agent-dag 3.2.0 → 3.3.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/README.md +18 -6
- package/bin/deck.js +9 -1
- package/dist/web/assets/index-GLqupad3.css +1 -0
- package/dist/web/assets/index-Z0vOy1A6.js +165 -0
- package/dist/web/index.html +2 -2
- package/hook/hook.js +60 -14
- package/package.json +6 -3
- package/release-notes.json +32 -0
- package/src/server/agent-activity.mjs +27 -11
- package/src/server/browser-history.mjs +31 -5
- package/src/server/browser-presence.mjs +57 -12
- package/src/server/browser-react.mjs +31 -9
- package/src/server/browser-watch-store.mjs +56 -2
- package/src/server/browser-watch.mjs +90 -10
- package/src/server/ccusage.mjs +95 -2
- package/src/server/codex-quota.mjs +6 -2
- package/src/server/codex-usage.mjs +24 -1
- package/src/server/cswap-admin.mjs +0 -14
- package/src/server/cswap-auto.mjs +39 -1
- package/src/server/cswap-install.mjs +6 -1
- package/src/server/exec.mjs +44 -0
- package/src/server/index.mjs +127 -11
- package/src/server/installer.mjs +58 -3
- package/src/server/macmon.mjs +17 -6
- package/src/server/npx.mjs +6 -1
- package/src/server/open-url.mjs +25 -4
- package/src/server/quota.mjs +88 -26
- package/src/server/retire-sound-hook.mjs +36 -2
- package/src/server/self-update.mjs +17 -5
- package/src/server/system-metrics.mjs +28 -36
- package/src/server/uv-bootstrap.mjs +39 -3
- package/dist/web/assets/index-7UsJp5Ht.js +0 -143
- package/dist/web/assets/index-Bnn7d7u8.css +0 -1
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))s(i);new MutationObserver(i=>{for(const a of i)if(a.type==="childList")for(const l of a.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&s(l)}).observe(document,{childList:!0,subtree:!0});function n(i){const a={};return i.integrity&&(a.integrity=i.integrity),i.referrerPolicy&&(a.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?a.credentials="include":i.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function s(i){if(i.ep)return;i.ep=!0;const a=n(i);fetch(i.href,a)}})();var Lc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Zy(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Tf={exports:{}},La={},Rf={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 Wx;function DA(){if(Wx)return Ve;Wx=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),l=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),g=Symbol.iterator;function y($){return $===null||typeof $!="object"?null:($=g&&$[g]||$["@@iterator"],typeof $=="function"?$:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},N=Object.assign,b={};function _($,G,Q){this.props=$,this.context=G,this.refs=b,this.updater=Q||w}_.prototype.isReactComponent={},_.prototype.setState=function($,G){if(typeof $!="object"&&typeof $!="function"&&$!=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,$,G,"setState")},_.prototype.forceUpdate=function($){this.updater.enqueueForceUpdate(this,$,"forceUpdate")};function k(){}k.prototype=_.prototype;function E($,G,Q){this.props=$,this.context=G,this.refs=b,this.updater=Q||w}var j=E.prototype=new k;j.constructor=E,N(j,_.prototype),j.isPureReactComponent=!0;var C=Array.isArray,I=Object.prototype.hasOwnProperty,P={current:null},O={key:!0,ref:!0,__self:!0,__source:!0};function F($,G,Q){var D,L={},K=null,se=null;if(G!=null)for(D in G.ref!==void 0&&(se=G.ref),G.key!==void 0&&(K=""+G.key),G)I.call(G,D)&&!O.hasOwnProperty(D)&&(L[D]=G[D]);var he=arguments.length-2;if(he===1)L.children=Q;else if(1<he){for(var pe=Array(he),re=0;re<he;re++)pe[re]=arguments[re+2];L.children=pe}if($&&$.defaultProps)for(D in he=$.defaultProps,he)L[D]===void 0&&(L[D]=he[D]);return{$$typeof:e,type:$,key:K,ref:se,props:L,_owner:P.current}}function M($,G){return{$$typeof:e,type:$.type,key:G,ref:$.ref,props:$.props,_owner:$._owner}}function A($){return typeof $=="object"&&$!==null&&$.$$typeof===e}function q($){var G={"=":"=0",":":"=2"};return"$"+$.replace(/[=:]/g,function(Q){return G[Q]})}var W=/\/+/g;function Y($,G){return typeof $=="object"&&$!==null&&$.key!=null?q(""+$.key):G.toString(36)}function T($,G,Q,D,L){var K=typeof $;(K==="undefined"||K==="boolean")&&($=null);var se=!1;if($===null)se=!0;else switch(K){case"string":case"number":se=!0;break;case"object":switch($.$$typeof){case e:case t:se=!0}}if(se)return se=$,L=L(se),$=D===""?"."+Y(se,0):D,C(L)?(Q="",$!=null&&(Q=$.replace(W,"$&/")+"/"),T(L,G,Q,"",function(re){return re})):L!=null&&(A(L)&&(L=M(L,Q+(!L.key||se&&se.key===L.key?"":(""+L.key).replace(W,"$&/")+"/")+$)),G.push(L)),1;if(se=0,D=D===""?".":D+":",C($))for(var he=0;he<$.length;he++){K=$[he];var pe=D+Y(K,he);se+=T(K,G,Q,pe,L)}else if(pe=y($),typeof pe=="function")for($=pe.call($),he=0;!(K=$.next()).done;)K=K.value,pe=D+Y(K,he++),se+=T(K,G,Q,pe,L);else if(K==="object")throw G=String($),Error("Objects are not valid as a React child (found: "+(G==="[object Object]"?"object with keys {"+Object.keys($).join(", ")+"}":G)+"). If you meant to render a collection of children, use an array instead.");return se}function Z($,G,Q){if($==null)return $;var D=[],L=0;return T($,D,"","",function(K){return G.call(Q,K,L++)}),D}function U($){if($._status===-1){var G=$._result;G=G(),G.then(function(Q){($._status===0||$._status===-1)&&($._status=1,$._result=Q)},function(Q){($._status===0||$._status===-1)&&($._status=2,$._result=Q)}),$._status===-1&&($._status=0,$._result=G)}if($._status===1)return $._result.default;throw $._result}var ne={current:null},X={transition:null},H={ReactCurrentDispatcher:ne,ReactCurrentBatchConfig:X,ReactCurrentOwner:P};function J(){throw Error("act(...) is not supported in production builds of React.")}return Ve.Children={map:Z,forEach:function($,G,Q){Z($,function(){G.apply(this,arguments)},Q)},count:function($){var G=0;return Z($,function(){G++}),G},toArray:function($){return Z($,function(G){return G})||[]},only:function($){if(!A($))throw Error("React.Children.only expected to receive a single React element child.");return $}},Ve.Component=_,Ve.Fragment=n,Ve.Profiler=i,Ve.PureComponent=E,Ve.StrictMode=s,Ve.Suspense=h,Ve.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=H,Ve.act=J,Ve.cloneElement=function($,G,Q){if($==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+$+".");var D=N({},$.props),L=$.key,K=$.ref,se=$._owner;if(G!=null){if(G.ref!==void 0&&(K=G.ref,se=P.current),G.key!==void 0&&(L=""+G.key),$.type&&$.type.defaultProps)var he=$.type.defaultProps;for(pe in G)I.call(G,pe)&&!O.hasOwnProperty(pe)&&(D[pe]=G[pe]===void 0&&he!==void 0?he[pe]:G[pe])}var pe=arguments.length-2;if(pe===1)D.children=Q;else if(1<pe){he=Array(pe);for(var re=0;re<pe;re++)he[re]=arguments[re+2];D.children=he}return{$$typeof:e,type:$.type,key:L,ref:K,props:D,_owner:se}},Ve.createContext=function($){return $={$$typeof:l,_currentValue:$,_currentValue2:$,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},$.Provider={$$typeof:a,_context:$},$.Consumer=$},Ve.createElement=F,Ve.createFactory=function($){var G=F.bind(null,$);return G.type=$,G},Ve.createRef=function(){return{current:null}},Ve.forwardRef=function($){return{$$typeof:u,render:$}},Ve.isValidElement=A,Ve.lazy=function($){return{$$typeof:f,_payload:{_status:-1,_result:$},_init:U}},Ve.memo=function($,G){return{$$typeof:p,type:$,compare:G===void 0?null:G}},Ve.startTransition=function($){var G=X.transition;X.transition={};try{$()}finally{X.transition=G}},Ve.unstable_act=J,Ve.useCallback=function($,G){return ne.current.useCallback($,G)},Ve.useContext=function($){return ne.current.useContext($)},Ve.useDebugValue=function(){},Ve.useDeferredValue=function($){return ne.current.useDeferredValue($)},Ve.useEffect=function($,G){return ne.current.useEffect($,G)},Ve.useId=function(){return ne.current.useId()},Ve.useImperativeHandle=function($,G,Q){return ne.current.useImperativeHandle($,G,Q)},Ve.useInsertionEffect=function($,G){return ne.current.useInsertionEffect($,G)},Ve.useLayoutEffect=function($,G){return ne.current.useLayoutEffect($,G)},Ve.useMemo=function($,G){return ne.current.useMemo($,G)},Ve.useReducer=function($,G,Q){return ne.current.useReducer($,G,Q)},Ve.useRef=function($){return ne.current.useRef($)},Ve.useState=function($){return ne.current.useState($)},Ve.useSyncExternalStore=function($,G,Q){return ne.current.useSyncExternalStore($,G,Q)},Ve.useTransition=function(){return ne.current.useTransition()},Ve.version="18.3.1",Ve}var Hx;function fl(){return Hx||(Hx=1,Rf.exports=DA()),Rf.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 Gx;function FA(){if(Gx)return La;Gx=1;var e=fl(),t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,i=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a={key:!0,ref:!0,__self:!0,__source:!0};function l(u,h,p){var f,g={},y=null,w=null;p!==void 0&&(y=""+p),h.key!==void 0&&(y=""+h.key),h.ref!==void 0&&(w=h.ref);for(f in h)s.call(h,f)&&!a.hasOwnProperty(f)&&(g[f]=h[f]);if(u&&u.defaultProps)for(f in h=u.defaultProps,h)g[f]===void 0&&(g[f]=h[f]);return{$$typeof:t,type:u,key:y,ref:w,props:g,_owner:i.current}}return La.Fragment=n,La.jsx=l,La.jsxs=l,La}var Vx;function zA(){return Vx||(Vx=1,Tf.exports=FA()),Tf.exports}var d=zA(),qc={},Af={exports:{}},fn={},Mf={exports:{}},If={};/**
|
|
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 Yx;function BA(){return Yx||(Yx=1,(function(e){function t(X,H){var J=X.length;X.push(H);e:for(;0<J;){var $=J-1>>>1,G=X[$];if(0<i(G,H))X[$]=H,X[J]=G,J=$;else break e}}function n(X){return X.length===0?null:X[0]}function s(X){if(X.length===0)return null;var H=X[0],J=X.pop();if(J!==H){X[0]=J;e:for(var $=0,G=X.length,Q=G>>>1;$<Q;){var D=2*($+1)-1,L=X[D],K=D+1,se=X[K];if(0>i(L,J))K<G&&0>i(se,L)?(X[$]=se,X[K]=J,$=K):(X[$]=L,X[D]=J,$=D);else if(K<G&&0>i(se,J))X[$]=se,X[K]=J,$=K;else break e}}return H}function i(X,H){var J=X.sortIndex-H.sortIndex;return J!==0?J:X.id-H.id}if(typeof performance=="object"&&typeof performance.now=="function"){var a=performance;e.unstable_now=function(){return a.now()}}else{var l=Date,u=l.now();e.unstable_now=function(){return l.now()-u}}var h=[],p=[],f=1,g=null,y=3,w=!1,N=!1,b=!1,_=typeof setTimeout=="function"?setTimeout:null,k=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 j(X){for(var H=n(p);H!==null;){if(H.callback===null)s(p);else if(H.startTime<=X)s(p),H.sortIndex=H.expirationTime,t(h,H);else break;H=n(p)}}function C(X){if(b=!1,j(X),!N)if(n(h)!==null)N=!0,U(I);else{var H=n(p);H!==null&&ne(C,H.startTime-X)}}function I(X,H){N=!1,b&&(b=!1,k(F),F=-1),w=!0;var J=y;try{for(j(H),g=n(h);g!==null&&(!(g.expirationTime>H)||X&&!q());){var $=g.callback;if(typeof $=="function"){g.callback=null,y=g.priorityLevel;var G=$(g.expirationTime<=H);H=e.unstable_now(),typeof G=="function"?g.callback=G:g===n(h)&&s(h),j(H)}else s(h);g=n(h)}if(g!==null)var Q=!0;else{var D=n(p);D!==null&&ne(C,D.startTime-H),Q=!1}return Q}finally{g=null,y=J,w=!1}}var P=!1,O=null,F=-1,M=5,A=-1;function q(){return!(e.unstable_now()-A<M)}function W(){if(O!==null){var X=e.unstable_now();A=X;var H=!0;try{H=O(!0,X)}finally{H?Y():(P=!1,O=null)}}else P=!1}var Y;if(typeof E=="function")Y=function(){E(W)};else if(typeof MessageChannel<"u"){var T=new MessageChannel,Z=T.port2;T.port1.onmessage=W,Y=function(){Z.postMessage(null)}}else Y=function(){_(W,0)};function U(X){O=X,P||(P=!0,Y())}function ne(X,H){F=_(function(){X(e.unstable_now())},H)}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(X){X.callback=null},e.unstable_continueExecution=function(){N||w||(N=!0,U(I))},e.unstable_forceFrameRate=function(X){0>X||125<X?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):M=0<X?Math.floor(1e3/X):5},e.unstable_getCurrentPriorityLevel=function(){return y},e.unstable_getFirstCallbackNode=function(){return n(h)},e.unstable_next=function(X){switch(y){case 1:case 2:case 3:var H=3;break;default:H=y}var J=y;y=H;try{return X()}finally{y=J}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(X,H){switch(X){case 1:case 2:case 3:case 4:case 5:break;default:X=3}var J=y;y=X;try{return H()}finally{y=J}},e.unstable_scheduleCallback=function(X,H,J){var $=e.unstable_now();switch(typeof J=="object"&&J!==null?(J=J.delay,J=typeof J=="number"&&0<J?$+J:$):J=$,X){case 1:var G=-1;break;case 2:G=250;break;case 5:G=1073741823;break;case 4:G=1e4;break;default:G=5e3}return G=J+G,X={id:f++,callback:H,priorityLevel:X,startTime:J,expirationTime:G,sortIndex:-1},J>$?(X.sortIndex=J,t(p,X),n(h)===null&&X===n(p)&&(b?(k(F),F=-1):b=!0,ne(C,J-$))):(X.sortIndex=G,t(h,X),N||w||(N=!0,U(I))),X},e.unstable_shouldYield=q,e.unstable_wrapCallback=function(X){var H=y;return function(){var J=y;y=H;try{return X.apply(this,arguments)}finally{y=J}}}})(If)),If}var Kx;function UA(){return Kx||(Kx=1,Mf.exports=BA()),Mf.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 Xx;function WA(){if(Xx)return fn;Xx=1;var e=fl(),t=UA();function n(r){for(var o="https://reactjs.org/docs/error-decoder.html?invariant="+r,c=1;c<arguments.length;c++)o+="&args[]="+encodeURIComponent(arguments[c]);return"Minified React error #"+r+"; visit "+o+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var s=new Set,i={};function a(r,o){l(r,o),l(r+"Capture",o)}function l(r,o){for(i[r]=o,r=0;r<o.length;r++)s.add(o[r])}var u=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),h=Object.prototype.hasOwnProperty,p=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,f={},g={};function y(r){return h.call(g,r)?!0:h.call(f,r)?!1:p.test(r)?g[r]=!0:(f[r]=!0,!1)}function w(r,o,c,m){if(c!==null&&c.type===0)return!1;switch(typeof o){case"function":case"symbol":return!0;case"boolean":return m?!1:c!==null?!c.acceptsBooleans:(r=r.toLowerCase().slice(0,5),r!=="data-"&&r!=="aria-");default:return!1}}function N(r,o,c,m){if(o===null||typeof o>"u"||w(r,o,c,m))return!0;if(m)return!1;if(c!==null)switch(c.type){case 3:return!o;case 4:return o===!1;case 5:return isNaN(o);case 6:return isNaN(o)||1>o}return!1}function b(r,o,c,m,v,x,R){this.acceptsBooleans=o===2||o===3||o===4,this.attributeName=m,this.attributeNamespace=v,this.mustUseProperty=c,this.propertyName=r,this.type=o,this.sanitizeURL=x,this.removeEmptyString=R}var _={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(r){_[r]=new b(r,0,!1,r,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(r){var o=r[0];_[o]=new b(o,1,!1,r[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(r){_[r]=new b(r,2,!1,r.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(r){_[r]=new b(r,2,!1,r,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(r){_[r]=new b(r,3,!1,r.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(r){_[r]=new b(r,3,!0,r,null,!1,!1)}),["capture","download"].forEach(function(r){_[r]=new b(r,4,!1,r,null,!1,!1)}),["cols","rows","size","span"].forEach(function(r){_[r]=new b(r,6,!1,r,null,!1,!1)}),["rowSpan","start"].forEach(function(r){_[r]=new b(r,5,!1,r.toLowerCase(),null,!1,!1)});var k=/[\-:]([a-z])/g;function E(r){return r[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(r){var o=r.replace(k,E);_[o]=new b(o,1,!1,r,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(r){var o=r.replace(k,E);_[o]=new b(o,1,!1,r,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(r){var o=r.replace(k,E);_[o]=new b(o,1,!1,r,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(r){_[r]=new b(r,1,!1,r.toLowerCase(),null,!1,!1)}),_.xlinkHref=new b("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(r){_[r]=new b(r,1,!1,r.toLowerCase(),null,!0,!0)});function j(r,o,c,m){var v=_.hasOwnProperty(o)?_[o]:null;(v!==null?v.type!==0:m||!(2<o.length)||o[0]!=="o"&&o[0]!=="O"||o[1]!=="n"&&o[1]!=="N")&&(N(o,c,v,m)&&(c=null),m||v===null?y(o)&&(c===null?r.removeAttribute(o):r.setAttribute(o,""+c)):v.mustUseProperty?r[v.propertyName]=c===null?v.type===3?!1:"":c:(o=v.attributeName,m=v.attributeNamespace,c===null?r.removeAttribute(o):(v=v.type,c=v===3||v===4&&c===!0?"":""+c,m?r.setAttributeNS(m,o,c):r.setAttribute(o,c))))}var C=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,I=Symbol.for("react.element"),P=Symbol.for("react.portal"),O=Symbol.for("react.fragment"),F=Symbol.for("react.strict_mode"),M=Symbol.for("react.profiler"),A=Symbol.for("react.provider"),q=Symbol.for("react.context"),W=Symbol.for("react.forward_ref"),Y=Symbol.for("react.suspense"),T=Symbol.for("react.suspense_list"),Z=Symbol.for("react.memo"),U=Symbol.for("react.lazy"),ne=Symbol.for("react.offscreen"),X=Symbol.iterator;function H(r){return r===null||typeof r!="object"?null:(r=X&&r[X]||r["@@iterator"],typeof r=="function"?r:null)}var J=Object.assign,$;function G(r){if($===void 0)try{throw Error()}catch(c){var o=c.stack.trim().match(/\n( *(at )?)/);$=o&&o[1]||""}return`
|
|
34
|
+
`+$+r}var Q=!1;function D(r,o){if(!r||Q)return"";Q=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(o)if(o=function(){throw Error()},Object.defineProperty(o.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(o,[])}catch(ue){var m=ue}Reflect.construct(r,[],o)}else{try{o.call()}catch(ue){m=ue}r.call(o.prototype)}else{try{throw Error()}catch(ue){m=ue}r()}}catch(ue){if(ue&&m&&typeof ue.stack=="string"){for(var v=ue.stack.split(`
|
|
35
|
+
`),x=m.stack.split(`
|
|
36
|
+
`),R=v.length-1,B=x.length-1;1<=R&&0<=B&&v[R]!==x[B];)B--;for(;1<=R&&0<=B;R--,B--)if(v[R]!==x[B]){if(R!==1||B!==1)do if(R--,B--,0>B||v[R]!==x[B]){var ee=`
|
|
37
|
+
`+v[R].replace(" at new "," at ");return r.displayName&&ee.includes("<anonymous>")&&(ee=ee.replace("<anonymous>",r.displayName)),ee}while(1<=R&&0<=B);break}}}finally{Q=!1,Error.prepareStackTrace=c}return(r=r?r.displayName||r.name:"")?G(r):""}function L(r){switch(r.tag){case 5:return G(r.type);case 16:return G("Lazy");case 13:return G("Suspense");case 19:return G("SuspenseList");case 0:case 2:case 15:return r=D(r.type,!1),r;case 11:return r=D(r.type.render,!1),r;case 1:return r=D(r.type,!0),r;default:return""}}function K(r){if(r==null)return null;if(typeof r=="function")return r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case O:return"Fragment";case P:return"Portal";case M:return"Profiler";case F:return"StrictMode";case Y:return"Suspense";case T:return"SuspenseList"}if(typeof r=="object")switch(r.$$typeof){case q:return(r.displayName||"Context")+".Consumer";case A:return(r._context.displayName||"Context")+".Provider";case W:var o=r.render;return r=r.displayName,r||(r=o.displayName||o.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case Z:return o=r.displayName||null,o!==null?o:K(r.type)||"Memo";case U:o=r._payload,r=r._init;try{return K(r(o))}catch{}}return null}function se(r){var o=r.type;switch(r.tag){case 24:return"Cache";case 9:return(o.displayName||"Context")+".Consumer";case 10:return(o._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return r=o.render,r=r.displayName||r.name||"",o.displayName||(r!==""?"ForwardRef("+r+")":"ForwardRef");case 7:return"Fragment";case 5:return o;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return K(o);case 8:return o===F?"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 o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o}return null}function he(r){switch(typeof r){case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function pe(r){var o=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(o==="checkbox"||o==="radio")}function re(r){var o=pe(r)?"checked":"value",c=Object.getOwnPropertyDescriptor(r.constructor.prototype,o),m=""+r[o];if(!r.hasOwnProperty(o)&&typeof c<"u"&&typeof c.get=="function"&&typeof c.set=="function"){var v=c.get,x=c.set;return Object.defineProperty(r,o,{configurable:!0,get:function(){return v.call(this)},set:function(R){m=""+R,x.call(this,R)}}),Object.defineProperty(r,o,{enumerable:c.enumerable}),{getValue:function(){return m},setValue:function(R){m=""+R},stopTracking:function(){r._valueTracker=null,delete r[o]}}}}function ve(r){r._valueTracker||(r._valueTracker=re(r))}function Te(r){if(!r)return!1;var o=r._valueTracker;if(!o)return!0;var c=o.getValue(),m="";return r&&(m=pe(r)?r.checked?"true":"false":r.value),r=m,r!==c?(o.setValue(r),!0):!1}function $e(r){if(r=r||(typeof document<"u"?document:void 0),typeof r>"u")return null;try{return r.activeElement||r.body}catch{return r.body}}function Me(r,o){var c=o.checked;return J({},o,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:c??r._wrapperState.initialChecked})}function _e(r,o){var c=o.defaultValue==null?"":o.defaultValue,m=o.checked!=null?o.checked:o.defaultChecked;c=he(o.value!=null?o.value:c),r._wrapperState={initialChecked:m,initialValue:c,controlled:o.type==="checkbox"||o.type==="radio"?o.checked!=null:o.value!=null}}function ae(r,o){o=o.checked,o!=null&&j(r,"checked",o,!1)}function we(r,o){ae(r,o);var c=he(o.value),m=o.type;if(c!=null)m==="number"?(c===0&&r.value===""||r.value!=c)&&(r.value=""+c):r.value!==""+c&&(r.value=""+c);else if(m==="submit"||m==="reset"){r.removeAttribute("value");return}o.hasOwnProperty("value")?Ue(r,o.type,c):o.hasOwnProperty("defaultValue")&&Ue(r,o.type,he(o.defaultValue)),o.checked==null&&o.defaultChecked!=null&&(r.defaultChecked=!!o.defaultChecked)}function be(r,o,c){if(o.hasOwnProperty("value")||o.hasOwnProperty("defaultValue")){var m=o.type;if(!(m!=="submit"&&m!=="reset"||o.value!==void 0&&o.value!==null))return;o=""+r._wrapperState.initialValue,c||o===r.value||(r.value=o),r.defaultValue=o}c=r.name,c!==""&&(r.name=""),r.defaultChecked=!!r._wrapperState.initialChecked,c!==""&&(r.name=c)}function Ue(r,o,c){(o!=="number"||$e(r.ownerDocument)!==r)&&(c==null?r.defaultValue=""+r._wrapperState.initialValue:r.defaultValue!==""+c&&(r.defaultValue=""+c))}var Ke=Array.isArray;function ut(r,o,c,m){if(r=r.options,o){o={};for(var v=0;v<c.length;v++)o["$"+c[v]]=!0;for(c=0;c<r.length;c++)v=o.hasOwnProperty("$"+r[c].value),r[c].selected!==v&&(r[c].selected=v),v&&m&&(r[c].defaultSelected=!0)}else{for(c=""+he(c),o=null,v=0;v<r.length;v++){if(r[v].value===c){r[v].selected=!0,m&&(r[v].defaultSelected=!0);return}o!==null||r[v].disabled||(o=r[v])}o!==null&&(o.selected=!0)}}function ot(r,o){if(o.dangerouslySetInnerHTML!=null)throw Error(n(91));return J({},o,{value:void 0,defaultValue:void 0,children:""+r._wrapperState.initialValue})}function He(r,o){var c=o.value;if(c==null){if(c=o.children,o=o.defaultValue,c!=null){if(o!=null)throw Error(n(92));if(Ke(c)){if(1<c.length)throw Error(n(93));c=c[0]}o=c}o==null&&(o=""),c=o}r._wrapperState={initialValue:he(c)}}function nt(r,o){var c=he(o.value),m=he(o.defaultValue);c!=null&&(c=""+c,c!==r.value&&(r.value=c),o.defaultValue==null&&r.defaultValue!==c&&(r.defaultValue=c)),m!=null&&(r.defaultValue=""+m)}function Xe(r){var o=r.textContent;o===r._wrapperState.initialValue&&o!==""&&o!==null&&(r.value=o)}function _t(r){switch(r){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 Oe(r,o){return r==null||r==="http://www.w3.org/1999/xhtml"?_t(o):r==="http://www.w3.org/2000/svg"&&o==="foreignObject"?"http://www.w3.org/1999/xhtml":r}var it,Mt=(function(r){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(o,c,m,v){MSApp.execUnsafeLocalFunction(function(){return r(o,c,m,v)})}:r})(function(r,o){if(r.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in r)r.innerHTML=o;else{for(it=it||document.createElement("div"),it.innerHTML="<svg>"+o.valueOf().toString()+"</svg>",o=it.firstChild;r.firstChild;)r.removeChild(r.firstChild);for(;o.firstChild;)r.appendChild(o.firstChild)}});function le(r,o){if(o){var c=r.firstChild;if(c&&c===r.lastChild&&c.nodeType===3){c.nodeValue=o;return}}r.textContent=o}var Le={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},Fe=["Webkit","ms","Moz","O"];Object.keys(Le).forEach(function(r){Fe.forEach(function(o){o=o+r.charAt(0).toUpperCase()+r.substring(1),Le[o]=Le[r]})});function Ee(r,o,c){return o==null||typeof o=="boolean"||o===""?"":c||typeof o!="number"||o===0||Le.hasOwnProperty(r)&&Le[r]?(""+o).trim():o+"px"}function Ge(r,o){r=r.style;for(var c in o)if(o.hasOwnProperty(c)){var m=c.indexOf("--")===0,v=Ee(c,o[c],m);c==="float"&&(c="cssFloat"),m?r.setProperty(c,v):r[c]=v}}var Et=J({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(r,o){if(o){if(Et[r]&&(o.children!=null||o.dangerouslySetInnerHTML!=null))throw Error(n(137,r));if(o.dangerouslySetInnerHTML!=null){if(o.children!=null)throw Error(n(60));if(typeof o.dangerouslySetInnerHTML!="object"||!("__html"in o.dangerouslySetInnerHTML))throw Error(n(61))}if(o.style!=null&&typeof o.style!="object")throw Error(n(62))}}function Re(r,o){if(r.indexOf("-")===-1)return typeof o.is=="string";switch(r){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 wt=null;function lt(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var kt=null,Nn=null,zn=null;function En(r){if(r=_a(r)){if(typeof kt!="function")throw Error(n(280));var o=r.stateNode;o&&(o=Zl(o),kt(r.stateNode,r.type,o))}}function jo(r){Nn?zn?zn.push(r):zn=[r]:Nn=r}function mn(){if(Nn){var r=Nn,o=zn;if(zn=Nn=null,En(r),o)for(r=0;r<o.length;r++)En(o[r])}}function Co(r,o){return r(o)}function To(){}var Bt=!1;function Cr(r,o,c){if(Bt)return r(o,c);Bt=!0;try{return Co(r,o,c)}finally{Bt=!1,(Nn!==null||zn!==null)&&(To(),mn())}}function Bn(r,o){var c=r.stateNode;if(c===null)return null;var m=Zl(c);if(m===null)return null;c=m[o];e:switch(o){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(m=!m.disabled)||(r=r.type,m=!(r==="button"||r==="input"||r==="select"||r==="textarea")),r=!m;break e;default:r=!1}if(r)return null;if(c&&typeof c!="function")throw Error(n(231,o,typeof c));return c}var Ps=!1;if(u)try{var Tr={};Object.defineProperty(Tr,"passive",{get:function(){Ps=!0}}),window.addEventListener("test",Tr,Tr),window.removeEventListener("test",Tr,Tr)}catch{Ps=!1}function Qi(r,o,c,m,v,x,R,B,ee){var ue=Array.prototype.slice.call(arguments,3);try{o.apply(c,ue)}catch(ge){this.onError(ge)}}var fr=!1,Rr=null,hr=!1,es=null,Ro={onError:function(r){fr=!0,Rr=r}};function Ao(r,o,c,m,v,x,R,B,ee){fr=!1,Rr=null,Qi.apply(Ro,arguments)}function Mo(r,o,c,m,v,x,R,B,ee){if(Ao.apply(this,arguments),fr){if(fr){var ue=Rr;fr=!1,Rr=null}else throw Error(n(198));hr||(hr=!0,es=ue)}}function jn(r){var o=r,c=r;if(r.alternate)for(;o.return;)o=o.return;else{r=o;do o=r,(o.flags&4098)!==0&&(c=o.return),r=o.return;while(r)}return o.tag===3?c:null}function Io(r){if(r.tag===13){var o=r.memoizedState;if(o===null&&(r=r.alternate,r!==null&&(o=r.memoizedState)),o!==null)return o.dehydrated}return null}function Ar(r){if(jn(r)!==r)throw Error(n(188))}function Oo(r){var o=r.alternate;if(!o){if(o=jn(r),o===null)throw Error(n(188));return o!==r?null:r}for(var c=r,m=o;;){var v=c.return;if(v===null)break;var x=v.alternate;if(x===null){if(m=v.return,m!==null){c=m;continue}break}if(v.child===x.child){for(x=v.child;x;){if(x===c)return Ar(v),r;if(x===m)return Ar(v),o;x=x.sibling}throw Error(n(188))}if(c.return!==m.return)c=v,m=x;else{for(var R=!1,B=v.child;B;){if(B===c){R=!0,c=v,m=x;break}if(B===m){R=!0,m=v,c=x;break}B=B.sibling}if(!R){for(B=x.child;B;){if(B===c){R=!0,c=x,m=v;break}if(B===m){R=!0,m=x,c=v;break}B=B.sibling}if(!R)throw Error(n(189))}}if(c.alternate!==m)throw Error(n(190))}if(c.tag!==3)throw Error(n(188));return c.stateNode.current===c?r:o}function Un(r){return r=Oo(r),r!==null?Po(r):null}function Po(r){if(r.tag===5||r.tag===6)return r;for(r=r.child;r!==null;){var o=Po(r);if(o!==null)return o;r=r.sibling}return null}var $s=t.unstable_scheduleCallback,Ls=t.unstable_cancelCallback,$o=t.unstable_shouldYield,Lo=t.unstable_requestPaint,rt=t.unstable_now,Zi=t.unstable_getCurrentPriorityLevel,ts=t.unstable_ImmediatePriority,Gt=t.unstable_UserBlockingPriority,Wn=t.unstable_NormalPriority,qo=t.unstable_LowPriority,ns=t.unstable_IdlePriority,pt=null,sn=null;function Hn(r){if(sn&&typeof sn.onCommitFiberRoot=="function")try{sn.onCommitFiberRoot(pt,r,void 0,(r.current.flags&128)===128)}catch{}}var gn=Math.clz32?Math.clz32:Do,nd=Math.log,Mr=Math.LN2;function Do(r){return r>>>=0,r===0?32:31-(nd(r)/Mr|0)|0}var Fo=64,zo=4194304;function rs(r){switch(r&-r){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 r&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return r&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return r}}function qs(r,o){var c=r.pendingLanes;if(c===0)return 0;var m=0,v=r.suspendedLanes,x=r.pingedLanes,R=c&268435455;if(R!==0){var B=R&~v;B!==0?m=rs(B):(x&=R,x!==0&&(m=rs(x)))}else R=c&~v,R!==0?m=rs(R):x!==0&&(m=rs(x));if(m===0)return 0;if(o!==0&&o!==m&&(o&v)===0&&(v=m&-m,x=o&-o,v>=x||v===16&&(x&4194240)!==0))return o;if((m&4)!==0&&(m|=c&16),o=r.entangledLanes,o!==0)for(r=r.entanglements,o&=m;0<o;)c=31-gn(o),v=1<<c,m|=r[c],o&=~v;return m}function ss(r,o){switch(r){case 1:case 2:case 4:return o+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 o+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 jl(r,o){for(var c=r.suspendedLanes,m=r.pingedLanes,v=r.expirationTimes,x=r.pendingLanes;0<x;){var R=31-gn(x),B=1<<R,ee=v[R];ee===-1?((B&c)===0||(B&m)!==0)&&(v[R]=ss(B,o)):ee<=o&&(r.expiredLanes|=B),x&=~B}}function Bo(r){return r=r.pendingLanes&-1073741825,r!==0?r:r&1073741824?1073741824:0}function Ds(){var r=Fo;return Fo<<=1,(Fo&4194240)===0&&(Fo=64),r}function Uo(r){for(var o=[],c=0;31>c;c++)o.push(r);return o}function os(r,o,c){r.pendingLanes|=o,o!==536870912&&(r.suspendedLanes=0,r.pingedLanes=0),r=r.eventTimes,o=31-gn(o),r[o]=c}function Jt(r,o){var c=r.pendingLanes&~o;r.pendingLanes=o,r.suspendedLanes=0,r.pingedLanes=0,r.expiredLanes&=o,r.mutableReadLanes&=o,r.entangledLanes&=o,o=r.entanglements;var m=r.eventTimes;for(r=r.expirationTimes;0<c;){var v=31-gn(c),x=1<<v;o[v]=0,m[v]=-1,r[v]=-1,c&=~x}}function is(r,o){var c=r.entangledLanes|=o;for(r=r.entanglements;c;){var m=31-gn(c),v=1<<m;v&o|r[m]&o&&(r[m]|=o),c&=~v}}var Qe=0;function Ji(r){return r&=-r,1<r?4<r?(r&268435455)!==0?16:536870912:4:1}var Cl,Ir,ea,Gn,Tl,Wo=!1,Ho=[],pr=null,Vn=null,mr=null,vn=new Map,Yn=new Map,Kn=[],ta="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 Xn(r,o){switch(r){case"focusin":case"focusout":pr=null;break;case"dragenter":case"dragleave":Vn=null;break;case"mouseover":case"mouseout":mr=null;break;case"pointerover":case"pointerout":vn.delete(o.pointerId);break;case"gotpointercapture":case"lostpointercapture":Yn.delete(o.pointerId)}}function Fs(r,o,c,m,v,x){return r===null||r.nativeEvent!==x?(r={blockedOn:o,domEventName:c,eventSystemFlags:m,nativeEvent:x,targetContainers:[v]},o!==null&&(o=_a(o),o!==null&&Ir(o)),r):(r.eventSystemFlags|=m,o=r.targetContainers,v!==null&&o.indexOf(v)===-1&&o.push(v),r)}function Cn(r,o,c,m,v){switch(o){case"focusin":return pr=Fs(pr,r,o,c,m,v),!0;case"dragenter":return Vn=Fs(Vn,r,o,c,m,v),!0;case"mouseover":return mr=Fs(mr,r,o,c,m,v),!0;case"pointerover":var x=v.pointerId;return vn.set(x,Fs(vn.get(x)||null,r,o,c,m,v)),!0;case"gotpointercapture":return x=v.pointerId,Yn.set(x,Fs(Yn.get(x)||null,r,o,c,m,v)),!0}return!1}function Go(r){var o=eo(r.target);if(o!==null){var c=jn(o);if(c!==null){if(o=c.tag,o===13){if(o=Io(c),o!==null){r.blockedOn=o,Tl(r.priority,function(){ea(c)});return}}else if(o===3&&c.stateNode.current.memoizedState.isDehydrated){r.blockedOn=c.tag===3?c.stateNode.containerInfo:null;return}}}r.blockedOn=null}function as(r){if(r.blockedOn!==null)return!1;for(var o=r.targetContainers;0<o.length;){var c=Yo(r.domEventName,r.eventSystemFlags,o[0],r.nativeEvent);if(c===null){c=r.nativeEvent;var m=new c.constructor(c.type,c);wt=m,c.target.dispatchEvent(m),wt=null}else return o=_a(c),o!==null&&Ir(o),r.blockedOn=c,!1;o.shift()}return!0}function na(r,o,c){as(r)&&c.delete(o)}function Vo(){Wo=!1,pr!==null&&as(pr)&&(pr=null),Vn!==null&&as(Vn)&&(Vn=null),mr!==null&&as(mr)&&(mr=null),vn.forEach(na),Yn.forEach(na)}function Or(r,o){r.blockedOn===o&&(r.blockedOn=null,Wo||(Wo=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Vo)))}function ls(r){function o(v){return Or(v,r)}if(0<Ho.length){Or(Ho[0],r);for(var c=1;c<Ho.length;c++){var m=Ho[c];m.blockedOn===r&&(m.blockedOn=null)}}for(pr!==null&&Or(pr,r),Vn!==null&&Or(Vn,r),mr!==null&&Or(mr,r),vn.forEach(o),Yn.forEach(o),c=0;c<Kn.length;c++)m=Kn[c],m.blockedOn===r&&(m.blockedOn=null);for(;0<Kn.length&&(c=Kn[0],c.blockedOn===null);)Go(c),c.blockedOn===null&&Kn.shift()}var gr=C.ReactCurrentBatchConfig,zs=!0;function ra(r,o,c,m){var v=Qe,x=gr.transition;gr.transition=null;try{Qe=1,vr(r,o,c,m)}finally{Qe=v,gr.transition=x}}function Rl(r,o,c,m){var v=Qe,x=gr.transition;gr.transition=null;try{Qe=4,vr(r,o,c,m)}finally{Qe=v,gr.transition=x}}function vr(r,o,c,m){if(zs){var v=Yo(r,o,c,m);if(v===null)yd(r,o,m,Bs,c),Xn(r,m);else if(Cn(v,r,o,c,m))m.stopPropagation();else if(Xn(r,m),o&4&&-1<ta.indexOf(r)){for(;v!==null;){var x=_a(v);if(x!==null&&Cl(x),x=Yo(r,o,c,m),x===null&&yd(r,o,m,Bs,c),x===v)break;v=x}v!==null&&m.stopPropagation()}else yd(r,o,m,null,c)}}var Bs=null;function Yo(r,o,c,m){if(Bs=null,r=lt(m),r=eo(r),r!==null)if(o=jn(r),o===null)r=null;else if(c=o.tag,c===13){if(r=Io(o),r!==null)return r;r=null}else if(c===3){if(o.stateNode.current.memoizedState.isDehydrated)return o.tag===3?o.stateNode.containerInfo:null;r=null}else o!==r&&(r=null);return Bs=r,null}function Ko(r){switch(r){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(Zi()){case ts:return 1;case Gt:return 4;case Wn:case qo:return 16;case ns:return 536870912;default:return 16}default:return 16}}var yr=null,Us=null,Qn=null;function sa(){if(Qn)return Qn;var r,o=Us,c=o.length,m,v="value"in yr?yr.value:yr.textContent,x=v.length;for(r=0;r<c&&o[r]===v[r];r++);var R=c-r;for(m=1;m<=R&&o[c-m]===v[x-m];m++);return Qn=v.slice(r,1<m?1-m:void 0)}function Xo(r){var o=r.keyCode;return"charCode"in r?(r=r.charCode,r===0&&o===13&&(r=13)):r=o,r===10&&(r=13),32<=r||r===13?r:0}function Ws(){return!0}function oa(){return!1}function en(r){function o(c,m,v,x,R){this._reactName=c,this._targetInst=v,this.type=m,this.nativeEvent=x,this.target=R,this.currentTarget=null;for(var B in r)r.hasOwnProperty(B)&&(c=r[B],this[B]=c?c(x):x[B]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?Ws:oa,this.isPropagationStopped=oa,this}return J(o.prototype,{preventDefault:function(){this.defaultPrevented=!0;var c=this.nativeEvent;c&&(c.preventDefault?c.preventDefault():typeof c.returnValue!="unknown"&&(c.returnValue=!1),this.isDefaultPrevented=Ws)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=Ws)},persist:function(){},isPersistent:Ws}),o}var It={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ia=en(It),Pr=J({},It,{view:0,detail:0}),cs=en(Pr),$r,Hs,Lr,Gs=J({},Pr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Tn,button:0,buttons:0,relatedTarget:function(r){return r.relatedTarget===void 0?r.fromElement===r.srcElement?r.toElement:r.fromElement:r.relatedTarget},movementX:function(r){return"movementX"in r?r.movementX:(r!==Lr&&(Lr&&r.type==="mousemove"?($r=r.screenX-Lr.screenX,Hs=r.screenY-Lr.screenY):Hs=$r=0,Lr=r),$r)},movementY:function(r){return"movementY"in r?r.movementY:Hs}}),Vs=en(Gs),Al=J({},Gs,{dataTransfer:0}),rd=en(Al),sd=J({},Pr,{relatedTarget:0}),Qo=en(sd),od=J({},It,{animationName:0,elapsedTime:0,pseudoElement:0}),id=en(od),aa=J({},It,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),wr=en(aa),la=J({},It,{data:0}),ca=en(la),ad={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},ld={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"},Ml={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Il(r){var o=this.nativeEvent;return o.getModifierState?o.getModifierState(r):(r=Ml[r])?!!o[r]:!1}function Tn(){return Il}var cd=J({},Pr,{key:function(r){if(r.key){var o=ad[r.key]||r.key;if(o!=="Unidentified")return o}return r.type==="keypress"?(r=Xo(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?ld[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Tn,charCode:function(r){return r.type==="keypress"?Xo(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?Xo(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),Ol=en(cd),ud=J({},Gs,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Ys=en(ud),dd=J({},Pr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Tn}),tn=en(dd),ua=J({},It,{propertyName:0,elapsedTime:0,pseudoElement:0}),Pl=en(ua),$l=J({},Gs,{deltaX:function(r){return"deltaX"in r?r.deltaX:"wheelDeltaX"in r?-r.wheelDeltaX:0},deltaY:function(r){return"deltaY"in r?r.deltaY:"wheelDeltaY"in r?-r.wheelDeltaY:"wheelDelta"in r?-r.wheelDelta:0},deltaZ:0,deltaMode:0}),Ll=en($l),da=[9,13,27,32],us=u&&"CompositionEvent"in window,qr=null;u&&"documentMode"in document&&(qr=document.documentMode);var ql=u&&"TextEvent"in window&&!qr,Ks=u&&(!us||qr&&8<qr&&11>=qr),fa=" ",Zo=!1;function ha(r,o){switch(r){case"keyup":return da.indexOf(o.keyCode)!==-1;case"keydown":return o.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Jo(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var Vt=!1;function Dl(r,o){switch(r){case"compositionend":return Jo(o);case"keypress":return o.which!==32?null:(Zo=!0,fa);case"textInput":return r=o.data,r===fa&&Zo?null:r;default:return null}}function Fl(r,o){if(Vt)return r==="compositionend"||!us&&ha(r,o)?(r=sa(),Qn=Us=yr=null,Vt=!1,r):null;switch(r){case"paste":return null;case"keypress":if(!(o.ctrlKey||o.altKey||o.metaKey)||o.ctrlKey&&o.altKey){if(o.char&&1<o.char.length)return o.char;if(o.which)return String.fromCharCode(o.which)}return null;case"compositionend":return Ks&&o.locale!=="ko"?null:o.data;default:return null}}var fd={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 zl(r){var o=r&&r.nodeName&&r.nodeName.toLowerCase();return o==="input"?!!fd[r.type]:o==="textarea"}function pa(r,o,c,m){jo(m),o=Kl(o,"onChange"),0<o.length&&(c=new ia("onChange","change",null,c,m),r.push({event:c,listeners:o}))}var Lt=null,ds=null;function Bl(r){i0(r,0)}function Xs(r){var o=si(r);if(Te(o))return r}function Ul(r,o){if(r==="change")return o}var z=!1;if(u){var V;if(u){var ce="oninput"in document;if(!ce){var fe=document.createElement("div");fe.setAttribute("oninput","return;"),ce=typeof fe.oninput=="function"}V=ce}else V=!1;z=V&&(!document.documentMode||9<document.documentMode)}function ke(){Lt&&(Lt.detachEvent("onpropertychange",Ce),ds=Lt=null)}function Ce(r){if(r.propertyName==="value"&&Xs(ds)){var o=[];pa(o,ds,r,lt(r)),Cr(Bl,o)}}function Be(r,o,c){r==="focusin"?(ke(),Lt=o,ds=c,Lt.attachEvent("onpropertychange",Ce)):r==="focusout"&&ke()}function Je(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return Xs(ds)}function mt(r,o){if(r==="click")return Xs(o)}function at(r,o){if(r==="input"||r==="change")return Xs(o)}function on(r,o){return r===o&&(r!==0||1/r===1/o)||r!==r&&o!==o}var Yt=typeof Object.is=="function"?Object.is:on;function fs(r,o){if(Yt(r,o))return!0;if(typeof r!="object"||r===null||typeof o!="object"||o===null)return!1;var c=Object.keys(r),m=Object.keys(o);if(c.length!==m.length)return!1;for(m=0;m<c.length;m++){var v=c[m];if(!h.call(o,v)||!Yt(r[v],o[v]))return!1}return!0}function Wl(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function ma(r,o){var c=Wl(r);r=0;for(var m;c;){if(c.nodeType===3){if(m=r+c.textContent.length,r<=o&&m>=o)return{node:c,offset:o-r};r=m}e:{for(;c;){if(c.nextSibling){c=c.nextSibling;break e}c=c.parentNode}c=void 0}c=Wl(c)}}function Hl(r,o){return r&&o?r===o?!0:r&&r.nodeType===3?!1:o&&o.nodeType===3?Hl(r,o.parentNode):"contains"in r?r.contains(o):r.compareDocumentPosition?!!(r.compareDocumentPosition(o)&16):!1:!1}function ga(){for(var r=window,o=$e();o instanceof r.HTMLIFrameElement;){try{var c=typeof o.contentWindow.location.href=="string"}catch{c=!1}if(c)r=o.contentWindow;else break;o=$e(r.document)}return o}function Qs(r){var o=r&&r.nodeName&&r.nodeName.toLowerCase();return o&&(o==="input"&&(r.type==="text"||r.type==="search"||r.type==="tel"||r.type==="url"||r.type==="password")||o==="textarea"||r.contentEditable==="true")}function Zs(r){var o=ga(),c=r.focusedElem,m=r.selectionRange;if(o!==c&&c&&c.ownerDocument&&Hl(c.ownerDocument.documentElement,c)){if(m!==null&&Qs(c)){if(o=m.start,r=m.end,r===void 0&&(r=o),"selectionStart"in c)c.selectionStart=o,c.selectionEnd=Math.min(r,c.value.length);else if(r=(o=c.ownerDocument||document)&&o.defaultView||window,r.getSelection){r=r.getSelection();var v=c.textContent.length,x=Math.min(m.start,v);m=m.end===void 0?x:Math.min(m.end,v),!r.extend&&x>m&&(v=m,m=x,x=v),v=ma(c,x);var R=ma(c,m);v&&R&&(r.rangeCount!==1||r.anchorNode!==v.node||r.anchorOffset!==v.offset||r.focusNode!==R.node||r.focusOffset!==R.offset)&&(o=o.createRange(),o.setStart(v.node,v.offset),r.removeAllRanges(),x>m?(r.addRange(o),r.extend(R.node,R.offset)):(o.setEnd(R.node,R.offset),r.addRange(o)))}}for(o=[],r=c;r=r.parentNode;)r.nodeType===1&&o.push({element:r,left:r.scrollLeft,top:r.scrollTop});for(typeof c.focus=="function"&&c.focus(),c=0;c<o.length;c++)r=o[c],r.element.scrollLeft=r.left,r.element.scrollTop=r.top}}var Js=u&&"documentMode"in document&&11>=document.documentMode,dt=null,ei=null,va=null,hd=!1;function Qw(r,o,c){var m=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;hd||dt==null||dt!==$e(m)||(m=dt,"selectionStart"in m&&Qs(m)?m={start:m.selectionStart,end:m.selectionEnd}:(m=(m.ownerDocument&&m.ownerDocument.defaultView||window).getSelection(),m={anchorNode:m.anchorNode,anchorOffset:m.anchorOffset,focusNode:m.focusNode,focusOffset:m.focusOffset}),va&&fs(va,m)||(va=m,m=Kl(ei,"onSelect"),0<m.length&&(o=new ia("onSelect","select",null,o,c),r.push({event:o,listeners:m}),o.target=dt)))}function Gl(r,o){var c={};return c[r.toLowerCase()]=o.toLowerCase(),c["Webkit"+r]="webkit"+o,c["Moz"+r]="moz"+o,c}var ti={animationend:Gl("Animation","AnimationEnd"),animationiteration:Gl("Animation","AnimationIteration"),animationstart:Gl("Animation","AnimationStart"),transitionend:Gl("Transition","TransitionEnd")},pd={},Zw={};u&&(Zw=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 Vl(r){if(pd[r])return pd[r];if(!ti[r])return r;var o=ti[r],c;for(c in o)if(o.hasOwnProperty(c)&&c in Zw)return pd[r]=o[c];return r}var Jw=Vl("animationend"),e0=Vl("animationiteration"),t0=Vl("animationstart"),n0=Vl("transitionend"),r0=new Map,s0="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 hs(r,o){r0.set(r,o),a(o,[r])}for(var md=0;md<s0.length;md++){var gd=s0[md],YR=gd.toLowerCase(),KR=gd[0].toUpperCase()+gd.slice(1);hs(YR,"on"+KR)}hs(Jw,"onAnimationEnd"),hs(e0,"onAnimationIteration"),hs(t0,"onAnimationStart"),hs("dblclick","onDoubleClick"),hs("focusin","onFocus"),hs("focusout","onBlur"),hs(n0,"onTransitionEnd"),l("onMouseEnter",["mouseout","mouseover"]),l("onMouseLeave",["mouseout","mouseover"]),l("onPointerEnter",["pointerout","pointerover"]),l("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 ya="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(" "),XR=new Set("cancel close invalid load scroll toggle".split(" ").concat(ya));function o0(r,o,c){var m=r.type||"unknown-event";r.currentTarget=c,Mo(m,o,void 0,r),r.currentTarget=null}function i0(r,o){o=(o&4)!==0;for(var c=0;c<r.length;c++){var m=r[c],v=m.event;m=m.listeners;e:{var x=void 0;if(o)for(var R=m.length-1;0<=R;R--){var B=m[R],ee=B.instance,ue=B.currentTarget;if(B=B.listener,ee!==x&&v.isPropagationStopped())break e;o0(v,B,ue),x=ee}else for(R=0;R<m.length;R++){if(B=m[R],ee=B.instance,ue=B.currentTarget,B=B.listener,ee!==x&&v.isPropagationStopped())break e;o0(v,B,ue),x=ee}}}if(hr)throw r=es,hr=!1,es=null,r}function ft(r,o){var c=o[Sd];c===void 0&&(c=o[Sd]=new Set);var m=r+"__bubble";c.has(m)||(a0(o,r,2,!1),c.add(m))}function vd(r,o,c){var m=0;o&&(m|=4),a0(c,r,m,o)}var Yl="_reactListening"+Math.random().toString(36).slice(2);function wa(r){if(!r[Yl]){r[Yl]=!0,s.forEach(function(c){c!=="selectionchange"&&(XR.has(c)||vd(c,!1,r),vd(c,!0,r))});var o=r.nodeType===9?r:r.ownerDocument;o===null||o[Yl]||(o[Yl]=!0,vd("selectionchange",!1,o))}}function a0(r,o,c,m){switch(Ko(o)){case 1:var v=ra;break;case 4:v=Rl;break;default:v=vr}c=v.bind(null,o,c,r),v=void 0,!Ps||o!=="touchstart"&&o!=="touchmove"&&o!=="wheel"||(v=!0),m?v!==void 0?r.addEventListener(o,c,{capture:!0,passive:v}):r.addEventListener(o,c,!0):v!==void 0?r.addEventListener(o,c,{passive:v}):r.addEventListener(o,c,!1)}function yd(r,o,c,m,v){var x=m;if((o&1)===0&&(o&2)===0&&m!==null)e:for(;;){if(m===null)return;var R=m.tag;if(R===3||R===4){var B=m.stateNode.containerInfo;if(B===v||B.nodeType===8&&B.parentNode===v)break;if(R===4)for(R=m.return;R!==null;){var ee=R.tag;if((ee===3||ee===4)&&(ee=R.stateNode.containerInfo,ee===v||ee.nodeType===8&&ee.parentNode===v))return;R=R.return}for(;B!==null;){if(R=eo(B),R===null)return;if(ee=R.tag,ee===5||ee===6){m=x=R;continue e}B=B.parentNode}}m=m.return}Cr(function(){var ue=x,ge=lt(c),ye=[];e:{var me=r0.get(r);if(me!==void 0){var Se=ia,je=r;switch(r){case"keypress":if(Xo(c)===0)break e;case"keydown":case"keyup":Se=Ol;break;case"focusin":je="focus",Se=Qo;break;case"focusout":je="blur",Se=Qo;break;case"beforeblur":case"afterblur":Se=Qo;break;case"click":if(c.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Se=Vs;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Se=rd;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Se=tn;break;case Jw:case e0:case t0:Se=id;break;case n0:Se=Pl;break;case"scroll":Se=cs;break;case"wheel":Se=Ll;break;case"copy":case"cut":case"paste":Se=wr;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Se=Ys}var Ae=(o&4)!==0,jt=!Ae&&r==="scroll",oe=Ae?me!==null?me+"Capture":null:me;Ae=[];for(var te=ue,ie;te!==null;){ie=te;var xe=ie.stateNode;if(ie.tag===5&&xe!==null&&(ie=xe,oe!==null&&(xe=Bn(te,oe),xe!=null&&Ae.push(xa(te,xe,ie)))),jt)break;te=te.return}0<Ae.length&&(me=new Se(me,je,null,c,ge),ye.push({event:me,listeners:Ae}))}}if((o&7)===0){e:{if(me=r==="mouseover"||r==="pointerover",Se=r==="mouseout"||r==="pointerout",me&&c!==wt&&(je=c.relatedTarget||c.fromElement)&&(eo(je)||je[Dr]))break e;if((Se||me)&&(me=ge.window===ge?ge:(me=ge.ownerDocument)?me.defaultView||me.parentWindow:window,Se?(je=c.relatedTarget||c.toElement,Se=ue,je=je?eo(je):null,je!==null&&(jt=jn(je),je!==jt||je.tag!==5&&je.tag!==6)&&(je=null)):(Se=null,je=ue),Se!==je)){if(Ae=Vs,xe="onMouseLeave",oe="onMouseEnter",te="mouse",(r==="pointerout"||r==="pointerover")&&(Ae=Ys,xe="onPointerLeave",oe="onPointerEnter",te="pointer"),jt=Se==null?me:si(Se),ie=je==null?me:si(je),me=new Ae(xe,te+"leave",Se,c,ge),me.target=jt,me.relatedTarget=ie,xe=null,eo(ge)===ue&&(Ae=new Ae(oe,te+"enter",je,c,ge),Ae.target=ie,Ae.relatedTarget=jt,xe=Ae),jt=xe,Se&&je)t:{for(Ae=Se,oe=je,te=0,ie=Ae;ie;ie=ni(ie))te++;for(ie=0,xe=oe;xe;xe=ni(xe))ie++;for(;0<te-ie;)Ae=ni(Ae),te--;for(;0<ie-te;)oe=ni(oe),ie--;for(;te--;){if(Ae===oe||oe!==null&&Ae===oe.alternate)break t;Ae=ni(Ae),oe=ni(oe)}Ae=null}else Ae=null;Se!==null&&l0(ye,me,Se,Ae,!1),je!==null&&jt!==null&&l0(ye,jt,je,Ae,!0)}}e:{if(me=ue?si(ue):window,Se=me.nodeName&&me.nodeName.toLowerCase(),Se==="select"||Se==="input"&&me.type==="file")var Ie=Ul;else if(zl(me))if(z)Ie=at;else{Ie=Je;var qe=Be}else(Se=me.nodeName)&&Se.toLowerCase()==="input"&&(me.type==="checkbox"||me.type==="radio")&&(Ie=mt);if(Ie&&(Ie=Ie(r,ue))){pa(ye,Ie,c,ge);break e}qe&&qe(r,me,ue),r==="focusout"&&(qe=me._wrapperState)&&qe.controlled&&me.type==="number"&&Ue(me,"number",me.value)}switch(qe=ue?si(ue):window,r){case"focusin":(zl(qe)||qe.contentEditable==="true")&&(dt=qe,ei=ue,va=null);break;case"focusout":va=ei=dt=null;break;case"mousedown":hd=!0;break;case"contextmenu":case"mouseup":case"dragend":hd=!1,Qw(ye,c,ge);break;case"selectionchange":if(Js)break;case"keydown":case"keyup":Qw(ye,c,ge)}var De;if(us)e:{switch(r){case"compositionstart":var ze="onCompositionStart";break e;case"compositionend":ze="onCompositionEnd";break e;case"compositionupdate":ze="onCompositionUpdate";break e}ze=void 0}else Vt?ha(r,c)&&(ze="onCompositionEnd"):r==="keydown"&&c.keyCode===229&&(ze="onCompositionStart");ze&&(Ks&&c.locale!=="ko"&&(Vt||ze!=="onCompositionStart"?ze==="onCompositionEnd"&&Vt&&(De=sa()):(yr=ge,Us="value"in yr?yr.value:yr.textContent,Vt=!0)),qe=Kl(ue,ze),0<qe.length&&(ze=new ca(ze,r,null,c,ge),ye.push({event:ze,listeners:qe}),De?ze.data=De:(De=Jo(c),De!==null&&(ze.data=De)))),(De=ql?Dl(r,c):Fl(r,c))&&(ue=Kl(ue,"onBeforeInput"),0<ue.length&&(ge=new ca("onBeforeInput","beforeinput",null,c,ge),ye.push({event:ge,listeners:ue}),ge.data=De))}i0(ye,o)})}function xa(r,o,c){return{instance:r,listener:o,currentTarget:c}}function Kl(r,o){for(var c=o+"Capture",m=[];r!==null;){var v=r,x=v.stateNode;v.tag===5&&x!==null&&(v=x,x=Bn(r,c),x!=null&&m.unshift(xa(r,x,v)),x=Bn(r,o),x!=null&&m.push(xa(r,x,v))),r=r.return}return m}function ni(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5);return r||null}function l0(r,o,c,m,v){for(var x=o._reactName,R=[];c!==null&&c!==m;){var B=c,ee=B.alternate,ue=B.stateNode;if(ee!==null&&ee===m)break;B.tag===5&&ue!==null&&(B=ue,v?(ee=Bn(c,x),ee!=null&&R.unshift(xa(c,ee,B))):v||(ee=Bn(c,x),ee!=null&&R.push(xa(c,ee,B)))),c=c.return}R.length!==0&&r.push({event:o,listeners:R})}var QR=/\r\n?/g,ZR=/\u0000|\uFFFD/g;function c0(r){return(typeof r=="string"?r:""+r).replace(QR,`
|
|
38
|
+
`).replace(ZR,"")}function Xl(r,o,c){if(o=c0(o),c0(r)!==o&&c)throw Error(n(425))}function Ql(){}var wd=null,xd=null;function bd(r,o){return r==="textarea"||r==="noscript"||typeof o.children=="string"||typeof o.children=="number"||typeof o.dangerouslySetInnerHTML=="object"&&o.dangerouslySetInnerHTML!==null&&o.dangerouslySetInnerHTML.__html!=null}var _d=typeof setTimeout=="function"?setTimeout:void 0,JR=typeof clearTimeout=="function"?clearTimeout:void 0,u0=typeof Promise=="function"?Promise:void 0,eA=typeof queueMicrotask=="function"?queueMicrotask:typeof u0<"u"?function(r){return u0.resolve(null).then(r).catch(tA)}:_d;function tA(r){setTimeout(function(){throw r})}function kd(r,o){var c=o,m=0;do{var v=c.nextSibling;if(r.removeChild(c),v&&v.nodeType===8)if(c=v.data,c==="/$"){if(m===0){r.removeChild(v),ls(o);return}m--}else c!=="$"&&c!=="$?"&&c!=="$!"||m++;c=v}while(c);ls(o)}function ps(r){for(;r!=null;r=r.nextSibling){var o=r.nodeType;if(o===1||o===3)break;if(o===8){if(o=r.data,o==="$"||o==="$!"||o==="$?")break;if(o==="/$")return null}}return r}function d0(r){r=r.previousSibling;for(var o=0;r;){if(r.nodeType===8){var c=r.data;if(c==="$"||c==="$!"||c==="$?"){if(o===0)return r;o--}else c==="/$"&&o++}r=r.previousSibling}return null}var ri=Math.random().toString(36).slice(2),xr="__reactFiber$"+ri,ba="__reactProps$"+ri,Dr="__reactContainer$"+ri,Sd="__reactEvents$"+ri,nA="__reactListeners$"+ri,rA="__reactHandles$"+ri;function eo(r){var o=r[xr];if(o)return o;for(var c=r.parentNode;c;){if(o=c[Dr]||c[xr]){if(c=o.alternate,o.child!==null||c!==null&&c.child!==null)for(r=d0(r);r!==null;){if(c=r[xr])return c;r=d0(r)}return o}r=c,c=r.parentNode}return null}function _a(r){return r=r[xr]||r[Dr],!r||r.tag!==5&&r.tag!==6&&r.tag!==13&&r.tag!==3?null:r}function si(r){if(r.tag===5||r.tag===6)return r.stateNode;throw Error(n(33))}function Zl(r){return r[ba]||null}var Nd=[],oi=-1;function ms(r){return{current:r}}function ht(r){0>oi||(r.current=Nd[oi],Nd[oi]=null,oi--)}function ct(r,o){oi++,Nd[oi]=r.current,r.current=o}var gs={},Kt=ms(gs),an=ms(!1),to=gs;function ii(r,o){var c=r.type.contextTypes;if(!c)return gs;var m=r.stateNode;if(m&&m.__reactInternalMemoizedUnmaskedChildContext===o)return m.__reactInternalMemoizedMaskedChildContext;var v={},x;for(x in c)v[x]=o[x];return m&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=o,r.__reactInternalMemoizedMaskedChildContext=v),v}function ln(r){return r=r.childContextTypes,r!=null}function Jl(){ht(an),ht(Kt)}function f0(r,o,c){if(Kt.current!==gs)throw Error(n(168));ct(Kt,o),ct(an,c)}function h0(r,o,c){var m=r.stateNode;if(o=o.childContextTypes,typeof m.getChildContext!="function")return c;m=m.getChildContext();for(var v in m)if(!(v in o))throw Error(n(108,se(r)||"Unknown",v));return J({},c,m)}function ec(r){return r=(r=r.stateNode)&&r.__reactInternalMemoizedMergedChildContext||gs,to=Kt.current,ct(Kt,r),ct(an,an.current),!0}function p0(r,o,c){var m=r.stateNode;if(!m)throw Error(n(169));c?(r=h0(r,o,to),m.__reactInternalMemoizedMergedChildContext=r,ht(an),ht(Kt),ct(Kt,r)):ht(an),ct(an,c)}var Fr=null,tc=!1,Ed=!1;function m0(r){Fr===null?Fr=[r]:Fr.push(r)}function sA(r){tc=!0,m0(r)}function vs(){if(!Ed&&Fr!==null){Ed=!0;var r=0,o=Qe;try{var c=Fr;for(Qe=1;r<c.length;r++){var m=c[r];do m=m(!0);while(m!==null)}Fr=null,tc=!1}catch(v){throw Fr!==null&&(Fr=Fr.slice(r+1)),$s(ts,vs),v}finally{Qe=o,Ed=!1}}return null}var ai=[],li=0,nc=null,rc=0,Rn=[],An=0,no=null,zr=1,Br="";function ro(r,o){ai[li++]=rc,ai[li++]=nc,nc=r,rc=o}function g0(r,o,c){Rn[An++]=zr,Rn[An++]=Br,Rn[An++]=no,no=r;var m=zr;r=Br;var v=32-gn(m)-1;m&=~(1<<v),c+=1;var x=32-gn(o)+v;if(30<x){var R=v-v%5;x=(m&(1<<R)-1).toString(32),m>>=R,v-=R,zr=1<<32-gn(o)+v|c<<v|m,Br=x+r}else zr=1<<x|c<<v|m,Br=r}function jd(r){r.return!==null&&(ro(r,1),g0(r,1,0))}function Cd(r){for(;r===nc;)nc=ai[--li],ai[li]=null,rc=ai[--li],ai[li]=null;for(;r===no;)no=Rn[--An],Rn[An]=null,Br=Rn[--An],Rn[An]=null,zr=Rn[--An],Rn[An]=null}var yn=null,wn=null,gt=!1,Zn=null;function v0(r,o){var c=Pn(5,null,null,0);c.elementType="DELETED",c.stateNode=o,c.return=r,o=r.deletions,o===null?(r.deletions=[c],r.flags|=16):o.push(c)}function y0(r,o){switch(r.tag){case 5:var c=r.type;return o=o.nodeType!==1||c.toLowerCase()!==o.nodeName.toLowerCase()?null:o,o!==null?(r.stateNode=o,yn=r,wn=ps(o.firstChild),!0):!1;case 6:return o=r.pendingProps===""||o.nodeType!==3?null:o,o!==null?(r.stateNode=o,yn=r,wn=null,!0):!1;case 13:return o=o.nodeType!==8?null:o,o!==null?(c=no!==null?{id:zr,overflow:Br}:null,r.memoizedState={dehydrated:o,treeContext:c,retryLane:1073741824},c=Pn(18,null,null,0),c.stateNode=o,c.return=r,r.child=c,yn=r,wn=null,!0):!1;default:return!1}}function Td(r){return(r.mode&1)!==0&&(r.flags&128)===0}function Rd(r){if(gt){var o=wn;if(o){var c=o;if(!y0(r,o)){if(Td(r))throw Error(n(418));o=ps(c.nextSibling);var m=yn;o&&y0(r,o)?v0(m,c):(r.flags=r.flags&-4097|2,gt=!1,yn=r)}}else{if(Td(r))throw Error(n(418));r.flags=r.flags&-4097|2,gt=!1,yn=r}}}function w0(r){for(r=r.return;r!==null&&r.tag!==5&&r.tag!==3&&r.tag!==13;)r=r.return;yn=r}function sc(r){if(r!==yn)return!1;if(!gt)return w0(r),gt=!0,!1;var o;if((o=r.tag!==3)&&!(o=r.tag!==5)&&(o=r.type,o=o!=="head"&&o!=="body"&&!bd(r.type,r.memoizedProps)),o&&(o=wn)){if(Td(r))throw x0(),Error(n(418));for(;o;)v0(r,o),o=ps(o.nextSibling)}if(w0(r),r.tag===13){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(n(317));e:{for(r=r.nextSibling,o=0;r;){if(r.nodeType===8){var c=r.data;if(c==="/$"){if(o===0){wn=ps(r.nextSibling);break e}o--}else c!=="$"&&c!=="$!"&&c!=="$?"||o++}r=r.nextSibling}wn=null}}else wn=yn?ps(r.stateNode.nextSibling):null;return!0}function x0(){for(var r=wn;r;)r=ps(r.nextSibling)}function ci(){wn=yn=null,gt=!1}function Ad(r){Zn===null?Zn=[r]:Zn.push(r)}var oA=C.ReactCurrentBatchConfig;function ka(r,o,c){if(r=c.ref,r!==null&&typeof r!="function"&&typeof r!="object"){if(c._owner){if(c=c._owner,c){if(c.tag!==1)throw Error(n(309));var m=c.stateNode}if(!m)throw Error(n(147,r));var v=m,x=""+r;return o!==null&&o.ref!==null&&typeof o.ref=="function"&&o.ref._stringRef===x?o.ref:(o=function(R){var B=v.refs;R===null?delete B[x]:B[x]=R},o._stringRef=x,o)}if(typeof r!="string")throw Error(n(284));if(!c._owner)throw Error(n(290,r))}return r}function oc(r,o){throw r=Object.prototype.toString.call(o),Error(n(31,r==="[object Object]"?"object with keys {"+Object.keys(o).join(", ")+"}":r))}function b0(r){var o=r._init;return o(r._payload)}function _0(r){function o(oe,te){if(r){var ie=oe.deletions;ie===null?(oe.deletions=[te],oe.flags|=16):ie.push(te)}}function c(oe,te){if(!r)return null;for(;te!==null;)o(oe,te),te=te.sibling;return null}function m(oe,te){for(oe=new Map;te!==null;)te.key!==null?oe.set(te.key,te):oe.set(te.index,te),te=te.sibling;return oe}function v(oe,te){return oe=Ns(oe,te),oe.index=0,oe.sibling=null,oe}function x(oe,te,ie){return oe.index=ie,r?(ie=oe.alternate,ie!==null?(ie=ie.index,ie<te?(oe.flags|=2,te):ie):(oe.flags|=2,te)):(oe.flags|=1048576,te)}function R(oe){return r&&oe.alternate===null&&(oe.flags|=2),oe}function B(oe,te,ie,xe){return te===null||te.tag!==6?(te=kf(ie,oe.mode,xe),te.return=oe,te):(te=v(te,ie),te.return=oe,te)}function ee(oe,te,ie,xe){var Ie=ie.type;return Ie===O?ge(oe,te,ie.props.children,xe,ie.key):te!==null&&(te.elementType===Ie||typeof Ie=="object"&&Ie!==null&&Ie.$$typeof===U&&b0(Ie)===te.type)?(xe=v(te,ie.props),xe.ref=ka(oe,te,ie),xe.return=oe,xe):(xe=Tc(ie.type,ie.key,ie.props,null,oe.mode,xe),xe.ref=ka(oe,te,ie),xe.return=oe,xe)}function ue(oe,te,ie,xe){return te===null||te.tag!==4||te.stateNode.containerInfo!==ie.containerInfo||te.stateNode.implementation!==ie.implementation?(te=Sf(ie,oe.mode,xe),te.return=oe,te):(te=v(te,ie.children||[]),te.return=oe,te)}function ge(oe,te,ie,xe,Ie){return te===null||te.tag!==7?(te=fo(ie,oe.mode,xe,Ie),te.return=oe,te):(te=v(te,ie),te.return=oe,te)}function ye(oe,te,ie){if(typeof te=="string"&&te!==""||typeof te=="number")return te=kf(""+te,oe.mode,ie),te.return=oe,te;if(typeof te=="object"&&te!==null){switch(te.$$typeof){case I:return ie=Tc(te.type,te.key,te.props,null,oe.mode,ie),ie.ref=ka(oe,null,te),ie.return=oe,ie;case P:return te=Sf(te,oe.mode,ie),te.return=oe,te;case U:var xe=te._init;return ye(oe,xe(te._payload),ie)}if(Ke(te)||H(te))return te=fo(te,oe.mode,ie,null),te.return=oe,te;oc(oe,te)}return null}function me(oe,te,ie,xe){var Ie=te!==null?te.key:null;if(typeof ie=="string"&&ie!==""||typeof ie=="number")return Ie!==null?null:B(oe,te,""+ie,xe);if(typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case I:return ie.key===Ie?ee(oe,te,ie,xe):null;case P:return ie.key===Ie?ue(oe,te,ie,xe):null;case U:return Ie=ie._init,me(oe,te,Ie(ie._payload),xe)}if(Ke(ie)||H(ie))return Ie!==null?null:ge(oe,te,ie,xe,null);oc(oe,ie)}return null}function Se(oe,te,ie,xe,Ie){if(typeof xe=="string"&&xe!==""||typeof xe=="number")return oe=oe.get(ie)||null,B(te,oe,""+xe,Ie);if(typeof xe=="object"&&xe!==null){switch(xe.$$typeof){case I:return oe=oe.get(xe.key===null?ie:xe.key)||null,ee(te,oe,xe,Ie);case P:return oe=oe.get(xe.key===null?ie:xe.key)||null,ue(te,oe,xe,Ie);case U:var qe=xe._init;return Se(oe,te,ie,qe(xe._payload),Ie)}if(Ke(xe)||H(xe))return oe=oe.get(ie)||null,ge(te,oe,xe,Ie,null);oc(te,xe)}return null}function je(oe,te,ie,xe){for(var Ie=null,qe=null,De=te,ze=te=0,Ft=null;De!==null&&ze<ie.length;ze++){De.index>ze?(Ft=De,De=null):Ft=De.sibling;var et=me(oe,De,ie[ze],xe);if(et===null){De===null&&(De=Ft);break}r&&De&&et.alternate===null&&o(oe,De),te=x(et,te,ze),qe===null?Ie=et:qe.sibling=et,qe=et,De=Ft}if(ze===ie.length)return c(oe,De),gt&&ro(oe,ze),Ie;if(De===null){for(;ze<ie.length;ze++)De=ye(oe,ie[ze],xe),De!==null&&(te=x(De,te,ze),qe===null?Ie=De:qe.sibling=De,qe=De);return gt&&ro(oe,ze),Ie}for(De=m(oe,De);ze<ie.length;ze++)Ft=Se(De,oe,ze,ie[ze],xe),Ft!==null&&(r&&Ft.alternate!==null&&De.delete(Ft.key===null?ze:Ft.key),te=x(Ft,te,ze),qe===null?Ie=Ft:qe.sibling=Ft,qe=Ft);return r&&De.forEach(function(Es){return o(oe,Es)}),gt&&ro(oe,ze),Ie}function Ae(oe,te,ie,xe){var Ie=H(ie);if(typeof Ie!="function")throw Error(n(150));if(ie=Ie.call(ie),ie==null)throw Error(n(151));for(var qe=Ie=null,De=te,ze=te=0,Ft=null,et=ie.next();De!==null&&!et.done;ze++,et=ie.next()){De.index>ze?(Ft=De,De=null):Ft=De.sibling;var Es=me(oe,De,et.value,xe);if(Es===null){De===null&&(De=Ft);break}r&&De&&Es.alternate===null&&o(oe,De),te=x(Es,te,ze),qe===null?Ie=Es:qe.sibling=Es,qe=Es,De=Ft}if(et.done)return c(oe,De),gt&&ro(oe,ze),Ie;if(De===null){for(;!et.done;ze++,et=ie.next())et=ye(oe,et.value,xe),et!==null&&(te=x(et,te,ze),qe===null?Ie=et:qe.sibling=et,qe=et);return gt&&ro(oe,ze),Ie}for(De=m(oe,De);!et.done;ze++,et=ie.next())et=Se(De,oe,ze,et.value,xe),et!==null&&(r&&et.alternate!==null&&De.delete(et.key===null?ze:et.key),te=x(et,te,ze),qe===null?Ie=et:qe.sibling=et,qe=et);return r&&De.forEach(function(qA){return o(oe,qA)}),gt&&ro(oe,ze),Ie}function jt(oe,te,ie,xe){if(typeof ie=="object"&&ie!==null&&ie.type===O&&ie.key===null&&(ie=ie.props.children),typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case I:e:{for(var Ie=ie.key,qe=te;qe!==null;){if(qe.key===Ie){if(Ie=ie.type,Ie===O){if(qe.tag===7){c(oe,qe.sibling),te=v(qe,ie.props.children),te.return=oe,oe=te;break e}}else if(qe.elementType===Ie||typeof Ie=="object"&&Ie!==null&&Ie.$$typeof===U&&b0(Ie)===qe.type){c(oe,qe.sibling),te=v(qe,ie.props),te.ref=ka(oe,qe,ie),te.return=oe,oe=te;break e}c(oe,qe);break}else o(oe,qe);qe=qe.sibling}ie.type===O?(te=fo(ie.props.children,oe.mode,xe,ie.key),te.return=oe,oe=te):(xe=Tc(ie.type,ie.key,ie.props,null,oe.mode,xe),xe.ref=ka(oe,te,ie),xe.return=oe,oe=xe)}return R(oe);case P:e:{for(qe=ie.key;te!==null;){if(te.key===qe)if(te.tag===4&&te.stateNode.containerInfo===ie.containerInfo&&te.stateNode.implementation===ie.implementation){c(oe,te.sibling),te=v(te,ie.children||[]),te.return=oe,oe=te;break e}else{c(oe,te);break}else o(oe,te);te=te.sibling}te=Sf(ie,oe.mode,xe),te.return=oe,oe=te}return R(oe);case U:return qe=ie._init,jt(oe,te,qe(ie._payload),xe)}if(Ke(ie))return je(oe,te,ie,xe);if(H(ie))return Ae(oe,te,ie,xe);oc(oe,ie)}return typeof ie=="string"&&ie!==""||typeof ie=="number"?(ie=""+ie,te!==null&&te.tag===6?(c(oe,te.sibling),te=v(te,ie),te.return=oe,oe=te):(c(oe,te),te=kf(ie,oe.mode,xe),te.return=oe,oe=te),R(oe)):c(oe,te)}return jt}var ui=_0(!0),k0=_0(!1),ic=ms(null),ac=null,di=null,Md=null;function Id(){Md=di=ac=null}function Od(r){var o=ic.current;ht(ic),r._currentValue=o}function Pd(r,o,c){for(;r!==null;){var m=r.alternate;if((r.childLanes&o)!==o?(r.childLanes|=o,m!==null&&(m.childLanes|=o)):m!==null&&(m.childLanes&o)!==o&&(m.childLanes|=o),r===c)break;r=r.return}}function fi(r,o){ac=r,Md=di=null,r=r.dependencies,r!==null&&r.firstContext!==null&&((r.lanes&o)!==0&&(cn=!0),r.firstContext=null)}function Mn(r){var o=r._currentValue;if(Md!==r)if(r={context:r,memoizedValue:o,next:null},di===null){if(ac===null)throw Error(n(308));di=r,ac.dependencies={lanes:0,firstContext:r}}else di=di.next=r;return o}var so=null;function $d(r){so===null?so=[r]:so.push(r)}function S0(r,o,c,m){var v=o.interleaved;return v===null?(c.next=c,$d(o)):(c.next=v.next,v.next=c),o.interleaved=c,Ur(r,m)}function Ur(r,o){r.lanes|=o;var c=r.alternate;for(c!==null&&(c.lanes|=o),c=r,r=r.return;r!==null;)r.childLanes|=o,c=r.alternate,c!==null&&(c.childLanes|=o),c=r,r=r.return;return c.tag===3?c.stateNode:null}var ys=!1;function Ld(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function N0(r,o){r=r.updateQueue,o.updateQueue===r&&(o.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,effects:r.effects})}function Wr(r,o){return{eventTime:r,lane:o,tag:0,payload:null,callback:null,next:null}}function ws(r,o,c){var m=r.updateQueue;if(m===null)return null;if(m=m.shared,(Ze&2)!==0){var v=m.pending;return v===null?o.next=o:(o.next=v.next,v.next=o),m.pending=o,Ur(r,c)}return v=m.interleaved,v===null?(o.next=o,$d(m)):(o.next=v.next,v.next=o),m.interleaved=o,Ur(r,c)}function lc(r,o,c){if(o=o.updateQueue,o!==null&&(o=o.shared,(c&4194240)!==0)){var m=o.lanes;m&=r.pendingLanes,c|=m,o.lanes=c,is(r,c)}}function E0(r,o){var c=r.updateQueue,m=r.alternate;if(m!==null&&(m=m.updateQueue,c===m)){var v=null,x=null;if(c=c.firstBaseUpdate,c!==null){do{var R={eventTime:c.eventTime,lane:c.lane,tag:c.tag,payload:c.payload,callback:c.callback,next:null};x===null?v=x=R:x=x.next=R,c=c.next}while(c!==null);x===null?v=x=o:x=x.next=o}else v=x=o;c={baseState:m.baseState,firstBaseUpdate:v,lastBaseUpdate:x,shared:m.shared,effects:m.effects},r.updateQueue=c;return}r=c.lastBaseUpdate,r===null?c.firstBaseUpdate=o:r.next=o,c.lastBaseUpdate=o}function cc(r,o,c,m){var v=r.updateQueue;ys=!1;var x=v.firstBaseUpdate,R=v.lastBaseUpdate,B=v.shared.pending;if(B!==null){v.shared.pending=null;var ee=B,ue=ee.next;ee.next=null,R===null?x=ue:R.next=ue,R=ee;var ge=r.alternate;ge!==null&&(ge=ge.updateQueue,B=ge.lastBaseUpdate,B!==R&&(B===null?ge.firstBaseUpdate=ue:B.next=ue,ge.lastBaseUpdate=ee))}if(x!==null){var ye=v.baseState;R=0,ge=ue=ee=null,B=x;do{var me=B.lane,Se=B.eventTime;if((m&me)===me){ge!==null&&(ge=ge.next={eventTime:Se,lane:0,tag:B.tag,payload:B.payload,callback:B.callback,next:null});e:{var je=r,Ae=B;switch(me=o,Se=c,Ae.tag){case 1:if(je=Ae.payload,typeof je=="function"){ye=je.call(Se,ye,me);break e}ye=je;break e;case 3:je.flags=je.flags&-65537|128;case 0:if(je=Ae.payload,me=typeof je=="function"?je.call(Se,ye,me):je,me==null)break e;ye=J({},ye,me);break e;case 2:ys=!0}}B.callback!==null&&B.lane!==0&&(r.flags|=64,me=v.effects,me===null?v.effects=[B]:me.push(B))}else Se={eventTime:Se,lane:me,tag:B.tag,payload:B.payload,callback:B.callback,next:null},ge===null?(ue=ge=Se,ee=ye):ge=ge.next=Se,R|=me;if(B=B.next,B===null){if(B=v.shared.pending,B===null)break;me=B,B=me.next,me.next=null,v.lastBaseUpdate=me,v.shared.pending=null}}while(!0);if(ge===null&&(ee=ye),v.baseState=ee,v.firstBaseUpdate=ue,v.lastBaseUpdate=ge,o=v.shared.interleaved,o!==null){v=o;do R|=v.lane,v=v.next;while(v!==o)}else x===null&&(v.shared.lanes=0);ao|=R,r.lanes=R,r.memoizedState=ye}}function j0(r,o,c){if(r=o.effects,o.effects=null,r!==null)for(o=0;o<r.length;o++){var m=r[o],v=m.callback;if(v!==null){if(m.callback=null,m=c,typeof v!="function")throw Error(n(191,v));v.call(m)}}}var Sa={},br=ms(Sa),Na=ms(Sa),Ea=ms(Sa);function oo(r){if(r===Sa)throw Error(n(174));return r}function qd(r,o){switch(ct(Ea,o),ct(Na,r),ct(br,Sa),r=o.nodeType,r){case 9:case 11:o=(o=o.documentElement)?o.namespaceURI:Oe(null,"");break;default:r=r===8?o.parentNode:o,o=r.namespaceURI||null,r=r.tagName,o=Oe(o,r)}ht(br),ct(br,o)}function hi(){ht(br),ht(Na),ht(Ea)}function C0(r){oo(Ea.current);var o=oo(br.current),c=Oe(o,r.type);o!==c&&(ct(Na,r),ct(br,c))}function Dd(r){Na.current===r&&(ht(br),ht(Na))}var xt=ms(0);function uc(r){for(var o=r;o!==null;){if(o.tag===13){var c=o.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||c.data==="$?"||c.data==="$!"))return o}else if(o.tag===19&&o.memoizedProps.revealOrder!==void 0){if((o.flags&128)!==0)return o}else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===r)break;for(;o.sibling===null;){if(o.return===null||o.return===r)return null;o=o.return}o.sibling.return=o.return,o=o.sibling}return null}var Fd=[];function zd(){for(var r=0;r<Fd.length;r++)Fd[r]._workInProgressVersionPrimary=null;Fd.length=0}var dc=C.ReactCurrentDispatcher,Bd=C.ReactCurrentBatchConfig,io=0,bt=null,Ot=null,qt=null,fc=!1,ja=!1,Ca=0,iA=0;function Xt(){throw Error(n(321))}function Ud(r,o){if(o===null)return!1;for(var c=0;c<o.length&&c<r.length;c++)if(!Yt(r[c],o[c]))return!1;return!0}function Wd(r,o,c,m,v,x){if(io=x,bt=o,o.memoizedState=null,o.updateQueue=null,o.lanes=0,dc.current=r===null||r.memoizedState===null?uA:dA,r=c(m,v),ja){x=0;do{if(ja=!1,Ca=0,25<=x)throw Error(n(301));x+=1,qt=Ot=null,o.updateQueue=null,dc.current=fA,r=c(m,v)}while(ja)}if(dc.current=mc,o=Ot!==null&&Ot.next!==null,io=0,qt=Ot=bt=null,fc=!1,o)throw Error(n(300));return r}function Hd(){var r=Ca!==0;return Ca=0,r}function _r(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return qt===null?bt.memoizedState=qt=r:qt=qt.next=r,qt}function In(){if(Ot===null){var r=bt.alternate;r=r!==null?r.memoizedState:null}else r=Ot.next;var o=qt===null?bt.memoizedState:qt.next;if(o!==null)qt=o,Ot=r;else{if(r===null)throw Error(n(310));Ot=r,r={memoizedState:Ot.memoizedState,baseState:Ot.baseState,baseQueue:Ot.baseQueue,queue:Ot.queue,next:null},qt===null?bt.memoizedState=qt=r:qt=qt.next=r}return qt}function Ta(r,o){return typeof o=="function"?o(r):o}function Gd(r){var o=In(),c=o.queue;if(c===null)throw Error(n(311));c.lastRenderedReducer=r;var m=Ot,v=m.baseQueue,x=c.pending;if(x!==null){if(v!==null){var R=v.next;v.next=x.next,x.next=R}m.baseQueue=v=x,c.pending=null}if(v!==null){x=v.next,m=m.baseState;var B=R=null,ee=null,ue=x;do{var ge=ue.lane;if((io&ge)===ge)ee!==null&&(ee=ee.next={lane:0,action:ue.action,hasEagerState:ue.hasEagerState,eagerState:ue.eagerState,next:null}),m=ue.hasEagerState?ue.eagerState:r(m,ue.action);else{var ye={lane:ge,action:ue.action,hasEagerState:ue.hasEagerState,eagerState:ue.eagerState,next:null};ee===null?(B=ee=ye,R=m):ee=ee.next=ye,bt.lanes|=ge,ao|=ge}ue=ue.next}while(ue!==null&&ue!==x);ee===null?R=m:ee.next=B,Yt(m,o.memoizedState)||(cn=!0),o.memoizedState=m,o.baseState=R,o.baseQueue=ee,c.lastRenderedState=m}if(r=c.interleaved,r!==null){v=r;do x=v.lane,bt.lanes|=x,ao|=x,v=v.next;while(v!==r)}else v===null&&(c.lanes=0);return[o.memoizedState,c.dispatch]}function Vd(r){var o=In(),c=o.queue;if(c===null)throw Error(n(311));c.lastRenderedReducer=r;var m=c.dispatch,v=c.pending,x=o.memoizedState;if(v!==null){c.pending=null;var R=v=v.next;do x=r(x,R.action),R=R.next;while(R!==v);Yt(x,o.memoizedState)||(cn=!0),o.memoizedState=x,o.baseQueue===null&&(o.baseState=x),c.lastRenderedState=x}return[x,m]}function T0(){}function R0(r,o){var c=bt,m=In(),v=o(),x=!Yt(m.memoizedState,v);if(x&&(m.memoizedState=v,cn=!0),m=m.queue,Yd(I0.bind(null,c,m,r),[r]),m.getSnapshot!==o||x||qt!==null&&qt.memoizedState.tag&1){if(c.flags|=2048,Ra(9,M0.bind(null,c,m,v,o),void 0,null),Dt===null)throw Error(n(349));(io&30)!==0||A0(c,o,v)}return v}function A0(r,o,c){r.flags|=16384,r={getSnapshot:o,value:c},o=bt.updateQueue,o===null?(o={lastEffect:null,stores:null},bt.updateQueue=o,o.stores=[r]):(c=o.stores,c===null?o.stores=[r]:c.push(r))}function M0(r,o,c,m){o.value=c,o.getSnapshot=m,O0(o)&&P0(r)}function I0(r,o,c){return c(function(){O0(o)&&P0(r)})}function O0(r){var o=r.getSnapshot;r=r.value;try{var c=o();return!Yt(r,c)}catch{return!0}}function P0(r){var o=Ur(r,1);o!==null&&nr(o,r,1,-1)}function $0(r){var o=_r();return typeof r=="function"&&(r=r()),o.memoizedState=o.baseState=r,r={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Ta,lastRenderedState:r},o.queue=r,r=r.dispatch=cA.bind(null,bt,r),[o.memoizedState,r]}function Ra(r,o,c,m){return r={tag:r,create:o,destroy:c,deps:m,next:null},o=bt.updateQueue,o===null?(o={lastEffect:null,stores:null},bt.updateQueue=o,o.lastEffect=r.next=r):(c=o.lastEffect,c===null?o.lastEffect=r.next=r:(m=c.next,c.next=r,r.next=m,o.lastEffect=r)),r}function L0(){return In().memoizedState}function hc(r,o,c,m){var v=_r();bt.flags|=r,v.memoizedState=Ra(1|o,c,void 0,m===void 0?null:m)}function pc(r,o,c,m){var v=In();m=m===void 0?null:m;var x=void 0;if(Ot!==null){var R=Ot.memoizedState;if(x=R.destroy,m!==null&&Ud(m,R.deps)){v.memoizedState=Ra(o,c,x,m);return}}bt.flags|=r,v.memoizedState=Ra(1|o,c,x,m)}function q0(r,o){return hc(8390656,8,r,o)}function Yd(r,o){return pc(2048,8,r,o)}function D0(r,o){return pc(4,2,r,o)}function F0(r,o){return pc(4,4,r,o)}function z0(r,o){if(typeof o=="function")return r=r(),o(r),function(){o(null)};if(o!=null)return r=r(),o.current=r,function(){o.current=null}}function B0(r,o,c){return c=c!=null?c.concat([r]):null,pc(4,4,z0.bind(null,o,r),c)}function Kd(){}function U0(r,o){var c=In();o=o===void 0?null:o;var m=c.memoizedState;return m!==null&&o!==null&&Ud(o,m[1])?m[0]:(c.memoizedState=[r,o],r)}function W0(r,o){var c=In();o=o===void 0?null:o;var m=c.memoizedState;return m!==null&&o!==null&&Ud(o,m[1])?m[0]:(r=r(),c.memoizedState=[r,o],r)}function H0(r,o,c){return(io&21)===0?(r.baseState&&(r.baseState=!1,cn=!0),r.memoizedState=c):(Yt(c,o)||(c=Ds(),bt.lanes|=c,ao|=c,r.baseState=!0),o)}function aA(r,o){var c=Qe;Qe=c!==0&&4>c?c:4,r(!0);var m=Bd.transition;Bd.transition={};try{r(!1),o()}finally{Qe=c,Bd.transition=m}}function G0(){return In().memoizedState}function lA(r,o,c){var m=ks(r);if(c={lane:m,action:c,hasEagerState:!1,eagerState:null,next:null},V0(r))Y0(o,c);else if(c=S0(r,o,c,m),c!==null){var v=rn();nr(c,r,m,v),K0(c,o,m)}}function cA(r,o,c){var m=ks(r),v={lane:m,action:c,hasEagerState:!1,eagerState:null,next:null};if(V0(r))Y0(o,v);else{var x=r.alternate;if(r.lanes===0&&(x===null||x.lanes===0)&&(x=o.lastRenderedReducer,x!==null))try{var R=o.lastRenderedState,B=x(R,c);if(v.hasEagerState=!0,v.eagerState=B,Yt(B,R)){var ee=o.interleaved;ee===null?(v.next=v,$d(o)):(v.next=ee.next,ee.next=v),o.interleaved=v;return}}catch{}finally{}c=S0(r,o,v,m),c!==null&&(v=rn(),nr(c,r,m,v),K0(c,o,m))}}function V0(r){var o=r.alternate;return r===bt||o!==null&&o===bt}function Y0(r,o){ja=fc=!0;var c=r.pending;c===null?o.next=o:(o.next=c.next,c.next=o),r.pending=o}function K0(r,o,c){if((c&4194240)!==0){var m=o.lanes;m&=r.pendingLanes,c|=m,o.lanes=c,is(r,c)}}var mc={readContext:Mn,useCallback:Xt,useContext:Xt,useEffect:Xt,useImperativeHandle:Xt,useInsertionEffect:Xt,useLayoutEffect:Xt,useMemo:Xt,useReducer:Xt,useRef:Xt,useState:Xt,useDebugValue:Xt,useDeferredValue:Xt,useTransition:Xt,useMutableSource:Xt,useSyncExternalStore:Xt,useId:Xt,unstable_isNewReconciler:!1},uA={readContext:Mn,useCallback:function(r,o){return _r().memoizedState=[r,o===void 0?null:o],r},useContext:Mn,useEffect:q0,useImperativeHandle:function(r,o,c){return c=c!=null?c.concat([r]):null,hc(4194308,4,z0.bind(null,o,r),c)},useLayoutEffect:function(r,o){return hc(4194308,4,r,o)},useInsertionEffect:function(r,o){return hc(4,2,r,o)},useMemo:function(r,o){var c=_r();return o=o===void 0?null:o,r=r(),c.memoizedState=[r,o],r},useReducer:function(r,o,c){var m=_r();return o=c!==void 0?c(o):o,m.memoizedState=m.baseState=o,r={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:o},m.queue=r,r=r.dispatch=lA.bind(null,bt,r),[m.memoizedState,r]},useRef:function(r){var o=_r();return r={current:r},o.memoizedState=r},useState:$0,useDebugValue:Kd,useDeferredValue:function(r){return _r().memoizedState=r},useTransition:function(){var r=$0(!1),o=r[0];return r=aA.bind(null,r[1]),_r().memoizedState=r,[o,r]},useMutableSource:function(){},useSyncExternalStore:function(r,o,c){var m=bt,v=_r();if(gt){if(c===void 0)throw Error(n(407));c=c()}else{if(c=o(),Dt===null)throw Error(n(349));(io&30)!==0||A0(m,o,c)}v.memoizedState=c;var x={value:c,getSnapshot:o};return v.queue=x,q0(I0.bind(null,m,x,r),[r]),m.flags|=2048,Ra(9,M0.bind(null,m,x,c,o),void 0,null),c},useId:function(){var r=_r(),o=Dt.identifierPrefix;if(gt){var c=Br,m=zr;c=(m&~(1<<32-gn(m)-1)).toString(32)+c,o=":"+o+"R"+c,c=Ca++,0<c&&(o+="H"+c.toString(32)),o+=":"}else c=iA++,o=":"+o+"r"+c.toString(32)+":";return r.memoizedState=o},unstable_isNewReconciler:!1},dA={readContext:Mn,useCallback:U0,useContext:Mn,useEffect:Yd,useImperativeHandle:B0,useInsertionEffect:D0,useLayoutEffect:F0,useMemo:W0,useReducer:Gd,useRef:L0,useState:function(){return Gd(Ta)},useDebugValue:Kd,useDeferredValue:function(r){var o=In();return H0(o,Ot.memoizedState,r)},useTransition:function(){var r=Gd(Ta)[0],o=In().memoizedState;return[r,o]},useMutableSource:T0,useSyncExternalStore:R0,useId:G0,unstable_isNewReconciler:!1},fA={readContext:Mn,useCallback:U0,useContext:Mn,useEffect:Yd,useImperativeHandle:B0,useInsertionEffect:D0,useLayoutEffect:F0,useMemo:W0,useReducer:Vd,useRef:L0,useState:function(){return Vd(Ta)},useDebugValue:Kd,useDeferredValue:function(r){var o=In();return Ot===null?o.memoizedState=r:H0(o,Ot.memoizedState,r)},useTransition:function(){var r=Vd(Ta)[0],o=In().memoizedState;return[r,o]},useMutableSource:T0,useSyncExternalStore:R0,useId:G0,unstable_isNewReconciler:!1};function Jn(r,o){if(r&&r.defaultProps){o=J({},o),r=r.defaultProps;for(var c in r)o[c]===void 0&&(o[c]=r[c]);return o}return o}function Xd(r,o,c,m){o=r.memoizedState,c=c(m,o),c=c==null?o:J({},o,c),r.memoizedState=c,r.lanes===0&&(r.updateQueue.baseState=c)}var gc={isMounted:function(r){return(r=r._reactInternals)?jn(r)===r:!1},enqueueSetState:function(r,o,c){r=r._reactInternals;var m=rn(),v=ks(r),x=Wr(m,v);x.payload=o,c!=null&&(x.callback=c),o=ws(r,x,v),o!==null&&(nr(o,r,v,m),lc(o,r,v))},enqueueReplaceState:function(r,o,c){r=r._reactInternals;var m=rn(),v=ks(r),x=Wr(m,v);x.tag=1,x.payload=o,c!=null&&(x.callback=c),o=ws(r,x,v),o!==null&&(nr(o,r,v,m),lc(o,r,v))},enqueueForceUpdate:function(r,o){r=r._reactInternals;var c=rn(),m=ks(r),v=Wr(c,m);v.tag=2,o!=null&&(v.callback=o),o=ws(r,v,m),o!==null&&(nr(o,r,m,c),lc(o,r,m))}};function X0(r,o,c,m,v,x,R){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(m,x,R):o.prototype&&o.prototype.isPureReactComponent?!fs(c,m)||!fs(v,x):!0}function Q0(r,o,c){var m=!1,v=gs,x=o.contextType;return typeof x=="object"&&x!==null?x=Mn(x):(v=ln(o)?to:Kt.current,m=o.contextTypes,x=(m=m!=null)?ii(r,v):gs),o=new o(c,x),r.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,o.updater=gc,r.stateNode=o,o._reactInternals=r,m&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=v,r.__reactInternalMemoizedMaskedChildContext=x),o}function Z0(r,o,c,m){r=o.state,typeof o.componentWillReceiveProps=="function"&&o.componentWillReceiveProps(c,m),typeof o.UNSAFE_componentWillReceiveProps=="function"&&o.UNSAFE_componentWillReceiveProps(c,m),o.state!==r&&gc.enqueueReplaceState(o,o.state,null)}function Qd(r,o,c,m){var v=r.stateNode;v.props=c,v.state=r.memoizedState,v.refs={},Ld(r);var x=o.contextType;typeof x=="object"&&x!==null?v.context=Mn(x):(x=ln(o)?to:Kt.current,v.context=ii(r,x)),v.state=r.memoizedState,x=o.getDerivedStateFromProps,typeof x=="function"&&(Xd(r,o,x,c),v.state=r.memoizedState),typeof o.getDerivedStateFromProps=="function"||typeof v.getSnapshotBeforeUpdate=="function"||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(o=v.state,typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount(),o!==v.state&&gc.enqueueReplaceState(v,v.state,null),cc(r,c,v,m),v.state=r.memoizedState),typeof v.componentDidMount=="function"&&(r.flags|=4194308)}function pi(r,o){try{var c="",m=o;do c+=L(m),m=m.return;while(m);var v=c}catch(x){v=`
|
|
39
|
+
Error generating stack: `+x.message+`
|
|
40
|
+
`+x.stack}return{value:r,source:o,stack:v,digest:null}}function Zd(r,o,c){return{value:r,source:null,stack:c??null,digest:o??null}}function Jd(r,o){try{console.error(o.value)}catch(c){setTimeout(function(){throw c})}}var hA=typeof WeakMap=="function"?WeakMap:Map;function J0(r,o,c){c=Wr(-1,c),c.tag=3,c.payload={element:null};var m=o.value;return c.callback=function(){kc||(kc=!0,mf=m),Jd(r,o)},c}function ex(r,o,c){c=Wr(-1,c),c.tag=3;var m=r.type.getDerivedStateFromError;if(typeof m=="function"){var v=o.value;c.payload=function(){return m(v)},c.callback=function(){Jd(r,o)}}var x=r.stateNode;return x!==null&&typeof x.componentDidCatch=="function"&&(c.callback=function(){Jd(r,o),typeof m!="function"&&(bs===null?bs=new Set([this]):bs.add(this));var R=o.stack;this.componentDidCatch(o.value,{componentStack:R!==null?R:""})}),c}function tx(r,o,c){var m=r.pingCache;if(m===null){m=r.pingCache=new hA;var v=new Set;m.set(o,v)}else v=m.get(o),v===void 0&&(v=new Set,m.set(o,v));v.has(c)||(v.add(c),r=jA.bind(null,r,o,c),o.then(r,r))}function nx(r){do{var o;if((o=r.tag===13)&&(o=r.memoizedState,o=o!==null?o.dehydrated!==null:!0),o)return r;r=r.return}while(r!==null);return null}function rx(r,o,c,m,v){return(r.mode&1)===0?(r===o?r.flags|=65536:(r.flags|=128,c.flags|=131072,c.flags&=-52805,c.tag===1&&(c.alternate===null?c.tag=17:(o=Wr(-1,1),o.tag=2,ws(c,o,1))),c.lanes|=1),r):(r.flags|=65536,r.lanes=v,r)}var pA=C.ReactCurrentOwner,cn=!1;function nn(r,o,c,m){o.child=r===null?k0(o,null,c,m):ui(o,r.child,c,m)}function sx(r,o,c,m,v){c=c.render;var x=o.ref;return fi(o,v),m=Wd(r,o,c,m,x,v),c=Hd(),r!==null&&!cn?(o.updateQueue=r.updateQueue,o.flags&=-2053,r.lanes&=~v,Hr(r,o,v)):(gt&&c&&jd(o),o.flags|=1,nn(r,o,m,v),o.child)}function ox(r,o,c,m,v){if(r===null){var x=c.type;return typeof x=="function"&&!_f(x)&&x.defaultProps===void 0&&c.compare===null&&c.defaultProps===void 0?(o.tag=15,o.type=x,ix(r,o,x,m,v)):(r=Tc(c.type,null,m,o,o.mode,v),r.ref=o.ref,r.return=o,o.child=r)}if(x=r.child,(r.lanes&v)===0){var R=x.memoizedProps;if(c=c.compare,c=c!==null?c:fs,c(R,m)&&r.ref===o.ref)return Hr(r,o,v)}return o.flags|=1,r=Ns(x,m),r.ref=o.ref,r.return=o,o.child=r}function ix(r,o,c,m,v){if(r!==null){var x=r.memoizedProps;if(fs(x,m)&&r.ref===o.ref)if(cn=!1,o.pendingProps=m=x,(r.lanes&v)!==0)(r.flags&131072)!==0&&(cn=!0);else return o.lanes=r.lanes,Hr(r,o,v)}return ef(r,o,c,m,v)}function ax(r,o,c){var m=o.pendingProps,v=m.children,x=r!==null?r.memoizedState:null;if(m.mode==="hidden")if((o.mode&1)===0)o.memoizedState={baseLanes:0,cachePool:null,transitions:null},ct(gi,xn),xn|=c;else{if((c&1073741824)===0)return r=x!==null?x.baseLanes|c:c,o.lanes=o.childLanes=1073741824,o.memoizedState={baseLanes:r,cachePool:null,transitions:null},o.updateQueue=null,ct(gi,xn),xn|=r,null;o.memoizedState={baseLanes:0,cachePool:null,transitions:null},m=x!==null?x.baseLanes:c,ct(gi,xn),xn|=m}else x!==null?(m=x.baseLanes|c,o.memoizedState=null):m=c,ct(gi,xn),xn|=m;return nn(r,o,v,c),o.child}function lx(r,o){var c=o.ref;(r===null&&c!==null||r!==null&&r.ref!==c)&&(o.flags|=512,o.flags|=2097152)}function ef(r,o,c,m,v){var x=ln(c)?to:Kt.current;return x=ii(o,x),fi(o,v),c=Wd(r,o,c,m,x,v),m=Hd(),r!==null&&!cn?(o.updateQueue=r.updateQueue,o.flags&=-2053,r.lanes&=~v,Hr(r,o,v)):(gt&&m&&jd(o),o.flags|=1,nn(r,o,c,v),o.child)}function cx(r,o,c,m,v){if(ln(c)){var x=!0;ec(o)}else x=!1;if(fi(o,v),o.stateNode===null)yc(r,o),Q0(o,c,m),Qd(o,c,m,v),m=!0;else if(r===null){var R=o.stateNode,B=o.memoizedProps;R.props=B;var ee=R.context,ue=c.contextType;typeof ue=="object"&&ue!==null?ue=Mn(ue):(ue=ln(c)?to:Kt.current,ue=ii(o,ue));var ge=c.getDerivedStateFromProps,ye=typeof ge=="function"||typeof R.getSnapshotBeforeUpdate=="function";ye||typeof R.UNSAFE_componentWillReceiveProps!="function"&&typeof R.componentWillReceiveProps!="function"||(B!==m||ee!==ue)&&Z0(o,R,m,ue),ys=!1;var me=o.memoizedState;R.state=me,cc(o,m,R,v),ee=o.memoizedState,B!==m||me!==ee||an.current||ys?(typeof ge=="function"&&(Xd(o,c,ge,m),ee=o.memoizedState),(B=ys||X0(o,c,B,m,me,ee,ue))?(ye||typeof R.UNSAFE_componentWillMount!="function"&&typeof R.componentWillMount!="function"||(typeof R.componentWillMount=="function"&&R.componentWillMount(),typeof R.UNSAFE_componentWillMount=="function"&&R.UNSAFE_componentWillMount()),typeof R.componentDidMount=="function"&&(o.flags|=4194308)):(typeof R.componentDidMount=="function"&&(o.flags|=4194308),o.memoizedProps=m,o.memoizedState=ee),R.props=m,R.state=ee,R.context=ue,m=B):(typeof R.componentDidMount=="function"&&(o.flags|=4194308),m=!1)}else{R=o.stateNode,N0(r,o),B=o.memoizedProps,ue=o.type===o.elementType?B:Jn(o.type,B),R.props=ue,ye=o.pendingProps,me=R.context,ee=c.contextType,typeof ee=="object"&&ee!==null?ee=Mn(ee):(ee=ln(c)?to:Kt.current,ee=ii(o,ee));var Se=c.getDerivedStateFromProps;(ge=typeof Se=="function"||typeof R.getSnapshotBeforeUpdate=="function")||typeof R.UNSAFE_componentWillReceiveProps!="function"&&typeof R.componentWillReceiveProps!="function"||(B!==ye||me!==ee)&&Z0(o,R,m,ee),ys=!1,me=o.memoizedState,R.state=me,cc(o,m,R,v);var je=o.memoizedState;B!==ye||me!==je||an.current||ys?(typeof Se=="function"&&(Xd(o,c,Se,m),je=o.memoizedState),(ue=ys||X0(o,c,ue,m,me,je,ee)||!1)?(ge||typeof R.UNSAFE_componentWillUpdate!="function"&&typeof R.componentWillUpdate!="function"||(typeof R.componentWillUpdate=="function"&&R.componentWillUpdate(m,je,ee),typeof R.UNSAFE_componentWillUpdate=="function"&&R.UNSAFE_componentWillUpdate(m,je,ee)),typeof R.componentDidUpdate=="function"&&(o.flags|=4),typeof R.getSnapshotBeforeUpdate=="function"&&(o.flags|=1024)):(typeof R.componentDidUpdate!="function"||B===r.memoizedProps&&me===r.memoizedState||(o.flags|=4),typeof R.getSnapshotBeforeUpdate!="function"||B===r.memoizedProps&&me===r.memoizedState||(o.flags|=1024),o.memoizedProps=m,o.memoizedState=je),R.props=m,R.state=je,R.context=ee,m=ue):(typeof R.componentDidUpdate!="function"||B===r.memoizedProps&&me===r.memoizedState||(o.flags|=4),typeof R.getSnapshotBeforeUpdate!="function"||B===r.memoizedProps&&me===r.memoizedState||(o.flags|=1024),m=!1)}return tf(r,o,c,m,x,v)}function tf(r,o,c,m,v,x){lx(r,o);var R=(o.flags&128)!==0;if(!m&&!R)return v&&p0(o,c,!1),Hr(r,o,x);m=o.stateNode,pA.current=o;var B=R&&typeof c.getDerivedStateFromError!="function"?null:m.render();return o.flags|=1,r!==null&&R?(o.child=ui(o,r.child,null,x),o.child=ui(o,null,B,x)):nn(r,o,B,x),o.memoizedState=m.state,v&&p0(o,c,!0),o.child}function ux(r){var o=r.stateNode;o.pendingContext?f0(r,o.pendingContext,o.pendingContext!==o.context):o.context&&f0(r,o.context,!1),qd(r,o.containerInfo)}function dx(r,o,c,m,v){return ci(),Ad(v),o.flags|=256,nn(r,o,c,m),o.child}var nf={dehydrated:null,treeContext:null,retryLane:0};function rf(r){return{baseLanes:r,cachePool:null,transitions:null}}function fx(r,o,c){var m=o.pendingProps,v=xt.current,x=!1,R=(o.flags&128)!==0,B;if((B=R)||(B=r!==null&&r.memoizedState===null?!1:(v&2)!==0),B?(x=!0,o.flags&=-129):(r===null||r.memoizedState!==null)&&(v|=1),ct(xt,v&1),r===null)return Rd(o),r=o.memoizedState,r!==null&&(r=r.dehydrated,r!==null)?((o.mode&1)===0?o.lanes=1:r.data==="$!"?o.lanes=8:o.lanes=1073741824,null):(R=m.children,r=m.fallback,x?(m=o.mode,x=o.child,R={mode:"hidden",children:R},(m&1)===0&&x!==null?(x.childLanes=0,x.pendingProps=R):x=Rc(R,m,0,null),r=fo(r,m,c,null),x.return=o,r.return=o,x.sibling=r,o.child=x,o.child.memoizedState=rf(c),o.memoizedState=nf,r):sf(o,R));if(v=r.memoizedState,v!==null&&(B=v.dehydrated,B!==null))return mA(r,o,R,m,B,v,c);if(x){x=m.fallback,R=o.mode,v=r.child,B=v.sibling;var ee={mode:"hidden",children:m.children};return(R&1)===0&&o.child!==v?(m=o.child,m.childLanes=0,m.pendingProps=ee,o.deletions=null):(m=Ns(v,ee),m.subtreeFlags=v.subtreeFlags&14680064),B!==null?x=Ns(B,x):(x=fo(x,R,c,null),x.flags|=2),x.return=o,m.return=o,m.sibling=x,o.child=m,m=x,x=o.child,R=r.child.memoizedState,R=R===null?rf(c):{baseLanes:R.baseLanes|c,cachePool:null,transitions:R.transitions},x.memoizedState=R,x.childLanes=r.childLanes&~c,o.memoizedState=nf,m}return x=r.child,r=x.sibling,m=Ns(x,{mode:"visible",children:m.children}),(o.mode&1)===0&&(m.lanes=c),m.return=o,m.sibling=null,r!==null&&(c=o.deletions,c===null?(o.deletions=[r],o.flags|=16):c.push(r)),o.child=m,o.memoizedState=null,m}function sf(r,o){return o=Rc({mode:"visible",children:o},r.mode,0,null),o.return=r,r.child=o}function vc(r,o,c,m){return m!==null&&Ad(m),ui(o,r.child,null,c),r=sf(o,o.pendingProps.children),r.flags|=2,o.memoizedState=null,r}function mA(r,o,c,m,v,x,R){if(c)return o.flags&256?(o.flags&=-257,m=Zd(Error(n(422))),vc(r,o,R,m)):o.memoizedState!==null?(o.child=r.child,o.flags|=128,null):(x=m.fallback,v=o.mode,m=Rc({mode:"visible",children:m.children},v,0,null),x=fo(x,v,R,null),x.flags|=2,m.return=o,x.return=o,m.sibling=x,o.child=m,(o.mode&1)!==0&&ui(o,r.child,null,R),o.child.memoizedState=rf(R),o.memoizedState=nf,x);if((o.mode&1)===0)return vc(r,o,R,null);if(v.data==="$!"){if(m=v.nextSibling&&v.nextSibling.dataset,m)var B=m.dgst;return m=B,x=Error(n(419)),m=Zd(x,m,void 0),vc(r,o,R,m)}if(B=(R&r.childLanes)!==0,cn||B){if(m=Dt,m!==null){switch(R&-R){case 4:v=2;break;case 16:v=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:v=32;break;case 536870912:v=268435456;break;default:v=0}v=(v&(m.suspendedLanes|R))!==0?0:v,v!==0&&v!==x.retryLane&&(x.retryLane=v,Ur(r,v),nr(m,r,v,-1))}return bf(),m=Zd(Error(n(421))),vc(r,o,R,m)}return v.data==="$?"?(o.flags|=128,o.child=r.child,o=CA.bind(null,r),v._reactRetry=o,null):(r=x.treeContext,wn=ps(v.nextSibling),yn=o,gt=!0,Zn=null,r!==null&&(Rn[An++]=zr,Rn[An++]=Br,Rn[An++]=no,zr=r.id,Br=r.overflow,no=o),o=sf(o,m.children),o.flags|=4096,o)}function hx(r,o,c){r.lanes|=o;var m=r.alternate;m!==null&&(m.lanes|=o),Pd(r.return,o,c)}function of(r,o,c,m,v){var x=r.memoizedState;x===null?r.memoizedState={isBackwards:o,rendering:null,renderingStartTime:0,last:m,tail:c,tailMode:v}:(x.isBackwards=o,x.rendering=null,x.renderingStartTime=0,x.last=m,x.tail=c,x.tailMode=v)}function px(r,o,c){var m=o.pendingProps,v=m.revealOrder,x=m.tail;if(nn(r,o,m.children,c),m=xt.current,(m&2)!==0)m=m&1|2,o.flags|=128;else{if(r!==null&&(r.flags&128)!==0)e:for(r=o.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&hx(r,c,o);else if(r.tag===19)hx(r,c,o);else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===o)break e;for(;r.sibling===null;){if(r.return===null||r.return===o)break e;r=r.return}r.sibling.return=r.return,r=r.sibling}m&=1}if(ct(xt,m),(o.mode&1)===0)o.memoizedState=null;else switch(v){case"forwards":for(c=o.child,v=null;c!==null;)r=c.alternate,r!==null&&uc(r)===null&&(v=c),c=c.sibling;c=v,c===null?(v=o.child,o.child=null):(v=c.sibling,c.sibling=null),of(o,!1,v,c,x);break;case"backwards":for(c=null,v=o.child,o.child=null;v!==null;){if(r=v.alternate,r!==null&&uc(r)===null){o.child=v;break}r=v.sibling,v.sibling=c,c=v,v=r}of(o,!0,c,null,x);break;case"together":of(o,!1,null,null,void 0);break;default:o.memoizedState=null}return o.child}function yc(r,o){(o.mode&1)===0&&r!==null&&(r.alternate=null,o.alternate=null,o.flags|=2)}function Hr(r,o,c){if(r!==null&&(o.dependencies=r.dependencies),ao|=o.lanes,(c&o.childLanes)===0)return null;if(r!==null&&o.child!==r.child)throw Error(n(153));if(o.child!==null){for(r=o.child,c=Ns(r,r.pendingProps),o.child=c,c.return=o;r.sibling!==null;)r=r.sibling,c=c.sibling=Ns(r,r.pendingProps),c.return=o;c.sibling=null}return o.child}function gA(r,o,c){switch(o.tag){case 3:ux(o),ci();break;case 5:C0(o);break;case 1:ln(o.type)&&ec(o);break;case 4:qd(o,o.stateNode.containerInfo);break;case 10:var m=o.type._context,v=o.memoizedProps.value;ct(ic,m._currentValue),m._currentValue=v;break;case 13:if(m=o.memoizedState,m!==null)return m.dehydrated!==null?(ct(xt,xt.current&1),o.flags|=128,null):(c&o.child.childLanes)!==0?fx(r,o,c):(ct(xt,xt.current&1),r=Hr(r,o,c),r!==null?r.sibling:null);ct(xt,xt.current&1);break;case 19:if(m=(c&o.childLanes)!==0,(r.flags&128)!==0){if(m)return px(r,o,c);o.flags|=128}if(v=o.memoizedState,v!==null&&(v.rendering=null,v.tail=null,v.lastEffect=null),ct(xt,xt.current),m)break;return null;case 22:case 23:return o.lanes=0,ax(r,o,c)}return Hr(r,o,c)}var mx,af,gx,vx;mx=function(r,o){for(var c=o.child;c!==null;){if(c.tag===5||c.tag===6)r.appendChild(c.stateNode);else if(c.tag!==4&&c.child!==null){c.child.return=c,c=c.child;continue}if(c===o)break;for(;c.sibling===null;){if(c.return===null||c.return===o)return;c=c.return}c.sibling.return=c.return,c=c.sibling}},af=function(){},gx=function(r,o,c,m){var v=r.memoizedProps;if(v!==m){r=o.stateNode,oo(br.current);var x=null;switch(c){case"input":v=Me(r,v),m=Me(r,m),x=[];break;case"select":v=J({},v,{value:void 0}),m=J({},m,{value:void 0}),x=[];break;case"textarea":v=ot(r,v),m=ot(r,m),x=[];break;default:typeof v.onClick!="function"&&typeof m.onClick=="function"&&(r.onclick=Ql)}tt(c,m);var R;c=null;for(ue in v)if(!m.hasOwnProperty(ue)&&v.hasOwnProperty(ue)&&v[ue]!=null)if(ue==="style"){var B=v[ue];for(R in B)B.hasOwnProperty(R)&&(c||(c={}),c[R]="")}else ue!=="dangerouslySetInnerHTML"&&ue!=="children"&&ue!=="suppressContentEditableWarning"&&ue!=="suppressHydrationWarning"&&ue!=="autoFocus"&&(i.hasOwnProperty(ue)?x||(x=[]):(x=x||[]).push(ue,null));for(ue in m){var ee=m[ue];if(B=v!=null?v[ue]:void 0,m.hasOwnProperty(ue)&&ee!==B&&(ee!=null||B!=null))if(ue==="style")if(B){for(R in B)!B.hasOwnProperty(R)||ee&&ee.hasOwnProperty(R)||(c||(c={}),c[R]="");for(R in ee)ee.hasOwnProperty(R)&&B[R]!==ee[R]&&(c||(c={}),c[R]=ee[R])}else c||(x||(x=[]),x.push(ue,c)),c=ee;else ue==="dangerouslySetInnerHTML"?(ee=ee?ee.__html:void 0,B=B?B.__html:void 0,ee!=null&&B!==ee&&(x=x||[]).push(ue,ee)):ue==="children"?typeof ee!="string"&&typeof ee!="number"||(x=x||[]).push(ue,""+ee):ue!=="suppressContentEditableWarning"&&ue!=="suppressHydrationWarning"&&(i.hasOwnProperty(ue)?(ee!=null&&ue==="onScroll"&&ft("scroll",r),x||B===ee||(x=[])):(x=x||[]).push(ue,ee))}c&&(x=x||[]).push("style",c);var ue=x;(o.updateQueue=ue)&&(o.flags|=4)}},vx=function(r,o,c,m){c!==m&&(o.flags|=4)};function Aa(r,o){if(!gt)switch(r.tailMode){case"hidden":o=r.tail;for(var c=null;o!==null;)o.alternate!==null&&(c=o),o=o.sibling;c===null?r.tail=null:c.sibling=null;break;case"collapsed":c=r.tail;for(var m=null;c!==null;)c.alternate!==null&&(m=c),c=c.sibling;m===null?o||r.tail===null?r.tail=null:r.tail.sibling=null:m.sibling=null}}function Qt(r){var o=r.alternate!==null&&r.alternate.child===r.child,c=0,m=0;if(o)for(var v=r.child;v!==null;)c|=v.lanes|v.childLanes,m|=v.subtreeFlags&14680064,m|=v.flags&14680064,v.return=r,v=v.sibling;else for(v=r.child;v!==null;)c|=v.lanes|v.childLanes,m|=v.subtreeFlags,m|=v.flags,v.return=r,v=v.sibling;return r.subtreeFlags|=m,r.childLanes=c,o}function vA(r,o,c){var m=o.pendingProps;switch(Cd(o),o.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Qt(o),null;case 1:return ln(o.type)&&Jl(),Qt(o),null;case 3:return m=o.stateNode,hi(),ht(an),ht(Kt),zd(),m.pendingContext&&(m.context=m.pendingContext,m.pendingContext=null),(r===null||r.child===null)&&(sc(o)?o.flags|=4:r===null||r.memoizedState.isDehydrated&&(o.flags&256)===0||(o.flags|=1024,Zn!==null&&(yf(Zn),Zn=null))),af(r,o),Qt(o),null;case 5:Dd(o);var v=oo(Ea.current);if(c=o.type,r!==null&&o.stateNode!=null)gx(r,o,c,m,v),r.ref!==o.ref&&(o.flags|=512,o.flags|=2097152);else{if(!m){if(o.stateNode===null)throw Error(n(166));return Qt(o),null}if(r=oo(br.current),sc(o)){m=o.stateNode,c=o.type;var x=o.memoizedProps;switch(m[xr]=o,m[ba]=x,r=(o.mode&1)!==0,c){case"dialog":ft("cancel",m),ft("close",m);break;case"iframe":case"object":case"embed":ft("load",m);break;case"video":case"audio":for(v=0;v<ya.length;v++)ft(ya[v],m);break;case"source":ft("error",m);break;case"img":case"image":case"link":ft("error",m),ft("load",m);break;case"details":ft("toggle",m);break;case"input":_e(m,x),ft("invalid",m);break;case"select":m._wrapperState={wasMultiple:!!x.multiple},ft("invalid",m);break;case"textarea":He(m,x),ft("invalid",m)}tt(c,x),v=null;for(var R in x)if(x.hasOwnProperty(R)){var B=x[R];R==="children"?typeof B=="string"?m.textContent!==B&&(x.suppressHydrationWarning!==!0&&Xl(m.textContent,B,r),v=["children",B]):typeof B=="number"&&m.textContent!==""+B&&(x.suppressHydrationWarning!==!0&&Xl(m.textContent,B,r),v=["children",""+B]):i.hasOwnProperty(R)&&B!=null&&R==="onScroll"&&ft("scroll",m)}switch(c){case"input":ve(m),be(m,x,!0);break;case"textarea":ve(m),Xe(m);break;case"select":case"option":break;default:typeof x.onClick=="function"&&(m.onclick=Ql)}m=v,o.updateQueue=m,m!==null&&(o.flags|=4)}else{R=v.nodeType===9?v:v.ownerDocument,r==="http://www.w3.org/1999/xhtml"&&(r=_t(c)),r==="http://www.w3.org/1999/xhtml"?c==="script"?(r=R.createElement("div"),r.innerHTML="<script><\/script>",r=r.removeChild(r.firstChild)):typeof m.is=="string"?r=R.createElement(c,{is:m.is}):(r=R.createElement(c),c==="select"&&(R=r,m.multiple?R.multiple=!0:m.size&&(R.size=m.size))):r=R.createElementNS(r,c),r[xr]=o,r[ba]=m,mx(r,o,!1,!1),o.stateNode=r;e:{switch(R=Re(c,m),c){case"dialog":ft("cancel",r),ft("close",r),v=m;break;case"iframe":case"object":case"embed":ft("load",r),v=m;break;case"video":case"audio":for(v=0;v<ya.length;v++)ft(ya[v],r);v=m;break;case"source":ft("error",r),v=m;break;case"img":case"image":case"link":ft("error",r),ft("load",r),v=m;break;case"details":ft("toggle",r),v=m;break;case"input":_e(r,m),v=Me(r,m),ft("invalid",r);break;case"option":v=m;break;case"select":r._wrapperState={wasMultiple:!!m.multiple},v=J({},m,{value:void 0}),ft("invalid",r);break;case"textarea":He(r,m),v=ot(r,m),ft("invalid",r);break;default:v=m}tt(c,v),B=v;for(x in B)if(B.hasOwnProperty(x)){var ee=B[x];x==="style"?Ge(r,ee):x==="dangerouslySetInnerHTML"?(ee=ee?ee.__html:void 0,ee!=null&&Mt(r,ee)):x==="children"?typeof ee=="string"?(c!=="textarea"||ee!=="")&&le(r,ee):typeof ee=="number"&&le(r,""+ee):x!=="suppressContentEditableWarning"&&x!=="suppressHydrationWarning"&&x!=="autoFocus"&&(i.hasOwnProperty(x)?ee!=null&&x==="onScroll"&&ft("scroll",r):ee!=null&&j(r,x,ee,R))}switch(c){case"input":ve(r),be(r,m,!1);break;case"textarea":ve(r),Xe(r);break;case"option":m.value!=null&&r.setAttribute("value",""+he(m.value));break;case"select":r.multiple=!!m.multiple,x=m.value,x!=null?ut(r,!!m.multiple,x,!1):m.defaultValue!=null&&ut(r,!!m.multiple,m.defaultValue,!0);break;default:typeof v.onClick=="function"&&(r.onclick=Ql)}switch(c){case"button":case"input":case"select":case"textarea":m=!!m.autoFocus;break e;case"img":m=!0;break e;default:m=!1}}m&&(o.flags|=4)}o.ref!==null&&(o.flags|=512,o.flags|=2097152)}return Qt(o),null;case 6:if(r&&o.stateNode!=null)vx(r,o,r.memoizedProps,m);else{if(typeof m!="string"&&o.stateNode===null)throw Error(n(166));if(c=oo(Ea.current),oo(br.current),sc(o)){if(m=o.stateNode,c=o.memoizedProps,m[xr]=o,(x=m.nodeValue!==c)&&(r=yn,r!==null))switch(r.tag){case 3:Xl(m.nodeValue,c,(r.mode&1)!==0);break;case 5:r.memoizedProps.suppressHydrationWarning!==!0&&Xl(m.nodeValue,c,(r.mode&1)!==0)}x&&(o.flags|=4)}else m=(c.nodeType===9?c:c.ownerDocument).createTextNode(m),m[xr]=o,o.stateNode=m}return Qt(o),null;case 13:if(ht(xt),m=o.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(gt&&wn!==null&&(o.mode&1)!==0&&(o.flags&128)===0)x0(),ci(),o.flags|=98560,x=!1;else if(x=sc(o),m!==null&&m.dehydrated!==null){if(r===null){if(!x)throw Error(n(318));if(x=o.memoizedState,x=x!==null?x.dehydrated:null,!x)throw Error(n(317));x[xr]=o}else ci(),(o.flags&128)===0&&(o.memoizedState=null),o.flags|=4;Qt(o),x=!1}else Zn!==null&&(yf(Zn),Zn=null),x=!0;if(!x)return o.flags&65536?o:null}return(o.flags&128)!==0?(o.lanes=c,o):(m=m!==null,m!==(r!==null&&r.memoizedState!==null)&&m&&(o.child.flags|=8192,(o.mode&1)!==0&&(r===null||(xt.current&1)!==0?Pt===0&&(Pt=3):bf())),o.updateQueue!==null&&(o.flags|=4),Qt(o),null);case 4:return hi(),af(r,o),r===null&&wa(o.stateNode.containerInfo),Qt(o),null;case 10:return Od(o.type._context),Qt(o),null;case 17:return ln(o.type)&&Jl(),Qt(o),null;case 19:if(ht(xt),x=o.memoizedState,x===null)return Qt(o),null;if(m=(o.flags&128)!==0,R=x.rendering,R===null)if(m)Aa(x,!1);else{if(Pt!==0||r!==null&&(r.flags&128)!==0)for(r=o.child;r!==null;){if(R=uc(r),R!==null){for(o.flags|=128,Aa(x,!1),m=R.updateQueue,m!==null&&(o.updateQueue=m,o.flags|=4),o.subtreeFlags=0,m=c,c=o.child;c!==null;)x=c,r=m,x.flags&=14680066,R=x.alternate,R===null?(x.childLanes=0,x.lanes=r,x.child=null,x.subtreeFlags=0,x.memoizedProps=null,x.memoizedState=null,x.updateQueue=null,x.dependencies=null,x.stateNode=null):(x.childLanes=R.childLanes,x.lanes=R.lanes,x.child=R.child,x.subtreeFlags=0,x.deletions=null,x.memoizedProps=R.memoizedProps,x.memoizedState=R.memoizedState,x.updateQueue=R.updateQueue,x.type=R.type,r=R.dependencies,x.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),c=c.sibling;return ct(xt,xt.current&1|2),o.child}r=r.sibling}x.tail!==null&&rt()>vi&&(o.flags|=128,m=!0,Aa(x,!1),o.lanes=4194304)}else{if(!m)if(r=uc(R),r!==null){if(o.flags|=128,m=!0,c=r.updateQueue,c!==null&&(o.updateQueue=c,o.flags|=4),Aa(x,!0),x.tail===null&&x.tailMode==="hidden"&&!R.alternate&&!gt)return Qt(o),null}else 2*rt()-x.renderingStartTime>vi&&c!==1073741824&&(o.flags|=128,m=!0,Aa(x,!1),o.lanes=4194304);x.isBackwards?(R.sibling=o.child,o.child=R):(c=x.last,c!==null?c.sibling=R:o.child=R,x.last=R)}return x.tail!==null?(o=x.tail,x.rendering=o,x.tail=o.sibling,x.renderingStartTime=rt(),o.sibling=null,c=xt.current,ct(xt,m?c&1|2:c&1),o):(Qt(o),null);case 22:case 23:return xf(),m=o.memoizedState!==null,r!==null&&r.memoizedState!==null!==m&&(o.flags|=8192),m&&(o.mode&1)!==0?(xn&1073741824)!==0&&(Qt(o),o.subtreeFlags&6&&(o.flags|=8192)):Qt(o),null;case 24:return null;case 25:return null}throw Error(n(156,o.tag))}function yA(r,o){switch(Cd(o),o.tag){case 1:return ln(o.type)&&Jl(),r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 3:return hi(),ht(an),ht(Kt),zd(),r=o.flags,(r&65536)!==0&&(r&128)===0?(o.flags=r&-65537|128,o):null;case 5:return Dd(o),null;case 13:if(ht(xt),r=o.memoizedState,r!==null&&r.dehydrated!==null){if(o.alternate===null)throw Error(n(340));ci()}return r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 19:return ht(xt),null;case 4:return hi(),null;case 10:return Od(o.type._context),null;case 22:case 23:return xf(),null;case 24:return null;default:return null}}var wc=!1,Zt=!1,wA=typeof WeakSet=="function"?WeakSet:Set,Ne=null;function mi(r,o){var c=r.ref;if(c!==null)if(typeof c=="function")try{c(null)}catch(m){St(r,o,m)}else c.current=null}function lf(r,o,c){try{c()}catch(m){St(r,o,m)}}var yx=!1;function xA(r,o){if(wd=zs,r=ga(),Qs(r)){if("selectionStart"in r)var c={start:r.selectionStart,end:r.selectionEnd};else e:{c=(c=r.ownerDocument)&&c.defaultView||window;var m=c.getSelection&&c.getSelection();if(m&&m.rangeCount!==0){c=m.anchorNode;var v=m.anchorOffset,x=m.focusNode;m=m.focusOffset;try{c.nodeType,x.nodeType}catch{c=null;break e}var R=0,B=-1,ee=-1,ue=0,ge=0,ye=r,me=null;t:for(;;){for(var Se;ye!==c||v!==0&&ye.nodeType!==3||(B=R+v),ye!==x||m!==0&&ye.nodeType!==3||(ee=R+m),ye.nodeType===3&&(R+=ye.nodeValue.length),(Se=ye.firstChild)!==null;)me=ye,ye=Se;for(;;){if(ye===r)break t;if(me===c&&++ue===v&&(B=R),me===x&&++ge===m&&(ee=R),(Se=ye.nextSibling)!==null)break;ye=me,me=ye.parentNode}ye=Se}c=B===-1||ee===-1?null:{start:B,end:ee}}else c=null}c=c||{start:0,end:0}}else c=null;for(xd={focusedElem:r,selectionRange:c},zs=!1,Ne=o;Ne!==null;)if(o=Ne,r=o.child,(o.subtreeFlags&1028)!==0&&r!==null)r.return=o,Ne=r;else for(;Ne!==null;){o=Ne;try{var je=o.alternate;if((o.flags&1024)!==0)switch(o.tag){case 0:case 11:case 15:break;case 1:if(je!==null){var Ae=je.memoizedProps,jt=je.memoizedState,oe=o.stateNode,te=oe.getSnapshotBeforeUpdate(o.elementType===o.type?Ae:Jn(o.type,Ae),jt);oe.__reactInternalSnapshotBeforeUpdate=te}break;case 3:var ie=o.stateNode.containerInfo;ie.nodeType===1?ie.textContent="":ie.nodeType===9&&ie.documentElement&&ie.removeChild(ie.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(xe){St(o,o.return,xe)}if(r=o.sibling,r!==null){r.return=o.return,Ne=r;break}Ne=o.return}return je=yx,yx=!1,je}function Ma(r,o,c){var m=o.updateQueue;if(m=m!==null?m.lastEffect:null,m!==null){var v=m=m.next;do{if((v.tag&r)===r){var x=v.destroy;v.destroy=void 0,x!==void 0&&lf(o,c,x)}v=v.next}while(v!==m)}}function xc(r,o){if(o=o.updateQueue,o=o!==null?o.lastEffect:null,o!==null){var c=o=o.next;do{if((c.tag&r)===r){var m=c.create;c.destroy=m()}c=c.next}while(c!==o)}}function cf(r){var o=r.ref;if(o!==null){var c=r.stateNode;switch(r.tag){case 5:r=c;break;default:r=c}typeof o=="function"?o(r):o.current=r}}function wx(r){var o=r.alternate;o!==null&&(r.alternate=null,wx(o)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(o=r.stateNode,o!==null&&(delete o[xr],delete o[ba],delete o[Sd],delete o[nA],delete o[rA])),r.stateNode=null,r.return=null,r.dependencies=null,r.memoizedProps=null,r.memoizedState=null,r.pendingProps=null,r.stateNode=null,r.updateQueue=null}function xx(r){return r.tag===5||r.tag===3||r.tag===4}function bx(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||xx(r.return))return null;r=r.return}for(r.sibling.return=r.return,r=r.sibling;r.tag!==5&&r.tag!==6&&r.tag!==18;){if(r.flags&2||r.child===null||r.tag===4)continue e;r.child.return=r,r=r.child}if(!(r.flags&2))return r.stateNode}}function uf(r,o,c){var m=r.tag;if(m===5||m===6)r=r.stateNode,o?c.nodeType===8?c.parentNode.insertBefore(r,o):c.insertBefore(r,o):(c.nodeType===8?(o=c.parentNode,o.insertBefore(r,c)):(o=c,o.appendChild(r)),c=c._reactRootContainer,c!=null||o.onclick!==null||(o.onclick=Ql));else if(m!==4&&(r=r.child,r!==null))for(uf(r,o,c),r=r.sibling;r!==null;)uf(r,o,c),r=r.sibling}function df(r,o,c){var m=r.tag;if(m===5||m===6)r=r.stateNode,o?c.insertBefore(r,o):c.appendChild(r);else if(m!==4&&(r=r.child,r!==null))for(df(r,o,c),r=r.sibling;r!==null;)df(r,o,c),r=r.sibling}var Ut=null,er=!1;function xs(r,o,c){for(c=c.child;c!==null;)_x(r,o,c),c=c.sibling}function _x(r,o,c){if(sn&&typeof sn.onCommitFiberUnmount=="function")try{sn.onCommitFiberUnmount(pt,c)}catch{}switch(c.tag){case 5:Zt||mi(c,o);case 6:var m=Ut,v=er;Ut=null,xs(r,o,c),Ut=m,er=v,Ut!==null&&(er?(r=Ut,c=c.stateNode,r.nodeType===8?r.parentNode.removeChild(c):r.removeChild(c)):Ut.removeChild(c.stateNode));break;case 18:Ut!==null&&(er?(r=Ut,c=c.stateNode,r.nodeType===8?kd(r.parentNode,c):r.nodeType===1&&kd(r,c),ls(r)):kd(Ut,c.stateNode));break;case 4:m=Ut,v=er,Ut=c.stateNode.containerInfo,er=!0,xs(r,o,c),Ut=m,er=v;break;case 0:case 11:case 14:case 15:if(!Zt&&(m=c.updateQueue,m!==null&&(m=m.lastEffect,m!==null))){v=m=m.next;do{var x=v,R=x.destroy;x=x.tag,R!==void 0&&((x&2)!==0||(x&4)!==0)&&lf(c,o,R),v=v.next}while(v!==m)}xs(r,o,c);break;case 1:if(!Zt&&(mi(c,o),m=c.stateNode,typeof m.componentWillUnmount=="function"))try{m.props=c.memoizedProps,m.state=c.memoizedState,m.componentWillUnmount()}catch(B){St(c,o,B)}xs(r,o,c);break;case 21:xs(r,o,c);break;case 22:c.mode&1?(Zt=(m=Zt)||c.memoizedState!==null,xs(r,o,c),Zt=m):xs(r,o,c);break;default:xs(r,o,c)}}function kx(r){var o=r.updateQueue;if(o!==null){r.updateQueue=null;var c=r.stateNode;c===null&&(c=r.stateNode=new wA),o.forEach(function(m){var v=TA.bind(null,r,m);c.has(m)||(c.add(m),m.then(v,v))})}}function tr(r,o){var c=o.deletions;if(c!==null)for(var m=0;m<c.length;m++){var v=c[m];try{var x=r,R=o,B=R;e:for(;B!==null;){switch(B.tag){case 5:Ut=B.stateNode,er=!1;break e;case 3:Ut=B.stateNode.containerInfo,er=!0;break e;case 4:Ut=B.stateNode.containerInfo,er=!0;break e}B=B.return}if(Ut===null)throw Error(n(160));_x(x,R,v),Ut=null,er=!1;var ee=v.alternate;ee!==null&&(ee.return=null),v.return=null}catch(ue){St(v,o,ue)}}if(o.subtreeFlags&12854)for(o=o.child;o!==null;)Sx(o,r),o=o.sibling}function Sx(r,o){var c=r.alternate,m=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:if(tr(o,r),kr(r),m&4){try{Ma(3,r,r.return),xc(3,r)}catch(Ae){St(r,r.return,Ae)}try{Ma(5,r,r.return)}catch(Ae){St(r,r.return,Ae)}}break;case 1:tr(o,r),kr(r),m&512&&c!==null&&mi(c,c.return);break;case 5:if(tr(o,r),kr(r),m&512&&c!==null&&mi(c,c.return),r.flags&32){var v=r.stateNode;try{le(v,"")}catch(Ae){St(r,r.return,Ae)}}if(m&4&&(v=r.stateNode,v!=null)){var x=r.memoizedProps,R=c!==null?c.memoizedProps:x,B=r.type,ee=r.updateQueue;if(r.updateQueue=null,ee!==null)try{B==="input"&&x.type==="radio"&&x.name!=null&&ae(v,x),Re(B,R);var ue=Re(B,x);for(R=0;R<ee.length;R+=2){var ge=ee[R],ye=ee[R+1];ge==="style"?Ge(v,ye):ge==="dangerouslySetInnerHTML"?Mt(v,ye):ge==="children"?le(v,ye):j(v,ge,ye,ue)}switch(B){case"input":we(v,x);break;case"textarea":nt(v,x);break;case"select":var me=v._wrapperState.wasMultiple;v._wrapperState.wasMultiple=!!x.multiple;var Se=x.value;Se!=null?ut(v,!!x.multiple,Se,!1):me!==!!x.multiple&&(x.defaultValue!=null?ut(v,!!x.multiple,x.defaultValue,!0):ut(v,!!x.multiple,x.multiple?[]:"",!1))}v[ba]=x}catch(Ae){St(r,r.return,Ae)}}break;case 6:if(tr(o,r),kr(r),m&4){if(r.stateNode===null)throw Error(n(162));v=r.stateNode,x=r.memoizedProps;try{v.nodeValue=x}catch(Ae){St(r,r.return,Ae)}}break;case 3:if(tr(o,r),kr(r),m&4&&c!==null&&c.memoizedState.isDehydrated)try{ls(o.containerInfo)}catch(Ae){St(r,r.return,Ae)}break;case 4:tr(o,r),kr(r);break;case 13:tr(o,r),kr(r),v=r.child,v.flags&8192&&(x=v.memoizedState!==null,v.stateNode.isHidden=x,!x||v.alternate!==null&&v.alternate.memoizedState!==null||(pf=rt())),m&4&&kx(r);break;case 22:if(ge=c!==null&&c.memoizedState!==null,r.mode&1?(Zt=(ue=Zt)||ge,tr(o,r),Zt=ue):tr(o,r),kr(r),m&8192){if(ue=r.memoizedState!==null,(r.stateNode.isHidden=ue)&&!ge&&(r.mode&1)!==0)for(Ne=r,ge=r.child;ge!==null;){for(ye=Ne=ge;Ne!==null;){switch(me=Ne,Se=me.child,me.tag){case 0:case 11:case 14:case 15:Ma(4,me,me.return);break;case 1:mi(me,me.return);var je=me.stateNode;if(typeof je.componentWillUnmount=="function"){m=me,c=me.return;try{o=m,je.props=o.memoizedProps,je.state=o.memoizedState,je.componentWillUnmount()}catch(Ae){St(m,c,Ae)}}break;case 5:mi(me,me.return);break;case 22:if(me.memoizedState!==null){jx(ye);continue}}Se!==null?(Se.return=me,Ne=Se):jx(ye)}ge=ge.sibling}e:for(ge=null,ye=r;;){if(ye.tag===5){if(ge===null){ge=ye;try{v=ye.stateNode,ue?(x=v.style,typeof x.setProperty=="function"?x.setProperty("display","none","important"):x.display="none"):(B=ye.stateNode,ee=ye.memoizedProps.style,R=ee!=null&&ee.hasOwnProperty("display")?ee.display:null,B.style.display=Ee("display",R))}catch(Ae){St(r,r.return,Ae)}}}else if(ye.tag===6){if(ge===null)try{ye.stateNode.nodeValue=ue?"":ye.memoizedProps}catch(Ae){St(r,r.return,Ae)}}else if((ye.tag!==22&&ye.tag!==23||ye.memoizedState===null||ye===r)&&ye.child!==null){ye.child.return=ye,ye=ye.child;continue}if(ye===r)break e;for(;ye.sibling===null;){if(ye.return===null||ye.return===r)break e;ge===ye&&(ge=null),ye=ye.return}ge===ye&&(ge=null),ye.sibling.return=ye.return,ye=ye.sibling}}break;case 19:tr(o,r),kr(r),m&4&&kx(r);break;case 21:break;default:tr(o,r),kr(r)}}function kr(r){var o=r.flags;if(o&2){try{e:{for(var c=r.return;c!==null;){if(xx(c)){var m=c;break e}c=c.return}throw Error(n(160))}switch(m.tag){case 5:var v=m.stateNode;m.flags&32&&(le(v,""),m.flags&=-33);var x=bx(r);df(r,x,v);break;case 3:case 4:var R=m.stateNode.containerInfo,B=bx(r);uf(r,B,R);break;default:throw Error(n(161))}}catch(ee){St(r,r.return,ee)}r.flags&=-3}o&4096&&(r.flags&=-4097)}function bA(r,o,c){Ne=r,Nx(r)}function Nx(r,o,c){for(var m=(r.mode&1)!==0;Ne!==null;){var v=Ne,x=v.child;if(v.tag===22&&m){var R=v.memoizedState!==null||wc;if(!R){var B=v.alternate,ee=B!==null&&B.memoizedState!==null||Zt;B=wc;var ue=Zt;if(wc=R,(Zt=ee)&&!ue)for(Ne=v;Ne!==null;)R=Ne,ee=R.child,R.tag===22&&R.memoizedState!==null?Cx(v):ee!==null?(ee.return=R,Ne=ee):Cx(v);for(;x!==null;)Ne=x,Nx(x),x=x.sibling;Ne=v,wc=B,Zt=ue}Ex(r)}else(v.subtreeFlags&8772)!==0&&x!==null?(x.return=v,Ne=x):Ex(r)}}function Ex(r){for(;Ne!==null;){var o=Ne;if((o.flags&8772)!==0){var c=o.alternate;try{if((o.flags&8772)!==0)switch(o.tag){case 0:case 11:case 15:Zt||xc(5,o);break;case 1:var m=o.stateNode;if(o.flags&4&&!Zt)if(c===null)m.componentDidMount();else{var v=o.elementType===o.type?c.memoizedProps:Jn(o.type,c.memoizedProps);m.componentDidUpdate(v,c.memoizedState,m.__reactInternalSnapshotBeforeUpdate)}var x=o.updateQueue;x!==null&&j0(o,x,m);break;case 3:var R=o.updateQueue;if(R!==null){if(c=null,o.child!==null)switch(o.child.tag){case 5:c=o.child.stateNode;break;case 1:c=o.child.stateNode}j0(o,R,c)}break;case 5:var B=o.stateNode;if(c===null&&o.flags&4){c=B;var ee=o.memoizedProps;switch(o.type){case"button":case"input":case"select":case"textarea":ee.autoFocus&&c.focus();break;case"img":ee.src&&(c.src=ee.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(o.memoizedState===null){var ue=o.alternate;if(ue!==null){var ge=ue.memoizedState;if(ge!==null){var ye=ge.dehydrated;ye!==null&&ls(ye)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}Zt||o.flags&512&&cf(o)}catch(me){St(o,o.return,me)}}if(o===r){Ne=null;break}if(c=o.sibling,c!==null){c.return=o.return,Ne=c;break}Ne=o.return}}function jx(r){for(;Ne!==null;){var o=Ne;if(o===r){Ne=null;break}var c=o.sibling;if(c!==null){c.return=o.return,Ne=c;break}Ne=o.return}}function Cx(r){for(;Ne!==null;){var o=Ne;try{switch(o.tag){case 0:case 11:case 15:var c=o.return;try{xc(4,o)}catch(ee){St(o,c,ee)}break;case 1:var m=o.stateNode;if(typeof m.componentDidMount=="function"){var v=o.return;try{m.componentDidMount()}catch(ee){St(o,v,ee)}}var x=o.return;try{cf(o)}catch(ee){St(o,x,ee)}break;case 5:var R=o.return;try{cf(o)}catch(ee){St(o,R,ee)}}}catch(ee){St(o,o.return,ee)}if(o===r){Ne=null;break}var B=o.sibling;if(B!==null){B.return=o.return,Ne=B;break}Ne=o.return}}var _A=Math.ceil,bc=C.ReactCurrentDispatcher,ff=C.ReactCurrentOwner,On=C.ReactCurrentBatchConfig,Ze=0,Dt=null,Tt=null,Wt=0,xn=0,gi=ms(0),Pt=0,Ia=null,ao=0,_c=0,hf=0,Oa=null,un=null,pf=0,vi=1/0,Gr=null,kc=!1,mf=null,bs=null,Sc=!1,_s=null,Nc=0,Pa=0,gf=null,Ec=-1,jc=0;function rn(){return(Ze&6)!==0?rt():Ec!==-1?Ec:Ec=rt()}function ks(r){return(r.mode&1)===0?1:(Ze&2)!==0&&Wt!==0?Wt&-Wt:oA.transition!==null?(jc===0&&(jc=Ds()),jc):(r=Qe,r!==0||(r=window.event,r=r===void 0?16:Ko(r.type)),r)}function nr(r,o,c,m){if(50<Pa)throw Pa=0,gf=null,Error(n(185));os(r,c,m),((Ze&2)===0||r!==Dt)&&(r===Dt&&((Ze&2)===0&&(_c|=c),Pt===4&&Ss(r,Wt)),dn(r,m),c===1&&Ze===0&&(o.mode&1)===0&&(vi=rt()+500,tc&&vs()))}function dn(r,o){var c=r.callbackNode;jl(r,o);var m=qs(r,r===Dt?Wt:0);if(m===0)c!==null&&Ls(c),r.callbackNode=null,r.callbackPriority=0;else if(o=m&-m,r.callbackPriority!==o){if(c!=null&&Ls(c),o===1)r.tag===0?sA(Rx.bind(null,r)):m0(Rx.bind(null,r)),eA(function(){(Ze&6)===0&&vs()}),c=null;else{switch(Ji(m)){case 1:c=ts;break;case 4:c=Gt;break;case 16:c=Wn;break;case 536870912:c=ns;break;default:c=Wn}c=qx(c,Tx.bind(null,r))}r.callbackPriority=o,r.callbackNode=c}}function Tx(r,o){if(Ec=-1,jc=0,(Ze&6)!==0)throw Error(n(327));var c=r.callbackNode;if(yi()&&r.callbackNode!==c)return null;var m=qs(r,r===Dt?Wt:0);if(m===0)return null;if((m&30)!==0||(m&r.expiredLanes)!==0||o)o=Cc(r,m);else{o=m;var v=Ze;Ze|=2;var x=Mx();(Dt!==r||Wt!==o)&&(Gr=null,vi=rt()+500,co(r,o));do try{NA();break}catch(B){Ax(r,B)}while(!0);Id(),bc.current=x,Ze=v,Tt!==null?o=0:(Dt=null,Wt=0,o=Pt)}if(o!==0){if(o===2&&(v=Bo(r),v!==0&&(m=v,o=vf(r,v))),o===1)throw c=Ia,co(r,0),Ss(r,m),dn(r,rt()),c;if(o===6)Ss(r,m);else{if(v=r.current.alternate,(m&30)===0&&!kA(v)&&(o=Cc(r,m),o===2&&(x=Bo(r),x!==0&&(m=x,o=vf(r,x))),o===1))throw c=Ia,co(r,0),Ss(r,m),dn(r,rt()),c;switch(r.finishedWork=v,r.finishedLanes=m,o){case 0:case 1:throw Error(n(345));case 2:uo(r,un,Gr);break;case 3:if(Ss(r,m),(m&130023424)===m&&(o=pf+500-rt(),10<o)){if(qs(r,0)!==0)break;if(v=r.suspendedLanes,(v&m)!==m){rn(),r.pingedLanes|=r.suspendedLanes&v;break}r.timeoutHandle=_d(uo.bind(null,r,un,Gr),o);break}uo(r,un,Gr);break;case 4:if(Ss(r,m),(m&4194240)===m)break;for(o=r.eventTimes,v=-1;0<m;){var R=31-gn(m);x=1<<R,R=o[R],R>v&&(v=R),m&=~x}if(m=v,m=rt()-m,m=(120>m?120:480>m?480:1080>m?1080:1920>m?1920:3e3>m?3e3:4320>m?4320:1960*_A(m/1960))-m,10<m){r.timeoutHandle=_d(uo.bind(null,r,un,Gr),m);break}uo(r,un,Gr);break;case 5:uo(r,un,Gr);break;default:throw Error(n(329))}}}return dn(r,rt()),r.callbackNode===c?Tx.bind(null,r):null}function vf(r,o){var c=Oa;return r.current.memoizedState.isDehydrated&&(co(r,o).flags|=256),r=Cc(r,o),r!==2&&(o=un,un=c,o!==null&&yf(o)),r}function yf(r){un===null?un=r:un.push.apply(un,r)}function kA(r){for(var o=r;;){if(o.flags&16384){var c=o.updateQueue;if(c!==null&&(c=c.stores,c!==null))for(var m=0;m<c.length;m++){var v=c[m],x=v.getSnapshot;v=v.value;try{if(!Yt(x(),v))return!1}catch{return!1}}}if(c=o.child,o.subtreeFlags&16384&&c!==null)c.return=o,o=c;else{if(o===r)break;for(;o.sibling===null;){if(o.return===null||o.return===r)return!0;o=o.return}o.sibling.return=o.return,o=o.sibling}}return!0}function Ss(r,o){for(o&=~hf,o&=~_c,r.suspendedLanes|=o,r.pingedLanes&=~o,r=r.expirationTimes;0<o;){var c=31-gn(o),m=1<<c;r[c]=-1,o&=~m}}function Rx(r){if((Ze&6)!==0)throw Error(n(327));yi();var o=qs(r,0);if((o&1)===0)return dn(r,rt()),null;var c=Cc(r,o);if(r.tag!==0&&c===2){var m=Bo(r);m!==0&&(o=m,c=vf(r,m))}if(c===1)throw c=Ia,co(r,0),Ss(r,o),dn(r,rt()),c;if(c===6)throw Error(n(345));return r.finishedWork=r.current.alternate,r.finishedLanes=o,uo(r,un,Gr),dn(r,rt()),null}function wf(r,o){var c=Ze;Ze|=1;try{return r(o)}finally{Ze=c,Ze===0&&(vi=rt()+500,tc&&vs())}}function lo(r){_s!==null&&_s.tag===0&&(Ze&6)===0&&yi();var o=Ze;Ze|=1;var c=On.transition,m=Qe;try{if(On.transition=null,Qe=1,r)return r()}finally{Qe=m,On.transition=c,Ze=o,(Ze&6)===0&&vs()}}function xf(){xn=gi.current,ht(gi)}function co(r,o){r.finishedWork=null,r.finishedLanes=0;var c=r.timeoutHandle;if(c!==-1&&(r.timeoutHandle=-1,JR(c)),Tt!==null)for(c=Tt.return;c!==null;){var m=c;switch(Cd(m),m.tag){case 1:m=m.type.childContextTypes,m!=null&&Jl();break;case 3:hi(),ht(an),ht(Kt),zd();break;case 5:Dd(m);break;case 4:hi();break;case 13:ht(xt);break;case 19:ht(xt);break;case 10:Od(m.type._context);break;case 22:case 23:xf()}c=c.return}if(Dt=r,Tt=r=Ns(r.current,null),Wt=xn=o,Pt=0,Ia=null,hf=_c=ao=0,un=Oa=null,so!==null){for(o=0;o<so.length;o++)if(c=so[o],m=c.interleaved,m!==null){c.interleaved=null;var v=m.next,x=c.pending;if(x!==null){var R=x.next;x.next=v,m.next=R}c.pending=m}so=null}return r}function Ax(r,o){do{var c=Tt;try{if(Id(),dc.current=mc,fc){for(var m=bt.memoizedState;m!==null;){var v=m.queue;v!==null&&(v.pending=null),m=m.next}fc=!1}if(io=0,qt=Ot=bt=null,ja=!1,Ca=0,ff.current=null,c===null||c.return===null){Pt=1,Ia=o,Tt=null;break}e:{var x=r,R=c.return,B=c,ee=o;if(o=Wt,B.flags|=32768,ee!==null&&typeof ee=="object"&&typeof ee.then=="function"){var ue=ee,ge=B,ye=ge.tag;if((ge.mode&1)===0&&(ye===0||ye===11||ye===15)){var me=ge.alternate;me?(ge.updateQueue=me.updateQueue,ge.memoizedState=me.memoizedState,ge.lanes=me.lanes):(ge.updateQueue=null,ge.memoizedState=null)}var Se=nx(R);if(Se!==null){Se.flags&=-257,rx(Se,R,B,x,o),Se.mode&1&&tx(x,ue,o),o=Se,ee=ue;var je=o.updateQueue;if(je===null){var Ae=new Set;Ae.add(ee),o.updateQueue=Ae}else je.add(ee);break e}else{if((o&1)===0){tx(x,ue,o),bf();break e}ee=Error(n(426))}}else if(gt&&B.mode&1){var jt=nx(R);if(jt!==null){(jt.flags&65536)===0&&(jt.flags|=256),rx(jt,R,B,x,o),Ad(pi(ee,B));break e}}x=ee=pi(ee,B),Pt!==4&&(Pt=2),Oa===null?Oa=[x]:Oa.push(x),x=R;do{switch(x.tag){case 3:x.flags|=65536,o&=-o,x.lanes|=o;var oe=J0(x,ee,o);E0(x,oe);break e;case 1:B=ee;var te=x.type,ie=x.stateNode;if((x.flags&128)===0&&(typeof te.getDerivedStateFromError=="function"||ie!==null&&typeof ie.componentDidCatch=="function"&&(bs===null||!bs.has(ie)))){x.flags|=65536,o&=-o,x.lanes|=o;var xe=ex(x,B,o);E0(x,xe);break e}}x=x.return}while(x!==null)}Ox(c)}catch(Ie){o=Ie,Tt===c&&c!==null&&(Tt=c=c.return);continue}break}while(!0)}function Mx(){var r=bc.current;return bc.current=mc,r===null?mc:r}function bf(){(Pt===0||Pt===3||Pt===2)&&(Pt=4),Dt===null||(ao&268435455)===0&&(_c&268435455)===0||Ss(Dt,Wt)}function Cc(r,o){var c=Ze;Ze|=2;var m=Mx();(Dt!==r||Wt!==o)&&(Gr=null,co(r,o));do try{SA();break}catch(v){Ax(r,v)}while(!0);if(Id(),Ze=c,bc.current=m,Tt!==null)throw Error(n(261));return Dt=null,Wt=0,Pt}function SA(){for(;Tt!==null;)Ix(Tt)}function NA(){for(;Tt!==null&&!$o();)Ix(Tt)}function Ix(r){var o=Lx(r.alternate,r,xn);r.memoizedProps=r.pendingProps,o===null?Ox(r):Tt=o,ff.current=null}function Ox(r){var o=r;do{var c=o.alternate;if(r=o.return,(o.flags&32768)===0){if(c=vA(c,o,xn),c!==null){Tt=c;return}}else{if(c=yA(c,o),c!==null){c.flags&=32767,Tt=c;return}if(r!==null)r.flags|=32768,r.subtreeFlags=0,r.deletions=null;else{Pt=6,Tt=null;return}}if(o=o.sibling,o!==null){Tt=o;return}Tt=o=r}while(o!==null);Pt===0&&(Pt=5)}function uo(r,o,c){var m=Qe,v=On.transition;try{On.transition=null,Qe=1,EA(r,o,c,m)}finally{On.transition=v,Qe=m}return null}function EA(r,o,c,m){do yi();while(_s!==null);if((Ze&6)!==0)throw Error(n(327));c=r.finishedWork;var v=r.finishedLanes;if(c===null)return null;if(r.finishedWork=null,r.finishedLanes=0,c===r.current)throw Error(n(177));r.callbackNode=null,r.callbackPriority=0;var x=c.lanes|c.childLanes;if(Jt(r,x),r===Dt&&(Tt=Dt=null,Wt=0),(c.subtreeFlags&2064)===0&&(c.flags&2064)===0||Sc||(Sc=!0,qx(Wn,function(){return yi(),null})),x=(c.flags&15990)!==0,(c.subtreeFlags&15990)!==0||x){x=On.transition,On.transition=null;var R=Qe;Qe=1;var B=Ze;Ze|=4,ff.current=null,xA(r,c),Sx(c,r),Zs(xd),zs=!!wd,xd=wd=null,r.current=c,bA(c),Lo(),Ze=B,Qe=R,On.transition=x}else r.current=c;if(Sc&&(Sc=!1,_s=r,Nc=v),x=r.pendingLanes,x===0&&(bs=null),Hn(c.stateNode),dn(r,rt()),o!==null)for(m=r.onRecoverableError,c=0;c<o.length;c++)v=o[c],m(v.value,{componentStack:v.stack,digest:v.digest});if(kc)throw kc=!1,r=mf,mf=null,r;return(Nc&1)!==0&&r.tag!==0&&yi(),x=r.pendingLanes,(x&1)!==0?r===gf?Pa++:(Pa=0,gf=r):Pa=0,vs(),null}function yi(){if(_s!==null){var r=Ji(Nc),o=On.transition,c=Qe;try{if(On.transition=null,Qe=16>r?16:r,_s===null)var m=!1;else{if(r=_s,_s=null,Nc=0,(Ze&6)!==0)throw Error(n(331));var v=Ze;for(Ze|=4,Ne=r.current;Ne!==null;){var x=Ne,R=x.child;if((Ne.flags&16)!==0){var B=x.deletions;if(B!==null){for(var ee=0;ee<B.length;ee++){var ue=B[ee];for(Ne=ue;Ne!==null;){var ge=Ne;switch(ge.tag){case 0:case 11:case 15:Ma(8,ge,x)}var ye=ge.child;if(ye!==null)ye.return=ge,Ne=ye;else for(;Ne!==null;){ge=Ne;var me=ge.sibling,Se=ge.return;if(wx(ge),ge===ue){Ne=null;break}if(me!==null){me.return=Se,Ne=me;break}Ne=Se}}}var je=x.alternate;if(je!==null){var Ae=je.child;if(Ae!==null){je.child=null;do{var jt=Ae.sibling;Ae.sibling=null,Ae=jt}while(Ae!==null)}}Ne=x}}if((x.subtreeFlags&2064)!==0&&R!==null)R.return=x,Ne=R;else e:for(;Ne!==null;){if(x=Ne,(x.flags&2048)!==0)switch(x.tag){case 0:case 11:case 15:Ma(9,x,x.return)}var oe=x.sibling;if(oe!==null){oe.return=x.return,Ne=oe;break e}Ne=x.return}}var te=r.current;for(Ne=te;Ne!==null;){R=Ne;var ie=R.child;if((R.subtreeFlags&2064)!==0&&ie!==null)ie.return=R,Ne=ie;else e:for(R=te;Ne!==null;){if(B=Ne,(B.flags&2048)!==0)try{switch(B.tag){case 0:case 11:case 15:xc(9,B)}}catch(Ie){St(B,B.return,Ie)}if(B===R){Ne=null;break e}var xe=B.sibling;if(xe!==null){xe.return=B.return,Ne=xe;break e}Ne=B.return}}if(Ze=v,vs(),sn&&typeof sn.onPostCommitFiberRoot=="function")try{sn.onPostCommitFiberRoot(pt,r)}catch{}m=!0}return m}finally{Qe=c,On.transition=o}}return!1}function Px(r,o,c){o=pi(c,o),o=J0(r,o,1),r=ws(r,o,1),o=rn(),r!==null&&(os(r,1,o),dn(r,o))}function St(r,o,c){if(r.tag===3)Px(r,r,c);else for(;o!==null;){if(o.tag===3){Px(o,r,c);break}else if(o.tag===1){var m=o.stateNode;if(typeof o.type.getDerivedStateFromError=="function"||typeof m.componentDidCatch=="function"&&(bs===null||!bs.has(m))){r=pi(c,r),r=ex(o,r,1),o=ws(o,r,1),r=rn(),o!==null&&(os(o,1,r),dn(o,r));break}}o=o.return}}function jA(r,o,c){var m=r.pingCache;m!==null&&m.delete(o),o=rn(),r.pingedLanes|=r.suspendedLanes&c,Dt===r&&(Wt&c)===c&&(Pt===4||Pt===3&&(Wt&130023424)===Wt&&500>rt()-pf?co(r,0):hf|=c),dn(r,o)}function $x(r,o){o===0&&((r.mode&1)===0?o=1:(o=zo,zo<<=1,(zo&130023424)===0&&(zo=4194304)));var c=rn();r=Ur(r,o),r!==null&&(os(r,o,c),dn(r,c))}function CA(r){var o=r.memoizedState,c=0;o!==null&&(c=o.retryLane),$x(r,c)}function TA(r,o){var c=0;switch(r.tag){case 13:var m=r.stateNode,v=r.memoizedState;v!==null&&(c=v.retryLane);break;case 19:m=r.stateNode;break;default:throw Error(n(314))}m!==null&&m.delete(o),$x(r,c)}var Lx;Lx=function(r,o,c){if(r!==null)if(r.memoizedProps!==o.pendingProps||an.current)cn=!0;else{if((r.lanes&c)===0&&(o.flags&128)===0)return cn=!1,gA(r,o,c);cn=(r.flags&131072)!==0}else cn=!1,gt&&(o.flags&1048576)!==0&&g0(o,rc,o.index);switch(o.lanes=0,o.tag){case 2:var m=o.type;yc(r,o),r=o.pendingProps;var v=ii(o,Kt.current);fi(o,c),v=Wd(null,o,m,r,v,c);var x=Hd();return o.flags|=1,typeof v=="object"&&v!==null&&typeof v.render=="function"&&v.$$typeof===void 0?(o.tag=1,o.memoizedState=null,o.updateQueue=null,ln(m)?(x=!0,ec(o)):x=!1,o.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,Ld(o),v.updater=gc,o.stateNode=v,v._reactInternals=o,Qd(o,m,r,c),o=tf(null,o,m,!0,x,c)):(o.tag=0,gt&&x&&jd(o),nn(null,o,v,c),o=o.child),o;case 16:m=o.elementType;e:{switch(yc(r,o),r=o.pendingProps,v=m._init,m=v(m._payload),o.type=m,v=o.tag=AA(m),r=Jn(m,r),v){case 0:o=ef(null,o,m,r,c);break e;case 1:o=cx(null,o,m,r,c);break e;case 11:o=sx(null,o,m,r,c);break e;case 14:o=ox(null,o,m,Jn(m.type,r),c);break e}throw Error(n(306,m,""))}return o;case 0:return m=o.type,v=o.pendingProps,v=o.elementType===m?v:Jn(m,v),ef(r,o,m,v,c);case 1:return m=o.type,v=o.pendingProps,v=o.elementType===m?v:Jn(m,v),cx(r,o,m,v,c);case 3:e:{if(ux(o),r===null)throw Error(n(387));m=o.pendingProps,x=o.memoizedState,v=x.element,N0(r,o),cc(o,m,null,c);var R=o.memoizedState;if(m=R.element,x.isDehydrated)if(x={element:m,isDehydrated:!1,cache:R.cache,pendingSuspenseBoundaries:R.pendingSuspenseBoundaries,transitions:R.transitions},o.updateQueue.baseState=x,o.memoizedState=x,o.flags&256){v=pi(Error(n(423)),o),o=dx(r,o,m,c,v);break e}else if(m!==v){v=pi(Error(n(424)),o),o=dx(r,o,m,c,v);break e}else for(wn=ps(o.stateNode.containerInfo.firstChild),yn=o,gt=!0,Zn=null,c=k0(o,null,m,c),o.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling;else{if(ci(),m===v){o=Hr(r,o,c);break e}nn(r,o,m,c)}o=o.child}return o;case 5:return C0(o),r===null&&Rd(o),m=o.type,v=o.pendingProps,x=r!==null?r.memoizedProps:null,R=v.children,bd(m,v)?R=null:x!==null&&bd(m,x)&&(o.flags|=32),lx(r,o),nn(r,o,R,c),o.child;case 6:return r===null&&Rd(o),null;case 13:return fx(r,o,c);case 4:return qd(o,o.stateNode.containerInfo),m=o.pendingProps,r===null?o.child=ui(o,null,m,c):nn(r,o,m,c),o.child;case 11:return m=o.type,v=o.pendingProps,v=o.elementType===m?v:Jn(m,v),sx(r,o,m,v,c);case 7:return nn(r,o,o.pendingProps,c),o.child;case 8:return nn(r,o,o.pendingProps.children,c),o.child;case 12:return nn(r,o,o.pendingProps.children,c),o.child;case 10:e:{if(m=o.type._context,v=o.pendingProps,x=o.memoizedProps,R=v.value,ct(ic,m._currentValue),m._currentValue=R,x!==null)if(Yt(x.value,R)){if(x.children===v.children&&!an.current){o=Hr(r,o,c);break e}}else for(x=o.child,x!==null&&(x.return=o);x!==null;){var B=x.dependencies;if(B!==null){R=x.child;for(var ee=B.firstContext;ee!==null;){if(ee.context===m){if(x.tag===1){ee=Wr(-1,c&-c),ee.tag=2;var ue=x.updateQueue;if(ue!==null){ue=ue.shared;var ge=ue.pending;ge===null?ee.next=ee:(ee.next=ge.next,ge.next=ee),ue.pending=ee}}x.lanes|=c,ee=x.alternate,ee!==null&&(ee.lanes|=c),Pd(x.return,c,o),B.lanes|=c;break}ee=ee.next}}else if(x.tag===10)R=x.type===o.type?null:x.child;else if(x.tag===18){if(R=x.return,R===null)throw Error(n(341));R.lanes|=c,B=R.alternate,B!==null&&(B.lanes|=c),Pd(R,c,o),R=x.sibling}else R=x.child;if(R!==null)R.return=x;else for(R=x;R!==null;){if(R===o){R=null;break}if(x=R.sibling,x!==null){x.return=R.return,R=x;break}R=R.return}x=R}nn(r,o,v.children,c),o=o.child}return o;case 9:return v=o.type,m=o.pendingProps.children,fi(o,c),v=Mn(v),m=m(v),o.flags|=1,nn(r,o,m,c),o.child;case 14:return m=o.type,v=Jn(m,o.pendingProps),v=Jn(m.type,v),ox(r,o,m,v,c);case 15:return ix(r,o,o.type,o.pendingProps,c);case 17:return m=o.type,v=o.pendingProps,v=o.elementType===m?v:Jn(m,v),yc(r,o),o.tag=1,ln(m)?(r=!0,ec(o)):r=!1,fi(o,c),Q0(o,m,v),Qd(o,m,v,c),tf(null,o,m,!0,r,c);case 19:return px(r,o,c);case 22:return ax(r,o,c)}throw Error(n(156,o.tag))};function qx(r,o){return $s(r,o)}function RA(r,o,c,m){this.tag=r,this.key=c,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=o,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=m,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Pn(r,o,c,m){return new RA(r,o,c,m)}function _f(r){return r=r.prototype,!(!r||!r.isReactComponent)}function AA(r){if(typeof r=="function")return _f(r)?1:0;if(r!=null){if(r=r.$$typeof,r===W)return 11;if(r===Z)return 14}return 2}function Ns(r,o){var c=r.alternate;return c===null?(c=Pn(r.tag,o,r.key,r.mode),c.elementType=r.elementType,c.type=r.type,c.stateNode=r.stateNode,c.alternate=r,r.alternate=c):(c.pendingProps=o,c.type=r.type,c.flags=0,c.subtreeFlags=0,c.deletions=null),c.flags=r.flags&14680064,c.childLanes=r.childLanes,c.lanes=r.lanes,c.child=r.child,c.memoizedProps=r.memoizedProps,c.memoizedState=r.memoizedState,c.updateQueue=r.updateQueue,o=r.dependencies,c.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext},c.sibling=r.sibling,c.index=r.index,c.ref=r.ref,c}function Tc(r,o,c,m,v,x){var R=2;if(m=r,typeof r=="function")_f(r)&&(R=1);else if(typeof r=="string")R=5;else e:switch(r){case O:return fo(c.children,v,x,o);case F:R=8,v|=8;break;case M:return r=Pn(12,c,o,v|2),r.elementType=M,r.lanes=x,r;case Y:return r=Pn(13,c,o,v),r.elementType=Y,r.lanes=x,r;case T:return r=Pn(19,c,o,v),r.elementType=T,r.lanes=x,r;case ne:return Rc(c,v,x,o);default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case A:R=10;break e;case q:R=9;break e;case W:R=11;break e;case Z:R=14;break e;case U:R=16,m=null;break e}throw Error(n(130,r==null?r:typeof r,""))}return o=Pn(R,c,o,v),o.elementType=r,o.type=m,o.lanes=x,o}function fo(r,o,c,m){return r=Pn(7,r,m,o),r.lanes=c,r}function Rc(r,o,c,m){return r=Pn(22,r,m,o),r.elementType=ne,r.lanes=c,r.stateNode={isHidden:!1},r}function kf(r,o,c){return r=Pn(6,r,null,o),r.lanes=c,r}function Sf(r,o,c){return o=Pn(4,r.children!==null?r.children:[],r.key,o),o.lanes=c,o.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},o}function MA(r,o,c,m,v){this.tag=o,this.containerInfo=r,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Uo(0),this.expirationTimes=Uo(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Uo(0),this.identifierPrefix=m,this.onRecoverableError=v,this.mutableSourceEagerHydrationData=null}function Nf(r,o,c,m,v,x,R,B,ee){return r=new MA(r,o,c,B,ee),o===1?(o=1,x===!0&&(o|=8)):o=0,x=Pn(3,null,null,o),r.current=x,x.stateNode=r,x.memoizedState={element:m,isDehydrated:c,cache:null,transitions:null,pendingSuspenseBoundaries:null},Ld(x),r}function IA(r,o,c){var m=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:P,key:m==null?null:""+m,children:r,containerInfo:o,implementation:c}}function Dx(r){if(!r)return gs;r=r._reactInternals;e:{if(jn(r)!==r||r.tag!==1)throw Error(n(170));var o=r;do{switch(o.tag){case 3:o=o.stateNode.context;break e;case 1:if(ln(o.type)){o=o.stateNode.__reactInternalMemoizedMergedChildContext;break e}}o=o.return}while(o!==null);throw Error(n(171))}if(r.tag===1){var c=r.type;if(ln(c))return h0(r,c,o)}return o}function Fx(r,o,c,m,v,x,R,B,ee){return r=Nf(c,m,!0,r,v,x,R,B,ee),r.context=Dx(null),c=r.current,m=rn(),v=ks(c),x=Wr(m,v),x.callback=o??null,ws(c,x,v),r.current.lanes=v,os(r,v,m),dn(r,m),r}function Ac(r,o,c,m){var v=o.current,x=rn(),R=ks(v);return c=Dx(c),o.context===null?o.context=c:o.pendingContext=c,o=Wr(x,R),o.payload={element:r},m=m===void 0?null:m,m!==null&&(o.callback=m),r=ws(v,o,R),r!==null&&(nr(r,v,R,x),lc(r,v,R)),R}function Mc(r){if(r=r.current,!r.child)return null;switch(r.child.tag){case 5:return r.child.stateNode;default:return r.child.stateNode}}function zx(r,o){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var c=r.retryLane;r.retryLane=c!==0&&c<o?c:o}}function Ef(r,o){zx(r,o),(r=r.alternate)&&zx(r,o)}function OA(){return null}var Bx=typeof reportError=="function"?reportError:function(r){console.error(r)};function jf(r){this._internalRoot=r}Ic.prototype.render=jf.prototype.render=function(r){var o=this._internalRoot;if(o===null)throw Error(n(409));Ac(r,o,null,null)},Ic.prototype.unmount=jf.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var o=r.containerInfo;lo(function(){Ac(null,r,null,null)}),o[Dr]=null}};function Ic(r){this._internalRoot=r}Ic.prototype.unstable_scheduleHydration=function(r){if(r){var o=Gn();r={blockedOn:null,target:r,priority:o};for(var c=0;c<Kn.length&&o!==0&&o<Kn[c].priority;c++);Kn.splice(c,0,r),c===0&&Go(r)}};function Cf(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function Oc(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11&&(r.nodeType!==8||r.nodeValue!==" react-mount-point-unstable "))}function Ux(){}function PA(r,o,c,m,v){if(v){if(typeof m=="function"){var x=m;m=function(){var ue=Mc(R);x.call(ue)}}var R=Fx(o,m,r,0,null,!1,!1,"",Ux);return r._reactRootContainer=R,r[Dr]=R.current,wa(r.nodeType===8?r.parentNode:r),lo(),R}for(;v=r.lastChild;)r.removeChild(v);if(typeof m=="function"){var B=m;m=function(){var ue=Mc(ee);B.call(ue)}}var ee=Nf(r,0,!1,null,null,!1,!1,"",Ux);return r._reactRootContainer=ee,r[Dr]=ee.current,wa(r.nodeType===8?r.parentNode:r),lo(function(){Ac(o,ee,c,m)}),ee}function Pc(r,o,c,m,v){var x=c._reactRootContainer;if(x){var R=x;if(typeof v=="function"){var B=v;v=function(){var ee=Mc(R);B.call(ee)}}Ac(o,R,r,v)}else R=PA(c,o,r,v,m);return Mc(R)}Cl=function(r){switch(r.tag){case 3:var o=r.stateNode;if(o.current.memoizedState.isDehydrated){var c=rs(o.pendingLanes);c!==0&&(is(o,c|1),dn(o,rt()),(Ze&6)===0&&(vi=rt()+500,vs()))}break;case 13:lo(function(){var m=Ur(r,1);if(m!==null){var v=rn();nr(m,r,1,v)}}),Ef(r,1)}},Ir=function(r){if(r.tag===13){var o=Ur(r,134217728);if(o!==null){var c=rn();nr(o,r,134217728,c)}Ef(r,134217728)}},ea=function(r){if(r.tag===13){var o=ks(r),c=Ur(r,o);if(c!==null){var m=rn();nr(c,r,o,m)}Ef(r,o)}},Gn=function(){return Qe},Tl=function(r,o){var c=Qe;try{return Qe=r,o()}finally{Qe=c}},kt=function(r,o,c){switch(o){case"input":if(we(r,c),o=c.name,c.type==="radio"&&o!=null){for(c=r;c.parentNode;)c=c.parentNode;for(c=c.querySelectorAll("input[name="+JSON.stringify(""+o)+'][type="radio"]'),o=0;o<c.length;o++){var m=c[o];if(m!==r&&m.form===r.form){var v=Zl(m);if(!v)throw Error(n(90));Te(m),we(m,v)}}}break;case"textarea":nt(r,c);break;case"select":o=c.value,o!=null&&ut(r,!!c.multiple,o,!1)}},Co=wf,To=lo;var $A={usingClientEntryPoint:!1,Events:[_a,si,Zl,jo,mn,wf]},$a={findFiberByHostInstance:eo,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},LA={bundleType:$a.bundleType,version:$a.version,rendererPackageName:$a.rendererPackageName,rendererConfig:$a.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:C.ReactCurrentDispatcher,findHostInstanceByFiber:function(r){return r=Un(r),r===null?null:r.stateNode},findFiberByHostInstance:$a.findFiberByHostInstance||OA,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 $c=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!$c.isDisabled&&$c.supportsFiber)try{pt=$c.inject(LA),sn=$c}catch{}}return fn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=$A,fn.createPortal=function(r,o){var c=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Cf(o))throw Error(n(200));return IA(r,o,null,c)},fn.createRoot=function(r,o){if(!Cf(r))throw Error(n(299));var c=!1,m="",v=Bx;return o!=null&&(o.unstable_strictMode===!0&&(c=!0),o.identifierPrefix!==void 0&&(m=o.identifierPrefix),o.onRecoverableError!==void 0&&(v=o.onRecoverableError)),o=Nf(r,1,!1,null,null,c,!1,m,v),r[Dr]=o.current,wa(r.nodeType===8?r.parentNode:r),new jf(o)},fn.findDOMNode=function(r){if(r==null)return null;if(r.nodeType===1)return r;var o=r._reactInternals;if(o===void 0)throw typeof r.render=="function"?Error(n(188)):(r=Object.keys(r).join(","),Error(n(268,r)));return r=Un(o),r=r===null?null:r.stateNode,r},fn.flushSync=function(r){return lo(r)},fn.hydrate=function(r,o,c){if(!Oc(o))throw Error(n(200));return Pc(null,r,o,!0,c)},fn.hydrateRoot=function(r,o,c){if(!Cf(r))throw Error(n(405));var m=c!=null&&c.hydratedSources||null,v=!1,x="",R=Bx;if(c!=null&&(c.unstable_strictMode===!0&&(v=!0),c.identifierPrefix!==void 0&&(x=c.identifierPrefix),c.onRecoverableError!==void 0&&(R=c.onRecoverableError)),o=Fx(o,null,r,1,c??null,v,!1,x,R),r[Dr]=o.current,wa(r),m)for(r=0;r<m.length;r++)c=m[r],v=c._getVersion,v=v(c._source),o.mutableSourceEagerHydrationData==null?o.mutableSourceEagerHydrationData=[c,v]:o.mutableSourceEagerHydrationData.push(c,v);return new Ic(o)},fn.render=function(r,o,c){if(!Oc(o))throw Error(n(200));return Pc(null,r,o,!1,c)},fn.unmountComponentAtNode=function(r){if(!Oc(r))throw Error(n(40));return r._reactRootContainer?(lo(function(){Pc(null,null,r,!1,function(){r._reactRootContainer=null,r[Dr]=null})}),!0):!1},fn.unstable_batchedUpdates=wf,fn.unstable_renderSubtreeIntoContainer=function(r,o,c,m){if(!Oc(c))throw Error(n(200));if(r==null||r._reactInternals===void 0)throw Error(n(38));return Pc(r,o,c,!1,m)},fn.version="18.3.1-next-f1338f8080-20240426",fn}var Qx;function Ej(){if(Qx)return Af.exports;Qx=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(),Af.exports=WA(),Af.exports}var Zx;function HA(){if(Zx)return qc;Zx=1;var e=Ej();return qc.createRoot=e.createRoot,qc.hydrateRoot=e.hydrateRoot,qc}var GA=HA(),S=fl();const de=Zy(S);function Ht(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,s;n<e.length;n++)(s=Ht(e[n]))!==""&&(t+=(t&&" ")+s);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var Of={exports:{}},Pf={},$f={exports:{}},Lf={};/**
|
|
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 Jx;function VA(){if(Jx)return Lf;Jx=1;var e=fl();function t(g,y){return g===y&&(g!==0||1/g===1/y)||g!==g&&y!==y}var n=typeof Object.is=="function"?Object.is:t,s=e.useState,i=e.useEffect,a=e.useLayoutEffect,l=e.useDebugValue;function u(g,y){var w=y(),N=s({inst:{value:w,getSnapshot:y}}),b=N[0].inst,_=N[1];return a(function(){b.value=w,b.getSnapshot=y,h(b)&&_({inst:b})},[g,w,y]),i(function(){return h(b)&&_({inst:b}),g(function(){h(b)&&_({inst:b})})},[g]),l(w),w}function h(g){var y=g.getSnapshot;g=g.value;try{var w=y();return!n(g,w)}catch{return!0}}function p(g,y){return y()}var f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?p:u;return Lf.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:f,Lf}var eb;function YA(){return eb||(eb=1,$f.exports=VA()),$f.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 tb;function KA(){if(tb)return Pf;tb=1;var e=fl(),t=YA();function n(p,f){return p===f&&(p!==0||1/p===1/f)||p!==p&&f!==f}var s=typeof Object.is=="function"?Object.is:n,i=t.useSyncExternalStore,a=e.useRef,l=e.useEffect,u=e.useMemo,h=e.useDebugValue;return Pf.useSyncExternalStoreWithSelector=function(p,f,g,y,w){var N=a(null);if(N.current===null){var b={hasValue:!1,value:null};N.current=b}else b=N.current;N=u(function(){function k(P){if(!E){if(E=!0,j=P,P=y(P),w!==void 0&&b.hasValue){var O=b.value;if(w(O,P))return C=O}return C=P}if(O=C,s(j,P))return O;var F=y(P);return w!==void 0&&w(O,F)?(j=P,O):(j=P,C=F)}var E=!1,j,C,I=g===void 0?null:g;return[function(){return k(f())},I===null?void 0:function(){return k(I())}]},[f,g,y,w]);var _=i(p,N[0],N[1]);return l(function(){b.hasValue=!0,b.value=_},[_]),h(_),_},Pf}var nb;function XA(){return nb||(nb=1,Of.exports=KA()),Of.exports}var QA=XA();const ZA=Zy(QA),JA={},rb=e=>{let t;const n=new Set,s=(f,g)=>{const y=typeof f=="function"?f(t):f;if(!Object.is(y,t)){const w=t;t=g??(typeof y!="object"||y===null)?y:Object.assign({},t,y),n.forEach(N=>N(t,w))}},i=()=>t,h={setState:s,getState:i,getInitialState:()=>p,subscribe:f=>(n.add(f),()=>n.delete(f)),destroy:()=>{(JA?"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."),n.clear()}},p=t=e(s,i,h);return h},e2=e=>e?rb(e):rb,{useDebugValue:t2}=de,{useSyncExternalStoreWithSelector:n2}=ZA,r2=e=>e;function jj(e,t=r2,n){const s=n2(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return t2(s),s}const sb=(e,t)=>{const n=e2(e),s=(i,a=t)=>jj(n,i,a);return Object.assign(s,n),s},s2=(e,t)=>e?sb(e,t):sb;function $t(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[s,i]of e)if(!Object.is(i,t.get(s)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const s of e)if(!t.has(s))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const s of n)if(!Object.prototype.hasOwnProperty.call(t,s)||!Object.is(e[s],t[s]))return!1;return!0}var o2={value:()=>{}};function ju(){for(var e=0,t=arguments.length,n={},s;e<t;++e){if(!(s=arguments[e]+"")||s in n||/[\s.]/.test(s))throw new Error("illegal type: "+s);n[s]=[]}return new su(n)}function su(e){this._=e}function i2(e,t){return e.trim().split(/^|\s+/).map(function(n){var s="",i=n.indexOf(".");if(i>=0&&(s=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:s}})}su.prototype=ju.prototype={constructor:su,on:function(e,t){var n=this._,s=i2(e+"",n),i,a=-1,l=s.length;if(arguments.length<2){for(;++a<l;)if((i=(e=s[a]).type)&&(i=a2(n[i],e.name)))return i;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++a<l;)if(i=(e=s[a]).type)n[i]=ob(n[i],e.name,t);else if(t==null)for(i in n)n[i]=ob(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new su(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=new Array(i),s=0,i,a;s<i;++s)n[s]=arguments[s+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(a=this._[e],s=0,i=a.length;s<i;++s)a[s].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var s=this._[e],i=0,a=s.length;i<a;++i)s[i].value.apply(t,n)}};function a2(e,t){for(var n=0,s=e.length,i;n<s;++n)if((i=e[n]).name===t)return i.value}function ob(e,t,n){for(var s=0,i=e.length;s<i;++s)if(e[s].name===t){e[s]=o2,e=e.slice(0,s).concat(e.slice(s+1));break}return n!=null&&e.push({name:t,value:n}),e}var wy="http://www.w3.org/1999/xhtml";const ib={svg:"http://www.w3.org/2000/svg",xhtml:wy,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Cu(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),ib.hasOwnProperty(t)?{space:ib[t],local:e}:e}function l2(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===wy&&t.documentElement.namespaceURI===wy?t.createElement(e):t.createElementNS(n,e)}}function c2(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Cj(e){var t=Cu(e);return(t.local?c2:l2)(t)}function u2(){}function Jy(e){return e==null?u2:function(){return this.querySelector(e)}}function d2(e){typeof e!="function"&&(e=Jy(e));for(var t=this._groups,n=t.length,s=new Array(n),i=0;i<n;++i)for(var a=t[i],l=a.length,u=s[i]=new Array(l),h,p,f=0;f<l;++f)(h=a[f])&&(p=e.call(h,h.__data__,f,a))&&("__data__"in h&&(p.__data__=h.__data__),u[f]=p);return new kn(s,this._parents)}function f2(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function h2(){return[]}function Tj(e){return e==null?h2:function(){return this.querySelectorAll(e)}}function p2(e){return function(){return f2(e.apply(this,arguments))}}function m2(e){typeof e=="function"?e=p2(e):e=Tj(e);for(var t=this._groups,n=t.length,s=[],i=[],a=0;a<n;++a)for(var l=t[a],u=l.length,h,p=0;p<u;++p)(h=l[p])&&(s.push(e.call(h,h.__data__,p,l)),i.push(h));return new kn(s,i)}function Rj(e){return function(){return this.matches(e)}}function Aj(e){return function(t){return t.matches(e)}}var g2=Array.prototype.find;function v2(e){return function(){return g2.call(this.children,e)}}function y2(){return this.firstElementChild}function w2(e){return this.select(e==null?y2:v2(typeof e=="function"?e:Aj(e)))}var x2=Array.prototype.filter;function b2(){return Array.from(this.children)}function _2(e){return function(){return x2.call(this.children,e)}}function k2(e){return this.selectAll(e==null?b2:_2(typeof e=="function"?e:Aj(e)))}function S2(e){typeof e!="function"&&(e=Rj(e));for(var t=this._groups,n=t.length,s=new Array(n),i=0;i<n;++i)for(var a=t[i],l=a.length,u=s[i]=[],h,p=0;p<l;++p)(h=a[p])&&e.call(h,h.__data__,p,a)&&u.push(h);return new kn(s,this._parents)}function Mj(e){return new Array(e.length)}function N2(){return new kn(this._enter||this._groups.map(Mj),this._parents)}function uu(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}uu.prototype={constructor:uu,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 E2(e){return function(){return e}}function j2(e,t,n,s,i,a){for(var l=0,u,h=t.length,p=a.length;l<p;++l)(u=t[l])?(u.__data__=a[l],s[l]=u):n[l]=new uu(e,a[l]);for(;l<h;++l)(u=t[l])&&(i[l]=u)}function C2(e,t,n,s,i,a,l){var u,h,p=new Map,f=t.length,g=a.length,y=new Array(f),w;for(u=0;u<f;++u)(h=t[u])&&(y[u]=w=l.call(h,h.__data__,u,t)+"",p.has(w)?i[u]=h:p.set(w,h));for(u=0;u<g;++u)w=l.call(e,a[u],u,a)+"",(h=p.get(w))?(s[u]=h,h.__data__=a[u],p.delete(w)):n[u]=new uu(e,a[u]);for(u=0;u<f;++u)(h=t[u])&&p.get(y[u])===h&&(i[u]=h)}function T2(e){return e.__data__}function R2(e,t){if(!arguments.length)return Array.from(this,T2);var n=t?C2:j2,s=this._parents,i=this._groups;typeof e!="function"&&(e=E2(e));for(var a=i.length,l=new Array(a),u=new Array(a),h=new Array(a),p=0;p<a;++p){var f=s[p],g=i[p],y=g.length,w=A2(e.call(f,f&&f.__data__,p,s)),N=w.length,b=u[p]=new Array(N),_=l[p]=new Array(N),k=h[p]=new Array(y);n(f,g,b,_,k,w,t);for(var E=0,j=0,C,I;E<N;++E)if(C=b[E]){for(E>=j&&(j=E+1);!(I=_[j])&&++j<N;);C._next=I||null}}return l=new kn(l,s),l._enter=u,l._exit=h,l}function A2(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function M2(){return new kn(this._exit||this._groups.map(Mj),this._parents)}function I2(e,t,n){var s=this.enter(),i=this,a=this.exit();return typeof e=="function"?(s=e(s),s&&(s=s.selection())):s=s.append(e+""),t!=null&&(i=t(i),i&&(i=i.selection())),n==null?a.remove():n(a),s&&i?s.merge(i).order():i}function O2(e){for(var t=e.selection?e.selection():e,n=this._groups,s=t._groups,i=n.length,a=s.length,l=Math.min(i,a),u=new Array(i),h=0;h<l;++h)for(var p=n[h],f=s[h],g=p.length,y=u[h]=new Array(g),w,N=0;N<g;++N)(w=p[N]||f[N])&&(y[N]=w);for(;h<i;++h)u[h]=n[h];return new kn(u,this._parents)}function P2(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var s=e[t],i=s.length-1,a=s[i],l;--i>=0;)(l=s[i])&&(a&&l.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(l,a),a=l);return this}function $2(e){e||(e=L2);function t(g,y){return g&&y?e(g.__data__,y.__data__):!g-!y}for(var n=this._groups,s=n.length,i=new Array(s),a=0;a<s;++a){for(var l=n[a],u=l.length,h=i[a]=new Array(u),p,f=0;f<u;++f)(p=l[f])&&(h[f]=p);h.sort(t)}return new kn(i,this._parents).order()}function L2(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function q2(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function D2(){return Array.from(this)}function F2(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var s=e[t],i=0,a=s.length;i<a;++i){var l=s[i];if(l)return l}return null}function z2(){let e=0;for(const t of this)++e;return e}function B2(){return!this.node()}function U2(e){for(var t=this._groups,n=0,s=t.length;n<s;++n)for(var i=t[n],a=0,l=i.length,u;a<l;++a)(u=i[a])&&e.call(u,u.__data__,a,i);return this}function W2(e){return function(){this.removeAttribute(e)}}function H2(e){return function(){this.removeAttributeNS(e.space,e.local)}}function G2(e,t){return function(){this.setAttribute(e,t)}}function V2(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Y2(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function K2(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function X2(e,t){var n=Cu(e);if(arguments.length<2){var s=this.node();return n.local?s.getAttributeNS(n.space,n.local):s.getAttribute(n)}return this.each((t==null?n.local?H2:W2:typeof t=="function"?n.local?K2:Y2:n.local?V2:G2)(n,t))}function Ij(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Q2(e){return function(){this.style.removeProperty(e)}}function Z2(e,t,n){return function(){this.style.setProperty(e,t,n)}}function J2(e,t,n){return function(){var s=t.apply(this,arguments);s==null?this.style.removeProperty(e):this.style.setProperty(e,s,n)}}function eM(e,t,n){return arguments.length>1?this.each((t==null?Q2:typeof t=="function"?J2:Z2)(e,t,n??"")):$i(this.node(),e)}function $i(e,t){return e.style.getPropertyValue(t)||Ij(e).getComputedStyle(e,null).getPropertyValue(t)}function tM(e){return function(){delete this[e]}}function nM(e,t){return function(){this[e]=t}}function rM(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function sM(e,t){return arguments.length>1?this.each((t==null?tM:typeof t=="function"?rM:nM)(e,t)):this.node()[e]}function Oj(e){return e.trim().split(/^|\s+/)}function ew(e){return e.classList||new Pj(e)}function Pj(e){this._node=e,this._names=Oj(e.getAttribute("class")||"")}Pj.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 $j(e,t){for(var n=ew(e),s=-1,i=t.length;++s<i;)n.add(t[s])}function Lj(e,t){for(var n=ew(e),s=-1,i=t.length;++s<i;)n.remove(t[s])}function oM(e){return function(){$j(this,e)}}function iM(e){return function(){Lj(this,e)}}function aM(e,t){return function(){(t.apply(this,arguments)?$j:Lj)(this,e)}}function lM(e,t){var n=Oj(e+"");if(arguments.length<2){for(var s=ew(this.node()),i=-1,a=n.length;++i<a;)if(!s.contains(n[i]))return!1;return!0}return this.each((typeof t=="function"?aM:t?oM:iM)(n,t))}function cM(){this.textContent=""}function uM(e){return function(){this.textContent=e}}function dM(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function fM(e){return arguments.length?this.each(e==null?cM:(typeof e=="function"?dM:uM)(e)):this.node().textContent}function hM(){this.innerHTML=""}function pM(e){return function(){this.innerHTML=e}}function mM(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function gM(e){return arguments.length?this.each(e==null?hM:(typeof e=="function"?mM:pM)(e)):this.node().innerHTML}function vM(){this.nextSibling&&this.parentNode.appendChild(this)}function yM(){return this.each(vM)}function wM(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function xM(){return this.each(wM)}function bM(e){var t=typeof e=="function"?e:Cj(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function _M(){return null}function kM(e,t){var n=typeof e=="function"?e:Cj(e),s=t==null?_M:typeof t=="function"?t:Jy(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),s.apply(this,arguments)||null)})}function SM(){var e=this.parentNode;e&&e.removeChild(this)}function NM(){return this.each(SM)}function EM(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function jM(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function CM(e){return this.select(e?jM:EM)}function TM(e){return arguments.length?this.property("__data__",e):this.node().__data__}function RM(e){return function(t){e.call(this,t,this.__data__)}}function AM(e){return e.trim().split(/^|\s+/).map(function(t){var n="",s=t.indexOf(".");return s>=0&&(n=t.slice(s+1),t=t.slice(0,s)),{type:t,name:n}})}function MM(e){return function(){var t=this.__on;if(t){for(var n=0,s=-1,i=t.length,a;n<i;++n)a=t[n],(!e.type||a.type===e.type)&&a.name===e.name?this.removeEventListener(a.type,a.listener,a.options):t[++s]=a;++s?t.length=s:delete this.__on}}}function IM(e,t,n){return function(){var s=this.__on,i,a=RM(t);if(s){for(var l=0,u=s.length;l<u;++l)if((i=s[l]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=a,i.options=n),i.value=t;return}}this.addEventListener(e.type,a,n),i={type:e.type,name:e.name,value:t,listener:a,options:n},s?s.push(i):this.__on=[i]}}function OM(e,t,n){var s=AM(e+""),i,a=s.length,l;if(arguments.length<2){var u=this.node().__on;if(u){for(var h=0,p=u.length,f;h<p;++h)for(i=0,f=u[h];i<a;++i)if((l=s[i]).type===f.type&&l.name===f.name)return f.value}return}for(u=t?IM:MM,i=0;i<a;++i)this.each(u(s[i],t,n));return this}function qj(e,t,n){var s=Ij(e),i=s.CustomEvent;typeof i=="function"?i=new i(t,n):(i=s.document.createEvent("Event"),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function PM(e,t){return function(){return qj(this,e,t)}}function $M(e,t){return function(){return qj(this,e,t.apply(this,arguments))}}function LM(e,t){return this.each((typeof t=="function"?$M:PM)(e,t))}function*qM(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var s=e[t],i=0,a=s.length,l;i<a;++i)(l=s[i])&&(yield l)}var Dj=[null];function kn(e,t){this._groups=e,this._parents=t}function hl(){return new kn([[document.documentElement]],Dj)}function DM(){return this}kn.prototype=hl.prototype={constructor:kn,select:d2,selectAll:m2,selectChild:w2,selectChildren:k2,filter:S2,data:R2,enter:N2,exit:M2,join:I2,merge:O2,selection:DM,order:P2,sort:$2,call:q2,nodes:D2,node:F2,size:z2,empty:B2,each:U2,attr:X2,style:eM,property:sM,classed:lM,text:fM,html:gM,raise:yM,lower:xM,append:bM,insert:kM,remove:NM,clone:CM,datum:TM,on:OM,dispatch:LM,[Symbol.iterator]:qM};function Ln(e){return typeof e=="string"?new kn([[document.querySelector(e)]],[document.documentElement]):new kn([[e]],Dj)}function FM(e){let t;for(;t=e.sourceEvent;)e=t;return e}function sr(e,t){if(e=FM(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var s=n.createSVGPoint();return s.x=e.clientX,s.y=e.clientY,s=s.matrixTransform(t.getScreenCTM().inverse()),[s.x,s.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}const zM={passive:!1},el={capture:!0,passive:!1};function qf(e){e.stopImmediatePropagation()}function Ri(e){e.preventDefault(),e.stopImmediatePropagation()}function Fj(e){var t=e.document.documentElement,n=Ln(e).on("dragstart.drag",Ri,el);"onselectstart"in t?n.on("selectstart.drag",Ri,el):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function zj(e,t){var n=e.document.documentElement,s=Ln(e).on("dragstart.drag",null);t&&(s.on("click.drag",Ri,el),setTimeout(function(){s.on("click.drag",null)},0)),"onselectstart"in n?s.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const Dc=e=>()=>e;function xy(e,{sourceEvent:t,subject:n,target:s,identifier:i,active:a,x:l,y:u,dx:h,dy:p,dispatch:f}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:s,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:l,enumerable:!0,configurable:!0},y:{value:u,enumerable:!0,configurable:!0},dx:{value:h,enumerable:!0,configurable:!0},dy:{value:p,enumerable:!0,configurable:!0},_:{value:f}})}xy.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function BM(e){return!e.ctrlKey&&!e.button}function UM(){return this.parentNode}function WM(e,t){return t??{x:e.x,y:e.y}}function HM(){return navigator.maxTouchPoints||"ontouchstart"in this}function GM(){var e=BM,t=UM,n=WM,s=HM,i={},a=ju("start","drag","end"),l=0,u,h,p,f,g=0;function y(C){C.on("mousedown.drag",w).filter(s).on("touchstart.drag",_).on("touchmove.drag",k,zM).on("touchend.drag touchcancel.drag",E).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function w(C,I){if(!(f||!e.call(this,C,I))){var P=j(this,t.call(this,C,I),C,I,"mouse");P&&(Ln(C.view).on("mousemove.drag",N,el).on("mouseup.drag",b,el),Fj(C.view),qf(C),p=!1,u=C.clientX,h=C.clientY,P("start",C))}}function N(C){if(Ri(C),!p){var I=C.clientX-u,P=C.clientY-h;p=I*I+P*P>g}i.mouse("drag",C)}function b(C){Ln(C.view).on("mousemove.drag mouseup.drag",null),zj(C.view,p),Ri(C),i.mouse("end",C)}function _(C,I){if(e.call(this,C,I)){var P=C.changedTouches,O=t.call(this,C,I),F=P.length,M,A;for(M=0;M<F;++M)(A=j(this,O,C,I,P[M].identifier,P[M]))&&(qf(C),A("start",C,P[M]))}}function k(C){var I=C.changedTouches,P=I.length,O,F;for(O=0;O<P;++O)(F=i[I[O].identifier])&&(Ri(C),F("drag",C,I[O]))}function E(C){var I=C.changedTouches,P=I.length,O,F;for(f&&clearTimeout(f),f=setTimeout(function(){f=null},500),O=0;O<P;++O)(F=i[I[O].identifier])&&(qf(C),F("end",C,I[O]))}function j(C,I,P,O,F,M){var A=a.copy(),q=sr(M||P,I),W,Y,T;if((T=n.call(C,new xy("beforestart",{sourceEvent:P,target:y,identifier:F,active:l,x:q[0],y:q[1],dx:0,dy:0,dispatch:A}),O))!=null)return W=T.x-q[0]||0,Y=T.y-q[1]||0,function Z(U,ne,X){var H=q,J;switch(U){case"start":i[F]=Z,J=l++;break;case"end":delete i[F],--l;case"drag":q=sr(X||ne,I),J=l;break}A.call(U,C,new xy(U,{sourceEvent:ne,subject:T,target:y,identifier:F,active:J,x:q[0]+W,y:q[1]+Y,dx:q[0]-H[0],dy:q[1]-H[1],dispatch:A}),O)}}return y.filter=function(C){return arguments.length?(e=typeof C=="function"?C:Dc(!!C),y):e},y.container=function(C){return arguments.length?(t=typeof C=="function"?C:Dc(C),y):t},y.subject=function(C){return arguments.length?(n=typeof C=="function"?C:Dc(C),y):n},y.touchable=function(C){return arguments.length?(s=typeof C=="function"?C:Dc(!!C),y):s},y.on=function(){var C=a.on.apply(a,arguments);return C===a?y:C},y.clickDistance=function(C){return arguments.length?(g=(C=+C)*C,y):Math.sqrt(g)},y}function tw(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Bj(e,t){var n=Object.create(e.prototype);for(var s in t)n[s]=t[s];return n}function pl(){}var tl=.7,du=1/tl,Ai="\\s*([+-]?\\d+)\\s*",nl="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Nr="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",VM=/^#([0-9a-f]{3,8})$/,YM=new RegExp(`^rgb\\(${Ai},${Ai},${Ai}\\)$`),KM=new RegExp(`^rgb\\(${Nr},${Nr},${Nr}\\)$`),XM=new RegExp(`^rgba\\(${Ai},${Ai},${Ai},${nl}\\)$`),QM=new RegExp(`^rgba\\(${Nr},${Nr},${Nr},${nl}\\)$`),ZM=new RegExp(`^hsl\\(${nl},${Nr},${Nr}\\)$`),JM=new RegExp(`^hsla\\(${nl},${Nr},${Nr},${nl}\\)$`),ab={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};tw(pl,rl,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:lb,formatHex:lb,formatHex8:eI,formatHsl:tI,formatRgb:cb,toString:cb});function lb(){return this.rgb().formatHex()}function eI(){return this.rgb().formatHex8()}function tI(){return Uj(this).formatHsl()}function cb(){return this.rgb().formatRgb()}function rl(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=VM.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?ub(t):n===3?new hn(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Fc(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Fc(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=YM.exec(e))?new hn(t[1],t[2],t[3],1):(t=KM.exec(e))?new hn(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=XM.exec(e))?Fc(t[1],t[2],t[3],t[4]):(t=QM.exec(e))?Fc(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=ZM.exec(e))?hb(t[1],t[2]/100,t[3]/100,1):(t=JM.exec(e))?hb(t[1],t[2]/100,t[3]/100,t[4]):ab.hasOwnProperty(e)?ub(ab[e]):e==="transparent"?new hn(NaN,NaN,NaN,0):null}function ub(e){return new hn(e>>16&255,e>>8&255,e&255,1)}function Fc(e,t,n,s){return s<=0&&(e=t=n=NaN),new hn(e,t,n,s)}function nI(e){return e instanceof pl||(e=rl(e)),e?(e=e.rgb(),new hn(e.r,e.g,e.b,e.opacity)):new hn}function by(e,t,n,s){return arguments.length===1?nI(e):new hn(e,t,n,s??1)}function hn(e,t,n,s){this.r=+e,this.g=+t,this.b=+n,this.opacity=+s}tw(hn,by,Bj(pl,{brighter(e){return e=e==null?du:Math.pow(du,e),new hn(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?tl:Math.pow(tl,e),new hn(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new hn(wo(this.r),wo(this.g),wo(this.b),fu(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:db,formatHex:db,formatHex8:rI,formatRgb:fb,toString:fb}));function db(){return`#${vo(this.r)}${vo(this.g)}${vo(this.b)}`}function rI(){return`#${vo(this.r)}${vo(this.g)}${vo(this.b)}${vo((isNaN(this.opacity)?1:this.opacity)*255)}`}function fb(){const e=fu(this.opacity);return`${e===1?"rgb(":"rgba("}${wo(this.r)}, ${wo(this.g)}, ${wo(this.b)}${e===1?")":`, ${e})`}`}function fu(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function wo(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function vo(e){return e=wo(e),(e<16?"0":"")+e.toString(16)}function hb(e,t,n,s){return s<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new or(e,t,n,s)}function Uj(e){if(e instanceof or)return new or(e.h,e.s,e.l,e.opacity);if(e instanceof pl||(e=rl(e)),!e)return new or;if(e instanceof or)return e;e=e.rgb();var t=e.r/255,n=e.g/255,s=e.b/255,i=Math.min(t,n,s),a=Math.max(t,n,s),l=NaN,u=a-i,h=(a+i)/2;return u?(t===a?l=(n-s)/u+(n<s)*6:n===a?l=(s-t)/u+2:l=(t-n)/u+4,u/=h<.5?a+i:2-a-i,l*=60):u=h>0&&h<1?0:l,new or(l,u,h,e.opacity)}function sI(e,t,n,s){return arguments.length===1?Uj(e):new or(e,t,n,s??1)}function or(e,t,n,s){this.h=+e,this.s=+t,this.l=+n,this.opacity=+s}tw(or,sI,Bj(pl,{brighter(e){return e=e==null?du:Math.pow(du,e),new or(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?tl:Math.pow(tl,e),new or(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,n=this.l,s=n+(n<.5?n:1-n)*t,i=2*n-s;return new hn(Df(e>=240?e-240:e+120,i,s),Df(e,i,s),Df(e<120?e+240:e-120,i,s),this.opacity)},clamp(){return new or(pb(this.h),zc(this.s),zc(this.l),fu(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=fu(this.opacity);return`${e===1?"hsl(":"hsla("}${pb(this.h)}, ${zc(this.s)*100}%, ${zc(this.l)*100}%${e===1?")":`, ${e})`}`}}));function pb(e){return e=(e||0)%360,e<0?e+360:e}function zc(e){return Math.max(0,Math.min(1,e||0))}function Df(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const Wj=e=>()=>e;function oI(e,t){return function(n){return e+n*t}}function iI(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(s){return Math.pow(e+s*t,n)}}function aI(e){return(e=+e)==1?Hj:function(t,n){return n-t?iI(t,n,e):Wj(isNaN(t)?n:t)}}function Hj(e,t){var n=t-e;return n?oI(e,n):Wj(isNaN(e)?t:e)}const mb=(function e(t){var n=aI(t);function s(i,a){var l=n((i=by(i)).r,(a=by(a)).r),u=n(i.g,a.g),h=n(i.b,a.b),p=Hj(i.opacity,a.opacity);return function(f){return i.r=l(f),i.g=u(f),i.b=h(f),i.opacity=p(f),i+""}}return s.gamma=e,s})(1);function Cs(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var _y=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Ff=new RegExp(_y.source,"g");function lI(e){return function(){return e}}function cI(e){return function(t){return e(t)+""}}function uI(e,t){var n=_y.lastIndex=Ff.lastIndex=0,s,i,a,l=-1,u=[],h=[];for(e=e+"",t=t+"";(s=_y.exec(e))&&(i=Ff.exec(t));)(a=i.index)>n&&(a=t.slice(n,a),u[l]?u[l]+=a:u[++l]=a),(s=s[0])===(i=i[0])?u[l]?u[l]+=i:u[++l]=i:(u[++l]=null,h.push({i:l,x:Cs(s,i)})),n=Ff.lastIndex;return n<t.length&&(a=t.slice(n),u[l]?u[l]+=a:u[++l]=a),u.length<2?h[0]?cI(h[0].x):lI(t):(t=h.length,function(p){for(var f=0,g;f<t;++f)u[(g=h[f]).i]=g.x(p);return u.join("")})}var gb=180/Math.PI,ky={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Gj(e,t,n,s,i,a){var l,u,h;return(l=Math.sqrt(e*e+t*t))&&(e/=l,t/=l),(h=e*n+t*s)&&(n-=e*h,s-=t*h),(u=Math.sqrt(n*n+s*s))&&(n/=u,s/=u,h/=u),e*s<t*n&&(e=-e,t=-t,h=-h,l=-l),{translateX:i,translateY:a,rotate:Math.atan2(t,e)*gb,skewX:Math.atan(h)*gb,scaleX:l,scaleY:u}}var Bc;function dI(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?ky:Gj(t.a,t.b,t.c,t.d,t.e,t.f)}function fI(e){return e==null||(Bc||(Bc=document.createElementNS("http://www.w3.org/2000/svg","g")),Bc.setAttribute("transform",e),!(e=Bc.transform.baseVal.consolidate()))?ky:(e=e.matrix,Gj(e.a,e.b,e.c,e.d,e.e,e.f))}function Vj(e,t,n,s){function i(p){return p.length?p.pop()+" ":""}function a(p,f,g,y,w,N){if(p!==g||f!==y){var b=w.push("translate(",null,t,null,n);N.push({i:b-4,x:Cs(p,g)},{i:b-2,x:Cs(f,y)})}else(g||y)&&w.push("translate("+g+t+y+n)}function l(p,f,g,y){p!==f?(p-f>180?f+=360:f-p>180&&(p+=360),y.push({i:g.push(i(g)+"rotate(",null,s)-2,x:Cs(p,f)})):f&&g.push(i(g)+"rotate("+f+s)}function u(p,f,g,y){p!==f?y.push({i:g.push(i(g)+"skewX(",null,s)-2,x:Cs(p,f)}):f&&g.push(i(g)+"skewX("+f+s)}function h(p,f,g,y,w,N){if(p!==g||f!==y){var b=w.push(i(w)+"scale(",null,",",null,")");N.push({i:b-4,x:Cs(p,g)},{i:b-2,x:Cs(f,y)})}else(g!==1||y!==1)&&w.push(i(w)+"scale("+g+","+y+")")}return function(p,f){var g=[],y=[];return p=e(p),f=e(f),a(p.translateX,p.translateY,f.translateX,f.translateY,g,y),l(p.rotate,f.rotate,g,y),u(p.skewX,f.skewX,g,y),h(p.scaleX,p.scaleY,f.scaleX,f.scaleY,g,y),p=f=null,function(w){for(var N=-1,b=y.length,_;++N<b;)g[(_=y[N]).i]=_.x(w);return g.join("")}}}var hI=Vj(dI,"px, ","px)","deg)"),pI=Vj(fI,", ",")",")"),mI=1e-12;function vb(e){return((e=Math.exp(e))+1/e)/2}function gI(e){return((e=Math.exp(e))-1/e)/2}function vI(e){return((e=Math.exp(2*e))-1)/(e+1)}const yI=(function e(t,n,s){function i(a,l){var u=a[0],h=a[1],p=a[2],f=l[0],g=l[1],y=l[2],w=f-u,N=g-h,b=w*w+N*N,_,k;if(b<mI)k=Math.log(y/p)/t,_=function(O){return[u+O*w,h+O*N,p*Math.exp(t*O*k)]};else{var E=Math.sqrt(b),j=(y*y-p*p+s*b)/(2*p*n*E),C=(y*y-p*p-s*b)/(2*y*n*E),I=Math.log(Math.sqrt(j*j+1)-j),P=Math.log(Math.sqrt(C*C+1)-C);k=(P-I)/t,_=function(O){var F=O*k,M=vb(I),A=p/(n*E)*(M*vI(t*F+I)-gI(I));return[u+A*w,h+A*N,p*M/vb(t*F+I)]}}return _.duration=k*1e3*t/Math.SQRT2,_}return i.rho=function(a){var l=Math.max(.001,+a),u=l*l,h=u*u;return e(l,u,h)},i})(Math.SQRT2,2,4);var Li=0,Ga=0,qa=0,Yj=1e3,hu,Va,pu=0,bo=0,Tu=0,sl=typeof performance=="object"&&performance.now?performance:Date,Kj=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function nw(){return bo||(Kj(wI),bo=sl.now()+Tu)}function wI(){bo=0}function mu(){this._call=this._time=this._next=null}mu.prototype=Xj.prototype={constructor:mu,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?nw():+n)+(t==null?0:+t),!this._next&&Va!==this&&(Va?Va._next=this:hu=this,Va=this),this._call=e,this._time=n,Sy()},stop:function(){this._call&&(this._call=null,this._time=1/0,Sy())}};function Xj(e,t,n){var s=new mu;return s.restart(e,t,n),s}function xI(){nw(),++Li;for(var e=hu,t;e;)(t=bo-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Li}function yb(){bo=(pu=sl.now())+Tu,Li=Ga=0;try{xI()}finally{Li=0,_I(),bo=0}}function bI(){var e=sl.now(),t=e-pu;t>Yj&&(Tu-=t,pu=e)}function _I(){for(var e,t=hu,n,s=1/0;t;)t._call?(s>t._time&&(s=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:hu=n);Va=e,Sy(s)}function Sy(e){if(!Li){Ga&&(Ga=clearTimeout(Ga));var t=e-bo;t>24?(e<1/0&&(Ga=setTimeout(yb,e-sl.now()-Tu)),qa&&(qa=clearInterval(qa))):(qa||(pu=sl.now(),qa=setInterval(bI,Yj)),Li=1,Kj(yb))}}function wb(e,t,n){var s=new mu;return t=t==null?0:+t,s.restart(i=>{s.stop(),e(i+t)},t,n),s}var kI=ju("start","end","cancel","interrupt"),SI=[],Qj=0,xb=1,Ny=2,ou=3,bb=4,Ey=5,iu=6;function Ru(e,t,n,s,i,a){var l=e.__transition;if(!l)e.__transition={};else if(n in l)return;NI(e,n,{name:t,index:s,group:i,on:kI,tween:SI,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:Qj})}function rw(e,t){var n=ur(e,t);if(n.state>Qj)throw new Error("too late; already scheduled");return n}function Er(e,t){var n=ur(e,t);if(n.state>ou)throw new Error("too late; already running");return n}function ur(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function NI(e,t,n){var s=e.__transition,i;s[t]=n,n.timer=Xj(a,0,n.time);function a(p){n.state=xb,n.timer.restart(l,n.delay,n.time),n.delay<=p&&l(p-n.delay)}function l(p){var f,g,y,w;if(n.state!==xb)return h();for(f in s)if(w=s[f],w.name===n.name){if(w.state===ou)return wb(l);w.state===bb?(w.state=iu,w.timer.stop(),w.on.call("interrupt",e,e.__data__,w.index,w.group),delete s[f]):+f<t&&(w.state=iu,w.timer.stop(),w.on.call("cancel",e,e.__data__,w.index,w.group),delete s[f])}if(wb(function(){n.state===ou&&(n.state=bb,n.timer.restart(u,n.delay,n.time),u(p))}),n.state=Ny,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Ny){for(n.state=ou,i=new Array(y=n.tween.length),f=0,g=-1;f<y;++f)(w=n.tween[f].value.call(e,e.__data__,n.index,n.group))&&(i[++g]=w);i.length=g+1}}function u(p){for(var f=p<n.duration?n.ease.call(null,p/n.duration):(n.timer.restart(h),n.state=Ey,1),g=-1,y=i.length;++g<y;)i[g].call(e,f);n.state===Ey&&(n.on.call("end",e,e.__data__,n.index,n.group),h())}function h(){n.state=iu,n.timer.stop(),delete s[t];for(var p in s)return;delete e.__transition}}function au(e,t){var n=e.__transition,s,i,a=!0,l;if(n){t=t==null?null:t+"";for(l in n){if((s=n[l]).name!==t){a=!1;continue}i=s.state>Ny&&s.state<Ey,s.state=iu,s.timer.stop(),s.on.call(i?"interrupt":"cancel",e,e.__data__,s.index,s.group),delete n[l]}a&&delete e.__transition}}function EI(e){return this.each(function(){au(this,e)})}function jI(e,t){var n,s;return function(){var i=Er(this,e),a=i.tween;if(a!==n){s=n=a;for(var l=0,u=s.length;l<u;++l)if(s[l].name===t){s=s.slice(),s.splice(l,1);break}}i.tween=s}}function CI(e,t,n){var s,i;if(typeof n!="function")throw new Error;return function(){var a=Er(this,e),l=a.tween;if(l!==s){i=(s=l).slice();for(var u={name:t,value:n},h=0,p=i.length;h<p;++h)if(i[h].name===t){i[h]=u;break}h===p&&i.push(u)}a.tween=i}}function TI(e,t){var n=this._id;if(e+="",arguments.length<2){for(var s=ur(this.node(),n).tween,i=0,a=s.length,l;i<a;++i)if((l=s[i]).name===e)return l.value;return null}return this.each((t==null?jI:CI)(n,e,t))}function sw(e,t,n){var s=e._id;return e.each(function(){var i=Er(this,s);(i.value||(i.value={}))[t]=n.apply(this,arguments)}),function(i){return ur(i,s).value[t]}}function Zj(e,t){var n;return(typeof t=="number"?Cs:t instanceof rl?mb:(n=rl(t))?(t=n,mb):uI)(e,t)}function RI(e){return function(){this.removeAttribute(e)}}function AI(e){return function(){this.removeAttributeNS(e.space,e.local)}}function MI(e,t,n){var s,i=n+"",a;return function(){var l=this.getAttribute(e);return l===i?null:l===s?a:a=t(s=l,n)}}function II(e,t,n){var s,i=n+"",a;return function(){var l=this.getAttributeNS(e.space,e.local);return l===i?null:l===s?a:a=t(s=l,n)}}function OI(e,t,n){var s,i,a;return function(){var l,u=n(this),h;return u==null?void this.removeAttribute(e):(l=this.getAttribute(e),h=u+"",l===h?null:l===s&&h===i?a:(i=h,a=t(s=l,u)))}}function PI(e,t,n){var s,i,a;return function(){var l,u=n(this),h;return u==null?void this.removeAttributeNS(e.space,e.local):(l=this.getAttributeNS(e.space,e.local),h=u+"",l===h?null:l===s&&h===i?a:(i=h,a=t(s=l,u)))}}function $I(e,t){var n=Cu(e),s=n==="transform"?pI:Zj;return this.attrTween(e,typeof t=="function"?(n.local?PI:OI)(n,s,sw(this,"attr."+e,t)):t==null?(n.local?AI:RI)(n):(n.local?II:MI)(n,s,t))}function LI(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function qI(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function DI(e,t){var n,s;function i(){var a=t.apply(this,arguments);return a!==s&&(n=(s=a)&&qI(e,a)),n}return i._value=t,i}function FI(e,t){var n,s;function i(){var a=t.apply(this,arguments);return a!==s&&(n=(s=a)&&LI(e,a)),n}return i._value=t,i}function zI(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var s=Cu(e);return this.tween(n,(s.local?DI:FI)(s,t))}function BI(e,t){return function(){rw(this,e).delay=+t.apply(this,arguments)}}function UI(e,t){return t=+t,function(){rw(this,e).delay=t}}function WI(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?BI:UI)(t,e)):ur(this.node(),t).delay}function HI(e,t){return function(){Er(this,e).duration=+t.apply(this,arguments)}}function GI(e,t){return t=+t,function(){Er(this,e).duration=t}}function VI(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?HI:GI)(t,e)):ur(this.node(),t).duration}function YI(e,t){if(typeof t!="function")throw new Error;return function(){Er(this,e).ease=t}}function KI(e){var t=this._id;return arguments.length?this.each(YI(t,e)):ur(this.node(),t).ease}function XI(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Er(this,e).ease=n}}function QI(e){if(typeof e!="function")throw new Error;return this.each(XI(this._id,e))}function ZI(e){typeof e!="function"&&(e=Rj(e));for(var t=this._groups,n=t.length,s=new Array(n),i=0;i<n;++i)for(var a=t[i],l=a.length,u=s[i]=[],h,p=0;p<l;++p)(h=a[p])&&e.call(h,h.__data__,p,a)&&u.push(h);return new Xr(s,this._parents,this._name,this._id)}function JI(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,s=t.length,i=n.length,a=Math.min(s,i),l=new Array(s),u=0;u<a;++u)for(var h=t[u],p=n[u],f=h.length,g=l[u]=new Array(f),y,w=0;w<f;++w)(y=h[w]||p[w])&&(g[w]=y);for(;u<s;++u)l[u]=t[u];return new Xr(l,this._parents,this._name,this._id)}function eO(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function tO(e,t,n){var s,i,a=eO(t)?rw:Er;return function(){var l=a(this,e),u=l.on;u!==s&&(i=(s=u).copy()).on(t,n),l.on=i}}function nO(e,t){var n=this._id;return arguments.length<2?ur(this.node(),n).on.on(e):this.each(tO(n,e,t))}function rO(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function sO(){return this.on("end.remove",rO(this._id))}function oO(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Jy(e));for(var s=this._groups,i=s.length,a=new Array(i),l=0;l<i;++l)for(var u=s[l],h=u.length,p=a[l]=new Array(h),f,g,y=0;y<h;++y)(f=u[y])&&(g=e.call(f,f.__data__,y,u))&&("__data__"in f&&(g.__data__=f.__data__),p[y]=g,Ru(p[y],t,n,y,p,ur(f,n)));return new Xr(a,this._parents,t,n)}function iO(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Tj(e));for(var s=this._groups,i=s.length,a=[],l=[],u=0;u<i;++u)for(var h=s[u],p=h.length,f,g=0;g<p;++g)if(f=h[g]){for(var y=e.call(f,f.__data__,g,h),w,N=ur(f,n),b=0,_=y.length;b<_;++b)(w=y[b])&&Ru(w,t,n,b,y,N);a.push(y),l.push(f)}return new Xr(a,l,t,n)}var aO=hl.prototype.constructor;function lO(){return new aO(this._groups,this._parents)}function cO(e,t){var n,s,i;return function(){var a=$i(this,e),l=(this.style.removeProperty(e),$i(this,e));return a===l?null:a===n&&l===s?i:i=t(n=a,s=l)}}function Jj(e){return function(){this.style.removeProperty(e)}}function uO(e,t,n){var s,i=n+"",a;return function(){var l=$i(this,e);return l===i?null:l===s?a:a=t(s=l,n)}}function dO(e,t,n){var s,i,a;return function(){var l=$i(this,e),u=n(this),h=u+"";return u==null&&(h=u=(this.style.removeProperty(e),$i(this,e))),l===h?null:l===s&&h===i?a:(i=h,a=t(s=l,u))}}function fO(e,t){var n,s,i,a="style."+t,l="end."+a,u;return function(){var h=Er(this,e),p=h.on,f=h.value[a]==null?u||(u=Jj(t)):void 0;(p!==n||i!==f)&&(s=(n=p).copy()).on(l,i=f),h.on=s}}function hO(e,t,n){var s=(e+="")=="transform"?hI:Zj;return t==null?this.styleTween(e,cO(e,s)).on("end.style."+e,Jj(e)):typeof t=="function"?this.styleTween(e,dO(e,s,sw(this,"style."+e,t))).each(fO(this._id,e)):this.styleTween(e,uO(e,s,t),n).on("end.style."+e,null)}function pO(e,t,n){return function(s){this.style.setProperty(e,t.call(this,s),n)}}function mO(e,t,n){var s,i;function a(){var l=t.apply(this,arguments);return l!==i&&(s=(i=l)&&pO(e,l,n)),s}return a._value=t,a}function gO(e,t,n){var s="style."+(e+="");if(arguments.length<2)return(s=this.tween(s))&&s._value;if(t==null)return this.tween(s,null);if(typeof t!="function")throw new Error;return this.tween(s,mO(e,t,n??""))}function vO(e){return function(){this.textContent=e}}function yO(e){return function(){var t=e(this);this.textContent=t??""}}function wO(e){return this.tween("text",typeof e=="function"?yO(sw(this,"text",e)):vO(e==null?"":e+""))}function xO(e){return function(t){this.textContent=e.call(this,t)}}function bO(e){var t,n;function s(){var i=e.apply(this,arguments);return i!==n&&(t=(n=i)&&xO(i)),t}return s._value=e,s}function _O(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,bO(e))}function kO(){for(var e=this._name,t=this._id,n=eC(),s=this._groups,i=s.length,a=0;a<i;++a)for(var l=s[a],u=l.length,h,p=0;p<u;++p)if(h=l[p]){var f=ur(h,t);Ru(h,e,n,p,l,{time:f.time+f.delay+f.duration,delay:0,duration:f.duration,ease:f.ease})}return new Xr(s,this._parents,e,n)}function SO(){var e,t,n=this,s=n._id,i=n.size();return new Promise(function(a,l){var u={value:l},h={value:function(){--i===0&&a()}};n.each(function(){var p=Er(this,s),f=p.on;f!==e&&(t=(e=f).copy(),t._.cancel.push(u),t._.interrupt.push(u),t._.end.push(h)),p.on=t}),i===0&&a()})}var NO=0;function Xr(e,t,n,s){this._groups=e,this._parents=t,this._name=n,this._id=s}function eC(){return++NO}var Vr=hl.prototype;Xr.prototype={constructor:Xr,select:oO,selectAll:iO,selectChild:Vr.selectChild,selectChildren:Vr.selectChildren,filter:ZI,merge:JI,selection:lO,transition:kO,call:Vr.call,nodes:Vr.nodes,node:Vr.node,size:Vr.size,empty:Vr.empty,each:Vr.each,on:nO,attr:$I,attrTween:zI,style:hO,styleTween:gO,text:wO,textTween:_O,remove:sO,tween:TI,delay:WI,duration:VI,ease:KI,easeVarying:QI,end:SO,[Symbol.iterator]:Vr[Symbol.iterator]};function EO(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var jO={time:null,delay:0,duration:250,ease:EO};function CO(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function TO(e){var t,n;e instanceof Xr?(t=e._id,e=e._name):(t=eC(),(n=jO).time=nw(),e=e==null?null:e+"");for(var s=this._groups,i=s.length,a=0;a<i;++a)for(var l=s[a],u=l.length,h,p=0;p<u;++p)(h=l[p])&&Ru(h,e,t,p,l,n||CO(h,t));return new Xr(s,this._parents,e,t)}hl.prototype.interrupt=EI;hl.prototype.transition=TO;const Uc=e=>()=>e;function RO(e,{sourceEvent:t,target:n,transform:s,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:s,enumerable:!0,configurable:!0},_:{value:i}})}function Yr(e,t,n){this.k=e,this.x=t,this.y=n}Yr.prototype={constructor:Yr,scale:function(e){return e===1?this:new Yr(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Yr(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 Kr=new Yr(1,0,0);Yr.prototype;function zf(e){e.stopImmediatePropagation()}function Da(e){e.preventDefault(),e.stopImmediatePropagation()}function AO(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function MO(){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 _b(){return this.__zoom||Kr}function IO(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function OO(){return navigator.maxTouchPoints||"ontouchstart"in this}function PO(e,t,n){var s=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],a=e.invertY(t[0][1])-n[0][1],l=e.invertY(t[1][1])-n[1][1];return e.translate(i>s?(s+i)/2:Math.min(0,s)||Math.max(0,i),l>a?(a+l)/2:Math.min(0,a)||Math.max(0,l))}function tC(){var e=AO,t=MO,n=PO,s=IO,i=OO,a=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],u=250,h=yI,p=ju("start","zoom","end"),f,g,y,w=500,N=150,b=0,_=10;function k(T){T.property("__zoom",_b).on("wheel.zoom",F,{passive:!1}).on("mousedown.zoom",M).on("dblclick.zoom",A).filter(i).on("touchstart.zoom",q).on("touchmove.zoom",W).on("touchend.zoom touchcancel.zoom",Y).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}k.transform=function(T,Z,U,ne){var X=T.selection?T.selection():T;X.property("__zoom",_b),T!==X?I(T,Z,U,ne):X.interrupt().each(function(){P(this,arguments).event(ne).start().zoom(null,typeof Z=="function"?Z.apply(this,arguments):Z).end()})},k.scaleBy=function(T,Z,U,ne){k.scaleTo(T,function(){var X=this.__zoom.k,H=typeof Z=="function"?Z.apply(this,arguments):Z;return X*H},U,ne)},k.scaleTo=function(T,Z,U,ne){k.transform(T,function(){var X=t.apply(this,arguments),H=this.__zoom,J=U==null?C(X):typeof U=="function"?U.apply(this,arguments):U,$=H.invert(J),G=typeof Z=="function"?Z.apply(this,arguments):Z;return n(j(E(H,G),J,$),X,l)},U,ne)},k.translateBy=function(T,Z,U,ne){k.transform(T,function(){return n(this.__zoom.translate(typeof Z=="function"?Z.apply(this,arguments):Z,typeof U=="function"?U.apply(this,arguments):U),t.apply(this,arguments),l)},null,ne)},k.translateTo=function(T,Z,U,ne,X){k.transform(T,function(){var H=t.apply(this,arguments),J=this.__zoom,$=ne==null?C(H):typeof ne=="function"?ne.apply(this,arguments):ne;return n(Kr.translate($[0],$[1]).scale(J.k).translate(typeof Z=="function"?-Z.apply(this,arguments):-Z,typeof U=="function"?-U.apply(this,arguments):-U),H,l)},ne,X)};function E(T,Z){return Z=Math.max(a[0],Math.min(a[1],Z)),Z===T.k?T:new Yr(Z,T.x,T.y)}function j(T,Z,U){var ne=Z[0]-U[0]*T.k,X=Z[1]-U[1]*T.k;return ne===T.x&&X===T.y?T:new Yr(T.k,ne,X)}function C(T){return[(+T[0][0]+ +T[1][0])/2,(+T[0][1]+ +T[1][1])/2]}function I(T,Z,U,ne){T.on("start.zoom",function(){P(this,arguments).event(ne).start()}).on("interrupt.zoom end.zoom",function(){P(this,arguments).event(ne).end()}).tween("zoom",function(){var X=this,H=arguments,J=P(X,H).event(ne),$=t.apply(X,H),G=U==null?C($):typeof U=="function"?U.apply(X,H):U,Q=Math.max($[1][0]-$[0][0],$[1][1]-$[0][1]),D=X.__zoom,L=typeof Z=="function"?Z.apply(X,H):Z,K=h(D.invert(G).concat(Q/D.k),L.invert(G).concat(Q/L.k));return function(se){if(se===1)se=L;else{var he=K(se),pe=Q/he[2];se=new Yr(pe,G[0]-he[0]*pe,G[1]-he[1]*pe)}J.zoom(null,se)}})}function P(T,Z,U){return!U&&T.__zooming||new O(T,Z)}function O(T,Z){this.that=T,this.args=Z,this.active=0,this.sourceEvent=null,this.extent=t.apply(T,Z),this.taps=0}O.prototype={event:function(T){return T&&(this.sourceEvent=T),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(T,Z){return this.mouse&&T!=="mouse"&&(this.mouse[1]=Z.invert(this.mouse[0])),this.touch0&&T!=="touch"&&(this.touch0[1]=Z.invert(this.touch0[0])),this.touch1&&T!=="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(T){var Z=Ln(this.that).datum();p.call(T,this.that,new RO(T,{sourceEvent:this.sourceEvent,target:k,transform:this.that.__zoom,dispatch:p}),Z)}};function F(T,...Z){if(!e.apply(this,arguments))return;var U=P(this,Z).event(T),ne=this.__zoom,X=Math.max(a[0],Math.min(a[1],ne.k*Math.pow(2,s.apply(this,arguments)))),H=sr(T);if(U.wheel)(U.mouse[0][0]!==H[0]||U.mouse[0][1]!==H[1])&&(U.mouse[1]=ne.invert(U.mouse[0]=H)),clearTimeout(U.wheel);else{if(ne.k===X)return;U.mouse=[H,ne.invert(H)],au(this),U.start()}Da(T),U.wheel=setTimeout(J,N),U.zoom("mouse",n(j(E(ne,X),U.mouse[0],U.mouse[1]),U.extent,l));function J(){U.wheel=null,U.end()}}function M(T,...Z){if(y||!e.apply(this,arguments))return;var U=T.currentTarget,ne=P(this,Z,!0).event(T),X=Ln(T.view).on("mousemove.zoom",G,!0).on("mouseup.zoom",Q,!0),H=sr(T,U),J=T.clientX,$=T.clientY;Fj(T.view),zf(T),ne.mouse=[H,this.__zoom.invert(H)],au(this),ne.start();function G(D){if(Da(D),!ne.moved){var L=D.clientX-J,K=D.clientY-$;ne.moved=L*L+K*K>b}ne.event(D).zoom("mouse",n(j(ne.that.__zoom,ne.mouse[0]=sr(D,U),ne.mouse[1]),ne.extent,l))}function Q(D){X.on("mousemove.zoom mouseup.zoom",null),zj(D.view,ne.moved),Da(D),ne.event(D).end()}}function A(T,...Z){if(e.apply(this,arguments)){var U=this.__zoom,ne=sr(T.changedTouches?T.changedTouches[0]:T,this),X=U.invert(ne),H=U.k*(T.shiftKey?.5:2),J=n(j(E(U,H),ne,X),t.apply(this,Z),l);Da(T),u>0?Ln(this).transition().duration(u).call(I,J,ne,T):Ln(this).call(k.transform,J,ne,T)}}function q(T,...Z){if(e.apply(this,arguments)){var U=T.touches,ne=U.length,X=P(this,Z,T.changedTouches.length===ne).event(T),H,J,$,G;for(zf(T),J=0;J<ne;++J)$=U[J],G=sr($,this),G=[G,this.__zoom.invert(G),$.identifier],X.touch0?!X.touch1&&X.touch0[2]!==G[2]&&(X.touch1=G,X.taps=0):(X.touch0=G,H=!0,X.taps=1+!!f);f&&(f=clearTimeout(f)),H&&(X.taps<2&&(g=G[0],f=setTimeout(function(){f=null},w)),au(this),X.start())}}function W(T,...Z){if(this.__zooming){var U=P(this,Z).event(T),ne=T.changedTouches,X=ne.length,H,J,$,G;for(Da(T),H=0;H<X;++H)J=ne[H],$=sr(J,this),U.touch0&&U.touch0[2]===J.identifier?U.touch0[0]=$:U.touch1&&U.touch1[2]===J.identifier&&(U.touch1[0]=$);if(J=U.that.__zoom,U.touch1){var Q=U.touch0[0],D=U.touch0[1],L=U.touch1[0],K=U.touch1[1],se=(se=L[0]-Q[0])*se+(se=L[1]-Q[1])*se,he=(he=K[0]-D[0])*he+(he=K[1]-D[1])*he;J=E(J,Math.sqrt(se/he)),$=[(Q[0]+L[0])/2,(Q[1]+L[1])/2],G=[(D[0]+K[0])/2,(D[1]+K[1])/2]}else if(U.touch0)$=U.touch0[0],G=U.touch0[1];else return;U.zoom("touch",n(j(J,$,G),U.extent,l))}}function Y(T,...Z){if(this.__zooming){var U=P(this,Z).event(T),ne=T.changedTouches,X=ne.length,H,J;for(zf(T),y&&clearTimeout(y),y=setTimeout(function(){y=null},w),H=0;H<X;++H)J=ne[H],U.touch0&&U.touch0[2]===J.identifier?delete U.touch0:U.touch1&&U.touch1[2]===J.identifier&&delete U.touch1;if(U.touch1&&!U.touch0&&(U.touch0=U.touch1,delete U.touch1),U.touch0)U.touch0[1]=this.__zoom.invert(U.touch0[0]);else if(U.end(),U.taps===2&&(J=sr(J,this),Math.hypot(g[0]-J[0],g[1]-J[1])<_)){var $=Ln(this).on("dblclick.zoom");$&&$.apply(this,arguments)}}}return k.wheelDelta=function(T){return arguments.length?(s=typeof T=="function"?T:Uc(+T),k):s},k.filter=function(T){return arguments.length?(e=typeof T=="function"?T:Uc(!!T),k):e},k.touchable=function(T){return arguments.length?(i=typeof T=="function"?T:Uc(!!T),k):i},k.extent=function(T){return arguments.length?(t=typeof T=="function"?T:Uc([[+T[0][0],+T[0][1]],[+T[1][0],+T[1][1]]]),k):t},k.scaleExtent=function(T){return arguments.length?(a[0]=+T[0],a[1]=+T[1],k):[a[0],a[1]]},k.translateExtent=function(T){return arguments.length?(l[0][0]=+T[0][0],l[1][0]=+T[1][0],l[0][1]=+T[0][1],l[1][1]=+T[1][1],k):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},k.constrain=function(T){return arguments.length?(n=T,k):n},k.duration=function(T){return arguments.length?(u=+T,k):u},k.interpolate=function(T){return arguments.length?(h=T,k):h},k.on=function(){var T=p.on.apply(p,arguments);return T===p?k:T},k.clickDistance=function(T){return arguments.length?(b=(T=+T)*T,k):Math.sqrt(b)},k.tapDistance=function(T){return arguments.length?(_=+T,k):_},k}var ow=Ej();const Au=S.createContext(null),$O=Au.Provider,Qr={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.`},nC=Qr.error001();function st(e,t){const n=S.useContext(Au);if(n===null)throw new Error(nC);return jj(n,e,t)}const Rt=()=>{const e=S.useContext(Au);if(e===null)throw new Error(nC);return S.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},LO=e=>e.userSelectionActive?"none":"all";function iw({position:e,children:t,className:n,style:s,...i}){const a=st(LO),l=`${e}`.split("-");return de.createElement("div",{className:Ht(["react-flow__panel",n,...l]),style:{...s,pointerEvents:a},...i},t)}function qO({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:de.createElement(iw,{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"},de.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}const DO=({x:e,y:t,label:n,labelStyle:s={},labelShowBg:i=!0,labelBgStyle:a={},labelBgPadding:l=[2,4],labelBgBorderRadius:u=2,children:h,className:p,...f})=>{const g=S.useRef(null),[y,w]=S.useState({x:0,y:0,width:0,height:0}),N=Ht(["react-flow__edge-textwrapper",p]);return S.useEffect(()=>{if(g.current){const b=g.current.getBBox();w({x:b.x,y:b.y,width:b.width,height:b.height})}},[n]),typeof n>"u"||!n?null:de.createElement("g",{transform:`translate(${e-y.width/2} ${t-y.height/2})`,className:N,visibility:y.width?"visible":"hidden",...f},i&&de.createElement("rect",{width:y.width+2*l[0],x:-l[0],y:-l[1],height:y.height+2*l[1],className:"react-flow__edge-textbg",style:a,rx:u,ry:u}),de.createElement("text",{className:"react-flow__edge-text",y:y.height/2,dy:"0.3em",ref:g,style:s},n),h)};var FO=S.memo(DO);const aw=e=>({width:e.offsetWidth,height:e.offsetHeight}),qi=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),lw=(e={x:0,y:0},t)=>({x:qi(e.x,t[0][0],t[1][0]),y:qi(e.y,t[0][1],t[1][1])}),kb=(e,t,n)=>e<t?qi(Math.abs(e-t),1,50)/50:e>n?-qi(Math.abs(e-n),1,50)/50:0,rC=(e,t)=>{const n=kb(e.x,35,t.width-35)*20,s=kb(e.y,35,t.height-35)*20;return[n,s]},sC=e=>{var t;return((t=e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},oC=(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)}),ol=({x:e,y:t,width:n,height:s})=>({x:e,y:t,x2:e+n,y2:t+s}),iC=({x:e,y:t,x2:n,y2:s})=>({x:e,y:t,width:n-e,height:s-t}),Sb=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),zO=(e,t)=>iC(oC(ol(e),ol(t))),jy=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),s=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*s)},BO=e=>qn(e.width)&&qn(e.height)&&qn(e.x)&&qn(e.y),qn=e=>!isNaN(e)&&isFinite(e),Nt=Symbol.for("internals"),aC=["Enter"," ","Escape"],UO=(e,t)=>{},WO=e=>"nativeEvent"in e;function Cy(e){var i,a;const t=WO(e)?e.nativeEvent:e,n=((a=(i=t.composedPath)==null?void 0:i.call(t))==null?void 0:a[0])||e.target;return["INPUT","SELECT","TEXTAREA"].includes(n==null?void 0:n.nodeName)||(n==null?void 0:n.hasAttribute("contenteditable"))||!!(n!=null&&n.closest(".nokey"))}const lC=e=>"clientX"in e,As=(e,t)=>{var a,l;const n=lC(e),s=n?e.clientX:(a=e.touches)==null?void 0:a[0].clientX,i=n?e.clientY:(l=e.touches)==null?void 0:l[0].clientY;return{x:s-((t==null?void 0:t.left)??0),y:i-((t==null?void 0:t.top)??0)}},gu=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0},ml=({id:e,path:t,labelX:n,labelY:s,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:p,style:f,markerEnd:g,markerStart:y,interactionWidth:w=20})=>de.createElement(de.Fragment,null,de.createElement("path",{id:e,style:f,d:t,fill:"none",className:"react-flow__edge-path",markerEnd:g,markerStart:y}),w&&de.createElement("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:w,className:"react-flow__edge-interaction"}),i&&qn(n)&&qn(s)?de.createElement(FO,{x:n,y:s,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:p}):null);ml.displayName="BaseEdge";function Fa(e,t,n){return n===void 0?n:s=>{const i=t().edges.find(a=>a.id===e);i&&n(s,{...i})}}function cC({sourceX:e,sourceY:t,targetX:n,targetY:s}){const i=Math.abs(n-e)/2,a=n<e?n+i:n-i,l=Math.abs(s-t)/2,u=s<t?s+l:s-l;return[a,u,i,l]}function uC({sourceX:e,sourceY:t,targetX:n,targetY:s,sourceControlX:i,sourceControlY:a,targetControlX:l,targetControlY:u}){const h=e*.125+i*.375+l*.375+n*.125,p=t*.125+a*.375+u*.375+s*.125,f=Math.abs(h-e),g=Math.abs(p-t);return[h,p,f,g]}var _o;(function(e){e.Strict="strict",e.Loose="loose"})(_o||(_o={}));var yo;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(yo||(yo={}));var il;(function(e){e.Partial="partial",e.Full="full"})(il||(il={}));var Rs;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Rs||(Rs={}));var vu;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(vu||(vu={}));var Pe;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Pe||(Pe={}));function Nb({pos:e,x1:t,y1:n,x2:s,y2:i}){return e===Pe.Left||e===Pe.Right?[.5*(t+s),n]:[t,.5*(n+i)]}function dC({sourceX:e,sourceY:t,sourcePosition:n=Pe.Bottom,targetX:s,targetY:i,targetPosition:a=Pe.Top}){const[l,u]=Nb({pos:n,x1:e,y1:t,x2:s,y2:i}),[h,p]=Nb({pos:a,x1:s,y1:i,x2:e,y2:t}),[f,g,y,w]=uC({sourceX:e,sourceY:t,targetX:s,targetY:i,sourceControlX:l,sourceControlY:u,targetControlX:h,targetControlY:p});return[`M${e},${t} C${l},${u} ${h},${p} ${s},${i}`,f,g,y,w]}const cw=S.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,sourcePosition:i=Pe.Bottom,targetPosition:a=Pe.Top,label:l,labelStyle:u,labelShowBg:h,labelBgStyle:p,labelBgPadding:f,labelBgBorderRadius:g,style:y,markerEnd:w,markerStart:N,interactionWidth:b})=>{const[_,k,E]=dC({sourceX:e,sourceY:t,sourcePosition:i,targetX:n,targetY:s,targetPosition:a});return de.createElement(ml,{path:_,labelX:k,labelY:E,label:l,labelStyle:u,labelShowBg:h,labelBgStyle:p,labelBgPadding:f,labelBgBorderRadius:g,style:y,markerEnd:w,markerStart:N,interactionWidth:b})});cw.displayName="SimpleBezierEdge";const Eb={[Pe.Left]:{x:-1,y:0},[Pe.Right]:{x:1,y:0},[Pe.Top]:{x:0,y:-1},[Pe.Bottom]:{x:0,y:1}},HO=({source:e,sourcePosition:t=Pe.Bottom,target:n})=>t===Pe.Left||t===Pe.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},jb=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function GO({source:e,sourcePosition:t=Pe.Bottom,target:n,targetPosition:s=Pe.Top,center:i,offset:a}){const l=Eb[t],u=Eb[s],h={x:e.x+l.x*a,y:e.y+l.y*a},p={x:n.x+u.x*a,y:n.y+u.y*a},f=HO({source:h,sourcePosition:t,target:p}),g=f.x!==0?"x":"y",y=f[g];let w=[],N,b;const _={x:0,y:0},k={x:0,y:0},[E,j,C,I]=cC({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[g]*u[g]===-1){N=i.x??E,b=i.y??j;const O=[{x:N,y:h.y},{x:N,y:p.y}],F=[{x:h.x,y:b},{x:p.x,y:b}];l[g]===y?w=g==="x"?O:F:w=g==="x"?F:O}else{const O=[{x:h.x,y:p.y}],F=[{x:p.x,y:h.y}];if(g==="x"?w=l.x===y?F:O:w=l.y===y?O:F,t===s){const Y=Math.abs(e[g]-n[g]);if(Y<=a){const T=Math.min(a-1,a-Y);l[g]===y?_[g]=(h[g]>e[g]?-1:1)*T:k[g]=(p[g]>n[g]?-1:1)*T}}if(t!==s){const Y=g==="x"?"y":"x",T=l[g]===u[Y],Z=h[Y]>p[Y],U=h[Y]<p[Y];(l[g]===1&&(!T&&Z||T&&U)||l[g]!==1&&(!T&&U||T&&Z))&&(w=g==="x"?O:F)}const M={x:h.x+_.x,y:h.y+_.y},A={x:p.x+k.x,y:p.y+k.y},q=Math.max(Math.abs(M.x-w[0].x),Math.abs(A.x-w[0].x)),W=Math.max(Math.abs(M.y-w[0].y),Math.abs(A.y-w[0].y));q>=W?(N=(M.x+A.x)/2,b=w[0].y):(N=w[0].x,b=(M.y+A.y)/2)}return[[e,{x:h.x+_.x,y:h.y+_.y},...w,{x:p.x+k.x,y:p.y+k.y},n],N,b,C,I]}function VO(e,t,n,s){const i=Math.min(jb(e,t)/2,jb(t,n)/2,s),{x:a,y:l}=t;if(e.x===a&&a===n.x||e.y===l&&l===n.y)return`L${a} ${l}`;if(e.y===l){const p=e.x<n.x?-1:1,f=e.y<n.y?1:-1;return`L ${a+i*p},${l}Q ${a},${l} ${a},${l+i*f}`}const u=e.x<n.x?1:-1,h=e.y<n.y?-1:1;return`L ${a},${l+i*h}Q ${a},${l} ${a+i*u},${l}`}function Ty({sourceX:e,sourceY:t,sourcePosition:n=Pe.Bottom,targetX:s,targetY:i,targetPosition:a=Pe.Top,borderRadius:l=5,centerX:u,centerY:h,offset:p=20}){const[f,g,y,w,N]=GO({source:{x:e,y:t},sourcePosition:n,target:{x:s,y:i},targetPosition:a,center:{x:u,y:h},offset:p});return[f.reduce((_,k,E)=>{let j="";return E>0&&E<f.length-1?j=VO(f[E-1],k,f[E+1],l):j=`${E===0?"M":"L"}${k.x} ${k.y}`,_+=j,_},""),g,y,w,N]}const Mu=S.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:p,style:f,sourcePosition:g=Pe.Bottom,targetPosition:y=Pe.Top,markerEnd:w,markerStart:N,pathOptions:b,interactionWidth:_})=>{const[k,E,j]=Ty({sourceX:e,sourceY:t,sourcePosition:g,targetX:n,targetY:s,targetPosition:y,borderRadius:b==null?void 0:b.borderRadius,offset:b==null?void 0:b.offset});return de.createElement(ml,{path:k,labelX:E,labelY:j,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:p,style:f,markerEnd:w,markerStart:N,interactionWidth:_})});Mu.displayName="SmoothStepEdge";const uw=S.memo(e=>{var t;return de.createElement(Mu,{...e,pathOptions:S.useMemo(()=>{var n;return{borderRadius:0,offset:(n=e.pathOptions)==null?void 0:n.offset}},[(t=e.pathOptions)==null?void 0:t.offset])})});uw.displayName="StepEdge";function YO({sourceX:e,sourceY:t,targetX:n,targetY:s}){const[i,a,l,u]=cC({sourceX:e,sourceY:t,targetX:n,targetY:s});return[`M ${e},${t}L ${n},${s}`,i,a,l,u]}const dw=S.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:p,style:f,markerEnd:g,markerStart:y,interactionWidth:w})=>{const[N,b,_]=YO({sourceX:e,sourceY:t,targetX:n,targetY:s});return de.createElement(ml,{path:N,labelX:b,labelY:_,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:p,style:f,markerEnd:g,markerStart:y,interactionWidth:w})});dw.displayName="StraightEdge";function Wc(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Cb({pos:e,x1:t,y1:n,x2:s,y2:i,c:a}){switch(e){case Pe.Left:return[t-Wc(t-s,a),n];case Pe.Right:return[t+Wc(s-t,a),n];case Pe.Top:return[t,n-Wc(n-i,a)];case Pe.Bottom:return[t,n+Wc(i-n,a)]}}function fC({sourceX:e,sourceY:t,sourcePosition:n=Pe.Bottom,targetX:s,targetY:i,targetPosition:a=Pe.Top,curvature:l=.25}){const[u,h]=Cb({pos:n,x1:e,y1:t,x2:s,y2:i,c:l}),[p,f]=Cb({pos:a,x1:s,y1:i,x2:e,y2:t,c:l}),[g,y,w,N]=uC({sourceX:e,sourceY:t,targetX:s,targetY:i,sourceControlX:u,sourceControlY:h,targetControlX:p,targetControlY:f});return[`M${e},${t} C${u},${h} ${p},${f} ${s},${i}`,g,y,w,N]}const yu=S.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,sourcePosition:i=Pe.Bottom,targetPosition:a=Pe.Top,label:l,labelStyle:u,labelShowBg:h,labelBgStyle:p,labelBgPadding:f,labelBgBorderRadius:g,style:y,markerEnd:w,markerStart:N,pathOptions:b,interactionWidth:_})=>{const[k,E,j]=fC({sourceX:e,sourceY:t,sourcePosition:i,targetX:n,targetY:s,targetPosition:a,curvature:b==null?void 0:b.curvature});return de.createElement(ml,{path:k,labelX:E,labelY:j,label:l,labelStyle:u,labelShowBg:h,labelBgStyle:p,labelBgPadding:f,labelBgBorderRadius:g,style:y,markerEnd:w,markerStart:N,interactionWidth:_})});yu.displayName="BezierEdge";const fw=S.createContext(null),KO=fw.Provider;fw.Consumer;const XO=()=>S.useContext(fw),QO=e=>"id"in e&&"source"in e&&"target"in e,ZO=({source:e,sourceHandle:t,target:n,targetHandle:s})=>`reactflow__edge-${e}${t||""}-${n}${s||""}`,Ry=(e,t)=>typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(s=>`${s}=${e[s]}`).join("&")}`,JO=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),eP=(e,t)=>{if(!e.source||!e.target)return t;let n;return QO(e)?n={...e}:n={...e,id:ZO(e)},JO(n,t)?t:t.concat(n)},Ay=({x:e,y:t},[n,s,i],a,[l,u])=>{const h={x:(e-n)/i,y:(t-s)/i};return a?{x:l*Math.round(h.x/l),y:u*Math.round(h.y/u)}:h},hC=({x:e,y:t},[n,s,i])=>({x:e*i+n,y:t*i+s}),xo=(e,t=[0,0])=>{if(!e)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const n=(e.width??0)*t[0],s=(e.height??0)*t[1],i={x:e.position.x-n,y:e.position.y-s};return{...i,positionAbsolute:e.positionAbsolute?{x:e.positionAbsolute.x-n,y:e.positionAbsolute.y-s}:i}},Iu=(e,t=[0,0])=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((s,i)=>{const{x:a,y:l}=xo(i,t).positionAbsolute;return oC(s,ol({x:a,y:l,width:i.width||0,height:i.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return iC(n)},pC=(e,t,[n,s,i]=[0,0,1],a=!1,l=!1,u=[0,0])=>{const h={x:(t.x-n)/i,y:(t.y-s)/i,width:t.width/i,height:t.height/i},p=[];return e.forEach(f=>{const{width:g,height:y,selectable:w=!0,hidden:N=!1}=f;if(l&&!w||N)return!1;const{positionAbsolute:b}=xo(f,u),_={x:b.x,y:b.y,width:g||0,height:y||0},k=jy(h,_),E=typeof g>"u"||typeof y>"u"||g===null||y===null,j=a&&k>0,C=(g||0)*(y||0);(E||j||k>=C||f.dragging)&&p.push(f)}),p},mC=(e,t)=>{const n=e.map(s=>s.id);return t.filter(s=>n.includes(s.source)||n.includes(s.target))},gC=(e,t,n,s,i,a=.1)=>{const l=t/(e.width*(1+a)),u=n/(e.height*(1+a)),h=Math.min(l,u),p=qi(h,s,i),f=e.x+e.width/2,g=e.y+e.height/2,y=t/2-f*p,w=n/2-g*p;return{x:y,y:w,zoom:p}},po=(e,t=0)=>e.transition().duration(t);function Tb(e,t,n,s){return(t[n]||[]).reduce((i,a)=>{var l,u;return`${e.id}-${a.id}-${n}`!==s&&i.push({id:a.id||null,type:n,nodeId:e.id,x:(((l=e.positionAbsolute)==null?void 0:l.x)??0)+a.x+a.width/2,y:(((u=e.positionAbsolute)==null?void 0:u.y)??0)+a.y+a.height/2}),i},[])}function tP(e,t,n,s,i,a){const{x:l,y:u}=As(e),p=t.elementsFromPoint(l,u).find(N=>N.classList.contains("react-flow__handle"));if(p){const N=p.getAttribute("data-nodeid");if(N){const b=hw(void 0,p),_=p.getAttribute("data-handleid"),k=a({nodeId:N,id:_,type:b});if(k){const E=i.find(j=>j.nodeId===N&&j.type===b&&j.id===_);return{handle:{id:_,type:b,nodeId:N,x:(E==null?void 0:E.x)||n.x,y:(E==null?void 0:E.y)||n.y},validHandleResult:k}}}}let f=[],g=1/0;if(i.forEach(N=>{const b=Math.sqrt((N.x-n.x)**2+(N.y-n.y)**2);if(b<=s){const _=a(N);b<=g&&(b<g?f=[{handle:N,validHandleResult:_}]:b===g&&f.push({handle:N,validHandleResult:_}),g=b)}}),!f.length)return{handle:null,validHandleResult:vC()};if(f.length===1)return f[0];const y=f.some(({validHandleResult:N})=>N.isValid),w=f.some(({handle:N})=>N.type==="target");return f.find(({handle:N,validHandleResult:b})=>w?N.type==="target":y?b.isValid:!0)||f[0]}const nP={source:null,target:null,sourceHandle:null,targetHandle:null},vC=()=>({handleDomNode:null,isValid:!1,connection:nP,endHandle:null});function yC(e,t,n,s,i,a,l){const u=i==="target",h=l.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={...vC(),handleDomNode:h};if(h){const f=hw(void 0,h),g=h.getAttribute("data-nodeid"),y=h.getAttribute("data-handleid"),w=h.classList.contains("connectable"),N=h.classList.contains("connectableend"),b={source:u?g:n,sourceHandle:u?y:s,target:u?n:g,targetHandle:u?s:y};p.connection=b,w&&N&&(t===_o.Strict?u&&f==="source"||!u&&f==="target":g!==n||y!==s)&&(p.endHandle={nodeId:g,handleId:y,type:f},p.isValid=a(b))}return p}function rP({nodes:e,nodeId:t,handleId:n,handleType:s}){return e.reduce((i,a)=>{if(a[Nt]){const{handleBounds:l}=a[Nt];let u=[],h=[];l&&(u=Tb(a,l,"source",`${t}-${n}-${s}`),h=Tb(a,l,"target",`${t}-${n}-${s}`)),i.push(...u,...h)}return i},[])}function hw(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function Bf(e){e==null||e.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function sP(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}function wC({event:e,handleId:t,nodeId:n,onConnect:s,isTarget:i,getState:a,setState:l,isValidConnection:u,edgeUpdaterType:h,onReconnectEnd:p}){const f=sC(e.target),{connectionMode:g,domNode:y,autoPanOnConnect:w,connectionRadius:N,onConnectStart:b,panBy:_,getNodes:k,cancelConnection:E}=a();let j=0,C;const{x:I,y:P}=As(e),O=f==null?void 0:f.elementFromPoint(I,P),F=hw(h,O),M=y==null?void 0:y.getBoundingClientRect();if(!M||!F)return;let A,q=As(e,M),W=!1,Y=null,T=!1,Z=null;const U=rP({nodes:k(),nodeId:n,handleId:t,handleType:F}),ne=()=>{if(!w)return;const[J,$]=rC(q,M);_({x:J,y:$}),j=requestAnimationFrame(ne)};l({connectionPosition:q,connectionStatus:null,connectionNodeId:n,connectionHandleId:t,connectionHandleType:F,connectionStartHandle:{nodeId:n,handleId:t,type:F},connectionEndHandle:null}),b==null||b(e,{nodeId:n,handleId:t,handleType:F});function X(J){const{transform:$}=a();q=As(J,M);const{handle:G,validHandleResult:Q}=tP(J,f,Ay(q,$,!1,[1,1]),N,U,D=>yC(D,g,n,t,i?"target":"source",u,f));if(C=G,W||(ne(),W=!0),Z=Q.handleDomNode,Y=Q.connection,T=Q.isValid,l({connectionPosition:C&&T?hC({x:C.x,y:C.y},$):q,connectionStatus:sP(!!C,T),connectionEndHandle:Q.endHandle}),!C&&!T&&!Z)return Bf(A);Y.source!==Y.target&&Z&&(Bf(A),A=Z,Z.classList.add("connecting","react-flow__handle-connecting"),Z.classList.toggle("valid",T),Z.classList.toggle("react-flow__handle-valid",T))}function H(J){var $,G;(C||Z)&&Y&&T&&(s==null||s(Y)),(G=($=a()).onConnectEnd)==null||G.call($,J),h&&(p==null||p(J)),Bf(A),E(),cancelAnimationFrame(j),W=!1,T=!1,Y=null,Z=null,f.removeEventListener("mousemove",X),f.removeEventListener("mouseup",H),f.removeEventListener("touchmove",X),f.removeEventListener("touchend",H)}f.addEventListener("mousemove",X),f.addEventListener("mouseup",H),f.addEventListener("touchmove",X),f.addEventListener("touchend",H)}const Rb=()=>!0,oP=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),iP=(e,t,n)=>s=>{const{connectionStartHandle:i,connectionEndHandle:a,connectionClickStartHandle:l}=s;return{connecting:(i==null?void 0:i.nodeId)===e&&(i==null?void 0:i.handleId)===t&&(i==null?void 0:i.type)===n||(a==null?void 0:a.nodeId)===e&&(a==null?void 0:a.handleId)===t&&(a==null?void 0:a.type)===n,clickConnecting:(l==null?void 0:l.nodeId)===e&&(l==null?void 0:l.handleId)===t&&(l==null?void 0:l.type)===n}},xC=S.forwardRef(({type:e="source",position:t=Pe.Top,isValidConnection:n,isConnectable:s=!0,isConnectableStart:i=!0,isConnectableEnd:a=!0,id:l,onConnect:u,children:h,className:p,onMouseDown:f,onTouchStart:g,...y},w)=>{var M,A;const N=l||null,b=e==="target",_=Rt(),k=XO(),{connectOnClick:E,noPanClassName:j}=st(oP,$t),{connecting:C,clickConnecting:I}=st(iP(k,N,e),$t);k||(A=(M=_.getState()).onError)==null||A.call(M,"010",Qr.error010());const P=q=>{const{defaultEdgeOptions:W,onConnect:Y,hasDefaultEdges:T}=_.getState(),Z={...W,...q};if(T){const{edges:U,setEdges:ne}=_.getState();ne(eP(Z,U))}Y==null||Y(Z),u==null||u(Z)},O=q=>{if(!k)return;const W=lC(q);i&&(W&&q.button===0||!W)&&wC({event:q,handleId:N,nodeId:k,onConnect:P,isTarget:b,getState:_.getState,setState:_.setState,isValidConnection:n||_.getState().isValidConnection||Rb}),W?f==null||f(q):g==null||g(q)},F=q=>{const{onClickConnectStart:W,onClickConnectEnd:Y,connectionClickStartHandle:T,connectionMode:Z,isValidConnection:U}=_.getState();if(!k||!T&&!i)return;if(!T){W==null||W(q,{nodeId:k,handleId:N,handleType:e}),_.setState({connectionClickStartHandle:{nodeId:k,type:e,handleId:N}});return}const ne=sC(q.target),X=n||U||Rb,{connection:H,isValid:J}=yC({nodeId:k,id:N,type:e},Z,T.nodeId,T.handleId||null,T.type,X,ne);J&&P(H),Y==null||Y(q),_.setState({connectionClickStartHandle:null})};return de.createElement("div",{"data-handleid":N,"data-nodeid":k,"data-handlepos":t,"data-id":`${k}-${N}-${e}`,className:Ht(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",j,p,{source:!b,target:b,connectable:s,connectablestart:i,connectableend:a,connecting:I,connectionindicator:s&&(i&&!C||a&&C)}]),onMouseDown:O,onTouchStart:O,onClick:E?F:void 0,ref:w,...y},h)});xC.displayName="Handle";var Di=S.memo(xC);const bC=({data:e,isConnectable:t,targetPosition:n=Pe.Top,sourcePosition:s=Pe.Bottom})=>de.createElement(de.Fragment,null,de.createElement(Di,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,de.createElement(Di,{type:"source",position:s,isConnectable:t}));bC.displayName="DefaultNode";var My=S.memo(bC);const _C=({data:e,isConnectable:t,sourcePosition:n=Pe.Bottom})=>de.createElement(de.Fragment,null,e==null?void 0:e.label,de.createElement(Di,{type:"source",position:n,isConnectable:t}));_C.displayName="InputNode";var kC=S.memo(_C);const SC=({data:e,isConnectable:t,targetPosition:n=Pe.Top})=>de.createElement(de.Fragment,null,de.createElement(Di,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label);SC.displayName="OutputNode";var NC=S.memo(SC);const pw=()=>null;pw.displayName="GroupNode";const aP=e=>({selectedNodes:e.getNodes().filter(t=>t.selected),selectedEdges:e.edges.filter(t=>t.selected).map(t=>({...t}))}),Hc=e=>e.id;function lP(e,t){return $t(e.selectedNodes.map(Hc),t.selectedNodes.map(Hc))&&$t(e.selectedEdges.map(Hc),t.selectedEdges.map(Hc))}const EC=S.memo(({onSelectionChange:e})=>{const t=Rt(),{selectedNodes:n,selectedEdges:s}=st(aP,lP);return S.useEffect(()=>{const i={nodes:n,edges:s};e==null||e(i),t.getState().onSelectionChange.forEach(a=>a(i))},[n,s,e]),null});EC.displayName="SelectionListener";const cP=e=>!!e.onSelectionChange;function uP({onSelectionChange:e}){const t=st(cP);return e||t?de.createElement(EC,{onSelectionChange:e}):null}const dP=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 wi(e,t){S.useEffect(()=>{typeof e<"u"&&t(e)},[e])}function Ye(e,t,n){S.useEffect(()=>{typeof t<"u"&&n({[e]:t})},[t])}const fP=({nodes:e,edges:t,defaultNodes:n,defaultEdges:s,onConnect:i,onConnectStart:a,onConnectEnd:l,onClickConnectStart:u,onClickConnectEnd:h,nodesDraggable:p,nodesConnectable:f,nodesFocusable:g,edgesFocusable:y,edgesUpdatable:w,elevateNodesOnSelect:N,minZoom:b,maxZoom:_,nodeExtent:k,onNodesChange:E,onEdgesChange:j,elementsSelectable:C,connectionMode:I,snapGrid:P,snapToGrid:O,translateExtent:F,connectOnClick:M,defaultEdgeOptions:A,fitView:q,fitViewOptions:W,onNodesDelete:Y,onEdgesDelete:T,onNodeDrag:Z,onNodeDragStart:U,onNodeDragStop:ne,onSelectionDrag:X,onSelectionDragStart:H,onSelectionDragStop:J,noPanClassName:$,nodeOrigin:G,rfId:Q,autoPanOnConnect:D,autoPanOnNodeDrag:L,onError:K,connectionRadius:se,isValidConnection:he,nodeDragThreshold:pe})=>{const{setNodes:re,setEdges:ve,setDefaultNodesAndEdges:Te,setMinZoom:$e,setMaxZoom:Me,setTranslateExtent:_e,setNodeExtent:ae,reset:we}=st(dP,$t),be=Rt();return S.useEffect(()=>{const Ue=s==null?void 0:s.map(Ke=>({...Ke,...A}));return Te(n,Ue),()=>{we()}},[]),Ye("defaultEdgeOptions",A,be.setState),Ye("connectionMode",I,be.setState),Ye("onConnect",i,be.setState),Ye("onConnectStart",a,be.setState),Ye("onConnectEnd",l,be.setState),Ye("onClickConnectStart",u,be.setState),Ye("onClickConnectEnd",h,be.setState),Ye("nodesDraggable",p,be.setState),Ye("nodesConnectable",f,be.setState),Ye("nodesFocusable",g,be.setState),Ye("edgesFocusable",y,be.setState),Ye("edgesUpdatable",w,be.setState),Ye("elementsSelectable",C,be.setState),Ye("elevateNodesOnSelect",N,be.setState),Ye("snapToGrid",O,be.setState),Ye("snapGrid",P,be.setState),Ye("onNodesChange",E,be.setState),Ye("onEdgesChange",j,be.setState),Ye("connectOnClick",M,be.setState),Ye("fitViewOnInit",q,be.setState),Ye("fitViewOnInitOptions",W,be.setState),Ye("onNodesDelete",Y,be.setState),Ye("onEdgesDelete",T,be.setState),Ye("onNodeDrag",Z,be.setState),Ye("onNodeDragStart",U,be.setState),Ye("onNodeDragStop",ne,be.setState),Ye("onSelectionDrag",X,be.setState),Ye("onSelectionDragStart",H,be.setState),Ye("onSelectionDragStop",J,be.setState),Ye("noPanClassName",$,be.setState),Ye("nodeOrigin",G,be.setState),Ye("rfId",Q,be.setState),Ye("autoPanOnConnect",D,be.setState),Ye("autoPanOnNodeDrag",L,be.setState),Ye("onError",K,be.setState),Ye("connectionRadius",se,be.setState),Ye("isValidConnection",he,be.setState),Ye("nodeDragThreshold",pe,be.setState),wi(e,re),wi(t,ve),wi(b,$e),wi(_,Me),wi(F,_e),wi(k,ae),null},Ab={display:"none"},hP={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},jC="react-flow__node-desc",CC="react-flow__edge-desc",pP="react-flow__aria-live",mP=e=>e.ariaLiveMessage;function gP({rfId:e}){const t=st(mP);return de.createElement("div",{id:`${pP}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:hP},t)}function vP({rfId:e,disableKeyboardA11y:t}){return de.createElement(de.Fragment,null,de.createElement("div",{id:`${jC}-${e}`,style:Ab},"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."," "),de.createElement("div",{id:`${CC}-${e}`,style:Ab},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!t&&de.createElement(gP,{rfId:e}))}var al=(e=null,t={actInsideInputWithModifier:!0})=>{const[n,s]=S.useState(!1),i=S.useRef(!1),a=S.useRef(new Set([])),[l,u]=S.useMemo(()=>{if(e!==null){const p=(Array.isArray(e)?e:[e]).filter(g=>typeof g=="string").map(g=>g.split("+")),f=p.reduce((g,y)=>g.concat(...y),[]);return[p,f]}return[[],[]]},[e]);return S.useEffect(()=>{const h=typeof document<"u"?document:null,p=(t==null?void 0:t.target)||h;if(e!==null){const f=w=>{if(i.current=w.ctrlKey||w.metaKey||w.shiftKey,(!i.current||i.current&&!t.actInsideInputWithModifier)&&Cy(w))return!1;const b=Ib(w.code,u);a.current.add(w[b]),Mb(l,a.current,!1)&&(w.preventDefault(),s(!0))},g=w=>{if((!i.current||i.current&&!t.actInsideInputWithModifier)&&Cy(w))return!1;const b=Ib(w.code,u);Mb(l,a.current,!0)?(s(!1),a.current.clear()):a.current.delete(w[b]),w.key==="Meta"&&a.current.clear(),i.current=!1},y=()=>{a.current.clear(),s(!1)};return p==null||p.addEventListener("keydown",f),p==null||p.addEventListener("keyup",g),window.addEventListener("blur",y),()=>{p==null||p.removeEventListener("keydown",f),p==null||p.removeEventListener("keyup",g),window.removeEventListener("blur",y)}}},[e,s]),n};function Mb(e,t,n){return e.filter(s=>n||s.length===t.size).some(s=>s.every(i=>t.has(i)))}function Ib(e,t){return t.includes(e)?"code":"key"}function TC(e,t,n,s){var u,h;const i=e.parentNode||e.parentId;if(!i)return n;const a=t.get(i),l=xo(a,s);return TC(a,t,{x:(n.x??0)+l.x,y:(n.y??0)+l.y,z:(((u=a[Nt])==null?void 0:u.z)??0)>(n.z??0)?((h=a[Nt])==null?void 0:h.z)??0:n.z??0},s)}function RC(e,t,n){e.forEach(s=>{var a;const i=s.parentNode||s.parentId;if(i&&!e.has(i))throw new Error(`Parent node ${i} not found`);if(i||n!=null&&n[s.id]){const{x:l,y:u,z:h}=TC(s,e,{...s.position,z:((a=s[Nt])==null?void 0:a.z)??0},t);s.positionAbsolute={x:l,y:u},s[Nt].z=h,n!=null&&n[s.id]&&(s[Nt].isParent=!0)}})}function Uf(e,t,n,s){const i=new Map,a={},l=s?1e3:0;return e.forEach(u=>{var w;const h=(qn(u.zIndex)?u.zIndex:0)+(u.selected?l:0),p=t.get(u.id),f={...u,positionAbsolute:{x:u.position.x,y:u.position.y}},g=u.parentNode||u.parentId;g&&(a[g]=!0);const y=(p==null?void 0:p.type)&&(p==null?void 0:p.type)!==u.type;Object.defineProperty(f,Nt,{enumerable:!1,value:{handleBounds:y||(w=p==null?void 0:p[Nt])==null?void 0:w.handleBounds,z:h}}),i.set(u.id,f)}),RC(i,n,a),i}function AC(e,t={}){const{getNodes:n,width:s,height:i,minZoom:a,maxZoom:l,d3Zoom:u,d3Selection:h,fitViewOnInitDone:p,fitViewOnInit:f,nodeOrigin:g}=e(),y=t.initial&&!p&&f;if(u&&h&&(y||!t.initial)){const N=n().filter(_=>{var E;const k=t.includeHiddenNodes?_.width&&_.height:!_.hidden;return(E=t.nodes)!=null&&E.length?k&&t.nodes.some(j=>j.id===_.id):k}),b=N.every(_=>_.width&&_.height);if(N.length>0&&b){const _=Iu(N,g),{x:k,y:E,zoom:j}=gC(_,s,i,t.minZoom??a,t.maxZoom??l,t.padding??.1),C=Kr.translate(k,E).scale(j);return typeof t.duration=="number"&&t.duration>0?u.transform(po(h,t.duration),C):u.transform(h,C),!0}}return!1}function yP(e,t){return e.forEach(n=>{const s=t.get(n.id);s&&t.set(s.id,{...s,[Nt]:s[Nt],selected:n.selected})}),new Map(t)}function wP(e,t){return t.map(n=>{const s=e.find(i=>i.id===n.id);return s&&(n.selected=s.selected),n})}function Gc({changedNodes:e,changedEdges:t,get:n,set:s}){const{nodeInternals:i,edges:a,onNodesChange:l,onEdgesChange:u,hasDefaultNodes:h,hasDefaultEdges:p}=n();e!=null&&e.length&&(h&&s({nodeInternals:yP(e,i)}),l==null||l(e)),t!=null&&t.length&&(p&&s({edges:wP(t,a)}),u==null||u(t))}const xi=()=>{},xP={zoomIn:xi,zoomOut:xi,zoomTo:xi,getZoom:()=>1,setViewport:xi,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:xi,fitBounds:xi,project:e=>e,screenToFlowPosition:e=>e,flowToScreenPosition:e=>e,viewportInitialized:!1},bP=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),_P=()=>{const e=Rt(),{d3Zoom:t,d3Selection:n}=st(bP,$t);return S.useMemo(()=>n&&t?{zoomIn:i=>t.scaleBy(po(n,i==null?void 0:i.duration),1.2),zoomOut:i=>t.scaleBy(po(n,i==null?void 0:i.duration),1/1.2),zoomTo:(i,a)=>t.scaleTo(po(n,a==null?void 0:a.duration),i),getZoom:()=>e.getState().transform[2],setViewport:(i,a)=>{const[l,u,h]=e.getState().transform,p=Kr.translate(i.x??l,i.y??u).scale(i.zoom??h);t.transform(po(n,a==null?void 0:a.duration),p)},getViewport:()=>{const[i,a,l]=e.getState().transform;return{x:i,y:a,zoom:l}},fitView:i=>AC(e.getState,i),setCenter:(i,a,l)=>{const{width:u,height:h,maxZoom:p}=e.getState(),f=typeof(l==null?void 0:l.zoom)<"u"?l.zoom:p,g=u/2-i*f,y=h/2-a*f,w=Kr.translate(g,y).scale(f);t.transform(po(n,l==null?void 0:l.duration),w)},fitBounds:(i,a)=>{const{width:l,height:u,minZoom:h,maxZoom:p}=e.getState(),{x:f,y:g,zoom:y}=gC(i,l,u,h,p,(a==null?void 0:a.padding)??.1),w=Kr.translate(f,g).scale(y);t.transform(po(n,a==null?void 0:a.duration),w)},project:i=>{const{transform:a,snapToGrid:l,snapGrid:u}=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"),Ay(i,a,l,u)},screenToFlowPosition:i=>{const{transform:a,snapToGrid:l,snapGrid:u,domNode:h}=e.getState();if(!h)return i;const{x:p,y:f}=h.getBoundingClientRect(),g={x:i.x-p,y:i.y-f};return Ay(g,a,l,u)},flowToScreenPosition:i=>{const{transform:a,domNode:l}=e.getState();if(!l)return i;const{x:u,y:h}=l.getBoundingClientRect(),p=hC(i,a);return{x:p.x+u,y:p.y+h}},viewportInitialized:!0}:xP,[t,n])};function gl(){const e=_P(),t=Rt(),n=S.useCallback(()=>t.getState().getNodes().map(b=>({...b})),[]),s=S.useCallback(b=>t.getState().nodeInternals.get(b),[]),i=S.useCallback(()=>{const{edges:b=[]}=t.getState();return b.map(_=>({..._}))},[]),a=S.useCallback(b=>{const{edges:_=[]}=t.getState();return _.find(k=>k.id===b)},[]),l=S.useCallback(b=>{const{getNodes:_,setNodes:k,hasDefaultNodes:E,onNodesChange:j}=t.getState(),C=_(),I=typeof b=="function"?b(C):b;if(E)k(I);else if(j){const P=I.length===0?C.map(O=>({type:"remove",id:O.id})):I.map(O=>({item:O,type:"reset"}));j(P)}},[]),u=S.useCallback(b=>{const{edges:_=[],setEdges:k,hasDefaultEdges:E,onEdgesChange:j}=t.getState(),C=typeof b=="function"?b(_):b;if(E)k(C);else if(j){const I=C.length===0?_.map(P=>({type:"remove",id:P.id})):C.map(P=>({item:P,type:"reset"}));j(I)}},[]),h=S.useCallback(b=>{const _=Array.isArray(b)?b:[b],{getNodes:k,setNodes:E,hasDefaultNodes:j,onNodesChange:C}=t.getState();if(j){const P=[...k(),..._];E(P)}else if(C){const I=_.map(P=>({item:P,type:"add"}));C(I)}},[]),p=S.useCallback(b=>{const _=Array.isArray(b)?b:[b],{edges:k=[],setEdges:E,hasDefaultEdges:j,onEdgesChange:C}=t.getState();if(j)E([...k,..._]);else if(C){const I=_.map(P=>({item:P,type:"add"}));C(I)}},[]),f=S.useCallback(()=>{const{getNodes:b,edges:_=[],transform:k}=t.getState(),[E,j,C]=k;return{nodes:b().map(I=>({...I})),edges:_.map(I=>({...I})),viewport:{x:E,y:j,zoom:C}}},[]),g=S.useCallback(({nodes:b,edges:_})=>{const{nodeInternals:k,getNodes:E,edges:j,hasDefaultNodes:C,hasDefaultEdges:I,onNodesDelete:P,onEdgesDelete:O,onNodesChange:F,onEdgesChange:M}=t.getState(),A=(b||[]).map(Z=>Z.id),q=(_||[]).map(Z=>Z.id),W=E().reduce((Z,U)=>{const ne=U.parentNode||U.parentId,X=!A.includes(U.id)&&ne&&Z.find(J=>J.id===ne);return(typeof U.deletable=="boolean"?U.deletable:!0)&&(A.includes(U.id)||X)&&Z.push(U),Z},[]),Y=j.filter(Z=>typeof Z.deletable=="boolean"?Z.deletable:!0),T=Y.filter(Z=>q.includes(Z.id));if(W||T){const Z=mC(W,Y),U=[...T,...Z],ne=U.reduce((X,H)=>(X.includes(H.id)||X.push(H.id),X),[]);if((I||C)&&(I&&t.setState({edges:j.filter(X=>!ne.includes(X.id))}),C&&(W.forEach(X=>{k.delete(X.id)}),t.setState({nodeInternals:new Map(k)}))),ne.length>0&&(O==null||O(U),M&&M(ne.map(X=>({id:X,type:"remove"})))),W.length>0&&(P==null||P(W),F)){const X=W.map(H=>({id:H.id,type:"remove"}));F(X)}}},[]),y=S.useCallback(b=>{const _=BO(b),k=_?null:t.getState().nodeInternals.get(b.id);return!_&&!k?[null,null,_]:[_?b:Sb(k),k,_]},[]),w=S.useCallback((b,_=!0,k)=>{const[E,j,C]=y(b);return E?(k||t.getState().getNodes()).filter(I=>{if(!C&&(I.id===j.id||!I.positionAbsolute))return!1;const P=Sb(I),O=jy(P,E);return _&&O>0||O>=E.width*E.height}):[]},[]),N=S.useCallback((b,_,k=!0)=>{const[E]=y(b);if(!E)return!1;const j=jy(E,_);return k&&j>0||j>=E.width*E.height},[]);return S.useMemo(()=>({...e,getNodes:n,getNode:s,getEdges:i,getEdge:a,setNodes:l,setEdges:u,addNodes:h,addEdges:p,toObject:f,deleteElements:g,getIntersectingNodes:w,isNodeIntersecting:N}),[e,n,s,i,a,l,u,h,p,f,g,w,N])}const kP={actInsideInputWithModifier:!1};var SP=({deleteKeyCode:e,multiSelectionKeyCode:t})=>{const n=Rt(),{deleteElements:s}=gl(),i=al(e,kP),a=al(t);S.useEffect(()=>{if(i){const{edges:l,getNodes:u}=n.getState(),h=u().filter(f=>f.selected),p=l.filter(f=>f.selected);s({nodes:h,edges:p}),n.setState({nodesSelectionActive:!1})}},[i]),S.useEffect(()=>{n.setState({multiSelectionActive:a})},[a])};function NP(e){const t=Rt();S.useEffect(()=>{let n;const s=()=>{var a,l;if(!e.current)return;const i=aw(e.current);(i.height===0||i.width===0)&&((l=(a=t.getState()).onError)==null||l.call(a,"004",Qr.error004())),t.setState({width:i.width||500,height:i.height||500})};return s(),window.addEventListener("resize",s),e.current&&(n=new ResizeObserver(()=>s()),n.observe(e.current)),()=>{window.removeEventListener("resize",s),n&&e.current&&n.unobserve(e.current)}},[])}const mw={position:"absolute",width:"100%",height:"100%",top:0,left:0},EP=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,Vc=e=>({x:e.x,y:e.y,zoom:e.k}),bi=(e,t)=>e.target.closest(`.${t}`),Ob=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Pb=e=>{const t=e.ctrlKey&&gu()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t},jP=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),CP=({onMove:e,onMoveStart:t,onMoveEnd:n,onPaneContextMenu:s,zoomOnScroll:i=!0,zoomOnPinch:a=!0,panOnScroll:l=!1,panOnScrollSpeed:u=.5,panOnScrollMode:h=yo.Free,zoomOnDoubleClick:p=!0,elementsSelectable:f,panOnDrag:g=!0,defaultViewport:y,translateExtent:w,minZoom:N,maxZoom:b,zoomActivationKeyCode:_,preventScrolling:k=!0,children:E,noWheelClassName:j,noPanClassName:C})=>{const I=S.useRef(),P=Rt(),O=S.useRef(!1),F=S.useRef(!1),M=S.useRef(null),A=S.useRef({x:0,y:0,zoom:0}),{d3Zoom:q,d3Selection:W,d3ZoomHandler:Y,userSelectionActive:T}=st(jP,$t),Z=al(_),U=S.useRef(0),ne=S.useRef(!1),X=S.useRef();return NP(M),S.useEffect(()=>{if(M.current){const H=M.current.getBoundingClientRect(),J=tC().scaleExtent([N,b]).translateExtent(w),$=Ln(M.current).call(J),G=Kr.translate(y.x,y.y).scale(qi(y.zoom,N,b)),Q=[[0,0],[H.width,H.height]],D=J.constrain()(G,Q,w);J.transform($,D),J.wheelDelta(Pb),P.setState({d3Zoom:J,d3Selection:$,d3ZoomHandler:$.on("wheel.zoom"),transform:[D.x,D.y,D.k],domNode:M.current.closest(".react-flow")})}},[]),S.useEffect(()=>{W&&q&&(l&&!Z&&!T?W.on("wheel.zoom",H=>{if(bi(H,j))return!1;H.preventDefault(),H.stopImmediatePropagation();const J=W.property("__zoom").k||1;if(H.ctrlKey&&a){const he=sr(H),pe=Pb(H),re=J*Math.pow(2,pe);q.scaleTo(W,re,he,H);return}const $=H.deltaMode===1?20:1;let G=h===yo.Vertical?0:H.deltaX*$,Q=h===yo.Horizontal?0:H.deltaY*$;!gu()&&H.shiftKey&&h!==yo.Vertical&&(G=H.deltaY*$,Q=0),q.translateBy(W,-(G/J)*u,-(Q/J)*u,{internal:!0});const D=Vc(W.property("__zoom")),{onViewportChangeStart:L,onViewportChange:K,onViewportChangeEnd:se}=P.getState();clearTimeout(X.current),ne.current||(ne.current=!0,t==null||t(H,D),L==null||L(D)),ne.current&&(e==null||e(H,D),K==null||K(D),X.current=setTimeout(()=>{n==null||n(H,D),se==null||se(D),ne.current=!1},150))},{passive:!1}):typeof Y<"u"&&W.on("wheel.zoom",function(H,J){if(!k&&H.type==="wheel"&&!H.ctrlKey||bi(H,j))return null;H.preventDefault(),Y.call(this,H,J)},{passive:!1}))},[T,l,h,W,q,Y,Z,a,k,j,t,e,n]),S.useEffect(()=>{q&&q.on("start",H=>{var G,Q;if(!H.sourceEvent||H.sourceEvent.internal)return null;U.current=(G=H.sourceEvent)==null?void 0:G.button;const{onViewportChangeStart:J}=P.getState(),$=Vc(H.transform);O.current=!0,A.current=$,((Q=H.sourceEvent)==null?void 0:Q.type)==="mousedown"&&P.setState({paneDragging:!0}),J==null||J($),t==null||t(H.sourceEvent,$)})},[q,t]),S.useEffect(()=>{q&&(T&&!O.current?q.on("zoom",null):T||q.on("zoom",H=>{var $;const{onViewportChange:J}=P.getState();if(P.setState({transform:[H.transform.x,H.transform.y,H.transform.k]}),F.current=!!(s&&Ob(g,U.current??0)),(e||J)&&!(($=H.sourceEvent)!=null&&$.internal)){const G=Vc(H.transform);J==null||J(G),e==null||e(H.sourceEvent,G)}}))},[T,q,e,g,s]),S.useEffect(()=>{q&&q.on("end",H=>{if(!H.sourceEvent||H.sourceEvent.internal)return null;const{onViewportChangeEnd:J}=P.getState();if(O.current=!1,P.setState({paneDragging:!1}),s&&Ob(g,U.current??0)&&!F.current&&s(H.sourceEvent),F.current=!1,(n||J)&&EP(A.current,H.transform)){const $=Vc(H.transform);A.current=$,clearTimeout(I.current),I.current=setTimeout(()=>{J==null||J($),n==null||n(H.sourceEvent,$)},l?150:0)}})},[q,l,g,n,s]),S.useEffect(()=>{q&&q.filter(H=>{const J=Z||i,$=a&&H.ctrlKey;if((g===!0||Array.isArray(g)&&g.includes(1))&&H.button===1&&H.type==="mousedown"&&(bi(H,"react-flow__node")||bi(H,"react-flow__edge")))return!0;if(!g&&!J&&!l&&!p&&!a||T||!p&&H.type==="dblclick"||bi(H,j)&&H.type==="wheel"||bi(H,C)&&(H.type!=="wheel"||l&&H.type==="wheel"&&!Z)||!a&&H.ctrlKey&&H.type==="wheel"||!J&&!l&&!$&&H.type==="wheel"||!g&&(H.type==="mousedown"||H.type==="touchstart")||Array.isArray(g)&&!g.includes(H.button)&&H.type==="mousedown")return!1;const G=Array.isArray(g)&&g.includes(H.button)||!H.button||H.button<=1;return(!H.ctrlKey||H.type==="wheel")&&G})},[T,q,i,a,l,p,g,f,Z]),de.createElement("div",{className:"react-flow__renderer",ref:M,style:mw},E)},TP=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function RP(){const{userSelectionActive:e,userSelectionRect:t}=st(TP,$t);return e&&t?de.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 $b(e,t){const n=t.parentNode||t.parentId,s=e.find(i=>i.id===n);if(s){const i=t.position.x+t.width-s.width,a=t.position.y+t.height-s.height;if(i>0||a>0||t.position.x<0||t.position.y<0){if(s.style={...s.style},s.style.width=s.style.width??s.width,s.style.height=s.style.height??s.height,i>0&&(s.style.width+=i),a>0&&(s.style.height+=a),t.position.x<0){const l=Math.abs(t.position.x);s.position.x=s.position.x-l,s.style.width+=l,t.position.x=0}if(t.position.y<0){const l=Math.abs(t.position.y);s.position.y=s.position.y-l,s.style.height+=l,t.position.y=0}s.width=s.style.width,s.height=s.style.height}}}function AP(e,t){if(e.some(s=>s.type==="reset"))return e.filter(s=>s.type==="reset").map(s=>s.item);const n=e.filter(s=>s.type==="add").map(s=>s.item);return t.reduce((s,i)=>{const a=e.filter(u=>u.id===i.id);if(a.length===0)return s.push(i),s;const l={...i};for(const u of a)if(u)switch(u.type){case"select":{l.selected=u.selected;break}case"position":{typeof u.position<"u"&&(l.position=u.position),typeof u.positionAbsolute<"u"&&(l.positionAbsolute=u.positionAbsolute),typeof u.dragging<"u"&&(l.dragging=u.dragging),l.expandParent&&$b(s,l);break}case"dimensions":{typeof u.dimensions<"u"&&(l.width=u.dimensions.width,l.height=u.dimensions.height),typeof u.updateStyle<"u"&&(l.style={...l.style||{},...u.dimensions}),typeof u.resizing=="boolean"&&(l.resizing=u.resizing),l.expandParent&&$b(s,l);break}case"remove":return s}return s.push(l),s},n)}function MP(e,t){return AP(e,t)}const Ts=(e,t)=>({id:e,type:"select",selected:t});function ji(e,t){return e.reduce((n,s)=>{const i=t.includes(s.id);return!s.selected&&i?(s.selected=!0,n.push(Ts(s.id,!0))):s.selected&&!i&&(s.selected=!1,n.push(Ts(s.id,!1))),n},[])}const Wf=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},IP=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),MC=S.memo(({isSelecting:e,selectionMode:t=il.Full,panOnDrag:n,onSelectionStart:s,onSelectionEnd:i,onPaneClick:a,onPaneContextMenu:l,onPaneScroll:u,onPaneMouseEnter:h,onPaneMouseMove:p,onPaneMouseLeave:f,children:g})=>{const y=S.useRef(null),w=Rt(),N=S.useRef(0),b=S.useRef(0),_=S.useRef(),{userSelectionActive:k,elementsSelectable:E,dragging:j}=st(IP,$t),C=()=>{w.setState({userSelectionActive:!1,userSelectionRect:null}),N.current=0,b.current=0},I=Y=>{a==null||a(Y),w.getState().resetSelectedElements(),w.setState({nodesSelectionActive:!1})},P=Y=>{if(Array.isArray(n)&&(n!=null&&n.includes(2))){Y.preventDefault();return}l==null||l(Y)},O=u?Y=>u(Y):void 0,F=Y=>{const{resetSelectedElements:T,domNode:Z}=w.getState();if(_.current=Z==null?void 0:Z.getBoundingClientRect(),!E||!e||Y.button!==0||Y.target!==y.current||!_.current)return;const{x:U,y:ne}=As(Y,_.current);T(),w.setState({userSelectionRect:{width:0,height:0,startX:U,startY:ne,x:U,y:ne}}),s==null||s(Y)},M=Y=>{const{userSelectionRect:T,nodeInternals:Z,edges:U,transform:ne,onNodesChange:X,onEdgesChange:H,nodeOrigin:J,getNodes:$}=w.getState();if(!e||!_.current||!T)return;w.setState({userSelectionActive:!0,nodesSelectionActive:!1});const G=As(Y,_.current),Q=T.startX??0,D=T.startY??0,L={...T,x:G.x<Q?G.x:Q,y:G.y<D?G.y:D,width:Math.abs(G.x-Q),height:Math.abs(G.y-D)},K=$(),se=pC(Z,L,ne,t===il.Partial,!0,J),he=mC(se,U).map(re=>re.id),pe=se.map(re=>re.id);if(N.current!==pe.length){N.current=pe.length;const re=ji(K,pe);re.length&&(X==null||X(re))}if(b.current!==he.length){b.current=he.length;const re=ji(U,he);re.length&&(H==null||H(re))}w.setState({userSelectionRect:L})},A=Y=>{if(Y.button!==0)return;const{userSelectionRect:T}=w.getState();!k&&T&&Y.target===y.current&&(I==null||I(Y)),w.setState({nodesSelectionActive:N.current>0}),C(),i==null||i(Y)},q=Y=>{k&&(w.setState({nodesSelectionActive:N.current>0}),i==null||i(Y)),C()},W=E&&(e||k);return de.createElement("div",{className:Ht(["react-flow__pane",{dragging:j,selection:e}]),onClick:W?void 0:Wf(I,y),onContextMenu:Wf(P,y),onWheel:Wf(O,y),onMouseEnter:W?void 0:h,onMouseDown:W?F:void 0,onMouseMove:W?M:p,onMouseUp:W?A:void 0,onMouseLeave:W?q:f,ref:y,style:mw},g,de.createElement(RP,null))});MC.displayName="Pane";function IC(e,t){const n=e.parentNode||e.parentId;if(!n)return!1;const s=t.get(n);return s?s.selected?!0:IC(s,t):!1}function Lb(e,t,n){let s=e;do{if(s!=null&&s.matches(t))return!0;if(s===n.current)return!1;s=s.parentElement}while(s);return!1}function OP(e,t,n,s){return Array.from(e.values()).filter(i=>(i.selected||i.id===s)&&(!i.parentNode||i.parentId||!IC(i,e))&&(i.draggable||t&&typeof i.draggable>"u")).map(i=>{var a,l;return{id:i.id,position:i.position||{x:0,y:0},positionAbsolute:i.positionAbsolute||{x:0,y:0},distance:{x:n.x-(((a=i.positionAbsolute)==null?void 0:a.x)??0),y:n.y-(((l=i.positionAbsolute)==null?void 0:l.y)??0)},delta:{x:0,y:0},extent:i.extent,parentNode:i.parentNode||i.parentId,parentId:i.parentNode||i.parentId,width:i.width,height:i.height,expandParent:i.expandParent}})}function PP(e,t){return!t||t==="parent"?t:[t[0],[t[1][0]-(e.width||0),t[1][1]-(e.height||0)]]}function OC(e,t,n,s,i=[0,0],a){const l=PP(e,e.extent||s);let u=l;const h=e.parentNode||e.parentId;if(e.extent==="parent"&&!e.expandParent)if(h&&e.width&&e.height){const g=n.get(h),{x:y,y:w}=xo(g,i).positionAbsolute;u=g&&qn(y)&&qn(w)&&qn(g.width)&&qn(g.height)?[[y+e.width*i[0],w+e.height*i[1]],[y+g.width-e.width+e.width*i[0],w+g.height-e.height+e.height*i[1]]]:u}else a==null||a("005",Qr.error005()),u=l;else if(e.extent&&h&&e.extent!=="parent"){const g=n.get(h),{x:y,y:w}=xo(g,i).positionAbsolute;u=[[e.extent[0][0]+y,e.extent[0][1]+w],[e.extent[1][0]+y,e.extent[1][1]+w]]}let p={x:0,y:0};if(h){const g=n.get(h);p=xo(g,i).positionAbsolute}const f=u&&u!=="parent"?lw(t,u):t;return{position:{x:f.x-p.x,y:f.y-p.y},positionAbsolute:f}}function Hf({nodeId:e,dragItems:t,nodeInternals:n}){const s=t.map(i=>({...n.get(i.id),position:i.position,positionAbsolute:i.positionAbsolute}));return[e?s.find(i=>i.id===e):s[0],s]}const qb=(e,t,n,s)=>{const i=t.querySelectorAll(e);if(!i||!i.length)return null;const a=Array.from(i),l=t.getBoundingClientRect(),u={x:l.width*s[0],y:l.height*s[1]};return a.map(h=>{const p=h.getBoundingClientRect();return{id:h.getAttribute("data-handleid"),position:h.getAttribute("data-handlepos"),x:(p.left-l.left-u.x)/n,y:(p.top-l.top-u.y)/n,...aw(h)}})};function za(e,t,n){return n===void 0?n:s=>{const i=t().nodeInternals.get(e);i&&n(s,{...i})}}function Iy({id:e,store:t,unselect:n=!1,nodeRef:s}){const{addSelectedNodes:i,unselectNodesAndEdges:a,multiSelectionActive:l,nodeInternals:u,onError:h}=t.getState(),p=u.get(e);if(!p){h==null||h("012",Qr.error012(e));return}t.setState({nodesSelectionActive:!1}),p.selected?(n||p.selected&&l)&&(a({nodes:[p],edges:[]}),requestAnimationFrame(()=>{var f;return(f=s==null?void 0:s.current)==null?void 0:f.blur()})):i([e])}function $P(){const e=Rt();return S.useCallback(({sourceEvent:n})=>{const{transform:s,snapGrid:i,snapToGrid:a}=e.getState(),l=n.touches?n.touches[0].clientX:n.clientX,u=n.touches?n.touches[0].clientY:n.clientY,h={x:(l-s[0])/s[2],y:(u-s[1])/s[2]};return{xSnapped:a?i[0]*Math.round(h.x/i[0]):h.x,ySnapped:a?i[1]*Math.round(h.y/i[1]):h.y,...h}},[])}function Gf(e){return(t,n,s)=>e==null?void 0:e(t,s)}function PC({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:s,nodeId:i,isSelectable:a,selectNodesOnDrag:l}){const u=Rt(),[h,p]=S.useState(!1),f=S.useRef([]),g=S.useRef({x:null,y:null}),y=S.useRef(0),w=S.useRef(null),N=S.useRef({x:0,y:0}),b=S.useRef(null),_=S.useRef(!1),k=S.useRef(!1),E=S.useRef(!1),j=$P();return S.useEffect(()=>{if(e!=null&&e.current){const C=Ln(e.current),I=({x:F,y:M})=>{const{nodeInternals:A,onNodeDrag:q,onSelectionDrag:W,updateNodePositions:Y,nodeExtent:T,snapGrid:Z,snapToGrid:U,nodeOrigin:ne,onError:X}=u.getState();g.current={x:F,y:M};let H=!1,J={x:0,y:0,x2:0,y2:0};if(f.current.length>1&&T){const G=Iu(f.current,ne);J=ol(G)}if(f.current=f.current.map(G=>{const Q={x:F-G.distance.x,y:M-G.distance.y};U&&(Q.x=Z[0]*Math.round(Q.x/Z[0]),Q.y=Z[1]*Math.round(Q.y/Z[1]));const D=[[T[0][0],T[0][1]],[T[1][0],T[1][1]]];f.current.length>1&&T&&!G.extent&&(D[0][0]=G.positionAbsolute.x-J.x+T[0][0],D[1][0]=G.positionAbsolute.x+(G.width??0)-J.x2+T[1][0],D[0][1]=G.positionAbsolute.y-J.y+T[0][1],D[1][1]=G.positionAbsolute.y+(G.height??0)-J.y2+T[1][1]);const L=OC(G,Q,A,D,ne,X);return H=H||G.position.x!==L.position.x||G.position.y!==L.position.y,G.position=L.position,G.positionAbsolute=L.positionAbsolute,G}),!H)return;Y(f.current,!0,!0),p(!0);const $=i?q:Gf(W);if($&&b.current){const[G,Q]=Hf({nodeId:i,dragItems:f.current,nodeInternals:A});$(b.current,G,Q)}},P=()=>{if(!w.current)return;const[F,M]=rC(N.current,w.current);if(F!==0||M!==0){const{transform:A,panBy:q}=u.getState();g.current.x=(g.current.x??0)-F/A[2],g.current.y=(g.current.y??0)-M/A[2],q({x:F,y:M})&&I(g.current)}y.current=requestAnimationFrame(P)},O=F=>{var ne;const{nodeInternals:M,multiSelectionActive:A,nodesDraggable:q,unselectNodesAndEdges:W,onNodeDragStart:Y,onSelectionDragStart:T}=u.getState();k.current=!0;const Z=i?Y:Gf(T);(!l||!a)&&!A&&i&&((ne=M.get(i))!=null&&ne.selected||W()),i&&a&&l&&Iy({id:i,store:u,nodeRef:e});const U=j(F);if(g.current=U,f.current=OP(M,q,U,i),Z&&f.current){const[X,H]=Hf({nodeId:i,dragItems:f.current,nodeInternals:M});Z(F.sourceEvent,X,H)}};if(t)C.on(".drag",null);else{const F=GM().on("start",M=>{const{domNode:A,nodeDragThreshold:q}=u.getState();q===0&&O(M),E.current=!1;const W=j(M);g.current=W,w.current=(A==null?void 0:A.getBoundingClientRect())||null,N.current=As(M.sourceEvent,w.current)}).on("drag",M=>{var Y,T;const A=j(M),{autoPanOnNodeDrag:q,nodeDragThreshold:W}=u.getState();if(M.sourceEvent.type==="touchmove"&&M.sourceEvent.touches.length>1&&(E.current=!0),!E.current){if(!_.current&&k.current&&q&&(_.current=!0,P()),!k.current){const Z=A.xSnapped-(((Y=g==null?void 0:g.current)==null?void 0:Y.x)??0),U=A.ySnapped-(((T=g==null?void 0:g.current)==null?void 0:T.y)??0);Math.sqrt(Z*Z+U*U)>W&&O(M)}(g.current.x!==A.xSnapped||g.current.y!==A.ySnapped)&&f.current&&k.current&&(b.current=M.sourceEvent,N.current=As(M.sourceEvent,w.current),I(A))}}).on("end",M=>{if(!(!k.current||E.current)&&(p(!1),_.current=!1,k.current=!1,cancelAnimationFrame(y.current),f.current)){const{updateNodePositions:A,nodeInternals:q,onNodeDragStop:W,onSelectionDragStop:Y}=u.getState(),T=i?W:Gf(Y);if(A(f.current,!1,!1),T){const[Z,U]=Hf({nodeId:i,dragItems:f.current,nodeInternals:q});T(M.sourceEvent,Z,U)}}}).filter(M=>{const A=M.target;return!M.button&&(!n||!Lb(A,`.${n}`,e))&&(!s||Lb(A,s,e))});return C.call(F),()=>{C.on(".drag",null)}}}},[e,t,n,s,a,u,i,l,j]),h}function $C(){const e=Rt();return S.useCallback(n=>{const{nodeInternals:s,nodeExtent:i,updateNodePositions:a,getNodes:l,snapToGrid:u,snapGrid:h,onError:p,nodesDraggable:f}=e.getState(),g=l().filter(E=>E.selected&&(E.draggable||f&&typeof E.draggable>"u")),y=u?h[0]:5,w=u?h[1]:5,N=n.isShiftPressed?4:1,b=n.x*y*N,_=n.y*w*N,k=g.map(E=>{if(E.positionAbsolute){const j={x:E.positionAbsolute.x+b,y:E.positionAbsolute.y+_};u&&(j.x=h[0]*Math.round(j.x/h[0]),j.y=h[1]*Math.round(j.y/h[1]));const{positionAbsolute:C,position:I}=OC(E,j,s,i,void 0,p);E.position=I,E.positionAbsolute=C}return E});a(k,!0,!1)},[])}const Mi={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var Ba=e=>{const t=({id:n,type:s,data:i,xPos:a,yPos:l,xPosOrigin:u,yPosOrigin:h,selected:p,onClick:f,onMouseEnter:g,onMouseMove:y,onMouseLeave:w,onContextMenu:N,onDoubleClick:b,style:_,className:k,isDraggable:E,isSelectable:j,isConnectable:C,isFocusable:I,selectNodesOnDrag:P,sourcePosition:O,targetPosition:F,hidden:M,resizeObserver:A,dragHandle:q,zIndex:W,isParent:Y,noDragClassName:T,noPanClassName:Z,initialized:U,disableKeyboardA11y:ne,ariaLabel:X,rfId:H,hasHandleBounds:J})=>{const $=Rt(),G=S.useRef(null),Q=S.useRef(null),D=S.useRef(O),L=S.useRef(F),K=S.useRef(s),se=j||E||f||g||y||w,he=$C(),pe=za(n,$.getState,g),re=za(n,$.getState,y),ve=za(n,$.getState,w),Te=za(n,$.getState,N),$e=za(n,$.getState,b),Me=we=>{const{nodeDragThreshold:be}=$.getState();if(j&&(!P||!E||be>0)&&Iy({id:n,store:$,nodeRef:G}),f){const Ue=$.getState().nodeInternals.get(n);Ue&&f(we,{...Ue})}},_e=we=>{if(!Cy(we)&&!ne)if(aC.includes(we.key)&&j){const be=we.key==="Escape";Iy({id:n,store:$,unselect:be,nodeRef:G})}else E&&p&&Object.prototype.hasOwnProperty.call(Mi,we.key)&&($.setState({ariaLiveMessage:`Moved selected node ${we.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~a}, y: ${~~l}`}),he({x:Mi[we.key].x,y:Mi[we.key].y,isShiftPressed:we.shiftKey}))};S.useEffect(()=>()=>{Q.current&&(A==null||A.unobserve(Q.current),Q.current=null)},[]),S.useEffect(()=>{if(G.current&&!M){const we=G.current;(!U||!J||Q.current!==we)&&(Q.current&&(A==null||A.unobserve(Q.current)),A==null||A.observe(we),Q.current=we)}},[M,U,J]),S.useEffect(()=>{const we=K.current!==s,be=D.current!==O,Ue=L.current!==F;G.current&&(we||be||Ue)&&(we&&(K.current=s),be&&(D.current=O),Ue&&(L.current=F),$.getState().updateNodeDimensions([{id:n,nodeElement:G.current,forceUpdate:!0}]))},[n,s,O,F]);const ae=PC({nodeRef:G,disabled:M||!E,noDragClassName:T,handleSelector:q,nodeId:n,isSelectable:j,selectNodesOnDrag:P});return M?null:de.createElement("div",{className:Ht(["react-flow__node",`react-flow__node-${s}`,{[Z]:E},k,{selected:p,selectable:j,parent:Y,dragging:ae}]),ref:G,style:{zIndex:W,transform:`translate(${u}px,${h}px)`,pointerEvents:se?"all":"none",visibility:U?"visible":"hidden",..._},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:pe,onMouseMove:re,onMouseLeave:ve,onContextMenu:Te,onClick:Me,onDoubleClick:$e,onKeyDown:I?_e:void 0,tabIndex:I?0:void 0,role:I?"button":void 0,"aria-describedby":ne?void 0:`${jC}-${H}`,"aria-label":X},de.createElement(KO,{value:n},de.createElement(e,{id:n,data:i,type:s,xPos:a,yPos:l,selected:p,isConnectable:C,sourcePosition:O,targetPosition:F,dragging:ae,dragHandle:q,zIndex:W})))};return t.displayName="NodeWrapper",S.memo(t)};const LP=e=>{const t=e.getNodes().filter(n=>n.selected);return{...Iu(t,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};function qP({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const s=Rt(),{width:i,height:a,x:l,y:u,transformString:h,userSelectionActive:p}=st(LP,$t),f=$C(),g=S.useRef(null);if(S.useEffect(()=>{var N;n||(N=g.current)==null||N.focus({preventScroll:!0})},[n]),PC({nodeRef:g}),p||!i||!a)return null;const y=e?N=>{const b=s.getState().getNodes().filter(_=>_.selected);e(N,b)}:void 0,w=N=>{Object.prototype.hasOwnProperty.call(Mi,N.key)&&f({x:Mi[N.key].x,y:Mi[N.key].y,isShiftPressed:N.shiftKey})};return de.createElement("div",{className:Ht(["react-flow__nodesselection","react-flow__container",t]),style:{transform:h}},de.createElement("div",{ref:g,className:"react-flow__nodesselection-rect",onContextMenu:y,tabIndex:n?void 0:-1,onKeyDown:n?void 0:w,style:{width:i,height:a,top:u,left:l}}))}var DP=S.memo(qP);const FP=e=>e.nodesSelectionActive,LC=({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:s,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:l,deleteKeyCode:u,onMove:h,onMoveStart:p,onMoveEnd:f,selectionKeyCode:g,selectionOnDrag:y,selectionMode:w,onSelectionStart:N,onSelectionEnd:b,multiSelectionKeyCode:_,panActivationKeyCode:k,zoomActivationKeyCode:E,elementsSelectable:j,zoomOnScroll:C,zoomOnPinch:I,panOnScroll:P,panOnScrollSpeed:O,panOnScrollMode:F,zoomOnDoubleClick:M,panOnDrag:A,defaultViewport:q,translateExtent:W,minZoom:Y,maxZoom:T,preventScrolling:Z,onSelectionContextMenu:U,noWheelClassName:ne,noPanClassName:X,disableKeyboardA11y:H})=>{const J=st(FP),$=al(g),G=al(k),Q=G||A,D=G||P,L=$||y&&Q!==!0;return SP({deleteKeyCode:u,multiSelectionKeyCode:_}),de.createElement(CP,{onMove:h,onMoveStart:p,onMoveEnd:f,onPaneContextMenu:a,elementsSelectable:j,zoomOnScroll:C,zoomOnPinch:I,panOnScroll:D,panOnScrollSpeed:O,panOnScrollMode:F,zoomOnDoubleClick:M,panOnDrag:!$&&Q,defaultViewport:q,translateExtent:W,minZoom:Y,maxZoom:T,zoomActivationKeyCode:E,preventScrolling:Z,noWheelClassName:ne,noPanClassName:X},de.createElement(MC,{onSelectionStart:N,onSelectionEnd:b,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:s,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:l,panOnDrag:Q,isSelecting:!!L,selectionMode:w},e,J&&de.createElement(DP,{onSelectionContextMenu:U,noPanClassName:X,disableKeyboardA11y:H})))};LC.displayName="FlowRenderer";var zP=S.memo(LC);function BP(e){return st(S.useCallback(n=>e?pC(n.nodeInternals,{x:0,y:0,width:n.width,height:n.height},n.transform,!0):n.getNodes(),[e]))}function UP(e){const t={input:Ba(e.input||kC),default:Ba(e.default||My),output:Ba(e.output||NC),group:Ba(e.group||pw)},n={},s=Object.keys(e).filter(i=>!["input","default","output","group"].includes(i)).reduce((i,a)=>(i[a]=Ba(e[a]||My),i),n);return{...t,...s}}const WP=({x:e,y:t,width:n,height:s,origin:i})=>!n||!s?{x:e,y:t}:i[0]<0||i[1]<0||i[0]>1||i[1]>1?{x:e,y:t}:{x:e-n*i[0],y:t-s*i[1]},HP=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),qC=e=>{const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:s,elementsSelectable:i,updateNodeDimensions:a,onError:l}=st(HP,$t),u=BP(e.onlyRenderVisibleElements),h=S.useRef(),p=S.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const f=new ResizeObserver(g=>{const y=g.map(w=>({id:w.target.getAttribute("data-id"),nodeElement:w.target,forceUpdate:!0}));a(y)});return h.current=f,f},[]);return S.useEffect(()=>()=>{var f;(f=h==null?void 0:h.current)==null||f.disconnect()},[]),de.createElement("div",{className:"react-flow__nodes",style:mw},u.map(f=>{var I,P,O;let g=f.type||"default";e.nodeTypes[g]||(l==null||l("003",Qr.error003(g)),g="default");const y=e.nodeTypes[g]||e.nodeTypes.default,w=!!(f.draggable||t&&typeof f.draggable>"u"),N=!!(f.selectable||i&&typeof f.selectable>"u"),b=!!(f.connectable||n&&typeof f.connectable>"u"),_=!!(f.focusable||s&&typeof f.focusable>"u"),k=e.nodeExtent?lw(f.positionAbsolute,e.nodeExtent):f.positionAbsolute,E=(k==null?void 0:k.x)??0,j=(k==null?void 0:k.y)??0,C=WP({x:E,y:j,width:f.width??0,height:f.height??0,origin:e.nodeOrigin});return de.createElement(y,{key:f.id,id:f.id,className:f.className,style:f.style,type:g,data:f.data,sourcePosition:f.sourcePosition||Pe.Bottom,targetPosition:f.targetPosition||Pe.Top,hidden:f.hidden,xPos:E,yPos:j,xPosOrigin:C.x,yPosOrigin:C.y,selectNodesOnDrag:e.selectNodesOnDrag,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,selected:!!f.selected,isDraggable:w,isSelectable:N,isConnectable:b,isFocusable:_,resizeObserver:p,dragHandle:f.dragHandle,zIndex:((I=f[Nt])==null?void 0:I.z)??0,isParent:!!((P=f[Nt])!=null&&P.isParent),noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!f.width&&!!f.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:f.ariaLabel,hasHandleBounds:!!((O=f[Nt])!=null&&O.handleBounds)})}))};qC.displayName="NodeRenderer";var GP=S.memo(qC);const VP=(e,t,n)=>n===Pe.Left?e-t:n===Pe.Right?e+t:e,YP=(e,t,n)=>n===Pe.Top?e-t:n===Pe.Bottom?e+t:e,Db="react-flow__edgeupdater",Fb=({position:e,centerX:t,centerY:n,radius:s=10,onMouseDown:i,onMouseEnter:a,onMouseOut:l,type:u})=>de.createElement("circle",{onMouseDown:i,onMouseEnter:a,onMouseOut:l,className:Ht([Db,`${Db}-${u}`]),cx:VP(t,s,e),cy:YP(n,s,e),r:s,stroke:"transparent",fill:"transparent"}),KP=()=>!0;var _i=e=>{const t=({id:n,className:s,type:i,data:a,onClick:l,onEdgeDoubleClick:u,selected:h,animated:p,label:f,labelStyle:g,labelShowBg:y,labelBgStyle:w,labelBgPadding:N,labelBgBorderRadius:b,style:_,source:k,target:E,sourceX:j,sourceY:C,targetX:I,targetY:P,sourcePosition:O,targetPosition:F,elementsSelectable:M,hidden:A,sourceHandleId:q,targetHandleId:W,onContextMenu:Y,onMouseEnter:T,onMouseMove:Z,onMouseLeave:U,reconnectRadius:ne,onReconnect:X,onReconnectStart:H,onReconnectEnd:J,markerEnd:$,markerStart:G,rfId:Q,ariaLabel:D,isFocusable:L,isReconnectable:K,pathOptions:se,interactionWidth:he,disableKeyboardA11y:pe})=>{const re=S.useRef(null),[ve,Te]=S.useState(!1),[$e,Me]=S.useState(!1),_e=Rt(),ae=S.useMemo(()=>`url('#${Ry(G,Q)}')`,[G,Q]),we=S.useMemo(()=>`url('#${Ry($,Q)}')`,[$,Q]);if(A)return null;const be=Le=>{var Re;const{edges:Fe,addSelectedEdges:Ee,unselectNodesAndEdges:Ge,multiSelectionActive:Et}=_e.getState(),tt=Fe.find(wt=>wt.id===n);tt&&(M&&(_e.setState({nodesSelectionActive:!1}),tt.selected&&Et?(Ge({nodes:[],edges:[tt]}),(Re=re.current)==null||Re.blur()):Ee([n])),l&&l(Le,tt))},Ue=Fa(n,_e.getState,u),Ke=Fa(n,_e.getState,Y),ut=Fa(n,_e.getState,T),ot=Fa(n,_e.getState,Z),He=Fa(n,_e.getState,U),nt=(Le,Fe)=>{if(Le.button!==0)return;const{edges:Ee,isValidConnection:Ge}=_e.getState(),Et=Fe?E:k,tt=(Fe?W:q)||null,Re=Fe?"target":"source",wt=Ge||KP,lt=Fe,kt=Ee.find(En=>En.id===n);Me(!0),H==null||H(Le,kt,Re);const Nn=En=>{Me(!1),J==null||J(En,kt,Re)};wC({event:Le,handleId:tt,nodeId:Et,onConnect:En=>X==null?void 0:X(kt,En),isTarget:lt,getState:_e.getState,setState:_e.setState,isValidConnection:wt,edgeUpdaterType:Re,onReconnectEnd:Nn})},Xe=Le=>nt(Le,!0),_t=Le=>nt(Le,!1),Oe=()=>Te(!0),it=()=>Te(!1),Mt=!M&&!l,le=Le=>{var Fe;if(!pe&&aC.includes(Le.key)&&M){const{unselectNodesAndEdges:Ee,addSelectedEdges:Ge,edges:Et}=_e.getState();Le.key==="Escape"?((Fe=re.current)==null||Fe.blur(),Ee({edges:[Et.find(Re=>Re.id===n)]})):Ge([n])}};return de.createElement("g",{className:Ht(["react-flow__edge",`react-flow__edge-${i}`,s,{selected:h,animated:p,inactive:Mt,updating:ve}]),onClick:be,onDoubleClick:Ue,onContextMenu:Ke,onMouseEnter:ut,onMouseMove:ot,onMouseLeave:He,onKeyDown:L?le:void 0,tabIndex:L?0:void 0,role:L?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":D===null?void 0:D||`Edge from ${k} to ${E}`,"aria-describedby":L?`${CC}-${Q}`:void 0,ref:re},!$e&&de.createElement(e,{id:n,source:k,target:E,selected:h,animated:p,label:f,labelStyle:g,labelShowBg:y,labelBgStyle:w,labelBgPadding:N,labelBgBorderRadius:b,data:a,style:_,sourceX:j,sourceY:C,targetX:I,targetY:P,sourcePosition:O,targetPosition:F,sourceHandleId:q,targetHandleId:W,markerStart:ae,markerEnd:we,pathOptions:se,interactionWidth:he}),K&&de.createElement(de.Fragment,null,(K==="source"||K===!0)&&de.createElement(Fb,{position:O,centerX:j,centerY:C,radius:ne,onMouseDown:Xe,onMouseEnter:Oe,onMouseOut:it,type:"source"}),(K==="target"||K===!0)&&de.createElement(Fb,{position:F,centerX:I,centerY:P,radius:ne,onMouseDown:_t,onMouseEnter:Oe,onMouseOut:it,type:"target"})))};return t.displayName="EdgeWrapper",S.memo(t)};function XP(e){const t={default:_i(e.default||yu),straight:_i(e.bezier||dw),step:_i(e.step||uw),smoothstep:_i(e.step||Mu),simplebezier:_i(e.simplebezier||cw)},n={},s=Object.keys(e).filter(i=>!["default","bezier"].includes(i)).reduce((i,a)=>(i[a]=_i(e[a]||yu),i),n);return{...t,...s}}function zb(e,t,n=null){const s=((n==null?void 0:n.x)||0)+t.x,i=((n==null?void 0:n.y)||0)+t.y,a=(n==null?void 0:n.width)||t.width,l=(n==null?void 0:n.height)||t.height;switch(e){case Pe.Top:return{x:s+a/2,y:i};case Pe.Right:return{x:s+a,y:i+l/2};case Pe.Bottom:return{x:s+a/2,y:i+l};case Pe.Left:return{x:s,y:i+l/2}}}function Bb(e,t){return e?e.length===1||!t?e[0]:t&&e.find(n=>n.id===t)||null:null}const QP=(e,t,n,s,i,a)=>{const l=zb(n,e,t),u=zb(a,s,i);return{sourceX:l.x,sourceY:l.y,targetX:u.x,targetY:u.y}};function ZP({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:s,targetWidth:i,targetHeight:a,width:l,height:u,transform:h}){const p={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+n,t.x+i),y2:Math.max(e.y+s,t.y+a)};p.x===p.x2&&(p.x2+=1),p.y===p.y2&&(p.y2+=1);const f=ol({x:(0-h[0])/h[2],y:(0-h[1])/h[2],width:l/h[2],height:u/h[2]}),g=Math.max(0,Math.min(f.x2,p.x2)-Math.max(f.x,p.x)),y=Math.max(0,Math.min(f.y2,p.y2)-Math.max(f.y,p.y));return Math.ceil(g*y)>0}function Ub(e){var s,i,a,l,u;const t=((s=e==null?void 0:e[Nt])==null?void 0:s.handleBounds)||null,n=t&&(e==null?void 0:e.width)&&(e==null?void 0:e.height)&&typeof((i=e==null?void 0:e.positionAbsolute)==null?void 0:i.x)<"u"&&typeof((a=e==null?void 0:e.positionAbsolute)==null?void 0:a.y)<"u";return[{x:((l=e==null?void 0:e.positionAbsolute)==null?void 0:l.x)||0,y:((u=e==null?void 0:e.positionAbsolute)==null?void 0:u.y)||0,width:(e==null?void 0:e.width)||0,height:(e==null?void 0:e.height)||0},t,!!n]}const JP=[{level:0,isMaxLevel:!0,edges:[]}];function e$(e,t,n=!1){let s=-1;const i=e.reduce((l,u)=>{var f,g;const h=qn(u.zIndex);let p=h?u.zIndex:0;if(n){const y=t.get(u.target),w=t.get(u.source),N=u.selected||(y==null?void 0:y.selected)||(w==null?void 0:w.selected),b=Math.max(((f=w==null?void 0:w[Nt])==null?void 0:f.z)||0,((g=y==null?void 0:y[Nt])==null?void 0:g.z)||0,1e3);p=(h?u.zIndex:0)+(N?b:0)}return l[p]?l[p].push(u):l[p]=[u],s=p>s?p:s,l},{}),a=Object.entries(i).map(([l,u])=>{const h=+l;return{edges:u,level:h,isMaxLevel:h===s}});return a.length===0?JP:a}function t$(e,t,n){const s=st(S.useCallback(i=>e?i.edges.filter(a=>{const l=t.get(a.source),u=t.get(a.target);return(l==null?void 0:l.width)&&(l==null?void 0:l.height)&&(u==null?void 0:u.width)&&(u==null?void 0:u.height)&&ZP({sourcePos:l.positionAbsolute||{x:0,y:0},targetPos:u.positionAbsolute||{x:0,y:0},sourceWidth:l.width,sourceHeight:l.height,targetWidth:u.width,targetHeight:u.height,width:i.width,height:i.height,transform:i.transform})}):i.edges,[e,t]));return e$(s,t,n)}const n$=({color:e="none",strokeWidth:t=1})=>de.createElement("polyline",{style:{stroke:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),r$=({color:e="none",strokeWidth:t=1})=>de.createElement("polyline",{style:{stroke:e,fill:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),Wb={[vu.Arrow]:n$,[vu.ArrowClosed]:r$};function s$(e){const t=Rt();return S.useMemo(()=>{var i,a;return Object.prototype.hasOwnProperty.call(Wb,e)?Wb[e]:((a=(i=t.getState()).onError)==null||a.call(i,"009",Qr.error009(e)),null)},[e])}const o$=({id:e,type:t,color:n,width:s=12.5,height:i=12.5,markerUnits:a="strokeWidth",strokeWidth:l,orient:u="auto-start-reverse"})=>{const h=s$(t);return h?de.createElement("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${s}`,markerHeight:`${i}`,viewBox:"-10 -10 20 20",markerUnits:a,orient:u,refX:"0",refY:"0"},de.createElement(h,{color:n,strokeWidth:l})):null},i$=({defaultColor:e,rfId:t})=>n=>{const s=[];return n.edges.reduce((i,a)=>([a.markerStart,a.markerEnd].forEach(l=>{if(l&&typeof l=="object"){const u=Ry(l,t);s.includes(u)||(i.push({id:u,color:l.color||e,...l}),s.push(u))}}),i),[]).sort((i,a)=>i.id.localeCompare(a.id))},DC=({defaultColor:e,rfId:t})=>{const n=st(S.useCallback(i$({defaultColor:e,rfId:t}),[e,t]),(s,i)=>!(s.length!==i.length||s.some((a,l)=>a.id!==i[l].id)));return de.createElement("defs",null,n.map(s=>de.createElement(o$,{id:s.id,key:s.id,type:s.type,color:s.color,width:s.width,height:s.height,markerUnits:s.markerUnits,strokeWidth:s.strokeWidth,orient:s.orient})))};DC.displayName="MarkerDefinitions";var a$=S.memo(DC);const l$=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}),FC=({defaultMarkerColor:e,onlyRenderVisibleElements:t,elevateEdgesOnSelect:n,rfId:s,edgeTypes:i,noPanClassName:a,onEdgeContextMenu:l,onEdgeMouseEnter:u,onEdgeMouseMove:h,onEdgeMouseLeave:p,onEdgeClick:f,onEdgeDoubleClick:g,onReconnect:y,onReconnectStart:w,onReconnectEnd:N,reconnectRadius:b,children:_,disableKeyboardA11y:k})=>{const{edgesFocusable:E,edgesUpdatable:j,elementsSelectable:C,width:I,height:P,connectionMode:O,nodeInternals:F,onError:M}=st(l$,$t),A=t$(t,F,n);return I?de.createElement(de.Fragment,null,A.map(({level:q,edges:W,isMaxLevel:Y})=>de.createElement("svg",{key:q,style:{zIndex:q},width:I,height:P,className:"react-flow__edges react-flow__container"},Y&&de.createElement(a$,{defaultColor:e,rfId:s}),de.createElement("g",null,W.map(T=>{const[Z,U,ne]=Ub(F.get(T.source)),[X,H,J]=Ub(F.get(T.target));if(!ne||!J)return null;let $=T.type||"default";i[$]||(M==null||M("011",Qr.error011($)),$="default");const G=i[$]||i.default,Q=O===_o.Strict?H.target:(H.target??[]).concat(H.source??[]),D=Bb(U.source,T.sourceHandle),L=Bb(Q,T.targetHandle),K=(D==null?void 0:D.position)||Pe.Bottom,se=(L==null?void 0:L.position)||Pe.Top,he=!!(T.focusable||E&&typeof T.focusable>"u"),pe=T.reconnectable||T.updatable,re=typeof y<"u"&&(pe||j&&typeof pe>"u");if(!D||!L)return M==null||M("008",Qr.error008(D,T)),null;const{sourceX:ve,sourceY:Te,targetX:$e,targetY:Me}=QP(Z,D,K,X,L,se);return de.createElement(G,{key:T.id,id:T.id,className:Ht([T.className,a]),type:$,data:T.data,selected:!!T.selected,animated:!!T.animated,hidden:!!T.hidden,label:T.label,labelStyle:T.labelStyle,labelShowBg:T.labelShowBg,labelBgStyle:T.labelBgStyle,labelBgPadding:T.labelBgPadding,labelBgBorderRadius:T.labelBgBorderRadius,style:T.style,source:T.source,target:T.target,sourceHandleId:T.sourceHandle,targetHandleId:T.targetHandle,markerEnd:T.markerEnd,markerStart:T.markerStart,sourceX:ve,sourceY:Te,targetX:$e,targetY:Me,sourcePosition:K,targetPosition:se,elementsSelectable:C,onContextMenu:l,onMouseEnter:u,onMouseMove:h,onMouseLeave:p,onClick:f,onEdgeDoubleClick:g,onReconnect:y,onReconnectStart:w,onReconnectEnd:N,reconnectRadius:b,rfId:s,ariaLabel:T.ariaLabel,isFocusable:he,isReconnectable:re,pathOptions:"pathOptions"in T?T.pathOptions:void 0,interactionWidth:T.interactionWidth,disableKeyboardA11y:k})})))),_):null};FC.displayName="EdgeRenderer";var c$=S.memo(FC);const u$=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function d$({children:e}){const t=st(u$);return de.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:t}},e)}function f$(e){const t=gl(),n=S.useRef(!1);S.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const h$={[Pe.Left]:Pe.Right,[Pe.Right]:Pe.Left,[Pe.Top]:Pe.Bottom,[Pe.Bottom]:Pe.Top},zC=({nodeId:e,handleType:t,style:n,type:s=Rs.Bezier,CustomComponent:i,connectionStatus:a})=>{var P,O,F;const{fromNode:l,handleId:u,toX:h,toY:p,connectionMode:f}=st(S.useCallback(M=>({fromNode:M.nodeInternals.get(e),handleId:M.connectionHandleId,toX:(M.connectionPosition.x-M.transform[0])/M.transform[2],toY:(M.connectionPosition.y-M.transform[1])/M.transform[2],connectionMode:M.connectionMode}),[e]),$t),g=(P=l==null?void 0:l[Nt])==null?void 0:P.handleBounds;let y=g==null?void 0:g[t];if(f===_o.Loose&&(y=y||(g==null?void 0:g[t==="source"?"target":"source"])),!l||!y)return null;const w=u?y.find(M=>M.id===u):y[0],N=w?w.x+w.width/2:(l.width??0)/2,b=w?w.y+w.height/2:l.height??0,_=(((O=l.positionAbsolute)==null?void 0:O.x)??0)+N,k=(((F=l.positionAbsolute)==null?void 0:F.y)??0)+b,E=w==null?void 0:w.position,j=E?h$[E]:null;if(!E||!j)return null;if(i)return de.createElement(i,{connectionLineType:s,connectionLineStyle:n,fromNode:l,fromHandle:w,fromX:_,fromY:k,toX:h,toY:p,fromPosition:E,toPosition:j,connectionStatus:a});let C="";const I={sourceX:_,sourceY:k,sourcePosition:E,targetX:h,targetY:p,targetPosition:j};return s===Rs.Bezier?[C]=fC(I):s===Rs.Step?[C]=Ty({...I,borderRadius:0}):s===Rs.SmoothStep?[C]=Ty(I):s===Rs.SimpleBezier?[C]=dC(I):C=`M${_},${k} ${h},${p}`,de.createElement("path",{d:C,fill:"none",className:"react-flow__connection-path",style:n})};zC.displayName="ConnectionLine";const p$=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function m$({containerStyle:e,style:t,type:n,component:s}){const{nodeId:i,handleType:a,nodesConnectable:l,width:u,height:h,connectionStatus:p}=st(p$,$t);return!(i&&a&&u&&l)?null:de.createElement("svg",{style:e,width:u,height:h,className:"react-flow__edges react-flow__connectionline react-flow__container"},de.createElement("g",{className:Ht(["react-flow__connection",p])},de.createElement(zC,{nodeId:i,handleType:a,style:t,type:n,CustomComponent:s,connectionStatus:p})))}function Hb(e,t){return S.useRef(null),Rt(),S.useMemo(()=>t(e),[e])}const BC=({nodeTypes:e,edgeTypes:t,onMove:n,onMoveStart:s,onMoveEnd:i,onInit:a,onNodeClick:l,onEdgeClick:u,onNodeDoubleClick:h,onEdgeDoubleClick:p,onNodeMouseEnter:f,onNodeMouseMove:g,onNodeMouseLeave:y,onNodeContextMenu:w,onSelectionContextMenu:N,onSelectionStart:b,onSelectionEnd:_,connectionLineType:k,connectionLineStyle:E,connectionLineComponent:j,connectionLineContainerStyle:C,selectionKeyCode:I,selectionOnDrag:P,selectionMode:O,multiSelectionKeyCode:F,panActivationKeyCode:M,zoomActivationKeyCode:A,deleteKeyCode:q,onlyRenderVisibleElements:W,elementsSelectable:Y,selectNodesOnDrag:T,defaultViewport:Z,translateExtent:U,minZoom:ne,maxZoom:X,preventScrolling:H,defaultMarkerColor:J,zoomOnScroll:$,zoomOnPinch:G,panOnScroll:Q,panOnScrollSpeed:D,panOnScrollMode:L,zoomOnDoubleClick:K,panOnDrag:se,onPaneClick:he,onPaneMouseEnter:pe,onPaneMouseMove:re,onPaneMouseLeave:ve,onPaneScroll:Te,onPaneContextMenu:$e,onEdgeContextMenu:Me,onEdgeMouseEnter:_e,onEdgeMouseMove:ae,onEdgeMouseLeave:we,onReconnect:be,onReconnectStart:Ue,onReconnectEnd:Ke,reconnectRadius:ut,noDragClassName:ot,noWheelClassName:He,noPanClassName:nt,elevateEdgesOnSelect:Xe,disableKeyboardA11y:_t,nodeOrigin:Oe,nodeExtent:it,rfId:Mt})=>{const le=Hb(e,UP),Le=Hb(t,XP);return f$(a),de.createElement(zP,{onPaneClick:he,onPaneMouseEnter:pe,onPaneMouseMove:re,onPaneMouseLeave:ve,onPaneContextMenu:$e,onPaneScroll:Te,deleteKeyCode:q,selectionKeyCode:I,selectionOnDrag:P,selectionMode:O,onSelectionStart:b,onSelectionEnd:_,multiSelectionKeyCode:F,panActivationKeyCode:M,zoomActivationKeyCode:A,elementsSelectable:Y,onMove:n,onMoveStart:s,onMoveEnd:i,zoomOnScroll:$,zoomOnPinch:G,zoomOnDoubleClick:K,panOnScroll:Q,panOnScrollSpeed:D,panOnScrollMode:L,panOnDrag:se,defaultViewport:Z,translateExtent:U,minZoom:ne,maxZoom:X,onSelectionContextMenu:N,preventScrolling:H,noDragClassName:ot,noWheelClassName:He,noPanClassName:nt,disableKeyboardA11y:_t},de.createElement(d$,null,de.createElement(c$,{edgeTypes:Le,onEdgeClick:u,onEdgeDoubleClick:p,onlyRenderVisibleElements:W,onEdgeContextMenu:Me,onEdgeMouseEnter:_e,onEdgeMouseMove:ae,onEdgeMouseLeave:we,onReconnect:be,onReconnectStart:Ue,onReconnectEnd:Ke,reconnectRadius:ut,defaultMarkerColor:J,noPanClassName:nt,elevateEdgesOnSelect:!!Xe,disableKeyboardA11y:_t,rfId:Mt},de.createElement(m$,{style:E,type:k,component:j,containerStyle:C})),de.createElement("div",{className:"react-flow__edgelabel-renderer"}),de.createElement(GP,{nodeTypes:le,onNodeClick:l,onNodeDoubleClick:h,onNodeMouseEnter:f,onNodeMouseMove:g,onNodeMouseLeave:y,onNodeContextMenu:w,selectNodesOnDrag:T,onlyRenderVisibleElements:W,noPanClassName:nt,noDragClassName:ot,disableKeyboardA11y:_t,nodeOrigin:Oe,nodeExtent:it,rfId:Mt})))};BC.displayName="GraphView";var g$=S.memo(BC);const Oy=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],js={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:Oy,nodeExtent:Oy,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:_o.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:UO,isValidConnection:void 0},v$=()=>s2((e,t)=>({...js,setNodes:n=>{const{nodeInternals:s,nodeOrigin:i,elevateNodesOnSelect:a}=t();e({nodeInternals:Uf(n,s,i,a)})},getNodes:()=>Array.from(t().nodeInternals.values()),setEdges:n=>{const{defaultEdgeOptions:s={}}=t();e({edges:n.map(i=>({...s,...i}))})},setDefaultNodesAndEdges:(n,s)=>{const i=typeof n<"u",a=typeof s<"u",l=i?Uf(n,new Map,t().nodeOrigin,t().elevateNodesOnSelect):new Map;e({nodeInternals:l,edges:a?s:[],hasDefaultNodes:i,hasDefaultEdges:a})},updateNodeDimensions:n=>{const{onNodesChange:s,nodeInternals:i,fitViewOnInit:a,fitViewOnInitDone:l,fitViewOnInitOptions:u,domNode:h,nodeOrigin:p}=t(),f=h==null?void 0:h.querySelector(".react-flow__viewport");if(!f)return;const g=window.getComputedStyle(f),{m22:y}=new window.DOMMatrixReadOnly(g.transform),w=n.reduce((b,_)=>{const k=i.get(_.id);if(k!=null&&k.hidden)i.set(k.id,{...k,[Nt]:{...k[Nt],handleBounds:void 0}});else if(k){const E=aw(_.nodeElement);!!(E.width&&E.height&&(k.width!==E.width||k.height!==E.height||_.forceUpdate))&&(i.set(k.id,{...k,[Nt]:{...k[Nt],handleBounds:{source:qb(".source",_.nodeElement,y,p),target:qb(".target",_.nodeElement,y,p)}},...E}),b.push({id:k.id,type:"dimensions",dimensions:E}))}return b},[]);RC(i,p);const N=l||a&&!l&&AC(t,{initial:!0,...u});e({nodeInternals:new Map(i),fitViewOnInitDone:N}),(w==null?void 0:w.length)>0&&(s==null||s(w))},updateNodePositions:(n,s=!0,i=!1)=>{const{triggerNodeChanges:a}=t(),l=n.map(u=>{const h={id:u.id,type:"position",dragging:i};return s&&(h.positionAbsolute=u.positionAbsolute,h.position=u.position),h});a(l)},triggerNodeChanges:n=>{const{onNodesChange:s,nodeInternals:i,hasDefaultNodes:a,nodeOrigin:l,getNodes:u,elevateNodesOnSelect:h}=t();if(n!=null&&n.length){if(a){const p=MP(n,u()),f=Uf(p,i,l,h);e({nodeInternals:f})}s==null||s(n)}},addSelectedNodes:n=>{const{multiSelectionActive:s,edges:i,getNodes:a}=t();let l,u=null;s?l=n.map(h=>Ts(h,!0)):(l=ji(a(),n),u=ji(i,[])),Gc({changedNodes:l,changedEdges:u,get:t,set:e})},addSelectedEdges:n=>{const{multiSelectionActive:s,edges:i,getNodes:a}=t();let l,u=null;s?l=n.map(h=>Ts(h,!0)):(l=ji(i,n),u=ji(a(),[])),Gc({changedNodes:u,changedEdges:l,get:t,set:e})},unselectNodesAndEdges:({nodes:n,edges:s}={})=>{const{edges:i,getNodes:a}=t(),l=n||a(),u=s||i,h=l.map(f=>(f.selected=!1,Ts(f.id,!1))),p=u.map(f=>Ts(f.id,!1));Gc({changedNodes:h,changedEdges:p,get:t,set:e})},setMinZoom:n=>{const{d3Zoom:s,maxZoom:i}=t();s==null||s.scaleExtent([n,i]),e({minZoom:n})},setMaxZoom:n=>{const{d3Zoom:s,minZoom:i}=t();s==null||s.scaleExtent([i,n]),e({maxZoom:n})},setTranslateExtent:n=>{var s;(s=t().d3Zoom)==null||s.translateExtent(n),e({translateExtent:n})},resetSelectedElements:()=>{const{edges:n,getNodes:s}=t(),a=s().filter(u=>u.selected).map(u=>Ts(u.id,!1)),l=n.filter(u=>u.selected).map(u=>Ts(u.id,!1));Gc({changedNodes:a,changedEdges:l,get:t,set:e})},setNodeExtent:n=>{const{nodeInternals:s}=t();s.forEach(i=>{i.positionAbsolute=lw(i.position,n)}),e({nodeExtent:n,nodeInternals:new Map(s)})},panBy:n=>{const{transform:s,width:i,height:a,d3Zoom:l,d3Selection:u,translateExtent:h}=t();if(!l||!u||!n.x&&!n.y)return!1;const p=Kr.translate(s[0]+n.x,s[1]+n.y).scale(s[2]),f=[[0,0],[i,a]],g=l==null?void 0:l.constrain()(p,f,h);return l.transform(u,g),s[0]!==g.x||s[1]!==g.y||s[2]!==g.k},cancelConnection:()=>e({connectionNodeId:js.connectionNodeId,connectionHandleId:js.connectionHandleId,connectionHandleType:js.connectionHandleType,connectionStatus:js.connectionStatus,connectionStartHandle:js.connectionStartHandle,connectionEndHandle:js.connectionEndHandle}),reset:()=>e({...js})}),Object.is),gw=({children:e})=>{const t=S.useRef(null);return t.current||(t.current=v$()),de.createElement($O,{value:t.current},e)};gw.displayName="ReactFlowProvider";const UC=({children:e})=>S.useContext(Au)?de.createElement(de.Fragment,null,e):de.createElement(gw,null,e);UC.displayName="ReactFlowWrapper";const y$={input:kC,default:My,output:NC,group:pw},w$={default:yu,straight:dw,step:uw,smoothstep:Mu,simplebezier:cw},x$=[0,0],b$=[15,15],_$={x:0,y:0,zoom:1},k$={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},WC=S.forwardRef(({nodes:e,edges:t,defaultNodes:n,defaultEdges:s,className:i,nodeTypes:a=y$,edgeTypes:l=w$,onNodeClick:u,onEdgeClick:h,onInit:p,onMove:f,onMoveStart:g,onMoveEnd:y,onConnect:w,onConnectStart:N,onConnectEnd:b,onClickConnectStart:_,onClickConnectEnd:k,onNodeMouseEnter:E,onNodeMouseMove:j,onNodeMouseLeave:C,onNodeContextMenu:I,onNodeDoubleClick:P,onNodeDragStart:O,onNodeDrag:F,onNodeDragStop:M,onNodesDelete:A,onEdgesDelete:q,onSelectionChange:W,onSelectionDragStart:Y,onSelectionDrag:T,onSelectionDragStop:Z,onSelectionContextMenu:U,onSelectionStart:ne,onSelectionEnd:X,connectionMode:H=_o.Strict,connectionLineType:J=Rs.Bezier,connectionLineStyle:$,connectionLineComponent:G,connectionLineContainerStyle:Q,deleteKeyCode:D="Backspace",selectionKeyCode:L="Shift",selectionOnDrag:K=!1,selectionMode:se=il.Full,panActivationKeyCode:he="Space",multiSelectionKeyCode:pe=gu()?"Meta":"Control",zoomActivationKeyCode:re=gu()?"Meta":"Control",snapToGrid:ve=!1,snapGrid:Te=b$,onlyRenderVisibleElements:$e=!1,selectNodesOnDrag:Me=!0,nodesDraggable:_e,nodesConnectable:ae,nodesFocusable:we,nodeOrigin:be=x$,edgesFocusable:Ue,edgesUpdatable:Ke,elementsSelectable:ut,defaultViewport:ot=_$,minZoom:He=.5,maxZoom:nt=2,translateExtent:Xe=Oy,preventScrolling:_t=!0,nodeExtent:Oe,defaultMarkerColor:it="#b1b1b7",zoomOnScroll:Mt=!0,zoomOnPinch:le=!0,panOnScroll:Le=!1,panOnScrollSpeed:Fe=.5,panOnScrollMode:Ee=yo.Free,zoomOnDoubleClick:Ge=!0,panOnDrag:Et=!0,onPaneClick:tt,onPaneMouseEnter:Re,onPaneMouseMove:wt,onPaneMouseLeave:lt,onPaneScroll:kt,onPaneContextMenu:Nn,children:zn,onEdgeContextMenu:En,onEdgeDoubleClick:jo,onEdgeMouseEnter:mn,onEdgeMouseMove:Co,onEdgeMouseLeave:To,onEdgeUpdate:Bt,onEdgeUpdateStart:Cr,onEdgeUpdateEnd:Bn,onReconnect:Ps,onReconnectStart:Tr,onReconnectEnd:Qi,reconnectRadius:fr=10,edgeUpdaterRadius:Rr=10,onNodesChange:hr,onEdgesChange:es,noDragClassName:Ro="nodrag",noWheelClassName:Ao="nowheel",noPanClassName:Mo="nopan",fitView:jn=!1,fitViewOptions:Io,connectOnClick:Ar=!0,attributionPosition:Oo,proOptions:Un,defaultEdgeOptions:Po,elevateNodesOnSelect:$s=!0,elevateEdgesOnSelect:Ls=!1,disableKeyboardA11y:$o=!1,autoPanOnConnect:Lo=!0,autoPanOnNodeDrag:rt=!0,connectionRadius:Zi=20,isValidConnection:ts,onError:Gt,style:Wn,id:qo,nodeDragThreshold:ns,...pt},sn)=>{const Hn=qo||"1";return de.createElement("div",{...pt,style:{...Wn,...k$},ref:sn,className:Ht(["react-flow",i]),"data-testid":"rf__wrapper",id:qo},de.createElement(UC,null,de.createElement(g$,{onInit:p,onMove:f,onMoveStart:g,onMoveEnd:y,onNodeClick:u,onEdgeClick:h,onNodeMouseEnter:E,onNodeMouseMove:j,onNodeMouseLeave:C,onNodeContextMenu:I,onNodeDoubleClick:P,nodeTypes:a,edgeTypes:l,connectionLineType:J,connectionLineStyle:$,connectionLineComponent:G,connectionLineContainerStyle:Q,selectionKeyCode:L,selectionOnDrag:K,selectionMode:se,deleteKeyCode:D,multiSelectionKeyCode:pe,panActivationKeyCode:he,zoomActivationKeyCode:re,onlyRenderVisibleElements:$e,selectNodesOnDrag:Me,defaultViewport:ot,translateExtent:Xe,minZoom:He,maxZoom:nt,preventScrolling:_t,zoomOnScroll:Mt,zoomOnPinch:le,zoomOnDoubleClick:Ge,panOnScroll:Le,panOnScrollSpeed:Fe,panOnScrollMode:Ee,panOnDrag:Et,onPaneClick:tt,onPaneMouseEnter:Re,onPaneMouseMove:wt,onPaneMouseLeave:lt,onPaneScroll:kt,onPaneContextMenu:Nn,onSelectionContextMenu:U,onSelectionStart:ne,onSelectionEnd:X,onEdgeContextMenu:En,onEdgeDoubleClick:jo,onEdgeMouseEnter:mn,onEdgeMouseMove:Co,onEdgeMouseLeave:To,onReconnect:Ps??Bt,onReconnectStart:Tr??Cr,onReconnectEnd:Qi??Bn,reconnectRadius:fr??Rr,defaultMarkerColor:it,noDragClassName:Ro,noWheelClassName:Ao,noPanClassName:Mo,elevateEdgesOnSelect:Ls,rfId:Hn,disableKeyboardA11y:$o,nodeOrigin:be,nodeExtent:Oe}),de.createElement(fP,{nodes:e,edges:t,defaultNodes:n,defaultEdges:s,onConnect:w,onConnectStart:N,onConnectEnd:b,onClickConnectStart:_,onClickConnectEnd:k,nodesDraggable:_e,nodesConnectable:ae,nodesFocusable:we,edgesFocusable:Ue,edgesUpdatable:Ke,elementsSelectable:ut,elevateNodesOnSelect:$s,minZoom:He,maxZoom:nt,nodeExtent:Oe,onNodesChange:hr,onEdgesChange:es,snapToGrid:ve,snapGrid:Te,connectionMode:H,translateExtent:Xe,connectOnClick:Ar,defaultEdgeOptions:Po,fitView:jn,fitViewOptions:Io,onNodesDelete:A,onEdgesDelete:q,onNodeDragStart:O,onNodeDrag:F,onNodeDragStop:M,onSelectionDrag:T,onSelectionDragStart:Y,onSelectionDragStop:Z,noPanClassName:Mo,nodeOrigin:be,rfId:Hn,autoPanOnConnect:Lo,autoPanOnNodeDrag:rt,onError:Gt,connectionRadius:Zi,isValidConnection:ts,nodeDragThreshold:ns}),de.createElement(uP,{onSelectionChange:W}),zn,de.createElement(qO,{proOptions:Un,position:Oo}),de.createElement(vP,{rfId:Hn,disableKeyboardA11y:$o})))});WC.displayName="ReactFlow";const S$=e=>({x:e.transform[0],y:e.transform[1],zoom:e.transform[2]});function HC(){return st(S$,$t)}const GC=({id:e,x:t,y:n,width:s,height:i,style:a,color:l,strokeColor:u,strokeWidth:h,className:p,borderRadius:f,shapeRendering:g,onClick:y,selected:w})=>{const{background:N,backgroundColor:b}=a||{},_=l||N||b;return de.createElement("rect",{className:Ht(["react-flow__minimap-node",{selected:w},p]),x:t,y:n,rx:f,ry:f,width:s,height:i,fill:_,stroke:u,strokeWidth:h,shapeRendering:g,onClick:y?k=>y(k,e):void 0})};GC.displayName="MiniMapNode";var N$=S.memo(GC);const E$=e=>e.nodeOrigin,j$=e=>e.getNodes().filter(t=>!t.hidden&&t.width&&t.height),Vf=e=>e instanceof Function?e:()=>e;function C$({nodeStrokeColor:e="transparent",nodeColor:t="#e2e2e2",nodeClassName:n="",nodeBorderRadius:s=5,nodeStrokeWidth:i=2,nodeComponent:a=N$,onClick:l}){const u=st(j$,$t),h=st(E$),p=Vf(t),f=Vf(e),g=Vf(n),y=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return de.createElement(de.Fragment,null,u.map(w=>{const{x:N,y:b}=xo(w,h).positionAbsolute;return de.createElement(a,{key:w.id,x:N,y:b,width:w.width,height:w.height,style:w.style,selected:w.selected,className:g(w),color:p(w),borderRadius:s,strokeColor:f(w),strokeWidth:i,shapeRendering:y,onClick:l,id:w.id})}))}var T$=S.memo(C$);const R$=200,A$=150,M$=e=>{const t=e.getNodes(),n={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:n,boundingRect:t.length>0?zO(Iu(t,e.nodeOrigin),n):n,rfId:e.rfId}},I$="react-flow__minimap-desc";function VC({style:e,className:t,nodeStrokeColor:n="transparent",nodeColor:s="#e2e2e2",nodeClassName:i="",nodeBorderRadius:a=5,nodeStrokeWidth:l=2,nodeComponent:u,maskColor:h="rgb(240, 240, 240, 0.6)",maskStrokeColor:p="none",maskStrokeWidth:f=1,position:g="bottom-right",onClick:y,onNodeClick:w,pannable:N=!1,zoomable:b=!1,ariaLabel:_="React Flow mini map",inversePan:k=!1,zoomStep:E=10,offsetScale:j=5}){const C=Rt(),I=S.useRef(null),{boundingRect:P,viewBB:O,rfId:F}=st(M$,$t),M=(e==null?void 0:e.width)??R$,A=(e==null?void 0:e.height)??A$,q=P.width/M,W=P.height/A,Y=Math.max(q,W),T=Y*M,Z=Y*A,U=j*Y,ne=P.x-(T-P.width)/2-U,X=P.y-(Z-P.height)/2-U,H=T+U*2,J=Z+U*2,$=`${I$}-${F}`,G=S.useRef(0);G.current=Y,S.useEffect(()=>{if(I.current){const L=Ln(I.current),K=pe=>{const{transform:re,d3Selection:ve,d3Zoom:Te}=C.getState();if(pe.sourceEvent.type!=="wheel"||!ve||!Te)return;const $e=-pe.sourceEvent.deltaY*(pe.sourceEvent.deltaMode===1?.05:pe.sourceEvent.deltaMode?1:.002)*E,Me=re[2]*Math.pow(2,$e);Te.scaleTo(ve,Me)},se=pe=>{const{transform:re,d3Selection:ve,d3Zoom:Te,translateExtent:$e,width:Me,height:_e}=C.getState();if(pe.sourceEvent.type!=="mousemove"||!ve||!Te)return;const ae=G.current*Math.max(1,re[2])*(k?-1:1),we={x:re[0]-pe.sourceEvent.movementX*ae,y:re[1]-pe.sourceEvent.movementY*ae},be=[[0,0],[Me,_e]],Ue=Kr.translate(we.x,we.y).scale(re[2]),Ke=Te.constrain()(Ue,be,$e);Te.transform(ve,Ke)},he=tC().on("zoom",N?se:null).on("zoom.wheel",b?K:null);return L.call(he),()=>{L.on("zoom",null)}}},[N,b,k,E]);const Q=y?L=>{const K=sr(L);y(L,{x:K[0],y:K[1]})}:void 0,D=w?(L,K)=>{const se=C.getState().nodeInternals.get(K);w(L,se)}:void 0;return de.createElement(iw,{position:g,style:e,className:Ht(["react-flow__minimap",t]),"data-testid":"rf__minimap"},de.createElement("svg",{width:M,height:A,viewBox:`${ne} ${X} ${H} ${J}`,role:"img","aria-labelledby":$,ref:I,onClick:Q},_&&de.createElement("title",{id:$},_),de.createElement(T$,{onClick:D,nodeColor:s,nodeStrokeColor:n,nodeBorderRadius:a,nodeClassName:i,nodeStrokeWidth:l,nodeComponent:u}),de.createElement("path",{className:"react-flow__minimap-mask",d:`M${ne-U},${X-U}h${H+U*2}v${J+U*2}h${-H-U*2}z
|
|
57
|
+
M${O.x},${O.y}h${O.width}v${O.height}h${-O.width}z`,fill:h,fillRule:"evenodd",stroke:p,strokeWidth:f,pointerEvents:"none"})))}VC.displayName="MiniMap";var O$=S.memo(VC);function P$(){return de.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},de.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function $$(){return de.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},de.createElement("path",{d:"M0 0h32v4.2H0z"}))}function L$(){return de.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},de.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 q$(){return de.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},de.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 D$(){return de.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},de.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 Sr=({children:e,className:t,...n})=>de.createElement("button",{type:"button",className:Ht(["react-flow__controls-button",t]),...n},e);Sr.displayName="ControlButton";const F$=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom}),YC=({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:s=!0,fitViewOptions:i,onZoomIn:a,onZoomOut:l,onFitView:u,onInteractiveChange:h,className:p,children:f,position:g="bottom-left"})=>{const y=Rt(),[w,N]=S.useState(!1),{isInteractive:b,minZoomReached:_,maxZoomReached:k}=st(F$,$t),{zoomIn:E,zoomOut:j,fitView:C}=gl();if(S.useEffect(()=>{N(!0)},[]),!w)return null;const I=()=>{E(),a==null||a()},P=()=>{j(),l==null||l()},O=()=>{C(i),u==null||u()},F=()=>{y.setState({nodesDraggable:!b,nodesConnectable:!b,elementsSelectable:!b}),h==null||h(!b)};return de.createElement(iw,{className:Ht(["react-flow__controls",p]),position:g,style:e,"data-testid":"rf__controls"},t&&de.createElement(de.Fragment,null,de.createElement(Sr,{onClick:I,className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:k},de.createElement(P$,null)),de.createElement(Sr,{onClick:P,className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:_},de.createElement($$,null))),n&&de.createElement(Sr,{className:"react-flow__controls-fitview",onClick:O,title:"fit view","aria-label":"fit view"},de.createElement(L$,null)),s&&de.createElement(Sr,{className:"react-flow__controls-interactive",onClick:F,title:"toggle interactivity","aria-label":"toggle interactivity"},b?de.createElement(D$,null):de.createElement(q$,null)),f)};YC.displayName="Controls";var z$=S.memo(YC),lr;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(lr||(lr={}));function B$({color:e,dimensions:t,lineWidth:n}){return de.createElement("path",{stroke:e,strokeWidth:n,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`})}function U$({color:e,radius:t}){return de.createElement("circle",{cx:t,cy:t,r:t,fill:e})}const W$={[lr.Dots]:"#91919a",[lr.Lines]:"#eee",[lr.Cross]:"#e2e2e2"},H$={[lr.Dots]:1,[lr.Lines]:1,[lr.Cross]:6},G$=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function KC({id:e,variant:t=lr.Dots,gap:n=20,size:s,lineWidth:i=1,offset:a=2,color:l,style:u,className:h}){const p=S.useRef(null),{transform:f,patternId:g}=st(G$,$t),y=l||W$[t],w=s||H$[t],N=t===lr.Dots,b=t===lr.Cross,_=Array.isArray(n)?n:[n,n],k=[_[0]*f[2]||1,_[1]*f[2]||1],E=w*f[2],j=b?[E,E]:k,C=N?[E/a,E/a]:[j[0]/a,j[1]/a];return de.createElement("svg",{className:Ht(["react-flow__background",h]),style:{...u,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:p,"data-testid":"rf__background"},de.createElement("pattern",{id:g+e,x:f[0]%k[0],y:f[1]%k[1],width:k[0],height:k[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${C[0]},-${C[1]})`},N?de.createElement(U$,{color:y,radius:E/a}):de.createElement(B$,{dimensions:j,color:y,lineWidth:i})),de.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${g+e})`}))}KC.displayName="Background";var V$=S.memo(KC);const Y$=["us-gov","global","apac","us","eu","jp","au"],K$=new RegExp(`^(?:(?:${Y$.join("|")})\\.)?anthropic\\.`,"i");function vl(e){return e.replace(K$,"")}function XC(){return{inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0}}function vw(e){const t=e.cache_creation,n=t&&typeof t=="object"?t:e,s=n.ephemeral_1h_input_tokens,i=n.ephemeral_5m_input_tokens;return typeof s!="number"&&typeof i!="number"?{}:{cacheCreate1hTokens:Number(s??0),cacheCreate5mTokens:Number(i??0)}}function X$(e){const t=vw(e),n={inputTokens:Number(e.input_tokens??0),outputTokens:Number(e.output_tokens??0),cacheReadTokens:Number(e.cache_read_input_tokens??e.cached_input_tokens??0),cacheCreateTokens:Number(e.cache_creation_input_tokens??e.cache_write_input_tokens??0),cacheCreate1hTokens:t.cacheCreate1hTokens,cacheCreate5mTokens:t.cacheCreate5mTokens};return typeof e.reasoning_output_tokens=="number"&&(n.reasoningOutputTokens=Number(e.reasoning_output_tokens)),n}function Q$(e){if(!e||typeof e!="object"||Array.isArray(e))return;const t={};for(const[n,s]of Object.entries(e))!n||!s||typeof s!="object"||(t[n]=X$(s));return Object.keys(t).length?t:void 0}function QC(e,t=0){if(!e||typeof e!="object"||t>6)return null;const n=e;if(typeof n.input_tokens=="number"||typeof n.output_tokens=="number"||typeof n.cache_read_input_tokens=="number"||typeof n.cache_creation_input_tokens=="number")return{inputTokens:Number(n.input_tokens??0),outputTokens:Number(n.output_tokens??0),cacheReadTokens:Number(n.cache_read_input_tokens??0),cacheCreateTokens:Number(n.cache_creation_input_tokens??0),...vw(n)};for(const s of Object.values(n)){const i=QC(s,t+1);if(i)return i}return null}const Z$=/^(?:claude[-_]|gpt[-_]|o\d|codex[-_])/i;function ZC(e,t=0){if(!e||typeof e!="object"||t>6)return null;const n=e;if(typeof n.model=="string"&&Z$.test(vl(n.model)))return n.model;for(const s of Object.values(n)){const i=ZC(s,t+1);if(i)return i}return null}function Py(){return{agents:new Map,toolIndex:new Map,toolOwner:new Map,activeSubagentStack:new Map,lastSeq:0,seqEpoch:null,totalEvents:0,revision:0}}function Ms(e){if(!e)return;const t=e.replace(/\\/g,"/").split("/").filter(Boolean);return t[t.length-1]}function Gb(){return{msgsUser:0,msgsAssistant:0,toolUses:0,toolResults:0,systemReminders:0,currentContextTokens:0,memoryFiles:[]}}function yl(e,t){return`${e}::${t}`}function wu(e){return e.agent_type??e.subagent_type??"subagent"}function Qa(e){return e.agent_id?e.agent_id:e.parent_tool_use_id?e.parent_tool_use_id:null}function Ci(e,t,n,s){const i=t;let a=e.agents.get(i);return a||(a={id:i,sessionId:t,label:"session",kind:"root",state:"active",startedAt:n,lastEventAt:n,tools:[],prompts:[],toolCount:0,childCount:0,synthetic:s,usage:XC()},e.agents.set(i,a),a)}function JC(e,t,n,s){const i=yl(t,n),a=e.agents.get(i);if(!a)return null;!a.cwd&&s.cwd&&(a.cwd=s.cwd,a.cwdBasename=Ms(s.cwd));const l=wu(s);return l&&(a.label==="subagent"||!a.label)&&(a.label=l),a}function J$(e,t,n){const s=t.session_id??"unknown",i=Qa(t);if(i){const h=JC(e,s,i,t);if(h)return h}const a=e.activeSubagentStack.get(s),l=a&&a.length>0?a[a.length-1]:null;if(l){const h=e.agents.get(yl(s,l));if(h)return!h.cwd&&t.cwd&&(h.cwd=t.cwd,h.cwdBasename=Ms(t.cwd)),h}const u=Ci(e,s,n,t.hook_event_name!=="SessionStart");return!u.cwd&&t.cwd&&(u.cwd=t.cwd,u.cwdBasename=Ms(t.cwd)),u.label==="session"&&t.cwd&&(u.label=Ms(t.cwd)??"session"),u}function eL(e,t,n,s,i){const a=yl(t,n),l=Ci(e,t,i,!0);let u=e.agents.get(a);if(u){!u.cwd&&s.cwd&&(u.cwd=s.cwd,u.cwdBasename=Ms(s.cwd));const h=wu(s);return h&&(u.label==="subagent"||!u.label)&&(u.label=h),u}return u={id:a,sessionId:t,label:wu(s),kind:"subagent",parentId:l.id,state:"active",startedAt:i,tools:[],prompts:[],cwd:s.cwd,cwdBasename:Ms(s.cwd),toolCount:0,childCount:0,usage:XC()},e.agents.set(a,u),l.childCount+=1,u}function tL(e,t,n){const s=e.activeSubagentStack.get(t)??[];s.includes(n)||(s.push(n),e.activeSubagentStack.set(t,s))}function nL(e,t,n){const s=e.activeSubagentStack.get(t);if(s){for(let i=s.length-1;i>=0;i--)if(s[i]===n){s.splice(i,1);break}s.length===0&&e.activeSubagentStack.delete(t)}}function Yc(e,t=80){if(e==null)return"";if(typeof e=="string")return e.length>t?e.slice(0,t-1)+"…":e;try{const n=JSON.stringify(e);return n.length>t?n.slice(0,t-1)+"…":n}catch{return String(e)}}const Vb=200,rL=25;function sL(e,t){const n=t.tools;if(n.length>Vb){const s=n.splice(0,n.length-Vb);for(const i of s)e.toolIndex.get(i.id)===i&&(e.toolIndex.delete(i.id),e.toolOwner.delete(i.id))}for(let s=n.length-rL-1;s>=0;s--){const i=n[s];if(i.trimmed)break;i.input=void 0,i.response=void 0,i.trimmed=!0}}function oL(e,t,n){const s=e.toolIndex.get(n);if(s)return s;for(let i=t.tools.length-1;i>=0;i--)if(t.tools[i].id===n)return t.tools[i];return null}const Yb=2e3;function iL(e,t,n){for(let s=e.prompts.length-1;s>=0;s--){const i=e.prompts[s];if(i.at<t-Yb)return!1;if(i.text===n&&i.at<=t+Yb)return!0}return!1}function eT(e,t){for(const n of t.tools)e.toolIndex.get(n.id)===n&&e.toolIndex.delete(n.id),e.toolOwner.get(n.id)===t.id&&e.toolOwner.delete(n.id)}function wl(e,t){return t&&(e.revision+=1),t}function aL(e,t,n,s){if(e.agents.size<=n)return!1;const i=p=>p.state==="done"&&p.endedAt!=null&&t-p.endedAt>s,a=[],l=new Map;for(const[p,f]of e.agents){if(f.parentId!=null){const g=l.get(f.parentId);g?g.push(p):l.set(f.parentId,[p])}i(f)&&a.push({id:p,endedAt:f.endedAt})}if(a.length===0)return!1;a.sort((p,f)=>p.endedAt-f.endedAt);let u=0;const h=p=>{const f=e.agents.get(p);f&&(eT(e,f),e.agents.delete(p),u++)};for(const p of a){if(e.agents.size<=n)break;if(!e.agents.has(p.id))continue;const f=(l.get(p.id)??[]).map(g=>e.agents.get(g)).filter(g=>g!=null);if(!f.some(g=>!i(g))){for(const g of f)h(g.id);h(p.id)}}return wl(e,u>0)}function lL(e,t,n,s){const i=new Map;for(const[p,f]of e.agents){let g=i.get(f.sessionId);g||(g={ids:[],endedAt:0,live:!1,closed:!1},i.set(f.sessionId,g)),g.ids.push(p),f.kind==="root"&&f.closedAt!=null&&(g.closed=!0),f.state==="done"&&f.endedAt!=null?g.endedAt=Math.max(g.endedAt,f.endedAt):g.live=!0}const a=[...i.values()].filter(p=>!p.live&&p.endedAt>0&&t-p.endedAt>s).sort((p,f)=>p.closed===f.closed?p.endedAt-f.endedAt:p.closed?-1:1);let u=[...i.values()].filter(p=>!p.live).length-n;if(u<=0)return!1;let h=!1;for(const p of a){if(u<=0)break;for(const f of p.ids){const g=e.agents.get(f);g&&eT(e,g),e.agents.delete(f)}u--,h=!0}return wl(e,h)}function cL(e,t){const n=t==null?void 0:t.payload,s=n==null?void 0:n.hook_event_name;if(s!=="PostToolUse"&&s!=="PostToolUseFailure")return!1;const i=n==null?void 0:n.tool_use_id;return typeof i=="string"&&i.length>0&&e.toolIndex.has(i)}function uL(e){let t=!1;for(const n of e.agents.values())for(const s of n.tools)s.endedAt!=null||s.outcomeGap||(s.outcomeGap=!0,t=!0);return wl(e,t)}function dL(e,t,n){let s=!1;for(const i of e.agents.values()){if(i.provider==="codex")continue;const a=e.agents.get(i.sessionId),l=(a==null?void 0:a.lastEventAt)??(a==null?void 0:a.startedAt);for(const u of i.tools){const h=Math.max(u.startedAt,l??u.startedAt);u.endedAt==null&&t-h>n&&(u.endedAt=h,u.ok=!1,u.errorPreview=u.outcomeGap?"no result reached the deck — events were dropped while the deck was paused":"session ended before this call returned",e.toolIndex.delete(u.id),e.toolOwner.delete(u.id),s=!0)}}return wl(e,s)}const Kb=90*6e4;function fL(e,t,n){let s=!1;for(const i of e.agents.values()){if(i.kind!=="root")continue;const a=i.lastEventAt??i.startedAt;if(!(t-a<=n)){i.waiting&&(i.waiting=null,s=!0),i.closedAt==null&&(i.closedAt=a),i.state==="active"&&(i.state="done",i.endedAt=a,i.reaped=!0,s=!0);for(const l of e.agents.values())l.sessionId!==i.sessionId||l.kind==="root"||l.state!=="active"||(l.state="done",l.endedAt=a,s=!0);e.activeSubagentStack.delete(i.sessionId)}}return wl(e,s)}function hL(e){return e==="permission_prompt"?"permission":e==="idle_prompt"?"idle":null}const pL=new Set(["Notification","ModelObserved","ContextObserved","UsageObserved","SessionNamed"]);function mL(e,t){let n=null;for(const s of e.toolIndex.values()){const i=s.agentId?e.agents.get(s.agentId):void 0;!i||i.sessionId!==t||(!n||s.startedAt>n.startedAt)&&(n=s)}return n==null?void 0:n.explicitSubagentId}function gL(e,t,n,s,i){const a=n==="permission"?mL(e,t):void 0;return a?{kind:n,message:s,since:i,subagentId:a}:{kind:n,message:s,since:i}}function vL(e,t,n){if(e.kind!=="permission")return!0;const s=Qa(t);return s==null?!0:e.subagentId!=null&&yl(n,s)===e.subagentId}function Xb(e,t){const n=t.epoch??null;if(n!==null&&n!==e.seqEpoch)e.seqEpoch=n,e.lastSeq=0;else if(t.seq<=e.lastSeq)return e;const s=t.payload??{},i=t.receivedAt,a=s.hook_event_name??"Unknown";if(a==="__clear")return{...Py(),lastSeq:t.seq,seqEpoch:e.seqEpoch,revision:e.revision+1};e.totalEvents+=1,e.lastSeq=t.seq,e.revision+=1;const l=s.session_id??"unknown";if(!pL.has(a)){const f=e.agents.get(l);f!=null&&f.waiting&&vL(f.waiting,s,l)&&(f.waiting=null)}const u=e.agents.get(l);if(u&&i>(u.lastEventAt??0)&&(u.lastEventAt=i,u.reaped&&(u.reaped=!1,u.state="active",u.endedAt=void 0,u.closedAt=void 0)),typeof s.model_context_window=="number"&&s.model_context_window>0){const f=e.agents.get(l);f&&(f.contextWindow=s.model_context_window)}if(typeof s.approval_policy=="string"&&s.approval_policy){const f=e.agents.get(l);f&&(f.approvalPolicy=s.approval_policy)}if(typeof s.context_tokens=="number"&&s.context_tokens>=0){const f=e.agents.get(l);f&&(f.context={...f.context??Gb(),currentContextTokens:s.context_tokens})}if(a==="ModelObserved"){const f=typeof s.model=="string"?s.model:null;if(f){const y=e.agents.get(l);y&&(y.model=f)}const g=s.subagentModels;if(g&&typeof g=="object")for(const[y,w]of Object.entries(g)){if(typeof w!="string")continue;const N=`${l}::${y}`,b=e.agents.get(N);b&&(b.model=w)}return e}if(a==="ContextObserved"){const f=s.context??null;if(f){const g=e.agents.get(l);if(g){const y=g.context??Gb(),w=(b,_)=>typeof f[b]=="number"?f[b]:_,N=Array.isArray(f.memoryFiles)?f.memoryFiles:Array.isArray(f.claudeMdFiles)?f.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:N??y.memoryFiles}}}return e}if(a==="SessionNamed"){const f=e.agents.get(l);if(f){const g=typeof s.sessionName=="string"?s.sessionName.trim():"",y=typeof s.sessionTitle=="string"?s.sessionTitle.trim():"";g&&(f.sessionName=g),y&&(f.sessionTitle=y);const w=f.sessionName??"";f.sessionTitle&&w&&f.sessionTitle.toLowerCase()===w.toLowerCase()&&(f.sessionTitle=void 0)}return e}if(a==="UsageObserved"){const f=s.usage??null;if(f){const g=e.agents.get(l);if(g){g.usage.inputTokens=Number(f.input_tokens??0),g.usage.outputTokens=Number(f.output_tokens??0),g.usage.cacheReadTokens=Number(f.cache_read_input_tokens??f.cached_input_tokens??0),g.usage.cacheCreateTokens=Number(f.cache_creation_input_tokens??f.cache_write_input_tokens??0);const y=vw(f);g.usage.cacheCreate1hTokens=y.cacheCreate1hTokens,g.usage.cacheCreate5mTokens=y.cacheCreate5mTokens,typeof f.reasoning_output_tokens=="number"&&(g.usage.reasoningOutputTokens=Number(f.reasoning_output_tokens)),g.usageByModel=Q$(s.usageByModel)}}return e}const h=J$(e,s,i);h.provider||(h.provider=s.provider==="codex"?"codex":"claude");const p=ZC(s);switch(p&&(h.model=p),a){case"SessionStart":{const f=Ci(e,l,i,!1);f.synthetic=!1,f.state="active",f.closedAt=void 0,f.startedAt=f.startedAt||i,!f.cwd&&s.cwd&&(f.cwd=s.cwd,f.cwdBasename=Ms(s.cwd)),f.label==="session"&&s.cwd&&(f.label=Ms(s.cwd)??"session");break}case"UserPromptSubmit":{for(const y of e.agents.values())y.sessionId===l&&y.kind==="subagent"&&y.state==="done"&&y.exitAt==null&&y.endedAt!=null&&y.endedAt<i&&(y.exitAt=i);const f=Ci(e,l,i,!1);f.state="active",f.endedAt=void 0,f.closedAt=void 0,f.exitAt=void 0;const g=(typeof s.prompt=="string"?s.prompt:typeof s.message=="string"?s.message:"")??"";g&&!iL(f,i,g)&&(f.prompts.push({at:i,text:g}),f.firstPrompt||(f.firstPrompt=Yc(g,120)));break}case"PreToolUse":{const f=s.tool_use_id?oL(e,h,s.tool_use_id):null;if(f){s.tool_name&&f.name==="?"&&(f.name=s.tool_name),f.endedAt==null&&!f.trimmed&&s.tool_input!==void 0&&(f.input=s.tool_input,f.inputPreview=Yc(s.tool_input));break}const g=s.tool_use_id??`${h.id}:${h.toolCount}`,y=Qa(s),w={id:g,name:s.tool_name??"?",input:s.tool_input,inputPreview:Yc(s.tool_input),agentId:h.id,explicitSubagentId:y?yl(l,y):void 0,startedAt:i};h.tools.push(w),h.toolCount+=1,h.state="active",e.toolIndex.set(g,w),e.toolOwner.set(g,h.id),sL(e,h);break}case"PostToolUse":case"PostToolUseFailure":{const f=s.tool_use_id;if(!f)break;let g=e.toolIndex.get(f),y=!1;if(!g)for(const N of e.agents.values()){const b=N.tools.find(_=>_.id===f);if(b){g=b,y=!0;break}}if(!g||g.outcomeApplied)break;g.outcomeApplied=!0,g.outcomeGap=void 0,g.endedAt=i,g.ok=a==="PostToolUse",g.trimmed||(g.response=s.tool_response),a==="PostToolUseFailure"?g.errorPreview=Yc(s.tool_response):y&&(g.errorPreview=void 0);const w=QC(s.tool_response);w&&(g.usage=w),e.toolIndex.delete(f),e.toolOwner.delete(f);break}case"SubagentStart":{const f=Qa(s);if(!f)break;const g=eL(e,l,f,s,i);g.state="active",g.startedAt=g.startedAt||i,g.exitAt=void 0,g.endedAt=void 0;const y=wu(s);y&&(g.label=y),tL(e,l,f);break}case"SubagentStop":{const f=Qa(s);if(!f)break;const g=JC(e,l,f,s);if(!g)break;g.state="done",g.endedAt=i,nL(e,l,f);break}case"Stop":case"SessionEnd":{const f=Ci(e,l,i,!1);f.state="done",f.endedAt=i,a==="SessionEnd"&&(f.closedAt=i),e.activeSubagentStack.delete(l);break}case"Notification":{const f=hL(s.notification_type);if(!f)break;const g=Ci(e,l,i,!1),y=typeof s.message=="string"?s.message:"",w=g.waiting;g.waiting=w&&w.kind===f&&w.message===y?{...w,since:Math.min(w.since,i)}:gL(e,l,f,y,i);break}}return e}function yw(e){let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t^e.charCodeAt(n);return Math.abs(t)%360}const yL={input:2,output:10,cacheRead:.2,cacheWrite:2.5,cacheWrite1h:4},wL=[{match:/^claude[-_](fable|mythos)[-_]5[-_.]1\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:10,output:50,cacheRead:.25,cacheWrite:12.5,cacheWrite1h:20}},{match:/^claude[-_](fable|mythos)[-_]5\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:10,output:50,cacheRead:1,cacheWrite:12.5,cacheWrite1h:20}},{match:/^claude[-_]opus[-_]5\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:5,output:25,cacheRead:.5,cacheWrite:6.25,cacheWrite1h:10}},{match:/^claude[-_]sonnet[-_]5\b(?![-_.]\d{1,7}(?!\d))/i,rates:yL},{match:/^claude[-_]opus[-_]4[-_.](?:5|6|7|8)\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:5,output:25,cacheRead:.5,cacheWrite:6.25,cacheWrite1h:10}},{match:/^claude[-_]opus[-_]4(?:[-_.]1)?\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75,cacheWrite1h:30}},{match:/^claude[-_]sonnet[-_]4[-_.](?:5|6)\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:3,output:15,cacheRead:.3,cacheWrite:3.75,cacheWrite1h:6}},{match:/^claude[-_]sonnet[-_]4\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:3,output:15,cacheRead:.3,cacheWrite:3.75,cacheWrite1h:6}},{match:/^claude[-_]haiku[-_]4[-_.]5\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:1,output:5,cacheRead:.1,cacheWrite:1.25,cacheWrite1h:2}},{match:/^claude[-_]haiku[-_]3[-_.]5\b(?![-_.]\d{1,7}(?!\d))/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[-_]mini/i,rates:{input:1.1,output:4.4,cacheRead:.55,cacheWrite:0}},{match:/^o1\b/i,rates:{input:15,output:60,cacheRead:7.5,cacheWrite:0}},{match:/^o3[-_]deep[-_]research/i,rates:{input:10,output:40,cacheRead:2.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[-_]deep[-_]research/i,rates:{input:2,output:8,cacheRead:.5,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 xL(e){return e?/^(?:gpt[-_]|codex[-_]|o\d)/i.test(e):!1}function Hi(e,t=Date.now()){if(!e)return null;const n=vl(e);for(const s of wL)if(s.match.test(n))return typeof s.rates=="function"?s.rates(t):s.rates;return null}function tT(e,t){const n=Math.max(0,e.cacheCreate1hTokens??0),s=Math.max(0,e.cacheCreate5mTokens??0),i=Math.max(0,e.cacheCreateTokens-n-s),a=s+i,l=t.cacheWrite1h??t.cacheWrite;return{tokens5m:a,tokens1h:n,usd5m:a*t.cacheWrite/1e6,usd1h:n*l/1e6}}function nT(e,t,n=Date.now()){if(!xL(t))return e.inputTokens;const s=Hi(t,n),i=((s==null?void 0:s.cacheWrite)??0)>0?Math.max(0,e.cacheCreateTokens):0;return Math.max(0,e.inputTokens-e.cacheReadTokens-i)}function ww(e,t,n=Date.now()){const s=Hi(t,n);if(!s)return{input:0,output:0,cacheRead:0,cacheWrite:0,total:0};const i=nT(e,t,n)*s.input/1e6,a=e.outputTokens*s.output/1e6,l=e.cacheReadTokens*s.cacheRead/1e6,u=tT(e,s),h=u.usd5m+u.usd1h;return{input:i,output:a,cacheRead:l,cacheWrite:h,total:i+a+l+h}}const Qb=2e5,bL=1e6,_L=[/\[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],kL=[{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 SL(e){if(!e)return Qb;const t=vl(e);for(const n of _L)if(n.test(t))return bL;for(const n of kL)if(n.match.test(t))return n.window;return Qb}function rT(e,t){return typeof e=="number"&&e>0?e:SL(t)}const Ei="not priced";function We(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 xu(e,t){if(e<=0||t<10)return null;const n=e/t,s=n*60;return s>=.01?`${We(s)}/min`:`${We(n*3600)}/hr`}function NL(e,t){const n={inputTokens:e.inputTokens+t.inputTokens,outputTokens:e.outputTokens+t.outputTokens,cacheReadTokens:e.cacheReadTokens+t.cacheReadTokens,cacheCreateTokens:e.cacheCreateTokens+t.cacheCreateTokens};return(e.cacheCreate1hTokens!==void 0||e.cacheCreate5mTokens!==void 0||t.cacheCreate1hTokens!==void 0||t.cacheCreate5mTokens!==void 0)&&(n.cacheCreate1hTokens=(e.cacheCreate1hTokens??0)+(t.cacheCreate1hTokens??0),n.cacheCreate5mTokens=(e.cacheCreate5mTokens??0)+(t.cacheCreate5mTokens??0)),(e.reasoningOutputTokens!==void 0||t.reasoningOutputTokens!==void 0)&&(n.reasoningOutputTokens=(e.reasoningOutputTokens??0)+(t.reasoningOutputTokens??0)),n}function EL(e,t){let n=0,s=0,i=0,a=0,l=0,u=0;for(const g of t)n+=g.inputTokens,s+=g.outputTokens,i+=g.cacheReadTokens,a+=g.cacheCreateTokens,l+=g.cacheCreate1hTokens??0,u+=g.cacheCreate5mTokens??0;const h=(g,y)=>Math.max(0,g-y),p={inputTokens:h(e.inputTokens,n),outputTokens:h(e.outputTokens,s),cacheReadTokens:h(e.cacheReadTokens,i),cacheCreateTokens:h(e.cacheCreateTokens,a)};return(e.cacheCreate1hTokens!==void 0||e.cacheCreate5mTokens!==void 0)&&(p.cacheCreate1hTokens=h(e.cacheCreate1hTokens??0,l),p.cacheCreate5mTokens=h(e.cacheCreate5mTokens??0,u)),p.inputTokens+p.outputTokens+p.cacheReadTokens+p.cacheCreateTokens>0?p:null}function xl(e){const t=e.usageByModel,n=t?Object.keys(t):[];if(!t||n.length===0)return[{model:e.model,usage:e.usage}];const s=n.map(a=>({model:a,usage:t[a]})),i=EL(e.usage,s.map(a=>a.usage));if(i){const a=s.findIndex(l=>l.model===e.model);a>=0?s[a]={model:s[a].model,usage:NL(s[a].usage,i)}:s.push({model:e.model,usage:i})}return s}function _n(e,t=Date.now()){const n={input:0,output:0,cacheRead:0,cacheWrite:0,total:0};for(const s of xl(e)){const i=ww(s.usage,s.model,t);n.input+=i.input,n.output+=i.output,n.cacheRead+=i.cacheRead,n.cacheWrite+=i.cacheWrite,n.total+=i.total}return n}function $y(e,t=Date.now()){let n=0;for(const s of xl(e))Hi(s.model,t)==null&&(n+=s.usage.inputTokens+s.usage.outputTokens);return n}function sT(e){const t=[];for(const n of xl(e)){if(!n.model||t.includes(n.model))continue;const s=n.usage;s.inputTokens+s.outputTokens+s.cacheReadTokens+s.cacheCreateTokens<=0||t.push(n.model)}return t}function oT(e){return sT(e).filter(t=>t!==e.model)}const jL=new Set(["untrusted","on-request","on-failure"]);function CL(e){return typeof e!="string"||!e?null:jL.has(e)?!0:e==="never"?!1:null}function TL(e){if(e.provider!=="codex"||e.kind!=="root"||e.waiting||e.state!=="active")return null;const t=CL(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 Zb(e){return e[0].toUpperCase()+e.slice(1).toLowerCase()}function Is(e){const t=vl(e).replace(/[-_]\d{8}(?!\d)/,""),n=t.match(/^claude[-_](opus|sonnet|haiku|fable|mythos)[-_](\d+(?:[-_.]\d+)*)/i);if(n){const i=Zb(n[1]),a=n[2].replace(/[-_]/g,".");return`${i} ${a}`}const s=t.match(/^gpt[-_](\d+(?:[-_.]\d+)*)((?:[-_][A-Za-z0-9.]+)*)$/i);if(s){const i=s[1].replace(/[-_]/g,"."),a=s[2].split(/[-_]/).filter(Boolean).map(Zb);return[`GPT-${i}`,...a].join(" ")}return e}function Ou(e){const t=vl(e??""),n=t.match(/^claude[-_](opus|sonnet|haiku|fable|mythos)[-_]/i);return n?n[1].toLowerCase():/^gpt[-_]/i.test(t)?"gpt":""}function Ct(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 bu(e,t,n){const s=(t??n)-e;if(s<1e3)return`${Math.max(0,s)}ms`;const i=Math.floor(s/1e3);if(i<60)return`${i}s`;const a=Math.floor(i/60),l=i%60;return`${a}m ${String(l).padStart(2,"0")}s`}function iT(e,t){if(e.endedAt==null)return t;const n=e.endedAt-e.startedAt;return n<1e3?`${n}ms`:`${(n/1e3).toFixed(2)}s`}function aT(e,t){const n=typeof e=="string"?e.trim():"",s=typeof t=="string"?t.trim():"";return{face:n||s||void 0,tooltip:s||n||void 0}}const RL=1,lT=-1;function AL(){const e=[];let t=0;function n(){let s;for(const i of e)(!s||i.layer>s.layer||i.layer===s.layer&&i.seq>s.seq)&&(s=i);return s}return{push(s,i=0){const a={dismiss:s,layer:i,seq:t++};return e.push(a),()=>{const l=e.indexOf(a);l!==-1&&e.splice(l,1)}},dismissTop(){const s=n();return s?(s.dismiss(),!0):!1},isTop(s){const i=n();return i!=null&&i.dismiss===s},depth(){return e.length},topIsPanel(){const s=n();return s!=null&&s.layer===lT}}}const Ii=AL();function ML(e){return e.overlayOpen&&!e.panelOnTop?"dismiss":e.typing?"blur":e.overlayOpen?"dismiss":"clear-selection"}function Jb(e){return String(e.tagName??"").toUpperCase()==="BODY"}function IL(e,t){return!e||!e.isConnected||Jb(e)?!1:t==null||Jb(t)}const e1="a[href], button, input, select, textarea, [tabindex]";function OL(e){return!e||e.disabled||e.rendered===!1?!1:(e.tabIndex??0)>=0}function PL(e){if(!e||!e.overflowing||e.hasFocusable)return!1;const t=String(e.overflow??"").toLowerCase();return t==="auto"||t==="scroll"}function $L({count:e,index:t,shiftKey:n}){return e<=0?{kind:"hold"}:t<0||t>=e?{kind:"focus",index:n?e-1:0}:!n&&t===e-1?{kind:"focus",index:0}:n&&t===0?{kind:"focus",index:e-1}:{kind:"allow"}}function xw(e){return e.ctrlKey||e.metaKey||e.altKey}const LL=new Set(["button","checkbox","color","file","image","radio","range","reset","submit"]),qL=new Set(["INPUT","TEXTAREA","SELECT","OPTION","BUTTON","SUMMARY","A"]),DL=new Set(["button","checkbox","combobox","link","listbox","menu","menubar","menuitem","menuitemcheckbox","menuitemradio","option","radio","searchbox","slider","spinbutton","switch","tab","textbox","treeitem"]);function cT(e){return typeof e.tagName=="string"?e.tagName.toUpperCase():""}function bw(e){if(!e)return!1;if(e.isContentEditable)return!0;const t=cT(e);return t==="TEXTAREA"?!0:t!=="INPUT"?!1:!LL.has(String(e.type??"text").toLowerCase())}function FL(e){if(!e)return!1;if(bw(e)||qL.has(cT(e)))return!0;const t=typeof e.role=="string"?e.role.trim().toLowerCase():"";return t!==""&&t.split(/\s+/).some(n=>DL.has(n))}function zL({key:e,modalOpen:t,sheetOpen:n}){return t?!(e==="?"&&n):!1}function uT(e){return e?Array.from(e.querySelectorAll("*")).filter(t=>{if(t.matches(e1))return OL({disabled:t.disabled,tabIndex:t.tabIndex,rendered:t.getClientRects().length>0});const n=t.scrollHeight>t.clientHeight;return n&&PL({overflowing:n,overflow:getComputedStyle(t).overflowY,hasFocusable:t.querySelector(e1)!=null})}):[]}function BL(e,t){const n=uT(e);if(!t||!e.contains(t)||n.includes(t))return n;const s=n.findIndex(i=>(t.compareDocumentPosition(i)&Node.DOCUMENT_POSITION_FOLLOWING)!==0);return s===-1?[...n,t]:[...n.slice(0,s),t,...n.slice(s)]}function Sn(e,t={}){const{focusRef:n,layer:s}=t,i=S.useRef(null),a=S.useRef(e);a.current=e;const l=S.useRef(null);l.current===null&&(l.current=()=>a.current());const u=l.current;return S.useEffect(()=>Ii.push(u,s),[u,s]),S.useEffect(()=>{var p;const h=document.activeElement;return(p=(n==null?void 0:n.current)??uT(i.current)[0])==null||p.focus(),()=>{IL(h,document.activeElement)&&h.focus()}},[]),S.useEffect(()=>{const h=p=>{var b;if(p.key!=="Tab"||xw(p))return;const f=i.current;if(!f)return;const g=document.activeElement;if(!(g!=null&&f.contains(g))&&!Ii.isTop(u))return;const w=BL(f,g),N=$L({count:w.length,index:g?w.indexOf(g):-1,shiftKey:p.shiftKey});N.kind!=="allow"&&(p.preventDefault(),N.kind==="focus"&&((b=w[N.index])==null||b.focus()))};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[u]),i}function UL(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 $n(e){return e.toLocaleString()}function WL(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(2)} MB`}const HL=60;function GL(e,t=HL){if(e.length<=t)return e;const n=e.slice(e.length-(t-1)),s=n.search(/[/\\]/);return"…"+(s===-1?n:n.slice(s))}function VL({agent:e,onClose:t}){var y;const n=S.useRef(null),s=Sn(t,{focusRef:n}),i=e.context,a=e.usage,l=(i==null?void 0:i.currentContextTokens)??0,u=rT(e.contextWindow,e.model),h=Math.min(100,l/u*100),p=_n(e),f=a.inputTokens+a.cacheReadTokens+a.cacheCreateTokens,g=UL(e.provider);return d.jsx("div",{className:"ctx-modal-backdrop",onClick:t,role:"presentation",children:d.jsxs("div",{ref:s,className:"ctx-modal",onClick:w=>w.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Context breakdown",children:[d.jsxs("header",{className:"ctx-modal-head",children:[d.jsxs("div",{children:[d.jsxs("div",{className:"ctx-modal-title",children:["Context · ",e.label]}),d.jsx("div",{className:"ctx-modal-sub",children:g.subtitle})]}),d.jsx("button",{type:"button",ref:n,className:"glyph-btn ctx-modal-close",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),d.jsxs("section",{className:"ctx-window-row",children:[d.jsx("div",{className:"ctx-window-bar",role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(h),children:d.jsx("div",{className:"ctx-window-fill",style:{width:`${h}%`}})}),d.jsxs("div",{className:"ctx-window-meta",children:[d.jsxs("span",{className:"ctx-window-pct",children:[h.toFixed(1),"%"]}),d.jsxs("span",{children:[$n(l)," / ",$n(u)," tok (",g.windowScope,")"]})]})]}),d.jsx("h3",{className:"ctx-section-title",children:"Cumulative usage · whole session"}),d.jsxs("div",{className:"ctx-grid",children:[d.jsx(rr,{label:"input tokens",val:$n(a.inputTokens)}),d.jsx(rr,{label:"output tokens",val:$n(a.outputTokens)}),d.jsx(rr,{label:"cache reads",val:$n(a.cacheReadTokens)}),d.jsx(rr,{label:"cache writes",val:$n(a.cacheCreateTokens)}),d.jsx(rr,{label:"cumulative total",val:$n(f)}),d.jsx(rr,{label:"estimated cost",val:We(p.total),accent:!0})]}),d.jsx("h3",{className:"ctx-section-title",children:"Transcript composition"}),g.compositionCounted?d.jsxs("div",{className:"ctx-grid",children:[d.jsx(rr,{label:"user messages",val:$n((i==null?void 0:i.msgsUser)??0)}),d.jsx(rr,{label:"assistant messages",val:$n((i==null?void 0:i.msgsAssistant)??0)}),d.jsx(rr,{label:"tool uses",val:$n((i==null?void 0:i.toolUses)??0)}),d.jsx(rr,{label:"tool results",val:$n((i==null?void 0:i.toolResults)??0)}),d.jsx(rr,{label:"system-reminders",val:$n((i==null?void 0:i.systemReminders)??0)})]}):d.jsx("div",{className:"ctx-empty",children:g.compositionUncounted}),d.jsx("h3",{className:"ctx-section-title",children:g.memoryHeading}),(((y=i==null?void 0:i.memoryFiles)==null?void 0:y.length)??0)===0?d.jsx("div",{className:"ctx-empty",children:g.memoryEmpty}):d.jsx("ul",{className:"ctx-md-list",children:i.memoryFiles.map(w=>d.jsxs("li",{children:[d.jsx("span",{className:"ctx-md-path",title:w.path,children:GL(w.path)}),d.jsx("span",{className:"ctx-md-size",children:WL(w.bytes)})]},w.path))})]})})}function rr({label:e,val:t,accent:n}){return d.jsxs("div",{className:`ctx-row${n?" accent":""}`,children:[d.jsx("span",{className:"ctx-row-label",children:e}),d.jsx("span",{className:"ctx-row-val",children:t})]})}function YL({currentContextTokens:e,modelId:t,contextWindow:n,size:s=26,onClick:i}){const a=rT(n,t),l=Math.min(1,e/a),u=s/2-3,h=s/2,p=2*Math.PI*u,f=p*l,g=l>.9?"var(--err)":l>.7?"var(--inflight)":"var(--accent)";return d.jsx("button",{type:"button",className:"ctx-donut",onClick:i,title:`context: ${e.toLocaleString()} / ${a.toLocaleString()} (${(l*100).toFixed(1)}%)`,"aria-label":"Show context breakdown",children:d.jsxs("svg",{width:s,height:s,viewBox:`0 0 ${s} ${s}`,children:[d.jsx("circle",{cx:h,cy:h,r:u,stroke:"var(--line)",strokeWidth:"2.5",fill:"none"}),d.jsx("circle",{cx:h,cy:h,r:u,stroke:g,strokeWidth:"2.5",fill:"none",strokeDasharray:`${f} ${p-f}`,strokeDashoffset:p/4,strokeLinecap:"round",style:{transition:"var(--ctx-arc-transition)"}}),d.jsx("text",{x:h,y:h+3,textAnchor:"middle",fontSize:"8",fill:"var(--text)",fontWeight:"600",children:Math.round(l*100)})]})})}function t1(e,t){const n=Hi(t);if(!n)return`model: ${t}
|
|
60
|
+
no published rate in this build — the tokens are counted, the dollars are not`;const s=f=>f.toLocaleString(),i=f=>`$${f}/MTok`,a=ww(e,t),l=tT(e,n),u=l.tokens1h>0?[`cache w5m${s(l.tokens5m).padStart(14)} × ${i(n.cacheWrite).padEnd(11)} = ${We(l.usd5m)}`,`cache w1h${s(l.tokens1h).padStart(14)} × ${i(n.cacheWrite1h??n.cacheWrite).padEnd(11)} = ${We(l.usd1h)}`]:[`cache w ${s(l.tokens5m).padStart(14)} × ${i(n.cacheWrite).padEnd(11)} = ${We(l.usd5m)}`],h=nT(e,t),p=h===e.inputTokens?"input":"uncached";return[`model: ${t}`,`${p.padEnd(9)}${s(h).padStart(14)} × ${i(n.input).padEnd(11)} = ${We(a.input)}`,`output ${s(e.outputTokens).padStart(14)} × ${i(n.output).padEnd(11)} = ${We(a.output)}`,`cache r ${s(e.cacheReadTokens).padStart(14)} × ${i(n.cacheRead).padEnd(11)} = ${We(a.cacheRead)}`,...u,"─────────────────────────────────────────",`total = ${We(a.total)}`].join(`
|
|
61
|
+
`)}function n1(e){const t=xl(e);return t.length<=1?t1(e.usage,e.model):[...t.map(n=>t1(n.usage,n.model)),"═════════════════════════════════════════",`all models = ${We(_n(e).total)}`].join(`
|
|
62
|
+
`)}function KL({data:e,selected:t}){var y;const n=e.now??Date.now(),s=["agent-node",`state-${e.state}`,e.synthetic?"synthetic":"",t?"selected":""].filter(Boolean).join(" "),i=e.tools.filter(w=>!w.endedAt).length,a=yw(e.sessionId),l=((y=e.context)==null?void 0:y.currentContextTokens)??0,u=e.kind==="root"&&l>0,h=e.sessionTitle?e.cwd?`${e.cwd}
|
|
63
|
+
${e.sessionTitle}`:e.sessionTitle:e.cwd,p=oT(e),f=p.length>0?`${e.model}
|
|
64
|
+
spend on this card also covers:
|
|
65
|
+
${p.join(`
|
|
66
|
+
`)}`:e.model,g=aT(e.sessionName,e.sessionTitle);return d.jsxs("div",{className:s,style:{"--session-hue":a},children:[d.jsx("span",{className:"accent-stripe"}),d.jsx(Di,{type:"target",position:Pe.Left,style:{background:"transparent",border:"none"}}),d.jsxs("div",{className:"head",children:[d.jsxs("div",{className:"title",children:[d.jsx(XL,{state:e.state}),d.jsx("span",{className:"label",title:h,children:e.label}),e.synthetic&&d.jsx("span",{className:"synth-tag",title:"No SessionStart captured — synthesised",children:"?"})]}),d.jsxs("div",{className:"head-right",children:[u&&e.onOpenContext&&d.jsx(YL,{currentContextTokens:l,modelId:e.model,contextWindow:e.contextWindow,onClick:()=>e.onOpenContext(e.sessionId)}),d.jsx("div",{className:"time",title:`Started ${new Date(e.startedAt).toLocaleTimeString()}`,children:bu(e.startedAt,e.endedAt,n)})]})]}),d.jsxs("div",{className:"sub",children:[e.kind==="root"?"session":"subagent",e.childCount>0&&d.jsxs("span",{className:"spawn-badge",title:`${e.childCount} subagents spawned`,children:["→ ",e.childCount]}),e.cwdBasename&&e.kind==="subagent"?` · ${e.cwdBasename}`:"",e.model?d.jsxs("span",{className:"model-chip","data-family":Ou(e.model),title:f,children:[Is(e.model),p.length>0?` +${p.length}`:""]}):e.provider==="codex"?d.jsx("span",{className:"model-chip",title:"OpenAI Codex — no model reported yet",children:"Codex"}):null]}),e.kind==="root"&&g.face&&d.jsx("div",{className:"session-name",title:g.tooltip,children:g.face}),e.waiting&&d.jsx(ZL,{waiting:e.waiting,now:n}),(()=>{const w=TL(e);return w?d.jsxs("div",{className:"approval-blind-row",title:w.detail,children:[d.jsx("span",{className:"approval-blind-dot","aria-hidden":!0}),d.jsx("span",{className:"approval-blind-said",children:w.label})]}):null})(),e.tools.length>0&&d.jsx(JL,{tools:e.tools,now:n}),d.jsxs("div",{className:"meta",children:[d.jsxs("span",{children:[d.jsx("b",{children:e.toolCount})," tools"]}),i>0&&d.jsxs("span",{className:"inflight-meta",children:[d.jsx("b",{children:i})," in-flight"]}),e.usage.inputTokens+e.usage.outputTokens>0&&d.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:[d.jsx("b",{children:Ct(e.usage.inputTokens+e.usage.outputTokens)})," tok"]}),e.model&&(()=>{const w=Hi(e.model),N=_n(e),b=$y(e);if(!w&&N.total<=0)return e.usage.inputTokens+e.usage.outputTokens<=0?null:d.jsx("span",{className:"cost-unpriced",title:n1(e),children:Ei});if(N.total<=0)return null;const _=Math.max(0,((e.endedAt??n)-e.startedAt)/1e3),k=e.state==="active"?xu(N.total,_):null,E=n1(e)+(k?`
|
|
67
|
+
burn: ${k}`:"");return d.jsxs("span",{className:"cost-meta",title:E,children:[d.jsxs("b",{children:[We(N.total),b>0?"+":""]}),k&&d.jsx("span",{className:"cost-rate",children:k})]})})()]}),d.jsx(Di,{type:"source",position:Pe.Right,style:{background:"transparent",border:"none"}})]})}function _u(e){return e==="active"?"live":e==="done"?"done":"err"}function XL({state:e}){return d.jsx("span",{className:`state-pill state-${e}`,children:_u(e)})}function Pu(e){return e.message?e.message:e.kind==="permission"?"Needs your permission":"Waiting for your input"}function QL(e){return e.kind==="permission"?Pu(e):"Your turn"}function ZL({waiting:e,now:t}){const n=e.kind==="permission",s=Pu(e);return d.jsxs("div",{className:n?"waiting-row permission":"waiting-row idle",title:`${s}
|
|
68
|
+
Blocked for ${bu(e.since,void 0,t)} — the answer goes in the terminal, not here.`,children:[n?d.jsx("span",{className:"ap-pulse","aria-hidden":!0}):d.jsx("span",{className:"waiting-dot","aria-hidden":!0}),d.jsx("span",{className:"waiting-said",children:QL(e)}),d.jsx("b",{children:bu(e.since,void 0,t)})]})}function JL({tools:e,now:t}){const a=new Array(24).fill(0);let l=0;for(const N of e){const b=t-N.startedAt;if(b<0||b>=6e4)continue;const _=23-Math.floor(b/2500);_>=0&&_<24&&(a[_]+=1,l+=1)}const u=Math.max(1,...a),h=Math.max(0,...a),p=132,f=14,g=p/24,y=h/(2500/1e3),w=l===0?"no tool calls in the last 60s":`${l} tool calls in last 60s · peak ${y.toFixed(1)}/s`;return d.jsxs("div",{className:"tool-spark-row",title:w,children:[d.jsx("svg",{className:"tool-spark",width:p,height:f,viewBox:`0 0 ${p} ${f}`,"aria-hidden":!0,children:a.map((N,b)=>{const _=N===0?1.5:Math.max(1.5,N/u*f),k=b===23&&N>0,j=`tool-spark-bar${N>0?" active":""}${k?" latest":""}`;return d.jsx("rect",{x:b*g+.4,y:f-_,width:Math.max(.5,g-1),height:_,rx:.8,className:j},b)})}),d.jsx("span",{className:"tool-spark-label",children:"60s"})]})}function r1(e){if(e==null)return"(none)";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function e3({tool:e,onClose:t}){const n=Sn(t),s=e.endedAt==null?"inflight":e.ok===!1?"err":"done";return d.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:d.jsxs("div",{ref:n,className:"modal",onClick:i=>i.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"tool-modal-title",children:[d.jsxs("header",{className:"modal-head",children:[d.jsxs("div",{className:"modal-title",children:[d.jsx("span",{className:`status-dot ${s}`,"aria-hidden":!0}),d.jsx("span",{id:"tool-modal-title",className:"modal-tool-name",children:e.name}),d.jsxs("span",{className:"modal-tool-id",title:e.id,children:[e.id.slice(0,12),"…"]})]}),d.jsxs("div",{className:"modal-actions",children:[d.jsx("span",{className:"modal-dur",children:iT(e,"in-flight…")}),d.jsx("button",{className:"glyph-btn",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),d.jsxs("section",{className:"modal-body",children:[e.trimmed&&d.jsx("div",{className:"modal-section",children:d.jsx("p",{className:"modal-note",children:"Full payloads for this call were released to keep memory bounded — only the previews below are still held."})}),d.jsxs("div",{className:"modal-section",children:[d.jsx("h4",{children:"Input"}),d.jsx("pre",{children:r1(e.input??e.inputPreview)})]}),d.jsxs("div",{className:"modal-section",children:[d.jsxs("h4",{children:["Response ",s==="err"&&d.jsx("span",{className:"err-tag",children:"error"})]}),d.jsx("pre",{children:e.endedAt==null?"(waiting…)":r1(e.response??e.errorPreview)})]})]})]})})}const Kc=18,s1=26,t3=12;function n3(e){return r3(e.nodeInternals.values())}function r3(e){const t=new Map;for(const i of e){if(i.type!=="agent")continue;const a=i.data;if(!(a!=null&&a.sessionId)||a.exitAt!=null||i.width==null||i.height==null)continue;const l=i.position.x,u=i.position.y,h=l+i.width,p=u+i.height,f=t.get(a.sessionId);f?(f.minX=Math.min(f.minX,l),f.minY=Math.min(f.minY,u),f.maxX=Math.max(f.maxX,h),f.maxY=Math.max(f.maxY,p),a.kind==="root"&&(f.label=i1(a)??f.label),a.kind==="root"&&(f.name=a1(a))):t.set(a.sessionId,{minX:l,minY:u,maxX:h,maxY:p,label:i1(a)??a.sessionId,name:a1(a)})}const n=new Map;for(const i of t.values())n.set(i.label,(n.get(i.label)??0)+1);const s=[];for(const[i,a]of t){const l=(n.get(a.label)??0)>1;s.push({sessionId:i,...a3(a.label,a.name,i,l),x:a.minX-Kc,y:a.minY-Kc-s1,w:a.maxX-a.minX+Kc*2,h:a.maxY-a.minY+Kc*2+s1})}return s}const Ly=" · ",s3=32,o3=/[\u1100-\u115F\u2E80-\u303E\u3041-\u33FF\u3400-\u4DBF\u4E00-\u9FFF\uA000-\uA4CF\uAC00-\uD7A3\uF900-\uFAFF\uFE30-\uFE6F\uFF00-\uFF60\uFFE0-\uFFE6]/;function o1(e){return o3.test(e)?2:1}function i3(e,t=s3){const n=[...e];let s=0;for(const l of n)s+=o1(l);if(s<=t)return e;const i=[];let a=0;for(const l of n){const u=o1(l);if(a+u>t-1)break;i.push(l),a+=u}for(;i.length&&/[\s\-_.:/]/.test(i[i.length-1]);)i.pop();return`${i.join("")}…`}function a3(e,t,n,s){const i=(t==null?void 0:t.trim())??"",a=s?l3(n):void 0,l=[e,i||void 0,a].filter(Boolean);return{label:e,name:i?i3(i):void 0,shortId:a,fullLabel:l.join(Ly)}}function l3(e){const t=e.match(/[a-zA-Z0-9]{4}/);return t?t[0]:e.slice(0,4)}function i1(e){if(e.kind==="root")return e.label}function a1(e){if(e.kind==="root")return aT(e.sessionName,e.sessionTitle).face}function c3(){const{x:e,y:t,zoom:n}=HC(),s=gl(),i=st(n3,u3);if(i.length<=1)return null;const a=u=>{try{const h=s.getNodes().filter(p=>{const f=p.data;return(f==null?void 0:f.sessionId)===u});if(h.length===0)return;s.fitView({padding:.3,duration:500,nodes:h})}catch{}},l={transform:`translate(${e}px, ${t}px) scale(${n})`};return d.jsx("div",{className:"session-clusters",style:l,children:i.map(u=>{const h=yw(u.sessionId),p={position:"absolute",left:u.x,top:u.y,width:u.w,height:u.h,"--session-hue":h},f={position:"absolute",left:u.x+16,top:u.y-t3,transform:`scale(${Math.min(1,n)/(n||1)})`,transformOrigin:"left top","--session-hue":h};return d.jsxs(de.Fragment,{children:[d.jsx("div",{className:"cluster-card",style:p,"aria-hidden":!0}),d.jsxs("button",{type:"button",className:"cluster-label",style:f,title:`Fit view to ${u.fullLabel}
|
|
69
|
+
drag the wrapper to move the whole session`,onClick:()=>a(u.sessionId),children:[u.label,u.name?d.jsxs(d.Fragment,{children:[Ly,d.jsx("span",{className:"cluster-label-name",children:u.name})]}):null,u.shortId?Ly+u.shortId:null]})]},u.sessionId)})})}function u3(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){const s=e[n],i=t[n];if(s.sessionId!==i.sessionId||s.label!==i.label||s.name!==i.name||s.shortId!==i.shortId||s.fullLabel!==i.fullLabel||s.x!==i.x||s.y!==i.y||s.w!==i.w||s.h!==i.h)return!1}return!0}function d3({data:e}){return d.jsx("div",{className:"session-group-handle",style:{width:(e==null?void 0:e.w)??0,height:(e==null?void 0:e.h)??0}})}const bl={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"}},f3=Object.fromEntries(Object.entries(bl).map(([e,t])=>[e,t.category])),h3=Object.fromEntries(Object.entries(bl).map(([e,t])=>[e,t.emoji])),p3=Object.fromEntries(Object.entries(bl).map(([e,t])=>[e,t.label])),m3=new Set(Object.keys(bl)),g3=new Set(Object.entries(bl).filter(([,e])=>e.shell).map(([e])=>e)),l1={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",...f3};function dT(e){return e.startsWith("mcp__")?"mcp":Object.hasOwn(l1,e)?l1[e]:"other"}const v3=/\btools\.exec_command\s*\(\s*\{[^{}]*?\bcmd\s*:\s*(["'`])((?:\\.|(?!\1)[^\\])*)\1/,y3=/\btools\.([A-Za-z_$][\w$]*)\s*\(/;function w3(e){if(typeof e!="string"||!e)return null;const t=v3.exec(e);if(t){const s=x3(t[2]);if(s.trim())return s}const n=y3.exec(e);return n?n[1]:null}function x3(e){return e.replace(/\\(["'`\\nrt])/g,(t,n)=>n==="n"?`
|
|
70
|
+
`:n==="r"?"\r":n==="t"?" ":n)}const fT=600,b3=4,_3=36,qy=16,k3=60,S3=6,c1=220,u1=96,N3=28,d1={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:"📡",...h3};function f1(e){return e.startsWith("mcp__")?"🔌":Object.hasOwn(d1,e)?d1[e]:"✨"}const h1={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 hT(e){if(!e)return null;let t=e.trim();if(!t)return null;const n=t.match(/^(?:bash|sh|zsh|fish|powershell|pwsh)(?:\.exe)?\s+(?:-c|-Command|-NoProfile|-NonInteractive|\s)+["']([^"']+)["']/i);if(n)return hT(n[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 s=t.match(/^([^\s|;&<>(]+)/);if(!s)return null;let i=s[1];return i=i.replace(/^.*[/\\]/,""),i=i.replace(/\.(exe|cmd|bat|ps1)$/i,""),i||null}function E3(e){if(typeof e=="string")return e;if(!e||typeof e!="object")return null;const t=e;if(typeof t.script=="string"){const n=w3(t.script);if(n)return n}if(typeof t.cmd=="string")return t.cmd;if(typeof t.command=="string")return t.command;if(Array.isArray(t.command)&&t.command.every(n=>typeof n=="string")){const n=t.command;if(/powershell|cmd|bash|sh(\.exe)?$/i.test(n[0]??"")){const s=n.findIndex(i=>/^(-Command|-c)$/i.test(i));if(s>=0&&s+1<n.length)return n[s+1]}return n.join(" ")}return typeof t.script=="string"?t.script:null}const j3=new Set(["Bash","PowerShell",...g3]),C3=m3;function T3(e,t){return C3.has(e)||e.startsWith("mcp__")?Math.max(u1,34+t.length*7.5):u1}function R3(e,t){if(!j3.has(e))return null;const n=E3(t);if(!n)return null;const s=hT(n);return s?{emoji:Object.hasOwn(h1,s)?h1[s]:"⚙️",label:s,category:"shell",detail:n}:null}const A3=new Set(["Read","Write","Edit","MultiEdit","NotebookEdit","LS","Glob","apply_patch"]),p1={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:"🗄️"},m1={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 M3(e){const n=e.replace(/\\/g,"/").replace(/\/+$/,""),s=n.lastIndexOf("/");return s>=0?n.slice(s+1):n}function I3(e){const t=e.toLowerCase();if(Object.hasOwn(m1,t))return m1[t];if(t.startsWith("dockerfile."))return"🐳";if(/\.(test|spec)\.[a-z]+$/.test(t))return"🧪";const n=t.lastIndexOf(".");if(n>0&&n<t.length-1){const s=t.slice(n+1);if(Object.hasOwn(p1,s))return p1[s]}return"📄"}function O3(e,t){if(!t||typeof t!="object")return null;const n=t;if(e==="apply_patch"&&typeof n.patch=="string"){const s=n.patch.match(/^\*\*\* (?:Update|Add|Delete) File: (.+)$/m);return s?s[1].trim():null}return typeof n.file_path=="string"?n.file_path:typeof n.notebook_path=="string"?n.notebook_path:typeof n.path=="string"?n.path:e==="Glob"&&typeof n.pattern=="string"?n.pattern:null}function P3(e,t){if(!A3.has(e))return null;const n=O3(e,t);if(!n)return null;const s=M3(n);return s?{emoji:e==="LS"?"📂":I3(s),label:s,category:"file",detail:n}:null}const g1={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 _w(e){if(!e.startsWith("mcp__"))return null;const t=e.slice(5),n=t.indexOf("__");return n<=0?{server:t,method:""}:{server:t.slice(0,n),method:t.slice(n+2)}}function $3(e){let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t^e.charCodeAt(n);return Math.abs(t)%360}function pT(e){const t=e.toLowerCase();return Object.hasOwn(g1,t)?g1[t]:void 0}function L3(e,t){const n=_w(e);if(!n)return null;const{server:s,method:i}=n;if(!i)return null;const a=pT(s);return{emoji:(a==null?void 0:a.emoji)??"🔌",label:i,category:"mcp",detail:a?`${a.name} · ${i}`:`${s} · ${i}`}}function q3(e,t){return R3(e,t)??P3(e,t)??L3(e)}const v1=p3;function mT(e){const t=_w(e);if(t){const s=pT(t.server);return s?{emoji:s.emoji,label:s.name}:{emoji:"🔌",label:t.server,hue:$3(t.server)}}const n=Object.hasOwn(v1,e)?v1[e]:"";return n?{emoji:f1(e),label:n}:{emoji:f1(e),label:e}}function D3(e){let t=null,n="";for(const s of e){const i=_w(s);if(i){if(!i.server)return null;if(t===null)t=i.server,n=s;else if(i.server!==t)return null}}return t===null?null:mT(n)}function F3(e){return e.endedAt==null?"inflight":e.ok===!1?"err":"done"}function z3(e,t){if(t==null)return 1;const n=e-t;return n<0?1:Math.max(0,1-n/fT)}function B3(e,t){const n=[],s=new Set;for(let i=e.length-1;i>=0&&n.length<t;i--){const a=e[i];s.has(a.id)||(s.add(a.id),n.push(a))}return n.reverse()}function U3(e,t,n,s,i,a){const l=[];for(const u of e.values()){if(!t.has(u.id)||u.exitAt!=null&&a-u.exitAt>fT)continue;const h=s.get(u.id)??n.get(u.id);if(!h)continue;const p=B3(u.tools,b3);if(p.length===0)continue;const f=u.exitAt??null,g=i.get(u.id),y=Math.max((g==null?void 0:g.width)??c1,c1),w=(g==null?void 0:g.height)??130,N=h.x,b=h.y,_=N+y,k=b+w/2;p.forEach((E,j)=>{const C=j*_3,I=N+y+k3,P=b+S3+C,O=z3(a,f),F=E.inputPreview??"",M=F3(E),A=O<.999,q=mT(E.name);l.push({id:`${u.id}::${E.id}`,toolId:E.id,agentId:u.id,toolName:E.name,name:q.label,emoji:q.emoji,status:M,category:dT(E.name),mcpHue:q.hue,inputPreview:F,fade:O,fading:A,worldX:I,worldY:P,anchorX:_,anchorY:k,spawnDx:_-I,spawnDy:k-(P+qy)});const W=q3(E.name,E.input);if(W){const Y=T3(E.name,q.label),T=I+Y+N3,Z=P,U=I+Y,ne=P+qy;l.push({id:`sub:${u.id}::${E.id}`,toolId:E.id,agentId:u.id,toolName:E.name,name:W.label,emoji:W.emoji,isSub:!0,status:M,category:W.category,inputPreview:W.detail??F,fade:O,fading:A,worldX:T,worldY:Z,anchorX:U,anchorY:ne,spawnDx:U-T,spawnDy:0})}})}return l}function W3({agents:e,visibleAgentIds:t,positions:n,pinned:s,measured:i,spotlight:a,hiddenCategories:l,now:u,onOpenTool:h}){const p=U3(e,t,n,s,i,u),f=l&&l.size>0?p.filter(g=>!l.has(g.category)):p;return d.jsx(H3,{bursts:f,spotlight:a,onOpenTool:h})}function H3({bursts:e,spotlight:t,onOpenTool:n}){const{x:s,y:i,zoom:a}=HC();return d.jsxs("div",{className:"tool-bursts-layer","aria-hidden":!0,children:[d.jsx("svg",{className:"tool-bursts-svg",children:e.map(l=>{const u=l.anchorX*a+s,h=l.anchorY*a+i,p=(l.worldX+6)*a+s,f=(l.worldY+qy)*a+i,g=u+(p-u)*.55,y=t!=null&&!t.has(l.agentId),w=l.fade*(y?.14:1);return d.jsx("path",{d:`M ${u} ${h} Q ${g} ${h}, ${p} ${f}`,className:`tool-conn status-${l.status}${l.fading?" fading":""}`,opacity:w},`l:${l.id}`)})}),e.map(l=>{const u=l.worldX*a+s,h=l.worldY*a+i,p={left:`${u}px`,top:`${h}px`,transform:`scale(${a})`,transformOrigin:"left top","--spawn-dx":`${l.spawnDx}px`,"--spawn-dy":`${l.spawnDy}px`},f=l.isSub?`${l.toolName} · ${l.name}`:l.toolName,g=l.inputPreview?`${f} · ${l.inputPreview}`:f,y=n!=null,w=l.mcpHue!=null?{"--mcp-hue":l.mcpHue}:{},b=t!=null&&!t.has(l.agentId)?" dim":"";return d.jsx("div",{className:"tool-burst-wrap",style:p,children:d.jsxs("div",{className:`tool-burst cat-${l.category}${l.mcpHue!=null?" mcp-hue":""} status-${l.status}${l.fading?" fading":""}${y?" clickable":""}${l.isSub?" sub":""}${b}`,style:w,title:g,onClick:y?()=>n(l.toolId):void 0,children:[d.jsx("span",{className:"tb-emoji",children:l.emoji}),d.jsx("span",{className:"tb-name",children:l.name}),l.status==="inflight"&&d.jsx("span",{className:"tb-spin"}),l.status==="done"&&d.jsx("span",{className:"tb-mark done",children:"✓"}),l.status==="err"&&d.jsx("span",{className:"tb-mark err",children:"×"})]})},l.id)})]})}function gT(e){const t={input:0,output:0,cacheRead:0,cacheWrite:0,total:0};let n=0,s=0,i=0,a=0;for(const l of e){const u=_n(l);t.input+=u.input,t.output+=u.output,t.cacheRead+=u.cacheRead,t.cacheWrite+=u.cacheWrite,t.total+=u.total,n+=l.usage.inputTokens,s+=l.usage.outputTokens,i+=l.usage.cacheReadTokens,a+=l.usage.cacheCreateTokens}return{cost:t,inputTokens:n,outputTokens:s,cacheReadTokens:i,cacheCreateTokens:a,sum:n+s}}const G3="spend on this board",y1="on this board",V3="board tokens",Y3="board cost",Za=`Everything on the board right now, and only that.
|
|
71
|
+
Finished sessions are evicted from the canvas a couple of minutes after they end, and their tokens and dollars leave with them — so this figure falls on its own.
|
|
72
|
+
Press H for the totals ccusage reads off the logs on disk, which do not forget.`,vT="session spend";function kw({cost:e,size:t="md"}){const n=e.total;if(n<=0)return null;const s=(a,l,u)=>{if(a<=0)return null;const h=a/n*100;return d.jsx("span",{className:`cb-seg ${l}`,style:{width:`${h}%`},title:`${u}: ${We(a)} (${h.toFixed(0)}%)`},l)},i=t==="lg";return d.jsxs("div",{className:i?"cost-bar cost-bar-lg":"cost-bar",role:"img","aria-label":"Cost breakdown",children:[s(e.input,"cb-input","input"),s(e.output,"cb-output","output"),s(e.cacheRead,"cb-cache-r","cache read"),s(e.cacheWrite,"cb-cache-w","cache write")]})}function K3({state:e,sessionId:t,onClose:n}){const s=S.useMemo(()=>X3(e,t),[e,t]),i=S.useRef(null),a=Sn(n,{focusRef:i});return s?d.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:d.jsxs("div",{ref:a,className:"modal session-summary",onClick:l=>l.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"ss-title",children:[d.jsxs("div",{className:"modal-head",children:[d.jsxs("div",{className:"modal-title",children:[d.jsx("span",{className:"state-pill state-done","aria-hidden":!0,children:"done"}),d.jsx("span",{id:"ss-title",className:"modal-tool-name",title:s.cwd??s.sessionId,children:s.label}),d.jsxs("span",{className:"modal-tool-id",children:["· ",s.sessionId.slice(0,8)]})]}),d.jsxs("div",{className:"modal-actions",children:[d.jsx("span",{className:"modal-dur",title:"Total wall time",children:s.durationLabel}),d.jsx("button",{type:"button",ref:i,className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),d.jsxs("div",{className:"modal-body",children:[d.jsxs("section",{className:"ss-hero",children:[d.jsxs("div",{className:"ss-hero-left",children:[d.jsx("div",{className:"ss-cost-label",children:vT}),d.jsx("div",{className:"ss-cost",children:We(s.cost.total)}),s.modelChips.length>0&&d.jsx("div",{className:"ss-models",children:s.modelChips.map(l=>d.jsx("span",{className:"model-chip","data-family":Ou(l),title:l,children:Is(l)},l))})]}),d.jsx("div",{className:"ss-hero-right",children:s.cost.total>0&&d.jsxs(d.Fragment,{children:[d.jsx(kw,{cost:s.cost,size:"lg"}),d.jsxs("div",{className:"ss-cost-legend",children:[d.jsxs("span",{className:"ssl ssl-in",children:["input ",d.jsx("b",{children:We(s.cost.input)})]}),d.jsxs("span",{className:"ssl ssl-out",children:["output ",d.jsx("b",{children:We(s.cost.output)})]}),d.jsxs("span",{className:"ssl ssl-cr",children:["cache r ",d.jsx("b",{children:We(s.cost.cacheRead)})]}),d.jsxs("span",{className:"ssl ssl-cw",children:["cache w ",d.jsx("b",{children:We(s.cost.cacheWrite)})]})]})]})})]}),d.jsxs("section",{className:"ss-stats",children:[d.jsx(ki,{label:"agents",value:s.agentCount}),d.jsx(ki,{label:"subagents",value:s.subagentCount}),d.jsx(ki,{label:"tool calls",value:s.toolCount}),d.jsx(ki,{label:"prompts",value:s.promptCount}),d.jsx(ki,{label:"tokens",value:s.tokensSum.toLocaleString()}),s.errCount>0&&d.jsx(ki,{label:"errors",value:s.errCount,tone:"err"})]}),s.topTools.length>0&&d.jsxs("section",{className:"modal-section",children:[d.jsx("h4",{children:"Most-used tools"}),d.jsx("div",{className:"ss-top-tools",children:s.topTools.map(([l,u])=>d.jsxs("div",{className:"ss-tt",children:[d.jsx("span",{className:"ss-tt-name",children:l}),d.jsx("span",{className:"ss-tt-bar",children:d.jsx("span",{className:"ss-tt-bar-fill",style:{width:`${u/s.topTools[0][1]*100}%`}})}),d.jsx("span",{className:"ss-tt-count",children:u})]},l))})]}),s.firstPrompt&&d.jsxs("section",{className:"modal-section",children:[d.jsx("h4",{children:"Opening prompt"}),d.jsx("div",{className:"ss-prompt",children:s.firstPrompt})]})]})]})}):null}function ki({label:e,value:t,tone:n}){return d.jsxs("div",{className:`ss-stat${n?` tone-${n}`:""}`,children:[d.jsx("div",{className:"ss-stat-value",children:t}),d.jsx("div",{className:"ss-stat-label",children:e})]})}function X3(e,t){const n=e.agents.get(t);if(!n)return null;const s=[];for(const j of e.agents.values())j.sessionId===t&&s.push(j);if(s.length===0)return null;const i={input:0,output:0,cacheRead:0,cacheWrite:0,total:0},a=new Set,l=new Map;let u=0,h=0,p=0,f=0,g=0,y,w=1/0,N=0;for(const j of s){const C=_n(j);i.input+=C.input,i.output+=C.output,i.cacheRead+=C.cacheRead,i.cacheWrite+=C.cacheWrite,i.total+=C.total;for(const I of sT(j))a.add(I);j.model&&a.add(j.model),j.kind==="subagent"&&g++,h+=j.prompts.length,!y&&j.prompts.length>0&&(y=j.prompts[0].text),p+=j.usage.inputTokens+j.usage.outputTokens,u+=j.toolCount,w=Math.min(w,j.startedAt),N=Math.max(N,j.endedAt??Date.now());for(const I of j.tools)l.set(I.name,(l.get(I.name)??0)+1),I.ok===!1&&f++}const b=Math.max(0,N-w),_=Math.floor(b/1e3),k=_<60?`${_}s`:_<3600?`${Math.floor(_/60)}m ${String(_%60).padStart(2,"0")}s`:`${Math.floor(_/3600)}h ${Math.floor(_%3600/60)}m`,E=Array.from(l.entries()).sort((j,C)=>C[1]-j[1]).slice(0,5);return{sessionId:t,label:n.label||n.cwdBasename||"session",cwd:n.cwd,durationLabel:k,cost:i,modelChips:Array.from(a),agentCount:s.length,subagentCount:g,toolCount:u,promptCount:h,tokensSum:p,errCount:f,topTools:E,firstPrompt:y}}function Sw(e){return(e==null?void 0:e.kind)==="permission"}function Q3(e){const t=[];for(const n of e)n.kind==="root"&&Sw(n.waiting)&&t.push({id:n.id,label:n.label,waiting:n.waiting});return t.sort((n,s)=>n.waiting.since-s.waiting.since)}function Z3(e){const t=new Set;for(const n of e)n.state==="active"&&t.add(n.sessionId);return t.size}function w1(e){return e.waiting?Sw(e.waiting)?0:1:e.state==="active"?2:3}function J3(e,t){const n=[];for(const s of e.agents.values()){if(s.kind!=="root")continue;let i=s.toolCount,a=_n(s).total,l=s.endedAt??s.startedAt;for(const u of e.agents.values()){if(u.sessionId!==s.sessionId||u.kind==="root")continue;i+=u.toolCount,a+=_n(u).total;const h=u.endedAt??u.startedAt;h>l&&(l=h)}n.push({sessionId:s.sessionId,label:s.label||s.cwdBasename||"session",cwdBasename:s.cwdBasename,state:s.state,waiting:s.waiting,modelId:s.model,toolCount:i,cost:a,startedAt:s.startedAt,lastActivity:l})}return n.sort((s,i)=>{const a=w1(s),l=w1(i);return a!==l?a-l:s.waiting&&i.waiting?s.waiting.since-i.waiting.since:i.lastActivity-s.lastActivity}),n}function x1(e,t,n){const s=(t??n)-e;if(s<1e3)return"<1s";const i=Math.floor(s/1e3);if(i<60)return`${i}s`;const a=Math.floor(i/60);return a<60?`${a}m`:`${Math.floor(a/60)}h ${a%60}m`}function eq({state:e,now:t,selectedIds:n,onSelect:s,onClose:i}){const a=S.useMemo(()=>J3(e),[e,e.revision,t]),l=a.filter(h=>h.state==="active").length,u=a.filter(h=>Sw(h.waiting)).length;return d.jsxs("aside",{className:"session-list",id:"session-list","aria-label":"Sessions",children:[d.jsxs("div",{className:"sl-header",children:[d.jsxs("h2",{children:["Sessions ",d.jsx("span",{className:"sl-count",children:a.length})]}),u>0&&d.jsxs("span",{className:"sl-waiting-count",children:[u," waiting"]}),l>0&&d.jsxs("span",{className:"sl-live-count",children:[l," live"]}),d.jsx("button",{className:"glyph-btn sl-close",onClick:i,title:"Hide sidebar (L)","aria-label":"Hide session list",children:"‹"})]}),d.jsxs("div",{className:"sl-rows",children:[a.length===0&&d.jsx("div",{className:"sl-empty",children:"No sessions yet."}),a.map(h=>{const p=n.has(h.sessionId);return d.jsxs("button",{type:"button",className:`sl-row state-${h.state}${p?" selected":""}`,onClick:()=>s(h.sessionId),title:`Focus ${h.label}`,children:[d.jsx("span",{className:`sl-dot state-${h.state}`,"aria-hidden":!0}),d.jsx("span",{className:"vis-hidden",children:_u(h.state)}),d.jsxs("div",{className:"sl-row-body",children:[d.jsxs("div",{className:"sl-row-head",children:[d.jsx("span",{className:"sl-label",children:h.label}),h.modelId&&d.jsx("span",{className:"model-chip","data-family":Ou(h.modelId),title:h.modelId,children:Is(h.modelId)})]}),d.jsxs("div",{className:"sl-row-meta",children:[d.jsxs("span",{title:"tool calls",children:[d.jsx("b",{children:h.toolCount})," tools"]}),h.cost>0&&d.jsx("span",{className:"sl-cost",title:vT,children:d.jsx("b",{children:We(h.cost)})}),h.waiting?d.jsxs("span",{className:"sl-waiting",title:`${Pu(h.waiting)}
|
|
73
|
+
Blocked since ${new Date(h.waiting.since).toLocaleTimeString()} · started ${new Date(h.startedAt).toLocaleString()}`,children:["waiting ",x1(h.waiting.since,void 0,t)]}):d.jsx("span",{className:"sl-elapsed",title:`Started ${new Date(h.startedAt).toLocaleString()}`,children:x1(h.startedAt,h.state==="active"?void 0:h.lastActivity,t)})]})]})]},h.sessionId)})]})]})}function Dy(e,t=new Date){return new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate()-(e-1))).toISOString().slice(0,10).replace(/-/g,"")}const b1=[{key:"today",label:"today",noun:"today"},{key:"month",label:"month",noun:"this month"},{key:"all",label:"all",noun:"all time"}];function tq(e,t=new Date){return e==="today"?Dy(1,t):e==="month"?Dy(t.getDate(),t):"20200101"}const bn=e=>typeof e=="number"&&Number.isFinite(e)?e:0,lu=e=>typeof e=="string"?e:"";function yT(e){const t=Array.isArray(e==null?void 0:e.days)?e.days:[],n=new Map;for(const s of t){const i=Array.isArray(s==null?void 0:s.modelBreakdowns)?s.modelBreakdowns:[];for(const a of i){const l=lu(a==null?void 0:a.modelName);if(!l)continue;let u=n.get(l);u||(u={model:l,cost:0,inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0,get tokens(){return this.inputTokens+this.outputTokens+this.cacheReadTokens+this.cacheCreateTokens}},n.set(l,u)),u.cost+=bn(a==null?void 0:a.cost),u.inputTokens+=bn(a==null?void 0:a.inputTokens),u.outputTokens+=bn(a==null?void 0:a.outputTokens),u.cacheReadTokens+=bn(a==null?void 0:a.cacheReadTokens),u.cacheCreateTokens+=bn(a==null?void 0:a.cacheCreationTokens)}}return[...n.values()].sort((s,i)=>i.cost-s.cost||i.tokens-s.tokens)}function nq(e,t=new Map){const n=Array.isArray(e==null?void 0:e.sessions)?e.sessions:[],s=[];for(const i of n){const a=lu(i==null?void 0:i.period);if(!a)continue;const l=i==null?void 0:i.metadata,u=typeof(l==null?void 0:l.lastActivity)=="string"?Date.parse(l.lastActivity):NaN;s.push({sessionId:a,label:t.get(a)??null,agent:lu(i==null?void 0:i.agent)||"claude",cost:bn(i==null?void 0:i.totalCost),tokens:bn(i==null?void 0:i.totalTokens),models:Array.isArray(i==null?void 0:i.modelsUsed)?i.modelsUsed.map(lu).filter(Boolean):[],lastActivityMs:Number.isFinite(u)?u:null})}return s.sort((i,a)=>a.cost-i.cost||a.tokens-i.tokens)}function rq(e){const t=e==null?void 0:e.totals;if(t&&typeof t=="object"){const h=bn(t.cacheReadTokens),p=bn(t.cacheCreationTokens),f=bn(t.inputTokens),g=bn(t.outputTokens);return{cost:bn(t.totalCost),inputTokens:f,outputTokens:g,cacheReadTokens:h,cacheCreateTokens:p,tokens:bn(t.totalTokens)||f+g+h+p}}const n=yT(e),s=h=>n.reduce((p,f)=>p+h(f),0),i=s(h=>h.inputTokens),a=s(h=>h.outputTokens),l=s(h=>h.cacheReadTokens),u=s(h=>h.cacheCreateTokens);return{cost:s(h=>h.cost),inputTokens:i,outputTokens:a,cacheReadTokens:l,cacheCreateTokens:u,tokens:i+a+l+u}}const zt="ccdeck";function wT(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 Fy(e){return wT(Math.floor(e/1e3))}function xT(e,t){const n=e-t;if(n<=0)return null;const s=Math.floor(n/86400),i=Math.floor(n%86400/3600),a=Math.floor(n%3600/60);return s>0?`${s}d ${i}h`:i>0?`${i}h ${a}m`:`${a}m`}function sq(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function oq(e,t,n){const s=new Date(e),i=Fy(t-e);return{label:sq(s,new Date(t))?i:`${i} · ${s.toLocaleDateString(n,{month:"short",day:"numeric"})}`,title:s.toLocaleString(n,{dateStyle:"medium",timeStyle:"medium"})}}function bT(e,t){return{disabled:e!=null&&e!==t,busy:e===t}}function _T(e){return e==null}const zy="self";function ir(e,t=!1){const n=bT(e?zy:null,zy);return{disabled:t||n.disabled,"aria-busy":n.busy}}function ar(e){return _T(e?zy:null)}function iq(e){return[...e==null?[]:[`#ap-more-${e}`],".accounts-panel .ap-refresh"]}function aq(e){return e==null||e==="BODY"||e==="HTML"}function _1(e,t){if(!e)return null;const n=t-Math.floor(e/1e3);return n<10?"just now":n<60?`${n}s ago`:n<3600?`${Math.floor(n/60)}m ago`:`${Math.floor(n/3600)}h ago`}function lq(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 Yf="__unknown__";function cq(e,t,n,s){const i=Math.max(0,t-s),a=Math.max(0,n-i);if(a<120)return null;const l=Math.min(100,a/n*100),u=e-l;if(Math.abs(u)<3)return{label:"on pace",color:"var(--ok)",expectedPct:l,isDeficit:!1};if(u>0){const h=100-e,p=a>0?e/a:0,f=p>0?h/p:1/0,g={label:`${Math.round(u)}% ahead`,color:"var(--warn)",expectedPct:l,isDeficit:!0};if(f<i&&f<86400){const y=Math.floor(f/3600),w=Math.floor(f%3600/60);g.runsOutIn=y>0?`${y}h ${w}m`:`${w}m`}return g}return{label:`${Math.round(-u)}% reserve`,color:"var(--ok)",expectedPct:l,isDeficit:!1}}function ho({pct:e,label:t,reset:n,resetAt:s,windowSec:i,limitReached:a,nowSec:l}){const u=Math.min(100,Math.max(0,e)),p=a||u>=90?"var(--err)":u>=70?"var(--warn)":"var(--accent)",f=u===0?"< 1%":`${u}%`,g=u===0?2:u,y=s?xT(s,l):null,w=s&&i?cq(u,s,i,l):null;return d.jsxs("div",{className:"qb-row",children:[d.jsxs("div",{className:"qb-meta",children:[d.jsxs("span",{className:"qb-label",children:[t,a&&d.jsx("span",{className:"qb-limit-badge",title:"Rate limit reached",children:"⛔"})]}),d.jsx("span",{className:"qb-pct",style:{color:p},children:f})]}),d.jsxs("div",{className:"qb-track",children:[d.jsx("div",{className:"qb-fill",style:{width:`${g}%`,background:p,opacity:u===0?.4:1}}),w&&d.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`})]}),d.jsxs("div",{className:"qb-reset-row",children:[y?d.jsxs("span",{className:"qb-reset",children:["resets in ",y]}):n?d.jsxs("span",{className:"qb-reset",children:["resets ",n]}):null,w&&d.jsx("span",{className:"qb-pace",style:{color:w.color},children:w.runsOutIn?`runs out in ${w.runsOutIn}`:w.label})]})]})}const uq=6e4;function dq(e){const[t,n]=S.useState(null),[s,i]=S.useState(!1),a=S.useRef(null),l=S.useRef(!1),u=async(p=!1)=>{if(!(p&&!ar(l.current))){p&&(l.current=!0,i(!0));try{const g=await fetch(p?"/api/quota?refresh=1":"/api/quota");g.ok&&n(await g.json())}catch{}finally{p&&(l.current=!1,i(!1))}}};return S.useEffect(()=>{if(e)return u(!0),a.current=window.setInterval(()=>u(!1),uq),()=>{a.current!=null&&window.clearInterval(a.current)}},[e]),{quota:t,loading:s,refresh:()=>{e&&u(!0)}}}function fq(e){switch(e){case"no_subscription":return"This install signs in with an API key (or Bedrock/Vertex), which is billed per token and has no session window.";case"rate_limited":return"Anthropic asked the deck to wait — it will retry on its own.";case"waiting":return"Waiting for the next allowed read — or click ↻.";default:return"Run /usage in a claude session, then click ↻"}}function hq(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 kT=6e4;function pq(e){const[t,n]=S.useState(null),[s,i]=S.useState(!1),a=S.useRef(null),l=S.useRef(!1),u=async(p=!1)=>{if(!(p&&!ar(l.current))){p&&(l.current=!0,i(!0));try{const g=await fetch(p?"/api/codex-quota?refresh=1":"/api/codex-quota");g.ok&&n(await g.json())}catch{}finally{p&&(l.current=!1,i(!1))}}};return S.useEffect(()=>{if(e)return u(!0),a.current=window.setInterval(()=>u(!1),kT),()=>{a.current!=null&&window.clearInterval(a.current)}},[e]),{data:t,loading:s,refresh:()=>{e&&u(!0)}}}function mq(e){const[t,n]=S.useState(null),s=S.useRef(null),i=async()=>{try{const a=await fetch("/api/codex-usage");a.ok&&n(await a.json())}catch{}};return S.useEffect(()=>{if(e)return i(),s.current=window.setInterval(i,kT),()=>{s.current!=null&&window.clearInterval(s.current)}},[e]),{data:t}}function gq(e,t){const[n,s]=S.useState(null),[i,a]=S.useState(!1),[l,u]=S.useState(0);S.useEffect(()=>{const p=()=>{document.visibilityState==="visible"&&u(y=>y+1)},f=window.setInterval(p,3e5),g=()=>{document.visibilityState==="visible"&&u(y=>y+1)};return document.addEventListener("visibilitychange",g),()=>{window.clearInterval(f),document.removeEventListener("visibilitychange",g)}},[]);const h=S.useRef(t);return S.useEffect(()=>{let p=!0;const f=t!==h.current;h.current=t;const g=e,y=tq(g);return a(!0),fetch(`/api/ccusage?since=${y}${f?"&refresh=1":""}`).then(w=>w.ok?w.json():null).then(w=>{p&&(w!=null&&w.ok)&&s({period:g,data:w})}).catch(()=>{}).finally(()=>{p&&a(!1)}),()=>{p=!1}},[e,t,l]),{data:(n==null?void 0:n.data)??null,shown:(n==null?void 0:n.period)??null,loading:i,stale:n!=null&&n.period!==e}}function vq({state:e,now:t,providers:n,onClose:s}){var se,he,pe;const{quota:i,loading:a,refresh:l}=dq(n.claude),{data:u,loading:h,refresh:p}=pq(n.codex),{data:f}=mq(n.codex),[g,y]=S.useState(()=>Math.floor(Date.now()/1e3));S.useEffect(()=>{const re=window.setInterval(()=>y(Math.floor(Date.now()/1e3)),3e4);return()=>window.clearInterval(re)},[]);const{byModel:w,totalCost:N,totalTokens:b,burnRate:_}=S.useMemo(()=>{const re=new Map;for(const ae of e.agents.values())for(const we of xl(ae)){const be=we.model??Yf,Ue=ww(we.usage,we.model),Ke=re.get(be);Ke?(Ke.inputTokens+=we.usage.inputTokens,Ke.outputTokens+=we.usage.outputTokens,Ke.cacheReadTokens+=we.usage.cacheReadTokens,Ke.cacheCreateTokens+=we.usage.cacheCreateTokens,Ke.cost.total+=Ue.total,Ke.cost.input+=Ue.input,Ke.cost.output+=Ue.output,Ke.cost.cacheRead+=Ue.cacheRead,Ke.cost.cacheWrite+=Ue.cacheWrite,Ke.agentCount++):re.set(be,{model:be,inputTokens:we.usage.inputTokens,outputTokens:we.usage.outputTokens,cacheReadTokens:we.usage.cacheReadTokens,cacheCreateTokens:we.usage.cacheCreateTokens,cost:{...Ue},agentCount:1,priced:Hi(we.model)!=null})}const ve=Array.from(re.values()).sort((ae,we)=>we.cost.total-ae.cost.total||we.inputTokens+we.outputTokens-(ae.inputTokens+ae.outputTokens));let Te=0,$e=0;for(const ae of e.agents.values()){if(ae.state!=="active")continue;const we=_n(ae);Te+=we.total,$e=Math.max($e,((ae.endedAt??t)-ae.startedAt)/1e3)}const Me=$e>0?xu(Te,$e):null,_e=gT(e.agents.values());return{byModel:ve,totalCost:_e.cost,totalTokens:_e,burnRate:Me}},[e,e.revision,t]),k=S.useMemo(()=>{const re=[];for(const ve of e.agents.values()){if(ve.kind!=="root")continue;let Te=_n(ve).total,$e=ve.usage.inputTokens,Me=ve.usage.outputTokens,_e=$y(ve);for(const ae of e.agents.values())ae.sessionId!==ve.sessionId||ae.kind==="root"||(Te+=_n(ae).total,$e+=ae.usage.inputTokens,Me+=ae.usage.outputTokens,_e+=$y(ae));re.push({sessionId:ve.sessionId,label:ve.label||ve.cwdBasename||"session",state:ve.state,cost:Te,inputTokens:$e,outputTokens:Me,unpricedTokens:_e})}return re.sort((ve,Te)=>Te.cost-ve.cost||Te.inputTokens+Te.outputTokens-(ve.inputTokens+ve.outputTokens)).slice(0,12)},[e,e.revision]),[E,j]=S.useState("today"),[C,I]=S.useState(0),{data:P,shown:O,stale:F}=gq(E,C),M=P!=null,A=S.useMemo(()=>{const re=new Map;for(const ve of e.agents.values()){if(ve.kind!=="root"||!ve.sessionId)continue;const Te=ve.label||ve.cwdBasename;Te&&re.set(ve.sessionId,Te)}return re},[e,e.revision]),q=S.useMemo(()=>{const re=new Map;for(const ve of e.agents.values())ve.kind!=="root"||!ve.sessionId||re.set(ve.sessionId,ve.state);return re},[e,e.revision]),W=S.useMemo(()=>M?yT(P):[],[P,M]),Y=S.useMemo(()=>{if(!M)return[];const re=nq(P,A).slice(0,12),ve=new Map;for(const Te of re)Te.label&&ve.set(Te.label,(ve.get(Te.label)??0)+1);return re.map(Te=>Te.label&&(ve.get(Te.label)??0)>1?{...Te,label:`${Te.label} ${Te.sessionId.slice(0,4)}`}:Te)},[P,M,A]),T=S.useMemo(()=>rq(P),[P]),Z=((se=b1.find(re=>re.key===(O??E)))==null?void 0:se.noun)??"today",U=F?" up-stale":"",ne=M?T.cost>0:N.total>0,X=M?T.tokens:b.sum,H=w.filter(re=>re.cost.total>0||re.inputTokens+re.outputTokens>0),J=k.filter(re=>re.cost>0||re.inputTokens+re.outputTokens>0),$=M?W.some(re=>re.cost<=0&&re.tokens>0):H.some(re=>!re.priced),G=a||h,Q=_1(i==null?void 0:i.fetchedAt,g),D=_1(u==null?void 0:u.fetchedAt,g),L=()=>{l(),p(),I(re=>re+1)},K=n.claude&&n.codex?"Refresh Claude + Codex quota":n.codex?"Refresh Codex quota":"Refresh Claude quota";return d.jsxs("aside",{className:"usage-panel",id:"usage-panel","aria-label":"Usage",children:[d.jsxs("div",{className:"up-header",children:[d.jsx("h2",{children:"Usage"}),_&&d.jsx("span",{className:"up-rate",children:_}),d.jsxs("div",{className:"up-header-right",children:[(n.claude||n.codex)&&d.jsx("button",{type:"button",className:"glyph-btn up-refresh-btn",onClick:L,...ir(G),"aria-label":K,title:K,children:G?"…":"↻"}),d.jsx("button",{type:"button",className:"glyph-btn up-close",onClick:s,"aria-label":"Close usage panel",title:"Close (U)",children:"×"})]})]}),n.claude&&d.jsxs("section",{className:"up-section up-quota-section",children:[d.jsxs("h3",{className:"up-section-title",children:["Claude quota",Q&&!a&&d.jsx("span",{className:"up-section-age",title:lq(i==null?void 0:i.source),children:Q})]}),i!=null&&i.ok?d.jsxs("div",{className:"up-quota-bars",children:[i.session5hPct!=null&&d.jsx(ho,{label:"5-hour window",pct:i.session5hPct,reset:i.session5hReset,resetAt:i.session5hResetAt,windowSec:i.session5hWindowSec,nowSec:g}),i.week7dPct!=null&&d.jsx(ho,{label:"7-day window",pct:i.week7dPct,reset:i.week7dReset,resetAt:i.week7dResetAt,windowSec:i.week7dWindowSec,nowSec:g}),i.weekSonnetPct!=null&&d.jsx(ho,{label:"Sonnet (7d)",pct:i.weekSonnetPct,nowSec:g}),i.weekOpusPct!=null&&d.jsx(ho,{label:"Opus (7d)",pct:i.weekOpusPct,nowSec:g})]}):(i==null?void 0:i.ok)===!1?d.jsxs("div",{className:"up-quota-na",children:[d.jsx("span",{children:i.reason==="no_subscription"?"No quota to show.":"Quota unavailable."}),d.jsx("span",{className:"up-quota-hint",children:fq(i.reason)})]}):d.jsx("div",{className:"up-quota-na up-quota-loading",children:"Checking…"})]}),n.codex&&d.jsxs("section",{className:"up-section up-quota-section",children:[d.jsxs("h3",{className:"up-section-title",children:["Codex quota",(u==null?void 0:u.ok)&&u.planLabel&&d.jsx("span",{className:"up-plan-badge",children:u.planLabel}),D&&!h&&d.jsx("span",{className:"up-section-age",title:"Fetched from the Codex usage endpoint",children:D})]}),u!=null&&u.ok?d.jsxs("div",{className:"up-quota-bars",children:[(he=u.windows)==null?void 0:he.map(re=>d.jsx(ho,{label:re.label,pct:re.pct,reset:re.reset??void 0,resetAt:re.resetAt??void 0,windowSec:re.windowSec??void 0,limitReached:u.limitReached&&re.pct>=100,nowSec:g},re.id)),(pe=u.extraWindows)==null?void 0:pe.map(re=>d.jsx(ho,{label:re.label,pct:re.pct,reset:re.reset??void 0,resetAt:re.resetAt??void 0,windowSec:re.windowSec??void 0,nowSec:g},re.id)),u.creditLimit&&d.jsx(ho,{label:`spend cap · $${Math.round(u.creditLimit.used)} of $${Math.round(u.creditLimit.limit)}`,pct:u.creditLimit.usedPct,reset:u.creditLimit.reset??void 0,resetAt:u.creditLimit.resetAt??void 0,limitReached:u.spendControlReached,nowSec:g}),u.creditsBalance&&!u.creditsUnlimited&&d.jsxs("div",{className:"up-quota-sub up-credits",children:["credits: $",u.creditsBalance,u.overageReached&&" · overage limit reached"]}),u.creditsUnlimited&&d.jsx("div",{className:"up-quota-sub up-credits",children:"credits: unlimited"}),u.resetCredits&&u.resetCredits.availableCount>0&&d.jsxs("div",{className:"up-quota-sub up-reset-credits",title:`Redeem in the Codex CLI or ChatGPT — ${zt} only reports them`,children:[u.resetCredits.availableCount," rate-limit reset",u.resetCredits.availableCount!==1?"s":""," available",u.resetCredits.nextExpiryAt&&` · expires ${new Date(u.resetCredits.nextExpiryAt).toLocaleDateString("en-US",{month:"short",day:"numeric"})}`]}),u.promo&&d.jsx("div",{className:"up-quota-sub",children:u.promo}),u.partial&&d.jsx("div",{className:"up-quota-sub up-quota-hint",children:"Partial data — OpenAI returned limits this build doesn't recognise."})]}):(u==null?void 0:u.ok)===!1?d.jsxs("div",{className:"up-quota-na",children:[d.jsx("span",{children:"Quota unavailable."}),d.jsx("span",{className:"up-quota-hint",children:hq(u.reason)})]}):d.jsx("div",{className:"up-quota-na up-quota-loading",children:"Checking…"}),(f==null?void 0:f.ok)&&f.window7d&&f.window7d.sessionCount>0&&d.jsxs("div",{className:"up-quota-sub",title:`Counted from the rollout files under CODEX_HOME — no network, no account${f.window5h?`
|
|
74
|
+
last 5h: ${Ct(f.window5h.totalTokens)} tokens · ${f.window5h.sessionCount} session${f.window5h.sessionCount!==1?"s":""}`:""}`,children:[Ct(f.window7d.totalTokens)," tokens · ",f.window7d.sessionCount," session",f.window7d.sessionCount!==1?"s":""," (7d)"]})]}),M&&d.jsx("div",{className:"uh-range up-period",role:"group","aria-label":"Period",children:b1.map(re=>d.jsx("button",{type:"button","aria-pressed":E===re.key,className:"uh-range-btn",onClick:()=>j(re.key),children:re.label},re.key))}),X>0?d.jsxs(d.Fragment,{children:[ne&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:`up-total${U}`,title:M?void 0:Za,children:[d.jsx("span",{className:"up-total-value",children:We(M?T.cost:N.total)}),d.jsx("span",{className:"up-total-label",children:M?Z:G3})]}),!M&&d.jsx(kw,{cost:N})]}),d.jsxs("div",{className:`up-tokens-row${U}`,title:M?void 0:Za,children:[d.jsxs("span",{className:"up-tok",children:[d.jsx("span",{className:"up-k",children:"in"}),Ct(M?T.inputTokens:b.inputTokens)]}),d.jsxs("span",{className:"up-tok",children:[d.jsx("span",{className:"up-k",children:"out"}),Ct(M?T.outputTokens:b.outputTokens)]}),(M?T.cacheReadTokens:b.cacheReadTokens)>0&&d.jsxs("span",{className:"up-tok",children:[d.jsx("span",{className:"up-k",children:"cache r"}),Ct(M?T.cacheReadTokens:b.cacheReadTokens)]}),(M?T.cacheCreateTokens:b.cacheCreateTokens)>0&&d.jsxs("span",{className:"up-tok",children:[d.jsx("span",{className:"up-k",children:"cache c"}),Ct(M?T.cacheCreateTokens:b.cacheCreateTokens)]}),!ne&&d.jsx("span",{className:"up-tok up-scope",children:y1})]}),M&&N.total>0&&d.jsxs("div",{className:"up-live",title:Za,children:[d.jsx("span",{className:"up-live-value",children:We(N.total)}),d.jsxs("span",{className:"up-live-label",children:[y1," now"]})]}),(M?W.length:H.length)>0&&d.jsxs("section",{className:`up-section${U}`,children:[d.jsx("h3",{className:"up-section-title",children:"By model"}),d.jsxs("table",{className:"up-table",children:[d.jsx("thead",{children:d.jsxs("tr",{children:[d.jsx("th",{children:"Model"}),d.jsx("th",{children:"Tokens"}),d.jsx("th",{children:"Cost"})]})}),d.jsx("tbody",{children:M?W.map(re=>d.jsxs("tr",{children:[d.jsx("td",{className:"up-model-name",title:re.model,children:Is(re.model)}),d.jsx("td",{className:"up-num",children:Ct(re.tokens)}),re.cost>0?d.jsx("td",{className:"up-num up-cost-val",children:We(re.cost)}):d.jsx("td",{className:"up-num up-unpriced",children:Ei})]},re.model)):H.map(re=>d.jsxs("tr",{children:[d.jsx("td",{className:"up-model-name",title:re.model===Yf?"no model reported yet":re.model,children:re.model===Yf?"unknown":Is(re.model)}),d.jsx("td",{className:"up-num",children:Ct(re.inputTokens+re.outputTokens)}),re.priced?d.jsx("td",{className:"up-num up-cost-val",children:We(re.cost.total)}):d.jsx("td",{className:"up-num up-unpriced",children:Ei})]},re.model))})]})]}),M&&Y.length===0&&T.tokens>0&&d.jsxs("section",{className:"up-section",children:[d.jsx("h3",{className:"up-section-title",children:"By session"}),d.jsxs("div",{className:"up-hint",children:["No session is dated ",Z," yet — ccusage dates sessions in UTC, and the totals above are your local day."]})]}),(M?Y.length:J.length)>0&&d.jsxs("section",{className:`up-section${U}`,children:[d.jsxs("h3",{className:"up-section-title",children:["By session",M&&d.jsxs("span",{className:"up-section-age",title:`Sessions with activity ${Z}, each showing what that session has cost since it started.
|
|
75
|
+
A session that began earlier brings its whole total with it, so these rows can add up to more than the figure above.`,children:["active ",Z]})]}),d.jsxs("div",{className:"up-sessions",children:[M&&Y.map(re=>{const ve=q.get(re.sessionId);return d.jsxs("div",{className:"up-session-row",children:[ve?d.jsxs(d.Fragment,{children:[d.jsx("span",{className:`sl-dot state-${ve}`,"aria-hidden":!0}),d.jsx("span",{className:"vis-hidden",children:_u(ve)})]}):d.jsx("span",{className:"sl-dot up-dot-past","aria-hidden":!0}),d.jsx("span",{className:`up-session-label${re.label?"":" up-session-id"}`,title:re.label?`${re.label}
|
|
76
|
+
${re.sessionId}`:re.sessionId,children:re.label??re.sessionId.slice(0,8)}),d.jsx("span",{className:"up-session-tokens",children:Ct(re.tokens)}),re.cost>0?d.jsx("span",{className:"up-session-cost",title:re.models.join(", ")||void 0,children:We(re.cost)}):d.jsx("span",{className:"up-session-cost up-unpriced",children:Ei})]},re.sessionId)}),!M&&J.map(re=>d.jsxs("div",{className:"up-session-row",children:[d.jsx("span",{className:`sl-dot state-${re.state}`,"aria-hidden":!0}),d.jsx("span",{className:"vis-hidden",children:_u(re.state)}),d.jsx("span",{className:"up-session-label",children:re.label}),d.jsx("span",{className:"up-session-tokens",children:Ct(re.inputTokens+re.outputTokens)}),re.cost>0?d.jsxs("span",{className:"up-session-cost",title:re.unpricedTokens>0?`${Ct(re.unpricedTokens)} tokens in this session are on an unpriced model, so this is a floor`:void 0,children:[We(re.cost),re.unpricedTokens>0?"+":""]}):d.jsx("span",{className:"up-session-cost up-unpriced",children:Ei})]},re.sessionId))]})]}),$&&d.jsxs("div",{className:"up-hint",children:["“",Ei,"” means this build holds no published rate for that model — those tokens are counted above and their dollars are not."]})]}):d.jsx("div",{className:"up-empty",children:M?d.jsxs(d.Fragment,{children:["No usage ",Z,".",d.jsx("br",{}),"Try a longer period."]}):d.jsxs(d.Fragment,{children:["No usage data yet.",d.jsx("br",{}),"Start a Claude Code or Codex session."]})})]})}const yq="1",k1="agent-dag.schema",wq=["agent-dag.layout","agent-dag.viewport"];function $u(e){if(typeof window>"u")return null;try{return window.localStorage.getItem(e)}catch{return null}}function xq(e,t=yq){let n=null;try{n=e.getItem(k1)}catch{return[]}if(n===t)return[];const s=[];if(n!==null)for(const i of wq)try{e.getItem(i)!==null&&(e.removeItem(i),s.push(i))}catch{}try{e.setItem(k1,t)}catch{}return s}const vt={l:30,r:6,t:6,b:2},Lu=104,bq=64;function mo(e,t=100,n=Lu){const s=n-vt.t-vt.b;return vt.t+s*(1-Math.max(0,Math.min(t,e))/t)}function _q(e,t,n,s=100,i=Lu){if(!e.length)return"";const a=e[e.length-1].t-e[0].t,l=p=>{const f=t-vt.l-vt.r;return vt.l+(a>0?f*(p-e[0].t)/a:f/2)};let u="",h=null;for(const p of e){const f=h&&p.t-h.t<=n*2?"L":"M";u+=`${f}${l(p.t).toFixed(1)} ${mo(p.v,s,i).toFixed(1)}`,h=p}return u}function kq(e,t,n,s=100,i=Lu){if(e.length<2)return"";const a=i-vt.b,l=e[e.length-1].t-e[0].t,u=t-vt.l-vt.r,h=y=>vt.l+(l>0?u*(y-e[0].t)/l:u/2);let p="",f=[];const g=()=>{if(f.length>=2){let y=`M${h(f[0].t).toFixed(1)} ${a}`;for(const w of f)y+=`L${h(w.t).toFixed(1)} ${mo(w.v,s,i).toFixed(1)}`;p+=`${y}L${h(f[f.length-1].t).toFixed(1)} ${a}Z`}f=[]};for(const y of e)f.length&&y.t-f[f.length-1].t>n*2&&g(),f.push(y);return g(),p}function Sq(e){return e.length?{now:e[e.length-1].v,peak:e.reduce((t,n)=>Math.max(t,n.v),e[0].v)}:{now:null,peak:null}}function Nq(e,t,n){return n!=null&&e>=n?"hot":t!=null&&e>=t?"warn":""}function Eq(e,t,n=s=>Ja(s)){const s=e.filter(l=>l.v>0);if(!e.length)return null;if(!s.length)return"never held back";const i=s.length*(t/6e4),a=s[s.length-1];return`held back for ${i===1?"1 minute":`${i} minutes`}, last at ${n(a.t)}`}function Ja(e){const t=new Date(e);return`${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}`}function ST(e,t){const n=Math.max(0,Math.floor((t-e)/6e4));if(n<1)return"less than a minute";if(n<60)return`${n} minute${n===1?"":"s"}`;const s=Math.floor(n/60),i=n%60;return i?`${s}h ${i}m`:`${s}h`}function jq({group:e,title:t,onClose:n}){const s=Sn(n),[i,a]=S.useState(null);S.useEffect(()=>{let p=!0;const f=async()=>{try{const y=await fetch(`/api/system/history?group=${e}`);if(!y.ok)return;const w=await y.json();p&&(w!=null&&w.ok)&&a(w)}catch{}};f();const g=window.setInterval(f,2e4);return()=>{p=!1,window.clearInterval(g)}},[e]);const l=(i==null?void 0:i.series)??[],[u,h]=S.useMemo(()=>{let p=1/0,f=0;for(const g of l)g.points.length&&(p=Math.min(p,g.points[0].t),f=Math.max(f,g.points[g.points.length-1].t));return[Number.isFinite(p)?Math.max(p,(i==null?void 0:i.sinceMs)??0):(i==null?void 0:i.sinceMs)??0,f]},[l,i==null?void 0:i.sinceMs]);return ow.createPortal(d.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:d.jsxs("div",{ref:s,className:"modal hist-modal",onClick:p=>p.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"hist-modal-title",children:[d.jsxs("div",{className:"modal-head",children:[d.jsx("span",{className:"modal-title",id:"hist-modal-title",children:t}),i&&u>0&&d.jsxs("span",{className:"hist-since",children:["since ",Ja(u)," · ",ST(u,h||Date.now())]}),d.jsx("button",{type:"button",className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),d.jsx("div",{className:"hist-body",children:i==null?d.jsx("p",{className:"hist-empty",children:"Reading…"}):l.length===0?d.jsx("p",{className:"hist-empty",children:"Nothing has been measured yet."}):l.map(p=>d.jsx(Cq,{series:p,stepMs:i.stepMs},p.label))})]})}),document.body)}function Cq({series:e,stepMs:t}){const n=S.useRef(null),[s,i]=S.useState(560),[a,l]=S.useState(null);S.useEffect(()=>{const O=n.current;if(!O||typeof ResizeObserver>"u")return;const F=new ResizeObserver(([M])=>i(Math.max(160,M.contentRect.width)));return F.observe(O),()=>F.disconnect()},[]);const{points:u,unit:h,warnAt:p,critAt:f,label:g,top:y,restsAtZero:w}=e,N=w?bq:Lu,{now:b,peak:_}=Sq(u),k=h==="C"?"°C":h,E=g==="Throttling"?Eq(u,t):null,j=a!=null?u[a]:null,C=u.length>1?u[u.length-1].t-u[0].t:0,I=O=>{const F=s-vt.l-vt.r;return vt.l+(C>0?F*(O-u[0].t)/C:F/2)},P=O=>{if(u.length<2)return;const F=O.currentTarget.getBoundingClientRect(),M=(O.clientX-F.left-vt.l)/Math.max(1,F.width-vt.l-vt.r),A=u[0].t+C*Math.max(0,Math.min(1,M));let q=0;for(let W=1;W<u.length;W++)Math.abs(u[W].t-A)<Math.abs(u[q].t-A)&&(q=W);l(q)};return d.jsxs("section",{className:"hist-series","aria-label":`${g} history`,children:[d.jsxs("div",{className:"hist-head",children:[d.jsx("span",{className:"hist-label",children:g}),d.jsxs("span",{className:"hist-stats",children:[b!=null&&d.jsxs(d.Fragment,{children:[d.jsx("b",{children:b}),d.jsxs("span",{children:[k," now"]})]}),_!=null&&d.jsxs(d.Fragment,{children:[d.jsx("b",{className:Nq(_,p,f),children:_}),d.jsxs("span",{children:[k," peak"]})]})]})]}),d.jsx("div",{className:"hist-plot",ref:n,children:d.jsxs("svg",{className:"hist-chart",width:"100%",height:N,viewBox:`0 0 ${s} ${N}`,preserveAspectRatio:"none",role:"img","aria-label":b==null?`${g}: nothing measured yet`:`${g}: ${b}${k} now, peak ${_}${k}, over ${ST(u[0].t,u[u.length-1].t)}`,onPointerMove:P,onPointerLeave:()=>l(null),children:[[["warn",p],["hot",f]].map(([O,F])=>F==null||F>y?null:d.jsxs("g",{children:[d.jsx("line",{className:`hist-rule ${O}`,x1:vt.l,x2:s-vt.r,y1:mo(F,y,N),y2:mo(F,y,N)}),d.jsx("text",{className:`hist-rule-tag ${O}`,x:2,y:mo(F,y,N)+3,children:F})]},O)),d.jsx("line",{className:"hist-floor",x1:vt.l,x2:s-vt.r,y1:N-vt.b,y2:N-vt.b}),d.jsx("path",{className:"hist-area",d:kq(u,s,t,y,N)}),d.jsx("path",{className:"hist-line",d:_q(u,s,t,y,N)}),u.length===1&&d.jsx("circle",{className:"hist-dot",cx:I(u[0].t),cy:mo(u[0].v,y,N),r:3}),j&&d.jsxs("g",{children:[d.jsx("line",{className:"hist-cross",x1:I(j.t),x2:I(j.t),y1:vt.t,y2:N-vt.b}),d.jsx("circle",{className:"hist-dot",cx:I(j.t),cy:mo(j.v,y,N),r:3})]})]})}),d.jsx("div",{className:"hist-axis",children:j?d.jsxs("span",{className:"hist-at",children:[Ja(j.t)," — ",d.jsx("b",{children:j.v}),k]}):d.jsxs(d.Fragment,{children:[d.jsx("span",{children:u.length?Ja(u[0].t):""}),d.jsx("span",{children:u.length?Ja(u[u.length-1].t):""})]})}),E&&d.jsx("div",{className:"hist-note",children:E})]})}function Tq({procs:e,total:t,onClose:n}){const s=Sn(n),[i,a]=S.useState(NT),l=By(e,i);return ow.createPortal(d.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:d.jsxs("div",{ref:s,className:"modal pl-modal",onClick:u=>u.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"pl-modal-title",children:[d.jsxs("div",{className:"modal-head",children:[d.jsx("span",{className:"modal-title",id:"pl-modal-title",children:"Busiest processes"}),d.jsxs("span",{className:"pl-count",children:[l.length," of ",t," running"]}),d.jsx("button",{type:"button",className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),d.jsx("div",{className:"pl-body",children:l.length===0?d.jsx("p",{className:"pl-empty",children:"Could not read the process list on this platform."}):d.jsxs("table",{className:"sd-procs pl-table",children:[d.jsx("thead",{children:d.jsxs("tr",{children:[d.jsx(Oi,{col:"cpu",label:"cpu",sort:i,onSort:a}),d.jsx(Oi,{col:"mem",label:"mem",sort:i,onSort:a}),d.jsx("th",{scope:"col",className:"pl-pid-h",children:"pid"}),d.jsx(Oi,{col:"name",label:"process",sort:i,onSort:a})]})}),d.jsx("tbody",{children:l.map(u=>d.jsxs("tr",{children:[d.jsx("td",{className:"sd-num",children:u.cpu==null?"—":u.cpu.toFixed(0)}),d.jsx("td",{className:"sd-num sd-dim",children:u.mem.toFixed(1)}),d.jsx("td",{className:"sd-num sd-dim pl-pid",children:u.pid}),d.jsx("td",{className:"pl-name",children:u.name})]},u.pid))})]})}),d.jsx("div",{className:"pl-foot",children:"The busiest by processor and by memory, refreshed every four seconds. Not every process on the machine."})]})}),document.body)}const Rq=3e3,Aq=4e3,Kf=20,Ua=36,Si=8,Mq=8,NT={key:"cpu",dir:"desc",rank:"cpu"};function Iq(e,t){return e.key===t?{...e,dir:e.dir==="asc"?"desc":"asc"}:{key:t,dir:t==="name"?"asc":"desc",rank:t==="name"?e.rank:t}}function By(e,t){const n=t.dir==="asc"?1:-1,s=(i,a)=>{if(t.key==="name")return n*i.name.localeCompare(a.name,void 0,{sensitivity:"base"});const l=t.key==="cpu"?i.cpu:i.mem,u=t.key==="cpu"?a.cpu:a.mem;return l==null||u==null?l==null?u==null?0:1:-1:n*(l-u)};return[...e].sort((i,a)=>s(i,a)||(a.cpu??-1)-(i.cpu??-1)||a.mem-i.mem||i.pid-a.pid)}function Oq(e,t,n=Mq){const s=By(e,{key:t.rank,dir:"desc",rank:t.rank});return By(s.slice(0,n),t)}function Pq(e,t){return e.key!==t?"none":e.dir==="asc"?"ascending":"descending"}function $q(e,t,n){return e>=n?"hot":e>=t?"warn":"calm"}function Lq(e,t,n=Date.now()){const s=Math.max(0,Math.min(100,100-e));return{pct:s,value:`${s}%`,tone:s===0?"calm":s>=30?"hot":"warn",note:s>0?`CPU held to ${e}% of full speed to cool down`:t?`at full speed · held to ${100-t.peak}% ${qq(t.lastMs,n)}`:"running at full speed, and never held back"}}function qq(e,t=Date.now()){const n=Math.max(0,Math.floor((t-e)/6e4));if(n<2)return"just now";if(n<60)return`${n} minutes ago`;const s=Math.floor(n/60);return s===1?"an hour ago":`${s} hours ago`}const ET="agent-dag.systemPanelOpen";function Dq(){return $u(ET)==="1"}function Fq(e){if(!(typeof window>"u"))try{window.localStorage.setItem(ET,e?"1":"0")}catch{}}function go(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 zq(e){const t=Math.floor(e/86400),n=Math.floor(e%86400/3600),s=Math.floor(e%3600/60);return t>0?`${t}d ${n}h`:n>0?`${n}h ${s}m`:`${s}m`}function Bq(){const[e,t]=S.useState(null),n=S.useRef(null);return S.useEffect(()=>{let s=!0;const i=async()=>{if(document.visibilityState!=="hidden")try{const h=await fetch("/api/system");if(!h.ok)return;const p=await h.json();s&&(p!=null&&p.ok)&&t(p)}catch{}},a=()=>{n.current==null&&(i(),n.current=window.setInterval(i,Rq))},l=()=>{n.current!=null&&(window.clearInterval(n.current),n.current=null)},u=()=>{if(document.visibilityState==="hidden"){l();return}a(),i()};return a(),document.addEventListener("visibilitychange",u),()=>{s=!1,l(),document.removeEventListener("visibilitychange",u)}},[]),e}function Uq(e){const[t,n]=S.useState(null);return S.useEffect(()=>{let s=!0;const i=async()=>{if(document.visibilityState!=="hidden")try{const l=await fetch("/api/system/processes");if(!l.ok)return;const u=await l.json();s&&(u!=null&&u.ok)&&n({procs:u.procs??[],total:u.total??0})}catch{}};i();const a=window.setInterval(i,Aq);return()=>{s=!1,window.clearInterval(a)}},[e]),t}function Wq({usageOpen:e=!1}){const t=Bq(),[n,s]=S.useState(Dq);S.useEffect(()=>{Fq(n)},[n]);const i=S.useRef(null),a=S.useRef(null);if(S.useEffect(()=>{if(n)return Ii.push(()=>{var k,E;const _=((k=a.current)==null?void 0:k.contains(document.activeElement))??!1;s(!1),_&&((E=i.current)==null||E.focus())},lT)},[n]),!t||t.cpu==null||!t.memory)return d.jsx("span",{className:"sysmeter idle",title:"Sampling this machine…",children:d.jsx("span",{className:"sm-box","aria-hidden":!0,children:d.jsxs("span",{className:"sm-graphic",children:[d.jsx("svg",{className:"sm-spark",width:Ua,height:Si,viewBox:`0 0 ${Ua} ${Si}`}),d.jsx("span",{className:"sm-ram"})]})})});const{cpu:l,cpuHistory:u,cores:h,memory:p,loadavg:f}=t,g=p.usedPct>=90,y=u.slice(-Kf),w=Kf-y.length,N=Ua/Kf,b=[`CPU ${l.toFixed(0)}% of ${h} cores`,f?`load ${f[0]} · ${f[1]} · ${f[2]} (1m · 5m · 15m)`:null,`Memory ${go(p.total-p.available)} of ${go(p.total)} used`,"","Click for detail. This machine, not this session."].filter(_=>_!==null).join(`
|
|
77
|
+
`);return d.jsxs("span",{className:"sysmeter-wrap",children:[d.jsxs("button",{type:"button",ref:i,className:"sysmeter",title:b,"aria-label":"Toggle machine detail","aria-expanded":n,"aria-controls":n?"system-panel":void 0,onClick:()=>s(_=>!_),children:[d.jsxs("span",{className:"sm-box","aria-hidden":!0,children:[d.jsxs("span",{className:"sm-graphic",children:[d.jsx("svg",{className:"sm-spark",width:Ua,height:Si,viewBox:`0 0 ${Ua} ${Si}`,children:y.map((_,k)=>{const E=w+k,j=Math.max(1,_/100*Si),C=.32+.68*((k+1)/y.length);return d.jsx("rect",{x:E*N,y:Si-j,width:Math.max(.8,N-.7),height:j,rx:.5,fill:"var(--accent)",opacity:C},E)})}),d.jsx("span",{className:"sm-ram",children:d.jsx("span",{className:`sm-ram-fill${g?" warn":""}`,style:{transform:`scaleX(${Math.max(2,p.usedPct)/100})`}})})]}),d.jsxs("span",{className:"sm-read",children:[d.jsx("b",{children:l.toFixed(0)}),d.jsx("i",{children:"·"}),d.jsx("b",{children:p.usedPct.toFixed(0)})]})]}),d.jsxs("span",{className:"sm-sr",children:["CPU ",l.toFixed(0)," percent, memory ",p.usedPct.toFixed(0)," percent used"]})]}),n&&d.jsx(Hq,{sys:t,usageOpen:e,panelRef:a,onClose:()=>{var _;s(!1),(_=i.current)==null||_.focus()}})]})}function Hq({sys:e,usageOpen:t,panelRef:n,onClose:s}){const i=Uq(!0),{memory:a,swap:l,perCore:u,loadavg:h,cores:p,uptimeSec:f,platform:g,thermal:y}=e,w=a?a.total-a.available:0,N=g==="win32"?"Commit":"Swap",b=l&&l.total>0?l.used/l.total*100:0;return d.jsxs("aside",{ref:n,className:`sysdetail${t?" shifted":""}`,id:"system-panel","aria-label":"Machine detail",children:[d.jsxs("div",{className:"sd-head",children:[d.jsx("span",{className:"sd-title",children:"This machine"}),d.jsxs("span",{className:"sd-sub",children:["up ",zq(f)," · ",p," cores"]}),d.jsx("button",{type:"button",className:"glyph-btn sd-close",onClick:s,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),u&&u.length>0&&d.jsx("div",{className:"sd-section",role:"group","aria-label":"Cores",children:d.jsx(cu,{group:"cores",title:"Core history",action:"Show core history",label:"Cores",children:d.jsx("div",{className:"sd-cores",style:{"--n":u.length},children:u.map((_,k)=>d.jsx("span",{className:"sd-core",title:`core ${k+1}: ${_}%`,children:d.jsx("span",{className:"sd-core-fill",style:{transform:`scaleY(${Math.max(2,_)/100})`}})},k))})})}),d.jsx("div",{className:"sd-section",role:"group","aria-label":"Memory",children:d.jsxs(cu,{group:"memory",title:"Memory history",action:"Show memory history",label:"Memory",children:[a&&d.jsx(ku,{label:"Physical",value:d.jsxs(d.Fragment,{children:[d.jsx("b",{children:go(w)})," of ",go(a.total)]}),pct:a.usedPct,tone:a.usedPct>=90?"warn":"calm",note:`${go(a.available)} available`}),l&&l.total>0&&d.jsx(ku,{label:N,value:d.jsxs(d.Fragment,{children:[d.jsx("b",{children:go(l.used)})," of ",go(l.total)]}),pct:b,tone:b>=90?"warn":"calm",note:b>=50?"paging to disk":void 0})]})}),h&&d.jsx("div",{className:"sd-section",role:"group","aria-label":"Load average",children:d.jsxs(cu,{group:"load",title:"Load history",action:"Show load history",label:"Load average",children:[d.jsx("div",{className:"sd-load",children:h.map((_,k)=>d.jsxs("span",{className:`sd-load-item${_>p?" over":""}`,children:[d.jsx("b",{children:_.toFixed(2)}),d.jsx("span",{children:["1m","5m","15m"][k]})]},k))}),d.jsx("div",{className:"sd-note",children:h[0]>p?`${(h[0]/p).toFixed(1)}× more work queued than cores to run it`:`within ${p} cores`})]})}),d.jsx(Gq,{thermal:y}),d.jsx(Vq,{read:i})]})}function cu({group:e,title:t,action:n,label:s,children:i}){const[a,l]=S.useState(!1);return d.jsxs(d.Fragment,{children:[d.jsxs("button",{type:"button",className:"sd-open",onClick:()=>l(!0),title:n,"aria-label":n,children:[d.jsxs("div",{className:"sd-h","aria-hidden":!0,children:[s," ",d.jsx("i",{className:"sd-row-more",children:"›"})]}),i]}),a&&d.jsx(jq,{group:e,title:t,onClose:()=>l(!1)})]})}function Gq({thermal:e}){if(!e)return null;const t=e.throttle?Lq(e.throttle.speedLimit,e.heldBack):null;return d.jsx("div",{className:"sd-section",role:"group","aria-label":"Thermal",children:d.jsxs(cu,{group:"thermal",title:"Thermal history",action:"Show thermal history",label:"Thermal",children:[e.celsius.map(n=>d.jsx(ku,{label:n.label,value:d.jsxs(d.Fragment,{children:[d.jsx("b",{children:n.celsius})," °C"]}),pct:n.celsius,tone:$q(n.celsius,n.warnAt,n.critAt)},n.label)),t&&d.jsx(ku,{label:"Throttling",value:t.value,pct:t.pct,tone:t.tone,note:t.note})]})})}function Vq({read:e}){const[t,n]=S.useState(NT),[s,i]=S.useState(!1),a=(e==null?void 0:e.procs)??null;return d.jsxs("div",{className:"sd-section",role:"group","aria-label":"Busiest processes",children:[d.jsxs("div",{className:"sd-hrow",children:[d.jsx("div",{className:"sd-h","aria-hidden":!0,children:"Busiest processes"}),a!=null&&a.length>0&&d.jsxs("button",{type:"button",className:"sd-all",onClick:()=>i(!0),title:"Show every process the deck is watching","aria-label":"Show every process the deck is watching",children:["more ",d.jsx("i",{className:"sd-row-more","aria-hidden":!0,children:"›"})]})]}),s&&e&&d.jsx(Tq,{procs:e.procs,total:e.total,onClose:()=>i(!1)}),a==null?d.jsx("div",{className:"sd-note",children:"reading…"}):a.length===0?d.jsx("div",{className:"sd-note",children:"Could not read the process list on this platform."}):d.jsxs("table",{className:"sd-procs",children:[d.jsx("thead",{children:d.jsxs("tr",{children:[d.jsx(Oi,{col:"cpu",label:"cpu",sort:t,onSort:n}),d.jsx(Oi,{col:"mem",label:"mem",sort:t,onSort:n}),d.jsx(Oi,{col:"name",label:"process",sort:t,onSort:n})]})}),d.jsx("tbody",{children:Oq(a,t).map(l=>d.jsxs("tr",{children:[d.jsx("td",{className:"sd-num",children:l.cpu==null?"—":l.cpu.toFixed(0)}),d.jsx("td",{className:"sd-num sd-dim",children:l.mem.toFixed(1)}),d.jsx("td",{className:"sd-proc-name",title:`pid ${l.pid}`,children:l.name})]},l.pid))})]})]})}function Oi({col:e,label:t,sort:n,onSort:s}){const i=Pq(n,e);return d.jsx("th",{scope:"col","aria-sort":i,children:d.jsxs("button",{type:"button",className:"sd-sort",title:`Sort by ${t}`,onClick:()=>s(Iq(n,e)),children:[t,d.jsx("span",{className:"sd-sort-dir","aria-hidden":!0,children:i==="none"?"":i==="ascending"?"↑":"↓"})]})})}function ku({label:e,value:t,pct:n,tone:s="calm",note:i}){return d.jsxs("div",{className:"sd-row",children:[d.jsxs("div",{className:"sd-row-head",children:[d.jsx("span",{className:"sd-row-label",children:e}),d.jsx("span",{className:"sd-row-val",children:t})]}),d.jsx("span",{className:"sd-track",children:d.jsx("span",{className:`sd-fill${s==="calm"?"":` ${s}`}`,style:{transform:`scaleX(${n<=0?0:Math.max(1,Math.min(100,n))/100})`}})}),i&&d.jsx("div",{className:"sd-note",children:i})]})}const S1=18,Yq=1100,Ni=(e,t)=>{const n=Math.sin(e*12.9898+t*78.233)*43758.5453;return n-Math.floor(n)},Kq=Array.from({length:S1},(e,t)=>{const n=-72+144*t/(S1-1)+(Ni(t,1)-.5)*9,s=(n-90)*(Math.PI/180),i=(54+32*Math.cos(n*Math.PI/180))*(.74+Ni(t,2)*.52);return{dx:Math.cos(s)*i,dy:Math.sin(s)*i,rot:(t%2?1:-1)*(100+Ni(t,3)*260),delay:Math.round(Ni(t,4)*90),dur:760+Math.round(Ni(t,5)*260),scale:.8+Ni(t,6)*.45,hue:t%4,round:t%3===0}});function N1({anchor:e}){var i;const[t,n]=S.useState(null),s=typeof window<"u"&&((i=window.matchMedia)==null?void 0:i.call(window,"(prefers-reduced-motion: reduce)").matches);return S.useEffect(()=>{if(s)return;const a=e.current;if(!a)return;const l=a.getBoundingClientRect();n({x:l.left+l.width/2,y:l.top+l.height/2});const u=window.setTimeout(()=>n(null),Yq);return()=>window.clearTimeout(u)},[e,s]),s||!t?null:ow.createPortal(d.jsx("div",{className:"confetti",style:{left:`${t.x}px`,top:`${t.y}px`},"aria-hidden":!0,children:Kq.map((a,l)=>d.jsx("span",{className:`confetti-bit${a.round?" round":""}`,"data-hue":a.hue,style:{"--dx":`${a.dx.toFixed(1)}px`,"--dy":`${a.dy.toFixed(1)}px`,"--rot":`${a.rot}deg`,"--s":a.scale.toFixed(2),animationDelay:`${a.delay}ms`,animationDuration:`${a.dur}ms, ${a.dur}ms`}},l))}),document.body)}const jT=new Set(["awaiting_url","awaiting_code","registering"]);function Xq(e){return e!=null&&jT.has(e)}function CT(e){return e!=null&&e!=="done"&&!jT.has(e)}const Qq="the sign-in ended before it finished — the deck restarted, or it was cancelled in another tab",Zq="the sign-in did not complete";function Jq({state:e,serverError:t,localError:n}){const s=e==="idle";return{title:s?"Sign-in ended":"Sign-in failed",message:n||t||(s?Qq:Zq)}}const e4="done";function t4(){let e=!1;return{shouldAnnounce(t){return t!==e4?(e=!1,!1):e?!1:(e=!0,!0)}}}function Nw(e,t){return t&&Object.hasOwn(e,t)?e[t]:void 0}const n4={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 ccdeck2:",corrupt:"that share is incomplete — copy the whole thing",wrong_version:`that share was made by a newer ${zt}`,expired:"that share has expired — make a new one",import_failed:"claude-swap refused the import",unreadable_export:"claude-swap wrote something this deck could not read — try again, and upgrade it if this repeats",mixed_versions:"claude-swap changed format part-way through — try again",nothing_to_share:"none of those accounts could be exported",too_many:"that is more accounts than one share can carry",not_in_bundle:"that account is not in this share",bad_value:"an alias can only use letters, numbers, spaces, dots, dashes and underscores, up to 64 characters, and cannot start with a dash",bad_email:"that does not look like an email address — it cannot contain spaces or start with a dash"},r4={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"},s4=`claude-swap could not read the login keychain — start ${zt} from a Terminal window rather than a background service`;function Uy(e,t){if((e==null?void 0:e.reason)!=="no_cswap"&&/keychain/i.test(Fi(e)))return s4;const n=Nw(r4,e==null?void 0:e.reason);return n||(e==null?void 0:e.reason)||t}function Fi(e){return((e==null?void 0:e.output)||(e==null?void 0:e.detail)||(e==null?void 0:e.error)||"").trim()}const o4={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"},i4="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 a4(e){return/\bnpx\b/i.test(e)&&/(command not found|not found|not recognized|ENOENT)/i.test(e)}const l4="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",c4="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",u4=e=>/\b(?:ERR_)?MODULE_NOT_FOUND\b|cannot find (?:module|package)/i.test(e),d4=/node_modules[\\/]npm[\\/]bin[\\/]|\bnpm-prefix\.js\b|\bnp[mx][-.][\w.-]*cli\.js\b/i,f4=/[\\/]_npx[\\/]/i,h4=`the copy of ccusage ${zt} installed for itself`;function p4(e){const t=String((e==null?void 0:e.install)??"").replace(/\s+/g," ").trim();return t.length>240?`${t.slice(0,239)}…`:t}function m4(e,t){const n=g4(e,t),s=p4(e);switch(e==null?void 0:e.stage){case"npx":return s?`ccusage failed on both of its paths. The managed install failed first — ${s} — and the deck then fell back to npx, where ${Wa(n)}`:`there is no managed copy of ccusage on this machine, and the npx fallback failed: ${Wa(n)}`;case"managed":return`${h4} failed to run: ${Wa(n)}`;case"path":return e.bin?`the ccusage this deck found at ${e.bin} failed to run: ${Wa(n)}`:`the ccusage this deck found on your PATH failed to run: ${Wa(n)}`;default:return n}}const Wa=e=>/^[A-Z][a-z]/.test(e)?e[0].toLowerCase()+e.slice(1):e;function g4(e,t){const n=Fi(e);if(u4(n)){if(f4.test(n))return c4;if(d4.test(n))return l4}if(a4(n))return i4;const s=Nw(o4,e==null?void 0:e.reason);return s||(e==null?void 0:e.reason)||t}function Ti(e,t){if(e!=null&&e.detail)return e.detail;if(e!=null&&e.error&&CT(e.state))return e.error;const n=Nw(n4,e==null?void 0:e.reason);return n||(e!=null&&e.error?e.error:(e==null?void 0:e.reason)||t)}function v4(e,t,n){if(n<=0||xw(e))return{kind:"pass"};const s=t>=0&&t<n?t:-1;switch(e.key){case"ArrowRight":return{kind:"select",index:s===-1?0:(s+1)%n};case"ArrowLeft":return{kind:"select",index:s===-1?n-1:(s-1+n)%n};case"Home":return{kind:"select",index:0};case"End":return{kind:"select",index:n-1};default:return{kind:"pass"}}}function TT(e,t){const n=Math.round(e/1e3)-t;return n<=0?{text:"expired",tone:"gone"}:n<60?{text:`expires in ${n}s`,tone:"soon"}:{text:`expires in ${Math.round(n/60)}m`,tone:"ok"}}function y4(e){const t=new Map;for(const n of e){const s=(n.email??"").trim().toLowerCase();s&&t.set(s,(t.get(s)??0)+1)}return e.map(n=>{const s=(n.email??"").trim(),i=n.alias||s||`account ${n.num}`,a=[];return n.alias&&s&&a.push(s),s&&(t.get(s.toLowerCase())??0)>1&&a.push(n.org||`slot ${n.num}`),{num:n.num,label:i,sub:a.length?a.join(" · "):null}})}function w4(e){return e<=0?"Nothing picked yet.":e===1?"1 account — its sign-in token will be on your clipboard.":`${e} accounts — ${e} sign-in tokens will be on your clipboard.`}function x4(e){switch(e){case"imported":return"imported";case"healed":return"dead token replaced";case"updated":return"updated";case"present":return"already here";default:return"not imported"}}function b4(e){const t=e.length;if(!t)return"Nothing to import.";const n=p=>e.filter(f=>f.state===p).length,s=[],i=n("imported");i&&s.push(`${i} of ${t} imported`);const a=n("healed");a&&s.push(`${a} had a dead token replaced`);const l=n("updated");l&&s.push(`${l} updated`);const u=n("present");u&&s.push(`${u} already here`);const h=n("failed");return h&&s.push(`${h} did not arrive`),`${s.join(", ")}.`}const _4=1500,Xc=[{id:"login",label:"Sign in"},{id:"paste",label:"Paste a share"}],E1="aa-panel",j1=e=>`aa-tab-${e}`;async function Ha(e){return(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json().catch(()=>null)}const Wy=de.forwardRef((e,t)=>d.jsxs("svg",{className:"aa-mark",viewBox:"0 0 44 44","aria-hidden":!0,ref:t,children:[d.jsx("circle",{className:"aa-mark-ring",cx:"22",cy:"22",r:"20"}),d.jsx("path",{className:"aa-mark-tick",d:"M13.5 22.5 L19.5 28.5 L31 17"})]}));Wy.displayName="SuccessMark";function k4({onClose:e,onChanged:t}){const[n,s]=S.useState("login"),[i,a]=S.useState(null),[l,u]=S.useState(""),[h,p]=S.useState(""),[f,g]=S.useState(!1),[y,w]=S.useState(null),[N,b]=S.useState(null),[_,k]=S.useState(null),[E,j]=S.useState(null),C=S.useRef(""),I=S.useRef(!1),P=S.useRef(!1),O=S.useRef(null),F=S.useRef(null),M=S.useRef(null),A=S.useRef(null),q=S.useRef([]),W=S.useRef(!1),Y=S.useCallback(()=>{I.current&&Ha({action:"login-cancel"}).catch(()=>{}),e()},[e]),T=Sn(Y,{focusRef:M}),Z=S.useCallback(async()=>{if(!ar(P.current))return;P.current=!0,g(!0),w(null),I.current=!0;const L=await Ha({action:"login"}).catch(()=>null);if(P.current=!1,g(!1),!(L!=null&&L.ok)){w(Ti(L,"could not start the sign-in"));return}a(L)},[]);S.useEffect(()=>{if(!Xq(i==null?void 0:i.state))return;const L=window.setInterval(async()=>{try{const K=await fetch("/api/claude-accounts/login");K.ok&&a(await K.json())}catch{}},_4);return()=>window.clearInterval(L)},[i]);const U=S.useRef(t);U.current=t;const ne=S.useState(t4)[0];S.useEffect(()=>{var L;(i==null?void 0:i.state)==="awaiting_code"&&((L=O.current)==null||L.focus()),ne.shouldAnnounce(i==null?void 0:i.state)&&U.current()},[i==null?void 0:i.state,ne]),S.useEffect(()=>{var L;n==="paste"&&!W.current&&((L=F.current)==null||L.focus()),W.current=!1},[n]);const X=S.useCallback(L=>{var se;const K=v4(L,Xc.findIndex(he=>he.id===n),Xc.length);K.kind!=="pass"&&(L.preventDefault(),W.current=!0,s(Xc[K.index].id),(se=q.current[K.index])==null||se.focus())},[n]),H=S.useCallback(async()=>{var K;if(!ar(P.current))return;P.current=!0,g(!0),w(null);const L=await Ha({action:"login-code",code:l}).catch(()=>null);if(P.current=!1,g(!1),!(L!=null&&L.ok)){w(Ti(L,"the code was not accepted")),L!=null&&L.state&&a(L),(K=O.current)==null||K.select();return}u(""),a(L)},[l,i]),J=S.useCallback(async()=>{if(!ar(P.current))return;P.current=!0,g(!0),w(null);const L=await Ha({action:"import",blob:h}).catch(()=>null);if(P.current=!1,g(!1),!(L!=null&&L.ok)){w(Ti(L,"the import failed"));return}C.current=h,p(""),j(null),b(L.results??[]),t()},[h,t]),$=S.useCallback(async L=>{const K=`${L.email}|${L.org??""}`;if(!ar(P.current)||!C.current)return;P.current=!0,g(!0),k(K),j(null);const se=await Ha({action:"import",blob:C.current,force:!0,only:{email:L.email,org:L.org??""}}).catch(()=>null);if(P.current=!1,g(!1),k(null),!(se!=null&&se.ok)){j({key:K,text:Ti(se,"that account could not be updated")});return}const he=(se.results??[])[0];he&&b(pe=>pe&&pe.map(re=>`${re.email}|${re.org??""}`===K?he:re)),t()},[t]),G=(i==null?void 0:i.state)==="done"?i.account:null,Q=CT(i==null?void 0:i.state)||!!(y&&I.current&&!f),D=Jq({state:i==null?void 0:i.state,serverError:i==null?void 0:i.error,localError:y});return d.jsx("div",{className:"modal-backdrop",onClick:Y,role:"presentation",children:d.jsxs("div",{ref:T,className:"modal aa-modal",onClick:L=>L.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Add a Claude account",children:[d.jsxs("header",{className:"modal-head",children:[d.jsx("div",{className:"modal-title",children:d.jsx("span",{className:"aa-tabs",role:"tablist","aria-label":"How to add the account",onKeyDown:X,children:Xc.map((L,K)=>d.jsx("button",{type:"button",role:"tab",id:j1(L.id),ref:se=>{q.current[K]=se},"aria-selected":n===L.id,"aria-controls":E1,tabIndex:n===L.id?0:-1,className:`aa-tab${n===L.id?" on":""}`,onClick:()=>{W.current=!1,s(L.id)},children:L.label},L.id))})}),d.jsx("div",{className:"modal-actions",children:d.jsx("button",{type:"button",className:"glyph-btn",onClick:Y,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),d.jsx("section",{className:"modal-body aa-body",id:E1,role:"tabpanel","aria-labelledby":j1(n),children:n==="login"?G?d.jsxs("div",{className:"aa-done",children:[d.jsx(Wy,{ref:A}),d.jsx(N1,{anchor:A}),d.jsx("h4",{children:G.added?`Account ${G.num} added`:"Credentials refreshed"}),d.jsxs("p",{className:"aa-note",children:[d.jsx("strong",{children:G.email}),G.added?" is in the rotation. The account you were using is still active.":" was already managed, so its stored credentials were replaced."]}),d.jsx("button",{type:"button",className:"btn primary",onClick:e,children:"Done"})]}):(i==null?void 0:i.state)==="awaiting_code"||(i==null?void 0:i.state)==="registering"?d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"aa-step",children:[d.jsx("h4",{children:"1 · Approve in the browser"}),d.jsx("p",{className:"aa-note",children:"A tab should have opened. If not, use this link:"}),d.jsx("a",{className:"aa-link",href:i.url??"#",target:"_blank",rel:"noreferrer noopener",children:i.url})]}),d.jsxs("div",{className:"aa-step",children:[d.jsx("h4",{children:"2 · Paste a code, if the page shows one"}),d.jsx("p",{className:"aa-note",children:"It usually finishes on its own — if the page says you are all set, there is nothing to do here."}),d.jsxs("div",{className:"aa-field",children:[d.jsx("input",{ref:O,type:"text",value:l,onChange:L=>u(L.target.value),onKeyDown:L=>{L.key==="Enter"&&l.trim()&&!f&&H()},placeholder:"paste the code here",spellCheck:!1,autoComplete:"off","aria-label":"Sign-in code",disabled:i.state==="registering"}),d.jsx("button",{type:"button",className:"btn primary",...ir(f,!l.trim()||i.state==="registering"),onClick:H,children:i.state==="registering"?"registering…":"Continue"})]}),(y||i.error)&&d.jsx("p",{className:"aa-err",children:y??i.error}),d.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."})]})]}):Q?d.jsxs("div",{className:"aa-step",children:[d.jsx("h4",{children:D.title}),d.jsx("p",{className:"aa-err",children:D.message}),d.jsx("button",{type:"button",className:"btn",onClick:()=>{I.current=!1,a(null),w(null),Z()},children:"Try again"})]}):f||I.current?d.jsx("div",{className:"aa-step",children:d.jsx("p",{className:"aa-note",children:"Asking the claude CLI for a sign-in link…"})}):d.jsxs("div",{className:"aa-step aa-primer",children:[d.jsx("h4",{children:"Sign in to Anthropic"}),d.jsx("p",{className:"aa-note",children:"Opens a browser tab where you approve the sign-in. It normally completes by itself; only if the page hands you a code does it need pasting back here. claude-swap records the account when it completes, and the account you are using now stays active."}),d.jsx("div",{className:"aa-actions",children:d.jsx("button",{type:"button",ref:M,className:"btn primary",onClick:Z,children:"Open the sign-in page"})})]}):N?(()=>{const L=N.filter(K=>K.state==="imported").length;return d.jsxs("div",{className:"aa-done",children:[d.jsx(Wy,{ref:A}),L>0&&d.jsx(N1,{anchor:A}),d.jsx("h4",{children:b4(N)}),N.length>0&&d.jsx("ul",{className:"aa-results",children:N.map(K=>{const se=`${K.email}|${K.org??""}`;return d.jsxs("li",{className:`aa-result ${K.state}`,children:[d.jsx("span",{className:"aa-result-who",children:K.email||(K.num?`slot ${K.num}`:"an account")}),d.jsx("span",{className:"aa-result-what",children:x4(K.state)}),K.state==="present"&&d.jsx("button",{type:"button",className:"aa-result-fix","aria-busy":_===se,title:`Overwrite the stored login for ${K.email} with the one in this share. Do this when that account has stopped working here; if it works, leave it.`,onClick:()=>$(K),children:_===se?"updating…":"update anyway"}),(E==null?void 0:E.key)===se&&d.jsx("span",{className:"aa-result-err",children:E.text})]},se)})}),d.jsxs("p",{className:"aa-note",children:["Nothing changed on the deck you copied this from. An account already here is left as it is, unless its stored login was dead or you pressed",d.jsx("strong",{children:" update anyway"}),"."]}),d.jsxs("div",{className:"aa-actions",children:[d.jsx("button",{type:"button",className:"btn primary",onClick:e,children:"Done"}),d.jsx("button",{type:"button",className:"btn",onClick:()=>{C.current="",j(null),b(null)},children:"Import another"})]})]})})():d.jsxs("div",{className:"aa-step",children:[d.jsx("h4",{children:"Paste an account shared from another deck"}),d.jsxs("div",{className:"aa-field",children:[d.jsx("input",{ref:F,type:"text",value:h,onChange:L=>p(L.target.value),onKeyDown:L=>{L.key==="Enter"&&h.trim()&&!f&&J()},placeholder:"ccdeck2:…",spellCheck:!1,autoComplete:"off","aria-label":"Shared account"}),d.jsx("button",{type:"button",className:"btn primary",...ir(f,!h.trim()),onClick:J,children:f?"importing…":"Import"})]}),y&&d.jsx("p",{className:"aa-err",children:y}),d.jsxs("p",{className:"aa-note",children:["Use ",d.jsx("strong",{children:"share"})," on one account in the other deck, or ",d.jsx("strong",{children:"↗"})," above its list to send several at once. A share carries a live login for every account in it and expires ten minutes after it is made."]})]})})]})})}async function S4(e){return(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json().catch(()=>null)}const N4=1800;function E4({accounts:e,onClose:t,copyText:n}){const[s,i]=S.useState([]),[a,l]=S.useState(null),[u,h]=S.useState(!1),[p,f]=S.useState(null),[g,y]=S.useState(!1),[w,N]=S.useState(()=>Math.floor(Date.now()/1e3)),b=S.useRef(null),_=S.useRef(!1),k=Sn(t,{focusRef:b});S.useEffect(()=>{if(!a)return;N(Math.floor(Date.now()/1e3));const A=window.setInterval(()=>N(Math.floor(Date.now()/1e3)),1e3);return()=>window.clearInterval(A)},[a]);const E=y4(e),j=e.filter(A=>!s.includes(A.num)).map(A=>A.num),C=j.length===e.length,I=A=>i(q=>q.includes(A)?q.filter(W=>W!==A):[...q,A]),P=S.useCallback(async()=>{if(!ar(_.current)||!j.length)return;_.current=!0,h(!0),f(null),y(!1);const A=await S4({action:"share",accounts:j}).catch(()=>null);if(_.current=!1,h(!1),!(A!=null&&A.ok)){f(Ti(A,"the share could not be made"));return}l({blob:A.blob,expiresAt:A.expiresAt,shared:A.shared??[],failed:A.failed??[]})},[e,j]),O=a?TT(a.expiresAt,w):null,F=(O==null?void 0:O.tone)==="gone",M=(a==null?void 0:a.shared.length)??0;return d.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:d.jsxs("div",{ref:k,className:"modal sa-modal",onClick:A=>A.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Share accounts with another deck",children:[d.jsxs("header",{className:"modal-head",children:[d.jsx("div",{className:"modal-title",children:d.jsx("h3",{children:"Share accounts"})}),d.jsx("div",{className:"modal-actions",children:d.jsx("button",{type:"button",className:"glyph-btn",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),d.jsx("section",{className:"modal-body sa-body",children:a?d.jsxs("div",{className:"sa-step",children:[d.jsx("h4",{children:F?"This share has expired":M===1?"1 account, ready to paste":`${M} accounts, ready to paste`}),d.jsx("code",{className:`ap-share-blob${F?" sa-dead":""}`,children:a.blob}),d.jsxs("div",{className:"ap-share-foot",children:[d.jsx("button",{type:"button",className:"ap-manage-btn",ref:b,onClick:async()=>{if(F){l(null),P();return}await n(a.blob)&&(y(!0),window.setTimeout(()=>y(!1),N4))},children:F?"make a new share":g?"copied":`copy ${M===1?"the share":"all "+M}`}),d.jsxs("span",{className:"ap-manage-hint",title:"This text is the sign-in for every account in it. It is base64 of plain JSON — the expiry inside it is not signed, so anyone holding a copy can change it, and the logins themselves are 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 those accounts out and back in.",children:[d.jsx("span",{className:"ap-share-warn",children:M===1?"this is the password":`this is ${M} passwords`})," · ",d.jsx("span",{className:`ap-share-expiry ${O==null?void 0:O.tone}`,children:O==null?void 0:O.text})]})]}),a.failed.length>0&&d.jsxs("div",{className:"sa-failed",role:"alert",children:[d.jsx("p",{className:"sa-failed-head",children:a.failed.length===1?"One account is not in this bundle:":`${a.failed.length} accounts are not in this bundle:`}),d.jsx("ul",{className:"sa-list",children:a.failed.map(A=>{var W;const q=!!(A.email&&((W=A.detail)!=null&&W.includes(A.email)));return d.jsxs("li",{children:[!q&&d.jsx("span",{className:"sa-who",children:A.email||`account ${A.num}`}),d.jsx("span",{className:"sa-why",children:A.detail||"could not be exported"})]},`${A.num}-${A.email}`)})})]}),d.jsx("p",{className:"sa-note",children:F?d.jsx(d.Fragment,{children:"Another deck will refuse this text now. Make a new one — the same accounts are still picked."}):d.jsxs(d.Fragment,{children:["Paste it into the other deck with ",d.jsx("strong",{children:"+"})," → ",d.jsx("strong",{children:"Paste a share"}),". Accounts it already holds are left exactly as they are."]})}),d.jsxs("div",{className:"sa-actions",children:[d.jsx("button",{type:"button",className:"btn",onClick:()=>{l(null),y(!1)},children:"Pick again"}),d.jsx("button",{type:"button",className:"btn primary",onClick:t,children:"Done"})]})]}):e.length===0?d.jsxs("div",{className:"sa-step",children:[d.jsx("h4",{children:"Nothing to share"}),d.jsxs("p",{className:"sa-note",children:["This deck is not holding any accounts right now. Sign one in with ",d.jsx("strong",{children:"+"}),", or wait — the panel is still reading the store."]}),d.jsx("div",{className:"sa-actions",children:d.jsx("button",{type:"button",className:"btn primary",ref:b,onClick:t,children:"Close"})})]}):d.jsxs("div",{className:"sa-step",children:[d.jsxs("h4",{children:["Which accounts go to the other ",zt,"?"]}),d.jsx("p",{className:`sa-count${j.length?"":" empty"}`,children:w4(j.length)}),d.jsx("ul",{className:"sa-list sa-pick",children:E.map(A=>d.jsx("li",{children:d.jsxs("label",{className:"sa-row",children:[d.jsx("input",{type:"checkbox",checked:j.includes(A.num),onChange:()=>I(A.num)}),d.jsx("span",{className:"sa-who",children:A.label}),A.sub&&d.jsx("span",{className:"sa-sub",children:A.sub})]})},A.num))}),p&&d.jsx("p",{className:"aa-err",children:p}),d.jsxs("div",{className:"sa-actions",children:[d.jsx("button",{type:"button",className:"btn",onClick:()=>i(C?e.map(A=>A.num):[]),children:C?"Clear all":"Select all"}),d.jsx("button",{type:"button",className:"btn primary",ref:b,...ir(u,!j.length),onClick:P,children:u?"making the share…":j.length===0?"Share":j.length===1?"Share 1 account":`Share ${j.length} accounts`})]})]})})]})})}function j4(e,t){const n=new Set(e),s=e.length?Math.max(...e):0;return[...new Set([...e,s+1])].sort((i,a)=>i-a).map(i=>{const a=i===t?"here":n.has(i)?"swap":"free";return{slot:i,kind:a,label:a==="here"?`slot ${i}`:`slot ${i} · ${a}`}})}function C4(e,t,n){if(!(n!=null&&n.ok))return null;const s=Number.isInteger(n.to)?n.to:null;if(s==null)return{menuFor:null,confirmRemove:null,shareFor:null,swapNote:null};const i=n.swapped===!0&&s!==t;return{menuFor:e.menuFor===t?s:i&&e.menuFor===s?t:e.menuFor,confirmRemove:null,shareFor:null,swapNote:i?{at:s,displaced:t}:null}}function T4(e,t,n){return t!=null&&e.some(s=>s.slot===t)?t:n}function R4(e,t,n){var i;const s=((i=e.find(a=>a.slot===t))==null?void 0:i.kind)??"here";return s==="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 ${n}.`}:s==="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 ${n}.`}}function A4(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 C1(e){return typeof e.id=="string"&&e.id.startsWith("scoped-")}function T1(e){const t=e.filter(u=>!C1(u)),n=e.filter(u=>C1(u)),s=t.length?t:n,i=t.length?n:[],a=s.reduce((u,h)=>u&&u.pct>=h.pct?u:h,null);let l=null;for(const u of i)a&&u.pct<=a.pct||(!l||u.pct>l.pct)&&(l=u);return{shown:s,rest:i,fuller:l,peak:l??a}}function M4(e,t,n){return e<1?null:t?"fewer":n?`${n.label} ${Math.round(n.pct)}%`:`${e} more`}function I4(e,t,n,s){const i=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=n===1?"the other window":`the other ${n} windows`;return`${i} ${s?"Hide":"Show"} ${a}.`}const O4="\0";function Ew(e){const t=typeof e.email=="string"?e.email.trim():"";if(!t)return`slot:${e.num}`;const n=typeof e.org=="string"?e.org.trim():"";return`acct:${t}${O4}${n}`}function P4(e,t){const n=Ew(t);return e.includes(n)?e.filter(s=>s!==n):[...e,n]}function $4(e,t){if(!Array.isArray(t))return e;const n=new Set(t.map(Ew)),s=e.filter(i=>n.has(i));return s.length===e.length?e:s}const L4=64;function q4(e,t){const n=e.trim();return{alias:n,commit:n!==(t??"").trim()}}const D4=Object.freeze({text:"couldn't reach the deck server",reload:!0});async function R1(e){return e.ok?{ok:!0,status:e.status,body:null}:{ok:!1,status:e.status,body:await e.json().catch(()=>null)}}function F4(e){const t=e.find(s=>!s.ok);if(!t)return null;const n=Fi(t.body);return{text:Uy(t.body,`the deck server answered ${t.status}`),...n?{raw:n}:{},reload:!0}}function A1(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,z4=8e3,Xf=1800,B4=3e4,U4=[70,80,85,90,95];function I1(e,t){return wT(t-Math.floor(e/1e3))}function W4(e,t){if(!e)return"";const n=Math.floor(e/1e3)-t;return n<=0?" · due":n<60?` · next in ${n}s`:` · next in ${Math.round(n/60)}m`}function H4(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 O1({lane:e,nowSec:t}){const n=Math.min(100,Math.max(0,e.pct)),s=n>=90?"var(--err)":n>=70?"var(--warn)":"var(--accent)",i=e.resetAt?xT(e.resetAt,t):null;return d.jsxs("div",{className:"ap-lane",children:[d.jsx("span",{className:"ap-lane-label",children:e.label}),d.jsx("div",{className:"ap-lane-track",children:d.jsx("div",{className:"ap-lane-fill",style:{width:`${n===0?1.5:n}%`,background:s,opacity:n===0?.4:1}})}),d.jsxs("span",{className:"ap-lane-pct",style:{color:s},children:[n,"%"]}),d.jsx("span",{className:"ap-lane-reset",children:i?`resets ${i}`:""})]})}async function P1(e){var n;let t=!1;try{t=await Promise.race([((n=navigator.clipboard)==null?void 0:n.writeText(e).then(()=>!0))??Promise.resolve(!1),new Promise(s=>window.setTimeout(()=>s(!1),500))])}catch{t=!1}if(t)return!0;try{const s=document.createElement("textarea");s.value=e,s.setAttribute("readonly",""),s.style.cssText="position:fixed;top:0;left:0;opacity:0",document.body.appendChild(s),s.select(),t=document.execCommand("copy"),s.remove()}catch{t=!1}return t}function G4({onClose:e}){var Xe,_t,Oe,it,Mt;const[t,n]=S.useState(null),[s,i]=S.useState(null),[a,l]=S.useState(null),[u,h]=S.useState(!1),[p,f]=S.useState(null),[g,y]=S.useState(()=>Math.floor(Date.now()/1e3)),w=S.useRef(null),[N,b]=S.useState(null),[_,k]=S.useState(!1),[E,j]=S.useState(""),[C,I]=S.useState(null),[P,O]=S.useState(null),[F,M]=S.useState(null),[A,q]=S.useState(!1),[W,Y]=S.useState(!1),[T,Z]=S.useState(null),[U,ne]=S.useState(null),[X,H]=S.useState(null),[J,$]=S.useState(null),[G,Q]=S.useState(!1),[D,L]=S.useState([]),K=S.useRef(null),se=S.useCallback(le=>_T(K.current)?(K.current=le,l(le),!0):!1,[]),he=S.useCallback(()=>{K.current=null,l(null)},[]),pe=(le,Le=!1)=>{const Fe=bT(a,le);return{disabled:Fe.disabled,"aria-busy":Fe.busy||Le}},re=S.useCallback(le=>{window.requestAnimationFrame(()=>{var Le;if(aq(((Le=document.activeElement)==null?void 0:Le.tagName)??null))for(const Fe of iq(le)){const Ee=document.querySelector(Fe);if(Ee){Ee.focus();return}}})},[]),ve=S.useCallback(async(le=!1)=>{le&&h(!0);const Le=new AbortController,Fe=window.setTimeout(()=>Le.abort(),B4);try{const[Ee,Ge]=await Promise.all([fetch(`/api/claude-accounts${le?"?refresh=1":""}`,{signal:Le.signal}),fetch("/api/cswap-auto",{signal:Le.signal})]);if(Ee.ok){const tt=await Ee.json();n(tt),L(Re=>$4(Re,tt.accounts))}Ge.ok&&i(await Ge.json());const Et=F4([await R1(Ee),await R1(Ge)]);f(tt=>A1(tt,Et))}catch{f(Ee=>A1(Ee,D4))}finally{window.clearTimeout(Fe),le&&h(!1)}},[]),Te=S.useCallback(async(le,Le)=>{if(!se(Le))return null;f(null);try{const Ee=await(await fetch("/api/cswap-auto",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(le)})).json().catch(()=>null);return Ee!=null&&Ee.ok||f({text:Uy(Ee,"command failed"),raw:Fi(Ee)}),Ee}catch{return f({text:"server unreachable"}),null}finally{he()}},[se,he]),$e=S.useCallback(async(le,Le)=>{if(!se(Le))return null;f(null);try{const Ee=await(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(le)})).json().catch(()=>null);return Ee!=null&&Ee.ok||f({text:Ti(Ee,"command failed")}),Ee}catch{return f({text:"server unreachable"}),null}finally{he()}},[se,he]);S.useEffect(()=>(ve(!0),w.current=window.setInterval(()=>ve(!1),M1),()=>{w.current!=null&&window.clearInterval(w.current)}),[ve]),S.useEffect(()=>{const le=window.setInterval(()=>y(Math.floor(Date.now()/1e3)),3e4);return()=>window.clearInterval(le)},[]);const Me=((Xe=s==null?void 0:s.settings["autoswitch.threshold"])==null?void 0:Xe.value)??"90",_e=J??Me,ae=A4(_e,Me),we=(_t=t==null?void 0:t.accounts)==null?void 0:_t.find(le=>le.active),be=((Oe=T1((we==null?void 0:we.lanes)??[]).peak)==null?void 0:Oe.pct)??null,Ue=be!=null&&be>=Number(Me)-15,Ke=async le=>{if(se(`switch-${le}`)){f(null);try{const Fe=await(await fetch("/api/claude-accounts/switch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({account:le})})).json().catch(()=>null);Fe!=null&&Fe.ok||f({text:Uy(Fe,"the switch failed"),raw:Fi(Fe)}),await ve(!0)}catch{f({text:"server unreachable"})}finally{he(),re(le)}}},ut=async(le,Le)=>{const{commit:Fe,alias:Ee}=q4(E,Le);if(Fe){const Ge=await $e({action:"alias",account:le,alias:Ee},`alias-${le}`);if(await ve(!0),!(Ge!=null&&Ge.ok))return;j(Ee)}I(le),window.setTimeout(()=>I(Ge=>Ge===le?null:Ge),Xf)},ot=async(le,Le)=>{const Fe=await $e({action:"move",account:le,slot:Le},`move-${le}`),Ee=C4({menuFor:N,shareFor:(F==null?void 0:F.num)??null},le,Fe);if(await ve(!0),Ee){b(Ee.menuFor),O(Ee.confirmRemove),Ee.shareFor==null&&(M(null),Y(!1)),Z(Ee.swapNote);const Ge=Ee.swapNote;Ge&&window.setTimeout(()=>Z(Et=>Et===Ge?null:Et),z4),ne(null),re(Ee.menuFor)}return Fe},He=async(le,Le,Fe)=>{if(Fe.sends){const Ee=await ot(le,Le);if(!(Ee!=null&&Ee.ok))return}H(le),window.setTimeout(()=>H(Ee=>Ee===le?null:Ee),Xf)},nt=async(le,Le)=>{if(Le.sends){const Fe=await Te({action:"setting",key:"autoswitch.threshold",value:le},"threshold");if(await ve(!0),!(Fe!=null&&Fe.ok))return;$(null)}Q(!0),window.setTimeout(()=>Q(!1),Xf)};return d.jsxs("aside",{className:"accounts-panel",id:"accounts-panel","aria-label":"Claude accounts",children:[d.jsxs("div",{className:"ap-header",children:[d.jsx("h2",{children:"Accounts"}),d.jsxs("div",{className:"ap-header-right",children:[d.jsx("button",{type:"button",className:"glyph-btn ap-add",onClick:()=>k(!0),"aria-label":"Add an account",title:"Sign in to another Claude account, or paste one shared from another deck",children:"+"}),(((it=t==null?void 0:t.accounts)==null?void 0:it.length)??0)>0&&d.jsx("button",{type:"button",className:"glyph-btn ap-share-set",onClick:()=>q(!0),"aria-label":"Share accounts with another deck",title:`Copy several accounts to another ${zt} in one paste. The text carries a live login for each one — treat it as those passwords.`,children:"↗"}),d.jsx("button",{type:"button",className:"glyph-btn ap-refresh",onClick:()=>ve(!0),...pe("reload",u),"aria-label":"Reload accounts",title:"Reload from claude-swap",children:u?"…":"↻"}),d.jsx("button",{type:"button",className:"glyph-btn",onClick:e,"aria-label":"Close accounts panel",title:"Close (A)",children:"×"})]})]}),t==null?p?d.jsxs("div",{className:"ap-empty",role:"alert",children:[d.jsx("span",{title:p.raw||void 0,children:p.text}),d.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."]}),d.jsx("button",{type:"button",className:"ap-fix",disabled:u,onClick:()=>ve(!0),children:u?"trying…":"try again"})]}):d.jsx("div",{className:"ap-empty",children:"Checking…"}):t.ok?d.jsxs(d.Fragment,{children:[(Mt=t.accounts)==null?void 0:Mt.map(le=>{const{shown:Le,rest:Fe,fuller:Ee,peak:Ge}=T1(le.lanes),Et=D.includes(Ew(le)),tt=M4(Fe.length,Et,Ee);return d.jsxs("div",{className:`ap-account${le.active?" active":""}`,children:[d.jsxs("div",{className:"ap-account-head",children:[d.jsx("span",{className:"ap-num",children:le.num}),le.alias&&d.jsx("span",{className:"ap-alias",title:le.alias,children:le.alias}),d.jsx("span",{className:"ap-email",title:le.email??void 0,children:le.email}),d.jsx("button",{type:"button",id:`ap-more-${le.num}`,className:`ap-more${N===le.num?" on":""}`,"aria-label":`Manage account ${le.num}`,"aria-expanded":N===le.num,"aria-controls":N===le.num?`ap-manage-${le.num}`:void 0,title:"Share, rename, move, remove",onClick:()=>{b(N===le.num?null:le.num),j(le.alias??""),O(null),M(null),Y(!1),Z(null),I(null),ne(null),H(null)},children:"⋯"}),le.active&&d.jsx("span",{className:"ap-badge-active",children:"active"}),le.disabled&&d.jsx("span",{className:"ap-badge-held",children:"held out"}),!le.active&&!le.disabled&&d.jsx("button",{type:"button",className:"ap-manage-btn ap-switch",...pe(`switch-${le.num}`),onClick:()=>Ke(le.num),title:`Switch to ${le.alias??le.email}`,children:a===`switch-${le.num}`?"…":"switch"})]}),d.jsx("div",{className:"ap-lanes",id:`ap-lanes-${le.num}`,children:Le.length?d.jsxs(d.Fragment,{children:[Le.map(Re=>d.jsx(O1,{lane:Re,nowSec:g},Re.id)),Et&&Fe.map(Re=>d.jsx(O1,{lane:Re,nowSec:g},Re.id))]}):d.jsx("div",{className:"ap-hint",children:"No usage recorded yet."})}),d.jsxs("div",{className:"ap-meta",children:[le.staleCopy&&d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"ap-stale-copy",title:"The deck can still see this account — its live usage is being read — but claude-swap's own stored copy of the login was rejected, so these numbers stopped updating. Resume re-captures the copy from the login you already have.",children:"numbers paused"}),d.jsx("button",{type:"button",className:"ap-fix",...pe("recapture"),onClick:async()=>{const Re=await $e({action:"recapture"},"recapture");Re!=null&&Re.ok&&ve(!0)},title:"Re-capture this account's stored credentials from the login you already have. No sign-in, no switch.",children:a==="recapture"?"resuming…":"resume"})]}),le.error&&(()=>{const Re=H4(le.error);return d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"ap-err",title:Re.hint,children:Re.text}),Re.fixable&&d.jsx("button",{type:"button",className:"ap-fix",onClick:()=>k(!0),title:"Open the sign-in dialog. Signing in as this account replaces its stored login in place.",children:"sign in again"})]})})(),tt&&d.jsx("button",{type:"button",className:"ap-lanes-more","aria-expanded":Et,"aria-controls":`ap-lanes-${le.num}`,title:I4(le.headroom,(Ge==null?void 0:Ge.label)??null,Fe.length,Et),onClick:()=>L(Re=>P4(Re,le)),children:tt}),(((s==null?void 0:s.enabled)||(s==null?void 0:s.external))&&!le.active||le.disabled)&&d.jsx("button",{type:"button",className:"ap-rotate",...pe(`rot-${le.num}`),onClick:()=>Te({action:"account",account:le.num,enabled:le.disabled},`rot-${le.num}`).then(()=>ve(!0)),title:le.disabled?"Return this account to auto-rotation":"Hold this account out of auto-rotation",children:le.disabled?"put back":"hold out"}),le.fetchedAt?d.jsxs("span",{className:`ap-age${le.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 ",I1(le.fetchedAt,g),W4(le.nextAt,g)]}):d.jsx("span",{className:"ap-age ap-stale",title:"claude-swap has not read this account yet",children:"never collected"})]}),N===le.num&&d.jsxs("div",{className:"ap-manage",id:`ap-manage-${le.num}`,role:"group","aria-label":`Manage account ${le.num}`,children:[d.jsxs("div",{className:"ap-manage-name",children:[d.jsx("label",{className:"vis-hidden",htmlFor:`ap-alias-${le.num}`,children:"Alias"}),d.jsx("input",{id:`ap-alias-${le.num}`,className:"ap-manage-input",type:"text",value:E,onChange:Re=>j(Re.target.value),onKeyDown:Re=>{Re.key==="Enter"&&ut(le.num,le.alias)},maxLength:L4,placeholder:"e.g. work",spellCheck:!1,autoFocus:!0}),d.jsx("button",{type:"button",className:"ap-manage-btn",...pe(`alias-${le.num}`),onClick:()=>ut(le.num,le.alias),title:"A short name to show instead of the email",children:C===le.num?"saved":"save"})]}),(()=>{const Re=j4((t.accounts??[]).map(kt=>kt.num),le.num),wt=T4(Re,U,le.num),lt=R4(Re,wt,le.num);return d.jsxs("div",{className:"ap-manage-slot",children:[d.jsx("label",{className:"vis-hidden",htmlFor:`ap-slot-${le.num}`,children:"Slot"}),d.jsx("span",{className:"ap-field",children:d.jsx("select",{id:`ap-slot-${le.num}`,value:String(wt),...pe(`move-${le.num}`),onChange:kt=>ne(Number(kt.target.value)),children:Re.map(kt=>d.jsx("option",{value:kt.slot,children:kt.label},kt.slot))})}),d.jsx("button",{type:"button",className:"ap-manage-btn",...pe(`move-${le.num}`),title:lt.title,onClick:()=>He(le.num,wt,lt),children:X===le.num?lt.done:lt.label})]})})(),d.jsxs("div",{className:"ap-manage-acts",children:[d.jsx("button",{type:"button",className:"ap-manage-btn",...pe(`share-${le.num}`),title:`Copy this account to another ${zt}. 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()=>{Y(!1);const Re=await $e({action:"share",account:le.num},`share-${le.num}`);Re!=null&&Re.ok&&M({num:le.num,blob:Re.blob,expiresAt:Re.expiresAt})},children:"share"}),d.jsx("button",{type:"button",className:`ap-manage-btn danger${P===le.num?" armed":""}`,...pe(`rm-${le.num}`),title:P===le.num?"This deletes the stored credentials for this account":"Remove this account from claude-swap",onClick:()=>{if(P!==le.num){O(le.num),window.setTimeout(()=>O(Re=>Re===le.num?null:Re),4e3);return}O(null),$e({action:"remove",account:le.num},`rm-${le.num}`).then(()=>{b(null),ve(!0),re(null)})},children:P===le.num?"confirm":"remove"})]}),(T==null?void 0:T.at)===le.num&&(()=>{var lt;const Re=(lt=t.accounts)==null?void 0:lt.find(kt=>kt.num===T.displaced),wt=(Re==null?void 0:Re.alias)??(Re==null?void 0:Re.email)??"the account that was there";return d.jsxs("span",{className:"ap-manage-hint ap-manage-swap",title:`Slot ${T.at} was taken, so the two accounts traded places: ${wt} now holds slot ${T.displaced}.`,children:["swapped with slot ",T.displaced]})})(),(F==null?void 0:F.num)===le.num&&(()=>{const Re=TT(F.expiresAt,g),wt=Re.tone==="gone";return d.jsxs("div",{className:`ap-share${wt?" expired":""}`,children:[d.jsx("code",{className:"ap-share-blob",children:F.blob}),d.jsxs("div",{className:"ap-share-foot",children:[d.jsx("button",{type:"button",className:"ap-manage-btn",...pe(`share-${le.num}`),onClick:async()=>{if(wt){Y(!1);const lt=await $e({action:"share",account:le.num},`share-${le.num}`);lt!=null&<.ok&&M({num:le.num,blob:lt.blob,expiresAt:lt.expiresAt});return}await P1(F.blob)&&(Y(!0),window.setTimeout(()=>Y(!1),1800))},children:wt?"make a new share":W?"copied":"copy"}),d.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:[d.jsx("span",{className:"ap-share-warn",children:"this is the password"})," · ",d.jsx("span",{className:`ap-share-expiry ${Re.tone}`,children:Re.text})]})]})]})})()]})]},le.num)}),(s==null?void 0:s.ok)&&d.jsxs("div",{className:"ap-auto",children:[d.jsxs("div",{className:"ap-auto-head",children:[d.jsx("h3",{className:"ap-auto-title",children:"Auto-switch"}),d.jsxs("span",{className:"ap-auto-ctl",children:[be!=null&&d.jsxs("span",{className:`ap-auto-now${Ue?" near":""}`,children:[Math.round(be),"%"]}),d.jsx("span",{className:"ap-field",title:"Switch once the active account passes this much of its limit",children:d.jsx("select",{"aria-label":"Switch threshold",value:_e,...pe("threshold"),onChange:le=>$(le.target.value),children:U4.map(le=>d.jsxs("option",{value:le,children:[le,"%"]},le))})}),d.jsx("button",{type:"button",className:"ap-manage-btn",...pe("threshold"),title:ae.title,onClick:()=>nt(_e,ae),children:G?ae.done:ae.label}),d.jsxs("button",{type:"button",className:`ap-auto-state${s.enabled?" live":""}`,role:"switch","aria-checked":s.enabled,"aria-label":"Auto-switch",...pe("enable"),onClick:()=>Te({action:"enable",enabled:!s.enabled},"enable").then(()=>ve(!0)),title:s.enabled?"Stop switching accounts automatically":"Switch accounts automatically when the active one nears its limit",children:[d.jsx("i",{className:s.enabled?"ap-pulse":"ap-dot","aria-hidden":!0}),s.enabled?"on":"off"]})]})]}),s.external&&d.jsxs("p",{className:"ap-auto-note",children:[d.jsx("i",{className:"ap-pulse","aria-hidden":!0})," A ",d.jsx("code",{children:"cswap auto"})," loop in your terminal is doing the switching. The deck stands down while it runs",s.enabled?" — this toggle takes over when you stop it.":"."]}),s.lastTick&&d.jsx("div",{className:"ap-auto-foot",children:d.jsxs("span",{className:"ap-auto-result",children:["checked ",I1(s.lastTick.at,g)]})})]}),p&&d.jsxs("div",{className:"ap-failure",role:"alert",children:[d.jsx("span",{className:"ap-failure-text",title:p.raw||void 0,children:p.text}),d.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>f(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),d.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."})]}):d.jsx("div",{className:"ap-empty",children:t.reason==="no_cswap"?d.jsxs(d.Fragment,{children:[d.jsx("span",{children:"claude-swap isn't installed."}),d.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&&d.jsx("code",{className:"ap-cmd",children:t.hint}),d.jsxs("span",{className:"ap-hint",children:["Then add an account with the ",d.jsx("strong",{children:"+"})," button above."]})]}):t.reason==="no_accounts"?d.jsxs(d.Fragment,{children:[d.jsx("span",{children:"No accounts added yet."}),d.jsxs("span",{className:"ap-hint",children:["claude-swap is installed but has nothing in its store. Use the ",d.jsx("strong",{children:"+"})," above to sign one in, or to paste one shared from another deck."]})]}):d.jsxs(d.Fragment,{children:[d.jsx("span",{children:"Couldn't read the account store."}),d.jsxs("span",{className:"ap-hint",children:["claude-swap is installed, but its store could not be read",t.reason?` (${t.reason})`:"","."]})]})}),_&&d.jsx(k4,{onClose:()=>k(!1),onChanged:()=>ve(!0)}),A&&d.jsx(E4,{accounts:((t==null?void 0:t.accounts)??[]).map(le=>({num:le.num,email:le.email,alias:le.alias,org:le.org})),onClose:()=>q(!1),copyText:P1})]})}const V4=3e4;function Y4({bundle:e,running:t,lastTried:n}){return!t||e===t?!1:n!==t}function K4({bundle:e,running:t,pending:n,lastTried:s}){return t?Y4({bundle:e,running:t,lastTried:s})?"reload":n==null||n&&n!==t?"wait":"confirm":"wait"}function X4(e){return!e||e.state!=="failed"?null:`${typeof e.at=="number"?e.at:0}:${e.error??""}`}function Q4({asked:e,reported:t}){return t?t!==e:!1}function Z4(e){const t=e.thresholdMs??V4;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 J4(e,t){return e==="confirmation"?t.confirmOpen?"clear":"ignore":t.modalOpen||t.confirmOpen?"ignore":"confirm"}function eD(e){if(!e||typeof e!="object")return null;const t=e;if(typeof t.decks!="number"||typeof t.mine!="boolean")return null;const n=t.owner&&typeof t.owner=="object"?t.owner.port:null;return{path:typeof t.path=="string"&&t.path!==""?t.path:null,decks:t.decks,mine:t.mine,ownerPort:typeof n=="number"?n:null}}function tD(e){return e<=0?null:e===1?"the one agent":`all ${e} agents`}function nD(e,t){const n=tD(e),s=n?`removes ${n} on the canvas`:null,i=u=>`This ${s?`${s} and ${u}`:u}`;if(!t)return{note:`${i("deletes the event log on disk")} — the file a restarted deck replays to rebuild what you see, and the file every deck on this machine shares unless one was told otherwise. Layout, pins and selection go with it. This cannot be undone.`,confirm:"Clear everything"};if(!t.path)return{note:`${i("leaves nothing on disk — this deck keeps no event log")}. Layout, pins and selection go with it. This cannot be undone.`,confirm:"Clear everything"};if(!t.mine){const u=t.ownerPort===null?"another running deck owns that file":`the deck on port ${t.ownerPort} owns that file`,h=t.decks>2?`, one of ${t.decks} decks sharing it`:"";return{note:`${i(`leaves the event log alone: ${u}${h}`)}. Clearing here empties this canvas only — restart this deck and the log replays back onto it. Layout, pins and selection go with it.`,confirm:"Clear this canvas"}}if(t.decks<=1)return{note:`${i("deletes this deck's event log")} — the file a restarted deck replays to rebuild what you see. Layout, pins and selection go with it. This cannot be undone.`,confirm:"Clear everything"};const a=t.decks-1,l=a===1?"That deck keeps what is on its canvas until it restarts, and then it is gone there too.":"Those decks keep what is on their canvases until they restart, and then it is gone there too.";return{note:`${i(`deletes the event log ${a===1?"1 other running deck shares":`${a} other running decks share`} with this one`)} — every session recorded in it, not just the ones drawn here. ${l} This cannot be undone.`,confirm:"Clear everything"}}function rD({agentCount:e,onConfirm:t,onCancel:n}){const s=S.useRef(null),i=Sn(n,{focusRef:s,layer:RL}),[a,l]=S.useState(null);S.useEffect(()=>{let p=!1;return fetch("/api/clear").then(f=>f.ok?f.json():null).then(f=>{p||l(eD(f))}).catch(()=>{}),()=>{p=!0}},[]);const{note:u,confirm:h}=nD(e,a);return d.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:d.jsxs("div",{ref:i,className:"modal clear-confirm",onClick:p=>p.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"clear-confirm-title",children:[d.jsxs("header",{className:"modal-head",children:[d.jsxs("div",{className:"modal-title",children:[d.jsx("span",{className:"status-dot err","aria-hidden":!0}),d.jsx("span",{id:"clear-confirm-title",className:"modal-tool-name",children:"Clear the deck?"})]}),d.jsx("div",{className:"modal-actions",children:d.jsx("button",{type:"button",className:"glyph-btn",onClick:n,"aria-label":"Cancel (Esc)",title:"Cancel (Esc)",children:"×"})})]}),d.jsxs("section",{className:"modal-body",children:[d.jsx("p",{className:"modal-note",children:u}),d.jsxs("div",{className:"cc-actions",children:[d.jsx("button",{type:"button",ref:s,className:"btn",onClick:n,children:"Cancel"}),d.jsx("button",{type:"button",className:"btn danger",onClick:t,children:h})]})]})]})})}const sD="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.",oD=[{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:"sound on or off",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:"click",action:"the topbar speaker opens volume and sound settings",binds:[]}]}];function iD({onClose:e}){const t=Sn(e);return d.jsx("div",{className:"modal-backdrop",onClick:e,role:"presentation",children:d.jsxs("div",{ref:t,className:"modal key-help",onClick:n=>n.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"key-help-title",children:[d.jsxs("header",{className:"modal-head",children:[d.jsx("div",{className:"modal-title",children:d.jsx("span",{id:"key-help-title",className:"modal-tool-name",children:"Keyboard shortcuts"})}),d.jsx("div",{className:"modal-actions",children:d.jsx("button",{type:"button",className:"glyph-btn",onClick:e,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),d.jsxs("section",{className:"modal-body",children:[d.jsx("p",{className:"modal-note",children:sD}),d.jsx("div",{className:"shortcuts",children:oD.map(n=>d.jsxs(S.Fragment,{children:[d.jsx("h3",{className:"kh-group",children:n.title}),n.rows.map(s=>d.jsxs("div",{className:"sc",children:[d.jsx("kbd",{children:s.cap}),d.jsx("span",{children:s.action})]},`${n.title}:${s.cap}:${s.action}`))]},n.title))})]})]})})}const aD=["done","needs-input"],lD=[{id:"two",label:"Two notes",notes:[{at:0,hz:740,ms:90},{at:.085,hz:440,ms:150}]},{id:"arc",label:"Descent",notes:[{at:0,hz:988,ms:80},{at:.07,hz:659,ms:80},{at:.14,hz:440,ms:160}]},{id:"tap",label:"Double tap",notes:[{at:0,hz:740,ms:55},{at:.055,hz:740,ms:55},{at:.165,hz:440,ms:150}]},{id:"chord",label:"Chord",trim:.7,notes:[{at:0,hz:988,ms:110},{at:0,hz:740,ms:110},{at:.1,hz:440,ms:170}]},{id:"bell",label:"Bell",type:"triangle",notes:[{at:0,hz:740,ms:120},{at:.11,hz:440,ms:260}]},{id:"blip",label:"Blip",type:"square",trim:.7,notes:[{at:0,hz:740,ms:55},{at:.06,hz:440,ms:90}]}],cD=[{id:"two",label:"Two notes",notes:[{at:0,hz:440,ms:90},{at:.085,hz:740,ms:150}]},{id:"arc",label:"Ascent",notes:[{at:0,hz:440,ms:80},{at:.07,hz:659,ms:80},{at:.14,hz:988,ms:160}]},{id:"tap",label:"Double tap",notes:[{at:0,hz:440,ms:55},{at:.055,hz:440,ms:55},{at:.165,hz:740,ms:150}]},{id:"chord",label:"Chord",trim:.7,notes:[{at:0,hz:440,ms:110},{at:.1,hz:740,ms:170},{at:.1,hz:988,ms:170}]},{id:"bell",label:"Bell",type:"triangle",notes:[{at:0,hz:440,ms:120},{at:.11,hz:740,ms:260}]},{id:"blip",label:"Blip",type:"square",trim:.7,notes:[{at:0,hz:440,ms:55},{at:.06,hz:740,ms:90}]}],jw={done:lD,"needs-input":cD},zi="two";function Hy(e,t){const n=jw[e];return n.find(s=>s.id===t)??n.find(s=>s.id===zi)??n[0]}function RT(e,t){return jw[e].some(s=>s.id===t)?t:zi}Hy("done",zi).notes,Hy("needs-input",zi).notes;const $1=.04,uD=.24,AT=0,Cw=100,Gy=5,ll=50;function cl(e){if(!Number.isFinite(e))return ll;const t=Math.round(e/Gy)*Gy;return Math.min(Cw,Math.max(AT,t))}function dD(e){if(e==null)return ll;const t=e.trim();return/^-?\d+(\.\d+)?$/.test(t)?cl(Number(t)):ll}function fD(e){const t=cl(e),n=$1+(uD-$1)*(t/Cw);return Math.round(n*1e4)/1e4}function hD(e,t){const n=t.trim,s=typeof n=="number"&&Number.isFinite(n)&&n>0&&n<=1?n:1;return Math.round(fD(e)*s*1e4)/1e4}const pD=160,mD="agent-dag.soundLevel.done",gD="agent-dag.soundLevel.needs-input",vD="agent-dag.soundFigure.done",yD="agent-dag.soundFigure.needs-input",MT={done:mD,"needs-input":gD},IT={done:vD,"needs-input":yD},Vy={done:{level:ll,figure:zi},"needs-input":{level:ll,figure:zi}};function wD(e){const t=n=>({level:dD(e(MT[n])),figure:RT(n,e(IT[n]))});return{done:t("done"),"needs-input":t("needs-input")}}const xD={Stop:"done",Notification:"needs-input"};function bD(e,t){var s;if(t)return null;const n=(s=e==null?void 0:e.payload)==null?void 0:s.hook_event_name;return typeof n!="string"?null:xD[n]??null}function _D(e={enabled:()=>!0}){const t=e.ctor??(typeof window<"u"?window.AudioContext??window.webkitAudioContext??null:null);let n=null,s=!1;const i=()=>e.enabled()?s&&(n==null?void 0:n.state)==="running"?"ready":"locked":"off",a=()=>{var h;return(h=e.onState)==null?void 0:h.call(e,i())};function l(){var h;if(!(!t||s))try{n=n??new t,(h=n.resume)==null||h.call(n).then(a,()=>{}),s=!0,a()}catch{}}function u(h,p=!1){var N;if(!p&&!e.enabled()||!n||n.state!=="running")return!1;const f=(((N=e.prefs)==null?void 0:N.call(e))??Vy)[h]??Vy[h],g=Hy(h,f.figure),y=hD(f.level,g),w=n.currentTime;for(const b of g.notes){const _=n.createOscillator(),k=n.createGain();_.type=g.type??"sine",_.frequency.value=b.hz;const E=w+b.at,j=E+b.ms/1e3;k.gain.setValueAtTime(1e-4,E),k.gain.exponentialRampToValueAtTime(y,E+.012),k.gain.exponentialRampToValueAtTime(1e-4,j),_.connect(k).connect(n.destination),_.start(E),_.stop(j+.02)}return!0}return{unlock:l,play:u,state:i,get context(){return n}}}const L1={done:"Turn finished","needs-input":"Claude is asking"},kD={done:"Every finished turn, on both CLIs.","needs-input":"Claude Code only — Codex has no such event."};function SD({onClose:e,soundOn:t,onToggleSound:n,prefs:s,onLevel:i,onFigure:a,onPreview:l,openerRef:u}){const h=Sn(e),p=S.useRef(e);return p.current=e,S.useEffect(()=>{const f=g=>{var w,N;const y=g.target;y&&((w=h.current)!=null&&w.contains(y)||(N=u.current)!=null&&N.contains(y)||p.current())};return window.addEventListener("pointerdown",f,!0),()=>window.removeEventListener("pointerdown",f,!0)},[h,u]),d.jsxs("div",{ref:h,id:"sound-menu",className:"sound-menu",role:"dialog","aria-label":"Sound settings",children:[d.jsxs("button",{type:"button",className:"btn sm-switch",onClick:n,"aria-pressed":t,children:[d.jsx("span",{className:"sm-switch-label",children:"Sound"}),d.jsx("span",{className:"sm-switch-state",children:t?"on":"off"})]}),aD.map(f=>{const g=s[f],y=`sm-level-${f}`,w=`sm-figure-${f}`;return d.jsxs("section",{className:"sm-tone","aria-labelledby":`sm-name-${f}`,children:[d.jsxs("div",{className:"sm-tone-head",children:[d.jsx("h3",{className:"sm-tone-name",id:`sm-name-${f}`,children:L1[f]}),d.jsxs("button",{type:"button",className:"btn sm-hear",onClick:()=>l(f),"aria-label":`Hear the ${L1[f].toLowerCase()} tone`,children:[d.jsx("svg",{width:"11",height:"11",viewBox:"0 0 12 12",fill:"currentColor","aria-hidden":!0,children:d.jsx("path",{d:"M3 1.6v8.8l7-4.4z"})}),"Hear it"]})]}),d.jsxs("div",{className:"sm-row",children:[d.jsx("label",{htmlFor:y,children:"Volume"}),d.jsx("input",{id:y,type:"range",min:AT,max:Cw,step:Gy,value:g.level,onChange:N=>i(f,Number(N.target.value))}),d.jsxs("span",{className:"sm-read",children:[g.level,"%"]})]}),d.jsxs("div",{className:"sm-row",children:[d.jsx("label",{htmlFor:w,children:"Sound"}),d.jsx("select",{id:w,className:"sm-select",value:g.figure,onChange:N=>a(f,N.target.value),children:jw[f].map(N=>d.jsx("option",{value:N.id,children:N.label},N.id))})]}),d.jsx("p",{className:"sm-note",children:kD[f]})]},f)}),d.jsx("p",{className:"sm-foot",children:"M turns the sound on and off from anywhere."})]})}const ND={"//":["What a user would NOTICE. One key per version that has something to say,","and no key at all for a version that has nothing — which is most of them.","","The rule this file exists to serve: before every release, ask 'what would a","user notice?' and write the answer here. 'Nothing user-visible' is a valid","and expected answer, and it is spelled by adding no key. A release with no","key shows no modal, and that silence is what keeps the modal worth reading","on the day it is not silent.","","What belongs here: something that changed on the user's machine or under","their hands — a hook written to or removed from settings.json, a default","that flipped, a control that moved or went away, a stored preference that","changed meaning. What does not: bounds, races, assertions that could not","fire, anything that is invisible when it is correct.","","Write it for the person running the deck, not for the person reading the","diff. `title` is the sentence they scan; `body` is what they need in order","to act on it, or to stop worrying about it.","","Keys are versions exactly as package.json spells them. A key that is not a","version, or an entry missing either field, fails the suite rather than","being quietly dropped — see src/web/__tests__/release-notes-file.test.ts.","Ordering here is for humans; the deck sorts by version itself.","","A title may open with an emoji, and if it does, put exactly ONE space after","it. Not two: the dialog gives a leading emoji its own optical gap, because","a colour glyph is drawn edge to edge inside its advance and one word space","after one reads as none. A second space here would be a lie in the data","about a defect in the type, and the suite refuses both it and no space at","all."],"3.3.0":[{title:"📊 The Usage panel answers for a period, not just for the board",body:`It used to add up the sessions drawn on the canvas — which is an honest number with a scope nobody reads it as having: finished sessions are evicted a couple of minutes after they end, so the figure fell on its own while nothing had happened and nothing was refunded.
|
|
78
|
+
|
|
79
|
+
It now reads ccusage, the same source the H modal uses, and offers today, this month and all time. BY MODEL and BY SESSION come from there too, and each session is named by the project the board knows it as rather than by a uuid.
|
|
80
|
+
|
|
81
|
+
The live figure is still there, on its own line and labelled — what the sessions currently on the board have spent — because that is a different question from what the month cost.
|
|
82
|
+
|
|
83
|
+
One thing worth knowing about the source: ccusage reports a session's LIFETIME total, so the rows under "active today" can add up to more than the day above them. The heading says so.`},{title:"🪟 Windows: a deck started from an elevated terminal was being treated as dead",body:"The hook decides whether a deck is still running by trying to signal it. On POSIX a process you may not signal answers EPERM; on Windows it answers EACCES, and only EPERM was accepted — so a deck started from an elevated terminal, or under another account, read as gone. Its registration was deleted on every event and rewritten five seconds later, while its banner went on saying it was connected and almost nothing arrived.\n\nThree more Windows-only faults went with it: a read-only settings.json made every hook install fail for good (the atomic write could not replace the file); the machine panel answered 500 every four seconds whenever the process read failed; and a bare command name was looked for in the working directory before PATH, which is where `npx ccdeck` was run."},{title:"👁 Browser Watch reads nothing while it is switched off",body:`The switch used to control only what was KEPT. The read happened anyway — every five minutes, on every deck, the panel's badge poll discovered each Chromium profile and copied its whole History database to a temp file to query it. A switch that says off while that continues is not a switch.
|
|
84
|
+
|
|
85
|
+
With the watch off, nothing touches a browser now. Opening the panel still reads live, because that is you looking, and a watch that is ON still records in the background — that is the feature. The trade is that the topbar badge no longer counts findings while the watch is off; open the panel to see them.
|
|
86
|
+
|
|
87
|
+
The README has a Browser Watch section now: what is read, when, where the copy goes, and that only visits after the deck started are ever considered.`},{title:"🔒 The deck's own data is no longer readable by anything on the machine",body:"Changing an account needed the deck's credential; reading the event ring did not. Anything running on your machine could `curl` the events — prompt text, the commands an agent ran, the paths and contents it touched — plus the account list and the browsing episodes.\n\nThose reads now answer to the same rule the mutations do: the deck's own page, or its token. Nothing changes for you in the browser. A script of yours that reads those routes needs the token from `~/.claude/agent-dag/<pid>.json`, sent as `x-ccdeck-token`."},{title:"💳 An API-key, Bedrock or Vertex install is told there is no quota window",body:`Those installs are billed per token and have no five-hour window. The CLI ran, printed no quota lines, and the deck read that as a genuine "under 1%" — drawing two empty bars for a measurement nobody had taken, or telling you to run /usage, which cannot help there.
|
|
88
|
+
|
|
89
|
+
It now says what it is, in one line, the way the Codex half already did.`},{title:"🎨 The model chip is coloured by its model again",body:`A session that switched model — Sonnet, then Opus — drew a chip reading "Opus 5 +1" in Sonnet blue, because the colour was picked from the tooltip and the tooltip lists every model the card's spend covers. Add a Fable turn and it went yellow.
|
|
90
|
+
|
|
91
|
+
Also fixed on the way past: an account import the CLI rejected could take the whole deck down with it, and a corrupt compressed Codex rollout leaked a file handle on every poll.`}],"3.2.1":[{title:"💵 Sonnet 5 was being costed fifty per cent high",body:`Sonnet 5 launched at $2/$10 per million tokens as introductory pricing, with a rise to $3/$15 announced for September 1. The deck implemented that schedule, and on September 1 it started charging the higher rate.
|
|
92
|
+
|
|
93
|
+
The increase was cancelled. Anthropic's pricing page now says the $2/$10 rate is simply the price and the rise "will not occur" — so every Sonnet 5 session since the 1st has been shown to you at half again what it cost.
|
|
94
|
+
|
|
95
|
+
It is corrected, and there is no date logic left in that rate to go stale a second time. Numbers already on your board are recomputed from the log the next time the deck starts; nothing was billed by us, only displayed.
|
|
96
|
+
|
|
97
|
+
Fable 5.1 and Mythos 5.1 are also priced now, including the cache read that is a quarter of Fable 5's — which is most of what a long session pays for.`}],"3.2.0":[{title:"🌡️ Windows shows a temperature where it can find one",body:`On most Windows laptops there is nothing to show, and that is Windows rather than this deck: modern machines declare no ACPI thermal zone, and the sensors that do exist sit behind an interface only an administrator may read. Measured on real hardware, elevated and not.
|
|
98
|
+
|
|
99
|
+
One thing does work, and it costs you nothing to have. If LibreHardwareMonitor happens to be running with its web server on, the deck now reads its numbers over localhost — which needs no privileges at all.
|
|
100
|
+
|
|
101
|
+
It is only ever a read. Nothing is installed, nothing is asked of you, and a machine without it shows no section, exactly as before.`}],"3.1.0":[{title:"🚀 The first run stops looking like it hung",body:`\`npx ccdeck\` on a machine that has never run it used to sit on a spinner at "checking claude-swap" and say nothing else. Measured on a Windows box: seventeen and a half seconds before it told you where to point a browser. It is now one and a half.
|
|
102
|
+
|
|
103
|
+
The deck was waiting for an install nobody asked for during that boot — a Python toolchain being fetched so the accounts panel would work. The port had been open the whole time; there was just nothing on screen to say so.
|
|
104
|
+
|
|
105
|
+
It no longer waits. Anything still working past the boot says so on its own line and keeps going in the background, and the deck comes up without it.`},{title:"⚡ Every start is quicker, and stays quicker",body:`The event log was read from the beginning on every boot to fill a buffer that only keeps the last two thousand events — so four fifths of that reading existed to be thrown away, and it got slower the longer you had been using the deck. It reads from the end now and stops when the buffer is full: 258ms down to 20ms here, on a 34 MB log, and it no longer grows.
|
|
106
|
+
|
|
107
|
+
The accounts tool is also asked for its version once instead of twice, which on this machine was the single largest thing in an ordinary boot.`},{title:"📉 Ten fewer packages to install",body:"Opening your browser used to cost a dependency that brought nine more with it — ten downloads on a cold `npx ccdeck` before the deck's own files were unpacked. It is now done with the commands the operating system already has.\n\nThe package has no runtime dependencies at all."},{title:"🌡️ Temperature, on the machines that could not show it",body:`On Windows the deck was asking somewhere it is not allowed to look: that reading lives behind a namespace that needs administrator, so it failed for everybody and the section never appeared. It reads a performance counter now, which needs nothing.
|
|
108
|
+
|
|
109
|
+
On Apple Silicon there is no command that ships with macOS which prints a temperature at all — the sensors are behind an interface only native code can reach. The deck fetches a small signed tool for it, verified against the checksum its release publishes, in the background and only on the Macs that need it. You do not have to install anything. \`AGENTS_DECK_NO_DOWNLOAD=1\` turns that off.
|
|
110
|
+
|
|
111
|
+
A machine with no sensor still shows no section, which includes every virtual machine. Nothing is drawn that was not measured.`},{title:"😌 The terminal goes quiet when there is nothing happening",body:`The dot at the bottom blinked every 800ms for as long as the deck ran, which is what a terminal does while it is working — so a deck that had finished in a second looked like one that never finished.
|
|
112
|
+
|
|
113
|
+
It now moves only while something actually is: a job still running, or hooks that cannot find the deck. Otherwise it is drawn once and left alone, and it says what the job is rather than just blinking. A step that takes more than three seconds shows how long it has been going, which is the whole of "is this stuck".
|
|
114
|
+
|
|
115
|
+
And a machine with no Claude Code installed stops being told about it every few seconds — that one is said once now, on its own line instead of across the status line.`}],"3.0.0":[{title:"📈 The machine panel now shows what it DID, not just what it is",body:`Click any section of the machine panel — Cores, Memory, Load average, Thermal — and it opens a chart of what that reading has done since the deck started.
|
|
116
|
+
|
|
117
|
+
The panel could always tell you the machine is busy now. It could not tell you whether it got hot while that three-hour build was running, or how deep the queue went while you were away, and those are the questions you actually have afterwards.
|
|
118
|
+
|
|
119
|
+
Thermal is new as well. Where the machine will give degrees, it gives degrees; on a Mac it also reports whether the CPU is being held back to cool down, which is the consequence a temperature has to be interpreted into anyway. Nothing is drawn that was not measured — a machine with no sensor gets no section at all, rather than a zero.`},{title:"🔍 The whole process list, not just the busiest eight",body:`"more" beside Busiest processes opens the full list the deck is watching — around fifty processes rather than eight — with the pid and the untruncated name.
|
|
120
|
+
|
|
121
|
+
This closes a gap. The panel's eight rows are the busiest, so sorting them by name only reorders those eight: "is my test runner still going" could not be answered if the test runner was not already on screen. Now it can.
|
|
122
|
+
|
|
123
|
+
It is deliberately not a task manager. Nothing here ends a process; Activity Monitor and Task Manager are better at that and it is not a thing this deck should own.`},{title:"🔤 Process names in Cyrillic, Greek or with accents read correctly",body:`An application named Яндекс Музыка was showing up as M-PM-/M-PM-=M-PM-4M-PM-5… in the process list, and so was every other name the deck could not spell in plain ASCII.
|
|
124
|
+
|
|
125
|
+
The deck was forcing a fixed locale on the commands it runs, to guarantee that a decimal point stays a point on a machine set to German or Russian — and that also forced the character set. It forces only the number format now. Your own character set is left alone, which is what makes the name arrive intact.`},{title:"📦 The text you copy to share accounts is a third of its size",body:`Sharing three accounts used to produce 6168 characters. It is now 1896.
|
|
126
|
+
|
|
127
|
+
Most of that text was never the credentials — two OAuth tokens are about two hundred characters between them, and the rest was the envelope, whose field names repeated in full for every account added. So the saving grows with the number of accounts rather than shrinking.
|
|
128
|
+
|
|
129
|
+
A blob you copied before this still imports until it expires. One made now cannot be read by a deck older than this version — that is the one thing in this release that older decks cannot follow.`}],"1.48.0":[{title:"👁 Browser Watch — see what a program opened while you were away",body:`There is a new eye in the top bar. It watches the browsers on this machine and tells you when a program — an extension, an agent, a command — opened pages while nobody was touching the browser.
|
|
130
|
+
|
|
131
|
+
Usually that is your own agent doing what you asked, and the panel says so rather than crying intrusion. What it gives you is the evidence: which pages, in which browser, at what time, with every address written out in full.
|
|
132
|
+
|
|
133
|
+
It is off until you switch it on, and nothing leaves this machine. It reads a copy of the browser's own history and only pages newer than the moment the deck started — never anything from before, never cookies, never saved passwords. Open ⚙ inside the panel and "What Browser Watch can access" says exactly what it reads, keeps and sends.
|
|
134
|
+
|
|
135
|
+
When it finds something the eye turns amber with a count. You can dismiss a finding once you have looked at it and it stays gone, while the log file on disk keeps the record. On a Mac it can also close the tab it found, or quit the browser.`},{title:"🔑 Move all your accounts to another machine in one paste",body:`Sharing accounts between two decks used to be one account at a time, and step four of six is where people stop — leaving the second deck half set up with nothing saying so.
|
|
136
|
+
|
|
137
|
+
Pick the accounts you want, copy one blob, paste it into the other deck. The import adds what is missing, leaves what already works alone, heals an account whose token has died, and tells you which of those happened to each one.
|
|
138
|
+
|
|
139
|
+
The blob carries real credentials, so it expires ten minutes after you make it and the deck refuses an expired one before it unwraps anything.`}],"1.47.0":[{title:"🔌 The top bar goes quiet when everything is fine",body:`The green "live" pill used to sit up there permanently to tell you nothing was broken. It is gone while things are working.
|
|
140
|
+
|
|
141
|
+
You will still see a pill when it matters: amber when you pause the canvas, with how many events are waiting, and red when the deck loses its connection to the server. No pill means all is well.`},{title:"🔴 The browser tab tells you when the connection drops",body:`The little icon in the tab has always shown what your sessions are doing — grey when it is quiet, blue when something is working, amber when a session is waiting on you.
|
|
142
|
+
|
|
143
|
+
It could not say the one thing that matters most: that the deck has stopped hearing from the server. Until now it just kept showing whatever it had last seen. It turns into a broken red ring instead, so you can spot it from another tab without switching over.`}],"1.46.0":[{title:"🔊 Pick a volume and a sound for each of the two tones",body:`Click the speaker in the top bar and a small menu opens. There are two tones — one when a turn finishes, one when Claude is waiting for you — and each has its own volume and its own sound, six to choose from. Press "Hear it" to try one straight away, without waiting for a real turn.
|
|
144
|
+
|
|
145
|
+
The two lists are separate on purpose, so you can never end up with both tones sounding the same. A finish tone always falls; an asking tone always rises. That is how you tell them apart without looking at the screen.
|
|
146
|
+
|
|
147
|
+
M still turns the sound on and off from anywhere.`},{title:"✨ This box is new",body:`After an update, the deck tells you what changed — once, and only when there is something worth telling. Most updates have nothing to say and you will see nothing at all.
|
|
148
|
+
|
|
149
|
+
Click the version at the top of the deck to read it again whenever you like.`}],"1.45.0":[{title:"🔕 The deck no longer puts anything in your settings.json",body:"It used to add a hook there so Claude Code would play a sound when a turn ended. That entry is removed the first time you start this version, and any sound hook you wrote yourself is put back exactly where you had it. Nothing else in that file is touched. The deck makes the sound itself now — which is also why you finally hear one when a Codex turn ends, not just a Claude one."}]},Tw="agent-dag.releaseNotesSeen";function q1(e){return e.split(/[.\-+]/).map(t=>parseInt(t,10)).map(t=>Number.isNaN(t)?0:t)}function Bi(e,t){const n=q1(e),s=q1(t);for(let i=0;i<Math.max(n.length,s.length);i++){const a=(n[i]??0)-(s[i]??0);if(a!==0)return a<0?-1:1}return 0}function Ui(e){return typeof e=="string"&&/^\d+\.\d+\.\d+/.test(e)}function ED(e){if(!e||typeof e!="object")return!1;const{title:t,body:n}=e;return typeof t=="string"&&t.trim()!==""&&typeof n=="string"&&n.trim()!==""}function jD(e){if(!e||typeof e!="object")return[];const t=[];for(const[n,s]of Object.entries(e)){if(!Ui(n)||!Array.isArray(s))continue;const i=s.filter(ED);i.length&&t.push({version:n,notes:i})}return t.sort((n,s)=>Bi(s.version,n.version))}const D1=jD(ND);function OT(e,t,n){return e.filter(s=>Bi(s.version,n)<=0&&(t===null||Bi(s.version,t)>0))}function CD(e,t){return e.filter(n=>Bi(n.version,t)===0)}function TD(e){if(!e.length)return"";const t=e[0].version,n=e[e.length-1].version;return t===n?`v${t}`:`v${n} – v${t}`}function RD({since:e,running:t,entries:n,firstRun:s}){if(!n.length)return"Nothing in this build has anything to report yet. Most releases do not, which is the point.";if(e!==null){const l=n.length===1?"one release":`${n.length} releases`;return`You were last caught up at v${e}. Since then ${l} changed something you would notice. Clicking the version in the topbar brings this back.`}if(s&&Ui(t))return`The deck has not run in this browser before, so this is what v${t} — the release you have — changed. Earlier releases are not repeated here; clicking the version in the topbar brings all of them back.`;const i=n[0].version;if(!Ui(t))return"Everything this build has to say, newest first. Most releases have nothing here, which is why the deck stays quiet about them.";const a=Bi(i,t);return a<0?`v${t} — the release you are running — changed nothing you would notice, which most releases do not. Below is the last release that did, and everything before it, newest first.`:a>0?"Everything this build has to say, newest first. Most releases have nothing here, which is why the deck stays quiet about them.":`You are running v${t}, and this is what it changed — and everything before it, newest first. Most releases have nothing here, which is why the deck stays quiet about them.`}const AD=new RegExp("^(?:\\p{Extended_Pictographic}|\\p{Emoji_Modifier}|\\p{Regional_Indicator}|[\\u200D\\uFE0F])+(?= \\S)","u");function MD(e){const t=AD.exec(e);return t?{icon:t[0],rest:e.slice(t[0].length)}:{icon:null,rest:e}}function ID(){if(typeof window>"u")return null;try{return window.localStorage}catch{return null}}function OD(e){if(!e)return null;let t=null;try{t=e.getItem(Tw)}catch{return null}return Ui(t)?t:null}function PD(e){if(!e)return!1;try{return e.getItem(Tw),!0}catch{return!1}}function $D(e,t){if(!e)return!1;try{return e.setItem(Tw,t),!0}catch{return!1}}function LD({stored:e,running:t,notes:n,remembers:s=!0}){if(!Ui(t))return{show:[],record:null,reason:"no-version"};if(!Ui(e)){if(!s)return{show:[],record:t,reason:"cannot-remember"};const l=CD(n,t);return l.length?{show:l,record:t,reason:"welcome"}:{show:[],record:t,reason:"first-run"}}const i=Bi(e,t);if(i===0)return{show:[],record:null,reason:"seen"};if(i>0)return{show:[],record:null,reason:"ahead"};const a=OT(n,e,t);return a.length?{show:a,record:t,reason:"new-notes"}:{show:[],record:t,reason:"nothing-new"}}function qD({entries:e,since:t,running:n,firstRun:s,onClose:i}){const a=Sn(i),l=TD(e);return d.jsx("div",{className:"modal-backdrop",onClick:i,role:"presentation",children:d.jsxs("div",{ref:a,className:"modal release-notes",onClick:u=>u.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"release-notes-title",children:[d.jsxs("header",{className:"modal-head",children:[d.jsxs("div",{className:"modal-title",children:[d.jsx("span",{id:"release-notes-title",className:"modal-tool-name",children:"What's new"}),l&&d.jsx("span",{className:"modal-tool-id",children:l})]}),d.jsx("div",{className:"modal-actions",children:d.jsx("button",{type:"button",className:"glyph-btn",onClick:i,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),d.jsxs("section",{className:"modal-body",children:[d.jsx("p",{className:"modal-note",children:RD({since:t,running:n,firstRun:s,entries:e})}),e.map(u=>d.jsxs("section",{className:"modal-section",children:[d.jsxs("h3",{className:"rn-version",children:["v",u.version]}),d.jsx("ul",{className:"rn-notes",children:u.notes.map((h,p)=>{const{icon:f,rest:g}=MD(h.title);return d.jsxs("li",{className:"rn-note",children:[d.jsxs("p",{className:"rn-note-title",children:[f&&d.jsx("span",{className:"rn-note-icon",children:f}),g]}),d.jsx("p",{className:"rn-note-body",children:h.body})]},p)})})]},u.version))]})]})})}function DD(e){return e.slice().sort((t,n)=>t.y-n.y||t.x-n.x)}function FD(e,t,n){var l;if(e.length===0)return null;const s=DD(e),i=t?s.findIndex(u=>u.id===t):-1,a=i===-1?n===1?0:s.length-1:(i+n+s.length)%s.length;return((l=s[a])==null?void 0:l.id)??null}const zD=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Escape","Delete","Backspace"]);function BD(e,t){return t==null?{kind:"deck",nodeId:null}:e.key==="Enter"||e.key===" "?{kind:"activate",nodeId:t,additive:e.shiftKey}:zD.has(e.key)?{kind:"node",nodeId:t}:{kind:"deck",nodeId:t}}const UD=new Set(["","BODY","HTML","#DOCUMENT"]);function WD(e){return!e||bw(e)?!1:!UD.has(String(e.tagName??"").toUpperCase())}function Qc(e,t){if(t.size!==0)for(const n of Array.from(e.keys()))t.has(n)||e.delete(n)}function HD(e,t){let n=!1;for(const i of e)if(!t.has(i)){n=!0;break}if(!n)return e;const s=new Set;for(const i of e)t.has(i)&&s.add(i);return s}function GD(e){const t=new Set;for(const n of e)t.add(n.id),t.add(`group:${n.sessionId}`);return t}function VD(e,t){if(!t||!e.agents.get(t))return null;const s=new Set([t]);let i=t;for(;i;){const l=e.agents.get(i);if(!(l!=null&&l.parentId)||s.has(l.parentId))break;s.add(l.parentId),i=l.parentId}let a=!0;for(;a;){a=!1;for(const l of e.agents.values())l.parentId&&s.has(l.parentId)&&!s.has(l.id)&&(s.add(l.id),a=!0)}return s}function YD(e,t){const n=new Set;for(const s of t){const i=VD(e,s);if(i)for(const a of i)n.add(a)}return n.size>0?n:null}function PT(e,t,n){return!t.has(e)||n.has(e)}function KD(e,t,n,s){return!t.has(e)&&PT(e,n,s)}function XD(e,t,n){const s={x:0,y:0};return t.set(e,s),n.add(e),s}function QD(e,t,n,s){n.set(e,t),s.delete(e)}const ZD=40,JD=120;function e5(e,t){let n=null,s=0,i=Number.NEGATIVE_INFINITY;const a=()=>{n=null,i=t.now(),e()},l=()=>{n!=null&&(t.clearTimeout(n),n=null)},u=(h,p,f)=>{if(n!=null){if(s<=h)return;l()}const g=Math.min(f,Math.max(0,h-p));s=h,n=t.setTimeout(a,g)};return{live(h=ZD){const p=t.now(),f=Math.max(i+h,p);if(f<=p){l(),a();return}u(f,p,h)},replay(h=JD){l(),s=t.now()+h,n=t.setTimeout(a,h)},flush(){l(),a()},cancel(){l()}}}const t5=1e3;function n5(e={}){const t=Math.max(1,Math.floor(e.limit??t5)),n=e.protect;let s=!1,i=[],a=new Set,l=0,u=0,h=null;return{get paused(){return s},get size(){return i.length},get dropped(){return l},get overflowed(){return l>0},get through(){return u},accept(p){const f=typeof(p==null?void 0:p.seq)=="number"?p.seq:null,g=(p==null?void 0:p.epoch)??null,y=g!==null&&g!==h;y&&(h=g,u=0);const w=f!==null&&!y&&f<=u;if(f!==null&&f>u&&(u=f),!s)return!0;if(w)return!1;if(i.push(p),n!=null&&n(p)&&a.add(p),i.length>t){let N=0;if(a.size<i.length)for(;a.has(i[N]);)N++;const[b]=i.splice(N,1);a.delete(b),l++}return!1},setPaused(p){if(s=p,p)return[];const f=i;return i=[],a=new Set,l=0,f}}}const $T="agent-dag.theme";function r5(e){return e==="light"?"light":"dark"}function s5(){return r5($u($T))}function o5({waiting:e,running:t,connected:n=!0}){return{title:e>0?`(${e}) ${zt}`:zt,icon:n?e>0?"waiting":t>0?"running":"idle":"offline"}}const Zc={offline:"#e05252",waiting:"#c97d12",running:"#2a90d4",idle:"#7e828c"};function Jc(e,t){const i=l=>`<circle cx="16" cy="16" r="12" fill="none" stroke="${e}" stroke-width="5"${l}/>`;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}"/>`:t==="offline"?i(` stroke-dasharray="${56.5485.toFixed(2)} ${18.8495.toFixed(2)}" transform="rotate(-58 16 16)"`):i("")+(t==="running"?`<circle cx="16" cy="16" r="5" fill="${e}"/>`:"")}</svg>`}const i5=Object.freeze({offline:`data:image/svg+xml,${encodeURIComponent(Jc(Zc.offline,"offline"))}`,waiting:`data:image/svg+xml,${encodeURIComponent(Jc(Zc.waiting,"waiting"))}`,running:`data:image/svg+xml,${encodeURIComponent(Jc(Zc.running,"running"))}`,idle:`data:image/svg+xml,${encodeURIComponent(Jc(Zc.idle,"idle"))}`}),a5="No sessions are waiting for you.";function l5(e){if(e.length===0)return"";const[t,...n]=e;if(n.length===0)return`${t.label} is waiting for your permission.`;const s=`${n.length} more session${n.length===1?"":"s"}`;return`${t.label} and ${s} are waiting for your permission.`}function c5(e,t){return t!==""?t:e===""?"":a5}function u5(){let e=0;return{begin(){const t=++e;return()=>t===e},cancel(){e++}}}function d5(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 f5(e){return e.claude&&e.codex?"Claude Code and Codex":e.claude?"Claude Code":e.codex?"Codex":null}const F1={claude:"Claude Code",codex:"Codex",opencode:"OpenCode",openclaw:"OpenClaw",copilot:"GitHub Copilot",pi:"pi-agent"};function Rw(e){const t=e.toLowerCase();return Object.hasOwn(F1,t)?F1[t]:t?t[0].toUpperCase()+t.slice(1):""}function h5(e){return e.length<=1?e[0]??"":`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`}function p5(e,t=[]){const n=t.length?h5(t.map(Rw)):f5(e);return n?`via ccusage · local ${n} logs`:"via ccusage · local agent logs"}function m5(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:"."}]},n=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,n]}function g5(e,t){const n=t.prefs??Vy,s=cl(n.done.level),i=cl(n["needs-input"].level),a=s===i?`${s}%`:`${s}% and ${i}%`,l=t.on?`Sound: on at ${a} — a tone when a turn finishes, another when Claude asks for you (M)`:"Sound: off — press M, or use the switch in here, for a tone when a turn finishes (M)",u=e.codex?`
|
|
150
|
+
|
|
151
|
+
Both CLIs get the finish tone. The second tone — Claude is waiting for you — has no Codex equivalent to fire on, so it only ever plays for Claude Code.`:"",h=t.on&&t.locked?`
|
|
152
|
+
|
|
153
|
+
Waiting for a click: this browser plays no sound until the page has been used at least once. Anything you press unlocks it.`:"";return l+u+h+`
|
|
154
|
+
|
|
155
|
+
Click to set the volume and the sound of each tone, and to hear either one.`}function LT(e){const t=new Map;for(const n of e)for(const s of n.agents??[]){if(!s||typeof s.agent!="string"||s.agent==="")continue;const i=t.get(s.agent)??{id:s.agent,cost:0,tokens:0};i.cost+=Number.isFinite(s.totalCost)?s.totalCost:0,i.tokens+=Number.isFinite(s.totalTokens)?s.totalTokens:0,t.set(s.agent,i)}return[...t.values()].sort((n,s)=>s.cost-n.cost||n.id.localeCompare(s.id))}function v5(e){const t=LT([{agents:e}]);return t.length<2?null:t.map(n=>`${Rw(n.id)} ${We(n.cost)}`).join(" · ")}function z1(e){switch(e.toLowerCase()){case"claude":return"var(--usage-purple)";case"codex":return"var(--usage-orange)";case"gemini":return"var(--usage-indigo)";case"copilot":return"var(--usage-green)";default:return"var(--usage-zinc)"}}function y5(e,t){if(!(t>0)||!(e>0))return"0%";const n=e/t*100;return n<.1?"<0.1%":`${n.toFixed(1)}%`}function eu(e){const t=e.toLowerCase();return t.includes("opus")?"var(--usage-purple)":t.includes("sonnet")?"var(--usage-blue)":t.includes("haiku")?"var(--usage-green)":t.includes("gpt-5")||t.includes("gpt5")?"var(--usage-amber)":t.includes("gpt")?"var(--usage-red)":t.includes("gemini")?"var(--usage-indigo)":t.includes("codex")?"var(--usage-orange)":"var(--usage-zinc)"}const w5=[7,14,30,90];function x5(e){const[t,n]=S.useState(null),[s,i]=S.useState(!1),a=S.useState(u5)[0],l=S.useRef(!1),u=(h=!1)=>{if(h&&!ar(l.current))return;const p=a.begin();l.current=h;const f=e;i(!0);const y=`/api/ccusage?since=${Dy(f)}${h?"&refresh=1":""}`;fetch(y).then(w=>w.json()).then(w=>{p()&&n({range:f,resp:w})}).catch(()=>{p()&&n({range:f,resp:{ok:!1,reason:"unreachable"}})}).finally(()=>{p()&&(l.current=!1,i(!1))})};return S.useEffect(()=>(u(!1),()=>a.cancel()),[e]),{landed:t,loading:s,reload:()=>u(!0)}}function b5({onClose:e,providers:t}){var F;const[n,s]=S.useState(30),[i,a]=S.useState(null),{landed:l,loading:u,reload:h}=x5(n),p=S.useRef(null),f=Sn(e,{focusRef:p}),g=d5({loading:u,want:n,answer:l&&{range:l.range,ok:l.resp.ok===!0,days:((F=l.resp.days)==null?void 0:F.length)??0}}),y=g.phase==="chart"?l.resp.days??[]:[],w=S.useMemo(()=>y.reduce((M,A)=>Math.max(M,A.totalCost),0),[y]),N=S.useRef(null);S.useLayoutEffect(()=>{const M=N.current;M&&(M.scrollLeft=M.scrollWidth)},[y]);const{totalCost:b,totalTok:_,inOut:k,cacheRead:E,modelCosts:j}=S.useMemo(()=>{let M=0,A=0,q=0,W=0;const Y=new Map;for(const T of y){M+=T.totalCost,A+=T.totalTokens,q+=T.inputTokens+T.outputTokens,W+=T.cacheReadTokens;for(const Z of T.modelBreakdowns)Y.set(Z.modelName,(Y.get(Z.modelName)??0)+Z.cost)}return{totalCost:M,totalTok:A,inOut:q,cacheRead:W,modelCosts:Y}},[y]),C=S.useMemo(()=>Array.from(j.entries()).sort((M,A)=>A[1]-M[1]),[j]),I=S.useMemo(()=>LT(y),[y]),P=I.length>1,O=i?y.find(M=>M.period===i)??null:null;return d.jsx("div",{className:"uh-backdrop",onClick:e,role:"presentation",children:d.jsxs("div",{ref:f,className:"uh-modal",onClick:M=>M.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Usage history",children:[d.jsxs("header",{className:"uh-head",children:[d.jsxs("div",{className:"uh-titlewrap",children:[d.jsx("div",{className:"uh-title",children:"Usage history"}),d.jsx("div",{className:"uh-sub",children:p5(t,I.map(M=>M.id))})]}),d.jsx("div",{className:"uh-range",role:"group","aria-label":"Range",children:w5.map(M=>d.jsxs("button",{type:"button","aria-pressed":n===M,className:"uh-range-btn",onClick:()=>{s(M),a(null)},children:[M,"d"]},M))}),d.jsx("button",{className:"glyph-btn uh-reload",onClick:h,...ir(u),title:"Re-run ccusage","aria-label":"Reload",children:u?"…":"↻"}),d.jsx("button",{ref:p,className:"glyph-btn uh-close",onClick:e,"aria-label":"Close",children:"×"})]}),g.phase==="busy"?d.jsx("div",{className:"uh-status","aria-busy":"true",children:l?"running ccusage…":"running ccusage… (first run downloads the package)"}):g.phase==="error"?d.jsxs("div",{className:"uh-status uh-err",title:Fi(l.resp)||void 0,children:[m4(l.resp,"ccusage did not report usage"),d.jsx("div",{children:d.jsx("button",{className:"btn uh-retry",onClick:h,...ir(u),children:u?"trying…":"Try again"})})]}):g.phase==="empty"?d.jsx("div",{className:`uh-status${g.stale?" uh-stale":""}`,"aria-busy":g.stale||void 0,children:"no usage in this range"}):d.jsxs("div",{className:g.stale?"uh-stale":void 0,"aria-busy":g.stale||void 0,children:[d.jsxs("div",{className:"uh-totals",children:[d.jsx(tu,{label:"total cost",val:We(b),accent:!0}),d.jsx(tu,{label:"tokens",val:Ct(_)}),d.jsx(tu,{label:"input+output",val:Ct(k)}),d.jsx(tu,{label:"cache reads",val:Ct(E)})]}),P&&d.jsxs("div",{className:"uh-agents",role:"group","aria-label":"Cost by CLI",children:[d.jsx("div",{className:"uh-agent-bar","aria-hidden":"true",children:I.map(M=>d.jsx("span",{className:"uh-agent-seg",style:{width:`${b>0?M.cost/b*100:0}%`,background:z1(M.id)}},M.id))}),d.jsx("div",{className:"uh-agent-keys",children:I.map(M=>d.jsxs("span",{className:"uh-agent-key",title:`${M.id} · ${Ct(M.tokens)} tokens`,children:[d.jsx("span",{className:"uh-legend-dot",style:{background:z1(M.id)}}),Rw(M.id),d.jsx("span",{className:"uh-agent-cost",children:We(M.cost)}),d.jsx("span",{className:"uh-agent-share",children:y5(M.cost,b)})]},M.id))})]}),d.jsx("div",{ref:N,className:"uh-chart",role:"group","aria-label":"Daily cost by model",children:y.map(M=>{const A=w>0?M.totalCost/w*100:0,q=M.period===i,W=`${M.period}, ${We(M.totalCost)}`;return d.jsxs("button",{className:`uh-bar-col${q?" sel":""}`,onClick:()=>a(q?null:M.period),"aria-pressed":q,"aria-label":W,title:`${M.period} · ${We(M.totalCost)}`,style:{flexBasis:`${100/y.length}%`},children:[d.jsx("div",{className:"uh-bar",style:{height:`${Math.max(A,M.totalCost>0?2:0)}%`},children:M.modelBreakdowns.slice().sort((Y,T)=>T.cost-Y.cost).map(Y=>{const T=M.totalCost>0?Y.cost/M.totalCost*100:0;return d.jsx("div",{className:"uh-bar-seg",style:{height:`${T}%`,background:eu(Y.modelName)}},Y.modelName)})}),d.jsx("span",{className:"uh-bar-label",children:M.period.slice(5)})]},M.period)})}),d.jsx("div",{className:"uh-legend",children:C.map(([M,A])=>d.jsxs("span",{className:"uh-legend-item",title:M,children:[d.jsx("span",{className:"uh-legend-dot",style:{background:eu(M)}}),Is(M)," ",d.jsx("span",{className:"uh-legend-cost",children:We(A)})]},M))}),O&&d.jsxs("div",{className:"uh-detail",children:[d.jsxs("div",{className:"uh-detail-head",children:[d.jsx("span",{className:"uh-detail-date",children:O.period}),d.jsx("span",{className:"uh-detail-cost",children:We(O.totalCost)}),(()=>{var q,W;const A=v5(O.agents)??((W=(q=O.metadata)==null?void 0:q.agents)!=null&&W.length?O.metadata.agents.join(" · "):null);return A?d.jsx("span",{className:"uh-detail-agents",title:A,children:A}):null})()]}),d.jsxs("div",{className:"uh-detail-mini",children:[d.jsx(nu,{label:"input",val:Ct(O.inputTokens)}),d.jsx(nu,{label:"output",val:Ct(O.outputTokens)}),d.jsx(nu,{label:"cache write",val:Ct(O.cacheCreationTokens)}),d.jsx(nu,{label:"cache read",val:Ct(O.cacheReadTokens)})]}),d.jsx("div",{className:"uh-detail-models",children:O.modelBreakdowns.slice().sort((M,A)=>A.cost-M.cost).map(M=>{const A=O.totalCost>0?M.cost/O.totalCost*100:0;return d.jsxs("div",{className:"uh-model-row",title:M.modelName,children:[d.jsxs("span",{className:"uh-model-name",children:[d.jsx("span",{className:"uh-legend-dot",style:{background:eu(M.modelName)}}),d.jsx("span",{className:"uh-model-label",children:Is(M.modelName)})]}),d.jsx("span",{className:"uh-model-bar",children:d.jsx("span",{className:"uh-model-bar-fill",style:{width:`${A}%`,background:eu(M.modelName)}})}),d.jsx("span",{className:"uh-model-cost",children:We(M.cost)})]},M.modelName)})})]})]})]})})}function tu({label:e,val:t,accent:n}){return d.jsxs("div",{className:"uh-stat",children:[d.jsx("span",{className:`uh-stat-val${n?" accent":""}`,children:t}),d.jsx("span",{className:"uh-stat-label",children:e})]})}function nu({label:e,val:t}){return d.jsxs("div",{className:"uh-ministat",children:[d.jsx("span",{className:"uh-ministat-val",children:t}),d.jsx("span",{className:"uh-ministat-label",children:e})]})}function _5(e){const t=/^#?([0-9a-f]{6})$/i.exec((e??"").trim());if(!t)return!1;const n=parseInt(t[1],16),s=[n>>16&255,n>>8&255,n&255].map(i=>{const a=i/255;return a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4)});return .2126*s[0]+.7152*s[1]+.0722*s[2]>.5}const B1=1e4,k5=12e3;function S5({browsers:e,findings:t,watching:n,palette:s,now:i=()=>Date.now()}){const a=S.useRef(null),l=S.useRef(null);return l.current={browsers:e,findings:t,watching:n},S.useEffect(()=>{var w;const u=a.current;if(!u)return;const h=u.getContext("2d");if(!h)return;const p=((w=window.matchMedia)==null?void 0:w.call(window,"(prefers-reduced-motion: reduce)").matches)??!1;let f=0,g=!1;const y=()=>{var ne;if(g)return;const N=l.current;if(!N)return;const{browsers:b,findings:_,watching:k}=N,E=s["--accent"]||"#7dd3fc",j=s["--line"]||"#1f2229",C=s["--text-dim"]||"#6e727c",I=_5(s["--bg"]),P=I?42:26,O=I?.85:.65,F=i(),M=Math.min(window.devicePixelRatio||1,2),A=u.clientWidth,q=u.clientHeight;(u.width!==A*M||u.height!==q*M)&&(u.width=A*M,u.height=q*M),h.setTransform(M,0,0,M,0,0),h.clearRect(0,0,A,q);const W=A/2,Y=q/2,T=Math.min(A,q)/2-6;h.strokeStyle=j,h.lineWidth=1,h.globalAlpha=I?1:.9;for(const X of[.4,.7,1])h.beginPath(),h.arc(W,Y,T*X,0,Math.PI*2),h.stroke();h.beginPath(),h.moveTo(W-T,Y),h.lineTo(W+T,Y),h.moveTo(W,Y-T),h.lineTo(W,Y+T),h.stroke(),h.globalAlpha=1;const U=(k&&!p?F%B1/B1:0)*Math.PI*2-Math.PI/2;if(k){const X=(ne=h.createConicGradient)==null?void 0:ne.call(h,U-.85,W,Y);X&&(X.addColorStop(0,"transparent"),X.addColorStop(.85/(Math.PI*2),`color-mix(in srgb, ${E} ${P}%, transparent)`),X.addColorStop(1,"transparent"),h.fillStyle=X,h.beginPath(),h.moveTo(W,Y),h.arc(W,Y,T,U-.85,U),h.closePath(),h.fill()),h.strokeStyle=E,h.globalAlpha=O,h.beginPath(),h.moveTo(W,Y),h.lineTo(W+Math.cos(U)*T,Y+Math.sin(U)*T),h.stroke(),h.globalAlpha=1}b.forEach((X,H)=>{const J=H/Math.max(b.length,1)*Math.PI*2-Math.PI/2,$=X.lastReadMs===null?1:Math.min(1,(F-X.lastReadMs)/12e4),G=T*(.42+$*.5),Q=W+Math.cos(J)*G,D=Y+Math.sin(J)*G,L=Math.abs((U-J+Math.PI*3)%(Math.PI*2)-Math.PI),K=k?Math.max(0,1-L/.55):0;h.beginPath(),h.arc(Q,D,3+K*1.6,0,Math.PI*2),h.fillStyle=X.running?E:C,h.globalAlpha=X.running?.55+K*.45:.35,h.fill(),h.globalAlpha=1});for(const X of _){const H=(F-X.atMs)/k5;if(H<0||H>1)continue;const $=Math.max(0,b.findIndex(D=>D.key===X.browser))/Math.max(b.length,1)*Math.PI*2-Math.PI/2,G=W+Math.cos($)*T*.6,Q=Y+Math.sin($)*T*.6;h.beginPath(),h.arc(G,Q,4+H*22,0,Math.PI*2),h.strokeStyle=E,h.globalAlpha=(1-H)*.8,h.lineWidth=1.5,h.stroke(),h.globalAlpha=1}f=requestAnimationFrame(y)};return y(),()=>{g=!0,cancelAnimationFrame(f)}},[i,s]),d.jsx("canvas",{ref:a,className:"bw-radar",role:"img","aria-label":n?`Watching ${e.length} browser${e.length===1?"":"s"}`:"Not watching"})}const U1="agent-dag.browserWatch.seenMs";function N5(e,t){return e.filter(n=>n.startMs>t)}function E5(e,t,n){if(e===null)return null;const s=e+t-n;return s>0?s:null}function j5(e){const t=Math.ceil(e/1e3),n=Math.floor(t/60),s=t%60;return n>0?`${n}m ${s}s`:`${s}s`}function qT(e){return(e??[]).filter(t=>t.installed&&t.profiles>0)}function W1(e,t){return t?{kind:"saving",word:"Saving",detail:""}:e.settings.enabled?{kind:"on",word:"Watching",detail:""}:{kind:"off",word:"Paused",detail:"nothing new is recorded"}}function C5(e,t){return e.map(n=>({key:n.key,name:n.name,running:n.running,visits:t.filter(s=>s.browser===n.key).reduce((s,i)=>s+i.programVisits,0)}))}function T5(e,t){if(e===null)return null;const n=Math.max(0,Math.round((t-e)/1e3));if(n<5)return"just now";if(n<60)return`${n} sec ago`;const s=Math.round(n/60);return s<60?`${s} min ago`:`${Math.round(s/60)} hr ago`}function R5(e){const t=e.profiles.filter(s=>s.degraded);if(t.length>0){const s=t[0],i=t.length-1;return{kind:"unreadable",text:`${s.name}/${s.profile} could not be read — ${s.reason??"no reason given"}`+(i>0?`, and ${i} more`:"")+". The watch continues on the profiles it can read."}}const n=qT(e.browsers);return n.length===0?{kind:"no-profiles",text:"No browser on this machine has a profile to read. Open one of the browsers below once and it will be watched from then on."}:n.some(s=>s.running)?null:{kind:"none-running",text:"No watched browser is running, so nothing can be navigated right now. Their history is still read, and anything found while they were open is still here."}}function A5(e){const t=n=>new Date(n).toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit",hour12:!1});return e.count===1||e.endMs-e.startMs<6e4?t(e.startMs):`${t(e.startMs)} → ${t(e.endMs)}`}function M5(e){return new Date(e).toLocaleDateString(void 0,{weekday:"short",day:"numeric",month:"short"})}function H1(e){const t=Math.round((e.endMs-e.startMs)/6e4);return t<1?"":`${t} min`}function I5({onClose:e,onSeen:t,onWatching:n,palette:s}){const i=Sn(e),[a,l]=S.useState(null),[u,h]=S.useState(null),[p,f]=S.useState(!1),g=S.useRef(!1),[y,w]=S.useState(null),[N,b]=S.useState(null),[_,k]=S.useState(!1),[E,j]=S.useState(!1),[C,I]=S.useState(!1),[P,O]=S.useState(!1),[F,M]=S.useState(!1),[A,q]=S.useState(!1),[W,Y]=S.useState(()=>Date.now());S.useEffect(()=>{const Q=setInterval(()=>Y(Date.now()),1e3);return()=>clearInterval(Q)},[]);const T=S.useCallback(async Q=>{var D;if(!(Q&&!ar(g.current))){g.current=Q,f(!0);try{const L=await fetch(`/api/browser-watch${Q?"?refresh=1":""}`);if(!L.ok)throw new Error(`the deck answered ${L.status}`);const K=await L.json();l(K),w(se=>{var he;return se===null?((he=K==null?void 0:K.settings)==null?void 0:he.quietMinutes)??15:se}),n(((D=K==null?void 0:K.settings)==null?void 0:D.enabled)===!0),h(null)}catch(L){h(L instanceof Error?L.message:String(L))}finally{g.current=!1,f(!1)}}},[n]);S.useEffect(()=>{T(!1)},[T]),S.useEffect(()=>{const Q=setInterval(()=>{T(!1)},1e4);return()=>clearInterval(Q)},[T]);const Z=S.useCallback(async Q=>{try{await fetch("/api/browser-watch/dismiss",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({host:Q.host,startMs:Q.startMs})})}finally{await T(!1)}},[T]),U=S.useCallback(async Q=>{k(!0);try{const D=await fetch("/api/browser-watch",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(Q)});if(!D.ok)throw new Error(`the deck answered ${D.status}`);await T(!1)}catch(D){h(D instanceof Error?D.message:String(D))}finally{k(!1)}},[T]);S.useEffect(()=>()=>t(Date.now()),[t]);const ne=S.useMemo(()=>{const Q=[];for(const D of(a==null?void 0:a.episodes)??[]){const L=M5(D.startMs),K=Q[Q.length-1];K&&K.label===L?K.episodes.push(D):Q.push({label:L,episodes:[D]})}return Q},[a]),X=qT(a==null?void 0:a.browsers),H=((a==null?void 0:a.browsers)??[]).filter(Q=>!(Q.installed&&Q.profiles>0)),J=a?R5(a):null,$=X.reduce((Q,D)=>Q+D.profiles,0),G=a?E5(a.coverage.lastHumanMs,a.coverage.quietMs,W):null;return d.jsx("div",{className:"modal-backdrop",onClick:e,role:"presentation",children:d.jsxs("div",{ref:i,className:"modal bw-modal",onClick:Q=>Q.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"bw-title",children:[d.jsxs("header",{className:"modal-head",children:[d.jsxs("div",{className:"modal-title",children:[d.jsx("span",{className:"modal-tool-name",id:"bw-title",children:"Browser watch"}),d.jsx("span",{className:"modal-tool-id",children:a?`${$} ${$===1?"profile":"profiles"} · local only`:"local only"})]}),d.jsxs("div",{className:"modal-actions",children:[d.jsx("button",{className:"glyph-btn",onClick:()=>void T(!0),...ir(p),"aria-label":"Re-read every profile now",title:"Re-read every profile now",children:p?"…":"↻"}),d.jsx("button",{className:"glyph-btn",onClick:e,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),d.jsxs("div",{className:"modal-body bw-body",children:[!a&&!u&&d.jsxs("div",{className:"bw-loading",children:[d.jsx("span",{className:"bw-loading-bar","aria-hidden":!0}),d.jsx("p",{children:"Reading each browser's history. The first look copies the file, which takes a moment."})]}),u&&d.jsx("div",{className:"bw-state",children:d.jsxs("div",{className:"bw-row err",children:[d.jsx("span",{className:"bw-dot","aria-hidden":!0}),d.jsx("span",{className:"bw-row-label",children:"Could not read"}),d.jsx("span",{className:"bw-row-detail",children:u})]})}),a&&J&&d.jsx("p",{className:`bw-trouble ${J.kind}`,role:"status",children:J.text}),a&&d.jsxs("div",{className:"bw-work",children:[d.jsxs("aside",{className:"bw-side",children:[d.jsxs("section",{className:"bw-sec",children:[d.jsxs("h4",{className:"bw-sec-head",children:["Activity overview",d.jsx("button",{className:"bw-help",onClick:()=>O(Q=>!Q),"aria-expanded":P,"aria-label":"What the sweep and the dots mean",children:"?"})]}),d.jsxs("div",{className:"bw-glance",children:[d.jsx(S5,{browsers:X.map(Q=>{var D;return{key:Q.key,name:Q.name,running:Q.running,lastReadMs:((D=a.profiles.find(L=>L.browser===Q.key))==null?void 0:D.lastWrittenMs)??null}}),findings:a.episodes.slice(0,6).map(Q=>({browser:Q.browser??null,atMs:Q.endMs})),watching:a.settings.enabled,palette:s}),d.jsx("ul",{className:"bw-counts",children:C5(X,a.profiles).map(Q=>d.jsxs("li",{children:[d.jsx("span",{className:"bw-count-n",children:Q.visits.toLocaleString("en-US")}),d.jsx("span",{className:"bw-count-of",children:Q.name})]},Q.key))})]}),d.jsx("p",{className:"bw-since",children:"Pages a program opened, since this deck started"}),a.coverage.checkedMs>0&&d.jsxs("p",{className:"bw-since",children:["Last checked ",T5(a.coverage.checkedMs,W),a.coverage.checks>0&&d.jsxs(d.Fragment,{children:[" · ",a.coverage.checks.toLocaleString("en-US")," ",a.coverage.checks===1?"check":"checks"]})]}),G!==null&&d.jsxs("p",{className:"bw-gate",children:["You are browsing — a program page would count in ",j5(G)]}),P&&d.jsxs("dl",{className:"bw-key",children:[d.jsx("dt",{children:"Sweep"}),d.jsx("dd",{children:"one poll of every watched profile"}),d.jsx("dt",{children:"Dot"}),d.jsx("dd",{children:"a browser, further out the longer since it last wrote history"}),d.jsx("dt",{children:"Ring"}),d.jsx("dd",{children:"a finding, leaving the browser it came from"})]})]}),d.jsxs("section",{className:"bw-sec",children:[d.jsxs("h4",{className:"bw-sec-head",children:["Watched profiles",d.jsx("button",{className:"bw-help",onClick:()=>M(Q=>!Q),"aria-expanded":F,"aria-label":"What running, idle and connected to Anthropic mean",children:"?"})]}),F&&d.jsxs("dl",{className:"bw-key",children:[d.jsx("dt",{children:"Running"}),d.jsx("dd",{children:"the browser has a process on this machine right now"}),d.jsx("dt",{children:"Connected"}),d.jsx("dd",{children:"an open connection to an address Anthropic's relay uses — which it shares with claude.ai, so an open tab looks the same as an agent channel"})]}),d.jsx("ul",{className:"bw-profiles",children:X.map(Q=>d.jsxs("li",{children:[d.jsx("span",{className:`bw-prof-dot${Q.running?" on":""}`,"aria-hidden":!0}),d.jsx("span",{className:"bw-prof-name",children:Q.name}),d.jsx("span",{className:"bw-prof-state",children:Q.running?"running":"idle"}),Q.running&&Q.relay.state==="live"&&d.jsx("span",{className:"bw-relay",children:"connected to Anthropic"})]},Q.key))}),H.length>0&&d.jsxs(d.Fragment,{children:[d.jsxs("button",{className:"bw-why bw-rest-head",onClick:()=>q(Q=>!Q),"aria-expanded":A,children:[d.jsx("span",{className:"bw-chev","aria-hidden":!0,children:A?"▾":"▸"})," ",H.length," not watched"]}),A&&d.jsxs("p",{className:"bw-rest",children:[H.map(Q=>Q.name).join(", ")," — not installed, or installed and never opened, so there is no history to read."]})]})]})]}),d.jsxs("div",{className:"bw-main",children:[d.jsxs("section",{className:"bw-findings",children:[d.jsxs("h4",{className:"bw-sec-head bw-head-row",children:["Findings",a.episodes.length>0&&d.jsxs("span",{className:"bw-feed-count",children:[a.episodes.length," ",a.episodes.length===1?"episode":"episodes"]})]}),d.jsx("div",{className:"bw-eps",children:ne.length===0?d.jsxs("div",{className:"bw-empty",children:[d.jsx("p",{className:"bw-empty-head",children:"Nothing found yet"}),d.jsxs("p",{className:"bw-empty-note",children:["An episode lands here when a program opens pages in a browser nobody has touched for"," ",a.settings.quietMinutes," ",a.settings.quietMinutes===1?"minute":"minutes",". On most machines that is rare, so an empty list is the ordinary result rather than a sign something is wrong."]}),!a.settings.enabled&&d.jsx("p",{className:"bw-empty-note",children:"Watching is off, so this shows only what this deck has seen since it started. Anything an earlier run recorded comes back when you switch it on."})]}):ne.map(Q=>d.jsxs("div",{className:"bw-day",children:[d.jsx("h4",{className:"bw-sec-head",children:Q.label}),Q.episodes.map(D=>{const L=`${D.host}-${D.startMs}`,K=N===L;return d.jsxs("div",{className:`bw-ep${K?" open":""}`,children:[d.jsxs("div",{className:"bw-ep-row",children:[d.jsxs("button",{className:"bw-ep-head",onClick:()=>b(K?null:L),"aria-expanded":K,children:[d.jsx("span",{className:"bw-chev","aria-hidden":!0,children:K?"▾":"▸"}),d.jsx("span",{className:"bw-ep-host",children:D.host}),d.jsxs("span",{className:"bw-ep-meta",children:[A5(D),H1(D)&&d.jsxs(d.Fragment,{children:[" · ",H1(D)]})]}),d.jsxs("span",{className:"bw-ep-count",children:[D.count," ",D.count===1?"page":"pages"]})]}),d.jsx("button",{className:"glyph-btn bw-ep-x",onClick:()=>void Z(D),"aria-label":`Dismiss ${D.host}`,title:"Dismiss — it leaves this list for good, and stays in the log file",children:"×"})]}),K&&d.jsx("ul",{className:"bw-urls",children:D.urls.map((se,he)=>d.jsxs("li",{children:[d.jsx("span",{className:"bw-url-time",children:new Date(se.timeMs).toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit",hour12:!1})}),d.jsx("span",{className:"bw-url",children:se.url})]},`${se.url}-${se.timeMs}-${he}`))})]},L)})]},Q.label))})]}),d.jsxs("section",{className:"bw-feed",children:[d.jsxs("h4",{className:"bw-sec-head bw-head-row",children:["Live activity",d.jsxs("span",{className:"bw-feed-count",children:[a.log.length," ",a.log.length===1?"event":"events"]})]}),d.jsx("p",{className:"bw-since bw-feed-note",children:"Pages you opened yourself — counted to run the rule, never written down. Addresses appear under Findings, and only for pages a program opened."}),d.jsx("div",{className:"bw-log","aria-live":"polite","aria-relevant":"additions",children:a.log.length===0?d.jsx("p",{className:"bw-note",children:"The deck writes a line here each time it looks at a profile."}):a.log.map(Q=>d.jsxs("div",{className:`bw-log-line ${Q.level}${Q.parts?"":" sys"}`,children:[d.jsx("span",{className:"bw-log-time",children:new Date(Q.atMs).toLocaleTimeString("en-GB",{hour12:!1})}),Q.parts?d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"bw-log-browser",children:Q.parts.browser}),d.jsx("span",{className:"bw-log-profile",title:Q.parts.profile,children:Q.parts.profile}),d.jsxs("span",{className:"bw-log-value",children:[Q.parts.value,Q.parts.flagged>0&&d.jsxs("span",{className:"bw-log-flag",children:[" · ",Q.parts.flagged," flagged"]})]})]}):d.jsx("span",{className:"bw-log-sys",children:Q.text})]},`${Q.atMs}-${Q.level}-${Q.text}`))})]})]})]}),a&&E&&d.jsxs("div",{className:"bw-settings",children:[d.jsxs("label",{title:"A program opening a page counts as a finding only if nobody had touched the browser for this long. Shorter catches more and reports more of your own work; longer is quieter.",children:[d.jsx("span",{children:"Nobody browsing for"}),d.jsxs("select",{value:y??a.settings.quietMinutes,onChange:Q=>{w(Number(Q.target.value)),U({quietMinutes:Number(Q.target.value)})},children:[d.jsx("option",{value:1,children:"1 min"}),d.jsx("option",{value:5,children:"5 min"}),d.jsx("option",{value:15,children:"15 min"}),d.jsx("option",{value:30,children:"30 min"}),d.jsx("option",{value:60,children:"60 min"})]})]}),d.jsxs("label",{children:[d.jsx("span",{children:"When it finds one"}),d.jsx("select",{value:a.settings.reaction,onChange:Q=>void U({reaction:Q.target.value}),disabled:!a.settings.enabled,title:a.settings.enabled?"What to do besides writing it down.":"Turn watching on to arm a reaction.",children:(a.reactions??["notify"]).map(Q=>d.jsx("option",{value:Q,children:Q==="notify"?"notify me":Q==="close-tab"?"close the tab":"quit the browser"},Q))})]}),d.jsxs("div",{className:"bw-settings-note",children:[d.jsxs("p",{children:["Chrome marks a navigation that came from an extension or a command rather than from a click. These are the ones that happened while nobody had touched the browser for the time above. ",d.jsx("strong",{children:"Usually that is your own agent doing what you asked."})]}),d.jsxs("button",{className:"bw-why",onClick:()=>I(Q=>!Q),"aria-expanded":C,children:[d.jsx("span",{className:"bw-chev","aria-hidden":!0,children:C?"▾":"▸"})," What Browser Watch can access"]}),C&&d.jsxs("dl",{className:"bw-access",children:[d.jsx("dt",{children:"Reads"}),d.jsxs("dd",{children:["A copy of each browser's own history database — the live file is locked while the browser holds it. Only rows newer than the moment this deck started:"," ",new Date(a.coverage.startedMs).toLocaleString(),"."]}),d.jsx("dt",{children:"Keeps"}),d.jsxs("dd",{children:["Only while the switch is on, and only the episodes it flagged — never your ordinary browsing. In ",d.jsx("code",{className:"bw-path",children:a.coverage.logPath}),", with every address written in full so you can check it yourself."]}),d.jsx("dt",{children:"Sends"}),d.jsx("dd",{children:"Nothing. No part of this reads or writes over the network; the deck serves on 127.0.0.1 and this panel talks only to it."}),d.jsx("dt",{children:"Never reads"}),d.jsx("dd",{children:"Anything from before this deck started, cookies, saved passwords, page contents, or any browser profile with no history file."})]})]})]}),a&&d.jsxs("footer",{className:"bw-status",children:[d.jsx("span",{className:`bw-mode-dot${a.settings.enabled?" on":""}`,"aria-hidden":!0}),d.jsx("span",{className:"bw-mode-word",children:W1(a,_).word},W1(a,_).kind),d.jsx("span",{className:"bw-status-text",children:a.coverage.archived===0?a.settings.enabled?"No episodes recorded yet":"No episodes on disk":`${a.coverage.archived} ${a.coverage.archived===1?"episode":"episodes"} on disk`}),d.jsx("button",{className:`glyph-btn bw-gear${E?" on":""}`,onClick:()=>j(Q=>!Q),"aria-expanded":E,"aria-label":"Settings",title:"Settings",children:d.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3","aria-hidden":!0,children:[d.jsx("circle",{cx:"7",cy:"7",r:"2.1"}),d.jsx("path",{d:"M7 1.2v1.6M7 11.2v1.6M1.2 7h1.6M11.2 7h1.6M2.9 2.9l1.1 1.1M10 10l1.1 1.1M11.1 2.9L10 4M4 10l-1.1 1.1"})]})}),d.jsxs("label",{className:"bw-switch",htmlFor:"bw-enabled",children:[d.jsx("span",{className:"bw-switch-label",id:"bw-enabled-label",children:"Watch browser activity"}),d.jsx("button",{id:"bw-enabled",type:"button",role:"switch","aria-checked":a.settings.enabled,"aria-labelledby":"bw-enabled-label",className:"bw-toggle",onClick:()=>void U({enabled:!a.settings.enabled}),title:a.settings.enabled?"On — every episode it finds is written down, so the list outlives the browsing history being cleared":"Off — showing only what this deck has seen since it started. Anything an earlier run archived is hidden until you switch back on, and nothing new is kept",children:d.jsx("span",{className:"bw-toggle-knob"})})]})]})]})]})})}function Aw(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 Qf,G1;function O5(){if(G1)return Qf;G1=1;function e(){this.__data__=[],this.size=0}return Qf=e,Qf}var Zf,V1;function Gi(){if(V1)return Zf;V1=1;function e(t,n){return t===n||t!==t&&n!==n}return Zf=e,Zf}var Jf,Y1;function qu(){if(Y1)return Jf;Y1=1;var e=Gi();function t(n,s){for(var i=n.length;i--;)if(e(n[i][0],s))return i;return-1}return Jf=t,Jf}var eh,K1;function P5(){if(K1)return eh;K1=1;var e=qu(),t=Array.prototype,n=t.splice;function s(i){var a=this.__data__,l=e(a,i);if(l<0)return!1;var u=a.length-1;return l==u?a.pop():n.call(a,l,1),--this.size,!0}return eh=s,eh}var th,X1;function $5(){if(X1)return th;X1=1;var e=qu();function t(n){var s=this.__data__,i=e(s,n);return i<0?void 0:s[i][1]}return th=t,th}var nh,Q1;function L5(){if(Q1)return nh;Q1=1;var e=qu();function t(n){return e(this.__data__,n)>-1}return nh=t,nh}var rh,Z1;function q5(){if(Z1)return rh;Z1=1;var e=qu();function t(n,s){var i=this.__data__,a=e(i,n);return a<0?(++this.size,i.push([n,s])):i[a][1]=s,this}return rh=t,rh}var sh,J1;function Du(){if(J1)return sh;J1=1;var e=O5(),t=P5(),n=$5(),s=L5(),i=q5();function a(l){var u=-1,h=l==null?0:l.length;for(this.clear();++u<h;){var p=l[u];this.set(p[0],p[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=s,a.prototype.set=i,sh=a,sh}var oh,e_;function D5(){if(e_)return oh;e_=1;var e=Du();function t(){this.__data__=new e,this.size=0}return oh=t,oh}var ih,t_;function F5(){if(t_)return ih;t_=1;function e(t){var n=this.__data__,s=n.delete(t);return this.size=n.size,s}return ih=e,ih}var ah,n_;function z5(){if(n_)return ah;n_=1;function e(t){return this.__data__.get(t)}return ah=e,ah}var lh,r_;function B5(){if(r_)return lh;r_=1;function e(t){return this.__data__.has(t)}return lh=e,lh}var ch,s_;function DT(){if(s_)return ch;s_=1;var e=typeof Lc=="object"&&Lc&&Lc.Object===Object&&Lc;return ch=e,ch}var uh,o_;function dr(){if(o_)return uh;o_=1;var e=DT(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return uh=n,uh}var dh,i_;function Vi(){if(i_)return dh;i_=1;var e=dr(),t=e.Symbol;return dh=t,dh}var fh,a_;function U5(){if(a_)return fh;a_=1;var e=Vi(),t=Object.prototype,n=t.hasOwnProperty,s=t.toString,i=e?e.toStringTag:void 0;function a(l){var u=n.call(l,i),h=l[i];try{l[i]=void 0;var p=!0}catch{}var f=s.call(l);return p&&(u?l[i]=h:delete l[i]),f}return fh=a,fh}var hh,l_;function W5(){if(l_)return hh;l_=1;var e=Object.prototype,t=e.toString;function n(s){return t.call(s)}return hh=n,hh}var ph,c_;function ko(){if(c_)return ph;c_=1;var e=Vi(),t=U5(),n=W5(),s="[object Null]",i="[object Undefined]",a=e?e.toStringTag:void 0;function l(u){return u==null?u===void 0?i:s:a&&a in Object(u)?t(u):n(u)}return ph=l,ph}var mh,u_;function Dn(){if(u_)return mh;u_=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return mh=e,mh}var gh,d_;function _l(){if(d_)return gh;d_=1;var e=ko(),t=Dn(),n="[object AsyncFunction]",s="[object Function]",i="[object GeneratorFunction]",a="[object Proxy]";function l(u){if(!t(u))return!1;var h=e(u);return h==s||h==i||h==n||h==a}return gh=l,gh}var vh,f_;function H5(){if(f_)return vh;f_=1;var e=dr(),t=e["__core-js_shared__"];return vh=t,vh}var yh,h_;function G5(){if(h_)return yh;h_=1;var e=H5(),t=(function(){var s=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return s?"Symbol(src)_1."+s:""})();function n(s){return!!t&&t in s}return yh=n,yh}var wh,p_;function FT(){if(p_)return wh;p_=1;var e=Function.prototype,t=e.toString;function n(s){if(s!=null){try{return t.call(s)}catch{}try{return s+""}catch{}}return""}return wh=n,wh}var xh,m_;function V5(){if(m_)return xh;m_=1;var e=_l(),t=G5(),n=Dn(),s=FT(),i=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,l=Function.prototype,u=Object.prototype,h=l.toString,p=u.hasOwnProperty,f=RegExp("^"+h.call(p).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function g(y){if(!n(y)||t(y))return!1;var w=e(y)?f:a;return w.test(s(y))}return xh=g,xh}var bh,g_;function Y5(){if(g_)return bh;g_=1;function e(t,n){return t==null?void 0:t[n]}return bh=e,bh}var _h,v_;function So(){if(v_)return _h;v_=1;var e=V5(),t=Y5();function n(s,i){var a=t(s,i);return e(a)?a:void 0}return _h=n,_h}var kh,y_;function Mw(){if(y_)return kh;y_=1;var e=So(),t=dr(),n=e(t,"Map");return kh=n,kh}var Sh,w_;function Fu(){if(w_)return Sh;w_=1;var e=So(),t=e(Object,"create");return Sh=t,Sh}var Nh,x_;function K5(){if(x_)return Nh;x_=1;var e=Fu();function t(){this.__data__=e?e(null):{},this.size=0}return Nh=t,Nh}var Eh,b_;function X5(){if(b_)return Eh;b_=1;function e(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}return Eh=e,Eh}var jh,__;function Q5(){if(__)return jh;__=1;var e=Fu(),t="__lodash_hash_undefined__",n=Object.prototype,s=n.hasOwnProperty;function i(a){var l=this.__data__;if(e){var u=l[a];return u===t?void 0:u}return s.call(l,a)?l[a]:void 0}return jh=i,jh}var Ch,k_;function Z5(){if(k_)return Ch;k_=1;var e=Fu(),t=Object.prototype,n=t.hasOwnProperty;function s(i){var a=this.__data__;return e?a[i]!==void 0:n.call(a,i)}return Ch=s,Ch}var Th,S_;function J5(){if(S_)return Th;S_=1;var e=Fu(),t="__lodash_hash_undefined__";function n(s,i){var a=this.__data__;return this.size+=this.has(s)?0:1,a[s]=e&&i===void 0?t:i,this}return Th=n,Th}var Rh,N_;function eF(){if(N_)return Rh;N_=1;var e=K5(),t=X5(),n=Q5(),s=Z5(),i=J5();function a(l){var u=-1,h=l==null?0:l.length;for(this.clear();++u<h;){var p=l[u];this.set(p[0],p[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=s,a.prototype.set=i,Rh=a,Rh}var Ah,E_;function tF(){if(E_)return Ah;E_=1;var e=eF(),t=Du(),n=Mw();function s(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return Ah=s,Ah}var Mh,j_;function nF(){if(j_)return Mh;j_=1;function e(t){var n=typeof t;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?t!=="__proto__":t===null}return Mh=e,Mh}var Ih,C_;function zu(){if(C_)return Ih;C_=1;var e=nF();function t(n,s){var i=n.__data__;return e(s)?i[typeof s=="string"?"string":"hash"]:i.map}return Ih=t,Ih}var Oh,T_;function rF(){if(T_)return Oh;T_=1;var e=zu();function t(n){var s=e(this,n).delete(n);return this.size-=s?1:0,s}return Oh=t,Oh}var Ph,R_;function sF(){if(R_)return Ph;R_=1;var e=zu();function t(n){return e(this,n).get(n)}return Ph=t,Ph}var $h,A_;function oF(){if(A_)return $h;A_=1;var e=zu();function t(n){return e(this,n).has(n)}return $h=t,$h}var Lh,M_;function iF(){if(M_)return Lh;M_=1;var e=zu();function t(n,s){var i=e(this,n),a=i.size;return i.set(n,s),this.size+=i.size==a?0:1,this}return Lh=t,Lh}var qh,I_;function Iw(){if(I_)return qh;I_=1;var e=tF(),t=rF(),n=sF(),s=oF(),i=iF();function a(l){var u=-1,h=l==null?0:l.length;for(this.clear();++u<h;){var p=l[u];this.set(p[0],p[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=s,a.prototype.set=i,qh=a,qh}var Dh,O_;function aF(){if(O_)return Dh;O_=1;var e=Du(),t=Mw(),n=Iw(),s=200;function i(a,l){var u=this.__data__;if(u instanceof e){var h=u.__data__;if(!t||h.length<s-1)return h.push([a,l]),this.size=++u.size,this;u=this.__data__=new n(h)}return u.set(a,l),this.size=u.size,this}return Dh=i,Dh}var Fh,P_;function Bu(){if(P_)return Fh;P_=1;var e=Du(),t=D5(),n=F5(),s=z5(),i=B5(),a=aF();function l(u){var h=this.__data__=new e(u);this.size=h.size}return l.prototype.clear=t,l.prototype.delete=n,l.prototype.get=s,l.prototype.has=i,l.prototype.set=a,Fh=l,Fh}var zh,$_;function Ow(){if($_)return zh;$_=1;function e(t,n){for(var s=-1,i=t==null?0:t.length;++s<i&&n(t[s],s,t)!==!1;);return t}return zh=e,zh}var Bh,L_;function zT(){if(L_)return Bh;L_=1;var e=So(),t=(function(){try{var n=e(Object,"defineProperty");return n({},"",{}),n}catch{}})();return Bh=t,Bh}var Uh,q_;function Uu(){if(q_)return Uh;q_=1;var e=zT();function t(n,s,i){s=="__proto__"&&e?e(n,s,{configurable:!0,enumerable:!0,value:i,writable:!0}):n[s]=i}return Uh=t,Uh}var Wh,D_;function Wu(){if(D_)return Wh;D_=1;var e=Uu(),t=Gi(),n=Object.prototype,s=n.hasOwnProperty;function i(a,l,u){var h=a[l];(!(s.call(a,l)&&t(h,u))||u===void 0&&!(l in a))&&e(a,l,u)}return Wh=i,Wh}var Hh,F_;function kl(){if(F_)return Hh;F_=1;var e=Wu(),t=Uu();function n(s,i,a,l){var u=!a;a||(a={});for(var h=-1,p=i.length;++h<p;){var f=i[h],g=l?l(a[f],s[f],f,a,s):void 0;g===void 0&&(g=s[f]),u?t(a,f,g):e(a,f,g)}return a}return Hh=n,Hh}var Gh,z_;function lF(){if(z_)return Gh;z_=1;function e(t,n){for(var s=-1,i=Array(t);++s<t;)i[s]=n(s);return i}return Gh=e,Gh}var Vh,B_;function jr(){if(B_)return Vh;B_=1;function e(t){return t!=null&&typeof t=="object"}return Vh=e,Vh}var Yh,U_;function cF(){if(U_)return Yh;U_=1;var e=ko(),t=jr(),n="[object Arguments]";function s(i){return t(i)&&e(i)==n}return Yh=s,Yh}var Kh,W_;function Sl(){if(W_)return Kh;W_=1;var e=cF(),t=jr(),n=Object.prototype,s=n.hasOwnProperty,i=n.propertyIsEnumerable,a=e((function(){return arguments})())?e:function(l){return t(l)&&s.call(l,"callee")&&!i.call(l,"callee")};return Kh=a,Kh}var Xh,H_;function At(){if(H_)return Xh;H_=1;var e=Array.isArray;return Xh=e,Xh}var Ya={exports:{}},Qh,G_;function uF(){if(G_)return Qh;G_=1;function e(){return!1}return Qh=e,Qh}Ya.exports;var V_;function Yi(){return V_||(V_=1,(function(e,t){var n=dr(),s=uF(),i=t&&!t.nodeType&&t,a=i&&!0&&e&&!e.nodeType&&e,l=a&&a.exports===i,u=l?n.Buffer:void 0,h=u?u.isBuffer:void 0,p=h||s;e.exports=p})(Ya,Ya.exports)),Ya.exports}var Zh,Y_;function Hu(){if(Y_)return Zh;Y_=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function n(s,i){var a=typeof s;return i=i??e,!!i&&(a=="number"||a!="symbol"&&t.test(s))&&s>-1&&s%1==0&&s<i}return Zh=n,Zh}var Jh,K_;function Pw(){if(K_)return Jh;K_=1;var e=9007199254740991;function t(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=e}return Jh=t,Jh}var ep,X_;function dF(){if(X_)return ep;X_=1;var e=ko(),t=Pw(),n=jr(),s="[object Arguments]",i="[object Array]",a="[object Boolean]",l="[object Date]",u="[object Error]",h="[object Function]",p="[object Map]",f="[object Number]",g="[object Object]",y="[object RegExp]",w="[object Set]",N="[object String]",b="[object WeakMap]",_="[object ArrayBuffer]",k="[object DataView]",E="[object Float32Array]",j="[object Float64Array]",C="[object Int8Array]",I="[object Int16Array]",P="[object Int32Array]",O="[object Uint8Array]",F="[object Uint8ClampedArray]",M="[object Uint16Array]",A="[object Uint32Array]",q={};q[E]=q[j]=q[C]=q[I]=q[P]=q[O]=q[F]=q[M]=q[A]=!0,q[s]=q[i]=q[_]=q[a]=q[k]=q[l]=q[u]=q[h]=q[p]=q[f]=q[g]=q[y]=q[w]=q[N]=q[b]=!1;function W(Y){return n(Y)&&t(Y.length)&&!!q[e(Y)]}return ep=W,ep}var tp,Q_;function Gu(){if(Q_)return tp;Q_=1;function e(t){return function(n){return t(n)}}return tp=e,tp}var Ka={exports:{}};Ka.exports;var Z_;function $w(){return Z_||(Z_=1,(function(e,t){var n=DT(),s=t&&!t.nodeType&&t,i=s&&!0&&e&&!e.nodeType&&e,a=i&&i.exports===s,l=a&&n.process,u=(function(){try{var h=i&&i.require&&i.require("util").types;return h||l&&l.binding&&l.binding("util")}catch{}})();e.exports=u})(Ka,Ka.exports)),Ka.exports}var np,J_;function Nl(){if(J_)return np;J_=1;var e=dF(),t=Gu(),n=$w(),s=n&&n.isTypedArray,i=s?t(s):e;return np=i,np}var rp,ek;function BT(){if(ek)return rp;ek=1;var e=lF(),t=Sl(),n=At(),s=Yi(),i=Hu(),a=Nl(),l=Object.prototype,u=l.hasOwnProperty;function h(p,f){var g=n(p),y=!g&&t(p),w=!g&&!y&&s(p),N=!g&&!y&&!w&&a(p),b=g||y||w||N,_=b?e(p.length,String):[],k=_.length;for(var E in p)(f||u.call(p,E))&&!(b&&(E=="length"||w&&(E=="offset"||E=="parent")||N&&(E=="buffer"||E=="byteLength"||E=="byteOffset")||i(E,k)))&&_.push(E);return _}return rp=h,rp}var sp,tk;function Vu(){if(tk)return sp;tk=1;var e=Object.prototype;function t(n){var s=n&&n.constructor,i=typeof s=="function"&&s.prototype||e;return n===i}return sp=t,sp}var op,nk;function UT(){if(nk)return op;nk=1;function e(t,n){return function(s){return t(n(s))}}return op=e,op}var ip,rk;function fF(){if(rk)return ip;rk=1;var e=UT(),t=e(Object.keys,Object);return ip=t,ip}var ap,sk;function Lw(){if(sk)return ap;sk=1;var e=Vu(),t=fF(),n=Object.prototype,s=n.hasOwnProperty;function i(a){if(!e(a))return t(a);var l=[];for(var u in Object(a))s.call(a,u)&&u!="constructor"&&l.push(u);return l}return ap=i,ap}var lp,ok;function Zr(){if(ok)return lp;ok=1;var e=_l(),t=Pw();function n(s){return s!=null&&t(s.length)&&!e(s)}return lp=n,lp}var cp,ik;function Os(){if(ik)return cp;ik=1;var e=BT(),t=Lw(),n=Zr();function s(i){return n(i)?e(i):t(i)}return cp=s,cp}var up,ak;function hF(){if(ak)return up;ak=1;var e=kl(),t=Os();function n(s,i){return s&&e(i,t(i),s)}return up=n,up}var dp,lk;function pF(){if(lk)return dp;lk=1;function e(t){var n=[];if(t!=null)for(var s in Object(t))n.push(s);return n}return dp=e,dp}var fp,ck;function mF(){if(ck)return fp;ck=1;var e=Dn(),t=Vu(),n=pF(),s=Object.prototype,i=s.hasOwnProperty;function a(l){if(!e(l))return n(l);var u=t(l),h=[];for(var p in l)p=="constructor"&&(u||!i.call(l,p))||h.push(p);return h}return fp=a,fp}var hp,uk;function No(){if(uk)return hp;uk=1;var e=BT(),t=mF(),n=Zr();function s(i){return n(i)?e(i,!0):t(i)}return hp=s,hp}var pp,dk;function gF(){if(dk)return pp;dk=1;var e=kl(),t=No();function n(s,i){return s&&e(i,t(i),s)}return pp=n,pp}var Xa={exports:{}};Xa.exports;var fk;function WT(){return fk||(fk=1,(function(e,t){var n=dr(),s=t&&!t.nodeType&&t,i=s&&!0&&e&&!e.nodeType&&e,a=i&&i.exports===s,l=a?n.Buffer:void 0,u=l?l.allocUnsafe:void 0;function h(p,f){if(f)return p.slice();var g=p.length,y=u?u(g):new p.constructor(g);return p.copy(y),y}e.exports=h})(Xa,Xa.exports)),Xa.exports}var mp,hk;function HT(){if(hk)return mp;hk=1;function e(t,n){var s=-1,i=t.length;for(n||(n=Array(i));++s<i;)n[s]=t[s];return n}return mp=e,mp}var gp,pk;function GT(){if(pk)return gp;pk=1;function e(t,n){for(var s=-1,i=t==null?0:t.length,a=0,l=[];++s<i;){var u=t[s];n(u,s,t)&&(l[a++]=u)}return l}return gp=e,gp}var vp,mk;function VT(){if(mk)return vp;mk=1;function e(){return[]}return vp=e,vp}var yp,gk;function qw(){if(gk)return yp;gk=1;var e=GT(),t=VT(),n=Object.prototype,s=n.propertyIsEnumerable,i=Object.getOwnPropertySymbols,a=i?function(l){return l==null?[]:(l=Object(l),e(i(l),function(u){return s.call(l,u)}))}:t;return yp=a,yp}var wp,vk;function vF(){if(vk)return wp;vk=1;var e=kl(),t=qw();function n(s,i){return e(s,t(s),i)}return wp=n,wp}var xp,yk;function Dw(){if(yk)return xp;yk=1;function e(t,n){for(var s=-1,i=n.length,a=t.length;++s<i;)t[a+s]=n[s];return t}return xp=e,xp}var bp,wk;function Yu(){if(wk)return bp;wk=1;var e=UT(),t=e(Object.getPrototypeOf,Object);return bp=t,bp}var _p,xk;function YT(){if(xk)return _p;xk=1;var e=Dw(),t=Yu(),n=qw(),s=VT(),i=Object.getOwnPropertySymbols,a=i?function(l){for(var u=[];l;)e(u,n(l)),l=t(l);return u}:s;return _p=a,_p}var kp,bk;function yF(){if(bk)return kp;bk=1;var e=kl(),t=YT();function n(s,i){return e(s,t(s),i)}return kp=n,kp}var Sp,_k;function KT(){if(_k)return Sp;_k=1;var e=Dw(),t=At();function n(s,i,a){var l=i(s);return t(s)?l:e(l,a(s))}return Sp=n,Sp}var Np,kk;function XT(){if(kk)return Np;kk=1;var e=KT(),t=qw(),n=Os();function s(i){return e(i,n,t)}return Np=s,Np}var Ep,Sk;function wF(){if(Sk)return Ep;Sk=1;var e=KT(),t=YT(),n=No();function s(i){return e(i,n,t)}return Ep=s,Ep}var jp,Nk;function xF(){if(Nk)return jp;Nk=1;var e=So(),t=dr(),n=e(t,"DataView");return jp=n,jp}var Cp,Ek;function bF(){if(Ek)return Cp;Ek=1;var e=So(),t=dr(),n=e(t,"Promise");return Cp=n,Cp}var Tp,jk;function QT(){if(jk)return Tp;jk=1;var e=So(),t=dr(),n=e(t,"Set");return Tp=n,Tp}var Rp,Ck;function _F(){if(Ck)return Rp;Ck=1;var e=So(),t=dr(),n=e(t,"WeakMap");return Rp=n,Rp}var Ap,Tk;function Ki(){if(Tk)return Ap;Tk=1;var e=xF(),t=Mw(),n=bF(),s=QT(),i=_F(),a=ko(),l=FT(),u="[object Map]",h="[object Object]",p="[object Promise]",f="[object Set]",g="[object WeakMap]",y="[object DataView]",w=l(e),N=l(t),b=l(n),_=l(s),k=l(i),E=a;return(e&&E(new e(new ArrayBuffer(1)))!=y||t&&E(new t)!=u||n&&E(n.resolve())!=p||s&&E(new s)!=f||i&&E(new i)!=g)&&(E=function(j){var C=a(j),I=C==h?j.constructor:void 0,P=I?l(I):"";if(P)switch(P){case w:return y;case N:return u;case b:return p;case _:return f;case k:return g}return C}),Ap=E,Ap}var Mp,Rk;function kF(){if(Rk)return Mp;Rk=1;var e=Object.prototype,t=e.hasOwnProperty;function n(s){var i=s.length,a=new s.constructor(i);return i&&typeof s[0]=="string"&&t.call(s,"index")&&(a.index=s.index,a.input=s.input),a}return Mp=n,Mp}var Ip,Ak;function ZT(){if(Ak)return Ip;Ak=1;var e=dr(),t=e.Uint8Array;return Ip=t,Ip}var Op,Mk;function Fw(){if(Mk)return Op;Mk=1;var e=ZT();function t(n){var s=new n.constructor(n.byteLength);return new e(s).set(new e(n)),s}return Op=t,Op}var Pp,Ik;function SF(){if(Ik)return Pp;Ik=1;var e=Fw();function t(n,s){var i=s?e(n.buffer):n.buffer;return new n.constructor(i,n.byteOffset,n.byteLength)}return Pp=t,Pp}var $p,Ok;function NF(){if(Ok)return $p;Ok=1;var e=/\w*$/;function t(n){var s=new n.constructor(n.source,e.exec(n));return s.lastIndex=n.lastIndex,s}return $p=t,$p}var Lp,Pk;function EF(){if(Pk)return Lp;Pk=1;var e=Vi(),t=e?e.prototype:void 0,n=t?t.valueOf:void 0;function s(i){return n?Object(n.call(i)):{}}return Lp=s,Lp}var qp,$k;function JT(){if($k)return qp;$k=1;var e=Fw();function t(n,s){var i=s?e(n.buffer):n.buffer;return new n.constructor(i,n.byteOffset,n.length)}return qp=t,qp}var Dp,Lk;function jF(){if(Lk)return Dp;Lk=1;var e=Fw(),t=SF(),n=NF(),s=EF(),i=JT(),a="[object Boolean]",l="[object Date]",u="[object Map]",h="[object Number]",p="[object RegExp]",f="[object Set]",g="[object String]",y="[object Symbol]",w="[object ArrayBuffer]",N="[object DataView]",b="[object Float32Array]",_="[object Float64Array]",k="[object Int8Array]",E="[object Int16Array]",j="[object Int32Array]",C="[object Uint8Array]",I="[object Uint8ClampedArray]",P="[object Uint16Array]",O="[object Uint32Array]";function F(M,A,q){var W=M.constructor;switch(A){case w:return e(M);case a:case l:return new W(+M);case N:return t(M,q);case b:case _:case k:case E:case j:case C:case I:case P:case O:return i(M,q);case u:return new W;case h:case g:return new W(M);case p:return n(M);case f:return new W;case y:return s(M)}}return Dp=F,Dp}var Fp,qk;function eR(){if(qk)return Fp;qk=1;var e=Dn(),t=Object.create,n=(function(){function s(){}return function(i){if(!e(i))return{};if(t)return t(i);s.prototype=i;var a=new s;return s.prototype=void 0,a}})();return Fp=n,Fp}var zp,Dk;function tR(){if(Dk)return zp;Dk=1;var e=eR(),t=Yu(),n=Vu();function s(i){return typeof i.constructor=="function"&&!n(i)?e(t(i)):{}}return zp=s,zp}var Bp,Fk;function CF(){if(Fk)return Bp;Fk=1;var e=Ki(),t=jr(),n="[object Map]";function s(i){return t(i)&&e(i)==n}return Bp=s,Bp}var Up,zk;function TF(){if(zk)return Up;zk=1;var e=CF(),t=Gu(),n=$w(),s=n&&n.isMap,i=s?t(s):e;return Up=i,Up}var Wp,Bk;function RF(){if(Bk)return Wp;Bk=1;var e=Ki(),t=jr(),n="[object Set]";function s(i){return t(i)&&e(i)==n}return Wp=s,Wp}var Hp,Uk;function AF(){if(Uk)return Hp;Uk=1;var e=RF(),t=Gu(),n=$w(),s=n&&n.isSet,i=s?t(s):e;return Hp=i,Hp}var Gp,Wk;function nR(){if(Wk)return Gp;Wk=1;var e=Bu(),t=Ow(),n=Wu(),s=hF(),i=gF(),a=WT(),l=HT(),u=vF(),h=yF(),p=XT(),f=wF(),g=Ki(),y=kF(),w=jF(),N=tR(),b=At(),_=Yi(),k=TF(),E=Dn(),j=AF(),C=Os(),I=No(),P=1,O=2,F=4,M="[object Arguments]",A="[object Array]",q="[object Boolean]",W="[object Date]",Y="[object Error]",T="[object Function]",Z="[object GeneratorFunction]",U="[object Map]",ne="[object Number]",X="[object Object]",H="[object RegExp]",J="[object Set]",$="[object String]",G="[object Symbol]",Q="[object WeakMap]",D="[object ArrayBuffer]",L="[object DataView]",K="[object Float32Array]",se="[object Float64Array]",he="[object Int8Array]",pe="[object Int16Array]",re="[object Int32Array]",ve="[object Uint8Array]",Te="[object Uint8ClampedArray]",$e="[object Uint16Array]",Me="[object Uint32Array]",_e={};_e[M]=_e[A]=_e[D]=_e[L]=_e[q]=_e[W]=_e[K]=_e[se]=_e[he]=_e[pe]=_e[re]=_e[U]=_e[ne]=_e[X]=_e[H]=_e[J]=_e[$]=_e[G]=_e[ve]=_e[Te]=_e[$e]=_e[Me]=!0,_e[Y]=_e[T]=_e[Q]=!1;function ae(we,be,Ue,Ke,ut,ot){var He,nt=be&P,Xe=be&O,_t=be&F;if(Ue&&(He=ut?Ue(we,Ke,ut,ot):Ue(we)),He!==void 0)return He;if(!E(we))return we;var Oe=b(we);if(Oe){if(He=y(we),!nt)return l(we,He)}else{var it=g(we),Mt=it==T||it==Z;if(_(we))return a(we,nt);if(it==X||it==M||Mt&&!ut){if(He=Xe||Mt?{}:N(we),!nt)return Xe?h(we,i(He,we)):u(we,s(He,we))}else{if(!_e[it])return ut?we:{};He=w(we,it,nt)}}ot||(ot=new e);var le=ot.get(we);if(le)return le;ot.set(we,He),j(we)?we.forEach(function(Ee){He.add(ae(Ee,be,Ue,Ee,we,ot))}):k(we)&&we.forEach(function(Ee,Ge){He.set(Ge,ae(Ee,be,Ue,Ge,we,ot))});var Le=_t?Xe?f:p:Xe?I:C,Fe=Oe?void 0:Le(we);return t(Fe||we,function(Ee,Ge){Fe&&(Ge=Ee,Ee=we[Ge]),n(He,Ge,ae(Ee,be,Ue,Ge,we,ot))}),He}return Gp=ae,Gp}var Vp,Hk;function MF(){if(Hk)return Vp;Hk=1;var e=nR(),t=4;function n(s){return e(s,t)}return Vp=n,Vp}var Yp,Gk;function zw(){if(Gk)return Yp;Gk=1;function e(t){return function(){return t}}return Yp=e,Yp}var Kp,Vk;function IF(){if(Vk)return Kp;Vk=1;function e(t){return function(n,s,i){for(var a=-1,l=Object(n),u=i(n),h=u.length;h--;){var p=u[t?h:++a];if(s(l[p],p,l)===!1)break}return n}}return Kp=e,Kp}var Xp,Yk;function Bw(){if(Yk)return Xp;Yk=1;var e=IF(),t=e();return Xp=t,Xp}var Qp,Kk;function Uw(){if(Kk)return Qp;Kk=1;var e=Bw(),t=Os();function n(s,i){return s&&e(s,i,t)}return Qp=n,Qp}var Zp,Xk;function OF(){if(Xk)return Zp;Xk=1;var e=Zr();function t(n,s){return function(i,a){if(i==null)return i;if(!e(i))return n(i,a);for(var l=i.length,u=s?l:-1,h=Object(i);(s?u--:++u<l)&&a(h[u],u,h)!==!1;);return i}}return Zp=t,Zp}var Jp,Qk;function Ku(){if(Qk)return Jp;Qk=1;var e=Uw(),t=OF(),n=t(e);return Jp=n,Jp}var em,Zk;function Eo(){if(Zk)return em;Zk=1;function e(t){return t}return em=e,em}var tm,Jk;function rR(){if(Jk)return tm;Jk=1;var e=Eo();function t(n){return typeof n=="function"?n:e}return tm=t,tm}var nm,eS;function sR(){if(eS)return nm;eS=1;var e=Ow(),t=Ku(),n=rR(),s=At();function i(a,l){var u=s(a)?e:t;return u(a,n(l))}return nm=i,nm}var rm,tS;function oR(){return tS||(tS=1,rm=sR()),rm}var sm,nS;function PF(){if(nS)return sm;nS=1;var e=Ku();function t(n,s){var i=[];return e(n,function(a,l,u){s(a,l,u)&&i.push(a)}),i}return sm=t,sm}var om,rS;function $F(){if(rS)return om;rS=1;var e="__lodash_hash_undefined__";function t(n){return this.__data__.set(n,e),this}return om=t,om}var im,sS;function LF(){if(sS)return im;sS=1;function e(t){return this.__data__.has(t)}return im=e,im}var am,oS;function iR(){if(oS)return am;oS=1;var e=Iw(),t=$F(),n=LF();function s(i){var a=-1,l=i==null?0:i.length;for(this.__data__=new e;++a<l;)this.add(i[a])}return s.prototype.add=s.prototype.push=t,s.prototype.has=n,am=s,am}var lm,iS;function qF(){if(iS)return lm;iS=1;function e(t,n){for(var s=-1,i=t==null?0:t.length;++s<i;)if(n(t[s],s,t))return!0;return!1}return lm=e,lm}var cm,aS;function aR(){if(aS)return cm;aS=1;function e(t,n){return t.has(n)}return cm=e,cm}var um,lS;function lR(){if(lS)return um;lS=1;var e=iR(),t=qF(),n=aR(),s=1,i=2;function a(l,u,h,p,f,g){var y=h&s,w=l.length,N=u.length;if(w!=N&&!(y&&N>w))return!1;var b=g.get(l),_=g.get(u);if(b&&_)return b==u&&_==l;var k=-1,E=!0,j=h&i?new e:void 0;for(g.set(l,u),g.set(u,l);++k<w;){var C=l[k],I=u[k];if(p)var P=y?p(I,C,k,u,l,g):p(C,I,k,l,u,g);if(P!==void 0){if(P)continue;E=!1;break}if(j){if(!t(u,function(O,F){if(!n(j,F)&&(C===O||f(C,O,h,p,g)))return j.push(F)})){E=!1;break}}else if(!(C===I||f(C,I,h,p,g))){E=!1;break}}return g.delete(l),g.delete(u),E}return um=a,um}var dm,cS;function DF(){if(cS)return dm;cS=1;function e(t){var n=-1,s=Array(t.size);return t.forEach(function(i,a){s[++n]=[a,i]}),s}return dm=e,dm}var fm,uS;function Ww(){if(uS)return fm;uS=1;function e(t){var n=-1,s=Array(t.size);return t.forEach(function(i){s[++n]=i}),s}return fm=e,fm}var hm,dS;function FF(){if(dS)return hm;dS=1;var e=Vi(),t=ZT(),n=Gi(),s=lR(),i=DF(),a=Ww(),l=1,u=2,h="[object Boolean]",p="[object Date]",f="[object Error]",g="[object Map]",y="[object Number]",w="[object RegExp]",N="[object Set]",b="[object String]",_="[object Symbol]",k="[object ArrayBuffer]",E="[object DataView]",j=e?e.prototype:void 0,C=j?j.valueOf:void 0;function I(P,O,F,M,A,q,W){switch(F){case E:if(P.byteLength!=O.byteLength||P.byteOffset!=O.byteOffset)return!1;P=P.buffer,O=O.buffer;case k:return!(P.byteLength!=O.byteLength||!q(new t(P),new t(O)));case h:case p:case y:return n(+P,+O);case f:return P.name==O.name&&P.message==O.message;case w:case b:return P==O+"";case g:var Y=i;case N:var T=M&l;if(Y||(Y=a),P.size!=O.size&&!T)return!1;var Z=W.get(P);if(Z)return Z==O;M|=u,W.set(P,O);var U=s(Y(P),Y(O),M,A,q,W);return W.delete(P),U;case _:if(C)return C.call(P)==C.call(O)}return!1}return hm=I,hm}var pm,fS;function zF(){if(fS)return pm;fS=1;var e=XT(),t=1,n=Object.prototype,s=n.hasOwnProperty;function i(a,l,u,h,p,f){var g=u&t,y=e(a),w=y.length,N=e(l),b=N.length;if(w!=b&&!g)return!1;for(var _=w;_--;){var k=y[_];if(!(g?k in l:s.call(l,k)))return!1}var E=f.get(a),j=f.get(l);if(E&&j)return E==l&&j==a;var C=!0;f.set(a,l),f.set(l,a);for(var I=g;++_<w;){k=y[_];var P=a[k],O=l[k];if(h)var F=g?h(O,P,k,l,a,f):h(P,O,k,a,l,f);if(!(F===void 0?P===O||p(P,O,u,h,f):F)){C=!1;break}I||(I=k=="constructor")}if(C&&!I){var M=a.constructor,A=l.constructor;M!=A&&"constructor"in a&&"constructor"in l&&!(typeof M=="function"&&M instanceof M&&typeof A=="function"&&A instanceof A)&&(C=!1)}return f.delete(a),f.delete(l),C}return pm=i,pm}var mm,hS;function BF(){if(hS)return mm;hS=1;var e=Bu(),t=lR(),n=FF(),s=zF(),i=Ki(),a=At(),l=Yi(),u=Nl(),h=1,p="[object Arguments]",f="[object Array]",g="[object Object]",y=Object.prototype,w=y.hasOwnProperty;function N(b,_,k,E,j,C){var I=a(b),P=a(_),O=I?f:i(b),F=P?f:i(_);O=O==p?g:O,F=F==p?g:F;var M=O==g,A=F==g,q=O==F;if(q&&l(b)){if(!l(_))return!1;I=!0,M=!1}if(q&&!M)return C||(C=new e),I||u(b)?t(b,_,k,E,j,C):n(b,_,O,k,E,j,C);if(!(k&h)){var W=M&&w.call(b,"__wrapped__"),Y=A&&w.call(_,"__wrapped__");if(W||Y){var T=W?b.value():b,Z=Y?_.value():_;return C||(C=new e),j(T,Z,k,E,C)}}return q?(C||(C=new e),s(b,_,k,E,j,C)):!1}return mm=N,mm}var gm,pS;function cR(){if(pS)return gm;pS=1;var e=BF(),t=jr();function n(s,i,a,l,u){return s===i?!0:s==null||i==null||!t(s)&&!t(i)?s!==s&&i!==i:e(s,i,a,l,n,u)}return gm=n,gm}var vm,mS;function UF(){if(mS)return vm;mS=1;var e=Bu(),t=cR(),n=1,s=2;function i(a,l,u,h){var p=u.length,f=p,g=!h;if(a==null)return!f;for(a=Object(a);p--;){var y=u[p];if(g&&y[2]?y[1]!==a[y[0]]:!(y[0]in a))return!1}for(;++p<f;){y=u[p];var w=y[0],N=a[w],b=y[1];if(g&&y[2]){if(N===void 0&&!(w in a))return!1}else{var _=new e;if(h)var k=h(N,b,w,a,l,_);if(!(k===void 0?t(b,N,n|s,h,_):k))return!1}}return!0}return vm=i,vm}var ym,gS;function uR(){if(gS)return ym;gS=1;var e=Dn();function t(n){return n===n&&!e(n)}return ym=t,ym}var wm,vS;function WF(){if(vS)return wm;vS=1;var e=uR(),t=Os();function n(s){for(var i=t(s),a=i.length;a--;){var l=i[a],u=s[l];i[a]=[l,u,e(u)]}return i}return wm=n,wm}var xm,yS;function dR(){if(yS)return xm;yS=1;function e(t,n){return function(s){return s==null?!1:s[t]===n&&(n!==void 0||t in Object(s))}}return xm=e,xm}var bm,wS;function HF(){if(wS)return bm;wS=1;var e=UF(),t=WF(),n=dR();function s(i){var a=t(i);return a.length==1&&a[0][2]?n(a[0][0],a[0][1]):function(l){return l===i||e(l,i,a)}}return bm=s,bm}var _m,xS;function Xi(){if(xS)return _m;xS=1;var e=ko(),t=jr(),n="[object Symbol]";function s(i){return typeof i=="symbol"||t(i)&&e(i)==n}return _m=s,_m}var km,bS;function Hw(){if(bS)return km;bS=1;var e=At(),t=Xi(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,s=/^\w*$/;function i(a,l){if(e(a))return!1;var u=typeof a;return u=="number"||u=="symbol"||u=="boolean"||a==null||t(a)?!0:s.test(a)||!n.test(a)||l!=null&&a in Object(l)}return km=i,km}var Sm,_S;function GF(){if(_S)return Sm;_S=1;var e=Iw(),t="Expected a function";function n(s,i){if(typeof s!="function"||i!=null&&typeof i!="function")throw new TypeError(t);var a=function(){var l=arguments,u=i?i.apply(this,l):l[0],h=a.cache;if(h.has(u))return h.get(u);var p=s.apply(this,l);return a.cache=h.set(u,p)||h,p};return a.cache=new(n.Cache||e),a}return n.Cache=e,Sm=n,Sm}var Nm,kS;function VF(){if(kS)return Nm;kS=1;var e=GF(),t=500;function n(s){var i=e(s,function(l){return a.size===t&&a.clear(),l}),a=i.cache;return i}return Nm=n,Nm}var Em,SS;function YF(){if(SS)return Em;SS=1;var e=VF(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g,s=e(function(i){var a=[];return i.charCodeAt(0)===46&&a.push(""),i.replace(t,function(l,u,h,p){a.push(h?p.replace(n,"$1"):u||l)}),a});return Em=s,Em}var jm,NS;function Xu(){if(NS)return jm;NS=1;function e(t,n){for(var s=-1,i=t==null?0:t.length,a=Array(i);++s<i;)a[s]=n(t[s],s,t);return a}return jm=e,jm}var Cm,ES;function KF(){if(ES)return Cm;ES=1;var e=Vi(),t=Xu(),n=At(),s=Xi(),i=e?e.prototype:void 0,a=i?i.toString:void 0;function l(u){if(typeof u=="string")return u;if(n(u))return t(u,l)+"";if(s(u))return a?a.call(u):"";var h=u+"";return h=="0"&&1/u==-1/0?"-0":h}return Cm=l,Cm}var Tm,jS;function fR(){if(jS)return Tm;jS=1;var e=KF();function t(n){return n==null?"":e(n)}return Tm=t,Tm}var Rm,CS;function Qu(){if(CS)return Rm;CS=1;var e=At(),t=Hw(),n=YF(),s=fR();function i(a,l){return e(a)?a:t(a,l)?[a]:n(s(a))}return Rm=i,Rm}var Am,TS;function El(){if(TS)return Am;TS=1;var e=Xi();function t(n){if(typeof n=="string"||e(n))return n;var s=n+"";return s=="0"&&1/n==-1/0?"-0":s}return Am=t,Am}var Mm,RS;function Zu(){if(RS)return Mm;RS=1;var e=Qu(),t=El();function n(s,i){i=e(i,s);for(var a=0,l=i.length;s!=null&&a<l;)s=s[t(i[a++])];return a&&a==l?s:void 0}return Mm=n,Mm}var Im,AS;function XF(){if(AS)return Im;AS=1;var e=Zu();function t(n,s,i){var a=n==null?void 0:e(n,s);return a===void 0?i:a}return Im=t,Im}var Om,MS;function QF(){if(MS)return Om;MS=1;function e(t,n){return t!=null&&n in Object(t)}return Om=e,Om}var Pm,IS;function hR(){if(IS)return Pm;IS=1;var e=Qu(),t=Sl(),n=At(),s=Hu(),i=Pw(),a=El();function l(u,h,p){h=e(h,u);for(var f=-1,g=h.length,y=!1;++f<g;){var w=a(h[f]);if(!(y=u!=null&&p(u,w)))break;u=u[w]}return y||++f!=g?y:(g=u==null?0:u.length,!!g&&i(g)&&s(w,g)&&(n(u)||t(u)))}return Pm=l,Pm}var $m,OS;function pR(){if(OS)return $m;OS=1;var e=QF(),t=hR();function n(s,i){return s!=null&&t(s,i,e)}return $m=n,$m}var Lm,PS;function ZF(){if(PS)return Lm;PS=1;var e=cR(),t=XF(),n=pR(),s=Hw(),i=uR(),a=dR(),l=El(),u=1,h=2;function p(f,g){return s(f)&&i(g)?a(l(f),g):function(y){var w=t(y,f);return w===void 0&&w===g?n(y,f):e(g,w,u|h)}}return Lm=p,Lm}var qm,$S;function mR(){if($S)return qm;$S=1;function e(t){return function(n){return n==null?void 0:n[t]}}return qm=e,qm}var Dm,LS;function JF(){if(LS)return Dm;LS=1;var e=Zu();function t(n){return function(s){return e(s,n)}}return Dm=t,Dm}var Fm,qS;function e6(){if(qS)return Fm;qS=1;var e=mR(),t=JF(),n=Hw(),s=El();function i(a){return n(a)?e(s(a)):t(a)}return Fm=i,Fm}var zm,DS;function Jr(){if(DS)return zm;DS=1;var e=HF(),t=ZF(),n=Eo(),s=At(),i=e6();function a(l){return typeof l=="function"?l:l==null?n:typeof l=="object"?s(l)?t(l[0],l[1]):e(l):i(l)}return zm=a,zm}var Bm,FS;function gR(){if(FS)return Bm;FS=1;var e=GT(),t=PF(),n=Jr(),s=At();function i(a,l){var u=s(a)?e:t;return u(a,n(l,3))}return Bm=i,Bm}var Um,zS;function t6(){if(zS)return Um;zS=1;var e=Object.prototype,t=e.hasOwnProperty;function n(s,i){return s!=null&&t.call(s,i)}return Um=n,Um}var Wm,BS;function vR(){if(BS)return Wm;BS=1;var e=t6(),t=hR();function n(s,i){return s!=null&&t(s,i,e)}return Wm=n,Wm}var Hm,US;function n6(){if(US)return Hm;US=1;var e=Lw(),t=Ki(),n=Sl(),s=At(),i=Zr(),a=Yi(),l=Vu(),u=Nl(),h="[object Map]",p="[object Set]",f=Object.prototype,g=f.hasOwnProperty;function y(w){if(w==null)return!0;if(i(w)&&(s(w)||typeof w=="string"||typeof w.splice=="function"||a(w)||u(w)||n(w)))return!w.length;var N=t(w);if(N==h||N==p)return!w.size;if(l(w))return!e(w).length;for(var b in w)if(g.call(w,b))return!1;return!0}return Hm=y,Hm}var Gm,WS;function yR(){if(WS)return Gm;WS=1;function e(t){return t===void 0}return Gm=e,Gm}var Vm,HS;function wR(){if(HS)return Vm;HS=1;var e=Ku(),t=Zr();function n(s,i){var a=-1,l=t(s)?Array(s.length):[];return e(s,function(u,h,p){l[++a]=i(u,h,p)}),l}return Vm=n,Vm}var Ym,GS;function xR(){if(GS)return Ym;GS=1;var e=Xu(),t=Jr(),n=wR(),s=At();function i(a,l){var u=s(a)?e:n;return u(a,t(l,3))}return Ym=i,Ym}var Km,VS;function r6(){if(VS)return Km;VS=1;function e(t,n,s,i){var a=-1,l=t==null?0:t.length;for(i&&l&&(s=t[++a]);++a<l;)s=n(s,t[a],a,t);return s}return Km=e,Km}var Xm,YS;function s6(){if(YS)return Xm;YS=1;function e(t,n,s,i,a){return a(t,function(l,u,h){s=i?(i=!1,l):n(s,l,u,h)}),s}return Xm=e,Xm}var Qm,KS;function bR(){if(KS)return Qm;KS=1;var e=r6(),t=Ku(),n=Jr(),s=s6(),i=At();function a(l,u,h){var p=i(l)?e:s,f=arguments.length<3;return p(l,n(u,4),h,f,t)}return Qm=a,Qm}var Zm,XS;function o6(){if(XS)return Zm;XS=1;var e=ko(),t=At(),n=jr(),s="[object String]";function i(a){return typeof a=="string"||!t(a)&&n(a)&&e(a)==s}return Zm=i,Zm}var Jm,QS;function i6(){if(QS)return Jm;QS=1;var e=mR(),t=e("length");return Jm=t,Jm}var eg,ZS;function a6(){if(ZS)return eg;ZS=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",s="\\u20d0-\\u20ff",i=t+n+s,a="\\ufe0e\\ufe0f",l="\\u200d",u=RegExp("["+l+e+i+a+"]");function h(p){return u.test(p)}return eg=h,eg}var tg,JS;function l6(){if(JS)return tg;JS=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",s="\\u20d0-\\u20ff",i=t+n+s,a="\\ufe0e\\ufe0f",l="["+e+"]",u="["+i+"]",h="\\ud83c[\\udffb-\\udfff]",p="(?:"+u+"|"+h+")",f="[^"+e+"]",g="(?:\\ud83c[\\udde6-\\uddff]){2}",y="[\\ud800-\\udbff][\\udc00-\\udfff]",w="\\u200d",N=p+"?",b="["+a+"]?",_="(?:"+w+"(?:"+[f,g,y].join("|")+")"+b+N+")*",k=b+N+_,E="(?:"+[f+u+"?",u,g,y,l].join("|")+")",j=RegExp(h+"(?="+h+")|"+E+k,"g");function C(I){for(var P=j.lastIndex=0;j.test(I);)++P;return P}return tg=C,tg}var ng,eN;function c6(){if(eN)return ng;eN=1;var e=i6(),t=a6(),n=l6();function s(i){return t(i)?n(i):e(i)}return ng=s,ng}var rg,tN;function u6(){if(tN)return rg;tN=1;var e=Lw(),t=Ki(),n=Zr(),s=o6(),i=c6(),a="[object Map]",l="[object Set]";function u(h){if(h==null)return 0;if(n(h))return s(h)?i(h):h.length;var p=t(h);return p==a||p==l?h.size:e(h).length}return rg=u,rg}var sg,nN;function d6(){if(nN)return sg;nN=1;var e=Ow(),t=eR(),n=Uw(),s=Jr(),i=Yu(),a=At(),l=Yi(),u=_l(),h=Dn(),p=Nl();function f(g,y,w){var N=a(g),b=N||l(g)||p(g);if(y=s(y,4),w==null){var _=g&&g.constructor;b?w=N?new _:[]:h(g)?w=u(_)?t(i(g)):{}:w={}}return(b?e:n)(g,function(k,E,j){return y(w,k,E,j)}),w}return sg=f,sg}var og,rN;function f6(){if(rN)return og;rN=1;var e=Vi(),t=Sl(),n=At(),s=e?e.isConcatSpreadable:void 0;function i(a){return n(a)||t(a)||!!(s&&a&&a[s])}return og=i,og}var ig,sN;function Gw(){if(sN)return ig;sN=1;var e=Dw(),t=f6();function n(s,i,a,l,u){var h=-1,p=s.length;for(a||(a=t),u||(u=[]);++h<p;){var f=s[h];i>0&&a(f)?i>1?n(f,i-1,a,l,u):e(u,f):l||(u[u.length]=f)}return u}return ig=n,ig}var ag,oN;function h6(){if(oN)return ag;oN=1;function e(t,n,s){switch(s.length){case 0:return t.call(n);case 1:return t.call(n,s[0]);case 2:return t.call(n,s[0],s[1]);case 3:return t.call(n,s[0],s[1],s[2])}return t.apply(n,s)}return ag=e,ag}var lg,iN;function _R(){if(iN)return lg;iN=1;var e=h6(),t=Math.max;function n(s,i,a){return i=t(i===void 0?s.length-1:i,0),function(){for(var l=arguments,u=-1,h=t(l.length-i,0),p=Array(h);++u<h;)p[u]=l[i+u];u=-1;for(var f=Array(i+1);++u<i;)f[u]=l[u];return f[i]=a(p),e(s,this,f)}}return lg=n,lg}var cg,aN;function p6(){if(aN)return cg;aN=1;var e=zw(),t=zT(),n=Eo(),s=t?function(i,a){return t(i,"toString",{configurable:!0,enumerable:!1,value:e(a),writable:!0})}:n;return cg=s,cg}var ug,lN;function m6(){if(lN)return ug;lN=1;var e=800,t=16,n=Date.now;function s(i){var a=0,l=0;return function(){var u=n(),h=t-(u-l);if(l=u,h>0){if(++a>=e)return arguments[0]}else a=0;return i.apply(void 0,arguments)}}return ug=s,ug}var dg,cN;function kR(){if(cN)return dg;cN=1;var e=p6(),t=m6(),n=t(e);return dg=n,dg}var fg,uN;function Ju(){if(uN)return fg;uN=1;var e=Eo(),t=_R(),n=kR();function s(i,a){return n(t(i,a,e),i+"")}return fg=s,fg}var hg,dN;function SR(){if(dN)return hg;dN=1;function e(t,n,s,i){for(var a=t.length,l=s+(i?1:-1);i?l--:++l<a;)if(n(t[l],l,t))return l;return-1}return hg=e,hg}var pg,fN;function g6(){if(fN)return pg;fN=1;function e(t){return t!==t}return pg=e,pg}var mg,hN;function v6(){if(hN)return mg;hN=1;function e(t,n,s){for(var i=s-1,a=t.length;++i<a;)if(t[i]===n)return i;return-1}return mg=e,mg}var gg,pN;function y6(){if(pN)return gg;pN=1;var e=SR(),t=g6(),n=v6();function s(i,a,l){return a===a?n(i,a,l):e(i,t,l)}return gg=s,gg}var vg,mN;function w6(){if(mN)return vg;mN=1;var e=y6();function t(n,s){var i=n==null?0:n.length;return!!i&&e(n,s,0)>-1}return vg=t,vg}var yg,gN;function x6(){if(gN)return yg;gN=1;function e(t,n,s){for(var i=-1,a=t==null?0:t.length;++i<a;)if(s(n,t[i]))return!0;return!1}return yg=e,yg}var wg,vN;function b6(){if(vN)return wg;vN=1;function e(){}return wg=e,wg}var xg,yN;function _6(){if(yN)return xg;yN=1;var e=QT(),t=b6(),n=Ww(),s=1/0,i=e&&1/n(new e([,-0]))[1]==s?function(a){return new e(a)}:t;return xg=i,xg}var bg,wN;function k6(){if(wN)return bg;wN=1;var e=iR(),t=w6(),n=x6(),s=aR(),i=_6(),a=Ww(),l=200;function u(h,p,f){var g=-1,y=t,w=h.length,N=!0,b=[],_=b;if(f)N=!1,y=n;else if(w>=l){var k=p?null:i(h);if(k)return a(k);N=!1,y=s,_=new e}else _=p?[]:b;e:for(;++g<w;){var E=h[g],j=p?p(E):E;if(E=f||E!==0?E:0,N&&j===j){for(var C=_.length;C--;)if(_[C]===j)continue e;p&&_.push(j),b.push(E)}else y(_,j,f)||(_!==b&&_.push(j),b.push(E))}return b}return bg=u,bg}var _g,xN;function NR(){if(xN)return _g;xN=1;var e=Zr(),t=jr();function n(s){return t(s)&&e(s)}return _g=n,_g}var kg,bN;function S6(){if(bN)return kg;bN=1;var e=Gw(),t=Ju(),n=k6(),s=NR(),i=t(function(a){return n(e(a,1,s,!0))});return kg=i,kg}var Sg,_N;function N6(){if(_N)return Sg;_N=1;var e=Xu();function t(n,s){return e(s,function(i){return n[i]})}return Sg=t,Sg}var Ng,kN;function ER(){if(kN)return Ng;kN=1;var e=N6(),t=Os();function n(s){return s==null?[]:e(s,t(s))}return Ng=n,Ng}var Eg,SN;function Fn(){if(SN)return Eg;SN=1;var e;if(typeof Aw=="function")try{e={clone:MF(),constant:zw(),each:oR(),filter:gR(),has:vR(),isArray:At(),isEmpty:n6(),isFunction:_l(),isUndefined:yR(),keys:Os(),map:xR(),reduce:bR(),size:u6(),transform:d6(),union:S6(),values:ER()}}catch{}return e||(e=window._),Eg=e,Eg}var jg,NN;function Vw(){if(NN)return jg;NN=1;var e=Fn();jg=i;var t="\0",n="\0",s="";function i(f){this._isDirected=e.has(f,"directed")?f.directed:!0,this._isMultigraph=e.has(f,"multigraph")?f.multigraph:!1,this._isCompound=e.has(f,"compound")?f.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[n]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}i.prototype._nodeCount=0,i.prototype._edgeCount=0,i.prototype.isDirected=function(){return this._isDirected},i.prototype.isMultigraph=function(){return this._isMultigraph},i.prototype.isCompound=function(){return this._isCompound},i.prototype.setGraph=function(f){return this._label=f,this},i.prototype.graph=function(){return this._label},i.prototype.setDefaultNodeLabel=function(f){return e.isFunction(f)||(f=e.constant(f)),this._defaultNodeLabelFn=f,this},i.prototype.nodeCount=function(){return this._nodeCount},i.prototype.nodes=function(){return e.keys(this._nodes)},i.prototype.sources=function(){var f=this;return e.filter(this.nodes(),function(g){return e.isEmpty(f._in[g])})},i.prototype.sinks=function(){var f=this;return e.filter(this.nodes(),function(g){return e.isEmpty(f._out[g])})},i.prototype.setNodes=function(f,g){var y=arguments,w=this;return e.each(f,function(N){y.length>1?w.setNode(N,g):w.setNode(N)}),this},i.prototype.setNode=function(f,g){return e.has(this._nodes,f)?(arguments.length>1&&(this._nodes[f]=g),this):(this._nodes[f]=arguments.length>1?g:this._defaultNodeLabelFn(f),this._isCompound&&(this._parent[f]=n,this._children[f]={},this._children[n][f]=!0),this._in[f]={},this._preds[f]={},this._out[f]={},this._sucs[f]={},++this._nodeCount,this)},i.prototype.node=function(f){return this._nodes[f]},i.prototype.hasNode=function(f){return e.has(this._nodes,f)},i.prototype.removeNode=function(f){var g=this;if(e.has(this._nodes,f)){var y=function(w){g.removeEdge(g._edgeObjs[w])};delete this._nodes[f],this._isCompound&&(this._removeFromParentsChildList(f),delete this._parent[f],e.each(this.children(f),function(w){g.setParent(w)}),delete this._children[f]),e.each(e.keys(this._in[f]),y),delete this._in[f],delete this._preds[f],e.each(e.keys(this._out[f]),y),delete this._out[f],delete this._sucs[f],--this._nodeCount}return this},i.prototype.setParent=function(f,g){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(e.isUndefined(g))g=n;else{g+="";for(var y=g;!e.isUndefined(y);y=this.parent(y))if(y===f)throw new Error("Setting "+g+" as parent of "+f+" would create a cycle");this.setNode(g)}return this.setNode(f),this._removeFromParentsChildList(f),this._parent[f]=g,this._children[g][f]=!0,this},i.prototype._removeFromParentsChildList=function(f){delete this._children[this._parent[f]][f]},i.prototype.parent=function(f){if(this._isCompound){var g=this._parent[f];if(g!==n)return g}},i.prototype.children=function(f){if(e.isUndefined(f)&&(f=n),this._isCompound){var g=this._children[f];if(g)return e.keys(g)}else{if(f===n)return this.nodes();if(this.hasNode(f))return[]}},i.prototype.predecessors=function(f){var g=this._preds[f];if(g)return e.keys(g)},i.prototype.successors=function(f){var g=this._sucs[f];if(g)return e.keys(g)},i.prototype.neighbors=function(f){var g=this.predecessors(f);if(g)return e.union(g,this.successors(f))},i.prototype.isLeaf=function(f){var g;return this.isDirected()?g=this.successors(f):g=this.neighbors(f),g.length===0},i.prototype.filterNodes=function(f){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,_){f(_)&&g.setNode(_,b)}),e.each(this._edgeObjs,function(b){g.hasNode(b.v)&&g.hasNode(b.w)&&g.setEdge(b,y.edge(b))});var w={};function N(b){var _=y.parent(b);return _===void 0||g.hasNode(_)?(w[b]=_,_):_ in w?w[_]:N(_)}return this._isCompound&&e.each(g.nodes(),function(b){g.setParent(b,N(b))}),g},i.prototype.setDefaultEdgeLabel=function(f){return e.isFunction(f)||(f=e.constant(f)),this._defaultEdgeLabelFn=f,this},i.prototype.edgeCount=function(){return this._edgeCount},i.prototype.edges=function(){return e.values(this._edgeObjs)},i.prototype.setPath=function(f,g){var y=this,w=arguments;return e.reduce(f,function(N,b){return w.length>1?y.setEdge(N,b,g):y.setEdge(N,b),b}),this},i.prototype.setEdge=function(){var f,g,y,w,N=!1,b=arguments[0];typeof b=="object"&&b!==null&&"v"in b?(f=b.v,g=b.w,y=b.name,arguments.length===2&&(w=arguments[1],N=!0)):(f=b,g=arguments[1],y=arguments[3],arguments.length>2&&(w=arguments[2],N=!0)),f=""+f,g=""+g,e.isUndefined(y)||(y=""+y);var _=u(this._isDirected,f,g,y);if(e.has(this._edgeLabels,_))return N&&(this._edgeLabels[_]=w),this;if(!e.isUndefined(y)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(f),this.setNode(g),this._edgeLabels[_]=N?w:this._defaultEdgeLabelFn(f,g,y);var k=h(this._isDirected,f,g,y);return f=k.v,g=k.w,Object.freeze(k),this._edgeObjs[_]=k,a(this._preds[g],f),a(this._sucs[f],g),this._in[g][_]=k,this._out[f][_]=k,this._edgeCount++,this},i.prototype.edge=function(f,g,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):u(this._isDirected,f,g,y);return this._edgeLabels[w]},i.prototype.hasEdge=function(f,g,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):u(this._isDirected,f,g,y);return e.has(this._edgeLabels,w)},i.prototype.removeEdge=function(f,g,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):u(this._isDirected,f,g,y),N=this._edgeObjs[w];return N&&(f=N.v,g=N.w,delete this._edgeLabels[w],delete this._edgeObjs[w],l(this._preds[g],f),l(this._sucs[f],g),delete this._in[g][w],delete this._out[f][w],this._edgeCount--),this},i.prototype.inEdges=function(f,g){var y=this._in[f];if(y){var w=e.values(y);return g?e.filter(w,function(N){return N.v===g}):w}},i.prototype.outEdges=function(f,g){var y=this._out[f];if(y){var w=e.values(y);return g?e.filter(w,function(N){return N.w===g}):w}},i.prototype.nodeEdges=function(f,g){var y=this.inEdges(f,g);if(y)return y.concat(this.outEdges(f,g))};function a(f,g){f[g]?f[g]++:f[g]=1}function l(f,g){--f[g]||delete f[g]}function u(f,g,y,w){var N=""+g,b=""+y;if(!f&&N>b){var _=N;N=b,b=_}return N+s+b+s+(e.isUndefined(w)?t:w)}function h(f,g,y,w){var N=""+g,b=""+y;if(!f&&N>b){var _=N;N=b,b=_}var k={v:N,w:b};return w&&(k.name=w),k}function p(f,g){return u(f,g.v,g.w,g.name)}return jg}var Cg,EN;function E6(){return EN||(EN=1,Cg="2.1.8"),Cg}var Tg,jN;function j6(){return jN||(jN=1,Tg={Graph:Vw(),version:E6()}),Tg}var Rg,CN;function C6(){if(CN)return Rg;CN=1;var e=Fn(),t=Vw();Rg={write:n,read:a};function n(l){var u={options:{directed:l.isDirected(),multigraph:l.isMultigraph(),compound:l.isCompound()},nodes:s(l),edges:i(l)};return e.isUndefined(l.graph())||(u.value=e.clone(l.graph())),u}function s(l){return e.map(l.nodes(),function(u){var h=l.node(u),p=l.parent(u),f={v:u};return e.isUndefined(h)||(f.value=h),e.isUndefined(p)||(f.parent=p),f})}function i(l){return e.map(l.edges(),function(u){var h=l.edge(u),p={v:u.v,w:u.w};return e.isUndefined(u.name)||(p.name=u.name),e.isUndefined(h)||(p.value=h),p})}function a(l){var u=new t(l.options).setGraph(l.value);return e.each(l.nodes,function(h){u.setNode(h.v,h.value),h.parent&&u.setParent(h.v,h.parent)}),e.each(l.edges,function(h){u.setEdge({v:h.v,w:h.w,name:h.name},h.value)}),u}return Rg}var Ag,TN;function T6(){if(TN)return Ag;TN=1;var e=Fn();Ag=t;function t(n){var s={},i=[],a;function l(u){e.has(s,u)||(s[u]=!0,a.push(u),e.each(n.successors(u),l),e.each(n.predecessors(u),l))}return e.each(n.nodes(),function(u){a=[],l(u),a.length&&i.push(a)}),i}return Ag}var Mg,RN;function jR(){if(RN)return Mg;RN=1;var e=Fn();Mg=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(n){return n.key})},t.prototype.has=function(n){return e.has(this._keyIndices,n)},t.prototype.priority=function(n){var s=this._keyIndices[n];if(s!==void 0)return this._arr[s].priority},t.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},t.prototype.add=function(n,s){var i=this._keyIndices;if(n=String(n),!e.has(i,n)){var a=this._arr,l=a.length;return i[n]=l,a.push({key:n,priority:s}),this._decrease(l),!0}return!1},t.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var n=this._arr.pop();return delete this._keyIndices[n.key],this._heapify(0),n.key},t.prototype.decrease=function(n,s){var i=this._keyIndices[n];if(s>this._arr[i].priority)throw new Error("New priority is greater than current priority. Key: "+n+" Old: "+this._arr[i].priority+" New: "+s);this._arr[i].priority=s,this._decrease(i)},t.prototype._heapify=function(n){var s=this._arr,i=2*n,a=i+1,l=n;i<s.length&&(l=s[i].priority<s[l].priority?i:l,a<s.length&&(l=s[a].priority<s[l].priority?a:l),l!==n&&(this._swap(n,l),this._heapify(l)))},t.prototype._decrease=function(n){for(var s=this._arr,i=s[n].priority,a;n!==0&&(a=n>>1,!(s[a].priority<i));)this._swap(n,a),n=a},t.prototype._swap=function(n,s){var i=this._arr,a=this._keyIndices,l=i[n],u=i[s];i[n]=u,i[s]=l,a[u.key]=n,a[l.key]=s},Mg}var Ig,AN;function CR(){if(AN)return Ig;AN=1;var e=Fn(),t=jR();Ig=s;var n=e.constant(1);function s(a,l,u,h){return i(a,String(l),u||n,h||function(p){return a.outEdges(p)})}function i(a,l,u,h){var p={},f=new t,g,y,w=function(N){var b=N.v!==g?N.v:N.w,_=p[b],k=u(N),E=y.distance+k;if(k<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+N+" Weight: "+k);E<_.distance&&(_.distance=E,_.predecessor=g,f.decrease(b,E))};for(a.nodes().forEach(function(N){var b=N===l?0:Number.POSITIVE_INFINITY;p[N]={distance:b},f.add(N,b)});f.size()>0&&(g=f.removeMin(),y=p[g],y.distance!==Number.POSITIVE_INFINITY);)h(g).forEach(w);return p}return Ig}var Og,MN;function R6(){if(MN)return Og;MN=1;var e=CR(),t=Fn();Og=n;function n(s,i,a){return t.transform(s.nodes(),function(l,u){l[u]=e(s,u,i,a)},{})}return Og}var Pg,IN;function TR(){if(IN)return Pg;IN=1;var e=Fn();Pg=t;function t(n){var s=0,i=[],a={},l=[];function u(h){var p=a[h]={onStack:!0,lowlink:s,index:s++};if(i.push(h),n.successors(h).forEach(function(y){e.has(a,y)?a[y].onStack&&(p.lowlink=Math.min(p.lowlink,a[y].index)):(u(y),p.lowlink=Math.min(p.lowlink,a[y].lowlink))}),p.lowlink===p.index){var f=[],g;do g=i.pop(),a[g].onStack=!1,f.push(g);while(h!==g);l.push(f)}}return n.nodes().forEach(function(h){e.has(a,h)||u(h)}),l}return Pg}var $g,ON;function A6(){if(ON)return $g;ON=1;var e=Fn(),t=TR();$g=n;function n(s){return e.filter(t(s),function(i){return i.length>1||i.length===1&&s.hasEdge(i[0],i[0])})}return $g}var Lg,PN;function M6(){if(PN)return Lg;PN=1;var e=Fn();Lg=n;var t=e.constant(1);function n(i,a,l){return s(i,a||t,l||function(u){return i.outEdges(u)})}function s(i,a,l){var u={},h=i.nodes();return h.forEach(function(p){u[p]={},u[p][p]={distance:0},h.forEach(function(f){p!==f&&(u[p][f]={distance:Number.POSITIVE_INFINITY})}),l(p).forEach(function(f){var g=f.v===p?f.w:f.v,y=a(f);u[p][g]={distance:y,predecessor:p}})}),h.forEach(function(p){var f=u[p];h.forEach(function(g){var y=u[g];h.forEach(function(w){var N=y[p],b=f[w],_=y[w],k=N.distance+b.distance;k<_.distance&&(_.distance=k,_.predecessor=b.predecessor)})})}),u}return Lg}var qg,$N;function RR(){if($N)return qg;$N=1;var e=Fn();qg=t,t.CycleException=n;function t(s){var i={},a={},l=[];function u(h){if(e.has(a,h))throw new n;e.has(i,h)||(a[h]=!0,i[h]=!0,e.each(s.predecessors(h),u),delete a[h],l.push(h))}if(e.each(s.sinks(),u),e.size(i)!==s.nodeCount())throw new n;return l}function n(){}return n.prototype=new Error,qg}var Dg,LN;function I6(){if(LN)return Dg;LN=1;var e=RR();Dg=t;function t(n){try{e(n)}catch(s){if(s instanceof e.CycleException)return!1;throw s}return!0}return Dg}var Fg,qN;function AR(){if(qN)return Fg;qN=1;var e=Fn();Fg=t;function t(s,i,a){e.isArray(i)||(i=[i]);var l=(s.isDirected()?s.successors:s.neighbors).bind(s),u=[],h={};return e.each(i,function(p){if(!s.hasNode(p))throw new Error("Graph does not have node: "+p);n(s,p,a==="post",h,l,u)}),u}function n(s,i,a,l,u,h){e.has(l,i)||(l[i]=!0,a||h.push(i),e.each(u(i),function(p){n(s,p,a,l,u,h)}),a&&h.push(i))}return Fg}var zg,DN;function O6(){if(DN)return zg;DN=1;var e=AR();zg=t;function t(n,s){return e(n,s,"post")}return zg}var Bg,FN;function P6(){if(FN)return Bg;FN=1;var e=AR();Bg=t;function t(n,s){return e(n,s,"pre")}return Bg}var Ug,zN;function $6(){if(zN)return Ug;zN=1;var e=Fn(),t=Vw(),n=jR();Ug=s;function s(i,a){var l=new t,u={},h=new n,p;function f(y){var w=y.v===p?y.w:y.v,N=h.priority(w);if(N!==void 0){var b=a(y);b<N&&(u[w]=p,h.decrease(w,b))}}if(i.nodeCount()===0)return l;e.each(i.nodes(),function(y){h.add(y,Number.POSITIVE_INFINITY),l.setNode(y)}),h.decrease(i.nodes()[0],0);for(var g=!1;h.size()>0;){if(p=h.removeMin(),e.has(u,p))l.setEdge(p,u[p]);else{if(g)throw new Error("Input graph is not connected: "+i);g=!0}i.nodeEdges(p).forEach(f)}return l}return Ug}var Wg,BN;function L6(){return BN||(BN=1,Wg={components:T6(),dijkstra:CR(),dijkstraAll:R6(),findCycles:A6(),floydWarshall:M6(),isAcyclic:I6(),postorder:O6(),preorder:P6(),prim:$6(),tarjan:TR(),topsort:RR()}),Wg}var Hg,UN;function q6(){if(UN)return Hg;UN=1;var e=j6();return Hg={Graph:e.Graph,json:C6(),alg:L6(),version:e.version},Hg}var Gg,WN;function cr(){if(WN)return Gg;WN=1;var e;if(typeof Aw=="function")try{e=q6()}catch{}return e||(e=window.graphlib),Gg=e,Gg}var Vg,HN;function D6(){if(HN)return Vg;HN=1;var e=nR(),t=1,n=4;function s(i){return e(i,t|n)}return Vg=s,Vg}var Yg,GN;function ed(){if(GN)return Yg;GN=1;var e=Gi(),t=Zr(),n=Hu(),s=Dn();function i(a,l,u){if(!s(u))return!1;var h=typeof l;return(h=="number"?t(u)&&n(l,u.length):h=="string"&&l in u)?e(u[l],a):!1}return Yg=i,Yg}var Kg,VN;function F6(){if(VN)return Kg;VN=1;var e=Ju(),t=Gi(),n=ed(),s=No(),i=Object.prototype,a=i.hasOwnProperty,l=e(function(u,h){u=Object(u);var p=-1,f=h.length,g=f>2?h[2]:void 0;for(g&&n(h[0],h[1],g)&&(f=1);++p<f;)for(var y=h[p],w=s(y),N=-1,b=w.length;++N<b;){var _=w[N],k=u[_];(k===void 0||t(k,i[_])&&!a.call(u,_))&&(u[_]=y[_])}return u});return Kg=l,Kg}var Xg,YN;function z6(){if(YN)return Xg;YN=1;var e=Jr(),t=Zr(),n=Os();function s(i){return function(a,l,u){var h=Object(a);if(!t(a)){var p=e(l,3);a=n(a),l=function(g){return p(h[g],g,h)}}var f=i(a,l,u);return f>-1?h[p?a[f]:f]:void 0}}return Xg=s,Xg}var Qg,KN;function B6(){if(KN)return Qg;KN=1;var e=/\s/;function t(n){for(var s=n.length;s--&&e.test(n.charAt(s)););return s}return Qg=t,Qg}var Zg,XN;function U6(){if(XN)return Zg;XN=1;var e=B6(),t=/^\s+/;function n(s){return s&&s.slice(0,e(s)+1).replace(t,"")}return Zg=n,Zg}var Jg,QN;function W6(){if(QN)return Jg;QN=1;var e=U6(),t=Dn(),n=Xi(),s=NaN,i=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,l=/^0o[0-7]+$/i,u=parseInt;function h(p){if(typeof p=="number")return p;if(n(p))return s;if(t(p)){var f=typeof p.valueOf=="function"?p.valueOf():p;p=t(f)?f+"":f}if(typeof p!="string")return p===0?p:+p;p=e(p);var g=a.test(p);return g||l.test(p)?u(p.slice(2),g?2:8):i.test(p)?s:+p}return Jg=h,Jg}var ev,ZN;function MR(){if(ZN)return ev;ZN=1;var e=W6(),t=1/0,n=17976931348623157e292;function s(i){if(!i)return i===0?i:0;if(i=e(i),i===t||i===-t){var a=i<0?-1:1;return a*n}return i===i?i:0}return ev=s,ev}var tv,JN;function H6(){if(JN)return tv;JN=1;var e=MR();function t(n){var s=e(n),i=s%1;return s===s?i?s-i:s:0}return tv=t,tv}var nv,eE;function G6(){if(eE)return nv;eE=1;var e=SR(),t=Jr(),n=H6(),s=Math.max;function i(a,l,u){var h=a==null?0:a.length;if(!h)return-1;var p=u==null?0:n(u);return p<0&&(p=s(h+p,0)),e(a,t(l,3),p)}return nv=i,nv}var rv,tE;function V6(){if(tE)return rv;tE=1;var e=z6(),t=G6(),n=e(t);return rv=n,rv}var sv,nE;function IR(){if(nE)return sv;nE=1;var e=Gw();function t(n){var s=n==null?0:n.length;return s?e(n,1):[]}return sv=t,sv}var ov,rE;function Y6(){if(rE)return ov;rE=1;var e=Bw(),t=rR(),n=No();function s(i,a){return i==null?i:e(i,t(a),n)}return ov=s,ov}var iv,sE;function K6(){if(sE)return iv;sE=1;function e(t){var n=t==null?0:t.length;return n?t[n-1]:void 0}return iv=e,iv}var av,oE;function X6(){if(oE)return av;oE=1;var e=Uu(),t=Uw(),n=Jr();function s(i,a){var l={};return a=n(a,3),t(i,function(u,h,p){e(l,h,a(u,h,p))}),l}return av=s,av}var lv,iE;function Yw(){if(iE)return lv;iE=1;var e=Xi();function t(n,s,i){for(var a=-1,l=n.length;++a<l;){var u=n[a],h=s(u);if(h!=null&&(p===void 0?h===h&&!e(h):i(h,p)))var p=h,f=u}return f}return lv=t,lv}var cv,aE;function Q6(){if(aE)return cv;aE=1;function e(t,n){return t>n}return cv=e,cv}var uv,lE;function Z6(){if(lE)return uv;lE=1;var e=Yw(),t=Q6(),n=Eo();function s(i){return i&&i.length?e(i,n,t):void 0}return uv=s,uv}var dv,cE;function OR(){if(cE)return dv;cE=1;var e=Uu(),t=Gi();function n(s,i,a){(a!==void 0&&!t(s[i],a)||a===void 0&&!(i in s))&&e(s,i,a)}return dv=n,dv}var fv,uE;function J6(){if(uE)return fv;uE=1;var e=ko(),t=Yu(),n=jr(),s="[object Object]",i=Function.prototype,a=Object.prototype,l=i.toString,u=a.hasOwnProperty,h=l.call(Object);function p(f){if(!n(f)||e(f)!=s)return!1;var g=t(f);if(g===null)return!0;var y=u.call(g,"constructor")&&g.constructor;return typeof y=="function"&&y instanceof y&&l.call(y)==h}return fv=p,fv}var hv,dE;function PR(){if(dE)return hv;dE=1;function e(t,n){if(!(n==="constructor"&&typeof t[n]=="function")&&n!="__proto__")return t[n]}return hv=e,hv}var pv,fE;function ez(){if(fE)return pv;fE=1;var e=kl(),t=No();function n(s){return e(s,t(s))}return pv=n,pv}var mv,hE;function tz(){if(hE)return mv;hE=1;var e=OR(),t=WT(),n=JT(),s=HT(),i=tR(),a=Sl(),l=At(),u=NR(),h=Yi(),p=_l(),f=Dn(),g=J6(),y=Nl(),w=PR(),N=ez();function b(_,k,E,j,C,I,P){var O=w(_,E),F=w(k,E),M=P.get(F);if(M){e(_,E,M);return}var A=I?I(O,F,E+"",_,k,P):void 0,q=A===void 0;if(q){var W=l(F),Y=!W&&h(F),T=!W&&!Y&&y(F);A=F,W||Y||T?l(O)?A=O:u(O)?A=s(O):Y?(q=!1,A=t(F,!0)):T?(q=!1,A=n(F,!0)):A=[]:g(F)||a(F)?(A=O,a(O)?A=N(O):(!f(O)||p(O))&&(A=i(F))):q=!1}q&&(P.set(F,A),C(A,F,j,I,P),P.delete(F)),e(_,E,A)}return mv=b,mv}var gv,pE;function nz(){if(pE)return gv;pE=1;var e=Bu(),t=OR(),n=Bw(),s=tz(),i=Dn(),a=No(),l=PR();function u(h,p,f,g,y){h!==p&&n(p,function(w,N){if(y||(y=new e),i(w))s(h,p,N,f,u,g,y);else{var b=g?g(l(h,N),w,N+"",h,p,y):void 0;b===void 0&&(b=w),t(h,N,b)}},a)}return gv=u,gv}var vv,mE;function rz(){if(mE)return vv;mE=1;var e=Ju(),t=ed();function n(s){return e(function(i,a){var l=-1,u=a.length,h=u>1?a[u-1]:void 0,p=u>2?a[2]:void 0;for(h=s.length>3&&typeof h=="function"?(u--,h):void 0,p&&t(a[0],a[1],p)&&(h=u<3?void 0:h,u=1),i=Object(i);++l<u;){var f=a[l];f&&s(i,f,l,h)}return i})}return vv=n,vv}var yv,gE;function sz(){if(gE)return yv;gE=1;var e=nz(),t=rz(),n=t(function(s,i,a){e(s,i,a)});return yv=n,yv}var wv,vE;function $R(){if(vE)return wv;vE=1;function e(t,n){return t<n}return wv=e,wv}var xv,yE;function oz(){if(yE)return xv;yE=1;var e=Yw(),t=$R(),n=Eo();function s(i){return i&&i.length?e(i,n,t):void 0}return xv=s,xv}var bv,wE;function iz(){if(wE)return bv;wE=1;var e=Yw(),t=Jr(),n=$R();function s(i,a){return i&&i.length?e(i,t(a,2),n):void 0}return bv=s,bv}var _v,xE;function az(){if(xE)return _v;xE=1;var e=dr(),t=function(){return e.Date.now()};return _v=t,_v}var kv,bE;function lz(){if(bE)return kv;bE=1;var e=Wu(),t=Qu(),n=Hu(),s=Dn(),i=El();function a(l,u,h,p){if(!s(l))return l;u=t(u,l);for(var f=-1,g=u.length,y=g-1,w=l;w!=null&&++f<g;){var N=i(u[f]),b=h;if(N==="__proto__"||N==="constructor"||N==="prototype")return l;if(f!=y){var _=w[N];b=p?p(_,N,w):void 0,b===void 0&&(b=s(_)?_:n(u[f+1])?[]:{})}e(w,N,b),w=w[N]}return l}return kv=a,kv}var Sv,_E;function cz(){if(_E)return Sv;_E=1;var e=Zu(),t=lz(),n=Qu();function s(i,a,l){for(var u=-1,h=a.length,p={};++u<h;){var f=a[u],g=e(i,f);l(g,f)&&t(p,n(f,i),g)}return p}return Sv=s,Sv}var Nv,kE;function uz(){if(kE)return Nv;kE=1;var e=cz(),t=pR();function n(s,i){return e(s,i,function(a,l){return t(s,l)})}return Nv=n,Nv}var Ev,SE;function dz(){if(SE)return Ev;SE=1;var e=IR(),t=_R(),n=kR();function s(i){return n(t(i,void 0,e),i+"")}return Ev=s,Ev}var jv,NE;function fz(){if(NE)return jv;NE=1;var e=uz(),t=dz(),n=t(function(s,i){return s==null?{}:e(s,i)});return jv=n,jv}var Cv,EE;function hz(){if(EE)return Cv;EE=1;var e=Math.ceil,t=Math.max;function n(s,i,a,l){for(var u=-1,h=t(e((i-s)/(a||1)),0),p=Array(h);h--;)p[l?h:++u]=s,s+=a;return p}return Cv=n,Cv}var Tv,jE;function pz(){if(jE)return Tv;jE=1;var e=hz(),t=ed(),n=MR();function s(i){return function(a,l,u){return u&&typeof u!="number"&&t(a,l,u)&&(l=u=void 0),a=n(a),l===void 0?(l=a,a=0):l=n(l),u=u===void 0?a<l?1:-1:n(u),e(a,l,u,i)}}return Tv=s,Tv}var Rv,CE;function mz(){if(CE)return Rv;CE=1;var e=pz(),t=e();return Rv=t,Rv}var Av,TE;function gz(){if(TE)return Av;TE=1;function e(t,n){var s=t.length;for(t.sort(n);s--;)t[s]=t[s].value;return t}return Av=e,Av}var Mv,RE;function vz(){if(RE)return Mv;RE=1;var e=Xi();function t(n,s){if(n!==s){var i=n!==void 0,a=n===null,l=n===n,u=e(n),h=s!==void 0,p=s===null,f=s===s,g=e(s);if(!p&&!g&&!u&&n>s||u&&h&&f&&!p&&!g||a&&h&&f||!i&&f||!l)return 1;if(!a&&!u&&!g&&n<s||g&&i&&l&&!a&&!u||p&&i&&l||!h&&l||!f)return-1}return 0}return Mv=t,Mv}var Iv,AE;function yz(){if(AE)return Iv;AE=1;var e=vz();function t(n,s,i){for(var a=-1,l=n.criteria,u=s.criteria,h=l.length,p=i.length;++a<h;){var f=e(l[a],u[a]);if(f){if(a>=p)return f;var g=i[a];return f*(g=="desc"?-1:1)}}return n.index-s.index}return Iv=t,Iv}var Ov,ME;function wz(){if(ME)return Ov;ME=1;var e=Xu(),t=Zu(),n=Jr(),s=wR(),i=gz(),a=Gu(),l=yz(),u=Eo(),h=At();function p(f,g,y){g.length?g=e(g,function(b){return h(b)?function(_){return t(_,b.length===1?b[0]:b)}:b}):g=[u];var w=-1;g=e(g,a(n));var N=s(f,function(b,_,k){var E=e(g,function(j){return j(b)});return{criteria:E,index:++w,value:b}});return i(N,function(b,_){return l(b,_,y)})}return Ov=p,Ov}var Pv,IE;function xz(){if(IE)return Pv;IE=1;var e=Gw(),t=wz(),n=Ju(),s=ed(),i=n(function(a,l){if(a==null)return[];var u=l.length;return u>1&&s(a,l[0],l[1])?l=[]:u>2&&s(l[0],l[1],l[2])&&(l=[l[0]]),t(a,e(l,1),[])});return Pv=i,Pv}var $v,OE;function bz(){if(OE)return $v;OE=1;var e=fR(),t=0;function n(s){var i=++t;return e(s)+i}return $v=n,$v}var Lv,PE;function _z(){if(PE)return Lv;PE=1;function e(t,n,s){for(var i=-1,a=t.length,l=n.length,u={};++i<a;){var h=i<l?n[i]:void 0;s(u,t[i],h)}return u}return Lv=e,Lv}var qv,$E;function kz(){if($E)return qv;$E=1;var e=Wu(),t=_z();function n(s,i){return t(s||[],i||[],e)}return qv=n,qv}var Dv,LE;function yt(){if(LE)return Dv;LE=1;var e;if(typeof Aw=="function")try{e={cloneDeep:D6(),constant:zw(),defaults:F6(),each:oR(),filter:gR(),find:V6(),flatten:IR(),forEach:sR(),forIn:Y6(),has:vR(),isUndefined:yR(),last:K6(),map:xR(),mapValues:X6(),max:Z6(),merge:sz(),min:oz(),minBy:iz(),now:az(),pick:fz(),range:mz(),reduce:bR(),sortBy:xz(),uniqueId:bz(),values:ER(),zipObject:kz()}}catch{}return e||(e=window._),Dv=e,Dv}var Fv,qE;function Sz(){if(qE)return Fv;qE=1,Fv=e;function e(){var s={};s._next=s._prev=s,this._sentinel=s}e.prototype.dequeue=function(){var s=this._sentinel,i=s._prev;if(i!==s)return t(i),i},e.prototype.enqueue=function(s){var i=this._sentinel;s._prev&&s._next&&t(s),s._next=i._next,i._next._prev=s,i._next=s,s._prev=i},e.prototype.toString=function(){for(var s=[],i=this._sentinel,a=i._prev;a!==i;)s.push(JSON.stringify(a,n)),a=a._prev;return"["+s.join(", ")+"]"};function t(s){s._prev._next=s._next,s._next._prev=s._prev,delete s._next,delete s._prev}function n(s,i){if(s!=="_next"&&s!=="_prev")return i}return Fv}var zv,DE;function Nz(){if(DE)return zv;DE=1;var e=yt(),t=cr().Graph,n=Sz();zv=i;var s=e.constant(1);function i(p,f){if(p.nodeCount()<=1)return[];var g=u(p,f||s),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,f,g){for(var y=[],w=f[f.length-1],N=f[0],b;p.nodeCount();){for(;b=N.dequeue();)l(p,f,g,b);for(;b=w.dequeue();)l(p,f,g,b);if(p.nodeCount()){for(var _=f.length-2;_>0;--_)if(b=f[_].dequeue(),b){y=y.concat(l(p,f,g,b,!0));break}}}return y}function l(p,f,g,y,w){var N=w?[]:void 0;return e.forEach(p.inEdges(y.v),function(b){var _=p.edge(b),k=p.node(b.v);w&&N.push({v:b.v,w:b.w}),k.out-=_,h(f,g,k)}),e.forEach(p.outEdges(y.v),function(b){var _=p.edge(b),k=b.w,E=p.node(k);E.in-=_,h(f,g,E)}),p.removeNode(y.v),N}function u(p,f){var g=new t,y=0,w=0;e.forEach(p.nodes(),function(_){g.setNode(_,{v:_,in:0,out:0})}),e.forEach(p.edges(),function(_){var k=g.edge(_.v,_.w)||0,E=f(_),j=k+E;g.setEdge(_.v,_.w,j),w=Math.max(w,g.node(_.v).out+=E),y=Math.max(y,g.node(_.w).in+=E)});var N=e.range(w+y+3).map(function(){return new n}),b=y+1;return e.forEach(g.nodes(),function(_){h(N,b,g.node(_))}),{graph:g,buckets:N,zeroIdx:b}}function h(p,f,g){g.out?g.in?p[g.out-g.in+f].enqueue(g):p[p.length-1].enqueue(g):p[0].enqueue(g)}return zv}var Bv,FE;function Ez(){if(FE)return Bv;FE=1;var e=yt(),t=Nz();Bv={run:n,undo:i};function n(a){var l=a.graph().acyclicer==="greedy"?t(a,u(a)):s(a);e.forEach(l,function(h){var p=a.edge(h);a.removeEdge(h),p.forwardName=h.name,p.reversed=!0,a.setEdge(h.w,h.v,p,e.uniqueId("rev"))});function u(h){return function(p){return h.edge(p).weight}}}function s(a){var l=[],u={},h={};function p(f){e.has(h,f)||(h[f]=!0,u[f]=!0,e.forEach(a.outEdges(f),function(g){e.has(u,g.w)?l.push(g):p(g.w)}),delete u[f])}return e.forEach(a.nodes(),p),l}function i(a){e.forEach(a.edges(),function(l){var u=a.edge(l);if(u.reversed){a.removeEdge(l);var h=u.forwardName;delete u.reversed,delete u.forwardName,a.setEdge(l.w,l.v,u,h)}})}return Bv}var Uv,zE;function pn(){if(zE)return Uv;zE=1;var e=yt(),t=cr().Graph;Uv={addDummyNode:n,simplify:s,asNonCompoundGraph:i,successorWeights:a,predecessorWeights:l,intersectRect:u,buildLayerMatrix:h,normalizeRanks:p,removeEmptyRanks:f,addBorderNode:g,maxRank:y,partition:w,time:N,notime:b};function n(_,k,E,j){var C;do C=e.uniqueId(j);while(_.hasNode(C));return E.dummy=k,_.setNode(C,E),C}function s(_){var k=new t().setGraph(_.graph());return e.forEach(_.nodes(),function(E){k.setNode(E,_.node(E))}),e.forEach(_.edges(),function(E){var j=k.edge(E.v,E.w)||{weight:0,minlen:1},C=_.edge(E);k.setEdge(E.v,E.w,{weight:j.weight+C.weight,minlen:Math.max(j.minlen,C.minlen)})}),k}function i(_){var k=new t({multigraph:_.isMultigraph()}).setGraph(_.graph());return e.forEach(_.nodes(),function(E){_.children(E).length||k.setNode(E,_.node(E))}),e.forEach(_.edges(),function(E){k.setEdge(E,_.edge(E))}),k}function a(_){var k=e.map(_.nodes(),function(E){var j={};return e.forEach(_.outEdges(E),function(C){j[C.w]=(j[C.w]||0)+_.edge(C).weight}),j});return e.zipObject(_.nodes(),k)}function l(_){var k=e.map(_.nodes(),function(E){var j={};return e.forEach(_.inEdges(E),function(C){j[C.v]=(j[C.v]||0)+_.edge(C).weight}),j});return e.zipObject(_.nodes(),k)}function u(_,k){var E=_.x,j=_.y,C=k.x-E,I=k.y-j,P=_.width/2,O=_.height/2;if(!C&&!I)throw new Error("Not possible to find intersection inside of the rectangle");var F,M;return Math.abs(I)*P>Math.abs(C)*O?(I<0&&(O=-O),F=O*C/I,M=O):(C<0&&(P=-P),F=P,M=P*I/C),{x:E+F,y:j+M}}function h(_){var k=e.map(e.range(y(_)+1),function(){return[]});return e.forEach(_.nodes(),function(E){var j=_.node(E),C=j.rank;e.isUndefined(C)||(k[C][j.order]=E)}),k}function p(_){var k=e.min(e.map(_.nodes(),function(E){return _.node(E).rank}));e.forEach(_.nodes(),function(E){var j=_.node(E);e.has(j,"rank")&&(j.rank-=k)})}function f(_){var k=e.min(e.map(_.nodes(),function(I){return _.node(I).rank})),E=[];e.forEach(_.nodes(),function(I){var P=_.node(I).rank-k;E[P]||(E[P]=[]),E[P].push(I)});var j=0,C=_.graph().nodeRankFactor;e.forEach(E,function(I,P){e.isUndefined(I)&&P%C!==0?--j:j&&e.forEach(I,function(O){_.node(O).rank+=j})})}function g(_,k,E,j){var C={width:0,height:0};return arguments.length>=4&&(C.rank=E,C.order=j),n(_,"border",C,k)}function y(_){return e.max(e.map(_.nodes(),function(k){var E=_.node(k).rank;if(!e.isUndefined(E))return E}))}function w(_,k){var E={lhs:[],rhs:[]};return e.forEach(_,function(j){k(j)?E.lhs.push(j):E.rhs.push(j)}),E}function N(_,k){var E=e.now();try{return k()}finally{console.log(_+" time: "+(e.now()-E)+"ms")}}function b(_,k){return k()}return Uv}var Wv,BE;function jz(){if(BE)return Wv;BE=1;var e=yt(),t=pn();Wv={run:n,undo:i};function n(a){a.graph().dummyChains=[],e.forEach(a.edges(),function(l){s(a,l)})}function s(a,l){var u=l.v,h=a.node(u).rank,p=l.w,f=a.node(p).rank,g=l.name,y=a.edge(l),w=y.labelRank;if(f!==h+1){a.removeEdge(l);var N,b,_;for(_=0,++h;h<f;++_,++h)y.points=[],b={width:0,height:0,edgeLabel:y,edgeObj:l,rank:h},N=t.addDummyNode(a,"edge",b,"_d"),h===w&&(b.width=y.width,b.height=y.height,b.dummy="edge-label",b.labelpos=y.labelpos),a.setEdge(u,N,{weight:y.weight},g),_===0&&a.graph().dummyChains.push(N),u=N;a.setEdge(u,p,{weight:y.weight},g)}}function i(a){e.forEach(a.graph().dummyChains,function(l){var u=a.node(l),h=u.edgeLabel,p;for(a.setEdge(u.edgeObj,h);u.dummy;)p=a.successors(l)[0],a.removeNode(l),h.points.push({x:u.x,y:u.y}),u.dummy==="edge-label"&&(h.x=u.x,h.y=u.y,h.width=u.width,h.height=u.height),l=p,u=a.node(l)})}return Wv}var Hv,UE;function Su(){if(UE)return Hv;UE=1;var e=yt();Hv={longestPath:t,slack:n};function t(s){var i={};function a(l){var u=s.node(l);if(e.has(i,l))return u.rank;i[l]=!0;var h=e.min(e.map(s.outEdges(l),function(p){return a(p.w)-s.edge(p).minlen}));return(h===Number.POSITIVE_INFINITY||h===void 0||h===null)&&(h=0),u.rank=h}e.forEach(s.sources(),a)}function n(s,i){return s.node(i.w).rank-s.node(i.v).rank-s.edge(i).minlen}return Hv}var Gv,WE;function LR(){if(WE)return Gv;WE=1;var e=yt(),t=cr().Graph,n=Su().slack;Gv=s;function s(u){var h=new t({directed:!1}),p=u.nodes()[0],f=u.nodeCount();h.setNode(p,{});for(var g,y;i(h,u)<f;)g=a(h,u),y=h.hasNode(g.v)?n(u,g):-n(u,g),l(h,u,y);return h}function i(u,h){function p(f){e.forEach(h.nodeEdges(f),function(g){var y=g.v,w=f===y?g.w:y;!u.hasNode(w)&&!n(h,g)&&(u.setNode(w,{}),u.setEdge(f,w,{}),p(w))})}return e.forEach(u.nodes(),p),u.nodeCount()}function a(u,h){return e.minBy(h.edges(),function(p){if(u.hasNode(p.v)!==u.hasNode(p.w))return n(h,p)})}function l(u,h,p){e.forEach(u.nodes(),function(f){h.node(f).rank+=p})}return Gv}var Vv,HE;function Cz(){if(HE)return Vv;HE=1;var e=yt(),t=LR(),n=Su().slack,s=Su().longestPath,i=cr().alg.preorder,a=cr().alg.postorder,l=pn().simplify;Vv=u,u.initLowLimValues=g,u.initCutValues=h,u.calcCutValue=f,u.leaveEdge=w,u.enterEdge=N,u.exchangeEdges=b;function u(j){j=l(j),s(j);var C=t(j);g(C),h(C,j);for(var I,P;I=w(C);)P=N(C,j,I),b(C,j,I,P)}function h(j,C){var I=a(j,j.nodes());I=I.slice(0,I.length-1),e.forEach(I,function(P){p(j,C,P)})}function p(j,C,I){var P=j.node(I),O=P.parent;j.edge(I,O).cutvalue=f(j,C,I)}function f(j,C,I){var P=j.node(I),O=P.parent,F=!0,M=C.edge(I,O),A=0;return M||(F=!1,M=C.edge(O,I)),A=M.weight,e.forEach(C.nodeEdges(I),function(q){var W=q.v===I,Y=W?q.w:q.v;if(Y!==O){var T=W===F,Z=C.edge(q).weight;if(A+=T?Z:-Z,k(j,I,Y)){var U=j.edge(I,Y).cutvalue;A+=T?-U:U}}}),A}function g(j,C){arguments.length<2&&(C=j.nodes()[0]),y(j,{},1,C)}function y(j,C,I,P,O){var F=I,M=j.node(P);return C[P]=!0,e.forEach(j.neighbors(P),function(A){e.has(C,A)||(I=y(j,C,I,A,P))}),M.low=F,M.lim=I++,O?M.parent=O:delete M.parent,I}function w(j){return e.find(j.edges(),function(C){return j.edge(C).cutvalue<0})}function N(j,C,I){var P=I.v,O=I.w;C.hasEdge(P,O)||(P=I.w,O=I.v);var F=j.node(P),M=j.node(O),A=F,q=!1;F.lim>M.lim&&(A=M,q=!0);var W=e.filter(C.edges(),function(Y){return q===E(j,j.node(Y.v),A)&&q!==E(j,j.node(Y.w),A)});return e.minBy(W,function(Y){return n(C,Y)})}function b(j,C,I,P){var O=I.v,F=I.w;j.removeEdge(O,F),j.setEdge(P.v,P.w,{}),g(j),h(j,C),_(j,C)}function _(j,C){var I=e.find(j.nodes(),function(O){return!C.node(O).parent}),P=i(j,I);P=P.slice(1),e.forEach(P,function(O){var F=j.node(O).parent,M=C.edge(O,F),A=!1;M||(M=C.edge(F,O),A=!0),C.node(O).rank=C.node(F).rank+(A?M.minlen:-M.minlen)})}function k(j,C,I){return j.hasEdge(C,I)}function E(j,C,I){return I.low<=C.lim&&C.lim<=I.lim}return Vv}var Yv,GE;function Tz(){if(GE)return Yv;GE=1;var e=Su(),t=e.longestPath,n=LR(),s=Cz();Yv=i;function i(h){switch(h.graph().ranker){case"network-simplex":u(h);break;case"tight-tree":l(h);break;case"longest-path":a(h);break;default:u(h)}}var a=t;function l(h){t(h),n(h)}function u(h){s(h)}return Yv}var Kv,VE;function Rz(){if(VE)return Kv;VE=1;var e=yt();Kv=t;function t(i){var a=s(i);e.forEach(i.graph().dummyChains,function(l){for(var u=i.node(l),h=u.edgeObj,p=n(i,a,h.v,h.w),f=p.path,g=p.lca,y=0,w=f[y],N=!0;l!==h.w;){if(u=i.node(l),N){for(;(w=f[y])!==g&&i.node(w).maxRank<u.rank;)y++;w===g&&(N=!1)}if(!N){for(;y<f.length-1&&i.node(w=f[y+1]).minRank<=u.rank;)y++;w=f[y]}i.setParent(l,w),l=i.successors(l)[0]}})}function n(i,a,l,u){var h=[],p=[],f=Math.min(a[l].low,a[u].low),g=Math.max(a[l].lim,a[u].lim),y,w;y=l;do y=i.parent(y),h.push(y);while(y&&(a[y].low>f||g>a[y].lim));for(w=y,y=u;(y=i.parent(y))!==w;)p.push(y);return{path:h.concat(p.reverse()),lca:w}}function s(i){var a={},l=0;function u(h){var p=l;e.forEach(i.children(h),u),a[h]={low:p,lim:l++}}return e.forEach(i.children(),u),a}return Kv}var Xv,YE;function Az(){if(YE)return Xv;YE=1;var e=yt(),t=pn();Xv={run:n,cleanup:l};function n(u){var h=t.addDummyNode(u,"root",{},"_root"),p=i(u),f=e.max(e.values(p))-1,g=2*f+1;u.graph().nestingRoot=h,e.forEach(u.edges(),function(w){u.edge(w).minlen*=g});var y=a(u)+1;e.forEach(u.children(),function(w){s(u,h,g,y,f,p,w)}),u.graph().nodeRankFactor=g}function s(u,h,p,f,g,y,w){var N=u.children(w);if(!N.length){w!==h&&u.setEdge(h,w,{weight:0,minlen:p});return}var b=t.addBorderNode(u,"_bt"),_=t.addBorderNode(u,"_bb"),k=u.node(w);u.setParent(b,w),k.borderTop=b,u.setParent(_,w),k.borderBottom=_,e.forEach(N,function(E){s(u,h,p,f,g,y,E);var j=u.node(E),C=j.borderTop?j.borderTop:E,I=j.borderBottom?j.borderBottom:E,P=j.borderTop?f:2*f,O=C!==I?1:g-y[w]+1;u.setEdge(b,C,{weight:P,minlen:O,nestingEdge:!0}),u.setEdge(I,_,{weight:P,minlen:O,nestingEdge:!0})}),u.parent(w)||u.setEdge(h,b,{weight:0,minlen:g+y[w]})}function i(u){var h={};function p(f,g){var y=u.children(f);y&&y.length&&e.forEach(y,function(w){p(w,g+1)}),h[f]=g}return e.forEach(u.children(),function(f){p(f,1)}),h}function a(u){return e.reduce(u.edges(),function(h,p){return h+u.edge(p).weight},0)}function l(u){var h=u.graph();u.removeNode(h.nestingRoot),delete h.nestingRoot,e.forEach(u.edges(),function(p){var f=u.edge(p);f.nestingEdge&&u.removeEdge(p)})}return Xv}var Qv,KE;function Mz(){if(KE)return Qv;KE=1;var e=yt(),t=pn();Qv=n;function n(i){function a(l){var u=i.children(l),h=i.node(l);if(u.length&&e.forEach(u,a),e.has(h,"minRank")){h.borderLeft=[],h.borderRight=[];for(var p=h.minRank,f=h.maxRank+1;p<f;++p)s(i,"borderLeft","_bl",l,h,p),s(i,"borderRight","_br",l,h,p)}}e.forEach(i.children(),a)}function s(i,a,l,u,h,p){var f={width:0,height:0,rank:p,borderType:a},g=h[a][p-1],y=t.addDummyNode(i,"border",f,l);h[a][p]=y,i.setParent(y,u),g&&i.setEdge(g,y,{weight:1})}return Qv}var Zv,XE;function Iz(){if(XE)return Zv;XE=1;var e=yt();Zv={adjust:t,undo:n};function t(p){var f=p.graph().rankdir.toLowerCase();(f==="lr"||f==="rl")&&s(p)}function n(p){var f=p.graph().rankdir.toLowerCase();(f==="bt"||f==="rl")&&a(p),(f==="lr"||f==="rl")&&(u(p),s(p))}function s(p){e.forEach(p.nodes(),function(f){i(p.node(f))}),e.forEach(p.edges(),function(f){i(p.edge(f))})}function i(p){var f=p.width;p.width=p.height,p.height=f}function a(p){e.forEach(p.nodes(),function(f){l(p.node(f))}),e.forEach(p.edges(),function(f){var g=p.edge(f);e.forEach(g.points,l),e.has(g,"y")&&l(g)})}function l(p){p.y=-p.y}function u(p){e.forEach(p.nodes(),function(f){h(p.node(f))}),e.forEach(p.edges(),function(f){var g=p.edge(f);e.forEach(g.points,h),e.has(g,"x")&&h(g)})}function h(p){var f=p.x;p.x=p.y,p.y=f}return Zv}var Jv,QE;function Oz(){if(QE)return Jv;QE=1;var e=yt();Jv=t;function t(n){var s={},i=e.filter(n.nodes(),function(p){return!n.children(p).length}),a=e.max(e.map(i,function(p){return n.node(p).rank})),l=e.map(e.range(a+1),function(){return[]});function u(p){if(!e.has(s,p)){s[p]=!0;var f=n.node(p);l[f.rank].push(p),e.forEach(n.successors(p),u)}}var h=e.sortBy(i,function(p){return n.node(p).rank});return e.forEach(h,u),l}return Jv}var ey,ZE;function Pz(){if(ZE)return ey;ZE=1;var e=yt();ey=t;function t(s,i){for(var a=0,l=1;l<i.length;++l)a+=n(s,i[l-1],i[l]);return a}function n(s,i,a){for(var l=e.zipObject(a,e.map(a,function(y,w){return w})),u=e.flatten(e.map(i,function(y){return e.sortBy(e.map(s.outEdges(y),function(w){return{pos:l[w.w],weight:s.edge(w).weight}}),"pos")}),!0),h=1;h<a.length;)h<<=1;var p=2*h-1;h-=1;var f=e.map(new Array(p),function(){return 0}),g=0;return e.forEach(u.forEach(function(y){var w=y.pos+h;f[w]+=y.weight;for(var N=0;w>0;)w%2&&(N+=f[w+1]),w=w-1>>1,f[w]+=y.weight;g+=y.weight*N})),g}return ey}var ty,JE;function $z(){if(JE)return ty;JE=1;var e=yt();ty=t;function t(n,s){return e.map(s,function(i){var a=n.inEdges(i);if(a.length){var l=e.reduce(a,function(u,h){var p=n.edge(h),f=n.node(h.v);return{sum:u.sum+p.weight*f.order,weight:u.weight+p.weight}},{sum:0,weight:0});return{v:i,barycenter:l.sum/l.weight,weight:l.weight}}else return{v:i}})}return ty}var ny,ej;function Lz(){if(ej)return ny;ej=1;var e=yt();ny=t;function t(i,a){var l={};e.forEach(i,function(h,p){var f=l[h.v]={indegree:0,in:[],out:[],vs:[h.v],i:p};e.isUndefined(h.barycenter)||(f.barycenter=h.barycenter,f.weight=h.weight)}),e.forEach(a.edges(),function(h){var p=l[h.v],f=l[h.w];!e.isUndefined(p)&&!e.isUndefined(f)&&(f.indegree++,p.out.push(l[h.w]))});var u=e.filter(l,function(h){return!h.indegree});return n(u)}function n(i){var a=[];function l(p){return function(f){f.merged||(e.isUndefined(f.barycenter)||e.isUndefined(p.barycenter)||f.barycenter>=p.barycenter)&&s(p,f)}}function u(p){return function(f){f.in.push(p),--f.indegree===0&&i.push(f)}}for(;i.length;){var h=i.pop();a.push(h),e.forEach(h.in.reverse(),l(h)),e.forEach(h.out,u(h))}return e.map(e.filter(a,function(p){return!p.merged}),function(p){return e.pick(p,["vs","i","barycenter","weight"])})}function s(i,a){var l=0,u=0;i.weight&&(l+=i.barycenter*i.weight,u+=i.weight),a.weight&&(l+=a.barycenter*a.weight,u+=a.weight),i.vs=a.vs.concat(i.vs),i.barycenter=l/u,i.weight=u,i.i=Math.min(a.i,i.i),a.merged=!0}return ny}var ry,tj;function qz(){if(tj)return ry;tj=1;var e=yt(),t=pn();ry=n;function n(a,l){var u=t.partition(a,function(b){return e.has(b,"barycenter")}),h=u.lhs,p=e.sortBy(u.rhs,function(b){return-b.i}),f=[],g=0,y=0,w=0;h.sort(i(!!l)),w=s(f,p,w),e.forEach(h,function(b){w+=b.vs.length,f.push(b.vs),g+=b.barycenter*b.weight,y+=b.weight,w=s(f,p,w)});var N={vs:e.flatten(f,!0)};return y&&(N.barycenter=g/y,N.weight=y),N}function s(a,l,u){for(var h;l.length&&(h=e.last(l)).i<=u;)l.pop(),a.push(h.vs),u++;return u}function i(a){return function(l,u){return l.barycenter<u.barycenter?-1:l.barycenter>u.barycenter?1:a?u.i-l.i:l.i-u.i}}return ry}var sy,nj;function Dz(){if(nj)return sy;nj=1;var e=yt(),t=$z(),n=Lz(),s=qz();sy=i;function i(u,h,p,f){var g=u.children(h),y=u.node(h),w=y?y.borderLeft:void 0,N=y?y.borderRight:void 0,b={};w&&(g=e.filter(g,function(I){return I!==w&&I!==N}));var _=t(u,g);e.forEach(_,function(I){if(u.children(I.v).length){var P=i(u,I.v,p,f);b[I.v]=P,e.has(P,"barycenter")&&l(I,P)}});var k=n(_,p);a(k,b);var E=s(k,f);if(w&&(E.vs=e.flatten([w,E.vs,N],!0),u.predecessors(w).length)){var j=u.node(u.predecessors(w)[0]),C=u.node(u.predecessors(N)[0]);e.has(E,"barycenter")||(E.barycenter=0,E.weight=0),E.barycenter=(E.barycenter*E.weight+j.order+C.order)/(E.weight+2),E.weight+=2}return E}function a(u,h){e.forEach(u,function(p){p.vs=e.flatten(p.vs.map(function(f){return h[f]?h[f].vs:f}),!0)})}function l(u,h){e.isUndefined(u.barycenter)?(u.barycenter=h.barycenter,u.weight=h.weight):(u.barycenter=(u.barycenter*u.weight+h.barycenter*h.weight)/(u.weight+h.weight),u.weight+=h.weight)}return sy}var oy,rj;function Fz(){if(rj)return oy;rj=1;var e=yt(),t=cr().Graph;oy=n;function n(i,a,l){var u=s(i),h=new t({compound:!0}).setGraph({root:u}).setDefaultNodeLabel(function(p){return i.node(p)});return e.forEach(i.nodes(),function(p){var f=i.node(p),g=i.parent(p);(f.rank===a||f.minRank<=a&&a<=f.maxRank)&&(h.setNode(p),h.setParent(p,g||u),e.forEach(i[l](p),function(y){var w=y.v===p?y.w:y.v,N=h.edge(w,p),b=e.isUndefined(N)?0:N.weight;h.setEdge(w,p,{weight:i.edge(y).weight+b})}),e.has(f,"minRank")&&h.setNode(p,{borderLeft:f.borderLeft[a],borderRight:f.borderRight[a]}))}),h}function s(i){for(var a;i.hasNode(a=e.uniqueId("_root")););return a}return oy}var iy,sj;function zz(){if(sj)return iy;sj=1;var e=yt();iy=t;function t(n,s,i){var a={},l;e.forEach(i,function(u){for(var h=n.parent(u),p,f;h;){if(p=n.parent(h),p?(f=a[p],a[p]=h):(f=l,l=h),f&&f!==h){s.setEdge(f,h);return}h=p}})}return iy}var ay,oj;function Bz(){if(oj)return ay;oj=1;var e=yt(),t=Oz(),n=Pz(),s=Dz(),i=Fz(),a=zz(),l=cr().Graph,u=pn();ay=h;function h(y){var w=u.maxRank(y),N=p(y,e.range(1,w+1),"inEdges"),b=p(y,e.range(w-1,-1,-1),"outEdges"),_=t(y);g(y,_);for(var k=Number.POSITIVE_INFINITY,E,j=0,C=0;C<4;++j,++C){f(j%2?N:b,j%4>=2),_=u.buildLayerMatrix(y);var I=n(y,_);I<k&&(C=0,E=e.cloneDeep(_),k=I)}g(y,E)}function p(y,w,N){return e.map(w,function(b){return i(y,b,N)})}function f(y,w){var N=new l;e.forEach(y,function(b){var _=b.graph().root,k=s(b,_,N,w);e.forEach(k.vs,function(E,j){b.node(E).order=j}),a(b,N,k.vs)})}function g(y,w){e.forEach(w,function(N){e.forEach(N,function(b,_){y.node(b).order=_})})}return ay}var ly,ij;function Uz(){if(ij)return ly;ij=1;var e=yt(),t=cr().Graph,n=pn();ly={positionX:N,findType1Conflicts:s,findType2Conflicts:i,addConflict:l,hasConflict:u,verticalAlignment:h,horizontalCompaction:p,alignCoordinates:y,findSmallestWidthAlignment:g,balance:w};function s(k,E){var j={};function C(I,P){var O=0,F=0,M=I.length,A=e.last(P);return e.forEach(P,function(q,W){var Y=a(k,q),T=Y?k.node(Y).order:M;(Y||q===A)&&(e.forEach(P.slice(F,W+1),function(Z){e.forEach(k.predecessors(Z),function(U){var ne=k.node(U),X=ne.order;(X<O||T<X)&&!(ne.dummy&&k.node(Z).dummy)&&l(j,U,Z)})}),F=W+1,O=T)}),P}return e.reduce(E,C),j}function i(k,E){var j={};function C(P,O,F,M,A){var q;e.forEach(e.range(O,F),function(W){q=P[W],k.node(q).dummy&&e.forEach(k.predecessors(q),function(Y){var T=k.node(Y);T.dummy&&(T.order<M||T.order>A)&&l(j,Y,q)})})}function I(P,O){var F=-1,M,A=0;return e.forEach(O,function(q,W){if(k.node(q).dummy==="border"){var Y=k.predecessors(q);Y.length&&(M=k.node(Y[0]).order,C(O,A,W,F,M),A=W,F=M)}C(O,A,O.length,M,P.length)}),O}return e.reduce(E,I),j}function a(k,E){if(k.node(E).dummy)return e.find(k.predecessors(E),function(j){return k.node(j).dummy})}function l(k,E,j){if(E>j){var C=E;E=j,j=C}var I=k[E];I||(k[E]=I={}),I[j]=!0}function u(k,E,j){if(E>j){var C=E;E=j,j=C}return e.has(k[E],j)}function h(k,E,j,C){var I={},P={},O={};return e.forEach(E,function(F){e.forEach(F,function(M,A){I[M]=M,P[M]=M,O[M]=A})}),e.forEach(E,function(F){var M=-1;e.forEach(F,function(A){var q=C(A);if(q.length){q=e.sortBy(q,function(U){return O[U]});for(var W=(q.length-1)/2,Y=Math.floor(W),T=Math.ceil(W);Y<=T;++Y){var Z=q[Y];P[A]===A&&M<O[Z]&&!u(j,A,Z)&&(P[Z]=A,P[A]=I[A]=I[Z],M=O[Z])}}})}),{root:I,align:P}}function p(k,E,j,C,I){var P={},O=f(k,E,j,I),F=I?"borderLeft":"borderRight";function M(W,Y){for(var T=O.nodes(),Z=T.pop(),U={};Z;)U[Z]?W(Z):(U[Z]=!0,T.push(Z),T=T.concat(Y(Z))),Z=T.pop()}function A(W){P[W]=O.inEdges(W).reduce(function(Y,T){return Math.max(Y,P[T.v]+O.edge(T))},0)}function q(W){var Y=O.outEdges(W).reduce(function(Z,U){return Math.min(Z,P[U.w]-O.edge(U))},Number.POSITIVE_INFINITY),T=k.node(W);Y!==Number.POSITIVE_INFINITY&&T.borderType!==F&&(P[W]=Math.max(P[W],Y))}return M(A,O.predecessors.bind(O)),M(q,O.successors.bind(O)),e.forEach(C,function(W){P[W]=P[j[W]]}),P}function f(k,E,j,C){var I=new t,P=k.graph(),O=b(P.nodesep,P.edgesep,C);return e.forEach(E,function(F){var M;e.forEach(F,function(A){var q=j[A];if(I.setNode(q),M){var W=j[M],Y=I.edge(W,q);I.setEdge(W,q,Math.max(O(k,A,M),Y||0))}M=A})}),I}function g(k,E){return e.minBy(e.values(E),function(j){var C=Number.NEGATIVE_INFINITY,I=Number.POSITIVE_INFINITY;return e.forIn(j,function(P,O){var F=_(k,O)/2;C=Math.max(P+F,C),I=Math.min(P-F,I)}),C-I})}function y(k,E){var j=e.values(E),C=e.min(j),I=e.max(j);e.forEach(["u","d"],function(P){e.forEach(["l","r"],function(O){var F=P+O,M=k[F],A;if(M!==E){var q=e.values(M);A=O==="l"?C-e.min(q):I-e.max(q),A&&(k[F]=e.mapValues(M,function(W){return W+A}))}})})}function w(k,E){return e.mapValues(k.ul,function(j,C){if(E)return k[E.toLowerCase()][C];var I=e.sortBy(e.map(k,C));return(I[1]+I[2])/2})}function N(k){var E=n.buildLayerMatrix(k),j=e.merge(s(k,E),i(k,E)),C={},I;e.forEach(["u","d"],function(O){I=O==="u"?E:e.values(E).reverse(),e.forEach(["l","r"],function(F){F==="r"&&(I=e.map(I,function(W){return e.values(W).reverse()}));var M=(O==="u"?k.predecessors:k.successors).bind(k),A=h(k,I,j,M),q=p(k,I,A.root,A.align,F==="r");F==="r"&&(q=e.mapValues(q,function(W){return-W})),C[O+F]=q})});var P=g(k,C);return y(C,P),w(C,k.graph().align)}function b(k,E,j){return function(C,I,P){var O=C.node(I),F=C.node(P),M=0,A;if(M+=O.width/2,e.has(O,"labelpos"))switch(O.labelpos.toLowerCase()){case"l":A=-O.width/2;break;case"r":A=O.width/2;break}if(A&&(M+=j?A:-A),A=0,M+=(O.dummy?E:k)/2,M+=(F.dummy?E:k)/2,M+=F.width/2,e.has(F,"labelpos"))switch(F.labelpos.toLowerCase()){case"l":A=F.width/2;break;case"r":A=-F.width/2;break}return A&&(M+=j?A:-A),A=0,M}}function _(k,E){return k.node(E).width}return ly}var cy,aj;function Wz(){if(aj)return cy;aj=1;var e=yt(),t=pn(),n=Uz().positionX;cy=s;function s(a){a=t.asNonCompoundGraph(a),i(a),e.forEach(n(a),function(l,u){a.node(u).x=l})}function i(a){var l=t.buildLayerMatrix(a),u=a.graph().ranksep,h=0;e.forEach(l,function(p){var f=e.max(e.map(p,function(g){return a.node(g).height}));e.forEach(p,function(g){a.node(g).y=h+f/2}),h+=f+u})}return cy}var uy,lj;function Hz(){if(lj)return uy;lj=1;var e=yt(),t=Ez(),n=jz(),s=Tz(),i=pn().normalizeRanks,a=Rz(),l=pn().removeEmptyRanks,u=Az(),h=Mz(),p=Iz(),f=Bz(),g=Wz(),y=pn(),w=cr().Graph;uy=N;function N(D,L){var K=L&&L.debugTiming?y.time:y.notime;K("layout",function(){var se=K(" buildLayoutGraph",function(){return M(D)});K(" runLayout",function(){b(se,K)}),K(" updateInputGraph",function(){_(D,se)})})}function b(D,L){L(" makeSpaceForEdgeLabels",function(){A(D)}),L(" removeSelfEdges",function(){H(D)}),L(" acyclic",function(){t.run(D)}),L(" nestingGraph.run",function(){u.run(D)}),L(" rank",function(){s(y.asNonCompoundGraph(D))}),L(" injectEdgeLabelProxies",function(){q(D)}),L(" removeEmptyRanks",function(){l(D)}),L(" nestingGraph.cleanup",function(){u.cleanup(D)}),L(" normalizeRanks",function(){i(D)}),L(" assignRankMinMax",function(){W(D)}),L(" removeEdgeLabelProxies",function(){Y(D)}),L(" normalize.run",function(){n.run(D)}),L(" parentDummyChains",function(){a(D)}),L(" addBorderSegments",function(){h(D)}),L(" order",function(){f(D)}),L(" insertSelfEdges",function(){J(D)}),L(" adjustCoordinateSystem",function(){p.adjust(D)}),L(" position",function(){g(D)}),L(" positionSelfEdges",function(){$(D)}),L(" removeBorderNodes",function(){X(D)}),L(" normalize.undo",function(){n.undo(D)}),L(" fixupEdgeLabelCoords",function(){U(D)}),L(" undoCoordinateSystem",function(){p.undo(D)}),L(" translateGraph",function(){T(D)}),L(" assignNodeIntersects",function(){Z(D)}),L(" reversePoints",function(){ne(D)}),L(" acyclic.undo",function(){t.undo(D)})}function _(D,L){e.forEach(D.nodes(),function(K){var se=D.node(K),he=L.node(K);se&&(se.x=he.x,se.y=he.y,L.children(K).length&&(se.width=he.width,se.height=he.height))}),e.forEach(D.edges(),function(K){var se=D.edge(K),he=L.edge(K);se.points=he.points,e.has(he,"x")&&(se.x=he.x,se.y=he.y)}),D.graph().width=L.graph().width,D.graph().height=L.graph().height}var k=["nodesep","edgesep","ranksep","marginx","marginy"],E={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},j=["acyclicer","ranker","rankdir","align"],C=["width","height"],I={width:0,height:0},P=["minlen","weight","width","height","labeloffset"],O={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},F=["labelpos"];function M(D){var L=new w({multigraph:!0,compound:!0}),K=Q(D.graph());return L.setGraph(e.merge({},E,G(K,k),e.pick(K,j))),e.forEach(D.nodes(),function(se){var he=Q(D.node(se));L.setNode(se,e.defaults(G(he,C),I)),L.setParent(se,D.parent(se))}),e.forEach(D.edges(),function(se){var he=Q(D.edge(se));L.setEdge(se,e.merge({},O,G(he,P),e.pick(he,F)))}),L}function A(D){var L=D.graph();L.ranksep/=2,e.forEach(D.edges(),function(K){var se=D.edge(K);se.minlen*=2,se.labelpos.toLowerCase()!=="c"&&(L.rankdir==="TB"||L.rankdir==="BT"?se.width+=se.labeloffset:se.height+=se.labeloffset)})}function q(D){e.forEach(D.edges(),function(L){var K=D.edge(L);if(K.width&&K.height){var se=D.node(L.v),he=D.node(L.w),pe={rank:(he.rank-se.rank)/2+se.rank,e:L};y.addDummyNode(D,"edge-proxy",pe,"_ep")}})}function W(D){var L=0;e.forEach(D.nodes(),function(K){var se=D.node(K);se.borderTop&&(se.minRank=D.node(se.borderTop).rank,se.maxRank=D.node(se.borderBottom).rank,L=e.max(L,se.maxRank))}),D.graph().maxRank=L}function Y(D){e.forEach(D.nodes(),function(L){var K=D.node(L);K.dummy==="edge-proxy"&&(D.edge(K.e).labelRank=K.rank,D.removeNode(L))})}function T(D){var L=Number.POSITIVE_INFINITY,K=0,se=Number.POSITIVE_INFINITY,he=0,pe=D.graph(),re=pe.marginx||0,ve=pe.marginy||0;function Te($e){var Me=$e.x,_e=$e.y,ae=$e.width,we=$e.height;L=Math.min(L,Me-ae/2),K=Math.max(K,Me+ae/2),se=Math.min(se,_e-we/2),he=Math.max(he,_e+we/2)}e.forEach(D.nodes(),function($e){Te(D.node($e))}),e.forEach(D.edges(),function($e){var Me=D.edge($e);e.has(Me,"x")&&Te(Me)}),L-=re,se-=ve,e.forEach(D.nodes(),function($e){var Me=D.node($e);Me.x-=L,Me.y-=se}),e.forEach(D.edges(),function($e){var Me=D.edge($e);e.forEach(Me.points,function(_e){_e.x-=L,_e.y-=se}),e.has(Me,"x")&&(Me.x-=L),e.has(Me,"y")&&(Me.y-=se)}),pe.width=K-L+re,pe.height=he-se+ve}function Z(D){e.forEach(D.edges(),function(L){var K=D.edge(L),se=D.node(L.v),he=D.node(L.w),pe,re;K.points?(pe=K.points[0],re=K.points[K.points.length-1]):(K.points=[],pe=he,re=se),K.points.unshift(y.intersectRect(se,pe)),K.points.push(y.intersectRect(he,re))})}function U(D){e.forEach(D.edges(),function(L){var K=D.edge(L);if(e.has(K,"x"))switch((K.labelpos==="l"||K.labelpos==="r")&&(K.width-=K.labeloffset),K.labelpos){case"l":K.x-=K.width/2+K.labeloffset;break;case"r":K.x+=K.width/2+K.labeloffset;break}})}function ne(D){e.forEach(D.edges(),function(L){var K=D.edge(L);K.reversed&&K.points.reverse()})}function X(D){e.forEach(D.nodes(),function(L){if(D.children(L).length){var K=D.node(L),se=D.node(K.borderTop),he=D.node(K.borderBottom),pe=D.node(e.last(K.borderLeft)),re=D.node(e.last(K.borderRight));K.width=Math.abs(re.x-pe.x),K.height=Math.abs(he.y-se.y),K.x=pe.x+K.width/2,K.y=se.y+K.height/2}}),e.forEach(D.nodes(),function(L){D.node(L).dummy==="border"&&D.removeNode(L)})}function H(D){e.forEach(D.edges(),function(L){if(L.v===L.w){var K=D.node(L.v);K.selfEdges||(K.selfEdges=[]),K.selfEdges.push({e:L,label:D.edge(L)}),D.removeEdge(L)}})}function J(D){var L=y.buildLayerMatrix(D);e.forEach(L,function(K){var se=0;e.forEach(K,function(he,pe){var re=D.node(he);re.order=pe+se,e.forEach(re.selfEdges,function(ve){y.addDummyNode(D,"selfedge",{width:ve.label.width,height:ve.label.height,rank:re.rank,order:pe+ ++se,e:ve.e,label:ve.label},"_se")}),delete re.selfEdges})})}function $(D){e.forEach(D.nodes(),function(L){var K=D.node(L);if(K.dummy==="selfedge"){var se=D.node(K.e.v),he=se.x+se.width/2,pe=se.y,re=K.x-he,ve=se.height/2;D.setEdge(K.e,K.label),D.removeNode(L),K.label.points=[{x:he+2*re/3,y:pe-ve},{x:he+5*re/6,y:pe-ve},{x:he+re,y:pe},{x:he+5*re/6,y:pe+ve},{x:he+2*re/3,y:pe+ve}],K.label.x=K.x,K.label.y=K.y}})}function G(D,L){return e.mapValues(e.pick(D,L),Number)}function Q(D){var L={};return e.forEach(D,function(K,se){L[se.toLowerCase()]=K}),L}return uy}var dy,cj;function Gz(){if(cj)return dy;cj=1;var e=yt(),t=pn(),n=cr().Graph;dy={debugOrdering:s};function s(i){var a=t.buildLayerMatrix(i),l=new n({compound:!0,multigraph:!0}).setGraph({});return e.forEach(i.nodes(),function(u){l.setNode(u,{label:u}),l.setParent(u,"layer"+i.node(u).rank)}),e.forEach(i.edges(),function(u){l.setEdge(u.v,u.w,{},u.name)}),e.forEach(a,function(u,h){var p="layer"+h;l.setNode(p,{rank:"same"}),e.reduce(u,function(f,g){return l.setEdge(f,g,{style:"invis"}),g})}),l}return dy}var fy,uj;function Vz(){return uj||(uj=1,fy="0.8.5"),fy}var hy,dj;function Yz(){return dj||(dj=1,hy={graphlib:cr(),layout:Hz(),debug:Gz(),util:{time:pn().time,notime:pn().notime},version:Vz()}),hy}var Kz=Yz();const fj=Zy(Kz),Wi=240,Nu=130,Pi=74,td=72,hj=Pi+td;function Xz(e,t){var s;let n=Wi;for(const i of e)n=Math.max(n,((s=t.get(i.id))==null?void 0:s.width)??Wi);return n}const qR=420,Qz=2;function ul(e){var n;return((n=e.data)==null?void 0:n.sessionId)??"_default"}function Zz(e,t){return((t==null?void 0:t.get(e))??0)>0?qR:0}function Jz(e,t){const n=(t==null?void 0:t.get(e))??0;return n>0?6+n*36:0}function dl(e,t,n){const s=t.get(e);return{w:((s==null?void 0:s.width)??Wi)+Zz(e,n),h:Math.max((s==null?void 0:s.height)??Nu,Jz(e,n))}}function eB(e){return[...e.keys()].sort().map(t=>`${t}:${e.get(t)}`).join("|")}function tB(e,t,n,s,i,a){const l=new fj.graphlib.Graph;l.setDefaultEdgeLabel(()=>({})),l.setGraph({rankdir:n,marginx:0,marginy:0,nodesep:70,ranksep:160,edgesep:30});const u=e.filter(k=>!i.has(k)),h=new Set(u);for(const k of u){const{w:E,h:j}=dl(k,s,a);l.setNode(k,{width:E,height:j})}for(const k of t)h.has(k.source)&&h.has(k.target)&&l.setEdge(k.source,k.target);fj.layout(l);const p=new Map;let f=1/0,g=1/0,y=-1/0,w=-1/0;for(const k of u){const E=l.node(k);if(!E)continue;const j=s.get(k),C=(j==null?void 0:j.width)??Wi,I=(j==null?void 0:j.height)??Nu,P=dl(k,s,a),O=E.x-P.w/2,F=E.y-P.h/2;p.set(k,{x:O,y:F}),O<f&&(f=O),F<g&&(g=F),O+C>y&&(y=O+C),F+I>w&&(w=F+I)}if(Number.isFinite(f)&&Number.isFinite(g))for(const[k,E]of p)p.set(k,{x:E.x-f,y:E.y-g});const N=Number.isFinite(y)?y-f:0,b=Number.isFinite(w)?w-g:0;let _=null;for(const k of e){const E=i.get(k);if(!E)continue;const j=s.get(k),C=(j==null?void 0:j.width)??Wi,I=(j==null?void 0:j.height)??Nu;_=_===null?{minX:E.x,minY:E.y,maxX:E.x+C,maxY:E.y+I}:{minX:Math.min(_.minX,E.x),minY:Math.min(_.minY,E.y),maxX:Math.max(_.maxX,E.x+C),maxY:Math.max(_.maxY,E.y+I)}}return{positions:p,width:N,height:b,pinnedBox:_}}function nB(e,t,n={}){const s=n.direction??"LR",i=n.pinned??new Map,a=n.measured??new Map,l=n.lanes,u=new Map;for(const k of e){const E=ul(k),j=u.get(E);j?j.push(k.id):u.set(E,[k.id])}const p=Array.from(u.keys()).sort().map(k=>({sid:k,...tB(u.get(k),t,s,a,i,l)})),f=Xz(e,a),g=n.availableHeight&&n.availableHeight>0?n.availableHeight:Number.POSITIVE_INFINITY,y=k=>{const E=[[]];let j=0;for(const C of p)E.length<k&&j>0&&j+C.height>g&&(E.push([]),j=0),E[E.length-1].push(C),j+=C.height+hj;return E},w=k=>k.reduce((E,j)=>Math.max(E,j.width),0)+qR;let N=y(n.availableWidth?Qz:1);N.length>1&&N.reduce((E,j)=>E+w(j),0)+f*(N.length-1)>(n.availableWidth??0)&&(N=y(1));const b=new Map;let _=0;for(const k of N){const E=w(k);let j=0;for(const{positions:C,height:I,pinnedBox:P}of k){for(const[F,M]of C)b.set(F,{x:M.x+_,y:M.y+j});let O=j+I;P&&P.maxY>O&&P.minX<_+E&&_<P.maxX&&(O=P.maxY),j=O+hj}_+=E+f}return e.map(k=>{const E=i.get(k.id);if(E)return{...k,position:E};const j=b.get(k.id);return j?{...k,position:j}:k})}function rB(e,t,n,s,i){const l=Pi+td,u=60,h=w=>dl(w,s,i),p=new Map(e.map(w=>[w.id,ul(w)])),f=[],g=e.map(w=>({id:w.id,pos:n.get(w.id)??t.get(w.id)})).filter(w=>w.pos!=null).sort((w,N)=>w.pos.y-N.pos.y||w.pos.x-N.pos.x||w.id.localeCompare(N.id)),y=[];for(const{id:w,pos:N}of g){const{w:b,h:_}=h(w),k=p.get(w)??"_default";if(n.has(w)){f.push({x:N.x,y:N.y,w:b,h:_,sid:k});continue}let E=N.y;for(let j=0;j<f.length+1;j++){const C=f.find(I=>{const P=I.sid===k?24:u,O=I.sid===k?24:l;return N.x<I.x+I.w+P&&I.x<N.x+b+P&&E<I.y+I.h+O&&I.y<E+_+O});if(!C)break;E=C.y+C.h+(C.sid===k?24:l)}E!==N.y&&(t.set(w,{x:N.x,y:E}),y.push(w)),f.push({x:N.x,y:E,w:b,h:_,sid:k})}return y}function sB(e,t,n,s,i,a){const l=b=>dl(b,s,a),u=b=>n.get(b)??t.get(b),h=new Map;for(const b of e){if(!u(b.id))continue;const _=ul(b),k=h.get(_);k?k.push(b):h.set(_,[b])}const p=new Set;for(const[b,_]of h)_.every(k=>i.has(k.id)&&!n.has(k.id))&&p.add(b);const f=new Map,g=[];for(const b of e){const _=u(b.id);if(!_)continue;const{w:k,h:E}=l(b.id),j=ul(b);p.has(j)?(f.get(j)??f.set(j,[]).get(j)).push(b):g.push({x:_.x,y:_.y,w:k,h:E})}if(f.size===0)return[];const y=Pi+td,w=(b,_,k,E)=>g.some(j=>b<j.x+j.w+Pi&&j.x<b+k+Pi&&_<j.y+j.h+y&&j.y<_+E+y),N=[];for(const b of[...f.keys()].sort()){const _=f.get(b);let k=1/0,E=1/0,j=-1/0,C=-1/0;for(const q of _){const W=u(q.id),{w:Y,h:T}=l(q.id);k=Math.min(k,W.x),E=Math.min(E,W.y),j=Math.max(j,W.x+Y),C=Math.max(C,W.y+T)}const I=j-k,P=C-E,O=[...new Set(g.map(q=>Math.round(q.x)))].sort((q,W)=>q-W),F=O.length?O:[k],M=[0,...g.map(q=>q.y+q.h+y)].sort((q,W)=>q-W);let A=null;e:for(const q of F)for(const W of M){if(W>=E)break;if(!w(q,W,I,P)){A={x:q,y:W};break e}}if(A){const q=A.x-k,W=A.y-E;for(const Y of _){const T=u(Y.id);t.set(Y.id,{x:T.x+q,y:T.y+W})}N.push(b)}for(const q of _){const W=u(q.id),{w:Y,h:T}=l(q.id);g.push({x:W.x,y:W.y,w:Y,h:T})}}return N}function oB(e,t,n,s,i,a=!1,l){const p=Pi+td+1,f=8,g=1.75,y=200,w=.7,N=.01,b=A=>dl(A,s,l),_=A=>n.get(A)??t.get(A),k=new Map;for(const A of e){if(!_(A.id))continue;const q=ul(A),W=k.get(q);W?W.push(A):k.set(q,[A])}const E=[],j=new Set,C=new Set,I=i.size===0;for(const A of[...k.keys()].sort()){const q=k.get(A);let W=1/0,Y=1/0,T=-1/0,Z=-1/0,U=!1;for(const J of q){const $=_(J.id),{w:G,h:Q}=b(J.id);W=Math.min(W,$.x),Y=Math.min(Y,$.y),T=Math.max(T,$.x+G),Z=Math.max(Z,$.y+Q),n.has(J.id)&&(U=!0)}const ne=T-W,X=Z-Y;C.add(A);const H=i.get(A);H&&(ne>H.w+f||X>H.h+f)&&j.add(A),i.set(A,{w:ne,h:X}),E.push({sid:A,members:q.map(J=>J.id),x:W,y:Y,w:ne,h:X,anchored:U,mass:1})}for(const A of[...i.keys()])C.has(A)||i.delete(A);if(a||I)return[];let P=!1;for(let A=0;A<E.length&&!P;A++)for(let q=A+1;q<E.length;q++){const W=E[A],Y=E[q];if(!(W.anchored&&Y.anchored)&&Math.abs(W.x+W.w/2-(Y.x+Y.w/2))<(W.w+Y.w)/2+61&&Math.abs(W.y+W.h/2-(Y.y+Y.h/2))<(W.h+Y.h)/2+p){P=!0;break}}if(j.size===0&&!P)return[];if(j.size>0)for(const A of E)j.has(A.sid)&&(A.mass=8);else for(const A of E)A.mass=Math.max(1,A.w*A.h/(Wi*Nu));const O=new Map(E.map(A=>[A.sid,A.x])),F=new Map(E.map(A=>[A.sid,A.y]));for(let A=0;A<y;A++){const q=new Map,W=new Map;let Y=0;for(let T=0;T<E.length;T++)for(let Z=T+1;Z<E.length;Z++){const U=E[T],ne=E[Z];if(U.anchored&&ne.anchored)continue;const X=U.x+U.w/2,H=U.y+U.h/2,J=ne.x+ne.w/2,$=ne.y+ne.h/2,G=(U.w+ne.w)/2+61-Math.abs(X-J),Q=(U.h+ne.h)/2+p-Math.abs(H-$);if(G<=0||Q<=0)continue;const D=(He,nt)=>!He.anchored&&!(nt<0&&He.x<=0),L=(He,nt)=>!He.anchored&&!(nt<0&&He.y<=0),K=(He,nt,Xe)=>{const _t=He===nt,Oe=_t?U.sid<ne.sid?-1:1:Math.sign(He-nt);return Xe(U,Oe)||Xe(ne,-Oe)?Oe:_t&&(Xe(U,-Oe)||Xe(ne,Oe))?-Oe:0},se=K(X,J,D),he=K(H,$,L),pe=se!==0,re=he!==0;if(!pe&&!re)continue;const ve=pe&&(!re||G*g<Q),[Te,$e,Me,_e]=ve?[se,G,q,D]:[he,Q,W,L],ae=_e(U,Te),we=_e(ne,-Te),be=U.mass,Ue=ne.mass,Ke=ae?we?Ue/(be+Ue):1:0,ut=we?ae?be/(be+Ue):1:0,ot=$e*w;Me.set(U.sid,(Me.get(U.sid)??0)+Te*ot*Ke),Me.set(ne.sid,(Me.get(ne.sid)??0)-Te*ot*ut),Y+=ot}for(const T of E)T.anchored||(T.x=Math.max(0,T.x+(q.get(T.sid)??0)),T.y=Math.max(0,T.y+(W.get(T.sid)??0)));if(Y<N)break}const M=[];for(const A of E){const q=A.x-O.get(A.sid),W=A.y-F.get(A.sid);if(!(Math.abs(q)<1&&Math.abs(W)<1)){for(const Y of A.members){if(n.has(Y))continue;const T=t.get(Y);T&&t.set(Y,{x:T.x+q,y:T.y+W})}M.push(A.sid)}}return M}const iB=600;function Yy(e,t){return!(e.exitAt!=null&&t-e.exitAt>iB||e.kind==="root"&&e.state==="done"&&e.tools.length===0&&e.endedAt!=null&&e.endedAt-e.startedAt<3e3)}function aB(e,t){const n=new Set;for(const s of e.agents.values())Yy(s,t)&&n.add(s.id);return n}function lB(e,t,n=0){return e.right+n>t.left&&e.left-n<t.right&&e.bottom+n>t.top&&e.top-n<t.bottom}function cB(e,t,n=0){if(!e)return!1;for(const s of t)if(lB(e,s,n))return!0;return!1}const DR="sessionGroup";function uB(e,t){var s;if(e.type===DR)return"transparent";const n=(s=e.data)==null?void 0:s.state;return t(n==="err"?"--err":n==="active"?"--inflight":"--ok")}const FR=["--err","--inflight","--ok","--grid-line","--minimap-mask","--panel","--line","--accent","--text-dim","--bg"];function pj(e){const t={};for(const n of FR)t[n]=e(n);return t}function dB(e){return t=>e[t]??""}function fB(e,t){return FR.every(n=>e[n]===t[n])}function hB(e){const t=new Set(e.pins),n=new Map,s=new Map;for(const[i,a]of e.positions)n.set(i,a),t.has(i)&&s.set(i,a);return{positions:n,pinned:s}}const pB=1200,mB=1e3;function mj(e){return e.lastDeckFitAt>0&&e.at-e.lastDeckFitAt<pB?!1:e.hasSourceEvent?!0:e.lastCanvasInputAt>0&&e.at-e.lastCanvasInputAt<mB}function py({durationMs:e,documentHidden:t}){return t?!1:Number.isFinite(e)&&e>0}function gB(e,t,n){const s=e.x*t.zoom+t.x,i=e.y*t.zoom+t.y,a=(e.x+e.width)*t.zoom+t.x,l=(e.y+e.height)*t.zoom+t.y;return a>0&&s<n.width&&l>0&&i<n.height}function vB({pane:e,viewport:t,boxes:n}){if(!e||!(e.width>0)||!(e.height>0)||!Number.isFinite(t.zoom)||t.zoom<=0||!Number.isFinite(t.x)||!Number.isFinite(t.y))return!1;let s=!1;for(const i of n)if(s=!0,gB(i,t,e))return!1;return s}const yB="Update checks are off (AGENTS_DECK_NO_UPDATE_CHECK=1)",my="click for what's new";function wB(e){if(e.checkDisabled)return`${yB} · ${my}`;if(e.checking)return`Asking npm for the newest release… · ${my}`;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",n=e.checkedAgo?` · checked ${e.checkedAgo}`:"";return`${t}${n} · re-checked periodically · ${my}, and to check npm now`}function xB(e){const t=`Version v${e.running}, show what's new`;return e.checkDisabled?`${t} — update checks are off`:e.checking?`${t} — checking npm for a newer release`:`${t} and check npm for a newer release`}function bB(e){const t=e.kind==="restart"?`v${e.to} is installed and waiting for a restart`:`v${e.to} is available on npm`,n=e.open?"show what's new":"show what's new and the notice";return`Version v${e.from}, ${t} — ${n}`}function _B(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 Ky={kind:"assumed",claude:!0,codex:!0};function kB(e){if(!e||typeof e!="object")return Ky;const t=e.providers;if(!t||typeof t!="object")return Ky;const n=t;return{kind:"reported",claude:n.claude!==!1,codex:n.codex!==!1}}function Eu(e){const t=Math.max(0,Math.floor(e));return`${t} event${t===1?"":"s"}`}const gj=99;function SB(e){const t=Math.max(0,Math.floor(e));return t>gj?`${gj}+`:String(t)}const NB="Pause the canvas";function EB(e){if(!e.paused)return"Pause live updates — events keep arriving and are applied when you resume (Space)";const t=Math.max(0,Math.floor(e.dropped??0));return t>0?`The pause is full — ${Eu(e.held)} held and ${t} older ${t===1?"one":"ones"} already dropped. Resume to follow the canvas again (Space)`:e.held<=0?"Nothing has arrived since you paused. Resume to follow the canvas again (Space)":`${Eu(e.held)} arrived while paused and will be applied in order when you resume (Space)`}function jB(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 zR="paused · full",CB=(e,t)=>t>0?zR:e>0?`paused · ${SB(e)}`:"paused";function TB(e){const t=Math.max(0,Math.floor(e.dropped??0));return e.connected?e.paused?{tone:"paused",resting:!1,label:CB(e.held,t),widest:zR,title:t>0?`Connected — the pause is full at ${Eu(e.held)}; the oldest are being dropped as new ones arrive. Resume to catch up (Space)`:e.held>0?`Connected — ${Eu(e.held)} held until you resume (Space)`:"Connected — updates held until you resume (Space)"}:{tone:"live",resting:!0,label:"live",widest:"live",title:"Receiving events"}:{tone:"dead",resting:!1,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 vj(e){return typeof window>"u"?"":getComputedStyle(document.documentElement).getPropertyValue(e).trim()||""}const RB={agent:KL,sessionGroup:d3},BR="react-flow__node";function yj(e){var t,n;return!!e&&((n=(t=e.classList)==null?void 0:t.contains)==null?void 0:n.call(t,BR))===!0}function AB(e){try{const t=document.querySelector(`.${BR}[data-id="${CSS.escape(e)}"]`);t==null||t.focus({preventScroll:!0})}catch{}}const MB=["a[href]","button:not(:disabled)","input:not(:disabled)","select:not(:disabled)","textarea:not(:disabled)","summary","[tabindex]"].join(","),IB=420,ru=18,OB=200,PB=5*6e4,$B=6,LB=2*6e4,wj=400,Kw="agent-dag.layout",Xw="agent-dag.viewport",UR="agent-dag.summariesDismissed",WR="agent-dag.sessionListOpen",HR="agent-dag.detailOpen",GR="agent-dag.usagePanelOpen",xj="agent-dag.accountsPanelOpen",gy="agent-dag.versionNoticeDismissed",bj="agent-dag.oldNameNoticeDismissed",qB=15*6e4,vy={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:"},_j="agent-dag.autoRestart",kj="agent-dag.bundleReloadedFor";function DB(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(WR)==="1"}catch{return!1}}function FB(e){if(!(typeof window>"u"))try{window.localStorage.setItem(WR,e?"1":"0")}catch{}}function zB(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(HR)==="1"}catch{return!1}}function BB(e){if(!(typeof window>"u"))try{window.localStorage.setItem(HR,e?"1":"0")}catch{}}function UB(){const e=$u(GR);return e===null?!0:e==="1"}function WB(e){if(!(typeof window>"u"))try{window.localStorage.setItem(GR,e?"1":"0")}catch{}}function HB(){if(typeof window>"u")return new Set;try{const e=window.localStorage.getItem(UR);if(!e)return new Set;const t=JSON.parse(e);return new Set(Array.isArray(t)?t.filter(n=>typeof n=="string"):[])}catch{return new Set}}function Sj(e){if(!(typeof window>"u"))try{const t=Array.from(e),n=t.length>200?t.slice(-200):t;window.localStorage.setItem(UR,JSON.stringify(n))}catch{}}function GB(){const e={positions:[],pins:[]};if(typeof window>"u")return e;try{const t=window.localStorage.getItem(Kw);if(!t)return e;const n=JSON.parse(t);if(!("v"in n)){const i=Object.entries(n).filter(([,a])=>a&&typeof a.x=="number"&&typeof a.y=="number");return{positions:i,pins:i.map(([a])=>a)}}return{positions:Object.entries(n.positions??{}).filter(([,i])=>i&&typeof i.x=="number"&&typeof i.y=="number"),pins:Array.isArray(n.pins)?n.pins:[]}}catch{return e}}function yy(e,t){if(!(typeof window>"u"))try{const n={};for(const[s,i]of e)n[s]=i;for(const[s,i]of t)n[s]=i;window.localStorage.setItem(Kw,JSON.stringify({v:2,positions:n,pins:Array.from(t.keys())}))}catch{}}function VB(){if(typeof window>"u")return null;try{const e=window.localStorage.getItem(Xw);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 YB(e){if(!(typeof window>"u"))try{window.localStorage.setItem(Xw,JSON.stringify(e))}catch{}}function Nj(){if(!(typeof window>"u")){try{window.localStorage.removeItem(Kw)}catch{}try{window.localStorage.removeItem(Xw)}catch{}}}function KB(e,t){const n=e.agents.get(t);if(!n)return;const s=[];for(const f of e.agents.values())f.sessionId===t&&s.push(f);const i={schemaVersion:1,exportedAt:new Date().toISOString(),sessionId:t,label:n.label,cwd:n.cwd,startedAt:n.startedAt,endedAt:n.endedAt,model:n.model,agents:s.map(f=>({id:f.id,kind:f.kind,label:f.label,parentId:f.parentId,state:f.state,startedAt:f.startedAt,endedAt:f.endedAt,model:f.model,cwd:f.cwd,usage:f.usage,prompts:f.prompts,tools:f.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(i,null,2),l=new Blob([a],{type:"application/json"}),u=URL.createObjectURL(l),h=document.createElement("a"),p=(n.label||"session").replace(/[^a-z0-9._-]/gi,"_");h.href=u,h.download=`${zt}-${p}-${t.slice(0,8)}.json`,document.body.appendChild(h),h.click(),document.body.removeChild(h),setTimeout(()=>URL.revokeObjectURL(u),1e3)}const Xy={file:"📁",shell:"⚡",web:"🌐",agent:"🤖",task:"📋",plan:"🧭",mcp:"🔌",other:"✨"},Qy={file:"file",shell:"shell",web:"web",agent:"agent",task:"task",plan:"plan",mcp:"mcp",other:"other"},VR=dT;function XB(e,t,n,s,i,a,l,u,h,p,f,g,y,w,N,b,_,k){const E=[],j=[];for(const A of e.agents.values()){if(!_.has(A.id))continue;const q=A.exitAt!=null,W=b!=null&&!b.has(A.id),Y=[q?"rf-exiting":"",W?"rf-spotlit-out":""].filter(Boolean).join(" ")||void 0,T=a.get(A.id);if(E.push({id:A.id,type:"agent",position:{x:0,y:0},data:{...A,now:t,onOpenContext:k},className:Y,...T?{width:T.width,height:T.height}:null}),A.parentId&&_.has(A.parentId)){const Z=yw(A.sessionId),U=q,ne=N.size>0&&(N.has(A.id)||N.has(A.parentId)),X=b!=null&&!b.has(A.id)&&!b.has(A.parentId),H=A.state==="active"?2:1.5,J=ne?H+1.5:H,$=U?.2:X?.12:1,G=["sess-edge",A.state==="active"?"sess-live":"sess-idle",U?"rf-edge-exiting":"",ne?"rf-edge-selected":""].filter(Boolean).join(" ");j.push({id:`e:${A.parentId}->${A.id}`,source:A.parentId,target:A.id,animated:(A.state==="active"||ne)&&!U,type:"smoothstep",style:{"--session-hue":Z,strokeWidth:J,opacity:$,transition:"var(--edge-transition)"},className:G})}}const C=new Map;for(const A of e.agents.values())A.tools.length>0&&C.set(A.id,Math.min(4,A.tools.length));const I=`${y}#lanes:${eB(C)}`,P=E.filter(A=>KD(A.id,i,f,g));if(P.length>0||I!==w.current){if(P.length>0){const A=nB(E,j,{direction:"LR",pinned:i,measured:a,availableWidth:n,availableHeight:s,lanes:C});for(const q of A)PT(q.id,f,g)&&QD(q.id,q.position,f,g);sB(E,f,i,a,new Set(P.map(q=>q.id)),C)}rB(E,f,i,a,C),w.current=I}const O=oB(E,f,i,a,l,!h||p,C);O.length>0&&u(O),Qc(f,e.agents),Qc(g,e.agents),Qc(i,e.agents),Qc(a,GD(e.agents.values()));const F=[];let M=!1;for(const A of E){let q=i.get(A.id)??f.get(A.id);q||(q=XD(A.id,f,g),M=!0),F.push({...A,position:q})}return M&&(w.current=""),{nodes:F,edges:j}}function QB(){return d.jsx(gw,{children:d.jsx(ZB,{})})}function ZB(){var ds,Bl,Xs,Ul;const e=gl(),t=Rt(),n=S.useState(Py)[0],s=S.useRef(n),[,i]=S.useState(0),a=S.useCallback(()=>i(z=>z+1),[]),[l,u]=S.useState(()=>new Set),[h,p]=S.useState(null),[f,g]=S.useState(null),y=S.useCallback((z,V)=>{u(ce=>{if(!V)return new Set([z]);const fe=new Set(ce);return fe.has(z)?fe.delete(z):fe.add(z),fe}),p(ce=>V&&ce===z?ce:z)},[]),w=S.useCallback(()=>{u(new Set),p(null)},[]),[N,b]=S.useState(null),[_,k]=S.useState(null),E=S.useCallback(z=>k(z),[]),[j,C]=S.useState(!1),[I,P]=S.useState(!1),O=S.useState(HB)[0],[F,M]=S.useState(DB);S.useEffect(()=>{FB(F)},[F]);const[A,q]=S.useState(zB);S.useEffect(()=>{BB(A)},[A]);const[W,Y]=S.useState(UB);S.useEffect(()=>{WB(W)},[W]);const[T,Z]=S.useState(()=>{try{const z=window.localStorage.getItem(xj);return z===null?!0:z==="1"}catch{return!0}});S.useEffect(()=>{try{window.localStorage.setItem(xj,T?"1":"0")}catch{}},[T]);const[U,ne]=S.useState(null);S.useEffect(()=>{let z=null;try{z=localStorage.getItem("agent-dag.sound")}catch{}ne(z===null?!0:z==="on")},[]);const X=S.useCallback(()=>{ne(z=>{var ce;const V=z!==!0;try{localStorage.setItem("agent-dag.sound",V?"on":"off")}catch{}return V&&((ce=ve.current)==null||ce.unlock()),V})},[]),H=S.useCallback(z=>{X()},[X]),J=S.useRef(H);J.current=H;const $=S.useRef(U);$.current=U;const[G,Q]=S.useState(()=>wD($u)),D=S.useRef(G);D.current=G;const L=S.useRef(null),K=S.useCallback((z,V=!1)=>{var ce,fe;if((ce=ve.current)==null||ce.unlock(),L.current!==null&&clearTimeout(L.current),L.current=null,!V){(fe=ve.current)==null||fe.play(z,!0);return}L.current=setTimeout(()=>{var ke;L.current=null,(ke=ve.current)==null||ke.play(z,!0)},pD)},[]),se=S.useCallback((z,V)=>{Q(ce=>{const fe={level:cl(V.level??ce[z].level),figure:RT(z,V.figure??ce[z].figure)};try{localStorage.setItem(MT[z],String(fe.level)),localStorage.setItem(IT[z],fe.figure)}catch{}return{...ce,[z]:fe}}),K(z,!0)},[K]);S.useEffect(()=>()=>{L.current!==null&&clearTimeout(L.current)},[]);const[he,pe]=S.useState(!1),re=S.useRef(null),ve=S.useRef(null),[Te,$e]=S.useState("locked");S.useEffect(()=>{const z=_D({enabled:()=>$.current===!0,prefs:()=>D.current,onState:$e});ve.current=z,$e(z.state());const V=()=>z.unlock();return window.addEventListener("pointerdown",V,{once:!0,capture:!0}),window.addEventListener("keydown",V,{once:!0,capture:!0}),()=>{window.removeEventListener("pointerdown",V,{capture:!0}),window.removeEventListener("keydown",V,{capture:!0})}},[]);const[Me,_e]=S.useState(!1),[ae,we]=S.useState(null),[be,Ue]=S.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(gy)??""}catch{return""}}),[Ke,ut]=S.useState(!1),ot=S.useRef(0),[He,nt]=S.useState(!1),Xe=S.useCallback((z=!1)=>(z&&(ot.current=Date.now(),nt(!0)),fetch(z?"/api/version?refresh=1":"/api/version").then(V=>V.ok?V.json():null).then(V=>{V&&we(V)}).catch(()=>{}).finally(()=>{z&&nt(!1)})),[]),_t=S.useCallback(()=>{Xe(Date.now()-ot.current>=qB)},[Xe]);S.useEffect(()=>{Xe();const z=window.setInterval(_t,5*6e4),V=()=>{document.visibilityState==="visible"&&_t()};return document.addEventListener("visibilitychange",V),()=>{window.clearInterval(z),document.removeEventListener("visibilitychange",V)}},[Xe,_t]),S.useEffect(()=>{Me&&Xe()},[Me,Xe]);const Oe=(ae==null?void 0:ae.notice)??null,[it,Mt]=S.useState(null),le=S.useRef(!1);S.useEffect(()=>{if(le.current)return;const z=ID(),V=OD(z),ce=LD({stored:V,running:(ae==null?void 0:ae.running)??null,notes:D1,remembers:PD(z)});ce.reason!=="no-version"&&(le.current=!0,ce.record&&$D(z,ce.record),ce.show.length&&Mt({entries:ce.show,since:V,firstRun:ce.reason==="welcome"}))},[ae==null?void 0:ae.running]);const Le=(ae==null?void 0:ae.running)??"3.3.0",Fe=S.useMemo(()=>OT(D1,null,Le),[Le]),Ee=S.useCallback(()=>{Mt({entries:Fe,since:null,firstRun:!1})},[Fe]),[Ge,Et]=S.useState(null),[tt,Re]=S.useState(Ky);S.useEffect(()=>{let z=!1;return fetch("/api/health").then(V=>V.ok?V.json():null).then(V=>{z||(Re(kB(V)),!(!V||typeof V.workspace!="string")&&Et(V.workspace))}).catch(()=>{}),()=>{z=!0}},[Me]);const wt=S.useRef(tt);wt.current=tt;const lt=Oe?`${Oe.kind}:${Oe.to}`:"",kt=Oe!=null&&be!==lt,Nn=S.useCallback(()=>{Ue("");try{window.localStorage.setItem(gy,"")}catch{}},[]),zn=S.useCallback(()=>{if(Oe){Ue(lt);try{window.localStorage.setItem(gy,lt)}catch{}}},[Oe,lt]),[En,jo]=S.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(bj)??""}catch{return""}}),mn=ae!=null&&ae.invokedAs&&ae.invokedAs!==zt?ae.invokedAs:null,Co=mn!=null&&En!==mn,To=S.useCallback(()=>{if(mn){jo(mn);try{window.localStorage.setItem(bj,mn)}catch{}}},[mn]),Bt=((ds=ae==null?void 0:ae.upgrade)==null?void 0:ds.state)??"idle",Cr=X4(ae==null?void 0:ae.upgrade),Bn=S.useRef(!1),Ps=S.useCallback(async()=>{if(ar(Bn.current||Bt==="running")){Bn.current=!0;try{await fetch("/api/upgrade",{method:"POST"})}catch{}await Xe(),Bn.current=!1}},[Bt,Xe]);S.useEffect(()=>{if(Bt!=="running")return;const z=window.setInterval(Xe,3e3);return()=>window.clearInterval(z)},[Bt,Xe]);const Tr=S.useCallback(async()=>{var ce;const z=ae==null?void 0:ae.command;if(!z)return;let V=!1;try{V=await Promise.race([((ce=navigator.clipboard)==null?void 0:ce.writeText(z).then(()=>!0))??Promise.resolve(!1),new Promise(fe=>window.setTimeout(()=>fe(!1),500))])}catch{V=!1}if(!V)try{const fe=document.createElement("textarea");fe.value=z,fe.setAttribute("readonly",""),fe.style.cssText="position:fixed;top:0;left:0;opacity:0",document.body.appendChild(fe),fe.select(),V=document.execCommand("copy"),fe.remove()}catch{V=!1}V&&(ut(!0),window.setTimeout(()=>ut(!1),1600))},[ae==null?void 0:ae.command]),Qi=S.useCallback(()=>{M(z=>(z||Z(!1),!z))},[]),fr=S.useCallback(()=>{Z(z=>(z||M(!1),!z))},[]),[Rr,hr]=S.useState(!1),[es,Ro]=S.useState(!1),[Ao,Mo]=S.useState(()=>{try{return Number(localStorage.getItem(U1))||0}catch{return 0}}),[jn,Io]=S.useState([]),[Ar,Oo]=S.useState(!1);S.useEffect(()=>{let z=!0;const V=()=>{fetch("/api/browser-watch?live=0").then(fe=>fe.ok?fe.json():null).then(fe=>{var ke;!z||!(fe!=null&&fe.ok)||(Io(fe.episodes??[]),Oo(((ke=fe.settings)==null?void 0:ke.enabled)===!0))}).catch(()=>{})};V();const ce=setInterval(V,5*6e4);return()=>{z=!1,clearInterval(ce)}},[]);const Un=S.useMemo(()=>N5(jn,Ao).length,[jn,Ao]),[Po,$s]=S.useState(0),Ls=S.useRef(null),[$o,Lo]=S.useState(!1),rt=S.useRef(null),[Zi,ts]=S.useState(0),Gt=S.useState(()=>n5({protect:z=>cL(s.current,z)}))[0],[Wn,qo]=S.useState(!1),ns=S.useCallback(()=>{const z=Gt.paused&&Gt.dropped>0,V=Gt.setPaused(!Gt.paused);z&&uL(s.current);for(const ce of V)s.current=Xb(s.current,ce);qo(Gt.paused)},[Gt]),[pt,sn]=S.useState(Date.now()),[Hn,gn]=S.useState(()=>{if(typeof window>"u")return!0;try{return window.localStorage.getItem(_j)!=="0"}catch{return!0}}),nd=S.useCallback(()=>{gn(z=>{const V=!z;try{window.localStorage.setItem(_j,V?"1":"0")}catch{}return V})},[]),[Mr,Do]=S.useState(!1),[Fo,zo]=S.useState("restart"),[rs,qs]=S.useState(null),ss=S.useRef(!1),jl=S.useRef(null),Bo=S.useRef(0),Ds=S.useCallback(async z=>{if(!ar(ss.current))return;const V=(z==null?void 0:z.upgrade)===!0;ss.current=!0,jl.current=Cr;const ce=++Bo.current;zo(V?"npx":"restart"),Do(!0);try{window.sessionStorage.setItem("agent-dag.restartPending",(Oe==null?void 0:Oe.to)??"")}catch{}try{await fetch("/api/restart",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({upgrade:V})})}catch{}window.setTimeout(()=>{if(Bo.current===ce&&ss.current){ss.current=!1,Do(!1);try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}}},V?18e4:3e4)},[Oe==null?void 0:Oe.to,Cr]),Uo=S.useRef(null);S.useEffect(()=>{let z=!1;for(const ce of s.current.agents.values())if(ce.state==="active"){z=!0;break}const V=Z4({enabled:Hn,kind:Oe==null?void 0:Oe.kind,canRestart:(ae==null?void 0:ae.canRestart)===!0,busy:z,idleSince:Uo.current,now:pt});Uo.current=V.idleSince,V.restart&&Ds()},[Hn,Oe==null?void 0:Oe.kind,ae==null?void 0:ae.canRestart,pt,Ds]),S.useEffect(()=>{const z=ae==null?void 0:ae.running;let V=null,ce=null;try{V=window.sessionStorage.getItem("agent-dag.restartPending"),ce=window.sessionStorage.getItem(kj)}catch{return}const fe=K4({bundle:"3.3.0",running:z,pending:V,lastTried:ce});if(fe==="reload"){try{window.sessionStorage.setItem(kj,z??"")}catch{return}window.location.reload();return}if(fe!=="confirm")return;try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}ss.current=!1,Do(!1),qs(z??null);const ke=window.setTimeout(()=>qs(null),6e3);return()=>window.clearTimeout(ke)},[ae==null?void 0:ae.running]),S.useEffect(()=>{if(Mr&&Q4({asked:jl.current,reported:Cr})){try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}ss.current=!1,Do(!1)}},[Mr,Cr]);const os=S.useState(()=>hB(GB()))[0],Jt=S.useRef(os.pinned),is=S.useRef(null),Qe=S.useState(()=>VB())[0],[Ji,Cl]=S.useState(()=>new Set),[Ir,ea]=S.useState(s5),[Gn,Tl]=S.useState(()=>pj(vj)),Wo=S.useMemo(()=>dB(Gn),[Gn]),Ho=S.useCallback(z=>uB(z,Wo),[Wo]),pr=S.useMemo(()=>({background:Gn["--panel"],border:`1px solid ${Gn["--line"]}`,borderRadius:8}),[Gn]),[Vn,mr]=S.useState(!1);S.useEffect(()=>{document.documentElement.dataset.theme=Ir;try{window.localStorage.setItem($T,Ir)}catch{}Tl(z=>{const V=pj(vj);return fB(z,V)?z:V})},[Ir]);const vn=S.useCallback((z,V)=>{if(py({durationMs:V,documentHidden:document.hidden})){e.setViewport(z,{duration:V});return}const{d3Zoom:ce,d3Selection:fe}=t.getState(),ke=fe==null?void 0:fe.property("__zoom");if(ce&&fe&&ke&&ke.k>0&&z.zoom>0){ce.transform(fe,ke.scale(z.zoom/ke.k).translate((z.x-ke.x)/z.zoom,(z.y-ke.y)/z.zoom));return}e.setViewport(z,{duration:0})},[e,t]),Yn=S.useRef(null);S.useEffect(()=>{if(!Qe)return;const z=window.setTimeout(()=>{try{vn(Qe,0)}catch{}Xn.current=Date.now()},60);return()=>window.clearTimeout(z)},[vn,Qe]);const Kn=S.useRef(!0);S.useEffect(()=>{const z=new EventSource("/events"),V=e5(a,{now:()=>Date.now(),setTimeout:(ce,fe)=>window.setTimeout(ce,fe),clearTimeout:ce=>window.clearTimeout(ce)});return z.addEventListener("open",()=>{_e(!0),mr(!0)}),z.addEventListener("error",()=>_e(!1)),z.addEventListener("replay-end",()=>{Kn.current=!1,V.flush()}),z.addEventListener("hook",ce=>{var fe;try{const ke=JSON.parse(ce.data);if(!Gt.accept(ke))return;s.current=Xb(s.current,ke);const Ce=ke.replay===!0||Kn.current||Date.now()-ke.receivedAt>3e4;Ce?V.replay():V.live();const Be=bD(ke,Ce);Be&&((fe=ve.current)==null||fe.play(Be))}catch{}}),()=>{z.close(),V.cancel()}},[a]),S.useEffect(()=>{const z=setInterval(()=>{const V=Date.now();sn(V);let ce=dL(s.current,V,Kb);fL(s.current,V,Kb)&&(ce=!0),aL(s.current,V,OB,PB)&&(ce=!0),lL(s.current,V,$B,LB)&&(ce=!0),u(fe=>HD(fe,s.current.agents)),p(fe=>fe!=null&&!s.current.agents.has(fe)?null:fe),ce&&a()},250);return()=>clearInterval(z)},[a]);const ta=S.useRef(null),Xn=S.useRef(0),Fs=420,Cn=S.useCallback((z=500)=>{try{const Ce=document.querySelector(".canvas-wrap"),Be=Array.from(document.querySelectorAll(".react-flow__node")).filter(dt=>dt.offsetWidth>0);if(!Ce||Be.length===0)return;const Je=Ce.getBoundingClientRect(),mt=e.getViewport();if(!Number.isFinite(mt.zoom)||mt.zoom<=0)return;const at=dt=>(dt-Je.left-mt.x)/mt.zoom,on=dt=>(dt-Je.top-mt.y)/mt.zoom,Yt=Be.map(dt=>dt.getBoundingClientRect()),fs=Math.min(...Yt.map(dt=>at(dt.left))),Wl=Math.max(...Yt.map(dt=>at(dt.right))),ma=Math.min(...Yt.map(dt=>on(dt.top))),Hl=Math.max(...Yt.map(dt=>on(dt.bottom))),ga=Wl-fs,Qs=Hl-ma;if(!(ga>0&&Qs>0))return;const Zs=Math.max(.2,Math.min(1,(Je.width-160)/(ga+Fs)*.86,(Je.height-160)/Qs*.86)),Js={x:80-fs*Zs,y:Math.max(80,(Je.height-Qs*Zs)/2)-ma*Zs,zoom:Zs};vn(Js,z),Xn.current=Date.now(),Yn.current=py({durationMs:z,documentHidden:document.hidden})?{target:Js,until:Date.now()+z+60}:null,window.setTimeout(()=>{var dt;try{((dt=Yn.current)==null?void 0:dt.target)===Js&&(Yn.current=null);const ei=e.getViewport();(Math.abs(ei.zoom-Zs)>.01||Math.abs(ei.x-Js.x)>2)&&vn(Js,0)}catch{}},z+60)}catch{}},[e,vn]);S.useEffect(()=>{const z=()=>{if(!document.hidden)return;const V=Yn.current;if(Yn.current=null,!(!V||Date.now()>V.until)){try{vn(V.target,0)}catch{}Xn.current=Date.now()}};return document.addEventListener("visibilitychange",z),()=>document.removeEventListener("visibilitychange",z)},[vn]);const Go=S.useRef(""),as=S.useRef(null),na=S.useRef(0),Vo=S.useCallback(()=>{na.current=Date.now()},[]),Or=S.useRef(null),ls=S.useRef(0),gr=S.useCallback(()=>{ls.current=Date.now()},[]),zs=S.useCallback(z=>({hasSourceEvent:!!z,at:Date.now(),lastDeckFitAt:Xn.current,lastCanvasInputAt:ls.current}),[]),ra="agent-dag.autoFitDisabled",Rl=S.useState(()=>{if(typeof window>"u")return!1;try{return window.localStorage.getItem(ra)==="1"}catch{return!1}})[0],vr=S.useRef(Rl),[Bs,Yo]=S.useState(Rl),Ko=S.useCallback(()=>{if(!vr.current){vr.current=!0,Yo(!0);try{window.localStorage.setItem(ra,"1")}catch{}}},[]),yr=S.useCallback(()=>{vr.current=!1,Yo(!1);try{window.localStorage.removeItem(ra)}catch{}Cn(400)},[e,Cn]);S.useEffect(()=>{const z=setInterval(()=>{if(vr.current||Date.now()-na.current<800)return;const V=s.current,ce=Date.now(),fe=[];for(const Ce of V.agents.values())Yy(Ce,ce)&&fe.push({id:Ce.id});if(fe.length===0)return;const ke=[];for(const{id:Ce}of fe){const Be=Qn.current.get(Ce),Je=Jt.current.get(Ce)??It.current.get(Ce);!Be||!Je||ke.push({x:Je.x,y:Je.y,width:Be.width,height:Be.height})}vB({pane:Or.current,viewport:e.getViewport(),boxes:ke})&&Cn(600)},1500);return()=>clearInterval(z)},[e]);const Us=S.useRef(!1),Qn=S.useRef(new Map),sa=S.useRef(0),Xo=S.useCallback(z=>{const V=Qn.current;let ce=!1;for(const fe of z.nodeInternals.values()){const ke=fe.width,Ce=fe.height;if(ke==null||Ce==null)continue;const Be=V.get(fe.id);Be?(Math.abs(Be.height-Ce)>4||Math.abs(Be.width-ke)>4)&&(V.set(fe.id,{width:ke,height:Ce}),ce=!0):(V.set(fe.id,{width:ke,height:Ce}),ce=!0)}return ce&&(sa.current+=1),sa.current},[]),Ws=st(Xo),[oa,en]=S.useState(0);S.useEffect(()=>{let z=0;const V=()=>{const fe=Qn.current;let ke=!1;for(const Ce of document.querySelectorAll(".react-flow__node[data-id]")){const Be=Ce.getAttribute("data-id");if(!Be)continue;const Je=Ce.offsetWidth,mt=Ce.offsetHeight;if(!Je||!mt)continue;const at=fe.get(Be);(!at||Math.abs(at.width-Je)>4||Math.abs(at.height-mt)>4)&&(fe.set(Be,{width:Je,height:mt}),ke=!0)}ke&&en(Ce=>Ce+1)};if(Us.current)return;let ce=0;return document.visibilityState==="hidden"?ce=window.setTimeout(V,32):z=requestAnimationFrame(V),()=>{cancelAnimationFrame(z),window.clearTimeout(ce)}});const It=S.useRef(os.positions),ia=S.useRef(new Set),Pr=S.useRef(""),cs=S.useMemo(()=>{const z=[];for(const V of s.current.agents.values())Yy(V,pt)&&z.push(V.id+(V.parentId?`>${V.parentId}`:""));return z.sort(),`${z.join("|")}#sv${Ws}.${oa}`},[s.current,s.current.revision,pt,Ws,oa]),$r=S.useRef(null);S.useEffect(()=>($r.current!=null&&window.clearTimeout($r.current),$r.current=window.setTimeout(()=>{yy(It.current,Jt.current)},1500),()=>{$r.current!=null&&window.clearTimeout($r.current)}),[cs]),S.useEffect(()=>{if(Go.current===cs)return;const z=Go.current;if(Go.current=cs,!z||vr.current)return;Date.now()-Xn.current>1200&&Cn(400),ta.current&&window.clearTimeout(ta.current),ta.current=window.setTimeout(()=>{vr.current||Cn(500)},280)},[cs,e,Cn]);const Hs=S.useMemo(()=>YD(s.current,l),[s.current,s.current.revision,l]),Lr=S.useMemo(()=>aB(s.current,pt),[s.current,s.current.revision,pt]),Gs=S.useRef(null),[Vs,Al]=S.useState({w:0,h:0});S.useEffect(()=>{const z=Gs.current;if(!z||typeof ResizeObserver>"u")return;const V=new ResizeObserver(ce=>{var ke;const fe=(ke=ce[0])==null?void 0:ke.contentRect;fe&&(Or.current={width:fe.width,height:fe.height},Al(Ce=>Math.abs(Ce.w-fe.width)>40||Math.abs(Ce.h-fe.height)>40?{w:fe.width,h:fe.height}:Ce))});return V.observe(z),Or.current={width:z.clientWidth,height:z.clientHeight},Al({w:z.clientWidth,h:z.clientHeight}),()=>V.disconnect()},[]);const rd=S.useCallback(z=>{var ce,fe;const V=z.target;!(V!=null&&V.closest)||V.closest(MB)!==z.currentTarget||(z.preventDefault(),(fe=(ce=document.activeElement)==null?void 0:ce.blur)==null||fe.call(ce))},[]),sd=S.useRef(new Map),[Qo,od]=S.useState(!1);S.useEffect(()=>{const z=window.setTimeout(()=>od(!0),2500);return()=>window.clearTimeout(z)},[]);const[id,aa]=S.useState(!1),wr=S.useRef(null),[la,ca]=S.useState(!1),ad=S.useCallback(()=>{wr.current&&(window.clearTimeout(wr.current),wr.current=null),aa(!1)},[]),ld=S.useCallback(z=>{z.length!==0&&queueMicrotask(()=>{aa(!0),wr.current&&window.clearTimeout(wr.current),wr.current=window.setTimeout(()=>aa(!1),IB+80)})},[]);S.useEffect(()=>()=>{wr.current&&window.clearTimeout(wr.current)},[]);const Ml=Vs.w>0?Vs.w*.92:0,Il=Vs.h>0?Vs.h:0,{nodes:Tn,edges:cd}=S.useMemo(()=>XB(s.current,pt,Ml,Il,Jt.current,Qn.current,sd.current,ld,Qo,la,It.current,ia.current,cs,Pr,l,Hs,Lr,E),[s.current,s.current.revision,pt,Ml,Il,Qo,la,cs,l,Hs,Lr,E,Po]),Ol=S.useMemo(()=>{const z=new Map;for(const ce of Tn){const fe=ce.data;if(!(fe!=null&&fe.sessionId)||fe.exitAt!=null)continue;const ke=ce.width,Ce=ce.height;if(ke==null||Ce==null)continue;const Be=ce.position.x,Je=ce.position.y,mt=Be+ke,at=Je+Ce,on=z.get(fe.sessionId);on?(on.minX=Math.min(on.minX,Be),on.minY=Math.min(on.minY,Je),on.maxX=Math.max(on.maxX,mt),on.maxY=Math.max(on.maxY,at)):z.set(fe.sessionId,{minX:Be,minY:Je,maxX:mt,maxY:at})}const V=[];for(const[ce,fe]of z){const ke=fe.maxX-fe.minX+ru*2,Ce=fe.maxY-fe.minY+ru*2;V.push({id:`group:${ce}`,type:DR,position:{x:fe.minX-ru,y:fe.minY-ru},data:{sessionId:ce,w:ke,h:Ce},width:ke,height:Ce,style:{width:ke,height:Ce},zIndex:-1,draggable:!0,selectable:!1,focusable:!1,deletable:!1,connectable:!1})}return V},[Tn,pt]),ud=S.useMemo(()=>{const z=[...Ol,...Tn],V=rt.current;return!V||V.size===0?z:z.map(ce=>{const fe=V.get(ce.id);return fe?{...ce,position:fe}:ce})},[Ol,Tn,Zi]),Ys=S.useMemo(()=>{const z=new Set;for(const V of s.current.agents.values())for(const ce of V.tools)z.add(VR(ce.name));return Object.keys(Xy).filter(V=>z.has(V))},[s.current,s.current.revision]);S.useEffect(()=>{if(Ys.length<=1){Lo(!1);return}let z=0;const V=()=>{const ce=Ls.current;if(ce&&!document.hidden){const fe=ce.getBoundingClientRect(),ke=Array.from(document.querySelectorAll(".react-flow__node, .tool-burst")).map(Be=>Be.getBoundingClientRect()),Ce=cB(fe,ke,8);Lo(Be=>Be===Ce?Be:Ce)}z=window.setTimeout(V,300)};return V(),()=>window.clearTimeout(z)},[Ys.length]);const dd=S.useCallback(z=>{Cl(V=>{const ce=new Set(V);return ce.has(z)?ce.delete(z):ce.add(z),ce})},[]),tn=h?s.current.agents.get(h):null,ua=f?Array.from(s.current.agents.values()).flatMap(z=>z.tools).find(z=>z.id===f)??null:null,Pl=S.useCallback(async()=>{try{await fetch("/api/clear",{method:"POST"})}catch{}s.current=Py(),Jt.current.clear(),Qn.current.clear(),It.current.clear(),Pr.current="",Nj(),w(),a()},[a,w]),$l=S.useRef(j);$l.current=j;const Ll=S.useRef(I);Ll.current=I;const da=S.useRef(!1);da.current=ua!=null||Rr||_!=null||N!=null||es||I||it!=null;const us=S.useCallback(z=>{const V=J4(z,{confirmOpen:$l.current,modalOpen:da.current});V==="confirm"?C(!0):V==="clear"&&(C(!1),Pl())},[Pl]),qr=S.useCallback(()=>{Jt.current.clear(),It.current.clear(),Pr.current="",Nj(),a(),window.setTimeout(()=>Cn(500),80)},[a,e,Cn]),ql=S.useCallback(()=>Cn(500),[Cn]),Ks=S.useRef(Tn);Ks.current=Tn;const fa=S.useRef(h);fa.current=h;const Zo=S.useCallback(z=>{const V=Ks.current,ce=FD(V.map(Ce=>({id:Ce.id,x:Ce.position.x,y:Ce.position.y})),fa.current,z),fe=ce?V.find(Ce=>Ce.id===ce):void 0;if(!fe)return;const ke=yj(document.activeElement);y(fe.id,!1),window.setTimeout(()=>{try{e.fitView({padding:.35,duration:350,nodes:[fe]})}catch{}Xn.current=Date.now(),ke&&AB(fe.id)},30)},[y,e]),ha=S.useCallback(z=>{y(z,!1),window.setTimeout(()=>{try{const V=Ks.current.find(ce=>ce.id===z);V&&e.fitView({padding:.3,duration:500,nodes:[V]}),Xn.current=Date.now()}catch{}},60)},[y,e]);S.useEffect(()=>{const z=V=>{var Je,mt;const ce=V.target,fe={tagName:ce==null?void 0:ce.tagName,isContentEditable:ce==null?void 0:ce.isContentEditable,role:(Je=ce==null?void 0:ce.getAttribute)==null?void 0:Je.call(ce,"role"),type:ce==null?void 0:ce.type};if(V.key==="Escape"){const at=ML({overlayOpen:Ii.depth()>0,panelOnTop:Ii.topIsPanel(),typing:bw(fe)});at==="dismiss"?Ii.dismissTop():at==="blur"?ce==null||ce.blur():(WD(fe)&&(ce==null||ce.blur()),w());return}if(xw(V))return;const ke=yj(ce)?(mt=ce==null?void 0:ce.getAttribute)==null?void 0:mt.call(ce,"data-id"):null,Ce=ke&&Ks.current.some(at=>at.id===ke)?ke:null,Be=BD(V,Ce);if(Be.kind==="activate"){V.preventDefault(),y(Be.nodeId,Be.additive);return}Be.kind!=="node"&&(Be.nodeId==null&&FL(fe)||zL({key:V.key,modalOpen:da.current,sheetOpen:Ll.current})||(V.key===" "&&(V.preventDefault(),ns()),(V.key==="c"||V.key==="C")&&us("shortcut"),(V.key==="r"||V.key==="R")&&qr(),(V.key==="f"||V.key==="F")&&ql(),(V.key==="l"||V.key==="L")&&Qi(),(V.key==="h"||V.key==="H")&&hr(at=>!at),(V.key==="u"||V.key==="U")&&Y(at=>!at),(V.key==="a"||V.key==="A")&&wt.current.claude&&fr(),(V.key==="j"||V.key==="J")&&Zo(1),(V.key==="k"||V.key==="K")&&Zo(-1),(V.key==="t"||V.key==="T")&&ea(at=>at==="dark"?"light":"dark"),(V.key==="m"||V.key==="M")&&wt.current.claude&&$.current!==null&&J.current(V.shiftKey),V.key==="?"&&P(at=>!at)))};return window.addEventListener("keydown",z),()=>window.removeEventListener("keydown",z)},[us,qr,ql,w,y,Zo,ns]);const Jo=s.current.agents.size,Vt=S.useMemo(()=>Q3(s.current.agents.values()),[s.current,s.current.revision]),Dl=S.useMemo(()=>Z3(s.current.agents.values()),[s.current,s.current.revision]),Fl=S.useRef(null);S.useEffect(()=>{const z=o5({waiting:Vt.length,running:Dl,connected:Me}),V=Fl.current;if(Fl.current=z,(V==null?void 0:V.title)!==z.title&&(document.title=z.title),(V==null?void 0:V.icon)!==z.icon){const ce=document.querySelector('link[rel="icon"]');ce&&(ce.href=i5[z.icon])}},[Vt.length,Dl,Me]);const[fd,zl]=S.useState(""),pa=l5(Vt);S.useEffect(()=>{zl(z=>c5(z,pa))},[pa]);const Lt=S.useMemo(()=>gT(s.current.agents.values()),[s.current,s.current.revision]);return d.jsxs("div",{className:"app",children:[d.jsx("a",{className:"skip-link",href:"#canvas",children:"Skip to the canvas"}),d.jsxs("header",{className:"topbar",children:[d.jsxs("div",{className:"readout",children:[d.jsxs("div",{className:"brand",children:[d.jsx("span",{className:"logo"}),d.jsx("h1",{children:zt}),Oe?d.jsxs("button",{type:"button",className:"v stale",onClick:()=>{Ee(),Nn()},"aria-haspopup":"dialog","aria-label":bB({...Oe,open:kt}),title:Oe.kind==="restart"?`Running v${Oe.from}; v${Oe.to} is installed on disk. Restart to pick it up · click for what's new`:`Running v${Oe.from}; v${Oe.to} is on npm · click for what's new`,children:["v",Oe.from,d.jsx("span",{className:"v-dot","aria-hidden":!0})]}):(()=>{const z={running:Le,latest:ae==null?void 0:ae.latest,latestPending:ae==null?void 0:ae.latestPending,checkedAgo:ae!=null&&ae.checkedAt?Fy(pt-ae.checkedAt):null,checkDisabled:ae==null?void 0:ae.checkDisabled,checking:He};return d.jsxs("button",{type:"button",className:He?"v checking":"v",onClick:()=>{Ee(),Xe(!0)},"aria-busy":He||void 0,"aria-haspopup":"dialog","aria-label":xB(z),title:wB(z),children:["v",z.running]})})()]}),d.jsxs("span",{className:"status",children:[(()=>{const z=TB({connected:Me,paused:Wn,held:Gt.size,dropped:Gt.dropped});return z.resting?null:d.jsx("span",{className:`pill ${z.tone}`,title:z.title,children:d.jsxs("span",{className:"pill-box",children:[d.jsx("span",{className:"pill-widest","aria-hidden":!0,children:z.widest}),d.jsx("span",{className:"pill-label",children:z.label})]})})})(),d.jsx(Wq,{usageOpen:W}),Lt.sum>0&&d.jsxs("span",{className:"stat",title:`in:${Lt.inputTokens.toLocaleString()} out:${Lt.outputTokens.toLocaleString()} cache-r:${Lt.cacheReadTokens.toLocaleString()} cache-c:${Lt.cacheCreateTokens.toLocaleString()}
|
|
156
|
+
|
|
157
|
+
${Za}`,children:[d.jsx("span",{className:"count",children:Ct(Lt.sum)}),d.jsx("span",{className:"lbl",children:V3})]}),Lt.cost.total>0&&(()=>{let z=0,V=0;for(const ke of s.current.agents.values()){if(ke.state!=="active")continue;const Ce=_n(ke);z+=Ce.total,V=Math.max(V,((ke.endedAt??pt)-ke.startedAt)/1e3)}const ce=V>0?xu(z,V):null,fe=`input ${We(Lt.cost.input)} + output ${We(Lt.cost.output)} + cache r ${We(Lt.cost.cacheRead)} + cache w ${We(Lt.cost.cacheWrite)}${ce?`
|
|
158
|
+
active burn: ${ce}`:""}
|
|
159
|
+
|
|
160
|
+
${Za}`;return d.jsxs("span",{className:"stat",title:fe,children:[d.jsx("span",{className:"count",children:We(Lt.cost.total)}),d.jsxs("span",{className:"lbl",children:[Y3,ce?` · ${ce}`:""]})]})})()]}),d.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:fd}),Vt.length>0&&d.jsxs("button",{type:"button",className:"waiting-stat",onClick:()=>ha(Vt[0].id),title:`Blocked waiting for you — click to go to the one that has been stuck longest:
|
|
161
|
+
${Vt.map(z=>` ${z.label}: ${Pu(z.waiting)} (${Fy(pt-z.waiting.since)})`).join(`
|
|
162
|
+
`)}`,"aria-label":`${Vt.length} session${Vt.length===1?"":"s"} waiting for you`,children:[d.jsx("span",{className:"ap-pulse","aria-hidden":!0}),d.jsx("b",{children:Vt.length})," waiting"]})]}),tn&&(()=>{const z=_n(tn),V=Math.max(0,((tn.endedAt??pt)-tn.startedAt)/1e3),ce=tn.state==="active"?xu(z.total,V):null,fe=l.size-1;return d.jsxs("button",{type:"button",className:"selected-ribbon",title:`Fit view to ${tn.label}`,onClick:()=>{try{const ke=Tn.find(Ce=>Ce.id===tn.id);ke&&e.fitView({padding:.35,duration:500,nodes:[ke]}),Xn.current=Date.now()}catch{}},children:[d.jsx("span",{className:`state-pill state-${tn.state}`,children:tn.state==="active"?"live":tn.state}),d.jsx("span",{className:"selected-label",children:tn.label}),z.total>0&&d.jsxs("span",{className:"selected-cost",children:[We(z.total),ce?d.jsxs("span",{className:"selected-rate",children:[" · ",ce]}):null]}),fe>0&&d.jsxs("span",{className:"selected-extra",children:["+",fe]}),d.jsx("span",{"aria-hidden":!0,className:"selected-close",onClick:ke=>{ke.stopPropagation(),w()},children:"×"})]})})(),d.jsxs("div",{className:"actions",children:[d.jsxs("div",{className:"action-run",children:[d.jsx("button",{className:"btn icon-btn",onClick:()=>Y(z=>!z),title:`${W?"Hide":"Show"} usage panel (U)`,"aria-label":"Toggle usage panel","aria-expanded":W,"aria-controls":W?"usage-panel":void 0,children:"$"}),tt.claude&&d.jsx("button",{className:"btn icon-btn",onClick:fr,title:`${T?"Hide":"Show"} accounts (A)`,"aria-label":"Toggle accounts panel","aria-expanded":T,"aria-controls":T?"accounts-panel":void 0,children:d.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:[d.jsx("circle",{cx:"7",cy:"4.6",r:"2.4"}),d.jsx("path",{d:"M2.4 12c0-2.3 2.1-3.7 4.6-3.7s4.6 1.4 4.6 3.7"})]})}),d.jsx("button",{className:"btn icon-btn",onClick:()=>hr(z=>!z),title:"Usage history — ccusage (H)","aria-label":"Open usage history","aria-haspopup":"dialog",children:d.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round","aria-hidden":!0,children:[d.jsx("line",{x1:"3",y1:"11.5",x2:"3",y2:"7"}),d.jsx("line",{x1:"7",y1:"11.5",x2:"7",y2:"3"}),d.jsx("line",{x1:"11",y1:"11.5",x2:"11",y2:"8.5"})]})}),d.jsxs("button",{className:`btn icon-btn bw-btn${Un>0?" has-findings":Ar?" watching":""}`,onClick:()=>Ro(z=>!z),title:Ar?"Browser watch — watching; the deck is keeping its own copy":"Browser watch — not watching; reading the browser's history live","aria-label":`Browser watch, ${Ar?"watching":"not watching"}`+(Un>0?`, ${Un} unread`:""),"aria-haspopup":"dialog",children:[d.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5","aria-hidden":!0,children:[d.jsx("path",{d:"M0.9 7s2.2-4 6.1-4 6.1 4 6.1 4-2.2 4-6.1 4S0.9 7 0.9 7Z"}),Ar||Un>0?d.jsx("circle",{cx:"7",cy:"7",r:"1.8",fill:"currentColor",stroke:"none"}):d.jsx("line",{x1:"2.4",y1:"11.6",x2:"11.6",y2:"2.4"})]}),Un>0&&d.jsx("span",{className:"bw-badge","aria-hidden":!0,children:Un})]})]}),d.jsxs("div",{className:"action-run",children:[tt.claude&&U!==null&&d.jsxs("div",{className:"sound-slot",children:[d.jsx("button",{ref:re,className:"btn icon-btn",onClick:()=>pe(z=>!z),...ir(!1),title:g5(tt,{on:U===!0,locked:Te==="locked",prefs:G}),"aria-label":"Sound settings","aria-haspopup":"dialog","aria-expanded":he,"aria-controls":he?"sound-menu":void 0,children:d.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:[d.jsx("path",{d:"M3.2 5.2h2L7.8 3v8L5.2 8.8h-2z"}),U?d.jsxs(d.Fragment,{children:[d.jsx("path",{d:"M9.8 5.4a2.4 2.4 0 0 1 0 3.2"}),d.jsx("path",{d:"M11.3 3.9a4.6 4.6 0 0 1 0 6.2"})]}):d.jsxs(d.Fragment,{children:[d.jsx("path",{d:"M10 5.6l2.6 2.8"}),d.jsx("path",{d:"M12.6 5.6L10 8.4"})]})]})}),he&&d.jsx(SD,{onClose:()=>pe(!1),soundOn:U===!0,onToggleSound:X,prefs:G,onLevel:(z,V)=>se(z,{level:V}),onFigure:(z,V)=>se(z,{figure:V}),onPreview:z=>K(z),openerRef:re})]}),d.jsx("button",{className:"btn icon-btn",onClick:()=>ea(z=>z==="dark"?"light":"dark"),title:`Switch to ${Ir==="dark"?"light":"dark"} mode (T)`,"aria-label":"Toggle theme",children:Ir==="dark"?"☀":"☾"})]})]})]}),rs?d.jsxs("div",{className:"ver-banner done",role:"status",children:[d.jsx("span",{className:"ver-dot"}),d.jsxs("strong",{children:["Restarted — now running v",rs,"."]}),d.jsx("span",{className:"ver-sub",children:"The canvas replayed from the event log."})]}):Vn&&!Me?d.jsxs("div",{className:"conn-banner",role:"alert",children:[d.jsx("span",{className:"conn-dot"}),Mr?Fo==="npx"?"Fetching the new version with npx — this can take a minute…":`Restarting ${zt}…`:(()=>{const z=jB({connected:Me,paused:Wn});return d.jsxs(d.Fragment,{children:[`Lost connection to the ${zt} server. Reconnecting…`,z&&d.jsx("span",{className:"conn-sub",children:z})]})})()]}):kt&&Oe?d.jsxs("div",{className:`ver-banner ${Oe.kind}`,role:"status",children:[d.jsx("span",{className:"ver-dot"}),Oe.kind==="restart"?d.jsxs(d.Fragment,{children:[d.jsxs("strong",{children:["v",Oe.to," is installed — this deck still runs v",Oe.from,"."]}),ae!=null&&ae.canRestart?d.jsxs(d.Fragment,{children:[d.jsx("button",{type:"button",className:"ver-act",onClick:()=>Ds(),...ir(Mr),title:"Stop this process and bring it back on the same port. The canvas replays from the event log.",children:Mr?"restarting…":"Restart now"}),d.jsxs("button",{type:"button",className:`ver-auto${Hn?" on":""}`,role:"switch","aria-checked":Hn,onClick:nd,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:[d.jsx("i",{"aria-hidden":!0}),"auto when idle"]})]}):d.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."})]}):d.jsxs(d.Fragment,{children:[d.jsxs("strong",{children:[zt," v",Oe.to," is out — you are on v",Oe.from,"."]}),(ae==null?void 0:ae.upgradeMode)==="install"&&Bt!=="failed"&&d.jsx("button",{type:"button",className:"ver-act",onClick:Ps,...ir(Bt==="running",Bt==="done"),title:`Runs ${((Bl=ae==null?void 0:ae.upgrade)==null?void 0:Bl.command)??(ae==null?void 0:ae.command)??"npm i -g"} here, then restarts once nothing is running.`,children:Bt==="running"?"installing…":Bt==="done"?"installed":"Update now"}),(ae==null?void 0:ae.upgradeMode)==="npx"&&(ae==null?void 0:ae.canRestart)&&d.jsx("button",{type:"button",className:"ver-act",onClick:()=>Ds({upgrade:!0}),...ir(Mr),title:`Runs ${ae==null?void 0:ae.command} and hands it this port. Nothing is installed globally — npx unpacks its own copy.`,children:Mr?"fetching…":Bt==="failed"?"Retry update":"Update & restart"}),Bt==="failed"?d.jsxs("span",{className:"ver-sub fail",title:((Xs=ae==null?void 0:ae.upgrade)==null?void 0:Xs.error)??"",children:[(ae==null?void 0:ae.upgradeMode)==="npx"?"update failed":"install failed",": ",((Ul=ae==null?void 0:ae.upgrade)==null?void 0:Ul.error)??"unknown error"," — run it yourself:"]}):(ae==null?void 0:ae.upgradeMode)==="npx"?d.jsx("span",{className:"ver-sub",children:ae!=null&&ae.canRestart?"npx cannot upgrade in place, so the deck re-runs:":vy.npx}):ae!=null&&ae.upgradeBlocked?d.jsx("span",{className:"ver-sub",children:Object.hasOwn(vy,ae.upgradeBlocked)?vy[ae.upgradeBlocked]:"cannot install from here"}):null,d.jsxs("button",{type:"button",className:"ver-cmd",onClick:Tr,title:"Copy to clipboard",children:[d.jsx("code",{children:ae==null?void 0:ae.command}),d.jsx("span",{className:"ver-cmd-hint",children:Ke?"copied":"copy"})]})]}),d.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:zn,children:"×"})]}):Co&&mn?d.jsxs("div",{className:"ver-banner",role:"status",children:[d.jsx("span",{className:"ver-dot"}),d.jsxs("strong",{children:[mn," still works — the deck is called ",zt," now."]}),ae!=null&&ae.renameFix?d.jsx("span",{className:"ver-sub",children:ae.renameFix}):null,d.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:To,children:"×"})]}):null,W&&d.jsx(vq,{state:s.current,now:pt,providers:tt,onClose:()=>Y(!1)}),T&&tt.claude&&d.jsx(G4,{onClose:()=>Z(!1)}),F&&d.jsx(eq,{state:s.current,now:pt,selectedIds:l,onSelect:ha,onClose:()=>M(!1)}),d.jsxs("main",{id:"canvas",tabIndex:-1,className:`canvas-wrap${id?" bubbling":""}${la?" dragging-any":""}`,ref:Gs,onMouseDownCapture:rd,onPointerDownCapture:gr,onPointerUpCapture:gr,onWheelCapture:gr,children:[Jo===0&&d.jsx(JB,{live:Me,everConnected:Vn,providers:tt}),Ys.length>1&&d.jsx("div",{ref:Ls,className:`cat-filter-bar${$o?" occluded":""}`,role:"group","aria-label":"Filter tools by category",children:Ys.map(z=>{const V=Ji.has(z);return d.jsxs("button",{type:"button",className:`cat-filter${V?" off":""}`,onClick:()=>dd(z),"aria-pressed":!V,title:`${V?"Show":"Hide"} ${Qy[z]} tools`,children:[d.jsx("span",{className:"cat-emoji",children:Xy[z]}),d.jsx("span",{className:"cat-name",children:Qy[z]})]},z)})}),d.jsxs(WC,{nodes:ud,edges:cd,nodeTypes:RB,fitView:!Qe,fitViewOptions:{padding:.25,duration:py({durationMs:wj,documentHidden:document.hidden})?wj:0},minZoom:.2,maxZoom:1.6,panOnScroll:!0,nodesDraggable:!0,nodesConnectable:!1,selectionOnDrag:!1,nodeDragThreshold:5,onNodeClick:(z,V)=>{if(V.type==="sessionGroup"){w();return}y(V.id,z.shiftKey)},onPaneClick:()=>w(),onMoveStart:z=>{mj(zs(z))&&Ko()},onMove:(z,V)=>{Vo(),mj(zs(z))&&Ko(),as.current&&window.clearTimeout(as.current),as.current=window.setTimeout(()=>YB(V),250)},onNodeDragStart:(z,V)=>{var ce;if(ad(),Us.current=!0,rt.current=new Map,ca(!0),Vo(),Ko(),V.type==="sessionGroup"){const fe=(ce=V.data)==null?void 0:ce.sessionId,ke=new Map;if(fe)for(const Ce of Tn){const Be=Ce.data;(Be==null?void 0:Be.sessionId)===fe&&ke.set(Ce.id,{x:Ce.position.x,y:Ce.position.y})}is.current={start:{x:V.position.x,y:V.position.y},members:ke};return}Jt.current.set(V.id,{x:V.position.x,y:V.position.y})},onNodeDrag:(z,V)=>{var ce;if(Vo(),V.type==="sessionGroup"){const fe=is.current;if(!fe)return;const ke=V.position.x-fe.start.x,Ce=V.position.y-fe.start.y;for(const[Je,mt]of fe.members){const at={x:mt.x+ke,y:mt.y+Ce};Jt.current.set(Je,at),It.current.set(Je,at)}const Be=rt.current;if(Be){for(const[Je,mt]of fe.members)Be.set(Je,{x:mt.x+ke,y:mt.y+Ce});Be.set(V.id,{x:V.position.x,y:V.position.y})}ts(Je=>Je+1);return}Jt.current.set(V.id,{x:V.position.x,y:V.position.y}),It.current.set(V.id,{x:V.position.x,y:V.position.y}),(ce=rt.current)==null||ce.set(V.id,{x:V.position.x,y:V.position.y}),ts(fe=>fe+1)},onNodeDragStop:(z,V)=>{if(Vo(),Us.current=!1,rt.current=null,ca(!1),$s(ce=>ce+1),V.type==="sessionGroup"){const ce=is.current;if(ce){const fe=V.position.x-ce.start.x,ke=V.position.y-ce.start.y;for(const[Ce,Be]of ce.members){const Je={x:Be.x+fe,y:Be.y+ke};Jt.current.set(Ce,Je),It.current.set(Ce,Je)}}is.current=null,yy(It.current,Jt.current),$s(fe=>fe+1);return}Jt.current.set(V.id,{x:V.position.x,y:V.position.y}),It.current.set(V.id,{x:V.position.x,y:V.position.y}),yy(It.current,Jt.current)},children:[d.jsx(V$,{gap:28,size:1,color:Gn["--grid-line"]}),d.jsx(c3,{}),d.jsx(W3,{agents:s.current.agents,visibleAgentIds:Lr,positions:It.current,pinned:Jt.current,measured:Qn.current,spotlight:Hs,hiddenCategories:Ji,now:pt,onOpenTool:g}),d.jsxs(z$,{showInteractive:!1,children:[d.jsx(Sr,{onClick:yr,title:Bs?"Recenter view + re-enable autofit":"Recenter view (autofit already on)","aria-label":"Recenter view",style:Bs?{color:"var(--accent)"}:void 0,children:d.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[d.jsx("circle",{cx:"12",cy:"12",r:"3.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),d.jsx("path",{d:"M12 2v4M12 18v4M2 12h4M18 12h4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})]})}),d.jsx(Sr,{onClick:ns,title:EB({paused:Wn,held:Gt.size,dropped:Gt.dropped}),"aria-label":NB,"aria-pressed":Wn,children:d.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:d.jsx("path",{d:"M9 5.5v13M15 5.5v13",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})})}),d.jsx(Sr,{onClick:qr,title:"Auto-arrange — clear pins (R)","aria-label":"Re-arrange the canvas",children:d.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[d.jsx("rect",{x:"8.5",y:"2",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),d.jsx("rect",{x:"1.5",y:"17",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),d.jsx("rect",{x:"15.5",y:"17",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),d.jsx("path",{d:"M12 7v6.5M5 17v-3.5h14V17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]})}),d.jsx(Sr,{onClick:()=>us("button"),title:"Clear the canvas and the server's event log — asks first (C)","aria-label":"Clear the canvas",children:d.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[d.jsx("path",{d:"M4 6.2h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"}),d.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"}),d.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"}),d.jsx("path",{d:"M10.3 10.6v6.8M13.7 10.6v6.8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})]})}),d.jsx(Sr,{onClick:()=>P(z=>!z),title:"Keyboard shortcuts (?)","aria-label":"Open the keyboard shortcuts","aria-haspopup":"dialog",children:d.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[d.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"}),d.jsx("path",{d:"M12 18.4v.2",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",fill:"none"})]})})]}),d.jsx(O$,{zoomable:!0,pannable:!0,nodeColor:Ho,nodeStrokeWidth:2,maskColor:Gn["--minimap-mask"],style:pr})]})]}),A?d.jsxs("aside",{className:"detail","aria-label":"Detail",children:[d.jsx("button",{type:"button",className:"glyph-btn detail-close",title:"Close panel","aria-label":"Close detail panel",onClick:()=>q(!1),children:"×"}),tn?d.jsx(n8,{agent:tn,now:pt,onOpenTool:g,onShowSummary:z=>{O.has(z)&&(O.delete(z),Sj(O)),b(z)},onExportSession:z=>KB(s.current,z)}):d.jsx(t8,{count:Jo,workspace:Ge})]}):d.jsx("button",{type:"button",className:"detail-reopen",title:"Show detail panel","aria-label":"Show detail panel",onClick:()=>q(!0),children:"‹"}),ua&&d.jsx(e3,{tool:ua,onClose:()=>g(null)}),Rr&&d.jsx(b5,{providers:tt,onClose:()=>hr(!1)}),es&&d.jsx(I5,{onClose:()=>Ro(!1),onSeen:z=>{Mo(z);try{localStorage.setItem(U1,String(z))}catch{}},onWatching:Oo,palette:Gn}),_&&(()=>{const z=s.current.agents.get(_);return z?d.jsx(VL,{agent:z,onClose:()=>k(null)}):null})(),N&&d.jsx(K3,{state:s.current,sessionId:N,onClose:()=>{O.add(N),Sj(O),b(null)}}),it&&d.jsx(qD,{entries:it.entries,since:it.since,firstRun:it.firstRun,running:Le,onClose:()=>Mt(null)}),I&&d.jsx(iD,{onClose:()=>P(!1)}),j&&d.jsx(rD,{agentCount:Jo,onConfirm:()=>us("confirmation"),onCancel:()=>C(!1)})]})}function JB({live:e,everConnected:t,providers:n}){const s=!e;return d.jsxs("div",{className:"empty-hero",children:[d.jsxs("div",{className:"orbit-stack","aria-hidden":!0,children:[d.jsx("div",{className:"core"}),d.jsxs("div",{className:"orbit r1",children:[d.jsx("span",{className:"dot"}),d.jsx("span",{className:"dot b"})]}),d.jsxs("div",{className:"orbit r2",children:[d.jsx("span",{className:"dot"}),d.jsx("span",{className:"dot b"})]}),d.jsxs("div",{className:"orbit r3",children:[d.jsx("span",{className:"dot"}),d.jsx("span",{className:"dot b"})]})]}),s?d.jsxs(d.Fragment,{children:[d.jsx("h2",{children:t?"Disconnected from server":"Server unreachable"}),d.jsxs("p",{children:["The browser cannot reach ",d.jsx("code",{children:"/events"}),". Check that",d.jsx("code",{children:zt})," is still running in your terminal, then this page will resume automatically."]})]}):e8(n)]})}function e8(e){return d.jsxs(d.Fragment,{children:[d.jsx("h2",{children:"Waiting for Claude Code or Codex"}),d.jsxs("p",{children:["Run ",d.jsx("code",{children:"claude"})," or ",d.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."]}),d.jsxs("p",{className:"hint-row",children:["Not seeing anything? Make sure ",d.jsx("code",{children:zt})," is running."]}),m5(e).map(t=>d.jsx("p",{className:"hint-row",children:t.spans.map((n,s)=>n.code?d.jsx("code",{children:n.text},s):d.jsx("span",{children:n.text},s))},t.provider))]})}function t8({count:e,workspace:t}){const n=_B(t);return d.jsxs(d.Fragment,{children:[d.jsx("h2",{children:"Detail"}),e===0?d.jsxs("div",{className:"hint",children:[n.lead,n.workspace!==null&&d.jsxs(d.Fragment,{children:[" ",d.jsx("code",{children:n.workspace}),n.tail]})]}):d.jsx("div",{className:"empty",children:"Click an agent to see its tools."}),d.jsx("h3",{style:{marginTop:4},children:"Shortcuts"}),d.jsxs("div",{className:"shortcuts",children:[d.jsxs("div",{className:"sc",children:[d.jsx("kbd",{children:"?"}),d.jsx("span",{children:"all shortcuts"})]}),d.jsxs("div",{className:"sc",children:[d.jsx("kbd",{children:"drag"}),d.jsx("span",{children:"move a node"})]}),d.jsxs("div",{className:"sc",children:[d.jsx("kbd",{children:"tab"}),d.jsx("span",{children:"reach the cards"})]}),d.jsxs("div",{className:"sc",children:[d.jsx("kbd",{children:"enter"}),d.jsx("span",{children:"select the focused card"})]}),d.jsxs("div",{className:"sc",children:[d.jsx("kbd",{children:"space"}),d.jsx("span",{children:"pause / resume"})]}),d.jsxs("div",{className:"sc",children:[d.jsx("kbd",{children:"J"}),d.jsx("span",{children:"next agent"})]}),d.jsxs("div",{className:"sc",children:[d.jsx("kbd",{children:"K"}),d.jsx("span",{children:"previous agent"})]}),d.jsxs("div",{className:"sc",children:[d.jsx("kbd",{children:"R"}),d.jsx("span",{children:"re-arrange"})]}),d.jsxs("div",{className:"sc",children:[d.jsx("kbd",{children:"F"}),d.jsx("span",{children:"fit view"})]}),d.jsxs("div",{className:"sc",children:[d.jsx("kbd",{children:"L"}),d.jsx("span",{children:"session list"})]}),d.jsxs("div",{className:"sc",children:[d.jsx("kbd",{children:"H"}),d.jsx("span",{children:"usage history"})]}),d.jsxs("div",{className:"sc",children:[d.jsx("kbd",{children:"U"}),d.jsx("span",{children:"usage panel"})]}),d.jsxs("div",{className:"sc",children:[d.jsx("kbd",{children:"C"}),d.jsx("span",{children:"clear canvas"})]}),d.jsxs("div",{className:"sc",children:[d.jsx("kbd",{children:"T"}),d.jsx("span",{children:"toggle theme"})]}),d.jsxs("div",{className:"sc",children:[d.jsx("kbd",{children:"Esc"}),d.jsx("span",{children:"deselect, release focus"})]})]})]})}function n8({agent:e,now:t,onOpenTool:n,onShowSummary:s,onExportSession:i}){const a=bu(e.startedAt,e.endedAt,t),l=_n(e),u=l.total>0,h=e.usage.inputTokens+e.usage.outputTokens,p=new Map;for(const N of e.tools){const b=VR(N.name);p.set(b,(p.get(b)??0)+1)}const f=e.tools.filter(N=>N.ok===!1).length,g=e.tools.filter(N=>!N.endedAt).length,y=Array.from(p.entries()).sort((N,b)=>b[1]-N[1]),w=p.has("mcp")?D3(e.tools.map(N=>N.name)):null;return d.jsxs(d.Fragment,{children:[d.jsxs("header",{className:"detail-hero",children:[d.jsxs("div",{className:"hero-line",children:[d.jsx("span",{className:`state-pill state-${e.state}`,children:e.state==="active"?"live":e.state}),d.jsx("h2",{className:"hero-title",title:e.cwd??e.label,children:e.label})]}),d.jsxs("div",{className:"hero-meta",children:[d.jsx("span",{className:"hero-meta-item",children:e.kind}),d.jsx("span",{className:"hero-sep",children:"·"}),d.jsx("span",{className:"hero-meta-item",title:`started ${new Date(e.startedAt).toLocaleString()}`,children:a}),e.model&&(()=>{const N=oT(e);return d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"hero-sep",children:"·"}),d.jsxs("span",{className:"model-chip","data-family":Ou(e.model),title:N.length>0?`${e.model}
|
|
163
|
+
spend on this panel also covers:
|
|
164
|
+
${N.join(`
|
|
165
|
+
`)}`:e.model,children:[Is(e.model),N.length>0?` +${N.length}`:""]})]})})()]}),u&&d.jsxs("div",{className:"hero-cost",children:[d.jsxs("div",{className:"hero-cost-headline",children:[d.jsx("span",{className:"hero-cost-value",children:We(l.total)}),d.jsx("span",{className:"hero-cost-label",children:"spend"})]}),d.jsx(kw,{cost:l})]}),d.jsxs("div",{className:"hero-actions",children:[e.kind==="root"&&e.state==="done"&&s&&d.jsx("button",{type:"button",className:"btn hero-action-btn",onClick:()=>s(e.sessionId),title:"Reopen the end-of-session recap modal",children:"Show recap"}),i&&d.jsx("button",{type:"button",className:"btn hero-action-btn",onClick:()=>i(e.sessionId),title:"Download this session as JSON",children:"Export JSON"})]})]}),e.tools.length>0&&d.jsxs("section",{className:"detail-section",children:[d.jsx("h3",{children:"Activity"}),d.jsxs("div",{className:"activity-row",children:[d.jsxs("div",{className:"activity-counters",children:[d.jsxs("span",{className:"ac-item",children:[d.jsx("b",{children:e.toolCount})," calls"]}),g>0&&d.jsxs("span",{className:"ac-item ac-live",children:[d.jsx("b",{children:g})," live"]}),f>0&&d.jsxs("span",{className:"ac-item ac-err",children:[d.jsx("b",{children:f})," err"]})]}),d.jsx("div",{className:"cat-strip",children:y.map(([N,b])=>{const _=N==="mcp"?w:null,k=_==null?void 0:_.hue,E=`${b} ${Qy[N]} call${b===1?"":"s"}`;return d.jsxs("span",{className:`cat-chip cat-${N}${k!=null?" mcp-hue":""}`,style:k!=null?{"--mcp-hue":k}:void 0,title:_?`${E}, all to ${_.label}`:E,children:[d.jsx("span",{className:"cat-emoji",children:Xy[N]}),d.jsx("span",{className:"cat-count",children:b}),_&&d.jsx("span",{className:"cat-server",children:_.label})]},N)})})]})]}),h>0&&d.jsxs("section",{className:"detail-section",children:[d.jsx("h3",{children:"Tokens"}),d.jsxs("div",{className:"tokens-grid",children:[d.jsxs("div",{children:[d.jsx("span",{className:"k",children:"in"}),d.jsx("b",{children:e.usage.inputTokens.toLocaleString()})]}),d.jsxs("div",{children:[d.jsx("span",{className:"k",children:"out"}),d.jsx("b",{children:e.usage.outputTokens.toLocaleString()})]}),d.jsxs("div",{children:[d.jsx("span",{className:"k",children:"cache r"}),d.jsx("b",{children:e.usage.cacheReadTokens.toLocaleString()})]}),d.jsxs("div",{children:[d.jsx("span",{className:"k",children:"cache c"}),d.jsx("b",{children:e.usage.cacheCreateTokens.toLocaleString()})]})]})]}),d.jsxs("section",{className:"detail-section",children:[d.jsx("h3",{children:"Identity"}),d.jsxs("div",{children:[e.cwd&&d.jsxs("div",{className:"row",children:[d.jsx("span",{className:"k",children:"cwd"}),d.jsx("span",{className:"v",title:e.cwd,children:e.cwd})]}),d.jsxs("div",{className:"row",children:[d.jsx("span",{className:"k",children:"session"}),d.jsxs("span",{className:"v",children:[e.sessionId.slice(0,12),"…"]})]}),e.parentId&&d.jsxs("div",{className:"row",children:[d.jsx("span",{className:"k",children:"parent"}),d.jsxs("span",{className:"v",children:[e.parentId.slice(0,12),"…"]})]})]})]}),e.prompts.length>0&&d.jsxs("section",{className:"detail-section",children:[d.jsxs("h3",{children:["Prompts ",d.jsx("span",{className:"section-count",children:e.prompts.length})]}),d.jsx("div",{className:"prompts",children:e.prompts.slice().reverse().map((N,b)=>{const _=oq(N.at,t);return d.jsxs("div",{className:"prompt-entry",children:[d.jsx("div",{className:"prompt-time",title:_.title,children:_.label}),d.jsx("div",{className:"prompt-text",children:N.text})]},b)})})]}),d.jsxs("section",{className:"detail-section",children:[d.jsxs("h3",{children:["Tool calls ",d.jsx("span",{className:"section-count",children:e.tools.length})]}),e.tools.length===0&&d.jsx("div",{className:"empty",children:"No tool calls yet."}),d.jsx("div",{children:e.tools.slice().reverse().map(N=>d.jsx(s8,{t:N,onClick:()=>n(N.id)},N.id))})]})]})}const r8={inflight:"in-flight",done:"done",err:"error"};function s8({t:e,onClick:t}){const n=e.endedAt==null?"inflight":e.ok===!1?"err":"done",s=iT(e,"…");return d.jsxs("button",{className:"tool clickable",title:e.inputPreview||e.name,onClick:t,children:[d.jsxs("span",{className:"name",children:[d.jsx("span",{className:`status-dot ${n}`,"aria-hidden":!0}),d.jsx("span",{className:"vis-hidden",children:r8[n]}),e.name]}),d.jsx("span",{style:{color:"var(--muted)"},children:s})]})}try{xq(window.localStorage)}catch{}const o8=GA.createRoot(document.getElementById("root"));o8.render(d.jsx(QB,{}));
|