agent-dag 3.7.1 → 3.8.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.
@@ -1,4 +1,4 @@
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 Wc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function iw(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Pf={exports:{}},Fa={},$f={exports:{}},Ye={};/**
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 Vc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function lw(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Lf={exports:{}},Va={},qf={exports:{}},Ye={};/**
2
2
  * @license React
3
3
  * react.production.min.js
4
4
  *
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var Vx;function YA(){if(Vx)return Ye;Vx=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 v($){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 k($,V,Z){this.props=$,this.context=V,this.refs=b,this.updater=Z||w}k.prototype.isReactComponent={},k.prototype.setState=function($,V){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,$,V,"setState")},k.prototype.forceUpdate=function($){this.updater.enqueueForceUpdate(this,$,"forceUpdate")};function S(){}S.prototype=k.prototype;function E($,V,Z){this.props=$,this.context=V,this.refs=b,this.updater=Z||w}var C=E.prototype=new S;C.constructor=E,N(C,k.prototype),C.isPureReactComponent=!0;var j=Array.isArray,I=Object.prototype.hasOwnProperty,O={current:null},P={key:!0,ref:!0,__self:!0,__source:!0};function z($,V,Z){var F,L={},K=null,se=null;if(V!=null)for(F in V.ref!==void 0&&(se=V.ref),V.key!==void 0&&(K=""+V.key),V)I.call(V,F)&&!P.hasOwnProperty(F)&&(L[F]=V[F]);var he=arguments.length-2;if(he===1)L.children=Z;else if(1<he){for(var me=Array(he),xe=0;xe<he;xe++)me[xe]=arguments[xe+2];L.children=me}if($&&$.defaultProps)for(F in he=$.defaultProps,he)L[F]===void 0&&(L[F]=he[F]);return{$$typeof:e,type:$,key:K,ref:se,props:L,_owner:O.current}}function M($,V){return{$$typeof:e,type:$.type,key:V,ref:$.ref,props:$.props,_owner:$._owner}}function A($){return typeof $=="object"&&$!==null&&$.$$typeof===e}function q($){var V={"=":"=0",":":"=2"};return"$"+$.replace(/[=:]/g,function(Z){return V[Z]})}var H=/\/+/g;function Y($,V){return typeof $=="object"&&$!==null&&$.key!=null?q(""+$.key):V.toString(36)}function R($,V,Z,F,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),$=F===""?"."+Y(se,0):F,j(L)?(Z="",$!=null&&(Z=$.replace(H,"$&/")+"/"),R(L,V,Z,"",function(xe){return xe})):L!=null&&(A(L)&&(L=M(L,Z+(!L.key||se&&se.key===L.key?"":(""+L.key).replace(H,"$&/")+"/")+$)),V.push(L)),1;if(se=0,F=F===""?".":F+":",j($))for(var he=0;he<$.length;he++){K=$[he];var me=F+Y(K,he);se+=R(K,V,Z,me,L)}else if(me=v($),typeof me=="function")for($=me.call($),he=0;!(K=$.next()).done;)K=K.value,me=F+Y(K,he++),se+=R(K,V,Z,me,L);else if(K==="object")throw V=String($),Error("Objects are not valid as a React child (found: "+(V==="[object Object]"?"object with keys {"+Object.keys($).join(", ")+"}":V)+"). If you meant to render a collection of children, use an array instead.");return se}function Q($,V,Z){if($==null)return $;var F=[],L=0;return R($,F,"","",function(K){return V.call(Z,K,L++)}),F}function W($){if($._status===-1){var V=$._result;V=V(),V.then(function(Z){($._status===0||$._status===-1)&&($._status=1,$._result=Z)},function(Z){($._status===0||$._status===-1)&&($._status=2,$._result=Z)}),$._status===-1&&($._status=0,$._result=V)}if($._status===1)return $._result.default;throw $._result}var ne={current:null},X={transition:null},B={ReactCurrentDispatcher:ne,ReactCurrentBatchConfig:X,ReactCurrentOwner:O};function J(){throw Error("act(...) is not supported in production builds of React.")}return Ye.Children={map:Q,forEach:function($,V,Z){Q($,function(){V.apply(this,arguments)},Z)},count:function($){var V=0;return Q($,function(){V++}),V},toArray:function($){return Q($,function(V){return V})||[]},only:function($){if(!A($))throw Error("React.Children.only expected to receive a single React element child.");return $}},Ye.Component=k,Ye.Fragment=n,Ye.Profiler=i,Ye.PureComponent=E,Ye.StrictMode=s,Ye.Suspense=h,Ye.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=B,Ye.act=J,Ye.cloneElement=function($,V,Z){if($==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+$+".");var F=N({},$.props),L=$.key,K=$.ref,se=$._owner;if(V!=null){if(V.ref!==void 0&&(K=V.ref,se=O.current),V.key!==void 0&&(L=""+V.key),$.type&&$.type.defaultProps)var he=$.type.defaultProps;for(me in V)I.call(V,me)&&!P.hasOwnProperty(me)&&(F[me]=V[me]===void 0&&he!==void 0?he[me]:V[me])}var me=arguments.length-2;if(me===1)F.children=Z;else if(1<me){he=Array(me);for(var xe=0;xe<me;xe++)he[xe]=arguments[xe+2];F.children=he}return{$$typeof:e,type:$.type,key:L,ref:K,props:F,_owner:se}},Ye.createContext=function($){return $={$$typeof:l,_currentValue:$,_currentValue2:$,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},$.Provider={$$typeof:a,_context:$},$.Consumer=$},Ye.createElement=z,Ye.createFactory=function($){var V=z.bind(null,$);return V.type=$,V},Ye.createRef=function(){return{current:null}},Ye.forwardRef=function($){return{$$typeof:u,render:$}},Ye.isValidElement=A,Ye.lazy=function($){return{$$typeof:f,_payload:{_status:-1,_result:$},_init:W}},Ye.memo=function($,V){return{$$typeof:p,type:$,compare:V===void 0?null:V}},Ye.startTransition=function($){var V=X.transition;X.transition={};try{$()}finally{X.transition=V}},Ye.unstable_act=J,Ye.useCallback=function($,V){return ne.current.useCallback($,V)},Ye.useContext=function($){return ne.current.useContext($)},Ye.useDebugValue=function(){},Ye.useDeferredValue=function($){return ne.current.useDeferredValue($)},Ye.useEffect=function($,V){return ne.current.useEffect($,V)},Ye.useId=function(){return ne.current.useId()},Ye.useImperativeHandle=function($,V,Z){return ne.current.useImperativeHandle($,V,Z)},Ye.useInsertionEffect=function($,V){return ne.current.useInsertionEffect($,V)},Ye.useLayoutEffect=function($,V){return ne.current.useLayoutEffect($,V)},Ye.useMemo=function($,V){return ne.current.useMemo($,V)},Ye.useReducer=function($,V,Z){return ne.current.useReducer($,V,Z)},Ye.useRef=function($){return ne.current.useRef($)},Ye.useState=function($){return ne.current.useState($)},Ye.useSyncExternalStore=function($,V,Z){return ne.current.useSyncExternalStore($,V,Z)},Ye.useTransition=function(){return ne.current.useTransition()},Ye.version="18.3.1",Ye}var Yx;function gl(){return Yx||(Yx=1,$f.exports=YA()),$f.exports}/**
9
+ */var Vx;function YA(){if(Vx)return Ye;Vx=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 v($){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 k($,V,Z){this.props=$,this.context=V,this.refs=b,this.updater=Z||w}k.prototype.isReactComponent={},k.prototype.setState=function($,V){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,$,V,"setState")},k.prototype.forceUpdate=function($){this.updater.enqueueForceUpdate(this,$,"forceUpdate")};function S(){}S.prototype=k.prototype;function E($,V,Z){this.props=$,this.context=V,this.refs=b,this.updater=Z||w}var C=E.prototype=new S;C.constructor=E,N(C,k.prototype),C.isPureReactComponent=!0;var j=Array.isArray,I=Object.prototype.hasOwnProperty,O={current:null},P={key:!0,ref:!0,__self:!0,__source:!0};function z($,V,Z){var D,L={},K=null,se=null;if(V!=null)for(D in V.ref!==void 0&&(se=V.ref),V.key!==void 0&&(K=""+V.key),V)I.call(V,D)&&!P.hasOwnProperty(D)&&(L[D]=V[D]);var he=arguments.length-2;if(he===1)L.children=Z;else if(1<he){for(var me=Array(he),xe=0;xe<he;xe++)me[xe]=arguments[xe+2];L.children=me}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:O.current}}function M($,V){return{$$typeof:e,type:$.type,key:V,ref:$.ref,props:$.props,_owner:$._owner}}function A($){return typeof $=="object"&&$!==null&&$.$$typeof===e}function q($){var V={"=":"=0",":":"=2"};return"$"+$.replace(/[=:]/g,function(Z){return V[Z]})}var G=/\/+/g;function Y($,V){return typeof $=="object"&&$!==null&&$.key!=null?q(""+$.key):V.toString(36)}function R($,V,Z,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,j(L)?(Z="",$!=null&&(Z=$.replace(G,"$&/")+"/"),R(L,V,Z,"",function(xe){return xe})):L!=null&&(A(L)&&(L=M(L,Z+(!L.key||se&&se.key===L.key?"":(""+L.key).replace(G,"$&/")+"/")+$)),V.push(L)),1;if(se=0,D=D===""?".":D+":",j($))for(var he=0;he<$.length;he++){K=$[he];var me=D+Y(K,he);se+=R(K,V,Z,me,L)}else if(me=v($),typeof me=="function")for($=me.call($),he=0;!(K=$.next()).done;)K=K.value,me=D+Y(K,he++),se+=R(K,V,Z,me,L);else if(K==="object")throw V=String($),Error("Objects are not valid as a React child (found: "+(V==="[object Object]"?"object with keys {"+Object.keys($).join(", ")+"}":V)+"). If you meant to render a collection of children, use an array instead.");return se}function Q($,V,Z){if($==null)return $;var D=[],L=0;return R($,D,"","",function(K){return V.call(Z,K,L++)}),D}function H($){if($._status===-1){var V=$._result;V=V(),V.then(function(Z){($._status===0||$._status===-1)&&($._status=1,$._result=Z)},function(Z){($._status===0||$._status===-1)&&($._status=2,$._result=Z)}),$._status===-1&&($._status=0,$._result=V)}if($._status===1)return $._result.default;throw $._result}var ne={current:null},X={transition:null},U={ReactCurrentDispatcher:ne,ReactCurrentBatchConfig:X,ReactCurrentOwner:O};function J(){throw Error("act(...) is not supported in production builds of React.")}return Ye.Children={map:Q,forEach:function($,V,Z){Q($,function(){V.apply(this,arguments)},Z)},count:function($){var V=0;return Q($,function(){V++}),V},toArray:function($){return Q($,function(V){return V})||[]},only:function($){if(!A($))throw Error("React.Children.only expected to receive a single React element child.");return $}},Ye.Component=k,Ye.Fragment=n,Ye.Profiler=i,Ye.PureComponent=E,Ye.StrictMode=s,Ye.Suspense=h,Ye.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=U,Ye.act=J,Ye.cloneElement=function($,V,Z){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(V!=null){if(V.ref!==void 0&&(K=V.ref,se=O.current),V.key!==void 0&&(L=""+V.key),$.type&&$.type.defaultProps)var he=$.type.defaultProps;for(me in V)I.call(V,me)&&!P.hasOwnProperty(me)&&(D[me]=V[me]===void 0&&he!==void 0?he[me]:V[me])}var me=arguments.length-2;if(me===1)D.children=Z;else if(1<me){he=Array(me);for(var xe=0;xe<me;xe++)he[xe]=arguments[xe+2];D.children=he}return{$$typeof:e,type:$.type,key:L,ref:K,props:D,_owner:se}},Ye.createContext=function($){return $={$$typeof:l,_currentValue:$,_currentValue2:$,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},$.Provider={$$typeof:a,_context:$},$.Consumer=$},Ye.createElement=z,Ye.createFactory=function($){var V=z.bind(null,$);return V.type=$,V},Ye.createRef=function(){return{current:null}},Ye.forwardRef=function($){return{$$typeof:u,render:$}},Ye.isValidElement=A,Ye.lazy=function($){return{$$typeof:f,_payload:{_status:-1,_result:$},_init:H}},Ye.memo=function($,V){return{$$typeof:p,type:$,compare:V===void 0?null:V}},Ye.startTransition=function($){var V=X.transition;X.transition={};try{$()}finally{X.transition=V}},Ye.unstable_act=J,Ye.useCallback=function($,V){return ne.current.useCallback($,V)},Ye.useContext=function($){return ne.current.useContext($)},Ye.useDebugValue=function(){},Ye.useDeferredValue=function($){return ne.current.useDeferredValue($)},Ye.useEffect=function($,V){return ne.current.useEffect($,V)},Ye.useId=function(){return ne.current.useId()},Ye.useImperativeHandle=function($,V,Z){return ne.current.useImperativeHandle($,V,Z)},Ye.useInsertionEffect=function($,V){return ne.current.useInsertionEffect($,V)},Ye.useLayoutEffect=function($,V){return ne.current.useLayoutEffect($,V)},Ye.useMemo=function($,V){return ne.current.useMemo($,V)},Ye.useReducer=function($,V,Z){return ne.current.useReducer($,V,Z)},Ye.useRef=function($){return ne.current.useRef($)},Ye.useState=function($){return ne.current.useState($)},Ye.useSyncExternalStore=function($,V,Z){return ne.current.useSyncExternalStore($,V,Z)},Ye.useTransition=function(){return ne.current.useTransition()},Ye.version="18.3.1",Ye}var Yx;function _l(){return Yx||(Yx=1,qf.exports=YA()),qf.exports}/**
10
10
  * @license React
11
11
  * react-jsx-runtime.production.min.js
12
12
  *
@@ -14,7 +14,7 @@
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var Kx;function KA(){if(Kx)return Fa;Kx=1;var e=gl(),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={},v=null,w=null;p!==void 0&&(v=""+p),h.key!==void 0&&(v=""+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:v,ref:w,props:g,_owner:i.current}}return Fa.Fragment=n,Fa.jsx=l,Fa.jsxs=l,Fa}var Xx;function XA(){return Xx||(Xx=1,Pf.exports=KA()),Pf.exports}var d=XA(),Hc={},Lf={exports:{}},un={},qf={exports:{}},Df={};/**
17
+ */var Kx;function KA(){if(Kx)return Va;Kx=1;var e=_l(),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={},v=null,w=null;p!==void 0&&(v=""+p),h.key!==void 0&&(v=""+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:v,ref:w,props:g,_owner:i.current}}return Va.Fragment=n,Va.jsx=l,Va.jsxs=l,Va}var Xx;function XA(){return Xx||(Xx=1,Lf.exports=KA()),Lf.exports}var d=XA(),Yc={},Df={exports:{}},un={},Ff={exports:{}},zf={};/**
18
18
  * @license React
19
19
  * scheduler.production.min.js
20
20
  *
@@ -22,7 +22,7 @@
22
22
  *
23
23
  * This source code is licensed under the MIT license found in the
24
24
  * LICENSE file in the root directory of this source tree.
25
- */var Qx;function QA(){return Qx||(Qx=1,(function(e){function t(X,B){var J=X.length;X.push(B);e:for(;0<J;){var $=J-1>>>1,V=X[$];if(0<i(V,B))X[$]=B,X[J]=V,J=$;else break e}}function n(X){return X.length===0?null:X[0]}function s(X){if(X.length===0)return null;var B=X[0],J=X.pop();if(J!==B){X[0]=J;e:for(var $=0,V=X.length,Z=V>>>1;$<Z;){var F=2*($+1)-1,L=X[F],K=F+1,se=X[K];if(0>i(L,J))K<V&&0>i(se,L)?(X[$]=se,X[K]=J,$=K):(X[$]=L,X[F]=J,$=F);else if(K<V&&0>i(se,J))X[$]=se,X[K]=J,$=K;else break e}}return B}function i(X,B){var J=X.sortIndex-B.sortIndex;return J!==0?J:X.id-B.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,v=3,w=!1,N=!1,b=!1,k=typeof setTimeout=="function"?setTimeout:null,S=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function C(X){for(var B=n(p);B!==null;){if(B.callback===null)s(p);else if(B.startTime<=X)s(p),B.sortIndex=B.expirationTime,t(h,B);else break;B=n(p)}}function j(X){if(b=!1,C(X),!N)if(n(h)!==null)N=!0,W(I);else{var B=n(p);B!==null&&ne(j,B.startTime-X)}}function I(X,B){N=!1,b&&(b=!1,S(z),z=-1),w=!0;var J=v;try{for(C(B),g=n(h);g!==null&&(!(g.expirationTime>B)||X&&!q());){var $=g.callback;if(typeof $=="function"){g.callback=null,v=g.priorityLevel;var V=$(g.expirationTime<=B);B=e.unstable_now(),typeof V=="function"?g.callback=V:g===n(h)&&s(h),C(B)}else s(h);g=n(h)}if(g!==null)var Z=!0;else{var F=n(p);F!==null&&ne(j,F.startTime-B),Z=!1}return Z}finally{g=null,v=J,w=!1}}var O=!1,P=null,z=-1,M=5,A=-1;function q(){return!(e.unstable_now()-A<M)}function H(){if(P!==null){var X=e.unstable_now();A=X;var B=!0;try{B=P(!0,X)}finally{B?Y():(O=!1,P=null)}}else O=!1}var Y;if(typeof E=="function")Y=function(){E(H)};else if(typeof MessageChannel<"u"){var R=new MessageChannel,Q=R.port2;R.port1.onmessage=H,Y=function(){Q.postMessage(null)}}else Y=function(){k(H,0)};function W(X){P=X,O||(O=!0,Y())}function ne(X,B){z=k(function(){X(e.unstable_now())},B)}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,W(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 v},e.unstable_getFirstCallbackNode=function(){return n(h)},e.unstable_next=function(X){switch(v){case 1:case 2:case 3:var B=3;break;default:B=v}var J=v;v=B;try{return X()}finally{v=J}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(X,B){switch(X){case 1:case 2:case 3:case 4:case 5:break;default:X=3}var J=v;v=X;try{return B()}finally{v=J}},e.unstable_scheduleCallback=function(X,B,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 V=-1;break;case 2:V=250;break;case 5:V=1073741823;break;case 4:V=1e4;break;default:V=5e3}return V=J+V,X={id:f++,callback:B,priorityLevel:X,startTime:J,expirationTime:V,sortIndex:-1},J>$?(X.sortIndex=J,t(p,X),n(h)===null&&X===n(p)&&(b?(S(z),z=-1):b=!0,ne(j,J-$))):(X.sortIndex=V,t(h,X),N||w||(N=!0,W(I))),X},e.unstable_shouldYield=q,e.unstable_wrapCallback=function(X){var B=v;return function(){var J=v;v=B;try{return X.apply(this,arguments)}finally{v=J}}}})(Df)),Df}var Zx;function ZA(){return Zx||(Zx=1,qf.exports=QA()),qf.exports}/**
25
+ */var Qx;function QA(){return Qx||(Qx=1,(function(e){function t(X,U){var J=X.length;X.push(U);e:for(;0<J;){var $=J-1>>>1,V=X[$];if(0<i(V,U))X[$]=U,X[J]=V,J=$;else break e}}function n(X){return X.length===0?null:X[0]}function s(X){if(X.length===0)return null;var U=X[0],J=X.pop();if(J!==U){X[0]=J;e:for(var $=0,V=X.length,Z=V>>>1;$<Z;){var D=2*($+1)-1,L=X[D],K=D+1,se=X[K];if(0>i(L,J))K<V&&0>i(se,L)?(X[$]=se,X[K]=J,$=K):(X[$]=L,X[D]=J,$=D);else if(K<V&&0>i(se,J))X[$]=se,X[K]=J,$=K;else break e}}return U}function i(X,U){var J=X.sortIndex-U.sortIndex;return J!==0?J:X.id-U.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,v=3,w=!1,N=!1,b=!1,k=typeof setTimeout=="function"?setTimeout:null,S=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function C(X){for(var U=n(p);U!==null;){if(U.callback===null)s(p);else if(U.startTime<=X)s(p),U.sortIndex=U.expirationTime,t(h,U);else break;U=n(p)}}function j(X){if(b=!1,C(X),!N)if(n(h)!==null)N=!0,H(I);else{var U=n(p);U!==null&&ne(j,U.startTime-X)}}function I(X,U){N=!1,b&&(b=!1,S(z),z=-1),w=!0;var J=v;try{for(C(U),g=n(h);g!==null&&(!(g.expirationTime>U)||X&&!q());){var $=g.callback;if(typeof $=="function"){g.callback=null,v=g.priorityLevel;var V=$(g.expirationTime<=U);U=e.unstable_now(),typeof V=="function"?g.callback=V:g===n(h)&&s(h),C(U)}else s(h);g=n(h)}if(g!==null)var Z=!0;else{var D=n(p);D!==null&&ne(j,D.startTime-U),Z=!1}return Z}finally{g=null,v=J,w=!1}}var O=!1,P=null,z=-1,M=5,A=-1;function q(){return!(e.unstable_now()-A<M)}function G(){if(P!==null){var X=e.unstable_now();A=X;var U=!0;try{U=P(!0,X)}finally{U?Y():(O=!1,P=null)}}else O=!1}var Y;if(typeof E=="function")Y=function(){E(G)};else if(typeof MessageChannel<"u"){var R=new MessageChannel,Q=R.port2;R.port1.onmessage=G,Y=function(){Q.postMessage(null)}}else Y=function(){k(G,0)};function H(X){P=X,O||(O=!0,Y())}function ne(X,U){z=k(function(){X(e.unstable_now())},U)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(X){X.callback=null},e.unstable_continueExecution=function(){N||w||(N=!0,H(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 v},e.unstable_getFirstCallbackNode=function(){return n(h)},e.unstable_next=function(X){switch(v){case 1:case 2:case 3:var U=3;break;default:U=v}var J=v;v=U;try{return X()}finally{v=J}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(X,U){switch(X){case 1:case 2:case 3:case 4:case 5:break;default:X=3}var J=v;v=X;try{return U()}finally{v=J}},e.unstable_scheduleCallback=function(X,U,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 V=-1;break;case 2:V=250;break;case 5:V=1073741823;break;case 4:V=1e4;break;default:V=5e3}return V=J+V,X={id:f++,callback:U,priorityLevel:X,startTime:J,expirationTime:V,sortIndex:-1},J>$?(X.sortIndex=J,t(p,X),n(h)===null&&X===n(p)&&(b?(S(z),z=-1):b=!0,ne(j,J-$))):(X.sortIndex=V,t(h,X),N||w||(N=!0,H(I))),X},e.unstable_shouldYield=q,e.unstable_wrapCallback=function(X){var U=v;return function(){var J=v;v=U;try{return X.apply(this,arguments)}finally{v=J}}}})(zf)),zf}var Zx;function ZA(){return Zx||(Zx=1,Ff.exports=QA()),Ff.exports}/**
26
26
  * @license React
27
27
  * react-dom.production.min.js
28
28
  *
@@ -30,14 +30,14 @@
30
30
  *
31
31
  * This source code is licensed under the MIT license found in the
32
32
  * LICENSE file in the root directory of this source tree.
33
- */var Jx;function JA(){if(Jx)return un;Jx=1;var e=gl(),t=ZA();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 v(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,y,x,T){this.acceptsBooleans=o===2||o===3||o===4,this.attributeName=m,this.attributeNamespace=y,this.mustUseProperty=c,this.propertyName=r,this.type=o,this.sanitizeURL=x,this.removeEmptyString=T}var k={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(r){k[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];k[o]=new b(o,1,!1,r[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(r){k[r]=new b(r,2,!1,r.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(r){k[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){k[r]=new b(r,3,!1,r.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(r){k[r]=new b(r,3,!0,r,null,!1,!1)}),["capture","download"].forEach(function(r){k[r]=new b(r,4,!1,r,null,!1,!1)}),["cols","rows","size","span"].forEach(function(r){k[r]=new b(r,6,!1,r,null,!1,!1)}),["rowSpan","start"].forEach(function(r){k[r]=new b(r,5,!1,r.toLowerCase(),null,!1,!1)});var S=/[\-:]([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(S,E);k[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(S,E);k[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(S,E);k[o]=new b(o,1,!1,r,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(r){k[r]=new b(r,1,!1,r.toLowerCase(),null,!1,!1)}),k.xlinkHref=new b("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(r){k[r]=new b(r,1,!1,r.toLowerCase(),null,!0,!0)});function C(r,o,c,m){var y=k.hasOwnProperty(o)?k[o]:null;(y!==null?y.type!==0:m||!(2<o.length)||o[0]!=="o"&&o[0]!=="O"||o[1]!=="n"&&o[1]!=="N")&&(N(o,c,y,m)&&(c=null),m||y===null?v(o)&&(c===null?r.removeAttribute(o):r.setAttribute(o,""+c)):y.mustUseProperty?r[y.propertyName]=c===null?y.type===3?!1:"":c:(o=y.attributeName,m=y.attributeNamespace,c===null?r.removeAttribute(o):(y=y.type,c=y===3||y===4&&c===!0?"":""+c,m?r.setAttributeNS(m,o,c):r.setAttribute(o,c))))}var j=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,I=Symbol.for("react.element"),O=Symbol.for("react.portal"),P=Symbol.for("react.fragment"),z=Symbol.for("react.strict_mode"),M=Symbol.for("react.profiler"),A=Symbol.for("react.provider"),q=Symbol.for("react.context"),H=Symbol.for("react.forward_ref"),Y=Symbol.for("react.suspense"),R=Symbol.for("react.suspense_list"),Q=Symbol.for("react.memo"),W=Symbol.for("react.lazy"),ne=Symbol.for("react.offscreen"),X=Symbol.iterator;function B(r){return r===null||typeof r!="object"?null:(r=X&&r[X]||r["@@iterator"],typeof r=="function"?r:null)}var J=Object.assign,$;function V(r){if($===void 0)try{throw Error()}catch(c){var o=c.stack.trim().match(/\n( *(at )?)/);$=o&&o[1]||""}return`
34
- `+$+r}var Z=!1;function F(r,o){if(!r||Z)return"";Z=!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(ce){var m=ce}Reflect.construct(r,[],o)}else{try{o.call()}catch(ce){m=ce}r.call(o.prototype)}else{try{throw Error()}catch(ce){m=ce}r()}}catch(ce){if(ce&&m&&typeof ce.stack=="string"){for(var y=ce.stack.split(`
33
+ */var Jx;function JA(){if(Jx)return un;Jx=1;var e=_l(),t=ZA();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 v(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,y,x,T){this.acceptsBooleans=o===2||o===3||o===4,this.attributeName=m,this.attributeNamespace=y,this.mustUseProperty=c,this.propertyName=r,this.type=o,this.sanitizeURL=x,this.removeEmptyString=T}var k={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(r){k[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];k[o]=new b(o,1,!1,r[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(r){k[r]=new b(r,2,!1,r.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(r){k[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){k[r]=new b(r,3,!1,r.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(r){k[r]=new b(r,3,!0,r,null,!1,!1)}),["capture","download"].forEach(function(r){k[r]=new b(r,4,!1,r,null,!1,!1)}),["cols","rows","size","span"].forEach(function(r){k[r]=new b(r,6,!1,r,null,!1,!1)}),["rowSpan","start"].forEach(function(r){k[r]=new b(r,5,!1,r.toLowerCase(),null,!1,!1)});var S=/[\-:]([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(S,E);k[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(S,E);k[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(S,E);k[o]=new b(o,1,!1,r,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(r){k[r]=new b(r,1,!1,r.toLowerCase(),null,!1,!1)}),k.xlinkHref=new b("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(r){k[r]=new b(r,1,!1,r.toLowerCase(),null,!0,!0)});function C(r,o,c,m){var y=k.hasOwnProperty(o)?k[o]:null;(y!==null?y.type!==0:m||!(2<o.length)||o[0]!=="o"&&o[0]!=="O"||o[1]!=="n"&&o[1]!=="N")&&(N(o,c,y,m)&&(c=null),m||y===null?v(o)&&(c===null?r.removeAttribute(o):r.setAttribute(o,""+c)):y.mustUseProperty?r[y.propertyName]=c===null?y.type===3?!1:"":c:(o=y.attributeName,m=y.attributeNamespace,c===null?r.removeAttribute(o):(y=y.type,c=y===3||y===4&&c===!0?"":""+c,m?r.setAttributeNS(m,o,c):r.setAttribute(o,c))))}var j=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,I=Symbol.for("react.element"),O=Symbol.for("react.portal"),P=Symbol.for("react.fragment"),z=Symbol.for("react.strict_mode"),M=Symbol.for("react.profiler"),A=Symbol.for("react.provider"),q=Symbol.for("react.context"),G=Symbol.for("react.forward_ref"),Y=Symbol.for("react.suspense"),R=Symbol.for("react.suspense_list"),Q=Symbol.for("react.memo"),H=Symbol.for("react.lazy"),ne=Symbol.for("react.offscreen"),X=Symbol.iterator;function U(r){return r===null||typeof r!="object"?null:(r=X&&r[X]||r["@@iterator"],typeof r=="function"?r:null)}var J=Object.assign,$;function V(r){if($===void 0)try{throw Error()}catch(c){var o=c.stack.trim().match(/\n( *(at )?)/);$=o&&o[1]||""}return`
34
+ `+$+r}var Z=!1;function D(r,o){if(!r||Z)return"";Z=!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(ce){var m=ce}Reflect.construct(r,[],o)}else{try{o.call()}catch(ce){m=ce}r.call(o.prototype)}else{try{throw Error()}catch(ce){m=ce}r()}}catch(ce){if(ce&&m&&typeof ce.stack=="string"){for(var y=ce.stack.split(`
35
35
  `),x=m.stack.split(`
36
- `),T=y.length-1,U=x.length-1;1<=T&&0<=U&&y[T]!==x[U];)U--;for(;1<=T&&0<=U;T--,U--)if(y[T]!==x[U]){if(T!==1||U!==1)do if(T--,U--,0>U||y[T]!==x[U]){var ee=`
37
- `+y[T].replace(" at new "," at ");return r.displayName&&ee.includes("<anonymous>")&&(ee=ee.replace("<anonymous>",r.displayName)),ee}while(1<=T&&0<=U);break}}}finally{Z=!1,Error.prepareStackTrace=c}return(r=r?r.displayName||r.name:"")?V(r):""}function L(r){switch(r.tag){case 5:return V(r.type);case 16:return V("Lazy");case 13:return V("Suspense");case 19:return V("SuspenseList");case 0:case 2:case 15:return r=F(r.type,!1),r;case 11:return r=F(r.type.render,!1),r;case 1:return r=F(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 P:return"Fragment";case O:return"Portal";case M:return"Profiler";case z:return"StrictMode";case Y:return"Suspense";case R: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 H:var o=r.render;return r=r.displayName,r||(r=o.displayName||o.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case Q:return o=r.displayName||null,o!==null?o:K(r.type)||"Memo";case W: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===z?"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 me(r){var o=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(o==="checkbox"||o==="radio")}function xe(r){var o=me(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 y=c.get,x=c.set;return Object.defineProperty(r,o,{configurable:!0,get:function(){return y.call(this)},set:function(T){m=""+T,x.call(this,T)}}),Object.defineProperty(r,o,{enumerable:c.enumerable}),{getValue:function(){return m},setValue:function(T){m=""+T},stopTracking:function(){r._valueTracker=null,delete r[o]}}}}function Ee(r){r._valueTracker||(r._valueTracker=xe(r))}function He(r){if(!r)return!1;var o=r._valueTracker;if(!o)return!0;var c=o.getValue(),m="";return r&&(m=me(r)?r.checked?"true":"false":r.value),r=m,r!==c?(o.setValue(r),!0):!1}function Fe(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 Ie(r,o){var c=o.checked;return J({},o,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:c??r._wrapperState.initialChecked})}function be(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 ue(r,o){o=o.checked,o!=null&&C(r,"checked",o,!1)}function re(r,o){ue(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")?Oe(r,o.type,c):o.hasOwnProperty("defaultValue")&&Oe(r,o.type,he(o.defaultValue)),o.checked==null&&o.defaultChecked!=null&&(r.defaultChecked=!!o.defaultChecked)}function pe(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 Oe(r,o,c){(o!=="number"||Fe(r.ownerDocument)!==r)&&(c==null?r.defaultValue=""+r._wrapperState.initialValue:r.defaultValue!==""+c&&(r.defaultValue=""+c))}var rt=Array.isArray;function ot(r,o,c,m){if(r=r.options,o){o={};for(var y=0;y<c.length;y++)o["$"+c[y]]=!0;for(c=0;c<r.length;c++)y=o.hasOwnProperty("$"+r[c].value),r[c].selected!==y&&(r[c].selected=y),y&&m&&(r[c].defaultSelected=!0)}else{for(c=""+he(c),o=null,y=0;y<r.length;y++){if(r[y].value===c){r[y].selected=!0,m&&(r[y].defaultSelected=!0);return}o!==null||r[y].disabled||(o=r[y])}o!==null&&(o.selected=!0)}}function Xe(r,o){if(o.dangerouslySetInnerHTML!=null)throw Error(n(91));return J({},o,{value:void 0,defaultValue:void 0,children:""+r._wrapperState.initialValue})}function Pe(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(rt(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 Be(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 Ge(r){var o=r.textContent;o===r._wrapperState.initialValue&&o!==""&&o!==null&&(r.value=o)}function it(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 ke(r,o){return r==null||r==="http://www.w3.org/1999/xhtml"?it(o):r==="http://www.w3.org/2000/svg"&&o==="foreignObject"?"http://www.w3.org/1999/xhtml":r}var ct,It=(function(r){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(o,c,m,y){MSApp.execUnsafeLocalFunction(function(){return r(o,c,m,y)})}:r})(function(r,o){if(r.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in r)r.innerHTML=o;else{for(ct=ct||document.createElement("div"),ct.innerHTML="<svg>"+o.valueOf().toString()+"</svg>",o=ct.firstChild;r.firstChild;)r.removeChild(r.firstChild);for(;o.firstChild;)r.appendChild(o.firstChild)}});function ae(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},ze=["Webkit","ms","Moz","O"];Object.keys(Le).forEach(function(r){ze.forEach(function(o){o=o+r.charAt(0).toUpperCase()+r.substring(1),Le[o]=Le[r]})});function Ce(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 Ve(r,o){r=r.style;for(var c in o)if(o.hasOwnProperty(c)){var m=c.indexOf("--")===0,y=Ce(c,o[c],m);c==="float"&&(c="cssFloat"),m?r.setProperty(c,y):r[c]=y}}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 st(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 Te(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 vt=null;function ut(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var _t=null,_n=null,Dn=null;function Sn(r){if(r=Na(r)){if(typeof _t!="function")throw Error(n(280));var o=r.stateNode;o&&(o=oc(o),_t(r.stateNode,r.type,o))}}function Ro(r){_n?Dn?Dn.push(r):Dn=[r]:_n=r}function hn(){if(_n){var r=_n,o=Dn;if(Dn=_n=null,Sn(r),o)for(r=0;r<o.length;r++)Sn(o[r])}}function Ao(r,o){return r(o)}function Mo(){}var Bt=!1;function Tr(r,o,c){if(Bt)return r(o,c);Bt=!0;try{return Ao(r,o,c)}finally{Bt=!1,(_n!==null||Dn!==null)&&(Mo(),hn())}}function Fn(r,o){var c=r.stateNode;if(c===null)return null;var m=oc(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 qs=!1;if(u)try{var Rr={};Object.defineProperty(Rr,"passive",{get:function(){qs=!0}}),window.addEventListener("test",Rr,Rr),window.removeEventListener("test",Rr,Rr)}catch{qs=!1}function ra(r,o,c,m,y,x,T,U,ee){var ce=Array.prototype.slice.call(arguments,3);try{o.apply(c,ce)}catch(ye){this.onError(ye)}}var ur=!1,Ar=null,dr=!1,ns=null,Io={onError:function(r){ur=!0,Ar=r}};function Oo(r,o,c,m,y,x,T,U,ee){ur=!1,Ar=null,ra.apply(Io,arguments)}function Po(r,o,c,m,y,x,T,U,ee){if(Oo.apply(this,arguments),ur){if(ur){var ce=Ar;ur=!1,Ar=null}else throw Error(n(198));dr||(dr=!0,ns=ce)}}function Nn(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 $o(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 Mr(r){if(Nn(r)!==r)throw Error(n(188))}function Lo(r){var o=r.alternate;if(!o){if(o=Nn(r),o===null)throw Error(n(188));return o!==r?null:r}for(var c=r,m=o;;){var y=c.return;if(y===null)break;var x=y.alternate;if(x===null){if(m=y.return,m!==null){c=m;continue}break}if(y.child===x.child){for(x=y.child;x;){if(x===c)return Mr(y),r;if(x===m)return Mr(y),o;x=x.sibling}throw Error(n(188))}if(c.return!==m.return)c=y,m=x;else{for(var T=!1,U=y.child;U;){if(U===c){T=!0,c=y,m=x;break}if(U===m){T=!0,m=y,c=x;break}U=U.sibling}if(!T){for(U=x.child;U;){if(U===c){T=!0,c=x,m=y;break}if(U===m){T=!0,m=x,c=y;break}U=U.sibling}if(!T)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 zn(r){return r=Lo(r),r!==null?qo(r):null}function qo(r){if(r.tag===5||r.tag===6)return r;for(r=r.child;r!==null;){var o=qo(r);if(o!==null)return o;r=r.sibling}return null}var Ds=t.unstable_scheduleCallback,Fs=t.unstable_cancelCallback,Do=t.unstable_shouldYield,Fo=t.unstable_requestPaint,at=t.unstable_now,sa=t.unstable_getCurrentPriorityLevel,rs=t.unstable_ImmediatePriority,Gt=t.unstable_UserBlockingPriority,Bn=t.unstable_NormalPriority,zo=t.unstable_LowPriority,ss=t.unstable_IdlePriority,wt=null,rn=null;function Un(r){if(rn&&typeof rn.onCommitFiberRoot=="function")try{rn.onCommitFiberRoot(wt,r,void 0,(r.current.flags&128)===128)}catch{}}var pn=Math.clz32?Math.clz32:Bo,ld=Math.log,Ir=Math.LN2;function Bo(r){return r>>>=0,r===0?32:31-(ld(r)/Ir|0)|0}var Uo=64,Wo=4194304;function os(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 zs(r,o){var c=r.pendingLanes;if(c===0)return 0;var m=0,y=r.suspendedLanes,x=r.pingedLanes,T=c&268435455;if(T!==0){var U=T&~y;U!==0?m=os(U):(x&=T,x!==0&&(m=os(x)))}else T=c&~y,T!==0?m=os(T):x!==0&&(m=os(x));if(m===0)return 0;if(o!==0&&o!==m&&(o&y)===0&&(y=m&-m,x=o&-o,y>=x||y===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-pn(o),y=1<<c,m|=r[c],o&=~y;return m}function is(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 Ml(r,o){for(var c=r.suspendedLanes,m=r.pingedLanes,y=r.expirationTimes,x=r.pendingLanes;0<x;){var T=31-pn(x),U=1<<T,ee=y[T];ee===-1?((U&c)===0||(U&m)!==0)&&(y[T]=is(U,o)):ee<=o&&(r.expiredLanes|=U),x&=~U}}function Ho(r){return r=r.pendingLanes&-1073741825,r!==0?r:r&1073741824?1073741824:0}function Bs(){var r=Uo;return Uo<<=1,(Uo&4194240)===0&&(Uo=64),r}function Go(r){for(var o=[],c=0;31>c;c++)o.push(r);return o}function as(r,o,c){r.pendingLanes|=o,o!==536870912&&(r.suspendedLanes=0,r.pingedLanes=0),r=r.eventTimes,o=31-pn(o),r[o]=c}function Zt(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 y=31-pn(c),x=1<<y;o[y]=0,m[y]=-1,r[y]=-1,c&=~x}}function ls(r,o){var c=r.entangledLanes|=o;for(r=r.entanglements;c;){var m=31-pn(c),y=1<<m;y&o|r[m]&o&&(r[m]|=o),c&=~y}}var Qe=0;function oa(r){return r&=-r,1<r?4<r?(r&268435455)!==0?16:536870912:4:1}var Il,Or,ia,Wn,Ol,Vo=!1,Yo=[],fr=null,Hn=null,hr=null,mn=new Map,Gn=new Map,Vn=[],aa="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 Yn(r,o){switch(r){case"focusin":case"focusout":fr=null;break;case"dragenter":case"dragleave":Hn=null;break;case"mouseover":case"mouseout":hr=null;break;case"pointerover":case"pointerout":mn.delete(o.pointerId);break;case"gotpointercapture":case"lostpointercapture":Gn.delete(o.pointerId)}}function Us(r,o,c,m,y,x){return r===null||r.nativeEvent!==x?(r={blockedOn:o,domEventName:c,eventSystemFlags:m,nativeEvent:x,targetContainers:[y]},o!==null&&(o=Na(o),o!==null&&Or(o)),r):(r.eventSystemFlags|=m,o=r.targetContainers,y!==null&&o.indexOf(y)===-1&&o.push(y),r)}function En(r,o,c,m,y){switch(o){case"focusin":return fr=Us(fr,r,o,c,m,y),!0;case"dragenter":return Hn=Us(Hn,r,o,c,m,y),!0;case"mouseover":return hr=Us(hr,r,o,c,m,y),!0;case"pointerover":var x=y.pointerId;return mn.set(x,Us(mn.get(x)||null,r,o,c,m,y)),!0;case"gotpointercapture":return x=y.pointerId,Gn.set(x,Us(Gn.get(x)||null,r,o,c,m,y)),!0}return!1}function Ko(r){var o=ro(r.target);if(o!==null){var c=Nn(o);if(c!==null){if(o=c.tag,o===13){if(o=$o(c),o!==null){r.blockedOn=o,Ol(r.priority,function(){ia(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 cs(r){if(r.blockedOn!==null)return!1;for(var o=r.targetContainers;0<o.length;){var c=Qo(r.domEventName,r.eventSystemFlags,o[0],r.nativeEvent);if(c===null){c=r.nativeEvent;var m=new c.constructor(c.type,c);vt=m,c.target.dispatchEvent(m),vt=null}else return o=Na(c),o!==null&&Or(o),r.blockedOn=c,!1;o.shift()}return!0}function la(r,o,c){cs(r)&&c.delete(o)}function Xo(){Vo=!1,fr!==null&&cs(fr)&&(fr=null),Hn!==null&&cs(Hn)&&(Hn=null),hr!==null&&cs(hr)&&(hr=null),mn.forEach(la),Gn.forEach(la)}function Pr(r,o){r.blockedOn===o&&(r.blockedOn=null,Vo||(Vo=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Xo)))}function us(r){function o(y){return Pr(y,r)}if(0<Yo.length){Pr(Yo[0],r);for(var c=1;c<Yo.length;c++){var m=Yo[c];m.blockedOn===r&&(m.blockedOn=null)}}for(fr!==null&&Pr(fr,r),Hn!==null&&Pr(Hn,r),hr!==null&&Pr(hr,r),mn.forEach(o),Gn.forEach(o),c=0;c<Vn.length;c++)m=Vn[c],m.blockedOn===r&&(m.blockedOn=null);for(;0<Vn.length&&(c=Vn[0],c.blockedOn===null);)Ko(c),c.blockedOn===null&&Vn.shift()}var pr=j.ReactCurrentBatchConfig,Ws=!0;function ca(r,o,c,m){var y=Qe,x=pr.transition;pr.transition=null;try{Qe=1,mr(r,o,c,m)}finally{Qe=y,pr.transition=x}}function Pl(r,o,c,m){var y=Qe,x=pr.transition;pr.transition=null;try{Qe=4,mr(r,o,c,m)}finally{Qe=y,pr.transition=x}}function mr(r,o,c,m){if(Ws){var y=Qo(r,o,c,m);if(y===null)Sd(r,o,m,Hs,c),Yn(r,m);else if(En(y,r,o,c,m))m.stopPropagation();else if(Yn(r,m),o&4&&-1<aa.indexOf(r)){for(;y!==null;){var x=Na(y);if(x!==null&&Il(x),x=Qo(r,o,c,m),x===null&&Sd(r,o,m,Hs,c),x===y)break;y=x}y!==null&&m.stopPropagation()}else Sd(r,o,m,null,c)}}var Hs=null;function Qo(r,o,c,m){if(Hs=null,r=ut(m),r=ro(r),r!==null)if(o=Nn(r),o===null)r=null;else if(c=o.tag,c===13){if(r=$o(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 Hs=r,null}function Zo(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(sa()){case rs:return 1;case Gt:return 4;case Bn:case zo:return 16;case ss:return 536870912;default:return 16}default:return 16}}var gr=null,Gs=null,Kn=null;function ua(){if(Kn)return Kn;var r,o=Gs,c=o.length,m,y="value"in gr?gr.value:gr.textContent,x=y.length;for(r=0;r<c&&o[r]===y[r];r++);var T=c-r;for(m=1;m<=T&&o[c-m]===y[x-m];m++);return Kn=y.slice(r,1<m?1-m:void 0)}function Jo(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 Vs(){return!0}function da(){return!1}function Jt(r){function o(c,m,y,x,T){this._reactName=c,this._targetInst=y,this.type=m,this.nativeEvent=x,this.target=T,this.currentTarget=null;for(var U in r)r.hasOwnProperty(U)&&(c=r[U],this[U]=c?c(x):x[U]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?Vs:da,this.isPropagationStopped=da,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=Vs)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=Vs)},persist:function(){},isPersistent:Vs}),o}var Ot={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},fa=Jt(Ot),$r=J({},Ot,{view:0,detail:0}),ds=Jt($r),Lr,Ys,qr,Ks=J({},$r,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Cn,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!==qr&&(qr&&r.type==="mousemove"?(Lr=r.screenX-qr.screenX,Ys=r.screenY-qr.screenY):Ys=Lr=0,qr=r),Lr)},movementY:function(r){return"movementY"in r?r.movementY:Ys}}),Xs=Jt(Ks),$l=J({},Ks,{dataTransfer:0}),cd=Jt($l),ud=J({},$r,{relatedTarget:0}),ei=Jt(ud),dd=J({},Ot,{animationName:0,elapsedTime:0,pseudoElement:0}),fd=Jt(dd),ha=J({},Ot,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),yr=Jt(ha),pa=J({},Ot,{data:0}),ma=Jt(pa),hd={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},pd={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"},Ll={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function ql(r){var o=this.nativeEvent;return o.getModifierState?o.getModifierState(r):(r=Ll[r])?!!o[r]:!1}function Cn(){return ql}var md=J({},$r,{key:function(r){if(r.key){var o=hd[r.key]||r.key;if(o!=="Unidentified")return o}return r.type==="keypress"?(r=Jo(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?pd[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Cn,charCode:function(r){return r.type==="keypress"?Jo(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?Jo(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),Dl=Jt(md),gd=J({},Ks,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Qs=Jt(gd),yd=J({},$r,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Cn}),en=Jt(yd),ga=J({},Ot,{propertyName:0,elapsedTime:0,pseudoElement:0}),Fl=Jt(ga),zl=J({},Ks,{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}),Bl=Jt(zl),ya=[9,13,27,32],fs=u&&"CompositionEvent"in window,Dr=null;u&&"documentMode"in document&&(Dr=document.documentMode);var Ul=u&&"TextEvent"in window&&!Dr,Zs=u&&(!fs||Dr&&8<Dr&&11>=Dr),va=" ",ti=!1;function ni(r,o){switch(r){case"keyup":return ya.indexOf(o.keyCode)!==-1;case"keydown":return o.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ri(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var xt=!1;function Wl(r,o){switch(r){case"compositionend":return ri(o);case"keypress":return o.which!==32?null:(ti=!0,va);case"textInput":return r=o.data,r===va&&ti?null:r;default:return null}}function Hl(r,o){if(xt)return r==="compositionend"||!fs&&ni(r,o)?(r=ua(),Kn=Gs=gr=null,xt=!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 Zs&&o.locale!=="ko"?null:o.data;default:return null}}var vd={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 Gl(r){var o=r&&r.nodeName&&r.nodeName.toLowerCase();return o==="input"?!!vd[r.type]:o==="textarea"}function wa(r,o,c,m){Ro(m),o=nc(o,"onChange"),0<o.length&&(c=new fa("onChange","change",null,c,m),r.push({event:c,listeners:o}))}var vr=null,Js=null;function Fr(r){c0(r,0)}function hs(r){var o=ui(r);if(He(o))return r}function wd(r,o){if(r==="change")return o}var Vl=!1;if(u){var Yl;if(u){var eo="oninput"in document;if(!eo){var Kl=document.createElement("div");Kl.setAttribute("oninput","return;"),eo=typeof Kl.oninput=="function"}Yl=eo}else Yl=!1;Vl=Yl&&(!document.documentMode||9<document.documentMode)}function to(){vr&&(vr.detachEvent("onpropertychange",si),Js=vr=null)}function si(r){if(r.propertyName==="value"&&hs(Js)){var o=[];wa(o,Js,r,ut(r)),Tr(Fr,o)}}function xd(r,o,c){r==="focusin"?(to(),vr=o,Js=c,vr.attachEvent("onpropertychange",si)):r==="focusout"&&to()}function Xl(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return hs(Js)}function Ql(r,o){if(r==="click")return hs(o)}function Zl(r,o){if(r==="input"||r==="change")return hs(o)}function Jl(r,o){return r===o&&(r!==0||1/r===1/o)||r!==r&&o!==o}var D=typeof Object.is=="function"?Object.is:Jl;function G(r,o){if(D(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 y=c[m];if(!h.call(o,y)||!D(r[y],o[y]))return!1}return!0}function le(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function fe(r,o){var c=le(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=le(c)}}function Se(r,o){return r&&o?r===o?!0:r&&r.nodeType===3?!1:o&&o.nodeType===3?Se(r,o.parentNode):"contains"in r?r.contains(o):r.compareDocumentPosition?!!(r.compareDocumentPosition(o)&16):!1:!1}function Ae(){for(var r=window,o=Fe();o instanceof r.HTMLIFrameElement;){try{var c=typeof o.contentWindow.location.href=="string"}catch{c=!1}if(c)r=o.contentWindow;else break;o=Fe(r.document)}return o}function Ue(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 et(r){var o=Ae(),c=r.focusedElem,m=r.selectionRange;if(o!==c&&c&&c.ownerDocument&&Se(c.ownerDocument.documentElement,c)){if(m!==null&&Ue(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 y=c.textContent.length,x=Math.min(m.start,y);m=m.end===void 0?x:Math.min(m.end,y),!r.extend&&x>m&&(y=m,m=x,x=y),y=fe(c,x);var T=fe(c,m);y&&T&&(r.rangeCount!==1||r.anchorNode!==y.node||r.anchorOffset!==y.offset||r.focusNode!==T.node||r.focusOffset!==T.offset)&&(o=o.createRange(),o.setStart(y.node,y.offset),r.removeAllRanges(),x>m?(r.addRange(o),r.extend(T.node,T.offset)):(o.setEnd(T.node,T.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 pt=u&&"documentMode"in document&&11>=document.documentMode,tt=null,Vt=null,wr=null,oi=!1;function ec(r,o,c){var m=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;oi||tt==null||tt!==Fe(m)||(m=tt,"selectionStart"in m&&Ue(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}),wr&&G(wr,m)||(wr=m,m=nc(Vt,"onSelect"),0<m.length&&(o=new fa("onSelect","select",null,o,c),r.push({event:o,listeners:m}),o.target=tt)))}function no(r,o){var c={};return c[r.toLowerCase()]=o.toLowerCase(),c["Webkit"+r]="webkit"+o,c["Moz"+r]="moz"+o,c}var ps={animationend:no("Animation","AnimationEnd"),animationiteration:no("Animation","AnimationIteration"),animationstart:no("Animation","AnimationStart"),transitionend:no("Transition","TransitionEnd")},ii={},ai={};u&&(ai=document.createElement("div").style,"AnimationEvent"in window||(delete ps.animationend.animation,delete ps.animationiteration.animation,delete ps.animationstart.animation),"TransitionEvent"in window||delete ps.transitionend.transition);function xr(r){if(ii[r])return ii[r];if(!ps[r])return r;var o=ps[r],c;for(c in o)if(o.hasOwnProperty(c)&&c in ai)return ii[r]=o[c];return r}var ms=xr("animationend"),Ct=xr("animationiteration"),xa=xr("animationstart"),o0=xr("transitionend"),i0=new Map,a0="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 gs(r,o){i0.set(r,o),a(o,[r])}for(var bd=0;bd<a0.length;bd++){var kd=a0[bd],rA=kd.toLowerCase(),sA=kd[0].toUpperCase()+kd.slice(1);gs(rA,"on"+sA)}gs(ms,"onAnimationEnd"),gs(Ct,"onAnimationIteration"),gs(xa,"onAnimationStart"),gs("dblclick","onDoubleClick"),gs("focusin","onFocus"),gs("focusout","onBlur"),gs(o0,"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 ba="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(" "),oA=new Set("cancel close invalid load scroll toggle".split(" ").concat(ba));function l0(r,o,c){var m=r.type||"unknown-event";r.currentTarget=c,Po(m,o,void 0,r),r.currentTarget=null}function c0(r,o){o=(o&4)!==0;for(var c=0;c<r.length;c++){var m=r[c],y=m.event;m=m.listeners;e:{var x=void 0;if(o)for(var T=m.length-1;0<=T;T--){var U=m[T],ee=U.instance,ce=U.currentTarget;if(U=U.listener,ee!==x&&y.isPropagationStopped())break e;l0(y,U,ce),x=ee}else for(T=0;T<m.length;T++){if(U=m[T],ee=U.instance,ce=U.currentTarget,U=U.listener,ee!==x&&y.isPropagationStopped())break e;l0(y,U,ce),x=ee}}}if(dr)throw r=ns,dr=!1,ns=null,r}function ft(r,o){var c=o[Rd];c===void 0&&(c=o[Rd]=new Set);var m=r+"__bubble";c.has(m)||(u0(o,r,2,!1),c.add(m))}function _d(r,o,c){var m=0;o&&(m|=4),u0(c,r,m,o)}var tc="_reactListening"+Math.random().toString(36).slice(2);function ka(r){if(!r[tc]){r[tc]=!0,s.forEach(function(c){c!=="selectionchange"&&(oA.has(c)||_d(c,!1,r),_d(c,!0,r))});var o=r.nodeType===9?r:r.ownerDocument;o===null||o[tc]||(o[tc]=!0,_d("selectionchange",!1,o))}}function u0(r,o,c,m){switch(Zo(o)){case 1:var y=ca;break;case 4:y=Pl;break;default:y=mr}c=y.bind(null,o,c,r),y=void 0,!qs||o!=="touchstart"&&o!=="touchmove"&&o!=="wheel"||(y=!0),m?y!==void 0?r.addEventListener(o,c,{capture:!0,passive:y}):r.addEventListener(o,c,!0):y!==void 0?r.addEventListener(o,c,{passive:y}):r.addEventListener(o,c,!1)}function Sd(r,o,c,m,y){var x=m;if((o&1)===0&&(o&2)===0&&m!==null)e:for(;;){if(m===null)return;var T=m.tag;if(T===3||T===4){var U=m.stateNode.containerInfo;if(U===y||U.nodeType===8&&U.parentNode===y)break;if(T===4)for(T=m.return;T!==null;){var ee=T.tag;if((ee===3||ee===4)&&(ee=T.stateNode.containerInfo,ee===y||ee.nodeType===8&&ee.parentNode===y))return;T=T.return}for(;U!==null;){if(T=ro(U),T===null)return;if(ee=T.tag,ee===5||ee===6){m=x=T;continue e}U=U.parentNode}}m=m.return}Tr(function(){var ce=x,ye=ut(c),ve=[];e:{var ge=i0.get(r);if(ge!==void 0){var _e=fa,je=r;switch(r){case"keypress":if(Jo(c)===0)break e;case"keydown":case"keyup":_e=Dl;break;case"focusin":je="focus",_e=ei;break;case"focusout":je="blur",_e=ei;break;case"beforeblur":case"afterblur":_e=ei;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":_e=Xs;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":_e=cd;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":_e=en;break;case ms:case Ct:case xa:_e=fd;break;case o0:_e=Fl;break;case"scroll":_e=ds;break;case"wheel":_e=Bl;break;case"copy":case"cut":case"paste":_e=yr;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":_e=Qs}var Re=(o&4)!==0,jt=!Re&&r==="scroll",oe=Re?ge!==null?ge+"Capture":null:ge;Re=[];for(var te=ce,ie;te!==null;){ie=te;var we=ie.stateNode;if(ie.tag===5&&we!==null&&(ie=we,oe!==null&&(we=Fn(te,oe),we!=null&&Re.push(_a(te,we,ie)))),jt)break;te=te.return}0<Re.length&&(ge=new _e(ge,je,null,c,ye),ve.push({event:ge,listeners:Re}))}}if((o&7)===0){e:{if(ge=r==="mouseover"||r==="pointerover",_e=r==="mouseout"||r==="pointerout",ge&&c!==vt&&(je=c.relatedTarget||c.fromElement)&&(ro(je)||je[zr]))break e;if((_e||ge)&&(ge=ye.window===ye?ye:(ge=ye.ownerDocument)?ge.defaultView||ge.parentWindow:window,_e?(je=c.relatedTarget||c.toElement,_e=ce,je=je?ro(je):null,je!==null&&(jt=Nn(je),je!==jt||je.tag!==5&&je.tag!==6)&&(je=null)):(_e=null,je=ce),_e!==je)){if(Re=Xs,we="onMouseLeave",oe="onMouseEnter",te="mouse",(r==="pointerout"||r==="pointerover")&&(Re=Qs,we="onPointerLeave",oe="onPointerEnter",te="pointer"),jt=_e==null?ge:ui(_e),ie=je==null?ge:ui(je),ge=new Re(we,te+"leave",_e,c,ye),ge.target=jt,ge.relatedTarget=ie,we=null,ro(ye)===ce&&(Re=new Re(oe,te+"enter",je,c,ye),Re.target=ie,Re.relatedTarget=jt,we=Re),jt=we,_e&&je)t:{for(Re=_e,oe=je,te=0,ie=Re;ie;ie=li(ie))te++;for(ie=0,we=oe;we;we=li(we))ie++;for(;0<te-ie;)Re=li(Re),te--;for(;0<ie-te;)oe=li(oe),ie--;for(;te--;){if(Re===oe||oe!==null&&Re===oe.alternate)break t;Re=li(Re),oe=li(oe)}Re=null}else Re=null;_e!==null&&d0(ve,ge,_e,Re,!1),je!==null&&jt!==null&&d0(ve,jt,je,Re,!0)}}e:{if(ge=ce?ui(ce):window,_e=ge.nodeName&&ge.nodeName.toLowerCase(),_e==="select"||_e==="input"&&ge.type==="file")var Me=wd;else if(Gl(ge))if(Vl)Me=Zl;else{Me=Xl;var qe=xd}else(_e=ge.nodeName)&&_e.toLowerCase()==="input"&&(ge.type==="checkbox"||ge.type==="radio")&&(Me=Ql);if(Me&&(Me=Me(r,ce))){wa(ve,Me,c,ye);break e}qe&&qe(r,ge,ce),r==="focusout"&&(qe=ge._wrapperState)&&qe.controlled&&ge.type==="number"&&Oe(ge,"number",ge.value)}switch(qe=ce?ui(ce):window,r){case"focusin":(Gl(qe)||qe.contentEditable==="true")&&(tt=qe,Vt=ce,wr=null);break;case"focusout":wr=Vt=tt=null;break;case"mousedown":oi=!0;break;case"contextmenu":case"mouseup":case"dragend":oi=!1,ec(ve,c,ye);break;case"selectionchange":if(pt)break;case"keydown":case"keyup":ec(ve,c,ye)}var De;if(fs)e:{switch(r){case"compositionstart":var We="onCompositionStart";break e;case"compositionend":We="onCompositionEnd";break e;case"compositionupdate":We="onCompositionUpdate";break e}We=void 0}else xt?ni(r,c)&&(We="onCompositionEnd"):r==="keydown"&&c.keyCode===229&&(We="onCompositionStart");We&&(Zs&&c.locale!=="ko"&&(xt||We!=="onCompositionStart"?We==="onCompositionEnd"&&xt&&(De=ua()):(gr=ye,Gs="value"in gr?gr.value:gr.textContent,xt=!0)),qe=nc(ce,We),0<qe.length&&(We=new ma(We,r,null,c,ye),ve.push({event:We,listeners:qe}),De?We.data=De:(De=ri(c),De!==null&&(We.data=De)))),(De=Ul?Wl(r,c):Hl(r,c))&&(ce=nc(ce,"onBeforeInput"),0<ce.length&&(ye=new ma("onBeforeInput","beforeinput",null,c,ye),ve.push({event:ye,listeners:ce}),ye.data=De))}c0(ve,o)})}function _a(r,o,c){return{instance:r,listener:o,currentTarget:c}}function nc(r,o){for(var c=o+"Capture",m=[];r!==null;){var y=r,x=y.stateNode;y.tag===5&&x!==null&&(y=x,x=Fn(r,c),x!=null&&m.unshift(_a(r,x,y)),x=Fn(r,o),x!=null&&m.push(_a(r,x,y))),r=r.return}return m}function li(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5);return r||null}function d0(r,o,c,m,y){for(var x=o._reactName,T=[];c!==null&&c!==m;){var U=c,ee=U.alternate,ce=U.stateNode;if(ee!==null&&ee===m)break;U.tag===5&&ce!==null&&(U=ce,y?(ee=Fn(c,x),ee!=null&&T.unshift(_a(c,ee,U))):y||(ee=Fn(c,x),ee!=null&&T.push(_a(c,ee,U)))),c=c.return}T.length!==0&&r.push({event:o,listeners:T})}var iA=/\r\n?/g,aA=/\u0000|\uFFFD/g;function f0(r){return(typeof r=="string"?r:""+r).replace(iA,`
38
- `).replace(aA,"")}function rc(r,o,c){if(o=f0(o),f0(r)!==o&&c)throw Error(n(425))}function sc(){}var Nd=null,Ed=null;function Cd(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 jd=typeof setTimeout=="function"?setTimeout:void 0,lA=typeof clearTimeout=="function"?clearTimeout:void 0,h0=typeof Promise=="function"?Promise:void 0,cA=typeof queueMicrotask=="function"?queueMicrotask:typeof h0<"u"?function(r){return h0.resolve(null).then(r).catch(uA)}:jd;function uA(r){setTimeout(function(){throw r})}function Td(r,o){var c=o,m=0;do{var y=c.nextSibling;if(r.removeChild(c),y&&y.nodeType===8)if(c=y.data,c==="/$"){if(m===0){r.removeChild(y),us(o);return}m--}else c!=="$"&&c!=="$?"&&c!=="$!"||m++;c=y}while(c);us(o)}function ys(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 p0(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 ci=Math.random().toString(36).slice(2),br="__reactFiber$"+ci,Sa="__reactProps$"+ci,zr="__reactContainer$"+ci,Rd="__reactEvents$"+ci,dA="__reactListeners$"+ci,fA="__reactHandles$"+ci;function ro(r){var o=r[br];if(o)return o;for(var c=r.parentNode;c;){if(o=c[zr]||c[br]){if(c=o.alternate,o.child!==null||c!==null&&c.child!==null)for(r=p0(r);r!==null;){if(c=r[br])return c;r=p0(r)}return o}r=c,c=r.parentNode}return null}function Na(r){return r=r[br]||r[zr],!r||r.tag!==5&&r.tag!==6&&r.tag!==13&&r.tag!==3?null:r}function ui(r){if(r.tag===5||r.tag===6)return r.stateNode;throw Error(n(33))}function oc(r){return r[Sa]||null}var Ad=[],di=-1;function vs(r){return{current:r}}function ht(r){0>di||(r.current=Ad[di],Ad[di]=null,di--)}function dt(r,o){di++,Ad[di]=r.current,r.current=o}var ws={},Yt=vs(ws),sn=vs(!1),so=ws;function fi(r,o){var c=r.type.contextTypes;if(!c)return ws;var m=r.stateNode;if(m&&m.__reactInternalMemoizedUnmaskedChildContext===o)return m.__reactInternalMemoizedMaskedChildContext;var y={},x;for(x in c)y[x]=o[x];return m&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=o,r.__reactInternalMemoizedMaskedChildContext=y),y}function on(r){return r=r.childContextTypes,r!=null}function ic(){ht(sn),ht(Yt)}function m0(r,o,c){if(Yt.current!==ws)throw Error(n(168));dt(Yt,o),dt(sn,c)}function g0(r,o,c){var m=r.stateNode;if(o=o.childContextTypes,typeof m.getChildContext!="function")return c;m=m.getChildContext();for(var y in m)if(!(y in o))throw Error(n(108,se(r)||"Unknown",y));return J({},c,m)}function ac(r){return r=(r=r.stateNode)&&r.__reactInternalMemoizedMergedChildContext||ws,so=Yt.current,dt(Yt,r),dt(sn,sn.current),!0}function y0(r,o,c){var m=r.stateNode;if(!m)throw Error(n(169));c?(r=g0(r,o,so),m.__reactInternalMemoizedMergedChildContext=r,ht(sn),ht(Yt),dt(Yt,r)):ht(sn),dt(sn,c)}var Br=null,lc=!1,Md=!1;function v0(r){Br===null?Br=[r]:Br.push(r)}function hA(r){lc=!0,v0(r)}function xs(){if(!Md&&Br!==null){Md=!0;var r=0,o=Qe;try{var c=Br;for(Qe=1;r<c.length;r++){var m=c[r];do m=m(!0);while(m!==null)}Br=null,lc=!1}catch(y){throw Br!==null&&(Br=Br.slice(r+1)),Ds(rs,xs),y}finally{Qe=o,Md=!1}}return null}var hi=[],pi=0,cc=null,uc=0,jn=[],Tn=0,oo=null,Ur=1,Wr="";function io(r,o){hi[pi++]=uc,hi[pi++]=cc,cc=r,uc=o}function w0(r,o,c){jn[Tn++]=Ur,jn[Tn++]=Wr,jn[Tn++]=oo,oo=r;var m=Ur;r=Wr;var y=32-pn(m)-1;m&=~(1<<y),c+=1;var x=32-pn(o)+y;if(30<x){var T=y-y%5;x=(m&(1<<T)-1).toString(32),m>>=T,y-=T,Ur=1<<32-pn(o)+y|c<<y|m,Wr=x+r}else Ur=1<<x|c<<y|m,Wr=r}function Id(r){r.return!==null&&(io(r,1),w0(r,1,0))}function Od(r){for(;r===cc;)cc=hi[--pi],hi[pi]=null,uc=hi[--pi],hi[pi]=null;for(;r===oo;)oo=jn[--Tn],jn[Tn]=null,Wr=jn[--Tn],jn[Tn]=null,Ur=jn[--Tn],jn[Tn]=null}var gn=null,yn=null,mt=!1,Xn=null;function x0(r,o){var c=In(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 b0(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,gn=r,yn=ys(o.firstChild),!0):!1;case 6:return o=r.pendingProps===""||o.nodeType!==3?null:o,o!==null?(r.stateNode=o,gn=r,yn=null,!0):!1;case 13:return o=o.nodeType!==8?null:o,o!==null?(c=oo!==null?{id:Ur,overflow:Wr}:null,r.memoizedState={dehydrated:o,treeContext:c,retryLane:1073741824},c=In(18,null,null,0),c.stateNode=o,c.return=r,r.child=c,gn=r,yn=null,!0):!1;default:return!1}}function Pd(r){return(r.mode&1)!==0&&(r.flags&128)===0}function $d(r){if(mt){var o=yn;if(o){var c=o;if(!b0(r,o)){if(Pd(r))throw Error(n(418));o=ys(c.nextSibling);var m=gn;o&&b0(r,o)?x0(m,c):(r.flags=r.flags&-4097|2,mt=!1,gn=r)}}else{if(Pd(r))throw Error(n(418));r.flags=r.flags&-4097|2,mt=!1,gn=r}}}function k0(r){for(r=r.return;r!==null&&r.tag!==5&&r.tag!==3&&r.tag!==13;)r=r.return;gn=r}function dc(r){if(r!==gn)return!1;if(!mt)return k0(r),mt=!0,!1;var o;if((o=r.tag!==3)&&!(o=r.tag!==5)&&(o=r.type,o=o!=="head"&&o!=="body"&&!Cd(r.type,r.memoizedProps)),o&&(o=yn)){if(Pd(r))throw _0(),Error(n(418));for(;o;)x0(r,o),o=ys(o.nextSibling)}if(k0(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){yn=ys(r.nextSibling);break e}o--}else c!=="$"&&c!=="$!"&&c!=="$?"||o++}r=r.nextSibling}yn=null}}else yn=gn?ys(r.stateNode.nextSibling):null;return!0}function _0(){for(var r=yn;r;)r=ys(r.nextSibling)}function mi(){yn=gn=null,mt=!1}function Ld(r){Xn===null?Xn=[r]:Xn.push(r)}var pA=j.ReactCurrentBatchConfig;function Ea(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 y=m,x=""+r;return o!==null&&o.ref!==null&&typeof o.ref=="function"&&o.ref._stringRef===x?o.ref:(o=function(T){var U=y.refs;T===null?delete U[x]:U[x]=T},o._stringRef=x,o)}if(typeof r!="string")throw Error(n(284));if(!c._owner)throw Error(n(290,r))}return r}function fc(r,o){throw r=Object.prototype.toString.call(o),Error(n(31,r==="[object Object]"?"object with keys {"+Object.keys(o).join(", ")+"}":r))}function S0(r){var o=r._init;return o(r._payload)}function N0(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 y(oe,te){return oe=js(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 T(oe){return r&&oe.alternate===null&&(oe.flags|=2),oe}function U(oe,te,ie,we){return te===null||te.tag!==6?(te=Tf(ie,oe.mode,we),te.return=oe,te):(te=y(te,ie),te.return=oe,te)}function ee(oe,te,ie,we){var Me=ie.type;return Me===P?ye(oe,te,ie.props.children,we,ie.key):te!==null&&(te.elementType===Me||typeof Me=="object"&&Me!==null&&Me.$$typeof===W&&S0(Me)===te.type)?(we=y(te,ie.props),we.ref=Ea(oe,te,ie),we.return=oe,we):(we=$c(ie.type,ie.key,ie.props,null,oe.mode,we),we.ref=Ea(oe,te,ie),we.return=oe,we)}function ce(oe,te,ie,we){return te===null||te.tag!==4||te.stateNode.containerInfo!==ie.containerInfo||te.stateNode.implementation!==ie.implementation?(te=Rf(ie,oe.mode,we),te.return=oe,te):(te=y(te,ie.children||[]),te.return=oe,te)}function ye(oe,te,ie,we,Me){return te===null||te.tag!==7?(te=mo(ie,oe.mode,we,Me),te.return=oe,te):(te=y(te,ie),te.return=oe,te)}function ve(oe,te,ie){if(typeof te=="string"&&te!==""||typeof te=="number")return te=Tf(""+te,oe.mode,ie),te.return=oe,te;if(typeof te=="object"&&te!==null){switch(te.$$typeof){case I:return ie=$c(te.type,te.key,te.props,null,oe.mode,ie),ie.ref=Ea(oe,null,te),ie.return=oe,ie;case O:return te=Rf(te,oe.mode,ie),te.return=oe,te;case W:var we=te._init;return ve(oe,we(te._payload),ie)}if(rt(te)||B(te))return te=mo(te,oe.mode,ie,null),te.return=oe,te;fc(oe,te)}return null}function ge(oe,te,ie,we){var Me=te!==null?te.key:null;if(typeof ie=="string"&&ie!==""||typeof ie=="number")return Me!==null?null:U(oe,te,""+ie,we);if(typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case I:return ie.key===Me?ee(oe,te,ie,we):null;case O:return ie.key===Me?ce(oe,te,ie,we):null;case W:return Me=ie._init,ge(oe,te,Me(ie._payload),we)}if(rt(ie)||B(ie))return Me!==null?null:ye(oe,te,ie,we,null);fc(oe,ie)}return null}function _e(oe,te,ie,we,Me){if(typeof we=="string"&&we!==""||typeof we=="number")return oe=oe.get(ie)||null,U(te,oe,""+we,Me);if(typeof we=="object"&&we!==null){switch(we.$$typeof){case I:return oe=oe.get(we.key===null?ie:we.key)||null,ee(te,oe,we,Me);case O:return oe=oe.get(we.key===null?ie:we.key)||null,ce(te,oe,we,Me);case W:var qe=we._init;return _e(oe,te,ie,qe(we._payload),Me)}if(rt(we)||B(we))return oe=oe.get(ie)||null,ye(te,oe,we,Me,null);fc(te,we)}return null}function je(oe,te,ie,we){for(var Me=null,qe=null,De=te,We=te=0,Ft=null;De!==null&&We<ie.length;We++){De.index>We?(Ft=De,De=null):Ft=De.sibling;var nt=ge(oe,De,ie[We],we);if(nt===null){De===null&&(De=Ft);break}r&&De&&nt.alternate===null&&o(oe,De),te=x(nt,te,We),qe===null?Me=nt:qe.sibling=nt,qe=nt,De=Ft}if(We===ie.length)return c(oe,De),mt&&io(oe,We),Me;if(De===null){for(;We<ie.length;We++)De=ve(oe,ie[We],we),De!==null&&(te=x(De,te,We),qe===null?Me=De:qe.sibling=De,qe=De);return mt&&io(oe,We),Me}for(De=m(oe,De);We<ie.length;We++)Ft=_e(De,oe,We,ie[We],we),Ft!==null&&(r&&Ft.alternate!==null&&De.delete(Ft.key===null?We:Ft.key),te=x(Ft,te,We),qe===null?Me=Ft:qe.sibling=Ft,qe=Ft);return r&&De.forEach(function(Ts){return o(oe,Ts)}),mt&&io(oe,We),Me}function Re(oe,te,ie,we){var Me=B(ie);if(typeof Me!="function")throw Error(n(150));if(ie=Me.call(ie),ie==null)throw Error(n(151));for(var qe=Me=null,De=te,We=te=0,Ft=null,nt=ie.next();De!==null&&!nt.done;We++,nt=ie.next()){De.index>We?(Ft=De,De=null):Ft=De.sibling;var Ts=ge(oe,De,nt.value,we);if(Ts===null){De===null&&(De=Ft);break}r&&De&&Ts.alternate===null&&o(oe,De),te=x(Ts,te,We),qe===null?Me=Ts:qe.sibling=Ts,qe=Ts,De=Ft}if(nt.done)return c(oe,De),mt&&io(oe,We),Me;if(De===null){for(;!nt.done;We++,nt=ie.next())nt=ve(oe,nt.value,we),nt!==null&&(te=x(nt,te,We),qe===null?Me=nt:qe.sibling=nt,qe=nt);return mt&&io(oe,We),Me}for(De=m(oe,De);!nt.done;We++,nt=ie.next())nt=_e(De,oe,We,nt.value,we),nt!==null&&(r&&nt.alternate!==null&&De.delete(nt.key===null?We:nt.key),te=x(nt,te,We),qe===null?Me=nt:qe.sibling=nt,qe=nt);return r&&De.forEach(function(VA){return o(oe,VA)}),mt&&io(oe,We),Me}function jt(oe,te,ie,we){if(typeof ie=="object"&&ie!==null&&ie.type===P&&ie.key===null&&(ie=ie.props.children),typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case I:e:{for(var Me=ie.key,qe=te;qe!==null;){if(qe.key===Me){if(Me=ie.type,Me===P){if(qe.tag===7){c(oe,qe.sibling),te=y(qe,ie.props.children),te.return=oe,oe=te;break e}}else if(qe.elementType===Me||typeof Me=="object"&&Me!==null&&Me.$$typeof===W&&S0(Me)===qe.type){c(oe,qe.sibling),te=y(qe,ie.props),te.ref=Ea(oe,qe,ie),te.return=oe,oe=te;break e}c(oe,qe);break}else o(oe,qe);qe=qe.sibling}ie.type===P?(te=mo(ie.props.children,oe.mode,we,ie.key),te.return=oe,oe=te):(we=$c(ie.type,ie.key,ie.props,null,oe.mode,we),we.ref=Ea(oe,te,ie),we.return=oe,oe=we)}return T(oe);case O: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=y(te,ie.children||[]),te.return=oe,oe=te;break e}else{c(oe,te);break}else o(oe,te);te=te.sibling}te=Rf(ie,oe.mode,we),te.return=oe,oe=te}return T(oe);case W:return qe=ie._init,jt(oe,te,qe(ie._payload),we)}if(rt(ie))return je(oe,te,ie,we);if(B(ie))return Re(oe,te,ie,we);fc(oe,ie)}return typeof ie=="string"&&ie!==""||typeof ie=="number"?(ie=""+ie,te!==null&&te.tag===6?(c(oe,te.sibling),te=y(te,ie),te.return=oe,oe=te):(c(oe,te),te=Tf(ie,oe.mode,we),te.return=oe,oe=te),T(oe)):c(oe,te)}return jt}var gi=N0(!0),E0=N0(!1),hc=vs(null),pc=null,yi=null,qd=null;function Dd(){qd=yi=pc=null}function Fd(r){var o=hc.current;ht(hc),r._currentValue=o}function zd(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 vi(r,o){pc=r,qd=yi=null,r=r.dependencies,r!==null&&r.firstContext!==null&&((r.lanes&o)!==0&&(an=!0),r.firstContext=null)}function Rn(r){var o=r._currentValue;if(qd!==r)if(r={context:r,memoizedValue:o,next:null},yi===null){if(pc===null)throw Error(n(308));yi=r,pc.dependencies={lanes:0,firstContext:r}}else yi=yi.next=r;return o}var ao=null;function Bd(r){ao===null?ao=[r]:ao.push(r)}function C0(r,o,c,m){var y=o.interleaved;return y===null?(c.next=c,Bd(o)):(c.next=y.next,y.next=c),o.interleaved=c,Hr(r,m)}function Hr(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 bs=!1;function Ud(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function j0(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 Gr(r,o){return{eventTime:r,lane:o,tag:0,payload:null,callback:null,next:null}}function ks(r,o,c){var m=r.updateQueue;if(m===null)return null;if(m=m.shared,(Je&2)!==0){var y=m.pending;return y===null?o.next=o:(o.next=y.next,y.next=o),m.pending=o,Hr(r,c)}return y=m.interleaved,y===null?(o.next=o,Bd(m)):(o.next=y.next,y.next=o),m.interleaved=o,Hr(r,c)}function mc(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,ls(r,c)}}function T0(r,o){var c=r.updateQueue,m=r.alternate;if(m!==null&&(m=m.updateQueue,c===m)){var y=null,x=null;if(c=c.firstBaseUpdate,c!==null){do{var T={eventTime:c.eventTime,lane:c.lane,tag:c.tag,payload:c.payload,callback:c.callback,next:null};x===null?y=x=T:x=x.next=T,c=c.next}while(c!==null);x===null?y=x=o:x=x.next=o}else y=x=o;c={baseState:m.baseState,firstBaseUpdate:y,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 gc(r,o,c,m){var y=r.updateQueue;bs=!1;var x=y.firstBaseUpdate,T=y.lastBaseUpdate,U=y.shared.pending;if(U!==null){y.shared.pending=null;var ee=U,ce=ee.next;ee.next=null,T===null?x=ce:T.next=ce,T=ee;var ye=r.alternate;ye!==null&&(ye=ye.updateQueue,U=ye.lastBaseUpdate,U!==T&&(U===null?ye.firstBaseUpdate=ce:U.next=ce,ye.lastBaseUpdate=ee))}if(x!==null){var ve=y.baseState;T=0,ye=ce=ee=null,U=x;do{var ge=U.lane,_e=U.eventTime;if((m&ge)===ge){ye!==null&&(ye=ye.next={eventTime:_e,lane:0,tag:U.tag,payload:U.payload,callback:U.callback,next:null});e:{var je=r,Re=U;switch(ge=o,_e=c,Re.tag){case 1:if(je=Re.payload,typeof je=="function"){ve=je.call(_e,ve,ge);break e}ve=je;break e;case 3:je.flags=je.flags&-65537|128;case 0:if(je=Re.payload,ge=typeof je=="function"?je.call(_e,ve,ge):je,ge==null)break e;ve=J({},ve,ge);break e;case 2:bs=!0}}U.callback!==null&&U.lane!==0&&(r.flags|=64,ge=y.effects,ge===null?y.effects=[U]:ge.push(U))}else _e={eventTime:_e,lane:ge,tag:U.tag,payload:U.payload,callback:U.callback,next:null},ye===null?(ce=ye=_e,ee=ve):ye=ye.next=_e,T|=ge;if(U=U.next,U===null){if(U=y.shared.pending,U===null)break;ge=U,U=ge.next,ge.next=null,y.lastBaseUpdate=ge,y.shared.pending=null}}while(!0);if(ye===null&&(ee=ve),y.baseState=ee,y.firstBaseUpdate=ce,y.lastBaseUpdate=ye,o=y.shared.interleaved,o!==null){y=o;do T|=y.lane,y=y.next;while(y!==o)}else x===null&&(y.shared.lanes=0);uo|=T,r.lanes=T,r.memoizedState=ve}}function R0(r,o,c){if(r=o.effects,o.effects=null,r!==null)for(o=0;o<r.length;o++){var m=r[o],y=m.callback;if(y!==null){if(m.callback=null,m=c,typeof y!="function")throw Error(n(191,y));y.call(m)}}}var Ca={},kr=vs(Ca),ja=vs(Ca),Ta=vs(Ca);function lo(r){if(r===Ca)throw Error(n(174));return r}function Wd(r,o){switch(dt(Ta,o),dt(ja,r),dt(kr,Ca),r=o.nodeType,r){case 9:case 11:o=(o=o.documentElement)?o.namespaceURI:ke(null,"");break;default:r=r===8?o.parentNode:o,o=r.namespaceURI||null,r=r.tagName,o=ke(o,r)}ht(kr),dt(kr,o)}function wi(){ht(kr),ht(ja),ht(Ta)}function A0(r){lo(Ta.current);var o=lo(kr.current),c=ke(o,r.type);o!==c&&(dt(ja,r),dt(kr,c))}function Hd(r){ja.current===r&&(ht(kr),ht(ja))}var bt=vs(0);function yc(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 Gd=[];function Vd(){for(var r=0;r<Gd.length;r++)Gd[r]._workInProgressVersionPrimary=null;Gd.length=0}var vc=j.ReactCurrentDispatcher,Yd=j.ReactCurrentBatchConfig,co=0,kt=null,Pt=null,qt=null,wc=!1,Ra=!1,Aa=0,mA=0;function Kt(){throw Error(n(321))}function Kd(r,o){if(o===null)return!1;for(var c=0;c<o.length&&c<r.length;c++)if(!D(r[c],o[c]))return!1;return!0}function Xd(r,o,c,m,y,x){if(co=x,kt=o,o.memoizedState=null,o.updateQueue=null,o.lanes=0,vc.current=r===null||r.memoizedState===null?wA:xA,r=c(m,y),Ra){x=0;do{if(Ra=!1,Aa=0,25<=x)throw Error(n(301));x+=1,qt=Pt=null,o.updateQueue=null,vc.current=bA,r=c(m,y)}while(Ra)}if(vc.current=kc,o=Pt!==null&&Pt.next!==null,co=0,qt=Pt=kt=null,wc=!1,o)throw Error(n(300));return r}function Qd(){var r=Aa!==0;return Aa=0,r}function _r(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return qt===null?kt.memoizedState=qt=r:qt=qt.next=r,qt}function An(){if(Pt===null){var r=kt.alternate;r=r!==null?r.memoizedState:null}else r=Pt.next;var o=qt===null?kt.memoizedState:qt.next;if(o!==null)qt=o,Pt=r;else{if(r===null)throw Error(n(310));Pt=r,r={memoizedState:Pt.memoizedState,baseState:Pt.baseState,baseQueue:Pt.baseQueue,queue:Pt.queue,next:null},qt===null?kt.memoizedState=qt=r:qt=qt.next=r}return qt}function Ma(r,o){return typeof o=="function"?o(r):o}function Zd(r){var o=An(),c=o.queue;if(c===null)throw Error(n(311));c.lastRenderedReducer=r;var m=Pt,y=m.baseQueue,x=c.pending;if(x!==null){if(y!==null){var T=y.next;y.next=x.next,x.next=T}m.baseQueue=y=x,c.pending=null}if(y!==null){x=y.next,m=m.baseState;var U=T=null,ee=null,ce=x;do{var ye=ce.lane;if((co&ye)===ye)ee!==null&&(ee=ee.next={lane:0,action:ce.action,hasEagerState:ce.hasEagerState,eagerState:ce.eagerState,next:null}),m=ce.hasEagerState?ce.eagerState:r(m,ce.action);else{var ve={lane:ye,action:ce.action,hasEagerState:ce.hasEagerState,eagerState:ce.eagerState,next:null};ee===null?(U=ee=ve,T=m):ee=ee.next=ve,kt.lanes|=ye,uo|=ye}ce=ce.next}while(ce!==null&&ce!==x);ee===null?T=m:ee.next=U,D(m,o.memoizedState)||(an=!0),o.memoizedState=m,o.baseState=T,o.baseQueue=ee,c.lastRenderedState=m}if(r=c.interleaved,r!==null){y=r;do x=y.lane,kt.lanes|=x,uo|=x,y=y.next;while(y!==r)}else y===null&&(c.lanes=0);return[o.memoizedState,c.dispatch]}function Jd(r){var o=An(),c=o.queue;if(c===null)throw Error(n(311));c.lastRenderedReducer=r;var m=c.dispatch,y=c.pending,x=o.memoizedState;if(y!==null){c.pending=null;var T=y=y.next;do x=r(x,T.action),T=T.next;while(T!==y);D(x,o.memoizedState)||(an=!0),o.memoizedState=x,o.baseQueue===null&&(o.baseState=x),c.lastRenderedState=x}return[x,m]}function M0(){}function I0(r,o){var c=kt,m=An(),y=o(),x=!D(m.memoizedState,y);if(x&&(m.memoizedState=y,an=!0),m=m.queue,ef($0.bind(null,c,m,r),[r]),m.getSnapshot!==o||x||qt!==null&&qt.memoizedState.tag&1){if(c.flags|=2048,Ia(9,P0.bind(null,c,m,y,o),void 0,null),Dt===null)throw Error(n(349));(co&30)!==0||O0(c,o,y)}return y}function O0(r,o,c){r.flags|=16384,r={getSnapshot:o,value:c},o=kt.updateQueue,o===null?(o={lastEffect:null,stores:null},kt.updateQueue=o,o.stores=[r]):(c=o.stores,c===null?o.stores=[r]:c.push(r))}function P0(r,o,c,m){o.value=c,o.getSnapshot=m,L0(o)&&q0(r)}function $0(r,o,c){return c(function(){L0(o)&&q0(r)})}function L0(r){var o=r.getSnapshot;r=r.value;try{var c=o();return!D(r,c)}catch{return!0}}function q0(r){var o=Hr(r,1);o!==null&&er(o,r,1,-1)}function D0(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:Ma,lastRenderedState:r},o.queue=r,r=r.dispatch=vA.bind(null,kt,r),[o.memoizedState,r]}function Ia(r,o,c,m){return r={tag:r,create:o,destroy:c,deps:m,next:null},o=kt.updateQueue,o===null?(o={lastEffect:null,stores:null},kt.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 F0(){return An().memoizedState}function xc(r,o,c,m){var y=_r();kt.flags|=r,y.memoizedState=Ia(1|o,c,void 0,m===void 0?null:m)}function bc(r,o,c,m){var y=An();m=m===void 0?null:m;var x=void 0;if(Pt!==null){var T=Pt.memoizedState;if(x=T.destroy,m!==null&&Kd(m,T.deps)){y.memoizedState=Ia(o,c,x,m);return}}kt.flags|=r,y.memoizedState=Ia(1|o,c,x,m)}function z0(r,o){return xc(8390656,8,r,o)}function ef(r,o){return bc(2048,8,r,o)}function B0(r,o){return bc(4,2,r,o)}function U0(r,o){return bc(4,4,r,o)}function W0(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 H0(r,o,c){return c=c!=null?c.concat([r]):null,bc(4,4,W0.bind(null,o,r),c)}function tf(){}function G0(r,o){var c=An();o=o===void 0?null:o;var m=c.memoizedState;return m!==null&&o!==null&&Kd(o,m[1])?m[0]:(c.memoizedState=[r,o],r)}function V0(r,o){var c=An();o=o===void 0?null:o;var m=c.memoizedState;return m!==null&&o!==null&&Kd(o,m[1])?m[0]:(r=r(),c.memoizedState=[r,o],r)}function Y0(r,o,c){return(co&21)===0?(r.baseState&&(r.baseState=!1,an=!0),r.memoizedState=c):(D(c,o)||(c=Bs(),kt.lanes|=c,uo|=c,r.baseState=!0),o)}function gA(r,o){var c=Qe;Qe=c!==0&&4>c?c:4,r(!0);var m=Yd.transition;Yd.transition={};try{r(!1),o()}finally{Qe=c,Yd.transition=m}}function K0(){return An().memoizedState}function yA(r,o,c){var m=Es(r);if(c={lane:m,action:c,hasEagerState:!1,eagerState:null,next:null},X0(r))Q0(o,c);else if(c=C0(r,o,c,m),c!==null){var y=nn();er(c,r,m,y),Z0(c,o,m)}}function vA(r,o,c){var m=Es(r),y={lane:m,action:c,hasEagerState:!1,eagerState:null,next:null};if(X0(r))Q0(o,y);else{var x=r.alternate;if(r.lanes===0&&(x===null||x.lanes===0)&&(x=o.lastRenderedReducer,x!==null))try{var T=o.lastRenderedState,U=x(T,c);if(y.hasEagerState=!0,y.eagerState=U,D(U,T)){var ee=o.interleaved;ee===null?(y.next=y,Bd(o)):(y.next=ee.next,ee.next=y),o.interleaved=y;return}}catch{}finally{}c=C0(r,o,y,m),c!==null&&(y=nn(),er(c,r,m,y),Z0(c,o,m))}}function X0(r){var o=r.alternate;return r===kt||o!==null&&o===kt}function Q0(r,o){Ra=wc=!0;var c=r.pending;c===null?o.next=o:(o.next=c.next,c.next=o),r.pending=o}function Z0(r,o,c){if((c&4194240)!==0){var m=o.lanes;m&=r.pendingLanes,c|=m,o.lanes=c,ls(r,c)}}var kc={readContext:Rn,useCallback:Kt,useContext:Kt,useEffect:Kt,useImperativeHandle:Kt,useInsertionEffect:Kt,useLayoutEffect:Kt,useMemo:Kt,useReducer:Kt,useRef:Kt,useState:Kt,useDebugValue:Kt,useDeferredValue:Kt,useTransition:Kt,useMutableSource:Kt,useSyncExternalStore:Kt,useId:Kt,unstable_isNewReconciler:!1},wA={readContext:Rn,useCallback:function(r,o){return _r().memoizedState=[r,o===void 0?null:o],r},useContext:Rn,useEffect:z0,useImperativeHandle:function(r,o,c){return c=c!=null?c.concat([r]):null,xc(4194308,4,W0.bind(null,o,r),c)},useLayoutEffect:function(r,o){return xc(4194308,4,r,o)},useInsertionEffect:function(r,o){return xc(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=yA.bind(null,kt,r),[m.memoizedState,r]},useRef:function(r){var o=_r();return r={current:r},o.memoizedState=r},useState:D0,useDebugValue:tf,useDeferredValue:function(r){return _r().memoizedState=r},useTransition:function(){var r=D0(!1),o=r[0];return r=gA.bind(null,r[1]),_r().memoizedState=r,[o,r]},useMutableSource:function(){},useSyncExternalStore:function(r,o,c){var m=kt,y=_r();if(mt){if(c===void 0)throw Error(n(407));c=c()}else{if(c=o(),Dt===null)throw Error(n(349));(co&30)!==0||O0(m,o,c)}y.memoizedState=c;var x={value:c,getSnapshot:o};return y.queue=x,z0($0.bind(null,m,x,r),[r]),m.flags|=2048,Ia(9,P0.bind(null,m,x,c,o),void 0,null),c},useId:function(){var r=_r(),o=Dt.identifierPrefix;if(mt){var c=Wr,m=Ur;c=(m&~(1<<32-pn(m)-1)).toString(32)+c,o=":"+o+"R"+c,c=Aa++,0<c&&(o+="H"+c.toString(32)),o+=":"}else c=mA++,o=":"+o+"r"+c.toString(32)+":";return r.memoizedState=o},unstable_isNewReconciler:!1},xA={readContext:Rn,useCallback:G0,useContext:Rn,useEffect:ef,useImperativeHandle:H0,useInsertionEffect:B0,useLayoutEffect:U0,useMemo:V0,useReducer:Zd,useRef:F0,useState:function(){return Zd(Ma)},useDebugValue:tf,useDeferredValue:function(r){var o=An();return Y0(o,Pt.memoizedState,r)},useTransition:function(){var r=Zd(Ma)[0],o=An().memoizedState;return[r,o]},useMutableSource:M0,useSyncExternalStore:I0,useId:K0,unstable_isNewReconciler:!1},bA={readContext:Rn,useCallback:G0,useContext:Rn,useEffect:ef,useImperativeHandle:H0,useInsertionEffect:B0,useLayoutEffect:U0,useMemo:V0,useReducer:Jd,useRef:F0,useState:function(){return Jd(Ma)},useDebugValue:tf,useDeferredValue:function(r){var o=An();return Pt===null?o.memoizedState=r:Y0(o,Pt.memoizedState,r)},useTransition:function(){var r=Jd(Ma)[0],o=An().memoizedState;return[r,o]},useMutableSource:M0,useSyncExternalStore:I0,useId:K0,unstable_isNewReconciler:!1};function Qn(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 nf(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 _c={isMounted:function(r){return(r=r._reactInternals)?Nn(r)===r:!1},enqueueSetState:function(r,o,c){r=r._reactInternals;var m=nn(),y=Es(r),x=Gr(m,y);x.payload=o,c!=null&&(x.callback=c),o=ks(r,x,y),o!==null&&(er(o,r,y,m),mc(o,r,y))},enqueueReplaceState:function(r,o,c){r=r._reactInternals;var m=nn(),y=Es(r),x=Gr(m,y);x.tag=1,x.payload=o,c!=null&&(x.callback=c),o=ks(r,x,y),o!==null&&(er(o,r,y,m),mc(o,r,y))},enqueueForceUpdate:function(r,o){r=r._reactInternals;var c=nn(),m=Es(r),y=Gr(c,m);y.tag=2,o!=null&&(y.callback=o),o=ks(r,y,m),o!==null&&(er(o,r,m,c),mc(o,r,m))}};function J0(r,o,c,m,y,x,T){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(m,x,T):o.prototype&&o.prototype.isPureReactComponent?!G(c,m)||!G(y,x):!0}function ex(r,o,c){var m=!1,y=ws,x=o.contextType;return typeof x=="object"&&x!==null?x=Rn(x):(y=on(o)?so:Yt.current,m=o.contextTypes,x=(m=m!=null)?fi(r,y):ws),o=new o(c,x),r.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,o.updater=_c,r.stateNode=o,o._reactInternals=r,m&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=y,r.__reactInternalMemoizedMaskedChildContext=x),o}function tx(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&&_c.enqueueReplaceState(o,o.state,null)}function rf(r,o,c,m){var y=r.stateNode;y.props=c,y.state=r.memoizedState,y.refs={},Ud(r);var x=o.contextType;typeof x=="object"&&x!==null?y.context=Rn(x):(x=on(o)?so:Yt.current,y.context=fi(r,x)),y.state=r.memoizedState,x=o.getDerivedStateFromProps,typeof x=="function"&&(nf(r,o,x,c),y.state=r.memoizedState),typeof o.getDerivedStateFromProps=="function"||typeof y.getSnapshotBeforeUpdate=="function"||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(o=y.state,typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount(),o!==y.state&&_c.enqueueReplaceState(y,y.state,null),gc(r,c,y,m),y.state=r.memoizedState),typeof y.componentDidMount=="function"&&(r.flags|=4194308)}function xi(r,o){try{var c="",m=o;do c+=L(m),m=m.return;while(m);var y=c}catch(x){y=`
36
+ `),T=y.length-1,W=x.length-1;1<=T&&0<=W&&y[T]!==x[W];)W--;for(;1<=T&&0<=W;T--,W--)if(y[T]!==x[W]){if(T!==1||W!==1)do if(T--,W--,0>W||y[T]!==x[W]){var ee=`
37
+ `+y[T].replace(" at new "," at ");return r.displayName&&ee.includes("<anonymous>")&&(ee=ee.replace("<anonymous>",r.displayName)),ee}while(1<=T&&0<=W);break}}}finally{Z=!1,Error.prepareStackTrace=c}return(r=r?r.displayName||r.name:"")?V(r):""}function L(r){switch(r.tag){case 5:return V(r.type);case 16:return V("Lazy");case 13:return V("Suspense");case 19:return V("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 P:return"Fragment";case O:return"Portal";case M:return"Profiler";case z:return"StrictMode";case Y:return"Suspense";case R: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 G:var o=r.render;return r=r.displayName,r||(r=o.displayName||o.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case Q:return o=r.displayName||null,o!==null?o:K(r.type)||"Memo";case H: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===z?"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 me(r){var o=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(o==="checkbox"||o==="radio")}function xe(r){var o=me(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 y=c.get,x=c.set;return Object.defineProperty(r,o,{configurable:!0,get:function(){return y.call(this)},set:function(T){m=""+T,x.call(this,T)}}),Object.defineProperty(r,o,{enumerable:c.enumerable}),{getValue:function(){return m},setValue:function(T){m=""+T},stopTracking:function(){r._valueTracker=null,delete r[o]}}}}function Ee(r){r._valueTracker||(r._valueTracker=xe(r))}function He(r){if(!r)return!1;var o=r._valueTracker;if(!o)return!0;var c=o.getValue(),m="";return r&&(m=me(r)?r.checked?"true":"false":r.value),r=m,r!==c?(o.setValue(r),!0):!1}function Fe(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 Ie(r,o){var c=o.checked;return J({},o,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:c??r._wrapperState.initialChecked})}function be(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 ue(r,o){o=o.checked,o!=null&&C(r,"checked",o,!1)}function re(r,o){ue(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")?Oe(r,o.type,c):o.hasOwnProperty("defaultValue")&&Oe(r,o.type,he(o.defaultValue)),o.checked==null&&o.defaultChecked!=null&&(r.defaultChecked=!!o.defaultChecked)}function pe(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 Oe(r,o,c){(o!=="number"||Fe(r.ownerDocument)!==r)&&(c==null?r.defaultValue=""+r._wrapperState.initialValue:r.defaultValue!==""+c&&(r.defaultValue=""+c))}var nt=Array.isArray;function st(r,o,c,m){if(r=r.options,o){o={};for(var y=0;y<c.length;y++)o["$"+c[y]]=!0;for(c=0;c<r.length;c++)y=o.hasOwnProperty("$"+r[c].value),r[c].selected!==y&&(r[c].selected=y),y&&m&&(r[c].defaultSelected=!0)}else{for(c=""+he(c),o=null,y=0;y<r.length;y++){if(r[y].value===c){r[y].selected=!0,m&&(r[y].defaultSelected=!0);return}o!==null||r[y].disabled||(o=r[y])}o!==null&&(o.selected=!0)}}function Xe(r,o){if(o.dangerouslySetInnerHTML!=null)throw Error(n(91));return J({},o,{value:void 0,defaultValue:void 0,children:""+r._wrapperState.initialValue})}function Pe(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(nt(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 Ue(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 Ge(r){var o=r.textContent;o===r._wrapperState.initialValue&&o!==""&&o!==null&&(r.value=o)}function it(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 ke(r,o){return r==null||r==="http://www.w3.org/1999/xhtml"?it(o):r==="http://www.w3.org/2000/svg"&&o==="foreignObject"?"http://www.w3.org/1999/xhtml":r}var ct,It=(function(r){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(o,c,m,y){MSApp.execUnsafeLocalFunction(function(){return r(o,c,m,y)})}:r})(function(r,o){if(r.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in r)r.innerHTML=o;else{for(ct=ct||document.createElement("div"),ct.innerHTML="<svg>"+o.valueOf().toString()+"</svg>",o=ct.firstChild;r.firstChild;)r.removeChild(r.firstChild);for(;o.firstChild;)r.appendChild(o.firstChild)}});function ae(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},ze=["Webkit","ms","Moz","O"];Object.keys(Le).forEach(function(r){ze.forEach(function(o){o=o+r.charAt(0).toUpperCase()+r.substring(1),Le[o]=Le[r]})});function Ce(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 Ve(r,o){r=r.style;for(var c in o)if(o.hasOwnProperty(c)){var m=c.indexOf("--")===0,y=Ce(c,o[c],m);c==="float"&&(c="cssFloat"),m?r.setProperty(c,y):r[c]=y}}var Ct=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 rt(r,o){if(o){if(Ct[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 Te(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 dt(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var St=null,Sn=null,Fn=null;function Nn(r){if(r=Ma(r)){if(typeof St!="function")throw Error(n(280));var o=r.stateNode;o&&(o=lc(o),St(r.stateNode,r.type,o))}}function To(r){Sn?Fn?Fn.push(r):Fn=[r]:Sn=r}function hn(){if(Sn){var r=Sn,o=Fn;if(Fn=Sn=null,Nn(r),o)for(r=0;r<o.length;r++)Nn(o[r])}}function Ro(r,o){return r(o)}function Ao(){}var Ut=!1;function Tr(r,o,c){if(Ut)return r(o,c);Ut=!0;try{return Ro(r,o,c)}finally{Ut=!1,(Sn!==null||Fn!==null)&&(Ao(),hn())}}function zn(r,o){var c=r.stateNode;if(c===null)return null;var m=lc(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 Ds=!1;if(u)try{var Rr={};Object.defineProperty(Rr,"passive",{get:function(){Ds=!0}}),window.addEventListener("test",Rr,Rr),window.removeEventListener("test",Rr,Rr)}catch{Ds=!1}function na(r,o,c,m,y,x,T,W,ee){var ce=Array.prototype.slice.call(arguments,3);try{o.apply(c,ce)}catch(ye){this.onError(ye)}}var fr=!1,Ar=null,hr=!1,ns=null,Mo={onError:function(r){fr=!0,Ar=r}};function Io(r,o,c,m,y,x,T,W,ee){fr=!1,Ar=null,na.apply(Mo,arguments)}function Oo(r,o,c,m,y,x,T,W,ee){if(Io.apply(this,arguments),fr){if(fr){var ce=Ar;fr=!1,Ar=null}else throw Error(n(198));hr||(hr=!0,ns=ce)}}function En(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 Po(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 Mr(r){if(En(r)!==r)throw Error(n(188))}function $o(r){var o=r.alternate;if(!o){if(o=En(r),o===null)throw Error(n(188));return o!==r?null:r}for(var c=r,m=o;;){var y=c.return;if(y===null)break;var x=y.alternate;if(x===null){if(m=y.return,m!==null){c=m;continue}break}if(y.child===x.child){for(x=y.child;x;){if(x===c)return Mr(y),r;if(x===m)return Mr(y),o;x=x.sibling}throw Error(n(188))}if(c.return!==m.return)c=y,m=x;else{for(var T=!1,W=y.child;W;){if(W===c){T=!0,c=y,m=x;break}if(W===m){T=!0,m=y,c=x;break}W=W.sibling}if(!T){for(W=x.child;W;){if(W===c){T=!0,c=x,m=y;break}if(W===m){T=!0,m=x,c=y;break}W=W.sibling}if(!T)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 Bn(r){return r=$o(r),r!==null?Lo(r):null}function Lo(r){if(r.tag===5||r.tag===6)return r;for(r=r.child;r!==null;){var o=Lo(r);if(o!==null)return o;r=r.sibling}return null}var Fs=t.unstable_scheduleCallback,zs=t.unstable_cancelCallback,qo=t.unstable_shouldYield,Do=t.unstable_requestPaint,at=t.unstable_now,ra=t.unstable_getCurrentPriorityLevel,rs=t.unstable_ImmediatePriority,Vt=t.unstable_UserBlockingPriority,Un=t.unstable_NormalPriority,Fo=t.unstable_LowPriority,ss=t.unstable_IdlePriority,xt=null,rn=null;function Wn(r){if(rn&&typeof rn.onCommitFiberRoot=="function")try{rn.onCommitFiberRoot(xt,r,void 0,(r.current.flags&128)===128)}catch{}}var pn=Math.clz32?Math.clz32:zo,dd=Math.log,Ir=Math.LN2;function zo(r){return r>>>=0,r===0?32:31-(dd(r)/Ir|0)|0}var Bo=64,Uo=4194304;function os(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 Bs(r,o){var c=r.pendingLanes;if(c===0)return 0;var m=0,y=r.suspendedLanes,x=r.pingedLanes,T=c&268435455;if(T!==0){var W=T&~y;W!==0?m=os(W):(x&=T,x!==0&&(m=os(x)))}else T=c&~y,T!==0?m=os(T):x!==0&&(m=os(x));if(m===0)return 0;if(o!==0&&o!==m&&(o&y)===0&&(y=m&-m,x=o&-o,y>=x||y===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-pn(o),y=1<<c,m|=r[c],o&=~y;return m}function is(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 Dl(r,o){for(var c=r.suspendedLanes,m=r.pingedLanes,y=r.expirationTimes,x=r.pendingLanes;0<x;){var T=31-pn(x),W=1<<T,ee=y[T];ee===-1?((W&c)===0||(W&m)!==0)&&(y[T]=is(W,o)):ee<=o&&(r.expiredLanes|=W),x&=~W}}function Wo(r){return r=r.pendingLanes&-1073741825,r!==0?r:r&1073741824?1073741824:0}function Us(){var r=Bo;return Bo<<=1,(Bo&4194240)===0&&(Bo=64),r}function Ho(r){for(var o=[],c=0;31>c;c++)o.push(r);return o}function as(r,o,c){r.pendingLanes|=o,o!==536870912&&(r.suspendedLanes=0,r.pingedLanes=0),r=r.eventTimes,o=31-pn(o),r[o]=c}function Zt(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 y=31-pn(c),x=1<<y;o[y]=0,m[y]=-1,r[y]=-1,c&=~x}}function ls(r,o){var c=r.entangledLanes|=o;for(r=r.entanglements;c;){var m=31-pn(c),y=1<<m;y&o|r[m]&o&&(r[m]|=o),c&=~y}}var Qe=0;function sa(r){return r&=-r,1<r?4<r?(r&268435455)!==0?16:536870912:4:1}var Fl,Or,oa,Hn,zl,Go=!1,Vo=[],pr=null,Gn=null,mr=null,mn=new Map,Vn=new Map,Yn=[],ia="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 Kn(r,o){switch(r){case"focusin":case"focusout":pr=null;break;case"dragenter":case"dragleave":Gn=null;break;case"mouseover":case"mouseout":mr=null;break;case"pointerover":case"pointerout":mn.delete(o.pointerId);break;case"gotpointercapture":case"lostpointercapture":Vn.delete(o.pointerId)}}function Ws(r,o,c,m,y,x){return r===null||r.nativeEvent!==x?(r={blockedOn:o,domEventName:c,eventSystemFlags:m,nativeEvent:x,targetContainers:[y]},o!==null&&(o=Ma(o),o!==null&&Or(o)),r):(r.eventSystemFlags|=m,o=r.targetContainers,y!==null&&o.indexOf(y)===-1&&o.push(y),r)}function Cn(r,o,c,m,y){switch(o){case"focusin":return pr=Ws(pr,r,o,c,m,y),!0;case"dragenter":return Gn=Ws(Gn,r,o,c,m,y),!0;case"mouseover":return mr=Ws(mr,r,o,c,m,y),!0;case"pointerover":var x=y.pointerId;return mn.set(x,Ws(mn.get(x)||null,r,o,c,m,y)),!0;case"gotpointercapture":return x=y.pointerId,Vn.set(x,Ws(Vn.get(x)||null,r,o,c,m,y)),!0}return!1}function Yo(r){var o=no(r.target);if(o!==null){var c=En(o);if(c!==null){if(o=c.tag,o===13){if(o=Po(c),o!==null){r.blockedOn=o,zl(r.priority,function(){oa(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 cs(r){if(r.blockedOn!==null)return!1;for(var o=r.targetContainers;0<o.length;){var c=Xo(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=Ma(c),o!==null&&Or(o),r.blockedOn=c,!1;o.shift()}return!0}function aa(r,o,c){cs(r)&&c.delete(o)}function Ko(){Go=!1,pr!==null&&cs(pr)&&(pr=null),Gn!==null&&cs(Gn)&&(Gn=null),mr!==null&&cs(mr)&&(mr=null),mn.forEach(aa),Vn.forEach(aa)}function Pr(r,o){r.blockedOn===o&&(r.blockedOn=null,Go||(Go=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Ko)))}function us(r){function o(y){return Pr(y,r)}if(0<Vo.length){Pr(Vo[0],r);for(var c=1;c<Vo.length;c++){var m=Vo[c];m.blockedOn===r&&(m.blockedOn=null)}}for(pr!==null&&Pr(pr,r),Gn!==null&&Pr(Gn,r),mr!==null&&Pr(mr,r),mn.forEach(o),Vn.forEach(o),c=0;c<Yn.length;c++)m=Yn[c],m.blockedOn===r&&(m.blockedOn=null);for(;0<Yn.length&&(c=Yn[0],c.blockedOn===null);)Yo(c),c.blockedOn===null&&Yn.shift()}var gr=j.ReactCurrentBatchConfig,Hs=!0;function la(r,o,c,m){var y=Qe,x=gr.transition;gr.transition=null;try{Qe=1,yr(r,o,c,m)}finally{Qe=y,gr.transition=x}}function Bl(r,o,c,m){var y=Qe,x=gr.transition;gr.transition=null;try{Qe=4,yr(r,o,c,m)}finally{Qe=y,gr.transition=x}}function yr(r,o,c,m){if(Hs){var y=Xo(r,o,c,m);if(y===null)Ed(r,o,m,Gs,c),Kn(r,m);else if(Cn(y,r,o,c,m))m.stopPropagation();else if(Kn(r,m),o&4&&-1<ia.indexOf(r)){for(;y!==null;){var x=Ma(y);if(x!==null&&Fl(x),x=Xo(r,o,c,m),x===null&&Ed(r,o,m,Gs,c),x===y)break;y=x}y!==null&&m.stopPropagation()}else Ed(r,o,m,null,c)}}var Gs=null;function Xo(r,o,c,m){if(Gs=null,r=dt(m),r=no(r),r!==null)if(o=En(r),o===null)r=null;else if(c=o.tag,c===13){if(r=Po(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 Gs=r,null}function Qo(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(ra()){case rs:return 1;case Vt:return 4;case Un:case Fo:return 16;case ss:return 536870912;default:return 16}default:return 16}}var vr=null,Vs=null,Xn=null;function ca(){if(Xn)return Xn;var r,o=Vs,c=o.length,m,y="value"in vr?vr.value:vr.textContent,x=y.length;for(r=0;r<c&&o[r]===y[r];r++);var T=c-r;for(m=1;m<=T&&o[c-m]===y[x-m];m++);return Xn=y.slice(r,1<m?1-m:void 0)}function Zo(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 Ys(){return!0}function ua(){return!1}function Jt(r){function o(c,m,y,x,T){this._reactName=c,this._targetInst=y,this.type=m,this.nativeEvent=x,this.target=T,this.currentTarget=null;for(var W in r)r.hasOwnProperty(W)&&(c=r[W],this[W]=c?c(x):x[W]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?Ys:ua,this.isPropagationStopped=ua,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=Ys)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=Ys)},persist:function(){},isPersistent:Ys}),o}var Ot={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},da=Jt(Ot),$r=J({},Ot,{view:0,detail:0}),ds=Jt($r),Lr,Ks,qr,Xs=J({},$r,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:jn,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!==qr&&(qr&&r.type==="mousemove"?(Lr=r.screenX-qr.screenX,Ks=r.screenY-qr.screenY):Ks=Lr=0,qr=r),Lr)},movementY:function(r){return"movementY"in r?r.movementY:Ks}}),Qs=Jt(Xs),Ul=J({},Xs,{dataTransfer:0}),fd=Jt(Ul),hd=J({},$r,{relatedTarget:0}),Jo=Jt(hd),pd=J({},Ot,{animationName:0,elapsedTime:0,pseudoElement:0}),md=Jt(pd),fa=J({},Ot,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),wr=Jt(fa),ha=J({},Ot,{data:0}),pa=Jt(ha),gd={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},yd={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"},Wl={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Hl(r){var o=this.nativeEvent;return o.getModifierState?o.getModifierState(r):(r=Wl[r])?!!o[r]:!1}function jn(){return Hl}var vd=J({},$r,{key:function(r){if(r.key){var o=gd[r.key]||r.key;if(o!=="Unidentified")return o}return r.type==="keypress"?(r=Zo(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?yd[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:jn,charCode:function(r){return r.type==="keypress"?Zo(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?Zo(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),Gl=Jt(vd),wd=J({},Xs,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Zs=Jt(wd),xd=J({},$r,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:jn}),en=Jt(xd),ma=J({},Ot,{propertyName:0,elapsedTime:0,pseudoElement:0}),Vl=Jt(ma),Yl=J({},Xs,{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}),Kl=Jt(Yl),ga=[9,13,27,32],fs=u&&"CompositionEvent"in window,Dr=null;u&&"documentMode"in document&&(Dr=document.documentMode);var Xl=u&&"TextEvent"in window&&!Dr,Js=u&&(!fs||Dr&&8<Dr&&11>=Dr),ya=" ",ei=!1;function ti(r,o){switch(r){case"keyup":return ga.indexOf(o.keyCode)!==-1;case"keydown":return o.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ni(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var bt=!1;function Ql(r,o){switch(r){case"compositionend":return ni(o);case"keypress":return o.which!==32?null:(ei=!0,ya);case"textInput":return r=o.data,r===ya&&ei?null:r;default:return null}}function Zl(r,o){if(bt)return r==="compositionend"||!fs&&ti(r,o)?(r=ca(),Xn=Vs=vr=null,bt=!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 Js&&o.locale!=="ko"?null:o.data;default:return null}}var bd={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 Jl(r){var o=r&&r.nodeName&&r.nodeName.toLowerCase();return o==="input"?!!bd[r.type]:o==="textarea"}function va(r,o,c,m){To(m),o=oc(o,"onChange"),0<o.length&&(c=new da("onChange","change",null,c,m),r.push({event:c,listeners:o}))}var xr=null,eo=null;function Fr(r){c0(r,0)}function hs(r){var o=ci(r);if(He(o))return r}function kd(r,o){if(r==="change")return o}var ec=!1;if(u){var Qn;if(u){var to="oninput"in document;if(!to){var tc=document.createElement("div");tc.setAttribute("oninput","return;"),to=typeof tc.oninput=="function"}Qn=to}else Qn=!1;ec=Qn&&(!document.documentMode||9<document.documentMode)}function wa(){xr&&(xr.detachEvent("onpropertychange",nc),eo=xr=null)}function nc(r){if(r.propertyName==="value"&&hs(eo)){var o=[];va(o,eo,r,dt(r)),Tr(Fr,o)}}function a0(r,o,c){r==="focusin"?(wa(),xr=o,eo=c,xr.attachEvent("onpropertychange",nc)):r==="focusout"&&wa()}function xa(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return hs(eo)}function _d(r,o){if(r==="click")return hs(o)}function ri(r,o){if(r==="input"||r==="change")return hs(o)}function ba(r,o){return r===o&&(r!==0||1/r===1/o)||r!==r&&o!==o}var gn=typeof Object.is=="function"?Object.is:ba;function ps(r,o){if(gn(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 y=c[m];if(!h.call(o,y)||!gn(r[y],o[y]))return!1}return!0}function ka(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function _a(r,o){var c=ka(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=ka(c)}}function Sa(r,o){return r&&o?r===o?!0:r&&r.nodeType===3?!1:o&&o.nodeType===3?Sa(r,o.parentNode):"contains"in r?r.contains(o):r.compareDocumentPosition?!!(r.compareDocumentPosition(o)&16):!1:!1}function F(){for(var r=window,o=Fe();o instanceof r.HTMLIFrameElement;){try{var c=typeof o.contentWindow.location.href=="string"}catch{c=!1}if(c)r=o.contentWindow;else break;o=Fe(r.document)}return o}function B(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 le(r){var o=F(),c=r.focusedElem,m=r.selectionRange;if(o!==c&&c&&c.ownerDocument&&Sa(c.ownerDocument.documentElement,c)){if(m!==null&&B(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 y=c.textContent.length,x=Math.min(m.start,y);m=m.end===void 0?x:Math.min(m.end,y),!r.extend&&x>m&&(y=m,m=x,x=y),y=_a(c,x);var T=_a(c,m);y&&T&&(r.rangeCount!==1||r.anchorNode!==y.node||r.anchorOffset!==y.offset||r.focusNode!==T.node||r.focusOffset!==T.offset)&&(o=o.createRange(),o.setStart(y.node,y.offset),r.removeAllRanges(),x>m?(r.addRange(o),r.extend(T.node,T.offset)):(o.setEnd(T.node,T.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 fe=u&&"documentMode"in document&&11>=document.documentMode,_e=null,Re=null,Be=null,Ze=!1;function ht(r,o,c){var m=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;Ze||_e==null||_e!==Fe(m)||(m=_e,"selectionStart"in m&&B(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}),Be&&ps(Be,m)||(Be=m,m=oc(Re,"onSelect"),0<m.length&&(o=new da("onSelect","select",null,o,c),r.push({event:o,listeners:m}),o.target=_e)))}function ot(r,o){var c={};return c[r.toLowerCase()]=o.toLowerCase(),c["Webkit"+r]="webkit"+o,c["Moz"+r]="moz"+o,c}var Pt={animationend:ot("Animation","AnimationEnd"),animationiteration:ot("Animation","AnimationIteration"),animationstart:ot("Animation","AnimationStart"),transitionend:ot("Transition","TransitionEnd")},ms={},Na={};u&&(Na=document.createElement("div").style,"AnimationEvent"in window||(delete Pt.animationend.animation,delete Pt.animationiteration.animation,delete Pt.animationstart.animation),"TransitionEvent"in window||delete Pt.transitionend.transition);function si(r){if(ms[r])return ms[r];if(!Pt[r])return r;var o=Pt[r],c;for(c in o)if(o.hasOwnProperty(c)&&c in Na)return ms[r]=o[c];return r}var Ea=si("animationend"),rc=si("animationiteration"),Ca=si("animationstart"),oi=si("transitionend"),gs=new Map,ys="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 ut(r,o){gs.set(r,o),a(o,[r])}for(var ii=0;ii<ys.length;ii++){var Sd=ys[ii],rA=Sd.toLowerCase(),sA=Sd[0].toUpperCase()+Sd.slice(1);ut(rA,"on"+sA)}ut(Ea,"onAnimationEnd"),ut(rc,"onAnimationIteration"),ut(Ca,"onAnimationStart"),ut("dblclick","onDoubleClick"),ut("focusin","onFocus"),ut("focusout","onBlur"),ut(oi,"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 ja="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(" "),oA=new Set("cancel close invalid load scroll toggle".split(" ").concat(ja));function l0(r,o,c){var m=r.type||"unknown-event";r.currentTarget=c,Oo(m,o,void 0,r),r.currentTarget=null}function c0(r,o){o=(o&4)!==0;for(var c=0;c<r.length;c++){var m=r[c],y=m.event;m=m.listeners;e:{var x=void 0;if(o)for(var T=m.length-1;0<=T;T--){var W=m[T],ee=W.instance,ce=W.currentTarget;if(W=W.listener,ee!==x&&y.isPropagationStopped())break e;l0(y,W,ce),x=ee}else for(T=0;T<m.length;T++){if(W=m[T],ee=W.instance,ce=W.currentTarget,W=W.listener,ee!==x&&y.isPropagationStopped())break e;l0(y,W,ce),x=ee}}}if(hr)throw r=ns,hr=!1,ns=null,r}function pt(r,o){var c=o[Md];c===void 0&&(c=o[Md]=new Set);var m=r+"__bubble";c.has(m)||(u0(o,r,2,!1),c.add(m))}function Nd(r,o,c){var m=0;o&&(m|=4),u0(c,r,m,o)}var sc="_reactListening"+Math.random().toString(36).slice(2);function Ta(r){if(!r[sc]){r[sc]=!0,s.forEach(function(c){c!=="selectionchange"&&(oA.has(c)||Nd(c,!1,r),Nd(c,!0,r))});var o=r.nodeType===9?r:r.ownerDocument;o===null||o[sc]||(o[sc]=!0,Nd("selectionchange",!1,o))}}function u0(r,o,c,m){switch(Qo(o)){case 1:var y=la;break;case 4:y=Bl;break;default:y=yr}c=y.bind(null,o,c,r),y=void 0,!Ds||o!=="touchstart"&&o!=="touchmove"&&o!=="wheel"||(y=!0),m?y!==void 0?r.addEventListener(o,c,{capture:!0,passive:y}):r.addEventListener(o,c,!0):y!==void 0?r.addEventListener(o,c,{passive:y}):r.addEventListener(o,c,!1)}function Ed(r,o,c,m,y){var x=m;if((o&1)===0&&(o&2)===0&&m!==null)e:for(;;){if(m===null)return;var T=m.tag;if(T===3||T===4){var W=m.stateNode.containerInfo;if(W===y||W.nodeType===8&&W.parentNode===y)break;if(T===4)for(T=m.return;T!==null;){var ee=T.tag;if((ee===3||ee===4)&&(ee=T.stateNode.containerInfo,ee===y||ee.nodeType===8&&ee.parentNode===y))return;T=T.return}for(;W!==null;){if(T=no(W),T===null)return;if(ee=T.tag,ee===5||ee===6){m=x=T;continue e}W=W.parentNode}}m=m.return}Tr(function(){var ce=x,ye=dt(c),ve=[];e:{var ge=gs.get(r);if(ge!==void 0){var Se=da,je=r;switch(r){case"keypress":if(Zo(c)===0)break e;case"keydown":case"keyup":Se=Gl;break;case"focusin":je="focus",Se=Jo;break;case"focusout":je="blur",Se=Jo;break;case"beforeblur":case"afterblur":Se=Jo;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=Qs;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Se=fd;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Se=en;break;case Ea:case rc:case Ca:Se=md;break;case oi:Se=Vl;break;case"scroll":Se=ds;break;case"wheel":Se=Kl;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=Zs}var Ae=(o&4)!==0,jt=!Ae&&r==="scroll",oe=Ae?ge!==null?ge+"Capture":null:ge;Ae=[];for(var te=ce,ie;te!==null;){ie=te;var we=ie.stateNode;if(ie.tag===5&&we!==null&&(ie=we,oe!==null&&(we=zn(te,oe),we!=null&&Ae.push(Ra(te,we,ie)))),jt)break;te=te.return}0<Ae.length&&(ge=new Se(ge,je,null,c,ye),ve.push({event:ge,listeners:Ae}))}}if((o&7)===0){e:{if(ge=r==="mouseover"||r==="pointerover",Se=r==="mouseout"||r==="pointerout",ge&&c!==wt&&(je=c.relatedTarget||c.fromElement)&&(no(je)||je[zr]))break e;if((Se||ge)&&(ge=ye.window===ye?ye:(ge=ye.ownerDocument)?ge.defaultView||ge.parentWindow:window,Se?(je=c.relatedTarget||c.toElement,Se=ce,je=je?no(je):null,je!==null&&(jt=En(je),je!==jt||je.tag!==5&&je.tag!==6)&&(je=null)):(Se=null,je=ce),Se!==je)){if(Ae=Qs,we="onMouseLeave",oe="onMouseEnter",te="mouse",(r==="pointerout"||r==="pointerover")&&(Ae=Zs,we="onPointerLeave",oe="onPointerEnter",te="pointer"),jt=Se==null?ge:ci(Se),ie=je==null?ge:ci(je),ge=new Ae(we,te+"leave",Se,c,ye),ge.target=jt,ge.relatedTarget=ie,we=null,no(ye)===ce&&(Ae=new Ae(oe,te+"enter",je,c,ye),Ae.target=ie,Ae.relatedTarget=jt,we=Ae),jt=we,Se&&je)t:{for(Ae=Se,oe=je,te=0,ie=Ae;ie;ie=ai(ie))te++;for(ie=0,we=oe;we;we=ai(we))ie++;for(;0<te-ie;)Ae=ai(Ae),te--;for(;0<ie-te;)oe=ai(oe),ie--;for(;te--;){if(Ae===oe||oe!==null&&Ae===oe.alternate)break t;Ae=ai(Ae),oe=ai(oe)}Ae=null}else Ae=null;Se!==null&&d0(ve,ge,Se,Ae,!1),je!==null&&jt!==null&&d0(ve,jt,je,Ae,!0)}}e:{if(ge=ce?ci(ce):window,Se=ge.nodeName&&ge.nodeName.toLowerCase(),Se==="select"||Se==="input"&&ge.type==="file")var Me=kd;else if(Jl(ge))if(ec)Me=ri;else{Me=xa;var qe=a0}else(Se=ge.nodeName)&&Se.toLowerCase()==="input"&&(ge.type==="checkbox"||ge.type==="radio")&&(Me=_d);if(Me&&(Me=Me(r,ce))){va(ve,Me,c,ye);break e}qe&&qe(r,ge,ce),r==="focusout"&&(qe=ge._wrapperState)&&qe.controlled&&ge.type==="number"&&Oe(ge,"number",ge.value)}switch(qe=ce?ci(ce):window,r){case"focusin":(Jl(qe)||qe.contentEditable==="true")&&(_e=qe,Re=ce,Be=null);break;case"focusout":Be=Re=_e=null;break;case"mousedown":Ze=!0;break;case"contextmenu":case"mouseup":case"dragend":Ze=!1,ht(ve,c,ye);break;case"selectionchange":if(fe)break;case"keydown":case"keyup":ht(ve,c,ye)}var De;if(fs)e:{switch(r){case"compositionstart":var We="onCompositionStart";break e;case"compositionend":We="onCompositionEnd";break e;case"compositionupdate":We="onCompositionUpdate";break e}We=void 0}else bt?ti(r,c)&&(We="onCompositionEnd"):r==="keydown"&&c.keyCode===229&&(We="onCompositionStart");We&&(Js&&c.locale!=="ko"&&(bt||We!=="onCompositionStart"?We==="onCompositionEnd"&&bt&&(De=ca()):(vr=ye,Vs="value"in vr?vr.value:vr.textContent,bt=!0)),qe=oc(ce,We),0<qe.length&&(We=new pa(We,r,null,c,ye),ve.push({event:We,listeners:qe}),De?We.data=De:(De=ni(c),De!==null&&(We.data=De)))),(De=Xl?Ql(r,c):Zl(r,c))&&(ce=oc(ce,"onBeforeInput"),0<ce.length&&(ye=new pa("onBeforeInput","beforeinput",null,c,ye),ve.push({event:ye,listeners:ce}),ye.data=De))}c0(ve,o)})}function Ra(r,o,c){return{instance:r,listener:o,currentTarget:c}}function oc(r,o){for(var c=o+"Capture",m=[];r!==null;){var y=r,x=y.stateNode;y.tag===5&&x!==null&&(y=x,x=zn(r,c),x!=null&&m.unshift(Ra(r,x,y)),x=zn(r,o),x!=null&&m.push(Ra(r,x,y))),r=r.return}return m}function ai(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5);return r||null}function d0(r,o,c,m,y){for(var x=o._reactName,T=[];c!==null&&c!==m;){var W=c,ee=W.alternate,ce=W.stateNode;if(ee!==null&&ee===m)break;W.tag===5&&ce!==null&&(W=ce,y?(ee=zn(c,x),ee!=null&&T.unshift(Ra(c,ee,W))):y||(ee=zn(c,x),ee!=null&&T.push(Ra(c,ee,W)))),c=c.return}T.length!==0&&r.push({event:o,listeners:T})}var iA=/\r\n?/g,aA=/\u0000|\uFFFD/g;function f0(r){return(typeof r=="string"?r:""+r).replace(iA,`
38
+ `).replace(aA,"")}function ic(r,o,c){if(o=f0(o),f0(r)!==o&&c)throw Error(n(425))}function ac(){}var Cd=null,jd=null;function Td(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 Rd=typeof setTimeout=="function"?setTimeout:void 0,lA=typeof clearTimeout=="function"?clearTimeout:void 0,h0=typeof Promise=="function"?Promise:void 0,cA=typeof queueMicrotask=="function"?queueMicrotask:typeof h0<"u"?function(r){return h0.resolve(null).then(r).catch(uA)}:Rd;function uA(r){setTimeout(function(){throw r})}function Ad(r,o){var c=o,m=0;do{var y=c.nextSibling;if(r.removeChild(c),y&&y.nodeType===8)if(c=y.data,c==="/$"){if(m===0){r.removeChild(y),us(o);return}m--}else c!=="$"&&c!=="$?"&&c!=="$!"||m++;c=y}while(c);us(o)}function vs(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 p0(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 li=Math.random().toString(36).slice(2),br="__reactFiber$"+li,Aa="__reactProps$"+li,zr="__reactContainer$"+li,Md="__reactEvents$"+li,dA="__reactListeners$"+li,fA="__reactHandles$"+li;function no(r){var o=r[br];if(o)return o;for(var c=r.parentNode;c;){if(o=c[zr]||c[br]){if(c=o.alternate,o.child!==null||c!==null&&c.child!==null)for(r=p0(r);r!==null;){if(c=r[br])return c;r=p0(r)}return o}r=c,c=r.parentNode}return null}function Ma(r){return r=r[br]||r[zr],!r||r.tag!==5&&r.tag!==6&&r.tag!==13&&r.tag!==3?null:r}function ci(r){if(r.tag===5||r.tag===6)return r.stateNode;throw Error(n(33))}function lc(r){return r[Aa]||null}var Id=[],ui=-1;function ws(r){return{current:r}}function mt(r){0>ui||(r.current=Id[ui],Id[ui]=null,ui--)}function ft(r,o){ui++,Id[ui]=r.current,r.current=o}var xs={},Yt=ws(xs),sn=ws(!1),ro=xs;function di(r,o){var c=r.type.contextTypes;if(!c)return xs;var m=r.stateNode;if(m&&m.__reactInternalMemoizedUnmaskedChildContext===o)return m.__reactInternalMemoizedMaskedChildContext;var y={},x;for(x in c)y[x]=o[x];return m&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=o,r.__reactInternalMemoizedMaskedChildContext=y),y}function on(r){return r=r.childContextTypes,r!=null}function cc(){mt(sn),mt(Yt)}function m0(r,o,c){if(Yt.current!==xs)throw Error(n(168));ft(Yt,o),ft(sn,c)}function g0(r,o,c){var m=r.stateNode;if(o=o.childContextTypes,typeof m.getChildContext!="function")return c;m=m.getChildContext();for(var y in m)if(!(y in o))throw Error(n(108,se(r)||"Unknown",y));return J({},c,m)}function uc(r){return r=(r=r.stateNode)&&r.__reactInternalMemoizedMergedChildContext||xs,ro=Yt.current,ft(Yt,r),ft(sn,sn.current),!0}function y0(r,o,c){var m=r.stateNode;if(!m)throw Error(n(169));c?(r=g0(r,o,ro),m.__reactInternalMemoizedMergedChildContext=r,mt(sn),mt(Yt),ft(Yt,r)):mt(sn),ft(sn,c)}var Br=null,dc=!1,Od=!1;function v0(r){Br===null?Br=[r]:Br.push(r)}function hA(r){dc=!0,v0(r)}function bs(){if(!Od&&Br!==null){Od=!0;var r=0,o=Qe;try{var c=Br;for(Qe=1;r<c.length;r++){var m=c[r];do m=m(!0);while(m!==null)}Br=null,dc=!1}catch(y){throw Br!==null&&(Br=Br.slice(r+1)),Fs(rs,bs),y}finally{Qe=o,Od=!1}}return null}var fi=[],hi=0,fc=null,hc=0,Tn=[],Rn=0,so=null,Ur=1,Wr="";function oo(r,o){fi[hi++]=hc,fi[hi++]=fc,fc=r,hc=o}function w0(r,o,c){Tn[Rn++]=Ur,Tn[Rn++]=Wr,Tn[Rn++]=so,so=r;var m=Ur;r=Wr;var y=32-pn(m)-1;m&=~(1<<y),c+=1;var x=32-pn(o)+y;if(30<x){var T=y-y%5;x=(m&(1<<T)-1).toString(32),m>>=T,y-=T,Ur=1<<32-pn(o)+y|c<<y|m,Wr=x+r}else Ur=1<<x|c<<y|m,Wr=r}function Pd(r){r.return!==null&&(oo(r,1),w0(r,1,0))}function $d(r){for(;r===fc;)fc=fi[--hi],fi[hi]=null,hc=fi[--hi],fi[hi]=null;for(;r===so;)so=Tn[--Rn],Tn[Rn]=null,Wr=Tn[--Rn],Tn[Rn]=null,Ur=Tn[--Rn],Tn[Rn]=null}var yn=null,vn=null,gt=!1,Zn=null;function x0(r,o){var c=On(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 b0(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,vn=vs(o.firstChild),!0):!1;case 6:return o=r.pendingProps===""||o.nodeType!==3?null:o,o!==null?(r.stateNode=o,yn=r,vn=null,!0):!1;case 13:return o=o.nodeType!==8?null:o,o!==null?(c=so!==null?{id:Ur,overflow:Wr}:null,r.memoizedState={dehydrated:o,treeContext:c,retryLane:1073741824},c=On(18,null,null,0),c.stateNode=o,c.return=r,r.child=c,yn=r,vn=null,!0):!1;default:return!1}}function Ld(r){return(r.mode&1)!==0&&(r.flags&128)===0}function qd(r){if(gt){var o=vn;if(o){var c=o;if(!b0(r,o)){if(Ld(r))throw Error(n(418));o=vs(c.nextSibling);var m=yn;o&&b0(r,o)?x0(m,c):(r.flags=r.flags&-4097|2,gt=!1,yn=r)}}else{if(Ld(r))throw Error(n(418));r.flags=r.flags&-4097|2,gt=!1,yn=r}}}function k0(r){for(r=r.return;r!==null&&r.tag!==5&&r.tag!==3&&r.tag!==13;)r=r.return;yn=r}function pc(r){if(r!==yn)return!1;if(!gt)return k0(r),gt=!0,!1;var o;if((o=r.tag!==3)&&!(o=r.tag!==5)&&(o=r.type,o=o!=="head"&&o!=="body"&&!Td(r.type,r.memoizedProps)),o&&(o=vn)){if(Ld(r))throw _0(),Error(n(418));for(;o;)x0(r,o),o=vs(o.nextSibling)}if(k0(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){vn=vs(r.nextSibling);break e}o--}else c!=="$"&&c!=="$!"&&c!=="$?"||o++}r=r.nextSibling}vn=null}}else vn=yn?vs(r.stateNode.nextSibling):null;return!0}function _0(){for(var r=vn;r;)r=vs(r.nextSibling)}function pi(){vn=yn=null,gt=!1}function Dd(r){Zn===null?Zn=[r]:Zn.push(r)}var pA=j.ReactCurrentBatchConfig;function Ia(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 y=m,x=""+r;return o!==null&&o.ref!==null&&typeof o.ref=="function"&&o.ref._stringRef===x?o.ref:(o=function(T){var W=y.refs;T===null?delete W[x]:W[x]=T},o._stringRef=x,o)}if(typeof r!="string")throw Error(n(284));if(!c._owner)throw Error(n(290,r))}return r}function mc(r,o){throw r=Object.prototype.toString.call(o),Error(n(31,r==="[object Object]"?"object with keys {"+Object.keys(o).join(", ")+"}":r))}function S0(r){var o=r._init;return o(r._payload)}function N0(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 y(oe,te){return oe=Ts(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 T(oe){return r&&oe.alternate===null&&(oe.flags|=2),oe}function W(oe,te,ie,we){return te===null||te.tag!==6?(te=Af(ie,oe.mode,we),te.return=oe,te):(te=y(te,ie),te.return=oe,te)}function ee(oe,te,ie,we){var Me=ie.type;return Me===P?ye(oe,te,ie.props.children,we,ie.key):te!==null&&(te.elementType===Me||typeof Me=="object"&&Me!==null&&Me.$$typeof===H&&S0(Me)===te.type)?(we=y(te,ie.props),we.ref=Ia(oe,te,ie),we.return=oe,we):(we=Dc(ie.type,ie.key,ie.props,null,oe.mode,we),we.ref=Ia(oe,te,ie),we.return=oe,we)}function ce(oe,te,ie,we){return te===null||te.tag!==4||te.stateNode.containerInfo!==ie.containerInfo||te.stateNode.implementation!==ie.implementation?(te=Mf(ie,oe.mode,we),te.return=oe,te):(te=y(te,ie.children||[]),te.return=oe,te)}function ye(oe,te,ie,we,Me){return te===null||te.tag!==7?(te=po(ie,oe.mode,we,Me),te.return=oe,te):(te=y(te,ie),te.return=oe,te)}function ve(oe,te,ie){if(typeof te=="string"&&te!==""||typeof te=="number")return te=Af(""+te,oe.mode,ie),te.return=oe,te;if(typeof te=="object"&&te!==null){switch(te.$$typeof){case I:return ie=Dc(te.type,te.key,te.props,null,oe.mode,ie),ie.ref=Ia(oe,null,te),ie.return=oe,ie;case O:return te=Mf(te,oe.mode,ie),te.return=oe,te;case H:var we=te._init;return ve(oe,we(te._payload),ie)}if(nt(te)||U(te))return te=po(te,oe.mode,ie,null),te.return=oe,te;mc(oe,te)}return null}function ge(oe,te,ie,we){var Me=te!==null?te.key:null;if(typeof ie=="string"&&ie!==""||typeof ie=="number")return Me!==null?null:W(oe,te,""+ie,we);if(typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case I:return ie.key===Me?ee(oe,te,ie,we):null;case O:return ie.key===Me?ce(oe,te,ie,we):null;case H:return Me=ie._init,ge(oe,te,Me(ie._payload),we)}if(nt(ie)||U(ie))return Me!==null?null:ye(oe,te,ie,we,null);mc(oe,ie)}return null}function Se(oe,te,ie,we,Me){if(typeof we=="string"&&we!==""||typeof we=="number")return oe=oe.get(ie)||null,W(te,oe,""+we,Me);if(typeof we=="object"&&we!==null){switch(we.$$typeof){case I:return oe=oe.get(we.key===null?ie:we.key)||null,ee(te,oe,we,Me);case O:return oe=oe.get(we.key===null?ie:we.key)||null,ce(te,oe,we,Me);case H:var qe=we._init;return Se(oe,te,ie,qe(we._payload),Me)}if(nt(we)||U(we))return oe=oe.get(ie)||null,ye(te,oe,we,Me,null);mc(te,we)}return null}function je(oe,te,ie,we){for(var Me=null,qe=null,De=te,We=te=0,zt=null;De!==null&&We<ie.length;We++){De.index>We?(zt=De,De=null):zt=De.sibling;var tt=ge(oe,De,ie[We],we);if(tt===null){De===null&&(De=zt);break}r&&De&&tt.alternate===null&&o(oe,De),te=x(tt,te,We),qe===null?Me=tt:qe.sibling=tt,qe=tt,De=zt}if(We===ie.length)return c(oe,De),gt&&oo(oe,We),Me;if(De===null){for(;We<ie.length;We++)De=ve(oe,ie[We],we),De!==null&&(te=x(De,te,We),qe===null?Me=De:qe.sibling=De,qe=De);return gt&&oo(oe,We),Me}for(De=m(oe,De);We<ie.length;We++)zt=Se(De,oe,We,ie[We],we),zt!==null&&(r&&zt.alternate!==null&&De.delete(zt.key===null?We:zt.key),te=x(zt,te,We),qe===null?Me=zt:qe.sibling=zt,qe=zt);return r&&De.forEach(function(Rs){return o(oe,Rs)}),gt&&oo(oe,We),Me}function Ae(oe,te,ie,we){var Me=U(ie);if(typeof Me!="function")throw Error(n(150));if(ie=Me.call(ie),ie==null)throw Error(n(151));for(var qe=Me=null,De=te,We=te=0,zt=null,tt=ie.next();De!==null&&!tt.done;We++,tt=ie.next()){De.index>We?(zt=De,De=null):zt=De.sibling;var Rs=ge(oe,De,tt.value,we);if(Rs===null){De===null&&(De=zt);break}r&&De&&Rs.alternate===null&&o(oe,De),te=x(Rs,te,We),qe===null?Me=Rs:qe.sibling=Rs,qe=Rs,De=zt}if(tt.done)return c(oe,De),gt&&oo(oe,We),Me;if(De===null){for(;!tt.done;We++,tt=ie.next())tt=ve(oe,tt.value,we),tt!==null&&(te=x(tt,te,We),qe===null?Me=tt:qe.sibling=tt,qe=tt);return gt&&oo(oe,We),Me}for(De=m(oe,De);!tt.done;We++,tt=ie.next())tt=Se(De,oe,We,tt.value,we),tt!==null&&(r&&tt.alternate!==null&&De.delete(tt.key===null?We:tt.key),te=x(tt,te,We),qe===null?Me=tt:qe.sibling=tt,qe=tt);return r&&De.forEach(function(VA){return o(oe,VA)}),gt&&oo(oe,We),Me}function jt(oe,te,ie,we){if(typeof ie=="object"&&ie!==null&&ie.type===P&&ie.key===null&&(ie=ie.props.children),typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case I:e:{for(var Me=ie.key,qe=te;qe!==null;){if(qe.key===Me){if(Me=ie.type,Me===P){if(qe.tag===7){c(oe,qe.sibling),te=y(qe,ie.props.children),te.return=oe,oe=te;break e}}else if(qe.elementType===Me||typeof Me=="object"&&Me!==null&&Me.$$typeof===H&&S0(Me)===qe.type){c(oe,qe.sibling),te=y(qe,ie.props),te.ref=Ia(oe,qe,ie),te.return=oe,oe=te;break e}c(oe,qe);break}else o(oe,qe);qe=qe.sibling}ie.type===P?(te=po(ie.props.children,oe.mode,we,ie.key),te.return=oe,oe=te):(we=Dc(ie.type,ie.key,ie.props,null,oe.mode,we),we.ref=Ia(oe,te,ie),we.return=oe,oe=we)}return T(oe);case O: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=y(te,ie.children||[]),te.return=oe,oe=te;break e}else{c(oe,te);break}else o(oe,te);te=te.sibling}te=Mf(ie,oe.mode,we),te.return=oe,oe=te}return T(oe);case H:return qe=ie._init,jt(oe,te,qe(ie._payload),we)}if(nt(ie))return je(oe,te,ie,we);if(U(ie))return Ae(oe,te,ie,we);mc(oe,ie)}return typeof ie=="string"&&ie!==""||typeof ie=="number"?(ie=""+ie,te!==null&&te.tag===6?(c(oe,te.sibling),te=y(te,ie),te.return=oe,oe=te):(c(oe,te),te=Af(ie,oe.mode,we),te.return=oe,oe=te),T(oe)):c(oe,te)}return jt}var mi=N0(!0),E0=N0(!1),gc=ws(null),yc=null,gi=null,Fd=null;function zd(){Fd=gi=yc=null}function Bd(r){var o=gc.current;mt(gc),r._currentValue=o}function Ud(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 yi(r,o){yc=r,Fd=gi=null,r=r.dependencies,r!==null&&r.firstContext!==null&&((r.lanes&o)!==0&&(an=!0),r.firstContext=null)}function An(r){var o=r._currentValue;if(Fd!==r)if(r={context:r,memoizedValue:o,next:null},gi===null){if(yc===null)throw Error(n(308));gi=r,yc.dependencies={lanes:0,firstContext:r}}else gi=gi.next=r;return o}var io=null;function Wd(r){io===null?io=[r]:io.push(r)}function C0(r,o,c,m){var y=o.interleaved;return y===null?(c.next=c,Wd(o)):(c.next=y.next,y.next=c),o.interleaved=c,Hr(r,m)}function Hr(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 ks=!1;function Hd(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function j0(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 Gr(r,o){return{eventTime:r,lane:o,tag:0,payload:null,callback:null,next:null}}function _s(r,o,c){var m=r.updateQueue;if(m===null)return null;if(m=m.shared,(et&2)!==0){var y=m.pending;return y===null?o.next=o:(o.next=y.next,y.next=o),m.pending=o,Hr(r,c)}return y=m.interleaved,y===null?(o.next=o,Wd(m)):(o.next=y.next,y.next=o),m.interleaved=o,Hr(r,c)}function vc(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,ls(r,c)}}function T0(r,o){var c=r.updateQueue,m=r.alternate;if(m!==null&&(m=m.updateQueue,c===m)){var y=null,x=null;if(c=c.firstBaseUpdate,c!==null){do{var T={eventTime:c.eventTime,lane:c.lane,tag:c.tag,payload:c.payload,callback:c.callback,next:null};x===null?y=x=T:x=x.next=T,c=c.next}while(c!==null);x===null?y=x=o:x=x.next=o}else y=x=o;c={baseState:m.baseState,firstBaseUpdate:y,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 wc(r,o,c,m){var y=r.updateQueue;ks=!1;var x=y.firstBaseUpdate,T=y.lastBaseUpdate,W=y.shared.pending;if(W!==null){y.shared.pending=null;var ee=W,ce=ee.next;ee.next=null,T===null?x=ce:T.next=ce,T=ee;var ye=r.alternate;ye!==null&&(ye=ye.updateQueue,W=ye.lastBaseUpdate,W!==T&&(W===null?ye.firstBaseUpdate=ce:W.next=ce,ye.lastBaseUpdate=ee))}if(x!==null){var ve=y.baseState;T=0,ye=ce=ee=null,W=x;do{var ge=W.lane,Se=W.eventTime;if((m&ge)===ge){ye!==null&&(ye=ye.next={eventTime:Se,lane:0,tag:W.tag,payload:W.payload,callback:W.callback,next:null});e:{var je=r,Ae=W;switch(ge=o,Se=c,Ae.tag){case 1:if(je=Ae.payload,typeof je=="function"){ve=je.call(Se,ve,ge);break e}ve=je;break e;case 3:je.flags=je.flags&-65537|128;case 0:if(je=Ae.payload,ge=typeof je=="function"?je.call(Se,ve,ge):je,ge==null)break e;ve=J({},ve,ge);break e;case 2:ks=!0}}W.callback!==null&&W.lane!==0&&(r.flags|=64,ge=y.effects,ge===null?y.effects=[W]:ge.push(W))}else Se={eventTime:Se,lane:ge,tag:W.tag,payload:W.payload,callback:W.callback,next:null},ye===null?(ce=ye=Se,ee=ve):ye=ye.next=Se,T|=ge;if(W=W.next,W===null){if(W=y.shared.pending,W===null)break;ge=W,W=ge.next,ge.next=null,y.lastBaseUpdate=ge,y.shared.pending=null}}while(!0);if(ye===null&&(ee=ve),y.baseState=ee,y.firstBaseUpdate=ce,y.lastBaseUpdate=ye,o=y.shared.interleaved,o!==null){y=o;do T|=y.lane,y=y.next;while(y!==o)}else x===null&&(y.shared.lanes=0);co|=T,r.lanes=T,r.memoizedState=ve}}function R0(r,o,c){if(r=o.effects,o.effects=null,r!==null)for(o=0;o<r.length;o++){var m=r[o],y=m.callback;if(y!==null){if(m.callback=null,m=c,typeof y!="function")throw Error(n(191,y));y.call(m)}}}var Oa={},kr=ws(Oa),Pa=ws(Oa),$a=ws(Oa);function ao(r){if(r===Oa)throw Error(n(174));return r}function Gd(r,o){switch(ft($a,o),ft(Pa,r),ft(kr,Oa),r=o.nodeType,r){case 9:case 11:o=(o=o.documentElement)?o.namespaceURI:ke(null,"");break;default:r=r===8?o.parentNode:o,o=r.namespaceURI||null,r=r.tagName,o=ke(o,r)}mt(kr),ft(kr,o)}function vi(){mt(kr),mt(Pa),mt($a)}function A0(r){ao($a.current);var o=ao(kr.current),c=ke(o,r.type);o!==c&&(ft(Pa,r),ft(kr,c))}function Vd(r){Pa.current===r&&(mt(kr),mt(Pa))}var kt=ws(0);function xc(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 Yd=[];function Kd(){for(var r=0;r<Yd.length;r++)Yd[r]._workInProgressVersionPrimary=null;Yd.length=0}var bc=j.ReactCurrentDispatcher,Xd=j.ReactCurrentBatchConfig,lo=0,_t=null,$t=null,Dt=null,kc=!1,La=!1,qa=0,mA=0;function Kt(){throw Error(n(321))}function Qd(r,o){if(o===null)return!1;for(var c=0;c<o.length&&c<r.length;c++)if(!gn(r[c],o[c]))return!1;return!0}function Zd(r,o,c,m,y,x){if(lo=x,_t=o,o.memoizedState=null,o.updateQueue=null,o.lanes=0,bc.current=r===null||r.memoizedState===null?wA:xA,r=c(m,y),La){x=0;do{if(La=!1,qa=0,25<=x)throw Error(n(301));x+=1,Dt=$t=null,o.updateQueue=null,bc.current=bA,r=c(m,y)}while(La)}if(bc.current=Nc,o=$t!==null&&$t.next!==null,lo=0,Dt=$t=_t=null,kc=!1,o)throw Error(n(300));return r}function Jd(){var r=qa!==0;return qa=0,r}function _r(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Dt===null?_t.memoizedState=Dt=r:Dt=Dt.next=r,Dt}function Mn(){if($t===null){var r=_t.alternate;r=r!==null?r.memoizedState:null}else r=$t.next;var o=Dt===null?_t.memoizedState:Dt.next;if(o!==null)Dt=o,$t=r;else{if(r===null)throw Error(n(310));$t=r,r={memoizedState:$t.memoizedState,baseState:$t.baseState,baseQueue:$t.baseQueue,queue:$t.queue,next:null},Dt===null?_t.memoizedState=Dt=r:Dt=Dt.next=r}return Dt}function Da(r,o){return typeof o=="function"?o(r):o}function ef(r){var o=Mn(),c=o.queue;if(c===null)throw Error(n(311));c.lastRenderedReducer=r;var m=$t,y=m.baseQueue,x=c.pending;if(x!==null){if(y!==null){var T=y.next;y.next=x.next,x.next=T}m.baseQueue=y=x,c.pending=null}if(y!==null){x=y.next,m=m.baseState;var W=T=null,ee=null,ce=x;do{var ye=ce.lane;if((lo&ye)===ye)ee!==null&&(ee=ee.next={lane:0,action:ce.action,hasEagerState:ce.hasEagerState,eagerState:ce.eagerState,next:null}),m=ce.hasEagerState?ce.eagerState:r(m,ce.action);else{var ve={lane:ye,action:ce.action,hasEagerState:ce.hasEagerState,eagerState:ce.eagerState,next:null};ee===null?(W=ee=ve,T=m):ee=ee.next=ve,_t.lanes|=ye,co|=ye}ce=ce.next}while(ce!==null&&ce!==x);ee===null?T=m:ee.next=W,gn(m,o.memoizedState)||(an=!0),o.memoizedState=m,o.baseState=T,o.baseQueue=ee,c.lastRenderedState=m}if(r=c.interleaved,r!==null){y=r;do x=y.lane,_t.lanes|=x,co|=x,y=y.next;while(y!==r)}else y===null&&(c.lanes=0);return[o.memoizedState,c.dispatch]}function tf(r){var o=Mn(),c=o.queue;if(c===null)throw Error(n(311));c.lastRenderedReducer=r;var m=c.dispatch,y=c.pending,x=o.memoizedState;if(y!==null){c.pending=null;var T=y=y.next;do x=r(x,T.action),T=T.next;while(T!==y);gn(x,o.memoizedState)||(an=!0),o.memoizedState=x,o.baseQueue===null&&(o.baseState=x),c.lastRenderedState=x}return[x,m]}function M0(){}function I0(r,o){var c=_t,m=Mn(),y=o(),x=!gn(m.memoizedState,y);if(x&&(m.memoizedState=y,an=!0),m=m.queue,nf($0.bind(null,c,m,r),[r]),m.getSnapshot!==o||x||Dt!==null&&Dt.memoizedState.tag&1){if(c.flags|=2048,Fa(9,P0.bind(null,c,m,y,o),void 0,null),Ft===null)throw Error(n(349));(lo&30)!==0||O0(c,o,y)}return y}function O0(r,o,c){r.flags|=16384,r={getSnapshot:o,value:c},o=_t.updateQueue,o===null?(o={lastEffect:null,stores:null},_t.updateQueue=o,o.stores=[r]):(c=o.stores,c===null?o.stores=[r]:c.push(r))}function P0(r,o,c,m){o.value=c,o.getSnapshot=m,L0(o)&&q0(r)}function $0(r,o,c){return c(function(){L0(o)&&q0(r)})}function L0(r){var o=r.getSnapshot;r=r.value;try{var c=o();return!gn(r,c)}catch{return!0}}function q0(r){var o=Hr(r,1);o!==null&&nr(o,r,1,-1)}function D0(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:Da,lastRenderedState:r},o.queue=r,r=r.dispatch=vA.bind(null,_t,r),[o.memoizedState,r]}function Fa(r,o,c,m){return r={tag:r,create:o,destroy:c,deps:m,next:null},o=_t.updateQueue,o===null?(o={lastEffect:null,stores:null},_t.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 F0(){return Mn().memoizedState}function _c(r,o,c,m){var y=_r();_t.flags|=r,y.memoizedState=Fa(1|o,c,void 0,m===void 0?null:m)}function Sc(r,o,c,m){var y=Mn();m=m===void 0?null:m;var x=void 0;if($t!==null){var T=$t.memoizedState;if(x=T.destroy,m!==null&&Qd(m,T.deps)){y.memoizedState=Fa(o,c,x,m);return}}_t.flags|=r,y.memoizedState=Fa(1|o,c,x,m)}function z0(r,o){return _c(8390656,8,r,o)}function nf(r,o){return Sc(2048,8,r,o)}function B0(r,o){return Sc(4,2,r,o)}function U0(r,o){return Sc(4,4,r,o)}function W0(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 H0(r,o,c){return c=c!=null?c.concat([r]):null,Sc(4,4,W0.bind(null,o,r),c)}function rf(){}function G0(r,o){var c=Mn();o=o===void 0?null:o;var m=c.memoizedState;return m!==null&&o!==null&&Qd(o,m[1])?m[0]:(c.memoizedState=[r,o],r)}function V0(r,o){var c=Mn();o=o===void 0?null:o;var m=c.memoizedState;return m!==null&&o!==null&&Qd(o,m[1])?m[0]:(r=r(),c.memoizedState=[r,o],r)}function Y0(r,o,c){return(lo&21)===0?(r.baseState&&(r.baseState=!1,an=!0),r.memoizedState=c):(gn(c,o)||(c=Us(),_t.lanes|=c,co|=c,r.baseState=!0),o)}function gA(r,o){var c=Qe;Qe=c!==0&&4>c?c:4,r(!0);var m=Xd.transition;Xd.transition={};try{r(!1),o()}finally{Qe=c,Xd.transition=m}}function K0(){return Mn().memoizedState}function yA(r,o,c){var m=Cs(r);if(c={lane:m,action:c,hasEagerState:!1,eagerState:null,next:null},X0(r))Q0(o,c);else if(c=C0(r,o,c,m),c!==null){var y=nn();nr(c,r,m,y),Z0(c,o,m)}}function vA(r,o,c){var m=Cs(r),y={lane:m,action:c,hasEagerState:!1,eagerState:null,next:null};if(X0(r))Q0(o,y);else{var x=r.alternate;if(r.lanes===0&&(x===null||x.lanes===0)&&(x=o.lastRenderedReducer,x!==null))try{var T=o.lastRenderedState,W=x(T,c);if(y.hasEagerState=!0,y.eagerState=W,gn(W,T)){var ee=o.interleaved;ee===null?(y.next=y,Wd(o)):(y.next=ee.next,ee.next=y),o.interleaved=y;return}}catch{}finally{}c=C0(r,o,y,m),c!==null&&(y=nn(),nr(c,r,m,y),Z0(c,o,m))}}function X0(r){var o=r.alternate;return r===_t||o!==null&&o===_t}function Q0(r,o){La=kc=!0;var c=r.pending;c===null?o.next=o:(o.next=c.next,c.next=o),r.pending=o}function Z0(r,o,c){if((c&4194240)!==0){var m=o.lanes;m&=r.pendingLanes,c|=m,o.lanes=c,ls(r,c)}}var Nc={readContext:An,useCallback:Kt,useContext:Kt,useEffect:Kt,useImperativeHandle:Kt,useInsertionEffect:Kt,useLayoutEffect:Kt,useMemo:Kt,useReducer:Kt,useRef:Kt,useState:Kt,useDebugValue:Kt,useDeferredValue:Kt,useTransition:Kt,useMutableSource:Kt,useSyncExternalStore:Kt,useId:Kt,unstable_isNewReconciler:!1},wA={readContext:An,useCallback:function(r,o){return _r().memoizedState=[r,o===void 0?null:o],r},useContext:An,useEffect:z0,useImperativeHandle:function(r,o,c){return c=c!=null?c.concat([r]):null,_c(4194308,4,W0.bind(null,o,r),c)},useLayoutEffect:function(r,o){return _c(4194308,4,r,o)},useInsertionEffect:function(r,o){return _c(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=yA.bind(null,_t,r),[m.memoizedState,r]},useRef:function(r){var o=_r();return r={current:r},o.memoizedState=r},useState:D0,useDebugValue:rf,useDeferredValue:function(r){return _r().memoizedState=r},useTransition:function(){var r=D0(!1),o=r[0];return r=gA.bind(null,r[1]),_r().memoizedState=r,[o,r]},useMutableSource:function(){},useSyncExternalStore:function(r,o,c){var m=_t,y=_r();if(gt){if(c===void 0)throw Error(n(407));c=c()}else{if(c=o(),Ft===null)throw Error(n(349));(lo&30)!==0||O0(m,o,c)}y.memoizedState=c;var x={value:c,getSnapshot:o};return y.queue=x,z0($0.bind(null,m,x,r),[r]),m.flags|=2048,Fa(9,P0.bind(null,m,x,c,o),void 0,null),c},useId:function(){var r=_r(),o=Ft.identifierPrefix;if(gt){var c=Wr,m=Ur;c=(m&~(1<<32-pn(m)-1)).toString(32)+c,o=":"+o+"R"+c,c=qa++,0<c&&(o+="H"+c.toString(32)),o+=":"}else c=mA++,o=":"+o+"r"+c.toString(32)+":";return r.memoizedState=o},unstable_isNewReconciler:!1},xA={readContext:An,useCallback:G0,useContext:An,useEffect:nf,useImperativeHandle:H0,useInsertionEffect:B0,useLayoutEffect:U0,useMemo:V0,useReducer:ef,useRef:F0,useState:function(){return ef(Da)},useDebugValue:rf,useDeferredValue:function(r){var o=Mn();return Y0(o,$t.memoizedState,r)},useTransition:function(){var r=ef(Da)[0],o=Mn().memoizedState;return[r,o]},useMutableSource:M0,useSyncExternalStore:I0,useId:K0,unstable_isNewReconciler:!1},bA={readContext:An,useCallback:G0,useContext:An,useEffect:nf,useImperativeHandle:H0,useInsertionEffect:B0,useLayoutEffect:U0,useMemo:V0,useReducer:tf,useRef:F0,useState:function(){return tf(Da)},useDebugValue:rf,useDeferredValue:function(r){var o=Mn();return $t===null?o.memoizedState=r:Y0(o,$t.memoizedState,r)},useTransition:function(){var r=tf(Da)[0],o=Mn().memoizedState;return[r,o]},useMutableSource:M0,useSyncExternalStore:I0,useId:K0,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 sf(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 Ec={isMounted:function(r){return(r=r._reactInternals)?En(r)===r:!1},enqueueSetState:function(r,o,c){r=r._reactInternals;var m=nn(),y=Cs(r),x=Gr(m,y);x.payload=o,c!=null&&(x.callback=c),o=_s(r,x,y),o!==null&&(nr(o,r,y,m),vc(o,r,y))},enqueueReplaceState:function(r,o,c){r=r._reactInternals;var m=nn(),y=Cs(r),x=Gr(m,y);x.tag=1,x.payload=o,c!=null&&(x.callback=c),o=_s(r,x,y),o!==null&&(nr(o,r,y,m),vc(o,r,y))},enqueueForceUpdate:function(r,o){r=r._reactInternals;var c=nn(),m=Cs(r),y=Gr(c,m);y.tag=2,o!=null&&(y.callback=o),o=_s(r,y,m),o!==null&&(nr(o,r,m,c),vc(o,r,m))}};function J0(r,o,c,m,y,x,T){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(m,x,T):o.prototype&&o.prototype.isPureReactComponent?!ps(c,m)||!ps(y,x):!0}function ex(r,o,c){var m=!1,y=xs,x=o.contextType;return typeof x=="object"&&x!==null?x=An(x):(y=on(o)?ro:Yt.current,m=o.contextTypes,x=(m=m!=null)?di(r,y):xs),o=new o(c,x),r.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,o.updater=Ec,r.stateNode=o,o._reactInternals=r,m&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=y,r.__reactInternalMemoizedMaskedChildContext=x),o}function tx(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&&Ec.enqueueReplaceState(o,o.state,null)}function of(r,o,c,m){var y=r.stateNode;y.props=c,y.state=r.memoizedState,y.refs={},Hd(r);var x=o.contextType;typeof x=="object"&&x!==null?y.context=An(x):(x=on(o)?ro:Yt.current,y.context=di(r,x)),y.state=r.memoizedState,x=o.getDerivedStateFromProps,typeof x=="function"&&(sf(r,o,x,c),y.state=r.memoizedState),typeof o.getDerivedStateFromProps=="function"||typeof y.getSnapshotBeforeUpdate=="function"||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(o=y.state,typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount(),o!==y.state&&Ec.enqueueReplaceState(y,y.state,null),wc(r,c,y,m),y.state=r.memoizedState),typeof y.componentDidMount=="function"&&(r.flags|=4194308)}function wi(r,o){try{var c="",m=o;do c+=L(m),m=m.return;while(m);var y=c}catch(x){y=`
39
39
  Error generating stack: `+x.message+`
40
- `+x.stack}return{value:r,source:o,stack:y,digest:null}}function sf(r,o,c){return{value:r,source:null,stack:c??null,digest:o??null}}function of(r,o){try{console.error(o.value)}catch(c){setTimeout(function(){throw c})}}var kA=typeof WeakMap=="function"?WeakMap:Map;function nx(r,o,c){c=Gr(-1,c),c.tag=3,c.payload={element:null};var m=o.value;return c.callback=function(){Rc||(Rc=!0,bf=m),of(r,o)},c}function rx(r,o,c){c=Gr(-1,c),c.tag=3;var m=r.type.getDerivedStateFromError;if(typeof m=="function"){var y=o.value;c.payload=function(){return m(y)},c.callback=function(){of(r,o)}}var x=r.stateNode;return x!==null&&typeof x.componentDidCatch=="function"&&(c.callback=function(){of(r,o),typeof m!="function"&&(Ss===null?Ss=new Set([this]):Ss.add(this));var T=o.stack;this.componentDidCatch(o.value,{componentStack:T!==null?T:""})}),c}function sx(r,o,c){var m=r.pingCache;if(m===null){m=r.pingCache=new kA;var y=new Set;m.set(o,y)}else y=m.get(o),y===void 0&&(y=new Set,m.set(o,y));y.has(c)||(y.add(c),r=$A.bind(null,r,o,c),o.then(r,r))}function ox(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 ix(r,o,c,m,y){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=Gr(-1,1),o.tag=2,ks(c,o,1))),c.lanes|=1),r):(r.flags|=65536,r.lanes=y,r)}var _A=j.ReactCurrentOwner,an=!1;function tn(r,o,c,m){o.child=r===null?E0(o,null,c,m):gi(o,r.child,c,m)}function ax(r,o,c,m,y){c=c.render;var x=o.ref;return vi(o,y),m=Xd(r,o,c,m,x,y),c=Qd(),r!==null&&!an?(o.updateQueue=r.updateQueue,o.flags&=-2053,r.lanes&=~y,Vr(r,o,y)):(mt&&c&&Id(o),o.flags|=1,tn(r,o,m,y),o.child)}function lx(r,o,c,m,y){if(r===null){var x=c.type;return typeof x=="function"&&!jf(x)&&x.defaultProps===void 0&&c.compare===null&&c.defaultProps===void 0?(o.tag=15,o.type=x,cx(r,o,x,m,y)):(r=$c(c.type,null,m,o,o.mode,y),r.ref=o.ref,r.return=o,o.child=r)}if(x=r.child,(r.lanes&y)===0){var T=x.memoizedProps;if(c=c.compare,c=c!==null?c:G,c(T,m)&&r.ref===o.ref)return Vr(r,o,y)}return o.flags|=1,r=js(x,m),r.ref=o.ref,r.return=o,o.child=r}function cx(r,o,c,m,y){if(r!==null){var x=r.memoizedProps;if(G(x,m)&&r.ref===o.ref)if(an=!1,o.pendingProps=m=x,(r.lanes&y)!==0)(r.flags&131072)!==0&&(an=!0);else return o.lanes=r.lanes,Vr(r,o,y)}return af(r,o,c,m,y)}function ux(r,o,c){var m=o.pendingProps,y=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},dt(ki,vn),vn|=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,dt(ki,vn),vn|=r,null;o.memoizedState={baseLanes:0,cachePool:null,transitions:null},m=x!==null?x.baseLanes:c,dt(ki,vn),vn|=m}else x!==null?(m=x.baseLanes|c,o.memoizedState=null):m=c,dt(ki,vn),vn|=m;return tn(r,o,y,c),o.child}function dx(r,o){var c=o.ref;(r===null&&c!==null||r!==null&&r.ref!==c)&&(o.flags|=512,o.flags|=2097152)}function af(r,o,c,m,y){var x=on(c)?so:Yt.current;return x=fi(o,x),vi(o,y),c=Xd(r,o,c,m,x,y),m=Qd(),r!==null&&!an?(o.updateQueue=r.updateQueue,o.flags&=-2053,r.lanes&=~y,Vr(r,o,y)):(mt&&m&&Id(o),o.flags|=1,tn(r,o,c,y),o.child)}function fx(r,o,c,m,y){if(on(c)){var x=!0;ac(o)}else x=!1;if(vi(o,y),o.stateNode===null)Nc(r,o),ex(o,c,m),rf(o,c,m,y),m=!0;else if(r===null){var T=o.stateNode,U=o.memoizedProps;T.props=U;var ee=T.context,ce=c.contextType;typeof ce=="object"&&ce!==null?ce=Rn(ce):(ce=on(c)?so:Yt.current,ce=fi(o,ce));var ye=c.getDerivedStateFromProps,ve=typeof ye=="function"||typeof T.getSnapshotBeforeUpdate=="function";ve||typeof T.UNSAFE_componentWillReceiveProps!="function"&&typeof T.componentWillReceiveProps!="function"||(U!==m||ee!==ce)&&tx(o,T,m,ce),bs=!1;var ge=o.memoizedState;T.state=ge,gc(o,m,T,y),ee=o.memoizedState,U!==m||ge!==ee||sn.current||bs?(typeof ye=="function"&&(nf(o,c,ye,m),ee=o.memoizedState),(U=bs||J0(o,c,U,m,ge,ee,ce))?(ve||typeof T.UNSAFE_componentWillMount!="function"&&typeof T.componentWillMount!="function"||(typeof T.componentWillMount=="function"&&T.componentWillMount(),typeof T.UNSAFE_componentWillMount=="function"&&T.UNSAFE_componentWillMount()),typeof T.componentDidMount=="function"&&(o.flags|=4194308)):(typeof T.componentDidMount=="function"&&(o.flags|=4194308),o.memoizedProps=m,o.memoizedState=ee),T.props=m,T.state=ee,T.context=ce,m=U):(typeof T.componentDidMount=="function"&&(o.flags|=4194308),m=!1)}else{T=o.stateNode,j0(r,o),U=o.memoizedProps,ce=o.type===o.elementType?U:Qn(o.type,U),T.props=ce,ve=o.pendingProps,ge=T.context,ee=c.contextType,typeof ee=="object"&&ee!==null?ee=Rn(ee):(ee=on(c)?so:Yt.current,ee=fi(o,ee));var _e=c.getDerivedStateFromProps;(ye=typeof _e=="function"||typeof T.getSnapshotBeforeUpdate=="function")||typeof T.UNSAFE_componentWillReceiveProps!="function"&&typeof T.componentWillReceiveProps!="function"||(U!==ve||ge!==ee)&&tx(o,T,m,ee),bs=!1,ge=o.memoizedState,T.state=ge,gc(o,m,T,y);var je=o.memoizedState;U!==ve||ge!==je||sn.current||bs?(typeof _e=="function"&&(nf(o,c,_e,m),je=o.memoizedState),(ce=bs||J0(o,c,ce,m,ge,je,ee)||!1)?(ye||typeof T.UNSAFE_componentWillUpdate!="function"&&typeof T.componentWillUpdate!="function"||(typeof T.componentWillUpdate=="function"&&T.componentWillUpdate(m,je,ee),typeof T.UNSAFE_componentWillUpdate=="function"&&T.UNSAFE_componentWillUpdate(m,je,ee)),typeof T.componentDidUpdate=="function"&&(o.flags|=4),typeof T.getSnapshotBeforeUpdate=="function"&&(o.flags|=1024)):(typeof T.componentDidUpdate!="function"||U===r.memoizedProps&&ge===r.memoizedState||(o.flags|=4),typeof T.getSnapshotBeforeUpdate!="function"||U===r.memoizedProps&&ge===r.memoizedState||(o.flags|=1024),o.memoizedProps=m,o.memoizedState=je),T.props=m,T.state=je,T.context=ee,m=ce):(typeof T.componentDidUpdate!="function"||U===r.memoizedProps&&ge===r.memoizedState||(o.flags|=4),typeof T.getSnapshotBeforeUpdate!="function"||U===r.memoizedProps&&ge===r.memoizedState||(o.flags|=1024),m=!1)}return lf(r,o,c,m,x,y)}function lf(r,o,c,m,y,x){dx(r,o);var T=(o.flags&128)!==0;if(!m&&!T)return y&&y0(o,c,!1),Vr(r,o,x);m=o.stateNode,_A.current=o;var U=T&&typeof c.getDerivedStateFromError!="function"?null:m.render();return o.flags|=1,r!==null&&T?(o.child=gi(o,r.child,null,x),o.child=gi(o,null,U,x)):tn(r,o,U,x),o.memoizedState=m.state,y&&y0(o,c,!0),o.child}function hx(r){var o=r.stateNode;o.pendingContext?m0(r,o.pendingContext,o.pendingContext!==o.context):o.context&&m0(r,o.context,!1),Wd(r,o.containerInfo)}function px(r,o,c,m,y){return mi(),Ld(y),o.flags|=256,tn(r,o,c,m),o.child}var cf={dehydrated:null,treeContext:null,retryLane:0};function uf(r){return{baseLanes:r,cachePool:null,transitions:null}}function mx(r,o,c){var m=o.pendingProps,y=bt.current,x=!1,T=(o.flags&128)!==0,U;if((U=T)||(U=r!==null&&r.memoizedState===null?!1:(y&2)!==0),U?(x=!0,o.flags&=-129):(r===null||r.memoizedState!==null)&&(y|=1),dt(bt,y&1),r===null)return $d(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):(T=m.children,r=m.fallback,x?(m=o.mode,x=o.child,T={mode:"hidden",children:T},(m&1)===0&&x!==null?(x.childLanes=0,x.pendingProps=T):x=Lc(T,m,0,null),r=mo(r,m,c,null),x.return=o,r.return=o,x.sibling=r,o.child=x,o.child.memoizedState=uf(c),o.memoizedState=cf,r):df(o,T));if(y=r.memoizedState,y!==null&&(U=y.dehydrated,U!==null))return SA(r,o,T,m,U,y,c);if(x){x=m.fallback,T=o.mode,y=r.child,U=y.sibling;var ee={mode:"hidden",children:m.children};return(T&1)===0&&o.child!==y?(m=o.child,m.childLanes=0,m.pendingProps=ee,o.deletions=null):(m=js(y,ee),m.subtreeFlags=y.subtreeFlags&14680064),U!==null?x=js(U,x):(x=mo(x,T,c,null),x.flags|=2),x.return=o,m.return=o,m.sibling=x,o.child=m,m=x,x=o.child,T=r.child.memoizedState,T=T===null?uf(c):{baseLanes:T.baseLanes|c,cachePool:null,transitions:T.transitions},x.memoizedState=T,x.childLanes=r.childLanes&~c,o.memoizedState=cf,m}return x=r.child,r=x.sibling,m=js(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 df(r,o){return o=Lc({mode:"visible",children:o},r.mode,0,null),o.return=r,r.child=o}function Sc(r,o,c,m){return m!==null&&Ld(m),gi(o,r.child,null,c),r=df(o,o.pendingProps.children),r.flags|=2,o.memoizedState=null,r}function SA(r,o,c,m,y,x,T){if(c)return o.flags&256?(o.flags&=-257,m=sf(Error(n(422))),Sc(r,o,T,m)):o.memoizedState!==null?(o.child=r.child,o.flags|=128,null):(x=m.fallback,y=o.mode,m=Lc({mode:"visible",children:m.children},y,0,null),x=mo(x,y,T,null),x.flags|=2,m.return=o,x.return=o,m.sibling=x,o.child=m,(o.mode&1)!==0&&gi(o,r.child,null,T),o.child.memoizedState=uf(T),o.memoizedState=cf,x);if((o.mode&1)===0)return Sc(r,o,T,null);if(y.data==="$!"){if(m=y.nextSibling&&y.nextSibling.dataset,m)var U=m.dgst;return m=U,x=Error(n(419)),m=sf(x,m,void 0),Sc(r,o,T,m)}if(U=(T&r.childLanes)!==0,an||U){if(m=Dt,m!==null){switch(T&-T){case 4:y=2;break;case 16:y=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:y=32;break;case 536870912:y=268435456;break;default:y=0}y=(y&(m.suspendedLanes|T))!==0?0:y,y!==0&&y!==x.retryLane&&(x.retryLane=y,Hr(r,y),er(m,r,y,-1))}return Cf(),m=sf(Error(n(421))),Sc(r,o,T,m)}return y.data==="$?"?(o.flags|=128,o.child=r.child,o=LA.bind(null,r),y._reactRetry=o,null):(r=x.treeContext,yn=ys(y.nextSibling),gn=o,mt=!0,Xn=null,r!==null&&(jn[Tn++]=Ur,jn[Tn++]=Wr,jn[Tn++]=oo,Ur=r.id,Wr=r.overflow,oo=o),o=df(o,m.children),o.flags|=4096,o)}function gx(r,o,c){r.lanes|=o;var m=r.alternate;m!==null&&(m.lanes|=o),zd(r.return,o,c)}function ff(r,o,c,m,y){var x=r.memoizedState;x===null?r.memoizedState={isBackwards:o,rendering:null,renderingStartTime:0,last:m,tail:c,tailMode:y}:(x.isBackwards=o,x.rendering=null,x.renderingStartTime=0,x.last=m,x.tail=c,x.tailMode=y)}function yx(r,o,c){var m=o.pendingProps,y=m.revealOrder,x=m.tail;if(tn(r,o,m.children,c),m=bt.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&&gx(r,c,o);else if(r.tag===19)gx(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(dt(bt,m),(o.mode&1)===0)o.memoizedState=null;else switch(y){case"forwards":for(c=o.child,y=null;c!==null;)r=c.alternate,r!==null&&yc(r)===null&&(y=c),c=c.sibling;c=y,c===null?(y=o.child,o.child=null):(y=c.sibling,c.sibling=null),ff(o,!1,y,c,x);break;case"backwards":for(c=null,y=o.child,o.child=null;y!==null;){if(r=y.alternate,r!==null&&yc(r)===null){o.child=y;break}r=y.sibling,y.sibling=c,c=y,y=r}ff(o,!0,c,null,x);break;case"together":ff(o,!1,null,null,void 0);break;default:o.memoizedState=null}return o.child}function Nc(r,o){(o.mode&1)===0&&r!==null&&(r.alternate=null,o.alternate=null,o.flags|=2)}function Vr(r,o,c){if(r!==null&&(o.dependencies=r.dependencies),uo|=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=js(r,r.pendingProps),o.child=c,c.return=o;r.sibling!==null;)r=r.sibling,c=c.sibling=js(r,r.pendingProps),c.return=o;c.sibling=null}return o.child}function NA(r,o,c){switch(o.tag){case 3:hx(o),mi();break;case 5:A0(o);break;case 1:on(o.type)&&ac(o);break;case 4:Wd(o,o.stateNode.containerInfo);break;case 10:var m=o.type._context,y=o.memoizedProps.value;dt(hc,m._currentValue),m._currentValue=y;break;case 13:if(m=o.memoizedState,m!==null)return m.dehydrated!==null?(dt(bt,bt.current&1),o.flags|=128,null):(c&o.child.childLanes)!==0?mx(r,o,c):(dt(bt,bt.current&1),r=Vr(r,o,c),r!==null?r.sibling:null);dt(bt,bt.current&1);break;case 19:if(m=(c&o.childLanes)!==0,(r.flags&128)!==0){if(m)return yx(r,o,c);o.flags|=128}if(y=o.memoizedState,y!==null&&(y.rendering=null,y.tail=null,y.lastEffect=null),dt(bt,bt.current),m)break;return null;case 22:case 23:return o.lanes=0,ux(r,o,c)}return Vr(r,o,c)}var vx,hf,wx,xx;vx=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}},hf=function(){},wx=function(r,o,c,m){var y=r.memoizedProps;if(y!==m){r=o.stateNode,lo(kr.current);var x=null;switch(c){case"input":y=Ie(r,y),m=Ie(r,m),x=[];break;case"select":y=J({},y,{value:void 0}),m=J({},m,{value:void 0}),x=[];break;case"textarea":y=Xe(r,y),m=Xe(r,m),x=[];break;default:typeof y.onClick!="function"&&typeof m.onClick=="function"&&(r.onclick=sc)}st(c,m);var T;c=null;for(ce in y)if(!m.hasOwnProperty(ce)&&y.hasOwnProperty(ce)&&y[ce]!=null)if(ce==="style"){var U=y[ce];for(T in U)U.hasOwnProperty(T)&&(c||(c={}),c[T]="")}else ce!=="dangerouslySetInnerHTML"&&ce!=="children"&&ce!=="suppressContentEditableWarning"&&ce!=="suppressHydrationWarning"&&ce!=="autoFocus"&&(i.hasOwnProperty(ce)?x||(x=[]):(x=x||[]).push(ce,null));for(ce in m){var ee=m[ce];if(U=y!=null?y[ce]:void 0,m.hasOwnProperty(ce)&&ee!==U&&(ee!=null||U!=null))if(ce==="style")if(U){for(T in U)!U.hasOwnProperty(T)||ee&&ee.hasOwnProperty(T)||(c||(c={}),c[T]="");for(T in ee)ee.hasOwnProperty(T)&&U[T]!==ee[T]&&(c||(c={}),c[T]=ee[T])}else c||(x||(x=[]),x.push(ce,c)),c=ee;else ce==="dangerouslySetInnerHTML"?(ee=ee?ee.__html:void 0,U=U?U.__html:void 0,ee!=null&&U!==ee&&(x=x||[]).push(ce,ee)):ce==="children"?typeof ee!="string"&&typeof ee!="number"||(x=x||[]).push(ce,""+ee):ce!=="suppressContentEditableWarning"&&ce!=="suppressHydrationWarning"&&(i.hasOwnProperty(ce)?(ee!=null&&ce==="onScroll"&&ft("scroll",r),x||U===ee||(x=[])):(x=x||[]).push(ce,ee))}c&&(x=x||[]).push("style",c);var ce=x;(o.updateQueue=ce)&&(o.flags|=4)}},xx=function(r,o,c,m){c!==m&&(o.flags|=4)};function Oa(r,o){if(!mt)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 Xt(r){var o=r.alternate!==null&&r.alternate.child===r.child,c=0,m=0;if(o)for(var y=r.child;y!==null;)c|=y.lanes|y.childLanes,m|=y.subtreeFlags&14680064,m|=y.flags&14680064,y.return=r,y=y.sibling;else for(y=r.child;y!==null;)c|=y.lanes|y.childLanes,m|=y.subtreeFlags,m|=y.flags,y.return=r,y=y.sibling;return r.subtreeFlags|=m,r.childLanes=c,o}function EA(r,o,c){var m=o.pendingProps;switch(Od(o),o.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Xt(o),null;case 1:return on(o.type)&&ic(),Xt(o),null;case 3:return m=o.stateNode,wi(),ht(sn),ht(Yt),Vd(),m.pendingContext&&(m.context=m.pendingContext,m.pendingContext=null),(r===null||r.child===null)&&(dc(o)?o.flags|=4:r===null||r.memoizedState.isDehydrated&&(o.flags&256)===0||(o.flags|=1024,Xn!==null&&(Sf(Xn),Xn=null))),hf(r,o),Xt(o),null;case 5:Hd(o);var y=lo(Ta.current);if(c=o.type,r!==null&&o.stateNode!=null)wx(r,o,c,m,y),r.ref!==o.ref&&(o.flags|=512,o.flags|=2097152);else{if(!m){if(o.stateNode===null)throw Error(n(166));return Xt(o),null}if(r=lo(kr.current),dc(o)){m=o.stateNode,c=o.type;var x=o.memoizedProps;switch(m[br]=o,m[Sa]=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(y=0;y<ba.length;y++)ft(ba[y],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":be(m,x),ft("invalid",m);break;case"select":m._wrapperState={wasMultiple:!!x.multiple},ft("invalid",m);break;case"textarea":Pe(m,x),ft("invalid",m)}st(c,x),y=null;for(var T in x)if(x.hasOwnProperty(T)){var U=x[T];T==="children"?typeof U=="string"?m.textContent!==U&&(x.suppressHydrationWarning!==!0&&rc(m.textContent,U,r),y=["children",U]):typeof U=="number"&&m.textContent!==""+U&&(x.suppressHydrationWarning!==!0&&rc(m.textContent,U,r),y=["children",""+U]):i.hasOwnProperty(T)&&U!=null&&T==="onScroll"&&ft("scroll",m)}switch(c){case"input":Ee(m),pe(m,x,!0);break;case"textarea":Ee(m),Ge(m);break;case"select":case"option":break;default:typeof x.onClick=="function"&&(m.onclick=sc)}m=y,o.updateQueue=m,m!==null&&(o.flags|=4)}else{T=y.nodeType===9?y:y.ownerDocument,r==="http://www.w3.org/1999/xhtml"&&(r=it(c)),r==="http://www.w3.org/1999/xhtml"?c==="script"?(r=T.createElement("div"),r.innerHTML="<script><\/script>",r=r.removeChild(r.firstChild)):typeof m.is=="string"?r=T.createElement(c,{is:m.is}):(r=T.createElement(c),c==="select"&&(T=r,m.multiple?T.multiple=!0:m.size&&(T.size=m.size))):r=T.createElementNS(r,c),r[br]=o,r[Sa]=m,vx(r,o,!1,!1),o.stateNode=r;e:{switch(T=Te(c,m),c){case"dialog":ft("cancel",r),ft("close",r),y=m;break;case"iframe":case"object":case"embed":ft("load",r),y=m;break;case"video":case"audio":for(y=0;y<ba.length;y++)ft(ba[y],r);y=m;break;case"source":ft("error",r),y=m;break;case"img":case"image":case"link":ft("error",r),ft("load",r),y=m;break;case"details":ft("toggle",r),y=m;break;case"input":be(r,m),y=Ie(r,m),ft("invalid",r);break;case"option":y=m;break;case"select":r._wrapperState={wasMultiple:!!m.multiple},y=J({},m,{value:void 0}),ft("invalid",r);break;case"textarea":Pe(r,m),y=Xe(r,m),ft("invalid",r);break;default:y=m}st(c,y),U=y;for(x in U)if(U.hasOwnProperty(x)){var ee=U[x];x==="style"?Ve(r,ee):x==="dangerouslySetInnerHTML"?(ee=ee?ee.__html:void 0,ee!=null&&It(r,ee)):x==="children"?typeof ee=="string"?(c!=="textarea"||ee!=="")&&ae(r,ee):typeof ee=="number"&&ae(r,""+ee):x!=="suppressContentEditableWarning"&&x!=="suppressHydrationWarning"&&x!=="autoFocus"&&(i.hasOwnProperty(x)?ee!=null&&x==="onScroll"&&ft("scroll",r):ee!=null&&C(r,x,ee,T))}switch(c){case"input":Ee(r),pe(r,m,!1);break;case"textarea":Ee(r),Ge(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?ot(r,!!m.multiple,x,!1):m.defaultValue!=null&&ot(r,!!m.multiple,m.defaultValue,!0);break;default:typeof y.onClick=="function"&&(r.onclick=sc)}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 Xt(o),null;case 6:if(r&&o.stateNode!=null)xx(r,o,r.memoizedProps,m);else{if(typeof m!="string"&&o.stateNode===null)throw Error(n(166));if(c=lo(Ta.current),lo(kr.current),dc(o)){if(m=o.stateNode,c=o.memoizedProps,m[br]=o,(x=m.nodeValue!==c)&&(r=gn,r!==null))switch(r.tag){case 3:rc(m.nodeValue,c,(r.mode&1)!==0);break;case 5:r.memoizedProps.suppressHydrationWarning!==!0&&rc(m.nodeValue,c,(r.mode&1)!==0)}x&&(o.flags|=4)}else m=(c.nodeType===9?c:c.ownerDocument).createTextNode(m),m[br]=o,o.stateNode=m}return Xt(o),null;case 13:if(ht(bt),m=o.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(mt&&yn!==null&&(o.mode&1)!==0&&(o.flags&128)===0)_0(),mi(),o.flags|=98560,x=!1;else if(x=dc(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[br]=o}else mi(),(o.flags&128)===0&&(o.memoizedState=null),o.flags|=4;Xt(o),x=!1}else Xn!==null&&(Sf(Xn),Xn=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||(bt.current&1)!==0?$t===0&&($t=3):Cf())),o.updateQueue!==null&&(o.flags|=4),Xt(o),null);case 4:return wi(),hf(r,o),r===null&&ka(o.stateNode.containerInfo),Xt(o),null;case 10:return Fd(o.type._context),Xt(o),null;case 17:return on(o.type)&&ic(),Xt(o),null;case 19:if(ht(bt),x=o.memoizedState,x===null)return Xt(o),null;if(m=(o.flags&128)!==0,T=x.rendering,T===null)if(m)Oa(x,!1);else{if($t!==0||r!==null&&(r.flags&128)!==0)for(r=o.child;r!==null;){if(T=yc(r),T!==null){for(o.flags|=128,Oa(x,!1),m=T.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,T=x.alternate,T===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=T.childLanes,x.lanes=T.lanes,x.child=T.child,x.subtreeFlags=0,x.deletions=null,x.memoizedProps=T.memoizedProps,x.memoizedState=T.memoizedState,x.updateQueue=T.updateQueue,x.type=T.type,r=T.dependencies,x.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),c=c.sibling;return dt(bt,bt.current&1|2),o.child}r=r.sibling}x.tail!==null&&at()>_i&&(o.flags|=128,m=!0,Oa(x,!1),o.lanes=4194304)}else{if(!m)if(r=yc(T),r!==null){if(o.flags|=128,m=!0,c=r.updateQueue,c!==null&&(o.updateQueue=c,o.flags|=4),Oa(x,!0),x.tail===null&&x.tailMode==="hidden"&&!T.alternate&&!mt)return Xt(o),null}else 2*at()-x.renderingStartTime>_i&&c!==1073741824&&(o.flags|=128,m=!0,Oa(x,!1),o.lanes=4194304);x.isBackwards?(T.sibling=o.child,o.child=T):(c=x.last,c!==null?c.sibling=T:o.child=T,x.last=T)}return x.tail!==null?(o=x.tail,x.rendering=o,x.tail=o.sibling,x.renderingStartTime=at(),o.sibling=null,c=bt.current,dt(bt,m?c&1|2:c&1),o):(Xt(o),null);case 22:case 23:return Ef(),m=o.memoizedState!==null,r!==null&&r.memoizedState!==null!==m&&(o.flags|=8192),m&&(o.mode&1)!==0?(vn&1073741824)!==0&&(Xt(o),o.subtreeFlags&6&&(o.flags|=8192)):Xt(o),null;case 24:return null;case 25:return null}throw Error(n(156,o.tag))}function CA(r,o){switch(Od(o),o.tag){case 1:return on(o.type)&&ic(),r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 3:return wi(),ht(sn),ht(Yt),Vd(),r=o.flags,(r&65536)!==0&&(r&128)===0?(o.flags=r&-65537|128,o):null;case 5:return Hd(o),null;case 13:if(ht(bt),r=o.memoizedState,r!==null&&r.dehydrated!==null){if(o.alternate===null)throw Error(n(340));mi()}return r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 19:return ht(bt),null;case 4:return wi(),null;case 10:return Fd(o.type._context),null;case 22:case 23:return Ef(),null;case 24:return null;default:return null}}var Ec=!1,Qt=!1,jA=typeof WeakSet=="function"?WeakSet:Set,Ne=null;function bi(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 pf(r,o,c){try{c()}catch(m){St(r,o,m)}}var bx=!1;function TA(r,o){if(Nd=Ws,r=Ae(),Ue(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 y=m.anchorOffset,x=m.focusNode;m=m.focusOffset;try{c.nodeType,x.nodeType}catch{c=null;break e}var T=0,U=-1,ee=-1,ce=0,ye=0,ve=r,ge=null;t:for(;;){for(var _e;ve!==c||y!==0&&ve.nodeType!==3||(U=T+y),ve!==x||m!==0&&ve.nodeType!==3||(ee=T+m),ve.nodeType===3&&(T+=ve.nodeValue.length),(_e=ve.firstChild)!==null;)ge=ve,ve=_e;for(;;){if(ve===r)break t;if(ge===c&&++ce===y&&(U=T),ge===x&&++ye===m&&(ee=T),(_e=ve.nextSibling)!==null)break;ve=ge,ge=ve.parentNode}ve=_e}c=U===-1||ee===-1?null:{start:U,end:ee}}else c=null}c=c||{start:0,end:0}}else c=null;for(Ed={focusedElem:r,selectionRange:c},Ws=!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 Re=je.memoizedProps,jt=je.memoizedState,oe=o.stateNode,te=oe.getSnapshotBeforeUpdate(o.elementType===o.type?Re:Qn(o.type,Re),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(we){St(o,o.return,we)}if(r=o.sibling,r!==null){r.return=o.return,Ne=r;break}Ne=o.return}return je=bx,bx=!1,je}function Pa(r,o,c){var m=o.updateQueue;if(m=m!==null?m.lastEffect:null,m!==null){var y=m=m.next;do{if((y.tag&r)===r){var x=y.destroy;y.destroy=void 0,x!==void 0&&pf(o,c,x)}y=y.next}while(y!==m)}}function Cc(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 mf(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 kx(r){var o=r.alternate;o!==null&&(r.alternate=null,kx(o)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(o=r.stateNode,o!==null&&(delete o[br],delete o[Sa],delete o[Rd],delete o[dA],delete o[fA])),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 _x(r){return r.tag===5||r.tag===3||r.tag===4}function Sx(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||_x(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 gf(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=sc));else if(m!==4&&(r=r.child,r!==null))for(gf(r,o,c),r=r.sibling;r!==null;)gf(r,o,c),r=r.sibling}function yf(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(yf(r,o,c),r=r.sibling;r!==null;)yf(r,o,c),r=r.sibling}var Ut=null,Zn=!1;function _s(r,o,c){for(c=c.child;c!==null;)Nx(r,o,c),c=c.sibling}function Nx(r,o,c){if(rn&&typeof rn.onCommitFiberUnmount=="function")try{rn.onCommitFiberUnmount(wt,c)}catch{}switch(c.tag){case 5:Qt||bi(c,o);case 6:var m=Ut,y=Zn;Ut=null,_s(r,o,c),Ut=m,Zn=y,Ut!==null&&(Zn?(r=Ut,c=c.stateNode,r.nodeType===8?r.parentNode.removeChild(c):r.removeChild(c)):Ut.removeChild(c.stateNode));break;case 18:Ut!==null&&(Zn?(r=Ut,c=c.stateNode,r.nodeType===8?Td(r.parentNode,c):r.nodeType===1&&Td(r,c),us(r)):Td(Ut,c.stateNode));break;case 4:m=Ut,y=Zn,Ut=c.stateNode.containerInfo,Zn=!0,_s(r,o,c),Ut=m,Zn=y;break;case 0:case 11:case 14:case 15:if(!Qt&&(m=c.updateQueue,m!==null&&(m=m.lastEffect,m!==null))){y=m=m.next;do{var x=y,T=x.destroy;x=x.tag,T!==void 0&&((x&2)!==0||(x&4)!==0)&&pf(c,o,T),y=y.next}while(y!==m)}_s(r,o,c);break;case 1:if(!Qt&&(bi(c,o),m=c.stateNode,typeof m.componentWillUnmount=="function"))try{m.props=c.memoizedProps,m.state=c.memoizedState,m.componentWillUnmount()}catch(U){St(c,o,U)}_s(r,o,c);break;case 21:_s(r,o,c);break;case 22:c.mode&1?(Qt=(m=Qt)||c.memoizedState!==null,_s(r,o,c),Qt=m):_s(r,o,c);break;default:_s(r,o,c)}}function Ex(r){var o=r.updateQueue;if(o!==null){r.updateQueue=null;var c=r.stateNode;c===null&&(c=r.stateNode=new jA),o.forEach(function(m){var y=qA.bind(null,r,m);c.has(m)||(c.add(m),m.then(y,y))})}}function Jn(r,o){var c=o.deletions;if(c!==null)for(var m=0;m<c.length;m++){var y=c[m];try{var x=r,T=o,U=T;e:for(;U!==null;){switch(U.tag){case 5:Ut=U.stateNode,Zn=!1;break e;case 3:Ut=U.stateNode.containerInfo,Zn=!0;break e;case 4:Ut=U.stateNode.containerInfo,Zn=!0;break e}U=U.return}if(Ut===null)throw Error(n(160));Nx(x,T,y),Ut=null,Zn=!1;var ee=y.alternate;ee!==null&&(ee.return=null),y.return=null}catch(ce){St(y,o,ce)}}if(o.subtreeFlags&12854)for(o=o.child;o!==null;)Cx(o,r),o=o.sibling}function Cx(r,o){var c=r.alternate,m=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:if(Jn(o,r),Sr(r),m&4){try{Pa(3,r,r.return),Cc(3,r)}catch(Re){St(r,r.return,Re)}try{Pa(5,r,r.return)}catch(Re){St(r,r.return,Re)}}break;case 1:Jn(o,r),Sr(r),m&512&&c!==null&&bi(c,c.return);break;case 5:if(Jn(o,r),Sr(r),m&512&&c!==null&&bi(c,c.return),r.flags&32){var y=r.stateNode;try{ae(y,"")}catch(Re){St(r,r.return,Re)}}if(m&4&&(y=r.stateNode,y!=null)){var x=r.memoizedProps,T=c!==null?c.memoizedProps:x,U=r.type,ee=r.updateQueue;if(r.updateQueue=null,ee!==null)try{U==="input"&&x.type==="radio"&&x.name!=null&&ue(y,x),Te(U,T);var ce=Te(U,x);for(T=0;T<ee.length;T+=2){var ye=ee[T],ve=ee[T+1];ye==="style"?Ve(y,ve):ye==="dangerouslySetInnerHTML"?It(y,ve):ye==="children"?ae(y,ve):C(y,ye,ve,ce)}switch(U){case"input":re(y,x);break;case"textarea":Be(y,x);break;case"select":var ge=y._wrapperState.wasMultiple;y._wrapperState.wasMultiple=!!x.multiple;var _e=x.value;_e!=null?ot(y,!!x.multiple,_e,!1):ge!==!!x.multiple&&(x.defaultValue!=null?ot(y,!!x.multiple,x.defaultValue,!0):ot(y,!!x.multiple,x.multiple?[]:"",!1))}y[Sa]=x}catch(Re){St(r,r.return,Re)}}break;case 6:if(Jn(o,r),Sr(r),m&4){if(r.stateNode===null)throw Error(n(162));y=r.stateNode,x=r.memoizedProps;try{y.nodeValue=x}catch(Re){St(r,r.return,Re)}}break;case 3:if(Jn(o,r),Sr(r),m&4&&c!==null&&c.memoizedState.isDehydrated)try{us(o.containerInfo)}catch(Re){St(r,r.return,Re)}break;case 4:Jn(o,r),Sr(r);break;case 13:Jn(o,r),Sr(r),y=r.child,y.flags&8192&&(x=y.memoizedState!==null,y.stateNode.isHidden=x,!x||y.alternate!==null&&y.alternate.memoizedState!==null||(xf=at())),m&4&&Ex(r);break;case 22:if(ye=c!==null&&c.memoizedState!==null,r.mode&1?(Qt=(ce=Qt)||ye,Jn(o,r),Qt=ce):Jn(o,r),Sr(r),m&8192){if(ce=r.memoizedState!==null,(r.stateNode.isHidden=ce)&&!ye&&(r.mode&1)!==0)for(Ne=r,ye=r.child;ye!==null;){for(ve=Ne=ye;Ne!==null;){switch(ge=Ne,_e=ge.child,ge.tag){case 0:case 11:case 14:case 15:Pa(4,ge,ge.return);break;case 1:bi(ge,ge.return);var je=ge.stateNode;if(typeof je.componentWillUnmount=="function"){m=ge,c=ge.return;try{o=m,je.props=o.memoizedProps,je.state=o.memoizedState,je.componentWillUnmount()}catch(Re){St(m,c,Re)}}break;case 5:bi(ge,ge.return);break;case 22:if(ge.memoizedState!==null){Rx(ve);continue}}_e!==null?(_e.return=ge,Ne=_e):Rx(ve)}ye=ye.sibling}e:for(ye=null,ve=r;;){if(ve.tag===5){if(ye===null){ye=ve;try{y=ve.stateNode,ce?(x=y.style,typeof x.setProperty=="function"?x.setProperty("display","none","important"):x.display="none"):(U=ve.stateNode,ee=ve.memoizedProps.style,T=ee!=null&&ee.hasOwnProperty("display")?ee.display:null,U.style.display=Ce("display",T))}catch(Re){St(r,r.return,Re)}}}else if(ve.tag===6){if(ye===null)try{ve.stateNode.nodeValue=ce?"":ve.memoizedProps}catch(Re){St(r,r.return,Re)}}else if((ve.tag!==22&&ve.tag!==23||ve.memoizedState===null||ve===r)&&ve.child!==null){ve.child.return=ve,ve=ve.child;continue}if(ve===r)break e;for(;ve.sibling===null;){if(ve.return===null||ve.return===r)break e;ye===ve&&(ye=null),ve=ve.return}ye===ve&&(ye=null),ve.sibling.return=ve.return,ve=ve.sibling}}break;case 19:Jn(o,r),Sr(r),m&4&&Ex(r);break;case 21:break;default:Jn(o,r),Sr(r)}}function Sr(r){var o=r.flags;if(o&2){try{e:{for(var c=r.return;c!==null;){if(_x(c)){var m=c;break e}c=c.return}throw Error(n(160))}switch(m.tag){case 5:var y=m.stateNode;m.flags&32&&(ae(y,""),m.flags&=-33);var x=Sx(r);yf(r,x,y);break;case 3:case 4:var T=m.stateNode.containerInfo,U=Sx(r);gf(r,U,T);break;default:throw Error(n(161))}}catch(ee){St(r,r.return,ee)}r.flags&=-3}o&4096&&(r.flags&=-4097)}function RA(r,o,c){Ne=r,jx(r)}function jx(r,o,c){for(var m=(r.mode&1)!==0;Ne!==null;){var y=Ne,x=y.child;if(y.tag===22&&m){var T=y.memoizedState!==null||Ec;if(!T){var U=y.alternate,ee=U!==null&&U.memoizedState!==null||Qt;U=Ec;var ce=Qt;if(Ec=T,(Qt=ee)&&!ce)for(Ne=y;Ne!==null;)T=Ne,ee=T.child,T.tag===22&&T.memoizedState!==null?Ax(y):ee!==null?(ee.return=T,Ne=ee):Ax(y);for(;x!==null;)Ne=x,jx(x),x=x.sibling;Ne=y,Ec=U,Qt=ce}Tx(r)}else(y.subtreeFlags&8772)!==0&&x!==null?(x.return=y,Ne=x):Tx(r)}}function Tx(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:Qt||Cc(5,o);break;case 1:var m=o.stateNode;if(o.flags&4&&!Qt)if(c===null)m.componentDidMount();else{var y=o.elementType===o.type?c.memoizedProps:Qn(o.type,c.memoizedProps);m.componentDidUpdate(y,c.memoizedState,m.__reactInternalSnapshotBeforeUpdate)}var x=o.updateQueue;x!==null&&R0(o,x,m);break;case 3:var T=o.updateQueue;if(T!==null){if(c=null,o.child!==null)switch(o.child.tag){case 5:c=o.child.stateNode;break;case 1:c=o.child.stateNode}R0(o,T,c)}break;case 5:var U=o.stateNode;if(c===null&&o.flags&4){c=U;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 ce=o.alternate;if(ce!==null){var ye=ce.memoizedState;if(ye!==null){var ve=ye.dehydrated;ve!==null&&us(ve)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}Qt||o.flags&512&&mf(o)}catch(ge){St(o,o.return,ge)}}if(o===r){Ne=null;break}if(c=o.sibling,c!==null){c.return=o.return,Ne=c;break}Ne=o.return}}function Rx(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 Ax(r){for(;Ne!==null;){var o=Ne;try{switch(o.tag){case 0:case 11:case 15:var c=o.return;try{Cc(4,o)}catch(ee){St(o,c,ee)}break;case 1:var m=o.stateNode;if(typeof m.componentDidMount=="function"){var y=o.return;try{m.componentDidMount()}catch(ee){St(o,y,ee)}}var x=o.return;try{mf(o)}catch(ee){St(o,x,ee)}break;case 5:var T=o.return;try{mf(o)}catch(ee){St(o,T,ee)}}}catch(ee){St(o,o.return,ee)}if(o===r){Ne=null;break}var U=o.sibling;if(U!==null){U.return=o.return,Ne=U;break}Ne=o.return}}var AA=Math.ceil,jc=j.ReactCurrentDispatcher,vf=j.ReactCurrentOwner,Mn=j.ReactCurrentBatchConfig,Je=0,Dt=null,Tt=null,Wt=0,vn=0,ki=vs(0),$t=0,$a=null,uo=0,Tc=0,wf=0,La=null,ln=null,xf=0,_i=1/0,Yr=null,Rc=!1,bf=null,Ss=null,Ac=!1,Ns=null,Mc=0,qa=0,kf=null,Ic=-1,Oc=0;function nn(){return(Je&6)!==0?at():Ic!==-1?Ic:Ic=at()}function Es(r){return(r.mode&1)===0?1:(Je&2)!==0&&Wt!==0?Wt&-Wt:pA.transition!==null?(Oc===0&&(Oc=Bs()),Oc):(r=Qe,r!==0||(r=window.event,r=r===void 0?16:Zo(r.type)),r)}function er(r,o,c,m){if(50<qa)throw qa=0,kf=null,Error(n(185));as(r,c,m),((Je&2)===0||r!==Dt)&&(r===Dt&&((Je&2)===0&&(Tc|=c),$t===4&&Cs(r,Wt)),cn(r,m),c===1&&Je===0&&(o.mode&1)===0&&(_i=at()+500,lc&&xs()))}function cn(r,o){var c=r.callbackNode;Ml(r,o);var m=zs(r,r===Dt?Wt:0);if(m===0)c!==null&&Fs(c),r.callbackNode=null,r.callbackPriority=0;else if(o=m&-m,r.callbackPriority!==o){if(c!=null&&Fs(c),o===1)r.tag===0?hA(Ix.bind(null,r)):v0(Ix.bind(null,r)),cA(function(){(Je&6)===0&&xs()}),c=null;else{switch(oa(m)){case 1:c=rs;break;case 4:c=Gt;break;case 16:c=Bn;break;case 536870912:c=ss;break;default:c=Bn}c=zx(c,Mx.bind(null,r))}r.callbackPriority=o,r.callbackNode=c}}function Mx(r,o){if(Ic=-1,Oc=0,(Je&6)!==0)throw Error(n(327));var c=r.callbackNode;if(Si()&&r.callbackNode!==c)return null;var m=zs(r,r===Dt?Wt:0);if(m===0)return null;if((m&30)!==0||(m&r.expiredLanes)!==0||o)o=Pc(r,m);else{o=m;var y=Je;Je|=2;var x=Px();(Dt!==r||Wt!==o)&&(Yr=null,_i=at()+500,ho(r,o));do try{OA();break}catch(U){Ox(r,U)}while(!0);Dd(),jc.current=x,Je=y,Tt!==null?o=0:(Dt=null,Wt=0,o=$t)}if(o!==0){if(o===2&&(y=Ho(r),y!==0&&(m=y,o=_f(r,y))),o===1)throw c=$a,ho(r,0),Cs(r,m),cn(r,at()),c;if(o===6)Cs(r,m);else{if(y=r.current.alternate,(m&30)===0&&!MA(y)&&(o=Pc(r,m),o===2&&(x=Ho(r),x!==0&&(m=x,o=_f(r,x))),o===1))throw c=$a,ho(r,0),Cs(r,m),cn(r,at()),c;switch(r.finishedWork=y,r.finishedLanes=m,o){case 0:case 1:throw Error(n(345));case 2:po(r,ln,Yr);break;case 3:if(Cs(r,m),(m&130023424)===m&&(o=xf+500-at(),10<o)){if(zs(r,0)!==0)break;if(y=r.suspendedLanes,(y&m)!==m){nn(),r.pingedLanes|=r.suspendedLanes&y;break}r.timeoutHandle=jd(po.bind(null,r,ln,Yr),o);break}po(r,ln,Yr);break;case 4:if(Cs(r,m),(m&4194240)===m)break;for(o=r.eventTimes,y=-1;0<m;){var T=31-pn(m);x=1<<T,T=o[T],T>y&&(y=T),m&=~x}if(m=y,m=at()-m,m=(120>m?120:480>m?480:1080>m?1080:1920>m?1920:3e3>m?3e3:4320>m?4320:1960*AA(m/1960))-m,10<m){r.timeoutHandle=jd(po.bind(null,r,ln,Yr),m);break}po(r,ln,Yr);break;case 5:po(r,ln,Yr);break;default:throw Error(n(329))}}}return cn(r,at()),r.callbackNode===c?Mx.bind(null,r):null}function _f(r,o){var c=La;return r.current.memoizedState.isDehydrated&&(ho(r,o).flags|=256),r=Pc(r,o),r!==2&&(o=ln,ln=c,o!==null&&Sf(o)),r}function Sf(r){ln===null?ln=r:ln.push.apply(ln,r)}function MA(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 y=c[m],x=y.getSnapshot;y=y.value;try{if(!D(x(),y))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 Cs(r,o){for(o&=~wf,o&=~Tc,r.suspendedLanes|=o,r.pingedLanes&=~o,r=r.expirationTimes;0<o;){var c=31-pn(o),m=1<<c;r[c]=-1,o&=~m}}function Ix(r){if((Je&6)!==0)throw Error(n(327));Si();var o=zs(r,0);if((o&1)===0)return cn(r,at()),null;var c=Pc(r,o);if(r.tag!==0&&c===2){var m=Ho(r);m!==0&&(o=m,c=_f(r,m))}if(c===1)throw c=$a,ho(r,0),Cs(r,o),cn(r,at()),c;if(c===6)throw Error(n(345));return r.finishedWork=r.current.alternate,r.finishedLanes=o,po(r,ln,Yr),cn(r,at()),null}function Nf(r,o){var c=Je;Je|=1;try{return r(o)}finally{Je=c,Je===0&&(_i=at()+500,lc&&xs())}}function fo(r){Ns!==null&&Ns.tag===0&&(Je&6)===0&&Si();var o=Je;Je|=1;var c=Mn.transition,m=Qe;try{if(Mn.transition=null,Qe=1,r)return r()}finally{Qe=m,Mn.transition=c,Je=o,(Je&6)===0&&xs()}}function Ef(){vn=ki.current,ht(ki)}function ho(r,o){r.finishedWork=null,r.finishedLanes=0;var c=r.timeoutHandle;if(c!==-1&&(r.timeoutHandle=-1,lA(c)),Tt!==null)for(c=Tt.return;c!==null;){var m=c;switch(Od(m),m.tag){case 1:m=m.type.childContextTypes,m!=null&&ic();break;case 3:wi(),ht(sn),ht(Yt),Vd();break;case 5:Hd(m);break;case 4:wi();break;case 13:ht(bt);break;case 19:ht(bt);break;case 10:Fd(m.type._context);break;case 22:case 23:Ef()}c=c.return}if(Dt=r,Tt=r=js(r.current,null),Wt=vn=o,$t=0,$a=null,wf=Tc=uo=0,ln=La=null,ao!==null){for(o=0;o<ao.length;o++)if(c=ao[o],m=c.interleaved,m!==null){c.interleaved=null;var y=m.next,x=c.pending;if(x!==null){var T=x.next;x.next=y,m.next=T}c.pending=m}ao=null}return r}function Ox(r,o){do{var c=Tt;try{if(Dd(),vc.current=kc,wc){for(var m=kt.memoizedState;m!==null;){var y=m.queue;y!==null&&(y.pending=null),m=m.next}wc=!1}if(co=0,qt=Pt=kt=null,Ra=!1,Aa=0,vf.current=null,c===null||c.return===null){$t=1,$a=o,Tt=null;break}e:{var x=r,T=c.return,U=c,ee=o;if(o=Wt,U.flags|=32768,ee!==null&&typeof ee=="object"&&typeof ee.then=="function"){var ce=ee,ye=U,ve=ye.tag;if((ye.mode&1)===0&&(ve===0||ve===11||ve===15)){var ge=ye.alternate;ge?(ye.updateQueue=ge.updateQueue,ye.memoizedState=ge.memoizedState,ye.lanes=ge.lanes):(ye.updateQueue=null,ye.memoizedState=null)}var _e=ox(T);if(_e!==null){_e.flags&=-257,ix(_e,T,U,x,o),_e.mode&1&&sx(x,ce,o),o=_e,ee=ce;var je=o.updateQueue;if(je===null){var Re=new Set;Re.add(ee),o.updateQueue=Re}else je.add(ee);break e}else{if((o&1)===0){sx(x,ce,o),Cf();break e}ee=Error(n(426))}}else if(mt&&U.mode&1){var jt=ox(T);if(jt!==null){(jt.flags&65536)===0&&(jt.flags|=256),ix(jt,T,U,x,o),Ld(xi(ee,U));break e}}x=ee=xi(ee,U),$t!==4&&($t=2),La===null?La=[x]:La.push(x),x=T;do{switch(x.tag){case 3:x.flags|=65536,o&=-o,x.lanes|=o;var oe=nx(x,ee,o);T0(x,oe);break e;case 1:U=ee;var te=x.type,ie=x.stateNode;if((x.flags&128)===0&&(typeof te.getDerivedStateFromError=="function"||ie!==null&&typeof ie.componentDidCatch=="function"&&(Ss===null||!Ss.has(ie)))){x.flags|=65536,o&=-o,x.lanes|=o;var we=rx(x,U,o);T0(x,we);break e}}x=x.return}while(x!==null)}Lx(c)}catch(Me){o=Me,Tt===c&&c!==null&&(Tt=c=c.return);continue}break}while(!0)}function Px(){var r=jc.current;return jc.current=kc,r===null?kc:r}function Cf(){($t===0||$t===3||$t===2)&&($t=4),Dt===null||(uo&268435455)===0&&(Tc&268435455)===0||Cs(Dt,Wt)}function Pc(r,o){var c=Je;Je|=2;var m=Px();(Dt!==r||Wt!==o)&&(Yr=null,ho(r,o));do try{IA();break}catch(y){Ox(r,y)}while(!0);if(Dd(),Je=c,jc.current=m,Tt!==null)throw Error(n(261));return Dt=null,Wt=0,$t}function IA(){for(;Tt!==null;)$x(Tt)}function OA(){for(;Tt!==null&&!Do();)$x(Tt)}function $x(r){var o=Fx(r.alternate,r,vn);r.memoizedProps=r.pendingProps,o===null?Lx(r):Tt=o,vf.current=null}function Lx(r){var o=r;do{var c=o.alternate;if(r=o.return,(o.flags&32768)===0){if(c=EA(c,o,vn),c!==null){Tt=c;return}}else{if(c=CA(c,o),c!==null){c.flags&=32767,Tt=c;return}if(r!==null)r.flags|=32768,r.subtreeFlags=0,r.deletions=null;else{$t=6,Tt=null;return}}if(o=o.sibling,o!==null){Tt=o;return}Tt=o=r}while(o!==null);$t===0&&($t=5)}function po(r,o,c){var m=Qe,y=Mn.transition;try{Mn.transition=null,Qe=1,PA(r,o,c,m)}finally{Mn.transition=y,Qe=m}return null}function PA(r,o,c,m){do Si();while(Ns!==null);if((Je&6)!==0)throw Error(n(327));c=r.finishedWork;var y=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(Zt(r,x),r===Dt&&(Tt=Dt=null,Wt=0),(c.subtreeFlags&2064)===0&&(c.flags&2064)===0||Ac||(Ac=!0,zx(Bn,function(){return Si(),null})),x=(c.flags&15990)!==0,(c.subtreeFlags&15990)!==0||x){x=Mn.transition,Mn.transition=null;var T=Qe;Qe=1;var U=Je;Je|=4,vf.current=null,TA(r,c),Cx(c,r),et(Ed),Ws=!!Nd,Ed=Nd=null,r.current=c,RA(c),Fo(),Je=U,Qe=T,Mn.transition=x}else r.current=c;if(Ac&&(Ac=!1,Ns=r,Mc=y),x=r.pendingLanes,x===0&&(Ss=null),Un(c.stateNode),cn(r,at()),o!==null)for(m=r.onRecoverableError,c=0;c<o.length;c++)y=o[c],m(y.value,{componentStack:y.stack,digest:y.digest});if(Rc)throw Rc=!1,r=bf,bf=null,r;return(Mc&1)!==0&&r.tag!==0&&Si(),x=r.pendingLanes,(x&1)!==0?r===kf?qa++:(qa=0,kf=r):qa=0,xs(),null}function Si(){if(Ns!==null){var r=oa(Mc),o=Mn.transition,c=Qe;try{if(Mn.transition=null,Qe=16>r?16:r,Ns===null)var m=!1;else{if(r=Ns,Ns=null,Mc=0,(Je&6)!==0)throw Error(n(331));var y=Je;for(Je|=4,Ne=r.current;Ne!==null;){var x=Ne,T=x.child;if((Ne.flags&16)!==0){var U=x.deletions;if(U!==null){for(var ee=0;ee<U.length;ee++){var ce=U[ee];for(Ne=ce;Ne!==null;){var ye=Ne;switch(ye.tag){case 0:case 11:case 15:Pa(8,ye,x)}var ve=ye.child;if(ve!==null)ve.return=ye,Ne=ve;else for(;Ne!==null;){ye=Ne;var ge=ye.sibling,_e=ye.return;if(kx(ye),ye===ce){Ne=null;break}if(ge!==null){ge.return=_e,Ne=ge;break}Ne=_e}}}var je=x.alternate;if(je!==null){var Re=je.child;if(Re!==null){je.child=null;do{var jt=Re.sibling;Re.sibling=null,Re=jt}while(Re!==null)}}Ne=x}}if((x.subtreeFlags&2064)!==0&&T!==null)T.return=x,Ne=T;else e:for(;Ne!==null;){if(x=Ne,(x.flags&2048)!==0)switch(x.tag){case 0:case 11:case 15:Pa(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;){T=Ne;var ie=T.child;if((T.subtreeFlags&2064)!==0&&ie!==null)ie.return=T,Ne=ie;else e:for(T=te;Ne!==null;){if(U=Ne,(U.flags&2048)!==0)try{switch(U.tag){case 0:case 11:case 15:Cc(9,U)}}catch(Me){St(U,U.return,Me)}if(U===T){Ne=null;break e}var we=U.sibling;if(we!==null){we.return=U.return,Ne=we;break e}Ne=U.return}}if(Je=y,xs(),rn&&typeof rn.onPostCommitFiberRoot=="function")try{rn.onPostCommitFiberRoot(wt,r)}catch{}m=!0}return m}finally{Qe=c,Mn.transition=o}}return!1}function qx(r,o,c){o=xi(c,o),o=nx(r,o,1),r=ks(r,o,1),o=nn(),r!==null&&(as(r,1,o),cn(r,o))}function St(r,o,c){if(r.tag===3)qx(r,r,c);else for(;o!==null;){if(o.tag===3){qx(o,r,c);break}else if(o.tag===1){var m=o.stateNode;if(typeof o.type.getDerivedStateFromError=="function"||typeof m.componentDidCatch=="function"&&(Ss===null||!Ss.has(m))){r=xi(c,r),r=rx(o,r,1),o=ks(o,r,1),r=nn(),o!==null&&(as(o,1,r),cn(o,r));break}}o=o.return}}function $A(r,o,c){var m=r.pingCache;m!==null&&m.delete(o),o=nn(),r.pingedLanes|=r.suspendedLanes&c,Dt===r&&(Wt&c)===c&&($t===4||$t===3&&(Wt&130023424)===Wt&&500>at()-xf?ho(r,0):wf|=c),cn(r,o)}function Dx(r,o){o===0&&((r.mode&1)===0?o=1:(o=Wo,Wo<<=1,(Wo&130023424)===0&&(Wo=4194304)));var c=nn();r=Hr(r,o),r!==null&&(as(r,o,c),cn(r,c))}function LA(r){var o=r.memoizedState,c=0;o!==null&&(c=o.retryLane),Dx(r,c)}function qA(r,o){var c=0;switch(r.tag){case 13:var m=r.stateNode,y=r.memoizedState;y!==null&&(c=y.retryLane);break;case 19:m=r.stateNode;break;default:throw Error(n(314))}m!==null&&m.delete(o),Dx(r,c)}var Fx;Fx=function(r,o,c){if(r!==null)if(r.memoizedProps!==o.pendingProps||sn.current)an=!0;else{if((r.lanes&c)===0&&(o.flags&128)===0)return an=!1,NA(r,o,c);an=(r.flags&131072)!==0}else an=!1,mt&&(o.flags&1048576)!==0&&w0(o,uc,o.index);switch(o.lanes=0,o.tag){case 2:var m=o.type;Nc(r,o),r=o.pendingProps;var y=fi(o,Yt.current);vi(o,c),y=Xd(null,o,m,r,y,c);var x=Qd();return o.flags|=1,typeof y=="object"&&y!==null&&typeof y.render=="function"&&y.$$typeof===void 0?(o.tag=1,o.memoizedState=null,o.updateQueue=null,on(m)?(x=!0,ac(o)):x=!1,o.memoizedState=y.state!==null&&y.state!==void 0?y.state:null,Ud(o),y.updater=_c,o.stateNode=y,y._reactInternals=o,rf(o,m,r,c),o=lf(null,o,m,!0,x,c)):(o.tag=0,mt&&x&&Id(o),tn(null,o,y,c),o=o.child),o;case 16:m=o.elementType;e:{switch(Nc(r,o),r=o.pendingProps,y=m._init,m=y(m._payload),o.type=m,y=o.tag=FA(m),r=Qn(m,r),y){case 0:o=af(null,o,m,r,c);break e;case 1:o=fx(null,o,m,r,c);break e;case 11:o=ax(null,o,m,r,c);break e;case 14:o=lx(null,o,m,Qn(m.type,r),c);break e}throw Error(n(306,m,""))}return o;case 0:return m=o.type,y=o.pendingProps,y=o.elementType===m?y:Qn(m,y),af(r,o,m,y,c);case 1:return m=o.type,y=o.pendingProps,y=o.elementType===m?y:Qn(m,y),fx(r,o,m,y,c);case 3:e:{if(hx(o),r===null)throw Error(n(387));m=o.pendingProps,x=o.memoizedState,y=x.element,j0(r,o),gc(o,m,null,c);var T=o.memoizedState;if(m=T.element,x.isDehydrated)if(x={element:m,isDehydrated:!1,cache:T.cache,pendingSuspenseBoundaries:T.pendingSuspenseBoundaries,transitions:T.transitions},o.updateQueue.baseState=x,o.memoizedState=x,o.flags&256){y=xi(Error(n(423)),o),o=px(r,o,m,c,y);break e}else if(m!==y){y=xi(Error(n(424)),o),o=px(r,o,m,c,y);break e}else for(yn=ys(o.stateNode.containerInfo.firstChild),gn=o,mt=!0,Xn=null,c=E0(o,null,m,c),o.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling;else{if(mi(),m===y){o=Vr(r,o,c);break e}tn(r,o,m,c)}o=o.child}return o;case 5:return A0(o),r===null&&$d(o),m=o.type,y=o.pendingProps,x=r!==null?r.memoizedProps:null,T=y.children,Cd(m,y)?T=null:x!==null&&Cd(m,x)&&(o.flags|=32),dx(r,o),tn(r,o,T,c),o.child;case 6:return r===null&&$d(o),null;case 13:return mx(r,o,c);case 4:return Wd(o,o.stateNode.containerInfo),m=o.pendingProps,r===null?o.child=gi(o,null,m,c):tn(r,o,m,c),o.child;case 11:return m=o.type,y=o.pendingProps,y=o.elementType===m?y:Qn(m,y),ax(r,o,m,y,c);case 7:return tn(r,o,o.pendingProps,c),o.child;case 8:return tn(r,o,o.pendingProps.children,c),o.child;case 12:return tn(r,o,o.pendingProps.children,c),o.child;case 10:e:{if(m=o.type._context,y=o.pendingProps,x=o.memoizedProps,T=y.value,dt(hc,m._currentValue),m._currentValue=T,x!==null)if(D(x.value,T)){if(x.children===y.children&&!sn.current){o=Vr(r,o,c);break e}}else for(x=o.child,x!==null&&(x.return=o);x!==null;){var U=x.dependencies;if(U!==null){T=x.child;for(var ee=U.firstContext;ee!==null;){if(ee.context===m){if(x.tag===1){ee=Gr(-1,c&-c),ee.tag=2;var ce=x.updateQueue;if(ce!==null){ce=ce.shared;var ye=ce.pending;ye===null?ee.next=ee:(ee.next=ye.next,ye.next=ee),ce.pending=ee}}x.lanes|=c,ee=x.alternate,ee!==null&&(ee.lanes|=c),zd(x.return,c,o),U.lanes|=c;break}ee=ee.next}}else if(x.tag===10)T=x.type===o.type?null:x.child;else if(x.tag===18){if(T=x.return,T===null)throw Error(n(341));T.lanes|=c,U=T.alternate,U!==null&&(U.lanes|=c),zd(T,c,o),T=x.sibling}else T=x.child;if(T!==null)T.return=x;else for(T=x;T!==null;){if(T===o){T=null;break}if(x=T.sibling,x!==null){x.return=T.return,T=x;break}T=T.return}x=T}tn(r,o,y.children,c),o=o.child}return o;case 9:return y=o.type,m=o.pendingProps.children,vi(o,c),y=Rn(y),m=m(y),o.flags|=1,tn(r,o,m,c),o.child;case 14:return m=o.type,y=Qn(m,o.pendingProps),y=Qn(m.type,y),lx(r,o,m,y,c);case 15:return cx(r,o,o.type,o.pendingProps,c);case 17:return m=o.type,y=o.pendingProps,y=o.elementType===m?y:Qn(m,y),Nc(r,o),o.tag=1,on(m)?(r=!0,ac(o)):r=!1,vi(o,c),ex(o,m,y),rf(o,m,y,c),lf(null,o,m,!0,r,c);case 19:return yx(r,o,c);case 22:return ux(r,o,c)}throw Error(n(156,o.tag))};function zx(r,o){return Ds(r,o)}function DA(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 In(r,o,c,m){return new DA(r,o,c,m)}function jf(r){return r=r.prototype,!(!r||!r.isReactComponent)}function FA(r){if(typeof r=="function")return jf(r)?1:0;if(r!=null){if(r=r.$$typeof,r===H)return 11;if(r===Q)return 14}return 2}function js(r,o){var c=r.alternate;return c===null?(c=In(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 $c(r,o,c,m,y,x){var T=2;if(m=r,typeof r=="function")jf(r)&&(T=1);else if(typeof r=="string")T=5;else e:switch(r){case P:return mo(c.children,y,x,o);case z:T=8,y|=8;break;case M:return r=In(12,c,o,y|2),r.elementType=M,r.lanes=x,r;case Y:return r=In(13,c,o,y),r.elementType=Y,r.lanes=x,r;case R:return r=In(19,c,o,y),r.elementType=R,r.lanes=x,r;case ne:return Lc(c,y,x,o);default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case A:T=10;break e;case q:T=9;break e;case H:T=11;break e;case Q:T=14;break e;case W:T=16,m=null;break e}throw Error(n(130,r==null?r:typeof r,""))}return o=In(T,c,o,y),o.elementType=r,o.type=m,o.lanes=x,o}function mo(r,o,c,m){return r=In(7,r,m,o),r.lanes=c,r}function Lc(r,o,c,m){return r=In(22,r,m,o),r.elementType=ne,r.lanes=c,r.stateNode={isHidden:!1},r}function Tf(r,o,c){return r=In(6,r,null,o),r.lanes=c,r}function Rf(r,o,c){return o=In(4,r.children!==null?r.children:[],r.key,o),o.lanes=c,o.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},o}function zA(r,o,c,m,y){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=Go(0),this.expirationTimes=Go(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Go(0),this.identifierPrefix=m,this.onRecoverableError=y,this.mutableSourceEagerHydrationData=null}function Af(r,o,c,m,y,x,T,U,ee){return r=new zA(r,o,c,U,ee),o===1?(o=1,x===!0&&(o|=8)):o=0,x=In(3,null,null,o),r.current=x,x.stateNode=r,x.memoizedState={element:m,isDehydrated:c,cache:null,transitions:null,pendingSuspenseBoundaries:null},Ud(x),r}function BA(r,o,c){var m=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:O,key:m==null?null:""+m,children:r,containerInfo:o,implementation:c}}function Bx(r){if(!r)return ws;r=r._reactInternals;e:{if(Nn(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(on(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(on(c))return g0(r,c,o)}return o}function Ux(r,o,c,m,y,x,T,U,ee){return r=Af(c,m,!0,r,y,x,T,U,ee),r.context=Bx(null),c=r.current,m=nn(),y=Es(c),x=Gr(m,y),x.callback=o??null,ks(c,x,y),r.current.lanes=y,as(r,y,m),cn(r,m),r}function qc(r,o,c,m){var y=o.current,x=nn(),T=Es(y);return c=Bx(c),o.context===null?o.context=c:o.pendingContext=c,o=Gr(x,T),o.payload={element:r},m=m===void 0?null:m,m!==null&&(o.callback=m),r=ks(y,o,T),r!==null&&(er(r,y,T,x),mc(r,y,T)),T}function Dc(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 Wx(r,o){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var c=r.retryLane;r.retryLane=c!==0&&c<o?c:o}}function Mf(r,o){Wx(r,o),(r=r.alternate)&&Wx(r,o)}function UA(){return null}var Hx=typeof reportError=="function"?reportError:function(r){console.error(r)};function If(r){this._internalRoot=r}Fc.prototype.render=If.prototype.render=function(r){var o=this._internalRoot;if(o===null)throw Error(n(409));qc(r,o,null,null)},Fc.prototype.unmount=If.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var o=r.containerInfo;fo(function(){qc(null,r,null,null)}),o[zr]=null}};function Fc(r){this._internalRoot=r}Fc.prototype.unstable_scheduleHydration=function(r){if(r){var o=Wn();r={blockedOn:null,target:r,priority:o};for(var c=0;c<Vn.length&&o!==0&&o<Vn[c].priority;c++);Vn.splice(c,0,r),c===0&&Ko(r)}};function Of(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function zc(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11&&(r.nodeType!==8||r.nodeValue!==" react-mount-point-unstable "))}function Gx(){}function WA(r,o,c,m,y){if(y){if(typeof m=="function"){var x=m;m=function(){var ce=Dc(T);x.call(ce)}}var T=Ux(o,m,r,0,null,!1,!1,"",Gx);return r._reactRootContainer=T,r[zr]=T.current,ka(r.nodeType===8?r.parentNode:r),fo(),T}for(;y=r.lastChild;)r.removeChild(y);if(typeof m=="function"){var U=m;m=function(){var ce=Dc(ee);U.call(ce)}}var ee=Af(r,0,!1,null,null,!1,!1,"",Gx);return r._reactRootContainer=ee,r[zr]=ee.current,ka(r.nodeType===8?r.parentNode:r),fo(function(){qc(o,ee,c,m)}),ee}function Bc(r,o,c,m,y){var x=c._reactRootContainer;if(x){var T=x;if(typeof y=="function"){var U=y;y=function(){var ee=Dc(T);U.call(ee)}}qc(o,T,r,y)}else T=WA(c,o,r,y,m);return Dc(T)}Il=function(r){switch(r.tag){case 3:var o=r.stateNode;if(o.current.memoizedState.isDehydrated){var c=os(o.pendingLanes);c!==0&&(ls(o,c|1),cn(o,at()),(Je&6)===0&&(_i=at()+500,xs()))}break;case 13:fo(function(){var m=Hr(r,1);if(m!==null){var y=nn();er(m,r,1,y)}}),Mf(r,1)}},Or=function(r){if(r.tag===13){var o=Hr(r,134217728);if(o!==null){var c=nn();er(o,r,134217728,c)}Mf(r,134217728)}},ia=function(r){if(r.tag===13){var o=Es(r),c=Hr(r,o);if(c!==null){var m=nn();er(c,r,o,m)}Mf(r,o)}},Wn=function(){return Qe},Ol=function(r,o){var c=Qe;try{return Qe=r,o()}finally{Qe=c}},_t=function(r,o,c){switch(o){case"input":if(re(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 y=oc(m);if(!y)throw Error(n(90));He(m),re(m,y)}}}break;case"textarea":Be(r,c);break;case"select":o=c.value,o!=null&&ot(r,!!c.multiple,o,!1)}},Ao=Nf,Mo=fo;var HA={usingClientEntryPoint:!1,Events:[Na,ui,oc,Ro,hn,Nf]},Da={findFiberByHostInstance:ro,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},GA={bundleType:Da.bundleType,version:Da.version,rendererPackageName:Da.rendererPackageName,rendererConfig:Da.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:j.ReactCurrentDispatcher,findHostInstanceByFiber:function(r){return r=zn(r),r===null?null:r.stateNode},findFiberByHostInstance:Da.findFiberByHostInstance||UA,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 Uc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Uc.isDisabled&&Uc.supportsFiber)try{wt=Uc.inject(GA),rn=Uc}catch{}}return un.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=HA,un.createPortal=function(r,o){var c=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Of(o))throw Error(n(200));return BA(r,o,null,c)},un.createRoot=function(r,o){if(!Of(r))throw Error(n(299));var c=!1,m="",y=Hx;return o!=null&&(o.unstable_strictMode===!0&&(c=!0),o.identifierPrefix!==void 0&&(m=o.identifierPrefix),o.onRecoverableError!==void 0&&(y=o.onRecoverableError)),o=Af(r,1,!1,null,null,c,!1,m,y),r[zr]=o.current,ka(r.nodeType===8?r.parentNode:r),new If(o)},un.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=zn(o),r=r===null?null:r.stateNode,r},un.flushSync=function(r){return fo(r)},un.hydrate=function(r,o,c){if(!zc(o))throw Error(n(200));return Bc(null,r,o,!0,c)},un.hydrateRoot=function(r,o,c){if(!Of(r))throw Error(n(405));var m=c!=null&&c.hydratedSources||null,y=!1,x="",T=Hx;if(c!=null&&(c.unstable_strictMode===!0&&(y=!0),c.identifierPrefix!==void 0&&(x=c.identifierPrefix),c.onRecoverableError!==void 0&&(T=c.onRecoverableError)),o=Ux(o,null,r,1,c??null,y,!1,x,T),r[zr]=o.current,ka(r),m)for(r=0;r<m.length;r++)c=m[r],y=c._getVersion,y=y(c._source),o.mutableSourceEagerHydrationData==null?o.mutableSourceEagerHydrationData=[c,y]:o.mutableSourceEagerHydrationData.push(c,y);return new Fc(o)},un.render=function(r,o,c){if(!zc(o))throw Error(n(200));return Bc(null,r,o,!1,c)},un.unmountComponentAtNode=function(r){if(!zc(r))throw Error(n(40));return r._reactRootContainer?(fo(function(){Bc(null,null,r,!1,function(){r._reactRootContainer=null,r[zr]=null})}),!0):!1},un.unstable_batchedUpdates=Nf,un.unstable_renderSubtreeIntoContainer=function(r,o,c,m){if(!zc(c))throw Error(n(200));if(r==null||r._reactInternals===void 0)throw Error(n(38));return Bc(r,o,c,!1,m)},un.version="18.3.1-next-f1338f8080-20240426",un}var eb;function MC(){if(eb)return Lf.exports;eb=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(),Lf.exports=JA(),Lf.exports}var tb;function e2(){if(tb)return Hc;tb=1;var e=MC();return Hc.createRoot=e.createRoot,Hc.hydrateRoot=e.hydrateRoot,Hc}var t2=e2(),_=gl();const de=iw(_);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 Ff={exports:{}},zf={},Bf={exports:{}},Uf={};/**
40
+ `+x.stack}return{value:r,source:o,stack:y,digest:null}}function af(r,o,c){return{value:r,source:null,stack:c??null,digest:o??null}}function lf(r,o){try{console.error(o.value)}catch(c){setTimeout(function(){throw c})}}var kA=typeof WeakMap=="function"?WeakMap:Map;function nx(r,o,c){c=Gr(-1,c),c.tag=3,c.payload={element:null};var m=o.value;return c.callback=function(){Ic||(Ic=!0,_f=m),lf(r,o)},c}function rx(r,o,c){c=Gr(-1,c),c.tag=3;var m=r.type.getDerivedStateFromError;if(typeof m=="function"){var y=o.value;c.payload=function(){return m(y)},c.callback=function(){lf(r,o)}}var x=r.stateNode;return x!==null&&typeof x.componentDidCatch=="function"&&(c.callback=function(){lf(r,o),typeof m!="function"&&(Ns===null?Ns=new Set([this]):Ns.add(this));var T=o.stack;this.componentDidCatch(o.value,{componentStack:T!==null?T:""})}),c}function sx(r,o,c){var m=r.pingCache;if(m===null){m=r.pingCache=new kA;var y=new Set;m.set(o,y)}else y=m.get(o),y===void 0&&(y=new Set,m.set(o,y));y.has(c)||(y.add(c),r=$A.bind(null,r,o,c),o.then(r,r))}function ox(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 ix(r,o,c,m,y){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=Gr(-1,1),o.tag=2,_s(c,o,1))),c.lanes|=1),r):(r.flags|=65536,r.lanes=y,r)}var _A=j.ReactCurrentOwner,an=!1;function tn(r,o,c,m){o.child=r===null?E0(o,null,c,m):mi(o,r.child,c,m)}function ax(r,o,c,m,y){c=c.render;var x=o.ref;return yi(o,y),m=Zd(r,o,c,m,x,y),c=Jd(),r!==null&&!an?(o.updateQueue=r.updateQueue,o.flags&=-2053,r.lanes&=~y,Vr(r,o,y)):(gt&&c&&Pd(o),o.flags|=1,tn(r,o,m,y),o.child)}function lx(r,o,c,m,y){if(r===null){var x=c.type;return typeof x=="function"&&!Rf(x)&&x.defaultProps===void 0&&c.compare===null&&c.defaultProps===void 0?(o.tag=15,o.type=x,cx(r,o,x,m,y)):(r=Dc(c.type,null,m,o,o.mode,y),r.ref=o.ref,r.return=o,o.child=r)}if(x=r.child,(r.lanes&y)===0){var T=x.memoizedProps;if(c=c.compare,c=c!==null?c:ps,c(T,m)&&r.ref===o.ref)return Vr(r,o,y)}return o.flags|=1,r=Ts(x,m),r.ref=o.ref,r.return=o,o.child=r}function cx(r,o,c,m,y){if(r!==null){var x=r.memoizedProps;if(ps(x,m)&&r.ref===o.ref)if(an=!1,o.pendingProps=m=x,(r.lanes&y)!==0)(r.flags&131072)!==0&&(an=!0);else return o.lanes=r.lanes,Vr(r,o,y)}return cf(r,o,c,m,y)}function ux(r,o,c){var m=o.pendingProps,y=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},ft(bi,wn),wn|=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,ft(bi,wn),wn|=r,null;o.memoizedState={baseLanes:0,cachePool:null,transitions:null},m=x!==null?x.baseLanes:c,ft(bi,wn),wn|=m}else x!==null?(m=x.baseLanes|c,o.memoizedState=null):m=c,ft(bi,wn),wn|=m;return tn(r,o,y,c),o.child}function dx(r,o){var c=o.ref;(r===null&&c!==null||r!==null&&r.ref!==c)&&(o.flags|=512,o.flags|=2097152)}function cf(r,o,c,m,y){var x=on(c)?ro:Yt.current;return x=di(o,x),yi(o,y),c=Zd(r,o,c,m,x,y),m=Jd(),r!==null&&!an?(o.updateQueue=r.updateQueue,o.flags&=-2053,r.lanes&=~y,Vr(r,o,y)):(gt&&m&&Pd(o),o.flags|=1,tn(r,o,c,y),o.child)}function fx(r,o,c,m,y){if(on(c)){var x=!0;uc(o)}else x=!1;if(yi(o,y),o.stateNode===null)jc(r,o),ex(o,c,m),of(o,c,m,y),m=!0;else if(r===null){var T=o.stateNode,W=o.memoizedProps;T.props=W;var ee=T.context,ce=c.contextType;typeof ce=="object"&&ce!==null?ce=An(ce):(ce=on(c)?ro:Yt.current,ce=di(o,ce));var ye=c.getDerivedStateFromProps,ve=typeof ye=="function"||typeof T.getSnapshotBeforeUpdate=="function";ve||typeof T.UNSAFE_componentWillReceiveProps!="function"&&typeof T.componentWillReceiveProps!="function"||(W!==m||ee!==ce)&&tx(o,T,m,ce),ks=!1;var ge=o.memoizedState;T.state=ge,wc(o,m,T,y),ee=o.memoizedState,W!==m||ge!==ee||sn.current||ks?(typeof ye=="function"&&(sf(o,c,ye,m),ee=o.memoizedState),(W=ks||J0(o,c,W,m,ge,ee,ce))?(ve||typeof T.UNSAFE_componentWillMount!="function"&&typeof T.componentWillMount!="function"||(typeof T.componentWillMount=="function"&&T.componentWillMount(),typeof T.UNSAFE_componentWillMount=="function"&&T.UNSAFE_componentWillMount()),typeof T.componentDidMount=="function"&&(o.flags|=4194308)):(typeof T.componentDidMount=="function"&&(o.flags|=4194308),o.memoizedProps=m,o.memoizedState=ee),T.props=m,T.state=ee,T.context=ce,m=W):(typeof T.componentDidMount=="function"&&(o.flags|=4194308),m=!1)}else{T=o.stateNode,j0(r,o),W=o.memoizedProps,ce=o.type===o.elementType?W:Jn(o.type,W),T.props=ce,ve=o.pendingProps,ge=T.context,ee=c.contextType,typeof ee=="object"&&ee!==null?ee=An(ee):(ee=on(c)?ro:Yt.current,ee=di(o,ee));var Se=c.getDerivedStateFromProps;(ye=typeof Se=="function"||typeof T.getSnapshotBeforeUpdate=="function")||typeof T.UNSAFE_componentWillReceiveProps!="function"&&typeof T.componentWillReceiveProps!="function"||(W!==ve||ge!==ee)&&tx(o,T,m,ee),ks=!1,ge=o.memoizedState,T.state=ge,wc(o,m,T,y);var je=o.memoizedState;W!==ve||ge!==je||sn.current||ks?(typeof Se=="function"&&(sf(o,c,Se,m),je=o.memoizedState),(ce=ks||J0(o,c,ce,m,ge,je,ee)||!1)?(ye||typeof T.UNSAFE_componentWillUpdate!="function"&&typeof T.componentWillUpdate!="function"||(typeof T.componentWillUpdate=="function"&&T.componentWillUpdate(m,je,ee),typeof T.UNSAFE_componentWillUpdate=="function"&&T.UNSAFE_componentWillUpdate(m,je,ee)),typeof T.componentDidUpdate=="function"&&(o.flags|=4),typeof T.getSnapshotBeforeUpdate=="function"&&(o.flags|=1024)):(typeof T.componentDidUpdate!="function"||W===r.memoizedProps&&ge===r.memoizedState||(o.flags|=4),typeof T.getSnapshotBeforeUpdate!="function"||W===r.memoizedProps&&ge===r.memoizedState||(o.flags|=1024),o.memoizedProps=m,o.memoizedState=je),T.props=m,T.state=je,T.context=ee,m=ce):(typeof T.componentDidUpdate!="function"||W===r.memoizedProps&&ge===r.memoizedState||(o.flags|=4),typeof T.getSnapshotBeforeUpdate!="function"||W===r.memoizedProps&&ge===r.memoizedState||(o.flags|=1024),m=!1)}return uf(r,o,c,m,x,y)}function uf(r,o,c,m,y,x){dx(r,o);var T=(o.flags&128)!==0;if(!m&&!T)return y&&y0(o,c,!1),Vr(r,o,x);m=o.stateNode,_A.current=o;var W=T&&typeof c.getDerivedStateFromError!="function"?null:m.render();return o.flags|=1,r!==null&&T?(o.child=mi(o,r.child,null,x),o.child=mi(o,null,W,x)):tn(r,o,W,x),o.memoizedState=m.state,y&&y0(o,c,!0),o.child}function hx(r){var o=r.stateNode;o.pendingContext?m0(r,o.pendingContext,o.pendingContext!==o.context):o.context&&m0(r,o.context,!1),Gd(r,o.containerInfo)}function px(r,o,c,m,y){return pi(),Dd(y),o.flags|=256,tn(r,o,c,m),o.child}var df={dehydrated:null,treeContext:null,retryLane:0};function ff(r){return{baseLanes:r,cachePool:null,transitions:null}}function mx(r,o,c){var m=o.pendingProps,y=kt.current,x=!1,T=(o.flags&128)!==0,W;if((W=T)||(W=r!==null&&r.memoizedState===null?!1:(y&2)!==0),W?(x=!0,o.flags&=-129):(r===null||r.memoizedState!==null)&&(y|=1),ft(kt,y&1),r===null)return qd(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):(T=m.children,r=m.fallback,x?(m=o.mode,x=o.child,T={mode:"hidden",children:T},(m&1)===0&&x!==null?(x.childLanes=0,x.pendingProps=T):x=Fc(T,m,0,null),r=po(r,m,c,null),x.return=o,r.return=o,x.sibling=r,o.child=x,o.child.memoizedState=ff(c),o.memoizedState=df,r):hf(o,T));if(y=r.memoizedState,y!==null&&(W=y.dehydrated,W!==null))return SA(r,o,T,m,W,y,c);if(x){x=m.fallback,T=o.mode,y=r.child,W=y.sibling;var ee={mode:"hidden",children:m.children};return(T&1)===0&&o.child!==y?(m=o.child,m.childLanes=0,m.pendingProps=ee,o.deletions=null):(m=Ts(y,ee),m.subtreeFlags=y.subtreeFlags&14680064),W!==null?x=Ts(W,x):(x=po(x,T,c,null),x.flags|=2),x.return=o,m.return=o,m.sibling=x,o.child=m,m=x,x=o.child,T=r.child.memoizedState,T=T===null?ff(c):{baseLanes:T.baseLanes|c,cachePool:null,transitions:T.transitions},x.memoizedState=T,x.childLanes=r.childLanes&~c,o.memoizedState=df,m}return x=r.child,r=x.sibling,m=Ts(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 hf(r,o){return o=Fc({mode:"visible",children:o},r.mode,0,null),o.return=r,r.child=o}function Cc(r,o,c,m){return m!==null&&Dd(m),mi(o,r.child,null,c),r=hf(o,o.pendingProps.children),r.flags|=2,o.memoizedState=null,r}function SA(r,o,c,m,y,x,T){if(c)return o.flags&256?(o.flags&=-257,m=af(Error(n(422))),Cc(r,o,T,m)):o.memoizedState!==null?(o.child=r.child,o.flags|=128,null):(x=m.fallback,y=o.mode,m=Fc({mode:"visible",children:m.children},y,0,null),x=po(x,y,T,null),x.flags|=2,m.return=o,x.return=o,m.sibling=x,o.child=m,(o.mode&1)!==0&&mi(o,r.child,null,T),o.child.memoizedState=ff(T),o.memoizedState=df,x);if((o.mode&1)===0)return Cc(r,o,T,null);if(y.data==="$!"){if(m=y.nextSibling&&y.nextSibling.dataset,m)var W=m.dgst;return m=W,x=Error(n(419)),m=af(x,m,void 0),Cc(r,o,T,m)}if(W=(T&r.childLanes)!==0,an||W){if(m=Ft,m!==null){switch(T&-T){case 4:y=2;break;case 16:y=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:y=32;break;case 536870912:y=268435456;break;default:y=0}y=(y&(m.suspendedLanes|T))!==0?0:y,y!==0&&y!==x.retryLane&&(x.retryLane=y,Hr(r,y),nr(m,r,y,-1))}return Tf(),m=af(Error(n(421))),Cc(r,o,T,m)}return y.data==="$?"?(o.flags|=128,o.child=r.child,o=LA.bind(null,r),y._reactRetry=o,null):(r=x.treeContext,vn=vs(y.nextSibling),yn=o,gt=!0,Zn=null,r!==null&&(Tn[Rn++]=Ur,Tn[Rn++]=Wr,Tn[Rn++]=so,Ur=r.id,Wr=r.overflow,so=o),o=hf(o,m.children),o.flags|=4096,o)}function gx(r,o,c){r.lanes|=o;var m=r.alternate;m!==null&&(m.lanes|=o),Ud(r.return,o,c)}function pf(r,o,c,m,y){var x=r.memoizedState;x===null?r.memoizedState={isBackwards:o,rendering:null,renderingStartTime:0,last:m,tail:c,tailMode:y}:(x.isBackwards=o,x.rendering=null,x.renderingStartTime=0,x.last=m,x.tail=c,x.tailMode=y)}function yx(r,o,c){var m=o.pendingProps,y=m.revealOrder,x=m.tail;if(tn(r,o,m.children,c),m=kt.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&&gx(r,c,o);else if(r.tag===19)gx(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(ft(kt,m),(o.mode&1)===0)o.memoizedState=null;else switch(y){case"forwards":for(c=o.child,y=null;c!==null;)r=c.alternate,r!==null&&xc(r)===null&&(y=c),c=c.sibling;c=y,c===null?(y=o.child,o.child=null):(y=c.sibling,c.sibling=null),pf(o,!1,y,c,x);break;case"backwards":for(c=null,y=o.child,o.child=null;y!==null;){if(r=y.alternate,r!==null&&xc(r)===null){o.child=y;break}r=y.sibling,y.sibling=c,c=y,y=r}pf(o,!0,c,null,x);break;case"together":pf(o,!1,null,null,void 0);break;default:o.memoizedState=null}return o.child}function jc(r,o){(o.mode&1)===0&&r!==null&&(r.alternate=null,o.alternate=null,o.flags|=2)}function Vr(r,o,c){if(r!==null&&(o.dependencies=r.dependencies),co|=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=Ts(r,r.pendingProps),o.child=c,c.return=o;r.sibling!==null;)r=r.sibling,c=c.sibling=Ts(r,r.pendingProps),c.return=o;c.sibling=null}return o.child}function NA(r,o,c){switch(o.tag){case 3:hx(o),pi();break;case 5:A0(o);break;case 1:on(o.type)&&uc(o);break;case 4:Gd(o,o.stateNode.containerInfo);break;case 10:var m=o.type._context,y=o.memoizedProps.value;ft(gc,m._currentValue),m._currentValue=y;break;case 13:if(m=o.memoizedState,m!==null)return m.dehydrated!==null?(ft(kt,kt.current&1),o.flags|=128,null):(c&o.child.childLanes)!==0?mx(r,o,c):(ft(kt,kt.current&1),r=Vr(r,o,c),r!==null?r.sibling:null);ft(kt,kt.current&1);break;case 19:if(m=(c&o.childLanes)!==0,(r.flags&128)!==0){if(m)return yx(r,o,c);o.flags|=128}if(y=o.memoizedState,y!==null&&(y.rendering=null,y.tail=null,y.lastEffect=null),ft(kt,kt.current),m)break;return null;case 22:case 23:return o.lanes=0,ux(r,o,c)}return Vr(r,o,c)}var vx,mf,wx,xx;vx=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}},mf=function(){},wx=function(r,o,c,m){var y=r.memoizedProps;if(y!==m){r=o.stateNode,ao(kr.current);var x=null;switch(c){case"input":y=Ie(r,y),m=Ie(r,m),x=[];break;case"select":y=J({},y,{value:void 0}),m=J({},m,{value:void 0}),x=[];break;case"textarea":y=Xe(r,y),m=Xe(r,m),x=[];break;default:typeof y.onClick!="function"&&typeof m.onClick=="function"&&(r.onclick=ac)}rt(c,m);var T;c=null;for(ce in y)if(!m.hasOwnProperty(ce)&&y.hasOwnProperty(ce)&&y[ce]!=null)if(ce==="style"){var W=y[ce];for(T in W)W.hasOwnProperty(T)&&(c||(c={}),c[T]="")}else ce!=="dangerouslySetInnerHTML"&&ce!=="children"&&ce!=="suppressContentEditableWarning"&&ce!=="suppressHydrationWarning"&&ce!=="autoFocus"&&(i.hasOwnProperty(ce)?x||(x=[]):(x=x||[]).push(ce,null));for(ce in m){var ee=m[ce];if(W=y!=null?y[ce]:void 0,m.hasOwnProperty(ce)&&ee!==W&&(ee!=null||W!=null))if(ce==="style")if(W){for(T in W)!W.hasOwnProperty(T)||ee&&ee.hasOwnProperty(T)||(c||(c={}),c[T]="");for(T in ee)ee.hasOwnProperty(T)&&W[T]!==ee[T]&&(c||(c={}),c[T]=ee[T])}else c||(x||(x=[]),x.push(ce,c)),c=ee;else ce==="dangerouslySetInnerHTML"?(ee=ee?ee.__html:void 0,W=W?W.__html:void 0,ee!=null&&W!==ee&&(x=x||[]).push(ce,ee)):ce==="children"?typeof ee!="string"&&typeof ee!="number"||(x=x||[]).push(ce,""+ee):ce!=="suppressContentEditableWarning"&&ce!=="suppressHydrationWarning"&&(i.hasOwnProperty(ce)?(ee!=null&&ce==="onScroll"&&pt("scroll",r),x||W===ee||(x=[])):(x=x||[]).push(ce,ee))}c&&(x=x||[]).push("style",c);var ce=x;(o.updateQueue=ce)&&(o.flags|=4)}},xx=function(r,o,c,m){c!==m&&(o.flags|=4)};function za(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 Xt(r){var o=r.alternate!==null&&r.alternate.child===r.child,c=0,m=0;if(o)for(var y=r.child;y!==null;)c|=y.lanes|y.childLanes,m|=y.subtreeFlags&14680064,m|=y.flags&14680064,y.return=r,y=y.sibling;else for(y=r.child;y!==null;)c|=y.lanes|y.childLanes,m|=y.subtreeFlags,m|=y.flags,y.return=r,y=y.sibling;return r.subtreeFlags|=m,r.childLanes=c,o}function EA(r,o,c){var m=o.pendingProps;switch($d(o),o.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Xt(o),null;case 1:return on(o.type)&&cc(),Xt(o),null;case 3:return m=o.stateNode,vi(),mt(sn),mt(Yt),Kd(),m.pendingContext&&(m.context=m.pendingContext,m.pendingContext=null),(r===null||r.child===null)&&(pc(o)?o.flags|=4:r===null||r.memoizedState.isDehydrated&&(o.flags&256)===0||(o.flags|=1024,Zn!==null&&(Ef(Zn),Zn=null))),mf(r,o),Xt(o),null;case 5:Vd(o);var y=ao($a.current);if(c=o.type,r!==null&&o.stateNode!=null)wx(r,o,c,m,y),r.ref!==o.ref&&(o.flags|=512,o.flags|=2097152);else{if(!m){if(o.stateNode===null)throw Error(n(166));return Xt(o),null}if(r=ao(kr.current),pc(o)){m=o.stateNode,c=o.type;var x=o.memoizedProps;switch(m[br]=o,m[Aa]=x,r=(o.mode&1)!==0,c){case"dialog":pt("cancel",m),pt("close",m);break;case"iframe":case"object":case"embed":pt("load",m);break;case"video":case"audio":for(y=0;y<ja.length;y++)pt(ja[y],m);break;case"source":pt("error",m);break;case"img":case"image":case"link":pt("error",m),pt("load",m);break;case"details":pt("toggle",m);break;case"input":be(m,x),pt("invalid",m);break;case"select":m._wrapperState={wasMultiple:!!x.multiple},pt("invalid",m);break;case"textarea":Pe(m,x),pt("invalid",m)}rt(c,x),y=null;for(var T in x)if(x.hasOwnProperty(T)){var W=x[T];T==="children"?typeof W=="string"?m.textContent!==W&&(x.suppressHydrationWarning!==!0&&ic(m.textContent,W,r),y=["children",W]):typeof W=="number"&&m.textContent!==""+W&&(x.suppressHydrationWarning!==!0&&ic(m.textContent,W,r),y=["children",""+W]):i.hasOwnProperty(T)&&W!=null&&T==="onScroll"&&pt("scroll",m)}switch(c){case"input":Ee(m),pe(m,x,!0);break;case"textarea":Ee(m),Ge(m);break;case"select":case"option":break;default:typeof x.onClick=="function"&&(m.onclick=ac)}m=y,o.updateQueue=m,m!==null&&(o.flags|=4)}else{T=y.nodeType===9?y:y.ownerDocument,r==="http://www.w3.org/1999/xhtml"&&(r=it(c)),r==="http://www.w3.org/1999/xhtml"?c==="script"?(r=T.createElement("div"),r.innerHTML="<script><\/script>",r=r.removeChild(r.firstChild)):typeof m.is=="string"?r=T.createElement(c,{is:m.is}):(r=T.createElement(c),c==="select"&&(T=r,m.multiple?T.multiple=!0:m.size&&(T.size=m.size))):r=T.createElementNS(r,c),r[br]=o,r[Aa]=m,vx(r,o,!1,!1),o.stateNode=r;e:{switch(T=Te(c,m),c){case"dialog":pt("cancel",r),pt("close",r),y=m;break;case"iframe":case"object":case"embed":pt("load",r),y=m;break;case"video":case"audio":for(y=0;y<ja.length;y++)pt(ja[y],r);y=m;break;case"source":pt("error",r),y=m;break;case"img":case"image":case"link":pt("error",r),pt("load",r),y=m;break;case"details":pt("toggle",r),y=m;break;case"input":be(r,m),y=Ie(r,m),pt("invalid",r);break;case"option":y=m;break;case"select":r._wrapperState={wasMultiple:!!m.multiple},y=J({},m,{value:void 0}),pt("invalid",r);break;case"textarea":Pe(r,m),y=Xe(r,m),pt("invalid",r);break;default:y=m}rt(c,y),W=y;for(x in W)if(W.hasOwnProperty(x)){var ee=W[x];x==="style"?Ve(r,ee):x==="dangerouslySetInnerHTML"?(ee=ee?ee.__html:void 0,ee!=null&&It(r,ee)):x==="children"?typeof ee=="string"?(c!=="textarea"||ee!=="")&&ae(r,ee):typeof ee=="number"&&ae(r,""+ee):x!=="suppressContentEditableWarning"&&x!=="suppressHydrationWarning"&&x!=="autoFocus"&&(i.hasOwnProperty(x)?ee!=null&&x==="onScroll"&&pt("scroll",r):ee!=null&&C(r,x,ee,T))}switch(c){case"input":Ee(r),pe(r,m,!1);break;case"textarea":Ee(r),Ge(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?st(r,!!m.multiple,x,!1):m.defaultValue!=null&&st(r,!!m.multiple,m.defaultValue,!0);break;default:typeof y.onClick=="function"&&(r.onclick=ac)}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 Xt(o),null;case 6:if(r&&o.stateNode!=null)xx(r,o,r.memoizedProps,m);else{if(typeof m!="string"&&o.stateNode===null)throw Error(n(166));if(c=ao($a.current),ao(kr.current),pc(o)){if(m=o.stateNode,c=o.memoizedProps,m[br]=o,(x=m.nodeValue!==c)&&(r=yn,r!==null))switch(r.tag){case 3:ic(m.nodeValue,c,(r.mode&1)!==0);break;case 5:r.memoizedProps.suppressHydrationWarning!==!0&&ic(m.nodeValue,c,(r.mode&1)!==0)}x&&(o.flags|=4)}else m=(c.nodeType===9?c:c.ownerDocument).createTextNode(m),m[br]=o,o.stateNode=m}return Xt(o),null;case 13:if(mt(kt),m=o.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(gt&&vn!==null&&(o.mode&1)!==0&&(o.flags&128)===0)_0(),pi(),o.flags|=98560,x=!1;else if(x=pc(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[br]=o}else pi(),(o.flags&128)===0&&(o.memoizedState=null),o.flags|=4;Xt(o),x=!1}else Zn!==null&&(Ef(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||(kt.current&1)!==0?Lt===0&&(Lt=3):Tf())),o.updateQueue!==null&&(o.flags|=4),Xt(o),null);case 4:return vi(),mf(r,o),r===null&&Ta(o.stateNode.containerInfo),Xt(o),null;case 10:return Bd(o.type._context),Xt(o),null;case 17:return on(o.type)&&cc(),Xt(o),null;case 19:if(mt(kt),x=o.memoizedState,x===null)return Xt(o),null;if(m=(o.flags&128)!==0,T=x.rendering,T===null)if(m)za(x,!1);else{if(Lt!==0||r!==null&&(r.flags&128)!==0)for(r=o.child;r!==null;){if(T=xc(r),T!==null){for(o.flags|=128,za(x,!1),m=T.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,T=x.alternate,T===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=T.childLanes,x.lanes=T.lanes,x.child=T.child,x.subtreeFlags=0,x.deletions=null,x.memoizedProps=T.memoizedProps,x.memoizedState=T.memoizedState,x.updateQueue=T.updateQueue,x.type=T.type,r=T.dependencies,x.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),c=c.sibling;return ft(kt,kt.current&1|2),o.child}r=r.sibling}x.tail!==null&&at()>ki&&(o.flags|=128,m=!0,za(x,!1),o.lanes=4194304)}else{if(!m)if(r=xc(T),r!==null){if(o.flags|=128,m=!0,c=r.updateQueue,c!==null&&(o.updateQueue=c,o.flags|=4),za(x,!0),x.tail===null&&x.tailMode==="hidden"&&!T.alternate&&!gt)return Xt(o),null}else 2*at()-x.renderingStartTime>ki&&c!==1073741824&&(o.flags|=128,m=!0,za(x,!1),o.lanes=4194304);x.isBackwards?(T.sibling=o.child,o.child=T):(c=x.last,c!==null?c.sibling=T:o.child=T,x.last=T)}return x.tail!==null?(o=x.tail,x.rendering=o,x.tail=o.sibling,x.renderingStartTime=at(),o.sibling=null,c=kt.current,ft(kt,m?c&1|2:c&1),o):(Xt(o),null);case 22:case 23:return jf(),m=o.memoizedState!==null,r!==null&&r.memoizedState!==null!==m&&(o.flags|=8192),m&&(o.mode&1)!==0?(wn&1073741824)!==0&&(Xt(o),o.subtreeFlags&6&&(o.flags|=8192)):Xt(o),null;case 24:return null;case 25:return null}throw Error(n(156,o.tag))}function CA(r,o){switch($d(o),o.tag){case 1:return on(o.type)&&cc(),r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 3:return vi(),mt(sn),mt(Yt),Kd(),r=o.flags,(r&65536)!==0&&(r&128)===0?(o.flags=r&-65537|128,o):null;case 5:return Vd(o),null;case 13:if(mt(kt),r=o.memoizedState,r!==null&&r.dehydrated!==null){if(o.alternate===null)throw Error(n(340));pi()}return r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 19:return mt(kt),null;case 4:return vi(),null;case 10:return Bd(o.type._context),null;case 22:case 23:return jf(),null;case 24:return null;default:return null}}var Tc=!1,Qt=!1,jA=typeof WeakSet=="function"?WeakSet:Set,Ne=null;function xi(r,o){var c=r.ref;if(c!==null)if(typeof c=="function")try{c(null)}catch(m){Nt(r,o,m)}else c.current=null}function gf(r,o,c){try{c()}catch(m){Nt(r,o,m)}}var bx=!1;function TA(r,o){if(Cd=Hs,r=F(),B(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 y=m.anchorOffset,x=m.focusNode;m=m.focusOffset;try{c.nodeType,x.nodeType}catch{c=null;break e}var T=0,W=-1,ee=-1,ce=0,ye=0,ve=r,ge=null;t:for(;;){for(var Se;ve!==c||y!==0&&ve.nodeType!==3||(W=T+y),ve!==x||m!==0&&ve.nodeType!==3||(ee=T+m),ve.nodeType===3&&(T+=ve.nodeValue.length),(Se=ve.firstChild)!==null;)ge=ve,ve=Se;for(;;){if(ve===r)break t;if(ge===c&&++ce===y&&(W=T),ge===x&&++ye===m&&(ee=T),(Se=ve.nextSibling)!==null)break;ve=ge,ge=ve.parentNode}ve=Se}c=W===-1||ee===-1?null:{start:W,end:ee}}else c=null}c=c||{start:0,end:0}}else c=null;for(jd={focusedElem:r,selectionRange:c},Hs=!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(we){Nt(o,o.return,we)}if(r=o.sibling,r!==null){r.return=o.return,Ne=r;break}Ne=o.return}return je=bx,bx=!1,je}function Ba(r,o,c){var m=o.updateQueue;if(m=m!==null?m.lastEffect:null,m!==null){var y=m=m.next;do{if((y.tag&r)===r){var x=y.destroy;y.destroy=void 0,x!==void 0&&gf(o,c,x)}y=y.next}while(y!==m)}}function Rc(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 yf(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 kx(r){var o=r.alternate;o!==null&&(r.alternate=null,kx(o)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(o=r.stateNode,o!==null&&(delete o[br],delete o[Aa],delete o[Md],delete o[dA],delete o[fA])),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 _x(r){return r.tag===5||r.tag===3||r.tag===4}function Sx(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||_x(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 vf(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=ac));else if(m!==4&&(r=r.child,r!==null))for(vf(r,o,c),r=r.sibling;r!==null;)vf(r,o,c),r=r.sibling}function wf(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(wf(r,o,c),r=r.sibling;r!==null;)wf(r,o,c),r=r.sibling}var Wt=null,er=!1;function Ss(r,o,c){for(c=c.child;c!==null;)Nx(r,o,c),c=c.sibling}function Nx(r,o,c){if(rn&&typeof rn.onCommitFiberUnmount=="function")try{rn.onCommitFiberUnmount(xt,c)}catch{}switch(c.tag){case 5:Qt||xi(c,o);case 6:var m=Wt,y=er;Wt=null,Ss(r,o,c),Wt=m,er=y,Wt!==null&&(er?(r=Wt,c=c.stateNode,r.nodeType===8?r.parentNode.removeChild(c):r.removeChild(c)):Wt.removeChild(c.stateNode));break;case 18:Wt!==null&&(er?(r=Wt,c=c.stateNode,r.nodeType===8?Ad(r.parentNode,c):r.nodeType===1&&Ad(r,c),us(r)):Ad(Wt,c.stateNode));break;case 4:m=Wt,y=er,Wt=c.stateNode.containerInfo,er=!0,Ss(r,o,c),Wt=m,er=y;break;case 0:case 11:case 14:case 15:if(!Qt&&(m=c.updateQueue,m!==null&&(m=m.lastEffect,m!==null))){y=m=m.next;do{var x=y,T=x.destroy;x=x.tag,T!==void 0&&((x&2)!==0||(x&4)!==0)&&gf(c,o,T),y=y.next}while(y!==m)}Ss(r,o,c);break;case 1:if(!Qt&&(xi(c,o),m=c.stateNode,typeof m.componentWillUnmount=="function"))try{m.props=c.memoizedProps,m.state=c.memoizedState,m.componentWillUnmount()}catch(W){Nt(c,o,W)}Ss(r,o,c);break;case 21:Ss(r,o,c);break;case 22:c.mode&1?(Qt=(m=Qt)||c.memoizedState!==null,Ss(r,o,c),Qt=m):Ss(r,o,c);break;default:Ss(r,o,c)}}function Ex(r){var o=r.updateQueue;if(o!==null){r.updateQueue=null;var c=r.stateNode;c===null&&(c=r.stateNode=new jA),o.forEach(function(m){var y=qA.bind(null,r,m);c.has(m)||(c.add(m),m.then(y,y))})}}function tr(r,o){var c=o.deletions;if(c!==null)for(var m=0;m<c.length;m++){var y=c[m];try{var x=r,T=o,W=T;e:for(;W!==null;){switch(W.tag){case 5:Wt=W.stateNode,er=!1;break e;case 3:Wt=W.stateNode.containerInfo,er=!0;break e;case 4:Wt=W.stateNode.containerInfo,er=!0;break e}W=W.return}if(Wt===null)throw Error(n(160));Nx(x,T,y),Wt=null,er=!1;var ee=y.alternate;ee!==null&&(ee.return=null),y.return=null}catch(ce){Nt(y,o,ce)}}if(o.subtreeFlags&12854)for(o=o.child;o!==null;)Cx(o,r),o=o.sibling}function Cx(r,o){var c=r.alternate,m=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:if(tr(o,r),Sr(r),m&4){try{Ba(3,r,r.return),Rc(3,r)}catch(Ae){Nt(r,r.return,Ae)}try{Ba(5,r,r.return)}catch(Ae){Nt(r,r.return,Ae)}}break;case 1:tr(o,r),Sr(r),m&512&&c!==null&&xi(c,c.return);break;case 5:if(tr(o,r),Sr(r),m&512&&c!==null&&xi(c,c.return),r.flags&32){var y=r.stateNode;try{ae(y,"")}catch(Ae){Nt(r,r.return,Ae)}}if(m&4&&(y=r.stateNode,y!=null)){var x=r.memoizedProps,T=c!==null?c.memoizedProps:x,W=r.type,ee=r.updateQueue;if(r.updateQueue=null,ee!==null)try{W==="input"&&x.type==="radio"&&x.name!=null&&ue(y,x),Te(W,T);var ce=Te(W,x);for(T=0;T<ee.length;T+=2){var ye=ee[T],ve=ee[T+1];ye==="style"?Ve(y,ve):ye==="dangerouslySetInnerHTML"?It(y,ve):ye==="children"?ae(y,ve):C(y,ye,ve,ce)}switch(W){case"input":re(y,x);break;case"textarea":Ue(y,x);break;case"select":var ge=y._wrapperState.wasMultiple;y._wrapperState.wasMultiple=!!x.multiple;var Se=x.value;Se!=null?st(y,!!x.multiple,Se,!1):ge!==!!x.multiple&&(x.defaultValue!=null?st(y,!!x.multiple,x.defaultValue,!0):st(y,!!x.multiple,x.multiple?[]:"",!1))}y[Aa]=x}catch(Ae){Nt(r,r.return,Ae)}}break;case 6:if(tr(o,r),Sr(r),m&4){if(r.stateNode===null)throw Error(n(162));y=r.stateNode,x=r.memoizedProps;try{y.nodeValue=x}catch(Ae){Nt(r,r.return,Ae)}}break;case 3:if(tr(o,r),Sr(r),m&4&&c!==null&&c.memoizedState.isDehydrated)try{us(o.containerInfo)}catch(Ae){Nt(r,r.return,Ae)}break;case 4:tr(o,r),Sr(r);break;case 13:tr(o,r),Sr(r),y=r.child,y.flags&8192&&(x=y.memoizedState!==null,y.stateNode.isHidden=x,!x||y.alternate!==null&&y.alternate.memoizedState!==null||(kf=at())),m&4&&Ex(r);break;case 22:if(ye=c!==null&&c.memoizedState!==null,r.mode&1?(Qt=(ce=Qt)||ye,tr(o,r),Qt=ce):tr(o,r),Sr(r),m&8192){if(ce=r.memoizedState!==null,(r.stateNode.isHidden=ce)&&!ye&&(r.mode&1)!==0)for(Ne=r,ye=r.child;ye!==null;){for(ve=Ne=ye;Ne!==null;){switch(ge=Ne,Se=ge.child,ge.tag){case 0:case 11:case 14:case 15:Ba(4,ge,ge.return);break;case 1:xi(ge,ge.return);var je=ge.stateNode;if(typeof je.componentWillUnmount=="function"){m=ge,c=ge.return;try{o=m,je.props=o.memoizedProps,je.state=o.memoizedState,je.componentWillUnmount()}catch(Ae){Nt(m,c,Ae)}}break;case 5:xi(ge,ge.return);break;case 22:if(ge.memoizedState!==null){Rx(ve);continue}}Se!==null?(Se.return=ge,Ne=Se):Rx(ve)}ye=ye.sibling}e:for(ye=null,ve=r;;){if(ve.tag===5){if(ye===null){ye=ve;try{y=ve.stateNode,ce?(x=y.style,typeof x.setProperty=="function"?x.setProperty("display","none","important"):x.display="none"):(W=ve.stateNode,ee=ve.memoizedProps.style,T=ee!=null&&ee.hasOwnProperty("display")?ee.display:null,W.style.display=Ce("display",T))}catch(Ae){Nt(r,r.return,Ae)}}}else if(ve.tag===6){if(ye===null)try{ve.stateNode.nodeValue=ce?"":ve.memoizedProps}catch(Ae){Nt(r,r.return,Ae)}}else if((ve.tag!==22&&ve.tag!==23||ve.memoizedState===null||ve===r)&&ve.child!==null){ve.child.return=ve,ve=ve.child;continue}if(ve===r)break e;for(;ve.sibling===null;){if(ve.return===null||ve.return===r)break e;ye===ve&&(ye=null),ve=ve.return}ye===ve&&(ye=null),ve.sibling.return=ve.return,ve=ve.sibling}}break;case 19:tr(o,r),Sr(r),m&4&&Ex(r);break;case 21:break;default:tr(o,r),Sr(r)}}function Sr(r){var o=r.flags;if(o&2){try{e:{for(var c=r.return;c!==null;){if(_x(c)){var m=c;break e}c=c.return}throw Error(n(160))}switch(m.tag){case 5:var y=m.stateNode;m.flags&32&&(ae(y,""),m.flags&=-33);var x=Sx(r);wf(r,x,y);break;case 3:case 4:var T=m.stateNode.containerInfo,W=Sx(r);vf(r,W,T);break;default:throw Error(n(161))}}catch(ee){Nt(r,r.return,ee)}r.flags&=-3}o&4096&&(r.flags&=-4097)}function RA(r,o,c){Ne=r,jx(r)}function jx(r,o,c){for(var m=(r.mode&1)!==0;Ne!==null;){var y=Ne,x=y.child;if(y.tag===22&&m){var T=y.memoizedState!==null||Tc;if(!T){var W=y.alternate,ee=W!==null&&W.memoizedState!==null||Qt;W=Tc;var ce=Qt;if(Tc=T,(Qt=ee)&&!ce)for(Ne=y;Ne!==null;)T=Ne,ee=T.child,T.tag===22&&T.memoizedState!==null?Ax(y):ee!==null?(ee.return=T,Ne=ee):Ax(y);for(;x!==null;)Ne=x,jx(x),x=x.sibling;Ne=y,Tc=W,Qt=ce}Tx(r)}else(y.subtreeFlags&8772)!==0&&x!==null?(x.return=y,Ne=x):Tx(r)}}function Tx(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:Qt||Rc(5,o);break;case 1:var m=o.stateNode;if(o.flags&4&&!Qt)if(c===null)m.componentDidMount();else{var y=o.elementType===o.type?c.memoizedProps:Jn(o.type,c.memoizedProps);m.componentDidUpdate(y,c.memoizedState,m.__reactInternalSnapshotBeforeUpdate)}var x=o.updateQueue;x!==null&&R0(o,x,m);break;case 3:var T=o.updateQueue;if(T!==null){if(c=null,o.child!==null)switch(o.child.tag){case 5:c=o.child.stateNode;break;case 1:c=o.child.stateNode}R0(o,T,c)}break;case 5:var W=o.stateNode;if(c===null&&o.flags&4){c=W;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 ce=o.alternate;if(ce!==null){var ye=ce.memoizedState;if(ye!==null){var ve=ye.dehydrated;ve!==null&&us(ve)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}Qt||o.flags&512&&yf(o)}catch(ge){Nt(o,o.return,ge)}}if(o===r){Ne=null;break}if(c=o.sibling,c!==null){c.return=o.return,Ne=c;break}Ne=o.return}}function Rx(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 Ax(r){for(;Ne!==null;){var o=Ne;try{switch(o.tag){case 0:case 11:case 15:var c=o.return;try{Rc(4,o)}catch(ee){Nt(o,c,ee)}break;case 1:var m=o.stateNode;if(typeof m.componentDidMount=="function"){var y=o.return;try{m.componentDidMount()}catch(ee){Nt(o,y,ee)}}var x=o.return;try{yf(o)}catch(ee){Nt(o,x,ee)}break;case 5:var T=o.return;try{yf(o)}catch(ee){Nt(o,T,ee)}}}catch(ee){Nt(o,o.return,ee)}if(o===r){Ne=null;break}var W=o.sibling;if(W!==null){W.return=o.return,Ne=W;break}Ne=o.return}}var AA=Math.ceil,Ac=j.ReactCurrentDispatcher,xf=j.ReactCurrentOwner,In=j.ReactCurrentBatchConfig,et=0,Ft=null,Tt=null,Ht=0,wn=0,bi=ws(0),Lt=0,Ua=null,co=0,Mc=0,bf=0,Wa=null,ln=null,kf=0,ki=1/0,Yr=null,Ic=!1,_f=null,Ns=null,Oc=!1,Es=null,Pc=0,Ha=0,Sf=null,$c=-1,Lc=0;function nn(){return(et&6)!==0?at():$c!==-1?$c:$c=at()}function Cs(r){return(r.mode&1)===0?1:(et&2)!==0&&Ht!==0?Ht&-Ht:pA.transition!==null?(Lc===0&&(Lc=Us()),Lc):(r=Qe,r!==0||(r=window.event,r=r===void 0?16:Qo(r.type)),r)}function nr(r,o,c,m){if(50<Ha)throw Ha=0,Sf=null,Error(n(185));as(r,c,m),((et&2)===0||r!==Ft)&&(r===Ft&&((et&2)===0&&(Mc|=c),Lt===4&&js(r,Ht)),cn(r,m),c===1&&et===0&&(o.mode&1)===0&&(ki=at()+500,dc&&bs()))}function cn(r,o){var c=r.callbackNode;Dl(r,o);var m=Bs(r,r===Ft?Ht:0);if(m===0)c!==null&&zs(c),r.callbackNode=null,r.callbackPriority=0;else if(o=m&-m,r.callbackPriority!==o){if(c!=null&&zs(c),o===1)r.tag===0?hA(Ix.bind(null,r)):v0(Ix.bind(null,r)),cA(function(){(et&6)===0&&bs()}),c=null;else{switch(sa(m)){case 1:c=rs;break;case 4:c=Vt;break;case 16:c=Un;break;case 536870912:c=ss;break;default:c=Un}c=zx(c,Mx.bind(null,r))}r.callbackPriority=o,r.callbackNode=c}}function Mx(r,o){if($c=-1,Lc=0,(et&6)!==0)throw Error(n(327));var c=r.callbackNode;if(_i()&&r.callbackNode!==c)return null;var m=Bs(r,r===Ft?Ht:0);if(m===0)return null;if((m&30)!==0||(m&r.expiredLanes)!==0||o)o=qc(r,m);else{o=m;var y=et;et|=2;var x=Px();(Ft!==r||Ht!==o)&&(Yr=null,ki=at()+500,fo(r,o));do try{OA();break}catch(W){Ox(r,W)}while(!0);zd(),Ac.current=x,et=y,Tt!==null?o=0:(Ft=null,Ht=0,o=Lt)}if(o!==0){if(o===2&&(y=Wo(r),y!==0&&(m=y,o=Nf(r,y))),o===1)throw c=Ua,fo(r,0),js(r,m),cn(r,at()),c;if(o===6)js(r,m);else{if(y=r.current.alternate,(m&30)===0&&!MA(y)&&(o=qc(r,m),o===2&&(x=Wo(r),x!==0&&(m=x,o=Nf(r,x))),o===1))throw c=Ua,fo(r,0),js(r,m),cn(r,at()),c;switch(r.finishedWork=y,r.finishedLanes=m,o){case 0:case 1:throw Error(n(345));case 2:ho(r,ln,Yr);break;case 3:if(js(r,m),(m&130023424)===m&&(o=kf+500-at(),10<o)){if(Bs(r,0)!==0)break;if(y=r.suspendedLanes,(y&m)!==m){nn(),r.pingedLanes|=r.suspendedLanes&y;break}r.timeoutHandle=Rd(ho.bind(null,r,ln,Yr),o);break}ho(r,ln,Yr);break;case 4:if(js(r,m),(m&4194240)===m)break;for(o=r.eventTimes,y=-1;0<m;){var T=31-pn(m);x=1<<T,T=o[T],T>y&&(y=T),m&=~x}if(m=y,m=at()-m,m=(120>m?120:480>m?480:1080>m?1080:1920>m?1920:3e3>m?3e3:4320>m?4320:1960*AA(m/1960))-m,10<m){r.timeoutHandle=Rd(ho.bind(null,r,ln,Yr),m);break}ho(r,ln,Yr);break;case 5:ho(r,ln,Yr);break;default:throw Error(n(329))}}}return cn(r,at()),r.callbackNode===c?Mx.bind(null,r):null}function Nf(r,o){var c=Wa;return r.current.memoizedState.isDehydrated&&(fo(r,o).flags|=256),r=qc(r,o),r!==2&&(o=ln,ln=c,o!==null&&Ef(o)),r}function Ef(r){ln===null?ln=r:ln.push.apply(ln,r)}function MA(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 y=c[m],x=y.getSnapshot;y=y.value;try{if(!gn(x(),y))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 js(r,o){for(o&=~bf,o&=~Mc,r.suspendedLanes|=o,r.pingedLanes&=~o,r=r.expirationTimes;0<o;){var c=31-pn(o),m=1<<c;r[c]=-1,o&=~m}}function Ix(r){if((et&6)!==0)throw Error(n(327));_i();var o=Bs(r,0);if((o&1)===0)return cn(r,at()),null;var c=qc(r,o);if(r.tag!==0&&c===2){var m=Wo(r);m!==0&&(o=m,c=Nf(r,m))}if(c===1)throw c=Ua,fo(r,0),js(r,o),cn(r,at()),c;if(c===6)throw Error(n(345));return r.finishedWork=r.current.alternate,r.finishedLanes=o,ho(r,ln,Yr),cn(r,at()),null}function Cf(r,o){var c=et;et|=1;try{return r(o)}finally{et=c,et===0&&(ki=at()+500,dc&&bs())}}function uo(r){Es!==null&&Es.tag===0&&(et&6)===0&&_i();var o=et;et|=1;var c=In.transition,m=Qe;try{if(In.transition=null,Qe=1,r)return r()}finally{Qe=m,In.transition=c,et=o,(et&6)===0&&bs()}}function jf(){wn=bi.current,mt(bi)}function fo(r,o){r.finishedWork=null,r.finishedLanes=0;var c=r.timeoutHandle;if(c!==-1&&(r.timeoutHandle=-1,lA(c)),Tt!==null)for(c=Tt.return;c!==null;){var m=c;switch($d(m),m.tag){case 1:m=m.type.childContextTypes,m!=null&&cc();break;case 3:vi(),mt(sn),mt(Yt),Kd();break;case 5:Vd(m);break;case 4:vi();break;case 13:mt(kt);break;case 19:mt(kt);break;case 10:Bd(m.type._context);break;case 22:case 23:jf()}c=c.return}if(Ft=r,Tt=r=Ts(r.current,null),Ht=wn=o,Lt=0,Ua=null,bf=Mc=co=0,ln=Wa=null,io!==null){for(o=0;o<io.length;o++)if(c=io[o],m=c.interleaved,m!==null){c.interleaved=null;var y=m.next,x=c.pending;if(x!==null){var T=x.next;x.next=y,m.next=T}c.pending=m}io=null}return r}function Ox(r,o){do{var c=Tt;try{if(zd(),bc.current=Nc,kc){for(var m=_t.memoizedState;m!==null;){var y=m.queue;y!==null&&(y.pending=null),m=m.next}kc=!1}if(lo=0,Dt=$t=_t=null,La=!1,qa=0,xf.current=null,c===null||c.return===null){Lt=1,Ua=o,Tt=null;break}e:{var x=r,T=c.return,W=c,ee=o;if(o=Ht,W.flags|=32768,ee!==null&&typeof ee=="object"&&typeof ee.then=="function"){var ce=ee,ye=W,ve=ye.tag;if((ye.mode&1)===0&&(ve===0||ve===11||ve===15)){var ge=ye.alternate;ge?(ye.updateQueue=ge.updateQueue,ye.memoizedState=ge.memoizedState,ye.lanes=ge.lanes):(ye.updateQueue=null,ye.memoizedState=null)}var Se=ox(T);if(Se!==null){Se.flags&=-257,ix(Se,T,W,x,o),Se.mode&1&&sx(x,ce,o),o=Se,ee=ce;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){sx(x,ce,o),Tf();break e}ee=Error(n(426))}}else if(gt&&W.mode&1){var jt=ox(T);if(jt!==null){(jt.flags&65536)===0&&(jt.flags|=256),ix(jt,T,W,x,o),Dd(wi(ee,W));break e}}x=ee=wi(ee,W),Lt!==4&&(Lt=2),Wa===null?Wa=[x]:Wa.push(x),x=T;do{switch(x.tag){case 3:x.flags|=65536,o&=-o,x.lanes|=o;var oe=nx(x,ee,o);T0(x,oe);break e;case 1:W=ee;var te=x.type,ie=x.stateNode;if((x.flags&128)===0&&(typeof te.getDerivedStateFromError=="function"||ie!==null&&typeof ie.componentDidCatch=="function"&&(Ns===null||!Ns.has(ie)))){x.flags|=65536,o&=-o,x.lanes|=o;var we=rx(x,W,o);T0(x,we);break e}}x=x.return}while(x!==null)}Lx(c)}catch(Me){o=Me,Tt===c&&c!==null&&(Tt=c=c.return);continue}break}while(!0)}function Px(){var r=Ac.current;return Ac.current=Nc,r===null?Nc:r}function Tf(){(Lt===0||Lt===3||Lt===2)&&(Lt=4),Ft===null||(co&268435455)===0&&(Mc&268435455)===0||js(Ft,Ht)}function qc(r,o){var c=et;et|=2;var m=Px();(Ft!==r||Ht!==o)&&(Yr=null,fo(r,o));do try{IA();break}catch(y){Ox(r,y)}while(!0);if(zd(),et=c,Ac.current=m,Tt!==null)throw Error(n(261));return Ft=null,Ht=0,Lt}function IA(){for(;Tt!==null;)$x(Tt)}function OA(){for(;Tt!==null&&!qo();)$x(Tt)}function $x(r){var o=Fx(r.alternate,r,wn);r.memoizedProps=r.pendingProps,o===null?Lx(r):Tt=o,xf.current=null}function Lx(r){var o=r;do{var c=o.alternate;if(r=o.return,(o.flags&32768)===0){if(c=EA(c,o,wn),c!==null){Tt=c;return}}else{if(c=CA(c,o),c!==null){c.flags&=32767,Tt=c;return}if(r!==null)r.flags|=32768,r.subtreeFlags=0,r.deletions=null;else{Lt=6,Tt=null;return}}if(o=o.sibling,o!==null){Tt=o;return}Tt=o=r}while(o!==null);Lt===0&&(Lt=5)}function ho(r,o,c){var m=Qe,y=In.transition;try{In.transition=null,Qe=1,PA(r,o,c,m)}finally{In.transition=y,Qe=m}return null}function PA(r,o,c,m){do _i();while(Es!==null);if((et&6)!==0)throw Error(n(327));c=r.finishedWork;var y=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(Zt(r,x),r===Ft&&(Tt=Ft=null,Ht=0),(c.subtreeFlags&2064)===0&&(c.flags&2064)===0||Oc||(Oc=!0,zx(Un,function(){return _i(),null})),x=(c.flags&15990)!==0,(c.subtreeFlags&15990)!==0||x){x=In.transition,In.transition=null;var T=Qe;Qe=1;var W=et;et|=4,xf.current=null,TA(r,c),Cx(c,r),le(jd),Hs=!!Cd,jd=Cd=null,r.current=c,RA(c),Do(),et=W,Qe=T,In.transition=x}else r.current=c;if(Oc&&(Oc=!1,Es=r,Pc=y),x=r.pendingLanes,x===0&&(Ns=null),Wn(c.stateNode),cn(r,at()),o!==null)for(m=r.onRecoverableError,c=0;c<o.length;c++)y=o[c],m(y.value,{componentStack:y.stack,digest:y.digest});if(Ic)throw Ic=!1,r=_f,_f=null,r;return(Pc&1)!==0&&r.tag!==0&&_i(),x=r.pendingLanes,(x&1)!==0?r===Sf?Ha++:(Ha=0,Sf=r):Ha=0,bs(),null}function _i(){if(Es!==null){var r=sa(Pc),o=In.transition,c=Qe;try{if(In.transition=null,Qe=16>r?16:r,Es===null)var m=!1;else{if(r=Es,Es=null,Pc=0,(et&6)!==0)throw Error(n(331));var y=et;for(et|=4,Ne=r.current;Ne!==null;){var x=Ne,T=x.child;if((Ne.flags&16)!==0){var W=x.deletions;if(W!==null){for(var ee=0;ee<W.length;ee++){var ce=W[ee];for(Ne=ce;Ne!==null;){var ye=Ne;switch(ye.tag){case 0:case 11:case 15:Ba(8,ye,x)}var ve=ye.child;if(ve!==null)ve.return=ye,Ne=ve;else for(;Ne!==null;){ye=Ne;var ge=ye.sibling,Se=ye.return;if(kx(ye),ye===ce){Ne=null;break}if(ge!==null){ge.return=Se,Ne=ge;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&&T!==null)T.return=x,Ne=T;else e:for(;Ne!==null;){if(x=Ne,(x.flags&2048)!==0)switch(x.tag){case 0:case 11:case 15:Ba(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;){T=Ne;var ie=T.child;if((T.subtreeFlags&2064)!==0&&ie!==null)ie.return=T,Ne=ie;else e:for(T=te;Ne!==null;){if(W=Ne,(W.flags&2048)!==0)try{switch(W.tag){case 0:case 11:case 15:Rc(9,W)}}catch(Me){Nt(W,W.return,Me)}if(W===T){Ne=null;break e}var we=W.sibling;if(we!==null){we.return=W.return,Ne=we;break e}Ne=W.return}}if(et=y,bs(),rn&&typeof rn.onPostCommitFiberRoot=="function")try{rn.onPostCommitFiberRoot(xt,r)}catch{}m=!0}return m}finally{Qe=c,In.transition=o}}return!1}function qx(r,o,c){o=wi(c,o),o=nx(r,o,1),r=_s(r,o,1),o=nn(),r!==null&&(as(r,1,o),cn(r,o))}function Nt(r,o,c){if(r.tag===3)qx(r,r,c);else for(;o!==null;){if(o.tag===3){qx(o,r,c);break}else if(o.tag===1){var m=o.stateNode;if(typeof o.type.getDerivedStateFromError=="function"||typeof m.componentDidCatch=="function"&&(Ns===null||!Ns.has(m))){r=wi(c,r),r=rx(o,r,1),o=_s(o,r,1),r=nn(),o!==null&&(as(o,1,r),cn(o,r));break}}o=o.return}}function $A(r,o,c){var m=r.pingCache;m!==null&&m.delete(o),o=nn(),r.pingedLanes|=r.suspendedLanes&c,Ft===r&&(Ht&c)===c&&(Lt===4||Lt===3&&(Ht&130023424)===Ht&&500>at()-kf?fo(r,0):bf|=c),cn(r,o)}function Dx(r,o){o===0&&((r.mode&1)===0?o=1:(o=Uo,Uo<<=1,(Uo&130023424)===0&&(Uo=4194304)));var c=nn();r=Hr(r,o),r!==null&&(as(r,o,c),cn(r,c))}function LA(r){var o=r.memoizedState,c=0;o!==null&&(c=o.retryLane),Dx(r,c)}function qA(r,o){var c=0;switch(r.tag){case 13:var m=r.stateNode,y=r.memoizedState;y!==null&&(c=y.retryLane);break;case 19:m=r.stateNode;break;default:throw Error(n(314))}m!==null&&m.delete(o),Dx(r,c)}var Fx;Fx=function(r,o,c){if(r!==null)if(r.memoizedProps!==o.pendingProps||sn.current)an=!0;else{if((r.lanes&c)===0&&(o.flags&128)===0)return an=!1,NA(r,o,c);an=(r.flags&131072)!==0}else an=!1,gt&&(o.flags&1048576)!==0&&w0(o,hc,o.index);switch(o.lanes=0,o.tag){case 2:var m=o.type;jc(r,o),r=o.pendingProps;var y=di(o,Yt.current);yi(o,c),y=Zd(null,o,m,r,y,c);var x=Jd();return o.flags|=1,typeof y=="object"&&y!==null&&typeof y.render=="function"&&y.$$typeof===void 0?(o.tag=1,o.memoizedState=null,o.updateQueue=null,on(m)?(x=!0,uc(o)):x=!1,o.memoizedState=y.state!==null&&y.state!==void 0?y.state:null,Hd(o),y.updater=Ec,o.stateNode=y,y._reactInternals=o,of(o,m,r,c),o=uf(null,o,m,!0,x,c)):(o.tag=0,gt&&x&&Pd(o),tn(null,o,y,c),o=o.child),o;case 16:m=o.elementType;e:{switch(jc(r,o),r=o.pendingProps,y=m._init,m=y(m._payload),o.type=m,y=o.tag=FA(m),r=Jn(m,r),y){case 0:o=cf(null,o,m,r,c);break e;case 1:o=fx(null,o,m,r,c);break e;case 11:o=ax(null,o,m,r,c);break e;case 14:o=lx(null,o,m,Jn(m.type,r),c);break e}throw Error(n(306,m,""))}return o;case 0:return m=o.type,y=o.pendingProps,y=o.elementType===m?y:Jn(m,y),cf(r,o,m,y,c);case 1:return m=o.type,y=o.pendingProps,y=o.elementType===m?y:Jn(m,y),fx(r,o,m,y,c);case 3:e:{if(hx(o),r===null)throw Error(n(387));m=o.pendingProps,x=o.memoizedState,y=x.element,j0(r,o),wc(o,m,null,c);var T=o.memoizedState;if(m=T.element,x.isDehydrated)if(x={element:m,isDehydrated:!1,cache:T.cache,pendingSuspenseBoundaries:T.pendingSuspenseBoundaries,transitions:T.transitions},o.updateQueue.baseState=x,o.memoizedState=x,o.flags&256){y=wi(Error(n(423)),o),o=px(r,o,m,c,y);break e}else if(m!==y){y=wi(Error(n(424)),o),o=px(r,o,m,c,y);break e}else for(vn=vs(o.stateNode.containerInfo.firstChild),yn=o,gt=!0,Zn=null,c=E0(o,null,m,c),o.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling;else{if(pi(),m===y){o=Vr(r,o,c);break e}tn(r,o,m,c)}o=o.child}return o;case 5:return A0(o),r===null&&qd(o),m=o.type,y=o.pendingProps,x=r!==null?r.memoizedProps:null,T=y.children,Td(m,y)?T=null:x!==null&&Td(m,x)&&(o.flags|=32),dx(r,o),tn(r,o,T,c),o.child;case 6:return r===null&&qd(o),null;case 13:return mx(r,o,c);case 4:return Gd(o,o.stateNode.containerInfo),m=o.pendingProps,r===null?o.child=mi(o,null,m,c):tn(r,o,m,c),o.child;case 11:return m=o.type,y=o.pendingProps,y=o.elementType===m?y:Jn(m,y),ax(r,o,m,y,c);case 7:return tn(r,o,o.pendingProps,c),o.child;case 8:return tn(r,o,o.pendingProps.children,c),o.child;case 12:return tn(r,o,o.pendingProps.children,c),o.child;case 10:e:{if(m=o.type._context,y=o.pendingProps,x=o.memoizedProps,T=y.value,ft(gc,m._currentValue),m._currentValue=T,x!==null)if(gn(x.value,T)){if(x.children===y.children&&!sn.current){o=Vr(r,o,c);break e}}else for(x=o.child,x!==null&&(x.return=o);x!==null;){var W=x.dependencies;if(W!==null){T=x.child;for(var ee=W.firstContext;ee!==null;){if(ee.context===m){if(x.tag===1){ee=Gr(-1,c&-c),ee.tag=2;var ce=x.updateQueue;if(ce!==null){ce=ce.shared;var ye=ce.pending;ye===null?ee.next=ee:(ee.next=ye.next,ye.next=ee),ce.pending=ee}}x.lanes|=c,ee=x.alternate,ee!==null&&(ee.lanes|=c),Ud(x.return,c,o),W.lanes|=c;break}ee=ee.next}}else if(x.tag===10)T=x.type===o.type?null:x.child;else if(x.tag===18){if(T=x.return,T===null)throw Error(n(341));T.lanes|=c,W=T.alternate,W!==null&&(W.lanes|=c),Ud(T,c,o),T=x.sibling}else T=x.child;if(T!==null)T.return=x;else for(T=x;T!==null;){if(T===o){T=null;break}if(x=T.sibling,x!==null){x.return=T.return,T=x;break}T=T.return}x=T}tn(r,o,y.children,c),o=o.child}return o;case 9:return y=o.type,m=o.pendingProps.children,yi(o,c),y=An(y),m=m(y),o.flags|=1,tn(r,o,m,c),o.child;case 14:return m=o.type,y=Jn(m,o.pendingProps),y=Jn(m.type,y),lx(r,o,m,y,c);case 15:return cx(r,o,o.type,o.pendingProps,c);case 17:return m=o.type,y=o.pendingProps,y=o.elementType===m?y:Jn(m,y),jc(r,o),o.tag=1,on(m)?(r=!0,uc(o)):r=!1,yi(o,c),ex(o,m,y),of(o,m,y,c),uf(null,o,m,!0,r,c);case 19:return yx(r,o,c);case 22:return ux(r,o,c)}throw Error(n(156,o.tag))};function zx(r,o){return Fs(r,o)}function DA(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 On(r,o,c,m){return new DA(r,o,c,m)}function Rf(r){return r=r.prototype,!(!r||!r.isReactComponent)}function FA(r){if(typeof r=="function")return Rf(r)?1:0;if(r!=null){if(r=r.$$typeof,r===G)return 11;if(r===Q)return 14}return 2}function Ts(r,o){var c=r.alternate;return c===null?(c=On(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 Dc(r,o,c,m,y,x){var T=2;if(m=r,typeof r=="function")Rf(r)&&(T=1);else if(typeof r=="string")T=5;else e:switch(r){case P:return po(c.children,y,x,o);case z:T=8,y|=8;break;case M:return r=On(12,c,o,y|2),r.elementType=M,r.lanes=x,r;case Y:return r=On(13,c,o,y),r.elementType=Y,r.lanes=x,r;case R:return r=On(19,c,o,y),r.elementType=R,r.lanes=x,r;case ne:return Fc(c,y,x,o);default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case A:T=10;break e;case q:T=9;break e;case G:T=11;break e;case Q:T=14;break e;case H:T=16,m=null;break e}throw Error(n(130,r==null?r:typeof r,""))}return o=On(T,c,o,y),o.elementType=r,o.type=m,o.lanes=x,o}function po(r,o,c,m){return r=On(7,r,m,o),r.lanes=c,r}function Fc(r,o,c,m){return r=On(22,r,m,o),r.elementType=ne,r.lanes=c,r.stateNode={isHidden:!1},r}function Af(r,o,c){return r=On(6,r,null,o),r.lanes=c,r}function Mf(r,o,c){return o=On(4,r.children!==null?r.children:[],r.key,o),o.lanes=c,o.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},o}function zA(r,o,c,m,y){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=Ho(0),this.expirationTimes=Ho(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ho(0),this.identifierPrefix=m,this.onRecoverableError=y,this.mutableSourceEagerHydrationData=null}function If(r,o,c,m,y,x,T,W,ee){return r=new zA(r,o,c,W,ee),o===1?(o=1,x===!0&&(o|=8)):o=0,x=On(3,null,null,o),r.current=x,x.stateNode=r,x.memoizedState={element:m,isDehydrated:c,cache:null,transitions:null,pendingSuspenseBoundaries:null},Hd(x),r}function BA(r,o,c){var m=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:O,key:m==null?null:""+m,children:r,containerInfo:o,implementation:c}}function Bx(r){if(!r)return xs;r=r._reactInternals;e:{if(En(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(on(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(on(c))return g0(r,c,o)}return o}function Ux(r,o,c,m,y,x,T,W,ee){return r=If(c,m,!0,r,y,x,T,W,ee),r.context=Bx(null),c=r.current,m=nn(),y=Cs(c),x=Gr(m,y),x.callback=o??null,_s(c,x,y),r.current.lanes=y,as(r,y,m),cn(r,m),r}function zc(r,o,c,m){var y=o.current,x=nn(),T=Cs(y);return c=Bx(c),o.context===null?o.context=c:o.pendingContext=c,o=Gr(x,T),o.payload={element:r},m=m===void 0?null:m,m!==null&&(o.callback=m),r=_s(y,o,T),r!==null&&(nr(r,y,T,x),vc(r,y,T)),T}function Bc(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 Wx(r,o){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var c=r.retryLane;r.retryLane=c!==0&&c<o?c:o}}function Of(r,o){Wx(r,o),(r=r.alternate)&&Wx(r,o)}function UA(){return null}var Hx=typeof reportError=="function"?reportError:function(r){console.error(r)};function Pf(r){this._internalRoot=r}Uc.prototype.render=Pf.prototype.render=function(r){var o=this._internalRoot;if(o===null)throw Error(n(409));zc(r,o,null,null)},Uc.prototype.unmount=Pf.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var o=r.containerInfo;uo(function(){zc(null,r,null,null)}),o[zr]=null}};function Uc(r){this._internalRoot=r}Uc.prototype.unstable_scheduleHydration=function(r){if(r){var o=Hn();r={blockedOn:null,target:r,priority:o};for(var c=0;c<Yn.length&&o!==0&&o<Yn[c].priority;c++);Yn.splice(c,0,r),c===0&&Yo(r)}};function $f(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function Wc(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11&&(r.nodeType!==8||r.nodeValue!==" react-mount-point-unstable "))}function Gx(){}function WA(r,o,c,m,y){if(y){if(typeof m=="function"){var x=m;m=function(){var ce=Bc(T);x.call(ce)}}var T=Ux(o,m,r,0,null,!1,!1,"",Gx);return r._reactRootContainer=T,r[zr]=T.current,Ta(r.nodeType===8?r.parentNode:r),uo(),T}for(;y=r.lastChild;)r.removeChild(y);if(typeof m=="function"){var W=m;m=function(){var ce=Bc(ee);W.call(ce)}}var ee=If(r,0,!1,null,null,!1,!1,"",Gx);return r._reactRootContainer=ee,r[zr]=ee.current,Ta(r.nodeType===8?r.parentNode:r),uo(function(){zc(o,ee,c,m)}),ee}function Hc(r,o,c,m,y){var x=c._reactRootContainer;if(x){var T=x;if(typeof y=="function"){var W=y;y=function(){var ee=Bc(T);W.call(ee)}}zc(o,T,r,y)}else T=WA(c,o,r,y,m);return Bc(T)}Fl=function(r){switch(r.tag){case 3:var o=r.stateNode;if(o.current.memoizedState.isDehydrated){var c=os(o.pendingLanes);c!==0&&(ls(o,c|1),cn(o,at()),(et&6)===0&&(ki=at()+500,bs()))}break;case 13:uo(function(){var m=Hr(r,1);if(m!==null){var y=nn();nr(m,r,1,y)}}),Of(r,1)}},Or=function(r){if(r.tag===13){var o=Hr(r,134217728);if(o!==null){var c=nn();nr(o,r,134217728,c)}Of(r,134217728)}},oa=function(r){if(r.tag===13){var o=Cs(r),c=Hr(r,o);if(c!==null){var m=nn();nr(c,r,o,m)}Of(r,o)}},Hn=function(){return Qe},zl=function(r,o){var c=Qe;try{return Qe=r,o()}finally{Qe=c}},St=function(r,o,c){switch(o){case"input":if(re(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 y=lc(m);if(!y)throw Error(n(90));He(m),re(m,y)}}}break;case"textarea":Ue(r,c);break;case"select":o=c.value,o!=null&&st(r,!!c.multiple,o,!1)}},Ro=Cf,Ao=uo;var HA={usingClientEntryPoint:!1,Events:[Ma,ci,lc,To,hn,Cf]},Ga={findFiberByHostInstance:no,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},GA={bundleType:Ga.bundleType,version:Ga.version,rendererPackageName:Ga.rendererPackageName,rendererConfig:Ga.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:j.ReactCurrentDispatcher,findHostInstanceByFiber:function(r){return r=Bn(r),r===null?null:r.stateNode},findFiberByHostInstance:Ga.findFiberByHostInstance||UA,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 Gc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Gc.isDisabled&&Gc.supportsFiber)try{xt=Gc.inject(GA),rn=Gc}catch{}}return un.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=HA,un.createPortal=function(r,o){var c=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!$f(o))throw Error(n(200));return BA(r,o,null,c)},un.createRoot=function(r,o){if(!$f(r))throw Error(n(299));var c=!1,m="",y=Hx;return o!=null&&(o.unstable_strictMode===!0&&(c=!0),o.identifierPrefix!==void 0&&(m=o.identifierPrefix),o.onRecoverableError!==void 0&&(y=o.onRecoverableError)),o=If(r,1,!1,null,null,c,!1,m,y),r[zr]=o.current,Ta(r.nodeType===8?r.parentNode:r),new Pf(o)},un.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=Bn(o),r=r===null?null:r.stateNode,r},un.flushSync=function(r){return uo(r)},un.hydrate=function(r,o,c){if(!Wc(o))throw Error(n(200));return Hc(null,r,o,!0,c)},un.hydrateRoot=function(r,o,c){if(!$f(r))throw Error(n(405));var m=c!=null&&c.hydratedSources||null,y=!1,x="",T=Hx;if(c!=null&&(c.unstable_strictMode===!0&&(y=!0),c.identifierPrefix!==void 0&&(x=c.identifierPrefix),c.onRecoverableError!==void 0&&(T=c.onRecoverableError)),o=Ux(o,null,r,1,c??null,y,!1,x,T),r[zr]=o.current,Ta(r),m)for(r=0;r<m.length;r++)c=m[r],y=c._getVersion,y=y(c._source),o.mutableSourceEagerHydrationData==null?o.mutableSourceEagerHydrationData=[c,y]:o.mutableSourceEagerHydrationData.push(c,y);return new Uc(o)},un.render=function(r,o,c){if(!Wc(o))throw Error(n(200));return Hc(null,r,o,!1,c)},un.unmountComponentAtNode=function(r){if(!Wc(r))throw Error(n(40));return r._reactRootContainer?(uo(function(){Hc(null,null,r,!1,function(){r._reactRootContainer=null,r[zr]=null})}),!0):!1},un.unstable_batchedUpdates=Cf,un.unstable_renderSubtreeIntoContainer=function(r,o,c,m){if(!Wc(c))throw Error(n(200));if(r==null||r._reactInternals===void 0)throw Error(n(38));return Hc(r,o,c,!1,m)},un.version="18.3.1-next-f1338f8080-20240426",un}var eb;function MC(){if(eb)return Df.exports;eb=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(),Df.exports=JA(),Df.exports}var tb;function e2(){if(tb)return Yc;tb=1;var e=MC();return Yc.createRoot=e.createRoot,Yc.hydrateRoot=e.hydrateRoot,Yc}var t2=e2(),_=_l();const de=lw(_);function Gt(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=Gt(e[n]))!==""&&(t+=(t&&" ")+s);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var Bf={exports:{}},Uf={},Wf={exports:{}},Hf={};/**
41
41
  * @license React
42
42
  * use-sync-external-store-shim.production.js
43
43
  *
@@ -45,7 +45,7 @@ Error generating stack: `+x.message+`
45
45
  *
46
46
  * This source code is licensed under the MIT license found in the
47
47
  * LICENSE file in the root directory of this source tree.
48
- */var nb;function n2(){if(nb)return Uf;nb=1;var e=gl();function t(g,v){return g===v&&(g!==0||1/g===1/v)||g!==g&&v!==v}var n=typeof Object.is=="function"?Object.is:t,s=e.useState,i=e.useEffect,a=e.useLayoutEffect,l=e.useDebugValue;function u(g,v){var w=v(),N=s({inst:{value:w,getSnapshot:v}}),b=N[0].inst,k=N[1];return a(function(){b.value=w,b.getSnapshot=v,h(b)&&k({inst:b})},[g,w,v]),i(function(){return h(b)&&k({inst:b}),g(function(){h(b)&&k({inst:b})})},[g]),l(w),w}function h(g){var v=g.getSnapshot;g=g.value;try{var w=v();return!n(g,w)}catch{return!0}}function p(g,v){return v()}var f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?p:u;return Uf.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:f,Uf}var rb;function r2(){return rb||(rb=1,Bf.exports=n2()),Bf.exports}/**
48
+ */var nb;function n2(){if(nb)return Hf;nb=1;var e=_l();function t(g,v){return g===v&&(g!==0||1/g===1/v)||g!==g&&v!==v}var n=typeof Object.is=="function"?Object.is:t,s=e.useState,i=e.useEffect,a=e.useLayoutEffect,l=e.useDebugValue;function u(g,v){var w=v(),N=s({inst:{value:w,getSnapshot:v}}),b=N[0].inst,k=N[1];return a(function(){b.value=w,b.getSnapshot=v,h(b)&&k({inst:b})},[g,w,v]),i(function(){return h(b)&&k({inst:b}),g(function(){h(b)&&k({inst:b})})},[g]),l(w),w}function h(g){var v=g.getSnapshot;g=g.value;try{var w=v();return!n(g,w)}catch{return!0}}function p(g,v){return v()}var f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?p:u;return Hf.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:f,Hf}var rb;function r2(){return rb||(rb=1,Wf.exports=n2()),Wf.exports}/**
49
49
  * @license React
50
50
  * use-sync-external-store-shim/with-selector.production.js
51
51
  *
@@ -53,29 +53,33 @@ Error generating stack: `+x.message+`
53
53
  *
54
54
  * This source code is licensed under the MIT license found in the
55
55
  * LICENSE file in the root directory of this source tree.
56
- */var sb;function s2(){if(sb)return zf;sb=1;var e=gl(),t=r2();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 zf.useSyncExternalStoreWithSelector=function(p,f,g,v,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 S(O){if(!E){if(E=!0,C=O,O=v(O),w!==void 0&&b.hasValue){var P=b.value;if(w(P,O))return j=P}return j=O}if(P=j,s(C,O))return P;var z=v(O);return w!==void 0&&w(P,z)?(C=O,P):(C=O,j=z)}var E=!1,C,j,I=g===void 0?null:g;return[function(){return S(f())},I===null?void 0:function(){return S(I())}]},[f,g,v,w]);var k=i(p,N[0],N[1]);return l(function(){b.hasValue=!0,b.value=k},[k]),h(k),k},zf}var ob;function o2(){return ob||(ob=1,Ff.exports=s2()),Ff.exports}var i2=o2();const a2=iw(i2),l2={},ib=e=>{let t;const n=new Set,s=(f,g)=>{const v=typeof f=="function"?f(t):f;if(!Object.is(v,t)){const w=t;t=g??(typeof v!="object"||v===null)?v:Object.assign({},t,v),n.forEach(N=>N(t,w))}},i=()=>t,h={setState:s,getState:i,getInitialState:()=>p,subscribe:f=>(n.add(f),()=>n.delete(f)),destroy:()=>{(l2?"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},c2=e=>e?ib(e):ib,{useDebugValue:u2}=de,{useSyncExternalStoreWithSelector:d2}=a2,f2=e=>e;function IC(e,t=f2,n){const s=d2(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return u2(s),s}const ab=(e,t)=>{const n=c2(e),s=(i,a=t)=>IC(n,i,a);return Object.assign(s,n),s},h2=(e,t)=>e?ab(e,t):ab;function Lt(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 p2={value:()=>{}};function Iu(){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 du(n)}function du(e){this._=e}function m2(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}})}du.prototype=Iu.prototype={constructor:du,on:function(e,t){var n=this._,s=m2(e+"",n),i,a=-1,l=s.length;if(arguments.length<2){for(;++a<l;)if((i=(e=s[a]).type)&&(i=g2(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]=lb(n[i],e.name,t);else if(t==null)for(i in n)n[i]=lb(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 du(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 g2(e,t){for(var n=0,s=e.length,i;n<s;++n)if((i=e[n]).name===t)return i.value}function lb(e,t,n){for(var s=0,i=e.length;s<i;++s)if(e[s].name===t){e[s]=p2,e=e.slice(0,s).concat(e.slice(s+1));break}return n!=null&&e.push({name:t,value:n}),e}var Ev="http://www.w3.org/1999/xhtml";const cb={svg:"http://www.w3.org/2000/svg",xhtml:Ev,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Ou(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),cb.hasOwnProperty(t)?{space:cb[t],local:e}:e}function y2(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Ev&&t.documentElement.namespaceURI===Ev?t.createElement(e):t.createElementNS(n,e)}}function v2(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function OC(e){var t=Ou(e);return(t.local?v2:y2)(t)}function w2(){}function aw(e){return e==null?w2:function(){return this.querySelector(e)}}function x2(e){typeof e!="function"&&(e=aw(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 bn(s,this._parents)}function b2(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function k2(){return[]}function PC(e){return e==null?k2:function(){return this.querySelectorAll(e)}}function _2(e){return function(){return b2(e.apply(this,arguments))}}function S2(e){typeof e=="function"?e=_2(e):e=PC(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 bn(s,i)}function $C(e){return function(){return this.matches(e)}}function LC(e){return function(t){return t.matches(e)}}var N2=Array.prototype.find;function E2(e){return function(){return N2.call(this.children,e)}}function C2(){return this.firstElementChild}function j2(e){return this.select(e==null?C2:E2(typeof e=="function"?e:LC(e)))}var T2=Array.prototype.filter;function R2(){return Array.from(this.children)}function A2(e){return function(){return T2.call(this.children,e)}}function M2(e){return this.selectAll(e==null?R2:A2(typeof e=="function"?e:LC(e)))}function I2(e){typeof e!="function"&&(e=$C(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 bn(s,this._parents)}function qC(e){return new Array(e.length)}function O2(){return new bn(this._enter||this._groups.map(qC),this._parents)}function yu(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}yu.prototype={constructor:yu,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 P2(e){return function(){return e}}function $2(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 yu(e,a[l]);for(;l<h;++l)(u=t[l])&&(i[l]=u)}function L2(e,t,n,s,i,a,l){var u,h,p=new Map,f=t.length,g=a.length,v=new Array(f),w;for(u=0;u<f;++u)(h=t[u])&&(v[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 yu(e,a[u]);for(u=0;u<f;++u)(h=t[u])&&p.get(v[u])===h&&(i[u]=h)}function q2(e){return e.__data__}function D2(e,t){if(!arguments.length)return Array.from(this,q2);var n=t?L2:$2,s=this._parents,i=this._groups;typeof e!="function"&&(e=P2(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],v=g.length,w=F2(e.call(f,f&&f.__data__,p,s)),N=w.length,b=u[p]=new Array(N),k=l[p]=new Array(N),S=h[p]=new Array(v);n(f,g,b,k,S,w,t);for(var E=0,C=0,j,I;E<N;++E)if(j=b[E]){for(E>=C&&(C=E+1);!(I=k[C])&&++C<N;);j._next=I||null}}return l=new bn(l,s),l._enter=u,l._exit=h,l}function F2(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function z2(){return new bn(this._exit||this._groups.map(qC),this._parents)}function B2(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 U2(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,v=u[h]=new Array(g),w,N=0;N<g;++N)(w=p[N]||f[N])&&(v[N]=w);for(;h<i;++h)u[h]=n[h];return new bn(u,this._parents)}function W2(){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 H2(e){e||(e=G2);function t(g,v){return g&&v?e(g.__data__,v.__data__):!g-!v}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 bn(i,this._parents).order()}function G2(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function V2(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Y2(){return Array.from(this)}function K2(){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 X2(){let e=0;for(const t of this)++e;return e}function Q2(){return!this.node()}function Z2(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 J2(e){return function(){this.removeAttribute(e)}}function eM(e){return function(){this.removeAttributeNS(e.space,e.local)}}function tM(e,t){return function(){this.setAttribute(e,t)}}function nM(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function rM(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function sM(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 oM(e,t){var n=Ou(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?eM:J2:typeof t=="function"?n.local?sM:rM:n.local?nM:tM)(n,t))}function DC(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function iM(e){return function(){this.style.removeProperty(e)}}function aM(e,t,n){return function(){this.style.setProperty(e,t,n)}}function lM(e,t,n){return function(){var s=t.apply(this,arguments);s==null?this.style.removeProperty(e):this.style.setProperty(e,s,n)}}function cM(e,t,n){return arguments.length>1?this.each((t==null?iM:typeof t=="function"?lM:aM)(e,t,n??"")):Bi(this.node(),e)}function Bi(e,t){return e.style.getPropertyValue(t)||DC(e).getComputedStyle(e,null).getPropertyValue(t)}function uM(e){return function(){delete this[e]}}function dM(e,t){return function(){this[e]=t}}function fM(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function hM(e,t){return arguments.length>1?this.each((t==null?uM:typeof t=="function"?fM:dM)(e,t)):this.node()[e]}function FC(e){return e.trim().split(/^|\s+/)}function lw(e){return e.classList||new zC(e)}function zC(e){this._node=e,this._names=FC(e.getAttribute("class")||"")}zC.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 BC(e,t){for(var n=lw(e),s=-1,i=t.length;++s<i;)n.add(t[s])}function UC(e,t){for(var n=lw(e),s=-1,i=t.length;++s<i;)n.remove(t[s])}function pM(e){return function(){BC(this,e)}}function mM(e){return function(){UC(this,e)}}function gM(e,t){return function(){(t.apply(this,arguments)?BC:UC)(this,e)}}function yM(e,t){var n=FC(e+"");if(arguments.length<2){for(var s=lw(this.node()),i=-1,a=n.length;++i<a;)if(!s.contains(n[i]))return!1;return!0}return this.each((typeof t=="function"?gM:t?pM:mM)(n,t))}function vM(){this.textContent=""}function wM(e){return function(){this.textContent=e}}function xM(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function bM(e){return arguments.length?this.each(e==null?vM:(typeof e=="function"?xM:wM)(e)):this.node().textContent}function kM(){this.innerHTML=""}function _M(e){return function(){this.innerHTML=e}}function SM(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function NM(e){return arguments.length?this.each(e==null?kM:(typeof e=="function"?SM:_M)(e)):this.node().innerHTML}function EM(){this.nextSibling&&this.parentNode.appendChild(this)}function CM(){return this.each(EM)}function jM(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function TM(){return this.each(jM)}function RM(e){var t=typeof e=="function"?e:OC(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function AM(){return null}function MM(e,t){var n=typeof e=="function"?e:OC(e),s=t==null?AM:typeof t=="function"?t:aw(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),s.apply(this,arguments)||null)})}function IM(){var e=this.parentNode;e&&e.removeChild(this)}function OM(){return this.each(IM)}function PM(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function $M(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function LM(e){return this.select(e?$M:PM)}function qM(e){return arguments.length?this.property("__data__",e):this.node().__data__}function DM(e){return function(t){e.call(this,t,this.__data__)}}function FM(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 zM(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 BM(e,t,n){return function(){var s=this.__on,i,a=DM(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 UM(e,t,n){var s=FM(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?BM:zM,i=0;i<a;++i)this.each(u(s[i],t,n));return this}function WC(e,t,n){var s=DC(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 WM(e,t){return function(){return WC(this,e,t)}}function HM(e,t){return function(){return WC(this,e,t.apply(this,arguments))}}function GM(e,t){return this.each((typeof t=="function"?HM:WM)(e,t))}function*VM(){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 HC=[null];function bn(e,t){this._groups=e,this._parents=t}function yl(){return new bn([[document.documentElement]],HC)}function YM(){return this}bn.prototype=yl.prototype={constructor:bn,select:x2,selectAll:S2,selectChild:j2,selectChildren:M2,filter:I2,data:D2,enter:O2,exit:z2,join:B2,merge:U2,selection:YM,order:W2,sort:H2,call:V2,nodes:Y2,node:K2,size:X2,empty:Q2,each:Z2,attr:oM,style:cM,property:hM,classed:yM,text:bM,html:NM,raise:CM,lower:TM,append:RM,insert:MM,remove:OM,clone:LM,datum:qM,on:UM,dispatch:GM,[Symbol.iterator]:VM};function Pn(e){return typeof e=="string"?new bn([[document.querySelector(e)]],[document.documentElement]):new bn([[e]],HC)}function KM(e){let t;for(;t=e.sourceEvent;)e=t;return e}function nr(e,t){if(e=KM(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 XM={passive:!1},rl={capture:!0,passive:!1};function Wf(e){e.stopImmediatePropagation()}function $i(e){e.preventDefault(),e.stopImmediatePropagation()}function GC(e){var t=e.document.documentElement,n=Pn(e).on("dragstart.drag",$i,rl);"onselectstart"in t?n.on("selectstart.drag",$i,rl):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function VC(e,t){var n=e.document.documentElement,s=Pn(e).on("dragstart.drag",null);t&&(s.on("click.drag",$i,rl),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 Gc=e=>()=>e;function Cv(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}})}Cv.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function QM(e){return!e.ctrlKey&&!e.button}function ZM(){return this.parentNode}function JM(e,t){return t??{x:e.x,y:e.y}}function eI(){return navigator.maxTouchPoints||"ontouchstart"in this}function tI(){var e=QM,t=ZM,n=JM,s=eI,i={},a=Iu("start","drag","end"),l=0,u,h,p,f,g=0;function v(j){j.on("mousedown.drag",w).filter(s).on("touchstart.drag",k).on("touchmove.drag",S,XM).on("touchend.drag touchcancel.drag",E).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function w(j,I){if(!(f||!e.call(this,j,I))){var O=C(this,t.call(this,j,I),j,I,"mouse");O&&(Pn(j.view).on("mousemove.drag",N,rl).on("mouseup.drag",b,rl),GC(j.view),Wf(j),p=!1,u=j.clientX,h=j.clientY,O("start",j))}}function N(j){if($i(j),!p){var I=j.clientX-u,O=j.clientY-h;p=I*I+O*O>g}i.mouse("drag",j)}function b(j){Pn(j.view).on("mousemove.drag mouseup.drag",null),VC(j.view,p),$i(j),i.mouse("end",j)}function k(j,I){if(e.call(this,j,I)){var O=j.changedTouches,P=t.call(this,j,I),z=O.length,M,A;for(M=0;M<z;++M)(A=C(this,P,j,I,O[M].identifier,O[M]))&&(Wf(j),A("start",j,O[M]))}}function S(j){var I=j.changedTouches,O=I.length,P,z;for(P=0;P<O;++P)(z=i[I[P].identifier])&&($i(j),z("drag",j,I[P]))}function E(j){var I=j.changedTouches,O=I.length,P,z;for(f&&clearTimeout(f),f=setTimeout(function(){f=null},500),P=0;P<O;++P)(z=i[I[P].identifier])&&(Wf(j),z("end",j,I[P]))}function C(j,I,O,P,z,M){var A=a.copy(),q=nr(M||O,I),H,Y,R;if((R=n.call(j,new Cv("beforestart",{sourceEvent:O,target:v,identifier:z,active:l,x:q[0],y:q[1],dx:0,dy:0,dispatch:A}),P))!=null)return H=R.x-q[0]||0,Y=R.y-q[1]||0,function Q(W,ne,X){var B=q,J;switch(W){case"start":i[z]=Q,J=l++;break;case"end":delete i[z],--l;case"drag":q=nr(X||ne,I),J=l;break}A.call(W,j,new Cv(W,{sourceEvent:ne,subject:R,target:v,identifier:z,active:J,x:q[0]+H,y:q[1]+Y,dx:q[0]-B[0],dy:q[1]-B[1],dispatch:A}),P)}}return v.filter=function(j){return arguments.length?(e=typeof j=="function"?j:Gc(!!j),v):e},v.container=function(j){return arguments.length?(t=typeof j=="function"?j:Gc(j),v):t},v.subject=function(j){return arguments.length?(n=typeof j=="function"?j:Gc(j),v):n},v.touchable=function(j){return arguments.length?(s=typeof j=="function"?j:Gc(!!j),v):s},v.on=function(){var j=a.on.apply(a,arguments);return j===a?v:j},v.clickDistance=function(j){return arguments.length?(g=(j=+j)*j,v):Math.sqrt(g)},v}function cw(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function YC(e,t){var n=Object.create(e.prototype);for(var s in t)n[s]=t[s];return n}function vl(){}var sl=.7,vu=1/sl,Li="\\s*([+-]?\\d+)\\s*",ol="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Er="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",nI=/^#([0-9a-f]{3,8})$/,rI=new RegExp(`^rgb\\(${Li},${Li},${Li}\\)$`),sI=new RegExp(`^rgb\\(${Er},${Er},${Er}\\)$`),oI=new RegExp(`^rgba\\(${Li},${Li},${Li},${ol}\\)$`),iI=new RegExp(`^rgba\\(${Er},${Er},${Er},${ol}\\)$`),aI=new RegExp(`^hsl\\(${ol},${Er},${Er}\\)$`),lI=new RegExp(`^hsla\\(${ol},${Er},${Er},${ol}\\)$`),ub={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};cw(vl,il,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:db,formatHex:db,formatHex8:cI,formatHsl:uI,formatRgb:fb,toString:fb});function db(){return this.rgb().formatHex()}function cI(){return this.rgb().formatHex8()}function uI(){return KC(this).formatHsl()}function fb(){return this.rgb().formatRgb()}function il(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=nI.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?hb(t):n===3?new dn(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Vc(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Vc(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=rI.exec(e))?new dn(t[1],t[2],t[3],1):(t=sI.exec(e))?new dn(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=oI.exec(e))?Vc(t[1],t[2],t[3],t[4]):(t=iI.exec(e))?Vc(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=aI.exec(e))?gb(t[1],t[2]/100,t[3]/100,1):(t=lI.exec(e))?gb(t[1],t[2]/100,t[3]/100,t[4]):ub.hasOwnProperty(e)?hb(ub[e]):e==="transparent"?new dn(NaN,NaN,NaN,0):null}function hb(e){return new dn(e>>16&255,e>>8&255,e&255,1)}function Vc(e,t,n,s){return s<=0&&(e=t=n=NaN),new dn(e,t,n,s)}function dI(e){return e instanceof vl||(e=il(e)),e?(e=e.rgb(),new dn(e.r,e.g,e.b,e.opacity)):new dn}function jv(e,t,n,s){return arguments.length===1?dI(e):new dn(e,t,n,s??1)}function dn(e,t,n,s){this.r=+e,this.g=+t,this.b=+n,this.opacity=+s}cw(dn,jv,YC(vl,{brighter(e){return e=e==null?vu:Math.pow(vu,e),new dn(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?sl:Math.pow(sl,e),new dn(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new dn(ko(this.r),ko(this.g),ko(this.b),wu(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:pb,formatHex:pb,formatHex8:fI,formatRgb:mb,toString:mb}));function pb(){return`#${xo(this.r)}${xo(this.g)}${xo(this.b)}`}function fI(){return`#${xo(this.r)}${xo(this.g)}${xo(this.b)}${xo((isNaN(this.opacity)?1:this.opacity)*255)}`}function mb(){const e=wu(this.opacity);return`${e===1?"rgb(":"rgba("}${ko(this.r)}, ${ko(this.g)}, ${ko(this.b)}${e===1?")":`, ${e})`}`}function wu(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ko(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function xo(e){return e=ko(e),(e<16?"0":"")+e.toString(16)}function gb(e,t,n,s){return s<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new rr(e,t,n,s)}function KC(e){if(e instanceof rr)return new rr(e.h,e.s,e.l,e.opacity);if(e instanceof vl||(e=il(e)),!e)return new rr;if(e instanceof rr)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 rr(l,u,h,e.opacity)}function hI(e,t,n,s){return arguments.length===1?KC(e):new rr(e,t,n,s??1)}function rr(e,t,n,s){this.h=+e,this.s=+t,this.l=+n,this.opacity=+s}cw(rr,hI,YC(vl,{brighter(e){return e=e==null?vu:Math.pow(vu,e),new rr(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?sl:Math.pow(sl,e),new rr(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 dn(Hf(e>=240?e-240:e+120,i,s),Hf(e,i,s),Hf(e<120?e+240:e-120,i,s),this.opacity)},clamp(){return new rr(yb(this.h),Yc(this.s),Yc(this.l),wu(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=wu(this.opacity);return`${e===1?"hsl(":"hsla("}${yb(this.h)}, ${Yc(this.s)*100}%, ${Yc(this.l)*100}%${e===1?")":`, ${e})`}`}}));function yb(e){return e=(e||0)%360,e<0?e+360:e}function Yc(e){return Math.max(0,Math.min(1,e||0))}function Hf(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 XC=e=>()=>e;function pI(e,t){return function(n){return e+n*t}}function mI(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 gI(e){return(e=+e)==1?QC:function(t,n){return n-t?mI(t,n,e):XC(isNaN(t)?n:t)}}function QC(e,t){var n=t-e;return n?pI(e,n):XC(isNaN(e)?t:e)}const vb=(function e(t){var n=gI(t);function s(i,a){var l=n((i=jv(i)).r,(a=jv(a)).r),u=n(i.g,a.g),h=n(i.b,a.b),p=QC(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 As(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var Tv=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Gf=new RegExp(Tv.source,"g");function yI(e){return function(){return e}}function vI(e){return function(t){return e(t)+""}}function wI(e,t){var n=Tv.lastIndex=Gf.lastIndex=0,s,i,a,l=-1,u=[],h=[];for(e=e+"",t=t+"";(s=Tv.exec(e))&&(i=Gf.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:As(s,i)})),n=Gf.lastIndex;return n<t.length&&(a=t.slice(n),u[l]?u[l]+=a:u[++l]=a),u.length<2?h[0]?vI(h[0].x):yI(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 wb=180/Math.PI,Rv={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function ZC(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)*wb,skewX:Math.atan(h)*wb,scaleX:l,scaleY:u}}var Kc;function xI(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Rv:ZC(t.a,t.b,t.c,t.d,t.e,t.f)}function bI(e){return e==null||(Kc||(Kc=document.createElementNS("http://www.w3.org/2000/svg","g")),Kc.setAttribute("transform",e),!(e=Kc.transform.baseVal.consolidate()))?Rv:(e=e.matrix,ZC(e.a,e.b,e.c,e.d,e.e,e.f))}function JC(e,t,n,s){function i(p){return p.length?p.pop()+" ":""}function a(p,f,g,v,w,N){if(p!==g||f!==v){var b=w.push("translate(",null,t,null,n);N.push({i:b-4,x:As(p,g)},{i:b-2,x:As(f,v)})}else(g||v)&&w.push("translate("+g+t+v+n)}function l(p,f,g,v){p!==f?(p-f>180?f+=360:f-p>180&&(p+=360),v.push({i:g.push(i(g)+"rotate(",null,s)-2,x:As(p,f)})):f&&g.push(i(g)+"rotate("+f+s)}function u(p,f,g,v){p!==f?v.push({i:g.push(i(g)+"skewX(",null,s)-2,x:As(p,f)}):f&&g.push(i(g)+"skewX("+f+s)}function h(p,f,g,v,w,N){if(p!==g||f!==v){var b=w.push(i(w)+"scale(",null,",",null,")");N.push({i:b-4,x:As(p,g)},{i:b-2,x:As(f,v)})}else(g!==1||v!==1)&&w.push(i(w)+"scale("+g+","+v+")")}return function(p,f){var g=[],v=[];return p=e(p),f=e(f),a(p.translateX,p.translateY,f.translateX,f.translateY,g,v),l(p.rotate,f.rotate,g,v),u(p.skewX,f.skewX,g,v),h(p.scaleX,p.scaleY,f.scaleX,f.scaleY,g,v),p=f=null,function(w){for(var N=-1,b=v.length,k;++N<b;)g[(k=v[N]).i]=k.x(w);return g.join("")}}}var kI=JC(xI,"px, ","px)","deg)"),_I=JC(bI,", ",")",")"),SI=1e-12;function xb(e){return((e=Math.exp(e))+1/e)/2}function NI(e){return((e=Math.exp(e))-1/e)/2}function EI(e){return((e=Math.exp(2*e))-1)/(e+1)}const CI=(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],v=l[2],w=f-u,N=g-h,b=w*w+N*N,k,S;if(b<SI)S=Math.log(v/p)/t,k=function(P){return[u+P*w,h+P*N,p*Math.exp(t*P*S)]};else{var E=Math.sqrt(b),C=(v*v-p*p+s*b)/(2*p*n*E),j=(v*v-p*p-s*b)/(2*v*n*E),I=Math.log(Math.sqrt(C*C+1)-C),O=Math.log(Math.sqrt(j*j+1)-j);S=(O-I)/t,k=function(P){var z=P*S,M=xb(I),A=p/(n*E)*(M*EI(t*z+I)-NI(I));return[u+A*w,h+A*N,p*M/xb(t*z+I)]}}return k.duration=S*1e3*t/Math.SQRT2,k}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 Ui=0,Xa=0,za=0,ej=1e3,xu,Qa,bu=0,So=0,Pu=0,al=typeof performance=="object"&&performance.now?performance:Date,tj=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function uw(){return So||(tj(jI),So=al.now()+Pu)}function jI(){So=0}function ku(){this._call=this._time=this._next=null}ku.prototype=nj.prototype={constructor:ku,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?uw():+n)+(t==null?0:+t),!this._next&&Qa!==this&&(Qa?Qa._next=this:xu=this,Qa=this),this._call=e,this._time=n,Av()},stop:function(){this._call&&(this._call=null,this._time=1/0,Av())}};function nj(e,t,n){var s=new ku;return s.restart(e,t,n),s}function TI(){uw(),++Ui;for(var e=xu,t;e;)(t=So-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Ui}function bb(){So=(bu=al.now())+Pu,Ui=Xa=0;try{TI()}finally{Ui=0,AI(),So=0}}function RI(){var e=al.now(),t=e-bu;t>ej&&(Pu-=t,bu=e)}function AI(){for(var e,t=xu,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:xu=n);Qa=e,Av(s)}function Av(e){if(!Ui){Xa&&(Xa=clearTimeout(Xa));var t=e-So;t>24?(e<1/0&&(Xa=setTimeout(bb,e-al.now()-Pu)),za&&(za=clearInterval(za))):(za||(bu=al.now(),za=setInterval(RI,ej)),Ui=1,tj(bb))}}function kb(e,t,n){var s=new ku;return t=t==null?0:+t,s.restart(i=>{s.stop(),e(i+t)},t,n),s}var MI=Iu("start","end","cancel","interrupt"),II=[],rj=0,_b=1,Mv=2,fu=3,Sb=4,Iv=5,hu=6;function $u(e,t,n,s,i,a){var l=e.__transition;if(!l)e.__transition={};else if(n in l)return;OI(e,n,{name:t,index:s,group:i,on:MI,tween:II,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:rj})}function dw(e,t){var n=lr(e,t);if(n.state>rj)throw new Error("too late; already scheduled");return n}function Cr(e,t){var n=lr(e,t);if(n.state>fu)throw new Error("too late; already running");return n}function lr(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function OI(e,t,n){var s=e.__transition,i;s[t]=n,n.timer=nj(a,0,n.time);function a(p){n.state=_b,n.timer.restart(l,n.delay,n.time),n.delay<=p&&l(p-n.delay)}function l(p){var f,g,v,w;if(n.state!==_b)return h();for(f in s)if(w=s[f],w.name===n.name){if(w.state===fu)return kb(l);w.state===Sb?(w.state=hu,w.timer.stop(),w.on.call("interrupt",e,e.__data__,w.index,w.group),delete s[f]):+f<t&&(w.state=hu,w.timer.stop(),w.on.call("cancel",e,e.__data__,w.index,w.group),delete s[f])}if(kb(function(){n.state===fu&&(n.state=Sb,n.timer.restart(u,n.delay,n.time),u(p))}),n.state=Mv,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Mv){for(n.state=fu,i=new Array(v=n.tween.length),f=0,g=-1;f<v;++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=Iv,1),g=-1,v=i.length;++g<v;)i[g].call(e,f);n.state===Iv&&(n.on.call("end",e,e.__data__,n.index,n.group),h())}function h(){n.state=hu,n.timer.stop(),delete s[t];for(var p in s)return;delete e.__transition}}function pu(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>Mv&&s.state<Iv,s.state=hu,s.timer.stop(),s.on.call(i?"interrupt":"cancel",e,e.__data__,s.index,s.group),delete n[l]}a&&delete e.__transition}}function PI(e){return this.each(function(){pu(this,e)})}function $I(e,t){var n,s;return function(){var i=Cr(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 LI(e,t,n){var s,i;if(typeof n!="function")throw new Error;return function(){var a=Cr(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 qI(e,t){var n=this._id;if(e+="",arguments.length<2){for(var s=lr(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?$I:LI)(n,e,t))}function fw(e,t,n){var s=e._id;return e.each(function(){var i=Cr(this,s);(i.value||(i.value={}))[t]=n.apply(this,arguments)}),function(i){return lr(i,s).value[t]}}function sj(e,t){var n;return(typeof t=="number"?As:t instanceof il?vb:(n=il(t))?(t=n,vb):wI)(e,t)}function DI(e){return function(){this.removeAttribute(e)}}function FI(e){return function(){this.removeAttributeNS(e.space,e.local)}}function zI(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 BI(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 UI(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 WI(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 HI(e,t){var n=Ou(e),s=n==="transform"?_I:sj;return this.attrTween(e,typeof t=="function"?(n.local?WI:UI)(n,s,fw(this,"attr."+e,t)):t==null?(n.local?FI:DI)(n):(n.local?BI:zI)(n,s,t))}function GI(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function VI(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function YI(e,t){var n,s;function i(){var a=t.apply(this,arguments);return a!==s&&(n=(s=a)&&VI(e,a)),n}return i._value=t,i}function KI(e,t){var n,s;function i(){var a=t.apply(this,arguments);return a!==s&&(n=(s=a)&&GI(e,a)),n}return i._value=t,i}function XI(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=Ou(e);return this.tween(n,(s.local?YI:KI)(s,t))}function QI(e,t){return function(){dw(this,e).delay=+t.apply(this,arguments)}}function ZI(e,t){return t=+t,function(){dw(this,e).delay=t}}function JI(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?QI:ZI)(t,e)):lr(this.node(),t).delay}function eO(e,t){return function(){Cr(this,e).duration=+t.apply(this,arguments)}}function tO(e,t){return t=+t,function(){Cr(this,e).duration=t}}function nO(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?eO:tO)(t,e)):lr(this.node(),t).duration}function rO(e,t){if(typeof t!="function")throw new Error;return function(){Cr(this,e).ease=t}}function sO(e){var t=this._id;return arguments.length?this.each(rO(t,e)):lr(this.node(),t).ease}function oO(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Cr(this,e).ease=n}}function iO(e){if(typeof e!="function")throw new Error;return this.each(oO(this._id,e))}function aO(e){typeof e!="function"&&(e=$C(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 Zr(s,this._parents,this._name,this._id)}function lO(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),v,w=0;w<f;++w)(v=h[w]||p[w])&&(g[w]=v);for(;u<s;++u)l[u]=t[u];return new Zr(l,this._parents,this._name,this._id)}function cO(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 uO(e,t,n){var s,i,a=cO(t)?dw:Cr;return function(){var l=a(this,e),u=l.on;u!==s&&(i=(s=u).copy()).on(t,n),l.on=i}}function dO(e,t){var n=this._id;return arguments.length<2?lr(this.node(),n).on.on(e):this.each(uO(n,e,t))}function fO(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function hO(){return this.on("end.remove",fO(this._id))}function pO(e){var t=this._name,n=this._id;typeof e!="function"&&(e=aw(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,v=0;v<h;++v)(f=u[v])&&(g=e.call(f,f.__data__,v,u))&&("__data__"in f&&(g.__data__=f.__data__),p[v]=g,$u(p[v],t,n,v,p,lr(f,n)));return new Zr(a,this._parents,t,n)}function mO(e){var t=this._name,n=this._id;typeof e!="function"&&(e=PC(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 v=e.call(f,f.__data__,g,h),w,N=lr(f,n),b=0,k=v.length;b<k;++b)(w=v[b])&&$u(w,t,n,b,v,N);a.push(v),l.push(f)}return new Zr(a,l,t,n)}var gO=yl.prototype.constructor;function yO(){return new gO(this._groups,this._parents)}function vO(e,t){var n,s,i;return function(){var a=Bi(this,e),l=(this.style.removeProperty(e),Bi(this,e));return a===l?null:a===n&&l===s?i:i=t(n=a,s=l)}}function oj(e){return function(){this.style.removeProperty(e)}}function wO(e,t,n){var s,i=n+"",a;return function(){var l=Bi(this,e);return l===i?null:l===s?a:a=t(s=l,n)}}function xO(e,t,n){var s,i,a;return function(){var l=Bi(this,e),u=n(this),h=u+"";return u==null&&(h=u=(this.style.removeProperty(e),Bi(this,e))),l===h?null:l===s&&h===i?a:(i=h,a=t(s=l,u))}}function bO(e,t){var n,s,i,a="style."+t,l="end."+a,u;return function(){var h=Cr(this,e),p=h.on,f=h.value[a]==null?u||(u=oj(t)):void 0;(p!==n||i!==f)&&(s=(n=p).copy()).on(l,i=f),h.on=s}}function kO(e,t,n){var s=(e+="")=="transform"?kI:sj;return t==null?this.styleTween(e,vO(e,s)).on("end.style."+e,oj(e)):typeof t=="function"?this.styleTween(e,xO(e,s,fw(this,"style."+e,t))).each(bO(this._id,e)):this.styleTween(e,wO(e,s,t),n).on("end.style."+e,null)}function _O(e,t,n){return function(s){this.style.setProperty(e,t.call(this,s),n)}}function SO(e,t,n){var s,i;function a(){var l=t.apply(this,arguments);return l!==i&&(s=(i=l)&&_O(e,l,n)),s}return a._value=t,a}function NO(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,SO(e,t,n??""))}function EO(e){return function(){this.textContent=e}}function CO(e){return function(){var t=e(this);this.textContent=t??""}}function jO(e){return this.tween("text",typeof e=="function"?CO(fw(this,"text",e)):EO(e==null?"":e+""))}function TO(e){return function(t){this.textContent=e.call(this,t)}}function RO(e){var t,n;function s(){var i=e.apply(this,arguments);return i!==n&&(t=(n=i)&&TO(i)),t}return s._value=e,s}function AO(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,RO(e))}function MO(){for(var e=this._name,t=this._id,n=ij(),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=lr(h,t);$u(h,e,n,p,l,{time:f.time+f.delay+f.duration,delay:0,duration:f.duration,ease:f.ease})}return new Zr(s,this._parents,e,n)}function IO(){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=Cr(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 OO=0;function Zr(e,t,n,s){this._groups=e,this._parents=t,this._name=n,this._id=s}function ij(){return++OO}var Kr=yl.prototype;Zr.prototype={constructor:Zr,select:pO,selectAll:mO,selectChild:Kr.selectChild,selectChildren:Kr.selectChildren,filter:aO,merge:lO,selection:yO,transition:MO,call:Kr.call,nodes:Kr.nodes,node:Kr.node,size:Kr.size,empty:Kr.empty,each:Kr.each,on:dO,attr:HI,attrTween:XI,style:kO,styleTween:NO,text:jO,textTween:AO,remove:hO,tween:qI,delay:JI,duration:nO,ease:sO,easeVarying:iO,end:IO,[Symbol.iterator]:Kr[Symbol.iterator]};function PO(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var $O={time:null,delay:0,duration:250,ease:PO};function LO(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 qO(e){var t,n;e instanceof Zr?(t=e._id,e=e._name):(t=ij(),(n=$O).time=uw(),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])&&$u(h,e,t,p,l,n||LO(h,t));return new Zr(s,this._parents,e,t)}yl.prototype.interrupt=PI;yl.prototype.transition=qO;const Xc=e=>()=>e;function DO(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 Xr(e,t,n){this.k=e,this.x=t,this.y=n}Xr.prototype={constructor:Xr,scale:function(e){return e===1?this:new Xr(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Xr(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 Qr=new Xr(1,0,0);Xr.prototype;function Vf(e){e.stopImmediatePropagation()}function Ba(e){e.preventDefault(),e.stopImmediatePropagation()}function FO(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function zO(){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 Nb(){return this.__zoom||Qr}function BO(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function UO(){return navigator.maxTouchPoints||"ontouchstart"in this}function WO(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 aj(){var e=FO,t=zO,n=WO,s=BO,i=UO,a=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],u=250,h=CI,p=Iu("start","zoom","end"),f,g,v,w=500,N=150,b=0,k=10;function S(R){R.property("__zoom",Nb).on("wheel.zoom",z,{passive:!1}).on("mousedown.zoom",M).on("dblclick.zoom",A).filter(i).on("touchstart.zoom",q).on("touchmove.zoom",H).on("touchend.zoom touchcancel.zoom",Y).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}S.transform=function(R,Q,W,ne){var X=R.selection?R.selection():R;X.property("__zoom",Nb),R!==X?I(R,Q,W,ne):X.interrupt().each(function(){O(this,arguments).event(ne).start().zoom(null,typeof Q=="function"?Q.apply(this,arguments):Q).end()})},S.scaleBy=function(R,Q,W,ne){S.scaleTo(R,function(){var X=this.__zoom.k,B=typeof Q=="function"?Q.apply(this,arguments):Q;return X*B},W,ne)},S.scaleTo=function(R,Q,W,ne){S.transform(R,function(){var X=t.apply(this,arguments),B=this.__zoom,J=W==null?j(X):typeof W=="function"?W.apply(this,arguments):W,$=B.invert(J),V=typeof Q=="function"?Q.apply(this,arguments):Q;return n(C(E(B,V),J,$),X,l)},W,ne)},S.translateBy=function(R,Q,W,ne){S.transform(R,function(){return n(this.__zoom.translate(typeof Q=="function"?Q.apply(this,arguments):Q,typeof W=="function"?W.apply(this,arguments):W),t.apply(this,arguments),l)},null,ne)},S.translateTo=function(R,Q,W,ne,X){S.transform(R,function(){var B=t.apply(this,arguments),J=this.__zoom,$=ne==null?j(B):typeof ne=="function"?ne.apply(this,arguments):ne;return n(Qr.translate($[0],$[1]).scale(J.k).translate(typeof Q=="function"?-Q.apply(this,arguments):-Q,typeof W=="function"?-W.apply(this,arguments):-W),B,l)},ne,X)};function E(R,Q){return Q=Math.max(a[0],Math.min(a[1],Q)),Q===R.k?R:new Xr(Q,R.x,R.y)}function C(R,Q,W){var ne=Q[0]-W[0]*R.k,X=Q[1]-W[1]*R.k;return ne===R.x&&X===R.y?R:new Xr(R.k,ne,X)}function j(R){return[(+R[0][0]+ +R[1][0])/2,(+R[0][1]+ +R[1][1])/2]}function I(R,Q,W,ne){R.on("start.zoom",function(){O(this,arguments).event(ne).start()}).on("interrupt.zoom end.zoom",function(){O(this,arguments).event(ne).end()}).tween("zoom",function(){var X=this,B=arguments,J=O(X,B).event(ne),$=t.apply(X,B),V=W==null?j($):typeof W=="function"?W.apply(X,B):W,Z=Math.max($[1][0]-$[0][0],$[1][1]-$[0][1]),F=X.__zoom,L=typeof Q=="function"?Q.apply(X,B):Q,K=h(F.invert(V).concat(Z/F.k),L.invert(V).concat(Z/L.k));return function(se){if(se===1)se=L;else{var he=K(se),me=Z/he[2];se=new Xr(me,V[0]-he[0]*me,V[1]-he[1]*me)}J.zoom(null,se)}})}function O(R,Q,W){return!W&&R.__zooming||new P(R,Q)}function P(R,Q){this.that=R,this.args=Q,this.active=0,this.sourceEvent=null,this.extent=t.apply(R,Q),this.taps=0}P.prototype={event:function(R){return R&&(this.sourceEvent=R),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(R,Q){return this.mouse&&R!=="mouse"&&(this.mouse[1]=Q.invert(this.mouse[0])),this.touch0&&R!=="touch"&&(this.touch0[1]=Q.invert(this.touch0[0])),this.touch1&&R!=="touch"&&(this.touch1[1]=Q.invert(this.touch1[0])),this.that.__zoom=Q,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(R){var Q=Pn(this.that).datum();p.call(R,this.that,new DO(R,{sourceEvent:this.sourceEvent,target:S,transform:this.that.__zoom,dispatch:p}),Q)}};function z(R,...Q){if(!e.apply(this,arguments))return;var W=O(this,Q).event(R),ne=this.__zoom,X=Math.max(a[0],Math.min(a[1],ne.k*Math.pow(2,s.apply(this,arguments)))),B=nr(R);if(W.wheel)(W.mouse[0][0]!==B[0]||W.mouse[0][1]!==B[1])&&(W.mouse[1]=ne.invert(W.mouse[0]=B)),clearTimeout(W.wheel);else{if(ne.k===X)return;W.mouse=[B,ne.invert(B)],pu(this),W.start()}Ba(R),W.wheel=setTimeout(J,N),W.zoom("mouse",n(C(E(ne,X),W.mouse[0],W.mouse[1]),W.extent,l));function J(){W.wheel=null,W.end()}}function M(R,...Q){if(v||!e.apply(this,arguments))return;var W=R.currentTarget,ne=O(this,Q,!0).event(R),X=Pn(R.view).on("mousemove.zoom",V,!0).on("mouseup.zoom",Z,!0),B=nr(R,W),J=R.clientX,$=R.clientY;GC(R.view),Vf(R),ne.mouse=[B,this.__zoom.invert(B)],pu(this),ne.start();function V(F){if(Ba(F),!ne.moved){var L=F.clientX-J,K=F.clientY-$;ne.moved=L*L+K*K>b}ne.event(F).zoom("mouse",n(C(ne.that.__zoom,ne.mouse[0]=nr(F,W),ne.mouse[1]),ne.extent,l))}function Z(F){X.on("mousemove.zoom mouseup.zoom",null),VC(F.view,ne.moved),Ba(F),ne.event(F).end()}}function A(R,...Q){if(e.apply(this,arguments)){var W=this.__zoom,ne=nr(R.changedTouches?R.changedTouches[0]:R,this),X=W.invert(ne),B=W.k*(R.shiftKey?.5:2),J=n(C(E(W,B),ne,X),t.apply(this,Q),l);Ba(R),u>0?Pn(this).transition().duration(u).call(I,J,ne,R):Pn(this).call(S.transform,J,ne,R)}}function q(R,...Q){if(e.apply(this,arguments)){var W=R.touches,ne=W.length,X=O(this,Q,R.changedTouches.length===ne).event(R),B,J,$,V;for(Vf(R),J=0;J<ne;++J)$=W[J],V=nr($,this),V=[V,this.__zoom.invert(V),$.identifier],X.touch0?!X.touch1&&X.touch0[2]!==V[2]&&(X.touch1=V,X.taps=0):(X.touch0=V,B=!0,X.taps=1+!!f);f&&(f=clearTimeout(f)),B&&(X.taps<2&&(g=V[0],f=setTimeout(function(){f=null},w)),pu(this),X.start())}}function H(R,...Q){if(this.__zooming){var W=O(this,Q).event(R),ne=R.changedTouches,X=ne.length,B,J,$,V;for(Ba(R),B=0;B<X;++B)J=ne[B],$=nr(J,this),W.touch0&&W.touch0[2]===J.identifier?W.touch0[0]=$:W.touch1&&W.touch1[2]===J.identifier&&(W.touch1[0]=$);if(J=W.that.__zoom,W.touch1){var Z=W.touch0[0],F=W.touch0[1],L=W.touch1[0],K=W.touch1[1],se=(se=L[0]-Z[0])*se+(se=L[1]-Z[1])*se,he=(he=K[0]-F[0])*he+(he=K[1]-F[1])*he;J=E(J,Math.sqrt(se/he)),$=[(Z[0]+L[0])/2,(Z[1]+L[1])/2],V=[(F[0]+K[0])/2,(F[1]+K[1])/2]}else if(W.touch0)$=W.touch0[0],V=W.touch0[1];else return;W.zoom("touch",n(C(J,$,V),W.extent,l))}}function Y(R,...Q){if(this.__zooming){var W=O(this,Q).event(R),ne=R.changedTouches,X=ne.length,B,J;for(Vf(R),v&&clearTimeout(v),v=setTimeout(function(){v=null},w),B=0;B<X;++B)J=ne[B],W.touch0&&W.touch0[2]===J.identifier?delete W.touch0:W.touch1&&W.touch1[2]===J.identifier&&delete W.touch1;if(W.touch1&&!W.touch0&&(W.touch0=W.touch1,delete W.touch1),W.touch0)W.touch0[1]=this.__zoom.invert(W.touch0[0]);else if(W.end(),W.taps===2&&(J=nr(J,this),Math.hypot(g[0]-J[0],g[1]-J[1])<k)){var $=Pn(this).on("dblclick.zoom");$&&$.apply(this,arguments)}}}return S.wheelDelta=function(R){return arguments.length?(s=typeof R=="function"?R:Xc(+R),S):s},S.filter=function(R){return arguments.length?(e=typeof R=="function"?R:Xc(!!R),S):e},S.touchable=function(R){return arguments.length?(i=typeof R=="function"?R:Xc(!!R),S):i},S.extent=function(R){return arguments.length?(t=typeof R=="function"?R:Xc([[+R[0][0],+R[0][1]],[+R[1][0],+R[1][1]]]),S):t},S.scaleExtent=function(R){return arguments.length?(a[0]=+R[0],a[1]=+R[1],S):[a[0],a[1]]},S.translateExtent=function(R){return arguments.length?(l[0][0]=+R[0][0],l[1][0]=+R[1][0],l[0][1]=+R[0][1],l[1][1]=+R[1][1],S):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},S.constrain=function(R){return arguments.length?(n=R,S):n},S.duration=function(R){return arguments.length?(u=+R,S):u},S.interpolate=function(R){return arguments.length?(h=R,S):h},S.on=function(){var R=p.on.apply(p,arguments);return R===p?S:R},S.clickDistance=function(R){return arguments.length?(b=(R=+R)*R,S):Math.sqrt(b)},S.tapDistance=function(R){return arguments.length?(k=+R,S):k},S}var hw=MC();const Lu=_.createContext(null),HO=Lu.Provider,Jr={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.`},lj=Jr.error001();function lt(e,t){const n=_.useContext(Lu);if(n===null)throw new Error(lj);return IC(n,e,t)}const At=()=>{const e=_.useContext(Lu);if(e===null)throw new Error(lj);return _.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},GO=e=>e.userSelectionActive?"none":"all";function pw({position:e,children:t,className:n,style:s,...i}){const a=lt(GO),l=`${e}`.split("-");return de.createElement("div",{className:Ht(["react-flow__panel",n,...l]),style:{...s,pointerEvents:a},...i},t)}function VO({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:de.createElement(pw,{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 YO=({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=_.useRef(null),[v,w]=_.useState({x:0,y:0,width:0,height:0}),N=Ht(["react-flow__edge-textwrapper",p]);return _.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-v.width/2} ${t-v.height/2})`,className:N,visibility:v.width?"visible":"hidden",...f},i&&de.createElement("rect",{width:v.width+2*l[0],x:-l[0],y:-l[1],height:v.height+2*l[1],className:"react-flow__edge-textbg",style:a,rx:u,ry:u}),de.createElement("text",{className:"react-flow__edge-text",y:v.height/2,dy:"0.3em",ref:g,style:s},n),h)};var KO=_.memo(YO);const mw=e=>({width:e.offsetWidth,height:e.offsetHeight}),Wi=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),gw=(e={x:0,y:0},t)=>({x:Wi(e.x,t[0][0],t[1][0]),y:Wi(e.y,t[0][1],t[1][1])}),Eb=(e,t,n)=>e<t?Wi(Math.abs(e-t),1,50)/50:e>n?-Wi(Math.abs(e-n),1,50)/50:0,cj=(e,t)=>{const n=Eb(e.x,35,t.width-35)*20,s=Eb(e.y,35,t.height-35)*20;return[n,s]},uj=e=>{var t;return((t=e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},dj=(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)}),ll=({x:e,y:t,width:n,height:s})=>({x:e,y:t,x2:e+n,y2:t+s}),fj=({x:e,y:t,x2:n,y2:s})=>({x:e,y:t,width:n-e,height:s-t}),Cb=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),XO=(e,t)=>fj(dj(ll(e),ll(t))),Ov=(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)},QO=e=>$n(e.width)&&$n(e.height)&&$n(e.x)&&$n(e.y),$n=e=>!isNaN(e)&&isFinite(e),Nt=Symbol.for("internals"),hj=["Enter"," ","Escape"],ZO=(e,t)=>{},JO=e=>"nativeEvent"in e;function Pv(e){var i,a;const t=JO(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 pj=e=>"clientX"in e,Os=(e,t)=>{var a,l;const n=pj(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)}},_u=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0},wl=({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:v,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:v}),w&&de.createElement("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:w,className:"react-flow__edge-interaction"}),i&&$n(n)&&$n(s)?de.createElement(KO,{x:n,y:s,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:p}):null);wl.displayName="BaseEdge";function Ua(e,t,n){return n===void 0?n:s=>{const i=t().edges.find(a=>a.id===e);i&&n(s,{...i})}}function mj({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 gj({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 No;(function(e){e.Strict="strict",e.Loose="loose"})(No||(No={}));var bo;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(bo||(bo={}));var cl;(function(e){e.Partial="partial",e.Full="full"})(cl||(cl={}));var Is;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Is||(Is={}));var Su;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Su||(Su={}));var $e;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})($e||($e={}));function jb({pos:e,x1:t,y1:n,x2:s,y2:i}){return e===$e.Left||e===$e.Right?[.5*(t+s),n]:[t,.5*(n+i)]}function yj({sourceX:e,sourceY:t,sourcePosition:n=$e.Bottom,targetX:s,targetY:i,targetPosition:a=$e.Top}){const[l,u]=jb({pos:n,x1:e,y1:t,x2:s,y2:i}),[h,p]=jb({pos:a,x1:s,y1:i,x2:e,y2:t}),[f,g,v,w]=gj({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,v,w]}const yw=_.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,sourcePosition:i=$e.Bottom,targetPosition:a=$e.Top,label:l,labelStyle:u,labelShowBg:h,labelBgStyle:p,labelBgPadding:f,labelBgBorderRadius:g,style:v,markerEnd:w,markerStart:N,interactionWidth:b})=>{const[k,S,E]=yj({sourceX:e,sourceY:t,sourcePosition:i,targetX:n,targetY:s,targetPosition:a});return de.createElement(wl,{path:k,labelX:S,labelY:E,label:l,labelStyle:u,labelShowBg:h,labelBgStyle:p,labelBgPadding:f,labelBgBorderRadius:g,style:v,markerEnd:w,markerStart:N,interactionWidth:b})});yw.displayName="SimpleBezierEdge";const Tb={[$e.Left]:{x:-1,y:0},[$e.Right]:{x:1,y:0},[$e.Top]:{x:0,y:-1},[$e.Bottom]:{x:0,y:1}},eP=({source:e,sourcePosition:t=$e.Bottom,target:n})=>t===$e.Left||t===$e.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},Rb=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function tP({source:e,sourcePosition:t=$e.Bottom,target:n,targetPosition:s=$e.Top,center:i,offset:a}){const l=Tb[t],u=Tb[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=eP({source:h,sourcePosition:t,target:p}),g=f.x!==0?"x":"y",v=f[g];let w=[],N,b;const k={x:0,y:0},S={x:0,y:0},[E,C,j,I]=mj({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??C;const P=[{x:N,y:h.y},{x:N,y:p.y}],z=[{x:h.x,y:b},{x:p.x,y:b}];l[g]===v?w=g==="x"?P:z:w=g==="x"?z:P}else{const P=[{x:h.x,y:p.y}],z=[{x:p.x,y:h.y}];if(g==="x"?w=l.x===v?z:P:w=l.y===v?P:z,t===s){const Y=Math.abs(e[g]-n[g]);if(Y<=a){const R=Math.min(a-1,a-Y);l[g]===v?k[g]=(h[g]>e[g]?-1:1)*R:S[g]=(p[g]>n[g]?-1:1)*R}}if(t!==s){const Y=g==="x"?"y":"x",R=l[g]===u[Y],Q=h[Y]>p[Y],W=h[Y]<p[Y];(l[g]===1&&(!R&&Q||R&&W)||l[g]!==1&&(!R&&W||R&&Q))&&(w=g==="x"?P:z)}const M={x:h.x+k.x,y:h.y+k.y},A={x:p.x+S.x,y:p.y+S.y},q=Math.max(Math.abs(M.x-w[0].x),Math.abs(A.x-w[0].x)),H=Math.max(Math.abs(M.y-w[0].y),Math.abs(A.y-w[0].y));q>=H?(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+k.x,y:h.y+k.y},...w,{x:p.x+S.x,y:p.y+S.y},n],N,b,j,I]}function nP(e,t,n,s){const i=Math.min(Rb(e,t)/2,Rb(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 $v({sourceX:e,sourceY:t,sourcePosition:n=$e.Bottom,targetX:s,targetY:i,targetPosition:a=$e.Top,borderRadius:l=5,centerX:u,centerY:h,offset:p=20}){const[f,g,v,w,N]=tP({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,S,E)=>{let C="";return E>0&&E<f.length-1?C=nP(f[E-1],S,f[E+1],l):C=`${E===0?"M":"L"}${S.x} ${S.y}`,k+=C,k},""),g,v,w,N]}const qu=_.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=$e.Bottom,targetPosition:v=$e.Top,markerEnd:w,markerStart:N,pathOptions:b,interactionWidth:k})=>{const[S,E,C]=$v({sourceX:e,sourceY:t,sourcePosition:g,targetX:n,targetY:s,targetPosition:v,borderRadius:b==null?void 0:b.borderRadius,offset:b==null?void 0:b.offset});return de.createElement(wl,{path:S,labelX:E,labelY:C,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:p,style:f,markerEnd:w,markerStart:N,interactionWidth:k})});qu.displayName="SmoothStepEdge";const vw=_.memo(e=>{var t;return de.createElement(qu,{...e,pathOptions:_.useMemo(()=>{var n;return{borderRadius:0,offset:(n=e.pathOptions)==null?void 0:n.offset}},[(t=e.pathOptions)==null?void 0:t.offset])})});vw.displayName="StepEdge";function rP({sourceX:e,sourceY:t,targetX:n,targetY:s}){const[i,a,l,u]=mj({sourceX:e,sourceY:t,targetX:n,targetY:s});return[`M ${e},${t}L ${n},${s}`,i,a,l,u]}const ww=_.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:v,interactionWidth:w})=>{const[N,b,k]=rP({sourceX:e,sourceY:t,targetX:n,targetY:s});return de.createElement(wl,{path:N,labelX:b,labelY:k,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:p,style:f,markerEnd:g,markerStart:v,interactionWidth:w})});ww.displayName="StraightEdge";function Qc(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Ab({pos:e,x1:t,y1:n,x2:s,y2:i,c:a}){switch(e){case $e.Left:return[t-Qc(t-s,a),n];case $e.Right:return[t+Qc(s-t,a),n];case $e.Top:return[t,n-Qc(n-i,a)];case $e.Bottom:return[t,n+Qc(i-n,a)]}}function vj({sourceX:e,sourceY:t,sourcePosition:n=$e.Bottom,targetX:s,targetY:i,targetPosition:a=$e.Top,curvature:l=.25}){const[u,h]=Ab({pos:n,x1:e,y1:t,x2:s,y2:i,c:l}),[p,f]=Ab({pos:a,x1:s,y1:i,x2:e,y2:t,c:l}),[g,v,w,N]=gj({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,v,w,N]}const Nu=_.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,sourcePosition:i=$e.Bottom,targetPosition:a=$e.Top,label:l,labelStyle:u,labelShowBg:h,labelBgStyle:p,labelBgPadding:f,labelBgBorderRadius:g,style:v,markerEnd:w,markerStart:N,pathOptions:b,interactionWidth:k})=>{const[S,E,C]=vj({sourceX:e,sourceY:t,sourcePosition:i,targetX:n,targetY:s,targetPosition:a,curvature:b==null?void 0:b.curvature});return de.createElement(wl,{path:S,labelX:E,labelY:C,label:l,labelStyle:u,labelShowBg:h,labelBgStyle:p,labelBgPadding:f,labelBgBorderRadius:g,style:v,markerEnd:w,markerStart:N,interactionWidth:k})});Nu.displayName="BezierEdge";const xw=_.createContext(null),sP=xw.Provider;xw.Consumer;const oP=()=>_.useContext(xw),iP=e=>"id"in e&&"source"in e&&"target"in e,aP=({source:e,sourceHandle:t,target:n,targetHandle:s})=>`reactflow__edge-${e}${t||""}-${n}${s||""}`,Lv=(e,t)=>typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(s=>`${s}=${e[s]}`).join("&")}`,lP=(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)),cP=(e,t)=>{if(!e.source||!e.target)return t;let n;return iP(e)?n={...e}:n={...e,id:aP(e)},lP(n,t)?t:t.concat(n)},qv=({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},wj=({x:e,y:t},[n,s,i])=>({x:e*i+n,y:t*i+s}),_o=(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}},Du=(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}=_o(i,t).positionAbsolute;return dj(s,ll({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 fj(n)},xj=(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:v,selectable:w=!0,hidden:N=!1}=f;if(l&&!w||N)return!1;const{positionAbsolute:b}=_o(f,u),k={x:b.x,y:b.y,width:g||0,height:v||0},S=Ov(h,k),E=typeof g>"u"||typeof v>"u"||g===null||v===null,C=a&&S>0,j=(g||0)*(v||0);(E||C||S>=j||f.dragging)&&p.push(f)}),p},bj=(e,t)=>{const n=e.map(s=>s.id);return t.filter(s=>n.includes(s.source)||n.includes(s.target))},kj=(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=Wi(h,s,i),f=e.x+e.width/2,g=e.y+e.height/2,v=t/2-f*p,w=n/2-g*p;return{x:v,y:w,zoom:p}},yo=(e,t=0)=>e.transition().duration(t);function Mb(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 uP(e,t,n,s,i,a){const{x:l,y:u}=Os(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=bw(void 0,p),k=p.getAttribute("data-handleid"),S=a({nodeId:N,id:k,type:b});if(S){const E=i.find(C=>C.nodeId===N&&C.type===b&&C.id===k);return{handle:{id:k,type:b,nodeId:N,x:(E==null?void 0:E.x)||n.x,y:(E==null?void 0:E.y)||n.y},validHandleResult:S}}}}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 k=a(N);b<=g&&(b<g?f=[{handle:N,validHandleResult:k}]:b===g&&f.push({handle:N,validHandleResult:k}),g=b)}}),!f.length)return{handle:null,validHandleResult:_j()};if(f.length===1)return f[0];const v=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":v?b.isValid:!0)||f[0]}const dP={source:null,target:null,sourceHandle:null,targetHandle:null},_j=()=>({handleDomNode:null,isValid:!1,connection:dP,endHandle:null});function Sj(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={..._j(),handleDomNode:h};if(h){const f=bw(void 0,h),g=h.getAttribute("data-nodeid"),v=h.getAttribute("data-handleid"),w=h.classList.contains("connectable"),N=h.classList.contains("connectableend"),b={source:u?g:n,sourceHandle:u?v:s,target:u?n:g,targetHandle:u?s:v};p.connection=b,w&&N&&(t===No.Strict?u&&f==="source"||!u&&f==="target":g!==n||v!==s)&&(p.endHandle={nodeId:g,handleId:v,type:f},p.isValid=a(b))}return p}function fP({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=Mb(a,l,"source",`${t}-${n}-${s}`),h=Mb(a,l,"target",`${t}-${n}-${s}`)),i.push(...u,...h)}return i},[])}function bw(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function Yf(e){e==null||e.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function hP(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}function Nj({event:e,handleId:t,nodeId:n,onConnect:s,isTarget:i,getState:a,setState:l,isValidConnection:u,edgeUpdaterType:h,onReconnectEnd:p}){const f=uj(e.target),{connectionMode:g,domNode:v,autoPanOnConnect:w,connectionRadius:N,onConnectStart:b,panBy:k,getNodes:S,cancelConnection:E}=a();let C=0,j;const{x:I,y:O}=Os(e),P=f==null?void 0:f.elementFromPoint(I,O),z=bw(h,P),M=v==null?void 0:v.getBoundingClientRect();if(!M||!z)return;let A,q=Os(e,M),H=!1,Y=null,R=!1,Q=null;const W=fP({nodes:S(),nodeId:n,handleId:t,handleType:z}),ne=()=>{if(!w)return;const[J,$]=cj(q,M);k({x:J,y:$}),C=requestAnimationFrame(ne)};l({connectionPosition:q,connectionStatus:null,connectionNodeId:n,connectionHandleId:t,connectionHandleType:z,connectionStartHandle:{nodeId:n,handleId:t,type:z},connectionEndHandle:null}),b==null||b(e,{nodeId:n,handleId:t,handleType:z});function X(J){const{transform:$}=a();q=Os(J,M);const{handle:V,validHandleResult:Z}=uP(J,f,qv(q,$,!1,[1,1]),N,W,F=>Sj(F,g,n,t,i?"target":"source",u,f));if(j=V,H||(ne(),H=!0),Q=Z.handleDomNode,Y=Z.connection,R=Z.isValid,l({connectionPosition:j&&R?wj({x:j.x,y:j.y},$):q,connectionStatus:hP(!!j,R),connectionEndHandle:Z.endHandle}),!j&&!R&&!Q)return Yf(A);Y.source!==Y.target&&Q&&(Yf(A),A=Q,Q.classList.add("connecting","react-flow__handle-connecting"),Q.classList.toggle("valid",R),Q.classList.toggle("react-flow__handle-valid",R))}function B(J){var $,V;(j||Q)&&Y&&R&&(s==null||s(Y)),(V=($=a()).onConnectEnd)==null||V.call($,J),h&&(p==null||p(J)),Yf(A),E(),cancelAnimationFrame(C),H=!1,R=!1,Y=null,Q=null,f.removeEventListener("mousemove",X),f.removeEventListener("mouseup",B),f.removeEventListener("touchmove",X),f.removeEventListener("touchend",B)}f.addEventListener("mousemove",X),f.addEventListener("mouseup",B),f.addEventListener("touchmove",X),f.addEventListener("touchend",B)}const Ib=()=>!0,pP=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),mP=(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}},Ej=_.forwardRef(({type:e="source",position:t=$e.Top,isValidConnection:n,isConnectable:s=!0,isConnectableStart:i=!0,isConnectableEnd:a=!0,id:l,onConnect:u,children:h,className:p,onMouseDown:f,onTouchStart:g,...v},w)=>{var M,A;const N=l||null,b=e==="target",k=At(),S=oP(),{connectOnClick:E,noPanClassName:C}=lt(pP,Lt),{connecting:j,clickConnecting:I}=lt(mP(S,N,e),Lt);S||(A=(M=k.getState()).onError)==null||A.call(M,"010",Jr.error010());const O=q=>{const{defaultEdgeOptions:H,onConnect:Y,hasDefaultEdges:R}=k.getState(),Q={...H,...q};if(R){const{edges:W,setEdges:ne}=k.getState();ne(cP(Q,W))}Y==null||Y(Q),u==null||u(Q)},P=q=>{if(!S)return;const H=pj(q);i&&(H&&q.button===0||!H)&&Nj({event:q,handleId:N,nodeId:S,onConnect:O,isTarget:b,getState:k.getState,setState:k.setState,isValidConnection:n||k.getState().isValidConnection||Ib}),H?f==null||f(q):g==null||g(q)},z=q=>{const{onClickConnectStart:H,onClickConnectEnd:Y,connectionClickStartHandle:R,connectionMode:Q,isValidConnection:W}=k.getState();if(!S||!R&&!i)return;if(!R){H==null||H(q,{nodeId:S,handleId:N,handleType:e}),k.setState({connectionClickStartHandle:{nodeId:S,type:e,handleId:N}});return}const ne=uj(q.target),X=n||W||Ib,{connection:B,isValid:J}=Sj({nodeId:S,id:N,type:e},Q,R.nodeId,R.handleId||null,R.type,X,ne);J&&O(B),Y==null||Y(q),k.setState({connectionClickStartHandle:null})};return de.createElement("div",{"data-handleid":N,"data-nodeid":S,"data-handlepos":t,"data-id":`${S}-${N}-${e}`,className:Ht(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",C,p,{source:!b,target:b,connectable:s,connectablestart:i,connectableend:a,connecting:I,connectionindicator:s&&(i&&!j||a&&j)}]),onMouseDown:P,onTouchStart:P,onClick:E?z:void 0,ref:w,...v},h)});Ej.displayName="Handle";var Hi=_.memo(Ej);const Cj=({data:e,isConnectable:t,targetPosition:n=$e.Top,sourcePosition:s=$e.Bottom})=>de.createElement(de.Fragment,null,de.createElement(Hi,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,de.createElement(Hi,{type:"source",position:s,isConnectable:t}));Cj.displayName="DefaultNode";var Dv=_.memo(Cj);const jj=({data:e,isConnectable:t,sourcePosition:n=$e.Bottom})=>de.createElement(de.Fragment,null,e==null?void 0:e.label,de.createElement(Hi,{type:"source",position:n,isConnectable:t}));jj.displayName="InputNode";var Tj=_.memo(jj);const Rj=({data:e,isConnectable:t,targetPosition:n=$e.Top})=>de.createElement(de.Fragment,null,de.createElement(Hi,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label);Rj.displayName="OutputNode";var Aj=_.memo(Rj);const kw=()=>null;kw.displayName="GroupNode";const gP=e=>({selectedNodes:e.getNodes().filter(t=>t.selected),selectedEdges:e.edges.filter(t=>t.selected).map(t=>({...t}))}),Zc=e=>e.id;function yP(e,t){return Lt(e.selectedNodes.map(Zc),t.selectedNodes.map(Zc))&&Lt(e.selectedEdges.map(Zc),t.selectedEdges.map(Zc))}const Mj=_.memo(({onSelectionChange:e})=>{const t=At(),{selectedNodes:n,selectedEdges:s}=lt(gP,yP);return _.useEffect(()=>{const i={nodes:n,edges:s};e==null||e(i),t.getState().onSelectionChange.forEach(a=>a(i))},[n,s,e]),null});Mj.displayName="SelectionListener";const vP=e=>!!e.onSelectionChange;function wP({onSelectionChange:e}){const t=lt(vP);return e||t?de.createElement(Mj,{onSelectionChange:e}):null}const xP=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 Ni(e,t){_.useEffect(()=>{typeof e<"u"&&t(e)},[e])}function Ke(e,t,n){_.useEffect(()=>{typeof t<"u"&&n({[e]:t})},[t])}const bP=({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:v,edgesUpdatable:w,elevateNodesOnSelect:N,minZoom:b,maxZoom:k,nodeExtent:S,onNodesChange:E,onEdgesChange:C,elementsSelectable:j,connectionMode:I,snapGrid:O,snapToGrid:P,translateExtent:z,connectOnClick:M,defaultEdgeOptions:A,fitView:q,fitViewOptions:H,onNodesDelete:Y,onEdgesDelete:R,onNodeDrag:Q,onNodeDragStart:W,onNodeDragStop:ne,onSelectionDrag:X,onSelectionDragStart:B,onSelectionDragStop:J,noPanClassName:$,nodeOrigin:V,rfId:Z,autoPanOnConnect:F,autoPanOnNodeDrag:L,onError:K,connectionRadius:se,isValidConnection:he,nodeDragThreshold:me})=>{const{setNodes:xe,setEdges:Ee,setDefaultNodesAndEdges:He,setMinZoom:Fe,setMaxZoom:Ie,setTranslateExtent:be,setNodeExtent:ue,reset:re}=lt(xP,Lt),pe=At();return _.useEffect(()=>{const Oe=s==null?void 0:s.map(rt=>({...rt,...A}));return He(n,Oe),()=>{re()}},[]),Ke("defaultEdgeOptions",A,pe.setState),Ke("connectionMode",I,pe.setState),Ke("onConnect",i,pe.setState),Ke("onConnectStart",a,pe.setState),Ke("onConnectEnd",l,pe.setState),Ke("onClickConnectStart",u,pe.setState),Ke("onClickConnectEnd",h,pe.setState),Ke("nodesDraggable",p,pe.setState),Ke("nodesConnectable",f,pe.setState),Ke("nodesFocusable",g,pe.setState),Ke("edgesFocusable",v,pe.setState),Ke("edgesUpdatable",w,pe.setState),Ke("elementsSelectable",j,pe.setState),Ke("elevateNodesOnSelect",N,pe.setState),Ke("snapToGrid",P,pe.setState),Ke("snapGrid",O,pe.setState),Ke("onNodesChange",E,pe.setState),Ke("onEdgesChange",C,pe.setState),Ke("connectOnClick",M,pe.setState),Ke("fitViewOnInit",q,pe.setState),Ke("fitViewOnInitOptions",H,pe.setState),Ke("onNodesDelete",Y,pe.setState),Ke("onEdgesDelete",R,pe.setState),Ke("onNodeDrag",Q,pe.setState),Ke("onNodeDragStart",W,pe.setState),Ke("onNodeDragStop",ne,pe.setState),Ke("onSelectionDrag",X,pe.setState),Ke("onSelectionDragStart",B,pe.setState),Ke("onSelectionDragStop",J,pe.setState),Ke("noPanClassName",$,pe.setState),Ke("nodeOrigin",V,pe.setState),Ke("rfId",Z,pe.setState),Ke("autoPanOnConnect",F,pe.setState),Ke("autoPanOnNodeDrag",L,pe.setState),Ke("onError",K,pe.setState),Ke("connectionRadius",se,pe.setState),Ke("isValidConnection",he,pe.setState),Ke("nodeDragThreshold",me,pe.setState),Ni(e,xe),Ni(t,Ee),Ni(b,Fe),Ni(k,Ie),Ni(z,be),Ni(S,ue),null},Ob={display:"none"},kP={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Ij="react-flow__node-desc",Oj="react-flow__edge-desc",_P="react-flow__aria-live",SP=e=>e.ariaLiveMessage;function NP({rfId:e}){const t=lt(SP);return de.createElement("div",{id:`${_P}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:kP},t)}function EP({rfId:e,disableKeyboardA11y:t}){return de.createElement(de.Fragment,null,de.createElement("div",{id:`${Ij}-${e}`,style:Ob},"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:`${Oj}-${e}`,style:Ob},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!t&&de.createElement(NP,{rfId:e}))}var ul=(e=null,t={actInsideInputWithModifier:!0})=>{const[n,s]=_.useState(!1),i=_.useRef(!1),a=_.useRef(new Set([])),[l,u]=_.useMemo(()=>{if(e!==null){const p=(Array.isArray(e)?e:[e]).filter(g=>typeof g=="string").map(g=>g.split("+")),f=p.reduce((g,v)=>g.concat(...v),[]);return[p,f]}return[[],[]]},[e]);return _.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)&&Pv(w))return!1;const b=$b(w.code,u);a.current.add(w[b]),Pb(l,a.current,!1)&&(w.preventDefault(),s(!0))},g=w=>{if((!i.current||i.current&&!t.actInsideInputWithModifier)&&Pv(w))return!1;const b=$b(w.code,u);Pb(l,a.current,!0)?(s(!1),a.current.clear()):a.current.delete(w[b]),w.key==="Meta"&&a.current.clear(),i.current=!1},v=()=>{a.current.clear(),s(!1)};return p==null||p.addEventListener("keydown",f),p==null||p.addEventListener("keyup",g),window.addEventListener("blur",v),()=>{p==null||p.removeEventListener("keydown",f),p==null||p.removeEventListener("keyup",g),window.removeEventListener("blur",v)}}},[e,s]),n};function Pb(e,t,n){return e.filter(s=>n||s.length===t.size).some(s=>s.every(i=>t.has(i)))}function $b(e,t){return t.includes(e)?"code":"key"}function Pj(e,t,n,s){var u,h;const i=e.parentNode||e.parentId;if(!i)return n;const a=t.get(i),l=_o(a,s);return Pj(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 $j(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}=Pj(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 Kf(e,t,n,s){const i=new Map,a={},l=s?1e3:0;return e.forEach(u=>{var w;const h=($n(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 v=(p==null?void 0:p.type)&&(p==null?void 0:p.type)!==u.type;Object.defineProperty(f,Nt,{enumerable:!1,value:{handleBounds:v||(w=p==null?void 0:p[Nt])==null?void 0:w.handleBounds,z:h}}),i.set(u.id,f)}),$j(i,n,a),i}function Lj(e,t={}){const{getNodes:n,width:s,height:i,minZoom:a,maxZoom:l,d3Zoom:u,d3Selection:h,fitViewOnInitDone:p,fitViewOnInit:f,nodeOrigin:g}=e(),v=t.initial&&!p&&f;if(u&&h&&(v||!t.initial)){const N=n().filter(k=>{var E;const S=t.includeHiddenNodes?k.width&&k.height:!k.hidden;return(E=t.nodes)!=null&&E.length?S&&t.nodes.some(C=>C.id===k.id):S}),b=N.every(k=>k.width&&k.height);if(N.length>0&&b){const k=Du(N,g),{x:S,y:E,zoom:C}=kj(k,s,i,t.minZoom??a,t.maxZoom??l,t.padding??.1),j=Qr.translate(S,E).scale(C);return typeof t.duration=="number"&&t.duration>0?u.transform(yo(h,t.duration),j):u.transform(h,j),!0}}return!1}function CP(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 jP(e,t){return t.map(n=>{const s=e.find(i=>i.id===n.id);return s&&(n.selected=s.selected),n})}function Jc({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:CP(e,i)}),l==null||l(e)),t!=null&&t.length&&(p&&s({edges:jP(t,a)}),u==null||u(t))}const Ei=()=>{},TP={zoomIn:Ei,zoomOut:Ei,zoomTo:Ei,getZoom:()=>1,setViewport:Ei,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:Ei,fitBounds:Ei,project:e=>e,screenToFlowPosition:e=>e,flowToScreenPosition:e=>e,viewportInitialized:!1},RP=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),AP=()=>{const e=At(),{d3Zoom:t,d3Selection:n}=lt(RP,Lt);return _.useMemo(()=>n&&t?{zoomIn:i=>t.scaleBy(yo(n,i==null?void 0:i.duration),1.2),zoomOut:i=>t.scaleBy(yo(n,i==null?void 0:i.duration),1/1.2),zoomTo:(i,a)=>t.scaleTo(yo(n,a==null?void 0:a.duration),i),getZoom:()=>e.getState().transform[2],setViewport:(i,a)=>{const[l,u,h]=e.getState().transform,p=Qr.translate(i.x??l,i.y??u).scale(i.zoom??h);t.transform(yo(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=>Lj(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,v=h/2-a*f,w=Qr.translate(g,v).scale(f);t.transform(yo(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:v}=kj(i,l,u,h,p,(a==null?void 0:a.padding)??.1),w=Qr.translate(f,g).scale(v);t.transform(yo(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"),qv(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 qv(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=wj(i,a);return{x:p.x+u,y:p.y+h}},viewportInitialized:!0}:TP,[t,n])};function xl(){const e=AP(),t=At(),n=_.useCallback(()=>t.getState().getNodes().map(b=>({...b})),[]),s=_.useCallback(b=>t.getState().nodeInternals.get(b),[]),i=_.useCallback(()=>{const{edges:b=[]}=t.getState();return b.map(k=>({...k}))},[]),a=_.useCallback(b=>{const{edges:k=[]}=t.getState();return k.find(S=>S.id===b)},[]),l=_.useCallback(b=>{const{getNodes:k,setNodes:S,hasDefaultNodes:E,onNodesChange:C}=t.getState(),j=k(),I=typeof b=="function"?b(j):b;if(E)S(I);else if(C){const O=I.length===0?j.map(P=>({type:"remove",id:P.id})):I.map(P=>({item:P,type:"reset"}));C(O)}},[]),u=_.useCallback(b=>{const{edges:k=[],setEdges:S,hasDefaultEdges:E,onEdgesChange:C}=t.getState(),j=typeof b=="function"?b(k):b;if(E)S(j);else if(C){const I=j.length===0?k.map(O=>({type:"remove",id:O.id})):j.map(O=>({item:O,type:"reset"}));C(I)}},[]),h=_.useCallback(b=>{const k=Array.isArray(b)?b:[b],{getNodes:S,setNodes:E,hasDefaultNodes:C,onNodesChange:j}=t.getState();if(C){const O=[...S(),...k];E(O)}else if(j){const I=k.map(O=>({item:O,type:"add"}));j(I)}},[]),p=_.useCallback(b=>{const k=Array.isArray(b)?b:[b],{edges:S=[],setEdges:E,hasDefaultEdges:C,onEdgesChange:j}=t.getState();if(C)E([...S,...k]);else if(j){const I=k.map(O=>({item:O,type:"add"}));j(I)}},[]),f=_.useCallback(()=>{const{getNodes:b,edges:k=[],transform:S}=t.getState(),[E,C,j]=S;return{nodes:b().map(I=>({...I})),edges:k.map(I=>({...I})),viewport:{x:E,y:C,zoom:j}}},[]),g=_.useCallback(({nodes:b,edges:k})=>{const{nodeInternals:S,getNodes:E,edges:C,hasDefaultNodes:j,hasDefaultEdges:I,onNodesDelete:O,onEdgesDelete:P,onNodesChange:z,onEdgesChange:M}=t.getState(),A=(b||[]).map(Q=>Q.id),q=(k||[]).map(Q=>Q.id),H=E().reduce((Q,W)=>{const ne=W.parentNode||W.parentId,X=!A.includes(W.id)&&ne&&Q.find(J=>J.id===ne);return(typeof W.deletable=="boolean"?W.deletable:!0)&&(A.includes(W.id)||X)&&Q.push(W),Q},[]),Y=C.filter(Q=>typeof Q.deletable=="boolean"?Q.deletable:!0),R=Y.filter(Q=>q.includes(Q.id));if(H||R){const Q=bj(H,Y),W=[...R,...Q],ne=W.reduce((X,B)=>(X.includes(B.id)||X.push(B.id),X),[]);if((I||j)&&(I&&t.setState({edges:C.filter(X=>!ne.includes(X.id))}),j&&(H.forEach(X=>{S.delete(X.id)}),t.setState({nodeInternals:new Map(S)}))),ne.length>0&&(P==null||P(W),M&&M(ne.map(X=>({id:X,type:"remove"})))),H.length>0&&(O==null||O(H),z)){const X=H.map(B=>({id:B.id,type:"remove"}));z(X)}}},[]),v=_.useCallback(b=>{const k=QO(b),S=k?null:t.getState().nodeInternals.get(b.id);return!k&&!S?[null,null,k]:[k?b:Cb(S),S,k]},[]),w=_.useCallback((b,k=!0,S)=>{const[E,C,j]=v(b);return E?(S||t.getState().getNodes()).filter(I=>{if(!j&&(I.id===C.id||!I.positionAbsolute))return!1;const O=Cb(I),P=Ov(O,E);return k&&P>0||P>=E.width*E.height}):[]},[]),N=_.useCallback((b,k,S=!0)=>{const[E]=v(b);if(!E)return!1;const C=Ov(E,k);return S&&C>0||C>=E.width*E.height},[]);return _.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 MP={actInsideInputWithModifier:!1};var IP=({deleteKeyCode:e,multiSelectionKeyCode:t})=>{const n=At(),{deleteElements:s}=xl(),i=ul(e,MP),a=ul(t);_.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]),_.useEffect(()=>{n.setState({multiSelectionActive:a})},[a])};function OP(e){const t=At();_.useEffect(()=>{let n;const s=()=>{var a,l;if(!e.current)return;const i=mw(e.current);(i.height===0||i.width===0)&&((l=(a=t.getState()).onError)==null||l.call(a,"004",Jr.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 _w={position:"absolute",width:"100%",height:"100%",top:0,left:0},PP=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,eu=e=>({x:e.x,y:e.y,zoom:e.k}),Ci=(e,t)=>e.target.closest(`.${t}`),Lb=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),qb=e=>{const t=e.ctrlKey&&_u()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t},$P=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),LP=({onMove:e,onMoveStart:t,onMoveEnd:n,onPaneContextMenu:s,zoomOnScroll:i=!0,zoomOnPinch:a=!0,panOnScroll:l=!1,panOnScrollSpeed:u=.5,panOnScrollMode:h=bo.Free,zoomOnDoubleClick:p=!0,elementsSelectable:f,panOnDrag:g=!0,defaultViewport:v,translateExtent:w,minZoom:N,maxZoom:b,zoomActivationKeyCode:k,preventScrolling:S=!0,children:E,noWheelClassName:C,noPanClassName:j})=>{const I=_.useRef(),O=At(),P=_.useRef(!1),z=_.useRef(!1),M=_.useRef(null),A=_.useRef({x:0,y:0,zoom:0}),{d3Zoom:q,d3Selection:H,d3ZoomHandler:Y,userSelectionActive:R}=lt($P,Lt),Q=ul(k),W=_.useRef(0),ne=_.useRef(!1),X=_.useRef();return OP(M),_.useEffect(()=>{if(M.current){const B=M.current.getBoundingClientRect(),J=aj().scaleExtent([N,b]).translateExtent(w),$=Pn(M.current).call(J),V=Qr.translate(v.x,v.y).scale(Wi(v.zoom,N,b)),Z=[[0,0],[B.width,B.height]],F=J.constrain()(V,Z,w);J.transform($,F),J.wheelDelta(qb),O.setState({d3Zoom:J,d3Selection:$,d3ZoomHandler:$.on("wheel.zoom"),transform:[F.x,F.y,F.k],domNode:M.current.closest(".react-flow")})}},[]),_.useEffect(()=>{H&&q&&(l&&!Q&&!R?H.on("wheel.zoom",B=>{if(Ci(B,C))return!1;B.preventDefault(),B.stopImmediatePropagation();const J=H.property("__zoom").k||1;if(B.ctrlKey&&a){const he=nr(B),me=qb(B),xe=J*Math.pow(2,me);q.scaleTo(H,xe,he,B);return}const $=B.deltaMode===1?20:1;let V=h===bo.Vertical?0:B.deltaX*$,Z=h===bo.Horizontal?0:B.deltaY*$;!_u()&&B.shiftKey&&h!==bo.Vertical&&(V=B.deltaY*$,Z=0),q.translateBy(H,-(V/J)*u,-(Z/J)*u,{internal:!0});const F=eu(H.property("__zoom")),{onViewportChangeStart:L,onViewportChange:K,onViewportChangeEnd:se}=O.getState();clearTimeout(X.current),ne.current||(ne.current=!0,t==null||t(B,F),L==null||L(F)),ne.current&&(e==null||e(B,F),K==null||K(F),X.current=setTimeout(()=>{n==null||n(B,F),se==null||se(F),ne.current=!1},150))},{passive:!1}):typeof Y<"u"&&H.on("wheel.zoom",function(B,J){if(!S&&B.type==="wheel"&&!B.ctrlKey||Ci(B,C))return null;B.preventDefault(),Y.call(this,B,J)},{passive:!1}))},[R,l,h,H,q,Y,Q,a,S,C,t,e,n]),_.useEffect(()=>{q&&q.on("start",B=>{var V,Z;if(!B.sourceEvent||B.sourceEvent.internal)return null;W.current=(V=B.sourceEvent)==null?void 0:V.button;const{onViewportChangeStart:J}=O.getState(),$=eu(B.transform);P.current=!0,A.current=$,((Z=B.sourceEvent)==null?void 0:Z.type)==="mousedown"&&O.setState({paneDragging:!0}),J==null||J($),t==null||t(B.sourceEvent,$)})},[q,t]),_.useEffect(()=>{q&&(R&&!P.current?q.on("zoom",null):R||q.on("zoom",B=>{var $;const{onViewportChange:J}=O.getState();if(O.setState({transform:[B.transform.x,B.transform.y,B.transform.k]}),z.current=!!(s&&Lb(g,W.current??0)),(e||J)&&!(($=B.sourceEvent)!=null&&$.internal)){const V=eu(B.transform);J==null||J(V),e==null||e(B.sourceEvent,V)}}))},[R,q,e,g,s]),_.useEffect(()=>{q&&q.on("end",B=>{if(!B.sourceEvent||B.sourceEvent.internal)return null;const{onViewportChangeEnd:J}=O.getState();if(P.current=!1,O.setState({paneDragging:!1}),s&&Lb(g,W.current??0)&&!z.current&&s(B.sourceEvent),z.current=!1,(n||J)&&PP(A.current,B.transform)){const $=eu(B.transform);A.current=$,clearTimeout(I.current),I.current=setTimeout(()=>{J==null||J($),n==null||n(B.sourceEvent,$)},l?150:0)}})},[q,l,g,n,s]),_.useEffect(()=>{q&&q.filter(B=>{const J=Q||i,$=a&&B.ctrlKey;if((g===!0||Array.isArray(g)&&g.includes(1))&&B.button===1&&B.type==="mousedown"&&(Ci(B,"react-flow__node")||Ci(B,"react-flow__edge")))return!0;if(!g&&!J&&!l&&!p&&!a||R||!p&&B.type==="dblclick"||Ci(B,C)&&B.type==="wheel"||Ci(B,j)&&(B.type!=="wheel"||l&&B.type==="wheel"&&!Q)||!a&&B.ctrlKey&&B.type==="wheel"||!J&&!l&&!$&&B.type==="wheel"||!g&&(B.type==="mousedown"||B.type==="touchstart")||Array.isArray(g)&&!g.includes(B.button)&&B.type==="mousedown")return!1;const V=Array.isArray(g)&&g.includes(B.button)||!B.button||B.button<=1;return(!B.ctrlKey||B.type==="wheel")&&V})},[R,q,i,a,l,p,g,f,Q]),de.createElement("div",{className:"react-flow__renderer",ref:M,style:_w},E)},qP=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function DP(){const{userSelectionActive:e,userSelectionRect:t}=lt(qP,Lt);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 Db(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 FP(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&&Db(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&&Db(s,l);break}case"remove":return s}return s.push(l),s},n)}function zP(e,t){return FP(e,t)}const Ms=(e,t)=>({id:e,type:"select",selected:t});function Ii(e,t){return e.reduce((n,s)=>{const i=t.includes(s.id);return!s.selected&&i?(s.selected=!0,n.push(Ms(s.id,!0))):s.selected&&!i&&(s.selected=!1,n.push(Ms(s.id,!1))),n},[])}const Xf=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},BP=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),qj=_.memo(({isSelecting:e,selectionMode:t=cl.Full,panOnDrag:n,onSelectionStart:s,onSelectionEnd:i,onPaneClick:a,onPaneContextMenu:l,onPaneScroll:u,onPaneMouseEnter:h,onPaneMouseMove:p,onPaneMouseLeave:f,children:g})=>{const v=_.useRef(null),w=At(),N=_.useRef(0),b=_.useRef(0),k=_.useRef(),{userSelectionActive:S,elementsSelectable:E,dragging:C}=lt(BP,Lt),j=()=>{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})},O=Y=>{if(Array.isArray(n)&&(n!=null&&n.includes(2))){Y.preventDefault();return}l==null||l(Y)},P=u?Y=>u(Y):void 0,z=Y=>{const{resetSelectedElements:R,domNode:Q}=w.getState();if(k.current=Q==null?void 0:Q.getBoundingClientRect(),!E||!e||Y.button!==0||Y.target!==v.current||!k.current)return;const{x:W,y:ne}=Os(Y,k.current);R(),w.setState({userSelectionRect:{width:0,height:0,startX:W,startY:ne,x:W,y:ne}}),s==null||s(Y)},M=Y=>{const{userSelectionRect:R,nodeInternals:Q,edges:W,transform:ne,onNodesChange:X,onEdgesChange:B,nodeOrigin:J,getNodes:$}=w.getState();if(!e||!k.current||!R)return;w.setState({userSelectionActive:!0,nodesSelectionActive:!1});const V=Os(Y,k.current),Z=R.startX??0,F=R.startY??0,L={...R,x:V.x<Z?V.x:Z,y:V.y<F?V.y:F,width:Math.abs(V.x-Z),height:Math.abs(V.y-F)},K=$(),se=xj(Q,L,ne,t===cl.Partial,!0,J),he=bj(se,W).map(xe=>xe.id),me=se.map(xe=>xe.id);if(N.current!==me.length){N.current=me.length;const xe=Ii(K,me);xe.length&&(X==null||X(xe))}if(b.current!==he.length){b.current=he.length;const xe=Ii(W,he);xe.length&&(B==null||B(xe))}w.setState({userSelectionRect:L})},A=Y=>{if(Y.button!==0)return;const{userSelectionRect:R}=w.getState();!S&&R&&Y.target===v.current&&(I==null||I(Y)),w.setState({nodesSelectionActive:N.current>0}),j(),i==null||i(Y)},q=Y=>{S&&(w.setState({nodesSelectionActive:N.current>0}),i==null||i(Y)),j()},H=E&&(e||S);return de.createElement("div",{className:Ht(["react-flow__pane",{dragging:C,selection:e}]),onClick:H?void 0:Xf(I,v),onContextMenu:Xf(O,v),onWheel:Xf(P,v),onMouseEnter:H?void 0:h,onMouseDown:H?z:void 0,onMouseMove:H?M:p,onMouseUp:H?A:void 0,onMouseLeave:H?q:f,ref:v,style:_w},g,de.createElement(DP,null))});qj.displayName="Pane";function Dj(e,t){const n=e.parentNode||e.parentId;if(!n)return!1;const s=t.get(n);return s?s.selected?!0:Dj(s,t):!1}function Fb(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 UP(e,t,n,s){return Array.from(e.values()).filter(i=>(i.selected||i.id===s)&&(!i.parentNode||i.parentId||!Dj(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 WP(e,t){return!t||t==="parent"?t:[t[0],[t[1][0]-(e.width||0),t[1][1]-(e.height||0)]]}function Fj(e,t,n,s,i=[0,0],a){const l=WP(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:v,y:w}=_o(g,i).positionAbsolute;u=g&&$n(v)&&$n(w)&&$n(g.width)&&$n(g.height)?[[v+e.width*i[0],w+e.height*i[1]],[v+g.width-e.width+e.width*i[0],w+g.height-e.height+e.height*i[1]]]:u}else a==null||a("005",Jr.error005()),u=l;else if(e.extent&&h&&e.extent!=="parent"){const g=n.get(h),{x:v,y:w}=_o(g,i).positionAbsolute;u=[[e.extent[0][0]+v,e.extent[0][1]+w],[e.extent[1][0]+v,e.extent[1][1]+w]]}let p={x:0,y:0};if(h){const g=n.get(h);p=_o(g,i).positionAbsolute}const f=u&&u!=="parent"?gw(t,u):t;return{position:{x:f.x-p.x,y:f.y-p.y},positionAbsolute:f}}function Qf({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 zb=(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,...mw(h)}})};function Wa(e,t,n){return n===void 0?n:s=>{const i=t().nodeInternals.get(e);i&&n(s,{...i})}}function Fv({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",Jr.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 HP(){const e=At();return _.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 Zf(e){return(t,n,s)=>e==null?void 0:e(t,s)}function zj({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:s,nodeId:i,isSelectable:a,selectNodesOnDrag:l}){const u=At(),[h,p]=_.useState(!1),f=_.useRef([]),g=_.useRef({x:null,y:null}),v=_.useRef(0),w=_.useRef(null),N=_.useRef({x:0,y:0}),b=_.useRef(null),k=_.useRef(!1),S=_.useRef(!1),E=_.useRef(!1),C=HP();return _.useEffect(()=>{if(e!=null&&e.current){const j=Pn(e.current),I=({x:z,y:M})=>{const{nodeInternals:A,onNodeDrag:q,onSelectionDrag:H,updateNodePositions:Y,nodeExtent:R,snapGrid:Q,snapToGrid:W,nodeOrigin:ne,onError:X}=u.getState();g.current={x:z,y:M};let B=!1,J={x:0,y:0,x2:0,y2:0};if(f.current.length>1&&R){const V=Du(f.current,ne);J=ll(V)}if(f.current=f.current.map(V=>{const Z={x:z-V.distance.x,y:M-V.distance.y};W&&(Z.x=Q[0]*Math.round(Z.x/Q[0]),Z.y=Q[1]*Math.round(Z.y/Q[1]));const F=[[R[0][0],R[0][1]],[R[1][0],R[1][1]]];f.current.length>1&&R&&!V.extent&&(F[0][0]=V.positionAbsolute.x-J.x+R[0][0],F[1][0]=V.positionAbsolute.x+(V.width??0)-J.x2+R[1][0],F[0][1]=V.positionAbsolute.y-J.y+R[0][1],F[1][1]=V.positionAbsolute.y+(V.height??0)-J.y2+R[1][1]);const L=Fj(V,Z,A,F,ne,X);return B=B||V.position.x!==L.position.x||V.position.y!==L.position.y,V.position=L.position,V.positionAbsolute=L.positionAbsolute,V}),!B)return;Y(f.current,!0,!0),p(!0);const $=i?q:Zf(H);if($&&b.current){const[V,Z]=Qf({nodeId:i,dragItems:f.current,nodeInternals:A});$(b.current,V,Z)}},O=()=>{if(!w.current)return;const[z,M]=cj(N.current,w.current);if(z!==0||M!==0){const{transform:A,panBy:q}=u.getState();g.current.x=(g.current.x??0)-z/A[2],g.current.y=(g.current.y??0)-M/A[2],q({x:z,y:M})&&I(g.current)}v.current=requestAnimationFrame(O)},P=z=>{var ne;const{nodeInternals:M,multiSelectionActive:A,nodesDraggable:q,unselectNodesAndEdges:H,onNodeDragStart:Y,onSelectionDragStart:R}=u.getState();S.current=!0;const Q=i?Y:Zf(R);(!l||!a)&&!A&&i&&((ne=M.get(i))!=null&&ne.selected||H()),i&&a&&l&&Fv({id:i,store:u,nodeRef:e});const W=C(z);if(g.current=W,f.current=UP(M,q,W,i),Q&&f.current){const[X,B]=Qf({nodeId:i,dragItems:f.current,nodeInternals:M});Q(z.sourceEvent,X,B)}};if(t)j.on(".drag",null);else{const z=tI().on("start",M=>{const{domNode:A,nodeDragThreshold:q}=u.getState();q===0&&P(M),E.current=!1;const H=C(M);g.current=H,w.current=(A==null?void 0:A.getBoundingClientRect())||null,N.current=Os(M.sourceEvent,w.current)}).on("drag",M=>{var Y,R;const A=C(M),{autoPanOnNodeDrag:q,nodeDragThreshold:H}=u.getState();if(M.sourceEvent.type==="touchmove"&&M.sourceEvent.touches.length>1&&(E.current=!0),!E.current){if(!k.current&&S.current&&q&&(k.current=!0,O()),!S.current){const Q=A.xSnapped-(((Y=g==null?void 0:g.current)==null?void 0:Y.x)??0),W=A.ySnapped-(((R=g==null?void 0:g.current)==null?void 0:R.y)??0);Math.sqrt(Q*Q+W*W)>H&&P(M)}(g.current.x!==A.xSnapped||g.current.y!==A.ySnapped)&&f.current&&S.current&&(b.current=M.sourceEvent,N.current=Os(M.sourceEvent,w.current),I(A))}}).on("end",M=>{if(!(!S.current||E.current)&&(p(!1),k.current=!1,S.current=!1,cancelAnimationFrame(v.current),f.current)){const{updateNodePositions:A,nodeInternals:q,onNodeDragStop:H,onSelectionDragStop:Y}=u.getState(),R=i?H:Zf(Y);if(A(f.current,!1,!1),R){const[Q,W]=Qf({nodeId:i,dragItems:f.current,nodeInternals:q});R(M.sourceEvent,Q,W)}}}).filter(M=>{const A=M.target;return!M.button&&(!n||!Fb(A,`.${n}`,e))&&(!s||Fb(A,s,e))});return j.call(z),()=>{j.on(".drag",null)}}}},[e,t,n,s,a,u,i,l,C]),h}function Bj(){const e=At();return _.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")),v=u?h[0]:5,w=u?h[1]:5,N=n.isShiftPressed?4:1,b=n.x*v*N,k=n.y*w*N,S=g.map(E=>{if(E.positionAbsolute){const C={x:E.positionAbsolute.x+b,y:E.positionAbsolute.y+k};u&&(C.x=h[0]*Math.round(C.x/h[0]),C.y=h[1]*Math.round(C.y/h[1]));const{positionAbsolute:j,position:I}=Fj(E,C,s,i,void 0,p);E.position=I,E.positionAbsolute=j}return E});a(S,!0,!1)},[])}const qi={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var Ha=e=>{const t=({id:n,type:s,data:i,xPos:a,yPos:l,xPosOrigin:u,yPosOrigin:h,selected:p,onClick:f,onMouseEnter:g,onMouseMove:v,onMouseLeave:w,onContextMenu:N,onDoubleClick:b,style:k,className:S,isDraggable:E,isSelectable:C,isConnectable:j,isFocusable:I,selectNodesOnDrag:O,sourcePosition:P,targetPosition:z,hidden:M,resizeObserver:A,dragHandle:q,zIndex:H,isParent:Y,noDragClassName:R,noPanClassName:Q,initialized:W,disableKeyboardA11y:ne,ariaLabel:X,rfId:B,hasHandleBounds:J})=>{const $=At(),V=_.useRef(null),Z=_.useRef(null),F=_.useRef(P),L=_.useRef(z),K=_.useRef(s),se=C||E||f||g||v||w,he=Bj(),me=Wa(n,$.getState,g),xe=Wa(n,$.getState,v),Ee=Wa(n,$.getState,w),He=Wa(n,$.getState,N),Fe=Wa(n,$.getState,b),Ie=re=>{const{nodeDragThreshold:pe}=$.getState();if(C&&(!O||!E||pe>0)&&Fv({id:n,store:$,nodeRef:V}),f){const Oe=$.getState().nodeInternals.get(n);Oe&&f(re,{...Oe})}},be=re=>{if(!Pv(re)&&!ne)if(hj.includes(re.key)&&C){const pe=re.key==="Escape";Fv({id:n,store:$,unselect:pe,nodeRef:V})}else E&&p&&Object.prototype.hasOwnProperty.call(qi,re.key)&&($.setState({ariaLiveMessage:`Moved selected node ${re.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~a}, y: ${~~l}`}),he({x:qi[re.key].x,y:qi[re.key].y,isShiftPressed:re.shiftKey}))};_.useEffect(()=>()=>{Z.current&&(A==null||A.unobserve(Z.current),Z.current=null)},[]),_.useEffect(()=>{if(V.current&&!M){const re=V.current;(!W||!J||Z.current!==re)&&(Z.current&&(A==null||A.unobserve(Z.current)),A==null||A.observe(re),Z.current=re)}},[M,W,J]),_.useEffect(()=>{const re=K.current!==s,pe=F.current!==P,Oe=L.current!==z;V.current&&(re||pe||Oe)&&(re&&(K.current=s),pe&&(F.current=P),Oe&&(L.current=z),$.getState().updateNodeDimensions([{id:n,nodeElement:V.current,forceUpdate:!0}]))},[n,s,P,z]);const ue=zj({nodeRef:V,disabled:M||!E,noDragClassName:R,handleSelector:q,nodeId:n,isSelectable:C,selectNodesOnDrag:O});return M?null:de.createElement("div",{className:Ht(["react-flow__node",`react-flow__node-${s}`,{[Q]:E},S,{selected:p,selectable:C,parent:Y,dragging:ue}]),ref:V,style:{zIndex:H,transform:`translate(${u}px,${h}px)`,pointerEvents:se?"all":"none",visibility:W?"visible":"hidden",...k},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:me,onMouseMove:xe,onMouseLeave:Ee,onContextMenu:He,onClick:Ie,onDoubleClick:Fe,onKeyDown:I?be:void 0,tabIndex:I?0:void 0,role:I?"button":void 0,"aria-describedby":ne?void 0:`${Ij}-${B}`,"aria-label":X},de.createElement(sP,{value:n},de.createElement(e,{id:n,data:i,type:s,xPos:a,yPos:l,selected:p,isConnectable:j,sourcePosition:P,targetPosition:z,dragging:ue,dragHandle:q,zIndex:H})))};return t.displayName="NodeWrapper",_.memo(t)};const GP=e=>{const t=e.getNodes().filter(n=>n.selected);return{...Du(t,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};function VP({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const s=At(),{width:i,height:a,x:l,y:u,transformString:h,userSelectionActive:p}=lt(GP,Lt),f=Bj(),g=_.useRef(null);if(_.useEffect(()=>{var N;n||(N=g.current)==null||N.focus({preventScroll:!0})},[n]),zj({nodeRef:g}),p||!i||!a)return null;const v=e?N=>{const b=s.getState().getNodes().filter(k=>k.selected);e(N,b)}:void 0,w=N=>{Object.prototype.hasOwnProperty.call(qi,N.key)&&f({x:qi[N.key].x,y:qi[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:v,tabIndex:n?void 0:-1,onKeyDown:n?void 0:w,style:{width:i,height:a,top:u,left:l}}))}var YP=_.memo(VP);const KP=e=>e.nodesSelectionActive,Uj=({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:v,selectionMode:w,onSelectionStart:N,onSelectionEnd:b,multiSelectionKeyCode:k,panActivationKeyCode:S,zoomActivationKeyCode:E,elementsSelectable:C,zoomOnScroll:j,zoomOnPinch:I,panOnScroll:O,panOnScrollSpeed:P,panOnScrollMode:z,zoomOnDoubleClick:M,panOnDrag:A,defaultViewport:q,translateExtent:H,minZoom:Y,maxZoom:R,preventScrolling:Q,onSelectionContextMenu:W,noWheelClassName:ne,noPanClassName:X,disableKeyboardA11y:B})=>{const J=lt(KP),$=ul(g),V=ul(S),Z=V||A,F=V||O,L=$||v&&Z!==!0;return IP({deleteKeyCode:u,multiSelectionKeyCode:k}),de.createElement(LP,{onMove:h,onMoveStart:p,onMoveEnd:f,onPaneContextMenu:a,elementsSelectable:C,zoomOnScroll:j,zoomOnPinch:I,panOnScroll:F,panOnScrollSpeed:P,panOnScrollMode:z,zoomOnDoubleClick:M,panOnDrag:!$&&Z,defaultViewport:q,translateExtent:H,minZoom:Y,maxZoom:R,zoomActivationKeyCode:E,preventScrolling:Q,noWheelClassName:ne,noPanClassName:X},de.createElement(qj,{onSelectionStart:N,onSelectionEnd:b,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:s,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:l,panOnDrag:Z,isSelecting:!!L,selectionMode:w},e,J&&de.createElement(YP,{onSelectionContextMenu:W,noPanClassName:X,disableKeyboardA11y:B})))};Uj.displayName="FlowRenderer";var XP=_.memo(Uj);function QP(e){return lt(_.useCallback(n=>e?xj(n.nodeInternals,{x:0,y:0,width:n.width,height:n.height},n.transform,!0):n.getNodes(),[e]))}function ZP(e){const t={input:Ha(e.input||Tj),default:Ha(e.default||Dv),output:Ha(e.output||Aj),group:Ha(e.group||kw)},n={},s=Object.keys(e).filter(i=>!["input","default","output","group"].includes(i)).reduce((i,a)=>(i[a]=Ha(e[a]||Dv),i),n);return{...t,...s}}const JP=({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]},e$=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),Wj=e=>{const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:s,elementsSelectable:i,updateNodeDimensions:a,onError:l}=lt(e$,Lt),u=QP(e.onlyRenderVisibleElements),h=_.useRef(),p=_.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const f=new ResizeObserver(g=>{const v=g.map(w=>({id:w.target.getAttribute("data-id"),nodeElement:w.target,forceUpdate:!0}));a(v)});return h.current=f,f},[]);return _.useEffect(()=>()=>{var f;(f=h==null?void 0:h.current)==null||f.disconnect()},[]),de.createElement("div",{className:"react-flow__nodes",style:_w},u.map(f=>{var I,O,P;let g=f.type||"default";e.nodeTypes[g]||(l==null||l("003",Jr.error003(g)),g="default");const v=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"),k=!!(f.focusable||s&&typeof f.focusable>"u"),S=e.nodeExtent?gw(f.positionAbsolute,e.nodeExtent):f.positionAbsolute,E=(S==null?void 0:S.x)??0,C=(S==null?void 0:S.y)??0,j=JP({x:E,y:C,width:f.width??0,height:f.height??0,origin:e.nodeOrigin});return de.createElement(v,{key:f.id,id:f.id,className:f.className,style:f.style,type:g,data:f.data,sourcePosition:f.sourcePosition||$e.Bottom,targetPosition:f.targetPosition||$e.Top,hidden:f.hidden,xPos:E,yPos:C,xPosOrigin:j.x,yPosOrigin:j.y,selectNodesOnDrag:e.selectNodesOnDrag,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,selected:!!f.selected,isDraggable:w,isSelectable:N,isConnectable:b,isFocusable:k,resizeObserver:p,dragHandle:f.dragHandle,zIndex:((I=f[Nt])==null?void 0:I.z)??0,isParent:!!((O=f[Nt])!=null&&O.isParent),noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!f.width&&!!f.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:f.ariaLabel,hasHandleBounds:!!((P=f[Nt])!=null&&P.handleBounds)})}))};Wj.displayName="NodeRenderer";var t$=_.memo(Wj);const n$=(e,t,n)=>n===$e.Left?e-t:n===$e.Right?e+t:e,r$=(e,t,n)=>n===$e.Top?e-t:n===$e.Bottom?e+t:e,Bb="react-flow__edgeupdater",Ub=({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([Bb,`${Bb}-${u}`]),cx:n$(t,s,e),cy:r$(n,s,e),r:s,stroke:"transparent",fill:"transparent"}),s$=()=>!0;var ji=e=>{const t=({id:n,className:s,type:i,data:a,onClick:l,onEdgeDoubleClick:u,selected:h,animated:p,label:f,labelStyle:g,labelShowBg:v,labelBgStyle:w,labelBgPadding:N,labelBgBorderRadius:b,style:k,source:S,target:E,sourceX:C,sourceY:j,targetX:I,targetY:O,sourcePosition:P,targetPosition:z,elementsSelectable:M,hidden:A,sourceHandleId:q,targetHandleId:H,onContextMenu:Y,onMouseEnter:R,onMouseMove:Q,onMouseLeave:W,reconnectRadius:ne,onReconnect:X,onReconnectStart:B,onReconnectEnd:J,markerEnd:$,markerStart:V,rfId:Z,ariaLabel:F,isFocusable:L,isReconnectable:K,pathOptions:se,interactionWidth:he,disableKeyboardA11y:me})=>{const xe=_.useRef(null),[Ee,He]=_.useState(!1),[Fe,Ie]=_.useState(!1),be=At(),ue=_.useMemo(()=>`url('#${Lv(V,Z)}')`,[V,Z]),re=_.useMemo(()=>`url('#${Lv($,Z)}')`,[$,Z]);if(A)return null;const pe=Le=>{var Te;const{edges:ze,addSelectedEdges:Ce,unselectNodesAndEdges:Ve,multiSelectionActive:Et}=be.getState(),st=ze.find(vt=>vt.id===n);st&&(M&&(be.setState({nodesSelectionActive:!1}),st.selected&&Et?(Ve({nodes:[],edges:[st]}),(Te=xe.current)==null||Te.blur()):Ce([n])),l&&l(Le,st))},Oe=Ua(n,be.getState,u),rt=Ua(n,be.getState,Y),ot=Ua(n,be.getState,R),Xe=Ua(n,be.getState,Q),Pe=Ua(n,be.getState,W),Be=(Le,ze)=>{if(Le.button!==0)return;const{edges:Ce,isValidConnection:Ve}=be.getState(),Et=ze?E:S,st=(ze?H:q)||null,Te=ze?"target":"source",vt=Ve||s$,ut=ze,_t=Ce.find(Sn=>Sn.id===n);Ie(!0),B==null||B(Le,_t,Te);const _n=Sn=>{Ie(!1),J==null||J(Sn,_t,Te)};Nj({event:Le,handleId:st,nodeId:Et,onConnect:Sn=>X==null?void 0:X(_t,Sn),isTarget:ut,getState:be.getState,setState:be.setState,isValidConnection:vt,edgeUpdaterType:Te,onReconnectEnd:_n})},Ge=Le=>Be(Le,!0),it=Le=>Be(Le,!1),ke=()=>He(!0),ct=()=>He(!1),It=!M&&!l,ae=Le=>{var ze;if(!me&&hj.includes(Le.key)&&M){const{unselectNodesAndEdges:Ce,addSelectedEdges:Ve,edges:Et}=be.getState();Le.key==="Escape"?((ze=xe.current)==null||ze.blur(),Ce({edges:[Et.find(Te=>Te.id===n)]})):Ve([n])}};return de.createElement("g",{className:Ht(["react-flow__edge",`react-flow__edge-${i}`,s,{selected:h,animated:p,inactive:It,updating:Ee}]),onClick:pe,onDoubleClick:Oe,onContextMenu:rt,onMouseEnter:ot,onMouseMove:Xe,onMouseLeave:Pe,onKeyDown:L?ae:void 0,tabIndex:L?0:void 0,role:L?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":F===null?void 0:F||`Edge from ${S} to ${E}`,"aria-describedby":L?`${Oj}-${Z}`:void 0,ref:xe},!Fe&&de.createElement(e,{id:n,source:S,target:E,selected:h,animated:p,label:f,labelStyle:g,labelShowBg:v,labelBgStyle:w,labelBgPadding:N,labelBgBorderRadius:b,data:a,style:k,sourceX:C,sourceY:j,targetX:I,targetY:O,sourcePosition:P,targetPosition:z,sourceHandleId:q,targetHandleId:H,markerStart:ue,markerEnd:re,pathOptions:se,interactionWidth:he}),K&&de.createElement(de.Fragment,null,(K==="source"||K===!0)&&de.createElement(Ub,{position:P,centerX:C,centerY:j,radius:ne,onMouseDown:Ge,onMouseEnter:ke,onMouseOut:ct,type:"source"}),(K==="target"||K===!0)&&de.createElement(Ub,{position:z,centerX:I,centerY:O,radius:ne,onMouseDown:it,onMouseEnter:ke,onMouseOut:ct,type:"target"})))};return t.displayName="EdgeWrapper",_.memo(t)};function o$(e){const t={default:ji(e.default||Nu),straight:ji(e.bezier||ww),step:ji(e.step||vw),smoothstep:ji(e.step||qu),simplebezier:ji(e.simplebezier||yw)},n={},s=Object.keys(e).filter(i=>!["default","bezier"].includes(i)).reduce((i,a)=>(i[a]=ji(e[a]||Nu),i),n);return{...t,...s}}function Wb(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 $e.Top:return{x:s+a/2,y:i};case $e.Right:return{x:s+a,y:i+l/2};case $e.Bottom:return{x:s+a/2,y:i+l};case $e.Left:return{x:s,y:i+l/2}}}function Hb(e,t){return e?e.length===1||!t?e[0]:t&&e.find(n=>n.id===t)||null:null}const i$=(e,t,n,s,i,a)=>{const l=Wb(n,e,t),u=Wb(a,s,i);return{sourceX:l.x,sourceY:l.y,targetX:u.x,targetY:u.y}};function a$({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=ll({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)),v=Math.max(0,Math.min(f.y2,p.y2)-Math.max(f.y,p.y));return Math.ceil(g*v)>0}function Gb(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 l$=[{level:0,isMaxLevel:!0,edges:[]}];function c$(e,t,n=!1){let s=-1;const i=e.reduce((l,u)=>{var f,g;const h=$n(u.zIndex);let p=h?u.zIndex:0;if(n){const v=t.get(u.target),w=t.get(u.source),N=u.selected||(v==null?void 0:v.selected)||(w==null?void 0:w.selected),b=Math.max(((f=w==null?void 0:w[Nt])==null?void 0:f.z)||0,((g=v==null?void 0:v[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?l$:a}function u$(e,t,n){const s=lt(_.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)&&a$({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 c$(s,t,n)}const d$=({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"}),f$=({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"}),Vb={[Su.Arrow]:d$,[Su.ArrowClosed]:f$};function h$(e){const t=At();return _.useMemo(()=>{var i,a;return Object.prototype.hasOwnProperty.call(Vb,e)?Vb[e]:((a=(i=t.getState()).onError)==null||a.call(i,"009",Jr.error009(e)),null)},[e])}const p$=({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=h$(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},m$=({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=Lv(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))},Hj=({defaultColor:e,rfId:t})=>{const n=lt(_.useCallback(m$({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(p$,{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})))};Hj.displayName="MarkerDefinitions";var g$=_.memo(Hj);const y$=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}),Gj=({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:v,onReconnectStart:w,onReconnectEnd:N,reconnectRadius:b,children:k,disableKeyboardA11y:S})=>{const{edgesFocusable:E,edgesUpdatable:C,elementsSelectable:j,width:I,height:O,connectionMode:P,nodeInternals:z,onError:M}=lt(y$,Lt),A=u$(t,z,n);return I?de.createElement(de.Fragment,null,A.map(({level:q,edges:H,isMaxLevel:Y})=>de.createElement("svg",{key:q,style:{zIndex:q},width:I,height:O,className:"react-flow__edges react-flow__container"},Y&&de.createElement(g$,{defaultColor:e,rfId:s}),de.createElement("g",null,H.map(R=>{const[Q,W,ne]=Gb(z.get(R.source)),[X,B,J]=Gb(z.get(R.target));if(!ne||!J)return null;let $=R.type||"default";i[$]||(M==null||M("011",Jr.error011($)),$="default");const V=i[$]||i.default,Z=P===No.Strict?B.target:(B.target??[]).concat(B.source??[]),F=Hb(W.source,R.sourceHandle),L=Hb(Z,R.targetHandle),K=(F==null?void 0:F.position)||$e.Bottom,se=(L==null?void 0:L.position)||$e.Top,he=!!(R.focusable||E&&typeof R.focusable>"u"),me=R.reconnectable||R.updatable,xe=typeof v<"u"&&(me||C&&typeof me>"u");if(!F||!L)return M==null||M("008",Jr.error008(F,R)),null;const{sourceX:Ee,sourceY:He,targetX:Fe,targetY:Ie}=i$(Q,F,K,X,L,se);return de.createElement(V,{key:R.id,id:R.id,className:Ht([R.className,a]),type:$,data:R.data,selected:!!R.selected,animated:!!R.animated,hidden:!!R.hidden,label:R.label,labelStyle:R.labelStyle,labelShowBg:R.labelShowBg,labelBgStyle:R.labelBgStyle,labelBgPadding:R.labelBgPadding,labelBgBorderRadius:R.labelBgBorderRadius,style:R.style,source:R.source,target:R.target,sourceHandleId:R.sourceHandle,targetHandleId:R.targetHandle,markerEnd:R.markerEnd,markerStart:R.markerStart,sourceX:Ee,sourceY:He,targetX:Fe,targetY:Ie,sourcePosition:K,targetPosition:se,elementsSelectable:j,onContextMenu:l,onMouseEnter:u,onMouseMove:h,onMouseLeave:p,onClick:f,onEdgeDoubleClick:g,onReconnect:v,onReconnectStart:w,onReconnectEnd:N,reconnectRadius:b,rfId:s,ariaLabel:R.ariaLabel,isFocusable:he,isReconnectable:xe,pathOptions:"pathOptions"in R?R.pathOptions:void 0,interactionWidth:R.interactionWidth,disableKeyboardA11y:S})})))),k):null};Gj.displayName="EdgeRenderer";var v$=_.memo(Gj);const w$=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function x$({children:e}){const t=lt(w$);return de.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:t}},e)}function b$(e){const t=xl(),n=_.useRef(!1);_.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const k$={[$e.Left]:$e.Right,[$e.Right]:$e.Left,[$e.Top]:$e.Bottom,[$e.Bottom]:$e.Top},Vj=({nodeId:e,handleType:t,style:n,type:s=Is.Bezier,CustomComponent:i,connectionStatus:a})=>{var O,P,z;const{fromNode:l,handleId:u,toX:h,toY:p,connectionMode:f}=lt(_.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]),Lt),g=(O=l==null?void 0:l[Nt])==null?void 0:O.handleBounds;let v=g==null?void 0:g[t];if(f===No.Loose&&(v=v||(g==null?void 0:g[t==="source"?"target":"source"])),!l||!v)return null;const w=u?v.find(M=>M.id===u):v[0],N=w?w.x+w.width/2:(l.width??0)/2,b=w?w.y+w.height/2:l.height??0,k=(((P=l.positionAbsolute)==null?void 0:P.x)??0)+N,S=(((z=l.positionAbsolute)==null?void 0:z.y)??0)+b,E=w==null?void 0:w.position,C=E?k$[E]:null;if(!E||!C)return null;if(i)return de.createElement(i,{connectionLineType:s,connectionLineStyle:n,fromNode:l,fromHandle:w,fromX:k,fromY:S,toX:h,toY:p,fromPosition:E,toPosition:C,connectionStatus:a});let j="";const I={sourceX:k,sourceY:S,sourcePosition:E,targetX:h,targetY:p,targetPosition:C};return s===Is.Bezier?[j]=vj(I):s===Is.Step?[j]=$v({...I,borderRadius:0}):s===Is.SmoothStep?[j]=$v(I):s===Is.SimpleBezier?[j]=yj(I):j=`M${k},${S} ${h},${p}`,de.createElement("path",{d:j,fill:"none",className:"react-flow__connection-path",style:n})};Vj.displayName="ConnectionLine";const _$=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function S$({containerStyle:e,style:t,type:n,component:s}){const{nodeId:i,handleType:a,nodesConnectable:l,width:u,height:h,connectionStatus:p}=lt(_$,Lt);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(Vj,{nodeId:i,handleType:a,style:t,type:n,CustomComponent:s,connectionStatus:p})))}function Yb(e,t){return _.useRef(null),At(),_.useMemo(()=>t(e),[e])}const Yj=({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:v,onNodeContextMenu:w,onSelectionContextMenu:N,onSelectionStart:b,onSelectionEnd:k,connectionLineType:S,connectionLineStyle:E,connectionLineComponent:C,connectionLineContainerStyle:j,selectionKeyCode:I,selectionOnDrag:O,selectionMode:P,multiSelectionKeyCode:z,panActivationKeyCode:M,zoomActivationKeyCode:A,deleteKeyCode:q,onlyRenderVisibleElements:H,elementsSelectable:Y,selectNodesOnDrag:R,defaultViewport:Q,translateExtent:W,minZoom:ne,maxZoom:X,preventScrolling:B,defaultMarkerColor:J,zoomOnScroll:$,zoomOnPinch:V,panOnScroll:Z,panOnScrollSpeed:F,panOnScrollMode:L,zoomOnDoubleClick:K,panOnDrag:se,onPaneClick:he,onPaneMouseEnter:me,onPaneMouseMove:xe,onPaneMouseLeave:Ee,onPaneScroll:He,onPaneContextMenu:Fe,onEdgeContextMenu:Ie,onEdgeMouseEnter:be,onEdgeMouseMove:ue,onEdgeMouseLeave:re,onReconnect:pe,onReconnectStart:Oe,onReconnectEnd:rt,reconnectRadius:ot,noDragClassName:Xe,noWheelClassName:Pe,noPanClassName:Be,elevateEdgesOnSelect:Ge,disableKeyboardA11y:it,nodeOrigin:ke,nodeExtent:ct,rfId:It})=>{const ae=Yb(e,ZP),Le=Yb(t,o$);return b$(a),de.createElement(XP,{onPaneClick:he,onPaneMouseEnter:me,onPaneMouseMove:xe,onPaneMouseLeave:Ee,onPaneContextMenu:Fe,onPaneScroll:He,deleteKeyCode:q,selectionKeyCode:I,selectionOnDrag:O,selectionMode:P,onSelectionStart:b,onSelectionEnd:k,multiSelectionKeyCode:z,panActivationKeyCode:M,zoomActivationKeyCode:A,elementsSelectable:Y,onMove:n,onMoveStart:s,onMoveEnd:i,zoomOnScroll:$,zoomOnPinch:V,zoomOnDoubleClick:K,panOnScroll:Z,panOnScrollSpeed:F,panOnScrollMode:L,panOnDrag:se,defaultViewport:Q,translateExtent:W,minZoom:ne,maxZoom:X,onSelectionContextMenu:N,preventScrolling:B,noDragClassName:Xe,noWheelClassName:Pe,noPanClassName:Be,disableKeyboardA11y:it},de.createElement(x$,null,de.createElement(v$,{edgeTypes:Le,onEdgeClick:u,onEdgeDoubleClick:p,onlyRenderVisibleElements:H,onEdgeContextMenu:Ie,onEdgeMouseEnter:be,onEdgeMouseMove:ue,onEdgeMouseLeave:re,onReconnect:pe,onReconnectStart:Oe,onReconnectEnd:rt,reconnectRadius:ot,defaultMarkerColor:J,noPanClassName:Be,elevateEdgesOnSelect:!!Ge,disableKeyboardA11y:it,rfId:It},de.createElement(S$,{style:E,type:S,component:C,containerStyle:j})),de.createElement("div",{className:"react-flow__edgelabel-renderer"}),de.createElement(t$,{nodeTypes:ae,onNodeClick:l,onNodeDoubleClick:h,onNodeMouseEnter:f,onNodeMouseMove:g,onNodeMouseLeave:v,onNodeContextMenu:w,selectNodesOnDrag:R,onlyRenderVisibleElements:H,noPanClassName:Be,noDragClassName:Xe,disableKeyboardA11y:it,nodeOrigin:ke,nodeExtent:ct,rfId:It})))};Yj.displayName="GraphView";var N$=_.memo(Yj);const zv=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Rs={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:zv,nodeExtent:zv,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:No.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:ZO,isValidConnection:void 0},E$=()=>h2((e,t)=>({...Rs,setNodes:n=>{const{nodeInternals:s,nodeOrigin:i,elevateNodesOnSelect:a}=t();e({nodeInternals:Kf(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?Kf(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:v}=new window.DOMMatrixReadOnly(g.transform),w=n.reduce((b,k)=>{const S=i.get(k.id);if(S!=null&&S.hidden)i.set(S.id,{...S,[Nt]:{...S[Nt],handleBounds:void 0}});else if(S){const E=mw(k.nodeElement);!!(E.width&&E.height&&(S.width!==E.width||S.height!==E.height||k.forceUpdate))&&(i.set(S.id,{...S,[Nt]:{...S[Nt],handleBounds:{source:zb(".source",k.nodeElement,v,p),target:zb(".target",k.nodeElement,v,p)}},...E}),b.push({id:S.id,type:"dimensions",dimensions:E}))}return b},[]);$j(i,p);const N=l||a&&!l&&Lj(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=zP(n,u()),f=Kf(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=>Ms(h,!0)):(l=Ii(a(),n),u=Ii(i,[])),Jc({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=>Ms(h,!0)):(l=Ii(i,n),u=Ii(a(),[])),Jc({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,Ms(f.id,!1))),p=u.map(f=>Ms(f.id,!1));Jc({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=>Ms(u.id,!1)),l=n.filter(u=>u.selected).map(u=>Ms(u.id,!1));Jc({changedNodes:a,changedEdges:l,get:t,set:e})},setNodeExtent:n=>{const{nodeInternals:s}=t();s.forEach(i=>{i.positionAbsolute=gw(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=Qr.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:Rs.connectionNodeId,connectionHandleId:Rs.connectionHandleId,connectionHandleType:Rs.connectionHandleType,connectionStatus:Rs.connectionStatus,connectionStartHandle:Rs.connectionStartHandle,connectionEndHandle:Rs.connectionEndHandle}),reset:()=>e({...Rs})}),Object.is),Sw=({children:e})=>{const t=_.useRef(null);return t.current||(t.current=E$()),de.createElement(HO,{value:t.current},e)};Sw.displayName="ReactFlowProvider";const Kj=({children:e})=>_.useContext(Lu)?de.createElement(de.Fragment,null,e):de.createElement(Sw,null,e);Kj.displayName="ReactFlowWrapper";const C$={input:Tj,default:Dv,output:Aj,group:kw},j$={default:Nu,straight:ww,step:vw,smoothstep:qu,simplebezier:yw},T$=[0,0],R$=[15,15],A$={x:0,y:0,zoom:1},M$={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},Xj=_.forwardRef(({nodes:e,edges:t,defaultNodes:n,defaultEdges:s,className:i,nodeTypes:a=C$,edgeTypes:l=j$,onNodeClick:u,onEdgeClick:h,onInit:p,onMove:f,onMoveStart:g,onMoveEnd:v,onConnect:w,onConnectStart:N,onConnectEnd:b,onClickConnectStart:k,onClickConnectEnd:S,onNodeMouseEnter:E,onNodeMouseMove:C,onNodeMouseLeave:j,onNodeContextMenu:I,onNodeDoubleClick:O,onNodeDragStart:P,onNodeDrag:z,onNodeDragStop:M,onNodesDelete:A,onEdgesDelete:q,onSelectionChange:H,onSelectionDragStart:Y,onSelectionDrag:R,onSelectionDragStop:Q,onSelectionContextMenu:W,onSelectionStart:ne,onSelectionEnd:X,connectionMode:B=No.Strict,connectionLineType:J=Is.Bezier,connectionLineStyle:$,connectionLineComponent:V,connectionLineContainerStyle:Z,deleteKeyCode:F="Backspace",selectionKeyCode:L="Shift",selectionOnDrag:K=!1,selectionMode:se=cl.Full,panActivationKeyCode:he="Space",multiSelectionKeyCode:me=_u()?"Meta":"Control",zoomActivationKeyCode:xe=_u()?"Meta":"Control",snapToGrid:Ee=!1,snapGrid:He=R$,onlyRenderVisibleElements:Fe=!1,selectNodesOnDrag:Ie=!0,nodesDraggable:be,nodesConnectable:ue,nodesFocusable:re,nodeOrigin:pe=T$,edgesFocusable:Oe,edgesUpdatable:rt,elementsSelectable:ot,defaultViewport:Xe=A$,minZoom:Pe=.5,maxZoom:Be=2,translateExtent:Ge=zv,preventScrolling:it=!0,nodeExtent:ke,defaultMarkerColor:ct="#b1b1b7",zoomOnScroll:It=!0,zoomOnPinch:ae=!0,panOnScroll:Le=!1,panOnScrollSpeed:ze=.5,panOnScrollMode:Ce=bo.Free,zoomOnDoubleClick:Ve=!0,panOnDrag:Et=!0,onPaneClick:st,onPaneMouseEnter:Te,onPaneMouseMove:vt,onPaneMouseLeave:ut,onPaneScroll:_t,onPaneContextMenu:_n,children:Dn,onEdgeContextMenu:Sn,onEdgeDoubleClick:Ro,onEdgeMouseEnter:hn,onEdgeMouseMove:Ao,onEdgeMouseLeave:Mo,onEdgeUpdate:Bt,onEdgeUpdateStart:Tr,onEdgeUpdateEnd:Fn,onReconnect:qs,onReconnectStart:Rr,onReconnectEnd:ra,reconnectRadius:ur=10,edgeUpdaterRadius:Ar=10,onNodesChange:dr,onEdgesChange:ns,noDragClassName:Io="nodrag",noWheelClassName:Oo="nowheel",noPanClassName:Po="nopan",fitView:Nn=!1,fitViewOptions:$o,connectOnClick:Mr=!0,attributionPosition:Lo,proOptions:zn,defaultEdgeOptions:qo,elevateNodesOnSelect:Ds=!0,elevateEdgesOnSelect:Fs=!1,disableKeyboardA11y:Do=!1,autoPanOnConnect:Fo=!0,autoPanOnNodeDrag:at=!0,connectionRadius:sa=20,isValidConnection:rs,onError:Gt,style:Bn,id:zo,nodeDragThreshold:ss,...wt},rn)=>{const Un=zo||"1";return de.createElement("div",{...wt,style:{...Bn,...M$},ref:rn,className:Ht(["react-flow",i]),"data-testid":"rf__wrapper",id:zo},de.createElement(Kj,null,de.createElement(N$,{onInit:p,onMove:f,onMoveStart:g,onMoveEnd:v,onNodeClick:u,onEdgeClick:h,onNodeMouseEnter:E,onNodeMouseMove:C,onNodeMouseLeave:j,onNodeContextMenu:I,onNodeDoubleClick:O,nodeTypes:a,edgeTypes:l,connectionLineType:J,connectionLineStyle:$,connectionLineComponent:V,connectionLineContainerStyle:Z,selectionKeyCode:L,selectionOnDrag:K,selectionMode:se,deleteKeyCode:F,multiSelectionKeyCode:me,panActivationKeyCode:he,zoomActivationKeyCode:xe,onlyRenderVisibleElements:Fe,selectNodesOnDrag:Ie,defaultViewport:Xe,translateExtent:Ge,minZoom:Pe,maxZoom:Be,preventScrolling:it,zoomOnScroll:It,zoomOnPinch:ae,zoomOnDoubleClick:Ve,panOnScroll:Le,panOnScrollSpeed:ze,panOnScrollMode:Ce,panOnDrag:Et,onPaneClick:st,onPaneMouseEnter:Te,onPaneMouseMove:vt,onPaneMouseLeave:ut,onPaneScroll:_t,onPaneContextMenu:_n,onSelectionContextMenu:W,onSelectionStart:ne,onSelectionEnd:X,onEdgeContextMenu:Sn,onEdgeDoubleClick:Ro,onEdgeMouseEnter:hn,onEdgeMouseMove:Ao,onEdgeMouseLeave:Mo,onReconnect:qs??Bt,onReconnectStart:Rr??Tr,onReconnectEnd:ra??Fn,reconnectRadius:ur??Ar,defaultMarkerColor:ct,noDragClassName:Io,noWheelClassName:Oo,noPanClassName:Po,elevateEdgesOnSelect:Fs,rfId:Un,disableKeyboardA11y:Do,nodeOrigin:pe,nodeExtent:ke}),de.createElement(bP,{nodes:e,edges:t,defaultNodes:n,defaultEdges:s,onConnect:w,onConnectStart:N,onConnectEnd:b,onClickConnectStart:k,onClickConnectEnd:S,nodesDraggable:be,nodesConnectable:ue,nodesFocusable:re,edgesFocusable:Oe,edgesUpdatable:rt,elementsSelectable:ot,elevateNodesOnSelect:Ds,minZoom:Pe,maxZoom:Be,nodeExtent:ke,onNodesChange:dr,onEdgesChange:ns,snapToGrid:Ee,snapGrid:He,connectionMode:B,translateExtent:Ge,connectOnClick:Mr,defaultEdgeOptions:qo,fitView:Nn,fitViewOptions:$o,onNodesDelete:A,onEdgesDelete:q,onNodeDragStart:P,onNodeDrag:z,onNodeDragStop:M,onSelectionDrag:R,onSelectionDragStart:Y,onSelectionDragStop:Q,noPanClassName:Po,nodeOrigin:pe,rfId:Un,autoPanOnConnect:Fo,autoPanOnNodeDrag:at,onError:Gt,connectionRadius:sa,isValidConnection:rs,nodeDragThreshold:ss}),de.createElement(wP,{onSelectionChange:H}),Dn,de.createElement(VO,{proOptions:zn,position:Lo}),de.createElement(EP,{rfId:Un,disableKeyboardA11y:Do})))});Xj.displayName="ReactFlow";const I$=e=>({x:e.transform[0],y:e.transform[1],zoom:e.transform[2]});function Qj(){return lt(I$,Lt)}const Zj=({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:v,selected:w})=>{const{background:N,backgroundColor:b}=a||{},k=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:k,stroke:u,strokeWidth:h,shapeRendering:g,onClick:v?S=>v(S,e):void 0})};Zj.displayName="MiniMapNode";var O$=_.memo(Zj);const P$=e=>e.nodeOrigin,$$=e=>e.getNodes().filter(t=>!t.hidden&&t.width&&t.height),Jf=e=>e instanceof Function?e:()=>e;function L$({nodeStrokeColor:e="transparent",nodeColor:t="#e2e2e2",nodeClassName:n="",nodeBorderRadius:s=5,nodeStrokeWidth:i=2,nodeComponent:a=O$,onClick:l}){const u=lt($$,Lt),h=lt(P$),p=Jf(t),f=Jf(e),g=Jf(n),v=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return de.createElement(de.Fragment,null,u.map(w=>{const{x:N,y:b}=_o(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:v,onClick:l,id:w.id})}))}var q$=_.memo(L$);const D$=200,F$=150,z$=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?XO(Du(t,e.nodeOrigin),n):n,rfId:e.rfId}},B$="react-flow__minimap-desc";function Jj({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:v,onNodeClick:w,pannable:N=!1,zoomable:b=!1,ariaLabel:k="React Flow mini map",inversePan:S=!1,zoomStep:E=10,offsetScale:C=5}){const j=At(),I=_.useRef(null),{boundingRect:O,viewBB:P,rfId:z}=lt(z$,Lt),M=(e==null?void 0:e.width)??D$,A=(e==null?void 0:e.height)??F$,q=O.width/M,H=O.height/A,Y=Math.max(q,H),R=Y*M,Q=Y*A,W=C*Y,ne=O.x-(R-O.width)/2-W,X=O.y-(Q-O.height)/2-W,B=R+W*2,J=Q+W*2,$=`${B$}-${z}`,V=_.useRef(0);V.current=Y,_.useEffect(()=>{if(I.current){const L=Pn(I.current),K=me=>{const{transform:xe,d3Selection:Ee,d3Zoom:He}=j.getState();if(me.sourceEvent.type!=="wheel"||!Ee||!He)return;const Fe=-me.sourceEvent.deltaY*(me.sourceEvent.deltaMode===1?.05:me.sourceEvent.deltaMode?1:.002)*E,Ie=xe[2]*Math.pow(2,Fe);He.scaleTo(Ee,Ie)},se=me=>{const{transform:xe,d3Selection:Ee,d3Zoom:He,translateExtent:Fe,width:Ie,height:be}=j.getState();if(me.sourceEvent.type!=="mousemove"||!Ee||!He)return;const ue=V.current*Math.max(1,xe[2])*(S?-1:1),re={x:xe[0]-me.sourceEvent.movementX*ue,y:xe[1]-me.sourceEvent.movementY*ue},pe=[[0,0],[Ie,be]],Oe=Qr.translate(re.x,re.y).scale(xe[2]),rt=He.constrain()(Oe,pe,Fe);He.transform(Ee,rt)},he=aj().on("zoom",N?se:null).on("zoom.wheel",b?K:null);return L.call(he),()=>{L.on("zoom",null)}}},[N,b,S,E]);const Z=v?L=>{const K=nr(L);v(L,{x:K[0],y:K[1]})}:void 0,F=w?(L,K)=>{const se=j.getState().nodeInternals.get(K);w(L,se)}:void 0;return de.createElement(pw,{position:g,style:e,className:Ht(["react-flow__minimap",t]),"data-testid":"rf__minimap"},de.createElement("svg",{width:M,height:A,viewBox:`${ne} ${X} ${B} ${J}`,role:"img","aria-labelledby":$,ref:I,onClick:Z},k&&de.createElement("title",{id:$},k),de.createElement(q$,{onClick:F,nodeColor:s,nodeStrokeColor:n,nodeBorderRadius:a,nodeClassName:i,nodeStrokeWidth:l,nodeComponent:u}),de.createElement("path",{className:"react-flow__minimap-mask",d:`M${ne-W},${X-W}h${B+W*2}v${J+W*2}h${-B-W*2}z
57
- M${P.x},${P.y}h${P.width}v${P.height}h${-P.width}z`,fill:h,fillRule:"evenodd",stroke:p,strokeWidth:f,pointerEvents:"none"})))}Jj.displayName="MiniMap";var U$=_.memo(Jj);function W$(){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 H$(){return de.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},de.createElement("path",{d:"M0 0h32v4.2H0z"}))}function G$(){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 V$(){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 Y$(){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 Nr=({children:e,className:t,...n})=>de.createElement("button",{type:"button",className:Ht(["react-flow__controls-button",t]),...n},e);Nr.displayName="ControlButton";const K$=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom}),eT=({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 v=At(),[w,N]=_.useState(!1),{isInteractive:b,minZoomReached:k,maxZoomReached:S}=lt(K$,Lt),{zoomIn:E,zoomOut:C,fitView:j}=xl();if(_.useEffect(()=>{N(!0)},[]),!w)return null;const I=()=>{E(),a==null||a()},O=()=>{C(),l==null||l()},P=()=>{j(i),u==null||u()},z=()=>{v.setState({nodesDraggable:!b,nodesConnectable:!b,elementsSelectable:!b}),h==null||h(!b)};return de.createElement(pw,{className:Ht(["react-flow__controls",p]),position:g,style:e,"data-testid":"rf__controls"},t&&de.createElement(de.Fragment,null,de.createElement(Nr,{onClick:I,className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:S},de.createElement(W$,null)),de.createElement(Nr,{onClick:O,className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:k},de.createElement(H$,null))),n&&de.createElement(Nr,{className:"react-flow__controls-fitview",onClick:P,title:"fit view","aria-label":"fit view"},de.createElement(G$,null)),s&&de.createElement(Nr,{className:"react-flow__controls-interactive",onClick:z,title:"toggle interactivity","aria-label":"toggle interactivity"},b?de.createElement(Y$,null):de.createElement(V$,null)),f)};eT.displayName="Controls";var X$=_.memo(eT),ir;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(ir||(ir={}));function Q$({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 Z$({color:e,radius:t}){return de.createElement("circle",{cx:t,cy:t,r:t,fill:e})}const J$={[ir.Dots]:"#91919a",[ir.Lines]:"#eee",[ir.Cross]:"#e2e2e2"},eL={[ir.Dots]:1,[ir.Lines]:1,[ir.Cross]:6},tL=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function tT({id:e,variant:t=ir.Dots,gap:n=20,size:s,lineWidth:i=1,offset:a=2,color:l,style:u,className:h}){const p=_.useRef(null),{transform:f,patternId:g}=lt(tL,Lt),v=l||J$[t],w=s||eL[t],N=t===ir.Dots,b=t===ir.Cross,k=Array.isArray(n)?n:[n,n],S=[k[0]*f[2]||1,k[1]*f[2]||1],E=w*f[2],C=b?[E,E]:S,j=N?[E/a,E/a]:[C[0]/a,C[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]%S[0],y:f[1]%S[1],width:S[0],height:S[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${j[0]},-${j[1]})`},N?de.createElement(Z$,{color:v,radius:E/a}):de.createElement(Q$,{dimensions:C,color:v,lineWidth:i})),de.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${g+e})`}))}tT.displayName="Background";var nL=_.memo(tT);const rL=["us-gov","global","apac","us","eu","jp","au"],sL=new RegExp(`^(?:(?:${rL.join("|")})\\.)?anthropic\\.`,"i");function bl(e){return e.replace(sL,"")}const oL=["command","cmd","file_path","path","url","pattern","notebook_path"],Kb=120,eh=e=>e.length>Kb?`${e.slice(0,Kb-1)}…`:e;function iL(e){if(typeof e=="string")return e.trim()?eh(e.trim()):null;if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e;for(const n of oL){const s=t[n];if(typeof s=="string"&&s.trim())return eh(s.trim());if(Array.isArray(s)&&s.length>0&&s.every(i=>typeof i=="string")){const i=s.join(" ").trim();if(i)return eh(i)}}return null}function nT(){return{inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0}}function Nw(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 aL(e){const t=Nw(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 lL(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]=aL(s));return Object.keys(t).length?t:void 0}function rT(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),...Nw(n)};for(const s of Object.values(n)){const i=rT(s,t+1);if(i)return i}return null}const cL=/^(?:claude[-_]|gpt[-_]|o\d|codex[-_])/i;function sT(e,t=0){if(!e||typeof e!="object"||t>6)return null;const n=e;if(typeof n.model=="string"&&cL.test(bl(n.model)))return n.model;for(const s of Object.values(n)){const i=sT(s,t+1);if(i)return i}return null}function Bv(){return{agents:new Map,toolIndex:new Map,toolOwner:new Map,activeSubagentStack:new Map,lastSeq:0,seqEpoch:null,totalEvents:0,revision:0}}function Ps(e){if(!e)return;const t=e.replace(/\\/g,"/").split("/").filter(Boolean);return t[t.length-1]}function Xb(){return{msgsUser:0,msgsAssistant:0,toolUses:0,toolResults:0,systemReminders:0,currentContextTokens:0,memoryFiles:[]}}function kl(e,t){return`${e}::${t}`}function Eu(e){return e.agent_type??e.subagent_type??"subagent"}function tl(e){return e.agent_id?e.agent_id:e.parent_tool_use_id?e.parent_tool_use_id:null}function Oi(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:nT()},e.agents.set(i,a),a)}function oT(e,t,n,s){const i=kl(t,n),a=e.agents.get(i);if(!a)return null;!a.cwd&&s.cwd&&(a.cwd=s.cwd,a.cwdBasename=Ps(s.cwd));const l=Eu(s);return l&&(a.label==="subagent"||!a.label)&&(a.label=l),a}function uL(e,t,n){const s=t.session_id??"unknown",i=tl(t);if(i){const h=oT(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(kl(s,l));if(h)return!h.cwd&&t.cwd&&(h.cwd=t.cwd,h.cwdBasename=Ps(t.cwd)),h}const u=Oi(e,s,n,t.hook_event_name!=="SessionStart");return!u.cwd&&t.cwd&&(u.cwd=t.cwd,u.cwdBasename=Ps(t.cwd)),u.label==="session"&&t.cwd&&(u.label=Ps(t.cwd)??"session"),u}function dL(e,t,n,s,i){const a=kl(t,n),l=Oi(e,t,i,!0);let u=e.agents.get(a);if(u){!u.cwd&&s.cwd&&(u.cwd=s.cwd,u.cwdBasename=Ps(s.cwd));const h=Eu(s);return h&&(u.label==="subagent"||!u.label)&&(u.label=h),u}return u={id:a,sessionId:t,label:Eu(s),kind:"subagent",parentId:l.id,state:"active",startedAt:i,tools:[],prompts:[],cwd:s.cwd,cwdBasename:Ps(s.cwd),toolCount:0,childCount:0,usage:nT()},e.agents.set(a,u),l.childCount+=1,u}function fL(e,t,n){const s=e.activeSubagentStack.get(t)??[];s.includes(n)||(s.push(n),e.activeSubagentStack.set(t,s))}function hL(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 tu(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 Qb=200,pL=25;function mL(e,t){const n=t.tools;if(n.length>Qb){const s=n.splice(0,n.length-Qb);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-pL-1;s>=0;s--){const i=n[s];if(i.trimmed)break;i.input=void 0,i.response=void 0,i.trimmed=!0}}function gL(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 Zb=2e3;function yL(e,t,n){for(let s=e.prompts.length-1;s>=0;s--){const i=e.prompts[s];if(i.at<t-Zb)return!1;if(i.text===n&&i.at<=t+Zb)return!0}return!1}function iT(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 _l(e,t){return t&&(e.revision+=1),t}function vL(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&&(iT(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 _l(e,u>0)}function wL(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&&iT(e,g),e.agents.delete(f)}u--,h=!0}return _l(e,h)}function xL(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 bL(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 _l(e,t)}function kL(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 _l(e,s)}const Jb=90*6e4;function _L(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 _l(e,s)}function SL(e){return e==="permission_prompt"?"permission":e==="agent_needs_input"?"asked":e==="idle_prompt"?"idle":null}const NL=new Set(["Notification","ModelObserved","ContextObserved","UsageObserved","SessionNamed"]);function EL(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}const CL=3e4;function jL(e,t){if(!(!e||!e.name)&&!(t-e.startedAt>CL)&&!(e.startedAt>t))return{name:e.name,preview:iL(e.input)??""}}function TL(e,t,n,s,i){if(n!=="permission")return{kind:n,message:s,since:i};const a=EL(e,t),l={kind:n,message:s,since:i};a!=null&&a.explicitSubagentId&&(l.subagentId=a.explicitSubagentId);const u=jL(a,i);return u&&(l.tool=u),l}function RL(e,t,n){if(e.kind==="idle")return!0;const s=tl(t);return s==null?!0:e.subagentId!=null&&kl(n,s)===e.subagentId}function e1(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{...Bv(),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(!NL.has(a)){const f=e.agents.get(l);f!=null&&f.waiting&&RL(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??Xb(),currentContextTokens:s.context_tokens})}if(a==="ModelObserved"){const f=typeof s.model=="string"?s.model:null;if(f){const v=e.agents.get(l);v&&(v.model=f)}const g=s.subagentModels;if(g&&typeof g=="object")for(const[v,w]of Object.entries(g)){if(typeof w!="string")continue;const N=`${l}::${v}`,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 v=g.context??Xb(),w=(b,k)=>typeof f[b]=="number"?f[b]:k,N=Array.isArray(f.memoryFiles)?f.memoryFiles:Array.isArray(f.claudeMdFiles)?f.claudeMdFiles:null;g.context={msgsUser:w("msgsUser",v.msgsUser),msgsAssistant:w("msgsAssistant",v.msgsAssistant),toolUses:w("toolUses",v.toolUses),toolResults:w("toolResults",v.toolResults),systemReminders:w("systemReminders",v.systemReminders),currentContextTokens:w("currentContextTokens",v.currentContextTokens),memoryFiles:N??v.memoryFiles}}}return e}if(a==="SessionNamed"){const f=e.agents.get(l);if(f){const g=typeof s.sessionName=="string"?s.sessionName.trim():"",v=typeof s.sessionTitle=="string"?s.sessionTitle.trim():"";g&&(f.sessionName=g),v&&(f.sessionTitle=v);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 v=Nw(f);g.usage.cacheCreate1hTokens=v.cacheCreate1hTokens,g.usage.cacheCreate5mTokens=v.cacheCreate5mTokens,typeof f.reasoning_output_tokens=="number"&&(g.usage.reasoningOutputTokens=Number(f.reasoning_output_tokens)),g.usageByModel=lL(s.usageByModel)}}return e}const h=uL(e,s,i);h.provider||(h.provider=s.provider==="codex"?"codex":"claude");const p=sT(s);switch(p&&(h.model=p),a){case"SessionStart":{const f=Oi(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=Ps(s.cwd)),f.label==="session"&&s.cwd&&(f.label=Ps(s.cwd)??"session");break}case"UserPromptSubmit":{for(const v of e.agents.values())v.sessionId===l&&v.kind==="subagent"&&v.state==="done"&&v.exitAt==null&&v.endedAt!=null&&v.endedAt<i&&(v.exitAt=i);const f=Oi(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&&!yL(f,i,g)&&(f.prompts.push({at:i,text:g}),f.firstPrompt||(f.firstPrompt=tu(g,120)));break}case"PreToolUse":{const f=s.tool_use_id?gL(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=tu(s.tool_input));break}const g=s.tool_use_id??`${h.id}:${h.toolCount}`,v=tl(s),w={id:g,name:s.tool_name??"?",input:s.tool_input,inputPreview:tu(s.tool_input),agentId:h.id,explicitSubagentId:v?kl(l,v):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),mL(e,h);break}case"PostToolUse":case"PostToolUseFailure":{const f=s.tool_use_id;if(!f)break;let g=e.toolIndex.get(f),v=!1;if(!g)for(const N of e.agents.values()){const b=N.tools.find(k=>k.id===f);if(b){g=b,v=!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=tu(s.tool_response):v&&(g.errorPreview=void 0);const w=rT(s.tool_response);w&&(g.usage=w),e.toolIndex.delete(f),e.toolOwner.delete(f);break}case"SubagentStart":{const f=tl(s);if(!f)break;const g=dL(e,l,f,s,i);g.state="active",g.startedAt=g.startedAt||i,g.exitAt=void 0,g.endedAt=void 0;const v=Eu(s);v&&(g.label=v),fL(e,l,f);break}case"SubagentStop":{const f=tl(s);if(!f)break;const g=oT(e,l,f,s);if(!g)break;g.state="done",g.endedAt=i,hL(e,l,f);break}case"Stop":case"SessionEnd":{const f=Oi(e,l,i,!1);f.state="done",f.endedAt=i,a==="SessionEnd"&&(f.closedAt=i),e.activeSubagentStack.delete(l);break}case"Notification":{const f=SL(s.notification_type);if(!f)break;const g=Oi(e,l,i,!1),v=typeof s.message=="string"?s.message:"",w=g.waiting;g.waiting=w&&w.kind===f&&w.message===v?{...w,since:Math.min(w.since,i)}:TL(e,l,f,v,i);break}}return e}function Ew(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 AL={input:2,output:10,cacheRead:.2,cacheWrite:2.5,cacheWrite1h:4},ML=[{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:AL},{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 IL(e){return e?/^(?:gpt[-_]|codex[-_]|o\d)/i.test(e):!1}function Qi(e,t=Date.now()){if(!e)return null;const n=bl(e);for(const s of ML)if(s.match.test(n))return typeof s.rates=="function"?s.rates(t):s.rates;return null}function aT(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 lT(e,t,n=Date.now()){if(!IL(t))return e.inputTokens;const s=Qi(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 Cw(e,t,n=Date.now()){const s=Qi(t,n);if(!s)return{input:0,output:0,cacheRead:0,cacheWrite:0,total:0};const i=lT(e,t,n)*s.input/1e6,a=e.outputTokens*s.output/1e6,l=e.cacheReadTokens*s.cacheRead/1e6,u=aT(e,s),h=u.usd5m+u.usd1h;return{input:i,output:a,cacheRead:l,cacheWrite:h,total:i+a+l+h}}const t1=2e5,OL=1e6,PL=[/\[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],$L=[{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 LL(e){if(!e)return t1;const t=bl(e);for(const n of PL)if(n.test(t))return OL;for(const n of $L)if(n.match.test(t))return n.window;return t1}function cT(e,t){return typeof e=="number"&&e>0?e:LL(t)}const Mi="not priced";function Ze(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 jw(e,t){if(e<=0||t<10)return null;const n=e/t,s=n*60;return s>=.01?`${Ze(s)}/min`:`${Ze(n*3600)}/hr`}function qL(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 DL(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,v)=>Math.max(0,g-v),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 Sl(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=DL(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:qL(s[a].usage,i)}:s.push({model:e.model,usage:i})}return s}function xn(e,t=Date.now()){const n={input:0,output:0,cacheRead:0,cacheWrite:0,total:0};for(const s of Sl(e)){const i=Cw(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 Uv(e,t=Date.now()){let n=0;for(const s of Sl(e))Qi(s.model,t)==null&&(n+=s.usage.inputTokens+s.usage.outputTokens);return n}function uT(e){const t=[];for(const n of Sl(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 dT(e){return uT(e).filter(t=>t!==e.model)}const FL=new Set(["untrusted","on-request","on-failure"]);function zL(e){return typeof e!="string"||!e?null:FL.has(e)?!0:e==="never"?!1:null}function BL(e){if(e.provider!=="codex"||e.kind!=="root"||e.waiting||e.state!=="active")return null;const t=zL(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 n1(e){return e[0].toUpperCase()+e.slice(1).toLowerCase()}function $s(e){const t=bl(e).replace(/[-_]\d{8}(?!\d)/,""),n=t.match(/^claude[-_](opus|sonnet|haiku|fable|mythos)[-_](\d+(?:[-_.]\d+)*)/i);if(n){const i=n1(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(n1);return[`GPT-${i}`,...a].join(" ")}return e}function Fu(e){const t=bl(e??""),n=t.match(/^claude[-_](opus|sonnet|haiku|fable|mythos)[-_]/i);return n?n[1].toLowerCase():/^gpt[-_]/i.test(t)?"gpt":""}function Nl(e){return(e==null?void 0:e.kind)==="permission"||(e==null?void 0:e.kind)==="asked"}function UL(e){const t=[];for(const n of e)n.kind==="root"&&Nl(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 WL(e){const t=new Set;for(const n of e)n.state==="active"&&t.add(n.sessionId);return t.size}function zu(e,t){return`${e}@${t.since}`}function fT(e,t){if(!e.tool)return null;const{name:n,preview:s}=e.tool,i=new RegExp(`\\b${n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`,"i").test(t);return s?i?s:`${n} · ${s}`:i?null:n}function HL(e){const t=e.message||"Needs your permission",n=fT(e,t);return n?`${t}
60
- Likely on: ${n}`:t}function GL(e,t,n){if(n)return[];const s=[];for(const i of e){if(!Nl(i.waiting))continue;const a=zu(i.id,i.waiting);t.has(a)||s.push({key:a,title:i.label,body:HL(i.waiting),sessionId:i.id})}return s}function VL(e,t,n){const s=new Set;for(const a of e)s.add(zu(a.id,a.waiting));const i=new Set;for(const a of n)s.has(a)&&i.add(a);for(const a of t)i.add(a.key);return i}function r1(e){return new Set(e.map(t=>zu(t.id,t.waiting)))}function YL(e,t){return e!==t}function KL(e,t){return t&&e==="default"}function Rt(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 Cu(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 hT(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 pT(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 XL=1,mT=-1;function QL(){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===mT}}}const Di=QL();function ZL(e){return e.overlayOpen&&!e.panelOnTop?"dismiss":e.typing?"blur":e.overlayOpen?"dismiss":"clear-selection"}function s1(e){return String(e.tagName??"").toUpperCase()==="BODY"}function JL(e,t){return!e||!e.isConnected||s1(e)?!1:t==null||s1(t)}const o1="a[href], button, input, select, textarea, [tabindex]";function e3(e){return!e||e.disabled||e.rendered===!1?!1:(e.tabIndex??0)>=0}function t3(e){if(!e||!e.overflowing||e.hasFocusable)return!1;const t=String(e.overflow??"").toLowerCase();return t==="auto"||t==="scroll"}function n3({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 Tw(e){return e.ctrlKey||e.metaKey||e.altKey}const r3=new Set(["button","checkbox","color","file","image","radio","range","reset","submit"]),s3=new Set(["INPUT","TEXTAREA","SELECT","OPTION","BUTTON","SUMMARY","A"]),o3=new Set(["button","checkbox","combobox","link","listbox","menu","menubar","menuitem","menuitemcheckbox","menuitemradio","option","radio","searchbox","slider","spinbutton","switch","tab","textbox","treeitem"]);function gT(e){return typeof e.tagName=="string"?e.tagName.toUpperCase():""}function Rw(e){if(!e)return!1;if(e.isContentEditable)return!0;const t=gT(e);return t==="TEXTAREA"?!0:t!=="INPUT"?!1:!r3.has(String(e.type??"text").toLowerCase())}function i3(e){if(!e)return!1;if(Rw(e)||s3.has(gT(e)))return!0;const t=typeof e.role=="string"?e.role.trim().toLowerCase():"";return t!==""&&t.split(/\s+/).some(n=>o3.has(n))}function a3({key:e,modalOpen:t,sheetOpen:n}){return t?!(e==="?"&&n):!1}function yT(e){return e?Array.from(e.querySelectorAll("*")).filter(t=>{if(t.matches(o1))return e3({disabled:t.disabled,tabIndex:t.tabIndex,rendered:t.getClientRects().length>0});const n=t.scrollHeight>t.clientHeight;return n&&t3({overflowing:n,overflow:getComputedStyle(t).overflowY,hasFocusable:t.querySelector(o1)!=null})}):[]}function l3(e,t){const n=yT(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 kn(e,t={}){const{focusRef:n,layer:s}=t,i=_.useRef(null),a=_.useRef(e);a.current=e;const l=_.useRef(null);l.current===null&&(l.current=()=>a.current());const u=l.current;return _.useEffect(()=>Di.push(u,s),[u,s]),_.useEffect(()=>{var p;const h=document.activeElement;return(p=(n==null?void 0:n.current)??yT(i.current)[0])==null||p.focus(),()=>{JL(h,document.activeElement)&&h.focus()}},[]),_.useEffect(()=>{const h=p=>{var b;if(p.key!=="Tab"||Tw(p))return;const f=i.current;if(!f)return;const g=document.activeElement;if(!(g!=null&&f.contains(g))&&!Di.isTop(u))return;const w=l3(f,g),N=n3({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 c3(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 On(e){return e.toLocaleString()}function u3(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(2)} MB`}const d3=60;function f3(e,t=d3){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 h3({agent:e,onClose:t}){var v;const n=_.useRef(null),s=kn(t,{focusRef:n}),i=e.context,a=e.usage,l=(i==null?void 0:i.currentContextTokens)??0,u=cT(e.contextWindow,e.model),h=Math.min(100,l/u*100),p=xn(e),f=a.inputTokens+a.cacheReadTokens+a.cacheCreateTokens,g=c3(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:[On(l)," / ",On(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(tr,{label:"input tokens",val:On(a.inputTokens)}),d.jsx(tr,{label:"output tokens",val:On(a.outputTokens)}),d.jsx(tr,{label:"cache reads",val:On(a.cacheReadTokens)}),d.jsx(tr,{label:"cache writes",val:On(a.cacheCreateTokens)}),d.jsx(tr,{label:"cumulative total",val:On(f)}),d.jsx(tr,{label:"estimated cost",val:Ze(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(tr,{label:"user messages",val:On((i==null?void 0:i.msgsUser)??0)}),d.jsx(tr,{label:"assistant messages",val:On((i==null?void 0:i.msgsAssistant)??0)}),d.jsx(tr,{label:"tool uses",val:On((i==null?void 0:i.toolUses)??0)}),d.jsx(tr,{label:"tool results",val:On((i==null?void 0:i.toolResults)??0)}),d.jsx(tr,{label:"system-reminders",val:On((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}),(((v=i==null?void 0:i.memoryFiles)==null?void 0:v.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:f3(w.path)}),d.jsx("span",{className:"ctx-md-size",children:u3(w.bytes)})]},w.path))})]})})}function tr({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 p3({currentContextTokens:e,modelId:t,contextWindow:n,size:s=26,onClick:i}){const a=cT(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 i1(e,t){const n=Qi(t);if(!n)return`model: ${t}
61
- no published rate in this build — the tokens are counted, the dollars are not`;const s=f=>f.toLocaleString(),i=f=>`$${f}/MTok`,a=Cw(e,t),l=aT(e,n),u=l.tokens1h>0?[`cache w5m${s(l.tokens5m).padStart(14)} × ${i(n.cacheWrite).padEnd(11)} = ${Ze(l.usd5m)}`,`cache w1h${s(l.tokens1h).padStart(14)} × ${i(n.cacheWrite1h??n.cacheWrite).padEnd(11)} = ${Ze(l.usd1h)}`]:[`cache w ${s(l.tokens5m).padStart(14)} × ${i(n.cacheWrite).padEnd(11)} = ${Ze(l.usd5m)}`],h=lT(e,t),p=h===e.inputTokens?"input":"uncached";return[`model: ${t}`,`${p.padEnd(9)}${s(h).padStart(14)} × ${i(n.input).padEnd(11)} = ${Ze(a.input)}`,`output ${s(e.outputTokens).padStart(14)} × ${i(n.output).padEnd(11)} = ${Ze(a.output)}`,`cache r ${s(e.cacheReadTokens).padStart(14)} × ${i(n.cacheRead).padEnd(11)} = ${Ze(a.cacheRead)}`,...u,"─────────────────────────────────────────",`total = ${Ze(a.total)}`].join(`
62
- `)}function a1(e){const t=Sl(e);return t.length<=1?i1(e.usage,e.model):[...t.map(n=>i1(n.usage,n.model)),"═════════════════════════════════════════",`all models = ${Ze(xn(e).total)}`].join(`
63
- `)}function m3({data:e,selected:t}){var v;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=Ew(e.sessionId),l=((v=e.context)==null?void 0:v.currentContextTokens)??0,u=e.kind==="root"&&l>0,h=e.sessionTitle?e.cwd?`${e.cwd}
56
+ */var sb;function s2(){if(sb)return Uf;sb=1;var e=_l(),t=r2();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 Uf.useSyncExternalStoreWithSelector=function(p,f,g,v,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 S(O){if(!E){if(E=!0,C=O,O=v(O),w!==void 0&&b.hasValue){var P=b.value;if(w(P,O))return j=P}return j=O}if(P=j,s(C,O))return P;var z=v(O);return w!==void 0&&w(P,z)?(C=O,P):(C=O,j=z)}var E=!1,C,j,I=g===void 0?null:g;return[function(){return S(f())},I===null?void 0:function(){return S(I())}]},[f,g,v,w]);var k=i(p,N[0],N[1]);return l(function(){b.hasValue=!0,b.value=k},[k]),h(k),k},Uf}var ob;function o2(){return ob||(ob=1,Bf.exports=s2()),Bf.exports}var i2=o2();const a2=lw(i2),l2={},ib=e=>{let t;const n=new Set,s=(f,g)=>{const v=typeof f=="function"?f(t):f;if(!Object.is(v,t)){const w=t;t=g??(typeof v!="object"||v===null)?v:Object.assign({},t,v),n.forEach(N=>N(t,w))}},i=()=>t,h={setState:s,getState:i,getInitialState:()=>p,subscribe:f=>(n.add(f),()=>n.delete(f)),destroy:()=>{(l2?"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},c2=e=>e?ib(e):ib,{useDebugValue:u2}=de,{useSyncExternalStoreWithSelector:d2}=a2,f2=e=>e;function IC(e,t=f2,n){const s=d2(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return u2(s),s}const ab=(e,t)=>{const n=c2(e),s=(i,a=t)=>IC(n,i,a);return Object.assign(s,n),s},h2=(e,t)=>e?ab(e,t):ab;function qt(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 p2={value:()=>{}};function $u(){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 pu(n)}function pu(e){this._=e}function m2(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}})}pu.prototype=$u.prototype={constructor:pu,on:function(e,t){var n=this._,s=m2(e+"",n),i,a=-1,l=s.length;if(arguments.length<2){for(;++a<l;)if((i=(e=s[a]).type)&&(i=g2(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]=lb(n[i],e.name,t);else if(t==null)for(i in n)n[i]=lb(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 pu(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 g2(e,t){for(var n=0,s=e.length,i;n<s;++n)if((i=e[n]).name===t)return i.value}function lb(e,t,n){for(var s=0,i=e.length;s<i;++s)if(e[s].name===t){e[s]=p2,e=e.slice(0,s).concat(e.slice(s+1));break}return n!=null&&e.push({name:t,value:n}),e}var jv="http://www.w3.org/1999/xhtml";const cb={svg:"http://www.w3.org/2000/svg",xhtml:jv,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Lu(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),cb.hasOwnProperty(t)?{space:cb[t],local:e}:e}function y2(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===jv&&t.documentElement.namespaceURI===jv?t.createElement(e):t.createElementNS(n,e)}}function v2(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function OC(e){var t=Lu(e);return(t.local?v2:y2)(t)}function w2(){}function cw(e){return e==null?w2:function(){return this.querySelector(e)}}function x2(e){typeof e!="function"&&(e=cw(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 b2(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function k2(){return[]}function PC(e){return e==null?k2:function(){return this.querySelectorAll(e)}}function _2(e){return function(){return b2(e.apply(this,arguments))}}function S2(e){typeof e=="function"?e=_2(e):e=PC(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 $C(e){return function(){return this.matches(e)}}function LC(e){return function(t){return t.matches(e)}}var N2=Array.prototype.find;function E2(e){return function(){return N2.call(this.children,e)}}function C2(){return this.firstElementChild}function j2(e){return this.select(e==null?C2:E2(typeof e=="function"?e:LC(e)))}var T2=Array.prototype.filter;function R2(){return Array.from(this.children)}function A2(e){return function(){return T2.call(this.children,e)}}function M2(e){return this.selectAll(e==null?R2:A2(typeof e=="function"?e:LC(e)))}function I2(e){typeof e!="function"&&(e=$C(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 qC(e){return new Array(e.length)}function O2(){return new kn(this._enter||this._groups.map(qC),this._parents)}function xu(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}xu.prototype={constructor:xu,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function P2(e){return function(){return e}}function $2(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 xu(e,a[l]);for(;l<h;++l)(u=t[l])&&(i[l]=u)}function L2(e,t,n,s,i,a,l){var u,h,p=new Map,f=t.length,g=a.length,v=new Array(f),w;for(u=0;u<f;++u)(h=t[u])&&(v[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 xu(e,a[u]);for(u=0;u<f;++u)(h=t[u])&&p.get(v[u])===h&&(i[u]=h)}function q2(e){return e.__data__}function D2(e,t){if(!arguments.length)return Array.from(this,q2);var n=t?L2:$2,s=this._parents,i=this._groups;typeof e!="function"&&(e=P2(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],v=g.length,w=F2(e.call(f,f&&f.__data__,p,s)),N=w.length,b=u[p]=new Array(N),k=l[p]=new Array(N),S=h[p]=new Array(v);n(f,g,b,k,S,w,t);for(var E=0,C=0,j,I;E<N;++E)if(j=b[E]){for(E>=C&&(C=E+1);!(I=k[C])&&++C<N;);j._next=I||null}}return l=new kn(l,s),l._enter=u,l._exit=h,l}function F2(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function z2(){return new kn(this._exit||this._groups.map(qC),this._parents)}function B2(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 U2(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,v=u[h]=new Array(g),w,N=0;N<g;++N)(w=p[N]||f[N])&&(v[N]=w);for(;h<i;++h)u[h]=n[h];return new kn(u,this._parents)}function W2(){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 H2(e){e||(e=G2);function t(g,v){return g&&v?e(g.__data__,v.__data__):!g-!v}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 G2(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function V2(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Y2(){return Array.from(this)}function K2(){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 X2(){let e=0;for(const t of this)++e;return e}function Q2(){return!this.node()}function Z2(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 J2(e){return function(){this.removeAttribute(e)}}function eM(e){return function(){this.removeAttributeNS(e.space,e.local)}}function tM(e,t){return function(){this.setAttribute(e,t)}}function nM(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function rM(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function sM(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 oM(e,t){var n=Lu(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?eM:J2:typeof t=="function"?n.local?sM:rM:n.local?nM:tM)(n,t))}function DC(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function iM(e){return function(){this.style.removeProperty(e)}}function aM(e,t,n){return function(){this.style.setProperty(e,t,n)}}function lM(e,t,n){return function(){var s=t.apply(this,arguments);s==null?this.style.removeProperty(e):this.style.setProperty(e,s,n)}}function cM(e,t,n){return arguments.length>1?this.each((t==null?iM:typeof t=="function"?lM:aM)(e,t,n??"")):zi(this.node(),e)}function zi(e,t){return e.style.getPropertyValue(t)||DC(e).getComputedStyle(e,null).getPropertyValue(t)}function uM(e){return function(){delete this[e]}}function dM(e,t){return function(){this[e]=t}}function fM(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function hM(e,t){return arguments.length>1?this.each((t==null?uM:typeof t=="function"?fM:dM)(e,t)):this.node()[e]}function FC(e){return e.trim().split(/^|\s+/)}function uw(e){return e.classList||new zC(e)}function zC(e){this._node=e,this._names=FC(e.getAttribute("class")||"")}zC.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 BC(e,t){for(var n=uw(e),s=-1,i=t.length;++s<i;)n.add(t[s])}function UC(e,t){for(var n=uw(e),s=-1,i=t.length;++s<i;)n.remove(t[s])}function pM(e){return function(){BC(this,e)}}function mM(e){return function(){UC(this,e)}}function gM(e,t){return function(){(t.apply(this,arguments)?BC:UC)(this,e)}}function yM(e,t){var n=FC(e+"");if(arguments.length<2){for(var s=uw(this.node()),i=-1,a=n.length;++i<a;)if(!s.contains(n[i]))return!1;return!0}return this.each((typeof t=="function"?gM:t?pM:mM)(n,t))}function vM(){this.textContent=""}function wM(e){return function(){this.textContent=e}}function xM(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function bM(e){return arguments.length?this.each(e==null?vM:(typeof e=="function"?xM:wM)(e)):this.node().textContent}function kM(){this.innerHTML=""}function _M(e){return function(){this.innerHTML=e}}function SM(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function NM(e){return arguments.length?this.each(e==null?kM:(typeof e=="function"?SM:_M)(e)):this.node().innerHTML}function EM(){this.nextSibling&&this.parentNode.appendChild(this)}function CM(){return this.each(EM)}function jM(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function TM(){return this.each(jM)}function RM(e){var t=typeof e=="function"?e:OC(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function AM(){return null}function MM(e,t){var n=typeof e=="function"?e:OC(e),s=t==null?AM:typeof t=="function"?t:cw(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),s.apply(this,arguments)||null)})}function IM(){var e=this.parentNode;e&&e.removeChild(this)}function OM(){return this.each(IM)}function PM(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function $M(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function LM(e){return this.select(e?$M:PM)}function qM(e){return arguments.length?this.property("__data__",e):this.node().__data__}function DM(e){return function(t){e.call(this,t,this.__data__)}}function FM(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 zM(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 BM(e,t,n){return function(){var s=this.__on,i,a=DM(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 UM(e,t,n){var s=FM(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?BM:zM,i=0;i<a;++i)this.each(u(s[i],t,n));return this}function WC(e,t,n){var s=DC(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 WM(e,t){return function(){return WC(this,e,t)}}function HM(e,t){return function(){return WC(this,e,t.apply(this,arguments))}}function GM(e,t){return this.each((typeof t=="function"?HM:WM)(e,t))}function*VM(){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 HC=[null];function kn(e,t){this._groups=e,this._parents=t}function Sl(){return new kn([[document.documentElement]],HC)}function YM(){return this}kn.prototype=Sl.prototype={constructor:kn,select:x2,selectAll:S2,selectChild:j2,selectChildren:M2,filter:I2,data:D2,enter:O2,exit:z2,join:B2,merge:U2,selection:YM,order:W2,sort:H2,call:V2,nodes:Y2,node:K2,size:X2,empty:Q2,each:Z2,attr:oM,style:cM,property:hM,classed:yM,text:bM,html:NM,raise:CM,lower:TM,append:RM,insert:MM,remove:OM,clone:LM,datum:qM,on:UM,dispatch:GM,[Symbol.iterator]:VM};function $n(e){return typeof e=="string"?new kn([[document.querySelector(e)]],[document.documentElement]):new kn([[e]],HC)}function KM(e){let t;for(;t=e.sourceEvent;)e=t;return e}function sr(e,t){if(e=KM(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 XM={passive:!1},ul={capture:!0,passive:!1};function Gf(e){e.stopImmediatePropagation()}function Pi(e){e.preventDefault(),e.stopImmediatePropagation()}function GC(e){var t=e.document.documentElement,n=$n(e).on("dragstart.drag",Pi,ul);"onselectstart"in t?n.on("selectstart.drag",Pi,ul):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function VC(e,t){var n=e.document.documentElement,s=$n(e).on("dragstart.drag",null);t&&(s.on("click.drag",Pi,ul),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 Kc=e=>()=>e;function Tv(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}})}Tv.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function QM(e){return!e.ctrlKey&&!e.button}function ZM(){return this.parentNode}function JM(e,t){return t??{x:e.x,y:e.y}}function eI(){return navigator.maxTouchPoints||"ontouchstart"in this}function tI(){var e=QM,t=ZM,n=JM,s=eI,i={},a=$u("start","drag","end"),l=0,u,h,p,f,g=0;function v(j){j.on("mousedown.drag",w).filter(s).on("touchstart.drag",k).on("touchmove.drag",S,XM).on("touchend.drag touchcancel.drag",E).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function w(j,I){if(!(f||!e.call(this,j,I))){var O=C(this,t.call(this,j,I),j,I,"mouse");O&&($n(j.view).on("mousemove.drag",N,ul).on("mouseup.drag",b,ul),GC(j.view),Gf(j),p=!1,u=j.clientX,h=j.clientY,O("start",j))}}function N(j){if(Pi(j),!p){var I=j.clientX-u,O=j.clientY-h;p=I*I+O*O>g}i.mouse("drag",j)}function b(j){$n(j.view).on("mousemove.drag mouseup.drag",null),VC(j.view,p),Pi(j),i.mouse("end",j)}function k(j,I){if(e.call(this,j,I)){var O=j.changedTouches,P=t.call(this,j,I),z=O.length,M,A;for(M=0;M<z;++M)(A=C(this,P,j,I,O[M].identifier,O[M]))&&(Gf(j),A("start",j,O[M]))}}function S(j){var I=j.changedTouches,O=I.length,P,z;for(P=0;P<O;++P)(z=i[I[P].identifier])&&(Pi(j),z("drag",j,I[P]))}function E(j){var I=j.changedTouches,O=I.length,P,z;for(f&&clearTimeout(f),f=setTimeout(function(){f=null},500),P=0;P<O;++P)(z=i[I[P].identifier])&&(Gf(j),z("end",j,I[P]))}function C(j,I,O,P,z,M){var A=a.copy(),q=sr(M||O,I),G,Y,R;if((R=n.call(j,new Tv("beforestart",{sourceEvent:O,target:v,identifier:z,active:l,x:q[0],y:q[1],dx:0,dy:0,dispatch:A}),P))!=null)return G=R.x-q[0]||0,Y=R.y-q[1]||0,function Q(H,ne,X){var U=q,J;switch(H){case"start":i[z]=Q,J=l++;break;case"end":delete i[z],--l;case"drag":q=sr(X||ne,I),J=l;break}A.call(H,j,new Tv(H,{sourceEvent:ne,subject:R,target:v,identifier:z,active:J,x:q[0]+G,y:q[1]+Y,dx:q[0]-U[0],dy:q[1]-U[1],dispatch:A}),P)}}return v.filter=function(j){return arguments.length?(e=typeof j=="function"?j:Kc(!!j),v):e},v.container=function(j){return arguments.length?(t=typeof j=="function"?j:Kc(j),v):t},v.subject=function(j){return arguments.length?(n=typeof j=="function"?j:Kc(j),v):n},v.touchable=function(j){return arguments.length?(s=typeof j=="function"?j:Kc(!!j),v):s},v.on=function(){var j=a.on.apply(a,arguments);return j===a?v:j},v.clickDistance=function(j){return arguments.length?(g=(j=+j)*j,v):Math.sqrt(g)},v}function dw(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function YC(e,t){var n=Object.create(e.prototype);for(var s in t)n[s]=t[s];return n}function Nl(){}var dl=.7,bu=1/dl,$i="\\s*([+-]?\\d+)\\s*",fl="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Er="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",nI=/^#([0-9a-f]{3,8})$/,rI=new RegExp(`^rgb\\(${$i},${$i},${$i}\\)$`),sI=new RegExp(`^rgb\\(${Er},${Er},${Er}\\)$`),oI=new RegExp(`^rgba\\(${$i},${$i},${$i},${fl}\\)$`),iI=new RegExp(`^rgba\\(${Er},${Er},${Er},${fl}\\)$`),aI=new RegExp(`^hsl\\(${fl},${Er},${Er}\\)$`),lI=new RegExp(`^hsla\\(${fl},${Er},${Er},${fl}\\)$`),ub={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};dw(Nl,hl,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:db,formatHex:db,formatHex8:cI,formatHsl:uI,formatRgb:fb,toString:fb});function db(){return this.rgb().formatHex()}function cI(){return this.rgb().formatHex8()}function uI(){return KC(this).formatHsl()}function fb(){return this.rgb().formatRgb()}function hl(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=nI.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?hb(t):n===3?new dn(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Xc(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Xc(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=rI.exec(e))?new dn(t[1],t[2],t[3],1):(t=sI.exec(e))?new dn(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=oI.exec(e))?Xc(t[1],t[2],t[3],t[4]):(t=iI.exec(e))?Xc(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=aI.exec(e))?gb(t[1],t[2]/100,t[3]/100,1):(t=lI.exec(e))?gb(t[1],t[2]/100,t[3]/100,t[4]):ub.hasOwnProperty(e)?hb(ub[e]):e==="transparent"?new dn(NaN,NaN,NaN,0):null}function hb(e){return new dn(e>>16&255,e>>8&255,e&255,1)}function Xc(e,t,n,s){return s<=0&&(e=t=n=NaN),new dn(e,t,n,s)}function dI(e){return e instanceof Nl||(e=hl(e)),e?(e=e.rgb(),new dn(e.r,e.g,e.b,e.opacity)):new dn}function Rv(e,t,n,s){return arguments.length===1?dI(e):new dn(e,t,n,s??1)}function dn(e,t,n,s){this.r=+e,this.g=+t,this.b=+n,this.opacity=+s}dw(dn,Rv,YC(Nl,{brighter(e){return e=e==null?bu:Math.pow(bu,e),new dn(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?dl:Math.pow(dl,e),new dn(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new dn(bo(this.r),bo(this.g),bo(this.b),ku(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:pb,formatHex:pb,formatHex8:fI,formatRgb:mb,toString:mb}));function pb(){return`#${wo(this.r)}${wo(this.g)}${wo(this.b)}`}function fI(){return`#${wo(this.r)}${wo(this.g)}${wo(this.b)}${wo((isNaN(this.opacity)?1:this.opacity)*255)}`}function mb(){const e=ku(this.opacity);return`${e===1?"rgb(":"rgba("}${bo(this.r)}, ${bo(this.g)}, ${bo(this.b)}${e===1?")":`, ${e})`}`}function ku(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function bo(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function wo(e){return e=bo(e),(e<16?"0":"")+e.toString(16)}function gb(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 KC(e){if(e instanceof or)return new or(e.h,e.s,e.l,e.opacity);if(e instanceof Nl||(e=hl(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 hI(e,t,n,s){return arguments.length===1?KC(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}dw(or,hI,YC(Nl,{brighter(e){return e=e==null?bu:Math.pow(bu,e),new or(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?dl:Math.pow(dl,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 dn(Vf(e>=240?e-240:e+120,i,s),Vf(e,i,s),Vf(e<120?e+240:e-120,i,s),this.opacity)},clamp(){return new or(yb(this.h),Qc(this.s),Qc(this.l),ku(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=ku(this.opacity);return`${e===1?"hsl(":"hsla("}${yb(this.h)}, ${Qc(this.s)*100}%, ${Qc(this.l)*100}%${e===1?")":`, ${e})`}`}}));function yb(e){return e=(e||0)%360,e<0?e+360:e}function Qc(e){return Math.max(0,Math.min(1,e||0))}function Vf(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 XC=e=>()=>e;function pI(e,t){return function(n){return e+n*t}}function mI(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 gI(e){return(e=+e)==1?QC:function(t,n){return n-t?mI(t,n,e):XC(isNaN(t)?n:t)}}function QC(e,t){var n=t-e;return n?pI(e,n):XC(isNaN(e)?t:e)}const vb=(function e(t){var n=gI(t);function s(i,a){var l=n((i=Rv(i)).r,(a=Rv(a)).r),u=n(i.g,a.g),h=n(i.b,a.b),p=QC(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 Ms(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var Av=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Yf=new RegExp(Av.source,"g");function yI(e){return function(){return e}}function vI(e){return function(t){return e(t)+""}}function wI(e,t){var n=Av.lastIndex=Yf.lastIndex=0,s,i,a,l=-1,u=[],h=[];for(e=e+"",t=t+"";(s=Av.exec(e))&&(i=Yf.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:Ms(s,i)})),n=Yf.lastIndex;return n<t.length&&(a=t.slice(n),u[l]?u[l]+=a:u[++l]=a),u.length<2?h[0]?vI(h[0].x):yI(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 wb=180/Math.PI,Mv={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function ZC(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)*wb,skewX:Math.atan(h)*wb,scaleX:l,scaleY:u}}var Zc;function xI(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Mv:ZC(t.a,t.b,t.c,t.d,t.e,t.f)}function bI(e){return e==null||(Zc||(Zc=document.createElementNS("http://www.w3.org/2000/svg","g")),Zc.setAttribute("transform",e),!(e=Zc.transform.baseVal.consolidate()))?Mv:(e=e.matrix,ZC(e.a,e.b,e.c,e.d,e.e,e.f))}function JC(e,t,n,s){function i(p){return p.length?p.pop()+" ":""}function a(p,f,g,v,w,N){if(p!==g||f!==v){var b=w.push("translate(",null,t,null,n);N.push({i:b-4,x:Ms(p,g)},{i:b-2,x:Ms(f,v)})}else(g||v)&&w.push("translate("+g+t+v+n)}function l(p,f,g,v){p!==f?(p-f>180?f+=360:f-p>180&&(p+=360),v.push({i:g.push(i(g)+"rotate(",null,s)-2,x:Ms(p,f)})):f&&g.push(i(g)+"rotate("+f+s)}function u(p,f,g,v){p!==f?v.push({i:g.push(i(g)+"skewX(",null,s)-2,x:Ms(p,f)}):f&&g.push(i(g)+"skewX("+f+s)}function h(p,f,g,v,w,N){if(p!==g||f!==v){var b=w.push(i(w)+"scale(",null,",",null,")");N.push({i:b-4,x:Ms(p,g)},{i:b-2,x:Ms(f,v)})}else(g!==1||v!==1)&&w.push(i(w)+"scale("+g+","+v+")")}return function(p,f){var g=[],v=[];return p=e(p),f=e(f),a(p.translateX,p.translateY,f.translateX,f.translateY,g,v),l(p.rotate,f.rotate,g,v),u(p.skewX,f.skewX,g,v),h(p.scaleX,p.scaleY,f.scaleX,f.scaleY,g,v),p=f=null,function(w){for(var N=-1,b=v.length,k;++N<b;)g[(k=v[N]).i]=k.x(w);return g.join("")}}}var kI=JC(xI,"px, ","px)","deg)"),_I=JC(bI,", ",")",")"),SI=1e-12;function xb(e){return((e=Math.exp(e))+1/e)/2}function NI(e){return((e=Math.exp(e))-1/e)/2}function EI(e){return((e=Math.exp(2*e))-1)/(e+1)}const CI=(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],v=l[2],w=f-u,N=g-h,b=w*w+N*N,k,S;if(b<SI)S=Math.log(v/p)/t,k=function(P){return[u+P*w,h+P*N,p*Math.exp(t*P*S)]};else{var E=Math.sqrt(b),C=(v*v-p*p+s*b)/(2*p*n*E),j=(v*v-p*p-s*b)/(2*v*n*E),I=Math.log(Math.sqrt(C*C+1)-C),O=Math.log(Math.sqrt(j*j+1)-j);S=(O-I)/t,k=function(P){var z=P*S,M=xb(I),A=p/(n*E)*(M*EI(t*z+I)-NI(I));return[u+A*w,h+A*N,p*M/xb(t*z+I)]}}return k.duration=S*1e3*t/Math.SQRT2,k}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 Bi=0,rl=0,Ya=0,ej=1e3,_u,sl,Su=0,_o=0,qu=0,pl=typeof performance=="object"&&performance.now?performance:Date,tj=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function fw(){return _o||(tj(jI),_o=pl.now()+qu)}function jI(){_o=0}function Nu(){this._call=this._time=this._next=null}Nu.prototype=nj.prototype={constructor:Nu,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?fw():+n)+(t==null?0:+t),!this._next&&sl!==this&&(sl?sl._next=this:_u=this,sl=this),this._call=e,this._time=n,Iv()},stop:function(){this._call&&(this._call=null,this._time=1/0,Iv())}};function nj(e,t,n){var s=new Nu;return s.restart(e,t,n),s}function TI(){fw(),++Bi;for(var e=_u,t;e;)(t=_o-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Bi}function bb(){_o=(Su=pl.now())+qu,Bi=rl=0;try{TI()}finally{Bi=0,AI(),_o=0}}function RI(){var e=pl.now(),t=e-Su;t>ej&&(qu-=t,Su=e)}function AI(){for(var e,t=_u,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:_u=n);sl=e,Iv(s)}function Iv(e){if(!Bi){rl&&(rl=clearTimeout(rl));var t=e-_o;t>24?(e<1/0&&(rl=setTimeout(bb,e-pl.now()-qu)),Ya&&(Ya=clearInterval(Ya))):(Ya||(Su=pl.now(),Ya=setInterval(RI,ej)),Bi=1,tj(bb))}}function kb(e,t,n){var s=new Nu;return t=t==null?0:+t,s.restart(i=>{s.stop(),e(i+t)},t,n),s}var MI=$u("start","end","cancel","interrupt"),II=[],rj=0,_b=1,Ov=2,mu=3,Sb=4,Pv=5,gu=6;function Du(e,t,n,s,i,a){var l=e.__transition;if(!l)e.__transition={};else if(n in l)return;OI(e,n,{name:t,index:s,group:i,on:MI,tween:II,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:rj})}function hw(e,t){var n=ur(e,t);if(n.state>rj)throw new Error("too late; already scheduled");return n}function Cr(e,t){var n=ur(e,t);if(n.state>mu)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 OI(e,t,n){var s=e.__transition,i;s[t]=n,n.timer=nj(a,0,n.time);function a(p){n.state=_b,n.timer.restart(l,n.delay,n.time),n.delay<=p&&l(p-n.delay)}function l(p){var f,g,v,w;if(n.state!==_b)return h();for(f in s)if(w=s[f],w.name===n.name){if(w.state===mu)return kb(l);w.state===Sb?(w.state=gu,w.timer.stop(),w.on.call("interrupt",e,e.__data__,w.index,w.group),delete s[f]):+f<t&&(w.state=gu,w.timer.stop(),w.on.call("cancel",e,e.__data__,w.index,w.group),delete s[f])}if(kb(function(){n.state===mu&&(n.state=Sb,n.timer.restart(u,n.delay,n.time),u(p))}),n.state=Ov,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Ov){for(n.state=mu,i=new Array(v=n.tween.length),f=0,g=-1;f<v;++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=Pv,1),g=-1,v=i.length;++g<v;)i[g].call(e,f);n.state===Pv&&(n.on.call("end",e,e.__data__,n.index,n.group),h())}function h(){n.state=gu,n.timer.stop(),delete s[t];for(var p in s)return;delete e.__transition}}function yu(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>Ov&&s.state<Pv,s.state=gu,s.timer.stop(),s.on.call(i?"interrupt":"cancel",e,e.__data__,s.index,s.group),delete n[l]}a&&delete e.__transition}}function PI(e){return this.each(function(){yu(this,e)})}function $I(e,t){var n,s;return function(){var i=Cr(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 LI(e,t,n){var s,i;if(typeof n!="function")throw new Error;return function(){var a=Cr(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 qI(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?$I:LI)(n,e,t))}function pw(e,t,n){var s=e._id;return e.each(function(){var i=Cr(this,s);(i.value||(i.value={}))[t]=n.apply(this,arguments)}),function(i){return ur(i,s).value[t]}}function sj(e,t){var n;return(typeof t=="number"?Ms:t instanceof hl?vb:(n=hl(t))?(t=n,vb):wI)(e,t)}function DI(e){return function(){this.removeAttribute(e)}}function FI(e){return function(){this.removeAttributeNS(e.space,e.local)}}function zI(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 BI(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 UI(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 WI(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 HI(e,t){var n=Lu(e),s=n==="transform"?_I:sj;return this.attrTween(e,typeof t=="function"?(n.local?WI:UI)(n,s,pw(this,"attr."+e,t)):t==null?(n.local?FI:DI)(n):(n.local?BI:zI)(n,s,t))}function GI(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function VI(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function YI(e,t){var n,s;function i(){var a=t.apply(this,arguments);return a!==s&&(n=(s=a)&&VI(e,a)),n}return i._value=t,i}function KI(e,t){var n,s;function i(){var a=t.apply(this,arguments);return a!==s&&(n=(s=a)&&GI(e,a)),n}return i._value=t,i}function XI(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=Lu(e);return this.tween(n,(s.local?YI:KI)(s,t))}function QI(e,t){return function(){hw(this,e).delay=+t.apply(this,arguments)}}function ZI(e,t){return t=+t,function(){hw(this,e).delay=t}}function JI(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?QI:ZI)(t,e)):ur(this.node(),t).delay}function eO(e,t){return function(){Cr(this,e).duration=+t.apply(this,arguments)}}function tO(e,t){return t=+t,function(){Cr(this,e).duration=t}}function nO(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?eO:tO)(t,e)):ur(this.node(),t).duration}function rO(e,t){if(typeof t!="function")throw new Error;return function(){Cr(this,e).ease=t}}function sO(e){var t=this._id;return arguments.length?this.each(rO(t,e)):ur(this.node(),t).ease}function oO(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Cr(this,e).ease=n}}function iO(e){if(typeof e!="function")throw new Error;return this.each(oO(this._id,e))}function aO(e){typeof e!="function"&&(e=$C(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 Zr(s,this._parents,this._name,this._id)}function lO(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),v,w=0;w<f;++w)(v=h[w]||p[w])&&(g[w]=v);for(;u<s;++u)l[u]=t[u];return new Zr(l,this._parents,this._name,this._id)}function cO(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 uO(e,t,n){var s,i,a=cO(t)?hw:Cr;return function(){var l=a(this,e),u=l.on;u!==s&&(i=(s=u).copy()).on(t,n),l.on=i}}function dO(e,t){var n=this._id;return arguments.length<2?ur(this.node(),n).on.on(e):this.each(uO(n,e,t))}function fO(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function hO(){return this.on("end.remove",fO(this._id))}function pO(e){var t=this._name,n=this._id;typeof e!="function"&&(e=cw(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,v=0;v<h;++v)(f=u[v])&&(g=e.call(f,f.__data__,v,u))&&("__data__"in f&&(g.__data__=f.__data__),p[v]=g,Du(p[v],t,n,v,p,ur(f,n)));return new Zr(a,this._parents,t,n)}function mO(e){var t=this._name,n=this._id;typeof e!="function"&&(e=PC(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 v=e.call(f,f.__data__,g,h),w,N=ur(f,n),b=0,k=v.length;b<k;++b)(w=v[b])&&Du(w,t,n,b,v,N);a.push(v),l.push(f)}return new Zr(a,l,t,n)}var gO=Sl.prototype.constructor;function yO(){return new gO(this._groups,this._parents)}function vO(e,t){var n,s,i;return function(){var a=zi(this,e),l=(this.style.removeProperty(e),zi(this,e));return a===l?null:a===n&&l===s?i:i=t(n=a,s=l)}}function oj(e){return function(){this.style.removeProperty(e)}}function wO(e,t,n){var s,i=n+"",a;return function(){var l=zi(this,e);return l===i?null:l===s?a:a=t(s=l,n)}}function xO(e,t,n){var s,i,a;return function(){var l=zi(this,e),u=n(this),h=u+"";return u==null&&(h=u=(this.style.removeProperty(e),zi(this,e))),l===h?null:l===s&&h===i?a:(i=h,a=t(s=l,u))}}function bO(e,t){var n,s,i,a="style."+t,l="end."+a,u;return function(){var h=Cr(this,e),p=h.on,f=h.value[a]==null?u||(u=oj(t)):void 0;(p!==n||i!==f)&&(s=(n=p).copy()).on(l,i=f),h.on=s}}function kO(e,t,n){var s=(e+="")=="transform"?kI:sj;return t==null?this.styleTween(e,vO(e,s)).on("end.style."+e,oj(e)):typeof t=="function"?this.styleTween(e,xO(e,s,pw(this,"style."+e,t))).each(bO(this._id,e)):this.styleTween(e,wO(e,s,t),n).on("end.style."+e,null)}function _O(e,t,n){return function(s){this.style.setProperty(e,t.call(this,s),n)}}function SO(e,t,n){var s,i;function a(){var l=t.apply(this,arguments);return l!==i&&(s=(i=l)&&_O(e,l,n)),s}return a._value=t,a}function NO(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,SO(e,t,n??""))}function EO(e){return function(){this.textContent=e}}function CO(e){return function(){var t=e(this);this.textContent=t??""}}function jO(e){return this.tween("text",typeof e=="function"?CO(pw(this,"text",e)):EO(e==null?"":e+""))}function TO(e){return function(t){this.textContent=e.call(this,t)}}function RO(e){var t,n;function s(){var i=e.apply(this,arguments);return i!==n&&(t=(n=i)&&TO(i)),t}return s._value=e,s}function AO(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,RO(e))}function MO(){for(var e=this._name,t=this._id,n=ij(),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);Du(h,e,n,p,l,{time:f.time+f.delay+f.duration,delay:0,duration:f.duration,ease:f.ease})}return new Zr(s,this._parents,e,n)}function IO(){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=Cr(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 OO=0;function Zr(e,t,n,s){this._groups=e,this._parents=t,this._name=n,this._id=s}function ij(){return++OO}var Kr=Sl.prototype;Zr.prototype={constructor:Zr,select:pO,selectAll:mO,selectChild:Kr.selectChild,selectChildren:Kr.selectChildren,filter:aO,merge:lO,selection:yO,transition:MO,call:Kr.call,nodes:Kr.nodes,node:Kr.node,size:Kr.size,empty:Kr.empty,each:Kr.each,on:dO,attr:HI,attrTween:XI,style:kO,styleTween:NO,text:jO,textTween:AO,remove:hO,tween:qI,delay:JI,duration:nO,ease:sO,easeVarying:iO,end:IO,[Symbol.iterator]:Kr[Symbol.iterator]};function PO(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var $O={time:null,delay:0,duration:250,ease:PO};function LO(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 qO(e){var t,n;e instanceof Zr?(t=e._id,e=e._name):(t=ij(),(n=$O).time=fw(),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])&&Du(h,e,t,p,l,n||LO(h,t));return new Zr(s,this._parents,e,t)}Sl.prototype.interrupt=PI;Sl.prototype.transition=qO;const Jc=e=>()=>e;function DO(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 Xr(e,t,n){this.k=e,this.x=t,this.y=n}Xr.prototype={constructor:Xr,scale:function(e){return e===1?this:new Xr(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Xr(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 Qr=new Xr(1,0,0);Xr.prototype;function Kf(e){e.stopImmediatePropagation()}function Ka(e){e.preventDefault(),e.stopImmediatePropagation()}function FO(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function zO(){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 Nb(){return this.__zoom||Qr}function BO(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function UO(){return navigator.maxTouchPoints||"ontouchstart"in this}function WO(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 aj(){var e=FO,t=zO,n=WO,s=BO,i=UO,a=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],u=250,h=CI,p=$u("start","zoom","end"),f,g,v,w=500,N=150,b=0,k=10;function S(R){R.property("__zoom",Nb).on("wheel.zoom",z,{passive:!1}).on("mousedown.zoom",M).on("dblclick.zoom",A).filter(i).on("touchstart.zoom",q).on("touchmove.zoom",G).on("touchend.zoom touchcancel.zoom",Y).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}S.transform=function(R,Q,H,ne){var X=R.selection?R.selection():R;X.property("__zoom",Nb),R!==X?I(R,Q,H,ne):X.interrupt().each(function(){O(this,arguments).event(ne).start().zoom(null,typeof Q=="function"?Q.apply(this,arguments):Q).end()})},S.scaleBy=function(R,Q,H,ne){S.scaleTo(R,function(){var X=this.__zoom.k,U=typeof Q=="function"?Q.apply(this,arguments):Q;return X*U},H,ne)},S.scaleTo=function(R,Q,H,ne){S.transform(R,function(){var X=t.apply(this,arguments),U=this.__zoom,J=H==null?j(X):typeof H=="function"?H.apply(this,arguments):H,$=U.invert(J),V=typeof Q=="function"?Q.apply(this,arguments):Q;return n(C(E(U,V),J,$),X,l)},H,ne)},S.translateBy=function(R,Q,H,ne){S.transform(R,function(){return n(this.__zoom.translate(typeof Q=="function"?Q.apply(this,arguments):Q,typeof H=="function"?H.apply(this,arguments):H),t.apply(this,arguments),l)},null,ne)},S.translateTo=function(R,Q,H,ne,X){S.transform(R,function(){var U=t.apply(this,arguments),J=this.__zoom,$=ne==null?j(U):typeof ne=="function"?ne.apply(this,arguments):ne;return n(Qr.translate($[0],$[1]).scale(J.k).translate(typeof Q=="function"?-Q.apply(this,arguments):-Q,typeof H=="function"?-H.apply(this,arguments):-H),U,l)},ne,X)};function E(R,Q){return Q=Math.max(a[0],Math.min(a[1],Q)),Q===R.k?R:new Xr(Q,R.x,R.y)}function C(R,Q,H){var ne=Q[0]-H[0]*R.k,X=Q[1]-H[1]*R.k;return ne===R.x&&X===R.y?R:new Xr(R.k,ne,X)}function j(R){return[(+R[0][0]+ +R[1][0])/2,(+R[0][1]+ +R[1][1])/2]}function I(R,Q,H,ne){R.on("start.zoom",function(){O(this,arguments).event(ne).start()}).on("interrupt.zoom end.zoom",function(){O(this,arguments).event(ne).end()}).tween("zoom",function(){var X=this,U=arguments,J=O(X,U).event(ne),$=t.apply(X,U),V=H==null?j($):typeof H=="function"?H.apply(X,U):H,Z=Math.max($[1][0]-$[0][0],$[1][1]-$[0][1]),D=X.__zoom,L=typeof Q=="function"?Q.apply(X,U):Q,K=h(D.invert(V).concat(Z/D.k),L.invert(V).concat(Z/L.k));return function(se){if(se===1)se=L;else{var he=K(se),me=Z/he[2];se=new Xr(me,V[0]-he[0]*me,V[1]-he[1]*me)}J.zoom(null,se)}})}function O(R,Q,H){return!H&&R.__zooming||new P(R,Q)}function P(R,Q){this.that=R,this.args=Q,this.active=0,this.sourceEvent=null,this.extent=t.apply(R,Q),this.taps=0}P.prototype={event:function(R){return R&&(this.sourceEvent=R),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(R,Q){return this.mouse&&R!=="mouse"&&(this.mouse[1]=Q.invert(this.mouse[0])),this.touch0&&R!=="touch"&&(this.touch0[1]=Q.invert(this.touch0[0])),this.touch1&&R!=="touch"&&(this.touch1[1]=Q.invert(this.touch1[0])),this.that.__zoom=Q,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(R){var Q=$n(this.that).datum();p.call(R,this.that,new DO(R,{sourceEvent:this.sourceEvent,target:S,transform:this.that.__zoom,dispatch:p}),Q)}};function z(R,...Q){if(!e.apply(this,arguments))return;var H=O(this,Q).event(R),ne=this.__zoom,X=Math.max(a[0],Math.min(a[1],ne.k*Math.pow(2,s.apply(this,arguments)))),U=sr(R);if(H.wheel)(H.mouse[0][0]!==U[0]||H.mouse[0][1]!==U[1])&&(H.mouse[1]=ne.invert(H.mouse[0]=U)),clearTimeout(H.wheel);else{if(ne.k===X)return;H.mouse=[U,ne.invert(U)],yu(this),H.start()}Ka(R),H.wheel=setTimeout(J,N),H.zoom("mouse",n(C(E(ne,X),H.mouse[0],H.mouse[1]),H.extent,l));function J(){H.wheel=null,H.end()}}function M(R,...Q){if(v||!e.apply(this,arguments))return;var H=R.currentTarget,ne=O(this,Q,!0).event(R),X=$n(R.view).on("mousemove.zoom",V,!0).on("mouseup.zoom",Z,!0),U=sr(R,H),J=R.clientX,$=R.clientY;GC(R.view),Kf(R),ne.mouse=[U,this.__zoom.invert(U)],yu(this),ne.start();function V(D){if(Ka(D),!ne.moved){var L=D.clientX-J,K=D.clientY-$;ne.moved=L*L+K*K>b}ne.event(D).zoom("mouse",n(C(ne.that.__zoom,ne.mouse[0]=sr(D,H),ne.mouse[1]),ne.extent,l))}function Z(D){X.on("mousemove.zoom mouseup.zoom",null),VC(D.view,ne.moved),Ka(D),ne.event(D).end()}}function A(R,...Q){if(e.apply(this,arguments)){var H=this.__zoom,ne=sr(R.changedTouches?R.changedTouches[0]:R,this),X=H.invert(ne),U=H.k*(R.shiftKey?.5:2),J=n(C(E(H,U),ne,X),t.apply(this,Q),l);Ka(R),u>0?$n(this).transition().duration(u).call(I,J,ne,R):$n(this).call(S.transform,J,ne,R)}}function q(R,...Q){if(e.apply(this,arguments)){var H=R.touches,ne=H.length,X=O(this,Q,R.changedTouches.length===ne).event(R),U,J,$,V;for(Kf(R),J=0;J<ne;++J)$=H[J],V=sr($,this),V=[V,this.__zoom.invert(V),$.identifier],X.touch0?!X.touch1&&X.touch0[2]!==V[2]&&(X.touch1=V,X.taps=0):(X.touch0=V,U=!0,X.taps=1+!!f);f&&(f=clearTimeout(f)),U&&(X.taps<2&&(g=V[0],f=setTimeout(function(){f=null},w)),yu(this),X.start())}}function G(R,...Q){if(this.__zooming){var H=O(this,Q).event(R),ne=R.changedTouches,X=ne.length,U,J,$,V;for(Ka(R),U=0;U<X;++U)J=ne[U],$=sr(J,this),H.touch0&&H.touch0[2]===J.identifier?H.touch0[0]=$:H.touch1&&H.touch1[2]===J.identifier&&(H.touch1[0]=$);if(J=H.that.__zoom,H.touch1){var Z=H.touch0[0],D=H.touch0[1],L=H.touch1[0],K=H.touch1[1],se=(se=L[0]-Z[0])*se+(se=L[1]-Z[1])*se,he=(he=K[0]-D[0])*he+(he=K[1]-D[1])*he;J=E(J,Math.sqrt(se/he)),$=[(Z[0]+L[0])/2,(Z[1]+L[1])/2],V=[(D[0]+K[0])/2,(D[1]+K[1])/2]}else if(H.touch0)$=H.touch0[0],V=H.touch0[1];else return;H.zoom("touch",n(C(J,$,V),H.extent,l))}}function Y(R,...Q){if(this.__zooming){var H=O(this,Q).event(R),ne=R.changedTouches,X=ne.length,U,J;for(Kf(R),v&&clearTimeout(v),v=setTimeout(function(){v=null},w),U=0;U<X;++U)J=ne[U],H.touch0&&H.touch0[2]===J.identifier?delete H.touch0:H.touch1&&H.touch1[2]===J.identifier&&delete H.touch1;if(H.touch1&&!H.touch0&&(H.touch0=H.touch1,delete H.touch1),H.touch0)H.touch0[1]=this.__zoom.invert(H.touch0[0]);else if(H.end(),H.taps===2&&(J=sr(J,this),Math.hypot(g[0]-J[0],g[1]-J[1])<k)){var $=$n(this).on("dblclick.zoom");$&&$.apply(this,arguments)}}}return S.wheelDelta=function(R){return arguments.length?(s=typeof R=="function"?R:Jc(+R),S):s},S.filter=function(R){return arguments.length?(e=typeof R=="function"?R:Jc(!!R),S):e},S.touchable=function(R){return arguments.length?(i=typeof R=="function"?R:Jc(!!R),S):i},S.extent=function(R){return arguments.length?(t=typeof R=="function"?R:Jc([[+R[0][0],+R[0][1]],[+R[1][0],+R[1][1]]]),S):t},S.scaleExtent=function(R){return arguments.length?(a[0]=+R[0],a[1]=+R[1],S):[a[0],a[1]]},S.translateExtent=function(R){return arguments.length?(l[0][0]=+R[0][0],l[1][0]=+R[1][0],l[0][1]=+R[0][1],l[1][1]=+R[1][1],S):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},S.constrain=function(R){return arguments.length?(n=R,S):n},S.duration=function(R){return arguments.length?(u=+R,S):u},S.interpolate=function(R){return arguments.length?(h=R,S):h},S.on=function(){var R=p.on.apply(p,arguments);return R===p?S:R},S.clickDistance=function(R){return arguments.length?(b=(R=+R)*R,S):Math.sqrt(b)},S.tapDistance=function(R){return arguments.length?(k=+R,S):k},S}var mw=MC();const Fu=_.createContext(null),HO=Fu.Provider,Jr={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.`},lj=Jr.error001();function lt(e,t){const n=_.useContext(Fu);if(n===null)throw new Error(lj);return IC(n,e,t)}const At=()=>{const e=_.useContext(Fu);if(e===null)throw new Error(lj);return _.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},GO=e=>e.userSelectionActive?"none":"all";function gw({position:e,children:t,className:n,style:s,...i}){const a=lt(GO),l=`${e}`.split("-");return de.createElement("div",{className:Gt(["react-flow__panel",n,...l]),style:{...s,pointerEvents:a},...i},t)}function VO({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:de.createElement(gw,{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 YO=({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=_.useRef(null),[v,w]=_.useState({x:0,y:0,width:0,height:0}),N=Gt(["react-flow__edge-textwrapper",p]);return _.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-v.width/2} ${t-v.height/2})`,className:N,visibility:v.width?"visible":"hidden",...f},i&&de.createElement("rect",{width:v.width+2*l[0],x:-l[0],y:-l[1],height:v.height+2*l[1],className:"react-flow__edge-textbg",style:a,rx:u,ry:u}),de.createElement("text",{className:"react-flow__edge-text",y:v.height/2,dy:"0.3em",ref:g,style:s},n),h)};var KO=_.memo(YO);const yw=e=>({width:e.offsetWidth,height:e.offsetHeight}),Ui=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),vw=(e={x:0,y:0},t)=>({x:Ui(e.x,t[0][0],t[1][0]),y:Ui(e.y,t[0][1],t[1][1])}),Eb=(e,t,n)=>e<t?Ui(Math.abs(e-t),1,50)/50:e>n?-Ui(Math.abs(e-n),1,50)/50:0,cj=(e,t)=>{const n=Eb(e.x,35,t.width-35)*20,s=Eb(e.y,35,t.height-35)*20;return[n,s]},uj=e=>{var t;return((t=e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},dj=(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)}),ml=({x:e,y:t,width:n,height:s})=>({x:e,y:t,x2:e+n,y2:t+s}),fj=({x:e,y:t,x2:n,y2:s})=>({x:e,y:t,width:n-e,height:s-t}),Cb=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),XO=(e,t)=>fj(dj(ml(e),ml(t))),$v=(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)},QO=e=>Ln(e.width)&&Ln(e.height)&&Ln(e.x)&&Ln(e.y),Ln=e=>!isNaN(e)&&isFinite(e),Et=Symbol.for("internals"),hj=["Enter"," ","Escape"],ZO=(e,t)=>{},JO=e=>"nativeEvent"in e;function Lv(e){var i,a;const t=JO(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 pj=e=>"clientX"in e,Ps=(e,t)=>{var a,l;const n=pj(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)}},Eu=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0},El=({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:v,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:v}),w&&de.createElement("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:w,className:"react-flow__edge-interaction"}),i&&Ln(n)&&Ln(s)?de.createElement(KO,{x:n,y:s,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:p}):null);El.displayName="BaseEdge";function Xa(e,t,n){return n===void 0?n:s=>{const i=t().edges.find(a=>a.id===e);i&&n(s,{...i})}}function mj({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 gj({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 So;(function(e){e.Strict="strict",e.Loose="loose"})(So||(So={}));var xo;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(xo||(xo={}));var gl;(function(e){e.Partial="partial",e.Full="full"})(gl||(gl={}));var Os;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Os||(Os={}));var Cu;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Cu||(Cu={}));var $e;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})($e||($e={}));function jb({pos:e,x1:t,y1:n,x2:s,y2:i}){return e===$e.Left||e===$e.Right?[.5*(t+s),n]:[t,.5*(n+i)]}function yj({sourceX:e,sourceY:t,sourcePosition:n=$e.Bottom,targetX:s,targetY:i,targetPosition:a=$e.Top}){const[l,u]=jb({pos:n,x1:e,y1:t,x2:s,y2:i}),[h,p]=jb({pos:a,x1:s,y1:i,x2:e,y2:t}),[f,g,v,w]=gj({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,v,w]}const ww=_.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,sourcePosition:i=$e.Bottom,targetPosition:a=$e.Top,label:l,labelStyle:u,labelShowBg:h,labelBgStyle:p,labelBgPadding:f,labelBgBorderRadius:g,style:v,markerEnd:w,markerStart:N,interactionWidth:b})=>{const[k,S,E]=yj({sourceX:e,sourceY:t,sourcePosition:i,targetX:n,targetY:s,targetPosition:a});return de.createElement(El,{path:k,labelX:S,labelY:E,label:l,labelStyle:u,labelShowBg:h,labelBgStyle:p,labelBgPadding:f,labelBgBorderRadius:g,style:v,markerEnd:w,markerStart:N,interactionWidth:b})});ww.displayName="SimpleBezierEdge";const Tb={[$e.Left]:{x:-1,y:0},[$e.Right]:{x:1,y:0},[$e.Top]:{x:0,y:-1},[$e.Bottom]:{x:0,y:1}},eP=({source:e,sourcePosition:t=$e.Bottom,target:n})=>t===$e.Left||t===$e.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},Rb=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function tP({source:e,sourcePosition:t=$e.Bottom,target:n,targetPosition:s=$e.Top,center:i,offset:a}){const l=Tb[t],u=Tb[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=eP({source:h,sourcePosition:t,target:p}),g=f.x!==0?"x":"y",v=f[g];let w=[],N,b;const k={x:0,y:0},S={x:0,y:0},[E,C,j,I]=mj({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??C;const P=[{x:N,y:h.y},{x:N,y:p.y}],z=[{x:h.x,y:b},{x:p.x,y:b}];l[g]===v?w=g==="x"?P:z:w=g==="x"?z:P}else{const P=[{x:h.x,y:p.y}],z=[{x:p.x,y:h.y}];if(g==="x"?w=l.x===v?z:P:w=l.y===v?P:z,t===s){const Y=Math.abs(e[g]-n[g]);if(Y<=a){const R=Math.min(a-1,a-Y);l[g]===v?k[g]=(h[g]>e[g]?-1:1)*R:S[g]=(p[g]>n[g]?-1:1)*R}}if(t!==s){const Y=g==="x"?"y":"x",R=l[g]===u[Y],Q=h[Y]>p[Y],H=h[Y]<p[Y];(l[g]===1&&(!R&&Q||R&&H)||l[g]!==1&&(!R&&H||R&&Q))&&(w=g==="x"?P:z)}const M={x:h.x+k.x,y:h.y+k.y},A={x:p.x+S.x,y:p.y+S.y},q=Math.max(Math.abs(M.x-w[0].x),Math.abs(A.x-w[0].x)),G=Math.max(Math.abs(M.y-w[0].y),Math.abs(A.y-w[0].y));q>=G?(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+k.x,y:h.y+k.y},...w,{x:p.x+S.x,y:p.y+S.y},n],N,b,j,I]}function nP(e,t,n,s){const i=Math.min(Rb(e,t)/2,Rb(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 qv({sourceX:e,sourceY:t,sourcePosition:n=$e.Bottom,targetX:s,targetY:i,targetPosition:a=$e.Top,borderRadius:l=5,centerX:u,centerY:h,offset:p=20}){const[f,g,v,w,N]=tP({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,S,E)=>{let C="";return E>0&&E<f.length-1?C=nP(f[E-1],S,f[E+1],l):C=`${E===0?"M":"L"}${S.x} ${S.y}`,k+=C,k},""),g,v,w,N]}const zu=_.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=$e.Bottom,targetPosition:v=$e.Top,markerEnd:w,markerStart:N,pathOptions:b,interactionWidth:k})=>{const[S,E,C]=qv({sourceX:e,sourceY:t,sourcePosition:g,targetX:n,targetY:s,targetPosition:v,borderRadius:b==null?void 0:b.borderRadius,offset:b==null?void 0:b.offset});return de.createElement(El,{path:S,labelX:E,labelY:C,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:p,style:f,markerEnd:w,markerStart:N,interactionWidth:k})});zu.displayName="SmoothStepEdge";const xw=_.memo(e=>{var t;return de.createElement(zu,{...e,pathOptions:_.useMemo(()=>{var n;return{borderRadius:0,offset:(n=e.pathOptions)==null?void 0:n.offset}},[(t=e.pathOptions)==null?void 0:t.offset])})});xw.displayName="StepEdge";function rP({sourceX:e,sourceY:t,targetX:n,targetY:s}){const[i,a,l,u]=mj({sourceX:e,sourceY:t,targetX:n,targetY:s});return[`M ${e},${t}L ${n},${s}`,i,a,l,u]}const bw=_.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:v,interactionWidth:w})=>{const[N,b,k]=rP({sourceX:e,sourceY:t,targetX:n,targetY:s});return de.createElement(El,{path:N,labelX:b,labelY:k,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:p,style:f,markerEnd:g,markerStart:v,interactionWidth:w})});bw.displayName="StraightEdge";function eu(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Ab({pos:e,x1:t,y1:n,x2:s,y2:i,c:a}){switch(e){case $e.Left:return[t-eu(t-s,a),n];case $e.Right:return[t+eu(s-t,a),n];case $e.Top:return[t,n-eu(n-i,a)];case $e.Bottom:return[t,n+eu(i-n,a)]}}function vj({sourceX:e,sourceY:t,sourcePosition:n=$e.Bottom,targetX:s,targetY:i,targetPosition:a=$e.Top,curvature:l=.25}){const[u,h]=Ab({pos:n,x1:e,y1:t,x2:s,y2:i,c:l}),[p,f]=Ab({pos:a,x1:s,y1:i,x2:e,y2:t,c:l}),[g,v,w,N]=gj({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,v,w,N]}const ju=_.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,sourcePosition:i=$e.Bottom,targetPosition:a=$e.Top,label:l,labelStyle:u,labelShowBg:h,labelBgStyle:p,labelBgPadding:f,labelBgBorderRadius:g,style:v,markerEnd:w,markerStart:N,pathOptions:b,interactionWidth:k})=>{const[S,E,C]=vj({sourceX:e,sourceY:t,sourcePosition:i,targetX:n,targetY:s,targetPosition:a,curvature:b==null?void 0:b.curvature});return de.createElement(El,{path:S,labelX:E,labelY:C,label:l,labelStyle:u,labelShowBg:h,labelBgStyle:p,labelBgPadding:f,labelBgBorderRadius:g,style:v,markerEnd:w,markerStart:N,interactionWidth:k})});ju.displayName="BezierEdge";const kw=_.createContext(null),sP=kw.Provider;kw.Consumer;const oP=()=>_.useContext(kw),iP=e=>"id"in e&&"source"in e&&"target"in e,aP=({source:e,sourceHandle:t,target:n,targetHandle:s})=>`reactflow__edge-${e}${t||""}-${n}${s||""}`,Dv=(e,t)=>typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(s=>`${s}=${e[s]}`).join("&")}`,lP=(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)),cP=(e,t)=>{if(!e.source||!e.target)return t;let n;return iP(e)?n={...e}:n={...e,id:aP(e)},lP(n,t)?t:t.concat(n)},Fv=({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},wj=({x:e,y:t},[n,s,i])=>({x:e*i+n,y:t*i+s}),ko=(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}},Bu=(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}=ko(i,t).positionAbsolute;return dj(s,ml({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 fj(n)},xj=(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:v,selectable:w=!0,hidden:N=!1}=f;if(l&&!w||N)return!1;const{positionAbsolute:b}=ko(f,u),k={x:b.x,y:b.y,width:g||0,height:v||0},S=$v(h,k),E=typeof g>"u"||typeof v>"u"||g===null||v===null,C=a&&S>0,j=(g||0)*(v||0);(E||C||S>=j||f.dragging)&&p.push(f)}),p},bj=(e,t)=>{const n=e.map(s=>s.id);return t.filter(s=>n.includes(s.source)||n.includes(s.target))},kj=(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=Ui(h,s,i),f=e.x+e.width/2,g=e.y+e.height/2,v=t/2-f*p,w=n/2-g*p;return{x:v,y:w,zoom:p}},go=(e,t=0)=>e.transition().duration(t);function Mb(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 uP(e,t,n,s,i,a){const{x:l,y:u}=Ps(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=_w(void 0,p),k=p.getAttribute("data-handleid"),S=a({nodeId:N,id:k,type:b});if(S){const E=i.find(C=>C.nodeId===N&&C.type===b&&C.id===k);return{handle:{id:k,type:b,nodeId:N,x:(E==null?void 0:E.x)||n.x,y:(E==null?void 0:E.y)||n.y},validHandleResult:S}}}}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 k=a(N);b<=g&&(b<g?f=[{handle:N,validHandleResult:k}]:b===g&&f.push({handle:N,validHandleResult:k}),g=b)}}),!f.length)return{handle:null,validHandleResult:_j()};if(f.length===1)return f[0];const v=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":v?b.isValid:!0)||f[0]}const dP={source:null,target:null,sourceHandle:null,targetHandle:null},_j=()=>({handleDomNode:null,isValid:!1,connection:dP,endHandle:null});function Sj(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={..._j(),handleDomNode:h};if(h){const f=_w(void 0,h),g=h.getAttribute("data-nodeid"),v=h.getAttribute("data-handleid"),w=h.classList.contains("connectable"),N=h.classList.contains("connectableend"),b={source:u?g:n,sourceHandle:u?v:s,target:u?n:g,targetHandle:u?s:v};p.connection=b,w&&N&&(t===So.Strict?u&&f==="source"||!u&&f==="target":g!==n||v!==s)&&(p.endHandle={nodeId:g,handleId:v,type:f},p.isValid=a(b))}return p}function fP({nodes:e,nodeId:t,handleId:n,handleType:s}){return e.reduce((i,a)=>{if(a[Et]){const{handleBounds:l}=a[Et];let u=[],h=[];l&&(u=Mb(a,l,"source",`${t}-${n}-${s}`),h=Mb(a,l,"target",`${t}-${n}-${s}`)),i.push(...u,...h)}return i},[])}function _w(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function Xf(e){e==null||e.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function hP(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}function Nj({event:e,handleId:t,nodeId:n,onConnect:s,isTarget:i,getState:a,setState:l,isValidConnection:u,edgeUpdaterType:h,onReconnectEnd:p}){const f=uj(e.target),{connectionMode:g,domNode:v,autoPanOnConnect:w,connectionRadius:N,onConnectStart:b,panBy:k,getNodes:S,cancelConnection:E}=a();let C=0,j;const{x:I,y:O}=Ps(e),P=f==null?void 0:f.elementFromPoint(I,O),z=_w(h,P),M=v==null?void 0:v.getBoundingClientRect();if(!M||!z)return;let A,q=Ps(e,M),G=!1,Y=null,R=!1,Q=null;const H=fP({nodes:S(),nodeId:n,handleId:t,handleType:z}),ne=()=>{if(!w)return;const[J,$]=cj(q,M);k({x:J,y:$}),C=requestAnimationFrame(ne)};l({connectionPosition:q,connectionStatus:null,connectionNodeId:n,connectionHandleId:t,connectionHandleType:z,connectionStartHandle:{nodeId:n,handleId:t,type:z},connectionEndHandle:null}),b==null||b(e,{nodeId:n,handleId:t,handleType:z});function X(J){const{transform:$}=a();q=Ps(J,M);const{handle:V,validHandleResult:Z}=uP(J,f,Fv(q,$,!1,[1,1]),N,H,D=>Sj(D,g,n,t,i?"target":"source",u,f));if(j=V,G||(ne(),G=!0),Q=Z.handleDomNode,Y=Z.connection,R=Z.isValid,l({connectionPosition:j&&R?wj({x:j.x,y:j.y},$):q,connectionStatus:hP(!!j,R),connectionEndHandle:Z.endHandle}),!j&&!R&&!Q)return Xf(A);Y.source!==Y.target&&Q&&(Xf(A),A=Q,Q.classList.add("connecting","react-flow__handle-connecting"),Q.classList.toggle("valid",R),Q.classList.toggle("react-flow__handle-valid",R))}function U(J){var $,V;(j||Q)&&Y&&R&&(s==null||s(Y)),(V=($=a()).onConnectEnd)==null||V.call($,J),h&&(p==null||p(J)),Xf(A),E(),cancelAnimationFrame(C),G=!1,R=!1,Y=null,Q=null,f.removeEventListener("mousemove",X),f.removeEventListener("mouseup",U),f.removeEventListener("touchmove",X),f.removeEventListener("touchend",U)}f.addEventListener("mousemove",X),f.addEventListener("mouseup",U),f.addEventListener("touchmove",X),f.addEventListener("touchend",U)}const Ib=()=>!0,pP=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),mP=(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}},Ej=_.forwardRef(({type:e="source",position:t=$e.Top,isValidConnection:n,isConnectable:s=!0,isConnectableStart:i=!0,isConnectableEnd:a=!0,id:l,onConnect:u,children:h,className:p,onMouseDown:f,onTouchStart:g,...v},w)=>{var M,A;const N=l||null,b=e==="target",k=At(),S=oP(),{connectOnClick:E,noPanClassName:C}=lt(pP,qt),{connecting:j,clickConnecting:I}=lt(mP(S,N,e),qt);S||(A=(M=k.getState()).onError)==null||A.call(M,"010",Jr.error010());const O=q=>{const{defaultEdgeOptions:G,onConnect:Y,hasDefaultEdges:R}=k.getState(),Q={...G,...q};if(R){const{edges:H,setEdges:ne}=k.getState();ne(cP(Q,H))}Y==null||Y(Q),u==null||u(Q)},P=q=>{if(!S)return;const G=pj(q);i&&(G&&q.button===0||!G)&&Nj({event:q,handleId:N,nodeId:S,onConnect:O,isTarget:b,getState:k.getState,setState:k.setState,isValidConnection:n||k.getState().isValidConnection||Ib}),G?f==null||f(q):g==null||g(q)},z=q=>{const{onClickConnectStart:G,onClickConnectEnd:Y,connectionClickStartHandle:R,connectionMode:Q,isValidConnection:H}=k.getState();if(!S||!R&&!i)return;if(!R){G==null||G(q,{nodeId:S,handleId:N,handleType:e}),k.setState({connectionClickStartHandle:{nodeId:S,type:e,handleId:N}});return}const ne=uj(q.target),X=n||H||Ib,{connection:U,isValid:J}=Sj({nodeId:S,id:N,type:e},Q,R.nodeId,R.handleId||null,R.type,X,ne);J&&O(U),Y==null||Y(q),k.setState({connectionClickStartHandle:null})};return de.createElement("div",{"data-handleid":N,"data-nodeid":S,"data-handlepos":t,"data-id":`${S}-${N}-${e}`,className:Gt(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",C,p,{source:!b,target:b,connectable:s,connectablestart:i,connectableend:a,connecting:I,connectionindicator:s&&(i&&!j||a&&j)}]),onMouseDown:P,onTouchStart:P,onClick:E?z:void 0,ref:w,...v},h)});Ej.displayName="Handle";var Wi=_.memo(Ej);const Cj=({data:e,isConnectable:t,targetPosition:n=$e.Top,sourcePosition:s=$e.Bottom})=>de.createElement(de.Fragment,null,de.createElement(Wi,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,de.createElement(Wi,{type:"source",position:s,isConnectable:t}));Cj.displayName="DefaultNode";var zv=_.memo(Cj);const jj=({data:e,isConnectable:t,sourcePosition:n=$e.Bottom})=>de.createElement(de.Fragment,null,e==null?void 0:e.label,de.createElement(Wi,{type:"source",position:n,isConnectable:t}));jj.displayName="InputNode";var Tj=_.memo(jj);const Rj=({data:e,isConnectable:t,targetPosition:n=$e.Top})=>de.createElement(de.Fragment,null,de.createElement(Wi,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label);Rj.displayName="OutputNode";var Aj=_.memo(Rj);const Sw=()=>null;Sw.displayName="GroupNode";const gP=e=>({selectedNodes:e.getNodes().filter(t=>t.selected),selectedEdges:e.edges.filter(t=>t.selected).map(t=>({...t}))}),tu=e=>e.id;function yP(e,t){return qt(e.selectedNodes.map(tu),t.selectedNodes.map(tu))&&qt(e.selectedEdges.map(tu),t.selectedEdges.map(tu))}const Mj=_.memo(({onSelectionChange:e})=>{const t=At(),{selectedNodes:n,selectedEdges:s}=lt(gP,yP);return _.useEffect(()=>{const i={nodes:n,edges:s};e==null||e(i),t.getState().onSelectionChange.forEach(a=>a(i))},[n,s,e]),null});Mj.displayName="SelectionListener";const vP=e=>!!e.onSelectionChange;function wP({onSelectionChange:e}){const t=lt(vP);return e||t?de.createElement(Mj,{onSelectionChange:e}):null}const xP=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 Si(e,t){_.useEffect(()=>{typeof e<"u"&&t(e)},[e])}function Ke(e,t,n){_.useEffect(()=>{typeof t<"u"&&n({[e]:t})},[t])}const bP=({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:v,edgesUpdatable:w,elevateNodesOnSelect:N,minZoom:b,maxZoom:k,nodeExtent:S,onNodesChange:E,onEdgesChange:C,elementsSelectable:j,connectionMode:I,snapGrid:O,snapToGrid:P,translateExtent:z,connectOnClick:M,defaultEdgeOptions:A,fitView:q,fitViewOptions:G,onNodesDelete:Y,onEdgesDelete:R,onNodeDrag:Q,onNodeDragStart:H,onNodeDragStop:ne,onSelectionDrag:X,onSelectionDragStart:U,onSelectionDragStop:J,noPanClassName:$,nodeOrigin:V,rfId:Z,autoPanOnConnect:D,autoPanOnNodeDrag:L,onError:K,connectionRadius:se,isValidConnection:he,nodeDragThreshold:me})=>{const{setNodes:xe,setEdges:Ee,setDefaultNodesAndEdges:He,setMinZoom:Fe,setMaxZoom:Ie,setTranslateExtent:be,setNodeExtent:ue,reset:re}=lt(xP,qt),pe=At();return _.useEffect(()=>{const Oe=s==null?void 0:s.map(nt=>({...nt,...A}));return He(n,Oe),()=>{re()}},[]),Ke("defaultEdgeOptions",A,pe.setState),Ke("connectionMode",I,pe.setState),Ke("onConnect",i,pe.setState),Ke("onConnectStart",a,pe.setState),Ke("onConnectEnd",l,pe.setState),Ke("onClickConnectStart",u,pe.setState),Ke("onClickConnectEnd",h,pe.setState),Ke("nodesDraggable",p,pe.setState),Ke("nodesConnectable",f,pe.setState),Ke("nodesFocusable",g,pe.setState),Ke("edgesFocusable",v,pe.setState),Ke("edgesUpdatable",w,pe.setState),Ke("elementsSelectable",j,pe.setState),Ke("elevateNodesOnSelect",N,pe.setState),Ke("snapToGrid",P,pe.setState),Ke("snapGrid",O,pe.setState),Ke("onNodesChange",E,pe.setState),Ke("onEdgesChange",C,pe.setState),Ke("connectOnClick",M,pe.setState),Ke("fitViewOnInit",q,pe.setState),Ke("fitViewOnInitOptions",G,pe.setState),Ke("onNodesDelete",Y,pe.setState),Ke("onEdgesDelete",R,pe.setState),Ke("onNodeDrag",Q,pe.setState),Ke("onNodeDragStart",H,pe.setState),Ke("onNodeDragStop",ne,pe.setState),Ke("onSelectionDrag",X,pe.setState),Ke("onSelectionDragStart",U,pe.setState),Ke("onSelectionDragStop",J,pe.setState),Ke("noPanClassName",$,pe.setState),Ke("nodeOrigin",V,pe.setState),Ke("rfId",Z,pe.setState),Ke("autoPanOnConnect",D,pe.setState),Ke("autoPanOnNodeDrag",L,pe.setState),Ke("onError",K,pe.setState),Ke("connectionRadius",se,pe.setState),Ke("isValidConnection",he,pe.setState),Ke("nodeDragThreshold",me,pe.setState),Si(e,xe),Si(t,Ee),Si(b,Fe),Si(k,Ie),Si(z,be),Si(S,ue),null},Ob={display:"none"},kP={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Ij="react-flow__node-desc",Oj="react-flow__edge-desc",_P="react-flow__aria-live",SP=e=>e.ariaLiveMessage;function NP({rfId:e}){const t=lt(SP);return de.createElement("div",{id:`${_P}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:kP},t)}function EP({rfId:e,disableKeyboardA11y:t}){return de.createElement(de.Fragment,null,de.createElement("div",{id:`${Ij}-${e}`,style:Ob},"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:`${Oj}-${e}`,style:Ob},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!t&&de.createElement(NP,{rfId:e}))}var yl=(e=null,t={actInsideInputWithModifier:!0})=>{const[n,s]=_.useState(!1),i=_.useRef(!1),a=_.useRef(new Set([])),[l,u]=_.useMemo(()=>{if(e!==null){const p=(Array.isArray(e)?e:[e]).filter(g=>typeof g=="string").map(g=>g.split("+")),f=p.reduce((g,v)=>g.concat(...v),[]);return[p,f]}return[[],[]]},[e]);return _.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)&&Lv(w))return!1;const b=$b(w.code,u);a.current.add(w[b]),Pb(l,a.current,!1)&&(w.preventDefault(),s(!0))},g=w=>{if((!i.current||i.current&&!t.actInsideInputWithModifier)&&Lv(w))return!1;const b=$b(w.code,u);Pb(l,a.current,!0)?(s(!1),a.current.clear()):a.current.delete(w[b]),w.key==="Meta"&&a.current.clear(),i.current=!1},v=()=>{a.current.clear(),s(!1)};return p==null||p.addEventListener("keydown",f),p==null||p.addEventListener("keyup",g),window.addEventListener("blur",v),()=>{p==null||p.removeEventListener("keydown",f),p==null||p.removeEventListener("keyup",g),window.removeEventListener("blur",v)}}},[e,s]),n};function Pb(e,t,n){return e.filter(s=>n||s.length===t.size).some(s=>s.every(i=>t.has(i)))}function $b(e,t){return t.includes(e)?"code":"key"}function Pj(e,t,n,s){var u,h;const i=e.parentNode||e.parentId;if(!i)return n;const a=t.get(i),l=ko(a,s);return Pj(a,t,{x:(n.x??0)+l.x,y:(n.y??0)+l.y,z:(((u=a[Et])==null?void 0:u.z)??0)>(n.z??0)?((h=a[Et])==null?void 0:h.z)??0:n.z??0},s)}function $j(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}=Pj(s,e,{...s.position,z:((a=s[Et])==null?void 0:a.z)??0},t);s.positionAbsolute={x:l,y:u},s[Et].z=h,n!=null&&n[s.id]&&(s[Et].isParent=!0)}})}function Qf(e,t,n,s){const i=new Map,a={},l=s?1e3:0;return e.forEach(u=>{var w;const h=(Ln(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 v=(p==null?void 0:p.type)&&(p==null?void 0:p.type)!==u.type;Object.defineProperty(f,Et,{enumerable:!1,value:{handleBounds:v||(w=p==null?void 0:p[Et])==null?void 0:w.handleBounds,z:h}}),i.set(u.id,f)}),$j(i,n,a),i}function Lj(e,t={}){const{getNodes:n,width:s,height:i,minZoom:a,maxZoom:l,d3Zoom:u,d3Selection:h,fitViewOnInitDone:p,fitViewOnInit:f,nodeOrigin:g}=e(),v=t.initial&&!p&&f;if(u&&h&&(v||!t.initial)){const N=n().filter(k=>{var E;const S=t.includeHiddenNodes?k.width&&k.height:!k.hidden;return(E=t.nodes)!=null&&E.length?S&&t.nodes.some(C=>C.id===k.id):S}),b=N.every(k=>k.width&&k.height);if(N.length>0&&b){const k=Bu(N,g),{x:S,y:E,zoom:C}=kj(k,s,i,t.minZoom??a,t.maxZoom??l,t.padding??.1),j=Qr.translate(S,E).scale(C);return typeof t.duration=="number"&&t.duration>0?u.transform(go(h,t.duration),j):u.transform(h,j),!0}}return!1}function CP(e,t){return e.forEach(n=>{const s=t.get(n.id);s&&t.set(s.id,{...s,[Et]:s[Et],selected:n.selected})}),new Map(t)}function jP(e,t){return t.map(n=>{const s=e.find(i=>i.id===n.id);return s&&(n.selected=s.selected),n})}function nu({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:CP(e,i)}),l==null||l(e)),t!=null&&t.length&&(p&&s({edges:jP(t,a)}),u==null||u(t))}const Ni=()=>{},TP={zoomIn:Ni,zoomOut:Ni,zoomTo:Ni,getZoom:()=>1,setViewport:Ni,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:Ni,fitBounds:Ni,project:e=>e,screenToFlowPosition:e=>e,flowToScreenPosition:e=>e,viewportInitialized:!1},RP=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),AP=()=>{const e=At(),{d3Zoom:t,d3Selection:n}=lt(RP,qt);return _.useMemo(()=>n&&t?{zoomIn:i=>t.scaleBy(go(n,i==null?void 0:i.duration),1.2),zoomOut:i=>t.scaleBy(go(n,i==null?void 0:i.duration),1/1.2),zoomTo:(i,a)=>t.scaleTo(go(n,a==null?void 0:a.duration),i),getZoom:()=>e.getState().transform[2],setViewport:(i,a)=>{const[l,u,h]=e.getState().transform,p=Qr.translate(i.x??l,i.y??u).scale(i.zoom??h);t.transform(go(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=>Lj(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,v=h/2-a*f,w=Qr.translate(g,v).scale(f);t.transform(go(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:v}=kj(i,l,u,h,p,(a==null?void 0:a.padding)??.1),w=Qr.translate(f,g).scale(v);t.transform(go(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"),Fv(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 Fv(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=wj(i,a);return{x:p.x+u,y:p.y+h}},viewportInitialized:!0}:TP,[t,n])};function Cl(){const e=AP(),t=At(),n=_.useCallback(()=>t.getState().getNodes().map(b=>({...b})),[]),s=_.useCallback(b=>t.getState().nodeInternals.get(b),[]),i=_.useCallback(()=>{const{edges:b=[]}=t.getState();return b.map(k=>({...k}))},[]),a=_.useCallback(b=>{const{edges:k=[]}=t.getState();return k.find(S=>S.id===b)},[]),l=_.useCallback(b=>{const{getNodes:k,setNodes:S,hasDefaultNodes:E,onNodesChange:C}=t.getState(),j=k(),I=typeof b=="function"?b(j):b;if(E)S(I);else if(C){const O=I.length===0?j.map(P=>({type:"remove",id:P.id})):I.map(P=>({item:P,type:"reset"}));C(O)}},[]),u=_.useCallback(b=>{const{edges:k=[],setEdges:S,hasDefaultEdges:E,onEdgesChange:C}=t.getState(),j=typeof b=="function"?b(k):b;if(E)S(j);else if(C){const I=j.length===0?k.map(O=>({type:"remove",id:O.id})):j.map(O=>({item:O,type:"reset"}));C(I)}},[]),h=_.useCallback(b=>{const k=Array.isArray(b)?b:[b],{getNodes:S,setNodes:E,hasDefaultNodes:C,onNodesChange:j}=t.getState();if(C){const O=[...S(),...k];E(O)}else if(j){const I=k.map(O=>({item:O,type:"add"}));j(I)}},[]),p=_.useCallback(b=>{const k=Array.isArray(b)?b:[b],{edges:S=[],setEdges:E,hasDefaultEdges:C,onEdgesChange:j}=t.getState();if(C)E([...S,...k]);else if(j){const I=k.map(O=>({item:O,type:"add"}));j(I)}},[]),f=_.useCallback(()=>{const{getNodes:b,edges:k=[],transform:S}=t.getState(),[E,C,j]=S;return{nodes:b().map(I=>({...I})),edges:k.map(I=>({...I})),viewport:{x:E,y:C,zoom:j}}},[]),g=_.useCallback(({nodes:b,edges:k})=>{const{nodeInternals:S,getNodes:E,edges:C,hasDefaultNodes:j,hasDefaultEdges:I,onNodesDelete:O,onEdgesDelete:P,onNodesChange:z,onEdgesChange:M}=t.getState(),A=(b||[]).map(Q=>Q.id),q=(k||[]).map(Q=>Q.id),G=E().reduce((Q,H)=>{const ne=H.parentNode||H.parentId,X=!A.includes(H.id)&&ne&&Q.find(J=>J.id===ne);return(typeof H.deletable=="boolean"?H.deletable:!0)&&(A.includes(H.id)||X)&&Q.push(H),Q},[]),Y=C.filter(Q=>typeof Q.deletable=="boolean"?Q.deletable:!0),R=Y.filter(Q=>q.includes(Q.id));if(G||R){const Q=bj(G,Y),H=[...R,...Q],ne=H.reduce((X,U)=>(X.includes(U.id)||X.push(U.id),X),[]);if((I||j)&&(I&&t.setState({edges:C.filter(X=>!ne.includes(X.id))}),j&&(G.forEach(X=>{S.delete(X.id)}),t.setState({nodeInternals:new Map(S)}))),ne.length>0&&(P==null||P(H),M&&M(ne.map(X=>({id:X,type:"remove"})))),G.length>0&&(O==null||O(G),z)){const X=G.map(U=>({id:U.id,type:"remove"}));z(X)}}},[]),v=_.useCallback(b=>{const k=QO(b),S=k?null:t.getState().nodeInternals.get(b.id);return!k&&!S?[null,null,k]:[k?b:Cb(S),S,k]},[]),w=_.useCallback((b,k=!0,S)=>{const[E,C,j]=v(b);return E?(S||t.getState().getNodes()).filter(I=>{if(!j&&(I.id===C.id||!I.positionAbsolute))return!1;const O=Cb(I),P=$v(O,E);return k&&P>0||P>=E.width*E.height}):[]},[]),N=_.useCallback((b,k,S=!0)=>{const[E]=v(b);if(!E)return!1;const C=$v(E,k);return S&&C>0||C>=E.width*E.height},[]);return _.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 MP={actInsideInputWithModifier:!1};var IP=({deleteKeyCode:e,multiSelectionKeyCode:t})=>{const n=At(),{deleteElements:s}=Cl(),i=yl(e,MP),a=yl(t);_.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]),_.useEffect(()=>{n.setState({multiSelectionActive:a})},[a])};function OP(e){const t=At();_.useEffect(()=>{let n;const s=()=>{var a,l;if(!e.current)return;const i=yw(e.current);(i.height===0||i.width===0)&&((l=(a=t.getState()).onError)==null||l.call(a,"004",Jr.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 Nw={position:"absolute",width:"100%",height:"100%",top:0,left:0},PP=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,ru=e=>({x:e.x,y:e.y,zoom:e.k}),Ei=(e,t)=>e.target.closest(`.${t}`),Lb=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),qb=e=>{const t=e.ctrlKey&&Eu()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t},$P=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),LP=({onMove:e,onMoveStart:t,onMoveEnd:n,onPaneContextMenu:s,zoomOnScroll:i=!0,zoomOnPinch:a=!0,panOnScroll:l=!1,panOnScrollSpeed:u=.5,panOnScrollMode:h=xo.Free,zoomOnDoubleClick:p=!0,elementsSelectable:f,panOnDrag:g=!0,defaultViewport:v,translateExtent:w,minZoom:N,maxZoom:b,zoomActivationKeyCode:k,preventScrolling:S=!0,children:E,noWheelClassName:C,noPanClassName:j})=>{const I=_.useRef(),O=At(),P=_.useRef(!1),z=_.useRef(!1),M=_.useRef(null),A=_.useRef({x:0,y:0,zoom:0}),{d3Zoom:q,d3Selection:G,d3ZoomHandler:Y,userSelectionActive:R}=lt($P,qt),Q=yl(k),H=_.useRef(0),ne=_.useRef(!1),X=_.useRef();return OP(M),_.useEffect(()=>{if(M.current){const U=M.current.getBoundingClientRect(),J=aj().scaleExtent([N,b]).translateExtent(w),$=$n(M.current).call(J),V=Qr.translate(v.x,v.y).scale(Ui(v.zoom,N,b)),Z=[[0,0],[U.width,U.height]],D=J.constrain()(V,Z,w);J.transform($,D),J.wheelDelta(qb),O.setState({d3Zoom:J,d3Selection:$,d3ZoomHandler:$.on("wheel.zoom"),transform:[D.x,D.y,D.k],domNode:M.current.closest(".react-flow")})}},[]),_.useEffect(()=>{G&&q&&(l&&!Q&&!R?G.on("wheel.zoom",U=>{if(Ei(U,C))return!1;U.preventDefault(),U.stopImmediatePropagation();const J=G.property("__zoom").k||1;if(U.ctrlKey&&a){const he=sr(U),me=qb(U),xe=J*Math.pow(2,me);q.scaleTo(G,xe,he,U);return}const $=U.deltaMode===1?20:1;let V=h===xo.Vertical?0:U.deltaX*$,Z=h===xo.Horizontal?0:U.deltaY*$;!Eu()&&U.shiftKey&&h!==xo.Vertical&&(V=U.deltaY*$,Z=0),q.translateBy(G,-(V/J)*u,-(Z/J)*u,{internal:!0});const D=ru(G.property("__zoom")),{onViewportChangeStart:L,onViewportChange:K,onViewportChangeEnd:se}=O.getState();clearTimeout(X.current),ne.current||(ne.current=!0,t==null||t(U,D),L==null||L(D)),ne.current&&(e==null||e(U,D),K==null||K(D),X.current=setTimeout(()=>{n==null||n(U,D),se==null||se(D),ne.current=!1},150))},{passive:!1}):typeof Y<"u"&&G.on("wheel.zoom",function(U,J){if(!S&&U.type==="wheel"&&!U.ctrlKey||Ei(U,C))return null;U.preventDefault(),Y.call(this,U,J)},{passive:!1}))},[R,l,h,G,q,Y,Q,a,S,C,t,e,n]),_.useEffect(()=>{q&&q.on("start",U=>{var V,Z;if(!U.sourceEvent||U.sourceEvent.internal)return null;H.current=(V=U.sourceEvent)==null?void 0:V.button;const{onViewportChangeStart:J}=O.getState(),$=ru(U.transform);P.current=!0,A.current=$,((Z=U.sourceEvent)==null?void 0:Z.type)==="mousedown"&&O.setState({paneDragging:!0}),J==null||J($),t==null||t(U.sourceEvent,$)})},[q,t]),_.useEffect(()=>{q&&(R&&!P.current?q.on("zoom",null):R||q.on("zoom",U=>{var $;const{onViewportChange:J}=O.getState();if(O.setState({transform:[U.transform.x,U.transform.y,U.transform.k]}),z.current=!!(s&&Lb(g,H.current??0)),(e||J)&&!(($=U.sourceEvent)!=null&&$.internal)){const V=ru(U.transform);J==null||J(V),e==null||e(U.sourceEvent,V)}}))},[R,q,e,g,s]),_.useEffect(()=>{q&&q.on("end",U=>{if(!U.sourceEvent||U.sourceEvent.internal)return null;const{onViewportChangeEnd:J}=O.getState();if(P.current=!1,O.setState({paneDragging:!1}),s&&Lb(g,H.current??0)&&!z.current&&s(U.sourceEvent),z.current=!1,(n||J)&&PP(A.current,U.transform)){const $=ru(U.transform);A.current=$,clearTimeout(I.current),I.current=setTimeout(()=>{J==null||J($),n==null||n(U.sourceEvent,$)},l?150:0)}})},[q,l,g,n,s]),_.useEffect(()=>{q&&q.filter(U=>{const J=Q||i,$=a&&U.ctrlKey;if((g===!0||Array.isArray(g)&&g.includes(1))&&U.button===1&&U.type==="mousedown"&&(Ei(U,"react-flow__node")||Ei(U,"react-flow__edge")))return!0;if(!g&&!J&&!l&&!p&&!a||R||!p&&U.type==="dblclick"||Ei(U,C)&&U.type==="wheel"||Ei(U,j)&&(U.type!=="wheel"||l&&U.type==="wheel"&&!Q)||!a&&U.ctrlKey&&U.type==="wheel"||!J&&!l&&!$&&U.type==="wheel"||!g&&(U.type==="mousedown"||U.type==="touchstart")||Array.isArray(g)&&!g.includes(U.button)&&U.type==="mousedown")return!1;const V=Array.isArray(g)&&g.includes(U.button)||!U.button||U.button<=1;return(!U.ctrlKey||U.type==="wheel")&&V})},[R,q,i,a,l,p,g,f,Q]),de.createElement("div",{className:"react-flow__renderer",ref:M,style:Nw},E)},qP=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function DP(){const{userSelectionActive:e,userSelectionRect:t}=lt(qP,qt);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 Db(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 FP(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&&Db(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&&Db(s,l);break}case"remove":return s}return s.push(l),s},n)}function zP(e,t){return FP(e,t)}const Is=(e,t)=>({id:e,type:"select",selected:t});function Mi(e,t){return e.reduce((n,s)=>{const i=t.includes(s.id);return!s.selected&&i?(s.selected=!0,n.push(Is(s.id,!0))):s.selected&&!i&&(s.selected=!1,n.push(Is(s.id,!1))),n},[])}const Zf=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},BP=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),qj=_.memo(({isSelecting:e,selectionMode:t=gl.Full,panOnDrag:n,onSelectionStart:s,onSelectionEnd:i,onPaneClick:a,onPaneContextMenu:l,onPaneScroll:u,onPaneMouseEnter:h,onPaneMouseMove:p,onPaneMouseLeave:f,children:g})=>{const v=_.useRef(null),w=At(),N=_.useRef(0),b=_.useRef(0),k=_.useRef(),{userSelectionActive:S,elementsSelectable:E,dragging:C}=lt(BP,qt),j=()=>{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})},O=Y=>{if(Array.isArray(n)&&(n!=null&&n.includes(2))){Y.preventDefault();return}l==null||l(Y)},P=u?Y=>u(Y):void 0,z=Y=>{const{resetSelectedElements:R,domNode:Q}=w.getState();if(k.current=Q==null?void 0:Q.getBoundingClientRect(),!E||!e||Y.button!==0||Y.target!==v.current||!k.current)return;const{x:H,y:ne}=Ps(Y,k.current);R(),w.setState({userSelectionRect:{width:0,height:0,startX:H,startY:ne,x:H,y:ne}}),s==null||s(Y)},M=Y=>{const{userSelectionRect:R,nodeInternals:Q,edges:H,transform:ne,onNodesChange:X,onEdgesChange:U,nodeOrigin:J,getNodes:$}=w.getState();if(!e||!k.current||!R)return;w.setState({userSelectionActive:!0,nodesSelectionActive:!1});const V=Ps(Y,k.current),Z=R.startX??0,D=R.startY??0,L={...R,x:V.x<Z?V.x:Z,y:V.y<D?V.y:D,width:Math.abs(V.x-Z),height:Math.abs(V.y-D)},K=$(),se=xj(Q,L,ne,t===gl.Partial,!0,J),he=bj(se,H).map(xe=>xe.id),me=se.map(xe=>xe.id);if(N.current!==me.length){N.current=me.length;const xe=Mi(K,me);xe.length&&(X==null||X(xe))}if(b.current!==he.length){b.current=he.length;const xe=Mi(H,he);xe.length&&(U==null||U(xe))}w.setState({userSelectionRect:L})},A=Y=>{if(Y.button!==0)return;const{userSelectionRect:R}=w.getState();!S&&R&&Y.target===v.current&&(I==null||I(Y)),w.setState({nodesSelectionActive:N.current>0}),j(),i==null||i(Y)},q=Y=>{S&&(w.setState({nodesSelectionActive:N.current>0}),i==null||i(Y)),j()},G=E&&(e||S);return de.createElement("div",{className:Gt(["react-flow__pane",{dragging:C,selection:e}]),onClick:G?void 0:Zf(I,v),onContextMenu:Zf(O,v),onWheel:Zf(P,v),onMouseEnter:G?void 0:h,onMouseDown:G?z:void 0,onMouseMove:G?M:p,onMouseUp:G?A:void 0,onMouseLeave:G?q:f,ref:v,style:Nw},g,de.createElement(DP,null))});qj.displayName="Pane";function Dj(e,t){const n=e.parentNode||e.parentId;if(!n)return!1;const s=t.get(n);return s?s.selected?!0:Dj(s,t):!1}function Fb(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 UP(e,t,n,s){return Array.from(e.values()).filter(i=>(i.selected||i.id===s)&&(!i.parentNode||i.parentId||!Dj(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 WP(e,t){return!t||t==="parent"?t:[t[0],[t[1][0]-(e.width||0),t[1][1]-(e.height||0)]]}function Fj(e,t,n,s,i=[0,0],a){const l=WP(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:v,y:w}=ko(g,i).positionAbsolute;u=g&&Ln(v)&&Ln(w)&&Ln(g.width)&&Ln(g.height)?[[v+e.width*i[0],w+e.height*i[1]],[v+g.width-e.width+e.width*i[0],w+g.height-e.height+e.height*i[1]]]:u}else a==null||a("005",Jr.error005()),u=l;else if(e.extent&&h&&e.extent!=="parent"){const g=n.get(h),{x:v,y:w}=ko(g,i).positionAbsolute;u=[[e.extent[0][0]+v,e.extent[0][1]+w],[e.extent[1][0]+v,e.extent[1][1]+w]]}let p={x:0,y:0};if(h){const g=n.get(h);p=ko(g,i).positionAbsolute}const f=u&&u!=="parent"?vw(t,u):t;return{position:{x:f.x-p.x,y:f.y-p.y},positionAbsolute:f}}function Jf({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 zb=(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,...yw(h)}})};function Qa(e,t,n){return n===void 0?n:s=>{const i=t().nodeInternals.get(e);i&&n(s,{...i})}}function Bv({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",Jr.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 HP(){const e=At();return _.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 eh(e){return(t,n,s)=>e==null?void 0:e(t,s)}function zj({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:s,nodeId:i,isSelectable:a,selectNodesOnDrag:l}){const u=At(),[h,p]=_.useState(!1),f=_.useRef([]),g=_.useRef({x:null,y:null}),v=_.useRef(0),w=_.useRef(null),N=_.useRef({x:0,y:0}),b=_.useRef(null),k=_.useRef(!1),S=_.useRef(!1),E=_.useRef(!1),C=HP();return _.useEffect(()=>{if(e!=null&&e.current){const j=$n(e.current),I=({x:z,y:M})=>{const{nodeInternals:A,onNodeDrag:q,onSelectionDrag:G,updateNodePositions:Y,nodeExtent:R,snapGrid:Q,snapToGrid:H,nodeOrigin:ne,onError:X}=u.getState();g.current={x:z,y:M};let U=!1,J={x:0,y:0,x2:0,y2:0};if(f.current.length>1&&R){const V=Bu(f.current,ne);J=ml(V)}if(f.current=f.current.map(V=>{const Z={x:z-V.distance.x,y:M-V.distance.y};H&&(Z.x=Q[0]*Math.round(Z.x/Q[0]),Z.y=Q[1]*Math.round(Z.y/Q[1]));const D=[[R[0][0],R[0][1]],[R[1][0],R[1][1]]];f.current.length>1&&R&&!V.extent&&(D[0][0]=V.positionAbsolute.x-J.x+R[0][0],D[1][0]=V.positionAbsolute.x+(V.width??0)-J.x2+R[1][0],D[0][1]=V.positionAbsolute.y-J.y+R[0][1],D[1][1]=V.positionAbsolute.y+(V.height??0)-J.y2+R[1][1]);const L=Fj(V,Z,A,D,ne,X);return U=U||V.position.x!==L.position.x||V.position.y!==L.position.y,V.position=L.position,V.positionAbsolute=L.positionAbsolute,V}),!U)return;Y(f.current,!0,!0),p(!0);const $=i?q:eh(G);if($&&b.current){const[V,Z]=Jf({nodeId:i,dragItems:f.current,nodeInternals:A});$(b.current,V,Z)}},O=()=>{if(!w.current)return;const[z,M]=cj(N.current,w.current);if(z!==0||M!==0){const{transform:A,panBy:q}=u.getState();g.current.x=(g.current.x??0)-z/A[2],g.current.y=(g.current.y??0)-M/A[2],q({x:z,y:M})&&I(g.current)}v.current=requestAnimationFrame(O)},P=z=>{var ne;const{nodeInternals:M,multiSelectionActive:A,nodesDraggable:q,unselectNodesAndEdges:G,onNodeDragStart:Y,onSelectionDragStart:R}=u.getState();S.current=!0;const Q=i?Y:eh(R);(!l||!a)&&!A&&i&&((ne=M.get(i))!=null&&ne.selected||G()),i&&a&&l&&Bv({id:i,store:u,nodeRef:e});const H=C(z);if(g.current=H,f.current=UP(M,q,H,i),Q&&f.current){const[X,U]=Jf({nodeId:i,dragItems:f.current,nodeInternals:M});Q(z.sourceEvent,X,U)}};if(t)j.on(".drag",null);else{const z=tI().on("start",M=>{const{domNode:A,nodeDragThreshold:q}=u.getState();q===0&&P(M),E.current=!1;const G=C(M);g.current=G,w.current=(A==null?void 0:A.getBoundingClientRect())||null,N.current=Ps(M.sourceEvent,w.current)}).on("drag",M=>{var Y,R;const A=C(M),{autoPanOnNodeDrag:q,nodeDragThreshold:G}=u.getState();if(M.sourceEvent.type==="touchmove"&&M.sourceEvent.touches.length>1&&(E.current=!0),!E.current){if(!k.current&&S.current&&q&&(k.current=!0,O()),!S.current){const Q=A.xSnapped-(((Y=g==null?void 0:g.current)==null?void 0:Y.x)??0),H=A.ySnapped-(((R=g==null?void 0:g.current)==null?void 0:R.y)??0);Math.sqrt(Q*Q+H*H)>G&&P(M)}(g.current.x!==A.xSnapped||g.current.y!==A.ySnapped)&&f.current&&S.current&&(b.current=M.sourceEvent,N.current=Ps(M.sourceEvent,w.current),I(A))}}).on("end",M=>{if(!(!S.current||E.current)&&(p(!1),k.current=!1,S.current=!1,cancelAnimationFrame(v.current),f.current)){const{updateNodePositions:A,nodeInternals:q,onNodeDragStop:G,onSelectionDragStop:Y}=u.getState(),R=i?G:eh(Y);if(A(f.current,!1,!1),R){const[Q,H]=Jf({nodeId:i,dragItems:f.current,nodeInternals:q});R(M.sourceEvent,Q,H)}}}).filter(M=>{const A=M.target;return!M.button&&(!n||!Fb(A,`.${n}`,e))&&(!s||Fb(A,s,e))});return j.call(z),()=>{j.on(".drag",null)}}}},[e,t,n,s,a,u,i,l,C]),h}function Bj(){const e=At();return _.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")),v=u?h[0]:5,w=u?h[1]:5,N=n.isShiftPressed?4:1,b=n.x*v*N,k=n.y*w*N,S=g.map(E=>{if(E.positionAbsolute){const C={x:E.positionAbsolute.x+b,y:E.positionAbsolute.y+k};u&&(C.x=h[0]*Math.round(C.x/h[0]),C.y=h[1]*Math.round(C.y/h[1]));const{positionAbsolute:j,position:I}=Fj(E,C,s,i,void 0,p);E.position=I,E.positionAbsolute=j}return E});a(S,!0,!1)},[])}const Li={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var Za=e=>{const t=({id:n,type:s,data:i,xPos:a,yPos:l,xPosOrigin:u,yPosOrigin:h,selected:p,onClick:f,onMouseEnter:g,onMouseMove:v,onMouseLeave:w,onContextMenu:N,onDoubleClick:b,style:k,className:S,isDraggable:E,isSelectable:C,isConnectable:j,isFocusable:I,selectNodesOnDrag:O,sourcePosition:P,targetPosition:z,hidden:M,resizeObserver:A,dragHandle:q,zIndex:G,isParent:Y,noDragClassName:R,noPanClassName:Q,initialized:H,disableKeyboardA11y:ne,ariaLabel:X,rfId:U,hasHandleBounds:J})=>{const $=At(),V=_.useRef(null),Z=_.useRef(null),D=_.useRef(P),L=_.useRef(z),K=_.useRef(s),se=C||E||f||g||v||w,he=Bj(),me=Qa(n,$.getState,g),xe=Qa(n,$.getState,v),Ee=Qa(n,$.getState,w),He=Qa(n,$.getState,N),Fe=Qa(n,$.getState,b),Ie=re=>{const{nodeDragThreshold:pe}=$.getState();if(C&&(!O||!E||pe>0)&&Bv({id:n,store:$,nodeRef:V}),f){const Oe=$.getState().nodeInternals.get(n);Oe&&f(re,{...Oe})}},be=re=>{if(!Lv(re)&&!ne)if(hj.includes(re.key)&&C){const pe=re.key==="Escape";Bv({id:n,store:$,unselect:pe,nodeRef:V})}else E&&p&&Object.prototype.hasOwnProperty.call(Li,re.key)&&($.setState({ariaLiveMessage:`Moved selected node ${re.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~a}, y: ${~~l}`}),he({x:Li[re.key].x,y:Li[re.key].y,isShiftPressed:re.shiftKey}))};_.useEffect(()=>()=>{Z.current&&(A==null||A.unobserve(Z.current),Z.current=null)},[]),_.useEffect(()=>{if(V.current&&!M){const re=V.current;(!H||!J||Z.current!==re)&&(Z.current&&(A==null||A.unobserve(Z.current)),A==null||A.observe(re),Z.current=re)}},[M,H,J]),_.useEffect(()=>{const re=K.current!==s,pe=D.current!==P,Oe=L.current!==z;V.current&&(re||pe||Oe)&&(re&&(K.current=s),pe&&(D.current=P),Oe&&(L.current=z),$.getState().updateNodeDimensions([{id:n,nodeElement:V.current,forceUpdate:!0}]))},[n,s,P,z]);const ue=zj({nodeRef:V,disabled:M||!E,noDragClassName:R,handleSelector:q,nodeId:n,isSelectable:C,selectNodesOnDrag:O});return M?null:de.createElement("div",{className:Gt(["react-flow__node",`react-flow__node-${s}`,{[Q]:E},S,{selected:p,selectable:C,parent:Y,dragging:ue}]),ref:V,style:{zIndex:G,transform:`translate(${u}px,${h}px)`,pointerEvents:se?"all":"none",visibility:H?"visible":"hidden",...k},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:me,onMouseMove:xe,onMouseLeave:Ee,onContextMenu:He,onClick:Ie,onDoubleClick:Fe,onKeyDown:I?be:void 0,tabIndex:I?0:void 0,role:I?"button":void 0,"aria-describedby":ne?void 0:`${Ij}-${U}`,"aria-label":X},de.createElement(sP,{value:n},de.createElement(e,{id:n,data:i,type:s,xPos:a,yPos:l,selected:p,isConnectable:j,sourcePosition:P,targetPosition:z,dragging:ue,dragHandle:q,zIndex:G})))};return t.displayName="NodeWrapper",_.memo(t)};const GP=e=>{const t=e.getNodes().filter(n=>n.selected);return{...Bu(t,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};function VP({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const s=At(),{width:i,height:a,x:l,y:u,transformString:h,userSelectionActive:p}=lt(GP,qt),f=Bj(),g=_.useRef(null);if(_.useEffect(()=>{var N;n||(N=g.current)==null||N.focus({preventScroll:!0})},[n]),zj({nodeRef:g}),p||!i||!a)return null;const v=e?N=>{const b=s.getState().getNodes().filter(k=>k.selected);e(N,b)}:void 0,w=N=>{Object.prototype.hasOwnProperty.call(Li,N.key)&&f({x:Li[N.key].x,y:Li[N.key].y,isShiftPressed:N.shiftKey})};return de.createElement("div",{className:Gt(["react-flow__nodesselection","react-flow__container",t]),style:{transform:h}},de.createElement("div",{ref:g,className:"react-flow__nodesselection-rect",onContextMenu:v,tabIndex:n?void 0:-1,onKeyDown:n?void 0:w,style:{width:i,height:a,top:u,left:l}}))}var YP=_.memo(VP);const KP=e=>e.nodesSelectionActive,Uj=({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:v,selectionMode:w,onSelectionStart:N,onSelectionEnd:b,multiSelectionKeyCode:k,panActivationKeyCode:S,zoomActivationKeyCode:E,elementsSelectable:C,zoomOnScroll:j,zoomOnPinch:I,panOnScroll:O,panOnScrollSpeed:P,panOnScrollMode:z,zoomOnDoubleClick:M,panOnDrag:A,defaultViewport:q,translateExtent:G,minZoom:Y,maxZoom:R,preventScrolling:Q,onSelectionContextMenu:H,noWheelClassName:ne,noPanClassName:X,disableKeyboardA11y:U})=>{const J=lt(KP),$=yl(g),V=yl(S),Z=V||A,D=V||O,L=$||v&&Z!==!0;return IP({deleteKeyCode:u,multiSelectionKeyCode:k}),de.createElement(LP,{onMove:h,onMoveStart:p,onMoveEnd:f,onPaneContextMenu:a,elementsSelectable:C,zoomOnScroll:j,zoomOnPinch:I,panOnScroll:D,panOnScrollSpeed:P,panOnScrollMode:z,zoomOnDoubleClick:M,panOnDrag:!$&&Z,defaultViewport:q,translateExtent:G,minZoom:Y,maxZoom:R,zoomActivationKeyCode:E,preventScrolling:Q,noWheelClassName:ne,noPanClassName:X},de.createElement(qj,{onSelectionStart:N,onSelectionEnd:b,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:s,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:l,panOnDrag:Z,isSelecting:!!L,selectionMode:w},e,J&&de.createElement(YP,{onSelectionContextMenu:H,noPanClassName:X,disableKeyboardA11y:U})))};Uj.displayName="FlowRenderer";var XP=_.memo(Uj);function QP(e){return lt(_.useCallback(n=>e?xj(n.nodeInternals,{x:0,y:0,width:n.width,height:n.height},n.transform,!0):n.getNodes(),[e]))}function ZP(e){const t={input:Za(e.input||Tj),default:Za(e.default||zv),output:Za(e.output||Aj),group:Za(e.group||Sw)},n={},s=Object.keys(e).filter(i=>!["input","default","output","group"].includes(i)).reduce((i,a)=>(i[a]=Za(e[a]||zv),i),n);return{...t,...s}}const JP=({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]},e$=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),Wj=e=>{const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:s,elementsSelectable:i,updateNodeDimensions:a,onError:l}=lt(e$,qt),u=QP(e.onlyRenderVisibleElements),h=_.useRef(),p=_.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const f=new ResizeObserver(g=>{const v=g.map(w=>({id:w.target.getAttribute("data-id"),nodeElement:w.target,forceUpdate:!0}));a(v)});return h.current=f,f},[]);return _.useEffect(()=>()=>{var f;(f=h==null?void 0:h.current)==null||f.disconnect()},[]),de.createElement("div",{className:"react-flow__nodes",style:Nw},u.map(f=>{var I,O,P;let g=f.type||"default";e.nodeTypes[g]||(l==null||l("003",Jr.error003(g)),g="default");const v=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"),k=!!(f.focusable||s&&typeof f.focusable>"u"),S=e.nodeExtent?vw(f.positionAbsolute,e.nodeExtent):f.positionAbsolute,E=(S==null?void 0:S.x)??0,C=(S==null?void 0:S.y)??0,j=JP({x:E,y:C,width:f.width??0,height:f.height??0,origin:e.nodeOrigin});return de.createElement(v,{key:f.id,id:f.id,className:f.className,style:f.style,type:g,data:f.data,sourcePosition:f.sourcePosition||$e.Bottom,targetPosition:f.targetPosition||$e.Top,hidden:f.hidden,xPos:E,yPos:C,xPosOrigin:j.x,yPosOrigin:j.y,selectNodesOnDrag:e.selectNodesOnDrag,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,selected:!!f.selected,isDraggable:w,isSelectable:N,isConnectable:b,isFocusable:k,resizeObserver:p,dragHandle:f.dragHandle,zIndex:((I=f[Et])==null?void 0:I.z)??0,isParent:!!((O=f[Et])!=null&&O.isParent),noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!f.width&&!!f.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:f.ariaLabel,hasHandleBounds:!!((P=f[Et])!=null&&P.handleBounds)})}))};Wj.displayName="NodeRenderer";var t$=_.memo(Wj);const n$=(e,t,n)=>n===$e.Left?e-t:n===$e.Right?e+t:e,r$=(e,t,n)=>n===$e.Top?e-t:n===$e.Bottom?e+t:e,Bb="react-flow__edgeupdater",Ub=({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:Gt([Bb,`${Bb}-${u}`]),cx:n$(t,s,e),cy:r$(n,s,e),r:s,stroke:"transparent",fill:"transparent"}),s$=()=>!0;var Ci=e=>{const t=({id:n,className:s,type:i,data:a,onClick:l,onEdgeDoubleClick:u,selected:h,animated:p,label:f,labelStyle:g,labelShowBg:v,labelBgStyle:w,labelBgPadding:N,labelBgBorderRadius:b,style:k,source:S,target:E,sourceX:C,sourceY:j,targetX:I,targetY:O,sourcePosition:P,targetPosition:z,elementsSelectable:M,hidden:A,sourceHandleId:q,targetHandleId:G,onContextMenu:Y,onMouseEnter:R,onMouseMove:Q,onMouseLeave:H,reconnectRadius:ne,onReconnect:X,onReconnectStart:U,onReconnectEnd:J,markerEnd:$,markerStart:V,rfId:Z,ariaLabel:D,isFocusable:L,isReconnectable:K,pathOptions:se,interactionWidth:he,disableKeyboardA11y:me})=>{const xe=_.useRef(null),[Ee,He]=_.useState(!1),[Fe,Ie]=_.useState(!1),be=At(),ue=_.useMemo(()=>`url('#${Dv(V,Z)}')`,[V,Z]),re=_.useMemo(()=>`url('#${Dv($,Z)}')`,[$,Z]);if(A)return null;const pe=Le=>{var Te;const{edges:ze,addSelectedEdges:Ce,unselectNodesAndEdges:Ve,multiSelectionActive:Ct}=be.getState(),rt=ze.find(wt=>wt.id===n);rt&&(M&&(be.setState({nodesSelectionActive:!1}),rt.selected&&Ct?(Ve({nodes:[],edges:[rt]}),(Te=xe.current)==null||Te.blur()):Ce([n])),l&&l(Le,rt))},Oe=Xa(n,be.getState,u),nt=Xa(n,be.getState,Y),st=Xa(n,be.getState,R),Xe=Xa(n,be.getState,Q),Pe=Xa(n,be.getState,H),Ue=(Le,ze)=>{if(Le.button!==0)return;const{edges:Ce,isValidConnection:Ve}=be.getState(),Ct=ze?E:S,rt=(ze?G:q)||null,Te=ze?"target":"source",wt=Ve||s$,dt=ze,St=Ce.find(Nn=>Nn.id===n);Ie(!0),U==null||U(Le,St,Te);const Sn=Nn=>{Ie(!1),J==null||J(Nn,St,Te)};Nj({event:Le,handleId:rt,nodeId:Ct,onConnect:Nn=>X==null?void 0:X(St,Nn),isTarget:dt,getState:be.getState,setState:be.setState,isValidConnection:wt,edgeUpdaterType:Te,onReconnectEnd:Sn})},Ge=Le=>Ue(Le,!0),it=Le=>Ue(Le,!1),ke=()=>He(!0),ct=()=>He(!1),It=!M&&!l,ae=Le=>{var ze;if(!me&&hj.includes(Le.key)&&M){const{unselectNodesAndEdges:Ce,addSelectedEdges:Ve,edges:Ct}=be.getState();Le.key==="Escape"?((ze=xe.current)==null||ze.blur(),Ce({edges:[Ct.find(Te=>Te.id===n)]})):Ve([n])}};return de.createElement("g",{className:Gt(["react-flow__edge",`react-flow__edge-${i}`,s,{selected:h,animated:p,inactive:It,updating:Ee}]),onClick:pe,onDoubleClick:Oe,onContextMenu:nt,onMouseEnter:st,onMouseMove:Xe,onMouseLeave:Pe,onKeyDown:L?ae: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 ${S} to ${E}`,"aria-describedby":L?`${Oj}-${Z}`:void 0,ref:xe},!Fe&&de.createElement(e,{id:n,source:S,target:E,selected:h,animated:p,label:f,labelStyle:g,labelShowBg:v,labelBgStyle:w,labelBgPadding:N,labelBgBorderRadius:b,data:a,style:k,sourceX:C,sourceY:j,targetX:I,targetY:O,sourcePosition:P,targetPosition:z,sourceHandleId:q,targetHandleId:G,markerStart:ue,markerEnd:re,pathOptions:se,interactionWidth:he}),K&&de.createElement(de.Fragment,null,(K==="source"||K===!0)&&de.createElement(Ub,{position:P,centerX:C,centerY:j,radius:ne,onMouseDown:Ge,onMouseEnter:ke,onMouseOut:ct,type:"source"}),(K==="target"||K===!0)&&de.createElement(Ub,{position:z,centerX:I,centerY:O,radius:ne,onMouseDown:it,onMouseEnter:ke,onMouseOut:ct,type:"target"})))};return t.displayName="EdgeWrapper",_.memo(t)};function o$(e){const t={default:Ci(e.default||ju),straight:Ci(e.bezier||bw),step:Ci(e.step||xw),smoothstep:Ci(e.step||zu),simplebezier:Ci(e.simplebezier||ww)},n={},s=Object.keys(e).filter(i=>!["default","bezier"].includes(i)).reduce((i,a)=>(i[a]=Ci(e[a]||ju),i),n);return{...t,...s}}function Wb(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 $e.Top:return{x:s+a/2,y:i};case $e.Right:return{x:s+a,y:i+l/2};case $e.Bottom:return{x:s+a/2,y:i+l};case $e.Left:return{x:s,y:i+l/2}}}function Hb(e,t){return e?e.length===1||!t?e[0]:t&&e.find(n=>n.id===t)||null:null}const i$=(e,t,n,s,i,a)=>{const l=Wb(n,e,t),u=Wb(a,s,i);return{sourceX:l.x,sourceY:l.y,targetX:u.x,targetY:u.y}};function a$({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=ml({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)),v=Math.max(0,Math.min(f.y2,p.y2)-Math.max(f.y,p.y));return Math.ceil(g*v)>0}function Gb(e){var s,i,a,l,u;const t=((s=e==null?void 0:e[Et])==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 l$=[{level:0,isMaxLevel:!0,edges:[]}];function c$(e,t,n=!1){let s=-1;const i=e.reduce((l,u)=>{var f,g;const h=Ln(u.zIndex);let p=h?u.zIndex:0;if(n){const v=t.get(u.target),w=t.get(u.source),N=u.selected||(v==null?void 0:v.selected)||(w==null?void 0:w.selected),b=Math.max(((f=w==null?void 0:w[Et])==null?void 0:f.z)||0,((g=v==null?void 0:v[Et])==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?l$:a}function u$(e,t,n){const s=lt(_.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)&&a$({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 c$(s,t,n)}const d$=({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"}),f$=({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"}),Vb={[Cu.Arrow]:d$,[Cu.ArrowClosed]:f$};function h$(e){const t=At();return _.useMemo(()=>{var i,a;return Object.prototype.hasOwnProperty.call(Vb,e)?Vb[e]:((a=(i=t.getState()).onError)==null||a.call(i,"009",Jr.error009(e)),null)},[e])}const p$=({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=h$(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},m$=({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=Dv(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))},Hj=({defaultColor:e,rfId:t})=>{const n=lt(_.useCallback(m$({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(p$,{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})))};Hj.displayName="MarkerDefinitions";var g$=_.memo(Hj);const y$=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}),Gj=({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:v,onReconnectStart:w,onReconnectEnd:N,reconnectRadius:b,children:k,disableKeyboardA11y:S})=>{const{edgesFocusable:E,edgesUpdatable:C,elementsSelectable:j,width:I,height:O,connectionMode:P,nodeInternals:z,onError:M}=lt(y$,qt),A=u$(t,z,n);return I?de.createElement(de.Fragment,null,A.map(({level:q,edges:G,isMaxLevel:Y})=>de.createElement("svg",{key:q,style:{zIndex:q},width:I,height:O,className:"react-flow__edges react-flow__container"},Y&&de.createElement(g$,{defaultColor:e,rfId:s}),de.createElement("g",null,G.map(R=>{const[Q,H,ne]=Gb(z.get(R.source)),[X,U,J]=Gb(z.get(R.target));if(!ne||!J)return null;let $=R.type||"default";i[$]||(M==null||M("011",Jr.error011($)),$="default");const V=i[$]||i.default,Z=P===So.Strict?U.target:(U.target??[]).concat(U.source??[]),D=Hb(H.source,R.sourceHandle),L=Hb(Z,R.targetHandle),K=(D==null?void 0:D.position)||$e.Bottom,se=(L==null?void 0:L.position)||$e.Top,he=!!(R.focusable||E&&typeof R.focusable>"u"),me=R.reconnectable||R.updatable,xe=typeof v<"u"&&(me||C&&typeof me>"u");if(!D||!L)return M==null||M("008",Jr.error008(D,R)),null;const{sourceX:Ee,sourceY:He,targetX:Fe,targetY:Ie}=i$(Q,D,K,X,L,se);return de.createElement(V,{key:R.id,id:R.id,className:Gt([R.className,a]),type:$,data:R.data,selected:!!R.selected,animated:!!R.animated,hidden:!!R.hidden,label:R.label,labelStyle:R.labelStyle,labelShowBg:R.labelShowBg,labelBgStyle:R.labelBgStyle,labelBgPadding:R.labelBgPadding,labelBgBorderRadius:R.labelBgBorderRadius,style:R.style,source:R.source,target:R.target,sourceHandleId:R.sourceHandle,targetHandleId:R.targetHandle,markerEnd:R.markerEnd,markerStart:R.markerStart,sourceX:Ee,sourceY:He,targetX:Fe,targetY:Ie,sourcePosition:K,targetPosition:se,elementsSelectable:j,onContextMenu:l,onMouseEnter:u,onMouseMove:h,onMouseLeave:p,onClick:f,onEdgeDoubleClick:g,onReconnect:v,onReconnectStart:w,onReconnectEnd:N,reconnectRadius:b,rfId:s,ariaLabel:R.ariaLabel,isFocusable:he,isReconnectable:xe,pathOptions:"pathOptions"in R?R.pathOptions:void 0,interactionWidth:R.interactionWidth,disableKeyboardA11y:S})})))),k):null};Gj.displayName="EdgeRenderer";var v$=_.memo(Gj);const w$=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function x$({children:e}){const t=lt(w$);return de.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:t}},e)}function b$(e){const t=Cl(),n=_.useRef(!1);_.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const k$={[$e.Left]:$e.Right,[$e.Right]:$e.Left,[$e.Top]:$e.Bottom,[$e.Bottom]:$e.Top},Vj=({nodeId:e,handleType:t,style:n,type:s=Os.Bezier,CustomComponent:i,connectionStatus:a})=>{var O,P,z;const{fromNode:l,handleId:u,toX:h,toY:p,connectionMode:f}=lt(_.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]),qt),g=(O=l==null?void 0:l[Et])==null?void 0:O.handleBounds;let v=g==null?void 0:g[t];if(f===So.Loose&&(v=v||(g==null?void 0:g[t==="source"?"target":"source"])),!l||!v)return null;const w=u?v.find(M=>M.id===u):v[0],N=w?w.x+w.width/2:(l.width??0)/2,b=w?w.y+w.height/2:l.height??0,k=(((P=l.positionAbsolute)==null?void 0:P.x)??0)+N,S=(((z=l.positionAbsolute)==null?void 0:z.y)??0)+b,E=w==null?void 0:w.position,C=E?k$[E]:null;if(!E||!C)return null;if(i)return de.createElement(i,{connectionLineType:s,connectionLineStyle:n,fromNode:l,fromHandle:w,fromX:k,fromY:S,toX:h,toY:p,fromPosition:E,toPosition:C,connectionStatus:a});let j="";const I={sourceX:k,sourceY:S,sourcePosition:E,targetX:h,targetY:p,targetPosition:C};return s===Os.Bezier?[j]=vj(I):s===Os.Step?[j]=qv({...I,borderRadius:0}):s===Os.SmoothStep?[j]=qv(I):s===Os.SimpleBezier?[j]=yj(I):j=`M${k},${S} ${h},${p}`,de.createElement("path",{d:j,fill:"none",className:"react-flow__connection-path",style:n})};Vj.displayName="ConnectionLine";const _$=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function S$({containerStyle:e,style:t,type:n,component:s}){const{nodeId:i,handleType:a,nodesConnectable:l,width:u,height:h,connectionStatus:p}=lt(_$,qt);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:Gt(["react-flow__connection",p])},de.createElement(Vj,{nodeId:i,handleType:a,style:t,type:n,CustomComponent:s,connectionStatus:p})))}function Yb(e,t){return _.useRef(null),At(),_.useMemo(()=>t(e),[e])}const Yj=({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:v,onNodeContextMenu:w,onSelectionContextMenu:N,onSelectionStart:b,onSelectionEnd:k,connectionLineType:S,connectionLineStyle:E,connectionLineComponent:C,connectionLineContainerStyle:j,selectionKeyCode:I,selectionOnDrag:O,selectionMode:P,multiSelectionKeyCode:z,panActivationKeyCode:M,zoomActivationKeyCode:A,deleteKeyCode:q,onlyRenderVisibleElements:G,elementsSelectable:Y,selectNodesOnDrag:R,defaultViewport:Q,translateExtent:H,minZoom:ne,maxZoom:X,preventScrolling:U,defaultMarkerColor:J,zoomOnScroll:$,zoomOnPinch:V,panOnScroll:Z,panOnScrollSpeed:D,panOnScrollMode:L,zoomOnDoubleClick:K,panOnDrag:se,onPaneClick:he,onPaneMouseEnter:me,onPaneMouseMove:xe,onPaneMouseLeave:Ee,onPaneScroll:He,onPaneContextMenu:Fe,onEdgeContextMenu:Ie,onEdgeMouseEnter:be,onEdgeMouseMove:ue,onEdgeMouseLeave:re,onReconnect:pe,onReconnectStart:Oe,onReconnectEnd:nt,reconnectRadius:st,noDragClassName:Xe,noWheelClassName:Pe,noPanClassName:Ue,elevateEdgesOnSelect:Ge,disableKeyboardA11y:it,nodeOrigin:ke,nodeExtent:ct,rfId:It})=>{const ae=Yb(e,ZP),Le=Yb(t,o$);return b$(a),de.createElement(XP,{onPaneClick:he,onPaneMouseEnter:me,onPaneMouseMove:xe,onPaneMouseLeave:Ee,onPaneContextMenu:Fe,onPaneScroll:He,deleteKeyCode:q,selectionKeyCode:I,selectionOnDrag:O,selectionMode:P,onSelectionStart:b,onSelectionEnd:k,multiSelectionKeyCode:z,panActivationKeyCode:M,zoomActivationKeyCode:A,elementsSelectable:Y,onMove:n,onMoveStart:s,onMoveEnd:i,zoomOnScroll:$,zoomOnPinch:V,zoomOnDoubleClick:K,panOnScroll:Z,panOnScrollSpeed:D,panOnScrollMode:L,panOnDrag:se,defaultViewport:Q,translateExtent:H,minZoom:ne,maxZoom:X,onSelectionContextMenu:N,preventScrolling:U,noDragClassName:Xe,noWheelClassName:Pe,noPanClassName:Ue,disableKeyboardA11y:it},de.createElement(x$,null,de.createElement(v$,{edgeTypes:Le,onEdgeClick:u,onEdgeDoubleClick:p,onlyRenderVisibleElements:G,onEdgeContextMenu:Ie,onEdgeMouseEnter:be,onEdgeMouseMove:ue,onEdgeMouseLeave:re,onReconnect:pe,onReconnectStart:Oe,onReconnectEnd:nt,reconnectRadius:st,defaultMarkerColor:J,noPanClassName:Ue,elevateEdgesOnSelect:!!Ge,disableKeyboardA11y:it,rfId:It},de.createElement(S$,{style:E,type:S,component:C,containerStyle:j})),de.createElement("div",{className:"react-flow__edgelabel-renderer"}),de.createElement(t$,{nodeTypes:ae,onNodeClick:l,onNodeDoubleClick:h,onNodeMouseEnter:f,onNodeMouseMove:g,onNodeMouseLeave:v,onNodeContextMenu:w,selectNodesOnDrag:R,onlyRenderVisibleElements:G,noPanClassName:Ue,noDragClassName:Xe,disableKeyboardA11y:it,nodeOrigin:ke,nodeExtent:ct,rfId:It})))};Yj.displayName="GraphView";var N$=_.memo(Yj);const Uv=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],As={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:Uv,nodeExtent:Uv,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:So.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:ZO,isValidConnection:void 0},E$=()=>h2((e,t)=>({...As,setNodes:n=>{const{nodeInternals:s,nodeOrigin:i,elevateNodesOnSelect:a}=t();e({nodeInternals:Qf(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?Qf(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:v}=new window.DOMMatrixReadOnly(g.transform),w=n.reduce((b,k)=>{const S=i.get(k.id);if(S!=null&&S.hidden)i.set(S.id,{...S,[Et]:{...S[Et],handleBounds:void 0}});else if(S){const E=yw(k.nodeElement);!!(E.width&&E.height&&(S.width!==E.width||S.height!==E.height||k.forceUpdate))&&(i.set(S.id,{...S,[Et]:{...S[Et],handleBounds:{source:zb(".source",k.nodeElement,v,p),target:zb(".target",k.nodeElement,v,p)}},...E}),b.push({id:S.id,type:"dimensions",dimensions:E}))}return b},[]);$j(i,p);const N=l||a&&!l&&Lj(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=zP(n,u()),f=Qf(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=>Is(h,!0)):(l=Mi(a(),n),u=Mi(i,[])),nu({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=>Is(h,!0)):(l=Mi(i,n),u=Mi(a(),[])),nu({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,Is(f.id,!1))),p=u.map(f=>Is(f.id,!1));nu({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=>Is(u.id,!1)),l=n.filter(u=>u.selected).map(u=>Is(u.id,!1));nu({changedNodes:a,changedEdges:l,get:t,set:e})},setNodeExtent:n=>{const{nodeInternals:s}=t();s.forEach(i=>{i.positionAbsolute=vw(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=Qr.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:As.connectionNodeId,connectionHandleId:As.connectionHandleId,connectionHandleType:As.connectionHandleType,connectionStatus:As.connectionStatus,connectionStartHandle:As.connectionStartHandle,connectionEndHandle:As.connectionEndHandle}),reset:()=>e({...As})}),Object.is),Ew=({children:e})=>{const t=_.useRef(null);return t.current||(t.current=E$()),de.createElement(HO,{value:t.current},e)};Ew.displayName="ReactFlowProvider";const Kj=({children:e})=>_.useContext(Fu)?de.createElement(de.Fragment,null,e):de.createElement(Ew,null,e);Kj.displayName="ReactFlowWrapper";const C$={input:Tj,default:zv,output:Aj,group:Sw},j$={default:ju,straight:bw,step:xw,smoothstep:zu,simplebezier:ww},T$=[0,0],R$=[15,15],A$={x:0,y:0,zoom:1},M$={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},Xj=_.forwardRef(({nodes:e,edges:t,defaultNodes:n,defaultEdges:s,className:i,nodeTypes:a=C$,edgeTypes:l=j$,onNodeClick:u,onEdgeClick:h,onInit:p,onMove:f,onMoveStart:g,onMoveEnd:v,onConnect:w,onConnectStart:N,onConnectEnd:b,onClickConnectStart:k,onClickConnectEnd:S,onNodeMouseEnter:E,onNodeMouseMove:C,onNodeMouseLeave:j,onNodeContextMenu:I,onNodeDoubleClick:O,onNodeDragStart:P,onNodeDrag:z,onNodeDragStop:M,onNodesDelete:A,onEdgesDelete:q,onSelectionChange:G,onSelectionDragStart:Y,onSelectionDrag:R,onSelectionDragStop:Q,onSelectionContextMenu:H,onSelectionStart:ne,onSelectionEnd:X,connectionMode:U=So.Strict,connectionLineType:J=Os.Bezier,connectionLineStyle:$,connectionLineComponent:V,connectionLineContainerStyle:Z,deleteKeyCode:D="Backspace",selectionKeyCode:L="Shift",selectionOnDrag:K=!1,selectionMode:se=gl.Full,panActivationKeyCode:he="Space",multiSelectionKeyCode:me=Eu()?"Meta":"Control",zoomActivationKeyCode:xe=Eu()?"Meta":"Control",snapToGrid:Ee=!1,snapGrid:He=R$,onlyRenderVisibleElements:Fe=!1,selectNodesOnDrag:Ie=!0,nodesDraggable:be,nodesConnectable:ue,nodesFocusable:re,nodeOrigin:pe=T$,edgesFocusable:Oe,edgesUpdatable:nt,elementsSelectable:st,defaultViewport:Xe=A$,minZoom:Pe=.5,maxZoom:Ue=2,translateExtent:Ge=Uv,preventScrolling:it=!0,nodeExtent:ke,defaultMarkerColor:ct="#b1b1b7",zoomOnScroll:It=!0,zoomOnPinch:ae=!0,panOnScroll:Le=!1,panOnScrollSpeed:ze=.5,panOnScrollMode:Ce=xo.Free,zoomOnDoubleClick:Ve=!0,panOnDrag:Ct=!0,onPaneClick:rt,onPaneMouseEnter:Te,onPaneMouseMove:wt,onPaneMouseLeave:dt,onPaneScroll:St,onPaneContextMenu:Sn,children:Fn,onEdgeContextMenu:Nn,onEdgeDoubleClick:To,onEdgeMouseEnter:hn,onEdgeMouseMove:Ro,onEdgeMouseLeave:Ao,onEdgeUpdate:Ut,onEdgeUpdateStart:Tr,onEdgeUpdateEnd:zn,onReconnect:Ds,onReconnectStart:Rr,onReconnectEnd:na,reconnectRadius:fr=10,edgeUpdaterRadius:Ar=10,onNodesChange:hr,onEdgesChange:ns,noDragClassName:Mo="nodrag",noWheelClassName:Io="nowheel",noPanClassName:Oo="nopan",fitView:En=!1,fitViewOptions:Po,connectOnClick:Mr=!0,attributionPosition:$o,proOptions:Bn,defaultEdgeOptions:Lo,elevateNodesOnSelect:Fs=!0,elevateEdgesOnSelect:zs=!1,disableKeyboardA11y:qo=!1,autoPanOnConnect:Do=!0,autoPanOnNodeDrag:at=!0,connectionRadius:ra=20,isValidConnection:rs,onError:Vt,style:Un,id:Fo,nodeDragThreshold:ss,...xt},rn)=>{const Wn=Fo||"1";return de.createElement("div",{...xt,style:{...Un,...M$},ref:rn,className:Gt(["react-flow",i]),"data-testid":"rf__wrapper",id:Fo},de.createElement(Kj,null,de.createElement(N$,{onInit:p,onMove:f,onMoveStart:g,onMoveEnd:v,onNodeClick:u,onEdgeClick:h,onNodeMouseEnter:E,onNodeMouseMove:C,onNodeMouseLeave:j,onNodeContextMenu:I,onNodeDoubleClick:O,nodeTypes:a,edgeTypes:l,connectionLineType:J,connectionLineStyle:$,connectionLineComponent:V,connectionLineContainerStyle:Z,selectionKeyCode:L,selectionOnDrag:K,selectionMode:se,deleteKeyCode:D,multiSelectionKeyCode:me,panActivationKeyCode:he,zoomActivationKeyCode:xe,onlyRenderVisibleElements:Fe,selectNodesOnDrag:Ie,defaultViewport:Xe,translateExtent:Ge,minZoom:Pe,maxZoom:Ue,preventScrolling:it,zoomOnScroll:It,zoomOnPinch:ae,zoomOnDoubleClick:Ve,panOnScroll:Le,panOnScrollSpeed:ze,panOnScrollMode:Ce,panOnDrag:Ct,onPaneClick:rt,onPaneMouseEnter:Te,onPaneMouseMove:wt,onPaneMouseLeave:dt,onPaneScroll:St,onPaneContextMenu:Sn,onSelectionContextMenu:H,onSelectionStart:ne,onSelectionEnd:X,onEdgeContextMenu:Nn,onEdgeDoubleClick:To,onEdgeMouseEnter:hn,onEdgeMouseMove:Ro,onEdgeMouseLeave:Ao,onReconnect:Ds??Ut,onReconnectStart:Rr??Tr,onReconnectEnd:na??zn,reconnectRadius:fr??Ar,defaultMarkerColor:ct,noDragClassName:Mo,noWheelClassName:Io,noPanClassName:Oo,elevateEdgesOnSelect:zs,rfId:Wn,disableKeyboardA11y:qo,nodeOrigin:pe,nodeExtent:ke}),de.createElement(bP,{nodes:e,edges:t,defaultNodes:n,defaultEdges:s,onConnect:w,onConnectStart:N,onConnectEnd:b,onClickConnectStart:k,onClickConnectEnd:S,nodesDraggable:be,nodesConnectable:ue,nodesFocusable:re,edgesFocusable:Oe,edgesUpdatable:nt,elementsSelectable:st,elevateNodesOnSelect:Fs,minZoom:Pe,maxZoom:Ue,nodeExtent:ke,onNodesChange:hr,onEdgesChange:ns,snapToGrid:Ee,snapGrid:He,connectionMode:U,translateExtent:Ge,connectOnClick:Mr,defaultEdgeOptions:Lo,fitView:En,fitViewOptions:Po,onNodesDelete:A,onEdgesDelete:q,onNodeDragStart:P,onNodeDrag:z,onNodeDragStop:M,onSelectionDrag:R,onSelectionDragStart:Y,onSelectionDragStop:Q,noPanClassName:Oo,nodeOrigin:pe,rfId:Wn,autoPanOnConnect:Do,autoPanOnNodeDrag:at,onError:Vt,connectionRadius:ra,isValidConnection:rs,nodeDragThreshold:ss}),de.createElement(wP,{onSelectionChange:G}),Fn,de.createElement(VO,{proOptions:Bn,position:$o}),de.createElement(EP,{rfId:Wn,disableKeyboardA11y:qo})))});Xj.displayName="ReactFlow";const I$=e=>({x:e.transform[0],y:e.transform[1],zoom:e.transform[2]});function Qj(){return lt(I$,qt)}const Zj=({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:v,selected:w})=>{const{background:N,backgroundColor:b}=a||{},k=l||N||b;return de.createElement("rect",{className:Gt(["react-flow__minimap-node",{selected:w},p]),x:t,y:n,rx:f,ry:f,width:s,height:i,fill:k,stroke:u,strokeWidth:h,shapeRendering:g,onClick:v?S=>v(S,e):void 0})};Zj.displayName="MiniMapNode";var O$=_.memo(Zj);const P$=e=>e.nodeOrigin,$$=e=>e.getNodes().filter(t=>!t.hidden&&t.width&&t.height),th=e=>e instanceof Function?e:()=>e;function L$({nodeStrokeColor:e="transparent",nodeColor:t="#e2e2e2",nodeClassName:n="",nodeBorderRadius:s=5,nodeStrokeWidth:i=2,nodeComponent:a=O$,onClick:l}){const u=lt($$,qt),h=lt(P$),p=th(t),f=th(e),g=th(n),v=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return de.createElement(de.Fragment,null,u.map(w=>{const{x:N,y:b}=ko(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:v,onClick:l,id:w.id})}))}var q$=_.memo(L$);const D$=200,F$=150,z$=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?XO(Bu(t,e.nodeOrigin),n):n,rfId:e.rfId}},B$="react-flow__minimap-desc";function Jj({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:v,onNodeClick:w,pannable:N=!1,zoomable:b=!1,ariaLabel:k="React Flow mini map",inversePan:S=!1,zoomStep:E=10,offsetScale:C=5}){const j=At(),I=_.useRef(null),{boundingRect:O,viewBB:P,rfId:z}=lt(z$,qt),M=(e==null?void 0:e.width)??D$,A=(e==null?void 0:e.height)??F$,q=O.width/M,G=O.height/A,Y=Math.max(q,G),R=Y*M,Q=Y*A,H=C*Y,ne=O.x-(R-O.width)/2-H,X=O.y-(Q-O.height)/2-H,U=R+H*2,J=Q+H*2,$=`${B$}-${z}`,V=_.useRef(0);V.current=Y,_.useEffect(()=>{if(I.current){const L=$n(I.current),K=me=>{const{transform:xe,d3Selection:Ee,d3Zoom:He}=j.getState();if(me.sourceEvent.type!=="wheel"||!Ee||!He)return;const Fe=-me.sourceEvent.deltaY*(me.sourceEvent.deltaMode===1?.05:me.sourceEvent.deltaMode?1:.002)*E,Ie=xe[2]*Math.pow(2,Fe);He.scaleTo(Ee,Ie)},se=me=>{const{transform:xe,d3Selection:Ee,d3Zoom:He,translateExtent:Fe,width:Ie,height:be}=j.getState();if(me.sourceEvent.type!=="mousemove"||!Ee||!He)return;const ue=V.current*Math.max(1,xe[2])*(S?-1:1),re={x:xe[0]-me.sourceEvent.movementX*ue,y:xe[1]-me.sourceEvent.movementY*ue},pe=[[0,0],[Ie,be]],Oe=Qr.translate(re.x,re.y).scale(xe[2]),nt=He.constrain()(Oe,pe,Fe);He.transform(Ee,nt)},he=aj().on("zoom",N?se:null).on("zoom.wheel",b?K:null);return L.call(he),()=>{L.on("zoom",null)}}},[N,b,S,E]);const Z=v?L=>{const K=sr(L);v(L,{x:K[0],y:K[1]})}:void 0,D=w?(L,K)=>{const se=j.getState().nodeInternals.get(K);w(L,se)}:void 0;return de.createElement(gw,{position:g,style:e,className:Gt(["react-flow__minimap",t]),"data-testid":"rf__minimap"},de.createElement("svg",{width:M,height:A,viewBox:`${ne} ${X} ${U} ${J}`,role:"img","aria-labelledby":$,ref:I,onClick:Z},k&&de.createElement("title",{id:$},k),de.createElement(q$,{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-H},${X-H}h${U+H*2}v${J+H*2}h${-U-H*2}z
57
+ M${P.x},${P.y}h${P.width}v${P.height}h${-P.width}z`,fill:h,fillRule:"evenodd",stroke:p,strokeWidth:f,pointerEvents:"none"})))}Jj.displayName="MiniMap";var U$=_.memo(Jj);function W$(){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 H$(){return de.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},de.createElement("path",{d:"M0 0h32v4.2H0z"}))}function G$(){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 V$(){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 Y$(){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 Nr=({children:e,className:t,...n})=>de.createElement("button",{type:"button",className:Gt(["react-flow__controls-button",t]),...n},e);Nr.displayName="ControlButton";const K$=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom}),eT=({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 v=At(),[w,N]=_.useState(!1),{isInteractive:b,minZoomReached:k,maxZoomReached:S}=lt(K$,qt),{zoomIn:E,zoomOut:C,fitView:j}=Cl();if(_.useEffect(()=>{N(!0)},[]),!w)return null;const I=()=>{E(),a==null||a()},O=()=>{C(),l==null||l()},P=()=>{j(i),u==null||u()},z=()=>{v.setState({nodesDraggable:!b,nodesConnectable:!b,elementsSelectable:!b}),h==null||h(!b)};return de.createElement(gw,{className:Gt(["react-flow__controls",p]),position:g,style:e,"data-testid":"rf__controls"},t&&de.createElement(de.Fragment,null,de.createElement(Nr,{onClick:I,className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:S},de.createElement(W$,null)),de.createElement(Nr,{onClick:O,className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:k},de.createElement(H$,null))),n&&de.createElement(Nr,{className:"react-flow__controls-fitview",onClick:P,title:"fit view","aria-label":"fit view"},de.createElement(G$,null)),s&&de.createElement(Nr,{className:"react-flow__controls-interactive",onClick:z,title:"toggle interactivity","aria-label":"toggle interactivity"},b?de.createElement(Y$,null):de.createElement(V$,null)),f)};eT.displayName="Controls";var X$=_.memo(eT),lr;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(lr||(lr={}));function Q$({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 Z$({color:e,radius:t}){return de.createElement("circle",{cx:t,cy:t,r:t,fill:e})}const J$={[lr.Dots]:"#91919a",[lr.Lines]:"#eee",[lr.Cross]:"#e2e2e2"},eL={[lr.Dots]:1,[lr.Lines]:1,[lr.Cross]:6},tL=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function tT({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=_.useRef(null),{transform:f,patternId:g}=lt(tL,qt),v=l||J$[t],w=s||eL[t],N=t===lr.Dots,b=t===lr.Cross,k=Array.isArray(n)?n:[n,n],S=[k[0]*f[2]||1,k[1]*f[2]||1],E=w*f[2],C=b?[E,E]:S,j=N?[E/a,E/a]:[C[0]/a,C[1]/a];return de.createElement("svg",{className:Gt(["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]%S[0],y:f[1]%S[1],width:S[0],height:S[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${j[0]},-${j[1]})`},N?de.createElement(Z$,{color:v,radius:E/a}):de.createElement(Q$,{dimensions:C,color:v,lineWidth:i})),de.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${g+e})`}))}tT.displayName="Background";var nL=_.memo(tT);const rL=["us-gov","global","apac","us","eu","jp","au"],sL=new RegExp(`^(?:(?:${rL.join("|")})\\.)?anthropic\\.`,"i");function jl(e){return e.replace(sL,"")}const oL=["command","cmd","file_path","path","url","pattern","notebook_path"],Kb=120,nh=e=>e.length>Kb?`${e.slice(0,Kb-1)}…`:e;function iL(e){if(typeof e=="string")return e.trim()?nh(e.trim()):null;if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e;for(const n of oL){const s=t[n];if(typeof s=="string"&&s.trim())return nh(s.trim());if(Array.isArray(s)&&s.length>0&&s.every(i=>typeof i=="string")){const i=s.join(" ").trim();if(i)return nh(i)}}return null}function nT(){return{inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0}}function Cw(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 aL(e){const t=Cw(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 lL(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]=aL(s));return Object.keys(t).length?t:void 0}function rT(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),...Cw(n)};for(const s of Object.values(n)){const i=rT(s,t+1);if(i)return i}return null}const cL=/^(?:claude[-_]|gpt[-_]|o\d|codex[-_])/i;function sT(e,t=0){if(!e||typeof e!="object"||t>6)return null;const n=e;if(typeof n.model=="string"&&cL.test(jl(n.model)))return n.model;for(const s of Object.values(n)){const i=sT(s,t+1);if(i)return i}return null}function Wv(){return{agents:new Map,toolIndex:new Map,toolOwner:new Map,activeSubagentStack:new Map,lastSeq:0,seqEpoch:null,totalEvents:0,revision:0}}function $s(e){if(!e)return;const t=e.replace(/\\/g,"/").split("/").filter(Boolean);return t[t.length-1]}function Xb(){return{msgsUser:0,msgsAssistant:0,toolUses:0,toolResults:0,systemReminders:0,currentContextTokens:0,memoryFiles:[]}}function Tl(e,t){return`${e}::${t}`}function Tu(e){return e.agent_type??e.subagent_type??"subagent"}function ll(e){return e.agent_id?e.agent_id:e.parent_tool_use_id?e.parent_tool_use_id:null}function Ii(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:nT()},e.agents.set(i,a),a)}function oT(e,t,n,s){const i=Tl(t,n),a=e.agents.get(i);if(!a)return null;!a.cwd&&s.cwd&&(a.cwd=s.cwd,a.cwdBasename=$s(s.cwd));const l=Tu(s);return l&&(a.label==="subagent"||!a.label)&&(a.label=l),a}function uL(e,t,n){const s=t.session_id??"unknown",i=ll(t);if(i){const h=oT(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(Tl(s,l));if(h)return!h.cwd&&t.cwd&&(h.cwd=t.cwd,h.cwdBasename=$s(t.cwd)),h}const u=Ii(e,s,n,t.hook_event_name!=="SessionStart");return!u.cwd&&t.cwd&&(u.cwd=t.cwd,u.cwdBasename=$s(t.cwd)),u.label==="session"&&t.cwd&&(u.label=$s(t.cwd)??"session"),u}function dL(e,t,n,s,i){const a=Tl(t,n),l=Ii(e,t,i,!0);let u=e.agents.get(a);if(u){!u.cwd&&s.cwd&&(u.cwd=s.cwd,u.cwdBasename=$s(s.cwd));const h=Tu(s);return h&&(u.label==="subagent"||!u.label)&&(u.label=h),u}return u={id:a,sessionId:t,label:Tu(s),kind:"subagent",parentId:l.id,state:"active",startedAt:i,tools:[],prompts:[],cwd:s.cwd,cwdBasename:$s(s.cwd),toolCount:0,childCount:0,usage:nT()},e.agents.set(a,u),l.childCount+=1,u}function fL(e,t,n){const s=e.activeSubagentStack.get(t)??[];s.includes(n)||(s.push(n),e.activeSubagentStack.set(t,s))}function hL(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 su(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 Qb=200,pL=25;function mL(e,t){const n=t.tools;if(n.length>Qb){const s=n.splice(0,n.length-Qb);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-pL-1;s>=0;s--){const i=n[s];if(i.trimmed)break;i.input=void 0,i.response=void 0,i.trimmed=!0}}function gL(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 Zb=2e3;function yL(e,t,n){for(let s=e.prompts.length-1;s>=0;s--){const i=e.prompts[s];if(i.at<t-Zb)return!1;if(i.text===n&&i.at<=t+Zb)return!0}return!1}function iT(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 Rl(e,t){return t&&(e.revision+=1),t}function vL(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&&(iT(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 Rl(e,u>0)}function wL(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&&iT(e,g),e.agents.delete(f)}u--,h=!0}return Rl(e,h)}function xL(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 bL(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 Rl(e,t)}function kL(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 Rl(e,s)}const Jb=90*6e4;function _L(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 Rl(e,s)}function SL(e){return e==="permission_prompt"?"permission":e==="agent_needs_input"?"asked":e==="idle_prompt"?"idle":null}const NL=new Set(["Notification","ModelObserved","ContextObserved","UsageObserved","SessionNamed"]);function EL(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}const CL=3e4;function jL(e,t){if(!(!e||!e.name)&&!(t-e.startedAt>CL)&&!(e.startedAt>t))return{name:e.name,preview:iL(e.input)??""}}function TL(e,t,n,s,i){if(n!=="permission")return{kind:n,message:s,since:i};const a=EL(e,t),l={kind:n,message:s,since:i};a!=null&&a.explicitSubagentId&&(l.subagentId=a.explicitSubagentId);const u=jL(a,i);return u&&(l.tool=u),l}function RL(e,t,n){if(e.kind==="idle")return!0;const s=ll(t);return s==null?!0:e.subagentId!=null&&Tl(n,s)===e.subagentId}function e1(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{...Wv(),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(!NL.has(a)){const f=e.agents.get(l);f!=null&&f.waiting&&RL(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??Xb(),currentContextTokens:s.context_tokens})}if(a==="ModelObserved"){const f=typeof s.model=="string"?s.model:null;if(f){const v=e.agents.get(l);v&&(v.model=f)}const g=s.subagentModels;if(g&&typeof g=="object")for(const[v,w]of Object.entries(g)){if(typeof w!="string")continue;const N=`${l}::${v}`,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 v=g.context??Xb(),w=(b,k)=>typeof f[b]=="number"?f[b]:k,N=Array.isArray(f.memoryFiles)?f.memoryFiles:Array.isArray(f.claudeMdFiles)?f.claudeMdFiles:null;g.context={msgsUser:w("msgsUser",v.msgsUser),msgsAssistant:w("msgsAssistant",v.msgsAssistant),toolUses:w("toolUses",v.toolUses),toolResults:w("toolResults",v.toolResults),systemReminders:w("systemReminders",v.systemReminders),currentContextTokens:w("currentContextTokens",v.currentContextTokens),memoryFiles:N??v.memoryFiles}}}return e}if(a==="SessionNamed"){const f=e.agents.get(l);if(f){const g=typeof s.sessionName=="string"?s.sessionName.trim():"",v=typeof s.sessionTitle=="string"?s.sessionTitle.trim():"";g&&(f.sessionName=g),v&&(f.sessionTitle=v);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 v=Cw(f);g.usage.cacheCreate1hTokens=v.cacheCreate1hTokens,g.usage.cacheCreate5mTokens=v.cacheCreate5mTokens,typeof f.reasoning_output_tokens=="number"&&(g.usage.reasoningOutputTokens=Number(f.reasoning_output_tokens)),g.usageByModel=lL(s.usageByModel)}}return e}const h=uL(e,s,i);h.provider||(h.provider=s.provider==="codex"?"codex":"claude");const p=sT(s);switch(p&&(h.model=p),a){case"SessionStart":{const f=Ii(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=$s(s.cwd)),f.label==="session"&&s.cwd&&(f.label=$s(s.cwd)??"session");break}case"UserPromptSubmit":{for(const v of e.agents.values())v.sessionId===l&&v.kind==="subagent"&&v.state==="done"&&v.exitAt==null&&v.endedAt!=null&&v.endedAt<i&&(v.exitAt=i);const f=Ii(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&&!yL(f,i,g)&&(f.prompts.push({at:i,text:g}),f.firstPrompt||(f.firstPrompt=su(g,120)));break}case"PreToolUse":{const f=s.tool_use_id?gL(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=su(s.tool_input));break}const g=s.tool_use_id??`${h.id}:${h.toolCount}`,v=ll(s),w={id:g,name:s.tool_name??"?",input:s.tool_input,inputPreview:su(s.tool_input),agentId:h.id,explicitSubagentId:v?Tl(l,v):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),mL(e,h);break}case"PostToolUse":case"PostToolUseFailure":{const f=s.tool_use_id;if(!f)break;let g=e.toolIndex.get(f),v=!1;if(!g)for(const N of e.agents.values()){const b=N.tools.find(k=>k.id===f);if(b){g=b,v=!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=su(s.tool_response):v&&(g.errorPreview=void 0);const w=rT(s.tool_response);w&&(g.usage=w),e.toolIndex.delete(f),e.toolOwner.delete(f);break}case"SubagentStart":{const f=ll(s);if(!f)break;const g=dL(e,l,f,s,i);g.state="active",g.startedAt=g.startedAt||i,g.exitAt=void 0,g.endedAt=void 0;const v=Tu(s);v&&(g.label=v),fL(e,l,f);break}case"SubagentStop":{const f=ll(s);if(!f)break;const g=oT(e,l,f,s);if(!g)break;g.state="done",g.endedAt=i,hL(e,l,f);break}case"Stop":case"SessionEnd":{const f=Ii(e,l,i,!1);f.state="done",f.endedAt=i,a==="SessionEnd"&&(f.closedAt=i),e.activeSubagentStack.delete(l);break}case"Notification":{const f=SL(s.notification_type);if(!f)break;const g=Ii(e,l,i,!1),v=typeof s.message=="string"?s.message:"",w=g.waiting;g.waiting=w&&w.kind===f&&w.message===v?{...w,since:Math.min(w.since,i)}:TL(e,l,f,v,i);break}}return e}function jw(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 AL={input:2,output:10,cacheRead:.2,cacheWrite:2.5,cacheWrite1h:4},ML=[{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:AL},{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 IL(e){return e?/^(?:gpt[-_]|codex[-_]|o\d)/i.test(e):!1}function Xi(e,t=Date.now()){if(!e)return null;const n=jl(e);for(const s of ML)if(s.match.test(n))return typeof s.rates=="function"?s.rates(t):s.rates;return null}function aT(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 lT(e,t,n=Date.now()){if(!IL(t))return e.inputTokens;const s=Xi(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 Tw(e,t,n=Date.now()){const s=Xi(t,n);if(!s)return{input:0,output:0,cacheRead:0,cacheWrite:0,total:0};const i=lT(e,t,n)*s.input/1e6,a=e.outputTokens*s.output/1e6,l=e.cacheReadTokens*s.cacheRead/1e6,u=aT(e,s),h=u.usd5m+u.usd1h;return{input:i,output:a,cacheRead:l,cacheWrite:h,total:i+a+l+h}}const t1=2e5,OL=1e6,PL=[/\[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],$L=[{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 LL(e){if(!e)return t1;const t=jl(e);for(const n of PL)if(n.test(t))return OL;for(const n of $L)if(n.match.test(t))return n.window;return t1}function cT(e,t){return typeof e=="number"&&e>0?e:LL(t)}const Ai="not priced";function Je(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 Rw(e,t){if(e<=0||t<10)return null;const n=e/t,s=n*60;return s>=.01?`${Je(s)}/min`:`${Je(n*3600)}/hr`}function qL(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 DL(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,v)=>Math.max(0,g-v),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 Al(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=DL(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:qL(s[a].usage,i)}:s.push({model:e.model,usage:i})}return s}function bn(e,t=Date.now()){const n={input:0,output:0,cacheRead:0,cacheWrite:0,total:0};for(const s of Al(e)){const i=Tw(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 Hv(e,t=Date.now()){let n=0;for(const s of Al(e))Xi(s.model,t)==null&&(n+=s.usage.inputTokens+s.usage.outputTokens);return n}function uT(e){const t=[];for(const n of Al(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 dT(e){return uT(e).filter(t=>t!==e.model)}const FL=new Set(["untrusted","on-request","on-failure"]);function zL(e){return typeof e!="string"||!e?null:FL.has(e)?!0:e==="never"?!1:null}function BL(e){if(e.provider!=="codex"||e.kind!=="root"||e.waiting||e.state!=="active")return null;const t=zL(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 n1(e){return e[0].toUpperCase()+e.slice(1).toLowerCase()}function Ls(e){const t=jl(e).replace(/[-_]\d{8}(?!\d)/,""),n=t.match(/^claude[-_](opus|sonnet|haiku|fable|mythos)[-_](\d+(?:[-_.]\d+)*)/i);if(n){const i=n1(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(n1);return[`GPT-${i}`,...a].join(" ")}return e}function Uu(e){const t=jl(e??""),n=t.match(/^claude[-_](opus|sonnet|haiku|fable|mythos)[-_]/i);return n?n[1].toLowerCase():/^gpt[-_]/i.test(t)?"gpt":""}function Ml(e){return(e==null?void 0:e.kind)==="permission"||(e==null?void 0:e.kind)==="asked"}function UL(e){const t=[];for(const n of e)n.kind==="root"&&Ml(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 WL(e){const t=new Set;for(const n of e)n.state==="active"&&t.add(n.sessionId);return t.size}function Wu(e,t){return`${e}@${t.since}`}function fT(e,t){if(!e.tool)return null;const{name:n,preview:s}=e.tool,i=new RegExp(`\\b${n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`,"i").test(t);return s?i?s:`${n} · ${s}`:i?null:n}function HL(e){const t=e.message||"Needs your permission",n=fT(e,t);return n?`${t}
60
+ Likely on: ${n}`:t}function GL(e,t,n,s=!0){if(!s)return[];if(n)return[];const i=[];for(const a of e){if(!Ml(a.waiting))continue;const l=Wu(a.id,a.waiting);t.has(l)||i.push({key:l,title:a.label,body:HL(a.waiting),sessionId:a.id})}return i}function VL(e,t,n){const s=new Set;for(const a of e)s.add(Wu(a.id,a.waiting));const i=new Set;for(const a of n)s.has(a)&&i.add(a);for(const a of t)i.add(a.key);return i}function r1(e){return new Set(e.map(t=>Wu(t.id,t.waiting)))}function YL(e,t){return e!==t}function KL(e,t){return t&&e==="default"}function Rt(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 Ru(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 hT(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 pT(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 XL=1,mT=-1;function QL(){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===mT}}}const qi=QL();function ZL(e){return e.overlayOpen&&!e.panelOnTop?"dismiss":e.typing?"blur":e.overlayOpen?"dismiss":"clear-selection"}function s1(e){return String(e.tagName??"").toUpperCase()==="BODY"}function JL(e,t){return!e||!e.isConnected||s1(e)?!1:t==null||s1(t)}const o1="a[href], button, input, select, textarea, [tabindex]";function e3(e){return!e||e.disabled||e.rendered===!1?!1:(e.tabIndex??0)>=0}function t3(e){if(!e||!e.overflowing||e.hasFocusable)return!1;const t=String(e.overflow??"").toLowerCase();return t==="auto"||t==="scroll"}function n3({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 Aw(e){return e.ctrlKey||e.metaKey||e.altKey}const r3=new Set(["button","checkbox","color","file","image","radio","range","reset","submit"]),s3=new Set(["INPUT","TEXTAREA","SELECT","OPTION","BUTTON","SUMMARY","A"]),o3=new Set(["button","checkbox","combobox","link","listbox","menu","menubar","menuitem","menuitemcheckbox","menuitemradio","option","radio","searchbox","slider","spinbutton","switch","tab","textbox","treeitem"]);function gT(e){return typeof e.tagName=="string"?e.tagName.toUpperCase():""}function Mw(e){if(!e)return!1;if(e.isContentEditable)return!0;const t=gT(e);return t==="TEXTAREA"?!0:t!=="INPUT"?!1:!r3.has(String(e.type??"text").toLowerCase())}function i3(e){if(!e)return!1;if(Mw(e)||s3.has(gT(e)))return!0;const t=typeof e.role=="string"?e.role.trim().toLowerCase():"";return t!==""&&t.split(/\s+/).some(n=>o3.has(n))}function a3({key:e,modalOpen:t,sheetOpen:n}){return t?!(e==="?"&&n):!1}function yT(e){return e?Array.from(e.querySelectorAll("*")).filter(t=>{if(t.matches(o1))return e3({disabled:t.disabled,tabIndex:t.tabIndex,rendered:t.getClientRects().length>0});const n=t.scrollHeight>t.clientHeight;return n&&t3({overflowing:n,overflow:getComputedStyle(t).overflowY,hasFocusable:t.querySelector(o1)!=null})}):[]}function l3(e,t){const n=yT(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 _n(e,t={}){const{focusRef:n,layer:s}=t,i=_.useRef(null),a=_.useRef(e);a.current=e;const l=_.useRef(null);l.current===null&&(l.current=()=>a.current());const u=l.current;return _.useEffect(()=>qi.push(u,s),[u,s]),_.useEffect(()=>{var p;const h=document.activeElement;return(p=(n==null?void 0:n.current)??yT(i.current)[0])==null||p.focus(),()=>{JL(h,document.activeElement)&&h.focus()}},[]),_.useEffect(()=>{const h=p=>{var b;if(p.key!=="Tab"||Aw(p))return;const f=i.current;if(!f)return;const g=document.activeElement;if(!(g!=null&&f.contains(g))&&!qi.isTop(u))return;const w=l3(f,g),N=n3({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 c3(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 Pn(e){return e.toLocaleString()}function u3(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(2)} MB`}const d3=60;function f3(e,t=d3){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 h3({agent:e,onClose:t}){var v;const n=_.useRef(null),s=_n(t,{focusRef:n}),i=e.context,a=e.usage,l=(i==null?void 0:i.currentContextTokens)??0,u=cT(e.contextWindow,e.model),h=Math.min(100,l/u*100),p=bn(e),f=a.inputTokens+a.cacheReadTokens+a.cacheCreateTokens,g=c3(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:[Pn(l)," / ",Pn(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:Pn(a.inputTokens)}),d.jsx(rr,{label:"output tokens",val:Pn(a.outputTokens)}),d.jsx(rr,{label:"cache reads",val:Pn(a.cacheReadTokens)}),d.jsx(rr,{label:"cache writes",val:Pn(a.cacheCreateTokens)}),d.jsx(rr,{label:"cumulative total",val:Pn(f)}),d.jsx(rr,{label:"estimated cost",val:Je(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:Pn((i==null?void 0:i.msgsUser)??0)}),d.jsx(rr,{label:"assistant messages",val:Pn((i==null?void 0:i.msgsAssistant)??0)}),d.jsx(rr,{label:"tool uses",val:Pn((i==null?void 0:i.toolUses)??0)}),d.jsx(rr,{label:"tool results",val:Pn((i==null?void 0:i.toolResults)??0)}),d.jsx(rr,{label:"system-reminders",val:Pn((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}),(((v=i==null?void 0:i.memoryFiles)==null?void 0:v.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:f3(w.path)}),d.jsx("span",{className:"ctx-md-size",children:u3(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 p3({currentContextTokens:e,modelId:t,contextWindow:n,size:s=26,onClick:i}){const a=cT(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 i1(e,t){const n=Xi(t);if(!n)return`model: ${t}
61
+ no published rate in this build — the tokens are counted, the dollars are not`;const s=f=>f.toLocaleString(),i=f=>`$${f}/MTok`,a=Tw(e,t),l=aT(e,n),u=l.tokens1h>0?[`cache w5m${s(l.tokens5m).padStart(14)} × ${i(n.cacheWrite).padEnd(11)} = ${Je(l.usd5m)}`,`cache w1h${s(l.tokens1h).padStart(14)} × ${i(n.cacheWrite1h??n.cacheWrite).padEnd(11)} = ${Je(l.usd1h)}`]:[`cache w ${s(l.tokens5m).padStart(14)} × ${i(n.cacheWrite).padEnd(11)} = ${Je(l.usd5m)}`],h=lT(e,t),p=h===e.inputTokens?"input":"uncached";return[`model: ${t}`,`${p.padEnd(9)}${s(h).padStart(14)} × ${i(n.input).padEnd(11)} = ${Je(a.input)}`,`output ${s(e.outputTokens).padStart(14)} × ${i(n.output).padEnd(11)} = ${Je(a.output)}`,`cache r ${s(e.cacheReadTokens).padStart(14)} × ${i(n.cacheRead).padEnd(11)} = ${Je(a.cacheRead)}`,...u,"─────────────────────────────────────────",`total = ${Je(a.total)}`].join(`
62
+ `)}function a1(e){const t=Al(e);return t.length<=1?i1(e.usage,e.model):[...t.map(n=>i1(n.usage,n.model)),"═════════════════════════════════════════",`all models = ${Je(bn(e).total)}`].join(`
63
+ `)}function m3({data:e,selected:t}){var v;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=jw(e.sessionId),l=((v=e.context)==null?void 0:v.currentContextTokens)??0,u=e.kind==="root"&&l>0,h=e.sessionTitle?e.cwd?`${e.cwd}
64
64
  ${e.sessionTitle}`:e.sessionTitle:e.cwd,p=dT(e),f=p.length>0?`${e.model}
65
65
  spend on this card also covers:
66
66
  ${p.join(`
67
- `)}`:e.model,g=pT(e.sessionName,e.sessionTitle);return d.jsxs("div",{className:s,style:{"--session-hue":a},children:[d.jsx("span",{className:"accent-stripe"}),d.jsx(Hi,{type:"target",position:$e.Left,style:{background:"transparent",border:"none"}}),d.jsxs("div",{className:"head",children:[d.jsxs("div",{className:"title",children:[d.jsx(g3,{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(p3,{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:Cu(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":Fu(e.model),title:f,children:[$s(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(w3,{waiting:e.waiting,now:n}),(()=>{const w=BL(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(x3,{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:Rt(e.usage.inputTokens+e.usage.outputTokens)})," tok"]}),e.model&&(()=>{const w=Qi(e.model),N=xn(e),b=Uv(e);if(!w&&N.total<=0)return e.usage.inputTokens+e.usage.outputTokens<=0?null:d.jsx("span",{className:"cost-unpriced",title:a1(e),children:Mi});if(N.total<=0)return null;const k=Math.max(0,((e.endedAt??n)-e.startedAt)/1e3),S=e.state==="active"?jw(N.total,k):null,E=a1(e)+(S?`
68
- burn: ${S}`:"");return d.jsxs("span",{className:"cost-meta",title:E,children:[d.jsxs("b",{children:[Ze(N.total),b>0?"+":""]}),S&&d.jsx("span",{className:"cost-rate",children:S})]})})()]}),d.jsx(Hi,{type:"source",position:$e.Right,style:{background:"transparent",border:"none"}})]})}function ju(e){return e==="active"?"live":e==="done"?"done":"err"}function g3({state:e}){return d.jsx("span",{className:`state-pill state-${e}`,children:ju(e)})}function dl(e){return e.message?e.message:e.kind==="permission"?"Needs your permission":"Waiting for your input"}function y3(e,t){const n=fT(e,t);return n?`Likely on: ${n}`:null}function v3(e){return e.kind==="idle"?"Your turn":dl(e)}function w3({waiting:e,now:t}){const n=Nl(e),s=dl(e);return d.jsxs("div",{className:n?"waiting-row permission":"waiting-row idle",title:`${s}
69
- Blocked for ${Cu(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:v3(e)}),d.jsx("b",{children:Cu(e.since,void 0,t)})]})}function x3({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 k=23-Math.floor(b/2500);k>=0&&k<24&&(a[k]+=1,l+=1)}const u=Math.max(1,...a),h=Math.max(0,...a),p=132,f=14,g=p/24,v=h/(2500/1e3),w=l===0?"no tool calls in the last 60s":`${l} tool calls in last 60s · peak ${v.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 k=N===0?1.5:Math.max(1.5,N/u*f),S=b===23&&N>0,C=`tool-spark-bar${N>0?" active":""}${S?" latest":""}`;return d.jsx("rect",{x:b*g+.4,y:f-k,width:Math.max(.5,g-1),height:k,rx:.8,className:C},b)})}),d.jsx("span",{className:"tool-spark-label",children:"60s"})]})}function l1(e){if(e==null)return"(none)";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function b3({tool:e,onClose:t}){const n=kn(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:hT(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:l1(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…)":l1(e.response??e.errorPreview)})]})]})]})})}const nu=18,c1=26,k3=12;function _3(e){return S3(e.nodeInternals.values())}function S3(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=d1(a)??f.label),a.kind==="root"&&(f.name=f1(a))):t.set(a.sessionId,{minX:l,minY:u,maxX:h,maxY:p,label:d1(a)??a.sessionId,name:f1(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,...j3(a.label,a.name,i,l),x:a.minX-nu,y:a.minY-nu-c1,w:a.maxX-a.minX+nu*2,h:a.maxY-a.minY+nu*2+c1})}return s}const Wv=" · ",N3=32,E3=/[\u1100-\u115F\u2E80-\u303E\u3041-\u33FF\u3400-\u4DBF\u4E00-\u9FFF\uA000-\uA4CF\uAC00-\uD7A3\uF900-\uFAFF\uFE30-\uFE6F\uFF00-\uFF60\uFFE0-\uFFE6]/;function u1(e){return E3.test(e)?2:1}function C3(e,t=N3){const n=[...e];let s=0;for(const l of n)s+=u1(l);if(s<=t)return e;const i=[];let a=0;for(const l of n){const u=u1(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 j3(e,t,n,s){const i=(t==null?void 0:t.trim())??"",a=s?T3(n):void 0,l=[e,i||void 0,a].filter(Boolean);return{label:e,name:i?C3(i):void 0,shortId:a,fullLabel:l.join(Wv)}}function T3(e){const t=e.match(/[a-zA-Z0-9]{4}/);return t?t[0]:e.slice(0,4)}function d1(e){if(e.kind==="root")return e.label}function f1(e){if(e.kind==="root")return pT(e.sessionName,e.sessionTitle).face}function R3(){const{x:e,y:t,zoom:n}=Qj(),s=xl(),i=lt(_3,A3);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=Ew(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-k3,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}
70
- drag the wrapper to move the whole session`,onClick:()=>a(u.sessionId),children:[u.label,u.name?d.jsxs(d.Fragment,{children:[Wv,d.jsx("span",{className:"cluster-label-name",children:u.name})]}):null,u.shortId?Wv+u.shortId:null]})]},u.sessionId)})})}function A3(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 M3({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 El={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"}},I3=Object.fromEntries(Object.entries(El).map(([e,t])=>[e,t.category])),O3=Object.fromEntries(Object.entries(El).map(([e,t])=>[e,t.emoji])),P3=Object.fromEntries(Object.entries(El).map(([e,t])=>[e,t.label])),$3=new Set(Object.keys(El)),L3=new Set(Object.entries(El).filter(([,e])=>e.shell).map(([e])=>e)),h1={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",...I3};function vT(e){return e.startsWith("mcp__")?"mcp":Object.hasOwn(h1,e)?h1[e]:"other"}const q3=/\btools\.exec_command\s*\(\s*\{[^{}]*?\bcmd\s*:\s*(["'`])((?:\\.|(?!\1)[^\\])*)\1/,D3=/\btools\.([A-Za-z_$][\w$]*)\s*\(/;function F3(e){if(typeof e!="string"||!e)return null;const t=q3.exec(e);if(t){const s=z3(t[2]);if(s.trim())return s}const n=D3.exec(e);return n?n[1]:null}function z3(e){return e.replace(/\\(["'`\\nrt])/g,(t,n)=>n==="n"?`
71
- `:n==="r"?"\r":n==="t"?" ":n)}const wT=600,B3=4,U3=36,Hv=16,W3=60,H3=6,p1=220,m1=96,G3=28,g1={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:"📡",...O3};function y1(e){return e.startsWith("mcp__")?"🔌":Object.hasOwn(g1,e)?g1[e]:"✨"}const v1={git:"🐙",gh:"🐙",glab:"🐙",npm:"📦",pnpm:"📦",yarn:"📦",bun:"📦",brew:"🍺",node:"🟢",deno:"🟢",python:"🐍",python3:"🐍",py:"🐍",pip:"🐍",pip3:"🐍",uv:"🐍",ruby:"💎",bundle:"💎",gem:"💎",cargo:"🦀",rustc:"🦀",rustup:"🦀",go:"🐹",docker:"🐳","docker-compose":"🐳",podman:"🐳",kubectl:"☸️",helm:"☸️",k9s:"☸️",grep:"🔎",rg:"🔎",ag:"🔎",ack:"🔎",find:"🔍",fd:"🔍",locate:"🔍",which:"🔍",ls:"📂",dir:"📂",tree:"📂",cat:"📄",head:"📄",tail:"📄",less:"📄",more:"📄",bat:"📄",cp:"📋",mv:"✂️",rm:"🗑️",rmdir:"🗑️",mkdir:"📁",touch:"📁",sed:"✏️",awk:"✏️",tr:"✏️",curl:"🌐",wget:"🌐",http:"🌐",httpie:"🌐",ssh:"🔐",scp:"🔐",rsync:"🔐",ping:"📡",make:"🔨",cmake:"🔨",ninja:"🔨",bazel:"🔨",just:"🔨",terraform:"🏗️",ansible:"📕",pulumi:"🏗️",ps:"📊",top:"📊",htop:"📊",btm:"📊",kill:"💀",pkill:"💀",systemctl:"⚙️",service:"⚙️",tar:"🗜️",zip:"🗜️",unzip:"🗜️",gzip:"🗜️","7z":"🗜️",vim:"📝",nvim:"📝",nano:"📝",emacs:"📝",code:"📝",jq:"🪺",yq:"🪺",echo:"💬",printf:"💬",ffmpeg:"🎞️",ffprobe:"🎞️",imagemagick:"🖼️",convert:"🖼️","Get-ChildItem":"📂","Get-Content":"📄","Set-Content":"💾","Out-File":"💾","Add-Content":"💾","Set-Location":"📍","Get-Location":"📍","Get-Process":"📊","Start-Process":"▶️","Stop-Process":"💀","Invoke-WebRequest":"🌐","Invoke-RestMethod":"🌐","New-Item":"📁","Remove-Item":"🗑️","Copy-Item":"📋","Move-Item":"✂️","Test-Path":"🔍","Where-Object":"🔎","ForEach-Object":"🔁","Select-Object":"🎯","Measure-Object":"📊","Get-Service":"⚙️","Restart-Service":"⚙️","ConvertTo-Json":"🪺","ConvertFrom-Json":"🪺"};function xT(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 xT(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 V3(e){if(typeof e=="string")return e;if(!e||typeof e!="object")return null;const t=e;if(typeof t.script=="string"){const n=F3(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 Y3=new Set(["Bash","PowerShell",...L3]),K3=$3;function X3(e,t){return K3.has(e)||e.startsWith("mcp__")?Math.max(m1,34+t.length*7.5):m1}function Q3(e,t){if(!Y3.has(e))return null;const n=V3(t);if(!n)return null;const s=xT(n);return s?{emoji:Object.hasOwn(v1,s)?v1[s]:"⚙️",label:s,category:"shell",detail:n}:null}const Z3=new Set(["Read","Write","Edit","MultiEdit","NotebookEdit","LS","Glob","apply_patch"]),w1={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:"🗄️"},x1={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 J3(e){const n=e.replace(/\\/g,"/").replace(/\/+$/,""),s=n.lastIndexOf("/");return s>=0?n.slice(s+1):n}function eq(e){const t=e.toLowerCase();if(Object.hasOwn(x1,t))return x1[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(w1,s))return w1[s]}return"📄"}function tq(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 nq(e,t){if(!Z3.has(e))return null;const n=tq(e,t);if(!n)return null;const s=J3(n);return s?{emoji:e==="LS"?"📂":eq(s),label:s,category:"file",detail:n}:null}const b1={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 Aw(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 rq(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 bT(e){const t=e.toLowerCase();return Object.hasOwn(b1,t)?b1[t]:void 0}function sq(e,t){const n=Aw(e);if(!n)return null;const{server:s,method:i}=n;if(!i)return null;const a=bT(s);return{emoji:(a==null?void 0:a.emoji)??"🔌",label:i,category:"mcp",detail:a?`${a.name} · ${i}`:`${s} · ${i}`}}function oq(e,t){return Q3(e,t)??nq(e,t)??sq(e)}const k1=P3;function kT(e){const t=Aw(e);if(t){const s=bT(t.server);return s?{emoji:s.emoji,label:s.name}:{emoji:"🔌",label:t.server,hue:rq(t.server)}}const n=Object.hasOwn(k1,e)?k1[e]:"";return n?{emoji:y1(e),label:n}:{emoji:y1(e),label:e}}function iq(e){let t=null,n="";for(const s of e){const i=Aw(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:kT(n)}function aq(e){return e.endedAt==null?"inflight":e.ok===!1?"err":"done"}function lq(e,t){if(t==null)return 1;const n=e-t;return n<0?1:Math.max(0,1-n/wT)}function cq(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 uq(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>wT)continue;const h=s.get(u.id)??n.get(u.id);if(!h)continue;const p=cq(u.tools,B3);if(p.length===0)continue;const f=u.exitAt??null,g=i.get(u.id),v=Math.max((g==null?void 0:g.width)??p1,p1),w=(g==null?void 0:g.height)??130,N=h.x,b=h.y,k=N+v,S=b+w/2;p.forEach((E,C)=>{const j=C*U3,I=N+v+W3,O=b+H3+j,P=lq(a,f),z=E.inputPreview??"",M=aq(E),A=P<.999,q=kT(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:vT(E.name),mcpHue:q.hue,inputPreview:z,fade:P,fading:A,worldX:I,worldY:O,anchorX:k,anchorY:S,spawnDx:k-I,spawnDy:S-(O+Hv)});const H=oq(E.name,E.input);if(H){const Y=X3(E.name,q.label),R=I+Y+G3,Q=O,W=I+Y,ne=O+Hv;l.push({id:`sub:${u.id}::${E.id}`,toolId:E.id,agentId:u.id,toolName:E.name,name:H.label,emoji:H.emoji,isSub:!0,status:M,category:H.category,inputPreview:H.detail??z,fade:P,fading:A,worldX:R,worldY:Q,anchorX:W,anchorY:ne,spawnDx:W-R,spawnDy:0})}})}return l}function dq({agents:e,visibleAgentIds:t,positions:n,pinned:s,measured:i,spotlight:a,hiddenCategories:l,now:u,onOpenTool:h}){const p=uq(e,t,n,s,i,u),f=l&&l.size>0?p.filter(g=>!l.has(g.category)):p;return d.jsx(fq,{bursts:f,spotlight:a,onOpenTool:h})}function fq({bursts:e,spotlight:t,onOpenTool:n}){const{x:s,y:i,zoom:a}=Qj();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+Hv)*a+i,g=u+(p-u)*.55,v=t!=null&&!t.has(l.agentId),w=l.fade*(v?.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,v=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":""}${v?" clickable":""}${l.isSub?" sub":""}${b}`,style:w,title:g,onClick:v?()=>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 hq(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=xn(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 pq="spend on this board",mq="on this board",_1=`Everything on the board right now, and only that.
67
+ `)}`:e.model,g=pT(e.sessionName,e.sessionTitle);return d.jsxs("div",{className:s,style:{"--session-hue":a},children:[d.jsx("span",{className:"accent-stripe"}),d.jsx(Wi,{type:"target",position:$e.Left,style:{background:"transparent",border:"none"}}),d.jsxs("div",{className:"head",children:[d.jsxs("div",{className:"title",children:[d.jsx(g3,{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(p3,{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:Ru(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":Uu(e.model),title:f,children:[Ls(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(w3,{waiting:e.waiting,now:n}),(()=>{const w=BL(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(x3,{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:Rt(e.usage.inputTokens+e.usage.outputTokens)})," tok"]}),e.model&&(()=>{const w=Xi(e.model),N=bn(e),b=Hv(e);if(!w&&N.total<=0)return e.usage.inputTokens+e.usage.outputTokens<=0?null:d.jsx("span",{className:"cost-unpriced",title:a1(e),children:Ai});if(N.total<=0)return null;const k=Math.max(0,((e.endedAt??n)-e.startedAt)/1e3),S=e.state==="active"?Rw(N.total,k):null,E=a1(e)+(S?`
68
+ burn: ${S}`:"");return d.jsxs("span",{className:"cost-meta",title:E,children:[d.jsxs("b",{children:[Je(N.total),b>0?"+":""]}),S&&d.jsx("span",{className:"cost-rate",children:S})]})})()]}),d.jsx(Wi,{type:"source",position:$e.Right,style:{background:"transparent",border:"none"}})]})}function Au(e){return e==="active"?"live":e==="done"?"done":"err"}function g3({state:e}){return d.jsx("span",{className:`state-pill state-${e}`,children:Au(e)})}function vl(e){return e.message?e.message:e.kind==="permission"?"Needs your permission":"Waiting for your input"}function y3(e,t){const n=fT(e,t);return n?`Likely on: ${n}`:null}function v3(e){return e.kind==="idle"?"Your turn":vl(e)}function w3({waiting:e,now:t}){const n=Ml(e),s=vl(e);return d.jsxs("div",{className:n?"waiting-row permission":"waiting-row idle",title:`${s}
69
+ Blocked for ${Ru(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:v3(e)}),d.jsx("b",{children:Ru(e.since,void 0,t)})]})}function x3({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 k=23-Math.floor(b/2500);k>=0&&k<24&&(a[k]+=1,l+=1)}const u=Math.max(1,...a),h=Math.max(0,...a),p=132,f=14,g=p/24,v=h/(2500/1e3),w=l===0?"no tool calls in the last 60s":`${l} tool calls in last 60s · peak ${v.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 k=N===0?1.5:Math.max(1.5,N/u*f),S=b===23&&N>0,C=`tool-spark-bar${N>0?" active":""}${S?" latest":""}`;return d.jsx("rect",{x:b*g+.4,y:f-k,width:Math.max(.5,g-1),height:k,rx:.8,className:C},b)})}),d.jsx("span",{className:"tool-spark-label",children:"60s"})]})}function l1(e){if(e==null)return"(none)";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function b3({tool:e,onClose:t}){const n=_n(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:hT(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:l1(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…)":l1(e.response??e.errorPreview)})]})]})]})})}const ou=18,c1=26,k3=12;function _3(e){return S3(e.nodeInternals.values())}function S3(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=d1(a)??f.label),a.kind==="root"&&(f.name=f1(a))):t.set(a.sessionId,{minX:l,minY:u,maxX:h,maxY:p,label:d1(a)??a.sessionId,name:f1(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,...j3(a.label,a.name,i,l),x:a.minX-ou,y:a.minY-ou-c1,w:a.maxX-a.minX+ou*2,h:a.maxY-a.minY+ou*2+c1})}return s}const Gv=" · ",N3=32,E3=/[\u1100-\u115F\u2E80-\u303E\u3041-\u33FF\u3400-\u4DBF\u4E00-\u9FFF\uA000-\uA4CF\uAC00-\uD7A3\uF900-\uFAFF\uFE30-\uFE6F\uFF00-\uFF60\uFFE0-\uFFE6]/;function u1(e){return E3.test(e)?2:1}function C3(e,t=N3){const n=[...e];let s=0;for(const l of n)s+=u1(l);if(s<=t)return e;const i=[];let a=0;for(const l of n){const u=u1(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 j3(e,t,n,s){const i=(t==null?void 0:t.trim())??"",a=s?T3(n):void 0,l=[e,i||void 0,a].filter(Boolean);return{label:e,name:i?C3(i):void 0,shortId:a,fullLabel:l.join(Gv)}}function T3(e){const t=e.match(/[a-zA-Z0-9]{4}/);return t?t[0]:e.slice(0,4)}function d1(e){if(e.kind==="root")return e.label}function f1(e){if(e.kind==="root")return pT(e.sessionName,e.sessionTitle).face}function R3(){const{x:e,y:t,zoom:n}=Qj(),s=Cl(),i=lt(_3,A3);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=jw(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-k3,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}
70
+ drag the wrapper to move the whole session`,onClick:()=>a(u.sessionId),children:[u.label,u.name?d.jsxs(d.Fragment,{children:[Gv,d.jsx("span",{className:"cluster-label-name",children:u.name})]}):null,u.shortId?Gv+u.shortId:null]})]},u.sessionId)})})}function A3(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 M3({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 Il={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"}},I3=Object.fromEntries(Object.entries(Il).map(([e,t])=>[e,t.category])),O3=Object.fromEntries(Object.entries(Il).map(([e,t])=>[e,t.emoji])),P3=Object.fromEntries(Object.entries(Il).map(([e,t])=>[e,t.label])),$3=new Set(Object.keys(Il)),L3=new Set(Object.entries(Il).filter(([,e])=>e.shell).map(([e])=>e)),h1={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",...I3};function vT(e){return e.startsWith("mcp__")?"mcp":Object.hasOwn(h1,e)?h1[e]:"other"}const q3=/\btools\.exec_command\s*\(\s*\{[^{}]*?\bcmd\s*:\s*(["'`])((?:\\.|(?!\1)[^\\])*)\1/,D3=/\btools\.([A-Za-z_$][\w$]*)\s*\(/;function F3(e){if(typeof e!="string"||!e)return null;const t=q3.exec(e);if(t){const s=z3(t[2]);if(s.trim())return s}const n=D3.exec(e);return n?n[1]:null}function z3(e){return e.replace(/\\(["'`\\nrt])/g,(t,n)=>n==="n"?`
71
+ `:n==="r"?"\r":n==="t"?" ":n)}const wT=600,B3=4,U3=36,Vv=16,W3=60,H3=6,p1=220,m1=96,G3=28,g1={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:"📡",...O3};function y1(e){return e.startsWith("mcp__")?"🔌":Object.hasOwn(g1,e)?g1[e]:"✨"}const v1={git:"🐙",gh:"🐙",glab:"🐙",npm:"📦",pnpm:"📦",yarn:"📦",bun:"📦",brew:"🍺",node:"🟢",deno:"🟢",python:"🐍",python3:"🐍",py:"🐍",pip:"🐍",pip3:"🐍",uv:"🐍",ruby:"💎",bundle:"💎",gem:"💎",cargo:"🦀",rustc:"🦀",rustup:"🦀",go:"🐹",docker:"🐳","docker-compose":"🐳",podman:"🐳",kubectl:"☸️",helm:"☸️",k9s:"☸️",grep:"🔎",rg:"🔎",ag:"🔎",ack:"🔎",find:"🔍",fd:"🔍",locate:"🔍",which:"🔍",ls:"📂",dir:"📂",tree:"📂",cat:"📄",head:"📄",tail:"📄",less:"📄",more:"📄",bat:"📄",cp:"📋",mv:"✂️",rm:"🗑️",rmdir:"🗑️",mkdir:"📁",touch:"📁",sed:"✏️",awk:"✏️",tr:"✏️",curl:"🌐",wget:"🌐",http:"🌐",httpie:"🌐",ssh:"🔐",scp:"🔐",rsync:"🔐",ping:"📡",make:"🔨",cmake:"🔨",ninja:"🔨",bazel:"🔨",just:"🔨",terraform:"🏗️",ansible:"📕",pulumi:"🏗️",ps:"📊",top:"📊",htop:"📊",btm:"📊",kill:"💀",pkill:"💀",systemctl:"⚙️",service:"⚙️",tar:"🗜️",zip:"🗜️",unzip:"🗜️",gzip:"🗜️","7z":"🗜️",vim:"📝",nvim:"📝",nano:"📝",emacs:"📝",code:"📝",jq:"🪺",yq:"🪺",echo:"💬",printf:"💬",ffmpeg:"🎞️",ffprobe:"🎞️",imagemagick:"🖼️",convert:"🖼️","Get-ChildItem":"📂","Get-Content":"📄","Set-Content":"💾","Out-File":"💾","Add-Content":"💾","Set-Location":"📍","Get-Location":"📍","Get-Process":"📊","Start-Process":"▶️","Stop-Process":"💀","Invoke-WebRequest":"🌐","Invoke-RestMethod":"🌐","New-Item":"📁","Remove-Item":"🗑️","Copy-Item":"📋","Move-Item":"✂️","Test-Path":"🔍","Where-Object":"🔎","ForEach-Object":"🔁","Select-Object":"🎯","Measure-Object":"📊","Get-Service":"⚙️","Restart-Service":"⚙️","ConvertTo-Json":"🪺","ConvertFrom-Json":"🪺"};function xT(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 xT(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 V3(e){if(typeof e=="string")return e;if(!e||typeof e!="object")return null;const t=e;if(typeof t.script=="string"){const n=F3(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 Y3=new Set(["Bash","PowerShell",...L3]),K3=$3;function X3(e,t){return K3.has(e)||e.startsWith("mcp__")?Math.max(m1,34+t.length*7.5):m1}function Q3(e,t){if(!Y3.has(e))return null;const n=V3(t);if(!n)return null;const s=xT(n);return s?{emoji:Object.hasOwn(v1,s)?v1[s]:"⚙️",label:s,category:"shell",detail:n}:null}const Z3=new Set(["Read","Write","Edit","MultiEdit","NotebookEdit","LS","Glob","apply_patch"]),w1={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:"🗄️"},x1={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 J3(e){const n=e.replace(/\\/g,"/").replace(/\/+$/,""),s=n.lastIndexOf("/");return s>=0?n.slice(s+1):n}function eq(e){const t=e.toLowerCase();if(Object.hasOwn(x1,t))return x1[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(w1,s))return w1[s]}return"📄"}function tq(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 nq(e,t){if(!Z3.has(e))return null;const n=tq(e,t);if(!n)return null;const s=J3(n);return s?{emoji:e==="LS"?"📂":eq(s),label:s,category:"file",detail:n}:null}const b1={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 Iw(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 rq(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 bT(e){const t=e.toLowerCase();return Object.hasOwn(b1,t)?b1[t]:void 0}function sq(e,t){const n=Iw(e);if(!n)return null;const{server:s,method:i}=n;if(!i)return null;const a=bT(s);return{emoji:(a==null?void 0:a.emoji)??"🔌",label:i,category:"mcp",detail:a?`${a.name} · ${i}`:`${s} · ${i}`}}function oq(e,t){return Q3(e,t)??nq(e,t)??sq(e)}const k1=P3;function kT(e){const t=Iw(e);if(t){const s=bT(t.server);return s?{emoji:s.emoji,label:s.name}:{emoji:"🔌",label:t.server,hue:rq(t.server)}}const n=Object.hasOwn(k1,e)?k1[e]:"";return n?{emoji:y1(e),label:n}:{emoji:y1(e),label:e}}function iq(e){let t=null,n="";for(const s of e){const i=Iw(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:kT(n)}function aq(e){return e.endedAt==null?"inflight":e.ok===!1?"err":"done"}function lq(e,t){if(t==null)return 1;const n=e-t;return n<0?1:Math.max(0,1-n/wT)}function cq(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 uq(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>wT)continue;const h=s.get(u.id)??n.get(u.id);if(!h)continue;const p=cq(u.tools,B3);if(p.length===0)continue;const f=u.exitAt??null,g=i.get(u.id),v=Math.max((g==null?void 0:g.width)??p1,p1),w=(g==null?void 0:g.height)??130,N=h.x,b=h.y,k=N+v,S=b+w/2;p.forEach((E,C)=>{const j=C*U3,I=N+v+W3,O=b+H3+j,P=lq(a,f),z=E.inputPreview??"",M=aq(E),A=P<.999,q=kT(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:vT(E.name),mcpHue:q.hue,inputPreview:z,fade:P,fading:A,worldX:I,worldY:O,anchorX:k,anchorY:S,spawnDx:k-I,spawnDy:S-(O+Vv)});const G=oq(E.name,E.input);if(G){const Y=X3(E.name,q.label),R=I+Y+G3,Q=O,H=I+Y,ne=O+Vv;l.push({id:`sub:${u.id}::${E.id}`,toolId:E.id,agentId:u.id,toolName:E.name,name:G.label,emoji:G.emoji,isSub:!0,status:M,category:G.category,inputPreview:G.detail??z,fade:P,fading:A,worldX:R,worldY:Q,anchorX:H,anchorY:ne,spawnDx:H-R,spawnDy:0})}})}return l}function dq({agents:e,visibleAgentIds:t,positions:n,pinned:s,measured:i,spotlight:a,hiddenCategories:l,now:u,onOpenTool:h}){const p=uq(e,t,n,s,i,u),f=l&&l.size>0?p.filter(g=>!l.has(g.category)):p;return d.jsx(fq,{bursts:f,spotlight:a,onOpenTool:h})}function fq({bursts:e,spotlight:t,onOpenTool:n}){const{x:s,y:i,zoom:a}=Qj();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+Vv)*a+i,g=u+(p-u)*.55,v=t!=null&&!t.has(l.agentId),w=l.fade*(v?.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,v=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":""}${v?" clickable":""}${l.isSub?" sub":""}${b}`,style:w,title:g,onClick:v?()=>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 hq(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=bn(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 pq="spend on this board",mq="on this board",_1=`Everything on the board right now, and only that.
72
72
  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.
73
- Press H for the totals ccusage reads off the logs on disk, which do not forget.`,_T="session spend";function Mw({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}: ${Ze(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 gq({state:e,sessionId:t,onClose:n}){const s=_.useMemo(()=>yq(e,t),[e,t]),i=_.useRef(null),a=kn(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:_T}),d.jsx("div",{className:"ss-cost",children:Ze(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":Fu(l),title:l,children:$s(l)},l))})]}),d.jsx("div",{className:"ss-hero-right",children:s.cost.total>0&&d.jsxs(d.Fragment,{children:[d.jsx(Mw,{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:Ze(s.cost.input)})]}),d.jsxs("span",{className:"ssl ssl-out",children:["output ",d.jsx("b",{children:Ze(s.cost.output)})]}),d.jsxs("span",{className:"ssl ssl-cr",children:["cache r ",d.jsx("b",{children:Ze(s.cost.cacheRead)})]}),d.jsxs("span",{className:"ssl ssl-cw",children:["cache w ",d.jsx("b",{children:Ze(s.cost.cacheWrite)})]})]})]})})]}),d.jsxs("section",{className:"ss-stats",children:[d.jsx(Ti,{label:"agents",value:s.agentCount}),d.jsx(Ti,{label:"subagents",value:s.subagentCount}),d.jsx(Ti,{label:"tool calls",value:s.toolCount}),d.jsx(Ti,{label:"prompts",value:s.promptCount}),d.jsx(Ti,{label:"tokens",value:s.tokensSum.toLocaleString()}),s.errCount>0&&d.jsx(Ti,{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 Ti({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 yq(e,t){const n=e.agents.get(t);if(!n)return null;const s=[];for(const C of e.agents.values())C.sessionId===t&&s.push(C);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,v,w=1/0,N=0;for(const C of s){const j=xn(C);i.input+=j.input,i.output+=j.output,i.cacheRead+=j.cacheRead,i.cacheWrite+=j.cacheWrite,i.total+=j.total;for(const I of uT(C))a.add(I);C.model&&a.add(C.model),C.kind==="subagent"&&g++,h+=C.prompts.length,!v&&C.prompts.length>0&&(v=C.prompts[0].text),p+=C.usage.inputTokens+C.usage.outputTokens,u+=C.toolCount,w=Math.min(w,C.startedAt),N=Math.max(N,C.endedAt??Date.now());for(const I of C.tools)l.set(I.name,(l.get(I.name)??0)+1),I.ok===!1&&f++}const b=Math.max(0,N-w),k=Math.floor(b/1e3),S=k<60?`${k}s`:k<3600?`${Math.floor(k/60)}m ${String(k%60).padStart(2,"0")}s`:`${Math.floor(k/3600)}h ${Math.floor(k%3600/60)}m`,E=Array.from(l.entries()).sort((C,j)=>j[1]-C[1]).slice(0,5);return{sessionId:t,label:n.label||n.cwdBasename||"session",cwd:n.cwd,durationLabel:S,cost:i,modelChips:Array.from(a),agentCount:s.length,subagentCount:g,toolCount:u,promptCount:h,tokensSum:p,errCount:f,topTools:E,firstPrompt:v}}function S1(e){return e.waiting?Nl(e.waiting)?0:1:e.state==="active"?2:3}function vq(e,t){const n=[];for(const s of e.agents.values()){if(s.kind!=="root")continue;let i=s.toolCount,a=xn(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+=xn(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=S1(s),l=S1(i);return a!==l?a-l:s.waiting&&i.waiting?s.waiting.since-i.waiting.since:i.lastActivity-s.lastActivity}),n}function N1(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 wq({state:e,now:t,selectedIds:n,onSelect:s,onClose:i}){const a=_.useMemo(()=>vq(e),[e,e.revision,t]),l=a.filter(h=>h.state==="active").length,u=a.filter(h=>Nl(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:ju(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":Fu(h.modelId),title:h.modelId,children:$s(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:_T,children:d.jsx("b",{children:Ze(h.cost)})}),h.waiting?d.jsxs("span",{className:"sl-waiting",title:[dl(h.waiting),y3(h.waiting,dl(h.waiting)),`Blocked since ${new Date(h.waiting.since).toLocaleTimeString()} · started ${new Date(h.startedAt).toLocaleString()}`].filter(Boolean).join(`
74
- `),children:["waiting ",N1(h.waiting.since,void 0,t),h.waiting.tool&&d.jsxs("span",{className:"sl-waiting-tool",children:[" · ",h.waiting.tool.name]})]}):d.jsx("span",{className:"sl-elapsed",title:`Started ${new Date(h.startedAt).toLocaleString()}`,children:N1(h.startedAt,h.state==="active"?void 0:h.lastActivity,t)})]})]})]},h.sessionId)})]})]})}const xq=e=>1-Math.pow(1-e,5),ST=420;function bq(e,t){if(!Number.isFinite(e)||!Number.isFinite(t)||e===t)return!1;const n=Math.abs(t-e);if(n<1)return!1;const s=Math.max(Math.abs(e),Math.abs(t));return s===0||n/s>=.005}function kq(e,t,n,s=ST){return n>=s?t:n<=0?e:e+(t-e)*xq(n/s)}function _q(e,t,n,s={}){const i=s.now??(()=>performance.now()),a=s.raf??(w=>requestAnimationFrame(w)),l=s.cancel??(w=>cancelAnimationFrame(w)),u=s.reducedMotion??(()=>typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches),h=s.hidden??(()=>typeof document=="object"&&document.hidden===!0);if(u()||h()||!bq(e,t))return n(t),()=>{};const p=i();let f=0,g=!0;const v=()=>{if(!g)return;const w=i()-p;n(kq(e,t,w)),w<ST&&(f=a(v))};return f=a(v),()=>{g=!1,f&&l(f)}}const Gv={cost:0,inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0,sessions:0};function E1(e,t){const n=new Map;for(const s of e){if(s.kind!=="root"||!s.sessionId)continue;const i=xn(s,t);n.set(s.sessionId,{cost:i.total,inputTokens:s.usage.inputTokens,outputTokens:s.usage.outputTokens,cacheReadTokens:s.usage.cacheReadTokens,cacheCreateTokens:s.usage.cacheCreateTokens})}return n}function Sq(e,t){if(!e)return Gv;const n={...Gv};for(const[s,i]of t){const a=e.get(s);if(!a)continue;const l={cost:i.cost-a.cost,inputTokens:i.inputTokens-a.inputTokens,outputTokens:i.outputTokens-a.outputTokens,cacheReadTokens:i.cacheReadTokens-a.cacheReadTokens,cacheCreateTokens:i.cacheCreateTokens-a.cacheCreateTokens};l.cost<0||l.inputTokens<0||l.outputTokens<0||l.cost===0&&l.inputTokens===0&&l.outputTokens===0&&l.cacheReadTokens===0&&l.cacheCreateTokens===0||(n.cost+=l.cost,n.inputTokens+=Math.max(0,l.inputTokens),n.outputTokens+=Math.max(0,l.outputTokens),n.cacheReadTokens+=Math.max(0,l.cacheReadTokens),n.cacheCreateTokens+=Math.max(0,l.cacheCreateTokens),n.sessions+=1)}return n}function Vv(e,t=new Date){return new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate()-(e-1))).toISOString().slice(0,10).replace(/-/g,"")}const NT=[{key:"today",label:"today",noun:"today"},{key:"month",label:"month",noun:"this month"},{key:"all",label:"all",noun:"all time"}];function Nq(e,t=new Date){return e==="today"?Vv(1,t):e==="month"?Vv(t.getDate(),t):"20200101"}const wn=e=>typeof e=="number"&&Number.isFinite(e)?e:0,mu=e=>typeof e=="string"?e:"";function ET(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=mu(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+=wn(a==null?void 0:a.cost),u.inputTokens+=wn(a==null?void 0:a.inputTokens),u.outputTokens+=wn(a==null?void 0:a.outputTokens),u.cacheReadTokens+=wn(a==null?void 0:a.cacheReadTokens),u.cacheCreateTokens+=wn(a==null?void 0:a.cacheCreationTokens)}}return[...n.values()].sort((s,i)=>i.cost-s.cost||i.tokens-s.tokens)}function Eq(e,t=new Map){const n=Array.isArray(e==null?void 0:e.sessions)?e.sessions:[],s=[];for(const i of n){const a=mu(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:mu(i==null?void 0:i.agent)||"claude",cost:wn(i==null?void 0:i.totalCost),tokens:wn(i==null?void 0:i.totalTokens),models:Array.isArray(i==null?void 0:i.modelsUsed)?i.modelsUsed.map(mu).filter(Boolean):[],lastActivityMs:Number.isFinite(u)?u:null})}return s.sort((i,a)=>a.cost-i.cost||a.tokens-i.tokens)}function CT(e){const t=e==null?void 0:e.totals;if(t&&typeof t=="object"){const h=wn(t.cacheReadTokens),p=wn(t.cacheCreationTokens),f=wn(t.inputTokens),g=wn(t.outputTokens);return{cost:wn(t.totalCost),inputTokens:f,outputTokens:g,cacheReadTokens:h,cacheCreateTokens:p,tokens:wn(t.totalTokens)||f+g+h+p}}const n=ET(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}}function Cq(e,t){return{data:(e==null?void 0:e.data)??null,shown:(e==null?void 0:e.period)??null,stale:e!=null&&e.period!==t}}function jq(e,t){var n;return((n=NT.find(s=>s.key===(e??t)))==null?void 0:n.noun)??"today"}function Tq(e,t,n){const s=e!=null,i=CT(e);return{fromRange:s,cost:s?i.cost+n.cost:t.cost.total,inputTokens:s?i.inputTokens+n.inputTokens:t.inputTokens,outputTokens:s?i.outputTokens+n.outputTokens:t.outputTokens,cacheReadTokens:s?i.cacheReadTokens+n.cacheReadTokens:t.cacheReadTokens,cacheCreateTokens:s?i.cacheCreateTokens+n.cacheCreateTokens:t.cacheCreateTokens,hasCost:s?i.cost>0:t.cost.total>0,tokenSum:s?i.tokens:t.sum,showCostBar:!s}}const zt="ccdeck";function jT(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 Yv(e){return jT(Math.floor(e/1e3))}function TT(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 Rq(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function Aq(e,t,n){const s=new Date(e),i=Yv(t-e);return{label:Rq(s,new Date(t))?i:`${i} · ${s.toLocaleDateString(n,{month:"short",day:"numeric"})}`,title:s.toLocaleString(n,{dateStyle:"medium",timeStyle:"medium"})}}function RT(e,t){return{disabled:e!=null&&e!==t,busy:e===t}}function AT(e){return e==null}const Kv="self";function sr(e,t=!1){const n=RT(e?Kv:null,Kv);return{disabled:t||n.disabled,"aria-busy":n.busy}}function or(e){return AT(e?Kv:null)}function Mq(e){return[...e==null?[]:[`#ap-more-${e}`],".accounts-panel .ap-refresh"]}function Iq(e){return e==null||e==="BODY"||e==="HTML"}function C1(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 Oq(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 th="__unknown__";function Pq(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 v=Math.floor(f/3600),w=Math.floor(f%3600/60);g.runsOutIn=v>0?`${v}h ${w}m`:`${w}m`}return g}return{label:`${Math.round(-u)}% reserve`,color:"var(--ok)",expectedPct:l,isDeficit:!1}}function go({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,v=s?TT(s,l):null,w=s&&i?Pq(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:[v?d.jsxs("span",{className:"qb-reset",children:["resets in ",v]}):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 $q=6e4;function Lq(e){const[t,n]=_.useState(null),[s,i]=_.useState(!1),a=_.useRef(null),l=_.useRef(!1),u=async(p=!1)=>{if(!(p&&!or(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 _.useEffect(()=>{if(e)return u(!0),a.current=window.setInterval(()=>u(!1),$q),()=>{a.current!=null&&window.clearInterval(a.current)}},[e]),{quota:t,loading:s,refresh:()=>{e&&u(!0)}}}function qq(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 Dq(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 MT=6e4,j1=6e4;function Fq(e){const[t,n]=_.useState(null),[s,i]=_.useState(!1),a=_.useRef(null),l=_.useRef(!1),u=async(p=!1)=>{if(!(p&&!or(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 _.useEffect(()=>{if(e)return u(!0),a.current=window.setInterval(()=>u(!1),MT),()=>{a.current!=null&&window.clearInterval(a.current)}},[e]),{data:t,loading:s,refresh:()=>{e&&u(!0)}}}function zq(e){const[t,n]=_.useState(null),s=_.useRef(null),i=async()=>{try{const a=await fetch("/api/codex-usage");a.ok&&n(await a.json())}catch{}};return _.useEffect(()=>{if(e)return i(),s.current=window.setInterval(i,MT),()=>{s.current!=null&&window.clearInterval(s.current)}},[e]),{data:t}}function Bq(e,t){const[n,s]=_.useState(null),[i,a]=_.useState(!1),[l,u]=_.useState(0),h=_.useRef(0);_.useEffect(()=>{const f=()=>document.visibilityState==="visible",g=()=>{f()&&u(N=>N+1)},v=window.setInterval(g,j1),w=()=>{f()&&Date.now()-h.current>=j1&&u(N=>N+1)};return document.addEventListener("visibilitychange",w),()=>{window.clearInterval(v),document.removeEventListener("visibilitychange",w)}},[]);const p=_.useRef(t);return _.useEffect(()=>{let f=!0;const g=t!==p.current;p.current=t;const v=e,w=Nq(v);return a(!0),fetch(`/api/ccusage?since=${w}${g?"&refresh=1":""}`).then(N=>N.ok?N.json():null).then(N=>{f&&(N!=null&&N.ok)&&(h.current=Date.now(),s({period:v,data:N}))}).catch(()=>{}).finally(()=>{f&&a(!1)}),()=>{f=!1}},[e,t,l]),{...Cq(n,e),loading:i}}function Ga(e){const[t,n]=_.useState(e),s=_.useRef(e),i=_.useRef(!0);return _.useEffect(()=>{s.current=t},[t]),_.useEffect(()=>{if(i.current){i.current=!1,s.current=e,n(e);return}return _q(s.current,e,l=>{s.current=l,n(l)})},[e]),t}function Uq({state:e,now:t,providers:n,onClose:s}){var be,ue;const{quota:i,loading:a,refresh:l}=Lq(n.claude),{data:u,loading:h,refresh:p}=Fq(n.codex),{data:f}=zq(n.codex),[g,v]=_.useState(()=>Math.floor(Date.now()/1e3));_.useEffect(()=>{const re=window.setInterval(()=>v(Math.floor(Date.now()/1e3)),3e4);return()=>window.clearInterval(re)},[]);const{byModel:w,totalCost:N,totalTokens:b,burnRate:k}=_.useMemo(()=>{const re=new Map;for(const Pe of e.agents.values())for(const Be of Sl(Pe)){const Ge=Be.model??th,it=Cw(Be.usage,Be.model),ke=re.get(Ge);ke?(ke.inputTokens+=Be.usage.inputTokens,ke.outputTokens+=Be.usage.outputTokens,ke.cacheReadTokens+=Be.usage.cacheReadTokens,ke.cacheCreateTokens+=Be.usage.cacheCreateTokens,ke.cost.total+=it.total,ke.cost.input+=it.input,ke.cost.output+=it.output,ke.cost.cacheRead+=it.cacheRead,ke.cost.cacheWrite+=it.cacheWrite,ke.agentCount++):re.set(Ge,{model:Ge,inputTokens:Be.usage.inputTokens,outputTokens:Be.usage.outputTokens,cacheReadTokens:Be.usage.cacheReadTokens,cacheCreateTokens:Be.usage.cacheCreateTokens,cost:{...it},agentCount:1,priced:Qi(Be.model)!=null})}const pe=Array.from(re.values()).sort((Pe,Be)=>Be.cost.total-Pe.cost.total||Be.inputTokens+Be.outputTokens-(Pe.inputTokens+Pe.outputTokens));let Oe=0,rt=0;for(const Pe of e.agents.values()){if(Pe.state!=="active")continue;const Be=xn(Pe);Oe+=Be.total,rt=Math.max(rt,((Pe.endedAt??t)-Pe.startedAt)/1e3)}const ot=rt>0?jw(Oe,rt):null,Xe=hq(e.agents.values());return{byModel:pe,totalCost:Xe.cost,totalTokens:Xe,burnRate:ot}},[e,e.revision,t]),S=_.useMemo(()=>{const re=[];for(const pe of e.agents.values()){if(pe.kind!=="root")continue;let Oe=xn(pe).total,rt=pe.usage.inputTokens,ot=pe.usage.outputTokens,Xe=Uv(pe);for(const Pe of e.agents.values())Pe.sessionId!==pe.sessionId||Pe.kind==="root"||(Oe+=xn(Pe).total,rt+=Pe.usage.inputTokens,ot+=Pe.usage.outputTokens,Xe+=Uv(Pe));re.push({sessionId:pe.sessionId,label:pe.label||pe.cwdBasename||"session",state:pe.state,cost:Oe,inputTokens:rt,outputTokens:ot,unpricedTokens:Xe})}return re.sort((pe,Oe)=>Oe.cost-pe.cost||Oe.inputTokens+Oe.outputTokens-(pe.inputTokens+pe.outputTokens)).slice(0,12)},[e,e.revision]),[E,C]=_.useState("today"),[j,I]=_.useState(0),{data:O,shown:P,stale:z}=Bq(E,j),M=O!=null,A=_.useMemo(()=>{const re=new Map;for(const pe of e.agents.values()){if(pe.kind!=="root"||!pe.sessionId)continue;const Oe=pe.label||pe.cwdBasename;Oe&&re.set(pe.sessionId,Oe)}return re},[e,e.revision]),q=_.useMemo(()=>{const re=new Map;for(const pe of e.agents.values())pe.kind!=="root"||!pe.sessionId||re.set(pe.sessionId,pe.state);return re},[e,e.revision]),H=_.useMemo(()=>M?ET(O):[],[O,M]),Y=_.useMemo(()=>{if(!M)return[];const re=Eq(O,A).slice(0,12),pe=new Map;for(const Oe of re)Oe.label&&pe.set(Oe.label,(pe.get(Oe.label)??0)+1);return re.map(Oe=>Oe.label&&(pe.get(Oe.label)??0)>1?{...Oe,label:`${Oe.label} ${Oe.sessionId.slice(0,4)}`}:Oe)},[O,M,A]),R=_.useMemo(()=>CT(O),[O]),Q=jq(P,E),W=z?" up-stale":"",ne=_.useRef(null);_.useEffect(()=>{ne.current=O?E1(e.agents.values(),t):null},[O]);const X=_.useMemo(()=>M?Sq(ne.current,E1(e.agents.values(),t)):Gv,[e,e.revision,O,M,t]),B=Tq(O,{...b,cost:N},X),J=B.hasCost,$=B.tokenSum,V=Ga(B.cost),Z=Ga(B.inputTokens),F=Ga(B.outputTokens),L=Ga(B.cacheReadTokens),K=Ga(B.cacheCreateTokens),se=w.filter(re=>re.cost.total>0||re.inputTokens+re.outputTokens>0),he=S.filter(re=>re.cost>0||re.inputTokens+re.outputTokens>0),me=M?H.some(re=>re.cost<=0&&re.tokens>0):se.some(re=>!re.priced),xe=a||h,Ee=C1(i==null?void 0:i.fetchedAt,g),He=C1(u==null?void 0:u.fetchedAt,g),Fe=()=>{l(),p(),I(re=>re+1)},Ie=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"}),k&&d.jsx("span",{className:"up-rate",children:k}),d.jsxs("div",{className:"up-header-right",children:[(n.claude||n.codex)&&d.jsx("button",{type:"button",className:"glyph-btn up-refresh-btn",onClick:Fe,...sr(xe),"aria-label":Ie,title:Ie,children:xe?"…":"↻"}),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",Ee&&!a&&d.jsx("span",{className:"up-section-age",title:Oq(i==null?void 0:i.source),children:Ee})]}),i!=null&&i.ok?d.jsxs("div",{className:"up-quota-bars",children:[i.session5hPct!=null&&d.jsx(go,{label:"5-hour window",pct:i.session5hPct,reset:i.session5hReset,resetAt:i.session5hResetAt,windowSec:i.session5hWindowSec,nowSec:g}),i.week7dPct!=null&&d.jsx(go,{label:"7-day window",pct:i.week7dPct,reset:i.week7dReset,resetAt:i.week7dResetAt,windowSec:i.week7dWindowSec,nowSec:g}),i.weekSonnetPct!=null&&d.jsx(go,{label:"Sonnet (7d)",pct:i.weekSonnetPct,nowSec:g}),i.weekOpusPct!=null&&d.jsx(go,{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:qq(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}),He&&!h&&d.jsx("span",{className:"up-section-age",title:"Fetched from the Codex usage endpoint",children:He})]}),u!=null&&u.ok?d.jsxs("div",{className:"up-quota-bars",children:[(be=u.windows)==null?void 0:be.map(re=>d.jsx(go,{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)),(ue=u.extraWindows)==null?void 0:ue.map(re=>d.jsx(go,{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(go,{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:Dq(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?`
75
- last 5h: ${Rt(f.window5h.totalTokens)} tokens · ${f.window5h.sessionCount} session${f.window5h.sessionCount!==1?"s":""}`:""}`,children:[Rt(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:NT.map(re=>d.jsx("button",{type:"button","aria-pressed":E===re.key,className:"uh-range-btn",onClick:()=>C(re.key),children:re.label},re.key))}),$>0?d.jsxs(d.Fragment,{children:[J&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:`up-total${W}`,title:M?void 0:_1,children:[d.jsx("span",{className:"up-total-value",children:Ze(V)}),d.jsx("span",{className:"up-total-label",children:M?Q:pq})]}),B.showCostBar&&d.jsx(Mw,{cost:N})]}),d.jsxs("div",{className:`up-tokens-row${W}`,title:M?void 0:_1,children:[d.jsxs("span",{className:"up-tok",children:[d.jsx("span",{className:"up-k",children:"in"}),Rt(Z)]}),d.jsxs("span",{className:"up-tok",children:[d.jsx("span",{className:"up-k",children:"out"}),Rt(F)]}),B.cacheReadTokens>0&&d.jsxs("span",{className:"up-tok",children:[d.jsx("span",{className:"up-k",children:"cache r"}),Rt(L)]}),B.cacheCreateTokens>0&&d.jsxs("span",{className:"up-tok",children:[d.jsx("span",{className:"up-k",children:"cache c"}),Rt(K)]}),!J&&d.jsx("span",{className:"up-tok up-scope",children:mq})]}),(M?H.length:se.length)>0&&d.jsxs("section",{className:`up-section${W}`,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?H.map(re=>d.jsxs("tr",{children:[d.jsx("td",{className:"up-model-name",title:re.model,children:$s(re.model)}),d.jsx("td",{className:"up-num",children:Rt(re.tokens)}),re.cost>0?d.jsx("td",{className:"up-num up-cost-val",children:Ze(re.cost)}):d.jsx("td",{className:"up-num up-unpriced",children:Mi})]},re.model)):se.map(re=>d.jsxs("tr",{children:[d.jsx("td",{className:"up-model-name",title:re.model===th?"no model reported yet":re.model,children:re.model===th?"unknown":$s(re.model)}),d.jsx("td",{className:"up-num",children:Rt(re.inputTokens+re.outputTokens)}),re.priced?d.jsx("td",{className:"up-num up-cost-val",children:Ze(re.cost.total)}):d.jsx("td",{className:"up-num up-unpriced",children:Mi})]},re.model))})]})]}),M&&Y.length===0&&R.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 ",Q," yet — ccusage dates sessions in UTC, and the totals above are your local day."]})]}),(M?Y.length:he.length)>0&&d.jsxs("section",{className:`up-section${W}`,children:[d.jsxs("h3",{className:"up-section-title",children:["By session",M&&d.jsxs("span",{className:"up-section-age",title:`Sessions with activity ${Q}, each showing what that session has cost since it started.
76
- 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 ",Q]})]}),d.jsxs("div",{className:"up-sessions",children:[M&&Y.map(re=>{const pe=q.get(re.sessionId);return d.jsxs("div",{className:"up-session-row",children:[pe?d.jsxs(d.Fragment,{children:[d.jsx("span",{className:`sl-dot state-${pe}`,"aria-hidden":!0}),d.jsx("span",{className:"vis-hidden",children:ju(pe)})]}):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}
77
- ${re.sessionId}`:re.sessionId,children:re.label??re.sessionId.slice(0,8)}),d.jsx("span",{className:"up-session-tokens",children:Rt(re.tokens)}),re.cost>0?d.jsx("span",{className:"up-session-cost",title:re.models.join(", ")||void 0,children:Ze(re.cost)}):d.jsx("span",{className:"up-session-cost up-unpriced",children:Mi})]},re.sessionId)}),!M&&he.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:ju(re.state)}),d.jsx("span",{className:"up-session-label",children:re.label}),d.jsx("span",{className:"up-session-tokens",children:Rt(re.inputTokens+re.outputTokens)}),re.cost>0?d.jsxs("span",{className:"up-session-cost",title:re.unpricedTokens>0?`${Rt(re.unpricedTokens)} tokens in this session are on an unpriced model, so this is a floor`:void 0,children:[Ze(re.cost),re.unpricedTokens>0?"+":""]}):d.jsx("span",{className:"up-session-cost up-unpriced",children:Mi})]},re.sessionId))]})]}),me&&d.jsxs("div",{className:"up-hint",children:["“",Mi,"” 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 ",Q,".",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 Wq="1",T1="agent-dag.schema",Hq=["agent-dag.layout","agent-dag.viewport"];function Bu(e){if(typeof window>"u")return null;try{return window.localStorage.getItem(e)}catch{return null}}function Gq(e,t=Wq){let n=null;try{n=e.getItem(T1)}catch{return[]}if(n===t)return[];const s=[];if(n!==null)for(const i of Hq)try{e.getItem(i)!==null&&(e.removeItem(i),s.push(i))}catch{}try{e.setItem(T1,t)}catch{}return s}const gt={l:30,r:6,t:6,b:2},Uu=104,Vq=64;function vo(e,t=100,n=Uu){const s=n-gt.t-gt.b;return gt.t+s*(1-Math.max(0,Math.min(t,e))/t)}function Yq(e,t,n,s=100,i=Uu){if(!e.length)return"";const a=e[e.length-1].t-e[0].t,l=p=>{const f=t-gt.l-gt.r;return gt.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)} ${vo(p.v,s,i).toFixed(1)}`,h=p}return u}function Kq(e,t,n,s=100,i=Uu){if(e.length<2)return"";const a=i-gt.b,l=e[e.length-1].t-e[0].t,u=t-gt.l-gt.r,h=v=>gt.l+(l>0?u*(v-e[0].t)/l:u/2);let p="",f=[];const g=()=>{if(f.length>=2){let v=`M${h(f[0].t).toFixed(1)} ${a}`;for(const w of f)v+=`L${h(w.t).toFixed(1)} ${vo(w.v,s,i).toFixed(1)}`;p+=`${v}L${h(f[f.length-1].t).toFixed(1)} ${a}Z`}f=[]};for(const v of e)f.length&&v.t-f[f.length-1].t>n*2&&g(),f.push(v);return g(),p}function Xq(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 Qq(e,t,n){return n!=null&&e>=n?"hot":t!=null&&e>=t?"warn":""}function Zq(e,t,n=s=>nl(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 nl(e){const t=new Date(e);return`${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}`}function IT(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=kn(n),[i,a]=_.useState(null);_.useEffect(()=>{let p=!0;const f=async()=>{try{const v=await fetch(`/api/system/history?group=${e}`);if(!v.ok)return;const w=await v.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]=_.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 hw.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 ",nl(u)," · ",IT(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(e4,{series:p,stepMs:i.stepMs},p.label))})]})}),document.body)}function e4({series:e,stepMs:t}){const n=_.useRef(null),[s,i]=_.useState(560),[a,l]=_.useState(null);_.useEffect(()=>{const P=n.current;if(!P||typeof ResizeObserver>"u")return;const z=new ResizeObserver(([M])=>i(Math.max(160,M.contentRect.width)));return z.observe(P),()=>z.disconnect()},[]);const{points:u,unit:h,warnAt:p,critAt:f,label:g,top:v,restsAtZero:w}=e,N=w?Vq:Uu,{now:b,peak:k}=Xq(u),S=h==="C"?"°C":h,E=g==="Throttling"?Zq(u,t):null,C=a!=null?u[a]:null,j=u.length>1?u[u.length-1].t-u[0].t:0,I=P=>{const z=s-gt.l-gt.r;return gt.l+(j>0?z*(P-u[0].t)/j:z/2)},O=P=>{if(u.length<2)return;const z=P.currentTarget.getBoundingClientRect(),M=(P.clientX-z.left-gt.l)/Math.max(1,z.width-gt.l-gt.r),A=u[0].t+j*Math.max(0,Math.min(1,M));let q=0;for(let H=1;H<u.length;H++)Math.abs(u[H].t-A)<Math.abs(u[q].t-A)&&(q=H);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:[S," now"]})]}),k!=null&&d.jsxs(d.Fragment,{children:[d.jsx("b",{className:Qq(k,p,f),children:k}),d.jsxs("span",{children:[S," 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}${S} now, peak ${k}${S}, over ${IT(u[0].t,u[u.length-1].t)}`,onPointerMove:O,onPointerLeave:()=>l(null),children:[[["warn",p],["hot",f]].map(([P,z])=>z==null||z>v?null:d.jsxs("g",{children:[d.jsx("line",{className:`hist-rule ${P}`,x1:gt.l,x2:s-gt.r,y1:vo(z,v,N),y2:vo(z,v,N)}),d.jsx("text",{className:`hist-rule-tag ${P}`,x:2,y:vo(z,v,N)+3,children:z})]},P)),d.jsx("line",{className:"hist-floor",x1:gt.l,x2:s-gt.r,y1:N-gt.b,y2:N-gt.b}),d.jsx("path",{className:"hist-area",d:Kq(u,s,t,v,N)}),d.jsx("path",{className:"hist-line",d:Yq(u,s,t,v,N)}),u.length===1&&d.jsx("circle",{className:"hist-dot",cx:I(u[0].t),cy:vo(u[0].v,v,N),r:3}),C&&d.jsxs("g",{children:[d.jsx("line",{className:"hist-cross",x1:I(C.t),x2:I(C.t),y1:gt.t,y2:N-gt.b}),d.jsx("circle",{className:"hist-dot",cx:I(C.t),cy:vo(C.v,v,N),r:3})]})]})}),d.jsx("div",{className:"hist-axis",children:C?d.jsxs("span",{className:"hist-at",children:[nl(C.t)," — ",d.jsx("b",{children:C.v}),S]}):d.jsxs(d.Fragment,{children:[d.jsx("span",{children:u.length?nl(u[0].t):""}),d.jsx("span",{children:u.length?nl(u[u.length-1].t):""})]})}),E&&d.jsx("div",{className:"hist-note",children:E})]})}function t4({procs:e,total:t,onClose:n}){const s=kn(n),[i,a]=_.useState(OT),l=Xv(e,i);return hw.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(Fi,{col:"cpu",label:"cpu",sort:i,onSort:a}),d.jsx(Fi,{col:"mem",label:"mem",sort:i,onSort:a}),d.jsx("th",{scope:"col",className:"pl-pid-h",children:"pid"}),d.jsx(Fi,{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 n4=3e3,r4=4e3,nh=20,Va=36,Ri=8,s4=8,OT={key:"cpu",dir:"desc",rank:"cpu"};function o4(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 Xv(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 i4(e,t,n=s4){const s=Xv(e,{key:t.rank,dir:"desc",rank:t.rank});return Xv(s.slice(0,n),t)}function a4(e,t){return e.key!==t?"none":e.dir==="asc"?"ascending":"descending"}function l4(e,t,n){return e>=n?"hot":e>=t?"warn":"calm"}function c4(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}% ${u4(t.lastMs,n)}`:"running at full speed, and never held back"}}function u4(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 PT="agent-dag.systemPanelOpen";function d4(){return Bu(PT)==="1"}function f4(e){if(!(typeof window>"u"))try{window.localStorage.setItem(PT,e?"1":"0")}catch{}}function wo(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 h4(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 p4(){const[e,t]=_.useState(null),n=_.useRef(null);return _.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,n4))},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 m4(e){const[t,n]=_.useState(null);return _.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,r4);return()=>{s=!1,window.clearInterval(a)}},[e]),t}function g4({usageOpen:e=!1}){const t=p4(),[n,s]=_.useState(d4);_.useEffect(()=>{f4(n)},[n]);const i=_.useRef(null),a=_.useRef(null);if(_.useEffect(()=>{if(n)return Di.push(()=>{var S,E;const k=((S=a.current)==null?void 0:S.contains(document.activeElement))??!1;s(!1),k&&((E=i.current)==null||E.focus())},mT)},[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:Va,height:Ri,viewBox:`0 0 ${Va} ${Ri}`}),d.jsx("span",{className:"sm-ram"})]})})});const{cpu:l,cpuHistory:u,cores:h,memory:p,loadavg:f}=t,g=p.usedPct>=90,v=u.slice(-nh),w=nh-v.length,N=Va/nh,b=[`CPU ${l.toFixed(0)}% of ${h} cores`,f?`load ${f[0]} · ${f[1]} · ${f[2]} (1m · 5m · 15m)`:null,`Memory ${wo(p.total-p.available)} of ${wo(p.total)} used`,"","Click for detail. This machine, not this session."].filter(k=>k!==null).join(`
78
- `);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(k=>!k),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:Va,height:Ri,viewBox:`0 0 ${Va} ${Ri}`,children:v.map((k,S)=>{const E=w+S,C=Math.max(1,k/100*Ri),j=.32+.68*((S+1)/v.length);return d.jsx("rect",{x:E*N,y:Ri-C,width:Math.max(.8,N-.7),height:C,rx:.5,fill:"var(--accent)",opacity:j},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(y4,{sys:t,usageOpen:e,panelRef:a,onClose:()=>{var k;s(!1),(k=i.current)==null||k.focus()}})]})}function y4({sys:e,usageOpen:t,panelRef:n,onClose:s}){const i=m4(!0),{memory:a,swap:l,perCore:u,loadavg:h,cores:p,uptimeSec:f,platform:g,thermal:v}=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 ",h4(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(gu,{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,S)=>d.jsx("span",{className:"sd-core",title:`core ${S+1}: ${k}%`,children:d.jsx("span",{className:"sd-core-fill",style:{transform:`scaleY(${Math.max(2,k)/100})`}})},S))})})}),d.jsx("div",{className:"sd-section",role:"group","aria-label":"Memory",children:d.jsxs(gu,{group:"memory",title:"Memory history",action:"Show memory history",label:"Memory",children:[a&&d.jsx(Tu,{label:"Physical",value:d.jsxs(d.Fragment,{children:[d.jsx("b",{children:wo(w)})," of ",wo(a.total)]}),pct:a.usedPct,tone:a.usedPct>=90?"warn":"calm",note:`${wo(a.available)} available`}),l&&l.total>0&&d.jsx(Tu,{label:N,value:d.jsxs(d.Fragment,{children:[d.jsx("b",{children:wo(l.used)})," of ",wo(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(gu,{group:"load",title:"Load history",action:"Show load history",label:"Load average",children:[d.jsx("div",{className:"sd-load",children:h.map((k,S)=>d.jsxs("span",{className:`sd-load-item${k>p?" over":""}`,children:[d.jsx("b",{children:k.toFixed(2)}),d.jsx("span",{children:["1m","5m","15m"][S]})]},S))}),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(v4,{thermal:v}),d.jsx(w4,{read:i})]})}function gu({group:e,title:t,action:n,label:s,children:i}){const[a,l]=_.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 v4({thermal:e}){if(!e)return null;const t=e.throttle?c4(e.throttle.speedLimit,e.heldBack):null;return d.jsx("div",{className:"sd-section",role:"group","aria-label":"Thermal",children:d.jsxs(gu,{group:"thermal",title:"Thermal history",action:"Show thermal history",label:"Thermal",children:[e.celsius.map(n=>d.jsx(Tu,{label:n.label,value:d.jsxs(d.Fragment,{children:[d.jsx("b",{children:n.celsius})," °C"]}),pct:n.celsius,tone:l4(n.celsius,n.warnAt,n.critAt)},n.label)),t&&d.jsx(Tu,{label:"Throttling",value:t.value,pct:t.pct,tone:t.tone,note:t.note})]})})}function w4({read:e}){const[t,n]=_.useState(OT),[s,i]=_.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(t4,{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(Fi,{col:"cpu",label:"cpu",sort:t,onSort:n}),d.jsx(Fi,{col:"mem",label:"mem",sort:t,onSort:n}),d.jsx(Fi,{col:"name",label:"process",sort:t,onSort:n})]})}),d.jsx("tbody",{children:i4(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 Fi({col:e,label:t,sort:n,onSort:s}){const i=a4(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(o4(n,e)),children:[t,d.jsx("span",{className:"sd-sort-dir","aria-hidden":!0,children:i==="none"?"":i==="ascending"?"↑":"↓"})]})})}function Tu({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 R1=18,x4=1100,Ai=(e,t)=>{const n=Math.sin(e*12.9898+t*78.233)*43758.5453;return n-Math.floor(n)},b4=Array.from({length:R1},(e,t)=>{const n=-72+144*t/(R1-1)+(Ai(t,1)-.5)*9,s=(n-90)*(Math.PI/180),i=(54+32*Math.cos(n*Math.PI/180))*(.74+Ai(t,2)*.52);return{dx:Math.cos(s)*i,dy:Math.sin(s)*i,rot:(t%2?1:-1)*(100+Ai(t,3)*260),delay:Math.round(Ai(t,4)*90),dur:760+Math.round(Ai(t,5)*260),scale:.8+Ai(t,6)*.45,hue:t%4,round:t%3===0}});function A1({anchor:e}){var i;const[t,n]=_.useState(null),s=typeof window<"u"&&((i=window.matchMedia)==null?void 0:i.call(window,"(prefers-reduced-motion: reduce)").matches);return _.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),x4);return()=>window.clearTimeout(u)},[e,s]),s||!t?null:hw.createPortal(d.jsx("div",{className:"confetti",style:{left:`${t.x}px`,top:`${t.y}px`},"aria-hidden":!0,children:b4.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 $T=new Set(["awaiting_url","awaiting_code","registering"]);function k4(e){return e!=null&&$T.has(e)}function LT(e){return e!=null&&e!=="done"&&!$T.has(e)}const _4="the sign-in ended before it finished — the deck restarted, or it was cancelled in another tab",S4="the sign-in did not complete";function N4({state:e,serverError:t,localError:n}){const s=e==="idle";return{title:s?"Sign-in ended":"Sign-in failed",message:n||t||(s?_4:S4)}}const E4="done";function C4(){let e=!1;return{shouldAnnounce(t){return t!==E4?(e=!1,!1):e?!1:(e=!0,!0)}}}function Iw(e,t){return t&&Object.hasOwn(e,t)?e[t]:void 0}const j4={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"},T4={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"},R4=`claude-swap could not read the login keychain — start ${zt} from a Terminal window rather than a background service`;function Qv(e,t){if((e==null?void 0:e.reason)!=="no_cswap"&&/keychain/i.test(Gi(e)))return R4;const n=Iw(T4,e==null?void 0:e.reason);return n||(e==null?void 0:e.reason)||t}function Gi(e){return((e==null?void 0:e.output)||(e==null?void 0:e.detail)||(e==null?void 0:e.error)||"").trim()}const A4={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"},M4="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 I4(e){return/\bnpx\b/i.test(e)&&/(command not found|not found|not recognized|ENOENT)/i.test(e)}const O4="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",P4="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",$4=e=>/\b(?:ERR_)?MODULE_NOT_FOUND\b|cannot find (?:module|package)/i.test(e),L4=/node_modules[\\/]npm[\\/]bin[\\/]|\bnpm-prefix\.js\b|\bnp[mx][-.][\w.-]*cli\.js\b/i,q4=/[\\/]_npx[\\/]/i,D4=`the copy of ccusage ${zt} installed for itself`;function F4(e){const t=String((e==null?void 0:e.install)??"").replace(/\s+/g," ").trim();return t.length>240?`${t.slice(0,239)}…`:t}function z4(e,t){const n=B4(e,t),s=F4(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 ${Ya(n)}`:`there is no managed copy of ccusage on this machine, and the npx fallback failed: ${Ya(n)}`;case"managed":return`${D4} failed to run: ${Ya(n)}`;case"path":return e.bin?`the ccusage this deck found at ${e.bin} failed to run: ${Ya(n)}`:`the ccusage this deck found on your PATH failed to run: ${Ya(n)}`;default:return n}}const Ya=e=>/^[A-Z][a-z]/.test(e)?e[0].toLowerCase()+e.slice(1):e;function B4(e,t){const n=Gi(e);if($4(n)){if(q4.test(n))return P4;if(L4.test(n))return O4}if(I4(n))return M4;const s=Iw(A4,e==null?void 0:e.reason);return s||(e==null?void 0:e.reason)||t}function Pi(e,t){if(e!=null&&e.detail)return e.detail;if(e!=null&&e.error&&LT(e.state))return e.error;const n=Iw(j4,e==null?void 0:e.reason);return n||(e!=null&&e.error?e.error:(e==null?void 0:e.reason)||t)}function U4(e,t,n){if(n<=0||Tw(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 qT(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 W4(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 H4(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 G4(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 V4(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 Y4=1500,ru=[{id:"login",label:"Sign in"},{id:"paste",label:"Paste a share"}],M1="aa-panel",I1=e=>`aa-tab-${e}`;async function Ka(e){return(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json().catch(()=>null)}const Zv=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"})]}));Zv.displayName="SuccessMark";function K4({onClose:e,onChanged:t}){const[n,s]=_.useState("login"),[i,a]=_.useState(null),[l,u]=_.useState(""),[h,p]=_.useState(""),[f,g]=_.useState(!1),[v,w]=_.useState(null),[N,b]=_.useState(null),[k,S]=_.useState(null),[E,C]=_.useState(null),j=_.useRef(""),I=_.useRef(!1),O=_.useRef(!1),P=_.useRef(null),z=_.useRef(null),M=_.useRef(null),A=_.useRef(null),q=_.useRef([]),H=_.useRef(!1),Y=_.useCallback(()=>{I.current&&Ka({action:"login-cancel"}).catch(()=>{}),e()},[e]),R=kn(Y,{focusRef:M}),Q=_.useCallback(async()=>{if(!or(O.current))return;O.current=!0,g(!0),w(null),I.current=!0;const L=await Ka({action:"login"}).catch(()=>null);if(O.current=!1,g(!1),!(L!=null&&L.ok)){w(Pi(L,"could not start the sign-in"));return}a(L)},[]);_.useEffect(()=>{if(!k4(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{}},Y4);return()=>window.clearInterval(L)},[i]);const W=_.useRef(t);W.current=t;const ne=_.useState(C4)[0];_.useEffect(()=>{var L;(i==null?void 0:i.state)==="awaiting_code"&&((L=P.current)==null||L.focus()),ne.shouldAnnounce(i==null?void 0:i.state)&&W.current()},[i==null?void 0:i.state,ne]),_.useEffect(()=>{var L;n==="paste"&&!H.current&&((L=z.current)==null||L.focus()),H.current=!1},[n]);const X=_.useCallback(L=>{var se;const K=U4(L,ru.findIndex(he=>he.id===n),ru.length);K.kind!=="pass"&&(L.preventDefault(),H.current=!0,s(ru[K.index].id),(se=q.current[K.index])==null||se.focus())},[n]),B=_.useCallback(async()=>{var K;if(!or(O.current))return;O.current=!0,g(!0),w(null);const L=await Ka({action:"login-code",code:l}).catch(()=>null);if(O.current=!1,g(!1),!(L!=null&&L.ok)){w(Pi(L,"the code was not accepted")),L!=null&&L.state&&a(L),(K=P.current)==null||K.select();return}u(""),a(L)},[l,i]),J=_.useCallback(async()=>{if(!or(O.current))return;O.current=!0,g(!0),w(null);const L=await Ka({action:"import",blob:h}).catch(()=>null);if(O.current=!1,g(!1),!(L!=null&&L.ok)){w(Pi(L,"the import failed"));return}j.current=h,p(""),C(null),b(L.results??[]),t()},[h,t]),$=_.useCallback(async L=>{const K=`${L.email}|${L.org??""}`;if(!or(O.current)||!j.current)return;O.current=!0,g(!0),S(K),C(null);const se=await Ka({action:"import",blob:j.current,force:!0,only:{email:L.email,org:L.org??""}}).catch(()=>null);if(O.current=!1,g(!1),S(null),!(se!=null&&se.ok)){C({key:K,text:Pi(se,"that account could not be updated")});return}const he=(se.results??[])[0];he&&b(me=>me&&me.map(xe=>`${xe.email}|${xe.org??""}`===K?he:xe)),t()},[t]),V=(i==null?void 0:i.state)==="done"?i.account:null,Z=LT(i==null?void 0:i.state)||!!(v&&I.current&&!f),F=N4({state:i==null?void 0:i.state,serverError:i==null?void 0:i.error,localError:v});return d.jsx("div",{className:"modal-backdrop",onClick:Y,role:"presentation",children:d.jsxs("div",{ref:R,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:ru.map((L,K)=>d.jsx("button",{type:"button",role:"tab",id:I1(L.id),ref:se=>{q.current[K]=se},"aria-selected":n===L.id,"aria-controls":M1,tabIndex:n===L.id?0:-1,className:`aa-tab${n===L.id?" on":""}`,onClick:()=>{H.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:M1,role:"tabpanel","aria-labelledby":I1(n),children:n==="login"?V?d.jsxs("div",{className:"aa-done",children:[d.jsx(Zv,{ref:A}),d.jsx(A1,{anchor:A}),d.jsx("h4",{children:V.added?`Account ${V.num} added`:"Credentials refreshed"}),d.jsxs("p",{className:"aa-note",children:[d.jsx("strong",{children:V.email}),V.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:P,type:"text",value:l,onChange:L=>u(L.target.value),onKeyDown:L=>{L.key==="Enter"&&l.trim()&&!f&&B()},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",...sr(f,!l.trim()||i.state==="registering"),onClick:B,children:i.state==="registering"?"registering…":"Continue"})]}),(v||i.error)&&d.jsx("p",{className:"aa-err",children:v??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."})]})]}):Z?d.jsxs("div",{className:"aa-step",children:[d.jsx("h4",{children:F.title}),d.jsx("p",{className:"aa-err",children:F.message}),d.jsx("button",{type:"button",className:"btn",onClick:()=>{I.current=!1,a(null),w(null),Q()},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:Q,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(Zv,{ref:A}),L>0&&d.jsx(A1,{anchor:A}),d.jsx("h4",{children:V4(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:G4(K.state)}),K.state==="present"&&d.jsx("button",{type:"button",className:"aa-result-fix","aria-busy":k===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:k===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:()=>{j.current="",C(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:z,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",...sr(f,!h.trim()),onClick:J,children:f?"importing…":"Import"})]}),v&&d.jsx("p",{className:"aa-err",children:v}),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 X4(e){return(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json().catch(()=>null)}const Q4=1800;function Z4({accounts:e,onClose:t,copyText:n}){const[s,i]=_.useState([]),[a,l]=_.useState(null),[u,h]=_.useState(!1),[p,f]=_.useState(null),[g,v]=_.useState(!1),[w,N]=_.useState(()=>Math.floor(Date.now()/1e3)),b=_.useRef(null),k=_.useRef(!1),S=kn(t,{focusRef:b});_.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=W4(e),C=e.filter(A=>!s.includes(A.num)).map(A=>A.num),j=C.length===e.length,I=A=>i(q=>q.includes(A)?q.filter(H=>H!==A):[...q,A]),O=_.useCallback(async()=>{if(!or(k.current)||!C.length)return;k.current=!0,h(!0),f(null),v(!1);const A=await X4({action:"share",accounts:C}).catch(()=>null);if(k.current=!1,h(!1),!(A!=null&&A.ok)){f(Pi(A,"the share could not be made"));return}l({blob:A.blob,expiresAt:A.expiresAt,shared:A.shared??[],failed:A.failed??[]})},[e,C]),P=a?qT(a.expiresAt,w):null,z=(P==null?void 0:P.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:S,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:z?"This share has expired":M===1?"1 account, ready to paste":`${M} accounts, ready to paste`}),d.jsx("code",{className:`ap-share-blob${z?" 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(z){l(null),O();return}await n(a.blob)&&(v(!0),window.setTimeout(()=>v(!1),Q4))},children:z?"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 ${P==null?void 0:P.tone}`,children:P==null?void 0:P.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 H;const q=!!(A.email&&((H=A.detail)!=null&&H.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:z?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),v(!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${C.length?"":" empty"}`,children:H4(C.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:C.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(j?e.map(A=>A.num):[]),children:j?"Clear all":"Select all"}),d.jsx("button",{type:"button",className:"btn primary",ref:b,...sr(u,!C.length),onClick:O,children:u?"making the share…":C.length===0?"Share":C.length===1?"Share 1 account":`Share ${C.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 eD(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 tD(e,t,n){return t!=null&&e.some(s=>s.slot===t)?t:n}function nD(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 rD(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 O1(e){return typeof e.id=="string"&&e.id.startsWith("scoped-")}function P1(e){const t=e.filter(u=>!O1(u)),n=e.filter(u=>O1(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 sD(e,t,n){return e<1?null:t?"fewer":n?`${n.label} ${Math.round(n.pct)}%`:`${e} more`}function oD(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 iD="\0";function Ow(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}${iD}${n}`}function aD(e,t){const n=Ow(t);return e.includes(n)?e.filter(s=>s!==n):[...e,n]}function lD(e,t){if(!Array.isArray(t))return e;const n=new Set(t.map(Ow)),s=e.filter(i=>n.has(i));return s.length===e.length?e:s}const cD=64;function uD(e,t){const n=e.trim();return{alias:n,commit:n!==(t??"").trim()}}const dD=Object.freeze({text:"couldn't reach the deck server",reload:!0});async function $1(e){return e.ok?{ok:!0,status:e.status,body:null}:{ok:!1,status:e.status,body:await e.json().catch(()=>null)}}function fD(e){const t=e.find(s=>!s.ok);if(!t)return null;const n=Gi(t.body);return{text:Qv(t.body,`the deck server answered ${t.status}`),...n?{raw:n}:{},reload:!0}}function L1(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 q1=15e3,hD=8e3,rh=1800,pD=3e4,mD=[70,80,85,90,95];function D1(e,t){return jT(t-Math.floor(e/1e3))}function gD(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 yD(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 F1({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?TT(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 z1(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 vD({onClose:e}){var Ge,it,ke,ct,It;const[t,n]=_.useState(null),[s,i]=_.useState(null),[a,l]=_.useState(null),[u,h]=_.useState(!1),[p,f]=_.useState(null),[g,v]=_.useState(()=>Math.floor(Date.now()/1e3)),w=_.useRef(null),[N,b]=_.useState(null),[k,S]=_.useState(!1),[E,C]=_.useState(""),[j,I]=_.useState(null),[O,P]=_.useState(null),[z,M]=_.useState(null),[A,q]=_.useState(!1),[H,Y]=_.useState(!1),[R,Q]=_.useState(null),[W,ne]=_.useState(null),[X,B]=_.useState(null),[J,$]=_.useState(null),[V,Z]=_.useState(!1),[F,L]=_.useState([]),K=_.useRef(null),se=_.useCallback(ae=>AT(K.current)?(K.current=ae,l(ae),!0):!1,[]),he=_.useCallback(()=>{K.current=null,l(null)},[]),me=(ae,Le=!1)=>{const ze=RT(a,ae);return{disabled:ze.disabled,"aria-busy":ze.busy||Le}},xe=_.useCallback(ae=>{window.requestAnimationFrame(()=>{var Le;if(Iq(((Le=document.activeElement)==null?void 0:Le.tagName)??null))for(const ze of Mq(ae)){const Ce=document.querySelector(ze);if(Ce){Ce.focus();return}}})},[]),Ee=_.useCallback(async(ae=!1)=>{ae&&h(!0);const Le=new AbortController,ze=window.setTimeout(()=>Le.abort(),pD);try{const[Ce,Ve]=await Promise.all([fetch(`/api/claude-accounts${ae?"?refresh=1":""}`,{signal:Le.signal}),fetch("/api/cswap-auto",{signal:Le.signal})]);if(Ce.ok){const st=await Ce.json();n(st),L(Te=>lD(Te,st.accounts))}Ve.ok&&i(await Ve.json());const Et=fD([await $1(Ce),await $1(Ve)]);f(st=>L1(st,Et))}catch{f(Ce=>L1(Ce,dD))}finally{window.clearTimeout(ze),ae&&h(!1)}},[]),He=_.useCallback(async(ae,Le)=>{if(!se(Le))return null;f(null);try{const Ce=await(await fetch("/api/cswap-auto",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(ae)})).json().catch(()=>null);return Ce!=null&&Ce.ok||f({text:Qv(Ce,"command failed"),raw:Gi(Ce)}),Ce}catch{return f({text:"server unreachable"}),null}finally{he()}},[se,he]),Fe=_.useCallback(async(ae,Le)=>{if(!se(Le))return null;f(null);try{const Ce=await(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(ae)})).json().catch(()=>null);return Ce!=null&&Ce.ok||f({text:Pi(Ce,"command failed")}),Ce}catch{return f({text:"server unreachable"}),null}finally{he()}},[se,he]);_.useEffect(()=>(Ee(!0),w.current=window.setInterval(()=>Ee(!1),q1),()=>{w.current!=null&&window.clearInterval(w.current)}),[Ee]),_.useEffect(()=>{const ae=window.setInterval(()=>v(Math.floor(Date.now()/1e3)),3e4);return()=>window.clearInterval(ae)},[]);const Ie=((Ge=s==null?void 0:s.settings["autoswitch.threshold"])==null?void 0:Ge.value)??"90",be=J??Ie,ue=rD(be,Ie),re=(it=t==null?void 0:t.accounts)==null?void 0:it.find(ae=>ae.active),pe=((ke=P1((re==null?void 0:re.lanes)??[]).peak)==null?void 0:ke.pct)??null,Oe=pe!=null&&pe>=Number(Ie)-15,rt=async ae=>{if(se(`switch-${ae}`)){f(null);try{const ze=await(await fetch("/api/claude-accounts/switch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({account:ae})})).json().catch(()=>null);ze!=null&&ze.ok||f({text:Qv(ze,"the switch failed"),raw:Gi(ze)}),await Ee(!0)}catch{f({text:"server unreachable"})}finally{he(),xe(ae)}}},ot=async(ae,Le)=>{const{commit:ze,alias:Ce}=uD(E,Le);if(ze){const Ve=await Fe({action:"alias",account:ae,alias:Ce},`alias-${ae}`);if(await Ee(!0),!(Ve!=null&&Ve.ok))return;C(Ce)}I(ae),window.setTimeout(()=>I(Ve=>Ve===ae?null:Ve),rh)},Xe=async(ae,Le)=>{const ze=await Fe({action:"move",account:ae,slot:Le},`move-${ae}`),Ce=eD({menuFor:N,shareFor:(z==null?void 0:z.num)??null},ae,ze);if(await Ee(!0),Ce){b(Ce.menuFor),P(Ce.confirmRemove),Ce.shareFor==null&&(M(null),Y(!1)),Q(Ce.swapNote);const Ve=Ce.swapNote;Ve&&window.setTimeout(()=>Q(Et=>Et===Ve?null:Et),hD),ne(null),xe(Ce.menuFor)}return ze},Pe=async(ae,Le,ze)=>{if(ze.sends){const Ce=await Xe(ae,Le);if(!(Ce!=null&&Ce.ok))return}B(ae),window.setTimeout(()=>B(Ce=>Ce===ae?null:Ce),rh)},Be=async(ae,Le)=>{if(Le.sends){const ze=await He({action:"setting",key:"autoswitch.threshold",value:ae},"threshold");if(await Ee(!0),!(ze!=null&&ze.ok))return;$(null)}Z(!0),window.setTimeout(()=>Z(!1),rh)};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:()=>S(!0),"aria-label":"Add an account",title:"Sign in to another Claude account, or paste one shared from another deck",children:"+"}),(((ct=t==null?void 0:t.accounts)==null?void 0:ct.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:()=>Ee(!0),...me("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 ",q1/1e3," seconds."]}),d.jsx("button",{type:"button",className:"ap-fix",disabled:u,onClick:()=>Ee(!0),children:u?"trying…":"try again"})]}):d.jsx("div",{className:"ap-empty",children:"Checking…"}):t.ok?d.jsxs(d.Fragment,{children:[(It=t.accounts)==null?void 0:It.map(ae=>{const{shown:Le,rest:ze,fuller:Ce,peak:Ve}=P1(ae.lanes),Et=F.includes(Ow(ae)),st=sD(ze.length,Et,Ce);return d.jsxs("div",{className:`ap-account${ae.active?" active":""}`,children:[d.jsxs("div",{className:"ap-account-head",children:[d.jsx("span",{className:"ap-num",children:ae.num}),ae.alias&&d.jsx("span",{className:"ap-alias",title:ae.alias,children:ae.alias}),d.jsx("span",{className:"ap-email",title:ae.email??void 0,children:ae.email}),d.jsx("button",{type:"button",id:`ap-more-${ae.num}`,className:`ap-more${N===ae.num?" on":""}`,"aria-label":`Manage account ${ae.num}`,"aria-expanded":N===ae.num,"aria-controls":N===ae.num?`ap-manage-${ae.num}`:void 0,title:"Share, rename, move, remove",onClick:()=>{b(N===ae.num?null:ae.num),C(ae.alias??""),P(null),M(null),Y(!1),Q(null),I(null),ne(null),B(null)},children:"⋯"}),ae.active&&d.jsx("span",{className:"ap-badge-active",children:"active"}),ae.disabled&&d.jsx("span",{className:"ap-badge-held",children:"held out"}),!ae.active&&!ae.disabled&&d.jsx("button",{type:"button",className:"ap-manage-btn ap-switch",...me(`switch-${ae.num}`),onClick:()=>rt(ae.num),title:`Switch to ${ae.alias??ae.email}`,children:a===`switch-${ae.num}`?"…":"switch"})]}),d.jsx("div",{className:"ap-lanes",id:`ap-lanes-${ae.num}`,children:Le.length?d.jsxs(d.Fragment,{children:[Le.map(Te=>d.jsx(F1,{lane:Te,nowSec:g},Te.id)),Et&&ze.map(Te=>d.jsx(F1,{lane:Te,nowSec:g},Te.id))]}):d.jsx("div",{className:"ap-hint",children:"No usage recorded yet."})}),d.jsxs("div",{className:"ap-meta",children:[ae.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",...me("recapture"),onClick:async()=>{const Te=await Fe({action:"recapture"},"recapture");Te!=null&&Te.ok&&Ee(!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"})]}),ae.error&&(()=>{const Te=yD(ae.error);return d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"ap-err",title:Te.hint,children:Te.text}),Te.fixable&&d.jsx("button",{type:"button",className:"ap-fix",onClick:()=>S(!0),title:"Open the sign-in dialog. Signing in as this account replaces its stored login in place.",children:"sign in again"})]})})(),st&&d.jsx("button",{type:"button",className:"ap-lanes-more","aria-expanded":Et,"aria-controls":`ap-lanes-${ae.num}`,title:oD(ae.headroom,(Ve==null?void 0:Ve.label)??null,ze.length,Et),onClick:()=>L(Te=>aD(Te,ae)),children:st}),(((s==null?void 0:s.enabled)||(s==null?void 0:s.external))&&!ae.active||ae.disabled)&&d.jsx("button",{type:"button",className:"ap-rotate",...me(`rot-${ae.num}`),onClick:()=>He({action:"account",account:ae.num,enabled:ae.disabled},`rot-${ae.num}`).then(()=>Ee(!0)),title:ae.disabled?"Return this account to auto-rotation":"Hold this account out of auto-rotation",children:ae.disabled?"put back":"hold out"}),ae.fetchedAt?d.jsxs("span",{className:`ap-age${ae.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 ",D1(ae.fetchedAt,g),gD(ae.nextAt,g)]}):d.jsx("span",{className:"ap-age ap-stale",title:"claude-swap has not read this account yet",children:"never collected"})]}),N===ae.num&&d.jsxs("div",{className:"ap-manage",id:`ap-manage-${ae.num}`,role:"group","aria-label":`Manage account ${ae.num}`,children:[d.jsxs("div",{className:"ap-manage-name",children:[d.jsx("label",{className:"vis-hidden",htmlFor:`ap-alias-${ae.num}`,children:"Alias"}),d.jsx("input",{id:`ap-alias-${ae.num}`,className:"ap-manage-input",type:"text",value:E,onChange:Te=>C(Te.target.value),onKeyDown:Te=>{Te.key==="Enter"&&ot(ae.num,ae.alias)},maxLength:cD,placeholder:"e.g. work",spellCheck:!1,autoFocus:!0}),d.jsx("button",{type:"button",className:"ap-manage-btn",...me(`alias-${ae.num}`),onClick:()=>ot(ae.num,ae.alias),title:"A short name to show instead of the email",children:j===ae.num?"saved":"save"})]}),(()=>{const Te=J4((t.accounts??[]).map(_t=>_t.num),ae.num),vt=tD(Te,W,ae.num),ut=nD(Te,vt,ae.num);return d.jsxs("div",{className:"ap-manage-slot",children:[d.jsx("label",{className:"vis-hidden",htmlFor:`ap-slot-${ae.num}`,children:"Slot"}),d.jsx("span",{className:"ap-field",children:d.jsx("select",{id:`ap-slot-${ae.num}`,value:String(vt),...me(`move-${ae.num}`),onChange:_t=>ne(Number(_t.target.value)),children:Te.map(_t=>d.jsx("option",{value:_t.slot,children:_t.label},_t.slot))})}),d.jsx("button",{type:"button",className:"ap-manage-btn",...me(`move-${ae.num}`),title:ut.title,onClick:()=>Pe(ae.num,vt,ut),children:X===ae.num?ut.done:ut.label})]})})(),d.jsxs("div",{className:"ap-manage-acts",children:[d.jsx("button",{type:"button",className:"ap-manage-btn",...me(`share-${ae.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 Te=await Fe({action:"share",account:ae.num},`share-${ae.num}`);Te!=null&&Te.ok&&M({num:ae.num,blob:Te.blob,expiresAt:Te.expiresAt})},children:"share"}),d.jsx("button",{type:"button",className:`ap-manage-btn danger${O===ae.num?" armed":""}`,...me(`rm-${ae.num}`),title:O===ae.num?"This deletes the stored credentials for this account":"Remove this account from claude-swap",onClick:()=>{if(O!==ae.num){P(ae.num),window.setTimeout(()=>P(Te=>Te===ae.num?null:Te),4e3);return}P(null),Fe({action:"remove",account:ae.num},`rm-${ae.num}`).then(()=>{b(null),Ee(!0),xe(null)})},children:O===ae.num?"confirm":"remove"})]}),(R==null?void 0:R.at)===ae.num&&(()=>{var ut;const Te=(ut=t.accounts)==null?void 0:ut.find(_t=>_t.num===R.displaced),vt=(Te==null?void 0:Te.alias)??(Te==null?void 0:Te.email)??"the account that was there";return d.jsxs("span",{className:"ap-manage-hint ap-manage-swap",title:`Slot ${R.at} was taken, so the two accounts traded places: ${vt} now holds slot ${R.displaced}.`,children:["swapped with slot ",R.displaced]})})(),(z==null?void 0:z.num)===ae.num&&(()=>{const Te=qT(z.expiresAt,g),vt=Te.tone==="gone";return d.jsxs("div",{className:`ap-share${vt?" expired":""}`,children:[d.jsx("code",{className:"ap-share-blob",children:z.blob}),d.jsxs("div",{className:"ap-share-foot",children:[d.jsx("button",{type:"button",className:"ap-manage-btn",...me(`share-${ae.num}`),onClick:async()=>{if(vt){Y(!1);const ut=await Fe({action:"share",account:ae.num},`share-${ae.num}`);ut!=null&&ut.ok&&M({num:ae.num,blob:ut.blob,expiresAt:ut.expiresAt});return}await z1(z.blob)&&(Y(!0),window.setTimeout(()=>Y(!1),1800))},children:vt?"make a new share":H?"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 ${Te.tone}`,children:Te.text})]})]})]})})()]})]},ae.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:[pe!=null&&d.jsxs("span",{className:`ap-auto-now${Oe?" near":""}`,children:[Math.round(pe),"%"]}),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:be,...me("threshold"),onChange:ae=>$(ae.target.value),children:mD.map(ae=>d.jsxs("option",{value:ae,children:[ae,"%"]},ae))})}),d.jsx("button",{type:"button",className:"ap-manage-btn",...me("threshold"),title:ue.title,onClick:()=>Be(be,ue),children:V?ue.done:ue.label}),d.jsxs("button",{type:"button",className:`ap-auto-state${s.enabled?" live":""}`,role:"switch","aria-checked":s.enabled,"aria-label":"Auto-switch",...me("enable"),onClick:()=>He({action:"enable",enabled:!s.enabled},"enable").then(()=>Ee(!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 ",D1(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})`:"","."]})]})}),k&&d.jsx(K4,{onClose:()=>S(!1),onChanged:()=>Ee(!0)}),A&&d.jsx(Z4,{accounts:((t==null?void 0:t.accounts)??[]).map(ae=>({num:ae.num,email:ae.email,alias:ae.alias,org:ae.org})),onClose:()=>q(!1),copyText:z1})]})}const wD=3e4;function xD({bundle:e,running:t,lastTried:n}){return!t||e===t?!1:n!==t}function bD({bundle:e,running:t,pending:n,lastTried:s}){return t?xD({bundle:e,running:t,lastTried:s})?"reload":n==null||n&&n!==t?"wait":"confirm":"wait"}function kD(e){return!e||e.state!=="failed"?null:`${typeof e.at=="number"?e.at:0}:${e.error??""}`}function _D({asked:e,reported:t}){return t?t!==e:!1}function SD(e){const t=e.thresholdMs??wD;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 ND(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 CD(e){return e<=0?null:e===1?"the one agent":`all ${e} agents`}function jD(e,t){const n=CD(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 TD({agentCount:e,onConfirm:t,onCancel:n}){const s=_.useRef(null),i=kn(n,{focusRef:s,layer:XL}),[a,l]=_.useState(null);_.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}=jD(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 RD="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.",AD=[{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 MD({onClose:e}){const t=kn(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:RD}),d.jsx("div",{className:"shortcuts",children:AD.map(n=>d.jsxs(_.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 ID=["done","needs-input"],OD=[{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}]}],PD=[{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}]}],Pw={done:OD,"needs-input":PD},Vi="two";function Jv(e,t){const n=Pw[e];return n.find(s=>s.id===t)??n.find(s=>s.id===Vi)??n[0]}function DT(e,t){return Pw[e].some(s=>s.id===t)?t:Vi}Jv("done",Vi).notes,Jv("needs-input",Vi).notes;const B1=.04,$D=.24,FT=0,$w=100,ew=5,fl=50;function hl(e){if(!Number.isFinite(e))return fl;const t=Math.round(e/ew)*ew;return Math.min($w,Math.max(FT,t))}function LD(e){if(e==null)return fl;const t=e.trim();return/^-?\d+(\.\d+)?$/.test(t)?hl(Number(t)):fl}function qD(e){const t=hl(e),n=B1+($D-B1)*(t/$w);return Math.round(n*1e4)/1e4}function DD(e,t){const n=t.trim,s=typeof n=="number"&&Number.isFinite(n)&&n>0&&n<=1?n:1;return Math.round(qD(e)*s*1e4)/1e4}const FD=160,zD="agent-dag.soundLevel.done",BD="agent-dag.soundLevel.needs-input",UD="agent-dag.soundFigure.done",WD="agent-dag.soundFigure.needs-input",zT={done:zD,"needs-input":BD},BT={done:UD,"needs-input":WD},tw={done:{level:fl,figure:Vi},"needs-input":{level:fl,figure:Vi}};function HD(e){const t=n=>({level:LD(e(zT[n])),figure:DT(n,e(BT[n]))});return{done:t("done"),"needs-input":t("needs-input")}}const GD={Stop:"done",Notification:"needs-input"};function VD(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:GD[n]??null}function YD(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))??tw)[h]??tw[h],g=Jv(h,f.figure),v=DD(f.level,g),w=n.currentTime;for(const b of g.notes){const k=n.createOscillator(),S=n.createGain();k.type=g.type??"sine",k.frequency.value=b.hz;const E=w+b.at,C=E+b.ms/1e3;S.gain.setValueAtTime(1e-4,E),S.gain.exponentialRampToValueAtTime(v,E+.012),S.gain.exponentialRampToValueAtTime(1e-4,C),k.connect(S).connect(n.destination),k.start(E),k.stop(C+.02)}return!0}return{unlock:l,play:u,state:i,get context(){return n}}}const U1={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 XD({onClose:e,soundOn:t,onToggleSound:n,prefs:s,onLevel:i,onFigure:a,onPreview:l,openerRef:u}){const h=kn(e),p=_.useRef(e);return p.current=e,_.useEffect(()=>{const f=g=>{var w,N;const v=g.target;v&&((w=h.current)!=null&&w.contains(v)||(N=u.current)!=null&&N.contains(v)||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"})]}),ID.map(f=>{const g=s[f],v=`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:U1[f]}),d.jsxs("button",{type:"button",className:"btn sm-hear",onClick:()=>l(f),"aria-label":`Hear the ${U1[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:v,children:"Volume"}),d.jsx("input",{id:v,type:"range",min:FT,max:$w,step:ew,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:Pw[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 QD={"//":["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.7.1":[{title:"🔔 The notifications now fire on the thing that actually stops your agent",body:`3.7.0 could tell you a session was waiting — but only when Claude Code asked permission to run a tool. If you work with permissions bypassed, that never happens, and the whole feature was silent for you. Measured on one real log: 1683 events, every one of them in bypassPermissions, and a single permission prompt in the entire history.
73
+ Press H for the totals ccusage reads off the logs on disk, which do not forget.`,_T="session spend";function Ow({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}: ${Je(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 gq({state:e,sessionId:t,onClose:n}){const s=_.useMemo(()=>yq(e,t),[e,t]),i=_.useRef(null),a=_n(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:_T}),d.jsx("div",{className:"ss-cost",children:Je(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":Uu(l),title:l,children:Ls(l)},l))})]}),d.jsx("div",{className:"ss-hero-right",children:s.cost.total>0&&d.jsxs(d.Fragment,{children:[d.jsx(Ow,{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:Je(s.cost.input)})]}),d.jsxs("span",{className:"ssl ssl-out",children:["output ",d.jsx("b",{children:Je(s.cost.output)})]}),d.jsxs("span",{className:"ssl ssl-cr",children:["cache r ",d.jsx("b",{children:Je(s.cost.cacheRead)})]}),d.jsxs("span",{className:"ssl ssl-cw",children:["cache w ",d.jsx("b",{children:Je(s.cost.cacheWrite)})]})]})]})})]}),d.jsxs("section",{className:"ss-stats",children:[d.jsx(ji,{label:"agents",value:s.agentCount}),d.jsx(ji,{label:"subagents",value:s.subagentCount}),d.jsx(ji,{label:"tool calls",value:s.toolCount}),d.jsx(ji,{label:"prompts",value:s.promptCount}),d.jsx(ji,{label:"tokens",value:s.tokensSum.toLocaleString()}),s.errCount>0&&d.jsx(ji,{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 ji({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 yq(e,t){const n=e.agents.get(t);if(!n)return null;const s=[];for(const C of e.agents.values())C.sessionId===t&&s.push(C);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,v,w=1/0,N=0;for(const C of s){const j=bn(C);i.input+=j.input,i.output+=j.output,i.cacheRead+=j.cacheRead,i.cacheWrite+=j.cacheWrite,i.total+=j.total;for(const I of uT(C))a.add(I);C.model&&a.add(C.model),C.kind==="subagent"&&g++,h+=C.prompts.length,!v&&C.prompts.length>0&&(v=C.prompts[0].text),p+=C.usage.inputTokens+C.usage.outputTokens,u+=C.toolCount,w=Math.min(w,C.startedAt),N=Math.max(N,C.endedAt??Date.now());for(const I of C.tools)l.set(I.name,(l.get(I.name)??0)+1),I.ok===!1&&f++}const b=Math.max(0,N-w),k=Math.floor(b/1e3),S=k<60?`${k}s`:k<3600?`${Math.floor(k/60)}m ${String(k%60).padStart(2,"0")}s`:`${Math.floor(k/3600)}h ${Math.floor(k%3600/60)}m`,E=Array.from(l.entries()).sort((C,j)=>j[1]-C[1]).slice(0,5);return{sessionId:t,label:n.label||n.cwdBasename||"session",cwd:n.cwd,durationLabel:S,cost:i,modelChips:Array.from(a),agentCount:s.length,subagentCount:g,toolCount:u,promptCount:h,tokensSum:p,errCount:f,topTools:E,firstPrompt:v}}function S1(e){return e.waiting?Ml(e.waiting)?0:1:e.state==="active"?2:3}function vq(e,t){const n=[];for(const s of e.agents.values()){if(s.kind!=="root")continue;let i=s.toolCount,a=bn(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+=bn(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=S1(s),l=S1(i);return a!==l?a-l:s.waiting&&i.waiting?s.waiting.since-i.waiting.since:i.lastActivity-s.lastActivity}),n}function N1(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 wq({state:e,now:t,selectedIds:n,onSelect:s,onClose:i}){const a=_.useMemo(()=>vq(e),[e,e.revision,t]),l=a.filter(h=>h.state==="active").length,u=a.filter(h=>Ml(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:Au(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":Uu(h.modelId),title:h.modelId,children:Ls(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:_T,children:d.jsx("b",{children:Je(h.cost)})}),h.waiting?d.jsxs("span",{className:"sl-waiting",title:[vl(h.waiting),y3(h.waiting,vl(h.waiting)),`Blocked since ${new Date(h.waiting.since).toLocaleTimeString()} · started ${new Date(h.startedAt).toLocaleString()}`].filter(Boolean).join(`
74
+ `),children:["waiting ",N1(h.waiting.since,void 0,t),h.waiting.tool&&d.jsxs("span",{className:"sl-waiting-tool",children:[" · ",h.waiting.tool.name]})]}):d.jsx("span",{className:"sl-elapsed",title:`Started ${new Date(h.startedAt).toLocaleString()}`,children:N1(h.startedAt,h.state==="active"?void 0:h.lastActivity,t)})]})]})]},h.sessionId)})]})]})}const xq=e=>1-Math.pow(1-e,5),ST=420;function bq(e,t){if(!Number.isFinite(e)||!Number.isFinite(t)||e===t)return!1;const n=Math.abs(t-e);if(n<1)return!1;const s=Math.max(Math.abs(e),Math.abs(t));return s===0||n/s>=.005}function kq(e,t,n,s=ST){return n>=s?t:n<=0?e:e+(t-e)*xq(n/s)}function _q(e,t,n,s={}){const i=s.now??(()=>performance.now()),a=s.raf??(w=>requestAnimationFrame(w)),l=s.cancel??(w=>cancelAnimationFrame(w)),u=s.reducedMotion??(()=>typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches),h=s.hidden??(()=>typeof document=="object"&&document.hidden===!0);if(u()||h()||!bq(e,t))return n(t),()=>{};const p=i();let f=0,g=!0;const v=()=>{if(!g)return;const w=i()-p;n(kq(e,t,w)),w<ST&&(f=a(v))};return f=a(v),()=>{g=!1,f&&l(f)}}const Yv={cost:0,inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0,sessions:0};function E1(e,t){const n=new Map;for(const s of e){if(s.kind!=="root"||!s.sessionId)continue;const i=bn(s,t);n.set(s.sessionId,{cost:i.total,inputTokens:s.usage.inputTokens,outputTokens:s.usage.outputTokens,cacheReadTokens:s.usage.cacheReadTokens,cacheCreateTokens:s.usage.cacheCreateTokens})}return n}function Sq(e,t){if(!e)return Yv;const n={...Yv};for(const[s,i]of t){const a=e.get(s);if(!a)continue;const l={cost:i.cost-a.cost,inputTokens:i.inputTokens-a.inputTokens,outputTokens:i.outputTokens-a.outputTokens,cacheReadTokens:i.cacheReadTokens-a.cacheReadTokens,cacheCreateTokens:i.cacheCreateTokens-a.cacheCreateTokens};l.cost<0||l.inputTokens<0||l.outputTokens<0||l.cost===0&&l.inputTokens===0&&l.outputTokens===0&&l.cacheReadTokens===0&&l.cacheCreateTokens===0||(n.cost+=l.cost,n.inputTokens+=Math.max(0,l.inputTokens),n.outputTokens+=Math.max(0,l.outputTokens),n.cacheReadTokens+=Math.max(0,l.cacheReadTokens),n.cacheCreateTokens+=Math.max(0,l.cacheCreateTokens),n.sessions+=1)}return n}function Kv(e,t=new Date){return new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate()-(e-1))).toISOString().slice(0,10).replace(/-/g,"")}const NT=[{key:"today",label:"today",noun:"today"},{key:"month",label:"month",noun:"this month"},{key:"all",label:"all",noun:"all time"}];function Nq(e,t=new Date){return e==="today"?Kv(1,t):e==="month"?Kv(t.getDate(),t):"20200101"}const xn=e=>typeof e=="number"&&Number.isFinite(e)?e:0,vu=e=>typeof e=="string"?e:"";function ET(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=vu(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+=xn(a==null?void 0:a.cost),u.inputTokens+=xn(a==null?void 0:a.inputTokens),u.outputTokens+=xn(a==null?void 0:a.outputTokens),u.cacheReadTokens+=xn(a==null?void 0:a.cacheReadTokens),u.cacheCreateTokens+=xn(a==null?void 0:a.cacheCreationTokens)}}return[...n.values()].sort((s,i)=>i.cost-s.cost||i.tokens-s.tokens)}function Eq(e,t=new Map){const n=Array.isArray(e==null?void 0:e.sessions)?e.sessions:[],s=[];for(const i of n){const a=vu(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:vu(i==null?void 0:i.agent)||"claude",cost:xn(i==null?void 0:i.totalCost),tokens:xn(i==null?void 0:i.totalTokens),models:Array.isArray(i==null?void 0:i.modelsUsed)?i.modelsUsed.map(vu).filter(Boolean):[],lastActivityMs:Number.isFinite(u)?u:null})}return s.sort((i,a)=>a.cost-i.cost||a.tokens-i.tokens)}function CT(e){const t=e==null?void 0:e.totals;if(t&&typeof t=="object"){const h=xn(t.cacheReadTokens),p=xn(t.cacheCreationTokens),f=xn(t.inputTokens),g=xn(t.outputTokens);return{cost:xn(t.totalCost),inputTokens:f,outputTokens:g,cacheReadTokens:h,cacheCreateTokens:p,tokens:xn(t.totalTokens)||f+g+h+p}}const n=ET(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}}function Cq(e,t){return{data:(e==null?void 0:e.data)??null,shown:(e==null?void 0:e.period)??null,stale:e!=null&&e.period!==t}}function jq(e,t){var n;return((n=NT.find(s=>s.key===(e??t)))==null?void 0:n.noun)??"today"}function Tq(e,t,n){const s=e!=null,i=CT(e);return{fromRange:s,cost:s?i.cost+n.cost:t.cost.total,inputTokens:s?i.inputTokens+n.inputTokens:t.inputTokens,outputTokens:s?i.outputTokens+n.outputTokens:t.outputTokens,cacheReadTokens:s?i.cacheReadTokens+n.cacheReadTokens:t.cacheReadTokens,cacheCreateTokens:s?i.cacheCreateTokens+n.cacheCreateTokens:t.cacheCreateTokens,hasCost:s?i.cost>0:t.cost.total>0,tokenSum:s?i.tokens:t.sum,showCostBar:!s}}const Bt="ccdeck";function jT(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 Xv(e){return jT(Math.floor(e/1e3))}function TT(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 Rq(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function Aq(e,t,n){const s=new Date(e),i=Xv(t-e);return{label:Rq(s,new Date(t))?i:`${i} · ${s.toLocaleDateString(n,{month:"short",day:"numeric"})}`,title:s.toLocaleString(n,{dateStyle:"medium",timeStyle:"medium"})}}function RT(e,t){return{disabled:e!=null&&e!==t,busy:e===t}}function AT(e){return e==null}const Qv="self";function ir(e,t=!1){const n=RT(e?Qv:null,Qv);return{disabled:t||n.disabled,"aria-busy":n.busy}}function ar(e){return AT(e?Qv:null)}function Mq(e){return[...e==null?[]:[`#ap-more-${e}`],".accounts-panel .ap-refresh"]}function Iq(e){return e==null||e==="BODY"||e==="HTML"}function C1(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 Oq(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 rh="__unknown__";function Pq(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 v=Math.floor(f/3600),w=Math.floor(f%3600/60);g.runsOutIn=v>0?`${v}h ${w}m`:`${w}m`}return g}return{label:`${Math.round(-u)}% reserve`,color:"var(--ok)",expectedPct:l,isDeficit:!1}}function mo({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,v=s?TT(s,l):null,w=s&&i?Pq(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:[v?d.jsxs("span",{className:"qb-reset",children:["resets in ",v]}):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 $q=6e4;function Lq(e){const[t,n]=_.useState(null),[s,i]=_.useState(!1),a=_.useRef(null),l=_.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 _.useEffect(()=>{if(e)return u(!0),a.current=window.setInterval(()=>u(!1),$q),()=>{a.current!=null&&window.clearInterval(a.current)}},[e]),{quota:t,loading:s,refresh:()=>{e&&u(!0)}}}function qq(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 Dq(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 MT=6e4,j1=6e4;function Fq(e){const[t,n]=_.useState(null),[s,i]=_.useState(!1),a=_.useRef(null),l=_.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 _.useEffect(()=>{if(e)return u(!0),a.current=window.setInterval(()=>u(!1),MT),()=>{a.current!=null&&window.clearInterval(a.current)}},[e]),{data:t,loading:s,refresh:()=>{e&&u(!0)}}}function zq(e){const[t,n]=_.useState(null),s=_.useRef(null),i=async()=>{try{const a=await fetch("/api/codex-usage");a.ok&&n(await a.json())}catch{}};return _.useEffect(()=>{if(e)return i(),s.current=window.setInterval(i,MT),()=>{s.current!=null&&window.clearInterval(s.current)}},[e]),{data:t}}function Bq(e,t){const[n,s]=_.useState(null),[i,a]=_.useState(!1),[l,u]=_.useState(0),h=_.useRef(0);_.useEffect(()=>{const f=()=>document.visibilityState==="visible",g=()=>{f()&&u(N=>N+1)},v=window.setInterval(g,j1),w=()=>{f()&&Date.now()-h.current>=j1&&u(N=>N+1)};return document.addEventListener("visibilitychange",w),()=>{window.clearInterval(v),document.removeEventListener("visibilitychange",w)}},[]);const p=_.useRef(t);return _.useEffect(()=>{let f=!0;const g=t!==p.current;p.current=t;const v=e,w=Nq(v);return a(!0),fetch(`/api/ccusage?since=${w}${g?"&refresh=1":""}`).then(N=>N.ok?N.json():null).then(N=>{f&&(N!=null&&N.ok)&&(h.current=Date.now(),s({period:v,data:N}))}).catch(()=>{}).finally(()=>{f&&a(!1)}),()=>{f=!1}},[e,t,l]),{...Cq(n,e),loading:i}}function Ja(e){const[t,n]=_.useState(e),s=_.useRef(e),i=_.useRef(!0);return _.useEffect(()=>{s.current=t},[t]),_.useEffect(()=>{if(i.current){i.current=!1,s.current=e,n(e);return}return _q(s.current,e,l=>{s.current=l,n(l)})},[e]),t}function Uq({state:e,now:t,providers:n,onClose:s}){var be,ue;const{quota:i,loading:a,refresh:l}=Lq(n.claude),{data:u,loading:h,refresh:p}=Fq(n.codex),{data:f}=zq(n.codex),[g,v]=_.useState(()=>Math.floor(Date.now()/1e3));_.useEffect(()=>{const re=window.setInterval(()=>v(Math.floor(Date.now()/1e3)),3e4);return()=>window.clearInterval(re)},[]);const{byModel:w,totalCost:N,totalTokens:b,burnRate:k}=_.useMemo(()=>{const re=new Map;for(const Pe of e.agents.values())for(const Ue of Al(Pe)){const Ge=Ue.model??rh,it=Tw(Ue.usage,Ue.model),ke=re.get(Ge);ke?(ke.inputTokens+=Ue.usage.inputTokens,ke.outputTokens+=Ue.usage.outputTokens,ke.cacheReadTokens+=Ue.usage.cacheReadTokens,ke.cacheCreateTokens+=Ue.usage.cacheCreateTokens,ke.cost.total+=it.total,ke.cost.input+=it.input,ke.cost.output+=it.output,ke.cost.cacheRead+=it.cacheRead,ke.cost.cacheWrite+=it.cacheWrite,ke.agentCount++):re.set(Ge,{model:Ge,inputTokens:Ue.usage.inputTokens,outputTokens:Ue.usage.outputTokens,cacheReadTokens:Ue.usage.cacheReadTokens,cacheCreateTokens:Ue.usage.cacheCreateTokens,cost:{...it},agentCount:1,priced:Xi(Ue.model)!=null})}const pe=Array.from(re.values()).sort((Pe,Ue)=>Ue.cost.total-Pe.cost.total||Ue.inputTokens+Ue.outputTokens-(Pe.inputTokens+Pe.outputTokens));let Oe=0,nt=0;for(const Pe of e.agents.values()){if(Pe.state!=="active")continue;const Ue=bn(Pe);Oe+=Ue.total,nt=Math.max(nt,((Pe.endedAt??t)-Pe.startedAt)/1e3)}const st=nt>0?Rw(Oe,nt):null,Xe=hq(e.agents.values());return{byModel:pe,totalCost:Xe.cost,totalTokens:Xe,burnRate:st}},[e,e.revision,t]),S=_.useMemo(()=>{const re=[];for(const pe of e.agents.values()){if(pe.kind!=="root")continue;let Oe=bn(pe).total,nt=pe.usage.inputTokens,st=pe.usage.outputTokens,Xe=Hv(pe);for(const Pe of e.agents.values())Pe.sessionId!==pe.sessionId||Pe.kind==="root"||(Oe+=bn(Pe).total,nt+=Pe.usage.inputTokens,st+=Pe.usage.outputTokens,Xe+=Hv(Pe));re.push({sessionId:pe.sessionId,label:pe.label||pe.cwdBasename||"session",state:pe.state,cost:Oe,inputTokens:nt,outputTokens:st,unpricedTokens:Xe})}return re.sort((pe,Oe)=>Oe.cost-pe.cost||Oe.inputTokens+Oe.outputTokens-(pe.inputTokens+pe.outputTokens)).slice(0,12)},[e,e.revision]),[E,C]=_.useState("today"),[j,I]=_.useState(0),{data:O,shown:P,stale:z}=Bq(E,j),M=O!=null,A=_.useMemo(()=>{const re=new Map;for(const pe of e.agents.values()){if(pe.kind!=="root"||!pe.sessionId)continue;const Oe=pe.label||pe.cwdBasename;Oe&&re.set(pe.sessionId,Oe)}return re},[e,e.revision]),q=_.useMemo(()=>{const re=new Map;for(const pe of e.agents.values())pe.kind!=="root"||!pe.sessionId||re.set(pe.sessionId,pe.state);return re},[e,e.revision]),G=_.useMemo(()=>M?ET(O):[],[O,M]),Y=_.useMemo(()=>{if(!M)return[];const re=Eq(O,A).slice(0,12),pe=new Map;for(const Oe of re)Oe.label&&pe.set(Oe.label,(pe.get(Oe.label)??0)+1);return re.map(Oe=>Oe.label&&(pe.get(Oe.label)??0)>1?{...Oe,label:`${Oe.label} ${Oe.sessionId.slice(0,4)}`}:Oe)},[O,M,A]),R=_.useMemo(()=>CT(O),[O]),Q=jq(P,E),H=z?" up-stale":"",ne=_.useRef(null);_.useEffect(()=>{ne.current=O?E1(e.agents.values(),t):null},[O]);const X=_.useMemo(()=>M?Sq(ne.current,E1(e.agents.values(),t)):Yv,[e,e.revision,O,M,t]),U=Tq(O,{...b,cost:N},X),J=U.hasCost,$=U.tokenSum,V=Ja(U.cost),Z=Ja(U.inputTokens),D=Ja(U.outputTokens),L=Ja(U.cacheReadTokens),K=Ja(U.cacheCreateTokens),se=w.filter(re=>re.cost.total>0||re.inputTokens+re.outputTokens>0),he=S.filter(re=>re.cost>0||re.inputTokens+re.outputTokens>0),me=M?G.some(re=>re.cost<=0&&re.tokens>0):se.some(re=>!re.priced),xe=a||h,Ee=C1(i==null?void 0:i.fetchedAt,g),He=C1(u==null?void 0:u.fetchedAt,g),Fe=()=>{l(),p(),I(re=>re+1)},Ie=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"}),k&&d.jsx("span",{className:"up-rate",children:k}),d.jsxs("div",{className:"up-header-right",children:[(n.claude||n.codex)&&d.jsx("button",{type:"button",className:"glyph-btn up-refresh-btn",onClick:Fe,...ir(xe),"aria-label":Ie,title:Ie,children:xe?"…":"↻"}),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",Ee&&!a&&d.jsx("span",{className:"up-section-age",title:Oq(i==null?void 0:i.source),children:Ee})]}),i!=null&&i.ok?d.jsxs("div",{className:"up-quota-bars",children:[i.session5hPct!=null&&d.jsx(mo,{label:"5-hour window",pct:i.session5hPct,reset:i.session5hReset,resetAt:i.session5hResetAt,windowSec:i.session5hWindowSec,nowSec:g}),i.week7dPct!=null&&d.jsx(mo,{label:"7-day window",pct:i.week7dPct,reset:i.week7dReset,resetAt:i.week7dResetAt,windowSec:i.week7dWindowSec,nowSec:g}),i.weekSonnetPct!=null&&d.jsx(mo,{label:"Sonnet (7d)",pct:i.weekSonnetPct,nowSec:g}),i.weekOpusPct!=null&&d.jsx(mo,{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:qq(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}),He&&!h&&d.jsx("span",{className:"up-section-age",title:"Fetched from the Codex usage endpoint",children:He})]}),u!=null&&u.ok?d.jsxs("div",{className:"up-quota-bars",children:[(be=u.windows)==null?void 0:be.map(re=>d.jsx(mo,{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)),(ue=u.extraWindows)==null?void 0:ue.map(re=>d.jsx(mo,{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(mo,{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 — ${Bt} 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:Dq(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?`
75
+ last 5h: ${Rt(f.window5h.totalTokens)} tokens · ${f.window5h.sessionCount} session${f.window5h.sessionCount!==1?"s":""}`:""}`,children:[Rt(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:NT.map(re=>d.jsx("button",{type:"button","aria-pressed":E===re.key,className:"uh-range-btn",onClick:()=>C(re.key),children:re.label},re.key))}),$>0?d.jsxs(d.Fragment,{children:[J&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:`up-total${H}`,title:M?void 0:_1,children:[d.jsx("span",{className:"up-total-value",children:Je(V)}),d.jsx("span",{className:"up-total-label",children:M?Q:pq})]}),U.showCostBar&&d.jsx(Ow,{cost:N})]}),d.jsxs("div",{className:`up-tokens-row${H}`,title:M?void 0:_1,children:[d.jsxs("span",{className:"up-tok",children:[d.jsx("span",{className:"up-k",children:"in"}),Rt(Z)]}),d.jsxs("span",{className:"up-tok",children:[d.jsx("span",{className:"up-k",children:"out"}),Rt(D)]}),U.cacheReadTokens>0&&d.jsxs("span",{className:"up-tok",children:[d.jsx("span",{className:"up-k",children:"cache r"}),Rt(L)]}),U.cacheCreateTokens>0&&d.jsxs("span",{className:"up-tok",children:[d.jsx("span",{className:"up-k",children:"cache c"}),Rt(K)]}),!J&&d.jsx("span",{className:"up-tok up-scope",children:mq})]}),(M?G.length:se.length)>0&&d.jsxs("section",{className:`up-section${H}`,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?G.map(re=>d.jsxs("tr",{children:[d.jsx("td",{className:"up-model-name",title:re.model,children:Ls(re.model)}),d.jsx("td",{className:"up-num",children:Rt(re.tokens)}),re.cost>0?d.jsx("td",{className:"up-num up-cost-val",children:Je(re.cost)}):d.jsx("td",{className:"up-num up-unpriced",children:Ai})]},re.model)):se.map(re=>d.jsxs("tr",{children:[d.jsx("td",{className:"up-model-name",title:re.model===rh?"no model reported yet":re.model,children:re.model===rh?"unknown":Ls(re.model)}),d.jsx("td",{className:"up-num",children:Rt(re.inputTokens+re.outputTokens)}),re.priced?d.jsx("td",{className:"up-num up-cost-val",children:Je(re.cost.total)}):d.jsx("td",{className:"up-num up-unpriced",children:Ai})]},re.model))})]})]}),M&&Y.length===0&&R.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 ",Q," yet — ccusage dates sessions in UTC, and the totals above are your local day."]})]}),(M?Y.length:he.length)>0&&d.jsxs("section",{className:`up-section${H}`,children:[d.jsxs("h3",{className:"up-section-title",children:["By session",M&&d.jsxs("span",{className:"up-section-age",title:`Sessions with activity ${Q}, each showing what that session has cost since it started.
76
+ 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 ",Q]})]}),d.jsxs("div",{className:"up-sessions",children:[M&&Y.map(re=>{const pe=q.get(re.sessionId);return d.jsxs("div",{className:"up-session-row",children:[pe?d.jsxs(d.Fragment,{children:[d.jsx("span",{className:`sl-dot state-${pe}`,"aria-hidden":!0}),d.jsx("span",{className:"vis-hidden",children:Au(pe)})]}):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}
77
+ ${re.sessionId}`:re.sessionId,children:re.label??re.sessionId.slice(0,8)}),d.jsx("span",{className:"up-session-tokens",children:Rt(re.tokens)}),re.cost>0?d.jsx("span",{className:"up-session-cost",title:re.models.join(", ")||void 0,children:Je(re.cost)}):d.jsx("span",{className:"up-session-cost up-unpriced",children:Ai})]},re.sessionId)}),!M&&he.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:Au(re.state)}),d.jsx("span",{className:"up-session-label",children:re.label}),d.jsx("span",{className:"up-session-tokens",children:Rt(re.inputTokens+re.outputTokens)}),re.cost>0?d.jsxs("span",{className:"up-session-cost",title:re.unpricedTokens>0?`${Rt(re.unpricedTokens)} tokens in this session are on an unpriced model, so this is a floor`:void 0,children:[Je(re.cost),re.unpricedTokens>0?"+":""]}):d.jsx("span",{className:"up-session-cost up-unpriced",children:Ai})]},re.sessionId))]})]}),me&&d.jsxs("div",{className:"up-hint",children:["“",Ai,"” 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 ",Q,".",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 Wq="1",T1="agent-dag.schema",Hq=["agent-dag.layout","agent-dag.viewport"];function Hu(e){if(typeof window>"u")return null;try{return window.localStorage.getItem(e)}catch{return null}}function Gq(e,t=Wq){let n=null;try{n=e.getItem(T1)}catch{return[]}if(n===t)return[];const s=[];if(n!==null)for(const i of Hq)try{e.getItem(i)!==null&&(e.removeItem(i),s.push(i))}catch{}try{e.setItem(T1,t)}catch{}return s}const yt={l:30,r:6,t:6,b:2},Gu=104,Vq=64;function yo(e,t=100,n=Gu){const s=n-yt.t-yt.b;return yt.t+s*(1-Math.max(0,Math.min(t,e))/t)}function Yq(e,t,n,s=100,i=Gu){if(!e.length)return"";const a=e[e.length-1].t-e[0].t,l=p=>{const f=t-yt.l-yt.r;return yt.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)} ${yo(p.v,s,i).toFixed(1)}`,h=p}return u}function Kq(e,t,n,s=100,i=Gu){if(e.length<2)return"";const a=i-yt.b,l=e[e.length-1].t-e[0].t,u=t-yt.l-yt.r,h=v=>yt.l+(l>0?u*(v-e[0].t)/l:u/2);let p="",f=[];const g=()=>{if(f.length>=2){let v=`M${h(f[0].t).toFixed(1)} ${a}`;for(const w of f)v+=`L${h(w.t).toFixed(1)} ${yo(w.v,s,i).toFixed(1)}`;p+=`${v}L${h(f[f.length-1].t).toFixed(1)} ${a}Z`}f=[]};for(const v of e)f.length&&v.t-f[f.length-1].t>n*2&&g(),f.push(v);return g(),p}function Xq(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 Qq(e,t,n){return n!=null&&e>=n?"hot":t!=null&&e>=t?"warn":""}function Zq(e,t,n=s=>cl(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 cl(e){const t=new Date(e);return`${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}`}function IT(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=_n(n),[i,a]=_.useState(null);_.useEffect(()=>{let p=!0;const f=async()=>{try{const v=await fetch(`/api/system/history?group=${e}`);if(!v.ok)return;const w=await v.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]=_.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 mw.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 ",cl(u)," · ",IT(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(e4,{series:p,stepMs:i.stepMs},p.label))})]})}),document.body)}function e4({series:e,stepMs:t}){const n=_.useRef(null),[s,i]=_.useState(560),[a,l]=_.useState(null);_.useEffect(()=>{const P=n.current;if(!P||typeof ResizeObserver>"u")return;const z=new ResizeObserver(([M])=>i(Math.max(160,M.contentRect.width)));return z.observe(P),()=>z.disconnect()},[]);const{points:u,unit:h,warnAt:p,critAt:f,label:g,top:v,restsAtZero:w}=e,N=w?Vq:Gu,{now:b,peak:k}=Xq(u),S=h==="C"?"°C":h,E=g==="Throttling"?Zq(u,t):null,C=a!=null?u[a]:null,j=u.length>1?u[u.length-1].t-u[0].t:0,I=P=>{const z=s-yt.l-yt.r;return yt.l+(j>0?z*(P-u[0].t)/j:z/2)},O=P=>{if(u.length<2)return;const z=P.currentTarget.getBoundingClientRect(),M=(P.clientX-z.left-yt.l)/Math.max(1,z.width-yt.l-yt.r),A=u[0].t+j*Math.max(0,Math.min(1,M));let q=0;for(let G=1;G<u.length;G++)Math.abs(u[G].t-A)<Math.abs(u[q].t-A)&&(q=G);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:[S," now"]})]}),k!=null&&d.jsxs(d.Fragment,{children:[d.jsx("b",{className:Qq(k,p,f),children:k}),d.jsxs("span",{children:[S," 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}${S} now, peak ${k}${S}, over ${IT(u[0].t,u[u.length-1].t)}`,onPointerMove:O,onPointerLeave:()=>l(null),children:[[["warn",p],["hot",f]].map(([P,z])=>z==null||z>v?null:d.jsxs("g",{children:[d.jsx("line",{className:`hist-rule ${P}`,x1:yt.l,x2:s-yt.r,y1:yo(z,v,N),y2:yo(z,v,N)}),d.jsx("text",{className:`hist-rule-tag ${P}`,x:2,y:yo(z,v,N)+3,children:z})]},P)),d.jsx("line",{className:"hist-floor",x1:yt.l,x2:s-yt.r,y1:N-yt.b,y2:N-yt.b}),d.jsx("path",{className:"hist-area",d:Kq(u,s,t,v,N)}),d.jsx("path",{className:"hist-line",d:Yq(u,s,t,v,N)}),u.length===1&&d.jsx("circle",{className:"hist-dot",cx:I(u[0].t),cy:yo(u[0].v,v,N),r:3}),C&&d.jsxs("g",{children:[d.jsx("line",{className:"hist-cross",x1:I(C.t),x2:I(C.t),y1:yt.t,y2:N-yt.b}),d.jsx("circle",{className:"hist-dot",cx:I(C.t),cy:yo(C.v,v,N),r:3})]})]})}),d.jsx("div",{className:"hist-axis",children:C?d.jsxs("span",{className:"hist-at",children:[cl(C.t)," — ",d.jsx("b",{children:C.v}),S]}):d.jsxs(d.Fragment,{children:[d.jsx("span",{children:u.length?cl(u[0].t):""}),d.jsx("span",{children:u.length?cl(u[u.length-1].t):""})]})}),E&&d.jsx("div",{className:"hist-note",children:E})]})}function t4({procs:e,total:t,onClose:n}){const s=_n(n),[i,a]=_.useState(OT),l=Zv(e,i);return mw.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(Di,{col:"cpu",label:"cpu",sort:i,onSort:a}),d.jsx(Di,{col:"mem",label:"mem",sort:i,onSort:a}),d.jsx("th",{scope:"col",className:"pl-pid-h",children:"pid"}),d.jsx(Di,{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 n4=3e3,r4=4e3,sh=20,el=36,Ti=8,s4=8,OT={key:"cpu",dir:"desc",rank:"cpu"};function o4(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 Zv(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 i4(e,t,n=s4){const s=Zv(e,{key:t.rank,dir:"desc",rank:t.rank});return Zv(s.slice(0,n),t)}function a4(e,t){return e.key!==t?"none":e.dir==="asc"?"ascending":"descending"}function l4(e,t,n){return e>=n?"hot":e>=t?"warn":"calm"}function c4(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}% ${u4(t.lastMs,n)}`:"running at full speed, and never held back"}}function u4(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 PT="agent-dag.systemPanelOpen";function d4(){return Hu(PT)==="1"}function f4(e){if(!(typeof window>"u"))try{window.localStorage.setItem(PT,e?"1":"0")}catch{}}function vo(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 h4(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 p4(){const[e,t]=_.useState(null),n=_.useRef(null);return _.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,n4))},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 m4(e){const[t,n]=_.useState(null);return _.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,r4);return()=>{s=!1,window.clearInterval(a)}},[e]),t}function g4({usageOpen:e=!1}){const t=p4(),[n,s]=_.useState(d4);_.useEffect(()=>{f4(n)},[n]);const i=_.useRef(null),a=_.useRef(null);if(_.useEffect(()=>{if(n)return qi.push(()=>{var S,E;const k=((S=a.current)==null?void 0:S.contains(document.activeElement))??!1;s(!1),k&&((E=i.current)==null||E.focus())},mT)},[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:el,height:Ti,viewBox:`0 0 ${el} ${Ti}`}),d.jsx("span",{className:"sm-ram"})]})})});const{cpu:l,cpuHistory:u,cores:h,memory:p,loadavg:f}=t,g=p.usedPct>=90,v=u.slice(-sh),w=sh-v.length,N=el/sh,b=[`CPU ${l.toFixed(0)}% of ${h} cores`,f?`load ${f[0]} · ${f[1]} · ${f[2]} (1m · 5m · 15m)`:null,`Memory ${vo(p.total-p.available)} of ${vo(p.total)} used`,"","Click for detail. This machine, not this session."].filter(k=>k!==null).join(`
78
+ `);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(k=>!k),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:el,height:Ti,viewBox:`0 0 ${el} ${Ti}`,children:v.map((k,S)=>{const E=w+S,C=Math.max(1,k/100*Ti),j=.32+.68*((S+1)/v.length);return d.jsx("rect",{x:E*N,y:Ti-C,width:Math.max(.8,N-.7),height:C,rx:.5,fill:"var(--accent)",opacity:j},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(y4,{sys:t,usageOpen:e,panelRef:a,onClose:()=>{var k;s(!1),(k=i.current)==null||k.focus()}})]})}function y4({sys:e,usageOpen:t,panelRef:n,onClose:s}){const i=m4(!0),{memory:a,swap:l,perCore:u,loadavg:h,cores:p,uptimeSec:f,platform:g,thermal:v}=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 ",h4(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(wu,{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,S)=>d.jsx("span",{className:"sd-core",title:`core ${S+1}: ${k}%`,children:d.jsx("span",{className:"sd-core-fill",style:{transform:`scaleY(${Math.max(2,k)/100})`}})},S))})})}),d.jsx("div",{className:"sd-section",role:"group","aria-label":"Memory",children:d.jsxs(wu,{group:"memory",title:"Memory history",action:"Show memory history",label:"Memory",children:[a&&d.jsx(Mu,{label:"Physical",value:d.jsxs(d.Fragment,{children:[d.jsx("b",{children:vo(w)})," of ",vo(a.total)]}),pct:a.usedPct,tone:a.usedPct>=90?"warn":"calm",note:`${vo(a.available)} available`}),l&&l.total>0&&d.jsx(Mu,{label:N,value:d.jsxs(d.Fragment,{children:[d.jsx("b",{children:vo(l.used)})," of ",vo(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(wu,{group:"load",title:"Load history",action:"Show load history",label:"Load average",children:[d.jsx("div",{className:"sd-load",children:h.map((k,S)=>d.jsxs("span",{className:`sd-load-item${k>p?" over":""}`,children:[d.jsx("b",{children:k.toFixed(2)}),d.jsx("span",{children:["1m","5m","15m"][S]})]},S))}),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(v4,{thermal:v}),d.jsx(w4,{read:i})]})}function wu({group:e,title:t,action:n,label:s,children:i}){const[a,l]=_.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 v4({thermal:e}){if(!e)return null;const t=e.throttle?c4(e.throttle.speedLimit,e.heldBack):null;return d.jsx("div",{className:"sd-section",role:"group","aria-label":"Thermal",children:d.jsxs(wu,{group:"thermal",title:"Thermal history",action:"Show thermal history",label:"Thermal",children:[e.celsius.map(n=>d.jsx(Mu,{label:n.label,value:d.jsxs(d.Fragment,{children:[d.jsx("b",{children:n.celsius})," °C"]}),pct:n.celsius,tone:l4(n.celsius,n.warnAt,n.critAt)},n.label)),t&&d.jsx(Mu,{label:"Throttling",value:t.value,pct:t.pct,tone:t.tone,note:t.note})]})})}function w4({read:e}){const[t,n]=_.useState(OT),[s,i]=_.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(t4,{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(Di,{col:"cpu",label:"cpu",sort:t,onSort:n}),d.jsx(Di,{col:"mem",label:"mem",sort:t,onSort:n}),d.jsx(Di,{col:"name",label:"process",sort:t,onSort:n})]})}),d.jsx("tbody",{children:i4(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 Di({col:e,label:t,sort:n,onSort:s}){const i=a4(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(o4(n,e)),children:[t,d.jsx("span",{className:"sd-sort-dir","aria-hidden":!0,children:i==="none"?"":i==="ascending"?"↑":"↓"})]})})}function Mu({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 R1=18,x4=1100,Ri=(e,t)=>{const n=Math.sin(e*12.9898+t*78.233)*43758.5453;return n-Math.floor(n)},b4=Array.from({length:R1},(e,t)=>{const n=-72+144*t/(R1-1)+(Ri(t,1)-.5)*9,s=(n-90)*(Math.PI/180),i=(54+32*Math.cos(n*Math.PI/180))*(.74+Ri(t,2)*.52);return{dx:Math.cos(s)*i,dy:Math.sin(s)*i,rot:(t%2?1:-1)*(100+Ri(t,3)*260),delay:Math.round(Ri(t,4)*90),dur:760+Math.round(Ri(t,5)*260),scale:.8+Ri(t,6)*.45,hue:t%4,round:t%3===0}});function A1({anchor:e}){var i;const[t,n]=_.useState(null),s=typeof window<"u"&&((i=window.matchMedia)==null?void 0:i.call(window,"(prefers-reduced-motion: reduce)").matches);return _.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),x4);return()=>window.clearTimeout(u)},[e,s]),s||!t?null:mw.createPortal(d.jsx("div",{className:"confetti",style:{left:`${t.x}px`,top:`${t.y}px`},"aria-hidden":!0,children:b4.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 $T=new Set(["awaiting_url","awaiting_code","registering"]);function k4(e){return e!=null&&$T.has(e)}function LT(e){return e!=null&&e!=="done"&&!$T.has(e)}const _4="the sign-in ended before it finished — the deck restarted, or it was cancelled in another tab",S4="the sign-in did not complete";function N4({state:e,serverError:t,localError:n}){const s=e==="idle";return{title:s?"Sign-in ended":"Sign-in failed",message:n||t||(s?_4:S4)}}const E4="done";function C4(){let e=!1;return{shouldAnnounce(t){return t!==E4?(e=!1,!1):e?!1:(e=!0,!0)}}}function Pw(e,t){return t&&Object.hasOwn(e,t)?e[t]:void 0}const j4={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 ${Bt}`,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"},T4={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"},R4=`claude-swap could not read the login keychain — start ${Bt} from a Terminal window rather than a background service`;function Jv(e,t){if((e==null?void 0:e.reason)!=="no_cswap"&&/keychain/i.test(Hi(e)))return R4;const n=Pw(T4,e==null?void 0:e.reason);return n||(e==null?void 0:e.reason)||t}function Hi(e){return((e==null?void 0:e.output)||(e==null?void 0:e.detail)||(e==null?void 0:e.error)||"").trim()}const A4={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"},M4="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 I4(e){return/\bnpx\b/i.test(e)&&/(command not found|not found|not recognized|ENOENT)/i.test(e)}const O4="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",P4="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",$4=e=>/\b(?:ERR_)?MODULE_NOT_FOUND\b|cannot find (?:module|package)/i.test(e),L4=/node_modules[\\/]npm[\\/]bin[\\/]|\bnpm-prefix\.js\b|\bnp[mx][-.][\w.-]*cli\.js\b/i,q4=/[\\/]_npx[\\/]/i,D4=`the copy of ccusage ${Bt} installed for itself`;function F4(e){const t=String((e==null?void 0:e.install)??"").replace(/\s+/g," ").trim();return t.length>240?`${t.slice(0,239)}…`:t}function z4(e,t){const n=B4(e,t),s=F4(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 ${tl(n)}`:`there is no managed copy of ccusage on this machine, and the npx fallback failed: ${tl(n)}`;case"managed":return`${D4} failed to run: ${tl(n)}`;case"path":return e.bin?`the ccusage this deck found at ${e.bin} failed to run: ${tl(n)}`:`the ccusage this deck found on your PATH failed to run: ${tl(n)}`;default:return n}}const tl=e=>/^[A-Z][a-z]/.test(e)?e[0].toLowerCase()+e.slice(1):e;function B4(e,t){const n=Hi(e);if($4(n)){if(q4.test(n))return P4;if(L4.test(n))return O4}if(I4(n))return M4;const s=Pw(A4,e==null?void 0:e.reason);return s||(e==null?void 0:e.reason)||t}function Oi(e,t){if(e!=null&&e.detail)return e.detail;if(e!=null&&e.error&&LT(e.state))return e.error;const n=Pw(j4,e==null?void 0:e.reason);return n||(e!=null&&e.error?e.error:(e==null?void 0:e.reason)||t)}function U4(e,t,n){if(n<=0||Aw(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 qT(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 W4(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 H4(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 G4(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 V4(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 Y4=1500,iu=[{id:"login",label:"Sign in"},{id:"paste",label:"Paste a share"}],M1="aa-panel",I1=e=>`aa-tab-${e}`;async function nl(e){return(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json().catch(()=>null)}const ew=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"})]}));ew.displayName="SuccessMark";function K4({onClose:e,onChanged:t}){const[n,s]=_.useState("login"),[i,a]=_.useState(null),[l,u]=_.useState(""),[h,p]=_.useState(""),[f,g]=_.useState(!1),[v,w]=_.useState(null),[N,b]=_.useState(null),[k,S]=_.useState(null),[E,C]=_.useState(null),j=_.useRef(""),I=_.useRef(!1),O=_.useRef(!1),P=_.useRef(null),z=_.useRef(null),M=_.useRef(null),A=_.useRef(null),q=_.useRef([]),G=_.useRef(!1),Y=_.useCallback(()=>{I.current&&nl({action:"login-cancel"}).catch(()=>{}),e()},[e]),R=_n(Y,{focusRef:M}),Q=_.useCallback(async()=>{if(!ar(O.current))return;O.current=!0,g(!0),w(null),I.current=!0;const L=await nl({action:"login"}).catch(()=>null);if(O.current=!1,g(!1),!(L!=null&&L.ok)){w(Oi(L,"could not start the sign-in"));return}a(L)},[]);_.useEffect(()=>{if(!k4(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{}},Y4);return()=>window.clearInterval(L)},[i]);const H=_.useRef(t);H.current=t;const ne=_.useState(C4)[0];_.useEffect(()=>{var L;(i==null?void 0:i.state)==="awaiting_code"&&((L=P.current)==null||L.focus()),ne.shouldAnnounce(i==null?void 0:i.state)&&H.current()},[i==null?void 0:i.state,ne]),_.useEffect(()=>{var L;n==="paste"&&!G.current&&((L=z.current)==null||L.focus()),G.current=!1},[n]);const X=_.useCallback(L=>{var se;const K=U4(L,iu.findIndex(he=>he.id===n),iu.length);K.kind!=="pass"&&(L.preventDefault(),G.current=!0,s(iu[K.index].id),(se=q.current[K.index])==null||se.focus())},[n]),U=_.useCallback(async()=>{var K;if(!ar(O.current))return;O.current=!0,g(!0),w(null);const L=await nl({action:"login-code",code:l}).catch(()=>null);if(O.current=!1,g(!1),!(L!=null&&L.ok)){w(Oi(L,"the code was not accepted")),L!=null&&L.state&&a(L),(K=P.current)==null||K.select();return}u(""),a(L)},[l,i]),J=_.useCallback(async()=>{if(!ar(O.current))return;O.current=!0,g(!0),w(null);const L=await nl({action:"import",blob:h}).catch(()=>null);if(O.current=!1,g(!1),!(L!=null&&L.ok)){w(Oi(L,"the import failed"));return}j.current=h,p(""),C(null),b(L.results??[]),t()},[h,t]),$=_.useCallback(async L=>{const K=`${L.email}|${L.org??""}`;if(!ar(O.current)||!j.current)return;O.current=!0,g(!0),S(K),C(null);const se=await nl({action:"import",blob:j.current,force:!0,only:{email:L.email,org:L.org??""}}).catch(()=>null);if(O.current=!1,g(!1),S(null),!(se!=null&&se.ok)){C({key:K,text:Oi(se,"that account could not be updated")});return}const he=(se.results??[])[0];he&&b(me=>me&&me.map(xe=>`${xe.email}|${xe.org??""}`===K?he:xe)),t()},[t]),V=(i==null?void 0:i.state)==="done"?i.account:null,Z=LT(i==null?void 0:i.state)||!!(v&&I.current&&!f),D=N4({state:i==null?void 0:i.state,serverError:i==null?void 0:i.error,localError:v});return d.jsx("div",{className:"modal-backdrop",onClick:Y,role:"presentation",children:d.jsxs("div",{ref:R,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:iu.map((L,K)=>d.jsx("button",{type:"button",role:"tab",id:I1(L.id),ref:se=>{q.current[K]=se},"aria-selected":n===L.id,"aria-controls":M1,tabIndex:n===L.id?0:-1,className:`aa-tab${n===L.id?" on":""}`,onClick:()=>{G.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:M1,role:"tabpanel","aria-labelledby":I1(n),children:n==="login"?V?d.jsxs("div",{className:"aa-done",children:[d.jsx(ew,{ref:A}),d.jsx(A1,{anchor:A}),d.jsx("h4",{children:V.added?`Account ${V.num} added`:"Credentials refreshed"}),d.jsxs("p",{className:"aa-note",children:[d.jsx("strong",{children:V.email}),V.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:P,type:"text",value:l,onChange:L=>u(L.target.value),onKeyDown:L=>{L.key==="Enter"&&l.trim()&&!f&&U()},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:U,children:i.state==="registering"?"registering…":"Continue"})]}),(v||i.error)&&d.jsx("p",{className:"aa-err",children:v??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."})]})]}):Z?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),Q()},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:Q,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(ew,{ref:A}),L>0&&d.jsx(A1,{anchor:A}),d.jsx("h4",{children:V4(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:G4(K.state)}),K.state==="present"&&d.jsx("button",{type:"button",className:"aa-result-fix","aria-busy":k===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:k===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:()=>{j.current="",C(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:z,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"})]}),v&&d.jsx("p",{className:"aa-err",children:v}),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 X4(e){return(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json().catch(()=>null)}const Q4=1800;function Z4({accounts:e,onClose:t,copyText:n}){const[s,i]=_.useState([]),[a,l]=_.useState(null),[u,h]=_.useState(!1),[p,f]=_.useState(null),[g,v]=_.useState(!1),[w,N]=_.useState(()=>Math.floor(Date.now()/1e3)),b=_.useRef(null),k=_.useRef(!1),S=_n(t,{focusRef:b});_.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=W4(e),C=e.filter(A=>!s.includes(A.num)).map(A=>A.num),j=C.length===e.length,I=A=>i(q=>q.includes(A)?q.filter(G=>G!==A):[...q,A]),O=_.useCallback(async()=>{if(!ar(k.current)||!C.length)return;k.current=!0,h(!0),f(null),v(!1);const A=await X4({action:"share",accounts:C}).catch(()=>null);if(k.current=!1,h(!1),!(A!=null&&A.ok)){f(Oi(A,"the share could not be made"));return}l({blob:A.blob,expiresAt:A.expiresAt,shared:A.shared??[],failed:A.failed??[]})},[e,C]),P=a?qT(a.expiresAt,w):null,z=(P==null?void 0:P.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:S,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:z?"This share has expired":M===1?"1 account, ready to paste":`${M} accounts, ready to paste`}),d.jsx("code",{className:`ap-share-blob${z?" 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(z){l(null),O();return}await n(a.blob)&&(v(!0),window.setTimeout(()=>v(!1),Q4))},children:z?"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 ${P==null?void 0:P.tone}`,children:P==null?void 0:P.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 G;const q=!!(A.email&&((G=A.detail)!=null&&G.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:z?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),v(!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 ",Bt,"?"]}),d.jsx("p",{className:`sa-count${C.length?"":" empty"}`,children:H4(C.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:C.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(j?e.map(A=>A.num):[]),children:j?"Clear all":"Select all"}),d.jsx("button",{type:"button",className:"btn primary",ref:b,...ir(u,!C.length),onClick:O,children:u?"making the share…":C.length===0?"Share":C.length===1?"Share 1 account":`Share ${C.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 eD(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 tD(e,t,n){return t!=null&&e.some(s=>s.slot===t)?t:n}function nD(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 rD(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 O1(e){return typeof e.id=="string"&&e.id.startsWith("scoped-")}function P1(e){const t=e.filter(u=>!O1(u)),n=e.filter(u=>O1(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 sD(e,t,n){return e<1?null:t?"fewer":n?`${n.label} ${Math.round(n.pct)}%`:`${e} more`}function oD(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 iD="\0";function $w(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}${iD}${n}`}function aD(e,t){const n=$w(t);return e.includes(n)?e.filter(s=>s!==n):[...e,n]}function lD(e,t){if(!Array.isArray(t))return e;const n=new Set(t.map($w)),s=e.filter(i=>n.has(i));return s.length===e.length?e:s}const cD=64;function uD(e,t){const n=e.trim();return{alias:n,commit:n!==(t??"").trim()}}const dD=Object.freeze({text:"couldn't reach the deck server",reload:!0});async function $1(e){return e.ok?{ok:!0,status:e.status,body:null}:{ok:!1,status:e.status,body:await e.json().catch(()=>null)}}function fD(e){const t=e.find(s=>!s.ok);if(!t)return null;const n=Hi(t.body);return{text:Jv(t.body,`the deck server answered ${t.status}`),...n?{raw:n}:{},reload:!0}}function L1(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 q1=15e3,hD=8e3,oh=1800,pD=3e4,mD=[70,80,85,90,95];function D1(e,t){return jT(t-Math.floor(e/1e3))}function gD(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 yD(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 F1({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?TT(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 z1(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 vD({onClose:e}){var Ge,it,ke,ct,It;const[t,n]=_.useState(null),[s,i]=_.useState(null),[a,l]=_.useState(null),[u,h]=_.useState(!1),[p,f]=_.useState(null),[g,v]=_.useState(()=>Math.floor(Date.now()/1e3)),w=_.useRef(null),[N,b]=_.useState(null),[k,S]=_.useState(!1),[E,C]=_.useState(""),[j,I]=_.useState(null),[O,P]=_.useState(null),[z,M]=_.useState(null),[A,q]=_.useState(!1),[G,Y]=_.useState(!1),[R,Q]=_.useState(null),[H,ne]=_.useState(null),[X,U]=_.useState(null),[J,$]=_.useState(null),[V,Z]=_.useState(!1),[D,L]=_.useState([]),K=_.useRef(null),se=_.useCallback(ae=>AT(K.current)?(K.current=ae,l(ae),!0):!1,[]),he=_.useCallback(()=>{K.current=null,l(null)},[]),me=(ae,Le=!1)=>{const ze=RT(a,ae);return{disabled:ze.disabled,"aria-busy":ze.busy||Le}},xe=_.useCallback(ae=>{window.requestAnimationFrame(()=>{var Le;if(Iq(((Le=document.activeElement)==null?void 0:Le.tagName)??null))for(const ze of Mq(ae)){const Ce=document.querySelector(ze);if(Ce){Ce.focus();return}}})},[]),Ee=_.useCallback(async(ae=!1)=>{ae&&h(!0);const Le=new AbortController,ze=window.setTimeout(()=>Le.abort(),pD);try{const[Ce,Ve]=await Promise.all([fetch(`/api/claude-accounts${ae?"?refresh=1":""}`,{signal:Le.signal}),fetch("/api/cswap-auto",{signal:Le.signal})]);if(Ce.ok){const rt=await Ce.json();n(rt),L(Te=>lD(Te,rt.accounts))}Ve.ok&&i(await Ve.json());const Ct=fD([await $1(Ce),await $1(Ve)]);f(rt=>L1(rt,Ct))}catch{f(Ce=>L1(Ce,dD))}finally{window.clearTimeout(ze),ae&&h(!1)}},[]),He=_.useCallback(async(ae,Le)=>{if(!se(Le))return null;f(null);try{const Ce=await(await fetch("/api/cswap-auto",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(ae)})).json().catch(()=>null);return Ce!=null&&Ce.ok||f({text:Jv(Ce,"command failed"),raw:Hi(Ce)}),Ce}catch{return f({text:"server unreachable"}),null}finally{he()}},[se,he]),Fe=_.useCallback(async(ae,Le)=>{if(!se(Le))return null;f(null);try{const Ce=await(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(ae)})).json().catch(()=>null);return Ce!=null&&Ce.ok||f({text:Oi(Ce,"command failed")}),Ce}catch{return f({text:"server unreachable"}),null}finally{he()}},[se,he]);_.useEffect(()=>(Ee(!0),w.current=window.setInterval(()=>Ee(!1),q1),()=>{w.current!=null&&window.clearInterval(w.current)}),[Ee]),_.useEffect(()=>{const ae=window.setInterval(()=>v(Math.floor(Date.now()/1e3)),3e4);return()=>window.clearInterval(ae)},[]);const Ie=((Ge=s==null?void 0:s.settings["autoswitch.threshold"])==null?void 0:Ge.value)??"90",be=J??Ie,ue=rD(be,Ie),re=(it=t==null?void 0:t.accounts)==null?void 0:it.find(ae=>ae.active),pe=((ke=P1((re==null?void 0:re.lanes)??[]).peak)==null?void 0:ke.pct)??null,Oe=pe!=null&&pe>=Number(Ie)-15,nt=async ae=>{if(se(`switch-${ae}`)){f(null);try{const ze=await(await fetch("/api/claude-accounts/switch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({account:ae})})).json().catch(()=>null);ze!=null&&ze.ok||f({text:Jv(ze,"the switch failed"),raw:Hi(ze)}),await Ee(!0)}catch{f({text:"server unreachable"})}finally{he(),xe(ae)}}},st=async(ae,Le)=>{const{commit:ze,alias:Ce}=uD(E,Le);if(ze){const Ve=await Fe({action:"alias",account:ae,alias:Ce},`alias-${ae}`);if(await Ee(!0),!(Ve!=null&&Ve.ok))return;C(Ce)}I(ae),window.setTimeout(()=>I(Ve=>Ve===ae?null:Ve),oh)},Xe=async(ae,Le)=>{const ze=await Fe({action:"move",account:ae,slot:Le},`move-${ae}`),Ce=eD({menuFor:N,shareFor:(z==null?void 0:z.num)??null},ae,ze);if(await Ee(!0),Ce){b(Ce.menuFor),P(Ce.confirmRemove),Ce.shareFor==null&&(M(null),Y(!1)),Q(Ce.swapNote);const Ve=Ce.swapNote;Ve&&window.setTimeout(()=>Q(Ct=>Ct===Ve?null:Ct),hD),ne(null),xe(Ce.menuFor)}return ze},Pe=async(ae,Le,ze)=>{if(ze.sends){const Ce=await Xe(ae,Le);if(!(Ce!=null&&Ce.ok))return}U(ae),window.setTimeout(()=>U(Ce=>Ce===ae?null:Ce),oh)},Ue=async(ae,Le)=>{if(Le.sends){const ze=await He({action:"setting",key:"autoswitch.threshold",value:ae},"threshold");if(await Ee(!0),!(ze!=null&&ze.ok))return;$(null)}Z(!0),window.setTimeout(()=>Z(!1),oh)};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:()=>S(!0),"aria-label":"Add an account",title:"Sign in to another Claude account, or paste one shared from another deck",children:"+"}),(((ct=t==null?void 0:t.accounts)==null?void 0:ct.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 ${Bt} 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:()=>Ee(!0),...me("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 ",q1/1e3," seconds."]}),d.jsx("button",{type:"button",className:"ap-fix",disabled:u,onClick:()=>Ee(!0),children:u?"trying…":"try again"})]}):d.jsx("div",{className:"ap-empty",children:"Checking…"}):t.ok?d.jsxs(d.Fragment,{children:[(It=t.accounts)==null?void 0:It.map(ae=>{const{shown:Le,rest:ze,fuller:Ce,peak:Ve}=P1(ae.lanes),Ct=D.includes($w(ae)),rt=sD(ze.length,Ct,Ce);return d.jsxs("div",{className:`ap-account${ae.active?" active":""}`,children:[d.jsxs("div",{className:"ap-account-head",children:[d.jsx("span",{className:"ap-num",children:ae.num}),ae.alias&&d.jsx("span",{className:"ap-alias",title:ae.alias,children:ae.alias}),d.jsx("span",{className:"ap-email",title:ae.email??void 0,children:ae.email}),d.jsx("button",{type:"button",id:`ap-more-${ae.num}`,className:`ap-more${N===ae.num?" on":""}`,"aria-label":`Manage account ${ae.num}`,"aria-expanded":N===ae.num,"aria-controls":N===ae.num?`ap-manage-${ae.num}`:void 0,title:"Share, rename, move, remove",onClick:()=>{b(N===ae.num?null:ae.num),C(ae.alias??""),P(null),M(null),Y(!1),Q(null),I(null),ne(null),U(null)},children:"⋯"}),ae.active&&d.jsx("span",{className:"ap-badge-active",children:"active"}),ae.disabled&&d.jsx("span",{className:"ap-badge-held",children:"held out"}),!ae.active&&!ae.disabled&&d.jsx("button",{type:"button",className:"ap-manage-btn ap-switch",...me(`switch-${ae.num}`),onClick:()=>nt(ae.num),title:`Switch to ${ae.alias??ae.email}`,children:a===`switch-${ae.num}`?"…":"switch"})]}),d.jsx("div",{className:"ap-lanes",id:`ap-lanes-${ae.num}`,children:Le.length?d.jsxs(d.Fragment,{children:[Le.map(Te=>d.jsx(F1,{lane:Te,nowSec:g},Te.id)),Ct&&ze.map(Te=>d.jsx(F1,{lane:Te,nowSec:g},Te.id))]}):d.jsx("div",{className:"ap-hint",children:"No usage recorded yet."})}),d.jsxs("div",{className:"ap-meta",children:[ae.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",...me("recapture"),onClick:async()=>{const Te=await Fe({action:"recapture"},"recapture");Te!=null&&Te.ok&&Ee(!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"})]}),ae.error&&(()=>{const Te=yD(ae.error);return d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"ap-err",title:Te.hint,children:Te.text}),Te.fixable&&d.jsx("button",{type:"button",className:"ap-fix",onClick:()=>S(!0),title:"Open the sign-in dialog. Signing in as this account replaces its stored login in place.",children:"sign in again"})]})})(),rt&&d.jsx("button",{type:"button",className:"ap-lanes-more","aria-expanded":Ct,"aria-controls":`ap-lanes-${ae.num}`,title:oD(ae.headroom,(Ve==null?void 0:Ve.label)??null,ze.length,Ct),onClick:()=>L(Te=>aD(Te,ae)),children:rt}),(((s==null?void 0:s.enabled)||(s==null?void 0:s.external))&&!ae.active||ae.disabled)&&d.jsx("button",{type:"button",className:"ap-rotate",...me(`rot-${ae.num}`),onClick:()=>He({action:"account",account:ae.num,enabled:ae.disabled},`rot-${ae.num}`).then(()=>Ee(!0)),title:ae.disabled?"Return this account to auto-rotation":"Hold this account out of auto-rotation",children:ae.disabled?"put back":"hold out"}),ae.fetchedAt?d.jsxs("span",{className:`ap-age${ae.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 ",D1(ae.fetchedAt,g),gD(ae.nextAt,g)]}):d.jsx("span",{className:"ap-age ap-stale",title:"claude-swap has not read this account yet",children:"never collected"})]}),N===ae.num&&d.jsxs("div",{className:"ap-manage",id:`ap-manage-${ae.num}`,role:"group","aria-label":`Manage account ${ae.num}`,children:[d.jsxs("div",{className:"ap-manage-name",children:[d.jsx("label",{className:"vis-hidden",htmlFor:`ap-alias-${ae.num}`,children:"Alias"}),d.jsx("input",{id:`ap-alias-${ae.num}`,className:"ap-manage-input",type:"text",value:E,onChange:Te=>C(Te.target.value),onKeyDown:Te=>{Te.key==="Enter"&&st(ae.num,ae.alias)},maxLength:cD,placeholder:"e.g. work",spellCheck:!1,autoFocus:!0}),d.jsx("button",{type:"button",className:"ap-manage-btn",...me(`alias-${ae.num}`),onClick:()=>st(ae.num,ae.alias),title:"A short name to show instead of the email",children:j===ae.num?"saved":"save"})]}),(()=>{const Te=J4((t.accounts??[]).map(St=>St.num),ae.num),wt=tD(Te,H,ae.num),dt=nD(Te,wt,ae.num);return d.jsxs("div",{className:"ap-manage-slot",children:[d.jsx("label",{className:"vis-hidden",htmlFor:`ap-slot-${ae.num}`,children:"Slot"}),d.jsx("span",{className:"ap-field",children:d.jsx("select",{id:`ap-slot-${ae.num}`,value:String(wt),...me(`move-${ae.num}`),onChange:St=>ne(Number(St.target.value)),children:Te.map(St=>d.jsx("option",{value:St.slot,children:St.label},St.slot))})}),d.jsx("button",{type:"button",className:"ap-manage-btn",...me(`move-${ae.num}`),title:dt.title,onClick:()=>Pe(ae.num,wt,dt),children:X===ae.num?dt.done:dt.label})]})})(),d.jsxs("div",{className:"ap-manage-acts",children:[d.jsx("button",{type:"button",className:"ap-manage-btn",...me(`share-${ae.num}`),title:`Copy this account to another ${Bt}. 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 Te=await Fe({action:"share",account:ae.num},`share-${ae.num}`);Te!=null&&Te.ok&&M({num:ae.num,blob:Te.blob,expiresAt:Te.expiresAt})},children:"share"}),d.jsx("button",{type:"button",className:`ap-manage-btn danger${O===ae.num?" armed":""}`,...me(`rm-${ae.num}`),title:O===ae.num?"This deletes the stored credentials for this account":"Remove this account from claude-swap",onClick:()=>{if(O!==ae.num){P(ae.num),window.setTimeout(()=>P(Te=>Te===ae.num?null:Te),4e3);return}P(null),Fe({action:"remove",account:ae.num},`rm-${ae.num}`).then(()=>{b(null),Ee(!0),xe(null)})},children:O===ae.num?"confirm":"remove"})]}),(R==null?void 0:R.at)===ae.num&&(()=>{var dt;const Te=(dt=t.accounts)==null?void 0:dt.find(St=>St.num===R.displaced),wt=(Te==null?void 0:Te.alias)??(Te==null?void 0:Te.email)??"the account that was there";return d.jsxs("span",{className:"ap-manage-hint ap-manage-swap",title:`Slot ${R.at} was taken, so the two accounts traded places: ${wt} now holds slot ${R.displaced}.`,children:["swapped with slot ",R.displaced]})})(),(z==null?void 0:z.num)===ae.num&&(()=>{const Te=qT(z.expiresAt,g),wt=Te.tone==="gone";return d.jsxs("div",{className:`ap-share${wt?" expired":""}`,children:[d.jsx("code",{className:"ap-share-blob",children:z.blob}),d.jsxs("div",{className:"ap-share-foot",children:[d.jsx("button",{type:"button",className:"ap-manage-btn",...me(`share-${ae.num}`),onClick:async()=>{if(wt){Y(!1);const dt=await Fe({action:"share",account:ae.num},`share-${ae.num}`);dt!=null&&dt.ok&&M({num:ae.num,blob:dt.blob,expiresAt:dt.expiresAt});return}await z1(z.blob)&&(Y(!0),window.setTimeout(()=>Y(!1),1800))},children:wt?"make a new share":G?"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 ${Te.tone}`,children:Te.text})]})]})]})})()]})]},ae.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:[pe!=null&&d.jsxs("span",{className:`ap-auto-now${Oe?" near":""}`,children:[Math.round(pe),"%"]}),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:be,...me("threshold"),onChange:ae=>$(ae.target.value),children:mD.map(ae=>d.jsxs("option",{value:ae,children:[ae,"%"]},ae))})}),d.jsx("button",{type:"button",className:"ap-manage-btn",...me("threshold"),title:ue.title,onClick:()=>Ue(be,ue),children:V?ue.done:ue.label}),d.jsxs("button",{type:"button",className:`ap-auto-state${s.enabled?" live":""}`,role:"switch","aria-checked":s.enabled,"aria-label":"Auto-switch",...me("enable"),onClick:()=>He({action:"enable",enabled:!s.enabled},"enable").then(()=>Ee(!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 ",D1(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})`:"","."]})]})}),k&&d.jsx(K4,{onClose:()=>S(!1),onChanged:()=>Ee(!0)}),A&&d.jsx(Z4,{accounts:((t==null?void 0:t.accounts)??[]).map(ae=>({num:ae.num,email:ae.email,alias:ae.alias,org:ae.org})),onClose:()=>q(!1),copyText:z1})]})}const wD=3e4;function xD({bundle:e,running:t,lastTried:n}){return!t||e===t?!1:n!==t}function bD({bundle:e,running:t,pending:n,lastTried:s}){return t?xD({bundle:e,running:t,lastTried:s})?"reload":n==null||n&&n!==t?"wait":"confirm":"wait"}function kD(e){return!e||e.state!=="failed"?null:`${typeof e.at=="number"?e.at:0}:${e.error??""}`}function _D({asked:e,reported:t}){return t?t!==e:!1}function SD(e){const t=e.thresholdMs??wD;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 ND(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 CD(e){return e<=0?null:e===1?"the one agent":`all ${e} agents`}function jD(e,t){const n=CD(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 TD({agentCount:e,onConfirm:t,onCancel:n}){const s=_.useRef(null),i=_n(n,{focusRef:s,layer:XL}),[a,l]=_.useState(null);_.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}=jD(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 RD="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.",AD=[{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 MD({onClose:e}){const t=_n(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:RD}),d.jsx("div",{className:"shortcuts",children:AD.map(n=>d.jsxs(_.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 ID=["done","needs-input"],OD=[{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}]}],PD=[{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}]}],Lw={done:OD,"needs-input":PD},Gi="two";function tw(e,t){const n=Lw[e];return n.find(s=>s.id===t)??n.find(s=>s.id===Gi)??n[0]}function DT(e,t){return Lw[e].some(s=>s.id===t)?t:Gi}tw("done",Gi).notes,tw("needs-input",Gi).notes;const B1=.04,$D=.24,FT=0,qw=100,nw=5,wl=50;function xl(e){if(!Number.isFinite(e))return wl;const t=Math.round(e/nw)*nw;return Math.min(qw,Math.max(FT,t))}function LD(e){if(e==null)return wl;const t=e.trim();return/^-?\d+(\.\d+)?$/.test(t)?xl(Number(t)):wl}function qD(e){const t=xl(e),n=B1+($D-B1)*(t/qw);return Math.round(n*1e4)/1e4}function DD(e,t){const n=t.trim,s=typeof n=="number"&&Number.isFinite(n)&&n>0&&n<=1?n:1;return Math.round(qD(e)*s*1e4)/1e4}const FD=160,zD="agent-dag.soundLevel.done",BD="agent-dag.soundLevel.needs-input",UD="agent-dag.soundFigure.done",WD="agent-dag.soundFigure.needs-input",zT={done:zD,"needs-input":BD},BT={done:UD,"needs-input":WD},rw={done:{level:wl,figure:Gi},"needs-input":{level:wl,figure:Gi}};function HD(e){const t=n=>({level:LD(e(zT[n])),figure:DT(n,e(BT[n]))});return{done:t("done"),"needs-input":t("needs-input")}}const GD={Stop:"done",Notification:"needs-input"};function VD(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:GD[n]??null}function YD(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))??rw)[h]??rw[h],g=tw(h,f.figure),v=DD(f.level,g),w=n.currentTime;for(const b of g.notes){const k=n.createOscillator(),S=n.createGain();k.type=g.type??"sine",k.frequency.value=b.hz;const E=w+b.at,C=E+b.ms/1e3;S.gain.setValueAtTime(1e-4,E),S.gain.exponentialRampToValueAtTime(v,E+.012),S.gain.exponentialRampToValueAtTime(1e-4,C),k.connect(S).connect(n.destination),k.start(E),k.stop(C+.02)}return!0}return{unlock:l,play:u,state:i,get context(){return n}}}const U1={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 XD({onClose:e,soundOn:t,onToggleSound:n,prefs:s,onLevel:i,onFigure:a,onPreview:l,openerRef:u,notifyOn:h,onToggleNotify:p,notifyVetoed:f}){const g=_n(e),v=_.useRef(e);return v.current=e,_.useEffect(()=>{const w=N=>{var k,S;const b=N.target;b&&((k=g.current)!=null&&k.contains(b)||(S=u.current)!=null&&S.contains(b)||v.current())};return window.addEventListener("pointerdown",w,!0),()=>window.removeEventListener("pointerdown",w,!0)},[g,u]),d.jsxs("div",{ref:g,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"})]}),d.jsxs("button",{type:"button",className:"btn sm-switch",onClick:p,"aria-pressed":h,title:f?"Recorded for next time: this deck was started with AGENTS_DECK_NO_NOTIFY=1, which overrules the switch":"A system notification when a session blocks on you — from this page while it is behind something, and from the deck itself when no page is open",children:[d.jsx("span",{className:"sm-switch-label",children:"Notifications"}),d.jsx("span",{className:"sm-switch-state",children:f?"off — set at launch":h?"on":"off"})]}),ID.map(w=>{const N=s[w],b=`sm-level-${w}`,k=`sm-figure-${w}`;return d.jsxs("section",{className:"sm-tone","aria-labelledby":`sm-name-${w}`,children:[d.jsxs("div",{className:"sm-tone-head",children:[d.jsx("h3",{className:"sm-tone-name",id:`sm-name-${w}`,children:U1[w]}),d.jsxs("button",{type:"button",className:"btn sm-hear",onClick:()=>l(w),"aria-label":`Hear the ${U1[w].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:b,children:"Volume"}),d.jsx("input",{id:b,type:"range",min:FT,max:qw,step:nw,value:N.level,onChange:S=>i(w,Number(S.target.value))}),d.jsxs("span",{className:"sm-read",children:[N.level,"%"]})]}),d.jsxs("div",{className:"sm-row",children:[d.jsx("label",{htmlFor:k,children:"Sound"}),d.jsx("select",{id:k,className:"sm-select",value:N.figure,onChange:S=>a(w,S.target.value),children:Lw[w].map(S=>d.jsx("option",{value:S.id,children:S.label},S.id))})]}),d.jsx("p",{className:"sm-note",children:KD[w]})]},w)}),d.jsx("p",{className:"sm-foot",children:"M turns the sound on and off from anywhere."})]})}const QD={"//":["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.8.0":[{title:"🔕 Notifications now have an off switch",body:`3.7.0 gave you a "notify me" button and no way back. Turning them off meant digging into your browser's site settings — which no page can do for you — and that still left the other notifier, the one the deck raises when no page is open at all. Silencing that one meant quitting the deck and starting it again with \`AGENTS_DECK_NO_NOTIFY=1\` in front. The person who wanted quiet was the one doing the work.
79
+
80
+ There is a **Notifications** switch in the sound menu now, beside the one for sound — that menu is already "how loudly does this deck interrupt me". One switch governs both notifiers, it takes effect immediately without a restart, and it is remembered across restarts.
81
+
82
+ It is kept by the deck rather than by your browser, because the second notifier runs when no page exists and a setting living in a page could never reach it. \`AGENTS_DECK_NO_NOTIFY=1\` still wins over the switch — a machine told at launch to stay off the desktop stays off it — and when that is the case the menu says so instead of showing an "on" that will not happen.`}],"3.7.1":[{title:"🔔 The notifications now fire on the thing that actually stops your agent",body:`3.7.0 could tell you a session was waiting — but only when Claude Code asked permission to run a tool. If you work with permissions bypassed, that never happens, and the whole feature was silent for you. Measured on one real log: 1683 events, every one of them in bypassPermissions, and a single permission prompt in the entire history.
79
83
 
80
84
  What fires constantly on that setup is the other kind: the agent asking you a question and stopping for the answer. The deck was throwing those away — no amber chip, no row in the sidebar, no notification, and no "notify me" button, because the button only appears while something is actually blocked.
81
85
 
@@ -177,15 +181,15 @@ The two lists are separate on purpose, so you can never end up with both tones s
177
181
 
178
182
  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.
179
183
 
180
- 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."}]},Lw="agent-dag.releaseNotesSeen";function W1(e){return e.split(/[.\-+]/).map(t=>parseInt(t,10)).map(t=>Number.isNaN(t)?0:t)}function Yi(e,t){const n=W1(e),s=W1(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 Ki(e){return typeof e=="string"&&/^\d+\.\d+\.\d+/.test(e)}function ZD(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(!Ki(n)||!Array.isArray(s))continue;const i=s.filter(ZD);i.length&&t.push({version:n,notes:i})}return t.sort((n,s)=>Yi(s.version,n.version))}const H1=JD(QD);function UT(e,t,n){return e.filter(s=>Yi(s.version,n)<=0&&(t===null||Yi(s.version,t)>0))}function e5(e,t){return e.filter(n=>Yi(n.version,t)===0)}function t5(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 n5({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&&Ki(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(!Ki(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=Yi(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 r5=new RegExp("^(?:\\p{Extended_Pictographic}|\\p{Emoji_Modifier}|\\p{Regional_Indicator}|[\\u200D\\uFE0F])+(?= \\S)","u");function s5(e){const t=r5.exec(e);return t?{icon:t[0],rest:e.slice(t[0].length)}:{icon:null,rest:e}}function o5(){if(typeof window>"u")return null;try{return window.localStorage}catch{return null}}function i5(e){if(!e)return null;let t=null;try{t=e.getItem(Lw)}catch{return null}return Ki(t)?t:null}function a5(e){if(!e)return!1;try{return e.getItem(Lw),!0}catch{return!1}}function l5(e,t){if(!e)return!1;try{return e.setItem(Lw,t),!0}catch{return!1}}function c5({stored:e,running:t,notes:n,remembers:s=!0}){if(!Ki(t))return{show:[],record:null,reason:"no-version"};if(!Ki(e)){if(!s)return{show:[],record:t,reason:"cannot-remember"};const l=e5(n,t);return l.length?{show:l,record:t,reason:"welcome"}:{show:[],record:t,reason:"first-run"}}const i=Yi(e,t);if(i===0)return{show:[],record:null,reason:"seen"};if(i>0)return{show:[],record:null,reason:"ahead"};const a=UT(n,e,t);return a.length?{show:a,record:t,reason:"new-notes"}:{show:[],record:t,reason:"nothing-new"}}function u5({entries:e,since:t,running:n,firstRun:s,onClose:i}){const a=kn(i),l=t5(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:n5({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}=s5(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 d5(e){return e.slice().sort((t,n)=>t.y-n.y||t.x-n.x)}function f5(e,t,n){var l;if(e.length===0)return null;const s=d5(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 h5=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Escape","Delete","Backspace"]);function p5(e,t){return t==null?{kind:"deck",nodeId:null}:e.key==="Enter"||e.key===" "?{kind:"activate",nodeId:t,additive:e.shiftKey}:h5.has(e.key)?{kind:"node",nodeId:t}:{kind:"deck",nodeId:t}}const m5=new Set(["","BODY","HTML","#DOCUMENT"]);function g5(e){return!e||Rw(e)?!1:!m5.has(String(e.tagName??"").toUpperCase())}function su(e,t){if(t.size!==0)for(const n of Array.from(e.keys()))t.has(n)||e.delete(n)}function y5(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 v5(e){const t=new Set;for(const n of e)t.add(n.id),t.add(`group:${n.sessionId}`);return t}function w5(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 x5(e,t){const n=new Set;for(const s of t){const i=w5(e,s);if(i)for(const a of i)n.add(a)}return n.size>0?n:null}function WT(e,t,n){return!t.has(e)||n.has(e)}function b5(e,t,n,s){return!t.has(e)&&WT(e,n,s)}function k5(e,t,n){const s={x:0,y:0};return t.set(e,s),n.add(e),s}function _5(e,t,n,s){n.set(e,t),s.delete(e)}const S5=40,N5=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=S5){const p=t.now(),f=Math.max(i+h,p);if(f<=p){l(),a();return}u(f,p,h)},replay(h=N5){l(),s=t.now()+h,n=t.setTimeout(a,h)},flush(){l(),a()},cancel(){l()}}}const C5=1e3;function j5(e={}){const t=Math.max(1,Math.floor(e.limit??C5)),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,v=g!==null&&g!==h;v&&(h=g,u=0);const w=f!==null&&!v&&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 HT="agent-dag.theme";function T5(e){return e==="light"?"light":"dark"}function R5(){return T5(Bu(HT))}function A5({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 ou={offline:"#e05252",waiting:"#c97d12",running:"#2a90d4",idle:"#7e828c"};function iu(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 M5=Object.freeze({offline:`data:image/svg+xml,${encodeURIComponent(iu(ou.offline,"offline"))}`,waiting:`data:image/svg+xml,${encodeURIComponent(iu(ou.waiting,"waiting"))}`,running:`data:image/svg+xml,${encodeURIComponent(iu(ou.running,"running"))}`,idle:`data:image/svg+xml,${encodeURIComponent(iu(ou.idle,"idle"))}`}),I5="No sessions are waiting for you.";function O5(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 P5(e,t){return t!==""?t:e===""?"":I5}function $5(){let e=0;return{begin(){const t=++e;return()=>t===e},cancel(){e++}}}function L5(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 q5(e){return e.claude&&e.codex?"Claude Code and Codex":e.claude?"Claude Code":e.codex?"Codex":null}const G1={claude:"Claude Code",codex:"Codex",opencode:"OpenCode",openclaw:"OpenClaw",copilot:"GitHub Copilot",pi:"pi-agent"};function qw(e){const t=e.toLowerCase();return Object.hasOwn(G1,t)?G1[t]:t?t[0].toUpperCase()+t.slice(1):""}function D5(e){return e.length<=1?e[0]??"":`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`}function F5(e,t=[]){const n=t.length?D5(t.map(qw)):q5(e);return n?`via ccusage · local ${n} logs`:"via ccusage · local agent logs"}function z5(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 B5(e,t){const n=t.prefs??tw,s=hl(n.done.level),i=hl(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?`
184
+ 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."}]},Dw="agent-dag.releaseNotesSeen";function W1(e){return e.split(/[.\-+]/).map(t=>parseInt(t,10)).map(t=>Number.isNaN(t)?0:t)}function Vi(e,t){const n=W1(e),s=W1(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 Yi(e){return typeof e=="string"&&/^\d+\.\d+\.\d+/.test(e)}function ZD(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(!Yi(n)||!Array.isArray(s))continue;const i=s.filter(ZD);i.length&&t.push({version:n,notes:i})}return t.sort((n,s)=>Vi(s.version,n.version))}const H1=JD(QD);function UT(e,t,n){return e.filter(s=>Vi(s.version,n)<=0&&(t===null||Vi(s.version,t)>0))}function e5(e,t){return e.filter(n=>Vi(n.version,t)===0)}function t5(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 n5({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&&Yi(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(!Yi(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=Vi(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 r5=new RegExp("^(?:\\p{Extended_Pictographic}|\\p{Emoji_Modifier}|\\p{Regional_Indicator}|[\\u200D\\uFE0F])+(?= \\S)","u");function s5(e){const t=r5.exec(e);return t?{icon:t[0],rest:e.slice(t[0].length)}:{icon:null,rest:e}}function o5(){if(typeof window>"u")return null;try{return window.localStorage}catch{return null}}function i5(e){if(!e)return null;let t=null;try{t=e.getItem(Dw)}catch{return null}return Yi(t)?t:null}function a5(e){if(!e)return!1;try{return e.getItem(Dw),!0}catch{return!1}}function l5(e,t){if(!e)return!1;try{return e.setItem(Dw,t),!0}catch{return!1}}function c5({stored:e,running:t,notes:n,remembers:s=!0}){if(!Yi(t))return{show:[],record:null,reason:"no-version"};if(!Yi(e)){if(!s)return{show:[],record:t,reason:"cannot-remember"};const l=e5(n,t);return l.length?{show:l,record:t,reason:"welcome"}:{show:[],record:t,reason:"first-run"}}const i=Vi(e,t);if(i===0)return{show:[],record:null,reason:"seen"};if(i>0)return{show:[],record:null,reason:"ahead"};const a=UT(n,e,t);return a.length?{show:a,record:t,reason:"new-notes"}:{show:[],record:t,reason:"nothing-new"}}function u5({entries:e,since:t,running:n,firstRun:s,onClose:i}){const a=_n(i),l=t5(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:n5({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}=s5(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 d5(e){return e.slice().sort((t,n)=>t.y-n.y||t.x-n.x)}function f5(e,t,n){var l;if(e.length===0)return null;const s=d5(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 h5=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Escape","Delete","Backspace"]);function p5(e,t){return t==null?{kind:"deck",nodeId:null}:e.key==="Enter"||e.key===" "?{kind:"activate",nodeId:t,additive:e.shiftKey}:h5.has(e.key)?{kind:"node",nodeId:t}:{kind:"deck",nodeId:t}}const m5=new Set(["","BODY","HTML","#DOCUMENT"]);function g5(e){return!e||Mw(e)?!1:!m5.has(String(e.tagName??"").toUpperCase())}function au(e,t){if(t.size!==0)for(const n of Array.from(e.keys()))t.has(n)||e.delete(n)}function y5(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 v5(e){const t=new Set;for(const n of e)t.add(n.id),t.add(`group:${n.sessionId}`);return t}function w5(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 x5(e,t){const n=new Set;for(const s of t){const i=w5(e,s);if(i)for(const a of i)n.add(a)}return n.size>0?n:null}function WT(e,t,n){return!t.has(e)||n.has(e)}function b5(e,t,n,s){return!t.has(e)&&WT(e,n,s)}function k5(e,t,n){const s={x:0,y:0};return t.set(e,s),n.add(e),s}function _5(e,t,n,s){n.set(e,t),s.delete(e)}const S5=40,N5=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=S5){const p=t.now(),f=Math.max(i+h,p);if(f<=p){l(),a();return}u(f,p,h)},replay(h=N5){l(),s=t.now()+h,n=t.setTimeout(a,h)},flush(){l(),a()},cancel(){l()}}}const C5=1e3;function j5(e={}){const t=Math.max(1,Math.floor(e.limit??C5)),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,v=g!==null&&g!==h;v&&(h=g,u=0);const w=f!==null&&!v&&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 HT="agent-dag.theme";function T5(e){return e==="light"?"light":"dark"}function R5(){return T5(Hu(HT))}function A5({waiting:e,running:t,connected:n=!0}){return{title:e>0?`(${e}) ${Bt}`:Bt,icon:n?e>0?"waiting":t>0?"running":"idle":"offline"}}const lu={offline:"#e05252",waiting:"#c97d12",running:"#2a90d4",idle:"#7e828c"};function cu(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 M5=Object.freeze({offline:`data:image/svg+xml,${encodeURIComponent(cu(lu.offline,"offline"))}`,waiting:`data:image/svg+xml,${encodeURIComponent(cu(lu.waiting,"waiting"))}`,running:`data:image/svg+xml,${encodeURIComponent(cu(lu.running,"running"))}`,idle:`data:image/svg+xml,${encodeURIComponent(cu(lu.idle,"idle"))}`}),I5="No sessions are waiting for you.";function O5(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 P5(e,t){return t!==""?t:e===""?"":I5}function $5(){let e=0;return{begin(){const t=++e;return()=>t===e},cancel(){e++}}}function L5(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 q5(e){return e.claude&&e.codex?"Claude Code and Codex":e.claude?"Claude Code":e.codex?"Codex":null}const G1={claude:"Claude Code",codex:"Codex",opencode:"OpenCode",openclaw:"OpenClaw",copilot:"GitHub Copilot",pi:"pi-agent"};function Fw(e){const t=e.toLowerCase();return Object.hasOwn(G1,t)?G1[t]:t?t[0].toUpperCase()+t.slice(1):""}function D5(e){return e.length<=1?e[0]??"":`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`}function F5(e,t=[]){const n=t.length?D5(t.map(Fw)):q5(e);return n?`via ccusage · local ${n} logs`:"via ccusage · local agent logs"}function z5(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 B5(e,t){const n=t.prefs??rw,s=xl(n.done.level),i=xl(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?`
181
185
 
182
186
  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?`
183
187
 
184
188
  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+`
185
189
 
186
- Click to set the volume and the sound of each tone, and to hear either one.`}function GT(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 U5(e){const t=GT([{agents:e}]);return t.length<2?null:t.map(n=>`${qw(n.id)} ${Ze(n.cost)}`).join(" · ")}function V1(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 W5(e,t){if(!(t>0)||!(e>0))return"0%";const n=e/t*100;return n<.1?"<0.1%":`${n.toFixed(1)}%`}function au(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 H5=[7,14,30,90];function G5(e){const[t,n]=_.useState(null),[s,i]=_.useState(!1),a=_.useState($5)[0],l=_.useRef(!1),u=(h=!1)=>{if(h&&!or(l.current))return;const p=a.begin();l.current=h;const f=e;i(!0);const v=`/api/ccusage?since=${Vv(f)}${h?"&refresh=1":""}`;fetch(v).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 _.useEffect(()=>(u(!1),()=>a.cancel()),[e]),{landed:t,loading:s,reload:()=>u(!0)}}function V5({onClose:e,providers:t}){var z;const[n,s]=_.useState(30),[i,a]=_.useState(null),{landed:l,loading:u,reload:h}=G5(n),p=_.useRef(null),f=kn(e,{focusRef:p}),g=L5({loading:u,want:n,answer:l&&{range:l.range,ok:l.resp.ok===!0,days:((z=l.resp.days)==null?void 0:z.length)??0}}),v=g.phase==="chart"?l.resp.days??[]:[],w=_.useMemo(()=>v.reduce((M,A)=>Math.max(M,A.totalCost),0),[v]),N=_.useRef(null);_.useLayoutEffect(()=>{const M=N.current;M&&(M.scrollLeft=M.scrollWidth)},[v]);const{totalCost:b,totalTok:k,inOut:S,cacheRead:E,modelCosts:C}=_.useMemo(()=>{let M=0,A=0,q=0,H=0;const Y=new Map;for(const R of v){M+=R.totalCost,A+=R.totalTokens,q+=R.inputTokens+R.outputTokens,H+=R.cacheReadTokens;for(const Q of R.modelBreakdowns)Y.set(Q.modelName,(Y.get(Q.modelName)??0)+Q.cost)}return{totalCost:M,totalTok:A,inOut:q,cacheRead:H,modelCosts:Y}},[v]),j=_.useMemo(()=>Array.from(C.entries()).sort((M,A)=>A[1]-M[1]),[C]),I=_.useMemo(()=>GT(v),[v]),O=I.length>1,P=i?v.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:F5(t,I.map(M=>M.id))})]}),d.jsx("div",{className:"uh-range",role:"group","aria-label":"Range",children:H5.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,...sr(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:Gi(l.resp)||void 0,children:[z4(l.resp,"ccusage did not report usage"),d.jsx("div",{children:d.jsx("button",{className:"btn uh-retry",onClick:h,...sr(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(lu,{label:"total cost",val:Ze(b),accent:!0}),d.jsx(lu,{label:"tokens",val:Rt(k)}),d.jsx(lu,{label:"input+output",val:Rt(S)}),d.jsx(lu,{label:"cache reads",val:Rt(E)})]}),O&&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:V1(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} · ${Rt(M.tokens)} tokens`,children:[d.jsx("span",{className:"uh-legend-dot",style:{background:V1(M.id)}}),qw(M.id),d.jsx("span",{className:"uh-agent-cost",children:Ze(M.cost)}),d.jsx("span",{className:"uh-agent-share",children:W5(M.cost,b)})]},M.id))})]}),d.jsx("div",{ref:N,className:"uh-chart",role:"group","aria-label":"Daily cost by model",children:v.map(M=>{const A=w>0?M.totalCost/w*100:0,q=M.period===i,H=`${M.period}, ${Ze(M.totalCost)}`;return d.jsxs("button",{className:`uh-bar-col${q?" sel":""}`,onClick:()=>a(q?null:M.period),"aria-pressed":q,"aria-label":H,title:`${M.period} · ${Ze(M.totalCost)}`,style:{flexBasis:`${100/v.length}%`},children:[d.jsx("div",{className:"uh-bar",style:{height:`${Math.max(A,M.totalCost>0?2:0)}%`},children:M.modelBreakdowns.slice().sort((Y,R)=>R.cost-Y.cost).map(Y=>{const R=M.totalCost>0?Y.cost/M.totalCost*100:0;return d.jsx("div",{className:"uh-bar-seg",style:{height:`${R}%`,background:au(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:j.map(([M,A])=>d.jsxs("span",{className:"uh-legend-item",title:M,children:[d.jsx("span",{className:"uh-legend-dot",style:{background:au(M)}}),$s(M)," ",d.jsx("span",{className:"uh-legend-cost",children:Ze(A)})]},M))}),P&&d.jsxs("div",{className:"uh-detail",children:[d.jsxs("div",{className:"uh-detail-head",children:[d.jsx("span",{className:"uh-detail-date",children:P.period}),d.jsx("span",{className:"uh-detail-cost",children:Ze(P.totalCost)}),(()=>{var q,H;const A=U5(P.agents)??((H=(q=P.metadata)==null?void 0:q.agents)!=null&&H.length?P.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(cu,{label:"input",val:Rt(P.inputTokens)}),d.jsx(cu,{label:"output",val:Rt(P.outputTokens)}),d.jsx(cu,{label:"cache write",val:Rt(P.cacheCreationTokens)}),d.jsx(cu,{label:"cache read",val:Rt(P.cacheReadTokens)})]}),d.jsx("div",{className:"uh-detail-models",children:P.modelBreakdowns.slice().sort((M,A)=>A.cost-M.cost).map(M=>{const A=P.totalCost>0?M.cost/P.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:au(M.modelName)}}),d.jsx("span",{className:"uh-model-label",children:$s(M.modelName)})]}),d.jsx("span",{className:"uh-model-bar",children:d.jsx("span",{className:"uh-model-bar-fill",style:{width:`${A}%`,background:au(M.modelName)}})}),d.jsx("span",{className:"uh-model-cost",children:Ze(M.cost)})]},M.modelName)})})]})]})]})})}function lu({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 cu({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 Y5(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 Y1=1e4,K5=12e3;function X5({browsers:e,findings:t,watching:n,palette:s,now:i=()=>Date.now()}){const a=_.useRef(null),l=_.useRef(null);return l.current={browsers:e,findings:t,watching:n},_.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 v=()=>{var ne;if(g)return;const N=l.current;if(!N)return;const{browsers:b,findings:k,watching:S}=N,E=s["--accent"]||"#7dd3fc",C=s["--line"]||"#1f2229",j=s["--text-dim"]||"#6e727c",I=Y5(s["--bg"]),O=I?42:26,P=I?.85:.65,z=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 H=A/2,Y=q/2,R=Math.min(A,q)/2-6;h.strokeStyle=C,h.lineWidth=1,h.globalAlpha=I?1:.9;for(const X of[.4,.7,1])h.beginPath(),h.arc(H,Y,R*X,0,Math.PI*2),h.stroke();h.beginPath(),h.moveTo(H-R,Y),h.lineTo(H+R,Y),h.moveTo(H,Y-R),h.lineTo(H,Y+R),h.stroke(),h.globalAlpha=1;const W=(S&&!p?z%Y1/Y1:0)*Math.PI*2-Math.PI/2;if(S){const X=(ne=h.createConicGradient)==null?void 0:ne.call(h,W-.85,H,Y);X&&(X.addColorStop(0,"transparent"),X.addColorStop(.85/(Math.PI*2),`color-mix(in srgb, ${E} ${O}%, transparent)`),X.addColorStop(1,"transparent"),h.fillStyle=X,h.beginPath(),h.moveTo(H,Y),h.arc(H,Y,R,W-.85,W),h.closePath(),h.fill()),h.strokeStyle=E,h.globalAlpha=P,h.beginPath(),h.moveTo(H,Y),h.lineTo(H+Math.cos(W)*R,Y+Math.sin(W)*R),h.stroke(),h.globalAlpha=1}b.forEach((X,B)=>{const J=B/Math.max(b.length,1)*Math.PI*2-Math.PI/2,$=X.lastReadMs===null?1:Math.min(1,(z-X.lastReadMs)/12e4),V=R*(.42+$*.5),Z=H+Math.cos(J)*V,F=Y+Math.sin(J)*V,L=Math.abs((W-J+Math.PI*3)%(Math.PI*2)-Math.PI),K=S?Math.max(0,1-L/.55):0;h.beginPath(),h.arc(Z,F,3+K*1.6,0,Math.PI*2),h.fillStyle=X.running?E:j,h.globalAlpha=X.running?.55+K*.45:.35,h.fill(),h.globalAlpha=1});for(const X of k){const B=(z-X.atMs)/K5;if(B<0||B>1)continue;const $=Math.max(0,b.findIndex(F=>F.key===X.browser))/Math.max(b.length,1)*Math.PI*2-Math.PI/2,V=H+Math.cos($)*R*.6,Z=Y+Math.sin($)*R*.6;h.beginPath(),h.arc(V,Z,4+B*22,0,Math.PI*2),h.strokeStyle=E,h.globalAlpha=(1-B)*.8,h.lineWidth=1.5,h.stroke(),h.globalAlpha=1}f=requestAnimationFrame(v)};return v(),()=>{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 K1="agent-dag.browserWatch.seenMs";function Q5(e,t){return e.filter(n=>n.startMs>t)}function Z5(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 VT(e){return(e??[]).filter(t=>t.installed&&t.profiles>0)}function X1(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 eF(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 tF(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 nF(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=VT(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 rF(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 sF(e){return new Date(e).toLocaleDateString(void 0,{weekday:"short",day:"numeric",month:"short"})}function Q1(e){const t=Math.round((e.endMs-e.startMs)/6e4);return t<1?"":`${t} min`}function oF({onClose:e,onSeen:t,onWatching:n,palette:s}){const i=kn(e),[a,l]=_.useState(null),[u,h]=_.useState(null),[p,f]=_.useState(!1),g=_.useRef(!1),[v,w]=_.useState(null),[N,b]=_.useState(null),[k,S]=_.useState(!1),[E,C]=_.useState(!1),[j,I]=_.useState(!1),[O,P]=_.useState(!1),[z,M]=_.useState(!1),[A,q]=_.useState(!1),[H,Y]=_.useState(()=>Date.now());_.useEffect(()=>{const Z=setInterval(()=>Y(Date.now()),1e3);return()=>clearInterval(Z)},[]);const R=_.useCallback(async Z=>{var F;if(!(Z&&!or(g.current))){g.current=Z,f(!0);try{const L=await fetch(`/api/browser-watch${Z?"?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(((F=K==null?void 0:K.settings)==null?void 0:F.enabled)===!0),h(null)}catch(L){h(L instanceof Error?L.message:String(L))}finally{g.current=!1,f(!1)}}},[n]);_.useEffect(()=>{R(!1)},[R]),_.useEffect(()=>{const Z=setInterval(()=>{R(!1)},1e4);return()=>clearInterval(Z)},[R]);const Q=_.useCallback(async Z=>{try{await fetch("/api/browser-watch/dismiss",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({host:Z.host,startMs:Z.startMs})})}finally{await R(!1)}},[R]),W=_.useCallback(async Z=>{S(!0);try{const F=await fetch("/api/browser-watch",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(Z)});if(!F.ok)throw new Error(`the deck answered ${F.status}`);await R(!1)}catch(F){h(F instanceof Error?F.message:String(F))}finally{S(!1)}},[R]);_.useEffect(()=>()=>t(Date.now()),[t]);const ne=_.useMemo(()=>{const Z=[];for(const F of(a==null?void 0:a.episodes)??[]){const L=sF(F.startMs),K=Z[Z.length-1];K&&K.label===L?K.episodes.push(F):Z.push({label:L,episodes:[F]})}return Z},[a]),X=VT(a==null?void 0:a.browsers),B=((a==null?void 0:a.browsers)??[]).filter(Z=>!(Z.installed&&Z.profiles>0)),J=a?nF(a):null,$=X.reduce((Z,F)=>Z+F.profiles,0),V=a?Z5(a.coverage.lastHumanMs,a.coverage.quietMs,H):null;return d.jsx("div",{className:"modal-backdrop",onClick:e,role:"presentation",children:d.jsxs("div",{ref:i,className:"modal bw-modal",onClick:Z=>Z.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 R(!0),...sr(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:()=>P(Z=>!Z),"aria-expanded":O,"aria-label":"What the sweep and the dots mean",children:"?"})]}),d.jsxs("div",{className:"bw-glance",children:[d.jsx(X5,{browsers:X.map(Z=>{var F;return{key:Z.key,name:Z.name,running:Z.running,lastReadMs:((F=a.profiles.find(L=>L.browser===Z.key))==null?void 0:F.lastWrittenMs)??null}}),findings:a.episodes.slice(0,6).map(Z=>({browser:Z.browser??null,atMs:Z.endMs})),watching:a.settings.enabled,palette:s}),d.jsx("ul",{className:"bw-counts",children:eF(X,a.profiles).map(Z=>d.jsxs("li",{children:[d.jsx("span",{className:"bw-count-n",children:Z.visits.toLocaleString("en-US")}),d.jsx("span",{className:"bw-count-of",children:Z.name})]},Z.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 ",tF(a.coverage.checkedMs,H),a.coverage.checks>0&&d.jsxs(d.Fragment,{children:[" · ",a.coverage.checks.toLocaleString("en-US")," ",a.coverage.checks===1?"check":"checks"]})]}),V!==null&&d.jsxs("p",{className:"bw-gate",children:["You are browsing — a program page would count in ",J5(V)]}),O&&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(Z=>!Z),"aria-expanded":z,"aria-label":"What running, idle and connected to Anthropic mean",children:"?"})]}),z&&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(Z=>d.jsxs("li",{children:[d.jsx("span",{className:`bw-prof-dot${Z.running?" on":""}`,"aria-hidden":!0}),d.jsx("span",{className:"bw-prof-name",children:Z.name}),d.jsx("span",{className:"bw-prof-state",children:Z.running?"running":"idle"}),Z.running&&Z.relay.state==="live"&&d.jsx("span",{className:"bw-relay",children:"connected to Anthropic"})]},Z.key))}),B.length>0&&d.jsxs(d.Fragment,{children:[d.jsxs("button",{className:"bw-why bw-rest-head",onClick:()=>q(Z=>!Z),"aria-expanded":A,children:[d.jsx("span",{className:"bw-chev","aria-hidden":!0,children:A?"▾":"▸"})," ",B.length," not watched"]}),A&&d.jsxs("p",{className:"bw-rest",children:[B.map(Z=>Z.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(Z=>d.jsxs("div",{className:"bw-day",children:[d.jsx("h4",{className:"bw-sec-head",children:Z.label}),Z.episodes.map(F=>{const L=`${F.host}-${F.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:F.host}),d.jsxs("span",{className:"bw-ep-meta",children:[rF(F),Q1(F)&&d.jsxs(d.Fragment,{children:[" · ",Q1(F)]})]}),d.jsxs("span",{className:"bw-ep-count",children:[F.count," ",F.count===1?"page":"pages"]})]}),d.jsx("button",{className:"glyph-btn bw-ep-x",onClick:()=>void Q(F),"aria-label":`Dismiss ${F.host}`,title:"Dismiss — it leaves this list for good, and stays in the log file",children:"×"})]}),K&&d.jsx("ul",{className:"bw-urls",children:F.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)})]},Z.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(Z=>d.jsxs("div",{className:`bw-log-line ${Z.level}${Z.parts?"":" sys"}`,children:[d.jsx("span",{className:"bw-log-time",children:new Date(Z.atMs).toLocaleTimeString("en-GB",{hour12:!1})}),Z.parts?d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"bw-log-browser",children:Z.parts.browser}),d.jsx("span",{className:"bw-log-profile",title:Z.parts.profile,children:Z.parts.profile}),d.jsxs("span",{className:"bw-log-value",children:[Z.parts.value,Z.parts.flagged>0&&d.jsxs("span",{className:"bw-log-flag",children:[" · ",Z.parts.flagged," flagged"]})]})]}):d.jsx("span",{className:"bw-log-sys",children:Z.text})]},`${Z.atMs}-${Z.level}-${Z.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:v??a.settings.quietMinutes,onChange:Z=>{w(Number(Z.target.value)),W({quietMinutes:Number(Z.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:Z=>void W({reaction:Z.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(Z=>d.jsx("option",{value:Z,children:Z==="notify"?"notify me":Z==="close-tab"?"close the tab":"quit the browser"},Z))})]}),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(Z=>!Z),"aria-expanded":j,children:[d.jsx("span",{className:"bw-chev","aria-hidden":!0,children:j?"▾":"▸"})," What Browser Watch can access"]}),j&&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:X1(a,k).word},X1(a,k).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:()=>C(Z=>!Z),"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 W({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 Dw(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 sh,Z1;function iF(){if(Z1)return sh;Z1=1;function e(){this.__data__=[],this.size=0}return sh=e,sh}var oh,J1;function Zi(){if(J1)return oh;J1=1;function e(t,n){return t===n||t!==t&&n!==n}return oh=e,oh}var ih,ek;function Wu(){if(ek)return ih;ek=1;var e=Zi();function t(n,s){for(var i=n.length;i--;)if(e(n[i][0],s))return i;return-1}return ih=t,ih}var ah,tk;function aF(){if(tk)return ah;tk=1;var e=Wu(),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 ah=s,ah}var lh,nk;function lF(){if(nk)return lh;nk=1;var e=Wu();function t(n){var s=this.__data__,i=e(s,n);return i<0?void 0:s[i][1]}return lh=t,lh}var ch,rk;function cF(){if(rk)return ch;rk=1;var e=Wu();function t(n){return e(this.__data__,n)>-1}return ch=t,ch}var uh,sk;function uF(){if(sk)return uh;sk=1;var e=Wu();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 uh=t,uh}var dh,ok;function Hu(){if(ok)return dh;ok=1;var e=iF(),t=aF(),n=lF(),s=cF(),i=uF();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,dh=a,dh}var fh,ik;function dF(){if(ik)return fh;ik=1;var e=Hu();function t(){this.__data__=new e,this.size=0}return fh=t,fh}var hh,ak;function fF(){if(ak)return hh;ak=1;function e(t){var n=this.__data__,s=n.delete(t);return this.size=n.size,s}return hh=e,hh}var ph,lk;function hF(){if(lk)return ph;lk=1;function e(t){return this.__data__.get(t)}return ph=e,ph}var mh,ck;function pF(){if(ck)return mh;ck=1;function e(t){return this.__data__.has(t)}return mh=e,mh}var gh,uk;function YT(){if(uk)return gh;uk=1;var e=typeof Wc=="object"&&Wc&&Wc.Object===Object&&Wc;return gh=e,gh}var yh,dk;function cr(){if(dk)return yh;dk=1;var e=YT(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return yh=n,yh}var vh,fk;function Ji(){if(fk)return vh;fk=1;var e=cr(),t=e.Symbol;return vh=t,vh}var wh,hk;function mF(){if(hk)return wh;hk=1;var e=Ji(),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 wh=a,wh}var xh,pk;function gF(){if(pk)return xh;pk=1;var e=Object.prototype,t=e.toString;function n(s){return t.call(s)}return xh=n,xh}var bh,mk;function Eo(){if(mk)return bh;mk=1;var e=Ji(),t=mF(),n=gF(),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 bh=l,bh}var kh,gk;function Ln(){if(gk)return kh;gk=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return kh=e,kh}var _h,yk;function Cl(){if(yk)return _h;yk=1;var e=Eo(),t=Ln(),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 _h=l,_h}var Sh,vk;function yF(){if(vk)return Sh;vk=1;var e=cr(),t=e["__core-js_shared__"];return Sh=t,Sh}var Nh,wk;function vF(){if(wk)return Nh;wk=1;var e=yF(),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 Nh=n,Nh}var Eh,xk;function KT(){if(xk)return Eh;xk=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 Eh=n,Eh}var Ch,bk;function wF(){if(bk)return Ch;bk=1;var e=Cl(),t=vF(),n=Ln(),s=KT(),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(v){if(!n(v)||t(v))return!1;var w=e(v)?f:a;return w.test(s(v))}return Ch=g,Ch}var jh,kk;function xF(){if(kk)return jh;kk=1;function e(t,n){return t==null?void 0:t[n]}return jh=e,jh}var Th,_k;function Co(){if(_k)return Th;_k=1;var e=wF(),t=xF();function n(s,i){var a=t(s,i);return e(a)?a:void 0}return Th=n,Th}var Rh,Sk;function Fw(){if(Sk)return Rh;Sk=1;var e=Co(),t=cr(),n=e(t,"Map");return Rh=n,Rh}var Ah,Nk;function Gu(){if(Nk)return Ah;Nk=1;var e=Co(),t=e(Object,"create");return Ah=t,Ah}var Mh,Ek;function bF(){if(Ek)return Mh;Ek=1;var e=Gu();function t(){this.__data__=e?e(null):{},this.size=0}return Mh=t,Mh}var Ih,Ck;function kF(){if(Ck)return Ih;Ck=1;function e(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}return Ih=e,Ih}var Oh,jk;function _F(){if(jk)return Oh;jk=1;var e=Gu(),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 Oh=i,Oh}var Ph,Tk;function SF(){if(Tk)return Ph;Tk=1;var e=Gu(),t=Object.prototype,n=t.hasOwnProperty;function s(i){var a=this.__data__;return e?a[i]!==void 0:n.call(a,i)}return Ph=s,Ph}var $h,Rk;function NF(){if(Rk)return $h;Rk=1;var e=Gu(),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 $h=n,$h}var Lh,Ak;function EF(){if(Ak)return Lh;Ak=1;var e=bF(),t=kF(),n=_F(),s=SF(),i=NF();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,Lh=a,Lh}var qh,Mk;function CF(){if(Mk)return qh;Mk=1;var e=EF(),t=Hu(),n=Fw();function s(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return qh=s,qh}var Dh,Ik;function jF(){if(Ik)return Dh;Ik=1;function e(t){var n=typeof t;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?t!=="__proto__":t===null}return Dh=e,Dh}var Fh,Ok;function Vu(){if(Ok)return Fh;Ok=1;var e=jF();function t(n,s){var i=n.__data__;return e(s)?i[typeof s=="string"?"string":"hash"]:i.map}return Fh=t,Fh}var zh,Pk;function TF(){if(Pk)return zh;Pk=1;var e=Vu();function t(n){var s=e(this,n).delete(n);return this.size-=s?1:0,s}return zh=t,zh}var Bh,$k;function RF(){if($k)return Bh;$k=1;var e=Vu();function t(n){return e(this,n).get(n)}return Bh=t,Bh}var Uh,Lk;function AF(){if(Lk)return Uh;Lk=1;var e=Vu();function t(n){return e(this,n).has(n)}return Uh=t,Uh}var Wh,qk;function MF(){if(qk)return Wh;qk=1;var e=Vu();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 Wh=t,Wh}var Hh,Dk;function zw(){if(Dk)return Hh;Dk=1;var e=CF(),t=TF(),n=RF(),s=AF(),i=MF();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,Hh=a,Hh}var Gh,Fk;function IF(){if(Fk)return Gh;Fk=1;var e=Hu(),t=Fw(),n=zw(),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 Gh=i,Gh}var Vh,zk;function Yu(){if(zk)return Vh;zk=1;var e=Hu(),t=dF(),n=fF(),s=hF(),i=pF(),a=IF();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,Vh=l,Vh}var Yh,Bk;function Bw(){if(Bk)return Yh;Bk=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 Yh=e,Yh}var Kh,Uk;function XT(){if(Uk)return Kh;Uk=1;var e=Co(),t=(function(){try{var n=e(Object,"defineProperty");return n({},"",{}),n}catch{}})();return Kh=t,Kh}var Xh,Wk;function Ku(){if(Wk)return Xh;Wk=1;var e=XT();function t(n,s,i){s=="__proto__"&&e?e(n,s,{configurable:!0,enumerable:!0,value:i,writable:!0}):n[s]=i}return Xh=t,Xh}var Qh,Hk;function Xu(){if(Hk)return Qh;Hk=1;var e=Ku(),t=Zi(),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 Qh=i,Qh}var Zh,Gk;function jl(){if(Gk)return Zh;Gk=1;var e=Xu(),t=Ku();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 Zh=n,Zh}var Jh,Vk;function OF(){if(Vk)return Jh;Vk=1;function e(t,n){for(var s=-1,i=Array(t);++s<t;)i[s]=n(s);return i}return Jh=e,Jh}var ep,Yk;function jr(){if(Yk)return ep;Yk=1;function e(t){return t!=null&&typeof t=="object"}return ep=e,ep}var tp,Kk;function PF(){if(Kk)return tp;Kk=1;var e=Eo(),t=jr(),n="[object Arguments]";function s(i){return t(i)&&e(i)==n}return tp=s,tp}var np,Xk;function Tl(){if(Xk)return np;Xk=1;var e=PF(),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 np=a,np}var rp,Qk;function Mt(){if(Qk)return rp;Qk=1;var e=Array.isArray;return rp=e,rp}var Za={exports:{}},sp,Zk;function $F(){if(Zk)return sp;Zk=1;function e(){return!1}return sp=e,sp}Za.exports;var Jk;function ea(){return Jk||(Jk=1,(function(e,t){var n=cr(),s=$F(),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})(Za,Za.exports)),Za.exports}var op,e_;function Qu(){if(e_)return op;e_=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 op=n,op}var ip,t_;function Uw(){if(t_)return ip;t_=1;var e=9007199254740991;function t(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=e}return ip=t,ip}var ap,n_;function LF(){if(n_)return ap;n_=1;var e=Eo(),t=Uw(),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]",v="[object RegExp]",w="[object Set]",N="[object String]",b="[object WeakMap]",k="[object ArrayBuffer]",S="[object DataView]",E="[object Float32Array]",C="[object Float64Array]",j="[object Int8Array]",I="[object Int16Array]",O="[object Int32Array]",P="[object Uint8Array]",z="[object Uint8ClampedArray]",M="[object Uint16Array]",A="[object Uint32Array]",q={};q[E]=q[C]=q[j]=q[I]=q[O]=q[P]=q[z]=q[M]=q[A]=!0,q[s]=q[i]=q[k]=q[a]=q[S]=q[l]=q[u]=q[h]=q[p]=q[f]=q[g]=q[v]=q[w]=q[N]=q[b]=!1;function H(Y){return n(Y)&&t(Y.length)&&!!q[e(Y)]}return ap=H,ap}var lp,r_;function Zu(){if(r_)return lp;r_=1;function e(t){return function(n){return t(n)}}return lp=e,lp}var Ja={exports:{}};Ja.exports;var s_;function Ww(){return s_||(s_=1,(function(e,t){var n=YT(),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})(Ja,Ja.exports)),Ja.exports}var cp,o_;function Rl(){if(o_)return cp;o_=1;var e=LF(),t=Zu(),n=Ww(),s=n&&n.isTypedArray,i=s?t(s):e;return cp=i,cp}var up,i_;function QT(){if(i_)return up;i_=1;var e=OF(),t=Tl(),n=Mt(),s=ea(),i=Qu(),a=Rl(),l=Object.prototype,u=l.hasOwnProperty;function h(p,f){var g=n(p),v=!g&&t(p),w=!g&&!v&&s(p),N=!g&&!v&&!w&&a(p),b=g||v||w||N,k=b?e(p.length,String):[],S=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,S)))&&k.push(E);return k}return up=h,up}var dp,a_;function Ju(){if(a_)return dp;a_=1;var e=Object.prototype;function t(n){var s=n&&n.constructor,i=typeof s=="function"&&s.prototype||e;return n===i}return dp=t,dp}var fp,l_;function ZT(){if(l_)return fp;l_=1;function e(t,n){return function(s){return t(n(s))}}return fp=e,fp}var hp,c_;function qF(){if(c_)return hp;c_=1;var e=ZT(),t=e(Object.keys,Object);return hp=t,hp}var pp,u_;function Hw(){if(u_)return pp;u_=1;var e=Ju(),t=qF(),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 pp=i,pp}var mp,d_;function es(){if(d_)return mp;d_=1;var e=Cl(),t=Uw();function n(s){return s!=null&&t(s.length)&&!e(s)}return mp=n,mp}var gp,f_;function Ls(){if(f_)return gp;f_=1;var e=QT(),t=Hw(),n=es();function s(i){return n(i)?e(i):t(i)}return gp=s,gp}var yp,h_;function DF(){if(h_)return yp;h_=1;var e=jl(),t=Ls();function n(s,i){return s&&e(i,t(i),s)}return yp=n,yp}var vp,p_;function FF(){if(p_)return vp;p_=1;function e(t){var n=[];if(t!=null)for(var s in Object(t))n.push(s);return n}return vp=e,vp}var wp,m_;function zF(){if(m_)return wp;m_=1;var e=Ln(),t=Ju(),n=FF(),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 wp=a,wp}var xp,g_;function jo(){if(g_)return xp;g_=1;var e=QT(),t=zF(),n=es();function s(i){return n(i)?e(i,!0):t(i)}return xp=s,xp}var bp,y_;function BF(){if(y_)return bp;y_=1;var e=jl(),t=jo();function n(s,i){return s&&e(i,t(i),s)}return bp=n,bp}var el={exports:{}};el.exports;var v_;function JT(){return v_||(v_=1,(function(e,t){var n=cr(),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,v=u?u(g):new p.constructor(g);return p.copy(v),v}e.exports=h})(el,el.exports)),el.exports}var kp,w_;function eR(){if(w_)return kp;w_=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 kp=e,kp}var _p,x_;function tR(){if(x_)return _p;x_=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 _p=e,_p}var Sp,b_;function nR(){if(b_)return Sp;b_=1;function e(){return[]}return Sp=e,Sp}var Np,k_;function Gw(){if(k_)return Np;k_=1;var e=tR(),t=nR(),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 Np=a,Np}var Ep,__;function UF(){if(__)return Ep;__=1;var e=jl(),t=Gw();function n(s,i){return e(s,t(s),i)}return Ep=n,Ep}var Cp,S_;function Vw(){if(S_)return Cp;S_=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 Cp=e,Cp}var jp,N_;function ed(){if(N_)return jp;N_=1;var e=ZT(),t=e(Object.getPrototypeOf,Object);return jp=t,jp}var Tp,E_;function rR(){if(E_)return Tp;E_=1;var e=Vw(),t=ed(),n=Gw(),s=nR(),i=Object.getOwnPropertySymbols,a=i?function(l){for(var u=[];l;)e(u,n(l)),l=t(l);return u}:s;return Tp=a,Tp}var Rp,C_;function WF(){if(C_)return Rp;C_=1;var e=jl(),t=rR();function n(s,i){return e(s,t(s),i)}return Rp=n,Rp}var Ap,j_;function sR(){if(j_)return Ap;j_=1;var e=Vw(),t=Mt();function n(s,i,a){var l=i(s);return t(s)?l:e(l,a(s))}return Ap=n,Ap}var Mp,T_;function oR(){if(T_)return Mp;T_=1;var e=sR(),t=Gw(),n=Ls();function s(i){return e(i,n,t)}return Mp=s,Mp}var Ip,R_;function HF(){if(R_)return Ip;R_=1;var e=sR(),t=rR(),n=jo();function s(i){return e(i,n,t)}return Ip=s,Ip}var Op,A_;function GF(){if(A_)return Op;A_=1;var e=Co(),t=cr(),n=e(t,"DataView");return Op=n,Op}var Pp,M_;function VF(){if(M_)return Pp;M_=1;var e=Co(),t=cr(),n=e(t,"Promise");return Pp=n,Pp}var $p,I_;function iR(){if(I_)return $p;I_=1;var e=Co(),t=cr(),n=e(t,"Set");return $p=n,$p}var Lp,O_;function YF(){if(O_)return Lp;O_=1;var e=Co(),t=cr(),n=e(t,"WeakMap");return Lp=n,Lp}var qp,P_;function ta(){if(P_)return qp;P_=1;var e=GF(),t=Fw(),n=VF(),s=iR(),i=YF(),a=Eo(),l=KT(),u="[object Map]",h="[object Object]",p="[object Promise]",f="[object Set]",g="[object WeakMap]",v="[object DataView]",w=l(e),N=l(t),b=l(n),k=l(s),S=l(i),E=a;return(e&&E(new e(new ArrayBuffer(1)))!=v||t&&E(new t)!=u||n&&E(n.resolve())!=p||s&&E(new s)!=f||i&&E(new i)!=g)&&(E=function(C){var j=a(C),I=j==h?C.constructor:void 0,O=I?l(I):"";if(O)switch(O){case w:return v;case N:return u;case b:return p;case k:return f;case S:return g}return j}),qp=E,qp}var Dp,$_;function KF(){if($_)return Dp;$_=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 Dp=n,Dp}var Fp,L_;function aR(){if(L_)return Fp;L_=1;var e=cr(),t=e.Uint8Array;return Fp=t,Fp}var zp,q_;function Yw(){if(q_)return zp;q_=1;var e=aR();function t(n){var s=new n.constructor(n.byteLength);return new e(s).set(new e(n)),s}return zp=t,zp}var Bp,D_;function XF(){if(D_)return Bp;D_=1;var e=Yw();function t(n,s){var i=s?e(n.buffer):n.buffer;return new n.constructor(i,n.byteOffset,n.byteLength)}return Bp=t,Bp}var Up,F_;function QF(){if(F_)return Up;F_=1;var e=/\w*$/;function t(n){var s=new n.constructor(n.source,e.exec(n));return s.lastIndex=n.lastIndex,s}return Up=t,Up}var Wp,z_;function ZF(){if(z_)return Wp;z_=1;var e=Ji(),t=e?e.prototype:void 0,n=t?t.valueOf:void 0;function s(i){return n?Object(n.call(i)):{}}return Wp=s,Wp}var Hp,B_;function lR(){if(B_)return Hp;B_=1;var e=Yw();function t(n,s){var i=s?e(n.buffer):n.buffer;return new n.constructor(i,n.byteOffset,n.length)}return Hp=t,Hp}var Gp,U_;function JF(){if(U_)return Gp;U_=1;var e=Yw(),t=XF(),n=QF(),s=ZF(),i=lR(),a="[object Boolean]",l="[object Date]",u="[object Map]",h="[object Number]",p="[object RegExp]",f="[object Set]",g="[object String]",v="[object Symbol]",w="[object ArrayBuffer]",N="[object DataView]",b="[object Float32Array]",k="[object Float64Array]",S="[object Int8Array]",E="[object Int16Array]",C="[object Int32Array]",j="[object Uint8Array]",I="[object Uint8ClampedArray]",O="[object Uint16Array]",P="[object Uint32Array]";function z(M,A,q){var H=M.constructor;switch(A){case w:return e(M);case a:case l:return new H(+M);case N:return t(M,q);case b:case k:case S:case E:case C:case j:case I:case O:case P:return i(M,q);case u:return new H;case h:case g:return new H(M);case p:return n(M);case f:return new H;case v:return s(M)}}return Gp=z,Gp}var Vp,W_;function cR(){if(W_)return Vp;W_=1;var e=Ln(),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 Vp=n,Vp}var Yp,H_;function uR(){if(H_)return Yp;H_=1;var e=cR(),t=ed(),n=Ju();function s(i){return typeof i.constructor=="function"&&!n(i)?e(t(i)):{}}return Yp=s,Yp}var Kp,G_;function e6(){if(G_)return Kp;G_=1;var e=ta(),t=jr(),n="[object Map]";function s(i){return t(i)&&e(i)==n}return Kp=s,Kp}var Xp,V_;function t6(){if(V_)return Xp;V_=1;var e=e6(),t=Zu(),n=Ww(),s=n&&n.isMap,i=s?t(s):e;return Xp=i,Xp}var Qp,Y_;function n6(){if(Y_)return Qp;Y_=1;var e=ta(),t=jr(),n="[object Set]";function s(i){return t(i)&&e(i)==n}return Qp=s,Qp}var Zp,K_;function r6(){if(K_)return Zp;K_=1;var e=n6(),t=Zu(),n=Ww(),s=n&&n.isSet,i=s?t(s):e;return Zp=i,Zp}var Jp,X_;function dR(){if(X_)return Jp;X_=1;var e=Yu(),t=Bw(),n=Xu(),s=DF(),i=BF(),a=JT(),l=eR(),u=UF(),h=WF(),p=oR(),f=HF(),g=ta(),v=KF(),w=JF(),N=uR(),b=Mt(),k=ea(),S=t6(),E=Ln(),C=r6(),j=Ls(),I=jo(),O=1,P=2,z=4,M="[object Arguments]",A="[object Array]",q="[object Boolean]",H="[object Date]",Y="[object Error]",R="[object Function]",Q="[object GeneratorFunction]",W="[object Map]",ne="[object Number]",X="[object Object]",B="[object RegExp]",J="[object Set]",$="[object String]",V="[object Symbol]",Z="[object WeakMap]",F="[object ArrayBuffer]",L="[object DataView]",K="[object Float32Array]",se="[object Float64Array]",he="[object Int8Array]",me="[object Int16Array]",xe="[object Int32Array]",Ee="[object Uint8Array]",He="[object Uint8ClampedArray]",Fe="[object Uint16Array]",Ie="[object Uint32Array]",be={};be[M]=be[A]=be[F]=be[L]=be[q]=be[H]=be[K]=be[se]=be[he]=be[me]=be[xe]=be[W]=be[ne]=be[X]=be[B]=be[J]=be[$]=be[V]=be[Ee]=be[He]=be[Fe]=be[Ie]=!0,be[Y]=be[R]=be[Z]=!1;function ue(re,pe,Oe,rt,ot,Xe){var Pe,Be=pe&O,Ge=pe&P,it=pe&z;if(Oe&&(Pe=ot?Oe(re,rt,ot,Xe):Oe(re)),Pe!==void 0)return Pe;if(!E(re))return re;var ke=b(re);if(ke){if(Pe=v(re),!Be)return l(re,Pe)}else{var ct=g(re),It=ct==R||ct==Q;if(k(re))return a(re,Be);if(ct==X||ct==M||It&&!ot){if(Pe=Ge||It?{}:N(re),!Be)return Ge?h(re,i(Pe,re)):u(re,s(Pe,re))}else{if(!be[ct])return ot?re:{};Pe=w(re,ct,Be)}}Xe||(Xe=new e);var ae=Xe.get(re);if(ae)return ae;Xe.set(re,Pe),C(re)?re.forEach(function(Ce){Pe.add(ue(Ce,pe,Oe,Ce,re,Xe))}):S(re)&&re.forEach(function(Ce,Ve){Pe.set(Ve,ue(Ce,pe,Oe,Ve,re,Xe))});var Le=it?Ge?f:p:Ge?I:j,ze=ke?void 0:Le(re);return t(ze||re,function(Ce,Ve){ze&&(Ve=Ce,Ce=re[Ve]),n(Pe,Ve,ue(Ce,pe,Oe,Ve,re,Xe))}),Pe}return Jp=ue,Jp}var em,Q_;function s6(){if(Q_)return em;Q_=1;var e=dR(),t=4;function n(s){return e(s,t)}return em=n,em}var tm,Z_;function Kw(){if(Z_)return tm;Z_=1;function e(t){return function(){return t}}return tm=e,tm}var nm,J_;function o6(){if(J_)return nm;J_=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 nm=e,nm}var rm,eS;function Xw(){if(eS)return rm;eS=1;var e=o6(),t=e();return rm=t,rm}var sm,tS;function Qw(){if(tS)return sm;tS=1;var e=Xw(),t=Ls();function n(s,i){return s&&e(s,i,t)}return sm=n,sm}var om,nS;function i6(){if(nS)return om;nS=1;var e=es();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 om=t,om}var im,rS;function td(){if(rS)return im;rS=1;var e=Qw(),t=i6(),n=t(e);return im=n,im}var am,sS;function To(){if(sS)return am;sS=1;function e(t){return t}return am=e,am}var lm,oS;function fR(){if(oS)return lm;oS=1;var e=To();function t(n){return typeof n=="function"?n:e}return lm=t,lm}var cm,iS;function hR(){if(iS)return cm;iS=1;var e=Bw(),t=td(),n=fR(),s=Mt();function i(a,l){var u=s(a)?e:t;return u(a,n(l))}return cm=i,cm}var um,aS;function pR(){return aS||(aS=1,um=hR()),um}var dm,lS;function a6(){if(lS)return dm;lS=1;var e=td();function t(n,s){var i=[];return e(n,function(a,l,u){s(a,l,u)&&i.push(a)}),i}return dm=t,dm}var fm,cS;function l6(){if(cS)return fm;cS=1;var e="__lodash_hash_undefined__";function t(n){return this.__data__.set(n,e),this}return fm=t,fm}var hm,uS;function c6(){if(uS)return hm;uS=1;function e(t){return this.__data__.has(t)}return hm=e,hm}var pm,dS;function mR(){if(dS)return pm;dS=1;var e=zw(),t=l6(),n=c6();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,pm=s,pm}var mm,fS;function u6(){if(fS)return mm;fS=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 mm=e,mm}var gm,hS;function gR(){if(hS)return gm;hS=1;function e(t,n){return t.has(n)}return gm=e,gm}var ym,pS;function yR(){if(pS)return ym;pS=1;var e=mR(),t=u6(),n=gR(),s=1,i=2;function a(l,u,h,p,f,g){var v=h&s,w=l.length,N=u.length;if(w!=N&&!(v&&N>w))return!1;var b=g.get(l),k=g.get(u);if(b&&k)return b==u&&k==l;var S=-1,E=!0,C=h&i?new e:void 0;for(g.set(l,u),g.set(u,l);++S<w;){var j=l[S],I=u[S];if(p)var O=v?p(I,j,S,u,l,g):p(j,I,S,l,u,g);if(O!==void 0){if(O)continue;E=!1;break}if(C){if(!t(u,function(P,z){if(!n(C,z)&&(j===P||f(j,P,h,p,g)))return C.push(z)})){E=!1;break}}else if(!(j===I||f(j,I,h,p,g))){E=!1;break}}return g.delete(l),g.delete(u),E}return ym=a,ym}var vm,mS;function d6(){if(mS)return vm;mS=1;function e(t){var n=-1,s=Array(t.size);return t.forEach(function(i,a){s[++n]=[a,i]}),s}return vm=e,vm}var wm,gS;function Zw(){if(gS)return wm;gS=1;function e(t){var n=-1,s=Array(t.size);return t.forEach(function(i){s[++n]=i}),s}return wm=e,wm}var xm,yS;function f6(){if(yS)return xm;yS=1;var e=Ji(),t=aR(),n=Zi(),s=yR(),i=d6(),a=Zw(),l=1,u=2,h="[object Boolean]",p="[object Date]",f="[object Error]",g="[object Map]",v="[object Number]",w="[object RegExp]",N="[object Set]",b="[object String]",k="[object Symbol]",S="[object ArrayBuffer]",E="[object DataView]",C=e?e.prototype:void 0,j=C?C.valueOf:void 0;function I(O,P,z,M,A,q,H){switch(z){case E:if(O.byteLength!=P.byteLength||O.byteOffset!=P.byteOffset)return!1;O=O.buffer,P=P.buffer;case S:return!(O.byteLength!=P.byteLength||!q(new t(O),new t(P)));case h:case p:case v:return n(+O,+P);case f:return O.name==P.name&&O.message==P.message;case w:case b:return O==P+"";case g:var Y=i;case N:var R=M&l;if(Y||(Y=a),O.size!=P.size&&!R)return!1;var Q=H.get(O);if(Q)return Q==P;M|=u,H.set(O,P);var W=s(Y(O),Y(P),M,A,q,H);return H.delete(O),W;case k:if(j)return j.call(O)==j.call(P)}return!1}return xm=I,xm}var bm,vS;function h6(){if(vS)return bm;vS=1;var e=oR(),t=1,n=Object.prototype,s=n.hasOwnProperty;function i(a,l,u,h,p,f){var g=u&t,v=e(a),w=v.length,N=e(l),b=N.length;if(w!=b&&!g)return!1;for(var k=w;k--;){var S=v[k];if(!(g?S in l:s.call(l,S)))return!1}var E=f.get(a),C=f.get(l);if(E&&C)return E==l&&C==a;var j=!0;f.set(a,l),f.set(l,a);for(var I=g;++k<w;){S=v[k];var O=a[S],P=l[S];if(h)var z=g?h(P,O,S,l,a,f):h(O,P,S,a,l,f);if(!(z===void 0?O===P||p(O,P,u,h,f):z)){j=!1;break}I||(I=S=="constructor")}if(j&&!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)&&(j=!1)}return f.delete(a),f.delete(l),j}return bm=i,bm}var km,wS;function p6(){if(wS)return km;wS=1;var e=Yu(),t=yR(),n=f6(),s=h6(),i=ta(),a=Mt(),l=ea(),u=Rl(),h=1,p="[object Arguments]",f="[object Array]",g="[object Object]",v=Object.prototype,w=v.hasOwnProperty;function N(b,k,S,E,C,j){var I=a(b),O=a(k),P=I?f:i(b),z=O?f:i(k);P=P==p?g:P,z=z==p?g:z;var M=P==g,A=z==g,q=P==z;if(q&&l(b)){if(!l(k))return!1;I=!0,M=!1}if(q&&!M)return j||(j=new e),I||u(b)?t(b,k,S,E,C,j):n(b,k,P,S,E,C,j);if(!(S&h)){var H=M&&w.call(b,"__wrapped__"),Y=A&&w.call(k,"__wrapped__");if(H||Y){var R=H?b.value():b,Q=Y?k.value():k;return j||(j=new e),C(R,Q,S,E,j)}}return q?(j||(j=new e),s(b,k,S,E,C,j)):!1}return km=N,km}var _m,xS;function vR(){if(xS)return _m;xS=1;var e=p6(),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 _m=n,_m}var Sm,bS;function m6(){if(bS)return Sm;bS=1;var e=Yu(),t=vR(),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 v=u[p];if(g&&v[2]?v[1]!==a[v[0]]:!(v[0]in a))return!1}for(;++p<f;){v=u[p];var w=v[0],N=a[w],b=v[1];if(g&&v[2]){if(N===void 0&&!(w in a))return!1}else{var k=new e;if(h)var S=h(N,b,w,a,l,k);if(!(S===void 0?t(b,N,n|s,h,k):S))return!1}}return!0}return Sm=i,Sm}var Nm,kS;function wR(){if(kS)return Nm;kS=1;var e=Ln();function t(n){return n===n&&!e(n)}return Nm=t,Nm}var Em,_S;function g6(){if(_S)return Em;_S=1;var e=wR(),t=Ls();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 Em=n,Em}var Cm,SS;function xR(){if(SS)return Cm;SS=1;function e(t,n){return function(s){return s==null?!1:s[t]===n&&(n!==void 0||t in Object(s))}}return Cm=e,Cm}var jm,NS;function y6(){if(NS)return jm;NS=1;var e=m6(),t=g6(),n=xR();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 jm=s,jm}var Tm,ES;function na(){if(ES)return Tm;ES=1;var e=Eo(),t=jr(),n="[object Symbol]";function s(i){return typeof i=="symbol"||t(i)&&e(i)==n}return Tm=s,Tm}var Rm,CS;function Jw(){if(CS)return Rm;CS=1;var e=Mt(),t=na(),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 Rm=i,Rm}var Am,jS;function v6(){if(jS)return Am;jS=1;var e=zw(),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,Am=n,Am}var Mm,TS;function w6(){if(TS)return Mm;TS=1;var e=v6(),t=500;function n(s){var i=e(s,function(l){return a.size===t&&a.clear(),l}),a=i.cache;return i}return Mm=n,Mm}var Im,RS;function x6(){if(RS)return Im;RS=1;var e=w6(),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 Im=s,Im}var Om,AS;function nd(){if(AS)return Om;AS=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 Om=e,Om}var Pm,MS;function b6(){if(MS)return Pm;MS=1;var e=Ji(),t=nd(),n=Mt(),s=na(),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 Pm=l,Pm}var $m,IS;function bR(){if(IS)return $m;IS=1;var e=b6();function t(n){return n==null?"":e(n)}return $m=t,$m}var Lm,OS;function rd(){if(OS)return Lm;OS=1;var e=Mt(),t=Jw(),n=x6(),s=bR();function i(a,l){return e(a)?a:t(a,l)?[a]:n(s(a))}return Lm=i,Lm}var qm,PS;function Al(){if(PS)return qm;PS=1;var e=na();function t(n){if(typeof n=="string"||e(n))return n;var s=n+"";return s=="0"&&1/n==-1/0?"-0":s}return qm=t,qm}var Dm,$S;function sd(){if($S)return Dm;$S=1;var e=rd(),t=Al();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 Dm=n,Dm}var Fm,LS;function k6(){if(LS)return Fm;LS=1;var e=sd();function t(n,s,i){var a=n==null?void 0:e(n,s);return a===void 0?i:a}return Fm=t,Fm}var zm,qS;function _6(){if(qS)return zm;qS=1;function e(t,n){return t!=null&&n in Object(t)}return zm=e,zm}var Bm,DS;function kR(){if(DS)return Bm;DS=1;var e=rd(),t=Tl(),n=Mt(),s=Qu(),i=Uw(),a=Al();function l(u,h,p){h=e(h,u);for(var f=-1,g=h.length,v=!1;++f<g;){var w=a(h[f]);if(!(v=u!=null&&p(u,w)))break;u=u[w]}return v||++f!=g?v:(g=u==null?0:u.length,!!g&&i(g)&&s(w,g)&&(n(u)||t(u)))}return Bm=l,Bm}var Um,FS;function _R(){if(FS)return Um;FS=1;var e=_6(),t=kR();function n(s,i){return s!=null&&t(s,i,e)}return Um=n,Um}var Wm,zS;function S6(){if(zS)return Wm;zS=1;var e=vR(),t=k6(),n=_R(),s=Jw(),i=wR(),a=xR(),l=Al(),u=1,h=2;function p(f,g){return s(f)&&i(g)?a(l(f),g):function(v){var w=t(v,f);return w===void 0&&w===g?n(v,f):e(g,w,u|h)}}return Wm=p,Wm}var Hm,BS;function SR(){if(BS)return Hm;BS=1;function e(t){return function(n){return n==null?void 0:n[t]}}return Hm=e,Hm}var Gm,US;function N6(){if(US)return Gm;US=1;var e=sd();function t(n){return function(s){return e(s,n)}}return Gm=t,Gm}var Vm,WS;function E6(){if(WS)return Vm;WS=1;var e=SR(),t=N6(),n=Jw(),s=Al();function i(a){return n(a)?e(s(a)):t(a)}return Vm=i,Vm}var Ym,HS;function ts(){if(HS)return Ym;HS=1;var e=y6(),t=S6(),n=To(),s=Mt(),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 Ym=a,Ym}var Km,GS;function NR(){if(GS)return Km;GS=1;var e=tR(),t=a6(),n=ts(),s=Mt();function i(a,l){var u=s(a)?e:t;return u(a,n(l,3))}return Km=i,Km}var Xm,VS;function C6(){if(VS)return Xm;VS=1;var e=Object.prototype,t=e.hasOwnProperty;function n(s,i){return s!=null&&t.call(s,i)}return Xm=n,Xm}var Qm,YS;function ER(){if(YS)return Qm;YS=1;var e=C6(),t=kR();function n(s,i){return s!=null&&t(s,i,e)}return Qm=n,Qm}var Zm,KS;function j6(){if(KS)return Zm;KS=1;var e=Hw(),t=ta(),n=Tl(),s=Mt(),i=es(),a=ea(),l=Ju(),u=Rl(),h="[object Map]",p="[object Set]",f=Object.prototype,g=f.hasOwnProperty;function v(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 Zm=v,Zm}var Jm,XS;function CR(){if(XS)return Jm;XS=1;function e(t){return t===void 0}return Jm=e,Jm}var eg,QS;function jR(){if(QS)return eg;QS=1;var e=td(),t=es();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 eg=n,eg}var tg,ZS;function TR(){if(ZS)return tg;ZS=1;var e=nd(),t=ts(),n=jR(),s=Mt();function i(a,l){var u=s(a)?e:n;return u(a,t(l,3))}return tg=i,tg}var ng,JS;function T6(){if(JS)return ng;JS=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 ng=e,ng}var rg,eN;function R6(){if(eN)return rg;eN=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 rg=e,rg}var sg,tN;function RR(){if(tN)return sg;tN=1;var e=T6(),t=td(),n=ts(),s=R6(),i=Mt();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 sg=a,sg}var og,nN;function A6(){if(nN)return og;nN=1;var e=Eo(),t=Mt(),n=jr(),s="[object String]";function i(a){return typeof a=="string"||!t(a)&&n(a)&&e(a)==s}return og=i,og}var ig,rN;function M6(){if(rN)return ig;rN=1;var e=SR(),t=e("length");return ig=t,ig}var ag,sN;function I6(){if(sN)return ag;sN=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 ag=h,ag}var lg,oN;function O6(){if(oN)return lg;oN=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}",v="[\\ud800-\\udbff][\\udc00-\\udfff]",w="\\u200d",N=p+"?",b="["+a+"]?",k="(?:"+w+"(?:"+[f,g,v].join("|")+")"+b+N+")*",S=b+N+k,E="(?:"+[f+u+"?",u,g,v,l].join("|")+")",C=RegExp(h+"(?="+h+")|"+E+S,"g");function j(I){for(var O=C.lastIndex=0;C.test(I);)++O;return O}return lg=j,lg}var cg,iN;function P6(){if(iN)return cg;iN=1;var e=M6(),t=I6(),n=O6();function s(i){return t(i)?n(i):e(i)}return cg=s,cg}var ug,aN;function $6(){if(aN)return ug;aN=1;var e=Hw(),t=ta(),n=es(),s=A6(),i=P6(),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 ug=u,ug}var dg,lN;function L6(){if(lN)return dg;lN=1;var e=Bw(),t=cR(),n=Qw(),s=ts(),i=ed(),a=Mt(),l=ea(),u=Cl(),h=Ln(),p=Rl();function f(g,v,w){var N=a(g),b=N||l(g)||p(g);if(v=s(v,4),w==null){var k=g&&g.constructor;b?w=N?new k:[]:h(g)?w=u(k)?t(i(g)):{}:w={}}return(b?e:n)(g,function(S,E,C){return v(w,S,E,C)}),w}return dg=f,dg}var fg,cN;function q6(){if(cN)return fg;cN=1;var e=Ji(),t=Tl(),n=Mt(),s=e?e.isConcatSpreadable:void 0;function i(a){return n(a)||t(a)||!!(s&&a&&a[s])}return fg=i,fg}var hg,uN;function e0(){if(uN)return hg;uN=1;var e=Vw(),t=q6();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 hg=n,hg}var pg,dN;function D6(){if(dN)return pg;dN=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 pg=e,pg}var mg,fN;function AR(){if(fN)return mg;fN=1;var e=D6(),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 mg=n,mg}var gg,hN;function F6(){if(hN)return gg;hN=1;var e=Kw(),t=XT(),n=To(),s=t?function(i,a){return t(i,"toString",{configurable:!0,enumerable:!1,value:e(a),writable:!0})}:n;return gg=s,gg}var yg,pN;function z6(){if(pN)return yg;pN=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 yg=s,yg}var vg,mN;function MR(){if(mN)return vg;mN=1;var e=F6(),t=z6(),n=t(e);return vg=n,vg}var wg,gN;function od(){if(gN)return wg;gN=1;var e=To(),t=AR(),n=MR();function s(i,a){return n(t(i,a,e),i+"")}return wg=s,wg}var xg,yN;function IR(){if(yN)return xg;yN=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 xg=e,xg}var bg,vN;function B6(){if(vN)return bg;vN=1;function e(t){return t!==t}return bg=e,bg}var kg,wN;function U6(){if(wN)return kg;wN=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 kg=e,kg}var _g,xN;function W6(){if(xN)return _g;xN=1;var e=IR(),t=B6(),n=U6();function s(i,a,l){return a===a?n(i,a,l):e(i,t,l)}return _g=s,_g}var Sg,bN;function H6(){if(bN)return Sg;bN=1;var e=W6();function t(n,s){var i=n==null?0:n.length;return!!i&&e(n,s,0)>-1}return Sg=t,Sg}var Ng,kN;function G6(){if(kN)return Ng;kN=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 Ng=e,Ng}var Eg,_N;function V6(){if(_N)return Eg;_N=1;function e(){}return Eg=e,Eg}var Cg,SN;function Y6(){if(SN)return Cg;SN=1;var e=iR(),t=V6(),n=Zw(),s=1/0,i=e&&1/n(new e([,-0]))[1]==s?function(a){return new e(a)}:t;return Cg=i,Cg}var jg,NN;function K6(){if(NN)return jg;NN=1;var e=mR(),t=H6(),n=G6(),s=gR(),i=Y6(),a=Zw(),l=200;function u(h,p,f){var g=-1,v=t,w=h.length,N=!0,b=[],k=b;if(f)N=!1,v=n;else if(w>=l){var S=p?null:i(h);if(S)return a(S);N=!1,v=s,k=new e}else k=p?[]:b;e:for(;++g<w;){var E=h[g],C=p?p(E):E;if(E=f||E!==0?E:0,N&&C===C){for(var j=k.length;j--;)if(k[j]===C)continue e;p&&k.push(C),b.push(E)}else v(k,C,f)||(k!==b&&k.push(C),b.push(E))}return b}return jg=u,jg}var Tg,EN;function OR(){if(EN)return Tg;EN=1;var e=es(),t=jr();function n(s){return t(s)&&e(s)}return Tg=n,Tg}var Rg,CN;function X6(){if(CN)return Rg;CN=1;var e=e0(),t=od(),n=K6(),s=OR(),i=t(function(a){return n(e(a,1,s,!0))});return Rg=i,Rg}var Ag,jN;function Q6(){if(jN)return Ag;jN=1;var e=nd();function t(n,s){return e(s,function(i){return n[i]})}return Ag=t,Ag}var Mg,TN;function PR(){if(TN)return Mg;TN=1;var e=Q6(),t=Ls();function n(s){return s==null?[]:e(s,t(s))}return Mg=n,Mg}var Ig,RN;function qn(){if(RN)return Ig;RN=1;var e;if(typeof Dw=="function")try{e={clone:s6(),constant:Kw(),each:pR(),filter:NR(),has:ER(),isArray:Mt(),isEmpty:j6(),isFunction:Cl(),isUndefined:CR(),keys:Ls(),map:TR(),reduce:RR(),size:$6(),transform:L6(),union:X6(),values:PR()}}catch{}return e||(e=window._),Ig=e,Ig}var Og,AN;function t0(){if(AN)return Og;AN=1;var e=qn();Og=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 v=arguments,w=this;return e.each(f,function(N){v.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 v=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]),v),delete this._in[f],delete this._preds[f],e.each(e.keys(this._out[f]),v),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 v=g;!e.isUndefined(v);v=this.parent(v))if(v===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 v=this;e.each(this._nodes,function(b,k){f(k)&&g.setNode(k,b)}),e.each(this._edgeObjs,function(b){g.hasNode(b.v)&&g.hasNode(b.w)&&g.setEdge(b,v.edge(b))});var w={};function N(b){var k=v.parent(b);return k===void 0||g.hasNode(k)?(w[b]=k,k):k in w?w[k]:N(k)}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 v=this,w=arguments;return e.reduce(f,function(N,b){return w.length>1?v.setEdge(N,b,g):v.setEdge(N,b),b}),this},i.prototype.setEdge=function(){var f,g,v,w,N=!1,b=arguments[0];typeof b=="object"&&b!==null&&"v"in b?(f=b.v,g=b.w,v=b.name,arguments.length===2&&(w=arguments[1],N=!0)):(f=b,g=arguments[1],v=arguments[3],arguments.length>2&&(w=arguments[2],N=!0)),f=""+f,g=""+g,e.isUndefined(v)||(v=""+v);var k=u(this._isDirected,f,g,v);if(e.has(this._edgeLabels,k))return N&&(this._edgeLabels[k]=w),this;if(!e.isUndefined(v)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(f),this.setNode(g),this._edgeLabels[k]=N?w:this._defaultEdgeLabelFn(f,g,v);var S=h(this._isDirected,f,g,v);return f=S.v,g=S.w,Object.freeze(S),this._edgeObjs[k]=S,a(this._preds[g],f),a(this._sucs[f],g),this._in[g][k]=S,this._out[f][k]=S,this._edgeCount++,this},i.prototype.edge=function(f,g,v){var w=arguments.length===1?p(this._isDirected,arguments[0]):u(this._isDirected,f,g,v);return this._edgeLabels[w]},i.prototype.hasEdge=function(f,g,v){var w=arguments.length===1?p(this._isDirected,arguments[0]):u(this._isDirected,f,g,v);return e.has(this._edgeLabels,w)},i.prototype.removeEdge=function(f,g,v){var w=arguments.length===1?p(this._isDirected,arguments[0]):u(this._isDirected,f,g,v),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 v=this._in[f];if(v){var w=e.values(v);return g?e.filter(w,function(N){return N.v===g}):w}},i.prototype.outEdges=function(f,g){var v=this._out[f];if(v){var w=e.values(v);return g?e.filter(w,function(N){return N.w===g}):w}},i.prototype.nodeEdges=function(f,g){var v=this.inEdges(f,g);if(v)return v.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,v,w){var N=""+g,b=""+v;if(!f&&N>b){var k=N;N=b,b=k}return N+s+b+s+(e.isUndefined(w)?t:w)}function h(f,g,v,w){var N=""+g,b=""+v;if(!f&&N>b){var k=N;N=b,b=k}var S={v:N,w:b};return w&&(S.name=w),S}function p(f,g){return u(f,g.v,g.w,g.name)}return Og}var Pg,MN;function Z6(){return MN||(MN=1,Pg="2.1.8"),Pg}var $g,IN;function J6(){return IN||(IN=1,$g={Graph:t0(),version:Z6()}),$g}var Lg,ON;function ez(){if(ON)return Lg;ON=1;var e=qn(),t=t0();Lg={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 Lg}var qg,PN;function tz(){if(PN)return qg;PN=1;var e=qn();qg=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 qg}var Dg,$N;function $R(){if($N)return Dg;$N=1;var e=qn();Dg=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},Dg}var Fg,LN;function LR(){if(LN)return Fg;LN=1;var e=qn(),t=$R();Fg=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,v,w=function(N){var b=N.v!==g?N.v:N.w,k=p[b],S=u(N),E=v.distance+S;if(S<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+N+" Weight: "+S);E<k.distance&&(k.distance=E,k.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(),v=p[g],v.distance!==Number.POSITIVE_INFINITY);)h(g).forEach(w);return p}return Fg}var zg,qN;function nz(){if(qN)return zg;qN=1;var e=LR(),t=qn();zg=n;function n(s,i,a){return t.transform(s.nodes(),function(l,u){l[u]=e(s,u,i,a)},{})}return zg}var Bg,DN;function qR(){if(DN)return Bg;DN=1;var e=qn();Bg=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(v){e.has(a,v)?a[v].onStack&&(p.lowlink=Math.min(p.lowlink,a[v].index)):(u(v),p.lowlink=Math.min(p.lowlink,a[v].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 Bg}var Ug,FN;function rz(){if(FN)return Ug;FN=1;var e=qn(),t=qR();Ug=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 Ug}var Wg,zN;function sz(){if(zN)return Wg;zN=1;var e=qn();Wg=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,v=a(f);u[p][g]={distance:v,predecessor:p}})}),h.forEach(function(p){var f=u[p];h.forEach(function(g){var v=u[g];h.forEach(function(w){var N=v[p],b=f[w],k=v[w],S=N.distance+b.distance;S<k.distance&&(k.distance=S,k.predecessor=b.predecessor)})})}),u}return Wg}var Hg,BN;function DR(){if(BN)return Hg;BN=1;var e=qn();Hg=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,Hg}var Gg,UN;function oz(){if(UN)return Gg;UN=1;var e=DR();Gg=t;function t(n){try{e(n)}catch(s){if(s instanceof e.CycleException)return!1;throw s}return!0}return Gg}var Vg,WN;function FR(){if(WN)return Vg;WN=1;var e=qn();Vg=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 Vg}var Yg,HN;function iz(){if(HN)return Yg;HN=1;var e=FR();Yg=t;function t(n,s){return e(n,s,"post")}return Yg}var Kg,GN;function az(){if(GN)return Kg;GN=1;var e=FR();Kg=t;function t(n,s){return e(n,s,"pre")}return Kg}var Xg,VN;function lz(){if(VN)return Xg;VN=1;var e=qn(),t=t0(),n=$R();Xg=s;function s(i,a){var l=new t,u={},h=new n,p;function f(v){var w=v.v===p?v.w:v.v,N=h.priority(w);if(N!==void 0){var b=a(v);b<N&&(u[w]=p,h.decrease(w,b))}}if(i.nodeCount()===0)return l;e.each(i.nodes(),function(v){h.add(v,Number.POSITIVE_INFINITY),l.setNode(v)}),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 Xg}var Qg,YN;function cz(){return YN||(YN=1,Qg={components:tz(),dijkstra:LR(),dijkstraAll:nz(),findCycles:rz(),floydWarshall:sz(),isAcyclic:oz(),postorder:iz(),preorder:az(),prim:lz(),tarjan:qR(),topsort:DR()}),Qg}var Zg,KN;function uz(){if(KN)return Zg;KN=1;var e=J6();return Zg={Graph:e.Graph,json:ez(),alg:cz(),version:e.version},Zg}var Jg,XN;function ar(){if(XN)return Jg;XN=1;var e;if(typeof Dw=="function")try{e=uz()}catch{}return e||(e=window.graphlib),Jg=e,Jg}var ey,QN;function dz(){if(QN)return ey;QN=1;var e=dR(),t=1,n=4;function s(i){return e(i,t|n)}return ey=s,ey}var ty,ZN;function id(){if(ZN)return ty;ZN=1;var e=Zi(),t=es(),n=Qu(),s=Ln();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 ty=i,ty}var ny,JN;function fz(){if(JN)return ny;JN=1;var e=od(),t=Zi(),n=id(),s=jo(),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 v=h[p],w=s(v),N=-1,b=w.length;++N<b;){var k=w[N],S=u[k];(S===void 0||t(S,i[k])&&!a.call(u,k))&&(u[k]=v[k])}return u});return ny=l,ny}var ry,eE;function hz(){if(eE)return ry;eE=1;var e=ts(),t=es(),n=Ls();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 ry=s,ry}var sy,tE;function pz(){if(tE)return sy;tE=1;var e=/\s/;function t(n){for(var s=n.length;s--&&e.test(n.charAt(s)););return s}return sy=t,sy}var oy,nE;function mz(){if(nE)return oy;nE=1;var e=pz(),t=/^\s+/;function n(s){return s&&s.slice(0,e(s)+1).replace(t,"")}return oy=n,oy}var iy,rE;function gz(){if(rE)return iy;rE=1;var e=mz(),t=Ln(),n=na(),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 iy=h,iy}var ay,sE;function zR(){if(sE)return ay;sE=1;var e=gz(),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 ay=s,ay}var ly,oE;function yz(){if(oE)return ly;oE=1;var e=zR();function t(n){var s=e(n),i=s%1;return s===s?i?s-i:s:0}return ly=t,ly}var cy,iE;function vz(){if(iE)return cy;iE=1;var e=IR(),t=ts(),n=yz(),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 cy=i,cy}var uy,aE;function wz(){if(aE)return uy;aE=1;var e=hz(),t=vz(),n=e(t);return uy=n,uy}var dy,lE;function BR(){if(lE)return dy;lE=1;var e=e0();function t(n){var s=n==null?0:n.length;return s?e(n,1):[]}return dy=t,dy}var fy,cE;function xz(){if(cE)return fy;cE=1;var e=Xw(),t=fR(),n=jo();function s(i,a){return i==null?i:e(i,t(a),n)}return fy=s,fy}var hy,uE;function bz(){if(uE)return hy;uE=1;function e(t){var n=t==null?0:t.length;return n?t[n-1]:void 0}return hy=e,hy}var py,dE;function kz(){if(dE)return py;dE=1;var e=Ku(),t=Qw(),n=ts();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 py=s,py}var my,fE;function n0(){if(fE)return my;fE=1;var e=na();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 my=t,my}var gy,hE;function _z(){if(hE)return gy;hE=1;function e(t,n){return t>n}return gy=e,gy}var yy,pE;function Sz(){if(pE)return yy;pE=1;var e=n0(),t=_z(),n=To();function s(i){return i&&i.length?e(i,n,t):void 0}return yy=s,yy}var vy,mE;function UR(){if(mE)return vy;mE=1;var e=Ku(),t=Zi();function n(s,i,a){(a!==void 0&&!t(s[i],a)||a===void 0&&!(i in s))&&e(s,i,a)}return vy=n,vy}var wy,gE;function Nz(){if(gE)return wy;gE=1;var e=Eo(),t=ed(),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 v=u.call(g,"constructor")&&g.constructor;return typeof v=="function"&&v instanceof v&&l.call(v)==h}return wy=p,wy}var xy,yE;function WR(){if(yE)return xy;yE=1;function e(t,n){if(!(n==="constructor"&&typeof t[n]=="function")&&n!="__proto__")return t[n]}return xy=e,xy}var by,vE;function Ez(){if(vE)return by;vE=1;var e=jl(),t=jo();function n(s){return e(s,t(s))}return by=n,by}var ky,wE;function Cz(){if(wE)return ky;wE=1;var e=UR(),t=JT(),n=lR(),s=eR(),i=uR(),a=Tl(),l=Mt(),u=OR(),h=ea(),p=Cl(),f=Ln(),g=Nz(),v=Rl(),w=WR(),N=Ez();function b(k,S,E,C,j,I,O){var P=w(k,E),z=w(S,E),M=O.get(z);if(M){e(k,E,M);return}var A=I?I(P,z,E+"",k,S,O):void 0,q=A===void 0;if(q){var H=l(z),Y=!H&&h(z),R=!H&&!Y&&v(z);A=z,H||Y||R?l(P)?A=P:u(P)?A=s(P):Y?(q=!1,A=t(z,!0)):R?(q=!1,A=n(z,!0)):A=[]:g(z)||a(z)?(A=P,a(P)?A=N(P):(!f(P)||p(P))&&(A=i(z))):q=!1}q&&(O.set(z,A),j(A,z,C,I,O),O.delete(z)),e(k,E,A)}return ky=b,ky}var _y,xE;function jz(){if(xE)return _y;xE=1;var e=Yu(),t=UR(),n=Xw(),s=Cz(),i=Ln(),a=jo(),l=WR();function u(h,p,f,g,v){h!==p&&n(p,function(w,N){if(v||(v=new e),i(w))s(h,p,N,f,u,g,v);else{var b=g?g(l(h,N),w,N+"",h,p,v):void 0;b===void 0&&(b=w),t(h,N,b)}},a)}return _y=u,_y}var Sy,bE;function Tz(){if(bE)return Sy;bE=1;var e=od(),t=id();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 Sy=n,Sy}var Ny,kE;function Rz(){if(kE)return Ny;kE=1;var e=jz(),t=Tz(),n=t(function(s,i,a){e(s,i,a)});return Ny=n,Ny}var Ey,_E;function HR(){if(_E)return Ey;_E=1;function e(t,n){return t<n}return Ey=e,Ey}var Cy,SE;function Az(){if(SE)return Cy;SE=1;var e=n0(),t=HR(),n=To();function s(i){return i&&i.length?e(i,n,t):void 0}return Cy=s,Cy}var jy,NE;function Mz(){if(NE)return jy;NE=1;var e=n0(),t=ts(),n=HR();function s(i,a){return i&&i.length?e(i,t(a,2),n):void 0}return jy=s,jy}var Ty,EE;function Iz(){if(EE)return Ty;EE=1;var e=cr(),t=function(){return e.Date.now()};return Ty=t,Ty}var Ry,CE;function Oz(){if(CE)return Ry;CE=1;var e=Xu(),t=rd(),n=Qu(),s=Ln(),i=Al();function a(l,u,h,p){if(!s(l))return l;u=t(u,l);for(var f=-1,g=u.length,v=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!=v){var k=w[N];b=p?p(k,N,w):void 0,b===void 0&&(b=s(k)?k:n(u[f+1])?[]:{})}e(w,N,b),w=w[N]}return l}return Ry=a,Ry}var Ay,jE;function Pz(){if(jE)return Ay;jE=1;var e=sd(),t=Oz(),n=rd();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 Ay=s,Ay}var My,TE;function $z(){if(TE)return My;TE=1;var e=Pz(),t=_R();function n(s,i){return e(s,i,function(a,l){return t(s,l)})}return My=n,My}var Iy,RE;function Lz(){if(RE)return Iy;RE=1;var e=BR(),t=AR(),n=MR();function s(i){return n(t(i,void 0,e),i+"")}return Iy=s,Iy}var Oy,AE;function qz(){if(AE)return Oy;AE=1;var e=$z(),t=Lz(),n=t(function(s,i){return s==null?{}:e(s,i)});return Oy=n,Oy}var Py,ME;function Dz(){if(ME)return Py;ME=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 Py=n,Py}var $y,IE;function Fz(){if(IE)return $y;IE=1;var e=Dz(),t=id(),n=zR();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 $y=s,$y}var Ly,OE;function zz(){if(OE)return Ly;OE=1;var e=Fz(),t=e();return Ly=t,Ly}var qy,PE;function Bz(){if(PE)return qy;PE=1;function e(t,n){var s=t.length;for(t.sort(n);s--;)t[s]=t[s].value;return t}return qy=e,qy}var Dy,$E;function Uz(){if($E)return Dy;$E=1;var e=na();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 Dy=t,Dy}var Fy,LE;function Wz(){if(LE)return Fy;LE=1;var e=Uz();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 Fy=t,Fy}var zy,qE;function Hz(){if(qE)return zy;qE=1;var e=nd(),t=sd(),n=ts(),s=jR(),i=Bz(),a=Zu(),l=Wz(),u=To(),h=Mt();function p(f,g,v){g.length?g=e(g,function(b){return h(b)?function(k){return t(k,b.length===1?b[0]:b)}:b}):g=[u];var w=-1;g=e(g,a(n));var N=s(f,function(b,k,S){var E=e(g,function(C){return C(b)});return{criteria:E,index:++w,value:b}});return i(N,function(b,k){return l(b,k,v)})}return zy=p,zy}var By,DE;function Gz(){if(DE)return By;DE=1;var e=e0(),t=Hz(),n=od(),s=id(),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 By=i,By}var Uy,FE;function Vz(){if(FE)return Uy;FE=1;var e=bR(),t=0;function n(s){var i=++t;return e(s)+i}return Uy=n,Uy}var Wy,zE;function Yz(){if(zE)return Wy;zE=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 Wy=e,Wy}var Hy,BE;function Kz(){if(BE)return Hy;BE=1;var e=Xu(),t=Yz();function n(s,i){return t(s||[],i||[],e)}return Hy=n,Hy}var Gy,UE;function yt(){if(UE)return Gy;UE=1;var e;if(typeof Dw=="function")try{e={cloneDeep:dz(),constant:Kw(),defaults:fz(),each:pR(),filter:NR(),find:wz(),flatten:BR(),forEach:hR(),forIn:xz(),has:ER(),isUndefined:CR(),last:bz(),map:TR(),mapValues:kz(),max:Sz(),merge:Rz(),min:Az(),minBy:Mz(),now:Iz(),pick:qz(),range:zz(),reduce:RR(),sortBy:Gz(),uniqueId:Vz(),values:PR(),zipObject:Kz()}}catch{}return e||(e=window._),Gy=e,Gy}var Vy,WE;function Xz(){if(WE)return Vy;WE=1,Vy=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 Vy}var Yy,HE;function Qz(){if(HE)return Yy;HE=1;var e=yt(),t=ar().Graph,n=Xz();Yy=i;var s=e.constant(1);function i(p,f){if(p.nodeCount()<=1)return[];var g=u(p,f||s),v=a(g.graph,g.buckets,g.zeroIdx);return e.flatten(e.map(v,function(w){return p.outEdges(w.v,w.w)}),!0)}function a(p,f,g){for(var v=[],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 k=f.length-2;k>0;--k)if(b=f[k].dequeue(),b){v=v.concat(l(p,f,g,b,!0));break}}}return v}function l(p,f,g,v,w){var N=w?[]:void 0;return e.forEach(p.inEdges(v.v),function(b){var k=p.edge(b),S=p.node(b.v);w&&N.push({v:b.v,w:b.w}),S.out-=k,h(f,g,S)}),e.forEach(p.outEdges(v.v),function(b){var k=p.edge(b),S=b.w,E=p.node(S);E.in-=k,h(f,g,E)}),p.removeNode(v.v),N}function u(p,f){var g=new t,v=0,w=0;e.forEach(p.nodes(),function(k){g.setNode(k,{v:k,in:0,out:0})}),e.forEach(p.edges(),function(k){var S=g.edge(k.v,k.w)||0,E=f(k),C=S+E;g.setEdge(k.v,k.w,C),w=Math.max(w,g.node(k.v).out+=E),v=Math.max(v,g.node(k.w).in+=E)});var N=e.range(w+v+3).map(function(){return new n}),b=v+1;return e.forEach(g.nodes(),function(k){h(N,b,g.node(k))}),{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 Yy}var Ky,GE;function Zz(){if(GE)return Ky;GE=1;var e=yt(),t=Qz();Ky={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 Ky}var Xy,VE;function fn(){if(VE)return Xy;VE=1;var e=yt(),t=ar().Graph;Xy={addDummyNode:n,simplify:s,asNonCompoundGraph:i,successorWeights:a,predecessorWeights:l,intersectRect:u,buildLayerMatrix:h,normalizeRanks:p,removeEmptyRanks:f,addBorderNode:g,maxRank:v,partition:w,time:N,notime:b};function n(k,S,E,C){var j;do j=e.uniqueId(C);while(k.hasNode(j));return E.dummy=S,k.setNode(j,E),j}function s(k){var S=new t().setGraph(k.graph());return e.forEach(k.nodes(),function(E){S.setNode(E,k.node(E))}),e.forEach(k.edges(),function(E){var C=S.edge(E.v,E.w)||{weight:0,minlen:1},j=k.edge(E);S.setEdge(E.v,E.w,{weight:C.weight+j.weight,minlen:Math.max(C.minlen,j.minlen)})}),S}function i(k){var S=new t({multigraph:k.isMultigraph()}).setGraph(k.graph());return e.forEach(k.nodes(),function(E){k.children(E).length||S.setNode(E,k.node(E))}),e.forEach(k.edges(),function(E){S.setEdge(E,k.edge(E))}),S}function a(k){var S=e.map(k.nodes(),function(E){var C={};return e.forEach(k.outEdges(E),function(j){C[j.w]=(C[j.w]||0)+k.edge(j).weight}),C});return e.zipObject(k.nodes(),S)}function l(k){var S=e.map(k.nodes(),function(E){var C={};return e.forEach(k.inEdges(E),function(j){C[j.v]=(C[j.v]||0)+k.edge(j).weight}),C});return e.zipObject(k.nodes(),S)}function u(k,S){var E=k.x,C=k.y,j=S.x-E,I=S.y-C,O=k.width/2,P=k.height/2;if(!j&&!I)throw new Error("Not possible to find intersection inside of the rectangle");var z,M;return Math.abs(I)*O>Math.abs(j)*P?(I<0&&(P=-P),z=P*j/I,M=P):(j<0&&(O=-O),z=O,M=O*I/j),{x:E+z,y:C+M}}function h(k){var S=e.map(e.range(v(k)+1),function(){return[]});return e.forEach(k.nodes(),function(E){var C=k.node(E),j=C.rank;e.isUndefined(j)||(S[j][C.order]=E)}),S}function p(k){var S=e.min(e.map(k.nodes(),function(E){return k.node(E).rank}));e.forEach(k.nodes(),function(E){var C=k.node(E);e.has(C,"rank")&&(C.rank-=S)})}function f(k){var S=e.min(e.map(k.nodes(),function(I){return k.node(I).rank})),E=[];e.forEach(k.nodes(),function(I){var O=k.node(I).rank-S;E[O]||(E[O]=[]),E[O].push(I)});var C=0,j=k.graph().nodeRankFactor;e.forEach(E,function(I,O){e.isUndefined(I)&&O%j!==0?--C:C&&e.forEach(I,function(P){k.node(P).rank+=C})})}function g(k,S,E,C){var j={width:0,height:0};return arguments.length>=4&&(j.rank=E,j.order=C),n(k,"border",j,S)}function v(k){return e.max(e.map(k.nodes(),function(S){var E=k.node(S).rank;if(!e.isUndefined(E))return E}))}function w(k,S){var E={lhs:[],rhs:[]};return e.forEach(k,function(C){S(C)?E.lhs.push(C):E.rhs.push(C)}),E}function N(k,S){var E=e.now();try{return S()}finally{console.log(k+" time: "+(e.now()-E)+"ms")}}function b(k,S){return S()}return Xy}var Qy,YE;function Jz(){if(YE)return Qy;YE=1;var e=yt(),t=fn();Qy={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,v=a.edge(l),w=v.labelRank;if(f!==h+1){a.removeEdge(l);var N,b,k;for(k=0,++h;h<f;++k,++h)v.points=[],b={width:0,height:0,edgeLabel:v,edgeObj:l,rank:h},N=t.addDummyNode(a,"edge",b,"_d"),h===w&&(b.width=v.width,b.height=v.height,b.dummy="edge-label",b.labelpos=v.labelpos),a.setEdge(u,N,{weight:v.weight},g),k===0&&a.graph().dummyChains.push(N),u=N;a.setEdge(u,p,{weight:v.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 Qy}var Zy,KE;function Ru(){if(KE)return Zy;KE=1;var e=yt();Zy={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 Zy}var Jy,XE;function GR(){if(XE)return Jy;XE=1;var e=yt(),t=ar().Graph,n=Ru().slack;Jy=s;function s(u){var h=new t({directed:!1}),p=u.nodes()[0],f=u.nodeCount();h.setNode(p,{});for(var g,v;i(h,u)<f;)g=a(h,u),v=h.hasNode(g.v)?n(u,g):-n(u,g),l(h,u,v);return h}function i(u,h){function p(f){e.forEach(h.nodeEdges(f),function(g){var v=g.v,w=f===v?g.w:v;!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 Jy}var ev,QE;function eB(){if(QE)return ev;QE=1;var e=yt(),t=GR(),n=Ru().slack,s=Ru().longestPath,i=ar().alg.preorder,a=ar().alg.postorder,l=fn().simplify;ev=u,u.initLowLimValues=g,u.initCutValues=h,u.calcCutValue=f,u.leaveEdge=w,u.enterEdge=N,u.exchangeEdges=b;function u(C){C=l(C),s(C);var j=t(C);g(j),h(j,C);for(var I,O;I=w(j);)O=N(j,C,I),b(j,C,I,O)}function h(C,j){var I=a(C,C.nodes());I=I.slice(0,I.length-1),e.forEach(I,function(O){p(C,j,O)})}function p(C,j,I){var O=C.node(I),P=O.parent;C.edge(I,P).cutvalue=f(C,j,I)}function f(C,j,I){var O=C.node(I),P=O.parent,z=!0,M=j.edge(I,P),A=0;return M||(z=!1,M=j.edge(P,I)),A=M.weight,e.forEach(j.nodeEdges(I),function(q){var H=q.v===I,Y=H?q.w:q.v;if(Y!==P){var R=H===z,Q=j.edge(q).weight;if(A+=R?Q:-Q,S(C,I,Y)){var W=C.edge(I,Y).cutvalue;A+=R?-W:W}}}),A}function g(C,j){arguments.length<2&&(j=C.nodes()[0]),v(C,{},1,j)}function v(C,j,I,O,P){var z=I,M=C.node(O);return j[O]=!0,e.forEach(C.neighbors(O),function(A){e.has(j,A)||(I=v(C,j,I,A,O))}),M.low=z,M.lim=I++,P?M.parent=P:delete M.parent,I}function w(C){return e.find(C.edges(),function(j){return C.edge(j).cutvalue<0})}function N(C,j,I){var O=I.v,P=I.w;j.hasEdge(O,P)||(O=I.w,P=I.v);var z=C.node(O),M=C.node(P),A=z,q=!1;z.lim>M.lim&&(A=M,q=!0);var H=e.filter(j.edges(),function(Y){return q===E(C,C.node(Y.v),A)&&q!==E(C,C.node(Y.w),A)});return e.minBy(H,function(Y){return n(j,Y)})}function b(C,j,I,O){var P=I.v,z=I.w;C.removeEdge(P,z),C.setEdge(O.v,O.w,{}),g(C),h(C,j),k(C,j)}function k(C,j){var I=e.find(C.nodes(),function(P){return!j.node(P).parent}),O=i(C,I);O=O.slice(1),e.forEach(O,function(P){var z=C.node(P).parent,M=j.edge(P,z),A=!1;M||(M=j.edge(z,P),A=!0),j.node(P).rank=j.node(z).rank+(A?M.minlen:-M.minlen)})}function S(C,j,I){return C.hasEdge(j,I)}function E(C,j,I){return I.low<=j.lim&&j.lim<=I.lim}return ev}var tv,ZE;function tB(){if(ZE)return tv;ZE=1;var e=Ru(),t=e.longestPath,n=GR(),s=eB();tv=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 tv}var nv,JE;function nB(){if(JE)return nv;JE=1;var e=yt();nv=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,v=0,w=f[v],N=!0;l!==h.w;){if(u=i.node(l),N){for(;(w=f[v])!==g&&i.node(w).maxRank<u.rank;)v++;w===g&&(N=!1)}if(!N){for(;v<f.length-1&&i.node(w=f[v+1]).minRank<=u.rank;)v++;w=f[v]}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),v,w;v=l;do v=i.parent(v),h.push(v);while(v&&(a[v].low>f||g>a[v].lim));for(w=v,v=u;(v=i.parent(v))!==w;)p.push(v);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 nv}var rv,eC;function rB(){if(eC)return rv;eC=1;var e=yt(),t=fn();rv={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 v=a(u)+1;e.forEach(u.children(),function(w){s(u,h,g,v,f,p,w)}),u.graph().nodeRankFactor=g}function s(u,h,p,f,g,v,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"),k=t.addBorderNode(u,"_bb"),S=u.node(w);u.setParent(b,w),S.borderTop=b,u.setParent(k,w),S.borderBottom=k,e.forEach(N,function(E){s(u,h,p,f,g,v,E);var C=u.node(E),j=C.borderTop?C.borderTop:E,I=C.borderBottom?C.borderBottom:E,O=C.borderTop?f:2*f,P=j!==I?1:g-v[w]+1;u.setEdge(b,j,{weight:O,minlen:P,nestingEdge:!0}),u.setEdge(I,k,{weight:O,minlen:P,nestingEdge:!0})}),u.parent(w)||u.setEdge(h,b,{weight:0,minlen:g+v[w]})}function i(u){var h={};function p(f,g){var v=u.children(f);v&&v.length&&e.forEach(v,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 rv}var sv,tC;function sB(){if(tC)return sv;tC=1;var e=yt(),t=fn();sv=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],v=t.addDummyNode(i,"border",f,l);h[a][p]=v,i.setParent(v,u),g&&i.setEdge(g,v,{weight:1})}return sv}var ov,nC;function oB(){if(nC)return ov;nC=1;var e=yt();ov={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 ov}var iv,rC;function iB(){if(rC)return iv;rC=1;var e=yt();iv=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 iv}var av,sC;function aB(){if(sC)return av;sC=1;var e=yt();av=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(v,w){return w})),u=e.flatten(e.map(i,function(v){return e.sortBy(e.map(s.outEdges(v),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(v){var w=v.pos+h;f[w]+=v.weight;for(var N=0;w>0;)w%2&&(N+=f[w+1]),w=w-1>>1,f[w]+=v.weight;g+=v.weight*N})),g}return av}var lv,oC;function lB(){if(oC)return lv;oC=1;var e=yt();lv=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 lv}var cv,iC;function cB(){if(iC)return cv;iC=1;var e=yt();cv=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 cv}var uv,aC;function uB(){if(aC)return uv;aC=1;var e=yt(),t=fn();uv=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,v=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,v+=b.weight,w=s(f,p,w)});var N={vs:e.flatten(f,!0)};return v&&(N.barycenter=g/v,N.weight=v),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 uv}var dv,lC;function dB(){if(lC)return dv;lC=1;var e=yt(),t=lB(),n=cB(),s=uB();dv=i;function i(u,h,p,f){var g=u.children(h),v=u.node(h),w=v?v.borderLeft:void 0,N=v?v.borderRight:void 0,b={};w&&(g=e.filter(g,function(I){return I!==w&&I!==N}));var k=t(u,g);e.forEach(k,function(I){if(u.children(I.v).length){var O=i(u,I.v,p,f);b[I.v]=O,e.has(O,"barycenter")&&l(I,O)}});var S=n(k,p);a(S,b);var E=s(S,f);if(w&&(E.vs=e.flatten([w,E.vs,N],!0),u.predecessors(w).length)){var C=u.node(u.predecessors(w)[0]),j=u.node(u.predecessors(N)[0]);e.has(E,"barycenter")||(E.barycenter=0,E.weight=0),E.barycenter=(E.barycenter*E.weight+C.order+j.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 dv}var fv,cC;function fB(){if(cC)return fv;cC=1;var e=yt(),t=ar().Graph;fv=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(v){var w=v.v===p?v.w:v.v,N=h.edge(w,p),b=e.isUndefined(N)?0:N.weight;h.setEdge(w,p,{weight:i.edge(v).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 fv}var hv,uC;function hB(){if(uC)return hv;uC=1;var e=yt();hv=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 hv}var pv,dC;function pB(){if(dC)return pv;dC=1;var e=yt(),t=iB(),n=aB(),s=dB(),i=fB(),a=hB(),l=ar().Graph,u=fn();pv=h;function h(v){var w=u.maxRank(v),N=p(v,e.range(1,w+1),"inEdges"),b=p(v,e.range(w-1,-1,-1),"outEdges"),k=t(v);g(v,k);for(var S=Number.POSITIVE_INFINITY,E,C=0,j=0;j<4;++C,++j){f(C%2?N:b,C%4>=2),k=u.buildLayerMatrix(v);var I=n(v,k);I<S&&(j=0,E=e.cloneDeep(k),S=I)}g(v,E)}function p(v,w,N){return e.map(w,function(b){return i(v,b,N)})}function f(v,w){var N=new l;e.forEach(v,function(b){var k=b.graph().root,S=s(b,k,N,w);e.forEach(S.vs,function(E,C){b.node(E).order=C}),a(b,N,S.vs)})}function g(v,w){e.forEach(w,function(N){e.forEach(N,function(b,k){v.node(b).order=k})})}return pv}var mv,fC;function mB(){if(fC)return mv;fC=1;var e=yt(),t=ar().Graph,n=fn();mv={positionX:N,findType1Conflicts:s,findType2Conflicts:i,addConflict:l,hasConflict:u,verticalAlignment:h,horizontalCompaction:p,alignCoordinates:v,findSmallestWidthAlignment:g,balance:w};function s(S,E){var C={};function j(I,O){var P=0,z=0,M=I.length,A=e.last(O);return e.forEach(O,function(q,H){var Y=a(S,q),R=Y?S.node(Y).order:M;(Y||q===A)&&(e.forEach(O.slice(z,H+1),function(Q){e.forEach(S.predecessors(Q),function(W){var ne=S.node(W),X=ne.order;(X<P||R<X)&&!(ne.dummy&&S.node(Q).dummy)&&l(C,W,Q)})}),z=H+1,P=R)}),O}return e.reduce(E,j),C}function i(S,E){var C={};function j(O,P,z,M,A){var q;e.forEach(e.range(P,z),function(H){q=O[H],S.node(q).dummy&&e.forEach(S.predecessors(q),function(Y){var R=S.node(Y);R.dummy&&(R.order<M||R.order>A)&&l(C,Y,q)})})}function I(O,P){var z=-1,M,A=0;return e.forEach(P,function(q,H){if(S.node(q).dummy==="border"){var Y=S.predecessors(q);Y.length&&(M=S.node(Y[0]).order,j(P,A,H,z,M),A=H,z=M)}j(P,A,P.length,M,O.length)}),P}return e.reduce(E,I),C}function a(S,E){if(S.node(E).dummy)return e.find(S.predecessors(E),function(C){return S.node(C).dummy})}function l(S,E,C){if(E>C){var j=E;E=C,C=j}var I=S[E];I||(S[E]=I={}),I[C]=!0}function u(S,E,C){if(E>C){var j=E;E=C,C=j}return e.has(S[E],C)}function h(S,E,C,j){var I={},O={},P={};return e.forEach(E,function(z){e.forEach(z,function(M,A){I[M]=M,O[M]=M,P[M]=A})}),e.forEach(E,function(z){var M=-1;e.forEach(z,function(A){var q=j(A);if(q.length){q=e.sortBy(q,function(W){return P[W]});for(var H=(q.length-1)/2,Y=Math.floor(H),R=Math.ceil(H);Y<=R;++Y){var Q=q[Y];O[A]===A&&M<P[Q]&&!u(C,A,Q)&&(O[Q]=A,O[A]=I[A]=I[Q],M=P[Q])}}})}),{root:I,align:O}}function p(S,E,C,j,I){var O={},P=f(S,E,C,I),z=I?"borderLeft":"borderRight";function M(H,Y){for(var R=P.nodes(),Q=R.pop(),W={};Q;)W[Q]?H(Q):(W[Q]=!0,R.push(Q),R=R.concat(Y(Q))),Q=R.pop()}function A(H){O[H]=P.inEdges(H).reduce(function(Y,R){return Math.max(Y,O[R.v]+P.edge(R))},0)}function q(H){var Y=P.outEdges(H).reduce(function(Q,W){return Math.min(Q,O[W.w]-P.edge(W))},Number.POSITIVE_INFINITY),R=S.node(H);Y!==Number.POSITIVE_INFINITY&&R.borderType!==z&&(O[H]=Math.max(O[H],Y))}return M(A,P.predecessors.bind(P)),M(q,P.successors.bind(P)),e.forEach(j,function(H){O[H]=O[C[H]]}),O}function f(S,E,C,j){var I=new t,O=S.graph(),P=b(O.nodesep,O.edgesep,j);return e.forEach(E,function(z){var M;e.forEach(z,function(A){var q=C[A];if(I.setNode(q),M){var H=C[M],Y=I.edge(H,q);I.setEdge(H,q,Math.max(P(S,A,M),Y||0))}M=A})}),I}function g(S,E){return e.minBy(e.values(E),function(C){var j=Number.NEGATIVE_INFINITY,I=Number.POSITIVE_INFINITY;return e.forIn(C,function(O,P){var z=k(S,P)/2;j=Math.max(O+z,j),I=Math.min(O-z,I)}),j-I})}function v(S,E){var C=e.values(E),j=e.min(C),I=e.max(C);e.forEach(["u","d"],function(O){e.forEach(["l","r"],function(P){var z=O+P,M=S[z],A;if(M!==E){var q=e.values(M);A=P==="l"?j-e.min(q):I-e.max(q),A&&(S[z]=e.mapValues(M,function(H){return H+A}))}})})}function w(S,E){return e.mapValues(S.ul,function(C,j){if(E)return S[E.toLowerCase()][j];var I=e.sortBy(e.map(S,j));return(I[1]+I[2])/2})}function N(S){var E=n.buildLayerMatrix(S),C=e.merge(s(S,E),i(S,E)),j={},I;e.forEach(["u","d"],function(P){I=P==="u"?E:e.values(E).reverse(),e.forEach(["l","r"],function(z){z==="r"&&(I=e.map(I,function(H){return e.values(H).reverse()}));var M=(P==="u"?S.predecessors:S.successors).bind(S),A=h(S,I,C,M),q=p(S,I,A.root,A.align,z==="r");z==="r"&&(q=e.mapValues(q,function(H){return-H})),j[P+z]=q})});var O=g(S,j);return v(j,O),w(j,S.graph().align)}function b(S,E,C){return function(j,I,O){var P=j.node(I),z=j.node(O),M=0,A;if(M+=P.width/2,e.has(P,"labelpos"))switch(P.labelpos.toLowerCase()){case"l":A=-P.width/2;break;case"r":A=P.width/2;break}if(A&&(M+=C?A:-A),A=0,M+=(P.dummy?E:S)/2,M+=(z.dummy?E:S)/2,M+=z.width/2,e.has(z,"labelpos"))switch(z.labelpos.toLowerCase()){case"l":A=z.width/2;break;case"r":A=-z.width/2;break}return A&&(M+=C?A:-A),A=0,M}}function k(S,E){return S.node(E).width}return mv}var gv,hC;function gB(){if(hC)return gv;hC=1;var e=yt(),t=fn(),n=mB().positionX;gv=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 gv}var yv,pC;function yB(){if(pC)return yv;pC=1;var e=yt(),t=Zz(),n=Jz(),s=tB(),i=fn().normalizeRanks,a=nB(),l=fn().removeEmptyRanks,u=rB(),h=sB(),p=oB(),f=pB(),g=gB(),v=fn(),w=ar().Graph;yv=N;function N(F,L){var K=L&&L.debugTiming?v.time:v.notime;K("layout",function(){var se=K(" buildLayoutGraph",function(){return M(F)});K(" runLayout",function(){b(se,K)}),K(" updateInputGraph",function(){k(F,se)})})}function b(F,L){L(" makeSpaceForEdgeLabels",function(){A(F)}),L(" removeSelfEdges",function(){B(F)}),L(" acyclic",function(){t.run(F)}),L(" nestingGraph.run",function(){u.run(F)}),L(" rank",function(){s(v.asNonCompoundGraph(F))}),L(" injectEdgeLabelProxies",function(){q(F)}),L(" removeEmptyRanks",function(){l(F)}),L(" nestingGraph.cleanup",function(){u.cleanup(F)}),L(" normalizeRanks",function(){i(F)}),L(" assignRankMinMax",function(){H(F)}),L(" removeEdgeLabelProxies",function(){Y(F)}),L(" normalize.run",function(){n.run(F)}),L(" parentDummyChains",function(){a(F)}),L(" addBorderSegments",function(){h(F)}),L(" order",function(){f(F)}),L(" insertSelfEdges",function(){J(F)}),L(" adjustCoordinateSystem",function(){p.adjust(F)}),L(" position",function(){g(F)}),L(" positionSelfEdges",function(){$(F)}),L(" removeBorderNodes",function(){X(F)}),L(" normalize.undo",function(){n.undo(F)}),L(" fixupEdgeLabelCoords",function(){W(F)}),L(" undoCoordinateSystem",function(){p.undo(F)}),L(" translateGraph",function(){R(F)}),L(" assignNodeIntersects",function(){Q(F)}),L(" reversePoints",function(){ne(F)}),L(" acyclic.undo",function(){t.undo(F)})}function k(F,L){e.forEach(F.nodes(),function(K){var se=F.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(F.edges(),function(K){var se=F.edge(K),he=L.edge(K);se.points=he.points,e.has(he,"x")&&(se.x=he.x,se.y=he.y)}),F.graph().width=L.graph().width,F.graph().height=L.graph().height}var S=["nodesep","edgesep","ranksep","marginx","marginy"],E={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},C=["acyclicer","ranker","rankdir","align"],j=["width","height"],I={width:0,height:0},O=["minlen","weight","width","height","labeloffset"],P={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},z=["labelpos"];function M(F){var L=new w({multigraph:!0,compound:!0}),K=Z(F.graph());return L.setGraph(e.merge({},E,V(K,S),e.pick(K,C))),e.forEach(F.nodes(),function(se){var he=Z(F.node(se));L.setNode(se,e.defaults(V(he,j),I)),L.setParent(se,F.parent(se))}),e.forEach(F.edges(),function(se){var he=Z(F.edge(se));L.setEdge(se,e.merge({},P,V(he,O),e.pick(he,z)))}),L}function A(F){var L=F.graph();L.ranksep/=2,e.forEach(F.edges(),function(K){var se=F.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(F){e.forEach(F.edges(),function(L){var K=F.edge(L);if(K.width&&K.height){var se=F.node(L.v),he=F.node(L.w),me={rank:(he.rank-se.rank)/2+se.rank,e:L};v.addDummyNode(F,"edge-proxy",me,"_ep")}})}function H(F){var L=0;e.forEach(F.nodes(),function(K){var se=F.node(K);se.borderTop&&(se.minRank=F.node(se.borderTop).rank,se.maxRank=F.node(se.borderBottom).rank,L=e.max(L,se.maxRank))}),F.graph().maxRank=L}function Y(F){e.forEach(F.nodes(),function(L){var K=F.node(L);K.dummy==="edge-proxy"&&(F.edge(K.e).labelRank=K.rank,F.removeNode(L))})}function R(F){var L=Number.POSITIVE_INFINITY,K=0,se=Number.POSITIVE_INFINITY,he=0,me=F.graph(),xe=me.marginx||0,Ee=me.marginy||0;function He(Fe){var Ie=Fe.x,be=Fe.y,ue=Fe.width,re=Fe.height;L=Math.min(L,Ie-ue/2),K=Math.max(K,Ie+ue/2),se=Math.min(se,be-re/2),he=Math.max(he,be+re/2)}e.forEach(F.nodes(),function(Fe){He(F.node(Fe))}),e.forEach(F.edges(),function(Fe){var Ie=F.edge(Fe);e.has(Ie,"x")&&He(Ie)}),L-=xe,se-=Ee,e.forEach(F.nodes(),function(Fe){var Ie=F.node(Fe);Ie.x-=L,Ie.y-=se}),e.forEach(F.edges(),function(Fe){var Ie=F.edge(Fe);e.forEach(Ie.points,function(be){be.x-=L,be.y-=se}),e.has(Ie,"x")&&(Ie.x-=L),e.has(Ie,"y")&&(Ie.y-=se)}),me.width=K-L+xe,me.height=he-se+Ee}function Q(F){e.forEach(F.edges(),function(L){var K=F.edge(L),se=F.node(L.v),he=F.node(L.w),me,xe;K.points?(me=K.points[0],xe=K.points[K.points.length-1]):(K.points=[],me=he,xe=se),K.points.unshift(v.intersectRect(se,me)),K.points.push(v.intersectRect(he,xe))})}function W(F){e.forEach(F.edges(),function(L){var K=F.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(F){e.forEach(F.edges(),function(L){var K=F.edge(L);K.reversed&&K.points.reverse()})}function X(F){e.forEach(F.nodes(),function(L){if(F.children(L).length){var K=F.node(L),se=F.node(K.borderTop),he=F.node(K.borderBottom),me=F.node(e.last(K.borderLeft)),xe=F.node(e.last(K.borderRight));K.width=Math.abs(xe.x-me.x),K.height=Math.abs(he.y-se.y),K.x=me.x+K.width/2,K.y=se.y+K.height/2}}),e.forEach(F.nodes(),function(L){F.node(L).dummy==="border"&&F.removeNode(L)})}function B(F){e.forEach(F.edges(),function(L){if(L.v===L.w){var K=F.node(L.v);K.selfEdges||(K.selfEdges=[]),K.selfEdges.push({e:L,label:F.edge(L)}),F.removeEdge(L)}})}function J(F){var L=v.buildLayerMatrix(F);e.forEach(L,function(K){var se=0;e.forEach(K,function(he,me){var xe=F.node(he);xe.order=me+se,e.forEach(xe.selfEdges,function(Ee){v.addDummyNode(F,"selfedge",{width:Ee.label.width,height:Ee.label.height,rank:xe.rank,order:me+ ++se,e:Ee.e,label:Ee.label},"_se")}),delete xe.selfEdges})})}function $(F){e.forEach(F.nodes(),function(L){var K=F.node(L);if(K.dummy==="selfedge"){var se=F.node(K.e.v),he=se.x+se.width/2,me=se.y,xe=K.x-he,Ee=se.height/2;F.setEdge(K.e,K.label),F.removeNode(L),K.label.points=[{x:he+2*xe/3,y:me-Ee},{x:he+5*xe/6,y:me-Ee},{x:he+xe,y:me},{x:he+5*xe/6,y:me+Ee},{x:he+2*xe/3,y:me+Ee}],K.label.x=K.x,K.label.y=K.y}})}function V(F,L){return e.mapValues(e.pick(F,L),Number)}function Z(F){var L={};return e.forEach(F,function(K,se){L[se.toLowerCase()]=K}),L}return yv}var vv,mC;function vB(){if(mC)return vv;mC=1;var e=yt(),t=fn(),n=ar().Graph;vv={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 vv}var wv,gC;function wB(){return gC||(gC=1,wv="0.8.5"),wv}var xv,yC;function xB(){return yC||(yC=1,xv={graphlib:ar(),layout:yB(),debug:vB(),util:{time:fn().time,notime:fn().notime},version:wB()}),xv}var bB=xB();const vC=iw(bB),Xi=240,Au=130,zi=74,ad=72,wC=zi+ad;function kB(e,t){var s;let n=Xi;for(const i of e)n=Math.max(n,((s=t.get(i.id))==null?void 0:s.width)??Xi);return n}const VR=420,_B=2;function pl(e){var n;return((n=e.data)==null?void 0:n.sessionId)??"_default"}function SB(e,t){return((t==null?void 0:t.get(e))??0)>0?VR:0}function NB(e,t){const n=(t==null?void 0:t.get(e))??0;return n>0?6+n*36:0}function ml(e,t,n){const s=t.get(e);return{w:((s==null?void 0:s.width)??Xi)+SB(e,n),h:Math.max((s==null?void 0:s.height)??Au,NB(e,n))}}function EB(e){return[...e.keys()].sort().map(t=>`${t}:${e.get(t)}`).join("|")}function CB(e,t,n,s,i,a){const l=new vC.graphlib.Graph;l.setDefaultEdgeLabel(()=>({})),l.setGraph({rankdir:n,marginx:0,marginy:0,nodesep:70,ranksep:160,edgesep:30});const u=e.filter(S=>!i.has(S)),h=new Set(u);for(const S of u){const{w:E,h:C}=ml(S,s,a);l.setNode(S,{width:E,height:C})}for(const S of t)h.has(S.source)&&h.has(S.target)&&l.setEdge(S.source,S.target);vC.layout(l);const p=new Map;let f=1/0,g=1/0,v=-1/0,w=-1/0;for(const S of u){const E=l.node(S);if(!E)continue;const C=s.get(S),j=(C==null?void 0:C.width)??Xi,I=(C==null?void 0:C.height)??Au,O=ml(S,s,a),P=E.x-O.w/2,z=E.y-O.h/2;p.set(S,{x:P,y:z}),P<f&&(f=P),z<g&&(g=z),P+j>v&&(v=P+j),z+I>w&&(w=z+I)}if(Number.isFinite(f)&&Number.isFinite(g))for(const[S,E]of p)p.set(S,{x:E.x-f,y:E.y-g});const N=Number.isFinite(v)?v-f:0,b=Number.isFinite(w)?w-g:0;let k=null;for(const S of e){const E=i.get(S);if(!E)continue;const C=s.get(S),j=(C==null?void 0:C.width)??Xi,I=(C==null?void 0:C.height)??Au;k=k===null?{minX:E.x,minY:E.y,maxX:E.x+j,maxY:E.y+I}:{minX:Math.min(k.minX,E.x),minY:Math.min(k.minY,E.y),maxX:Math.max(k.maxX,E.x+j),maxY:Math.max(k.maxY,E.y+I)}}return{positions:p,width:N,height:b,pinnedBox:k}}function jB(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 S of e){const E=pl(S),C=u.get(E);C?C.push(S.id):u.set(E,[S.id])}const p=Array.from(u.keys()).sort().map(S=>({sid:S,...CB(u.get(S),t,s,a,i,l)})),f=kB(e,a),g=n.availableHeight&&n.availableHeight>0?n.availableHeight:Number.POSITIVE_INFINITY,v=S=>{const E=[[]];let C=0;for(const j of p)E.length<S&&C>0&&C+j.height>g&&(E.push([]),C=0),E[E.length-1].push(j),C+=j.height+wC;return E},w=S=>S.reduce((E,C)=>Math.max(E,C.width),0)+VR;let N=v(n.availableWidth?_B:1);N.length>1&&N.reduce((E,C)=>E+w(C),0)+f*(N.length-1)>(n.availableWidth??0)&&(N=v(1));const b=new Map;let k=0;for(const S of N){const E=w(S);let C=0;for(const{positions:j,height:I,pinnedBox:O}of S){for(const[z,M]of j)b.set(z,{x:M.x+k,y:M.y+C});let P=C+I;O&&O.maxY>P&&O.minX<k+E&&k<O.maxX&&(P=O.maxY),C=P+wC}k+=E+f}return e.map(S=>{const E=i.get(S.id);if(E)return{...S,position:E};const C=b.get(S.id);return C?{...S,position:C}:S})}function TB(e,t,n,s,i){const l=zi+ad,u=60,h=w=>ml(w,s,i),p=new Map(e.map(w=>[w.id,pl(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)),v=[];for(const{id:w,pos:N}of g){const{w:b,h:k}=h(w),S=p.get(w)??"_default";if(n.has(w)){f.push({x:N.x,y:N.y,w:b,h:k,sid:S});continue}let E=N.y;for(let C=0;C<f.length+1;C++){const j=f.find(I=>{const O=I.sid===S?24:u,P=I.sid===S?24:l;return N.x<I.x+I.w+O&&I.x<N.x+b+O&&E<I.y+I.h+P&&I.y<E+k+P});if(!j)break;E=j.y+j.h+(j.sid===S?24:l)}E!==N.y&&(t.set(w,{x:N.x,y:E}),v.push(w)),f.push({x:N.x,y:E,w:b,h:k,sid:S})}return v}function RB(e,t,n,s,i,a){const l=b=>ml(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 k=pl(b),S=h.get(k);S?S.push(b):h.set(k,[b])}const p=new Set;for(const[b,k]of h)k.every(S=>i.has(S.id)&&!n.has(S.id))&&p.add(b);const f=new Map,g=[];for(const b of e){const k=u(b.id);if(!k)continue;const{w:S,h:E}=l(b.id),C=pl(b);p.has(C)?(f.get(C)??f.set(C,[]).get(C)).push(b):g.push({x:k.x,y:k.y,w:S,h:E})}if(f.size===0)return[];const v=zi+ad,w=(b,k,S,E)=>g.some(C=>b<C.x+C.w+zi&&C.x<b+S+zi&&k<C.y+C.h+v&&C.y<k+E+v),N=[];for(const b of[...f.keys()].sort()){const k=f.get(b);let S=1/0,E=1/0,C=-1/0,j=-1/0;for(const q of k){const H=u(q.id),{w:Y,h:R}=l(q.id);S=Math.min(S,H.x),E=Math.min(E,H.y),C=Math.max(C,H.x+Y),j=Math.max(j,H.y+R)}const I=C-S,O=j-E,P=[...new Set(g.map(q=>Math.round(q.x)))].sort((q,H)=>q-H),z=P.length?P:[S],M=[0,...g.map(q=>q.y+q.h+v)].sort((q,H)=>q-H);let A=null;e:for(const q of z)for(const H of M){if(H>=E)break;if(!w(q,H,I,O)){A={x:q,y:H};break e}}if(A){const q=A.x-S,H=A.y-E;for(const Y of k){const R=u(Y.id);t.set(Y.id,{x:R.x+q,y:R.y+H})}N.push(b)}for(const q of k){const H=u(q.id),{w:Y,h:R}=l(q.id);g.push({x:H.x,y:H.y,w:Y,h:R})}}return N}function AB(e,t,n,s,i,a=!1,l){const p=zi+ad+1,f=8,g=1.75,v=200,w=.7,N=.01,b=A=>ml(A,s,l),k=A=>n.get(A)??t.get(A),S=new Map;for(const A of e){if(!k(A.id))continue;const q=pl(A),H=S.get(q);H?H.push(A):S.set(q,[A])}const E=[],C=new Set,j=new Set,I=i.size===0;for(const A of[...S.keys()].sort()){const q=S.get(A);let H=1/0,Y=1/0,R=-1/0,Q=-1/0,W=!1;for(const J of q){const $=k(J.id),{w:V,h:Z}=b(J.id);H=Math.min(H,$.x),Y=Math.min(Y,$.y),R=Math.max(R,$.x+V),Q=Math.max(Q,$.y+Z),n.has(J.id)&&(W=!0)}const ne=R-H,X=Q-Y;j.add(A);const B=i.get(A);B&&(ne>B.w+f||X>B.h+f)&&C.add(A),i.set(A,{w:ne,h:X}),E.push({sid:A,members:q.map(J=>J.id),x:H,y:Y,w:ne,h:X,anchored:W,mass:1})}for(const A of[...i.keys()])j.has(A)||i.delete(A);if(a||I)return[];let O=!1;for(let A=0;A<E.length&&!O;A++)for(let q=A+1;q<E.length;q++){const H=E[A],Y=E[q];if(!(H.anchored&&Y.anchored)&&Math.abs(H.x+H.w/2-(Y.x+Y.w/2))<(H.w+Y.w)/2+61&&Math.abs(H.y+H.h/2-(Y.y+Y.h/2))<(H.h+Y.h)/2+p){O=!0;break}}if(C.size===0&&!O)return[];if(C.size>0)for(const A of E)C.has(A.sid)&&(A.mass=8);else for(const A of E)A.mass=Math.max(1,A.w*A.h/(Xi*Au));const P=new Map(E.map(A=>[A.sid,A.x])),z=new Map(E.map(A=>[A.sid,A.y]));for(let A=0;A<v;A++){const q=new Map,H=new Map;let Y=0;for(let R=0;R<E.length;R++)for(let Q=R+1;Q<E.length;Q++){const W=E[R],ne=E[Q];if(W.anchored&&ne.anchored)continue;const X=W.x+W.w/2,B=W.y+W.h/2,J=ne.x+ne.w/2,$=ne.y+ne.h/2,V=(W.w+ne.w)/2+61-Math.abs(X-J),Z=(W.h+ne.h)/2+p-Math.abs(B-$);if(V<=0||Z<=0)continue;const F=(Pe,Be)=>!Pe.anchored&&!(Be<0&&Pe.x<=0),L=(Pe,Be)=>!Pe.anchored&&!(Be<0&&Pe.y<=0),K=(Pe,Be,Ge)=>{const it=Pe===Be,ke=it?W.sid<ne.sid?-1:1:Math.sign(Pe-Be);return Ge(W,ke)||Ge(ne,-ke)?ke:it&&(Ge(W,-ke)||Ge(ne,ke))?-ke:0},se=K(X,J,F),he=K(B,$,L),me=se!==0,xe=he!==0;if(!me&&!xe)continue;const Ee=me&&(!xe||V*g<Z),[He,Fe,Ie,be]=Ee?[se,V,q,F]:[he,Z,H,L],ue=be(W,He),re=be(ne,-He),pe=W.mass,Oe=ne.mass,rt=ue?re?Oe/(pe+Oe):1:0,ot=re?ue?pe/(pe+Oe):1:0,Xe=Fe*w;Ie.set(W.sid,(Ie.get(W.sid)??0)+He*Xe*rt),Ie.set(ne.sid,(Ie.get(ne.sid)??0)-He*Xe*ot),Y+=Xe}for(const R of E)R.anchored||(R.x=Math.max(0,R.x+(q.get(R.sid)??0)),R.y=Math.max(0,R.y+(H.get(R.sid)??0)));if(Y<N)break}const M=[];for(const A of E){const q=A.x-P.get(A.sid),H=A.y-z.get(A.sid);if(!(Math.abs(q)<1&&Math.abs(H)<1)){for(const Y of A.members){if(n.has(Y))continue;const R=t.get(Y);R&&t.set(Y,{x:R.x+q,y:R.y+H})}M.push(A.sid)}}return M}const MB=600;function nw(e,t){return!(e.exitAt!=null&&t-e.exitAt>MB||e.kind==="root"&&e.state==="done"&&e.tools.length===0&&e.endedAt!=null&&e.endedAt-e.startedAt<3e3)}function IB(e,t){const n=new Set;for(const s of e.agents.values())nw(s,t)&&n.add(s.id);return n}function OB(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 PB(e,t,n=0){if(!e)return!1;for(const s of t)if(OB(e,s,n))return!0;return!1}const YR="sessionGroup";function $B(e,t){var s;if(e.type===YR)return"transparent";const n=(s=e.data)==null?void 0:s.state;return t(n==="err"?"--err":n==="active"?"--inflight":"--ok")}const KR=["--err","--inflight","--ok","--grid-line","--minimap-mask","--panel","--line","--accent","--text-dim","--bg"];function xC(e){const t={};for(const n of KR)t[n]=e(n);return t}function LB(e){return t=>e[t]??""}function qB(e,t){return KR.every(n=>e[n]===t[n])}function DB(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 FB=1200,zB=1e3;function bC(e){return e.lastDeckFitAt>0&&e.at-e.lastDeckFitAt<FB?!1:e.hasSourceEvent?!0:e.lastCanvasInputAt>0&&e.at-e.lastCanvasInputAt<zB}function bv({durationMs:e,documentHidden:t}){return t?!1:Number.isFinite(e)&&e>0}function BB(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 UB({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,BB(i,t,e))return!1;return s}const WB="Update checks are off (AGENTS_DECK_NO_UPDATE_CHECK=1)",kv="click for what's new";function HB(e){if(e.checkDisabled)return`${WB} · ${kv}`;if(e.checking)return`Asking npm for the newest release… · ${kv}`;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 · ${kv}, and to check npm now`}function GB(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 VB(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 YB(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 rw={kind:"assumed",claude:!0,codex:!0};function KB(e){if(!e||typeof e!="object")return rw;const t=e.providers;if(!t||typeof t!="object")return rw;const n=t;return{kind:"reported",claude:n.claude!==!1,codex:n.codex!==!1}}function Mu(e){const t=Math.max(0,Math.floor(e));return`${t} event${t===1?"":"s"}`}const kC=99;function XB(e){const t=Math.max(0,Math.floor(e));return t>kC?`${kC}+`:String(t)}const QB="Pause the canvas";function ZB(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 — ${Mu(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)":`${Mu(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 XR="paused · full",e8=(e,t)=>t>0?XR:e>0?`paused · ${XB(e)}`:"paused";function t8(e){const t=Math.max(0,Math.floor(e.dropped??0));return e.connected?e.paused?{tone:"paused",resting:!1,label:e8(e.held,t),widest:XR,title:t>0?`Connected — the pause is full at ${Mu(e.held)}; the oldest are being dropped as new ones arrive. Resume to catch up (Space)`:e.held>0?`Connected — ${Mu(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 _C(e){return typeof window>"u"?"":getComputedStyle(document.documentElement).getPropertyValue(e).trim()||""}const n8={agent:m3,sessionGroup:M3},QR="react-flow__node";function SC(e){var t,n;return!!e&&((n=(t=e.classList)==null?void 0:t.contains)==null?void 0:n.call(t,QR))===!0}function r8(e){try{const t=document.querySelector(`.${QR}[data-id="${CSS.escape(e)}"]`);t==null||t.focus({preventScroll:!0})}catch{}}const s8=["a[href]","button:not(:disabled)","input:not(:disabled)","select:not(:disabled)","textarea:not(:disabled)","summary","[tabindex]"].join(","),o8=420,uu=18,i8=200,a8=5*6e4,l8=6,c8=2*6e4,NC=400,r0="agent-dag.layout",s0="agent-dag.viewport",ZR="agent-dag.summariesDismissed",JR="agent-dag.sessionListOpen",eA="agent-dag.detailOpen",tA="agent-dag.usagePanelOpen",EC="agent-dag.accountsPanelOpen",_v="agent-dag.versionNoticeDismissed",CC="agent-dag.oldNameNoticeDismissed",u8=15*6e4,Sv={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:"},jC="agent-dag.autoRestart",TC="agent-dag.bundleReloadedFor";function d8(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(JR)==="1"}catch{return!1}}function f8(e){if(!(typeof window>"u"))try{window.localStorage.setItem(JR,e?"1":"0")}catch{}}function h8(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(eA)==="1"}catch{return!1}}function p8(e){if(!(typeof window>"u"))try{window.localStorage.setItem(eA,e?"1":"0")}catch{}}function m8(){const e=Bu(tA);return e===null?!0:e==="1"}function g8(e){if(!(typeof window>"u"))try{window.localStorage.setItem(tA,e?"1":"0")}catch{}}function y8(){if(typeof window>"u")return new Set;try{const e=window.localStorage.getItem(ZR);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 RC(e){if(!(typeof window>"u"))try{const t=Array.from(e),n=t.length>200?t.slice(-200):t;window.localStorage.setItem(ZR,JSON.stringify(n))}catch{}}function v8(){const e={positions:[],pins:[]};if(typeof window>"u")return e;try{const t=window.localStorage.getItem(r0);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 Nv(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(r0,JSON.stringify({v:2,positions:n,pins:Array.from(t.keys())}))}catch{}}function w8(){if(typeof window>"u")return null;try{const e=window.localStorage.getItem(s0);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 x8(e){if(!(typeof window>"u"))try{window.localStorage.setItem(s0,JSON.stringify(e))}catch{}}function AC(){if(!(typeof window>"u")){try{window.localStorage.removeItem(r0)}catch{}try{window.localStorage.removeItem(s0)}catch{}}}function b8(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 sw={file:"📁",shell:"⚡",web:"🌐",agent:"🤖",task:"📋",plan:"🧭",mcp:"🔌",other:"✨"},ow={file:"file",shell:"shell",web:"web",agent:"agent",task:"task",plan:"plan",mcp:"mcp",other:"other"},nA=vT;function k8(e,t,n,s,i,a,l,u,h,p,f,g,v,w,N,b,k,S){const E=[],C=[];for(const A of e.agents.values()){if(!k.has(A.id))continue;const q=A.exitAt!=null,H=b!=null&&!b.has(A.id),Y=[q?"rf-exiting":"",H?"rf-spotlit-out":""].filter(Boolean).join(" ")||void 0,R=a.get(A.id);if(E.push({id:A.id,type:"agent",position:{x:0,y:0},data:{...A,now:t,onOpenContext:S},className:Y,...R?{width:R.width,height:R.height}:null}),A.parentId&&k.has(A.parentId)){const Q=Ew(A.sessionId),W=q,ne=N.size>0&&(N.has(A.id)||N.has(A.parentId)),X=b!=null&&!b.has(A.id)&&!b.has(A.parentId),B=A.state==="active"?2:1.5,J=ne?B+1.5:B,$=W?.2:X?.12:1,V=["sess-edge",A.state==="active"?"sess-live":"sess-idle",W?"rf-edge-exiting":"",ne?"rf-edge-selected":""].filter(Boolean).join(" ");C.push({id:`e:${A.parentId}->${A.id}`,source:A.parentId,target:A.id,animated:(A.state==="active"||ne)&&!W,type:"smoothstep",style:{"--session-hue":Q,strokeWidth:J,opacity:$,transition:"var(--edge-transition)"},className:V})}}const j=new Map;for(const A of e.agents.values())A.tools.length>0&&j.set(A.id,Math.min(4,A.tools.length));const I=`${v}#lanes:${EB(j)}`,O=E.filter(A=>b5(A.id,i,f,g));if(O.length>0||I!==w.current){if(O.length>0){const A=jB(E,C,{direction:"LR",pinned:i,measured:a,availableWidth:n,availableHeight:s,lanes:j});for(const q of A)WT(q.id,f,g)&&_5(q.id,q.position,f,g);RB(E,f,i,a,new Set(O.map(q=>q.id)),j)}TB(E,f,i,a,j),w.current=I}const P=AB(E,f,i,a,l,!h||p,j);P.length>0&&u(P),su(f,e.agents),su(g,e.agents),su(i,e.agents),su(a,v5(e.agents.values()));const z=[];let M=!1;for(const A of E){let q=i.get(A.id)??f.get(A.id);q||(q=k5(A.id,f,g),M=!0),z.push({...A,position:q})}return M&&(w.current=""),{nodes:z,edges:C}}function _8(){return d.jsx(Sw,{children:d.jsx(S8,{})})}function S8(){var Xl,Ql,Zl,Jl;const e=xl(),t=At(),n=_.useState(Bv)[0],s=_.useRef(n),[,i]=_.useState(0),a=_.useCallback(()=>i(D=>D+1),[]),[l,u]=_.useState(()=>new Set),[h,p]=_.useState(null),[f,g]=_.useState(null),v=_.useCallback((D,G)=>{u(le=>{if(!G)return new Set([D]);const fe=new Set(le);return fe.has(D)?fe.delete(D):fe.add(D),fe}),p(le=>G&&le===D?le:D)},[]),w=_.useCallback(()=>{u(new Set),p(null)},[]),[N,b]=_.useState(null),[k,S]=_.useState(null),E=_.useCallback(D=>S(D),[]),[C,j]=_.useState(!1),[I,O]=_.useState(!1),P=_.useState(y8)[0],[z,M]=_.useState(d8);_.useEffect(()=>{f8(z)},[z]);const[A,q]=_.useState(h8);_.useEffect(()=>{p8(A)},[A]);const[H,Y]=_.useState(m8);_.useEffect(()=>{g8(H)},[H]);const[R,Q]=_.useState(()=>{try{const D=window.localStorage.getItem(EC);return D===null?!0:D==="1"}catch{return!0}});_.useEffect(()=>{try{window.localStorage.setItem(EC,R?"1":"0")}catch{}},[R]);const[W,ne]=_.useState(null);_.useEffect(()=>{let D=null;try{D=localStorage.getItem("agent-dag.sound")}catch{}ne(D===null?!0:D==="on")},[]);const X=_.useCallback(()=>{ne(D=>{var le;const G=D!==!0;try{localStorage.setItem("agent-dag.sound",G?"on":"off")}catch{}return G&&((le=Ee.current)==null||le.unlock()),G})},[]),B=_.useCallback(D=>{X()},[X]),J=_.useRef(B);J.current=B;const $=_.useRef(W);$.current=W;const[V,Z]=_.useState(()=>HD(Bu)),F=_.useRef(V);F.current=V;const L=_.useRef(null),K=_.useCallback((D,G=!1)=>{var le,fe;if((le=Ee.current)==null||le.unlock(),L.current!==null&&clearTimeout(L.current),L.current=null,!G){(fe=Ee.current)==null||fe.play(D,!0);return}L.current=setTimeout(()=>{var Se;L.current=null,(Se=Ee.current)==null||Se.play(D,!0)},FD)},[]),se=_.useCallback((D,G)=>{Z(le=>{const fe={level:hl(G.level??le[D].level),figure:DT(D,G.figure??le[D].figure)};try{localStorage.setItem(zT[D],String(fe.level)),localStorage.setItem(BT[D],fe.figure)}catch{}return{...le,[D]:fe}}),K(D,!0)},[K]);_.useEffect(()=>()=>{L.current!==null&&clearTimeout(L.current)},[]);const[he,me]=_.useState(!1),xe=_.useRef(null),Ee=_.useRef(null),[He,Fe]=_.useState("locked");_.useEffect(()=>{const D=YD({enabled:()=>$.current===!0,prefs:()=>F.current,onState:Fe});Ee.current=D,Fe(D.state());const G=()=>D.unlock();return window.addEventListener("pointerdown",G,{once:!0,capture:!0}),window.addEventListener("keydown",G,{once:!0,capture:!0}),()=>{window.removeEventListener("pointerdown",G,{capture:!0}),window.removeEventListener("keydown",G,{capture:!0})}},[]);const[Ie,be]=_.useState(!1),[ue,re]=_.useState(null),[pe,Oe]=_.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(_v)??""}catch{return""}}),[rt,ot]=_.useState(!1),Xe=_.useRef(0),[Pe,Be]=_.useState(!1),Ge=_.useCallback((D=!1)=>(D&&(Xe.current=Date.now(),Be(!0)),fetch(D?"/api/version?refresh=1":"/api/version").then(G=>G.ok?G.json():null).then(G=>{G&&re(G)}).catch(()=>{}).finally(()=>{D&&Be(!1)})),[]),it=_.useCallback(()=>{Ge(Date.now()-Xe.current>=u8)},[Ge]);_.useEffect(()=>{Ge();const D=window.setInterval(it,5*6e4),G=()=>{document.visibilityState==="visible"&&it()};return document.addEventListener("visibilitychange",G),()=>{window.clearInterval(D),document.removeEventListener("visibilitychange",G)}},[Ge,it]),_.useEffect(()=>{Ie&&Ge()},[Ie,Ge]);const ke=(ue==null?void 0:ue.notice)??null,[ct,It]=_.useState(null),ae=_.useRef(!1);_.useEffect(()=>{if(ae.current)return;const D=o5(),G=i5(D),le=c5({stored:G,running:(ue==null?void 0:ue.running)??null,notes:H1,remembers:a5(D)});le.reason!=="no-version"&&(ae.current=!0,le.record&&l5(D,le.record),le.show.length&&It({entries:le.show,since:G,firstRun:le.reason==="welcome"}))},[ue==null?void 0:ue.running]);const Le=(ue==null?void 0:ue.running)??"3.7.1",ze=_.useMemo(()=>UT(H1,null,Le),[Le]),Ce=_.useCallback(()=>{It({entries:ze,since:null,firstRun:!1})},[ze]),[Ve,Et]=_.useState(null),[st,Te]=_.useState(rw);_.useEffect(()=>{let D=!1;return fetch("/api/health").then(G=>G.ok?G.json():null).then(G=>{D||(Te(KB(G)),!(!G||typeof G.workspace!="string")&&Et(G.workspace))}).catch(()=>{}),()=>{D=!0}},[Ie]);const vt=_.useRef(st);vt.current=st;const ut=ke?`${ke.kind}:${ke.to}`:"",_t=ke!=null&&pe!==ut,_n=_.useCallback(()=>{Oe("");try{window.localStorage.setItem(_v,"")}catch{}},[]),Dn=_.useCallback(()=>{if(ke){Oe(ut);try{window.localStorage.setItem(_v,ut)}catch{}}},[ke,ut]),[Sn,Ro]=_.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(CC)??""}catch{return""}}),hn=ue!=null&&ue.invokedAs&&ue.invokedAs!==zt?ue.invokedAs:null,Ao=hn!=null&&Sn!==hn,Mo=_.useCallback(()=>{if(hn){Ro(hn);try{window.localStorage.setItem(CC,hn)}catch{}}},[hn]),Bt=((Xl=ue==null?void 0:ue.upgrade)==null?void 0:Xl.state)??"idle",Tr=kD(ue==null?void 0:ue.upgrade),Fn=_.useRef(!1),qs=_.useCallback(async()=>{if(or(Fn.current||Bt==="running")){Fn.current=!0;try{await fetch("/api/upgrade",{method:"POST"})}catch{}await Ge(),Fn.current=!1}},[Bt,Ge]);_.useEffect(()=>{if(Bt!=="running")return;const D=window.setInterval(Ge,3e3);return()=>window.clearInterval(D)},[Bt,Ge]);const Rr=_.useCallback(async()=>{var le;const D=ue==null?void 0:ue.command;if(!D)return;let G=!1;try{G=await Promise.race([((le=navigator.clipboard)==null?void 0:le.writeText(D).then(()=>!0))??Promise.resolve(!1),new Promise(fe=>window.setTimeout(()=>fe(!1),500))])}catch{G=!1}if(!G)try{const fe=document.createElement("textarea");fe.value=D,fe.setAttribute("readonly",""),fe.style.cssText="position:fixed;top:0;left:0;opacity:0",document.body.appendChild(fe),fe.select(),G=document.execCommand("copy"),fe.remove()}catch{G=!1}G&&(ot(!0),window.setTimeout(()=>ot(!1),1600))},[ue==null?void 0:ue.command]),ra=_.useCallback(()=>{M(D=>(D||Q(!1),!D))},[]),ur=_.useCallback(()=>{Q(D=>(D||M(!1),!D))},[]),[Ar,dr]=_.useState(!1),[ns,Io]=_.useState(!1),[Oo,Po]=_.useState(()=>{try{return Number(localStorage.getItem(K1))||0}catch{return 0}}),[Nn,$o]=_.useState([]),[Mr,Lo]=_.useState(!1);_.useEffect(()=>{let D=!0;const G=()=>{fetch("/api/browser-watch?live=0").then(fe=>fe.ok?fe.json():null).then(fe=>{var Se;!D||!(fe!=null&&fe.ok)||($o(fe.episodes??[]),Lo(((Se=fe.settings)==null?void 0:Se.enabled)===!0))}).catch(()=>{})};G();const le=setInterval(G,5*6e4);return()=>{D=!1,clearInterval(le)}},[]);const zn=_.useMemo(()=>Q5(Nn,Oo).length,[Nn,Oo]),[qo,Ds]=_.useState(0),Fs=_.useRef(null),[Do,Fo]=_.useState(!1),at=_.useRef(null),[sa,rs]=_.useState(0),Gt=_.useState(()=>j5({protect:D=>xL(s.current,D)}))[0],[Bn,zo]=_.useState(!1),ss=_.useCallback(()=>{const D=Gt.paused&&Gt.dropped>0,G=Gt.setPaused(!Gt.paused);D&&bL(s.current);for(const le of G)s.current=e1(s.current,le);zo(Gt.paused)},[Gt]),[wt,rn]=_.useState(Date.now()),[Un,pn]=_.useState(()=>{if(typeof window>"u")return!0;try{return window.localStorage.getItem(jC)!=="0"}catch{return!0}}),ld=_.useCallback(()=>{pn(D=>{const G=!D;try{window.localStorage.setItem(jC,G?"1":"0")}catch{}return G})},[]),[Ir,Bo]=_.useState(!1),[Uo,Wo]=_.useState("restart"),[os,zs]=_.useState(null),is=_.useRef(!1),Ml=_.useRef(null),Ho=_.useRef(0),Bs=_.useCallback(async D=>{if(!or(is.current))return;const G=(D==null?void 0:D.upgrade)===!0;is.current=!0,Ml.current=Tr;const le=++Ho.current;Wo(G?"npx":"restart"),Bo(!0);try{window.sessionStorage.setItem("agent-dag.restartPending",(ke==null?void 0:ke.to)??"")}catch{}try{await fetch("/api/restart",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({upgrade:G})})}catch{}window.setTimeout(()=>{if(Ho.current===le&&is.current){is.current=!1,Bo(!1);try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}}},G?18e4:3e4)},[ke==null?void 0:ke.to,Tr]),Go=_.useRef(null);_.useEffect(()=>{let D=!1;for(const le of s.current.agents.values())if(le.state==="active"){D=!0;break}const G=SD({enabled:Un,kind:ke==null?void 0:ke.kind,canRestart:(ue==null?void 0:ue.canRestart)===!0,busy:D,idleSince:Go.current,now:wt});Go.current=G.idleSince,G.restart&&Bs()},[Un,ke==null?void 0:ke.kind,ue==null?void 0:ue.canRestart,wt,Bs]),_.useEffect(()=>{const D=ue==null?void 0:ue.running;let G=null,le=null;try{G=window.sessionStorage.getItem("agent-dag.restartPending"),le=window.sessionStorage.getItem(TC)}catch{return}const fe=bD({bundle:"3.7.1",running:D,pending:G,lastTried:le});if(fe==="reload"){try{window.sessionStorage.setItem(TC,D??"")}catch{return}window.location.reload();return}if(fe!=="confirm")return;try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}is.current=!1,Bo(!1),zs(D??null);const Se=window.setTimeout(()=>zs(null),6e3);return()=>window.clearTimeout(Se)},[ue==null?void 0:ue.running]),_.useEffect(()=>{if(Ir&&_D({asked:Ml.current,reported:Tr})){try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}is.current=!1,Bo(!1)}},[Ir,Tr]);const as=_.useState(()=>DB(v8()))[0],Zt=_.useRef(as.pinned),ls=_.useRef(null),Qe=_.useState(()=>w8())[0],[oa,Il]=_.useState(()=>new Set),[Or,ia]=_.useState(R5),[Wn,Ol]=_.useState(()=>xC(_C)),Vo=_.useMemo(()=>LB(Wn),[Wn]),Yo=_.useCallback(D=>$B(D,Vo),[Vo]),fr=_.useMemo(()=>({background:Wn["--panel"],border:`1px solid ${Wn["--line"]}`,borderRadius:8}),[Wn]),[Hn,hr]=_.useState(!1);_.useEffect(()=>{document.documentElement.dataset.theme=Or;try{window.localStorage.setItem(HT,Or)}catch{}Ol(D=>{const G=xC(_C);return qB(D,G)?D:G})},[Or]);const mn=_.useCallback((D,G)=>{if(bv({durationMs:G,documentHidden:document.hidden})){e.setViewport(D,{duration:G});return}const{d3Zoom:le,d3Selection:fe}=t.getState(),Se=fe==null?void 0:fe.property("__zoom");if(le&&fe&&Se&&Se.k>0&&D.zoom>0){le.transform(fe,Se.scale(D.zoom/Se.k).translate((D.x-Se.x)/D.zoom,(D.y-Se.y)/D.zoom));return}e.setViewport(D,{duration:0})},[e,t]),Gn=_.useRef(null);_.useEffect(()=>{if(!Qe)return;const D=window.setTimeout(()=>{try{mn(Qe,0)}catch{}Yn.current=Date.now()},60);return()=>window.clearTimeout(D)},[mn,Qe]);const Vn=_.useRef(!0);_.useEffect(()=>{const D=new EventSource("/events"),G=E5(a,{now:()=>Date.now(),setTimeout:(le,fe)=>window.setTimeout(le,fe),clearTimeout:le=>window.clearTimeout(le)});return D.addEventListener("open",()=>{be(!0),hr(!0)}),D.addEventListener("error",()=>be(!1)),D.addEventListener("replay-end",()=>{Vn.current=!1,G.flush()}),D.addEventListener("hook",le=>{var fe;try{const Se=JSON.parse(le.data);if(!Gt.accept(Se))return;s.current=e1(s.current,Se);const Ae=Se.replay===!0||Vn.current||Date.now()-Se.receivedAt>3e4;Ae?G.replay():G.live();const Ue=VD(Se,Ae);Ue&&((fe=Ee.current)==null||fe.play(Ue))}catch{}}),()=>{D.close(),G.cancel()}},[a]),_.useEffect(()=>{const D=setInterval(()=>{const G=Date.now();rn(G);let le=kL(s.current,G,Jb);_L(s.current,G,Jb)&&(le=!0),vL(s.current,G,i8,a8)&&(le=!0),wL(s.current,G,l8,c8)&&(le=!0),u(fe=>y5(fe,s.current.agents)),p(fe=>fe!=null&&!s.current.agents.has(fe)?null:fe),le&&a()},250);return()=>clearInterval(D)},[a]);const aa=_.useRef(null),Yn=_.useRef(0),Us=420,En=_.useCallback((D=500)=>{try{const Ae=document.querySelector(".canvas-wrap"),Ue=Array.from(document.querySelectorAll(".react-flow__node")).filter(Ct=>Ct.offsetWidth>0);if(!Ae||Ue.length===0)return;const et=Ae.getBoundingClientRect(),pt=e.getViewport();if(!Number.isFinite(pt.zoom)||pt.zoom<=0)return;const tt=Ct=>(Ct-et.left-pt.x)/pt.zoom,Vt=Ct=>(Ct-et.top-pt.y)/pt.zoom,wr=Ue.map(Ct=>Ct.getBoundingClientRect()),oi=Math.min(...wr.map(Ct=>tt(Ct.left))),ec=Math.max(...wr.map(Ct=>tt(Ct.right))),no=Math.min(...wr.map(Ct=>Vt(Ct.top))),ps=Math.max(...wr.map(Ct=>Vt(Ct.bottom))),ii=ec-oi,ai=ps-no;if(!(ii>0&&ai>0))return;const xr=Math.max(.2,Math.min(1,(et.width-160)/(ii+Us)*.86,(et.height-160)/ai*.86)),ms={x:80-oi*xr,y:Math.max(80,(et.height-ai*xr)/2)-no*xr,zoom:xr};mn(ms,D),Yn.current=Date.now(),Gn.current=bv({durationMs:D,documentHidden:document.hidden})?{target:ms,until:Date.now()+D+60}:null,window.setTimeout(()=>{var Ct;try{((Ct=Gn.current)==null?void 0:Ct.target)===ms&&(Gn.current=null);const xa=e.getViewport();(Math.abs(xa.zoom-xr)>.01||Math.abs(xa.x-ms.x)>2)&&mn(ms,0)}catch{}},D+60)}catch{}},[e,mn]);_.useEffect(()=>{const D=()=>{if(!document.hidden)return;const G=Gn.current;if(Gn.current=null,!(!G||Date.now()>G.until)){try{mn(G.target,0)}catch{}Yn.current=Date.now()}};return document.addEventListener("visibilitychange",D),()=>document.removeEventListener("visibilitychange",D)},[mn]);const Ko=_.useRef(""),cs=_.useRef(null),la=_.useRef(0),Xo=_.useCallback(()=>{la.current=Date.now()},[]),Pr=_.useRef(null),us=_.useRef(0),pr=_.useCallback(()=>{us.current=Date.now()},[]),Ws=_.useCallback(D=>({hasSourceEvent:!!D,at:Date.now(),lastDeckFitAt:Yn.current,lastCanvasInputAt:us.current}),[]),ca="agent-dag.autoFitDisabled",Pl=_.useState(()=>{if(typeof window>"u")return!1;try{return window.localStorage.getItem(ca)==="1"}catch{return!1}})[0],mr=_.useRef(Pl),[Hs,Qo]=_.useState(Pl),Zo=_.useCallback(()=>{if(!mr.current){mr.current=!0,Qo(!0);try{window.localStorage.setItem(ca,"1")}catch{}}},[]),gr=_.useCallback(()=>{mr.current=!1,Qo(!1);try{window.localStorage.removeItem(ca)}catch{}En(400)},[e,En]);_.useEffect(()=>{const D=setInterval(()=>{if(mr.current||Date.now()-la.current<800)return;const G=s.current,le=Date.now(),fe=[];for(const Ae of G.agents.values())nw(Ae,le)&&fe.push({id:Ae.id});if(fe.length===0)return;const Se=[];for(const{id:Ae}of fe){const Ue=Kn.current.get(Ae),et=Zt.current.get(Ae)??Ot.current.get(Ae);!Ue||!et||Se.push({x:et.x,y:et.y,width:Ue.width,height:Ue.height})}UB({pane:Pr.current,viewport:e.getViewport(),boxes:Se})&&En(600)},1500);return()=>clearInterval(D)},[e]);const Gs=_.useRef(!1),Kn=_.useRef(new Map),ua=_.useRef(0),Jo=_.useCallback(D=>{const G=Kn.current;let le=!1;for(const fe of D.nodeInternals.values()){const Se=fe.width,Ae=fe.height;if(Se==null||Ae==null)continue;const Ue=G.get(fe.id);Ue?(Math.abs(Ue.height-Ae)>4||Math.abs(Ue.width-Se)>4)&&(G.set(fe.id,{width:Se,height:Ae}),le=!0):(G.set(fe.id,{width:Se,height:Ae}),le=!0)}return le&&(ua.current+=1),ua.current},[]),Vs=lt(Jo),[da,Jt]=_.useState(0);_.useEffect(()=>{let D=0;const G=()=>{const fe=Kn.current;let Se=!1;for(const Ae of document.querySelectorAll(".react-flow__node[data-id]")){const Ue=Ae.getAttribute("data-id");if(!Ue)continue;const et=Ae.offsetWidth,pt=Ae.offsetHeight;if(!et||!pt)continue;const tt=fe.get(Ue);(!tt||Math.abs(tt.width-et)>4||Math.abs(tt.height-pt)>4)&&(fe.set(Ue,{width:et,height:pt}),Se=!0)}Se&&Jt(Ae=>Ae+1)};if(Gs.current)return;let le=0;return document.visibilityState==="hidden"?le=window.setTimeout(G,32):D=requestAnimationFrame(G),()=>{cancelAnimationFrame(D),window.clearTimeout(le)}});const Ot=_.useRef(as.positions),fa=_.useRef(new Set),$r=_.useRef(""),ds=_.useMemo(()=>{const D=[];for(const G of s.current.agents.values())nw(G,wt)&&D.push(G.id+(G.parentId?`>${G.parentId}`:""));return D.sort(),`${D.join("|")}#sv${Vs}.${da}`},[s.current,s.current.revision,wt,Vs,da]),Lr=_.useRef(null);_.useEffect(()=>(Lr.current!=null&&window.clearTimeout(Lr.current),Lr.current=window.setTimeout(()=>{Nv(Ot.current,Zt.current)},1500),()=>{Lr.current!=null&&window.clearTimeout(Lr.current)}),[ds]),_.useEffect(()=>{if(Ko.current===ds)return;const D=Ko.current;if(Ko.current=ds,!D||mr.current)return;Date.now()-Yn.current>1200&&En(400),aa.current&&window.clearTimeout(aa.current),aa.current=window.setTimeout(()=>{mr.current||En(500)},280)},[ds,e,En]);const Ys=_.useMemo(()=>x5(s.current,l),[s.current,s.current.revision,l]),qr=_.useMemo(()=>IB(s.current,wt),[s.current,s.current.revision,wt]),Ks=_.useRef(null),[Xs,$l]=_.useState({w:0,h:0});_.useEffect(()=>{const D=Ks.current;if(!D||typeof ResizeObserver>"u")return;const G=new ResizeObserver(le=>{var Se;const fe=(Se=le[0])==null?void 0:Se.contentRect;fe&&(Pr.current={width:fe.width,height:fe.height},$l(Ae=>Math.abs(Ae.w-fe.width)>40||Math.abs(Ae.h-fe.height)>40?{w:fe.width,h:fe.height}:Ae))});return G.observe(D),Pr.current={width:D.clientWidth,height:D.clientHeight},$l({w:D.clientWidth,h:D.clientHeight}),()=>G.disconnect()},[]);const cd=_.useCallback(D=>{var le,fe;const G=D.target;!(G!=null&&G.closest)||G.closest(s8)!==D.currentTarget||(D.preventDefault(),(fe=(le=document.activeElement)==null?void 0:le.blur)==null||fe.call(le))},[]),ud=_.useRef(new Map),[ei,dd]=_.useState(!1);_.useEffect(()=>{const D=window.setTimeout(()=>dd(!0),2500);return()=>window.clearTimeout(D)},[]);const[fd,ha]=_.useState(!1),yr=_.useRef(null),[pa,ma]=_.useState(!1),hd=_.useCallback(()=>{yr.current&&(window.clearTimeout(yr.current),yr.current=null),ha(!1)},[]),pd=_.useCallback(D=>{D.length!==0&&queueMicrotask(()=>{ha(!0),yr.current&&window.clearTimeout(yr.current),yr.current=window.setTimeout(()=>ha(!1),o8+80)})},[]);_.useEffect(()=>()=>{yr.current&&window.clearTimeout(yr.current)},[]);const Ll=Xs.w>0?Xs.w*.92:0,ql=Xs.h>0?Xs.h:0,{nodes:Cn,edges:md}=_.useMemo(()=>k8(s.current,wt,Ll,ql,Zt.current,Kn.current,ud.current,pd,ei,pa,Ot.current,fa.current,ds,$r,l,Ys,qr,E),[s.current,s.current.revision,wt,Ll,ql,ei,pa,ds,l,Ys,qr,E,qo]),Dl=_.useMemo(()=>{const D=new Map;for(const le of Cn){const fe=le.data;if(!(fe!=null&&fe.sessionId)||fe.exitAt!=null)continue;const Se=le.width,Ae=le.height;if(Se==null||Ae==null)continue;const Ue=le.position.x,et=le.position.y,pt=Ue+Se,tt=et+Ae,Vt=D.get(fe.sessionId);Vt?(Vt.minX=Math.min(Vt.minX,Ue),Vt.minY=Math.min(Vt.minY,et),Vt.maxX=Math.max(Vt.maxX,pt),Vt.maxY=Math.max(Vt.maxY,tt)):D.set(fe.sessionId,{minX:Ue,minY:et,maxX:pt,maxY:tt})}const G=[];for(const[le,fe]of D){const Se=fe.maxX-fe.minX+uu*2,Ae=fe.maxY-fe.minY+uu*2;G.push({id:`group:${le}`,type:YR,position:{x:fe.minX-uu,y:fe.minY-uu},data:{sessionId:le,w:Se,h:Ae},width:Se,height:Ae,style:{width:Se,height:Ae},zIndex:-1,draggable:!0,selectable:!1,focusable:!1,deletable:!1,connectable:!1})}return G},[Cn,wt]),gd=_.useMemo(()=>{const D=[...Dl,...Cn],G=at.current;return!G||G.size===0?D:D.map(le=>{const fe=G.get(le.id);return fe?{...le,position:fe}:le})},[Dl,Cn,sa]),Qs=_.useMemo(()=>{const D=new Set;for(const G of s.current.agents.values())for(const le of G.tools)D.add(nA(le.name));return Object.keys(sw).filter(G=>D.has(G))},[s.current,s.current.revision]);_.useEffect(()=>{if(Qs.length<=1){Fo(!1);return}let D=0;const G=()=>{const le=Fs.current;if(le&&!document.hidden){const fe=le.getBoundingClientRect(),Se=Array.from(document.querySelectorAll(".react-flow__node, .tool-burst")).map(Ue=>Ue.getBoundingClientRect()),Ae=PB(fe,Se,8);Fo(Ue=>Ue===Ae?Ue:Ae)}D=window.setTimeout(G,300)};return G(),()=>window.clearTimeout(D)},[Qs.length]);const yd=_.useCallback(D=>{Il(G=>{const le=new Set(G);return le.has(D)?le.delete(D):le.add(D),le})},[]),en=h?s.current.agents.get(h):null,ga=f?Array.from(s.current.agents.values()).flatMap(D=>D.tools).find(D=>D.id===f)??null:null,Fl=_.useCallback(async()=>{try{await fetch("/api/clear",{method:"POST"})}catch{}s.current=Bv(),Zt.current.clear(),Kn.current.clear(),Ot.current.clear(),$r.current="",AC(),w(),a()},[a,w]),zl=_.useRef(C);zl.current=C;const Bl=_.useRef(I);Bl.current=I;const ya=_.useRef(!1);ya.current=ga!=null||Ar||k!=null||N!=null||ns||I||ct!=null;const fs=_.useCallback(D=>{const G=ND(D,{confirmOpen:zl.current,modalOpen:ya.current});G==="confirm"?j(!0):G==="clear"&&(j(!1),Fl())},[Fl]),Dr=_.useCallback(()=>{Zt.current.clear(),Ot.current.clear(),$r.current="",AC(),a(),window.setTimeout(()=>En(500),80)},[a,e,En]),Ul=_.useCallback(()=>En(500),[En]),Zs=_.useRef(Cn);Zs.current=Cn;const va=_.useRef(h);va.current=h;const ti=_.useCallback(D=>{const G=Zs.current,le=f5(G.map(Ae=>({id:Ae.id,x:Ae.position.x,y:Ae.position.y})),va.current,D),fe=le?G.find(Ae=>Ae.id===le):void 0;if(!fe)return;const Se=SC(document.activeElement);v(fe.id,!1),window.setTimeout(()=>{try{e.fitView({padding:.35,duration:350,nodes:[fe]})}catch{}Yn.current=Date.now(),Se&&r8(fe.id)},30)},[v,e]),ni=_.useCallback(D=>{v(D,!1),window.setTimeout(()=>{try{const G=Zs.current.find(le=>le.id===D);G&&e.fitView({padding:.3,duration:500,nodes:[G]}),Yn.current=Date.now()}catch{}},60)},[v,e]);_.useEffect(()=>{const D=G=>{var et,pt;const le=G.target,fe={tagName:le==null?void 0:le.tagName,isContentEditable:le==null?void 0:le.isContentEditable,role:(et=le==null?void 0:le.getAttribute)==null?void 0:et.call(le,"role"),type:le==null?void 0:le.type};if(G.key==="Escape"){const tt=ZL({overlayOpen:Di.depth()>0,panelOnTop:Di.topIsPanel(),typing:Rw(fe)});tt==="dismiss"?Di.dismissTop():tt==="blur"?le==null||le.blur():(g5(fe)&&(le==null||le.blur()),w());return}if(Tw(G))return;const Se=SC(le)?(pt=le==null?void 0:le.getAttribute)==null?void 0:pt.call(le,"data-id"):null,Ae=Se&&Zs.current.some(tt=>tt.id===Se)?Se:null,Ue=p5(G,Ae);if(Ue.kind==="activate"){G.preventDefault(),v(Ue.nodeId,Ue.additive);return}Ue.kind!=="node"&&(Ue.nodeId==null&&i3(fe)||a3({key:G.key,modalOpen:ya.current,sheetOpen:Bl.current})||(G.key===" "&&(G.preventDefault(),ss()),(G.key==="c"||G.key==="C")&&fs("shortcut"),(G.key==="r"||G.key==="R")&&Dr(),(G.key==="f"||G.key==="F")&&Ul(),(G.key==="l"||G.key==="L")&&ra(),(G.key==="h"||G.key==="H")&&dr(tt=>!tt),(G.key==="u"||G.key==="U")&&Y(tt=>!tt),(G.key==="a"||G.key==="A")&&vt.current.claude&&ur(),(G.key==="j"||G.key==="J")&&ti(1),(G.key==="k"||G.key==="K")&&ti(-1),(G.key==="t"||G.key==="T")&&ia(tt=>tt==="dark"?"light":"dark"),(G.key==="m"||G.key==="M")&&vt.current.claude&&$.current!==null&&J.current(G.shiftKey),G.key==="?"&&O(tt=>!tt)))};return window.addEventListener("keydown",D),()=>window.removeEventListener("keydown",D)},[fs,Dr,Ul,w,v,ti,ss]);const ri=s.current.agents.size,xt=_.useMemo(()=>UL(s.current.agents.values()),[s.current,s.current.revision]),Wl=_.useMemo(()=>WL(s.current.agents.values()),[s.current,s.current.revision]),Hl=_.useRef(null);_.useEffect(()=>{const D=A5({waiting:xt.length,running:Wl,connected:Ie}),G=Hl.current;if(Hl.current=D,(G==null?void 0:G.title)!==D.title&&(document.title=D.title),(G==null?void 0:G.icon)!==D.icon){const le=document.querySelector('link[rel="icon"]');le&&(le.href=M5[D.icon])}},[xt.length,Wl,Ie]);const[vd,Gl]=_.useState(""),wa=O5(xt);_.useEffect(()=>{Gl(D=>P5(D,wa))},[wa]);const[vr,Js]=_.useState(()=>typeof Notification>"u"?"denied":Notification.permission),[Fr,hs]=_.useState(null),[wd,Vl]=_.useState(!1),eo=KL(vr,typeof Notification<"u");_.useEffect(()=>{eo&&xt.length>0&&Vl(!0)},[eo,xt.length]),_.useEffect(()=>{if(!Fr)return;const G=setTimeout(()=>hs(null),Fr==="blocked"?8e3:4e3);return()=>clearTimeout(G)},[Fr]);const Kl=_.useCallback(()=>{typeof Notification>"u"||Notification.requestPermission().then(D=>{const G=D;Js(G),G==="granted"?hs("on"):G==="denied"&&hs("blocked")})},[]),to=_.useRef(new Set),si=_.useRef(null),xd=xt.map(D=>zu(D.id,D.waiting)).join("|");return _.useEffect(()=>{YL(si.current,vr)&&(si.current=vr,to.current=r1(xt))},[vr]),_.useEffect(()=>{if(typeof Notification>"u"||Notification.permission!=="granted"||si.current===null)return;const D=typeof document>"u"||!document.hidden,G=GL(xt,to.current,D);for(const le of G)try{const fe=new Notification(le.title,{body:le.body,tag:le.key});fe.onclick=()=>{window.focus(),ni(le.sessionId),fe.close()}}catch{}to.current=D?r1(xt):VL(xt,G,to.current)},[xd]),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}),ke?d.jsxs("button",{type:"button",className:"v stale",onClick:()=>{Ce(),_n()},"aria-haspopup":"dialog","aria-label":VB({...ke,open:_t}),title:ke.kind==="restart"?`Running v${ke.from}; v${ke.to} is installed on disk. Restart to pick it up · click for what's new`:`Running v${ke.from}; v${ke.to} is on npm · click for what's new`,children:["v",ke.from,d.jsx("span",{className:"v-dot","aria-hidden":!0})]}):(()=>{const D={running:Le,latest:ue==null?void 0:ue.latest,latestPending:ue==null?void 0:ue.latestPending,checkedAgo:ue!=null&&ue.checkedAt?Yv(wt-ue.checkedAt):null,checkDisabled:ue==null?void 0:ue.checkDisabled,checking:Pe};return d.jsxs("button",{type:"button",className:Pe?"v checking":"v",onClick:()=>{Ce(),Ge(!0)},"aria-busy":Pe||void 0,"aria-haspopup":"dialog","aria-label":GB(D),title:HB(D),children:["v",D.running]})})()]}),d.jsxs("span",{className:"status",children:[(()=>{const D=t8({connected:Ie,paused:Bn,held:Gt.size,dropped:Gt.dropped});return D.resting?null:d.jsx("span",{className:`pill ${D.tone}`,title:D.title,children:d.jsxs("span",{className:"pill-box",children:[d.jsx("span",{className:"pill-widest","aria-hidden":!0,children:D.widest}),d.jsx("span",{className:"pill-label",children:D.label})]})})})(),d.jsx(g4,{usageOpen:H})]}),d.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:vd}),xt.length>0&&d.jsxs("button",{type:"button",className:"waiting-stat",onClick:()=>ni(xt[0].id),title:`Blocked waiting for you — click to go to the one that has been stuck longest:
187
- ${xt.map(D=>` ${D.label}: ${dl(D.waiting)} (${Yv(wt-D.waiting.since)})`).join(`
188
- `)}`,"aria-label":`${xt.length} session${xt.length===1?"":"s"} waiting for you`,children:[d.jsx("span",{className:"ap-pulse","aria-hidden":!0}),d.jsx("b",{children:xt.length})," waiting"]}),wd&&eo&&d.jsx("button",{type:"button",className:"notify-ask",onClick:Kl,title:"Get a system notification when a session blocks on you, so the deck can reach you with this tab in the background",children:"notify me"}),Fr&&d.jsx("span",{className:Fr==="on"?"notify-said":"notify-said notify-said-blocked",role:"status",title:Fr==="on"?"The deck will raise a system notification when a session blocks on you and this tab is in the background":"Notifications are blocked for this page. Only your browser can undo that — its site settings for this address",children:Fr==="on"?"notifications on":"notifications blocked"})]}),en&&(()=>{const D=xn(en),G=Math.max(0,((en.endedAt??wt)-en.startedAt)/1e3),le=en.state==="active"?jw(D.total,G):null,fe=l.size-1;return d.jsxs("button",{type:"button",className:"selected-ribbon",title:`Fit view to ${en.label}`,onClick:()=>{try{const Se=Cn.find(Ae=>Ae.id===en.id);Se&&e.fitView({padding:.35,duration:500,nodes:[Se]}),Yn.current=Date.now()}catch{}},children:[d.jsx("span",{className:`state-pill state-${en.state}`,children:en.state==="active"?"live":en.state}),d.jsx("span",{className:"selected-label",children:en.label}),D.total>0&&d.jsxs("span",{className:"selected-cost",children:[Ze(D.total),le?d.jsxs("span",{className:"selected-rate",children:[" · ",le]}):null]}),fe>0&&d.jsxs("span",{className:"selected-extra",children:["+",fe]}),d.jsx("span",{"aria-hidden":!0,className:"selected-close",onClick:Se=>{Se.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(D=>!D),title:`${H?"Hide":"Show"} usage panel (U)`,"aria-label":"Toggle usage panel","aria-expanded":H,"aria-controls":H?"usage-panel":void 0,children:"$"}),st.claude&&d.jsx("button",{className:"btn icon-btn",onClick:ur,title:`${R?"Hide":"Show"} accounts (A)`,"aria-label":"Toggle accounts panel","aria-expanded":R,"aria-controls":R?"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:()=>dr(D=>!D),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${zn>0?" has-findings":Mr?" watching":""}`,onClick:()=>Io(D=>!D),title:Mr?"Browser watch — watching; the deck is keeping its own copy":"Browser watch — not watching; reading the browser's history live","aria-label":`Browser watch, ${Mr?"watching":"not watching"}`+(zn>0?`, ${zn} 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"}),Mr||zn>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"})]}),zn>0&&d.jsx("span",{className:"bw-badge","aria-hidden":!0,children:zn})]})]}),d.jsxs("div",{className:"action-run",children:[st.claude&&W!==null&&d.jsxs("div",{className:"sound-slot",children:[d.jsx("button",{ref:xe,className:"btn icon-btn",onClick:()=>me(D=>!D),...sr(!1),title:B5(st,{on:W===!0,locked:He==="locked",prefs:V}),"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"}),W?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(XD,{onClose:()=>me(!1),soundOn:W===!0,onToggleSound:X,prefs:V,onLevel:(D,G)=>se(D,{level:G}),onFigure:(D,G)=>se(D,{figure:G}),onPreview:D=>K(D),openerRef:xe})]}),d.jsx("button",{className:"btn icon-btn",onClick:()=>ia(D=>D==="dark"?"light":"dark"),title:`Switch to ${Or==="dark"?"light":"dark"} mode (T)`,"aria-label":"Toggle theme",children:Or==="dark"?"☀":"☾"})]})]})]}),os?d.jsxs("div",{className:"ver-banner done",role:"status",children:[d.jsx("span",{className:"ver-dot"}),d.jsxs("strong",{children:["Restarted — now running v",os,"."]}),d.jsx("span",{className:"ver-sub",children:"The canvas replayed from the event log."})]}):Hn&&!Ie?d.jsxs("div",{className:"conn-banner",role:"alert",children:[d.jsx("span",{className:"conn-dot"}),Ir?Uo==="npx"?"Fetching the new version with npx — this can take a minute…":`Restarting ${zt}…`:(()=>{const D=JB({connected:Ie,paused:Bn});return d.jsxs(d.Fragment,{children:[`Lost connection to the ${zt} server. Reconnecting…`,D&&d.jsx("span",{className:"conn-sub",children:D})]})})()]}):_t&&ke?d.jsxs("div",{className:`ver-banner ${ke.kind}`,role:"status",children:[d.jsx("span",{className:"ver-dot"}),ke.kind==="restart"?d.jsxs(d.Fragment,{children:[d.jsxs("strong",{children:["v",ke.to," is installed — this deck still runs v",ke.from,"."]}),ue!=null&&ue.canRestart?d.jsxs(d.Fragment,{children:[d.jsx("button",{type:"button",className:"ver-act",onClick:()=>Bs(),...sr(Ir),title:"Stop this process and bring it back on the same port. The canvas replays from the event log.",children:Ir?"restarting…":"Restart now"}),d.jsxs("button",{type:"button",className:`ver-auto${Un?" on":""}`,role:"switch","aria-checked":Un,onClick:ld,title:Un?"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",ke.to," is out — you are on v",ke.from,"."]}),(ue==null?void 0:ue.upgradeMode)==="install"&&Bt!=="failed"&&d.jsx("button",{type:"button",className:"ver-act",onClick:qs,...sr(Bt==="running",Bt==="done"),title:`Runs ${((Ql=ue==null?void 0:ue.upgrade)==null?void 0:Ql.command)??(ue==null?void 0:ue.command)??"npm i -g"} here, then restarts once nothing is running.`,children:Bt==="running"?"installing…":Bt==="done"?"installed":"Update now"}),(ue==null?void 0:ue.upgradeMode)==="npx"&&(ue==null?void 0:ue.canRestart)&&d.jsx("button",{type:"button",className:"ver-act",onClick:()=>Bs({upgrade:!0}),...sr(Ir),title:`Runs ${ue==null?void 0:ue.command} and hands it this port. Nothing is installed globally — npx unpacks its own copy.`,children:Ir?"fetching…":Bt==="failed"?"Retry update":"Update & restart"}),Bt==="failed"?d.jsxs("span",{className:"ver-sub fail",title:((Zl=ue==null?void 0:ue.upgrade)==null?void 0:Zl.error)??"",children:[(ue==null?void 0:ue.upgradeMode)==="npx"?"update failed":"install failed",": ",((Jl=ue==null?void 0:ue.upgrade)==null?void 0:Jl.error)??"unknown error"," — run it yourself:"]}):(ue==null?void 0:ue.upgradeMode)==="npx"?d.jsx("span",{className:"ver-sub",children:ue!=null&&ue.canRestart?"npx cannot upgrade in place, so the deck re-runs:":Sv.npx}):ue!=null&&ue.upgradeBlocked?d.jsx("span",{className:"ver-sub",children:Object.hasOwn(Sv,ue.upgradeBlocked)?Sv[ue.upgradeBlocked]:"cannot install from here"}):null,d.jsxs("button",{type:"button",className:"ver-cmd",onClick:Rr,title:"Copy to clipboard",children:[d.jsx("code",{children:ue==null?void 0:ue.command}),d.jsx("span",{className:"ver-cmd-hint",children:rt?"copied":"copy"})]})]}),d.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:Dn,children:"×"})]}):Ao&&hn?d.jsxs("div",{className:"ver-banner",role:"status",children:[d.jsx("span",{className:"ver-dot"}),d.jsxs("strong",{children:[hn," still works — the deck is called ",zt," now."]}),ue!=null&&ue.renameFix?d.jsx("span",{className:"ver-sub",children:ue.renameFix}):null,d.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:Mo,children:"×"})]}):null,H&&d.jsx(Uq,{state:s.current,now:wt,providers:st,onClose:()=>Y(!1)}),R&&st.claude&&d.jsx(vD,{onClose:()=>Q(!1)}),z&&d.jsx(wq,{state:s.current,now:wt,selectedIds:l,onSelect:ni,onClose:()=>M(!1)}),d.jsxs("main",{id:"canvas",tabIndex:-1,className:`canvas-wrap${fd?" bubbling":""}${pa?" dragging-any":""}`,ref:Ks,onMouseDownCapture:cd,onPointerDownCapture:pr,onPointerUpCapture:pr,onWheelCapture:pr,children:[ri===0&&d.jsx(N8,{live:Ie,everConnected:Hn,providers:st}),Qs.length>1&&d.jsx("div",{ref:Fs,className:`cat-filter-bar${Do?" occluded":""}`,role:"group","aria-label":"Filter tools by category",children:Qs.map(D=>{const G=oa.has(D);return d.jsxs("button",{type:"button",className:`cat-filter${G?" off":""}`,onClick:()=>yd(D),"aria-pressed":!G,title:`${G?"Show":"Hide"} ${ow[D]} tools`,children:[d.jsx("span",{className:"cat-emoji",children:sw[D]}),d.jsx("span",{className:"cat-name",children:ow[D]})]},D)})}),d.jsxs(Xj,{nodes:gd,edges:md,nodeTypes:n8,fitView:!Qe,fitViewOptions:{padding:.25,duration:bv({durationMs:NC,documentHidden:document.hidden})?NC:0},minZoom:.2,maxZoom:1.6,panOnScroll:!0,nodesDraggable:!0,nodesConnectable:!1,selectionOnDrag:!1,nodeDragThreshold:5,onNodeClick:(D,G)=>{if(G.type==="sessionGroup"){w();return}v(G.id,D.shiftKey)},onPaneClick:()=>w(),onMoveStart:D=>{bC(Ws(D))&&Zo()},onMove:(D,G)=>{Xo(),bC(Ws(D))&&Zo(),cs.current&&window.clearTimeout(cs.current),cs.current=window.setTimeout(()=>x8(G),250)},onNodeDragStart:(D,G)=>{var le;if(hd(),Gs.current=!0,at.current=new Map,ma(!0),Xo(),Zo(),G.type==="sessionGroup"){const fe=(le=G.data)==null?void 0:le.sessionId,Se=new Map;if(fe)for(const Ae of Cn){const Ue=Ae.data;(Ue==null?void 0:Ue.sessionId)===fe&&Se.set(Ae.id,{x:Ae.position.x,y:Ae.position.y})}ls.current={start:{x:G.position.x,y:G.position.y},members:Se};return}Zt.current.set(G.id,{x:G.position.x,y:G.position.y})},onNodeDrag:(D,G)=>{var le;if(Xo(),G.type==="sessionGroup"){const fe=ls.current;if(!fe)return;const Se=G.position.x-fe.start.x,Ae=G.position.y-fe.start.y;for(const[et,pt]of fe.members){const tt={x:pt.x+Se,y:pt.y+Ae};Zt.current.set(et,tt),Ot.current.set(et,tt)}const Ue=at.current;if(Ue){for(const[et,pt]of fe.members)Ue.set(et,{x:pt.x+Se,y:pt.y+Ae});Ue.set(G.id,{x:G.position.x,y:G.position.y})}rs(et=>et+1);return}Zt.current.set(G.id,{x:G.position.x,y:G.position.y}),Ot.current.set(G.id,{x:G.position.x,y:G.position.y}),(le=at.current)==null||le.set(G.id,{x:G.position.x,y:G.position.y}),rs(fe=>fe+1)},onNodeDragStop:(D,G)=>{if(Xo(),Gs.current=!1,at.current=null,ma(!1),Ds(le=>le+1),G.type==="sessionGroup"){const le=ls.current;if(le){const fe=G.position.x-le.start.x,Se=G.position.y-le.start.y;for(const[Ae,Ue]of le.members){const et={x:Ue.x+fe,y:Ue.y+Se};Zt.current.set(Ae,et),Ot.current.set(Ae,et)}}ls.current=null,Nv(Ot.current,Zt.current),Ds(fe=>fe+1);return}Zt.current.set(G.id,{x:G.position.x,y:G.position.y}),Ot.current.set(G.id,{x:G.position.x,y:G.position.y}),Nv(Ot.current,Zt.current)},children:[d.jsx(nL,{gap:28,size:1,color:Wn["--grid-line"]}),d.jsx(R3,{}),d.jsx(dq,{agents:s.current.agents,visibleAgentIds:qr,positions:Ot.current,pinned:Zt.current,measured:Kn.current,spotlight:Ys,hiddenCategories:oa,now:wt,onOpenTool:g}),d.jsxs(X$,{showInteractive:!1,children:[d.jsx(Nr,{onClick:gr,title:Hs?"Recenter view + re-enable autofit":"Recenter view (autofit already on)","aria-label":"Recenter view",style:Hs?{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(Nr,{onClick:ss,title:ZB({paused:Bn,held:Gt.size,dropped:Gt.dropped}),"aria-label":QB,"aria-pressed":Bn,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(Nr,{onClick:Dr,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(Nr,{onClick:()=>fs("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(Nr,{onClick:()=>O(D=>!D),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(U$,{zoomable:!0,pannable:!0,nodeColor:Yo,nodeStrokeWidth:2,maskColor:Wn["--minimap-mask"],style:fr})]})]}),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:"×"}),en?d.jsx(j8,{agent:en,now:wt,onOpenTool:g,onShowSummary:D=>{P.has(D)&&(P.delete(D),RC(P)),b(D)},onExportSession:D=>b8(s.current,D)}):d.jsx(C8,{count:ri,workspace:Ve})]}):d.jsx("button",{type:"button",className:"detail-reopen",title:"Show detail panel","aria-label":"Show detail panel",onClick:()=>q(!0),children:"‹"}),ga&&d.jsx(b3,{tool:ga,onClose:()=>g(null)}),Ar&&d.jsx(V5,{providers:st,onClose:()=>dr(!1)}),ns&&d.jsx(oF,{onClose:()=>Io(!1),onSeen:D=>{Po(D);try{localStorage.setItem(K1,String(D))}catch{}},onWatching:Lo,palette:Wn}),k&&(()=>{const D=s.current.agents.get(k);return D?d.jsx(h3,{agent:D,onClose:()=>S(null)}):null})(),N&&d.jsx(gq,{state:s.current,sessionId:N,onClose:()=>{P.add(N),RC(P),b(null)}}),ct&&d.jsx(u5,{entries:ct.entries,since:ct.since,firstRun:ct.firstRun,running:Le,onClose:()=>It(null)}),I&&d.jsx(MD,{onClose:()=>O(!1)}),C&&d.jsx(TD,{agentCount:ri,onConfirm:()=>fs("confirmation"),onCancel:()=>j(!1)})]})}function N8({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."]}),z5(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 C8({count:e,workspace:t}){const n=YB(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 j8({agent:e,now:t,onOpenTool:n,onShowSummary:s,onExportSession:i}){const a=Cu(e.startedAt,e.endedAt,t),l=xn(e),u=l.total>0,h=e.usage.inputTokens+e.usage.outputTokens,p=new Map;for(const N of e.tools){const b=nA(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,v=Array.from(p.entries()).sort((N,b)=>b[1]-N[1]),w=p.has("mcp")?iq(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=dT(e);return d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"hero-sep",children:"·"}),d.jsxs("span",{className:"model-chip","data-family":Fu(e.model),title:N.length>0?`${e.model}
190
+ Click to set the volume and the sound of each tone, and to hear either one.`}function GT(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 U5(e){const t=GT([{agents:e}]);return t.length<2?null:t.map(n=>`${Fw(n.id)} ${Je(n.cost)}`).join(" · ")}function V1(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 W5(e,t){if(!(t>0)||!(e>0))return"0%";const n=e/t*100;return n<.1?"<0.1%":`${n.toFixed(1)}%`}function uu(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 H5=[7,14,30,90];function G5(e){const[t,n]=_.useState(null),[s,i]=_.useState(!1),a=_.useState($5)[0],l=_.useRef(!1),u=(h=!1)=>{if(h&&!ar(l.current))return;const p=a.begin();l.current=h;const f=e;i(!0);const v=`/api/ccusage?since=${Kv(f)}${h?"&refresh=1":""}`;fetch(v).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 _.useEffect(()=>(u(!1),()=>a.cancel()),[e]),{landed:t,loading:s,reload:()=>u(!0)}}function V5({onClose:e,providers:t}){var z;const[n,s]=_.useState(30),[i,a]=_.useState(null),{landed:l,loading:u,reload:h}=G5(n),p=_.useRef(null),f=_n(e,{focusRef:p}),g=L5({loading:u,want:n,answer:l&&{range:l.range,ok:l.resp.ok===!0,days:((z=l.resp.days)==null?void 0:z.length)??0}}),v=g.phase==="chart"?l.resp.days??[]:[],w=_.useMemo(()=>v.reduce((M,A)=>Math.max(M,A.totalCost),0),[v]),N=_.useRef(null);_.useLayoutEffect(()=>{const M=N.current;M&&(M.scrollLeft=M.scrollWidth)},[v]);const{totalCost:b,totalTok:k,inOut:S,cacheRead:E,modelCosts:C}=_.useMemo(()=>{let M=0,A=0,q=0,G=0;const Y=new Map;for(const R of v){M+=R.totalCost,A+=R.totalTokens,q+=R.inputTokens+R.outputTokens,G+=R.cacheReadTokens;for(const Q of R.modelBreakdowns)Y.set(Q.modelName,(Y.get(Q.modelName)??0)+Q.cost)}return{totalCost:M,totalTok:A,inOut:q,cacheRead:G,modelCosts:Y}},[v]),j=_.useMemo(()=>Array.from(C.entries()).sort((M,A)=>A[1]-M[1]),[C]),I=_.useMemo(()=>GT(v),[v]),O=I.length>1,P=i?v.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:F5(t,I.map(M=>M.id))})]}),d.jsx("div",{className:"uh-range",role:"group","aria-label":"Range",children:H5.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:Hi(l.resp)||void 0,children:[z4(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(du,{label:"total cost",val:Je(b),accent:!0}),d.jsx(du,{label:"tokens",val:Rt(k)}),d.jsx(du,{label:"input+output",val:Rt(S)}),d.jsx(du,{label:"cache reads",val:Rt(E)})]}),O&&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:V1(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} · ${Rt(M.tokens)} tokens`,children:[d.jsx("span",{className:"uh-legend-dot",style:{background:V1(M.id)}}),Fw(M.id),d.jsx("span",{className:"uh-agent-cost",children:Je(M.cost)}),d.jsx("span",{className:"uh-agent-share",children:W5(M.cost,b)})]},M.id))})]}),d.jsx("div",{ref:N,className:"uh-chart",role:"group","aria-label":"Daily cost by model",children:v.map(M=>{const A=w>0?M.totalCost/w*100:0,q=M.period===i,G=`${M.period}, ${Je(M.totalCost)}`;return d.jsxs("button",{className:`uh-bar-col${q?" sel":""}`,onClick:()=>a(q?null:M.period),"aria-pressed":q,"aria-label":G,title:`${M.period} · ${Je(M.totalCost)}`,style:{flexBasis:`${100/v.length}%`},children:[d.jsx("div",{className:"uh-bar",style:{height:`${Math.max(A,M.totalCost>0?2:0)}%`},children:M.modelBreakdowns.slice().sort((Y,R)=>R.cost-Y.cost).map(Y=>{const R=M.totalCost>0?Y.cost/M.totalCost*100:0;return d.jsx("div",{className:"uh-bar-seg",style:{height:`${R}%`,background:uu(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:j.map(([M,A])=>d.jsxs("span",{className:"uh-legend-item",title:M,children:[d.jsx("span",{className:"uh-legend-dot",style:{background:uu(M)}}),Ls(M)," ",d.jsx("span",{className:"uh-legend-cost",children:Je(A)})]},M))}),P&&d.jsxs("div",{className:"uh-detail",children:[d.jsxs("div",{className:"uh-detail-head",children:[d.jsx("span",{className:"uh-detail-date",children:P.period}),d.jsx("span",{className:"uh-detail-cost",children:Je(P.totalCost)}),(()=>{var q,G;const A=U5(P.agents)??((G=(q=P.metadata)==null?void 0:q.agents)!=null&&G.length?P.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(fu,{label:"input",val:Rt(P.inputTokens)}),d.jsx(fu,{label:"output",val:Rt(P.outputTokens)}),d.jsx(fu,{label:"cache write",val:Rt(P.cacheCreationTokens)}),d.jsx(fu,{label:"cache read",val:Rt(P.cacheReadTokens)})]}),d.jsx("div",{className:"uh-detail-models",children:P.modelBreakdowns.slice().sort((M,A)=>A.cost-M.cost).map(M=>{const A=P.totalCost>0?M.cost/P.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:uu(M.modelName)}}),d.jsx("span",{className:"uh-model-label",children:Ls(M.modelName)})]}),d.jsx("span",{className:"uh-model-bar",children:d.jsx("span",{className:"uh-model-bar-fill",style:{width:`${A}%`,background:uu(M.modelName)}})}),d.jsx("span",{className:"uh-model-cost",children:Je(M.cost)})]},M.modelName)})})]})]})]})})}function du({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 fu({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 Y5(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 Y1=1e4,K5=12e3;function X5({browsers:e,findings:t,watching:n,palette:s,now:i=()=>Date.now()}){const a=_.useRef(null),l=_.useRef(null);return l.current={browsers:e,findings:t,watching:n},_.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 v=()=>{var ne;if(g)return;const N=l.current;if(!N)return;const{browsers:b,findings:k,watching:S}=N,E=s["--accent"]||"#7dd3fc",C=s["--line"]||"#1f2229",j=s["--text-dim"]||"#6e727c",I=Y5(s["--bg"]),O=I?42:26,P=I?.85:.65,z=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 G=A/2,Y=q/2,R=Math.min(A,q)/2-6;h.strokeStyle=C,h.lineWidth=1,h.globalAlpha=I?1:.9;for(const X of[.4,.7,1])h.beginPath(),h.arc(G,Y,R*X,0,Math.PI*2),h.stroke();h.beginPath(),h.moveTo(G-R,Y),h.lineTo(G+R,Y),h.moveTo(G,Y-R),h.lineTo(G,Y+R),h.stroke(),h.globalAlpha=1;const H=(S&&!p?z%Y1/Y1:0)*Math.PI*2-Math.PI/2;if(S){const X=(ne=h.createConicGradient)==null?void 0:ne.call(h,H-.85,G,Y);X&&(X.addColorStop(0,"transparent"),X.addColorStop(.85/(Math.PI*2),`color-mix(in srgb, ${E} ${O}%, transparent)`),X.addColorStop(1,"transparent"),h.fillStyle=X,h.beginPath(),h.moveTo(G,Y),h.arc(G,Y,R,H-.85,H),h.closePath(),h.fill()),h.strokeStyle=E,h.globalAlpha=P,h.beginPath(),h.moveTo(G,Y),h.lineTo(G+Math.cos(H)*R,Y+Math.sin(H)*R),h.stroke(),h.globalAlpha=1}b.forEach((X,U)=>{const J=U/Math.max(b.length,1)*Math.PI*2-Math.PI/2,$=X.lastReadMs===null?1:Math.min(1,(z-X.lastReadMs)/12e4),V=R*(.42+$*.5),Z=G+Math.cos(J)*V,D=Y+Math.sin(J)*V,L=Math.abs((H-J+Math.PI*3)%(Math.PI*2)-Math.PI),K=S?Math.max(0,1-L/.55):0;h.beginPath(),h.arc(Z,D,3+K*1.6,0,Math.PI*2),h.fillStyle=X.running?E:j,h.globalAlpha=X.running?.55+K*.45:.35,h.fill(),h.globalAlpha=1});for(const X of k){const U=(z-X.atMs)/K5;if(U<0||U>1)continue;const $=Math.max(0,b.findIndex(D=>D.key===X.browser))/Math.max(b.length,1)*Math.PI*2-Math.PI/2,V=G+Math.cos($)*R*.6,Z=Y+Math.sin($)*R*.6;h.beginPath(),h.arc(V,Z,4+U*22,0,Math.PI*2),h.strokeStyle=E,h.globalAlpha=(1-U)*.8,h.lineWidth=1.5,h.stroke(),h.globalAlpha=1}f=requestAnimationFrame(v)};return v(),()=>{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 K1="agent-dag.browserWatch.seenMs";function Q5(e,t){return e.filter(n=>n.startMs>t)}function Z5(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 VT(e){return(e??[]).filter(t=>t.installed&&t.profiles>0)}function X1(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 eF(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 tF(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 nF(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=VT(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 rF(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 sF(e){return new Date(e).toLocaleDateString(void 0,{weekday:"short",day:"numeric",month:"short"})}function Q1(e){const t=Math.round((e.endMs-e.startMs)/6e4);return t<1?"":`${t} min`}function oF({onClose:e,onSeen:t,onWatching:n,palette:s}){const i=_n(e),[a,l]=_.useState(null),[u,h]=_.useState(null),[p,f]=_.useState(!1),g=_.useRef(!1),[v,w]=_.useState(null),[N,b]=_.useState(null),[k,S]=_.useState(!1),[E,C]=_.useState(!1),[j,I]=_.useState(!1),[O,P]=_.useState(!1),[z,M]=_.useState(!1),[A,q]=_.useState(!1),[G,Y]=_.useState(()=>Date.now());_.useEffect(()=>{const Z=setInterval(()=>Y(Date.now()),1e3);return()=>clearInterval(Z)},[]);const R=_.useCallback(async Z=>{var D;if(!(Z&&!ar(g.current))){g.current=Z,f(!0);try{const L=await fetch(`/api/browser-watch${Z?"?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]);_.useEffect(()=>{R(!1)},[R]),_.useEffect(()=>{const Z=setInterval(()=>{R(!1)},1e4);return()=>clearInterval(Z)},[R]);const Q=_.useCallback(async Z=>{try{await fetch("/api/browser-watch/dismiss",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({host:Z.host,startMs:Z.startMs})})}finally{await R(!1)}},[R]),H=_.useCallback(async Z=>{S(!0);try{const D=await fetch("/api/browser-watch",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(Z)});if(!D.ok)throw new Error(`the deck answered ${D.status}`);await R(!1)}catch(D){h(D instanceof Error?D.message:String(D))}finally{S(!1)}},[R]);_.useEffect(()=>()=>t(Date.now()),[t]);const ne=_.useMemo(()=>{const Z=[];for(const D of(a==null?void 0:a.episodes)??[]){const L=sF(D.startMs),K=Z[Z.length-1];K&&K.label===L?K.episodes.push(D):Z.push({label:L,episodes:[D]})}return Z},[a]),X=VT(a==null?void 0:a.browsers),U=((a==null?void 0:a.browsers)??[]).filter(Z=>!(Z.installed&&Z.profiles>0)),J=a?nF(a):null,$=X.reduce((Z,D)=>Z+D.profiles,0),V=a?Z5(a.coverage.lastHumanMs,a.coverage.quietMs,G):null;return d.jsx("div",{className:"modal-backdrop",onClick:e,role:"presentation",children:d.jsxs("div",{ref:i,className:"modal bw-modal",onClick:Z=>Z.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 R(!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:()=>P(Z=>!Z),"aria-expanded":O,"aria-label":"What the sweep and the dots mean",children:"?"})]}),d.jsxs("div",{className:"bw-glance",children:[d.jsx(X5,{browsers:X.map(Z=>{var D;return{key:Z.key,name:Z.name,running:Z.running,lastReadMs:((D=a.profiles.find(L=>L.browser===Z.key))==null?void 0:D.lastWrittenMs)??null}}),findings:a.episodes.slice(0,6).map(Z=>({browser:Z.browser??null,atMs:Z.endMs})),watching:a.settings.enabled,palette:s}),d.jsx("ul",{className:"bw-counts",children:eF(X,a.profiles).map(Z=>d.jsxs("li",{children:[d.jsx("span",{className:"bw-count-n",children:Z.visits.toLocaleString("en-US")}),d.jsx("span",{className:"bw-count-of",children:Z.name})]},Z.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 ",tF(a.coverage.checkedMs,G),a.coverage.checks>0&&d.jsxs(d.Fragment,{children:[" · ",a.coverage.checks.toLocaleString("en-US")," ",a.coverage.checks===1?"check":"checks"]})]}),V!==null&&d.jsxs("p",{className:"bw-gate",children:["You are browsing — a program page would count in ",J5(V)]}),O&&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(Z=>!Z),"aria-expanded":z,"aria-label":"What running, idle and connected to Anthropic mean",children:"?"})]}),z&&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(Z=>d.jsxs("li",{children:[d.jsx("span",{className:`bw-prof-dot${Z.running?" on":""}`,"aria-hidden":!0}),d.jsx("span",{className:"bw-prof-name",children:Z.name}),d.jsx("span",{className:"bw-prof-state",children:Z.running?"running":"idle"}),Z.running&&Z.relay.state==="live"&&d.jsx("span",{className:"bw-relay",children:"connected to Anthropic"})]},Z.key))}),U.length>0&&d.jsxs(d.Fragment,{children:[d.jsxs("button",{className:"bw-why bw-rest-head",onClick:()=>q(Z=>!Z),"aria-expanded":A,children:[d.jsx("span",{className:"bw-chev","aria-hidden":!0,children:A?"▾":"▸"})," ",U.length," not watched"]}),A&&d.jsxs("p",{className:"bw-rest",children:[U.map(Z=>Z.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(Z=>d.jsxs("div",{className:"bw-day",children:[d.jsx("h4",{className:"bw-sec-head",children:Z.label}),Z.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:[rF(D),Q1(D)&&d.jsxs(d.Fragment,{children:[" · ",Q1(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 Q(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)})]},Z.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(Z=>d.jsxs("div",{className:`bw-log-line ${Z.level}${Z.parts?"":" sys"}`,children:[d.jsx("span",{className:"bw-log-time",children:new Date(Z.atMs).toLocaleTimeString("en-GB",{hour12:!1})}),Z.parts?d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"bw-log-browser",children:Z.parts.browser}),d.jsx("span",{className:"bw-log-profile",title:Z.parts.profile,children:Z.parts.profile}),d.jsxs("span",{className:"bw-log-value",children:[Z.parts.value,Z.parts.flagged>0&&d.jsxs("span",{className:"bw-log-flag",children:[" · ",Z.parts.flagged," flagged"]})]})]}):d.jsx("span",{className:"bw-log-sys",children:Z.text})]},`${Z.atMs}-${Z.level}-${Z.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:v??a.settings.quietMinutes,onChange:Z=>{w(Number(Z.target.value)),H({quietMinutes:Number(Z.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:Z=>void H({reaction:Z.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(Z=>d.jsx("option",{value:Z,children:Z==="notify"?"notify me":Z==="close-tab"?"close the tab":"quit the browser"},Z))})]}),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(Z=>!Z),"aria-expanded":j,children:[d.jsx("span",{className:"bw-chev","aria-hidden":!0,children:j?"▾":"▸"})," What Browser Watch can access"]}),j&&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:X1(a,k).word},X1(a,k).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:()=>C(Z=>!Z),"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 H({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 zw(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 ih,Z1;function iF(){if(Z1)return ih;Z1=1;function e(){this.__data__=[],this.size=0}return ih=e,ih}var ah,J1;function Qi(){if(J1)return ah;J1=1;function e(t,n){return t===n||t!==t&&n!==n}return ah=e,ah}var lh,ek;function Vu(){if(ek)return lh;ek=1;var e=Qi();function t(n,s){for(var i=n.length;i--;)if(e(n[i][0],s))return i;return-1}return lh=t,lh}var ch,tk;function aF(){if(tk)return ch;tk=1;var e=Vu(),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 ch=s,ch}var uh,nk;function lF(){if(nk)return uh;nk=1;var e=Vu();function t(n){var s=this.__data__,i=e(s,n);return i<0?void 0:s[i][1]}return uh=t,uh}var dh,rk;function cF(){if(rk)return dh;rk=1;var e=Vu();function t(n){return e(this.__data__,n)>-1}return dh=t,dh}var fh,sk;function uF(){if(sk)return fh;sk=1;var e=Vu();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 fh=t,fh}var hh,ok;function Yu(){if(ok)return hh;ok=1;var e=iF(),t=aF(),n=lF(),s=cF(),i=uF();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,hh=a,hh}var ph,ik;function dF(){if(ik)return ph;ik=1;var e=Yu();function t(){this.__data__=new e,this.size=0}return ph=t,ph}var mh,ak;function fF(){if(ak)return mh;ak=1;function e(t){var n=this.__data__,s=n.delete(t);return this.size=n.size,s}return mh=e,mh}var gh,lk;function hF(){if(lk)return gh;lk=1;function e(t){return this.__data__.get(t)}return gh=e,gh}var yh,ck;function pF(){if(ck)return yh;ck=1;function e(t){return this.__data__.has(t)}return yh=e,yh}var vh,uk;function YT(){if(uk)return vh;uk=1;var e=typeof Vc=="object"&&Vc&&Vc.Object===Object&&Vc;return vh=e,vh}var wh,dk;function dr(){if(dk)return wh;dk=1;var e=YT(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return wh=n,wh}var xh,fk;function Zi(){if(fk)return xh;fk=1;var e=dr(),t=e.Symbol;return xh=t,xh}var bh,hk;function mF(){if(hk)return bh;hk=1;var e=Zi(),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 bh=a,bh}var kh,pk;function gF(){if(pk)return kh;pk=1;var e=Object.prototype,t=e.toString;function n(s){return t.call(s)}return kh=n,kh}var _h,mk;function No(){if(mk)return _h;mk=1;var e=Zi(),t=mF(),n=gF(),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 _h=l,_h}var Sh,gk;function qn(){if(gk)return Sh;gk=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return Sh=e,Sh}var Nh,yk;function Ol(){if(yk)return Nh;yk=1;var e=No(),t=qn(),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 Nh=l,Nh}var Eh,vk;function yF(){if(vk)return Eh;vk=1;var e=dr(),t=e["__core-js_shared__"];return Eh=t,Eh}var Ch,wk;function vF(){if(wk)return Ch;wk=1;var e=yF(),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 Ch=n,Ch}var jh,xk;function KT(){if(xk)return jh;xk=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 jh=n,jh}var Th,bk;function wF(){if(bk)return Th;bk=1;var e=Ol(),t=vF(),n=qn(),s=KT(),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(v){if(!n(v)||t(v))return!1;var w=e(v)?f:a;return w.test(s(v))}return Th=g,Th}var Rh,kk;function xF(){if(kk)return Rh;kk=1;function e(t,n){return t==null?void 0:t[n]}return Rh=e,Rh}var Ah,_k;function Eo(){if(_k)return Ah;_k=1;var e=wF(),t=xF();function n(s,i){var a=t(s,i);return e(a)?a:void 0}return Ah=n,Ah}var Mh,Sk;function Bw(){if(Sk)return Mh;Sk=1;var e=Eo(),t=dr(),n=e(t,"Map");return Mh=n,Mh}var Ih,Nk;function Ku(){if(Nk)return Ih;Nk=1;var e=Eo(),t=e(Object,"create");return Ih=t,Ih}var Oh,Ek;function bF(){if(Ek)return Oh;Ek=1;var e=Ku();function t(){this.__data__=e?e(null):{},this.size=0}return Oh=t,Oh}var Ph,Ck;function kF(){if(Ck)return Ph;Ck=1;function e(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}return Ph=e,Ph}var $h,jk;function _F(){if(jk)return $h;jk=1;var e=Ku(),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 $h=i,$h}var Lh,Tk;function SF(){if(Tk)return Lh;Tk=1;var e=Ku(),t=Object.prototype,n=t.hasOwnProperty;function s(i){var a=this.__data__;return e?a[i]!==void 0:n.call(a,i)}return Lh=s,Lh}var qh,Rk;function NF(){if(Rk)return qh;Rk=1;var e=Ku(),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 qh=n,qh}var Dh,Ak;function EF(){if(Ak)return Dh;Ak=1;var e=bF(),t=kF(),n=_F(),s=SF(),i=NF();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,Dh=a,Dh}var Fh,Mk;function CF(){if(Mk)return Fh;Mk=1;var e=EF(),t=Yu(),n=Bw();function s(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return Fh=s,Fh}var zh,Ik;function jF(){if(Ik)return zh;Ik=1;function e(t){var n=typeof t;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?t!=="__proto__":t===null}return zh=e,zh}var Bh,Ok;function Xu(){if(Ok)return Bh;Ok=1;var e=jF();function t(n,s){var i=n.__data__;return e(s)?i[typeof s=="string"?"string":"hash"]:i.map}return Bh=t,Bh}var Uh,Pk;function TF(){if(Pk)return Uh;Pk=1;var e=Xu();function t(n){var s=e(this,n).delete(n);return this.size-=s?1:0,s}return Uh=t,Uh}var Wh,$k;function RF(){if($k)return Wh;$k=1;var e=Xu();function t(n){return e(this,n).get(n)}return Wh=t,Wh}var Hh,Lk;function AF(){if(Lk)return Hh;Lk=1;var e=Xu();function t(n){return e(this,n).has(n)}return Hh=t,Hh}var Gh,qk;function MF(){if(qk)return Gh;qk=1;var e=Xu();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 Gh=t,Gh}var Vh,Dk;function Uw(){if(Dk)return Vh;Dk=1;var e=CF(),t=TF(),n=RF(),s=AF(),i=MF();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,Vh=a,Vh}var Yh,Fk;function IF(){if(Fk)return Yh;Fk=1;var e=Yu(),t=Bw(),n=Uw(),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 Yh=i,Yh}var Kh,zk;function Qu(){if(zk)return Kh;zk=1;var e=Yu(),t=dF(),n=fF(),s=hF(),i=pF(),a=IF();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,Kh=l,Kh}var Xh,Bk;function Ww(){if(Bk)return Xh;Bk=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 Xh=e,Xh}var Qh,Uk;function XT(){if(Uk)return Qh;Uk=1;var e=Eo(),t=(function(){try{var n=e(Object,"defineProperty");return n({},"",{}),n}catch{}})();return Qh=t,Qh}var Zh,Wk;function Zu(){if(Wk)return Zh;Wk=1;var e=XT();function t(n,s,i){s=="__proto__"&&e?e(n,s,{configurable:!0,enumerable:!0,value:i,writable:!0}):n[s]=i}return Zh=t,Zh}var Jh,Hk;function Ju(){if(Hk)return Jh;Hk=1;var e=Zu(),t=Qi(),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 Jh=i,Jh}var ep,Gk;function Pl(){if(Gk)return ep;Gk=1;var e=Ju(),t=Zu();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 ep=n,ep}var tp,Vk;function OF(){if(Vk)return tp;Vk=1;function e(t,n){for(var s=-1,i=Array(t);++s<t;)i[s]=n(s);return i}return tp=e,tp}var np,Yk;function jr(){if(Yk)return np;Yk=1;function e(t){return t!=null&&typeof t=="object"}return np=e,np}var rp,Kk;function PF(){if(Kk)return rp;Kk=1;var e=No(),t=jr(),n="[object Arguments]";function s(i){return t(i)&&e(i)==n}return rp=s,rp}var sp,Xk;function $l(){if(Xk)return sp;Xk=1;var e=PF(),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 sp=a,sp}var op,Qk;function Mt(){if(Qk)return op;Qk=1;var e=Array.isArray;return op=e,op}var ol={exports:{}},ip,Zk;function $F(){if(Zk)return ip;Zk=1;function e(){return!1}return ip=e,ip}ol.exports;var Jk;function Ji(){return Jk||(Jk=1,(function(e,t){var n=dr(),s=$F(),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})(ol,ol.exports)),ol.exports}var ap,e_;function ed(){if(e_)return ap;e_=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 ap=n,ap}var lp,t_;function Hw(){if(t_)return lp;t_=1;var e=9007199254740991;function t(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=e}return lp=t,lp}var cp,n_;function LF(){if(n_)return cp;n_=1;var e=No(),t=Hw(),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]",v="[object RegExp]",w="[object Set]",N="[object String]",b="[object WeakMap]",k="[object ArrayBuffer]",S="[object DataView]",E="[object Float32Array]",C="[object Float64Array]",j="[object Int8Array]",I="[object Int16Array]",O="[object Int32Array]",P="[object Uint8Array]",z="[object Uint8ClampedArray]",M="[object Uint16Array]",A="[object Uint32Array]",q={};q[E]=q[C]=q[j]=q[I]=q[O]=q[P]=q[z]=q[M]=q[A]=!0,q[s]=q[i]=q[k]=q[a]=q[S]=q[l]=q[u]=q[h]=q[p]=q[f]=q[g]=q[v]=q[w]=q[N]=q[b]=!1;function G(Y){return n(Y)&&t(Y.length)&&!!q[e(Y)]}return cp=G,cp}var up,r_;function td(){if(r_)return up;r_=1;function e(t){return function(n){return t(n)}}return up=e,up}var il={exports:{}};il.exports;var s_;function Gw(){return s_||(s_=1,(function(e,t){var n=YT(),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})(il,il.exports)),il.exports}var dp,o_;function Ll(){if(o_)return dp;o_=1;var e=LF(),t=td(),n=Gw(),s=n&&n.isTypedArray,i=s?t(s):e;return dp=i,dp}var fp,i_;function QT(){if(i_)return fp;i_=1;var e=OF(),t=$l(),n=Mt(),s=Ji(),i=ed(),a=Ll(),l=Object.prototype,u=l.hasOwnProperty;function h(p,f){var g=n(p),v=!g&&t(p),w=!g&&!v&&s(p),N=!g&&!v&&!w&&a(p),b=g||v||w||N,k=b?e(p.length,String):[],S=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,S)))&&k.push(E);return k}return fp=h,fp}var hp,a_;function nd(){if(a_)return hp;a_=1;var e=Object.prototype;function t(n){var s=n&&n.constructor,i=typeof s=="function"&&s.prototype||e;return n===i}return hp=t,hp}var pp,l_;function ZT(){if(l_)return pp;l_=1;function e(t,n){return function(s){return t(n(s))}}return pp=e,pp}var mp,c_;function qF(){if(c_)return mp;c_=1;var e=ZT(),t=e(Object.keys,Object);return mp=t,mp}var gp,u_;function Vw(){if(u_)return gp;u_=1;var e=nd(),t=qF(),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 gp=i,gp}var yp,d_;function es(){if(d_)return yp;d_=1;var e=Ol(),t=Hw();function n(s){return s!=null&&t(s.length)&&!e(s)}return yp=n,yp}var vp,f_;function qs(){if(f_)return vp;f_=1;var e=QT(),t=Vw(),n=es();function s(i){return n(i)?e(i):t(i)}return vp=s,vp}var wp,h_;function DF(){if(h_)return wp;h_=1;var e=Pl(),t=qs();function n(s,i){return s&&e(i,t(i),s)}return wp=n,wp}var xp,p_;function FF(){if(p_)return xp;p_=1;function e(t){var n=[];if(t!=null)for(var s in Object(t))n.push(s);return n}return xp=e,xp}var bp,m_;function zF(){if(m_)return bp;m_=1;var e=qn(),t=nd(),n=FF(),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 bp=a,bp}var kp,g_;function Co(){if(g_)return kp;g_=1;var e=QT(),t=zF(),n=es();function s(i){return n(i)?e(i,!0):t(i)}return kp=s,kp}var _p,y_;function BF(){if(y_)return _p;y_=1;var e=Pl(),t=Co();function n(s,i){return s&&e(i,t(i),s)}return _p=n,_p}var al={exports:{}};al.exports;var v_;function JT(){return v_||(v_=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,v=u?u(g):new p.constructor(g);return p.copy(v),v}e.exports=h})(al,al.exports)),al.exports}var Sp,w_;function eR(){if(w_)return Sp;w_=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 Sp=e,Sp}var Np,x_;function tR(){if(x_)return Np;x_=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 Np=e,Np}var Ep,b_;function nR(){if(b_)return Ep;b_=1;function e(){return[]}return Ep=e,Ep}var Cp,k_;function Yw(){if(k_)return Cp;k_=1;var e=tR(),t=nR(),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 Cp=a,Cp}var jp,__;function UF(){if(__)return jp;__=1;var e=Pl(),t=Yw();function n(s,i){return e(s,t(s),i)}return jp=n,jp}var Tp,S_;function Kw(){if(S_)return Tp;S_=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 Tp=e,Tp}var Rp,N_;function rd(){if(N_)return Rp;N_=1;var e=ZT(),t=e(Object.getPrototypeOf,Object);return Rp=t,Rp}var Ap,E_;function rR(){if(E_)return Ap;E_=1;var e=Kw(),t=rd(),n=Yw(),s=nR(),i=Object.getOwnPropertySymbols,a=i?function(l){for(var u=[];l;)e(u,n(l)),l=t(l);return u}:s;return Ap=a,Ap}var Mp,C_;function WF(){if(C_)return Mp;C_=1;var e=Pl(),t=rR();function n(s,i){return e(s,t(s),i)}return Mp=n,Mp}var Ip,j_;function sR(){if(j_)return Ip;j_=1;var e=Kw(),t=Mt();function n(s,i,a){var l=i(s);return t(s)?l:e(l,a(s))}return Ip=n,Ip}var Op,T_;function oR(){if(T_)return Op;T_=1;var e=sR(),t=Yw(),n=qs();function s(i){return e(i,n,t)}return Op=s,Op}var Pp,R_;function HF(){if(R_)return Pp;R_=1;var e=sR(),t=rR(),n=Co();function s(i){return e(i,n,t)}return Pp=s,Pp}var $p,A_;function GF(){if(A_)return $p;A_=1;var e=Eo(),t=dr(),n=e(t,"DataView");return $p=n,$p}var Lp,M_;function VF(){if(M_)return Lp;M_=1;var e=Eo(),t=dr(),n=e(t,"Promise");return Lp=n,Lp}var qp,I_;function iR(){if(I_)return qp;I_=1;var e=Eo(),t=dr(),n=e(t,"Set");return qp=n,qp}var Dp,O_;function YF(){if(O_)return Dp;O_=1;var e=Eo(),t=dr(),n=e(t,"WeakMap");return Dp=n,Dp}var Fp,P_;function ea(){if(P_)return Fp;P_=1;var e=GF(),t=Bw(),n=VF(),s=iR(),i=YF(),a=No(),l=KT(),u="[object Map]",h="[object Object]",p="[object Promise]",f="[object Set]",g="[object WeakMap]",v="[object DataView]",w=l(e),N=l(t),b=l(n),k=l(s),S=l(i),E=a;return(e&&E(new e(new ArrayBuffer(1)))!=v||t&&E(new t)!=u||n&&E(n.resolve())!=p||s&&E(new s)!=f||i&&E(new i)!=g)&&(E=function(C){var j=a(C),I=j==h?C.constructor:void 0,O=I?l(I):"";if(O)switch(O){case w:return v;case N:return u;case b:return p;case k:return f;case S:return g}return j}),Fp=E,Fp}var zp,$_;function KF(){if($_)return zp;$_=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 zp=n,zp}var Bp,L_;function aR(){if(L_)return Bp;L_=1;var e=dr(),t=e.Uint8Array;return Bp=t,Bp}var Up,q_;function Xw(){if(q_)return Up;q_=1;var e=aR();function t(n){var s=new n.constructor(n.byteLength);return new e(s).set(new e(n)),s}return Up=t,Up}var Wp,D_;function XF(){if(D_)return Wp;D_=1;var e=Xw();function t(n,s){var i=s?e(n.buffer):n.buffer;return new n.constructor(i,n.byteOffset,n.byteLength)}return Wp=t,Wp}var Hp,F_;function QF(){if(F_)return Hp;F_=1;var e=/\w*$/;function t(n){var s=new n.constructor(n.source,e.exec(n));return s.lastIndex=n.lastIndex,s}return Hp=t,Hp}var Gp,z_;function ZF(){if(z_)return Gp;z_=1;var e=Zi(),t=e?e.prototype:void 0,n=t?t.valueOf:void 0;function s(i){return n?Object(n.call(i)):{}}return Gp=s,Gp}var Vp,B_;function lR(){if(B_)return Vp;B_=1;var e=Xw();function t(n,s){var i=s?e(n.buffer):n.buffer;return new n.constructor(i,n.byteOffset,n.length)}return Vp=t,Vp}var Yp,U_;function JF(){if(U_)return Yp;U_=1;var e=Xw(),t=XF(),n=QF(),s=ZF(),i=lR(),a="[object Boolean]",l="[object Date]",u="[object Map]",h="[object Number]",p="[object RegExp]",f="[object Set]",g="[object String]",v="[object Symbol]",w="[object ArrayBuffer]",N="[object DataView]",b="[object Float32Array]",k="[object Float64Array]",S="[object Int8Array]",E="[object Int16Array]",C="[object Int32Array]",j="[object Uint8Array]",I="[object Uint8ClampedArray]",O="[object Uint16Array]",P="[object Uint32Array]";function z(M,A,q){var G=M.constructor;switch(A){case w:return e(M);case a:case l:return new G(+M);case N:return t(M,q);case b:case k:case S:case E:case C:case j:case I:case O:case P:return i(M,q);case u:return new G;case h:case g:return new G(M);case p:return n(M);case f:return new G;case v:return s(M)}}return Yp=z,Yp}var Kp,W_;function cR(){if(W_)return Kp;W_=1;var e=qn(),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 Kp=n,Kp}var Xp,H_;function uR(){if(H_)return Xp;H_=1;var e=cR(),t=rd(),n=nd();function s(i){return typeof i.constructor=="function"&&!n(i)?e(t(i)):{}}return Xp=s,Xp}var Qp,G_;function e6(){if(G_)return Qp;G_=1;var e=ea(),t=jr(),n="[object Map]";function s(i){return t(i)&&e(i)==n}return Qp=s,Qp}var Zp,V_;function t6(){if(V_)return Zp;V_=1;var e=e6(),t=td(),n=Gw(),s=n&&n.isMap,i=s?t(s):e;return Zp=i,Zp}var Jp,Y_;function n6(){if(Y_)return Jp;Y_=1;var e=ea(),t=jr(),n="[object Set]";function s(i){return t(i)&&e(i)==n}return Jp=s,Jp}var em,K_;function r6(){if(K_)return em;K_=1;var e=n6(),t=td(),n=Gw(),s=n&&n.isSet,i=s?t(s):e;return em=i,em}var tm,X_;function dR(){if(X_)return tm;X_=1;var e=Qu(),t=Ww(),n=Ju(),s=DF(),i=BF(),a=JT(),l=eR(),u=UF(),h=WF(),p=oR(),f=HF(),g=ea(),v=KF(),w=JF(),N=uR(),b=Mt(),k=Ji(),S=t6(),E=qn(),C=r6(),j=qs(),I=Co(),O=1,P=2,z=4,M="[object Arguments]",A="[object Array]",q="[object Boolean]",G="[object Date]",Y="[object Error]",R="[object Function]",Q="[object GeneratorFunction]",H="[object Map]",ne="[object Number]",X="[object Object]",U="[object RegExp]",J="[object Set]",$="[object String]",V="[object Symbol]",Z="[object WeakMap]",D="[object ArrayBuffer]",L="[object DataView]",K="[object Float32Array]",se="[object Float64Array]",he="[object Int8Array]",me="[object Int16Array]",xe="[object Int32Array]",Ee="[object Uint8Array]",He="[object Uint8ClampedArray]",Fe="[object Uint16Array]",Ie="[object Uint32Array]",be={};be[M]=be[A]=be[D]=be[L]=be[q]=be[G]=be[K]=be[se]=be[he]=be[me]=be[xe]=be[H]=be[ne]=be[X]=be[U]=be[J]=be[$]=be[V]=be[Ee]=be[He]=be[Fe]=be[Ie]=!0,be[Y]=be[R]=be[Z]=!1;function ue(re,pe,Oe,nt,st,Xe){var Pe,Ue=pe&O,Ge=pe&P,it=pe&z;if(Oe&&(Pe=st?Oe(re,nt,st,Xe):Oe(re)),Pe!==void 0)return Pe;if(!E(re))return re;var ke=b(re);if(ke){if(Pe=v(re),!Ue)return l(re,Pe)}else{var ct=g(re),It=ct==R||ct==Q;if(k(re))return a(re,Ue);if(ct==X||ct==M||It&&!st){if(Pe=Ge||It?{}:N(re),!Ue)return Ge?h(re,i(Pe,re)):u(re,s(Pe,re))}else{if(!be[ct])return st?re:{};Pe=w(re,ct,Ue)}}Xe||(Xe=new e);var ae=Xe.get(re);if(ae)return ae;Xe.set(re,Pe),C(re)?re.forEach(function(Ce){Pe.add(ue(Ce,pe,Oe,Ce,re,Xe))}):S(re)&&re.forEach(function(Ce,Ve){Pe.set(Ve,ue(Ce,pe,Oe,Ve,re,Xe))});var Le=it?Ge?f:p:Ge?I:j,ze=ke?void 0:Le(re);return t(ze||re,function(Ce,Ve){ze&&(Ve=Ce,Ce=re[Ve]),n(Pe,Ve,ue(Ce,pe,Oe,Ve,re,Xe))}),Pe}return tm=ue,tm}var nm,Q_;function s6(){if(Q_)return nm;Q_=1;var e=dR(),t=4;function n(s){return e(s,t)}return nm=n,nm}var rm,Z_;function Qw(){if(Z_)return rm;Z_=1;function e(t){return function(){return t}}return rm=e,rm}var sm,J_;function o6(){if(J_)return sm;J_=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 sm=e,sm}var om,eS;function Zw(){if(eS)return om;eS=1;var e=o6(),t=e();return om=t,om}var im,tS;function Jw(){if(tS)return im;tS=1;var e=Zw(),t=qs();function n(s,i){return s&&e(s,i,t)}return im=n,im}var am,nS;function i6(){if(nS)return am;nS=1;var e=es();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 am=t,am}var lm,rS;function sd(){if(rS)return lm;rS=1;var e=Jw(),t=i6(),n=t(e);return lm=n,lm}var cm,sS;function jo(){if(sS)return cm;sS=1;function e(t){return t}return cm=e,cm}var um,oS;function fR(){if(oS)return um;oS=1;var e=jo();function t(n){return typeof n=="function"?n:e}return um=t,um}var dm,iS;function hR(){if(iS)return dm;iS=1;var e=Ww(),t=sd(),n=fR(),s=Mt();function i(a,l){var u=s(a)?e:t;return u(a,n(l))}return dm=i,dm}var fm,aS;function pR(){return aS||(aS=1,fm=hR()),fm}var hm,lS;function a6(){if(lS)return hm;lS=1;var e=sd();function t(n,s){var i=[];return e(n,function(a,l,u){s(a,l,u)&&i.push(a)}),i}return hm=t,hm}var pm,cS;function l6(){if(cS)return pm;cS=1;var e="__lodash_hash_undefined__";function t(n){return this.__data__.set(n,e),this}return pm=t,pm}var mm,uS;function c6(){if(uS)return mm;uS=1;function e(t){return this.__data__.has(t)}return mm=e,mm}var gm,dS;function mR(){if(dS)return gm;dS=1;var e=Uw(),t=l6(),n=c6();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,gm=s,gm}var ym,fS;function u6(){if(fS)return ym;fS=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 ym=e,ym}var vm,hS;function gR(){if(hS)return vm;hS=1;function e(t,n){return t.has(n)}return vm=e,vm}var wm,pS;function yR(){if(pS)return wm;pS=1;var e=mR(),t=u6(),n=gR(),s=1,i=2;function a(l,u,h,p,f,g){var v=h&s,w=l.length,N=u.length;if(w!=N&&!(v&&N>w))return!1;var b=g.get(l),k=g.get(u);if(b&&k)return b==u&&k==l;var S=-1,E=!0,C=h&i?new e:void 0;for(g.set(l,u),g.set(u,l);++S<w;){var j=l[S],I=u[S];if(p)var O=v?p(I,j,S,u,l,g):p(j,I,S,l,u,g);if(O!==void 0){if(O)continue;E=!1;break}if(C){if(!t(u,function(P,z){if(!n(C,z)&&(j===P||f(j,P,h,p,g)))return C.push(z)})){E=!1;break}}else if(!(j===I||f(j,I,h,p,g))){E=!1;break}}return g.delete(l),g.delete(u),E}return wm=a,wm}var xm,mS;function d6(){if(mS)return xm;mS=1;function e(t){var n=-1,s=Array(t.size);return t.forEach(function(i,a){s[++n]=[a,i]}),s}return xm=e,xm}var bm,gS;function e0(){if(gS)return bm;gS=1;function e(t){var n=-1,s=Array(t.size);return t.forEach(function(i){s[++n]=i}),s}return bm=e,bm}var km,yS;function f6(){if(yS)return km;yS=1;var e=Zi(),t=aR(),n=Qi(),s=yR(),i=d6(),a=e0(),l=1,u=2,h="[object Boolean]",p="[object Date]",f="[object Error]",g="[object Map]",v="[object Number]",w="[object RegExp]",N="[object Set]",b="[object String]",k="[object Symbol]",S="[object ArrayBuffer]",E="[object DataView]",C=e?e.prototype:void 0,j=C?C.valueOf:void 0;function I(O,P,z,M,A,q,G){switch(z){case E:if(O.byteLength!=P.byteLength||O.byteOffset!=P.byteOffset)return!1;O=O.buffer,P=P.buffer;case S:return!(O.byteLength!=P.byteLength||!q(new t(O),new t(P)));case h:case p:case v:return n(+O,+P);case f:return O.name==P.name&&O.message==P.message;case w:case b:return O==P+"";case g:var Y=i;case N:var R=M&l;if(Y||(Y=a),O.size!=P.size&&!R)return!1;var Q=G.get(O);if(Q)return Q==P;M|=u,G.set(O,P);var H=s(Y(O),Y(P),M,A,q,G);return G.delete(O),H;case k:if(j)return j.call(O)==j.call(P)}return!1}return km=I,km}var _m,vS;function h6(){if(vS)return _m;vS=1;var e=oR(),t=1,n=Object.prototype,s=n.hasOwnProperty;function i(a,l,u,h,p,f){var g=u&t,v=e(a),w=v.length,N=e(l),b=N.length;if(w!=b&&!g)return!1;for(var k=w;k--;){var S=v[k];if(!(g?S in l:s.call(l,S)))return!1}var E=f.get(a),C=f.get(l);if(E&&C)return E==l&&C==a;var j=!0;f.set(a,l),f.set(l,a);for(var I=g;++k<w;){S=v[k];var O=a[S],P=l[S];if(h)var z=g?h(P,O,S,l,a,f):h(O,P,S,a,l,f);if(!(z===void 0?O===P||p(O,P,u,h,f):z)){j=!1;break}I||(I=S=="constructor")}if(j&&!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)&&(j=!1)}return f.delete(a),f.delete(l),j}return _m=i,_m}var Sm,wS;function p6(){if(wS)return Sm;wS=1;var e=Qu(),t=yR(),n=f6(),s=h6(),i=ea(),a=Mt(),l=Ji(),u=Ll(),h=1,p="[object Arguments]",f="[object Array]",g="[object Object]",v=Object.prototype,w=v.hasOwnProperty;function N(b,k,S,E,C,j){var I=a(b),O=a(k),P=I?f:i(b),z=O?f:i(k);P=P==p?g:P,z=z==p?g:z;var M=P==g,A=z==g,q=P==z;if(q&&l(b)){if(!l(k))return!1;I=!0,M=!1}if(q&&!M)return j||(j=new e),I||u(b)?t(b,k,S,E,C,j):n(b,k,P,S,E,C,j);if(!(S&h)){var G=M&&w.call(b,"__wrapped__"),Y=A&&w.call(k,"__wrapped__");if(G||Y){var R=G?b.value():b,Q=Y?k.value():k;return j||(j=new e),C(R,Q,S,E,j)}}return q?(j||(j=new e),s(b,k,S,E,C,j)):!1}return Sm=N,Sm}var Nm,xS;function vR(){if(xS)return Nm;xS=1;var e=p6(),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 Nm=n,Nm}var Em,bS;function m6(){if(bS)return Em;bS=1;var e=Qu(),t=vR(),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 v=u[p];if(g&&v[2]?v[1]!==a[v[0]]:!(v[0]in a))return!1}for(;++p<f;){v=u[p];var w=v[0],N=a[w],b=v[1];if(g&&v[2]){if(N===void 0&&!(w in a))return!1}else{var k=new e;if(h)var S=h(N,b,w,a,l,k);if(!(S===void 0?t(b,N,n|s,h,k):S))return!1}}return!0}return Em=i,Em}var Cm,kS;function wR(){if(kS)return Cm;kS=1;var e=qn();function t(n){return n===n&&!e(n)}return Cm=t,Cm}var jm,_S;function g6(){if(_S)return jm;_S=1;var e=wR(),t=qs();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 jm=n,jm}var Tm,SS;function xR(){if(SS)return Tm;SS=1;function e(t,n){return function(s){return s==null?!1:s[t]===n&&(n!==void 0||t in Object(s))}}return Tm=e,Tm}var Rm,NS;function y6(){if(NS)return Rm;NS=1;var e=m6(),t=g6(),n=xR();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 Rm=s,Rm}var Am,ES;function ta(){if(ES)return Am;ES=1;var e=No(),t=jr(),n="[object Symbol]";function s(i){return typeof i=="symbol"||t(i)&&e(i)==n}return Am=s,Am}var Mm,CS;function t0(){if(CS)return Mm;CS=1;var e=Mt(),t=ta(),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 Mm=i,Mm}var Im,jS;function v6(){if(jS)return Im;jS=1;var e=Uw(),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,Im=n,Im}var Om,TS;function w6(){if(TS)return Om;TS=1;var e=v6(),t=500;function n(s){var i=e(s,function(l){return a.size===t&&a.clear(),l}),a=i.cache;return i}return Om=n,Om}var Pm,RS;function x6(){if(RS)return Pm;RS=1;var e=w6(),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 Pm=s,Pm}var $m,AS;function od(){if(AS)return $m;AS=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 $m=e,$m}var Lm,MS;function b6(){if(MS)return Lm;MS=1;var e=Zi(),t=od(),n=Mt(),s=ta(),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 Lm=l,Lm}var qm,IS;function bR(){if(IS)return qm;IS=1;var e=b6();function t(n){return n==null?"":e(n)}return qm=t,qm}var Dm,OS;function id(){if(OS)return Dm;OS=1;var e=Mt(),t=t0(),n=x6(),s=bR();function i(a,l){return e(a)?a:t(a,l)?[a]:n(s(a))}return Dm=i,Dm}var Fm,PS;function ql(){if(PS)return Fm;PS=1;var e=ta();function t(n){if(typeof n=="string"||e(n))return n;var s=n+"";return s=="0"&&1/n==-1/0?"-0":s}return Fm=t,Fm}var zm,$S;function ad(){if($S)return zm;$S=1;var e=id(),t=ql();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 zm=n,zm}var Bm,LS;function k6(){if(LS)return Bm;LS=1;var e=ad();function t(n,s,i){var a=n==null?void 0:e(n,s);return a===void 0?i:a}return Bm=t,Bm}var Um,qS;function _6(){if(qS)return Um;qS=1;function e(t,n){return t!=null&&n in Object(t)}return Um=e,Um}var Wm,DS;function kR(){if(DS)return Wm;DS=1;var e=id(),t=$l(),n=Mt(),s=ed(),i=Hw(),a=ql();function l(u,h,p){h=e(h,u);for(var f=-1,g=h.length,v=!1;++f<g;){var w=a(h[f]);if(!(v=u!=null&&p(u,w)))break;u=u[w]}return v||++f!=g?v:(g=u==null?0:u.length,!!g&&i(g)&&s(w,g)&&(n(u)||t(u)))}return Wm=l,Wm}var Hm,FS;function _R(){if(FS)return Hm;FS=1;var e=_6(),t=kR();function n(s,i){return s!=null&&t(s,i,e)}return Hm=n,Hm}var Gm,zS;function S6(){if(zS)return Gm;zS=1;var e=vR(),t=k6(),n=_R(),s=t0(),i=wR(),a=xR(),l=ql(),u=1,h=2;function p(f,g){return s(f)&&i(g)?a(l(f),g):function(v){var w=t(v,f);return w===void 0&&w===g?n(v,f):e(g,w,u|h)}}return Gm=p,Gm}var Vm,BS;function SR(){if(BS)return Vm;BS=1;function e(t){return function(n){return n==null?void 0:n[t]}}return Vm=e,Vm}var Ym,US;function N6(){if(US)return Ym;US=1;var e=ad();function t(n){return function(s){return e(s,n)}}return Ym=t,Ym}var Km,WS;function E6(){if(WS)return Km;WS=1;var e=SR(),t=N6(),n=t0(),s=ql();function i(a){return n(a)?e(s(a)):t(a)}return Km=i,Km}var Xm,HS;function ts(){if(HS)return Xm;HS=1;var e=y6(),t=S6(),n=jo(),s=Mt(),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 Xm=a,Xm}var Qm,GS;function NR(){if(GS)return Qm;GS=1;var e=tR(),t=a6(),n=ts(),s=Mt();function i(a,l){var u=s(a)?e:t;return u(a,n(l,3))}return Qm=i,Qm}var Zm,VS;function C6(){if(VS)return Zm;VS=1;var e=Object.prototype,t=e.hasOwnProperty;function n(s,i){return s!=null&&t.call(s,i)}return Zm=n,Zm}var Jm,YS;function ER(){if(YS)return Jm;YS=1;var e=C6(),t=kR();function n(s,i){return s!=null&&t(s,i,e)}return Jm=n,Jm}var eg,KS;function j6(){if(KS)return eg;KS=1;var e=Vw(),t=ea(),n=$l(),s=Mt(),i=es(),a=Ji(),l=nd(),u=Ll(),h="[object Map]",p="[object Set]",f=Object.prototype,g=f.hasOwnProperty;function v(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 eg=v,eg}var tg,XS;function CR(){if(XS)return tg;XS=1;function e(t){return t===void 0}return tg=e,tg}var ng,QS;function jR(){if(QS)return ng;QS=1;var e=sd(),t=es();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 ng=n,ng}var rg,ZS;function TR(){if(ZS)return rg;ZS=1;var e=od(),t=ts(),n=jR(),s=Mt();function i(a,l){var u=s(a)?e:n;return u(a,t(l,3))}return rg=i,rg}var sg,JS;function T6(){if(JS)return sg;JS=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 sg=e,sg}var og,eN;function R6(){if(eN)return og;eN=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 og=e,og}var ig,tN;function RR(){if(tN)return ig;tN=1;var e=T6(),t=sd(),n=ts(),s=R6(),i=Mt();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 ig=a,ig}var ag,nN;function A6(){if(nN)return ag;nN=1;var e=No(),t=Mt(),n=jr(),s="[object String]";function i(a){return typeof a=="string"||!t(a)&&n(a)&&e(a)==s}return ag=i,ag}var lg,rN;function M6(){if(rN)return lg;rN=1;var e=SR(),t=e("length");return lg=t,lg}var cg,sN;function I6(){if(sN)return cg;sN=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 cg=h,cg}var ug,oN;function O6(){if(oN)return ug;oN=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}",v="[\\ud800-\\udbff][\\udc00-\\udfff]",w="\\u200d",N=p+"?",b="["+a+"]?",k="(?:"+w+"(?:"+[f,g,v].join("|")+")"+b+N+")*",S=b+N+k,E="(?:"+[f+u+"?",u,g,v,l].join("|")+")",C=RegExp(h+"(?="+h+")|"+E+S,"g");function j(I){for(var O=C.lastIndex=0;C.test(I);)++O;return O}return ug=j,ug}var dg,iN;function P6(){if(iN)return dg;iN=1;var e=M6(),t=I6(),n=O6();function s(i){return t(i)?n(i):e(i)}return dg=s,dg}var fg,aN;function $6(){if(aN)return fg;aN=1;var e=Vw(),t=ea(),n=es(),s=A6(),i=P6(),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 fg=u,fg}var hg,lN;function L6(){if(lN)return hg;lN=1;var e=Ww(),t=cR(),n=Jw(),s=ts(),i=rd(),a=Mt(),l=Ji(),u=Ol(),h=qn(),p=Ll();function f(g,v,w){var N=a(g),b=N||l(g)||p(g);if(v=s(v,4),w==null){var k=g&&g.constructor;b?w=N?new k:[]:h(g)?w=u(k)?t(i(g)):{}:w={}}return(b?e:n)(g,function(S,E,C){return v(w,S,E,C)}),w}return hg=f,hg}var pg,cN;function q6(){if(cN)return pg;cN=1;var e=Zi(),t=$l(),n=Mt(),s=e?e.isConcatSpreadable:void 0;function i(a){return n(a)||t(a)||!!(s&&a&&a[s])}return pg=i,pg}var mg,uN;function n0(){if(uN)return mg;uN=1;var e=Kw(),t=q6();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 mg=n,mg}var gg,dN;function D6(){if(dN)return gg;dN=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 gg=e,gg}var yg,fN;function AR(){if(fN)return yg;fN=1;var e=D6(),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 yg=n,yg}var vg,hN;function F6(){if(hN)return vg;hN=1;var e=Qw(),t=XT(),n=jo(),s=t?function(i,a){return t(i,"toString",{configurable:!0,enumerable:!1,value:e(a),writable:!0})}:n;return vg=s,vg}var wg,pN;function z6(){if(pN)return wg;pN=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 wg=s,wg}var xg,mN;function MR(){if(mN)return xg;mN=1;var e=F6(),t=z6(),n=t(e);return xg=n,xg}var bg,gN;function ld(){if(gN)return bg;gN=1;var e=jo(),t=AR(),n=MR();function s(i,a){return n(t(i,a,e),i+"")}return bg=s,bg}var kg,yN;function IR(){if(yN)return kg;yN=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 kg=e,kg}var _g,vN;function B6(){if(vN)return _g;vN=1;function e(t){return t!==t}return _g=e,_g}var Sg,wN;function U6(){if(wN)return Sg;wN=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 Sg=e,Sg}var Ng,xN;function W6(){if(xN)return Ng;xN=1;var e=IR(),t=B6(),n=U6();function s(i,a,l){return a===a?n(i,a,l):e(i,t,l)}return Ng=s,Ng}var Eg,bN;function H6(){if(bN)return Eg;bN=1;var e=W6();function t(n,s){var i=n==null?0:n.length;return!!i&&e(n,s,0)>-1}return Eg=t,Eg}var Cg,kN;function G6(){if(kN)return Cg;kN=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 Cg=e,Cg}var jg,_N;function V6(){if(_N)return jg;_N=1;function e(){}return jg=e,jg}var Tg,SN;function Y6(){if(SN)return Tg;SN=1;var e=iR(),t=V6(),n=e0(),s=1/0,i=e&&1/n(new e([,-0]))[1]==s?function(a){return new e(a)}:t;return Tg=i,Tg}var Rg,NN;function K6(){if(NN)return Rg;NN=1;var e=mR(),t=H6(),n=G6(),s=gR(),i=Y6(),a=e0(),l=200;function u(h,p,f){var g=-1,v=t,w=h.length,N=!0,b=[],k=b;if(f)N=!1,v=n;else if(w>=l){var S=p?null:i(h);if(S)return a(S);N=!1,v=s,k=new e}else k=p?[]:b;e:for(;++g<w;){var E=h[g],C=p?p(E):E;if(E=f||E!==0?E:0,N&&C===C){for(var j=k.length;j--;)if(k[j]===C)continue e;p&&k.push(C),b.push(E)}else v(k,C,f)||(k!==b&&k.push(C),b.push(E))}return b}return Rg=u,Rg}var Ag,EN;function OR(){if(EN)return Ag;EN=1;var e=es(),t=jr();function n(s){return t(s)&&e(s)}return Ag=n,Ag}var Mg,CN;function X6(){if(CN)return Mg;CN=1;var e=n0(),t=ld(),n=K6(),s=OR(),i=t(function(a){return n(e(a,1,s,!0))});return Mg=i,Mg}var Ig,jN;function Q6(){if(jN)return Ig;jN=1;var e=od();function t(n,s){return e(s,function(i){return n[i]})}return Ig=t,Ig}var Og,TN;function PR(){if(TN)return Og;TN=1;var e=Q6(),t=qs();function n(s){return s==null?[]:e(s,t(s))}return Og=n,Og}var Pg,RN;function Dn(){if(RN)return Pg;RN=1;var e;if(typeof zw=="function")try{e={clone:s6(),constant:Qw(),each:pR(),filter:NR(),has:ER(),isArray:Mt(),isEmpty:j6(),isFunction:Ol(),isUndefined:CR(),keys:qs(),map:TR(),reduce:RR(),size:$6(),transform:L6(),union:X6(),values:PR()}}catch{}return e||(e=window._),Pg=e,Pg}var $g,AN;function r0(){if(AN)return $g;AN=1;var e=Dn();$g=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 v=arguments,w=this;return e.each(f,function(N){v.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 v=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]),v),delete this._in[f],delete this._preds[f],e.each(e.keys(this._out[f]),v),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 v=g;!e.isUndefined(v);v=this.parent(v))if(v===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 v=this;e.each(this._nodes,function(b,k){f(k)&&g.setNode(k,b)}),e.each(this._edgeObjs,function(b){g.hasNode(b.v)&&g.hasNode(b.w)&&g.setEdge(b,v.edge(b))});var w={};function N(b){var k=v.parent(b);return k===void 0||g.hasNode(k)?(w[b]=k,k):k in w?w[k]:N(k)}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 v=this,w=arguments;return e.reduce(f,function(N,b){return w.length>1?v.setEdge(N,b,g):v.setEdge(N,b),b}),this},i.prototype.setEdge=function(){var f,g,v,w,N=!1,b=arguments[0];typeof b=="object"&&b!==null&&"v"in b?(f=b.v,g=b.w,v=b.name,arguments.length===2&&(w=arguments[1],N=!0)):(f=b,g=arguments[1],v=arguments[3],arguments.length>2&&(w=arguments[2],N=!0)),f=""+f,g=""+g,e.isUndefined(v)||(v=""+v);var k=u(this._isDirected,f,g,v);if(e.has(this._edgeLabels,k))return N&&(this._edgeLabels[k]=w),this;if(!e.isUndefined(v)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(f),this.setNode(g),this._edgeLabels[k]=N?w:this._defaultEdgeLabelFn(f,g,v);var S=h(this._isDirected,f,g,v);return f=S.v,g=S.w,Object.freeze(S),this._edgeObjs[k]=S,a(this._preds[g],f),a(this._sucs[f],g),this._in[g][k]=S,this._out[f][k]=S,this._edgeCount++,this},i.prototype.edge=function(f,g,v){var w=arguments.length===1?p(this._isDirected,arguments[0]):u(this._isDirected,f,g,v);return this._edgeLabels[w]},i.prototype.hasEdge=function(f,g,v){var w=arguments.length===1?p(this._isDirected,arguments[0]):u(this._isDirected,f,g,v);return e.has(this._edgeLabels,w)},i.prototype.removeEdge=function(f,g,v){var w=arguments.length===1?p(this._isDirected,arguments[0]):u(this._isDirected,f,g,v),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 v=this._in[f];if(v){var w=e.values(v);return g?e.filter(w,function(N){return N.v===g}):w}},i.prototype.outEdges=function(f,g){var v=this._out[f];if(v){var w=e.values(v);return g?e.filter(w,function(N){return N.w===g}):w}},i.prototype.nodeEdges=function(f,g){var v=this.inEdges(f,g);if(v)return v.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,v,w){var N=""+g,b=""+v;if(!f&&N>b){var k=N;N=b,b=k}return N+s+b+s+(e.isUndefined(w)?t:w)}function h(f,g,v,w){var N=""+g,b=""+v;if(!f&&N>b){var k=N;N=b,b=k}var S={v:N,w:b};return w&&(S.name=w),S}function p(f,g){return u(f,g.v,g.w,g.name)}return $g}var Lg,MN;function Z6(){return MN||(MN=1,Lg="2.1.8"),Lg}var qg,IN;function J6(){return IN||(IN=1,qg={Graph:r0(),version:Z6()}),qg}var Dg,ON;function ez(){if(ON)return Dg;ON=1;var e=Dn(),t=r0();Dg={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 Dg}var Fg,PN;function tz(){if(PN)return Fg;PN=1;var e=Dn();Fg=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 Fg}var zg,$N;function $R(){if($N)return zg;$N=1;var e=Dn();zg=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},zg}var Bg,LN;function LR(){if(LN)return Bg;LN=1;var e=Dn(),t=$R();Bg=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,v,w=function(N){var b=N.v!==g?N.v:N.w,k=p[b],S=u(N),E=v.distance+S;if(S<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+N+" Weight: "+S);E<k.distance&&(k.distance=E,k.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(),v=p[g],v.distance!==Number.POSITIVE_INFINITY);)h(g).forEach(w);return p}return Bg}var Ug,qN;function nz(){if(qN)return Ug;qN=1;var e=LR(),t=Dn();Ug=n;function n(s,i,a){return t.transform(s.nodes(),function(l,u){l[u]=e(s,u,i,a)},{})}return Ug}var Wg,DN;function qR(){if(DN)return Wg;DN=1;var e=Dn();Wg=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(v){e.has(a,v)?a[v].onStack&&(p.lowlink=Math.min(p.lowlink,a[v].index)):(u(v),p.lowlink=Math.min(p.lowlink,a[v].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 Wg}var Hg,FN;function rz(){if(FN)return Hg;FN=1;var e=Dn(),t=qR();Hg=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 Hg}var Gg,zN;function sz(){if(zN)return Gg;zN=1;var e=Dn();Gg=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,v=a(f);u[p][g]={distance:v,predecessor:p}})}),h.forEach(function(p){var f=u[p];h.forEach(function(g){var v=u[g];h.forEach(function(w){var N=v[p],b=f[w],k=v[w],S=N.distance+b.distance;S<k.distance&&(k.distance=S,k.predecessor=b.predecessor)})})}),u}return Gg}var Vg,BN;function DR(){if(BN)return Vg;BN=1;var e=Dn();Vg=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,Vg}var Yg,UN;function oz(){if(UN)return Yg;UN=1;var e=DR();Yg=t;function t(n){try{e(n)}catch(s){if(s instanceof e.CycleException)return!1;throw s}return!0}return Yg}var Kg,WN;function FR(){if(WN)return Kg;WN=1;var e=Dn();Kg=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 Kg}var Xg,HN;function iz(){if(HN)return Xg;HN=1;var e=FR();Xg=t;function t(n,s){return e(n,s,"post")}return Xg}var Qg,GN;function az(){if(GN)return Qg;GN=1;var e=FR();Qg=t;function t(n,s){return e(n,s,"pre")}return Qg}var Zg,VN;function lz(){if(VN)return Zg;VN=1;var e=Dn(),t=r0(),n=$R();Zg=s;function s(i,a){var l=new t,u={},h=new n,p;function f(v){var w=v.v===p?v.w:v.v,N=h.priority(w);if(N!==void 0){var b=a(v);b<N&&(u[w]=p,h.decrease(w,b))}}if(i.nodeCount()===0)return l;e.each(i.nodes(),function(v){h.add(v,Number.POSITIVE_INFINITY),l.setNode(v)}),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 Zg}var Jg,YN;function cz(){return YN||(YN=1,Jg={components:tz(),dijkstra:LR(),dijkstraAll:nz(),findCycles:rz(),floydWarshall:sz(),isAcyclic:oz(),postorder:iz(),preorder:az(),prim:lz(),tarjan:qR(),topsort:DR()}),Jg}var ey,KN;function uz(){if(KN)return ey;KN=1;var e=J6();return ey={Graph:e.Graph,json:ez(),alg:cz(),version:e.version},ey}var ty,XN;function cr(){if(XN)return ty;XN=1;var e;if(typeof zw=="function")try{e=uz()}catch{}return e||(e=window.graphlib),ty=e,ty}var ny,QN;function dz(){if(QN)return ny;QN=1;var e=dR(),t=1,n=4;function s(i){return e(i,t|n)}return ny=s,ny}var ry,ZN;function cd(){if(ZN)return ry;ZN=1;var e=Qi(),t=es(),n=ed(),s=qn();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 ry=i,ry}var sy,JN;function fz(){if(JN)return sy;JN=1;var e=ld(),t=Qi(),n=cd(),s=Co(),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 v=h[p],w=s(v),N=-1,b=w.length;++N<b;){var k=w[N],S=u[k];(S===void 0||t(S,i[k])&&!a.call(u,k))&&(u[k]=v[k])}return u});return sy=l,sy}var oy,eE;function hz(){if(eE)return oy;eE=1;var e=ts(),t=es(),n=qs();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 oy=s,oy}var iy,tE;function pz(){if(tE)return iy;tE=1;var e=/\s/;function t(n){for(var s=n.length;s--&&e.test(n.charAt(s)););return s}return iy=t,iy}var ay,nE;function mz(){if(nE)return ay;nE=1;var e=pz(),t=/^\s+/;function n(s){return s&&s.slice(0,e(s)+1).replace(t,"")}return ay=n,ay}var ly,rE;function gz(){if(rE)return ly;rE=1;var e=mz(),t=qn(),n=ta(),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 ly=h,ly}var cy,sE;function zR(){if(sE)return cy;sE=1;var e=gz(),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 cy=s,cy}var uy,oE;function yz(){if(oE)return uy;oE=1;var e=zR();function t(n){var s=e(n),i=s%1;return s===s?i?s-i:s:0}return uy=t,uy}var dy,iE;function vz(){if(iE)return dy;iE=1;var e=IR(),t=ts(),n=yz(),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 dy=i,dy}var fy,aE;function wz(){if(aE)return fy;aE=1;var e=hz(),t=vz(),n=e(t);return fy=n,fy}var hy,lE;function BR(){if(lE)return hy;lE=1;var e=n0();function t(n){var s=n==null?0:n.length;return s?e(n,1):[]}return hy=t,hy}var py,cE;function xz(){if(cE)return py;cE=1;var e=Zw(),t=fR(),n=Co();function s(i,a){return i==null?i:e(i,t(a),n)}return py=s,py}var my,uE;function bz(){if(uE)return my;uE=1;function e(t){var n=t==null?0:t.length;return n?t[n-1]:void 0}return my=e,my}var gy,dE;function kz(){if(dE)return gy;dE=1;var e=Zu(),t=Jw(),n=ts();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 gy=s,gy}var yy,fE;function s0(){if(fE)return yy;fE=1;var e=ta();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 yy=t,yy}var vy,hE;function _z(){if(hE)return vy;hE=1;function e(t,n){return t>n}return vy=e,vy}var wy,pE;function Sz(){if(pE)return wy;pE=1;var e=s0(),t=_z(),n=jo();function s(i){return i&&i.length?e(i,n,t):void 0}return wy=s,wy}var xy,mE;function UR(){if(mE)return xy;mE=1;var e=Zu(),t=Qi();function n(s,i,a){(a!==void 0&&!t(s[i],a)||a===void 0&&!(i in s))&&e(s,i,a)}return xy=n,xy}var by,gE;function Nz(){if(gE)return by;gE=1;var e=No(),t=rd(),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 v=u.call(g,"constructor")&&g.constructor;return typeof v=="function"&&v instanceof v&&l.call(v)==h}return by=p,by}var ky,yE;function WR(){if(yE)return ky;yE=1;function e(t,n){if(!(n==="constructor"&&typeof t[n]=="function")&&n!="__proto__")return t[n]}return ky=e,ky}var _y,vE;function Ez(){if(vE)return _y;vE=1;var e=Pl(),t=Co();function n(s){return e(s,t(s))}return _y=n,_y}var Sy,wE;function Cz(){if(wE)return Sy;wE=1;var e=UR(),t=JT(),n=lR(),s=eR(),i=uR(),a=$l(),l=Mt(),u=OR(),h=Ji(),p=Ol(),f=qn(),g=Nz(),v=Ll(),w=WR(),N=Ez();function b(k,S,E,C,j,I,O){var P=w(k,E),z=w(S,E),M=O.get(z);if(M){e(k,E,M);return}var A=I?I(P,z,E+"",k,S,O):void 0,q=A===void 0;if(q){var G=l(z),Y=!G&&h(z),R=!G&&!Y&&v(z);A=z,G||Y||R?l(P)?A=P:u(P)?A=s(P):Y?(q=!1,A=t(z,!0)):R?(q=!1,A=n(z,!0)):A=[]:g(z)||a(z)?(A=P,a(P)?A=N(P):(!f(P)||p(P))&&(A=i(z))):q=!1}q&&(O.set(z,A),j(A,z,C,I,O),O.delete(z)),e(k,E,A)}return Sy=b,Sy}var Ny,xE;function jz(){if(xE)return Ny;xE=1;var e=Qu(),t=UR(),n=Zw(),s=Cz(),i=qn(),a=Co(),l=WR();function u(h,p,f,g,v){h!==p&&n(p,function(w,N){if(v||(v=new e),i(w))s(h,p,N,f,u,g,v);else{var b=g?g(l(h,N),w,N+"",h,p,v):void 0;b===void 0&&(b=w),t(h,N,b)}},a)}return Ny=u,Ny}var Ey,bE;function Tz(){if(bE)return Ey;bE=1;var e=ld(),t=cd();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 Ey=n,Ey}var Cy,kE;function Rz(){if(kE)return Cy;kE=1;var e=jz(),t=Tz(),n=t(function(s,i,a){e(s,i,a)});return Cy=n,Cy}var jy,_E;function HR(){if(_E)return jy;_E=1;function e(t,n){return t<n}return jy=e,jy}var Ty,SE;function Az(){if(SE)return Ty;SE=1;var e=s0(),t=HR(),n=jo();function s(i){return i&&i.length?e(i,n,t):void 0}return Ty=s,Ty}var Ry,NE;function Mz(){if(NE)return Ry;NE=1;var e=s0(),t=ts(),n=HR();function s(i,a){return i&&i.length?e(i,t(a,2),n):void 0}return Ry=s,Ry}var Ay,EE;function Iz(){if(EE)return Ay;EE=1;var e=dr(),t=function(){return e.Date.now()};return Ay=t,Ay}var My,CE;function Oz(){if(CE)return My;CE=1;var e=Ju(),t=id(),n=ed(),s=qn(),i=ql();function a(l,u,h,p){if(!s(l))return l;u=t(u,l);for(var f=-1,g=u.length,v=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!=v){var k=w[N];b=p?p(k,N,w):void 0,b===void 0&&(b=s(k)?k:n(u[f+1])?[]:{})}e(w,N,b),w=w[N]}return l}return My=a,My}var Iy,jE;function Pz(){if(jE)return Iy;jE=1;var e=ad(),t=Oz(),n=id();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 Iy=s,Iy}var Oy,TE;function $z(){if(TE)return Oy;TE=1;var e=Pz(),t=_R();function n(s,i){return e(s,i,function(a,l){return t(s,l)})}return Oy=n,Oy}var Py,RE;function Lz(){if(RE)return Py;RE=1;var e=BR(),t=AR(),n=MR();function s(i){return n(t(i,void 0,e),i+"")}return Py=s,Py}var $y,AE;function qz(){if(AE)return $y;AE=1;var e=$z(),t=Lz(),n=t(function(s,i){return s==null?{}:e(s,i)});return $y=n,$y}var Ly,ME;function Dz(){if(ME)return Ly;ME=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 Ly=n,Ly}var qy,IE;function Fz(){if(IE)return qy;IE=1;var e=Dz(),t=cd(),n=zR();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 qy=s,qy}var Dy,OE;function zz(){if(OE)return Dy;OE=1;var e=Fz(),t=e();return Dy=t,Dy}var Fy,PE;function Bz(){if(PE)return Fy;PE=1;function e(t,n){var s=t.length;for(t.sort(n);s--;)t[s]=t[s].value;return t}return Fy=e,Fy}var zy,$E;function Uz(){if($E)return zy;$E=1;var e=ta();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 zy=t,zy}var By,LE;function Wz(){if(LE)return By;LE=1;var e=Uz();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 By=t,By}var Uy,qE;function Hz(){if(qE)return Uy;qE=1;var e=od(),t=ad(),n=ts(),s=jR(),i=Bz(),a=td(),l=Wz(),u=jo(),h=Mt();function p(f,g,v){g.length?g=e(g,function(b){return h(b)?function(k){return t(k,b.length===1?b[0]:b)}:b}):g=[u];var w=-1;g=e(g,a(n));var N=s(f,function(b,k,S){var E=e(g,function(C){return C(b)});return{criteria:E,index:++w,value:b}});return i(N,function(b,k){return l(b,k,v)})}return Uy=p,Uy}var Wy,DE;function Gz(){if(DE)return Wy;DE=1;var e=n0(),t=Hz(),n=ld(),s=cd(),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 Wy=i,Wy}var Hy,FE;function Vz(){if(FE)return Hy;FE=1;var e=bR(),t=0;function n(s){var i=++t;return e(s)+i}return Hy=n,Hy}var Gy,zE;function Yz(){if(zE)return Gy;zE=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 Gy=e,Gy}var Vy,BE;function Kz(){if(BE)return Vy;BE=1;var e=Ju(),t=Yz();function n(s,i){return t(s||[],i||[],e)}return Vy=n,Vy}var Yy,UE;function vt(){if(UE)return Yy;UE=1;var e;if(typeof zw=="function")try{e={cloneDeep:dz(),constant:Qw(),defaults:fz(),each:pR(),filter:NR(),find:wz(),flatten:BR(),forEach:hR(),forIn:xz(),has:ER(),isUndefined:CR(),last:bz(),map:TR(),mapValues:kz(),max:Sz(),merge:Rz(),min:Az(),minBy:Mz(),now:Iz(),pick:qz(),range:zz(),reduce:RR(),sortBy:Gz(),uniqueId:Vz(),values:PR(),zipObject:Kz()}}catch{}return e||(e=window._),Yy=e,Yy}var Ky,WE;function Xz(){if(WE)return Ky;WE=1,Ky=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 Ky}var Xy,HE;function Qz(){if(HE)return Xy;HE=1;var e=vt(),t=cr().Graph,n=Xz();Xy=i;var s=e.constant(1);function i(p,f){if(p.nodeCount()<=1)return[];var g=u(p,f||s),v=a(g.graph,g.buckets,g.zeroIdx);return e.flatten(e.map(v,function(w){return p.outEdges(w.v,w.w)}),!0)}function a(p,f,g){for(var v=[],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 k=f.length-2;k>0;--k)if(b=f[k].dequeue(),b){v=v.concat(l(p,f,g,b,!0));break}}}return v}function l(p,f,g,v,w){var N=w?[]:void 0;return e.forEach(p.inEdges(v.v),function(b){var k=p.edge(b),S=p.node(b.v);w&&N.push({v:b.v,w:b.w}),S.out-=k,h(f,g,S)}),e.forEach(p.outEdges(v.v),function(b){var k=p.edge(b),S=b.w,E=p.node(S);E.in-=k,h(f,g,E)}),p.removeNode(v.v),N}function u(p,f){var g=new t,v=0,w=0;e.forEach(p.nodes(),function(k){g.setNode(k,{v:k,in:0,out:0})}),e.forEach(p.edges(),function(k){var S=g.edge(k.v,k.w)||0,E=f(k),C=S+E;g.setEdge(k.v,k.w,C),w=Math.max(w,g.node(k.v).out+=E),v=Math.max(v,g.node(k.w).in+=E)});var N=e.range(w+v+3).map(function(){return new n}),b=v+1;return e.forEach(g.nodes(),function(k){h(N,b,g.node(k))}),{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 Xy}var Qy,GE;function Zz(){if(GE)return Qy;GE=1;var e=vt(),t=Qz();Qy={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 Qy}var Zy,VE;function fn(){if(VE)return Zy;VE=1;var e=vt(),t=cr().Graph;Zy={addDummyNode:n,simplify:s,asNonCompoundGraph:i,successorWeights:a,predecessorWeights:l,intersectRect:u,buildLayerMatrix:h,normalizeRanks:p,removeEmptyRanks:f,addBorderNode:g,maxRank:v,partition:w,time:N,notime:b};function n(k,S,E,C){var j;do j=e.uniqueId(C);while(k.hasNode(j));return E.dummy=S,k.setNode(j,E),j}function s(k){var S=new t().setGraph(k.graph());return e.forEach(k.nodes(),function(E){S.setNode(E,k.node(E))}),e.forEach(k.edges(),function(E){var C=S.edge(E.v,E.w)||{weight:0,minlen:1},j=k.edge(E);S.setEdge(E.v,E.w,{weight:C.weight+j.weight,minlen:Math.max(C.minlen,j.minlen)})}),S}function i(k){var S=new t({multigraph:k.isMultigraph()}).setGraph(k.graph());return e.forEach(k.nodes(),function(E){k.children(E).length||S.setNode(E,k.node(E))}),e.forEach(k.edges(),function(E){S.setEdge(E,k.edge(E))}),S}function a(k){var S=e.map(k.nodes(),function(E){var C={};return e.forEach(k.outEdges(E),function(j){C[j.w]=(C[j.w]||0)+k.edge(j).weight}),C});return e.zipObject(k.nodes(),S)}function l(k){var S=e.map(k.nodes(),function(E){var C={};return e.forEach(k.inEdges(E),function(j){C[j.v]=(C[j.v]||0)+k.edge(j).weight}),C});return e.zipObject(k.nodes(),S)}function u(k,S){var E=k.x,C=k.y,j=S.x-E,I=S.y-C,O=k.width/2,P=k.height/2;if(!j&&!I)throw new Error("Not possible to find intersection inside of the rectangle");var z,M;return Math.abs(I)*O>Math.abs(j)*P?(I<0&&(P=-P),z=P*j/I,M=P):(j<0&&(O=-O),z=O,M=O*I/j),{x:E+z,y:C+M}}function h(k){var S=e.map(e.range(v(k)+1),function(){return[]});return e.forEach(k.nodes(),function(E){var C=k.node(E),j=C.rank;e.isUndefined(j)||(S[j][C.order]=E)}),S}function p(k){var S=e.min(e.map(k.nodes(),function(E){return k.node(E).rank}));e.forEach(k.nodes(),function(E){var C=k.node(E);e.has(C,"rank")&&(C.rank-=S)})}function f(k){var S=e.min(e.map(k.nodes(),function(I){return k.node(I).rank})),E=[];e.forEach(k.nodes(),function(I){var O=k.node(I).rank-S;E[O]||(E[O]=[]),E[O].push(I)});var C=0,j=k.graph().nodeRankFactor;e.forEach(E,function(I,O){e.isUndefined(I)&&O%j!==0?--C:C&&e.forEach(I,function(P){k.node(P).rank+=C})})}function g(k,S,E,C){var j={width:0,height:0};return arguments.length>=4&&(j.rank=E,j.order=C),n(k,"border",j,S)}function v(k){return e.max(e.map(k.nodes(),function(S){var E=k.node(S).rank;if(!e.isUndefined(E))return E}))}function w(k,S){var E={lhs:[],rhs:[]};return e.forEach(k,function(C){S(C)?E.lhs.push(C):E.rhs.push(C)}),E}function N(k,S){var E=e.now();try{return S()}finally{console.log(k+" time: "+(e.now()-E)+"ms")}}function b(k,S){return S()}return Zy}var Jy,YE;function Jz(){if(YE)return Jy;YE=1;var e=vt(),t=fn();Jy={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,v=a.edge(l),w=v.labelRank;if(f!==h+1){a.removeEdge(l);var N,b,k;for(k=0,++h;h<f;++k,++h)v.points=[],b={width:0,height:0,edgeLabel:v,edgeObj:l,rank:h},N=t.addDummyNode(a,"edge",b,"_d"),h===w&&(b.width=v.width,b.height=v.height,b.dummy="edge-label",b.labelpos=v.labelpos),a.setEdge(u,N,{weight:v.weight},g),k===0&&a.graph().dummyChains.push(N),u=N;a.setEdge(u,p,{weight:v.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 Jy}var ev,KE;function Iu(){if(KE)return ev;KE=1;var e=vt();ev={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 ev}var tv,XE;function GR(){if(XE)return tv;XE=1;var e=vt(),t=cr().Graph,n=Iu().slack;tv=s;function s(u){var h=new t({directed:!1}),p=u.nodes()[0],f=u.nodeCount();h.setNode(p,{});for(var g,v;i(h,u)<f;)g=a(h,u),v=h.hasNode(g.v)?n(u,g):-n(u,g),l(h,u,v);return h}function i(u,h){function p(f){e.forEach(h.nodeEdges(f),function(g){var v=g.v,w=f===v?g.w:v;!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 tv}var nv,QE;function eB(){if(QE)return nv;QE=1;var e=vt(),t=GR(),n=Iu().slack,s=Iu().longestPath,i=cr().alg.preorder,a=cr().alg.postorder,l=fn().simplify;nv=u,u.initLowLimValues=g,u.initCutValues=h,u.calcCutValue=f,u.leaveEdge=w,u.enterEdge=N,u.exchangeEdges=b;function u(C){C=l(C),s(C);var j=t(C);g(j),h(j,C);for(var I,O;I=w(j);)O=N(j,C,I),b(j,C,I,O)}function h(C,j){var I=a(C,C.nodes());I=I.slice(0,I.length-1),e.forEach(I,function(O){p(C,j,O)})}function p(C,j,I){var O=C.node(I),P=O.parent;C.edge(I,P).cutvalue=f(C,j,I)}function f(C,j,I){var O=C.node(I),P=O.parent,z=!0,M=j.edge(I,P),A=0;return M||(z=!1,M=j.edge(P,I)),A=M.weight,e.forEach(j.nodeEdges(I),function(q){var G=q.v===I,Y=G?q.w:q.v;if(Y!==P){var R=G===z,Q=j.edge(q).weight;if(A+=R?Q:-Q,S(C,I,Y)){var H=C.edge(I,Y).cutvalue;A+=R?-H:H}}}),A}function g(C,j){arguments.length<2&&(j=C.nodes()[0]),v(C,{},1,j)}function v(C,j,I,O,P){var z=I,M=C.node(O);return j[O]=!0,e.forEach(C.neighbors(O),function(A){e.has(j,A)||(I=v(C,j,I,A,O))}),M.low=z,M.lim=I++,P?M.parent=P:delete M.parent,I}function w(C){return e.find(C.edges(),function(j){return C.edge(j).cutvalue<0})}function N(C,j,I){var O=I.v,P=I.w;j.hasEdge(O,P)||(O=I.w,P=I.v);var z=C.node(O),M=C.node(P),A=z,q=!1;z.lim>M.lim&&(A=M,q=!0);var G=e.filter(j.edges(),function(Y){return q===E(C,C.node(Y.v),A)&&q!==E(C,C.node(Y.w),A)});return e.minBy(G,function(Y){return n(j,Y)})}function b(C,j,I,O){var P=I.v,z=I.w;C.removeEdge(P,z),C.setEdge(O.v,O.w,{}),g(C),h(C,j),k(C,j)}function k(C,j){var I=e.find(C.nodes(),function(P){return!j.node(P).parent}),O=i(C,I);O=O.slice(1),e.forEach(O,function(P){var z=C.node(P).parent,M=j.edge(P,z),A=!1;M||(M=j.edge(z,P),A=!0),j.node(P).rank=j.node(z).rank+(A?M.minlen:-M.minlen)})}function S(C,j,I){return C.hasEdge(j,I)}function E(C,j,I){return I.low<=j.lim&&j.lim<=I.lim}return nv}var rv,ZE;function tB(){if(ZE)return rv;ZE=1;var e=Iu(),t=e.longestPath,n=GR(),s=eB();rv=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 rv}var sv,JE;function nB(){if(JE)return sv;JE=1;var e=vt();sv=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,v=0,w=f[v],N=!0;l!==h.w;){if(u=i.node(l),N){for(;(w=f[v])!==g&&i.node(w).maxRank<u.rank;)v++;w===g&&(N=!1)}if(!N){for(;v<f.length-1&&i.node(w=f[v+1]).minRank<=u.rank;)v++;w=f[v]}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),v,w;v=l;do v=i.parent(v),h.push(v);while(v&&(a[v].low>f||g>a[v].lim));for(w=v,v=u;(v=i.parent(v))!==w;)p.push(v);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 sv}var ov,eC;function rB(){if(eC)return ov;eC=1;var e=vt(),t=fn();ov={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 v=a(u)+1;e.forEach(u.children(),function(w){s(u,h,g,v,f,p,w)}),u.graph().nodeRankFactor=g}function s(u,h,p,f,g,v,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"),k=t.addBorderNode(u,"_bb"),S=u.node(w);u.setParent(b,w),S.borderTop=b,u.setParent(k,w),S.borderBottom=k,e.forEach(N,function(E){s(u,h,p,f,g,v,E);var C=u.node(E),j=C.borderTop?C.borderTop:E,I=C.borderBottom?C.borderBottom:E,O=C.borderTop?f:2*f,P=j!==I?1:g-v[w]+1;u.setEdge(b,j,{weight:O,minlen:P,nestingEdge:!0}),u.setEdge(I,k,{weight:O,minlen:P,nestingEdge:!0})}),u.parent(w)||u.setEdge(h,b,{weight:0,minlen:g+v[w]})}function i(u){var h={};function p(f,g){var v=u.children(f);v&&v.length&&e.forEach(v,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 ov}var iv,tC;function sB(){if(tC)return iv;tC=1;var e=vt(),t=fn();iv=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],v=t.addDummyNode(i,"border",f,l);h[a][p]=v,i.setParent(v,u),g&&i.setEdge(g,v,{weight:1})}return iv}var av,nC;function oB(){if(nC)return av;nC=1;var e=vt();av={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 av}var lv,rC;function iB(){if(rC)return lv;rC=1;var e=vt();lv=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 lv}var cv,sC;function aB(){if(sC)return cv;sC=1;var e=vt();cv=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(v,w){return w})),u=e.flatten(e.map(i,function(v){return e.sortBy(e.map(s.outEdges(v),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(v){var w=v.pos+h;f[w]+=v.weight;for(var N=0;w>0;)w%2&&(N+=f[w+1]),w=w-1>>1,f[w]+=v.weight;g+=v.weight*N})),g}return cv}var uv,oC;function lB(){if(oC)return uv;oC=1;var e=vt();uv=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 uv}var dv,iC;function cB(){if(iC)return dv;iC=1;var e=vt();dv=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 dv}var fv,aC;function uB(){if(aC)return fv;aC=1;var e=vt(),t=fn();fv=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,v=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,v+=b.weight,w=s(f,p,w)});var N={vs:e.flatten(f,!0)};return v&&(N.barycenter=g/v,N.weight=v),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 fv}var hv,lC;function dB(){if(lC)return hv;lC=1;var e=vt(),t=lB(),n=cB(),s=uB();hv=i;function i(u,h,p,f){var g=u.children(h),v=u.node(h),w=v?v.borderLeft:void 0,N=v?v.borderRight:void 0,b={};w&&(g=e.filter(g,function(I){return I!==w&&I!==N}));var k=t(u,g);e.forEach(k,function(I){if(u.children(I.v).length){var O=i(u,I.v,p,f);b[I.v]=O,e.has(O,"barycenter")&&l(I,O)}});var S=n(k,p);a(S,b);var E=s(S,f);if(w&&(E.vs=e.flatten([w,E.vs,N],!0),u.predecessors(w).length)){var C=u.node(u.predecessors(w)[0]),j=u.node(u.predecessors(N)[0]);e.has(E,"barycenter")||(E.barycenter=0,E.weight=0),E.barycenter=(E.barycenter*E.weight+C.order+j.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 hv}var pv,cC;function fB(){if(cC)return pv;cC=1;var e=vt(),t=cr().Graph;pv=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(v){var w=v.v===p?v.w:v.v,N=h.edge(w,p),b=e.isUndefined(N)?0:N.weight;h.setEdge(w,p,{weight:i.edge(v).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 pv}var mv,uC;function hB(){if(uC)return mv;uC=1;var e=vt();mv=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 mv}var gv,dC;function pB(){if(dC)return gv;dC=1;var e=vt(),t=iB(),n=aB(),s=dB(),i=fB(),a=hB(),l=cr().Graph,u=fn();gv=h;function h(v){var w=u.maxRank(v),N=p(v,e.range(1,w+1),"inEdges"),b=p(v,e.range(w-1,-1,-1),"outEdges"),k=t(v);g(v,k);for(var S=Number.POSITIVE_INFINITY,E,C=0,j=0;j<4;++C,++j){f(C%2?N:b,C%4>=2),k=u.buildLayerMatrix(v);var I=n(v,k);I<S&&(j=0,E=e.cloneDeep(k),S=I)}g(v,E)}function p(v,w,N){return e.map(w,function(b){return i(v,b,N)})}function f(v,w){var N=new l;e.forEach(v,function(b){var k=b.graph().root,S=s(b,k,N,w);e.forEach(S.vs,function(E,C){b.node(E).order=C}),a(b,N,S.vs)})}function g(v,w){e.forEach(w,function(N){e.forEach(N,function(b,k){v.node(b).order=k})})}return gv}var yv,fC;function mB(){if(fC)return yv;fC=1;var e=vt(),t=cr().Graph,n=fn();yv={positionX:N,findType1Conflicts:s,findType2Conflicts:i,addConflict:l,hasConflict:u,verticalAlignment:h,horizontalCompaction:p,alignCoordinates:v,findSmallestWidthAlignment:g,balance:w};function s(S,E){var C={};function j(I,O){var P=0,z=0,M=I.length,A=e.last(O);return e.forEach(O,function(q,G){var Y=a(S,q),R=Y?S.node(Y).order:M;(Y||q===A)&&(e.forEach(O.slice(z,G+1),function(Q){e.forEach(S.predecessors(Q),function(H){var ne=S.node(H),X=ne.order;(X<P||R<X)&&!(ne.dummy&&S.node(Q).dummy)&&l(C,H,Q)})}),z=G+1,P=R)}),O}return e.reduce(E,j),C}function i(S,E){var C={};function j(O,P,z,M,A){var q;e.forEach(e.range(P,z),function(G){q=O[G],S.node(q).dummy&&e.forEach(S.predecessors(q),function(Y){var R=S.node(Y);R.dummy&&(R.order<M||R.order>A)&&l(C,Y,q)})})}function I(O,P){var z=-1,M,A=0;return e.forEach(P,function(q,G){if(S.node(q).dummy==="border"){var Y=S.predecessors(q);Y.length&&(M=S.node(Y[0]).order,j(P,A,G,z,M),A=G,z=M)}j(P,A,P.length,M,O.length)}),P}return e.reduce(E,I),C}function a(S,E){if(S.node(E).dummy)return e.find(S.predecessors(E),function(C){return S.node(C).dummy})}function l(S,E,C){if(E>C){var j=E;E=C,C=j}var I=S[E];I||(S[E]=I={}),I[C]=!0}function u(S,E,C){if(E>C){var j=E;E=C,C=j}return e.has(S[E],C)}function h(S,E,C,j){var I={},O={},P={};return e.forEach(E,function(z){e.forEach(z,function(M,A){I[M]=M,O[M]=M,P[M]=A})}),e.forEach(E,function(z){var M=-1;e.forEach(z,function(A){var q=j(A);if(q.length){q=e.sortBy(q,function(H){return P[H]});for(var G=(q.length-1)/2,Y=Math.floor(G),R=Math.ceil(G);Y<=R;++Y){var Q=q[Y];O[A]===A&&M<P[Q]&&!u(C,A,Q)&&(O[Q]=A,O[A]=I[A]=I[Q],M=P[Q])}}})}),{root:I,align:O}}function p(S,E,C,j,I){var O={},P=f(S,E,C,I),z=I?"borderLeft":"borderRight";function M(G,Y){for(var R=P.nodes(),Q=R.pop(),H={};Q;)H[Q]?G(Q):(H[Q]=!0,R.push(Q),R=R.concat(Y(Q))),Q=R.pop()}function A(G){O[G]=P.inEdges(G).reduce(function(Y,R){return Math.max(Y,O[R.v]+P.edge(R))},0)}function q(G){var Y=P.outEdges(G).reduce(function(Q,H){return Math.min(Q,O[H.w]-P.edge(H))},Number.POSITIVE_INFINITY),R=S.node(G);Y!==Number.POSITIVE_INFINITY&&R.borderType!==z&&(O[G]=Math.max(O[G],Y))}return M(A,P.predecessors.bind(P)),M(q,P.successors.bind(P)),e.forEach(j,function(G){O[G]=O[C[G]]}),O}function f(S,E,C,j){var I=new t,O=S.graph(),P=b(O.nodesep,O.edgesep,j);return e.forEach(E,function(z){var M;e.forEach(z,function(A){var q=C[A];if(I.setNode(q),M){var G=C[M],Y=I.edge(G,q);I.setEdge(G,q,Math.max(P(S,A,M),Y||0))}M=A})}),I}function g(S,E){return e.minBy(e.values(E),function(C){var j=Number.NEGATIVE_INFINITY,I=Number.POSITIVE_INFINITY;return e.forIn(C,function(O,P){var z=k(S,P)/2;j=Math.max(O+z,j),I=Math.min(O-z,I)}),j-I})}function v(S,E){var C=e.values(E),j=e.min(C),I=e.max(C);e.forEach(["u","d"],function(O){e.forEach(["l","r"],function(P){var z=O+P,M=S[z],A;if(M!==E){var q=e.values(M);A=P==="l"?j-e.min(q):I-e.max(q),A&&(S[z]=e.mapValues(M,function(G){return G+A}))}})})}function w(S,E){return e.mapValues(S.ul,function(C,j){if(E)return S[E.toLowerCase()][j];var I=e.sortBy(e.map(S,j));return(I[1]+I[2])/2})}function N(S){var E=n.buildLayerMatrix(S),C=e.merge(s(S,E),i(S,E)),j={},I;e.forEach(["u","d"],function(P){I=P==="u"?E:e.values(E).reverse(),e.forEach(["l","r"],function(z){z==="r"&&(I=e.map(I,function(G){return e.values(G).reverse()}));var M=(P==="u"?S.predecessors:S.successors).bind(S),A=h(S,I,C,M),q=p(S,I,A.root,A.align,z==="r");z==="r"&&(q=e.mapValues(q,function(G){return-G})),j[P+z]=q})});var O=g(S,j);return v(j,O),w(j,S.graph().align)}function b(S,E,C){return function(j,I,O){var P=j.node(I),z=j.node(O),M=0,A;if(M+=P.width/2,e.has(P,"labelpos"))switch(P.labelpos.toLowerCase()){case"l":A=-P.width/2;break;case"r":A=P.width/2;break}if(A&&(M+=C?A:-A),A=0,M+=(P.dummy?E:S)/2,M+=(z.dummy?E:S)/2,M+=z.width/2,e.has(z,"labelpos"))switch(z.labelpos.toLowerCase()){case"l":A=z.width/2;break;case"r":A=-z.width/2;break}return A&&(M+=C?A:-A),A=0,M}}function k(S,E){return S.node(E).width}return yv}var vv,hC;function gB(){if(hC)return vv;hC=1;var e=vt(),t=fn(),n=mB().positionX;vv=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 vv}var wv,pC;function yB(){if(pC)return wv;pC=1;var e=vt(),t=Zz(),n=Jz(),s=tB(),i=fn().normalizeRanks,a=nB(),l=fn().removeEmptyRanks,u=rB(),h=sB(),p=oB(),f=pB(),g=gB(),v=fn(),w=cr().Graph;wv=N;function N(D,L){var K=L&&L.debugTiming?v.time:v.notime;K("layout",function(){var se=K(" buildLayoutGraph",function(){return M(D)});K(" runLayout",function(){b(se,K)}),K(" updateInputGraph",function(){k(D,se)})})}function b(D,L){L(" makeSpaceForEdgeLabels",function(){A(D)}),L(" removeSelfEdges",function(){U(D)}),L(" acyclic",function(){t.run(D)}),L(" nestingGraph.run",function(){u.run(D)}),L(" rank",function(){s(v.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(){G(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(){H(D)}),L(" undoCoordinateSystem",function(){p.undo(D)}),L(" translateGraph",function(){R(D)}),L(" assignNodeIntersects",function(){Q(D)}),L(" reversePoints",function(){ne(D)}),L(" acyclic.undo",function(){t.undo(D)})}function k(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 S=["nodesep","edgesep","ranksep","marginx","marginy"],E={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},C=["acyclicer","ranker","rankdir","align"],j=["width","height"],I={width:0,height:0},O=["minlen","weight","width","height","labeloffset"],P={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},z=["labelpos"];function M(D){var L=new w({multigraph:!0,compound:!0}),K=Z(D.graph());return L.setGraph(e.merge({},E,V(K,S),e.pick(K,C))),e.forEach(D.nodes(),function(se){var he=Z(D.node(se));L.setNode(se,e.defaults(V(he,j),I)),L.setParent(se,D.parent(se))}),e.forEach(D.edges(),function(se){var he=Z(D.edge(se));L.setEdge(se,e.merge({},P,V(he,O),e.pick(he,z)))}),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),me={rank:(he.rank-se.rank)/2+se.rank,e:L};v.addDummyNode(D,"edge-proxy",me,"_ep")}})}function G(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 R(D){var L=Number.POSITIVE_INFINITY,K=0,se=Number.POSITIVE_INFINITY,he=0,me=D.graph(),xe=me.marginx||0,Ee=me.marginy||0;function He(Fe){var Ie=Fe.x,be=Fe.y,ue=Fe.width,re=Fe.height;L=Math.min(L,Ie-ue/2),K=Math.max(K,Ie+ue/2),se=Math.min(se,be-re/2),he=Math.max(he,be+re/2)}e.forEach(D.nodes(),function(Fe){He(D.node(Fe))}),e.forEach(D.edges(),function(Fe){var Ie=D.edge(Fe);e.has(Ie,"x")&&He(Ie)}),L-=xe,se-=Ee,e.forEach(D.nodes(),function(Fe){var Ie=D.node(Fe);Ie.x-=L,Ie.y-=se}),e.forEach(D.edges(),function(Fe){var Ie=D.edge(Fe);e.forEach(Ie.points,function(be){be.x-=L,be.y-=se}),e.has(Ie,"x")&&(Ie.x-=L),e.has(Ie,"y")&&(Ie.y-=se)}),me.width=K-L+xe,me.height=he-se+Ee}function Q(D){e.forEach(D.edges(),function(L){var K=D.edge(L),se=D.node(L.v),he=D.node(L.w),me,xe;K.points?(me=K.points[0],xe=K.points[K.points.length-1]):(K.points=[],me=he,xe=se),K.points.unshift(v.intersectRect(se,me)),K.points.push(v.intersectRect(he,xe))})}function H(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),me=D.node(e.last(K.borderLeft)),xe=D.node(e.last(K.borderRight));K.width=Math.abs(xe.x-me.x),K.height=Math.abs(he.y-se.y),K.x=me.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 U(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=v.buildLayerMatrix(D);e.forEach(L,function(K){var se=0;e.forEach(K,function(he,me){var xe=D.node(he);xe.order=me+se,e.forEach(xe.selfEdges,function(Ee){v.addDummyNode(D,"selfedge",{width:Ee.label.width,height:Ee.label.height,rank:xe.rank,order:me+ ++se,e:Ee.e,label:Ee.label},"_se")}),delete xe.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,me=se.y,xe=K.x-he,Ee=se.height/2;D.setEdge(K.e,K.label),D.removeNode(L),K.label.points=[{x:he+2*xe/3,y:me-Ee},{x:he+5*xe/6,y:me-Ee},{x:he+xe,y:me},{x:he+5*xe/6,y:me+Ee},{x:he+2*xe/3,y:me+Ee}],K.label.x=K.x,K.label.y=K.y}})}function V(D,L){return e.mapValues(e.pick(D,L),Number)}function Z(D){var L={};return e.forEach(D,function(K,se){L[se.toLowerCase()]=K}),L}return wv}var xv,mC;function vB(){if(mC)return xv;mC=1;var e=vt(),t=fn(),n=cr().Graph;xv={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 xv}var bv,gC;function wB(){return gC||(gC=1,bv="0.8.5"),bv}var kv,yC;function xB(){return yC||(yC=1,kv={graphlib:cr(),layout:yB(),debug:vB(),util:{time:fn().time,notime:fn().notime},version:wB()}),kv}var bB=xB();const vC=lw(bB),Ki=240,Ou=130,Fi=74,ud=72,wC=Fi+ud;function kB(e,t){var s;let n=Ki;for(const i of e)n=Math.max(n,((s=t.get(i.id))==null?void 0:s.width)??Ki);return n}const VR=420,_B=2;function bl(e){var n;return((n=e.data)==null?void 0:n.sessionId)??"_default"}function SB(e,t){return((t==null?void 0:t.get(e))??0)>0?VR:0}function NB(e,t){const n=(t==null?void 0:t.get(e))??0;return n>0?6+n*36:0}function kl(e,t,n){const s=t.get(e);return{w:((s==null?void 0:s.width)??Ki)+SB(e,n),h:Math.max((s==null?void 0:s.height)??Ou,NB(e,n))}}function EB(e){return[...e.keys()].sort().map(t=>`${t}:${e.get(t)}`).join("|")}function CB(e,t,n,s,i,a){const l=new vC.graphlib.Graph;l.setDefaultEdgeLabel(()=>({})),l.setGraph({rankdir:n,marginx:0,marginy:0,nodesep:70,ranksep:160,edgesep:30});const u=e.filter(S=>!i.has(S)),h=new Set(u);for(const S of u){const{w:E,h:C}=kl(S,s,a);l.setNode(S,{width:E,height:C})}for(const S of t)h.has(S.source)&&h.has(S.target)&&l.setEdge(S.source,S.target);vC.layout(l);const p=new Map;let f=1/0,g=1/0,v=-1/0,w=-1/0;for(const S of u){const E=l.node(S);if(!E)continue;const C=s.get(S),j=(C==null?void 0:C.width)??Ki,I=(C==null?void 0:C.height)??Ou,O=kl(S,s,a),P=E.x-O.w/2,z=E.y-O.h/2;p.set(S,{x:P,y:z}),P<f&&(f=P),z<g&&(g=z),P+j>v&&(v=P+j),z+I>w&&(w=z+I)}if(Number.isFinite(f)&&Number.isFinite(g))for(const[S,E]of p)p.set(S,{x:E.x-f,y:E.y-g});const N=Number.isFinite(v)?v-f:0,b=Number.isFinite(w)?w-g:0;let k=null;for(const S of e){const E=i.get(S);if(!E)continue;const C=s.get(S),j=(C==null?void 0:C.width)??Ki,I=(C==null?void 0:C.height)??Ou;k=k===null?{minX:E.x,minY:E.y,maxX:E.x+j,maxY:E.y+I}:{minX:Math.min(k.minX,E.x),minY:Math.min(k.minY,E.y),maxX:Math.max(k.maxX,E.x+j),maxY:Math.max(k.maxY,E.y+I)}}return{positions:p,width:N,height:b,pinnedBox:k}}function jB(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 S of e){const E=bl(S),C=u.get(E);C?C.push(S.id):u.set(E,[S.id])}const p=Array.from(u.keys()).sort().map(S=>({sid:S,...CB(u.get(S),t,s,a,i,l)})),f=kB(e,a),g=n.availableHeight&&n.availableHeight>0?n.availableHeight:Number.POSITIVE_INFINITY,v=S=>{const E=[[]];let C=0;for(const j of p)E.length<S&&C>0&&C+j.height>g&&(E.push([]),C=0),E[E.length-1].push(j),C+=j.height+wC;return E},w=S=>S.reduce((E,C)=>Math.max(E,C.width),0)+VR;let N=v(n.availableWidth?_B:1);N.length>1&&N.reduce((E,C)=>E+w(C),0)+f*(N.length-1)>(n.availableWidth??0)&&(N=v(1));const b=new Map;let k=0;for(const S of N){const E=w(S);let C=0;for(const{positions:j,height:I,pinnedBox:O}of S){for(const[z,M]of j)b.set(z,{x:M.x+k,y:M.y+C});let P=C+I;O&&O.maxY>P&&O.minX<k+E&&k<O.maxX&&(P=O.maxY),C=P+wC}k+=E+f}return e.map(S=>{const E=i.get(S.id);if(E)return{...S,position:E};const C=b.get(S.id);return C?{...S,position:C}:S})}function TB(e,t,n,s,i){const l=Fi+ud,u=60,h=w=>kl(w,s,i),p=new Map(e.map(w=>[w.id,bl(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)),v=[];for(const{id:w,pos:N}of g){const{w:b,h:k}=h(w),S=p.get(w)??"_default";if(n.has(w)){f.push({x:N.x,y:N.y,w:b,h:k,sid:S});continue}let E=N.y;for(let C=0;C<f.length+1;C++){const j=f.find(I=>{const O=I.sid===S?24:u,P=I.sid===S?24:l;return N.x<I.x+I.w+O&&I.x<N.x+b+O&&E<I.y+I.h+P&&I.y<E+k+P});if(!j)break;E=j.y+j.h+(j.sid===S?24:l)}E!==N.y&&(t.set(w,{x:N.x,y:E}),v.push(w)),f.push({x:N.x,y:E,w:b,h:k,sid:S})}return v}function RB(e,t,n,s,i,a){const l=b=>kl(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 k=bl(b),S=h.get(k);S?S.push(b):h.set(k,[b])}const p=new Set;for(const[b,k]of h)k.every(S=>i.has(S.id)&&!n.has(S.id))&&p.add(b);const f=new Map,g=[];for(const b of e){const k=u(b.id);if(!k)continue;const{w:S,h:E}=l(b.id),C=bl(b);p.has(C)?(f.get(C)??f.set(C,[]).get(C)).push(b):g.push({x:k.x,y:k.y,w:S,h:E})}if(f.size===0)return[];const v=Fi+ud,w=(b,k,S,E)=>g.some(C=>b<C.x+C.w+Fi&&C.x<b+S+Fi&&k<C.y+C.h+v&&C.y<k+E+v),N=[];for(const b of[...f.keys()].sort()){const k=f.get(b);let S=1/0,E=1/0,C=-1/0,j=-1/0;for(const q of k){const G=u(q.id),{w:Y,h:R}=l(q.id);S=Math.min(S,G.x),E=Math.min(E,G.y),C=Math.max(C,G.x+Y),j=Math.max(j,G.y+R)}const I=C-S,O=j-E,P=[...new Set(g.map(q=>Math.round(q.x)))].sort((q,G)=>q-G),z=P.length?P:[S],M=[0,...g.map(q=>q.y+q.h+v)].sort((q,G)=>q-G);let A=null;e:for(const q of z)for(const G of M){if(G>=E)break;if(!w(q,G,I,O)){A={x:q,y:G};break e}}if(A){const q=A.x-S,G=A.y-E;for(const Y of k){const R=u(Y.id);t.set(Y.id,{x:R.x+q,y:R.y+G})}N.push(b)}for(const q of k){const G=u(q.id),{w:Y,h:R}=l(q.id);g.push({x:G.x,y:G.y,w:Y,h:R})}}return N}function AB(e,t,n,s,i,a=!1,l){const p=Fi+ud+1,f=8,g=1.75,v=200,w=.7,N=.01,b=A=>kl(A,s,l),k=A=>n.get(A)??t.get(A),S=new Map;for(const A of e){if(!k(A.id))continue;const q=bl(A),G=S.get(q);G?G.push(A):S.set(q,[A])}const E=[],C=new Set,j=new Set,I=i.size===0;for(const A of[...S.keys()].sort()){const q=S.get(A);let G=1/0,Y=1/0,R=-1/0,Q=-1/0,H=!1;for(const J of q){const $=k(J.id),{w:V,h:Z}=b(J.id);G=Math.min(G,$.x),Y=Math.min(Y,$.y),R=Math.max(R,$.x+V),Q=Math.max(Q,$.y+Z),n.has(J.id)&&(H=!0)}const ne=R-G,X=Q-Y;j.add(A);const U=i.get(A);U&&(ne>U.w+f||X>U.h+f)&&C.add(A),i.set(A,{w:ne,h:X}),E.push({sid:A,members:q.map(J=>J.id),x:G,y:Y,w:ne,h:X,anchored:H,mass:1})}for(const A of[...i.keys()])j.has(A)||i.delete(A);if(a||I)return[];let O=!1;for(let A=0;A<E.length&&!O;A++)for(let q=A+1;q<E.length;q++){const G=E[A],Y=E[q];if(!(G.anchored&&Y.anchored)&&Math.abs(G.x+G.w/2-(Y.x+Y.w/2))<(G.w+Y.w)/2+61&&Math.abs(G.y+G.h/2-(Y.y+Y.h/2))<(G.h+Y.h)/2+p){O=!0;break}}if(C.size===0&&!O)return[];if(C.size>0)for(const A of E)C.has(A.sid)&&(A.mass=8);else for(const A of E)A.mass=Math.max(1,A.w*A.h/(Ki*Ou));const P=new Map(E.map(A=>[A.sid,A.x])),z=new Map(E.map(A=>[A.sid,A.y]));for(let A=0;A<v;A++){const q=new Map,G=new Map;let Y=0;for(let R=0;R<E.length;R++)for(let Q=R+1;Q<E.length;Q++){const H=E[R],ne=E[Q];if(H.anchored&&ne.anchored)continue;const X=H.x+H.w/2,U=H.y+H.h/2,J=ne.x+ne.w/2,$=ne.y+ne.h/2,V=(H.w+ne.w)/2+61-Math.abs(X-J),Z=(H.h+ne.h)/2+p-Math.abs(U-$);if(V<=0||Z<=0)continue;const D=(Pe,Ue)=>!Pe.anchored&&!(Ue<0&&Pe.x<=0),L=(Pe,Ue)=>!Pe.anchored&&!(Ue<0&&Pe.y<=0),K=(Pe,Ue,Ge)=>{const it=Pe===Ue,ke=it?H.sid<ne.sid?-1:1:Math.sign(Pe-Ue);return Ge(H,ke)||Ge(ne,-ke)?ke:it&&(Ge(H,-ke)||Ge(ne,ke))?-ke:0},se=K(X,J,D),he=K(U,$,L),me=se!==0,xe=he!==0;if(!me&&!xe)continue;const Ee=me&&(!xe||V*g<Z),[He,Fe,Ie,be]=Ee?[se,V,q,D]:[he,Z,G,L],ue=be(H,He),re=be(ne,-He),pe=H.mass,Oe=ne.mass,nt=ue?re?Oe/(pe+Oe):1:0,st=re?ue?pe/(pe+Oe):1:0,Xe=Fe*w;Ie.set(H.sid,(Ie.get(H.sid)??0)+He*Xe*nt),Ie.set(ne.sid,(Ie.get(ne.sid)??0)-He*Xe*st),Y+=Xe}for(const R of E)R.anchored||(R.x=Math.max(0,R.x+(q.get(R.sid)??0)),R.y=Math.max(0,R.y+(G.get(R.sid)??0)));if(Y<N)break}const M=[];for(const A of E){const q=A.x-P.get(A.sid),G=A.y-z.get(A.sid);if(!(Math.abs(q)<1&&Math.abs(G)<1)){for(const Y of A.members){if(n.has(Y))continue;const R=t.get(Y);R&&t.set(Y,{x:R.x+q,y:R.y+G})}M.push(A.sid)}}return M}const MB=600;function sw(e,t){return!(e.exitAt!=null&&t-e.exitAt>MB||e.kind==="root"&&e.state==="done"&&e.tools.length===0&&e.endedAt!=null&&e.endedAt-e.startedAt<3e3)}function IB(e,t){const n=new Set;for(const s of e.agents.values())sw(s,t)&&n.add(s.id);return n}function OB(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 PB(e,t,n=0){if(!e)return!1;for(const s of t)if(OB(e,s,n))return!0;return!1}const YR="sessionGroup";function $B(e,t){var s;if(e.type===YR)return"transparent";const n=(s=e.data)==null?void 0:s.state;return t(n==="err"?"--err":n==="active"?"--inflight":"--ok")}const KR=["--err","--inflight","--ok","--grid-line","--minimap-mask","--panel","--line","--accent","--text-dim","--bg"];function xC(e){const t={};for(const n of KR)t[n]=e(n);return t}function LB(e){return t=>e[t]??""}function qB(e,t){return KR.every(n=>e[n]===t[n])}function DB(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 FB=1200,zB=1e3;function bC(e){return e.lastDeckFitAt>0&&e.at-e.lastDeckFitAt<FB?!1:e.hasSourceEvent?!0:e.lastCanvasInputAt>0&&e.at-e.lastCanvasInputAt<zB}function _v({durationMs:e,documentHidden:t}){return t?!1:Number.isFinite(e)&&e>0}function BB(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 UB({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,BB(i,t,e))return!1;return s}const WB="Update checks are off (AGENTS_DECK_NO_UPDATE_CHECK=1)",Sv="click for what's new";function HB(e){if(e.checkDisabled)return`${WB} · ${Sv}`;if(e.checking)return`Asking npm for the newest release… · ${Sv}`;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 · ${Sv}, and to check npm now`}function GB(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 VB(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 YB(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 ow={kind:"assumed",claude:!0,codex:!0};function KB(e){if(!e||typeof e!="object")return ow;const t=e.providers;if(!t||typeof t!="object")return ow;const n=t;return{kind:"reported",claude:n.claude!==!1,codex:n.codex!==!1}}function Pu(e){const t=Math.max(0,Math.floor(e));return`${t} event${t===1?"":"s"}`}const kC=99;function XB(e){const t=Math.max(0,Math.floor(e));return t>kC?`${kC}+`:String(t)}const QB="Pause the canvas";function ZB(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 — ${Pu(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)":`${Pu(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 XR="paused · full",e8=(e,t)=>t>0?XR:e>0?`paused · ${XB(e)}`:"paused";function t8(e){const t=Math.max(0,Math.floor(e.dropped??0));return e.connected?e.paused?{tone:"paused",resting:!1,label:e8(e.held,t),widest:XR,title:t>0?`Connected — the pause is full at ${Pu(e.held)}; the oldest are being dropped as new ones arrive. Resume to catch up (Space)`:e.held>0?`Connected — ${Pu(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 _C(e){return typeof window>"u"?"":getComputedStyle(document.documentElement).getPropertyValue(e).trim()||""}const n8={agent:m3,sessionGroup:M3},QR="react-flow__node";function SC(e){var t,n;return!!e&&((n=(t=e.classList)==null?void 0:t.contains)==null?void 0:n.call(t,QR))===!0}function r8(e){try{const t=document.querySelector(`.${QR}[data-id="${CSS.escape(e)}"]`);t==null||t.focus({preventScroll:!0})}catch{}}const s8=["a[href]","button:not(:disabled)","input:not(:disabled)","select:not(:disabled)","textarea:not(:disabled)","summary","[tabindex]"].join(","),o8=420,hu=18,i8=200,a8=5*6e4,l8=6,c8=2*6e4,NC=400,o0="agent-dag.layout",i0="agent-dag.viewport",ZR="agent-dag.summariesDismissed",JR="agent-dag.sessionListOpen",eA="agent-dag.detailOpen",tA="agent-dag.usagePanelOpen",EC="agent-dag.accountsPanelOpen",Nv="agent-dag.versionNoticeDismissed",CC="agent-dag.oldNameNoticeDismissed",u8=15*6e4,Ev={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:"},jC="agent-dag.autoRestart",TC="agent-dag.bundleReloadedFor";function d8(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(JR)==="1"}catch{return!1}}function f8(e){if(!(typeof window>"u"))try{window.localStorage.setItem(JR,e?"1":"0")}catch{}}function h8(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(eA)==="1"}catch{return!1}}function p8(e){if(!(typeof window>"u"))try{window.localStorage.setItem(eA,e?"1":"0")}catch{}}function m8(){const e=Hu(tA);return e===null?!0:e==="1"}function g8(e){if(!(typeof window>"u"))try{window.localStorage.setItem(tA,e?"1":"0")}catch{}}function y8(){if(typeof window>"u")return new Set;try{const e=window.localStorage.getItem(ZR);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 RC(e){if(!(typeof window>"u"))try{const t=Array.from(e),n=t.length>200?t.slice(-200):t;window.localStorage.setItem(ZR,JSON.stringify(n))}catch{}}function v8(){const e={positions:[],pins:[]};if(typeof window>"u")return e;try{const t=window.localStorage.getItem(o0);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 Cv(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(o0,JSON.stringify({v:2,positions:n,pins:Array.from(t.keys())}))}catch{}}function w8(){if(typeof window>"u")return null;try{const e=window.localStorage.getItem(i0);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 x8(e){if(!(typeof window>"u"))try{window.localStorage.setItem(i0,JSON.stringify(e))}catch{}}function AC(){if(!(typeof window>"u")){try{window.localStorage.removeItem(o0)}catch{}try{window.localStorage.removeItem(i0)}catch{}}}function b8(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=`${Bt}-${p}-${t.slice(0,8)}.json`,document.body.appendChild(h),h.click(),document.body.removeChild(h),setTimeout(()=>URL.revokeObjectURL(u),1e3)}const iw={file:"📁",shell:"⚡",web:"🌐",agent:"🤖",task:"📋",plan:"🧭",mcp:"🔌",other:"✨"},aw={file:"file",shell:"shell",web:"web",agent:"agent",task:"task",plan:"plan",mcp:"mcp",other:"other"},nA=vT;function k8(e,t,n,s,i,a,l,u,h,p,f,g,v,w,N,b,k,S){const E=[],C=[];for(const A of e.agents.values()){if(!k.has(A.id))continue;const q=A.exitAt!=null,G=b!=null&&!b.has(A.id),Y=[q?"rf-exiting":"",G?"rf-spotlit-out":""].filter(Boolean).join(" ")||void 0,R=a.get(A.id);if(E.push({id:A.id,type:"agent",position:{x:0,y:0},data:{...A,now:t,onOpenContext:S},className:Y,...R?{width:R.width,height:R.height}:null}),A.parentId&&k.has(A.parentId)){const Q=jw(A.sessionId),H=q,ne=N.size>0&&(N.has(A.id)||N.has(A.parentId)),X=b!=null&&!b.has(A.id)&&!b.has(A.parentId),U=A.state==="active"?2:1.5,J=ne?U+1.5:U,$=H?.2:X?.12:1,V=["sess-edge",A.state==="active"?"sess-live":"sess-idle",H?"rf-edge-exiting":"",ne?"rf-edge-selected":""].filter(Boolean).join(" ");C.push({id:`e:${A.parentId}->${A.id}`,source:A.parentId,target:A.id,animated:(A.state==="active"||ne)&&!H,type:"smoothstep",style:{"--session-hue":Q,strokeWidth:J,opacity:$,transition:"var(--edge-transition)"},className:V})}}const j=new Map;for(const A of e.agents.values())A.tools.length>0&&j.set(A.id,Math.min(4,A.tools.length));const I=`${v}#lanes:${EB(j)}`,O=E.filter(A=>b5(A.id,i,f,g));if(O.length>0||I!==w.current){if(O.length>0){const A=jB(E,C,{direction:"LR",pinned:i,measured:a,availableWidth:n,availableHeight:s,lanes:j});for(const q of A)WT(q.id,f,g)&&_5(q.id,q.position,f,g);RB(E,f,i,a,new Set(O.map(q=>q.id)),j)}TB(E,f,i,a,j),w.current=I}const P=AB(E,f,i,a,l,!h||p,j);P.length>0&&u(P),au(f,e.agents),au(g,e.agents),au(i,e.agents),au(a,v5(e.agents.values()));const z=[];let M=!1;for(const A of E){let q=i.get(A.id)??f.get(A.id);q||(q=k5(A.id,f,g),M=!0),z.push({...A,position:q})}return M&&(w.current=""),{nodes:z,edges:C}}function _8(){return d.jsx(Ew,{children:d.jsx(S8,{})})}function S8(){var ps,ka,_a,Sa;const e=Cl(),t=At(),n=_.useState(Wv)[0],s=_.useRef(n),[,i]=_.useState(0),a=_.useCallback(()=>i(F=>F+1),[]),[l,u]=_.useState(()=>new Set),[h,p]=_.useState(null),[f,g]=_.useState(null),v=_.useCallback((F,B)=>{u(le=>{if(!B)return new Set([F]);const fe=new Set(le);return fe.has(F)?fe.delete(F):fe.add(F),fe}),p(le=>B&&le===F?le:F)},[]),w=_.useCallback(()=>{u(new Set),p(null)},[]),[N,b]=_.useState(null),[k,S]=_.useState(null),E=_.useCallback(F=>S(F),[]),[C,j]=_.useState(!1),[I,O]=_.useState(!1),P=_.useState(y8)[0],[z,M]=_.useState(d8);_.useEffect(()=>{f8(z)},[z]);const[A,q]=_.useState(h8);_.useEffect(()=>{p8(A)},[A]);const[G,Y]=_.useState(m8);_.useEffect(()=>{g8(G)},[G]);const[R,Q]=_.useState(()=>{try{const F=window.localStorage.getItem(EC);return F===null?!0:F==="1"}catch{return!0}});_.useEffect(()=>{try{window.localStorage.setItem(EC,R?"1":"0")}catch{}},[R]);const[H,ne]=_.useState(null);_.useEffect(()=>{let F=null;try{F=localStorage.getItem("agent-dag.sound")}catch{}ne(F===null?!0:F==="on")},[]);const X=_.useCallback(()=>{ne(F=>{var le;const B=F!==!0;try{localStorage.setItem("agent-dag.sound",B?"on":"off")}catch{}return B&&((le=Ee.current)==null||le.unlock()),B})},[]),U=_.useCallback(F=>{X()},[X]),J=_.useRef(U);J.current=U;const $=_.useRef(H);$.current=H;const[V,Z]=_.useState(()=>HD(Hu)),D=_.useRef(V);D.current=V;const L=_.useRef(null),K=_.useCallback((F,B=!1)=>{var le,fe;if((le=Ee.current)==null||le.unlock(),L.current!==null&&clearTimeout(L.current),L.current=null,!B){(fe=Ee.current)==null||fe.play(F,!0);return}L.current=setTimeout(()=>{var _e;L.current=null,(_e=Ee.current)==null||_e.play(F,!0)},FD)},[]),se=_.useCallback((F,B)=>{Z(le=>{const fe={level:xl(B.level??le[F].level),figure:DT(F,B.figure??le[F].figure)};try{localStorage.setItem(zT[F],String(fe.level)),localStorage.setItem(BT[F],fe.figure)}catch{}return{...le,[F]:fe}}),K(F,!0)},[K]);_.useEffect(()=>()=>{L.current!==null&&clearTimeout(L.current)},[]);const[he,me]=_.useState(!1),xe=_.useRef(null),Ee=_.useRef(null),[He,Fe]=_.useState("locked");_.useEffect(()=>{const F=YD({enabled:()=>$.current===!0,prefs:()=>D.current,onState:Fe});Ee.current=F,Fe(F.state());const B=()=>F.unlock();return window.addEventListener("pointerdown",B,{once:!0,capture:!0}),window.addEventListener("keydown",B,{once:!0,capture:!0}),()=>{window.removeEventListener("pointerdown",B,{capture:!0}),window.removeEventListener("keydown",B,{capture:!0})}},[]);const[Ie,be]=_.useState(!1),[ue,re]=_.useState(null),[pe,Oe]=_.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(Nv)??""}catch{return""}}),[nt,st]=_.useState(!1),Xe=_.useRef(0),[Pe,Ue]=_.useState(!1),Ge=_.useCallback((F=!1)=>(F&&(Xe.current=Date.now(),Ue(!0)),fetch(F?"/api/version?refresh=1":"/api/version").then(B=>B.ok?B.json():null).then(B=>{B&&re(B)}).catch(()=>{}).finally(()=>{F&&Ue(!1)})),[]),it=_.useCallback(()=>{Ge(Date.now()-Xe.current>=u8)},[Ge]);_.useEffect(()=>{Ge();const F=window.setInterval(it,5*6e4),B=()=>{document.visibilityState==="visible"&&it()};return document.addEventListener("visibilitychange",B),()=>{window.clearInterval(F),document.removeEventListener("visibilitychange",B)}},[Ge,it]),_.useEffect(()=>{Ie&&Ge()},[Ie,Ge]);const ke=(ue==null?void 0:ue.notice)??null,[ct,It]=_.useState(null),ae=_.useRef(!1);_.useEffect(()=>{if(ae.current)return;const F=o5(),B=i5(F),le=c5({stored:B,running:(ue==null?void 0:ue.running)??null,notes:H1,remembers:a5(F)});le.reason!=="no-version"&&(ae.current=!0,le.record&&l5(F,le.record),le.show.length&&It({entries:le.show,since:B,firstRun:le.reason==="welcome"}))},[ue==null?void 0:ue.running]);const Le=(ue==null?void 0:ue.running)??"3.8.0",ze=_.useMemo(()=>UT(H1,null,Le),[Le]),Ce=_.useCallback(()=>{It({entries:ze,since:null,firstRun:!1})},[ze]),[Ve,Ct]=_.useState(null),[rt,Te]=_.useState(ow);_.useEffect(()=>{let F=!1;return fetch("/api/health").then(B=>B.ok?B.json():null).then(B=>{F||(Te(KB(B)),!(!B||typeof B.workspace!="string")&&Ct(B.workspace))}).catch(()=>{}),()=>{F=!0}},[Ie]);const wt=_.useRef(rt);wt.current=rt;const dt=ke?`${ke.kind}:${ke.to}`:"",St=ke!=null&&pe!==dt,Sn=_.useCallback(()=>{Oe("");try{window.localStorage.setItem(Nv,"")}catch{}},[]),Fn=_.useCallback(()=>{if(ke){Oe(dt);try{window.localStorage.setItem(Nv,dt)}catch{}}},[ke,dt]),[Nn,To]=_.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(CC)??""}catch{return""}}),hn=ue!=null&&ue.invokedAs&&ue.invokedAs!==Bt?ue.invokedAs:null,Ro=hn!=null&&Nn!==hn,Ao=_.useCallback(()=>{if(hn){To(hn);try{window.localStorage.setItem(CC,hn)}catch{}}},[hn]),Ut=((ps=ue==null?void 0:ue.upgrade)==null?void 0:ps.state)??"idle",Tr=kD(ue==null?void 0:ue.upgrade),zn=_.useRef(!1),Ds=_.useCallback(async()=>{if(ar(zn.current||Ut==="running")){zn.current=!0;try{await fetch("/api/upgrade",{method:"POST"})}catch{}await Ge(),zn.current=!1}},[Ut,Ge]);_.useEffect(()=>{if(Ut!=="running")return;const F=window.setInterval(Ge,3e3);return()=>window.clearInterval(F)},[Ut,Ge]);const Rr=_.useCallback(async()=>{var le;const F=ue==null?void 0:ue.command;if(!F)return;let B=!1;try{B=await Promise.race([((le=navigator.clipboard)==null?void 0:le.writeText(F).then(()=>!0))??Promise.resolve(!1),new Promise(fe=>window.setTimeout(()=>fe(!1),500))])}catch{B=!1}if(!B)try{const fe=document.createElement("textarea");fe.value=F,fe.setAttribute("readonly",""),fe.style.cssText="position:fixed;top:0;left:0;opacity:0",document.body.appendChild(fe),fe.select(),B=document.execCommand("copy"),fe.remove()}catch{B=!1}B&&(st(!0),window.setTimeout(()=>st(!1),1600))},[ue==null?void 0:ue.command]),na=_.useCallback(()=>{M(F=>(F||Q(!1),!F))},[]),fr=_.useCallback(()=>{Q(F=>(F||M(!1),!F))},[]),[Ar,hr]=_.useState(!1),[ns,Mo]=_.useState(!1),[Io,Oo]=_.useState(()=>{try{return Number(localStorage.getItem(K1))||0}catch{return 0}}),[En,Po]=_.useState([]),[Mr,$o]=_.useState(!1);_.useEffect(()=>{let F=!0;const B=()=>{fetch("/api/browser-watch?live=0").then(fe=>fe.ok?fe.json():null).then(fe=>{var _e;!F||!(fe!=null&&fe.ok)||(Po(fe.episodes??[]),$o(((_e=fe.settings)==null?void 0:_e.enabled)===!0))}).catch(()=>{})};B();const le=setInterval(B,5*6e4);return()=>{F=!1,clearInterval(le)}},[]);const Bn=_.useMemo(()=>Q5(En,Io).length,[En,Io]),[Lo,Fs]=_.useState(0),zs=_.useRef(null),[qo,Do]=_.useState(!1),at=_.useRef(null),[ra,rs]=_.useState(0),Vt=_.useState(()=>j5({protect:F=>xL(s.current,F)}))[0],[Un,Fo]=_.useState(!1),ss=_.useCallback(()=>{const F=Vt.paused&&Vt.dropped>0,B=Vt.setPaused(!Vt.paused);F&&bL(s.current);for(const le of B)s.current=e1(s.current,le);Fo(Vt.paused)},[Vt]),[xt,rn]=_.useState(Date.now()),[Wn,pn]=_.useState(()=>{if(typeof window>"u")return!0;try{return window.localStorage.getItem(jC)!=="0"}catch{return!0}}),dd=_.useCallback(()=>{pn(F=>{const B=!F;try{window.localStorage.setItem(jC,B?"1":"0")}catch{}return B})},[]),[Ir,zo]=_.useState(!1),[Bo,Uo]=_.useState("restart"),[os,Bs]=_.useState(null),is=_.useRef(!1),Dl=_.useRef(null),Wo=_.useRef(0),Us=_.useCallback(async F=>{if(!ar(is.current))return;const B=(F==null?void 0:F.upgrade)===!0;is.current=!0,Dl.current=Tr;const le=++Wo.current;Uo(B?"npx":"restart"),zo(!0);try{window.sessionStorage.setItem("agent-dag.restartPending",(ke==null?void 0:ke.to)??"")}catch{}try{await fetch("/api/restart",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({upgrade:B})})}catch{}window.setTimeout(()=>{if(Wo.current===le&&is.current){is.current=!1,zo(!1);try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}}},B?18e4:3e4)},[ke==null?void 0:ke.to,Tr]),Ho=_.useRef(null);_.useEffect(()=>{let F=!1;for(const le of s.current.agents.values())if(le.state==="active"){F=!0;break}const B=SD({enabled:Wn,kind:ke==null?void 0:ke.kind,canRestart:(ue==null?void 0:ue.canRestart)===!0,busy:F,idleSince:Ho.current,now:xt});Ho.current=B.idleSince,B.restart&&Us()},[Wn,ke==null?void 0:ke.kind,ue==null?void 0:ue.canRestart,xt,Us]),_.useEffect(()=>{const F=ue==null?void 0:ue.running;let B=null,le=null;try{B=window.sessionStorage.getItem("agent-dag.restartPending"),le=window.sessionStorage.getItem(TC)}catch{return}const fe=bD({bundle:"3.8.0",running:F,pending:B,lastTried:le});if(fe==="reload"){try{window.sessionStorage.setItem(TC,F??"")}catch{return}window.location.reload();return}if(fe!=="confirm")return;try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}is.current=!1,zo(!1),Bs(F??null);const _e=window.setTimeout(()=>Bs(null),6e3);return()=>window.clearTimeout(_e)},[ue==null?void 0:ue.running]),_.useEffect(()=>{if(Ir&&_D({asked:Dl.current,reported:Tr})){try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}is.current=!1,zo(!1)}},[Ir,Tr]);const as=_.useState(()=>DB(v8()))[0],Zt=_.useRef(as.pinned),ls=_.useRef(null),Qe=_.useState(()=>w8())[0],[sa,Fl]=_.useState(()=>new Set),[Or,oa]=_.useState(R5),[Hn,zl]=_.useState(()=>xC(_C)),Go=_.useMemo(()=>LB(Hn),[Hn]),Vo=_.useCallback(F=>$B(F,Go),[Go]),pr=_.useMemo(()=>({background:Hn["--panel"],border:`1px solid ${Hn["--line"]}`,borderRadius:8}),[Hn]),[Gn,mr]=_.useState(!1);_.useEffect(()=>{document.documentElement.dataset.theme=Or;try{window.localStorage.setItem(HT,Or)}catch{}zl(F=>{const B=xC(_C);return qB(F,B)?F:B})},[Or]);const mn=_.useCallback((F,B)=>{if(_v({durationMs:B,documentHidden:document.hidden})){e.setViewport(F,{duration:B});return}const{d3Zoom:le,d3Selection:fe}=t.getState(),_e=fe==null?void 0:fe.property("__zoom");if(le&&fe&&_e&&_e.k>0&&F.zoom>0){le.transform(fe,_e.scale(F.zoom/_e.k).translate((F.x-_e.x)/F.zoom,(F.y-_e.y)/F.zoom));return}e.setViewport(F,{duration:0})},[e,t]),Vn=_.useRef(null);_.useEffect(()=>{if(!Qe)return;const F=window.setTimeout(()=>{try{mn(Qe,0)}catch{}Kn.current=Date.now()},60);return()=>window.clearTimeout(F)},[mn,Qe]);const Yn=_.useRef(!0);_.useEffect(()=>{const F=new EventSource("/events"),B=E5(a,{now:()=>Date.now(),setTimeout:(le,fe)=>window.setTimeout(le,fe),clearTimeout:le=>window.clearTimeout(le)});return F.addEventListener("open",()=>{be(!0),mr(!0)}),F.addEventListener("error",()=>be(!1)),F.addEventListener("replay-end",()=>{Yn.current=!1,B.flush()}),F.addEventListener("hook",le=>{var fe;try{const _e=JSON.parse(le.data);if(!Vt.accept(_e))return;s.current=e1(s.current,_e);const Re=_e.replay===!0||Yn.current||Date.now()-_e.receivedAt>3e4;Re?B.replay():B.live();const Be=VD(_e,Re);Be&&((fe=Ee.current)==null||fe.play(Be))}catch{}}),()=>{F.close(),B.cancel()}},[a]),_.useEffect(()=>{const F=setInterval(()=>{const B=Date.now();rn(B);let le=kL(s.current,B,Jb);_L(s.current,B,Jb)&&(le=!0),vL(s.current,B,i8,a8)&&(le=!0),wL(s.current,B,l8,c8)&&(le=!0),u(fe=>y5(fe,s.current.agents)),p(fe=>fe!=null&&!s.current.agents.has(fe)?null:fe),le&&a()},250);return()=>clearInterval(F)},[a]);const ia=_.useRef(null),Kn=_.useRef(0),Ws=420,Cn=_.useCallback((F=500)=>{try{const Re=document.querySelector(".canvas-wrap"),Be=Array.from(document.querySelectorAll(".react-flow__node")).filter(ut=>ut.offsetWidth>0);if(!Re||Be.length===0)return;const Ze=Re.getBoundingClientRect(),ht=e.getViewport();if(!Number.isFinite(ht.zoom)||ht.zoom<=0)return;const ot=ut=>(ut-Ze.left-ht.x)/ht.zoom,Pt=ut=>(ut-Ze.top-ht.y)/ht.zoom,ms=Be.map(ut=>ut.getBoundingClientRect()),Na=Math.min(...ms.map(ut=>ot(ut.left))),si=Math.max(...ms.map(ut=>ot(ut.right))),Ea=Math.min(...ms.map(ut=>Pt(ut.top))),rc=Math.max(...ms.map(ut=>Pt(ut.bottom))),Ca=si-Na,oi=rc-Ea;if(!(Ca>0&&oi>0))return;const gs=Math.max(.2,Math.min(1,(Ze.width-160)/(Ca+Ws)*.86,(Ze.height-160)/oi*.86)),ys={x:80-Na*gs,y:Math.max(80,(Ze.height-oi*gs)/2)-Ea*gs,zoom:gs};mn(ys,F),Kn.current=Date.now(),Vn.current=_v({durationMs:F,documentHidden:document.hidden})?{target:ys,until:Date.now()+F+60}:null,window.setTimeout(()=>{var ut;try{((ut=Vn.current)==null?void 0:ut.target)===ys&&(Vn.current=null);const ii=e.getViewport();(Math.abs(ii.zoom-gs)>.01||Math.abs(ii.x-ys.x)>2)&&mn(ys,0)}catch{}},F+60)}catch{}},[e,mn]);_.useEffect(()=>{const F=()=>{if(!document.hidden)return;const B=Vn.current;if(Vn.current=null,!(!B||Date.now()>B.until)){try{mn(B.target,0)}catch{}Kn.current=Date.now()}};return document.addEventListener("visibilitychange",F),()=>document.removeEventListener("visibilitychange",F)},[mn]);const Yo=_.useRef(""),cs=_.useRef(null),aa=_.useRef(0),Ko=_.useCallback(()=>{aa.current=Date.now()},[]),Pr=_.useRef(null),us=_.useRef(0),gr=_.useCallback(()=>{us.current=Date.now()},[]),Hs=_.useCallback(F=>({hasSourceEvent:!!F,at:Date.now(),lastDeckFitAt:Kn.current,lastCanvasInputAt:us.current}),[]),la="agent-dag.autoFitDisabled",Bl=_.useState(()=>{if(typeof window>"u")return!1;try{return window.localStorage.getItem(la)==="1"}catch{return!1}})[0],yr=_.useRef(Bl),[Gs,Xo]=_.useState(Bl),Qo=_.useCallback(()=>{if(!yr.current){yr.current=!0,Xo(!0);try{window.localStorage.setItem(la,"1")}catch{}}},[]),vr=_.useCallback(()=>{yr.current=!1,Xo(!1);try{window.localStorage.removeItem(la)}catch{}Cn(400)},[e,Cn]);_.useEffect(()=>{const F=setInterval(()=>{if(yr.current||Date.now()-aa.current<800)return;const B=s.current,le=Date.now(),fe=[];for(const Re of B.agents.values())sw(Re,le)&&fe.push({id:Re.id});if(fe.length===0)return;const _e=[];for(const{id:Re}of fe){const Be=Xn.current.get(Re),Ze=Zt.current.get(Re)??Ot.current.get(Re);!Be||!Ze||_e.push({x:Ze.x,y:Ze.y,width:Be.width,height:Be.height})}UB({pane:Pr.current,viewport:e.getViewport(),boxes:_e})&&Cn(600)},1500);return()=>clearInterval(F)},[e]);const Vs=_.useRef(!1),Xn=_.useRef(new Map),ca=_.useRef(0),Zo=_.useCallback(F=>{const B=Xn.current;let le=!1;for(const fe of F.nodeInternals.values()){const _e=fe.width,Re=fe.height;if(_e==null||Re==null)continue;const Be=B.get(fe.id);Be?(Math.abs(Be.height-Re)>4||Math.abs(Be.width-_e)>4)&&(B.set(fe.id,{width:_e,height:Re}),le=!0):(B.set(fe.id,{width:_e,height:Re}),le=!0)}return le&&(ca.current+=1),ca.current},[]),Ys=lt(Zo),[ua,Jt]=_.useState(0);_.useEffect(()=>{let F=0;const B=()=>{const fe=Xn.current;let _e=!1;for(const Re of document.querySelectorAll(".react-flow__node[data-id]")){const Be=Re.getAttribute("data-id");if(!Be)continue;const Ze=Re.offsetWidth,ht=Re.offsetHeight;if(!Ze||!ht)continue;const ot=fe.get(Be);(!ot||Math.abs(ot.width-Ze)>4||Math.abs(ot.height-ht)>4)&&(fe.set(Be,{width:Ze,height:ht}),_e=!0)}_e&&Jt(Re=>Re+1)};if(Vs.current)return;let le=0;return document.visibilityState==="hidden"?le=window.setTimeout(B,32):F=requestAnimationFrame(B),()=>{cancelAnimationFrame(F),window.clearTimeout(le)}});const Ot=_.useRef(as.positions),da=_.useRef(new Set),$r=_.useRef(""),ds=_.useMemo(()=>{const F=[];for(const B of s.current.agents.values())sw(B,xt)&&F.push(B.id+(B.parentId?`>${B.parentId}`:""));return F.sort(),`${F.join("|")}#sv${Ys}.${ua}`},[s.current,s.current.revision,xt,Ys,ua]),Lr=_.useRef(null);_.useEffect(()=>(Lr.current!=null&&window.clearTimeout(Lr.current),Lr.current=window.setTimeout(()=>{Cv(Ot.current,Zt.current)},1500),()=>{Lr.current!=null&&window.clearTimeout(Lr.current)}),[ds]),_.useEffect(()=>{if(Yo.current===ds)return;const F=Yo.current;if(Yo.current=ds,!F||yr.current)return;Date.now()-Kn.current>1200&&Cn(400),ia.current&&window.clearTimeout(ia.current),ia.current=window.setTimeout(()=>{yr.current||Cn(500)},280)},[ds,e,Cn]);const Ks=_.useMemo(()=>x5(s.current,l),[s.current,s.current.revision,l]),qr=_.useMemo(()=>IB(s.current,xt),[s.current,s.current.revision,xt]),Xs=_.useRef(null),[Qs,Ul]=_.useState({w:0,h:0});_.useEffect(()=>{const F=Xs.current;if(!F||typeof ResizeObserver>"u")return;const B=new ResizeObserver(le=>{var _e;const fe=(_e=le[0])==null?void 0:_e.contentRect;fe&&(Pr.current={width:fe.width,height:fe.height},Ul(Re=>Math.abs(Re.w-fe.width)>40||Math.abs(Re.h-fe.height)>40?{w:fe.width,h:fe.height}:Re))});return B.observe(F),Pr.current={width:F.clientWidth,height:F.clientHeight},Ul({w:F.clientWidth,h:F.clientHeight}),()=>B.disconnect()},[]);const fd=_.useCallback(F=>{var le,fe;const B=F.target;!(B!=null&&B.closest)||B.closest(s8)!==F.currentTarget||(F.preventDefault(),(fe=(le=document.activeElement)==null?void 0:le.blur)==null||fe.call(le))},[]),hd=_.useRef(new Map),[Jo,pd]=_.useState(!1);_.useEffect(()=>{const F=window.setTimeout(()=>pd(!0),2500);return()=>window.clearTimeout(F)},[]);const[md,fa]=_.useState(!1),wr=_.useRef(null),[ha,pa]=_.useState(!1),gd=_.useCallback(()=>{wr.current&&(window.clearTimeout(wr.current),wr.current=null),fa(!1)},[]),yd=_.useCallback(F=>{F.length!==0&&queueMicrotask(()=>{fa(!0),wr.current&&window.clearTimeout(wr.current),wr.current=window.setTimeout(()=>fa(!1),o8+80)})},[]);_.useEffect(()=>()=>{wr.current&&window.clearTimeout(wr.current)},[]);const Wl=Qs.w>0?Qs.w*.92:0,Hl=Qs.h>0?Qs.h:0,{nodes:jn,edges:vd}=_.useMemo(()=>k8(s.current,xt,Wl,Hl,Zt.current,Xn.current,hd.current,yd,Jo,ha,Ot.current,da.current,ds,$r,l,Ks,qr,E),[s.current,s.current.revision,xt,Wl,Hl,Jo,ha,ds,l,Ks,qr,E,Lo]),Gl=_.useMemo(()=>{const F=new Map;for(const le of jn){const fe=le.data;if(!(fe!=null&&fe.sessionId)||fe.exitAt!=null)continue;const _e=le.width,Re=le.height;if(_e==null||Re==null)continue;const Be=le.position.x,Ze=le.position.y,ht=Be+_e,ot=Ze+Re,Pt=F.get(fe.sessionId);Pt?(Pt.minX=Math.min(Pt.minX,Be),Pt.minY=Math.min(Pt.minY,Ze),Pt.maxX=Math.max(Pt.maxX,ht),Pt.maxY=Math.max(Pt.maxY,ot)):F.set(fe.sessionId,{minX:Be,minY:Ze,maxX:ht,maxY:ot})}const B=[];for(const[le,fe]of F){const _e=fe.maxX-fe.minX+hu*2,Re=fe.maxY-fe.minY+hu*2;B.push({id:`group:${le}`,type:YR,position:{x:fe.minX-hu,y:fe.minY-hu},data:{sessionId:le,w:_e,h:Re},width:_e,height:Re,style:{width:_e,height:Re},zIndex:-1,draggable:!0,selectable:!1,focusable:!1,deletable:!1,connectable:!1})}return B},[jn,xt]),wd=_.useMemo(()=>{const F=[...Gl,...jn],B=at.current;return!B||B.size===0?F:F.map(le=>{const fe=B.get(le.id);return fe?{...le,position:fe}:le})},[Gl,jn,ra]),Zs=_.useMemo(()=>{const F=new Set;for(const B of s.current.agents.values())for(const le of B.tools)F.add(nA(le.name));return Object.keys(iw).filter(B=>F.has(B))},[s.current,s.current.revision]);_.useEffect(()=>{if(Zs.length<=1){Do(!1);return}let F=0;const B=()=>{const le=zs.current;if(le&&!document.hidden){const fe=le.getBoundingClientRect(),_e=Array.from(document.querySelectorAll(".react-flow__node, .tool-burst")).map(Be=>Be.getBoundingClientRect()),Re=PB(fe,_e,8);Do(Be=>Be===Re?Be:Re)}F=window.setTimeout(B,300)};return B(),()=>window.clearTimeout(F)},[Zs.length]);const xd=_.useCallback(F=>{Fl(B=>{const le=new Set(B);return le.has(F)?le.delete(F):le.add(F),le})},[]),en=h?s.current.agents.get(h):null,ma=f?Array.from(s.current.agents.values()).flatMap(F=>F.tools).find(F=>F.id===f)??null:null,Vl=_.useCallback(async()=>{try{await fetch("/api/clear",{method:"POST"})}catch{}s.current=Wv(),Zt.current.clear(),Xn.current.clear(),Ot.current.clear(),$r.current="",AC(),w(),a()},[a,w]),Yl=_.useRef(C);Yl.current=C;const Kl=_.useRef(I);Kl.current=I;const ga=_.useRef(!1);ga.current=ma!=null||Ar||k!=null||N!=null||ns||I||ct!=null;const fs=_.useCallback(F=>{const B=ND(F,{confirmOpen:Yl.current,modalOpen:ga.current});B==="confirm"?j(!0):B==="clear"&&(j(!1),Vl())},[Vl]),Dr=_.useCallback(()=>{Zt.current.clear(),Ot.current.clear(),$r.current="",AC(),a(),window.setTimeout(()=>Cn(500),80)},[a,e,Cn]),Xl=_.useCallback(()=>Cn(500),[Cn]),Js=_.useRef(jn);Js.current=jn;const ya=_.useRef(h);ya.current=h;const ei=_.useCallback(F=>{const B=Js.current,le=f5(B.map(Re=>({id:Re.id,x:Re.position.x,y:Re.position.y})),ya.current,F),fe=le?B.find(Re=>Re.id===le):void 0;if(!fe)return;const _e=SC(document.activeElement);v(fe.id,!1),window.setTimeout(()=>{try{e.fitView({padding:.35,duration:350,nodes:[fe]})}catch{}Kn.current=Date.now(),_e&&r8(fe.id)},30)},[v,e]),ti=_.useCallback(F=>{v(F,!1),window.setTimeout(()=>{try{const B=Js.current.find(le=>le.id===F);B&&e.fitView({padding:.3,duration:500,nodes:[B]}),Kn.current=Date.now()}catch{}},60)},[v,e]);_.useEffect(()=>{const F=B=>{var Ze,ht;const le=B.target,fe={tagName:le==null?void 0:le.tagName,isContentEditable:le==null?void 0:le.isContentEditable,role:(Ze=le==null?void 0:le.getAttribute)==null?void 0:Ze.call(le,"role"),type:le==null?void 0:le.type};if(B.key==="Escape"){const ot=ZL({overlayOpen:qi.depth()>0,panelOnTop:qi.topIsPanel(),typing:Mw(fe)});ot==="dismiss"?qi.dismissTop():ot==="blur"?le==null||le.blur():(g5(fe)&&(le==null||le.blur()),w());return}if(Aw(B))return;const _e=SC(le)?(ht=le==null?void 0:le.getAttribute)==null?void 0:ht.call(le,"data-id"):null,Re=_e&&Js.current.some(ot=>ot.id===_e)?_e:null,Be=p5(B,Re);if(Be.kind==="activate"){B.preventDefault(),v(Be.nodeId,Be.additive);return}Be.kind!=="node"&&(Be.nodeId==null&&i3(fe)||a3({key:B.key,modalOpen:ga.current,sheetOpen:Kl.current})||(B.key===" "&&(B.preventDefault(),ss()),(B.key==="c"||B.key==="C")&&fs("shortcut"),(B.key==="r"||B.key==="R")&&Dr(),(B.key==="f"||B.key==="F")&&Xl(),(B.key==="l"||B.key==="L")&&na(),(B.key==="h"||B.key==="H")&&hr(ot=>!ot),(B.key==="u"||B.key==="U")&&Y(ot=>!ot),(B.key==="a"||B.key==="A")&&wt.current.claude&&fr(),(B.key==="j"||B.key==="J")&&ei(1),(B.key==="k"||B.key==="K")&&ei(-1),(B.key==="t"||B.key==="T")&&oa(ot=>ot==="dark"?"light":"dark"),(B.key==="m"||B.key==="M")&&wt.current.claude&&$.current!==null&&J.current(B.shiftKey),B.key==="?"&&O(ot=>!ot)))};return window.addEventListener("keydown",F),()=>window.removeEventListener("keydown",F)},[fs,Dr,Xl,w,v,ei,ss]);const ni=s.current.agents.size,bt=_.useMemo(()=>UL(s.current.agents.values()),[s.current,s.current.revision]),Ql=_.useMemo(()=>WL(s.current.agents.values()),[s.current,s.current.revision]),Zl=_.useRef(null);_.useEffect(()=>{const F=A5({waiting:bt.length,running:Ql,connected:Ie}),B=Zl.current;if(Zl.current=F,(B==null?void 0:B.title)!==F.title&&(document.title=F.title),(B==null?void 0:B.icon)!==F.icon){const le=document.querySelector('link[rel="icon"]');le&&(le.href=M5[F.icon])}},[bt.length,Ql,Ie]);const[bd,Jl]=_.useState(""),va=O5(bt);_.useEffect(()=>{Jl(F=>P5(F,va))},[va]);const[xr,eo]=_.useState(()=>typeof Notification>"u"?"denied":Notification.permission),[Fr,hs]=_.useState(null),[kd,ec]=_.useState(!1),[Qn,to]=_.useState(!0),[tc,wa]=_.useState(!1);_.useEffect(()=>{let F=!0;return fetch("/api/prefs").then(B=>B.ok?B.json():null).then(B=>{var le;!F||!(B!=null&&B.ok)||(to(((le=B.prefs)==null?void 0:le.notifications)!==!1),wa(B.notificationsVetoed===!0))}).catch(()=>{}),()=>{F=!1}},[]);const nc=_.useCallback(()=>{const F=!Qn;to(F),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({notifications:F})}).then(B=>B.ok?B.json():null).then(B=>{var le;B!=null&&B.ok&&(to(((le=B.prefs)==null?void 0:le.notifications)!==!1),wa(B.notificationsVetoed===!0))}).catch(()=>{})},[Qn]),xa=KL(xr,typeof Notification<"u");_.useEffect(()=>{xa&&Qn&&bt.length>0&&ec(!0)},[xa,Qn,bt.length]),_.useEffect(()=>{if(!Fr)return;const B=setTimeout(()=>hs(null),Fr==="blocked"?8e3:4e3);return()=>clearTimeout(B)},[Fr]);const _d=_.useCallback(()=>{typeof Notification>"u"||Notification.requestPermission().then(F=>{const B=F;eo(B),B==="granted"?hs("on"):B==="denied"&&hs("blocked")})},[]),ri=_.useRef(new Set),ba=_.useRef(null),gn=bt.map(F=>Wu(F.id,F.waiting)).join("|");return _.useEffect(()=>{YL(ba.current,xr)&&(ba.current=xr,ri.current=r1(bt))},[xr]),_.useEffect(()=>{if(typeof Notification>"u"||Notification.permission!=="granted"||ba.current===null)return;const F=typeof document>"u"||!document.hidden,B=GL(bt,ri.current,F,Qn);for(const le of B)try{const fe=new Notification(le.title,{body:le.body,tag:le.key});fe.onclick=()=>{window.focus(),ti(le.sessionId),fe.close()}}catch{}ri.current=F?r1(bt):VL(bt,B,ri.current)},[gn]),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:Bt}),ke?d.jsxs("button",{type:"button",className:"v stale",onClick:()=>{Ce(),Sn()},"aria-haspopup":"dialog","aria-label":VB({...ke,open:St}),title:ke.kind==="restart"?`Running v${ke.from}; v${ke.to} is installed on disk. Restart to pick it up · click for what's new`:`Running v${ke.from}; v${ke.to} is on npm · click for what's new`,children:["v",ke.from,d.jsx("span",{className:"v-dot","aria-hidden":!0})]}):(()=>{const F={running:Le,latest:ue==null?void 0:ue.latest,latestPending:ue==null?void 0:ue.latestPending,checkedAgo:ue!=null&&ue.checkedAt?Xv(xt-ue.checkedAt):null,checkDisabled:ue==null?void 0:ue.checkDisabled,checking:Pe};return d.jsxs("button",{type:"button",className:Pe?"v checking":"v",onClick:()=>{Ce(),Ge(!0)},"aria-busy":Pe||void 0,"aria-haspopup":"dialog","aria-label":GB(F),title:HB(F),children:["v",F.running]})})()]}),d.jsxs("span",{className:"status",children:[(()=>{const F=t8({connected:Ie,paused:Un,held:Vt.size,dropped:Vt.dropped});return F.resting?null:d.jsx("span",{className:`pill ${F.tone}`,title:F.title,children:d.jsxs("span",{className:"pill-box",children:[d.jsx("span",{className:"pill-widest","aria-hidden":!0,children:F.widest}),d.jsx("span",{className:"pill-label",children:F.label})]})})})(),d.jsx(g4,{usageOpen:G})]}),d.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:bd}),bt.length>0&&d.jsxs("button",{type:"button",className:"waiting-stat",onClick:()=>ti(bt[0].id),title:`Blocked waiting for you — click to go to the one that has been stuck longest:
191
+ ${bt.map(F=>` ${F.label}: ${vl(F.waiting)} (${Xv(xt-F.waiting.since)})`).join(`
192
+ `)}`,"aria-label":`${bt.length} session${bt.length===1?"":"s"} waiting for you`,children:[d.jsx("span",{className:"ap-pulse","aria-hidden":!0}),d.jsx("b",{children:bt.length})," waiting"]}),kd&&xa&&Qn&&d.jsx("button",{type:"button",className:"notify-ask",onClick:_d,title:"Get a system notification when a session blocks on you, so the deck can reach you with this tab in the background",children:"notify me"}),Fr&&d.jsx("span",{className:Fr==="on"?"notify-said":"notify-said notify-said-blocked",role:"status",title:Fr==="on"?"The deck will raise a system notification when a session blocks on you and this tab is in the background":"Notifications are blocked for this page. Only your browser can undo that — its site settings for this address",children:Fr==="on"?"notifications on":"notifications blocked"})]}),en&&(()=>{const F=bn(en),B=Math.max(0,((en.endedAt??xt)-en.startedAt)/1e3),le=en.state==="active"?Rw(F.total,B):null,fe=l.size-1;return d.jsxs("button",{type:"button",className:"selected-ribbon",title:`Fit view to ${en.label}`,onClick:()=>{try{const _e=jn.find(Re=>Re.id===en.id);_e&&e.fitView({padding:.35,duration:500,nodes:[_e]}),Kn.current=Date.now()}catch{}},children:[d.jsx("span",{className:`state-pill state-${en.state}`,children:en.state==="active"?"live":en.state}),d.jsx("span",{className:"selected-label",children:en.label}),F.total>0&&d.jsxs("span",{className:"selected-cost",children:[Je(F.total),le?d.jsxs("span",{className:"selected-rate",children:[" · ",le]}):null]}),fe>0&&d.jsxs("span",{className:"selected-extra",children:["+",fe]}),d.jsx("span",{"aria-hidden":!0,className:"selected-close",onClick:_e=>{_e.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(F=>!F),title:`${G?"Hide":"Show"} usage panel (U)`,"aria-label":"Toggle usage panel","aria-expanded":G,"aria-controls":G?"usage-panel":void 0,children:"$"}),rt.claude&&d.jsx("button",{className:"btn icon-btn",onClick:fr,title:`${R?"Hide":"Show"} accounts (A)`,"aria-label":"Toggle accounts panel","aria-expanded":R,"aria-controls":R?"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(F=>!F),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${Bn>0?" has-findings":Mr?" watching":""}`,onClick:()=>Mo(F=>!F),title:Mr?"Browser watch — watching; the deck is keeping its own copy":"Browser watch — not watching; reading the browser's history live","aria-label":`Browser watch, ${Mr?"watching":"not watching"}`+(Bn>0?`, ${Bn} 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"}),Mr||Bn>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"})]}),Bn>0&&d.jsx("span",{className:"bw-badge","aria-hidden":!0,children:Bn})]})]}),d.jsxs("div",{className:"action-run",children:[rt.claude&&H!==null&&d.jsxs("div",{className:"sound-slot",children:[d.jsx("button",{ref:xe,className:"btn icon-btn",onClick:()=>me(F=>!F),...ir(!1),title:B5(rt,{on:H===!0,locked:He==="locked",prefs:V}),"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"}),H?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(XD,{onClose:()=>me(!1),soundOn:H===!0,onToggleSound:X,prefs:V,onLevel:(F,B)=>se(F,{level:B}),onFigure:(F,B)=>se(F,{figure:B}),onPreview:F=>K(F),notifyOn:Qn,onToggleNotify:nc,notifyVetoed:tc,openerRef:xe})]}),d.jsx("button",{className:"btn icon-btn",onClick:()=>oa(F=>F==="dark"?"light":"dark"),title:`Switch to ${Or==="dark"?"light":"dark"} mode (T)`,"aria-label":"Toggle theme",children:Or==="dark"?"☀":"☾"})]})]})]}),os?d.jsxs("div",{className:"ver-banner done",role:"status",children:[d.jsx("span",{className:"ver-dot"}),d.jsxs("strong",{children:["Restarted — now running v",os,"."]}),d.jsx("span",{className:"ver-sub",children:"The canvas replayed from the event log."})]}):Gn&&!Ie?d.jsxs("div",{className:"conn-banner",role:"alert",children:[d.jsx("span",{className:"conn-dot"}),Ir?Bo==="npx"?"Fetching the new version with npx — this can take a minute…":`Restarting ${Bt}…`:(()=>{const F=JB({connected:Ie,paused:Un});return d.jsxs(d.Fragment,{children:[`Lost connection to the ${Bt} server. Reconnecting…`,F&&d.jsx("span",{className:"conn-sub",children:F})]})})()]}):St&&ke?d.jsxs("div",{className:`ver-banner ${ke.kind}`,role:"status",children:[d.jsx("span",{className:"ver-dot"}),ke.kind==="restart"?d.jsxs(d.Fragment,{children:[d.jsxs("strong",{children:["v",ke.to," is installed — this deck still runs v",ke.from,"."]}),ue!=null&&ue.canRestart?d.jsxs(d.Fragment,{children:[d.jsx("button",{type:"button",className:"ver-act",onClick:()=>Us(),...ir(Ir),title:"Stop this process and bring it back on the same port. The canvas replays from the event log.",children:Ir?"restarting…":"Restart now"}),d.jsxs("button",{type:"button",className:`ver-auto${Wn?" on":""}`,role:"switch","aria-checked":Wn,onClick:dd,title:Wn?"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:[Bt," v",ke.to," is out — you are on v",ke.from,"."]}),(ue==null?void 0:ue.upgradeMode)==="install"&&Ut!=="failed"&&d.jsx("button",{type:"button",className:"ver-act",onClick:Ds,...ir(Ut==="running",Ut==="done"),title:`Runs ${((ka=ue==null?void 0:ue.upgrade)==null?void 0:ka.command)??(ue==null?void 0:ue.command)??"npm i -g"} here, then restarts once nothing is running.`,children:Ut==="running"?"installing…":Ut==="done"?"installed":"Update now"}),(ue==null?void 0:ue.upgradeMode)==="npx"&&(ue==null?void 0:ue.canRestart)&&d.jsx("button",{type:"button",className:"ver-act",onClick:()=>Us({upgrade:!0}),...ir(Ir),title:`Runs ${ue==null?void 0:ue.command} and hands it this port. Nothing is installed globally — npx unpacks its own copy.`,children:Ir?"fetching…":Ut==="failed"?"Retry update":"Update & restart"}),Ut==="failed"?d.jsxs("span",{className:"ver-sub fail",title:((_a=ue==null?void 0:ue.upgrade)==null?void 0:_a.error)??"",children:[(ue==null?void 0:ue.upgradeMode)==="npx"?"update failed":"install failed",": ",((Sa=ue==null?void 0:ue.upgrade)==null?void 0:Sa.error)??"unknown error"," — run it yourself:"]}):(ue==null?void 0:ue.upgradeMode)==="npx"?d.jsx("span",{className:"ver-sub",children:ue!=null&&ue.canRestart?"npx cannot upgrade in place, so the deck re-runs:":Ev.npx}):ue!=null&&ue.upgradeBlocked?d.jsx("span",{className:"ver-sub",children:Object.hasOwn(Ev,ue.upgradeBlocked)?Ev[ue.upgradeBlocked]:"cannot install from here"}):null,d.jsxs("button",{type:"button",className:"ver-cmd",onClick:Rr,title:"Copy to clipboard",children:[d.jsx("code",{children:ue==null?void 0:ue.command}),d.jsx("span",{className:"ver-cmd-hint",children:nt?"copied":"copy"})]})]}),d.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:Fn,children:"×"})]}):Ro&&hn?d.jsxs("div",{className:"ver-banner",role:"status",children:[d.jsx("span",{className:"ver-dot"}),d.jsxs("strong",{children:[hn," still works — the deck is called ",Bt," now."]}),ue!=null&&ue.renameFix?d.jsx("span",{className:"ver-sub",children:ue.renameFix}):null,d.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:Ao,children:"×"})]}):null,G&&d.jsx(Uq,{state:s.current,now:xt,providers:rt,onClose:()=>Y(!1)}),R&&rt.claude&&d.jsx(vD,{onClose:()=>Q(!1)}),z&&d.jsx(wq,{state:s.current,now:xt,selectedIds:l,onSelect:ti,onClose:()=>M(!1)}),d.jsxs("main",{id:"canvas",tabIndex:-1,className:`canvas-wrap${md?" bubbling":""}${ha?" dragging-any":""}`,ref:Xs,onMouseDownCapture:fd,onPointerDownCapture:gr,onPointerUpCapture:gr,onWheelCapture:gr,children:[ni===0&&d.jsx(N8,{live:Ie,everConnected:Gn,providers:rt}),Zs.length>1&&d.jsx("div",{ref:zs,className:`cat-filter-bar${qo?" occluded":""}`,role:"group","aria-label":"Filter tools by category",children:Zs.map(F=>{const B=sa.has(F);return d.jsxs("button",{type:"button",className:`cat-filter${B?" off":""}`,onClick:()=>xd(F),"aria-pressed":!B,title:`${B?"Show":"Hide"} ${aw[F]} tools`,children:[d.jsx("span",{className:"cat-emoji",children:iw[F]}),d.jsx("span",{className:"cat-name",children:aw[F]})]},F)})}),d.jsxs(Xj,{nodes:wd,edges:vd,nodeTypes:n8,fitView:!Qe,fitViewOptions:{padding:.25,duration:_v({durationMs:NC,documentHidden:document.hidden})?NC:0},minZoom:.2,maxZoom:1.6,panOnScroll:!0,nodesDraggable:!0,nodesConnectable:!1,selectionOnDrag:!1,nodeDragThreshold:5,onNodeClick:(F,B)=>{if(B.type==="sessionGroup"){w();return}v(B.id,F.shiftKey)},onPaneClick:()=>w(),onMoveStart:F=>{bC(Hs(F))&&Qo()},onMove:(F,B)=>{Ko(),bC(Hs(F))&&Qo(),cs.current&&window.clearTimeout(cs.current),cs.current=window.setTimeout(()=>x8(B),250)},onNodeDragStart:(F,B)=>{var le;if(gd(),Vs.current=!0,at.current=new Map,pa(!0),Ko(),Qo(),B.type==="sessionGroup"){const fe=(le=B.data)==null?void 0:le.sessionId,_e=new Map;if(fe)for(const Re of jn){const Be=Re.data;(Be==null?void 0:Be.sessionId)===fe&&_e.set(Re.id,{x:Re.position.x,y:Re.position.y})}ls.current={start:{x:B.position.x,y:B.position.y},members:_e};return}Zt.current.set(B.id,{x:B.position.x,y:B.position.y})},onNodeDrag:(F,B)=>{var le;if(Ko(),B.type==="sessionGroup"){const fe=ls.current;if(!fe)return;const _e=B.position.x-fe.start.x,Re=B.position.y-fe.start.y;for(const[Ze,ht]of fe.members){const ot={x:ht.x+_e,y:ht.y+Re};Zt.current.set(Ze,ot),Ot.current.set(Ze,ot)}const Be=at.current;if(Be){for(const[Ze,ht]of fe.members)Be.set(Ze,{x:ht.x+_e,y:ht.y+Re});Be.set(B.id,{x:B.position.x,y:B.position.y})}rs(Ze=>Ze+1);return}Zt.current.set(B.id,{x:B.position.x,y:B.position.y}),Ot.current.set(B.id,{x:B.position.x,y:B.position.y}),(le=at.current)==null||le.set(B.id,{x:B.position.x,y:B.position.y}),rs(fe=>fe+1)},onNodeDragStop:(F,B)=>{if(Ko(),Vs.current=!1,at.current=null,pa(!1),Fs(le=>le+1),B.type==="sessionGroup"){const le=ls.current;if(le){const fe=B.position.x-le.start.x,_e=B.position.y-le.start.y;for(const[Re,Be]of le.members){const Ze={x:Be.x+fe,y:Be.y+_e};Zt.current.set(Re,Ze),Ot.current.set(Re,Ze)}}ls.current=null,Cv(Ot.current,Zt.current),Fs(fe=>fe+1);return}Zt.current.set(B.id,{x:B.position.x,y:B.position.y}),Ot.current.set(B.id,{x:B.position.x,y:B.position.y}),Cv(Ot.current,Zt.current)},children:[d.jsx(nL,{gap:28,size:1,color:Hn["--grid-line"]}),d.jsx(R3,{}),d.jsx(dq,{agents:s.current.agents,visibleAgentIds:qr,positions:Ot.current,pinned:Zt.current,measured:Xn.current,spotlight:Ks,hiddenCategories:sa,now:xt,onOpenTool:g}),d.jsxs(X$,{showInteractive:!1,children:[d.jsx(Nr,{onClick:vr,title:Gs?"Recenter view + re-enable autofit":"Recenter view (autofit already on)","aria-label":"Recenter view",style:Gs?{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(Nr,{onClick:ss,title:ZB({paused:Un,held:Vt.size,dropped:Vt.dropped}),"aria-label":QB,"aria-pressed":Un,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(Nr,{onClick:Dr,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(Nr,{onClick:()=>fs("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(Nr,{onClick:()=>O(F=>!F),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(U$,{zoomable:!0,pannable:!0,nodeColor:Vo,nodeStrokeWidth:2,maskColor:Hn["--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:"×"}),en?d.jsx(j8,{agent:en,now:xt,onOpenTool:g,onShowSummary:F=>{P.has(F)&&(P.delete(F),RC(P)),b(F)},onExportSession:F=>b8(s.current,F)}):d.jsx(C8,{count:ni,workspace:Ve})]}):d.jsx("button",{type:"button",className:"detail-reopen",title:"Show detail panel","aria-label":"Show detail panel",onClick:()=>q(!0),children:"‹"}),ma&&d.jsx(b3,{tool:ma,onClose:()=>g(null)}),Ar&&d.jsx(V5,{providers:rt,onClose:()=>hr(!1)}),ns&&d.jsx(oF,{onClose:()=>Mo(!1),onSeen:F=>{Oo(F);try{localStorage.setItem(K1,String(F))}catch{}},onWatching:$o,palette:Hn}),k&&(()=>{const F=s.current.agents.get(k);return F?d.jsx(h3,{agent:F,onClose:()=>S(null)}):null})(),N&&d.jsx(gq,{state:s.current,sessionId:N,onClose:()=>{P.add(N),RC(P),b(null)}}),ct&&d.jsx(u5,{entries:ct.entries,since:ct.since,firstRun:ct.firstRun,running:Le,onClose:()=>It(null)}),I&&d.jsx(MD,{onClose:()=>O(!1)}),C&&d.jsx(TD,{agentCount:ni,onConfirm:()=>fs("confirmation"),onCancel:()=>j(!1)})]})}function N8({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:Bt})," 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:Bt})," is running."]}),z5(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 C8({count:e,workspace:t}){const n=YB(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 j8({agent:e,now:t,onOpenTool:n,onShowSummary:s,onExportSession:i}){const a=Ru(e.startedAt,e.endedAt,t),l=bn(e),u=l.total>0,h=e.usage.inputTokens+e.usage.outputTokens,p=new Map;for(const N of e.tools){const b=nA(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,v=Array.from(p.entries()).sort((N,b)=>b[1]-N[1]),w=p.has("mcp")?iq(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=dT(e);return d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"hero-sep",children:"·"}),d.jsxs("span",{className:"model-chip","data-family":Uu(e.model),title:N.length>0?`${e.model}
189
193
  spend on this panel also covers:
190
194
  ${N.join(`
191
- `)}`:e.model,children:[$s(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:Ze(l.total)}),d.jsx("span",{className:"hero-cost-label",children:"spend"})]}),d.jsx(Mw,{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:v.map(([N,b])=>{const k=N==="mcp"?w:null,S=k==null?void 0:k.hue,E=`${b} ${ow[N]} call${b===1?"":"s"}`;return d.jsxs("span",{className:`cat-chip cat-${N}${S!=null?" mcp-hue":""}`,style:S!=null?{"--mcp-hue":S}:void 0,title:k?`${E}, all to ${k.label}`:E,children:[d.jsx("span",{className:"cat-emoji",children:sw[N]}),d.jsx("span",{className:"cat-count",children:b}),k&&d.jsx("span",{className:"cat-server",children:k.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 k=Aq(N.at,t);return d.jsxs("div",{className:"prompt-entry",children:[d.jsx("div",{className:"prompt-time",title:k.title,children:k.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(R8,{t:N,onClick:()=>n(N.id)},N.id))})]})]})}const T8={inflight:"in-flight",done:"done",err:"error"};function R8({t:e,onClick:t}){const n=e.endedAt==null?"inflight":e.ok===!1?"err":"done",s=hT(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:T8[n]}),e.name]}),d.jsx("span",{style:{color:"var(--muted)"},children:s})]})}try{Gq(window.localStorage)}catch{}const A8=t2.createRoot(document.getElementById("root"));A8.render(d.jsx(_8,{}));
195
+ `)}`:e.model,children:[Ls(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:Je(l.total)}),d.jsx("span",{className:"hero-cost-label",children:"spend"})]}),d.jsx(Ow,{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:v.map(([N,b])=>{const k=N==="mcp"?w:null,S=k==null?void 0:k.hue,E=`${b} ${aw[N]} call${b===1?"":"s"}`;return d.jsxs("span",{className:`cat-chip cat-${N}${S!=null?" mcp-hue":""}`,style:S!=null?{"--mcp-hue":S}:void 0,title:k?`${E}, all to ${k.label}`:E,children:[d.jsx("span",{className:"cat-emoji",children:iw[N]}),d.jsx("span",{className:"cat-count",children:b}),k&&d.jsx("span",{className:"cat-server",children:k.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 k=Aq(N.at,t);return d.jsxs("div",{className:"prompt-entry",children:[d.jsx("div",{className:"prompt-time",title:k.title,children:k.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(R8,{t:N,onClick:()=>n(N.id)},N.id))})]})]})}const T8={inflight:"in-flight",done:"done",err:"error"};function R8({t:e,onClick:t}){const n=e.endedAt==null?"inflight":e.ok===!1?"err":"done",s=hT(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:T8[n]}),e.name]}),d.jsx("span",{style:{color:"var(--muted)"},children:s})]})}try{Gq(window.localStorage)}catch{}const A8=t2.createRoot(document.getElementById("root"));A8.render(d.jsx(_8,{}));