agent-dag 3.8.9 → 3.9.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,217 @@
|
|
|
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 Kc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function cw(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var qf={exports:{}},Va={},Df={exports:{}},Xe={};/**
|
|
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 Vx;function KA(){if(Vx)return Xe;Vx=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),l=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),g=Symbol.iterator;function v($){return $===null||typeof $!="object"?null:($=g&&$[g]||$["@@iterator"],typeof $=="function"?$:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},E=Object.assign,b={};function k($,Y,de){this.props=$,this.context=Y,this.refs=b,this.updater=de||w}k.prototype.isReactComponent={},k.prototype.setState=function($,Y){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,$,Y,"setState")},k.prototype.forceUpdate=function($){this.updater.enqueueForceUpdate(this,$,"forceUpdate")};function S(){}S.prototype=k.prototype;function N($,Y,de){this.props=$,this.context=Y,this.refs=b,this.updater=de||w}var C=N.prototype=new S;C.constructor=N,E(C,k.prototype),C.isPureReactComponent=!0;var j=Array.isArray,M=Object.prototype.hasOwnProperty,P={current:null},I={key:!0,ref:!0,__self:!0,__source:!0};function D($,Y,de){var G,F={},J=null,V=null;if(Y!=null)for(G in Y.ref!==void 0&&(V=Y.ref),Y.key!==void 0&&(J=""+Y.key),Y)M.call(Y,G)&&!I.hasOwnProperty(G)&&(F[G]=Y[G]);var ae=arguments.length-2;if(ae===1)F.children=de;else if(1<ae){for(var pe=Array(ae),me=0;me<ae;me++)pe[me]=arguments[me+2];F.children=pe}if($&&$.defaultProps)for(G in ae=$.defaultProps,ae)F[G]===void 0&&(F[G]=ae[G]);return{$$typeof:e,type:$,key:J,ref:V,props:F,_owner:P.current}}function O($,Y){return{$$typeof:e,type:$.type,key:Y,ref:$.ref,props:$.props,_owner:$._owner}}function A($){return typeof $=="object"&&$!==null&&$.$$typeof===e}function L($){var Y={"=":"=0",":":"=2"};return"$"+$.replace(/[=:]/g,function(de){return Y[de]})}var z=/\/+/g;function K($,Y){return typeof $=="object"&&$!==null&&$.key!=null?L(""+$.key):Y.toString(36)}function R($,Y,de,G,F){var J=typeof $;(J==="undefined"||J==="boolean")&&($=null);var V=!1;if($===null)V=!0;else switch(J){case"string":case"number":V=!0;break;case"object":switch($.$$typeof){case e:case t:V=!0}}if(V)return V=$,F=F(V),$=G===""?"."+K(V,0):G,j(F)?(de="",$!=null&&(de=$.replace(z,"$&/")+"/"),R(F,Y,de,"",function(me){return me})):F!=null&&(A(F)&&(F=O(F,de+(!F.key||V&&V.key===F.key?"":(""+F.key).replace(z,"$&/")+"/")+$)),Y.push(F)),1;if(V=0,G=G===""?".":G+":",j($))for(var ae=0;ae<$.length;ae++){J=$[ae];var pe=G+K(J,ae);V+=R(J,Y,de,pe,F)}else if(pe=v($),typeof pe=="function")for($=pe.call($),ae=0;!(J=$.next()).done;)J=J.value,pe=G+K(J,ae++),V+=R(J,Y,de,pe,F);else if(J==="object")throw Y=String($),Error("Objects are not valid as a React child (found: "+(Y==="[object Object]"?"object with keys {"+Object.keys($).join(", ")+"}":Y)+"). If you meant to render a collection of children, use an array instead.");return V}function Q($,Y,de){if($==null)return $;var G=[],F=0;return R($,G,"","",function(J){return Y.call(de,J,F++)}),G}function H($){if($._status===-1){var Y=$._result;Y=Y(),Y.then(function(de){($._status===0||$._status===-1)&&($._status=1,$._result=de)},function(de){($._status===0||$._status===-1)&&($._status=2,$._result=de)}),$._status===-1&&($._status=0,$._result=Y)}if($._status===1)return $._result.default;throw $._result}var ne={current:null},X={transition:null},W={ReactCurrentDispatcher:ne,ReactCurrentBatchConfig:X,ReactCurrentOwner:P};function ee(){throw Error("act(...) is not supported in production builds of React.")}return Xe.Children={map:Q,forEach:function($,Y,de){Q($,function(){Y.apply(this,arguments)},de)},count:function($){var Y=0;return Q($,function(){Y++}),Y},toArray:function($){return Q($,function(Y){return Y})||[]},only:function($){if(!A($))throw Error("React.Children.only expected to receive a single React element child.");return $}},Xe.Component=k,Xe.Fragment=n,Xe.Profiler=i,Xe.PureComponent=N,Xe.StrictMode=s,Xe.Suspense=h,Xe.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=W,Xe.act=ee,Xe.cloneElement=function($,Y,de){if($==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+$+".");var G=E({},$.props),F=$.key,J=$.ref,V=$._owner;if(Y!=null){if(Y.ref!==void 0&&(J=Y.ref,V=P.current),Y.key!==void 0&&(F=""+Y.key),$.type&&$.type.defaultProps)var ae=$.type.defaultProps;for(pe in Y)M.call(Y,pe)&&!I.hasOwnProperty(pe)&&(G[pe]=Y[pe]===void 0&&ae!==void 0?ae[pe]:Y[pe])}var pe=arguments.length-2;if(pe===1)G.children=de;else if(1<pe){ae=Array(pe);for(var me=0;me<pe;me++)ae[me]=arguments[me+2];G.children=ae}return{$$typeof:e,type:$.type,key:F,ref:J,props:G,_owner:V}},Xe.createContext=function($){return $={$$typeof:l,_currentValue:$,_currentValue2:$,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},$.Provider={$$typeof:a,_context:$},$.Consumer=$},Xe.createElement=D,Xe.createFactory=function($){var Y=D.bind(null,$);return Y.type=$,Y},Xe.createRef=function(){return{current:null}},Xe.forwardRef=function($){return{$$typeof:u,render:$}},Xe.isValidElement=A,Xe.lazy=function($){return{$$typeof:f,_payload:{_status:-1,_result:$},_init:H}},Xe.memo=function($,Y){return{$$typeof:p,type:$,compare:Y===void 0?null:Y}},Xe.startTransition=function($){var Y=X.transition;X.transition={};try{$()}finally{X.transition=Y}},Xe.unstable_act=ee,Xe.useCallback=function($,Y){return ne.current.useCallback($,Y)},Xe.useContext=function($){return ne.current.useContext($)},Xe.useDebugValue=function(){},Xe.useDeferredValue=function($){return ne.current.useDeferredValue($)},Xe.useEffect=function($,Y){return ne.current.useEffect($,Y)},Xe.useId=function(){return ne.current.useId()},Xe.useImperativeHandle=function($,Y,de){return ne.current.useImperativeHandle($,Y,de)},Xe.useInsertionEffect=function($,Y){return ne.current.useInsertionEffect($,Y)},Xe.useLayoutEffect=function($,Y){return ne.current.useLayoutEffect($,Y)},Xe.useMemo=function($,Y){return ne.current.useMemo($,Y)},Xe.useReducer=function($,Y,de){return ne.current.useReducer($,Y,de)},Xe.useRef=function($){return ne.current.useRef($)},Xe.useState=function($){return ne.current.useState($)},Xe.useSyncExternalStore=function($,Y,de){return ne.current.useSyncExternalStore($,Y,de)},Xe.useTransition=function(){return ne.current.useTransition()},Xe.version="18.3.1",Xe}var Yx;function _l(){return Yx||(Yx=1,Df.exports=KA()),Df.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 Kx;function XA(){if(Kx)return Va;Kx=1;var e=_l(),t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,i=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a={key:!0,ref:!0,__self:!0,__source:!0};function l(u,h,p){var f,g={},v=null,w=null;p!==void 0&&(v=""+p),h.key!==void 0&&(v=""+h.key),h.ref!==void 0&&(w=h.ref);for(f in h)s.call(h,f)&&!a.hasOwnProperty(f)&&(g[f]=h[f]);if(u&&u.defaultProps)for(f in h=u.defaultProps,h)g[f]===void 0&&(g[f]=h[f]);return{$$typeof:t,type:u,key:v,ref:w,props:g,_owner:i.current}}return Va.Fragment=n,Va.jsx=l,Va.jsxs=l,Va}var Xx;function QA(){return Xx||(Xx=1,qf.exports=XA()),qf.exports}var d=QA(),Xc={},Ff={exports:{}},un={},zf={exports:{}},Bf={};/**
|
|
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 Qx;function ZA(){return Qx||(Qx=1,(function(e){function t(X,W){var ee=X.length;X.push(W);e:for(;0<ee;){var $=ee-1>>>1,Y=X[$];if(0<i(Y,W))X[$]=W,X[ee]=Y,ee=$;else break e}}function n(X){return X.length===0?null:X[0]}function s(X){if(X.length===0)return null;var W=X[0],ee=X.pop();if(ee!==W){X[0]=ee;e:for(var $=0,Y=X.length,de=Y>>>1;$<de;){var G=2*($+1)-1,F=X[G],J=G+1,V=X[J];if(0>i(F,ee))J<Y&&0>i(V,F)?(X[$]=V,X[J]=ee,$=J):(X[$]=F,X[G]=ee,$=G);else if(J<Y&&0>i(V,ee))X[$]=V,X[J]=ee,$=J;else break e}}return W}function i(X,W){var ee=X.sortIndex-W.sortIndex;return ee!==0?ee:X.id-W.id}if(typeof performance=="object"&&typeof performance.now=="function"){var a=performance;e.unstable_now=function(){return a.now()}}else{var l=Date,u=l.now();e.unstable_now=function(){return l.now()-u}}var h=[],p=[],f=1,g=null,v=3,w=!1,E=!1,b=!1,k=typeof setTimeout=="function"?setTimeout:null,S=typeof clearTimeout=="function"?clearTimeout:null,N=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 W=n(p);W!==null;){if(W.callback===null)s(p);else if(W.startTime<=X)s(p),W.sortIndex=W.expirationTime,t(h,W);else break;W=n(p)}}function j(X){if(b=!1,C(X),!E)if(n(h)!==null)E=!0,H(M);else{var W=n(p);W!==null&&ne(j,W.startTime-X)}}function M(X,W){E=!1,b&&(b=!1,S(D),D=-1),w=!0;var ee=v;try{for(C(W),g=n(h);g!==null&&(!(g.expirationTime>W)||X&&!L());){var $=g.callback;if(typeof $=="function"){g.callback=null,v=g.priorityLevel;var Y=$(g.expirationTime<=W);W=e.unstable_now(),typeof Y=="function"?g.callback=Y:g===n(h)&&s(h),C(W)}else s(h);g=n(h)}if(g!==null)var de=!0;else{var G=n(p);G!==null&&ne(j,G.startTime-W),de=!1}return de}finally{g=null,v=ee,w=!1}}var P=!1,I=null,D=-1,O=5,A=-1;function L(){return!(e.unstable_now()-A<O)}function z(){if(I!==null){var X=e.unstable_now();A=X;var W=!0;try{W=I(!0,X)}finally{W?K():(P=!1,I=null)}}else P=!1}var K;if(typeof N=="function")K=function(){N(z)};else if(typeof MessageChannel<"u"){var R=new MessageChannel,Q=R.port2;R.port1.onmessage=z,K=function(){Q.postMessage(null)}}else K=function(){k(z,0)};function H(X){I=X,P||(P=!0,K())}function ne(X,W){D=k(function(){X(e.unstable_now())},W)}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(){E||w||(E=!0,H(M))},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"):O=0<X?Math.floor(1e3/X):5},e.unstable_getCurrentPriorityLevel=function(){return v},e.unstable_getFirstCallbackNode=function(){return n(h)},e.unstable_next=function(X){switch(v){case 1:case 2:case 3:var W=3;break;default:W=v}var ee=v;v=W;try{return X()}finally{v=ee}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(X,W){switch(X){case 1:case 2:case 3:case 4:case 5:break;default:X=3}var ee=v;v=X;try{return W()}finally{v=ee}},e.unstable_scheduleCallback=function(X,W,ee){var $=e.unstable_now();switch(typeof ee=="object"&&ee!==null?(ee=ee.delay,ee=typeof ee=="number"&&0<ee?$+ee:$):ee=$,X){case 1:var Y=-1;break;case 2:Y=250;break;case 5:Y=1073741823;break;case 4:Y=1e4;break;default:Y=5e3}return Y=ee+Y,X={id:f++,callback:W,priorityLevel:X,startTime:ee,expirationTime:Y,sortIndex:-1},ee>$?(X.sortIndex=ee,t(p,X),n(h)===null&&X===n(p)&&(b?(S(D),D=-1):b=!0,ne(j,ee-$))):(X.sortIndex=Y,t(h,X),E||w||(E=!0,H(M))),X},e.unstable_shouldYield=L,e.unstable_wrapCallback=function(X){var W=v;return function(){var ee=v;v=W;try{return X.apply(this,arguments)}finally{v=ee}}}})(Bf)),Bf}var Zx;function JA(){return Zx||(Zx=1,zf.exports=ZA()),zf.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 Jx;function e2(){if(Jx)return un;Jx=1;var e=_l(),t=JA();function n(r){for(var o="https://reactjs.org/docs/error-decoder.html?invariant="+r,c=1;c<arguments.length;c++)o+="&args[]="+encodeURIComponent(arguments[c]);return"Minified React error #"+r+"; visit "+o+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var s=new Set,i={};function a(r,o){l(r,o),l(r+"Capture",o)}function l(r,o){for(i[r]=o,r=0;r<o.length;r++)s.add(o[r])}var u=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),h=Object.prototype.hasOwnProperty,p=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,f={},g={};function v(r){return h.call(g,r)?!0:h.call(f,r)?!1:p.test(r)?g[r]=!0:(f[r]=!0,!1)}function w(r,o,c,m){if(c!==null&&c.type===0)return!1;switch(typeof o){case"function":case"symbol":return!0;case"boolean":return m?!1:c!==null?!c.acceptsBooleans:(r=r.toLowerCase().slice(0,5),r!=="data-"&&r!=="aria-");default:return!1}}function E(r,o,c,m){if(o===null||typeof o>"u"||w(r,o,c,m))return!0;if(m)return!1;if(c!==null)switch(c.type){case 3:return!o;case 4:return o===!1;case 5:return isNaN(o);case 6:return isNaN(o)||1>o}return!1}function b(r,o,c,m,y,x,T){this.acceptsBooleans=o===2||o===3||o===4,this.attributeName=m,this.attributeNamespace=y,this.mustUseProperty=c,this.propertyName=r,this.type=o,this.sanitizeURL=x,this.removeEmptyString=T}var k={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(r){k[r]=new b(r,0,!1,r,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(r){var o=r[0];k[o]=new b(o,1,!1,r[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(r){k[r]=new b(r,2,!1,r.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(r){k[r]=new b(r,2,!1,r,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(r){k[r]=new b(r,3,!1,r.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(r){k[r]=new b(r,3,!0,r,null,!1,!1)}),["capture","download"].forEach(function(r){k[r]=new b(r,4,!1,r,null,!1,!1)}),["cols","rows","size","span"].forEach(function(r){k[r]=new b(r,6,!1,r,null,!1,!1)}),["rowSpan","start"].forEach(function(r){k[r]=new b(r,5,!1,r.toLowerCase(),null,!1,!1)});var S=/[\-:]([a-z])/g;function N(r){return r[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(r){var o=r.replace(S,N);k[o]=new b(o,1,!1,r,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(r){var o=r.replace(S,N);k[o]=new b(o,1,!1,r,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(r){var o=r.replace(S,N);k[o]=new b(o,1,!1,r,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(r){k[r]=new b(r,1,!1,r.toLowerCase(),null,!1,!1)}),k.xlinkHref=new b("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(r){k[r]=new b(r,1,!1,r.toLowerCase(),null,!0,!0)});function C(r,o,c,m){var y=k.hasOwnProperty(o)?k[o]:null;(y!==null?y.type!==0:m||!(2<o.length)||o[0]!=="o"&&o[0]!=="O"||o[1]!=="n"&&o[1]!=="N")&&(E(o,c,y,m)&&(c=null),m||y===null?v(o)&&(c===null?r.removeAttribute(o):r.setAttribute(o,""+c)):y.mustUseProperty?r[y.propertyName]=c===null?y.type===3?!1:"":c:(o=y.attributeName,m=y.attributeNamespace,c===null?r.removeAttribute(o):(y=y.type,c=y===3||y===4&&c===!0?"":""+c,m?r.setAttributeNS(m,o,c):r.setAttribute(o,c))))}var j=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,M=Symbol.for("react.element"),P=Symbol.for("react.portal"),I=Symbol.for("react.fragment"),D=Symbol.for("react.strict_mode"),O=Symbol.for("react.profiler"),A=Symbol.for("react.provider"),L=Symbol.for("react.context"),z=Symbol.for("react.forward_ref"),K=Symbol.for("react.suspense"),R=Symbol.for("react.suspense_list"),Q=Symbol.for("react.memo"),H=Symbol.for("react.lazy"),ne=Symbol.for("react.offscreen"),X=Symbol.iterator;function W(r){return r===null||typeof r!="object"?null:(r=X&&r[X]||r["@@iterator"],typeof r=="function"?r:null)}var ee=Object.assign,$;function Y(r){if($===void 0)try{throw Error()}catch(c){var o=c.stack.trim().match(/\n( *(at )?)/);$=o&&o[1]||""}return`
|
|
34
|
+
`+$+r}var de=!1;function G(r,o){if(!r||de)return"";de=!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(le){var m=le}Reflect.construct(r,[],o)}else{try{o.call()}catch(le){m=le}r.call(o.prototype)}else{try{throw Error()}catch(le){m=le}r()}}catch(le){if(le&&m&&typeof le.stack=="string"){for(var y=le.stack.split(`
|
|
35
|
+
`),x=m.stack.split(`
|
|
36
|
+
`),T=y.length-1,U=x.length-1;1<=T&&0<=U&&y[T]!==x[U];)U--;for(;1<=T&&0<=U;T--,U--)if(y[T]!==x[U]){if(T!==1||U!==1)do if(T--,U--,0>U||y[T]!==x[U]){var Z=`
|
|
37
|
+
`+y[T].replace(" at new "," at ");return r.displayName&&Z.includes("<anonymous>")&&(Z=Z.replace("<anonymous>",r.displayName)),Z}while(1<=T&&0<=U);break}}}finally{de=!1,Error.prepareStackTrace=c}return(r=r?r.displayName||r.name:"")?Y(r):""}function F(r){switch(r.tag){case 5:return Y(r.type);case 16:return Y("Lazy");case 13:return Y("Suspense");case 19:return Y("SuspenseList");case 0:case 2:case 15:return r=G(r.type,!1),r;case 11:return r=G(r.type.render,!1),r;case 1:return r=G(r.type,!0),r;default:return""}}function J(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 I:return"Fragment";case P:return"Portal";case O:return"Profiler";case D:return"StrictMode";case K:return"Suspense";case R:return"SuspenseList"}if(typeof r=="object")switch(r.$$typeof){case L:return(r.displayName||"Context")+".Consumer";case A:return(r._context.displayName||"Context")+".Provider";case z: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:J(r.type)||"Memo";case H:o=r._payload,r=r._init;try{return J(r(o))}catch{}}return null}function V(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 J(o);case 8:return o===D?"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 ae(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 me(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 y=c.get,x=c.set;return Object.defineProperty(r,o,{configurable:!0,get:function(){return y.call(this)},set:function(T){m=""+T,x.call(this,T)}}),Object.defineProperty(r,o,{enumerable:c.enumerable}),{getValue:function(){return m},setValue:function(T){m=""+T},stopTracking:function(){r._valueTracker=null,delete r[o]}}}}function ke(r){r._valueTracker||(r._valueTracker=me(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 ze(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 Oe(r,o){var c=o.checked;return ee({},o,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:c??r._wrapperState.initialChecked})}function Ne(r,o){var c=o.defaultValue==null?"":o.defaultValue,m=o.checked!=null?o.checked:o.defaultChecked;c=ae(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=ae(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")?he(r,o.type,c):o.hasOwnProperty("defaultValue")&&he(r,o.type,ae(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 he(r,o,c){(o!=="number"||ze(r.ownerDocument)!==r)&&(c==null?r.defaultValue=""+r._wrapperState.initialValue:r.defaultValue!==""+c&&(r.defaultValue=""+c))}var Pe=Array.isArray;function Be(r,o,c,m){if(r=r.options,o){o={};for(var y=0;y<c.length;y++)o["$"+c[y]]=!0;for(c=0;c<r.length;c++)y=o.hasOwnProperty("$"+r[c].value),r[c].selected!==y&&(r[c].selected=y),y&&m&&(r[c].defaultSelected=!0)}else{for(c=""+ae(c),o=null,y=0;y<r.length;y++){if(r[y].value===c){r[y].selected=!0,m&&(r[y].defaultSelected=!0);return}o!==null||r[y].disabled||(o=r[y])}o!==null&&(o.selected=!0)}}function Ze(r,o){if(o.dangerouslySetInnerHTML!=null)throw Error(n(91));return ee({},o,{value:void 0,defaultValue:void 0,children:""+r._wrapperState.initialValue})}function Ge(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(Pe(c)){if(1<c.length)throw Error(n(93));c=c[0]}o=c}o==null&&(o=""),c=o}r._wrapperState={initialValue:ae(c)}}function Je(r,o){var c=ae(o.value),m=ae(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 qe(r){var o=r.textContent;o===r._wrapperState.initialValue&&o!==""&&o!==null&&(r.value=o)}function Ye(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 Te(r,o){return r==null||r==="http://www.w3.org/1999/xhtml"?Ye(o):r==="http://www.w3.org/2000/svg"&&o==="foreignObject"?"http://www.w3.org/1999/xhtml":r}var et,it=(function(r){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(o,c,m,y){MSApp.execUnsafeLocalFunction(function(){return r(o,c,m,y)})}:r})(function(r,o){if(r.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in r)r.innerHTML=o;else{for(et=et||document.createElement("div"),et.innerHTML="<svg>"+o.valueOf().toString()+"</svg>",o=et.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 Le={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Ue=["Webkit","ms","Moz","O"];Object.keys(Le).forEach(function(r){Ue.forEach(function(o){o=o+r.charAt(0).toUpperCase()+r.substring(1),Le[o]=Le[r]})});function Ce(r,o,c){return o==null||typeof o=="boolean"||o===""?"":c||typeof o!="number"||o===0||Le.hasOwnProperty(r)&&Le[r]?(""+o).trim():o+"px"}function Ke(r,o){r=r.style;for(var c in o)if(o.hasOwnProperty(c)){var m=c.indexOf("--")===0,y=Ce(c,o[c],m);c==="float"&&(c="cssFloat"),m?r.setProperty(c,y):r[c]=y}}var jt=ee({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 at(r,o){if(o){if(jt[r]&&(o.children!=null||o.dangerouslySetInnerHTML!=null))throw Error(n(137,r));if(o.dangerouslySetInnerHTML!=null){if(o.children!=null)throw Error(n(60));if(typeof o.dangerouslySetInnerHTML!="object"||!("__html"in o.dangerouslySetInnerHTML))throw Error(n(61))}if(o.style!=null&&typeof o.style!="object")throw Error(n(62))}}function Re(r,o){if(r.indexOf("-")===-1)return typeof o.is=="string";switch(r){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var bt=null;function ft(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var yt=null,Sn=null,zn=null;function Nn(r){if(r=Ma(r)){if(typeof yt!="function")throw Error(n(280));var o=r.stateNode;o&&(o=uc(o),yt(r.stateNode,r.type,o))}}function To(r){Sn?zn?zn.push(r):zn=[r]:Sn=r}function hn(){if(Sn){var r=Sn,o=zn;if(zn=Sn=null,Nn(r),o)for(r=0;r<o.length;r++)Nn(o[r])}}function Ro(r,o){return r(o)}function Ao(){}var Ut=!1;function Tr(r,o,c){if(Ut)return r(o,c);Ut=!0;try{return Ro(r,o,c)}finally{Ut=!1,(Sn!==null||zn!==null)&&(Ao(),hn())}}function Bn(r,o){var c=r.stateNode;if(c===null)return null;var m=uc(c);if(m===null)return null;c=m[o];e:switch(o){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(m=!m.disabled)||(r=r.type,m=!(r==="button"||r==="input"||r==="select"||r==="textarea")),r=!m;break e;default:r=!1}if(r)return null;if(c&&typeof c!="function")throw Error(n(231,o,typeof c));return c}var Ds=!1;if(u)try{var Rr={};Object.defineProperty(Rr,"passive",{get:function(){Ds=!0}}),window.addEventListener("test",Rr,Rr),window.removeEventListener("test",Rr,Rr)}catch{Ds=!1}function Mo(r,o,c,m,y,x,T,U,Z){var le=Array.prototype.slice.call(arguments,3);try{o.apply(c,le)}catch(ye){this.onError(ye)}}var hr=!1,Ar=null,pr=!1,ns=null,Io={onError:function(r){hr=!0,Ar=r}};function Oo(r,o,c,m,y,x,T,U,Z){hr=!1,Ar=null,Mo.apply(Io,arguments)}function Po(r,o,c,m,y,x,T,U,Z){if(Oo.apply(this,arguments),hr){if(hr){var le=Ar;hr=!1,Ar=null}else throw Error(n(198));pr||(pr=!0,ns=le)}}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 $o(r){if(r.tag===13){var o=r.memoizedState;if(o===null&&(r=r.alternate,r!==null&&(o=r.memoizedState)),o!==null)return o.dehydrated}return null}function Mr(r){if(En(r)!==r)throw Error(n(188))}function Lo(r){var o=r.alternate;if(!o){if(o=En(r),o===null)throw Error(n(188));return o!==r?null:r}for(var c=r,m=o;;){var y=c.return;if(y===null)break;var x=y.alternate;if(x===null){if(m=y.return,m!==null){c=m;continue}break}if(y.child===x.child){for(x=y.child;x;){if(x===c)return Mr(y),r;if(x===m)return Mr(y),o;x=x.sibling}throw Error(n(188))}if(c.return!==m.return)c=y,m=x;else{for(var T=!1,U=y.child;U;){if(U===c){T=!0,c=y,m=x;break}if(U===m){T=!0,m=y,c=x;break}U=U.sibling}if(!T){for(U=x.child;U;){if(U===c){T=!0,c=x,m=y;break}if(U===m){T=!0,m=x,c=y;break}U=U.sibling}if(!T)throw Error(n(189))}}if(c.alternate!==m)throw Error(n(190))}if(c.tag!==3)throw Error(n(188));return c.stateNode.current===c?r:o}function Un(r){return r=Lo(r),r!==null?qo(r):null}function qo(r){if(r.tag===5||r.tag===6)return r;for(r=r.child;r!==null;){var o=qo(r);if(o!==null)return o;r=r.sibling}return null}var Fs=t.unstable_scheduleCallback,zs=t.unstable_cancelCallback,Do=t.unstable_shouldYield,Fo=t.unstable_requestPaint,ct=t.unstable_now,sa=t.unstable_getCurrentPriorityLevel,rs=t.unstable_ImmediatePriority,Vt=t.unstable_UserBlockingPriority,Wn=t.unstable_NormalPriority,zo=t.unstable_LowPriority,ss=t.unstable_IdlePriority,kt=null,rn=null;function Hn(r){if(rn&&typeof rn.onCommitFiberRoot=="function")try{rn.onCommitFiberRoot(kt,r,void 0,(r.current.flags&128)===128)}catch{}}var pn=Math.clz32?Math.clz32:Bo,hd=Math.log,Ir=Math.LN2;function Bo(r){return r>>>=0,r===0?32:31-(hd(r)/Ir|0)|0}var Uo=64,Wo=4194304;function os(r){switch(r&-r){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return r&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return r&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return r}}function Bs(r,o){var c=r.pendingLanes;if(c===0)return 0;var m=0,y=r.suspendedLanes,x=r.pingedLanes,T=c&268435455;if(T!==0){var U=T&~y;U!==0?m=os(U):(x&=T,x!==0&&(m=os(x)))}else T=c&~y,T!==0?m=os(T):x!==0&&(m=os(x));if(m===0)return 0;if(o!==0&&o!==m&&(o&y)===0&&(y=m&-m,x=o&-o,y>=x||y===16&&(x&4194240)!==0))return o;if((m&4)!==0&&(m|=c&16),o=r.entangledLanes,o!==0)for(r=r.entanglements,o&=m;0<o;)c=31-pn(o),y=1<<c,m|=r[c],o&=~y;return m}function is(r,o){switch(r){case 1:case 2:case 4:return o+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return o+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Dl(r,o){for(var c=r.suspendedLanes,m=r.pingedLanes,y=r.expirationTimes,x=r.pendingLanes;0<x;){var T=31-pn(x),U=1<<T,Z=y[T];Z===-1?((U&c)===0||(U&m)!==0)&&(y[T]=is(U,o)):Z<=o&&(r.expiredLanes|=U),x&=~U}}function Ho(r){return r=r.pendingLanes&-1073741825,r!==0?r:r&1073741824?1073741824:0}function Us(){var r=Uo;return Uo<<=1,(Uo&4194240)===0&&(Uo=64),r}function Go(r){for(var o=[],c=0;31>c;c++)o.push(r);return o}function as(r,o,c){r.pendingLanes|=o,o!==536870912&&(r.suspendedLanes=0,r.pingedLanes=0),r=r.eventTimes,o=31-pn(o),r[o]=c}function Zt(r,o){var c=r.pendingLanes&~o;r.pendingLanes=o,r.suspendedLanes=0,r.pingedLanes=0,r.expiredLanes&=o,r.mutableReadLanes&=o,r.entangledLanes&=o,o=r.entanglements;var m=r.eventTimes;for(r=r.expirationTimes;0<c;){var y=31-pn(c),x=1<<y;o[y]=0,m[y]=-1,r[y]=-1,c&=~x}}function ls(r,o){var c=r.entangledLanes|=o;for(r=r.entanglements;c;){var m=31-pn(c),y=1<<m;y&o|r[m]&o&&(r[m]|=o),c&=~y}}var tt=0;function Vo(r){return r&=-r,1<r?4<r?(r&268435455)!==0?16:536870912:4:1}var Fl,Or,oa,Gn,zl,Yo=!1,Ko=[],mr=null,Vn=null,gr=null,mn=new Map,Yn=new Map,Kn=[],ia="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function Cn(r,o){switch(r){case"focusin":case"focusout":mr=null;break;case"dragenter":case"dragleave":Vn=null;break;case"mouseover":case"mouseout":gr=null;break;case"pointerover":case"pointerout":mn.delete(o.pointerId);break;case"gotpointercapture":case"lostpointercapture":Yn.delete(o.pointerId)}}function Ws(r,o,c,m,y,x){return r===null||r.nativeEvent!==x?(r={blockedOn:o,domEventName:c,eventSystemFlags:m,nativeEvent:x,targetContainers:[y]},o!==null&&(o=Ma(o),o!==null&&Or(o)),r):(r.eventSystemFlags|=m,o=r.targetContainers,y!==null&&o.indexOf(y)===-1&&o.push(y),r)}function jn(r,o,c,m,y){switch(o){case"focusin":return mr=Ws(mr,r,o,c,m,y),!0;case"dragenter":return Vn=Ws(Vn,r,o,c,m,y),!0;case"mouseover":return gr=Ws(gr,r,o,c,m,y),!0;case"pointerover":var x=y.pointerId;return mn.set(x,Ws(mn.get(x)||null,r,o,c,m,y)),!0;case"gotpointercapture":return x=y.pointerId,Yn.set(x,Ws(Yn.get(x)||null,r,o,c,m,y)),!0}return!1}function Xo(r){var o=no(r.target);if(o!==null){var c=En(o);if(c!==null){if(o=c.tag,o===13){if(o=$o(c),o!==null){r.blockedOn=o,zl(r.priority,function(){oa(c)});return}}else if(o===3&&c.stateNode.current.memoizedState.isDehydrated){r.blockedOn=c.tag===3?c.stateNode.containerInfo:null;return}}}r.blockedOn=null}function cs(r){if(r.blockedOn!==null)return!1;for(var o=r.targetContainers;0<o.length;){var c=Zo(r.domEventName,r.eventSystemFlags,o[0],r.nativeEvent);if(c===null){c=r.nativeEvent;var m=new c.constructor(c.type,c);bt=m,c.target.dispatchEvent(m),bt=null}else return o=Ma(c),o!==null&&Or(o),r.blockedOn=c,!1;o.shift()}return!0}function aa(r,o,c){cs(r)&&c.delete(o)}function Qo(){Yo=!1,mr!==null&&cs(mr)&&(mr=null),Vn!==null&&cs(Vn)&&(Vn=null),gr!==null&&cs(gr)&&(gr=null),mn.forEach(aa),Yn.forEach(aa)}function Pr(r,o){r.blockedOn===o&&(r.blockedOn=null,Yo||(Yo=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Qo)))}function us(r){function o(y){return Pr(y,r)}if(0<Ko.length){Pr(Ko[0],r);for(var c=1;c<Ko.length;c++){var m=Ko[c];m.blockedOn===r&&(m.blockedOn=null)}}for(mr!==null&&Pr(mr,r),Vn!==null&&Pr(Vn,r),gr!==null&&Pr(gr,r),mn.forEach(o),Yn.forEach(o),c=0;c<Kn.length;c++)m=Kn[c],m.blockedOn===r&&(m.blockedOn=null);for(;0<Kn.length&&(c=Kn[0],c.blockedOn===null);)Xo(c),c.blockedOn===null&&Kn.shift()}var yr=j.ReactCurrentBatchConfig,Hs=!0;function la(r,o,c,m){var y=tt,x=yr.transition;yr.transition=null;try{tt=1,vr(r,o,c,m)}finally{tt=y,yr.transition=x}}function Bl(r,o,c,m){var y=tt,x=yr.transition;yr.transition=null;try{tt=4,vr(r,o,c,m)}finally{tt=y,yr.transition=x}}function vr(r,o,c,m){if(Hs){var y=Zo(r,o,c,m);if(y===null)Cd(r,o,m,Gs,c),Cn(r,m);else if(jn(y,r,o,c,m))m.stopPropagation();else if(Cn(r,m),o&4&&-1<ia.indexOf(r)){for(;y!==null;){var x=Ma(y);if(x!==null&&Fl(x),x=Zo(r,o,c,m),x===null&&Cd(r,o,m,Gs,c),x===y)break;y=x}y!==null&&m.stopPropagation()}else Cd(r,o,m,null,c)}}var Gs=null;function Zo(r,o,c,m){if(Gs=null,r=ft(m),r=no(r),r!==null)if(o=En(r),o===null)r=null;else if(c=o.tag,c===13){if(r=$o(o),r!==null)return r;r=null}else if(c===3){if(o.stateNode.current.memoizedState.isDehydrated)return o.tag===3?o.stateNode.containerInfo:null;r=null}else o!==r&&(r=null);return Gs=r,null}function Jo(r){switch(r){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(sa()){case rs:return 1;case Vt:return 4;case Wn:case zo:return 16;case ss:return 536870912;default:return 16}default:return 16}}var wr=null,Vs=null,Xn=null;function ca(){if(Xn)return Xn;var r,o=Vs,c=o.length,m,y="value"in wr?wr.value:wr.textContent,x=y.length;for(r=0;r<c&&o[r]===y[r];r++);var T=c-r;for(m=1;m<=T&&o[c-m]===y[x-m];m++);return Xn=y.slice(r,1<m?1-m:void 0)}function ei(r){var o=r.keyCode;return"charCode"in r?(r=r.charCode,r===0&&o===13&&(r=13)):r=o,r===10&&(r=13),32<=r||r===13?r:0}function Ys(){return!0}function ua(){return!1}function Jt(r){function o(c,m,y,x,T){this._reactName=c,this._targetInst=y,this.type=m,this.nativeEvent=x,this.target=T,this.currentTarget=null;for(var U in r)r.hasOwnProperty(U)&&(c=r[U],this[U]=c?c(x):x[U]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?Ys:ua,this.isPropagationStopped=ua,this}return ee(o.prototype,{preventDefault:function(){this.defaultPrevented=!0;var c=this.nativeEvent;c&&(c.preventDefault?c.preventDefault():typeof c.returnValue!="unknown"&&(c.returnValue=!1),this.isDefaultPrevented=Ys)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=Ys)},persist:function(){},isPersistent:Ys}),o}var Ot={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},da=Jt(Ot),$r=ee({},Ot,{view:0,detail:0}),ds=Jt($r),Lr,Ks,qr,Xs=ee({},$r,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Tn,button:0,buttons:0,relatedTarget:function(r){return r.relatedTarget===void 0?r.fromElement===r.srcElement?r.toElement:r.fromElement:r.relatedTarget},movementX:function(r){return"movementX"in r?r.movementX:(r!==qr&&(qr&&r.type==="mousemove"?(Lr=r.screenX-qr.screenX,Ks=r.screenY-qr.screenY):Ks=Lr=0,qr=r),Lr)},movementY:function(r){return"movementY"in r?r.movementY:Ks}}),Qs=Jt(Xs),Ul=ee({},Xs,{dataTransfer:0}),pd=Jt(Ul),md=ee({},$r,{relatedTarget:0}),ti=Jt(md),gd=ee({},Ot,{animationName:0,elapsedTime:0,pseudoElement:0}),yd=Jt(gd),fa=ee({},Ot,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),xr=Jt(fa),ha=ee({},Ot,{data:0}),pa=Jt(ha),vd={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},wd={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Wl={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Hl(r){var o=this.nativeEvent;return o.getModifierState?o.getModifierState(r):(r=Wl[r])?!!o[r]:!1}function Tn(){return Hl}var xd=ee({},$r,{key:function(r){if(r.key){var o=vd[r.key]||r.key;if(o!=="Unidentified")return o}return r.type==="keypress"?(r=ei(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?wd[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Tn,charCode:function(r){return r.type==="keypress"?ei(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?ei(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),Gl=Jt(xd),bd=ee({},Xs,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Zs=Jt(bd),kd=ee({},$r,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Tn}),en=Jt(kd),ma=ee({},Ot,{propertyName:0,elapsedTime:0,pseudoElement:0}),Vl=Jt(ma),Yl=ee({},Xs,{deltaX:function(r){return"deltaX"in r?r.deltaX:"wheelDeltaX"in r?-r.wheelDeltaX:0},deltaY:function(r){return"deltaY"in r?r.deltaY:"wheelDeltaY"in r?-r.wheelDeltaY:"wheelDelta"in r?-r.wheelDelta:0},deltaZ:0,deltaMode:0}),Kl=Jt(Yl),ga=[9,13,27,32],fs=u&&"CompositionEvent"in window,Dr=null;u&&"documentMode"in document&&(Dr=document.documentMode);var Xl=u&&"TextEvent"in window&&!Dr,Js=u&&(!fs||Dr&&8<Dr&&11>=Dr),ya=" ",ni=!1;function ri(r,o){switch(r){case"keyup":return ga.indexOf(o.keyCode)!==-1;case"keydown":return o.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function si(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var _t=!1;function Ql(r,o){switch(r){case"compositionend":return si(o);case"keypress":return o.which!==32?null:(ni=!0,ya);case"textInput":return r=o.data,r===ya&&ni?null:r;default:return null}}function Zl(r,o){if(_t)return r==="compositionend"||!fs&&ri(r,o)?(r=ca(),Xn=Vs=wr=null,_t=!1,r):null;switch(r){case"paste":return null;case"keypress":if(!(o.ctrlKey||o.altKey||o.metaKey)||o.ctrlKey&&o.altKey){if(o.char&&1<o.char.length)return o.char;if(o.which)return String.fromCharCode(o.which)}return null;case"compositionend":return Js&&o.locale!=="ko"?null:o.data;default:return null}}var _d={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Jl(r){var o=r&&r.nodeName&&r.nodeName.toLowerCase();return o==="input"?!!_d[r.type]:o==="textarea"}function va(r,o,c,m){To(m),o=ac(o,"onChange"),0<o.length&&(c=new da("onChange","change",null,c,m),r.push({event:c,listeners:o}))}var Qn=null,eo=null;function Fr(r){c0(r,0)}function hs(r){var o=di(r);if(Ve(o))return r}function Sd(r,o){if(r==="change")return o}var ec=!1;if(u){var Zn;if(u){var to="oninput"in document;if(!to){var tc=document.createElement("div");tc.setAttribute("oninput","return;"),to=typeof tc.oninput=="function"}Zn=to}else Zn=!1;ec=Zn&&(!document.documentMode||9<document.documentMode)}function wa(){Qn&&(Qn.detachEvent("onpropertychange",nc),eo=Qn=null)}function nc(r){if(r.propertyName==="value"&&hs(eo)){var o=[];va(o,eo,r,ft(r)),Tr(Fr,o)}}function rc(r,o,c){r==="focusin"?(wa(),Qn=o,eo=c,Qn.attachEvent("onpropertychange",nc)):r==="focusout"&&wa()}function xa(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return hs(eo)}function sc(r,o){if(r==="click")return hs(o)}function oi(r,o){if(r==="input"||r==="change")return hs(o)}function ba(r,o){return r===o&&(r!==0||1/r===1/o)||r!==r&&o!==o}var gn=typeof Object.is=="function"?Object.is:ba;function ps(r,o){if(gn(r,o))return!0;if(typeof r!="object"||r===null||typeof o!="object"||o===null)return!1;var c=Object.keys(r),m=Object.keys(o);if(c.length!==m.length)return!1;for(m=0;m<c.length;m++){var y=c[m];if(!h.call(o,y)||!gn(r[y],o[y]))return!1}return!0}function ka(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function _a(r,o){var c=ka(r);r=0;for(var m;c;){if(c.nodeType===3){if(m=r+c.textContent.length,r<=o&&m>=o)return{node:c,offset:o-r};r=m}e:{for(;c;){if(c.nextSibling){c=c.nextSibling;break e}c=c.parentNode}c=void 0}c=ka(c)}}function Sa(r,o){return r&&o?r===o?!0:r&&r.nodeType===3?!1:o&&o.nodeType===3?Sa(r,o.parentNode):"contains"in r?r.contains(o):r.compareDocumentPosition?!!(r.compareDocumentPosition(o)&16):!1:!1}function q(){for(var r=window,o=ze();o instanceof r.HTMLIFrameElement;){try{var c=typeof o.contentWindow.location.href=="string"}catch{c=!1}if(c)r=o.contentWindow;else break;o=ze(r.document)}return o}function B(r){var o=r&&r.nodeName&&r.nodeName.toLowerCase();return o&&(o==="input"&&(r.type==="text"||r.type==="search"||r.type==="tel"||r.type==="url"||r.type==="password")||o==="textarea"||r.contentEditable==="true")}function ie(r){var o=q(),c=r.focusedElem,m=r.selectionRange;if(o!==c&&c&&c.ownerDocument&&Sa(c.ownerDocument.documentElement,c)){if(m!==null&&B(c)){if(o=m.start,r=m.end,r===void 0&&(r=o),"selectionStart"in c)c.selectionStart=o,c.selectionEnd=Math.min(r,c.value.length);else if(r=(o=c.ownerDocument||document)&&o.defaultView||window,r.getSelection){r=r.getSelection();var y=c.textContent.length,x=Math.min(m.start,y);m=m.end===void 0?x:Math.min(m.end,y),!r.extend&&x>m&&(y=m,m=x,x=y),y=_a(c,x);var T=_a(c,m);y&&T&&(r.rangeCount!==1||r.anchorNode!==y.node||r.anchorOffset!==y.offset||r.focusNode!==T.node||r.focusOffset!==T.offset)&&(o=o.createRange(),o.setStart(y.node,y.offset),r.removeAllRanges(),x>m?(r.addRange(o),r.extend(T.node,T.offset)):(o.setEnd(T.node,T.offset),r.addRange(o)))}}for(o=[],r=c;r=r.parentNode;)r.nodeType===1&&o.push({element:r,left:r.scrollLeft,top:r.scrollTop});for(typeof c.focus=="function"&&c.focus(),c=0;c<o.length;c++)r=o[c],r.element.scrollLeft=r.left,r.element.scrollTop=r.top}}var ue=u&&"documentMode"in document&&11>=document.documentMode,_e=null,Ae=null,We=null,nt=!1;function pt(r,o,c){var m=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;nt||_e==null||_e!==ze(m)||(m=_e,"selectionStart"in m&&B(m)?m={start:m.selectionStart,end:m.selectionEnd}:(m=(m.ownerDocument&&m.ownerDocument.defaultView||window).getSelection(),m={anchorNode:m.anchorNode,anchorOffset:m.anchorOffset,focusNode:m.focusNode,focusOffset:m.focusOffset}),We&&ps(We,m)||(We=m,m=ac(Ae,"onSelect"),0<m.length&&(o=new da("onSelect","select",null,o,c),r.push({event:o,listeners:m}),o.target=_e)))}function lt(r,o){var c={};return c[r.toLowerCase()]=o.toLowerCase(),c["Webkit"+r]="webkit"+o,c["Moz"+r]="moz"+o,c}var Pt={animationend:lt("Animation","AnimationEnd"),animationiteration:lt("Animation","AnimationIteration"),animationstart:lt("Animation","AnimationStart"),transitionend:lt("Transition","TransitionEnd")},ms={},Na={};u&&(Na=document.createElement("div").style,"AnimationEvent"in window||(delete Pt.animationend.animation,delete Pt.animationiteration.animation,delete Pt.animationstart.animation),"TransitionEvent"in window||delete Pt.transitionend.transition);function ii(r){if(ms[r])return ms[r];if(!Pt[r])return r;var o=Pt[r],c;for(c in o)if(o.hasOwnProperty(c)&&c in Na)return ms[r]=o[c];return r}var Ea=ii("animationend"),oc=ii("animationiteration"),Ca=ii("animationstart"),ai=ii("transitionend"),gs=new Map,ys="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function dt(r,o){gs.set(r,o),a(o,[r])}for(var li=0;li<ys.length;li++){var Nd=ys[li],sA=Nd.toLowerCase(),oA=Nd[0].toUpperCase()+Nd.slice(1);dt(sA,"on"+oA)}dt(Ea,"onAnimationEnd"),dt(oc,"onAnimationIteration"),dt(Ca,"onAnimationStart"),dt("dblclick","onDoubleClick"),dt("focusin","onFocus"),dt("focusout","onBlur"),dt(ai,"onTransitionEnd"),l("onMouseEnter",["mouseout","mouseover"]),l("onMouseLeave",["mouseout","mouseover"]),l("onPointerEnter",["pointerout","pointerover"]),l("onPointerLeave",["pointerout","pointerover"]),a("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),a("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),a("onBeforeInput",["compositionend","keypress","textInput","paste"]),a("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),a("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),a("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ja="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),iA=new Set("cancel close invalid load scroll toggle".split(" ").concat(ja));function l0(r,o,c){var m=r.type||"unknown-event";r.currentTarget=c,Po(m,o,void 0,r),r.currentTarget=null}function c0(r,o){o=(o&4)!==0;for(var c=0;c<r.length;c++){var m=r[c],y=m.event;m=m.listeners;e:{var x=void 0;if(o)for(var T=m.length-1;0<=T;T--){var U=m[T],Z=U.instance,le=U.currentTarget;if(U=U.listener,Z!==x&&y.isPropagationStopped())break e;l0(y,U,le),x=Z}else for(T=0;T<m.length;T++){if(U=m[T],Z=U.instance,le=U.currentTarget,U=U.listener,Z!==x&&y.isPropagationStopped())break e;l0(y,U,le),x=Z}}}if(pr)throw r=ns,pr=!1,ns=null,r}function mt(r,o){var c=o[Id];c===void 0&&(c=o[Id]=new Set);var m=r+"__bubble";c.has(m)||(u0(o,r,2,!1),c.add(m))}function Ed(r,o,c){var m=0;o&&(m|=4),u0(c,r,m,o)}var ic="_reactListening"+Math.random().toString(36).slice(2);function Ta(r){if(!r[ic]){r[ic]=!0,s.forEach(function(c){c!=="selectionchange"&&(iA.has(c)||Ed(c,!1,r),Ed(c,!0,r))});var o=r.nodeType===9?r:r.ownerDocument;o===null||o[ic]||(o[ic]=!0,Ed("selectionchange",!1,o))}}function u0(r,o,c,m){switch(Jo(o)){case 1:var y=la;break;case 4:y=Bl;break;default:y=vr}c=y.bind(null,o,c,r),y=void 0,!Ds||o!=="touchstart"&&o!=="touchmove"&&o!=="wheel"||(y=!0),m?y!==void 0?r.addEventListener(o,c,{capture:!0,passive:y}):r.addEventListener(o,c,!0):y!==void 0?r.addEventListener(o,c,{passive:y}):r.addEventListener(o,c,!1)}function Cd(r,o,c,m,y){var x=m;if((o&1)===0&&(o&2)===0&&m!==null)e:for(;;){if(m===null)return;var T=m.tag;if(T===3||T===4){var U=m.stateNode.containerInfo;if(U===y||U.nodeType===8&&U.parentNode===y)break;if(T===4)for(T=m.return;T!==null;){var Z=T.tag;if((Z===3||Z===4)&&(Z=T.stateNode.containerInfo,Z===y||Z.nodeType===8&&Z.parentNode===y))return;T=T.return}for(;U!==null;){if(T=no(U),T===null)return;if(Z=T.tag,Z===5||Z===6){m=x=T;continue e}U=U.parentNode}}m=m.return}Tr(function(){var le=x,ye=ft(c),ve=[];e:{var ge=gs.get(r);if(ge!==void 0){var Se=da,je=r;switch(r){case"keypress":if(ei(c)===0)break e;case"keydown":case"keyup":Se=Gl;break;case"focusin":je="focus",Se=ti;break;case"focusout":je="blur",Se=ti;break;case"beforeblur":case"afterblur":Se=ti;break;case"click":if(c.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Se=Qs;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Se=pd;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Se=en;break;case Ea:case oc:case Ca:Se=yd;break;case ai:Se=Vl;break;case"scroll":Se=ds;break;case"wheel":Se=Kl;break;case"copy":case"cut":case"paste":Se=xr;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Se=Zs}var Me=(o&4)!==0,Tt=!Me&&r==="scroll",re=Me?ge!==null?ge+"Capture":null:ge;Me=[];for(var te=le,se;te!==null;){se=te;var we=se.stateNode;if(se.tag===5&&we!==null&&(se=we,re!==null&&(we=Bn(te,re),we!=null&&Me.push(Ra(te,we,se)))),Tt)break;te=te.return}0<Me.length&&(ge=new Se(ge,je,null,c,ye),ve.push({event:ge,listeners:Me}))}}if((o&7)===0){e:{if(ge=r==="mouseover"||r==="pointerover",Se=r==="mouseout"||r==="pointerout",ge&&c!==bt&&(je=c.relatedTarget||c.fromElement)&&(no(je)||je[zr]))break e;if((Se||ge)&&(ge=ye.window===ye?ye:(ge=ye.ownerDocument)?ge.defaultView||ge.parentWindow:window,Se?(je=c.relatedTarget||c.toElement,Se=le,je=je?no(je):null,je!==null&&(Tt=En(je),je!==Tt||je.tag!==5&&je.tag!==6)&&(je=null)):(Se=null,je=le),Se!==je)){if(Me=Qs,we="onMouseLeave",re="onMouseEnter",te="mouse",(r==="pointerout"||r==="pointerover")&&(Me=Zs,we="onPointerLeave",re="onPointerEnter",te="pointer"),Tt=Se==null?ge:di(Se),se=je==null?ge:di(je),ge=new Me(we,te+"leave",Se,c,ye),ge.target=Tt,ge.relatedTarget=se,we=null,no(ye)===le&&(Me=new Me(re,te+"enter",je,c,ye),Me.target=se,Me.relatedTarget=Tt,we=Me),Tt=we,Se&&je)t:{for(Me=Se,re=je,te=0,se=Me;se;se=ci(se))te++;for(se=0,we=re;we;we=ci(we))se++;for(;0<te-se;)Me=ci(Me),te--;for(;0<se-te;)re=ci(re),se--;for(;te--;){if(Me===re||re!==null&&Me===re.alternate)break t;Me=ci(Me),re=ci(re)}Me=null}else Me=null;Se!==null&&d0(ve,ge,Se,Me,!1),je!==null&&Tt!==null&&d0(ve,Tt,je,Me,!0)}}e:{if(ge=le?di(le):window,Se=ge.nodeName&&ge.nodeName.toLowerCase(),Se==="select"||Se==="input"&&ge.type==="file")var Ie=Sd;else if(Jl(ge))if(ec)Ie=oi;else{Ie=xa;var De=rc}else(Se=ge.nodeName)&&Se.toLowerCase()==="input"&&(ge.type==="checkbox"||ge.type==="radio")&&(Ie=sc);if(Ie&&(Ie=Ie(r,le))){va(ve,Ie,c,ye);break e}De&&De(r,ge,le),r==="focusout"&&(De=ge._wrapperState)&&De.controlled&&ge.type==="number"&&he(ge,"number",ge.value)}switch(De=le?di(le):window,r){case"focusin":(Jl(De)||De.contentEditable==="true")&&(_e=De,Ae=le,We=null);break;case"focusout":We=Ae=_e=null;break;case"mousedown":nt=!0;break;case"contextmenu":case"mouseup":case"dragend":nt=!1,pt(ve,c,ye);break;case"selectionchange":if(ue)break;case"keydown":case"keyup":pt(ve,c,ye)}var Fe;if(fs)e:{switch(r){case"compositionstart":var He="onCompositionStart";break e;case"compositionend":He="onCompositionEnd";break e;case"compositionupdate":He="onCompositionUpdate";break e}He=void 0}else _t?ri(r,c)&&(He="onCompositionEnd"):r==="keydown"&&c.keyCode===229&&(He="onCompositionStart");He&&(Js&&c.locale!=="ko"&&(_t||He!=="onCompositionStart"?He==="onCompositionEnd"&&_t&&(Fe=ca()):(wr=ye,Vs="value"in wr?wr.value:wr.textContent,_t=!0)),De=ac(le,He),0<De.length&&(He=new pa(He,r,null,c,ye),ve.push({event:He,listeners:De}),Fe?He.data=Fe:(Fe=si(c),Fe!==null&&(He.data=Fe)))),(Fe=Xl?Ql(r,c):Zl(r,c))&&(le=ac(le,"onBeforeInput"),0<le.length&&(ye=new pa("onBeforeInput","beforeinput",null,c,ye),ve.push({event:ye,listeners:le}),ye.data=Fe))}c0(ve,o)})}function Ra(r,o,c){return{instance:r,listener:o,currentTarget:c}}function ac(r,o){for(var c=o+"Capture",m=[];r!==null;){var y=r,x=y.stateNode;y.tag===5&&x!==null&&(y=x,x=Bn(r,c),x!=null&&m.unshift(Ra(r,x,y)),x=Bn(r,o),x!=null&&m.push(Ra(r,x,y))),r=r.return}return m}function ci(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5);return r||null}function d0(r,o,c,m,y){for(var x=o._reactName,T=[];c!==null&&c!==m;){var U=c,Z=U.alternate,le=U.stateNode;if(Z!==null&&Z===m)break;U.tag===5&&le!==null&&(U=le,y?(Z=Bn(c,x),Z!=null&&T.unshift(Ra(c,Z,U))):y||(Z=Bn(c,x),Z!=null&&T.push(Ra(c,Z,U)))),c=c.return}T.length!==0&&r.push({event:o,listeners:T})}var aA=/\r\n?/g,lA=/\u0000|\uFFFD/g;function f0(r){return(typeof r=="string"?r:""+r).replace(aA,`
|
|
38
|
+
`).replace(lA,"")}function lc(r,o,c){if(o=f0(o),f0(r)!==o&&c)throw Error(n(425))}function cc(){}var jd=null,Td=null;function Rd(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 Ad=typeof setTimeout=="function"?setTimeout:void 0,cA=typeof clearTimeout=="function"?clearTimeout:void 0,h0=typeof Promise=="function"?Promise:void 0,uA=typeof queueMicrotask=="function"?queueMicrotask:typeof h0<"u"?function(r){return h0.resolve(null).then(r).catch(dA)}:Ad;function dA(r){setTimeout(function(){throw r})}function Md(r,o){var c=o,m=0;do{var y=c.nextSibling;if(r.removeChild(c),y&&y.nodeType===8)if(c=y.data,c==="/$"){if(m===0){r.removeChild(y),us(o);return}m--}else c!=="$"&&c!=="$?"&&c!=="$!"||m++;c=y}while(c);us(o)}function vs(r){for(;r!=null;r=r.nextSibling){var o=r.nodeType;if(o===1||o===3)break;if(o===8){if(o=r.data,o==="$"||o==="$!"||o==="$?")break;if(o==="/$")return null}}return r}function p0(r){r=r.previousSibling;for(var o=0;r;){if(r.nodeType===8){var c=r.data;if(c==="$"||c==="$!"||c==="$?"){if(o===0)return r;o--}else c==="/$"&&o++}r=r.previousSibling}return null}var ui=Math.random().toString(36).slice(2),br="__reactFiber$"+ui,Aa="__reactProps$"+ui,zr="__reactContainer$"+ui,Id="__reactEvents$"+ui,fA="__reactListeners$"+ui,hA="__reactHandles$"+ui;function no(r){var o=r[br];if(o)return o;for(var c=r.parentNode;c;){if(o=c[zr]||c[br]){if(c=o.alternate,o.child!==null||c!==null&&c.child!==null)for(r=p0(r);r!==null;){if(c=r[br])return c;r=p0(r)}return o}r=c,c=r.parentNode}return null}function Ma(r){return r=r[br]||r[zr],!r||r.tag!==5&&r.tag!==6&&r.tag!==13&&r.tag!==3?null:r}function di(r){if(r.tag===5||r.tag===6)return r.stateNode;throw Error(n(33))}function uc(r){return r[Aa]||null}var Od=[],fi=-1;function ws(r){return{current:r}}function gt(r){0>fi||(r.current=Od[fi],Od[fi]=null,fi--)}function ht(r,o){fi++,Od[fi]=r.current,r.current=o}var xs={},Yt=ws(xs),sn=ws(!1),ro=xs;function hi(r,o){var c=r.type.contextTypes;if(!c)return xs;var m=r.stateNode;if(m&&m.__reactInternalMemoizedUnmaskedChildContext===o)return m.__reactInternalMemoizedMaskedChildContext;var y={},x;for(x in c)y[x]=o[x];return m&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=o,r.__reactInternalMemoizedMaskedChildContext=y),y}function on(r){return r=r.childContextTypes,r!=null}function dc(){gt(sn),gt(Yt)}function m0(r,o,c){if(Yt.current!==xs)throw Error(n(168));ht(Yt,o),ht(sn,c)}function g0(r,o,c){var m=r.stateNode;if(o=o.childContextTypes,typeof m.getChildContext!="function")return c;m=m.getChildContext();for(var y in m)if(!(y in o))throw Error(n(108,V(r)||"Unknown",y));return ee({},c,m)}function fc(r){return r=(r=r.stateNode)&&r.__reactInternalMemoizedMergedChildContext||xs,ro=Yt.current,ht(Yt,r),ht(sn,sn.current),!0}function y0(r,o,c){var m=r.stateNode;if(!m)throw Error(n(169));c?(r=g0(r,o,ro),m.__reactInternalMemoizedMergedChildContext=r,gt(sn),gt(Yt),ht(Yt,r)):gt(sn),ht(sn,c)}var Br=null,hc=!1,Pd=!1;function v0(r){Br===null?Br=[r]:Br.push(r)}function pA(r){hc=!0,v0(r)}function bs(){if(!Pd&&Br!==null){Pd=!0;var r=0,o=tt;try{var c=Br;for(tt=1;r<c.length;r++){var m=c[r];do m=m(!0);while(m!==null)}Br=null,hc=!1}catch(y){throw Br!==null&&(Br=Br.slice(r+1)),Fs(rs,bs),y}finally{tt=o,Pd=!1}}return null}var pi=[],mi=0,pc=null,mc=0,Rn=[],An=0,so=null,Ur=1,Wr="";function oo(r,o){pi[mi++]=mc,pi[mi++]=pc,pc=r,mc=o}function w0(r,o,c){Rn[An++]=Ur,Rn[An++]=Wr,Rn[An++]=so,so=r;var m=Ur;r=Wr;var y=32-pn(m)-1;m&=~(1<<y),c+=1;var x=32-pn(o)+y;if(30<x){var T=y-y%5;x=(m&(1<<T)-1).toString(32),m>>=T,y-=T,Ur=1<<32-pn(o)+y|c<<y|m,Wr=x+r}else Ur=1<<x|c<<y|m,Wr=r}function $d(r){r.return!==null&&(oo(r,1),w0(r,1,0))}function Ld(r){for(;r===pc;)pc=pi[--mi],pi[mi]=null,mc=pi[--mi],pi[mi]=null;for(;r===so;)so=Rn[--An],Rn[An]=null,Wr=Rn[--An],Rn[An]=null,Ur=Rn[--An],Rn[An]=null}var yn=null,vn=null,vt=!1,Jn=null;function x0(r,o){var c=Pn(5,null,null,0);c.elementType="DELETED",c.stateNode=o,c.return=r,o=r.deletions,o===null?(r.deletions=[c],r.flags|=16):o.push(c)}function b0(r,o){switch(r.tag){case 5:var c=r.type;return o=o.nodeType!==1||c.toLowerCase()!==o.nodeName.toLowerCase()?null:o,o!==null?(r.stateNode=o,yn=r,vn=vs(o.firstChild),!0):!1;case 6:return o=r.pendingProps===""||o.nodeType!==3?null:o,o!==null?(r.stateNode=o,yn=r,vn=null,!0):!1;case 13:return o=o.nodeType!==8?null:o,o!==null?(c=so!==null?{id:Ur,overflow:Wr}:null,r.memoizedState={dehydrated:o,treeContext:c,retryLane:1073741824},c=Pn(18,null,null,0),c.stateNode=o,c.return=r,r.child=c,yn=r,vn=null,!0):!1;default:return!1}}function qd(r){return(r.mode&1)!==0&&(r.flags&128)===0}function Dd(r){if(vt){var o=vn;if(o){var c=o;if(!b0(r,o)){if(qd(r))throw Error(n(418));o=vs(c.nextSibling);var m=yn;o&&b0(r,o)?x0(m,c):(r.flags=r.flags&-4097|2,vt=!1,yn=r)}}else{if(qd(r))throw Error(n(418));r.flags=r.flags&-4097|2,vt=!1,yn=r}}}function k0(r){for(r=r.return;r!==null&&r.tag!==5&&r.tag!==3&&r.tag!==13;)r=r.return;yn=r}function gc(r){if(r!==yn)return!1;if(!vt)return k0(r),vt=!0,!1;var o;if((o=r.tag!==3)&&!(o=r.tag!==5)&&(o=r.type,o=o!=="head"&&o!=="body"&&!Rd(r.type,r.memoizedProps)),o&&(o=vn)){if(qd(r))throw _0(),Error(n(418));for(;o;)x0(r,o),o=vs(o.nextSibling)}if(k0(r),r.tag===13){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(n(317));e:{for(r=r.nextSibling,o=0;r;){if(r.nodeType===8){var c=r.data;if(c==="/$"){if(o===0){vn=vs(r.nextSibling);break e}o--}else c!=="$"&&c!=="$!"&&c!=="$?"||o++}r=r.nextSibling}vn=null}}else vn=yn?vs(r.stateNode.nextSibling):null;return!0}function _0(){for(var r=vn;r;)r=vs(r.nextSibling)}function gi(){vn=yn=null,vt=!1}function Fd(r){Jn===null?Jn=[r]:Jn.push(r)}var mA=j.ReactCurrentBatchConfig;function Ia(r,o,c){if(r=c.ref,r!==null&&typeof r!="function"&&typeof r!="object"){if(c._owner){if(c=c._owner,c){if(c.tag!==1)throw Error(n(309));var m=c.stateNode}if(!m)throw Error(n(147,r));var y=m,x=""+r;return o!==null&&o.ref!==null&&typeof o.ref=="function"&&o.ref._stringRef===x?o.ref:(o=function(T){var U=y.refs;T===null?delete U[x]:U[x]=T},o._stringRef=x,o)}if(typeof r!="string")throw Error(n(284));if(!c._owner)throw Error(n(290,r))}return r}function yc(r,o){throw r=Object.prototype.toString.call(o),Error(n(31,r==="[object Object]"?"object with keys {"+Object.keys(o).join(", ")+"}":r))}function S0(r){var o=r._init;return o(r._payload)}function N0(r){function o(re,te){if(r){var se=re.deletions;se===null?(re.deletions=[te],re.flags|=16):se.push(te)}}function c(re,te){if(!r)return null;for(;te!==null;)o(re,te),te=te.sibling;return null}function m(re,te){for(re=new Map;te!==null;)te.key!==null?re.set(te.key,te):re.set(te.index,te),te=te.sibling;return re}function y(re,te){return re=Ts(re,te),re.index=0,re.sibling=null,re}function x(re,te,se){return re.index=se,r?(se=re.alternate,se!==null?(se=se.index,se<te?(re.flags|=2,te):se):(re.flags|=2,te)):(re.flags|=1048576,te)}function T(re){return r&&re.alternate===null&&(re.flags|=2),re}function U(re,te,se,we){return te===null||te.tag!==6?(te=Mf(se,re.mode,we),te.return=re,te):(te=y(te,se),te.return=re,te)}function Z(re,te,se,we){var Ie=se.type;return Ie===I?ye(re,te,se.props.children,we,se.key):te!==null&&(te.elementType===Ie||typeof Ie=="object"&&Ie!==null&&Ie.$$typeof===H&&S0(Ie)===te.type)?(we=y(te,se.props),we.ref=Ia(re,te,se),we.return=re,we):(we=zc(se.type,se.key,se.props,null,re.mode,we),we.ref=Ia(re,te,se),we.return=re,we)}function le(re,te,se,we){return te===null||te.tag!==4||te.stateNode.containerInfo!==se.containerInfo||te.stateNode.implementation!==se.implementation?(te=If(se,re.mode,we),te.return=re,te):(te=y(te,se.children||[]),te.return=re,te)}function ye(re,te,se,we,Ie){return te===null||te.tag!==7?(te=po(se,re.mode,we,Ie),te.return=re,te):(te=y(te,se),te.return=re,te)}function ve(re,te,se){if(typeof te=="string"&&te!==""||typeof te=="number")return te=Mf(""+te,re.mode,se),te.return=re,te;if(typeof te=="object"&&te!==null){switch(te.$$typeof){case M:return se=zc(te.type,te.key,te.props,null,re.mode,se),se.ref=Ia(re,null,te),se.return=re,se;case P:return te=If(te,re.mode,se),te.return=re,te;case H:var we=te._init;return ve(re,we(te._payload),se)}if(Pe(te)||W(te))return te=po(te,re.mode,se,null),te.return=re,te;yc(re,te)}return null}function ge(re,te,se,we){var Ie=te!==null?te.key:null;if(typeof se=="string"&&se!==""||typeof se=="number")return Ie!==null?null:U(re,te,""+se,we);if(typeof se=="object"&&se!==null){switch(se.$$typeof){case M:return se.key===Ie?Z(re,te,se,we):null;case P:return se.key===Ie?le(re,te,se,we):null;case H:return Ie=se._init,ge(re,te,Ie(se._payload),we)}if(Pe(se)||W(se))return Ie!==null?null:ye(re,te,se,we,null);yc(re,se)}return null}function Se(re,te,se,we,Ie){if(typeof we=="string"&&we!==""||typeof we=="number")return re=re.get(se)||null,U(te,re,""+we,Ie);if(typeof we=="object"&&we!==null){switch(we.$$typeof){case M:return re=re.get(we.key===null?se:we.key)||null,Z(te,re,we,Ie);case P:return re=re.get(we.key===null?se:we.key)||null,le(te,re,we,Ie);case H:var De=we._init;return Se(re,te,se,De(we._payload),Ie)}if(Pe(we)||W(we))return re=re.get(se)||null,ye(te,re,we,Ie,null);yc(te,we)}return null}function je(re,te,se,we){for(var Ie=null,De=null,Fe=te,He=te=0,zt=null;Fe!==null&&He<se.length;He++){Fe.index>He?(zt=Fe,Fe=null):zt=Fe.sibling;var ot=ge(re,Fe,se[He],we);if(ot===null){Fe===null&&(Fe=zt);break}r&&Fe&&ot.alternate===null&&o(re,Fe),te=x(ot,te,He),De===null?Ie=ot:De.sibling=ot,De=ot,Fe=zt}if(He===se.length)return c(re,Fe),vt&&oo(re,He),Ie;if(Fe===null){for(;He<se.length;He++)Fe=ve(re,se[He],we),Fe!==null&&(te=x(Fe,te,He),De===null?Ie=Fe:De.sibling=Fe,De=Fe);return vt&&oo(re,He),Ie}for(Fe=m(re,Fe);He<se.length;He++)zt=Se(Fe,re,He,se[He],we),zt!==null&&(r&&zt.alternate!==null&&Fe.delete(zt.key===null?He:zt.key),te=x(zt,te,He),De===null?Ie=zt:De.sibling=zt,De=zt);return r&&Fe.forEach(function(Rs){return o(re,Rs)}),vt&&oo(re,He),Ie}function Me(re,te,se,we){var Ie=W(se);if(typeof Ie!="function")throw Error(n(150));if(se=Ie.call(se),se==null)throw Error(n(151));for(var De=Ie=null,Fe=te,He=te=0,zt=null,ot=se.next();Fe!==null&&!ot.done;He++,ot=se.next()){Fe.index>He?(zt=Fe,Fe=null):zt=Fe.sibling;var Rs=ge(re,Fe,ot.value,we);if(Rs===null){Fe===null&&(Fe=zt);break}r&&Fe&&Rs.alternate===null&&o(re,Fe),te=x(Rs,te,He),De===null?Ie=Rs:De.sibling=Rs,De=Rs,Fe=zt}if(ot.done)return c(re,Fe),vt&&oo(re,He),Ie;if(Fe===null){for(;!ot.done;He++,ot=se.next())ot=ve(re,ot.value,we),ot!==null&&(te=x(ot,te,He),De===null?Ie=ot:De.sibling=ot,De=ot);return vt&&oo(re,He),Ie}for(Fe=m(re,Fe);!ot.done;He++,ot=se.next())ot=Se(Fe,re,He,ot.value,we),ot!==null&&(r&&ot.alternate!==null&&Fe.delete(ot.key===null?He:ot.key),te=x(ot,te,He),De===null?Ie=ot:De.sibling=ot,De=ot);return r&&Fe.forEach(function(YA){return o(re,YA)}),vt&&oo(re,He),Ie}function Tt(re,te,se,we){if(typeof se=="object"&&se!==null&&se.type===I&&se.key===null&&(se=se.props.children),typeof se=="object"&&se!==null){switch(se.$$typeof){case M:e:{for(var Ie=se.key,De=te;De!==null;){if(De.key===Ie){if(Ie=se.type,Ie===I){if(De.tag===7){c(re,De.sibling),te=y(De,se.props.children),te.return=re,re=te;break e}}else if(De.elementType===Ie||typeof Ie=="object"&&Ie!==null&&Ie.$$typeof===H&&S0(Ie)===De.type){c(re,De.sibling),te=y(De,se.props),te.ref=Ia(re,De,se),te.return=re,re=te;break e}c(re,De);break}else o(re,De);De=De.sibling}se.type===I?(te=po(se.props.children,re.mode,we,se.key),te.return=re,re=te):(we=zc(se.type,se.key,se.props,null,re.mode,we),we.ref=Ia(re,te,se),we.return=re,re=we)}return T(re);case P:e:{for(De=se.key;te!==null;){if(te.key===De)if(te.tag===4&&te.stateNode.containerInfo===se.containerInfo&&te.stateNode.implementation===se.implementation){c(re,te.sibling),te=y(te,se.children||[]),te.return=re,re=te;break e}else{c(re,te);break}else o(re,te);te=te.sibling}te=If(se,re.mode,we),te.return=re,re=te}return T(re);case H:return De=se._init,Tt(re,te,De(se._payload),we)}if(Pe(se))return je(re,te,se,we);if(W(se))return Me(re,te,se,we);yc(re,se)}return typeof se=="string"&&se!==""||typeof se=="number"?(se=""+se,te!==null&&te.tag===6?(c(re,te.sibling),te=y(te,se),te.return=re,re=te):(c(re,te),te=Mf(se,re.mode,we),te.return=re,re=te),T(re)):c(re,te)}return Tt}var yi=N0(!0),E0=N0(!1),vc=ws(null),wc=null,vi=null,zd=null;function Bd(){zd=vi=wc=null}function Ud(r){var o=vc.current;gt(vc),r._currentValue=o}function Wd(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 wi(r,o){wc=r,zd=vi=null,r=r.dependencies,r!==null&&r.firstContext!==null&&((r.lanes&o)!==0&&(an=!0),r.firstContext=null)}function Mn(r){var o=r._currentValue;if(zd!==r)if(r={context:r,memoizedValue:o,next:null},vi===null){if(wc===null)throw Error(n(308));vi=r,wc.dependencies={lanes:0,firstContext:r}}else vi=vi.next=r;return o}var io=null;function Hd(r){io===null?io=[r]:io.push(r)}function C0(r,o,c,m){var y=o.interleaved;return y===null?(c.next=c,Hd(o)):(c.next=y.next,y.next=c),o.interleaved=c,Hr(r,m)}function Hr(r,o){r.lanes|=o;var c=r.alternate;for(c!==null&&(c.lanes|=o),c=r,r=r.return;r!==null;)r.childLanes|=o,c=r.alternate,c!==null&&(c.childLanes|=o),c=r,r=r.return;return c.tag===3?c.stateNode:null}var ks=!1;function Gd(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function j0(r,o){r=r.updateQueue,o.updateQueue===r&&(o.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,effects:r.effects})}function Gr(r,o){return{eventTime:r,lane:o,tag:0,payload:null,callback:null,next:null}}function _s(r,o,c){var m=r.updateQueue;if(m===null)return null;if(m=m.shared,(st&2)!==0){var y=m.pending;return y===null?o.next=o:(o.next=y.next,y.next=o),m.pending=o,Hr(r,c)}return y=m.interleaved,y===null?(o.next=o,Hd(m)):(o.next=y.next,y.next=o),m.interleaved=o,Hr(r,c)}function xc(r,o,c){if(o=o.updateQueue,o!==null&&(o=o.shared,(c&4194240)!==0)){var m=o.lanes;m&=r.pendingLanes,c|=m,o.lanes=c,ls(r,c)}}function T0(r,o){var c=r.updateQueue,m=r.alternate;if(m!==null&&(m=m.updateQueue,c===m)){var y=null,x=null;if(c=c.firstBaseUpdate,c!==null){do{var T={eventTime:c.eventTime,lane:c.lane,tag:c.tag,payload:c.payload,callback:c.callback,next:null};x===null?y=x=T:x=x.next=T,c=c.next}while(c!==null);x===null?y=x=o:x=x.next=o}else y=x=o;c={baseState:m.baseState,firstBaseUpdate:y,lastBaseUpdate:x,shared:m.shared,effects:m.effects},r.updateQueue=c;return}r=c.lastBaseUpdate,r===null?c.firstBaseUpdate=o:r.next=o,c.lastBaseUpdate=o}function bc(r,o,c,m){var y=r.updateQueue;ks=!1;var x=y.firstBaseUpdate,T=y.lastBaseUpdate,U=y.shared.pending;if(U!==null){y.shared.pending=null;var Z=U,le=Z.next;Z.next=null,T===null?x=le:T.next=le,T=Z;var ye=r.alternate;ye!==null&&(ye=ye.updateQueue,U=ye.lastBaseUpdate,U!==T&&(U===null?ye.firstBaseUpdate=le:U.next=le,ye.lastBaseUpdate=Z))}if(x!==null){var ve=y.baseState;T=0,ye=le=Z=null,U=x;do{var ge=U.lane,Se=U.eventTime;if((m&ge)===ge){ye!==null&&(ye=ye.next={eventTime:Se,lane:0,tag:U.tag,payload:U.payload,callback:U.callback,next:null});e:{var je=r,Me=U;switch(ge=o,Se=c,Me.tag){case 1:if(je=Me.payload,typeof je=="function"){ve=je.call(Se,ve,ge);break e}ve=je;break e;case 3:je.flags=je.flags&-65537|128;case 0:if(je=Me.payload,ge=typeof je=="function"?je.call(Se,ve,ge):je,ge==null)break e;ve=ee({},ve,ge);break e;case 2:ks=!0}}U.callback!==null&&U.lane!==0&&(r.flags|=64,ge=y.effects,ge===null?y.effects=[U]:ge.push(U))}else Se={eventTime:Se,lane:ge,tag:U.tag,payload:U.payload,callback:U.callback,next:null},ye===null?(le=ye=Se,Z=ve):ye=ye.next=Se,T|=ge;if(U=U.next,U===null){if(U=y.shared.pending,U===null)break;ge=U,U=ge.next,ge.next=null,y.lastBaseUpdate=ge,y.shared.pending=null}}while(!0);if(ye===null&&(Z=ve),y.baseState=Z,y.firstBaseUpdate=le,y.lastBaseUpdate=ye,o=y.shared.interleaved,o!==null){y=o;do T|=y.lane,y=y.next;while(y!==o)}else x===null&&(y.shared.lanes=0);co|=T,r.lanes=T,r.memoizedState=ve}}function R0(r,o,c){if(r=o.effects,o.effects=null,r!==null)for(o=0;o<r.length;o++){var m=r[o],y=m.callback;if(y!==null){if(m.callback=null,m=c,typeof y!="function")throw Error(n(191,y));y.call(m)}}}var Oa={},kr=ws(Oa),Pa=ws(Oa),$a=ws(Oa);function ao(r){if(r===Oa)throw Error(n(174));return r}function Vd(r,o){switch(ht($a,o),ht(Pa,r),ht(kr,Oa),r=o.nodeType,r){case 9:case 11:o=(o=o.documentElement)?o.namespaceURI:Te(null,"");break;default:r=r===8?o.parentNode:o,o=r.namespaceURI||null,r=r.tagName,o=Te(o,r)}gt(kr),ht(kr,o)}function xi(){gt(kr),gt(Pa),gt($a)}function A0(r){ao($a.current);var o=ao(kr.current),c=Te(o,r.type);o!==c&&(ht(Pa,r),ht(kr,c))}function Yd(r){Pa.current===r&&(gt(kr),gt(Pa))}var St=ws(0);function kc(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 Kd=[];function Xd(){for(var r=0;r<Kd.length;r++)Kd[r]._workInProgressVersionPrimary=null;Kd.length=0}var _c=j.ReactCurrentDispatcher,Qd=j.ReactCurrentBatchConfig,lo=0,Nt=null,$t=null,Dt=null,Sc=!1,La=!1,qa=0,gA=0;function Kt(){throw Error(n(321))}function Zd(r,o){if(o===null)return!1;for(var c=0;c<o.length&&c<r.length;c++)if(!gn(r[c],o[c]))return!1;return!0}function Jd(r,o,c,m,y,x){if(lo=x,Nt=o,o.memoizedState=null,o.updateQueue=null,o.lanes=0,_c.current=r===null||r.memoizedState===null?xA:bA,r=c(m,y),La){x=0;do{if(La=!1,qa=0,25<=x)throw Error(n(301));x+=1,Dt=$t=null,o.updateQueue=null,_c.current=kA,r=c(m,y)}while(La)}if(_c.current=Cc,o=$t!==null&&$t.next!==null,lo=0,Dt=$t=Nt=null,Sc=!1,o)throw Error(n(300));return r}function ef(){var r=qa!==0;return qa=0,r}function _r(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Dt===null?Nt.memoizedState=Dt=r:Dt=Dt.next=r,Dt}function In(){if($t===null){var r=Nt.alternate;r=r!==null?r.memoizedState:null}else r=$t.next;var o=Dt===null?Nt.memoizedState:Dt.next;if(o!==null)Dt=o,$t=r;else{if(r===null)throw Error(n(310));$t=r,r={memoizedState:$t.memoizedState,baseState:$t.baseState,baseQueue:$t.baseQueue,queue:$t.queue,next:null},Dt===null?Nt.memoizedState=Dt=r:Dt=Dt.next=r}return Dt}function Da(r,o){return typeof o=="function"?o(r):o}function tf(r){var o=In(),c=o.queue;if(c===null)throw Error(n(311));c.lastRenderedReducer=r;var m=$t,y=m.baseQueue,x=c.pending;if(x!==null){if(y!==null){var T=y.next;y.next=x.next,x.next=T}m.baseQueue=y=x,c.pending=null}if(y!==null){x=y.next,m=m.baseState;var U=T=null,Z=null,le=x;do{var ye=le.lane;if((lo&ye)===ye)Z!==null&&(Z=Z.next={lane:0,action:le.action,hasEagerState:le.hasEagerState,eagerState:le.eagerState,next:null}),m=le.hasEagerState?le.eagerState:r(m,le.action);else{var ve={lane:ye,action:le.action,hasEagerState:le.hasEagerState,eagerState:le.eagerState,next:null};Z===null?(U=Z=ve,T=m):Z=Z.next=ve,Nt.lanes|=ye,co|=ye}le=le.next}while(le!==null&&le!==x);Z===null?T=m:Z.next=U,gn(m,o.memoizedState)||(an=!0),o.memoizedState=m,o.baseState=T,o.baseQueue=Z,c.lastRenderedState=m}if(r=c.interleaved,r!==null){y=r;do x=y.lane,Nt.lanes|=x,co|=x,y=y.next;while(y!==r)}else y===null&&(c.lanes=0);return[o.memoizedState,c.dispatch]}function nf(r){var o=In(),c=o.queue;if(c===null)throw Error(n(311));c.lastRenderedReducer=r;var m=c.dispatch,y=c.pending,x=o.memoizedState;if(y!==null){c.pending=null;var T=y=y.next;do x=r(x,T.action),T=T.next;while(T!==y);gn(x,o.memoizedState)||(an=!0),o.memoizedState=x,o.baseQueue===null&&(o.baseState=x),c.lastRenderedState=x}return[x,m]}function M0(){}function I0(r,o){var c=Nt,m=In(),y=o(),x=!gn(m.memoizedState,y);if(x&&(m.memoizedState=y,an=!0),m=m.queue,rf($0.bind(null,c,m,r),[r]),m.getSnapshot!==o||x||Dt!==null&&Dt.memoizedState.tag&1){if(c.flags|=2048,Fa(9,P0.bind(null,c,m,y,o),void 0,null),Ft===null)throw Error(n(349));(lo&30)!==0||O0(c,o,y)}return y}function O0(r,o,c){r.flags|=16384,r={getSnapshot:o,value:c},o=Nt.updateQueue,o===null?(o={lastEffect:null,stores:null},Nt.updateQueue=o,o.stores=[r]):(c=o.stores,c===null?o.stores=[r]:c.push(r))}function P0(r,o,c,m){o.value=c,o.getSnapshot=m,L0(o)&&q0(r)}function $0(r,o,c){return c(function(){L0(o)&&q0(r)})}function L0(r){var o=r.getSnapshot;r=r.value;try{var c=o();return!gn(r,c)}catch{return!0}}function q0(r){var o=Hr(r,1);o!==null&&rr(o,r,1,-1)}function D0(r){var o=_r();return typeof r=="function"&&(r=r()),o.memoizedState=o.baseState=r,r={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Da,lastRenderedState:r},o.queue=r,r=r.dispatch=wA.bind(null,Nt,r),[o.memoizedState,r]}function Fa(r,o,c,m){return r={tag:r,create:o,destroy:c,deps:m,next:null},o=Nt.updateQueue,o===null?(o={lastEffect:null,stores:null},Nt.updateQueue=o,o.lastEffect=r.next=r):(c=o.lastEffect,c===null?o.lastEffect=r.next=r:(m=c.next,c.next=r,r.next=m,o.lastEffect=r)),r}function F0(){return In().memoizedState}function Nc(r,o,c,m){var y=_r();Nt.flags|=r,y.memoizedState=Fa(1|o,c,void 0,m===void 0?null:m)}function Ec(r,o,c,m){var y=In();m=m===void 0?null:m;var x=void 0;if($t!==null){var T=$t.memoizedState;if(x=T.destroy,m!==null&&Zd(m,T.deps)){y.memoizedState=Fa(o,c,x,m);return}}Nt.flags|=r,y.memoizedState=Fa(1|o,c,x,m)}function z0(r,o){return Nc(8390656,8,r,o)}function rf(r,o){return Ec(2048,8,r,o)}function B0(r,o){return Ec(4,2,r,o)}function U0(r,o){return Ec(4,4,r,o)}function W0(r,o){if(typeof o=="function")return r=r(),o(r),function(){o(null)};if(o!=null)return r=r(),o.current=r,function(){o.current=null}}function H0(r,o,c){return c=c!=null?c.concat([r]):null,Ec(4,4,W0.bind(null,o,r),c)}function sf(){}function G0(r,o){var c=In();o=o===void 0?null:o;var m=c.memoizedState;return m!==null&&o!==null&&Zd(o,m[1])?m[0]:(c.memoizedState=[r,o],r)}function V0(r,o){var c=In();o=o===void 0?null:o;var m=c.memoizedState;return m!==null&&o!==null&&Zd(o,m[1])?m[0]:(r=r(),c.memoizedState=[r,o],r)}function Y0(r,o,c){return(lo&21)===0?(r.baseState&&(r.baseState=!1,an=!0),r.memoizedState=c):(gn(c,o)||(c=Us(),Nt.lanes|=c,co|=c,r.baseState=!0),o)}function yA(r,o){var c=tt;tt=c!==0&&4>c?c:4,r(!0);var m=Qd.transition;Qd.transition={};try{r(!1),o()}finally{tt=c,Qd.transition=m}}function K0(){return In().memoizedState}function vA(r,o,c){var m=Cs(r);if(c={lane:m,action:c,hasEagerState:!1,eagerState:null,next:null},X0(r))Q0(o,c);else if(c=C0(r,o,c,m),c!==null){var y=nn();rr(c,r,m,y),Z0(c,o,m)}}function wA(r,o,c){var m=Cs(r),y={lane:m,action:c,hasEagerState:!1,eagerState:null,next:null};if(X0(r))Q0(o,y);else{var x=r.alternate;if(r.lanes===0&&(x===null||x.lanes===0)&&(x=o.lastRenderedReducer,x!==null))try{var T=o.lastRenderedState,U=x(T,c);if(y.hasEagerState=!0,y.eagerState=U,gn(U,T)){var Z=o.interleaved;Z===null?(y.next=y,Hd(o)):(y.next=Z.next,Z.next=y),o.interleaved=y;return}}catch{}finally{}c=C0(r,o,y,m),c!==null&&(y=nn(),rr(c,r,m,y),Z0(c,o,m))}}function X0(r){var o=r.alternate;return r===Nt||o!==null&&o===Nt}function Q0(r,o){La=Sc=!0;var c=r.pending;c===null?o.next=o:(o.next=c.next,c.next=o),r.pending=o}function Z0(r,o,c){if((c&4194240)!==0){var m=o.lanes;m&=r.pendingLanes,c|=m,o.lanes=c,ls(r,c)}}var Cc={readContext:Mn,useCallback:Kt,useContext:Kt,useEffect:Kt,useImperativeHandle:Kt,useInsertionEffect:Kt,useLayoutEffect:Kt,useMemo:Kt,useReducer:Kt,useRef:Kt,useState:Kt,useDebugValue:Kt,useDeferredValue:Kt,useTransition:Kt,useMutableSource:Kt,useSyncExternalStore:Kt,useId:Kt,unstable_isNewReconciler:!1},xA={readContext:Mn,useCallback:function(r,o){return _r().memoizedState=[r,o===void 0?null:o],r},useContext:Mn,useEffect:z0,useImperativeHandle:function(r,o,c){return c=c!=null?c.concat([r]):null,Nc(4194308,4,W0.bind(null,o,r),c)},useLayoutEffect:function(r,o){return Nc(4194308,4,r,o)},useInsertionEffect:function(r,o){return Nc(4,2,r,o)},useMemo:function(r,o){var c=_r();return o=o===void 0?null:o,r=r(),c.memoizedState=[r,o],r},useReducer:function(r,o,c){var m=_r();return o=c!==void 0?c(o):o,m.memoizedState=m.baseState=o,r={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:o},m.queue=r,r=r.dispatch=vA.bind(null,Nt,r),[m.memoizedState,r]},useRef:function(r){var o=_r();return r={current:r},o.memoizedState=r},useState:D0,useDebugValue:sf,useDeferredValue:function(r){return _r().memoizedState=r},useTransition:function(){var r=D0(!1),o=r[0];return r=yA.bind(null,r[1]),_r().memoizedState=r,[o,r]},useMutableSource:function(){},useSyncExternalStore:function(r,o,c){var m=Nt,y=_r();if(vt){if(c===void 0)throw Error(n(407));c=c()}else{if(c=o(),Ft===null)throw Error(n(349));(lo&30)!==0||O0(m,o,c)}y.memoizedState=c;var x={value:c,getSnapshot:o};return y.queue=x,z0($0.bind(null,m,x,r),[r]),m.flags|=2048,Fa(9,P0.bind(null,m,x,c,o),void 0,null),c},useId:function(){var r=_r(),o=Ft.identifierPrefix;if(vt){var c=Wr,m=Ur;c=(m&~(1<<32-pn(m)-1)).toString(32)+c,o=":"+o+"R"+c,c=qa++,0<c&&(o+="H"+c.toString(32)),o+=":"}else c=gA++,o=":"+o+"r"+c.toString(32)+":";return r.memoizedState=o},unstable_isNewReconciler:!1},bA={readContext:Mn,useCallback:G0,useContext:Mn,useEffect:rf,useImperativeHandle:H0,useInsertionEffect:B0,useLayoutEffect:U0,useMemo:V0,useReducer:tf,useRef:F0,useState:function(){return tf(Da)},useDebugValue:sf,useDeferredValue:function(r){var o=In();return Y0(o,$t.memoizedState,r)},useTransition:function(){var r=tf(Da)[0],o=In().memoizedState;return[r,o]},useMutableSource:M0,useSyncExternalStore:I0,useId:K0,unstable_isNewReconciler:!1},kA={readContext:Mn,useCallback:G0,useContext:Mn,useEffect:rf,useImperativeHandle:H0,useInsertionEffect:B0,useLayoutEffect:U0,useMemo:V0,useReducer:nf,useRef:F0,useState:function(){return nf(Da)},useDebugValue:sf,useDeferredValue:function(r){var o=In();return $t===null?o.memoizedState=r:Y0(o,$t.memoizedState,r)},useTransition:function(){var r=nf(Da)[0],o=In().memoizedState;return[r,o]},useMutableSource:M0,useSyncExternalStore:I0,useId:K0,unstable_isNewReconciler:!1};function er(r,o){if(r&&r.defaultProps){o=ee({},o),r=r.defaultProps;for(var c in r)o[c]===void 0&&(o[c]=r[c]);return o}return o}function of(r,o,c,m){o=r.memoizedState,c=c(m,o),c=c==null?o:ee({},o,c),r.memoizedState=c,r.lanes===0&&(r.updateQueue.baseState=c)}var jc={isMounted:function(r){return(r=r._reactInternals)?En(r)===r:!1},enqueueSetState:function(r,o,c){r=r._reactInternals;var m=nn(),y=Cs(r),x=Gr(m,y);x.payload=o,c!=null&&(x.callback=c),o=_s(r,x,y),o!==null&&(rr(o,r,y,m),xc(o,r,y))},enqueueReplaceState:function(r,o,c){r=r._reactInternals;var m=nn(),y=Cs(r),x=Gr(m,y);x.tag=1,x.payload=o,c!=null&&(x.callback=c),o=_s(r,x,y),o!==null&&(rr(o,r,y,m),xc(o,r,y))},enqueueForceUpdate:function(r,o){r=r._reactInternals;var c=nn(),m=Cs(r),y=Gr(c,m);y.tag=2,o!=null&&(y.callback=o),o=_s(r,y,m),o!==null&&(rr(o,r,m,c),xc(o,r,m))}};function J0(r,o,c,m,y,x,T){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(m,x,T):o.prototype&&o.prototype.isPureReactComponent?!ps(c,m)||!ps(y,x):!0}function ex(r,o,c){var m=!1,y=xs,x=o.contextType;return typeof x=="object"&&x!==null?x=Mn(x):(y=on(o)?ro:Yt.current,m=o.contextTypes,x=(m=m!=null)?hi(r,y):xs),o=new o(c,x),r.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,o.updater=jc,r.stateNode=o,o._reactInternals=r,m&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=y,r.__reactInternalMemoizedMaskedChildContext=x),o}function tx(r,o,c,m){r=o.state,typeof o.componentWillReceiveProps=="function"&&o.componentWillReceiveProps(c,m),typeof o.UNSAFE_componentWillReceiveProps=="function"&&o.UNSAFE_componentWillReceiveProps(c,m),o.state!==r&&jc.enqueueReplaceState(o,o.state,null)}function af(r,o,c,m){var y=r.stateNode;y.props=c,y.state=r.memoizedState,y.refs={},Gd(r);var x=o.contextType;typeof x=="object"&&x!==null?y.context=Mn(x):(x=on(o)?ro:Yt.current,y.context=hi(r,x)),y.state=r.memoizedState,x=o.getDerivedStateFromProps,typeof x=="function"&&(of(r,o,x,c),y.state=r.memoizedState),typeof o.getDerivedStateFromProps=="function"||typeof y.getSnapshotBeforeUpdate=="function"||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(o=y.state,typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount(),o!==y.state&&jc.enqueueReplaceState(y,y.state,null),bc(r,c,y,m),y.state=r.memoizedState),typeof y.componentDidMount=="function"&&(r.flags|=4194308)}function bi(r,o){try{var c="",m=o;do c+=F(m),m=m.return;while(m);var y=c}catch(x){y=`
|
|
39
|
+
Error generating stack: `+x.message+`
|
|
40
|
+
`+x.stack}return{value:r,source:o,stack:y,digest:null}}function lf(r,o,c){return{value:r,source:null,stack:c??null,digest:o??null}}function cf(r,o){try{console.error(o.value)}catch(c){setTimeout(function(){throw c})}}var _A=typeof WeakMap=="function"?WeakMap:Map;function nx(r,o,c){c=Gr(-1,c),c.tag=3,c.payload={element:null};var m=o.value;return c.callback=function(){Pc||(Pc=!0,Sf=m),cf(r,o)},c}function rx(r,o,c){c=Gr(-1,c),c.tag=3;var m=r.type.getDerivedStateFromError;if(typeof m=="function"){var y=o.value;c.payload=function(){return m(y)},c.callback=function(){cf(r,o)}}var x=r.stateNode;return x!==null&&typeof x.componentDidCatch=="function"&&(c.callback=function(){cf(r,o),typeof m!="function"&&(Ns===null?Ns=new Set([this]):Ns.add(this));var T=o.stack;this.componentDidCatch(o.value,{componentStack:T!==null?T:""})}),c}function sx(r,o,c){var m=r.pingCache;if(m===null){m=r.pingCache=new _A;var y=new Set;m.set(o,y)}else y=m.get(o),y===void 0&&(y=new Set,m.set(o,y));y.has(c)||(y.add(c),r=LA.bind(null,r,o,c),o.then(r,r))}function ox(r){do{var o;if((o=r.tag===13)&&(o=r.memoizedState,o=o!==null?o.dehydrated!==null:!0),o)return r;r=r.return}while(r!==null);return null}function ix(r,o,c,m,y){return(r.mode&1)===0?(r===o?r.flags|=65536:(r.flags|=128,c.flags|=131072,c.flags&=-52805,c.tag===1&&(c.alternate===null?c.tag=17:(o=Gr(-1,1),o.tag=2,_s(c,o,1))),c.lanes|=1),r):(r.flags|=65536,r.lanes=y,r)}var SA=j.ReactCurrentOwner,an=!1;function tn(r,o,c,m){o.child=r===null?E0(o,null,c,m):yi(o,r.child,c,m)}function ax(r,o,c,m,y){c=c.render;var x=o.ref;return wi(o,y),m=Jd(r,o,c,m,x,y),c=ef(),r!==null&&!an?(o.updateQueue=r.updateQueue,o.flags&=-2053,r.lanes&=~y,Vr(r,o,y)):(vt&&c&&$d(o),o.flags|=1,tn(r,o,m,y),o.child)}function lx(r,o,c,m,y){if(r===null){var x=c.type;return typeof x=="function"&&!Af(x)&&x.defaultProps===void 0&&c.compare===null&&c.defaultProps===void 0?(o.tag=15,o.type=x,cx(r,o,x,m,y)):(r=zc(c.type,null,m,o,o.mode,y),r.ref=o.ref,r.return=o,o.child=r)}if(x=r.child,(r.lanes&y)===0){var T=x.memoizedProps;if(c=c.compare,c=c!==null?c:ps,c(T,m)&&r.ref===o.ref)return Vr(r,o,y)}return o.flags|=1,r=Ts(x,m),r.ref=o.ref,r.return=o,o.child=r}function cx(r,o,c,m,y){if(r!==null){var x=r.memoizedProps;if(ps(x,m)&&r.ref===o.ref)if(an=!1,o.pendingProps=m=x,(r.lanes&y)!==0)(r.flags&131072)!==0&&(an=!0);else return o.lanes=r.lanes,Vr(r,o,y)}return uf(r,o,c,m,y)}function ux(r,o,c){var m=o.pendingProps,y=m.children,x=r!==null?r.memoizedState:null;if(m.mode==="hidden")if((o.mode&1)===0)o.memoizedState={baseLanes:0,cachePool:null,transitions:null},ht(_i,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,ht(_i,wn),wn|=r,null;o.memoizedState={baseLanes:0,cachePool:null,transitions:null},m=x!==null?x.baseLanes:c,ht(_i,wn),wn|=m}else x!==null?(m=x.baseLanes|c,o.memoizedState=null):m=c,ht(_i,wn),wn|=m;return tn(r,o,y,c),o.child}function dx(r,o){var c=o.ref;(r===null&&c!==null||r!==null&&r.ref!==c)&&(o.flags|=512,o.flags|=2097152)}function uf(r,o,c,m,y){var x=on(c)?ro:Yt.current;return x=hi(o,x),wi(o,y),c=Jd(r,o,c,m,x,y),m=ef(),r!==null&&!an?(o.updateQueue=r.updateQueue,o.flags&=-2053,r.lanes&=~y,Vr(r,o,y)):(vt&&m&&$d(o),o.flags|=1,tn(r,o,c,y),o.child)}function fx(r,o,c,m,y){if(on(c)){var x=!0;fc(o)}else x=!1;if(wi(o,y),o.stateNode===null)Rc(r,o),ex(o,c,m),af(o,c,m,y),m=!0;else if(r===null){var T=o.stateNode,U=o.memoizedProps;T.props=U;var Z=T.context,le=c.contextType;typeof le=="object"&&le!==null?le=Mn(le):(le=on(c)?ro:Yt.current,le=hi(o,le));var ye=c.getDerivedStateFromProps,ve=typeof ye=="function"||typeof T.getSnapshotBeforeUpdate=="function";ve||typeof T.UNSAFE_componentWillReceiveProps!="function"&&typeof T.componentWillReceiveProps!="function"||(U!==m||Z!==le)&&tx(o,T,m,le),ks=!1;var ge=o.memoizedState;T.state=ge,bc(o,m,T,y),Z=o.memoizedState,U!==m||ge!==Z||sn.current||ks?(typeof ye=="function"&&(of(o,c,ye,m),Z=o.memoizedState),(U=ks||J0(o,c,U,m,ge,Z,le))?(ve||typeof T.UNSAFE_componentWillMount!="function"&&typeof T.componentWillMount!="function"||(typeof T.componentWillMount=="function"&&T.componentWillMount(),typeof T.UNSAFE_componentWillMount=="function"&&T.UNSAFE_componentWillMount()),typeof T.componentDidMount=="function"&&(o.flags|=4194308)):(typeof T.componentDidMount=="function"&&(o.flags|=4194308),o.memoizedProps=m,o.memoizedState=Z),T.props=m,T.state=Z,T.context=le,m=U):(typeof T.componentDidMount=="function"&&(o.flags|=4194308),m=!1)}else{T=o.stateNode,j0(r,o),U=o.memoizedProps,le=o.type===o.elementType?U:er(o.type,U),T.props=le,ve=o.pendingProps,ge=T.context,Z=c.contextType,typeof Z=="object"&&Z!==null?Z=Mn(Z):(Z=on(c)?ro:Yt.current,Z=hi(o,Z));var Se=c.getDerivedStateFromProps;(ye=typeof Se=="function"||typeof T.getSnapshotBeforeUpdate=="function")||typeof T.UNSAFE_componentWillReceiveProps!="function"&&typeof T.componentWillReceiveProps!="function"||(U!==ve||ge!==Z)&&tx(o,T,m,Z),ks=!1,ge=o.memoizedState,T.state=ge,bc(o,m,T,y);var je=o.memoizedState;U!==ve||ge!==je||sn.current||ks?(typeof Se=="function"&&(of(o,c,Se,m),je=o.memoizedState),(le=ks||J0(o,c,le,m,ge,je,Z)||!1)?(ye||typeof T.UNSAFE_componentWillUpdate!="function"&&typeof T.componentWillUpdate!="function"||(typeof T.componentWillUpdate=="function"&&T.componentWillUpdate(m,je,Z),typeof T.UNSAFE_componentWillUpdate=="function"&&T.UNSAFE_componentWillUpdate(m,je,Z)),typeof T.componentDidUpdate=="function"&&(o.flags|=4),typeof T.getSnapshotBeforeUpdate=="function"&&(o.flags|=1024)):(typeof T.componentDidUpdate!="function"||U===r.memoizedProps&&ge===r.memoizedState||(o.flags|=4),typeof T.getSnapshotBeforeUpdate!="function"||U===r.memoizedProps&&ge===r.memoizedState||(o.flags|=1024),o.memoizedProps=m,o.memoizedState=je),T.props=m,T.state=je,T.context=Z,m=le):(typeof T.componentDidUpdate!="function"||U===r.memoizedProps&&ge===r.memoizedState||(o.flags|=4),typeof T.getSnapshotBeforeUpdate!="function"||U===r.memoizedProps&&ge===r.memoizedState||(o.flags|=1024),m=!1)}return df(r,o,c,m,x,y)}function df(r,o,c,m,y,x){dx(r,o);var T=(o.flags&128)!==0;if(!m&&!T)return y&&y0(o,c,!1),Vr(r,o,x);m=o.stateNode,SA.current=o;var U=T&&typeof c.getDerivedStateFromError!="function"?null:m.render();return o.flags|=1,r!==null&&T?(o.child=yi(o,r.child,null,x),o.child=yi(o,null,U,x)):tn(r,o,U,x),o.memoizedState=m.state,y&&y0(o,c,!0),o.child}function hx(r){var o=r.stateNode;o.pendingContext?m0(r,o.pendingContext,o.pendingContext!==o.context):o.context&&m0(r,o.context,!1),Vd(r,o.containerInfo)}function px(r,o,c,m,y){return gi(),Fd(y),o.flags|=256,tn(r,o,c,m),o.child}var ff={dehydrated:null,treeContext:null,retryLane:0};function hf(r){return{baseLanes:r,cachePool:null,transitions:null}}function mx(r,o,c){var m=o.pendingProps,y=St.current,x=!1,T=(o.flags&128)!==0,U;if((U=T)||(U=r!==null&&r.memoizedState===null?!1:(y&2)!==0),U?(x=!0,o.flags&=-129):(r===null||r.memoizedState!==null)&&(y|=1),ht(St,y&1),r===null)return Dd(o),r=o.memoizedState,r!==null&&(r=r.dehydrated,r!==null)?((o.mode&1)===0?o.lanes=1:r.data==="$!"?o.lanes=8:o.lanes=1073741824,null):(T=m.children,r=m.fallback,x?(m=o.mode,x=o.child,T={mode:"hidden",children:T},(m&1)===0&&x!==null?(x.childLanes=0,x.pendingProps=T):x=Bc(T,m,0,null),r=po(r,m,c,null),x.return=o,r.return=o,x.sibling=r,o.child=x,o.child.memoizedState=hf(c),o.memoizedState=ff,r):pf(o,T));if(y=r.memoizedState,y!==null&&(U=y.dehydrated,U!==null))return NA(r,o,T,m,U,y,c);if(x){x=m.fallback,T=o.mode,y=r.child,U=y.sibling;var Z={mode:"hidden",children:m.children};return(T&1)===0&&o.child!==y?(m=o.child,m.childLanes=0,m.pendingProps=Z,o.deletions=null):(m=Ts(y,Z),m.subtreeFlags=y.subtreeFlags&14680064),U!==null?x=Ts(U,x):(x=po(x,T,c,null),x.flags|=2),x.return=o,m.return=o,m.sibling=x,o.child=m,m=x,x=o.child,T=r.child.memoizedState,T=T===null?hf(c):{baseLanes:T.baseLanes|c,cachePool:null,transitions:T.transitions},x.memoizedState=T,x.childLanes=r.childLanes&~c,o.memoizedState=ff,m}return x=r.child,r=x.sibling,m=Ts(x,{mode:"visible",children:m.children}),(o.mode&1)===0&&(m.lanes=c),m.return=o,m.sibling=null,r!==null&&(c=o.deletions,c===null?(o.deletions=[r],o.flags|=16):c.push(r)),o.child=m,o.memoizedState=null,m}function pf(r,o){return o=Bc({mode:"visible",children:o},r.mode,0,null),o.return=r,r.child=o}function Tc(r,o,c,m){return m!==null&&Fd(m),yi(o,r.child,null,c),r=pf(o,o.pendingProps.children),r.flags|=2,o.memoizedState=null,r}function NA(r,o,c,m,y,x,T){if(c)return o.flags&256?(o.flags&=-257,m=lf(Error(n(422))),Tc(r,o,T,m)):o.memoizedState!==null?(o.child=r.child,o.flags|=128,null):(x=m.fallback,y=o.mode,m=Bc({mode:"visible",children:m.children},y,0,null),x=po(x,y,T,null),x.flags|=2,m.return=o,x.return=o,m.sibling=x,o.child=m,(o.mode&1)!==0&&yi(o,r.child,null,T),o.child.memoizedState=hf(T),o.memoizedState=ff,x);if((o.mode&1)===0)return Tc(r,o,T,null);if(y.data==="$!"){if(m=y.nextSibling&&y.nextSibling.dataset,m)var U=m.dgst;return m=U,x=Error(n(419)),m=lf(x,m,void 0),Tc(r,o,T,m)}if(U=(T&r.childLanes)!==0,an||U){if(m=Ft,m!==null){switch(T&-T){case 4:y=2;break;case 16:y=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:y=32;break;case 536870912:y=268435456;break;default:y=0}y=(y&(m.suspendedLanes|T))!==0?0:y,y!==0&&y!==x.retryLane&&(x.retryLane=y,Hr(r,y),rr(m,r,y,-1))}return Rf(),m=lf(Error(n(421))),Tc(r,o,T,m)}return y.data==="$?"?(o.flags|=128,o.child=r.child,o=qA.bind(null,r),y._reactRetry=o,null):(r=x.treeContext,vn=vs(y.nextSibling),yn=o,vt=!0,Jn=null,r!==null&&(Rn[An++]=Ur,Rn[An++]=Wr,Rn[An++]=so,Ur=r.id,Wr=r.overflow,so=o),o=pf(o,m.children),o.flags|=4096,o)}function gx(r,o,c){r.lanes|=o;var m=r.alternate;m!==null&&(m.lanes|=o),Wd(r.return,o,c)}function mf(r,o,c,m,y){var x=r.memoizedState;x===null?r.memoizedState={isBackwards:o,rendering:null,renderingStartTime:0,last:m,tail:c,tailMode:y}:(x.isBackwards=o,x.rendering=null,x.renderingStartTime=0,x.last=m,x.tail=c,x.tailMode=y)}function yx(r,o,c){var m=o.pendingProps,y=m.revealOrder,x=m.tail;if(tn(r,o,m.children,c),m=St.current,(m&2)!==0)m=m&1|2,o.flags|=128;else{if(r!==null&&(r.flags&128)!==0)e:for(r=o.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&gx(r,c,o);else if(r.tag===19)gx(r,c,o);else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===o)break e;for(;r.sibling===null;){if(r.return===null||r.return===o)break e;r=r.return}r.sibling.return=r.return,r=r.sibling}m&=1}if(ht(St,m),(o.mode&1)===0)o.memoizedState=null;else switch(y){case"forwards":for(c=o.child,y=null;c!==null;)r=c.alternate,r!==null&&kc(r)===null&&(y=c),c=c.sibling;c=y,c===null?(y=o.child,o.child=null):(y=c.sibling,c.sibling=null),mf(o,!1,y,c,x);break;case"backwards":for(c=null,y=o.child,o.child=null;y!==null;){if(r=y.alternate,r!==null&&kc(r)===null){o.child=y;break}r=y.sibling,y.sibling=c,c=y,y=r}mf(o,!0,c,null,x);break;case"together":mf(o,!1,null,null,void 0);break;default:o.memoizedState=null}return o.child}function Rc(r,o){(o.mode&1)===0&&r!==null&&(r.alternate=null,o.alternate=null,o.flags|=2)}function Vr(r,o,c){if(r!==null&&(o.dependencies=r.dependencies),co|=o.lanes,(c&o.childLanes)===0)return null;if(r!==null&&o.child!==r.child)throw Error(n(153));if(o.child!==null){for(r=o.child,c=Ts(r,r.pendingProps),o.child=c,c.return=o;r.sibling!==null;)r=r.sibling,c=c.sibling=Ts(r,r.pendingProps),c.return=o;c.sibling=null}return o.child}function EA(r,o,c){switch(o.tag){case 3:hx(o),gi();break;case 5:A0(o);break;case 1:on(o.type)&&fc(o);break;case 4:Vd(o,o.stateNode.containerInfo);break;case 10:var m=o.type._context,y=o.memoizedProps.value;ht(vc,m._currentValue),m._currentValue=y;break;case 13:if(m=o.memoizedState,m!==null)return m.dehydrated!==null?(ht(St,St.current&1),o.flags|=128,null):(c&o.child.childLanes)!==0?mx(r,o,c):(ht(St,St.current&1),r=Vr(r,o,c),r!==null?r.sibling:null);ht(St,St.current&1);break;case 19:if(m=(c&o.childLanes)!==0,(r.flags&128)!==0){if(m)return yx(r,o,c);o.flags|=128}if(y=o.memoizedState,y!==null&&(y.rendering=null,y.tail=null,y.lastEffect=null),ht(St,St.current),m)break;return null;case 22:case 23:return o.lanes=0,ux(r,o,c)}return Vr(r,o,c)}var vx,gf,wx,xx;vx=function(r,o){for(var c=o.child;c!==null;){if(c.tag===5||c.tag===6)r.appendChild(c.stateNode);else if(c.tag!==4&&c.child!==null){c.child.return=c,c=c.child;continue}if(c===o)break;for(;c.sibling===null;){if(c.return===null||c.return===o)return;c=c.return}c.sibling.return=c.return,c=c.sibling}},gf=function(){},wx=function(r,o,c,m){var y=r.memoizedProps;if(y!==m){r=o.stateNode,ao(kr.current);var x=null;switch(c){case"input":y=Oe(r,y),m=Oe(r,m),x=[];break;case"select":y=ee({},y,{value:void 0}),m=ee({},m,{value:void 0}),x=[];break;case"textarea":y=Ze(r,y),m=Ze(r,m),x=[];break;default:typeof y.onClick!="function"&&typeof m.onClick=="function"&&(r.onclick=cc)}at(c,m);var T;c=null;for(le in y)if(!m.hasOwnProperty(le)&&y.hasOwnProperty(le)&&y[le]!=null)if(le==="style"){var U=y[le];for(T in U)U.hasOwnProperty(T)&&(c||(c={}),c[T]="")}else le!=="dangerouslySetInnerHTML"&&le!=="children"&&le!=="suppressContentEditableWarning"&&le!=="suppressHydrationWarning"&&le!=="autoFocus"&&(i.hasOwnProperty(le)?x||(x=[]):(x=x||[]).push(le,null));for(le in m){var Z=m[le];if(U=y!=null?y[le]:void 0,m.hasOwnProperty(le)&&Z!==U&&(Z!=null||U!=null))if(le==="style")if(U){for(T in U)!U.hasOwnProperty(T)||Z&&Z.hasOwnProperty(T)||(c||(c={}),c[T]="");for(T in Z)Z.hasOwnProperty(T)&&U[T]!==Z[T]&&(c||(c={}),c[T]=Z[T])}else c||(x||(x=[]),x.push(le,c)),c=Z;else le==="dangerouslySetInnerHTML"?(Z=Z?Z.__html:void 0,U=U?U.__html:void 0,Z!=null&&U!==Z&&(x=x||[]).push(le,Z)):le==="children"?typeof Z!="string"&&typeof Z!="number"||(x=x||[]).push(le,""+Z):le!=="suppressContentEditableWarning"&&le!=="suppressHydrationWarning"&&(i.hasOwnProperty(le)?(Z!=null&&le==="onScroll"&&mt("scroll",r),x||U===Z||(x=[])):(x=x||[]).push(le,Z))}c&&(x=x||[]).push("style",c);var le=x;(o.updateQueue=le)&&(o.flags|=4)}},xx=function(r,o,c,m){c!==m&&(o.flags|=4)};function za(r,o){if(!vt)switch(r.tailMode){case"hidden":o=r.tail;for(var c=null;o!==null;)o.alternate!==null&&(c=o),o=o.sibling;c===null?r.tail=null:c.sibling=null;break;case"collapsed":c=r.tail;for(var m=null;c!==null;)c.alternate!==null&&(m=c),c=c.sibling;m===null?o||r.tail===null?r.tail=null:r.tail.sibling=null:m.sibling=null}}function Xt(r){var o=r.alternate!==null&&r.alternate.child===r.child,c=0,m=0;if(o)for(var y=r.child;y!==null;)c|=y.lanes|y.childLanes,m|=y.subtreeFlags&14680064,m|=y.flags&14680064,y.return=r,y=y.sibling;else for(y=r.child;y!==null;)c|=y.lanes|y.childLanes,m|=y.subtreeFlags,m|=y.flags,y.return=r,y=y.sibling;return r.subtreeFlags|=m,r.childLanes=c,o}function CA(r,o,c){var m=o.pendingProps;switch(Ld(o),o.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Xt(o),null;case 1:return on(o.type)&&dc(),Xt(o),null;case 3:return m=o.stateNode,xi(),gt(sn),gt(Yt),Xd(),m.pendingContext&&(m.context=m.pendingContext,m.pendingContext=null),(r===null||r.child===null)&&(gc(o)?o.flags|=4:r===null||r.memoizedState.isDehydrated&&(o.flags&256)===0||(o.flags|=1024,Jn!==null&&(Cf(Jn),Jn=null))),gf(r,o),Xt(o),null;case 5:Yd(o);var y=ao($a.current);if(c=o.type,r!==null&&o.stateNode!=null)wx(r,o,c,m,y),r.ref!==o.ref&&(o.flags|=512,o.flags|=2097152);else{if(!m){if(o.stateNode===null)throw Error(n(166));return Xt(o),null}if(r=ao(kr.current),gc(o)){m=o.stateNode,c=o.type;var x=o.memoizedProps;switch(m[br]=o,m[Aa]=x,r=(o.mode&1)!==0,c){case"dialog":mt("cancel",m),mt("close",m);break;case"iframe":case"object":case"embed":mt("load",m);break;case"video":case"audio":for(y=0;y<ja.length;y++)mt(ja[y],m);break;case"source":mt("error",m);break;case"img":case"image":case"link":mt("error",m),mt("load",m);break;case"details":mt("toggle",m);break;case"input":Ne(m,x),mt("invalid",m);break;case"select":m._wrapperState={wasMultiple:!!x.multiple},mt("invalid",m);break;case"textarea":Ge(m,x),mt("invalid",m)}at(c,x),y=null;for(var T in x)if(x.hasOwnProperty(T)){var U=x[T];T==="children"?typeof U=="string"?m.textContent!==U&&(x.suppressHydrationWarning!==!0&&lc(m.textContent,U,r),y=["children",U]):typeof U=="number"&&m.textContent!==""+U&&(x.suppressHydrationWarning!==!0&&lc(m.textContent,U,r),y=["children",""+U]):i.hasOwnProperty(T)&&U!=null&&T==="onScroll"&&mt("scroll",m)}switch(c){case"input":ke(m),xe(m,x,!0);break;case"textarea":ke(m),qe(m);break;case"select":case"option":break;default:typeof x.onClick=="function"&&(m.onclick=cc)}m=y,o.updateQueue=m,m!==null&&(o.flags|=4)}else{T=y.nodeType===9?y:y.ownerDocument,r==="http://www.w3.org/1999/xhtml"&&(r=Ye(c)),r==="http://www.w3.org/1999/xhtml"?c==="script"?(r=T.createElement("div"),r.innerHTML="<script><\/script>",r=r.removeChild(r.firstChild)):typeof m.is=="string"?r=T.createElement(c,{is:m.is}):(r=T.createElement(c),c==="select"&&(T=r,m.multiple?T.multiple=!0:m.size&&(T.size=m.size))):r=T.createElementNS(r,c),r[br]=o,r[Aa]=m,vx(r,o,!1,!1),o.stateNode=r;e:{switch(T=Re(c,m),c){case"dialog":mt("cancel",r),mt("close",r),y=m;break;case"iframe":case"object":case"embed":mt("load",r),y=m;break;case"video":case"audio":for(y=0;y<ja.length;y++)mt(ja[y],r);y=m;break;case"source":mt("error",r),y=m;break;case"img":case"image":case"link":mt("error",r),mt("load",r),y=m;break;case"details":mt("toggle",r),y=m;break;case"input":Ne(r,m),y=Oe(r,m),mt("invalid",r);break;case"option":y=m;break;case"select":r._wrapperState={wasMultiple:!!m.multiple},y=ee({},m,{value:void 0}),mt("invalid",r);break;case"textarea":Ge(r,m),y=Ze(r,m),mt("invalid",r);break;default:y=m}at(c,y),U=y;for(x in U)if(U.hasOwnProperty(x)){var Z=U[x];x==="style"?Ke(r,Z):x==="dangerouslySetInnerHTML"?(Z=Z?Z.__html:void 0,Z!=null&&it(r,Z)):x==="children"?typeof Z=="string"?(c!=="textarea"||Z!=="")&&oe(r,Z):typeof Z=="number"&&oe(r,""+Z):x!=="suppressContentEditableWarning"&&x!=="suppressHydrationWarning"&&x!=="autoFocus"&&(i.hasOwnProperty(x)?Z!=null&&x==="onScroll"&&mt("scroll",r):Z!=null&&C(r,x,Z,T))}switch(c){case"input":ke(r),xe(r,m,!1);break;case"textarea":ke(r),qe(r);break;case"option":m.value!=null&&r.setAttribute("value",""+ae(m.value));break;case"select":r.multiple=!!m.multiple,x=m.value,x!=null?Be(r,!!m.multiple,x,!1):m.defaultValue!=null&&Be(r,!!m.multiple,m.defaultValue,!0);break;default:typeof y.onClick=="function"&&(r.onclick=cc)}switch(c){case"button":case"input":case"select":case"textarea":m=!!m.autoFocus;break e;case"img":m=!0;break e;default:m=!1}}m&&(o.flags|=4)}o.ref!==null&&(o.flags|=512,o.flags|=2097152)}return Xt(o),null;case 6:if(r&&o.stateNode!=null)xx(r,o,r.memoizedProps,m);else{if(typeof m!="string"&&o.stateNode===null)throw Error(n(166));if(c=ao($a.current),ao(kr.current),gc(o)){if(m=o.stateNode,c=o.memoizedProps,m[br]=o,(x=m.nodeValue!==c)&&(r=yn,r!==null))switch(r.tag){case 3:lc(m.nodeValue,c,(r.mode&1)!==0);break;case 5:r.memoizedProps.suppressHydrationWarning!==!0&&lc(m.nodeValue,c,(r.mode&1)!==0)}x&&(o.flags|=4)}else m=(c.nodeType===9?c:c.ownerDocument).createTextNode(m),m[br]=o,o.stateNode=m}return Xt(o),null;case 13:if(gt(St),m=o.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(vt&&vn!==null&&(o.mode&1)!==0&&(o.flags&128)===0)_0(),gi(),o.flags|=98560,x=!1;else if(x=gc(o),m!==null&&m.dehydrated!==null){if(r===null){if(!x)throw Error(n(318));if(x=o.memoizedState,x=x!==null?x.dehydrated:null,!x)throw Error(n(317));x[br]=o}else gi(),(o.flags&128)===0&&(o.memoizedState=null),o.flags|=4;Xt(o),x=!1}else Jn!==null&&(Cf(Jn),Jn=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||(St.current&1)!==0?Lt===0&&(Lt=3):Rf())),o.updateQueue!==null&&(o.flags|=4),Xt(o),null);case 4:return xi(),gf(r,o),r===null&&Ta(o.stateNode.containerInfo),Xt(o),null;case 10:return Ud(o.type._context),Xt(o),null;case 17:return on(o.type)&&dc(),Xt(o),null;case 19:if(gt(St),x=o.memoizedState,x===null)return Xt(o),null;if(m=(o.flags&128)!==0,T=x.rendering,T===null)if(m)za(x,!1);else{if(Lt!==0||r!==null&&(r.flags&128)!==0)for(r=o.child;r!==null;){if(T=kc(r),T!==null){for(o.flags|=128,za(x,!1),m=T.updateQueue,m!==null&&(o.updateQueue=m,o.flags|=4),o.subtreeFlags=0,m=c,c=o.child;c!==null;)x=c,r=m,x.flags&=14680066,T=x.alternate,T===null?(x.childLanes=0,x.lanes=r,x.child=null,x.subtreeFlags=0,x.memoizedProps=null,x.memoizedState=null,x.updateQueue=null,x.dependencies=null,x.stateNode=null):(x.childLanes=T.childLanes,x.lanes=T.lanes,x.child=T.child,x.subtreeFlags=0,x.deletions=null,x.memoizedProps=T.memoizedProps,x.memoizedState=T.memoizedState,x.updateQueue=T.updateQueue,x.type=T.type,r=T.dependencies,x.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),c=c.sibling;return ht(St,St.current&1|2),o.child}r=r.sibling}x.tail!==null&&ct()>Si&&(o.flags|=128,m=!0,za(x,!1),o.lanes=4194304)}else{if(!m)if(r=kc(T),r!==null){if(o.flags|=128,m=!0,c=r.updateQueue,c!==null&&(o.updateQueue=c,o.flags|=4),za(x,!0),x.tail===null&&x.tailMode==="hidden"&&!T.alternate&&!vt)return Xt(o),null}else 2*ct()-x.renderingStartTime>Si&&c!==1073741824&&(o.flags|=128,m=!0,za(x,!1),o.lanes=4194304);x.isBackwards?(T.sibling=o.child,o.child=T):(c=x.last,c!==null?c.sibling=T:o.child=T,x.last=T)}return x.tail!==null?(o=x.tail,x.rendering=o,x.tail=o.sibling,x.renderingStartTime=ct(),o.sibling=null,c=St.current,ht(St,m?c&1|2:c&1),o):(Xt(o),null);case 22:case 23:return Tf(),m=o.memoizedState!==null,r!==null&&r.memoizedState!==null!==m&&(o.flags|=8192),m&&(o.mode&1)!==0?(wn&1073741824)!==0&&(Xt(o),o.subtreeFlags&6&&(o.flags|=8192)):Xt(o),null;case 24:return null;case 25:return null}throw Error(n(156,o.tag))}function jA(r,o){switch(Ld(o),o.tag){case 1:return on(o.type)&&dc(),r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 3:return xi(),gt(sn),gt(Yt),Xd(),r=o.flags,(r&65536)!==0&&(r&128)===0?(o.flags=r&-65537|128,o):null;case 5:return Yd(o),null;case 13:if(gt(St),r=o.memoizedState,r!==null&&r.dehydrated!==null){if(o.alternate===null)throw Error(n(340));gi()}return r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 19:return gt(St),null;case 4:return xi(),null;case 10:return Ud(o.type._context),null;case 22:case 23:return Tf(),null;case 24:return null;default:return null}}var Ac=!1,Qt=!1,TA=typeof WeakSet=="function"?WeakSet:Set,Ee=null;function ki(r,o){var c=r.ref;if(c!==null)if(typeof c=="function")try{c(null)}catch(m){Et(r,o,m)}else c.current=null}function yf(r,o,c){try{c()}catch(m){Et(r,o,m)}}var bx=!1;function RA(r,o){if(jd=Hs,r=q(),B(r)){if("selectionStart"in r)var c={start:r.selectionStart,end:r.selectionEnd};else e:{c=(c=r.ownerDocument)&&c.defaultView||window;var m=c.getSelection&&c.getSelection();if(m&&m.rangeCount!==0){c=m.anchorNode;var y=m.anchorOffset,x=m.focusNode;m=m.focusOffset;try{c.nodeType,x.nodeType}catch{c=null;break e}var T=0,U=-1,Z=-1,le=0,ye=0,ve=r,ge=null;t:for(;;){for(var Se;ve!==c||y!==0&&ve.nodeType!==3||(U=T+y),ve!==x||m!==0&&ve.nodeType!==3||(Z=T+m),ve.nodeType===3&&(T+=ve.nodeValue.length),(Se=ve.firstChild)!==null;)ge=ve,ve=Se;for(;;){if(ve===r)break t;if(ge===c&&++le===y&&(U=T),ge===x&&++ye===m&&(Z=T),(Se=ve.nextSibling)!==null)break;ve=ge,ge=ve.parentNode}ve=Se}c=U===-1||Z===-1?null:{start:U,end:Z}}else c=null}c=c||{start:0,end:0}}else c=null;for(Td={focusedElem:r,selectionRange:c},Hs=!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 je=o.alternate;if((o.flags&1024)!==0)switch(o.tag){case 0:case 11:case 15:break;case 1:if(je!==null){var Me=je.memoizedProps,Tt=je.memoizedState,re=o.stateNode,te=re.getSnapshotBeforeUpdate(o.elementType===o.type?Me:er(o.type,Me),Tt);re.__reactInternalSnapshotBeforeUpdate=te}break;case 3:var se=o.stateNode.containerInfo;se.nodeType===1?se.textContent="":se.nodeType===9&&se.documentElement&&se.removeChild(se.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(we){Et(o,o.return,we)}if(r=o.sibling,r!==null){r.return=o.return,Ee=r;break}Ee=o.return}return je=bx,bx=!1,je}function Ba(r,o,c){var m=o.updateQueue;if(m=m!==null?m.lastEffect:null,m!==null){var y=m=m.next;do{if((y.tag&r)===r){var x=y.destroy;y.destroy=void 0,x!==void 0&&yf(o,c,x)}y=y.next}while(y!==m)}}function Mc(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 vf(r){var o=r.ref;if(o!==null){var c=r.stateNode;switch(r.tag){case 5:r=c;break;default:r=c}typeof o=="function"?o(r):o.current=r}}function kx(r){var o=r.alternate;o!==null&&(r.alternate=null,kx(o)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(o=r.stateNode,o!==null&&(delete o[br],delete o[Aa],delete o[Id],delete o[fA],delete o[hA])),r.stateNode=null,r.return=null,r.dependencies=null,r.memoizedProps=null,r.memoizedState=null,r.pendingProps=null,r.stateNode=null,r.updateQueue=null}function _x(r){return r.tag===5||r.tag===3||r.tag===4}function Sx(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||_x(r.return))return null;r=r.return}for(r.sibling.return=r.return,r=r.sibling;r.tag!==5&&r.tag!==6&&r.tag!==18;){if(r.flags&2||r.child===null||r.tag===4)continue e;r.child.return=r,r=r.child}if(!(r.flags&2))return r.stateNode}}function wf(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=cc));else if(m!==4&&(r=r.child,r!==null))for(wf(r,o,c),r=r.sibling;r!==null;)wf(r,o,c),r=r.sibling}function xf(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(xf(r,o,c),r=r.sibling;r!==null;)xf(r,o,c),r=r.sibling}var Wt=null,tr=!1;function Ss(r,o,c){for(c=c.child;c!==null;)Nx(r,o,c),c=c.sibling}function Nx(r,o,c){if(rn&&typeof rn.onCommitFiberUnmount=="function")try{rn.onCommitFiberUnmount(kt,c)}catch{}switch(c.tag){case 5:Qt||ki(c,o);case 6:var m=Wt,y=tr;Wt=null,Ss(r,o,c),Wt=m,tr=y,Wt!==null&&(tr?(r=Wt,c=c.stateNode,r.nodeType===8?r.parentNode.removeChild(c):r.removeChild(c)):Wt.removeChild(c.stateNode));break;case 18:Wt!==null&&(tr?(r=Wt,c=c.stateNode,r.nodeType===8?Md(r.parentNode,c):r.nodeType===1&&Md(r,c),us(r)):Md(Wt,c.stateNode));break;case 4:m=Wt,y=tr,Wt=c.stateNode.containerInfo,tr=!0,Ss(r,o,c),Wt=m,tr=y;break;case 0:case 11:case 14:case 15:if(!Qt&&(m=c.updateQueue,m!==null&&(m=m.lastEffect,m!==null))){y=m=m.next;do{var x=y,T=x.destroy;x=x.tag,T!==void 0&&((x&2)!==0||(x&4)!==0)&&yf(c,o,T),y=y.next}while(y!==m)}Ss(r,o,c);break;case 1:if(!Qt&&(ki(c,o),m=c.stateNode,typeof m.componentWillUnmount=="function"))try{m.props=c.memoizedProps,m.state=c.memoizedState,m.componentWillUnmount()}catch(U){Et(c,o,U)}Ss(r,o,c);break;case 21:Ss(r,o,c);break;case 22:c.mode&1?(Qt=(m=Qt)||c.memoizedState!==null,Ss(r,o,c),Qt=m):Ss(r,o,c);break;default:Ss(r,o,c)}}function Ex(r){var o=r.updateQueue;if(o!==null){r.updateQueue=null;var c=r.stateNode;c===null&&(c=r.stateNode=new TA),o.forEach(function(m){var y=DA.bind(null,r,m);c.has(m)||(c.add(m),m.then(y,y))})}}function nr(r,o){var c=o.deletions;if(c!==null)for(var m=0;m<c.length;m++){var y=c[m];try{var x=r,T=o,U=T;e:for(;U!==null;){switch(U.tag){case 5:Wt=U.stateNode,tr=!1;break e;case 3:Wt=U.stateNode.containerInfo,tr=!0;break e;case 4:Wt=U.stateNode.containerInfo,tr=!0;break e}U=U.return}if(Wt===null)throw Error(n(160));Nx(x,T,y),Wt=null,tr=!1;var Z=y.alternate;Z!==null&&(Z.return=null),y.return=null}catch(le){Et(y,o,le)}}if(o.subtreeFlags&12854)for(o=o.child;o!==null;)Cx(o,r),o=o.sibling}function Cx(r,o){var c=r.alternate,m=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:if(nr(o,r),Sr(r),m&4){try{Ba(3,r,r.return),Mc(3,r)}catch(Me){Et(r,r.return,Me)}try{Ba(5,r,r.return)}catch(Me){Et(r,r.return,Me)}}break;case 1:nr(o,r),Sr(r),m&512&&c!==null&&ki(c,c.return);break;case 5:if(nr(o,r),Sr(r),m&512&&c!==null&&ki(c,c.return),r.flags&32){var y=r.stateNode;try{oe(y,"")}catch(Me){Et(r,r.return,Me)}}if(m&4&&(y=r.stateNode,y!=null)){var x=r.memoizedProps,T=c!==null?c.memoizedProps:x,U=r.type,Z=r.updateQueue;if(r.updateQueue=null,Z!==null)try{U==="input"&&x.type==="radio"&&x.name!=null&&ce(y,x),Re(U,T);var le=Re(U,x);for(T=0;T<Z.length;T+=2){var ye=Z[T],ve=Z[T+1];ye==="style"?Ke(y,ve):ye==="dangerouslySetInnerHTML"?it(y,ve):ye==="children"?oe(y,ve):C(y,ye,ve,le)}switch(U){case"input":be(y,x);break;case"textarea":Je(y,x);break;case"select":var ge=y._wrapperState.wasMultiple;y._wrapperState.wasMultiple=!!x.multiple;var Se=x.value;Se!=null?Be(y,!!x.multiple,Se,!1):ge!==!!x.multiple&&(x.defaultValue!=null?Be(y,!!x.multiple,x.defaultValue,!0):Be(y,!!x.multiple,x.multiple?[]:"",!1))}y[Aa]=x}catch(Me){Et(r,r.return,Me)}}break;case 6:if(nr(o,r),Sr(r),m&4){if(r.stateNode===null)throw Error(n(162));y=r.stateNode,x=r.memoizedProps;try{y.nodeValue=x}catch(Me){Et(r,r.return,Me)}}break;case 3:if(nr(o,r),Sr(r),m&4&&c!==null&&c.memoizedState.isDehydrated)try{us(o.containerInfo)}catch(Me){Et(r,r.return,Me)}break;case 4:nr(o,r),Sr(r);break;case 13:nr(o,r),Sr(r),y=r.child,y.flags&8192&&(x=y.memoizedState!==null,y.stateNode.isHidden=x,!x||y.alternate!==null&&y.alternate.memoizedState!==null||(_f=ct())),m&4&&Ex(r);break;case 22:if(ye=c!==null&&c.memoizedState!==null,r.mode&1?(Qt=(le=Qt)||ye,nr(o,r),Qt=le):nr(o,r),Sr(r),m&8192){if(le=r.memoizedState!==null,(r.stateNode.isHidden=le)&&!ye&&(r.mode&1)!==0)for(Ee=r,ye=r.child;ye!==null;){for(ve=Ee=ye;Ee!==null;){switch(ge=Ee,Se=ge.child,ge.tag){case 0:case 11:case 14:case 15:Ba(4,ge,ge.return);break;case 1:ki(ge,ge.return);var je=ge.stateNode;if(typeof je.componentWillUnmount=="function"){m=ge,c=ge.return;try{o=m,je.props=o.memoizedProps,je.state=o.memoizedState,je.componentWillUnmount()}catch(Me){Et(m,c,Me)}}break;case 5:ki(ge,ge.return);break;case 22:if(ge.memoizedState!==null){Rx(ve);continue}}Se!==null?(Se.return=ge,Ee=Se):Rx(ve)}ye=ye.sibling}e:for(ye=null,ve=r;;){if(ve.tag===5){if(ye===null){ye=ve;try{y=ve.stateNode,le?(x=y.style,typeof x.setProperty=="function"?x.setProperty("display","none","important"):x.display="none"):(U=ve.stateNode,Z=ve.memoizedProps.style,T=Z!=null&&Z.hasOwnProperty("display")?Z.display:null,U.style.display=Ce("display",T))}catch(Me){Et(r,r.return,Me)}}}else if(ve.tag===6){if(ye===null)try{ve.stateNode.nodeValue=le?"":ve.memoizedProps}catch(Me){Et(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;ye===ve&&(ye=null),ve=ve.return}ye===ve&&(ye=null),ve.sibling.return=ve.return,ve=ve.sibling}}break;case 19:nr(o,r),Sr(r),m&4&&Ex(r);break;case 21:break;default:nr(o,r),Sr(r)}}function Sr(r){var o=r.flags;if(o&2){try{e:{for(var c=r.return;c!==null;){if(_x(c)){var m=c;break e}c=c.return}throw Error(n(160))}switch(m.tag){case 5:var y=m.stateNode;m.flags&32&&(oe(y,""),m.flags&=-33);var x=Sx(r);xf(r,x,y);break;case 3:case 4:var T=m.stateNode.containerInfo,U=Sx(r);wf(r,U,T);break;default:throw Error(n(161))}}catch(Z){Et(r,r.return,Z)}r.flags&=-3}o&4096&&(r.flags&=-4097)}function AA(r,o,c){Ee=r,jx(r)}function jx(r,o,c){for(var m=(r.mode&1)!==0;Ee!==null;){var y=Ee,x=y.child;if(y.tag===22&&m){var T=y.memoizedState!==null||Ac;if(!T){var U=y.alternate,Z=U!==null&&U.memoizedState!==null||Qt;U=Ac;var le=Qt;if(Ac=T,(Qt=Z)&&!le)for(Ee=y;Ee!==null;)T=Ee,Z=T.child,T.tag===22&&T.memoizedState!==null?Ax(y):Z!==null?(Z.return=T,Ee=Z):Ax(y);for(;x!==null;)Ee=x,jx(x),x=x.sibling;Ee=y,Ac=U,Qt=le}Tx(r)}else(y.subtreeFlags&8772)!==0&&x!==null?(x.return=y,Ee=x):Tx(r)}}function Tx(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:Qt||Mc(5,o);break;case 1:var m=o.stateNode;if(o.flags&4&&!Qt)if(c===null)m.componentDidMount();else{var y=o.elementType===o.type?c.memoizedProps:er(o.type,c.memoizedProps);m.componentDidUpdate(y,c.memoizedState,m.__reactInternalSnapshotBeforeUpdate)}var x=o.updateQueue;x!==null&&R0(o,x,m);break;case 3:var T=o.updateQueue;if(T!==null){if(c=null,o.child!==null)switch(o.child.tag){case 5:c=o.child.stateNode;break;case 1:c=o.child.stateNode}R0(o,T,c)}break;case 5:var U=o.stateNode;if(c===null&&o.flags&4){c=U;var Z=o.memoizedProps;switch(o.type){case"button":case"input":case"select":case"textarea":Z.autoFocus&&c.focus();break;case"img":Z.src&&(c.src=Z.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(o.memoizedState===null){var le=o.alternate;if(le!==null){var ye=le.memoizedState;if(ye!==null){var ve=ye.dehydrated;ve!==null&&us(ve)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}Qt||o.flags&512&&vf(o)}catch(ge){Et(o,o.return,ge)}}if(o===r){Ee=null;break}if(c=o.sibling,c!==null){c.return=o.return,Ee=c;break}Ee=o.return}}function Rx(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 Ax(r){for(;Ee!==null;){var o=Ee;try{switch(o.tag){case 0:case 11:case 15:var c=o.return;try{Mc(4,o)}catch(Z){Et(o,c,Z)}break;case 1:var m=o.stateNode;if(typeof m.componentDidMount=="function"){var y=o.return;try{m.componentDidMount()}catch(Z){Et(o,y,Z)}}var x=o.return;try{vf(o)}catch(Z){Et(o,x,Z)}break;case 5:var T=o.return;try{vf(o)}catch(Z){Et(o,T,Z)}}}catch(Z){Et(o,o.return,Z)}if(o===r){Ee=null;break}var U=o.sibling;if(U!==null){U.return=o.return,Ee=U;break}Ee=o.return}}var MA=Math.ceil,Ic=j.ReactCurrentDispatcher,bf=j.ReactCurrentOwner,On=j.ReactCurrentBatchConfig,st=0,Ft=null,Rt=null,Ht=0,wn=0,_i=ws(0),Lt=0,Ua=null,co=0,Oc=0,kf=0,Wa=null,ln=null,_f=0,Si=1/0,Yr=null,Pc=!1,Sf=null,Ns=null,$c=!1,Es=null,Lc=0,Ha=0,Nf=null,qc=-1,Dc=0;function nn(){return(st&6)!==0?ct():qc!==-1?qc:qc=ct()}function Cs(r){return(r.mode&1)===0?1:(st&2)!==0&&Ht!==0?Ht&-Ht:mA.transition!==null?(Dc===0&&(Dc=Us()),Dc):(r=tt,r!==0||(r=window.event,r=r===void 0?16:Jo(r.type)),r)}function rr(r,o,c,m){if(50<Ha)throw Ha=0,Nf=null,Error(n(185));as(r,c,m),((st&2)===0||r!==Ft)&&(r===Ft&&((st&2)===0&&(Oc|=c),Lt===4&&js(r,Ht)),cn(r,m),c===1&&st===0&&(o.mode&1)===0&&(Si=ct()+500,hc&&bs()))}function cn(r,o){var c=r.callbackNode;Dl(r,o);var m=Bs(r,r===Ft?Ht:0);if(m===0)c!==null&&zs(c),r.callbackNode=null,r.callbackPriority=0;else if(o=m&-m,r.callbackPriority!==o){if(c!=null&&zs(c),o===1)r.tag===0?pA(Ix.bind(null,r)):v0(Ix.bind(null,r)),uA(function(){(st&6)===0&&bs()}),c=null;else{switch(Vo(m)){case 1:c=rs;break;case 4:c=Vt;break;case 16:c=Wn;break;case 536870912:c=ss;break;default:c=Wn}c=zx(c,Mx.bind(null,r))}r.callbackPriority=o,r.callbackNode=c}}function Mx(r,o){if(qc=-1,Dc=0,(st&6)!==0)throw Error(n(327));var c=r.callbackNode;if(Ni()&&r.callbackNode!==c)return null;var m=Bs(r,r===Ft?Ht:0);if(m===0)return null;if((m&30)!==0||(m&r.expiredLanes)!==0||o)o=Fc(r,m);else{o=m;var y=st;st|=2;var x=Px();(Ft!==r||Ht!==o)&&(Yr=null,Si=ct()+500,fo(r,o));do try{PA();break}catch(U){Ox(r,U)}while(!0);Bd(),Ic.current=x,st=y,Rt!==null?o=0:(Ft=null,Ht=0,o=Lt)}if(o!==0){if(o===2&&(y=Ho(r),y!==0&&(m=y,o=Ef(r,y))),o===1)throw c=Ua,fo(r,0),js(r,m),cn(r,ct()),c;if(o===6)js(r,m);else{if(y=r.current.alternate,(m&30)===0&&!IA(y)&&(o=Fc(r,m),o===2&&(x=Ho(r),x!==0&&(m=x,o=Ef(r,x))),o===1))throw c=Ua,fo(r,0),js(r,m),cn(r,ct()),c;switch(r.finishedWork=y,r.finishedLanes=m,o){case 0:case 1:throw Error(n(345));case 2:ho(r,ln,Yr);break;case 3:if(js(r,m),(m&130023424)===m&&(o=_f+500-ct(),10<o)){if(Bs(r,0)!==0)break;if(y=r.suspendedLanes,(y&m)!==m){nn(),r.pingedLanes|=r.suspendedLanes&y;break}r.timeoutHandle=Ad(ho.bind(null,r,ln,Yr),o);break}ho(r,ln,Yr);break;case 4:if(js(r,m),(m&4194240)===m)break;for(o=r.eventTimes,y=-1;0<m;){var T=31-pn(m);x=1<<T,T=o[T],T>y&&(y=T),m&=~x}if(m=y,m=ct()-m,m=(120>m?120:480>m?480:1080>m?1080:1920>m?1920:3e3>m?3e3:4320>m?4320:1960*MA(m/1960))-m,10<m){r.timeoutHandle=Ad(ho.bind(null,r,ln,Yr),m);break}ho(r,ln,Yr);break;case 5:ho(r,ln,Yr);break;default:throw Error(n(329))}}}return cn(r,ct()),r.callbackNode===c?Mx.bind(null,r):null}function Ef(r,o){var c=Wa;return r.current.memoizedState.isDehydrated&&(fo(r,o).flags|=256),r=Fc(r,o),r!==2&&(o=ln,ln=c,o!==null&&Cf(o)),r}function Cf(r){ln===null?ln=r:ln.push.apply(ln,r)}function IA(r){for(var o=r;;){if(o.flags&16384){var c=o.updateQueue;if(c!==null&&(c=c.stores,c!==null))for(var m=0;m<c.length;m++){var y=c[m],x=y.getSnapshot;y=y.value;try{if(!gn(x(),y))return!1}catch{return!1}}}if(c=o.child,o.subtreeFlags&16384&&c!==null)c.return=o,o=c;else{if(o===r)break;for(;o.sibling===null;){if(o.return===null||o.return===r)return!0;o=o.return}o.sibling.return=o.return,o=o.sibling}}return!0}function js(r,o){for(o&=~kf,o&=~Oc,r.suspendedLanes|=o,r.pingedLanes&=~o,r=r.expirationTimes;0<o;){var c=31-pn(o),m=1<<c;r[c]=-1,o&=~m}}function Ix(r){if((st&6)!==0)throw Error(n(327));Ni();var o=Bs(r,0);if((o&1)===0)return cn(r,ct()),null;var c=Fc(r,o);if(r.tag!==0&&c===2){var m=Ho(r);m!==0&&(o=m,c=Ef(r,m))}if(c===1)throw c=Ua,fo(r,0),js(r,o),cn(r,ct()),c;if(c===6)throw Error(n(345));return r.finishedWork=r.current.alternate,r.finishedLanes=o,ho(r,ln,Yr),cn(r,ct()),null}function jf(r,o){var c=st;st|=1;try{return r(o)}finally{st=c,st===0&&(Si=ct()+500,hc&&bs())}}function uo(r){Es!==null&&Es.tag===0&&(st&6)===0&&Ni();var o=st;st|=1;var c=On.transition,m=tt;try{if(On.transition=null,tt=1,r)return r()}finally{tt=m,On.transition=c,st=o,(st&6)===0&&bs()}}function Tf(){wn=_i.current,gt(_i)}function fo(r,o){r.finishedWork=null,r.finishedLanes=0;var c=r.timeoutHandle;if(c!==-1&&(r.timeoutHandle=-1,cA(c)),Rt!==null)for(c=Rt.return;c!==null;){var m=c;switch(Ld(m),m.tag){case 1:m=m.type.childContextTypes,m!=null&&dc();break;case 3:xi(),gt(sn),gt(Yt),Xd();break;case 5:Yd(m);break;case 4:xi();break;case 13:gt(St);break;case 19:gt(St);break;case 10:Ud(m.type._context);break;case 22:case 23:Tf()}c=c.return}if(Ft=r,Rt=r=Ts(r.current,null),Ht=wn=o,Lt=0,Ua=null,kf=Oc=co=0,ln=Wa=null,io!==null){for(o=0;o<io.length;o++)if(c=io[o],m=c.interleaved,m!==null){c.interleaved=null;var y=m.next,x=c.pending;if(x!==null){var T=x.next;x.next=y,m.next=T}c.pending=m}io=null}return r}function Ox(r,o){do{var c=Rt;try{if(Bd(),_c.current=Cc,Sc){for(var m=Nt.memoizedState;m!==null;){var y=m.queue;y!==null&&(y.pending=null),m=m.next}Sc=!1}if(lo=0,Dt=$t=Nt=null,La=!1,qa=0,bf.current=null,c===null||c.return===null){Lt=1,Ua=o,Rt=null;break}e:{var x=r,T=c.return,U=c,Z=o;if(o=Ht,U.flags|=32768,Z!==null&&typeof Z=="object"&&typeof Z.then=="function"){var le=Z,ye=U,ve=ye.tag;if((ye.mode&1)===0&&(ve===0||ve===11||ve===15)){var ge=ye.alternate;ge?(ye.updateQueue=ge.updateQueue,ye.memoizedState=ge.memoizedState,ye.lanes=ge.lanes):(ye.updateQueue=null,ye.memoizedState=null)}var Se=ox(T);if(Se!==null){Se.flags&=-257,ix(Se,T,U,x,o),Se.mode&1&&sx(x,le,o),o=Se,Z=le;var je=o.updateQueue;if(je===null){var Me=new Set;Me.add(Z),o.updateQueue=Me}else je.add(Z);break e}else{if((o&1)===0){sx(x,le,o),Rf();break e}Z=Error(n(426))}}else if(vt&&U.mode&1){var Tt=ox(T);if(Tt!==null){(Tt.flags&65536)===0&&(Tt.flags|=256),ix(Tt,T,U,x,o),Fd(bi(Z,U));break e}}x=Z=bi(Z,U),Lt!==4&&(Lt=2),Wa===null?Wa=[x]:Wa.push(x),x=T;do{switch(x.tag){case 3:x.flags|=65536,o&=-o,x.lanes|=o;var re=nx(x,Z,o);T0(x,re);break e;case 1:U=Z;var te=x.type,se=x.stateNode;if((x.flags&128)===0&&(typeof te.getDerivedStateFromError=="function"||se!==null&&typeof se.componentDidCatch=="function"&&(Ns===null||!Ns.has(se)))){x.flags|=65536,o&=-o,x.lanes|=o;var we=rx(x,U,o);T0(x,we);break e}}x=x.return}while(x!==null)}Lx(c)}catch(Ie){o=Ie,Rt===c&&c!==null&&(Rt=c=c.return);continue}break}while(!0)}function Px(){var r=Ic.current;return Ic.current=Cc,r===null?Cc:r}function Rf(){(Lt===0||Lt===3||Lt===2)&&(Lt=4),Ft===null||(co&268435455)===0&&(Oc&268435455)===0||js(Ft,Ht)}function Fc(r,o){var c=st;st|=2;var m=Px();(Ft!==r||Ht!==o)&&(Yr=null,fo(r,o));do try{OA();break}catch(y){Ox(r,y)}while(!0);if(Bd(),st=c,Ic.current=m,Rt!==null)throw Error(n(261));return Ft=null,Ht=0,Lt}function OA(){for(;Rt!==null;)$x(Rt)}function PA(){for(;Rt!==null&&!Do();)$x(Rt)}function $x(r){var o=Fx(r.alternate,r,wn);r.memoizedProps=r.pendingProps,o===null?Lx(r):Rt=o,bf.current=null}function Lx(r){var o=r;do{var c=o.alternate;if(r=o.return,(o.flags&32768)===0){if(c=CA(c,o,wn),c!==null){Rt=c;return}}else{if(c=jA(c,o),c!==null){c.flags&=32767,Rt=c;return}if(r!==null)r.flags|=32768,r.subtreeFlags=0,r.deletions=null;else{Lt=6,Rt=null;return}}if(o=o.sibling,o!==null){Rt=o;return}Rt=o=r}while(o!==null);Lt===0&&(Lt=5)}function ho(r,o,c){var m=tt,y=On.transition;try{On.transition=null,tt=1,$A(r,o,c,m)}finally{On.transition=y,tt=m}return null}function $A(r,o,c,m){do Ni();while(Es!==null);if((st&6)!==0)throw Error(n(327));c=r.finishedWork;var y=r.finishedLanes;if(c===null)return null;if(r.finishedWork=null,r.finishedLanes=0,c===r.current)throw Error(n(177));r.callbackNode=null,r.callbackPriority=0;var x=c.lanes|c.childLanes;if(Zt(r,x),r===Ft&&(Rt=Ft=null,Ht=0),(c.subtreeFlags&2064)===0&&(c.flags&2064)===0||$c||($c=!0,zx(Wn,function(){return Ni(),null})),x=(c.flags&15990)!==0,(c.subtreeFlags&15990)!==0||x){x=On.transition,On.transition=null;var T=tt;tt=1;var U=st;st|=4,bf.current=null,RA(r,c),Cx(c,r),ie(Td),Hs=!!jd,Td=jd=null,r.current=c,AA(c),Fo(),st=U,tt=T,On.transition=x}else r.current=c;if($c&&($c=!1,Es=r,Lc=y),x=r.pendingLanes,x===0&&(Ns=null),Hn(c.stateNode),cn(r,ct()),o!==null)for(m=r.onRecoverableError,c=0;c<o.length;c++)y=o[c],m(y.value,{componentStack:y.stack,digest:y.digest});if(Pc)throw Pc=!1,r=Sf,Sf=null,r;return(Lc&1)!==0&&r.tag!==0&&Ni(),x=r.pendingLanes,(x&1)!==0?r===Nf?Ha++:(Ha=0,Nf=r):Ha=0,bs(),null}function Ni(){if(Es!==null){var r=Vo(Lc),o=On.transition,c=tt;try{if(On.transition=null,tt=16>r?16:r,Es===null)var m=!1;else{if(r=Es,Es=null,Lc=0,(st&6)!==0)throw Error(n(331));var y=st;for(st|=4,Ee=r.current;Ee!==null;){var x=Ee,T=x.child;if((Ee.flags&16)!==0){var U=x.deletions;if(U!==null){for(var Z=0;Z<U.length;Z++){var le=U[Z];for(Ee=le;Ee!==null;){var ye=Ee;switch(ye.tag){case 0:case 11:case 15:Ba(8,ye,x)}var ve=ye.child;if(ve!==null)ve.return=ye,Ee=ve;else for(;Ee!==null;){ye=Ee;var ge=ye.sibling,Se=ye.return;if(kx(ye),ye===le){Ee=null;break}if(ge!==null){ge.return=Se,Ee=ge;break}Ee=Se}}}var je=x.alternate;if(je!==null){var Me=je.child;if(Me!==null){je.child=null;do{var Tt=Me.sibling;Me.sibling=null,Me=Tt}while(Me!==null)}}Ee=x}}if((x.subtreeFlags&2064)!==0&&T!==null)T.return=x,Ee=T;else e:for(;Ee!==null;){if(x=Ee,(x.flags&2048)!==0)switch(x.tag){case 0:case 11:case 15:Ba(9,x,x.return)}var re=x.sibling;if(re!==null){re.return=x.return,Ee=re;break e}Ee=x.return}}var te=r.current;for(Ee=te;Ee!==null;){T=Ee;var se=T.child;if((T.subtreeFlags&2064)!==0&&se!==null)se.return=T,Ee=se;else e:for(T=te;Ee!==null;){if(U=Ee,(U.flags&2048)!==0)try{switch(U.tag){case 0:case 11:case 15:Mc(9,U)}}catch(Ie){Et(U,U.return,Ie)}if(U===T){Ee=null;break e}var we=U.sibling;if(we!==null){we.return=U.return,Ee=we;break e}Ee=U.return}}if(st=y,bs(),rn&&typeof rn.onPostCommitFiberRoot=="function")try{rn.onPostCommitFiberRoot(kt,r)}catch{}m=!0}return m}finally{tt=c,On.transition=o}}return!1}function qx(r,o,c){o=bi(c,o),o=nx(r,o,1),r=_s(r,o,1),o=nn(),r!==null&&(as(r,1,o),cn(r,o))}function Et(r,o,c){if(r.tag===3)qx(r,r,c);else for(;o!==null;){if(o.tag===3){qx(o,r,c);break}else if(o.tag===1){var m=o.stateNode;if(typeof o.type.getDerivedStateFromError=="function"||typeof m.componentDidCatch=="function"&&(Ns===null||!Ns.has(m))){r=bi(c,r),r=rx(o,r,1),o=_s(o,r,1),r=nn(),o!==null&&(as(o,1,r),cn(o,r));break}}o=o.return}}function LA(r,o,c){var m=r.pingCache;m!==null&&m.delete(o),o=nn(),r.pingedLanes|=r.suspendedLanes&c,Ft===r&&(Ht&c)===c&&(Lt===4||Lt===3&&(Ht&130023424)===Ht&&500>ct()-_f?fo(r,0):kf|=c),cn(r,o)}function Dx(r,o){o===0&&((r.mode&1)===0?o=1:(o=Wo,Wo<<=1,(Wo&130023424)===0&&(Wo=4194304)));var c=nn();r=Hr(r,o),r!==null&&(as(r,o,c),cn(r,c))}function qA(r){var o=r.memoizedState,c=0;o!==null&&(c=o.retryLane),Dx(r,c)}function DA(r,o){var c=0;switch(r.tag){case 13:var m=r.stateNode,y=r.memoizedState;y!==null&&(c=y.retryLane);break;case 19:m=r.stateNode;break;default:throw Error(n(314))}m!==null&&m.delete(o),Dx(r,c)}var Fx;Fx=function(r,o,c){if(r!==null)if(r.memoizedProps!==o.pendingProps||sn.current)an=!0;else{if((r.lanes&c)===0&&(o.flags&128)===0)return an=!1,EA(r,o,c);an=(r.flags&131072)!==0}else an=!1,vt&&(o.flags&1048576)!==0&&w0(o,mc,o.index);switch(o.lanes=0,o.tag){case 2:var m=o.type;Rc(r,o),r=o.pendingProps;var y=hi(o,Yt.current);wi(o,c),y=Jd(null,o,m,r,y,c);var x=ef();return o.flags|=1,typeof y=="object"&&y!==null&&typeof y.render=="function"&&y.$$typeof===void 0?(o.tag=1,o.memoizedState=null,o.updateQueue=null,on(m)?(x=!0,fc(o)):x=!1,o.memoizedState=y.state!==null&&y.state!==void 0?y.state:null,Gd(o),y.updater=jc,o.stateNode=y,y._reactInternals=o,af(o,m,r,c),o=df(null,o,m,!0,x,c)):(o.tag=0,vt&&x&&$d(o),tn(null,o,y,c),o=o.child),o;case 16:m=o.elementType;e:{switch(Rc(r,o),r=o.pendingProps,y=m._init,m=y(m._payload),o.type=m,y=o.tag=zA(m),r=er(m,r),y){case 0:o=uf(null,o,m,r,c);break e;case 1:o=fx(null,o,m,r,c);break e;case 11:o=ax(null,o,m,r,c);break e;case 14:o=lx(null,o,m,er(m.type,r),c);break e}throw Error(n(306,m,""))}return o;case 0:return m=o.type,y=o.pendingProps,y=o.elementType===m?y:er(m,y),uf(r,o,m,y,c);case 1:return m=o.type,y=o.pendingProps,y=o.elementType===m?y:er(m,y),fx(r,o,m,y,c);case 3:e:{if(hx(o),r===null)throw Error(n(387));m=o.pendingProps,x=o.memoizedState,y=x.element,j0(r,o),bc(o,m,null,c);var T=o.memoizedState;if(m=T.element,x.isDehydrated)if(x={element:m,isDehydrated:!1,cache:T.cache,pendingSuspenseBoundaries:T.pendingSuspenseBoundaries,transitions:T.transitions},o.updateQueue.baseState=x,o.memoizedState=x,o.flags&256){y=bi(Error(n(423)),o),o=px(r,o,m,c,y);break e}else if(m!==y){y=bi(Error(n(424)),o),o=px(r,o,m,c,y);break e}else for(vn=vs(o.stateNode.containerInfo.firstChild),yn=o,vt=!0,Jn=null,c=E0(o,null,m,c),o.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling;else{if(gi(),m===y){o=Vr(r,o,c);break e}tn(r,o,m,c)}o=o.child}return o;case 5:return A0(o),r===null&&Dd(o),m=o.type,y=o.pendingProps,x=r!==null?r.memoizedProps:null,T=y.children,Rd(m,y)?T=null:x!==null&&Rd(m,x)&&(o.flags|=32),dx(r,o),tn(r,o,T,c),o.child;case 6:return r===null&&Dd(o),null;case 13:return mx(r,o,c);case 4:return Vd(o,o.stateNode.containerInfo),m=o.pendingProps,r===null?o.child=yi(o,null,m,c):tn(r,o,m,c),o.child;case 11:return m=o.type,y=o.pendingProps,y=o.elementType===m?y:er(m,y),ax(r,o,m,y,c);case 7:return tn(r,o,o.pendingProps,c),o.child;case 8:return tn(r,o,o.pendingProps.children,c),o.child;case 12:return tn(r,o,o.pendingProps.children,c),o.child;case 10:e:{if(m=o.type._context,y=o.pendingProps,x=o.memoizedProps,T=y.value,ht(vc,m._currentValue),m._currentValue=T,x!==null)if(gn(x.value,T)){if(x.children===y.children&&!sn.current){o=Vr(r,o,c);break e}}else for(x=o.child,x!==null&&(x.return=o);x!==null;){var U=x.dependencies;if(U!==null){T=x.child;for(var Z=U.firstContext;Z!==null;){if(Z.context===m){if(x.tag===1){Z=Gr(-1,c&-c),Z.tag=2;var le=x.updateQueue;if(le!==null){le=le.shared;var ye=le.pending;ye===null?Z.next=Z:(Z.next=ye.next,ye.next=Z),le.pending=Z}}x.lanes|=c,Z=x.alternate,Z!==null&&(Z.lanes|=c),Wd(x.return,c,o),U.lanes|=c;break}Z=Z.next}}else if(x.tag===10)T=x.type===o.type?null:x.child;else if(x.tag===18){if(T=x.return,T===null)throw Error(n(341));T.lanes|=c,U=T.alternate,U!==null&&(U.lanes|=c),Wd(T,c,o),T=x.sibling}else T=x.child;if(T!==null)T.return=x;else for(T=x;T!==null;){if(T===o){T=null;break}if(x=T.sibling,x!==null){x.return=T.return,T=x;break}T=T.return}x=T}tn(r,o,y.children,c),o=o.child}return o;case 9:return y=o.type,m=o.pendingProps.children,wi(o,c),y=Mn(y),m=m(y),o.flags|=1,tn(r,o,m,c),o.child;case 14:return m=o.type,y=er(m,o.pendingProps),y=er(m.type,y),lx(r,o,m,y,c);case 15:return cx(r,o,o.type,o.pendingProps,c);case 17:return m=o.type,y=o.pendingProps,y=o.elementType===m?y:er(m,y),Rc(r,o),o.tag=1,on(m)?(r=!0,fc(o)):r=!1,wi(o,c),ex(o,m,y),af(o,m,y,c),df(null,o,m,!0,r,c);case 19:return yx(r,o,c);case 22:return ux(r,o,c)}throw Error(n(156,o.tag))};function zx(r,o){return Fs(r,o)}function FA(r,o,c,m){this.tag=r,this.key=c,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=o,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=m,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Pn(r,o,c,m){return new FA(r,o,c,m)}function Af(r){return r=r.prototype,!(!r||!r.isReactComponent)}function zA(r){if(typeof r=="function")return Af(r)?1:0;if(r!=null){if(r=r.$$typeof,r===z)return 11;if(r===Q)return 14}return 2}function Ts(r,o){var c=r.alternate;return c===null?(c=Pn(r.tag,o,r.key,r.mode),c.elementType=r.elementType,c.type=r.type,c.stateNode=r.stateNode,c.alternate=r,r.alternate=c):(c.pendingProps=o,c.type=r.type,c.flags=0,c.subtreeFlags=0,c.deletions=null),c.flags=r.flags&14680064,c.childLanes=r.childLanes,c.lanes=r.lanes,c.child=r.child,c.memoizedProps=r.memoizedProps,c.memoizedState=r.memoizedState,c.updateQueue=r.updateQueue,o=r.dependencies,c.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext},c.sibling=r.sibling,c.index=r.index,c.ref=r.ref,c}function zc(r,o,c,m,y,x){var T=2;if(m=r,typeof r=="function")Af(r)&&(T=1);else if(typeof r=="string")T=5;else e:switch(r){case I:return po(c.children,y,x,o);case D:T=8,y|=8;break;case O:return r=Pn(12,c,o,y|2),r.elementType=O,r.lanes=x,r;case K:return r=Pn(13,c,o,y),r.elementType=K,r.lanes=x,r;case R:return r=Pn(19,c,o,y),r.elementType=R,r.lanes=x,r;case ne:return Bc(c,y,x,o);default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case A:T=10;break e;case L:T=9;break e;case z:T=11;break e;case Q:T=14;break e;case H:T=16,m=null;break e}throw Error(n(130,r==null?r:typeof r,""))}return o=Pn(T,c,o,y),o.elementType=r,o.type=m,o.lanes=x,o}function po(r,o,c,m){return r=Pn(7,r,m,o),r.lanes=c,r}function Bc(r,o,c,m){return r=Pn(22,r,m,o),r.elementType=ne,r.lanes=c,r.stateNode={isHidden:!1},r}function Mf(r,o,c){return r=Pn(6,r,null,o),r.lanes=c,r}function If(r,o,c){return o=Pn(4,r.children!==null?r.children:[],r.key,o),o.lanes=c,o.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},o}function BA(r,o,c,m,y){this.tag=o,this.containerInfo=r,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Go(0),this.expirationTimes=Go(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Go(0),this.identifierPrefix=m,this.onRecoverableError=y,this.mutableSourceEagerHydrationData=null}function Of(r,o,c,m,y,x,T,U,Z){return r=new BA(r,o,c,U,Z),o===1?(o=1,x===!0&&(o|=8)):o=0,x=Pn(3,null,null,o),r.current=x,x.stateNode=r,x.memoizedState={element:m,isDehydrated:c,cache:null,transitions:null,pendingSuspenseBoundaries:null},Gd(x),r}function UA(r,o,c){var m=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:P,key:m==null?null:""+m,children:r,containerInfo:o,implementation:c}}function Bx(r){if(!r)return xs;r=r._reactInternals;e:{if(En(r)!==r||r.tag!==1)throw Error(n(170));var o=r;do{switch(o.tag){case 3:o=o.stateNode.context;break e;case 1:if(on(o.type)){o=o.stateNode.__reactInternalMemoizedMergedChildContext;break e}}o=o.return}while(o!==null);throw Error(n(171))}if(r.tag===1){var c=r.type;if(on(c))return g0(r,c,o)}return o}function Ux(r,o,c,m,y,x,T,U,Z){return r=Of(c,m,!0,r,y,x,T,U,Z),r.context=Bx(null),c=r.current,m=nn(),y=Cs(c),x=Gr(m,y),x.callback=o??null,_s(c,x,y),r.current.lanes=y,as(r,y,m),cn(r,m),r}function Uc(r,o,c,m){var y=o.current,x=nn(),T=Cs(y);return c=Bx(c),o.context===null?o.context=c:o.pendingContext=c,o=Gr(x,T),o.payload={element:r},m=m===void 0?null:m,m!==null&&(o.callback=m),r=_s(y,o,T),r!==null&&(rr(r,y,T,x),xc(r,y,T)),T}function Wc(r){if(r=r.current,!r.child)return null;switch(r.child.tag){case 5:return r.child.stateNode;default:return r.child.stateNode}}function Wx(r,o){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var c=r.retryLane;r.retryLane=c!==0&&c<o?c:o}}function Pf(r,o){Wx(r,o),(r=r.alternate)&&Wx(r,o)}function WA(){return null}var Hx=typeof reportError=="function"?reportError:function(r){console.error(r)};function $f(r){this._internalRoot=r}Hc.prototype.render=$f.prototype.render=function(r){var o=this._internalRoot;if(o===null)throw Error(n(409));Uc(r,o,null,null)},Hc.prototype.unmount=$f.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var o=r.containerInfo;uo(function(){Uc(null,r,null,null)}),o[zr]=null}};function Hc(r){this._internalRoot=r}Hc.prototype.unstable_scheduleHydration=function(r){if(r){var o=Gn();r={blockedOn:null,target:r,priority:o};for(var c=0;c<Kn.length&&o!==0&&o<Kn[c].priority;c++);Kn.splice(c,0,r),c===0&&Xo(r)}};function Lf(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function Gc(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11&&(r.nodeType!==8||r.nodeValue!==" react-mount-point-unstable "))}function Gx(){}function HA(r,o,c,m,y){if(y){if(typeof m=="function"){var x=m;m=function(){var le=Wc(T);x.call(le)}}var T=Ux(o,m,r,0,null,!1,!1,"",Gx);return r._reactRootContainer=T,r[zr]=T.current,Ta(r.nodeType===8?r.parentNode:r),uo(),T}for(;y=r.lastChild;)r.removeChild(y);if(typeof m=="function"){var U=m;m=function(){var le=Wc(Z);U.call(le)}}var Z=Of(r,0,!1,null,null,!1,!1,"",Gx);return r._reactRootContainer=Z,r[zr]=Z.current,Ta(r.nodeType===8?r.parentNode:r),uo(function(){Uc(o,Z,c,m)}),Z}function Vc(r,o,c,m,y){var x=c._reactRootContainer;if(x){var T=x;if(typeof y=="function"){var U=y;y=function(){var Z=Wc(T);U.call(Z)}}Uc(o,T,r,y)}else T=HA(c,o,r,y,m);return Wc(T)}Fl=function(r){switch(r.tag){case 3:var o=r.stateNode;if(o.current.memoizedState.isDehydrated){var c=os(o.pendingLanes);c!==0&&(ls(o,c|1),cn(o,ct()),(st&6)===0&&(Si=ct()+500,bs()))}break;case 13:uo(function(){var m=Hr(r,1);if(m!==null){var y=nn();rr(m,r,1,y)}}),Pf(r,1)}},Or=function(r){if(r.tag===13){var o=Hr(r,134217728);if(o!==null){var c=nn();rr(o,r,134217728,c)}Pf(r,134217728)}},oa=function(r){if(r.tag===13){var o=Cs(r),c=Hr(r,o);if(c!==null){var m=nn();rr(c,r,o,m)}Pf(r,o)}},Gn=function(){return tt},zl=function(r,o){var c=tt;try{return tt=r,o()}finally{tt=c}},yt=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 y=uc(m);if(!y)throw Error(n(90));Ve(m),be(m,y)}}}break;case"textarea":Je(r,c);break;case"select":o=c.value,o!=null&&Be(r,!!c.multiple,o,!1)}},Ro=jf,Ao=uo;var GA={usingClientEntryPoint:!1,Events:[Ma,di,uc,To,hn,jf]},Ga={findFiberByHostInstance:no,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},VA={bundleType:Ga.bundleType,version:Ga.version,rendererPackageName:Ga.rendererPackageName,rendererConfig:Ga.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:j.ReactCurrentDispatcher,findHostInstanceByFiber:function(r){return r=Un(r),r===null?null:r.stateNode},findFiberByHostInstance:Ga.findFiberByHostInstance||WA,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 Yc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Yc.isDisabled&&Yc.supportsFiber)try{kt=Yc.inject(VA),rn=Yc}catch{}}return un.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=GA,un.createPortal=function(r,o){var c=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Lf(o))throw Error(n(200));return UA(r,o,null,c)},un.createRoot=function(r,o){if(!Lf(r))throw Error(n(299));var c=!1,m="",y=Hx;return o!=null&&(o.unstable_strictMode===!0&&(c=!0),o.identifierPrefix!==void 0&&(m=o.identifierPrefix),o.onRecoverableError!==void 0&&(y=o.onRecoverableError)),o=Of(r,1,!1,null,null,c,!1,m,y),r[zr]=o.current,Ta(r.nodeType===8?r.parentNode:r),new $f(o)},un.findDOMNode=function(r){if(r==null)return null;if(r.nodeType===1)return r;var o=r._reactInternals;if(o===void 0)throw typeof r.render=="function"?Error(n(188)):(r=Object.keys(r).join(","),Error(n(268,r)));return r=Un(o),r=r===null?null:r.stateNode,r},un.flushSync=function(r){return uo(r)},un.hydrate=function(r,o,c){if(!Gc(o))throw Error(n(200));return Vc(null,r,o,!0,c)},un.hydrateRoot=function(r,o,c){if(!Lf(r))throw Error(n(405));var m=c!=null&&c.hydratedSources||null,y=!1,x="",T=Hx;if(c!=null&&(c.unstable_strictMode===!0&&(y=!0),c.identifierPrefix!==void 0&&(x=c.identifierPrefix),c.onRecoverableError!==void 0&&(T=c.onRecoverableError)),o=Ux(o,null,r,1,c??null,y,!1,x,T),r[zr]=o.current,Ta(r),m)for(r=0;r<m.length;r++)c=m[r],y=c._getVersion,y=y(c._source),o.mutableSourceEagerHydrationData==null?o.mutableSourceEagerHydrationData=[c,y]:o.mutableSourceEagerHydrationData.push(c,y);return new Hc(o)},un.render=function(r,o,c){if(!Gc(o))throw Error(n(200));return Vc(null,r,o,!1,c)},un.unmountComponentAtNode=function(r){if(!Gc(r))throw Error(n(40));return r._reactRootContainer?(uo(function(){Vc(null,null,r,!1,function(){r._reactRootContainer=null,r[zr]=null})}),!0):!1},un.unstable_batchedUpdates=jf,un.unstable_renderSubtreeIntoContainer=function(r,o,c,m){if(!Gc(c))throw Error(n(200));if(r==null||r._reactInternals===void 0)throw Error(n(38));return Vc(r,o,c,!1,m)},un.version="18.3.1-next-f1338f8080-20240426",un}var eb;function MC(){if(eb)return Ff.exports;eb=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Ff.exports=e2(),Ff.exports}var tb;function t2(){if(tb)return Xc;tb=1;var e=MC();return Xc.createRoot=e.createRoot,Xc.hydrateRoot=e.hydrateRoot,Xc}var n2=t2(),_=_l();const fe=cw(_);function Gt(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,s;n<e.length;n++)(s=Gt(e[n]))!==""&&(t+=(t&&" ")+s);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var Uf={exports:{}},Wf={},Hf={exports:{}},Gf={};/**
|
|
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 nb;function r2(){if(nb)return Gf;nb=1;var e=_l();function t(g,v){return g===v&&(g!==0||1/g===1/v)||g!==g&&v!==v}var n=typeof Object.is=="function"?Object.is:t,s=e.useState,i=e.useEffect,a=e.useLayoutEffect,l=e.useDebugValue;function u(g,v){var w=v(),E=s({inst:{value:w,getSnapshot:v}}),b=E[0].inst,k=E[1];return a(function(){b.value=w,b.getSnapshot=v,h(b)&&k({inst:b})},[g,w,v]),i(function(){return h(b)&&k({inst:b}),g(function(){h(b)&&k({inst:b})})},[g]),l(w),w}function h(g){var v=g.getSnapshot;g=g.value;try{var w=v();return!n(g,w)}catch{return!0}}function p(g,v){return v()}var f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?p:u;return Gf.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:f,Gf}var rb;function s2(){return rb||(rb=1,Hf.exports=r2()),Hf.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 sb;function o2(){if(sb)return Wf;sb=1;var e=_l(),t=s2();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 Wf.useSyncExternalStoreWithSelector=function(p,f,g,v,w){var E=a(null);if(E.current===null){var b={hasValue:!1,value:null};E.current=b}else b=E.current;E=u(function(){function S(P){if(!N){if(N=!0,C=P,P=v(P),w!==void 0&&b.hasValue){var I=b.value;if(w(I,P))return j=I}return j=P}if(I=j,s(C,P))return I;var D=v(P);return w!==void 0&&w(I,D)?(C=P,I):(C=P,j=D)}var N=!1,C,j,M=g===void 0?null:g;return[function(){return S(f())},M===null?void 0:function(){return S(M())}]},[f,g,v,w]);var k=i(p,E[0],E[1]);return l(function(){b.hasValue=!0,b.value=k},[k]),h(k),k},Wf}var ob;function i2(){return ob||(ob=1,Uf.exports=o2()),Uf.exports}var a2=i2();const l2=cw(a2),c2={},ib=e=>{let t;const n=new Set,s=(f,g)=>{const v=typeof f=="function"?f(t):f;if(!Object.is(v,t)){const w=t;t=g??(typeof v!="object"||v===null)?v:Object.assign({},t,v),n.forEach(E=>E(t,w))}},i=()=>t,h={setState:s,getState:i,getInitialState:()=>p,subscribe:f=>(n.add(f),()=>n.delete(f)),destroy:()=>{(c2?"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},u2=e=>e?ib(e):ib,{useDebugValue:d2}=fe,{useSyncExternalStoreWithSelector:f2}=l2,h2=e=>e;function IC(e,t=h2,n){const s=f2(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return d2(s),s}const ab=(e,t)=>{const n=u2(e),s=(i,a=t)=>IC(n,i,a);return Object.assign(s,n),s},p2=(e,t)=>e?ab(e,t):ab;function qt(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[s,i]of e)if(!Object.is(i,t.get(s)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const s of e)if(!t.has(s))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const s of n)if(!Object.prototype.hasOwnProperty.call(t,s)||!Object.is(e[s],t[s]))return!1;return!0}var m2={value:()=>{}};function qu(){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 gu(n)}function gu(e){this._=e}function g2(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}})}gu.prototype=qu.prototype={constructor:gu,on:function(e,t){var n=this._,s=g2(e+"",n),i,a=-1,l=s.length;if(arguments.length<2){for(;++a<l;)if((i=(e=s[a]).type)&&(i=y2(n[i],e.name)))return i;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++a<l;)if(i=(e=s[a]).type)n[i]=lb(n[i],e.name,t);else if(t==null)for(i in n)n[i]=lb(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new gu(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 y2(e,t){for(var n=0,s=e.length,i;n<s;++n)if((i=e[n]).name===t)return i.value}function lb(e,t,n){for(var s=0,i=e.length;s<i;++s)if(e[s].name===t){e[s]=m2,e=e.slice(0,s).concat(e.slice(s+1));break}return n!=null&&e.push({name:t,value:n}),e}var Tv="http://www.w3.org/1999/xhtml";const cb={svg:"http://www.w3.org/2000/svg",xhtml:Tv,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Du(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),cb.hasOwnProperty(t)?{space:cb[t],local:e}:e}function v2(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Tv&&t.documentElement.namespaceURI===Tv?t.createElement(e):t.createElementNS(n,e)}}function w2(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function OC(e){var t=Du(e);return(t.local?w2:v2)(t)}function x2(){}function uw(e){return e==null?x2:function(){return this.querySelector(e)}}function b2(e){typeof e!="function"&&(e=uw(e));for(var t=this._groups,n=t.length,s=new Array(n),i=0;i<n;++i)for(var a=t[i],l=a.length,u=s[i]=new Array(l),h,p,f=0;f<l;++f)(h=a[f])&&(p=e.call(h,h.__data__,f,a))&&("__data__"in h&&(p.__data__=h.__data__),u[f]=p);return new kn(s,this._parents)}function k2(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function _2(){return[]}function PC(e){return e==null?_2:function(){return this.querySelectorAll(e)}}function S2(e){return function(){return k2(e.apply(this,arguments))}}function N2(e){typeof e=="function"?e=S2(e):e=PC(e);for(var t=this._groups,n=t.length,s=[],i=[],a=0;a<n;++a)for(var l=t[a],u=l.length,h,p=0;p<u;++p)(h=l[p])&&(s.push(e.call(h,h.__data__,p,l)),i.push(h));return new kn(s,i)}function $C(e){return function(){return this.matches(e)}}function LC(e){return function(t){return t.matches(e)}}var E2=Array.prototype.find;function C2(e){return function(){return E2.call(this.children,e)}}function j2(){return this.firstElementChild}function T2(e){return this.select(e==null?j2:C2(typeof e=="function"?e:LC(e)))}var R2=Array.prototype.filter;function A2(){return Array.from(this.children)}function M2(e){return function(){return R2.call(this.children,e)}}function I2(e){return this.selectAll(e==null?A2:M2(typeof e=="function"?e:LC(e)))}function O2(e){typeof e!="function"&&(e=$C(e));for(var t=this._groups,n=t.length,s=new Array(n),i=0;i<n;++i)for(var a=t[i],l=a.length,u=s[i]=[],h,p=0;p<l;++p)(h=a[p])&&e.call(h,h.__data__,p,a)&&u.push(h);return new kn(s,this._parents)}function qC(e){return new Array(e.length)}function P2(){return new kn(this._enter||this._groups.map(qC),this._parents)}function ku(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}ku.prototype={constructor:ku,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 $2(e){return function(){return e}}function L2(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 ku(e,a[l]);for(;l<h;++l)(u=t[l])&&(i[l]=u)}function q2(e,t,n,s,i,a,l){var u,h,p=new Map,f=t.length,g=a.length,v=new Array(f),w;for(u=0;u<f;++u)(h=t[u])&&(v[u]=w=l.call(h,h.__data__,u,t)+"",p.has(w)?i[u]=h:p.set(w,h));for(u=0;u<g;++u)w=l.call(e,a[u],u,a)+"",(h=p.get(w))?(s[u]=h,h.__data__=a[u],p.delete(w)):n[u]=new ku(e,a[u]);for(u=0;u<f;++u)(h=t[u])&&p.get(v[u])===h&&(i[u]=h)}function D2(e){return e.__data__}function F2(e,t){if(!arguments.length)return Array.from(this,D2);var n=t?q2:L2,s=this._parents,i=this._groups;typeof e!="function"&&(e=$2(e));for(var a=i.length,l=new Array(a),u=new Array(a),h=new Array(a),p=0;p<a;++p){var f=s[p],g=i[p],v=g.length,w=z2(e.call(f,f&&f.__data__,p,s)),E=w.length,b=u[p]=new Array(E),k=l[p]=new Array(E),S=h[p]=new Array(v);n(f,g,b,k,S,w,t);for(var N=0,C=0,j,M;N<E;++N)if(j=b[N]){for(N>=C&&(C=N+1);!(M=k[C])&&++C<E;);j._next=M||null}}return l=new kn(l,s),l._enter=u,l._exit=h,l}function z2(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function B2(){return new kn(this._exit||this._groups.map(qC),this._parents)}function U2(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 W2(e){for(var t=e.selection?e.selection():e,n=this._groups,s=t._groups,i=n.length,a=s.length,l=Math.min(i,a),u=new Array(i),h=0;h<l;++h)for(var p=n[h],f=s[h],g=p.length,v=u[h]=new Array(g),w,E=0;E<g;++E)(w=p[E]||f[E])&&(v[E]=w);for(;h<i;++h)u[h]=n[h];return new kn(u,this._parents)}function H2(){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 G2(e){e||(e=V2);function t(g,v){return g&&v?e(g.__data__,v.__data__):!g-!v}for(var n=this._groups,s=n.length,i=new Array(s),a=0;a<s;++a){for(var l=n[a],u=l.length,h=i[a]=new Array(u),p,f=0;f<u;++f)(p=l[f])&&(h[f]=p);h.sort(t)}return new kn(i,this._parents).order()}function V2(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Y2(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function K2(){return Array.from(this)}function X2(){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 Q2(){let e=0;for(const t of this)++e;return e}function Z2(){return!this.node()}function J2(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 eM(e){return function(){this.removeAttribute(e)}}function tM(e){return function(){this.removeAttributeNS(e.space,e.local)}}function nM(e,t){return function(){this.setAttribute(e,t)}}function rM(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function sM(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function oM(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 iM(e,t){var n=Du(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?tM:eM:typeof t=="function"?n.local?oM:sM:n.local?rM:nM)(n,t))}function DC(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function aM(e){return function(){this.style.removeProperty(e)}}function lM(e,t,n){return function(){this.style.setProperty(e,t,n)}}function cM(e,t,n){return function(){var s=t.apply(this,arguments);s==null?this.style.removeProperty(e):this.style.setProperty(e,s,n)}}function uM(e,t,n){return arguments.length>1?this.each((t==null?aM:typeof t=="function"?cM:lM)(e,t,n??"")):Ui(this.node(),e)}function Ui(e,t){return e.style.getPropertyValue(t)||DC(e).getComputedStyle(e,null).getPropertyValue(t)}function dM(e){return function(){delete this[e]}}function fM(e,t){return function(){this[e]=t}}function hM(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function pM(e,t){return arguments.length>1?this.each((t==null?dM:typeof t=="function"?hM:fM)(e,t)):this.node()[e]}function FC(e){return e.trim().split(/^|\s+/)}function dw(e){return e.classList||new zC(e)}function zC(e){this._node=e,this._names=FC(e.getAttribute("class")||"")}zC.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function BC(e,t){for(var n=dw(e),s=-1,i=t.length;++s<i;)n.add(t[s])}function UC(e,t){for(var n=dw(e),s=-1,i=t.length;++s<i;)n.remove(t[s])}function mM(e){return function(){BC(this,e)}}function gM(e){return function(){UC(this,e)}}function yM(e,t){return function(){(t.apply(this,arguments)?BC:UC)(this,e)}}function vM(e,t){var n=FC(e+"");if(arguments.length<2){for(var s=dw(this.node()),i=-1,a=n.length;++i<a;)if(!s.contains(n[i]))return!1;return!0}return this.each((typeof t=="function"?yM:t?mM:gM)(n,t))}function wM(){this.textContent=""}function xM(e){return function(){this.textContent=e}}function bM(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function kM(e){return arguments.length?this.each(e==null?wM:(typeof e=="function"?bM:xM)(e)):this.node().textContent}function _M(){this.innerHTML=""}function SM(e){return function(){this.innerHTML=e}}function NM(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function EM(e){return arguments.length?this.each(e==null?_M:(typeof e=="function"?NM:SM)(e)):this.node().innerHTML}function CM(){this.nextSibling&&this.parentNode.appendChild(this)}function jM(){return this.each(CM)}function TM(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function RM(){return this.each(TM)}function AM(e){var t=typeof e=="function"?e:OC(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function MM(){return null}function IM(e,t){var n=typeof e=="function"?e:OC(e),s=t==null?MM:typeof t=="function"?t:uw(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),s.apply(this,arguments)||null)})}function OM(){var e=this.parentNode;e&&e.removeChild(this)}function PM(){return this.each(OM)}function $M(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function LM(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function qM(e){return this.select(e?LM:$M)}function DM(e){return arguments.length?this.property("__data__",e):this.node().__data__}function FM(e){return function(t){e.call(this,t,this.__data__)}}function zM(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 BM(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 UM(e,t,n){return function(){var s=this.__on,i,a=FM(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 WM(e,t,n){var s=zM(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?UM:BM,i=0;i<a;++i)this.each(u(s[i],t,n));return this}function WC(e,t,n){var s=DC(e),i=s.CustomEvent;typeof i=="function"?i=new i(t,n):(i=s.document.createEvent("Event"),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function HM(e,t){return function(){return WC(this,e,t)}}function GM(e,t){return function(){return WC(this,e,t.apply(this,arguments))}}function VM(e,t){return this.each((typeof t=="function"?GM:HM)(e,t))}function*YM(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var s=e[t],i=0,a=s.length,l;i<a;++i)(l=s[i])&&(yield l)}var HC=[null];function kn(e,t){this._groups=e,this._parents=t}function Sl(){return new kn([[document.documentElement]],HC)}function KM(){return this}kn.prototype=Sl.prototype={constructor:kn,select:b2,selectAll:N2,selectChild:T2,selectChildren:I2,filter:O2,data:F2,enter:P2,exit:B2,join:U2,merge:W2,selection:KM,order:H2,sort:G2,call:Y2,nodes:K2,node:X2,size:Q2,empty:Z2,each:J2,attr:iM,style:uM,property:pM,classed:vM,text:kM,html:EM,raise:jM,lower:RM,append:AM,insert:IM,remove:PM,clone:qM,datum:DM,on:WM,dispatch:VM,[Symbol.iterator]:YM};function Ln(e){return typeof e=="string"?new kn([[document.querySelector(e)]],[document.documentElement]):new kn([[e]],HC)}function XM(e){let t;for(;t=e.sourceEvent;)e=t;return e}function or(e,t){if(e=XM(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 QM={passive:!1},ul={capture:!0,passive:!1};function Vf(e){e.stopImmediatePropagation()}function Li(e){e.preventDefault(),e.stopImmediatePropagation()}function GC(e){var t=e.document.documentElement,n=Ln(e).on("dragstart.drag",Li,ul);"onselectstart"in t?n.on("selectstart.drag",Li,ul):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function VC(e,t){var n=e.document.documentElement,s=Ln(e).on("dragstart.drag",null);t&&(s.on("click.drag",Li,ul),setTimeout(function(){s.on("click.drag",null)},0)),"onselectstart"in n?s.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const Qc=e=>()=>e;function Rv(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}})}Rv.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function ZM(e){return!e.ctrlKey&&!e.button}function JM(){return this.parentNode}function eI(e,t){return t??{x:e.x,y:e.y}}function tI(){return navigator.maxTouchPoints||"ontouchstart"in this}function nI(){var e=ZM,t=JM,n=eI,s=tI,i={},a=qu("start","drag","end"),l=0,u,h,p,f,g=0;function v(j){j.on("mousedown.drag",w).filter(s).on("touchstart.drag",k).on("touchmove.drag",S,QM).on("touchend.drag touchcancel.drag",N).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function w(j,M){if(!(f||!e.call(this,j,M))){var P=C(this,t.call(this,j,M),j,M,"mouse");P&&(Ln(j.view).on("mousemove.drag",E,ul).on("mouseup.drag",b,ul),GC(j.view),Vf(j),p=!1,u=j.clientX,h=j.clientY,P("start",j))}}function E(j){if(Li(j),!p){var M=j.clientX-u,P=j.clientY-h;p=M*M+P*P>g}i.mouse("drag",j)}function b(j){Ln(j.view).on("mousemove.drag mouseup.drag",null),VC(j.view,p),Li(j),i.mouse("end",j)}function k(j,M){if(e.call(this,j,M)){var P=j.changedTouches,I=t.call(this,j,M),D=P.length,O,A;for(O=0;O<D;++O)(A=C(this,I,j,M,P[O].identifier,P[O]))&&(Vf(j),A("start",j,P[O]))}}function S(j){var M=j.changedTouches,P=M.length,I,D;for(I=0;I<P;++I)(D=i[M[I].identifier])&&(Li(j),D("drag",j,M[I]))}function N(j){var M=j.changedTouches,P=M.length,I,D;for(f&&clearTimeout(f),f=setTimeout(function(){f=null},500),I=0;I<P;++I)(D=i[M[I].identifier])&&(Vf(j),D("end",j,M[I]))}function C(j,M,P,I,D,O){var A=a.copy(),L=or(O||P,M),z,K,R;if((R=n.call(j,new Rv("beforestart",{sourceEvent:P,target:v,identifier:D,active:l,x:L[0],y:L[1],dx:0,dy:0,dispatch:A}),I))!=null)return z=R.x-L[0]||0,K=R.y-L[1]||0,function Q(H,ne,X){var W=L,ee;switch(H){case"start":i[D]=Q,ee=l++;break;case"end":delete i[D],--l;case"drag":L=or(X||ne,M),ee=l;break}A.call(H,j,new Rv(H,{sourceEvent:ne,subject:R,target:v,identifier:D,active:ee,x:L[0]+z,y:L[1]+K,dx:L[0]-W[0],dy:L[1]-W[1],dispatch:A}),I)}}return v.filter=function(j){return arguments.length?(e=typeof j=="function"?j:Qc(!!j),v):e},v.container=function(j){return arguments.length?(t=typeof j=="function"?j:Qc(j),v):t},v.subject=function(j){return arguments.length?(n=typeof j=="function"?j:Qc(j),v):n},v.touchable=function(j){return arguments.length?(s=typeof j=="function"?j:Qc(!!j),v):s},v.on=function(){var j=a.on.apply(a,arguments);return j===a?v:j},v.clickDistance=function(j){return arguments.length?(g=(j=+j)*j,v):Math.sqrt(g)},v}function fw(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function YC(e,t){var n=Object.create(e.prototype);for(var s in t)n[s]=t[s];return n}function Nl(){}var dl=.7,_u=1/dl,qi="\\s*([+-]?\\d+)\\s*",fl="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Er="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",rI=/^#([0-9a-f]{3,8})$/,sI=new RegExp(`^rgb\\(${qi},${qi},${qi}\\)$`),oI=new RegExp(`^rgb\\(${Er},${Er},${Er}\\)$`),iI=new RegExp(`^rgba\\(${qi},${qi},${qi},${fl}\\)$`),aI=new RegExp(`^rgba\\(${Er},${Er},${Er},${fl}\\)$`),lI=new RegExp(`^hsl\\(${fl},${Er},${Er}\\)$`),cI=new RegExp(`^hsla\\(${fl},${Er},${Er},${fl}\\)$`),ub={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};fw(Nl,hl,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:db,formatHex:db,formatHex8:uI,formatHsl:dI,formatRgb:fb,toString:fb});function db(){return this.rgb().formatHex()}function uI(){return this.rgb().formatHex8()}function dI(){return KC(this).formatHsl()}function fb(){return this.rgb().formatRgb()}function hl(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=rI.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?hb(t):n===3?new dn(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Zc(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Zc(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=sI.exec(e))?new dn(t[1],t[2],t[3],1):(t=oI.exec(e))?new dn(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=iI.exec(e))?Zc(t[1],t[2],t[3],t[4]):(t=aI.exec(e))?Zc(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=lI.exec(e))?gb(t[1],t[2]/100,t[3]/100,1):(t=cI.exec(e))?gb(t[1],t[2]/100,t[3]/100,t[4]):ub.hasOwnProperty(e)?hb(ub[e]):e==="transparent"?new dn(NaN,NaN,NaN,0):null}function hb(e){return new dn(e>>16&255,e>>8&255,e&255,1)}function Zc(e,t,n,s){return s<=0&&(e=t=n=NaN),new dn(e,t,n,s)}function fI(e){return e instanceof Nl||(e=hl(e)),e?(e=e.rgb(),new dn(e.r,e.g,e.b,e.opacity)):new dn}function Av(e,t,n,s){return arguments.length===1?fI(e):new dn(e,t,n,s??1)}function dn(e,t,n,s){this.r=+e,this.g=+t,this.b=+n,this.opacity=+s}fw(dn,Av,YC(Nl,{brighter(e){return e=e==null?_u:Math.pow(_u,e),new dn(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?dl:Math.pow(dl,e),new dn(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new dn(bo(this.r),bo(this.g),bo(this.b),Su(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:pb,formatHex:pb,formatHex8:hI,formatRgb:mb,toString:mb}));function pb(){return`#${wo(this.r)}${wo(this.g)}${wo(this.b)}`}function hI(){return`#${wo(this.r)}${wo(this.g)}${wo(this.b)}${wo((isNaN(this.opacity)?1:this.opacity)*255)}`}function mb(){const e=Su(this.opacity);return`${e===1?"rgb(":"rgba("}${bo(this.r)}, ${bo(this.g)}, ${bo(this.b)}${e===1?")":`, ${e})`}`}function Su(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function bo(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function wo(e){return e=bo(e),(e<16?"0":"")+e.toString(16)}function gb(e,t,n,s){return s<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new ir(e,t,n,s)}function KC(e){if(e instanceof ir)return new ir(e.h,e.s,e.l,e.opacity);if(e instanceof Nl||(e=hl(e)),!e)return new ir;if(e instanceof ir)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 ir(l,u,h,e.opacity)}function pI(e,t,n,s){return arguments.length===1?KC(e):new ir(e,t,n,s??1)}function ir(e,t,n,s){this.h=+e,this.s=+t,this.l=+n,this.opacity=+s}fw(ir,pI,YC(Nl,{brighter(e){return e=e==null?_u:Math.pow(_u,e),new ir(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?dl:Math.pow(dl,e),new ir(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,s=n+(n<.5?n:1-n)*t,i=2*n-s;return new dn(Yf(e>=240?e-240:e+120,i,s),Yf(e,i,s),Yf(e<120?e+240:e-120,i,s),this.opacity)},clamp(){return new ir(yb(this.h),Jc(this.s),Jc(this.l),Su(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=Su(this.opacity);return`${e===1?"hsl(":"hsla("}${yb(this.h)}, ${Jc(this.s)*100}%, ${Jc(this.l)*100}%${e===1?")":`, ${e})`}`}}));function yb(e){return e=(e||0)%360,e<0?e+360:e}function Jc(e){return Math.max(0,Math.min(1,e||0))}function Yf(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const XC=e=>()=>e;function mI(e,t){return function(n){return e+n*t}}function gI(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 yI(e){return(e=+e)==1?QC:function(t,n){return n-t?gI(t,n,e):XC(isNaN(t)?n:t)}}function QC(e,t){var n=t-e;return n?mI(e,n):XC(isNaN(e)?t:e)}const vb=(function e(t){var n=yI(t);function s(i,a){var l=n((i=Av(i)).r,(a=Av(a)).r),u=n(i.g,a.g),h=n(i.b,a.b),p=QC(i.opacity,a.opacity);return function(f){return i.r=l(f),i.g=u(f),i.b=h(f),i.opacity=p(f),i+""}}return s.gamma=e,s})(1);function Ms(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var Mv=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Kf=new RegExp(Mv.source,"g");function vI(e){return function(){return e}}function wI(e){return function(t){return e(t)+""}}function xI(e,t){var n=Mv.lastIndex=Kf.lastIndex=0,s,i,a,l=-1,u=[],h=[];for(e=e+"",t=t+"";(s=Mv.exec(e))&&(i=Kf.exec(t));)(a=i.index)>n&&(a=t.slice(n,a),u[l]?u[l]+=a:u[++l]=a),(s=s[0])===(i=i[0])?u[l]?u[l]+=i:u[++l]=i:(u[++l]=null,h.push({i:l,x:Ms(s,i)})),n=Kf.lastIndex;return n<t.length&&(a=t.slice(n),u[l]?u[l]+=a:u[++l]=a),u.length<2?h[0]?wI(h[0].x):vI(t):(t=h.length,function(p){for(var f=0,g;f<t;++f)u[(g=h[f]).i]=g.x(p);return u.join("")})}var wb=180/Math.PI,Iv={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function ZC(e,t,n,s,i,a){var l,u,h;return(l=Math.sqrt(e*e+t*t))&&(e/=l,t/=l),(h=e*n+t*s)&&(n-=e*h,s-=t*h),(u=Math.sqrt(n*n+s*s))&&(n/=u,s/=u,h/=u),e*s<t*n&&(e=-e,t=-t,h=-h,l=-l),{translateX:i,translateY:a,rotate:Math.atan2(t,e)*wb,skewX:Math.atan(h)*wb,scaleX:l,scaleY:u}}var eu;function bI(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Iv:ZC(t.a,t.b,t.c,t.d,t.e,t.f)}function kI(e){return e==null||(eu||(eu=document.createElementNS("http://www.w3.org/2000/svg","g")),eu.setAttribute("transform",e),!(e=eu.transform.baseVal.consolidate()))?Iv:(e=e.matrix,ZC(e.a,e.b,e.c,e.d,e.e,e.f))}function JC(e,t,n,s){function i(p){return p.length?p.pop()+" ":""}function a(p,f,g,v,w,E){if(p!==g||f!==v){var b=w.push("translate(",null,t,null,n);E.push({i:b-4,x:Ms(p,g)},{i:b-2,x:Ms(f,v)})}else(g||v)&&w.push("translate("+g+t+v+n)}function l(p,f,g,v){p!==f?(p-f>180?f+=360:f-p>180&&(p+=360),v.push({i:g.push(i(g)+"rotate(",null,s)-2,x:Ms(p,f)})):f&&g.push(i(g)+"rotate("+f+s)}function u(p,f,g,v){p!==f?v.push({i:g.push(i(g)+"skewX(",null,s)-2,x:Ms(p,f)}):f&&g.push(i(g)+"skewX("+f+s)}function h(p,f,g,v,w,E){if(p!==g||f!==v){var b=w.push(i(w)+"scale(",null,",",null,")");E.push({i:b-4,x:Ms(p,g)},{i:b-2,x:Ms(f,v)})}else(g!==1||v!==1)&&w.push(i(w)+"scale("+g+","+v+")")}return function(p,f){var g=[],v=[];return p=e(p),f=e(f),a(p.translateX,p.translateY,f.translateX,f.translateY,g,v),l(p.rotate,f.rotate,g,v),u(p.skewX,f.skewX,g,v),h(p.scaleX,p.scaleY,f.scaleX,f.scaleY,g,v),p=f=null,function(w){for(var E=-1,b=v.length,k;++E<b;)g[(k=v[E]).i]=k.x(w);return g.join("")}}}var _I=JC(bI,"px, ","px)","deg)"),SI=JC(kI,", ",")",")"),NI=1e-12;function xb(e){return((e=Math.exp(e))+1/e)/2}function EI(e){return((e=Math.exp(e))-1/e)/2}function CI(e){return((e=Math.exp(2*e))-1)/(e+1)}const jI=(function e(t,n,s){function i(a,l){var u=a[0],h=a[1],p=a[2],f=l[0],g=l[1],v=l[2],w=f-u,E=g-h,b=w*w+E*E,k,S;if(b<NI)S=Math.log(v/p)/t,k=function(I){return[u+I*w,h+I*E,p*Math.exp(t*I*S)]};else{var N=Math.sqrt(b),C=(v*v-p*p+s*b)/(2*p*n*N),j=(v*v-p*p-s*b)/(2*v*n*N),M=Math.log(Math.sqrt(C*C+1)-C),P=Math.log(Math.sqrt(j*j+1)-j);S=(P-M)/t,k=function(I){var D=I*S,O=xb(M),A=p/(n*N)*(O*CI(t*D+M)-EI(M));return[u+A*w,h+A*E,p*O/xb(t*D+M)]}}return k.duration=S*1e3*t/Math.SQRT2,k}return i.rho=function(a){var l=Math.max(.001,+a),u=l*l,h=u*u;return e(l,u,h)},i})(Math.SQRT2,2,4);var Wi=0,rl=0,Ya=0,ej=1e3,Nu,sl,Eu=0,_o=0,Fu=0,pl=typeof performance=="object"&&performance.now?performance:Date,tj=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function hw(){return _o||(tj(TI),_o=pl.now()+Fu)}function TI(){_o=0}function Cu(){this._call=this._time=this._next=null}Cu.prototype=nj.prototype={constructor:Cu,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?hw():+n)+(t==null?0:+t),!this._next&&sl!==this&&(sl?sl._next=this:Nu=this,sl=this),this._call=e,this._time=n,Ov()},stop:function(){this._call&&(this._call=null,this._time=1/0,Ov())}};function nj(e,t,n){var s=new Cu;return s.restart(e,t,n),s}function RI(){hw(),++Wi;for(var e=Nu,t;e;)(t=_o-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Wi}function bb(){_o=(Eu=pl.now())+Fu,Wi=rl=0;try{RI()}finally{Wi=0,MI(),_o=0}}function AI(){var e=pl.now(),t=e-Eu;t>ej&&(Fu-=t,Eu=e)}function MI(){for(var e,t=Nu,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:Nu=n);sl=e,Ov(s)}function Ov(e){if(!Wi){rl&&(rl=clearTimeout(rl));var t=e-_o;t>24?(e<1/0&&(rl=setTimeout(bb,e-pl.now()-Fu)),Ya&&(Ya=clearInterval(Ya))):(Ya||(Eu=pl.now(),Ya=setInterval(AI,ej)),Wi=1,tj(bb))}}function kb(e,t,n){var s=new Cu;return t=t==null?0:+t,s.restart(i=>{s.stop(),e(i+t)},t,n),s}var II=qu("start","end","cancel","interrupt"),OI=[],rj=0,_b=1,Pv=2,yu=3,Sb=4,$v=5,vu=6;function zu(e,t,n,s,i,a){var l=e.__transition;if(!l)e.__transition={};else if(n in l)return;PI(e,n,{name:t,index:s,group:i,on:II,tween:OI,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:rj})}function pw(e,t){var n=dr(e,t);if(n.state>rj)throw new Error("too late; already scheduled");return n}function Cr(e,t){var n=dr(e,t);if(n.state>yu)throw new Error("too late; already running");return n}function dr(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function PI(e,t,n){var s=e.__transition,i;s[t]=n,n.timer=nj(a,0,n.time);function a(p){n.state=_b,n.timer.restart(l,n.delay,n.time),n.delay<=p&&l(p-n.delay)}function l(p){var f,g,v,w;if(n.state!==_b)return h();for(f in s)if(w=s[f],w.name===n.name){if(w.state===yu)return kb(l);w.state===Sb?(w.state=vu,w.timer.stop(),w.on.call("interrupt",e,e.__data__,w.index,w.group),delete s[f]):+f<t&&(w.state=vu,w.timer.stop(),w.on.call("cancel",e,e.__data__,w.index,w.group),delete s[f])}if(kb(function(){n.state===yu&&(n.state=Sb,n.timer.restart(u,n.delay,n.time),u(p))}),n.state=Pv,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Pv){for(n.state=yu,i=new Array(v=n.tween.length),f=0,g=-1;f<v;++f)(w=n.tween[f].value.call(e,e.__data__,n.index,n.group))&&(i[++g]=w);i.length=g+1}}function u(p){for(var f=p<n.duration?n.ease.call(null,p/n.duration):(n.timer.restart(h),n.state=$v,1),g=-1,v=i.length;++g<v;)i[g].call(e,f);n.state===$v&&(n.on.call("end",e,e.__data__,n.index,n.group),h())}function h(){n.state=vu,n.timer.stop(),delete s[t];for(var p in s)return;delete e.__transition}}function wu(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>Pv&&s.state<$v,s.state=vu,s.timer.stop(),s.on.call(i?"interrupt":"cancel",e,e.__data__,s.index,s.group),delete n[l]}a&&delete e.__transition}}function $I(e){return this.each(function(){wu(this,e)})}function LI(e,t){var n,s;return function(){var i=Cr(this,e),a=i.tween;if(a!==n){s=n=a;for(var l=0,u=s.length;l<u;++l)if(s[l].name===t){s=s.slice(),s.splice(l,1);break}}i.tween=s}}function qI(e,t,n){var s,i;if(typeof n!="function")throw new Error;return function(){var a=Cr(this,e),l=a.tween;if(l!==s){i=(s=l).slice();for(var u={name:t,value:n},h=0,p=i.length;h<p;++h)if(i[h].name===t){i[h]=u;break}h===p&&i.push(u)}a.tween=i}}function DI(e,t){var n=this._id;if(e+="",arguments.length<2){for(var s=dr(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?LI:qI)(n,e,t))}function mw(e,t,n){var s=e._id;return e.each(function(){var i=Cr(this,s);(i.value||(i.value={}))[t]=n.apply(this,arguments)}),function(i){return dr(i,s).value[t]}}function sj(e,t){var n;return(typeof t=="number"?Ms:t instanceof hl?vb:(n=hl(t))?(t=n,vb):xI)(e,t)}function FI(e){return function(){this.removeAttribute(e)}}function zI(e){return function(){this.removeAttributeNS(e.space,e.local)}}function BI(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 UI(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 WI(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 HI(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 GI(e,t){var n=Du(e),s=n==="transform"?SI:sj;return this.attrTween(e,typeof t=="function"?(n.local?HI:WI)(n,s,mw(this,"attr."+e,t)):t==null?(n.local?zI:FI)(n):(n.local?UI:BI)(n,s,t))}function VI(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function YI(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function KI(e,t){var n,s;function i(){var a=t.apply(this,arguments);return a!==s&&(n=(s=a)&&YI(e,a)),n}return i._value=t,i}function XI(e,t){var n,s;function i(){var a=t.apply(this,arguments);return a!==s&&(n=(s=a)&&VI(e,a)),n}return i._value=t,i}function QI(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=Du(e);return this.tween(n,(s.local?KI:XI)(s,t))}function ZI(e,t){return function(){pw(this,e).delay=+t.apply(this,arguments)}}function JI(e,t){return t=+t,function(){pw(this,e).delay=t}}function eO(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?ZI:JI)(t,e)):dr(this.node(),t).delay}function tO(e,t){return function(){Cr(this,e).duration=+t.apply(this,arguments)}}function nO(e,t){return t=+t,function(){Cr(this,e).duration=t}}function rO(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?tO:nO)(t,e)):dr(this.node(),t).duration}function sO(e,t){if(typeof t!="function")throw new Error;return function(){Cr(this,e).ease=t}}function oO(e){var t=this._id;return arguments.length?this.each(sO(t,e)):dr(this.node(),t).ease}function iO(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Cr(this,e).ease=n}}function aO(e){if(typeof e!="function")throw new Error;return this.each(iO(this._id,e))}function lO(e){typeof e!="function"&&(e=$C(e));for(var t=this._groups,n=t.length,s=new Array(n),i=0;i<n;++i)for(var a=t[i],l=a.length,u=s[i]=[],h,p=0;p<l;++p)(h=a[p])&&e.call(h,h.__data__,p,a)&&u.push(h);return new Zr(s,this._parents,this._name,this._id)}function cO(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,s=t.length,i=n.length,a=Math.min(s,i),l=new Array(s),u=0;u<a;++u)for(var h=t[u],p=n[u],f=h.length,g=l[u]=new Array(f),v,w=0;w<f;++w)(v=h[w]||p[w])&&(g[w]=v);for(;u<s;++u)l[u]=t[u];return new Zr(l,this._parents,this._name,this._id)}function uO(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 dO(e,t,n){var s,i,a=uO(t)?pw:Cr;return function(){var l=a(this,e),u=l.on;u!==s&&(i=(s=u).copy()).on(t,n),l.on=i}}function fO(e,t){var n=this._id;return arguments.length<2?dr(this.node(),n).on.on(e):this.each(dO(n,e,t))}function hO(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function pO(){return this.on("end.remove",hO(this._id))}function mO(e){var t=this._name,n=this._id;typeof e!="function"&&(e=uw(e));for(var s=this._groups,i=s.length,a=new Array(i),l=0;l<i;++l)for(var u=s[l],h=u.length,p=a[l]=new Array(h),f,g,v=0;v<h;++v)(f=u[v])&&(g=e.call(f,f.__data__,v,u))&&("__data__"in f&&(g.__data__=f.__data__),p[v]=g,zu(p[v],t,n,v,p,dr(f,n)));return new Zr(a,this._parents,t,n)}function gO(e){var t=this._name,n=this._id;typeof e!="function"&&(e=PC(e));for(var s=this._groups,i=s.length,a=[],l=[],u=0;u<i;++u)for(var h=s[u],p=h.length,f,g=0;g<p;++g)if(f=h[g]){for(var v=e.call(f,f.__data__,g,h),w,E=dr(f,n),b=0,k=v.length;b<k;++b)(w=v[b])&&zu(w,t,n,b,v,E);a.push(v),l.push(f)}return new Zr(a,l,t,n)}var yO=Sl.prototype.constructor;function vO(){return new yO(this._groups,this._parents)}function wO(e,t){var n,s,i;return function(){var a=Ui(this,e),l=(this.style.removeProperty(e),Ui(this,e));return a===l?null:a===n&&l===s?i:i=t(n=a,s=l)}}function oj(e){return function(){this.style.removeProperty(e)}}function xO(e,t,n){var s,i=n+"",a;return function(){var l=Ui(this,e);return l===i?null:l===s?a:a=t(s=l,n)}}function bO(e,t,n){var s,i,a;return function(){var l=Ui(this,e),u=n(this),h=u+"";return u==null&&(h=u=(this.style.removeProperty(e),Ui(this,e))),l===h?null:l===s&&h===i?a:(i=h,a=t(s=l,u))}}function kO(e,t){var n,s,i,a="style."+t,l="end."+a,u;return function(){var h=Cr(this,e),p=h.on,f=h.value[a]==null?u||(u=oj(t)):void 0;(p!==n||i!==f)&&(s=(n=p).copy()).on(l,i=f),h.on=s}}function _O(e,t,n){var s=(e+="")=="transform"?_I:sj;return t==null?this.styleTween(e,wO(e,s)).on("end.style."+e,oj(e)):typeof t=="function"?this.styleTween(e,bO(e,s,mw(this,"style."+e,t))).each(kO(this._id,e)):this.styleTween(e,xO(e,s,t),n).on("end.style."+e,null)}function SO(e,t,n){return function(s){this.style.setProperty(e,t.call(this,s),n)}}function NO(e,t,n){var s,i;function a(){var l=t.apply(this,arguments);return l!==i&&(s=(i=l)&&SO(e,l,n)),s}return a._value=t,a}function EO(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,NO(e,t,n??""))}function CO(e){return function(){this.textContent=e}}function jO(e){return function(){var t=e(this);this.textContent=t??""}}function TO(e){return this.tween("text",typeof e=="function"?jO(mw(this,"text",e)):CO(e==null?"":e+""))}function RO(e){return function(t){this.textContent=e.call(this,t)}}function AO(e){var t,n;function s(){var i=e.apply(this,arguments);return i!==n&&(t=(n=i)&&RO(i)),t}return s._value=e,s}function MO(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,AO(e))}function IO(){for(var e=this._name,t=this._id,n=ij(),s=this._groups,i=s.length,a=0;a<i;++a)for(var l=s[a],u=l.length,h,p=0;p<u;++p)if(h=l[p]){var f=dr(h,t);zu(h,e,n,p,l,{time:f.time+f.delay+f.duration,delay:0,duration:f.duration,ease:f.ease})}return new Zr(s,this._parents,e,n)}function OO(){var e,t,n=this,s=n._id,i=n.size();return new Promise(function(a,l){var u={value:l},h={value:function(){--i===0&&a()}};n.each(function(){var p=Cr(this,s),f=p.on;f!==e&&(t=(e=f).copy(),t._.cancel.push(u),t._.interrupt.push(u),t._.end.push(h)),p.on=t}),i===0&&a()})}var PO=0;function Zr(e,t,n,s){this._groups=e,this._parents=t,this._name=n,this._id=s}function ij(){return++PO}var Kr=Sl.prototype;Zr.prototype={constructor:Zr,select:mO,selectAll:gO,selectChild:Kr.selectChild,selectChildren:Kr.selectChildren,filter:lO,merge:cO,selection:vO,transition:IO,call:Kr.call,nodes:Kr.nodes,node:Kr.node,size:Kr.size,empty:Kr.empty,each:Kr.each,on:fO,attr:GI,attrTween:QI,style:_O,styleTween:EO,text:TO,textTween:MO,remove:pO,tween:DI,delay:eO,duration:rO,ease:oO,easeVarying:aO,end:OO,[Symbol.iterator]:Kr[Symbol.iterator]};function $O(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var LO={time:null,delay:0,duration:250,ease:$O};function qO(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 DO(e){var t,n;e instanceof Zr?(t=e._id,e=e._name):(t=ij(),(n=LO).time=hw(),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])&&zu(h,e,t,p,l,n||qO(h,t));return new Zr(s,this._parents,e,t)}Sl.prototype.interrupt=$I;Sl.prototype.transition=DO;const tu=e=>()=>e;function FO(e,{sourceEvent:t,target:n,transform:s,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:s,enumerable:!0,configurable:!0},_:{value:i}})}function Xr(e,t,n){this.k=e,this.x=t,this.y=n}Xr.prototype={constructor:Xr,scale:function(e){return e===1?this:new Xr(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Xr(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Qr=new Xr(1,0,0);Xr.prototype;function Xf(e){e.stopImmediatePropagation()}function Ka(e){e.preventDefault(),e.stopImmediatePropagation()}function zO(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function BO(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function Nb(){return this.__zoom||Qr}function UO(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function WO(){return navigator.maxTouchPoints||"ontouchstart"in this}function HO(e,t,n){var s=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],a=e.invertY(t[0][1])-n[0][1],l=e.invertY(t[1][1])-n[1][1];return e.translate(i>s?(s+i)/2:Math.min(0,s)||Math.max(0,i),l>a?(a+l)/2:Math.min(0,a)||Math.max(0,l))}function aj(){var e=zO,t=BO,n=HO,s=UO,i=WO,a=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],u=250,h=jI,p=qu("start","zoom","end"),f,g,v,w=500,E=150,b=0,k=10;function S(R){R.property("__zoom",Nb).on("wheel.zoom",D,{passive:!1}).on("mousedown.zoom",O).on("dblclick.zoom",A).filter(i).on("touchstart.zoom",L).on("touchmove.zoom",z).on("touchend.zoom touchcancel.zoom",K).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}S.transform=function(R,Q,H,ne){var X=R.selection?R.selection():R;X.property("__zoom",Nb),R!==X?M(R,Q,H,ne):X.interrupt().each(function(){P(this,arguments).event(ne).start().zoom(null,typeof Q=="function"?Q.apply(this,arguments):Q).end()})},S.scaleBy=function(R,Q,H,ne){S.scaleTo(R,function(){var X=this.__zoom.k,W=typeof Q=="function"?Q.apply(this,arguments):Q;return X*W},H,ne)},S.scaleTo=function(R,Q,H,ne){S.transform(R,function(){var X=t.apply(this,arguments),W=this.__zoom,ee=H==null?j(X):typeof H=="function"?H.apply(this,arguments):H,$=W.invert(ee),Y=typeof Q=="function"?Q.apply(this,arguments):Q;return n(C(N(W,Y),ee,$),X,l)},H,ne)},S.translateBy=function(R,Q,H,ne){S.transform(R,function(){return n(this.__zoom.translate(typeof Q=="function"?Q.apply(this,arguments):Q,typeof H=="function"?H.apply(this,arguments):H),t.apply(this,arguments),l)},null,ne)},S.translateTo=function(R,Q,H,ne,X){S.transform(R,function(){var W=t.apply(this,arguments),ee=this.__zoom,$=ne==null?j(W):typeof ne=="function"?ne.apply(this,arguments):ne;return n(Qr.translate($[0],$[1]).scale(ee.k).translate(typeof Q=="function"?-Q.apply(this,arguments):-Q,typeof H=="function"?-H.apply(this,arguments):-H),W,l)},ne,X)};function N(R,Q){return Q=Math.max(a[0],Math.min(a[1],Q)),Q===R.k?R:new Xr(Q,R.x,R.y)}function C(R,Q,H){var ne=Q[0]-H[0]*R.k,X=Q[1]-H[1]*R.k;return ne===R.x&&X===R.y?R:new Xr(R.k,ne,X)}function j(R){return[(+R[0][0]+ +R[1][0])/2,(+R[0][1]+ +R[1][1])/2]}function M(R,Q,H,ne){R.on("start.zoom",function(){P(this,arguments).event(ne).start()}).on("interrupt.zoom end.zoom",function(){P(this,arguments).event(ne).end()}).tween("zoom",function(){var X=this,W=arguments,ee=P(X,W).event(ne),$=t.apply(X,W),Y=H==null?j($):typeof H=="function"?H.apply(X,W):H,de=Math.max($[1][0]-$[0][0],$[1][1]-$[0][1]),G=X.__zoom,F=typeof Q=="function"?Q.apply(X,W):Q,J=h(G.invert(Y).concat(de/G.k),F.invert(Y).concat(de/F.k));return function(V){if(V===1)V=F;else{var ae=J(V),pe=de/ae[2];V=new Xr(pe,Y[0]-ae[0]*pe,Y[1]-ae[1]*pe)}ee.zoom(null,V)}})}function P(R,Q,H){return!H&&R.__zooming||new I(R,Q)}function I(R,Q){this.that=R,this.args=Q,this.active=0,this.sourceEvent=null,this.extent=t.apply(R,Q),this.taps=0}I.prototype={event:function(R){return R&&(this.sourceEvent=R),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(R,Q){return this.mouse&&R!=="mouse"&&(this.mouse[1]=Q.invert(this.mouse[0])),this.touch0&&R!=="touch"&&(this.touch0[1]=Q.invert(this.touch0[0])),this.touch1&&R!=="touch"&&(this.touch1[1]=Q.invert(this.touch1[0])),this.that.__zoom=Q,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(R){var Q=Ln(this.that).datum();p.call(R,this.that,new FO(R,{sourceEvent:this.sourceEvent,target:S,transform:this.that.__zoom,dispatch:p}),Q)}};function D(R,...Q){if(!e.apply(this,arguments))return;var H=P(this,Q).event(R),ne=this.__zoom,X=Math.max(a[0],Math.min(a[1],ne.k*Math.pow(2,s.apply(this,arguments)))),W=or(R);if(H.wheel)(H.mouse[0][0]!==W[0]||H.mouse[0][1]!==W[1])&&(H.mouse[1]=ne.invert(H.mouse[0]=W)),clearTimeout(H.wheel);else{if(ne.k===X)return;H.mouse=[W,ne.invert(W)],wu(this),H.start()}Ka(R),H.wheel=setTimeout(ee,E),H.zoom("mouse",n(C(N(ne,X),H.mouse[0],H.mouse[1]),H.extent,l));function ee(){H.wheel=null,H.end()}}function O(R,...Q){if(v||!e.apply(this,arguments))return;var H=R.currentTarget,ne=P(this,Q,!0).event(R),X=Ln(R.view).on("mousemove.zoom",Y,!0).on("mouseup.zoom",de,!0),W=or(R,H),ee=R.clientX,$=R.clientY;GC(R.view),Xf(R),ne.mouse=[W,this.__zoom.invert(W)],wu(this),ne.start();function Y(G){if(Ka(G),!ne.moved){var F=G.clientX-ee,J=G.clientY-$;ne.moved=F*F+J*J>b}ne.event(G).zoom("mouse",n(C(ne.that.__zoom,ne.mouse[0]=or(G,H),ne.mouse[1]),ne.extent,l))}function de(G){X.on("mousemove.zoom mouseup.zoom",null),VC(G.view,ne.moved),Ka(G),ne.event(G).end()}}function A(R,...Q){if(e.apply(this,arguments)){var H=this.__zoom,ne=or(R.changedTouches?R.changedTouches[0]:R,this),X=H.invert(ne),W=H.k*(R.shiftKey?.5:2),ee=n(C(N(H,W),ne,X),t.apply(this,Q),l);Ka(R),u>0?Ln(this).transition().duration(u).call(M,ee,ne,R):Ln(this).call(S.transform,ee,ne,R)}}function L(R,...Q){if(e.apply(this,arguments)){var H=R.touches,ne=H.length,X=P(this,Q,R.changedTouches.length===ne).event(R),W,ee,$,Y;for(Xf(R),ee=0;ee<ne;++ee)$=H[ee],Y=or($,this),Y=[Y,this.__zoom.invert(Y),$.identifier],X.touch0?!X.touch1&&X.touch0[2]!==Y[2]&&(X.touch1=Y,X.taps=0):(X.touch0=Y,W=!0,X.taps=1+!!f);f&&(f=clearTimeout(f)),W&&(X.taps<2&&(g=Y[0],f=setTimeout(function(){f=null},w)),wu(this),X.start())}}function z(R,...Q){if(this.__zooming){var H=P(this,Q).event(R),ne=R.changedTouches,X=ne.length,W,ee,$,Y;for(Ka(R),W=0;W<X;++W)ee=ne[W],$=or(ee,this),H.touch0&&H.touch0[2]===ee.identifier?H.touch0[0]=$:H.touch1&&H.touch1[2]===ee.identifier&&(H.touch1[0]=$);if(ee=H.that.__zoom,H.touch1){var de=H.touch0[0],G=H.touch0[1],F=H.touch1[0],J=H.touch1[1],V=(V=F[0]-de[0])*V+(V=F[1]-de[1])*V,ae=(ae=J[0]-G[0])*ae+(ae=J[1]-G[1])*ae;ee=N(ee,Math.sqrt(V/ae)),$=[(de[0]+F[0])/2,(de[1]+F[1])/2],Y=[(G[0]+J[0])/2,(G[1]+J[1])/2]}else if(H.touch0)$=H.touch0[0],Y=H.touch0[1];else return;H.zoom("touch",n(C(ee,$,Y),H.extent,l))}}function K(R,...Q){if(this.__zooming){var H=P(this,Q).event(R),ne=R.changedTouches,X=ne.length,W,ee;for(Xf(R),v&&clearTimeout(v),v=setTimeout(function(){v=null},w),W=0;W<X;++W)ee=ne[W],H.touch0&&H.touch0[2]===ee.identifier?delete H.touch0:H.touch1&&H.touch1[2]===ee.identifier&&delete H.touch1;if(H.touch1&&!H.touch0&&(H.touch0=H.touch1,delete H.touch1),H.touch0)H.touch0[1]=this.__zoom.invert(H.touch0[0]);else if(H.end(),H.taps===2&&(ee=or(ee,this),Math.hypot(g[0]-ee[0],g[1]-ee[1])<k)){var $=Ln(this).on("dblclick.zoom");$&&$.apply(this,arguments)}}}return S.wheelDelta=function(R){return arguments.length?(s=typeof R=="function"?R:tu(+R),S):s},S.filter=function(R){return arguments.length?(e=typeof R=="function"?R:tu(!!R),S):e},S.touchable=function(R){return arguments.length?(i=typeof R=="function"?R:tu(!!R),S):i},S.extent=function(R){return arguments.length?(t=typeof R=="function"?R:tu([[+R[0][0],+R[0][1]],[+R[1][0],+R[1][1]]]),S):t},S.scaleExtent=function(R){return arguments.length?(a[0]=+R[0],a[1]=+R[1],S):[a[0],a[1]]},S.translateExtent=function(R){return arguments.length?(l[0][0]=+R[0][0],l[1][0]=+R[1][0],l[0][1]=+R[0][1],l[1][1]=+R[1][1],S):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},S.constrain=function(R){return arguments.length?(n=R,S):n},S.duration=function(R){return arguments.length?(u=+R,S):u},S.interpolate=function(R){return arguments.length?(h=R,S):h},S.on=function(){var R=p.on.apply(p,arguments);return R===p?S:R},S.clickDistance=function(R){return arguments.length?(b=(R=+R)*R,S):Math.sqrt(b)},S.tapDistance=function(R){return arguments.length?(k=+R,S):k},S}var gw=MC();const Bu=_.createContext(null),GO=Bu.Provider,Jr={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,t)=>`Couldn't create edge for ${e?"target":"source"} handle id: "${e?t.targetHandle:t.sourceHandle}", edge id: ${t.id}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`},lj=Jr.error001();function ut(e,t){const n=_.useContext(Bu);if(n===null)throw new Error(lj);return IC(n,e,t)}const Mt=()=>{const e=_.useContext(Bu);if(e===null)throw new Error(lj);return _.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},VO=e=>e.userSelectionActive?"none":"all";function yw({position:e,children:t,className:n,style:s,...i}){const a=ut(VO),l=`${e}`.split("-");return fe.createElement("div",{className:Gt(["react-flow__panel",n,...l]),style:{...s,pointerEvents:a},...i},t)}function YO({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:fe.createElement(yw,{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"},fe.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}const KO=({x:e,y:t,label:n,labelStyle:s={},labelShowBg:i=!0,labelBgStyle:a={},labelBgPadding:l=[2,4],labelBgBorderRadius:u=2,children:h,className:p,...f})=>{const g=_.useRef(null),[v,w]=_.useState({x:0,y:0,width:0,height:0}),E=Gt(["react-flow__edge-textwrapper",p]);return _.useEffect(()=>{if(g.current){const b=g.current.getBBox();w({x:b.x,y:b.y,width:b.width,height:b.height})}},[n]),typeof n>"u"||!n?null:fe.createElement("g",{transform:`translate(${e-v.width/2} ${t-v.height/2})`,className:E,visibility:v.width?"visible":"hidden",...f},i&&fe.createElement("rect",{width:v.width+2*l[0],x:-l[0],y:-l[1],height:v.height+2*l[1],className:"react-flow__edge-textbg",style:a,rx:u,ry:u}),fe.createElement("text",{className:"react-flow__edge-text",y:v.height/2,dy:"0.3em",ref:g,style:s},n),h)};var XO=_.memo(KO);const vw=e=>({width:e.offsetWidth,height:e.offsetHeight}),Hi=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),ww=(e={x:0,y:0},t)=>({x:Hi(e.x,t[0][0],t[1][0]),y:Hi(e.y,t[0][1],t[1][1])}),Eb=(e,t,n)=>e<t?Hi(Math.abs(e-t),1,50)/50:e>n?-Hi(Math.abs(e-n),1,50)/50:0,cj=(e,t)=>{const n=Eb(e.x,35,t.width-35)*20,s=Eb(e.y,35,t.height-35)*20;return[n,s]},uj=e=>{var t;return((t=e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},dj=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),ml=({x:e,y:t,width:n,height:s})=>({x:e,y:t,x2:e+n,y2:t+s}),fj=({x:e,y:t,x2:n,y2:s})=>({x:e,y:t,width:n-e,height:s-t}),Cb=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),QO=(e,t)=>fj(dj(ml(e),ml(t))),Lv=(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)},ZO=e=>qn(e.width)&&qn(e.height)&&qn(e.x)&&qn(e.y),qn=e=>!isNaN(e)&&isFinite(e),Ct=Symbol.for("internals"),hj=["Enter"," ","Escape"],JO=(e,t)=>{},eP=e=>"nativeEvent"in e;function qv(e){var i,a;const t=eP(e)?e.nativeEvent:e,n=((a=(i=t.composedPath)==null?void 0:i.call(t))==null?void 0:a[0])||e.target;return["INPUT","SELECT","TEXTAREA"].includes(n==null?void 0:n.nodeName)||(n==null?void 0:n.hasAttribute("contenteditable"))||!!(n!=null&&n.closest(".nokey"))}const pj=e=>"clientX"in e,Ps=(e,t)=>{var a,l;const n=pj(e),s=n?e.clientX:(a=e.touches)==null?void 0:a[0].clientX,i=n?e.clientY:(l=e.touches)==null?void 0:l[0].clientY;return{x:s-((t==null?void 0:t.left)??0),y:i-((t==null?void 0:t.top)??0)}},ju=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0},El=({id:e,path:t,labelX:n,labelY:s,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:p,style:f,markerEnd:g,markerStart:v,interactionWidth:w=20})=>fe.createElement(fe.Fragment,null,fe.createElement("path",{id:e,style:f,d:t,fill:"none",className:"react-flow__edge-path",markerEnd:g,markerStart:v}),w&&fe.createElement("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:w,className:"react-flow__edge-interaction"}),i&&qn(n)&&qn(s)?fe.createElement(XO,{x:n,y:s,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:p}):null);El.displayName="BaseEdge";function Xa(e,t,n){return n===void 0?n:s=>{const i=t().edges.find(a=>a.id===e);i&&n(s,{...i})}}function mj({sourceX:e,sourceY:t,targetX:n,targetY:s}){const i=Math.abs(n-e)/2,a=n<e?n+i:n-i,l=Math.abs(s-t)/2,u=s<t?s+l:s-l;return[a,u,i,l]}function gj({sourceX:e,sourceY:t,targetX:n,targetY:s,sourceControlX:i,sourceControlY:a,targetControlX:l,targetControlY:u}){const h=e*.125+i*.375+l*.375+n*.125,p=t*.125+a*.375+u*.375+s*.125,f=Math.abs(h-e),g=Math.abs(p-t);return[h,p,f,g]}var So;(function(e){e.Strict="strict",e.Loose="loose"})(So||(So={}));var xo;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(xo||(xo={}));var gl;(function(e){e.Partial="partial",e.Full="full"})(gl||(gl={}));var Os;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Os||(Os={}));var Tu;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Tu||(Tu={}));var $e;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})($e||($e={}));function jb({pos:e,x1:t,y1:n,x2:s,y2:i}){return e===$e.Left||e===$e.Right?[.5*(t+s),n]:[t,.5*(n+i)]}function yj({sourceX:e,sourceY:t,sourcePosition:n=$e.Bottom,targetX:s,targetY:i,targetPosition:a=$e.Top}){const[l,u]=jb({pos:n,x1:e,y1:t,x2:s,y2:i}),[h,p]=jb({pos:a,x1:s,y1:i,x2:e,y2:t}),[f,g,v,w]=gj({sourceX:e,sourceY:t,targetX:s,targetY:i,sourceControlX:l,sourceControlY:u,targetControlX:h,targetControlY:p});return[`M${e},${t} C${l},${u} ${h},${p} ${s},${i}`,f,g,v,w]}const xw=_.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,sourcePosition:i=$e.Bottom,targetPosition:a=$e.Top,label:l,labelStyle:u,labelShowBg:h,labelBgStyle:p,labelBgPadding:f,labelBgBorderRadius:g,style:v,markerEnd:w,markerStart:E,interactionWidth:b})=>{const[k,S,N]=yj({sourceX:e,sourceY:t,sourcePosition:i,targetX:n,targetY:s,targetPosition:a});return fe.createElement(El,{path:k,labelX:S,labelY:N,label:l,labelStyle:u,labelShowBg:h,labelBgStyle:p,labelBgPadding:f,labelBgBorderRadius:g,style:v,markerEnd:w,markerStart:E,interactionWidth:b})});xw.displayName="SimpleBezierEdge";const Tb={[$e.Left]:{x:-1,y:0},[$e.Right]:{x:1,y:0},[$e.Top]:{x:0,y:-1},[$e.Bottom]:{x:0,y:1}},tP=({source:e,sourcePosition:t=$e.Bottom,target:n})=>t===$e.Left||t===$e.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},Rb=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function nP({source:e,sourcePosition:t=$e.Bottom,target:n,targetPosition:s=$e.Top,center:i,offset:a}){const l=Tb[t],u=Tb[s],h={x:e.x+l.x*a,y:e.y+l.y*a},p={x:n.x+u.x*a,y:n.y+u.y*a},f=tP({source:h,sourcePosition:t,target:p}),g=f.x!==0?"x":"y",v=f[g];let w=[],E,b;const k={x:0,y:0},S={x:0,y:0},[N,C,j,M]=mj({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[g]*u[g]===-1){E=i.x??N,b=i.y??C;const I=[{x:E,y:h.y},{x:E,y:p.y}],D=[{x:h.x,y:b},{x:p.x,y:b}];l[g]===v?w=g==="x"?I:D:w=g==="x"?D:I}else{const I=[{x:h.x,y:p.y}],D=[{x:p.x,y:h.y}];if(g==="x"?w=l.x===v?D:I:w=l.y===v?I:D,t===s){const K=Math.abs(e[g]-n[g]);if(K<=a){const R=Math.min(a-1,a-K);l[g]===v?k[g]=(h[g]>e[g]?-1:1)*R:S[g]=(p[g]>n[g]?-1:1)*R}}if(t!==s){const K=g==="x"?"y":"x",R=l[g]===u[K],Q=h[K]>p[K],H=h[K]<p[K];(l[g]===1&&(!R&&Q||R&&H)||l[g]!==1&&(!R&&H||R&&Q))&&(w=g==="x"?I:D)}const O={x:h.x+k.x,y:h.y+k.y},A={x:p.x+S.x,y:p.y+S.y},L=Math.max(Math.abs(O.x-w[0].x),Math.abs(A.x-w[0].x)),z=Math.max(Math.abs(O.y-w[0].y),Math.abs(A.y-w[0].y));L>=z?(E=(O.x+A.x)/2,b=w[0].y):(E=w[0].x,b=(O.y+A.y)/2)}return[[e,{x:h.x+k.x,y:h.y+k.y},...w,{x:p.x+S.x,y:p.y+S.y},n],E,b,j,M]}function rP(e,t,n,s){const i=Math.min(Rb(e,t)/2,Rb(t,n)/2,s),{x:a,y:l}=t;if(e.x===a&&a===n.x||e.y===l&&l===n.y)return`L${a} ${l}`;if(e.y===l){const p=e.x<n.x?-1:1,f=e.y<n.y?1:-1;return`L ${a+i*p},${l}Q ${a},${l} ${a},${l+i*f}`}const u=e.x<n.x?1:-1,h=e.y<n.y?-1:1;return`L ${a},${l+i*h}Q ${a},${l} ${a+i*u},${l}`}function Dv({sourceX:e,sourceY:t,sourcePosition:n=$e.Bottom,targetX:s,targetY:i,targetPosition:a=$e.Top,borderRadius:l=5,centerX:u,centerY:h,offset:p=20}){const[f,g,v,w,E]=nP({source:{x:e,y:t},sourcePosition:n,target:{x:s,y:i},targetPosition:a,center:{x:u,y:h},offset:p});return[f.reduce((k,S,N)=>{let C="";return N>0&&N<f.length-1?C=rP(f[N-1],S,f[N+1],l):C=`${N===0?"M":"L"}${S.x} ${S.y}`,k+=C,k},""),g,v,w,E]}const Uu=_.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:p,style:f,sourcePosition:g=$e.Bottom,targetPosition:v=$e.Top,markerEnd:w,markerStart:E,pathOptions:b,interactionWidth:k})=>{const[S,N,C]=Dv({sourceX:e,sourceY:t,sourcePosition:g,targetX:n,targetY:s,targetPosition:v,borderRadius:b==null?void 0:b.borderRadius,offset:b==null?void 0:b.offset});return fe.createElement(El,{path:S,labelX:N,labelY:C,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:p,style:f,markerEnd:w,markerStart:E,interactionWidth:k})});Uu.displayName="SmoothStepEdge";const bw=_.memo(e=>{var t;return fe.createElement(Uu,{...e,pathOptions:_.useMemo(()=>{var n;return{borderRadius:0,offset:(n=e.pathOptions)==null?void 0:n.offset}},[(t=e.pathOptions)==null?void 0:t.offset])})});bw.displayName="StepEdge";function sP({sourceX:e,sourceY:t,targetX:n,targetY:s}){const[i,a,l,u]=mj({sourceX:e,sourceY:t,targetX:n,targetY:s});return[`M ${e},${t}L ${n},${s}`,i,a,l,u]}const kw=_.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:p,style:f,markerEnd:g,markerStart:v,interactionWidth:w})=>{const[E,b,k]=sP({sourceX:e,sourceY:t,targetX:n,targetY:s});return fe.createElement(El,{path:E,labelX:b,labelY:k,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:p,style:f,markerEnd:g,markerStart:v,interactionWidth:w})});kw.displayName="StraightEdge";function nu(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Ab({pos:e,x1:t,y1:n,x2:s,y2:i,c:a}){switch(e){case $e.Left:return[t-nu(t-s,a),n];case $e.Right:return[t+nu(s-t,a),n];case $e.Top:return[t,n-nu(n-i,a)];case $e.Bottom:return[t,n+nu(i-n,a)]}}function vj({sourceX:e,sourceY:t,sourcePosition:n=$e.Bottom,targetX:s,targetY:i,targetPosition:a=$e.Top,curvature:l=.25}){const[u,h]=Ab({pos:n,x1:e,y1:t,x2:s,y2:i,c:l}),[p,f]=Ab({pos:a,x1:s,y1:i,x2:e,y2:t,c:l}),[g,v,w,E]=gj({sourceX:e,sourceY:t,targetX:s,targetY:i,sourceControlX:u,sourceControlY:h,targetControlX:p,targetControlY:f});return[`M${e},${t} C${u},${h} ${p},${f} ${s},${i}`,g,v,w,E]}const Ru=_.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,sourcePosition:i=$e.Bottom,targetPosition:a=$e.Top,label:l,labelStyle:u,labelShowBg:h,labelBgStyle:p,labelBgPadding:f,labelBgBorderRadius:g,style:v,markerEnd:w,markerStart:E,pathOptions:b,interactionWidth:k})=>{const[S,N,C]=vj({sourceX:e,sourceY:t,sourcePosition:i,targetX:n,targetY:s,targetPosition:a,curvature:b==null?void 0:b.curvature});return fe.createElement(El,{path:S,labelX:N,labelY:C,label:l,labelStyle:u,labelShowBg:h,labelBgStyle:p,labelBgPadding:f,labelBgBorderRadius:g,style:v,markerEnd:w,markerStart:E,interactionWidth:k})});Ru.displayName="BezierEdge";const _w=_.createContext(null),oP=_w.Provider;_w.Consumer;const iP=()=>_.useContext(_w),aP=e=>"id"in e&&"source"in e&&"target"in e,lP=({source:e,sourceHandle:t,target:n,targetHandle:s})=>`reactflow__edge-${e}${t||""}-${n}${s||""}`,Fv=(e,t)=>typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(s=>`${s}=${e[s]}`).join("&")}`,cP=(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)),uP=(e,t)=>{if(!e.source||!e.target)return t;let n;return aP(e)?n={...e}:n={...e,id:lP(e)},cP(n,t)?t:t.concat(n)},zv=({x:e,y:t},[n,s,i],a,[l,u])=>{const h={x:(e-n)/i,y:(t-s)/i};return a?{x:l*Math.round(h.x/l),y:u*Math.round(h.y/u)}:h},wj=({x:e,y:t},[n,s,i])=>({x:e*i+n,y:t*i+s}),ko=(e,t=[0,0])=>{if(!e)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const n=(e.width??0)*t[0],s=(e.height??0)*t[1],i={x:e.position.x-n,y:e.position.y-s};return{...i,positionAbsolute:e.positionAbsolute?{x:e.positionAbsolute.x-n,y:e.positionAbsolute.y-s}:i}},Wu=(e,t=[0,0])=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((s,i)=>{const{x:a,y:l}=ko(i,t).positionAbsolute;return dj(s,ml({x:a,y:l,width:i.width||0,height:i.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return fj(n)},xj=(e,t,[n,s,i]=[0,0,1],a=!1,l=!1,u=[0,0])=>{const h={x:(t.x-n)/i,y:(t.y-s)/i,width:t.width/i,height:t.height/i},p=[];return e.forEach(f=>{const{width:g,height:v,selectable:w=!0,hidden:E=!1}=f;if(l&&!w||E)return!1;const{positionAbsolute:b}=ko(f,u),k={x:b.x,y:b.y,width:g||0,height:v||0},S=Lv(h,k),N=typeof g>"u"||typeof v>"u"||g===null||v===null,C=a&&S>0,j=(g||0)*(v||0);(N||C||S>=j||f.dragging)&&p.push(f)}),p},bj=(e,t)=>{const n=e.map(s=>s.id);return t.filter(s=>n.includes(s.source)||n.includes(s.target))},kj=(e,t,n,s,i,a=.1)=>{const l=t/(e.width*(1+a)),u=n/(e.height*(1+a)),h=Math.min(l,u),p=Hi(h,s,i),f=e.x+e.width/2,g=e.y+e.height/2,v=t/2-f*p,w=n/2-g*p;return{x:v,y:w,zoom:p}},go=(e,t=0)=>e.transition().duration(t);function Mb(e,t,n,s){return(t[n]||[]).reduce((i,a)=>{var l,u;return`${e.id}-${a.id}-${n}`!==s&&i.push({id:a.id||null,type:n,nodeId:e.id,x:(((l=e.positionAbsolute)==null?void 0:l.x)??0)+a.x+a.width/2,y:(((u=e.positionAbsolute)==null?void 0:u.y)??0)+a.y+a.height/2}),i},[])}function dP(e,t,n,s,i,a){const{x:l,y:u}=Ps(e),p=t.elementsFromPoint(l,u).find(E=>E.classList.contains("react-flow__handle"));if(p){const E=p.getAttribute("data-nodeid");if(E){const b=Sw(void 0,p),k=p.getAttribute("data-handleid"),S=a({nodeId:E,id:k,type:b});if(S){const N=i.find(C=>C.nodeId===E&&C.type===b&&C.id===k);return{handle:{id:k,type:b,nodeId:E,x:(N==null?void 0:N.x)||n.x,y:(N==null?void 0:N.y)||n.y},validHandleResult:S}}}}let f=[],g=1/0;if(i.forEach(E=>{const b=Math.sqrt((E.x-n.x)**2+(E.y-n.y)**2);if(b<=s){const k=a(E);b<=g&&(b<g?f=[{handle:E,validHandleResult:k}]:b===g&&f.push({handle:E,validHandleResult:k}),g=b)}}),!f.length)return{handle:null,validHandleResult:_j()};if(f.length===1)return f[0];const v=f.some(({validHandleResult:E})=>E.isValid),w=f.some(({handle:E})=>E.type==="target");return f.find(({handle:E,validHandleResult:b})=>w?E.type==="target":v?b.isValid:!0)||f[0]}const fP={source:null,target:null,sourceHandle:null,targetHandle:null},_j=()=>({handleDomNode:null,isValid:!1,connection:fP,endHandle:null});function Sj(e,t,n,s,i,a,l){const u=i==="target",h=l.querySelector(`.react-flow__handle[data-id="${e==null?void 0:e.nodeId}-${e==null?void 0:e.id}-${e==null?void 0:e.type}"]`),p={..._j(),handleDomNode:h};if(h){const f=Sw(void 0,h),g=h.getAttribute("data-nodeid"),v=h.getAttribute("data-handleid"),w=h.classList.contains("connectable"),E=h.classList.contains("connectableend"),b={source:u?g:n,sourceHandle:u?v:s,target:u?n:g,targetHandle:u?s:v};p.connection=b,w&&E&&(t===So.Strict?u&&f==="source"||!u&&f==="target":g!==n||v!==s)&&(p.endHandle={nodeId:g,handleId:v,type:f},p.isValid=a(b))}return p}function hP({nodes:e,nodeId:t,handleId:n,handleType:s}){return e.reduce((i,a)=>{if(a[Ct]){const{handleBounds:l}=a[Ct];let u=[],h=[];l&&(u=Mb(a,l,"source",`${t}-${n}-${s}`),h=Mb(a,l,"target",`${t}-${n}-${s}`)),i.push(...u,...h)}return i},[])}function Sw(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function Qf(e){e==null||e.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function pP(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}function Nj({event:e,handleId:t,nodeId:n,onConnect:s,isTarget:i,getState:a,setState:l,isValidConnection:u,edgeUpdaterType:h,onReconnectEnd:p}){const f=uj(e.target),{connectionMode:g,domNode:v,autoPanOnConnect:w,connectionRadius:E,onConnectStart:b,panBy:k,getNodes:S,cancelConnection:N}=a();let C=0,j;const{x:M,y:P}=Ps(e),I=f==null?void 0:f.elementFromPoint(M,P),D=Sw(h,I),O=v==null?void 0:v.getBoundingClientRect();if(!O||!D)return;let A,L=Ps(e,O),z=!1,K=null,R=!1,Q=null;const H=hP({nodes:S(),nodeId:n,handleId:t,handleType:D}),ne=()=>{if(!w)return;const[ee,$]=cj(L,O);k({x:ee,y:$}),C=requestAnimationFrame(ne)};l({connectionPosition:L,connectionStatus:null,connectionNodeId:n,connectionHandleId:t,connectionHandleType:D,connectionStartHandle:{nodeId:n,handleId:t,type:D},connectionEndHandle:null}),b==null||b(e,{nodeId:n,handleId:t,handleType:D});function X(ee){const{transform:$}=a();L=Ps(ee,O);const{handle:Y,validHandleResult:de}=dP(ee,f,zv(L,$,!1,[1,1]),E,H,G=>Sj(G,g,n,t,i?"target":"source",u,f));if(j=Y,z||(ne(),z=!0),Q=de.handleDomNode,K=de.connection,R=de.isValid,l({connectionPosition:j&&R?wj({x:j.x,y:j.y},$):L,connectionStatus:pP(!!j,R),connectionEndHandle:de.endHandle}),!j&&!R&&!Q)return Qf(A);K.source!==K.target&&Q&&(Qf(A),A=Q,Q.classList.add("connecting","react-flow__handle-connecting"),Q.classList.toggle("valid",R),Q.classList.toggle("react-flow__handle-valid",R))}function W(ee){var $,Y;(j||Q)&&K&&R&&(s==null||s(K)),(Y=($=a()).onConnectEnd)==null||Y.call($,ee),h&&(p==null||p(ee)),Qf(A),N(),cancelAnimationFrame(C),z=!1,R=!1,K=null,Q=null,f.removeEventListener("mousemove",X),f.removeEventListener("mouseup",W),f.removeEventListener("touchmove",X),f.removeEventListener("touchend",W)}f.addEventListener("mousemove",X),f.addEventListener("mouseup",W),f.addEventListener("touchmove",X),f.addEventListener("touchend",W)}const Ib=()=>!0,mP=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),gP=(e,t,n)=>s=>{const{connectionStartHandle:i,connectionEndHandle:a,connectionClickStartHandle:l}=s;return{connecting:(i==null?void 0:i.nodeId)===e&&(i==null?void 0:i.handleId)===t&&(i==null?void 0:i.type)===n||(a==null?void 0:a.nodeId)===e&&(a==null?void 0:a.handleId)===t&&(a==null?void 0:a.type)===n,clickConnecting:(l==null?void 0:l.nodeId)===e&&(l==null?void 0:l.handleId)===t&&(l==null?void 0:l.type)===n}},Ej=_.forwardRef(({type:e="source",position:t=$e.Top,isValidConnection:n,isConnectable:s=!0,isConnectableStart:i=!0,isConnectableEnd:a=!0,id:l,onConnect:u,children:h,className:p,onMouseDown:f,onTouchStart:g,...v},w)=>{var O,A;const E=l||null,b=e==="target",k=Mt(),S=iP(),{connectOnClick:N,noPanClassName:C}=ut(mP,qt),{connecting:j,clickConnecting:M}=ut(gP(S,E,e),qt);S||(A=(O=k.getState()).onError)==null||A.call(O,"010",Jr.error010());const P=L=>{const{defaultEdgeOptions:z,onConnect:K,hasDefaultEdges:R}=k.getState(),Q={...z,...L};if(R){const{edges:H,setEdges:ne}=k.getState();ne(uP(Q,H))}K==null||K(Q),u==null||u(Q)},I=L=>{if(!S)return;const z=pj(L);i&&(z&&L.button===0||!z)&&Nj({event:L,handleId:E,nodeId:S,onConnect:P,isTarget:b,getState:k.getState,setState:k.setState,isValidConnection:n||k.getState().isValidConnection||Ib}),z?f==null||f(L):g==null||g(L)},D=L=>{const{onClickConnectStart:z,onClickConnectEnd:K,connectionClickStartHandle:R,connectionMode:Q,isValidConnection:H}=k.getState();if(!S||!R&&!i)return;if(!R){z==null||z(L,{nodeId:S,handleId:E,handleType:e}),k.setState({connectionClickStartHandle:{nodeId:S,type:e,handleId:E}});return}const ne=uj(L.target),X=n||H||Ib,{connection:W,isValid:ee}=Sj({nodeId:S,id:E,type:e},Q,R.nodeId,R.handleId||null,R.type,X,ne);ee&&P(W),K==null||K(L),k.setState({connectionClickStartHandle:null})};return fe.createElement("div",{"data-handleid":E,"data-nodeid":S,"data-handlepos":t,"data-id":`${S}-${E}-${e}`,className:Gt(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",C,p,{source:!b,target:b,connectable:s,connectablestart:i,connectableend:a,connecting:M,connectionindicator:s&&(i&&!j||a&&j)}]),onMouseDown:I,onTouchStart:I,onClick:N?D:void 0,ref:w,...v},h)});Ej.displayName="Handle";var Gi=_.memo(Ej);const Cj=({data:e,isConnectable:t,targetPosition:n=$e.Top,sourcePosition:s=$e.Bottom})=>fe.createElement(fe.Fragment,null,fe.createElement(Gi,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,fe.createElement(Gi,{type:"source",position:s,isConnectable:t}));Cj.displayName="DefaultNode";var Bv=_.memo(Cj);const jj=({data:e,isConnectable:t,sourcePosition:n=$e.Bottom})=>fe.createElement(fe.Fragment,null,e==null?void 0:e.label,fe.createElement(Gi,{type:"source",position:n,isConnectable:t}));jj.displayName="InputNode";var Tj=_.memo(jj);const Rj=({data:e,isConnectable:t,targetPosition:n=$e.Top})=>fe.createElement(fe.Fragment,null,fe.createElement(Gi,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label);Rj.displayName="OutputNode";var Aj=_.memo(Rj);const Nw=()=>null;Nw.displayName="GroupNode";const yP=e=>({selectedNodes:e.getNodes().filter(t=>t.selected),selectedEdges:e.edges.filter(t=>t.selected).map(t=>({...t}))}),ru=e=>e.id;function vP(e,t){return qt(e.selectedNodes.map(ru),t.selectedNodes.map(ru))&&qt(e.selectedEdges.map(ru),t.selectedEdges.map(ru))}const Mj=_.memo(({onSelectionChange:e})=>{const t=Mt(),{selectedNodes:n,selectedEdges:s}=ut(yP,vP);return _.useEffect(()=>{const i={nodes:n,edges:s};e==null||e(i),t.getState().onSelectionChange.forEach(a=>a(i))},[n,s,e]),null});Mj.displayName="SelectionListener";const wP=e=>!!e.onSelectionChange;function xP({onSelectionChange:e}){const t=ut(wP);return e||t?fe.createElement(Mj,{onSelectionChange:e}):null}const bP=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 Ei(e,t){_.useEffect(()=>{typeof e<"u"&&t(e)},[e])}function Qe(e,t,n){_.useEffect(()=>{typeof t<"u"&&n({[e]:t})},[t])}const kP=({nodes:e,edges:t,defaultNodes:n,defaultEdges:s,onConnect:i,onConnectStart:a,onConnectEnd:l,onClickConnectStart:u,onClickConnectEnd:h,nodesDraggable:p,nodesConnectable:f,nodesFocusable:g,edgesFocusable:v,edgesUpdatable:w,elevateNodesOnSelect:E,minZoom:b,maxZoom:k,nodeExtent:S,onNodesChange:N,onEdgesChange:C,elementsSelectable:j,connectionMode:M,snapGrid:P,snapToGrid:I,translateExtent:D,connectOnClick:O,defaultEdgeOptions:A,fitView:L,fitViewOptions:z,onNodesDelete:K,onEdgesDelete:R,onNodeDrag:Q,onNodeDragStart:H,onNodeDragStop:ne,onSelectionDrag:X,onSelectionDragStart:W,onSelectionDragStop:ee,noPanClassName:$,nodeOrigin:Y,rfId:de,autoPanOnConnect:G,autoPanOnNodeDrag:F,onError:J,connectionRadius:V,isValidConnection:ae,nodeDragThreshold:pe})=>{const{setNodes:me,setEdges:ke,setDefaultNodesAndEdges:Ve,setMinZoom:ze,setMaxZoom:Oe,setTranslateExtent:Ne,setNodeExtent:ce,reset:be}=ut(bP,qt),xe=Mt();return _.useEffect(()=>{const he=s==null?void 0:s.map(Pe=>({...Pe,...A}));return Ve(n,he),()=>{be()}},[]),Qe("defaultEdgeOptions",A,xe.setState),Qe("connectionMode",M,xe.setState),Qe("onConnect",i,xe.setState),Qe("onConnectStart",a,xe.setState),Qe("onConnectEnd",l,xe.setState),Qe("onClickConnectStart",u,xe.setState),Qe("onClickConnectEnd",h,xe.setState),Qe("nodesDraggable",p,xe.setState),Qe("nodesConnectable",f,xe.setState),Qe("nodesFocusable",g,xe.setState),Qe("edgesFocusable",v,xe.setState),Qe("edgesUpdatable",w,xe.setState),Qe("elementsSelectable",j,xe.setState),Qe("elevateNodesOnSelect",E,xe.setState),Qe("snapToGrid",I,xe.setState),Qe("snapGrid",P,xe.setState),Qe("onNodesChange",N,xe.setState),Qe("onEdgesChange",C,xe.setState),Qe("connectOnClick",O,xe.setState),Qe("fitViewOnInit",L,xe.setState),Qe("fitViewOnInitOptions",z,xe.setState),Qe("onNodesDelete",K,xe.setState),Qe("onEdgesDelete",R,xe.setState),Qe("onNodeDrag",Q,xe.setState),Qe("onNodeDragStart",H,xe.setState),Qe("onNodeDragStop",ne,xe.setState),Qe("onSelectionDrag",X,xe.setState),Qe("onSelectionDragStart",W,xe.setState),Qe("onSelectionDragStop",ee,xe.setState),Qe("noPanClassName",$,xe.setState),Qe("nodeOrigin",Y,xe.setState),Qe("rfId",de,xe.setState),Qe("autoPanOnConnect",G,xe.setState),Qe("autoPanOnNodeDrag",F,xe.setState),Qe("onError",J,xe.setState),Qe("connectionRadius",V,xe.setState),Qe("isValidConnection",ae,xe.setState),Qe("nodeDragThreshold",pe,xe.setState),Ei(e,me),Ei(t,ke),Ei(b,ze),Ei(k,Oe),Ei(D,Ne),Ei(S,ce),null},Ob={display:"none"},_P={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Ij="react-flow__node-desc",Oj="react-flow__edge-desc",SP="react-flow__aria-live",NP=e=>e.ariaLiveMessage;function EP({rfId:e}){const t=ut(NP);return fe.createElement("div",{id:`${SP}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:_P},t)}function CP({rfId:e,disableKeyboardA11y:t}){return fe.createElement(fe.Fragment,null,fe.createElement("div",{id:`${Ij}-${e}`,style:Ob},"Press enter or space to select a node.",!t&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "),fe.createElement("div",{id:`${Oj}-${e}`,style:Ob},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!t&&fe.createElement(EP,{rfId:e}))}var yl=(e=null,t={actInsideInputWithModifier:!0})=>{const[n,s]=_.useState(!1),i=_.useRef(!1),a=_.useRef(new Set([])),[l,u]=_.useMemo(()=>{if(e!==null){const p=(Array.isArray(e)?e:[e]).filter(g=>typeof g=="string").map(g=>g.split("+")),f=p.reduce((g,v)=>g.concat(...v),[]);return[p,f]}return[[],[]]},[e]);return _.useEffect(()=>{const h=typeof document<"u"?document:null,p=(t==null?void 0:t.target)||h;if(e!==null){const f=w=>{if(i.current=w.ctrlKey||w.metaKey||w.shiftKey,(!i.current||i.current&&!t.actInsideInputWithModifier)&&qv(w))return!1;const b=$b(w.code,u);a.current.add(w[b]),Pb(l,a.current,!1)&&(w.preventDefault(),s(!0))},g=w=>{if((!i.current||i.current&&!t.actInsideInputWithModifier)&&qv(w))return!1;const b=$b(w.code,u);Pb(l,a.current,!0)?(s(!1),a.current.clear()):a.current.delete(w[b]),w.key==="Meta"&&a.current.clear(),i.current=!1},v=()=>{a.current.clear(),s(!1)};return p==null||p.addEventListener("keydown",f),p==null||p.addEventListener("keyup",g),window.addEventListener("blur",v),()=>{p==null||p.removeEventListener("keydown",f),p==null||p.removeEventListener("keyup",g),window.removeEventListener("blur",v)}}},[e,s]),n};function Pb(e,t,n){return e.filter(s=>n||s.length===t.size).some(s=>s.every(i=>t.has(i)))}function $b(e,t){return t.includes(e)?"code":"key"}function Pj(e,t,n,s){var u,h;const i=e.parentNode||e.parentId;if(!i)return n;const a=t.get(i),l=ko(a,s);return Pj(a,t,{x:(n.x??0)+l.x,y:(n.y??0)+l.y,z:(((u=a[Ct])==null?void 0:u.z)??0)>(n.z??0)?((h=a[Ct])==null?void 0:h.z)??0:n.z??0},s)}function $j(e,t,n){e.forEach(s=>{var a;const i=s.parentNode||s.parentId;if(i&&!e.has(i))throw new Error(`Parent node ${i} not found`);if(i||n!=null&&n[s.id]){const{x:l,y:u,z:h}=Pj(s,e,{...s.position,z:((a=s[Ct])==null?void 0:a.z)??0},t);s.positionAbsolute={x:l,y:u},s[Ct].z=h,n!=null&&n[s.id]&&(s[Ct].isParent=!0)}})}function Zf(e,t,n,s){const i=new Map,a={},l=s?1e3:0;return e.forEach(u=>{var w;const h=(qn(u.zIndex)?u.zIndex:0)+(u.selected?l:0),p=t.get(u.id),f={...u,positionAbsolute:{x:u.position.x,y:u.position.y}},g=u.parentNode||u.parentId;g&&(a[g]=!0);const v=(p==null?void 0:p.type)&&(p==null?void 0:p.type)!==u.type;Object.defineProperty(f,Ct,{enumerable:!1,value:{handleBounds:v||(w=p==null?void 0:p[Ct])==null?void 0:w.handleBounds,z:h}}),i.set(u.id,f)}),$j(i,n,a),i}function Lj(e,t={}){const{getNodes:n,width:s,height:i,minZoom:a,maxZoom:l,d3Zoom:u,d3Selection:h,fitViewOnInitDone:p,fitViewOnInit:f,nodeOrigin:g}=e(),v=t.initial&&!p&&f;if(u&&h&&(v||!t.initial)){const E=n().filter(k=>{var N;const S=t.includeHiddenNodes?k.width&&k.height:!k.hidden;return(N=t.nodes)!=null&&N.length?S&&t.nodes.some(C=>C.id===k.id):S}),b=E.every(k=>k.width&&k.height);if(E.length>0&&b){const k=Wu(E,g),{x:S,y:N,zoom:C}=kj(k,s,i,t.minZoom??a,t.maxZoom??l,t.padding??.1),j=Qr.translate(S,N).scale(C);return typeof t.duration=="number"&&t.duration>0?u.transform(go(h,t.duration),j):u.transform(h,j),!0}}return!1}function jP(e,t){return e.forEach(n=>{const s=t.get(n.id);s&&t.set(s.id,{...s,[Ct]:s[Ct],selected:n.selected})}),new Map(t)}function TP(e,t){return t.map(n=>{const s=e.find(i=>i.id===n.id);return s&&(n.selected=s.selected),n})}function su({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:jP(e,i)}),l==null||l(e)),t!=null&&t.length&&(p&&s({edges:TP(t,a)}),u==null||u(t))}const Ci=()=>{},RP={zoomIn:Ci,zoomOut:Ci,zoomTo:Ci,getZoom:()=>1,setViewport:Ci,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:Ci,fitBounds:Ci,project:e=>e,screenToFlowPosition:e=>e,flowToScreenPosition:e=>e,viewportInitialized:!1},AP=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),MP=()=>{const e=Mt(),{d3Zoom:t,d3Selection:n}=ut(AP,qt);return _.useMemo(()=>n&&t?{zoomIn:i=>t.scaleBy(go(n,i==null?void 0:i.duration),1.2),zoomOut:i=>t.scaleBy(go(n,i==null?void 0:i.duration),1/1.2),zoomTo:(i,a)=>t.scaleTo(go(n,a==null?void 0:a.duration),i),getZoom:()=>e.getState().transform[2],setViewport:(i,a)=>{const[l,u,h]=e.getState().transform,p=Qr.translate(i.x??l,i.y??u).scale(i.zoom??h);t.transform(go(n,a==null?void 0:a.duration),p)},getViewport:()=>{const[i,a,l]=e.getState().transform;return{x:i,y:a,zoom:l}},fitView:i=>Lj(e.getState,i),setCenter:(i,a,l)=>{const{width:u,height:h,maxZoom:p}=e.getState(),f=typeof(l==null?void 0:l.zoom)<"u"?l.zoom:p,g=u/2-i*f,v=h/2-a*f,w=Qr.translate(g,v).scale(f);t.transform(go(n,l==null?void 0:l.duration),w)},fitBounds:(i,a)=>{const{width:l,height:u,minZoom:h,maxZoom:p}=e.getState(),{x:f,y:g,zoom:v}=kj(i,l,u,h,p,(a==null?void 0:a.padding)??.1),w=Qr.translate(f,g).scale(v);t.transform(go(n,a==null?void 0:a.duration),w)},project:i=>{const{transform:a,snapToGrid:l,snapGrid:u}=e.getState();return console.warn("[DEPRECATED] `project` is deprecated. Instead use `screenToFlowPosition`. There is no need to subtract the react flow bounds anymore! https://reactflow.dev/api-reference/types/react-flow-instance#screen-to-flow-position"),zv(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 zv(g,a,l,u)},flowToScreenPosition:i=>{const{transform:a,domNode:l}=e.getState();if(!l)return i;const{x:u,y:h}=l.getBoundingClientRect(),p=wj(i,a);return{x:p.x+u,y:p.y+h}},viewportInitialized:!0}:RP,[t,n])};function Cl(){const e=MP(),t=Mt(),n=_.useCallback(()=>t.getState().getNodes().map(b=>({...b})),[]),s=_.useCallback(b=>t.getState().nodeInternals.get(b),[]),i=_.useCallback(()=>{const{edges:b=[]}=t.getState();return b.map(k=>({...k}))},[]),a=_.useCallback(b=>{const{edges:k=[]}=t.getState();return k.find(S=>S.id===b)},[]),l=_.useCallback(b=>{const{getNodes:k,setNodes:S,hasDefaultNodes:N,onNodesChange:C}=t.getState(),j=k(),M=typeof b=="function"?b(j):b;if(N)S(M);else if(C){const P=M.length===0?j.map(I=>({type:"remove",id:I.id})):M.map(I=>({item:I,type:"reset"}));C(P)}},[]),u=_.useCallback(b=>{const{edges:k=[],setEdges:S,hasDefaultEdges:N,onEdgesChange:C}=t.getState(),j=typeof b=="function"?b(k):b;if(N)S(j);else if(C){const M=j.length===0?k.map(P=>({type:"remove",id:P.id})):j.map(P=>({item:P,type:"reset"}));C(M)}},[]),h=_.useCallback(b=>{const k=Array.isArray(b)?b:[b],{getNodes:S,setNodes:N,hasDefaultNodes:C,onNodesChange:j}=t.getState();if(C){const P=[...S(),...k];N(P)}else if(j){const M=k.map(P=>({item:P,type:"add"}));j(M)}},[]),p=_.useCallback(b=>{const k=Array.isArray(b)?b:[b],{edges:S=[],setEdges:N,hasDefaultEdges:C,onEdgesChange:j}=t.getState();if(C)N([...S,...k]);else if(j){const M=k.map(P=>({item:P,type:"add"}));j(M)}},[]),f=_.useCallback(()=>{const{getNodes:b,edges:k=[],transform:S}=t.getState(),[N,C,j]=S;return{nodes:b().map(M=>({...M})),edges:k.map(M=>({...M})),viewport:{x:N,y:C,zoom:j}}},[]),g=_.useCallback(({nodes:b,edges:k})=>{const{nodeInternals:S,getNodes:N,edges:C,hasDefaultNodes:j,hasDefaultEdges:M,onNodesDelete:P,onEdgesDelete:I,onNodesChange:D,onEdgesChange:O}=t.getState(),A=(b||[]).map(Q=>Q.id),L=(k||[]).map(Q=>Q.id),z=N().reduce((Q,H)=>{const ne=H.parentNode||H.parentId,X=!A.includes(H.id)&&ne&&Q.find(ee=>ee.id===ne);return(typeof H.deletable=="boolean"?H.deletable:!0)&&(A.includes(H.id)||X)&&Q.push(H),Q},[]),K=C.filter(Q=>typeof Q.deletable=="boolean"?Q.deletable:!0),R=K.filter(Q=>L.includes(Q.id));if(z||R){const Q=bj(z,K),H=[...R,...Q],ne=H.reduce((X,W)=>(X.includes(W.id)||X.push(W.id),X),[]);if((M||j)&&(M&&t.setState({edges:C.filter(X=>!ne.includes(X.id))}),j&&(z.forEach(X=>{S.delete(X.id)}),t.setState({nodeInternals:new Map(S)}))),ne.length>0&&(I==null||I(H),O&&O(ne.map(X=>({id:X,type:"remove"})))),z.length>0&&(P==null||P(z),D)){const X=z.map(W=>({id:W.id,type:"remove"}));D(X)}}},[]),v=_.useCallback(b=>{const k=ZO(b),S=k?null:t.getState().nodeInternals.get(b.id);return!k&&!S?[null,null,k]:[k?b:Cb(S),S,k]},[]),w=_.useCallback((b,k=!0,S)=>{const[N,C,j]=v(b);return N?(S||t.getState().getNodes()).filter(M=>{if(!j&&(M.id===C.id||!M.positionAbsolute))return!1;const P=Cb(M),I=Lv(P,N);return k&&I>0||I>=N.width*N.height}):[]},[]),E=_.useCallback((b,k,S=!0)=>{const[N]=v(b);if(!N)return!1;const C=Lv(N,k);return S&&C>0||C>=N.width*N.height},[]);return _.useMemo(()=>({...e,getNodes:n,getNode:s,getEdges:i,getEdge:a,setNodes:l,setEdges:u,addNodes:h,addEdges:p,toObject:f,deleteElements:g,getIntersectingNodes:w,isNodeIntersecting:E}),[e,n,s,i,a,l,u,h,p,f,g,w,E])}const IP={actInsideInputWithModifier:!1};var OP=({deleteKeyCode:e,multiSelectionKeyCode:t})=>{const n=Mt(),{deleteElements:s}=Cl(),i=yl(e,IP),a=yl(t);_.useEffect(()=>{if(i){const{edges:l,getNodes:u}=n.getState(),h=u().filter(f=>f.selected),p=l.filter(f=>f.selected);s({nodes:h,edges:p}),n.setState({nodesSelectionActive:!1})}},[i]),_.useEffect(()=>{n.setState({multiSelectionActive:a})},[a])};function PP(e){const t=Mt();_.useEffect(()=>{let n;const s=()=>{var a,l;if(!e.current)return;const i=vw(e.current);(i.height===0||i.width===0)&&((l=(a=t.getState()).onError)==null||l.call(a,"004",Jr.error004())),t.setState({width:i.width||500,height:i.height||500})};return s(),window.addEventListener("resize",s),e.current&&(n=new ResizeObserver(()=>s()),n.observe(e.current)),()=>{window.removeEventListener("resize",s),n&&e.current&&n.unobserve(e.current)}},[])}const Ew={position:"absolute",width:"100%",height:"100%",top:0,left:0},$P=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,ou=e=>({x:e.x,y:e.y,zoom:e.k}),ji=(e,t)=>e.target.closest(`.${t}`),Lb=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),qb=e=>{const t=e.ctrlKey&&ju()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t},LP=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),qP=({onMove:e,onMoveStart:t,onMoveEnd:n,onPaneContextMenu:s,zoomOnScroll:i=!0,zoomOnPinch:a=!0,panOnScroll:l=!1,panOnScrollSpeed:u=.5,panOnScrollMode:h=xo.Free,zoomOnDoubleClick:p=!0,elementsSelectable:f,panOnDrag:g=!0,defaultViewport:v,translateExtent:w,minZoom:E,maxZoom:b,zoomActivationKeyCode:k,preventScrolling:S=!0,children:N,noWheelClassName:C,noPanClassName:j})=>{const M=_.useRef(),P=Mt(),I=_.useRef(!1),D=_.useRef(!1),O=_.useRef(null),A=_.useRef({x:0,y:0,zoom:0}),{d3Zoom:L,d3Selection:z,d3ZoomHandler:K,userSelectionActive:R}=ut(LP,qt),Q=yl(k),H=_.useRef(0),ne=_.useRef(!1),X=_.useRef();return PP(O),_.useEffect(()=>{if(O.current){const W=O.current.getBoundingClientRect(),ee=aj().scaleExtent([E,b]).translateExtent(w),$=Ln(O.current).call(ee),Y=Qr.translate(v.x,v.y).scale(Hi(v.zoom,E,b)),de=[[0,0],[W.width,W.height]],G=ee.constrain()(Y,de,w);ee.transform($,G),ee.wheelDelta(qb),P.setState({d3Zoom:ee,d3Selection:$,d3ZoomHandler:$.on("wheel.zoom"),transform:[G.x,G.y,G.k],domNode:O.current.closest(".react-flow")})}},[]),_.useEffect(()=>{z&&L&&(l&&!Q&&!R?z.on("wheel.zoom",W=>{if(ji(W,C))return!1;W.preventDefault(),W.stopImmediatePropagation();const ee=z.property("__zoom").k||1;if(W.ctrlKey&&a){const ae=or(W),pe=qb(W),me=ee*Math.pow(2,pe);L.scaleTo(z,me,ae,W);return}const $=W.deltaMode===1?20:1;let Y=h===xo.Vertical?0:W.deltaX*$,de=h===xo.Horizontal?0:W.deltaY*$;!ju()&&W.shiftKey&&h!==xo.Vertical&&(Y=W.deltaY*$,de=0),L.translateBy(z,-(Y/ee)*u,-(de/ee)*u,{internal:!0});const G=ou(z.property("__zoom")),{onViewportChangeStart:F,onViewportChange:J,onViewportChangeEnd:V}=P.getState();clearTimeout(X.current),ne.current||(ne.current=!0,t==null||t(W,G),F==null||F(G)),ne.current&&(e==null||e(W,G),J==null||J(G),X.current=setTimeout(()=>{n==null||n(W,G),V==null||V(G),ne.current=!1},150))},{passive:!1}):typeof K<"u"&&z.on("wheel.zoom",function(W,ee){if(!S&&W.type==="wheel"&&!W.ctrlKey||ji(W,C))return null;W.preventDefault(),K.call(this,W,ee)},{passive:!1}))},[R,l,h,z,L,K,Q,a,S,C,t,e,n]),_.useEffect(()=>{L&&L.on("start",W=>{var Y,de;if(!W.sourceEvent||W.sourceEvent.internal)return null;H.current=(Y=W.sourceEvent)==null?void 0:Y.button;const{onViewportChangeStart:ee}=P.getState(),$=ou(W.transform);I.current=!0,A.current=$,((de=W.sourceEvent)==null?void 0:de.type)==="mousedown"&&P.setState({paneDragging:!0}),ee==null||ee($),t==null||t(W.sourceEvent,$)})},[L,t]),_.useEffect(()=>{L&&(R&&!I.current?L.on("zoom",null):R||L.on("zoom",W=>{var $;const{onViewportChange:ee}=P.getState();if(P.setState({transform:[W.transform.x,W.transform.y,W.transform.k]}),D.current=!!(s&&Lb(g,H.current??0)),(e||ee)&&!(($=W.sourceEvent)!=null&&$.internal)){const Y=ou(W.transform);ee==null||ee(Y),e==null||e(W.sourceEvent,Y)}}))},[R,L,e,g,s]),_.useEffect(()=>{L&&L.on("end",W=>{if(!W.sourceEvent||W.sourceEvent.internal)return null;const{onViewportChangeEnd:ee}=P.getState();if(I.current=!1,P.setState({paneDragging:!1}),s&&Lb(g,H.current??0)&&!D.current&&s(W.sourceEvent),D.current=!1,(n||ee)&&$P(A.current,W.transform)){const $=ou(W.transform);A.current=$,clearTimeout(M.current),M.current=setTimeout(()=>{ee==null||ee($),n==null||n(W.sourceEvent,$)},l?150:0)}})},[L,l,g,n,s]),_.useEffect(()=>{L&&L.filter(W=>{const ee=Q||i,$=a&&W.ctrlKey;if((g===!0||Array.isArray(g)&&g.includes(1))&&W.button===1&&W.type==="mousedown"&&(ji(W,"react-flow__node")||ji(W,"react-flow__edge")))return!0;if(!g&&!ee&&!l&&!p&&!a||R||!p&&W.type==="dblclick"||ji(W,C)&&W.type==="wheel"||ji(W,j)&&(W.type!=="wheel"||l&&W.type==="wheel"&&!Q)||!a&&W.ctrlKey&&W.type==="wheel"||!ee&&!l&&!$&&W.type==="wheel"||!g&&(W.type==="mousedown"||W.type==="touchstart")||Array.isArray(g)&&!g.includes(W.button)&&W.type==="mousedown")return!1;const Y=Array.isArray(g)&&g.includes(W.button)||!W.button||W.button<=1;return(!W.ctrlKey||W.type==="wheel")&&Y})},[R,L,i,a,l,p,g,f,Q]),fe.createElement("div",{className:"react-flow__renderer",ref:O,style:Ew},N)},DP=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function FP(){const{userSelectionActive:e,userSelectionRect:t}=ut(DP,qt);return e&&t?fe.createElement("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}function Db(e,t){const n=t.parentNode||t.parentId,s=e.find(i=>i.id===n);if(s){const i=t.position.x+t.width-s.width,a=t.position.y+t.height-s.height;if(i>0||a>0||t.position.x<0||t.position.y<0){if(s.style={...s.style},s.style.width=s.style.width??s.width,s.style.height=s.style.height??s.height,i>0&&(s.style.width+=i),a>0&&(s.style.height+=a),t.position.x<0){const l=Math.abs(t.position.x);s.position.x=s.position.x-l,s.style.width+=l,t.position.x=0}if(t.position.y<0){const l=Math.abs(t.position.y);s.position.y=s.position.y-l,s.style.height+=l,t.position.y=0}s.width=s.style.width,s.height=s.style.height}}}function zP(e,t){if(e.some(s=>s.type==="reset"))return e.filter(s=>s.type==="reset").map(s=>s.item);const n=e.filter(s=>s.type==="add").map(s=>s.item);return t.reduce((s,i)=>{const a=e.filter(u=>u.id===i.id);if(a.length===0)return s.push(i),s;const l={...i};for(const u of a)if(u)switch(u.type){case"select":{l.selected=u.selected;break}case"position":{typeof u.position<"u"&&(l.position=u.position),typeof u.positionAbsolute<"u"&&(l.positionAbsolute=u.positionAbsolute),typeof u.dragging<"u"&&(l.dragging=u.dragging),l.expandParent&&Db(s,l);break}case"dimensions":{typeof u.dimensions<"u"&&(l.width=u.dimensions.width,l.height=u.dimensions.height),typeof u.updateStyle<"u"&&(l.style={...l.style||{},...u.dimensions}),typeof u.resizing=="boolean"&&(l.resizing=u.resizing),l.expandParent&&Db(s,l);break}case"remove":return s}return s.push(l),s},n)}function BP(e,t){return zP(e,t)}const Is=(e,t)=>({id:e,type:"select",selected:t});function Oi(e,t){return e.reduce((n,s)=>{const i=t.includes(s.id);return!s.selected&&i?(s.selected=!0,n.push(Is(s.id,!0))):s.selected&&!i&&(s.selected=!1,n.push(Is(s.id,!1))),n},[])}const Jf=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},UP=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),qj=_.memo(({isSelecting:e,selectionMode:t=gl.Full,panOnDrag:n,onSelectionStart:s,onSelectionEnd:i,onPaneClick:a,onPaneContextMenu:l,onPaneScroll:u,onPaneMouseEnter:h,onPaneMouseMove:p,onPaneMouseLeave:f,children:g})=>{const v=_.useRef(null),w=Mt(),E=_.useRef(0),b=_.useRef(0),k=_.useRef(),{userSelectionActive:S,elementsSelectable:N,dragging:C}=ut(UP,qt),j=()=>{w.setState({userSelectionActive:!1,userSelectionRect:null}),E.current=0,b.current=0},M=K=>{a==null||a(K),w.getState().resetSelectedElements(),w.setState({nodesSelectionActive:!1})},P=K=>{if(Array.isArray(n)&&(n!=null&&n.includes(2))){K.preventDefault();return}l==null||l(K)},I=u?K=>u(K):void 0,D=K=>{const{resetSelectedElements:R,domNode:Q}=w.getState();if(k.current=Q==null?void 0:Q.getBoundingClientRect(),!N||!e||K.button!==0||K.target!==v.current||!k.current)return;const{x:H,y:ne}=Ps(K,k.current);R(),w.setState({userSelectionRect:{width:0,height:0,startX:H,startY:ne,x:H,y:ne}}),s==null||s(K)},O=K=>{const{userSelectionRect:R,nodeInternals:Q,edges:H,transform:ne,onNodesChange:X,onEdgesChange:W,nodeOrigin:ee,getNodes:$}=w.getState();if(!e||!k.current||!R)return;w.setState({userSelectionActive:!0,nodesSelectionActive:!1});const Y=Ps(K,k.current),de=R.startX??0,G=R.startY??0,F={...R,x:Y.x<de?Y.x:de,y:Y.y<G?Y.y:G,width:Math.abs(Y.x-de),height:Math.abs(Y.y-G)},J=$(),V=xj(Q,F,ne,t===gl.Partial,!0,ee),ae=bj(V,H).map(me=>me.id),pe=V.map(me=>me.id);if(E.current!==pe.length){E.current=pe.length;const me=Oi(J,pe);me.length&&(X==null||X(me))}if(b.current!==ae.length){b.current=ae.length;const me=Oi(H,ae);me.length&&(W==null||W(me))}w.setState({userSelectionRect:F})},A=K=>{if(K.button!==0)return;const{userSelectionRect:R}=w.getState();!S&&R&&K.target===v.current&&(M==null||M(K)),w.setState({nodesSelectionActive:E.current>0}),j(),i==null||i(K)},L=K=>{S&&(w.setState({nodesSelectionActive:E.current>0}),i==null||i(K)),j()},z=N&&(e||S);return fe.createElement("div",{className:Gt(["react-flow__pane",{dragging:C,selection:e}]),onClick:z?void 0:Jf(M,v),onContextMenu:Jf(P,v),onWheel:Jf(I,v),onMouseEnter:z?void 0:h,onMouseDown:z?D:void 0,onMouseMove:z?O:p,onMouseUp:z?A:void 0,onMouseLeave:z?L:f,ref:v,style:Ew},g,fe.createElement(FP,null))});qj.displayName="Pane";function Dj(e,t){const n=e.parentNode||e.parentId;if(!n)return!1;const s=t.get(n);return s?s.selected?!0:Dj(s,t):!1}function Fb(e,t,n){let s=e;do{if(s!=null&&s.matches(t))return!0;if(s===n.current)return!1;s=s.parentElement}while(s);return!1}function WP(e,t,n,s){return Array.from(e.values()).filter(i=>(i.selected||i.id===s)&&(!i.parentNode||i.parentId||!Dj(i,e))&&(i.draggable||t&&typeof i.draggable>"u")).map(i=>{var a,l;return{id:i.id,position:i.position||{x:0,y:0},positionAbsolute:i.positionAbsolute||{x:0,y:0},distance:{x:n.x-(((a=i.positionAbsolute)==null?void 0:a.x)??0),y:n.y-(((l=i.positionAbsolute)==null?void 0:l.y)??0)},delta:{x:0,y:0},extent:i.extent,parentNode:i.parentNode||i.parentId,parentId:i.parentNode||i.parentId,width:i.width,height:i.height,expandParent:i.expandParent}})}function HP(e,t){return!t||t==="parent"?t:[t[0],[t[1][0]-(e.width||0),t[1][1]-(e.height||0)]]}function Fj(e,t,n,s,i=[0,0],a){const l=HP(e,e.extent||s);let u=l;const h=e.parentNode||e.parentId;if(e.extent==="parent"&&!e.expandParent)if(h&&e.width&&e.height){const g=n.get(h),{x:v,y:w}=ko(g,i).positionAbsolute;u=g&&qn(v)&&qn(w)&&qn(g.width)&&qn(g.height)?[[v+e.width*i[0],w+e.height*i[1]],[v+g.width-e.width+e.width*i[0],w+g.height-e.height+e.height*i[1]]]:u}else a==null||a("005",Jr.error005()),u=l;else if(e.extent&&h&&e.extent!=="parent"){const g=n.get(h),{x:v,y:w}=ko(g,i).positionAbsolute;u=[[e.extent[0][0]+v,e.extent[0][1]+w],[e.extent[1][0]+v,e.extent[1][1]+w]]}let p={x:0,y:0};if(h){const g=n.get(h);p=ko(g,i).positionAbsolute}const f=u&&u!=="parent"?ww(t,u):t;return{position:{x:f.x-p.x,y:f.y-p.y},positionAbsolute:f}}function eh({nodeId:e,dragItems:t,nodeInternals:n}){const s=t.map(i=>({...n.get(i.id),position:i.position,positionAbsolute:i.positionAbsolute}));return[e?s.find(i=>i.id===e):s[0],s]}const zb=(e,t,n,s)=>{const i=t.querySelectorAll(e);if(!i||!i.length)return null;const a=Array.from(i),l=t.getBoundingClientRect(),u={x:l.width*s[0],y:l.height*s[1]};return a.map(h=>{const p=h.getBoundingClientRect();return{id:h.getAttribute("data-handleid"),position:h.getAttribute("data-handlepos"),x:(p.left-l.left-u.x)/n,y:(p.top-l.top-u.y)/n,...vw(h)}})};function Qa(e,t,n){return n===void 0?n:s=>{const i=t().nodeInternals.get(e);i&&n(s,{...i})}}function Uv({id:e,store:t,unselect:n=!1,nodeRef:s}){const{addSelectedNodes:i,unselectNodesAndEdges:a,multiSelectionActive:l,nodeInternals:u,onError:h}=t.getState(),p=u.get(e);if(!p){h==null||h("012",Jr.error012(e));return}t.setState({nodesSelectionActive:!1}),p.selected?(n||p.selected&&l)&&(a({nodes:[p],edges:[]}),requestAnimationFrame(()=>{var f;return(f=s==null?void 0:s.current)==null?void 0:f.blur()})):i([e])}function GP(){const e=Mt();return _.useCallback(({sourceEvent:n})=>{const{transform:s,snapGrid:i,snapToGrid:a}=e.getState(),l=n.touches?n.touches[0].clientX:n.clientX,u=n.touches?n.touches[0].clientY:n.clientY,h={x:(l-s[0])/s[2],y:(u-s[1])/s[2]};return{xSnapped:a?i[0]*Math.round(h.x/i[0]):h.x,ySnapped:a?i[1]*Math.round(h.y/i[1]):h.y,...h}},[])}function th(e){return(t,n,s)=>e==null?void 0:e(t,s)}function zj({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:s,nodeId:i,isSelectable:a,selectNodesOnDrag:l}){const u=Mt(),[h,p]=_.useState(!1),f=_.useRef([]),g=_.useRef({x:null,y:null}),v=_.useRef(0),w=_.useRef(null),E=_.useRef({x:0,y:0}),b=_.useRef(null),k=_.useRef(!1),S=_.useRef(!1),N=_.useRef(!1),C=GP();return _.useEffect(()=>{if(e!=null&&e.current){const j=Ln(e.current),M=({x:D,y:O})=>{const{nodeInternals:A,onNodeDrag:L,onSelectionDrag:z,updateNodePositions:K,nodeExtent:R,snapGrid:Q,snapToGrid:H,nodeOrigin:ne,onError:X}=u.getState();g.current={x:D,y:O};let W=!1,ee={x:0,y:0,x2:0,y2:0};if(f.current.length>1&&R){const Y=Wu(f.current,ne);ee=ml(Y)}if(f.current=f.current.map(Y=>{const de={x:D-Y.distance.x,y:O-Y.distance.y};H&&(de.x=Q[0]*Math.round(de.x/Q[0]),de.y=Q[1]*Math.round(de.y/Q[1]));const G=[[R[0][0],R[0][1]],[R[1][0],R[1][1]]];f.current.length>1&&R&&!Y.extent&&(G[0][0]=Y.positionAbsolute.x-ee.x+R[0][0],G[1][0]=Y.positionAbsolute.x+(Y.width??0)-ee.x2+R[1][0],G[0][1]=Y.positionAbsolute.y-ee.y+R[0][1],G[1][1]=Y.positionAbsolute.y+(Y.height??0)-ee.y2+R[1][1]);const F=Fj(Y,de,A,G,ne,X);return W=W||Y.position.x!==F.position.x||Y.position.y!==F.position.y,Y.position=F.position,Y.positionAbsolute=F.positionAbsolute,Y}),!W)return;K(f.current,!0,!0),p(!0);const $=i?L:th(z);if($&&b.current){const[Y,de]=eh({nodeId:i,dragItems:f.current,nodeInternals:A});$(b.current,Y,de)}},P=()=>{if(!w.current)return;const[D,O]=cj(E.current,w.current);if(D!==0||O!==0){const{transform:A,panBy:L}=u.getState();g.current.x=(g.current.x??0)-D/A[2],g.current.y=(g.current.y??0)-O/A[2],L({x:D,y:O})&&M(g.current)}v.current=requestAnimationFrame(P)},I=D=>{var ne;const{nodeInternals:O,multiSelectionActive:A,nodesDraggable:L,unselectNodesAndEdges:z,onNodeDragStart:K,onSelectionDragStart:R}=u.getState();S.current=!0;const Q=i?K:th(R);(!l||!a)&&!A&&i&&((ne=O.get(i))!=null&&ne.selected||z()),i&&a&&l&&Uv({id:i,store:u,nodeRef:e});const H=C(D);if(g.current=H,f.current=WP(O,L,H,i),Q&&f.current){const[X,W]=eh({nodeId:i,dragItems:f.current,nodeInternals:O});Q(D.sourceEvent,X,W)}};if(t)j.on(".drag",null);else{const D=nI().on("start",O=>{const{domNode:A,nodeDragThreshold:L}=u.getState();L===0&&I(O),N.current=!1;const z=C(O);g.current=z,w.current=(A==null?void 0:A.getBoundingClientRect())||null,E.current=Ps(O.sourceEvent,w.current)}).on("drag",O=>{var K,R;const A=C(O),{autoPanOnNodeDrag:L,nodeDragThreshold:z}=u.getState();if(O.sourceEvent.type==="touchmove"&&O.sourceEvent.touches.length>1&&(N.current=!0),!N.current){if(!k.current&&S.current&&L&&(k.current=!0,P()),!S.current){const Q=A.xSnapped-(((K=g==null?void 0:g.current)==null?void 0:K.x)??0),H=A.ySnapped-(((R=g==null?void 0:g.current)==null?void 0:R.y)??0);Math.sqrt(Q*Q+H*H)>z&&I(O)}(g.current.x!==A.xSnapped||g.current.y!==A.ySnapped)&&f.current&&S.current&&(b.current=O.sourceEvent,E.current=Ps(O.sourceEvent,w.current),M(A))}}).on("end",O=>{if(!(!S.current||N.current)&&(p(!1),k.current=!1,S.current=!1,cancelAnimationFrame(v.current),f.current)){const{updateNodePositions:A,nodeInternals:L,onNodeDragStop:z,onSelectionDragStop:K}=u.getState(),R=i?z:th(K);if(A(f.current,!1,!1),R){const[Q,H]=eh({nodeId:i,dragItems:f.current,nodeInternals:L});R(O.sourceEvent,Q,H)}}}).filter(O=>{const A=O.target;return!O.button&&(!n||!Fb(A,`.${n}`,e))&&(!s||Fb(A,s,e))});return j.call(D),()=>{j.on(".drag",null)}}}},[e,t,n,s,a,u,i,l,C]),h}function Bj(){const e=Mt();return _.useCallback(n=>{const{nodeInternals:s,nodeExtent:i,updateNodePositions:a,getNodes:l,snapToGrid:u,snapGrid:h,onError:p,nodesDraggable:f}=e.getState(),g=l().filter(N=>N.selected&&(N.draggable||f&&typeof N.draggable>"u")),v=u?h[0]:5,w=u?h[1]:5,E=n.isShiftPressed?4:1,b=n.x*v*E,k=n.y*w*E,S=g.map(N=>{if(N.positionAbsolute){const C={x:N.positionAbsolute.x+b,y:N.positionAbsolute.y+k};u&&(C.x=h[0]*Math.round(C.x/h[0]),C.y=h[1]*Math.round(C.y/h[1]));const{positionAbsolute:j,position:M}=Fj(N,C,s,i,void 0,p);N.position=M,N.positionAbsolute=j}return N});a(S,!0,!1)},[])}const Di={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var Za=e=>{const t=({id:n,type:s,data:i,xPos:a,yPos:l,xPosOrigin:u,yPosOrigin:h,selected:p,onClick:f,onMouseEnter:g,onMouseMove:v,onMouseLeave:w,onContextMenu:E,onDoubleClick:b,style:k,className:S,isDraggable:N,isSelectable:C,isConnectable:j,isFocusable:M,selectNodesOnDrag:P,sourcePosition:I,targetPosition:D,hidden:O,resizeObserver:A,dragHandle:L,zIndex:z,isParent:K,noDragClassName:R,noPanClassName:Q,initialized:H,disableKeyboardA11y:ne,ariaLabel:X,rfId:W,hasHandleBounds:ee})=>{const $=Mt(),Y=_.useRef(null),de=_.useRef(null),G=_.useRef(I),F=_.useRef(D),J=_.useRef(s),V=C||N||f||g||v||w,ae=Bj(),pe=Qa(n,$.getState,g),me=Qa(n,$.getState,v),ke=Qa(n,$.getState,w),Ve=Qa(n,$.getState,E),ze=Qa(n,$.getState,b),Oe=be=>{const{nodeDragThreshold:xe}=$.getState();if(C&&(!P||!N||xe>0)&&Uv({id:n,store:$,nodeRef:Y}),f){const he=$.getState().nodeInternals.get(n);he&&f(be,{...he})}},Ne=be=>{if(!qv(be)&&!ne)if(hj.includes(be.key)&&C){const xe=be.key==="Escape";Uv({id:n,store:$,unselect:xe,nodeRef:Y})}else N&&p&&Object.prototype.hasOwnProperty.call(Di,be.key)&&($.setState({ariaLiveMessage:`Moved selected node ${be.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~a}, y: ${~~l}`}),ae({x:Di[be.key].x,y:Di[be.key].y,isShiftPressed:be.shiftKey}))};_.useEffect(()=>()=>{de.current&&(A==null||A.unobserve(de.current),de.current=null)},[]),_.useEffect(()=>{if(Y.current&&!O){const be=Y.current;(!H||!ee||de.current!==be)&&(de.current&&(A==null||A.unobserve(de.current)),A==null||A.observe(be),de.current=be)}},[O,H,ee]),_.useEffect(()=>{const be=J.current!==s,xe=G.current!==I,he=F.current!==D;Y.current&&(be||xe||he)&&(be&&(J.current=s),xe&&(G.current=I),he&&(F.current=D),$.getState().updateNodeDimensions([{id:n,nodeElement:Y.current,forceUpdate:!0}]))},[n,s,I,D]);const ce=zj({nodeRef:Y,disabled:O||!N,noDragClassName:R,handleSelector:L,nodeId:n,isSelectable:C,selectNodesOnDrag:P});return O?null:fe.createElement("div",{className:Gt(["react-flow__node",`react-flow__node-${s}`,{[Q]:N},S,{selected:p,selectable:C,parent:K,dragging:ce}]),ref:Y,style:{zIndex:z,transform:`translate(${u}px,${h}px)`,pointerEvents:V?"all":"none",visibility:H?"visible":"hidden",...k},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:pe,onMouseMove:me,onMouseLeave:ke,onContextMenu:Ve,onClick:Oe,onDoubleClick:ze,onKeyDown:M?Ne:void 0,tabIndex:M?0:void 0,role:M?"button":void 0,"aria-describedby":ne?void 0:`${Ij}-${W}`,"aria-label":X},fe.createElement(oP,{value:n},fe.createElement(e,{id:n,data:i,type:s,xPos:a,yPos:l,selected:p,isConnectable:j,sourcePosition:I,targetPosition:D,dragging:ce,dragHandle:L,zIndex:z})))};return t.displayName="NodeWrapper",_.memo(t)};const VP=e=>{const t=e.getNodes().filter(n=>n.selected);return{...Wu(t,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};function YP({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const s=Mt(),{width:i,height:a,x:l,y:u,transformString:h,userSelectionActive:p}=ut(VP,qt),f=Bj(),g=_.useRef(null);if(_.useEffect(()=>{var E;n||(E=g.current)==null||E.focus({preventScroll:!0})},[n]),zj({nodeRef:g}),p||!i||!a)return null;const v=e?E=>{const b=s.getState().getNodes().filter(k=>k.selected);e(E,b)}:void 0,w=E=>{Object.prototype.hasOwnProperty.call(Di,E.key)&&f({x:Di[E.key].x,y:Di[E.key].y,isShiftPressed:E.shiftKey})};return fe.createElement("div",{className:Gt(["react-flow__nodesselection","react-flow__container",t]),style:{transform:h}},fe.createElement("div",{ref:g,className:"react-flow__nodesselection-rect",onContextMenu:v,tabIndex:n?void 0:-1,onKeyDown:n?void 0:w,style:{width:i,height:a,top:u,left:l}}))}var KP=_.memo(YP);const XP=e=>e.nodesSelectionActive,Uj=({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:s,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:l,deleteKeyCode:u,onMove:h,onMoveStart:p,onMoveEnd:f,selectionKeyCode:g,selectionOnDrag:v,selectionMode:w,onSelectionStart:E,onSelectionEnd:b,multiSelectionKeyCode:k,panActivationKeyCode:S,zoomActivationKeyCode:N,elementsSelectable:C,zoomOnScroll:j,zoomOnPinch:M,panOnScroll:P,panOnScrollSpeed:I,panOnScrollMode:D,zoomOnDoubleClick:O,panOnDrag:A,defaultViewport:L,translateExtent:z,minZoom:K,maxZoom:R,preventScrolling:Q,onSelectionContextMenu:H,noWheelClassName:ne,noPanClassName:X,disableKeyboardA11y:W})=>{const ee=ut(XP),$=yl(g),Y=yl(S),de=Y||A,G=Y||P,F=$||v&&de!==!0;return OP({deleteKeyCode:u,multiSelectionKeyCode:k}),fe.createElement(qP,{onMove:h,onMoveStart:p,onMoveEnd:f,onPaneContextMenu:a,elementsSelectable:C,zoomOnScroll:j,zoomOnPinch:M,panOnScroll:G,panOnScrollSpeed:I,panOnScrollMode:D,zoomOnDoubleClick:O,panOnDrag:!$&&de,defaultViewport:L,translateExtent:z,minZoom:K,maxZoom:R,zoomActivationKeyCode:N,preventScrolling:Q,noWheelClassName:ne,noPanClassName:X},fe.createElement(qj,{onSelectionStart:E,onSelectionEnd:b,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:s,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:l,panOnDrag:de,isSelecting:!!F,selectionMode:w},e,ee&&fe.createElement(KP,{onSelectionContextMenu:H,noPanClassName:X,disableKeyboardA11y:W})))};Uj.displayName="FlowRenderer";var QP=_.memo(Uj);function ZP(e){return ut(_.useCallback(n=>e?xj(n.nodeInternals,{x:0,y:0,width:n.width,height:n.height},n.transform,!0):n.getNodes(),[e]))}function JP(e){const t={input:Za(e.input||Tj),default:Za(e.default||Bv),output:Za(e.output||Aj),group:Za(e.group||Nw)},n={},s=Object.keys(e).filter(i=>!["input","default","output","group"].includes(i)).reduce((i,a)=>(i[a]=Za(e[a]||Bv),i),n);return{...t,...s}}const e$=({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]},t$=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),Wj=e=>{const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:s,elementsSelectable:i,updateNodeDimensions:a,onError:l}=ut(t$,qt),u=ZP(e.onlyRenderVisibleElements),h=_.useRef(),p=_.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const f=new ResizeObserver(g=>{const v=g.map(w=>({id:w.target.getAttribute("data-id"),nodeElement:w.target,forceUpdate:!0}));a(v)});return h.current=f,f},[]);return _.useEffect(()=>()=>{var f;(f=h==null?void 0:h.current)==null||f.disconnect()},[]),fe.createElement("div",{className:"react-flow__nodes",style:Ew},u.map(f=>{var M,P,I;let g=f.type||"default";e.nodeTypes[g]||(l==null||l("003",Jr.error003(g)),g="default");const v=e.nodeTypes[g]||e.nodeTypes.default,w=!!(f.draggable||t&&typeof f.draggable>"u"),E=!!(f.selectable||i&&typeof f.selectable>"u"),b=!!(f.connectable||n&&typeof f.connectable>"u"),k=!!(f.focusable||s&&typeof f.focusable>"u"),S=e.nodeExtent?ww(f.positionAbsolute,e.nodeExtent):f.positionAbsolute,N=(S==null?void 0:S.x)??0,C=(S==null?void 0:S.y)??0,j=e$({x:N,y:C,width:f.width??0,height:f.height??0,origin:e.nodeOrigin});return fe.createElement(v,{key:f.id,id:f.id,className:f.className,style:f.style,type:g,data:f.data,sourcePosition:f.sourcePosition||$e.Bottom,targetPosition:f.targetPosition||$e.Top,hidden:f.hidden,xPos:N,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:E,isConnectable:b,isFocusable:k,resizeObserver:p,dragHandle:f.dragHandle,zIndex:((M=f[Ct])==null?void 0:M.z)??0,isParent:!!((P=f[Ct])!=null&&P.isParent),noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!f.width&&!!f.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:f.ariaLabel,hasHandleBounds:!!((I=f[Ct])!=null&&I.handleBounds)})}))};Wj.displayName="NodeRenderer";var n$=_.memo(Wj);const r$=(e,t,n)=>n===$e.Left?e-t:n===$e.Right?e+t:e,s$=(e,t,n)=>n===$e.Top?e-t:n===$e.Bottom?e+t:e,Bb="react-flow__edgeupdater",Ub=({position:e,centerX:t,centerY:n,radius:s=10,onMouseDown:i,onMouseEnter:a,onMouseOut:l,type:u})=>fe.createElement("circle",{onMouseDown:i,onMouseEnter:a,onMouseOut:l,className:Gt([Bb,`${Bb}-${u}`]),cx:r$(t,s,e),cy:s$(n,s,e),r:s,stroke:"transparent",fill:"transparent"}),o$=()=>!0;var Ti=e=>{const t=({id:n,className:s,type:i,data:a,onClick:l,onEdgeDoubleClick:u,selected:h,animated:p,label:f,labelStyle:g,labelShowBg:v,labelBgStyle:w,labelBgPadding:E,labelBgBorderRadius:b,style:k,source:S,target:N,sourceX:C,sourceY:j,targetX:M,targetY:P,sourcePosition:I,targetPosition:D,elementsSelectable:O,hidden:A,sourceHandleId:L,targetHandleId:z,onContextMenu:K,onMouseEnter:R,onMouseMove:Q,onMouseLeave:H,reconnectRadius:ne,onReconnect:X,onReconnectStart:W,onReconnectEnd:ee,markerEnd:$,markerStart:Y,rfId:de,ariaLabel:G,isFocusable:F,isReconnectable:J,pathOptions:V,interactionWidth:ae,disableKeyboardA11y:pe})=>{const me=_.useRef(null),[ke,Ve]=_.useState(!1),[ze,Oe]=_.useState(!1),Ne=Mt(),ce=_.useMemo(()=>`url('#${Fv(Y,de)}')`,[Y,de]),be=_.useMemo(()=>`url('#${Fv($,de)}')`,[$,de]);if(A)return null;const xe=Le=>{var Re;const{edges:Ue,addSelectedEdges:Ce,unselectNodesAndEdges:Ke,multiSelectionActive:jt}=Ne.getState(),at=Ue.find(bt=>bt.id===n);at&&(O&&(Ne.setState({nodesSelectionActive:!1}),at.selected&&jt?(Ke({nodes:[],edges:[at]}),(Re=me.current)==null||Re.blur()):Ce([n])),l&&l(Le,at))},he=Xa(n,Ne.getState,u),Pe=Xa(n,Ne.getState,K),Be=Xa(n,Ne.getState,R),Ze=Xa(n,Ne.getState,Q),Ge=Xa(n,Ne.getState,H),Je=(Le,Ue)=>{if(Le.button!==0)return;const{edges:Ce,isValidConnection:Ke}=Ne.getState(),jt=Ue?N:S,at=(Ue?z:L)||null,Re=Ue?"target":"source",bt=Ke||o$,ft=Ue,yt=Ce.find(Nn=>Nn.id===n);Oe(!0),W==null||W(Le,yt,Re);const Sn=Nn=>{Oe(!1),ee==null||ee(Nn,yt,Re)};Nj({event:Le,handleId:at,nodeId:jt,onConnect:Nn=>X==null?void 0:X(yt,Nn),isTarget:ft,getState:Ne.getState,setState:Ne.setState,isValidConnection:bt,edgeUpdaterType:Re,onReconnectEnd:Sn})},qe=Le=>Je(Le,!0),Ye=Le=>Je(Le,!1),Te=()=>Ve(!0),et=()=>Ve(!1),it=!O&&!l,oe=Le=>{var Ue;if(!pe&&hj.includes(Le.key)&&O){const{unselectNodesAndEdges:Ce,addSelectedEdges:Ke,edges:jt}=Ne.getState();Le.key==="Escape"?((Ue=me.current)==null||Ue.blur(),Ce({edges:[jt.find(Re=>Re.id===n)]})):Ke([n])}};return fe.createElement("g",{className:Gt(["react-flow__edge",`react-flow__edge-${i}`,s,{selected:h,animated:p,inactive:it,updating:ke}]),onClick:xe,onDoubleClick:he,onContextMenu:Pe,onMouseEnter:Be,onMouseMove:Ze,onMouseLeave:Ge,onKeyDown:F?oe:void 0,tabIndex:F?0:void 0,role:F?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":G===null?void 0:G||`Edge from ${S} to ${N}`,"aria-describedby":F?`${Oj}-${de}`:void 0,ref:me},!ze&&fe.createElement(e,{id:n,source:S,target:N,selected:h,animated:p,label:f,labelStyle:g,labelShowBg:v,labelBgStyle:w,labelBgPadding:E,labelBgBorderRadius:b,data:a,style:k,sourceX:C,sourceY:j,targetX:M,targetY:P,sourcePosition:I,targetPosition:D,sourceHandleId:L,targetHandleId:z,markerStart:ce,markerEnd:be,pathOptions:V,interactionWidth:ae}),J&&fe.createElement(fe.Fragment,null,(J==="source"||J===!0)&&fe.createElement(Ub,{position:I,centerX:C,centerY:j,radius:ne,onMouseDown:qe,onMouseEnter:Te,onMouseOut:et,type:"source"}),(J==="target"||J===!0)&&fe.createElement(Ub,{position:D,centerX:M,centerY:P,radius:ne,onMouseDown:Ye,onMouseEnter:Te,onMouseOut:et,type:"target"})))};return t.displayName="EdgeWrapper",_.memo(t)};function i$(e){const t={default:Ti(e.default||Ru),straight:Ti(e.bezier||kw),step:Ti(e.step||bw),smoothstep:Ti(e.step||Uu),simplebezier:Ti(e.simplebezier||xw)},n={},s=Object.keys(e).filter(i=>!["default","bezier"].includes(i)).reduce((i,a)=>(i[a]=Ti(e[a]||Ru),i),n);return{...t,...s}}function Wb(e,t,n=null){const s=((n==null?void 0:n.x)||0)+t.x,i=((n==null?void 0:n.y)||0)+t.y,a=(n==null?void 0:n.width)||t.width,l=(n==null?void 0:n.height)||t.height;switch(e){case $e.Top:return{x:s+a/2,y:i};case $e.Right:return{x:s+a,y:i+l/2};case $e.Bottom:return{x:s+a/2,y:i+l};case $e.Left:return{x:s,y:i+l/2}}}function Hb(e,t){return e?e.length===1||!t?e[0]:t&&e.find(n=>n.id===t)||null:null}const a$=(e,t,n,s,i,a)=>{const l=Wb(n,e,t),u=Wb(a,s,i);return{sourceX:l.x,sourceY:l.y,targetX:u.x,targetY:u.y}};function l$({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:s,targetWidth:i,targetHeight:a,width:l,height:u,transform:h}){const p={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+n,t.x+i),y2:Math.max(e.y+s,t.y+a)};p.x===p.x2&&(p.x2+=1),p.y===p.y2&&(p.y2+=1);const f=ml({x:(0-h[0])/h[2],y:(0-h[1])/h[2],width:l/h[2],height:u/h[2]}),g=Math.max(0,Math.min(f.x2,p.x2)-Math.max(f.x,p.x)),v=Math.max(0,Math.min(f.y2,p.y2)-Math.max(f.y,p.y));return Math.ceil(g*v)>0}function Gb(e){var s,i,a,l,u;const t=((s=e==null?void 0:e[Ct])==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 c$=[{level:0,isMaxLevel:!0,edges:[]}];function u$(e,t,n=!1){let s=-1;const i=e.reduce((l,u)=>{var f,g;const h=qn(u.zIndex);let p=h?u.zIndex:0;if(n){const v=t.get(u.target),w=t.get(u.source),E=u.selected||(v==null?void 0:v.selected)||(w==null?void 0:w.selected),b=Math.max(((f=w==null?void 0:w[Ct])==null?void 0:f.z)||0,((g=v==null?void 0:v[Ct])==null?void 0:g.z)||0,1e3);p=(h?u.zIndex:0)+(E?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?c$:a}function d$(e,t,n){const s=ut(_.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)&&l$({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 u$(s,t,n)}const f$=({color:e="none",strokeWidth:t=1})=>fe.createElement("polyline",{style:{stroke:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),h$=({color:e="none",strokeWidth:t=1})=>fe.createElement("polyline",{style:{stroke:e,fill:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),Vb={[Tu.Arrow]:f$,[Tu.ArrowClosed]:h$};function p$(e){const t=Mt();return _.useMemo(()=>{var i,a;return Object.prototype.hasOwnProperty.call(Vb,e)?Vb[e]:((a=(i=t.getState()).onError)==null||a.call(i,"009",Jr.error009(e)),null)},[e])}const m$=({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=p$(t);return h?fe.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"},fe.createElement(h,{color:n,strokeWidth:l})):null},g$=({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=Fv(l,t);s.includes(u)||(i.push({id:u,color:l.color||e,...l}),s.push(u))}}),i),[]).sort((i,a)=>i.id.localeCompare(a.id))},Hj=({defaultColor:e,rfId:t})=>{const n=ut(_.useCallback(g$({defaultColor:e,rfId:t}),[e,t]),(s,i)=>!(s.length!==i.length||s.some((a,l)=>a.id!==i[l].id)));return fe.createElement("defs",null,n.map(s=>fe.createElement(m$,{id:s.id,key:s.id,type:s.type,color:s.color,width:s.width,height:s.height,markerUnits:s.markerUnits,strokeWidth:s.strokeWidth,orient:s.orient})))};Hj.displayName="MarkerDefinitions";var y$=_.memo(Hj);const v$=e=>({nodesConnectable:e.nodesConnectable,edgesFocusable:e.edgesFocusable,edgesUpdatable:e.edgesUpdatable,elementsSelectable:e.elementsSelectable,width:e.width,height:e.height,connectionMode:e.connectionMode,nodeInternals:e.nodeInternals,onError:e.onError}),Gj=({defaultMarkerColor:e,onlyRenderVisibleElements:t,elevateEdgesOnSelect:n,rfId:s,edgeTypes:i,noPanClassName:a,onEdgeContextMenu:l,onEdgeMouseEnter:u,onEdgeMouseMove:h,onEdgeMouseLeave:p,onEdgeClick:f,onEdgeDoubleClick:g,onReconnect:v,onReconnectStart:w,onReconnectEnd:E,reconnectRadius:b,children:k,disableKeyboardA11y:S})=>{const{edgesFocusable:N,edgesUpdatable:C,elementsSelectable:j,width:M,height:P,connectionMode:I,nodeInternals:D,onError:O}=ut(v$,qt),A=d$(t,D,n);return M?fe.createElement(fe.Fragment,null,A.map(({level:L,edges:z,isMaxLevel:K})=>fe.createElement("svg",{key:L,style:{zIndex:L},width:M,height:P,className:"react-flow__edges react-flow__container"},K&&fe.createElement(y$,{defaultColor:e,rfId:s}),fe.createElement("g",null,z.map(R=>{const[Q,H,ne]=Gb(D.get(R.source)),[X,W,ee]=Gb(D.get(R.target));if(!ne||!ee)return null;let $=R.type||"default";i[$]||(O==null||O("011",Jr.error011($)),$="default");const Y=i[$]||i.default,de=I===So.Strict?W.target:(W.target??[]).concat(W.source??[]),G=Hb(H.source,R.sourceHandle),F=Hb(de,R.targetHandle),J=(G==null?void 0:G.position)||$e.Bottom,V=(F==null?void 0:F.position)||$e.Top,ae=!!(R.focusable||N&&typeof R.focusable>"u"),pe=R.reconnectable||R.updatable,me=typeof v<"u"&&(pe||C&&typeof pe>"u");if(!G||!F)return O==null||O("008",Jr.error008(G,R)),null;const{sourceX:ke,sourceY:Ve,targetX:ze,targetY:Oe}=a$(Q,G,J,X,F,V);return fe.createElement(Y,{key:R.id,id:R.id,className:Gt([R.className,a]),type:$,data:R.data,selected:!!R.selected,animated:!!R.animated,hidden:!!R.hidden,label:R.label,labelStyle:R.labelStyle,labelShowBg:R.labelShowBg,labelBgStyle:R.labelBgStyle,labelBgPadding:R.labelBgPadding,labelBgBorderRadius:R.labelBgBorderRadius,style:R.style,source:R.source,target:R.target,sourceHandleId:R.sourceHandle,targetHandleId:R.targetHandle,markerEnd:R.markerEnd,markerStart:R.markerStart,sourceX:ke,sourceY:Ve,targetX:ze,targetY:Oe,sourcePosition:J,targetPosition:V,elementsSelectable:j,onContextMenu:l,onMouseEnter:u,onMouseMove:h,onMouseLeave:p,onClick:f,onEdgeDoubleClick:g,onReconnect:v,onReconnectStart:w,onReconnectEnd:E,reconnectRadius:b,rfId:s,ariaLabel:R.ariaLabel,isFocusable:ae,isReconnectable:me,pathOptions:"pathOptions"in R?R.pathOptions:void 0,interactionWidth:R.interactionWidth,disableKeyboardA11y:S})})))),k):null};Gj.displayName="EdgeRenderer";var w$=_.memo(Gj);const x$=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function b$({children:e}){const t=ut(x$);return fe.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:t}},e)}function k$(e){const t=Cl(),n=_.useRef(!1);_.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const _$={[$e.Left]:$e.Right,[$e.Right]:$e.Left,[$e.Top]:$e.Bottom,[$e.Bottom]:$e.Top},Vj=({nodeId:e,handleType:t,style:n,type:s=Os.Bezier,CustomComponent:i,connectionStatus:a})=>{var P,I,D;const{fromNode:l,handleId:u,toX:h,toY:p,connectionMode:f}=ut(_.useCallback(O=>({fromNode:O.nodeInternals.get(e),handleId:O.connectionHandleId,toX:(O.connectionPosition.x-O.transform[0])/O.transform[2],toY:(O.connectionPosition.y-O.transform[1])/O.transform[2],connectionMode:O.connectionMode}),[e]),qt),g=(P=l==null?void 0:l[Ct])==null?void 0:P.handleBounds;let v=g==null?void 0:g[t];if(f===So.Loose&&(v=v||(g==null?void 0:g[t==="source"?"target":"source"])),!l||!v)return null;const w=u?v.find(O=>O.id===u):v[0],E=w?w.x+w.width/2:(l.width??0)/2,b=w?w.y+w.height/2:l.height??0,k=(((I=l.positionAbsolute)==null?void 0:I.x)??0)+E,S=(((D=l.positionAbsolute)==null?void 0:D.y)??0)+b,N=w==null?void 0:w.position,C=N?_$[N]:null;if(!N||!C)return null;if(i)return fe.createElement(i,{connectionLineType:s,connectionLineStyle:n,fromNode:l,fromHandle:w,fromX:k,fromY:S,toX:h,toY:p,fromPosition:N,toPosition:C,connectionStatus:a});let j="";const M={sourceX:k,sourceY:S,sourcePosition:N,targetX:h,targetY:p,targetPosition:C};return s===Os.Bezier?[j]=vj(M):s===Os.Step?[j]=Dv({...M,borderRadius:0}):s===Os.SmoothStep?[j]=Dv(M):s===Os.SimpleBezier?[j]=yj(M):j=`M${k},${S} ${h},${p}`,fe.createElement("path",{d:j,fill:"none",className:"react-flow__connection-path",style:n})};Vj.displayName="ConnectionLine";const S$=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function N$({containerStyle:e,style:t,type:n,component:s}){const{nodeId:i,handleType:a,nodesConnectable:l,width:u,height:h,connectionStatus:p}=ut(S$,qt);return!(i&&a&&u&&l)?null:fe.createElement("svg",{style:e,width:u,height:h,className:"react-flow__edges react-flow__connectionline react-flow__container"},fe.createElement("g",{className:Gt(["react-flow__connection",p])},fe.createElement(Vj,{nodeId:i,handleType:a,style:t,type:n,CustomComponent:s,connectionStatus:p})))}function Yb(e,t){return _.useRef(null),Mt(),_.useMemo(()=>t(e),[e])}const Yj=({nodeTypes:e,edgeTypes:t,onMove:n,onMoveStart:s,onMoveEnd:i,onInit:a,onNodeClick:l,onEdgeClick:u,onNodeDoubleClick:h,onEdgeDoubleClick:p,onNodeMouseEnter:f,onNodeMouseMove:g,onNodeMouseLeave:v,onNodeContextMenu:w,onSelectionContextMenu:E,onSelectionStart:b,onSelectionEnd:k,connectionLineType:S,connectionLineStyle:N,connectionLineComponent:C,connectionLineContainerStyle:j,selectionKeyCode:M,selectionOnDrag:P,selectionMode:I,multiSelectionKeyCode:D,panActivationKeyCode:O,zoomActivationKeyCode:A,deleteKeyCode:L,onlyRenderVisibleElements:z,elementsSelectable:K,selectNodesOnDrag:R,defaultViewport:Q,translateExtent:H,minZoom:ne,maxZoom:X,preventScrolling:W,defaultMarkerColor:ee,zoomOnScroll:$,zoomOnPinch:Y,panOnScroll:de,panOnScrollSpeed:G,panOnScrollMode:F,zoomOnDoubleClick:J,panOnDrag:V,onPaneClick:ae,onPaneMouseEnter:pe,onPaneMouseMove:me,onPaneMouseLeave:ke,onPaneScroll:Ve,onPaneContextMenu:ze,onEdgeContextMenu:Oe,onEdgeMouseEnter:Ne,onEdgeMouseMove:ce,onEdgeMouseLeave:be,onReconnect:xe,onReconnectStart:he,onReconnectEnd:Pe,reconnectRadius:Be,noDragClassName:Ze,noWheelClassName:Ge,noPanClassName:Je,elevateEdgesOnSelect:qe,disableKeyboardA11y:Ye,nodeOrigin:Te,nodeExtent:et,rfId:it})=>{const oe=Yb(e,JP),Le=Yb(t,i$);return k$(a),fe.createElement(QP,{onPaneClick:ae,onPaneMouseEnter:pe,onPaneMouseMove:me,onPaneMouseLeave:ke,onPaneContextMenu:ze,onPaneScroll:Ve,deleteKeyCode:L,selectionKeyCode:M,selectionOnDrag:P,selectionMode:I,onSelectionStart:b,onSelectionEnd:k,multiSelectionKeyCode:D,panActivationKeyCode:O,zoomActivationKeyCode:A,elementsSelectable:K,onMove:n,onMoveStart:s,onMoveEnd:i,zoomOnScroll:$,zoomOnPinch:Y,zoomOnDoubleClick:J,panOnScroll:de,panOnScrollSpeed:G,panOnScrollMode:F,panOnDrag:V,defaultViewport:Q,translateExtent:H,minZoom:ne,maxZoom:X,onSelectionContextMenu:E,preventScrolling:W,noDragClassName:Ze,noWheelClassName:Ge,noPanClassName:Je,disableKeyboardA11y:Ye},fe.createElement(b$,null,fe.createElement(w$,{edgeTypes:Le,onEdgeClick:u,onEdgeDoubleClick:p,onlyRenderVisibleElements:z,onEdgeContextMenu:Oe,onEdgeMouseEnter:Ne,onEdgeMouseMove:ce,onEdgeMouseLeave:be,onReconnect:xe,onReconnectStart:he,onReconnectEnd:Pe,reconnectRadius:Be,defaultMarkerColor:ee,noPanClassName:Je,elevateEdgesOnSelect:!!qe,disableKeyboardA11y:Ye,rfId:it},fe.createElement(N$,{style:N,type:S,component:C,containerStyle:j})),fe.createElement("div",{className:"react-flow__edgelabel-renderer"}),fe.createElement(n$,{nodeTypes:oe,onNodeClick:l,onNodeDoubleClick:h,onNodeMouseEnter:f,onNodeMouseMove:g,onNodeMouseLeave:v,onNodeContextMenu:w,selectNodesOnDrag:R,onlyRenderVisibleElements:z,noPanClassName:Je,noDragClassName:Ze,disableKeyboardA11y:Ye,nodeOrigin:Te,nodeExtent:et,rfId:it})))};Yj.displayName="GraphView";var E$=_.memo(Yj);const Wv=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],As={rfId:"1",width:0,height:0,transform:[0,0,1],nodeInternals:new Map,edges:[],onNodesChange:null,onEdgesChange:null,hasDefaultNodes:!1,hasDefaultEdges:!1,d3Zoom:null,d3Selection:null,d3ZoomHandler:void 0,minZoom:.5,maxZoom:2,translateExtent:Wv,nodeExtent:Wv,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:So.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:[0,0],nodeDragThreshold:0,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesUpdatable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,fitViewOnInit:!1,fitViewOnInitDone:!1,fitViewOnInitOptions:void 0,onSelectionChange:[],multiSelectionActive:!1,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,connectionRadius:20,onError:JO,isValidConnection:void 0},C$=()=>p2((e,t)=>({...As,setNodes:n=>{const{nodeInternals:s,nodeOrigin:i,elevateNodesOnSelect:a}=t();e({nodeInternals:Zf(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?Zf(n,new Map,t().nodeOrigin,t().elevateNodesOnSelect):new Map;e({nodeInternals:l,edges:a?s:[],hasDefaultNodes:i,hasDefaultEdges:a})},updateNodeDimensions:n=>{const{onNodesChange:s,nodeInternals:i,fitViewOnInit:a,fitViewOnInitDone:l,fitViewOnInitOptions:u,domNode:h,nodeOrigin:p}=t(),f=h==null?void 0:h.querySelector(".react-flow__viewport");if(!f)return;const g=window.getComputedStyle(f),{m22:v}=new window.DOMMatrixReadOnly(g.transform),w=n.reduce((b,k)=>{const S=i.get(k.id);if(S!=null&&S.hidden)i.set(S.id,{...S,[Ct]:{...S[Ct],handleBounds:void 0}});else if(S){const N=vw(k.nodeElement);!!(N.width&&N.height&&(S.width!==N.width||S.height!==N.height||k.forceUpdate))&&(i.set(S.id,{...S,[Ct]:{...S[Ct],handleBounds:{source:zb(".source",k.nodeElement,v,p),target:zb(".target",k.nodeElement,v,p)}},...N}),b.push({id:S.id,type:"dimensions",dimensions:N}))}return b},[]);$j(i,p);const E=l||a&&!l&&Lj(t,{initial:!0,...u});e({nodeInternals:new Map(i),fitViewOnInitDone:E}),(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=BP(n,u()),f=Zf(p,i,l,h);e({nodeInternals:f})}s==null||s(n)}},addSelectedNodes:n=>{const{multiSelectionActive:s,edges:i,getNodes:a}=t();let l,u=null;s?l=n.map(h=>Is(h,!0)):(l=Oi(a(),n),u=Oi(i,[])),su({changedNodes:l,changedEdges:u,get:t,set:e})},addSelectedEdges:n=>{const{multiSelectionActive:s,edges:i,getNodes:a}=t();let l,u=null;s?l=n.map(h=>Is(h,!0)):(l=Oi(i,n),u=Oi(a(),[])),su({changedNodes:u,changedEdges:l,get:t,set:e})},unselectNodesAndEdges:({nodes:n,edges:s}={})=>{const{edges:i,getNodes:a}=t(),l=n||a(),u=s||i,h=l.map(f=>(f.selected=!1,Is(f.id,!1))),p=u.map(f=>Is(f.id,!1));su({changedNodes:h,changedEdges:p,get:t,set:e})},setMinZoom:n=>{const{d3Zoom:s,maxZoom:i}=t();s==null||s.scaleExtent([n,i]),e({minZoom:n})},setMaxZoom:n=>{const{d3Zoom:s,minZoom:i}=t();s==null||s.scaleExtent([i,n]),e({maxZoom:n})},setTranslateExtent:n=>{var s;(s=t().d3Zoom)==null||s.translateExtent(n),e({translateExtent:n})},resetSelectedElements:()=>{const{edges:n,getNodes:s}=t(),a=s().filter(u=>u.selected).map(u=>Is(u.id,!1)),l=n.filter(u=>u.selected).map(u=>Is(u.id,!1));su({changedNodes:a,changedEdges:l,get:t,set:e})},setNodeExtent:n=>{const{nodeInternals:s}=t();s.forEach(i=>{i.positionAbsolute=ww(i.position,n)}),e({nodeExtent:n,nodeInternals:new Map(s)})},panBy:n=>{const{transform:s,width:i,height:a,d3Zoom:l,d3Selection:u,translateExtent:h}=t();if(!l||!u||!n.x&&!n.y)return!1;const p=Qr.translate(s[0]+n.x,s[1]+n.y).scale(s[2]),f=[[0,0],[i,a]],g=l==null?void 0:l.constrain()(p,f,h);return l.transform(u,g),s[0]!==g.x||s[1]!==g.y||s[2]!==g.k},cancelConnection:()=>e({connectionNodeId:As.connectionNodeId,connectionHandleId:As.connectionHandleId,connectionHandleType:As.connectionHandleType,connectionStatus:As.connectionStatus,connectionStartHandle:As.connectionStartHandle,connectionEndHandle:As.connectionEndHandle}),reset:()=>e({...As})}),Object.is),Cw=({children:e})=>{const t=_.useRef(null);return t.current||(t.current=C$()),fe.createElement(GO,{value:t.current},e)};Cw.displayName="ReactFlowProvider";const Kj=({children:e})=>_.useContext(Bu)?fe.createElement(fe.Fragment,null,e):fe.createElement(Cw,null,e);Kj.displayName="ReactFlowWrapper";const j$={input:Tj,default:Bv,output:Aj,group:Nw},T$={default:Ru,straight:kw,step:bw,smoothstep:Uu,simplebezier:xw},R$=[0,0],A$=[15,15],M$={x:0,y:0,zoom:1},I$={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},Xj=_.forwardRef(({nodes:e,edges:t,defaultNodes:n,defaultEdges:s,className:i,nodeTypes:a=j$,edgeTypes:l=T$,onNodeClick:u,onEdgeClick:h,onInit:p,onMove:f,onMoveStart:g,onMoveEnd:v,onConnect:w,onConnectStart:E,onConnectEnd:b,onClickConnectStart:k,onClickConnectEnd:S,onNodeMouseEnter:N,onNodeMouseMove:C,onNodeMouseLeave:j,onNodeContextMenu:M,onNodeDoubleClick:P,onNodeDragStart:I,onNodeDrag:D,onNodeDragStop:O,onNodesDelete:A,onEdgesDelete:L,onSelectionChange:z,onSelectionDragStart:K,onSelectionDrag:R,onSelectionDragStop:Q,onSelectionContextMenu:H,onSelectionStart:ne,onSelectionEnd:X,connectionMode:W=So.Strict,connectionLineType:ee=Os.Bezier,connectionLineStyle:$,connectionLineComponent:Y,connectionLineContainerStyle:de,deleteKeyCode:G="Backspace",selectionKeyCode:F="Shift",selectionOnDrag:J=!1,selectionMode:V=gl.Full,panActivationKeyCode:ae="Space",multiSelectionKeyCode:pe=ju()?"Meta":"Control",zoomActivationKeyCode:me=ju()?"Meta":"Control",snapToGrid:ke=!1,snapGrid:Ve=A$,onlyRenderVisibleElements:ze=!1,selectNodesOnDrag:Oe=!0,nodesDraggable:Ne,nodesConnectable:ce,nodesFocusable:be,nodeOrigin:xe=R$,edgesFocusable:he,edgesUpdatable:Pe,elementsSelectable:Be,defaultViewport:Ze=M$,minZoom:Ge=.5,maxZoom:Je=2,translateExtent:qe=Wv,preventScrolling:Ye=!0,nodeExtent:Te,defaultMarkerColor:et="#b1b1b7",zoomOnScroll:it=!0,zoomOnPinch:oe=!0,panOnScroll:Le=!1,panOnScrollSpeed:Ue=.5,panOnScrollMode:Ce=xo.Free,zoomOnDoubleClick:Ke=!0,panOnDrag:jt=!0,onPaneClick:at,onPaneMouseEnter:Re,onPaneMouseMove:bt,onPaneMouseLeave:ft,onPaneScroll:yt,onPaneContextMenu:Sn,children:zn,onEdgeContextMenu:Nn,onEdgeDoubleClick:To,onEdgeMouseEnter:hn,onEdgeMouseMove:Ro,onEdgeMouseLeave:Ao,onEdgeUpdate:Ut,onEdgeUpdateStart:Tr,onEdgeUpdateEnd:Bn,onReconnect:Ds,onReconnectStart:Rr,onReconnectEnd:Mo,reconnectRadius:hr=10,edgeUpdaterRadius:Ar=10,onNodesChange:pr,onEdgesChange:ns,noDragClassName:Io="nodrag",noWheelClassName:Oo="nowheel",noPanClassName:Po="nopan",fitView:En=!1,fitViewOptions:$o,connectOnClick:Mr=!0,attributionPosition:Lo,proOptions:Un,defaultEdgeOptions:qo,elevateNodesOnSelect:Fs=!0,elevateEdgesOnSelect:zs=!1,disableKeyboardA11y:Do=!1,autoPanOnConnect:Fo=!0,autoPanOnNodeDrag:ct=!0,connectionRadius:sa=20,isValidConnection:rs,onError:Vt,style:Wn,id:zo,nodeDragThreshold:ss,...kt},rn)=>{const Hn=zo||"1";return fe.createElement("div",{...kt,style:{...Wn,...I$},ref:rn,className:Gt(["react-flow",i]),"data-testid":"rf__wrapper",id:zo},fe.createElement(Kj,null,fe.createElement(E$,{onInit:p,onMove:f,onMoveStart:g,onMoveEnd:v,onNodeClick:u,onEdgeClick:h,onNodeMouseEnter:N,onNodeMouseMove:C,onNodeMouseLeave:j,onNodeContextMenu:M,onNodeDoubleClick:P,nodeTypes:a,edgeTypes:l,connectionLineType:ee,connectionLineStyle:$,connectionLineComponent:Y,connectionLineContainerStyle:de,selectionKeyCode:F,selectionOnDrag:J,selectionMode:V,deleteKeyCode:G,multiSelectionKeyCode:pe,panActivationKeyCode:ae,zoomActivationKeyCode:me,onlyRenderVisibleElements:ze,selectNodesOnDrag:Oe,defaultViewport:Ze,translateExtent:qe,minZoom:Ge,maxZoom:Je,preventScrolling:Ye,zoomOnScroll:it,zoomOnPinch:oe,zoomOnDoubleClick:Ke,panOnScroll:Le,panOnScrollSpeed:Ue,panOnScrollMode:Ce,panOnDrag:jt,onPaneClick:at,onPaneMouseEnter:Re,onPaneMouseMove:bt,onPaneMouseLeave:ft,onPaneScroll:yt,onPaneContextMenu:Sn,onSelectionContextMenu:H,onSelectionStart:ne,onSelectionEnd:X,onEdgeContextMenu:Nn,onEdgeDoubleClick:To,onEdgeMouseEnter:hn,onEdgeMouseMove:Ro,onEdgeMouseLeave:Ao,onReconnect:Ds??Ut,onReconnectStart:Rr??Tr,onReconnectEnd:Mo??Bn,reconnectRadius:hr??Ar,defaultMarkerColor:et,noDragClassName:Io,noWheelClassName:Oo,noPanClassName:Po,elevateEdgesOnSelect:zs,rfId:Hn,disableKeyboardA11y:Do,nodeOrigin:xe,nodeExtent:Te}),fe.createElement(kP,{nodes:e,edges:t,defaultNodes:n,defaultEdges:s,onConnect:w,onConnectStart:E,onConnectEnd:b,onClickConnectStart:k,onClickConnectEnd:S,nodesDraggable:Ne,nodesConnectable:ce,nodesFocusable:be,edgesFocusable:he,edgesUpdatable:Pe,elementsSelectable:Be,elevateNodesOnSelect:Fs,minZoom:Ge,maxZoom:Je,nodeExtent:Te,onNodesChange:pr,onEdgesChange:ns,snapToGrid:ke,snapGrid:Ve,connectionMode:W,translateExtent:qe,connectOnClick:Mr,defaultEdgeOptions:qo,fitView:En,fitViewOptions:$o,onNodesDelete:A,onEdgesDelete:L,onNodeDragStart:I,onNodeDrag:D,onNodeDragStop:O,onSelectionDrag:R,onSelectionDragStart:K,onSelectionDragStop:Q,noPanClassName:Po,nodeOrigin:xe,rfId:Hn,autoPanOnConnect:Fo,autoPanOnNodeDrag:ct,onError:Vt,connectionRadius:sa,isValidConnection:rs,nodeDragThreshold:ss}),fe.createElement(xP,{onSelectionChange:z}),zn,fe.createElement(YO,{proOptions:Un,position:Lo}),fe.createElement(CP,{rfId:Hn,disableKeyboardA11y:Do})))});Xj.displayName="ReactFlow";const O$=e=>({x:e.transform[0],y:e.transform[1],zoom:e.transform[2]});function Qj(){return ut(O$,qt)}const Zj=({id:e,x:t,y:n,width:s,height:i,style:a,color:l,strokeColor:u,strokeWidth:h,className:p,borderRadius:f,shapeRendering:g,onClick:v,selected:w})=>{const{background:E,backgroundColor:b}=a||{},k=l||E||b;return fe.createElement("rect",{className:Gt(["react-flow__minimap-node",{selected:w},p]),x:t,y:n,rx:f,ry:f,width:s,height:i,fill:k,stroke:u,strokeWidth:h,shapeRendering:g,onClick:v?S=>v(S,e):void 0})};Zj.displayName="MiniMapNode";var P$=_.memo(Zj);const $$=e=>e.nodeOrigin,L$=e=>e.getNodes().filter(t=>!t.hidden&&t.width&&t.height),nh=e=>e instanceof Function?e:()=>e;function q$({nodeStrokeColor:e="transparent",nodeColor:t="#e2e2e2",nodeClassName:n="",nodeBorderRadius:s=5,nodeStrokeWidth:i=2,nodeComponent:a=P$,onClick:l}){const u=ut(L$,qt),h=ut($$),p=nh(t),f=nh(e),g=nh(n),v=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return fe.createElement(fe.Fragment,null,u.map(w=>{const{x:E,y:b}=ko(w,h).positionAbsolute;return fe.createElement(a,{key:w.id,x:E,y:b,width:w.width,height:w.height,style:w.style,selected:w.selected,className:g(w),color:p(w),borderRadius:s,strokeColor:f(w),strokeWidth:i,shapeRendering:v,onClick:l,id:w.id})}))}var D$=_.memo(q$);const F$=200,z$=150,B$=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?QO(Wu(t,e.nodeOrigin),n):n,rfId:e.rfId}},U$="react-flow__minimap-desc";function Jj({style:e,className:t,nodeStrokeColor:n="transparent",nodeColor:s="#e2e2e2",nodeClassName:i="",nodeBorderRadius:a=5,nodeStrokeWidth:l=2,nodeComponent:u,maskColor:h="rgb(240, 240, 240, 0.6)",maskStrokeColor:p="none",maskStrokeWidth:f=1,position:g="bottom-right",onClick:v,onNodeClick:w,pannable:E=!1,zoomable:b=!1,ariaLabel:k="React Flow mini map",inversePan:S=!1,zoomStep:N=10,offsetScale:C=5}){const j=Mt(),M=_.useRef(null),{boundingRect:P,viewBB:I,rfId:D}=ut(B$,qt),O=(e==null?void 0:e.width)??F$,A=(e==null?void 0:e.height)??z$,L=P.width/O,z=P.height/A,K=Math.max(L,z),R=K*O,Q=K*A,H=C*K,ne=P.x-(R-P.width)/2-H,X=P.y-(Q-P.height)/2-H,W=R+H*2,ee=Q+H*2,$=`${U$}-${D}`,Y=_.useRef(0);Y.current=K,_.useEffect(()=>{if(M.current){const F=Ln(M.current),J=pe=>{const{transform:me,d3Selection:ke,d3Zoom:Ve}=j.getState();if(pe.sourceEvent.type!=="wheel"||!ke||!Ve)return;const ze=-pe.sourceEvent.deltaY*(pe.sourceEvent.deltaMode===1?.05:pe.sourceEvent.deltaMode?1:.002)*N,Oe=me[2]*Math.pow(2,ze);Ve.scaleTo(ke,Oe)},V=pe=>{const{transform:me,d3Selection:ke,d3Zoom:Ve,translateExtent:ze,width:Oe,height:Ne}=j.getState();if(pe.sourceEvent.type!=="mousemove"||!ke||!Ve)return;const ce=Y.current*Math.max(1,me[2])*(S?-1:1),be={x:me[0]-pe.sourceEvent.movementX*ce,y:me[1]-pe.sourceEvent.movementY*ce},xe=[[0,0],[Oe,Ne]],he=Qr.translate(be.x,be.y).scale(me[2]),Pe=Ve.constrain()(he,xe,ze);Ve.transform(ke,Pe)},ae=aj().on("zoom",E?V:null).on("zoom.wheel",b?J:null);return F.call(ae),()=>{F.on("zoom",null)}}},[E,b,S,N]);const de=v?F=>{const J=or(F);v(F,{x:J[0],y:J[1]})}:void 0,G=w?(F,J)=>{const V=j.getState().nodeInternals.get(J);w(F,V)}:void 0;return fe.createElement(yw,{position:g,style:e,className:Gt(["react-flow__minimap",t]),"data-testid":"rf__minimap"},fe.createElement("svg",{width:O,height:A,viewBox:`${ne} ${X} ${W} ${ee}`,role:"img","aria-labelledby":$,ref:M,onClick:de},k&&fe.createElement("title",{id:$},k),fe.createElement(D$,{onClick:G,nodeColor:s,nodeStrokeColor:n,nodeBorderRadius:a,nodeClassName:i,nodeStrokeWidth:l,nodeComponent:u}),fe.createElement("path",{className:"react-flow__minimap-mask",d:`M${ne-H},${X-H}h${W+H*2}v${ee+H*2}h${-W-H*2}z
|
|
57
|
+
M${I.x},${I.y}h${I.width}v${I.height}h${-I.width}z`,fill:h,fillRule:"evenodd",stroke:p,strokeWidth:f,pointerEvents:"none"})))}Jj.displayName="MiniMap";var W$=_.memo(Jj);function H$(){return fe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},fe.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function G$(){return fe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},fe.createElement("path",{d:"M0 0h32v4.2H0z"}))}function V$(){return fe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},fe.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 Y$(){return fe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},fe.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 K$(){return fe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},fe.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"}))}const Nr=({children:e,className:t,...n})=>fe.createElement("button",{type:"button",className:Gt(["react-flow__controls-button",t]),...n},e);Nr.displayName="ControlButton";const X$=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom}),eT=({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:s=!0,fitViewOptions:i,onZoomIn:a,onZoomOut:l,onFitView:u,onInteractiveChange:h,className:p,children:f,position:g="bottom-left"})=>{const v=Mt(),[w,E]=_.useState(!1),{isInteractive:b,minZoomReached:k,maxZoomReached:S}=ut(X$,qt),{zoomIn:N,zoomOut:C,fitView:j}=Cl();if(_.useEffect(()=>{E(!0)},[]),!w)return null;const M=()=>{N(),a==null||a()},P=()=>{C(),l==null||l()},I=()=>{j(i),u==null||u()},D=()=>{v.setState({nodesDraggable:!b,nodesConnectable:!b,elementsSelectable:!b}),h==null||h(!b)};return fe.createElement(yw,{className:Gt(["react-flow__controls",p]),position:g,style:e,"data-testid":"rf__controls"},t&&fe.createElement(fe.Fragment,null,fe.createElement(Nr,{onClick:M,className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:S},fe.createElement(H$,null)),fe.createElement(Nr,{onClick:P,className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:k},fe.createElement(G$,null))),n&&fe.createElement(Nr,{className:"react-flow__controls-fitview",onClick:I,title:"fit view","aria-label":"fit view"},fe.createElement(V$,null)),s&&fe.createElement(Nr,{className:"react-flow__controls-interactive",onClick:D,title:"toggle interactivity","aria-label":"toggle interactivity"},b?fe.createElement(K$,null):fe.createElement(Y$,null)),f)};eT.displayName="Controls";var Q$=_.memo(eT),cr;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(cr||(cr={}));function Z$({color:e,dimensions:t,lineWidth:n}){return fe.createElement("path",{stroke:e,strokeWidth:n,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`})}function J$({color:e,radius:t}){return fe.createElement("circle",{cx:t,cy:t,r:t,fill:e})}const eL={[cr.Dots]:"#91919a",[cr.Lines]:"#eee",[cr.Cross]:"#e2e2e2"},tL={[cr.Dots]:1,[cr.Lines]:1,[cr.Cross]:6},nL=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function tT({id:e,variant:t=cr.Dots,gap:n=20,size:s,lineWidth:i=1,offset:a=2,color:l,style:u,className:h}){const p=_.useRef(null),{transform:f,patternId:g}=ut(nL,qt),v=l||eL[t],w=s||tL[t],E=t===cr.Dots,b=t===cr.Cross,k=Array.isArray(n)?n:[n,n],S=[k[0]*f[2]||1,k[1]*f[2]||1],N=w*f[2],C=b?[N,N]:S,j=E?[N/a,N/a]:[C[0]/a,C[1]/a];return fe.createElement("svg",{className:Gt(["react-flow__background",h]),style:{...u,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:p,"data-testid":"rf__background"},fe.createElement("pattern",{id:g+e,x:f[0]%S[0],y:f[1]%S[1],width:S[0],height:S[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${j[0]},-${j[1]})`},E?fe.createElement(J$,{color:v,radius:N/a}):fe.createElement(Z$,{dimensions:C,color:v,lineWidth:i})),fe.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${g+e})`}))}tT.displayName="Background";var rL=_.memo(tT);const sL=["us-gov","global","apac","us","eu","jp","au"],oL=new RegExp(`^(?:(?:${sL.join("|")})\\.)?anthropic\\.`,"i");function jl(e){return e.replace(oL,"")}const iL=["command","cmd","file_path","path","url","pattern","notebook_path"],Kb=120,rh=e=>e.length>Kb?`${e.slice(0,Kb-1)}…`:e;function aL(e){if(typeof e=="string")return e.trim()?rh(e.trim()):null;if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e;for(const n of iL){const s=t[n];if(typeof s=="string"&&s.trim())return rh(s.trim());if(Array.isArray(s)&&s.length>0&&s.every(i=>typeof i=="string")){const i=s.join(" ").trim();if(i)return rh(i)}}return null}function nT(){return{inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0}}function jw(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 lL(e){const t=jw(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 cL(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]=lL(s));return Object.keys(t).length?t:void 0}function rT(e,t=0){if(!e||typeof e!="object"||t>6)return null;const n=e;if(typeof n.input_tokens=="number"||typeof n.output_tokens=="number"||typeof n.cache_read_input_tokens=="number"||typeof n.cache_creation_input_tokens=="number")return{inputTokens:Number(n.input_tokens??0),outputTokens:Number(n.output_tokens??0),cacheReadTokens:Number(n.cache_read_input_tokens??0),cacheCreateTokens:Number(n.cache_creation_input_tokens??0),...jw(n)};for(const s of Object.values(n)){const i=rT(s,t+1);if(i)return i}return null}const uL=/^(?:claude[-_]|gpt[-_]|o\d|codex[-_])/i;function sT(e,t=0){if(!e||typeof e!="object"||t>6)return null;const n=e;if(typeof n.model=="string"&&uL.test(jl(n.model)))return n.model;for(const s of Object.values(n)){const i=sT(s,t+1);if(i)return i}return null}function Hv(){return{agents:new Map,toolIndex:new Map,toolOwner:new Map,activeSubagentStack:new Map,lastSeq:0,seqEpoch:null,totalEvents:0,revision:0}}function $s(e){if(!e)return;const t=e.replace(/\\/g,"/").split("/").filter(Boolean);return t[t.length-1]}function Xb(){return{msgsUser:0,msgsAssistant:0,toolUses:0,toolResults:0,systemReminders:0,currentContextTokens:0,memoryFiles:[]}}function Tl(e,t){return`${e}::${t}`}function Au(e){return e.agent_type??e.subagent_type??"subagent"}function ll(e){return e.agent_id?e.agent_id:e.parent_tool_use_id?e.parent_tool_use_id:null}function Pi(e,t,n,s){const i=t;let a=e.agents.get(i);return a||(a={id:i,sessionId:t,label:"session",kind:"root",state:"active",startedAt:n,lastEventAt:n,tools:[],prompts:[],toolCount:0,childCount:0,synthetic:s,usage:nT()},e.agents.set(i,a),a)}function oT(e,t,n,s){const i=Tl(t,n),a=e.agents.get(i);if(!a)return null;!a.cwd&&s.cwd&&(a.cwd=s.cwd,a.cwdBasename=$s(s.cwd));const l=Au(s);return l&&(a.label==="subagent"||!a.label)&&(a.label=l),a}function dL(e,t,n){const s=t.session_id??"unknown",i=ll(t);if(i){const h=oT(e,s,i,t);if(h)return h}const a=e.activeSubagentStack.get(s),l=a&&a.length>0?a[a.length-1]:null;if(l){const h=e.agents.get(Tl(s,l));if(h)return!h.cwd&&t.cwd&&(h.cwd=t.cwd,h.cwdBasename=$s(t.cwd)),h}const u=Pi(e,s,n,t.hook_event_name!=="SessionStart");return!u.cwd&&t.cwd&&(u.cwd=t.cwd,u.cwdBasename=$s(t.cwd)),u.label==="session"&&t.cwd&&(u.label=$s(t.cwd)??"session"),u}function fL(e,t,n,s,i){const a=Tl(t,n),l=Pi(e,t,i,!0);let u=e.agents.get(a);if(u){!u.cwd&&s.cwd&&(u.cwd=s.cwd,u.cwdBasename=$s(s.cwd));const h=Au(s);return h&&(u.label==="subagent"||!u.label)&&(u.label=h),u}return u={id:a,sessionId:t,label:Au(s),kind:"subagent",parentId:l.id,state:"active",startedAt:i,tools:[],prompts:[],cwd:s.cwd,cwdBasename:$s(s.cwd),toolCount:0,childCount:0,usage:nT()},e.agents.set(a,u),l.childCount+=1,u}function hL(e,t,n){const s=e.activeSubagentStack.get(t)??[];s.includes(n)||(s.push(n),e.activeSubagentStack.set(t,s))}function pL(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 iu(e,t=80){if(e==null)return"";if(typeof e=="string")return e.length>t?e.slice(0,t-1)+"…":e;try{const n=JSON.stringify(e);return n.length>t?n.slice(0,t-1)+"…":n}catch{return String(e)}}const Qb=200,mL=25;function gL(e,t){const n=t.tools;if(n.length>Qb){const s=n.splice(0,n.length-Qb);for(const i of s)e.toolIndex.get(i.id)===i&&(e.toolIndex.delete(i.id),e.toolOwner.delete(i.id))}for(let s=n.length-mL-1;s>=0;s--){const i=n[s];if(i.trimmed)break;i.input=void 0,i.response=void 0,i.trimmed=!0}}function yL(e,t,n){const s=e.toolIndex.get(n);if(s)return s;for(let i=t.tools.length-1;i>=0;i--)if(t.tools[i].id===n)return t.tools[i];return null}const Zb=2e3;function vL(e,t,n){for(let s=e.prompts.length-1;s>=0;s--){const i=e.prompts[s];if(i.at<t-Zb)return!1;if(i.text===n&&i.at<=t+Zb)return!0}return!1}function iT(e,t){for(const n of t.tools)e.toolIndex.get(n.id)===n&&e.toolIndex.delete(n.id),e.toolOwner.get(n.id)===t.id&&e.toolOwner.delete(n.id)}function Rl(e,t){return t&&(e.revision+=1),t}function wL(e,t,n,s){if(e.agents.size<=n)return!1;const i=p=>p.state==="done"&&p.endedAt!=null&&t-p.endedAt>s,a=[],l=new Map;for(const[p,f]of e.agents){if(f.parentId!=null){const g=l.get(f.parentId);g?g.push(p):l.set(f.parentId,[p])}i(f)&&a.push({id:p,endedAt:f.endedAt})}if(a.length===0)return!1;a.sort((p,f)=>p.endedAt-f.endedAt);let u=0;const h=p=>{const f=e.agents.get(p);f&&(iT(e,f),e.agents.delete(p),u++)};for(const p of a){if(e.agents.size<=n)break;if(!e.agents.has(p.id))continue;const f=(l.get(p.id)??[]).map(g=>e.agents.get(g)).filter(g=>g!=null);if(!f.some(g=>!i(g))){for(const g of f)h(g.id);h(p.id)}}return Rl(e,u>0)}function xL(e,t,n,s){const i=new Map;for(const[p,f]of e.agents){let g=i.get(f.sessionId);g||(g={ids:[],endedAt:0,live:!1,closed:!1},i.set(f.sessionId,g)),g.ids.push(p),f.kind==="root"&&f.closedAt!=null&&(g.closed=!0),f.state==="done"&&f.endedAt!=null?g.endedAt=Math.max(g.endedAt,f.endedAt):g.live=!0}const a=[...i.values()].filter(p=>!p.live&&p.endedAt>0&&t-p.endedAt>s).sort((p,f)=>p.closed===f.closed?p.endedAt-f.endedAt:p.closed?-1:1);let u=[...i.values()].filter(p=>!p.live).length-n;if(u<=0)return!1;let h=!1;for(const p of a){if(u<=0)break;for(const f of p.ids){const g=e.agents.get(f);g&&iT(e,g),e.agents.delete(f)}u--,h=!0}return Rl(e,h)}function bL(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 kL(e){let t=!1;for(const n of e.agents.values())for(const s of n.tools)s.endedAt!=null||s.outcomeGap||(s.outcomeGap=!0,t=!0);return Rl(e,t)}function _L(e,t,n){let s=!1;for(const i of e.agents.values()){if(i.provider==="codex")continue;const a=e.agents.get(i.sessionId),l=(a==null?void 0:a.lastEventAt)??(a==null?void 0:a.startedAt);for(const u of i.tools){const h=Math.max(u.startedAt,l??u.startedAt);u.endedAt==null&&t-h>n&&(u.endedAt=h,u.ok=!1,u.errorPreview=u.outcomeGap?"no result reached the deck — events were dropped while the deck was paused":"session ended before this call returned",e.toolIndex.delete(u.id),e.toolOwner.delete(u.id),s=!0)}}return Rl(e,s)}const Jb=90*6e4;function SL(e,t,n){let s=!1;for(const i of e.agents.values()){if(i.kind!=="root")continue;const a=i.lastEventAt??i.startedAt;if(!(t-a<=n)){i.waiting&&(i.waiting=null,s=!0),i.closedAt==null&&(i.closedAt=a),i.state==="active"&&(i.state="done",i.endedAt=a,i.reaped=!0,s=!0);for(const l of e.agents.values())l.sessionId!==i.sessionId||l.kind==="root"||l.state!=="active"||(l.state="done",l.endedAt=a,s=!0);e.activeSubagentStack.delete(i.sessionId)}}return Rl(e,s)}function NL(e){return e==="permission_prompt"?"permission":e==="agent_needs_input"?"asked":e==="idle_prompt"?"idle":null}const EL=new Set(["Notification","ModelObserved","ContextObserved","UsageObserved","SessionNamed"]);function CL(e,t){let n=null;for(const s of e.toolIndex.values()){const i=s.agentId?e.agents.get(s.agentId):void 0;!i||i.sessionId!==t||(!n||s.startedAt>n.startedAt)&&(n=s)}return n}const jL=3e4;function TL(e,t){if(!(!e||!e.name)&&!(t-e.startedAt>jL)&&!(e.startedAt>t))return{name:e.name,preview:aL(e.input)??""}}function RL(e,t,n,s,i){if(n!=="permission")return{kind:n,message:s,since:i};const a=CL(e,t),l={kind:n,message:s,since:i};a!=null&&a.explicitSubagentId&&(l.subagentId=a.explicitSubagentId);const u=TL(a,i);return u&&(l.tool=u),l}function AL(e,t,n){if(e.kind==="idle")return!0;const s=ll(t);return s==null?!0:e.subagentId!=null&&Tl(n,s)===e.subagentId}function e1(e,t){const n=t.epoch??null;if(n!==null&&n!==e.seqEpoch)e.seqEpoch=n,e.lastSeq=0;else if(t.seq<=e.lastSeq)return e;const s=t.payload??{},i=t.receivedAt,a=s.hook_event_name??"Unknown";if(a==="__clear")return{...Hv(),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(!EL.has(a)){const f=e.agents.get(l);f!=null&&f.waiting&&AL(f.waiting,s,l)&&(f.waiting=null)}const u=e.agents.get(l);if(u&&i>(u.lastEventAt??0)&&(u.lastEventAt=i,u.reaped&&(u.reaped=!1,u.state="active",u.endedAt=void 0,u.closedAt=void 0)),typeof s.model_context_window=="number"&&s.model_context_window>0){const f=e.agents.get(l);f&&(f.contextWindow=s.model_context_window)}if(typeof s.approval_policy=="string"&&s.approval_policy){const f=e.agents.get(l);f&&(f.approvalPolicy=s.approval_policy)}if(typeof s.context_tokens=="number"&&s.context_tokens>=0){const f=e.agents.get(l);f&&(f.context={...f.context??Xb(),currentContextTokens:s.context_tokens})}if(a==="ModelObserved"){const f=typeof s.model=="string"?s.model:null;if(f){const v=e.agents.get(l);v&&(v.model=f)}const g=s.subagentModels;if(g&&typeof g=="object")for(const[v,w]of Object.entries(g)){if(typeof w!="string")continue;const E=`${l}::${v}`,b=e.agents.get(E);b&&(b.model=w)}return e}if(a==="ContextObserved"){const f=s.context??null;if(f){const g=e.agents.get(l);if(g){const v=g.context??Xb(),w=(b,k)=>typeof f[b]=="number"?f[b]:k,E=Array.isArray(f.memoryFiles)?f.memoryFiles:Array.isArray(f.claudeMdFiles)?f.claudeMdFiles:null;g.context={msgsUser:w("msgsUser",v.msgsUser),msgsAssistant:w("msgsAssistant",v.msgsAssistant),toolUses:w("toolUses",v.toolUses),toolResults:w("toolResults",v.toolResults),systemReminders:w("systemReminders",v.systemReminders),currentContextTokens:w("currentContextTokens",v.currentContextTokens),memoryFiles:E??v.memoryFiles}}}return e}if(a==="SessionNamed"){const f=e.agents.get(l);if(f){const g=typeof s.sessionName=="string"?s.sessionName.trim():"",v=typeof s.sessionTitle=="string"?s.sessionTitle.trim():"";g&&(f.sessionName=g),v&&(f.sessionTitle=v);const w=f.sessionName??"";f.sessionTitle&&w&&f.sessionTitle.toLowerCase()===w.toLowerCase()&&(f.sessionTitle=void 0)}return e}if(a==="UsageObserved"){const f=s.usage??null;if(f){const g=e.agents.get(l);if(g){g.usage.inputTokens=Number(f.input_tokens??0),g.usage.outputTokens=Number(f.output_tokens??0),g.usage.cacheReadTokens=Number(f.cache_read_input_tokens??f.cached_input_tokens??0),g.usage.cacheCreateTokens=Number(f.cache_creation_input_tokens??f.cache_write_input_tokens??0);const v=jw(f);g.usage.cacheCreate1hTokens=v.cacheCreate1hTokens,g.usage.cacheCreate5mTokens=v.cacheCreate5mTokens,typeof f.reasoning_output_tokens=="number"&&(g.usage.reasoningOutputTokens=Number(f.reasoning_output_tokens)),g.usageByModel=cL(s.usageByModel)}}return e}const h=dL(e,s,i);h.provider||(h.provider=s.provider==="codex"?"codex":"claude");const p=sT(s);switch(p&&(h.model=p),a){case"SessionStart":{const f=Pi(e,l,i,!1);f.synthetic=!1,f.state="active",f.closedAt=void 0,f.startedAt=f.startedAt||i,!f.cwd&&s.cwd&&(f.cwd=s.cwd,f.cwdBasename=$s(s.cwd)),f.label==="session"&&s.cwd&&(f.label=$s(s.cwd)??"session");break}case"UserPromptSubmit":{for(const v of e.agents.values())v.sessionId===l&&v.kind==="subagent"&&v.state==="done"&&v.exitAt==null&&v.endedAt!=null&&v.endedAt<i&&(v.exitAt=i);const f=Pi(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&&!vL(f,i,g)&&(f.prompts.push({at:i,text:g}),f.firstPrompt||(f.firstPrompt=iu(g,120)));break}case"PreToolUse":{const f=s.tool_use_id?yL(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=iu(s.tool_input));break}const g=s.tool_use_id??`${h.id}:${h.toolCount}`,v=ll(s),w={id:g,name:s.tool_name??"?",input:s.tool_input,inputPreview:iu(s.tool_input),agentId:h.id,explicitSubagentId:v?Tl(l,v):void 0,startedAt:i};h.tools.push(w),h.toolCount+=1,h.state="active",e.toolIndex.set(g,w),e.toolOwner.set(g,h.id),gL(e,h);break}case"PostToolUse":case"PostToolUseFailure":{const f=s.tool_use_id;if(!f)break;let g=e.toolIndex.get(f),v=!1;if(!g)for(const E of e.agents.values()){const b=E.tools.find(k=>k.id===f);if(b){g=b,v=!0;break}}if(!g||g.outcomeApplied)break;g.outcomeApplied=!0,g.outcomeGap=void 0,g.endedAt=i,g.ok=a==="PostToolUse",g.trimmed||(g.response=s.tool_response),a==="PostToolUseFailure"?g.errorPreview=iu(s.tool_response):v&&(g.errorPreview=void 0);const w=rT(s.tool_response);w&&(g.usage=w),e.toolIndex.delete(f),e.toolOwner.delete(f);break}case"SubagentStart":{const f=ll(s);if(!f)break;const g=fL(e,l,f,s,i);g.state="active",g.startedAt=g.startedAt||i,g.exitAt=void 0,g.endedAt=void 0;const v=Au(s);v&&(g.label=v),hL(e,l,f);break}case"SubagentStop":{const f=ll(s);if(!f)break;const g=oT(e,l,f,s);if(!g)break;g.state="done",g.endedAt=i,pL(e,l,f);break}case"Stop":case"SessionEnd":{const f=Pi(e,l,i,!1);f.state="done",f.endedAt=i,a==="SessionEnd"&&(f.closedAt=i),e.activeSubagentStack.delete(l);break}case"Notification":{const f=NL(s.notification_type);if(!f)break;const g=Pi(e,l,i,!1),v=typeof s.message=="string"?s.message:"",w=g.waiting;g.waiting=w&&w.kind===f&&w.message===v?{...w,since:Math.min(w.since,i)}:RL(e,l,f,v,i);break}}return e}function Tw(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 ML={input:2,output:10,cacheRead:.2,cacheWrite:2.5,cacheWrite1h:4},IL=[{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:ML},{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 OL(e){return e?/^(?:gpt[-_]|codex[-_]|o\d)/i.test(e):!1}function Zi(e,t=Date.now()){if(!e)return null;const n=jl(e);for(const s of IL)if(s.match.test(n))return typeof s.rates=="function"?s.rates(t):s.rates;return null}function aT(e,t){const n=Math.max(0,e.cacheCreate1hTokens??0),s=Math.max(0,e.cacheCreate5mTokens??0),i=Math.max(0,e.cacheCreateTokens-n-s),a=s+i,l=t.cacheWrite1h??t.cacheWrite;return{tokens5m:a,tokens1h:n,usd5m:a*t.cacheWrite/1e6,usd1h:n*l/1e6}}function lT(e,t,n=Date.now()){if(!OL(t))return e.inputTokens;const s=Zi(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 Rw(e,t,n=Date.now()){const s=Zi(t,n);if(!s)return{input:0,output:0,cacheRead:0,cacheWrite:0,total:0};const i=lT(e,t,n)*s.input/1e6,a=e.outputTokens*s.output/1e6,l=e.cacheReadTokens*s.cacheRead/1e6,u=aT(e,s),h=u.usd5m+u.usd1h;return{input:i,output:a,cacheRead:l,cacheWrite:h,total:i+a+l+h}}const t1=2e5,PL=1e6,$L=[/\[1m\]/i,/^claude[-_]opus[-_]5\b/i,/^claude[-_]sonnet[-_]5\b/i,/^claude[-_]opus[-_]4[-_.](?:5|6|7|8)\b/i,/^claude[-_]sonnet[-_]4[-_.]6\b/i,/^claude[-_](fable|mythos)[-_]5\b/i],LL=[{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 qL(e){if(!e)return t1;const t=jl(e);for(const n of $L)if(n.test(t))return PL;for(const n of LL)if(n.match.test(t))return n.window;return t1}function cT(e,t){return typeof e=="number"&&e>0?e:qL(t)}const Ii="not priced";function rt(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 Aw(e,t){if(e<=0||t<10)return null;const n=e/t,s=n*60;return s>=.01?`${rt(s)}/min`:`${rt(n*3600)}/hr`}function DL(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 FL(e,t){let n=0,s=0,i=0,a=0,l=0,u=0;for(const g of t)n+=g.inputTokens,s+=g.outputTokens,i+=g.cacheReadTokens,a+=g.cacheCreateTokens,l+=g.cacheCreate1hTokens??0,u+=g.cacheCreate5mTokens??0;const h=(g,v)=>Math.max(0,g-v),p={inputTokens:h(e.inputTokens,n),outputTokens:h(e.outputTokens,s),cacheReadTokens:h(e.cacheReadTokens,i),cacheCreateTokens:h(e.cacheCreateTokens,a)};return(e.cacheCreate1hTokens!==void 0||e.cacheCreate5mTokens!==void 0)&&(p.cacheCreate1hTokens=h(e.cacheCreate1hTokens??0,l),p.cacheCreate5mTokens=h(e.cacheCreate5mTokens??0,u)),p.inputTokens+p.outputTokens+p.cacheReadTokens+p.cacheCreateTokens>0?p:null}function Al(e){const t=e.usageByModel,n=t?Object.keys(t):[];if(!t||n.length===0)return[{model:e.model,usage:e.usage}];const s=n.map(a=>({model:a,usage:t[a]})),i=FL(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:DL(s[a].usage,i)}:s.push({model:e.model,usage:i})}return s}function bn(e,t=Date.now()){const n={input:0,output:0,cacheRead:0,cacheWrite:0,total:0};for(const s of Al(e)){const i=Rw(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 Gv(e,t=Date.now()){let n=0;for(const s of Al(e))Zi(s.model,t)==null&&(n+=s.usage.inputTokens+s.usage.outputTokens);return n}function uT(e){const t=[];for(const n of Al(e)){if(!n.model||t.includes(n.model))continue;const s=n.usage;s.inputTokens+s.outputTokens+s.cacheReadTokens+s.cacheCreateTokens<=0||t.push(n.model)}return t}function dT(e){return uT(e).filter(t=>t!==e.model)}const zL=new Set(["untrusted","on-request","on-failure"]);function BL(e){return typeof e!="string"||!e?null:zL.has(e)?!0:e==="never"?!1:null}function UL(e){if(e.provider!=="codex"||e.kind!=="root"||e.waiting||e.state!=="active")return null;const t=BL(e.approvalPolicy);return t===!1?null:{label:"approvals not visible",detail:`${t===!0?`This session's approval policy is "${e.approvalPolicy}", so Codex can stop and ask you to approve a command.`:"This session's approval policy has not been read yet, so it may be able to stop and ask you to approve a command."}
|
|
58
|
+
|
|
59
|
+
Codex writes no approval request to its rollout files, which are the only thing this deck can read — so when it does ask, this card, the sidebar, the topbar count, the tab title and the favicon will all stay silent. Check the terminal.`}}function n1(e){return e[0].toUpperCase()+e.slice(1).toLowerCase()}function Ls(e){const t=jl(e).replace(/[-_]\d{8}(?!\d)/,""),n=t.match(/^claude[-_](opus|sonnet|haiku|fable|mythos)[-_](\d+(?:[-_.]\d+)*)/i);if(n){const i=n1(n[1]),a=n[2].replace(/[-_]/g,".");return`${i} ${a}`}const s=t.match(/^gpt[-_](\d+(?:[-_.]\d+)*)((?:[-_][A-Za-z0-9.]+)*)$/i);if(s){const i=s[1].replace(/[-_]/g,"."),a=s[2].split(/[-_]/).filter(Boolean).map(n1);return[`GPT-${i}`,...a].join(" ")}return e}function Hu(e){const t=jl(e??""),n=t.match(/^claude[-_](opus|sonnet|haiku|fable|mythos)[-_]/i);return n?n[1].toLowerCase():/^gpt[-_]/i.test(t)?"gpt":""}function Ml(e){return(e==null?void 0:e.kind)==="permission"||(e==null?void 0:e.kind)==="asked"}function WL(e){const t=[];for(const n of e)n.kind==="root"&&Ml(n.waiting)&&t.push({id:n.id,label:n.label,waiting:n.waiting});return t.sort((n,s)=>n.waiting.since-s.waiting.since)}function HL(e){const t=new Set;for(const n of e)n.state==="active"&&t.add(n.sessionId);return t.size}function Gu(e,t){return`${e}@${t.since}`}function fT(e,t){if(!e.tool)return null;const{name:n,preview:s}=e.tool,i=new RegExp(`\\b${n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`,"i").test(t);return s?i?s:`${n} · ${s}`:i?null:n}function GL(e){const t=e.message||"Needs your permission",n=fT(e,t);return n?`${t}
|
|
60
|
+
Likely on: ${n}`:t}function VL(e,t,n,s=!0){if(!s)return[];if(n)return[];const i=[];for(const a of e){if(!Ml(a.waiting))continue;const l=Gu(a.id,a.waiting);t.has(l)||i.push({key:l,title:a.label,body:GL(a.waiting),sessionId:a.id})}return i}function YL(e,t,n){const s=new Set;for(const a of e)s.add(Gu(a.id,a.waiting));const i=new Set;for(const a of n)s.has(a)&&i.add(a);for(const a of t)i.add(a.key);return i}function r1(e){return new Set(e.map(t=>Gu(t.id,t.waiting)))}function KL(e,t){return e!==t}function XL(e,t){return t&&e==="default"}function At(e){return e<1e3?`${e}`:e<1e6?`${(e/1e3).toFixed(1)}k`:e<1e9?`${(e/1e6).toFixed(2)}M`:`${(e/1e9).toFixed(2)}B`}function Mu(e,t,n){const s=(t??n)-e;if(s<1e3)return`${Math.max(0,s)}ms`;const i=Math.floor(s/1e3);if(i<60)return`${i}s`;const a=Math.floor(i/60),l=i%60;return`${a}m ${String(l).padStart(2,"0")}s`}function hT(e,t){if(e.endedAt==null)return t;const n=e.endedAt-e.startedAt;return n<1e3?`${n}ms`:`${(n/1e3).toFixed(2)}s`}function pT(e,t){const n=typeof e=="string"?e.trim():"",s=typeof t=="string"?t.trim():"";return{face:n||s||void 0,tooltip:s||n||void 0}}const QL=1,mT=-1;function ZL(){const e=[];let t=0;function n(){let s;for(const i of e)(!s||i.layer>s.layer||i.layer===s.layer&&i.seq>s.seq)&&(s=i);return s}return{push(s,i=0){const a={dismiss:s,layer:i,seq:t++};return e.push(a),()=>{const l=e.indexOf(a);l!==-1&&e.splice(l,1)}},dismissTop(){const s=n();return s?(s.dismiss(),!0):!1},isTop(s){const i=n();return i!=null&&i.dismiss===s},depth(){return e.length},topIsPanel(){const s=n();return s!=null&&s.layer===mT}}}const Fi=ZL();function JL(e){return e.overlayOpen&&!e.panelOnTop?"dismiss":e.typing?"blur":e.overlayOpen?"dismiss":"clear-selection"}function s1(e){return String(e.tagName??"").toUpperCase()==="BODY"}function e3(e,t){return!e||!e.isConnected||s1(e)?!1:t==null||s1(t)}const o1="a[href], button, input, select, textarea, [tabindex]";function t3(e){return!e||e.disabled||e.rendered===!1?!1:(e.tabIndex??0)>=0}function n3(e){if(!e||!e.overflowing||e.hasFocusable)return!1;const t=String(e.overflow??"").toLowerCase();return t==="auto"||t==="scroll"}function r3({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 Mw(e){return e.ctrlKey||e.metaKey||e.altKey}const s3=new Set(["button","checkbox","color","file","image","radio","range","reset","submit"]),o3=new Set(["INPUT","TEXTAREA","SELECT","OPTION","BUTTON","SUMMARY","A"]),i3=new Set(["button","checkbox","combobox","link","listbox","menu","menubar","menuitem","menuitemcheckbox","menuitemradio","option","radio","searchbox","slider","spinbutton","switch","tab","textbox","treeitem"]);function gT(e){return typeof e.tagName=="string"?e.tagName.toUpperCase():""}function Iw(e){if(!e)return!1;if(e.isContentEditable)return!0;const t=gT(e);return t==="TEXTAREA"?!0:t!=="INPUT"?!1:!s3.has(String(e.type??"text").toLowerCase())}function a3(e){if(!e)return!1;if(Iw(e)||o3.has(gT(e)))return!0;const t=typeof e.role=="string"?e.role.trim().toLowerCase():"";return t!==""&&t.split(/\s+/).some(n=>i3.has(n))}function l3({key:e,modalOpen:t,sheetOpen:n}){return t?!(e==="?"&&n):!1}function yT(e){return e?Array.from(e.querySelectorAll("*")).filter(t=>{if(t.matches(o1))return t3({disabled:t.disabled,tabIndex:t.tabIndex,rendered:t.getClientRects().length>0});const n=t.scrollHeight>t.clientHeight;return n&&n3({overflowing:n,overflow:getComputedStyle(t).overflowY,hasFocusable:t.querySelector(o1)!=null})}):[]}function c3(e,t){const n=yT(e);if(!t||!e.contains(t)||n.includes(t))return n;const s=n.findIndex(i=>(t.compareDocumentPosition(i)&Node.DOCUMENT_POSITION_FOLLOWING)!==0);return s===-1?[...n,t]:[...n.slice(0,s),t,...n.slice(s)]}function _n(e,t={}){const{focusRef:n,layer:s}=t,i=_.useRef(null),a=_.useRef(e);a.current=e;const l=_.useRef(null);l.current===null&&(l.current=()=>a.current());const u=l.current;return _.useEffect(()=>Fi.push(u,s),[u,s]),_.useEffect(()=>{var p;const h=document.activeElement;return(p=(n==null?void 0:n.current)??yT(i.current)[0])==null||p.focus(),()=>{e3(h,document.activeElement)&&h.focus()}},[]),_.useEffect(()=>{const h=p=>{var b;if(p.key!=="Tab"||Mw(p))return;const f=i.current;if(!f)return;const g=document.activeElement;if(!(g!=null&&f.contains(g))&&!Fi.isTop(u))return;const w=c3(f,g),E=r3({count:w.length,index:g?w.indexOf(g):-1,shiftKey:p.shiftKey});E.kind!=="allow"&&(p.preventDefault(),E.kind==="focus"&&((b=w[E.index])==null||b.focus()))};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[u]),i}function u3(e){return e==="codex"?{subtitle:"reported by the Codex CLI — as of its most recent request",windowScope:"last request",compositionCounted:!1,compositionUncounted:"Not counted for Codex — the deck reconstructs the session from its rollout file and skips whatever was written before it attached, so a message and tool-call breakdown here would be short by an unknown amount. The window figure above is the CLI's own and is unaffected.",memoryHeading:"AGENTS.md files in scope",memoryEmpty:"No AGENTS.md files found on the path from cwd to the filesystem root, or in $CODEX_HOME."}:{subtitle:"approximation — CC's /context isn't hook-exposed",windowScope:"current turn",compositionCounted:!0,compositionUncounted:"",memoryHeading:"CLAUDE.md files in scope",memoryEmpty:"No CLAUDE.md files found on the path from cwd to ~/.claude."}}function $n(e){return e.toLocaleString()}function d3(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(2)} MB`}const f3=60;function h3(e,t=f3){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 p3({agent:e,onClose:t}){var v;const n=_.useRef(null),s=_n(t,{focusRef:n}),i=e.context,a=e.usage,l=(i==null?void 0:i.currentContextTokens)??0,u=cT(e.contextWindow,e.model),h=Math.min(100,l/u*100),p=bn(e),f=a.inputTokens+a.cacheReadTokens+a.cacheCreateTokens,g=u3(e.provider);return d.jsx("div",{className:"ctx-modal-backdrop",onClick:t,role:"presentation",children:d.jsxs("div",{ref:s,className:"ctx-modal",onClick:w=>w.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Context breakdown",children:[d.jsxs("header",{className:"ctx-modal-head",children:[d.jsxs("div",{children:[d.jsxs("div",{className:"ctx-modal-title",children:["Context · ",e.label]}),d.jsx("div",{className:"ctx-modal-sub",children:g.subtitle})]}),d.jsx("button",{type:"button",ref:n,className:"glyph-btn ctx-modal-close",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),d.jsxs("section",{className:"ctx-window-row",children:[d.jsx("div",{className:"ctx-window-bar",role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(h),children:d.jsx("div",{className:"ctx-window-fill",style:{width:`${h}%`}})}),d.jsxs("div",{className:"ctx-window-meta",children:[d.jsxs("span",{className:"ctx-window-pct",children:[h.toFixed(1),"%"]}),d.jsxs("span",{children:[$n(l)," / ",$n(u)," tok (",g.windowScope,")"]})]})]}),d.jsx("h3",{className:"ctx-section-title",children:"Cumulative usage · whole session"}),d.jsxs("div",{className:"ctx-grid",children:[d.jsx(sr,{label:"input tokens",val:$n(a.inputTokens)}),d.jsx(sr,{label:"output tokens",val:$n(a.outputTokens)}),d.jsx(sr,{label:"cache reads",val:$n(a.cacheReadTokens)}),d.jsx(sr,{label:"cache writes",val:$n(a.cacheCreateTokens)}),d.jsx(sr,{label:"cumulative total",val:$n(f)}),d.jsx(sr,{label:"estimated cost",val:rt(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(sr,{label:"user messages",val:$n((i==null?void 0:i.msgsUser)??0)}),d.jsx(sr,{label:"assistant messages",val:$n((i==null?void 0:i.msgsAssistant)??0)}),d.jsx(sr,{label:"tool uses",val:$n((i==null?void 0:i.toolUses)??0)}),d.jsx(sr,{label:"tool results",val:$n((i==null?void 0:i.toolResults)??0)}),d.jsx(sr,{label:"system-reminders",val:$n((i==null?void 0:i.systemReminders)??0)})]}):d.jsx("div",{className:"ctx-empty",children:g.compositionUncounted}),d.jsx("h3",{className:"ctx-section-title",children:g.memoryHeading}),(((v=i==null?void 0:i.memoryFiles)==null?void 0:v.length)??0)===0?d.jsx("div",{className:"ctx-empty",children:g.memoryEmpty}):d.jsx("ul",{className:"ctx-md-list",children:i.memoryFiles.map(w=>d.jsxs("li",{children:[d.jsx("span",{className:"ctx-md-path",title:w.path,children:h3(w.path)}),d.jsx("span",{className:"ctx-md-size",children:d3(w.bytes)})]},w.path))})]})})}function sr({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 m3({currentContextTokens:e,modelId:t,contextWindow:n,size:s=26,onClick:i}){const a=cT(n,t),l=Math.min(1,e/a),u=s/2-3,h=s/2,p=2*Math.PI*u,f=p*l,g=l>.9?"var(--err)":l>.7?"var(--inflight)":"var(--accent)";return d.jsx("button",{type:"button",className:"ctx-donut",onClick:i,title:`context: ${e.toLocaleString()} / ${a.toLocaleString()} (${(l*100).toFixed(1)}%)`,"aria-label":"Show context breakdown",children:d.jsxs("svg",{width:s,height:s,viewBox:`0 0 ${s} ${s}`,children:[d.jsx("circle",{cx:h,cy:h,r:u,stroke:"var(--line)",strokeWidth:"2.5",fill:"none"}),d.jsx("circle",{cx:h,cy:h,r:u,stroke:g,strokeWidth:"2.5",fill:"none",strokeDasharray:`${f} ${p-f}`,strokeDashoffset:p/4,strokeLinecap:"round",style:{transition:"var(--ctx-arc-transition)"}}),d.jsx("text",{x:h,y:h+3,textAnchor:"middle",fontSize:"8",fill:"var(--text)",fontWeight:"600",children:Math.round(l*100)})]})})}function i1(e,t){const n=Zi(t);if(!n)return`model: ${t}
|
|
61
|
+
no published rate in this build — the tokens are counted, the dollars are not`;const s=f=>f.toLocaleString(),i=f=>`$${f}/MTok`,a=Rw(e,t),l=aT(e,n),u=l.tokens1h>0?[`cache w5m${s(l.tokens5m).padStart(14)} × ${i(n.cacheWrite).padEnd(11)} = ${rt(l.usd5m)}`,`cache w1h${s(l.tokens1h).padStart(14)} × ${i(n.cacheWrite1h??n.cacheWrite).padEnd(11)} = ${rt(l.usd1h)}`]:[`cache w ${s(l.tokens5m).padStart(14)} × ${i(n.cacheWrite).padEnd(11)} = ${rt(l.usd5m)}`],h=lT(e,t),p=h===e.inputTokens?"input":"uncached";return[`model: ${t}`,`${p.padEnd(9)}${s(h).padStart(14)} × ${i(n.input).padEnd(11)} = ${rt(a.input)}`,`output ${s(e.outputTokens).padStart(14)} × ${i(n.output).padEnd(11)} = ${rt(a.output)}`,`cache r ${s(e.cacheReadTokens).padStart(14)} × ${i(n.cacheRead).padEnd(11)} = ${rt(a.cacheRead)}`,...u,"─────────────────────────────────────────",`total = ${rt(a.total)}`].join(`
|
|
62
|
+
`)}function a1(e){const t=Al(e);return t.length<=1?i1(e.usage,e.model):[...t.map(n=>i1(n.usage,n.model)),"═════════════════════════════════════════",`all models = ${rt(bn(e).total)}`].join(`
|
|
63
|
+
`)}function g3({data:e,selected:t}){var v;const n=e.now??Date.now(),s=["agent-node",`state-${e.state}`,e.synthetic?"synthetic":"",t?"selected":""].filter(Boolean).join(" "),i=e.tools.filter(w=>!w.endedAt).length,a=Tw(e.sessionId),l=((v=e.context)==null?void 0:v.currentContextTokens)??0,u=e.kind==="root"&&l>0,h=e.sessionTitle?e.cwd?`${e.cwd}
|
|
64
|
+
${e.sessionTitle}`:e.sessionTitle:e.cwd,p=dT(e),f=p.length>0?`${e.model}
|
|
65
|
+
spend on this card also covers:
|
|
66
|
+
${p.join(`
|
|
67
|
+
`)}`:e.model,g=pT(e.sessionName,e.sessionTitle);return d.jsxs("div",{className:s,style:{"--session-hue":a},children:[d.jsx("span",{className:"accent-stripe"}),d.jsx(Gi,{type:"target",position:$e.Left,style:{background:"transparent",border:"none"}}),d.jsxs("div",{className:"head",children:[d.jsxs("div",{className:"title",children:[d.jsx(y3,{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(m3,{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:Mu(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":Hu(e.model),title:f,children:[Ls(e.model),p.length>0?` +${p.length}`:""]}):e.provider==="codex"?d.jsx("span",{className:"model-chip",title:"OpenAI Codex — no model reported yet",children:"Codex"}):null]}),e.kind==="root"&&g.face&&d.jsx("div",{className:"session-name",title:g.tooltip,children:g.face}),e.waiting&&d.jsx(x3,{waiting:e.waiting,now:n}),(()=>{const w=UL(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(b3,{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:At(e.usage.inputTokens+e.usage.outputTokens)})," tok"]}),e.model&&(()=>{const w=Zi(e.model),E=bn(e),b=Gv(e);if(!w&&E.total<=0)return e.usage.inputTokens+e.usage.outputTokens<=0?null:d.jsx("span",{className:"cost-unpriced",title:a1(e),children:Ii});if(E.total<=0)return null;const k=Math.max(0,((e.endedAt??n)-e.startedAt)/1e3),S=e.state==="active"?Aw(E.total,k):null,N=a1(e)+(S?`
|
|
68
|
+
burn: ${S}`:"");return d.jsxs("span",{className:"cost-meta",title:N,children:[d.jsxs("b",{children:[rt(E.total),b>0?"+":""]}),S&&d.jsx("span",{className:"cost-rate",children:S})]})})()]}),d.jsx(Gi,{type:"source",position:$e.Right,style:{background:"transparent",border:"none"}})]})}function Iu(e){return e==="active"?"live":e==="done"?"done":"err"}function y3({state:e}){return d.jsx("span",{className:`state-pill state-${e}`,children:Iu(e)})}function vl(e){return e.message?e.message:e.kind==="permission"?"Needs your permission":"Waiting for your input"}function v3(e,t){const n=fT(e,t);return n?`Likely on: ${n}`:null}function w3(e){return e.kind==="idle"?"Your turn":vl(e)}function x3({waiting:e,now:t}){const n=Ml(e),s=vl(e);return d.jsxs("div",{className:n?"waiting-row permission":"waiting-row idle",title:`${s}
|
|
69
|
+
Blocked for ${Mu(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:w3(e)}),d.jsx("b",{children:Mu(e.since,void 0,t)})]})}function b3({tools:e,now:t}){const a=new Array(24).fill(0);let l=0;for(const E of e){const b=t-E.startedAt;if(b<0||b>=6e4)continue;const k=23-Math.floor(b/2500);k>=0&&k<24&&(a[k]+=1,l+=1)}const u=Math.max(1,...a),h=Math.max(0,...a),p=132,f=14,g=p/24,v=h/(2500/1e3),w=l===0?"no tool calls in the last 60s":`${l} tool calls in last 60s · peak ${v.toFixed(1)}/s`;return d.jsxs("div",{className:"tool-spark-row",title:w,children:[d.jsx("svg",{className:"tool-spark",width:p,height:f,viewBox:`0 0 ${p} ${f}`,"aria-hidden":!0,children:a.map((E,b)=>{const k=E===0?1.5:Math.max(1.5,E/u*f),S=b===23&&E>0,C=`tool-spark-bar${E>0?" active":""}${S?" latest":""}`;return d.jsx("rect",{x:b*g+.4,y:f-k,width:Math.max(.5,g-1),height:k,rx:.8,className:C},b)})}),d.jsx("span",{className:"tool-spark-label",children:"60s"})]})}function l1(e){if(e==null)return"(none)";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function k3({tool:e,onClose:t}){const n=_n(t),s=e.endedAt==null?"inflight":e.ok===!1?"err":"done";return d.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:d.jsxs("div",{ref:n,className:"modal",onClick:i=>i.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"tool-modal-title",children:[d.jsxs("header",{className:"modal-head",children:[d.jsxs("div",{className:"modal-title",children:[d.jsx("span",{className:`status-dot ${s}`,"aria-hidden":!0}),d.jsx("span",{id:"tool-modal-title",className:"modal-tool-name",children:e.name}),d.jsxs("span",{className:"modal-tool-id",title:e.id,children:[e.id.slice(0,12),"…"]})]}),d.jsxs("div",{className:"modal-actions",children:[d.jsx("span",{className:"modal-dur",children:hT(e,"in-flight…")}),d.jsx("button",{className:"glyph-btn",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),d.jsxs("section",{className:"modal-body",children:[e.trimmed&&d.jsx("div",{className:"modal-section",children:d.jsx("p",{className:"modal-note",children:"Full payloads for this call were released to keep memory bounded — only the previews below are still held."})}),d.jsxs("div",{className:"modal-section",children:[d.jsx("h4",{children:"Input"}),d.jsx("pre",{children:l1(e.input??e.inputPreview)})]}),d.jsxs("div",{className:"modal-section",children:[d.jsxs("h4",{children:["Response ",s==="err"&&d.jsx("span",{className:"err-tag",children:"error"})]}),d.jsx("pre",{children:e.endedAt==null?"(waiting…)":l1(e.response??e.errorPreview)})]})]})]})})}const au=18,c1=26,_3=12;function S3(e){return N3(e.nodeInternals.values())}function N3(e){const t=new Map;for(const i of e){if(i.type!=="agent")continue;const a=i.data;if(!(a!=null&&a.sessionId)||a.exitAt!=null||i.width==null||i.height==null)continue;const l=i.position.x,u=i.position.y,h=l+i.width,p=u+i.height,f=t.get(a.sessionId);f?(f.minX=Math.min(f.minX,l),f.minY=Math.min(f.minY,u),f.maxX=Math.max(f.maxX,h),f.maxY=Math.max(f.maxY,p),a.kind==="root"&&(f.label=d1(a)??f.label),a.kind==="root"&&(f.name=f1(a))):t.set(a.sessionId,{minX:l,minY:u,maxX:h,maxY:p,label:d1(a)??a.sessionId,name:f1(a)})}const n=new Map;for(const i of t.values())n.set(i.label,(n.get(i.label)??0)+1);const s=[];for(const[i,a]of t){const l=(n.get(a.label)??0)>1;s.push({sessionId:i,...T3(a.label,a.name,i,l),x:a.minX-au,y:a.minY-au-c1,w:a.maxX-a.minX+au*2,h:a.maxY-a.minY+au*2+c1})}return s}const Vv=" · ",E3=32,C3=/[\u1100-\u115F\u2E80-\u303E\u3041-\u33FF\u3400-\u4DBF\u4E00-\u9FFF\uA000-\uA4CF\uAC00-\uD7A3\uF900-\uFAFF\uFE30-\uFE6F\uFF00-\uFF60\uFFE0-\uFFE6]/;function u1(e){return C3.test(e)?2:1}function j3(e,t=E3){const n=[...e];let s=0;for(const l of n)s+=u1(l);if(s<=t)return e;const i=[];let a=0;for(const l of n){const u=u1(l);if(a+u>t-1)break;i.push(l),a+=u}for(;i.length&&/[\s\-_.:/]/.test(i[i.length-1]);)i.pop();return`${i.join("")}…`}function T3(e,t,n,s){const i=(t==null?void 0:t.trim())??"",a=s?R3(n):void 0,l=[e,i||void 0,a].filter(Boolean);return{label:e,name:i?j3(i):void 0,shortId:a,fullLabel:l.join(Vv)}}function R3(e){const t=e.match(/[a-zA-Z0-9]{4}/);return t?t[0]:e.slice(0,4)}function d1(e){if(e.kind==="root")return e.label}function f1(e){if(e.kind==="root")return pT(e.sessionName,e.sessionTitle).face}function A3({onFit:e}){const{x:t,y:n,zoom:s}=Qj(),i=Cl(),a=ut(S3,M3);if(a.length<=1)return null;const l=h=>{try{const p=i.getNodes().filter(f=>{const g=f.data;return(g==null?void 0:g.sessionId)===h});if(p.length===0)return;i.fitView({padding:.3,duration:500,nodes:p}),e==null||e()}catch{}},u={transform:`translate(${t}px, ${n}px) scale(${s})`};return d.jsx("div",{className:"session-clusters",style:u,children:a.map(h=>{const p=Tw(h.sessionId),f={position:"absolute",left:h.x,top:h.y,width:h.w,height:h.h,"--session-hue":p},g={position:"absolute",left:h.x+16,top:h.y-_3,transform:`scale(${Math.min(1,s)/(s||1)})`,transformOrigin:"left top","--session-hue":p};return d.jsxs(fe.Fragment,{children:[d.jsx("div",{className:"cluster-card",style:f,"aria-hidden":!0}),d.jsxs("button",{type:"button",className:"cluster-label",style:g,title:`Fit view to ${h.fullLabel}
|
|
70
|
+
drag the wrapper to move the whole session`,onClick:()=>l(h.sessionId),children:[h.label,h.name?d.jsxs(d.Fragment,{children:[Vv,d.jsx("span",{className:"cluster-label-name",children:h.name})]}):null,h.shortId?Vv+h.shortId:null]})]},h.sessionId)})})}function M3(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 I3({data:e}){return d.jsx("div",{className:"session-group-handle",style:{width:(e==null?void 0:e.w)??0,height:(e==null?void 0:e.h)??0}})}const Il={exec:{category:"shell",emoji:"⚡",label:"Shell",shell:!0},shell:{category:"shell",emoji:"⚡",label:"Shell",shell:!0},exec_command:{category:"shell",emoji:"⚡",label:"Shell",shell:!0},shell_command:{category:"shell",emoji:"⚡",label:"Shell",shell:!0},write_stdin:{category:"shell",emoji:"💻",label:"stdin",shell:!0},wait:{category:"shell",emoji:"⏳",label:"wait",shell:!0},apply_patch:{category:"file",emoji:"🩹",label:"Edit"},update_plan:{category:"task",emoji:"📋",label:"Plan"},run:{category:"web",emoji:"🌐",label:"Web"}},O3=Object.fromEntries(Object.entries(Il).map(([e,t])=>[e,t.category])),P3=Object.fromEntries(Object.entries(Il).map(([e,t])=>[e,t.emoji])),$3=Object.fromEntries(Object.entries(Il).map(([e,t])=>[e,t.label])),L3=new Set(Object.keys(Il)),q3=new Set(Object.entries(Il).filter(([,e])=>e.shell).map(([e])=>e)),h1={Read:"file",Write:"file",Edit:"file",MultiEdit:"file",Glob:"file",Grep:"file",LS:"file",NotebookEdit:"file",Bash:"shell",PowerShell:"shell",WebFetch:"web",WebSearch:"web",Task:"agent",Agent:"agent",TodoWrite:"task",TaskCreate:"task",TaskUpdate:"task",TaskList:"task",TaskGet:"task",TaskOutput:"task",TaskStop:"task",EnterPlanMode:"plan",ExitPlanMode:"plan",AskUserQuestion:"plan",Skill:"plan",Workflow:"plan",...O3};function vT(e){return e.startsWith("mcp__")?"mcp":Object.hasOwn(h1,e)?h1[e]:"other"}const D3=/\btools\.exec_command\s*\(\s*\{[^{}]*?\bcmd\s*:\s*(["'`])((?:\\.|(?!\1)[^\\])*)\1/,F3=/\btools\.([A-Za-z_$][\w$]*)\s*\(/;function z3(e){if(typeof e!="string"||!e)return null;const t=D3.exec(e);if(t){const s=B3(t[2]);if(s.trim())return s}const n=F3.exec(e);return n?n[1]:null}function B3(e){return e.replace(/\\(["'`\\nrt])/g,(t,n)=>n==="n"?`
|
|
71
|
+
`:n==="r"?"\r":n==="t"?" ":n)}const wT=600,U3=4,W3=36,Yv=16,H3=60,G3=6,p1=220,m1=96,V3=28,g1={Read:"📖",Write:"💾",Edit:"✏️",MultiEdit:"🔧",Glob:"🗺️",Grep:"🔎",Bash:"⚡",PowerShell:"💻",LS:"📂",Task:"🤖",Agent:"🤖",TodoWrite:"📋",TaskCreate:"📋",TaskUpdate:"📝",TaskList:"🗂️",TaskGet:"🗂️",TaskOutput:"📤",TaskStop:"🛑",WebFetch:"🌐",WebSearch:"🔭",ToolSearch:"🧰",NotebookEdit:"📓",EnterPlanMode:"🧭",ExitPlanMode:"🏁",AskUserQuestion:"❓",ScheduleWakeup:"⏰",CronCreate:"⏰",CronList:"📅",CronDelete:"🗑️",Skill:"🎯",Workflow:"🎬",Monitor:"📡",PushNotification:"🔔",RemoteTrigger:"📡",...P3};function y1(e){return e.startsWith("mcp__")?"🔌":Object.hasOwn(g1,e)?g1[e]:"✨"}const v1={git:"🐙",gh:"🐙",glab:"🐙",npm:"📦",pnpm:"📦",yarn:"📦",bun:"📦",brew:"🍺",node:"🟢",deno:"🟢",python:"🐍",python3:"🐍",py:"🐍",pip:"🐍",pip3:"🐍",uv:"🐍",ruby:"💎",bundle:"💎",gem:"💎",cargo:"🦀",rustc:"🦀",rustup:"🦀",go:"🐹",docker:"🐳","docker-compose":"🐳",podman:"🐳",kubectl:"☸️",helm:"☸️",k9s:"☸️",grep:"🔎",rg:"🔎",ag:"🔎",ack:"🔎",find:"🔍",fd:"🔍",locate:"🔍",which:"🔍",ls:"📂",dir:"📂",tree:"📂",cat:"📄",head:"📄",tail:"📄",less:"📄",more:"📄",bat:"📄",cp:"📋",mv:"✂️",rm:"🗑️",rmdir:"🗑️",mkdir:"📁",touch:"📁",sed:"✏️",awk:"✏️",tr:"✏️",curl:"🌐",wget:"🌐",http:"🌐",httpie:"🌐",ssh:"🔐",scp:"🔐",rsync:"🔐",ping:"📡",make:"🔨",cmake:"🔨",ninja:"🔨",bazel:"🔨",just:"🔨",terraform:"🏗️",ansible:"📕",pulumi:"🏗️",ps:"📊",top:"📊",htop:"📊",btm:"📊",kill:"💀",pkill:"💀",systemctl:"⚙️",service:"⚙️",tar:"🗜️",zip:"🗜️",unzip:"🗜️",gzip:"🗜️","7z":"🗜️",vim:"📝",nvim:"📝",nano:"📝",emacs:"📝",code:"📝",jq:"🪺",yq:"🪺",echo:"💬",printf:"💬",ffmpeg:"🎞️",ffprobe:"🎞️",imagemagick:"🖼️",convert:"🖼️","Get-ChildItem":"📂","Get-Content":"📄","Set-Content":"💾","Out-File":"💾","Add-Content":"💾","Set-Location":"📍","Get-Location":"📍","Get-Process":"📊","Start-Process":"▶️","Stop-Process":"💀","Invoke-WebRequest":"🌐","Invoke-RestMethod":"🌐","New-Item":"📁","Remove-Item":"🗑️","Copy-Item":"📋","Move-Item":"✂️","Test-Path":"🔍","Where-Object":"🔎","ForEach-Object":"🔁","Select-Object":"🎯","Measure-Object":"📊","Get-Service":"⚙️","Restart-Service":"⚙️","ConvertTo-Json":"🪺","ConvertFrom-Json":"🪺"};function xT(e){if(!e)return null;let t=e.trim();if(!t)return null;const n=t.match(/^(?:bash|sh|zsh|fish|powershell|pwsh)(?:\.exe)?\s+(?:-c|-Command|-NoProfile|-NonInteractive|\s)+["']([^"']+)["']/i);if(n)return xT(n[1]);for(;;){const a=t.match(/^([A-Z_][A-Z0-9_]*=\S*)\s+/);if(!a)break;t=t.slice(a[0].length)}t=t.replace(/^sudo(?:\s+-\S+)*\s+/,""),t=t.replace(/^(?:time|nohup|xargs)\s+/,"");const s=t.match(/^([^\s|;&<>(]+)/);if(!s)return null;let i=s[1];return i=i.replace(/^.*[/\\]/,""),i=i.replace(/\.(exe|cmd|bat|ps1)$/i,""),i||null}function Y3(e){if(typeof e=="string")return e;if(!e||typeof e!="object")return null;const t=e;if(typeof t.script=="string"){const n=z3(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 K3=new Set(["Bash","PowerShell",...q3]),X3=L3;function Q3(e,t){return X3.has(e)||e.startsWith("mcp__")?Math.max(m1,34+t.length*7.5):m1}function Z3(e,t){if(!K3.has(e))return null;const n=Y3(t);if(!n)return null;const s=xT(n);return s?{emoji:Object.hasOwn(v1,s)?v1[s]:"⚙️",label:s,category:"shell",detail:n}:null}const J3=new Set(["Read","Write","Edit","MultiEdit","NotebookEdit","LS","Glob","apply_patch"]),w1={ts:"🟦",tsx:"🟦",d:"🟦",js:"🟨",jsx:"🟨",mjs:"🟨",cjs:"🟨",py:"🐍",pyi:"🐍",ipynb:"📓",rs:"🦀",go:"🐹",rb:"💎",erb:"💎",java:"☕",kt:"☕",scala:"☕",gradle:"☕",cs:"🔷",fs:"🔷",php:"🐘",swift:"🦅",c:"🇨",cpp:"🇨",cc:"🇨",h:"🇨",hpp:"🇨",md:"📝",mdx:"📝",rst:"📝",json:"🪺",json5:"🪺",jsonl:"🪺",yaml:"⚙️",yml:"⚙️",toml:"⚙️",ini:"⚙️",conf:"⚙️",cfg:"⚙️",xml:"📰",html:"🌐",htm:"🌐",vue:"🌐",svelte:"🌐",css:"🎨",scss:"🎨",sass:"🎨",less:"🎨",sh:"⚡",bash:"⚡",zsh:"⚡",fish:"⚡",ps1:"⚡",txt:"📄",log:"📄",out:"📄",csv:"📊",tsv:"📊",xlsx:"📊",xls:"📊",pdf:"📕",png:"🖼️",jpg:"🖼️",jpeg:"🖼️",gif:"🖼️",webp:"🖼️",svg:"🖼️",ico:"🖼️",mp4:"🎬",mov:"🎬",avi:"🎬",mkv:"🎬",webm:"🎬",mp3:"🎵",wav:"🎵",ogg:"🎵",flac:"🎵",zip:"🗜️",tar:"🗜️",gz:"🗜️",bz2:"🗜️","7z":"🗜️",xz:"🗜️",rar:"🗜️",env:"🔐",lock:"🔐",pem:"🔐",key:"🔐",crt:"🔐",sql:"🗄️",db:"🗄️",sqlite:"🗄️",parquet:"🗄️"},x1={dockerfile:"🐳",makefile:"🔨",rakefile:"💎","package.json":"📦","pnpm-lock.yaml":"📦","yarn.lock":"📦","cargo.toml":"🦀","cargo.lock":"🦀","go.mod":"🐹","go.sum":"🐹","pyproject.toml":"🐍","requirements.txt":"🐍","readme.md":"📖",readme:"📖",license:"📜",".gitignore":"🐙",".gitattributes":"🐙",".env":"🔐",".dockerignore":"🐳"};function eq(e){const n=e.replace(/\\/g,"/").replace(/\/+$/,""),s=n.lastIndexOf("/");return s>=0?n.slice(s+1):n}function tq(e){const t=e.toLowerCase();if(Object.hasOwn(x1,t))return x1[t];if(t.startsWith("dockerfile."))return"🐳";if(/\.(test|spec)\.[a-z]+$/.test(t))return"🧪";const n=t.lastIndexOf(".");if(n>0&&n<t.length-1){const s=t.slice(n+1);if(Object.hasOwn(w1,s))return w1[s]}return"📄"}function nq(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 rq(e,t){if(!J3.has(e))return null;const n=nq(e,t);if(!n)return null;const s=eq(n);return s?{emoji:e==="LS"?"📂":tq(s),label:s,category:"file",detail:n}:null}const b1={github:{emoji:"🐙",name:"GitHub"},git:{emoji:"🐙",name:"Git"},gitlab:{emoji:"🦊",name:"GitLab"},slack:{emoji:"💬",name:"Slack"},discord:{emoji:"💬",name:"Discord"},linear:{emoji:"📐",name:"Linear"},jira:{emoji:"🅹",name:"Jira"},atlassian:{emoji:"🅰️",name:"Atlassian"},notion:{emoji:"📓",name:"Notion"},asana:{emoji:"📋",name:"Asana"},intercom:{emoji:"💬",name:"Intercom"},figma:{emoji:"🎨",name:"Figma"},gmail:{emoji:"📧",name:"Gmail"},calendar:{emoji:"📅",name:"Calendar"},drive:{emoji:"☁️",name:"Drive"},zoom:{emoji:"📹",name:"Zoom"},spotify:{emoji:"🎵",name:"Spotify"},youtube:{emoji:"📺",name:"YouTube"},ccd_session:{emoji:"📡",name:"Session"},ccd_directory:{emoji:"📂",name:"Directory"},ccd_session_mgmt:{emoji:"📡",name:"Sessions"},mcp_registry:{emoji:"🧰",name:"Registry"},"computer-use":{emoji:"🖱️",name:"Computer"},"claude-in-chrome":{emoji:"🌐",name:"Chrome"},"claude-preview":{emoji:"👀",name:"Preview"},"scheduled-tasks":{emoji:"⏰",name:"Scheduler"},visualize:{emoji:"🎨",name:"Visualize"},"plugin-design-asana":{emoji:"📋",name:"Asana"},"plugin-design-atlassian":{emoji:"🅰️",name:"Atlassian"},"plugin-design-figma":{emoji:"🎨",name:"Figma"},"plugin-design-intercom":{emoji:"💬",name:"Intercom"},"plugin-design-linear":{emoji:"📐",name:"Linear"},"plugin-design-notion":{emoji:"📓",name:"Notion"},"plugin-design-slack":{emoji:"💬",name:"Slack"}};function Ow(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 sq(e){let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t^e.charCodeAt(n);return Math.abs(t)%360}function bT(e){const t=e.toLowerCase();return Object.hasOwn(b1,t)?b1[t]:void 0}function oq(e,t){const n=Ow(e);if(!n)return null;const{server:s,method:i}=n;if(!i)return null;const a=bT(s);return{emoji:(a==null?void 0:a.emoji)??"🔌",label:i,category:"mcp",detail:a?`${a.name} · ${i}`:`${s} · ${i}`}}function iq(e,t){return Z3(e,t)??rq(e,t)??oq(e)}const k1=$3;function kT(e){const t=Ow(e);if(t){const s=bT(t.server);return s?{emoji:s.emoji,label:s.name}:{emoji:"🔌",label:t.server,hue:sq(t.server)}}const n=Object.hasOwn(k1,e)?k1[e]:"";return n?{emoji:y1(e),label:n}:{emoji:y1(e),label:e}}function aq(e){let t=null,n="";for(const s of e){const i=Ow(s);if(i){if(!i.server)return null;if(t===null)t=i.server,n=s;else if(i.server!==t)return null}}return t===null?null:kT(n)}function lq(e){return e.endedAt==null?"inflight":e.ok===!1?"err":"done"}function cq(e,t){if(t==null)return 1;const n=e-t;return n<0?1:Math.max(0,1-n/wT)}function uq(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 dq(e,t,n,s,i,a){const l=[];for(const u of e.values()){if(!t.has(u.id)||u.exitAt!=null&&a-u.exitAt>wT)continue;const h=s.get(u.id)??n.get(u.id);if(!h)continue;const p=uq(u.tools,U3);if(p.length===0)continue;const f=u.exitAt??null,g=i.get(u.id),v=Math.max((g==null?void 0:g.width)??p1,p1),w=(g==null?void 0:g.height)??130,E=h.x,b=h.y,k=E+v,S=b+w/2;p.forEach((N,C)=>{const j=C*W3,M=E+v+H3,P=b+G3+j,I=cq(a,f),D=N.inputPreview??"",O=lq(N),A=I<.999,L=kT(N.name);l.push({id:`${u.id}::${N.id}`,toolId:N.id,agentId:u.id,toolName:N.name,name:L.label,emoji:L.emoji,status:O,category:vT(N.name),mcpHue:L.hue,inputPreview:D,fade:I,fading:A,worldX:M,worldY:P,anchorX:k,anchorY:S,spawnDx:k-M,spawnDy:S-(P+Yv)});const z=iq(N.name,N.input);if(z){const K=Q3(N.name,L.label),R=M+K+V3,Q=P,H=M+K,ne=P+Yv;l.push({id:`sub:${u.id}::${N.id}`,toolId:N.id,agentId:u.id,toolName:N.name,name:z.label,emoji:z.emoji,isSub:!0,status:O,category:z.category,inputPreview:z.detail??D,fade:I,fading:A,worldX:R,worldY:Q,anchorX:H,anchorY:ne,spawnDx:H-R,spawnDy:0})}})}return l}function fq({agents:e,visibleAgentIds:t,positions:n,pinned:s,measured:i,spotlight:a,hiddenCategories:l,now:u,onOpenTool:h}){const p=dq(e,t,n,s,i,u),f=l&&l.size>0?p.filter(g=>!l.has(g.category)):p;return d.jsx(hq,{bursts:f,spotlight:a,onOpenTool:h})}function hq({bursts:e,spotlight:t,onOpenTool:n}){const{x:s,y:i,zoom:a}=Qj();return d.jsxs("div",{className:"tool-bursts-layer","aria-hidden":!0,children:[d.jsx("svg",{className:"tool-bursts-svg",children:e.map(l=>{const u=l.anchorX*a+s,h=l.anchorY*a+i,p=(l.worldX+6)*a+s,f=(l.worldY+Yv)*a+i,g=u+(p-u)*.55,v=t!=null&&!t.has(l.agentId),w=l.fade*(v?.14:1);return d.jsx("path",{d:`M ${u} ${h} Q ${g} ${h}, ${p} ${f}`,className:`tool-conn status-${l.status}${l.fading?" fading":""}`,opacity:w},`l:${l.id}`)})}),e.map(l=>{const u=l.worldX*a+s,h=l.worldY*a+i,p={left:`${u}px`,top:`${h}px`,transform:`scale(${a})`,transformOrigin:"left top","--spawn-dx":`${l.spawnDx}px`,"--spawn-dy":`${l.spawnDy}px`},f=l.isSub?`${l.toolName} · ${l.name}`:l.toolName,g=l.inputPreview?`${f} · ${l.inputPreview}`:f,v=n!=null,w=l.mcpHue!=null?{"--mcp-hue":l.mcpHue}:{},b=t!=null&&!t.has(l.agentId)?" dim":"";return d.jsx("div",{className:"tool-burst-wrap",style:p,children:d.jsxs("div",{className:`tool-burst cat-${l.category}${l.mcpHue!=null?" mcp-hue":""} status-${l.status}${l.fading?" fading":""}${v?" clickable":""}${l.isSub?" sub":""}${b}`,style:w,title:g,onClick:v?()=>n(l.toolId):void 0,children:[d.jsx("span",{className:"tb-emoji",children:l.emoji}),d.jsx("span",{className:"tb-name",children:l.name}),l.status==="inflight"&&d.jsx("span",{className:"tb-spin"}),l.status==="done"&&d.jsx("span",{className:"tb-mark done",children:"✓"}),l.status==="err"&&d.jsx("span",{className:"tb-mark err",children:"×"})]})},l.id)})]})}function pq(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 mq="spend on this board",gq="on this board",_1=`Everything on the board right now, and only that.
|
|
72
|
+
Finished sessions are evicted from the canvas a couple of minutes after they end, and their tokens and dollars leave with them — so this figure falls on its own.
|
|
73
|
+
Press H for the totals ccusage reads off the logs on disk, which do not forget.`,_T="session spend";function Pw({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}: ${rt(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 yq({state:e,sessionId:t,onClose:n}){const s=_.useMemo(()=>vq(e,t),[e,t]),i=_.useRef(null),a=_n(n,{focusRef:i});return s?d.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:d.jsxs("div",{ref:a,className:"modal session-summary",onClick:l=>l.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"ss-title",children:[d.jsxs("div",{className:"modal-head",children:[d.jsxs("div",{className:"modal-title",children:[d.jsx("span",{className:"state-pill state-done","aria-hidden":!0,children:"done"}),d.jsx("span",{id:"ss-title",className:"modal-tool-name",title:s.cwd??s.sessionId,children:s.label}),d.jsxs("span",{className:"modal-tool-id",children:["· ",s.sessionId.slice(0,8)]})]}),d.jsxs("div",{className:"modal-actions",children:[d.jsx("span",{className:"modal-dur",title:"Total wall time",children:s.durationLabel}),d.jsx("button",{type:"button",ref:i,className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),d.jsxs("div",{className:"modal-body",children:[d.jsxs("section",{className:"ss-hero",children:[d.jsxs("div",{className:"ss-hero-left",children:[d.jsx("div",{className:"ss-cost-label",children:_T}),d.jsx("div",{className:"ss-cost",children:rt(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":Hu(l),title:l,children:Ls(l)},l))})]}),d.jsx("div",{className:"ss-hero-right",children:s.cost.total>0&&d.jsxs(d.Fragment,{children:[d.jsx(Pw,{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:rt(s.cost.input)})]}),d.jsxs("span",{className:"ssl ssl-out",children:["output ",d.jsx("b",{children:rt(s.cost.output)})]}),d.jsxs("span",{className:"ssl ssl-cr",children:["cache r ",d.jsx("b",{children:rt(s.cost.cacheRead)})]}),d.jsxs("span",{className:"ssl ssl-cw",children:["cache w ",d.jsx("b",{children:rt(s.cost.cacheWrite)})]})]})]})})]}),d.jsxs("section",{className:"ss-stats",children:[d.jsx(Ri,{label:"agents",value:s.agentCount}),d.jsx(Ri,{label:"subagents",value:s.subagentCount}),d.jsx(Ri,{label:"tool calls",value:s.toolCount}),d.jsx(Ri,{label:"prompts",value:s.promptCount}),d.jsx(Ri,{label:"tokens",value:s.tokensSum.toLocaleString()}),s.errCount>0&&d.jsx(Ri,{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 Ri({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 vq(e,t){const n=e.agents.get(t);if(!n)return null;const s=[];for(const C of e.agents.values())C.sessionId===t&&s.push(C);if(s.length===0)return null;const i={input:0,output:0,cacheRead:0,cacheWrite:0,total:0},a=new Set,l=new Map;let u=0,h=0,p=0,f=0,g=0,v,w=1/0,E=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 M of uT(C))a.add(M);C.model&&a.add(C.model),C.kind==="subagent"&&g++,h+=C.prompts.length,!v&&C.prompts.length>0&&(v=C.prompts[0].text),p+=C.usage.inputTokens+C.usage.outputTokens,u+=C.toolCount,w=Math.min(w,C.startedAt),E=Math.max(E,C.endedAt??Date.now());for(const M of C.tools)l.set(M.name,(l.get(M.name)??0)+1),M.ok===!1&&f++}const b=Math.max(0,E-w),k=Math.floor(b/1e3),S=k<60?`${k}s`:k<3600?`${Math.floor(k/60)}m ${String(k%60).padStart(2,"0")}s`:`${Math.floor(k/3600)}h ${Math.floor(k%3600/60)}m`,N=Array.from(l.entries()).sort((C,j)=>j[1]-C[1]).slice(0,5);return{sessionId:t,label:n.label||n.cwdBasename||"session",cwd:n.cwd,durationLabel:S,cost:i,modelChips:Array.from(a),agentCount:s.length,subagentCount:g,toolCount:u,promptCount:h,tokensSum:p,errCount:f,topTools:N,firstPrompt:v}}function S1(e){return e.waiting?Ml(e.waiting)?0:1:e.state==="active"?2:3}function wq(e,t){const n=[];for(const s of e.agents.values()){if(s.kind!=="root")continue;let i=s.toolCount,a=bn(s).total,l=s.endedAt??s.startedAt;for(const u of e.agents.values()){if(u.sessionId!==s.sessionId||u.kind==="root")continue;i+=u.toolCount,a+=bn(u).total;const h=u.endedAt??u.startedAt;h>l&&(l=h)}n.push({sessionId:s.sessionId,label:s.label||s.cwdBasename||"session",cwdBasename:s.cwdBasename,state:s.state,waiting:s.waiting,modelId:s.model,toolCount:i,cost:a,startedAt:s.startedAt,lastActivity:l})}return n.sort((s,i)=>{const a=S1(s),l=S1(i);return a!==l?a-l:s.waiting&&i.waiting?s.waiting.since-i.waiting.since:i.lastActivity-s.lastActivity}),n}function N1(e,t,n){const s=(t??n)-e;if(s<1e3)return"<1s";const i=Math.floor(s/1e3);if(i<60)return`${i}s`;const a=Math.floor(i/60);return a<60?`${a}m`:`${Math.floor(a/60)}h ${a%60}m`}function xq({state:e,now:t,selectedIds:n,onSelect:s,onClose:i}){const a=_.useMemo(()=>wq(e),[e,e.revision,t]),l=a.filter(h=>h.state==="active").length,u=a.filter(h=>Ml(h.waiting)).length;return d.jsxs("aside",{className:"session-list",id:"session-list","aria-label":"Sessions",children:[d.jsxs("div",{className:"sl-header",children:[d.jsxs("h2",{children:["Sessions ",d.jsx("span",{className:"sl-count",children:a.length})]}),u>0&&d.jsxs("span",{className:"sl-waiting-count",children:[u," waiting"]}),l>0&&d.jsxs("span",{className:"sl-live-count",children:[l," live"]}),d.jsx("button",{className:"glyph-btn sl-close",onClick:i,title:"Hide sidebar (L)","aria-label":"Hide session list",children:"‹"})]}),d.jsxs("div",{className:"sl-rows",children:[a.length===0&&d.jsx("div",{className:"sl-empty",children:"No sessions yet."}),a.map(h=>{const p=n.has(h.sessionId);return d.jsxs("button",{type:"button",className:`sl-row state-${h.state}${p?" selected":""}`,onClick:()=>s(h.sessionId),title:`Focus ${h.label}`,children:[d.jsx("span",{className:`sl-dot state-${h.state}`,"aria-hidden":!0}),d.jsx("span",{className:"vis-hidden",children:Iu(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":Hu(h.modelId),title:h.modelId,children:Ls(h.modelId)})]}),d.jsxs("div",{className:"sl-row-meta",children:[d.jsxs("span",{title:"tool calls",children:[d.jsx("b",{children:h.toolCount})," tools"]}),h.cost>0&&d.jsx("span",{className:"sl-cost",title:_T,children:d.jsx("b",{children:rt(h.cost)})}),h.waiting?d.jsxs("span",{className:"sl-waiting",title:[vl(h.waiting),v3(h.waiting,vl(h.waiting)),`Blocked since ${new Date(h.waiting.since).toLocaleTimeString()} · started ${new Date(h.startedAt).toLocaleString()}`].filter(Boolean).join(`
|
|
74
|
+
`),children:["waiting ",N1(h.waiting.since,void 0,t),h.waiting.tool&&d.jsxs("span",{className:"sl-waiting-tool",children:[" · ",h.waiting.tool.name]})]}):d.jsx("span",{className:"sl-elapsed",title:`Started ${new Date(h.startedAt).toLocaleString()}`,children:N1(h.startedAt,h.state==="active"?void 0:h.lastActivity,t)})]})]})]},h.sessionId)})]})]})}const bq=e=>1-Math.pow(1-e,5),ST=420;function kq(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 _q(e,t,n,s=ST){return n>=s?t:n<=0?e:e+(t-e)*bq(n/s)}function Sq(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()||!kq(e,t))return n(t),()=>{};const p=i();let f=0,g=!0;const v=()=>{if(!g)return;const w=i()-p;n(_q(e,t,w)),w<ST&&(f=a(v))};return f=a(v),()=>{g=!1,f&&l(f)}}const Kv={cost:0,inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0,sessions:0};function E1(e,t){const n=new Map;for(const s of e){if(s.kind!=="root"||!s.sessionId)continue;const i=bn(s,t);n.set(s.sessionId,{cost:i.total,inputTokens:s.usage.inputTokens,outputTokens:s.usage.outputTokens,cacheReadTokens:s.usage.cacheReadTokens,cacheCreateTokens:s.usage.cacheCreateTokens})}return n}function Nq(e,t){if(!e)return Kv;const n={...Kv};for(const[s,i]of t){const a=e.get(s);if(!a)continue;const l={cost:i.cost-a.cost,inputTokens:i.inputTokens-a.inputTokens,outputTokens:i.outputTokens-a.outputTokens,cacheReadTokens:i.cacheReadTokens-a.cacheReadTokens,cacheCreateTokens:i.cacheCreateTokens-a.cacheCreateTokens};l.cost<0||l.inputTokens<0||l.outputTokens<0||l.cost===0&&l.inputTokens===0&&l.outputTokens===0&&l.cacheReadTokens===0&&l.cacheCreateTokens===0||(n.cost+=l.cost,n.inputTokens+=Math.max(0,l.inputTokens),n.outputTokens+=Math.max(0,l.outputTokens),n.cacheReadTokens+=Math.max(0,l.cacheReadTokens),n.cacheCreateTokens+=Math.max(0,l.cacheCreateTokens),n.sessions+=1)}return n}function Xv(e,t=new Date){return new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate()-(e-1))).toISOString().slice(0,10).replace(/-/g,"")}const NT=[{key:"today",label:"today",noun:"today"},{key:"month",label:"month",noun:"this month"},{key:"all",label:"all",noun:"all time"}];function Eq(e,t=new Date){return e==="today"?Xv(1,t):e==="month"?Xv(t.getDate(),t):"20200101"}const xn=e=>typeof e=="number"&&Number.isFinite(e)?e:0,xu=e=>typeof e=="string"?e:"";function ET(e){const t=Array.isArray(e==null?void 0:e.days)?e.days:[],n=new Map;for(const s of t){const i=Array.isArray(s==null?void 0:s.modelBreakdowns)?s.modelBreakdowns:[];for(const a of i){const l=xu(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 Cq(e,t=new Map){const n=Array.isArray(e==null?void 0:e.sessions)?e.sessions:[],s=[];for(const i of n){const a=xu(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:xu(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(xu).filter(Boolean):[],lastActivityMs:Number.isFinite(u)?u:null})}return s.sort((i,a)=>a.cost-i.cost||a.tokens-i.tokens)}function CT(e){const t=e==null?void 0:e.totals;if(t&&typeof t=="object"){const h=xn(t.cacheReadTokens),p=xn(t.cacheCreationTokens),f=xn(t.inputTokens),g=xn(t.outputTokens);return{cost:xn(t.totalCost),inputTokens:f,outputTokens:g,cacheReadTokens:h,cacheCreateTokens:p,tokens:xn(t.totalTokens)||f+g+h+p}}const n=ET(e),s=h=>n.reduce((p,f)=>p+h(f),0),i=s(h=>h.inputTokens),a=s(h=>h.outputTokens),l=s(h=>h.cacheReadTokens),u=s(h=>h.cacheCreateTokens);return{cost:s(h=>h.cost),inputTokens:i,outputTokens:a,cacheReadTokens:l,cacheCreateTokens:u,tokens:i+a+l+u}}function jq(e,t){return{data:(e==null?void 0:e.data)??null,shown:(e==null?void 0:e.period)??null,stale:e!=null&&e.period!==t,baseline:(e==null?void 0:e.baseline)??null}}function Tq(e,t){var n;return((n=NT.find(s=>s.key===(e??t)))==null?void 0:n.noun)??"today"}function Rq(e,t,n){const s=e!=null,i=CT(e);return{fromRange:s,cost:s?i.cost+n.cost:t.cost.total,inputTokens:s?i.inputTokens+n.inputTokens:t.inputTokens,outputTokens:s?i.outputTokens+n.outputTokens:t.outputTokens,cacheReadTokens:s?i.cacheReadTokens+n.cacheReadTokens:t.cacheReadTokens,cacheCreateTokens:s?i.cacheCreateTokens+n.cacheCreateTokens:t.cacheCreateTokens,hasCost:s?i.cost>0:t.cost.total>0,tokenSum:s?i.tokens:t.sum,showCostBar:!s}}const Bt="ccdeck";function jT(e){const t=Math.max(0,e);return t<60?"just now":t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}function Qv(e){return jT(Math.floor(e/1e3))}function TT(e,t){const n=e-t;if(n<=0)return null;const s=Math.floor(n/86400),i=Math.floor(n%86400/3600),a=Math.floor(n%3600/60);return s>0?`${s}d ${i}h`:i>0?`${i}h ${a}m`:`${a}m`}function Aq(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function Mq(e,t,n){const s=new Date(e),i=Qv(t-e);return{label:Aq(s,new Date(t))?i:`${i} · ${s.toLocaleDateString(n,{month:"short",day:"numeric"})}`,title:s.toLocaleString(n,{dateStyle:"medium",timeStyle:"medium"})}}function RT(e,t){return{disabled:e!=null&&e!==t,busy:e===t}}function AT(e){return e==null}const Zv="self";function ar(e,t=!1){const n=RT(e?Zv:null,Zv);return{disabled:t||n.disabled,"aria-busy":n.busy}}function lr(e){return AT(e?Zv:null)}function Iq(e){return[...e==null?[]:[`#ap-more-${e}`],".accounts-panel .ap-refresh"]}function Oq(e){return e==null||e==="BODY"||e==="HTML"}function C1(e,t){if(!e)return null;const n=t-Math.floor(e/1e3);return n<10?"just now":n<60?`${n}s ago`:n<3600?`${Math.floor(n/60)}m ago`:`${Math.floor(n/3600)}h ago`}function Pq(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 sh="__unknown__";function $q(e,t,n,s){const i=Math.max(0,t-s),a=Math.max(0,n-i);if(a<120)return null;const l=Math.min(100,a/n*100),u=e-l;if(Math.abs(u)<3)return{label:"on pace",color:"var(--ok)",expectedPct:l,isDeficit:!1};if(u>0){const h=100-e,p=a>0?e/a:0,f=p>0?h/p:1/0,g={label:`${Math.round(u)}% ahead`,color:"var(--warn)",expectedPct:l,isDeficit:!0};if(f<i&&f<86400){const v=Math.floor(f/3600),w=Math.floor(f%3600/60);g.runsOutIn=v>0?`${v}h ${w}m`:`${w}m`}return g}return{label:`${Math.round(-u)}% reserve`,color:"var(--ok)",expectedPct:l,isDeficit:!1}}function mo({pct:e,label:t,reset:n,resetAt:s,windowSec:i,limitReached:a,nowSec:l}){const u=Math.min(100,Math.max(0,e)),p=a||u>=90?"var(--err)":u>=70?"var(--warn)":"var(--accent)",f=u===0?"< 1%":`${u}%`,g=u===0?2:u,v=s?TT(s,l):null,w=s&&i?$q(u,s,i,l):null;return d.jsxs("div",{className:"qb-row",children:[d.jsxs("div",{className:"qb-meta",children:[d.jsxs("span",{className:"qb-label",children:[t,a&&d.jsx("span",{className:"qb-limit-badge",title:"Rate limit reached",children:"⛔"})]}),d.jsx("span",{className:"qb-pct",style:{color:p},children:f})]}),d.jsxs("div",{className:"qb-track",children:[d.jsx("div",{className:"qb-fill",style:{width:`${g}%`,background:p,opacity:u===0?.4:1}}),w&&d.jsx("div",{className:"qb-pace-marker",style:{left:`${w.expectedPct}%`,background:w.isDeficit?"var(--err)":"var(--ok)"},title:`To last until reset, stay near ${Math.round(w.expectedPct)}% by now`})]}),d.jsxs("div",{className:"qb-reset-row",children:[v?d.jsxs("span",{className:"qb-reset",children:["resets in ",v]}):n?d.jsxs("span",{className:"qb-reset",children:["resets ",n]}):null,w&&d.jsx("span",{className:"qb-pace",style:{color:w.color},children:w.runsOutIn?`runs out in ${w.runsOutIn}`:w.label})]})]})}const Lq=6e4;function qq(e){const[t,n]=_.useState(null),[s,i]=_.useState(!1),a=_.useRef(null),l=_.useRef(!1),u=async(p=!1)=>{if(!(p&&!lr(l.current))){p&&(l.current=!0,i(!0));try{const g=await fetch(p?"/api/quota?refresh=1":"/api/quota");g.ok&&n(await g.json())}catch{}finally{p&&(l.current=!1,i(!1))}}};return _.useEffect(()=>{if(e)return u(!0),a.current=window.setInterval(()=>u(!1),Lq),()=>{a.current!=null&&window.clearInterval(a.current)}},[e]),{quota:t,loading:s,refresh:()=>{e&&u(!0)}}}function Dq(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 Fq(e){switch(e){case"no_token":return"Run codex login to authenticate.";case"api_key_mode":return"API-key login — ChatGPT quota is only available for codex login.";case"refresh_rejected":return"Codex session expired — run codex login.";case"refresh_failed":return"Couldn't refresh the Codex token — click ↻ to retry.";case"untrusted_base_url":return"chatgpt_base_url in ~/.codex/config.toml is not an https OpenAI host, so the token was not sent.";default:return"ChatGPT API unreachable — click ↻ to retry."}}const MT=6e4,j1=6e4;function zq(e){const[t,n]=_.useState(null),[s,i]=_.useState(!1),a=_.useRef(null),l=_.useRef(!1),u=async(p=!1)=>{if(!(p&&!lr(l.current))){p&&(l.current=!0,i(!0));try{const g=await fetch(p?"/api/codex-quota?refresh=1":"/api/codex-quota");g.ok&&n(await g.json())}catch{}finally{p&&(l.current=!1,i(!1))}}};return _.useEffect(()=>{if(e)return u(!0),a.current=window.setInterval(()=>u(!1),MT),()=>{a.current!=null&&window.clearInterval(a.current)}},[e]),{data:t,loading:s,refresh:()=>{e&&u(!0)}}}function Bq(e){const[t,n]=_.useState(null),s=_.useRef(null),i=async()=>{try{const a=await fetch("/api/codex-usage");a.ok&&n(await a.json())}catch{}};return _.useEffect(()=>{if(e)return i(),s.current=window.setInterval(i,MT),()=>{s.current!=null&&window.clearInterval(s.current)}},[e]),{data:t}}function Uq(e,t,n){const[s,i]=_.useState(null),[a,l]=_.useState(!1),[u,h]=_.useState(0),p=_.useRef(0);_.useEffect(()=>{const g=()=>document.visibilityState==="visible",v=()=>{g()&&h(b=>b+1)},w=window.setInterval(v,j1),E=()=>{g()&&Date.now()-p.current>=j1&&h(b=>b+1)};return document.addEventListener("visibilitychange",E),()=>{window.clearInterval(w),document.removeEventListener("visibilitychange",E)}},[]);const f=_.useRef(t);return _.useEffect(()=>{let g=!0;const v=t!==f.current;f.current=t;const w=e,E=Eq(w);return l(!0),fetch(`/api/ccusage?since=${E}${v?"&refresh=1":""}`).then(b=>b.ok?b.json():null).then(b=>{!g||!(b!=null&&b.ok)||(p.current=Date.now(),i({period:w,data:b,baseline:n()}))}).catch(()=>{}).finally(()=>{g&&l(!1)}),()=>{g=!1}},[e,t,u]),{...jq(s,e),loading:a}}function Ja(e){const[t,n]=_.useState(e),s=_.useRef(e),i=_.useRef(!0);return _.useEffect(()=>{s.current=t},[t]),_.useEffect(()=>{if(i.current){i.current=!1,s.current=e,n(e);return}return Sq(s.current,e,l=>{s.current=l,n(l)})},[e]),t}function Wq({state:e,now:t,providers:n,onClose:s}){var be,xe;const{quota:i,loading:a,refresh:l}=qq(n.claude),{data:u,loading:h,refresh:p}=zq(n.codex),{data:f}=Bq(n.codex),[g,v]=_.useState(()=>Math.floor(Date.now()/1e3));_.useEffect(()=>{const he=window.setInterval(()=>v(Math.floor(Date.now()/1e3)),3e4);return()=>window.clearInterval(he)},[]);const{byModel:w,totalCost:E,totalTokens:b,burnRate:k}=_.useMemo(()=>{const he=new Map;for(const qe of e.agents.values())for(const Ye of Al(qe)){const Te=Ye.model??sh,et=Rw(Ye.usage,Ye.model),it=he.get(Te);it?(it.inputTokens+=Ye.usage.inputTokens,it.outputTokens+=Ye.usage.outputTokens,it.cacheReadTokens+=Ye.usage.cacheReadTokens,it.cacheCreateTokens+=Ye.usage.cacheCreateTokens,it.cost.total+=et.total,it.cost.input+=et.input,it.cost.output+=et.output,it.cost.cacheRead+=et.cacheRead,it.cost.cacheWrite+=et.cacheWrite,it.agentCount++):he.set(Te,{model:Te,inputTokens:Ye.usage.inputTokens,outputTokens:Ye.usage.outputTokens,cacheReadTokens:Ye.usage.cacheReadTokens,cacheCreateTokens:Ye.usage.cacheCreateTokens,cost:{...et},agentCount:1,priced:Zi(Ye.model)!=null})}const Pe=Array.from(he.values()).sort((qe,Ye)=>Ye.cost.total-qe.cost.total||Ye.inputTokens+Ye.outputTokens-(qe.inputTokens+qe.outputTokens));let Be=0,Ze=0;for(const qe of e.agents.values()){if(qe.state!=="active")continue;const Ye=bn(qe);Be+=Ye.total,Ze=Math.max(Ze,((qe.endedAt??t)-qe.startedAt)/1e3)}const Ge=Ze>0?Aw(Be,Ze):null,Je=pq(e.agents.values());return{byModel:Pe,totalCost:Je.cost,totalTokens:Je,burnRate:Ge}},[e,e.revision,t]),S=_.useMemo(()=>{const he=[];for(const Pe of e.agents.values()){if(Pe.kind!=="root")continue;let Be=bn(Pe).total,Ze=Pe.usage.inputTokens,Ge=Pe.usage.outputTokens,Je=Gv(Pe);for(const qe of e.agents.values())qe.sessionId!==Pe.sessionId||qe.kind==="root"||(Be+=bn(qe).total,Ze+=qe.usage.inputTokens,Ge+=qe.usage.outputTokens,Je+=Gv(qe));he.push({sessionId:Pe.sessionId,label:Pe.label||Pe.cwdBasename||"session",state:Pe.state,cost:Be,inputTokens:Ze,outputTokens:Ge,unpricedTokens:Je})}return he.sort((Pe,Be)=>Be.cost-Pe.cost||Be.inputTokens+Be.outputTokens-(Pe.inputTokens+Pe.outputTokens)).slice(0,12)},[e,e.revision]),[N,C]=_.useState("today"),[j,M]=_.useState(0),P=_.useRef(()=>new Map);P.current=()=>E1(e.agents.values(),t);const I=_.useCallback(()=>P.current(),[]),{data:D,shown:O,stale:A,baseline:L}=Uq(N,j,I),z=D!=null,K=_.useMemo(()=>{const he=new Map;for(const Pe of e.agents.values()){if(Pe.kind!=="root"||!Pe.sessionId)continue;const Be=Pe.label||Pe.cwdBasename;Be&&he.set(Pe.sessionId,Be)}return he},[e,e.revision]),R=_.useMemo(()=>{const he=new Map;for(const Pe of e.agents.values())Pe.kind!=="root"||!Pe.sessionId||he.set(Pe.sessionId,Pe.state);return he},[e,e.revision]),Q=_.useMemo(()=>z?ET(D):[],[D,z]),H=_.useMemo(()=>{if(!z)return[];const he=Cq(D,K).slice(0,12),Pe=new Map;for(const Be of he)Be.label&&Pe.set(Be.label,(Pe.get(Be.label)??0)+1);return he.map(Be=>Be.label&&(Pe.get(Be.label)??0)>1?{...Be,label:`${Be.label} ${Be.sessionId.slice(0,4)}`}:Be)},[D,z,K]),ne=_.useMemo(()=>CT(D),[D]),X=Tq(O,N),W=A?" up-stale":"",ee=_.useMemo(()=>z?Nq(L,E1(e.agents.values(),t)):Kv,[e,e.revision,L,z,t]),$=Rq(D,{...b,cost:E},ee),Y=$.hasCost,de=$.tokenSum,G=Ja($.cost),F=Ja($.inputTokens),J=Ja($.outputTokens),V=Ja($.cacheReadTokens),ae=Ja($.cacheCreateTokens),pe=w.filter(he=>he.cost.total>0||he.inputTokens+he.outputTokens>0),me=S.filter(he=>he.cost>0||he.inputTokens+he.outputTokens>0),ke=z?Q.some(he=>he.cost<=0&&he.tokens>0):pe.some(he=>!he.priced),Ve=a||h,ze=C1(i==null?void 0:i.fetchedAt,g),Oe=C1(u==null?void 0:u.fetchedAt,g),Ne=()=>{l(),p(),M(he=>he+1)},ce=n.claude&&n.codex?"Refresh Claude + Codex quota":n.codex?"Refresh Codex quota":"Refresh Claude quota";return d.jsxs("aside",{className:"usage-panel",id:"usage-panel","aria-label":"Usage",children:[d.jsxs("div",{className:"up-header",children:[d.jsx("h2",{children:"Usage"}),k&&d.jsx("span",{className:"up-rate",children:k}),d.jsxs("div",{className:"up-header-right",children:[(n.claude||n.codex)&&d.jsx("button",{type:"button",className:"glyph-btn up-refresh-btn",onClick:Ne,...ar(Ve),"aria-label":ce,title:ce,children:Ve?"…":"↻"}),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",ze&&!a&&d.jsx("span",{className:"up-section-age",title:Pq(i==null?void 0:i.source),children:ze})]}),i!=null&&i.ok?d.jsxs("div",{className:"up-quota-bars",children:[i.session5hPct!=null&&d.jsx(mo,{label:"5-hour window",pct:i.session5hPct,reset:i.session5hReset,resetAt:i.session5hResetAt,windowSec:i.session5hWindowSec,nowSec:g}),i.week7dPct!=null&&d.jsx(mo,{label:"7-day window",pct:i.week7dPct,reset:i.week7dReset,resetAt:i.week7dResetAt,windowSec:i.week7dWindowSec,nowSec:g}),i.weekSonnetPct!=null&&d.jsx(mo,{label:"Sonnet (7d)",pct:i.weekSonnetPct,nowSec:g}),i.weekOpusPct!=null&&d.jsx(mo,{label:"Opus (7d)",pct:i.weekOpusPct,nowSec:g})]}):(i==null?void 0:i.ok)===!1?d.jsxs("div",{className:"up-quota-na",children:[d.jsx("span",{children:i.reason==="no_subscription"?"No quota to show.":"Quota unavailable."}),d.jsx("span",{className:"up-quota-hint",children:Dq(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}),Oe&&!h&&d.jsx("span",{className:"up-section-age",title:"Fetched from the Codex usage endpoint",children:Oe})]}),u!=null&&u.ok?d.jsxs("div",{className:"up-quota-bars",children:[(be=u.windows)==null?void 0:be.map(he=>d.jsx(mo,{label:he.label,pct:he.pct,reset:he.reset??void 0,resetAt:he.resetAt??void 0,windowSec:he.windowSec??void 0,limitReached:u.limitReached&&he.pct>=100,nowSec:g},he.id)),(xe=u.extraWindows)==null?void 0:xe.map(he=>d.jsx(mo,{label:he.label,pct:he.pct,reset:he.reset??void 0,resetAt:he.resetAt??void 0,windowSec:he.windowSec??void 0,nowSec:g},he.id)),u.creditLimit&&d.jsx(mo,{label:`spend cap · $${Math.round(u.creditLimit.used)} of $${Math.round(u.creditLimit.limit)}`,pct:u.creditLimit.usedPct,reset:u.creditLimit.reset??void 0,resetAt:u.creditLimit.resetAt??void 0,limitReached:u.spendControlReached,nowSec:g}),u.creditsBalance&&!u.creditsUnlimited&&d.jsxs("div",{className:"up-quota-sub up-credits",children:["credits: $",u.creditsBalance,u.overageReached&&" · overage limit reached"]}),u.creditsUnlimited&&d.jsx("div",{className:"up-quota-sub up-credits",children:"credits: unlimited"}),u.resetCredits&&u.resetCredits.availableCount>0&&d.jsxs("div",{className:"up-quota-sub up-reset-credits",title:`Redeem in the Codex CLI or ChatGPT — ${Bt} only reports them`,children:[u.resetCredits.availableCount," rate-limit reset",u.resetCredits.availableCount!==1?"s":""," available",u.resetCredits.nextExpiryAt&&` · expires ${new Date(u.resetCredits.nextExpiryAt).toLocaleDateString("en-US",{month:"short",day:"numeric"})}`]}),u.promo&&d.jsx("div",{className:"up-quota-sub",children:u.promo}),u.partial&&d.jsx("div",{className:"up-quota-sub up-quota-hint",children:"Partial data — OpenAI returned limits this build doesn't recognise."})]}):(u==null?void 0:u.ok)===!1?d.jsxs("div",{className:"up-quota-na",children:[d.jsx("span",{children:"Quota unavailable."}),d.jsx("span",{className:"up-quota-hint",children:Fq(u.reason)})]}):d.jsx("div",{className:"up-quota-na up-quota-loading",children:"Checking…"}),(f==null?void 0:f.ok)&&f.window7d&&f.window7d.sessionCount>0&&d.jsxs("div",{className:"up-quota-sub",title:`Counted from the rollout files under CODEX_HOME — no network, no account${f.window5h?`
|
|
75
|
+
last 5h: ${At(f.window5h.totalTokens)} tokens · ${f.window5h.sessionCount} session${f.window5h.sessionCount!==1?"s":""}`:""}`,children:[At(f.window7d.totalTokens)," tokens · ",f.window7d.sessionCount," session",f.window7d.sessionCount!==1?"s":""," (7d)"]})]}),z&&d.jsx("div",{className:"uh-range up-period",role:"group","aria-label":"Period",children:NT.map(he=>d.jsx("button",{type:"button","aria-pressed":N===he.key,className:"uh-range-btn",onClick:()=>C(he.key),children:he.label},he.key))}),de>0?d.jsxs(d.Fragment,{children:[Y&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:`up-total${W}`,title:z?void 0:_1,children:[d.jsx("span",{className:"up-total-value",children:rt(G)}),d.jsx("span",{className:"up-total-label",children:z?X:mq})]}),$.showCostBar&&d.jsx(Pw,{cost:E})]}),d.jsxs("div",{className:`up-tokens-row${W}`,title:z?void 0:_1,children:[d.jsxs("span",{className:"up-tok",children:[d.jsx("span",{className:"up-k",children:"in"}),At(F)]}),d.jsxs("span",{className:"up-tok",children:[d.jsx("span",{className:"up-k",children:"out"}),At(J)]}),$.cacheReadTokens>0&&d.jsxs("span",{className:"up-tok",children:[d.jsx("span",{className:"up-k",children:"cache r"}),At(V)]}),$.cacheCreateTokens>0&&d.jsxs("span",{className:"up-tok",children:[d.jsx("span",{className:"up-k",children:"cache c"}),At(ae)]}),!Y&&d.jsx("span",{className:"up-tok up-scope",children:gq})]}),(z?Q.length:pe.length)>0&&d.jsxs("section",{className:`up-section${W}`,children:[d.jsx("h3",{className:"up-section-title",children:"By model"}),d.jsxs("table",{className:"up-table",children:[d.jsx("thead",{children:d.jsxs("tr",{children:[d.jsx("th",{children:"Model"}),d.jsx("th",{children:"Tokens"}),d.jsx("th",{children:"Cost"})]})}),d.jsx("tbody",{children:z?Q.map(he=>d.jsxs("tr",{children:[d.jsx("td",{className:"up-model-name",title:he.model,children:Ls(he.model)}),d.jsx("td",{className:"up-num",children:At(he.tokens)}),he.cost>0?d.jsx("td",{className:"up-num up-cost-val",children:rt(he.cost)}):d.jsx("td",{className:"up-num up-unpriced",children:Ii})]},he.model)):pe.map(he=>d.jsxs("tr",{children:[d.jsx("td",{className:"up-model-name",title:he.model===sh?"no model reported yet":he.model,children:he.model===sh?"unknown":Ls(he.model)}),d.jsx("td",{className:"up-num",children:At(he.inputTokens+he.outputTokens)}),he.priced?d.jsx("td",{className:"up-num up-cost-val",children:rt(he.cost.total)}):d.jsx("td",{className:"up-num up-unpriced",children:Ii})]},he.model))})]})]}),z&&H.length===0&&ne.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 ",X," yet — ccusage dates sessions in UTC, and the totals above are your local day."]})]}),(z?H.length:me.length)>0&&d.jsxs("section",{className:`up-section${W}`,children:[d.jsxs("h3",{className:"up-section-title",children:["By session",z&&d.jsxs("span",{className:"up-section-age",title:`Sessions with activity ${X}, each showing what that session has cost since it started.
|
|
76
|
+
A session that began earlier brings its whole total with it, so these rows can add up to more than the figure above.`,children:["active ",X]})]}),d.jsxs("div",{className:"up-sessions",children:[z&&H.map(he=>{const Pe=R.get(he.sessionId);return d.jsxs("div",{className:"up-session-row",children:[Pe?d.jsxs(d.Fragment,{children:[d.jsx("span",{className:`sl-dot state-${Pe}`,"aria-hidden":!0}),d.jsx("span",{className:"vis-hidden",children:Iu(Pe)})]}):d.jsx("span",{className:"sl-dot up-dot-past","aria-hidden":!0}),d.jsx("span",{className:`up-session-label${he.label?"":" up-session-id"}`,title:he.label?`${he.label}
|
|
77
|
+
${he.sessionId}`:he.sessionId,children:he.label??he.sessionId.slice(0,8)}),d.jsx("span",{className:"up-session-tokens",children:At(he.tokens)}),he.cost>0?d.jsx("span",{className:"up-session-cost",title:he.models.join(", ")||void 0,children:rt(he.cost)}):d.jsx("span",{className:"up-session-cost up-unpriced",children:Ii})]},he.sessionId)}),!z&&me.map(he=>d.jsxs("div",{className:"up-session-row",children:[d.jsx("span",{className:`sl-dot state-${he.state}`,"aria-hidden":!0}),d.jsx("span",{className:"vis-hidden",children:Iu(he.state)}),d.jsx("span",{className:"up-session-label",children:he.label}),d.jsx("span",{className:"up-session-tokens",children:At(he.inputTokens+he.outputTokens)}),he.cost>0?d.jsxs("span",{className:"up-session-cost",title:he.unpricedTokens>0?`${At(he.unpricedTokens)} tokens in this session are on an unpriced model, so this is a floor`:void 0,children:[rt(he.cost),he.unpricedTokens>0?"+":""]}):d.jsx("span",{className:"up-session-cost up-unpriced",children:Ii})]},he.sessionId))]})]}),ke&&d.jsxs("div",{className:"up-hint",children:["“",Ii,"” 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:z?d.jsxs(d.Fragment,{children:["No usage ",X,".",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 Hq="1",T1="agent-dag.schema",Gq=["agent-dag.layout","agent-dag.viewport"];function Vu(e){if(typeof window>"u")return null;try{return window.localStorage.getItem(e)}catch{return null}}function Vq(e,t=Hq){let n=null;try{n=e.getItem(T1)}catch{return[]}if(n===t)return[];const s=[];if(n!==null)for(const i of Gq)try{e.getItem(i)!==null&&(e.removeItem(i),s.push(i))}catch{}try{e.setItem(T1,t)}catch{}return s}const wt={l:30,r:6,t:6,b:2},Yu=104,Yq=64;function yo(e,t=100,n=Yu){const s=n-wt.t-wt.b;return wt.t+s*(1-Math.max(0,Math.min(t,e))/t)}function Kq(e,t,n,s=100,i=Yu){if(!e.length)return"";const a=e[e.length-1].t-e[0].t,l=p=>{const f=t-wt.l-wt.r;return wt.l+(a>0?f*(p-e[0].t)/a:f/2)};let u="",h=null;for(const p of e){const f=h&&p.t-h.t<=n*2?"L":"M";u+=`${f}${l(p.t).toFixed(1)} ${yo(p.v,s,i).toFixed(1)}`,h=p}return u}function Xq(e,t,n,s=100,i=Yu){if(e.length<2)return"";const a=i-wt.b,l=e[e.length-1].t-e[0].t,u=t-wt.l-wt.r,h=v=>wt.l+(l>0?u*(v-e[0].t)/l:u/2);let p="",f=[];const g=()=>{if(f.length>=2){let v=`M${h(f[0].t).toFixed(1)} ${a}`;for(const w of f)v+=`L${h(w.t).toFixed(1)} ${yo(w.v,s,i).toFixed(1)}`;p+=`${v}L${h(f[f.length-1].t).toFixed(1)} ${a}Z`}f=[]};for(const v of e)f.length&&v.t-f[f.length-1].t>n*2&&g(),f.push(v);return g(),p}function Qq(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 Zq(e,t,n){return n!=null&&e>=n?"hot":t!=null&&e>=t?"warn":""}function Jq(e,t,n=s=>cl(s)){const s=e.filter(l=>l.v>0);if(!e.length)return null;if(!s.length)return"never held back";const i=s.length*(t/6e4),a=s[s.length-1];return`held back for ${i===1?"1 minute":`${i} minutes`}, last at ${n(a.t)}`}function cl(e){const t=new Date(e);return`${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}`}function IT(e,t){const n=Math.max(0,Math.floor((t-e)/6e4));if(n<1)return"less than a minute";if(n<60)return`${n} minute${n===1?"":"s"}`;const s=Math.floor(n/60),i=n%60;return i?`${s}h ${i}m`:`${s}h`}function e4({group:e,title:t,onClose:n}){const s=_n(n),[i,a]=_.useState(null);_.useEffect(()=>{let p=!0;const f=async()=>{try{const v=await fetch(`/api/system/history?group=${e}`);if(!v.ok)return;const w=await v.json();p&&(w!=null&&w.ok)&&a(w)}catch{}};f();const g=window.setInterval(f,2e4);return()=>{p=!1,window.clearInterval(g)}},[e]);const l=(i==null?void 0:i.series)??[],[u,h]=_.useMemo(()=>{let p=1/0,f=0;for(const g of l)g.points.length&&(p=Math.min(p,g.points[0].t),f=Math.max(f,g.points[g.points.length-1].t));return[Number.isFinite(p)?Math.max(p,(i==null?void 0:i.sinceMs)??0):(i==null?void 0:i.sinceMs)??0,f]},[l,i==null?void 0:i.sinceMs]);return gw.createPortal(d.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:d.jsxs("div",{ref:s,className:"modal hist-modal",onClick:p=>p.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"hist-modal-title",children:[d.jsxs("div",{className:"modal-head",children:[d.jsx("span",{className:"modal-title",id:"hist-modal-title",children:t}),i&&u>0&&d.jsxs("span",{className:"hist-since",children:["since ",cl(u)," · ",IT(u,h||Date.now())]}),d.jsx("button",{type:"button",className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),d.jsx("div",{className:"hist-body",children:i==null?d.jsx("p",{className:"hist-empty",children:"Reading…"}):l.length===0?d.jsx("p",{className:"hist-empty",children:"Nothing has been measured yet."}):l.map(p=>d.jsx(t4,{series:p,stepMs:i.stepMs},p.label))})]})}),document.body)}function t4({series:e,stepMs:t}){const n=_.useRef(null),[s,i]=_.useState(560),[a,l]=_.useState(null);_.useEffect(()=>{const I=n.current;if(!I||typeof ResizeObserver>"u")return;const D=new ResizeObserver(([O])=>i(Math.max(160,O.contentRect.width)));return D.observe(I),()=>D.disconnect()},[]);const{points:u,unit:h,warnAt:p,critAt:f,label:g,top:v,restsAtZero:w}=e,E=w?Yq:Yu,{now:b,peak:k}=Qq(u),S=h==="C"?"°C":h,N=g==="Throttling"?Jq(u,t):null,C=a!=null?u[a]:null,j=u.length>1?u[u.length-1].t-u[0].t:0,M=I=>{const D=s-wt.l-wt.r;return wt.l+(j>0?D*(I-u[0].t)/j:D/2)},P=I=>{if(u.length<2)return;const D=I.currentTarget.getBoundingClientRect(),O=(I.clientX-D.left-wt.l)/Math.max(1,D.width-wt.l-wt.r),A=u[0].t+j*Math.max(0,Math.min(1,O));let L=0;for(let z=1;z<u.length;z++)Math.abs(u[z].t-A)<Math.abs(u[L].t-A)&&(L=z);l(L)};return d.jsxs("section",{className:"hist-series","aria-label":`${g} history`,children:[d.jsxs("div",{className:"hist-head",children:[d.jsx("span",{className:"hist-label",children:g}),d.jsxs("span",{className:"hist-stats",children:[b!=null&&d.jsxs(d.Fragment,{children:[d.jsx("b",{children:b}),d.jsxs("span",{children:[S," now"]})]}),k!=null&&d.jsxs(d.Fragment,{children:[d.jsx("b",{className:Zq(k,p,f),children:k}),d.jsxs("span",{children:[S," peak"]})]})]})]}),d.jsx("div",{className:"hist-plot",ref:n,children:d.jsxs("svg",{className:"hist-chart",width:"100%",height:E,viewBox:`0 0 ${s} ${E}`,preserveAspectRatio:"none",role:"img","aria-label":b==null?`${g}: nothing measured yet`:`${g}: ${b}${S} now, peak ${k}${S}, over ${IT(u[0].t,u[u.length-1].t)}`,onPointerMove:P,onPointerLeave:()=>l(null),children:[[["warn",p],["hot",f]].map(([I,D])=>D==null||D>v?null:d.jsxs("g",{children:[d.jsx("line",{className:`hist-rule ${I}`,x1:wt.l,x2:s-wt.r,y1:yo(D,v,E),y2:yo(D,v,E)}),d.jsx("text",{className:`hist-rule-tag ${I}`,x:2,y:yo(D,v,E)+3,children:D})]},I)),d.jsx("line",{className:"hist-floor",x1:wt.l,x2:s-wt.r,y1:E-wt.b,y2:E-wt.b}),d.jsx("path",{className:"hist-area",d:Xq(u,s,t,v,E)}),d.jsx("path",{className:"hist-line",d:Kq(u,s,t,v,E)}),u.length===1&&d.jsx("circle",{className:"hist-dot",cx:M(u[0].t),cy:yo(u[0].v,v,E),r:3}),C&&d.jsxs("g",{children:[d.jsx("line",{className:"hist-cross",x1:M(C.t),x2:M(C.t),y1:wt.t,y2:E-wt.b}),d.jsx("circle",{className:"hist-dot",cx:M(C.t),cy:yo(C.v,v,E),r:3})]})]})}),d.jsx("div",{className:"hist-axis",children:C?d.jsxs("span",{className:"hist-at",children:[cl(C.t)," — ",d.jsx("b",{children:C.v}),S]}):d.jsxs(d.Fragment,{children:[d.jsx("span",{children:u.length?cl(u[0].t):""}),d.jsx("span",{children:u.length?cl(u[u.length-1].t):""})]})}),N&&d.jsx("div",{className:"hist-note",children:N})]})}function n4({procs:e,total:t,onClose:n}){const s=_n(n),[i,a]=_.useState(OT),l=Jv(e,i);return gw.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(zi,{col:"cpu",label:"cpu",sort:i,onSort:a}),d.jsx(zi,{col:"mem",label:"mem",sort:i,onSort:a}),d.jsx("th",{scope:"col",className:"pl-pid-h",children:"pid"}),d.jsx(zi,{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 r4=3e3,s4=4e3,oh=20,el=36,Ai=8,o4=8,OT={key:"cpu",dir:"desc",rank:"cpu"};function i4(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 Jv(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 a4(e,t,n=o4){const s=Jv(e,{key:t.rank,dir:"desc",rank:t.rank});return Jv(s.slice(0,n),t)}function l4(e,t){return e.key!==t?"none":e.dir==="asc"?"ascending":"descending"}function c4(e,t,n){return e>=n?"hot":e>=t?"warn":"calm"}function u4(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}% ${d4(t.lastMs,n)}`:"running at full speed, and never held back"}}function d4(e,t=Date.now()){const n=Math.max(0,Math.floor((t-e)/6e4));if(n<2)return"just now";if(n<60)return`${n} minutes ago`;const s=Math.floor(n/60);return s===1?"an hour ago":`${s} hours ago`}const PT="agent-dag.systemPanelOpen";function f4(){return Vu(PT)==="1"}function h4(e){if(!(typeof window>"u"))try{window.localStorage.setItem(PT,e?"1":"0")}catch{}}function vo(e){return e>=1024**3?`${(e/1024**3).toFixed(1)} GB`:e>=1024**2?`${Math.round(e/1024**2)} MB`:`${Math.round(e/1024)} KB`}function p4(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 m4(){const[e,t]=_.useState(null),n=_.useRef(null);return _.useEffect(()=>{let s=!0;const i=async()=>{if(document.visibilityState!=="hidden")try{const h=await fetch("/api/system");if(!h.ok)return;const p=await h.json();s&&(p!=null&&p.ok)&&t(p)}catch{}},a=()=>{n.current==null&&(i(),n.current=window.setInterval(i,r4))},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 g4(e){const[t,n]=_.useState(null);return _.useEffect(()=>{let s=!0;const i=async()=>{if(document.visibilityState!=="hidden")try{const l=await fetch("/api/system/processes");if(!l.ok)return;const u=await l.json();s&&(u!=null&&u.ok)&&n({procs:u.procs??[],total:u.total??0})}catch{}};i();const a=window.setInterval(i,s4);return()=>{s=!1,window.clearInterval(a)}},[e]),t}function y4({usageOpen:e=!1}){const t=m4(),[n,s]=_.useState(f4);_.useEffect(()=>{h4(n)},[n]);const i=_.useRef(null),a=_.useRef(null);if(_.useEffect(()=>{if(n)return Fi.push(()=>{var S,N;const k=((S=a.current)==null?void 0:S.contains(document.activeElement))??!1;s(!1),k&&((N=i.current)==null||N.focus())},mT)},[n]),!t||t.cpu==null||!t.memory)return d.jsx("span",{className:"sysmeter idle",title:"Sampling this machine…",children:d.jsx("span",{className:"sm-box","aria-hidden":!0,children:d.jsxs("span",{className:"sm-graphic",children:[d.jsx("svg",{className:"sm-spark",width:el,height:Ai,viewBox:`0 0 ${el} ${Ai}`}),d.jsx("span",{className:"sm-ram"})]})})});const{cpu:l,cpuHistory:u,cores:h,memory:p,loadavg:f}=t,g=p.usedPct>=90,v=u.slice(-oh),w=oh-v.length,E=el/oh,b=[`CPU ${l.toFixed(0)}% of ${h} cores`,f?`load ${f[0]} · ${f[1]} · ${f[2]} (1m · 5m · 15m)`:null,`Memory ${vo(p.total-p.available)} of ${vo(p.total)} used`,"","Click for detail. This machine, not this session."].filter(k=>k!==null).join(`
|
|
78
|
+
`);return d.jsxs("span",{className:"sysmeter-wrap",children:[d.jsxs("button",{type:"button",ref:i,className:"sysmeter",title:b,"aria-label":"Toggle machine detail","aria-expanded":n,"aria-controls":n?"system-panel":void 0,onClick:()=>s(k=>!k),children:[d.jsxs("span",{className:"sm-box","aria-hidden":!0,children:[d.jsxs("span",{className:"sm-graphic",children:[d.jsx("svg",{className:"sm-spark",width:el,height:Ai,viewBox:`0 0 ${el} ${Ai}`,children:v.map((k,S)=>{const N=w+S,C=Math.max(1,k/100*Ai),j=.32+.68*((S+1)/v.length);return d.jsx("rect",{x:N*E,y:Ai-C,width:Math.max(.8,E-.7),height:C,rx:.5,fill:"var(--accent)",opacity:j},N)})}),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(v4,{sys:t,usageOpen:e,panelRef:a,onClose:()=>{var k;s(!1),(k=i.current)==null||k.focus()}})]})}function v4({sys:e,usageOpen:t,panelRef:n,onClose:s}){const i=g4(!0),{memory:a,swap:l,perCore:u,loadavg:h,cores:p,uptimeSec:f,platform:g,thermal:v}=e,w=a?a.total-a.available:0,E=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 ",p4(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(bu,{group:"cores",title:"Core history",action:"Show core history",label:"Cores",children:d.jsx("div",{className:"sd-cores",style:{"--n":u.length},children:u.map((k,S)=>d.jsx("span",{className:"sd-core",title:`core ${S+1}: ${k}%`,children:d.jsx("span",{className:"sd-core-fill",style:{transform:`scaleY(${Math.max(2,k)/100})`}})},S))})})}),d.jsx("div",{className:"sd-section",role:"group","aria-label":"Memory",children:d.jsxs(bu,{group:"memory",title:"Memory history",action:"Show memory history",label:"Memory",children:[a&&d.jsx(Ou,{label:"Physical",value:d.jsxs(d.Fragment,{children:[d.jsx("b",{children:vo(w)})," of ",vo(a.total)]}),pct:a.usedPct,tone:a.usedPct>=90?"warn":"calm",note:`${vo(a.available)} available`}),l&&l.total>0&&d.jsx(Ou,{label:E,value:d.jsxs(d.Fragment,{children:[d.jsx("b",{children:vo(l.used)})," of ",vo(l.total)]}),pct:b,tone:b>=90?"warn":"calm",note:b>=50?"paging to disk":void 0})]})}),h&&d.jsx("div",{className:"sd-section",role:"group","aria-label":"Load average",children:d.jsxs(bu,{group:"load",title:"Load history",action:"Show load history",label:"Load average",children:[d.jsx("div",{className:"sd-load",children:h.map((k,S)=>d.jsxs("span",{className:`sd-load-item${k>p?" over":""}`,children:[d.jsx("b",{children:k.toFixed(2)}),d.jsx("span",{children:["1m","5m","15m"][S]})]},S))}),d.jsx("div",{className:"sd-note",children:h[0]>p?`${(h[0]/p).toFixed(1)}× more work queued than cores to run it`:`within ${p} cores`})]})}),d.jsx(w4,{thermal:v}),d.jsx(x4,{read:i})]})}function bu({group:e,title:t,action:n,label:s,children:i}){const[a,l]=_.useState(!1);return d.jsxs(d.Fragment,{children:[d.jsxs("button",{type:"button",className:"sd-open",onClick:()=>l(!0),title:n,"aria-label":n,children:[d.jsxs("div",{className:"sd-h","aria-hidden":!0,children:[s," ",d.jsx("i",{className:"sd-row-more",children:"›"})]}),i]}),a&&d.jsx(e4,{group:e,title:t,onClose:()=>l(!1)})]})}function w4({thermal:e}){if(!e)return null;const t=e.throttle?u4(e.throttle.speedLimit,e.heldBack):null;return d.jsx("div",{className:"sd-section",role:"group","aria-label":"Thermal",children:d.jsxs(bu,{group:"thermal",title:"Thermal history",action:"Show thermal history",label:"Thermal",children:[e.celsius.map(n=>d.jsx(Ou,{label:n.label,value:d.jsxs(d.Fragment,{children:[d.jsx("b",{children:n.celsius})," °C"]}),pct:n.celsius,tone:c4(n.celsius,n.warnAt,n.critAt)},n.label)),t&&d.jsx(Ou,{label:"Throttling",value:t.value,pct:t.pct,tone:t.tone,note:t.note})]})})}function x4({read:e}){const[t,n]=_.useState(OT),[s,i]=_.useState(!1),a=(e==null?void 0:e.procs)??null;return d.jsxs("div",{className:"sd-section",role:"group","aria-label":"Busiest processes",children:[d.jsxs("div",{className:"sd-hrow",children:[d.jsx("div",{className:"sd-h","aria-hidden":!0,children:"Busiest processes"}),a!=null&&a.length>0&&d.jsxs("button",{type:"button",className:"sd-all",onClick:()=>i(!0),title:"Show every process the deck is watching","aria-label":"Show every process the deck is watching",children:["more ",d.jsx("i",{className:"sd-row-more","aria-hidden":!0,children:"›"})]})]}),s&&e&&d.jsx(n4,{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(zi,{col:"cpu",label:"cpu",sort:t,onSort:n}),d.jsx(zi,{col:"mem",label:"mem",sort:t,onSort:n}),d.jsx(zi,{col:"name",label:"process",sort:t,onSort:n})]})}),d.jsx("tbody",{children:a4(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 zi({col:e,label:t,sort:n,onSort:s}){const i=l4(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(i4(n,e)),children:[t,d.jsx("span",{className:"sd-sort-dir","aria-hidden":!0,children:i==="none"?"":i==="ascending"?"↑":"↓"})]})})}function Ou({label:e,value:t,pct:n,tone:s="calm",note:i}){return d.jsxs("div",{className:"sd-row",children:[d.jsxs("div",{className:"sd-row-head",children:[d.jsx("span",{className:"sd-row-label",children:e}),d.jsx("span",{className:"sd-row-val",children:t})]}),d.jsx("span",{className:"sd-track",children:d.jsx("span",{className:`sd-fill${s==="calm"?"":` ${s}`}`,style:{transform:`scaleX(${n<=0?0:Math.max(1,Math.min(100,n))/100})`}})}),i&&d.jsx("div",{className:"sd-note",children:i})]})}const R1=18,b4=1100,Mi=(e,t)=>{const n=Math.sin(e*12.9898+t*78.233)*43758.5453;return n-Math.floor(n)},k4=Array.from({length:R1},(e,t)=>{const n=-72+144*t/(R1-1)+(Mi(t,1)-.5)*9,s=(n-90)*(Math.PI/180),i=(54+32*Math.cos(n*Math.PI/180))*(.74+Mi(t,2)*.52);return{dx:Math.cos(s)*i,dy:Math.sin(s)*i,rot:(t%2?1:-1)*(100+Mi(t,3)*260),delay:Math.round(Mi(t,4)*90),dur:760+Math.round(Mi(t,5)*260),scale:.8+Mi(t,6)*.45,hue:t%4,round:t%3===0}});function A1({anchor:e}){var i;const[t,n]=_.useState(null),s=typeof window<"u"&&((i=window.matchMedia)==null?void 0:i.call(window,"(prefers-reduced-motion: reduce)").matches);return _.useEffect(()=>{if(s)return;const a=e.current;if(!a)return;const l=a.getBoundingClientRect();n({x:l.left+l.width/2,y:l.top+l.height/2});const u=window.setTimeout(()=>n(null),b4);return()=>window.clearTimeout(u)},[e,s]),s||!t?null:gw.createPortal(d.jsx("div",{className:"confetti",style:{left:`${t.x}px`,top:`${t.y}px`},"aria-hidden":!0,children:k4.map((a,l)=>d.jsx("span",{className:`confetti-bit${a.round?" round":""}`,"data-hue":a.hue,style:{"--dx":`${a.dx.toFixed(1)}px`,"--dy":`${a.dy.toFixed(1)}px`,"--rot":`${a.rot}deg`,"--s":a.scale.toFixed(2),animationDelay:`${a.delay}ms`,animationDuration:`${a.dur}ms, ${a.dur}ms`}},l))}),document.body)}const $T=new Set(["awaiting_url","awaiting_code","registering"]);function _4(e){return e!=null&&$T.has(e)}function LT(e){return e!=null&&e!=="done"&&!$T.has(e)}const S4="the sign-in ended before it finished — the deck restarted, or it was cancelled in another tab",N4="the sign-in did not complete";function E4({state:e,serverError:t,localError:n}){const s=e==="idle";return{title:s?"Sign-in ended":"Sign-in failed",message:n||t||(s?S4:N4)}}const C4="done";function j4(){let e=!1;return{shouldAnnounce(t){return t!==C4?(e=!1,!1):e?!1:(e=!0,!0)}}}function $w(e,t){return t&&Object.hasOwn(e,t)?e[t]:void 0}const T4={already_running:"a sign-in is already in progress",no_url:"the claude CLI did not offer a sign-in link — is it installed?",not_waiting:"that sign-in is no longer waiting for a code",not_prompted:"the CLI has not asked for a code yet",code_rejected:"that code was not accepted — copy it again from the browser",no_verdict:"the claude CLI has not answered — try the code again",empty_code:"paste the code from the browser first",login_failed:"the code was not accepted",no_identity:"signed in, but the CLI still reports nobody logged in",add_failed:"signed in, but claude-swap could not record the account",not_a_share:"that does not look like a shared account — it should start with ccdeck2:",corrupt:"that share is incomplete — copy the whole thing",wrong_version:`that share was made by a newer ${Bt}`,expired:"that share has expired — make a new one",import_failed:"claude-swap refused the import",unreadable_export:"claude-swap wrote something this deck could not read — try again, and upgrade it if this repeats",mixed_versions:"claude-swap changed format part-way through — try again",nothing_to_share:"none of those accounts could be exported",too_many:"that is more accounts than one share can carry",not_in_bundle:"that account is not in this share",bad_value:"an alias can only use letters, numbers, spaces, dots, dashes and underscores, up to 64 characters, and cannot start with a dash",bad_email:"that does not look like an email address — it cannot contain spaces or start with a dash"},R4={no_cswap:"claude-swap could not be run — it is not on this deck's PATH. Set AGENTS_DECK_CSWAP to its full path",timeout:"claude-swap took too long and was stopped — try again",switch_failed:"claude-swap refused the switch",bad_account:"that is not an account claude-swap has",unknown_setting:"claude-swap has no such setting",out_of_range:"that value is outside what the setting allows",bad_value:"claude-swap does not accept that value",set_failed:"claude-swap refused the change",command_failed:"claude-swap refused the command"},A4=`claude-swap could not read the login keychain — start ${Bt} from a Terminal window rather than a background service`;function ew(e,t){if((e==null?void 0:e.reason)!=="no_cswap"&&/keychain/i.test(Vi(e)))return A4;const n=$w(R4,e==null?void 0:e.reason);return n||(e==null?void 0:e.reason)||t}function Vi(e){return((e==null?void 0:e.output)||(e==null?void 0:e.detail)||(e==null?void 0:e.error)||"").trim()}const M4={no_install:"ccusage is not installed, and AGENTS_DECK_NO_INSTALL=1 forbids fetching it — unset that variable and restart the deck, or install ccusage yourself so it is on this deck's PATH",bad_override:"AGENTS_DECK_CCUSAGE names a file that is not there — correct it to the full path of your ccusage, or unset it to let the deck find its own",timeout:"ccusage took more than 90 seconds and was stopped — a narrower range usually finishes",bad_output:"ccusage ran but printed no usage data — try again, and run ccusage daily --json in a terminal if it keeps happening",run_failed:"ccusage could not report usage — try again",bad_range:"that date range is not a YYYYMMDD date — reopen the modal and pick one of the presets",unreachable:"the deck did not answer — check it is still running, then try again"},I4="ccusage could not be started — npx is not on this deck's PATH. Install Node's npm/npx, or put ccusage on PATH yourself";function O4(e){return/\bnpx\b/i.test(e)&&/(command not found|not found|not recognized|ENOENT)/i.test(e)}const P4="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",$4="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",L4=e=>/\b(?:ERR_)?MODULE_NOT_FOUND\b|cannot find (?:module|package)/i.test(e),q4=/node_modules[\\/]npm[\\/]bin[\\/]|\bnpm-prefix\.js\b|\bnp[mx][-.][\w.-]*cli\.js\b/i,D4=/[\\/]_npx[\\/]/i,F4=`the copy of ccusage ${Bt} installed for itself`;function z4(e){const t=String((e==null?void 0:e.install)??"").replace(/\s+/g," ").trim();return t.length>240?`${t.slice(0,239)}…`:t}function B4(e,t){const n=U4(e,t),s=z4(e);switch(e==null?void 0:e.stage){case"npx":return s?`ccusage failed on both of its paths. The managed install failed first — ${s} — and the deck then fell back to npx, where ${tl(n)}`:`there is no managed copy of ccusage on this machine, and the npx fallback failed: ${tl(n)}`;case"managed":return`${F4} failed to run: ${tl(n)}`;case"path":return e.bin?`the ccusage this deck found at ${e.bin} failed to run: ${tl(n)}`:`the ccusage this deck found on your PATH failed to run: ${tl(n)}`;default:return n}}const tl=e=>/^[A-Z][a-z]/.test(e)?e[0].toLowerCase()+e.slice(1):e;function U4(e,t){const n=Vi(e);if(L4(n)){if(D4.test(n))return $4;if(q4.test(n))return P4}if(O4(n))return I4;const s=$w(M4,e==null?void 0:e.reason);return s||(e==null?void 0:e.reason)||t}function $i(e,t){if(e!=null&&e.detail)return e.detail;if(e!=null&&e.error&<(e.state))return e.error;const n=$w(T4,e==null?void 0:e.reason);return n||(e!=null&&e.error?e.error:(e==null?void 0:e.reason)||t)}function W4(e,t,n){if(n<=0||Mw(e))return{kind:"pass"};const s=t>=0&&t<n?t:-1;switch(e.key){case"ArrowRight":return{kind:"select",index:s===-1?0:(s+1)%n};case"ArrowLeft":return{kind:"select",index:s===-1?n-1:(s-1+n)%n};case"Home":return{kind:"select",index:0};case"End":return{kind:"select",index:n-1};default:return{kind:"pass"}}}function qT(e,t){const n=Math.round(e/1e3)-t;return n<=0?{text:"expired",tone:"gone"}:n<60?{text:`expires in ${n}s`,tone:"soon"}:{text:`expires in ${Math.round(n/60)}m`,tone:"ok"}}function H4(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 G4(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 V4(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 Y4(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 K4=1500,lu=[{id:"login",label:"Sign in"},{id:"paste",label:"Paste a share"}],M1="aa-panel",I1=e=>`aa-tab-${e}`;async function nl(e){return(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json().catch(()=>null)}const tw=fe.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"})]}));tw.displayName="SuccessMark";function X4({onClose:e,onChanged:t}){const[n,s]=_.useState("login"),[i,a]=_.useState(null),[l,u]=_.useState(""),[h,p]=_.useState(""),[f,g]=_.useState(!1),[v,w]=_.useState(null),[E,b]=_.useState(null),[k,S]=_.useState(null),[N,C]=_.useState(null),j=_.useRef(""),M=_.useRef(!1),P=_.useRef(!1),I=_.useRef(null),D=_.useRef(null),O=_.useRef(null),A=_.useRef(null),L=_.useRef([]),z=_.useRef(!1),K=_.useCallback(()=>{M.current&&nl({action:"login-cancel"}).catch(()=>{}),e()},[e]),R=_n(K,{focusRef:O}),Q=_.useCallback(async()=>{if(!lr(P.current))return;P.current=!0,g(!0),w(null),M.current=!0;const F=await nl({action:"login"}).catch(()=>null);if(P.current=!1,g(!1),!(F!=null&&F.ok)){w($i(F,"could not start the sign-in"));return}a(F)},[]);_.useEffect(()=>{if(!_4(i==null?void 0:i.state))return;const F=window.setInterval(async()=>{try{const J=await fetch("/api/claude-accounts/login");J.ok&&a(await J.json())}catch{}},K4);return()=>window.clearInterval(F)},[i]);const H=_.useRef(t);H.current=t;const ne=_.useState(j4)[0];_.useEffect(()=>{var F;(i==null?void 0:i.state)==="awaiting_code"&&((F=I.current)==null||F.focus()),ne.shouldAnnounce(i==null?void 0:i.state)&&H.current()},[i==null?void 0:i.state,ne]),_.useEffect(()=>{var F;n==="paste"&&!z.current&&((F=D.current)==null||F.focus()),z.current=!1},[n]);const X=_.useCallback(F=>{var V;const J=W4(F,lu.findIndex(ae=>ae.id===n),lu.length);J.kind!=="pass"&&(F.preventDefault(),z.current=!0,s(lu[J.index].id),(V=L.current[J.index])==null||V.focus())},[n]),W=_.useCallback(async()=>{var J;if(!lr(P.current))return;P.current=!0,g(!0),w(null);const F=await nl({action:"login-code",code:l}).catch(()=>null);if(P.current=!1,g(!1),!(F!=null&&F.ok)){w($i(F,"the code was not accepted")),F!=null&&F.state&&a(F),(J=I.current)==null||J.select();return}u(""),a(F)},[l,i]),ee=_.useCallback(async()=>{if(!lr(P.current))return;P.current=!0,g(!0),w(null);const F=await nl({action:"import",blob:h}).catch(()=>null);if(P.current=!1,g(!1),!(F!=null&&F.ok)){w($i(F,"the import failed"));return}j.current=h,p(""),C(null),b(F.results??[]),t()},[h,t]),$=_.useCallback(async F=>{const J=`${F.email}|${F.org??""}`;if(!lr(P.current)||!j.current)return;P.current=!0,g(!0),S(J),C(null);const V=await nl({action:"import",blob:j.current,force:!0,only:{email:F.email,org:F.org??""}}).catch(()=>null);if(P.current=!1,g(!1),S(null),!(V!=null&&V.ok)){C({key:J,text:$i(V,"that account could not be updated")});return}const ae=(V.results??[])[0];ae&&b(pe=>pe&&pe.map(me=>`${me.email}|${me.org??""}`===J?ae:me)),t()},[t]),Y=(i==null?void 0:i.state)==="done"?i.account:null,de=LT(i==null?void 0:i.state)||!!(v&&M.current&&!f),G=E4({state:i==null?void 0:i.state,serverError:i==null?void 0:i.error,localError:v});return d.jsx("div",{className:"modal-backdrop",onClick:K,role:"presentation",children:d.jsxs("div",{ref:R,className:"modal aa-modal",onClick:F=>F.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:lu.map((F,J)=>d.jsx("button",{type:"button",role:"tab",id:I1(F.id),ref:V=>{L.current[J]=V},"aria-selected":n===F.id,"aria-controls":M1,tabIndex:n===F.id?0:-1,className:`aa-tab${n===F.id?" on":""}`,onClick:()=>{z.current=!1,s(F.id)},children:F.label},F.id))})}),d.jsx("div",{className:"modal-actions",children:d.jsx("button",{type:"button",className:"glyph-btn",onClick:K,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),d.jsx("section",{className:"modal-body aa-body",id:M1,role:"tabpanel","aria-labelledby":I1(n),children:n==="login"?Y?d.jsxs("div",{className:"aa-done",children:[d.jsx(tw,{ref:A}),d.jsx(A1,{anchor:A}),d.jsx("h4",{children:Y.added?`Account ${Y.num} added`:"Credentials refreshed"}),d.jsxs("p",{className:"aa-note",children:[d.jsx("strong",{children:Y.email}),Y.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:I,type:"text",value:l,onChange:F=>u(F.target.value),onKeyDown:F=>{F.key==="Enter"&&l.trim()&&!f&&W()},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",...ar(f,!l.trim()||i.state==="registering"),onClick:W,children:i.state==="registering"?"registering…":"Continue"})]}),(v||i.error)&&d.jsx("p",{className:"aa-err",children:v??i.error}),d.jsx("p",{className:"aa-note",children:"The code goes straight to the claude CLI on this machine. It is never stored or sent anywhere else."})]})]}):de?d.jsxs("div",{className:"aa-step",children:[d.jsx("h4",{children:G.title}),d.jsx("p",{className:"aa-err",children:G.message}),d.jsx("button",{type:"button",className:"btn",onClick:()=>{M.current=!1,a(null),w(null),Q()},children:"Try again"})]}):f||M.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:O,className:"btn primary",onClick:Q,children:"Open the sign-in page"})})]}):E?(()=>{const F=E.filter(J=>J.state==="imported").length;return d.jsxs("div",{className:"aa-done",children:[d.jsx(tw,{ref:A}),F>0&&d.jsx(A1,{anchor:A}),d.jsx("h4",{children:Y4(E)}),E.length>0&&d.jsx("ul",{className:"aa-results",children:E.map(J=>{const V=`${J.email}|${J.org??""}`;return d.jsxs("li",{className:`aa-result ${J.state}`,children:[d.jsx("span",{className:"aa-result-who",children:J.email||(J.num?`slot ${J.num}`:"an account")}),d.jsx("span",{className:"aa-result-what",children:V4(J.state)}),J.state==="present"&&d.jsx("button",{type:"button",className:"aa-result-fix","aria-busy":k===V,title:`Overwrite the stored login for ${J.email} with the one in this share. Do this when that account has stopped working here; if it works, leave it.`,onClick:()=>$(J),children:k===V?"updating…":"update anyway"}),(N==null?void 0:N.key)===V&&d.jsx("span",{className:"aa-result-err",children:N.text})]},V)})}),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:D,type:"text",value:h,onChange:F=>p(F.target.value),onKeyDown:F=>{F.key==="Enter"&&h.trim()&&!f&&ee()},placeholder:"ccdeck2:…",spellCheck:!1,autoComplete:"off","aria-label":"Shared account"}),d.jsx("button",{type:"button",className:"btn primary",...ar(f,!h.trim()),onClick:ee,children:f?"importing…":"Import"})]}),v&&d.jsx("p",{className:"aa-err",children:v}),d.jsxs("p",{className:"aa-note",children:["Use ",d.jsx("strong",{children:"share"})," on one account in the other deck, or ",d.jsx("strong",{children:"↗"})," above its list to send several at once. A share carries a live login for every account in it and expires ten minutes after it is made."]})]})})]})})}async function Q4(e){return(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json().catch(()=>null)}const Z4=1800;function J4({accounts:e,onClose:t,copyText:n}){const[s,i]=_.useState([]),[a,l]=_.useState(null),[u,h]=_.useState(!1),[p,f]=_.useState(null),[g,v]=_.useState(!1),[w,E]=_.useState(()=>Math.floor(Date.now()/1e3)),b=_.useRef(null),k=_.useRef(!1),S=_n(t,{focusRef:b});_.useEffect(()=>{if(!a)return;E(Math.floor(Date.now()/1e3));const A=window.setInterval(()=>E(Math.floor(Date.now()/1e3)),1e3);return()=>window.clearInterval(A)},[a]);const N=H4(e),C=e.filter(A=>!s.includes(A.num)).map(A=>A.num),j=C.length===e.length,M=A=>i(L=>L.includes(A)?L.filter(z=>z!==A):[...L,A]),P=_.useCallback(async()=>{if(!lr(k.current)||!C.length)return;k.current=!0,h(!0),f(null),v(!1);const A=await Q4({action:"share",accounts:C}).catch(()=>null);if(k.current=!1,h(!1),!(A!=null&&A.ok)){f($i(A,"the share could not be made"));return}l({blob:A.blob,expiresAt:A.expiresAt,shared:A.shared??[],failed:A.failed??[]})},[e,C]),I=a?qT(a.expiresAt,w):null,D=(I==null?void 0:I.tone)==="gone",O=(a==null?void 0:a.shared.length)??0;return d.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:d.jsxs("div",{ref:S,className:"modal sa-modal",onClick:A=>A.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Share accounts with another deck",children:[d.jsxs("header",{className:"modal-head",children:[d.jsx("div",{className:"modal-title",children:d.jsx("h3",{children:"Share accounts"})}),d.jsx("div",{className:"modal-actions",children:d.jsx("button",{type:"button",className:"glyph-btn",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),d.jsx("section",{className:"modal-body sa-body",children:a?d.jsxs("div",{className:"sa-step",children:[d.jsx("h4",{children:D?"This share has expired":O===1?"1 account, ready to paste":`${O} accounts, ready to paste`}),d.jsx("code",{className:`ap-share-blob${D?" 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(D){l(null),P();return}await n(a.blob)&&(v(!0),window.setTimeout(()=>v(!1),Z4))},children:D?"make a new share":g?"copied":`copy ${O===1?"the share":"all "+O}`}),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:O===1?"this is the password":`this is ${O} passwords`})," · ",d.jsx("span",{className:`ap-share-expiry ${I==null?void 0:I.tone}`,children:I==null?void 0:I.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 z;const L=!!(A.email&&((z=A.detail)!=null&&z.includes(A.email)));return d.jsxs("li",{children:[!L&&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:D?d.jsx(d.Fragment,{children:"Another deck will refuse this text now. Make a new one — the same accounts are still picked."}):d.jsxs(d.Fragment,{children:["Paste it into the other deck with ",d.jsx("strong",{children:"+"})," → ",d.jsx("strong",{children:"Paste a share"}),". Accounts it already holds are left exactly as they are."]})}),d.jsxs("div",{className:"sa-actions",children:[d.jsx("button",{type:"button",className:"btn",onClick:()=>{l(null),v(!1)},children:"Pick again"}),d.jsx("button",{type:"button",className:"btn primary",onClick:t,children:"Done"})]})]}):e.length===0?d.jsxs("div",{className:"sa-step",children:[d.jsx("h4",{children:"Nothing to share"}),d.jsxs("p",{className:"sa-note",children:["This deck is not holding any accounts right now. Sign one in with ",d.jsx("strong",{children:"+"}),", or wait — the panel is still reading the store."]}),d.jsx("div",{className:"sa-actions",children:d.jsx("button",{type:"button",className:"btn primary",ref:b,onClick:t,children:"Close"})})]}):d.jsxs("div",{className:"sa-step",children:[d.jsxs("h4",{children:["Which accounts go to the other ",Bt,"?"]}),d.jsx("p",{className:`sa-count${C.length?"":" empty"}`,children:G4(C.length)}),d.jsx("ul",{className:"sa-list sa-pick",children:N.map(A=>d.jsx("li",{children:d.jsxs("label",{className:"sa-row",children:[d.jsx("input",{type:"checkbox",checked:C.includes(A.num),onChange:()=>M(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,...ar(u,!C.length),onClick:P,children:u?"making the share…":C.length===0?"Share":C.length===1?"Share 1 account":`Share ${C.length} accounts`})]})]})})]})})}function eD(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 tD(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 nD(e,t,n){return t!=null&&e.some(s=>s.slot===t)?t:n}function rD(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 sD(e,t){return{label:"save",done:"saved",sends:e!==t,swaps:!1,title:`Switch the active account out once it passes ${e}% of its limit.`}}function O1(e){return typeof e.id=="string"&&e.id.startsWith("scoped-")}function P1(e){const t=e.filter(u=>!O1(u)),n=e.filter(u=>O1(u)),s=t.length?t:n,i=t.length?n:[],a=s.reduce((u,h)=>u&&u.pct>=h.pct?u:h,null);let l=null;for(const u of i)a&&u.pct<=a.pct||(!l||u.pct>l.pct)&&(l=u);return{shown:s,rest:i,fuller:l,peak:l??a}}function oD(e,t,n){return e<1?null:t?"fewer":n?`${n.label} ${Math.round(n.pct)}%`:`${e} more`}function iD(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 aD="\0";function Lw(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}${aD}${n}`}function lD(e,t){const n=Lw(t);return e.includes(n)?e.filter(s=>s!==n):[...e,n]}function cD(e,t){if(!Array.isArray(t))return e;const n=new Set(t.map(Lw)),s=e.filter(i=>n.has(i));return s.length===e.length?e:s}const uD=64;function dD(e,t){const n=e.trim();return{alias:n,commit:n!==(t??"").trim()}}const fD=Object.freeze({text:"couldn't reach the deck server",reload:!0});async function $1(e){return e.ok?{ok:!0,status:e.status,body:null}:{ok:!1,status:e.status,body:await e.json().catch(()=>null)}}function hD(e){const t=e.find(s=>!s.ok);if(!t)return null;const n=Vi(t.body);return{text:ew(t.body,`the deck server answered ${t.status}`),...n?{raw:n}:{},reload:!0}}function L1(e,t){return t?e!=null&&e.reload&&e.text===t.text&&e.raw===t.raw?e:t:e!=null&&e.reload?null:e}const q1=15e3,pD=8e3,ih=1800,mD=3e4,gD=[70,80,85,90,95];function D1(e,t){return jT(t-Math.floor(e/1e3))}function yD(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 vD(e){switch(e){case"invalid_grant":case"no_refresh_token":return{text:"login expired",hint:"claude-swap's stored login for this account was rejected and cannot be refreshed. Signing in again replaces it — the account keeps its slot, its alias and its history.",fixable:!0};case"http-401":return{text:"re-login needed",hint:"Anthropic refused this account's token.",fixable:!0};case"http-429":return{text:"rate limited",hint:"Anthropic is throttling requests for this account. It clears on its own.",fixable:!1};case"transient":return{text:"temporary error",hint:"A network or server hiccup while reading usage. The next collection retries.",fixable:!1};case"timeout":return{text:"timed out",hint:"Reading this account's usage took too long. The next collection retries.",fixable:!1};case"network":return{text:"unreachable",hint:"Could not reach Anthropic to read this account's usage.",fixable:!1};default:return{text:e,hint:`claude-swap reported "${e}" for this account.`,fixable:!1}}}function F1({lane:e,nowSec:t}){const n=Math.min(100,Math.max(0,e.pct)),s=n>=90?"var(--err)":n>=70?"var(--warn)":"var(--accent)",i=e.resetAt?TT(e.resetAt,t):null;return d.jsxs("div",{className:"ap-lane",children:[d.jsx("span",{className:"ap-lane-label",children:e.label}),d.jsx("div",{className:"ap-lane-track",children:d.jsx("div",{className:"ap-lane-fill",style:{width:`${n===0?1.5:n}%`,background:s,opacity:n===0?.4:1}})}),d.jsxs("span",{className:"ap-lane-pct",style:{color:s},children:[n,"%"]}),d.jsx("span",{className:"ap-lane-reset",children:i?`resets ${i}`:""})]})}async function z1(e){var n;let t=!1;try{t=await Promise.race([((n=navigator.clipboard)==null?void 0:n.writeText(e).then(()=>!0))??Promise.resolve(!1),new Promise(s=>window.setTimeout(()=>s(!1),500))])}catch{t=!1}if(t)return!0;try{const s=document.createElement("textarea");s.value=e,s.setAttribute("readonly",""),s.style.cssText="position:fixed;top:0;left:0;opacity:0",document.body.appendChild(s),s.select(),t=document.execCommand("copy"),s.remove()}catch{t=!1}return t}function wD({onClose:e}){var qe,Ye,Te,et,it;const[t,n]=_.useState(null),[s,i]=_.useState(null),[a,l]=_.useState(null),[u,h]=_.useState(!1),[p,f]=_.useState(null),[g,v]=_.useState(()=>Math.floor(Date.now()/1e3)),w=_.useRef(null),[E,b]=_.useState(null),[k,S]=_.useState(!1),[N,C]=_.useState(""),[j,M]=_.useState(null),[P,I]=_.useState(null),[D,O]=_.useState(null),[A,L]=_.useState(!1),[z,K]=_.useState(!1),[R,Q]=_.useState(null),[H,ne]=_.useState(null),[X,W]=_.useState(null),[ee,$]=_.useState(null),[Y,de]=_.useState(!1),[G,F]=_.useState([]),J=_.useRef(null),V=_.useCallback(oe=>AT(J.current)?(J.current=oe,l(oe),!0):!1,[]),ae=_.useCallback(()=>{J.current=null,l(null)},[]),pe=(oe,Le=!1)=>{const Ue=RT(a,oe);return{disabled:Ue.disabled,"aria-busy":Ue.busy||Le}},me=_.useCallback(oe=>{window.requestAnimationFrame(()=>{var Le;if(Oq(((Le=document.activeElement)==null?void 0:Le.tagName)??null))for(const Ue of Iq(oe)){const Ce=document.querySelector(Ue);if(Ce){Ce.focus();return}}})},[]),ke=_.useCallback(async(oe=!1)=>{oe&&h(!0);const Le=new AbortController,Ue=window.setTimeout(()=>Le.abort(),mD);try{const[Ce,Ke]=await Promise.all([fetch(`/api/claude-accounts${oe?"?refresh=1":""}`,{signal:Le.signal}),fetch("/api/cswap-auto",{signal:Le.signal})]);if(Ce.ok){const at=await Ce.json();n(at),F(Re=>cD(Re,at.accounts))}Ke.ok&&i(await Ke.json());const jt=hD([await $1(Ce),await $1(Ke)]);f(at=>L1(at,jt))}catch{f(Ce=>L1(Ce,fD))}finally{window.clearTimeout(Ue),oe&&h(!1)}},[]),Ve=_.useCallback(async(oe,Le)=>{if(!V(Le))return null;f(null);try{const Ce=await(await fetch("/api/cswap-auto",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(oe)})).json().catch(()=>null);return Ce!=null&&Ce.ok||f({text:ew(Ce,"command failed"),raw:Vi(Ce)}),Ce}catch{return f({text:"server unreachable"}),null}finally{ae()}},[V,ae]),ze=_.useCallback(async(oe,Le)=>{if(!V(Le))return null;f(null);try{const Ce=await(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(oe)})).json().catch(()=>null);return Ce!=null&&Ce.ok||f({text:$i(Ce,"command failed")}),Ce}catch{return f({text:"server unreachable"}),null}finally{ae()}},[V,ae]);_.useEffect(()=>(ke(!0),w.current=window.setInterval(()=>ke(!1),q1),()=>{w.current!=null&&window.clearInterval(w.current)}),[ke]),_.useEffect(()=>{const oe=window.setInterval(()=>v(Math.floor(Date.now()/1e3)),3e4);return()=>window.clearInterval(oe)},[]);const Oe=((qe=s==null?void 0:s.settings["autoswitch.threshold"])==null?void 0:qe.value)??"90",Ne=ee??Oe,ce=sD(Ne,Oe),be=(Ye=t==null?void 0:t.accounts)==null?void 0:Ye.find(oe=>oe.active),xe=((Te=P1((be==null?void 0:be.lanes)??[]).peak)==null?void 0:Te.pct)??null,he=xe!=null&&xe>=Number(Oe)-15,Pe=async oe=>{if(V(`switch-${oe}`)){f(null);try{const Ue=await(await fetch("/api/claude-accounts/switch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({account:oe})})).json().catch(()=>null);Ue!=null&&Ue.ok||f({text:ew(Ue,"the switch failed"),raw:Vi(Ue)}),await ke(!0)}catch{f({text:"server unreachable"})}finally{ae(),me(oe)}}},Be=async(oe,Le)=>{const{commit:Ue,alias:Ce}=dD(N,Le);if(Ue){const Ke=await ze({action:"alias",account:oe,alias:Ce},`alias-${oe}`);if(await ke(!0),!(Ke!=null&&Ke.ok))return;C(Ce)}M(oe),window.setTimeout(()=>M(Ke=>Ke===oe?null:Ke),ih)},Ze=async(oe,Le)=>{const Ue=await ze({action:"move",account:oe,slot:Le},`move-${oe}`),Ce=tD({menuFor:E,shareFor:(D==null?void 0:D.num)??null},oe,Ue);if(await ke(!0),Ce){b(Ce.menuFor),I(Ce.confirmRemove),Ce.shareFor==null&&(O(null),K(!1)),Q(Ce.swapNote);const Ke=Ce.swapNote;Ke&&window.setTimeout(()=>Q(jt=>jt===Ke?null:jt),pD),ne(null),me(Ce.menuFor)}return Ue},Ge=async(oe,Le,Ue)=>{if(Ue.sends){const Ce=await Ze(oe,Le);if(!(Ce!=null&&Ce.ok))return}W(oe),window.setTimeout(()=>W(Ce=>Ce===oe?null:Ce),ih)},Je=async(oe,Le)=>{if(Le.sends){const Ue=await Ve({action:"setting",key:"autoswitch.threshold",value:oe},"threshold");if(await ke(!0),!(Ue!=null&&Ue.ok))return;$(null)}de(!0),window.setTimeout(()=>de(!1),ih)};return d.jsxs("aside",{className:"accounts-panel",id:"accounts-panel","aria-label":"Claude accounts",children:[d.jsxs("div",{className:"ap-header",children:[d.jsx("h2",{children:"Accounts"}),d.jsxs("div",{className:"ap-header-right",children:[d.jsx("button",{type:"button",className:"glyph-btn ap-add",onClick:()=>S(!0),"aria-label":"Add an account",title:"Sign in to another Claude account, or paste one shared from another deck",children:"+"}),(((et=t==null?void 0:t.accounts)==null?void 0:et.length)??0)>0&&d.jsx("button",{type:"button",className:"glyph-btn ap-share-set",onClick:()=>L(!0),"aria-label":"Share accounts with another deck",title:`Copy several accounts to another ${Bt} in one paste. The text carries a live login for each one — treat it as those passwords.`,children:"↗"}),d.jsx("button",{type:"button",className:"glyph-btn ap-refresh",onClick:()=>ke(!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 ",q1/1e3," seconds."]}),d.jsx("button",{type:"button",className:"ap-fix",disabled:u,onClick:()=>ke(!0),children:u?"trying…":"try again"})]}):d.jsx("div",{className:"ap-empty",children:"Checking…"}):t.ok?d.jsxs(d.Fragment,{children:[(it=t.accounts)==null?void 0:it.map(oe=>{const{shown:Le,rest:Ue,fuller:Ce,peak:Ke}=P1(oe.lanes),jt=G.includes(Lw(oe)),at=oD(Ue.length,jt,Ce);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${E===oe.num?" on":""}`,"aria-label":`Manage account ${oe.num}`,"aria-expanded":E===oe.num,"aria-controls":E===oe.num?`ap-manage-${oe.num}`:void 0,title:"Share, rename, move, remove",onClick:()=>{b(E===oe.num?null:oe.num),C(oe.alias??""),I(null),O(null),K(!1),Q(null),M(null),ne(null),W(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:()=>Pe(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:Le.length?d.jsxs(d.Fragment,{children:[Le.map(Re=>d.jsx(F1,{lane:Re,nowSec:g},Re.id)),jt&&Ue.map(Re=>d.jsx(F1,{lane:Re,nowSec:g},Re.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 Re=await ze({action:"recapture"},"recapture");Re!=null&&Re.ok&&ke(!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 Re=vD(oe.error);return d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"ap-err",title:Re.hint,children:Re.text}),Re.fixable&&d.jsx("button",{type:"button",className:"ap-fix",onClick:()=>S(!0),title:"Open the sign-in dialog. Signing in as this account replaces its stored login in place.",children:"sign in again"})]})})(),at&&d.jsx("button",{type:"button",className:"ap-lanes-more","aria-expanded":jt,"aria-controls":`ap-lanes-${oe.num}`,title:iD(oe.headroom,(Ke==null?void 0:Ke.label)??null,Ue.length,jt),onClick:()=>F(Re=>lD(Re,oe)),children:at}),(((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(()=>ke(!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 ",D1(oe.fetchedAt,g),yD(oe.nextAt,g)]}):d.jsx("span",{className:"ap-age ap-stale",title:"claude-swap has not read this account yet",children:"never collected"})]}),E===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:N,onChange:Re=>C(Re.target.value),onKeyDown:Re=>{Re.key==="Enter"&&Be(oe.num,oe.alias)},maxLength:uD,placeholder:"e.g. work",spellCheck:!1,autoFocus:!0}),d.jsx("button",{type:"button",className:"ap-manage-btn",...pe(`alias-${oe.num}`),onClick:()=>Be(oe.num,oe.alias),title:"A short name to show instead of the email",children:j===oe.num?"saved":"save"})]}),(()=>{const Re=eD((t.accounts??[]).map(yt=>yt.num),oe.num),bt=nD(Re,H,oe.num),ft=rD(Re,bt,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(bt),...pe(`move-${oe.num}`),onChange:yt=>ne(Number(yt.target.value)),children:Re.map(yt=>d.jsx("option",{value:yt.slot,children:yt.label},yt.slot))})}),d.jsx("button",{type:"button",className:"ap-manage-btn",...pe(`move-${oe.num}`),title:ft.title,onClick:()=>Ge(oe.num,bt,ft),children:X===oe.num?ft.done:ft.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 ${Bt}. Anyone who has the text can use the account — treat it as the password. The other deck stops accepting it after 10 minutes; that does not make an escaped copy safe.`,onClick:async()=>{K(!1);const Re=await ze({action:"share",account:oe.num},`share-${oe.num}`);Re!=null&&Re.ok&&O({num:oe.num,blob:Re.blob,expiresAt:Re.expiresAt})},children:"share"}),d.jsx("button",{type:"button",className:`ap-manage-btn danger${P===oe.num?" armed":""}`,...pe(`rm-${oe.num}`),title:P===oe.num?"This deletes the stored credentials for this account":"Remove this account from claude-swap",onClick:()=>{if(P!==oe.num){I(oe.num),window.setTimeout(()=>I(Re=>Re===oe.num?null:Re),4e3);return}I(null),ze({action:"remove",account:oe.num},`rm-${oe.num}`).then(()=>{b(null),ke(!0),me(null)})},children:P===oe.num?"confirm":"remove"})]}),(R==null?void 0:R.at)===oe.num&&(()=>{var ft;const Re=(ft=t.accounts)==null?void 0:ft.find(yt=>yt.num===R.displaced),bt=(Re==null?void 0:Re.alias)??(Re==null?void 0:Re.email)??"the account that was there";return d.jsxs("span",{className:"ap-manage-hint ap-manage-swap",title:`Slot ${R.at} was taken, so the two accounts traded places: ${bt} now holds slot ${R.displaced}.`,children:["swapped with slot ",R.displaced]})})(),(D==null?void 0:D.num)===oe.num&&(()=>{const Re=qT(D.expiresAt,g),bt=Re.tone==="gone";return d.jsxs("div",{className:`ap-share${bt?" expired":""}`,children:[d.jsx("code",{className:"ap-share-blob",children:D.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(bt){K(!1);const ft=await ze({action:"share",account:oe.num},`share-${oe.num}`);ft!=null&&ft.ok&&O({num:oe.num,blob:ft.blob,expiresAt:ft.expiresAt});return}await z1(D.blob)&&(K(!0),window.setTimeout(()=>K(!1),1800))},children:bt?"make a new share":z?"copied":"copy"}),d.jsxs("span",{className:"ap-manage-hint",title:"This text is the account's password. It is base64 of plain JSON — the expiry inside it is not signed, so anyone holding a copy can change it, and the login itself is in there in the clear either way. The countdown only says how long another deck's import dialog will still accept it. If a copy escapes, sign the account out and back in.",children:[d.jsx("span",{className:"ap-share-warn",children:"this is the password"})," · ",d.jsx("span",{className:`ap-share-expiry ${Re.tone}`,children:Re.text})]})]})]})})()]})]},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${he?" 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:Ne,...pe("threshold"),onChange:oe=>$(oe.target.value),children:gD.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:()=>Je(Ne,ce),children:Y?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(()=>ke(!0)),title:s.enabled?"Stop switching accounts automatically":"Switch accounts automatically when the active one nears its limit",children:[d.jsx("i",{className:s.enabled?"ap-pulse":"ap-dot","aria-hidden":!0}),s.enabled?"on":"off"]})]})]}),s.external&&d.jsxs("p",{className:"ap-auto-note",children:[d.jsx("i",{className:"ap-pulse","aria-hidden":!0})," A ",d.jsx("code",{children:"cswap auto"})," loop in your terminal is doing the switching. The deck stands down while it runs",s.enabled?" — this toggle takes over when you stop it.":"."]}),s.lastTick&&d.jsx("div",{className:"ap-auto-foot",children:d.jsxs("span",{className:"ap-auto-result",children:["checked ",D1(s.lastTick.at,g)]})})]}),p&&d.jsxs("div",{className:"ap-failure",role:"alert",children:[d.jsx("span",{className:"ap-failure-text",title:p.raw||void 0,children:p.text}),d.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>f(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),d.jsx("p",{className:"ap-footnote",title:"Anthropic's usage endpoint allows roughly 28–30 requests per hour per account, shared by every tool on this machine — polling it from here would rate-limit your account. So the deck never fetches: it asks claude-swap to collect while this panel is open, at most once every three minutes, and claude-swap decides whether that touches the network at all.",children:"These numbers only update while this panel is open."})]}):d.jsx("div",{className:"ap-empty",children:t.reason==="no_cswap"?d.jsxs(d.Fragment,{children:[d.jsx("span",{children:"claude-swap isn't installed."}),d.jsx("span",{className:"ap-hint",children:"This panel reads the account store claude-swap keeps — without it there is nothing to show. It is a separate tool, published on PyPI, so it does not come with this package."}),t.hint&&d.jsx("code",{className:"ap-cmd",children:t.hint}),d.jsxs("span",{className:"ap-hint",children:["Then add an account with the ",d.jsx("strong",{children:"+"})," button above."]})]}):t.reason==="no_accounts"?d.jsxs(d.Fragment,{children:[d.jsx("span",{children:"No accounts added yet."}),d.jsxs("span",{className:"ap-hint",children:["claude-swap is installed but has nothing in its store. Use the ",d.jsx("strong",{children:"+"})," above to sign one in, or to paste one shared from another deck."]})]}):d.jsxs(d.Fragment,{children:[d.jsx("span",{children:"Couldn't read the account store."}),d.jsxs("span",{className:"ap-hint",children:["claude-swap is installed, but its store could not be read",t.reason?` (${t.reason})`:"","."]})]})}),k&&d.jsx(X4,{onClose:()=>S(!1),onChanged:()=>ke(!0)}),A&&d.jsx(J4,{accounts:((t==null?void 0:t.accounts)??[]).map(oe=>({num:oe.num,email:oe.email,alias:oe.alias,org:oe.org})),onClose:()=>L(!1),copyText:z1})]})}const xD=3e4;function bD({bundle:e,running:t,lastTried:n}){return!t||e===t?!1:n!==t}function kD({bundle:e,running:t,pending:n,lastTried:s}){return t?bD({bundle:e,running:t,lastTried:s})?"reload":n==null||n&&n!==t?"wait":"confirm":"wait"}function _D(e){return!e||e.state!=="failed"?null:`${typeof e.at=="number"?e.at:0}:${e.error??""}`}function SD({asked:e,reported:t}){return t?t!==e:!1}function ND(e){const t=e.thresholdMs??xD;return!e.enabled||e.kind!=="restart"||!e.canRestart||!e.noticeOpen?{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 ED(e,t){return e==="confirmation"?t.confirmOpen?"clear":"ignore":t.modalOpen||t.confirmOpen?"ignore":"confirm"}function CD(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 jD(e){return e<=0?null:e===1?"the one agent":`all ${e} agents`}function TD(e,t){const n=jD(e),s=n?`removes ${n} on the canvas`:null,i=u=>`This ${s?`${s} and ${u}`:u}`;if(!t)return{note:`${i("deletes the event log on disk")} — the file a restarted deck replays to rebuild what you see, and the file every deck on this machine shares unless one was told otherwise. Layout, pins and selection go with it. This cannot be undone.`,confirm:"Clear everything"};if(!t.path)return{note:`${i("leaves nothing on disk — this deck keeps no event log")}. Layout, pins and selection go with it. This cannot be undone.`,confirm:"Clear everything"};if(!t.mine){const u=t.ownerPort===null?"another running deck owns that file":`the deck on port ${t.ownerPort} owns that file`,h=t.decks>2?`, one of ${t.decks} decks sharing it`:"";return{note:`${i(`leaves the event log alone: ${u}${h}`)}. Clearing here empties this canvas only — restart this deck and the log replays back onto it. Layout, pins and selection go with it.`,confirm:"Clear this canvas"}}if(t.decks<=1)return{note:`${i("deletes this deck's event log")} — the file a restarted deck replays to rebuild what you see. Layout, pins and selection go with it. This cannot be undone.`,confirm:"Clear everything"};const a=t.decks-1,l=a===1?"That deck keeps what is on its canvas until it restarts, and then it is gone there too.":"Those decks keep what is on their canvases until they restart, and then it is gone there too.";return{note:`${i(`deletes the event log ${a===1?"1 other running deck shares":`${a} other running decks share`} with this one`)} — every session recorded in it, not just the ones drawn here. ${l} This cannot be undone.`,confirm:"Clear everything"}}function RD({agentCount:e,onConfirm:t,onCancel:n}){const s=_.useRef(null),i=_n(n,{focusRef:s,layer:QL}),[a,l]=_.useState(null);_.useEffect(()=>{let p=!1;return fetch("/api/clear").then(f=>f.ok?f.json():null).then(f=>{p||l(CD(f))}).catch(()=>{}),()=>{p=!0}},[]);const{note:u,confirm:h}=TD(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 AD="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.",MD=[{title:"Canvas",rows:[{cap:"Space",action:"pause or resume the stream",binds:[" "]},{cap:"J",action:"next agent",binds:["j","J"]},{cap:"K",action:"previous agent",binds:["k","K"]},{cap:"F",action:"fit every agent on screen",binds:["f","F"]},{cap:"R",action:"re-arrange the canvas and drop the pins",binds:["r","R"]},{cap:"C",action:"clear the canvas and the event log — asks first",binds:["c","C"]}]},{title:"Panels and dialogs",rows:[{cap:"U",action:"usage panel",binds:["u","U"]},{cap:"L",action:"session list",binds:["l","L"]},{cap:"H",action:"usage history",binds:["h","H"]},{cap:"A",action:"Claude accounts, where Claude Code is installed",binds:["a","A"]},{cap:"?",action:"this sheet",binds:["?"]}]},{title:"Settings",rows:[{cap:"M",action:"sound on or off",binds:["m","M"]},{cap:"T",action:"light or dark theme",binds:["t","T"]}]},{title:"Focus and selection",rows:[{cap:"Tab",action:"reach the agent cards",binds:[]},{cap:"Enter",action:"select the focused card",binds:["Enter"]},{cap:"Shift + Enter",action:"add the focused card to the selection",binds:["Enter"]},{cap:"Esc",action:"close what is open, deselect, release focus",binds:["Escape"]}]},{title:"Mouse",rows:[{cap:"drag",action:"move a node, and pin it where you dropped it",binds:[]},{cap:"shift-click",action:"add an agent to the selection",binds:[]},{cap:"click",action:"the topbar speaker opens volume and sound settings",binds:[]}]}];function ID({onClose:e}){const t=_n(e);return d.jsx("div",{className:"modal-backdrop",onClick:e,role:"presentation",children:d.jsxs("div",{ref:t,className:"modal key-help",onClick:n=>n.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"key-help-title",children:[d.jsxs("header",{className:"modal-head",children:[d.jsx("div",{className:"modal-title",children:d.jsx("span",{id:"key-help-title",className:"modal-tool-name",children:"Keyboard shortcuts"})}),d.jsx("div",{className:"modal-actions",children:d.jsx("button",{type:"button",className:"glyph-btn",onClick:e,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),d.jsxs("section",{className:"modal-body",children:[d.jsx("p",{className:"modal-note",children:AD}),d.jsx("div",{className:"shortcuts",children:MD.map(n=>d.jsxs(_.Fragment,{children:[d.jsx("h3",{className:"kh-group",children:n.title}),n.rows.map(s=>d.jsxs("div",{className:"sc",children:[d.jsx("kbd",{children:s.cap}),d.jsx("span",{children:s.action})]},`${n.title}:${s.cap}:${s.action}`))]},n.title))})]})]})})}const OD=["done","needs-input"],PD=[{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}]}],$D=[{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}]}],qw={done:PD,"needs-input":$D},Yi="two";function nw(e,t){const n=qw[e];return n.find(s=>s.id===t)??n.find(s=>s.id===Yi)??n[0]}function DT(e,t){return qw[e].some(s=>s.id===t)?t:Yi}nw("done",Yi).notes,nw("needs-input",Yi).notes;const B1=.04,LD=.24,FT=0,Dw=100,rw=5,wl=50;function xl(e){if(!Number.isFinite(e))return wl;const t=Math.round(e/rw)*rw;return Math.min(Dw,Math.max(FT,t))}function qD(e){if(e==null)return wl;const t=e.trim();return/^-?\d+(\.\d+)?$/.test(t)?xl(Number(t)):wl}function DD(e){const t=xl(e),n=B1+(LD-B1)*(t/Dw);return Math.round(n*1e4)/1e4}function FD(e,t){const n=t.trim,s=typeof n=="number"&&Number.isFinite(n)&&n>0&&n<=1?n:1;return Math.round(DD(e)*s*1e4)/1e4}const zD=160,BD="agent-dag.soundLevel.done",UD="agent-dag.soundLevel.needs-input",WD="agent-dag.soundFigure.done",HD="agent-dag.soundFigure.needs-input",zT={done:BD,"needs-input":UD},BT={done:WD,"needs-input":HD},sw={done:{level:wl,figure:Yi},"needs-input":{level:wl,figure:Yi}};function GD(e){const t=n=>({level:qD(e(zT[n])),figure:DT(n,e(BT[n]))});return{done:t("done"),"needs-input":t("needs-input")}}const VD={Stop:"done",Notification:"needs-input"};function YD(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:VD[n]??null}function KD(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 E;if(!p&&!e.enabled()||!n||n.state!=="running")return!1;const f=(((E=e.prefs)==null?void 0:E.call(e))??sw)[h]??sw[h],g=nw(h,f.figure),v=FD(f.level,g),w=n.currentTime;for(const b of g.notes){const k=n.createOscillator(),S=n.createGain();k.type=g.type??"sine",k.frequency.value=b.hz;const N=w+b.at,C=N+b.ms/1e3;S.gain.setValueAtTime(1e-4,N),S.gain.exponentialRampToValueAtTime(v,N+.012),S.gain.exponentialRampToValueAtTime(1e-4,C),k.connect(S).connect(n.destination),k.start(N),k.stop(C+.02)}return!0}return{unlock:l,play:u,state:i,get context(){return n}}}const U1={done:"Turn finished","needs-input":"Claude is asking"},XD={done:"Every finished turn, on both CLIs.","needs-input":"Claude Code only — Codex has no such event."};function QD({onClose:e,soundOn:t,onToggleSound:n,prefs:s,onLevel:i,onFigure:a,onPreview:l,openerRef:u,notifyOn:h,onToggleNotify:p,notifyVetoed:f,notifyPermission:g,onAskNotify:v}){const w=_n(e),E=_.useRef(e);return E.current=e,_.useEffect(()=>{const b=k=>{var N,C;const S=k.target;S&&((N=w.current)!=null&&N.contains(S)||(C=u.current)!=null&&C.contains(S)||E.current())};return window.addEventListener("pointerdown",b,!0),()=>window.removeEventListener("pointerdown",b,!0)},[w,u]),d.jsxs("div",{ref:w,id:"sound-menu",className:"sound-menu",role:"dialog","aria-label":"Sound settings",children:[d.jsxs("button",{type:"button",className:"btn sm-switch",onClick:n,"aria-pressed":t,children:[d.jsx("span",{className:"sm-switch-label",children:"Sound"}),d.jsx("span",{className:"sm-switch-state",children:t?"on":"off"})]}),d.jsxs("button",{type:"button",className:"btn sm-switch",onClick:p,"aria-pressed":h,title:f?"Recorded for next time: this deck was started with AGENTS_DECK_NO_NOTIFY=1, which overrules the switch":"A system notification when a session blocks on you — from this page while it is behind something, and from the deck itself when no page is open",children:[d.jsx("span",{className:"sm-switch-label",children:"Notifications"}),d.jsx("span",{className:"sm-switch-state",children:f?"off — set at launch":h?"on":"off"})]}),h&&!f&&g!=="granted"&&(g==="default"?d.jsxs("button",{type:"button",className:"btn sm-notice",onClick:v,children:[d.jsx("span",{className:"sm-notice-text",children:"This browser has not been asked yet"}),d.jsx("span",{className:"sm-notice-act",children:"ask now"})]}):d.jsx("p",{className:"sm-note sm-notice-note",children:g==="denied"?"This browser is blocking notifications from the deck. Only its own site settings can undo that — no page is allowed to ask again.":"This browser cannot show notifications, so only the deck's own desktop notification will arrive."})),OD.map(b=>{const k=s[b],S=`sm-level-${b}`,N=`sm-figure-${b}`;return d.jsxs("section",{className:"sm-tone","aria-labelledby":`sm-name-${b}`,children:[d.jsxs("div",{className:"sm-tone-head",children:[d.jsx("h3",{className:"sm-tone-name",id:`sm-name-${b}`,children:U1[b]}),d.jsxs("button",{type:"button",className:"btn sm-hear",onClick:()=>l(b),"aria-label":`Hear the ${U1[b].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:S,children:"Volume"}),d.jsx("input",{id:S,type:"range",min:FT,max:Dw,step:rw,value:k.level,onChange:C=>i(b,Number(C.target.value))}),d.jsxs("span",{className:"sm-read",children:[k.level,"%"]})]}),d.jsxs("div",{className:"sm-row",children:[d.jsx("label",{htmlFor:N,children:"Sound"}),d.jsx("select",{id:N,className:"sm-select",value:k.figure,onChange:C=>a(b,C.target.value),children:qw[b].map(C=>d.jsx("option",{value:C.id,children:C.label},C.id))})]}),d.jsx("p",{className:"sm-note",children:XD[b]})]},b)}),d.jsx("p",{className:"sm-foot",children:"M turns the sound on and off from anywhere."})]})}const ZD={"//":["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.9.0":[{title:"🎛️ Five switches that were not where the thing they control is",body:'**The session list has a button again.** It lost one a while back and only the `L` key was left — and `L` is written down in one place, a shortcuts sheet behind a small `?` in the corner of the canvas. If you use a mouse there was no way to open the list at all. The `☰` is back at the left of the top bar.\n\n**The Notifications switch now tells you whether the browser will actually show one.** It said `on` while this browser had never been asked for permission, which is not the same thing. It now says so on that row and offers the ask right there. Before, the only place to grant it was a button that appears solely while a session is stuck waiting — so on a machine where that rarely happens you could not switch notifications on at all.\n\n**Started with `--workspace` or `--scope` and seeing nothing?** The empty screen used to tell everyone to "run `claude` or `codex` in any folder", which is the one thing that cannot work for you. It now names the folder the deck is actually watching.\n\n**Browser Watch says when a setting did not save.** Flipping the switch and having it fail showed a red line reading "Could not read" — about reading history, not about your press — and ten seconds later the panel wiped it and looked perfectly healthy with the setting unchanged. A failed save now says so, in its own words, and stays until you dismiss it. The "nobody browsing for" menu also follows the stored value again: change it in a second tab and this one never caught up.\n\n**The deck no longer restarts itself when nothing on screen offers to stop it.** Thirty seconds after the last agent went quiet, with a new version on disk, the server would exit, come back and reload the page. The `auto when idle` switch that controls that lives inside the update banner — so if you had closed the banner with its `×`, it happened with no visible setting anywhere. Closing the banner now also stands down the restart; clicking the version chip brings back both together.'}],"3.8.9":[{title:"🖥️ Four things that only went wrong on somebody else's operating system",body:"**Ubuntu:** the deck knew where Chromium and Brave keep their profiles when installed as a snap or a flatpak — which on a default Ubuntu is the only place Chromium is — but not what those programs are called. So it reported them as not running while they were, and refused to quit them. Both now work.\n\n**Windows:** the deck asked the system whether it could write to the folder an update installs into, and Windows always answers yes for a folder whatever the permissions say. It offered you an update that then died inside npm with a permission error. It now finds out by trying, and declines up front with the command to run yourself — which is what every other platform already got.\n\n**Linux:** if `XDG_DATA_HOME` was set to something starting with `~`, as it is from a systemd unit or a Dockerfile, the deck and claude-swap looked in two different places for your accounts. The panel said you had none while `cswap list` showed them all.\n\n**Plain terminals:** six messages used a typographic dash the old Windows console and the Linux text console cannot draw, so a box appeared mid-sentence — including in the line that explains why no events are arriving. They use the plain form on those terminals now, like everything else already did."}],"3.8.8":[{title:"📉 A false 99% on the memory chart, and three other quiet failures",body:`**The machine meter no longer invents a reading.** When the deck could not measure memory — a subprocess that would not start under load, or one that took too long — it substituted a number that means something else, and on a Mac that reads as about 99% used. The meter went red for half a minute, and because the chart keeps the highest value in each minute, that false peak stayed on it for a full day. A poll that cannot measure now keeps the last reading and records nothing: a gap in the chart is honest.
|
|
79
|
+
|
|
80
|
+
**A failed ccusage repair no longer disables the repair.** If the deck found a half-installed copy it removes it and starts again. On Windows that removal can fail for a few seconds because the program it just ran still has the folder open — and the deck then treated the attempt as spent and never tried again for the rest of the session, leaving the panel permanently unable to read your usage. It now only counts a repair that happened.
|
|
81
|
+
|
|
82
|
+
**Changing the auto-switch interval takes effect even during startup.** Set it in the first seconds after launch and the timer kept the old value for the life of the process, while the panel showed the new one.
|
|
83
|
+
|
|
84
|
+
**Codex sessions with very large histories no longer cost hundreds of megabytes to read.** The deck read the whole file to find four values that live at its two ends — measured at 185 MB of memory and 95ms of frozen interface for one 44 MB session. It now reads only the ends.`}],"3.8.7":[{title:"🧠 Four things in the panel that behaved wrongly",body:`**Today's figure no longer overshoots.** Once a minute, when a fresh reading landed, the headline briefly counted past the true number and back down — it was measuring the last minute of spend from a starting point one moment out of date. The reading and its starting point are now recorded together, so there is no moment where they can disagree.
|
|
85
|
+
|
|
86
|
+
**Browser Watch marks findings read when you close it, not when you open it.** It was clearing the badge immediately, and stamping every new finding as read the moment it arrived — so anything that turned up while you were reading was never badged at all. It was also writing to storage four times a second the whole time the panel was open.
|
|
87
|
+
|
|
88
|
+
**A hidden tool category can always be brought back.** Hide one, leave the deck running, and once the canvas had turned over the row of chips disappeared while the filter stayed on — no bubbles, and nothing to press. Only reloading fixed it. The chips now stay for as long as anything is hidden.
|
|
89
|
+
|
|
90
|
+
**Clicking a session's name no longer switches auto-fit off.** The deck was reading its own camera move as you grabbing the canvas, and remembered it across restarts, with nothing said.`}],"3.8.6":[{title:"🗂️ Two decks can no longer both claim the same log",body:"When several decks share one events log they elect a single writer for it, so nothing is recorded twice. That election compared the path as typed — so two decks reaching the SAME file by different spellings each thought they were alone, both wrote every event, and each believed the log was theirs to clear.\n\nDifferent spellings are ordinary, not exotic: a shortened Windows home directory, a mapped or substituted drive, a junction, or on macOS `/tmp` against `/private/tmp`. The visible symptoms were duplicated tool calls after a restart, and Clear wiping history belonging to another deck.\n\nThe path is now canonicalised the same way the watched folder already was. It works on a first run too, before the log file exists."}],"3.8.5":[{title:"⛔ Cancelling a sign-in no longer adds the account anyway",body:`Press Escape while adding a Claude account and the deck killed the sign-in — and then, sometimes, registered the account regardless, switched to it, and told you it had worked.
|
|
91
|
+
|
|
92
|
+
The deck asks the tools it runs whether they finished cleanly. A program that is well behaved about being cancelled tidies up and exits with a success code, and the deck was reading that as "it finished" rather than "I stopped it". \`claude auth login\` is exactly that kind of program.
|
|
93
|
+
|
|
94
|
+
A cancelled run now reports as cancelled. Everything that was not cancelled is unaffected.`}],"3.8.4":[{title:"🧷 Your own hooks can no longer be eaten by two decks starting together",body:'If you keep hooks of your own in `settings.json`, the deck parks them while it installs and puts them back afterwards. Two decks starting at the same moment could interleave inside that, and the loser wrote a version of the file computed before the restore — so your hook was gone from `settings.json` and gone from the park, which was its only other copy.\n\nThere was already a check for this, and it had a hole: if the last-moment re-read of the file failed, it read that as "nothing changed" and wrote anyway. A failed read is the one moment that check was most needed, because the usual reason a file cannot be read for a few milliseconds is that something else has just written it.\n\n`ccdeck --uninstall` had no such check at all and could overwrite a deck that was starting, then exit 0 saying it had succeeded. It has one now, and when it declines it says so and tells you to run it again rather than reporting that there was nothing to remove.'}],"3.8.3":[{title:"🪟 Windows: two settings files that could refuse to save",body:`On Windows a file cannot be moved into place while anything else has it open, and Defender and the search indexer open a file the instant it is written. The deck has had a retry for that for a long time, and two files written in the last few days were not using it: the notifications preference, and Browser Watch's episode archive.
|
|
95
|
+
|
|
96
|
+
When it bit, the notifications switch silently did not stick, and Browser Watch answered an error and showed an empty panel. Both now retry the way everything else in the deck already did.
|
|
97
|
+
|
|
98
|
+
Nothing changes on macOS or Linux, where the operating system never refused the move in the first place — which is why this got past a green test suite on both.`}],"3.8.2":[{title:"⌨️ A closed-behind-your-back dialog no longer kills every keyboard shortcut",body:`Open the context ring on a session's card and leave it open. The session finishes, and a couple of minutes later the canvas evicts it — or you press Clear. The dialog vanished, and from that moment every shortcut in the deck stopped working: Space, C, R, F, L, H, U, A, J, K, T, M, and the trash button too. Only reloading the page brought them back.
|
|
99
|
+
|
|
100
|
+
The deck was still counting the dialog as open, because it remembered which session you had opened it for rather than whether anything was on screen. It now closes the dialog when its session leaves the board, which is what should have happened in the first place. The end-of-session recap had the same problem and is fixed with it.`}],"3.8.1":[{title:"🔒 Security: update if the deck runs on a Mac",body:"A local process able to reach the deck's port — no token, no browser, no tab — could get a string of its choosing compiled as AppleScript when the deck raised a desktop notification with no page open. On macOS that is code running as you.\n\nThe strings were already passed as arguments rather than pasted into the script, which is normally the whole defence. It is not enough for `osascript`: its option parser reads any argument starting with a dash as an option, so a name beginning with `-e` was taken as more script instead of as text. Every place the deck hands `osascript` or `notify-send` something from outside now carries an explicit end-of-options marker, so nothing from outside can be read as an instruction again.\n\nNothing to change on your side beyond updating. If you would rather keep the deck off the desktop entirely, the Notifications switch in the sound menu does that, and `AGENTS_DECK_NO_NOTIFY=1` does it at launch — but the fix is the thing to have."}],"3.8.0":[{title:"🔕 Notifications now have an off switch",body:`3.7.0 gave you a "notify me" button and no way back. Turning them off meant digging into your browser's site settings — which no page can do for you — and that still left the other notifier, the one the deck raises when no page is open at all. Silencing that one meant quitting the deck and starting it again with \`AGENTS_DECK_NO_NOTIFY=1\` in front. The person who wanted quiet was the one doing the work.
|
|
101
|
+
|
|
102
|
+
There is a **Notifications** switch in the sound menu now, beside the one for sound — that menu is already "how loudly does this deck interrupt me". One switch governs both notifiers, it takes effect immediately without a restart, and it is remembered across restarts.
|
|
103
|
+
|
|
104
|
+
It is kept by the deck rather than by your browser, because the second notifier runs when no page exists and a setting living in a page could never reach it. \`AGENTS_DECK_NO_NOTIFY=1\` still wins over the switch — a machine told at launch to stay off the desktop stays off it — and when that is the case the menu says so instead of showing an "on" that will not happen.`}],"3.7.1":[{title:"🔔 The notifications now fire on the thing that actually stops your agent",body:`3.7.0 could tell you a session was waiting — but only when Claude Code asked permission to run a tool. If you work with permissions bypassed, that never happens, and the whole feature was silent for you. Measured on one real log: 1683 events, every one of them in bypassPermissions, and a single permission prompt in the entire history.
|
|
105
|
+
|
|
106
|
+
What fires constantly on that setup is the other kind: the agent asking you a question and stopping for the answer. The deck was throwing those away — no amber chip, no row in the sidebar, no notification, and no "notify me" button, because the button only appears while something is actually blocked.
|
|
107
|
+
|
|
108
|
+
Now they count. The card carries the question itself rather than a generic "Your turn" — "paycore needs your input: merge both branches to main, or just one?" — and so does the notification, on the desktop, whether the tab is behind something or not open at all.
|
|
109
|
+
|
|
110
|
+
An idle prompt still stays quiet: a turn that ended is not a session that is stuck, and a channel that cries wolf is one you switch off.`}],"3.7.0":[{title:"🔔 The deck can reach you when you are not looking at it",body:`The deck's whole point is telling you which agent is waiting on you, and until now it could only say so on screen — the amber chip, the tab title, the favicon. Every one of those is drawn inside a page, so the one moment it matters, when you have walked away and four agents have gone quiet, the deck was silent.
|
|
111
|
+
|
|
112
|
+
Now it reaches the desktop, two ways that never overlap. With the deck open behind something, the page raises the notification itself: a "notify me" button appears in the top bar the first time a session blocks, and the browser asks you — nothing is requested before there is something to notify you about. With no page open at all, the server raises it, because it can see that nobody is connected and therefore that no other surface is saying anything.
|
|
113
|
+
|
|
114
|
+
One notification per session, replaced rather than stacked if a second deck raises it too. Clicking it brings the tab forward. \`AGENTS_DECK_NO_NOTIFY=1\` turns the desktop side off entirely, and if you refuse the browser prompt the deck says so plainly instead of leaving you thinking you switched something on — after a refusal only your browser's site settings can undo it, which no page is allowed to touch.`},{title:"🧩 A blocked session now says what it is asking for",body:'"Waiting on you" told you to go and look. The session row and the card now carry the tool the prompt is most likely about, and the tooltip carries the one line of its input that a person actually reads — `rm -rf node_modules` rather than `{"command":"rm -rf node_modules"}`.\n\nIt is a guess and it is worded as one: the deck sees the tool calls, not the permission dialog, so it says "likely on". The deck still cannot allow, deny or answer anything for your agent, and it never will.'},{title:"🧮 Today's figure was counting some sessions twice",body:`The panel reads your usage from ccusage once a minute and fills the gap in between from what the deck is watching. The filling-in was wrong: any session that reached the canvas after the reading had landed was added in full, and since the canvas is still loading when the first reading arrives, that was most of them.
|
|
115
|
+
|
|
116
|
+
Measured on a deck four seconds old: ccusage said $450 for today and the panel said $1,006. The table underneath it said $450 the whole time, which is the disagreement to trust.
|
|
117
|
+
|
|
118
|
+
The deck now adds only work it has actually watched happen. A session that starts while you are looking shows up at the next reading instead of instantly — up to a minute — which is how the panel behaved before the live figure existed at all. Everything already on screen keeps moving as it did.`}],"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.
|
|
119
|
+
|
|
120
|
+
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.
|
|
121
|
+
|
|
122
|
+
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.
|
|
123
|
+
|
|
124
|
+
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.
|
|
125
|
+
|
|
126
|
+
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.
|
|
127
|
+
|
|
128
|
+
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.
|
|
129
|
+
|
|
130
|
+
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.
|
|
131
|
+
|
|
132
|
+
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.
|
|
133
|
+
|
|
134
|
+
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.
|
|
135
|
+
|
|
136
|
+
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.
|
|
137
|
+
|
|
138
|
+
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.
|
|
139
|
+
|
|
140
|
+
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.
|
|
141
|
+
|
|
142
|
+
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.
|
|
143
|
+
|
|
144
|
+
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.
|
|
145
|
+
|
|
146
|
+
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.
|
|
147
|
+
|
|
148
|
+
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.
|
|
149
|
+
|
|
150
|
+
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.
|
|
151
|
+
|
|
152
|
+
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.
|
|
153
|
+
|
|
154
|
+
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.
|
|
155
|
+
|
|
156
|
+
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.
|
|
157
|
+
|
|
158
|
+
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.
|
|
159
|
+
|
|
160
|
+
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.
|
|
161
|
+
|
|
162
|
+
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.
|
|
163
|
+
|
|
164
|
+
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.
|
|
165
|
+
|
|
166
|
+
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.
|
|
167
|
+
|
|
168
|
+
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.
|
|
169
|
+
|
|
170
|
+
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".
|
|
171
|
+
|
|
172
|
+
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.
|
|
173
|
+
|
|
174
|
+
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.
|
|
175
|
+
|
|
176
|
+
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.
|
|
177
|
+
|
|
178
|
+
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.
|
|
179
|
+
|
|
180
|
+
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.
|
|
181
|
+
|
|
182
|
+
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.
|
|
183
|
+
|
|
184
|
+
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.
|
|
185
|
+
|
|
186
|
+
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.
|
|
187
|
+
|
|
188
|
+
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.
|
|
189
|
+
|
|
190
|
+
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.
|
|
191
|
+
|
|
192
|
+
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.
|
|
193
|
+
|
|
194
|
+
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.
|
|
195
|
+
|
|
196
|
+
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.
|
|
197
|
+
|
|
198
|
+
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.
|
|
199
|
+
|
|
200
|
+
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.
|
|
201
|
+
|
|
202
|
+
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.
|
|
203
|
+
|
|
204
|
+
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.
|
|
205
|
+
|
|
206
|
+
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."}]},Fw="agent-dag.releaseNotesSeen";function W1(e){return e.split(/[.\-+]/).map(t=>parseInt(t,10)).map(t=>Number.isNaN(t)?0:t)}function Ki(e,t){const n=W1(e),s=W1(t);for(let i=0;i<Math.max(n.length,s.length);i++){const a=(n[i]??0)-(s[i]??0);if(a!==0)return a<0?-1:1}return 0}function Xi(e){return typeof e=="string"&&/^\d+\.\d+\.\d+/.test(e)}function JD(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 e5(e){if(!e||typeof e!="object")return[];const t=[];for(const[n,s]of Object.entries(e)){if(!Xi(n)||!Array.isArray(s))continue;const i=s.filter(JD);i.length&&t.push({version:n,notes:i})}return t.sort((n,s)=>Ki(s.version,n.version))}const H1=e5(ZD);function UT(e,t,n){return e.filter(s=>Ki(s.version,n)<=0&&(t===null||Ki(s.version,t)>0))}function t5(e,t){return e.filter(n=>Ki(n.version,t)===0)}function n5(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 r5({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&&Xi(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(!Xi(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=Ki(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 s5=new RegExp("^(?:\\p{Extended_Pictographic}|\\p{Emoji_Modifier}|\\p{Regional_Indicator}|[\\u200D\\uFE0F])+(?= \\S)","u");function o5(e){const t=s5.exec(e);return t?{icon:t[0],rest:e.slice(t[0].length)}:{icon:null,rest:e}}function i5(){if(typeof window>"u")return null;try{return window.localStorage}catch{return null}}function a5(e){if(!e)return null;let t=null;try{t=e.getItem(Fw)}catch{return null}return Xi(t)?t:null}function l5(e){if(!e)return!1;try{return e.getItem(Fw),!0}catch{return!1}}function c5(e,t){if(!e)return!1;try{return e.setItem(Fw,t),!0}catch{return!1}}function u5({stored:e,running:t,notes:n,remembers:s=!0}){if(!Xi(t))return{show:[],record:null,reason:"no-version"};if(!Xi(e)){if(!s)return{show:[],record:t,reason:"cannot-remember"};const l=t5(n,t);return l.length?{show:l,record:t,reason:"welcome"}:{show:[],record:t,reason:"first-run"}}const i=Ki(e,t);if(i===0)return{show:[],record:null,reason:"seen"};if(i>0)return{show:[],record:null,reason:"ahead"};const a=UT(n,e,t);return a.length?{show:a,record:t,reason:"new-notes"}:{show:[],record:t,reason:"nothing-new"}}function d5({entries:e,since:t,running:n,firstRun:s,onClose:i}){const a=_n(i),l=n5(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:r5({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}=o5(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 f5(e){return e.slice().sort((t,n)=>t.y-n.y||t.x-n.x)}function h5(e,t,n){var l;if(e.length===0)return null;const s=f5(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 p5=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Escape","Delete","Backspace"]);function m5(e,t){return t==null?{kind:"deck",nodeId:null}:e.key==="Enter"||e.key===" "?{kind:"activate",nodeId:t,additive:e.shiftKey}:p5.has(e.key)?{kind:"node",nodeId:t}:{kind:"deck",nodeId:t}}const g5=new Set(["","BODY","HTML","#DOCUMENT"]);function y5(e){return!e||Iw(e)?!1:!g5.has(String(e.tagName??"").toUpperCase())}function cu(e,t){if(t.size!==0)for(const n of Array.from(e.keys()))t.has(n)||e.delete(n)}function v5(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 w5(e){const t=new Set;for(const n of e)t.add(n.id),t.add(`group:${n.sessionId}`);return t}function x5(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 b5(e,t){const n=new Set;for(const s of t){const i=x5(e,s);if(i)for(const a of i)n.add(a)}return n.size>0?n:null}function WT(e,t,n){return!t.has(e)||n.has(e)}function k5(e,t,n,s){return!t.has(e)&&WT(e,n,s)}function _5(e,t,n){const s={x:0,y:0};return t.set(e,s),n.add(e),s}function S5(e,t,n,s){n.set(e,t),s.delete(e)}const N5=40,E5=120;function C5(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=N5){const p=t.now(),f=Math.max(i+h,p);if(f<=p){l(),a();return}u(f,p,h)},replay(h=E5){l(),s=t.now()+h,n=t.setTimeout(a,h)},flush(){l(),a()},cancel(){l()}}}const j5=1e3;function T5(e={}){const t=Math.max(1,Math.floor(e.limit??j5)),n=e.protect;let s=!1,i=[],a=new Set,l=0,u=0,h=null;return{get paused(){return s},get size(){return i.length},get dropped(){return l},get overflowed(){return l>0},get through(){return u},accept(p){const f=typeof(p==null?void 0:p.seq)=="number"?p.seq:null,g=(p==null?void 0:p.epoch)??null,v=g!==null&&g!==h;v&&(h=g,u=0);const w=f!==null&&!v&&f<=u;if(f!==null&&f>u&&(u=f),!s)return!0;if(w)return!1;if(i.push(p),n!=null&&n(p)&&a.add(p),i.length>t){let E=0;if(a.size<i.length)for(;a.has(i[E]);)E++;const[b]=i.splice(E,1);a.delete(b),l++}return!1},setPaused(p){if(s=p,p)return[];const f=i;return i=[],a=new Set,l=0,f}}}const HT="agent-dag.theme";function R5(e){return e==="light"?"light":"dark"}function A5(){return R5(Vu(HT))}function M5({waiting:e,running:t,connected:n=!0}){return{title:e>0?`(${e}) ${Bt}`:Bt,icon:n?e>0?"waiting":t>0?"running":"idle":"offline"}}const uu={offline:"#e05252",waiting:"#c97d12",running:"#2a90d4",idle:"#7e828c"};function du(e,t){const i=l=>`<circle cx="16" cy="16" r="12" fill="none" stroke="${e}" stroke-width="5"${l}/>`;return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">${t==="waiting"?`<circle cx="16" cy="16" r="14.5" fill="${e}"/>`:t==="offline"?i(` stroke-dasharray="${56.5485.toFixed(2)} ${18.8495.toFixed(2)}" transform="rotate(-58 16 16)"`):i("")+(t==="running"?`<circle cx="16" cy="16" r="5" fill="${e}"/>`:"")}</svg>`}const I5=Object.freeze({offline:`data:image/svg+xml,${encodeURIComponent(du(uu.offline,"offline"))}`,waiting:`data:image/svg+xml,${encodeURIComponent(du(uu.waiting,"waiting"))}`,running:`data:image/svg+xml,${encodeURIComponent(du(uu.running,"running"))}`,idle:`data:image/svg+xml,${encodeURIComponent(du(uu.idle,"idle"))}`}),O5="No sessions are waiting for you.";function P5(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 $5(e,t){return t!==""?t:e===""?"":O5}function L5(){let e=0;return{begin(){const t=++e;return()=>t===e},cancel(){e++}}}function q5(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 D5(e){return e.claude&&e.codex?"Claude Code and Codex":e.claude?"Claude Code":e.codex?"Codex":null}const G1={claude:"Claude Code",codex:"Codex",opencode:"OpenCode",openclaw:"OpenClaw",copilot:"GitHub Copilot",pi:"pi-agent"};function zw(e){const t=e.toLowerCase();return Object.hasOwn(G1,t)?G1[t]:t?t[0].toUpperCase()+t.slice(1):""}function F5(e){return e.length<=1?e[0]??"":`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`}function z5(e,t=[]){const n=t.length?F5(t.map(zw)):D5(e);return n?`via ccusage · local ${n} logs`:"via ccusage · local agent logs"}function B5(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 U5(e,t){const n=t.prefs??sw,s=xl(n.done.level),i=xl(n["needs-input"].level),a=s===i?`${s}%`:`${s}% and ${i}%`,l=t.on?`Sound: on at ${a} — a tone when a turn finishes, another when Claude asks for you (M)`:"Sound: off — press M, or use the switch in here, for a tone when a turn finishes (M)",u=e.codex?`
|
|
207
|
+
|
|
208
|
+
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?`
|
|
209
|
+
|
|
210
|
+
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+`
|
|
211
|
+
|
|
212
|
+
Click to set the volume and the sound of each tone, and to hear either one.`}function GT(e){const t=new Map;for(const n of e)for(const s of n.agents??[]){if(!s||typeof s.agent!="string"||s.agent==="")continue;const i=t.get(s.agent)??{id:s.agent,cost:0,tokens:0};i.cost+=Number.isFinite(s.totalCost)?s.totalCost:0,i.tokens+=Number.isFinite(s.totalTokens)?s.totalTokens:0,t.set(s.agent,i)}return[...t.values()].sort((n,s)=>s.cost-n.cost||n.id.localeCompare(s.id))}function W5(e){const t=GT([{agents:e}]);return t.length<2?null:t.map(n=>`${zw(n.id)} ${rt(n.cost)}`).join(" · ")}function V1(e){switch(e.toLowerCase()){case"claude":return"var(--usage-purple)";case"codex":return"var(--usage-orange)";case"gemini":return"var(--usage-indigo)";case"copilot":return"var(--usage-green)";default:return"var(--usage-zinc)"}}function H5(e,t){if(!(t>0)||!(e>0))return"0%";const n=e/t*100;return n<.1?"<0.1%":`${n.toFixed(1)}%`}function fu(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 G5=[7,14,30,90];function V5(e){const[t,n]=_.useState(null),[s,i]=_.useState(!1),a=_.useState(L5)[0],l=_.useRef(!1),u=(h=!1)=>{if(h&&!lr(l.current))return;const p=a.begin();l.current=h;const f=e;i(!0);const v=`/api/ccusage?since=${Xv(f)}${h?"&refresh=1":""}`;fetch(v).then(w=>w.json()).then(w=>{p()&&n({range:f,resp:w})}).catch(()=>{p()&&n({range:f,resp:{ok:!1,reason:"unreachable"}})}).finally(()=>{p()&&(l.current=!1,i(!1))})};return _.useEffect(()=>(u(!1),()=>a.cancel()),[e]),{landed:t,loading:s,reload:()=>u(!0)}}function Y5({onClose:e,providers:t}){var D;const[n,s]=_.useState(30),[i,a]=_.useState(null),{landed:l,loading:u,reload:h}=V5(n),p=_.useRef(null),f=_n(e,{focusRef:p}),g=q5({loading:u,want:n,answer:l&&{range:l.range,ok:l.resp.ok===!0,days:((D=l.resp.days)==null?void 0:D.length)??0}}),v=g.phase==="chart"?l.resp.days??[]:[],w=_.useMemo(()=>v.reduce((O,A)=>Math.max(O,A.totalCost),0),[v]),E=_.useRef(null);_.useLayoutEffect(()=>{const O=E.current;O&&(O.scrollLeft=O.scrollWidth)},[v]);const{totalCost:b,totalTok:k,inOut:S,cacheRead:N,modelCosts:C}=_.useMemo(()=>{let O=0,A=0,L=0,z=0;const K=new Map;for(const R of v){O+=R.totalCost,A+=R.totalTokens,L+=R.inputTokens+R.outputTokens,z+=R.cacheReadTokens;for(const Q of R.modelBreakdowns)K.set(Q.modelName,(K.get(Q.modelName)??0)+Q.cost)}return{totalCost:O,totalTok:A,inOut:L,cacheRead:z,modelCosts:K}},[v]),j=_.useMemo(()=>Array.from(C.entries()).sort((O,A)=>A[1]-O[1]),[C]),M=_.useMemo(()=>GT(v),[v]),P=M.length>1,I=i?v.find(O=>O.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:O=>O.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:z5(t,M.map(O=>O.id))})]}),d.jsx("div",{className:"uh-range",role:"group","aria-label":"Range",children:G5.map(O=>d.jsxs("button",{type:"button","aria-pressed":n===O,className:"uh-range-btn",onClick:()=>{s(O),a(null)},children:[O,"d"]},O))}),d.jsx("button",{className:"glyph-btn uh-reload",onClick:h,...ar(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:Vi(l.resp)||void 0,children:[B4(l.resp,"ccusage did not report usage"),d.jsx("div",{children:d.jsx("button",{className:"btn uh-retry",onClick:h,...ar(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(hu,{label:"total cost",val:rt(b),accent:!0}),d.jsx(hu,{label:"tokens",val:At(k)}),d.jsx(hu,{label:"input+output",val:At(S)}),d.jsx(hu,{label:"cache reads",val:At(N)})]}),P&&d.jsxs("div",{className:"uh-agents",role:"group","aria-label":"Cost by CLI",children:[d.jsx("div",{className:"uh-agent-bar","aria-hidden":"true",children:M.map(O=>d.jsx("span",{className:"uh-agent-seg",style:{width:`${b>0?O.cost/b*100:0}%`,background:V1(O.id)}},O.id))}),d.jsx("div",{className:"uh-agent-keys",children:M.map(O=>d.jsxs("span",{className:"uh-agent-key",title:`${O.id} · ${At(O.tokens)} tokens`,children:[d.jsx("span",{className:"uh-legend-dot",style:{background:V1(O.id)}}),zw(O.id),d.jsx("span",{className:"uh-agent-cost",children:rt(O.cost)}),d.jsx("span",{className:"uh-agent-share",children:H5(O.cost,b)})]},O.id))})]}),d.jsx("div",{ref:E,className:"uh-chart",role:"group","aria-label":"Daily cost by model",children:v.map(O=>{const A=w>0?O.totalCost/w*100:0,L=O.period===i,z=`${O.period}, ${rt(O.totalCost)}`;return d.jsxs("button",{className:`uh-bar-col${L?" sel":""}`,onClick:()=>a(L?null:O.period),"aria-pressed":L,"aria-label":z,title:`${O.period} · ${rt(O.totalCost)}`,style:{flexBasis:`${100/v.length}%`},children:[d.jsx("div",{className:"uh-bar",style:{height:`${Math.max(A,O.totalCost>0?2:0)}%`},children:O.modelBreakdowns.slice().sort((K,R)=>R.cost-K.cost).map(K=>{const R=O.totalCost>0?K.cost/O.totalCost*100:0;return d.jsx("div",{className:"uh-bar-seg",style:{height:`${R}%`,background:fu(K.modelName)}},K.modelName)})}),d.jsx("span",{className:"uh-bar-label",children:O.period.slice(5)})]},O.period)})}),d.jsx("div",{className:"uh-legend",children:j.map(([O,A])=>d.jsxs("span",{className:"uh-legend-item",title:O,children:[d.jsx("span",{className:"uh-legend-dot",style:{background:fu(O)}}),Ls(O)," ",d.jsx("span",{className:"uh-legend-cost",children:rt(A)})]},O))}),I&&d.jsxs("div",{className:"uh-detail",children:[d.jsxs("div",{className:"uh-detail-head",children:[d.jsx("span",{className:"uh-detail-date",children:I.period}),d.jsx("span",{className:"uh-detail-cost",children:rt(I.totalCost)}),(()=>{var L,z;const A=W5(I.agents)??((z=(L=I.metadata)==null?void 0:L.agents)!=null&&z.length?I.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(pu,{label:"input",val:At(I.inputTokens)}),d.jsx(pu,{label:"output",val:At(I.outputTokens)}),d.jsx(pu,{label:"cache write",val:At(I.cacheCreationTokens)}),d.jsx(pu,{label:"cache read",val:At(I.cacheReadTokens)})]}),d.jsx("div",{className:"uh-detail-models",children:I.modelBreakdowns.slice().sort((O,A)=>A.cost-O.cost).map(O=>{const A=I.totalCost>0?O.cost/I.totalCost*100:0;return d.jsxs("div",{className:"uh-model-row",title:O.modelName,children:[d.jsxs("span",{className:"uh-model-name",children:[d.jsx("span",{className:"uh-legend-dot",style:{background:fu(O.modelName)}}),d.jsx("span",{className:"uh-model-label",children:Ls(O.modelName)})]}),d.jsx("span",{className:"uh-model-bar",children:d.jsx("span",{className:"uh-model-bar-fill",style:{width:`${A}%`,background:fu(O.modelName)}})}),d.jsx("span",{className:"uh-model-cost",children:rt(O.cost)})]},O.modelName)})})]})]})]})})}function hu({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 pu({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 K5(e){const t=/^#?([0-9a-f]{6})$/i.exec((e??"").trim());if(!t)return!1;const n=parseInt(t[1],16),s=[n>>16&255,n>>8&255,n&255].map(i=>{const a=i/255;return a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4)});return .2126*s[0]+.7152*s[1]+.0722*s[2]>.5}const Y1=1e4,X5=12e3;function Q5({browsers:e,findings:t,watching:n,palette:s,now:i=()=>Date.now()}){const a=_.useRef(null),l=_.useRef(null);return l.current={browsers:e,findings:t,watching:n},_.useEffect(()=>{var w;const u=a.current;if(!u)return;const h=u.getContext("2d");if(!h)return;const p=((w=window.matchMedia)==null?void 0:w.call(window,"(prefers-reduced-motion: reduce)").matches)??!1;let f=0,g=!1;const v=()=>{var ne;if(g)return;const E=l.current;if(!E)return;const{browsers:b,findings:k,watching:S}=E,N=s["--accent"]||"#7dd3fc",C=s["--line"]||"#1f2229",j=s["--text-dim"]||"#6e727c",M=K5(s["--bg"]),P=M?42:26,I=M?.85:.65,D=i(),O=Math.min(window.devicePixelRatio||1,2),A=u.clientWidth,L=u.clientHeight;(u.width!==A*O||u.height!==L*O)&&(u.width=A*O,u.height=L*O),h.setTransform(O,0,0,O,0,0),h.clearRect(0,0,A,L);const z=A/2,K=L/2,R=Math.min(A,L)/2-6;h.strokeStyle=C,h.lineWidth=1,h.globalAlpha=M?1:.9;for(const X of[.4,.7,1])h.beginPath(),h.arc(z,K,R*X,0,Math.PI*2),h.stroke();h.beginPath(),h.moveTo(z-R,K),h.lineTo(z+R,K),h.moveTo(z,K-R),h.lineTo(z,K+R),h.stroke(),h.globalAlpha=1;const H=(S&&!p?D%Y1/Y1:0)*Math.PI*2-Math.PI/2;if(S){const X=(ne=h.createConicGradient)==null?void 0:ne.call(h,H-.85,z,K);X&&(X.addColorStop(0,"transparent"),X.addColorStop(.85/(Math.PI*2),`color-mix(in srgb, ${N} ${P}%, transparent)`),X.addColorStop(1,"transparent"),h.fillStyle=X,h.beginPath(),h.moveTo(z,K),h.arc(z,K,R,H-.85,H),h.closePath(),h.fill()),h.strokeStyle=N,h.globalAlpha=I,h.beginPath(),h.moveTo(z,K),h.lineTo(z+Math.cos(H)*R,K+Math.sin(H)*R),h.stroke(),h.globalAlpha=1}b.forEach((X,W)=>{const ee=W/Math.max(b.length,1)*Math.PI*2-Math.PI/2,$=X.lastReadMs===null?1:Math.min(1,(D-X.lastReadMs)/12e4),Y=R*(.42+$*.5),de=z+Math.cos(ee)*Y,G=K+Math.sin(ee)*Y,F=Math.abs((H-ee+Math.PI*3)%(Math.PI*2)-Math.PI),J=S?Math.max(0,1-F/.55):0;h.beginPath(),h.arc(de,G,3+J*1.6,0,Math.PI*2),h.fillStyle=X.running?N:j,h.globalAlpha=X.running?.55+J*.45:.35,h.fill(),h.globalAlpha=1});for(const X of k){const W=(D-X.atMs)/X5;if(W<0||W>1)continue;const $=Math.max(0,b.findIndex(G=>G.key===X.browser))/Math.max(b.length,1)*Math.PI*2-Math.PI/2,Y=z+Math.cos($)*R*.6,de=K+Math.sin($)*R*.6;h.beginPath(),h.arc(Y,de,4+W*22,0,Math.PI*2),h.strokeStyle=N,h.globalAlpha=(1-W)*.8,h.lineWidth=1.5,h.stroke(),h.globalAlpha=1}f=requestAnimationFrame(v)};return v(),()=>{g=!0,cancelAnimationFrame(f)}},[i,s]),d.jsx("canvas",{ref:a,className:"bw-radar",role:"img","aria-label":n?`Watching ${e.length} browser${e.length===1?"":"s"}`:"Not watching"})}const K1="agent-dag.browserWatch.seenMs";function Z5(e,t){return e.filter(n=>n.startMs>t)}function J5(e,t,n){if(e===null)return null;const s=e+t-n;return s>0?s:null}function eF(e){const t=Math.ceil(e/1e3),n=Math.floor(t/60),s=t%60;return n>0?`${n}m ${s}s`:`${s}s`}function VT(e){return(e??[]).filter(t=>t.installed&&t.profiles>0)}function X1(e,t){return t?{kind:"saving",word:"Saving",detail:""}:e.settings.enabled?{kind:"on",word:"Watching",detail:""}:{kind:"off",word:"Paused",detail:"nothing new is recorded"}}function tF(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 nF(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 rF(e){const t=e.profiles.filter(s=>s.degraded);if(t.length>0){const s=t[0],i=t.length-1;return{kind:"unreadable",text:`${s.name}/${s.profile} could not be read — ${s.reason??"no reason given"}`+(i>0?`, and ${i} more`:"")+". The watch continues on the profiles it can read."}}const n=VT(e.browsers);return n.length===0?{kind:"no-profiles",text:"No browser on this machine has a profile to read. Open one of the browsers below once and it will be watched from then on."}:n.some(s=>s.running)?null:{kind:"none-running",text:"No watched browser is running, so nothing can be navigated right now. Their history is still read, and anything found while they were open is still here."}}function sF(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 oF(e){return new Date(e).toLocaleDateString(void 0,{weekday:"short",day:"numeric",month:"short"})}function Q1(e){const t=Math.round((e.endMs-e.startMs)/6e4);return t<1?"":`${t} min`}function iF({onClose:e,onSeen:t,onWatching:n,palette:s}){const i=_n(e),[a,l]=_.useState(null),[u,h]=_.useState(null),[p,f]=_.useState(null),[g,v]=_.useState(!1),w=_.useRef(!1),[E,b]=_.useState(null),[k,S]=_.useState(null),[N,C]=_.useState(!1),j=_.useRef(!1),[M,P]=_.useState(!1),[I,D]=_.useState(!1),[O,A]=_.useState(!1),[L,z]=_.useState(!1),[K,R]=_.useState(!1),[Q,H]=_.useState(()=>Date.now());_.useEffect(()=>{const V=setInterval(()=>H(Date.now()),1e3);return()=>clearInterval(V)},[]);const ne=_.useCallback(async V=>{var ae,pe;if(!(V&&!lr(w.current))){w.current=V,v(!0);try{const me=await fetch(`/api/browser-watch${V?"?refresh=1":""}`);if(!me.ok)throw new Error(`the deck answered ${me.status}`);const ke=await me.json();l(ke),j.current||b(((ae=ke==null?void 0:ke.settings)==null?void 0:ae.quietMinutes)??15),n(((pe=ke==null?void 0:ke.settings)==null?void 0:pe.enabled)===!0),h(null)}catch(me){h(me instanceof Error?me.message:String(me))}finally{w.current=!1,v(!1)}}},[n]);_.useEffect(()=>{ne(!1)},[ne]),_.useEffect(()=>{const V=setInterval(()=>{ne(!1)},1e4);return()=>clearInterval(V)},[ne]);const X=_.useCallback(async V=>{try{await fetch("/api/browser-watch/dismiss",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({host:V.host,startMs:V.startMs})})}finally{await ne(!1)}},[ne]),W=_.useCallback(async V=>{j.current=!0,C(!0);try{const ae=await fetch("/api/browser-watch",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(V)});if(!ae.ok)throw new Error(`the deck answered ${ae.status}`);await ne(!1),f(null)}catch(ae){f(ae instanceof Error?ae.message:String(ae))}finally{j.current=!1,C(!1)}},[ne]),ee=_.useRef(t);ee.current=t,_.useEffect(()=>()=>ee.current(Date.now()),[]);const $=_.useMemo(()=>{const V=[];for(const ae of(a==null?void 0:a.episodes)??[]){const pe=oF(ae.startMs),me=V[V.length-1];me&&me.label===pe?me.episodes.push(ae):V.push({label:pe,episodes:[ae]})}return V},[a]),Y=VT(a==null?void 0:a.browsers),de=((a==null?void 0:a.browsers)??[]).filter(V=>!(V.installed&&V.profiles>0)),G=a?rF(a):null,F=Y.reduce((V,ae)=>V+ae.profiles,0),J=a?J5(a.coverage.lastHumanMs,a.coverage.quietMs,Q):null;return d.jsx("div",{className:"modal-backdrop",onClick:e,role:"presentation",children:d.jsxs("div",{ref:i,className:"modal bw-modal",onClick:V=>V.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?`${F} ${F===1?"profile":"profiles"} · local only`:"local only"})]}),d.jsxs("div",{className:"modal-actions",children:[d.jsx("button",{className:"glyph-btn",onClick:()=>void ne(!0),...ar(g),"aria-label":"Re-read every profile now",title:"Re-read every profile now",children:g?"…":"↻"}),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&&G&&d.jsx("p",{className:`bw-trouble ${G.kind}`,role:"status",children:G.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:()=>A(V=>!V),"aria-expanded":O,"aria-label":"What the sweep and the dots mean",children:"?"})]}),d.jsxs("div",{className:"bw-glance",children:[d.jsx(Q5,{browsers:Y.map(V=>{var ae;return{key:V.key,name:V.name,running:V.running,lastReadMs:((ae=a.profiles.find(pe=>pe.browser===V.key))==null?void 0:ae.lastWrittenMs)??null}}),findings:a.episodes.slice(0,6).map(V=>({browser:V.browser??null,atMs:V.endMs})),watching:a.settings.enabled,palette:s}),d.jsx("ul",{className:"bw-counts",children:tF(Y,a.profiles).map(V=>d.jsxs("li",{children:[d.jsx("span",{className:"bw-count-n",children:V.visits.toLocaleString("en-US")}),d.jsx("span",{className:"bw-count-of",children:V.name})]},V.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 ",nF(a.coverage.checkedMs,Q),a.coverage.checks>0&&d.jsxs(d.Fragment,{children:[" · ",a.coverage.checks.toLocaleString("en-US")," ",a.coverage.checks===1?"check":"checks"]})]}),J!==null&&d.jsxs("p",{className:"bw-gate",children:["You are browsing — a program page would count in ",eF(J)]}),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:()=>z(V=>!V),"aria-expanded":L,"aria-label":"What running, idle and connected to Anthropic mean",children:"?"})]}),L&&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:Y.map(V=>d.jsxs("li",{children:[d.jsx("span",{className:`bw-prof-dot${V.running?" on":""}`,"aria-hidden":!0}),d.jsx("span",{className:"bw-prof-name",children:V.name}),d.jsx("span",{className:"bw-prof-state",children:V.running?"running":"idle"}),V.running&&V.relay.state==="live"&&d.jsx("span",{className:"bw-relay",children:"connected to Anthropic"})]},V.key))}),de.length>0&&d.jsxs(d.Fragment,{children:[d.jsxs("button",{className:"bw-why bw-rest-head",onClick:()=>R(V=>!V),"aria-expanded":K,children:[d.jsx("span",{className:"bw-chev","aria-hidden":!0,children:K?"▾":"▸"})," ",de.length," not watched"]}),K&&d.jsxs("p",{className:"bw-rest",children:[de.map(V=>V.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:$.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."})]}):$.map(V=>d.jsxs("div",{className:"bw-day",children:[d.jsx("h4",{className:"bw-sec-head",children:V.label}),V.episodes.map(ae=>{const pe=`${ae.host}-${ae.startMs}`,me=k===pe;return d.jsxs("div",{className:`bw-ep${me?" open":""}`,children:[d.jsxs("div",{className:"bw-ep-row",children:[d.jsxs("button",{className:"bw-ep-head",onClick:()=>S(me?null:pe),"aria-expanded":me,children:[d.jsx("span",{className:"bw-chev","aria-hidden":!0,children:me?"▾":"▸"}),d.jsx("span",{className:"bw-ep-host",children:ae.host}),d.jsxs("span",{className:"bw-ep-meta",children:[sF(ae),Q1(ae)&&d.jsxs(d.Fragment,{children:[" · ",Q1(ae)]})]}),d.jsxs("span",{className:"bw-ep-count",children:[ae.count," ",ae.count===1?"page":"pages"]})]}),d.jsx("button",{className:"glyph-btn bw-ep-x",onClick:()=>void X(ae),"aria-label":`Dismiss ${ae.host}`,title:"Dismiss — it leaves this list for good, and stays in the log file",children:"×"})]}),me&&d.jsx("ul",{className:"bw-urls",children:ae.urls.map((ke,Ve)=>d.jsxs("li",{children:[d.jsx("span",{className:"bw-url-time",children:new Date(ke.timeMs).toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit",hour12:!1})}),d.jsx("span",{className:"bw-url",children:ke.url})]},`${ke.url}-${ke.timeMs}-${Ve}`))})]},pe)})]},V.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(V=>d.jsxs("div",{className:`bw-log-line ${V.level}${V.parts?"":" sys"}`,children:[d.jsx("span",{className:"bw-log-time",children:new Date(V.atMs).toLocaleTimeString("en-GB",{hour12:!1})}),V.parts?d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"bw-log-browser",children:V.parts.browser}),d.jsx("span",{className:"bw-log-profile",title:V.parts.profile,children:V.parts.profile}),d.jsxs("span",{className:"bw-log-value",children:[V.parts.value,V.parts.flagged>0&&d.jsxs("span",{className:"bw-log-flag",children:[" · ",V.parts.flagged," flagged"]})]})]}):d.jsx("span",{className:"bw-log-sys",children:V.text})]},`${V.atMs}-${V.level}-${V.text}`))})]})]})]}),a&&M&&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:E??a.settings.quietMinutes,onChange:V=>{b(Number(V.target.value)),W({quietMinutes:Number(V.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:V=>void W({reaction:V.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(V=>d.jsx("option",{value:V,children:V==="notify"?"notify me":V==="close-tab"?"close the tab":"quit the browser"},V))})]}),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:()=>D(V=>!V),"aria-expanded":I,children:[d.jsx("span",{className:"bw-chev","aria-hidden":!0,children:I?"▾":"▸"})," What Browser Watch can access"]}),I&&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."})]})]})]}),p&&d.jsx("div",{className:"bw-state bw-write-err",role:"alert",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 save that setting"}),d.jsxs("span",{className:"bw-row-detail",children:[p," — the switches below show what is stored, not what you pressed."]}),d.jsx("button",{className:"glyph-btn bw-write-err-x",onClick:()=>f(null),"aria-label":"Dismiss",title:"Dismiss",children:"×"})]})}),a&&d.jsxs("footer",{className:"bw-status",children:[d.jsx("span",{className:`bw-mode-dot${a.settings.enabled?" on":""}`,"aria-hidden":!0}),d.jsx("span",{className:"bw-mode-word",children:X1(a,N).word},X1(a,N).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${M?" on":""}`,onClick:()=>P(V=>!V),"aria-expanded":M,"aria-label":"Settings",title:"Settings",children:d.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3","aria-hidden":!0,children:[d.jsx("circle",{cx:"7",cy:"7",r:"2.1"}),d.jsx("path",{d:"M7 1.2v1.6M7 11.2v1.6M1.2 7h1.6M11.2 7h1.6M2.9 2.9l1.1 1.1M10 10l1.1 1.1M11.1 2.9L10 4M4 10l-1.1 1.1"})]})}),d.jsxs("label",{className:"bw-switch",htmlFor:"bw-enabled",children:[d.jsx("span",{className:"bw-switch-label",id:"bw-enabled-label",children:"Watch browser activity"}),d.jsx("button",{id:"bw-enabled",type:"button",role:"switch","aria-checked":a.settings.enabled,"aria-labelledby":"bw-enabled-label",className:"bw-toggle",onClick:()=>void W({enabled:!a.settings.enabled}),title:a.settings.enabled?"On — every episode it finds is written down, so the list outlives the browsing history being cleared":"Off — showing only what this deck has seen since it started. Anything an earlier run archived is hidden until you switch back on, and nothing new is kept",children:d.jsx("span",{className:"bw-toggle-knob"})})]})]})]})]})})}function Bw(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 ah,Z1;function aF(){if(Z1)return ah;Z1=1;function e(){this.__data__=[],this.size=0}return ah=e,ah}var lh,J1;function Ji(){if(J1)return lh;J1=1;function e(t,n){return t===n||t!==t&&n!==n}return lh=e,lh}var ch,ek;function Ku(){if(ek)return ch;ek=1;var e=Ji();function t(n,s){for(var i=n.length;i--;)if(e(n[i][0],s))return i;return-1}return ch=t,ch}var uh,tk;function lF(){if(tk)return uh;tk=1;var e=Ku(),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 uh=s,uh}var dh,nk;function cF(){if(nk)return dh;nk=1;var e=Ku();function t(n){var s=this.__data__,i=e(s,n);return i<0?void 0:s[i][1]}return dh=t,dh}var fh,rk;function uF(){if(rk)return fh;rk=1;var e=Ku();function t(n){return e(this.__data__,n)>-1}return fh=t,fh}var hh,sk;function dF(){if(sk)return hh;sk=1;var e=Ku();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 hh=t,hh}var ph,ok;function Xu(){if(ok)return ph;ok=1;var e=aF(),t=lF(),n=cF(),s=uF(),i=dF();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,ph=a,ph}var mh,ik;function fF(){if(ik)return mh;ik=1;var e=Xu();function t(){this.__data__=new e,this.size=0}return mh=t,mh}var gh,ak;function hF(){if(ak)return gh;ak=1;function e(t){var n=this.__data__,s=n.delete(t);return this.size=n.size,s}return gh=e,gh}var yh,lk;function pF(){if(lk)return yh;lk=1;function e(t){return this.__data__.get(t)}return yh=e,yh}var vh,ck;function mF(){if(ck)return vh;ck=1;function e(t){return this.__data__.has(t)}return vh=e,vh}var wh,uk;function YT(){if(uk)return wh;uk=1;var e=typeof Kc=="object"&&Kc&&Kc.Object===Object&&Kc;return wh=e,wh}var xh,dk;function fr(){if(dk)return xh;dk=1;var e=YT(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return xh=n,xh}var bh,fk;function ea(){if(fk)return bh;fk=1;var e=fr(),t=e.Symbol;return bh=t,bh}var kh,hk;function gF(){if(hk)return kh;hk=1;var e=ea(),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 kh=a,kh}var _h,pk;function yF(){if(pk)return _h;pk=1;var e=Object.prototype,t=e.toString;function n(s){return t.call(s)}return _h=n,_h}var Sh,mk;function No(){if(mk)return Sh;mk=1;var e=ea(),t=gF(),n=yF(),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 Sh=l,Sh}var Nh,gk;function Dn(){if(gk)return Nh;gk=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return Nh=e,Nh}var Eh,yk;function Ol(){if(yk)return Eh;yk=1;var e=No(),t=Dn(),n="[object AsyncFunction]",s="[object Function]",i="[object GeneratorFunction]",a="[object Proxy]";function l(u){if(!t(u))return!1;var h=e(u);return h==s||h==i||h==n||h==a}return Eh=l,Eh}var Ch,vk;function vF(){if(vk)return Ch;vk=1;var e=fr(),t=e["__core-js_shared__"];return Ch=t,Ch}var jh,wk;function wF(){if(wk)return jh;wk=1;var e=vF(),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 jh=n,jh}var Th,xk;function KT(){if(xk)return Th;xk=1;var e=Function.prototype,t=e.toString;function n(s){if(s!=null){try{return t.call(s)}catch{}try{return s+""}catch{}}return""}return Th=n,Th}var Rh,bk;function xF(){if(bk)return Rh;bk=1;var e=Ol(),t=wF(),n=Dn(),s=KT(),i=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,l=Function.prototype,u=Object.prototype,h=l.toString,p=u.hasOwnProperty,f=RegExp("^"+h.call(p).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function g(v){if(!n(v)||t(v))return!1;var w=e(v)?f:a;return w.test(s(v))}return Rh=g,Rh}var Ah,kk;function bF(){if(kk)return Ah;kk=1;function e(t,n){return t==null?void 0:t[n]}return Ah=e,Ah}var Mh,_k;function Eo(){if(_k)return Mh;_k=1;var e=xF(),t=bF();function n(s,i){var a=t(s,i);return e(a)?a:void 0}return Mh=n,Mh}var Ih,Sk;function Uw(){if(Sk)return Ih;Sk=1;var e=Eo(),t=fr(),n=e(t,"Map");return Ih=n,Ih}var Oh,Nk;function Qu(){if(Nk)return Oh;Nk=1;var e=Eo(),t=e(Object,"create");return Oh=t,Oh}var Ph,Ek;function kF(){if(Ek)return Ph;Ek=1;var e=Qu();function t(){this.__data__=e?e(null):{},this.size=0}return Ph=t,Ph}var $h,Ck;function _F(){if(Ck)return $h;Ck=1;function e(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}return $h=e,$h}var Lh,jk;function SF(){if(jk)return Lh;jk=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 Lh=i,Lh}var qh,Tk;function NF(){if(Tk)return qh;Tk=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 qh=s,qh}var Dh,Rk;function EF(){if(Rk)return Dh;Rk=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 Dh=n,Dh}var Fh,Ak;function CF(){if(Ak)return Fh;Ak=1;var e=kF(),t=_F(),n=SF(),s=NF(),i=EF();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,Fh=a,Fh}var zh,Mk;function jF(){if(Mk)return zh;Mk=1;var e=CF(),t=Xu(),n=Uw();function s(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return zh=s,zh}var Bh,Ik;function TF(){if(Ik)return Bh;Ik=1;function e(t){var n=typeof t;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?t!=="__proto__":t===null}return Bh=e,Bh}var Uh,Ok;function Zu(){if(Ok)return Uh;Ok=1;var e=TF();function t(n,s){var i=n.__data__;return e(s)?i[typeof s=="string"?"string":"hash"]:i.map}return Uh=t,Uh}var Wh,Pk;function RF(){if(Pk)return Wh;Pk=1;var e=Zu();function t(n){var s=e(this,n).delete(n);return this.size-=s?1:0,s}return Wh=t,Wh}var Hh,$k;function AF(){if($k)return Hh;$k=1;var e=Zu();function t(n){return e(this,n).get(n)}return Hh=t,Hh}var Gh,Lk;function MF(){if(Lk)return Gh;Lk=1;var e=Zu();function t(n){return e(this,n).has(n)}return Gh=t,Gh}var Vh,qk;function IF(){if(qk)return Vh;qk=1;var e=Zu();function t(n,s){var i=e(this,n),a=i.size;return i.set(n,s),this.size+=i.size==a?0:1,this}return Vh=t,Vh}var Yh,Dk;function Ww(){if(Dk)return Yh;Dk=1;var e=jF(),t=RF(),n=AF(),s=MF(),i=IF();function a(l){var u=-1,h=l==null?0:l.length;for(this.clear();++u<h;){var p=l[u];this.set(p[0],p[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=s,a.prototype.set=i,Yh=a,Yh}var Kh,Fk;function OF(){if(Fk)return Kh;Fk=1;var e=Xu(),t=Uw(),n=Ww(),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 Kh=i,Kh}var Xh,zk;function Ju(){if(zk)return Xh;zk=1;var e=Xu(),t=fF(),n=hF(),s=pF(),i=mF(),a=OF();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,Xh=l,Xh}var Qh,Bk;function Hw(){if(Bk)return Qh;Bk=1;function e(t,n){for(var s=-1,i=t==null?0:t.length;++s<i&&n(t[s],s,t)!==!1;);return t}return Qh=e,Qh}var Zh,Uk;function XT(){if(Uk)return Zh;Uk=1;var e=Eo(),t=(function(){try{var n=e(Object,"defineProperty");return n({},"",{}),n}catch{}})();return Zh=t,Zh}var Jh,Wk;function ed(){if(Wk)return Jh;Wk=1;var e=XT();function t(n,s,i){s=="__proto__"&&e?e(n,s,{configurable:!0,enumerable:!0,value:i,writable:!0}):n[s]=i}return Jh=t,Jh}var ep,Hk;function td(){if(Hk)return ep;Hk=1;var e=ed(),t=Ji(),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 ep=i,ep}var tp,Gk;function Pl(){if(Gk)return tp;Gk=1;var e=td(),t=ed();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 tp=n,tp}var np,Vk;function PF(){if(Vk)return np;Vk=1;function e(t,n){for(var s=-1,i=Array(t);++s<t;)i[s]=n(s);return i}return np=e,np}var rp,Yk;function jr(){if(Yk)return rp;Yk=1;function e(t){return t!=null&&typeof t=="object"}return rp=e,rp}var sp,Kk;function $F(){if(Kk)return sp;Kk=1;var e=No(),t=jr(),n="[object Arguments]";function s(i){return t(i)&&e(i)==n}return sp=s,sp}var op,Xk;function $l(){if(Xk)return op;Xk=1;var e=$F(),t=jr(),n=Object.prototype,s=n.hasOwnProperty,i=n.propertyIsEnumerable,a=e((function(){return arguments})())?e:function(l){return t(l)&&s.call(l,"callee")&&!i.call(l,"callee")};return op=a,op}var ip,Qk;function It(){if(Qk)return ip;Qk=1;var e=Array.isArray;return ip=e,ip}var ol={exports:{}},ap,Zk;function LF(){if(Zk)return ap;Zk=1;function e(){return!1}return ap=e,ap}ol.exports;var Jk;function ta(){return Jk||(Jk=1,(function(e,t){var n=fr(),s=LF(),i=t&&!t.nodeType&&t,a=i&&!0&&e&&!e.nodeType&&e,l=a&&a.exports===i,u=l?n.Buffer:void 0,h=u?u.isBuffer:void 0,p=h||s;e.exports=p})(ol,ol.exports)),ol.exports}var lp,e_;function nd(){if(e_)return lp;e_=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function n(s,i){var a=typeof s;return i=i??e,!!i&&(a=="number"||a!="symbol"&&t.test(s))&&s>-1&&s%1==0&&s<i}return lp=n,lp}var cp,t_;function Gw(){if(t_)return cp;t_=1;var e=9007199254740991;function t(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=e}return cp=t,cp}var up,n_;function qF(){if(n_)return up;n_=1;var e=No(),t=Gw(),n=jr(),s="[object Arguments]",i="[object Array]",a="[object Boolean]",l="[object Date]",u="[object Error]",h="[object Function]",p="[object Map]",f="[object Number]",g="[object Object]",v="[object RegExp]",w="[object Set]",E="[object String]",b="[object WeakMap]",k="[object ArrayBuffer]",S="[object DataView]",N="[object Float32Array]",C="[object Float64Array]",j="[object Int8Array]",M="[object Int16Array]",P="[object Int32Array]",I="[object Uint8Array]",D="[object Uint8ClampedArray]",O="[object Uint16Array]",A="[object Uint32Array]",L={};L[N]=L[C]=L[j]=L[M]=L[P]=L[I]=L[D]=L[O]=L[A]=!0,L[s]=L[i]=L[k]=L[a]=L[S]=L[l]=L[u]=L[h]=L[p]=L[f]=L[g]=L[v]=L[w]=L[E]=L[b]=!1;function z(K){return n(K)&&t(K.length)&&!!L[e(K)]}return up=z,up}var dp,r_;function rd(){if(r_)return dp;r_=1;function e(t){return function(n){return t(n)}}return dp=e,dp}var il={exports:{}};il.exports;var s_;function Vw(){return s_||(s_=1,(function(e,t){var n=YT(),s=t&&!t.nodeType&&t,i=s&&!0&&e&&!e.nodeType&&e,a=i&&i.exports===s,l=a&&n.process,u=(function(){try{var h=i&&i.require&&i.require("util").types;return h||l&&l.binding&&l.binding("util")}catch{}})();e.exports=u})(il,il.exports)),il.exports}var fp,o_;function Ll(){if(o_)return fp;o_=1;var e=qF(),t=rd(),n=Vw(),s=n&&n.isTypedArray,i=s?t(s):e;return fp=i,fp}var hp,i_;function QT(){if(i_)return hp;i_=1;var e=PF(),t=$l(),n=It(),s=ta(),i=nd(),a=Ll(),l=Object.prototype,u=l.hasOwnProperty;function h(p,f){var g=n(p),v=!g&&t(p),w=!g&&!v&&s(p),E=!g&&!v&&!w&&a(p),b=g||v||w||E,k=b?e(p.length,String):[],S=k.length;for(var N in p)(f||u.call(p,N))&&!(b&&(N=="length"||w&&(N=="offset"||N=="parent")||E&&(N=="buffer"||N=="byteLength"||N=="byteOffset")||i(N,S)))&&k.push(N);return k}return hp=h,hp}var pp,a_;function sd(){if(a_)return pp;a_=1;var e=Object.prototype;function t(n){var s=n&&n.constructor,i=typeof s=="function"&&s.prototype||e;return n===i}return pp=t,pp}var mp,l_;function ZT(){if(l_)return mp;l_=1;function e(t,n){return function(s){return t(n(s))}}return mp=e,mp}var gp,c_;function DF(){if(c_)return gp;c_=1;var e=ZT(),t=e(Object.keys,Object);return gp=t,gp}var yp,u_;function Yw(){if(u_)return yp;u_=1;var e=sd(),t=DF(),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 yp=i,yp}var vp,d_;function es(){if(d_)return vp;d_=1;var e=Ol(),t=Gw();function n(s){return s!=null&&t(s.length)&&!e(s)}return vp=n,vp}var wp,f_;function qs(){if(f_)return wp;f_=1;var e=QT(),t=Yw(),n=es();function s(i){return n(i)?e(i):t(i)}return wp=s,wp}var xp,h_;function FF(){if(h_)return xp;h_=1;var e=Pl(),t=qs();function n(s,i){return s&&e(i,t(i),s)}return xp=n,xp}var bp,p_;function zF(){if(p_)return bp;p_=1;function e(t){var n=[];if(t!=null)for(var s in Object(t))n.push(s);return n}return bp=e,bp}var kp,m_;function BF(){if(m_)return kp;m_=1;var e=Dn(),t=sd(),n=zF(),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 kp=a,kp}var _p,g_;function Co(){if(g_)return _p;g_=1;var e=QT(),t=BF(),n=es();function s(i){return n(i)?e(i,!0):t(i)}return _p=s,_p}var Sp,y_;function UF(){if(y_)return Sp;y_=1;var e=Pl(),t=Co();function n(s,i){return s&&e(i,t(i),s)}return Sp=n,Sp}var al={exports:{}};al.exports;var v_;function JT(){return v_||(v_=1,(function(e,t){var n=fr(),s=t&&!t.nodeType&&t,i=s&&!0&&e&&!e.nodeType&&e,a=i&&i.exports===s,l=a?n.Buffer:void 0,u=l?l.allocUnsafe:void 0;function h(p,f){if(f)return p.slice();var g=p.length,v=u?u(g):new p.constructor(g);return p.copy(v),v}e.exports=h})(al,al.exports)),al.exports}var Np,w_;function eR(){if(w_)return Np;w_=1;function e(t,n){var s=-1,i=t.length;for(n||(n=Array(i));++s<i;)n[s]=t[s];return n}return Np=e,Np}var Ep,x_;function tR(){if(x_)return Ep;x_=1;function e(t,n){for(var s=-1,i=t==null?0:t.length,a=0,l=[];++s<i;){var u=t[s];n(u,s,t)&&(l[a++]=u)}return l}return Ep=e,Ep}var Cp,b_;function nR(){if(b_)return Cp;b_=1;function e(){return[]}return Cp=e,Cp}var jp,k_;function Kw(){if(k_)return jp;k_=1;var e=tR(),t=nR(),n=Object.prototype,s=n.propertyIsEnumerable,i=Object.getOwnPropertySymbols,a=i?function(l){return l==null?[]:(l=Object(l),e(i(l),function(u){return s.call(l,u)}))}:t;return jp=a,jp}var Tp,__;function WF(){if(__)return Tp;__=1;var e=Pl(),t=Kw();function n(s,i){return e(s,t(s),i)}return Tp=n,Tp}var Rp,S_;function Xw(){if(S_)return Rp;S_=1;function e(t,n){for(var s=-1,i=n.length,a=t.length;++s<i;)t[a+s]=n[s];return t}return Rp=e,Rp}var Ap,N_;function od(){if(N_)return Ap;N_=1;var e=ZT(),t=e(Object.getPrototypeOf,Object);return Ap=t,Ap}var Mp,E_;function rR(){if(E_)return Mp;E_=1;var e=Xw(),t=od(),n=Kw(),s=nR(),i=Object.getOwnPropertySymbols,a=i?function(l){for(var u=[];l;)e(u,n(l)),l=t(l);return u}:s;return Mp=a,Mp}var Ip,C_;function HF(){if(C_)return Ip;C_=1;var e=Pl(),t=rR();function n(s,i){return e(s,t(s),i)}return Ip=n,Ip}var Op,j_;function sR(){if(j_)return Op;j_=1;var e=Xw(),t=It();function n(s,i,a){var l=i(s);return t(s)?l:e(l,a(s))}return Op=n,Op}var Pp,T_;function oR(){if(T_)return Pp;T_=1;var e=sR(),t=Kw(),n=qs();function s(i){return e(i,n,t)}return Pp=s,Pp}var $p,R_;function GF(){if(R_)return $p;R_=1;var e=sR(),t=rR(),n=Co();function s(i){return e(i,n,t)}return $p=s,$p}var Lp,A_;function VF(){if(A_)return Lp;A_=1;var e=Eo(),t=fr(),n=e(t,"DataView");return Lp=n,Lp}var qp,M_;function YF(){if(M_)return qp;M_=1;var e=Eo(),t=fr(),n=e(t,"Promise");return qp=n,qp}var Dp,I_;function iR(){if(I_)return Dp;I_=1;var e=Eo(),t=fr(),n=e(t,"Set");return Dp=n,Dp}var Fp,O_;function KF(){if(O_)return Fp;O_=1;var e=Eo(),t=fr(),n=e(t,"WeakMap");return Fp=n,Fp}var zp,P_;function na(){if(P_)return zp;P_=1;var e=VF(),t=Uw(),n=YF(),s=iR(),i=KF(),a=No(),l=KT(),u="[object Map]",h="[object Object]",p="[object Promise]",f="[object Set]",g="[object WeakMap]",v="[object DataView]",w=l(e),E=l(t),b=l(n),k=l(s),S=l(i),N=a;return(e&&N(new e(new ArrayBuffer(1)))!=v||t&&N(new t)!=u||n&&N(n.resolve())!=p||s&&N(new s)!=f||i&&N(new i)!=g)&&(N=function(C){var j=a(C),M=j==h?C.constructor:void 0,P=M?l(M):"";if(P)switch(P){case w:return v;case E:return u;case b:return p;case k:return f;case S:return g}return j}),zp=N,zp}var Bp,$_;function XF(){if($_)return Bp;$_=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 Bp=n,Bp}var Up,L_;function aR(){if(L_)return Up;L_=1;var e=fr(),t=e.Uint8Array;return Up=t,Up}var Wp,q_;function Qw(){if(q_)return Wp;q_=1;var e=aR();function t(n){var s=new n.constructor(n.byteLength);return new e(s).set(new e(n)),s}return Wp=t,Wp}var Hp,D_;function QF(){if(D_)return Hp;D_=1;var e=Qw();function t(n,s){var i=s?e(n.buffer):n.buffer;return new n.constructor(i,n.byteOffset,n.byteLength)}return Hp=t,Hp}var Gp,F_;function ZF(){if(F_)return Gp;F_=1;var e=/\w*$/;function t(n){var s=new n.constructor(n.source,e.exec(n));return s.lastIndex=n.lastIndex,s}return Gp=t,Gp}var Vp,z_;function JF(){if(z_)return Vp;z_=1;var e=ea(),t=e?e.prototype:void 0,n=t?t.valueOf:void 0;function s(i){return n?Object(n.call(i)):{}}return Vp=s,Vp}var Yp,B_;function lR(){if(B_)return Yp;B_=1;var e=Qw();function t(n,s){var i=s?e(n.buffer):n.buffer;return new n.constructor(i,n.byteOffset,n.length)}return Yp=t,Yp}var Kp,U_;function e6(){if(U_)return Kp;U_=1;var e=Qw(),t=QF(),n=ZF(),s=JF(),i=lR(),a="[object Boolean]",l="[object Date]",u="[object Map]",h="[object Number]",p="[object RegExp]",f="[object Set]",g="[object String]",v="[object Symbol]",w="[object ArrayBuffer]",E="[object DataView]",b="[object Float32Array]",k="[object Float64Array]",S="[object Int8Array]",N="[object Int16Array]",C="[object Int32Array]",j="[object Uint8Array]",M="[object Uint8ClampedArray]",P="[object Uint16Array]",I="[object Uint32Array]";function D(O,A,L){var z=O.constructor;switch(A){case w:return e(O);case a:case l:return new z(+O);case E:return t(O,L);case b:case k:case S:case N:case C:case j:case M:case P:case I:return i(O,L);case u:return new z;case h:case g:return new z(O);case p:return n(O);case f:return new z;case v:return s(O)}}return Kp=D,Kp}var Xp,W_;function cR(){if(W_)return Xp;W_=1;var e=Dn(),t=Object.create,n=(function(){function s(){}return function(i){if(!e(i))return{};if(t)return t(i);s.prototype=i;var a=new s;return s.prototype=void 0,a}})();return Xp=n,Xp}var Qp,H_;function uR(){if(H_)return Qp;H_=1;var e=cR(),t=od(),n=sd();function s(i){return typeof i.constructor=="function"&&!n(i)?e(t(i)):{}}return Qp=s,Qp}var Zp,G_;function t6(){if(G_)return Zp;G_=1;var e=na(),t=jr(),n="[object Map]";function s(i){return t(i)&&e(i)==n}return Zp=s,Zp}var Jp,V_;function n6(){if(V_)return Jp;V_=1;var e=t6(),t=rd(),n=Vw(),s=n&&n.isMap,i=s?t(s):e;return Jp=i,Jp}var em,Y_;function r6(){if(Y_)return em;Y_=1;var e=na(),t=jr(),n="[object Set]";function s(i){return t(i)&&e(i)==n}return em=s,em}var tm,K_;function s6(){if(K_)return tm;K_=1;var e=r6(),t=rd(),n=Vw(),s=n&&n.isSet,i=s?t(s):e;return tm=i,tm}var nm,X_;function dR(){if(X_)return nm;X_=1;var e=Ju(),t=Hw(),n=td(),s=FF(),i=UF(),a=JT(),l=eR(),u=WF(),h=HF(),p=oR(),f=GF(),g=na(),v=XF(),w=e6(),E=uR(),b=It(),k=ta(),S=n6(),N=Dn(),C=s6(),j=qs(),M=Co(),P=1,I=2,D=4,O="[object Arguments]",A="[object Array]",L="[object Boolean]",z="[object Date]",K="[object Error]",R="[object Function]",Q="[object GeneratorFunction]",H="[object Map]",ne="[object Number]",X="[object Object]",W="[object RegExp]",ee="[object Set]",$="[object String]",Y="[object Symbol]",de="[object WeakMap]",G="[object ArrayBuffer]",F="[object DataView]",J="[object Float32Array]",V="[object Float64Array]",ae="[object Int8Array]",pe="[object Int16Array]",me="[object Int32Array]",ke="[object Uint8Array]",Ve="[object Uint8ClampedArray]",ze="[object Uint16Array]",Oe="[object Uint32Array]",Ne={};Ne[O]=Ne[A]=Ne[G]=Ne[F]=Ne[L]=Ne[z]=Ne[J]=Ne[V]=Ne[ae]=Ne[pe]=Ne[me]=Ne[H]=Ne[ne]=Ne[X]=Ne[W]=Ne[ee]=Ne[$]=Ne[Y]=Ne[ke]=Ne[Ve]=Ne[ze]=Ne[Oe]=!0,Ne[K]=Ne[R]=Ne[de]=!1;function ce(be,xe,he,Pe,Be,Ze){var Ge,Je=xe&P,qe=xe&I,Ye=xe&D;if(he&&(Ge=Be?he(be,Pe,Be,Ze):he(be)),Ge!==void 0)return Ge;if(!N(be))return be;var Te=b(be);if(Te){if(Ge=v(be),!Je)return l(be,Ge)}else{var et=g(be),it=et==R||et==Q;if(k(be))return a(be,Je);if(et==X||et==O||it&&!Be){if(Ge=qe||it?{}:E(be),!Je)return qe?h(be,i(Ge,be)):u(be,s(Ge,be))}else{if(!Ne[et])return Be?be:{};Ge=w(be,et,Je)}}Ze||(Ze=new e);var oe=Ze.get(be);if(oe)return oe;Ze.set(be,Ge),C(be)?be.forEach(function(Ce){Ge.add(ce(Ce,xe,he,Ce,be,Ze))}):S(be)&&be.forEach(function(Ce,Ke){Ge.set(Ke,ce(Ce,xe,he,Ke,be,Ze))});var Le=Ye?qe?f:p:qe?M:j,Ue=Te?void 0:Le(be);return t(Ue||be,function(Ce,Ke){Ue&&(Ke=Ce,Ce=be[Ke]),n(Ge,Ke,ce(Ce,xe,he,Ke,be,Ze))}),Ge}return nm=ce,nm}var rm,Q_;function o6(){if(Q_)return rm;Q_=1;var e=dR(),t=4;function n(s){return e(s,t)}return rm=n,rm}var sm,Z_;function Zw(){if(Z_)return sm;Z_=1;function e(t){return function(){return t}}return sm=e,sm}var om,J_;function i6(){if(J_)return om;J_=1;function e(t){return function(n,s,i){for(var a=-1,l=Object(n),u=i(n),h=u.length;h--;){var p=u[t?h:++a];if(s(l[p],p,l)===!1)break}return n}}return om=e,om}var im,eS;function Jw(){if(eS)return im;eS=1;var e=i6(),t=e();return im=t,im}var am,tS;function e0(){if(tS)return am;tS=1;var e=Jw(),t=qs();function n(s,i){return s&&e(s,i,t)}return am=n,am}var lm,nS;function a6(){if(nS)return lm;nS=1;var e=es();function t(n,s){return function(i,a){if(i==null)return i;if(!e(i))return n(i,a);for(var l=i.length,u=s?l:-1,h=Object(i);(s?u--:++u<l)&&a(h[u],u,h)!==!1;);return i}}return lm=t,lm}var cm,rS;function id(){if(rS)return cm;rS=1;var e=e0(),t=a6(),n=t(e);return cm=n,cm}var um,sS;function jo(){if(sS)return um;sS=1;function e(t){return t}return um=e,um}var dm,oS;function fR(){if(oS)return dm;oS=1;var e=jo();function t(n){return typeof n=="function"?n:e}return dm=t,dm}var fm,iS;function hR(){if(iS)return fm;iS=1;var e=Hw(),t=id(),n=fR(),s=It();function i(a,l){var u=s(a)?e:t;return u(a,n(l))}return fm=i,fm}var hm,aS;function pR(){return aS||(aS=1,hm=hR()),hm}var pm,lS;function l6(){if(lS)return pm;lS=1;var e=id();function t(n,s){var i=[];return e(n,function(a,l,u){s(a,l,u)&&i.push(a)}),i}return pm=t,pm}var mm,cS;function c6(){if(cS)return mm;cS=1;var e="__lodash_hash_undefined__";function t(n){return this.__data__.set(n,e),this}return mm=t,mm}var gm,uS;function u6(){if(uS)return gm;uS=1;function e(t){return this.__data__.has(t)}return gm=e,gm}var ym,dS;function mR(){if(dS)return ym;dS=1;var e=Ww(),t=c6(),n=u6();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,ym=s,ym}var vm,fS;function d6(){if(fS)return vm;fS=1;function e(t,n){for(var s=-1,i=t==null?0:t.length;++s<i;)if(n(t[s],s,t))return!0;return!1}return vm=e,vm}var wm,hS;function gR(){if(hS)return wm;hS=1;function e(t,n){return t.has(n)}return wm=e,wm}var xm,pS;function yR(){if(pS)return xm;pS=1;var e=mR(),t=d6(),n=gR(),s=1,i=2;function a(l,u,h,p,f,g){var v=h&s,w=l.length,E=u.length;if(w!=E&&!(v&&E>w))return!1;var b=g.get(l),k=g.get(u);if(b&&k)return b==u&&k==l;var S=-1,N=!0,C=h&i?new e:void 0;for(g.set(l,u),g.set(u,l);++S<w;){var j=l[S],M=u[S];if(p)var P=v?p(M,j,S,u,l,g):p(j,M,S,l,u,g);if(P!==void 0){if(P)continue;N=!1;break}if(C){if(!t(u,function(I,D){if(!n(C,D)&&(j===I||f(j,I,h,p,g)))return C.push(D)})){N=!1;break}}else if(!(j===M||f(j,M,h,p,g))){N=!1;break}}return g.delete(l),g.delete(u),N}return xm=a,xm}var bm,mS;function f6(){if(mS)return bm;mS=1;function e(t){var n=-1,s=Array(t.size);return t.forEach(function(i,a){s[++n]=[a,i]}),s}return bm=e,bm}var km,gS;function t0(){if(gS)return km;gS=1;function e(t){var n=-1,s=Array(t.size);return t.forEach(function(i){s[++n]=i}),s}return km=e,km}var _m,yS;function h6(){if(yS)return _m;yS=1;var e=ea(),t=aR(),n=Ji(),s=yR(),i=f6(),a=t0(),l=1,u=2,h="[object Boolean]",p="[object Date]",f="[object Error]",g="[object Map]",v="[object Number]",w="[object RegExp]",E="[object Set]",b="[object String]",k="[object Symbol]",S="[object ArrayBuffer]",N="[object DataView]",C=e?e.prototype:void 0,j=C?C.valueOf:void 0;function M(P,I,D,O,A,L,z){switch(D){case N:if(P.byteLength!=I.byteLength||P.byteOffset!=I.byteOffset)return!1;P=P.buffer,I=I.buffer;case S:return!(P.byteLength!=I.byteLength||!L(new t(P),new t(I)));case h:case p:case v:return n(+P,+I);case f:return P.name==I.name&&P.message==I.message;case w:case b:return P==I+"";case g:var K=i;case E:var R=O&l;if(K||(K=a),P.size!=I.size&&!R)return!1;var Q=z.get(P);if(Q)return Q==I;O|=u,z.set(P,I);var H=s(K(P),K(I),O,A,L,z);return z.delete(P),H;case k:if(j)return j.call(P)==j.call(I)}return!1}return _m=M,_m}var Sm,vS;function p6(){if(vS)return Sm;vS=1;var e=oR(),t=1,n=Object.prototype,s=n.hasOwnProperty;function i(a,l,u,h,p,f){var g=u&t,v=e(a),w=v.length,E=e(l),b=E.length;if(w!=b&&!g)return!1;for(var k=w;k--;){var S=v[k];if(!(g?S in l:s.call(l,S)))return!1}var N=f.get(a),C=f.get(l);if(N&&C)return N==l&&C==a;var j=!0;f.set(a,l),f.set(l,a);for(var M=g;++k<w;){S=v[k];var P=a[S],I=l[S];if(h)var D=g?h(I,P,S,l,a,f):h(P,I,S,a,l,f);if(!(D===void 0?P===I||p(P,I,u,h,f):D)){j=!1;break}M||(M=S=="constructor")}if(j&&!M){var O=a.constructor,A=l.constructor;O!=A&&"constructor"in a&&"constructor"in l&&!(typeof O=="function"&&O instanceof O&&typeof A=="function"&&A instanceof A)&&(j=!1)}return f.delete(a),f.delete(l),j}return Sm=i,Sm}var Nm,wS;function m6(){if(wS)return Nm;wS=1;var e=Ju(),t=yR(),n=h6(),s=p6(),i=na(),a=It(),l=ta(),u=Ll(),h=1,p="[object Arguments]",f="[object Array]",g="[object Object]",v=Object.prototype,w=v.hasOwnProperty;function E(b,k,S,N,C,j){var M=a(b),P=a(k),I=M?f:i(b),D=P?f:i(k);I=I==p?g:I,D=D==p?g:D;var O=I==g,A=D==g,L=I==D;if(L&&l(b)){if(!l(k))return!1;M=!0,O=!1}if(L&&!O)return j||(j=new e),M||u(b)?t(b,k,S,N,C,j):n(b,k,I,S,N,C,j);if(!(S&h)){var z=O&&w.call(b,"__wrapped__"),K=A&&w.call(k,"__wrapped__");if(z||K){var R=z?b.value():b,Q=K?k.value():k;return j||(j=new e),C(R,Q,S,N,j)}}return L?(j||(j=new e),s(b,k,S,N,C,j)):!1}return Nm=E,Nm}var Em,xS;function vR(){if(xS)return Em;xS=1;var e=m6(),t=jr();function n(s,i,a,l,u){return s===i?!0:s==null||i==null||!t(s)&&!t(i)?s!==s&&i!==i:e(s,i,a,l,n,u)}return Em=n,Em}var Cm,bS;function g6(){if(bS)return Cm;bS=1;var e=Ju(),t=vR(),n=1,s=2;function i(a,l,u,h){var p=u.length,f=p,g=!h;if(a==null)return!f;for(a=Object(a);p--;){var v=u[p];if(g&&v[2]?v[1]!==a[v[0]]:!(v[0]in a))return!1}for(;++p<f;){v=u[p];var w=v[0],E=a[w],b=v[1];if(g&&v[2]){if(E===void 0&&!(w in a))return!1}else{var k=new e;if(h)var S=h(E,b,w,a,l,k);if(!(S===void 0?t(b,E,n|s,h,k):S))return!1}}return!0}return Cm=i,Cm}var jm,kS;function wR(){if(kS)return jm;kS=1;var e=Dn();function t(n){return n===n&&!e(n)}return jm=t,jm}var Tm,_S;function y6(){if(_S)return Tm;_S=1;var e=wR(),t=qs();function n(s){for(var i=t(s),a=i.length;a--;){var l=i[a],u=s[l];i[a]=[l,u,e(u)]}return i}return Tm=n,Tm}var Rm,SS;function xR(){if(SS)return Rm;SS=1;function e(t,n){return function(s){return s==null?!1:s[t]===n&&(n!==void 0||t in Object(s))}}return Rm=e,Rm}var Am,NS;function v6(){if(NS)return Am;NS=1;var e=g6(),t=y6(),n=xR();function s(i){var a=t(i);return a.length==1&&a[0][2]?n(a[0][0],a[0][1]):function(l){return l===i||e(l,i,a)}}return Am=s,Am}var Mm,ES;function ra(){if(ES)return Mm;ES=1;var e=No(),t=jr(),n="[object Symbol]";function s(i){return typeof i=="symbol"||t(i)&&e(i)==n}return Mm=s,Mm}var Im,CS;function n0(){if(CS)return Im;CS=1;var e=It(),t=ra(),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 Im=i,Im}var Om,jS;function w6(){if(jS)return Om;jS=1;var e=Ww(),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,Om=n,Om}var Pm,TS;function x6(){if(TS)return Pm;TS=1;var e=w6(),t=500;function n(s){var i=e(s,function(l){return a.size===t&&a.clear(),l}),a=i.cache;return i}return Pm=n,Pm}var $m,RS;function b6(){if(RS)return $m;RS=1;var e=x6(),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 $m=s,$m}var Lm,AS;function ad(){if(AS)return Lm;AS=1;function e(t,n){for(var s=-1,i=t==null?0:t.length,a=Array(i);++s<i;)a[s]=n(t[s],s,t);return a}return Lm=e,Lm}var qm,MS;function k6(){if(MS)return qm;MS=1;var e=ea(),t=ad(),n=It(),s=ra(),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 qm=l,qm}var Dm,IS;function bR(){if(IS)return Dm;IS=1;var e=k6();function t(n){return n==null?"":e(n)}return Dm=t,Dm}var Fm,OS;function ld(){if(OS)return Fm;OS=1;var e=It(),t=n0(),n=b6(),s=bR();function i(a,l){return e(a)?a:t(a,l)?[a]:n(s(a))}return Fm=i,Fm}var zm,PS;function ql(){if(PS)return zm;PS=1;var e=ra();function t(n){if(typeof n=="string"||e(n))return n;var s=n+"";return s=="0"&&1/n==-1/0?"-0":s}return zm=t,zm}var Bm,$S;function cd(){if($S)return Bm;$S=1;var e=ld(),t=ql();function n(s,i){i=e(i,s);for(var a=0,l=i.length;s!=null&&a<l;)s=s[t(i[a++])];return a&&a==l?s:void 0}return Bm=n,Bm}var Um,LS;function _6(){if(LS)return Um;LS=1;var e=cd();function t(n,s,i){var a=n==null?void 0:e(n,s);return a===void 0?i:a}return Um=t,Um}var Wm,qS;function S6(){if(qS)return Wm;qS=1;function e(t,n){return t!=null&&n in Object(t)}return Wm=e,Wm}var Hm,DS;function kR(){if(DS)return Hm;DS=1;var e=ld(),t=$l(),n=It(),s=nd(),i=Gw(),a=ql();function l(u,h,p){h=e(h,u);for(var f=-1,g=h.length,v=!1;++f<g;){var w=a(h[f]);if(!(v=u!=null&&p(u,w)))break;u=u[w]}return v||++f!=g?v:(g=u==null?0:u.length,!!g&&i(g)&&s(w,g)&&(n(u)||t(u)))}return Hm=l,Hm}var Gm,FS;function _R(){if(FS)return Gm;FS=1;var e=S6(),t=kR();function n(s,i){return s!=null&&t(s,i,e)}return Gm=n,Gm}var Vm,zS;function N6(){if(zS)return Vm;zS=1;var e=vR(),t=_6(),n=_R(),s=n0(),i=wR(),a=xR(),l=ql(),u=1,h=2;function p(f,g){return s(f)&&i(g)?a(l(f),g):function(v){var w=t(v,f);return w===void 0&&w===g?n(v,f):e(g,w,u|h)}}return Vm=p,Vm}var Ym,BS;function SR(){if(BS)return Ym;BS=1;function e(t){return function(n){return n==null?void 0:n[t]}}return Ym=e,Ym}var Km,US;function E6(){if(US)return Km;US=1;var e=cd();function t(n){return function(s){return e(s,n)}}return Km=t,Km}var Xm,WS;function C6(){if(WS)return Xm;WS=1;var e=SR(),t=E6(),n=n0(),s=ql();function i(a){return n(a)?e(s(a)):t(a)}return Xm=i,Xm}var Qm,HS;function ts(){if(HS)return Qm;HS=1;var e=v6(),t=N6(),n=jo(),s=It(),i=C6();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 Qm=a,Qm}var Zm,GS;function NR(){if(GS)return Zm;GS=1;var e=tR(),t=l6(),n=ts(),s=It();function i(a,l){var u=s(a)?e:t;return u(a,n(l,3))}return Zm=i,Zm}var Jm,VS;function j6(){if(VS)return Jm;VS=1;var e=Object.prototype,t=e.hasOwnProperty;function n(s,i){return s!=null&&t.call(s,i)}return Jm=n,Jm}var eg,YS;function ER(){if(YS)return eg;YS=1;var e=j6(),t=kR();function n(s,i){return s!=null&&t(s,i,e)}return eg=n,eg}var tg,KS;function T6(){if(KS)return tg;KS=1;var e=Yw(),t=na(),n=$l(),s=It(),i=es(),a=ta(),l=sd(),u=Ll(),h="[object Map]",p="[object Set]",f=Object.prototype,g=f.hasOwnProperty;function v(w){if(w==null)return!0;if(i(w)&&(s(w)||typeof w=="string"||typeof w.splice=="function"||a(w)||u(w)||n(w)))return!w.length;var E=t(w);if(E==h||E==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 tg=v,tg}var ng,XS;function CR(){if(XS)return ng;XS=1;function e(t){return t===void 0}return ng=e,ng}var rg,QS;function jR(){if(QS)return rg;QS=1;var e=id(),t=es();function n(s,i){var a=-1,l=t(s)?Array(s.length):[];return e(s,function(u,h,p){l[++a]=i(u,h,p)}),l}return rg=n,rg}var sg,ZS;function TR(){if(ZS)return sg;ZS=1;var e=ad(),t=ts(),n=jR(),s=It();function i(a,l){var u=s(a)?e:n;return u(a,t(l,3))}return sg=i,sg}var og,JS;function R6(){if(JS)return og;JS=1;function e(t,n,s,i){var a=-1,l=t==null?0:t.length;for(i&&l&&(s=t[++a]);++a<l;)s=n(s,t[a],a,t);return s}return og=e,og}var ig,eN;function A6(){if(eN)return ig;eN=1;function e(t,n,s,i,a){return a(t,function(l,u,h){s=i?(i=!1,l):n(s,l,u,h)}),s}return ig=e,ig}var ag,tN;function RR(){if(tN)return ag;tN=1;var e=R6(),t=id(),n=ts(),s=A6(),i=It();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 ag=a,ag}var lg,nN;function M6(){if(nN)return lg;nN=1;var e=No(),t=It(),n=jr(),s="[object String]";function i(a){return typeof a=="string"||!t(a)&&n(a)&&e(a)==s}return lg=i,lg}var cg,rN;function I6(){if(rN)return cg;rN=1;var e=SR(),t=e("length");return cg=t,cg}var ug,sN;function O6(){if(sN)return ug;sN=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",s="\\u20d0-\\u20ff",i=t+n+s,a="\\ufe0e\\ufe0f",l="\\u200d",u=RegExp("["+l+e+i+a+"]");function h(p){return u.test(p)}return ug=h,ug}var dg,oN;function P6(){if(oN)return dg;oN=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",s="\\u20d0-\\u20ff",i=t+n+s,a="\\ufe0e\\ufe0f",l="["+e+"]",u="["+i+"]",h="\\ud83c[\\udffb-\\udfff]",p="(?:"+u+"|"+h+")",f="[^"+e+"]",g="(?:\\ud83c[\\udde6-\\uddff]){2}",v="[\\ud800-\\udbff][\\udc00-\\udfff]",w="\\u200d",E=p+"?",b="["+a+"]?",k="(?:"+w+"(?:"+[f,g,v].join("|")+")"+b+E+")*",S=b+E+k,N="(?:"+[f+u+"?",u,g,v,l].join("|")+")",C=RegExp(h+"(?="+h+")|"+N+S,"g");function j(M){for(var P=C.lastIndex=0;C.test(M);)++P;return P}return dg=j,dg}var fg,iN;function $6(){if(iN)return fg;iN=1;var e=I6(),t=O6(),n=P6();function s(i){return t(i)?n(i):e(i)}return fg=s,fg}var hg,aN;function L6(){if(aN)return hg;aN=1;var e=Yw(),t=na(),n=es(),s=M6(),i=$6(),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 hg=u,hg}var pg,lN;function q6(){if(lN)return pg;lN=1;var e=Hw(),t=cR(),n=e0(),s=ts(),i=od(),a=It(),l=ta(),u=Ol(),h=Dn(),p=Ll();function f(g,v,w){var E=a(g),b=E||l(g)||p(g);if(v=s(v,4),w==null){var k=g&&g.constructor;b?w=E?new k:[]:h(g)?w=u(k)?t(i(g)):{}:w={}}return(b?e:n)(g,function(S,N,C){return v(w,S,N,C)}),w}return pg=f,pg}var mg,cN;function D6(){if(cN)return mg;cN=1;var e=ea(),t=$l(),n=It(),s=e?e.isConcatSpreadable:void 0;function i(a){return n(a)||t(a)||!!(s&&a&&a[s])}return mg=i,mg}var gg,uN;function r0(){if(uN)return gg;uN=1;var e=Xw(),t=D6();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 gg=n,gg}var yg,dN;function F6(){if(dN)return yg;dN=1;function e(t,n,s){switch(s.length){case 0:return t.call(n);case 1:return t.call(n,s[0]);case 2:return t.call(n,s[0],s[1]);case 3:return t.call(n,s[0],s[1],s[2])}return t.apply(n,s)}return yg=e,yg}var vg,fN;function AR(){if(fN)return vg;fN=1;var e=F6(),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 vg=n,vg}var wg,hN;function z6(){if(hN)return wg;hN=1;var e=Zw(),t=XT(),n=jo(),s=t?function(i,a){return t(i,"toString",{configurable:!0,enumerable:!1,value:e(a),writable:!0})}:n;return wg=s,wg}var xg,pN;function B6(){if(pN)return xg;pN=1;var e=800,t=16,n=Date.now;function s(i){var a=0,l=0;return function(){var u=n(),h=t-(u-l);if(l=u,h>0){if(++a>=e)return arguments[0]}else a=0;return i.apply(void 0,arguments)}}return xg=s,xg}var bg,mN;function MR(){if(mN)return bg;mN=1;var e=z6(),t=B6(),n=t(e);return bg=n,bg}var kg,gN;function ud(){if(gN)return kg;gN=1;var e=jo(),t=AR(),n=MR();function s(i,a){return n(t(i,a,e),i+"")}return kg=s,kg}var _g,yN;function IR(){if(yN)return _g;yN=1;function e(t,n,s,i){for(var a=t.length,l=s+(i?1:-1);i?l--:++l<a;)if(n(t[l],l,t))return l;return-1}return _g=e,_g}var Sg,vN;function U6(){if(vN)return Sg;vN=1;function e(t){return t!==t}return Sg=e,Sg}var Ng,wN;function W6(){if(wN)return Ng;wN=1;function e(t,n,s){for(var i=s-1,a=t.length;++i<a;)if(t[i]===n)return i;return-1}return Ng=e,Ng}var Eg,xN;function H6(){if(xN)return Eg;xN=1;var e=IR(),t=U6(),n=W6();function s(i,a,l){return a===a?n(i,a,l):e(i,t,l)}return Eg=s,Eg}var Cg,bN;function G6(){if(bN)return Cg;bN=1;var e=H6();function t(n,s){var i=n==null?0:n.length;return!!i&&e(n,s,0)>-1}return Cg=t,Cg}var jg,kN;function V6(){if(kN)return jg;kN=1;function e(t,n,s){for(var i=-1,a=t==null?0:t.length;++i<a;)if(s(n,t[i]))return!0;return!1}return jg=e,jg}var Tg,_N;function Y6(){if(_N)return Tg;_N=1;function e(){}return Tg=e,Tg}var Rg,SN;function K6(){if(SN)return Rg;SN=1;var e=iR(),t=Y6(),n=t0(),s=1/0,i=e&&1/n(new e([,-0]))[1]==s?function(a){return new e(a)}:t;return Rg=i,Rg}var Ag,NN;function X6(){if(NN)return Ag;NN=1;var e=mR(),t=G6(),n=V6(),s=gR(),i=K6(),a=t0(),l=200;function u(h,p,f){var g=-1,v=t,w=h.length,E=!0,b=[],k=b;if(f)E=!1,v=n;else if(w>=l){var S=p?null:i(h);if(S)return a(S);E=!1,v=s,k=new e}else k=p?[]:b;e:for(;++g<w;){var N=h[g],C=p?p(N):N;if(N=f||N!==0?N:0,E&&C===C){for(var j=k.length;j--;)if(k[j]===C)continue e;p&&k.push(C),b.push(N)}else v(k,C,f)||(k!==b&&k.push(C),b.push(N))}return b}return Ag=u,Ag}var Mg,EN;function OR(){if(EN)return Mg;EN=1;var e=es(),t=jr();function n(s){return t(s)&&e(s)}return Mg=n,Mg}var Ig,CN;function Q6(){if(CN)return Ig;CN=1;var e=r0(),t=ud(),n=X6(),s=OR(),i=t(function(a){return n(e(a,1,s,!0))});return Ig=i,Ig}var Og,jN;function Z6(){if(jN)return Og;jN=1;var e=ad();function t(n,s){return e(s,function(i){return n[i]})}return Og=t,Og}var Pg,TN;function PR(){if(TN)return Pg;TN=1;var e=Z6(),t=qs();function n(s){return s==null?[]:e(s,t(s))}return Pg=n,Pg}var $g,RN;function Fn(){if(RN)return $g;RN=1;var e;if(typeof Bw=="function")try{e={clone:o6(),constant:Zw(),each:pR(),filter:NR(),has:ER(),isArray:It(),isEmpty:T6(),isFunction:Ol(),isUndefined:CR(),keys:qs(),map:TR(),reduce:RR(),size:L6(),transform:q6(),union:Q6(),values:PR()}}catch{}return e||(e=window._),$g=e,$g}var Lg,AN;function s0(){if(AN)return Lg;AN=1;var e=Fn();Lg=i;var t="\0",n="\0",s="";function i(f){this._isDirected=e.has(f,"directed")?f.directed:!0,this._isMultigraph=e.has(f,"multigraph")?f.multigraph:!1,this._isCompound=e.has(f,"compound")?f.compound:!1,this._label=void 0,this._defaultNodeLabelFn=e.constant(void 0),this._defaultEdgeLabelFn=e.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[n]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}i.prototype._nodeCount=0,i.prototype._edgeCount=0,i.prototype.isDirected=function(){return this._isDirected},i.prototype.isMultigraph=function(){return this._isMultigraph},i.prototype.isCompound=function(){return this._isCompound},i.prototype.setGraph=function(f){return this._label=f,this},i.prototype.graph=function(){return this._label},i.prototype.setDefaultNodeLabel=function(f){return e.isFunction(f)||(f=e.constant(f)),this._defaultNodeLabelFn=f,this},i.prototype.nodeCount=function(){return this._nodeCount},i.prototype.nodes=function(){return e.keys(this._nodes)},i.prototype.sources=function(){var f=this;return e.filter(this.nodes(),function(g){return e.isEmpty(f._in[g])})},i.prototype.sinks=function(){var f=this;return e.filter(this.nodes(),function(g){return e.isEmpty(f._out[g])})},i.prototype.setNodes=function(f,g){var v=arguments,w=this;return e.each(f,function(E){v.length>1?w.setNode(E,g):w.setNode(E)}),this},i.prototype.setNode=function(f,g){return e.has(this._nodes,f)?(arguments.length>1&&(this._nodes[f]=g),this):(this._nodes[f]=arguments.length>1?g:this._defaultNodeLabelFn(f),this._isCompound&&(this._parent[f]=n,this._children[f]={},this._children[n][f]=!0),this._in[f]={},this._preds[f]={},this._out[f]={},this._sucs[f]={},++this._nodeCount,this)},i.prototype.node=function(f){return this._nodes[f]},i.prototype.hasNode=function(f){return e.has(this._nodes,f)},i.prototype.removeNode=function(f){var g=this;if(e.has(this._nodes,f)){var v=function(w){g.removeEdge(g._edgeObjs[w])};delete this._nodes[f],this._isCompound&&(this._removeFromParentsChildList(f),delete this._parent[f],e.each(this.children(f),function(w){g.setParent(w)}),delete this._children[f]),e.each(e.keys(this._in[f]),v),delete this._in[f],delete this._preds[f],e.each(e.keys(this._out[f]),v),delete this._out[f],delete this._sucs[f],--this._nodeCount}return this},i.prototype.setParent=function(f,g){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(e.isUndefined(g))g=n;else{g+="";for(var v=g;!e.isUndefined(v);v=this.parent(v))if(v===f)throw new Error("Setting "+g+" as parent of "+f+" would create a cycle");this.setNode(g)}return this.setNode(f),this._removeFromParentsChildList(f),this._parent[f]=g,this._children[g][f]=!0,this},i.prototype._removeFromParentsChildList=function(f){delete this._children[this._parent[f]][f]},i.prototype.parent=function(f){if(this._isCompound){var g=this._parent[f];if(g!==n)return g}},i.prototype.children=function(f){if(e.isUndefined(f)&&(f=n),this._isCompound){var g=this._children[f];if(g)return e.keys(g)}else{if(f===n)return this.nodes();if(this.hasNode(f))return[]}},i.prototype.predecessors=function(f){var g=this._preds[f];if(g)return e.keys(g)},i.prototype.successors=function(f){var g=this._sucs[f];if(g)return e.keys(g)},i.prototype.neighbors=function(f){var g=this.predecessors(f);if(g)return e.union(g,this.successors(f))},i.prototype.isLeaf=function(f){var g;return this.isDirected()?g=this.successors(f):g=this.neighbors(f),g.length===0},i.prototype.filterNodes=function(f){var g=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});g.setGraph(this.graph());var v=this;e.each(this._nodes,function(b,k){f(k)&&g.setNode(k,b)}),e.each(this._edgeObjs,function(b){g.hasNode(b.v)&&g.hasNode(b.w)&&g.setEdge(b,v.edge(b))});var w={};function E(b){var k=v.parent(b);return k===void 0||g.hasNode(k)?(w[b]=k,k):k in w?w[k]:E(k)}return this._isCompound&&e.each(g.nodes(),function(b){g.setParent(b,E(b))}),g},i.prototype.setDefaultEdgeLabel=function(f){return e.isFunction(f)||(f=e.constant(f)),this._defaultEdgeLabelFn=f,this},i.prototype.edgeCount=function(){return this._edgeCount},i.prototype.edges=function(){return e.values(this._edgeObjs)},i.prototype.setPath=function(f,g){var v=this,w=arguments;return e.reduce(f,function(E,b){return w.length>1?v.setEdge(E,b,g):v.setEdge(E,b),b}),this},i.prototype.setEdge=function(){var f,g,v,w,E=!1,b=arguments[0];typeof b=="object"&&b!==null&&"v"in b?(f=b.v,g=b.w,v=b.name,arguments.length===2&&(w=arguments[1],E=!0)):(f=b,g=arguments[1],v=arguments[3],arguments.length>2&&(w=arguments[2],E=!0)),f=""+f,g=""+g,e.isUndefined(v)||(v=""+v);var k=u(this._isDirected,f,g,v);if(e.has(this._edgeLabels,k))return E&&(this._edgeLabels[k]=w),this;if(!e.isUndefined(v)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(f),this.setNode(g),this._edgeLabels[k]=E?w:this._defaultEdgeLabelFn(f,g,v);var S=h(this._isDirected,f,g,v);return f=S.v,g=S.w,Object.freeze(S),this._edgeObjs[k]=S,a(this._preds[g],f),a(this._sucs[f],g),this._in[g][k]=S,this._out[f][k]=S,this._edgeCount++,this},i.prototype.edge=function(f,g,v){var w=arguments.length===1?p(this._isDirected,arguments[0]):u(this._isDirected,f,g,v);return this._edgeLabels[w]},i.prototype.hasEdge=function(f,g,v){var w=arguments.length===1?p(this._isDirected,arguments[0]):u(this._isDirected,f,g,v);return e.has(this._edgeLabels,w)},i.prototype.removeEdge=function(f,g,v){var w=arguments.length===1?p(this._isDirected,arguments[0]):u(this._isDirected,f,g,v),E=this._edgeObjs[w];return E&&(f=E.v,g=E.w,delete this._edgeLabels[w],delete this._edgeObjs[w],l(this._preds[g],f),l(this._sucs[f],g),delete this._in[g][w],delete this._out[f][w],this._edgeCount--),this},i.prototype.inEdges=function(f,g){var v=this._in[f];if(v){var w=e.values(v);return g?e.filter(w,function(E){return E.v===g}):w}},i.prototype.outEdges=function(f,g){var v=this._out[f];if(v){var w=e.values(v);return g?e.filter(w,function(E){return E.w===g}):w}},i.prototype.nodeEdges=function(f,g){var v=this.inEdges(f,g);if(v)return v.concat(this.outEdges(f,g))};function a(f,g){f[g]?f[g]++:f[g]=1}function l(f,g){--f[g]||delete f[g]}function u(f,g,v,w){var E=""+g,b=""+v;if(!f&&E>b){var k=E;E=b,b=k}return E+s+b+s+(e.isUndefined(w)?t:w)}function h(f,g,v,w){var E=""+g,b=""+v;if(!f&&E>b){var k=E;E=b,b=k}var S={v:E,w:b};return w&&(S.name=w),S}function p(f,g){return u(f,g.v,g.w,g.name)}return Lg}var qg,MN;function J6(){return MN||(MN=1,qg="2.1.8"),qg}var Dg,IN;function ez(){return IN||(IN=1,Dg={Graph:s0(),version:J6()}),Dg}var Fg,ON;function tz(){if(ON)return Fg;ON=1;var e=Fn(),t=s0();Fg={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 Fg}var zg,PN;function nz(){if(PN)return zg;PN=1;var e=Fn();zg=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 zg}var Bg,$N;function $R(){if($N)return Bg;$N=1;var e=Fn();Bg=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},Bg}var Ug,LN;function LR(){if(LN)return Ug;LN=1;var e=Fn(),t=$R();Ug=s;var n=e.constant(1);function s(a,l,u,h){return i(a,String(l),u||n,h||function(p){return a.outEdges(p)})}function i(a,l,u,h){var p={},f=new t,g,v,w=function(E){var b=E.v!==g?E.v:E.w,k=p[b],S=u(E),N=v.distance+S;if(S<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+E+" Weight: "+S);N<k.distance&&(k.distance=N,k.predecessor=g,f.decrease(b,N))};for(a.nodes().forEach(function(E){var b=E===l?0:Number.POSITIVE_INFINITY;p[E]={distance:b},f.add(E,b)});f.size()>0&&(g=f.removeMin(),v=p[g],v.distance!==Number.POSITIVE_INFINITY);)h(g).forEach(w);return p}return Ug}var Wg,qN;function rz(){if(qN)return Wg;qN=1;var e=LR(),t=Fn();Wg=n;function n(s,i,a){return t.transform(s.nodes(),function(l,u){l[u]=e(s,u,i,a)},{})}return Wg}var Hg,DN;function qR(){if(DN)return Hg;DN=1;var e=Fn();Hg=t;function t(n){var s=0,i=[],a={},l=[];function u(h){var p=a[h]={onStack:!0,lowlink:s,index:s++};if(i.push(h),n.successors(h).forEach(function(v){e.has(a,v)?a[v].onStack&&(p.lowlink=Math.min(p.lowlink,a[v].index)):(u(v),p.lowlink=Math.min(p.lowlink,a[v].lowlink))}),p.lowlink===p.index){var f=[],g;do g=i.pop(),a[g].onStack=!1,f.push(g);while(h!==g);l.push(f)}}return n.nodes().forEach(function(h){e.has(a,h)||u(h)}),l}return Hg}var Gg,FN;function sz(){if(FN)return Gg;FN=1;var e=Fn(),t=qR();Gg=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 Gg}var Vg,zN;function oz(){if(zN)return Vg;zN=1;var e=Fn();Vg=n;var t=e.constant(1);function n(i,a,l){return s(i,a||t,l||function(u){return i.outEdges(u)})}function s(i,a,l){var u={},h=i.nodes();return h.forEach(function(p){u[p]={},u[p][p]={distance:0},h.forEach(function(f){p!==f&&(u[p][f]={distance:Number.POSITIVE_INFINITY})}),l(p).forEach(function(f){var g=f.v===p?f.w:f.v,v=a(f);u[p][g]={distance:v,predecessor:p}})}),h.forEach(function(p){var f=u[p];h.forEach(function(g){var v=u[g];h.forEach(function(w){var E=v[p],b=f[w],k=v[w],S=E.distance+b.distance;S<k.distance&&(k.distance=S,k.predecessor=b.predecessor)})})}),u}return Vg}var Yg,BN;function DR(){if(BN)return Yg;BN=1;var e=Fn();Yg=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,Yg}var Kg,UN;function iz(){if(UN)return Kg;UN=1;var e=DR();Kg=t;function t(n){try{e(n)}catch(s){if(s instanceof e.CycleException)return!1;throw s}return!0}return Kg}var Xg,WN;function FR(){if(WN)return Xg;WN=1;var e=Fn();Xg=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 Xg}var Qg,HN;function az(){if(HN)return Qg;HN=1;var e=FR();Qg=t;function t(n,s){return e(n,s,"post")}return Qg}var Zg,GN;function lz(){if(GN)return Zg;GN=1;var e=FR();Zg=t;function t(n,s){return e(n,s,"pre")}return Zg}var Jg,VN;function cz(){if(VN)return Jg;VN=1;var e=Fn(),t=s0(),n=$R();Jg=s;function s(i,a){var l=new t,u={},h=new n,p;function f(v){var w=v.v===p?v.w:v.v,E=h.priority(w);if(E!==void 0){var b=a(v);b<E&&(u[w]=p,h.decrease(w,b))}}if(i.nodeCount()===0)return l;e.each(i.nodes(),function(v){h.add(v,Number.POSITIVE_INFINITY),l.setNode(v)}),h.decrease(i.nodes()[0],0);for(var g=!1;h.size()>0;){if(p=h.removeMin(),e.has(u,p))l.setEdge(p,u[p]);else{if(g)throw new Error("Input graph is not connected: "+i);g=!0}i.nodeEdges(p).forEach(f)}return l}return Jg}var ey,YN;function uz(){return YN||(YN=1,ey={components:nz(),dijkstra:LR(),dijkstraAll:rz(),findCycles:sz(),floydWarshall:oz(),isAcyclic:iz(),postorder:az(),preorder:lz(),prim:cz(),tarjan:qR(),topsort:DR()}),ey}var ty,KN;function dz(){if(KN)return ty;KN=1;var e=ez();return ty={Graph:e.Graph,json:tz(),alg:uz(),version:e.version},ty}var ny,XN;function ur(){if(XN)return ny;XN=1;var e;if(typeof Bw=="function")try{e=dz()}catch{}return e||(e=window.graphlib),ny=e,ny}var ry,QN;function fz(){if(QN)return ry;QN=1;var e=dR(),t=1,n=4;function s(i){return e(i,t|n)}return ry=s,ry}var sy,ZN;function dd(){if(ZN)return sy;ZN=1;var e=Ji(),t=es(),n=nd(),s=Dn();function i(a,l,u){if(!s(u))return!1;var h=typeof l;return(h=="number"?t(u)&&n(l,u.length):h=="string"&&l in u)?e(u[l],a):!1}return sy=i,sy}var oy,JN;function hz(){if(JN)return oy;JN=1;var e=ud(),t=Ji(),n=dd(),s=Co(),i=Object.prototype,a=i.hasOwnProperty,l=e(function(u,h){u=Object(u);var p=-1,f=h.length,g=f>2?h[2]:void 0;for(g&&n(h[0],h[1],g)&&(f=1);++p<f;)for(var v=h[p],w=s(v),E=-1,b=w.length;++E<b;){var k=w[E],S=u[k];(S===void 0||t(S,i[k])&&!a.call(u,k))&&(u[k]=v[k])}return u});return oy=l,oy}var iy,eE;function pz(){if(eE)return iy;eE=1;var e=ts(),t=es(),n=qs();function s(i){return function(a,l,u){var h=Object(a);if(!t(a)){var p=e(l,3);a=n(a),l=function(g){return p(h[g],g,h)}}var f=i(a,l,u);return f>-1?h[p?a[f]:f]:void 0}}return iy=s,iy}var ay,tE;function mz(){if(tE)return ay;tE=1;var e=/\s/;function t(n){for(var s=n.length;s--&&e.test(n.charAt(s)););return s}return ay=t,ay}var ly,nE;function gz(){if(nE)return ly;nE=1;var e=mz(),t=/^\s+/;function n(s){return s&&s.slice(0,e(s)+1).replace(t,"")}return ly=n,ly}var cy,rE;function yz(){if(rE)return cy;rE=1;var e=gz(),t=Dn(),n=ra(),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 cy=h,cy}var uy,sE;function zR(){if(sE)return uy;sE=1;var e=yz(),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 uy=s,uy}var dy,oE;function vz(){if(oE)return dy;oE=1;var e=zR();function t(n){var s=e(n),i=s%1;return s===s?i?s-i:s:0}return dy=t,dy}var fy,iE;function wz(){if(iE)return fy;iE=1;var e=IR(),t=ts(),n=vz(),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 fy=i,fy}var hy,aE;function xz(){if(aE)return hy;aE=1;var e=pz(),t=wz(),n=e(t);return hy=n,hy}var py,lE;function BR(){if(lE)return py;lE=1;var e=r0();function t(n){var s=n==null?0:n.length;return s?e(n,1):[]}return py=t,py}var my,cE;function bz(){if(cE)return my;cE=1;var e=Jw(),t=fR(),n=Co();function s(i,a){return i==null?i:e(i,t(a),n)}return my=s,my}var gy,uE;function kz(){if(uE)return gy;uE=1;function e(t){var n=t==null?0:t.length;return n?t[n-1]:void 0}return gy=e,gy}var yy,dE;function _z(){if(dE)return yy;dE=1;var e=ed(),t=e0(),n=ts();function s(i,a){var l={};return a=n(a,3),t(i,function(u,h,p){e(l,h,a(u,h,p))}),l}return yy=s,yy}var vy,fE;function o0(){if(fE)return vy;fE=1;var e=ra();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 vy=t,vy}var wy,hE;function Sz(){if(hE)return wy;hE=1;function e(t,n){return t>n}return wy=e,wy}var xy,pE;function Nz(){if(pE)return xy;pE=1;var e=o0(),t=Sz(),n=jo();function s(i){return i&&i.length?e(i,n,t):void 0}return xy=s,xy}var by,mE;function UR(){if(mE)return by;mE=1;var e=ed(),t=Ji();function n(s,i,a){(a!==void 0&&!t(s[i],a)||a===void 0&&!(i in s))&&e(s,i,a)}return by=n,by}var ky,gE;function Ez(){if(gE)return ky;gE=1;var e=No(),t=od(),n=jr(),s="[object Object]",i=Function.prototype,a=Object.prototype,l=i.toString,u=a.hasOwnProperty,h=l.call(Object);function p(f){if(!n(f)||e(f)!=s)return!1;var g=t(f);if(g===null)return!0;var v=u.call(g,"constructor")&&g.constructor;return typeof v=="function"&&v instanceof v&&l.call(v)==h}return ky=p,ky}var _y,yE;function WR(){if(yE)return _y;yE=1;function e(t,n){if(!(n==="constructor"&&typeof t[n]=="function")&&n!="__proto__")return t[n]}return _y=e,_y}var Sy,vE;function Cz(){if(vE)return Sy;vE=1;var e=Pl(),t=Co();function n(s){return e(s,t(s))}return Sy=n,Sy}var Ny,wE;function jz(){if(wE)return Ny;wE=1;var e=UR(),t=JT(),n=lR(),s=eR(),i=uR(),a=$l(),l=It(),u=OR(),h=ta(),p=Ol(),f=Dn(),g=Ez(),v=Ll(),w=WR(),E=Cz();function b(k,S,N,C,j,M,P){var I=w(k,N),D=w(S,N),O=P.get(D);if(O){e(k,N,O);return}var A=M?M(I,D,N+"",k,S,P):void 0,L=A===void 0;if(L){var z=l(D),K=!z&&h(D),R=!z&&!K&&v(D);A=D,z||K||R?l(I)?A=I:u(I)?A=s(I):K?(L=!1,A=t(D,!0)):R?(L=!1,A=n(D,!0)):A=[]:g(D)||a(D)?(A=I,a(I)?A=E(I):(!f(I)||p(I))&&(A=i(D))):L=!1}L&&(P.set(D,A),j(A,D,C,M,P),P.delete(D)),e(k,N,A)}return Ny=b,Ny}var Ey,xE;function Tz(){if(xE)return Ey;xE=1;var e=Ju(),t=UR(),n=Jw(),s=jz(),i=Dn(),a=Co(),l=WR();function u(h,p,f,g,v){h!==p&&n(p,function(w,E){if(v||(v=new e),i(w))s(h,p,E,f,u,g,v);else{var b=g?g(l(h,E),w,E+"",h,p,v):void 0;b===void 0&&(b=w),t(h,E,b)}},a)}return Ey=u,Ey}var Cy,bE;function Rz(){if(bE)return Cy;bE=1;var e=ud(),t=dd();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 Cy=n,Cy}var jy,kE;function Az(){if(kE)return jy;kE=1;var e=Tz(),t=Rz(),n=t(function(s,i,a){e(s,i,a)});return jy=n,jy}var Ty,_E;function HR(){if(_E)return Ty;_E=1;function e(t,n){return t<n}return Ty=e,Ty}var Ry,SE;function Mz(){if(SE)return Ry;SE=1;var e=o0(),t=HR(),n=jo();function s(i){return i&&i.length?e(i,n,t):void 0}return Ry=s,Ry}var Ay,NE;function Iz(){if(NE)return Ay;NE=1;var e=o0(),t=ts(),n=HR();function s(i,a){return i&&i.length?e(i,t(a,2),n):void 0}return Ay=s,Ay}var My,EE;function Oz(){if(EE)return My;EE=1;var e=fr(),t=function(){return e.Date.now()};return My=t,My}var Iy,CE;function Pz(){if(CE)return Iy;CE=1;var e=td(),t=ld(),n=nd(),s=Dn(),i=ql();function a(l,u,h,p){if(!s(l))return l;u=t(u,l);for(var f=-1,g=u.length,v=g-1,w=l;w!=null&&++f<g;){var E=i(u[f]),b=h;if(E==="__proto__"||E==="constructor"||E==="prototype")return l;if(f!=v){var k=w[E];b=p?p(k,E,w):void 0,b===void 0&&(b=s(k)?k:n(u[f+1])?[]:{})}e(w,E,b),w=w[E]}return l}return Iy=a,Iy}var Oy,jE;function $z(){if(jE)return Oy;jE=1;var e=cd(),t=Pz(),n=ld();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 Oy=s,Oy}var Py,TE;function Lz(){if(TE)return Py;TE=1;var e=$z(),t=_R();function n(s,i){return e(s,i,function(a,l){return t(s,l)})}return Py=n,Py}var $y,RE;function qz(){if(RE)return $y;RE=1;var e=BR(),t=AR(),n=MR();function s(i){return n(t(i,void 0,e),i+"")}return $y=s,$y}var Ly,AE;function Dz(){if(AE)return Ly;AE=1;var e=Lz(),t=qz(),n=t(function(s,i){return s==null?{}:e(s,i)});return Ly=n,Ly}var qy,ME;function Fz(){if(ME)return qy;ME=1;var e=Math.ceil,t=Math.max;function n(s,i,a,l){for(var u=-1,h=t(e((i-s)/(a||1)),0),p=Array(h);h--;)p[l?h:++u]=s,s+=a;return p}return qy=n,qy}var Dy,IE;function zz(){if(IE)return Dy;IE=1;var e=Fz(),t=dd(),n=zR();function s(i){return function(a,l,u){return u&&typeof u!="number"&&t(a,l,u)&&(l=u=void 0),a=n(a),l===void 0?(l=a,a=0):l=n(l),u=u===void 0?a<l?1:-1:n(u),e(a,l,u,i)}}return Dy=s,Dy}var Fy,OE;function Bz(){if(OE)return Fy;OE=1;var e=zz(),t=e();return Fy=t,Fy}var zy,PE;function Uz(){if(PE)return zy;PE=1;function e(t,n){var s=t.length;for(t.sort(n);s--;)t[s]=t[s].value;return t}return zy=e,zy}var By,$E;function Wz(){if($E)return By;$E=1;var e=ra();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 By=t,By}var Uy,LE;function Hz(){if(LE)return Uy;LE=1;var e=Wz();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 Uy=t,Uy}var Wy,qE;function Gz(){if(qE)return Wy;qE=1;var e=ad(),t=cd(),n=ts(),s=jR(),i=Uz(),a=rd(),l=Hz(),u=jo(),h=It();function p(f,g,v){g.length?g=e(g,function(b){return h(b)?function(k){return t(k,b.length===1?b[0]:b)}:b}):g=[u];var w=-1;g=e(g,a(n));var E=s(f,function(b,k,S){var N=e(g,function(C){return C(b)});return{criteria:N,index:++w,value:b}});return i(E,function(b,k){return l(b,k,v)})}return Wy=p,Wy}var Hy,DE;function Vz(){if(DE)return Hy;DE=1;var e=r0(),t=Gz(),n=ud(),s=dd(),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 Hy=i,Hy}var Gy,FE;function Yz(){if(FE)return Gy;FE=1;var e=bR(),t=0;function n(s){var i=++t;return e(s)+i}return Gy=n,Gy}var Vy,zE;function Kz(){if(zE)return Vy;zE=1;function e(t,n,s){for(var i=-1,a=t.length,l=n.length,u={};++i<a;){var h=i<l?n[i]:void 0;s(u,t[i],h)}return u}return Vy=e,Vy}var Yy,BE;function Xz(){if(BE)return Yy;BE=1;var e=td(),t=Kz();function n(s,i){return t(s||[],i||[],e)}return Yy=n,Yy}var Ky,UE;function xt(){if(UE)return Ky;UE=1;var e;if(typeof Bw=="function")try{e={cloneDeep:fz(),constant:Zw(),defaults:hz(),each:pR(),filter:NR(),find:xz(),flatten:BR(),forEach:hR(),forIn:bz(),has:ER(),isUndefined:CR(),last:kz(),map:TR(),mapValues:_z(),max:Nz(),merge:Az(),min:Mz(),minBy:Iz(),now:Oz(),pick:Dz(),range:Bz(),reduce:RR(),sortBy:Vz(),uniqueId:Yz(),values:PR(),zipObject:Xz()}}catch{}return e||(e=window._),Ky=e,Ky}var Xy,WE;function Qz(){if(WE)return Xy;WE=1,Xy=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 Xy}var Qy,HE;function Zz(){if(HE)return Qy;HE=1;var e=xt(),t=ur().Graph,n=Qz();Qy=i;var s=e.constant(1);function i(p,f){if(p.nodeCount()<=1)return[];var g=u(p,f||s),v=a(g.graph,g.buckets,g.zeroIdx);return e.flatten(e.map(v,function(w){return p.outEdges(w.v,w.w)}),!0)}function a(p,f,g){for(var v=[],w=f[f.length-1],E=f[0],b;p.nodeCount();){for(;b=E.dequeue();)l(p,f,g,b);for(;b=w.dequeue();)l(p,f,g,b);if(p.nodeCount()){for(var k=f.length-2;k>0;--k)if(b=f[k].dequeue(),b){v=v.concat(l(p,f,g,b,!0));break}}}return v}function l(p,f,g,v,w){var E=w?[]:void 0;return e.forEach(p.inEdges(v.v),function(b){var k=p.edge(b),S=p.node(b.v);w&&E.push({v:b.v,w:b.w}),S.out-=k,h(f,g,S)}),e.forEach(p.outEdges(v.v),function(b){var k=p.edge(b),S=b.w,N=p.node(S);N.in-=k,h(f,g,N)}),p.removeNode(v.v),E}function u(p,f){var g=new t,v=0,w=0;e.forEach(p.nodes(),function(k){g.setNode(k,{v:k,in:0,out:0})}),e.forEach(p.edges(),function(k){var S=g.edge(k.v,k.w)||0,N=f(k),C=S+N;g.setEdge(k.v,k.w,C),w=Math.max(w,g.node(k.v).out+=N),v=Math.max(v,g.node(k.w).in+=N)});var E=e.range(w+v+3).map(function(){return new n}),b=v+1;return e.forEach(g.nodes(),function(k){h(E,b,g.node(k))}),{graph:g,buckets:E,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 Qy}var Zy,GE;function Jz(){if(GE)return Zy;GE=1;var e=xt(),t=Zz();Zy={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 Zy}var Jy,VE;function fn(){if(VE)return Jy;VE=1;var e=xt(),t=ur().Graph;Jy={addDummyNode:n,simplify:s,asNonCompoundGraph:i,successorWeights:a,predecessorWeights:l,intersectRect:u,buildLayerMatrix:h,normalizeRanks:p,removeEmptyRanks:f,addBorderNode:g,maxRank:v,partition:w,time:E,notime:b};function n(k,S,N,C){var j;do j=e.uniqueId(C);while(k.hasNode(j));return N.dummy=S,k.setNode(j,N),j}function s(k){var S=new t().setGraph(k.graph());return e.forEach(k.nodes(),function(N){S.setNode(N,k.node(N))}),e.forEach(k.edges(),function(N){var C=S.edge(N.v,N.w)||{weight:0,minlen:1},j=k.edge(N);S.setEdge(N.v,N.w,{weight:C.weight+j.weight,minlen:Math.max(C.minlen,j.minlen)})}),S}function i(k){var S=new t({multigraph:k.isMultigraph()}).setGraph(k.graph());return e.forEach(k.nodes(),function(N){k.children(N).length||S.setNode(N,k.node(N))}),e.forEach(k.edges(),function(N){S.setEdge(N,k.edge(N))}),S}function a(k){var S=e.map(k.nodes(),function(N){var C={};return e.forEach(k.outEdges(N),function(j){C[j.w]=(C[j.w]||0)+k.edge(j).weight}),C});return e.zipObject(k.nodes(),S)}function l(k){var S=e.map(k.nodes(),function(N){var C={};return e.forEach(k.inEdges(N),function(j){C[j.v]=(C[j.v]||0)+k.edge(j).weight}),C});return e.zipObject(k.nodes(),S)}function u(k,S){var N=k.x,C=k.y,j=S.x-N,M=S.y-C,P=k.width/2,I=k.height/2;if(!j&&!M)throw new Error("Not possible to find intersection inside of the rectangle");var D,O;return Math.abs(M)*P>Math.abs(j)*I?(M<0&&(I=-I),D=I*j/M,O=I):(j<0&&(P=-P),D=P,O=P*M/j),{x:N+D,y:C+O}}function h(k){var S=e.map(e.range(v(k)+1),function(){return[]});return e.forEach(k.nodes(),function(N){var C=k.node(N),j=C.rank;e.isUndefined(j)||(S[j][C.order]=N)}),S}function p(k){var S=e.min(e.map(k.nodes(),function(N){return k.node(N).rank}));e.forEach(k.nodes(),function(N){var C=k.node(N);e.has(C,"rank")&&(C.rank-=S)})}function f(k){var S=e.min(e.map(k.nodes(),function(M){return k.node(M).rank})),N=[];e.forEach(k.nodes(),function(M){var P=k.node(M).rank-S;N[P]||(N[P]=[]),N[P].push(M)});var C=0,j=k.graph().nodeRankFactor;e.forEach(N,function(M,P){e.isUndefined(M)&&P%j!==0?--C:C&&e.forEach(M,function(I){k.node(I).rank+=C})})}function g(k,S,N,C){var j={width:0,height:0};return arguments.length>=4&&(j.rank=N,j.order=C),n(k,"border",j,S)}function v(k){return e.max(e.map(k.nodes(),function(S){var N=k.node(S).rank;if(!e.isUndefined(N))return N}))}function w(k,S){var N={lhs:[],rhs:[]};return e.forEach(k,function(C){S(C)?N.lhs.push(C):N.rhs.push(C)}),N}function E(k,S){var N=e.now();try{return S()}finally{console.log(k+" time: "+(e.now()-N)+"ms")}}function b(k,S){return S()}return Jy}var ev,YE;function eB(){if(YE)return ev;YE=1;var e=xt(),t=fn();ev={run:n,undo:i};function n(a){a.graph().dummyChains=[],e.forEach(a.edges(),function(l){s(a,l)})}function s(a,l){var u=l.v,h=a.node(u).rank,p=l.w,f=a.node(p).rank,g=l.name,v=a.edge(l),w=v.labelRank;if(f!==h+1){a.removeEdge(l);var E,b,k;for(k=0,++h;h<f;++k,++h)v.points=[],b={width:0,height:0,edgeLabel:v,edgeObj:l,rank:h},E=t.addDummyNode(a,"edge",b,"_d"),h===w&&(b.width=v.width,b.height=v.height,b.dummy="edge-label",b.labelpos=v.labelpos),a.setEdge(u,E,{weight:v.weight},g),k===0&&a.graph().dummyChains.push(E),u=E;a.setEdge(u,p,{weight:v.weight},g)}}function i(a){e.forEach(a.graph().dummyChains,function(l){var u=a.node(l),h=u.edgeLabel,p;for(a.setEdge(u.edgeObj,h);u.dummy;)p=a.successors(l)[0],a.removeNode(l),h.points.push({x:u.x,y:u.y}),u.dummy==="edge-label"&&(h.x=u.x,h.y=u.y,h.width=u.width,h.height=u.height),l=p,u=a.node(l)})}return ev}var tv,KE;function Pu(){if(KE)return tv;KE=1;var e=xt();tv={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 tv}var nv,XE;function GR(){if(XE)return nv;XE=1;var e=xt(),t=ur().Graph,n=Pu().slack;nv=s;function s(u){var h=new t({directed:!1}),p=u.nodes()[0],f=u.nodeCount();h.setNode(p,{});for(var g,v;i(h,u)<f;)g=a(h,u),v=h.hasNode(g.v)?n(u,g):-n(u,g),l(h,u,v);return h}function i(u,h){function p(f){e.forEach(h.nodeEdges(f),function(g){var v=g.v,w=f===v?g.w:v;!u.hasNode(w)&&!n(h,g)&&(u.setNode(w,{}),u.setEdge(f,w,{}),p(w))})}return e.forEach(u.nodes(),p),u.nodeCount()}function a(u,h){return e.minBy(h.edges(),function(p){if(u.hasNode(p.v)!==u.hasNode(p.w))return n(h,p)})}function l(u,h,p){e.forEach(u.nodes(),function(f){h.node(f).rank+=p})}return nv}var rv,QE;function tB(){if(QE)return rv;QE=1;var e=xt(),t=GR(),n=Pu().slack,s=Pu().longestPath,i=ur().alg.preorder,a=ur().alg.postorder,l=fn().simplify;rv=u,u.initLowLimValues=g,u.initCutValues=h,u.calcCutValue=f,u.leaveEdge=w,u.enterEdge=E,u.exchangeEdges=b;function u(C){C=l(C),s(C);var j=t(C);g(j),h(j,C);for(var M,P;M=w(j);)P=E(j,C,M),b(j,C,M,P)}function h(C,j){var M=a(C,C.nodes());M=M.slice(0,M.length-1),e.forEach(M,function(P){p(C,j,P)})}function p(C,j,M){var P=C.node(M),I=P.parent;C.edge(M,I).cutvalue=f(C,j,M)}function f(C,j,M){var P=C.node(M),I=P.parent,D=!0,O=j.edge(M,I),A=0;return O||(D=!1,O=j.edge(I,M)),A=O.weight,e.forEach(j.nodeEdges(M),function(L){var z=L.v===M,K=z?L.w:L.v;if(K!==I){var R=z===D,Q=j.edge(L).weight;if(A+=R?Q:-Q,S(C,M,K)){var H=C.edge(M,K).cutvalue;A+=R?-H:H}}}),A}function g(C,j){arguments.length<2&&(j=C.nodes()[0]),v(C,{},1,j)}function v(C,j,M,P,I){var D=M,O=C.node(P);return j[P]=!0,e.forEach(C.neighbors(P),function(A){e.has(j,A)||(M=v(C,j,M,A,P))}),O.low=D,O.lim=M++,I?O.parent=I:delete O.parent,M}function w(C){return e.find(C.edges(),function(j){return C.edge(j).cutvalue<0})}function E(C,j,M){var P=M.v,I=M.w;j.hasEdge(P,I)||(P=M.w,I=M.v);var D=C.node(P),O=C.node(I),A=D,L=!1;D.lim>O.lim&&(A=O,L=!0);var z=e.filter(j.edges(),function(K){return L===N(C,C.node(K.v),A)&&L!==N(C,C.node(K.w),A)});return e.minBy(z,function(K){return n(j,K)})}function b(C,j,M,P){var I=M.v,D=M.w;C.removeEdge(I,D),C.setEdge(P.v,P.w,{}),g(C),h(C,j),k(C,j)}function k(C,j){var M=e.find(C.nodes(),function(I){return!j.node(I).parent}),P=i(C,M);P=P.slice(1),e.forEach(P,function(I){var D=C.node(I).parent,O=j.edge(I,D),A=!1;O||(O=j.edge(D,I),A=!0),j.node(I).rank=j.node(D).rank+(A?O.minlen:-O.minlen)})}function S(C,j,M){return C.hasEdge(j,M)}function N(C,j,M){return M.low<=j.lim&&j.lim<=M.lim}return rv}var sv,ZE;function nB(){if(ZE)return sv;ZE=1;var e=Pu(),t=e.longestPath,n=GR(),s=tB();sv=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 sv}var ov,JE;function rB(){if(JE)return ov;JE=1;var e=xt();ov=t;function t(i){var a=s(i);e.forEach(i.graph().dummyChains,function(l){for(var u=i.node(l),h=u.edgeObj,p=n(i,a,h.v,h.w),f=p.path,g=p.lca,v=0,w=f[v],E=!0;l!==h.w;){if(u=i.node(l),E){for(;(w=f[v])!==g&&i.node(w).maxRank<u.rank;)v++;w===g&&(E=!1)}if(!E){for(;v<f.length-1&&i.node(w=f[v+1]).minRank<=u.rank;)v++;w=f[v]}i.setParent(l,w),l=i.successors(l)[0]}})}function n(i,a,l,u){var h=[],p=[],f=Math.min(a[l].low,a[u].low),g=Math.max(a[l].lim,a[u].lim),v,w;v=l;do v=i.parent(v),h.push(v);while(v&&(a[v].low>f||g>a[v].lim));for(w=v,v=u;(v=i.parent(v))!==w;)p.push(v);return{path:h.concat(p.reverse()),lca:w}}function s(i){var a={},l=0;function u(h){var p=l;e.forEach(i.children(h),u),a[h]={low:p,lim:l++}}return e.forEach(i.children(),u),a}return ov}var iv,eC;function sB(){if(eC)return iv;eC=1;var e=xt(),t=fn();iv={run:n,cleanup:l};function n(u){var h=t.addDummyNode(u,"root",{},"_root"),p=i(u),f=e.max(e.values(p))-1,g=2*f+1;u.graph().nestingRoot=h,e.forEach(u.edges(),function(w){u.edge(w).minlen*=g});var v=a(u)+1;e.forEach(u.children(),function(w){s(u,h,g,v,f,p,w)}),u.graph().nodeRankFactor=g}function s(u,h,p,f,g,v,w){var E=u.children(w);if(!E.length){w!==h&&u.setEdge(h,w,{weight:0,minlen:p});return}var b=t.addBorderNode(u,"_bt"),k=t.addBorderNode(u,"_bb"),S=u.node(w);u.setParent(b,w),S.borderTop=b,u.setParent(k,w),S.borderBottom=k,e.forEach(E,function(N){s(u,h,p,f,g,v,N);var C=u.node(N),j=C.borderTop?C.borderTop:N,M=C.borderBottom?C.borderBottom:N,P=C.borderTop?f:2*f,I=j!==M?1:g-v[w]+1;u.setEdge(b,j,{weight:P,minlen:I,nestingEdge:!0}),u.setEdge(M,k,{weight:P,minlen:I,nestingEdge:!0})}),u.parent(w)||u.setEdge(h,b,{weight:0,minlen:g+v[w]})}function i(u){var h={};function p(f,g){var v=u.children(f);v&&v.length&&e.forEach(v,function(w){p(w,g+1)}),h[f]=g}return e.forEach(u.children(),function(f){p(f,1)}),h}function a(u){return e.reduce(u.edges(),function(h,p){return h+u.edge(p).weight},0)}function l(u){var h=u.graph();u.removeNode(h.nestingRoot),delete h.nestingRoot,e.forEach(u.edges(),function(p){var f=u.edge(p);f.nestingEdge&&u.removeEdge(p)})}return iv}var av,tC;function oB(){if(tC)return av;tC=1;var e=xt(),t=fn();av=n;function n(i){function a(l){var u=i.children(l),h=i.node(l);if(u.length&&e.forEach(u,a),e.has(h,"minRank")){h.borderLeft=[],h.borderRight=[];for(var p=h.minRank,f=h.maxRank+1;p<f;++p)s(i,"borderLeft","_bl",l,h,p),s(i,"borderRight","_br",l,h,p)}}e.forEach(i.children(),a)}function s(i,a,l,u,h,p){var f={width:0,height:0,rank:p,borderType:a},g=h[a][p-1],v=t.addDummyNode(i,"border",f,l);h[a][p]=v,i.setParent(v,u),g&&i.setEdge(g,v,{weight:1})}return av}var lv,nC;function iB(){if(nC)return lv;nC=1;var e=xt();lv={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 lv}var cv,rC;function aB(){if(rC)return cv;rC=1;var e=xt();cv=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 cv}var uv,sC;function lB(){if(sC)return uv;sC=1;var e=xt();uv=t;function t(s,i){for(var a=0,l=1;l<i.length;++l)a+=n(s,i[l-1],i[l]);return a}function n(s,i,a){for(var l=e.zipObject(a,e.map(a,function(v,w){return w})),u=e.flatten(e.map(i,function(v){return e.sortBy(e.map(s.outEdges(v),function(w){return{pos:l[w.w],weight:s.edge(w).weight}}),"pos")}),!0),h=1;h<a.length;)h<<=1;var p=2*h-1;h-=1;var f=e.map(new Array(p),function(){return 0}),g=0;return e.forEach(u.forEach(function(v){var w=v.pos+h;f[w]+=v.weight;for(var E=0;w>0;)w%2&&(E+=f[w+1]),w=w-1>>1,f[w]+=v.weight;g+=v.weight*E})),g}return uv}var dv,oC;function cB(){if(oC)return dv;oC=1;var e=xt();dv=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 dv}var fv,iC;function uB(){if(iC)return fv;iC=1;var e=xt();fv=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 fv}var hv,aC;function dB(){if(aC)return hv;aC=1;var e=xt(),t=fn();hv=n;function n(a,l){var u=t.partition(a,function(b){return e.has(b,"barycenter")}),h=u.lhs,p=e.sortBy(u.rhs,function(b){return-b.i}),f=[],g=0,v=0,w=0;h.sort(i(!!l)),w=s(f,p,w),e.forEach(h,function(b){w+=b.vs.length,f.push(b.vs),g+=b.barycenter*b.weight,v+=b.weight,w=s(f,p,w)});var E={vs:e.flatten(f,!0)};return v&&(E.barycenter=g/v,E.weight=v),E}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 hv}var pv,lC;function fB(){if(lC)return pv;lC=1;var e=xt(),t=cB(),n=uB(),s=dB();pv=i;function i(u,h,p,f){var g=u.children(h),v=u.node(h),w=v?v.borderLeft:void 0,E=v?v.borderRight:void 0,b={};w&&(g=e.filter(g,function(M){return M!==w&&M!==E}));var k=t(u,g);e.forEach(k,function(M){if(u.children(M.v).length){var P=i(u,M.v,p,f);b[M.v]=P,e.has(P,"barycenter")&&l(M,P)}});var S=n(k,p);a(S,b);var N=s(S,f);if(w&&(N.vs=e.flatten([w,N.vs,E],!0),u.predecessors(w).length)){var C=u.node(u.predecessors(w)[0]),j=u.node(u.predecessors(E)[0]);e.has(N,"barycenter")||(N.barycenter=0,N.weight=0),N.barycenter=(N.barycenter*N.weight+C.order+j.order)/(N.weight+2),N.weight+=2}return N}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 pv}var mv,cC;function hB(){if(cC)return mv;cC=1;var e=xt(),t=ur().Graph;mv=n;function n(i,a,l){var u=s(i),h=new t({compound:!0}).setGraph({root:u}).setDefaultNodeLabel(function(p){return i.node(p)});return e.forEach(i.nodes(),function(p){var f=i.node(p),g=i.parent(p);(f.rank===a||f.minRank<=a&&a<=f.maxRank)&&(h.setNode(p),h.setParent(p,g||u),e.forEach(i[l](p),function(v){var w=v.v===p?v.w:v.v,E=h.edge(w,p),b=e.isUndefined(E)?0:E.weight;h.setEdge(w,p,{weight:i.edge(v).weight+b})}),e.has(f,"minRank")&&h.setNode(p,{borderLeft:f.borderLeft[a],borderRight:f.borderRight[a]}))}),h}function s(i){for(var a;i.hasNode(a=e.uniqueId("_root")););return a}return mv}var gv,uC;function pB(){if(uC)return gv;uC=1;var e=xt();gv=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 gv}var yv,dC;function mB(){if(dC)return yv;dC=1;var e=xt(),t=aB(),n=lB(),s=fB(),i=hB(),a=pB(),l=ur().Graph,u=fn();yv=h;function h(v){var w=u.maxRank(v),E=p(v,e.range(1,w+1),"inEdges"),b=p(v,e.range(w-1,-1,-1),"outEdges"),k=t(v);g(v,k);for(var S=Number.POSITIVE_INFINITY,N,C=0,j=0;j<4;++C,++j){f(C%2?E:b,C%4>=2),k=u.buildLayerMatrix(v);var M=n(v,k);M<S&&(j=0,N=e.cloneDeep(k),S=M)}g(v,N)}function p(v,w,E){return e.map(w,function(b){return i(v,b,E)})}function f(v,w){var E=new l;e.forEach(v,function(b){var k=b.graph().root,S=s(b,k,E,w);e.forEach(S.vs,function(N,C){b.node(N).order=C}),a(b,E,S.vs)})}function g(v,w){e.forEach(w,function(E){e.forEach(E,function(b,k){v.node(b).order=k})})}return yv}var vv,fC;function gB(){if(fC)return vv;fC=1;var e=xt(),t=ur().Graph,n=fn();vv={positionX:E,findType1Conflicts:s,findType2Conflicts:i,addConflict:l,hasConflict:u,verticalAlignment:h,horizontalCompaction:p,alignCoordinates:v,findSmallestWidthAlignment:g,balance:w};function s(S,N){var C={};function j(M,P){var I=0,D=0,O=M.length,A=e.last(P);return e.forEach(P,function(L,z){var K=a(S,L),R=K?S.node(K).order:O;(K||L===A)&&(e.forEach(P.slice(D,z+1),function(Q){e.forEach(S.predecessors(Q),function(H){var ne=S.node(H),X=ne.order;(X<I||R<X)&&!(ne.dummy&&S.node(Q).dummy)&&l(C,H,Q)})}),D=z+1,I=R)}),P}return e.reduce(N,j),C}function i(S,N){var C={};function j(P,I,D,O,A){var L;e.forEach(e.range(I,D),function(z){L=P[z],S.node(L).dummy&&e.forEach(S.predecessors(L),function(K){var R=S.node(K);R.dummy&&(R.order<O||R.order>A)&&l(C,K,L)})})}function M(P,I){var D=-1,O,A=0;return e.forEach(I,function(L,z){if(S.node(L).dummy==="border"){var K=S.predecessors(L);K.length&&(O=S.node(K[0]).order,j(I,A,z,D,O),A=z,D=O)}j(I,A,I.length,O,P.length)}),I}return e.reduce(N,M),C}function a(S,N){if(S.node(N).dummy)return e.find(S.predecessors(N),function(C){return S.node(C).dummy})}function l(S,N,C){if(N>C){var j=N;N=C,C=j}var M=S[N];M||(S[N]=M={}),M[C]=!0}function u(S,N,C){if(N>C){var j=N;N=C,C=j}return e.has(S[N],C)}function h(S,N,C,j){var M={},P={},I={};return e.forEach(N,function(D){e.forEach(D,function(O,A){M[O]=O,P[O]=O,I[O]=A})}),e.forEach(N,function(D){var O=-1;e.forEach(D,function(A){var L=j(A);if(L.length){L=e.sortBy(L,function(H){return I[H]});for(var z=(L.length-1)/2,K=Math.floor(z),R=Math.ceil(z);K<=R;++K){var Q=L[K];P[A]===A&&O<I[Q]&&!u(C,A,Q)&&(P[Q]=A,P[A]=M[A]=M[Q],O=I[Q])}}})}),{root:M,align:P}}function p(S,N,C,j,M){var P={},I=f(S,N,C,M),D=M?"borderLeft":"borderRight";function O(z,K){for(var R=I.nodes(),Q=R.pop(),H={};Q;)H[Q]?z(Q):(H[Q]=!0,R.push(Q),R=R.concat(K(Q))),Q=R.pop()}function A(z){P[z]=I.inEdges(z).reduce(function(K,R){return Math.max(K,P[R.v]+I.edge(R))},0)}function L(z){var K=I.outEdges(z).reduce(function(Q,H){return Math.min(Q,P[H.w]-I.edge(H))},Number.POSITIVE_INFINITY),R=S.node(z);K!==Number.POSITIVE_INFINITY&&R.borderType!==D&&(P[z]=Math.max(P[z],K))}return O(A,I.predecessors.bind(I)),O(L,I.successors.bind(I)),e.forEach(j,function(z){P[z]=P[C[z]]}),P}function f(S,N,C,j){var M=new t,P=S.graph(),I=b(P.nodesep,P.edgesep,j);return e.forEach(N,function(D){var O;e.forEach(D,function(A){var L=C[A];if(M.setNode(L),O){var z=C[O],K=M.edge(z,L);M.setEdge(z,L,Math.max(I(S,A,O),K||0))}O=A})}),M}function g(S,N){return e.minBy(e.values(N),function(C){var j=Number.NEGATIVE_INFINITY,M=Number.POSITIVE_INFINITY;return e.forIn(C,function(P,I){var D=k(S,I)/2;j=Math.max(P+D,j),M=Math.min(P-D,M)}),j-M})}function v(S,N){var C=e.values(N),j=e.min(C),M=e.max(C);e.forEach(["u","d"],function(P){e.forEach(["l","r"],function(I){var D=P+I,O=S[D],A;if(O!==N){var L=e.values(O);A=I==="l"?j-e.min(L):M-e.max(L),A&&(S[D]=e.mapValues(O,function(z){return z+A}))}})})}function w(S,N){return e.mapValues(S.ul,function(C,j){if(N)return S[N.toLowerCase()][j];var M=e.sortBy(e.map(S,j));return(M[1]+M[2])/2})}function E(S){var N=n.buildLayerMatrix(S),C=e.merge(s(S,N),i(S,N)),j={},M;e.forEach(["u","d"],function(I){M=I==="u"?N:e.values(N).reverse(),e.forEach(["l","r"],function(D){D==="r"&&(M=e.map(M,function(z){return e.values(z).reverse()}));var O=(I==="u"?S.predecessors:S.successors).bind(S),A=h(S,M,C,O),L=p(S,M,A.root,A.align,D==="r");D==="r"&&(L=e.mapValues(L,function(z){return-z})),j[I+D]=L})});var P=g(S,j);return v(j,P),w(j,S.graph().align)}function b(S,N,C){return function(j,M,P){var I=j.node(M),D=j.node(P),O=0,A;if(O+=I.width/2,e.has(I,"labelpos"))switch(I.labelpos.toLowerCase()){case"l":A=-I.width/2;break;case"r":A=I.width/2;break}if(A&&(O+=C?A:-A),A=0,O+=(I.dummy?N:S)/2,O+=(D.dummy?N:S)/2,O+=D.width/2,e.has(D,"labelpos"))switch(D.labelpos.toLowerCase()){case"l":A=D.width/2;break;case"r":A=-D.width/2;break}return A&&(O+=C?A:-A),A=0,O}}function k(S,N){return S.node(N).width}return vv}var wv,hC;function yB(){if(hC)return wv;hC=1;var e=xt(),t=fn(),n=gB().positionX;wv=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 wv}var xv,pC;function vB(){if(pC)return xv;pC=1;var e=xt(),t=Jz(),n=eB(),s=nB(),i=fn().normalizeRanks,a=rB(),l=fn().removeEmptyRanks,u=sB(),h=oB(),p=iB(),f=mB(),g=yB(),v=fn(),w=ur().Graph;xv=E;function E(G,F){var J=F&&F.debugTiming?v.time:v.notime;J("layout",function(){var V=J(" buildLayoutGraph",function(){return O(G)});J(" runLayout",function(){b(V,J)}),J(" updateInputGraph",function(){k(G,V)})})}function b(G,F){F(" makeSpaceForEdgeLabels",function(){A(G)}),F(" removeSelfEdges",function(){W(G)}),F(" acyclic",function(){t.run(G)}),F(" nestingGraph.run",function(){u.run(G)}),F(" rank",function(){s(v.asNonCompoundGraph(G))}),F(" injectEdgeLabelProxies",function(){L(G)}),F(" removeEmptyRanks",function(){l(G)}),F(" nestingGraph.cleanup",function(){u.cleanup(G)}),F(" normalizeRanks",function(){i(G)}),F(" assignRankMinMax",function(){z(G)}),F(" removeEdgeLabelProxies",function(){K(G)}),F(" normalize.run",function(){n.run(G)}),F(" parentDummyChains",function(){a(G)}),F(" addBorderSegments",function(){h(G)}),F(" order",function(){f(G)}),F(" insertSelfEdges",function(){ee(G)}),F(" adjustCoordinateSystem",function(){p.adjust(G)}),F(" position",function(){g(G)}),F(" positionSelfEdges",function(){$(G)}),F(" removeBorderNodes",function(){X(G)}),F(" normalize.undo",function(){n.undo(G)}),F(" fixupEdgeLabelCoords",function(){H(G)}),F(" undoCoordinateSystem",function(){p.undo(G)}),F(" translateGraph",function(){R(G)}),F(" assignNodeIntersects",function(){Q(G)}),F(" reversePoints",function(){ne(G)}),F(" acyclic.undo",function(){t.undo(G)})}function k(G,F){e.forEach(G.nodes(),function(J){var V=G.node(J),ae=F.node(J);V&&(V.x=ae.x,V.y=ae.y,F.children(J).length&&(V.width=ae.width,V.height=ae.height))}),e.forEach(G.edges(),function(J){var V=G.edge(J),ae=F.edge(J);V.points=ae.points,e.has(ae,"x")&&(V.x=ae.x,V.y=ae.y)}),G.graph().width=F.graph().width,G.graph().height=F.graph().height}var S=["nodesep","edgesep","ranksep","marginx","marginy"],N={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},C=["acyclicer","ranker","rankdir","align"],j=["width","height"],M={width:0,height:0},P=["minlen","weight","width","height","labeloffset"],I={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},D=["labelpos"];function O(G){var F=new w({multigraph:!0,compound:!0}),J=de(G.graph());return F.setGraph(e.merge({},N,Y(J,S),e.pick(J,C))),e.forEach(G.nodes(),function(V){var ae=de(G.node(V));F.setNode(V,e.defaults(Y(ae,j),M)),F.setParent(V,G.parent(V))}),e.forEach(G.edges(),function(V){var ae=de(G.edge(V));F.setEdge(V,e.merge({},I,Y(ae,P),e.pick(ae,D)))}),F}function A(G){var F=G.graph();F.ranksep/=2,e.forEach(G.edges(),function(J){var V=G.edge(J);V.minlen*=2,V.labelpos.toLowerCase()!=="c"&&(F.rankdir==="TB"||F.rankdir==="BT"?V.width+=V.labeloffset:V.height+=V.labeloffset)})}function L(G){e.forEach(G.edges(),function(F){var J=G.edge(F);if(J.width&&J.height){var V=G.node(F.v),ae=G.node(F.w),pe={rank:(ae.rank-V.rank)/2+V.rank,e:F};v.addDummyNode(G,"edge-proxy",pe,"_ep")}})}function z(G){var F=0;e.forEach(G.nodes(),function(J){var V=G.node(J);V.borderTop&&(V.minRank=G.node(V.borderTop).rank,V.maxRank=G.node(V.borderBottom).rank,F=e.max(F,V.maxRank))}),G.graph().maxRank=F}function K(G){e.forEach(G.nodes(),function(F){var J=G.node(F);J.dummy==="edge-proxy"&&(G.edge(J.e).labelRank=J.rank,G.removeNode(F))})}function R(G){var F=Number.POSITIVE_INFINITY,J=0,V=Number.POSITIVE_INFINITY,ae=0,pe=G.graph(),me=pe.marginx||0,ke=pe.marginy||0;function Ve(ze){var Oe=ze.x,Ne=ze.y,ce=ze.width,be=ze.height;F=Math.min(F,Oe-ce/2),J=Math.max(J,Oe+ce/2),V=Math.min(V,Ne-be/2),ae=Math.max(ae,Ne+be/2)}e.forEach(G.nodes(),function(ze){Ve(G.node(ze))}),e.forEach(G.edges(),function(ze){var Oe=G.edge(ze);e.has(Oe,"x")&&Ve(Oe)}),F-=me,V-=ke,e.forEach(G.nodes(),function(ze){var Oe=G.node(ze);Oe.x-=F,Oe.y-=V}),e.forEach(G.edges(),function(ze){var Oe=G.edge(ze);e.forEach(Oe.points,function(Ne){Ne.x-=F,Ne.y-=V}),e.has(Oe,"x")&&(Oe.x-=F),e.has(Oe,"y")&&(Oe.y-=V)}),pe.width=J-F+me,pe.height=ae-V+ke}function Q(G){e.forEach(G.edges(),function(F){var J=G.edge(F),V=G.node(F.v),ae=G.node(F.w),pe,me;J.points?(pe=J.points[0],me=J.points[J.points.length-1]):(J.points=[],pe=ae,me=V),J.points.unshift(v.intersectRect(V,pe)),J.points.push(v.intersectRect(ae,me))})}function H(G){e.forEach(G.edges(),function(F){var J=G.edge(F);if(e.has(J,"x"))switch((J.labelpos==="l"||J.labelpos==="r")&&(J.width-=J.labeloffset),J.labelpos){case"l":J.x-=J.width/2+J.labeloffset;break;case"r":J.x+=J.width/2+J.labeloffset;break}})}function ne(G){e.forEach(G.edges(),function(F){var J=G.edge(F);J.reversed&&J.points.reverse()})}function X(G){e.forEach(G.nodes(),function(F){if(G.children(F).length){var J=G.node(F),V=G.node(J.borderTop),ae=G.node(J.borderBottom),pe=G.node(e.last(J.borderLeft)),me=G.node(e.last(J.borderRight));J.width=Math.abs(me.x-pe.x),J.height=Math.abs(ae.y-V.y),J.x=pe.x+J.width/2,J.y=V.y+J.height/2}}),e.forEach(G.nodes(),function(F){G.node(F).dummy==="border"&&G.removeNode(F)})}function W(G){e.forEach(G.edges(),function(F){if(F.v===F.w){var J=G.node(F.v);J.selfEdges||(J.selfEdges=[]),J.selfEdges.push({e:F,label:G.edge(F)}),G.removeEdge(F)}})}function ee(G){var F=v.buildLayerMatrix(G);e.forEach(F,function(J){var V=0;e.forEach(J,function(ae,pe){var me=G.node(ae);me.order=pe+V,e.forEach(me.selfEdges,function(ke){v.addDummyNode(G,"selfedge",{width:ke.label.width,height:ke.label.height,rank:me.rank,order:pe+ ++V,e:ke.e,label:ke.label},"_se")}),delete me.selfEdges})})}function $(G){e.forEach(G.nodes(),function(F){var J=G.node(F);if(J.dummy==="selfedge"){var V=G.node(J.e.v),ae=V.x+V.width/2,pe=V.y,me=J.x-ae,ke=V.height/2;G.setEdge(J.e,J.label),G.removeNode(F),J.label.points=[{x:ae+2*me/3,y:pe-ke},{x:ae+5*me/6,y:pe-ke},{x:ae+me,y:pe},{x:ae+5*me/6,y:pe+ke},{x:ae+2*me/3,y:pe+ke}],J.label.x=J.x,J.label.y=J.y}})}function Y(G,F){return e.mapValues(e.pick(G,F),Number)}function de(G){var F={};return e.forEach(G,function(J,V){F[V.toLowerCase()]=J}),F}return xv}var bv,mC;function wB(){if(mC)return bv;mC=1;var e=xt(),t=fn(),n=ur().Graph;bv={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 bv}var kv,gC;function xB(){return gC||(gC=1,kv="0.8.5"),kv}var _v,yC;function bB(){return yC||(yC=1,_v={graphlib:ur(),layout:vB(),debug:wB(),util:{time:fn().time,notime:fn().notime},version:xB()}),_v}var kB=bB();const vC=cw(kB),Qi=240,$u=130,Bi=74,fd=72,wC=Bi+fd;function _B(e,t){var s;let n=Qi;for(const i of e)n=Math.max(n,((s=t.get(i.id))==null?void 0:s.width)??Qi);return n}const VR=420,SB=2;function bl(e){var n;return((n=e.data)==null?void 0:n.sessionId)??"_default"}function NB(e,t){return((t==null?void 0:t.get(e))??0)>0?VR:0}function EB(e,t){const n=(t==null?void 0:t.get(e))??0;return n>0?6+n*36:0}function kl(e,t,n){const s=t.get(e);return{w:((s==null?void 0:s.width)??Qi)+NB(e,n),h:Math.max((s==null?void 0:s.height)??$u,EB(e,n))}}function CB(e){return[...e.keys()].sort().map(t=>`${t}:${e.get(t)}`).join("|")}function jB(e,t,n,s,i,a){const l=new vC.graphlib.Graph;l.setDefaultEdgeLabel(()=>({})),l.setGraph({rankdir:n,marginx:0,marginy:0,nodesep:70,ranksep:160,edgesep:30});const u=e.filter(S=>!i.has(S)),h=new Set(u);for(const S of u){const{w:N,h:C}=kl(S,s,a);l.setNode(S,{width:N,height:C})}for(const S of t)h.has(S.source)&&h.has(S.target)&&l.setEdge(S.source,S.target);vC.layout(l);const p=new Map;let f=1/0,g=1/0,v=-1/0,w=-1/0;for(const S of u){const N=l.node(S);if(!N)continue;const C=s.get(S),j=(C==null?void 0:C.width)??Qi,M=(C==null?void 0:C.height)??$u,P=kl(S,s,a),I=N.x-P.w/2,D=N.y-P.h/2;p.set(S,{x:I,y:D}),I<f&&(f=I),D<g&&(g=D),I+j>v&&(v=I+j),D+M>w&&(w=D+M)}if(Number.isFinite(f)&&Number.isFinite(g))for(const[S,N]of p)p.set(S,{x:N.x-f,y:N.y-g});const E=Number.isFinite(v)?v-f:0,b=Number.isFinite(w)?w-g:0;let k=null;for(const S of e){const N=i.get(S);if(!N)continue;const C=s.get(S),j=(C==null?void 0:C.width)??Qi,M=(C==null?void 0:C.height)??$u;k=k===null?{minX:N.x,minY:N.y,maxX:N.x+j,maxY:N.y+M}:{minX:Math.min(k.minX,N.x),minY:Math.min(k.minY,N.y),maxX:Math.max(k.maxX,N.x+j),maxY:Math.max(k.maxY,N.y+M)}}return{positions:p,width:E,height:b,pinnedBox:k}}function TB(e,t,n={}){const s=n.direction??"LR",i=n.pinned??new Map,a=n.measured??new Map,l=n.lanes,u=new Map;for(const S of e){const N=bl(S),C=u.get(N);C?C.push(S.id):u.set(N,[S.id])}const p=Array.from(u.keys()).sort().map(S=>({sid:S,...jB(u.get(S),t,s,a,i,l)})),f=_B(e,a),g=n.availableHeight&&n.availableHeight>0?n.availableHeight:Number.POSITIVE_INFINITY,v=S=>{const N=[[]];let C=0;for(const j of p)N.length<S&&C>0&&C+j.height>g&&(N.push([]),C=0),N[N.length-1].push(j),C+=j.height+wC;return N},w=S=>S.reduce((N,C)=>Math.max(N,C.width),0)+VR;let E=v(n.availableWidth?SB:1);E.length>1&&E.reduce((N,C)=>N+w(C),0)+f*(E.length-1)>(n.availableWidth??0)&&(E=v(1));const b=new Map;let k=0;for(const S of E){const N=w(S);let C=0;for(const{positions:j,height:M,pinnedBox:P}of S){for(const[D,O]of j)b.set(D,{x:O.x+k,y:O.y+C});let I=C+M;P&&P.maxY>I&&P.minX<k+N&&k<P.maxX&&(I=P.maxY),C=I+wC}k+=N+f}return e.map(S=>{const N=i.get(S.id);if(N)return{...S,position:N};const C=b.get(S.id);return C?{...S,position:C}:S})}function RB(e,t,n,s,i){const l=Bi+fd,u=60,h=w=>kl(w,s,i),p=new Map(e.map(w=>[w.id,bl(w)])),f=[],g=e.map(w=>({id:w.id,pos:n.get(w.id)??t.get(w.id)})).filter(w=>w.pos!=null).sort((w,E)=>w.pos.y-E.pos.y||w.pos.x-E.pos.x||w.id.localeCompare(E.id)),v=[];for(const{id:w,pos:E}of g){const{w:b,h:k}=h(w),S=p.get(w)??"_default";if(n.has(w)){f.push({x:E.x,y:E.y,w:b,h:k,sid:S});continue}let N=E.y;for(let C=0;C<f.length+1;C++){const j=f.find(M=>{const P=M.sid===S?24:u,I=M.sid===S?24:l;return E.x<M.x+M.w+P&&M.x<E.x+b+P&&N<M.y+M.h+I&&M.y<N+k+I});if(!j)break;N=j.y+j.h+(j.sid===S?24:l)}N!==E.y&&(t.set(w,{x:E.x,y:N}),v.push(w)),f.push({x:E.x,y:N,w:b,h:k,sid:S})}return v}function AB(e,t,n,s,i,a){const l=b=>kl(b,s,a),u=b=>n.get(b)??t.get(b),h=new Map;for(const b of e){if(!u(b.id))continue;const k=bl(b),S=h.get(k);S?S.push(b):h.set(k,[b])}const p=new Set;for(const[b,k]of h)k.every(S=>i.has(S.id)&&!n.has(S.id))&&p.add(b);const f=new Map,g=[];for(const b of e){const k=u(b.id);if(!k)continue;const{w:S,h:N}=l(b.id),C=bl(b);p.has(C)?(f.get(C)??f.set(C,[]).get(C)).push(b):g.push({x:k.x,y:k.y,w:S,h:N})}if(f.size===0)return[];const v=Bi+fd,w=(b,k,S,N)=>g.some(C=>b<C.x+C.w+Bi&&C.x<b+S+Bi&&k<C.y+C.h+v&&C.y<k+N+v),E=[];for(const b of[...f.keys()].sort()){const k=f.get(b);let S=1/0,N=1/0,C=-1/0,j=-1/0;for(const L of k){const z=u(L.id),{w:K,h:R}=l(L.id);S=Math.min(S,z.x),N=Math.min(N,z.y),C=Math.max(C,z.x+K),j=Math.max(j,z.y+R)}const M=C-S,P=j-N,I=[...new Set(g.map(L=>Math.round(L.x)))].sort((L,z)=>L-z),D=I.length?I:[S],O=[0,...g.map(L=>L.y+L.h+v)].sort((L,z)=>L-z);let A=null;e:for(const L of D)for(const z of O){if(z>=N)break;if(!w(L,z,M,P)){A={x:L,y:z};break e}}if(A){const L=A.x-S,z=A.y-N;for(const K of k){const R=u(K.id);t.set(K.id,{x:R.x+L,y:R.y+z})}E.push(b)}for(const L of k){const z=u(L.id),{w:K,h:R}=l(L.id);g.push({x:z.x,y:z.y,w:K,h:R})}}return E}function MB(e,t,n,s,i,a=!1,l){const p=Bi+fd+1,f=8,g=1.75,v=200,w=.7,E=.01,b=A=>kl(A,s,l),k=A=>n.get(A)??t.get(A),S=new Map;for(const A of e){if(!k(A.id))continue;const L=bl(A),z=S.get(L);z?z.push(A):S.set(L,[A])}const N=[],C=new Set,j=new Set,M=i.size===0;for(const A of[...S.keys()].sort()){const L=S.get(A);let z=1/0,K=1/0,R=-1/0,Q=-1/0,H=!1;for(const ee of L){const $=k(ee.id),{w:Y,h:de}=b(ee.id);z=Math.min(z,$.x),K=Math.min(K,$.y),R=Math.max(R,$.x+Y),Q=Math.max(Q,$.y+de),n.has(ee.id)&&(H=!0)}const ne=R-z,X=Q-K;j.add(A);const W=i.get(A);W&&(ne>W.w+f||X>W.h+f)&&C.add(A),i.set(A,{w:ne,h:X}),N.push({sid:A,members:L.map(ee=>ee.id),x:z,y:K,w:ne,h:X,anchored:H,mass:1})}for(const A of[...i.keys()])j.has(A)||i.delete(A);if(a||M)return[];let P=!1;for(let A=0;A<N.length&&!P;A++)for(let L=A+1;L<N.length;L++){const z=N[A],K=N[L];if(!(z.anchored&&K.anchored)&&Math.abs(z.x+z.w/2-(K.x+K.w/2))<(z.w+K.w)/2+61&&Math.abs(z.y+z.h/2-(K.y+K.h/2))<(z.h+K.h)/2+p){P=!0;break}}if(C.size===0&&!P)return[];if(C.size>0)for(const A of N)C.has(A.sid)&&(A.mass=8);else for(const A of N)A.mass=Math.max(1,A.w*A.h/(Qi*$u));const I=new Map(N.map(A=>[A.sid,A.x])),D=new Map(N.map(A=>[A.sid,A.y]));for(let A=0;A<v;A++){const L=new Map,z=new Map;let K=0;for(let R=0;R<N.length;R++)for(let Q=R+1;Q<N.length;Q++){const H=N[R],ne=N[Q];if(H.anchored&&ne.anchored)continue;const X=H.x+H.w/2,W=H.y+H.h/2,ee=ne.x+ne.w/2,$=ne.y+ne.h/2,Y=(H.w+ne.w)/2+61-Math.abs(X-ee),de=(H.h+ne.h)/2+p-Math.abs(W-$);if(Y<=0||de<=0)continue;const G=(Ge,Je)=>!Ge.anchored&&!(Je<0&&Ge.x<=0),F=(Ge,Je)=>!Ge.anchored&&!(Je<0&&Ge.y<=0),J=(Ge,Je,qe)=>{const Ye=Ge===Je,Te=Ye?H.sid<ne.sid?-1:1:Math.sign(Ge-Je);return qe(H,Te)||qe(ne,-Te)?Te:Ye&&(qe(H,-Te)||qe(ne,Te))?-Te:0},V=J(X,ee,G),ae=J(W,$,F),pe=V!==0,me=ae!==0;if(!pe&&!me)continue;const ke=pe&&(!me||Y*g<de),[Ve,ze,Oe,Ne]=ke?[V,Y,L,G]:[ae,de,z,F],ce=Ne(H,Ve),be=Ne(ne,-Ve),xe=H.mass,he=ne.mass,Pe=ce?be?he/(xe+he):1:0,Be=be?ce?xe/(xe+he):1:0,Ze=ze*w;Oe.set(H.sid,(Oe.get(H.sid)??0)+Ve*Ze*Pe),Oe.set(ne.sid,(Oe.get(ne.sid)??0)-Ve*Ze*Be),K+=Ze}for(const R of N)R.anchored||(R.x=Math.max(0,R.x+(L.get(R.sid)??0)),R.y=Math.max(0,R.y+(z.get(R.sid)??0)));if(K<E)break}const O=[];for(const A of N){const L=A.x-I.get(A.sid),z=A.y-D.get(A.sid);if(!(Math.abs(L)<1&&Math.abs(z)<1)){for(const K of A.members){if(n.has(K))continue;const R=t.get(K);R&&t.set(K,{x:R.x+L,y:R.y+z})}O.push(A.sid)}}return O}const IB=600;function ow(e,t){return!(e.exitAt!=null&&t-e.exitAt>IB||e.kind==="root"&&e.state==="done"&&e.tools.length===0&&e.endedAt!=null&&e.endedAt-e.startedAt<3e3)}function OB(e,t){const n=new Set;for(const s of e.agents.values())ow(s,t)&&n.add(s.id);return n}function PB(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 $B(e,t,n=0){if(!e)return!1;for(const s of t)if(PB(e,s,n))return!0;return!1}const YR="sessionGroup";function LB(e,t){var s;if(e.type===YR)return"transparent";const n=(s=e.data)==null?void 0:s.state;return t(n==="err"?"--err":n==="active"?"--inflight":"--ok")}const KR=["--err","--inflight","--ok","--grid-line","--minimap-mask","--panel","--line","--accent","--text-dim","--bg"];function xC(e){const t={};for(const n of KR)t[n]=e(n);return t}function qB(e){return t=>e[t]??""}function DB(e,t){return KR.every(n=>e[n]===t[n])}function FB(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 zB=1200,BB=1e3;function bC(e){return e.lastDeckFitAt>0&&e.at-e.lastDeckFitAt<zB?!1:e.hasSourceEvent?!0:e.lastCanvasInputAt>0&&e.at-e.lastCanvasInputAt<BB}function Sv({durationMs:e,documentHidden:t}){return t?!1:Number.isFinite(e)&&e>0}function UB(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 WB({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,UB(i,t,e))return!1;return s}const HB="Update checks are off (AGENTS_DECK_NO_UPDATE_CHECK=1)",Nv="click for what's new";function GB(e){if(e.checkDisabled)return`${HB} · ${Nv}`;if(e.checking)return`Asking npm for the newest release… · ${Nv}`;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 · ${Nv}, and to check npm now`}function VB(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 YB(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 XR(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 iw={kind:"assumed",claude:!0,codex:!0};function KB(e){if(!e||typeof e!="object")return iw;const t=e.providers;if(!t||typeof t!="object")return iw;const n=t;return{kind:"reported",claude:n.claude!==!1,codex:n.codex!==!1}}function Lu(e){const t=Math.max(0,Math.floor(e));return`${t} event${t===1?"":"s"}`}const kC=99;function XB(e){const t=Math.max(0,Math.floor(e));return t>kC?`${kC}+`:String(t)}const QB="Pause the canvas";function ZB(e){if(!e.paused)return"Pause live updates — events keep arriving and are applied when you resume (Space)";const t=Math.max(0,Math.floor(e.dropped??0));return t>0?`The pause is full — ${Lu(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)":`${Lu(e.held)} arrived while paused and will be applied in order when you resume (Space)`}function JB(e){return e.connected||!e.paused?null:"The canvas is paused as well — Space resumes it, but nothing new arrives until the stream is back."}const QR="paused · full",e8=(e,t)=>t>0?QR:e>0?`paused · ${XB(e)}`:"paused";function t8(e){const t=Math.max(0,Math.floor(e.dropped??0));return e.connected?e.paused?{tone:"paused",resting:!1,label:e8(e.held,t),widest:QR,title:t>0?`Connected — the pause is full at ${Lu(e.held)}; the oldest are being dropped as new ones arrive. Resume to catch up (Space)`:e.held>0?`Connected — ${Lu(e.held)} held until you resume (Space)`:"Connected — updates held until you resume (Space)"}:{tone:"live",resting:!0,label:"live",widest:"live",title:"Receiving events"}:{tone:"dead",resting:!1,label:"offline",widest:"offline",title:e.paused?"SSE disconnected — and the canvas is paused, so resuming will not bring events back until it reconnects":"SSE disconnected"}}function _C(e){return typeof window>"u"?"":getComputedStyle(document.documentElement).getPropertyValue(e).trim()||""}const n8={agent:g3,sessionGroup:I3},ZR="react-flow__node";function SC(e){var t,n;return!!e&&((n=(t=e.classList)==null?void 0:t.contains)==null?void 0:n.call(t,ZR))===!0}function r8(e){try{const t=document.querySelector(`.${ZR}[data-id="${CSS.escape(e)}"]`);t==null||t.focus({preventScroll:!0})}catch{}}const s8=["a[href]","button:not(:disabled)","input:not(:disabled)","select:not(:disabled)","textarea:not(:disabled)","summary","[tabindex]"].join(","),o8=420,mu=18,i8=200,a8=5*6e4,l8=6,c8=2*6e4,NC=400,i0="agent-dag.layout",a0="agent-dag.viewport",JR="agent-dag.summariesDismissed",eA="agent-dag.sessionListOpen",tA="agent-dag.detailOpen",nA="agent-dag.usagePanelOpen",EC="agent-dag.accountsPanelOpen",Ev="agent-dag.versionNoticeDismissed",CC="agent-dag.oldNameNoticeDismissed",u8=15*6e4,Cv={git_checkout:"this deck runs from a git checkout — pull instead:",npx:"npx runs from a cache that cannot be upgraded in place — run:",not_writable:"the install directory is not writable by this user — run:",opted_out:"installs are off (AGENTS_DECK_NO_INSTALL=1) — run:"},jC="agent-dag.autoRestart",TC="agent-dag.bundleReloadedFor";function d8(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(eA)==="1"}catch{return!1}}function f8(e){if(!(typeof window>"u"))try{window.localStorage.setItem(eA,e?"1":"0")}catch{}}function h8(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(tA)==="1"}catch{return!1}}function p8(e){if(!(typeof window>"u"))try{window.localStorage.setItem(tA,e?"1":"0")}catch{}}function m8(){const e=Vu(nA);return e===null?!0:e==="1"}function g8(e){if(!(typeof window>"u"))try{window.localStorage.setItem(nA,e?"1":"0")}catch{}}function y8(){if(typeof window>"u")return new Set;try{const e=window.localStorage.getItem(JR);if(!e)return new Set;const t=JSON.parse(e);return new Set(Array.isArray(t)?t.filter(n=>typeof n=="string"):[])}catch{return new Set}}function RC(e){if(!(typeof window>"u"))try{const t=Array.from(e),n=t.length>200?t.slice(-200):t;window.localStorage.setItem(JR,JSON.stringify(n))}catch{}}function v8(){const e={positions:[],pins:[]};if(typeof window>"u")return e;try{const t=window.localStorage.getItem(i0);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 jv(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(i0,JSON.stringify({v:2,positions:n,pins:Array.from(t.keys())}))}catch{}}function w8(){if(typeof window>"u")return null;try{const e=window.localStorage.getItem(a0);if(!e)return null;const t=JSON.parse(e);return typeof(t==null?void 0:t.x)!="number"||typeof(t==null?void 0:t.y)!="number"||typeof(t==null?void 0:t.zoom)!="number"?null:t}catch{return null}}function x8(e){if(!(typeof window>"u"))try{window.localStorage.setItem(a0,JSON.stringify(e))}catch{}}function AC(){if(!(typeof window>"u")){try{window.localStorage.removeItem(i0)}catch{}try{window.localStorage.removeItem(a0)}catch{}}}function b8(e,t){const n=e.agents.get(t);if(!n)return;const s=[];for(const f of e.agents.values())f.sessionId===t&&s.push(f);const i={schemaVersion:1,exportedAt:new Date().toISOString(),sessionId:t,label:n.label,cwd:n.cwd,startedAt:n.startedAt,endedAt:n.endedAt,model:n.model,agents:s.map(f=>({id:f.id,kind:f.kind,label:f.label,parentId:f.parentId,state:f.state,startedAt:f.startedAt,endedAt:f.endedAt,model:f.model,cwd:f.cwd,usage:f.usage,prompts:f.prompts,tools:f.tools.map(g=>({id:g.id,name:g.name,inputPreview:g.inputPreview,startedAt:g.startedAt,endedAt:g.endedAt,ok:g.ok,errorPreview:g.errorPreview,usage:g.usage}))}))},a=JSON.stringify(i,null,2),l=new Blob([a],{type:"application/json"}),u=URL.createObjectURL(l),h=document.createElement("a"),p=(n.label||"session").replace(/[^a-z0-9._-]/gi,"_");h.href=u,h.download=`${Bt}-${p}-${t.slice(0,8)}.json`,document.body.appendChild(h),h.click(),document.body.removeChild(h),setTimeout(()=>URL.revokeObjectURL(u),1e3)}const aw={file:"📁",shell:"⚡",web:"🌐",agent:"🤖",task:"📋",plan:"🧭",mcp:"🔌",other:"✨"},lw={file:"file",shell:"shell",web:"web",agent:"agent",task:"task",plan:"plan",mcp:"mcp",other:"other"},rA=vT;function k8(e,t,n,s,i,a,l,u,h,p,f,g,v,w,E,b,k,S){const N=[],C=[];for(const A of e.agents.values()){if(!k.has(A.id))continue;const L=A.exitAt!=null,z=b!=null&&!b.has(A.id),K=[L?"rf-exiting":"",z?"rf-spotlit-out":""].filter(Boolean).join(" ")||void 0,R=a.get(A.id);if(N.push({id:A.id,type:"agent",position:{x:0,y:0},data:{...A,now:t,onOpenContext:S},className:K,...R?{width:R.width,height:R.height}:null}),A.parentId&&k.has(A.parentId)){const Q=Tw(A.sessionId),H=L,ne=E.size>0&&(E.has(A.id)||E.has(A.parentId)),X=b!=null&&!b.has(A.id)&&!b.has(A.parentId),W=A.state==="active"?2:1.5,ee=ne?W+1.5:W,$=H?.2:X?.12:1,Y=["sess-edge",A.state==="active"?"sess-live":"sess-idle",H?"rf-edge-exiting":"",ne?"rf-edge-selected":""].filter(Boolean).join(" ");C.push({id:`e:${A.parentId}->${A.id}`,source:A.parentId,target:A.id,animated:(A.state==="active"||ne)&&!H,type:"smoothstep",style:{"--session-hue":Q,strokeWidth:ee,opacity:$,transition:"var(--edge-transition)"},className:Y})}}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 M=`${v}#lanes:${CB(j)}`,P=N.filter(A=>k5(A.id,i,f,g));if(P.length>0||M!==w.current){if(P.length>0){const A=TB(N,C,{direction:"LR",pinned:i,measured:a,availableWidth:n,availableHeight:s,lanes:j});for(const L of A)WT(L.id,f,g)&&S5(L.id,L.position,f,g);AB(N,f,i,a,new Set(P.map(L=>L.id)),j)}RB(N,f,i,a,j),w.current=M}const I=MB(N,f,i,a,l,!h||p,j);I.length>0&&u(I),cu(f,e.agents),cu(g,e.agents),cu(i,e.agents),cu(a,w5(e.agents.values()));const D=[];let O=!1;for(const A of N){let L=i.get(A.id)??f.get(A.id);L||(L=_5(A.id,f,g),O=!0),D.push({...A,position:L})}return O&&(w.current=""),{nodes:D,edges:C}}function _8(){return d.jsx(Cw,{children:d.jsx(S8,{})})}function S8(){var ps,ka,_a,Sa;const e=Cl(),t=Mt(),n=_.useState(Hv)[0],s=_.useRef(n),[,i]=_.useState(0),a=_.useCallback(()=>i(q=>q+1),[]),[l,u]=_.useState(()=>new Set),[h,p]=_.useState(null),[f,g]=_.useState(null),v=_.useCallback((q,B)=>{u(ie=>{if(!B)return new Set([q]);const ue=new Set(ie);return ue.has(q)?ue.delete(q):ue.add(q),ue}),p(ie=>B&&ie===q?ie:q)},[]),w=_.useCallback(()=>{u(new Set),p(null)},[]),[E,b]=_.useState(null),[k,S]=_.useState(null),N=_.useCallback(q=>S(q),[]),[C,j]=_.useState(!1),[M,P]=_.useState(!1),I=_.useState(y8)[0],[D,O]=_.useState(d8);_.useEffect(()=>{f8(D)},[D]);const[A,L]=_.useState(h8);_.useEffect(()=>{p8(A)},[A]);const[z,K]=_.useState(m8);_.useEffect(()=>{g8(z)},[z]);const[R,Q]=_.useState(()=>{try{const q=window.localStorage.getItem(EC);return q===null?!0:q==="1"}catch{return!0}});_.useEffect(()=>{try{window.localStorage.setItem(EC,R?"1":"0")}catch{}},[R]);const[H,ne]=_.useState(null);_.useEffect(()=>{let q=null;try{q=localStorage.getItem("agent-dag.sound")}catch{}ne(q===null?!0:q==="on")},[]);const X=_.useCallback(()=>{ne(q=>{var ie;const B=q!==!0;try{localStorage.setItem("agent-dag.sound",B?"on":"off")}catch{}return B&&((ie=ke.current)==null||ie.unlock()),B})},[]),W=_.useCallback(q=>{X()},[X]),ee=_.useRef(W);ee.current=W;const $=_.useRef(H);$.current=H;const[Y,de]=_.useState(()=>GD(Vu)),G=_.useRef(Y);G.current=Y;const F=_.useRef(null),J=_.useCallback((q,B=!1)=>{var ie,ue;if((ie=ke.current)==null||ie.unlock(),F.current!==null&&clearTimeout(F.current),F.current=null,!B){(ue=ke.current)==null||ue.play(q,!0);return}F.current=setTimeout(()=>{var _e;F.current=null,(_e=ke.current)==null||_e.play(q,!0)},zD)},[]),V=_.useCallback((q,B)=>{de(ie=>{const ue={level:xl(B.level??ie[q].level),figure:DT(q,B.figure??ie[q].figure)};try{localStorage.setItem(zT[q],String(ue.level)),localStorage.setItem(BT[q],ue.figure)}catch{}return{...ie,[q]:ue}}),J(q,!0)},[J]);_.useEffect(()=>()=>{F.current!==null&&clearTimeout(F.current)},[]);const[ae,pe]=_.useState(!1),me=_.useRef(null),ke=_.useRef(null),[Ve,ze]=_.useState("locked");_.useEffect(()=>{const q=KD({enabled:()=>$.current===!0,prefs:()=>G.current,onState:ze});ke.current=q,ze(q.state());const B=()=>q.unlock();return window.addEventListener("pointerdown",B,{once:!0,capture:!0}),window.addEventListener("keydown",B,{once:!0,capture:!0}),()=>{window.removeEventListener("pointerdown",B,{capture:!0}),window.removeEventListener("keydown",B,{capture:!0})}},[]);const[Oe,Ne]=_.useState(!1),[ce,be]=_.useState(null),[xe,he]=_.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(Ev)??""}catch{return""}}),[Pe,Be]=_.useState(!1),Ze=_.useRef(0),[Ge,Je]=_.useState(!1),qe=_.useCallback((q=!1)=>(q&&(Ze.current=Date.now(),Je(!0)),fetch(q?"/api/version?refresh=1":"/api/version").then(B=>B.ok?B.json():null).then(B=>{B&&be(B)}).catch(()=>{}).finally(()=>{q&&Je(!1)})),[]),Ye=_.useCallback(()=>{qe(Date.now()-Ze.current>=u8)},[qe]);_.useEffect(()=>{qe();const q=window.setInterval(Ye,5*6e4),B=()=>{document.visibilityState==="visible"&&Ye()};return document.addEventListener("visibilitychange",B),()=>{window.clearInterval(q),document.removeEventListener("visibilitychange",B)}},[qe,Ye]),_.useEffect(()=>{Oe&&qe()},[Oe,qe]);const Te=(ce==null?void 0:ce.notice)??null,[et,it]=_.useState(null),oe=_.useRef(!1);_.useEffect(()=>{if(oe.current)return;const q=i5(),B=a5(q),ie=u5({stored:B,running:(ce==null?void 0:ce.running)??null,notes:H1,remembers:l5(q)});ie.reason!=="no-version"&&(oe.current=!0,ie.record&&c5(q,ie.record),ie.show.length&&it({entries:ie.show,since:B,firstRun:ie.reason==="welcome"}))},[ce==null?void 0:ce.running]);const Le=(ce==null?void 0:ce.running)??"3.9.0",Ue=_.useMemo(()=>UT(H1,null,Le),[Le]),Ce=_.useCallback(()=>{it({entries:Ue,since:null,firstRun:!1})},[Ue]),[Ke,jt]=_.useState(null),[at,Re]=_.useState(iw);_.useEffect(()=>{let q=!1;return fetch("/api/health").then(B=>B.ok?B.json():null).then(B=>{q||(Re(KB(B)),!(!B||typeof B.workspace!="string")&&jt(B.workspace))}).catch(()=>{}),()=>{q=!0}},[Oe]);const bt=_.useRef(at);bt.current=at;const ft=Te?`${Te.kind}:${Te.to}`:"",yt=Te!=null&&xe!==ft,Sn=_.useCallback(()=>{he("");try{window.localStorage.setItem(Ev,"")}catch{}},[]),zn=_.useCallback(()=>{if(Te){he(ft);try{window.localStorage.setItem(Ev,ft)}catch{}}},[Te,ft]),[Nn,To]=_.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(CC)??""}catch{return""}}),hn=ce!=null&&ce.invokedAs&&ce.invokedAs!==Bt?ce.invokedAs:null,Ro=hn!=null&&Nn!==hn,Ao=_.useCallback(()=>{if(hn){To(hn);try{window.localStorage.setItem(CC,hn)}catch{}}},[hn]),Ut=((ps=ce==null?void 0:ce.upgrade)==null?void 0:ps.state)??"idle",Tr=_D(ce==null?void 0:ce.upgrade),Bn=_.useRef(!1),Ds=_.useCallback(async()=>{if(lr(Bn.current||Ut==="running")){Bn.current=!0;try{await fetch("/api/upgrade",{method:"POST"})}catch{}await qe(),Bn.current=!1}},[Ut,qe]);_.useEffect(()=>{if(Ut!=="running")return;const q=window.setInterval(qe,3e3);return()=>window.clearInterval(q)},[Ut,qe]);const Rr=_.useCallback(async()=>{var ie;const q=ce==null?void 0:ce.command;if(!q)return;let B=!1;try{B=await Promise.race([((ie=navigator.clipboard)==null?void 0:ie.writeText(q).then(()=>!0))??Promise.resolve(!1),new Promise(ue=>window.setTimeout(()=>ue(!1),500))])}catch{B=!1}if(!B)try{const ue=document.createElement("textarea");ue.value=q,ue.setAttribute("readonly",""),ue.style.cssText="position:fixed;top:0;left:0;opacity:0",document.body.appendChild(ue),ue.select(),B=document.execCommand("copy"),ue.remove()}catch{B=!1}B&&(Be(!0),window.setTimeout(()=>Be(!1),1600))},[ce==null?void 0:ce.command]),Mo=_.useCallback(()=>{O(q=>(q||Q(!1),!q))},[]),hr=_.useCallback(()=>{Q(q=>(q||O(!1),!q))},[]),[Ar,pr]=_.useState(!1),[ns,Io]=_.useState(!1),[Oo,Po]=_.useState(()=>{try{return Number(localStorage.getItem(K1))||0}catch{return 0}}),[En,$o]=_.useState([]),[Mr,Lo]=_.useState(!1);_.useEffect(()=>{let q=!0;const B=()=>{fetch("/api/browser-watch?live=0").then(ue=>ue.ok?ue.json():null).then(ue=>{var _e;!q||!(ue!=null&&ue.ok)||($o(ue.episodes??[]),Lo(((_e=ue.settings)==null?void 0:_e.enabled)===!0))}).catch(()=>{})};B();const ie=setInterval(B,5*6e4);return()=>{q=!1,clearInterval(ie)}},[]);const Un=_.useMemo(()=>Z5(En,Oo).length,[En,Oo]),[qo,Fs]=_.useState(0),zs=_.useRef(null),[Do,Fo]=_.useState(!1),ct=_.useRef(null),[sa,rs]=_.useState(0),Vt=_.useState(()=>T5({protect:q=>bL(s.current,q)}))[0],[Wn,zo]=_.useState(!1),ss=_.useCallback(()=>{const q=Vt.paused&&Vt.dropped>0,B=Vt.setPaused(!Vt.paused);q&&kL(s.current);for(const ie of B)s.current=e1(s.current,ie);zo(Vt.paused)},[Vt]),[kt,rn]=_.useState(Date.now()),[Hn,pn]=_.useState(()=>{if(typeof window>"u")return!0;try{return window.localStorage.getItem(jC)!=="0"}catch{return!0}}),hd=_.useCallback(()=>{pn(q=>{const B=!q;try{window.localStorage.setItem(jC,B?"1":"0")}catch{}return B})},[]),[Ir,Bo]=_.useState(!1),[Uo,Wo]=_.useState("restart"),[os,Bs]=_.useState(null),is=_.useRef(!1),Dl=_.useRef(null),Ho=_.useRef(0),Us=_.useCallback(async q=>{if(!lr(is.current))return;const B=(q==null?void 0:q.upgrade)===!0;is.current=!0,Dl.current=Tr;const ie=++Ho.current;Wo(B?"npx":"restart"),Bo(!0);try{window.sessionStorage.setItem("agent-dag.restartPending",(Te==null?void 0:Te.to)??"")}catch{}try{await fetch("/api/restart",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({upgrade:B})})}catch{}window.setTimeout(()=>{if(Ho.current===ie&&is.current){is.current=!1,Bo(!1);try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}}},B?18e4:3e4)},[Te==null?void 0:Te.to,Tr]),Go=_.useRef(null);_.useEffect(()=>{let q=!1;for(const ie of s.current.agents.values())if(ie.state==="active"){q=!0;break}const B=ND({enabled:Hn,kind:Te==null?void 0:Te.kind,canRestart:(ce==null?void 0:ce.canRestart)===!0,noticeOpen:yt,busy:q,idleSince:Go.current,now:kt});Go.current=B.idleSince,B.restart&&Us()},[Hn,Te==null?void 0:Te.kind,ce==null?void 0:ce.canRestart,yt,kt,Us]),_.useEffect(()=>{const q=ce==null?void 0:ce.running;let B=null,ie=null;try{B=window.sessionStorage.getItem("agent-dag.restartPending"),ie=window.sessionStorage.getItem(TC)}catch{return}const ue=kD({bundle:"3.9.0",running:q,pending:B,lastTried:ie});if(ue==="reload"){try{window.sessionStorage.setItem(TC,q??"")}catch{return}window.location.reload();return}if(ue!=="confirm")return;try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}is.current=!1,Bo(!1),Bs(q??null);const _e=window.setTimeout(()=>Bs(null),6e3);return()=>window.clearTimeout(_e)},[ce==null?void 0:ce.running]),_.useEffect(()=>{if(Ir&&SD({asked:Dl.current,reported:Tr})){try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}is.current=!1,Bo(!1)}},[Ir,Tr]);const as=_.useState(()=>FB(v8()))[0],Zt=_.useRef(as.pinned),ls=_.useRef(null),tt=_.useState(()=>w8())[0],[Vo,Fl]=_.useState(()=>new Set),[Or,oa]=_.useState(A5),[Gn,zl]=_.useState(()=>xC(_C)),Yo=_.useMemo(()=>qB(Gn),[Gn]),Ko=_.useCallback(q=>LB(q,Yo),[Yo]),mr=_.useMemo(()=>({background:Gn["--panel"],border:`1px solid ${Gn["--line"]}`,borderRadius:8}),[Gn]),[Vn,gr]=_.useState(!1);_.useEffect(()=>{document.documentElement.dataset.theme=Or;try{window.localStorage.setItem(HT,Or)}catch{}zl(q=>{const B=xC(_C);return DB(q,B)?q:B})},[Or]);const mn=_.useCallback((q,B)=>{if(Sv({durationMs:B,documentHidden:document.hidden})){e.setViewport(q,{duration:B});return}const{d3Zoom:ie,d3Selection:ue}=t.getState(),_e=ue==null?void 0:ue.property("__zoom");if(ie&&ue&&_e&&_e.k>0&&q.zoom>0){ie.transform(ue,_e.scale(q.zoom/_e.k).translate((q.x-_e.x)/q.zoom,(q.y-_e.y)/q.zoom));return}e.setViewport(q,{duration:0})},[e,t]),Yn=_.useRef(null);_.useEffect(()=>{if(!tt)return;const q=window.setTimeout(()=>{try{mn(tt,0)}catch{}Cn.current=Date.now()},60);return()=>window.clearTimeout(q)},[mn,tt]);const Kn=_.useRef(!0);_.useEffect(()=>{const q=new EventSource("/events"),B=C5(a,{now:()=>Date.now(),setTimeout:(ie,ue)=>window.setTimeout(ie,ue),clearTimeout:ie=>window.clearTimeout(ie)});return q.addEventListener("open",()=>{Ne(!0),gr(!0)}),q.addEventListener("error",()=>Ne(!1)),q.addEventListener("replay-end",()=>{Kn.current=!1,B.flush()}),q.addEventListener("hook",ie=>{var ue;try{const _e=JSON.parse(ie.data);if(!Vt.accept(_e))return;s.current=e1(s.current,_e);const Ae=_e.replay===!0||Kn.current||Date.now()-_e.receivedAt>3e4;Ae?B.replay():B.live();const We=YD(_e,Ae);We&&((ue=ke.current)==null||ue.play(We))}catch{}}),()=>{q.close(),B.cancel()}},[a]),_.useEffect(()=>{const q=setInterval(()=>{const B=Date.now();rn(B);let ie=_L(s.current,B,Jb);SL(s.current,B,Jb)&&(ie=!0),wL(s.current,B,i8,a8)&&(ie=!0),xL(s.current,B,l8,c8)&&(ie=!0),u(ue=>v5(ue,s.current.agents)),p(ue=>ue!=null&&!s.current.agents.has(ue)?null:ue),S(ue=>ue!=null&&!s.current.agents.has(ue)?null:ue),b(ue=>ue!=null&&!s.current.agents.has(ue)?null:ue),ie&&a()},250);return()=>clearInterval(q)},[a]);const ia=_.useRef(null),Cn=_.useRef(0),Ws=420,jn=_.useCallback((q=500)=>{try{const Ae=document.querySelector(".canvas-wrap"),We=Array.from(document.querySelectorAll(".react-flow__node")).filter(dt=>dt.offsetWidth>0);if(!Ae||We.length===0)return;const nt=Ae.getBoundingClientRect(),pt=e.getViewport();if(!Number.isFinite(pt.zoom)||pt.zoom<=0)return;const lt=dt=>(dt-nt.left-pt.x)/pt.zoom,Pt=dt=>(dt-nt.top-pt.y)/pt.zoom,ms=We.map(dt=>dt.getBoundingClientRect()),Na=Math.min(...ms.map(dt=>lt(dt.left))),ii=Math.max(...ms.map(dt=>lt(dt.right))),Ea=Math.min(...ms.map(dt=>Pt(dt.top))),oc=Math.max(...ms.map(dt=>Pt(dt.bottom))),Ca=ii-Na,ai=oc-Ea;if(!(Ca>0&&ai>0))return;const gs=Math.max(.2,Math.min(1,(nt.width-160)/(Ca+Ws)*.86,(nt.height-160)/ai*.86)),ys={x:80-Na*gs,y:Math.max(80,(nt.height-ai*gs)/2)-Ea*gs,zoom:gs};mn(ys,q),Cn.current=Date.now(),Yn.current=Sv({durationMs:q,documentHidden:document.hidden})?{target:ys,until:Date.now()+q+60}:null,window.setTimeout(()=>{var dt;try{((dt=Yn.current)==null?void 0:dt.target)===ys&&(Yn.current=null);const li=e.getViewport();(Math.abs(li.zoom-gs)>.01||Math.abs(li.x-ys.x)>2)&&mn(ys,0)}catch{}},q+60)}catch{}},[e,mn]);_.useEffect(()=>{const q=()=>{if(!document.hidden)return;const B=Yn.current;if(Yn.current=null,!(!B||Date.now()>B.until)){try{mn(B.target,0)}catch{}Cn.current=Date.now()}};return document.addEventListener("visibilitychange",q),()=>document.removeEventListener("visibilitychange",q)},[mn]);const Xo=_.useRef(""),cs=_.useRef(null),aa=_.useRef(0),Qo=_.useCallback(()=>{aa.current=Date.now()},[]),Pr=_.useRef(null),us=_.useRef(0),yr=_.useCallback(()=>{us.current=Date.now()},[]),Hs=_.useCallback(q=>({hasSourceEvent:!!q,at:Date.now(),lastDeckFitAt:Cn.current,lastCanvasInputAt:us.current}),[]),la="agent-dag.autoFitDisabled",Bl=_.useState(()=>{if(typeof window>"u")return!1;try{return window.localStorage.getItem(la)==="1"}catch{return!1}})[0],vr=_.useRef(Bl),[Gs,Zo]=_.useState(Bl),Jo=_.useCallback(()=>{if(!vr.current){vr.current=!0,Zo(!0);try{window.localStorage.setItem(la,"1")}catch{}}},[]),wr=_.useCallback(()=>{vr.current=!1,Zo(!1);try{window.localStorage.removeItem(la)}catch{}jn(400)},[e,jn]);_.useEffect(()=>{const q=setInterval(()=>{if(vr.current||Date.now()-aa.current<800)return;const B=s.current,ie=Date.now(),ue=[];for(const Ae of B.agents.values())ow(Ae,ie)&&ue.push({id:Ae.id});if(ue.length===0)return;const _e=[];for(const{id:Ae}of ue){const We=Xn.current.get(Ae),nt=Zt.current.get(Ae)??Ot.current.get(Ae);!We||!nt||_e.push({x:nt.x,y:nt.y,width:We.width,height:We.height})}WB({pane:Pr.current,viewport:e.getViewport(),boxes:_e})&&jn(600)},1500);return()=>clearInterval(q)},[e]);const Vs=_.useRef(!1),Xn=_.useRef(new Map),ca=_.useRef(0),ei=_.useCallback(q=>{const B=Xn.current;let ie=!1;for(const ue of q.nodeInternals.values()){const _e=ue.width,Ae=ue.height;if(_e==null||Ae==null)continue;const We=B.get(ue.id);We?(Math.abs(We.height-Ae)>4||Math.abs(We.width-_e)>4)&&(B.set(ue.id,{width:_e,height:Ae}),ie=!0):(B.set(ue.id,{width:_e,height:Ae}),ie=!0)}return ie&&(ca.current+=1),ca.current},[]),Ys=ut(ei),[ua,Jt]=_.useState(0);_.useEffect(()=>{let q=0;const B=()=>{const ue=Xn.current;let _e=!1;for(const Ae of document.querySelectorAll(".react-flow__node[data-id]")){const We=Ae.getAttribute("data-id");if(!We)continue;const nt=Ae.offsetWidth,pt=Ae.offsetHeight;if(!nt||!pt)continue;const lt=ue.get(We);(!lt||Math.abs(lt.width-nt)>4||Math.abs(lt.height-pt)>4)&&(ue.set(We,{width:nt,height:pt}),_e=!0)}_e&&Jt(Ae=>Ae+1)};if(Vs.current)return;let ie=0;return document.visibilityState==="hidden"?ie=window.setTimeout(B,32):q=requestAnimationFrame(B),()=>{cancelAnimationFrame(q),window.clearTimeout(ie)}});const Ot=_.useRef(as.positions),da=_.useRef(new Set),$r=_.useRef(""),ds=_.useMemo(()=>{const q=[];for(const B of s.current.agents.values())ow(B,kt)&&q.push(B.id+(B.parentId?`>${B.parentId}`:""));return q.sort(),`${q.join("|")}#sv${Ys}.${ua}`},[s.current,s.current.revision,kt,Ys,ua]),Lr=_.useRef(null);_.useEffect(()=>(Lr.current!=null&&window.clearTimeout(Lr.current),Lr.current=window.setTimeout(()=>{jv(Ot.current,Zt.current)},1500),()=>{Lr.current!=null&&window.clearTimeout(Lr.current)}),[ds]),_.useEffect(()=>{if(Xo.current===ds)return;const q=Xo.current;if(Xo.current=ds,!q||vr.current)return;Date.now()-Cn.current>1200&&jn(400),ia.current&&window.clearTimeout(ia.current),ia.current=window.setTimeout(()=>{vr.current||jn(500)},280)},[ds,e,jn]);const Ks=_.useMemo(()=>b5(s.current,l),[s.current,s.current.revision,l]),qr=_.useMemo(()=>OB(s.current,kt),[s.current,s.current.revision,kt]),Xs=_.useRef(null),[Qs,Ul]=_.useState({w:0,h:0});_.useEffect(()=>{const q=Xs.current;if(!q||typeof ResizeObserver>"u")return;const B=new ResizeObserver(ie=>{var _e;const ue=(_e=ie[0])==null?void 0:_e.contentRect;ue&&(Pr.current={width:ue.width,height:ue.height},Ul(Ae=>Math.abs(Ae.w-ue.width)>40||Math.abs(Ae.h-ue.height)>40?{w:ue.width,h:ue.height}:Ae))});return B.observe(q),Pr.current={width:q.clientWidth,height:q.clientHeight},Ul({w:q.clientWidth,h:q.clientHeight}),()=>B.disconnect()},[]);const pd=_.useCallback(q=>{var ie,ue;const B=q.target;!(B!=null&&B.closest)||B.closest(s8)!==q.currentTarget||(q.preventDefault(),(ue=(ie=document.activeElement)==null?void 0:ie.blur)==null||ue.call(ie))},[]),md=_.useRef(new Map),[ti,gd]=_.useState(!1);_.useEffect(()=>{const q=window.setTimeout(()=>gd(!0),2500);return()=>window.clearTimeout(q)},[]);const[yd,fa]=_.useState(!1),xr=_.useRef(null),[ha,pa]=_.useState(!1),vd=_.useCallback(()=>{xr.current&&(window.clearTimeout(xr.current),xr.current=null),fa(!1)},[]),wd=_.useCallback(q=>{q.length!==0&&queueMicrotask(()=>{fa(!0),xr.current&&window.clearTimeout(xr.current),xr.current=window.setTimeout(()=>fa(!1),o8+80)})},[]);_.useEffect(()=>()=>{xr.current&&window.clearTimeout(xr.current)},[]);const Wl=Qs.w>0?Qs.w*.92:0,Hl=Qs.h>0?Qs.h:0,{nodes:Tn,edges:xd}=_.useMemo(()=>k8(s.current,kt,Wl,Hl,Zt.current,Xn.current,md.current,wd,ti,ha,Ot.current,da.current,ds,$r,l,Ks,qr,N),[s.current,s.current.revision,kt,Wl,Hl,ti,ha,ds,l,Ks,qr,N,qo]),Gl=_.useMemo(()=>{const q=new Map;for(const ie of Tn){const ue=ie.data;if(!(ue!=null&&ue.sessionId)||ue.exitAt!=null)continue;const _e=ie.width,Ae=ie.height;if(_e==null||Ae==null)continue;const We=ie.position.x,nt=ie.position.y,pt=We+_e,lt=nt+Ae,Pt=q.get(ue.sessionId);Pt?(Pt.minX=Math.min(Pt.minX,We),Pt.minY=Math.min(Pt.minY,nt),Pt.maxX=Math.max(Pt.maxX,pt),Pt.maxY=Math.max(Pt.maxY,lt)):q.set(ue.sessionId,{minX:We,minY:nt,maxX:pt,maxY:lt})}const B=[];for(const[ie,ue]of q){const _e=ue.maxX-ue.minX+mu*2,Ae=ue.maxY-ue.minY+mu*2;B.push({id:`group:${ie}`,type:YR,position:{x:ue.minX-mu,y:ue.minY-mu},data:{sessionId:ie,w:_e,h:Ae},width:_e,height:Ae,style:{width:_e,height:Ae},zIndex:-1,draggable:!0,selectable:!1,focusable:!1,deletable:!1,connectable:!1})}return B},[Tn,kt]),bd=_.useMemo(()=>{const q=[...Gl,...Tn],B=ct.current;return!B||B.size===0?q:q.map(ie=>{const ue=B.get(ie.id);return ue?{...ie,position:ue}:ie})},[Gl,Tn,sa]),Zs=_.useMemo(()=>{const q=new Set;for(const B of s.current.agents.values())for(const ie of B.tools)q.add(rA(ie.name));return Object.keys(aw).filter(B=>q.has(B))},[s.current,s.current.revision]);_.useEffect(()=>{if(Zs.length<=1){Fo(!1);return}let q=0;const B=()=>{const ie=zs.current;if(ie&&!document.hidden){const ue=ie.getBoundingClientRect(),_e=Array.from(document.querySelectorAll(".react-flow__node, .tool-burst")).map(We=>We.getBoundingClientRect()),Ae=$B(ue,_e,8);Fo(We=>We===Ae?We:Ae)}q=window.setTimeout(B,300)};return B(),()=>window.clearTimeout(q)},[Zs.length]);const kd=_.useCallback(q=>{Fl(B=>{const ie=new Set(B);return ie.has(q)?ie.delete(q):ie.add(q),ie})},[]),en=h?s.current.agents.get(h):null,ma=f?Array.from(s.current.agents.values()).flatMap(q=>q.tools).find(q=>q.id===f)??null:null,Vl=_.useCallback(async()=>{try{await fetch("/api/clear",{method:"POST"})}catch{}s.current=Hv(),Zt.current.clear(),Xn.current.clear(),Ot.current.clear(),$r.current="",AC(),w(),a()},[a,w]),Yl=_.useRef(C);Yl.current=C;const Kl=_.useRef(M);Kl.current=M;const ga=_.useRef(!1);ga.current=ma!=null||Ar||k!=null||E!=null||ns||M||et!=null;const fs=_.useCallback(q=>{const B=ED(q,{confirmOpen:Yl.current,modalOpen:ga.current});B==="confirm"?j(!0):B==="clear"&&(j(!1),Vl())},[Vl]),Dr=_.useCallback(()=>{Zt.current.clear(),Ot.current.clear(),$r.current="",AC(),a(),window.setTimeout(()=>jn(500),80)},[a,e,jn]),Xl=_.useCallback(()=>jn(500),[jn]),Js=_.useRef(Tn);Js.current=Tn;const ya=_.useRef(h);ya.current=h;const ni=_.useCallback(q=>{const B=Js.current,ie=h5(B.map(Ae=>({id:Ae.id,x:Ae.position.x,y:Ae.position.y})),ya.current,q),ue=ie?B.find(Ae=>Ae.id===ie):void 0;if(!ue)return;const _e=SC(document.activeElement);v(ue.id,!1),window.setTimeout(()=>{try{e.fitView({padding:.35,duration:350,nodes:[ue]})}catch{}Cn.current=Date.now(),_e&&r8(ue.id)},30)},[v,e]),ri=_.useCallback(q=>{v(q,!1),window.setTimeout(()=>{try{const B=Js.current.find(ie=>ie.id===q);B&&e.fitView({padding:.3,duration:500,nodes:[B]}),Cn.current=Date.now()}catch{}},60)},[v,e]);_.useEffect(()=>{const q=B=>{var nt,pt;const ie=B.target,ue={tagName:ie==null?void 0:ie.tagName,isContentEditable:ie==null?void 0:ie.isContentEditable,role:(nt=ie==null?void 0:ie.getAttribute)==null?void 0:nt.call(ie,"role"),type:ie==null?void 0:ie.type};if(B.key==="Escape"){const lt=JL({overlayOpen:Fi.depth()>0,panelOnTop:Fi.topIsPanel(),typing:Iw(ue)});lt==="dismiss"?Fi.dismissTop():lt==="blur"?ie==null||ie.blur():(y5(ue)&&(ie==null||ie.blur()),w());return}if(Mw(B))return;const _e=SC(ie)?(pt=ie==null?void 0:ie.getAttribute)==null?void 0:pt.call(ie,"data-id"):null,Ae=_e&&Js.current.some(lt=>lt.id===_e)?_e:null,We=m5(B,Ae);if(We.kind==="activate"){B.preventDefault(),v(We.nodeId,We.additive);return}We.kind!=="node"&&(We.nodeId==null&&a3(ue)||l3({key:B.key,modalOpen:ga.current,sheetOpen:Kl.current})||(B.key===" "&&(B.preventDefault(),ss()),(B.key==="c"||B.key==="C")&&fs("shortcut"),(B.key==="r"||B.key==="R")&&Dr(),(B.key==="f"||B.key==="F")&&Xl(),(B.key==="l"||B.key==="L")&&Mo(),(B.key==="h"||B.key==="H")&&pr(lt=>!lt),(B.key==="u"||B.key==="U")&&K(lt=>!lt),(B.key==="a"||B.key==="A")&&bt.current.claude&&hr(),(B.key==="j"||B.key==="J")&&ni(1),(B.key==="k"||B.key==="K")&&ni(-1),(B.key==="t"||B.key==="T")&&oa(lt=>lt==="dark"?"light":"dark"),(B.key==="m"||B.key==="M")&&bt.current.claude&&$.current!==null&&ee.current(B.shiftKey),B.key==="?"&&P(lt=>!lt)))};return window.addEventListener("keydown",q),()=>window.removeEventListener("keydown",q)},[fs,Dr,Xl,w,v,ni,ss]);const si=s.current.agents.size,_t=_.useMemo(()=>WL(s.current.agents.values()),[s.current,s.current.revision]),Ql=_.useMemo(()=>HL(s.current.agents.values()),[s.current,s.current.revision]),Zl=_.useRef(null);_.useEffect(()=>{const q=M5({waiting:_t.length,running:Ql,connected:Oe}),B=Zl.current;if(Zl.current=q,(B==null?void 0:B.title)!==q.title&&(document.title=q.title),(B==null?void 0:B.icon)!==q.icon){const ie=document.querySelector('link[rel="icon"]');ie&&(ie.href=I5[q.icon])}},[_t.length,Ql,Oe]);const[_d,Jl]=_.useState(""),va=P5(_t);_.useEffect(()=>{Jl(q=>$5(q,va))},[va]);const[Qn,eo]=_.useState(()=>typeof Notification>"u"?"denied":Notification.permission),[Fr,hs]=_.useState(null),[Sd,ec]=_.useState(!1),[Zn,to]=_.useState(!0),[tc,wa]=_.useState(!1);_.useEffect(()=>{let q=!0;return fetch("/api/prefs").then(B=>B.ok?B.json():null).then(B=>{var ie;!q||!(B!=null&&B.ok)||(to(((ie=B.prefs)==null?void 0:ie.notifications)!==!1),wa(B.notificationsVetoed===!0))}).catch(()=>{}),()=>{q=!1}},[]);const nc=_.useCallback(()=>{const q=!Zn;to(q),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({notifications:q})}).then(B=>B.ok?B.json():null).then(B=>{var ie;B!=null&&B.ok&&(to(((ie=B.prefs)==null?void 0:ie.notifications)!==!1),wa(B.notificationsVetoed===!0))}).catch(()=>{})},[Zn]),rc=typeof Notification<"u",xa=XL(Qn,rc);_.useEffect(()=>{xa&&Zn&&_t.length>0&&ec(!0)},[xa,Zn,_t.length]),_.useEffect(()=>{if(!Fr)return;const B=setTimeout(()=>hs(null),Fr==="blocked"?8e3:4e3);return()=>clearTimeout(B)},[Fr]);const sc=_.useCallback(()=>{typeof Notification>"u"||Notification.requestPermission().then(q=>{const B=q;eo(B),B==="granted"?hs("on"):B==="denied"&&hs("blocked")})},[]),oi=_.useRef(new Set),ba=_.useRef(null),gn=_t.map(q=>Gu(q.id,q.waiting)).join("|");return _.useEffect(()=>{KL(ba.current,Qn)&&(ba.current=Qn,oi.current=r1(_t))},[Qn]),_.useEffect(()=>{if(typeof Notification>"u"||Notification.permission!=="granted"||ba.current===null)return;const q=typeof document>"u"||!document.hidden,B=VL(_t,oi.current,q,Zn);for(const ie of B)try{const ue=new Notification(ie.title,{body:ie.body,tag:ie.key});ue.onclick=()=>{window.focus(),ri(ie.sessionId),ue.close()}}catch{}oi.current=q?r1(_t):YL(_t,B,oi.current)},[gn]),d.jsxs("div",{className:"app",children:[d.jsx("a",{className:"skip-link",href:"#canvas",children:"Skip to the canvas"}),d.jsxs("header",{className:"topbar",children:[d.jsxs("div",{className:"readout",children:[d.jsxs("div",{className:"brand",children:[d.jsx("span",{className:"logo"}),d.jsx("h1",{children:Bt}),Te?d.jsxs("button",{type:"button",className:"v stale",onClick:()=>{Ce(),Sn()},"aria-haspopup":"dialog","aria-label":YB({...Te,open:yt}),title:Te.kind==="restart"?`Running v${Te.from}; v${Te.to} is installed on disk. Restart to pick it up · click for what's new`:`Running v${Te.from}; v${Te.to} is on npm · click for what's new`,children:["v",Te.from,d.jsx("span",{className:"v-dot","aria-hidden":!0})]}):(()=>{const q={running:Le,latest:ce==null?void 0:ce.latest,latestPending:ce==null?void 0:ce.latestPending,checkedAgo:ce!=null&&ce.checkedAt?Qv(kt-ce.checkedAt):null,checkDisabled:ce==null?void 0:ce.checkDisabled,checking:Ge};return d.jsxs("button",{type:"button",className:Ge?"v checking":"v",onClick:()=>{Ce(),qe(!0)},"aria-busy":Ge||void 0,"aria-haspopup":"dialog","aria-label":VB(q),title:GB(q),children:["v",q.running]})})()]}),d.jsxs("span",{className:"status",children:[(()=>{const q=t8({connected:Oe,paused:Wn,held:Vt.size,dropped:Vt.dropped});return q.resting?null:d.jsx("span",{className:`pill ${q.tone}`,title:q.title,children:d.jsxs("span",{className:"pill-box",children:[d.jsx("span",{className:"pill-widest","aria-hidden":!0,children:q.widest}),d.jsx("span",{className:"pill-label",children:q.label})]})})})(),d.jsx(y4,{usageOpen:z})]}),d.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:_d}),_t.length>0&&d.jsxs("button",{type:"button",className:"waiting-stat",onClick:()=>ri(_t[0].id),title:`Blocked waiting for you — click to go to the one that has been stuck longest:
|
|
213
|
+
${_t.map(q=>` ${q.label}: ${vl(q.waiting)} (${Qv(kt-q.waiting.since)})`).join(`
|
|
214
|
+
`)}`,"aria-label":`${_t.length} session${_t.length===1?"":"s"} waiting for you`,children:[d.jsx("span",{className:"ap-pulse","aria-hidden":!0}),d.jsx("b",{children:_t.length})," waiting"]}),Sd&&xa&&Zn&&d.jsx("button",{type:"button",className:"notify-ask",onClick:sc,title:"Get a system notification when a session blocks on you, so the deck can reach you with this tab in the background",children:"notify me"}),Fr&&d.jsx("span",{className:Fr==="on"?"notify-said":"notify-said notify-said-blocked",role:"status",title:Fr==="on"?"The deck will raise a system notification when a session blocks on you and this tab is in the background":"Notifications are blocked for this page. Only your browser can undo that — its site settings for this address",children:Fr==="on"?"notifications on":"notifications blocked"})]}),en&&(()=>{const q=bn(en),B=Math.max(0,((en.endedAt??kt)-en.startedAt)/1e3),ie=en.state==="active"?Aw(q.total,B):null,ue=l.size-1;return d.jsxs("button",{type:"button",className:"selected-ribbon",title:`Fit view to ${en.label}`,onClick:()=>{try{const _e=Tn.find(Ae=>Ae.id===en.id);_e&&e.fitView({padding:.35,duration:500,nodes:[_e]}),Cn.current=Date.now()}catch{}},children:[d.jsx("span",{className:`state-pill state-${en.state}`,children:en.state==="active"?"live":en.state}),d.jsx("span",{className:"selected-label",children:en.label}),q.total>0&&d.jsxs("span",{className:"selected-cost",children:[rt(q.total),ie?d.jsxs("span",{className:"selected-rate",children:[" · ",ie]}):null]}),ue>0&&d.jsxs("span",{className:"selected-extra",children:["+",ue]}),d.jsx("span",{"aria-hidden":!0,className:"selected-close",onClick:_e=>{_e.stopPropagation(),w()},children:"×"})]})})(),d.jsxs("div",{className:"actions",children:[d.jsxs("div",{className:"action-run",children:[d.jsx("button",{className:"btn icon-btn",onClick:Mo,title:`${D?"Hide":"Show"} session list (L)`,"aria-label":"Toggle session list","aria-expanded":D,"aria-controls":D?"session-list":void 0,children:"☰"}),d.jsx("button",{className:"btn icon-btn",onClick:()=>K(q=>!q),title:`${z?"Hide":"Show"} usage panel (U)`,"aria-label":"Toggle usage panel","aria-expanded":z,"aria-controls":z?"usage-panel":void 0,children:"$"}),at.claude&&d.jsx("button",{className:"btn icon-btn",onClick:hr,title:`${R?"Hide":"Show"} accounts (A)`,"aria-label":"Toggle accounts panel","aria-expanded":R,"aria-controls":R?"accounts-panel":void 0,children:d.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[d.jsx("circle",{cx:"7",cy:"4.6",r:"2.4"}),d.jsx("path",{d:"M2.4 12c0-2.3 2.1-3.7 4.6-3.7s4.6 1.4 4.6 3.7"})]})}),d.jsx("button",{className:"btn icon-btn",onClick:()=>pr(q=>!q),title:"Usage history — ccusage (H)","aria-label":"Open usage history","aria-haspopup":"dialog",children:d.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round","aria-hidden":!0,children:[d.jsx("line",{x1:"3",y1:"11.5",x2:"3",y2:"7"}),d.jsx("line",{x1:"7",y1:"11.5",x2:"7",y2:"3"}),d.jsx("line",{x1:"11",y1:"11.5",x2:"11",y2:"8.5"})]})}),d.jsxs("button",{className:`btn icon-btn bw-btn${Un>0?" has-findings":Mr?" watching":""}`,onClick:()=>Io(q=>!q),title:Mr?"Browser watch — watching; the deck is keeping its own copy":"Browser watch — not watching; reading the browser's history live","aria-label":`Browser watch, ${Mr?"watching":"not watching"}`+(Un>0?`, ${Un} unread`:""),"aria-haspopup":"dialog",children:[d.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5","aria-hidden":!0,children:[d.jsx("path",{d:"M0.9 7s2.2-4 6.1-4 6.1 4 6.1 4-2.2 4-6.1 4S0.9 7 0.9 7Z"}),Mr||Un>0?d.jsx("circle",{cx:"7",cy:"7",r:"1.8",fill:"currentColor",stroke:"none"}):d.jsx("line",{x1:"2.4",y1:"11.6",x2:"11.6",y2:"2.4"})]}),Un>0&&d.jsx("span",{className:"bw-badge","aria-hidden":!0,children:Un})]})]}),d.jsxs("div",{className:"action-run",children:[at.claude&&H!==null&&d.jsxs("div",{className:"sound-slot",children:[d.jsx("button",{ref:me,className:"btn icon-btn",onClick:()=>pe(q=>!q),...ar(!1),title:U5(at,{on:H===!0,locked:Ve==="locked",prefs:Y}),"aria-label":"Sound settings","aria-haspopup":"dialog","aria-expanded":ae,"aria-controls":ae?"sound-menu":void 0,children:d.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[d.jsx("path",{d:"M3.2 5.2h2L7.8 3v8L5.2 8.8h-2z"}),H?d.jsxs(d.Fragment,{children:[d.jsx("path",{d:"M9.8 5.4a2.4 2.4 0 0 1 0 3.2"}),d.jsx("path",{d:"M11.3 3.9a4.6 4.6 0 0 1 0 6.2"})]}):d.jsxs(d.Fragment,{children:[d.jsx("path",{d:"M10 5.6l2.6 2.8"}),d.jsx("path",{d:"M12.6 5.6L10 8.4"})]})]})}),ae&&d.jsx(QD,{onClose:()=>pe(!1),soundOn:H===!0,onToggleSound:X,prefs:Y,onLevel:(q,B)=>V(q,{level:B}),onFigure:(q,B)=>V(q,{figure:B}),onPreview:q=>J(q),notifyOn:Zn,onToggleNotify:nc,notifyVetoed:tc,notifyPermission:rc?Qn:"unsupported",onAskNotify:sc,openerRef:me})]}),d.jsx("button",{className:"btn icon-btn",onClick:()=>oa(q=>q==="dark"?"light":"dark"),title:`Switch to ${Or==="dark"?"light":"dark"} mode (T)`,"aria-label":"Toggle theme",children:Or==="dark"?"☀":"☾"})]})]})]}),os?d.jsxs("div",{className:"ver-banner done",role:"status",children:[d.jsx("span",{className:"ver-dot"}),d.jsxs("strong",{children:["Restarted — now running v",os,"."]}),d.jsx("span",{className:"ver-sub",children:"The canvas replayed from the event log."})]}):Vn&&!Oe?d.jsxs("div",{className:"conn-banner",role:"alert",children:[d.jsx("span",{className:"conn-dot"}),Ir?Uo==="npx"?"Fetching the new version with npx — this can take a minute…":`Restarting ${Bt}…`:(()=>{const q=JB({connected:Oe,paused:Wn});return d.jsxs(d.Fragment,{children:[`Lost connection to the ${Bt} server. Reconnecting…`,q&&d.jsx("span",{className:"conn-sub",children:q})]})})()]}):yt&&Te?d.jsxs("div",{className:`ver-banner ${Te.kind}`,role:"status",children:[d.jsx("span",{className:"ver-dot"}),Te.kind==="restart"?d.jsxs(d.Fragment,{children:[d.jsxs("strong",{children:["v",Te.to," is installed — this deck still runs v",Te.from,"."]}),ce!=null&&ce.canRestart?d.jsxs(d.Fragment,{children:[d.jsx("button",{type:"button",className:"ver-act",onClick:()=>Us(),...ar(Ir),title:"Stop this process and bring it back on the same port. The canvas replays from the event log.",children:Ir?"restarting…":"Restart now"}),d.jsxs("button",{type:"button",className:`ver-auto${Hn?" on":""}`,role:"switch","aria-checked":Hn,onClick:hd,title:Hn?"Restarts on its own once nothing has been running for 30 seconds. Click to require a click instead.":"Only restarts when you click. Click to let it restart itself while idle.",children:[d.jsx("i",{"aria-hidden":!0}),"auto when idle"]})]}):d.jsx("span",{className:"ver-sub",title:"Node loads every module once, at startup. An upgrade replaces the files on disk but not the code already in memory, so this process keeps running the old version until it is restarted.",children:"Restart it to pick up the new code."})]}):d.jsxs(d.Fragment,{children:[d.jsxs("strong",{children:[Bt," v",Te.to," is out — you are on v",Te.from,"."]}),(ce==null?void 0:ce.upgradeMode)==="install"&&Ut!=="failed"&&d.jsx("button",{type:"button",className:"ver-act",onClick:Ds,...ar(Ut==="running",Ut==="done"),title:`Runs ${((ka=ce==null?void 0:ce.upgrade)==null?void 0:ka.command)??(ce==null?void 0:ce.command)??"npm i -g"} here, then restarts once nothing is running.`,children:Ut==="running"?"installing…":Ut==="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:()=>Us({upgrade:!0}),...ar(Ir),title:`Runs ${ce==null?void 0:ce.command} and hands it this port. Nothing is installed globally — npx unpacks its own copy.`,children:Ir?"fetching…":Ut==="failed"?"Retry update":"Update & restart"}),Ut==="failed"?d.jsxs("span",{className:"ver-sub fail",title:((_a=ce==null?void 0:ce.upgrade)==null?void 0:_a.error)??"",children:[(ce==null?void 0:ce.upgradeMode)==="npx"?"update failed":"install failed",": ",((Sa=ce==null?void 0:ce.upgrade)==null?void 0:Sa.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:":Cv.npx}):ce!=null&&ce.upgradeBlocked?d.jsx("span",{className:"ver-sub",children:Object.hasOwn(Cv,ce.upgradeBlocked)?Cv[ce.upgradeBlocked]:"cannot install from here"}):null,d.jsxs("button",{type:"button",className:"ver-cmd",onClick:Rr,title:"Copy to clipboard",children:[d.jsx("code",{children:ce==null?void 0:ce.command}),d.jsx("span",{className:"ver-cmd-hint",children:Pe?"copied":"copy"})]})]}),d.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:zn,children:"×"})]}):Ro&&hn?d.jsxs("div",{className:"ver-banner",role:"status",children:[d.jsx("span",{className:"ver-dot"}),d.jsxs("strong",{children:[hn," still works — the deck is called ",Bt," now."]}),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:Ao,children:"×"})]}):null,z&&d.jsx(Wq,{state:s.current,now:kt,providers:at,onClose:()=>K(!1)}),R&&at.claude&&d.jsx(wD,{onClose:()=>Q(!1)}),D&&d.jsx(xq,{state:s.current,now:kt,selectedIds:l,onSelect:ri,onClose:()=>O(!1)}),d.jsxs("main",{id:"canvas",tabIndex:-1,className:`canvas-wrap${yd?" bubbling":""}${ha?" dragging-any":""}`,ref:Xs,onMouseDownCapture:pd,onPointerDownCapture:yr,onPointerUpCapture:yr,onWheelCapture:yr,children:[si===0&&d.jsx(N8,{live:Oe,everConnected:Vn,providers:at,workspace:Ke}),(Zs.length>1||Vo.size>0)&&d.jsx("div",{ref:zs,className:`cat-filter-bar${Do?" occluded":""}`,role:"group","aria-label":"Filter tools by category",children:Zs.map(q=>{const B=Vo.has(q);return d.jsxs("button",{type:"button",className:`cat-filter${B?" off":""}`,onClick:()=>kd(q),"aria-pressed":!B,title:`${B?"Show":"Hide"} ${lw[q]} tools`,children:[d.jsx("span",{className:"cat-emoji",children:aw[q]}),d.jsx("span",{className:"cat-name",children:lw[q]})]},q)})}),d.jsxs(Xj,{nodes:bd,edges:xd,nodeTypes:n8,fitView:!tt,fitViewOptions:{padding:.25,duration:Sv({durationMs:NC,documentHidden:document.hidden})?NC:0},minZoom:.2,maxZoom:1.6,panOnScroll:!0,nodesDraggable:!0,nodesConnectable:!1,selectionOnDrag:!1,nodeDragThreshold:5,onNodeClick:(q,B)=>{if(B.type==="sessionGroup"){w();return}v(B.id,q.shiftKey)},onPaneClick:()=>w(),onMoveStart:q=>{bC(Hs(q))&&Jo()},onMove:(q,B)=>{Qo(),bC(Hs(q))&&Jo(),cs.current&&window.clearTimeout(cs.current),cs.current=window.setTimeout(()=>x8(B),250)},onNodeDragStart:(q,B)=>{var ie;if(vd(),Vs.current=!0,ct.current=new Map,pa(!0),Qo(),Jo(),B.type==="sessionGroup"){const ue=(ie=B.data)==null?void 0:ie.sessionId,_e=new Map;if(ue)for(const Ae of Tn){const We=Ae.data;(We==null?void 0:We.sessionId)===ue&&_e.set(Ae.id,{x:Ae.position.x,y:Ae.position.y})}ls.current={start:{x:B.position.x,y:B.position.y},members:_e};return}Zt.current.set(B.id,{x:B.position.x,y:B.position.y})},onNodeDrag:(q,B)=>{var ie;if(Qo(),B.type==="sessionGroup"){const ue=ls.current;if(!ue)return;const _e=B.position.x-ue.start.x,Ae=B.position.y-ue.start.y;for(const[nt,pt]of ue.members){const lt={x:pt.x+_e,y:pt.y+Ae};Zt.current.set(nt,lt),Ot.current.set(nt,lt)}const We=ct.current;if(We){for(const[nt,pt]of ue.members)We.set(nt,{x:pt.x+_e,y:pt.y+Ae});We.set(B.id,{x:B.position.x,y:B.position.y})}rs(nt=>nt+1);return}Zt.current.set(B.id,{x:B.position.x,y:B.position.y}),Ot.current.set(B.id,{x:B.position.x,y:B.position.y}),(ie=ct.current)==null||ie.set(B.id,{x:B.position.x,y:B.position.y}),rs(ue=>ue+1)},onNodeDragStop:(q,B)=>{if(Qo(),Vs.current=!1,ct.current=null,pa(!1),Fs(ie=>ie+1),B.type==="sessionGroup"){const ie=ls.current;if(ie){const ue=B.position.x-ie.start.x,_e=B.position.y-ie.start.y;for(const[Ae,We]of ie.members){const nt={x:We.x+ue,y:We.y+_e};Zt.current.set(Ae,nt),Ot.current.set(Ae,nt)}}ls.current=null,jv(Ot.current,Zt.current),Fs(ue=>ue+1);return}Zt.current.set(B.id,{x:B.position.x,y:B.position.y}),Ot.current.set(B.id,{x:B.position.x,y:B.position.y}),jv(Ot.current,Zt.current)},children:[d.jsx(rL,{gap:28,size:1,color:Gn["--grid-line"]}),d.jsx(A3,{onFit:()=>{Cn.current=Date.now()}}),d.jsx(fq,{agents:s.current.agents,visibleAgentIds:qr,positions:Ot.current,pinned:Zt.current,measured:Xn.current,spotlight:Ks,hiddenCategories:Vo,now:kt,onOpenTool:g}),d.jsxs(Q$,{showInteractive:!1,children:[d.jsx(Nr,{onClick:wr,title:Gs?"Recenter view + re-enable autofit":"Recenter view (autofit already on)","aria-label":"Recenter view",style:Gs?{color:"var(--accent)"}:void 0,children:d.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[d.jsx("circle",{cx:"12",cy:"12",r:"3.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),d.jsx("path",{d:"M12 2v4M12 18v4M2 12h4M18 12h4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})]})}),d.jsx(Nr,{onClick:ss,title:ZB({paused:Wn,held:Vt.size,dropped:Vt.dropped}),"aria-label":QB,"aria-pressed":Wn,children:d.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:d.jsx("path",{d:"M9 5.5v13M15 5.5v13",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})})}),d.jsx(Nr,{onClick:Dr,title:"Auto-arrange — clear pins (R)","aria-label":"Re-arrange the canvas",children:d.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[d.jsx("rect",{x:"8.5",y:"2",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),d.jsx("rect",{x:"1.5",y:"17",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),d.jsx("rect",{x:"15.5",y:"17",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),d.jsx("path",{d:"M12 7v6.5M5 17v-3.5h14V17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]})}),d.jsx(Nr,{onClick:()=>fs("button"),title:"Clear the canvas and the server's event log — asks first (C)","aria-label":"Clear the canvas",children:d.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[d.jsx("path",{d:"M4 6.2h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"}),d.jsx("path",{d:"M9 6.2V4.4a1.6 1.6 0 0 1 1.6-1.6h2.8a1.6 1.6 0 0 1 1.6 1.6v1.8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),d.jsx("path",{d:"M17.4 6.4 16.7 20a2 2 0 0 1-2 1.9H9.3a2 2 0 0 1-2-1.9L6.6 6.4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),d.jsx("path",{d:"M10.3 10.6v6.8M13.7 10.6v6.8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})]})}),d.jsx(Nr,{onClick:()=>P(q=>!q),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(W$,{zoomable:!0,pannable:!0,nodeColor:Ko,nodeStrokeWidth:2,maskColor:Gn["--minimap-mask"],style:mr})]})]}),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:()=>L(!1),children:"×"}),en?d.jsx(j8,{agent:en,now:kt,onOpenTool:g,onShowSummary:q=>{I.has(q)&&(I.delete(q),RC(I)),b(q)},onExportSession:q=>b8(s.current,q)}):d.jsx(C8,{count:si,workspace:Ke})]}):d.jsx("button",{type:"button",className:"detail-reopen",title:"Show detail panel","aria-label":"Show detail panel",onClick:()=>L(!0),children:"‹"}),ma&&d.jsx(k3,{tool:ma,onClose:()=>g(null)}),Ar&&d.jsx(Y5,{providers:at,onClose:()=>pr(!1)}),ns&&d.jsx(iF,{onClose:()=>Io(!1),onSeen:q=>{Po(q);try{localStorage.setItem(K1,String(q))}catch{}},onWatching:Lo,palette:Gn}),k&&(()=>{const q=s.current.agents.get(k);return q?d.jsx(p3,{agent:q,onClose:()=>S(null)}):null})(),E&&d.jsx(yq,{state:s.current,sessionId:E,onClose:()=>{I.add(E),RC(I),b(null)}}),et&&d.jsx(d5,{entries:et.entries,since:et.since,firstRun:et.firstRun,running:Le,onClose:()=>it(null)}),M&&d.jsx(ID,{onClose:()=>P(!1)}),C&&d.jsx(RD,{agentCount:si,onConfirm:()=>fs("confirmation"),onCancel:()=>j(!1)})]})}function N8({live:e,everConnected:t,providers:n,workspace:s}){const i=!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"})]})]}),i?d.jsxs(d.Fragment,{children:[d.jsx("h2",{children:t?"Disconnected from server":"Server unreachable"}),d.jsxs("p",{children:["The browser cannot reach ",d.jsx("code",{children:"/events"}),". Check that",d.jsx("code",{children:Bt})," is still running in your terminal, then this page will resume automatically."]})]}):E8(n,s)]})}function E8(e,t){const n=XR(t);return d.jsxs(d.Fragment,{children:[d.jsx("h2",{children:"Waiting for Claude Code or Codex"}),n.kind==="scoped"?d.jsxs("p",{children:[n.lead," ",d.jsx("code",{children:n.workspace}),n.tail]}):d.jsxs("p",{children:["Run ",d.jsx("code",{children:"claude"})," or ",d.jsx("code",{children:"codex"})," in any folder. As soon as a session sends an event, a node appears here and grows as subagents fork and tools are called."]}),d.jsxs("p",{className:"hint-row",children:["Not seeing anything? Make sure ",d.jsx("code",{children:Bt})," is running."]}),B5(e).map(s=>d.jsx("p",{className:"hint-row",children:s.spans.map((i,a)=>i.code?d.jsx("code",{children:i.text},a):d.jsx("span",{children:i.text},a))},s.provider))]})}function C8({count:e,workspace:t}){const n=XR(t);return d.jsxs(d.Fragment,{children:[d.jsx("h2",{children:"Detail"}),e===0?d.jsxs("div",{className:"hint",children:[n.lead,n.workspace!==null&&d.jsxs(d.Fragment,{children:[" ",d.jsx("code",{children:n.workspace}),n.tail]})]}):d.jsx("div",{className:"empty",children:"Click an agent to see its tools."}),d.jsx("h3",{style:{marginTop:4},children:"Shortcuts"}),d.jsxs("div",{className:"shortcuts",children:[d.jsxs("div",{className:"sc",children:[d.jsx("kbd",{children:"?"}),d.jsx("span",{children:"all shortcuts"})]}),d.jsxs("div",{className:"sc",children:[d.jsx("kbd",{children:"drag"}),d.jsx("span",{children:"move a node"})]}),d.jsxs("div",{className:"sc",children:[d.jsx("kbd",{children:"tab"}),d.jsx("span",{children:"reach the cards"})]}),d.jsxs("div",{className:"sc",children:[d.jsx("kbd",{children:"enter"}),d.jsx("span",{children:"select the focused card"})]}),d.jsxs("div",{className:"sc",children:[d.jsx("kbd",{children:"space"}),d.jsx("span",{children:"pause / resume"})]}),d.jsxs("div",{className:"sc",children:[d.jsx("kbd",{children:"J"}),d.jsx("span",{children:"next agent"})]}),d.jsxs("div",{className:"sc",children:[d.jsx("kbd",{children:"K"}),d.jsx("span",{children:"previous agent"})]}),d.jsxs("div",{className:"sc",children:[d.jsx("kbd",{children:"R"}),d.jsx("span",{children:"re-arrange"})]}),d.jsxs("div",{className:"sc",children:[d.jsx("kbd",{children:"F"}),d.jsx("span",{children:"fit view"})]}),d.jsxs("div",{className:"sc",children:[d.jsx("kbd",{children:"L"}),d.jsx("span",{children:"session list"})]}),d.jsxs("div",{className:"sc",children:[d.jsx("kbd",{children:"H"}),d.jsx("span",{children:"usage history"})]}),d.jsxs("div",{className:"sc",children:[d.jsx("kbd",{children:"U"}),d.jsx("span",{children:"usage panel"})]}),d.jsxs("div",{className:"sc",children:[d.jsx("kbd",{children:"C"}),d.jsx("span",{children:"clear canvas"})]}),d.jsxs("div",{className:"sc",children:[d.jsx("kbd",{children:"T"}),d.jsx("span",{children:"toggle theme"})]}),d.jsxs("div",{className:"sc",children:[d.jsx("kbd",{children:"Esc"}),d.jsx("span",{children:"deselect, release focus"})]})]})]})}function j8({agent:e,now:t,onOpenTool:n,onShowSummary:s,onExportSession:i}){const a=Mu(e.startedAt,e.endedAt,t),l=bn(e),u=l.total>0,h=e.usage.inputTokens+e.usage.outputTokens,p=new Map;for(const E of e.tools){const b=rA(E.name);p.set(b,(p.get(b)??0)+1)}const f=e.tools.filter(E=>E.ok===!1).length,g=e.tools.filter(E=>!E.endedAt).length,v=Array.from(p.entries()).sort((E,b)=>b[1]-E[1]),w=p.has("mcp")?aq(e.tools.map(E=>E.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 E=dT(e);return d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"hero-sep",children:"·"}),d.jsxs("span",{className:"model-chip","data-family":Hu(e.model),title:E.length>0?`${e.model}
|
|
215
|
+
spend on this panel also covers:
|
|
216
|
+
${E.join(`
|
|
217
|
+
`)}`:e.model,children:[Ls(e.model),E.length>0?` +${E.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:rt(l.total)}),d.jsx("span",{className:"hero-cost-label",children:"spend"})]}),d.jsx(Pw,{cost:l})]}),d.jsxs("div",{className:"hero-actions",children:[e.kind==="root"&&e.state==="done"&&s&&d.jsx("button",{type:"button",className:"btn hero-action-btn",onClick:()=>s(e.sessionId),title:"Reopen the end-of-session recap modal",children:"Show recap"}),i&&d.jsx("button",{type:"button",className:"btn hero-action-btn",onClick:()=>i(e.sessionId),title:"Download this session as JSON",children:"Export JSON"})]})]}),e.tools.length>0&&d.jsxs("section",{className:"detail-section",children:[d.jsx("h3",{children:"Activity"}),d.jsxs("div",{className:"activity-row",children:[d.jsxs("div",{className:"activity-counters",children:[d.jsxs("span",{className:"ac-item",children:[d.jsx("b",{children:e.toolCount})," calls"]}),g>0&&d.jsxs("span",{className:"ac-item ac-live",children:[d.jsx("b",{children:g})," live"]}),f>0&&d.jsxs("span",{className:"ac-item ac-err",children:[d.jsx("b",{children:f})," err"]})]}),d.jsx("div",{className:"cat-strip",children:v.map(([E,b])=>{const k=E==="mcp"?w:null,S=k==null?void 0:k.hue,N=`${b} ${lw[E]} call${b===1?"":"s"}`;return d.jsxs("span",{className:`cat-chip cat-${E}${S!=null?" mcp-hue":""}`,style:S!=null?{"--mcp-hue":S}:void 0,title:k?`${N}, all to ${k.label}`:N,children:[d.jsx("span",{className:"cat-emoji",children:aw[E]}),d.jsx("span",{className:"cat-count",children:b}),k&&d.jsx("span",{className:"cat-server",children:k.label})]},E)})})]})]}),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((E,b)=>{const k=Mq(E.at,t);return d.jsxs("div",{className:"prompt-entry",children:[d.jsx("div",{className:"prompt-time",title:k.title,children:k.label}),d.jsx("div",{className:"prompt-text",children:E.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(E=>d.jsx(R8,{t:E,onClick:()=>n(E.id)},E.id))})]})]})}const T8={inflight:"in-flight",done:"done",err:"error"};function R8({t:e,onClick:t}){const n=e.endedAt==null?"inflight":e.ok===!1?"err":"done",s=hT(e,"…");return d.jsxs("button",{className:"tool clickable",title:e.inputPreview||e.name,onClick:t,children:[d.jsxs("span",{className:"name",children:[d.jsx("span",{className:`status-dot ${n}`,"aria-hidden":!0}),d.jsx("span",{className:"vis-hidden",children:T8[n]}),e.name]}),d.jsx("span",{style:{color:"var(--muted)"},children:s})]})}try{Vq(window.localStorage)}catch{}const A8=n2.createRoot(document.getElementById("root"));A8.render(d.jsx(_8,{}));
|