agent-dag 3.4.0 → 3.6.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.
@@ -0,0 +1,176 @@
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 $c=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Zy(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var jf={exports:{}},qa={},Tf={exports:{}},Qe={};/**
2
+ * @license React
3
+ * react.production.min.js
4
+ *
5
+ * Copyright (c) Facebook, Inc. and its affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var Hx;function BA(){if(Hx)return Qe;Hx=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),l=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),g=Symbol.iterator;function y($){return $===null||typeof $!="object"?null:($=g&&$[g]||$["@@iterator"],typeof $=="function"?$:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,b={};function _($,G,Z){this.props=$,this.context=G,this.refs=b,this.updater=Z||w}_.prototype.isReactComponent={},_.prototype.setState=function($,G){if(typeof $!="object"&&typeof $!="function"&&$!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,$,G,"setState")},_.prototype.forceUpdate=function($){this.updater.enqueueForceUpdate(this,$,"forceUpdate")};function k(){}k.prototype=_.prototype;function E($,G,Z){this.props=$,this.context=G,this.refs=b,this.updater=Z||w}var C=E.prototype=new k;C.constructor=E,S(C,_.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 F($,G,Z){var D,L={},Y=null,re=null;if(G!=null)for(D in G.ref!==void 0&&(re=G.ref),G.key!==void 0&&(Y=""+G.key),G)I.call(G,D)&&!P.hasOwnProperty(D)&&(L[D]=G[D]);var he=arguments.length-2;if(he===1)L.children=Z;else if(1<he){for(var pe=Array(he),we=0;we<he;we++)pe[we]=arguments[we+2];L.children=pe}if($&&$.defaultProps)for(D in he=$.defaultProps,he)L[D]===void 0&&(L[D]=he[D]);return{$$typeof:e,type:$,key:Y,ref:re,props:L,_owner:O.current}}function M($,G){return{$$typeof:e,type:$.type,key:G,ref:$.ref,props:$.props,_owner:$._owner}}function A($){return typeof $=="object"&&$!==null&&$.$$typeof===e}function q($){var G={"=":"=0",":":"=2"};return"$"+$.replace(/[=:]/g,function(Z){return G[Z]})}var W=/\/+/g;function V($,G){return typeof $=="object"&&$!==null&&$.key!=null?q(""+$.key):G.toString(36)}function T($,G,Z,D,L){var Y=typeof $;(Y==="undefined"||Y==="boolean")&&($=null);var re=!1;if($===null)re=!0;else switch(Y){case"string":case"number":re=!0;break;case"object":switch($.$$typeof){case e:case t:re=!0}}if(re)return re=$,L=L(re),$=D===""?"."+V(re,0):D,j(L)?(Z="",$!=null&&(Z=$.replace(W,"$&/")+"/"),T(L,G,Z,"",function(we){return we})):L!=null&&(A(L)&&(L=M(L,Z+(!L.key||re&&re.key===L.key?"":(""+L.key).replace(W,"$&/")+"/")+$)),G.push(L)),1;if(re=0,D=D===""?".":D+":",j($))for(var he=0;he<$.length;he++){Y=$[he];var pe=D+V(Y,he);re+=T(Y,G,Z,pe,L)}else if(pe=y($),typeof pe=="function")for($=pe.call($),he=0;!(Y=$.next()).done;)Y=Y.value,pe=D+V(Y,he++),re+=T(Y,G,Z,pe,L);else if(Y==="object")throw G=String($),Error("Objects are not valid as a React child (found: "+(G==="[object Object]"?"object with keys {"+Object.keys($).join(", ")+"}":G)+"). If you meant to render a collection of children, use an array instead.");return re}function Q($,G,Z){if($==null)return $;var D=[],L=0;return T($,D,"","",function(Y){return G.call(Z,Y,L++)}),D}function U($){if($._status===-1){var G=$._result;G=G(),G.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=G)}if($._status===1)return $._result.default;throw $._result}var ne={current:null},X={transition:null},H={ReactCurrentDispatcher:ne,ReactCurrentBatchConfig:X,ReactCurrentOwner:O};function J(){throw Error("act(...) is not supported in production builds of React.")}return Qe.Children={map:Q,forEach:function($,G,Z){Q($,function(){G.apply(this,arguments)},Z)},count:function($){var G=0;return Q($,function(){G++}),G},toArray:function($){return Q($,function(G){return G})||[]},only:function($){if(!A($))throw Error("React.Children.only expected to receive a single React element child.");return $}},Qe.Component=_,Qe.Fragment=n,Qe.Profiler=i,Qe.PureComponent=E,Qe.StrictMode=s,Qe.Suspense=h,Qe.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=H,Qe.act=J,Qe.cloneElement=function($,G,Z){if($==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+$+".");var D=S({},$.props),L=$.key,Y=$.ref,re=$._owner;if(G!=null){if(G.ref!==void 0&&(Y=G.ref,re=O.current),G.key!==void 0&&(L=""+G.key),$.type&&$.type.defaultProps)var he=$.type.defaultProps;for(pe in G)I.call(G,pe)&&!P.hasOwnProperty(pe)&&(D[pe]=G[pe]===void 0&&he!==void 0?he[pe]:G[pe])}var pe=arguments.length-2;if(pe===1)D.children=Z;else if(1<pe){he=Array(pe);for(var we=0;we<pe;we++)he[we]=arguments[we+2];D.children=he}return{$$typeof:e,type:$.type,key:L,ref:Y,props:D,_owner:re}},Qe.createContext=function($){return $={$$typeof:l,_currentValue:$,_currentValue2:$,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},$.Provider={$$typeof:a,_context:$},$.Consumer=$},Qe.createElement=F,Qe.createFactory=function($){var G=F.bind(null,$);return G.type=$,G},Qe.createRef=function(){return{current:null}},Qe.forwardRef=function($){return{$$typeof:u,render:$}},Qe.isValidElement=A,Qe.lazy=function($){return{$$typeof:f,_payload:{_status:-1,_result:$},_init:U}},Qe.memo=function($,G){return{$$typeof:p,type:$,compare:G===void 0?null:G}},Qe.startTransition=function($){var G=X.transition;X.transition={};try{$()}finally{X.transition=G}},Qe.unstable_act=J,Qe.useCallback=function($,G){return ne.current.useCallback($,G)},Qe.useContext=function($){return ne.current.useContext($)},Qe.useDebugValue=function(){},Qe.useDeferredValue=function($){return ne.current.useDeferredValue($)},Qe.useEffect=function($,G){return ne.current.useEffect($,G)},Qe.useId=function(){return ne.current.useId()},Qe.useImperativeHandle=function($,G,Z){return ne.current.useImperativeHandle($,G,Z)},Qe.useInsertionEffect=function($,G){return ne.current.useInsertionEffect($,G)},Qe.useLayoutEffect=function($,G){return ne.current.useLayoutEffect($,G)},Qe.useMemo=function($,G){return ne.current.useMemo($,G)},Qe.useReducer=function($,G,Z){return ne.current.useReducer($,G,Z)},Qe.useRef=function($){return ne.current.useRef($)},Qe.useState=function($){return ne.current.useState($)},Qe.useSyncExternalStore=function($,G,Z){return ne.current.useSyncExternalStore($,G,Z)},Qe.useTransition=function(){return ne.current.useTransition()},Qe.version="18.3.1",Qe}var Gx;function hl(){return Gx||(Gx=1,Tf.exports=BA()),Tf.exports}/**
10
+ * @license React
11
+ * react-jsx-runtime.production.min.js
12
+ *
13
+ * Copyright (c) Facebook, Inc. and its affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var Vx;function UA(){if(Vx)return qa;Vx=1;var e=hl(),t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,i=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a={key:!0,ref:!0,__self:!0,__source:!0};function l(u,h,p){var f,g={},y=null,w=null;p!==void 0&&(y=""+p),h.key!==void 0&&(y=""+h.key),h.ref!==void 0&&(w=h.ref);for(f in h)s.call(h,f)&&!a.hasOwnProperty(f)&&(g[f]=h[f]);if(u&&u.defaultProps)for(f in h=u.defaultProps,h)g[f]===void 0&&(g[f]=h[f]);return{$$typeof:t,type:u,key:y,ref:w,props:g,_owner:i.current}}return qa.Fragment=n,qa.jsx=l,qa.jsxs=l,qa}var Yx;function WA(){return Yx||(Yx=1,jf.exports=UA()),jf.exports}var d=WA(),Lc={},Rf={exports:{}},dn={},Af={exports:{}},Mf={};/**
18
+ * @license React
19
+ * scheduler.production.min.js
20
+ *
21
+ * Copyright (c) Facebook, Inc. and its affiliates.
22
+ *
23
+ * This source code is licensed under the MIT license found in the
24
+ * LICENSE file in the root directory of this source tree.
25
+ */var Kx;function HA(){return Kx||(Kx=1,(function(e){function t(X,H){var J=X.length;X.push(H);e:for(;0<J;){var $=J-1>>>1,G=X[$];if(0<i(G,H))X[$]=H,X[J]=G,J=$;else break e}}function n(X){return X.length===0?null:X[0]}function s(X){if(X.length===0)return null;var H=X[0],J=X.pop();if(J!==H){X[0]=J;e:for(var $=0,G=X.length,Z=G>>>1;$<Z;){var D=2*($+1)-1,L=X[D],Y=D+1,re=X[Y];if(0>i(L,J))Y<G&&0>i(re,L)?(X[$]=re,X[Y]=J,$=Y):(X[$]=L,X[D]=J,$=D);else if(Y<G&&0>i(re,J))X[$]=re,X[Y]=J,$=Y;else break e}}return H}function i(X,H){var J=X.sortIndex-H.sortIndex;return J!==0?J:X.id-H.id}if(typeof performance=="object"&&typeof performance.now=="function"){var a=performance;e.unstable_now=function(){return a.now()}}else{var l=Date,u=l.now();e.unstable_now=function(){return l.now()-u}}var h=[],p=[],f=1,g=null,y=3,w=!1,S=!1,b=!1,_=typeof setTimeout=="function"?setTimeout:null,k=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function C(X){for(var H=n(p);H!==null;){if(H.callback===null)s(p);else if(H.startTime<=X)s(p),H.sortIndex=H.expirationTime,t(h,H);else break;H=n(p)}}function j(X){if(b=!1,C(X),!S)if(n(h)!==null)S=!0,U(I);else{var H=n(p);H!==null&&ne(j,H.startTime-X)}}function I(X,H){S=!1,b&&(b=!1,k(F),F=-1),w=!0;var J=y;try{for(C(H),g=n(h);g!==null&&(!(g.expirationTime>H)||X&&!q());){var $=g.callback;if(typeof $=="function"){g.callback=null,y=g.priorityLevel;var G=$(g.expirationTime<=H);H=e.unstable_now(),typeof G=="function"?g.callback=G:g===n(h)&&s(h),C(H)}else s(h);g=n(h)}if(g!==null)var Z=!0;else{var D=n(p);D!==null&&ne(j,D.startTime-H),Z=!1}return Z}finally{g=null,y=J,w=!1}}var O=!1,P=null,F=-1,M=5,A=-1;function q(){return!(e.unstable_now()-A<M)}function W(){if(P!==null){var X=e.unstable_now();A=X;var H=!0;try{H=P(!0,X)}finally{H?V():(O=!1,P=null)}}else O=!1}var V;if(typeof E=="function")V=function(){E(W)};else if(typeof MessageChannel<"u"){var T=new MessageChannel,Q=T.port2;T.port1.onmessage=W,V=function(){Q.postMessage(null)}}else V=function(){_(W,0)};function U(X){P=X,O||(O=!0,V())}function ne(X,H){F=_(function(){X(e.unstable_now())},H)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(X){X.callback=null},e.unstable_continueExecution=function(){S||w||(S=!0,U(I))},e.unstable_forceFrameRate=function(X){0>X||125<X?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):M=0<X?Math.floor(1e3/X):5},e.unstable_getCurrentPriorityLevel=function(){return y},e.unstable_getFirstCallbackNode=function(){return n(h)},e.unstable_next=function(X){switch(y){case 1:case 2:case 3:var H=3;break;default:H=y}var J=y;y=H;try{return X()}finally{y=J}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(X,H){switch(X){case 1:case 2:case 3:case 4:case 5:break;default:X=3}var J=y;y=X;try{return H()}finally{y=J}},e.unstable_scheduleCallback=function(X,H,J){var $=e.unstable_now();switch(typeof J=="object"&&J!==null?(J=J.delay,J=typeof J=="number"&&0<J?$+J:$):J=$,X){case 1:var G=-1;break;case 2:G=250;break;case 5:G=1073741823;break;case 4:G=1e4;break;default:G=5e3}return G=J+G,X={id:f++,callback:H,priorityLevel:X,startTime:J,expirationTime:G,sortIndex:-1},J>$?(X.sortIndex=J,t(p,X),n(h)===null&&X===n(p)&&(b?(k(F),F=-1):b=!0,ne(j,J-$))):(X.sortIndex=G,t(h,X),S||w||(S=!0,U(I))),X},e.unstable_shouldYield=q,e.unstable_wrapCallback=function(X){var H=y;return function(){var J=y;y=H;try{return X.apply(this,arguments)}finally{y=J}}}})(Mf)),Mf}var Xx;function GA(){return Xx||(Xx=1,Af.exports=HA()),Af.exports}/**
26
+ * @license React
27
+ * react-dom.production.min.js
28
+ *
29
+ * Copyright (c) Facebook, Inc. and its affiliates.
30
+ *
31
+ * This source code is licensed under the MIT license found in the
32
+ * LICENSE file in the root directory of this source tree.
33
+ */var Qx;function VA(){if(Qx)return dn;Qx=1;var e=hl(),t=GA();function n(r){for(var o="https://reactjs.org/docs/error-decoder.html?invariant="+r,c=1;c<arguments.length;c++)o+="&args[]="+encodeURIComponent(arguments[c]);return"Minified React error #"+r+"; visit "+o+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var s=new Set,i={};function a(r,o){l(r,o),l(r+"Capture",o)}function l(r,o){for(i[r]=o,r=0;r<o.length;r++)s.add(o[r])}var u=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),h=Object.prototype.hasOwnProperty,p=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,f={},g={};function y(r){return h.call(g,r)?!0:h.call(f,r)?!1:p.test(r)?g[r]=!0:(f[r]=!0,!1)}function w(r,o,c,m){if(c!==null&&c.type===0)return!1;switch(typeof o){case"function":case"symbol":return!0;case"boolean":return m?!1:c!==null?!c.acceptsBooleans:(r=r.toLowerCase().slice(0,5),r!=="data-"&&r!=="aria-");default:return!1}}function S(r,o,c,m){if(o===null||typeof o>"u"||w(r,o,c,m))return!0;if(m)return!1;if(c!==null)switch(c.type){case 3:return!o;case 4:return o===!1;case 5:return isNaN(o);case 6:return isNaN(o)||1>o}return!1}function b(r,o,c,m,v,x,R){this.acceptsBooleans=o===2||o===3||o===4,this.attributeName=m,this.attributeNamespace=v,this.mustUseProperty=c,this.propertyName=r,this.type=o,this.sanitizeURL=x,this.removeEmptyString=R}var _={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(r){_[r]=new b(r,0,!1,r,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(r){var o=r[0];_[o]=new b(o,1,!1,r[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(r){_[r]=new b(r,2,!1,r.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(r){_[r]=new b(r,2,!1,r,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(r){_[r]=new b(r,3,!1,r.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(r){_[r]=new b(r,3,!0,r,null,!1,!1)}),["capture","download"].forEach(function(r){_[r]=new b(r,4,!1,r,null,!1,!1)}),["cols","rows","size","span"].forEach(function(r){_[r]=new b(r,6,!1,r,null,!1,!1)}),["rowSpan","start"].forEach(function(r){_[r]=new b(r,5,!1,r.toLowerCase(),null,!1,!1)});var k=/[\-:]([a-z])/g;function E(r){return r[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(r){var o=r.replace(k,E);_[o]=new b(o,1,!1,r,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(r){var o=r.replace(k,E);_[o]=new b(o,1,!1,r,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(r){var o=r.replace(k,E);_[o]=new b(o,1,!1,r,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(r){_[r]=new b(r,1,!1,r.toLowerCase(),null,!1,!1)}),_.xlinkHref=new b("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(r){_[r]=new b(r,1,!1,r.toLowerCase(),null,!0,!0)});function C(r,o,c,m){var v=_.hasOwnProperty(o)?_[o]:null;(v!==null?v.type!==0:m||!(2<o.length)||o[0]!=="o"&&o[0]!=="O"||o[1]!=="n"&&o[1]!=="N")&&(S(o,c,v,m)&&(c=null),m||v===null?y(o)&&(c===null?r.removeAttribute(o):r.setAttribute(o,""+c)):v.mustUseProperty?r[v.propertyName]=c===null?v.type===3?!1:"":c:(o=v.attributeName,m=v.attributeNamespace,c===null?r.removeAttribute(o):(v=v.type,c=v===3||v===4&&c===!0?"":""+c,m?r.setAttributeNS(m,o,c):r.setAttribute(o,c))))}var 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"),F=Symbol.for("react.strict_mode"),M=Symbol.for("react.profiler"),A=Symbol.for("react.provider"),q=Symbol.for("react.context"),W=Symbol.for("react.forward_ref"),V=Symbol.for("react.suspense"),T=Symbol.for("react.suspense_list"),Q=Symbol.for("react.memo"),U=Symbol.for("react.lazy"),ne=Symbol.for("react.offscreen"),X=Symbol.iterator;function H(r){return r===null||typeof r!="object"?null:(r=X&&r[X]||r["@@iterator"],typeof r=="function"?r:null)}var J=Object.assign,$;function G(r){if($===void 0)try{throw Error()}catch(c){var o=c.stack.trim().match(/\n( *(at )?)/);$=o&&o[1]||""}return`
34
+ `+$+r}var 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(ae){var m=ae}Reflect.construct(r,[],o)}else{try{o.call()}catch(ae){m=ae}r.call(o.prototype)}else{try{throw Error()}catch(ae){m=ae}r()}}catch(ae){if(ae&&m&&typeof ae.stack=="string"){for(var v=ae.stack.split(`
35
+ `),x=m.stack.split(`
36
+ `),R=v.length-1,B=x.length-1;1<=R&&0<=B&&v[R]!==x[B];)B--;for(;1<=R&&0<=B;R--,B--)if(v[R]!==x[B]){if(R!==1||B!==1)do if(R--,B--,0>B||v[R]!==x[B]){var ee=`
37
+ `+v[R].replace(" at new "," at ");return r.displayName&&ee.includes("<anonymous>")&&(ee=ee.replace("<anonymous>",r.displayName)),ee}while(1<=R&&0<=B);break}}}finally{Z=!1,Error.prepareStackTrace=c}return(r=r?r.displayName||r.name:"")?G(r):""}function L(r){switch(r.tag){case 5:return G(r.type);case 16:return G("Lazy");case 13:return G("Suspense");case 19:return G("SuspenseList");case 0:case 2:case 15:return r=D(r.type,!1),r;case 11:return r=D(r.type.render,!1),r;case 1:return r=D(r.type,!0),r;default:return""}}function Y(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 F:return"StrictMode";case V:return"Suspense";case T:return"SuspenseList"}if(typeof r=="object")switch(r.$$typeof){case q:return(r.displayName||"Context")+".Consumer";case A:return(r._context.displayName||"Context")+".Provider";case W:var o=r.render;return r=r.displayName,r||(r=o.displayName||o.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case Q:return o=r.displayName||null,o!==null?o:Y(r.type)||"Memo";case U:o=r._payload,r=r._init;try{return Y(r(o))}catch{}}return null}function re(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 Y(o);case 8:return o===F?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o}return null}function he(r){switch(typeof r){case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function pe(r){var o=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(o==="checkbox"||o==="radio")}function we(r){var o=pe(r)?"checked":"value",c=Object.getOwnPropertyDescriptor(r.constructor.prototype,o),m=""+r[o];if(!r.hasOwnProperty(o)&&typeof c<"u"&&typeof c.get=="function"&&typeof c.set=="function"){var v=c.get,x=c.set;return Object.defineProperty(r,o,{configurable:!0,get:function(){return v.call(this)},set:function(R){m=""+R,x.call(this,R)}}),Object.defineProperty(r,o,{enumerable:c.enumerable}),{getValue:function(){return m},setValue:function(R){m=""+R},stopTracking:function(){r._valueTracker=null,delete r[o]}}}}function Ce(r){r._valueTracker||(r._valueTracker=we(r))}function Ve(r){if(!r)return!1;var o=r._valueTracker;if(!o)return!0;var c=o.getValue(),m="";return r&&(m=pe(r)?r.checked?"true":"false":r.value),r=m,r!==c?(o.setValue(r),!0):!1}function Be(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 Le(r,o){var c=o.checked;return J({},o,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:c??r._wrapperState.initialChecked})}function ke(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 ce(r,o){o=o.checked,o!=null&&C(r,"checked",o,!1)}function be(r,o){ce(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")?Ye(r,o.type,c):o.hasOwnProperty("defaultValue")&&Ye(r,o.type,he(o.defaultValue)),o.checked==null&&o.defaultChecked!=null&&(r.defaultChecked=!!o.defaultChecked)}function xe(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 Ye(r,o,c){(o!=="number"||Be(r.ownerDocument)!==r)&&(c==null?r.defaultValue=""+r._wrapperState.initialValue:r.defaultValue!==""+c&&(r.defaultValue=""+c))}var ut=Array.isArray;function at(r,o,c,m){if(r=r.options,o){o={};for(var v=0;v<c.length;v++)o["$"+c[v]]=!0;for(c=0;c<r.length;c++)v=o.hasOwnProperty("$"+r[c].value),r[c].selected!==v&&(r[c].selected=v),v&&m&&(r[c].defaultSelected=!0)}else{for(c=""+he(c),o=null,v=0;v<r.length;v++){if(r[v].value===c){r[v].selected=!0,m&&(r[v].defaultSelected=!0);return}o!==null||r[v].disabled||(o=r[v])}o!==null&&(o.selected=!0)}}function de(r,o){if(o.dangerouslySetInnerHTML!=null)throw Error(n(91));return J({},o,{value:void 0,defaultValue:void 0,children:""+r._wrapperState.initialValue})}function _e(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(ut(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 De(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 lt(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 je(r,o){return r==null||r==="http://www.w3.org/1999/xhtml"?lt(o):r==="http://www.w3.org/2000/svg"&&o==="foreignObject"?"http://www.w3.org/1999/xhtml":r}var He,Ke=(function(r){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(o,c,m,v){MSApp.execUnsafeLocalFunction(function(){return r(o,c,m,v)})}:r})(function(r,o){if(r.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in r)r.innerHTML=o;else{for(He=He||document.createElement("div"),He.innerHTML="<svg>"+o.valueOf().toString()+"</svg>",o=He.firstChild;r.firstChild;)r.removeChild(r.firstChild);for(;o.firstChild;)r.appendChild(o.firstChild)}});function oe(r,o){if(o){var c=r.firstChild;if(c&&c===r.lastChild&&c.nodeType===3){c.nodeValue=o;return}}r.textContent=o}var Ie={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},Oe=["Webkit","ms","Moz","O"];Object.keys(Ie).forEach(function(r){Oe.forEach(function(o){o=o+r.charAt(0).toUpperCase()+r.substring(1),Ie[o]=Ie[r]})});function Te(r,o,c){return o==null||typeof o=="boolean"||o===""?"":c||typeof o!="number"||o===0||Ie.hasOwnProperty(r)&&Ie[r]?(""+o).trim():o+"px"}function Xe(r,o){r=r.style;for(var c in o)if(o.hasOwnProperty(c)){var m=c.indexOf("--")===0,v=Te(c,o[c],m);c==="float"&&(c="cssFloat"),m?r.setProperty(c,v):r[c]=v}}var Et=J({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function 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 Ae(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 kt=null,Sn=null,Fn=null;function Nn(r){if(r=ka(r)){if(typeof kt!="function")throw Error(n(280));var o=r.stateNode;o&&(o=Ql(o),kt(r.stateNode,r.type,o))}}function Co(r){Sn?Fn?Fn.push(r):Fn=[r]:Sn=r}function pn(){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 jo(r,o){return r(o)}function To(){}var zt=!1;function Cr(r,o,c){if(zt)return r(o,c);zt=!0;try{return jo(r,o,c)}finally{zt=!1,(Sn!==null||Fn!==null)&&(To(),pn())}}function zn(r,o){var c=r.stateNode;if(c===null)return null;var m=Ql(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 $s=!1;if(u)try{var jr={};Object.defineProperty(jr,"passive",{get:function(){$s=!0}}),window.addEventListener("test",jr,jr),window.removeEventListener("test",jr,jr)}catch{$s=!1}function Zi(r,o,c,m,v,x,R,B,ee){var ae=Array.prototype.slice.call(arguments,3);try{o.apply(c,ae)}catch(ge){this.onError(ge)}}var dr=!1,Tr=null,fr=!1,ts=null,Ro={onError:function(r){dr=!0,Tr=r}};function Ao(r,o,c,m,v,x,R,B,ee){dr=!1,Tr=null,Zi.apply(Ro,arguments)}function Mo(r,o,c,m,v,x,R,B,ee){if(Ao.apply(this,arguments),dr){if(dr){var ae=Tr;dr=!1,Tr=null}else throw Error(n(198));fr||(fr=!0,ts=ae)}}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 Io(r){if(r.tag===13){var o=r.memoizedState;if(o===null&&(r=r.alternate,r!==null&&(o=r.memoizedState)),o!==null)return o.dehydrated}return null}function Rr(r){if(En(r)!==r)throw Error(n(188))}function Oo(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 v=c.return;if(v===null)break;var x=v.alternate;if(x===null){if(m=v.return,m!==null){c=m;continue}break}if(v.child===x.child){for(x=v.child;x;){if(x===c)return Rr(v),r;if(x===m)return Rr(v),o;x=x.sibling}throw Error(n(188))}if(c.return!==m.return)c=v,m=x;else{for(var R=!1,B=v.child;B;){if(B===c){R=!0,c=v,m=x;break}if(B===m){R=!0,m=v,c=x;break}B=B.sibling}if(!R){for(B=x.child;B;){if(B===c){R=!0,c=x,m=v;break}if(B===m){R=!0,m=x,c=v;break}B=B.sibling}if(!R)throw Error(n(189))}}if(c.alternate!==m)throw Error(n(190))}if(c.tag!==3)throw Error(n(188));return c.stateNode.current===c?r:o}function Bn(r){return r=Oo(r),r!==null?Po(r):null}function Po(r){if(r.tag===5||r.tag===6)return r;for(r=r.child;r!==null;){var o=Po(r);if(o!==null)return o;r=r.sibling}return null}var Ls=t.unstable_scheduleCallback,qs=t.unstable_cancelCallback,$o=t.unstable_shouldYield,Lo=t.unstable_requestPaint,ot=t.unstable_now,Ji=t.unstable_getCurrentPriorityLevel,ns=t.unstable_ImmediatePriority,Ht=t.unstable_UserBlockingPriority,Un=t.unstable_NormalPriority,qo=t.unstable_LowPriority,rs=t.unstable_IdlePriority,xt=null,nn=null;function Wn(r){if(nn&&typeof nn.onCommitFiberRoot=="function")try{nn.onCommitFiberRoot(xt,r,void 0,(r.current.flags&128)===128)}catch{}}var mn=Math.clz32?Math.clz32:Do,ed=Math.log,Ar=Math.LN2;function Do(r){return r>>>=0,r===0?32:31-(ed(r)/Ar|0)|0}var Fo=64,zo=4194304;function ss(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 Ds(r,o){var c=r.pendingLanes;if(c===0)return 0;var m=0,v=r.suspendedLanes,x=r.pingedLanes,R=c&268435455;if(R!==0){var B=R&~v;B!==0?m=ss(B):(x&=R,x!==0&&(m=ss(x)))}else R=c&~v,R!==0?m=ss(R):x!==0&&(m=ss(x));if(m===0)return 0;if(o!==0&&o!==m&&(o&v)===0&&(v=m&-m,x=o&-o,v>=x||v===16&&(x&4194240)!==0))return o;if((m&4)!==0&&(m|=c&16),o=r.entangledLanes,o!==0)for(r=r.entanglements,o&=m;0<o;)c=31-mn(o),v=1<<c,m|=r[c],o&=~v;return m}function os(r,o){switch(r){case 1:case 2:case 4:return o+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return o+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function jl(r,o){for(var c=r.suspendedLanes,m=r.pingedLanes,v=r.expirationTimes,x=r.pendingLanes;0<x;){var R=31-mn(x),B=1<<R,ee=v[R];ee===-1?((B&c)===0||(B&m)!==0)&&(v[R]=os(B,o)):ee<=o&&(r.expiredLanes|=B),x&=~B}}function Bo(r){return r=r.pendingLanes&-1073741825,r!==0?r:r&1073741824?1073741824:0}function Fs(){var r=Fo;return Fo<<=1,(Fo&4194240)===0&&(Fo=64),r}function Uo(r){for(var o=[],c=0;31>c;c++)o.push(r);return o}function is(r,o,c){r.pendingLanes|=o,o!==536870912&&(r.suspendedLanes=0,r.pingedLanes=0),r=r.eventTimes,o=31-mn(o),r[o]=c}function Qt(r,o){var c=r.pendingLanes&~o;r.pendingLanes=o,r.suspendedLanes=0,r.pingedLanes=0,r.expiredLanes&=o,r.mutableReadLanes&=o,r.entangledLanes&=o,o=r.entanglements;var m=r.eventTimes;for(r=r.expirationTimes;0<c;){var v=31-mn(c),x=1<<v;o[v]=0,m[v]=-1,r[v]=-1,c&=~x}}function as(r,o){var c=r.entangledLanes|=o;for(r=r.entanglements;c;){var m=31-mn(c),v=1<<m;v&o|r[m]&o&&(r[m]|=o),c&=~v}}var Je=0;function ea(r){return r&=-r,1<r?4<r?(r&268435455)!==0?16:536870912:4:1}var Tl,Mr,ta,Hn,Rl,Wo=!1,Ho=[],hr=null,Gn=null,pr=null,gn=new Map,Vn=new Map,Yn=[],na="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":hr=null;break;case"dragenter":case"dragleave":Gn=null;break;case"mouseover":case"mouseout":pr=null;break;case"pointerover":case"pointerout":gn.delete(o.pointerId);break;case"gotpointercapture":case"lostpointercapture":Vn.delete(o.pointerId)}}function zs(r,o,c,m,v,x){return r===null||r.nativeEvent!==x?(r={blockedOn:o,domEventName:c,eventSystemFlags:m,nativeEvent:x,targetContainers:[v]},o!==null&&(o=ka(o),o!==null&&Mr(o)),r):(r.eventSystemFlags|=m,o=r.targetContainers,v!==null&&o.indexOf(v)===-1&&o.push(v),r)}function Cn(r,o,c,m,v){switch(o){case"focusin":return hr=zs(hr,r,o,c,m,v),!0;case"dragenter":return Gn=zs(Gn,r,o,c,m,v),!0;case"mouseover":return pr=zs(pr,r,o,c,m,v),!0;case"pointerover":var x=v.pointerId;return gn.set(x,zs(gn.get(x)||null,r,o,c,m,v)),!0;case"gotpointercapture":return x=v.pointerId,Vn.set(x,zs(Vn.get(x)||null,r,o,c,m,v)),!0}return!1}function Go(r){var o=eo(r.target);if(o!==null){var c=En(o);if(c!==null){if(o=c.tag,o===13){if(o=Io(c),o!==null){r.blockedOn=o,Rl(r.priority,function(){ta(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 ls(r){if(r.blockedOn!==null)return!1;for(var o=r.targetContainers;0<o.length;){var c=Yo(r.domEventName,r.eventSystemFlags,o[0],r.nativeEvent);if(c===null){c=r.nativeEvent;var m=new c.constructor(c.type,c);wt=m,c.target.dispatchEvent(m),wt=null}else return o=ka(c),o!==null&&Mr(o),r.blockedOn=c,!1;o.shift()}return!0}function ra(r,o,c){ls(r)&&c.delete(o)}function Vo(){Wo=!1,hr!==null&&ls(hr)&&(hr=null),Gn!==null&&ls(Gn)&&(Gn=null),pr!==null&&ls(pr)&&(pr=null),gn.forEach(ra),Vn.forEach(ra)}function Ir(r,o){r.blockedOn===o&&(r.blockedOn=null,Wo||(Wo=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Vo)))}function cs(r){function o(v){return Ir(v,r)}if(0<Ho.length){Ir(Ho[0],r);for(var c=1;c<Ho.length;c++){var m=Ho[c];m.blockedOn===r&&(m.blockedOn=null)}}for(hr!==null&&Ir(hr,r),Gn!==null&&Ir(Gn,r),pr!==null&&Ir(pr,r),gn.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);)Go(c),c.blockedOn===null&&Yn.shift()}var mr=j.ReactCurrentBatchConfig,Bs=!0;function sa(r,o,c,m){var v=Je,x=mr.transition;mr.transition=null;try{Je=1,gr(r,o,c,m)}finally{Je=v,mr.transition=x}}function Al(r,o,c,m){var v=Je,x=mr.transition;mr.transition=null;try{Je=4,gr(r,o,c,m)}finally{Je=v,mr.transition=x}}function gr(r,o,c,m){if(Bs){var v=Yo(r,o,c,m);if(v===null)vd(r,o,m,Us,c),Kn(r,m);else if(Cn(v,r,o,c,m))m.stopPropagation();else if(Kn(r,m),o&4&&-1<na.indexOf(r)){for(;v!==null;){var x=ka(v);if(x!==null&&Tl(x),x=Yo(r,o,c,m),x===null&&vd(r,o,m,Us,c),x===v)break;v=x}v!==null&&m.stopPropagation()}else vd(r,o,m,null,c)}}var Us=null;function Yo(r,o,c,m){if(Us=null,r=dt(m),r=eo(r),r!==null)if(o=En(r),o===null)r=null;else if(c=o.tag,c===13){if(r=Io(o),r!==null)return r;r=null}else if(c===3){if(o.stateNode.current.memoizedState.isDehydrated)return o.tag===3?o.stateNode.containerInfo:null;r=null}else o!==r&&(r=null);return Us=r,null}function Ko(r){switch(r){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(Ji()){case ns:return 1;case Ht:return 4;case Un:case qo:return 16;case rs:return 536870912;default:return 16}default:return 16}}var vr=null,Ws=null,Xn=null;function oa(){if(Xn)return Xn;var r,o=Ws,c=o.length,m,v="value"in vr?vr.value:vr.textContent,x=v.length;for(r=0;r<c&&o[r]===v[r];r++);var R=c-r;for(m=1;m<=R&&o[c-m]===v[x-m];m++);return Xn=v.slice(r,1<m?1-m:void 0)}function Xo(r){var o=r.keyCode;return"charCode"in r?(r=r.charCode,r===0&&o===13&&(r=13)):r=o,r===10&&(r=13),32<=r||r===13?r:0}function Hs(){return!0}function ia(){return!1}function Zt(r){function o(c,m,v,x,R){this._reactName=c,this._targetInst=v,this.type=m,this.nativeEvent=x,this.target=R,this.currentTarget=null;for(var B in r)r.hasOwnProperty(B)&&(c=r[B],this[B]=c?c(x):x[B]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?Hs:ia,this.isPropagationStopped=ia,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=Hs)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=Hs)},persist:function(){},isPersistent:Hs}),o}var It={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},aa=Zt(It),Or=J({},It,{view:0,detail:0}),us=Zt(Or),Pr,Gs,$r,Vs=J({},Or,{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!==$r&&($r&&r.type==="mousemove"?(Pr=r.screenX-$r.screenX,Gs=r.screenY-$r.screenY):Gs=Pr=0,$r=r),Pr)},movementY:function(r){return"movementY"in r?r.movementY:Gs}}),Ys=Zt(Vs),Ml=J({},Vs,{dataTransfer:0}),td=Zt(Ml),nd=J({},Or,{relatedTarget:0}),Qo=Zt(nd),rd=J({},It,{animationName:0,elapsedTime:0,pseudoElement:0}),sd=Zt(rd),la=J({},It,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),yr=Zt(la),ca=J({},It,{data:0}),ua=Zt(ca),od={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},id={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"},Il={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Ol(r){var o=this.nativeEvent;return o.getModifierState?o.getModifierState(r):(r=Il[r])?!!o[r]:!1}function jn(){return Ol}var ad=J({},Or,{key:function(r){if(r.key){var o=od[r.key]||r.key;if(o!=="Unidentified")return o}return r.type==="keypress"?(r=Xo(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?id[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"?Xo(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?Xo(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),Pl=Zt(ad),ld=J({},Vs,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Ks=Zt(ld),cd=J({},Or,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:jn}),Jt=Zt(cd),da=J({},It,{propertyName:0,elapsedTime:0,pseudoElement:0}),$l=Zt(da),Ll=J({},Vs,{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}),ql=Zt(Ll),fa=[9,13,27,32],ds=u&&"CompositionEvent"in window,Lr=null;u&&"documentMode"in document&&(Lr=document.documentMode);var Dl=u&&"TextEvent"in window&&!Lr,Xs=u&&(!ds||Lr&&8<Lr&&11>=Lr),ha=" ",Zo=!1;function pa(r,o){switch(r){case"keyup":return fa.indexOf(o.keyCode)!==-1;case"keydown":return o.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Jo(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var Gt=!1;function Fl(r,o){switch(r){case"compositionend":return Jo(o);case"keypress":return o.which!==32?null:(Zo=!0,ha);case"textInput":return r=o.data,r===ha&&Zo?null:r;default:return null}}function zl(r,o){if(Gt)return r==="compositionend"||!ds&&pa(r,o)?(r=oa(),Xn=Ws=vr=null,Gt=!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 Xs&&o.locale!=="ko"?null:o.data;default:return null}}var ud={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 Bl(r){var o=r&&r.nodeName&&r.nodeName.toLowerCase();return o==="input"?!!ud[r.type]:o==="textarea"}function ma(r,o,c,m){Co(m),o=Yl(o,"onChange"),0<o.length&&(c=new aa("onChange","change",null,c,m),r.push({event:c,listeners:o}))}var fs=null,hs=null;function Ul(r){a0(r,0)}function Qs(r){var o=oi(r);if(Ve(o))return r}function z(r,o){if(r==="change")return o}var K=!1;if(u){var le;if(u){var fe="oninput"in document;if(!fe){var Ne=document.createElement("div");Ne.setAttribute("oninput","return;"),fe=typeof Ne.oninput=="function"}le=fe}else le=!1;K=le&&(!document.documentMode||9<document.documentMode)}function Pe(){fs&&(fs.detachEvent("onpropertychange",We),hs=fs=null)}function We(r){if(r.propertyName==="value"&&Qs(hs)){var o=[];ma(o,hs,r,dt(r)),Cr(Ul,o)}}function nt(r,o,c){r==="focusin"?(Pe(),fs=o,hs=c,fs.attachEvent("onpropertychange",We)):r==="focusout"&&Pe()}function mt(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return Qs(hs)}function ct(r,o){if(r==="click")return Qs(o)}function rn(r,o){if(r==="input"||r==="change")return Qs(o)}function ei(r,o){return r===o&&(r!==0||1/r===1/o)||r!==r&&o!==o}var sn=typeof Object.is=="function"?Object.is:ei;function Zs(r,o){if(sn(r,o))return!0;if(typeof r!="object"||r===null||typeof o!="object"||o===null)return!1;var c=Object.keys(r),m=Object.keys(o);if(c.length!==m.length)return!1;for(m=0;m<c.length;m++){var v=c[m];if(!h.call(o,v)||!sn(r[v],o[v]))return!1}return!0}function ga(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function Wl(r,o){var c=ga(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=ga(c)}}function va(r,o){return r&&o?r===o?!0:r&&r.nodeType===3?!1:o&&o.nodeType===3?va(r,o.parentNode):"contains"in r?r.contains(o):r.compareDocumentPosition?!!(r.compareDocumentPosition(o)&16):!1:!1}function ti(){for(var r=window,o=Be();o instanceof r.HTMLIFrameElement;){try{var c=typeof o.contentWindow.location.href=="string"}catch{c=!1}if(c)r=o.contentWindow;else break;o=Be(r.document)}return o}function qr(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 Js(r){var o=ti(),c=r.focusedElem,m=r.selectionRange;if(o!==c&&c&&c.ownerDocument&&va(c.ownerDocument.documentElement,c)){if(m!==null&&qr(c)){if(o=m.start,r=m.end,r===void 0&&(r=o),"selectionStart"in c)c.selectionStart=o,c.selectionEnd=Math.min(r,c.value.length);else if(r=(o=c.ownerDocument||document)&&o.defaultView||window,r.getSelection){r=r.getSelection();var v=c.textContent.length,x=Math.min(m.start,v);m=m.end===void 0?x:Math.min(m.end,v),!r.extend&&x>m&&(v=m,m=x,x=v),v=Wl(c,x);var R=Wl(c,m);v&&R&&(r.rangeCount!==1||r.anchorNode!==v.node||r.anchorOffset!==v.offset||r.focusNode!==R.node||r.focusOffset!==R.offset)&&(o=o.createRange(),o.setStart(v.node,v.offset),r.removeAllRanges(),x>m?(r.addRange(o),r.extend(R.node,R.offset)):(o.setEnd(R.node,R.offset),r.addRange(o)))}}for(o=[],r=c;r=r.parentNode;)r.nodeType===1&&o.push({element:r,left:r.scrollLeft,top:r.scrollTop});for(typeof c.focus=="function"&&c.focus(),c=0;c<o.length;c++)r=o[c],r.element.scrollLeft=r.left,r.element.scrollTop=r.top}}var jt=u&&"documentMode"in document&&11>=document.documentMode,Dr=null,dd=null,ya=null,fd=!1;function Zw(r,o,c){var m=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;fd||Dr==null||Dr!==Be(m)||(m=Dr,"selectionStart"in m&&qr(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}),ya&&Zs(ya,m)||(ya=m,m=Yl(dd,"onSelect"),0<m.length&&(o=new aa("onSelect","select",null,o,c),r.push({event:o,listeners:m}),o.target=Dr)))}function Hl(r,o){var c={};return c[r.toLowerCase()]=o.toLowerCase(),c["Webkit"+r]="webkit"+o,c["Moz"+r]="moz"+o,c}var ni={animationend:Hl("Animation","AnimationEnd"),animationiteration:Hl("Animation","AnimationIteration"),animationstart:Hl("Animation","AnimationStart"),transitionend:Hl("Transition","TransitionEnd")},hd={},Jw={};u&&(Jw=document.createElement("div").style,"AnimationEvent"in window||(delete ni.animationend.animation,delete ni.animationiteration.animation,delete ni.animationstart.animation),"TransitionEvent"in window||delete ni.transitionend.transition);function Gl(r){if(hd[r])return hd[r];if(!ni[r])return r;var o=ni[r],c;for(c in o)if(o.hasOwnProperty(c)&&c in Jw)return hd[r]=o[c];return r}var e0=Gl("animationend"),t0=Gl("animationiteration"),n0=Gl("animationstart"),r0=Gl("transitionend"),s0=new Map,o0="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 ps(r,o){s0.set(r,o),a(o,[r])}for(var pd=0;pd<o0.length;pd++){var md=o0[pd],QR=md.toLowerCase(),ZR=md[0].toUpperCase()+md.slice(1);ps(QR,"on"+ZR)}ps(e0,"onAnimationEnd"),ps(t0,"onAnimationIteration"),ps(n0,"onAnimationStart"),ps("dblclick","onDoubleClick"),ps("focusin","onFocus"),ps("focusout","onBlur"),ps(r0,"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 wa="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(" "),JR=new Set("cancel close invalid load scroll toggle".split(" ").concat(wa));function i0(r,o,c){var m=r.type||"unknown-event";r.currentTarget=c,Mo(m,o,void 0,r),r.currentTarget=null}function a0(r,o){o=(o&4)!==0;for(var c=0;c<r.length;c++){var m=r[c],v=m.event;m=m.listeners;e:{var x=void 0;if(o)for(var R=m.length-1;0<=R;R--){var B=m[R],ee=B.instance,ae=B.currentTarget;if(B=B.listener,ee!==x&&v.isPropagationStopped())break e;i0(v,B,ae),x=ee}else for(R=0;R<m.length;R++){if(B=m[R],ee=B.instance,ae=B.currentTarget,B=B.listener,ee!==x&&v.isPropagationStopped())break e;i0(v,B,ae),x=ee}}}if(fr)throw r=ts,fr=!1,ts=null,r}function ht(r,o){var c=o[kd];c===void 0&&(c=o[kd]=new Set);var m=r+"__bubble";c.has(m)||(l0(o,r,2,!1),c.add(m))}function gd(r,o,c){var m=0;o&&(m|=4),l0(c,r,m,o)}var Vl="_reactListening"+Math.random().toString(36).slice(2);function xa(r){if(!r[Vl]){r[Vl]=!0,s.forEach(function(c){c!=="selectionchange"&&(JR.has(c)||gd(c,!1,r),gd(c,!0,r))});var o=r.nodeType===9?r:r.ownerDocument;o===null||o[Vl]||(o[Vl]=!0,gd("selectionchange",!1,o))}}function l0(r,o,c,m){switch(Ko(o)){case 1:var v=sa;break;case 4:v=Al;break;default:v=gr}c=v.bind(null,o,c,r),v=void 0,!$s||o!=="touchstart"&&o!=="touchmove"&&o!=="wheel"||(v=!0),m?v!==void 0?r.addEventListener(o,c,{capture:!0,passive:v}):r.addEventListener(o,c,!0):v!==void 0?r.addEventListener(o,c,{passive:v}):r.addEventListener(o,c,!1)}function vd(r,o,c,m,v){var x=m;if((o&1)===0&&(o&2)===0&&m!==null)e:for(;;){if(m===null)return;var R=m.tag;if(R===3||R===4){var B=m.stateNode.containerInfo;if(B===v||B.nodeType===8&&B.parentNode===v)break;if(R===4)for(R=m.return;R!==null;){var ee=R.tag;if((ee===3||ee===4)&&(ee=R.stateNode.containerInfo,ee===v||ee.nodeType===8&&ee.parentNode===v))return;R=R.return}for(;B!==null;){if(R=eo(B),R===null)return;if(ee=R.tag,ee===5||ee===6){m=x=R;continue e}B=B.parentNode}}m=m.return}Cr(function(){var ae=x,ge=dt(c),ve=[];e:{var me=s0.get(r);if(me!==void 0){var Se=aa,Re=r;switch(r){case"keypress":if(Xo(c)===0)break e;case"keydown":case"keyup":Se=Pl;break;case"focusin":Re="focus",Se=Qo;break;case"focusout":Re="blur",Se=Qo;break;case"beforeblur":case"afterblur":Se=Qo;break;case"click":if(c.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Se=Ys;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Se=td;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Se=Jt;break;case e0:case t0:case n0:Se=sd;break;case r0:Se=$l;break;case"scroll":Se=us;break;case"wheel":Se=ql;break;case"copy":case"cut":case"paste":Se=yr;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Se=Ks}var Me=(o&4)!==0,Ct=!Me&&r==="scroll",se=Me?me!==null?me+"Capture":null:me;Me=[];for(var te=ae,ie;te!==null;){ie=te;var ye=ie.stateNode;if(ie.tag===5&&ye!==null&&(ie=ye,se!==null&&(ye=zn(te,se),ye!=null&&Me.push(ba(te,ye,ie)))),Ct)break;te=te.return}0<Me.length&&(me=new Se(me,Re,null,c,ge),ve.push({event:me,listeners:Me}))}}if((o&7)===0){e:{if(me=r==="mouseover"||r==="pointerover",Se=r==="mouseout"||r==="pointerout",me&&c!==wt&&(Re=c.relatedTarget||c.fromElement)&&(eo(Re)||Re[Fr]))break e;if((Se||me)&&(me=ge.window===ge?ge:(me=ge.ownerDocument)?me.defaultView||me.parentWindow:window,Se?(Re=c.relatedTarget||c.toElement,Se=ae,Re=Re?eo(Re):null,Re!==null&&(Ct=En(Re),Re!==Ct||Re.tag!==5&&Re.tag!==6)&&(Re=null)):(Se=null,Re=ae),Se!==Re)){if(Me=Ys,ye="onMouseLeave",se="onMouseEnter",te="mouse",(r==="pointerout"||r==="pointerover")&&(Me=Ks,ye="onPointerLeave",se="onPointerEnter",te="pointer"),Ct=Se==null?me:oi(Se),ie=Re==null?me:oi(Re),me=new Me(ye,te+"leave",Se,c,ge),me.target=Ct,me.relatedTarget=ie,ye=null,eo(ge)===ae&&(Me=new Me(se,te+"enter",Re,c,ge),Me.target=ie,Me.relatedTarget=Ct,ye=Me),Ct=ye,Se&&Re)t:{for(Me=Se,se=Re,te=0,ie=Me;ie;ie=ri(ie))te++;for(ie=0,ye=se;ye;ye=ri(ye))ie++;for(;0<te-ie;)Me=ri(Me),te--;for(;0<ie-te;)se=ri(se),ie--;for(;te--;){if(Me===se||se!==null&&Me===se.alternate)break t;Me=ri(Me),se=ri(se)}Me=null}else Me=null;Se!==null&&c0(ve,me,Se,Me,!1),Re!==null&&Ct!==null&&c0(ve,Ct,Re,Me,!0)}}e:{if(me=ae?oi(ae):window,Se=me.nodeName&&me.nodeName.toLowerCase(),Se==="select"||Se==="input"&&me.type==="file")var $e=z;else if(Bl(me))if(K)$e=rn;else{$e=mt;var Fe=nt}else(Se=me.nodeName)&&Se.toLowerCase()==="input"&&(me.type==="checkbox"||me.type==="radio")&&($e=ct);if($e&&($e=$e(r,ae))){ma(ve,$e,c,ge);break e}Fe&&Fe(r,me,ae),r==="focusout"&&(Fe=me._wrapperState)&&Fe.controlled&&me.type==="number"&&Ye(me,"number",me.value)}switch(Fe=ae?oi(ae):window,r){case"focusin":(Bl(Fe)||Fe.contentEditable==="true")&&(Dr=Fe,dd=ae,ya=null);break;case"focusout":ya=dd=Dr=null;break;case"mousedown":fd=!0;break;case"contextmenu":case"mouseup":case"dragend":fd=!1,Zw(ve,c,ge);break;case"selectionchange":if(jt)break;case"keydown":case"keyup":Zw(ve,c,ge)}var ze;if(ds)e:{switch(r){case"compositionstart":var Ue="onCompositionStart";break e;case"compositionend":Ue="onCompositionEnd";break e;case"compositionupdate":Ue="onCompositionUpdate";break e}Ue=void 0}else Gt?pa(r,c)&&(Ue="onCompositionEnd"):r==="keydown"&&c.keyCode===229&&(Ue="onCompositionStart");Ue&&(Xs&&c.locale!=="ko"&&(Gt||Ue!=="onCompositionStart"?Ue==="onCompositionEnd"&&Gt&&(ze=oa()):(vr=ge,Ws="value"in vr?vr.value:vr.textContent,Gt=!0)),Fe=Yl(ae,Ue),0<Fe.length&&(Ue=new ua(Ue,r,null,c,ge),ve.push({event:Ue,listeners:Fe}),ze?Ue.data=ze:(ze=Jo(c),ze!==null&&(Ue.data=ze)))),(ze=Dl?Fl(r,c):zl(r,c))&&(ae=Yl(ae,"onBeforeInput"),0<ae.length&&(ge=new ua("onBeforeInput","beforeinput",null,c,ge),ve.push({event:ge,listeners:ae}),ge.data=ze))}a0(ve,o)})}function ba(r,o,c){return{instance:r,listener:o,currentTarget:c}}function Yl(r,o){for(var c=o+"Capture",m=[];r!==null;){var v=r,x=v.stateNode;v.tag===5&&x!==null&&(v=x,x=zn(r,c),x!=null&&m.unshift(ba(r,x,v)),x=zn(r,o),x!=null&&m.push(ba(r,x,v))),r=r.return}return m}function ri(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5);return r||null}function c0(r,o,c,m,v){for(var x=o._reactName,R=[];c!==null&&c!==m;){var B=c,ee=B.alternate,ae=B.stateNode;if(ee!==null&&ee===m)break;B.tag===5&&ae!==null&&(B=ae,v?(ee=zn(c,x),ee!=null&&R.unshift(ba(c,ee,B))):v||(ee=zn(c,x),ee!=null&&R.push(ba(c,ee,B)))),c=c.return}R.length!==0&&r.push({event:o,listeners:R})}var eA=/\r\n?/g,tA=/\u0000|\uFFFD/g;function u0(r){return(typeof r=="string"?r:""+r).replace(eA,`
38
+ `).replace(tA,"")}function Kl(r,o,c){if(o=u0(o),u0(r)!==o&&c)throw Error(n(425))}function Xl(){}var yd=null,wd=null;function xd(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 bd=typeof setTimeout=="function"?setTimeout:void 0,nA=typeof clearTimeout=="function"?clearTimeout:void 0,d0=typeof Promise=="function"?Promise:void 0,rA=typeof queueMicrotask=="function"?queueMicrotask:typeof d0<"u"?function(r){return d0.resolve(null).then(r).catch(sA)}:bd;function sA(r){setTimeout(function(){throw r})}function _d(r,o){var c=o,m=0;do{var v=c.nextSibling;if(r.removeChild(c),v&&v.nodeType===8)if(c=v.data,c==="/$"){if(m===0){r.removeChild(v),cs(o);return}m--}else c!=="$"&&c!=="$?"&&c!=="$!"||m++;c=v}while(c);cs(o)}function ms(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 f0(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 si=Math.random().toString(36).slice(2),wr="__reactFiber$"+si,_a="__reactProps$"+si,Fr="__reactContainer$"+si,kd="__reactEvents$"+si,oA="__reactListeners$"+si,iA="__reactHandles$"+si;function eo(r){var o=r[wr];if(o)return o;for(var c=r.parentNode;c;){if(o=c[Fr]||c[wr]){if(c=o.alternate,o.child!==null||c!==null&&c.child!==null)for(r=f0(r);r!==null;){if(c=r[wr])return c;r=f0(r)}return o}r=c,c=r.parentNode}return null}function ka(r){return r=r[wr]||r[Fr],!r||r.tag!==5&&r.tag!==6&&r.tag!==13&&r.tag!==3?null:r}function oi(r){if(r.tag===5||r.tag===6)return r.stateNode;throw Error(n(33))}function Ql(r){return r[_a]||null}var Sd=[],ii=-1;function gs(r){return{current:r}}function pt(r){0>ii||(r.current=Sd[ii],Sd[ii]=null,ii--)}function ft(r,o){ii++,Sd[ii]=r.current,r.current=o}var vs={},Vt=gs(vs),on=gs(!1),to=vs;function ai(r,o){var c=r.type.contextTypes;if(!c)return vs;var m=r.stateNode;if(m&&m.__reactInternalMemoizedUnmaskedChildContext===o)return m.__reactInternalMemoizedMaskedChildContext;var v={},x;for(x in c)v[x]=o[x];return m&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=o,r.__reactInternalMemoizedMaskedChildContext=v),v}function an(r){return r=r.childContextTypes,r!=null}function Zl(){pt(on),pt(Vt)}function h0(r,o,c){if(Vt.current!==vs)throw Error(n(168));ft(Vt,o),ft(on,c)}function p0(r,o,c){var m=r.stateNode;if(o=o.childContextTypes,typeof m.getChildContext!="function")return c;m=m.getChildContext();for(var v in m)if(!(v in o))throw Error(n(108,re(r)||"Unknown",v));return J({},c,m)}function Jl(r){return r=(r=r.stateNode)&&r.__reactInternalMemoizedMergedChildContext||vs,to=Vt.current,ft(Vt,r),ft(on,on.current),!0}function m0(r,o,c){var m=r.stateNode;if(!m)throw Error(n(169));c?(r=p0(r,o,to),m.__reactInternalMemoizedMergedChildContext=r,pt(on),pt(Vt),ft(Vt,r)):pt(on),ft(on,c)}var zr=null,ec=!1,Nd=!1;function g0(r){zr===null?zr=[r]:zr.push(r)}function aA(r){ec=!0,g0(r)}function ys(){if(!Nd&&zr!==null){Nd=!0;var r=0,o=Je;try{var c=zr;for(Je=1;r<c.length;r++){var m=c[r];do m=m(!0);while(m!==null)}zr=null,ec=!1}catch(v){throw zr!==null&&(zr=zr.slice(r+1)),Ls(ns,ys),v}finally{Je=o,Nd=!1}}return null}var li=[],ci=0,tc=null,nc=0,Tn=[],Rn=0,no=null,Br=1,Ur="";function ro(r,o){li[ci++]=nc,li[ci++]=tc,tc=r,nc=o}function v0(r,o,c){Tn[Rn++]=Br,Tn[Rn++]=Ur,Tn[Rn++]=no,no=r;var m=Br;r=Ur;var v=32-mn(m)-1;m&=~(1<<v),c+=1;var x=32-mn(o)+v;if(30<x){var R=v-v%5;x=(m&(1<<R)-1).toString(32),m>>=R,v-=R,Br=1<<32-mn(o)+v|c<<v|m,Ur=x+r}else Br=1<<x|c<<v|m,Ur=r}function Ed(r){r.return!==null&&(ro(r,1),v0(r,1,0))}function Cd(r){for(;r===tc;)tc=li[--ci],li[ci]=null,nc=li[--ci],li[ci]=null;for(;r===no;)no=Tn[--Rn],Tn[Rn]=null,Ur=Tn[--Rn],Tn[Rn]=null,Br=Tn[--Rn],Tn[Rn]=null}var vn=null,yn=null,gt=!1,Qn=null;function y0(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 w0(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,vn=r,yn=ms(o.firstChild),!0):!1;case 6:return o=r.pendingProps===""||o.nodeType!==3?null:o,o!==null?(r.stateNode=o,vn=r,yn=null,!0):!1;case 13:return o=o.nodeType!==8?null:o,o!==null?(c=no!==null?{id:Br,overflow:Ur}:null,r.memoizedState={dehydrated:o,treeContext:c,retryLane:1073741824},c=On(18,null,null,0),c.stateNode=o,c.return=r,r.child=c,vn=r,yn=null,!0):!1;default:return!1}}function jd(r){return(r.mode&1)!==0&&(r.flags&128)===0}function Td(r){if(gt){var o=yn;if(o){var c=o;if(!w0(r,o)){if(jd(r))throw Error(n(418));o=ms(c.nextSibling);var m=vn;o&&w0(r,o)?y0(m,c):(r.flags=r.flags&-4097|2,gt=!1,vn=r)}}else{if(jd(r))throw Error(n(418));r.flags=r.flags&-4097|2,gt=!1,vn=r}}}function x0(r){for(r=r.return;r!==null&&r.tag!==5&&r.tag!==3&&r.tag!==13;)r=r.return;vn=r}function rc(r){if(r!==vn)return!1;if(!gt)return x0(r),gt=!0,!1;var o;if((o=r.tag!==3)&&!(o=r.tag!==5)&&(o=r.type,o=o!=="head"&&o!=="body"&&!xd(r.type,r.memoizedProps)),o&&(o=yn)){if(jd(r))throw b0(),Error(n(418));for(;o;)y0(r,o),o=ms(o.nextSibling)}if(x0(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=ms(r.nextSibling);break e}o--}else c!=="$"&&c!=="$!"&&c!=="$?"||o++}r=r.nextSibling}yn=null}}else yn=vn?ms(r.stateNode.nextSibling):null;return!0}function b0(){for(var r=yn;r;)r=ms(r.nextSibling)}function ui(){yn=vn=null,gt=!1}function Rd(r){Qn===null?Qn=[r]:Qn.push(r)}var lA=j.ReactCurrentBatchConfig;function Sa(r,o,c){if(r=c.ref,r!==null&&typeof r!="function"&&typeof r!="object"){if(c._owner){if(c=c._owner,c){if(c.tag!==1)throw Error(n(309));var m=c.stateNode}if(!m)throw Error(n(147,r));var v=m,x=""+r;return o!==null&&o.ref!==null&&typeof o.ref=="function"&&o.ref._stringRef===x?o.ref:(o=function(R){var B=v.refs;R===null?delete B[x]:B[x]=R},o._stringRef=x,o)}if(typeof r!="string")throw Error(n(284));if(!c._owner)throw Error(n(290,r))}return r}function sc(r,o){throw r=Object.prototype.toString.call(o),Error(n(31,r==="[object Object]"?"object with keys {"+Object.keys(o).join(", ")+"}":r))}function _0(r){var o=r._init;return o(r._payload)}function k0(r){function o(se,te){if(r){var ie=se.deletions;ie===null?(se.deletions=[te],se.flags|=16):ie.push(te)}}function c(se,te){if(!r)return null;for(;te!==null;)o(se,te),te=te.sibling;return null}function m(se,te){for(se=new Map;te!==null;)te.key!==null?se.set(te.key,te):se.set(te.index,te),te=te.sibling;return se}function v(se,te){return se=Es(se,te),se.index=0,se.sibling=null,se}function x(se,te,ie){return se.index=ie,r?(ie=se.alternate,ie!==null?(ie=ie.index,ie<te?(se.flags|=2,te):ie):(se.flags|=2,te)):(se.flags|=1048576,te)}function R(se){return r&&se.alternate===null&&(se.flags|=2),se}function B(se,te,ie,ye){return te===null||te.tag!==6?(te=_f(ie,se.mode,ye),te.return=se,te):(te=v(te,ie),te.return=se,te)}function ee(se,te,ie,ye){var $e=ie.type;return $e===P?ge(se,te,ie.props.children,ye,ie.key):te!==null&&(te.elementType===$e||typeof $e=="object"&&$e!==null&&$e.$$typeof===U&&_0($e)===te.type)?(ye=v(te,ie.props),ye.ref=Sa(se,te,ie),ye.return=se,ye):(ye=jc(ie.type,ie.key,ie.props,null,se.mode,ye),ye.ref=Sa(se,te,ie),ye.return=se,ye)}function ae(se,te,ie,ye){return te===null||te.tag!==4||te.stateNode.containerInfo!==ie.containerInfo||te.stateNode.implementation!==ie.implementation?(te=kf(ie,se.mode,ye),te.return=se,te):(te=v(te,ie.children||[]),te.return=se,te)}function ge(se,te,ie,ye,$e){return te===null||te.tag!==7?(te=fo(ie,se.mode,ye,$e),te.return=se,te):(te=v(te,ie),te.return=se,te)}function ve(se,te,ie){if(typeof te=="string"&&te!==""||typeof te=="number")return te=_f(""+te,se.mode,ie),te.return=se,te;if(typeof te=="object"&&te!==null){switch(te.$$typeof){case I:return ie=jc(te.type,te.key,te.props,null,se.mode,ie),ie.ref=Sa(se,null,te),ie.return=se,ie;case O:return te=kf(te,se.mode,ie),te.return=se,te;case U:var ye=te._init;return ve(se,ye(te._payload),ie)}if(ut(te)||H(te))return te=fo(te,se.mode,ie,null),te.return=se,te;sc(se,te)}return null}function me(se,te,ie,ye){var $e=te!==null?te.key:null;if(typeof ie=="string"&&ie!==""||typeof ie=="number")return $e!==null?null:B(se,te,""+ie,ye);if(typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case I:return ie.key===$e?ee(se,te,ie,ye):null;case O:return ie.key===$e?ae(se,te,ie,ye):null;case U:return $e=ie._init,me(se,te,$e(ie._payload),ye)}if(ut(ie)||H(ie))return $e!==null?null:ge(se,te,ie,ye,null);sc(se,ie)}return null}function Se(se,te,ie,ye,$e){if(typeof ye=="string"&&ye!==""||typeof ye=="number")return se=se.get(ie)||null,B(te,se,""+ye,$e);if(typeof ye=="object"&&ye!==null){switch(ye.$$typeof){case I:return se=se.get(ye.key===null?ie:ye.key)||null,ee(te,se,ye,$e);case O:return se=se.get(ye.key===null?ie:ye.key)||null,ae(te,se,ye,$e);case U:var Fe=ye._init;return Se(se,te,ie,Fe(ye._payload),$e)}if(ut(ye)||H(ye))return se=se.get(ie)||null,ge(te,se,ye,$e,null);sc(te,ye)}return null}function Re(se,te,ie,ye){for(var $e=null,Fe=null,ze=te,Ue=te=0,Dt=null;ze!==null&&Ue<ie.length;Ue++){ze.index>Ue?(Dt=ze,ze=null):Dt=ze.sibling;var rt=me(se,ze,ie[Ue],ye);if(rt===null){ze===null&&(ze=Dt);break}r&&ze&&rt.alternate===null&&o(se,ze),te=x(rt,te,Ue),Fe===null?$e=rt:Fe.sibling=rt,Fe=rt,ze=Dt}if(Ue===ie.length)return c(se,ze),gt&&ro(se,Ue),$e;if(ze===null){for(;Ue<ie.length;Ue++)ze=ve(se,ie[Ue],ye),ze!==null&&(te=x(ze,te,Ue),Fe===null?$e=ze:Fe.sibling=ze,Fe=ze);return gt&&ro(se,Ue),$e}for(ze=m(se,ze);Ue<ie.length;Ue++)Dt=Se(ze,se,Ue,ie[Ue],ye),Dt!==null&&(r&&Dt.alternate!==null&&ze.delete(Dt.key===null?Ue:Dt.key),te=x(Dt,te,Ue),Fe===null?$e=Dt:Fe.sibling=Dt,Fe=Dt);return r&&ze.forEach(function(Cs){return o(se,Cs)}),gt&&ro(se,Ue),$e}function Me(se,te,ie,ye){var $e=H(ie);if(typeof $e!="function")throw Error(n(150));if(ie=$e.call(ie),ie==null)throw Error(n(151));for(var Fe=$e=null,ze=te,Ue=te=0,Dt=null,rt=ie.next();ze!==null&&!rt.done;Ue++,rt=ie.next()){ze.index>Ue?(Dt=ze,ze=null):Dt=ze.sibling;var Cs=me(se,ze,rt.value,ye);if(Cs===null){ze===null&&(ze=Dt);break}r&&ze&&Cs.alternate===null&&o(se,ze),te=x(Cs,te,Ue),Fe===null?$e=Cs:Fe.sibling=Cs,Fe=Cs,ze=Dt}if(rt.done)return c(se,ze),gt&&ro(se,Ue),$e;if(ze===null){for(;!rt.done;Ue++,rt=ie.next())rt=ve(se,rt.value,ye),rt!==null&&(te=x(rt,te,Ue),Fe===null?$e=rt:Fe.sibling=rt,Fe=rt);return gt&&ro(se,Ue),$e}for(ze=m(se,ze);!rt.done;Ue++,rt=ie.next())rt=Se(ze,se,Ue,rt.value,ye),rt!==null&&(r&&rt.alternate!==null&&ze.delete(rt.key===null?Ue:rt.key),te=x(rt,te,Ue),Fe===null?$e=rt:Fe.sibling=rt,Fe=rt);return r&&ze.forEach(function(zA){return o(se,zA)}),gt&&ro(se,Ue),$e}function Ct(se,te,ie,ye){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 $e=ie.key,Fe=te;Fe!==null;){if(Fe.key===$e){if($e=ie.type,$e===P){if(Fe.tag===7){c(se,Fe.sibling),te=v(Fe,ie.props.children),te.return=se,se=te;break e}}else if(Fe.elementType===$e||typeof $e=="object"&&$e!==null&&$e.$$typeof===U&&_0($e)===Fe.type){c(se,Fe.sibling),te=v(Fe,ie.props),te.ref=Sa(se,Fe,ie),te.return=se,se=te;break e}c(se,Fe);break}else o(se,Fe);Fe=Fe.sibling}ie.type===P?(te=fo(ie.props.children,se.mode,ye,ie.key),te.return=se,se=te):(ye=jc(ie.type,ie.key,ie.props,null,se.mode,ye),ye.ref=Sa(se,te,ie),ye.return=se,se=ye)}return R(se);case O:e:{for(Fe=ie.key;te!==null;){if(te.key===Fe)if(te.tag===4&&te.stateNode.containerInfo===ie.containerInfo&&te.stateNode.implementation===ie.implementation){c(se,te.sibling),te=v(te,ie.children||[]),te.return=se,se=te;break e}else{c(se,te);break}else o(se,te);te=te.sibling}te=kf(ie,se.mode,ye),te.return=se,se=te}return R(se);case U:return Fe=ie._init,Ct(se,te,Fe(ie._payload),ye)}if(ut(ie))return Re(se,te,ie,ye);if(H(ie))return Me(se,te,ie,ye);sc(se,ie)}return typeof ie=="string"&&ie!==""||typeof ie=="number"?(ie=""+ie,te!==null&&te.tag===6?(c(se,te.sibling),te=v(te,ie),te.return=se,se=te):(c(se,te),te=_f(ie,se.mode,ye),te.return=se,se=te),R(se)):c(se,te)}return Ct}var di=k0(!0),S0=k0(!1),oc=gs(null),ic=null,fi=null,Ad=null;function Md(){Ad=fi=ic=null}function Id(r){var o=oc.current;pt(oc),r._currentValue=o}function Od(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 hi(r,o){ic=r,Ad=fi=null,r=r.dependencies,r!==null&&r.firstContext!==null&&((r.lanes&o)!==0&&(ln=!0),r.firstContext=null)}function An(r){var o=r._currentValue;if(Ad!==r)if(r={context:r,memoizedValue:o,next:null},fi===null){if(ic===null)throw Error(n(308));fi=r,ic.dependencies={lanes:0,firstContext:r}}else fi=fi.next=r;return o}var so=null;function Pd(r){so===null?so=[r]:so.push(r)}function N0(r,o,c,m){var v=o.interleaved;return v===null?(c.next=c,Pd(o)):(c.next=v.next,v.next=c),o.interleaved=c,Wr(r,m)}function Wr(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 ws=!1;function $d(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function E0(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 Hr(r,o){return{eventTime:r,lane:o,tag:0,payload:null,callback:null,next:null}}function xs(r,o,c){var m=r.updateQueue;if(m===null)return null;if(m=m.shared,(tt&2)!==0){var v=m.pending;return v===null?o.next=o:(o.next=v.next,v.next=o),m.pending=o,Wr(r,c)}return v=m.interleaved,v===null?(o.next=o,Pd(m)):(o.next=v.next,v.next=o),m.interleaved=o,Wr(r,c)}function ac(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,as(r,c)}}function C0(r,o){var c=r.updateQueue,m=r.alternate;if(m!==null&&(m=m.updateQueue,c===m)){var v=null,x=null;if(c=c.firstBaseUpdate,c!==null){do{var R={eventTime:c.eventTime,lane:c.lane,tag:c.tag,payload:c.payload,callback:c.callback,next:null};x===null?v=x=R:x=x.next=R,c=c.next}while(c!==null);x===null?v=x=o:x=x.next=o}else v=x=o;c={baseState:m.baseState,firstBaseUpdate:v,lastBaseUpdate:x,shared:m.shared,effects:m.effects},r.updateQueue=c;return}r=c.lastBaseUpdate,r===null?c.firstBaseUpdate=o:r.next=o,c.lastBaseUpdate=o}function lc(r,o,c,m){var v=r.updateQueue;ws=!1;var x=v.firstBaseUpdate,R=v.lastBaseUpdate,B=v.shared.pending;if(B!==null){v.shared.pending=null;var ee=B,ae=ee.next;ee.next=null,R===null?x=ae:R.next=ae,R=ee;var ge=r.alternate;ge!==null&&(ge=ge.updateQueue,B=ge.lastBaseUpdate,B!==R&&(B===null?ge.firstBaseUpdate=ae:B.next=ae,ge.lastBaseUpdate=ee))}if(x!==null){var ve=v.baseState;R=0,ge=ae=ee=null,B=x;do{var me=B.lane,Se=B.eventTime;if((m&me)===me){ge!==null&&(ge=ge.next={eventTime:Se,lane:0,tag:B.tag,payload:B.payload,callback:B.callback,next:null});e:{var Re=r,Me=B;switch(me=o,Se=c,Me.tag){case 1:if(Re=Me.payload,typeof Re=="function"){ve=Re.call(Se,ve,me);break e}ve=Re;break e;case 3:Re.flags=Re.flags&-65537|128;case 0:if(Re=Me.payload,me=typeof Re=="function"?Re.call(Se,ve,me):Re,me==null)break e;ve=J({},ve,me);break e;case 2:ws=!0}}B.callback!==null&&B.lane!==0&&(r.flags|=64,me=v.effects,me===null?v.effects=[B]:me.push(B))}else Se={eventTime:Se,lane:me,tag:B.tag,payload:B.payload,callback:B.callback,next:null},ge===null?(ae=ge=Se,ee=ve):ge=ge.next=Se,R|=me;if(B=B.next,B===null){if(B=v.shared.pending,B===null)break;me=B,B=me.next,me.next=null,v.lastBaseUpdate=me,v.shared.pending=null}}while(!0);if(ge===null&&(ee=ve),v.baseState=ee,v.firstBaseUpdate=ae,v.lastBaseUpdate=ge,o=v.shared.interleaved,o!==null){v=o;do R|=v.lane,v=v.next;while(v!==o)}else x===null&&(v.shared.lanes=0);ao|=R,r.lanes=R,r.memoizedState=ve}}function j0(r,o,c){if(r=o.effects,o.effects=null,r!==null)for(o=0;o<r.length;o++){var m=r[o],v=m.callback;if(v!==null){if(m.callback=null,m=c,typeof v!="function")throw Error(n(191,v));v.call(m)}}}var Na={},xr=gs(Na),Ea=gs(Na),Ca=gs(Na);function oo(r){if(r===Na)throw Error(n(174));return r}function Ld(r,o){switch(ft(Ca,o),ft(Ea,r),ft(xr,Na),r=o.nodeType,r){case 9:case 11:o=(o=o.documentElement)?o.namespaceURI:je(null,"");break;default:r=r===8?o.parentNode:o,o=r.namespaceURI||null,r=r.tagName,o=je(o,r)}pt(xr),ft(xr,o)}function pi(){pt(xr),pt(Ea),pt(Ca)}function T0(r){oo(Ca.current);var o=oo(xr.current),c=je(o,r.type);o!==c&&(ft(Ea,r),ft(xr,c))}function qd(r){Ea.current===r&&(pt(xr),pt(Ea))}var bt=gs(0);function cc(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 Dd=[];function Fd(){for(var r=0;r<Dd.length;r++)Dd[r]._workInProgressVersionPrimary=null;Dd.length=0}var uc=j.ReactCurrentDispatcher,zd=j.ReactCurrentBatchConfig,io=0,_t=null,Ot=null,Lt=null,dc=!1,ja=!1,Ta=0,cA=0;function Yt(){throw Error(n(321))}function Bd(r,o){if(o===null)return!1;for(var c=0;c<o.length&&c<r.length;c++)if(!sn(r[c],o[c]))return!1;return!0}function Ud(r,o,c,m,v,x){if(io=x,_t=o,o.memoizedState=null,o.updateQueue=null,o.lanes=0,uc.current=r===null||r.memoizedState===null?hA:pA,r=c(m,v),ja){x=0;do{if(ja=!1,Ta=0,25<=x)throw Error(n(301));x+=1,Lt=Ot=null,o.updateQueue=null,uc.current=mA,r=c(m,v)}while(ja)}if(uc.current=pc,o=Ot!==null&&Ot.next!==null,io=0,Lt=Ot=_t=null,dc=!1,o)throw Error(n(300));return r}function Wd(){var r=Ta!==0;return Ta=0,r}function br(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Lt===null?_t.memoizedState=Lt=r:Lt=Lt.next=r,Lt}function Mn(){if(Ot===null){var r=_t.alternate;r=r!==null?r.memoizedState:null}else r=Ot.next;var o=Lt===null?_t.memoizedState:Lt.next;if(o!==null)Lt=o,Ot=r;else{if(r===null)throw Error(n(310));Ot=r,r={memoizedState:Ot.memoizedState,baseState:Ot.baseState,baseQueue:Ot.baseQueue,queue:Ot.queue,next:null},Lt===null?_t.memoizedState=Lt=r:Lt=Lt.next=r}return Lt}function Ra(r,o){return typeof o=="function"?o(r):o}function Hd(r){var o=Mn(),c=o.queue;if(c===null)throw Error(n(311));c.lastRenderedReducer=r;var m=Ot,v=m.baseQueue,x=c.pending;if(x!==null){if(v!==null){var R=v.next;v.next=x.next,x.next=R}m.baseQueue=v=x,c.pending=null}if(v!==null){x=v.next,m=m.baseState;var B=R=null,ee=null,ae=x;do{var ge=ae.lane;if((io&ge)===ge)ee!==null&&(ee=ee.next={lane:0,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null}),m=ae.hasEagerState?ae.eagerState:r(m,ae.action);else{var ve={lane:ge,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null};ee===null?(B=ee=ve,R=m):ee=ee.next=ve,_t.lanes|=ge,ao|=ge}ae=ae.next}while(ae!==null&&ae!==x);ee===null?R=m:ee.next=B,sn(m,o.memoizedState)||(ln=!0),o.memoizedState=m,o.baseState=R,o.baseQueue=ee,c.lastRenderedState=m}if(r=c.interleaved,r!==null){v=r;do x=v.lane,_t.lanes|=x,ao|=x,v=v.next;while(v!==r)}else v===null&&(c.lanes=0);return[o.memoizedState,c.dispatch]}function Gd(r){var o=Mn(),c=o.queue;if(c===null)throw Error(n(311));c.lastRenderedReducer=r;var m=c.dispatch,v=c.pending,x=o.memoizedState;if(v!==null){c.pending=null;var R=v=v.next;do x=r(x,R.action),R=R.next;while(R!==v);sn(x,o.memoizedState)||(ln=!0),o.memoizedState=x,o.baseQueue===null&&(o.baseState=x),c.lastRenderedState=x}return[x,m]}function R0(){}function A0(r,o){var c=_t,m=Mn(),v=o(),x=!sn(m.memoizedState,v);if(x&&(m.memoizedState=v,ln=!0),m=m.queue,Vd(O0.bind(null,c,m,r),[r]),m.getSnapshot!==o||x||Lt!==null&&Lt.memoizedState.tag&1){if(c.flags|=2048,Aa(9,I0.bind(null,c,m,v,o),void 0,null),qt===null)throw Error(n(349));(io&30)!==0||M0(c,o,v)}return v}function M0(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 I0(r,o,c,m){o.value=c,o.getSnapshot=m,P0(o)&&$0(r)}function O0(r,o,c){return c(function(){P0(o)&&$0(r)})}function P0(r){var o=r.getSnapshot;r=r.value;try{var c=o();return!sn(r,c)}catch{return!0}}function $0(r){var o=Wr(r,1);o!==null&&tr(o,r,1,-1)}function L0(r){var o=br();return typeof r=="function"&&(r=r()),o.memoizedState=o.baseState=r,r={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Ra,lastRenderedState:r},o.queue=r,r=r.dispatch=fA.bind(null,_t,r),[o.memoizedState,r]}function Aa(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 q0(){return Mn().memoizedState}function fc(r,o,c,m){var v=br();_t.flags|=r,v.memoizedState=Aa(1|o,c,void 0,m===void 0?null:m)}function hc(r,o,c,m){var v=Mn();m=m===void 0?null:m;var x=void 0;if(Ot!==null){var R=Ot.memoizedState;if(x=R.destroy,m!==null&&Bd(m,R.deps)){v.memoizedState=Aa(o,c,x,m);return}}_t.flags|=r,v.memoizedState=Aa(1|o,c,x,m)}function D0(r,o){return fc(8390656,8,r,o)}function Vd(r,o){return hc(2048,8,r,o)}function F0(r,o){return hc(4,2,r,o)}function z0(r,o){return hc(4,4,r,o)}function B0(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 U0(r,o,c){return c=c!=null?c.concat([r]):null,hc(4,4,B0.bind(null,o,r),c)}function Yd(){}function W0(r,o){var c=Mn();o=o===void 0?null:o;var m=c.memoizedState;return m!==null&&o!==null&&Bd(o,m[1])?m[0]:(c.memoizedState=[r,o],r)}function H0(r,o){var c=Mn();o=o===void 0?null:o;var m=c.memoizedState;return m!==null&&o!==null&&Bd(o,m[1])?m[0]:(r=r(),c.memoizedState=[r,o],r)}function G0(r,o,c){return(io&21)===0?(r.baseState&&(r.baseState=!1,ln=!0),r.memoizedState=c):(sn(c,o)||(c=Fs(),_t.lanes|=c,ao|=c,r.baseState=!0),o)}function uA(r,o){var c=Je;Je=c!==0&&4>c?c:4,r(!0);var m=zd.transition;zd.transition={};try{r(!1),o()}finally{Je=c,zd.transition=m}}function V0(){return Mn().memoizedState}function dA(r,o,c){var m=Ss(r);if(c={lane:m,action:c,hasEagerState:!1,eagerState:null,next:null},Y0(r))K0(o,c);else if(c=N0(r,o,c,m),c!==null){var v=tn();tr(c,r,m,v),X0(c,o,m)}}function fA(r,o,c){var m=Ss(r),v={lane:m,action:c,hasEagerState:!1,eagerState:null,next:null};if(Y0(r))K0(o,v);else{var x=r.alternate;if(r.lanes===0&&(x===null||x.lanes===0)&&(x=o.lastRenderedReducer,x!==null))try{var R=o.lastRenderedState,B=x(R,c);if(v.hasEagerState=!0,v.eagerState=B,sn(B,R)){var ee=o.interleaved;ee===null?(v.next=v,Pd(o)):(v.next=ee.next,ee.next=v),o.interleaved=v;return}}catch{}finally{}c=N0(r,o,v,m),c!==null&&(v=tn(),tr(c,r,m,v),X0(c,o,m))}}function Y0(r){var o=r.alternate;return r===_t||o!==null&&o===_t}function K0(r,o){ja=dc=!0;var c=r.pending;c===null?o.next=o:(o.next=c.next,c.next=o),r.pending=o}function X0(r,o,c){if((c&4194240)!==0){var m=o.lanes;m&=r.pendingLanes,c|=m,o.lanes=c,as(r,c)}}var pc={readContext:An,useCallback:Yt,useContext:Yt,useEffect:Yt,useImperativeHandle:Yt,useInsertionEffect:Yt,useLayoutEffect:Yt,useMemo:Yt,useReducer:Yt,useRef:Yt,useState:Yt,useDebugValue:Yt,useDeferredValue:Yt,useTransition:Yt,useMutableSource:Yt,useSyncExternalStore:Yt,useId:Yt,unstable_isNewReconciler:!1},hA={readContext:An,useCallback:function(r,o){return br().memoizedState=[r,o===void 0?null:o],r},useContext:An,useEffect:D0,useImperativeHandle:function(r,o,c){return c=c!=null?c.concat([r]):null,fc(4194308,4,B0.bind(null,o,r),c)},useLayoutEffect:function(r,o){return fc(4194308,4,r,o)},useInsertionEffect:function(r,o){return fc(4,2,r,o)},useMemo:function(r,o){var c=br();return o=o===void 0?null:o,r=r(),c.memoizedState=[r,o],r},useReducer:function(r,o,c){var m=br();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=dA.bind(null,_t,r),[m.memoizedState,r]},useRef:function(r){var o=br();return r={current:r},o.memoizedState=r},useState:L0,useDebugValue:Yd,useDeferredValue:function(r){return br().memoizedState=r},useTransition:function(){var r=L0(!1),o=r[0];return r=uA.bind(null,r[1]),br().memoizedState=r,[o,r]},useMutableSource:function(){},useSyncExternalStore:function(r,o,c){var m=_t,v=br();if(gt){if(c===void 0)throw Error(n(407));c=c()}else{if(c=o(),qt===null)throw Error(n(349));(io&30)!==0||M0(m,o,c)}v.memoizedState=c;var x={value:c,getSnapshot:o};return v.queue=x,D0(O0.bind(null,m,x,r),[r]),m.flags|=2048,Aa(9,I0.bind(null,m,x,c,o),void 0,null),c},useId:function(){var r=br(),o=qt.identifierPrefix;if(gt){var c=Ur,m=Br;c=(m&~(1<<32-mn(m)-1)).toString(32)+c,o=":"+o+"R"+c,c=Ta++,0<c&&(o+="H"+c.toString(32)),o+=":"}else c=cA++,o=":"+o+"r"+c.toString(32)+":";return r.memoizedState=o},unstable_isNewReconciler:!1},pA={readContext:An,useCallback:W0,useContext:An,useEffect:Vd,useImperativeHandle:U0,useInsertionEffect:F0,useLayoutEffect:z0,useMemo:H0,useReducer:Hd,useRef:q0,useState:function(){return Hd(Ra)},useDebugValue:Yd,useDeferredValue:function(r){var o=Mn();return G0(o,Ot.memoizedState,r)},useTransition:function(){var r=Hd(Ra)[0],o=Mn().memoizedState;return[r,o]},useMutableSource:R0,useSyncExternalStore:A0,useId:V0,unstable_isNewReconciler:!1},mA={readContext:An,useCallback:W0,useContext:An,useEffect:Vd,useImperativeHandle:U0,useInsertionEffect:F0,useLayoutEffect:z0,useMemo:H0,useReducer:Gd,useRef:q0,useState:function(){return Gd(Ra)},useDebugValue:Yd,useDeferredValue:function(r){var o=Mn();return Ot===null?o.memoizedState=r:G0(o,Ot.memoizedState,r)},useTransition:function(){var r=Gd(Ra)[0],o=Mn().memoizedState;return[r,o]},useMutableSource:R0,useSyncExternalStore:A0,useId:V0,unstable_isNewReconciler:!1};function Zn(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 Kd(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 mc={isMounted:function(r){return(r=r._reactInternals)?En(r)===r:!1},enqueueSetState:function(r,o,c){r=r._reactInternals;var m=tn(),v=Ss(r),x=Hr(m,v);x.payload=o,c!=null&&(x.callback=c),o=xs(r,x,v),o!==null&&(tr(o,r,v,m),ac(o,r,v))},enqueueReplaceState:function(r,o,c){r=r._reactInternals;var m=tn(),v=Ss(r),x=Hr(m,v);x.tag=1,x.payload=o,c!=null&&(x.callback=c),o=xs(r,x,v),o!==null&&(tr(o,r,v,m),ac(o,r,v))},enqueueForceUpdate:function(r,o){r=r._reactInternals;var c=tn(),m=Ss(r),v=Hr(c,m);v.tag=2,o!=null&&(v.callback=o),o=xs(r,v,m),o!==null&&(tr(o,r,m,c),ac(o,r,m))}};function Q0(r,o,c,m,v,x,R){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(m,x,R):o.prototype&&o.prototype.isPureReactComponent?!Zs(c,m)||!Zs(v,x):!0}function Z0(r,o,c){var m=!1,v=vs,x=o.contextType;return typeof x=="object"&&x!==null?x=An(x):(v=an(o)?to:Vt.current,m=o.contextTypes,x=(m=m!=null)?ai(r,v):vs),o=new o(c,x),r.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,o.updater=mc,r.stateNode=o,o._reactInternals=r,m&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=v,r.__reactInternalMemoizedMaskedChildContext=x),o}function J0(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&&mc.enqueueReplaceState(o,o.state,null)}function Xd(r,o,c,m){var v=r.stateNode;v.props=c,v.state=r.memoizedState,v.refs={},$d(r);var x=o.contextType;typeof x=="object"&&x!==null?v.context=An(x):(x=an(o)?to:Vt.current,v.context=ai(r,x)),v.state=r.memoizedState,x=o.getDerivedStateFromProps,typeof x=="function"&&(Kd(r,o,x,c),v.state=r.memoizedState),typeof o.getDerivedStateFromProps=="function"||typeof v.getSnapshotBeforeUpdate=="function"||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(o=v.state,typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount(),o!==v.state&&mc.enqueueReplaceState(v,v.state,null),lc(r,c,v,m),v.state=r.memoizedState),typeof v.componentDidMount=="function"&&(r.flags|=4194308)}function mi(r,o){try{var c="",m=o;do c+=L(m),m=m.return;while(m);var v=c}catch(x){v=`
39
+ Error generating stack: `+x.message+`
40
+ `+x.stack}return{value:r,source:o,stack:v,digest:null}}function Qd(r,o,c){return{value:r,source:null,stack:c??null,digest:o??null}}function Zd(r,o){try{console.error(o.value)}catch(c){setTimeout(function(){throw c})}}var gA=typeof WeakMap=="function"?WeakMap:Map;function ex(r,o,c){c=Hr(-1,c),c.tag=3,c.payload={element:null};var m=o.value;return c.callback=function(){_c||(_c=!0,pf=m),Zd(r,o)},c}function tx(r,o,c){c=Hr(-1,c),c.tag=3;var m=r.type.getDerivedStateFromError;if(typeof m=="function"){var v=o.value;c.payload=function(){return m(v)},c.callback=function(){Zd(r,o)}}var x=r.stateNode;return x!==null&&typeof x.componentDidCatch=="function"&&(c.callback=function(){Zd(r,o),typeof m!="function"&&(_s===null?_s=new Set([this]):_s.add(this));var R=o.stack;this.componentDidCatch(o.value,{componentStack:R!==null?R:""})}),c}function nx(r,o,c){var m=r.pingCache;if(m===null){m=r.pingCache=new gA;var v=new Set;m.set(o,v)}else v=m.get(o),v===void 0&&(v=new Set,m.set(o,v));v.has(c)||(v.add(c),r=RA.bind(null,r,o,c),o.then(r,r))}function rx(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 sx(r,o,c,m,v){return(r.mode&1)===0?(r===o?r.flags|=65536:(r.flags|=128,c.flags|=131072,c.flags&=-52805,c.tag===1&&(c.alternate===null?c.tag=17:(o=Hr(-1,1),o.tag=2,xs(c,o,1))),c.lanes|=1),r):(r.flags|=65536,r.lanes=v,r)}var vA=j.ReactCurrentOwner,ln=!1;function en(r,o,c,m){o.child=r===null?S0(o,null,c,m):di(o,r.child,c,m)}function ox(r,o,c,m,v){c=c.render;var x=o.ref;return hi(o,v),m=Ud(r,o,c,m,x,v),c=Wd(),r!==null&&!ln?(o.updateQueue=r.updateQueue,o.flags&=-2053,r.lanes&=~v,Gr(r,o,v)):(gt&&c&&Ed(o),o.flags|=1,en(r,o,m,v),o.child)}function ix(r,o,c,m,v){if(r===null){var x=c.type;return typeof x=="function"&&!bf(x)&&x.defaultProps===void 0&&c.compare===null&&c.defaultProps===void 0?(o.tag=15,o.type=x,ax(r,o,x,m,v)):(r=jc(c.type,null,m,o,o.mode,v),r.ref=o.ref,r.return=o,o.child=r)}if(x=r.child,(r.lanes&v)===0){var R=x.memoizedProps;if(c=c.compare,c=c!==null?c:Zs,c(R,m)&&r.ref===o.ref)return Gr(r,o,v)}return o.flags|=1,r=Es(x,m),r.ref=o.ref,r.return=o,o.child=r}function ax(r,o,c,m,v){if(r!==null){var x=r.memoizedProps;if(Zs(x,m)&&r.ref===o.ref)if(ln=!1,o.pendingProps=m=x,(r.lanes&v)!==0)(r.flags&131072)!==0&&(ln=!0);else return o.lanes=r.lanes,Gr(r,o,v)}return Jd(r,o,c,m,v)}function lx(r,o,c){var m=o.pendingProps,v=m.children,x=r!==null?r.memoizedState:null;if(m.mode==="hidden")if((o.mode&1)===0)o.memoizedState={baseLanes:0,cachePool:null,transitions:null},ft(vi,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(vi,wn),wn|=r,null;o.memoizedState={baseLanes:0,cachePool:null,transitions:null},m=x!==null?x.baseLanes:c,ft(vi,wn),wn|=m}else x!==null?(m=x.baseLanes|c,o.memoizedState=null):m=c,ft(vi,wn),wn|=m;return en(r,o,v,c),o.child}function cx(r,o){var c=o.ref;(r===null&&c!==null||r!==null&&r.ref!==c)&&(o.flags|=512,o.flags|=2097152)}function Jd(r,o,c,m,v){var x=an(c)?to:Vt.current;return x=ai(o,x),hi(o,v),c=Ud(r,o,c,m,x,v),m=Wd(),r!==null&&!ln?(o.updateQueue=r.updateQueue,o.flags&=-2053,r.lanes&=~v,Gr(r,o,v)):(gt&&m&&Ed(o),o.flags|=1,en(r,o,c,v),o.child)}function ux(r,o,c,m,v){if(an(c)){var x=!0;Jl(o)}else x=!1;if(hi(o,v),o.stateNode===null)vc(r,o),Z0(o,c,m),Xd(o,c,m,v),m=!0;else if(r===null){var R=o.stateNode,B=o.memoizedProps;R.props=B;var ee=R.context,ae=c.contextType;typeof ae=="object"&&ae!==null?ae=An(ae):(ae=an(c)?to:Vt.current,ae=ai(o,ae));var ge=c.getDerivedStateFromProps,ve=typeof ge=="function"||typeof R.getSnapshotBeforeUpdate=="function";ve||typeof R.UNSAFE_componentWillReceiveProps!="function"&&typeof R.componentWillReceiveProps!="function"||(B!==m||ee!==ae)&&J0(o,R,m,ae),ws=!1;var me=o.memoizedState;R.state=me,lc(o,m,R,v),ee=o.memoizedState,B!==m||me!==ee||on.current||ws?(typeof ge=="function"&&(Kd(o,c,ge,m),ee=o.memoizedState),(B=ws||Q0(o,c,B,m,me,ee,ae))?(ve||typeof R.UNSAFE_componentWillMount!="function"&&typeof R.componentWillMount!="function"||(typeof R.componentWillMount=="function"&&R.componentWillMount(),typeof R.UNSAFE_componentWillMount=="function"&&R.UNSAFE_componentWillMount()),typeof R.componentDidMount=="function"&&(o.flags|=4194308)):(typeof R.componentDidMount=="function"&&(o.flags|=4194308),o.memoizedProps=m,o.memoizedState=ee),R.props=m,R.state=ee,R.context=ae,m=B):(typeof R.componentDidMount=="function"&&(o.flags|=4194308),m=!1)}else{R=o.stateNode,E0(r,o),B=o.memoizedProps,ae=o.type===o.elementType?B:Zn(o.type,B),R.props=ae,ve=o.pendingProps,me=R.context,ee=c.contextType,typeof ee=="object"&&ee!==null?ee=An(ee):(ee=an(c)?to:Vt.current,ee=ai(o,ee));var Se=c.getDerivedStateFromProps;(ge=typeof Se=="function"||typeof R.getSnapshotBeforeUpdate=="function")||typeof R.UNSAFE_componentWillReceiveProps!="function"&&typeof R.componentWillReceiveProps!="function"||(B!==ve||me!==ee)&&J0(o,R,m,ee),ws=!1,me=o.memoizedState,R.state=me,lc(o,m,R,v);var Re=o.memoizedState;B!==ve||me!==Re||on.current||ws?(typeof Se=="function"&&(Kd(o,c,Se,m),Re=o.memoizedState),(ae=ws||Q0(o,c,ae,m,me,Re,ee)||!1)?(ge||typeof R.UNSAFE_componentWillUpdate!="function"&&typeof R.componentWillUpdate!="function"||(typeof R.componentWillUpdate=="function"&&R.componentWillUpdate(m,Re,ee),typeof R.UNSAFE_componentWillUpdate=="function"&&R.UNSAFE_componentWillUpdate(m,Re,ee)),typeof R.componentDidUpdate=="function"&&(o.flags|=4),typeof R.getSnapshotBeforeUpdate=="function"&&(o.flags|=1024)):(typeof R.componentDidUpdate!="function"||B===r.memoizedProps&&me===r.memoizedState||(o.flags|=4),typeof R.getSnapshotBeforeUpdate!="function"||B===r.memoizedProps&&me===r.memoizedState||(o.flags|=1024),o.memoizedProps=m,o.memoizedState=Re),R.props=m,R.state=Re,R.context=ee,m=ae):(typeof R.componentDidUpdate!="function"||B===r.memoizedProps&&me===r.memoizedState||(o.flags|=4),typeof R.getSnapshotBeforeUpdate!="function"||B===r.memoizedProps&&me===r.memoizedState||(o.flags|=1024),m=!1)}return ef(r,o,c,m,x,v)}function ef(r,o,c,m,v,x){cx(r,o);var R=(o.flags&128)!==0;if(!m&&!R)return v&&m0(o,c,!1),Gr(r,o,x);m=o.stateNode,vA.current=o;var B=R&&typeof c.getDerivedStateFromError!="function"?null:m.render();return o.flags|=1,r!==null&&R?(o.child=di(o,r.child,null,x),o.child=di(o,null,B,x)):en(r,o,B,x),o.memoizedState=m.state,v&&m0(o,c,!0),o.child}function dx(r){var o=r.stateNode;o.pendingContext?h0(r,o.pendingContext,o.pendingContext!==o.context):o.context&&h0(r,o.context,!1),Ld(r,o.containerInfo)}function fx(r,o,c,m,v){return ui(),Rd(v),o.flags|=256,en(r,o,c,m),o.child}var tf={dehydrated:null,treeContext:null,retryLane:0};function nf(r){return{baseLanes:r,cachePool:null,transitions:null}}function hx(r,o,c){var m=o.pendingProps,v=bt.current,x=!1,R=(o.flags&128)!==0,B;if((B=R)||(B=r!==null&&r.memoizedState===null?!1:(v&2)!==0),B?(x=!0,o.flags&=-129):(r===null||r.memoizedState!==null)&&(v|=1),ft(bt,v&1),r===null)return Td(o),r=o.memoizedState,r!==null&&(r=r.dehydrated,r!==null)?((o.mode&1)===0?o.lanes=1:r.data==="$!"?o.lanes=8:o.lanes=1073741824,null):(R=m.children,r=m.fallback,x?(m=o.mode,x=o.child,R={mode:"hidden",children:R},(m&1)===0&&x!==null?(x.childLanes=0,x.pendingProps=R):x=Tc(R,m,0,null),r=fo(r,m,c,null),x.return=o,r.return=o,x.sibling=r,o.child=x,o.child.memoizedState=nf(c),o.memoizedState=tf,r):rf(o,R));if(v=r.memoizedState,v!==null&&(B=v.dehydrated,B!==null))return yA(r,o,R,m,B,v,c);if(x){x=m.fallback,R=o.mode,v=r.child,B=v.sibling;var ee={mode:"hidden",children:m.children};return(R&1)===0&&o.child!==v?(m=o.child,m.childLanes=0,m.pendingProps=ee,o.deletions=null):(m=Es(v,ee),m.subtreeFlags=v.subtreeFlags&14680064),B!==null?x=Es(B,x):(x=fo(x,R,c,null),x.flags|=2),x.return=o,m.return=o,m.sibling=x,o.child=m,m=x,x=o.child,R=r.child.memoizedState,R=R===null?nf(c):{baseLanes:R.baseLanes|c,cachePool:null,transitions:R.transitions},x.memoizedState=R,x.childLanes=r.childLanes&~c,o.memoizedState=tf,m}return x=r.child,r=x.sibling,m=Es(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 rf(r,o){return o=Tc({mode:"visible",children:o},r.mode,0,null),o.return=r,r.child=o}function gc(r,o,c,m){return m!==null&&Rd(m),di(o,r.child,null,c),r=rf(o,o.pendingProps.children),r.flags|=2,o.memoizedState=null,r}function yA(r,o,c,m,v,x,R){if(c)return o.flags&256?(o.flags&=-257,m=Qd(Error(n(422))),gc(r,o,R,m)):o.memoizedState!==null?(o.child=r.child,o.flags|=128,null):(x=m.fallback,v=o.mode,m=Tc({mode:"visible",children:m.children},v,0,null),x=fo(x,v,R,null),x.flags|=2,m.return=o,x.return=o,m.sibling=x,o.child=m,(o.mode&1)!==0&&di(o,r.child,null,R),o.child.memoizedState=nf(R),o.memoizedState=tf,x);if((o.mode&1)===0)return gc(r,o,R,null);if(v.data==="$!"){if(m=v.nextSibling&&v.nextSibling.dataset,m)var B=m.dgst;return m=B,x=Error(n(419)),m=Qd(x,m,void 0),gc(r,o,R,m)}if(B=(R&r.childLanes)!==0,ln||B){if(m=qt,m!==null){switch(R&-R){case 4:v=2;break;case 16:v=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:v=32;break;case 536870912:v=268435456;break;default:v=0}v=(v&(m.suspendedLanes|R))!==0?0:v,v!==0&&v!==x.retryLane&&(x.retryLane=v,Wr(r,v),tr(m,r,v,-1))}return xf(),m=Qd(Error(n(421))),gc(r,o,R,m)}return v.data==="$?"?(o.flags|=128,o.child=r.child,o=AA.bind(null,r),v._reactRetry=o,null):(r=x.treeContext,yn=ms(v.nextSibling),vn=o,gt=!0,Qn=null,r!==null&&(Tn[Rn++]=Br,Tn[Rn++]=Ur,Tn[Rn++]=no,Br=r.id,Ur=r.overflow,no=o),o=rf(o,m.children),o.flags|=4096,o)}function px(r,o,c){r.lanes|=o;var m=r.alternate;m!==null&&(m.lanes|=o),Od(r.return,o,c)}function sf(r,o,c,m,v){var x=r.memoizedState;x===null?r.memoizedState={isBackwards:o,rendering:null,renderingStartTime:0,last:m,tail:c,tailMode:v}:(x.isBackwards=o,x.rendering=null,x.renderingStartTime=0,x.last=m,x.tail=c,x.tailMode=v)}function mx(r,o,c){var m=o.pendingProps,v=m.revealOrder,x=m.tail;if(en(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&&px(r,c,o);else if(r.tag===19)px(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(bt,m),(o.mode&1)===0)o.memoizedState=null;else switch(v){case"forwards":for(c=o.child,v=null;c!==null;)r=c.alternate,r!==null&&cc(r)===null&&(v=c),c=c.sibling;c=v,c===null?(v=o.child,o.child=null):(v=c.sibling,c.sibling=null),sf(o,!1,v,c,x);break;case"backwards":for(c=null,v=o.child,o.child=null;v!==null;){if(r=v.alternate,r!==null&&cc(r)===null){o.child=v;break}r=v.sibling,v.sibling=c,c=v,v=r}sf(o,!0,c,null,x);break;case"together":sf(o,!1,null,null,void 0);break;default:o.memoizedState=null}return o.child}function vc(r,o){(o.mode&1)===0&&r!==null&&(r.alternate=null,o.alternate=null,o.flags|=2)}function Gr(r,o,c){if(r!==null&&(o.dependencies=r.dependencies),ao|=o.lanes,(c&o.childLanes)===0)return null;if(r!==null&&o.child!==r.child)throw Error(n(153));if(o.child!==null){for(r=o.child,c=Es(r,r.pendingProps),o.child=c,c.return=o;r.sibling!==null;)r=r.sibling,c=c.sibling=Es(r,r.pendingProps),c.return=o;c.sibling=null}return o.child}function wA(r,o,c){switch(o.tag){case 3:dx(o),ui();break;case 5:T0(o);break;case 1:an(o.type)&&Jl(o);break;case 4:Ld(o,o.stateNode.containerInfo);break;case 10:var m=o.type._context,v=o.memoizedProps.value;ft(oc,m._currentValue),m._currentValue=v;break;case 13:if(m=o.memoizedState,m!==null)return m.dehydrated!==null?(ft(bt,bt.current&1),o.flags|=128,null):(c&o.child.childLanes)!==0?hx(r,o,c):(ft(bt,bt.current&1),r=Gr(r,o,c),r!==null?r.sibling:null);ft(bt,bt.current&1);break;case 19:if(m=(c&o.childLanes)!==0,(r.flags&128)!==0){if(m)return mx(r,o,c);o.flags|=128}if(v=o.memoizedState,v!==null&&(v.rendering=null,v.tail=null,v.lastEffect=null),ft(bt,bt.current),m)break;return null;case 22:case 23:return o.lanes=0,lx(r,o,c)}return Gr(r,o,c)}var gx,of,vx,yx;gx=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}},of=function(){},vx=function(r,o,c,m){var v=r.memoizedProps;if(v!==m){r=o.stateNode,oo(xr.current);var x=null;switch(c){case"input":v=Le(r,v),m=Le(r,m),x=[];break;case"select":v=J({},v,{value:void 0}),m=J({},m,{value:void 0}),x=[];break;case"textarea":v=de(r,v),m=de(r,m),x=[];break;default:typeof v.onClick!="function"&&typeof m.onClick=="function"&&(r.onclick=Xl)}st(c,m);var R;c=null;for(ae in v)if(!m.hasOwnProperty(ae)&&v.hasOwnProperty(ae)&&v[ae]!=null)if(ae==="style"){var B=v[ae];for(R in B)B.hasOwnProperty(R)&&(c||(c={}),c[R]="")}else ae!=="dangerouslySetInnerHTML"&&ae!=="children"&&ae!=="suppressContentEditableWarning"&&ae!=="suppressHydrationWarning"&&ae!=="autoFocus"&&(i.hasOwnProperty(ae)?x||(x=[]):(x=x||[]).push(ae,null));for(ae in m){var ee=m[ae];if(B=v!=null?v[ae]:void 0,m.hasOwnProperty(ae)&&ee!==B&&(ee!=null||B!=null))if(ae==="style")if(B){for(R in B)!B.hasOwnProperty(R)||ee&&ee.hasOwnProperty(R)||(c||(c={}),c[R]="");for(R in ee)ee.hasOwnProperty(R)&&B[R]!==ee[R]&&(c||(c={}),c[R]=ee[R])}else c||(x||(x=[]),x.push(ae,c)),c=ee;else ae==="dangerouslySetInnerHTML"?(ee=ee?ee.__html:void 0,B=B?B.__html:void 0,ee!=null&&B!==ee&&(x=x||[]).push(ae,ee)):ae==="children"?typeof ee!="string"&&typeof ee!="number"||(x=x||[]).push(ae,""+ee):ae!=="suppressContentEditableWarning"&&ae!=="suppressHydrationWarning"&&(i.hasOwnProperty(ae)?(ee!=null&&ae==="onScroll"&&ht("scroll",r),x||B===ee||(x=[])):(x=x||[]).push(ae,ee))}c&&(x=x||[]).push("style",c);var ae=x;(o.updateQueue=ae)&&(o.flags|=4)}},yx=function(r,o,c,m){c!==m&&(o.flags|=4)};function Ma(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 Kt(r){var o=r.alternate!==null&&r.alternate.child===r.child,c=0,m=0;if(o)for(var v=r.child;v!==null;)c|=v.lanes|v.childLanes,m|=v.subtreeFlags&14680064,m|=v.flags&14680064,v.return=r,v=v.sibling;else for(v=r.child;v!==null;)c|=v.lanes|v.childLanes,m|=v.subtreeFlags,m|=v.flags,v.return=r,v=v.sibling;return r.subtreeFlags|=m,r.childLanes=c,o}function xA(r,o,c){var m=o.pendingProps;switch(Cd(o),o.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Kt(o),null;case 1:return an(o.type)&&Zl(),Kt(o),null;case 3:return m=o.stateNode,pi(),pt(on),pt(Vt),Fd(),m.pendingContext&&(m.context=m.pendingContext,m.pendingContext=null),(r===null||r.child===null)&&(rc(o)?o.flags|=4:r===null||r.memoizedState.isDehydrated&&(o.flags&256)===0||(o.flags|=1024,Qn!==null&&(vf(Qn),Qn=null))),of(r,o),Kt(o),null;case 5:qd(o);var v=oo(Ca.current);if(c=o.type,r!==null&&o.stateNode!=null)vx(r,o,c,m,v),r.ref!==o.ref&&(o.flags|=512,o.flags|=2097152);else{if(!m){if(o.stateNode===null)throw Error(n(166));return Kt(o),null}if(r=oo(xr.current),rc(o)){m=o.stateNode,c=o.type;var x=o.memoizedProps;switch(m[wr]=o,m[_a]=x,r=(o.mode&1)!==0,c){case"dialog":ht("cancel",m),ht("close",m);break;case"iframe":case"object":case"embed":ht("load",m);break;case"video":case"audio":for(v=0;v<wa.length;v++)ht(wa[v],m);break;case"source":ht("error",m);break;case"img":case"image":case"link":ht("error",m),ht("load",m);break;case"details":ht("toggle",m);break;case"input":ke(m,x),ht("invalid",m);break;case"select":m._wrapperState={wasMultiple:!!x.multiple},ht("invalid",m);break;case"textarea":_e(m,x),ht("invalid",m)}st(c,x),v=null;for(var R in x)if(x.hasOwnProperty(R)){var B=x[R];R==="children"?typeof B=="string"?m.textContent!==B&&(x.suppressHydrationWarning!==!0&&Kl(m.textContent,B,r),v=["children",B]):typeof B=="number"&&m.textContent!==""+B&&(x.suppressHydrationWarning!==!0&&Kl(m.textContent,B,r),v=["children",""+B]):i.hasOwnProperty(R)&&B!=null&&R==="onScroll"&&ht("scroll",m)}switch(c){case"input":Ce(m),xe(m,x,!0);break;case"textarea":Ce(m),Ge(m);break;case"select":case"option":break;default:typeof x.onClick=="function"&&(m.onclick=Xl)}m=v,o.updateQueue=m,m!==null&&(o.flags|=4)}else{R=v.nodeType===9?v:v.ownerDocument,r==="http://www.w3.org/1999/xhtml"&&(r=lt(c)),r==="http://www.w3.org/1999/xhtml"?c==="script"?(r=R.createElement("div"),r.innerHTML="<script><\/script>",r=r.removeChild(r.firstChild)):typeof m.is=="string"?r=R.createElement(c,{is:m.is}):(r=R.createElement(c),c==="select"&&(R=r,m.multiple?R.multiple=!0:m.size&&(R.size=m.size))):r=R.createElementNS(r,c),r[wr]=o,r[_a]=m,gx(r,o,!1,!1),o.stateNode=r;e:{switch(R=Ae(c,m),c){case"dialog":ht("cancel",r),ht("close",r),v=m;break;case"iframe":case"object":case"embed":ht("load",r),v=m;break;case"video":case"audio":for(v=0;v<wa.length;v++)ht(wa[v],r);v=m;break;case"source":ht("error",r),v=m;break;case"img":case"image":case"link":ht("error",r),ht("load",r),v=m;break;case"details":ht("toggle",r),v=m;break;case"input":ke(r,m),v=Le(r,m),ht("invalid",r);break;case"option":v=m;break;case"select":r._wrapperState={wasMultiple:!!m.multiple},v=J({},m,{value:void 0}),ht("invalid",r);break;case"textarea":_e(r,m),v=de(r,m),ht("invalid",r);break;default:v=m}st(c,v),B=v;for(x in B)if(B.hasOwnProperty(x)){var ee=B[x];x==="style"?Xe(r,ee):x==="dangerouslySetInnerHTML"?(ee=ee?ee.__html:void 0,ee!=null&&Ke(r,ee)):x==="children"?typeof ee=="string"?(c!=="textarea"||ee!=="")&&oe(r,ee):typeof ee=="number"&&oe(r,""+ee):x!=="suppressContentEditableWarning"&&x!=="suppressHydrationWarning"&&x!=="autoFocus"&&(i.hasOwnProperty(x)?ee!=null&&x==="onScroll"&&ht("scroll",r):ee!=null&&C(r,x,ee,R))}switch(c){case"input":Ce(r),xe(r,m,!1);break;case"textarea":Ce(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?at(r,!!m.multiple,x,!1):m.defaultValue!=null&&at(r,!!m.multiple,m.defaultValue,!0);break;default:typeof v.onClick=="function"&&(r.onclick=Xl)}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 Kt(o),null;case 6:if(r&&o.stateNode!=null)yx(r,o,r.memoizedProps,m);else{if(typeof m!="string"&&o.stateNode===null)throw Error(n(166));if(c=oo(Ca.current),oo(xr.current),rc(o)){if(m=o.stateNode,c=o.memoizedProps,m[wr]=o,(x=m.nodeValue!==c)&&(r=vn,r!==null))switch(r.tag){case 3:Kl(m.nodeValue,c,(r.mode&1)!==0);break;case 5:r.memoizedProps.suppressHydrationWarning!==!0&&Kl(m.nodeValue,c,(r.mode&1)!==0)}x&&(o.flags|=4)}else m=(c.nodeType===9?c:c.ownerDocument).createTextNode(m),m[wr]=o,o.stateNode=m}return Kt(o),null;case 13:if(pt(bt),m=o.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(gt&&yn!==null&&(o.mode&1)!==0&&(o.flags&128)===0)b0(),ui(),o.flags|=98560,x=!1;else if(x=rc(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[wr]=o}else ui(),(o.flags&128)===0&&(o.memoizedState=null),o.flags|=4;Kt(o),x=!1}else Qn!==null&&(vf(Qn),Qn=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?Pt===0&&(Pt=3):xf())),o.updateQueue!==null&&(o.flags|=4),Kt(o),null);case 4:return pi(),of(r,o),r===null&&xa(o.stateNode.containerInfo),Kt(o),null;case 10:return Id(o.type._context),Kt(o),null;case 17:return an(o.type)&&Zl(),Kt(o),null;case 19:if(pt(bt),x=o.memoizedState,x===null)return Kt(o),null;if(m=(o.flags&128)!==0,R=x.rendering,R===null)if(m)Ma(x,!1);else{if(Pt!==0||r!==null&&(r.flags&128)!==0)for(r=o.child;r!==null;){if(R=cc(r),R!==null){for(o.flags|=128,Ma(x,!1),m=R.updateQueue,m!==null&&(o.updateQueue=m,o.flags|=4),o.subtreeFlags=0,m=c,c=o.child;c!==null;)x=c,r=m,x.flags&=14680066,R=x.alternate,R===null?(x.childLanes=0,x.lanes=r,x.child=null,x.subtreeFlags=0,x.memoizedProps=null,x.memoizedState=null,x.updateQueue=null,x.dependencies=null,x.stateNode=null):(x.childLanes=R.childLanes,x.lanes=R.lanes,x.child=R.child,x.subtreeFlags=0,x.deletions=null,x.memoizedProps=R.memoizedProps,x.memoizedState=R.memoizedState,x.updateQueue=R.updateQueue,x.type=R.type,r=R.dependencies,x.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),c=c.sibling;return ft(bt,bt.current&1|2),o.child}r=r.sibling}x.tail!==null&&ot()>yi&&(o.flags|=128,m=!0,Ma(x,!1),o.lanes=4194304)}else{if(!m)if(r=cc(R),r!==null){if(o.flags|=128,m=!0,c=r.updateQueue,c!==null&&(o.updateQueue=c,o.flags|=4),Ma(x,!0),x.tail===null&&x.tailMode==="hidden"&&!R.alternate&&!gt)return Kt(o),null}else 2*ot()-x.renderingStartTime>yi&&c!==1073741824&&(o.flags|=128,m=!0,Ma(x,!1),o.lanes=4194304);x.isBackwards?(R.sibling=o.child,o.child=R):(c=x.last,c!==null?c.sibling=R:o.child=R,x.last=R)}return x.tail!==null?(o=x.tail,x.rendering=o,x.tail=o.sibling,x.renderingStartTime=ot(),o.sibling=null,c=bt.current,ft(bt,m?c&1|2:c&1),o):(Kt(o),null);case 22:case 23:return wf(),m=o.memoizedState!==null,r!==null&&r.memoizedState!==null!==m&&(o.flags|=8192),m&&(o.mode&1)!==0?(wn&1073741824)!==0&&(Kt(o),o.subtreeFlags&6&&(o.flags|=8192)):Kt(o),null;case 24:return null;case 25:return null}throw Error(n(156,o.tag))}function bA(r,o){switch(Cd(o),o.tag){case 1:return an(o.type)&&Zl(),r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 3:return pi(),pt(on),pt(Vt),Fd(),r=o.flags,(r&65536)!==0&&(r&128)===0?(o.flags=r&-65537|128,o):null;case 5:return qd(o),null;case 13:if(pt(bt),r=o.memoizedState,r!==null&&r.dehydrated!==null){if(o.alternate===null)throw Error(n(340));ui()}return r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 19:return pt(bt),null;case 4:return pi(),null;case 10:return Id(o.type._context),null;case 22:case 23:return wf(),null;case 24:return null;default:return null}}var yc=!1,Xt=!1,_A=typeof WeakSet=="function"?WeakSet:Set,Ee=null;function gi(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 af(r,o,c){try{c()}catch(m){St(r,o,m)}}var wx=!1;function kA(r,o){if(yd=Bs,r=ti(),qr(r)){if("selectionStart"in r)var c={start:r.selectionStart,end:r.selectionEnd};else e:{c=(c=r.ownerDocument)&&c.defaultView||window;var m=c.getSelection&&c.getSelection();if(m&&m.rangeCount!==0){c=m.anchorNode;var v=m.anchorOffset,x=m.focusNode;m=m.focusOffset;try{c.nodeType,x.nodeType}catch{c=null;break e}var R=0,B=-1,ee=-1,ae=0,ge=0,ve=r,me=null;t:for(;;){for(var Se;ve!==c||v!==0&&ve.nodeType!==3||(B=R+v),ve!==x||m!==0&&ve.nodeType!==3||(ee=R+m),ve.nodeType===3&&(R+=ve.nodeValue.length),(Se=ve.firstChild)!==null;)me=ve,ve=Se;for(;;){if(ve===r)break t;if(me===c&&++ae===v&&(B=R),me===x&&++ge===m&&(ee=R),(Se=ve.nextSibling)!==null)break;ve=me,me=ve.parentNode}ve=Se}c=B===-1||ee===-1?null:{start:B,end:ee}}else c=null}c=c||{start:0,end:0}}else c=null;for(wd={focusedElem:r,selectionRange:c},Bs=!1,Ee=o;Ee!==null;)if(o=Ee,r=o.child,(o.subtreeFlags&1028)!==0&&r!==null)r.return=o,Ee=r;else for(;Ee!==null;){o=Ee;try{var Re=o.alternate;if((o.flags&1024)!==0)switch(o.tag){case 0:case 11:case 15:break;case 1:if(Re!==null){var Me=Re.memoizedProps,Ct=Re.memoizedState,se=o.stateNode,te=se.getSnapshotBeforeUpdate(o.elementType===o.type?Me:Zn(o.type,Me),Ct);se.__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(ye){St(o,o.return,ye)}if(r=o.sibling,r!==null){r.return=o.return,Ee=r;break}Ee=o.return}return Re=wx,wx=!1,Re}function Ia(r,o,c){var m=o.updateQueue;if(m=m!==null?m.lastEffect:null,m!==null){var v=m=m.next;do{if((v.tag&r)===r){var x=v.destroy;v.destroy=void 0,x!==void 0&&af(o,c,x)}v=v.next}while(v!==m)}}function wc(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 lf(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 xx(r){var o=r.alternate;o!==null&&(r.alternate=null,xx(o)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(o=r.stateNode,o!==null&&(delete o[wr],delete o[_a],delete o[kd],delete o[oA],delete o[iA])),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 bx(r){return r.tag===5||r.tag===3||r.tag===4}function _x(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||bx(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 cf(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=Xl));else if(m!==4&&(r=r.child,r!==null))for(cf(r,o,c),r=r.sibling;r!==null;)cf(r,o,c),r=r.sibling}function uf(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(uf(r,o,c),r=r.sibling;r!==null;)uf(r,o,c),r=r.sibling}var Bt=null,Jn=!1;function bs(r,o,c){for(c=c.child;c!==null;)kx(r,o,c),c=c.sibling}function kx(r,o,c){if(nn&&typeof nn.onCommitFiberUnmount=="function")try{nn.onCommitFiberUnmount(xt,c)}catch{}switch(c.tag){case 5:Xt||gi(c,o);case 6:var m=Bt,v=Jn;Bt=null,bs(r,o,c),Bt=m,Jn=v,Bt!==null&&(Jn?(r=Bt,c=c.stateNode,r.nodeType===8?r.parentNode.removeChild(c):r.removeChild(c)):Bt.removeChild(c.stateNode));break;case 18:Bt!==null&&(Jn?(r=Bt,c=c.stateNode,r.nodeType===8?_d(r.parentNode,c):r.nodeType===1&&_d(r,c),cs(r)):_d(Bt,c.stateNode));break;case 4:m=Bt,v=Jn,Bt=c.stateNode.containerInfo,Jn=!0,bs(r,o,c),Bt=m,Jn=v;break;case 0:case 11:case 14:case 15:if(!Xt&&(m=c.updateQueue,m!==null&&(m=m.lastEffect,m!==null))){v=m=m.next;do{var x=v,R=x.destroy;x=x.tag,R!==void 0&&((x&2)!==0||(x&4)!==0)&&af(c,o,R),v=v.next}while(v!==m)}bs(r,o,c);break;case 1:if(!Xt&&(gi(c,o),m=c.stateNode,typeof m.componentWillUnmount=="function"))try{m.props=c.memoizedProps,m.state=c.memoizedState,m.componentWillUnmount()}catch(B){St(c,o,B)}bs(r,o,c);break;case 21:bs(r,o,c);break;case 22:c.mode&1?(Xt=(m=Xt)||c.memoizedState!==null,bs(r,o,c),Xt=m):bs(r,o,c);break;default:bs(r,o,c)}}function Sx(r){var o=r.updateQueue;if(o!==null){r.updateQueue=null;var c=r.stateNode;c===null&&(c=r.stateNode=new _A),o.forEach(function(m){var v=MA.bind(null,r,m);c.has(m)||(c.add(m),m.then(v,v))})}}function er(r,o){var c=o.deletions;if(c!==null)for(var m=0;m<c.length;m++){var v=c[m];try{var x=r,R=o,B=R;e:for(;B!==null;){switch(B.tag){case 5:Bt=B.stateNode,Jn=!1;break e;case 3:Bt=B.stateNode.containerInfo,Jn=!0;break e;case 4:Bt=B.stateNode.containerInfo,Jn=!0;break e}B=B.return}if(Bt===null)throw Error(n(160));kx(x,R,v),Bt=null,Jn=!1;var ee=v.alternate;ee!==null&&(ee.return=null),v.return=null}catch(ae){St(v,o,ae)}}if(o.subtreeFlags&12854)for(o=o.child;o!==null;)Nx(o,r),o=o.sibling}function Nx(r,o){var c=r.alternate,m=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:if(er(o,r),_r(r),m&4){try{Ia(3,r,r.return),wc(3,r)}catch(Me){St(r,r.return,Me)}try{Ia(5,r,r.return)}catch(Me){St(r,r.return,Me)}}break;case 1:er(o,r),_r(r),m&512&&c!==null&&gi(c,c.return);break;case 5:if(er(o,r),_r(r),m&512&&c!==null&&gi(c,c.return),r.flags&32){var v=r.stateNode;try{oe(v,"")}catch(Me){St(r,r.return,Me)}}if(m&4&&(v=r.stateNode,v!=null)){var x=r.memoizedProps,R=c!==null?c.memoizedProps:x,B=r.type,ee=r.updateQueue;if(r.updateQueue=null,ee!==null)try{B==="input"&&x.type==="radio"&&x.name!=null&&ce(v,x),Ae(B,R);var ae=Ae(B,x);for(R=0;R<ee.length;R+=2){var ge=ee[R],ve=ee[R+1];ge==="style"?Xe(v,ve):ge==="dangerouslySetInnerHTML"?Ke(v,ve):ge==="children"?oe(v,ve):C(v,ge,ve,ae)}switch(B){case"input":be(v,x);break;case"textarea":De(v,x);break;case"select":var me=v._wrapperState.wasMultiple;v._wrapperState.wasMultiple=!!x.multiple;var Se=x.value;Se!=null?at(v,!!x.multiple,Se,!1):me!==!!x.multiple&&(x.defaultValue!=null?at(v,!!x.multiple,x.defaultValue,!0):at(v,!!x.multiple,x.multiple?[]:"",!1))}v[_a]=x}catch(Me){St(r,r.return,Me)}}break;case 6:if(er(o,r),_r(r),m&4){if(r.stateNode===null)throw Error(n(162));v=r.stateNode,x=r.memoizedProps;try{v.nodeValue=x}catch(Me){St(r,r.return,Me)}}break;case 3:if(er(o,r),_r(r),m&4&&c!==null&&c.memoizedState.isDehydrated)try{cs(o.containerInfo)}catch(Me){St(r,r.return,Me)}break;case 4:er(o,r),_r(r);break;case 13:er(o,r),_r(r),v=r.child,v.flags&8192&&(x=v.memoizedState!==null,v.stateNode.isHidden=x,!x||v.alternate!==null&&v.alternate.memoizedState!==null||(hf=ot())),m&4&&Sx(r);break;case 22:if(ge=c!==null&&c.memoizedState!==null,r.mode&1?(Xt=(ae=Xt)||ge,er(o,r),Xt=ae):er(o,r),_r(r),m&8192){if(ae=r.memoizedState!==null,(r.stateNode.isHidden=ae)&&!ge&&(r.mode&1)!==0)for(Ee=r,ge=r.child;ge!==null;){for(ve=Ee=ge;Ee!==null;){switch(me=Ee,Se=me.child,me.tag){case 0:case 11:case 14:case 15:Ia(4,me,me.return);break;case 1:gi(me,me.return);var Re=me.stateNode;if(typeof Re.componentWillUnmount=="function"){m=me,c=me.return;try{o=m,Re.props=o.memoizedProps,Re.state=o.memoizedState,Re.componentWillUnmount()}catch(Me){St(m,c,Me)}}break;case 5:gi(me,me.return);break;case 22:if(me.memoizedState!==null){jx(ve);continue}}Se!==null?(Se.return=me,Ee=Se):jx(ve)}ge=ge.sibling}e:for(ge=null,ve=r;;){if(ve.tag===5){if(ge===null){ge=ve;try{v=ve.stateNode,ae?(x=v.style,typeof x.setProperty=="function"?x.setProperty("display","none","important"):x.display="none"):(B=ve.stateNode,ee=ve.memoizedProps.style,R=ee!=null&&ee.hasOwnProperty("display")?ee.display:null,B.style.display=Te("display",R))}catch(Me){St(r,r.return,Me)}}}else if(ve.tag===6){if(ge===null)try{ve.stateNode.nodeValue=ae?"":ve.memoizedProps}catch(Me){St(r,r.return,Me)}}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;ge===ve&&(ge=null),ve=ve.return}ge===ve&&(ge=null),ve.sibling.return=ve.return,ve=ve.sibling}}break;case 19:er(o,r),_r(r),m&4&&Sx(r);break;case 21:break;default:er(o,r),_r(r)}}function _r(r){var o=r.flags;if(o&2){try{e:{for(var c=r.return;c!==null;){if(bx(c)){var m=c;break e}c=c.return}throw Error(n(160))}switch(m.tag){case 5:var v=m.stateNode;m.flags&32&&(oe(v,""),m.flags&=-33);var x=_x(r);uf(r,x,v);break;case 3:case 4:var R=m.stateNode.containerInfo,B=_x(r);cf(r,B,R);break;default:throw Error(n(161))}}catch(ee){St(r,r.return,ee)}r.flags&=-3}o&4096&&(r.flags&=-4097)}function SA(r,o,c){Ee=r,Ex(r)}function Ex(r,o,c){for(var m=(r.mode&1)!==0;Ee!==null;){var v=Ee,x=v.child;if(v.tag===22&&m){var R=v.memoizedState!==null||yc;if(!R){var B=v.alternate,ee=B!==null&&B.memoizedState!==null||Xt;B=yc;var ae=Xt;if(yc=R,(Xt=ee)&&!ae)for(Ee=v;Ee!==null;)R=Ee,ee=R.child,R.tag===22&&R.memoizedState!==null?Tx(v):ee!==null?(ee.return=R,Ee=ee):Tx(v);for(;x!==null;)Ee=x,Ex(x),x=x.sibling;Ee=v,yc=B,Xt=ae}Cx(r)}else(v.subtreeFlags&8772)!==0&&x!==null?(x.return=v,Ee=x):Cx(r)}}function Cx(r){for(;Ee!==null;){var o=Ee;if((o.flags&8772)!==0){var c=o.alternate;try{if((o.flags&8772)!==0)switch(o.tag){case 0:case 11:case 15:Xt||wc(5,o);break;case 1:var m=o.stateNode;if(o.flags&4&&!Xt)if(c===null)m.componentDidMount();else{var v=o.elementType===o.type?c.memoizedProps:Zn(o.type,c.memoizedProps);m.componentDidUpdate(v,c.memoizedState,m.__reactInternalSnapshotBeforeUpdate)}var x=o.updateQueue;x!==null&&j0(o,x,m);break;case 3:var R=o.updateQueue;if(R!==null){if(c=null,o.child!==null)switch(o.child.tag){case 5:c=o.child.stateNode;break;case 1:c=o.child.stateNode}j0(o,R,c)}break;case 5:var B=o.stateNode;if(c===null&&o.flags&4){c=B;var ee=o.memoizedProps;switch(o.type){case"button":case"input":case"select":case"textarea":ee.autoFocus&&c.focus();break;case"img":ee.src&&(c.src=ee.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(o.memoizedState===null){var ae=o.alternate;if(ae!==null){var ge=ae.memoizedState;if(ge!==null){var ve=ge.dehydrated;ve!==null&&cs(ve)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}Xt||o.flags&512&&lf(o)}catch(me){St(o,o.return,me)}}if(o===r){Ee=null;break}if(c=o.sibling,c!==null){c.return=o.return,Ee=c;break}Ee=o.return}}function jx(r){for(;Ee!==null;){var o=Ee;if(o===r){Ee=null;break}var c=o.sibling;if(c!==null){c.return=o.return,Ee=c;break}Ee=o.return}}function Tx(r){for(;Ee!==null;){var o=Ee;try{switch(o.tag){case 0:case 11:case 15:var c=o.return;try{wc(4,o)}catch(ee){St(o,c,ee)}break;case 1:var m=o.stateNode;if(typeof m.componentDidMount=="function"){var v=o.return;try{m.componentDidMount()}catch(ee){St(o,v,ee)}}var x=o.return;try{lf(o)}catch(ee){St(o,x,ee)}break;case 5:var R=o.return;try{lf(o)}catch(ee){St(o,R,ee)}}}catch(ee){St(o,o.return,ee)}if(o===r){Ee=null;break}var B=o.sibling;if(B!==null){B.return=o.return,Ee=B;break}Ee=o.return}}var NA=Math.ceil,xc=j.ReactCurrentDispatcher,df=j.ReactCurrentOwner,In=j.ReactCurrentBatchConfig,tt=0,qt=null,Tt=null,Ut=0,wn=0,vi=gs(0),Pt=0,Oa=null,ao=0,bc=0,ff=0,Pa=null,cn=null,hf=0,yi=1/0,Vr=null,_c=!1,pf=null,_s=null,kc=!1,ks=null,Sc=0,$a=0,mf=null,Nc=-1,Ec=0;function tn(){return(tt&6)!==0?ot():Nc!==-1?Nc:Nc=ot()}function Ss(r){return(r.mode&1)===0?1:(tt&2)!==0&&Ut!==0?Ut&-Ut:lA.transition!==null?(Ec===0&&(Ec=Fs()),Ec):(r=Je,r!==0||(r=window.event,r=r===void 0?16:Ko(r.type)),r)}function tr(r,o,c,m){if(50<$a)throw $a=0,mf=null,Error(n(185));is(r,c,m),((tt&2)===0||r!==qt)&&(r===qt&&((tt&2)===0&&(bc|=c),Pt===4&&Ns(r,Ut)),un(r,m),c===1&&tt===0&&(o.mode&1)===0&&(yi=ot()+500,ec&&ys()))}function un(r,o){var c=r.callbackNode;jl(r,o);var m=Ds(r,r===qt?Ut:0);if(m===0)c!==null&&qs(c),r.callbackNode=null,r.callbackPriority=0;else if(o=m&-m,r.callbackPriority!==o){if(c!=null&&qs(c),o===1)r.tag===0?aA(Ax.bind(null,r)):g0(Ax.bind(null,r)),rA(function(){(tt&6)===0&&ys()}),c=null;else{switch(ea(m)){case 1:c=ns;break;case 4:c=Ht;break;case 16:c=Un;break;case 536870912:c=rs;break;default:c=Un}c=Dx(c,Rx.bind(null,r))}r.callbackPriority=o,r.callbackNode=c}}function Rx(r,o){if(Nc=-1,Ec=0,(tt&6)!==0)throw Error(n(327));var c=r.callbackNode;if(wi()&&r.callbackNode!==c)return null;var m=Ds(r,r===qt?Ut:0);if(m===0)return null;if((m&30)!==0||(m&r.expiredLanes)!==0||o)o=Cc(r,m);else{o=m;var v=tt;tt|=2;var x=Ix();(qt!==r||Ut!==o)&&(Vr=null,yi=ot()+500,co(r,o));do try{jA();break}catch(B){Mx(r,B)}while(!0);Md(),xc.current=x,tt=v,Tt!==null?o=0:(qt=null,Ut=0,o=Pt)}if(o!==0){if(o===2&&(v=Bo(r),v!==0&&(m=v,o=gf(r,v))),o===1)throw c=Oa,co(r,0),Ns(r,m),un(r,ot()),c;if(o===6)Ns(r,m);else{if(v=r.current.alternate,(m&30)===0&&!EA(v)&&(o=Cc(r,m),o===2&&(x=Bo(r),x!==0&&(m=x,o=gf(r,x))),o===1))throw c=Oa,co(r,0),Ns(r,m),un(r,ot()),c;switch(r.finishedWork=v,r.finishedLanes=m,o){case 0:case 1:throw Error(n(345));case 2:uo(r,cn,Vr);break;case 3:if(Ns(r,m),(m&130023424)===m&&(o=hf+500-ot(),10<o)){if(Ds(r,0)!==0)break;if(v=r.suspendedLanes,(v&m)!==m){tn(),r.pingedLanes|=r.suspendedLanes&v;break}r.timeoutHandle=bd(uo.bind(null,r,cn,Vr),o);break}uo(r,cn,Vr);break;case 4:if(Ns(r,m),(m&4194240)===m)break;for(o=r.eventTimes,v=-1;0<m;){var R=31-mn(m);x=1<<R,R=o[R],R>v&&(v=R),m&=~x}if(m=v,m=ot()-m,m=(120>m?120:480>m?480:1080>m?1080:1920>m?1920:3e3>m?3e3:4320>m?4320:1960*NA(m/1960))-m,10<m){r.timeoutHandle=bd(uo.bind(null,r,cn,Vr),m);break}uo(r,cn,Vr);break;case 5:uo(r,cn,Vr);break;default:throw Error(n(329))}}}return un(r,ot()),r.callbackNode===c?Rx.bind(null,r):null}function gf(r,o){var c=Pa;return r.current.memoizedState.isDehydrated&&(co(r,o).flags|=256),r=Cc(r,o),r!==2&&(o=cn,cn=c,o!==null&&vf(o)),r}function vf(r){cn===null?cn=r:cn.push.apply(cn,r)}function EA(r){for(var o=r;;){if(o.flags&16384){var c=o.updateQueue;if(c!==null&&(c=c.stores,c!==null))for(var m=0;m<c.length;m++){var v=c[m],x=v.getSnapshot;v=v.value;try{if(!sn(x(),v))return!1}catch{return!1}}}if(c=o.child,o.subtreeFlags&16384&&c!==null)c.return=o,o=c;else{if(o===r)break;for(;o.sibling===null;){if(o.return===null||o.return===r)return!0;o=o.return}o.sibling.return=o.return,o=o.sibling}}return!0}function Ns(r,o){for(o&=~ff,o&=~bc,r.suspendedLanes|=o,r.pingedLanes&=~o,r=r.expirationTimes;0<o;){var c=31-mn(o),m=1<<c;r[c]=-1,o&=~m}}function Ax(r){if((tt&6)!==0)throw Error(n(327));wi();var o=Ds(r,0);if((o&1)===0)return un(r,ot()),null;var c=Cc(r,o);if(r.tag!==0&&c===2){var m=Bo(r);m!==0&&(o=m,c=gf(r,m))}if(c===1)throw c=Oa,co(r,0),Ns(r,o),un(r,ot()),c;if(c===6)throw Error(n(345));return r.finishedWork=r.current.alternate,r.finishedLanes=o,uo(r,cn,Vr),un(r,ot()),null}function yf(r,o){var c=tt;tt|=1;try{return r(o)}finally{tt=c,tt===0&&(yi=ot()+500,ec&&ys())}}function lo(r){ks!==null&&ks.tag===0&&(tt&6)===0&&wi();var o=tt;tt|=1;var c=In.transition,m=Je;try{if(In.transition=null,Je=1,r)return r()}finally{Je=m,In.transition=c,tt=o,(tt&6)===0&&ys()}}function wf(){wn=vi.current,pt(vi)}function co(r,o){r.finishedWork=null,r.finishedLanes=0;var c=r.timeoutHandle;if(c!==-1&&(r.timeoutHandle=-1,nA(c)),Tt!==null)for(c=Tt.return;c!==null;){var m=c;switch(Cd(m),m.tag){case 1:m=m.type.childContextTypes,m!=null&&Zl();break;case 3:pi(),pt(on),pt(Vt),Fd();break;case 5:qd(m);break;case 4:pi();break;case 13:pt(bt);break;case 19:pt(bt);break;case 10:Id(m.type._context);break;case 22:case 23:wf()}c=c.return}if(qt=r,Tt=r=Es(r.current,null),Ut=wn=o,Pt=0,Oa=null,ff=bc=ao=0,cn=Pa=null,so!==null){for(o=0;o<so.length;o++)if(c=so[o],m=c.interleaved,m!==null){c.interleaved=null;var v=m.next,x=c.pending;if(x!==null){var R=x.next;x.next=v,m.next=R}c.pending=m}so=null}return r}function Mx(r,o){do{var c=Tt;try{if(Md(),uc.current=pc,dc){for(var m=_t.memoizedState;m!==null;){var v=m.queue;v!==null&&(v.pending=null),m=m.next}dc=!1}if(io=0,Lt=Ot=_t=null,ja=!1,Ta=0,df.current=null,c===null||c.return===null){Pt=1,Oa=o,Tt=null;break}e:{var x=r,R=c.return,B=c,ee=o;if(o=Ut,B.flags|=32768,ee!==null&&typeof ee=="object"&&typeof ee.then=="function"){var ae=ee,ge=B,ve=ge.tag;if((ge.mode&1)===0&&(ve===0||ve===11||ve===15)){var me=ge.alternate;me?(ge.updateQueue=me.updateQueue,ge.memoizedState=me.memoizedState,ge.lanes=me.lanes):(ge.updateQueue=null,ge.memoizedState=null)}var Se=rx(R);if(Se!==null){Se.flags&=-257,sx(Se,R,B,x,o),Se.mode&1&&nx(x,ae,o),o=Se,ee=ae;var Re=o.updateQueue;if(Re===null){var Me=new Set;Me.add(ee),o.updateQueue=Me}else Re.add(ee);break e}else{if((o&1)===0){nx(x,ae,o),xf();break e}ee=Error(n(426))}}else if(gt&&B.mode&1){var Ct=rx(R);if(Ct!==null){(Ct.flags&65536)===0&&(Ct.flags|=256),sx(Ct,R,B,x,o),Rd(mi(ee,B));break e}}x=ee=mi(ee,B),Pt!==4&&(Pt=2),Pa===null?Pa=[x]:Pa.push(x),x=R;do{switch(x.tag){case 3:x.flags|=65536,o&=-o,x.lanes|=o;var se=ex(x,ee,o);C0(x,se);break e;case 1:B=ee;var te=x.type,ie=x.stateNode;if((x.flags&128)===0&&(typeof te.getDerivedStateFromError=="function"||ie!==null&&typeof ie.componentDidCatch=="function"&&(_s===null||!_s.has(ie)))){x.flags|=65536,o&=-o,x.lanes|=o;var ye=tx(x,B,o);C0(x,ye);break e}}x=x.return}while(x!==null)}Px(c)}catch($e){o=$e,Tt===c&&c!==null&&(Tt=c=c.return);continue}break}while(!0)}function Ix(){var r=xc.current;return xc.current=pc,r===null?pc:r}function xf(){(Pt===0||Pt===3||Pt===2)&&(Pt=4),qt===null||(ao&268435455)===0&&(bc&268435455)===0||Ns(qt,Ut)}function Cc(r,o){var c=tt;tt|=2;var m=Ix();(qt!==r||Ut!==o)&&(Vr=null,co(r,o));do try{CA();break}catch(v){Mx(r,v)}while(!0);if(Md(),tt=c,xc.current=m,Tt!==null)throw Error(n(261));return qt=null,Ut=0,Pt}function CA(){for(;Tt!==null;)Ox(Tt)}function jA(){for(;Tt!==null&&!$o();)Ox(Tt)}function Ox(r){var o=qx(r.alternate,r,wn);r.memoizedProps=r.pendingProps,o===null?Px(r):Tt=o,df.current=null}function Px(r){var o=r;do{var c=o.alternate;if(r=o.return,(o.flags&32768)===0){if(c=xA(c,o,wn),c!==null){Tt=c;return}}else{if(c=bA(c,o),c!==null){c.flags&=32767,Tt=c;return}if(r!==null)r.flags|=32768,r.subtreeFlags=0,r.deletions=null;else{Pt=6,Tt=null;return}}if(o=o.sibling,o!==null){Tt=o;return}Tt=o=r}while(o!==null);Pt===0&&(Pt=5)}function uo(r,o,c){var m=Je,v=In.transition;try{In.transition=null,Je=1,TA(r,o,c,m)}finally{In.transition=v,Je=m}return null}function TA(r,o,c,m){do wi();while(ks!==null);if((tt&6)!==0)throw Error(n(327));c=r.finishedWork;var v=r.finishedLanes;if(c===null)return null;if(r.finishedWork=null,r.finishedLanes=0,c===r.current)throw Error(n(177));r.callbackNode=null,r.callbackPriority=0;var x=c.lanes|c.childLanes;if(Qt(r,x),r===qt&&(Tt=qt=null,Ut=0),(c.subtreeFlags&2064)===0&&(c.flags&2064)===0||kc||(kc=!0,Dx(Un,function(){return wi(),null})),x=(c.flags&15990)!==0,(c.subtreeFlags&15990)!==0||x){x=In.transition,In.transition=null;var R=Je;Je=1;var B=tt;tt|=4,df.current=null,kA(r,c),Nx(c,r),Js(wd),Bs=!!yd,wd=yd=null,r.current=c,SA(c),Lo(),tt=B,Je=R,In.transition=x}else r.current=c;if(kc&&(kc=!1,ks=r,Sc=v),x=r.pendingLanes,x===0&&(_s=null),Wn(c.stateNode),un(r,ot()),o!==null)for(m=r.onRecoverableError,c=0;c<o.length;c++)v=o[c],m(v.value,{componentStack:v.stack,digest:v.digest});if(_c)throw _c=!1,r=pf,pf=null,r;return(Sc&1)!==0&&r.tag!==0&&wi(),x=r.pendingLanes,(x&1)!==0?r===mf?$a++:($a=0,mf=r):$a=0,ys(),null}function wi(){if(ks!==null){var r=ea(Sc),o=In.transition,c=Je;try{if(In.transition=null,Je=16>r?16:r,ks===null)var m=!1;else{if(r=ks,ks=null,Sc=0,(tt&6)!==0)throw Error(n(331));var v=tt;for(tt|=4,Ee=r.current;Ee!==null;){var x=Ee,R=x.child;if((Ee.flags&16)!==0){var B=x.deletions;if(B!==null){for(var ee=0;ee<B.length;ee++){var ae=B[ee];for(Ee=ae;Ee!==null;){var ge=Ee;switch(ge.tag){case 0:case 11:case 15:Ia(8,ge,x)}var ve=ge.child;if(ve!==null)ve.return=ge,Ee=ve;else for(;Ee!==null;){ge=Ee;var me=ge.sibling,Se=ge.return;if(xx(ge),ge===ae){Ee=null;break}if(me!==null){me.return=Se,Ee=me;break}Ee=Se}}}var Re=x.alternate;if(Re!==null){var Me=Re.child;if(Me!==null){Re.child=null;do{var Ct=Me.sibling;Me.sibling=null,Me=Ct}while(Me!==null)}}Ee=x}}if((x.subtreeFlags&2064)!==0&&R!==null)R.return=x,Ee=R;else e:for(;Ee!==null;){if(x=Ee,(x.flags&2048)!==0)switch(x.tag){case 0:case 11:case 15:Ia(9,x,x.return)}var se=x.sibling;if(se!==null){se.return=x.return,Ee=se;break e}Ee=x.return}}var te=r.current;for(Ee=te;Ee!==null;){R=Ee;var ie=R.child;if((R.subtreeFlags&2064)!==0&&ie!==null)ie.return=R,Ee=ie;else e:for(R=te;Ee!==null;){if(B=Ee,(B.flags&2048)!==0)try{switch(B.tag){case 0:case 11:case 15:wc(9,B)}}catch($e){St(B,B.return,$e)}if(B===R){Ee=null;break e}var ye=B.sibling;if(ye!==null){ye.return=B.return,Ee=ye;break e}Ee=B.return}}if(tt=v,ys(),nn&&typeof nn.onPostCommitFiberRoot=="function")try{nn.onPostCommitFiberRoot(xt,r)}catch{}m=!0}return m}finally{Je=c,In.transition=o}}return!1}function $x(r,o,c){o=mi(c,o),o=ex(r,o,1),r=xs(r,o,1),o=tn(),r!==null&&(is(r,1,o),un(r,o))}function St(r,o,c){if(r.tag===3)$x(r,r,c);else for(;o!==null;){if(o.tag===3){$x(o,r,c);break}else if(o.tag===1){var m=o.stateNode;if(typeof o.type.getDerivedStateFromError=="function"||typeof m.componentDidCatch=="function"&&(_s===null||!_s.has(m))){r=mi(c,r),r=tx(o,r,1),o=xs(o,r,1),r=tn(),o!==null&&(is(o,1,r),un(o,r));break}}o=o.return}}function RA(r,o,c){var m=r.pingCache;m!==null&&m.delete(o),o=tn(),r.pingedLanes|=r.suspendedLanes&c,qt===r&&(Ut&c)===c&&(Pt===4||Pt===3&&(Ut&130023424)===Ut&&500>ot()-hf?co(r,0):ff|=c),un(r,o)}function Lx(r,o){o===0&&((r.mode&1)===0?o=1:(o=zo,zo<<=1,(zo&130023424)===0&&(zo=4194304)));var c=tn();r=Wr(r,o),r!==null&&(is(r,o,c),un(r,c))}function AA(r){var o=r.memoizedState,c=0;o!==null&&(c=o.retryLane),Lx(r,c)}function MA(r,o){var c=0;switch(r.tag){case 13:var m=r.stateNode,v=r.memoizedState;v!==null&&(c=v.retryLane);break;case 19:m=r.stateNode;break;default:throw Error(n(314))}m!==null&&m.delete(o),Lx(r,c)}var qx;qx=function(r,o,c){if(r!==null)if(r.memoizedProps!==o.pendingProps||on.current)ln=!0;else{if((r.lanes&c)===0&&(o.flags&128)===0)return ln=!1,wA(r,o,c);ln=(r.flags&131072)!==0}else ln=!1,gt&&(o.flags&1048576)!==0&&v0(o,nc,o.index);switch(o.lanes=0,o.tag){case 2:var m=o.type;vc(r,o),r=o.pendingProps;var v=ai(o,Vt.current);hi(o,c),v=Ud(null,o,m,r,v,c);var x=Wd();return o.flags|=1,typeof v=="object"&&v!==null&&typeof v.render=="function"&&v.$$typeof===void 0?(o.tag=1,o.memoizedState=null,o.updateQueue=null,an(m)?(x=!0,Jl(o)):x=!1,o.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,$d(o),v.updater=mc,o.stateNode=v,v._reactInternals=o,Xd(o,m,r,c),o=ef(null,o,m,!0,x,c)):(o.tag=0,gt&&x&&Ed(o),en(null,o,v,c),o=o.child),o;case 16:m=o.elementType;e:{switch(vc(r,o),r=o.pendingProps,v=m._init,m=v(m._payload),o.type=m,v=o.tag=OA(m),r=Zn(m,r),v){case 0:o=Jd(null,o,m,r,c);break e;case 1:o=ux(null,o,m,r,c);break e;case 11:o=ox(null,o,m,r,c);break e;case 14:o=ix(null,o,m,Zn(m.type,r),c);break e}throw Error(n(306,m,""))}return o;case 0:return m=o.type,v=o.pendingProps,v=o.elementType===m?v:Zn(m,v),Jd(r,o,m,v,c);case 1:return m=o.type,v=o.pendingProps,v=o.elementType===m?v:Zn(m,v),ux(r,o,m,v,c);case 3:e:{if(dx(o),r===null)throw Error(n(387));m=o.pendingProps,x=o.memoizedState,v=x.element,E0(r,o),lc(o,m,null,c);var R=o.memoizedState;if(m=R.element,x.isDehydrated)if(x={element:m,isDehydrated:!1,cache:R.cache,pendingSuspenseBoundaries:R.pendingSuspenseBoundaries,transitions:R.transitions},o.updateQueue.baseState=x,o.memoizedState=x,o.flags&256){v=mi(Error(n(423)),o),o=fx(r,o,m,c,v);break e}else if(m!==v){v=mi(Error(n(424)),o),o=fx(r,o,m,c,v);break e}else for(yn=ms(o.stateNode.containerInfo.firstChild),vn=o,gt=!0,Qn=null,c=S0(o,null,m,c),o.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling;else{if(ui(),m===v){o=Gr(r,o,c);break e}en(r,o,m,c)}o=o.child}return o;case 5:return T0(o),r===null&&Td(o),m=o.type,v=o.pendingProps,x=r!==null?r.memoizedProps:null,R=v.children,xd(m,v)?R=null:x!==null&&xd(m,x)&&(o.flags|=32),cx(r,o),en(r,o,R,c),o.child;case 6:return r===null&&Td(o),null;case 13:return hx(r,o,c);case 4:return Ld(o,o.stateNode.containerInfo),m=o.pendingProps,r===null?o.child=di(o,null,m,c):en(r,o,m,c),o.child;case 11:return m=o.type,v=o.pendingProps,v=o.elementType===m?v:Zn(m,v),ox(r,o,m,v,c);case 7:return en(r,o,o.pendingProps,c),o.child;case 8:return en(r,o,o.pendingProps.children,c),o.child;case 12:return en(r,o,o.pendingProps.children,c),o.child;case 10:e:{if(m=o.type._context,v=o.pendingProps,x=o.memoizedProps,R=v.value,ft(oc,m._currentValue),m._currentValue=R,x!==null)if(sn(x.value,R)){if(x.children===v.children&&!on.current){o=Gr(r,o,c);break e}}else for(x=o.child,x!==null&&(x.return=o);x!==null;){var B=x.dependencies;if(B!==null){R=x.child;for(var ee=B.firstContext;ee!==null;){if(ee.context===m){if(x.tag===1){ee=Hr(-1,c&-c),ee.tag=2;var ae=x.updateQueue;if(ae!==null){ae=ae.shared;var ge=ae.pending;ge===null?ee.next=ee:(ee.next=ge.next,ge.next=ee),ae.pending=ee}}x.lanes|=c,ee=x.alternate,ee!==null&&(ee.lanes|=c),Od(x.return,c,o),B.lanes|=c;break}ee=ee.next}}else if(x.tag===10)R=x.type===o.type?null:x.child;else if(x.tag===18){if(R=x.return,R===null)throw Error(n(341));R.lanes|=c,B=R.alternate,B!==null&&(B.lanes|=c),Od(R,c,o),R=x.sibling}else R=x.child;if(R!==null)R.return=x;else for(R=x;R!==null;){if(R===o){R=null;break}if(x=R.sibling,x!==null){x.return=R.return,R=x;break}R=R.return}x=R}en(r,o,v.children,c),o=o.child}return o;case 9:return v=o.type,m=o.pendingProps.children,hi(o,c),v=An(v),m=m(v),o.flags|=1,en(r,o,m,c),o.child;case 14:return m=o.type,v=Zn(m,o.pendingProps),v=Zn(m.type,v),ix(r,o,m,v,c);case 15:return ax(r,o,o.type,o.pendingProps,c);case 17:return m=o.type,v=o.pendingProps,v=o.elementType===m?v:Zn(m,v),vc(r,o),o.tag=1,an(m)?(r=!0,Jl(o)):r=!1,hi(o,c),Z0(o,m,v),Xd(o,m,v,c),ef(null,o,m,!0,r,c);case 19:return mx(r,o,c);case 22:return lx(r,o,c)}throw Error(n(156,o.tag))};function Dx(r,o){return Ls(r,o)}function IA(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 IA(r,o,c,m)}function bf(r){return r=r.prototype,!(!r||!r.isReactComponent)}function OA(r){if(typeof r=="function")return bf(r)?1:0;if(r!=null){if(r=r.$$typeof,r===W)return 11;if(r===Q)return 14}return 2}function Es(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 jc(r,o,c,m,v,x){var R=2;if(m=r,typeof r=="function")bf(r)&&(R=1);else if(typeof r=="string")R=5;else e:switch(r){case P:return fo(c.children,v,x,o);case F:R=8,v|=8;break;case M:return r=On(12,c,o,v|2),r.elementType=M,r.lanes=x,r;case V:return r=On(13,c,o,v),r.elementType=V,r.lanes=x,r;case T:return r=On(19,c,o,v),r.elementType=T,r.lanes=x,r;case ne:return Tc(c,v,x,o);default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case A:R=10;break e;case q:R=9;break e;case W:R=11;break e;case Q:R=14;break e;case U:R=16,m=null;break e}throw Error(n(130,r==null?r:typeof r,""))}return o=On(R,c,o,v),o.elementType=r,o.type=m,o.lanes=x,o}function fo(r,o,c,m){return r=On(7,r,m,o),r.lanes=c,r}function Tc(r,o,c,m){return r=On(22,r,m,o),r.elementType=ne,r.lanes=c,r.stateNode={isHidden:!1},r}function _f(r,o,c){return r=On(6,r,null,o),r.lanes=c,r}function kf(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 PA(r,o,c,m,v){this.tag=o,this.containerInfo=r,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Uo(0),this.expirationTimes=Uo(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Uo(0),this.identifierPrefix=m,this.onRecoverableError=v,this.mutableSourceEagerHydrationData=null}function Sf(r,o,c,m,v,x,R,B,ee){return r=new PA(r,o,c,B,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},$d(x),r}function $A(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 Fx(r){if(!r)return vs;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(an(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(an(c))return p0(r,c,o)}return o}function zx(r,o,c,m,v,x,R,B,ee){return r=Sf(c,m,!0,r,v,x,R,B,ee),r.context=Fx(null),c=r.current,m=tn(),v=Ss(c),x=Hr(m,v),x.callback=o??null,xs(c,x,v),r.current.lanes=v,is(r,v,m),un(r,m),r}function Rc(r,o,c,m){var v=o.current,x=tn(),R=Ss(v);return c=Fx(c),o.context===null?o.context=c:o.pendingContext=c,o=Hr(x,R),o.payload={element:r},m=m===void 0?null:m,m!==null&&(o.callback=m),r=xs(v,o,R),r!==null&&(tr(r,v,R,x),ac(r,v,R)),R}function Ac(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 Bx(r,o){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var c=r.retryLane;r.retryLane=c!==0&&c<o?c:o}}function Nf(r,o){Bx(r,o),(r=r.alternate)&&Bx(r,o)}function LA(){return null}var Ux=typeof reportError=="function"?reportError:function(r){console.error(r)};function Ef(r){this._internalRoot=r}Mc.prototype.render=Ef.prototype.render=function(r){var o=this._internalRoot;if(o===null)throw Error(n(409));Rc(r,o,null,null)},Mc.prototype.unmount=Ef.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var o=r.containerInfo;lo(function(){Rc(null,r,null,null)}),o[Fr]=null}};function Mc(r){this._internalRoot=r}Mc.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&&Go(r)}};function Cf(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function Ic(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11&&(r.nodeType!==8||r.nodeValue!==" react-mount-point-unstable "))}function Wx(){}function qA(r,o,c,m,v){if(v){if(typeof m=="function"){var x=m;m=function(){var ae=Ac(R);x.call(ae)}}var R=zx(o,m,r,0,null,!1,!1,"",Wx);return r._reactRootContainer=R,r[Fr]=R.current,xa(r.nodeType===8?r.parentNode:r),lo(),R}for(;v=r.lastChild;)r.removeChild(v);if(typeof m=="function"){var B=m;m=function(){var ae=Ac(ee);B.call(ae)}}var ee=Sf(r,0,!1,null,null,!1,!1,"",Wx);return r._reactRootContainer=ee,r[Fr]=ee.current,xa(r.nodeType===8?r.parentNode:r),lo(function(){Rc(o,ee,c,m)}),ee}function Oc(r,o,c,m,v){var x=c._reactRootContainer;if(x){var R=x;if(typeof v=="function"){var B=v;v=function(){var ee=Ac(R);B.call(ee)}}Rc(o,R,r,v)}else R=qA(c,o,r,v,m);return Ac(R)}Tl=function(r){switch(r.tag){case 3:var o=r.stateNode;if(o.current.memoizedState.isDehydrated){var c=ss(o.pendingLanes);c!==0&&(as(o,c|1),un(o,ot()),(tt&6)===0&&(yi=ot()+500,ys()))}break;case 13:lo(function(){var m=Wr(r,1);if(m!==null){var v=tn();tr(m,r,1,v)}}),Nf(r,1)}},Mr=function(r){if(r.tag===13){var o=Wr(r,134217728);if(o!==null){var c=tn();tr(o,r,134217728,c)}Nf(r,134217728)}},ta=function(r){if(r.tag===13){var o=Ss(r),c=Wr(r,o);if(c!==null){var m=tn();tr(c,r,o,m)}Nf(r,o)}},Hn=function(){return Je},Rl=function(r,o){var c=Je;try{return Je=r,o()}finally{Je=c}},kt=function(r,o,c){switch(o){case"input":if(be(r,c),o=c.name,c.type==="radio"&&o!=null){for(c=r;c.parentNode;)c=c.parentNode;for(c=c.querySelectorAll("input[name="+JSON.stringify(""+o)+'][type="radio"]'),o=0;o<c.length;o++){var m=c[o];if(m!==r&&m.form===r.form){var v=Ql(m);if(!v)throw Error(n(90));Ve(m),be(m,v)}}}break;case"textarea":De(r,c);break;case"select":o=c.value,o!=null&&at(r,!!c.multiple,o,!1)}},jo=yf,To=lo;var DA={usingClientEntryPoint:!1,Events:[ka,oi,Ql,Co,pn,yf]},La={findFiberByHostInstance:eo,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},FA={bundleType:La.bundleType,version:La.version,rendererPackageName:La.rendererPackageName,rendererConfig:La.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:j.ReactCurrentDispatcher,findHostInstanceByFiber:function(r){return r=Bn(r),r===null?null:r.stateNode},findFiberByHostInstance:La.findFiberByHostInstance||LA,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 Pc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Pc.isDisabled&&Pc.supportsFiber)try{xt=Pc.inject(FA),nn=Pc}catch{}}return dn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=DA,dn.createPortal=function(r,o){var c=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Cf(o))throw Error(n(200));return $A(r,o,null,c)},dn.createRoot=function(r,o){if(!Cf(r))throw Error(n(299));var c=!1,m="",v=Ux;return o!=null&&(o.unstable_strictMode===!0&&(c=!0),o.identifierPrefix!==void 0&&(m=o.identifierPrefix),o.onRecoverableError!==void 0&&(v=o.onRecoverableError)),o=Sf(r,1,!1,null,null,c,!1,m,v),r[Fr]=o.current,xa(r.nodeType===8?r.parentNode:r),new Ef(o)},dn.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},dn.flushSync=function(r){return lo(r)},dn.hydrate=function(r,o,c){if(!Ic(o))throw Error(n(200));return Oc(null,r,o,!0,c)},dn.hydrateRoot=function(r,o,c){if(!Cf(r))throw Error(n(405));var m=c!=null&&c.hydratedSources||null,v=!1,x="",R=Ux;if(c!=null&&(c.unstable_strictMode===!0&&(v=!0),c.identifierPrefix!==void 0&&(x=c.identifierPrefix),c.onRecoverableError!==void 0&&(R=c.onRecoverableError)),o=zx(o,null,r,1,c??null,v,!1,x,R),r[Fr]=o.current,xa(r),m)for(r=0;r<m.length;r++)c=m[r],v=c._getVersion,v=v(c._source),o.mutableSourceEagerHydrationData==null?o.mutableSourceEagerHydrationData=[c,v]:o.mutableSourceEagerHydrationData.push(c,v);return new Mc(o)},dn.render=function(r,o,c){if(!Ic(o))throw Error(n(200));return Oc(null,r,o,!1,c)},dn.unmountComponentAtNode=function(r){if(!Ic(r))throw Error(n(40));return r._reactRootContainer?(lo(function(){Oc(null,null,r,!1,function(){r._reactRootContainer=null,r[Fr]=null})}),!0):!1},dn.unstable_batchedUpdates=yf,dn.unstable_renderSubtreeIntoContainer=function(r,o,c,m){if(!Ic(c))throw Error(n(200));if(r==null||r._reactInternals===void 0)throw Error(n(38));return Oc(r,o,c,!1,m)},dn.version="18.3.1-next-f1338f8080-20240426",dn}var Zx;function TC(){if(Zx)return Rf.exports;Zx=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(),Rf.exports=VA(),Rf.exports}var Jx;function YA(){if(Jx)return Lc;Jx=1;var e=TC();return Lc.createRoot=e.createRoot,Lc.hydrateRoot=e.hydrateRoot,Lc}var KA=YA(),N=hl();const ue=Zy(N);function Wt(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=Wt(e[n]))!==""&&(t+=(t&&" ")+s);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var If={exports:{}},Of={},Pf={exports:{}},$f={};/**
41
+ * @license React
42
+ * use-sync-external-store-shim.production.js
43
+ *
44
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
45
+ *
46
+ * This source code is licensed under the MIT license found in the
47
+ * LICENSE file in the root directory of this source tree.
48
+ */var eb;function XA(){if(eb)return $f;eb=1;var e=hl();function t(g,y){return g===y&&(g!==0||1/g===1/y)||g!==g&&y!==y}var n=typeof Object.is=="function"?Object.is:t,s=e.useState,i=e.useEffect,a=e.useLayoutEffect,l=e.useDebugValue;function u(g,y){var w=y(),S=s({inst:{value:w,getSnapshot:y}}),b=S[0].inst,_=S[1];return a(function(){b.value=w,b.getSnapshot=y,h(b)&&_({inst:b})},[g,w,y]),i(function(){return h(b)&&_({inst:b}),g(function(){h(b)&&_({inst:b})})},[g]),l(w),w}function h(g){var y=g.getSnapshot;g=g.value;try{var w=y();return!n(g,w)}catch{return!0}}function p(g,y){return y()}var f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?p:u;return $f.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:f,$f}var tb;function QA(){return tb||(tb=1,Pf.exports=XA()),Pf.exports}/**
49
+ * @license React
50
+ * use-sync-external-store-shim/with-selector.production.js
51
+ *
52
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
53
+ *
54
+ * This source code is licensed under the MIT license found in the
55
+ * LICENSE file in the root directory of this source tree.
56
+ */var nb;function ZA(){if(nb)return Of;nb=1;var e=hl(),t=QA();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 Of.useSyncExternalStoreWithSelector=function(p,f,g,y,w){var S=a(null);if(S.current===null){var b={hasValue:!1,value:null};S.current=b}else b=S.current;S=u(function(){function k(O){if(!E){if(E=!0,C=O,O=y(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 F=y(O);return w!==void 0&&w(P,F)?(C=O,P):(C=O,j=F)}var E=!1,C,j,I=g===void 0?null:g;return[function(){return k(f())},I===null?void 0:function(){return k(I())}]},[f,g,y,w]);var _=i(p,S[0],S[1]);return l(function(){b.hasValue=!0,b.value=_},[_]),h(_),_},Of}var rb;function JA(){return rb||(rb=1,If.exports=ZA()),If.exports}var e2=JA();const t2=Zy(e2),n2={},sb=e=>{let t;const n=new Set,s=(f,g)=>{const y=typeof f=="function"?f(t):f;if(!Object.is(y,t)){const w=t;t=g??(typeof y!="object"||y===null)?y:Object.assign({},t,y),n.forEach(S=>S(t,w))}},i=()=>t,h={setState:s,getState:i,getInitialState:()=>p,subscribe:f=>(n.add(f),()=>n.delete(f)),destroy:()=>{(n2?"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},r2=e=>e?sb(e):sb,{useDebugValue:s2}=ue,{useSyncExternalStoreWithSelector:o2}=t2,i2=e=>e;function RC(e,t=i2,n){const s=o2(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return s2(s),s}const ob=(e,t)=>{const n=r2(e),s=(i,a=t)=>RC(n,i,a);return Object.assign(s,n),s},a2=(e,t)=>e?ob(e,t):ob;function $t(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[s,i]of e)if(!Object.is(i,t.get(s)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const s of e)if(!t.has(s))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const s of n)if(!Object.prototype.hasOwnProperty.call(t,s)||!Object.is(e[s],t[s]))return!1;return!0}var l2={value:()=>{}};function Nu(){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 ru(n)}function ru(e){this._=e}function c2(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}})}ru.prototype=Nu.prototype={constructor:ru,on:function(e,t){var n=this._,s=c2(e+"",n),i,a=-1,l=s.length;if(arguments.length<2){for(;++a<l;)if((i=(e=s[a]).type)&&(i=u2(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]=ib(n[i],e.name,t);else if(t==null)for(i in n)n[i]=ib(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 ru(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 u2(e,t){for(var n=0,s=e.length,i;n<s;++n)if((i=e[n]).name===t)return i.value}function ib(e,t,n){for(var s=0,i=e.length;s<i;++s)if(e[s].name===t){e[s]=l2,e=e.slice(0,s).concat(e.slice(s+1));break}return n!=null&&e.push({name:t,value:n}),e}var yy="http://www.w3.org/1999/xhtml";const ab={svg:"http://www.w3.org/2000/svg",xhtml:yy,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Eu(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),ab.hasOwnProperty(t)?{space:ab[t],local:e}:e}function d2(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===yy&&t.documentElement.namespaceURI===yy?t.createElement(e):t.createElementNS(n,e)}}function f2(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function AC(e){var t=Eu(e);return(t.local?f2:d2)(t)}function h2(){}function Jy(e){return e==null?h2:function(){return this.querySelector(e)}}function p2(e){typeof e!="function"&&(e=Jy(e));for(var t=this._groups,n=t.length,s=new Array(n),i=0;i<n;++i)for(var a=t[i],l=a.length,u=s[i]=new Array(l),h,p,f=0;f<l;++f)(h=a[f])&&(p=e.call(h,h.__data__,f,a))&&("__data__"in h&&(p.__data__=h.__data__),u[f]=p);return new _n(s,this._parents)}function m2(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function g2(){return[]}function MC(e){return e==null?g2:function(){return this.querySelectorAll(e)}}function v2(e){return function(){return m2(e.apply(this,arguments))}}function y2(e){typeof e=="function"?e=v2(e):e=MC(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 _n(s,i)}function IC(e){return function(){return this.matches(e)}}function OC(e){return function(t){return t.matches(e)}}var w2=Array.prototype.find;function x2(e){return function(){return w2.call(this.children,e)}}function b2(){return this.firstElementChild}function _2(e){return this.select(e==null?b2:x2(typeof e=="function"?e:OC(e)))}var k2=Array.prototype.filter;function S2(){return Array.from(this.children)}function N2(e){return function(){return k2.call(this.children,e)}}function E2(e){return this.selectAll(e==null?S2:N2(typeof e=="function"?e:OC(e)))}function C2(e){typeof e!="function"&&(e=IC(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 _n(s,this._parents)}function PC(e){return new Array(e.length)}function j2(){return new _n(this._enter||this._groups.map(PC),this._parents)}function cu(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}cu.prototype={constructor:cu,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 T2(e){return function(){return e}}function R2(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 cu(e,a[l]);for(;l<h;++l)(u=t[l])&&(i[l]=u)}function A2(e,t,n,s,i,a,l){var u,h,p=new Map,f=t.length,g=a.length,y=new Array(f),w;for(u=0;u<f;++u)(h=t[u])&&(y[u]=w=l.call(h,h.__data__,u,t)+"",p.has(w)?i[u]=h:p.set(w,h));for(u=0;u<g;++u)w=l.call(e,a[u],u,a)+"",(h=p.get(w))?(s[u]=h,h.__data__=a[u],p.delete(w)):n[u]=new cu(e,a[u]);for(u=0;u<f;++u)(h=t[u])&&p.get(y[u])===h&&(i[u]=h)}function M2(e){return e.__data__}function I2(e,t){if(!arguments.length)return Array.from(this,M2);var n=t?A2:R2,s=this._parents,i=this._groups;typeof e!="function"&&(e=T2(e));for(var a=i.length,l=new Array(a),u=new Array(a),h=new Array(a),p=0;p<a;++p){var f=s[p],g=i[p],y=g.length,w=O2(e.call(f,f&&f.__data__,p,s)),S=w.length,b=u[p]=new Array(S),_=l[p]=new Array(S),k=h[p]=new Array(y);n(f,g,b,_,k,w,t);for(var E=0,C=0,j,I;E<S;++E)if(j=b[E]){for(E>=C&&(C=E+1);!(I=_[C])&&++C<S;);j._next=I||null}}return l=new _n(l,s),l._enter=u,l._exit=h,l}function O2(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function P2(){return new _n(this._exit||this._groups.map(PC),this._parents)}function $2(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 L2(e){for(var t=e.selection?e.selection():e,n=this._groups,s=t._groups,i=n.length,a=s.length,l=Math.min(i,a),u=new Array(i),h=0;h<l;++h)for(var p=n[h],f=s[h],g=p.length,y=u[h]=new Array(g),w,S=0;S<g;++S)(w=p[S]||f[S])&&(y[S]=w);for(;h<i;++h)u[h]=n[h];return new _n(u,this._parents)}function q2(){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 D2(e){e||(e=F2);function t(g,y){return g&&y?e(g.__data__,y.__data__):!g-!y}for(var n=this._groups,s=n.length,i=new Array(s),a=0;a<s;++a){for(var l=n[a],u=l.length,h=i[a]=new Array(u),p,f=0;f<u;++f)(p=l[f])&&(h[f]=p);h.sort(t)}return new _n(i,this._parents).order()}function F2(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function z2(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function B2(){return Array.from(this)}function U2(){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 W2(){let e=0;for(const t of this)++e;return e}function H2(){return!this.node()}function G2(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 V2(e){return function(){this.removeAttribute(e)}}function Y2(e){return function(){this.removeAttributeNS(e.space,e.local)}}function K2(e,t){return function(){this.setAttribute(e,t)}}function X2(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Q2(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function Z2(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 J2(e,t){var n=Eu(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?Y2:V2:typeof t=="function"?n.local?Z2:Q2:n.local?X2:K2)(n,t))}function $C(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function eM(e){return function(){this.style.removeProperty(e)}}function tM(e,t,n){return function(){this.style.setProperty(e,t,n)}}function nM(e,t,n){return function(){var s=t.apply(this,arguments);s==null?this.style.removeProperty(e):this.style.setProperty(e,s,n)}}function rM(e,t,n){return arguments.length>1?this.each((t==null?eM:typeof t=="function"?nM:tM)(e,t,n??"")):Li(this.node(),e)}function Li(e,t){return e.style.getPropertyValue(t)||$C(e).getComputedStyle(e,null).getPropertyValue(t)}function sM(e){return function(){delete this[e]}}function oM(e,t){return function(){this[e]=t}}function iM(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function aM(e,t){return arguments.length>1?this.each((t==null?sM:typeof t=="function"?iM:oM)(e,t)):this.node()[e]}function LC(e){return e.trim().split(/^|\s+/)}function ew(e){return e.classList||new qC(e)}function qC(e){this._node=e,this._names=LC(e.getAttribute("class")||"")}qC.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 DC(e,t){for(var n=ew(e),s=-1,i=t.length;++s<i;)n.add(t[s])}function FC(e,t){for(var n=ew(e),s=-1,i=t.length;++s<i;)n.remove(t[s])}function lM(e){return function(){DC(this,e)}}function cM(e){return function(){FC(this,e)}}function uM(e,t){return function(){(t.apply(this,arguments)?DC:FC)(this,e)}}function dM(e,t){var n=LC(e+"");if(arguments.length<2){for(var s=ew(this.node()),i=-1,a=n.length;++i<a;)if(!s.contains(n[i]))return!1;return!0}return this.each((typeof t=="function"?uM:t?lM:cM)(n,t))}function fM(){this.textContent=""}function hM(e){return function(){this.textContent=e}}function pM(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function mM(e){return arguments.length?this.each(e==null?fM:(typeof e=="function"?pM:hM)(e)):this.node().textContent}function gM(){this.innerHTML=""}function vM(e){return function(){this.innerHTML=e}}function yM(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function wM(e){return arguments.length?this.each(e==null?gM:(typeof e=="function"?yM:vM)(e)):this.node().innerHTML}function xM(){this.nextSibling&&this.parentNode.appendChild(this)}function bM(){return this.each(xM)}function _M(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function kM(){return this.each(_M)}function SM(e){var t=typeof e=="function"?e:AC(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function NM(){return null}function EM(e,t){var n=typeof e=="function"?e:AC(e),s=t==null?NM:typeof t=="function"?t:Jy(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),s.apply(this,arguments)||null)})}function CM(){var e=this.parentNode;e&&e.removeChild(this)}function jM(){return this.each(CM)}function TM(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function RM(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function AM(e){return this.select(e?RM:TM)}function MM(e){return arguments.length?this.property("__data__",e):this.node().__data__}function IM(e){return function(t){e.call(this,t,this.__data__)}}function OM(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 PM(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 $M(e,t,n){return function(){var s=this.__on,i,a=IM(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 LM(e,t,n){var s=OM(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?$M:PM,i=0;i<a;++i)this.each(u(s[i],t,n));return this}function zC(e,t,n){var s=$C(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 qM(e,t){return function(){return zC(this,e,t)}}function DM(e,t){return function(){return zC(this,e,t.apply(this,arguments))}}function FM(e,t){return this.each((typeof t=="function"?DM:qM)(e,t))}function*zM(){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 BC=[null];function _n(e,t){this._groups=e,this._parents=t}function pl(){return new _n([[document.documentElement]],BC)}function BM(){return this}_n.prototype=pl.prototype={constructor:_n,select:p2,selectAll:y2,selectChild:_2,selectChildren:E2,filter:C2,data:I2,enter:j2,exit:P2,join:$2,merge:L2,selection:BM,order:q2,sort:D2,call:z2,nodes:B2,node:U2,size:W2,empty:H2,each:G2,attr:J2,style:rM,property:aM,classed:dM,text:mM,html:wM,raise:bM,lower:kM,append:SM,insert:EM,remove:jM,clone:AM,datum:MM,on:LM,dispatch:FM,[Symbol.iterator]:zM};function $n(e){return typeof e=="string"?new _n([[document.querySelector(e)]],[document.documentElement]):new _n([[e]],BC)}function UM(e){let t;for(;t=e.sourceEvent;)e=t;return e}function rr(e,t){if(e=UM(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 WM={passive:!1},tl={capture:!0,passive:!1};function Lf(e){e.stopImmediatePropagation()}function Ai(e){e.preventDefault(),e.stopImmediatePropagation()}function UC(e){var t=e.document.documentElement,n=$n(e).on("dragstart.drag",Ai,tl);"onselectstart"in t?n.on("selectstart.drag",Ai,tl):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function WC(e,t){var n=e.document.documentElement,s=$n(e).on("dragstart.drag",null);t&&(s.on("click.drag",Ai,tl),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 qc=e=>()=>e;function wy(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}})}wy.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function HM(e){return!e.ctrlKey&&!e.button}function GM(){return this.parentNode}function VM(e,t){return t??{x:e.x,y:e.y}}function YM(){return navigator.maxTouchPoints||"ontouchstart"in this}function KM(){var e=HM,t=GM,n=VM,s=YM,i={},a=Nu("start","drag","end"),l=0,u,h,p,f,g=0;function y(j){j.on("mousedown.drag",w).filter(s).on("touchstart.drag",_).on("touchmove.drag",k,WM).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",S,tl).on("mouseup.drag",b,tl),UC(j.view),Lf(j),p=!1,u=j.clientX,h=j.clientY,O("start",j))}}function S(j){if(Ai(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),WC(j.view,p),Ai(j),i.mouse("end",j)}function _(j,I){if(e.call(this,j,I)){var O=j.changedTouches,P=t.call(this,j,I),F=O.length,M,A;for(M=0;M<F;++M)(A=C(this,P,j,I,O[M].identifier,O[M]))&&(Lf(j),A("start",j,O[M]))}}function k(j){var I=j.changedTouches,O=I.length,P,F;for(P=0;P<O;++P)(F=i[I[P].identifier])&&(Ai(j),F("drag",j,I[P]))}function E(j){var I=j.changedTouches,O=I.length,P,F;for(f&&clearTimeout(f),f=setTimeout(function(){f=null},500),P=0;P<O;++P)(F=i[I[P].identifier])&&(Lf(j),F("end",j,I[P]))}function C(j,I,O,P,F,M){var A=a.copy(),q=rr(M||O,I),W,V,T;if((T=n.call(j,new wy("beforestart",{sourceEvent:O,target:y,identifier:F,active:l,x:q[0],y:q[1],dx:0,dy:0,dispatch:A}),P))!=null)return W=T.x-q[0]||0,V=T.y-q[1]||0,function Q(U,ne,X){var H=q,J;switch(U){case"start":i[F]=Q,J=l++;break;case"end":delete i[F],--l;case"drag":q=rr(X||ne,I),J=l;break}A.call(U,j,new wy(U,{sourceEvent:ne,subject:T,target:y,identifier:F,active:J,x:q[0]+W,y:q[1]+V,dx:q[0]-H[0],dy:q[1]-H[1],dispatch:A}),P)}}return y.filter=function(j){return arguments.length?(e=typeof j=="function"?j:qc(!!j),y):e},y.container=function(j){return arguments.length?(t=typeof j=="function"?j:qc(j),y):t},y.subject=function(j){return arguments.length?(n=typeof j=="function"?j:qc(j),y):n},y.touchable=function(j){return arguments.length?(s=typeof j=="function"?j:qc(!!j),y):s},y.on=function(){var j=a.on.apply(a,arguments);return j===a?y:j},y.clickDistance=function(j){return arguments.length?(g=(j=+j)*j,y):Math.sqrt(g)},y}function tw(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function HC(e,t){var n=Object.create(e.prototype);for(var s in t)n[s]=t[s];return n}function ml(){}var nl=.7,uu=1/nl,Mi="\\s*([+-]?\\d+)\\s*",rl="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Sr="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",XM=/^#([0-9a-f]{3,8})$/,QM=new RegExp(`^rgb\\(${Mi},${Mi},${Mi}\\)$`),ZM=new RegExp(`^rgb\\(${Sr},${Sr},${Sr}\\)$`),JM=new RegExp(`^rgba\\(${Mi},${Mi},${Mi},${rl}\\)$`),eI=new RegExp(`^rgba\\(${Sr},${Sr},${Sr},${rl}\\)$`),tI=new RegExp(`^hsl\\(${rl},${Sr},${Sr}\\)$`),nI=new RegExp(`^hsla\\(${rl},${Sr},${Sr},${rl}\\)$`),lb={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};tw(ml,sl,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:cb,formatHex:cb,formatHex8:rI,formatHsl:sI,formatRgb:ub,toString:ub});function cb(){return this.rgb().formatHex()}function rI(){return this.rgb().formatHex8()}function sI(){return GC(this).formatHsl()}function ub(){return this.rgb().formatRgb()}function sl(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=XM.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?db(t):n===3?new fn(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Dc(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Dc(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=QM.exec(e))?new fn(t[1],t[2],t[3],1):(t=ZM.exec(e))?new fn(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=JM.exec(e))?Dc(t[1],t[2],t[3],t[4]):(t=eI.exec(e))?Dc(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=tI.exec(e))?pb(t[1],t[2]/100,t[3]/100,1):(t=nI.exec(e))?pb(t[1],t[2]/100,t[3]/100,t[4]):lb.hasOwnProperty(e)?db(lb[e]):e==="transparent"?new fn(NaN,NaN,NaN,0):null}function db(e){return new fn(e>>16&255,e>>8&255,e&255,1)}function Dc(e,t,n,s){return s<=0&&(e=t=n=NaN),new fn(e,t,n,s)}function oI(e){return e instanceof ml||(e=sl(e)),e?(e=e.rgb(),new fn(e.r,e.g,e.b,e.opacity)):new fn}function xy(e,t,n,s){return arguments.length===1?oI(e):new fn(e,t,n,s??1)}function fn(e,t,n,s){this.r=+e,this.g=+t,this.b=+n,this.opacity=+s}tw(fn,xy,HC(ml,{brighter(e){return e=e==null?uu:Math.pow(uu,e),new fn(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?nl:Math.pow(nl,e),new fn(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new fn(wo(this.r),wo(this.g),wo(this.b),du(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:fb,formatHex:fb,formatHex8:iI,formatRgb:hb,toString:hb}));function fb(){return`#${vo(this.r)}${vo(this.g)}${vo(this.b)}`}function iI(){return`#${vo(this.r)}${vo(this.g)}${vo(this.b)}${vo((isNaN(this.opacity)?1:this.opacity)*255)}`}function hb(){const e=du(this.opacity);return`${e===1?"rgb(":"rgba("}${wo(this.r)}, ${wo(this.g)}, ${wo(this.b)}${e===1?")":`, ${e})`}`}function du(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function wo(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function vo(e){return e=wo(e),(e<16?"0":"")+e.toString(16)}function pb(e,t,n,s){return s<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new sr(e,t,n,s)}function GC(e){if(e instanceof sr)return new sr(e.h,e.s,e.l,e.opacity);if(e instanceof ml||(e=sl(e)),!e)return new sr;if(e instanceof sr)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 sr(l,u,h,e.opacity)}function aI(e,t,n,s){return arguments.length===1?GC(e):new sr(e,t,n,s??1)}function sr(e,t,n,s){this.h=+e,this.s=+t,this.l=+n,this.opacity=+s}tw(sr,aI,HC(ml,{brighter(e){return e=e==null?uu:Math.pow(uu,e),new sr(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?nl:Math.pow(nl,e),new sr(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 fn(qf(e>=240?e-240:e+120,i,s),qf(e,i,s),qf(e<120?e+240:e-120,i,s),this.opacity)},clamp(){return new sr(mb(this.h),Fc(this.s),Fc(this.l),du(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=du(this.opacity);return`${e===1?"hsl(":"hsla("}${mb(this.h)}, ${Fc(this.s)*100}%, ${Fc(this.l)*100}%${e===1?")":`, ${e})`}`}}));function mb(e){return e=(e||0)%360,e<0?e+360:e}function Fc(e){return Math.max(0,Math.min(1,e||0))}function qf(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 VC=e=>()=>e;function lI(e,t){return function(n){return e+n*t}}function cI(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 uI(e){return(e=+e)==1?YC:function(t,n){return n-t?cI(t,n,e):VC(isNaN(t)?n:t)}}function YC(e,t){var n=t-e;return n?lI(e,n):VC(isNaN(e)?t:e)}const gb=(function e(t){var n=uI(t);function s(i,a){var l=n((i=xy(i)).r,(a=xy(a)).r),u=n(i.g,a.g),h=n(i.b,a.b),p=YC(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 Ts(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var by=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Df=new RegExp(by.source,"g");function dI(e){return function(){return e}}function fI(e){return function(t){return e(t)+""}}function hI(e,t){var n=by.lastIndex=Df.lastIndex=0,s,i,a,l=-1,u=[],h=[];for(e=e+"",t=t+"";(s=by.exec(e))&&(i=Df.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:Ts(s,i)})),n=Df.lastIndex;return n<t.length&&(a=t.slice(n),u[l]?u[l]+=a:u[++l]=a),u.length<2?h[0]?fI(h[0].x):dI(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 vb=180/Math.PI,_y={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function KC(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)*vb,skewX:Math.atan(h)*vb,scaleX:l,scaleY:u}}var zc;function pI(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?_y:KC(t.a,t.b,t.c,t.d,t.e,t.f)}function mI(e){return e==null||(zc||(zc=document.createElementNS("http://www.w3.org/2000/svg","g")),zc.setAttribute("transform",e),!(e=zc.transform.baseVal.consolidate()))?_y:(e=e.matrix,KC(e.a,e.b,e.c,e.d,e.e,e.f))}function XC(e,t,n,s){function i(p){return p.length?p.pop()+" ":""}function a(p,f,g,y,w,S){if(p!==g||f!==y){var b=w.push("translate(",null,t,null,n);S.push({i:b-4,x:Ts(p,g)},{i:b-2,x:Ts(f,y)})}else(g||y)&&w.push("translate("+g+t+y+n)}function l(p,f,g,y){p!==f?(p-f>180?f+=360:f-p>180&&(p+=360),y.push({i:g.push(i(g)+"rotate(",null,s)-2,x:Ts(p,f)})):f&&g.push(i(g)+"rotate("+f+s)}function u(p,f,g,y){p!==f?y.push({i:g.push(i(g)+"skewX(",null,s)-2,x:Ts(p,f)}):f&&g.push(i(g)+"skewX("+f+s)}function h(p,f,g,y,w,S){if(p!==g||f!==y){var b=w.push(i(w)+"scale(",null,",",null,")");S.push({i:b-4,x:Ts(p,g)},{i:b-2,x:Ts(f,y)})}else(g!==1||y!==1)&&w.push(i(w)+"scale("+g+","+y+")")}return function(p,f){var g=[],y=[];return p=e(p),f=e(f),a(p.translateX,p.translateY,f.translateX,f.translateY,g,y),l(p.rotate,f.rotate,g,y),u(p.skewX,f.skewX,g,y),h(p.scaleX,p.scaleY,f.scaleX,f.scaleY,g,y),p=f=null,function(w){for(var S=-1,b=y.length,_;++S<b;)g[(_=y[S]).i]=_.x(w);return g.join("")}}}var gI=XC(pI,"px, ","px)","deg)"),vI=XC(mI,", ",")",")"),yI=1e-12;function yb(e){return((e=Math.exp(e))+1/e)/2}function wI(e){return((e=Math.exp(e))-1/e)/2}function xI(e){return((e=Math.exp(2*e))-1)/(e+1)}const bI=(function e(t,n,s){function i(a,l){var u=a[0],h=a[1],p=a[2],f=l[0],g=l[1],y=l[2],w=f-u,S=g-h,b=w*w+S*S,_,k;if(b<yI)k=Math.log(y/p)/t,_=function(P){return[u+P*w,h+P*S,p*Math.exp(t*P*k)]};else{var E=Math.sqrt(b),C=(y*y-p*p+s*b)/(2*p*n*E),j=(y*y-p*p-s*b)/(2*y*n*E),I=Math.log(Math.sqrt(C*C+1)-C),O=Math.log(Math.sqrt(j*j+1)-j);k=(O-I)/t,_=function(P){var F=P*k,M=yb(I),A=p/(n*E)*(M*xI(t*F+I)-wI(I));return[u+A*w,h+A*S,p*M/yb(t*F+I)]}}return _.duration=k*1e3*t/Math.SQRT2,_}return i.rho=function(a){var l=Math.max(.001,+a),u=l*l,h=u*u;return e(l,u,h)},i})(Math.SQRT2,2,4);var qi=0,Ya=0,Da=0,QC=1e3,fu,Ka,hu=0,bo=0,Cu=0,ol=typeof performance=="object"&&performance.now?performance:Date,ZC=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function nw(){return bo||(ZC(_I),bo=ol.now()+Cu)}function _I(){bo=0}function pu(){this._call=this._time=this._next=null}pu.prototype=JC.prototype={constructor:pu,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?nw():+n)+(t==null?0:+t),!this._next&&Ka!==this&&(Ka?Ka._next=this:fu=this,Ka=this),this._call=e,this._time=n,ky()},stop:function(){this._call&&(this._call=null,this._time=1/0,ky())}};function JC(e,t,n){var s=new pu;return s.restart(e,t,n),s}function kI(){nw(),++qi;for(var e=fu,t;e;)(t=bo-e._time)>=0&&e._call.call(void 0,t),e=e._next;--qi}function wb(){bo=(hu=ol.now())+Cu,qi=Ya=0;try{kI()}finally{qi=0,NI(),bo=0}}function SI(){var e=ol.now(),t=e-hu;t>QC&&(Cu-=t,hu=e)}function NI(){for(var e,t=fu,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:fu=n);Ka=e,ky(s)}function ky(e){if(!qi){Ya&&(Ya=clearTimeout(Ya));var t=e-bo;t>24?(e<1/0&&(Ya=setTimeout(wb,e-ol.now()-Cu)),Da&&(Da=clearInterval(Da))):(Da||(hu=ol.now(),Da=setInterval(SI,QC)),qi=1,ZC(wb))}}function xb(e,t,n){var s=new pu;return t=t==null?0:+t,s.restart(i=>{s.stop(),e(i+t)},t,n),s}var EI=Nu("start","end","cancel","interrupt"),CI=[],ej=0,bb=1,Sy=2,su=3,_b=4,Ny=5,ou=6;function ju(e,t,n,s,i,a){var l=e.__transition;if(!l)e.__transition={};else if(n in l)return;jI(e,n,{name:t,index:s,group:i,on:EI,tween:CI,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:ej})}function rw(e,t){var n=cr(e,t);if(n.state>ej)throw new Error("too late; already scheduled");return n}function Nr(e,t){var n=cr(e,t);if(n.state>su)throw new Error("too late; already running");return n}function cr(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function jI(e,t,n){var s=e.__transition,i;s[t]=n,n.timer=JC(a,0,n.time);function a(p){n.state=bb,n.timer.restart(l,n.delay,n.time),n.delay<=p&&l(p-n.delay)}function l(p){var f,g,y,w;if(n.state!==bb)return h();for(f in s)if(w=s[f],w.name===n.name){if(w.state===su)return xb(l);w.state===_b?(w.state=ou,w.timer.stop(),w.on.call("interrupt",e,e.__data__,w.index,w.group),delete s[f]):+f<t&&(w.state=ou,w.timer.stop(),w.on.call("cancel",e,e.__data__,w.index,w.group),delete s[f])}if(xb(function(){n.state===su&&(n.state=_b,n.timer.restart(u,n.delay,n.time),u(p))}),n.state=Sy,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Sy){for(n.state=su,i=new Array(y=n.tween.length),f=0,g=-1;f<y;++f)(w=n.tween[f].value.call(e,e.__data__,n.index,n.group))&&(i[++g]=w);i.length=g+1}}function u(p){for(var f=p<n.duration?n.ease.call(null,p/n.duration):(n.timer.restart(h),n.state=Ny,1),g=-1,y=i.length;++g<y;)i[g].call(e,f);n.state===Ny&&(n.on.call("end",e,e.__data__,n.index,n.group),h())}function h(){n.state=ou,n.timer.stop(),delete s[t];for(var p in s)return;delete e.__transition}}function iu(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>Sy&&s.state<Ny,s.state=ou,s.timer.stop(),s.on.call(i?"interrupt":"cancel",e,e.__data__,s.index,s.group),delete n[l]}a&&delete e.__transition}}function TI(e){return this.each(function(){iu(this,e)})}function RI(e,t){var n,s;return function(){var i=Nr(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 AI(e,t,n){var s,i;if(typeof n!="function")throw new Error;return function(){var a=Nr(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 MI(e,t){var n=this._id;if(e+="",arguments.length<2){for(var s=cr(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?RI:AI)(n,e,t))}function sw(e,t,n){var s=e._id;return e.each(function(){var i=Nr(this,s);(i.value||(i.value={}))[t]=n.apply(this,arguments)}),function(i){return cr(i,s).value[t]}}function tj(e,t){var n;return(typeof t=="number"?Ts:t instanceof sl?gb:(n=sl(t))?(t=n,gb):hI)(e,t)}function II(e){return function(){this.removeAttribute(e)}}function OI(e){return function(){this.removeAttributeNS(e.space,e.local)}}function PI(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 $I(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 LI(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 qI(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 DI(e,t){var n=Eu(e),s=n==="transform"?vI:tj;return this.attrTween(e,typeof t=="function"?(n.local?qI:LI)(n,s,sw(this,"attr."+e,t)):t==null?(n.local?OI:II)(n):(n.local?$I:PI)(n,s,t))}function FI(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function zI(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function BI(e,t){var n,s;function i(){var a=t.apply(this,arguments);return a!==s&&(n=(s=a)&&zI(e,a)),n}return i._value=t,i}function UI(e,t){var n,s;function i(){var a=t.apply(this,arguments);return a!==s&&(n=(s=a)&&FI(e,a)),n}return i._value=t,i}function WI(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=Eu(e);return this.tween(n,(s.local?BI:UI)(s,t))}function HI(e,t){return function(){rw(this,e).delay=+t.apply(this,arguments)}}function GI(e,t){return t=+t,function(){rw(this,e).delay=t}}function VI(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?HI:GI)(t,e)):cr(this.node(),t).delay}function YI(e,t){return function(){Nr(this,e).duration=+t.apply(this,arguments)}}function KI(e,t){return t=+t,function(){Nr(this,e).duration=t}}function XI(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?YI:KI)(t,e)):cr(this.node(),t).duration}function QI(e,t){if(typeof t!="function")throw new Error;return function(){Nr(this,e).ease=t}}function ZI(e){var t=this._id;return arguments.length?this.each(QI(t,e)):cr(this.node(),t).ease}function JI(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Nr(this,e).ease=n}}function eO(e){if(typeof e!="function")throw new Error;return this.each(JI(this._id,e))}function tO(e){typeof e!="function"&&(e=IC(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 Qr(s,this._parents,this._name,this._id)}function nO(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,s=t.length,i=n.length,a=Math.min(s,i),l=new Array(s),u=0;u<a;++u)for(var h=t[u],p=n[u],f=h.length,g=l[u]=new Array(f),y,w=0;w<f;++w)(y=h[w]||p[w])&&(g[w]=y);for(;u<s;++u)l[u]=t[u];return new Qr(l,this._parents,this._name,this._id)}function rO(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 sO(e,t,n){var s,i,a=rO(t)?rw:Nr;return function(){var l=a(this,e),u=l.on;u!==s&&(i=(s=u).copy()).on(t,n),l.on=i}}function oO(e,t){var n=this._id;return arguments.length<2?cr(this.node(),n).on.on(e):this.each(sO(n,e,t))}function iO(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function aO(){return this.on("end.remove",iO(this._id))}function lO(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Jy(e));for(var s=this._groups,i=s.length,a=new Array(i),l=0;l<i;++l)for(var u=s[l],h=u.length,p=a[l]=new Array(h),f,g,y=0;y<h;++y)(f=u[y])&&(g=e.call(f,f.__data__,y,u))&&("__data__"in f&&(g.__data__=f.__data__),p[y]=g,ju(p[y],t,n,y,p,cr(f,n)));return new Qr(a,this._parents,t,n)}function cO(e){var t=this._name,n=this._id;typeof e!="function"&&(e=MC(e));for(var s=this._groups,i=s.length,a=[],l=[],u=0;u<i;++u)for(var h=s[u],p=h.length,f,g=0;g<p;++g)if(f=h[g]){for(var y=e.call(f,f.__data__,g,h),w,S=cr(f,n),b=0,_=y.length;b<_;++b)(w=y[b])&&ju(w,t,n,b,y,S);a.push(y),l.push(f)}return new Qr(a,l,t,n)}var uO=pl.prototype.constructor;function dO(){return new uO(this._groups,this._parents)}function fO(e,t){var n,s,i;return function(){var a=Li(this,e),l=(this.style.removeProperty(e),Li(this,e));return a===l?null:a===n&&l===s?i:i=t(n=a,s=l)}}function nj(e){return function(){this.style.removeProperty(e)}}function hO(e,t,n){var s,i=n+"",a;return function(){var l=Li(this,e);return l===i?null:l===s?a:a=t(s=l,n)}}function pO(e,t,n){var s,i,a;return function(){var l=Li(this,e),u=n(this),h=u+"";return u==null&&(h=u=(this.style.removeProperty(e),Li(this,e))),l===h?null:l===s&&h===i?a:(i=h,a=t(s=l,u))}}function mO(e,t){var n,s,i,a="style."+t,l="end."+a,u;return function(){var h=Nr(this,e),p=h.on,f=h.value[a]==null?u||(u=nj(t)):void 0;(p!==n||i!==f)&&(s=(n=p).copy()).on(l,i=f),h.on=s}}function gO(e,t,n){var s=(e+="")=="transform"?gI:tj;return t==null?this.styleTween(e,fO(e,s)).on("end.style."+e,nj(e)):typeof t=="function"?this.styleTween(e,pO(e,s,sw(this,"style."+e,t))).each(mO(this._id,e)):this.styleTween(e,hO(e,s,t),n).on("end.style."+e,null)}function vO(e,t,n){return function(s){this.style.setProperty(e,t.call(this,s),n)}}function yO(e,t,n){var s,i;function a(){var l=t.apply(this,arguments);return l!==i&&(s=(i=l)&&vO(e,l,n)),s}return a._value=t,a}function wO(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,yO(e,t,n??""))}function xO(e){return function(){this.textContent=e}}function bO(e){return function(){var t=e(this);this.textContent=t??""}}function _O(e){return this.tween("text",typeof e=="function"?bO(sw(this,"text",e)):xO(e==null?"":e+""))}function kO(e){return function(t){this.textContent=e.call(this,t)}}function SO(e){var t,n;function s(){var i=e.apply(this,arguments);return i!==n&&(t=(n=i)&&kO(i)),t}return s._value=e,s}function NO(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,SO(e))}function EO(){for(var e=this._name,t=this._id,n=rj(),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=cr(h,t);ju(h,e,n,p,l,{time:f.time+f.delay+f.duration,delay:0,duration:f.duration,ease:f.ease})}return new Qr(s,this._parents,e,n)}function CO(){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=Nr(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 jO=0;function Qr(e,t,n,s){this._groups=e,this._parents=t,this._name=n,this._id=s}function rj(){return++jO}var Yr=pl.prototype;Qr.prototype={constructor:Qr,select:lO,selectAll:cO,selectChild:Yr.selectChild,selectChildren:Yr.selectChildren,filter:tO,merge:nO,selection:dO,transition:EO,call:Yr.call,nodes:Yr.nodes,node:Yr.node,size:Yr.size,empty:Yr.empty,each:Yr.each,on:oO,attr:DI,attrTween:WI,style:gO,styleTween:wO,text:_O,textTween:NO,remove:aO,tween:MI,delay:VI,duration:XI,ease:ZI,easeVarying:eO,end:CO,[Symbol.iterator]:Yr[Symbol.iterator]};function TO(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var RO={time:null,delay:0,duration:250,ease:TO};function AO(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 MO(e){var t,n;e instanceof Qr?(t=e._id,e=e._name):(t=rj(),(n=RO).time=nw(),e=e==null?null:e+"");for(var s=this._groups,i=s.length,a=0;a<i;++a)for(var l=s[a],u=l.length,h,p=0;p<u;++p)(h=l[p])&&ju(h,e,t,p,l,n||AO(h,t));return new Qr(s,this._parents,e,t)}pl.prototype.interrupt=TI;pl.prototype.transition=MO;const Bc=e=>()=>e;function IO(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 Kr(e,t,n){this.k=e,this.x=t,this.y=n}Kr.prototype={constructor:Kr,scale:function(e){return e===1?this:new Kr(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Kr(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 Xr=new Kr(1,0,0);Kr.prototype;function Ff(e){e.stopImmediatePropagation()}function Fa(e){e.preventDefault(),e.stopImmediatePropagation()}function OO(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function PO(){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 kb(){return this.__zoom||Xr}function $O(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function LO(){return navigator.maxTouchPoints||"ontouchstart"in this}function qO(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 sj(){var e=OO,t=PO,n=qO,s=$O,i=LO,a=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],u=250,h=bI,p=Nu("start","zoom","end"),f,g,y,w=500,S=150,b=0,_=10;function k(T){T.property("__zoom",kb).on("wheel.zoom",F,{passive:!1}).on("mousedown.zoom",M).on("dblclick.zoom",A).filter(i).on("touchstart.zoom",q).on("touchmove.zoom",W).on("touchend.zoom touchcancel.zoom",V).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}k.transform=function(T,Q,U,ne){var X=T.selection?T.selection():T;X.property("__zoom",kb),T!==X?I(T,Q,U,ne):X.interrupt().each(function(){O(this,arguments).event(ne).start().zoom(null,typeof Q=="function"?Q.apply(this,arguments):Q).end()})},k.scaleBy=function(T,Q,U,ne){k.scaleTo(T,function(){var X=this.__zoom.k,H=typeof Q=="function"?Q.apply(this,arguments):Q;return X*H},U,ne)},k.scaleTo=function(T,Q,U,ne){k.transform(T,function(){var X=t.apply(this,arguments),H=this.__zoom,J=U==null?j(X):typeof U=="function"?U.apply(this,arguments):U,$=H.invert(J),G=typeof Q=="function"?Q.apply(this,arguments):Q;return n(C(E(H,G),J,$),X,l)},U,ne)},k.translateBy=function(T,Q,U,ne){k.transform(T,function(){return n(this.__zoom.translate(typeof Q=="function"?Q.apply(this,arguments):Q,typeof U=="function"?U.apply(this,arguments):U),t.apply(this,arguments),l)},null,ne)},k.translateTo=function(T,Q,U,ne,X){k.transform(T,function(){var H=t.apply(this,arguments),J=this.__zoom,$=ne==null?j(H):typeof ne=="function"?ne.apply(this,arguments):ne;return n(Xr.translate($[0],$[1]).scale(J.k).translate(typeof Q=="function"?-Q.apply(this,arguments):-Q,typeof U=="function"?-U.apply(this,arguments):-U),H,l)},ne,X)};function E(T,Q){return Q=Math.max(a[0],Math.min(a[1],Q)),Q===T.k?T:new Kr(Q,T.x,T.y)}function C(T,Q,U){var ne=Q[0]-U[0]*T.k,X=Q[1]-U[1]*T.k;return ne===T.x&&X===T.y?T:new Kr(T.k,ne,X)}function j(T){return[(+T[0][0]+ +T[1][0])/2,(+T[0][1]+ +T[1][1])/2]}function I(T,Q,U,ne){T.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,H=arguments,J=O(X,H).event(ne),$=t.apply(X,H),G=U==null?j($):typeof U=="function"?U.apply(X,H):U,Z=Math.max($[1][0]-$[0][0],$[1][1]-$[0][1]),D=X.__zoom,L=typeof Q=="function"?Q.apply(X,H):Q,Y=h(D.invert(G).concat(Z/D.k),L.invert(G).concat(Z/L.k));return function(re){if(re===1)re=L;else{var he=Y(re),pe=Z/he[2];re=new Kr(pe,G[0]-he[0]*pe,G[1]-he[1]*pe)}J.zoom(null,re)}})}function O(T,Q,U){return!U&&T.__zooming||new P(T,Q)}function P(T,Q){this.that=T,this.args=Q,this.active=0,this.sourceEvent=null,this.extent=t.apply(T,Q),this.taps=0}P.prototype={event:function(T){return T&&(this.sourceEvent=T),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(T,Q){return this.mouse&&T!=="mouse"&&(this.mouse[1]=Q.invert(this.mouse[0])),this.touch0&&T!=="touch"&&(this.touch0[1]=Q.invert(this.touch0[0])),this.touch1&&T!=="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(T){var Q=$n(this.that).datum();p.call(T,this.that,new IO(T,{sourceEvent:this.sourceEvent,target:k,transform:this.that.__zoom,dispatch:p}),Q)}};function F(T,...Q){if(!e.apply(this,arguments))return;var U=O(this,Q).event(T),ne=this.__zoom,X=Math.max(a[0],Math.min(a[1],ne.k*Math.pow(2,s.apply(this,arguments)))),H=rr(T);if(U.wheel)(U.mouse[0][0]!==H[0]||U.mouse[0][1]!==H[1])&&(U.mouse[1]=ne.invert(U.mouse[0]=H)),clearTimeout(U.wheel);else{if(ne.k===X)return;U.mouse=[H,ne.invert(H)],iu(this),U.start()}Fa(T),U.wheel=setTimeout(J,S),U.zoom("mouse",n(C(E(ne,X),U.mouse[0],U.mouse[1]),U.extent,l));function J(){U.wheel=null,U.end()}}function M(T,...Q){if(y||!e.apply(this,arguments))return;var U=T.currentTarget,ne=O(this,Q,!0).event(T),X=$n(T.view).on("mousemove.zoom",G,!0).on("mouseup.zoom",Z,!0),H=rr(T,U),J=T.clientX,$=T.clientY;UC(T.view),Ff(T),ne.mouse=[H,this.__zoom.invert(H)],iu(this),ne.start();function G(D){if(Fa(D),!ne.moved){var L=D.clientX-J,Y=D.clientY-$;ne.moved=L*L+Y*Y>b}ne.event(D).zoom("mouse",n(C(ne.that.__zoom,ne.mouse[0]=rr(D,U),ne.mouse[1]),ne.extent,l))}function Z(D){X.on("mousemove.zoom mouseup.zoom",null),WC(D.view,ne.moved),Fa(D),ne.event(D).end()}}function A(T,...Q){if(e.apply(this,arguments)){var U=this.__zoom,ne=rr(T.changedTouches?T.changedTouches[0]:T,this),X=U.invert(ne),H=U.k*(T.shiftKey?.5:2),J=n(C(E(U,H),ne,X),t.apply(this,Q),l);Fa(T),u>0?$n(this).transition().duration(u).call(I,J,ne,T):$n(this).call(k.transform,J,ne,T)}}function q(T,...Q){if(e.apply(this,arguments)){var U=T.touches,ne=U.length,X=O(this,Q,T.changedTouches.length===ne).event(T),H,J,$,G;for(Ff(T),J=0;J<ne;++J)$=U[J],G=rr($,this),G=[G,this.__zoom.invert(G),$.identifier],X.touch0?!X.touch1&&X.touch0[2]!==G[2]&&(X.touch1=G,X.taps=0):(X.touch0=G,H=!0,X.taps=1+!!f);f&&(f=clearTimeout(f)),H&&(X.taps<2&&(g=G[0],f=setTimeout(function(){f=null},w)),iu(this),X.start())}}function W(T,...Q){if(this.__zooming){var U=O(this,Q).event(T),ne=T.changedTouches,X=ne.length,H,J,$,G;for(Fa(T),H=0;H<X;++H)J=ne[H],$=rr(J,this),U.touch0&&U.touch0[2]===J.identifier?U.touch0[0]=$:U.touch1&&U.touch1[2]===J.identifier&&(U.touch1[0]=$);if(J=U.that.__zoom,U.touch1){var Z=U.touch0[0],D=U.touch0[1],L=U.touch1[0],Y=U.touch1[1],re=(re=L[0]-Z[0])*re+(re=L[1]-Z[1])*re,he=(he=Y[0]-D[0])*he+(he=Y[1]-D[1])*he;J=E(J,Math.sqrt(re/he)),$=[(Z[0]+L[0])/2,(Z[1]+L[1])/2],G=[(D[0]+Y[0])/2,(D[1]+Y[1])/2]}else if(U.touch0)$=U.touch0[0],G=U.touch0[1];else return;U.zoom("touch",n(C(J,$,G),U.extent,l))}}function V(T,...Q){if(this.__zooming){var U=O(this,Q).event(T),ne=T.changedTouches,X=ne.length,H,J;for(Ff(T),y&&clearTimeout(y),y=setTimeout(function(){y=null},w),H=0;H<X;++H)J=ne[H],U.touch0&&U.touch0[2]===J.identifier?delete U.touch0:U.touch1&&U.touch1[2]===J.identifier&&delete U.touch1;if(U.touch1&&!U.touch0&&(U.touch0=U.touch1,delete U.touch1),U.touch0)U.touch0[1]=this.__zoom.invert(U.touch0[0]);else if(U.end(),U.taps===2&&(J=rr(J,this),Math.hypot(g[0]-J[0],g[1]-J[1])<_)){var $=$n(this).on("dblclick.zoom");$&&$.apply(this,arguments)}}}return k.wheelDelta=function(T){return arguments.length?(s=typeof T=="function"?T:Bc(+T),k):s},k.filter=function(T){return arguments.length?(e=typeof T=="function"?T:Bc(!!T),k):e},k.touchable=function(T){return arguments.length?(i=typeof T=="function"?T:Bc(!!T),k):i},k.extent=function(T){return arguments.length?(t=typeof T=="function"?T:Bc([[+T[0][0],+T[0][1]],[+T[1][0],+T[1][1]]]),k):t},k.scaleExtent=function(T){return arguments.length?(a[0]=+T[0],a[1]=+T[1],k):[a[0],a[1]]},k.translateExtent=function(T){return arguments.length?(l[0][0]=+T[0][0],l[1][0]=+T[1][0],l[0][1]=+T[0][1],l[1][1]=+T[1][1],k):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},k.constrain=function(T){return arguments.length?(n=T,k):n},k.duration=function(T){return arguments.length?(u=+T,k):u},k.interpolate=function(T){return arguments.length?(h=T,k):h},k.on=function(){var T=p.on.apply(p,arguments);return T===p?k:T},k.clickDistance=function(T){return arguments.length?(b=(T=+T)*T,k):Math.sqrt(b)},k.tapDistance=function(T){return arguments.length?(_=+T,k):_},k}var ow=TC();const Tu=N.createContext(null),DO=Tu.Provider,Zr={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.`},oj=Zr.error001();function it(e,t){const n=N.useContext(Tu);if(n===null)throw new Error(oj);return RC(n,e,t)}const At=()=>{const e=N.useContext(Tu);if(e===null)throw new Error(oj);return N.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},FO=e=>e.userSelectionActive?"none":"all";function iw({position:e,children:t,className:n,style:s,...i}){const a=it(FO),l=`${e}`.split("-");return ue.createElement("div",{className:Wt(["react-flow__panel",n,...l]),style:{...s,pointerEvents:a},...i},t)}function zO({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:ue.createElement(iw,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://reactflow.dev/pro"},ue.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}const BO=({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=N.useRef(null),[y,w]=N.useState({x:0,y:0,width:0,height:0}),S=Wt(["react-flow__edge-textwrapper",p]);return N.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:ue.createElement("g",{transform:`translate(${e-y.width/2} ${t-y.height/2})`,className:S,visibility:y.width?"visible":"hidden",...f},i&&ue.createElement("rect",{width:y.width+2*l[0],x:-l[0],y:-l[1],height:y.height+2*l[1],className:"react-flow__edge-textbg",style:a,rx:u,ry:u}),ue.createElement("text",{className:"react-flow__edge-text",y:y.height/2,dy:"0.3em",ref:g,style:s},n),h)};var UO=N.memo(BO);const aw=e=>({width:e.offsetWidth,height:e.offsetHeight}),Di=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),lw=(e={x:0,y:0},t)=>({x:Di(e.x,t[0][0],t[1][0]),y:Di(e.y,t[0][1],t[1][1])}),Sb=(e,t,n)=>e<t?Di(Math.abs(e-t),1,50)/50:e>n?-Di(Math.abs(e-n),1,50)/50:0,ij=(e,t)=>{const n=Sb(e.x,35,t.width-35)*20,s=Sb(e.y,35,t.height-35)*20;return[n,s]},aj=e=>{var t;return((t=e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},lj=(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)}),il=({x:e,y:t,width:n,height:s})=>({x:e,y:t,x2:e+n,y2:t+s}),cj=({x:e,y:t,x2:n,y2:s})=>({x:e,y:t,width:n-e,height:s-t}),Nb=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),WO=(e,t)=>cj(lj(il(e),il(t))),Ey=(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)},HO=e=>Ln(e.width)&&Ln(e.height)&&Ln(e.x)&&Ln(e.y),Ln=e=>!isNaN(e)&&isFinite(e),Nt=Symbol.for("internals"),uj=["Enter"," ","Escape"],GO=(e,t)=>{},VO=e=>"nativeEvent"in e;function Cy(e){var i,a;const t=VO(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 dj=e=>"clientX"in e,Ms=(e,t)=>{var a,l;const n=dj(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)}},mu=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0},gl=({id:e,path:t,labelX:n,labelY:s,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:p,style:f,markerEnd:g,markerStart:y,interactionWidth:w=20})=>ue.createElement(ue.Fragment,null,ue.createElement("path",{id:e,style:f,d:t,fill:"none",className:"react-flow__edge-path",markerEnd:g,markerStart:y}),w&&ue.createElement("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:w,className:"react-flow__edge-interaction"}),i&&Ln(n)&&Ln(s)?ue.createElement(UO,{x:n,y:s,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:p}):null);gl.displayName="BaseEdge";function za(e,t,n){return n===void 0?n:s=>{const i=t().edges.find(a=>a.id===e);i&&n(s,{...i})}}function fj({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 hj({sourceX:e,sourceY:t,targetX:n,targetY:s,sourceControlX:i,sourceControlY:a,targetControlX:l,targetControlY:u}){const h=e*.125+i*.375+l*.375+n*.125,p=t*.125+a*.375+u*.375+s*.125,f=Math.abs(h-e),g=Math.abs(p-t);return[h,p,f,g]}var _o;(function(e){e.Strict="strict",e.Loose="loose"})(_o||(_o={}));var yo;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(yo||(yo={}));var al;(function(e){e.Partial="partial",e.Full="full"})(al||(al={}));var As;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(As||(As={}));var gu;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(gu||(gu={}));var qe;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(qe||(qe={}));function Eb({pos:e,x1:t,y1:n,x2:s,y2:i}){return e===qe.Left||e===qe.Right?[.5*(t+s),n]:[t,.5*(n+i)]}function pj({sourceX:e,sourceY:t,sourcePosition:n=qe.Bottom,targetX:s,targetY:i,targetPosition:a=qe.Top}){const[l,u]=Eb({pos:n,x1:e,y1:t,x2:s,y2:i}),[h,p]=Eb({pos:a,x1:s,y1:i,x2:e,y2:t}),[f,g,y,w]=hj({sourceX:e,sourceY:t,targetX:s,targetY:i,sourceControlX:l,sourceControlY:u,targetControlX:h,targetControlY:p});return[`M${e},${t} C${l},${u} ${h},${p} ${s},${i}`,f,g,y,w]}const cw=N.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,sourcePosition:i=qe.Bottom,targetPosition:a=qe.Top,label:l,labelStyle:u,labelShowBg:h,labelBgStyle:p,labelBgPadding:f,labelBgBorderRadius:g,style:y,markerEnd:w,markerStart:S,interactionWidth:b})=>{const[_,k,E]=pj({sourceX:e,sourceY:t,sourcePosition:i,targetX:n,targetY:s,targetPosition:a});return ue.createElement(gl,{path:_,labelX:k,labelY:E,label:l,labelStyle:u,labelShowBg:h,labelBgStyle:p,labelBgPadding:f,labelBgBorderRadius:g,style:y,markerEnd:w,markerStart:S,interactionWidth:b})});cw.displayName="SimpleBezierEdge";const Cb={[qe.Left]:{x:-1,y:0},[qe.Right]:{x:1,y:0},[qe.Top]:{x:0,y:-1},[qe.Bottom]:{x:0,y:1}},YO=({source:e,sourcePosition:t=qe.Bottom,target:n})=>t===qe.Left||t===qe.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},jb=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function KO({source:e,sourcePosition:t=qe.Bottom,target:n,targetPosition:s=qe.Top,center:i,offset:a}){const l=Cb[t],u=Cb[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=YO({source:h,sourcePosition:t,target:p}),g=f.x!==0?"x":"y",y=f[g];let w=[],S,b;const _={x:0,y:0},k={x:0,y:0},[E,C,j,I]=fj({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[g]*u[g]===-1){S=i.x??E,b=i.y??C;const P=[{x:S,y:h.y},{x:S,y:p.y}],F=[{x:h.x,y:b},{x:p.x,y:b}];l[g]===y?w=g==="x"?P:F:w=g==="x"?F:P}else{const P=[{x:h.x,y:p.y}],F=[{x:p.x,y:h.y}];if(g==="x"?w=l.x===y?F:P:w=l.y===y?P:F,t===s){const V=Math.abs(e[g]-n[g]);if(V<=a){const T=Math.min(a-1,a-V);l[g]===y?_[g]=(h[g]>e[g]?-1:1)*T:k[g]=(p[g]>n[g]?-1:1)*T}}if(t!==s){const V=g==="x"?"y":"x",T=l[g]===u[V],Q=h[V]>p[V],U=h[V]<p[V];(l[g]===1&&(!T&&Q||T&&U)||l[g]!==1&&(!T&&U||T&&Q))&&(w=g==="x"?P:F)}const M={x:h.x+_.x,y:h.y+_.y},A={x:p.x+k.x,y:p.y+k.y},q=Math.max(Math.abs(M.x-w[0].x),Math.abs(A.x-w[0].x)),W=Math.max(Math.abs(M.y-w[0].y),Math.abs(A.y-w[0].y));q>=W?(S=(M.x+A.x)/2,b=w[0].y):(S=w[0].x,b=(M.y+A.y)/2)}return[[e,{x:h.x+_.x,y:h.y+_.y},...w,{x:p.x+k.x,y:p.y+k.y},n],S,b,j,I]}function XO(e,t,n,s){const i=Math.min(jb(e,t)/2,jb(t,n)/2,s),{x:a,y:l}=t;if(e.x===a&&a===n.x||e.y===l&&l===n.y)return`L${a} ${l}`;if(e.y===l){const p=e.x<n.x?-1:1,f=e.y<n.y?1:-1;return`L ${a+i*p},${l}Q ${a},${l} ${a},${l+i*f}`}const u=e.x<n.x?1:-1,h=e.y<n.y?-1:1;return`L ${a},${l+i*h}Q ${a},${l} ${a+i*u},${l}`}function jy({sourceX:e,sourceY:t,sourcePosition:n=qe.Bottom,targetX:s,targetY:i,targetPosition:a=qe.Top,borderRadius:l=5,centerX:u,centerY:h,offset:p=20}){const[f,g,y,w,S]=KO({source:{x:e,y:t},sourcePosition:n,target:{x:s,y:i},targetPosition:a,center:{x:u,y:h},offset:p});return[f.reduce((_,k,E)=>{let C="";return E>0&&E<f.length-1?C=XO(f[E-1],k,f[E+1],l):C=`${E===0?"M":"L"}${k.x} ${k.y}`,_+=C,_},""),g,y,w,S]}const Ru=N.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=qe.Bottom,targetPosition:y=qe.Top,markerEnd:w,markerStart:S,pathOptions:b,interactionWidth:_})=>{const[k,E,C]=jy({sourceX:e,sourceY:t,sourcePosition:g,targetX:n,targetY:s,targetPosition:y,borderRadius:b==null?void 0:b.borderRadius,offset:b==null?void 0:b.offset});return ue.createElement(gl,{path:k,labelX:E,labelY:C,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:p,style:f,markerEnd:w,markerStart:S,interactionWidth:_})});Ru.displayName="SmoothStepEdge";const uw=N.memo(e=>{var t;return ue.createElement(Ru,{...e,pathOptions:N.useMemo(()=>{var n;return{borderRadius:0,offset:(n=e.pathOptions)==null?void 0:n.offset}},[(t=e.pathOptions)==null?void 0:t.offset])})});uw.displayName="StepEdge";function QO({sourceX:e,sourceY:t,targetX:n,targetY:s}){const[i,a,l,u]=fj({sourceX:e,sourceY:t,targetX:n,targetY:s});return[`M ${e},${t}L ${n},${s}`,i,a,l,u]}const dw=N.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:p,style:f,markerEnd:g,markerStart:y,interactionWidth:w})=>{const[S,b,_]=QO({sourceX:e,sourceY:t,targetX:n,targetY:s});return ue.createElement(gl,{path:S,labelX:b,labelY:_,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:p,style:f,markerEnd:g,markerStart:y,interactionWidth:w})});dw.displayName="StraightEdge";function Uc(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Tb({pos:e,x1:t,y1:n,x2:s,y2:i,c:a}){switch(e){case qe.Left:return[t-Uc(t-s,a),n];case qe.Right:return[t+Uc(s-t,a),n];case qe.Top:return[t,n-Uc(n-i,a)];case qe.Bottom:return[t,n+Uc(i-n,a)]}}function mj({sourceX:e,sourceY:t,sourcePosition:n=qe.Bottom,targetX:s,targetY:i,targetPosition:a=qe.Top,curvature:l=.25}){const[u,h]=Tb({pos:n,x1:e,y1:t,x2:s,y2:i,c:l}),[p,f]=Tb({pos:a,x1:s,y1:i,x2:e,y2:t,c:l}),[g,y,w,S]=hj({sourceX:e,sourceY:t,targetX:s,targetY:i,sourceControlX:u,sourceControlY:h,targetControlX:p,targetControlY:f});return[`M${e},${t} C${u},${h} ${p},${f} ${s},${i}`,g,y,w,S]}const vu=N.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,sourcePosition:i=qe.Bottom,targetPosition:a=qe.Top,label:l,labelStyle:u,labelShowBg:h,labelBgStyle:p,labelBgPadding:f,labelBgBorderRadius:g,style:y,markerEnd:w,markerStart:S,pathOptions:b,interactionWidth:_})=>{const[k,E,C]=mj({sourceX:e,sourceY:t,sourcePosition:i,targetX:n,targetY:s,targetPosition:a,curvature:b==null?void 0:b.curvature});return ue.createElement(gl,{path:k,labelX:E,labelY:C,label:l,labelStyle:u,labelShowBg:h,labelBgStyle:p,labelBgPadding:f,labelBgBorderRadius:g,style:y,markerEnd:w,markerStart:S,interactionWidth:_})});vu.displayName="BezierEdge";const fw=N.createContext(null),ZO=fw.Provider;fw.Consumer;const JO=()=>N.useContext(fw),eP=e=>"id"in e&&"source"in e&&"target"in e,tP=({source:e,sourceHandle:t,target:n,targetHandle:s})=>`reactflow__edge-${e}${t||""}-${n}${s||""}`,Ty=(e,t)=>typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(s=>`${s}=${e[s]}`).join("&")}`,nP=(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)),rP=(e,t)=>{if(!e.source||!e.target)return t;let n;return eP(e)?n={...e}:n={...e,id:tP(e)},nP(n,t)?t:t.concat(n)},Ry=({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},gj=({x:e,y:t},[n,s,i])=>({x:e*i+n,y:t*i+s}),xo=(e,t=[0,0])=>{if(!e)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const n=(e.width??0)*t[0],s=(e.height??0)*t[1],i={x:e.position.x-n,y:e.position.y-s};return{...i,positionAbsolute:e.positionAbsolute?{x:e.positionAbsolute.x-n,y:e.positionAbsolute.y-s}:i}},Au=(e,t=[0,0])=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((s,i)=>{const{x:a,y:l}=xo(i,t).positionAbsolute;return lj(s,il({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 cj(n)},vj=(e,t,[n,s,i]=[0,0,1],a=!1,l=!1,u=[0,0])=>{const h={x:(t.x-n)/i,y:(t.y-s)/i,width:t.width/i,height:t.height/i},p=[];return e.forEach(f=>{const{width:g,height:y,selectable:w=!0,hidden:S=!1}=f;if(l&&!w||S)return!1;const{positionAbsolute:b}=xo(f,u),_={x:b.x,y:b.y,width:g||0,height:y||0},k=Ey(h,_),E=typeof g>"u"||typeof y>"u"||g===null||y===null,C=a&&k>0,j=(g||0)*(y||0);(E||C||k>=j||f.dragging)&&p.push(f)}),p},yj=(e,t)=>{const n=e.map(s=>s.id);return t.filter(s=>n.includes(s.source)||n.includes(s.target))},wj=(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=Di(h,s,i),f=e.x+e.width/2,g=e.y+e.height/2,y=t/2-f*p,w=n/2-g*p;return{x:y,y:w,zoom:p}},po=(e,t=0)=>e.transition().duration(t);function Rb(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 sP(e,t,n,s,i,a){const{x:l,y:u}=Ms(e),p=t.elementsFromPoint(l,u).find(S=>S.classList.contains("react-flow__handle"));if(p){const S=p.getAttribute("data-nodeid");if(S){const b=hw(void 0,p),_=p.getAttribute("data-handleid"),k=a({nodeId:S,id:_,type:b});if(k){const E=i.find(C=>C.nodeId===S&&C.type===b&&C.id===_);return{handle:{id:_,type:b,nodeId:S,x:(E==null?void 0:E.x)||n.x,y:(E==null?void 0:E.y)||n.y},validHandleResult:k}}}}let f=[],g=1/0;if(i.forEach(S=>{const b=Math.sqrt((S.x-n.x)**2+(S.y-n.y)**2);if(b<=s){const _=a(S);b<=g&&(b<g?f=[{handle:S,validHandleResult:_}]:b===g&&f.push({handle:S,validHandleResult:_}),g=b)}}),!f.length)return{handle:null,validHandleResult:xj()};if(f.length===1)return f[0];const y=f.some(({validHandleResult:S})=>S.isValid),w=f.some(({handle:S})=>S.type==="target");return f.find(({handle:S,validHandleResult:b})=>w?S.type==="target":y?b.isValid:!0)||f[0]}const oP={source:null,target:null,sourceHandle:null,targetHandle:null},xj=()=>({handleDomNode:null,isValid:!1,connection:oP,endHandle:null});function bj(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={...xj(),handleDomNode:h};if(h){const f=hw(void 0,h),g=h.getAttribute("data-nodeid"),y=h.getAttribute("data-handleid"),w=h.classList.contains("connectable"),S=h.classList.contains("connectableend"),b={source:u?g:n,sourceHandle:u?y:s,target:u?n:g,targetHandle:u?s:y};p.connection=b,w&&S&&(t===_o.Strict?u&&f==="source"||!u&&f==="target":g!==n||y!==s)&&(p.endHandle={nodeId:g,handleId:y,type:f},p.isValid=a(b))}return p}function iP({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=Rb(a,l,"source",`${t}-${n}-${s}`),h=Rb(a,l,"target",`${t}-${n}-${s}`)),i.push(...u,...h)}return i},[])}function hw(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function zf(e){e==null||e.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function aP(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}function _j({event:e,handleId:t,nodeId:n,onConnect:s,isTarget:i,getState:a,setState:l,isValidConnection:u,edgeUpdaterType:h,onReconnectEnd:p}){const f=aj(e.target),{connectionMode:g,domNode:y,autoPanOnConnect:w,connectionRadius:S,onConnectStart:b,panBy:_,getNodes:k,cancelConnection:E}=a();let C=0,j;const{x:I,y:O}=Ms(e),P=f==null?void 0:f.elementFromPoint(I,O),F=hw(h,P),M=y==null?void 0:y.getBoundingClientRect();if(!M||!F)return;let A,q=Ms(e,M),W=!1,V=null,T=!1,Q=null;const U=iP({nodes:k(),nodeId:n,handleId:t,handleType:F}),ne=()=>{if(!w)return;const[J,$]=ij(q,M);_({x:J,y:$}),C=requestAnimationFrame(ne)};l({connectionPosition:q,connectionStatus:null,connectionNodeId:n,connectionHandleId:t,connectionHandleType:F,connectionStartHandle:{nodeId:n,handleId:t,type:F},connectionEndHandle:null}),b==null||b(e,{nodeId:n,handleId:t,handleType:F});function X(J){const{transform:$}=a();q=Ms(J,M);const{handle:G,validHandleResult:Z}=sP(J,f,Ry(q,$,!1,[1,1]),S,U,D=>bj(D,g,n,t,i?"target":"source",u,f));if(j=G,W||(ne(),W=!0),Q=Z.handleDomNode,V=Z.connection,T=Z.isValid,l({connectionPosition:j&&T?gj({x:j.x,y:j.y},$):q,connectionStatus:aP(!!j,T),connectionEndHandle:Z.endHandle}),!j&&!T&&!Q)return zf(A);V.source!==V.target&&Q&&(zf(A),A=Q,Q.classList.add("connecting","react-flow__handle-connecting"),Q.classList.toggle("valid",T),Q.classList.toggle("react-flow__handle-valid",T))}function H(J){var $,G;(j||Q)&&V&&T&&(s==null||s(V)),(G=($=a()).onConnectEnd)==null||G.call($,J),h&&(p==null||p(J)),zf(A),E(),cancelAnimationFrame(C),W=!1,T=!1,V=null,Q=null,f.removeEventListener("mousemove",X),f.removeEventListener("mouseup",H),f.removeEventListener("touchmove",X),f.removeEventListener("touchend",H)}f.addEventListener("mousemove",X),f.addEventListener("mouseup",H),f.addEventListener("touchmove",X),f.addEventListener("touchend",H)}const Ab=()=>!0,lP=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),cP=(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}},kj=N.forwardRef(({type:e="source",position:t=qe.Top,isValidConnection:n,isConnectable:s=!0,isConnectableStart:i=!0,isConnectableEnd:a=!0,id:l,onConnect:u,children:h,className:p,onMouseDown:f,onTouchStart:g,...y},w)=>{var M,A;const S=l||null,b=e==="target",_=At(),k=JO(),{connectOnClick:E,noPanClassName:C}=it(lP,$t),{connecting:j,clickConnecting:I}=it(cP(k,S,e),$t);k||(A=(M=_.getState()).onError)==null||A.call(M,"010",Zr.error010());const O=q=>{const{defaultEdgeOptions:W,onConnect:V,hasDefaultEdges:T}=_.getState(),Q={...W,...q};if(T){const{edges:U,setEdges:ne}=_.getState();ne(rP(Q,U))}V==null||V(Q),u==null||u(Q)},P=q=>{if(!k)return;const W=dj(q);i&&(W&&q.button===0||!W)&&_j({event:q,handleId:S,nodeId:k,onConnect:O,isTarget:b,getState:_.getState,setState:_.setState,isValidConnection:n||_.getState().isValidConnection||Ab}),W?f==null||f(q):g==null||g(q)},F=q=>{const{onClickConnectStart:W,onClickConnectEnd:V,connectionClickStartHandle:T,connectionMode:Q,isValidConnection:U}=_.getState();if(!k||!T&&!i)return;if(!T){W==null||W(q,{nodeId:k,handleId:S,handleType:e}),_.setState({connectionClickStartHandle:{nodeId:k,type:e,handleId:S}});return}const ne=aj(q.target),X=n||U||Ab,{connection:H,isValid:J}=bj({nodeId:k,id:S,type:e},Q,T.nodeId,T.handleId||null,T.type,X,ne);J&&O(H),V==null||V(q),_.setState({connectionClickStartHandle:null})};return ue.createElement("div",{"data-handleid":S,"data-nodeid":k,"data-handlepos":t,"data-id":`${k}-${S}-${e}`,className:Wt(["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?F:void 0,ref:w,...y},h)});kj.displayName="Handle";var Fi=N.memo(kj);const Sj=({data:e,isConnectable:t,targetPosition:n=qe.Top,sourcePosition:s=qe.Bottom})=>ue.createElement(ue.Fragment,null,ue.createElement(Fi,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,ue.createElement(Fi,{type:"source",position:s,isConnectable:t}));Sj.displayName="DefaultNode";var Ay=N.memo(Sj);const Nj=({data:e,isConnectable:t,sourcePosition:n=qe.Bottom})=>ue.createElement(ue.Fragment,null,e==null?void 0:e.label,ue.createElement(Fi,{type:"source",position:n,isConnectable:t}));Nj.displayName="InputNode";var Ej=N.memo(Nj);const Cj=({data:e,isConnectable:t,targetPosition:n=qe.Top})=>ue.createElement(ue.Fragment,null,ue.createElement(Fi,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label);Cj.displayName="OutputNode";var jj=N.memo(Cj);const pw=()=>null;pw.displayName="GroupNode";const uP=e=>({selectedNodes:e.getNodes().filter(t=>t.selected),selectedEdges:e.edges.filter(t=>t.selected).map(t=>({...t}))}),Wc=e=>e.id;function dP(e,t){return $t(e.selectedNodes.map(Wc),t.selectedNodes.map(Wc))&&$t(e.selectedEdges.map(Wc),t.selectedEdges.map(Wc))}const Tj=N.memo(({onSelectionChange:e})=>{const t=At(),{selectedNodes:n,selectedEdges:s}=it(uP,dP);return N.useEffect(()=>{const i={nodes:n,edges:s};e==null||e(i),t.getState().onSelectionChange.forEach(a=>a(i))},[n,s,e]),null});Tj.displayName="SelectionListener";const fP=e=>!!e.onSelectionChange;function hP({onSelectionChange:e}){const t=it(fP);return e||t?ue.createElement(Tj,{onSelectionChange:e}):null}const pP=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 xi(e,t){N.useEffect(()=>{typeof e<"u"&&t(e)},[e])}function Ze(e,t,n){N.useEffect(()=>{typeof t<"u"&&n({[e]:t})},[t])}const mP=({nodes:e,edges:t,defaultNodes:n,defaultEdges:s,onConnect:i,onConnectStart:a,onConnectEnd:l,onClickConnectStart:u,onClickConnectEnd:h,nodesDraggable:p,nodesConnectable:f,nodesFocusable:g,edgesFocusable:y,edgesUpdatable:w,elevateNodesOnSelect:S,minZoom:b,maxZoom:_,nodeExtent:k,onNodesChange:E,onEdgesChange:C,elementsSelectable:j,connectionMode:I,snapGrid:O,snapToGrid:P,translateExtent:F,connectOnClick:M,defaultEdgeOptions:A,fitView:q,fitViewOptions:W,onNodesDelete:V,onEdgesDelete:T,onNodeDrag:Q,onNodeDragStart:U,onNodeDragStop:ne,onSelectionDrag:X,onSelectionDragStart:H,onSelectionDragStop:J,noPanClassName:$,nodeOrigin:G,rfId:Z,autoPanOnConnect:D,autoPanOnNodeDrag:L,onError:Y,connectionRadius:re,isValidConnection:he,nodeDragThreshold:pe})=>{const{setNodes:we,setEdges:Ce,setDefaultNodesAndEdges:Ve,setMinZoom:Be,setMaxZoom:Le,setTranslateExtent:ke,setNodeExtent:ce,reset:be}=it(pP,$t),xe=At();return N.useEffect(()=>{const Ye=s==null?void 0:s.map(ut=>({...ut,...A}));return Ve(n,Ye),()=>{be()}},[]),Ze("defaultEdgeOptions",A,xe.setState),Ze("connectionMode",I,xe.setState),Ze("onConnect",i,xe.setState),Ze("onConnectStart",a,xe.setState),Ze("onConnectEnd",l,xe.setState),Ze("onClickConnectStart",u,xe.setState),Ze("onClickConnectEnd",h,xe.setState),Ze("nodesDraggable",p,xe.setState),Ze("nodesConnectable",f,xe.setState),Ze("nodesFocusable",g,xe.setState),Ze("edgesFocusable",y,xe.setState),Ze("edgesUpdatable",w,xe.setState),Ze("elementsSelectable",j,xe.setState),Ze("elevateNodesOnSelect",S,xe.setState),Ze("snapToGrid",P,xe.setState),Ze("snapGrid",O,xe.setState),Ze("onNodesChange",E,xe.setState),Ze("onEdgesChange",C,xe.setState),Ze("connectOnClick",M,xe.setState),Ze("fitViewOnInit",q,xe.setState),Ze("fitViewOnInitOptions",W,xe.setState),Ze("onNodesDelete",V,xe.setState),Ze("onEdgesDelete",T,xe.setState),Ze("onNodeDrag",Q,xe.setState),Ze("onNodeDragStart",U,xe.setState),Ze("onNodeDragStop",ne,xe.setState),Ze("onSelectionDrag",X,xe.setState),Ze("onSelectionDragStart",H,xe.setState),Ze("onSelectionDragStop",J,xe.setState),Ze("noPanClassName",$,xe.setState),Ze("nodeOrigin",G,xe.setState),Ze("rfId",Z,xe.setState),Ze("autoPanOnConnect",D,xe.setState),Ze("autoPanOnNodeDrag",L,xe.setState),Ze("onError",Y,xe.setState),Ze("connectionRadius",re,xe.setState),Ze("isValidConnection",he,xe.setState),Ze("nodeDragThreshold",pe,xe.setState),xi(e,we),xi(t,Ce),xi(b,Be),xi(_,Le),xi(F,ke),xi(k,ce),null},Mb={display:"none"},gP={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Rj="react-flow__node-desc",Aj="react-flow__edge-desc",vP="react-flow__aria-live",yP=e=>e.ariaLiveMessage;function wP({rfId:e}){const t=it(yP);return ue.createElement("div",{id:`${vP}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:gP},t)}function xP({rfId:e,disableKeyboardA11y:t}){return ue.createElement(ue.Fragment,null,ue.createElement("div",{id:`${Rj}-${e}`,style:Mb},"Press enter or space to select a node.",!t&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "),ue.createElement("div",{id:`${Aj}-${e}`,style:Mb},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!t&&ue.createElement(wP,{rfId:e}))}var ll=(e=null,t={actInsideInputWithModifier:!0})=>{const[n,s]=N.useState(!1),i=N.useRef(!1),a=N.useRef(new Set([])),[l,u]=N.useMemo(()=>{if(e!==null){const p=(Array.isArray(e)?e:[e]).filter(g=>typeof g=="string").map(g=>g.split("+")),f=p.reduce((g,y)=>g.concat(...y),[]);return[p,f]}return[[],[]]},[e]);return N.useEffect(()=>{const h=typeof document<"u"?document:null,p=(t==null?void 0:t.target)||h;if(e!==null){const f=w=>{if(i.current=w.ctrlKey||w.metaKey||w.shiftKey,(!i.current||i.current&&!t.actInsideInputWithModifier)&&Cy(w))return!1;const b=Ob(w.code,u);a.current.add(w[b]),Ib(l,a.current,!1)&&(w.preventDefault(),s(!0))},g=w=>{if((!i.current||i.current&&!t.actInsideInputWithModifier)&&Cy(w))return!1;const b=Ob(w.code,u);Ib(l,a.current,!0)?(s(!1),a.current.clear()):a.current.delete(w[b]),w.key==="Meta"&&a.current.clear(),i.current=!1},y=()=>{a.current.clear(),s(!1)};return p==null||p.addEventListener("keydown",f),p==null||p.addEventListener("keyup",g),window.addEventListener("blur",y),()=>{p==null||p.removeEventListener("keydown",f),p==null||p.removeEventListener("keyup",g),window.removeEventListener("blur",y)}}},[e,s]),n};function Ib(e,t,n){return e.filter(s=>n||s.length===t.size).some(s=>s.every(i=>t.has(i)))}function Ob(e,t){return t.includes(e)?"code":"key"}function Mj(e,t,n,s){var u,h;const i=e.parentNode||e.parentId;if(!i)return n;const a=t.get(i),l=xo(a,s);return Mj(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 Ij(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}=Mj(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 Bf(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 y=(p==null?void 0:p.type)&&(p==null?void 0:p.type)!==u.type;Object.defineProperty(f,Nt,{enumerable:!1,value:{handleBounds:y||(w=p==null?void 0:p[Nt])==null?void 0:w.handleBounds,z:h}}),i.set(u.id,f)}),Ij(i,n,a),i}function Oj(e,t={}){const{getNodes:n,width:s,height:i,minZoom:a,maxZoom:l,d3Zoom:u,d3Selection:h,fitViewOnInitDone:p,fitViewOnInit:f,nodeOrigin:g}=e(),y=t.initial&&!p&&f;if(u&&h&&(y||!t.initial)){const S=n().filter(_=>{var E;const k=t.includeHiddenNodes?_.width&&_.height:!_.hidden;return(E=t.nodes)!=null&&E.length?k&&t.nodes.some(C=>C.id===_.id):k}),b=S.every(_=>_.width&&_.height);if(S.length>0&&b){const _=Au(S,g),{x:k,y:E,zoom:C}=wj(_,s,i,t.minZoom??a,t.maxZoom??l,t.padding??.1),j=Xr.translate(k,E).scale(C);return typeof t.duration=="number"&&t.duration>0?u.transform(po(h,t.duration),j):u.transform(h,j),!0}}return!1}function bP(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 _P(e,t){return t.map(n=>{const s=e.find(i=>i.id===n.id);return s&&(n.selected=s.selected),n})}function Hc({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:bP(e,i)}),l==null||l(e)),t!=null&&t.length&&(p&&s({edges:_P(t,a)}),u==null||u(t))}const bi=()=>{},kP={zoomIn:bi,zoomOut:bi,zoomTo:bi,getZoom:()=>1,setViewport:bi,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:bi,fitBounds:bi,project:e=>e,screenToFlowPosition:e=>e,flowToScreenPosition:e=>e,viewportInitialized:!1},SP=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),NP=()=>{const e=At(),{d3Zoom:t,d3Selection:n}=it(SP,$t);return N.useMemo(()=>n&&t?{zoomIn:i=>t.scaleBy(po(n,i==null?void 0:i.duration),1.2),zoomOut:i=>t.scaleBy(po(n,i==null?void 0:i.duration),1/1.2),zoomTo:(i,a)=>t.scaleTo(po(n,a==null?void 0:a.duration),i),getZoom:()=>e.getState().transform[2],setViewport:(i,a)=>{const[l,u,h]=e.getState().transform,p=Xr.translate(i.x??l,i.y??u).scale(i.zoom??h);t.transform(po(n,a==null?void 0:a.duration),p)},getViewport:()=>{const[i,a,l]=e.getState().transform;return{x:i,y:a,zoom:l}},fitView:i=>Oj(e.getState,i),setCenter:(i,a,l)=>{const{width:u,height:h,maxZoom:p}=e.getState(),f=typeof(l==null?void 0:l.zoom)<"u"?l.zoom:p,g=u/2-i*f,y=h/2-a*f,w=Xr.translate(g,y).scale(f);t.transform(po(n,l==null?void 0:l.duration),w)},fitBounds:(i,a)=>{const{width:l,height:u,minZoom:h,maxZoom:p}=e.getState(),{x:f,y:g,zoom:y}=wj(i,l,u,h,p,(a==null?void 0:a.padding)??.1),w=Xr.translate(f,g).scale(y);t.transform(po(n,a==null?void 0:a.duration),w)},project:i=>{const{transform:a,snapToGrid:l,snapGrid:u}=e.getState();return console.warn("[DEPRECATED] `project` is deprecated. Instead use `screenToFlowPosition`. There is no need to subtract the react flow bounds anymore! https://reactflow.dev/api-reference/types/react-flow-instance#screen-to-flow-position"),Ry(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 Ry(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=gj(i,a);return{x:p.x+u,y:p.y+h}},viewportInitialized:!0}:kP,[t,n])};function vl(){const e=NP(),t=At(),n=N.useCallback(()=>t.getState().getNodes().map(b=>({...b})),[]),s=N.useCallback(b=>t.getState().nodeInternals.get(b),[]),i=N.useCallback(()=>{const{edges:b=[]}=t.getState();return b.map(_=>({..._}))},[]),a=N.useCallback(b=>{const{edges:_=[]}=t.getState();return _.find(k=>k.id===b)},[]),l=N.useCallback(b=>{const{getNodes:_,setNodes:k,hasDefaultNodes:E,onNodesChange:C}=t.getState(),j=_(),I=typeof b=="function"?b(j):b;if(E)k(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=N.useCallback(b=>{const{edges:_=[],setEdges:k,hasDefaultEdges:E,onEdgesChange:C}=t.getState(),j=typeof b=="function"?b(_):b;if(E)k(j);else if(C){const I=j.length===0?_.map(O=>({type:"remove",id:O.id})):j.map(O=>({item:O,type:"reset"}));C(I)}},[]),h=N.useCallback(b=>{const _=Array.isArray(b)?b:[b],{getNodes:k,setNodes:E,hasDefaultNodes:C,onNodesChange:j}=t.getState();if(C){const O=[...k(),..._];E(O)}else if(j){const I=_.map(O=>({item:O,type:"add"}));j(I)}},[]),p=N.useCallback(b=>{const _=Array.isArray(b)?b:[b],{edges:k=[],setEdges:E,hasDefaultEdges:C,onEdgesChange:j}=t.getState();if(C)E([...k,..._]);else if(j){const I=_.map(O=>({item:O,type:"add"}));j(I)}},[]),f=N.useCallback(()=>{const{getNodes:b,edges:_=[],transform:k}=t.getState(),[E,C,j]=k;return{nodes:b().map(I=>({...I})),edges:_.map(I=>({...I})),viewport:{x:E,y:C,zoom:j}}},[]),g=N.useCallback(({nodes:b,edges:_})=>{const{nodeInternals:k,getNodes:E,edges:C,hasDefaultNodes:j,hasDefaultEdges:I,onNodesDelete:O,onEdgesDelete:P,onNodesChange:F,onEdgesChange:M}=t.getState(),A=(b||[]).map(Q=>Q.id),q=(_||[]).map(Q=>Q.id),W=E().reduce((Q,U)=>{const ne=U.parentNode||U.parentId,X=!A.includes(U.id)&&ne&&Q.find(J=>J.id===ne);return(typeof U.deletable=="boolean"?U.deletable:!0)&&(A.includes(U.id)||X)&&Q.push(U),Q},[]),V=C.filter(Q=>typeof Q.deletable=="boolean"?Q.deletable:!0),T=V.filter(Q=>q.includes(Q.id));if(W||T){const Q=yj(W,V),U=[...T,...Q],ne=U.reduce((X,H)=>(X.includes(H.id)||X.push(H.id),X),[]);if((I||j)&&(I&&t.setState({edges:C.filter(X=>!ne.includes(X.id))}),j&&(W.forEach(X=>{k.delete(X.id)}),t.setState({nodeInternals:new Map(k)}))),ne.length>0&&(P==null||P(U),M&&M(ne.map(X=>({id:X,type:"remove"})))),W.length>0&&(O==null||O(W),F)){const X=W.map(H=>({id:H.id,type:"remove"}));F(X)}}},[]),y=N.useCallback(b=>{const _=HO(b),k=_?null:t.getState().nodeInternals.get(b.id);return!_&&!k?[null,null,_]:[_?b:Nb(k),k,_]},[]),w=N.useCallback((b,_=!0,k)=>{const[E,C,j]=y(b);return E?(k||t.getState().getNodes()).filter(I=>{if(!j&&(I.id===C.id||!I.positionAbsolute))return!1;const O=Nb(I),P=Ey(O,E);return _&&P>0||P>=E.width*E.height}):[]},[]),S=N.useCallback((b,_,k=!0)=>{const[E]=y(b);if(!E)return!1;const C=Ey(E,_);return k&&C>0||C>=E.width*E.height},[]);return N.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:S}),[e,n,s,i,a,l,u,h,p,f,g,w,S])}const EP={actInsideInputWithModifier:!1};var CP=({deleteKeyCode:e,multiSelectionKeyCode:t})=>{const n=At(),{deleteElements:s}=vl(),i=ll(e,EP),a=ll(t);N.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]),N.useEffect(()=>{n.setState({multiSelectionActive:a})},[a])};function jP(e){const t=At();N.useEffect(()=>{let n;const s=()=>{var a,l;if(!e.current)return;const i=aw(e.current);(i.height===0||i.width===0)&&((l=(a=t.getState()).onError)==null||l.call(a,"004",Zr.error004())),t.setState({width:i.width||500,height:i.height||500})};return s(),window.addEventListener("resize",s),e.current&&(n=new ResizeObserver(()=>s()),n.observe(e.current)),()=>{window.removeEventListener("resize",s),n&&e.current&&n.unobserve(e.current)}},[])}const mw={position:"absolute",width:"100%",height:"100%",top:0,left:0},TP=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,Gc=e=>({x:e.x,y:e.y,zoom:e.k}),_i=(e,t)=>e.target.closest(`.${t}`),Pb=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),$b=e=>{const t=e.ctrlKey&&mu()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t},RP=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),AP=({onMove:e,onMoveStart:t,onMoveEnd:n,onPaneContextMenu:s,zoomOnScroll:i=!0,zoomOnPinch:a=!0,panOnScroll:l=!1,panOnScrollSpeed:u=.5,panOnScrollMode:h=yo.Free,zoomOnDoubleClick:p=!0,elementsSelectable:f,panOnDrag:g=!0,defaultViewport:y,translateExtent:w,minZoom:S,maxZoom:b,zoomActivationKeyCode:_,preventScrolling:k=!0,children:E,noWheelClassName:C,noPanClassName:j})=>{const I=N.useRef(),O=At(),P=N.useRef(!1),F=N.useRef(!1),M=N.useRef(null),A=N.useRef({x:0,y:0,zoom:0}),{d3Zoom:q,d3Selection:W,d3ZoomHandler:V,userSelectionActive:T}=it(RP,$t),Q=ll(_),U=N.useRef(0),ne=N.useRef(!1),X=N.useRef();return jP(M),N.useEffect(()=>{if(M.current){const H=M.current.getBoundingClientRect(),J=sj().scaleExtent([S,b]).translateExtent(w),$=$n(M.current).call(J),G=Xr.translate(y.x,y.y).scale(Di(y.zoom,S,b)),Z=[[0,0],[H.width,H.height]],D=J.constrain()(G,Z,w);J.transform($,D),J.wheelDelta($b),O.setState({d3Zoom:J,d3Selection:$,d3ZoomHandler:$.on("wheel.zoom"),transform:[D.x,D.y,D.k],domNode:M.current.closest(".react-flow")})}},[]),N.useEffect(()=>{W&&q&&(l&&!Q&&!T?W.on("wheel.zoom",H=>{if(_i(H,C))return!1;H.preventDefault(),H.stopImmediatePropagation();const J=W.property("__zoom").k||1;if(H.ctrlKey&&a){const he=rr(H),pe=$b(H),we=J*Math.pow(2,pe);q.scaleTo(W,we,he,H);return}const $=H.deltaMode===1?20:1;let G=h===yo.Vertical?0:H.deltaX*$,Z=h===yo.Horizontal?0:H.deltaY*$;!mu()&&H.shiftKey&&h!==yo.Vertical&&(G=H.deltaY*$,Z=0),q.translateBy(W,-(G/J)*u,-(Z/J)*u,{internal:!0});const D=Gc(W.property("__zoom")),{onViewportChangeStart:L,onViewportChange:Y,onViewportChangeEnd:re}=O.getState();clearTimeout(X.current),ne.current||(ne.current=!0,t==null||t(H,D),L==null||L(D)),ne.current&&(e==null||e(H,D),Y==null||Y(D),X.current=setTimeout(()=>{n==null||n(H,D),re==null||re(D),ne.current=!1},150))},{passive:!1}):typeof V<"u"&&W.on("wheel.zoom",function(H,J){if(!k&&H.type==="wheel"&&!H.ctrlKey||_i(H,C))return null;H.preventDefault(),V.call(this,H,J)},{passive:!1}))},[T,l,h,W,q,V,Q,a,k,C,t,e,n]),N.useEffect(()=>{q&&q.on("start",H=>{var G,Z;if(!H.sourceEvent||H.sourceEvent.internal)return null;U.current=(G=H.sourceEvent)==null?void 0:G.button;const{onViewportChangeStart:J}=O.getState(),$=Gc(H.transform);P.current=!0,A.current=$,((Z=H.sourceEvent)==null?void 0:Z.type)==="mousedown"&&O.setState({paneDragging:!0}),J==null||J($),t==null||t(H.sourceEvent,$)})},[q,t]),N.useEffect(()=>{q&&(T&&!P.current?q.on("zoom",null):T||q.on("zoom",H=>{var $;const{onViewportChange:J}=O.getState();if(O.setState({transform:[H.transform.x,H.transform.y,H.transform.k]}),F.current=!!(s&&Pb(g,U.current??0)),(e||J)&&!(($=H.sourceEvent)!=null&&$.internal)){const G=Gc(H.transform);J==null||J(G),e==null||e(H.sourceEvent,G)}}))},[T,q,e,g,s]),N.useEffect(()=>{q&&q.on("end",H=>{if(!H.sourceEvent||H.sourceEvent.internal)return null;const{onViewportChangeEnd:J}=O.getState();if(P.current=!1,O.setState({paneDragging:!1}),s&&Pb(g,U.current??0)&&!F.current&&s(H.sourceEvent),F.current=!1,(n||J)&&TP(A.current,H.transform)){const $=Gc(H.transform);A.current=$,clearTimeout(I.current),I.current=setTimeout(()=>{J==null||J($),n==null||n(H.sourceEvent,$)},l?150:0)}})},[q,l,g,n,s]),N.useEffect(()=>{q&&q.filter(H=>{const J=Q||i,$=a&&H.ctrlKey;if((g===!0||Array.isArray(g)&&g.includes(1))&&H.button===1&&H.type==="mousedown"&&(_i(H,"react-flow__node")||_i(H,"react-flow__edge")))return!0;if(!g&&!J&&!l&&!p&&!a||T||!p&&H.type==="dblclick"||_i(H,C)&&H.type==="wheel"||_i(H,j)&&(H.type!=="wheel"||l&&H.type==="wheel"&&!Q)||!a&&H.ctrlKey&&H.type==="wheel"||!J&&!l&&!$&&H.type==="wheel"||!g&&(H.type==="mousedown"||H.type==="touchstart")||Array.isArray(g)&&!g.includes(H.button)&&H.type==="mousedown")return!1;const G=Array.isArray(g)&&g.includes(H.button)||!H.button||H.button<=1;return(!H.ctrlKey||H.type==="wheel")&&G})},[T,q,i,a,l,p,g,f,Q]),ue.createElement("div",{className:"react-flow__renderer",ref:M,style:mw},E)},MP=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function IP(){const{userSelectionActive:e,userSelectionRect:t}=it(MP,$t);return e&&t?ue.createElement("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}function Lb(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 OP(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&&Lb(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&&Lb(s,l);break}case"remove":return s}return s.push(l),s},n)}function PP(e,t){return OP(e,t)}const Rs=(e,t)=>({id:e,type:"select",selected:t});function ji(e,t){return e.reduce((n,s)=>{const i=t.includes(s.id);return!s.selected&&i?(s.selected=!0,n.push(Rs(s.id,!0))):s.selected&&!i&&(s.selected=!1,n.push(Rs(s.id,!1))),n},[])}const Uf=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},$P=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),Pj=N.memo(({isSelecting:e,selectionMode:t=al.Full,panOnDrag:n,onSelectionStart:s,onSelectionEnd:i,onPaneClick:a,onPaneContextMenu:l,onPaneScroll:u,onPaneMouseEnter:h,onPaneMouseMove:p,onPaneMouseLeave:f,children:g})=>{const y=N.useRef(null),w=At(),S=N.useRef(0),b=N.useRef(0),_=N.useRef(),{userSelectionActive:k,elementsSelectable:E,dragging:C}=it($P,$t),j=()=>{w.setState({userSelectionActive:!1,userSelectionRect:null}),S.current=0,b.current=0},I=V=>{a==null||a(V),w.getState().resetSelectedElements(),w.setState({nodesSelectionActive:!1})},O=V=>{if(Array.isArray(n)&&(n!=null&&n.includes(2))){V.preventDefault();return}l==null||l(V)},P=u?V=>u(V):void 0,F=V=>{const{resetSelectedElements:T,domNode:Q}=w.getState();if(_.current=Q==null?void 0:Q.getBoundingClientRect(),!E||!e||V.button!==0||V.target!==y.current||!_.current)return;const{x:U,y:ne}=Ms(V,_.current);T(),w.setState({userSelectionRect:{width:0,height:0,startX:U,startY:ne,x:U,y:ne}}),s==null||s(V)},M=V=>{const{userSelectionRect:T,nodeInternals:Q,edges:U,transform:ne,onNodesChange:X,onEdgesChange:H,nodeOrigin:J,getNodes:$}=w.getState();if(!e||!_.current||!T)return;w.setState({userSelectionActive:!0,nodesSelectionActive:!1});const G=Ms(V,_.current),Z=T.startX??0,D=T.startY??0,L={...T,x:G.x<Z?G.x:Z,y:G.y<D?G.y:D,width:Math.abs(G.x-Z),height:Math.abs(G.y-D)},Y=$(),re=vj(Q,L,ne,t===al.Partial,!0,J),he=yj(re,U).map(we=>we.id),pe=re.map(we=>we.id);if(S.current!==pe.length){S.current=pe.length;const we=ji(Y,pe);we.length&&(X==null||X(we))}if(b.current!==he.length){b.current=he.length;const we=ji(U,he);we.length&&(H==null||H(we))}w.setState({userSelectionRect:L})},A=V=>{if(V.button!==0)return;const{userSelectionRect:T}=w.getState();!k&&T&&V.target===y.current&&(I==null||I(V)),w.setState({nodesSelectionActive:S.current>0}),j(),i==null||i(V)},q=V=>{k&&(w.setState({nodesSelectionActive:S.current>0}),i==null||i(V)),j()},W=E&&(e||k);return ue.createElement("div",{className:Wt(["react-flow__pane",{dragging:C,selection:e}]),onClick:W?void 0:Uf(I,y),onContextMenu:Uf(O,y),onWheel:Uf(P,y),onMouseEnter:W?void 0:h,onMouseDown:W?F:void 0,onMouseMove:W?M:p,onMouseUp:W?A:void 0,onMouseLeave:W?q:f,ref:y,style:mw},g,ue.createElement(IP,null))});Pj.displayName="Pane";function $j(e,t){const n=e.parentNode||e.parentId;if(!n)return!1;const s=t.get(n);return s?s.selected?!0:$j(s,t):!1}function qb(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 LP(e,t,n,s){return Array.from(e.values()).filter(i=>(i.selected||i.id===s)&&(!i.parentNode||i.parentId||!$j(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 qP(e,t){return!t||t==="parent"?t:[t[0],[t[1][0]-(e.width||0),t[1][1]-(e.height||0)]]}function Lj(e,t,n,s,i=[0,0],a){const l=qP(e,e.extent||s);let u=l;const h=e.parentNode||e.parentId;if(e.extent==="parent"&&!e.expandParent)if(h&&e.width&&e.height){const g=n.get(h),{x:y,y:w}=xo(g,i).positionAbsolute;u=g&&Ln(y)&&Ln(w)&&Ln(g.width)&&Ln(g.height)?[[y+e.width*i[0],w+e.height*i[1]],[y+g.width-e.width+e.width*i[0],w+g.height-e.height+e.height*i[1]]]:u}else a==null||a("005",Zr.error005()),u=l;else if(e.extent&&h&&e.extent!=="parent"){const g=n.get(h),{x:y,y:w}=xo(g,i).positionAbsolute;u=[[e.extent[0][0]+y,e.extent[0][1]+w],[e.extent[1][0]+y,e.extent[1][1]+w]]}let p={x:0,y:0};if(h){const g=n.get(h);p=xo(g,i).positionAbsolute}const f=u&&u!=="parent"?lw(t,u):t;return{position:{x:f.x-p.x,y:f.y-p.y},positionAbsolute:f}}function Wf({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 Db=(e,t,n,s)=>{const i=t.querySelectorAll(e);if(!i||!i.length)return null;const a=Array.from(i),l=t.getBoundingClientRect(),u={x:l.width*s[0],y:l.height*s[1]};return a.map(h=>{const p=h.getBoundingClientRect();return{id:h.getAttribute("data-handleid"),position:h.getAttribute("data-handlepos"),x:(p.left-l.left-u.x)/n,y:(p.top-l.top-u.y)/n,...aw(h)}})};function Ba(e,t,n){return n===void 0?n:s=>{const i=t().nodeInternals.get(e);i&&n(s,{...i})}}function My({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",Zr.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 DP(){const e=At();return N.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 Hf(e){return(t,n,s)=>e==null?void 0:e(t,s)}function qj({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:s,nodeId:i,isSelectable:a,selectNodesOnDrag:l}){const u=At(),[h,p]=N.useState(!1),f=N.useRef([]),g=N.useRef({x:null,y:null}),y=N.useRef(0),w=N.useRef(null),S=N.useRef({x:0,y:0}),b=N.useRef(null),_=N.useRef(!1),k=N.useRef(!1),E=N.useRef(!1),C=DP();return N.useEffect(()=>{if(e!=null&&e.current){const j=$n(e.current),I=({x:F,y:M})=>{const{nodeInternals:A,onNodeDrag:q,onSelectionDrag:W,updateNodePositions:V,nodeExtent:T,snapGrid:Q,snapToGrid:U,nodeOrigin:ne,onError:X}=u.getState();g.current={x:F,y:M};let H=!1,J={x:0,y:0,x2:0,y2:0};if(f.current.length>1&&T){const G=Au(f.current,ne);J=il(G)}if(f.current=f.current.map(G=>{const Z={x:F-G.distance.x,y:M-G.distance.y};U&&(Z.x=Q[0]*Math.round(Z.x/Q[0]),Z.y=Q[1]*Math.round(Z.y/Q[1]));const D=[[T[0][0],T[0][1]],[T[1][0],T[1][1]]];f.current.length>1&&T&&!G.extent&&(D[0][0]=G.positionAbsolute.x-J.x+T[0][0],D[1][0]=G.positionAbsolute.x+(G.width??0)-J.x2+T[1][0],D[0][1]=G.positionAbsolute.y-J.y+T[0][1],D[1][1]=G.positionAbsolute.y+(G.height??0)-J.y2+T[1][1]);const L=Lj(G,Z,A,D,ne,X);return H=H||G.position.x!==L.position.x||G.position.y!==L.position.y,G.position=L.position,G.positionAbsolute=L.positionAbsolute,G}),!H)return;V(f.current,!0,!0),p(!0);const $=i?q:Hf(W);if($&&b.current){const[G,Z]=Wf({nodeId:i,dragItems:f.current,nodeInternals:A});$(b.current,G,Z)}},O=()=>{if(!w.current)return;const[F,M]=ij(S.current,w.current);if(F!==0||M!==0){const{transform:A,panBy:q}=u.getState();g.current.x=(g.current.x??0)-F/A[2],g.current.y=(g.current.y??0)-M/A[2],q({x:F,y:M})&&I(g.current)}y.current=requestAnimationFrame(O)},P=F=>{var ne;const{nodeInternals:M,multiSelectionActive:A,nodesDraggable:q,unselectNodesAndEdges:W,onNodeDragStart:V,onSelectionDragStart:T}=u.getState();k.current=!0;const Q=i?V:Hf(T);(!l||!a)&&!A&&i&&((ne=M.get(i))!=null&&ne.selected||W()),i&&a&&l&&My({id:i,store:u,nodeRef:e});const U=C(F);if(g.current=U,f.current=LP(M,q,U,i),Q&&f.current){const[X,H]=Wf({nodeId:i,dragItems:f.current,nodeInternals:M});Q(F.sourceEvent,X,H)}};if(t)j.on(".drag",null);else{const F=KM().on("start",M=>{const{domNode:A,nodeDragThreshold:q}=u.getState();q===0&&P(M),E.current=!1;const W=C(M);g.current=W,w.current=(A==null?void 0:A.getBoundingClientRect())||null,S.current=Ms(M.sourceEvent,w.current)}).on("drag",M=>{var V,T;const A=C(M),{autoPanOnNodeDrag:q,nodeDragThreshold:W}=u.getState();if(M.sourceEvent.type==="touchmove"&&M.sourceEvent.touches.length>1&&(E.current=!0),!E.current){if(!_.current&&k.current&&q&&(_.current=!0,O()),!k.current){const Q=A.xSnapped-(((V=g==null?void 0:g.current)==null?void 0:V.x)??0),U=A.ySnapped-(((T=g==null?void 0:g.current)==null?void 0:T.y)??0);Math.sqrt(Q*Q+U*U)>W&&P(M)}(g.current.x!==A.xSnapped||g.current.y!==A.ySnapped)&&f.current&&k.current&&(b.current=M.sourceEvent,S.current=Ms(M.sourceEvent,w.current),I(A))}}).on("end",M=>{if(!(!k.current||E.current)&&(p(!1),_.current=!1,k.current=!1,cancelAnimationFrame(y.current),f.current)){const{updateNodePositions:A,nodeInternals:q,onNodeDragStop:W,onSelectionDragStop:V}=u.getState(),T=i?W:Hf(V);if(A(f.current,!1,!1),T){const[Q,U]=Wf({nodeId:i,dragItems:f.current,nodeInternals:q});T(M.sourceEvent,Q,U)}}}).filter(M=>{const A=M.target;return!M.button&&(!n||!qb(A,`.${n}`,e))&&(!s||qb(A,s,e))});return j.call(F),()=>{j.on(".drag",null)}}}},[e,t,n,s,a,u,i,l,C]),h}function Dj(){const e=At();return N.useCallback(n=>{const{nodeInternals:s,nodeExtent:i,updateNodePositions:a,getNodes:l,snapToGrid:u,snapGrid:h,onError:p,nodesDraggable:f}=e.getState(),g=l().filter(E=>E.selected&&(E.draggable||f&&typeof E.draggable>"u")),y=u?h[0]:5,w=u?h[1]:5,S=n.isShiftPressed?4:1,b=n.x*y*S,_=n.y*w*S,k=g.map(E=>{if(E.positionAbsolute){const C={x:E.positionAbsolute.x+b,y:E.positionAbsolute.y+_};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}=Lj(E,C,s,i,void 0,p);E.position=I,E.positionAbsolute=j}return E});a(k,!0,!1)},[])}const Ii={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var Ua=e=>{const t=({id:n,type:s,data:i,xPos:a,yPos:l,xPosOrigin:u,yPosOrigin:h,selected:p,onClick:f,onMouseEnter:g,onMouseMove:y,onMouseLeave:w,onContextMenu:S,onDoubleClick:b,style:_,className:k,isDraggable:E,isSelectable:C,isConnectable:j,isFocusable:I,selectNodesOnDrag:O,sourcePosition:P,targetPosition:F,hidden:M,resizeObserver:A,dragHandle:q,zIndex:W,isParent:V,noDragClassName:T,noPanClassName:Q,initialized:U,disableKeyboardA11y:ne,ariaLabel:X,rfId:H,hasHandleBounds:J})=>{const $=At(),G=N.useRef(null),Z=N.useRef(null),D=N.useRef(P),L=N.useRef(F),Y=N.useRef(s),re=C||E||f||g||y||w,he=Dj(),pe=Ba(n,$.getState,g),we=Ba(n,$.getState,y),Ce=Ba(n,$.getState,w),Ve=Ba(n,$.getState,S),Be=Ba(n,$.getState,b),Le=be=>{const{nodeDragThreshold:xe}=$.getState();if(C&&(!O||!E||xe>0)&&My({id:n,store:$,nodeRef:G}),f){const Ye=$.getState().nodeInternals.get(n);Ye&&f(be,{...Ye})}},ke=be=>{if(!Cy(be)&&!ne)if(uj.includes(be.key)&&C){const xe=be.key==="Escape";My({id:n,store:$,unselect:xe,nodeRef:G})}else E&&p&&Object.prototype.hasOwnProperty.call(Ii,be.key)&&($.setState({ariaLiveMessage:`Moved selected node ${be.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~a}, y: ${~~l}`}),he({x:Ii[be.key].x,y:Ii[be.key].y,isShiftPressed:be.shiftKey}))};N.useEffect(()=>()=>{Z.current&&(A==null||A.unobserve(Z.current),Z.current=null)},[]),N.useEffect(()=>{if(G.current&&!M){const be=G.current;(!U||!J||Z.current!==be)&&(Z.current&&(A==null||A.unobserve(Z.current)),A==null||A.observe(be),Z.current=be)}},[M,U,J]),N.useEffect(()=>{const be=Y.current!==s,xe=D.current!==P,Ye=L.current!==F;G.current&&(be||xe||Ye)&&(be&&(Y.current=s),xe&&(D.current=P),Ye&&(L.current=F),$.getState().updateNodeDimensions([{id:n,nodeElement:G.current,forceUpdate:!0}]))},[n,s,P,F]);const ce=qj({nodeRef:G,disabled:M||!E,noDragClassName:T,handleSelector:q,nodeId:n,isSelectable:C,selectNodesOnDrag:O});return M?null:ue.createElement("div",{className:Wt(["react-flow__node",`react-flow__node-${s}`,{[Q]:E},k,{selected:p,selectable:C,parent:V,dragging:ce}]),ref:G,style:{zIndex:W,transform:`translate(${u}px,${h}px)`,pointerEvents:re?"all":"none",visibility:U?"visible":"hidden",..._},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:pe,onMouseMove:we,onMouseLeave:Ce,onContextMenu:Ve,onClick:Le,onDoubleClick:Be,onKeyDown:I?ke:void 0,tabIndex:I?0:void 0,role:I?"button":void 0,"aria-describedby":ne?void 0:`${Rj}-${H}`,"aria-label":X},ue.createElement(ZO,{value:n},ue.createElement(e,{id:n,data:i,type:s,xPos:a,yPos:l,selected:p,isConnectable:j,sourcePosition:P,targetPosition:F,dragging:ce,dragHandle:q,zIndex:W})))};return t.displayName="NodeWrapper",N.memo(t)};const FP=e=>{const t=e.getNodes().filter(n=>n.selected);return{...Au(t,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};function zP({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const s=At(),{width:i,height:a,x:l,y:u,transformString:h,userSelectionActive:p}=it(FP,$t),f=Dj(),g=N.useRef(null);if(N.useEffect(()=>{var S;n||(S=g.current)==null||S.focus({preventScroll:!0})},[n]),qj({nodeRef:g}),p||!i||!a)return null;const y=e?S=>{const b=s.getState().getNodes().filter(_=>_.selected);e(S,b)}:void 0,w=S=>{Object.prototype.hasOwnProperty.call(Ii,S.key)&&f({x:Ii[S.key].x,y:Ii[S.key].y,isShiftPressed:S.shiftKey})};return ue.createElement("div",{className:Wt(["react-flow__nodesselection","react-flow__container",t]),style:{transform:h}},ue.createElement("div",{ref:g,className:"react-flow__nodesselection-rect",onContextMenu:y,tabIndex:n?void 0:-1,onKeyDown:n?void 0:w,style:{width:i,height:a,top:u,left:l}}))}var BP=N.memo(zP);const UP=e=>e.nodesSelectionActive,Fj=({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:s,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:l,deleteKeyCode:u,onMove:h,onMoveStart:p,onMoveEnd:f,selectionKeyCode:g,selectionOnDrag:y,selectionMode:w,onSelectionStart:S,onSelectionEnd:b,multiSelectionKeyCode:_,panActivationKeyCode:k,zoomActivationKeyCode:E,elementsSelectable:C,zoomOnScroll:j,zoomOnPinch:I,panOnScroll:O,panOnScrollSpeed:P,panOnScrollMode:F,zoomOnDoubleClick:M,panOnDrag:A,defaultViewport:q,translateExtent:W,minZoom:V,maxZoom:T,preventScrolling:Q,onSelectionContextMenu:U,noWheelClassName:ne,noPanClassName:X,disableKeyboardA11y:H})=>{const J=it(UP),$=ll(g),G=ll(k),Z=G||A,D=G||O,L=$||y&&Z!==!0;return CP({deleteKeyCode:u,multiSelectionKeyCode:_}),ue.createElement(AP,{onMove:h,onMoveStart:p,onMoveEnd:f,onPaneContextMenu:a,elementsSelectable:C,zoomOnScroll:j,zoomOnPinch:I,panOnScroll:D,panOnScrollSpeed:P,panOnScrollMode:F,zoomOnDoubleClick:M,panOnDrag:!$&&Z,defaultViewport:q,translateExtent:W,minZoom:V,maxZoom:T,zoomActivationKeyCode:E,preventScrolling:Q,noWheelClassName:ne,noPanClassName:X},ue.createElement(Pj,{onSelectionStart:S,onSelectionEnd:b,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:s,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:l,panOnDrag:Z,isSelecting:!!L,selectionMode:w},e,J&&ue.createElement(BP,{onSelectionContextMenu:U,noPanClassName:X,disableKeyboardA11y:H})))};Fj.displayName="FlowRenderer";var WP=N.memo(Fj);function HP(e){return it(N.useCallback(n=>e?vj(n.nodeInternals,{x:0,y:0,width:n.width,height:n.height},n.transform,!0):n.getNodes(),[e]))}function GP(e){const t={input:Ua(e.input||Ej),default:Ua(e.default||Ay),output:Ua(e.output||jj),group:Ua(e.group||pw)},n={},s=Object.keys(e).filter(i=>!["input","default","output","group"].includes(i)).reduce((i,a)=>(i[a]=Ua(e[a]||Ay),i),n);return{...t,...s}}const VP=({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]},YP=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),zj=e=>{const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:s,elementsSelectable:i,updateNodeDimensions:a,onError:l}=it(YP,$t),u=HP(e.onlyRenderVisibleElements),h=N.useRef(),p=N.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const f=new ResizeObserver(g=>{const y=g.map(w=>({id:w.target.getAttribute("data-id"),nodeElement:w.target,forceUpdate:!0}));a(y)});return h.current=f,f},[]);return N.useEffect(()=>()=>{var f;(f=h==null?void 0:h.current)==null||f.disconnect()},[]),ue.createElement("div",{className:"react-flow__nodes",style:mw},u.map(f=>{var I,O,P;let g=f.type||"default";e.nodeTypes[g]||(l==null||l("003",Zr.error003(g)),g="default");const y=e.nodeTypes[g]||e.nodeTypes.default,w=!!(f.draggable||t&&typeof f.draggable>"u"),S=!!(f.selectable||i&&typeof f.selectable>"u"),b=!!(f.connectable||n&&typeof f.connectable>"u"),_=!!(f.focusable||s&&typeof f.focusable>"u"),k=e.nodeExtent?lw(f.positionAbsolute,e.nodeExtent):f.positionAbsolute,E=(k==null?void 0:k.x)??0,C=(k==null?void 0:k.y)??0,j=VP({x:E,y:C,width:f.width??0,height:f.height??0,origin:e.nodeOrigin});return ue.createElement(y,{key:f.id,id:f.id,className:f.className,style:f.style,type:g,data:f.data,sourcePosition:f.sourcePosition||qe.Bottom,targetPosition:f.targetPosition||qe.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:S,isConnectable:b,isFocusable:_,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)})}))};zj.displayName="NodeRenderer";var KP=N.memo(zj);const XP=(e,t,n)=>n===qe.Left?e-t:n===qe.Right?e+t:e,QP=(e,t,n)=>n===qe.Top?e-t:n===qe.Bottom?e+t:e,Fb="react-flow__edgeupdater",zb=({position:e,centerX:t,centerY:n,radius:s=10,onMouseDown:i,onMouseEnter:a,onMouseOut:l,type:u})=>ue.createElement("circle",{onMouseDown:i,onMouseEnter:a,onMouseOut:l,className:Wt([Fb,`${Fb}-${u}`]),cx:XP(t,s,e),cy:QP(n,s,e),r:s,stroke:"transparent",fill:"transparent"}),ZP=()=>!0;var ki=e=>{const t=({id:n,className:s,type:i,data:a,onClick:l,onEdgeDoubleClick:u,selected:h,animated:p,label:f,labelStyle:g,labelShowBg:y,labelBgStyle:w,labelBgPadding:S,labelBgBorderRadius:b,style:_,source:k,target:E,sourceX:C,sourceY:j,targetX:I,targetY:O,sourcePosition:P,targetPosition:F,elementsSelectable:M,hidden:A,sourceHandleId:q,targetHandleId:W,onContextMenu:V,onMouseEnter:T,onMouseMove:Q,onMouseLeave:U,reconnectRadius:ne,onReconnect:X,onReconnectStart:H,onReconnectEnd:J,markerEnd:$,markerStart:G,rfId:Z,ariaLabel:D,isFocusable:L,isReconnectable:Y,pathOptions:re,interactionWidth:he,disableKeyboardA11y:pe})=>{const we=N.useRef(null),[Ce,Ve]=N.useState(!1),[Be,Le]=N.useState(!1),ke=At(),ce=N.useMemo(()=>`url('#${Ty(G,Z)}')`,[G,Z]),be=N.useMemo(()=>`url('#${Ty($,Z)}')`,[$,Z]);if(A)return null;const xe=Ie=>{var Ae;const{edges:Oe,addSelectedEdges:Te,unselectNodesAndEdges:Xe,multiSelectionActive:Et}=ke.getState(),st=Oe.find(wt=>wt.id===n);st&&(M&&(ke.setState({nodesSelectionActive:!1}),st.selected&&Et?(Xe({nodes:[],edges:[st]}),(Ae=we.current)==null||Ae.blur()):Te([n])),l&&l(Ie,st))},Ye=za(n,ke.getState,u),ut=za(n,ke.getState,V),at=za(n,ke.getState,T),de=za(n,ke.getState,Q),_e=za(n,ke.getState,U),De=(Ie,Oe)=>{if(Ie.button!==0)return;const{edges:Te,isValidConnection:Xe}=ke.getState(),Et=Oe?E:k,st=(Oe?W:q)||null,Ae=Oe?"target":"source",wt=Xe||ZP,dt=Oe,kt=Te.find(Nn=>Nn.id===n);Le(!0),H==null||H(Ie,kt,Ae);const Sn=Nn=>{Le(!1),J==null||J(Nn,kt,Ae)};_j({event:Ie,handleId:st,nodeId:Et,onConnect:Nn=>X==null?void 0:X(kt,Nn),isTarget:dt,getState:ke.getState,setState:ke.setState,isValidConnection:wt,edgeUpdaterType:Ae,onReconnectEnd:Sn})},Ge=Ie=>De(Ie,!0),lt=Ie=>De(Ie,!1),je=()=>Ve(!0),He=()=>Ve(!1),Ke=!M&&!l,oe=Ie=>{var Oe;if(!pe&&uj.includes(Ie.key)&&M){const{unselectNodesAndEdges:Te,addSelectedEdges:Xe,edges:Et}=ke.getState();Ie.key==="Escape"?((Oe=we.current)==null||Oe.blur(),Te({edges:[Et.find(Ae=>Ae.id===n)]})):Xe([n])}};return ue.createElement("g",{className:Wt(["react-flow__edge",`react-flow__edge-${i}`,s,{selected:h,animated:p,inactive:Ke,updating:Ce}]),onClick:xe,onDoubleClick:Ye,onContextMenu:ut,onMouseEnter:at,onMouseMove:de,onMouseLeave:_e,onKeyDown:L?oe:void 0,tabIndex:L?0:void 0,role:L?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":D===null?void 0:D||`Edge from ${k} to ${E}`,"aria-describedby":L?`${Aj}-${Z}`:void 0,ref:we},!Be&&ue.createElement(e,{id:n,source:k,target:E,selected:h,animated:p,label:f,labelStyle:g,labelShowBg:y,labelBgStyle:w,labelBgPadding:S,labelBgBorderRadius:b,data:a,style:_,sourceX:C,sourceY:j,targetX:I,targetY:O,sourcePosition:P,targetPosition:F,sourceHandleId:q,targetHandleId:W,markerStart:ce,markerEnd:be,pathOptions:re,interactionWidth:he}),Y&&ue.createElement(ue.Fragment,null,(Y==="source"||Y===!0)&&ue.createElement(zb,{position:P,centerX:C,centerY:j,radius:ne,onMouseDown:Ge,onMouseEnter:je,onMouseOut:He,type:"source"}),(Y==="target"||Y===!0)&&ue.createElement(zb,{position:F,centerX:I,centerY:O,radius:ne,onMouseDown:lt,onMouseEnter:je,onMouseOut:He,type:"target"})))};return t.displayName="EdgeWrapper",N.memo(t)};function JP(e){const t={default:ki(e.default||vu),straight:ki(e.bezier||dw),step:ki(e.step||uw),smoothstep:ki(e.step||Ru),simplebezier:ki(e.simplebezier||cw)},n={},s=Object.keys(e).filter(i=>!["default","bezier"].includes(i)).reduce((i,a)=>(i[a]=ki(e[a]||vu),i),n);return{...t,...s}}function Bb(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 qe.Top:return{x:s+a/2,y:i};case qe.Right:return{x:s+a,y:i+l/2};case qe.Bottom:return{x:s+a/2,y:i+l};case qe.Left:return{x:s,y:i+l/2}}}function Ub(e,t){return e?e.length===1||!t?e[0]:t&&e.find(n=>n.id===t)||null:null}const e$=(e,t,n,s,i,a)=>{const l=Bb(n,e,t),u=Bb(a,s,i);return{sourceX:l.x,sourceY:l.y,targetX:u.x,targetY:u.y}};function t$({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=il({x:(0-h[0])/h[2],y:(0-h[1])/h[2],width:l/h[2],height:u/h[2]}),g=Math.max(0,Math.min(f.x2,p.x2)-Math.max(f.x,p.x)),y=Math.max(0,Math.min(f.y2,p.y2)-Math.max(f.y,p.y));return Math.ceil(g*y)>0}function Wb(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 n$=[{level:0,isMaxLevel:!0,edges:[]}];function r$(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 y=t.get(u.target),w=t.get(u.source),S=u.selected||(y==null?void 0:y.selected)||(w==null?void 0:w.selected),b=Math.max(((f=w==null?void 0:w[Nt])==null?void 0:f.z)||0,((g=y==null?void 0:y[Nt])==null?void 0:g.z)||0,1e3);p=(h?u.zIndex:0)+(S?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?n$:a}function s$(e,t,n){const s=it(N.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)&&t$({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 r$(s,t,n)}const o$=({color:e="none",strokeWidth:t=1})=>ue.createElement("polyline",{style:{stroke:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),i$=({color:e="none",strokeWidth:t=1})=>ue.createElement("polyline",{style:{stroke:e,fill:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),Hb={[gu.Arrow]:o$,[gu.ArrowClosed]:i$};function a$(e){const t=At();return N.useMemo(()=>{var i,a;return Object.prototype.hasOwnProperty.call(Hb,e)?Hb[e]:((a=(i=t.getState()).onError)==null||a.call(i,"009",Zr.error009(e)),null)},[e])}const l$=({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=a$(t);return h?ue.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"},ue.createElement(h,{color:n,strokeWidth:l})):null},c$=({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=Ty(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))},Bj=({defaultColor:e,rfId:t})=>{const n=it(N.useCallback(c$({defaultColor:e,rfId:t}),[e,t]),(s,i)=>!(s.length!==i.length||s.some((a,l)=>a.id!==i[l].id)));return ue.createElement("defs",null,n.map(s=>ue.createElement(l$,{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})))};Bj.displayName="MarkerDefinitions";var u$=N.memo(Bj);const d$=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}),Uj=({defaultMarkerColor:e,onlyRenderVisibleElements:t,elevateEdgesOnSelect:n,rfId:s,edgeTypes:i,noPanClassName:a,onEdgeContextMenu:l,onEdgeMouseEnter:u,onEdgeMouseMove:h,onEdgeMouseLeave:p,onEdgeClick:f,onEdgeDoubleClick:g,onReconnect:y,onReconnectStart:w,onReconnectEnd:S,reconnectRadius:b,children:_,disableKeyboardA11y:k})=>{const{edgesFocusable:E,edgesUpdatable:C,elementsSelectable:j,width:I,height:O,connectionMode:P,nodeInternals:F,onError:M}=it(d$,$t),A=s$(t,F,n);return I?ue.createElement(ue.Fragment,null,A.map(({level:q,edges:W,isMaxLevel:V})=>ue.createElement("svg",{key:q,style:{zIndex:q},width:I,height:O,className:"react-flow__edges react-flow__container"},V&&ue.createElement(u$,{defaultColor:e,rfId:s}),ue.createElement("g",null,W.map(T=>{const[Q,U,ne]=Wb(F.get(T.source)),[X,H,J]=Wb(F.get(T.target));if(!ne||!J)return null;let $=T.type||"default";i[$]||(M==null||M("011",Zr.error011($)),$="default");const G=i[$]||i.default,Z=P===_o.Strict?H.target:(H.target??[]).concat(H.source??[]),D=Ub(U.source,T.sourceHandle),L=Ub(Z,T.targetHandle),Y=(D==null?void 0:D.position)||qe.Bottom,re=(L==null?void 0:L.position)||qe.Top,he=!!(T.focusable||E&&typeof T.focusable>"u"),pe=T.reconnectable||T.updatable,we=typeof y<"u"&&(pe||C&&typeof pe>"u");if(!D||!L)return M==null||M("008",Zr.error008(D,T)),null;const{sourceX:Ce,sourceY:Ve,targetX:Be,targetY:Le}=e$(Q,D,Y,X,L,re);return ue.createElement(G,{key:T.id,id:T.id,className:Wt([T.className,a]),type:$,data:T.data,selected:!!T.selected,animated:!!T.animated,hidden:!!T.hidden,label:T.label,labelStyle:T.labelStyle,labelShowBg:T.labelShowBg,labelBgStyle:T.labelBgStyle,labelBgPadding:T.labelBgPadding,labelBgBorderRadius:T.labelBgBorderRadius,style:T.style,source:T.source,target:T.target,sourceHandleId:T.sourceHandle,targetHandleId:T.targetHandle,markerEnd:T.markerEnd,markerStart:T.markerStart,sourceX:Ce,sourceY:Ve,targetX:Be,targetY:Le,sourcePosition:Y,targetPosition:re,elementsSelectable:j,onContextMenu:l,onMouseEnter:u,onMouseMove:h,onMouseLeave:p,onClick:f,onEdgeDoubleClick:g,onReconnect:y,onReconnectStart:w,onReconnectEnd:S,reconnectRadius:b,rfId:s,ariaLabel:T.ariaLabel,isFocusable:he,isReconnectable:we,pathOptions:"pathOptions"in T?T.pathOptions:void 0,interactionWidth:T.interactionWidth,disableKeyboardA11y:k})})))),_):null};Uj.displayName="EdgeRenderer";var f$=N.memo(Uj);const h$=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function p$({children:e}){const t=it(h$);return ue.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:t}},e)}function m$(e){const t=vl(),n=N.useRef(!1);N.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const g$={[qe.Left]:qe.Right,[qe.Right]:qe.Left,[qe.Top]:qe.Bottom,[qe.Bottom]:qe.Top},Wj=({nodeId:e,handleType:t,style:n,type:s=As.Bezier,CustomComponent:i,connectionStatus:a})=>{var O,P,F;const{fromNode:l,handleId:u,toX:h,toY:p,connectionMode:f}=it(N.useCallback(M=>({fromNode:M.nodeInternals.get(e),handleId:M.connectionHandleId,toX:(M.connectionPosition.x-M.transform[0])/M.transform[2],toY:(M.connectionPosition.y-M.transform[1])/M.transform[2],connectionMode:M.connectionMode}),[e]),$t),g=(O=l==null?void 0:l[Nt])==null?void 0:O.handleBounds;let y=g==null?void 0:g[t];if(f===_o.Loose&&(y=y||(g==null?void 0:g[t==="source"?"target":"source"])),!l||!y)return null;const w=u?y.find(M=>M.id===u):y[0],S=w?w.x+w.width/2:(l.width??0)/2,b=w?w.y+w.height/2:l.height??0,_=(((P=l.positionAbsolute)==null?void 0:P.x)??0)+S,k=(((F=l.positionAbsolute)==null?void 0:F.y)??0)+b,E=w==null?void 0:w.position,C=E?g$[E]:null;if(!E||!C)return null;if(i)return ue.createElement(i,{connectionLineType:s,connectionLineStyle:n,fromNode:l,fromHandle:w,fromX:_,fromY:k,toX:h,toY:p,fromPosition:E,toPosition:C,connectionStatus:a});let j="";const I={sourceX:_,sourceY:k,sourcePosition:E,targetX:h,targetY:p,targetPosition:C};return s===As.Bezier?[j]=mj(I):s===As.Step?[j]=jy({...I,borderRadius:0}):s===As.SmoothStep?[j]=jy(I):s===As.SimpleBezier?[j]=pj(I):j=`M${_},${k} ${h},${p}`,ue.createElement("path",{d:j,fill:"none",className:"react-flow__connection-path",style:n})};Wj.displayName="ConnectionLine";const v$=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function y$({containerStyle:e,style:t,type:n,component:s}){const{nodeId:i,handleType:a,nodesConnectable:l,width:u,height:h,connectionStatus:p}=it(v$,$t);return!(i&&a&&u&&l)?null:ue.createElement("svg",{style:e,width:u,height:h,className:"react-flow__edges react-flow__connectionline react-flow__container"},ue.createElement("g",{className:Wt(["react-flow__connection",p])},ue.createElement(Wj,{nodeId:i,handleType:a,style:t,type:n,CustomComponent:s,connectionStatus:p})))}function Gb(e,t){return N.useRef(null),At(),N.useMemo(()=>t(e),[e])}const Hj=({nodeTypes:e,edgeTypes:t,onMove:n,onMoveStart:s,onMoveEnd:i,onInit:a,onNodeClick:l,onEdgeClick:u,onNodeDoubleClick:h,onEdgeDoubleClick:p,onNodeMouseEnter:f,onNodeMouseMove:g,onNodeMouseLeave:y,onNodeContextMenu:w,onSelectionContextMenu:S,onSelectionStart:b,onSelectionEnd:_,connectionLineType:k,connectionLineStyle:E,connectionLineComponent:C,connectionLineContainerStyle:j,selectionKeyCode:I,selectionOnDrag:O,selectionMode:P,multiSelectionKeyCode:F,panActivationKeyCode:M,zoomActivationKeyCode:A,deleteKeyCode:q,onlyRenderVisibleElements:W,elementsSelectable:V,selectNodesOnDrag:T,defaultViewport:Q,translateExtent:U,minZoom:ne,maxZoom:X,preventScrolling:H,defaultMarkerColor:J,zoomOnScroll:$,zoomOnPinch:G,panOnScroll:Z,panOnScrollSpeed:D,panOnScrollMode:L,zoomOnDoubleClick:Y,panOnDrag:re,onPaneClick:he,onPaneMouseEnter:pe,onPaneMouseMove:we,onPaneMouseLeave:Ce,onPaneScroll:Ve,onPaneContextMenu:Be,onEdgeContextMenu:Le,onEdgeMouseEnter:ke,onEdgeMouseMove:ce,onEdgeMouseLeave:be,onReconnect:xe,onReconnectStart:Ye,onReconnectEnd:ut,reconnectRadius:at,noDragClassName:de,noWheelClassName:_e,noPanClassName:De,elevateEdgesOnSelect:Ge,disableKeyboardA11y:lt,nodeOrigin:je,nodeExtent:He,rfId:Ke})=>{const oe=Gb(e,GP),Ie=Gb(t,JP);return m$(a),ue.createElement(WP,{onPaneClick:he,onPaneMouseEnter:pe,onPaneMouseMove:we,onPaneMouseLeave:Ce,onPaneContextMenu:Be,onPaneScroll:Ve,deleteKeyCode:q,selectionKeyCode:I,selectionOnDrag:O,selectionMode:P,onSelectionStart:b,onSelectionEnd:_,multiSelectionKeyCode:F,panActivationKeyCode:M,zoomActivationKeyCode:A,elementsSelectable:V,onMove:n,onMoveStart:s,onMoveEnd:i,zoomOnScroll:$,zoomOnPinch:G,zoomOnDoubleClick:Y,panOnScroll:Z,panOnScrollSpeed:D,panOnScrollMode:L,panOnDrag:re,defaultViewport:Q,translateExtent:U,minZoom:ne,maxZoom:X,onSelectionContextMenu:S,preventScrolling:H,noDragClassName:de,noWheelClassName:_e,noPanClassName:De,disableKeyboardA11y:lt},ue.createElement(p$,null,ue.createElement(f$,{edgeTypes:Ie,onEdgeClick:u,onEdgeDoubleClick:p,onlyRenderVisibleElements:W,onEdgeContextMenu:Le,onEdgeMouseEnter:ke,onEdgeMouseMove:ce,onEdgeMouseLeave:be,onReconnect:xe,onReconnectStart:Ye,onReconnectEnd:ut,reconnectRadius:at,defaultMarkerColor:J,noPanClassName:De,elevateEdgesOnSelect:!!Ge,disableKeyboardA11y:lt,rfId:Ke},ue.createElement(y$,{style:E,type:k,component:C,containerStyle:j})),ue.createElement("div",{className:"react-flow__edgelabel-renderer"}),ue.createElement(KP,{nodeTypes:oe,onNodeClick:l,onNodeDoubleClick:h,onNodeMouseEnter:f,onNodeMouseMove:g,onNodeMouseLeave:y,onNodeContextMenu:w,selectNodesOnDrag:T,onlyRenderVisibleElements:W,noPanClassName:De,noDragClassName:de,disableKeyboardA11y:lt,nodeOrigin:je,nodeExtent:He,rfId:Ke})))};Hj.displayName="GraphView";var w$=N.memo(Hj);const Iy=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],js={rfId:"1",width:0,height:0,transform:[0,0,1],nodeInternals:new Map,edges:[],onNodesChange:null,onEdgesChange:null,hasDefaultNodes:!1,hasDefaultEdges:!1,d3Zoom:null,d3Selection:null,d3ZoomHandler:void 0,minZoom:.5,maxZoom:2,translateExtent:Iy,nodeExtent:Iy,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:_o.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:[0,0],nodeDragThreshold:0,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesUpdatable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,fitViewOnInit:!1,fitViewOnInitDone:!1,fitViewOnInitOptions:void 0,onSelectionChange:[],multiSelectionActive:!1,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,connectionRadius:20,onError:GO,isValidConnection:void 0},x$=()=>a2((e,t)=>({...js,setNodes:n=>{const{nodeInternals:s,nodeOrigin:i,elevateNodesOnSelect:a}=t();e({nodeInternals:Bf(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?Bf(n,new Map,t().nodeOrigin,t().elevateNodesOnSelect):new Map;e({nodeInternals:l,edges:a?s:[],hasDefaultNodes:i,hasDefaultEdges:a})},updateNodeDimensions:n=>{const{onNodesChange:s,nodeInternals:i,fitViewOnInit:a,fitViewOnInitDone:l,fitViewOnInitOptions:u,domNode:h,nodeOrigin:p}=t(),f=h==null?void 0:h.querySelector(".react-flow__viewport");if(!f)return;const g=window.getComputedStyle(f),{m22:y}=new window.DOMMatrixReadOnly(g.transform),w=n.reduce((b,_)=>{const k=i.get(_.id);if(k!=null&&k.hidden)i.set(k.id,{...k,[Nt]:{...k[Nt],handleBounds:void 0}});else if(k){const E=aw(_.nodeElement);!!(E.width&&E.height&&(k.width!==E.width||k.height!==E.height||_.forceUpdate))&&(i.set(k.id,{...k,[Nt]:{...k[Nt],handleBounds:{source:Db(".source",_.nodeElement,y,p),target:Db(".target",_.nodeElement,y,p)}},...E}),b.push({id:k.id,type:"dimensions",dimensions:E}))}return b},[]);Ij(i,p);const S=l||a&&!l&&Oj(t,{initial:!0,...u});e({nodeInternals:new Map(i),fitViewOnInitDone:S}),(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=PP(n,u()),f=Bf(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=>Rs(h,!0)):(l=ji(a(),n),u=ji(i,[])),Hc({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=>Rs(h,!0)):(l=ji(i,n),u=ji(a(),[])),Hc({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,Rs(f.id,!1))),p=u.map(f=>Rs(f.id,!1));Hc({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=>Rs(u.id,!1)),l=n.filter(u=>u.selected).map(u=>Rs(u.id,!1));Hc({changedNodes:a,changedEdges:l,get:t,set:e})},setNodeExtent:n=>{const{nodeInternals:s}=t();s.forEach(i=>{i.positionAbsolute=lw(i.position,n)}),e({nodeExtent:n,nodeInternals:new Map(s)})},panBy:n=>{const{transform:s,width:i,height:a,d3Zoom:l,d3Selection:u,translateExtent:h}=t();if(!l||!u||!n.x&&!n.y)return!1;const p=Xr.translate(s[0]+n.x,s[1]+n.y).scale(s[2]),f=[[0,0],[i,a]],g=l==null?void 0:l.constrain()(p,f,h);return l.transform(u,g),s[0]!==g.x||s[1]!==g.y||s[2]!==g.k},cancelConnection:()=>e({connectionNodeId:js.connectionNodeId,connectionHandleId:js.connectionHandleId,connectionHandleType:js.connectionHandleType,connectionStatus:js.connectionStatus,connectionStartHandle:js.connectionStartHandle,connectionEndHandle:js.connectionEndHandle}),reset:()=>e({...js})}),Object.is),gw=({children:e})=>{const t=N.useRef(null);return t.current||(t.current=x$()),ue.createElement(DO,{value:t.current},e)};gw.displayName="ReactFlowProvider";const Gj=({children:e})=>N.useContext(Tu)?ue.createElement(ue.Fragment,null,e):ue.createElement(gw,null,e);Gj.displayName="ReactFlowWrapper";const b$={input:Ej,default:Ay,output:jj,group:pw},_$={default:vu,straight:dw,step:uw,smoothstep:Ru,simplebezier:cw},k$=[0,0],S$=[15,15],N$={x:0,y:0,zoom:1},E$={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},Vj=N.forwardRef(({nodes:e,edges:t,defaultNodes:n,defaultEdges:s,className:i,nodeTypes:a=b$,edgeTypes:l=_$,onNodeClick:u,onEdgeClick:h,onInit:p,onMove:f,onMoveStart:g,onMoveEnd:y,onConnect:w,onConnectStart:S,onConnectEnd:b,onClickConnectStart:_,onClickConnectEnd:k,onNodeMouseEnter:E,onNodeMouseMove:C,onNodeMouseLeave:j,onNodeContextMenu:I,onNodeDoubleClick:O,onNodeDragStart:P,onNodeDrag:F,onNodeDragStop:M,onNodesDelete:A,onEdgesDelete:q,onSelectionChange:W,onSelectionDragStart:V,onSelectionDrag:T,onSelectionDragStop:Q,onSelectionContextMenu:U,onSelectionStart:ne,onSelectionEnd:X,connectionMode:H=_o.Strict,connectionLineType:J=As.Bezier,connectionLineStyle:$,connectionLineComponent:G,connectionLineContainerStyle:Z,deleteKeyCode:D="Backspace",selectionKeyCode:L="Shift",selectionOnDrag:Y=!1,selectionMode:re=al.Full,panActivationKeyCode:he="Space",multiSelectionKeyCode:pe=mu()?"Meta":"Control",zoomActivationKeyCode:we=mu()?"Meta":"Control",snapToGrid:Ce=!1,snapGrid:Ve=S$,onlyRenderVisibleElements:Be=!1,selectNodesOnDrag:Le=!0,nodesDraggable:ke,nodesConnectable:ce,nodesFocusable:be,nodeOrigin:xe=k$,edgesFocusable:Ye,edgesUpdatable:ut,elementsSelectable:at,defaultViewport:de=N$,minZoom:_e=.5,maxZoom:De=2,translateExtent:Ge=Iy,preventScrolling:lt=!0,nodeExtent:je,defaultMarkerColor:He="#b1b1b7",zoomOnScroll:Ke=!0,zoomOnPinch:oe=!0,panOnScroll:Ie=!1,panOnScrollSpeed:Oe=.5,panOnScrollMode:Te=yo.Free,zoomOnDoubleClick:Xe=!0,panOnDrag:Et=!0,onPaneClick:st,onPaneMouseEnter:Ae,onPaneMouseMove:wt,onPaneMouseLeave:dt,onPaneScroll:kt,onPaneContextMenu:Sn,children:Fn,onEdgeContextMenu:Nn,onEdgeDoubleClick:Co,onEdgeMouseEnter:pn,onEdgeMouseMove:jo,onEdgeMouseLeave:To,onEdgeUpdate:zt,onEdgeUpdateStart:Cr,onEdgeUpdateEnd:zn,onReconnect:$s,onReconnectStart:jr,onReconnectEnd:Zi,reconnectRadius:dr=10,edgeUpdaterRadius:Tr=10,onNodesChange:fr,onEdgesChange:ts,noDragClassName:Ro="nodrag",noWheelClassName:Ao="nowheel",noPanClassName:Mo="nopan",fitView:En=!1,fitViewOptions:Io,connectOnClick:Rr=!0,attributionPosition:Oo,proOptions:Bn,defaultEdgeOptions:Po,elevateNodesOnSelect:Ls=!0,elevateEdgesOnSelect:qs=!1,disableKeyboardA11y:$o=!1,autoPanOnConnect:Lo=!0,autoPanOnNodeDrag:ot=!0,connectionRadius:Ji=20,isValidConnection:ns,onError:Ht,style:Un,id:qo,nodeDragThreshold:rs,...xt},nn)=>{const Wn=qo||"1";return ue.createElement("div",{...xt,style:{...Un,...E$},ref:nn,className:Wt(["react-flow",i]),"data-testid":"rf__wrapper",id:qo},ue.createElement(Gj,null,ue.createElement(w$,{onInit:p,onMove:f,onMoveStart:g,onMoveEnd:y,onNodeClick:u,onEdgeClick:h,onNodeMouseEnter:E,onNodeMouseMove:C,onNodeMouseLeave:j,onNodeContextMenu:I,onNodeDoubleClick:O,nodeTypes:a,edgeTypes:l,connectionLineType:J,connectionLineStyle:$,connectionLineComponent:G,connectionLineContainerStyle:Z,selectionKeyCode:L,selectionOnDrag:Y,selectionMode:re,deleteKeyCode:D,multiSelectionKeyCode:pe,panActivationKeyCode:he,zoomActivationKeyCode:we,onlyRenderVisibleElements:Be,selectNodesOnDrag:Le,defaultViewport:de,translateExtent:Ge,minZoom:_e,maxZoom:De,preventScrolling:lt,zoomOnScroll:Ke,zoomOnPinch:oe,zoomOnDoubleClick:Xe,panOnScroll:Ie,panOnScrollSpeed:Oe,panOnScrollMode:Te,panOnDrag:Et,onPaneClick:st,onPaneMouseEnter:Ae,onPaneMouseMove:wt,onPaneMouseLeave:dt,onPaneScroll:kt,onPaneContextMenu:Sn,onSelectionContextMenu:U,onSelectionStart:ne,onSelectionEnd:X,onEdgeContextMenu:Nn,onEdgeDoubleClick:Co,onEdgeMouseEnter:pn,onEdgeMouseMove:jo,onEdgeMouseLeave:To,onReconnect:$s??zt,onReconnectStart:jr??Cr,onReconnectEnd:Zi??zn,reconnectRadius:dr??Tr,defaultMarkerColor:He,noDragClassName:Ro,noWheelClassName:Ao,noPanClassName:Mo,elevateEdgesOnSelect:qs,rfId:Wn,disableKeyboardA11y:$o,nodeOrigin:xe,nodeExtent:je}),ue.createElement(mP,{nodes:e,edges:t,defaultNodes:n,defaultEdges:s,onConnect:w,onConnectStart:S,onConnectEnd:b,onClickConnectStart:_,onClickConnectEnd:k,nodesDraggable:ke,nodesConnectable:ce,nodesFocusable:be,edgesFocusable:Ye,edgesUpdatable:ut,elementsSelectable:at,elevateNodesOnSelect:Ls,minZoom:_e,maxZoom:De,nodeExtent:je,onNodesChange:fr,onEdgesChange:ts,snapToGrid:Ce,snapGrid:Ve,connectionMode:H,translateExtent:Ge,connectOnClick:Rr,defaultEdgeOptions:Po,fitView:En,fitViewOptions:Io,onNodesDelete:A,onEdgesDelete:q,onNodeDragStart:P,onNodeDrag:F,onNodeDragStop:M,onSelectionDrag:T,onSelectionDragStart:V,onSelectionDragStop:Q,noPanClassName:Mo,nodeOrigin:xe,rfId:Wn,autoPanOnConnect:Lo,autoPanOnNodeDrag:ot,onError:Ht,connectionRadius:Ji,isValidConnection:ns,nodeDragThreshold:rs}),ue.createElement(hP,{onSelectionChange:W}),Fn,ue.createElement(zO,{proOptions:Bn,position:Oo}),ue.createElement(xP,{rfId:Wn,disableKeyboardA11y:$o})))});Vj.displayName="ReactFlow";const C$=e=>({x:e.transform[0],y:e.transform[1],zoom:e.transform[2]});function Yj(){return it(C$,$t)}const Kj=({id:e,x:t,y:n,width:s,height:i,style:a,color:l,strokeColor:u,strokeWidth:h,className:p,borderRadius:f,shapeRendering:g,onClick:y,selected:w})=>{const{background:S,backgroundColor:b}=a||{},_=l||S||b;return ue.createElement("rect",{className:Wt(["react-flow__minimap-node",{selected:w},p]),x:t,y:n,rx:f,ry:f,width:s,height:i,fill:_,stroke:u,strokeWidth:h,shapeRendering:g,onClick:y?k=>y(k,e):void 0})};Kj.displayName="MiniMapNode";var j$=N.memo(Kj);const T$=e=>e.nodeOrigin,R$=e=>e.getNodes().filter(t=>!t.hidden&&t.width&&t.height),Gf=e=>e instanceof Function?e:()=>e;function A$({nodeStrokeColor:e="transparent",nodeColor:t="#e2e2e2",nodeClassName:n="",nodeBorderRadius:s=5,nodeStrokeWidth:i=2,nodeComponent:a=j$,onClick:l}){const u=it(R$,$t),h=it(T$),p=Gf(t),f=Gf(e),g=Gf(n),y=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return ue.createElement(ue.Fragment,null,u.map(w=>{const{x:S,y:b}=xo(w,h).positionAbsolute;return ue.createElement(a,{key:w.id,x:S,y:b,width:w.width,height:w.height,style:w.style,selected:w.selected,className:g(w),color:p(w),borderRadius:s,strokeColor:f(w),strokeWidth:i,shapeRendering:y,onClick:l,id:w.id})}))}var M$=N.memo(A$);const I$=200,O$=150,P$=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?WO(Au(t,e.nodeOrigin),n):n,rfId:e.rfId}},$$="react-flow__minimap-desc";function Xj({style:e,className:t,nodeStrokeColor:n="transparent",nodeColor:s="#e2e2e2",nodeClassName:i="",nodeBorderRadius:a=5,nodeStrokeWidth:l=2,nodeComponent:u,maskColor:h="rgb(240, 240, 240, 0.6)",maskStrokeColor:p="none",maskStrokeWidth:f=1,position:g="bottom-right",onClick:y,onNodeClick:w,pannable:S=!1,zoomable:b=!1,ariaLabel:_="React Flow mini map",inversePan:k=!1,zoomStep:E=10,offsetScale:C=5}){const j=At(),I=N.useRef(null),{boundingRect:O,viewBB:P,rfId:F}=it(P$,$t),M=(e==null?void 0:e.width)??I$,A=(e==null?void 0:e.height)??O$,q=O.width/M,W=O.height/A,V=Math.max(q,W),T=V*M,Q=V*A,U=C*V,ne=O.x-(T-O.width)/2-U,X=O.y-(Q-O.height)/2-U,H=T+U*2,J=Q+U*2,$=`${$$}-${F}`,G=N.useRef(0);G.current=V,N.useEffect(()=>{if(I.current){const L=$n(I.current),Y=pe=>{const{transform:we,d3Selection:Ce,d3Zoom:Ve}=j.getState();if(pe.sourceEvent.type!=="wheel"||!Ce||!Ve)return;const Be=-pe.sourceEvent.deltaY*(pe.sourceEvent.deltaMode===1?.05:pe.sourceEvent.deltaMode?1:.002)*E,Le=we[2]*Math.pow(2,Be);Ve.scaleTo(Ce,Le)},re=pe=>{const{transform:we,d3Selection:Ce,d3Zoom:Ve,translateExtent:Be,width:Le,height:ke}=j.getState();if(pe.sourceEvent.type!=="mousemove"||!Ce||!Ve)return;const ce=G.current*Math.max(1,we[2])*(k?-1:1),be={x:we[0]-pe.sourceEvent.movementX*ce,y:we[1]-pe.sourceEvent.movementY*ce},xe=[[0,0],[Le,ke]],Ye=Xr.translate(be.x,be.y).scale(we[2]),ut=Ve.constrain()(Ye,xe,Be);Ve.transform(Ce,ut)},he=sj().on("zoom",S?re:null).on("zoom.wheel",b?Y:null);return L.call(he),()=>{L.on("zoom",null)}}},[S,b,k,E]);const Z=y?L=>{const Y=rr(L);y(L,{x:Y[0],y:Y[1]})}:void 0,D=w?(L,Y)=>{const re=j.getState().nodeInternals.get(Y);w(L,re)}:void 0;return ue.createElement(iw,{position:g,style:e,className:Wt(["react-flow__minimap",t]),"data-testid":"rf__minimap"},ue.createElement("svg",{width:M,height:A,viewBox:`${ne} ${X} ${H} ${J}`,role:"img","aria-labelledby":$,ref:I,onClick:Z},_&&ue.createElement("title",{id:$},_),ue.createElement(M$,{onClick:D,nodeColor:s,nodeStrokeColor:n,nodeBorderRadius:a,nodeClassName:i,nodeStrokeWidth:l,nodeComponent:u}),ue.createElement("path",{className:"react-flow__minimap-mask",d:`M${ne-U},${X-U}h${H+U*2}v${J+U*2}h${-H-U*2}z
57
+ M${P.x},${P.y}h${P.width}v${P.height}h${-P.width}z`,fill:h,fillRule:"evenodd",stroke:p,strokeWidth:f,pointerEvents:"none"})))}Xj.displayName="MiniMap";var L$=N.memo(Xj);function q$(){return ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},ue.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function D$(){return ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},ue.createElement("path",{d:"M0 0h32v4.2H0z"}))}function F$(){return ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},ue.createElement("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"}))}function z$(){return ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},ue.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"}))}function B$(){return ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},ue.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"}))}const kr=({children:e,className:t,...n})=>ue.createElement("button",{type:"button",className:Wt(["react-flow__controls-button",t]),...n},e);kr.displayName="ControlButton";const U$=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom}),Qj=({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:s=!0,fitViewOptions:i,onZoomIn:a,onZoomOut:l,onFitView:u,onInteractiveChange:h,className:p,children:f,position:g="bottom-left"})=>{const y=At(),[w,S]=N.useState(!1),{isInteractive:b,minZoomReached:_,maxZoomReached:k}=it(U$,$t),{zoomIn:E,zoomOut:C,fitView:j}=vl();if(N.useEffect(()=>{S(!0)},[]),!w)return null;const I=()=>{E(),a==null||a()},O=()=>{C(),l==null||l()},P=()=>{j(i),u==null||u()},F=()=>{y.setState({nodesDraggable:!b,nodesConnectable:!b,elementsSelectable:!b}),h==null||h(!b)};return ue.createElement(iw,{className:Wt(["react-flow__controls",p]),position:g,style:e,"data-testid":"rf__controls"},t&&ue.createElement(ue.Fragment,null,ue.createElement(kr,{onClick:I,className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:k},ue.createElement(q$,null)),ue.createElement(kr,{onClick:O,className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:_},ue.createElement(D$,null))),n&&ue.createElement(kr,{className:"react-flow__controls-fitview",onClick:P,title:"fit view","aria-label":"fit view"},ue.createElement(F$,null)),s&&ue.createElement(kr,{className:"react-flow__controls-interactive",onClick:F,title:"toggle interactivity","aria-label":"toggle interactivity"},b?ue.createElement(B$,null):ue.createElement(z$,null)),f)};Qj.displayName="Controls";var W$=N.memo(Qj),ar;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(ar||(ar={}));function H$({color:e,dimensions:t,lineWidth:n}){return ue.createElement("path",{stroke:e,strokeWidth:n,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`})}function G$({color:e,radius:t}){return ue.createElement("circle",{cx:t,cy:t,r:t,fill:e})}const V$={[ar.Dots]:"#91919a",[ar.Lines]:"#eee",[ar.Cross]:"#e2e2e2"},Y$={[ar.Dots]:1,[ar.Lines]:1,[ar.Cross]:6},K$=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function Zj({id:e,variant:t=ar.Dots,gap:n=20,size:s,lineWidth:i=1,offset:a=2,color:l,style:u,className:h}){const p=N.useRef(null),{transform:f,patternId:g}=it(K$,$t),y=l||V$[t],w=s||Y$[t],S=t===ar.Dots,b=t===ar.Cross,_=Array.isArray(n)?n:[n,n],k=[_[0]*f[2]||1,_[1]*f[2]||1],E=w*f[2],C=b?[E,E]:k,j=S?[E/a,E/a]:[C[0]/a,C[1]/a];return ue.createElement("svg",{className:Wt(["react-flow__background",h]),style:{...u,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:p,"data-testid":"rf__background"},ue.createElement("pattern",{id:g+e,x:f[0]%k[0],y:f[1]%k[1],width:k[0],height:k[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${j[0]},-${j[1]})`},S?ue.createElement(G$,{color:y,radius:E/a}):ue.createElement(H$,{dimensions:C,color:y,lineWidth:i})),ue.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${g+e})`}))}Zj.displayName="Background";var X$=N.memo(Zj);const Q$=["us-gov","global","apac","us","eu","jp","au"],Z$=new RegExp(`^(?:(?:${Q$.join("|")})\\.)?anthropic\\.`,"i");function yl(e){return e.replace(Z$,"")}function Jj(){return{inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0}}function vw(e){const t=e.cache_creation,n=t&&typeof t=="object"?t:e,s=n.ephemeral_1h_input_tokens,i=n.ephemeral_5m_input_tokens;return typeof s!="number"&&typeof i!="number"?{}:{cacheCreate1hTokens:Number(s??0),cacheCreate5mTokens:Number(i??0)}}function J$(e){const t=vw(e),n={inputTokens:Number(e.input_tokens??0),outputTokens:Number(e.output_tokens??0),cacheReadTokens:Number(e.cache_read_input_tokens??e.cached_input_tokens??0),cacheCreateTokens:Number(e.cache_creation_input_tokens??e.cache_write_input_tokens??0),cacheCreate1hTokens:t.cacheCreate1hTokens,cacheCreate5mTokens:t.cacheCreate5mTokens};return typeof e.reasoning_output_tokens=="number"&&(n.reasoningOutputTokens=Number(e.reasoning_output_tokens)),n}function eL(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]=J$(s));return Object.keys(t).length?t:void 0}function eT(e,t=0){if(!e||typeof e!="object"||t>6)return null;const n=e;if(typeof n.input_tokens=="number"||typeof n.output_tokens=="number"||typeof n.cache_read_input_tokens=="number"||typeof n.cache_creation_input_tokens=="number")return{inputTokens:Number(n.input_tokens??0),outputTokens:Number(n.output_tokens??0),cacheReadTokens:Number(n.cache_read_input_tokens??0),cacheCreateTokens:Number(n.cache_creation_input_tokens??0),...vw(n)};for(const s of Object.values(n)){const i=eT(s,t+1);if(i)return i}return null}const tL=/^(?:claude[-_]|gpt[-_]|o\d|codex[-_])/i;function tT(e,t=0){if(!e||typeof e!="object"||t>6)return null;const n=e;if(typeof n.model=="string"&&tL.test(yl(n.model)))return n.model;for(const s of Object.values(n)){const i=tT(s,t+1);if(i)return i}return null}function Oy(){return{agents:new Map,toolIndex:new Map,toolOwner:new Map,activeSubagentStack:new Map,lastSeq:0,seqEpoch:null,totalEvents:0,revision:0}}function Is(e){if(!e)return;const t=e.replace(/\\/g,"/").split("/").filter(Boolean);return t[t.length-1]}function Vb(){return{msgsUser:0,msgsAssistant:0,toolUses:0,toolResults:0,systemReminders:0,currentContextTokens:0,memoryFiles:[]}}function wl(e,t){return`${e}::${t}`}function yu(e){return e.agent_type??e.subagent_type??"subagent"}function Ja(e){return e.agent_id?e.agent_id:e.parent_tool_use_id?e.parent_tool_use_id:null}function Ti(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:Jj()},e.agents.set(i,a),a)}function nT(e,t,n,s){const i=wl(t,n),a=e.agents.get(i);if(!a)return null;!a.cwd&&s.cwd&&(a.cwd=s.cwd,a.cwdBasename=Is(s.cwd));const l=yu(s);return l&&(a.label==="subagent"||!a.label)&&(a.label=l),a}function nL(e,t,n){const s=t.session_id??"unknown",i=Ja(t);if(i){const h=nT(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(wl(s,l));if(h)return!h.cwd&&t.cwd&&(h.cwd=t.cwd,h.cwdBasename=Is(t.cwd)),h}const u=Ti(e,s,n,t.hook_event_name!=="SessionStart");return!u.cwd&&t.cwd&&(u.cwd=t.cwd,u.cwdBasename=Is(t.cwd)),u.label==="session"&&t.cwd&&(u.label=Is(t.cwd)??"session"),u}function rL(e,t,n,s,i){const a=wl(t,n),l=Ti(e,t,i,!0);let u=e.agents.get(a);if(u){!u.cwd&&s.cwd&&(u.cwd=s.cwd,u.cwdBasename=Is(s.cwd));const h=yu(s);return h&&(u.label==="subagent"||!u.label)&&(u.label=h),u}return u={id:a,sessionId:t,label:yu(s),kind:"subagent",parentId:l.id,state:"active",startedAt:i,tools:[],prompts:[],cwd:s.cwd,cwdBasename:Is(s.cwd),toolCount:0,childCount:0,usage:Jj()},e.agents.set(a,u),l.childCount+=1,u}function sL(e,t,n){const s=e.activeSubagentStack.get(t)??[];s.includes(n)||(s.push(n),e.activeSubagentStack.set(t,s))}function oL(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 Vc(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 Yb=200,iL=25;function aL(e,t){const n=t.tools;if(n.length>Yb){const s=n.splice(0,n.length-Yb);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-iL-1;s>=0;s--){const i=n[s];if(i.trimmed)break;i.input=void 0,i.response=void 0,i.trimmed=!0}}function lL(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 Kb=2e3;function cL(e,t,n){for(let s=e.prompts.length-1;s>=0;s--){const i=e.prompts[s];if(i.at<t-Kb)return!1;if(i.text===n&&i.at<=t+Kb)return!0}return!1}function rT(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 xl(e,t){return t&&(e.revision+=1),t}function uL(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&&(rT(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 xl(e,u>0)}function dL(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&&rT(e,g),e.agents.delete(f)}u--,h=!0}return xl(e,h)}function fL(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 hL(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 xl(e,t)}function pL(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 xl(e,s)}const Xb=90*6e4;function mL(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 xl(e,s)}function gL(e){return e==="permission_prompt"?"permission":e==="idle_prompt"?"idle":null}const vL=new Set(["Notification","ModelObserved","ContextObserved","UsageObserved","SessionNamed"]);function yL(e,t){let n=null;for(const s of e.toolIndex.values()){const i=s.agentId?e.agents.get(s.agentId):void 0;!i||i.sessionId!==t||(!n||s.startedAt>n.startedAt)&&(n=s)}return n==null?void 0:n.explicitSubagentId}function wL(e,t,n,s,i){const a=n==="permission"?yL(e,t):void 0;return a?{kind:n,message:s,since:i,subagentId:a}:{kind:n,message:s,since:i}}function xL(e,t,n){if(e.kind!=="permission")return!0;const s=Ja(t);return s==null?!0:e.subagentId!=null&&wl(n,s)===e.subagentId}function Qb(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{...Oy(),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(!vL.has(a)){const f=e.agents.get(l);f!=null&&f.waiting&&xL(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??Vb(),currentContextTokens:s.context_tokens})}if(a==="ModelObserved"){const f=typeof s.model=="string"?s.model:null;if(f){const y=e.agents.get(l);y&&(y.model=f)}const g=s.subagentModels;if(g&&typeof g=="object")for(const[y,w]of Object.entries(g)){if(typeof w!="string")continue;const S=`${l}::${y}`,b=e.agents.get(S);b&&(b.model=w)}return e}if(a==="ContextObserved"){const f=s.context??null;if(f){const g=e.agents.get(l);if(g){const y=g.context??Vb(),w=(b,_)=>typeof f[b]=="number"?f[b]:_,S=Array.isArray(f.memoryFiles)?f.memoryFiles:Array.isArray(f.claudeMdFiles)?f.claudeMdFiles:null;g.context={msgsUser:w("msgsUser",y.msgsUser),msgsAssistant:w("msgsAssistant",y.msgsAssistant),toolUses:w("toolUses",y.toolUses),toolResults:w("toolResults",y.toolResults),systemReminders:w("systemReminders",y.systemReminders),currentContextTokens:w("currentContextTokens",y.currentContextTokens),memoryFiles:S??y.memoryFiles}}}return e}if(a==="SessionNamed"){const f=e.agents.get(l);if(f){const g=typeof s.sessionName=="string"?s.sessionName.trim():"",y=typeof s.sessionTitle=="string"?s.sessionTitle.trim():"";g&&(f.sessionName=g),y&&(f.sessionTitle=y);const w=f.sessionName??"";f.sessionTitle&&w&&f.sessionTitle.toLowerCase()===w.toLowerCase()&&(f.sessionTitle=void 0)}return e}if(a==="UsageObserved"){const f=s.usage??null;if(f){const g=e.agents.get(l);if(g){g.usage.inputTokens=Number(f.input_tokens??0),g.usage.outputTokens=Number(f.output_tokens??0),g.usage.cacheReadTokens=Number(f.cache_read_input_tokens??f.cached_input_tokens??0),g.usage.cacheCreateTokens=Number(f.cache_creation_input_tokens??f.cache_write_input_tokens??0);const y=vw(f);g.usage.cacheCreate1hTokens=y.cacheCreate1hTokens,g.usage.cacheCreate5mTokens=y.cacheCreate5mTokens,typeof f.reasoning_output_tokens=="number"&&(g.usage.reasoningOutputTokens=Number(f.reasoning_output_tokens)),g.usageByModel=eL(s.usageByModel)}}return e}const h=nL(e,s,i);h.provider||(h.provider=s.provider==="codex"?"codex":"claude");const p=tT(s);switch(p&&(h.model=p),a){case"SessionStart":{const f=Ti(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=Is(s.cwd)),f.label==="session"&&s.cwd&&(f.label=Is(s.cwd)??"session");break}case"UserPromptSubmit":{for(const y of e.agents.values())y.sessionId===l&&y.kind==="subagent"&&y.state==="done"&&y.exitAt==null&&y.endedAt!=null&&y.endedAt<i&&(y.exitAt=i);const f=Ti(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&&!cL(f,i,g)&&(f.prompts.push({at:i,text:g}),f.firstPrompt||(f.firstPrompt=Vc(g,120)));break}case"PreToolUse":{const f=s.tool_use_id?lL(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=Vc(s.tool_input));break}const g=s.tool_use_id??`${h.id}:${h.toolCount}`,y=Ja(s),w={id:g,name:s.tool_name??"?",input:s.tool_input,inputPreview:Vc(s.tool_input),agentId:h.id,explicitSubagentId:y?wl(l,y):void 0,startedAt:i};h.tools.push(w),h.toolCount+=1,h.state="active",e.toolIndex.set(g,w),e.toolOwner.set(g,h.id),aL(e,h);break}case"PostToolUse":case"PostToolUseFailure":{const f=s.tool_use_id;if(!f)break;let g=e.toolIndex.get(f),y=!1;if(!g)for(const S of e.agents.values()){const b=S.tools.find(_=>_.id===f);if(b){g=b,y=!0;break}}if(!g||g.outcomeApplied)break;g.outcomeApplied=!0,g.outcomeGap=void 0,g.endedAt=i,g.ok=a==="PostToolUse",g.trimmed||(g.response=s.tool_response),a==="PostToolUseFailure"?g.errorPreview=Vc(s.tool_response):y&&(g.errorPreview=void 0);const w=eT(s.tool_response);w&&(g.usage=w),e.toolIndex.delete(f),e.toolOwner.delete(f);break}case"SubagentStart":{const f=Ja(s);if(!f)break;const g=rL(e,l,f,s,i);g.state="active",g.startedAt=g.startedAt||i,g.exitAt=void 0,g.endedAt=void 0;const y=yu(s);y&&(g.label=y),sL(e,l,f);break}case"SubagentStop":{const f=Ja(s);if(!f)break;const g=nT(e,l,f,s);if(!g)break;g.state="done",g.endedAt=i,oL(e,l,f);break}case"Stop":case"SessionEnd":{const f=Ti(e,l,i,!1);f.state="done",f.endedAt=i,a==="SessionEnd"&&(f.closedAt=i),e.activeSubagentStack.delete(l);break}case"Notification":{const f=gL(s.notification_type);if(!f)break;const g=Ti(e,l,i,!1),y=typeof s.message=="string"?s.message:"",w=g.waiting;g.waiting=w&&w.kind===f&&w.message===y?{...w,since:Math.min(w.since,i)}:wL(e,l,f,y,i);break}}return e}function yw(e){let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t^e.charCodeAt(n);return Math.abs(t)%360}const bL={input:2,output:10,cacheRead:.2,cacheWrite:2.5,cacheWrite1h:4},_L=[{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:bL},{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 kL(e){return e?/^(?:gpt[-_]|codex[-_]|o\d)/i.test(e):!1}function Gi(e,t=Date.now()){if(!e)return null;const n=yl(e);for(const s of _L)if(s.match.test(n))return typeof s.rates=="function"?s.rates(t):s.rates;return null}function sT(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 oT(e,t,n=Date.now()){if(!kL(t))return e.inputTokens;const s=Gi(t,n),i=((s==null?void 0:s.cacheWrite)??0)>0?Math.max(0,e.cacheCreateTokens):0;return Math.max(0,e.inputTokens-e.cacheReadTokens-i)}function ww(e,t,n=Date.now()){const s=Gi(t,n);if(!s)return{input:0,output:0,cacheRead:0,cacheWrite:0,total:0};const i=oT(e,t,n)*s.input/1e6,a=e.outputTokens*s.output/1e6,l=e.cacheReadTokens*s.cacheRead/1e6,u=sT(e,s),h=u.usd5m+u.usd1h;return{input:i,output:a,cacheRead:l,cacheWrite:h,total:i+a+l+h}}const Zb=2e5,SL=1e6,NL=[/\[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],EL=[{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 CL(e){if(!e)return Zb;const t=yl(e);for(const n of NL)if(n.test(t))return SL;for(const n of EL)if(n.match.test(t))return n.window;return Zb}function iT(e,t){return typeof e=="number"&&e>0?e:CL(t)}const Ci="not priced";function et(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 xw(e,t){if(e<=0||t<10)return null;const n=e/t,s=n*60;return s>=.01?`${et(s)}/min`:`${et(n*3600)}/hr`}function jL(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 TL(e,t){let n=0,s=0,i=0,a=0,l=0,u=0;for(const g of t)n+=g.inputTokens,s+=g.outputTokens,i+=g.cacheReadTokens,a+=g.cacheCreateTokens,l+=g.cacheCreate1hTokens??0,u+=g.cacheCreate5mTokens??0;const h=(g,y)=>Math.max(0,g-y),p={inputTokens:h(e.inputTokens,n),outputTokens:h(e.outputTokens,s),cacheReadTokens:h(e.cacheReadTokens,i),cacheCreateTokens:h(e.cacheCreateTokens,a)};return(e.cacheCreate1hTokens!==void 0||e.cacheCreate5mTokens!==void 0)&&(p.cacheCreate1hTokens=h(e.cacheCreate1hTokens??0,l),p.cacheCreate5mTokens=h(e.cacheCreate5mTokens??0,u)),p.inputTokens+p.outputTokens+p.cacheReadTokens+p.cacheCreateTokens>0?p:null}function bl(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=TL(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:jL(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 bl(e)){const i=ww(s.usage,s.model,t);n.input+=i.input,n.output+=i.output,n.cacheRead+=i.cacheRead,n.cacheWrite+=i.cacheWrite,n.total+=i.total}return n}function Py(e,t=Date.now()){let n=0;for(const s of bl(e))Gi(s.model,t)==null&&(n+=s.usage.inputTokens+s.usage.outputTokens);return n}function aT(e){const t=[];for(const n of bl(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 lT(e){return aT(e).filter(t=>t!==e.model)}const RL=new Set(["untrusted","on-request","on-failure"]);function AL(e){return typeof e!="string"||!e?null:RL.has(e)?!0:e==="never"?!1:null}function ML(e){if(e.provider!=="codex"||e.kind!=="root"||e.waiting||e.state!=="active")return null;const t=AL(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 Jb(e){return e[0].toUpperCase()+e.slice(1).toLowerCase()}function Os(e){const t=yl(e).replace(/[-_]\d{8}(?!\d)/,""),n=t.match(/^claude[-_](opus|sonnet|haiku|fable|mythos)[-_](\d+(?:[-_.]\d+)*)/i);if(n){const i=Jb(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(Jb);return[`GPT-${i}`,...a].join(" ")}return e}function Mu(e){const t=yl(e??""),n=t.match(/^claude[-_](opus|sonnet|haiku|fable|mythos)[-_]/i);return n?n[1].toLowerCase():/^gpt[-_]/i.test(t)?"gpt":""}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 wu(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 cT(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 uT(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 IL=1,dT=-1;function OL(){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===dT}}}const Oi=OL();function PL(e){return e.overlayOpen&&!e.panelOnTop?"dismiss":e.typing?"blur":e.overlayOpen?"dismiss":"clear-selection"}function e1(e){return String(e.tagName??"").toUpperCase()==="BODY"}function $L(e,t){return!e||!e.isConnected||e1(e)?!1:t==null||e1(t)}const t1="a[href], button, input, select, textarea, [tabindex]";function LL(e){return!e||e.disabled||e.rendered===!1?!1:(e.tabIndex??0)>=0}function qL(e){if(!e||!e.overflowing||e.hasFocusable)return!1;const t=String(e.overflow??"").toLowerCase();return t==="auto"||t==="scroll"}function DL({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 bw(e){return e.ctrlKey||e.metaKey||e.altKey}const FL=new Set(["button","checkbox","color","file","image","radio","range","reset","submit"]),zL=new Set(["INPUT","TEXTAREA","SELECT","OPTION","BUTTON","SUMMARY","A"]),BL=new Set(["button","checkbox","combobox","link","listbox","menu","menubar","menuitem","menuitemcheckbox","menuitemradio","option","radio","searchbox","slider","spinbutton","switch","tab","textbox","treeitem"]);function fT(e){return typeof e.tagName=="string"?e.tagName.toUpperCase():""}function _w(e){if(!e)return!1;if(e.isContentEditable)return!0;const t=fT(e);return t==="TEXTAREA"?!0:t!=="INPUT"?!1:!FL.has(String(e.type??"text").toLowerCase())}function UL(e){if(!e)return!1;if(_w(e)||zL.has(fT(e)))return!0;const t=typeof e.role=="string"?e.role.trim().toLowerCase():"";return t!==""&&t.split(/\s+/).some(n=>BL.has(n))}function WL({key:e,modalOpen:t,sheetOpen:n}){return t?!(e==="?"&&n):!1}function hT(e){return e?Array.from(e.querySelectorAll("*")).filter(t=>{if(t.matches(t1))return LL({disabled:t.disabled,tabIndex:t.tabIndex,rendered:t.getClientRects().length>0});const n=t.scrollHeight>t.clientHeight;return n&&qL({overflowing:n,overflow:getComputedStyle(t).overflowY,hasFocusable:t.querySelector(t1)!=null})}):[]}function HL(e,t){const n=hT(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=N.useRef(null),a=N.useRef(e);a.current=e;const l=N.useRef(null);l.current===null&&(l.current=()=>a.current());const u=l.current;return N.useEffect(()=>Oi.push(u,s),[u,s]),N.useEffect(()=>{var p;const h=document.activeElement;return(p=(n==null?void 0:n.current)??hT(i.current)[0])==null||p.focus(),()=>{$L(h,document.activeElement)&&h.focus()}},[]),N.useEffect(()=>{const h=p=>{var b;if(p.key!=="Tab"||bw(p))return;const f=i.current;if(!f)return;const g=document.activeElement;if(!(g!=null&&f.contains(g))&&!Oi.isTop(u))return;const w=HL(f,g),S=DL({count:w.length,index:g?w.indexOf(g):-1,shiftKey:p.shiftKey});S.kind!=="allow"&&(p.preventDefault(),S.kind==="focus"&&((b=w[S.index])==null||b.focus()))};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[u]),i}function GL(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 VL(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(2)} MB`}const YL=60;function KL(e,t=YL){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 XL({agent:e,onClose:t}){var y;const n=N.useRef(null),s=kn(t,{focusRef:n}),i=e.context,a=e.usage,l=(i==null?void 0:i.currentContextTokens)??0,u=iT(e.contextWindow,e.model),h=Math.min(100,l/u*100),p=bn(e),f=a.inputTokens+a.cacheReadTokens+a.cacheCreateTokens,g=GL(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(nr,{label:"input tokens",val:Pn(a.inputTokens)}),d.jsx(nr,{label:"output tokens",val:Pn(a.outputTokens)}),d.jsx(nr,{label:"cache reads",val:Pn(a.cacheReadTokens)}),d.jsx(nr,{label:"cache writes",val:Pn(a.cacheCreateTokens)}),d.jsx(nr,{label:"cumulative total",val:Pn(f)}),d.jsx(nr,{label:"estimated cost",val:et(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(nr,{label:"user messages",val:Pn((i==null?void 0:i.msgsUser)??0)}),d.jsx(nr,{label:"assistant messages",val:Pn((i==null?void 0:i.msgsAssistant)??0)}),d.jsx(nr,{label:"tool uses",val:Pn((i==null?void 0:i.toolUses)??0)}),d.jsx(nr,{label:"tool results",val:Pn((i==null?void 0:i.toolResults)??0)}),d.jsx(nr,{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}),(((y=i==null?void 0:i.memoryFiles)==null?void 0:y.length)??0)===0?d.jsx("div",{className:"ctx-empty",children:g.memoryEmpty}):d.jsx("ul",{className:"ctx-md-list",children:i.memoryFiles.map(w=>d.jsxs("li",{children:[d.jsx("span",{className:"ctx-md-path",title:w.path,children:KL(w.path)}),d.jsx("span",{className:"ctx-md-size",children:VL(w.bytes)})]},w.path))})]})})}function nr({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 QL({currentContextTokens:e,modelId:t,contextWindow:n,size:s=26,onClick:i}){const a=iT(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 n1(e,t){const n=Gi(t);if(!n)return`model: ${t}
60
+ no published rate in this build — the tokens are counted, the dollars are not`;const s=f=>f.toLocaleString(),i=f=>`$${f}/MTok`,a=ww(e,t),l=sT(e,n),u=l.tokens1h>0?[`cache w5m${s(l.tokens5m).padStart(14)} × ${i(n.cacheWrite).padEnd(11)} = ${et(l.usd5m)}`,`cache w1h${s(l.tokens1h).padStart(14)} × ${i(n.cacheWrite1h??n.cacheWrite).padEnd(11)} = ${et(l.usd1h)}`]:[`cache w ${s(l.tokens5m).padStart(14)} × ${i(n.cacheWrite).padEnd(11)} = ${et(l.usd5m)}`],h=oT(e,t),p=h===e.inputTokens?"input":"uncached";return[`model: ${t}`,`${p.padEnd(9)}${s(h).padStart(14)} × ${i(n.input).padEnd(11)} = ${et(a.input)}`,`output ${s(e.outputTokens).padStart(14)} × ${i(n.output).padEnd(11)} = ${et(a.output)}`,`cache r ${s(e.cacheReadTokens).padStart(14)} × ${i(n.cacheRead).padEnd(11)} = ${et(a.cacheRead)}`,...u,"─────────────────────────────────────────",`total = ${et(a.total)}`].join(`
61
+ `)}function r1(e){const t=bl(e);return t.length<=1?n1(e.usage,e.model):[...t.map(n=>n1(n.usage,n.model)),"═════════════════════════════════════════",`all models = ${et(bn(e).total)}`].join(`
62
+ `)}function ZL({data:e,selected:t}){var y;const n=e.now??Date.now(),s=["agent-node",`state-${e.state}`,e.synthetic?"synthetic":"",t?"selected":""].filter(Boolean).join(" "),i=e.tools.filter(w=>!w.endedAt).length,a=yw(e.sessionId),l=((y=e.context)==null?void 0:y.currentContextTokens)??0,u=e.kind==="root"&&l>0,h=e.sessionTitle?e.cwd?`${e.cwd}
63
+ ${e.sessionTitle}`:e.sessionTitle:e.cwd,p=lT(e),f=p.length>0?`${e.model}
64
+ spend on this card also covers:
65
+ ${p.join(`
66
+ `)}`:e.model,g=uT(e.sessionName,e.sessionTitle);return d.jsxs("div",{className:s,style:{"--session-hue":a},children:[d.jsx("span",{className:"accent-stripe"}),d.jsx(Fi,{type:"target",position:qe.Left,style:{background:"transparent",border:"none"}}),d.jsxs("div",{className:"head",children:[d.jsxs("div",{className:"title",children:[d.jsx(JL,{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(QL,{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:wu(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":Mu(e.model),title:f,children:[Os(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(t3,{waiting:e.waiting,now:n}),(()=>{const w=ML(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(n3,{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=Gi(e.model),S=bn(e),b=Py(e);if(!w&&S.total<=0)return e.usage.inputTokens+e.usage.outputTokens<=0?null:d.jsx("span",{className:"cost-unpriced",title:r1(e),children:Ci});if(S.total<=0)return null;const _=Math.max(0,((e.endedAt??n)-e.startedAt)/1e3),k=e.state==="active"?xw(S.total,_):null,E=r1(e)+(k?`
67
+ burn: ${k}`:"");return d.jsxs("span",{className:"cost-meta",title:E,children:[d.jsxs("b",{children:[et(S.total),b>0?"+":""]}),k&&d.jsx("span",{className:"cost-rate",children:k})]})})()]}),d.jsx(Fi,{type:"source",position:qe.Right,style:{background:"transparent",border:"none"}})]})}function xu(e){return e==="active"?"live":e==="done"?"done":"err"}function JL({state:e}){return d.jsx("span",{className:`state-pill state-${e}`,children:xu(e)})}function Iu(e){return e.message?e.message:e.kind==="permission"?"Needs your permission":"Waiting for your input"}function e3(e){return e.kind==="permission"?Iu(e):"Your turn"}function t3({waiting:e,now:t}){const n=e.kind==="permission",s=Iu(e);return d.jsxs("div",{className:n?"waiting-row permission":"waiting-row idle",title:`${s}
68
+ Blocked for ${wu(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:e3(e)}),d.jsx("b",{children:wu(e.since,void 0,t)})]})}function n3({tools:e,now:t}){const a=new Array(24).fill(0);let l=0;for(const S of e){const b=t-S.startedAt;if(b<0||b>=6e4)continue;const _=23-Math.floor(b/2500);_>=0&&_<24&&(a[_]+=1,l+=1)}const u=Math.max(1,...a),h=Math.max(0,...a),p=132,f=14,g=p/24,y=h/(2500/1e3),w=l===0?"no tool calls in the last 60s":`${l} tool calls in last 60s · peak ${y.toFixed(1)}/s`;return d.jsxs("div",{className:"tool-spark-row",title:w,children:[d.jsx("svg",{className:"tool-spark",width:p,height:f,viewBox:`0 0 ${p} ${f}`,"aria-hidden":!0,children:a.map((S,b)=>{const _=S===0?1.5:Math.max(1.5,S/u*f),k=b===23&&S>0,C=`tool-spark-bar${S>0?" active":""}${k?" latest":""}`;return d.jsx("rect",{x:b*g+.4,y:f-_,width:Math.max(.5,g-1),height:_,rx:.8,className:C},b)})}),d.jsx("span",{className:"tool-spark-label",children:"60s"})]})}function s1(e){if(e==null)return"(none)";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function r3({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:cT(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:s1(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…)":s1(e.response??e.errorPreview)})]})]})]})})}const Yc=18,o1=26,s3=12;function o3(e){return i3(e.nodeInternals.values())}function i3(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=a1(a)??f.label),a.kind==="root"&&(f.name=l1(a))):t.set(a.sessionId,{minX:l,minY:u,maxX:h,maxY:p,label:a1(a)??a.sessionId,name:l1(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,...u3(a.label,a.name,i,l),x:a.minX-Yc,y:a.minY-Yc-o1,w:a.maxX-a.minX+Yc*2,h:a.maxY-a.minY+Yc*2+o1})}return s}const $y=" · ",a3=32,l3=/[\u1100-\u115F\u2E80-\u303E\u3041-\u33FF\u3400-\u4DBF\u4E00-\u9FFF\uA000-\uA4CF\uAC00-\uD7A3\uF900-\uFAFF\uFE30-\uFE6F\uFF00-\uFF60\uFFE0-\uFFE6]/;function i1(e){return l3.test(e)?2:1}function c3(e,t=a3){const n=[...e];let s=0;for(const l of n)s+=i1(l);if(s<=t)return e;const i=[];let a=0;for(const l of n){const u=i1(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 u3(e,t,n,s){const i=(t==null?void 0:t.trim())??"",a=s?d3(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($y)}}function d3(e){const t=e.match(/[a-zA-Z0-9]{4}/);return t?t[0]:e.slice(0,4)}function a1(e){if(e.kind==="root")return e.label}function l1(e){if(e.kind==="root")return uT(e.sessionName,e.sessionTitle).face}function f3(){const{x:e,y:t,zoom:n}=Yj(),s=vl(),i=it(o3,h3);if(i.length<=1)return null;const a=u=>{try{const h=s.getNodes().filter(p=>{const f=p.data;return(f==null?void 0:f.sessionId)===u});if(h.length===0)return;s.fitView({padding:.3,duration:500,nodes:h})}catch{}},l={transform:`translate(${e}px, ${t}px) scale(${n})`};return d.jsx("div",{className:"session-clusters",style:l,children:i.map(u=>{const h=yw(u.sessionId),p={position:"absolute",left:u.x,top:u.y,width:u.w,height:u.h,"--session-hue":h},f={position:"absolute",left:u.x+16,top:u.y-s3,transform:`scale(${Math.min(1,n)/(n||1)})`,transformOrigin:"left top","--session-hue":h};return d.jsxs(ue.Fragment,{children:[d.jsx("div",{className:"cluster-card",style:p,"aria-hidden":!0}),d.jsxs("button",{type:"button",className:"cluster-label",style:f,title:`Fit view to ${u.fullLabel}
69
+ drag the wrapper to move the whole session`,onClick:()=>a(u.sessionId),children:[u.label,u.name?d.jsxs(d.Fragment,{children:[$y,d.jsx("span",{className:"cluster-label-name",children:u.name})]}):null,u.shortId?$y+u.shortId:null]})]},u.sessionId)})})}function h3(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 p3({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 _l={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"}},m3=Object.fromEntries(Object.entries(_l).map(([e,t])=>[e,t.category])),g3=Object.fromEntries(Object.entries(_l).map(([e,t])=>[e,t.emoji])),v3=Object.fromEntries(Object.entries(_l).map(([e,t])=>[e,t.label])),y3=new Set(Object.keys(_l)),w3=new Set(Object.entries(_l).filter(([,e])=>e.shell).map(([e])=>e)),c1={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",...m3};function pT(e){return e.startsWith("mcp__")?"mcp":Object.hasOwn(c1,e)?c1[e]:"other"}const x3=/\btools\.exec_command\s*\(\s*\{[^{}]*?\bcmd\s*:\s*(["'`])((?:\\.|(?!\1)[^\\])*)\1/,b3=/\btools\.([A-Za-z_$][\w$]*)\s*\(/;function _3(e){if(typeof e!="string"||!e)return null;const t=x3.exec(e);if(t){const s=k3(t[2]);if(s.trim())return s}const n=b3.exec(e);return n?n[1]:null}function k3(e){return e.replace(/\\(["'`\\nrt])/g,(t,n)=>n==="n"?`
70
+ `:n==="r"?"\r":n==="t"?" ":n)}const mT=600,S3=4,N3=36,Ly=16,E3=60,C3=6,u1=220,d1=96,j3=28,f1={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:"📡",...g3};function h1(e){return e.startsWith("mcp__")?"🔌":Object.hasOwn(f1,e)?f1[e]:"✨"}const p1={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 gT(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 gT(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 T3(e){if(typeof e=="string")return e;if(!e||typeof e!="object")return null;const t=e;if(typeof t.script=="string"){const n=_3(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 R3=new Set(["Bash","PowerShell",...w3]),A3=y3;function M3(e,t){return A3.has(e)||e.startsWith("mcp__")?Math.max(d1,34+t.length*7.5):d1}function I3(e,t){if(!R3.has(e))return null;const n=T3(t);if(!n)return null;const s=gT(n);return s?{emoji:Object.hasOwn(p1,s)?p1[s]:"⚙️",label:s,category:"shell",detail:n}:null}const O3=new Set(["Read","Write","Edit","MultiEdit","NotebookEdit","LS","Glob","apply_patch"]),m1={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:"🗄️"},g1={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 P3(e){const n=e.replace(/\\/g,"/").replace(/\/+$/,""),s=n.lastIndexOf("/");return s>=0?n.slice(s+1):n}function $3(e){const t=e.toLowerCase();if(Object.hasOwn(g1,t))return g1[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(m1,s))return m1[s]}return"📄"}function L3(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 q3(e,t){if(!O3.has(e))return null;const n=L3(e,t);if(!n)return null;const s=P3(n);return s?{emoji:e==="LS"?"📂":$3(s),label:s,category:"file",detail:n}:null}const v1={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 kw(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 D3(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 vT(e){const t=e.toLowerCase();return Object.hasOwn(v1,t)?v1[t]:void 0}function F3(e,t){const n=kw(e);if(!n)return null;const{server:s,method:i}=n;if(!i)return null;const a=vT(s);return{emoji:(a==null?void 0:a.emoji)??"🔌",label:i,category:"mcp",detail:a?`${a.name} · ${i}`:`${s} · ${i}`}}function z3(e,t){return I3(e,t)??q3(e,t)??F3(e)}const y1=v3;function yT(e){const t=kw(e);if(t){const s=vT(t.server);return s?{emoji:s.emoji,label:s.name}:{emoji:"🔌",label:t.server,hue:D3(t.server)}}const n=Object.hasOwn(y1,e)?y1[e]:"";return n?{emoji:h1(e),label:n}:{emoji:h1(e),label:e}}function B3(e){let t=null,n="";for(const s of e){const i=kw(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:yT(n)}function U3(e){return e.endedAt==null?"inflight":e.ok===!1?"err":"done"}function W3(e,t){if(t==null)return 1;const n=e-t;return n<0?1:Math.max(0,1-n/mT)}function H3(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 G3(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>mT)continue;const h=s.get(u.id)??n.get(u.id);if(!h)continue;const p=H3(u.tools,S3);if(p.length===0)continue;const f=u.exitAt??null,g=i.get(u.id),y=Math.max((g==null?void 0:g.width)??u1,u1),w=(g==null?void 0:g.height)??130,S=h.x,b=h.y,_=S+y,k=b+w/2;p.forEach((E,C)=>{const j=C*N3,I=S+y+E3,O=b+C3+j,P=W3(a,f),F=E.inputPreview??"",M=U3(E),A=P<.999,q=yT(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:pT(E.name),mcpHue:q.hue,inputPreview:F,fade:P,fading:A,worldX:I,worldY:O,anchorX:_,anchorY:k,spawnDx:_-I,spawnDy:k-(O+Ly)});const W=z3(E.name,E.input);if(W){const V=M3(E.name,q.label),T=I+V+j3,Q=O,U=I+V,ne=O+Ly;l.push({id:`sub:${u.id}::${E.id}`,toolId:E.id,agentId:u.id,toolName:E.name,name:W.label,emoji:W.emoji,isSub:!0,status:M,category:W.category,inputPreview:W.detail??F,fade:P,fading:A,worldX:T,worldY:Q,anchorX:U,anchorY:ne,spawnDx:U-T,spawnDy:0})}})}return l}function V3({agents:e,visibleAgentIds:t,positions:n,pinned:s,measured:i,spotlight:a,hiddenCategories:l,now:u,onOpenTool:h}){const p=G3(e,t,n,s,i,u),f=l&&l.size>0?p.filter(g=>!l.has(g.category)):p;return d.jsx(Y3,{bursts:f,spotlight:a,onOpenTool:h})}function Y3({bursts:e,spotlight:t,onOpenTool:n}){const{x:s,y:i,zoom:a}=Yj();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+Ly)*a+i,g=u+(p-u)*.55,y=t!=null&&!t.has(l.agentId),w=l.fade*(y?.14:1);return d.jsx("path",{d:`M ${u} ${h} Q ${g} ${h}, ${p} ${f}`,className:`tool-conn status-${l.status}${l.fading?" fading":""}`,opacity:w},`l:${l.id}`)})}),e.map(l=>{const u=l.worldX*a+s,h=l.worldY*a+i,p={left:`${u}px`,top:`${h}px`,transform:`scale(${a})`,transformOrigin:"left top","--spawn-dx":`${l.spawnDx}px`,"--spawn-dy":`${l.spawnDy}px`},f=l.isSub?`${l.toolName} · ${l.name}`:l.toolName,g=l.inputPreview?`${f} · ${l.inputPreview}`:f,y=n!=null,w=l.mcpHue!=null?{"--mcp-hue":l.mcpHue}:{},b=t!=null&&!t.has(l.agentId)?" dim":"";return d.jsx("div",{className:"tool-burst-wrap",style:p,children:d.jsxs("div",{className:`tool-burst cat-${l.category}${l.mcpHue!=null?" mcp-hue":""} status-${l.status}${l.fading?" fading":""}${y?" clickable":""}${l.isSub?" sub":""}${b}`,style:w,title:g,onClick:y?()=>n(l.toolId):void 0,children:[d.jsx("span",{className:"tb-emoji",children:l.emoji}),d.jsx("span",{className:"tb-name",children:l.name}),l.status==="inflight"&&d.jsx("span",{className:"tb-spin"}),l.status==="done"&&d.jsx("span",{className:"tb-mark done",children:"✓"}),l.status==="err"&&d.jsx("span",{className:"tb-mark err",children:"×"})]})},l.id)})]})}function K3(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 X3="spend on this board",Q3="on this board",w1=`Everything on the board right now, and only that.
71
+ Finished sessions are evicted from the canvas a couple of minutes after they end, and their tokens and dollars leave with them — so this figure falls on its own.
72
+ Press H for the totals ccusage reads off the logs on disk, which do not forget.`,wT="session spend";function Sw({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}: ${et(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 Z3({state:e,sessionId:t,onClose:n}){const s=N.useMemo(()=>J3(e,t),[e,t]),i=N.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:wT}),d.jsx("div",{className:"ss-cost",children:et(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":Mu(l),title:l,children:Os(l)},l))})]}),d.jsx("div",{className:"ss-hero-right",children:s.cost.total>0&&d.jsxs(d.Fragment,{children:[d.jsx(Sw,{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:et(s.cost.input)})]}),d.jsxs("span",{className:"ssl ssl-out",children:["output ",d.jsx("b",{children:et(s.cost.output)})]}),d.jsxs("span",{className:"ssl ssl-cr",children:["cache r ",d.jsx("b",{children:et(s.cost.cacheRead)})]}),d.jsxs("span",{className:"ssl ssl-cw",children:["cache w ",d.jsx("b",{children:et(s.cost.cacheWrite)})]})]})]})})]}),d.jsxs("section",{className:"ss-stats",children:[d.jsx(Si,{label:"agents",value:s.agentCount}),d.jsx(Si,{label:"subagents",value:s.subagentCount}),d.jsx(Si,{label:"tool calls",value:s.toolCount}),d.jsx(Si,{label:"prompts",value:s.promptCount}),d.jsx(Si,{label:"tokens",value:s.tokensSum.toLocaleString()}),s.errCount>0&&d.jsx(Si,{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 Si({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 J3(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,y,w=1/0,S=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 aT(C))a.add(I);C.model&&a.add(C.model),C.kind==="subagent"&&g++,h+=C.prompts.length,!y&&C.prompts.length>0&&(y=C.prompts[0].text),p+=C.usage.inputTokens+C.usage.outputTokens,u+=C.toolCount,w=Math.min(w,C.startedAt),S=Math.max(S,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,S-w),_=Math.floor(b/1e3),k=_<60?`${_}s`:_<3600?`${Math.floor(_/60)}m ${String(_%60).padStart(2,"0")}s`:`${Math.floor(_/3600)}h ${Math.floor(_%3600/60)}m`,E=Array.from(l.entries()).sort((C,j)=>j[1]-C[1]).slice(0,5);return{sessionId:t,label:n.label||n.cwdBasename||"session",cwd:n.cwd,durationLabel:k,cost:i,modelChips:Array.from(a),agentCount:s.length,subagentCount:g,toolCount:u,promptCount:h,tokensSum:p,errCount:f,topTools:E,firstPrompt:y}}function Nw(e){return(e==null?void 0:e.kind)==="permission"}function eq(e){const t=[];for(const n of e)n.kind==="root"&&Nw(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 tq(e){const t=new Set;for(const n of e)n.state==="active"&&t.add(n.sessionId);return t.size}function x1(e){return e.waiting?Nw(e.waiting)?0:1:e.state==="active"?2:3}function nq(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=x1(s),l=x1(i);return a!==l?a-l:s.waiting&&i.waiting?s.waiting.since-i.waiting.since:i.lastActivity-s.lastActivity}),n}function b1(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 rq({state:e,now:t,selectedIds:n,onSelect:s,onClose:i}){const a=N.useMemo(()=>nq(e),[e,e.revision,t]),l=a.filter(h=>h.state==="active").length,u=a.filter(h=>Nw(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:xu(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":Mu(h.modelId),title:h.modelId,children:Os(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:wT,children:d.jsx("b",{children:et(h.cost)})}),h.waiting?d.jsxs("span",{className:"sl-waiting",title:`${Iu(h.waiting)}
73
+ Blocked since ${new Date(h.waiting.since).toLocaleTimeString()} · started ${new Date(h.startedAt).toLocaleString()}`,children:["waiting ",b1(h.waiting.since,void 0,t)]}):d.jsx("span",{className:"sl-elapsed",title:`Started ${new Date(h.startedAt).toLocaleString()}`,children:b1(h.startedAt,h.state==="active"?void 0:h.lastActivity,t)})]})]})]},h.sessionId)})]})]})}const sq=e=>1-Math.pow(1-e,5),xT=420;function oq(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 iq(e,t,n,s=xT){return n>=s?t:n<=0?e:e+(t-e)*sq(n/s)}function aq(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()||!oq(e,t))return n(t),()=>{};const p=i();let f=0,g=!0;const y=()=>{if(!g)return;const w=i()-p;n(iq(e,t,w)),w<xT&&(f=a(y))};return f=a(y),()=>{g=!1,f&&l(f)}}const qy={cost:0,inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0,sessions:0};function _1(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 lq(e,t){if(!e)return qy;const n={...qy};for(const[s,i]of t){const a=e.get(s),l={cost:i.cost-((a==null?void 0:a.cost)??0),inputTokens:i.inputTokens-((a==null?void 0:a.inputTokens)??0),outputTokens:i.outputTokens-((a==null?void 0:a.outputTokens)??0),cacheReadTokens:i.cacheReadTokens-((a==null?void 0:a.cacheReadTokens)??0),cacheCreateTokens:i.cacheCreateTokens-((a==null?void 0:a.cacheCreateTokens)??0)};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 Dy(e,t=new Date){return new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate()-(e-1))).toISOString().slice(0,10).replace(/-/g,"")}const k1=[{key:"today",label:"today",noun:"today"},{key:"month",label:"month",noun:"this month"},{key:"all",label:"all",noun:"all time"}];function cq(e,t=new Date){return e==="today"?Dy(1,t):e==="month"?Dy(t.getDate(),t):"20200101"}const xn=e=>typeof e=="number"&&Number.isFinite(e)?e:0,au=e=>typeof e=="string"?e:"";function bT(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=au(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 uq(e,t=new Map){const n=Array.isArray(e==null?void 0:e.sessions)?e.sessions:[],s=[];for(const i of n){const a=au(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:au(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(au).filter(Boolean):[],lastActivityMs:Number.isFinite(u)?u:null})}return s.sort((i,a)=>a.cost-i.cost||a.tokens-i.tokens)}function dq(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=bT(e),s=h=>n.reduce((p,f)=>p+h(f),0),i=s(h=>h.inputTokens),a=s(h=>h.outputTokens),l=s(h=>h.cacheReadTokens),u=s(h=>h.cacheCreateTokens);return{cost:s(h=>h.cost),inputTokens:i,outputTokens:a,cacheReadTokens:l,cacheCreateTokens:u,tokens:i+a+l+u}}const Ft="ccdeck";function _T(e){const t=Math.max(0,e);return t<60?"just now":t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}function Fy(e){return _T(Math.floor(e/1e3))}function kT(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 fq(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function hq(e,t,n){const s=new Date(e),i=Fy(t-e);return{label:fq(s,new Date(t))?i:`${i} · ${s.toLocaleDateString(n,{month:"short",day:"numeric"})}`,title:s.toLocaleString(n,{dateStyle:"medium",timeStyle:"medium"})}}function ST(e,t){return{disabled:e!=null&&e!==t,busy:e===t}}function NT(e){return e==null}const zy="self";function or(e,t=!1){const n=ST(e?zy:null,zy);return{disabled:t||n.disabled,"aria-busy":n.busy}}function ir(e){return NT(e?zy:null)}function pq(e){return[...e==null?[]:[`#ap-more-${e}`],".accounts-panel .ap-refresh"]}function mq(e){return e==null||e==="BODY"||e==="HTML"}function S1(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 gq(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 Vf="__unknown__";function vq(e,t,n,s){const i=Math.max(0,t-s),a=Math.max(0,n-i);if(a<120)return null;const l=Math.min(100,a/n*100),u=e-l;if(Math.abs(u)<3)return{label:"on pace",color:"var(--ok)",expectedPct:l,isDeficit:!1};if(u>0){const h=100-e,p=a>0?e/a:0,f=p>0?h/p:1/0,g={label:`${Math.round(u)}% ahead`,color:"var(--warn)",expectedPct:l,isDeficit:!0};if(f<i&&f<86400){const y=Math.floor(f/3600),w=Math.floor(f%3600/60);g.runsOutIn=y>0?`${y}h ${w}m`:`${w}m`}return g}return{label:`${Math.round(-u)}% reserve`,color:"var(--ok)",expectedPct:l,isDeficit:!1}}function ho({pct:e,label:t,reset:n,resetAt:s,windowSec:i,limitReached:a,nowSec:l}){const u=Math.min(100,Math.max(0,e)),p=a||u>=90?"var(--err)":u>=70?"var(--warn)":"var(--accent)",f=u===0?"< 1%":`${u}%`,g=u===0?2:u,y=s?kT(s,l):null,w=s&&i?vq(u,s,i,l):null;return d.jsxs("div",{className:"qb-row",children:[d.jsxs("div",{className:"qb-meta",children:[d.jsxs("span",{className:"qb-label",children:[t,a&&d.jsx("span",{className:"qb-limit-badge",title:"Rate limit reached",children:"⛔"})]}),d.jsx("span",{className:"qb-pct",style:{color:p},children:f})]}),d.jsxs("div",{className:"qb-track",children:[d.jsx("div",{className:"qb-fill",style:{width:`${g}%`,background:p,opacity:u===0?.4:1}}),w&&d.jsx("div",{className:"qb-pace-marker",style:{left:`${w.expectedPct}%`,background:w.isDeficit?"var(--err)":"var(--ok)"},title:`To last until reset, stay near ${Math.round(w.expectedPct)}% by now`})]}),d.jsxs("div",{className:"qb-reset-row",children:[y?d.jsxs("span",{className:"qb-reset",children:["resets in ",y]}):n?d.jsxs("span",{className:"qb-reset",children:["resets ",n]}):null,w&&d.jsx("span",{className:"qb-pace",style:{color:w.color},children:w.runsOutIn?`runs out in ${w.runsOutIn}`:w.label})]})]})}const yq=6e4;function wq(e){const[t,n]=N.useState(null),[s,i]=N.useState(!1),a=N.useRef(null),l=N.useRef(!1),u=async(p=!1)=>{if(!(p&&!ir(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 N.useEffect(()=>{if(e)return u(!0),a.current=window.setInterval(()=>u(!1),yq),()=>{a.current!=null&&window.clearInterval(a.current)}},[e]),{quota:t,loading:s,refresh:()=>{e&&u(!0)}}}function xq(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 bq(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 ET=6e4,N1=6e4;function _q(e){const[t,n]=N.useState(null),[s,i]=N.useState(!1),a=N.useRef(null),l=N.useRef(!1),u=async(p=!1)=>{if(!(p&&!ir(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 N.useEffect(()=>{if(e)return u(!0),a.current=window.setInterval(()=>u(!1),ET),()=>{a.current!=null&&window.clearInterval(a.current)}},[e]),{data:t,loading:s,refresh:()=>{e&&u(!0)}}}function kq(e){const[t,n]=N.useState(null),s=N.useRef(null),i=async()=>{try{const a=await fetch("/api/codex-usage");a.ok&&n(await a.json())}catch{}};return N.useEffect(()=>{if(e)return i(),s.current=window.setInterval(i,ET),()=>{s.current!=null&&window.clearInterval(s.current)}},[e]),{data:t}}function Sq(e,t){const[n,s]=N.useState(null),[i,a]=N.useState(!1),[l,u]=N.useState(0),h=N.useRef(0);N.useEffect(()=>{const f=()=>document.visibilityState==="visible",g=()=>{f()&&u(S=>S+1)},y=window.setInterval(g,N1),w=()=>{f()&&Date.now()-h.current>=N1&&u(S=>S+1)};return document.addEventListener("visibilitychange",w),()=>{window.clearInterval(y),document.removeEventListener("visibilitychange",w)}},[]);const p=N.useRef(t);return N.useEffect(()=>{let f=!0;const g=t!==p.current;p.current=t;const y=e,w=cq(y);return a(!0),fetch(`/api/ccusage?since=${w}${g?"&refresh=1":""}`).then(S=>S.ok?S.json():null).then(S=>{f&&(S!=null&&S.ok)&&(h.current=Date.now(),s({period:y,data:S}))}).catch(()=>{}).finally(()=>{f&&a(!1)}),()=>{f=!1}},[e,t,l]),{data:(n==null?void 0:n.data)??null,shown:(n==null?void 0:n.period)??null,loading:i,stale:n!=null&&n.period!==e}}function Wa(e){const[t,n]=N.useState(e),s=N.useRef(e),i=N.useRef(!0);return N.useEffect(()=>{s.current=t},[t]),N.useEffect(()=>{if(i.current){i.current=!1,s.current=e,n(e);return}return aq(s.current,e,l=>{s.current=l,n(l)})},[e]),t}function Nq({state:e,now:t,providers:n,onClose:s}){var Ye,ut,at;const{quota:i,loading:a,refresh:l}=wq(n.claude),{data:u,loading:h,refresh:p}=_q(n.codex),{data:f}=kq(n.codex),[g,y]=N.useState(()=>Math.floor(Date.now()/1e3));N.useEffect(()=>{const de=window.setInterval(()=>y(Math.floor(Date.now()/1e3)),3e4);return()=>window.clearInterval(de)},[]);const{byModel:w,totalCost:S,totalTokens:b,burnRate:_}=N.useMemo(()=>{const de=new Map;for(const He of e.agents.values())for(const Ke of bl(He)){const oe=Ke.model??Vf,Ie=ww(Ke.usage,Ke.model),Oe=de.get(oe);Oe?(Oe.inputTokens+=Ke.usage.inputTokens,Oe.outputTokens+=Ke.usage.outputTokens,Oe.cacheReadTokens+=Ke.usage.cacheReadTokens,Oe.cacheCreateTokens+=Ke.usage.cacheCreateTokens,Oe.cost.total+=Ie.total,Oe.cost.input+=Ie.input,Oe.cost.output+=Ie.output,Oe.cost.cacheRead+=Ie.cacheRead,Oe.cost.cacheWrite+=Ie.cacheWrite,Oe.agentCount++):de.set(oe,{model:oe,inputTokens:Ke.usage.inputTokens,outputTokens:Ke.usage.outputTokens,cacheReadTokens:Ke.usage.cacheReadTokens,cacheCreateTokens:Ke.usage.cacheCreateTokens,cost:{...Ie},agentCount:1,priced:Gi(Ke.model)!=null})}const _e=Array.from(de.values()).sort((He,Ke)=>Ke.cost.total-He.cost.total||Ke.inputTokens+Ke.outputTokens-(He.inputTokens+He.outputTokens));let De=0,Ge=0;for(const He of e.agents.values()){if(He.state!=="active")continue;const Ke=bn(He);De+=Ke.total,Ge=Math.max(Ge,((He.endedAt??t)-He.startedAt)/1e3)}const lt=Ge>0?xw(De,Ge):null,je=K3(e.agents.values());return{byModel:_e,totalCost:je.cost,totalTokens:je,burnRate:lt}},[e,e.revision,t]),k=N.useMemo(()=>{const de=[];for(const _e of e.agents.values()){if(_e.kind!=="root")continue;let De=bn(_e).total,Ge=_e.usage.inputTokens,lt=_e.usage.outputTokens,je=Py(_e);for(const He of e.agents.values())He.sessionId!==_e.sessionId||He.kind==="root"||(De+=bn(He).total,Ge+=He.usage.inputTokens,lt+=He.usage.outputTokens,je+=Py(He));de.push({sessionId:_e.sessionId,label:_e.label||_e.cwdBasename||"session",state:_e.state,cost:De,inputTokens:Ge,outputTokens:lt,unpricedTokens:je})}return de.sort((_e,De)=>De.cost-_e.cost||De.inputTokens+De.outputTokens-(_e.inputTokens+_e.outputTokens)).slice(0,12)},[e,e.revision]),[E,C]=N.useState("today"),[j,I]=N.useState(0),{data:O,shown:P,stale:F}=Sq(E,j),M=O!=null,A=N.useMemo(()=>{const de=new Map;for(const _e of e.agents.values()){if(_e.kind!=="root"||!_e.sessionId)continue;const De=_e.label||_e.cwdBasename;De&&de.set(_e.sessionId,De)}return de},[e,e.revision]),q=N.useMemo(()=>{const de=new Map;for(const _e of e.agents.values())_e.kind!=="root"||!_e.sessionId||de.set(_e.sessionId,_e.state);return de},[e,e.revision]),W=N.useMemo(()=>M?bT(O):[],[O,M]),V=N.useMemo(()=>{if(!M)return[];const de=uq(O,A).slice(0,12),_e=new Map;for(const De of de)De.label&&_e.set(De.label,(_e.get(De.label)??0)+1);return de.map(De=>De.label&&(_e.get(De.label)??0)>1?{...De,label:`${De.label} ${De.sessionId.slice(0,4)}`}:De)},[O,M,A]),T=N.useMemo(()=>dq(O),[O]),Q=((Ye=k1.find(de=>de.key===(P??E)))==null?void 0:Ye.noun)??"today",U=F?" up-stale":"",ne=M?T.cost>0:S.total>0,X=M?T.tokens:b.sum,H=N.useRef(null);N.useEffect(()=>{H.current=O?_1(e.agents.values(),t):null},[O]);const J=N.useMemo(()=>M?lq(H.current,_1(e.agents.values(),t)):qy,[e,e.revision,O,M,t]),$=M?T.cost+J.cost:S.total,G=M?T.inputTokens+J.inputTokens:b.inputTokens,Z=M?T.outputTokens+J.outputTokens:b.outputTokens,D=M?T.cacheReadTokens+J.cacheReadTokens:b.cacheReadTokens,L=M?T.cacheCreateTokens+J.cacheCreateTokens:b.cacheCreateTokens,Y=Wa($),re=Wa(G),he=Wa(Z),pe=Wa(D),we=Wa(L),Ce=w.filter(de=>de.cost.total>0||de.inputTokens+de.outputTokens>0),Ve=k.filter(de=>de.cost>0||de.inputTokens+de.outputTokens>0),Be=M?W.some(de=>de.cost<=0&&de.tokens>0):Ce.some(de=>!de.priced),Le=a||h,ke=S1(i==null?void 0:i.fetchedAt,g),ce=S1(u==null?void 0:u.fetchedAt,g),be=()=>{l(),p(),I(de=>de+1)},xe=n.claude&&n.codex?"Refresh Claude + Codex quota":n.codex?"Refresh Codex quota":"Refresh Claude quota";return d.jsxs("aside",{className:"usage-panel",id:"usage-panel","aria-label":"Usage",children:[d.jsxs("div",{className:"up-header",children:[d.jsx("h2",{children:"Usage"}),_&&d.jsx("span",{className:"up-rate",children:_}),d.jsxs("div",{className:"up-header-right",children:[(n.claude||n.codex)&&d.jsx("button",{type:"button",className:"glyph-btn up-refresh-btn",onClick:be,...or(Le),"aria-label":xe,title:xe,children:Le?"…":"↻"}),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",ke&&!a&&d.jsx("span",{className:"up-section-age",title:gq(i==null?void 0:i.source),children:ke})]}),i!=null&&i.ok?d.jsxs("div",{className:"up-quota-bars",children:[i.session5hPct!=null&&d.jsx(ho,{label:"5-hour window",pct:i.session5hPct,reset:i.session5hReset,resetAt:i.session5hResetAt,windowSec:i.session5hWindowSec,nowSec:g}),i.week7dPct!=null&&d.jsx(ho,{label:"7-day window",pct:i.week7dPct,reset:i.week7dReset,resetAt:i.week7dResetAt,windowSec:i.week7dWindowSec,nowSec:g}),i.weekSonnetPct!=null&&d.jsx(ho,{label:"Sonnet (7d)",pct:i.weekSonnetPct,nowSec:g}),i.weekOpusPct!=null&&d.jsx(ho,{label:"Opus (7d)",pct:i.weekOpusPct,nowSec:g})]}):(i==null?void 0:i.ok)===!1?d.jsxs("div",{className:"up-quota-na",children:[d.jsx("span",{children:i.reason==="no_subscription"?"No quota to show.":"Quota unavailable."}),d.jsx("span",{className:"up-quota-hint",children:xq(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}),ce&&!h&&d.jsx("span",{className:"up-section-age",title:"Fetched from the Codex usage endpoint",children:ce})]}),u!=null&&u.ok?d.jsxs("div",{className:"up-quota-bars",children:[(ut=u.windows)==null?void 0:ut.map(de=>d.jsx(ho,{label:de.label,pct:de.pct,reset:de.reset??void 0,resetAt:de.resetAt??void 0,windowSec:de.windowSec??void 0,limitReached:u.limitReached&&de.pct>=100,nowSec:g},de.id)),(at=u.extraWindows)==null?void 0:at.map(de=>d.jsx(ho,{label:de.label,pct:de.pct,reset:de.reset??void 0,resetAt:de.resetAt??void 0,windowSec:de.windowSec??void 0,nowSec:g},de.id)),u.creditLimit&&d.jsx(ho,{label:`spend cap · $${Math.round(u.creditLimit.used)} of $${Math.round(u.creditLimit.limit)}`,pct:u.creditLimit.usedPct,reset:u.creditLimit.reset??void 0,resetAt:u.creditLimit.resetAt??void 0,limitReached:u.spendControlReached,nowSec:g}),u.creditsBalance&&!u.creditsUnlimited&&d.jsxs("div",{className:"up-quota-sub up-credits",children:["credits: $",u.creditsBalance,u.overageReached&&" · overage limit reached"]}),u.creditsUnlimited&&d.jsx("div",{className:"up-quota-sub up-credits",children:"credits: unlimited"}),u.resetCredits&&u.resetCredits.availableCount>0&&d.jsxs("div",{className:"up-quota-sub up-reset-credits",title:`Redeem in the Codex CLI or ChatGPT — ${Ft} 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:bq(u.reason)})]}):d.jsx("div",{className:"up-quota-na up-quota-loading",children:"Checking…"}),(f==null?void 0:f.ok)&&f.window7d&&f.window7d.sessionCount>0&&d.jsxs("div",{className:"up-quota-sub",title:`Counted from the rollout files under CODEX_HOME — no network, no account${f.window5h?`
74
+ last 5h: ${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:k1.map(de=>d.jsx("button",{type:"button","aria-pressed":E===de.key,className:"uh-range-btn",onClick:()=>C(de.key),children:de.label},de.key))}),X>0?d.jsxs(d.Fragment,{children:[ne&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:`up-total${U}`,title:M?void 0:w1,children:[d.jsx("span",{className:"up-total-value",children:et(Y)}),d.jsx("span",{className:"up-total-label",children:M?Q:X3})]}),!M&&d.jsx(Sw,{cost:S})]}),d.jsxs("div",{className:`up-tokens-row${U}`,title:M?void 0:w1,children:[d.jsxs("span",{className:"up-tok",children:[d.jsx("span",{className:"up-k",children:"in"}),Rt(re)]}),d.jsxs("span",{className:"up-tok",children:[d.jsx("span",{className:"up-k",children:"out"}),Rt(he)]}),D>0&&d.jsxs("span",{className:"up-tok",children:[d.jsx("span",{className:"up-k",children:"cache r"}),Rt(pe)]}),L>0&&d.jsxs("span",{className:"up-tok",children:[d.jsx("span",{className:"up-k",children:"cache c"}),Rt(we)]}),!ne&&d.jsx("span",{className:"up-tok up-scope",children:Q3})]}),(M?W.length:Ce.length)>0&&d.jsxs("section",{className:`up-section${U}`,children:[d.jsx("h3",{className:"up-section-title",children:"By model"}),d.jsxs("table",{className:"up-table",children:[d.jsx("thead",{children:d.jsxs("tr",{children:[d.jsx("th",{children:"Model"}),d.jsx("th",{children:"Tokens"}),d.jsx("th",{children:"Cost"})]})}),d.jsx("tbody",{children:M?W.map(de=>d.jsxs("tr",{children:[d.jsx("td",{className:"up-model-name",title:de.model,children:Os(de.model)}),d.jsx("td",{className:"up-num",children:Rt(de.tokens)}),de.cost>0?d.jsx("td",{className:"up-num up-cost-val",children:et(de.cost)}):d.jsx("td",{className:"up-num up-unpriced",children:Ci})]},de.model)):Ce.map(de=>d.jsxs("tr",{children:[d.jsx("td",{className:"up-model-name",title:de.model===Vf?"no model reported yet":de.model,children:de.model===Vf?"unknown":Os(de.model)}),d.jsx("td",{className:"up-num",children:Rt(de.inputTokens+de.outputTokens)}),de.priced?d.jsx("td",{className:"up-num up-cost-val",children:et(de.cost.total)}):d.jsx("td",{className:"up-num up-unpriced",children:Ci})]},de.model))})]})]}),M&&V.length===0&&T.tokens>0&&d.jsxs("section",{className:"up-section",children:[d.jsx("h3",{className:"up-section-title",children:"By session"}),d.jsxs("div",{className:"up-hint",children:["No session is dated ",Q," yet — ccusage dates sessions in UTC, and the totals above are your local day."]})]}),(M?V.length:Ve.length)>0&&d.jsxs("section",{className:`up-section${U}`,children:[d.jsxs("h3",{className:"up-section-title",children:["By session",M&&d.jsxs("span",{className:"up-section-age",title:`Sessions with activity ${Q}, each showing what that session has cost since it started.
75
+ A session that began earlier brings its whole total with it, so these rows can add up to more than the figure above.`,children:["active ",Q]})]}),d.jsxs("div",{className:"up-sessions",children:[M&&V.map(de=>{const _e=q.get(de.sessionId);return d.jsxs("div",{className:"up-session-row",children:[_e?d.jsxs(d.Fragment,{children:[d.jsx("span",{className:`sl-dot state-${_e}`,"aria-hidden":!0}),d.jsx("span",{className:"vis-hidden",children:xu(_e)})]}):d.jsx("span",{className:"sl-dot up-dot-past","aria-hidden":!0}),d.jsx("span",{className:`up-session-label${de.label?"":" up-session-id"}`,title:de.label?`${de.label}
76
+ ${de.sessionId}`:de.sessionId,children:de.label??de.sessionId.slice(0,8)}),d.jsx("span",{className:"up-session-tokens",children:Rt(de.tokens)}),de.cost>0?d.jsx("span",{className:"up-session-cost",title:de.models.join(", ")||void 0,children:et(de.cost)}):d.jsx("span",{className:"up-session-cost up-unpriced",children:Ci})]},de.sessionId)}),!M&&Ve.map(de=>d.jsxs("div",{className:"up-session-row",children:[d.jsx("span",{className:`sl-dot state-${de.state}`,"aria-hidden":!0}),d.jsx("span",{className:"vis-hidden",children:xu(de.state)}),d.jsx("span",{className:"up-session-label",children:de.label}),d.jsx("span",{className:"up-session-tokens",children:Rt(de.inputTokens+de.outputTokens)}),de.cost>0?d.jsxs("span",{className:"up-session-cost",title:de.unpricedTokens>0?`${Rt(de.unpricedTokens)} tokens in this session are on an unpriced model, so this is a floor`:void 0,children:[et(de.cost),de.unpricedTokens>0?"+":""]}):d.jsx("span",{className:"up-session-cost up-unpriced",children:Ci})]},de.sessionId))]})]}),Be&&d.jsxs("div",{className:"up-hint",children:["“",Ci,"” 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 Eq="1",E1="agent-dag.schema",Cq=["agent-dag.layout","agent-dag.viewport"];function Ou(e){if(typeof window>"u")return null;try{return window.localStorage.getItem(e)}catch{return null}}function jq(e,t=Eq){let n=null;try{n=e.getItem(E1)}catch{return[]}if(n===t)return[];const s=[];if(n!==null)for(const i of Cq)try{e.getItem(i)!==null&&(e.removeItem(i),s.push(i))}catch{}try{e.setItem(E1,t)}catch{}return s}const vt={l:30,r:6,t:6,b:2},Pu=104,Tq=64;function mo(e,t=100,n=Pu){const s=n-vt.t-vt.b;return vt.t+s*(1-Math.max(0,Math.min(t,e))/t)}function Rq(e,t,n,s=100,i=Pu){if(!e.length)return"";const a=e[e.length-1].t-e[0].t,l=p=>{const f=t-vt.l-vt.r;return vt.l+(a>0?f*(p-e[0].t)/a:f/2)};let u="",h=null;for(const p of e){const f=h&&p.t-h.t<=n*2?"L":"M";u+=`${f}${l(p.t).toFixed(1)} ${mo(p.v,s,i).toFixed(1)}`,h=p}return u}function Aq(e,t,n,s=100,i=Pu){if(e.length<2)return"";const a=i-vt.b,l=e[e.length-1].t-e[0].t,u=t-vt.l-vt.r,h=y=>vt.l+(l>0?u*(y-e[0].t)/l:u/2);let p="",f=[];const g=()=>{if(f.length>=2){let y=`M${h(f[0].t).toFixed(1)} ${a}`;for(const w of f)y+=`L${h(w.t).toFixed(1)} ${mo(w.v,s,i).toFixed(1)}`;p+=`${y}L${h(f[f.length-1].t).toFixed(1)} ${a}Z`}f=[]};for(const y of e)f.length&&y.t-f[f.length-1].t>n*2&&g(),f.push(y);return g(),p}function Mq(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 Iq(e,t,n){return n!=null&&e>=n?"hot":t!=null&&e>=t?"warn":""}function Oq(e,t,n=s=>el(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 el(e){const t=new Date(e);return`${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}`}function CT(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 Pq({group:e,title:t,onClose:n}){const s=kn(n),[i,a]=N.useState(null);N.useEffect(()=>{let p=!0;const f=async()=>{try{const y=await fetch(`/api/system/history?group=${e}`);if(!y.ok)return;const w=await y.json();p&&(w!=null&&w.ok)&&a(w)}catch{}};f();const g=window.setInterval(f,2e4);return()=>{p=!1,window.clearInterval(g)}},[e]);const l=(i==null?void 0:i.series)??[],[u,h]=N.useMemo(()=>{let p=1/0,f=0;for(const g of l)g.points.length&&(p=Math.min(p,g.points[0].t),f=Math.max(f,g.points[g.points.length-1].t));return[Number.isFinite(p)?Math.max(p,(i==null?void 0:i.sinceMs)??0):(i==null?void 0:i.sinceMs)??0,f]},[l,i==null?void 0:i.sinceMs]);return ow.createPortal(d.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:d.jsxs("div",{ref:s,className:"modal hist-modal",onClick:p=>p.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"hist-modal-title",children:[d.jsxs("div",{className:"modal-head",children:[d.jsx("span",{className:"modal-title",id:"hist-modal-title",children:t}),i&&u>0&&d.jsxs("span",{className:"hist-since",children:["since ",el(u)," · ",CT(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($q,{series:p,stepMs:i.stepMs},p.label))})]})}),document.body)}function $q({series:e,stepMs:t}){const n=N.useRef(null),[s,i]=N.useState(560),[a,l]=N.useState(null);N.useEffect(()=>{const P=n.current;if(!P||typeof ResizeObserver>"u")return;const F=new ResizeObserver(([M])=>i(Math.max(160,M.contentRect.width)));return F.observe(P),()=>F.disconnect()},[]);const{points:u,unit:h,warnAt:p,critAt:f,label:g,top:y,restsAtZero:w}=e,S=w?Tq:Pu,{now:b,peak:_}=Mq(u),k=h==="C"?"°C":h,E=g==="Throttling"?Oq(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 F=s-vt.l-vt.r;return vt.l+(j>0?F*(P-u[0].t)/j:F/2)},O=P=>{if(u.length<2)return;const F=P.currentTarget.getBoundingClientRect(),M=(P.clientX-F.left-vt.l)/Math.max(1,F.width-vt.l-vt.r),A=u[0].t+j*Math.max(0,Math.min(1,M));let q=0;for(let W=1;W<u.length;W++)Math.abs(u[W].t-A)<Math.abs(u[q].t-A)&&(q=W);l(q)};return d.jsxs("section",{className:"hist-series","aria-label":`${g} history`,children:[d.jsxs("div",{className:"hist-head",children:[d.jsx("span",{className:"hist-label",children:g}),d.jsxs("span",{className:"hist-stats",children:[b!=null&&d.jsxs(d.Fragment,{children:[d.jsx("b",{children:b}),d.jsxs("span",{children:[k," now"]})]}),_!=null&&d.jsxs(d.Fragment,{children:[d.jsx("b",{className:Iq(_,p,f),children:_}),d.jsxs("span",{children:[k," peak"]})]})]})]}),d.jsx("div",{className:"hist-plot",ref:n,children:d.jsxs("svg",{className:"hist-chart",width:"100%",height:S,viewBox:`0 0 ${s} ${S}`,preserveAspectRatio:"none",role:"img","aria-label":b==null?`${g}: nothing measured yet`:`${g}: ${b}${k} now, peak ${_}${k}, over ${CT(u[0].t,u[u.length-1].t)}`,onPointerMove:O,onPointerLeave:()=>l(null),children:[[["warn",p],["hot",f]].map(([P,F])=>F==null||F>y?null:d.jsxs("g",{children:[d.jsx("line",{className:`hist-rule ${P}`,x1:vt.l,x2:s-vt.r,y1:mo(F,y,S),y2:mo(F,y,S)}),d.jsx("text",{className:`hist-rule-tag ${P}`,x:2,y:mo(F,y,S)+3,children:F})]},P)),d.jsx("line",{className:"hist-floor",x1:vt.l,x2:s-vt.r,y1:S-vt.b,y2:S-vt.b}),d.jsx("path",{className:"hist-area",d:Aq(u,s,t,y,S)}),d.jsx("path",{className:"hist-line",d:Rq(u,s,t,y,S)}),u.length===1&&d.jsx("circle",{className:"hist-dot",cx:I(u[0].t),cy:mo(u[0].v,y,S),r:3}),C&&d.jsxs("g",{children:[d.jsx("line",{className:"hist-cross",x1:I(C.t),x2:I(C.t),y1:vt.t,y2:S-vt.b}),d.jsx("circle",{className:"hist-dot",cx:I(C.t),cy:mo(C.v,y,S),r:3})]})]})}),d.jsx("div",{className:"hist-axis",children:C?d.jsxs("span",{className:"hist-at",children:[el(C.t)," — ",d.jsx("b",{children:C.v}),k]}):d.jsxs(d.Fragment,{children:[d.jsx("span",{children:u.length?el(u[0].t):""}),d.jsx("span",{children:u.length?el(u[u.length-1].t):""})]})}),E&&d.jsx("div",{className:"hist-note",children:E})]})}function Lq({procs:e,total:t,onClose:n}){const s=kn(n),[i,a]=N.useState(jT),l=By(e,i);return ow.createPortal(d.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:d.jsxs("div",{ref:s,className:"modal pl-modal",onClick:u=>u.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"pl-modal-title",children:[d.jsxs("div",{className:"modal-head",children:[d.jsx("span",{className:"modal-title",id:"pl-modal-title",children:"Busiest processes"}),d.jsxs("span",{className:"pl-count",children:[l.length," of ",t," running"]}),d.jsx("button",{type:"button",className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),d.jsx("div",{className:"pl-body",children:l.length===0?d.jsx("p",{className:"pl-empty",children:"Could not read the process list on this platform."}):d.jsxs("table",{className:"sd-procs pl-table",children:[d.jsx("thead",{children:d.jsxs("tr",{children:[d.jsx(Pi,{col:"cpu",label:"cpu",sort:i,onSort:a}),d.jsx(Pi,{col:"mem",label:"mem",sort:i,onSort:a}),d.jsx("th",{scope:"col",className:"pl-pid-h",children:"pid"}),d.jsx(Pi,{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 qq=3e3,Dq=4e3,Yf=20,Ha=36,Ni=8,Fq=8,jT={key:"cpu",dir:"desc",rank:"cpu"};function zq(e,t){return e.key===t?{...e,dir:e.dir==="asc"?"desc":"asc"}:{key:t,dir:t==="name"?"asc":"desc",rank:t==="name"?e.rank:t}}function By(e,t){const n=t.dir==="asc"?1:-1,s=(i,a)=>{if(t.key==="name")return n*i.name.localeCompare(a.name,void 0,{sensitivity:"base"});const l=t.key==="cpu"?i.cpu:i.mem,u=t.key==="cpu"?a.cpu:a.mem;return l==null||u==null?l==null?u==null?0:1:-1:n*(l-u)};return[...e].sort((i,a)=>s(i,a)||(a.cpu??-1)-(i.cpu??-1)||a.mem-i.mem||i.pid-a.pid)}function Bq(e,t,n=Fq){const s=By(e,{key:t.rank,dir:"desc",rank:t.rank});return By(s.slice(0,n),t)}function Uq(e,t){return e.key!==t?"none":e.dir==="asc"?"ascending":"descending"}function Wq(e,t,n){return e>=n?"hot":e>=t?"warn":"calm"}function Hq(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}% ${Gq(t.lastMs,n)}`:"running at full speed, and never held back"}}function Gq(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 TT="agent-dag.systemPanelOpen";function Vq(){return Ou(TT)==="1"}function Yq(e){if(!(typeof window>"u"))try{window.localStorage.setItem(TT,e?"1":"0")}catch{}}function go(e){return e>=1024**3?`${(e/1024**3).toFixed(1)} GB`:e>=1024**2?`${Math.round(e/1024**2)} MB`:`${Math.round(e/1024)} KB`}function Kq(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 Xq(){const[e,t]=N.useState(null),n=N.useRef(null);return N.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,qq))},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 Qq(e){const[t,n]=N.useState(null);return N.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,Dq);return()=>{s=!1,window.clearInterval(a)}},[e]),t}function Zq({usageOpen:e=!1}){const t=Xq(),[n,s]=N.useState(Vq);N.useEffect(()=>{Yq(n)},[n]);const i=N.useRef(null),a=N.useRef(null);if(N.useEffect(()=>{if(n)return Oi.push(()=>{var k,E;const _=((k=a.current)==null?void 0:k.contains(document.activeElement))??!1;s(!1),_&&((E=i.current)==null||E.focus())},dT)},[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:Ha,height:Ni,viewBox:`0 0 ${Ha} ${Ni}`}),d.jsx("span",{className:"sm-ram"})]})})});const{cpu:l,cpuHistory:u,cores:h,memory:p,loadavg:f}=t,g=p.usedPct>=90,y=u.slice(-Yf),w=Yf-y.length,S=Ha/Yf,b=[`CPU ${l.toFixed(0)}% of ${h} cores`,f?`load ${f[0]} · ${f[1]} · ${f[2]} (1m · 5m · 15m)`:null,`Memory ${go(p.total-p.available)} of ${go(p.total)} used`,"","Click for detail. This machine, not this session."].filter(_=>_!==null).join(`
77
+ `);return d.jsxs("span",{className:"sysmeter-wrap",children:[d.jsxs("button",{type:"button",ref:i,className:"sysmeter",title:b,"aria-label":"Toggle machine detail","aria-expanded":n,"aria-controls":n?"system-panel":void 0,onClick:()=>s(_=>!_),children:[d.jsxs("span",{className:"sm-box","aria-hidden":!0,children:[d.jsxs("span",{className:"sm-graphic",children:[d.jsx("svg",{className:"sm-spark",width:Ha,height:Ni,viewBox:`0 0 ${Ha} ${Ni}`,children:y.map((_,k)=>{const E=w+k,C=Math.max(1,_/100*Ni),j=.32+.68*((k+1)/y.length);return d.jsx("rect",{x:E*S,y:Ni-C,width:Math.max(.8,S-.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(Jq,{sys:t,usageOpen:e,panelRef:a,onClose:()=>{var _;s(!1),(_=i.current)==null||_.focus()}})]})}function Jq({sys:e,usageOpen:t,panelRef:n,onClose:s}){const i=Qq(!0),{memory:a,swap:l,perCore:u,loadavg:h,cores:p,uptimeSec:f,platform:g,thermal:y}=e,w=a?a.total-a.available:0,S=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 ",Kq(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(lu,{group:"cores",title:"Core history",action:"Show core history",label:"Cores",children:d.jsx("div",{className:"sd-cores",style:{"--n":u.length},children:u.map((_,k)=>d.jsx("span",{className:"sd-core",title:`core ${k+1}: ${_}%`,children:d.jsx("span",{className:"sd-core-fill",style:{transform:`scaleY(${Math.max(2,_)/100})`}})},k))})})}),d.jsx("div",{className:"sd-section",role:"group","aria-label":"Memory",children:d.jsxs(lu,{group:"memory",title:"Memory history",action:"Show memory history",label:"Memory",children:[a&&d.jsx(bu,{label:"Physical",value:d.jsxs(d.Fragment,{children:[d.jsx("b",{children:go(w)})," of ",go(a.total)]}),pct:a.usedPct,tone:a.usedPct>=90?"warn":"calm",note:`${go(a.available)} available`}),l&&l.total>0&&d.jsx(bu,{label:S,value:d.jsxs(d.Fragment,{children:[d.jsx("b",{children:go(l.used)})," of ",go(l.total)]}),pct:b,tone:b>=90?"warn":"calm",note:b>=50?"paging to disk":void 0})]})}),h&&d.jsx("div",{className:"sd-section",role:"group","aria-label":"Load average",children:d.jsxs(lu,{group:"load",title:"Load history",action:"Show load history",label:"Load average",children:[d.jsx("div",{className:"sd-load",children:h.map((_,k)=>d.jsxs("span",{className:`sd-load-item${_>p?" over":""}`,children:[d.jsx("b",{children:_.toFixed(2)}),d.jsx("span",{children:["1m","5m","15m"][k]})]},k))}),d.jsx("div",{className:"sd-note",children:h[0]>p?`${(h[0]/p).toFixed(1)}× more work queued than cores to run it`:`within ${p} cores`})]})}),d.jsx(e4,{thermal:y}),d.jsx(t4,{read:i})]})}function lu({group:e,title:t,action:n,label:s,children:i}){const[a,l]=N.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(Pq,{group:e,title:t,onClose:()=>l(!1)})]})}function e4({thermal:e}){if(!e)return null;const t=e.throttle?Hq(e.throttle.speedLimit,e.heldBack):null;return d.jsx("div",{className:"sd-section",role:"group","aria-label":"Thermal",children:d.jsxs(lu,{group:"thermal",title:"Thermal history",action:"Show thermal history",label:"Thermal",children:[e.celsius.map(n=>d.jsx(bu,{label:n.label,value:d.jsxs(d.Fragment,{children:[d.jsx("b",{children:n.celsius})," °C"]}),pct:n.celsius,tone:Wq(n.celsius,n.warnAt,n.critAt)},n.label)),t&&d.jsx(bu,{label:"Throttling",value:t.value,pct:t.pct,tone:t.tone,note:t.note})]})})}function t4({read:e}){const[t,n]=N.useState(jT),[s,i]=N.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(Lq,{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(Pi,{col:"cpu",label:"cpu",sort:t,onSort:n}),d.jsx(Pi,{col:"mem",label:"mem",sort:t,onSort:n}),d.jsx(Pi,{col:"name",label:"process",sort:t,onSort:n})]})}),d.jsx("tbody",{children:Bq(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 Pi({col:e,label:t,sort:n,onSort:s}){const i=Uq(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(zq(n,e)),children:[t,d.jsx("span",{className:"sd-sort-dir","aria-hidden":!0,children:i==="none"?"":i==="ascending"?"↑":"↓"})]})})}function bu({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 C1=18,n4=1100,Ei=(e,t)=>{const n=Math.sin(e*12.9898+t*78.233)*43758.5453;return n-Math.floor(n)},r4=Array.from({length:C1},(e,t)=>{const n=-72+144*t/(C1-1)+(Ei(t,1)-.5)*9,s=(n-90)*(Math.PI/180),i=(54+32*Math.cos(n*Math.PI/180))*(.74+Ei(t,2)*.52);return{dx:Math.cos(s)*i,dy:Math.sin(s)*i,rot:(t%2?1:-1)*(100+Ei(t,3)*260),delay:Math.round(Ei(t,4)*90),dur:760+Math.round(Ei(t,5)*260),scale:.8+Ei(t,6)*.45,hue:t%4,round:t%3===0}});function j1({anchor:e}){var i;const[t,n]=N.useState(null),s=typeof window<"u"&&((i=window.matchMedia)==null?void 0:i.call(window,"(prefers-reduced-motion: reduce)").matches);return N.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),n4);return()=>window.clearTimeout(u)},[e,s]),s||!t?null:ow.createPortal(d.jsx("div",{className:"confetti",style:{left:`${t.x}px`,top:`${t.y}px`},"aria-hidden":!0,children:r4.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 RT=new Set(["awaiting_url","awaiting_code","registering"]);function s4(e){return e!=null&&RT.has(e)}function AT(e){return e!=null&&e!=="done"&&!RT.has(e)}const o4="the sign-in ended before it finished — the deck restarted, or it was cancelled in another tab",i4="the sign-in did not complete";function a4({state:e,serverError:t,localError:n}){const s=e==="idle";return{title:s?"Sign-in ended":"Sign-in failed",message:n||t||(s?o4:i4)}}const l4="done";function c4(){let e=!1;return{shouldAnnounce(t){return t!==l4?(e=!1,!1):e?!1:(e=!0,!0)}}}function Ew(e,t){return t&&Object.hasOwn(e,t)?e[t]:void 0}const u4={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 ${Ft}`,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"},d4={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"},f4=`claude-swap could not read the login keychain — start ${Ft} from a Terminal window rather than a background service`;function Uy(e,t){if((e==null?void 0:e.reason)!=="no_cswap"&&/keychain/i.test(zi(e)))return f4;const n=Ew(d4,e==null?void 0:e.reason);return n||(e==null?void 0:e.reason)||t}function zi(e){return((e==null?void 0:e.output)||(e==null?void 0:e.detail)||(e==null?void 0:e.error)||"").trim()}const h4={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"},p4="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 m4(e){return/\bnpx\b/i.test(e)&&/(command not found|not found|not recognized|ENOENT)/i.test(e)}const g4="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",v4="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",y4=e=>/\b(?:ERR_)?MODULE_NOT_FOUND\b|cannot find (?:module|package)/i.test(e),w4=/node_modules[\\/]npm[\\/]bin[\\/]|\bnpm-prefix\.js\b|\bnp[mx][-.][\w.-]*cli\.js\b/i,x4=/[\\/]_npx[\\/]/i,b4=`the copy of ccusage ${Ft} installed for itself`;function _4(e){const t=String((e==null?void 0:e.install)??"").replace(/\s+/g," ").trim();return t.length>240?`${t.slice(0,239)}…`:t}function k4(e,t){const n=S4(e,t),s=_4(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 ${Ga(n)}`:`there is no managed copy of ccusage on this machine, and the npx fallback failed: ${Ga(n)}`;case"managed":return`${b4} failed to run: ${Ga(n)}`;case"path":return e.bin?`the ccusage this deck found at ${e.bin} failed to run: ${Ga(n)}`:`the ccusage this deck found on your PATH failed to run: ${Ga(n)}`;default:return n}}const Ga=e=>/^[A-Z][a-z]/.test(e)?e[0].toLowerCase()+e.slice(1):e;function S4(e,t){const n=zi(e);if(y4(n)){if(x4.test(n))return v4;if(w4.test(n))return g4}if(m4(n))return p4;const s=Ew(h4,e==null?void 0:e.reason);return s||(e==null?void 0:e.reason)||t}function Ri(e,t){if(e!=null&&e.detail)return e.detail;if(e!=null&&e.error&&AT(e.state))return e.error;const n=Ew(u4,e==null?void 0:e.reason);return n||(e!=null&&e.error?e.error:(e==null?void 0:e.reason)||t)}function N4(e,t,n){if(n<=0||bw(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 MT(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 E4(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 C4(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 j4(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 T4(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 R4=1500,Kc=[{id:"login",label:"Sign in"},{id:"paste",label:"Paste a share"}],T1="aa-panel",R1=e=>`aa-tab-${e}`;async function Va(e){return(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json().catch(()=>null)}const Wy=ue.forwardRef((e,t)=>d.jsxs("svg",{className:"aa-mark",viewBox:"0 0 44 44","aria-hidden":!0,ref:t,children:[d.jsx("circle",{className:"aa-mark-ring",cx:"22",cy:"22",r:"20"}),d.jsx("path",{className:"aa-mark-tick",d:"M13.5 22.5 L19.5 28.5 L31 17"})]}));Wy.displayName="SuccessMark";function A4({onClose:e,onChanged:t}){const[n,s]=N.useState("login"),[i,a]=N.useState(null),[l,u]=N.useState(""),[h,p]=N.useState(""),[f,g]=N.useState(!1),[y,w]=N.useState(null),[S,b]=N.useState(null),[_,k]=N.useState(null),[E,C]=N.useState(null),j=N.useRef(""),I=N.useRef(!1),O=N.useRef(!1),P=N.useRef(null),F=N.useRef(null),M=N.useRef(null),A=N.useRef(null),q=N.useRef([]),W=N.useRef(!1),V=N.useCallback(()=>{I.current&&Va({action:"login-cancel"}).catch(()=>{}),e()},[e]),T=kn(V,{focusRef:M}),Q=N.useCallback(async()=>{if(!ir(O.current))return;O.current=!0,g(!0),w(null),I.current=!0;const L=await Va({action:"login"}).catch(()=>null);if(O.current=!1,g(!1),!(L!=null&&L.ok)){w(Ri(L,"could not start the sign-in"));return}a(L)},[]);N.useEffect(()=>{if(!s4(i==null?void 0:i.state))return;const L=window.setInterval(async()=>{try{const Y=await fetch("/api/claude-accounts/login");Y.ok&&a(await Y.json())}catch{}},R4);return()=>window.clearInterval(L)},[i]);const U=N.useRef(t);U.current=t;const ne=N.useState(c4)[0];N.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)&&U.current()},[i==null?void 0:i.state,ne]),N.useEffect(()=>{var L;n==="paste"&&!W.current&&((L=F.current)==null||L.focus()),W.current=!1},[n]);const X=N.useCallback(L=>{var re;const Y=N4(L,Kc.findIndex(he=>he.id===n),Kc.length);Y.kind!=="pass"&&(L.preventDefault(),W.current=!0,s(Kc[Y.index].id),(re=q.current[Y.index])==null||re.focus())},[n]),H=N.useCallback(async()=>{var Y;if(!ir(O.current))return;O.current=!0,g(!0),w(null);const L=await Va({action:"login-code",code:l}).catch(()=>null);if(O.current=!1,g(!1),!(L!=null&&L.ok)){w(Ri(L,"the code was not accepted")),L!=null&&L.state&&a(L),(Y=P.current)==null||Y.select();return}u(""),a(L)},[l,i]),J=N.useCallback(async()=>{if(!ir(O.current))return;O.current=!0,g(!0),w(null);const L=await Va({action:"import",blob:h}).catch(()=>null);if(O.current=!1,g(!1),!(L!=null&&L.ok)){w(Ri(L,"the import failed"));return}j.current=h,p(""),C(null),b(L.results??[]),t()},[h,t]),$=N.useCallback(async L=>{const Y=`${L.email}|${L.org??""}`;if(!ir(O.current)||!j.current)return;O.current=!0,g(!0),k(Y),C(null);const re=await Va({action:"import",blob:j.current,force:!0,only:{email:L.email,org:L.org??""}}).catch(()=>null);if(O.current=!1,g(!1),k(null),!(re!=null&&re.ok)){C({key:Y,text:Ri(re,"that account could not be updated")});return}const he=(re.results??[])[0];he&&b(pe=>pe&&pe.map(we=>`${we.email}|${we.org??""}`===Y?he:we)),t()},[t]),G=(i==null?void 0:i.state)==="done"?i.account:null,Z=AT(i==null?void 0:i.state)||!!(y&&I.current&&!f),D=a4({state:i==null?void 0:i.state,serverError:i==null?void 0:i.error,localError:y});return d.jsx("div",{className:"modal-backdrop",onClick:V,role:"presentation",children:d.jsxs("div",{ref:T,className:"modal aa-modal",onClick:L=>L.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Add a Claude account",children:[d.jsxs("header",{className:"modal-head",children:[d.jsx("div",{className:"modal-title",children:d.jsx("span",{className:"aa-tabs",role:"tablist","aria-label":"How to add the account",onKeyDown:X,children:Kc.map((L,Y)=>d.jsx("button",{type:"button",role:"tab",id:R1(L.id),ref:re=>{q.current[Y]=re},"aria-selected":n===L.id,"aria-controls":T1,tabIndex:n===L.id?0:-1,className:`aa-tab${n===L.id?" on":""}`,onClick:()=>{W.current=!1,s(L.id)},children:L.label},L.id))})}),d.jsx("div",{className:"modal-actions",children:d.jsx("button",{type:"button",className:"glyph-btn",onClick:V,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),d.jsx("section",{className:"modal-body aa-body",id:T1,role:"tabpanel","aria-labelledby":R1(n),children:n==="login"?G?d.jsxs("div",{className:"aa-done",children:[d.jsx(Wy,{ref:A}),d.jsx(j1,{anchor:A}),d.jsx("h4",{children:G.added?`Account ${G.num} added`:"Credentials refreshed"}),d.jsxs("p",{className:"aa-note",children:[d.jsx("strong",{children:G.email}),G.added?" is in the rotation. The account you were using is still active.":" was already managed, so its stored credentials were replaced."]}),d.jsx("button",{type:"button",className:"btn primary",onClick:e,children:"Done"})]}):(i==null?void 0:i.state)==="awaiting_code"||(i==null?void 0:i.state)==="registering"?d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"aa-step",children:[d.jsx("h4",{children:"1 · Approve in the browser"}),d.jsx("p",{className:"aa-note",children:"A tab should have opened. If not, use this link:"}),d.jsx("a",{className:"aa-link",href:i.url??"#",target:"_blank",rel:"noreferrer noopener",children:i.url})]}),d.jsxs("div",{className:"aa-step",children:[d.jsx("h4",{children:"2 · Paste a code, if the page shows one"}),d.jsx("p",{className:"aa-note",children:"It usually finishes on its own — if the page says you are all set, there is nothing to do here."}),d.jsxs("div",{className:"aa-field",children:[d.jsx("input",{ref:P,type:"text",value:l,onChange:L=>u(L.target.value),onKeyDown:L=>{L.key==="Enter"&&l.trim()&&!f&&H()},placeholder:"paste the code here",spellCheck:!1,autoComplete:"off","aria-label":"Sign-in code",disabled:i.state==="registering"}),d.jsx("button",{type:"button",className:"btn primary",...or(f,!l.trim()||i.state==="registering"),onClick:H,children:i.state==="registering"?"registering…":"Continue"})]}),(y||i.error)&&d.jsx("p",{className:"aa-err",children:y??i.error}),d.jsx("p",{className:"aa-note",children:"The code goes straight to the claude CLI on this machine. It is never stored or sent anywhere else."})]})]}):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"})})]}):S?(()=>{const L=S.filter(Y=>Y.state==="imported").length;return d.jsxs("div",{className:"aa-done",children:[d.jsx(Wy,{ref:A}),L>0&&d.jsx(j1,{anchor:A}),d.jsx("h4",{children:T4(S)}),S.length>0&&d.jsx("ul",{className:"aa-results",children:S.map(Y=>{const re=`${Y.email}|${Y.org??""}`;return d.jsxs("li",{className:`aa-result ${Y.state}`,children:[d.jsx("span",{className:"aa-result-who",children:Y.email||(Y.num?`slot ${Y.num}`:"an account")}),d.jsx("span",{className:"aa-result-what",children:j4(Y.state)}),Y.state==="present"&&d.jsx("button",{type:"button",className:"aa-result-fix","aria-busy":_===re,title:`Overwrite the stored login for ${Y.email} with the one in this share. Do this when that account has stopped working here; if it works, leave it.`,onClick:()=>$(Y),children:_===re?"updating…":"update anyway"}),(E==null?void 0:E.key)===re&&d.jsx("span",{className:"aa-result-err",children:E.text})]},re)})}),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:F,type:"text",value:h,onChange:L=>p(L.target.value),onKeyDown:L=>{L.key==="Enter"&&h.trim()&&!f&&J()},placeholder:"ccdeck2:…",spellCheck:!1,autoComplete:"off","aria-label":"Shared account"}),d.jsx("button",{type:"button",className:"btn primary",...or(f,!h.trim()),onClick:J,children:f?"importing…":"Import"})]}),y&&d.jsx("p",{className:"aa-err",children:y}),d.jsxs("p",{className:"aa-note",children:["Use ",d.jsx("strong",{children:"share"})," on one account in the other deck, or ",d.jsx("strong",{children:"↗"})," above its list to send several at once. A share carries a live login for every account in it and expires ten minutes after it is made."]})]})})]})})}async function M4(e){return(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json().catch(()=>null)}const I4=1800;function O4({accounts:e,onClose:t,copyText:n}){const[s,i]=N.useState([]),[a,l]=N.useState(null),[u,h]=N.useState(!1),[p,f]=N.useState(null),[g,y]=N.useState(!1),[w,S]=N.useState(()=>Math.floor(Date.now()/1e3)),b=N.useRef(null),_=N.useRef(!1),k=kn(t,{focusRef:b});N.useEffect(()=>{if(!a)return;S(Math.floor(Date.now()/1e3));const A=window.setInterval(()=>S(Math.floor(Date.now()/1e3)),1e3);return()=>window.clearInterval(A)},[a]);const E=E4(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(W=>W!==A):[...q,A]),O=N.useCallback(async()=>{if(!ir(_.current)||!C.length)return;_.current=!0,h(!0),f(null),y(!1);const A=await M4({action:"share",accounts:C}).catch(()=>null);if(_.current=!1,h(!1),!(A!=null&&A.ok)){f(Ri(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?MT(a.expiresAt,w):null,F=(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:k,className:"modal sa-modal",onClick:A=>A.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Share accounts with another deck",children:[d.jsxs("header",{className:"modal-head",children:[d.jsx("div",{className:"modal-title",children:d.jsx("h3",{children:"Share accounts"})}),d.jsx("div",{className:"modal-actions",children:d.jsx("button",{type:"button",className:"glyph-btn",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),d.jsx("section",{className:"modal-body sa-body",children:a?d.jsxs("div",{className:"sa-step",children:[d.jsx("h4",{children:F?"This share has expired":M===1?"1 account, ready to paste":`${M} accounts, ready to paste`}),d.jsx("code",{className:`ap-share-blob${F?" sa-dead":""}`,children:a.blob}),d.jsxs("div",{className:"ap-share-foot",children:[d.jsx("button",{type:"button",className:"ap-manage-btn",ref:b,onClick:async()=>{if(F){l(null),O();return}await n(a.blob)&&(y(!0),window.setTimeout(()=>y(!1),I4))},children:F?"make a new share":g?"copied":`copy ${M===1?"the share":"all "+M}`}),d.jsxs("span",{className:"ap-manage-hint",title:"This text is the sign-in for every account in it. It is base64 of plain JSON — the expiry inside it is not signed, so anyone holding a copy can change it, and the logins themselves are in there in the clear either way. The countdown only says how long another deck's import dialog will still accept it. If a copy escapes, sign those accounts out and back in.",children:[d.jsx("span",{className:"ap-share-warn",children:M===1?"this is the password":`this is ${M} passwords`})," · ",d.jsx("span",{className:`ap-share-expiry ${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 W;const q=!!(A.email&&((W=A.detail)!=null&&W.includes(A.email)));return d.jsxs("li",{children:[!q&&d.jsx("span",{className:"sa-who",children:A.email||`account ${A.num}`}),d.jsx("span",{className:"sa-why",children:A.detail||"could not be exported"})]},`${A.num}-${A.email}`)})})]}),d.jsx("p",{className:"sa-note",children:F?d.jsx(d.Fragment,{children:"Another deck will refuse this text now. Make a new one — the same accounts are still picked."}):d.jsxs(d.Fragment,{children:["Paste it into the other deck with ",d.jsx("strong",{children:"+"})," → ",d.jsx("strong",{children:"Paste a share"}),". Accounts it already holds are left exactly as they are."]})}),d.jsxs("div",{className:"sa-actions",children:[d.jsx("button",{type:"button",className:"btn",onClick:()=>{l(null),y(!1)},children:"Pick again"}),d.jsx("button",{type:"button",className:"btn primary",onClick:t,children:"Done"})]})]}):e.length===0?d.jsxs("div",{className:"sa-step",children:[d.jsx("h4",{children:"Nothing to share"}),d.jsxs("p",{className:"sa-note",children:["This deck is not holding any accounts right now. Sign one in with ",d.jsx("strong",{children:"+"}),", or wait — the panel is still reading the store."]}),d.jsx("div",{className:"sa-actions",children:d.jsx("button",{type:"button",className:"btn primary",ref:b,onClick:t,children:"Close"})})]}):d.jsxs("div",{className:"sa-step",children:[d.jsxs("h4",{children:["Which accounts go to the other ",Ft,"?"]}),d.jsx("p",{className:`sa-count${C.length?"":" empty"}`,children:C4(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,...or(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 P4(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 $4(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 L4(e,t,n){return t!=null&&e.some(s=>s.slot===t)?t:n}function q4(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 D4(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 A1(e){return typeof e.id=="string"&&e.id.startsWith("scoped-")}function M1(e){const t=e.filter(u=>!A1(u)),n=e.filter(u=>A1(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 F4(e,t,n){return e<1?null:t?"fewer":n?`${n.label} ${Math.round(n.pct)}%`:`${e} more`}function z4(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 B4="\0";function Cw(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}${B4}${n}`}function U4(e,t){const n=Cw(t);return e.includes(n)?e.filter(s=>s!==n):[...e,n]}function W4(e,t){if(!Array.isArray(t))return e;const n=new Set(t.map(Cw)),s=e.filter(i=>n.has(i));return s.length===e.length?e:s}const H4=64;function G4(e,t){const n=e.trim();return{alias:n,commit:n!==(t??"").trim()}}const V4=Object.freeze({text:"couldn't reach the deck server",reload:!0});async function I1(e){return e.ok?{ok:!0,status:e.status,body:null}:{ok:!1,status:e.status,body:await e.json().catch(()=>null)}}function Y4(e){const t=e.find(s=>!s.ok);if(!t)return null;const n=zi(t.body);return{text:Uy(t.body,`the deck server answered ${t.status}`),...n?{raw:n}:{},reload:!0}}function O1(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 P1=15e3,K4=8e3,Kf=1800,X4=3e4,Q4=[70,80,85,90,95];function $1(e,t){return _T(t-Math.floor(e/1e3))}function Z4(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 J4(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 L1({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?kT(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 q1(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 eD({onClose:e}){var Ge,lt,je,He,Ke;const[t,n]=N.useState(null),[s,i]=N.useState(null),[a,l]=N.useState(null),[u,h]=N.useState(!1),[p,f]=N.useState(null),[g,y]=N.useState(()=>Math.floor(Date.now()/1e3)),w=N.useRef(null),[S,b]=N.useState(null),[_,k]=N.useState(!1),[E,C]=N.useState(""),[j,I]=N.useState(null),[O,P]=N.useState(null),[F,M]=N.useState(null),[A,q]=N.useState(!1),[W,V]=N.useState(!1),[T,Q]=N.useState(null),[U,ne]=N.useState(null),[X,H]=N.useState(null),[J,$]=N.useState(null),[G,Z]=N.useState(!1),[D,L]=N.useState([]),Y=N.useRef(null),re=N.useCallback(oe=>NT(Y.current)?(Y.current=oe,l(oe),!0):!1,[]),he=N.useCallback(()=>{Y.current=null,l(null)},[]),pe=(oe,Ie=!1)=>{const Oe=ST(a,oe);return{disabled:Oe.disabled,"aria-busy":Oe.busy||Ie}},we=N.useCallback(oe=>{window.requestAnimationFrame(()=>{var Ie;if(mq(((Ie=document.activeElement)==null?void 0:Ie.tagName)??null))for(const Oe of pq(oe)){const Te=document.querySelector(Oe);if(Te){Te.focus();return}}})},[]),Ce=N.useCallback(async(oe=!1)=>{oe&&h(!0);const Ie=new AbortController,Oe=window.setTimeout(()=>Ie.abort(),X4);try{const[Te,Xe]=await Promise.all([fetch(`/api/claude-accounts${oe?"?refresh=1":""}`,{signal:Ie.signal}),fetch("/api/cswap-auto",{signal:Ie.signal})]);if(Te.ok){const st=await Te.json();n(st),L(Ae=>W4(Ae,st.accounts))}Xe.ok&&i(await Xe.json());const Et=Y4([await I1(Te),await I1(Xe)]);f(st=>O1(st,Et))}catch{f(Te=>O1(Te,V4))}finally{window.clearTimeout(Oe),oe&&h(!1)}},[]),Ve=N.useCallback(async(oe,Ie)=>{if(!re(Ie))return null;f(null);try{const Te=await(await fetch("/api/cswap-auto",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(oe)})).json().catch(()=>null);return Te!=null&&Te.ok||f({text:Uy(Te,"command failed"),raw:zi(Te)}),Te}catch{return f({text:"server unreachable"}),null}finally{he()}},[re,he]),Be=N.useCallback(async(oe,Ie)=>{if(!re(Ie))return null;f(null);try{const Te=await(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(oe)})).json().catch(()=>null);return Te!=null&&Te.ok||f({text:Ri(Te,"command failed")}),Te}catch{return f({text:"server unreachable"}),null}finally{he()}},[re,he]);N.useEffect(()=>(Ce(!0),w.current=window.setInterval(()=>Ce(!1),P1),()=>{w.current!=null&&window.clearInterval(w.current)}),[Ce]),N.useEffect(()=>{const oe=window.setInterval(()=>y(Math.floor(Date.now()/1e3)),3e4);return()=>window.clearInterval(oe)},[]);const Le=((Ge=s==null?void 0:s.settings["autoswitch.threshold"])==null?void 0:Ge.value)??"90",ke=J??Le,ce=D4(ke,Le),be=(lt=t==null?void 0:t.accounts)==null?void 0:lt.find(oe=>oe.active),xe=((je=M1((be==null?void 0:be.lanes)??[]).peak)==null?void 0:je.pct)??null,Ye=xe!=null&&xe>=Number(Le)-15,ut=async oe=>{if(re(`switch-${oe}`)){f(null);try{const Oe=await(await fetch("/api/claude-accounts/switch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({account:oe})})).json().catch(()=>null);Oe!=null&&Oe.ok||f({text:Uy(Oe,"the switch failed"),raw:zi(Oe)}),await Ce(!0)}catch{f({text:"server unreachable"})}finally{he(),we(oe)}}},at=async(oe,Ie)=>{const{commit:Oe,alias:Te}=G4(E,Ie);if(Oe){const Xe=await Be({action:"alias",account:oe,alias:Te},`alias-${oe}`);if(await Ce(!0),!(Xe!=null&&Xe.ok))return;C(Te)}I(oe),window.setTimeout(()=>I(Xe=>Xe===oe?null:Xe),Kf)},de=async(oe,Ie)=>{const Oe=await Be({action:"move",account:oe,slot:Ie},`move-${oe}`),Te=$4({menuFor:S,shareFor:(F==null?void 0:F.num)??null},oe,Oe);if(await Ce(!0),Te){b(Te.menuFor),P(Te.confirmRemove),Te.shareFor==null&&(M(null),V(!1)),Q(Te.swapNote);const Xe=Te.swapNote;Xe&&window.setTimeout(()=>Q(Et=>Et===Xe?null:Et),K4),ne(null),we(Te.menuFor)}return Oe},_e=async(oe,Ie,Oe)=>{if(Oe.sends){const Te=await de(oe,Ie);if(!(Te!=null&&Te.ok))return}H(oe),window.setTimeout(()=>H(Te=>Te===oe?null:Te),Kf)},De=async(oe,Ie)=>{if(Ie.sends){const Oe=await Ve({action:"setting",key:"autoswitch.threshold",value:oe},"threshold");if(await Ce(!0),!(Oe!=null&&Oe.ok))return;$(null)}Z(!0),window.setTimeout(()=>Z(!1),Kf)};return d.jsxs("aside",{className:"accounts-panel",id:"accounts-panel","aria-label":"Claude accounts",children:[d.jsxs("div",{className:"ap-header",children:[d.jsx("h2",{children:"Accounts"}),d.jsxs("div",{className:"ap-header-right",children:[d.jsx("button",{type:"button",className:"glyph-btn ap-add",onClick:()=>k(!0),"aria-label":"Add an account",title:"Sign in to another Claude account, or paste one shared from another deck",children:"+"}),(((He=t==null?void 0:t.accounts)==null?void 0:He.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 ${Ft} 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:()=>Ce(!0),...pe("reload",u),"aria-label":"Reload accounts",title:"Reload from claude-swap",children:u?"…":"↻"}),d.jsx("button",{type:"button",className:"glyph-btn",onClick:e,"aria-label":"Close accounts panel",title:"Close (A)",children:"×"})]})]}),t==null?p?d.jsxs("div",{className:"ap-empty",role:"alert",children:[d.jsx("span",{title:p.raw||void 0,children:p.text}),d.jsxs("span",{className:"ap-hint",children:["No accounts have arrived, so there is nothing to show yet. The panel keeps trying every ",P1/1e3," seconds."]}),d.jsx("button",{type:"button",className:"ap-fix",disabled:u,onClick:()=>Ce(!0),children:u?"trying…":"try again"})]}):d.jsx("div",{className:"ap-empty",children:"Checking…"}):t.ok?d.jsxs(d.Fragment,{children:[(Ke=t.accounts)==null?void 0:Ke.map(oe=>{const{shown:Ie,rest:Oe,fuller:Te,peak:Xe}=M1(oe.lanes),Et=D.includes(Cw(oe)),st=F4(Oe.length,Et,Te);return d.jsxs("div",{className:`ap-account${oe.active?" active":""}`,children:[d.jsxs("div",{className:"ap-account-head",children:[d.jsx("span",{className:"ap-num",children:oe.num}),oe.alias&&d.jsx("span",{className:"ap-alias",title:oe.alias,children:oe.alias}),d.jsx("span",{className:"ap-email",title:oe.email??void 0,children:oe.email}),d.jsx("button",{type:"button",id:`ap-more-${oe.num}`,className:`ap-more${S===oe.num?" on":""}`,"aria-label":`Manage account ${oe.num}`,"aria-expanded":S===oe.num,"aria-controls":S===oe.num?`ap-manage-${oe.num}`:void 0,title:"Share, rename, move, remove",onClick:()=>{b(S===oe.num?null:oe.num),C(oe.alias??""),P(null),M(null),V(!1),Q(null),I(null),ne(null),H(null)},children:"⋯"}),oe.active&&d.jsx("span",{className:"ap-badge-active",children:"active"}),oe.disabled&&d.jsx("span",{className:"ap-badge-held",children:"held out"}),!oe.active&&!oe.disabled&&d.jsx("button",{type:"button",className:"ap-manage-btn ap-switch",...pe(`switch-${oe.num}`),onClick:()=>ut(oe.num),title:`Switch to ${oe.alias??oe.email}`,children:a===`switch-${oe.num}`?"…":"switch"})]}),d.jsx("div",{className:"ap-lanes",id:`ap-lanes-${oe.num}`,children:Ie.length?d.jsxs(d.Fragment,{children:[Ie.map(Ae=>d.jsx(L1,{lane:Ae,nowSec:g},Ae.id)),Et&&Oe.map(Ae=>d.jsx(L1,{lane:Ae,nowSec:g},Ae.id))]}):d.jsx("div",{className:"ap-hint",children:"No usage recorded yet."})}),d.jsxs("div",{className:"ap-meta",children:[oe.staleCopy&&d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"ap-stale-copy",title:"The deck can still see this account — its live usage is being read — but claude-swap's own stored copy of the login was rejected, so these numbers stopped updating. Resume re-captures the copy from the login you already have.",children:"numbers paused"}),d.jsx("button",{type:"button",className:"ap-fix",...pe("recapture"),onClick:async()=>{const Ae=await Be({action:"recapture"},"recapture");Ae!=null&&Ae.ok&&Ce(!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"})]}),oe.error&&(()=>{const Ae=J4(oe.error);return d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"ap-err",title:Ae.hint,children:Ae.text}),Ae.fixable&&d.jsx("button",{type:"button",className:"ap-fix",onClick:()=>k(!0),title:"Open the sign-in dialog. Signing in as this account replaces its stored login in place.",children:"sign in again"})]})})(),st&&d.jsx("button",{type:"button",className:"ap-lanes-more","aria-expanded":Et,"aria-controls":`ap-lanes-${oe.num}`,title:z4(oe.headroom,(Xe==null?void 0:Xe.label)??null,Oe.length,Et),onClick:()=>L(Ae=>U4(Ae,oe)),children:st}),(((s==null?void 0:s.enabled)||(s==null?void 0:s.external))&&!oe.active||oe.disabled)&&d.jsx("button",{type:"button",className:"ap-rotate",...pe(`rot-${oe.num}`),onClick:()=>Ve({action:"account",account:oe.num,enabled:oe.disabled},`rot-${oe.num}`).then(()=>Ce(!0)),title:oe.disabled?"Return this account to auto-rotation":"Hold this account out of auto-rotation",children:oe.disabled?"put back":"hold out"}),oe.fetchedAt?d.jsxs("span",{className:`ap-age${oe.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 ",$1(oe.fetchedAt,g),Z4(oe.nextAt,g)]}):d.jsx("span",{className:"ap-age ap-stale",title:"claude-swap has not read this account yet",children:"never collected"})]}),S===oe.num&&d.jsxs("div",{className:"ap-manage",id:`ap-manage-${oe.num}`,role:"group","aria-label":`Manage account ${oe.num}`,children:[d.jsxs("div",{className:"ap-manage-name",children:[d.jsx("label",{className:"vis-hidden",htmlFor:`ap-alias-${oe.num}`,children:"Alias"}),d.jsx("input",{id:`ap-alias-${oe.num}`,className:"ap-manage-input",type:"text",value:E,onChange:Ae=>C(Ae.target.value),onKeyDown:Ae=>{Ae.key==="Enter"&&at(oe.num,oe.alias)},maxLength:H4,placeholder:"e.g. work",spellCheck:!1,autoFocus:!0}),d.jsx("button",{type:"button",className:"ap-manage-btn",...pe(`alias-${oe.num}`),onClick:()=>at(oe.num,oe.alias),title:"A short name to show instead of the email",children:j===oe.num?"saved":"save"})]}),(()=>{const Ae=P4((t.accounts??[]).map(kt=>kt.num),oe.num),wt=L4(Ae,U,oe.num),dt=q4(Ae,wt,oe.num);return d.jsxs("div",{className:"ap-manage-slot",children:[d.jsx("label",{className:"vis-hidden",htmlFor:`ap-slot-${oe.num}`,children:"Slot"}),d.jsx("span",{className:"ap-field",children:d.jsx("select",{id:`ap-slot-${oe.num}`,value:String(wt),...pe(`move-${oe.num}`),onChange:kt=>ne(Number(kt.target.value)),children:Ae.map(kt=>d.jsx("option",{value:kt.slot,children:kt.label},kt.slot))})}),d.jsx("button",{type:"button",className:"ap-manage-btn",...pe(`move-${oe.num}`),title:dt.title,onClick:()=>_e(oe.num,wt,dt),children:X===oe.num?dt.done:dt.label})]})})(),d.jsxs("div",{className:"ap-manage-acts",children:[d.jsx("button",{type:"button",className:"ap-manage-btn",...pe(`share-${oe.num}`),title:`Copy this account to another ${Ft}. 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()=>{V(!1);const Ae=await Be({action:"share",account:oe.num},`share-${oe.num}`);Ae!=null&&Ae.ok&&M({num:oe.num,blob:Ae.blob,expiresAt:Ae.expiresAt})},children:"share"}),d.jsx("button",{type:"button",className:`ap-manage-btn danger${O===oe.num?" armed":""}`,...pe(`rm-${oe.num}`),title:O===oe.num?"This deletes the stored credentials for this account":"Remove this account from claude-swap",onClick:()=>{if(O!==oe.num){P(oe.num),window.setTimeout(()=>P(Ae=>Ae===oe.num?null:Ae),4e3);return}P(null),Be({action:"remove",account:oe.num},`rm-${oe.num}`).then(()=>{b(null),Ce(!0),we(null)})},children:O===oe.num?"confirm":"remove"})]}),(T==null?void 0:T.at)===oe.num&&(()=>{var dt;const Ae=(dt=t.accounts)==null?void 0:dt.find(kt=>kt.num===T.displaced),wt=(Ae==null?void 0:Ae.alias)??(Ae==null?void 0:Ae.email)??"the account that was there";return d.jsxs("span",{className:"ap-manage-hint ap-manage-swap",title:`Slot ${T.at} was taken, so the two accounts traded places: ${wt} now holds slot ${T.displaced}.`,children:["swapped with slot ",T.displaced]})})(),(F==null?void 0:F.num)===oe.num&&(()=>{const Ae=MT(F.expiresAt,g),wt=Ae.tone==="gone";return d.jsxs("div",{className:`ap-share${wt?" expired":""}`,children:[d.jsx("code",{className:"ap-share-blob",children:F.blob}),d.jsxs("div",{className:"ap-share-foot",children:[d.jsx("button",{type:"button",className:"ap-manage-btn",...pe(`share-${oe.num}`),onClick:async()=>{if(wt){V(!1);const dt=await Be({action:"share",account:oe.num},`share-${oe.num}`);dt!=null&&dt.ok&&M({num:oe.num,blob:dt.blob,expiresAt:dt.expiresAt});return}await q1(F.blob)&&(V(!0),window.setTimeout(()=>V(!1),1800))},children:wt?"make a new share":W?"copied":"copy"}),d.jsxs("span",{className:"ap-manage-hint",title:"This text is the account's password. It is base64 of plain JSON — the expiry inside it is not signed, so anyone holding a copy can change it, and the login itself is in there in the clear either way. The countdown only says how long another deck's import dialog will still accept it. If a copy escapes, sign the account out and back in.",children:[d.jsx("span",{className:"ap-share-warn",children:"this is the password"})," · ",d.jsx("span",{className:`ap-share-expiry ${Ae.tone}`,children:Ae.text})]})]})]})})()]})]},oe.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:[xe!=null&&d.jsxs("span",{className:`ap-auto-now${Ye?" near":""}`,children:[Math.round(xe),"%"]}),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:ke,...pe("threshold"),onChange:oe=>$(oe.target.value),children:Q4.map(oe=>d.jsxs("option",{value:oe,children:[oe,"%"]},oe))})}),d.jsx("button",{type:"button",className:"ap-manage-btn",...pe("threshold"),title:ce.title,onClick:()=>De(ke,ce),children:G?ce.done:ce.label}),d.jsxs("button",{type:"button",className:`ap-auto-state${s.enabled?" live":""}`,role:"switch","aria-checked":s.enabled,"aria-label":"Auto-switch",...pe("enable"),onClick:()=>Ve({action:"enable",enabled:!s.enabled},"enable").then(()=>Ce(!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 ",$1(s.lastTick.at,g)]})})]}),p&&d.jsxs("div",{className:"ap-failure",role:"alert",children:[d.jsx("span",{className:"ap-failure-text",title:p.raw||void 0,children:p.text}),d.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>f(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),d.jsx("p",{className:"ap-footnote",title:"Anthropic's usage endpoint allows roughly 28–30 requests per hour per account, shared by every tool on this machine — polling it from here would rate-limit your account. So the deck never fetches: it asks claude-swap to collect while this panel is open, at most once every three minutes, and claude-swap decides whether that touches the network at all.",children:"These numbers only update while this panel is open."})]}):d.jsx("div",{className:"ap-empty",children:t.reason==="no_cswap"?d.jsxs(d.Fragment,{children:[d.jsx("span",{children:"claude-swap isn't installed."}),d.jsx("span",{className:"ap-hint",children:"This panel reads the account store claude-swap keeps — without it there is nothing to show. It is a separate tool, published on PyPI, so it does not come with this package."}),t.hint&&d.jsx("code",{className:"ap-cmd",children:t.hint}),d.jsxs("span",{className:"ap-hint",children:["Then add an account with the ",d.jsx("strong",{children:"+"})," button above."]})]}):t.reason==="no_accounts"?d.jsxs(d.Fragment,{children:[d.jsx("span",{children:"No accounts added yet."}),d.jsxs("span",{className:"ap-hint",children:["claude-swap is installed but has nothing in its store. Use the ",d.jsx("strong",{children:"+"})," above to sign one in, or to paste one shared from another deck."]})]}):d.jsxs(d.Fragment,{children:[d.jsx("span",{children:"Couldn't read the account store."}),d.jsxs("span",{className:"ap-hint",children:["claude-swap is installed, but its store could not be read",t.reason?` (${t.reason})`:"","."]})]})}),_&&d.jsx(A4,{onClose:()=>k(!1),onChanged:()=>Ce(!0)}),A&&d.jsx(O4,{accounts:((t==null?void 0:t.accounts)??[]).map(oe=>({num:oe.num,email:oe.email,alias:oe.alias,org:oe.org})),onClose:()=>q(!1),copyText:q1})]})}const tD=3e4;function nD({bundle:e,running:t,lastTried:n}){return!t||e===t?!1:n!==t}function rD({bundle:e,running:t,pending:n,lastTried:s}){return t?nD({bundle:e,running:t,lastTried:s})?"reload":n==null||n&&n!==t?"wait":"confirm":"wait"}function sD(e){return!e||e.state!=="failed"?null:`${typeof e.at=="number"?e.at:0}:${e.error??""}`}function oD({asked:e,reported:t}){return t?t!==e:!1}function iD(e){const t=e.thresholdMs??tD;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 aD(e,t){return e==="confirmation"?t.confirmOpen?"clear":"ignore":t.modalOpen||t.confirmOpen?"ignore":"confirm"}function lD(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 uD(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 dD({agentCount:e,onConfirm:t,onCancel:n}){const s=N.useRef(null),i=kn(n,{focusRef:s,layer:IL}),[a,l]=N.useState(null);N.useEffect(()=>{let p=!1;return fetch("/api/clear").then(f=>f.ok?f.json():null).then(f=>{p||l(lD(f))}).catch(()=>{}),()=>{p=!0}},[]);const{note:u,confirm:h}=uD(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 fD="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.",hD=[{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 pD({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:fD}),d.jsx("div",{className:"shortcuts",children:hD.map(n=>d.jsxs(N.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 mD=["done","needs-input"],gD=[{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}]}],vD=[{id:"two",label:"Two notes",notes:[{at:0,hz:440,ms:90},{at:.085,hz:740,ms:150}]},{id:"arc",label:"Ascent",notes:[{at:0,hz:440,ms:80},{at:.07,hz:659,ms:80},{at:.14,hz:988,ms:160}]},{id:"tap",label:"Double tap",notes:[{at:0,hz:440,ms:55},{at:.055,hz:440,ms:55},{at:.165,hz:740,ms:150}]},{id:"chord",label:"Chord",trim:.7,notes:[{at:0,hz:440,ms:110},{at:.1,hz:740,ms:170},{at:.1,hz:988,ms:170}]},{id:"bell",label:"Bell",type:"triangle",notes:[{at:0,hz:440,ms:120},{at:.11,hz:740,ms:260}]},{id:"blip",label:"Blip",type:"square",trim:.7,notes:[{at:0,hz:440,ms:55},{at:.06,hz:740,ms:90}]}],jw={done:gD,"needs-input":vD},Bi="two";function Hy(e,t){const n=jw[e];return n.find(s=>s.id===t)??n.find(s=>s.id===Bi)??n[0]}function IT(e,t){return jw[e].some(s=>s.id===t)?t:Bi}Hy("done",Bi).notes,Hy("needs-input",Bi).notes;const D1=.04,yD=.24,OT=0,Tw=100,Gy=5,cl=50;function ul(e){if(!Number.isFinite(e))return cl;const t=Math.round(e/Gy)*Gy;return Math.min(Tw,Math.max(OT,t))}function wD(e){if(e==null)return cl;const t=e.trim();return/^-?\d+(\.\d+)?$/.test(t)?ul(Number(t)):cl}function xD(e){const t=ul(e),n=D1+(yD-D1)*(t/Tw);return Math.round(n*1e4)/1e4}function bD(e,t){const n=t.trim,s=typeof n=="number"&&Number.isFinite(n)&&n>0&&n<=1?n:1;return Math.round(xD(e)*s*1e4)/1e4}const _D=160,kD="agent-dag.soundLevel.done",SD="agent-dag.soundLevel.needs-input",ND="agent-dag.soundFigure.done",ED="agent-dag.soundFigure.needs-input",PT={done:kD,"needs-input":SD},$T={done:ND,"needs-input":ED},Vy={done:{level:cl,figure:Bi},"needs-input":{level:cl,figure:Bi}};function CD(e){const t=n=>({level:wD(e(PT[n])),figure:IT(n,e($T[n]))});return{done:t("done"),"needs-input":t("needs-input")}}const jD={Stop:"done",Notification:"needs-input"};function TD(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:jD[n]??null}function RD(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 S;if(!p&&!e.enabled()||!n||n.state!=="running")return!1;const f=(((S=e.prefs)==null?void 0:S.call(e))??Vy)[h]??Vy[h],g=Hy(h,f.figure),y=bD(f.level,g),w=n.currentTime;for(const b of g.notes){const _=n.createOscillator(),k=n.createGain();_.type=g.type??"sine",_.frequency.value=b.hz;const E=w+b.at,C=E+b.ms/1e3;k.gain.setValueAtTime(1e-4,E),k.gain.exponentialRampToValueAtTime(y,E+.012),k.gain.exponentialRampToValueAtTime(1e-4,C),_.connect(k).connect(n.destination),_.start(E),_.stop(C+.02)}return!0}return{unlock:l,play:u,state:i,get context(){return n}}}const F1={done:"Turn finished","needs-input":"Claude is asking"},AD={done:"Every finished turn, on both CLIs.","needs-input":"Claude Code only — Codex has no such event."};function MD({onClose:e,soundOn:t,onToggleSound:n,prefs:s,onLevel:i,onFigure:a,onPreview:l,openerRef:u}){const h=kn(e),p=N.useRef(e);return p.current=e,N.useEffect(()=>{const f=g=>{var w,S;const y=g.target;y&&((w=h.current)!=null&&w.contains(y)||(S=u.current)!=null&&S.contains(y)||p.current())};return window.addEventListener("pointerdown",f,!0),()=>window.removeEventListener("pointerdown",f,!0)},[h,u]),d.jsxs("div",{ref:h,id:"sound-menu",className:"sound-menu",role:"dialog","aria-label":"Sound settings",children:[d.jsxs("button",{type:"button",className:"btn sm-switch",onClick:n,"aria-pressed":t,children:[d.jsx("span",{className:"sm-switch-label",children:"Sound"}),d.jsx("span",{className:"sm-switch-state",children:t?"on":"off"})]}),mD.map(f=>{const g=s[f],y=`sm-level-${f}`,w=`sm-figure-${f}`;return d.jsxs("section",{className:"sm-tone","aria-labelledby":`sm-name-${f}`,children:[d.jsxs("div",{className:"sm-tone-head",children:[d.jsx("h3",{className:"sm-tone-name",id:`sm-name-${f}`,children:F1[f]}),d.jsxs("button",{type:"button",className:"btn sm-hear",onClick:()=>l(f),"aria-label":`Hear the ${F1[f].toLowerCase()} tone`,children:[d.jsx("svg",{width:"11",height:"11",viewBox:"0 0 12 12",fill:"currentColor","aria-hidden":!0,children:d.jsx("path",{d:"M3 1.6v8.8l7-4.4z"})}),"Hear it"]})]}),d.jsxs("div",{className:"sm-row",children:[d.jsx("label",{htmlFor:y,children:"Volume"}),d.jsx("input",{id:y,type:"range",min:OT,max:Tw,step:Gy,value:g.level,onChange:S=>i(f,Number(S.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:S=>a(f,S.target.value),children:jw[f].map(S=>d.jsx("option",{value:S.id,children:S.label},S.id))})]}),d.jsx("p",{className:"sm-note",children:AD[f]})]},f)}),d.jsx("p",{className:"sm-foot",children:"M turns the sound on and off from anywhere."})]})}const ID={"//":["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.6.0":[{title:"✂️ The two figures at the end of the top bar are gone",body:`The bar used to end with a token count and a dollar figure. Both were sums over what is on the canvas at that moment, and the canvas drops finished sessions a couple of minutes after they end — so both numbers fell on their own, with nothing on screen to explain the fall. They carried the word "board" and a three-line tooltip for exactly that reason.
78
+
79
+ The usage panel answers the same question without the apology: it reads the logs on disk, it covers sessions this deck never watched, and it does not forget. Press U for the panel, or H for the full history.
80
+
81
+ What is left in the bar is what is true right now — whether the stream is alive, and what your machine is doing.`}],"3.5.0":[{title:"⚡ The figures move when the work happens",body:`Reading your usage off the logs is not free — measured here, one reading is 7.8 seconds of CPU, because ccusage walks every transcript on the machine whatever period you asked for. Once a minute is affordable; once every ten seconds would be three quarters of a core, permanently, for numbers that move slowly.
82
+
83
+ So the reading stays on a minute and the deck fills the gap with what it already knows. Every hook event carries its session's running total, so the panel adds whatever has been spent since the last reading and counts up to it. The headline now moves when a turn finishes rather than on the clock, and it costs nothing extra.
84
+
85
+ It only ever adds. A session leaving the canvas cannot pull the figure down, and the next reading corrects whatever the estimate got wrong — the tokens are exact, and the dollars in between are priced by the deck's own table.
86
+
87
+ Two smaller things with it: pressing today, month or all now counts between the two figures instead of swapping them, and coming back to the tab only re-reads if what is on screen is actually stale.`}],"3.4.0":[{title:"🔢 The figures count to their new value, once a minute",body:`The Usage panel re-reads its numbers every minute now rather than every five, and it is a real minute — the server used to hold a reading for two, so a shorter poll would have handed the same figure back.
88
+
89
+ And they no longer teleport. Replaced in a single frame, $170 → $269 says only "this is different now": no direction, no sense of how much, and nothing at all if your eye was a few pixels away. Counted over a fifth of a second, the same change says up, and roughly how far.
90
+
91
+ What deliberately does not count: the first paint, a change of period — "today" and "all time" are different quantities rather than one that moved — the tables, a change too small to read, and anything at all if you have reduced motion on or the tab is in the background.`},{title:"🧹 The board's own figure is out of the Usage panel",body:`3.3.0 put the canvas's live spend on its own labelled line, under whichever period you had chosen. In front of a panel that answers today, this month and all time from the logs on disk, that second money figure answers a question nobody asked at that moment — and it invited a comparison it could never win, $7,385 on the board beneath $170 for today.
92
+
93
+ It is gone. The board's tokens and cost are still on the topbar, with the sentence that explains why they fall on their own, and the panel still shows them when ccusage cannot answer at all.`}],"3.3.0":[{title:"📊 The Usage panel answers for a period, not just for the board",body:`It used to add up the sessions drawn on the canvas — which is an honest number with a scope nobody reads it as having: finished sessions are evicted a couple of minutes after they end, so the figure fell on its own while nothing had happened and nothing was refunded.
94
+
95
+ It now reads ccusage, the same source the H modal uses, and offers today, this month and all time. BY MODEL and BY SESSION come from there too, and each session is named by the project the board knows it as rather than by a uuid.
96
+
97
+ The live figure is still there, on its own line and labelled — what the sessions currently on the board have spent — because that is a different question from what the month cost.
98
+
99
+ One thing worth knowing about the source: ccusage reports a session's LIFETIME total, so the rows under "active today" can add up to more than the day above them. The heading says so.`},{title:"🪟 Windows: a deck started from an elevated terminal was being treated as dead",body:"The hook decides whether a deck is still running by trying to signal it. On POSIX a process you may not signal answers EPERM; on Windows it answers EACCES, and only EPERM was accepted — so a deck started from an elevated terminal, or under another account, read as gone. Its registration was deleted on every event and rewritten five seconds later, while its banner went on saying it was connected and almost nothing arrived.\n\nThree more Windows-only faults went with it: a read-only settings.json made every hook install fail for good (the atomic write could not replace the file); the machine panel answered 500 every four seconds whenever the process read failed; and a bare command name was looked for in the working directory before PATH, which is where `npx ccdeck` was run."},{title:"👁 Browser Watch reads nothing while it is switched off",body:`The switch used to control only what was KEPT. The read happened anyway — every five minutes, on every deck, the panel's badge poll discovered each Chromium profile and copied its whole History database to a temp file to query it. A switch that says off while that continues is not a switch.
100
+
101
+ With the watch off, nothing touches a browser now. Opening the panel still reads live, because that is you looking, and a watch that is ON still records in the background — that is the feature. The trade is that the topbar badge no longer counts findings while the watch is off; open the panel to see them.
102
+
103
+ The README has a Browser Watch section now: what is read, when, where the copy goes, and that only visits after the deck started are ever considered.`},{title:"🔒 The deck's own data is no longer readable by anything on the machine",body:"Changing an account needed the deck's credential; reading the event ring did not. Anything running on your machine could `curl` the events — prompt text, the commands an agent ran, the paths and contents it touched — plus the account list and the browsing episodes.\n\nThose reads now answer to the same rule the mutations do: the deck's own page, or its token. Nothing changes for you in the browser. A script of yours that reads those routes needs the token from `~/.claude/agent-dag/<pid>.json`, sent as `x-ccdeck-token`."},{title:"💳 An API-key, Bedrock or Vertex install is told there is no quota window",body:`Those installs are billed per token and have no five-hour window. The CLI ran, printed no quota lines, and the deck read that as a genuine "under 1%" — drawing two empty bars for a measurement nobody had taken, or telling you to run /usage, which cannot help there.
104
+
105
+ It now says what it is, in one line, the way the Codex half already did.`},{title:"🎨 The model chip is coloured by its model again",body:`A session that switched model — Sonnet, then Opus — drew a chip reading "Opus 5 +1" in Sonnet blue, because the colour was picked from the tooltip and the tooltip lists every model the card's spend covers. Add a Fable turn and it went yellow.
106
+
107
+ Also fixed on the way past: an account import the CLI rejected could take the whole deck down with it, and a corrupt compressed Codex rollout leaked a file handle on every poll.`}],"3.2.1":[{title:"💵 Sonnet 5 was being costed fifty per cent high",body:`Sonnet 5 launched at $2/$10 per million tokens as introductory pricing, with a rise to $3/$15 announced for September 1. The deck implemented that schedule, and on September 1 it started charging the higher rate.
108
+
109
+ The increase was cancelled. Anthropic's pricing page now says the $2/$10 rate is simply the price and the rise "will not occur" — so every Sonnet 5 session since the 1st has been shown to you at half again what it cost.
110
+
111
+ It is corrected, and there is no date logic left in that rate to go stale a second time. Numbers already on your board are recomputed from the log the next time the deck starts; nothing was billed by us, only displayed.
112
+
113
+ Fable 5.1 and Mythos 5.1 are also priced now, including the cache read that is a quarter of Fable 5's — which is most of what a long session pays for.`}],"3.2.0":[{title:"🌡️ Windows shows a temperature where it can find one",body:`On most Windows laptops there is nothing to show, and that is Windows rather than this deck: modern machines declare no ACPI thermal zone, and the sensors that do exist sit behind an interface only an administrator may read. Measured on real hardware, elevated and not.
114
+
115
+ One thing does work, and it costs you nothing to have. If LibreHardwareMonitor happens to be running with its web server on, the deck now reads its numbers over localhost — which needs no privileges at all.
116
+
117
+ It is only ever a read. Nothing is installed, nothing is asked of you, and a machine without it shows no section, exactly as before.`}],"3.1.0":[{title:"🚀 The first run stops looking like it hung",body:`\`npx ccdeck\` on a machine that has never run it used to sit on a spinner at "checking claude-swap" and say nothing else. Measured on a Windows box: seventeen and a half seconds before it told you where to point a browser. It is now one and a half.
118
+
119
+ The deck was waiting for an install nobody asked for during that boot — a Python toolchain being fetched so the accounts panel would work. The port had been open the whole time; there was just nothing on screen to say so.
120
+
121
+ It no longer waits. Anything still working past the boot says so on its own line and keeps going in the background, and the deck comes up without it.`},{title:"⚡ Every start is quicker, and stays quicker",body:`The event log was read from the beginning on every boot to fill a buffer that only keeps the last two thousand events — so four fifths of that reading existed to be thrown away, and it got slower the longer you had been using the deck. It reads from the end now and stops when the buffer is full: 258ms down to 20ms here, on a 34 MB log, and it no longer grows.
122
+
123
+ The accounts tool is also asked for its version once instead of twice, which on this machine was the single largest thing in an ordinary boot.`},{title:"📉 Ten fewer packages to install",body:"Opening your browser used to cost a dependency that brought nine more with it — ten downloads on a cold `npx ccdeck` before the deck's own files were unpacked. It is now done with the commands the operating system already has.\n\nThe package has no runtime dependencies at all."},{title:"🌡️ Temperature, on the machines that could not show it",body:`On Windows the deck was asking somewhere it is not allowed to look: that reading lives behind a namespace that needs administrator, so it failed for everybody and the section never appeared. It reads a performance counter now, which needs nothing.
124
+
125
+ On Apple Silicon there is no command that ships with macOS which prints a temperature at all — the sensors are behind an interface only native code can reach. The deck fetches a small signed tool for it, verified against the checksum its release publishes, in the background and only on the Macs that need it. You do not have to install anything. \`AGENTS_DECK_NO_DOWNLOAD=1\` turns that off.
126
+
127
+ A machine with no sensor still shows no section, which includes every virtual machine. Nothing is drawn that was not measured.`},{title:"😌 The terminal goes quiet when there is nothing happening",body:`The dot at the bottom blinked every 800ms for as long as the deck ran, which is what a terminal does while it is working — so a deck that had finished in a second looked like one that never finished.
128
+
129
+ It now moves only while something actually is: a job still running, or hooks that cannot find the deck. Otherwise it is drawn once and left alone, and it says what the job is rather than just blinking. A step that takes more than three seconds shows how long it has been going, which is the whole of "is this stuck".
130
+
131
+ And a machine with no Claude Code installed stops being told about it every few seconds — that one is said once now, on its own line instead of across the status line.`}],"3.0.0":[{title:"📈 The machine panel now shows what it DID, not just what it is",body:`Click any section of the machine panel — Cores, Memory, Load average, Thermal — and it opens a chart of what that reading has done since the deck started.
132
+
133
+ The panel could always tell you the machine is busy now. It could not tell you whether it got hot while that three-hour build was running, or how deep the queue went while you were away, and those are the questions you actually have afterwards.
134
+
135
+ Thermal is new as well. Where the machine will give degrees, it gives degrees; on a Mac it also reports whether the CPU is being held back to cool down, which is the consequence a temperature has to be interpreted into anyway. Nothing is drawn that was not measured — a machine with no sensor gets no section at all, rather than a zero.`},{title:"🔍 The whole process list, not just the busiest eight",body:`"more" beside Busiest processes opens the full list the deck is watching — around fifty processes rather than eight — with the pid and the untruncated name.
136
+
137
+ This closes a gap. The panel's eight rows are the busiest, so sorting them by name only reorders those eight: "is my test runner still going" could not be answered if the test runner was not already on screen. Now it can.
138
+
139
+ It is deliberately not a task manager. Nothing here ends a process; Activity Monitor and Task Manager are better at that and it is not a thing this deck should own.`},{title:"🔤 Process names in Cyrillic, Greek or with accents read correctly",body:`An application named Яндекс Музыка was showing up as M-PM-/M-PM-=M-PM-4M-PM-5… in the process list, and so was every other name the deck could not spell in plain ASCII.
140
+
141
+ The deck was forcing a fixed locale on the commands it runs, to guarantee that a decimal point stays a point on a machine set to German or Russian — and that also forced the character set. It forces only the number format now. Your own character set is left alone, which is what makes the name arrive intact.`},{title:"📦 The text you copy to share accounts is a third of its size",body:`Sharing three accounts used to produce 6168 characters. It is now 1896.
142
+
143
+ Most of that text was never the credentials — two OAuth tokens are about two hundred characters between them, and the rest was the envelope, whose field names repeated in full for every account added. So the saving grows with the number of accounts rather than shrinking.
144
+
145
+ A blob you copied before this still imports until it expires. One made now cannot be read by a deck older than this version — that is the one thing in this release that older decks cannot follow.`}],"1.48.0":[{title:"👁 Browser Watch — see what a program opened while you were away",body:`There is a new eye in the top bar. It watches the browsers on this machine and tells you when a program — an extension, an agent, a command — opened pages while nobody was touching the browser.
146
+
147
+ Usually that is your own agent doing what you asked, and the panel says so rather than crying intrusion. What it gives you is the evidence: which pages, in which browser, at what time, with every address written out in full.
148
+
149
+ It is off until you switch it on, and nothing leaves this machine. It reads a copy of the browser's own history and only pages newer than the moment the deck started — never anything from before, never cookies, never saved passwords. Open ⚙ inside the panel and "What Browser Watch can access" says exactly what it reads, keeps and sends.
150
+
151
+ When it finds something the eye turns amber with a count. You can dismiss a finding once you have looked at it and it stays gone, while the log file on disk keeps the record. On a Mac it can also close the tab it found, or quit the browser.`},{title:"🔑 Move all your accounts to another machine in one paste",body:`Sharing accounts between two decks used to be one account at a time, and step four of six is where people stop — leaving the second deck half set up with nothing saying so.
152
+
153
+ Pick the accounts you want, copy one blob, paste it into the other deck. The import adds what is missing, leaves what already works alone, heals an account whose token has died, and tells you which of those happened to each one.
154
+
155
+ The blob carries real credentials, so it expires ten minutes after you make it and the deck refuses an expired one before it unwraps anything.`}],"1.47.0":[{title:"🔌 The top bar goes quiet when everything is fine",body:`The green "live" pill used to sit up there permanently to tell you nothing was broken. It is gone while things are working.
156
+
157
+ You will still see a pill when it matters: amber when you pause the canvas, with how many events are waiting, and red when the deck loses its connection to the server. No pill means all is well.`},{title:"🔴 The browser tab tells you when the connection drops",body:`The little icon in the tab has always shown what your sessions are doing — grey when it is quiet, blue when something is working, amber when a session is waiting on you.
158
+
159
+ It could not say the one thing that matters most: that the deck has stopped hearing from the server. Until now it just kept showing whatever it had last seen. It turns into a broken red ring instead, so you can spot it from another tab without switching over.`}],"1.46.0":[{title:"🔊 Pick a volume and a sound for each of the two tones",body:`Click the speaker in the top bar and a small menu opens. There are two tones — one when a turn finishes, one when Claude is waiting for you — and each has its own volume and its own sound, six to choose from. Press "Hear it" to try one straight away, without waiting for a real turn.
160
+
161
+ The two lists are separate on purpose, so you can never end up with both tones sounding the same. A finish tone always falls; an asking tone always rises. That is how you tell them apart without looking at the screen.
162
+
163
+ 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.
164
+
165
+ 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."}]},Rw="agent-dag.releaseNotesSeen";function z1(e){return e.split(/[.\-+]/).map(t=>parseInt(t,10)).map(t=>Number.isNaN(t)?0:t)}function Ui(e,t){const n=z1(e),s=z1(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 Wi(e){return typeof e=="string"&&/^\d+\.\d+\.\d+/.test(e)}function OD(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 PD(e){if(!e||typeof e!="object")return[];const t=[];for(const[n,s]of Object.entries(e)){if(!Wi(n)||!Array.isArray(s))continue;const i=s.filter(OD);i.length&&t.push({version:n,notes:i})}return t.sort((n,s)=>Ui(s.version,n.version))}const B1=PD(ID);function LT(e,t,n){return e.filter(s=>Ui(s.version,n)<=0&&(t===null||Ui(s.version,t)>0))}function $D(e,t){return e.filter(n=>Ui(n.version,t)===0)}function LD(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 qD({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&&Wi(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(!Wi(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=Ui(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 DD=new RegExp("^(?:\\p{Extended_Pictographic}|\\p{Emoji_Modifier}|\\p{Regional_Indicator}|[\\u200D\\uFE0F])+(?= \\S)","u");function FD(e){const t=DD.exec(e);return t?{icon:t[0],rest:e.slice(t[0].length)}:{icon:null,rest:e}}function zD(){if(typeof window>"u")return null;try{return window.localStorage}catch{return null}}function BD(e){if(!e)return null;let t=null;try{t=e.getItem(Rw)}catch{return null}return Wi(t)?t:null}function UD(e){if(!e)return!1;try{return e.getItem(Rw),!0}catch{return!1}}function WD(e,t){if(!e)return!1;try{return e.setItem(Rw,t),!0}catch{return!1}}function HD({stored:e,running:t,notes:n,remembers:s=!0}){if(!Wi(t))return{show:[],record:null,reason:"no-version"};if(!Wi(e)){if(!s)return{show:[],record:t,reason:"cannot-remember"};const l=$D(n,t);return l.length?{show:l,record:t,reason:"welcome"}:{show:[],record:t,reason:"first-run"}}const i=Ui(e,t);if(i===0)return{show:[],record:null,reason:"seen"};if(i>0)return{show:[],record:null,reason:"ahead"};const a=LT(n,e,t);return a.length?{show:a,record:t,reason:"new-notes"}:{show:[],record:t,reason:"nothing-new"}}function GD({entries:e,since:t,running:n,firstRun:s,onClose:i}){const a=kn(i),l=LD(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:qD({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}=FD(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 VD(e){return e.slice().sort((t,n)=>t.y-n.y||t.x-n.x)}function YD(e,t,n){var l;if(e.length===0)return null;const s=VD(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 KD=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Escape","Delete","Backspace"]);function XD(e,t){return t==null?{kind:"deck",nodeId:null}:e.key==="Enter"||e.key===" "?{kind:"activate",nodeId:t,additive:e.shiftKey}:KD.has(e.key)?{kind:"node",nodeId:t}:{kind:"deck",nodeId:t}}const QD=new Set(["","BODY","HTML","#DOCUMENT"]);function ZD(e){return!e||_w(e)?!1:!QD.has(String(e.tagName??"").toUpperCase())}function Xc(e,t){if(t.size!==0)for(const n of Array.from(e.keys()))t.has(n)||e.delete(n)}function JD(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 e5(e){const t=new Set;for(const n of e)t.add(n.id),t.add(`group:${n.sessionId}`);return t}function t5(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 n5(e,t){const n=new Set;for(const s of t){const i=t5(e,s);if(i)for(const a of i)n.add(a)}return n.size>0?n:null}function qT(e,t,n){return!t.has(e)||n.has(e)}function r5(e,t,n,s){return!t.has(e)&&qT(e,n,s)}function s5(e,t,n){const s={x:0,y:0};return t.set(e,s),n.add(e),s}function o5(e,t,n,s){n.set(e,t),s.delete(e)}const i5=40,a5=120;function l5(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=i5){const p=t.now(),f=Math.max(i+h,p);if(f<=p){l(),a();return}u(f,p,h)},replay(h=a5){l(),s=t.now()+h,n=t.setTimeout(a,h)},flush(){l(),a()},cancel(){l()}}}const c5=1e3;function u5(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,y=g!==null&&g!==h;y&&(h=g,u=0);const w=f!==null&&!y&&f<=u;if(f!==null&&f>u&&(u=f),!s)return!0;if(w)return!1;if(i.push(p),n!=null&&n(p)&&a.add(p),i.length>t){let S=0;if(a.size<i.length)for(;a.has(i[S]);)S++;const[b]=i.splice(S,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 DT="agent-dag.theme";function d5(e){return e==="light"?"light":"dark"}function f5(){return d5(Ou(DT))}function h5({waiting:e,running:t,connected:n=!0}){return{title:e>0?`(${e}) ${Ft}`:Ft,icon:n?e>0?"waiting":t>0?"running":"idle":"offline"}}const Qc={offline:"#e05252",waiting:"#c97d12",running:"#2a90d4",idle:"#7e828c"};function Zc(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 p5=Object.freeze({offline:`data:image/svg+xml,${encodeURIComponent(Zc(Qc.offline,"offline"))}`,waiting:`data:image/svg+xml,${encodeURIComponent(Zc(Qc.waiting,"waiting"))}`,running:`data:image/svg+xml,${encodeURIComponent(Zc(Qc.running,"running"))}`,idle:`data:image/svg+xml,${encodeURIComponent(Zc(Qc.idle,"idle"))}`}),m5="No sessions are waiting for you.";function g5(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 v5(e,t){return t!==""?t:e===""?"":m5}function y5(){let e=0;return{begin(){const t=++e;return()=>t===e},cancel(){e++}}}function w5(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 x5(e){return e.claude&&e.codex?"Claude Code and Codex":e.claude?"Claude Code":e.codex?"Codex":null}const U1={claude:"Claude Code",codex:"Codex",opencode:"OpenCode",openclaw:"OpenClaw",copilot:"GitHub Copilot",pi:"pi-agent"};function Aw(e){const t=e.toLowerCase();return Object.hasOwn(U1,t)?U1[t]:t?t[0].toUpperCase()+t.slice(1):""}function b5(e){return e.length<=1?e[0]??"":`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`}function _5(e,t=[]){const n=t.length?b5(t.map(Aw)):x5(e);return n?`via ccusage · local ${n} logs`:"via ccusage · local agent logs"}function k5(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 S5(e,t){const n=t.prefs??Vy,s=ul(n.done.level),i=ul(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?`
166
+
167
+ 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?`
168
+
169
+ 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+`
170
+
171
+ Click to set the volume and the sound of each tone, and to hear either one.`}function FT(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 N5(e){const t=FT([{agents:e}]);return t.length<2?null:t.map(n=>`${Aw(n.id)} ${et(n.cost)}`).join(" · ")}function W1(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 E5(e,t){if(!(t>0)||!(e>0))return"0%";const n=e/t*100;return n<.1?"<0.1%":`${n.toFixed(1)}%`}function Jc(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 C5=[7,14,30,90];function j5(e){const[t,n]=N.useState(null),[s,i]=N.useState(!1),a=N.useState(y5)[0],l=N.useRef(!1),u=(h=!1)=>{if(h&&!ir(l.current))return;const p=a.begin();l.current=h;const f=e;i(!0);const y=`/api/ccusage?since=${Dy(f)}${h?"&refresh=1":""}`;fetch(y).then(w=>w.json()).then(w=>{p()&&n({range:f,resp:w})}).catch(()=>{p()&&n({range:f,resp:{ok:!1,reason:"unreachable"}})}).finally(()=>{p()&&(l.current=!1,i(!1))})};return N.useEffect(()=>(u(!1),()=>a.cancel()),[e]),{landed:t,loading:s,reload:()=>u(!0)}}function T5({onClose:e,providers:t}){var F;const[n,s]=N.useState(30),[i,a]=N.useState(null),{landed:l,loading:u,reload:h}=j5(n),p=N.useRef(null),f=kn(e,{focusRef:p}),g=w5({loading:u,want:n,answer:l&&{range:l.range,ok:l.resp.ok===!0,days:((F=l.resp.days)==null?void 0:F.length)??0}}),y=g.phase==="chart"?l.resp.days??[]:[],w=N.useMemo(()=>y.reduce((M,A)=>Math.max(M,A.totalCost),0),[y]),S=N.useRef(null);N.useLayoutEffect(()=>{const M=S.current;M&&(M.scrollLeft=M.scrollWidth)},[y]);const{totalCost:b,totalTok:_,inOut:k,cacheRead:E,modelCosts:C}=N.useMemo(()=>{let M=0,A=0,q=0,W=0;const V=new Map;for(const T of y){M+=T.totalCost,A+=T.totalTokens,q+=T.inputTokens+T.outputTokens,W+=T.cacheReadTokens;for(const Q of T.modelBreakdowns)V.set(Q.modelName,(V.get(Q.modelName)??0)+Q.cost)}return{totalCost:M,totalTok:A,inOut:q,cacheRead:W,modelCosts:V}},[y]),j=N.useMemo(()=>Array.from(C.entries()).sort((M,A)=>A[1]-M[1]),[C]),I=N.useMemo(()=>FT(y),[y]),O=I.length>1,P=i?y.find(M=>M.period===i)??null:null;return d.jsx("div",{className:"uh-backdrop",onClick:e,role:"presentation",children:d.jsxs("div",{ref:f,className:"uh-modal",onClick:M=>M.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Usage history",children:[d.jsxs("header",{className:"uh-head",children:[d.jsxs("div",{className:"uh-titlewrap",children:[d.jsx("div",{className:"uh-title",children:"Usage history"}),d.jsx("div",{className:"uh-sub",children:_5(t,I.map(M=>M.id))})]}),d.jsx("div",{className:"uh-range",role:"group","aria-label":"Range",children:C5.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,...or(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:zi(l.resp)||void 0,children:[k4(l.resp,"ccusage did not report usage"),d.jsx("div",{children:d.jsx("button",{className:"btn uh-retry",onClick:h,...or(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(eu,{label:"total cost",val:et(b),accent:!0}),d.jsx(eu,{label:"tokens",val:Rt(_)}),d.jsx(eu,{label:"input+output",val:Rt(k)}),d.jsx(eu,{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:W1(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:W1(M.id)}}),Aw(M.id),d.jsx("span",{className:"uh-agent-cost",children:et(M.cost)}),d.jsx("span",{className:"uh-agent-share",children:E5(M.cost,b)})]},M.id))})]}),d.jsx("div",{ref:S,className:"uh-chart",role:"group","aria-label":"Daily cost by model",children:y.map(M=>{const A=w>0?M.totalCost/w*100:0,q=M.period===i,W=`${M.period}, ${et(M.totalCost)}`;return d.jsxs("button",{className:`uh-bar-col${q?" sel":""}`,onClick:()=>a(q?null:M.period),"aria-pressed":q,"aria-label":W,title:`${M.period} · ${et(M.totalCost)}`,style:{flexBasis:`${100/y.length}%`},children:[d.jsx("div",{className:"uh-bar",style:{height:`${Math.max(A,M.totalCost>0?2:0)}%`},children:M.modelBreakdowns.slice().sort((V,T)=>T.cost-V.cost).map(V=>{const T=M.totalCost>0?V.cost/M.totalCost*100:0;return d.jsx("div",{className:"uh-bar-seg",style:{height:`${T}%`,background:Jc(V.modelName)}},V.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:Jc(M)}}),Os(M)," ",d.jsx("span",{className:"uh-legend-cost",children:et(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:et(P.totalCost)}),(()=>{var q,W;const A=N5(P.agents)??((W=(q=P.metadata)==null?void 0:q.agents)!=null&&W.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(tu,{label:"input",val:Rt(P.inputTokens)}),d.jsx(tu,{label:"output",val:Rt(P.outputTokens)}),d.jsx(tu,{label:"cache write",val:Rt(P.cacheCreationTokens)}),d.jsx(tu,{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:Jc(M.modelName)}}),d.jsx("span",{className:"uh-model-label",children:Os(M.modelName)})]}),d.jsx("span",{className:"uh-model-bar",children:d.jsx("span",{className:"uh-model-bar-fill",style:{width:`${A}%`,background:Jc(M.modelName)}})}),d.jsx("span",{className:"uh-model-cost",children:et(M.cost)})]},M.modelName)})})]})]})]})})}function eu({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 tu({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 R5(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 H1=1e4,A5=12e3;function M5({browsers:e,findings:t,watching:n,palette:s,now:i=()=>Date.now()}){const a=N.useRef(null),l=N.useRef(null);return l.current={browsers:e,findings:t,watching:n},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 y=()=>{var ne;if(g)return;const S=l.current;if(!S)return;const{browsers:b,findings:_,watching:k}=S,E=s["--accent"]||"#7dd3fc",C=s["--line"]||"#1f2229",j=s["--text-dim"]||"#6e727c",I=R5(s["--bg"]),O=I?42:26,P=I?.85:.65,F=i(),M=Math.min(window.devicePixelRatio||1,2),A=u.clientWidth,q=u.clientHeight;(u.width!==A*M||u.height!==q*M)&&(u.width=A*M,u.height=q*M),h.setTransform(M,0,0,M,0,0),h.clearRect(0,0,A,q);const W=A/2,V=q/2,T=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(W,V,T*X,0,Math.PI*2),h.stroke();h.beginPath(),h.moveTo(W-T,V),h.lineTo(W+T,V),h.moveTo(W,V-T),h.lineTo(W,V+T),h.stroke(),h.globalAlpha=1;const U=(k&&!p?F%H1/H1:0)*Math.PI*2-Math.PI/2;if(k){const X=(ne=h.createConicGradient)==null?void 0:ne.call(h,U-.85,W,V);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(W,V),h.arc(W,V,T,U-.85,U),h.closePath(),h.fill()),h.strokeStyle=E,h.globalAlpha=P,h.beginPath(),h.moveTo(W,V),h.lineTo(W+Math.cos(U)*T,V+Math.sin(U)*T),h.stroke(),h.globalAlpha=1}b.forEach((X,H)=>{const J=H/Math.max(b.length,1)*Math.PI*2-Math.PI/2,$=X.lastReadMs===null?1:Math.min(1,(F-X.lastReadMs)/12e4),G=T*(.42+$*.5),Z=W+Math.cos(J)*G,D=V+Math.sin(J)*G,L=Math.abs((U-J+Math.PI*3)%(Math.PI*2)-Math.PI),Y=k?Math.max(0,1-L/.55):0;h.beginPath(),h.arc(Z,D,3+Y*1.6,0,Math.PI*2),h.fillStyle=X.running?E:j,h.globalAlpha=X.running?.55+Y*.45:.35,h.fill(),h.globalAlpha=1});for(const X of _){const H=(F-X.atMs)/A5;if(H<0||H>1)continue;const $=Math.max(0,b.findIndex(D=>D.key===X.browser))/Math.max(b.length,1)*Math.PI*2-Math.PI/2,G=W+Math.cos($)*T*.6,Z=V+Math.sin($)*T*.6;h.beginPath(),h.arc(G,Z,4+H*22,0,Math.PI*2),h.strokeStyle=E,h.globalAlpha=(1-H)*.8,h.lineWidth=1.5,h.stroke(),h.globalAlpha=1}f=requestAnimationFrame(y)};return y(),()=>{g=!0,cancelAnimationFrame(f)}},[i,s]),d.jsx("canvas",{ref:a,className:"bw-radar",role:"img","aria-label":n?`Watching ${e.length} browser${e.length===1?"":"s"}`:"Not watching"})}const G1="agent-dag.browserWatch.seenMs";function I5(e,t){return e.filter(n=>n.startMs>t)}function O5(e,t,n){if(e===null)return null;const s=e+t-n;return s>0?s:null}function P5(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 zT(e){return(e??[]).filter(t=>t.installed&&t.profiles>0)}function V1(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 $5(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 L5(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 q5(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=zT(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 D5(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 F5(e){return new Date(e).toLocaleDateString(void 0,{weekday:"short",day:"numeric",month:"short"})}function Y1(e){const t=Math.round((e.endMs-e.startMs)/6e4);return t<1?"":`${t} min`}function z5({onClose:e,onSeen:t,onWatching:n,palette:s}){const i=kn(e),[a,l]=N.useState(null),[u,h]=N.useState(null),[p,f]=N.useState(!1),g=N.useRef(!1),[y,w]=N.useState(null),[S,b]=N.useState(null),[_,k]=N.useState(!1),[E,C]=N.useState(!1),[j,I]=N.useState(!1),[O,P]=N.useState(!1),[F,M]=N.useState(!1),[A,q]=N.useState(!1),[W,V]=N.useState(()=>Date.now());N.useEffect(()=>{const Z=setInterval(()=>V(Date.now()),1e3);return()=>clearInterval(Z)},[]);const T=N.useCallback(async Z=>{var D;if(!(Z&&!ir(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 Y=await L.json();l(Y),w(re=>{var he;return re===null?((he=Y==null?void 0:Y.settings)==null?void 0:he.quietMinutes)??15:re}),n(((D=Y==null?void 0:Y.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]);N.useEffect(()=>{T(!1)},[T]),N.useEffect(()=>{const Z=setInterval(()=>{T(!1)},1e4);return()=>clearInterval(Z)},[T]);const Q=N.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 T(!1)}},[T]),U=N.useCallback(async Z=>{k(!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 T(!1)}catch(D){h(D instanceof Error?D.message:String(D))}finally{k(!1)}},[T]);N.useEffect(()=>()=>t(Date.now()),[t]);const ne=N.useMemo(()=>{const Z=[];for(const D of(a==null?void 0:a.episodes)??[]){const L=F5(D.startMs),Y=Z[Z.length-1];Y&&Y.label===L?Y.episodes.push(D):Z.push({label:L,episodes:[D]})}return Z},[a]),X=zT(a==null?void 0:a.browsers),H=((a==null?void 0:a.browsers)??[]).filter(Z=>!(Z.installed&&Z.profiles>0)),J=a?q5(a):null,$=X.reduce((Z,D)=>Z+D.profiles,0),G=a?O5(a.coverage.lastHumanMs,a.coverage.quietMs,W):null;return d.jsx("div",{className:"modal-backdrop",onClick:e,role:"presentation",children:d.jsxs("div",{ref:i,className:"modal bw-modal",onClick: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 T(!0),...or(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(M5,{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:$5(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 ",L5(a.coverage.checkedMs,W),a.coverage.checks>0&&d.jsxs(d.Fragment,{children:[" · ",a.coverage.checks.toLocaleString("en-US")," ",a.coverage.checks===1?"check":"checks"]})]}),G!==null&&d.jsxs("p",{className:"bw-gate",children:["You are browsing — a program page would count in ",P5(G)]}),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":F,"aria-label":"What running, idle and connected to Anthropic mean",children:"?"})]}),F&&d.jsxs("dl",{className:"bw-key",children:[d.jsx("dt",{children:"Running"}),d.jsx("dd",{children:"the browser has a process on this machine right now"}),d.jsx("dt",{children:"Connected"}),d.jsx("dd",{children:"an open connection to an address Anthropic's relay uses — which it shares with claude.ai, so an open tab looks the same as an agent channel"})]}),d.jsx("ul",{className:"bw-profiles",children:X.map(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))}),H.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?"▾":"▸"})," ",H.length," not watched"]}),A&&d.jsxs("p",{className:"bw-rest",children:[H.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}`,Y=S===L;return d.jsxs("div",{className:`bw-ep${Y?" open":""}`,children:[d.jsxs("div",{className:"bw-ep-row",children:[d.jsxs("button",{className:"bw-ep-head",onClick:()=>b(Y?null:L),"aria-expanded":Y,children:[d.jsx("span",{className:"bw-chev","aria-hidden":!0,children:Y?"▾":"▸"}),d.jsx("span",{className:"bw-ep-host",children:D.host}),d.jsxs("span",{className:"bw-ep-meta",children:[D5(D),Y1(D)&&d.jsxs(d.Fragment,{children:[" · ",Y1(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:"×"})]}),Y&&d.jsx("ul",{className:"bw-urls",children:D.urls.map((re,he)=>d.jsxs("li",{children:[d.jsx("span",{className:"bw-url-time",children:new Date(re.timeMs).toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit",hour12:!1})}),d.jsx("span",{className:"bw-url",children:re.url})]},`${re.url}-${re.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:y??a.settings.quietMinutes,onChange:Z=>{w(Number(Z.target.value)),U({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 U({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:V1(a,_).word},V1(a,_).kind),d.jsx("span",{className:"bw-status-text",children:a.coverage.archived===0?a.settings.enabled?"No episodes recorded yet":"No episodes on disk":`${a.coverage.archived} ${a.coverage.archived===1?"episode":"episodes"} on disk`}),d.jsx("button",{className:`glyph-btn bw-gear${E?" on":""}`,onClick:()=>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 U({enabled:!a.settings.enabled}),title:a.settings.enabled?"On — every episode it finds is written down, so the list outlives the browsing history being cleared":"Off — showing only what this deck has seen since it started. Anything an earlier run archived is hidden until you switch back on, and nothing new is kept",children:d.jsx("span",{className:"bw-toggle-knob"})})]})]})]})]})})}function Mw(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 Xf,K1;function B5(){if(K1)return Xf;K1=1;function e(){this.__data__=[],this.size=0}return Xf=e,Xf}var Qf,X1;function Vi(){if(X1)return Qf;X1=1;function e(t,n){return t===n||t!==t&&n!==n}return Qf=e,Qf}var Zf,Q1;function $u(){if(Q1)return Zf;Q1=1;var e=Vi();function t(n,s){for(var i=n.length;i--;)if(e(n[i][0],s))return i;return-1}return Zf=t,Zf}var Jf,Z1;function U5(){if(Z1)return Jf;Z1=1;var e=$u(),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 Jf=s,Jf}var eh,J1;function W5(){if(J1)return eh;J1=1;var e=$u();function t(n){var s=this.__data__,i=e(s,n);return i<0?void 0:s[i][1]}return eh=t,eh}var th,e_;function H5(){if(e_)return th;e_=1;var e=$u();function t(n){return e(this.__data__,n)>-1}return th=t,th}var nh,t_;function G5(){if(t_)return nh;t_=1;var e=$u();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 nh=t,nh}var rh,n_;function Lu(){if(n_)return rh;n_=1;var e=B5(),t=U5(),n=W5(),s=H5(),i=G5();function a(l){var u=-1,h=l==null?0:l.length;for(this.clear();++u<h;){var p=l[u];this.set(p[0],p[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=s,a.prototype.set=i,rh=a,rh}var sh,r_;function V5(){if(r_)return sh;r_=1;var e=Lu();function t(){this.__data__=new e,this.size=0}return sh=t,sh}var oh,s_;function Y5(){if(s_)return oh;s_=1;function e(t){var n=this.__data__,s=n.delete(t);return this.size=n.size,s}return oh=e,oh}var ih,o_;function K5(){if(o_)return ih;o_=1;function e(t){return this.__data__.get(t)}return ih=e,ih}var ah,i_;function X5(){if(i_)return ah;i_=1;function e(t){return this.__data__.has(t)}return ah=e,ah}var lh,a_;function BT(){if(a_)return lh;a_=1;var e=typeof $c=="object"&&$c&&$c.Object===Object&&$c;return lh=e,lh}var ch,l_;function ur(){if(l_)return ch;l_=1;var e=BT(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return ch=n,ch}var uh,c_;function Yi(){if(c_)return uh;c_=1;var e=ur(),t=e.Symbol;return uh=t,uh}var dh,u_;function Q5(){if(u_)return dh;u_=1;var e=Yi(),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 dh=a,dh}var fh,d_;function Z5(){if(d_)return fh;d_=1;var e=Object.prototype,t=e.toString;function n(s){return t.call(s)}return fh=n,fh}var hh,f_;function ko(){if(f_)return hh;f_=1;var e=Yi(),t=Q5(),n=Z5(),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 hh=l,hh}var ph,h_;function qn(){if(h_)return ph;h_=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return ph=e,ph}var mh,p_;function kl(){if(p_)return mh;p_=1;var e=ko(),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 mh=l,mh}var gh,m_;function J5(){if(m_)return gh;m_=1;var e=ur(),t=e["__core-js_shared__"];return gh=t,gh}var vh,g_;function eF(){if(g_)return vh;g_=1;var e=J5(),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 vh=n,vh}var yh,v_;function UT(){if(v_)return yh;v_=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 yh=n,yh}var wh,y_;function tF(){if(y_)return wh;y_=1;var e=kl(),t=eF(),n=qn(),s=UT(),i=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,l=Function.prototype,u=Object.prototype,h=l.toString,p=u.hasOwnProperty,f=RegExp("^"+h.call(p).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function g(y){if(!n(y)||t(y))return!1;var w=e(y)?f:a;return w.test(s(y))}return wh=g,wh}var xh,w_;function nF(){if(w_)return xh;w_=1;function e(t,n){return t==null?void 0:t[n]}return xh=e,xh}var bh,x_;function So(){if(x_)return bh;x_=1;var e=tF(),t=nF();function n(s,i){var a=t(s,i);return e(a)?a:void 0}return bh=n,bh}var _h,b_;function Iw(){if(b_)return _h;b_=1;var e=So(),t=ur(),n=e(t,"Map");return _h=n,_h}var kh,__;function qu(){if(__)return kh;__=1;var e=So(),t=e(Object,"create");return kh=t,kh}var Sh,k_;function rF(){if(k_)return Sh;k_=1;var e=qu();function t(){this.__data__=e?e(null):{},this.size=0}return Sh=t,Sh}var Nh,S_;function sF(){if(S_)return Nh;S_=1;function e(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}return Nh=e,Nh}var Eh,N_;function oF(){if(N_)return Eh;N_=1;var e=qu(),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 Eh=i,Eh}var Ch,E_;function iF(){if(E_)return Ch;E_=1;var e=qu(),t=Object.prototype,n=t.hasOwnProperty;function s(i){var a=this.__data__;return e?a[i]!==void 0:n.call(a,i)}return Ch=s,Ch}var jh,C_;function aF(){if(C_)return jh;C_=1;var e=qu(),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 jh=n,jh}var Th,j_;function lF(){if(j_)return Th;j_=1;var e=rF(),t=sF(),n=oF(),s=iF(),i=aF();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,Th=a,Th}var Rh,T_;function cF(){if(T_)return Rh;T_=1;var e=lF(),t=Lu(),n=Iw();function s(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return Rh=s,Rh}var Ah,R_;function uF(){if(R_)return Ah;R_=1;function e(t){var n=typeof t;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?t!=="__proto__":t===null}return Ah=e,Ah}var Mh,A_;function Du(){if(A_)return Mh;A_=1;var e=uF();function t(n,s){var i=n.__data__;return e(s)?i[typeof s=="string"?"string":"hash"]:i.map}return Mh=t,Mh}var Ih,M_;function dF(){if(M_)return Ih;M_=1;var e=Du();function t(n){var s=e(this,n).delete(n);return this.size-=s?1:0,s}return Ih=t,Ih}var Oh,I_;function fF(){if(I_)return Oh;I_=1;var e=Du();function t(n){return e(this,n).get(n)}return Oh=t,Oh}var Ph,O_;function hF(){if(O_)return Ph;O_=1;var e=Du();function t(n){return e(this,n).has(n)}return Ph=t,Ph}var $h,P_;function pF(){if(P_)return $h;P_=1;var e=Du();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 $h=t,$h}var Lh,$_;function Ow(){if($_)return Lh;$_=1;var e=cF(),t=dF(),n=fF(),s=hF(),i=pF();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,L_;function mF(){if(L_)return qh;L_=1;var e=Lu(),t=Iw(),n=Ow(),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 qh=i,qh}var Dh,q_;function Fu(){if(q_)return Dh;q_=1;var e=Lu(),t=V5(),n=Y5(),s=K5(),i=X5(),a=mF();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,Dh=l,Dh}var Fh,D_;function Pw(){if(D_)return Fh;D_=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 Fh=e,Fh}var zh,F_;function WT(){if(F_)return zh;F_=1;var e=So(),t=(function(){try{var n=e(Object,"defineProperty");return n({},"",{}),n}catch{}})();return zh=t,zh}var Bh,z_;function zu(){if(z_)return Bh;z_=1;var e=WT();function t(n,s,i){s=="__proto__"&&e?e(n,s,{configurable:!0,enumerable:!0,value:i,writable:!0}):n[s]=i}return Bh=t,Bh}var Uh,B_;function Bu(){if(B_)return Uh;B_=1;var e=zu(),t=Vi(),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 Uh=i,Uh}var Wh,U_;function Sl(){if(U_)return Wh;U_=1;var e=Bu(),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 Wh=n,Wh}var Hh,W_;function gF(){if(W_)return Hh;W_=1;function e(t,n){for(var s=-1,i=Array(t);++s<t;)i[s]=n(s);return i}return Hh=e,Hh}var Gh,H_;function Er(){if(H_)return Gh;H_=1;function e(t){return t!=null&&typeof t=="object"}return Gh=e,Gh}var Vh,G_;function vF(){if(G_)return Vh;G_=1;var e=ko(),t=Er(),n="[object Arguments]";function s(i){return t(i)&&e(i)==n}return Vh=s,Vh}var Yh,V_;function Nl(){if(V_)return Yh;V_=1;var e=vF(),t=Er(),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 Yh=a,Yh}var Kh,Y_;function Mt(){if(Y_)return Kh;Y_=1;var e=Array.isArray;return Kh=e,Kh}var Xa={exports:{}},Xh,K_;function yF(){if(K_)return Xh;K_=1;function e(){return!1}return Xh=e,Xh}Xa.exports;var X_;function Ki(){return X_||(X_=1,(function(e,t){var n=ur(),s=yF(),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})(Xa,Xa.exports)),Xa.exports}var Qh,Q_;function Uu(){if(Q_)return Qh;Q_=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 Qh=n,Qh}var Zh,Z_;function $w(){if(Z_)return Zh;Z_=1;var e=9007199254740991;function t(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=e}return Zh=t,Zh}var Jh,J_;function wF(){if(J_)return Jh;J_=1;var e=ko(),t=$w(),n=Er(),s="[object Arguments]",i="[object Array]",a="[object Boolean]",l="[object Date]",u="[object Error]",h="[object Function]",p="[object Map]",f="[object Number]",g="[object Object]",y="[object RegExp]",w="[object Set]",S="[object String]",b="[object WeakMap]",_="[object ArrayBuffer]",k="[object DataView]",E="[object Float32Array]",C="[object Float64Array]",j="[object Int8Array]",I="[object Int16Array]",O="[object Int32Array]",P="[object Uint8Array]",F="[object Uint8ClampedArray]",M="[object Uint16Array]",A="[object Uint32Array]",q={};q[E]=q[C]=q[j]=q[I]=q[O]=q[P]=q[F]=q[M]=q[A]=!0,q[s]=q[i]=q[_]=q[a]=q[k]=q[l]=q[u]=q[h]=q[p]=q[f]=q[g]=q[y]=q[w]=q[S]=q[b]=!1;function W(V){return n(V)&&t(V.length)&&!!q[e(V)]}return Jh=W,Jh}var ep,ek;function Wu(){if(ek)return ep;ek=1;function e(t){return function(n){return t(n)}}return ep=e,ep}var Qa={exports:{}};Qa.exports;var tk;function Lw(){return tk||(tk=1,(function(e,t){var n=BT(),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})(Qa,Qa.exports)),Qa.exports}var tp,nk;function El(){if(nk)return tp;nk=1;var e=wF(),t=Wu(),n=Lw(),s=n&&n.isTypedArray,i=s?t(s):e;return tp=i,tp}var np,rk;function HT(){if(rk)return np;rk=1;var e=gF(),t=Nl(),n=Mt(),s=Ki(),i=Uu(),a=El(),l=Object.prototype,u=l.hasOwnProperty;function h(p,f){var g=n(p),y=!g&&t(p),w=!g&&!y&&s(p),S=!g&&!y&&!w&&a(p),b=g||y||w||S,_=b?e(p.length,String):[],k=_.length;for(var E in p)(f||u.call(p,E))&&!(b&&(E=="length"||w&&(E=="offset"||E=="parent")||S&&(E=="buffer"||E=="byteLength"||E=="byteOffset")||i(E,k)))&&_.push(E);return _}return np=h,np}var rp,sk;function Hu(){if(sk)return rp;sk=1;var e=Object.prototype;function t(n){var s=n&&n.constructor,i=typeof s=="function"&&s.prototype||e;return n===i}return rp=t,rp}var sp,ok;function GT(){if(ok)return sp;ok=1;function e(t,n){return function(s){return t(n(s))}}return sp=e,sp}var op,ik;function xF(){if(ik)return op;ik=1;var e=GT(),t=e(Object.keys,Object);return op=t,op}var ip,ak;function qw(){if(ak)return ip;ak=1;var e=Hu(),t=xF(),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 ip=i,ip}var ap,lk;function Jr(){if(lk)return ap;lk=1;var e=kl(),t=$w();function n(s){return s!=null&&t(s.length)&&!e(s)}return ap=n,ap}var lp,ck;function Ps(){if(ck)return lp;ck=1;var e=HT(),t=qw(),n=Jr();function s(i){return n(i)?e(i):t(i)}return lp=s,lp}var cp,uk;function bF(){if(uk)return cp;uk=1;var e=Sl(),t=Ps();function n(s,i){return s&&e(i,t(i),s)}return cp=n,cp}var up,dk;function _F(){if(dk)return up;dk=1;function e(t){var n=[];if(t!=null)for(var s in Object(t))n.push(s);return n}return up=e,up}var dp,fk;function kF(){if(fk)return dp;fk=1;var e=qn(),t=Hu(),n=_F(),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 dp=a,dp}var fp,hk;function No(){if(hk)return fp;hk=1;var e=HT(),t=kF(),n=Jr();function s(i){return n(i)?e(i,!0):t(i)}return fp=s,fp}var hp,pk;function SF(){if(pk)return hp;pk=1;var e=Sl(),t=No();function n(s,i){return s&&e(i,t(i),s)}return hp=n,hp}var Za={exports:{}};Za.exports;var mk;function VT(){return mk||(mk=1,(function(e,t){var n=ur(),s=t&&!t.nodeType&&t,i=s&&!0&&e&&!e.nodeType&&e,a=i&&i.exports===s,l=a?n.Buffer:void 0,u=l?l.allocUnsafe:void 0;function h(p,f){if(f)return p.slice();var g=p.length,y=u?u(g):new p.constructor(g);return p.copy(y),y}e.exports=h})(Za,Za.exports)),Za.exports}var pp,gk;function YT(){if(gk)return pp;gk=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 pp=e,pp}var mp,vk;function KT(){if(vk)return mp;vk=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 mp=e,mp}var gp,yk;function XT(){if(yk)return gp;yk=1;function e(){return[]}return gp=e,gp}var vp,wk;function Dw(){if(wk)return vp;wk=1;var e=KT(),t=XT(),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 vp=a,vp}var yp,xk;function NF(){if(xk)return yp;xk=1;var e=Sl(),t=Dw();function n(s,i){return e(s,t(s),i)}return yp=n,yp}var wp,bk;function Fw(){if(bk)return wp;bk=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 wp=e,wp}var xp,_k;function Gu(){if(_k)return xp;_k=1;var e=GT(),t=e(Object.getPrototypeOf,Object);return xp=t,xp}var bp,kk;function QT(){if(kk)return bp;kk=1;var e=Fw(),t=Gu(),n=Dw(),s=XT(),i=Object.getOwnPropertySymbols,a=i?function(l){for(var u=[];l;)e(u,n(l)),l=t(l);return u}:s;return bp=a,bp}var _p,Sk;function EF(){if(Sk)return _p;Sk=1;var e=Sl(),t=QT();function n(s,i){return e(s,t(s),i)}return _p=n,_p}var kp,Nk;function ZT(){if(Nk)return kp;Nk=1;var e=Fw(),t=Mt();function n(s,i,a){var l=i(s);return t(s)?l:e(l,a(s))}return kp=n,kp}var Sp,Ek;function JT(){if(Ek)return Sp;Ek=1;var e=ZT(),t=Dw(),n=Ps();function s(i){return e(i,n,t)}return Sp=s,Sp}var Np,Ck;function CF(){if(Ck)return Np;Ck=1;var e=ZT(),t=QT(),n=No();function s(i){return e(i,n,t)}return Np=s,Np}var Ep,jk;function jF(){if(jk)return Ep;jk=1;var e=So(),t=ur(),n=e(t,"DataView");return Ep=n,Ep}var Cp,Tk;function TF(){if(Tk)return Cp;Tk=1;var e=So(),t=ur(),n=e(t,"Promise");return Cp=n,Cp}var jp,Rk;function eR(){if(Rk)return jp;Rk=1;var e=So(),t=ur(),n=e(t,"Set");return jp=n,jp}var Tp,Ak;function RF(){if(Ak)return Tp;Ak=1;var e=So(),t=ur(),n=e(t,"WeakMap");return Tp=n,Tp}var Rp,Mk;function Xi(){if(Mk)return Rp;Mk=1;var e=jF(),t=Iw(),n=TF(),s=eR(),i=RF(),a=ko(),l=UT(),u="[object Map]",h="[object Object]",p="[object Promise]",f="[object Set]",g="[object WeakMap]",y="[object DataView]",w=l(e),S=l(t),b=l(n),_=l(s),k=l(i),E=a;return(e&&E(new e(new ArrayBuffer(1)))!=y||t&&E(new t)!=u||n&&E(n.resolve())!=p||s&&E(new s)!=f||i&&E(new i)!=g)&&(E=function(C){var j=a(C),I=j==h?C.constructor:void 0,O=I?l(I):"";if(O)switch(O){case w:return y;case S:return u;case b:return p;case _:return f;case k:return g}return j}),Rp=E,Rp}var Ap,Ik;function AF(){if(Ik)return Ap;Ik=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 Ap=n,Ap}var Mp,Ok;function tR(){if(Ok)return Mp;Ok=1;var e=ur(),t=e.Uint8Array;return Mp=t,Mp}var Ip,Pk;function zw(){if(Pk)return Ip;Pk=1;var e=tR();function t(n){var s=new n.constructor(n.byteLength);return new e(s).set(new e(n)),s}return Ip=t,Ip}var Op,$k;function MF(){if($k)return Op;$k=1;var e=zw();function t(n,s){var i=s?e(n.buffer):n.buffer;return new n.constructor(i,n.byteOffset,n.byteLength)}return Op=t,Op}var Pp,Lk;function IF(){if(Lk)return Pp;Lk=1;var e=/\w*$/;function t(n){var s=new n.constructor(n.source,e.exec(n));return s.lastIndex=n.lastIndex,s}return Pp=t,Pp}var $p,qk;function OF(){if(qk)return $p;qk=1;var e=Yi(),t=e?e.prototype:void 0,n=t?t.valueOf:void 0;function s(i){return n?Object(n.call(i)):{}}return $p=s,$p}var Lp,Dk;function nR(){if(Dk)return Lp;Dk=1;var e=zw();function t(n,s){var i=s?e(n.buffer):n.buffer;return new n.constructor(i,n.byteOffset,n.length)}return Lp=t,Lp}var qp,Fk;function PF(){if(Fk)return qp;Fk=1;var e=zw(),t=MF(),n=IF(),s=OF(),i=nR(),a="[object Boolean]",l="[object Date]",u="[object Map]",h="[object Number]",p="[object RegExp]",f="[object Set]",g="[object String]",y="[object Symbol]",w="[object ArrayBuffer]",S="[object DataView]",b="[object Float32Array]",_="[object Float64Array]",k="[object Int8Array]",E="[object Int16Array]",C="[object Int32Array]",j="[object Uint8Array]",I="[object Uint8ClampedArray]",O="[object Uint16Array]",P="[object Uint32Array]";function F(M,A,q){var W=M.constructor;switch(A){case w:return e(M);case a:case l:return new W(+M);case S:return t(M,q);case b:case _:case k:case E:case C:case j:case I:case O:case P:return i(M,q);case u:return new W;case h:case g:return new W(M);case p:return n(M);case f:return new W;case y:return s(M)}}return qp=F,qp}var Dp,zk;function rR(){if(zk)return Dp;zk=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 Dp=n,Dp}var Fp,Bk;function sR(){if(Bk)return Fp;Bk=1;var e=rR(),t=Gu(),n=Hu();function s(i){return typeof i.constructor=="function"&&!n(i)?e(t(i)):{}}return Fp=s,Fp}var zp,Uk;function $F(){if(Uk)return zp;Uk=1;var e=Xi(),t=Er(),n="[object Map]";function s(i){return t(i)&&e(i)==n}return zp=s,zp}var Bp,Wk;function LF(){if(Wk)return Bp;Wk=1;var e=$F(),t=Wu(),n=Lw(),s=n&&n.isMap,i=s?t(s):e;return Bp=i,Bp}var Up,Hk;function qF(){if(Hk)return Up;Hk=1;var e=Xi(),t=Er(),n="[object Set]";function s(i){return t(i)&&e(i)==n}return Up=s,Up}var Wp,Gk;function DF(){if(Gk)return Wp;Gk=1;var e=qF(),t=Wu(),n=Lw(),s=n&&n.isSet,i=s?t(s):e;return Wp=i,Wp}var Hp,Vk;function oR(){if(Vk)return Hp;Vk=1;var e=Fu(),t=Pw(),n=Bu(),s=bF(),i=SF(),a=VT(),l=YT(),u=NF(),h=EF(),p=JT(),f=CF(),g=Xi(),y=AF(),w=PF(),S=sR(),b=Mt(),_=Ki(),k=LF(),E=qn(),C=DF(),j=Ps(),I=No(),O=1,P=2,F=4,M="[object Arguments]",A="[object Array]",q="[object Boolean]",W="[object Date]",V="[object Error]",T="[object Function]",Q="[object GeneratorFunction]",U="[object Map]",ne="[object Number]",X="[object Object]",H="[object RegExp]",J="[object Set]",$="[object String]",G="[object Symbol]",Z="[object WeakMap]",D="[object ArrayBuffer]",L="[object DataView]",Y="[object Float32Array]",re="[object Float64Array]",he="[object Int8Array]",pe="[object Int16Array]",we="[object Int32Array]",Ce="[object Uint8Array]",Ve="[object Uint8ClampedArray]",Be="[object Uint16Array]",Le="[object Uint32Array]",ke={};ke[M]=ke[A]=ke[D]=ke[L]=ke[q]=ke[W]=ke[Y]=ke[re]=ke[he]=ke[pe]=ke[we]=ke[U]=ke[ne]=ke[X]=ke[H]=ke[J]=ke[$]=ke[G]=ke[Ce]=ke[Ve]=ke[Be]=ke[Le]=!0,ke[V]=ke[T]=ke[Z]=!1;function ce(be,xe,Ye,ut,at,de){var _e,De=xe&O,Ge=xe&P,lt=xe&F;if(Ye&&(_e=at?Ye(be,ut,at,de):Ye(be)),_e!==void 0)return _e;if(!E(be))return be;var je=b(be);if(je){if(_e=y(be),!De)return l(be,_e)}else{var He=g(be),Ke=He==T||He==Q;if(_(be))return a(be,De);if(He==X||He==M||Ke&&!at){if(_e=Ge||Ke?{}:S(be),!De)return Ge?h(be,i(_e,be)):u(be,s(_e,be))}else{if(!ke[He])return at?be:{};_e=w(be,He,De)}}de||(de=new e);var oe=de.get(be);if(oe)return oe;de.set(be,_e),C(be)?be.forEach(function(Te){_e.add(ce(Te,xe,Ye,Te,be,de))}):k(be)&&be.forEach(function(Te,Xe){_e.set(Xe,ce(Te,xe,Ye,Xe,be,de))});var Ie=lt?Ge?f:p:Ge?I:j,Oe=je?void 0:Ie(be);return t(Oe||be,function(Te,Xe){Oe&&(Xe=Te,Te=be[Xe]),n(_e,Xe,ce(Te,xe,Ye,Xe,be,de))}),_e}return Hp=ce,Hp}var Gp,Yk;function FF(){if(Yk)return Gp;Yk=1;var e=oR(),t=4;function n(s){return e(s,t)}return Gp=n,Gp}var Vp,Kk;function Bw(){if(Kk)return Vp;Kk=1;function e(t){return function(){return t}}return Vp=e,Vp}var Yp,Xk;function zF(){if(Xk)return Yp;Xk=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 Yp=e,Yp}var Kp,Qk;function Uw(){if(Qk)return Kp;Qk=1;var e=zF(),t=e();return Kp=t,Kp}var Xp,Zk;function Ww(){if(Zk)return Xp;Zk=1;var e=Uw(),t=Ps();function n(s,i){return s&&e(s,i,t)}return Xp=n,Xp}var Qp,Jk;function BF(){if(Jk)return Qp;Jk=1;var e=Jr();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 Qp=t,Qp}var Zp,eS;function Vu(){if(eS)return Zp;eS=1;var e=Ww(),t=BF(),n=t(e);return Zp=n,Zp}var Jp,tS;function Eo(){if(tS)return Jp;tS=1;function e(t){return t}return Jp=e,Jp}var em,nS;function iR(){if(nS)return em;nS=1;var e=Eo();function t(n){return typeof n=="function"?n:e}return em=t,em}var tm,rS;function aR(){if(rS)return tm;rS=1;var e=Pw(),t=Vu(),n=iR(),s=Mt();function i(a,l){var u=s(a)?e:t;return u(a,n(l))}return tm=i,tm}var nm,sS;function lR(){return sS||(sS=1,nm=aR()),nm}var rm,oS;function UF(){if(oS)return rm;oS=1;var e=Vu();function t(n,s){var i=[];return e(n,function(a,l,u){s(a,l,u)&&i.push(a)}),i}return rm=t,rm}var sm,iS;function WF(){if(iS)return sm;iS=1;var e="__lodash_hash_undefined__";function t(n){return this.__data__.set(n,e),this}return sm=t,sm}var om,aS;function HF(){if(aS)return om;aS=1;function e(t){return this.__data__.has(t)}return om=e,om}var im,lS;function cR(){if(lS)return im;lS=1;var e=Ow(),t=WF(),n=HF();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,im=s,im}var am,cS;function GF(){if(cS)return am;cS=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 am=e,am}var lm,uS;function uR(){if(uS)return lm;uS=1;function e(t,n){return t.has(n)}return lm=e,lm}var cm,dS;function dR(){if(dS)return cm;dS=1;var e=cR(),t=GF(),n=uR(),s=1,i=2;function a(l,u,h,p,f,g){var y=h&s,w=l.length,S=u.length;if(w!=S&&!(y&&S>w))return!1;var b=g.get(l),_=g.get(u);if(b&&_)return b==u&&_==l;var k=-1,E=!0,C=h&i?new e:void 0;for(g.set(l,u),g.set(u,l);++k<w;){var j=l[k],I=u[k];if(p)var O=y?p(I,j,k,u,l,g):p(j,I,k,l,u,g);if(O!==void 0){if(O)continue;E=!1;break}if(C){if(!t(u,function(P,F){if(!n(C,F)&&(j===P||f(j,P,h,p,g)))return C.push(F)})){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 cm=a,cm}var um,fS;function VF(){if(fS)return um;fS=1;function e(t){var n=-1,s=Array(t.size);return t.forEach(function(i,a){s[++n]=[a,i]}),s}return um=e,um}var dm,hS;function Hw(){if(hS)return dm;hS=1;function e(t){var n=-1,s=Array(t.size);return t.forEach(function(i){s[++n]=i}),s}return dm=e,dm}var fm,pS;function YF(){if(pS)return fm;pS=1;var e=Yi(),t=tR(),n=Vi(),s=dR(),i=VF(),a=Hw(),l=1,u=2,h="[object Boolean]",p="[object Date]",f="[object Error]",g="[object Map]",y="[object Number]",w="[object RegExp]",S="[object Set]",b="[object String]",_="[object Symbol]",k="[object ArrayBuffer]",E="[object DataView]",C=e?e.prototype:void 0,j=C?C.valueOf:void 0;function I(O,P,F,M,A,q,W){switch(F){case E:if(O.byteLength!=P.byteLength||O.byteOffset!=P.byteOffset)return!1;O=O.buffer,P=P.buffer;case k:return!(O.byteLength!=P.byteLength||!q(new t(O),new t(P)));case h:case p:case y: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 V=i;case S:var T=M&l;if(V||(V=a),O.size!=P.size&&!T)return!1;var Q=W.get(O);if(Q)return Q==P;M|=u,W.set(O,P);var U=s(V(O),V(P),M,A,q,W);return W.delete(O),U;case _:if(j)return j.call(O)==j.call(P)}return!1}return fm=I,fm}var hm,mS;function KF(){if(mS)return hm;mS=1;var e=JT(),t=1,n=Object.prototype,s=n.hasOwnProperty;function i(a,l,u,h,p,f){var g=u&t,y=e(a),w=y.length,S=e(l),b=S.length;if(w!=b&&!g)return!1;for(var _=w;_--;){var k=y[_];if(!(g?k in l:s.call(l,k)))return!1}var E=f.get(a),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;++_<w;){k=y[_];var O=a[k],P=l[k];if(h)var F=g?h(P,O,k,l,a,f):h(O,P,k,a,l,f);if(!(F===void 0?O===P||p(O,P,u,h,f):F)){j=!1;break}I||(I=k=="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 hm=i,hm}var pm,gS;function XF(){if(gS)return pm;gS=1;var e=Fu(),t=dR(),n=YF(),s=KF(),i=Xi(),a=Mt(),l=Ki(),u=El(),h=1,p="[object Arguments]",f="[object Array]",g="[object Object]",y=Object.prototype,w=y.hasOwnProperty;function S(b,_,k,E,C,j){var I=a(b),O=a(_),P=I?f:i(b),F=O?f:i(_);P=P==p?g:P,F=F==p?g:F;var M=P==g,A=F==g,q=P==F;if(q&&l(b)){if(!l(_))return!1;I=!0,M=!1}if(q&&!M)return j||(j=new e),I||u(b)?t(b,_,k,E,C,j):n(b,_,P,k,E,C,j);if(!(k&h)){var W=M&&w.call(b,"__wrapped__"),V=A&&w.call(_,"__wrapped__");if(W||V){var T=W?b.value():b,Q=V?_.value():_;return j||(j=new e),C(T,Q,k,E,j)}}return q?(j||(j=new e),s(b,_,k,E,C,j)):!1}return pm=S,pm}var mm,vS;function fR(){if(vS)return mm;vS=1;var e=XF(),t=Er();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 mm=n,mm}var gm,yS;function QF(){if(yS)return gm;yS=1;var e=Fu(),t=fR(),n=1,s=2;function i(a,l,u,h){var p=u.length,f=p,g=!h;if(a==null)return!f;for(a=Object(a);p--;){var y=u[p];if(g&&y[2]?y[1]!==a[y[0]]:!(y[0]in a))return!1}for(;++p<f;){y=u[p];var w=y[0],S=a[w],b=y[1];if(g&&y[2]){if(S===void 0&&!(w in a))return!1}else{var _=new e;if(h)var k=h(S,b,w,a,l,_);if(!(k===void 0?t(b,S,n|s,h,_):k))return!1}}return!0}return gm=i,gm}var vm,wS;function hR(){if(wS)return vm;wS=1;var e=qn();function t(n){return n===n&&!e(n)}return vm=t,vm}var ym,xS;function ZF(){if(xS)return ym;xS=1;var e=hR(),t=Ps();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 ym=n,ym}var wm,bS;function pR(){if(bS)return wm;bS=1;function e(t,n){return function(s){return s==null?!1:s[t]===n&&(n!==void 0||t in Object(s))}}return wm=e,wm}var xm,_S;function JF(){if(_S)return xm;_S=1;var e=QF(),t=ZF(),n=pR();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 xm=s,xm}var bm,kS;function Qi(){if(kS)return bm;kS=1;var e=ko(),t=Er(),n="[object Symbol]";function s(i){return typeof i=="symbol"||t(i)&&e(i)==n}return bm=s,bm}var _m,SS;function Gw(){if(SS)return _m;SS=1;var e=Mt(),t=Qi(),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 _m=i,_m}var km,NS;function e6(){if(NS)return km;NS=1;var e=Ow(),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,km=n,km}var Sm,ES;function t6(){if(ES)return Sm;ES=1;var e=e6(),t=500;function n(s){var i=e(s,function(l){return a.size===t&&a.clear(),l}),a=i.cache;return i}return Sm=n,Sm}var Nm,CS;function n6(){if(CS)return Nm;CS=1;var e=t6(),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 Nm=s,Nm}var Em,jS;function Yu(){if(jS)return Em;jS=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 Em=e,Em}var Cm,TS;function r6(){if(TS)return Cm;TS=1;var e=Yi(),t=Yu(),n=Mt(),s=Qi(),i=e?e.prototype:void 0,a=i?i.toString:void 0;function l(u){if(typeof u=="string")return u;if(n(u))return t(u,l)+"";if(s(u))return a?a.call(u):"";var h=u+"";return h=="0"&&1/u==-1/0?"-0":h}return Cm=l,Cm}var jm,RS;function mR(){if(RS)return jm;RS=1;var e=r6();function t(n){return n==null?"":e(n)}return jm=t,jm}var Tm,AS;function Ku(){if(AS)return Tm;AS=1;var e=Mt(),t=Gw(),n=n6(),s=mR();function i(a,l){return e(a)?a:t(a,l)?[a]:n(s(a))}return Tm=i,Tm}var Rm,MS;function Cl(){if(MS)return Rm;MS=1;var e=Qi();function t(n){if(typeof n=="string"||e(n))return n;var s=n+"";return s=="0"&&1/n==-1/0?"-0":s}return Rm=t,Rm}var Am,IS;function Xu(){if(IS)return Am;IS=1;var e=Ku(),t=Cl();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 Am=n,Am}var Mm,OS;function s6(){if(OS)return Mm;OS=1;var e=Xu();function t(n,s,i){var a=n==null?void 0:e(n,s);return a===void 0?i:a}return Mm=t,Mm}var Im,PS;function o6(){if(PS)return Im;PS=1;function e(t,n){return t!=null&&n in Object(t)}return Im=e,Im}var Om,$S;function gR(){if($S)return Om;$S=1;var e=Ku(),t=Nl(),n=Mt(),s=Uu(),i=$w(),a=Cl();function l(u,h,p){h=e(h,u);for(var f=-1,g=h.length,y=!1;++f<g;){var w=a(h[f]);if(!(y=u!=null&&p(u,w)))break;u=u[w]}return y||++f!=g?y:(g=u==null?0:u.length,!!g&&i(g)&&s(w,g)&&(n(u)||t(u)))}return Om=l,Om}var Pm,LS;function vR(){if(LS)return Pm;LS=1;var e=o6(),t=gR();function n(s,i){return s!=null&&t(s,i,e)}return Pm=n,Pm}var $m,qS;function i6(){if(qS)return $m;qS=1;var e=fR(),t=s6(),n=vR(),s=Gw(),i=hR(),a=pR(),l=Cl(),u=1,h=2;function p(f,g){return s(f)&&i(g)?a(l(f),g):function(y){var w=t(y,f);return w===void 0&&w===g?n(y,f):e(g,w,u|h)}}return $m=p,$m}var Lm,DS;function yR(){if(DS)return Lm;DS=1;function e(t){return function(n){return n==null?void 0:n[t]}}return Lm=e,Lm}var qm,FS;function a6(){if(FS)return qm;FS=1;var e=Xu();function t(n){return function(s){return e(s,n)}}return qm=t,qm}var Dm,zS;function l6(){if(zS)return Dm;zS=1;var e=yR(),t=a6(),n=Gw(),s=Cl();function i(a){return n(a)?e(s(a)):t(a)}return Dm=i,Dm}var Fm,BS;function es(){if(BS)return Fm;BS=1;var e=JF(),t=i6(),n=Eo(),s=Mt(),i=l6();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 Fm=a,Fm}var zm,US;function wR(){if(US)return zm;US=1;var e=KT(),t=UF(),n=es(),s=Mt();function i(a,l){var u=s(a)?e:t;return u(a,n(l,3))}return zm=i,zm}var Bm,WS;function c6(){if(WS)return Bm;WS=1;var e=Object.prototype,t=e.hasOwnProperty;function n(s,i){return s!=null&&t.call(s,i)}return Bm=n,Bm}var Um,HS;function xR(){if(HS)return Um;HS=1;var e=c6(),t=gR();function n(s,i){return s!=null&&t(s,i,e)}return Um=n,Um}var Wm,GS;function u6(){if(GS)return Wm;GS=1;var e=qw(),t=Xi(),n=Nl(),s=Mt(),i=Jr(),a=Ki(),l=Hu(),u=El(),h="[object Map]",p="[object Set]",f=Object.prototype,g=f.hasOwnProperty;function y(w){if(w==null)return!0;if(i(w)&&(s(w)||typeof w=="string"||typeof w.splice=="function"||a(w)||u(w)||n(w)))return!w.length;var S=t(w);if(S==h||S==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 Wm=y,Wm}var Hm,VS;function bR(){if(VS)return Hm;VS=1;function e(t){return t===void 0}return Hm=e,Hm}var Gm,YS;function _R(){if(YS)return Gm;YS=1;var e=Vu(),t=Jr();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 Gm=n,Gm}var Vm,KS;function kR(){if(KS)return Vm;KS=1;var e=Yu(),t=es(),n=_R(),s=Mt();function i(a,l){var u=s(a)?e:n;return u(a,t(l,3))}return Vm=i,Vm}var Ym,XS;function d6(){if(XS)return Ym;XS=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 Ym=e,Ym}var Km,QS;function f6(){if(QS)return Km;QS=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 Km=e,Km}var Xm,ZS;function SR(){if(ZS)return Xm;ZS=1;var e=d6(),t=Vu(),n=es(),s=f6(),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 Xm=a,Xm}var Qm,JS;function h6(){if(JS)return Qm;JS=1;var e=ko(),t=Mt(),n=Er(),s="[object String]";function i(a){return typeof a=="string"||!t(a)&&n(a)&&e(a)==s}return Qm=i,Qm}var Zm,eN;function p6(){if(eN)return Zm;eN=1;var e=yR(),t=e("length");return Zm=t,Zm}var Jm,tN;function m6(){if(tN)return Jm;tN=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 Jm=h,Jm}var eg,nN;function g6(){if(nN)return eg;nN=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",s="\\u20d0-\\u20ff",i=t+n+s,a="\\ufe0e\\ufe0f",l="["+e+"]",u="["+i+"]",h="\\ud83c[\\udffb-\\udfff]",p="(?:"+u+"|"+h+")",f="[^"+e+"]",g="(?:\\ud83c[\\udde6-\\uddff]){2}",y="[\\ud800-\\udbff][\\udc00-\\udfff]",w="\\u200d",S=p+"?",b="["+a+"]?",_="(?:"+w+"(?:"+[f,g,y].join("|")+")"+b+S+")*",k=b+S+_,E="(?:"+[f+u+"?",u,g,y,l].join("|")+")",C=RegExp(h+"(?="+h+")|"+E+k,"g");function j(I){for(var O=C.lastIndex=0;C.test(I);)++O;return O}return eg=j,eg}var tg,rN;function v6(){if(rN)return tg;rN=1;var e=p6(),t=m6(),n=g6();function s(i){return t(i)?n(i):e(i)}return tg=s,tg}var ng,sN;function y6(){if(sN)return ng;sN=1;var e=qw(),t=Xi(),n=Jr(),s=h6(),i=v6(),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 ng=u,ng}var rg,oN;function w6(){if(oN)return rg;oN=1;var e=Pw(),t=rR(),n=Ww(),s=es(),i=Gu(),a=Mt(),l=Ki(),u=kl(),h=qn(),p=El();function f(g,y,w){var S=a(g),b=S||l(g)||p(g);if(y=s(y,4),w==null){var _=g&&g.constructor;b?w=S?new _:[]:h(g)?w=u(_)?t(i(g)):{}:w={}}return(b?e:n)(g,function(k,E,C){return y(w,k,E,C)}),w}return rg=f,rg}var sg,iN;function x6(){if(iN)return sg;iN=1;var e=Yi(),t=Nl(),n=Mt(),s=e?e.isConcatSpreadable:void 0;function i(a){return n(a)||t(a)||!!(s&&a&&a[s])}return sg=i,sg}var og,aN;function Vw(){if(aN)return og;aN=1;var e=Fw(),t=x6();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 og=n,og}var ig,lN;function b6(){if(lN)return ig;lN=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 ig=e,ig}var ag,cN;function NR(){if(cN)return ag;cN=1;var e=b6(),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 ag=n,ag}var lg,uN;function _6(){if(uN)return lg;uN=1;var e=Bw(),t=WT(),n=Eo(),s=t?function(i,a){return t(i,"toString",{configurable:!0,enumerable:!1,value:e(a),writable:!0})}:n;return lg=s,lg}var cg,dN;function k6(){if(dN)return cg;dN=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 cg=s,cg}var ug,fN;function ER(){if(fN)return ug;fN=1;var e=_6(),t=k6(),n=t(e);return ug=n,ug}var dg,hN;function Qu(){if(hN)return dg;hN=1;var e=Eo(),t=NR(),n=ER();function s(i,a){return n(t(i,a,e),i+"")}return dg=s,dg}var fg,pN;function CR(){if(pN)return fg;pN=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 fg=e,fg}var hg,mN;function S6(){if(mN)return hg;mN=1;function e(t){return t!==t}return hg=e,hg}var pg,gN;function N6(){if(gN)return pg;gN=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 pg=e,pg}var mg,vN;function E6(){if(vN)return mg;vN=1;var e=CR(),t=S6(),n=N6();function s(i,a,l){return a===a?n(i,a,l):e(i,t,l)}return mg=s,mg}var gg,yN;function C6(){if(yN)return gg;yN=1;var e=E6();function t(n,s){var i=n==null?0:n.length;return!!i&&e(n,s,0)>-1}return gg=t,gg}var vg,wN;function j6(){if(wN)return vg;wN=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 vg=e,vg}var yg,xN;function T6(){if(xN)return yg;xN=1;function e(){}return yg=e,yg}var wg,bN;function R6(){if(bN)return wg;bN=1;var e=eR(),t=T6(),n=Hw(),s=1/0,i=e&&1/n(new e([,-0]))[1]==s?function(a){return new e(a)}:t;return wg=i,wg}var xg,_N;function A6(){if(_N)return xg;_N=1;var e=cR(),t=C6(),n=j6(),s=uR(),i=R6(),a=Hw(),l=200;function u(h,p,f){var g=-1,y=t,w=h.length,S=!0,b=[],_=b;if(f)S=!1,y=n;else if(w>=l){var k=p?null:i(h);if(k)return a(k);S=!1,y=s,_=new e}else _=p?[]:b;e:for(;++g<w;){var E=h[g],C=p?p(E):E;if(E=f||E!==0?E:0,S&&C===C){for(var j=_.length;j--;)if(_[j]===C)continue e;p&&_.push(C),b.push(E)}else y(_,C,f)||(_!==b&&_.push(C),b.push(E))}return b}return xg=u,xg}var bg,kN;function jR(){if(kN)return bg;kN=1;var e=Jr(),t=Er();function n(s){return t(s)&&e(s)}return bg=n,bg}var _g,SN;function M6(){if(SN)return _g;SN=1;var e=Vw(),t=Qu(),n=A6(),s=jR(),i=t(function(a){return n(e(a,1,s,!0))});return _g=i,_g}var kg,NN;function I6(){if(NN)return kg;NN=1;var e=Yu();function t(n,s){return e(s,function(i){return n[i]})}return kg=t,kg}var Sg,EN;function TR(){if(EN)return Sg;EN=1;var e=I6(),t=Ps();function n(s){return s==null?[]:e(s,t(s))}return Sg=n,Sg}var Ng,CN;function Dn(){if(CN)return Ng;CN=1;var e;if(typeof Mw=="function")try{e={clone:FF(),constant:Bw(),each:lR(),filter:wR(),has:xR(),isArray:Mt(),isEmpty:u6(),isFunction:kl(),isUndefined:bR(),keys:Ps(),map:kR(),reduce:SR(),size:y6(),transform:w6(),union:M6(),values:TR()}}catch{}return e||(e=window._),Ng=e,Ng}var Eg,jN;function Yw(){if(jN)return Eg;jN=1;var e=Dn();Eg=i;var t="\0",n="\0",s="";function i(f){this._isDirected=e.has(f,"directed")?f.directed:!0,this._isMultigraph=e.has(f,"multigraph")?f.multigraph:!1,this._isCompound=e.has(f,"compound")?f.compound:!1,this._label=void 0,this._defaultNodeLabelFn=e.constant(void 0),this._defaultEdgeLabelFn=e.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[n]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}i.prototype._nodeCount=0,i.prototype._edgeCount=0,i.prototype.isDirected=function(){return this._isDirected},i.prototype.isMultigraph=function(){return this._isMultigraph},i.prototype.isCompound=function(){return this._isCompound},i.prototype.setGraph=function(f){return this._label=f,this},i.prototype.graph=function(){return this._label},i.prototype.setDefaultNodeLabel=function(f){return e.isFunction(f)||(f=e.constant(f)),this._defaultNodeLabelFn=f,this},i.prototype.nodeCount=function(){return this._nodeCount},i.prototype.nodes=function(){return e.keys(this._nodes)},i.prototype.sources=function(){var f=this;return e.filter(this.nodes(),function(g){return e.isEmpty(f._in[g])})},i.prototype.sinks=function(){var f=this;return e.filter(this.nodes(),function(g){return e.isEmpty(f._out[g])})},i.prototype.setNodes=function(f,g){var y=arguments,w=this;return e.each(f,function(S){y.length>1?w.setNode(S,g):w.setNode(S)}),this},i.prototype.setNode=function(f,g){return e.has(this._nodes,f)?(arguments.length>1&&(this._nodes[f]=g),this):(this._nodes[f]=arguments.length>1?g:this._defaultNodeLabelFn(f),this._isCompound&&(this._parent[f]=n,this._children[f]={},this._children[n][f]=!0),this._in[f]={},this._preds[f]={},this._out[f]={},this._sucs[f]={},++this._nodeCount,this)},i.prototype.node=function(f){return this._nodes[f]},i.prototype.hasNode=function(f){return e.has(this._nodes,f)},i.prototype.removeNode=function(f){var g=this;if(e.has(this._nodes,f)){var y=function(w){g.removeEdge(g._edgeObjs[w])};delete this._nodes[f],this._isCompound&&(this._removeFromParentsChildList(f),delete this._parent[f],e.each(this.children(f),function(w){g.setParent(w)}),delete this._children[f]),e.each(e.keys(this._in[f]),y),delete this._in[f],delete this._preds[f],e.each(e.keys(this._out[f]),y),delete this._out[f],delete this._sucs[f],--this._nodeCount}return this},i.prototype.setParent=function(f,g){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(e.isUndefined(g))g=n;else{g+="";for(var y=g;!e.isUndefined(y);y=this.parent(y))if(y===f)throw new Error("Setting "+g+" as parent of "+f+" would create a cycle");this.setNode(g)}return this.setNode(f),this._removeFromParentsChildList(f),this._parent[f]=g,this._children[g][f]=!0,this},i.prototype._removeFromParentsChildList=function(f){delete this._children[this._parent[f]][f]},i.prototype.parent=function(f){if(this._isCompound){var g=this._parent[f];if(g!==n)return g}},i.prototype.children=function(f){if(e.isUndefined(f)&&(f=n),this._isCompound){var g=this._children[f];if(g)return e.keys(g)}else{if(f===n)return this.nodes();if(this.hasNode(f))return[]}},i.prototype.predecessors=function(f){var g=this._preds[f];if(g)return e.keys(g)},i.prototype.successors=function(f){var g=this._sucs[f];if(g)return e.keys(g)},i.prototype.neighbors=function(f){var g=this.predecessors(f);if(g)return e.union(g,this.successors(f))},i.prototype.isLeaf=function(f){var g;return this.isDirected()?g=this.successors(f):g=this.neighbors(f),g.length===0},i.prototype.filterNodes=function(f){var g=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});g.setGraph(this.graph());var y=this;e.each(this._nodes,function(b,_){f(_)&&g.setNode(_,b)}),e.each(this._edgeObjs,function(b){g.hasNode(b.v)&&g.hasNode(b.w)&&g.setEdge(b,y.edge(b))});var w={};function S(b){var _=y.parent(b);return _===void 0||g.hasNode(_)?(w[b]=_,_):_ in w?w[_]:S(_)}return this._isCompound&&e.each(g.nodes(),function(b){g.setParent(b,S(b))}),g},i.prototype.setDefaultEdgeLabel=function(f){return e.isFunction(f)||(f=e.constant(f)),this._defaultEdgeLabelFn=f,this},i.prototype.edgeCount=function(){return this._edgeCount},i.prototype.edges=function(){return e.values(this._edgeObjs)},i.prototype.setPath=function(f,g){var y=this,w=arguments;return e.reduce(f,function(S,b){return w.length>1?y.setEdge(S,b,g):y.setEdge(S,b),b}),this},i.prototype.setEdge=function(){var f,g,y,w,S=!1,b=arguments[0];typeof b=="object"&&b!==null&&"v"in b?(f=b.v,g=b.w,y=b.name,arguments.length===2&&(w=arguments[1],S=!0)):(f=b,g=arguments[1],y=arguments[3],arguments.length>2&&(w=arguments[2],S=!0)),f=""+f,g=""+g,e.isUndefined(y)||(y=""+y);var _=u(this._isDirected,f,g,y);if(e.has(this._edgeLabels,_))return S&&(this._edgeLabels[_]=w),this;if(!e.isUndefined(y)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(f),this.setNode(g),this._edgeLabels[_]=S?w:this._defaultEdgeLabelFn(f,g,y);var k=h(this._isDirected,f,g,y);return f=k.v,g=k.w,Object.freeze(k),this._edgeObjs[_]=k,a(this._preds[g],f),a(this._sucs[f],g),this._in[g][_]=k,this._out[f][_]=k,this._edgeCount++,this},i.prototype.edge=function(f,g,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):u(this._isDirected,f,g,y);return this._edgeLabels[w]},i.prototype.hasEdge=function(f,g,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):u(this._isDirected,f,g,y);return e.has(this._edgeLabels,w)},i.prototype.removeEdge=function(f,g,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):u(this._isDirected,f,g,y),S=this._edgeObjs[w];return S&&(f=S.v,g=S.w,delete this._edgeLabels[w],delete this._edgeObjs[w],l(this._preds[g],f),l(this._sucs[f],g),delete this._in[g][w],delete this._out[f][w],this._edgeCount--),this},i.prototype.inEdges=function(f,g){var y=this._in[f];if(y){var w=e.values(y);return g?e.filter(w,function(S){return S.v===g}):w}},i.prototype.outEdges=function(f,g){var y=this._out[f];if(y){var w=e.values(y);return g?e.filter(w,function(S){return S.w===g}):w}},i.prototype.nodeEdges=function(f,g){var y=this.inEdges(f,g);if(y)return y.concat(this.outEdges(f,g))};function a(f,g){f[g]?f[g]++:f[g]=1}function l(f,g){--f[g]||delete f[g]}function u(f,g,y,w){var S=""+g,b=""+y;if(!f&&S>b){var _=S;S=b,b=_}return S+s+b+s+(e.isUndefined(w)?t:w)}function h(f,g,y,w){var S=""+g,b=""+y;if(!f&&S>b){var _=S;S=b,b=_}var k={v:S,w:b};return w&&(k.name=w),k}function p(f,g){return u(f,g.v,g.w,g.name)}return Eg}var Cg,TN;function O6(){return TN||(TN=1,Cg="2.1.8"),Cg}var jg,RN;function P6(){return RN||(RN=1,jg={Graph:Yw(),version:O6()}),jg}var Tg,AN;function $6(){if(AN)return Tg;AN=1;var e=Dn(),t=Yw();Tg={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 Tg}var Rg,MN;function L6(){if(MN)return Rg;MN=1;var e=Dn();Rg=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 Rg}var Ag,IN;function RR(){if(IN)return Ag;IN=1;var e=Dn();Ag=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},Ag}var Mg,ON;function AR(){if(ON)return Mg;ON=1;var e=Dn(),t=RR();Mg=s;var n=e.constant(1);function s(a,l,u,h){return i(a,String(l),u||n,h||function(p){return a.outEdges(p)})}function i(a,l,u,h){var p={},f=new t,g,y,w=function(S){var b=S.v!==g?S.v:S.w,_=p[b],k=u(S),E=y.distance+k;if(k<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+S+" Weight: "+k);E<_.distance&&(_.distance=E,_.predecessor=g,f.decrease(b,E))};for(a.nodes().forEach(function(S){var b=S===l?0:Number.POSITIVE_INFINITY;p[S]={distance:b},f.add(S,b)});f.size()>0&&(g=f.removeMin(),y=p[g],y.distance!==Number.POSITIVE_INFINITY);)h(g).forEach(w);return p}return Mg}var Ig,PN;function q6(){if(PN)return Ig;PN=1;var e=AR(),t=Dn();Ig=n;function n(s,i,a){return t.transform(s.nodes(),function(l,u){l[u]=e(s,u,i,a)},{})}return Ig}var Og,$N;function MR(){if($N)return Og;$N=1;var e=Dn();Og=t;function t(n){var s=0,i=[],a={},l=[];function u(h){var p=a[h]={onStack:!0,lowlink:s,index:s++};if(i.push(h),n.successors(h).forEach(function(y){e.has(a,y)?a[y].onStack&&(p.lowlink=Math.min(p.lowlink,a[y].index)):(u(y),p.lowlink=Math.min(p.lowlink,a[y].lowlink))}),p.lowlink===p.index){var f=[],g;do g=i.pop(),a[g].onStack=!1,f.push(g);while(h!==g);l.push(f)}}return n.nodes().forEach(function(h){e.has(a,h)||u(h)}),l}return Og}var Pg,LN;function D6(){if(LN)return Pg;LN=1;var e=Dn(),t=MR();Pg=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 Pg}var $g,qN;function F6(){if(qN)return $g;qN=1;var e=Dn();$g=n;var t=e.constant(1);function n(i,a,l){return s(i,a||t,l||function(u){return i.outEdges(u)})}function s(i,a,l){var u={},h=i.nodes();return h.forEach(function(p){u[p]={},u[p][p]={distance:0},h.forEach(function(f){p!==f&&(u[p][f]={distance:Number.POSITIVE_INFINITY})}),l(p).forEach(function(f){var g=f.v===p?f.w:f.v,y=a(f);u[p][g]={distance:y,predecessor:p}})}),h.forEach(function(p){var f=u[p];h.forEach(function(g){var y=u[g];h.forEach(function(w){var S=y[p],b=f[w],_=y[w],k=S.distance+b.distance;k<_.distance&&(_.distance=k,_.predecessor=b.predecessor)})})}),u}return $g}var Lg,DN;function IR(){if(DN)return Lg;DN=1;var e=Dn();Lg=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,Lg}var qg,FN;function z6(){if(FN)return qg;FN=1;var e=IR();qg=t;function t(n){try{e(n)}catch(s){if(s instanceof e.CycleException)return!1;throw s}return!0}return qg}var Dg,zN;function OR(){if(zN)return Dg;zN=1;var e=Dn();Dg=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 Dg}var Fg,BN;function B6(){if(BN)return Fg;BN=1;var e=OR();Fg=t;function t(n,s){return e(n,s,"post")}return Fg}var zg,UN;function U6(){if(UN)return zg;UN=1;var e=OR();zg=t;function t(n,s){return e(n,s,"pre")}return zg}var Bg,WN;function W6(){if(WN)return Bg;WN=1;var e=Dn(),t=Yw(),n=RR();Bg=s;function s(i,a){var l=new t,u={},h=new n,p;function f(y){var w=y.v===p?y.w:y.v,S=h.priority(w);if(S!==void 0){var b=a(y);b<S&&(u[w]=p,h.decrease(w,b))}}if(i.nodeCount()===0)return l;e.each(i.nodes(),function(y){h.add(y,Number.POSITIVE_INFINITY),l.setNode(y)}),h.decrease(i.nodes()[0],0);for(var g=!1;h.size()>0;){if(p=h.removeMin(),e.has(u,p))l.setEdge(p,u[p]);else{if(g)throw new Error("Input graph is not connected: "+i);g=!0}i.nodeEdges(p).forEach(f)}return l}return Bg}var Ug,HN;function H6(){return HN||(HN=1,Ug={components:L6(),dijkstra:AR(),dijkstraAll:q6(),findCycles:D6(),floydWarshall:F6(),isAcyclic:z6(),postorder:B6(),preorder:U6(),prim:W6(),tarjan:MR(),topsort:IR()}),Ug}var Wg,GN;function G6(){if(GN)return Wg;GN=1;var e=P6();return Wg={Graph:e.Graph,json:$6(),alg:H6(),version:e.version},Wg}var Hg,VN;function lr(){if(VN)return Hg;VN=1;var e;if(typeof Mw=="function")try{e=G6()}catch{}return e||(e=window.graphlib),Hg=e,Hg}var Gg,YN;function V6(){if(YN)return Gg;YN=1;var e=oR(),t=1,n=4;function s(i){return e(i,t|n)}return Gg=s,Gg}var Vg,KN;function Zu(){if(KN)return Vg;KN=1;var e=Vi(),t=Jr(),n=Uu(),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 Vg=i,Vg}var Yg,XN;function Y6(){if(XN)return Yg;XN=1;var e=Qu(),t=Vi(),n=Zu(),s=No(),i=Object.prototype,a=i.hasOwnProperty,l=e(function(u,h){u=Object(u);var p=-1,f=h.length,g=f>2?h[2]:void 0;for(g&&n(h[0],h[1],g)&&(f=1);++p<f;)for(var y=h[p],w=s(y),S=-1,b=w.length;++S<b;){var _=w[S],k=u[_];(k===void 0||t(k,i[_])&&!a.call(u,_))&&(u[_]=y[_])}return u});return Yg=l,Yg}var Kg,QN;function K6(){if(QN)return Kg;QN=1;var e=es(),t=Jr(),n=Ps();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 Kg=s,Kg}var Xg,ZN;function X6(){if(ZN)return Xg;ZN=1;var e=/\s/;function t(n){for(var s=n.length;s--&&e.test(n.charAt(s)););return s}return Xg=t,Xg}var Qg,JN;function Q6(){if(JN)return Qg;JN=1;var e=X6(),t=/^\s+/;function n(s){return s&&s.slice(0,e(s)+1).replace(t,"")}return Qg=n,Qg}var Zg,eE;function Z6(){if(eE)return Zg;eE=1;var e=Q6(),t=qn(),n=Qi(),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 Zg=h,Zg}var Jg,tE;function PR(){if(tE)return Jg;tE=1;var e=Z6(),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 Jg=s,Jg}var ev,nE;function J6(){if(nE)return ev;nE=1;var e=PR();function t(n){var s=e(n),i=s%1;return s===s?i?s-i:s:0}return ev=t,ev}var tv,rE;function ez(){if(rE)return tv;rE=1;var e=CR(),t=es(),n=J6(),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 tv=i,tv}var nv,sE;function tz(){if(sE)return nv;sE=1;var e=K6(),t=ez(),n=e(t);return nv=n,nv}var rv,oE;function $R(){if(oE)return rv;oE=1;var e=Vw();function t(n){var s=n==null?0:n.length;return s?e(n,1):[]}return rv=t,rv}var sv,iE;function nz(){if(iE)return sv;iE=1;var e=Uw(),t=iR(),n=No();function s(i,a){return i==null?i:e(i,t(a),n)}return sv=s,sv}var ov,aE;function rz(){if(aE)return ov;aE=1;function e(t){var n=t==null?0:t.length;return n?t[n-1]:void 0}return ov=e,ov}var iv,lE;function sz(){if(lE)return iv;lE=1;var e=zu(),t=Ww(),n=es();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 iv=s,iv}var av,cE;function Kw(){if(cE)return av;cE=1;var e=Qi();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 av=t,av}var lv,uE;function oz(){if(uE)return lv;uE=1;function e(t,n){return t>n}return lv=e,lv}var cv,dE;function iz(){if(dE)return cv;dE=1;var e=Kw(),t=oz(),n=Eo();function s(i){return i&&i.length?e(i,n,t):void 0}return cv=s,cv}var uv,fE;function LR(){if(fE)return uv;fE=1;var e=zu(),t=Vi();function n(s,i,a){(a!==void 0&&!t(s[i],a)||a===void 0&&!(i in s))&&e(s,i,a)}return uv=n,uv}var dv,hE;function az(){if(hE)return dv;hE=1;var e=ko(),t=Gu(),n=Er(),s="[object Object]",i=Function.prototype,a=Object.prototype,l=i.toString,u=a.hasOwnProperty,h=l.call(Object);function p(f){if(!n(f)||e(f)!=s)return!1;var g=t(f);if(g===null)return!0;var y=u.call(g,"constructor")&&g.constructor;return typeof y=="function"&&y instanceof y&&l.call(y)==h}return dv=p,dv}var fv,pE;function qR(){if(pE)return fv;pE=1;function e(t,n){if(!(n==="constructor"&&typeof t[n]=="function")&&n!="__proto__")return t[n]}return fv=e,fv}var hv,mE;function lz(){if(mE)return hv;mE=1;var e=Sl(),t=No();function n(s){return e(s,t(s))}return hv=n,hv}var pv,gE;function cz(){if(gE)return pv;gE=1;var e=LR(),t=VT(),n=nR(),s=YT(),i=sR(),a=Nl(),l=Mt(),u=jR(),h=Ki(),p=kl(),f=qn(),g=az(),y=El(),w=qR(),S=lz();function b(_,k,E,C,j,I,O){var P=w(_,E),F=w(k,E),M=O.get(F);if(M){e(_,E,M);return}var A=I?I(P,F,E+"",_,k,O):void 0,q=A===void 0;if(q){var W=l(F),V=!W&&h(F),T=!W&&!V&&y(F);A=F,W||V||T?l(P)?A=P:u(P)?A=s(P):V?(q=!1,A=t(F,!0)):T?(q=!1,A=n(F,!0)):A=[]:g(F)||a(F)?(A=P,a(P)?A=S(P):(!f(P)||p(P))&&(A=i(F))):q=!1}q&&(O.set(F,A),j(A,F,C,I,O),O.delete(F)),e(_,E,A)}return pv=b,pv}var mv,vE;function uz(){if(vE)return mv;vE=1;var e=Fu(),t=LR(),n=Uw(),s=cz(),i=qn(),a=No(),l=qR();function u(h,p,f,g,y){h!==p&&n(p,function(w,S){if(y||(y=new e),i(w))s(h,p,S,f,u,g,y);else{var b=g?g(l(h,S),w,S+"",h,p,y):void 0;b===void 0&&(b=w),t(h,S,b)}},a)}return mv=u,mv}var gv,yE;function dz(){if(yE)return gv;yE=1;var e=Qu(),t=Zu();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 gv=n,gv}var vv,wE;function fz(){if(wE)return vv;wE=1;var e=uz(),t=dz(),n=t(function(s,i,a){e(s,i,a)});return vv=n,vv}var yv,xE;function DR(){if(xE)return yv;xE=1;function e(t,n){return t<n}return yv=e,yv}var wv,bE;function hz(){if(bE)return wv;bE=1;var e=Kw(),t=DR(),n=Eo();function s(i){return i&&i.length?e(i,n,t):void 0}return wv=s,wv}var xv,_E;function pz(){if(_E)return xv;_E=1;var e=Kw(),t=es(),n=DR();function s(i,a){return i&&i.length?e(i,t(a,2),n):void 0}return xv=s,xv}var bv,kE;function mz(){if(kE)return bv;kE=1;var e=ur(),t=function(){return e.Date.now()};return bv=t,bv}var _v,SE;function gz(){if(SE)return _v;SE=1;var e=Bu(),t=Ku(),n=Uu(),s=qn(),i=Cl();function a(l,u,h,p){if(!s(l))return l;u=t(u,l);for(var f=-1,g=u.length,y=g-1,w=l;w!=null&&++f<g;){var S=i(u[f]),b=h;if(S==="__proto__"||S==="constructor"||S==="prototype")return l;if(f!=y){var _=w[S];b=p?p(_,S,w):void 0,b===void 0&&(b=s(_)?_:n(u[f+1])?[]:{})}e(w,S,b),w=w[S]}return l}return _v=a,_v}var kv,NE;function vz(){if(NE)return kv;NE=1;var e=Xu(),t=gz(),n=Ku();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 kv=s,kv}var Sv,EE;function yz(){if(EE)return Sv;EE=1;var e=vz(),t=vR();function n(s,i){return e(s,i,function(a,l){return t(s,l)})}return Sv=n,Sv}var Nv,CE;function wz(){if(CE)return Nv;CE=1;var e=$R(),t=NR(),n=ER();function s(i){return n(t(i,void 0,e),i+"")}return Nv=s,Nv}var Ev,jE;function xz(){if(jE)return Ev;jE=1;var e=yz(),t=wz(),n=t(function(s,i){return s==null?{}:e(s,i)});return Ev=n,Ev}var Cv,TE;function bz(){if(TE)return Cv;TE=1;var e=Math.ceil,t=Math.max;function n(s,i,a,l){for(var u=-1,h=t(e((i-s)/(a||1)),0),p=Array(h);h--;)p[l?h:++u]=s,s+=a;return p}return Cv=n,Cv}var jv,RE;function _z(){if(RE)return jv;RE=1;var e=bz(),t=Zu(),n=PR();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 jv=s,jv}var Tv,AE;function kz(){if(AE)return Tv;AE=1;var e=_z(),t=e();return Tv=t,Tv}var Rv,ME;function Sz(){if(ME)return Rv;ME=1;function e(t,n){var s=t.length;for(t.sort(n);s--;)t[s]=t[s].value;return t}return Rv=e,Rv}var Av,IE;function Nz(){if(IE)return Av;IE=1;var e=Qi();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 Av=t,Av}var Mv,OE;function Ez(){if(OE)return Mv;OE=1;var e=Nz();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 Mv=t,Mv}var Iv,PE;function Cz(){if(PE)return Iv;PE=1;var e=Yu(),t=Xu(),n=es(),s=_R(),i=Sz(),a=Wu(),l=Ez(),u=Eo(),h=Mt();function p(f,g,y){g.length?g=e(g,function(b){return h(b)?function(_){return t(_,b.length===1?b[0]:b)}:b}):g=[u];var w=-1;g=e(g,a(n));var S=s(f,function(b,_,k){var E=e(g,function(C){return C(b)});return{criteria:E,index:++w,value:b}});return i(S,function(b,_){return l(b,_,y)})}return Iv=p,Iv}var Ov,$E;function jz(){if($E)return Ov;$E=1;var e=Vw(),t=Cz(),n=Qu(),s=Zu(),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 Ov=i,Ov}var Pv,LE;function Tz(){if(LE)return Pv;LE=1;var e=mR(),t=0;function n(s){var i=++t;return e(s)+i}return Pv=n,Pv}var $v,qE;function Rz(){if(qE)return $v;qE=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 $v=e,$v}var Lv,DE;function Az(){if(DE)return Lv;DE=1;var e=Bu(),t=Rz();function n(s,i){return t(s||[],i||[],e)}return Lv=n,Lv}var qv,FE;function yt(){if(FE)return qv;FE=1;var e;if(typeof Mw=="function")try{e={cloneDeep:V6(),constant:Bw(),defaults:Y6(),each:lR(),filter:wR(),find:tz(),flatten:$R(),forEach:aR(),forIn:nz(),has:xR(),isUndefined:bR(),last:rz(),map:kR(),mapValues:sz(),max:iz(),merge:fz(),min:hz(),minBy:pz(),now:mz(),pick:xz(),range:kz(),reduce:SR(),sortBy:jz(),uniqueId:Tz(),values:TR(),zipObject:Az()}}catch{}return e||(e=window._),qv=e,qv}var Dv,zE;function Mz(){if(zE)return Dv;zE=1,Dv=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 Dv}var Fv,BE;function Iz(){if(BE)return Fv;BE=1;var e=yt(),t=lr().Graph,n=Mz();Fv=i;var s=e.constant(1);function i(p,f){if(p.nodeCount()<=1)return[];var g=u(p,f||s),y=a(g.graph,g.buckets,g.zeroIdx);return e.flatten(e.map(y,function(w){return p.outEdges(w.v,w.w)}),!0)}function a(p,f,g){for(var y=[],w=f[f.length-1],S=f[0],b;p.nodeCount();){for(;b=S.dequeue();)l(p,f,g,b);for(;b=w.dequeue();)l(p,f,g,b);if(p.nodeCount()){for(var _=f.length-2;_>0;--_)if(b=f[_].dequeue(),b){y=y.concat(l(p,f,g,b,!0));break}}}return y}function l(p,f,g,y,w){var S=w?[]:void 0;return e.forEach(p.inEdges(y.v),function(b){var _=p.edge(b),k=p.node(b.v);w&&S.push({v:b.v,w:b.w}),k.out-=_,h(f,g,k)}),e.forEach(p.outEdges(y.v),function(b){var _=p.edge(b),k=b.w,E=p.node(k);E.in-=_,h(f,g,E)}),p.removeNode(y.v),S}function u(p,f){var g=new t,y=0,w=0;e.forEach(p.nodes(),function(_){g.setNode(_,{v:_,in:0,out:0})}),e.forEach(p.edges(),function(_){var k=g.edge(_.v,_.w)||0,E=f(_),C=k+E;g.setEdge(_.v,_.w,C),w=Math.max(w,g.node(_.v).out+=E),y=Math.max(y,g.node(_.w).in+=E)});var S=e.range(w+y+3).map(function(){return new n}),b=y+1;return e.forEach(g.nodes(),function(_){h(S,b,g.node(_))}),{graph:g,buckets:S,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 Fv}var zv,UE;function Oz(){if(UE)return zv;UE=1;var e=yt(),t=Iz();zv={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 zv}var Bv,WE;function hn(){if(WE)return Bv;WE=1;var e=yt(),t=lr().Graph;Bv={addDummyNode:n,simplify:s,asNonCompoundGraph:i,successorWeights:a,predecessorWeights:l,intersectRect:u,buildLayerMatrix:h,normalizeRanks:p,removeEmptyRanks:f,addBorderNode:g,maxRank:y,partition:w,time:S,notime:b};function n(_,k,E,C){var j;do j=e.uniqueId(C);while(_.hasNode(j));return E.dummy=k,_.setNode(j,E),j}function s(_){var k=new t().setGraph(_.graph());return e.forEach(_.nodes(),function(E){k.setNode(E,_.node(E))}),e.forEach(_.edges(),function(E){var C=k.edge(E.v,E.w)||{weight:0,minlen:1},j=_.edge(E);k.setEdge(E.v,E.w,{weight:C.weight+j.weight,minlen:Math.max(C.minlen,j.minlen)})}),k}function i(_){var k=new t({multigraph:_.isMultigraph()}).setGraph(_.graph());return e.forEach(_.nodes(),function(E){_.children(E).length||k.setNode(E,_.node(E))}),e.forEach(_.edges(),function(E){k.setEdge(E,_.edge(E))}),k}function a(_){var k=e.map(_.nodes(),function(E){var C={};return e.forEach(_.outEdges(E),function(j){C[j.w]=(C[j.w]||0)+_.edge(j).weight}),C});return e.zipObject(_.nodes(),k)}function l(_){var k=e.map(_.nodes(),function(E){var C={};return e.forEach(_.inEdges(E),function(j){C[j.v]=(C[j.v]||0)+_.edge(j).weight}),C});return e.zipObject(_.nodes(),k)}function u(_,k){var E=_.x,C=_.y,j=k.x-E,I=k.y-C,O=_.width/2,P=_.height/2;if(!j&&!I)throw new Error("Not possible to find intersection inside of the rectangle");var F,M;return Math.abs(I)*O>Math.abs(j)*P?(I<0&&(P=-P),F=P*j/I,M=P):(j<0&&(O=-O),F=O,M=O*I/j),{x:E+F,y:C+M}}function h(_){var k=e.map(e.range(y(_)+1),function(){return[]});return e.forEach(_.nodes(),function(E){var C=_.node(E),j=C.rank;e.isUndefined(j)||(k[j][C.order]=E)}),k}function p(_){var k=e.min(e.map(_.nodes(),function(E){return _.node(E).rank}));e.forEach(_.nodes(),function(E){var C=_.node(E);e.has(C,"rank")&&(C.rank-=k)})}function f(_){var k=e.min(e.map(_.nodes(),function(I){return _.node(I).rank})),E=[];e.forEach(_.nodes(),function(I){var O=_.node(I).rank-k;E[O]||(E[O]=[]),E[O].push(I)});var C=0,j=_.graph().nodeRankFactor;e.forEach(E,function(I,O){e.isUndefined(I)&&O%j!==0?--C:C&&e.forEach(I,function(P){_.node(P).rank+=C})})}function g(_,k,E,C){var j={width:0,height:0};return arguments.length>=4&&(j.rank=E,j.order=C),n(_,"border",j,k)}function y(_){return e.max(e.map(_.nodes(),function(k){var E=_.node(k).rank;if(!e.isUndefined(E))return E}))}function w(_,k){var E={lhs:[],rhs:[]};return e.forEach(_,function(C){k(C)?E.lhs.push(C):E.rhs.push(C)}),E}function S(_,k){var E=e.now();try{return k()}finally{console.log(_+" time: "+(e.now()-E)+"ms")}}function b(_,k){return k()}return Bv}var Uv,HE;function Pz(){if(HE)return Uv;HE=1;var e=yt(),t=hn();Uv={run:n,undo:i};function n(a){a.graph().dummyChains=[],e.forEach(a.edges(),function(l){s(a,l)})}function s(a,l){var u=l.v,h=a.node(u).rank,p=l.w,f=a.node(p).rank,g=l.name,y=a.edge(l),w=y.labelRank;if(f!==h+1){a.removeEdge(l);var S,b,_;for(_=0,++h;h<f;++_,++h)y.points=[],b={width:0,height:0,edgeLabel:y,edgeObj:l,rank:h},S=t.addDummyNode(a,"edge",b,"_d"),h===w&&(b.width=y.width,b.height=y.height,b.dummy="edge-label",b.labelpos=y.labelpos),a.setEdge(u,S,{weight:y.weight},g),_===0&&a.graph().dummyChains.push(S),u=S;a.setEdge(u,p,{weight:y.weight},g)}}function i(a){e.forEach(a.graph().dummyChains,function(l){var u=a.node(l),h=u.edgeLabel,p;for(a.setEdge(u.edgeObj,h);u.dummy;)p=a.successors(l)[0],a.removeNode(l),h.points.push({x:u.x,y:u.y}),u.dummy==="edge-label"&&(h.x=u.x,h.y=u.y,h.width=u.width,h.height=u.height),l=p,u=a.node(l)})}return Uv}var Wv,GE;function _u(){if(GE)return Wv;GE=1;var e=yt();Wv={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 Wv}var Hv,VE;function FR(){if(VE)return Hv;VE=1;var e=yt(),t=lr().Graph,n=_u().slack;Hv=s;function s(u){var h=new t({directed:!1}),p=u.nodes()[0],f=u.nodeCount();h.setNode(p,{});for(var g,y;i(h,u)<f;)g=a(h,u),y=h.hasNode(g.v)?n(u,g):-n(u,g),l(h,u,y);return h}function i(u,h){function p(f){e.forEach(h.nodeEdges(f),function(g){var y=g.v,w=f===y?g.w:y;!u.hasNode(w)&&!n(h,g)&&(u.setNode(w,{}),u.setEdge(f,w,{}),p(w))})}return e.forEach(u.nodes(),p),u.nodeCount()}function a(u,h){return e.minBy(h.edges(),function(p){if(u.hasNode(p.v)!==u.hasNode(p.w))return n(h,p)})}function l(u,h,p){e.forEach(u.nodes(),function(f){h.node(f).rank+=p})}return Hv}var Gv,YE;function $z(){if(YE)return Gv;YE=1;var e=yt(),t=FR(),n=_u().slack,s=_u().longestPath,i=lr().alg.preorder,a=lr().alg.postorder,l=hn().simplify;Gv=u,u.initLowLimValues=g,u.initCutValues=h,u.calcCutValue=f,u.leaveEdge=w,u.enterEdge=S,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=S(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,F=!0,M=j.edge(I,P),A=0;return M||(F=!1,M=j.edge(P,I)),A=M.weight,e.forEach(j.nodeEdges(I),function(q){var W=q.v===I,V=W?q.w:q.v;if(V!==P){var T=W===F,Q=j.edge(q).weight;if(A+=T?Q:-Q,k(C,I,V)){var U=C.edge(I,V).cutvalue;A+=T?-U:U}}}),A}function g(C,j){arguments.length<2&&(j=C.nodes()[0]),y(C,{},1,j)}function y(C,j,I,O,P){var F=I,M=C.node(O);return j[O]=!0,e.forEach(C.neighbors(O),function(A){e.has(j,A)||(I=y(C,j,I,A,O))}),M.low=F,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 S(C,j,I){var O=I.v,P=I.w;j.hasEdge(O,P)||(O=I.w,P=I.v);var F=C.node(O),M=C.node(P),A=F,q=!1;F.lim>M.lim&&(A=M,q=!0);var W=e.filter(j.edges(),function(V){return q===E(C,C.node(V.v),A)&&q!==E(C,C.node(V.w),A)});return e.minBy(W,function(V){return n(j,V)})}function b(C,j,I,O){var P=I.v,F=I.w;C.removeEdge(P,F),C.setEdge(O.v,O.w,{}),g(C),h(C,j),_(C,j)}function _(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 F=C.node(P).parent,M=j.edge(P,F),A=!1;M||(M=j.edge(F,P),A=!0),j.node(P).rank=j.node(F).rank+(A?M.minlen:-M.minlen)})}function k(C,j,I){return C.hasEdge(j,I)}function E(C,j,I){return I.low<=j.lim&&j.lim<=I.lim}return Gv}var Vv,KE;function Lz(){if(KE)return Vv;KE=1;var e=_u(),t=e.longestPath,n=FR(),s=$z();Vv=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 Vv}var Yv,XE;function qz(){if(XE)return Yv;XE=1;var e=yt();Yv=t;function t(i){var a=s(i);e.forEach(i.graph().dummyChains,function(l){for(var u=i.node(l),h=u.edgeObj,p=n(i,a,h.v,h.w),f=p.path,g=p.lca,y=0,w=f[y],S=!0;l!==h.w;){if(u=i.node(l),S){for(;(w=f[y])!==g&&i.node(w).maxRank<u.rank;)y++;w===g&&(S=!1)}if(!S){for(;y<f.length-1&&i.node(w=f[y+1]).minRank<=u.rank;)y++;w=f[y]}i.setParent(l,w),l=i.successors(l)[0]}})}function n(i,a,l,u){var h=[],p=[],f=Math.min(a[l].low,a[u].low),g=Math.max(a[l].lim,a[u].lim),y,w;y=l;do y=i.parent(y),h.push(y);while(y&&(a[y].low>f||g>a[y].lim));for(w=y,y=u;(y=i.parent(y))!==w;)p.push(y);return{path:h.concat(p.reverse()),lca:w}}function s(i){var a={},l=0;function u(h){var p=l;e.forEach(i.children(h),u),a[h]={low:p,lim:l++}}return e.forEach(i.children(),u),a}return Yv}var Kv,QE;function Dz(){if(QE)return Kv;QE=1;var e=yt(),t=hn();Kv={run:n,cleanup:l};function n(u){var h=t.addDummyNode(u,"root",{},"_root"),p=i(u),f=e.max(e.values(p))-1,g=2*f+1;u.graph().nestingRoot=h,e.forEach(u.edges(),function(w){u.edge(w).minlen*=g});var y=a(u)+1;e.forEach(u.children(),function(w){s(u,h,g,y,f,p,w)}),u.graph().nodeRankFactor=g}function s(u,h,p,f,g,y,w){var S=u.children(w);if(!S.length){w!==h&&u.setEdge(h,w,{weight:0,minlen:p});return}var b=t.addBorderNode(u,"_bt"),_=t.addBorderNode(u,"_bb"),k=u.node(w);u.setParent(b,w),k.borderTop=b,u.setParent(_,w),k.borderBottom=_,e.forEach(S,function(E){s(u,h,p,f,g,y,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-y[w]+1;u.setEdge(b,j,{weight:O,minlen:P,nestingEdge:!0}),u.setEdge(I,_,{weight:O,minlen:P,nestingEdge:!0})}),u.parent(w)||u.setEdge(h,b,{weight:0,minlen:g+y[w]})}function i(u){var h={};function p(f,g){var y=u.children(f);y&&y.length&&e.forEach(y,function(w){p(w,g+1)}),h[f]=g}return e.forEach(u.children(),function(f){p(f,1)}),h}function a(u){return e.reduce(u.edges(),function(h,p){return h+u.edge(p).weight},0)}function l(u){var h=u.graph();u.removeNode(h.nestingRoot),delete h.nestingRoot,e.forEach(u.edges(),function(p){var f=u.edge(p);f.nestingEdge&&u.removeEdge(p)})}return Kv}var Xv,ZE;function Fz(){if(ZE)return Xv;ZE=1;var e=yt(),t=hn();Xv=n;function n(i){function a(l){var u=i.children(l),h=i.node(l);if(u.length&&e.forEach(u,a),e.has(h,"minRank")){h.borderLeft=[],h.borderRight=[];for(var p=h.minRank,f=h.maxRank+1;p<f;++p)s(i,"borderLeft","_bl",l,h,p),s(i,"borderRight","_br",l,h,p)}}e.forEach(i.children(),a)}function s(i,a,l,u,h,p){var f={width:0,height:0,rank:p,borderType:a},g=h[a][p-1],y=t.addDummyNode(i,"border",f,l);h[a][p]=y,i.setParent(y,u),g&&i.setEdge(g,y,{weight:1})}return Xv}var Qv,JE;function zz(){if(JE)return Qv;JE=1;var e=yt();Qv={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 Qv}var Zv,eC;function Bz(){if(eC)return Zv;eC=1;var e=yt();Zv=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 Zv}var Jv,tC;function Uz(){if(tC)return Jv;tC=1;var e=yt();Jv=t;function t(s,i){for(var a=0,l=1;l<i.length;++l)a+=n(s,i[l-1],i[l]);return a}function n(s,i,a){for(var l=e.zipObject(a,e.map(a,function(y,w){return w})),u=e.flatten(e.map(i,function(y){return e.sortBy(e.map(s.outEdges(y),function(w){return{pos:l[w.w],weight:s.edge(w).weight}}),"pos")}),!0),h=1;h<a.length;)h<<=1;var p=2*h-1;h-=1;var f=e.map(new Array(p),function(){return 0}),g=0;return e.forEach(u.forEach(function(y){var w=y.pos+h;f[w]+=y.weight;for(var S=0;w>0;)w%2&&(S+=f[w+1]),w=w-1>>1,f[w]+=y.weight;g+=y.weight*S})),g}return Jv}var ey,nC;function Wz(){if(nC)return ey;nC=1;var e=yt();ey=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 ey}var ty,rC;function Hz(){if(rC)return ty;rC=1;var e=yt();ty=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 ty}var ny,sC;function Gz(){if(sC)return ny;sC=1;var e=yt(),t=hn();ny=n;function n(a,l){var u=t.partition(a,function(b){return e.has(b,"barycenter")}),h=u.lhs,p=e.sortBy(u.rhs,function(b){return-b.i}),f=[],g=0,y=0,w=0;h.sort(i(!!l)),w=s(f,p,w),e.forEach(h,function(b){w+=b.vs.length,f.push(b.vs),g+=b.barycenter*b.weight,y+=b.weight,w=s(f,p,w)});var S={vs:e.flatten(f,!0)};return y&&(S.barycenter=g/y,S.weight=y),S}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 ny}var ry,oC;function Vz(){if(oC)return ry;oC=1;var e=yt(),t=Wz(),n=Hz(),s=Gz();ry=i;function i(u,h,p,f){var g=u.children(h),y=u.node(h),w=y?y.borderLeft:void 0,S=y?y.borderRight:void 0,b={};w&&(g=e.filter(g,function(I){return I!==w&&I!==S}));var _=t(u,g);e.forEach(_,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 k=n(_,p);a(k,b);var E=s(k,f);if(w&&(E.vs=e.flatten([w,E.vs,S],!0),u.predecessors(w).length)){var C=u.node(u.predecessors(w)[0]),j=u.node(u.predecessors(S)[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 ry}var sy,iC;function Yz(){if(iC)return sy;iC=1;var e=yt(),t=lr().Graph;sy=n;function n(i,a,l){var u=s(i),h=new t({compound:!0}).setGraph({root:u}).setDefaultNodeLabel(function(p){return i.node(p)});return e.forEach(i.nodes(),function(p){var f=i.node(p),g=i.parent(p);(f.rank===a||f.minRank<=a&&a<=f.maxRank)&&(h.setNode(p),h.setParent(p,g||u),e.forEach(i[l](p),function(y){var w=y.v===p?y.w:y.v,S=h.edge(w,p),b=e.isUndefined(S)?0:S.weight;h.setEdge(w,p,{weight:i.edge(y).weight+b})}),e.has(f,"minRank")&&h.setNode(p,{borderLeft:f.borderLeft[a],borderRight:f.borderRight[a]}))}),h}function s(i){for(var a;i.hasNode(a=e.uniqueId("_root")););return a}return sy}var oy,aC;function Kz(){if(aC)return oy;aC=1;var e=yt();oy=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 oy}var iy,lC;function Xz(){if(lC)return iy;lC=1;var e=yt(),t=Bz(),n=Uz(),s=Vz(),i=Yz(),a=Kz(),l=lr().Graph,u=hn();iy=h;function h(y){var w=u.maxRank(y),S=p(y,e.range(1,w+1),"inEdges"),b=p(y,e.range(w-1,-1,-1),"outEdges"),_=t(y);g(y,_);for(var k=Number.POSITIVE_INFINITY,E,C=0,j=0;j<4;++C,++j){f(C%2?S:b,C%4>=2),_=u.buildLayerMatrix(y);var I=n(y,_);I<k&&(j=0,E=e.cloneDeep(_),k=I)}g(y,E)}function p(y,w,S){return e.map(w,function(b){return i(y,b,S)})}function f(y,w){var S=new l;e.forEach(y,function(b){var _=b.graph().root,k=s(b,_,S,w);e.forEach(k.vs,function(E,C){b.node(E).order=C}),a(b,S,k.vs)})}function g(y,w){e.forEach(w,function(S){e.forEach(S,function(b,_){y.node(b).order=_})})}return iy}var ay,cC;function Qz(){if(cC)return ay;cC=1;var e=yt(),t=lr().Graph,n=hn();ay={positionX:S,findType1Conflicts:s,findType2Conflicts:i,addConflict:l,hasConflict:u,verticalAlignment:h,horizontalCompaction:p,alignCoordinates:y,findSmallestWidthAlignment:g,balance:w};function s(k,E){var C={};function j(I,O){var P=0,F=0,M=I.length,A=e.last(O);return e.forEach(O,function(q,W){var V=a(k,q),T=V?k.node(V).order:M;(V||q===A)&&(e.forEach(O.slice(F,W+1),function(Q){e.forEach(k.predecessors(Q),function(U){var ne=k.node(U),X=ne.order;(X<P||T<X)&&!(ne.dummy&&k.node(Q).dummy)&&l(C,U,Q)})}),F=W+1,P=T)}),O}return e.reduce(E,j),C}function i(k,E){var C={};function j(O,P,F,M,A){var q;e.forEach(e.range(P,F),function(W){q=O[W],k.node(q).dummy&&e.forEach(k.predecessors(q),function(V){var T=k.node(V);T.dummy&&(T.order<M||T.order>A)&&l(C,V,q)})})}function I(O,P){var F=-1,M,A=0;return e.forEach(P,function(q,W){if(k.node(q).dummy==="border"){var V=k.predecessors(q);V.length&&(M=k.node(V[0]).order,j(P,A,W,F,M),A=W,F=M)}j(P,A,P.length,M,O.length)}),P}return e.reduce(E,I),C}function a(k,E){if(k.node(E).dummy)return e.find(k.predecessors(E),function(C){return k.node(C).dummy})}function l(k,E,C){if(E>C){var j=E;E=C,C=j}var I=k[E];I||(k[E]=I={}),I[C]=!0}function u(k,E,C){if(E>C){var j=E;E=C,C=j}return e.has(k[E],C)}function h(k,E,C,j){var I={},O={},P={};return e.forEach(E,function(F){e.forEach(F,function(M,A){I[M]=M,O[M]=M,P[M]=A})}),e.forEach(E,function(F){var M=-1;e.forEach(F,function(A){var q=j(A);if(q.length){q=e.sortBy(q,function(U){return P[U]});for(var W=(q.length-1)/2,V=Math.floor(W),T=Math.ceil(W);V<=T;++V){var Q=q[V];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(k,E,C,j,I){var O={},P=f(k,E,C,I),F=I?"borderLeft":"borderRight";function M(W,V){for(var T=P.nodes(),Q=T.pop(),U={};Q;)U[Q]?W(Q):(U[Q]=!0,T.push(Q),T=T.concat(V(Q))),Q=T.pop()}function A(W){O[W]=P.inEdges(W).reduce(function(V,T){return Math.max(V,O[T.v]+P.edge(T))},0)}function q(W){var V=P.outEdges(W).reduce(function(Q,U){return Math.min(Q,O[U.w]-P.edge(U))},Number.POSITIVE_INFINITY),T=k.node(W);V!==Number.POSITIVE_INFINITY&&T.borderType!==F&&(O[W]=Math.max(O[W],V))}return M(A,P.predecessors.bind(P)),M(q,P.successors.bind(P)),e.forEach(j,function(W){O[W]=O[C[W]]}),O}function f(k,E,C,j){var I=new t,O=k.graph(),P=b(O.nodesep,O.edgesep,j);return e.forEach(E,function(F){var M;e.forEach(F,function(A){var q=C[A];if(I.setNode(q),M){var W=C[M],V=I.edge(W,q);I.setEdge(W,q,Math.max(P(k,A,M),V||0))}M=A})}),I}function g(k,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 F=_(k,P)/2;j=Math.max(O+F,j),I=Math.min(O-F,I)}),j-I})}function y(k,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 F=O+P,M=k[F],A;if(M!==E){var q=e.values(M);A=P==="l"?j-e.min(q):I-e.max(q),A&&(k[F]=e.mapValues(M,function(W){return W+A}))}})})}function w(k,E){return e.mapValues(k.ul,function(C,j){if(E)return k[E.toLowerCase()][j];var I=e.sortBy(e.map(k,j));return(I[1]+I[2])/2})}function S(k){var E=n.buildLayerMatrix(k),C=e.merge(s(k,E),i(k,E)),j={},I;e.forEach(["u","d"],function(P){I=P==="u"?E:e.values(E).reverse(),e.forEach(["l","r"],function(F){F==="r"&&(I=e.map(I,function(W){return e.values(W).reverse()}));var M=(P==="u"?k.predecessors:k.successors).bind(k),A=h(k,I,C,M),q=p(k,I,A.root,A.align,F==="r");F==="r"&&(q=e.mapValues(q,function(W){return-W})),j[P+F]=q})});var O=g(k,j);return y(j,O),w(j,k.graph().align)}function b(k,E,C){return function(j,I,O){var P=j.node(I),F=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:k)/2,M+=(F.dummy?E:k)/2,M+=F.width/2,e.has(F,"labelpos"))switch(F.labelpos.toLowerCase()){case"l":A=F.width/2;break;case"r":A=-F.width/2;break}return A&&(M+=C?A:-A),A=0,M}}function _(k,E){return k.node(E).width}return ay}var ly,uC;function Zz(){if(uC)return ly;uC=1;var e=yt(),t=hn(),n=Qz().positionX;ly=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 ly}var cy,dC;function Jz(){if(dC)return cy;dC=1;var e=yt(),t=Oz(),n=Pz(),s=Lz(),i=hn().normalizeRanks,a=qz(),l=hn().removeEmptyRanks,u=Dz(),h=Fz(),p=zz(),f=Xz(),g=Zz(),y=hn(),w=lr().Graph;cy=S;function S(D,L){var Y=L&&L.debugTiming?y.time:y.notime;Y("layout",function(){var re=Y(" buildLayoutGraph",function(){return M(D)});Y(" runLayout",function(){b(re,Y)}),Y(" updateInputGraph",function(){_(D,re)})})}function b(D,L){L(" makeSpaceForEdgeLabels",function(){A(D)}),L(" removeSelfEdges",function(){H(D)}),L(" acyclic",function(){t.run(D)}),L(" nestingGraph.run",function(){u.run(D)}),L(" rank",function(){s(y.asNonCompoundGraph(D))}),L(" injectEdgeLabelProxies",function(){q(D)}),L(" removeEmptyRanks",function(){l(D)}),L(" nestingGraph.cleanup",function(){u.cleanup(D)}),L(" normalizeRanks",function(){i(D)}),L(" assignRankMinMax",function(){W(D)}),L(" removeEdgeLabelProxies",function(){V(D)}),L(" normalize.run",function(){n.run(D)}),L(" parentDummyChains",function(){a(D)}),L(" addBorderSegments",function(){h(D)}),L(" order",function(){f(D)}),L(" insertSelfEdges",function(){J(D)}),L(" adjustCoordinateSystem",function(){p.adjust(D)}),L(" position",function(){g(D)}),L(" positionSelfEdges",function(){$(D)}),L(" removeBorderNodes",function(){X(D)}),L(" normalize.undo",function(){n.undo(D)}),L(" fixupEdgeLabelCoords",function(){U(D)}),L(" undoCoordinateSystem",function(){p.undo(D)}),L(" translateGraph",function(){T(D)}),L(" assignNodeIntersects",function(){Q(D)}),L(" reversePoints",function(){ne(D)}),L(" acyclic.undo",function(){t.undo(D)})}function _(D,L){e.forEach(D.nodes(),function(Y){var re=D.node(Y),he=L.node(Y);re&&(re.x=he.x,re.y=he.y,L.children(Y).length&&(re.width=he.width,re.height=he.height))}),e.forEach(D.edges(),function(Y){var re=D.edge(Y),he=L.edge(Y);re.points=he.points,e.has(he,"x")&&(re.x=he.x,re.y=he.y)}),D.graph().width=L.graph().width,D.graph().height=L.graph().height}var k=["nodesep","edgesep","ranksep","marginx","marginy"],E={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},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"},F=["labelpos"];function M(D){var L=new w({multigraph:!0,compound:!0}),Y=Z(D.graph());return L.setGraph(e.merge({},E,G(Y,k),e.pick(Y,C))),e.forEach(D.nodes(),function(re){var he=Z(D.node(re));L.setNode(re,e.defaults(G(he,j),I)),L.setParent(re,D.parent(re))}),e.forEach(D.edges(),function(re){var he=Z(D.edge(re));L.setEdge(re,e.merge({},P,G(he,O),e.pick(he,F)))}),L}function A(D){var L=D.graph();L.ranksep/=2,e.forEach(D.edges(),function(Y){var re=D.edge(Y);re.minlen*=2,re.labelpos.toLowerCase()!=="c"&&(L.rankdir==="TB"||L.rankdir==="BT"?re.width+=re.labeloffset:re.height+=re.labeloffset)})}function q(D){e.forEach(D.edges(),function(L){var Y=D.edge(L);if(Y.width&&Y.height){var re=D.node(L.v),he=D.node(L.w),pe={rank:(he.rank-re.rank)/2+re.rank,e:L};y.addDummyNode(D,"edge-proxy",pe,"_ep")}})}function W(D){var L=0;e.forEach(D.nodes(),function(Y){var re=D.node(Y);re.borderTop&&(re.minRank=D.node(re.borderTop).rank,re.maxRank=D.node(re.borderBottom).rank,L=e.max(L,re.maxRank))}),D.graph().maxRank=L}function V(D){e.forEach(D.nodes(),function(L){var Y=D.node(L);Y.dummy==="edge-proxy"&&(D.edge(Y.e).labelRank=Y.rank,D.removeNode(L))})}function T(D){var L=Number.POSITIVE_INFINITY,Y=0,re=Number.POSITIVE_INFINITY,he=0,pe=D.graph(),we=pe.marginx||0,Ce=pe.marginy||0;function Ve(Be){var Le=Be.x,ke=Be.y,ce=Be.width,be=Be.height;L=Math.min(L,Le-ce/2),Y=Math.max(Y,Le+ce/2),re=Math.min(re,ke-be/2),he=Math.max(he,ke+be/2)}e.forEach(D.nodes(),function(Be){Ve(D.node(Be))}),e.forEach(D.edges(),function(Be){var Le=D.edge(Be);e.has(Le,"x")&&Ve(Le)}),L-=we,re-=Ce,e.forEach(D.nodes(),function(Be){var Le=D.node(Be);Le.x-=L,Le.y-=re}),e.forEach(D.edges(),function(Be){var Le=D.edge(Be);e.forEach(Le.points,function(ke){ke.x-=L,ke.y-=re}),e.has(Le,"x")&&(Le.x-=L),e.has(Le,"y")&&(Le.y-=re)}),pe.width=Y-L+we,pe.height=he-re+Ce}function Q(D){e.forEach(D.edges(),function(L){var Y=D.edge(L),re=D.node(L.v),he=D.node(L.w),pe,we;Y.points?(pe=Y.points[0],we=Y.points[Y.points.length-1]):(Y.points=[],pe=he,we=re),Y.points.unshift(y.intersectRect(re,pe)),Y.points.push(y.intersectRect(he,we))})}function U(D){e.forEach(D.edges(),function(L){var Y=D.edge(L);if(e.has(Y,"x"))switch((Y.labelpos==="l"||Y.labelpos==="r")&&(Y.width-=Y.labeloffset),Y.labelpos){case"l":Y.x-=Y.width/2+Y.labeloffset;break;case"r":Y.x+=Y.width/2+Y.labeloffset;break}})}function ne(D){e.forEach(D.edges(),function(L){var Y=D.edge(L);Y.reversed&&Y.points.reverse()})}function X(D){e.forEach(D.nodes(),function(L){if(D.children(L).length){var Y=D.node(L),re=D.node(Y.borderTop),he=D.node(Y.borderBottom),pe=D.node(e.last(Y.borderLeft)),we=D.node(e.last(Y.borderRight));Y.width=Math.abs(we.x-pe.x),Y.height=Math.abs(he.y-re.y),Y.x=pe.x+Y.width/2,Y.y=re.y+Y.height/2}}),e.forEach(D.nodes(),function(L){D.node(L).dummy==="border"&&D.removeNode(L)})}function H(D){e.forEach(D.edges(),function(L){if(L.v===L.w){var Y=D.node(L.v);Y.selfEdges||(Y.selfEdges=[]),Y.selfEdges.push({e:L,label:D.edge(L)}),D.removeEdge(L)}})}function J(D){var L=y.buildLayerMatrix(D);e.forEach(L,function(Y){var re=0;e.forEach(Y,function(he,pe){var we=D.node(he);we.order=pe+re,e.forEach(we.selfEdges,function(Ce){y.addDummyNode(D,"selfedge",{width:Ce.label.width,height:Ce.label.height,rank:we.rank,order:pe+ ++re,e:Ce.e,label:Ce.label},"_se")}),delete we.selfEdges})})}function $(D){e.forEach(D.nodes(),function(L){var Y=D.node(L);if(Y.dummy==="selfedge"){var re=D.node(Y.e.v),he=re.x+re.width/2,pe=re.y,we=Y.x-he,Ce=re.height/2;D.setEdge(Y.e,Y.label),D.removeNode(L),Y.label.points=[{x:he+2*we/3,y:pe-Ce},{x:he+5*we/6,y:pe-Ce},{x:he+we,y:pe},{x:he+5*we/6,y:pe+Ce},{x:he+2*we/3,y:pe+Ce}],Y.label.x=Y.x,Y.label.y=Y.y}})}function G(D,L){return e.mapValues(e.pick(D,L),Number)}function Z(D){var L={};return e.forEach(D,function(Y,re){L[re.toLowerCase()]=Y}),L}return cy}var uy,fC;function eB(){if(fC)return uy;fC=1;var e=yt(),t=hn(),n=lr().Graph;uy={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 uy}var dy,hC;function tB(){return hC||(hC=1,dy="0.8.5"),dy}var fy,pC;function nB(){return pC||(pC=1,fy={graphlib:lr(),layout:Jz(),debug:eB(),util:{time:hn().time,notime:hn().notime},version:tB()}),fy}var rB=nB();const mC=Zy(rB),Hi=240,ku=130,$i=74,Ju=72,gC=$i+Ju;function sB(e,t){var s;let n=Hi;for(const i of e)n=Math.max(n,((s=t.get(i.id))==null?void 0:s.width)??Hi);return n}const zR=420,oB=2;function dl(e){var n;return((n=e.data)==null?void 0:n.sessionId)??"_default"}function iB(e,t){return((t==null?void 0:t.get(e))??0)>0?zR:0}function aB(e,t){const n=(t==null?void 0:t.get(e))??0;return n>0?6+n*36:0}function fl(e,t,n){const s=t.get(e);return{w:((s==null?void 0:s.width)??Hi)+iB(e,n),h:Math.max((s==null?void 0:s.height)??ku,aB(e,n))}}function lB(e){return[...e.keys()].sort().map(t=>`${t}:${e.get(t)}`).join("|")}function cB(e,t,n,s,i,a){const l=new mC.graphlib.Graph;l.setDefaultEdgeLabel(()=>({})),l.setGraph({rankdir:n,marginx:0,marginy:0,nodesep:70,ranksep:160,edgesep:30});const u=e.filter(k=>!i.has(k)),h=new Set(u);for(const k of u){const{w:E,h:C}=fl(k,s,a);l.setNode(k,{width:E,height:C})}for(const k of t)h.has(k.source)&&h.has(k.target)&&l.setEdge(k.source,k.target);mC.layout(l);const p=new Map;let f=1/0,g=1/0,y=-1/0,w=-1/0;for(const k of u){const E=l.node(k);if(!E)continue;const C=s.get(k),j=(C==null?void 0:C.width)??Hi,I=(C==null?void 0:C.height)??ku,O=fl(k,s,a),P=E.x-O.w/2,F=E.y-O.h/2;p.set(k,{x:P,y:F}),P<f&&(f=P),F<g&&(g=F),P+j>y&&(y=P+j),F+I>w&&(w=F+I)}if(Number.isFinite(f)&&Number.isFinite(g))for(const[k,E]of p)p.set(k,{x:E.x-f,y:E.y-g});const S=Number.isFinite(y)?y-f:0,b=Number.isFinite(w)?w-g:0;let _=null;for(const k of e){const E=i.get(k);if(!E)continue;const C=s.get(k),j=(C==null?void 0:C.width)??Hi,I=(C==null?void 0:C.height)??ku;_=_===null?{minX:E.x,minY:E.y,maxX:E.x+j,maxY:E.y+I}:{minX:Math.min(_.minX,E.x),minY:Math.min(_.minY,E.y),maxX:Math.max(_.maxX,E.x+j),maxY:Math.max(_.maxY,E.y+I)}}return{positions:p,width:S,height:b,pinnedBox:_}}function uB(e,t,n={}){const s=n.direction??"LR",i=n.pinned??new Map,a=n.measured??new Map,l=n.lanes,u=new Map;for(const k of e){const E=dl(k),C=u.get(E);C?C.push(k.id):u.set(E,[k.id])}const p=Array.from(u.keys()).sort().map(k=>({sid:k,...cB(u.get(k),t,s,a,i,l)})),f=sB(e,a),g=n.availableHeight&&n.availableHeight>0?n.availableHeight:Number.POSITIVE_INFINITY,y=k=>{const E=[[]];let C=0;for(const j of p)E.length<k&&C>0&&C+j.height>g&&(E.push([]),C=0),E[E.length-1].push(j),C+=j.height+gC;return E},w=k=>k.reduce((E,C)=>Math.max(E,C.width),0)+zR;let S=y(n.availableWidth?oB:1);S.length>1&&S.reduce((E,C)=>E+w(C),0)+f*(S.length-1)>(n.availableWidth??0)&&(S=y(1));const b=new Map;let _=0;for(const k of S){const E=w(k);let C=0;for(const{positions:j,height:I,pinnedBox:O}of k){for(const[F,M]of j)b.set(F,{x:M.x+_,y:M.y+C});let P=C+I;O&&O.maxY>P&&O.minX<_+E&&_<O.maxX&&(P=O.maxY),C=P+gC}_+=E+f}return e.map(k=>{const E=i.get(k.id);if(E)return{...k,position:E};const C=b.get(k.id);return C?{...k,position:C}:k})}function dB(e,t,n,s,i){const l=$i+Ju,u=60,h=w=>fl(w,s,i),p=new Map(e.map(w=>[w.id,dl(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,S)=>w.pos.y-S.pos.y||w.pos.x-S.pos.x||w.id.localeCompare(S.id)),y=[];for(const{id:w,pos:S}of g){const{w:b,h:_}=h(w),k=p.get(w)??"_default";if(n.has(w)){f.push({x:S.x,y:S.y,w:b,h:_,sid:k});continue}let E=S.y;for(let C=0;C<f.length+1;C++){const j=f.find(I=>{const O=I.sid===k?24:u,P=I.sid===k?24:l;return S.x<I.x+I.w+O&&I.x<S.x+b+O&&E<I.y+I.h+P&&I.y<E+_+P});if(!j)break;E=j.y+j.h+(j.sid===k?24:l)}E!==S.y&&(t.set(w,{x:S.x,y:E}),y.push(w)),f.push({x:S.x,y:E,w:b,h:_,sid:k})}return y}function fB(e,t,n,s,i,a){const l=b=>fl(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 _=dl(b),k=h.get(_);k?k.push(b):h.set(_,[b])}const p=new Set;for(const[b,_]of h)_.every(k=>i.has(k.id)&&!n.has(k.id))&&p.add(b);const f=new Map,g=[];for(const b of e){const _=u(b.id);if(!_)continue;const{w:k,h:E}=l(b.id),C=dl(b);p.has(C)?(f.get(C)??f.set(C,[]).get(C)).push(b):g.push({x:_.x,y:_.y,w:k,h:E})}if(f.size===0)return[];const y=$i+Ju,w=(b,_,k,E)=>g.some(C=>b<C.x+C.w+$i&&C.x<b+k+$i&&_<C.y+C.h+y&&C.y<_+E+y),S=[];for(const b of[...f.keys()].sort()){const _=f.get(b);let k=1/0,E=1/0,C=-1/0,j=-1/0;for(const q of _){const W=u(q.id),{w:V,h:T}=l(q.id);k=Math.min(k,W.x),E=Math.min(E,W.y),C=Math.max(C,W.x+V),j=Math.max(j,W.y+T)}const I=C-k,O=j-E,P=[...new Set(g.map(q=>Math.round(q.x)))].sort((q,W)=>q-W),F=P.length?P:[k],M=[0,...g.map(q=>q.y+q.h+y)].sort((q,W)=>q-W);let A=null;e:for(const q of F)for(const W of M){if(W>=E)break;if(!w(q,W,I,O)){A={x:q,y:W};break e}}if(A){const q=A.x-k,W=A.y-E;for(const V of _){const T=u(V.id);t.set(V.id,{x:T.x+q,y:T.y+W})}S.push(b)}for(const q of _){const W=u(q.id),{w:V,h:T}=l(q.id);g.push({x:W.x,y:W.y,w:V,h:T})}}return S}function hB(e,t,n,s,i,a=!1,l){const p=$i+Ju+1,f=8,g=1.75,y=200,w=.7,S=.01,b=A=>fl(A,s,l),_=A=>n.get(A)??t.get(A),k=new Map;for(const A of e){if(!_(A.id))continue;const q=dl(A),W=k.get(q);W?W.push(A):k.set(q,[A])}const E=[],C=new Set,j=new Set,I=i.size===0;for(const A of[...k.keys()].sort()){const q=k.get(A);let W=1/0,V=1/0,T=-1/0,Q=-1/0,U=!1;for(const J of q){const $=_(J.id),{w:G,h:Z}=b(J.id);W=Math.min(W,$.x),V=Math.min(V,$.y),T=Math.max(T,$.x+G),Q=Math.max(Q,$.y+Z),n.has(J.id)&&(U=!0)}const ne=T-W,X=Q-V;j.add(A);const H=i.get(A);H&&(ne>H.w+f||X>H.h+f)&&C.add(A),i.set(A,{w:ne,h:X}),E.push({sid:A,members:q.map(J=>J.id),x:W,y:V,w:ne,h:X,anchored:U,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 W=E[A],V=E[q];if(!(W.anchored&&V.anchored)&&Math.abs(W.x+W.w/2-(V.x+V.w/2))<(W.w+V.w)/2+61&&Math.abs(W.y+W.h/2-(V.y+V.h/2))<(W.h+V.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/(Hi*ku));const P=new Map(E.map(A=>[A.sid,A.x])),F=new Map(E.map(A=>[A.sid,A.y]));for(let A=0;A<y;A++){const q=new Map,W=new Map;let V=0;for(let T=0;T<E.length;T++)for(let Q=T+1;Q<E.length;Q++){const U=E[T],ne=E[Q];if(U.anchored&&ne.anchored)continue;const X=U.x+U.w/2,H=U.y+U.h/2,J=ne.x+ne.w/2,$=ne.y+ne.h/2,G=(U.w+ne.w)/2+61-Math.abs(X-J),Z=(U.h+ne.h)/2+p-Math.abs(H-$);if(G<=0||Z<=0)continue;const D=(_e,De)=>!_e.anchored&&!(De<0&&_e.x<=0),L=(_e,De)=>!_e.anchored&&!(De<0&&_e.y<=0),Y=(_e,De,Ge)=>{const lt=_e===De,je=lt?U.sid<ne.sid?-1:1:Math.sign(_e-De);return Ge(U,je)||Ge(ne,-je)?je:lt&&(Ge(U,-je)||Ge(ne,je))?-je:0},re=Y(X,J,D),he=Y(H,$,L),pe=re!==0,we=he!==0;if(!pe&&!we)continue;const Ce=pe&&(!we||G*g<Z),[Ve,Be,Le,ke]=Ce?[re,G,q,D]:[he,Z,W,L],ce=ke(U,Ve),be=ke(ne,-Ve),xe=U.mass,Ye=ne.mass,ut=ce?be?Ye/(xe+Ye):1:0,at=be?ce?xe/(xe+Ye):1:0,de=Be*w;Le.set(U.sid,(Le.get(U.sid)??0)+Ve*de*ut),Le.set(ne.sid,(Le.get(ne.sid)??0)-Ve*de*at),V+=de}for(const T of E)T.anchored||(T.x=Math.max(0,T.x+(q.get(T.sid)??0)),T.y=Math.max(0,T.y+(W.get(T.sid)??0)));if(V<S)break}const M=[];for(const A of E){const q=A.x-P.get(A.sid),W=A.y-F.get(A.sid);if(!(Math.abs(q)<1&&Math.abs(W)<1)){for(const V of A.members){if(n.has(V))continue;const T=t.get(V);T&&t.set(V,{x:T.x+q,y:T.y+W})}M.push(A.sid)}}return M}const pB=600;function Yy(e,t){return!(e.exitAt!=null&&t-e.exitAt>pB||e.kind==="root"&&e.state==="done"&&e.tools.length===0&&e.endedAt!=null&&e.endedAt-e.startedAt<3e3)}function mB(e,t){const n=new Set;for(const s of e.agents.values())Yy(s,t)&&n.add(s.id);return n}function gB(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 vB(e,t,n=0){if(!e)return!1;for(const s of t)if(gB(e,s,n))return!0;return!1}const BR="sessionGroup";function yB(e,t){var s;if(e.type===BR)return"transparent";const n=(s=e.data)==null?void 0:s.state;return t(n==="err"?"--err":n==="active"?"--inflight":"--ok")}const UR=["--err","--inflight","--ok","--grid-line","--minimap-mask","--panel","--line","--accent","--text-dim","--bg"];function vC(e){const t={};for(const n of UR)t[n]=e(n);return t}function wB(e){return t=>e[t]??""}function xB(e,t){return UR.every(n=>e[n]===t[n])}function bB(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 _B=1200,kB=1e3;function yC(e){return e.lastDeckFitAt>0&&e.at-e.lastDeckFitAt<_B?!1:e.hasSourceEvent?!0:e.lastCanvasInputAt>0&&e.at-e.lastCanvasInputAt<kB}function hy({durationMs:e,documentHidden:t}){return t?!1:Number.isFinite(e)&&e>0}function SB(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 NB({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,SB(i,t,e))return!1;return s}const EB="Update checks are off (AGENTS_DECK_NO_UPDATE_CHECK=1)",py="click for what's new";function CB(e){if(e.checkDisabled)return`${EB} · ${py}`;if(e.checking)return`Asking npm for the newest release… · ${py}`;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 · ${py}, and to check npm now`}function jB(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 TB(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 RB(e){if(e==null)return{kind:"unknown",lead:"No data yet. Start a Claude Code or Codex session — it appears here as soon as the deck sees its first event.",workspace:null,tail:""};const t=e.trim();return t===""?{kind:"machine",lead:"No data yet. Start a Claude Code or Codex session anywhere on this machine — this deck is unscoped and captures every workspace.",workspace:null,tail:""}:{kind:"scoped",lead:"No data yet. This deck only captures sessions running under",workspace:t,tail:" — start one there, or restart it without --workspace/--scope to watch the whole machine."}}const Ky={kind:"assumed",claude:!0,codex:!0};function AB(e){if(!e||typeof e!="object")return Ky;const t=e.providers;if(!t||typeof t!="object")return Ky;const n=t;return{kind:"reported",claude:n.claude!==!1,codex:n.codex!==!1}}function Su(e){const t=Math.max(0,Math.floor(e));return`${t} event${t===1?"":"s"}`}const wC=99;function MB(e){const t=Math.max(0,Math.floor(e));return t>wC?`${wC}+`:String(t)}const IB="Pause the canvas";function OB(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 — ${Su(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)":`${Su(e.held)} arrived while paused and will be applied in order when you resume (Space)`}function PB(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 WR="paused · full",$B=(e,t)=>t>0?WR:e>0?`paused · ${MB(e)}`:"paused";function LB(e){const t=Math.max(0,Math.floor(e.dropped??0));return e.connected?e.paused?{tone:"paused",resting:!1,label:$B(e.held,t),widest:WR,title:t>0?`Connected — the pause is full at ${Su(e.held)}; the oldest are being dropped as new ones arrive. Resume to catch up (Space)`:e.held>0?`Connected — ${Su(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 xC(e){return typeof window>"u"?"":getComputedStyle(document.documentElement).getPropertyValue(e).trim()||""}const qB={agent:ZL,sessionGroup:p3},HR="react-flow__node";function bC(e){var t,n;return!!e&&((n=(t=e.classList)==null?void 0:t.contains)==null?void 0:n.call(t,HR))===!0}function DB(e){try{const t=document.querySelector(`.${HR}[data-id="${CSS.escape(e)}"]`);t==null||t.focus({preventScroll:!0})}catch{}}const FB=["a[href]","button:not(:disabled)","input:not(:disabled)","select:not(:disabled)","textarea:not(:disabled)","summary","[tabindex]"].join(","),zB=420,nu=18,BB=200,UB=5*6e4,WB=6,HB=2*6e4,_C=400,Xw="agent-dag.layout",Qw="agent-dag.viewport",GR="agent-dag.summariesDismissed",VR="agent-dag.sessionListOpen",YR="agent-dag.detailOpen",KR="agent-dag.usagePanelOpen",kC="agent-dag.accountsPanelOpen",my="agent-dag.versionNoticeDismissed",SC="agent-dag.oldNameNoticeDismissed",GB=15*6e4,gy={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:"},NC="agent-dag.autoRestart",EC="agent-dag.bundleReloadedFor";function VB(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(VR)==="1"}catch{return!1}}function YB(e){if(!(typeof window>"u"))try{window.localStorage.setItem(VR,e?"1":"0")}catch{}}function KB(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(YR)==="1"}catch{return!1}}function XB(e){if(!(typeof window>"u"))try{window.localStorage.setItem(YR,e?"1":"0")}catch{}}function QB(){const e=Ou(KR);return e===null?!0:e==="1"}function ZB(e){if(!(typeof window>"u"))try{window.localStorage.setItem(KR,e?"1":"0")}catch{}}function JB(){if(typeof window>"u")return new Set;try{const e=window.localStorage.getItem(GR);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 CC(e){if(!(typeof window>"u"))try{const t=Array.from(e),n=t.length>200?t.slice(-200):t;window.localStorage.setItem(GR,JSON.stringify(n))}catch{}}function e8(){const e={positions:[],pins:[]};if(typeof window>"u")return e;try{const t=window.localStorage.getItem(Xw);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 vy(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(Xw,JSON.stringify({v:2,positions:n,pins:Array.from(t.keys())}))}catch{}}function t8(){if(typeof window>"u")return null;try{const e=window.localStorage.getItem(Qw);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 n8(e){if(!(typeof window>"u"))try{window.localStorage.setItem(Qw,JSON.stringify(e))}catch{}}function jC(){if(!(typeof window>"u")){try{window.localStorage.removeItem(Xw)}catch{}try{window.localStorage.removeItem(Qw)}catch{}}}function r8(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=`${Ft}-${p}-${t.slice(0,8)}.json`,document.body.appendChild(h),h.click(),document.body.removeChild(h),setTimeout(()=>URL.revokeObjectURL(u),1e3)}const Xy={file:"📁",shell:"⚡",web:"🌐",agent:"🤖",task:"📋",plan:"🧭",mcp:"🔌",other:"✨"},Qy={file:"file",shell:"shell",web:"web",agent:"agent",task:"task",plan:"plan",mcp:"mcp",other:"other"},XR=pT;function s8(e,t,n,s,i,a,l,u,h,p,f,g,y,w,S,b,_,k){const E=[],C=[];for(const A of e.agents.values()){if(!_.has(A.id))continue;const q=A.exitAt!=null,W=b!=null&&!b.has(A.id),V=[q?"rf-exiting":"",W?"rf-spotlit-out":""].filter(Boolean).join(" ")||void 0,T=a.get(A.id);if(E.push({id:A.id,type:"agent",position:{x:0,y:0},data:{...A,now:t,onOpenContext:k},className:V,...T?{width:T.width,height:T.height}:null}),A.parentId&&_.has(A.parentId)){const Q=yw(A.sessionId),U=q,ne=S.size>0&&(S.has(A.id)||S.has(A.parentId)),X=b!=null&&!b.has(A.id)&&!b.has(A.parentId),H=A.state==="active"?2:1.5,J=ne?H+1.5:H,$=U?.2:X?.12:1,G=["sess-edge",A.state==="active"?"sess-live":"sess-idle",U?"rf-edge-exiting":"",ne?"rf-edge-selected":""].filter(Boolean).join(" ");C.push({id:`e:${A.parentId}->${A.id}`,source:A.parentId,target:A.id,animated:(A.state==="active"||ne)&&!U,type:"smoothstep",style:{"--session-hue":Q,strokeWidth:J,opacity:$,transition:"var(--edge-transition)"},className:G})}}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=`${y}#lanes:${lB(j)}`,O=E.filter(A=>r5(A.id,i,f,g));if(O.length>0||I!==w.current){if(O.length>0){const A=uB(E,C,{direction:"LR",pinned:i,measured:a,availableWidth:n,availableHeight:s,lanes:j});for(const q of A)qT(q.id,f,g)&&o5(q.id,q.position,f,g);fB(E,f,i,a,new Set(O.map(q=>q.id)),j)}dB(E,f,i,a,j),w.current=I}const P=hB(E,f,i,a,l,!h||p,j);P.length>0&&u(P),Xc(f,e.agents),Xc(g,e.agents),Xc(i,e.agents),Xc(a,e5(e.agents.values()));const F=[];let M=!1;for(const A of E){let q=i.get(A.id)??f.get(A.id);q||(q=s5(A.id,f,g),M=!0),F.push({...A,position:q})}return M&&(w.current=""),{nodes:F,edges:C}}function o8(){return d.jsx(gw,{children:d.jsx(i8,{})})}function i8(){var fs,hs,Ul,Qs;const e=vl(),t=At(),n=N.useState(Oy)[0],s=N.useRef(n),[,i]=N.useState(0),a=N.useCallback(()=>i(z=>z+1),[]),[l,u]=N.useState(()=>new Set),[h,p]=N.useState(null),[f,g]=N.useState(null),y=N.useCallback((z,K)=>{u(le=>{if(!K)return new Set([z]);const fe=new Set(le);return fe.has(z)?fe.delete(z):fe.add(z),fe}),p(le=>K&&le===z?le:z)},[]),w=N.useCallback(()=>{u(new Set),p(null)},[]),[S,b]=N.useState(null),[_,k]=N.useState(null),E=N.useCallback(z=>k(z),[]),[C,j]=N.useState(!1),[I,O]=N.useState(!1),P=N.useState(JB)[0],[F,M]=N.useState(VB);N.useEffect(()=>{YB(F)},[F]);const[A,q]=N.useState(KB);N.useEffect(()=>{XB(A)},[A]);const[W,V]=N.useState(QB);N.useEffect(()=>{ZB(W)},[W]);const[T,Q]=N.useState(()=>{try{const z=window.localStorage.getItem(kC);return z===null?!0:z==="1"}catch{return!0}});N.useEffect(()=>{try{window.localStorage.setItem(kC,T?"1":"0")}catch{}},[T]);const[U,ne]=N.useState(null);N.useEffect(()=>{let z=null;try{z=localStorage.getItem("agent-dag.sound")}catch{}ne(z===null?!0:z==="on")},[]);const X=N.useCallback(()=>{ne(z=>{var le;const K=z!==!0;try{localStorage.setItem("agent-dag.sound",K?"on":"off")}catch{}return K&&((le=Ce.current)==null||le.unlock()),K})},[]),H=N.useCallback(z=>{X()},[X]),J=N.useRef(H);J.current=H;const $=N.useRef(U);$.current=U;const[G,Z]=N.useState(()=>CD(Ou)),D=N.useRef(G);D.current=G;const L=N.useRef(null),Y=N.useCallback((z,K=!1)=>{var le,fe;if((le=Ce.current)==null||le.unlock(),L.current!==null&&clearTimeout(L.current),L.current=null,!K){(fe=Ce.current)==null||fe.play(z,!0);return}L.current=setTimeout(()=>{var Ne;L.current=null,(Ne=Ce.current)==null||Ne.play(z,!0)},_D)},[]),re=N.useCallback((z,K)=>{Z(le=>{const fe={level:ul(K.level??le[z].level),figure:IT(z,K.figure??le[z].figure)};try{localStorage.setItem(PT[z],String(fe.level)),localStorage.setItem($T[z],fe.figure)}catch{}return{...le,[z]:fe}}),Y(z,!0)},[Y]);N.useEffect(()=>()=>{L.current!==null&&clearTimeout(L.current)},[]);const[he,pe]=N.useState(!1),we=N.useRef(null),Ce=N.useRef(null),[Ve,Be]=N.useState("locked");N.useEffect(()=>{const z=RD({enabled:()=>$.current===!0,prefs:()=>D.current,onState:Be});Ce.current=z,Be(z.state());const K=()=>z.unlock();return window.addEventListener("pointerdown",K,{once:!0,capture:!0}),window.addEventListener("keydown",K,{once:!0,capture:!0}),()=>{window.removeEventListener("pointerdown",K,{capture:!0}),window.removeEventListener("keydown",K,{capture:!0})}},[]);const[Le,ke]=N.useState(!1),[ce,be]=N.useState(null),[xe,Ye]=N.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(my)??""}catch{return""}}),[ut,at]=N.useState(!1),de=N.useRef(0),[_e,De]=N.useState(!1),Ge=N.useCallback((z=!1)=>(z&&(de.current=Date.now(),De(!0)),fetch(z?"/api/version?refresh=1":"/api/version").then(K=>K.ok?K.json():null).then(K=>{K&&be(K)}).catch(()=>{}).finally(()=>{z&&De(!1)})),[]),lt=N.useCallback(()=>{Ge(Date.now()-de.current>=GB)},[Ge]);N.useEffect(()=>{Ge();const z=window.setInterval(lt,5*6e4),K=()=>{document.visibilityState==="visible"&&lt()};return document.addEventListener("visibilitychange",K),()=>{window.clearInterval(z),document.removeEventListener("visibilitychange",K)}},[Ge,lt]),N.useEffect(()=>{Le&&Ge()},[Le,Ge]);const je=(ce==null?void 0:ce.notice)??null,[He,Ke]=N.useState(null),oe=N.useRef(!1);N.useEffect(()=>{if(oe.current)return;const z=zD(),K=BD(z),le=HD({stored:K,running:(ce==null?void 0:ce.running)??null,notes:B1,remembers:UD(z)});le.reason!=="no-version"&&(oe.current=!0,le.record&&WD(z,le.record),le.show.length&&Ke({entries:le.show,since:K,firstRun:le.reason==="welcome"}))},[ce==null?void 0:ce.running]);const Ie=(ce==null?void 0:ce.running)??"3.6.0",Oe=N.useMemo(()=>LT(B1,null,Ie),[Ie]),Te=N.useCallback(()=>{Ke({entries:Oe,since:null,firstRun:!1})},[Oe]),[Xe,Et]=N.useState(null),[st,Ae]=N.useState(Ky);N.useEffect(()=>{let z=!1;return fetch("/api/health").then(K=>K.ok?K.json():null).then(K=>{z||(Ae(AB(K)),!(!K||typeof K.workspace!="string")&&Et(K.workspace))}).catch(()=>{}),()=>{z=!0}},[Le]);const wt=N.useRef(st);wt.current=st;const dt=je?`${je.kind}:${je.to}`:"",kt=je!=null&&xe!==dt,Sn=N.useCallback(()=>{Ye("");try{window.localStorage.setItem(my,"")}catch{}},[]),Fn=N.useCallback(()=>{if(je){Ye(dt);try{window.localStorage.setItem(my,dt)}catch{}}},[je,dt]),[Nn,Co]=N.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(SC)??""}catch{return""}}),pn=ce!=null&&ce.invokedAs&&ce.invokedAs!==Ft?ce.invokedAs:null,jo=pn!=null&&Nn!==pn,To=N.useCallback(()=>{if(pn){Co(pn);try{window.localStorage.setItem(SC,pn)}catch{}}},[pn]),zt=((fs=ce==null?void 0:ce.upgrade)==null?void 0:fs.state)??"idle",Cr=sD(ce==null?void 0:ce.upgrade),zn=N.useRef(!1),$s=N.useCallback(async()=>{if(ir(zn.current||zt==="running")){zn.current=!0;try{await fetch("/api/upgrade",{method:"POST"})}catch{}await Ge(),zn.current=!1}},[zt,Ge]);N.useEffect(()=>{if(zt!=="running")return;const z=window.setInterval(Ge,3e3);return()=>window.clearInterval(z)},[zt,Ge]);const jr=N.useCallback(async()=>{var le;const z=ce==null?void 0:ce.command;if(!z)return;let K=!1;try{K=await Promise.race([((le=navigator.clipboard)==null?void 0:le.writeText(z).then(()=>!0))??Promise.resolve(!1),new Promise(fe=>window.setTimeout(()=>fe(!1),500))])}catch{K=!1}if(!K)try{const fe=document.createElement("textarea");fe.value=z,fe.setAttribute("readonly",""),fe.style.cssText="position:fixed;top:0;left:0;opacity:0",document.body.appendChild(fe),fe.select(),K=document.execCommand("copy"),fe.remove()}catch{K=!1}K&&(at(!0),window.setTimeout(()=>at(!1),1600))},[ce==null?void 0:ce.command]),Zi=N.useCallback(()=>{M(z=>(z||Q(!1),!z))},[]),dr=N.useCallback(()=>{Q(z=>(z||M(!1),!z))},[]),[Tr,fr]=N.useState(!1),[ts,Ro]=N.useState(!1),[Ao,Mo]=N.useState(()=>{try{return Number(localStorage.getItem(G1))||0}catch{return 0}}),[En,Io]=N.useState([]),[Rr,Oo]=N.useState(!1);N.useEffect(()=>{let z=!0;const K=()=>{fetch("/api/browser-watch?live=0").then(fe=>fe.ok?fe.json():null).then(fe=>{var Ne;!z||!(fe!=null&&fe.ok)||(Io(fe.episodes??[]),Oo(((Ne=fe.settings)==null?void 0:Ne.enabled)===!0))}).catch(()=>{})};K();const le=setInterval(K,5*6e4);return()=>{z=!1,clearInterval(le)}},[]);const Bn=N.useMemo(()=>I5(En,Ao).length,[En,Ao]),[Po,Ls]=N.useState(0),qs=N.useRef(null),[$o,Lo]=N.useState(!1),ot=N.useRef(null),[Ji,ns]=N.useState(0),Ht=N.useState(()=>u5({protect:z=>fL(s.current,z)}))[0],[Un,qo]=N.useState(!1),rs=N.useCallback(()=>{const z=Ht.paused&&Ht.dropped>0,K=Ht.setPaused(!Ht.paused);z&&hL(s.current);for(const le of K)s.current=Qb(s.current,le);qo(Ht.paused)},[Ht]),[xt,nn]=N.useState(Date.now()),[Wn,mn]=N.useState(()=>{if(typeof window>"u")return!0;try{return window.localStorage.getItem(NC)!=="0"}catch{return!0}}),ed=N.useCallback(()=>{mn(z=>{const K=!z;try{window.localStorage.setItem(NC,K?"1":"0")}catch{}return K})},[]),[Ar,Do]=N.useState(!1),[Fo,zo]=N.useState("restart"),[ss,Ds]=N.useState(null),os=N.useRef(!1),jl=N.useRef(null),Bo=N.useRef(0),Fs=N.useCallback(async z=>{if(!ir(os.current))return;const K=(z==null?void 0:z.upgrade)===!0;os.current=!0,jl.current=Cr;const le=++Bo.current;zo(K?"npx":"restart"),Do(!0);try{window.sessionStorage.setItem("agent-dag.restartPending",(je==null?void 0:je.to)??"")}catch{}try{await fetch("/api/restart",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({upgrade:K})})}catch{}window.setTimeout(()=>{if(Bo.current===le&&os.current){os.current=!1,Do(!1);try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}}},K?18e4:3e4)},[je==null?void 0:je.to,Cr]),Uo=N.useRef(null);N.useEffect(()=>{let z=!1;for(const le of s.current.agents.values())if(le.state==="active"){z=!0;break}const K=iD({enabled:Wn,kind:je==null?void 0:je.kind,canRestart:(ce==null?void 0:ce.canRestart)===!0,busy:z,idleSince:Uo.current,now:xt});Uo.current=K.idleSince,K.restart&&Fs()},[Wn,je==null?void 0:je.kind,ce==null?void 0:ce.canRestart,xt,Fs]),N.useEffect(()=>{const z=ce==null?void 0:ce.running;let K=null,le=null;try{K=window.sessionStorage.getItem("agent-dag.restartPending"),le=window.sessionStorage.getItem(EC)}catch{return}const fe=rD({bundle:"3.6.0",running:z,pending:K,lastTried:le});if(fe==="reload"){try{window.sessionStorage.setItem(EC,z??"")}catch{return}window.location.reload();return}if(fe!=="confirm")return;try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}os.current=!1,Do(!1),Ds(z??null);const Ne=window.setTimeout(()=>Ds(null),6e3);return()=>window.clearTimeout(Ne)},[ce==null?void 0:ce.running]),N.useEffect(()=>{if(Ar&&oD({asked:jl.current,reported:Cr})){try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}os.current=!1,Do(!1)}},[Ar,Cr]);const is=N.useState(()=>bB(e8()))[0],Qt=N.useRef(is.pinned),as=N.useRef(null),Je=N.useState(()=>t8())[0],[ea,Tl]=N.useState(()=>new Set),[Mr,ta]=N.useState(f5),[Hn,Rl]=N.useState(()=>vC(xC)),Wo=N.useMemo(()=>wB(Hn),[Hn]),Ho=N.useCallback(z=>yB(z,Wo),[Wo]),hr=N.useMemo(()=>({background:Hn["--panel"],border:`1px solid ${Hn["--line"]}`,borderRadius:8}),[Hn]),[Gn,pr]=N.useState(!1);N.useEffect(()=>{document.documentElement.dataset.theme=Mr;try{window.localStorage.setItem(DT,Mr)}catch{}Rl(z=>{const K=vC(xC);return xB(z,K)?z:K})},[Mr]);const gn=N.useCallback((z,K)=>{if(hy({durationMs:K,documentHidden:document.hidden})){e.setViewport(z,{duration:K});return}const{d3Zoom:le,d3Selection:fe}=t.getState(),Ne=fe==null?void 0:fe.property("__zoom");if(le&&fe&&Ne&&Ne.k>0&&z.zoom>0){le.transform(fe,Ne.scale(z.zoom/Ne.k).translate((z.x-Ne.x)/z.zoom,(z.y-Ne.y)/z.zoom));return}e.setViewport(z,{duration:0})},[e,t]),Vn=N.useRef(null);N.useEffect(()=>{if(!Je)return;const z=window.setTimeout(()=>{try{gn(Je,0)}catch{}Kn.current=Date.now()},60);return()=>window.clearTimeout(z)},[gn,Je]);const Yn=N.useRef(!0);N.useEffect(()=>{const z=new EventSource("/events"),K=l5(a,{now:()=>Date.now(),setTimeout:(le,fe)=>window.setTimeout(le,fe),clearTimeout:le=>window.clearTimeout(le)});return z.addEventListener("open",()=>{ke(!0),pr(!0)}),z.addEventListener("error",()=>ke(!1)),z.addEventListener("replay-end",()=>{Yn.current=!1,K.flush()}),z.addEventListener("hook",le=>{var fe;try{const Ne=JSON.parse(le.data);if(!Ht.accept(Ne))return;s.current=Qb(s.current,Ne);const Pe=Ne.replay===!0||Yn.current||Date.now()-Ne.receivedAt>3e4;Pe?K.replay():K.live();const We=TD(Ne,Pe);We&&((fe=Ce.current)==null||fe.play(We))}catch{}}),()=>{z.close(),K.cancel()}},[a]),N.useEffect(()=>{const z=setInterval(()=>{const K=Date.now();nn(K);let le=pL(s.current,K,Xb);mL(s.current,K,Xb)&&(le=!0),uL(s.current,K,BB,UB)&&(le=!0),dL(s.current,K,WB,HB)&&(le=!0),u(fe=>JD(fe,s.current.agents)),p(fe=>fe!=null&&!s.current.agents.has(fe)?null:fe),le&&a()},250);return()=>clearInterval(z)},[a]);const na=N.useRef(null),Kn=N.useRef(0),zs=420,Cn=N.useCallback((z=500)=>{try{const Pe=document.querySelector(".canvas-wrap"),We=Array.from(document.querySelectorAll(".react-flow__node")).filter(jt=>jt.offsetWidth>0);if(!Pe||We.length===0)return;const nt=Pe.getBoundingClientRect(),mt=e.getViewport();if(!Number.isFinite(mt.zoom)||mt.zoom<=0)return;const ct=jt=>(jt-nt.left-mt.x)/mt.zoom,rn=jt=>(jt-nt.top-mt.y)/mt.zoom,ei=We.map(jt=>jt.getBoundingClientRect()),sn=Math.min(...ei.map(jt=>ct(jt.left))),Zs=Math.max(...ei.map(jt=>ct(jt.right))),ga=Math.min(...ei.map(jt=>rn(jt.top))),Wl=Math.max(...ei.map(jt=>rn(jt.bottom))),va=Zs-sn,ti=Wl-ga;if(!(va>0&&ti>0))return;const qr=Math.max(.2,Math.min(1,(nt.width-160)/(va+zs)*.86,(nt.height-160)/ti*.86)),Js={x:80-sn*qr,y:Math.max(80,(nt.height-ti*qr)/2)-ga*qr,zoom:qr};gn(Js,z),Kn.current=Date.now(),Vn.current=hy({durationMs:z,documentHidden:document.hidden})?{target:Js,until:Date.now()+z+60}:null,window.setTimeout(()=>{var jt;try{((jt=Vn.current)==null?void 0:jt.target)===Js&&(Vn.current=null);const Dr=e.getViewport();(Math.abs(Dr.zoom-qr)>.01||Math.abs(Dr.x-Js.x)>2)&&gn(Js,0)}catch{}},z+60)}catch{}},[e,gn]);N.useEffect(()=>{const z=()=>{if(!document.hidden)return;const K=Vn.current;if(Vn.current=null,!(!K||Date.now()>K.until)){try{gn(K.target,0)}catch{}Kn.current=Date.now()}};return document.addEventListener("visibilitychange",z),()=>document.removeEventListener("visibilitychange",z)},[gn]);const Go=N.useRef(""),ls=N.useRef(null),ra=N.useRef(0),Vo=N.useCallback(()=>{ra.current=Date.now()},[]),Ir=N.useRef(null),cs=N.useRef(0),mr=N.useCallback(()=>{cs.current=Date.now()},[]),Bs=N.useCallback(z=>({hasSourceEvent:!!z,at:Date.now(),lastDeckFitAt:Kn.current,lastCanvasInputAt:cs.current}),[]),sa="agent-dag.autoFitDisabled",Al=N.useState(()=>{if(typeof window>"u")return!1;try{return window.localStorage.getItem(sa)==="1"}catch{return!1}})[0],gr=N.useRef(Al),[Us,Yo]=N.useState(Al),Ko=N.useCallback(()=>{if(!gr.current){gr.current=!0,Yo(!0);try{window.localStorage.setItem(sa,"1")}catch{}}},[]),vr=N.useCallback(()=>{gr.current=!1,Yo(!1);try{window.localStorage.removeItem(sa)}catch{}Cn(400)},[e,Cn]);N.useEffect(()=>{const z=setInterval(()=>{if(gr.current||Date.now()-ra.current<800)return;const K=s.current,le=Date.now(),fe=[];for(const Pe of K.agents.values())Yy(Pe,le)&&fe.push({id:Pe.id});if(fe.length===0)return;const Ne=[];for(const{id:Pe}of fe){const We=Xn.current.get(Pe),nt=Qt.current.get(Pe)??It.current.get(Pe);!We||!nt||Ne.push({x:nt.x,y:nt.y,width:We.width,height:We.height})}NB({pane:Ir.current,viewport:e.getViewport(),boxes:Ne})&&Cn(600)},1500);return()=>clearInterval(z)},[e]);const Ws=N.useRef(!1),Xn=N.useRef(new Map),oa=N.useRef(0),Xo=N.useCallback(z=>{const K=Xn.current;let le=!1;for(const fe of z.nodeInternals.values()){const Ne=fe.width,Pe=fe.height;if(Ne==null||Pe==null)continue;const We=K.get(fe.id);We?(Math.abs(We.height-Pe)>4||Math.abs(We.width-Ne)>4)&&(K.set(fe.id,{width:Ne,height:Pe}),le=!0):(K.set(fe.id,{width:Ne,height:Pe}),le=!0)}return le&&(oa.current+=1),oa.current},[]),Hs=it(Xo),[ia,Zt]=N.useState(0);N.useEffect(()=>{let z=0;const K=()=>{const fe=Xn.current;let Ne=!1;for(const Pe of document.querySelectorAll(".react-flow__node[data-id]")){const We=Pe.getAttribute("data-id");if(!We)continue;const nt=Pe.offsetWidth,mt=Pe.offsetHeight;if(!nt||!mt)continue;const ct=fe.get(We);(!ct||Math.abs(ct.width-nt)>4||Math.abs(ct.height-mt)>4)&&(fe.set(We,{width:nt,height:mt}),Ne=!0)}Ne&&Zt(Pe=>Pe+1)};if(Ws.current)return;let le=0;return document.visibilityState==="hidden"?le=window.setTimeout(K,32):z=requestAnimationFrame(K),()=>{cancelAnimationFrame(z),window.clearTimeout(le)}});const It=N.useRef(is.positions),aa=N.useRef(new Set),Or=N.useRef(""),us=N.useMemo(()=>{const z=[];for(const K of s.current.agents.values())Yy(K,xt)&&z.push(K.id+(K.parentId?`>${K.parentId}`:""));return z.sort(),`${z.join("|")}#sv${Hs}.${ia}`},[s.current,s.current.revision,xt,Hs,ia]),Pr=N.useRef(null);N.useEffect(()=>(Pr.current!=null&&window.clearTimeout(Pr.current),Pr.current=window.setTimeout(()=>{vy(It.current,Qt.current)},1500),()=>{Pr.current!=null&&window.clearTimeout(Pr.current)}),[us]),N.useEffect(()=>{if(Go.current===us)return;const z=Go.current;if(Go.current=us,!z||gr.current)return;Date.now()-Kn.current>1200&&Cn(400),na.current&&window.clearTimeout(na.current),na.current=window.setTimeout(()=>{gr.current||Cn(500)},280)},[us,e,Cn]);const Gs=N.useMemo(()=>n5(s.current,l),[s.current,s.current.revision,l]),$r=N.useMemo(()=>mB(s.current,xt),[s.current,s.current.revision,xt]),Vs=N.useRef(null),[Ys,Ml]=N.useState({w:0,h:0});N.useEffect(()=>{const z=Vs.current;if(!z||typeof ResizeObserver>"u")return;const K=new ResizeObserver(le=>{var Ne;const fe=(Ne=le[0])==null?void 0:Ne.contentRect;fe&&(Ir.current={width:fe.width,height:fe.height},Ml(Pe=>Math.abs(Pe.w-fe.width)>40||Math.abs(Pe.h-fe.height)>40?{w:fe.width,h:fe.height}:Pe))});return K.observe(z),Ir.current={width:z.clientWidth,height:z.clientHeight},Ml({w:z.clientWidth,h:z.clientHeight}),()=>K.disconnect()},[]);const td=N.useCallback(z=>{var le,fe;const K=z.target;!(K!=null&&K.closest)||K.closest(FB)!==z.currentTarget||(z.preventDefault(),(fe=(le=document.activeElement)==null?void 0:le.blur)==null||fe.call(le))},[]),nd=N.useRef(new Map),[Qo,rd]=N.useState(!1);N.useEffect(()=>{const z=window.setTimeout(()=>rd(!0),2500);return()=>window.clearTimeout(z)},[]);const[sd,la]=N.useState(!1),yr=N.useRef(null),[ca,ua]=N.useState(!1),od=N.useCallback(()=>{yr.current&&(window.clearTimeout(yr.current),yr.current=null),la(!1)},[]),id=N.useCallback(z=>{z.length!==0&&queueMicrotask(()=>{la(!0),yr.current&&window.clearTimeout(yr.current),yr.current=window.setTimeout(()=>la(!1),zB+80)})},[]);N.useEffect(()=>()=>{yr.current&&window.clearTimeout(yr.current)},[]);const Il=Ys.w>0?Ys.w*.92:0,Ol=Ys.h>0?Ys.h:0,{nodes:jn,edges:ad}=N.useMemo(()=>s8(s.current,xt,Il,Ol,Qt.current,Xn.current,nd.current,id,Qo,ca,It.current,aa.current,us,Or,l,Gs,$r,E),[s.current,s.current.revision,xt,Il,Ol,Qo,ca,us,l,Gs,$r,E,Po]),Pl=N.useMemo(()=>{const z=new Map;for(const le of jn){const fe=le.data;if(!(fe!=null&&fe.sessionId)||fe.exitAt!=null)continue;const Ne=le.width,Pe=le.height;if(Ne==null||Pe==null)continue;const We=le.position.x,nt=le.position.y,mt=We+Ne,ct=nt+Pe,rn=z.get(fe.sessionId);rn?(rn.minX=Math.min(rn.minX,We),rn.minY=Math.min(rn.minY,nt),rn.maxX=Math.max(rn.maxX,mt),rn.maxY=Math.max(rn.maxY,ct)):z.set(fe.sessionId,{minX:We,minY:nt,maxX:mt,maxY:ct})}const K=[];for(const[le,fe]of z){const Ne=fe.maxX-fe.minX+nu*2,Pe=fe.maxY-fe.minY+nu*2;K.push({id:`group:${le}`,type:BR,position:{x:fe.minX-nu,y:fe.minY-nu},data:{sessionId:le,w:Ne,h:Pe},width:Ne,height:Pe,style:{width:Ne,height:Pe},zIndex:-1,draggable:!0,selectable:!1,focusable:!1,deletable:!1,connectable:!1})}return K},[jn,xt]),ld=N.useMemo(()=>{const z=[...Pl,...jn],K=ot.current;return!K||K.size===0?z:z.map(le=>{const fe=K.get(le.id);return fe?{...le,position:fe}:le})},[Pl,jn,Ji]),Ks=N.useMemo(()=>{const z=new Set;for(const K of s.current.agents.values())for(const le of K.tools)z.add(XR(le.name));return Object.keys(Xy).filter(K=>z.has(K))},[s.current,s.current.revision]);N.useEffect(()=>{if(Ks.length<=1){Lo(!1);return}let z=0;const K=()=>{const le=qs.current;if(le&&!document.hidden){const fe=le.getBoundingClientRect(),Ne=Array.from(document.querySelectorAll(".react-flow__node, .tool-burst")).map(We=>We.getBoundingClientRect()),Pe=vB(fe,Ne,8);Lo(We=>We===Pe?We:Pe)}z=window.setTimeout(K,300)};return K(),()=>window.clearTimeout(z)},[Ks.length]);const cd=N.useCallback(z=>{Tl(K=>{const le=new Set(K);return le.has(z)?le.delete(z):le.add(z),le})},[]),Jt=h?s.current.agents.get(h):null,da=f?Array.from(s.current.agents.values()).flatMap(z=>z.tools).find(z=>z.id===f)??null:null,$l=N.useCallback(async()=>{try{await fetch("/api/clear",{method:"POST"})}catch{}s.current=Oy(),Qt.current.clear(),Xn.current.clear(),It.current.clear(),Or.current="",jC(),w(),a()},[a,w]),Ll=N.useRef(C);Ll.current=C;const ql=N.useRef(I);ql.current=I;const fa=N.useRef(!1);fa.current=da!=null||Tr||_!=null||S!=null||ts||I||He!=null;const ds=N.useCallback(z=>{const K=aD(z,{confirmOpen:Ll.current,modalOpen:fa.current});K==="confirm"?j(!0):K==="clear"&&(j(!1),$l())},[$l]),Lr=N.useCallback(()=>{Qt.current.clear(),It.current.clear(),Or.current="",jC(),a(),window.setTimeout(()=>Cn(500),80)},[a,e,Cn]),Dl=N.useCallback(()=>Cn(500),[Cn]),Xs=N.useRef(jn);Xs.current=jn;const ha=N.useRef(h);ha.current=h;const Zo=N.useCallback(z=>{const K=Xs.current,le=YD(K.map(Pe=>({id:Pe.id,x:Pe.position.x,y:Pe.position.y})),ha.current,z),fe=le?K.find(Pe=>Pe.id===le):void 0;if(!fe)return;const Ne=bC(document.activeElement);y(fe.id,!1),window.setTimeout(()=>{try{e.fitView({padding:.35,duration:350,nodes:[fe]})}catch{}Kn.current=Date.now(),Ne&&DB(fe.id)},30)},[y,e]),pa=N.useCallback(z=>{y(z,!1),window.setTimeout(()=>{try{const K=Xs.current.find(le=>le.id===z);K&&e.fitView({padding:.3,duration:500,nodes:[K]}),Kn.current=Date.now()}catch{}},60)},[y,e]);N.useEffect(()=>{const z=K=>{var nt,mt;const le=K.target,fe={tagName:le==null?void 0:le.tagName,isContentEditable:le==null?void 0:le.isContentEditable,role:(nt=le==null?void 0:le.getAttribute)==null?void 0:nt.call(le,"role"),type:le==null?void 0:le.type};if(K.key==="Escape"){const ct=PL({overlayOpen:Oi.depth()>0,panelOnTop:Oi.topIsPanel(),typing:_w(fe)});ct==="dismiss"?Oi.dismissTop():ct==="blur"?le==null||le.blur():(ZD(fe)&&(le==null||le.blur()),w());return}if(bw(K))return;const Ne=bC(le)?(mt=le==null?void 0:le.getAttribute)==null?void 0:mt.call(le,"data-id"):null,Pe=Ne&&Xs.current.some(ct=>ct.id===Ne)?Ne:null,We=XD(K,Pe);if(We.kind==="activate"){K.preventDefault(),y(We.nodeId,We.additive);return}We.kind!=="node"&&(We.nodeId==null&&UL(fe)||WL({key:K.key,modalOpen:fa.current,sheetOpen:ql.current})||(K.key===" "&&(K.preventDefault(),rs()),(K.key==="c"||K.key==="C")&&ds("shortcut"),(K.key==="r"||K.key==="R")&&Lr(),(K.key==="f"||K.key==="F")&&Dl(),(K.key==="l"||K.key==="L")&&Zi(),(K.key==="h"||K.key==="H")&&fr(ct=>!ct),(K.key==="u"||K.key==="U")&&V(ct=>!ct),(K.key==="a"||K.key==="A")&&wt.current.claude&&dr(),(K.key==="j"||K.key==="J")&&Zo(1),(K.key==="k"||K.key==="K")&&Zo(-1),(K.key==="t"||K.key==="T")&&ta(ct=>ct==="dark"?"light":"dark"),(K.key==="m"||K.key==="M")&&wt.current.claude&&$.current!==null&&J.current(K.shiftKey),K.key==="?"&&O(ct=>!ct)))};return window.addEventListener("keydown",z),()=>window.removeEventListener("keydown",z)},[ds,Lr,Dl,w,y,Zo,rs]);const Jo=s.current.agents.size,Gt=N.useMemo(()=>eq(s.current.agents.values()),[s.current,s.current.revision]),Fl=N.useMemo(()=>tq(s.current.agents.values()),[s.current,s.current.revision]),zl=N.useRef(null);N.useEffect(()=>{const z=h5({waiting:Gt.length,running:Fl,connected:Le}),K=zl.current;if(zl.current=z,(K==null?void 0:K.title)!==z.title&&(document.title=z.title),(K==null?void 0:K.icon)!==z.icon){const le=document.querySelector('link[rel="icon"]');le&&(le.href=p5[z.icon])}},[Gt.length,Fl,Le]);const[ud,Bl]=N.useState(""),ma=g5(Gt);return N.useEffect(()=>{Bl(z=>v5(z,ma))},[ma]),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:Ft}),je?d.jsxs("button",{type:"button",className:"v stale",onClick:()=>{Te(),Sn()},"aria-haspopup":"dialog","aria-label":TB({...je,open:kt}),title:je.kind==="restart"?`Running v${je.from}; v${je.to} is installed on disk. Restart to pick it up · click for what's new`:`Running v${je.from}; v${je.to} is on npm · click for what's new`,children:["v",je.from,d.jsx("span",{className:"v-dot","aria-hidden":!0})]}):(()=>{const z={running:Ie,latest:ce==null?void 0:ce.latest,latestPending:ce==null?void 0:ce.latestPending,checkedAgo:ce!=null&&ce.checkedAt?Fy(xt-ce.checkedAt):null,checkDisabled:ce==null?void 0:ce.checkDisabled,checking:_e};return d.jsxs("button",{type:"button",className:_e?"v checking":"v",onClick:()=>{Te(),Ge(!0)},"aria-busy":_e||void 0,"aria-haspopup":"dialog","aria-label":jB(z),title:CB(z),children:["v",z.running]})})()]}),d.jsxs("span",{className:"status",children:[(()=>{const z=LB({connected:Le,paused:Un,held:Ht.size,dropped:Ht.dropped});return z.resting?null:d.jsx("span",{className:`pill ${z.tone}`,title:z.title,children:d.jsxs("span",{className:"pill-box",children:[d.jsx("span",{className:"pill-widest","aria-hidden":!0,children:z.widest}),d.jsx("span",{className:"pill-label",children:z.label})]})})})(),d.jsx(Zq,{usageOpen:W})]}),d.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:ud}),Gt.length>0&&d.jsxs("button",{type:"button",className:"waiting-stat",onClick:()=>pa(Gt[0].id),title:`Blocked waiting for you — click to go to the one that has been stuck longest:
172
+ ${Gt.map(z=>` ${z.label}: ${Iu(z.waiting)} (${Fy(xt-z.waiting.since)})`).join(`
173
+ `)}`,"aria-label":`${Gt.length} session${Gt.length===1?"":"s"} waiting for you`,children:[d.jsx("span",{className:"ap-pulse","aria-hidden":!0}),d.jsx("b",{children:Gt.length})," waiting"]})]}),Jt&&(()=>{const z=bn(Jt),K=Math.max(0,((Jt.endedAt??xt)-Jt.startedAt)/1e3),le=Jt.state==="active"?xw(z.total,K):null,fe=l.size-1;return d.jsxs("button",{type:"button",className:"selected-ribbon",title:`Fit view to ${Jt.label}`,onClick:()=>{try{const Ne=jn.find(Pe=>Pe.id===Jt.id);Ne&&e.fitView({padding:.35,duration:500,nodes:[Ne]}),Kn.current=Date.now()}catch{}},children:[d.jsx("span",{className:`state-pill state-${Jt.state}`,children:Jt.state==="active"?"live":Jt.state}),d.jsx("span",{className:"selected-label",children:Jt.label}),z.total>0&&d.jsxs("span",{className:"selected-cost",children:[et(z.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:Ne=>{Ne.stopPropagation(),w()},children:"×"})]})})(),d.jsxs("div",{className:"actions",children:[d.jsxs("div",{className:"action-run",children:[d.jsx("button",{className:"btn icon-btn",onClick:()=>V(z=>!z),title:`${W?"Hide":"Show"} usage panel (U)`,"aria-label":"Toggle usage panel","aria-expanded":W,"aria-controls":W?"usage-panel":void 0,children:"$"}),st.claude&&d.jsx("button",{className:"btn icon-btn",onClick:dr,title:`${T?"Hide":"Show"} accounts (A)`,"aria-label":"Toggle accounts panel","aria-expanded":T,"aria-controls":T?"accounts-panel":void 0,children:d.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[d.jsx("circle",{cx:"7",cy:"4.6",r:"2.4"}),d.jsx("path",{d:"M2.4 12c0-2.3 2.1-3.7 4.6-3.7s4.6 1.4 4.6 3.7"})]})}),d.jsx("button",{className:"btn icon-btn",onClick:()=>fr(z=>!z),title:"Usage history — ccusage (H)","aria-label":"Open usage history","aria-haspopup":"dialog",children:d.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round","aria-hidden":!0,children:[d.jsx("line",{x1:"3",y1:"11.5",x2:"3",y2:"7"}),d.jsx("line",{x1:"7",y1:"11.5",x2:"7",y2:"3"}),d.jsx("line",{x1:"11",y1:"11.5",x2:"11",y2:"8.5"})]})}),d.jsxs("button",{className:`btn icon-btn bw-btn${Bn>0?" has-findings":Rr?" watching":""}`,onClick:()=>Ro(z=>!z),title:Rr?"Browser watch — watching; the deck is keeping its own copy":"Browser watch — not watching; reading the browser's history live","aria-label":`Browser watch, ${Rr?"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"}),Rr||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:[st.claude&&U!==null&&d.jsxs("div",{className:"sound-slot",children:[d.jsx("button",{ref:we,className:"btn icon-btn",onClick:()=>pe(z=>!z),...or(!1),title:S5(st,{on:U===!0,locked:Ve==="locked",prefs:G}),"aria-label":"Sound settings","aria-haspopup":"dialog","aria-expanded":he,"aria-controls":he?"sound-menu":void 0,children:d.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[d.jsx("path",{d:"M3.2 5.2h2L7.8 3v8L5.2 8.8h-2z"}),U?d.jsxs(d.Fragment,{children:[d.jsx("path",{d:"M9.8 5.4a2.4 2.4 0 0 1 0 3.2"}),d.jsx("path",{d:"M11.3 3.9a4.6 4.6 0 0 1 0 6.2"})]}):d.jsxs(d.Fragment,{children:[d.jsx("path",{d:"M10 5.6l2.6 2.8"}),d.jsx("path",{d:"M12.6 5.6L10 8.4"})]})]})}),he&&d.jsx(MD,{onClose:()=>pe(!1),soundOn:U===!0,onToggleSound:X,prefs:G,onLevel:(z,K)=>re(z,{level:K}),onFigure:(z,K)=>re(z,{figure:K}),onPreview:z=>Y(z),openerRef:we})]}),d.jsx("button",{className:"btn icon-btn",onClick:()=>ta(z=>z==="dark"?"light":"dark"),title:`Switch to ${Mr==="dark"?"light":"dark"} mode (T)`,"aria-label":"Toggle theme",children:Mr==="dark"?"☀":"☾"})]})]})]}),ss?d.jsxs("div",{className:"ver-banner done",role:"status",children:[d.jsx("span",{className:"ver-dot"}),d.jsxs("strong",{children:["Restarted — now running v",ss,"."]}),d.jsx("span",{className:"ver-sub",children:"The canvas replayed from the event log."})]}):Gn&&!Le?d.jsxs("div",{className:"conn-banner",role:"alert",children:[d.jsx("span",{className:"conn-dot"}),Ar?Fo==="npx"?"Fetching the new version with npx — this can take a minute…":`Restarting ${Ft}…`:(()=>{const z=PB({connected:Le,paused:Un});return d.jsxs(d.Fragment,{children:[`Lost connection to the ${Ft} server. Reconnecting…`,z&&d.jsx("span",{className:"conn-sub",children:z})]})})()]}):kt&&je?d.jsxs("div",{className:`ver-banner ${je.kind}`,role:"status",children:[d.jsx("span",{className:"ver-dot"}),je.kind==="restart"?d.jsxs(d.Fragment,{children:[d.jsxs("strong",{children:["v",je.to," is installed — this deck still runs v",je.from,"."]}),ce!=null&&ce.canRestart?d.jsxs(d.Fragment,{children:[d.jsx("button",{type:"button",className:"ver-act",onClick:()=>Fs(),...or(Ar),title:"Stop this process and bring it back on the same port. The canvas replays from the event log.",children:Ar?"restarting…":"Restart now"}),d.jsxs("button",{type:"button",className:`ver-auto${Wn?" on":""}`,role:"switch","aria-checked":Wn,onClick:ed,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:[Ft," v",je.to," is out — you are on v",je.from,"."]}),(ce==null?void 0:ce.upgradeMode)==="install"&&zt!=="failed"&&d.jsx("button",{type:"button",className:"ver-act",onClick:$s,...or(zt==="running",zt==="done"),title:`Runs ${((hs=ce==null?void 0:ce.upgrade)==null?void 0:hs.command)??(ce==null?void 0:ce.command)??"npm i -g"} here, then restarts once nothing is running.`,children:zt==="running"?"installing…":zt==="done"?"installed":"Update now"}),(ce==null?void 0:ce.upgradeMode)==="npx"&&(ce==null?void 0:ce.canRestart)&&d.jsx("button",{type:"button",className:"ver-act",onClick:()=>Fs({upgrade:!0}),...or(Ar),title:`Runs ${ce==null?void 0:ce.command} and hands it this port. Nothing is installed globally — npx unpacks its own copy.`,children:Ar?"fetching…":zt==="failed"?"Retry update":"Update & restart"}),zt==="failed"?d.jsxs("span",{className:"ver-sub fail",title:((Ul=ce==null?void 0:ce.upgrade)==null?void 0:Ul.error)??"",children:[(ce==null?void 0:ce.upgradeMode)==="npx"?"update failed":"install failed",": ",((Qs=ce==null?void 0:ce.upgrade)==null?void 0:Qs.error)??"unknown error"," — run it yourself:"]}):(ce==null?void 0:ce.upgradeMode)==="npx"?d.jsx("span",{className:"ver-sub",children:ce!=null&&ce.canRestart?"npx cannot upgrade in place, so the deck re-runs:":gy.npx}):ce!=null&&ce.upgradeBlocked?d.jsx("span",{className:"ver-sub",children:Object.hasOwn(gy,ce.upgradeBlocked)?gy[ce.upgradeBlocked]:"cannot install from here"}):null,d.jsxs("button",{type:"button",className:"ver-cmd",onClick:jr,title:"Copy to clipboard",children:[d.jsx("code",{children:ce==null?void 0:ce.command}),d.jsx("span",{className:"ver-cmd-hint",children:ut?"copied":"copy"})]})]}),d.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:Fn,children:"×"})]}):jo&&pn?d.jsxs("div",{className:"ver-banner",role:"status",children:[d.jsx("span",{className:"ver-dot"}),d.jsxs("strong",{children:[pn," still works — the deck is called ",Ft," now."]}),ce!=null&&ce.renameFix?d.jsx("span",{className:"ver-sub",children:ce.renameFix}):null,d.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:To,children:"×"})]}):null,W&&d.jsx(Nq,{state:s.current,now:xt,providers:st,onClose:()=>V(!1)}),T&&st.claude&&d.jsx(eD,{onClose:()=>Q(!1)}),F&&d.jsx(rq,{state:s.current,now:xt,selectedIds:l,onSelect:pa,onClose:()=>M(!1)}),d.jsxs("main",{id:"canvas",tabIndex:-1,className:`canvas-wrap${sd?" bubbling":""}${ca?" dragging-any":""}`,ref:Vs,onMouseDownCapture:td,onPointerDownCapture:mr,onPointerUpCapture:mr,onWheelCapture:mr,children:[Jo===0&&d.jsx(a8,{live:Le,everConnected:Gn,providers:st}),Ks.length>1&&d.jsx("div",{ref:qs,className:`cat-filter-bar${$o?" occluded":""}`,role:"group","aria-label":"Filter tools by category",children:Ks.map(z=>{const K=ea.has(z);return d.jsxs("button",{type:"button",className:`cat-filter${K?" off":""}`,onClick:()=>cd(z),"aria-pressed":!K,title:`${K?"Show":"Hide"} ${Qy[z]} tools`,children:[d.jsx("span",{className:"cat-emoji",children:Xy[z]}),d.jsx("span",{className:"cat-name",children:Qy[z]})]},z)})}),d.jsxs(Vj,{nodes:ld,edges:ad,nodeTypes:qB,fitView:!Je,fitViewOptions:{padding:.25,duration:hy({durationMs:_C,documentHidden:document.hidden})?_C:0},minZoom:.2,maxZoom:1.6,panOnScroll:!0,nodesDraggable:!0,nodesConnectable:!1,selectionOnDrag:!1,nodeDragThreshold:5,onNodeClick:(z,K)=>{if(K.type==="sessionGroup"){w();return}y(K.id,z.shiftKey)},onPaneClick:()=>w(),onMoveStart:z=>{yC(Bs(z))&&Ko()},onMove:(z,K)=>{Vo(),yC(Bs(z))&&Ko(),ls.current&&window.clearTimeout(ls.current),ls.current=window.setTimeout(()=>n8(K),250)},onNodeDragStart:(z,K)=>{var le;if(od(),Ws.current=!0,ot.current=new Map,ua(!0),Vo(),Ko(),K.type==="sessionGroup"){const fe=(le=K.data)==null?void 0:le.sessionId,Ne=new Map;if(fe)for(const Pe of jn){const We=Pe.data;(We==null?void 0:We.sessionId)===fe&&Ne.set(Pe.id,{x:Pe.position.x,y:Pe.position.y})}as.current={start:{x:K.position.x,y:K.position.y},members:Ne};return}Qt.current.set(K.id,{x:K.position.x,y:K.position.y})},onNodeDrag:(z,K)=>{var le;if(Vo(),K.type==="sessionGroup"){const fe=as.current;if(!fe)return;const Ne=K.position.x-fe.start.x,Pe=K.position.y-fe.start.y;for(const[nt,mt]of fe.members){const ct={x:mt.x+Ne,y:mt.y+Pe};Qt.current.set(nt,ct),It.current.set(nt,ct)}const We=ot.current;if(We){for(const[nt,mt]of fe.members)We.set(nt,{x:mt.x+Ne,y:mt.y+Pe});We.set(K.id,{x:K.position.x,y:K.position.y})}ns(nt=>nt+1);return}Qt.current.set(K.id,{x:K.position.x,y:K.position.y}),It.current.set(K.id,{x:K.position.x,y:K.position.y}),(le=ot.current)==null||le.set(K.id,{x:K.position.x,y:K.position.y}),ns(fe=>fe+1)},onNodeDragStop:(z,K)=>{if(Vo(),Ws.current=!1,ot.current=null,ua(!1),Ls(le=>le+1),K.type==="sessionGroup"){const le=as.current;if(le){const fe=K.position.x-le.start.x,Ne=K.position.y-le.start.y;for(const[Pe,We]of le.members){const nt={x:We.x+fe,y:We.y+Ne};Qt.current.set(Pe,nt),It.current.set(Pe,nt)}}as.current=null,vy(It.current,Qt.current),Ls(fe=>fe+1);return}Qt.current.set(K.id,{x:K.position.x,y:K.position.y}),It.current.set(K.id,{x:K.position.x,y:K.position.y}),vy(It.current,Qt.current)},children:[d.jsx(X$,{gap:28,size:1,color:Hn["--grid-line"]}),d.jsx(f3,{}),d.jsx(V3,{agents:s.current.agents,visibleAgentIds:$r,positions:It.current,pinned:Qt.current,measured:Xn.current,spotlight:Gs,hiddenCategories:ea,now:xt,onOpenTool:g}),d.jsxs(W$,{showInteractive:!1,children:[d.jsx(kr,{onClick:vr,title:Us?"Recenter view + re-enable autofit":"Recenter view (autofit already on)","aria-label":"Recenter view",style:Us?{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(kr,{onClick:rs,title:OB({paused:Un,held:Ht.size,dropped:Ht.dropped}),"aria-label":IB,"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(kr,{onClick:Lr,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(kr,{onClick:()=>ds("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(kr,{onClick:()=>O(z=>!z),title:"Keyboard shortcuts (?)","aria-label":"Open the keyboard shortcuts","aria-haspopup":"dialog",children:d.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[d.jsx("path",{d:"M8.6 8.4a3.5 3.5 0 1 1 4.6 3.35c-.85.3-1.2 1-1.2 1.85v1",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),d.jsx("path",{d:"M12 18.4v.2",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",fill:"none"})]})})]}),d.jsx(L$,{zoomable:!0,pannable:!0,nodeColor:Ho,nodeStrokeWidth:2,maskColor:Hn["--minimap-mask"],style:hr})]})]}),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:"×"}),Jt?d.jsx(u8,{agent:Jt,now:xt,onOpenTool:g,onShowSummary:z=>{P.has(z)&&(P.delete(z),CC(P)),b(z)},onExportSession:z=>r8(s.current,z)}):d.jsx(c8,{count:Jo,workspace:Xe})]}):d.jsx("button",{type:"button",className:"detail-reopen",title:"Show detail panel","aria-label":"Show detail panel",onClick:()=>q(!0),children:"‹"}),da&&d.jsx(r3,{tool:da,onClose:()=>g(null)}),Tr&&d.jsx(T5,{providers:st,onClose:()=>fr(!1)}),ts&&d.jsx(z5,{onClose:()=>Ro(!1),onSeen:z=>{Mo(z);try{localStorage.setItem(G1,String(z))}catch{}},onWatching:Oo,palette:Hn}),_&&(()=>{const z=s.current.agents.get(_);return z?d.jsx(XL,{agent:z,onClose:()=>k(null)}):null})(),S&&d.jsx(Z3,{state:s.current,sessionId:S,onClose:()=>{P.add(S),CC(P),b(null)}}),He&&d.jsx(GD,{entries:He.entries,since:He.since,firstRun:He.firstRun,running:Ie,onClose:()=>Ke(null)}),I&&d.jsx(pD,{onClose:()=>O(!1)}),C&&d.jsx(dD,{agentCount:Jo,onConfirm:()=>ds("confirmation"),onCancel:()=>j(!1)})]})}function a8({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:Ft})," is still running in your terminal, then this page will resume automatically."]})]}):l8(n)]})}function l8(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:Ft})," is running."]}),k5(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=RB(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 u8({agent:e,now:t,onOpenTool:n,onShowSummary:s,onExportSession:i}){const a=wu(e.startedAt,e.endedAt,t),l=bn(e),u=l.total>0,h=e.usage.inputTokens+e.usage.outputTokens,p=new Map;for(const S of e.tools){const b=XR(S.name);p.set(b,(p.get(b)??0)+1)}const f=e.tools.filter(S=>S.ok===!1).length,g=e.tools.filter(S=>!S.endedAt).length,y=Array.from(p.entries()).sort((S,b)=>b[1]-S[1]),w=p.has("mcp")?B3(e.tools.map(S=>S.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 S=lT(e);return d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"hero-sep",children:"·"}),d.jsxs("span",{className:"model-chip","data-family":Mu(e.model),title:S.length>0?`${e.model}
174
+ spend on this panel also covers:
175
+ ${S.join(`
176
+ `)}`:e.model,children:[Os(e.model),S.length>0?` +${S.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:et(l.total)}),d.jsx("span",{className:"hero-cost-label",children:"spend"})]}),d.jsx(Sw,{cost:l})]}),d.jsxs("div",{className:"hero-actions",children:[e.kind==="root"&&e.state==="done"&&s&&d.jsx("button",{type:"button",className:"btn hero-action-btn",onClick:()=>s(e.sessionId),title:"Reopen the end-of-session recap modal",children:"Show recap"}),i&&d.jsx("button",{type:"button",className:"btn hero-action-btn",onClick:()=>i(e.sessionId),title:"Download this session as JSON",children:"Export JSON"})]})]}),e.tools.length>0&&d.jsxs("section",{className:"detail-section",children:[d.jsx("h3",{children:"Activity"}),d.jsxs("div",{className:"activity-row",children:[d.jsxs("div",{className:"activity-counters",children:[d.jsxs("span",{className:"ac-item",children:[d.jsx("b",{children:e.toolCount})," calls"]}),g>0&&d.jsxs("span",{className:"ac-item ac-live",children:[d.jsx("b",{children:g})," live"]}),f>0&&d.jsxs("span",{className:"ac-item ac-err",children:[d.jsx("b",{children:f})," err"]})]}),d.jsx("div",{className:"cat-strip",children:y.map(([S,b])=>{const _=S==="mcp"?w:null,k=_==null?void 0:_.hue,E=`${b} ${Qy[S]} call${b===1?"":"s"}`;return d.jsxs("span",{className:`cat-chip cat-${S}${k!=null?" mcp-hue":""}`,style:k!=null?{"--mcp-hue":k}:void 0,title:_?`${E}, all to ${_.label}`:E,children:[d.jsx("span",{className:"cat-emoji",children:Xy[S]}),d.jsx("span",{className:"cat-count",children:b}),_&&d.jsx("span",{className:"cat-server",children:_.label})]},S)})})]})]}),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((S,b)=>{const _=hq(S.at,t);return d.jsxs("div",{className:"prompt-entry",children:[d.jsx("div",{className:"prompt-time",title:_.title,children:_.label}),d.jsx("div",{className:"prompt-text",children:S.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(S=>d.jsx(f8,{t:S,onClick:()=>n(S.id)},S.id))})]})]})}const d8={inflight:"in-flight",done:"done",err:"error"};function f8({t:e,onClick:t}){const n=e.endedAt==null?"inflight":e.ok===!1?"err":"done",s=cT(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:d8[n]}),e.name]}),d.jsx("span",{style:{color:"var(--muted)"},children:s})]})}try{jq(window.localStorage)}catch{}const h8=KA.createRoot(document.getElementById("root"));h8.render(d.jsx(o8,{}));