agent-dag 3.15.0 → 3.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/web/assets/{index-CqAgutJT.css → index-BwFExw1D.css} +1 -1
- package/dist/web/assets/index-CSpWSOAU.js +260 -0
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/release-notes.json +16 -0
- package/src/server/deck-prefs.mjs +33 -14
- package/src/server/index.mjs +162 -26
- package/src/server/lan-engine.mjs +455 -67
- package/src/server/lan-reach.mjs +256 -0
- package/src/server/lan-socket.mjs +257 -63
- package/src/server/lan-sync.mjs +334 -86
- package/dist/web/assets/index-CbYzt04Y.js +0 -248
|
@@ -1,248 +0,0 @@
|
|
|
1
|
-
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))s(a);new MutationObserver(a=>{for(const i of a)if(i.type==="childList")for(const l of i.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&s(l)}).observe(document,{childList:!0,subtree:!0});function n(a){const i={};return a.integrity&&(i.integrity=a.integrity),a.referrerPolicy&&(i.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?i.credentials="include":a.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function s(a){if(a.ep)return;a.ep=!0;const i=n(a);fetch(a.href,i)}})();var eu=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ww(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Kh={exports:{}},Ji={},Xh={exports:{}},Ke={};/**
|
|
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 nb;function cM(){if(nb)return Ke;nb=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),l=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),g=Symbol.iterator;function v(P){return P===null||typeof P!="object"?null:(P=g&&P[g]||P["@@iterator"],typeof P=="function"?P:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},N=Object.assign,k={};function S(P,K,te){this.props=P,this.context=K,this.refs=k,this.updater=te||w}S.prototype.isReactComponent={},S.prototype.setState=function(P,K){if(typeof P!="object"&&typeof P!="function"&&P!=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,P,K,"setState")},S.prototype.forceUpdate=function(P){this.updater.enqueueForceUpdate(this,P,"forceUpdate")};function _(){}_.prototype=S.prototype;function E(P,K,te){this.props=P,this.context=K,this.refs=k,this.updater=te||w}var C=E.prototype=new _;C.constructor=E,N(C,S.prototype),C.isPureReactComponent=!0;var j=Array.isArray,M=Object.prototype.hasOwnProperty,$={current:null},O={key:!0,ref:!0,__self:!0,__source:!0};function z(P,K,te){var D,L={},Q=null,U=null;if(K!=null)for(D in K.ref!==void 0&&(U=K.ref),K.key!==void 0&&(Q=""+K.key),K)M.call(K,D)&&!O.hasOwnProperty(D)&&(L[D]=K[D]);var ie=arguments.length-2;if(ie===1)L.children=te;else if(1<ie){for(var fe=Array(ie),me=0;me<ie;me++)fe[me]=arguments[me+2];L.children=fe}if(P&&P.defaultProps)for(D in ie=P.defaultProps,ie)L[D]===void 0&&(L[D]=ie[D]);return{$$typeof:e,type:P,key:Q,ref:U,props:L,_owner:$.current}}function I(P,K){return{$$typeof:e,type:P.type,key:K,ref:P.ref,props:P.props,_owner:P._owner}}function A(P){return typeof P=="object"&&P!==null&&P.$$typeof===e}function q(P){var K={"=":"=0",":":"=2"};return"$"+P.replace(/[=:]/g,function(te){return K[te]})}var V=/\/+/g;function Y(P,K){return typeof P=="object"&&P!==null&&P.key!=null?q(""+P.key):K.toString(36)}function R(P,K,te,D,L){var Q=typeof P;(Q==="undefined"||Q==="boolean")&&(P=null);var U=!1;if(P===null)U=!0;else switch(Q){case"string":case"number":U=!0;break;case"object":switch(P.$$typeof){case e:case t:U=!0}}if(U)return U=P,L=L(U),P=D===""?"."+Y(U,0):D,j(L)?(te="",P!=null&&(te=P.replace(V,"$&/")+"/"),R(L,K,te,"",function(me){return me})):L!=null&&(A(L)&&(L=I(L,te+(!L.key||U&&U.key===L.key?"":(""+L.key).replace(V,"$&/")+"/")+P)),K.push(L)),1;if(U=0,D=D===""?".":D+":",j(P))for(var ie=0;ie<P.length;ie++){Q=P[ie];var fe=D+Y(Q,ie);U+=R(Q,K,te,fe,L)}else if(fe=v(P),typeof fe=="function")for(P=fe.call(P),ie=0;!(Q=P.next()).done;)Q=Q.value,fe=D+Y(Q,ie++),U+=R(Q,K,te,fe,L);else if(Q==="object")throw K=String(P),Error("Objects are not valid as a React child (found: "+(K==="[object Object]"?"object with keys {"+Object.keys(P).join(", ")+"}":K)+"). If you meant to render a collection of children, use an array instead.");return U}function X(P,K,te){if(P==null)return P;var D=[],L=0;return R(P,D,"","",function(Q){return K.call(te,Q,L++)}),D}function B(P){if(P._status===-1){var K=P._result;K=K(),K.then(function(te){(P._status===0||P._status===-1)&&(P._status=1,P._result=te)},function(te){(P._status===0||P._status===-1)&&(P._status=2,P._result=te)}),P._status===-1&&(P._status=0,P._result=K)}if(P._status===1)return P._result.default;throw P._result}var ne={current:null},Z={transition:null},W={ReactCurrentDispatcher:ne,ReactCurrentBatchConfig:Z,ReactCurrentOwner:$};function J(){throw Error("act(...) is not supported in production builds of React.")}return Ke.Children={map:X,forEach:function(P,K,te){X(P,function(){K.apply(this,arguments)},te)},count:function(P){var K=0;return X(P,function(){K++}),K},toArray:function(P){return X(P,function(K){return K})||[]},only:function(P){if(!A(P))throw Error("React.Children.only expected to receive a single React element child.");return P}},Ke.Component=S,Ke.Fragment=n,Ke.Profiler=a,Ke.PureComponent=E,Ke.StrictMode=s,Ke.Suspense=f,Ke.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=W,Ke.act=J,Ke.cloneElement=function(P,K,te){if(P==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+P+".");var D=N({},P.props),L=P.key,Q=P.ref,U=P._owner;if(K!=null){if(K.ref!==void 0&&(Q=K.ref,U=$.current),K.key!==void 0&&(L=""+K.key),P.type&&P.type.defaultProps)var ie=P.type.defaultProps;for(fe in K)M.call(K,fe)&&!O.hasOwnProperty(fe)&&(D[fe]=K[fe]===void 0&&ie!==void 0?ie[fe]:K[fe])}var fe=arguments.length-2;if(fe===1)D.children=te;else if(1<fe){ie=Array(fe);for(var me=0;me<fe;me++)ie[me]=arguments[me+2];D.children=ie}return{$$typeof:e,type:P.type,key:L,ref:Q,props:D,_owner:U}},Ke.createContext=function(P){return P={$$typeof:l,_currentValue:P,_currentValue2:P,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},P.Provider={$$typeof:i,_context:P},P.Consumer=P},Ke.createElement=z,Ke.createFactory=function(P){var K=z.bind(null,P);return K.type=P,K},Ke.createRef=function(){return{current:null}},Ke.forwardRef=function(P){return{$$typeof:u,render:P}},Ke.isValidElement=A,Ke.lazy=function(P){return{$$typeof:h,_payload:{_status:-1,_result:P},_init:B}},Ke.memo=function(P,K){return{$$typeof:p,type:P,compare:K===void 0?null:K}},Ke.startTransition=function(P){var K=Z.transition;Z.transition={};try{P()}finally{Z.transition=K}},Ke.unstable_act=J,Ke.useCallback=function(P,K){return ne.current.useCallback(P,K)},Ke.useContext=function(P){return ne.current.useContext(P)},Ke.useDebugValue=function(){},Ke.useDeferredValue=function(P){return ne.current.useDeferredValue(P)},Ke.useEffect=function(P,K){return ne.current.useEffect(P,K)},Ke.useId=function(){return ne.current.useId()},Ke.useImperativeHandle=function(P,K,te){return ne.current.useImperativeHandle(P,K,te)},Ke.useInsertionEffect=function(P,K){return ne.current.useInsertionEffect(P,K)},Ke.useLayoutEffect=function(P,K){return ne.current.useLayoutEffect(P,K)},Ke.useMemo=function(P,K){return ne.current.useMemo(P,K)},Ke.useReducer=function(P,K,te){return ne.current.useReducer(P,K,te)},Ke.useRef=function(P){return ne.current.useRef(P)},Ke.useState=function(P){return ne.current.useState(P)},Ke.useSyncExternalStore=function(P,K,te){return ne.current.useSyncExternalStore(P,K,te)},Ke.useTransition=function(){return ne.current.useTransition()},Ke.version="18.3.1",Ke}var rb;function Tl(){return rb||(rb=1,Xh.exports=cM()),Xh.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 sb;function uM(){if(sb)return Ji;sb=1;var e=Tl(),t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,a=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function l(u,f,p){var h,g={},v=null,w=null;p!==void 0&&(v=""+p),f.key!==void 0&&(v=""+f.key),f.ref!==void 0&&(w=f.ref);for(h in f)s.call(f,h)&&!i.hasOwnProperty(h)&&(g[h]=f[h]);if(u&&u.defaultProps)for(h in f=u.defaultProps,f)g[h]===void 0&&(g[h]=f[h]);return{$$typeof:t,type:u,key:v,ref:w,props:g,_owner:a.current}}return Ji.Fragment=n,Ji.jsx=l,Ji.jsxs=l,Ji}var ob;function dM(){return ob||(ob=1,Kh.exports=uM()),Kh.exports}var d=dM(),tu={},Qh={exports:{}},gn={},Zh={exports:{}},Jh={};/**
|
|
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 ab;function hM(){return ab||(ab=1,(function(e){function t(Z,W){var J=Z.length;Z.push(W);e:for(;0<J;){var P=J-1>>>1,K=Z[P];if(0<a(K,W))Z[P]=W,Z[J]=K,J=P;else break e}}function n(Z){return Z.length===0?null:Z[0]}function s(Z){if(Z.length===0)return null;var W=Z[0],J=Z.pop();if(J!==W){Z[0]=J;e:for(var P=0,K=Z.length,te=K>>>1;P<te;){var D=2*(P+1)-1,L=Z[D],Q=D+1,U=Z[Q];if(0>a(L,J))Q<K&&0>a(U,L)?(Z[P]=U,Z[Q]=J,P=Q):(Z[P]=L,Z[D]=J,P=D);else if(Q<K&&0>a(U,J))Z[P]=U,Z[Q]=J,P=Q;else break e}}return W}function a(Z,W){var J=Z.sortIndex-W.sortIndex;return J!==0?J:Z.id-W.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var l=Date,u=l.now();e.unstable_now=function(){return l.now()-u}}var f=[],p=[],h=1,g=null,v=3,w=!1,N=!1,k=!1,S=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function C(Z){for(var W=n(p);W!==null;){if(W.callback===null)s(p);else if(W.startTime<=Z)s(p),W.sortIndex=W.expirationTime,t(f,W);else break;W=n(p)}}function j(Z){if(k=!1,C(Z),!N)if(n(f)!==null)N=!0,B(M);else{var W=n(p);W!==null&&ne(j,W.startTime-Z)}}function M(Z,W){N=!1,k&&(k=!1,_(z),z=-1),w=!0;var J=v;try{for(C(W),g=n(f);g!==null&&(!(g.expirationTime>W)||Z&&!q());){var P=g.callback;if(typeof P=="function"){g.callback=null,v=g.priorityLevel;var K=P(g.expirationTime<=W);W=e.unstable_now(),typeof K=="function"?g.callback=K:g===n(f)&&s(f),C(W)}else s(f);g=n(f)}if(g!==null)var te=!0;else{var D=n(p);D!==null&&ne(j,D.startTime-W),te=!1}return te}finally{g=null,v=J,w=!1}}var $=!1,O=null,z=-1,I=5,A=-1;function q(){return!(e.unstable_now()-A<I)}function V(){if(O!==null){var Z=e.unstable_now();A=Z;var W=!0;try{W=O(!0,Z)}finally{W?Y():($=!1,O=null)}}else $=!1}var Y;if(typeof E=="function")Y=function(){E(V)};else if(typeof MessageChannel<"u"){var R=new MessageChannel,X=R.port2;R.port1.onmessage=V,Y=function(){X.postMessage(null)}}else Y=function(){S(V,0)};function B(Z){O=Z,$||($=!0,Y())}function ne(Z,W){z=S(function(){Z(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(Z){Z.callback=null},e.unstable_continueExecution=function(){N||w||(N=!0,B(M))},e.unstable_forceFrameRate=function(Z){0>Z||125<Z?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):I=0<Z?Math.floor(1e3/Z):5},e.unstable_getCurrentPriorityLevel=function(){return v},e.unstable_getFirstCallbackNode=function(){return n(f)},e.unstable_next=function(Z){switch(v){case 1:case 2:case 3:var W=3;break;default:W=v}var J=v;v=W;try{return Z()}finally{v=J}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(Z,W){switch(Z){case 1:case 2:case 3:case 4:case 5:break;default:Z=3}var J=v;v=Z;try{return W()}finally{v=J}},e.unstable_scheduleCallback=function(Z,W,J){var P=e.unstable_now();switch(typeof J=="object"&&J!==null?(J=J.delay,J=typeof J=="number"&&0<J?P+J:P):J=P,Z){case 1:var K=-1;break;case 2:K=250;break;case 5:K=1073741823;break;case 4:K=1e4;break;default:K=5e3}return K=J+K,Z={id:h++,callback:W,priorityLevel:Z,startTime:J,expirationTime:K,sortIndex:-1},J>P?(Z.sortIndex=J,t(p,Z),n(f)===null&&Z===n(p)&&(k?(_(z),z=-1):k=!0,ne(j,J-P))):(Z.sortIndex=K,t(f,Z),N||w||(N=!0,B(M))),Z},e.unstable_shouldYield=q,e.unstable_wrapCallback=function(Z){var W=v;return function(){var J=v;v=W;try{return Z.apply(this,arguments)}finally{v=J}}}})(Jh)),Jh}var ib;function fM(){return ib||(ib=1,Zh.exports=hM()),Zh.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 lb;function pM(){if(lb)return gn;lb=1;var e=Tl(),t=fM();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,a={};function i(r,o){l(r,o),l(r+"Capture",o)}function l(r,o){for(a[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"),f=Object.prototype.hasOwnProperty,p=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,h={},g={};function v(r){return f.call(g,r)?!0:f.call(h,r)?!1:p.test(r)?g[r]=!0:(h[r]=!0,!1)}function w(r,o,c,m){if(c!==null&&c.type===0)return!1;switch(typeof o){case"function":case"symbol":return!0;case"boolean":return m?!1:c!==null?!c.acceptsBooleans:(r=r.toLowerCase().slice(0,5),r!=="data-"&&r!=="aria-");default:return!1}}function N(r,o,c,m){if(o===null||typeof o>"u"||w(r,o,c,m))return!0;if(m)return!1;if(c!==null)switch(c.type){case 3:return!o;case 4:return o===!1;case 5:return isNaN(o);case 6:return isNaN(o)||1>o}return!1}function k(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 S={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(r){S[r]=new k(r,0,!1,r,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(r){var o=r[0];S[o]=new k(o,1,!1,r[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(r){S[r]=new k(r,2,!1,r.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(r){S[r]=new k(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){S[r]=new k(r,3,!1,r.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(r){S[r]=new k(r,3,!0,r,null,!1,!1)}),["capture","download"].forEach(function(r){S[r]=new k(r,4,!1,r,null,!1,!1)}),["cols","rows","size","span"].forEach(function(r){S[r]=new k(r,6,!1,r,null,!1,!1)}),["rowSpan","start"].forEach(function(r){S[r]=new k(r,5,!1,r.toLowerCase(),null,!1,!1)});var _=/[\-:]([a-z])/g;function E(r){return r[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(r){var o=r.replace(_,E);S[o]=new k(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(_,E);S[o]=new k(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(_,E);S[o]=new k(o,1,!1,r,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(r){S[r]=new k(r,1,!1,r.toLowerCase(),null,!1,!1)}),S.xlinkHref=new k("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(r){S[r]=new k(r,1,!1,r.toLowerCase(),null,!0,!0)});function C(r,o,c,m){var y=S.hasOwnProperty(o)?S[o]:null;(y!==null?y.type!==0:m||!(2<o.length)||o[0]!=="o"&&o[0]!=="O"||o[1]!=="n"&&o[1]!=="N")&&(N(o,c,y,m)&&(c=null),m||y===null?v(o)&&(c===null?r.removeAttribute(o):r.setAttribute(o,""+c)):y.mustUseProperty?r[y.propertyName]=c===null?y.type===3?!1:"":c:(o=y.attributeName,m=y.attributeNamespace,c===null?r.removeAttribute(o):(y=y.type,c=y===3||y===4&&c===!0?"":""+c,m?r.setAttributeNS(m,o,c):r.setAttribute(o,c))))}var j=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,M=Symbol.for("react.element"),$=Symbol.for("react.portal"),O=Symbol.for("react.fragment"),z=Symbol.for("react.strict_mode"),I=Symbol.for("react.profiler"),A=Symbol.for("react.provider"),q=Symbol.for("react.context"),V=Symbol.for("react.forward_ref"),Y=Symbol.for("react.suspense"),R=Symbol.for("react.suspense_list"),X=Symbol.for("react.memo"),B=Symbol.for("react.lazy"),ne=Symbol.for("react.offscreen"),Z=Symbol.iterator;function W(r){return r===null||typeof r!="object"?null:(r=Z&&r[Z]||r["@@iterator"],typeof r=="function"?r:null)}var J=Object.assign,P;function K(r){if(P===void 0)try{throw Error()}catch(c){var o=c.stack.trim().match(/\n( *(at )?)/);P=o&&o[1]||""}return`
|
|
34
|
-
`+P+r}var te=!1;function D(r,o){if(!r||te)return"";te=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(o)if(o=function(){throw Error()},Object.defineProperty(o.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(o,[])}catch(ue){var m=ue}Reflect.construct(r,[],o)}else{try{o.call()}catch(ue){m=ue}r.call(o.prototype)}else{try{throw Error()}catch(ue){m=ue}r()}}catch(ue){if(ue&&m&&typeof ue.stack=="string"){for(var y=ue.stack.split(`
|
|
35
|
-
`),x=m.stack.split(`
|
|
36
|
-
`),T=y.length-1,H=x.length-1;1<=T&&0<=H&&y[T]!==x[H];)H--;for(;1<=T&&0<=H;T--,H--)if(y[T]!==x[H]){if(T!==1||H!==1)do if(T--,H--,0>H||y[T]!==x[H]){var ee=`
|
|
37
|
-
`+y[T].replace(" at new "," at ");return r.displayName&&ee.includes("<anonymous>")&&(ee=ee.replace("<anonymous>",r.displayName)),ee}while(1<=T&&0<=H);break}}}finally{te=!1,Error.prepareStackTrace=c}return(r=r?r.displayName||r.name:"")?K(r):""}function L(r){switch(r.tag){case 5:return K(r.type);case 16:return K("Lazy");case 13:return K("Suspense");case 19:return K("SuspenseList");case 0:case 2:case 15:return r=D(r.type,!1),r;case 11:return r=D(r.type.render,!1),r;case 1:return r=D(r.type,!0),r;default:return""}}function Q(r){if(r==null)return null;if(typeof r=="function")return r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case O:return"Fragment";case $:return"Portal";case I:return"Profiler";case z:return"StrictMode";case Y:return"Suspense";case R:return"SuspenseList"}if(typeof r=="object")switch(r.$$typeof){case q:return(r.displayName||"Context")+".Consumer";case A:return(r._context.displayName||"Context")+".Provider";case V:var o=r.render;return r=r.displayName,r||(r=o.displayName||o.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case X:return o=r.displayName||null,o!==null?o:Q(r.type)||"Memo";case B:o=r._payload,r=r._init;try{return Q(r(o))}catch{}}return null}function U(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 Q(o);case 8:return o===z?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o}return null}function ie(r){switch(typeof r){case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function fe(r){var o=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(o==="checkbox"||o==="radio")}function me(r){var o=fe(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=fe(r)?r.checked?"true":"false":r.value),r=m,r!==c?(o.setValue(r),!0):!1}function Le(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 De(r,o){var c=o.checked;return J({},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=ie(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 Ge(r,o){o=o.checked,o!=null&&C(r,"checked",o,!1)}function be(r,o){Ge(r,o);var c=ie(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")?Qe(r,o.type,c):o.hasOwnProperty("defaultValue")&&Qe(r,o.type,ie(o.defaultValue)),o.checked==null&&o.defaultChecked!=null&&(r.defaultChecked=!!o.defaultChecked)}function se(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 Qe(r,o,c){(o!=="number"||Le(r.ownerDocument)!==r)&&(c==null?r.defaultValue=""+r._wrapperState.initialValue:r.defaultValue!==""+c&&(r.defaultValue=""+c))}var ut=Array.isArray;function lt(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=""+ie(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 rt(r,o){if(o.dangerouslySetInnerHTML!=null)throw Error(n(91));return J({},o,{value:void 0,defaultValue:void 0,children:""+r._wrapperState.initialValue})}function Ye(r,o){var c=o.value;if(c==null){if(c=o.children,o=o.defaultValue,c!=null){if(o!=null)throw Error(n(92));if(ut(c)){if(1<c.length)throw Error(n(93));c=c[0]}o=c}o==null&&(o=""),c=o}r._wrapperState={initialValue:ie(c)}}function pe(r,o){var c=ie(o.value),m=ie(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 we(r){var o=r.textContent;o===r._wrapperState.initialValue&&o!==""&&o!==null&&(r.value=o)}function Pe(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 Ue(r,o){return r==null||r==="http://www.w3.org/1999/xhtml"?Pe(o):r==="http://www.w3.org/2000/svg"&&o==="foreignObject"?"http://www.w3.org/1999/xhtml":r}var st,Oe=(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(st=st||document.createElement("div"),st.innerHTML="<svg>"+o.valueOf().toString()+"</svg>",o=st.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 Se={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},qe=["Webkit","ms","Moz","O"];Object.keys(Se).forEach(function(r){qe.forEach(function(o){o=o+r.charAt(0).toUpperCase()+r.substring(1),Se[o]=Se[r]})});function _e(r,o,c){return o==null||typeof o=="boolean"||o===""?"":c||typeof o!="number"||o===0||Se.hasOwnProperty(r)&&Se[r]?(""+o).trim():o+"px"}function Be(r,o){r=r.style;for(var c in o)if(o.hasOwnProperty(c)){var m=c.indexOf("--")===0,y=_e(c,o[c],m);c==="float"&&(c="cssFloat"),m?r.setProperty(c,y):r[c]=y}}var _t=J({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function yt(r,o){if(o){if(_t[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 at=null;function vt(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var wt=null,sn=null,on=null;function An(r){if(r=qi(r)){if(typeof wt!="function")throw Error(n(280));var o=r.stateNode;o&&(o=mc(o),wt(r.stateNode,r.type,o))}}function Io(r){sn?on?on.push(r):on=[r]:sn=r}function Oo(){if(sn){var r=sn,o=on;if(on=sn=null,An(r),o)for(r=0;r<o.length;r++)An(o[r])}}function $o(r,o){return r(o)}function wn(){}var zs=!1;function Po(r,o,c){if(zs)return r(o,c);zs=!0;try{return $o(r,o,c)}finally{zs=!1,(sn!==null||on!==null)&&(wn(),Oo())}}function Ot(r,o){var c=r.stateNode;if(c===null)return null;var m=mc(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 fr=!1;if(u)try{var Hn={};Object.defineProperty(Hn,"passive",{get:function(){fr=!0}}),window.addEventListener("test",Hn,Hn),window.removeEventListener("test",Hn,Hn)}catch{fr=!1}function ai(r,o,c,m,y,x,T,H,ee){var ue=Array.prototype.slice.call(arguments,3);try{o.apply(c,ue)}catch(ye){this.onError(ye)}}var Mr=!1,Ir=null,Or=!1,as=null,Bs={onError:function(r){Mr=!0,Ir=r}};function Lo(r,o,c,m,y,x,T,H,ee){Mr=!1,Ir=null,ai.apply(Bs,arguments)}function Us(r,o,c,m,y,x,T,H,ee){if(Lo.apply(this,arguments),Mr){if(Mr){var ue=Ir;Mr=!1,Ir=null}else throw Error(n(198));Or||(Or=!0,as=ue)}}function Mn(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 qo(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 Ws(r){if(Mn(r)!==r)throw Error(n(188))}function ii(r){var o=r.alternate;if(!o){if(o=Mn(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 Ws(y),r;if(x===m)return Ws(y),o;x=x.sibling}throw Error(n(188))}if(c.return!==m.return)c=y,m=x;else{for(var T=!1,H=y.child;H;){if(H===c){T=!0,c=y,m=x;break}if(H===m){T=!0,m=y,c=x;break}H=H.sibling}if(!T){for(H=x.child;H;){if(H===c){T=!0,c=x,m=y;break}if(H===m){T=!0,m=x,c=y;break}H=H.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 $r(r){return r=ii(r),r!==null?Hs(r):null}function Hs(r){if(r.tag===5||r.tag===6)return r;for(r=r.child;r!==null;){var o=Hs(r);if(o!==null)return o;r=r.sibling}return null}var Gn=t.unstable_scheduleCallback,Do=t.unstable_cancelCallback,Gs=t.unstable_shouldYield,Fo=t.unstable_requestPaint,dt=t.unstable_now,zo=t.unstable_getCurrentPriorityLevel,Vn=t.unstable_ImmediatePriority,Bo=t.unstable_UserBlockingPriority,Pr=t.unstable_NormalPriority,Xt=t.unstable_LowPriority,Lr=t.unstable_IdlePriority,is=null,Qt=null;function xt(r){if(Qt&&typeof Qt.onCommitFiberRoot=="function")try{Qt.onCommitFiberRoot(is,r,void 0,(r.current.flags&128)===128)}catch{}}var xn=Math.clz32?Math.clz32:Ed,qr=Math.log,Nd=Math.LN2;function Ed(r){return r>>>=0,r===0?32:31-(qr(r)/Nd|0)|0}var bn=64,Dr=4194304;function Vs(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 Uo(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 H=T&~y;H!==0?m=Vs(H):(x&=T,x!==0&&(m=Vs(x)))}else T=c&~y,T!==0?m=Vs(T):x!==0&&(m=Vs(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-xn(o),y=1<<c,m|=r[c],o&=~y;return m}function Hl(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 Gl(r,o){for(var c=r.suspendedLanes,m=r.pingedLanes,y=r.expirationTimes,x=r.pendingLanes;0<x;){var T=31-xn(x),H=1<<T,ee=y[T];ee===-1?((H&c)===0||(H&m)!==0)&&(y[T]=Hl(H,o)):ee<=o&&(r.expiredLanes|=H),x&=~H}}function pr(r){return r=r.pendingLanes&-1073741825,r!==0?r:r&1073741824?1073741824:0}function li(){var r=bn;return bn<<=1,(bn&4194240)===0&&(bn=64),r}function Wo(r){for(var o=[],c=0;31>c;c++)o.push(r);return o}function mr(r,o,c){r.pendingLanes|=o,o!==536870912&&(r.suspendedLanes=0,r.pingedLanes=0),r=r.eventTimes,o=31-xn(o),r[o]=c}function ci(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-xn(c),x=1<<y;o[y]=0,m[y]=-1,r[y]=-1,c&=~x}}function Ho(r,o){var c=r.entangledLanes|=o;for(r=r.entanglements;c;){var m=31-xn(c),y=1<<m;y&o|r[m]&o&&(r[m]|=o),c&=~y}}var tt=0;function ui(r){return r&=-r,1<r?4<r?(r&268435455)!==0?16:536870912:4:1}var di,Wt,Ys,Ks,Go,hi=!1,gr=[],Yn=null,Ht=null,yr=null,ls=new Map,Xs=new Map,vr=[],Vl="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 Yl(r,o){switch(r){case"focusin":case"focusout":Yn=null;break;case"dragenter":case"dragleave":Ht=null;break;case"mouseover":case"mouseout":yr=null;break;case"pointerover":case"pointerout":ls.delete(o.pointerId);break;case"gotpointercapture":case"lostpointercapture":Xs.delete(o.pointerId)}}function kn(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=qi(o),o!==null&&Wt(o)),r):(r.eventSystemFlags|=m,o=r.targetContainers,y!==null&&o.indexOf(y)===-1&&o.push(y),r)}function Qs(r,o,c,m,y){switch(o){case"focusin":return Yn=kn(Yn,r,o,c,m,y),!0;case"dragenter":return Ht=kn(Ht,r,o,c,m,y),!0;case"mouseover":return yr=kn(yr,r,o,c,m,y),!0;case"pointerover":var x=y.pointerId;return ls.set(x,kn(ls.get(x)||null,r,o,c,m,y)),!0;case"gotpointercapture":return x=y.pointerId,Xs.set(x,kn(Xs.get(x)||null,r,o,c,m,y)),!0}return!1}function fi(r){var o=io(r.target);if(o!==null){var c=Mn(o);if(c!==null){if(o=c.tag,o===13){if(o=qo(c),o!==null){r.blockedOn=o,Go(r.priority,function(){Ys(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=Ko(r.domEventName,r.eventSystemFlags,o[0],r.nativeEvent);if(c===null){c=r.nativeEvent;var m=new c.constructor(c.type,c);at=m,c.target.dispatchEvent(m),at=null}else return o=qi(c),o!==null&&Wt(o),r.blockedOn=c,!1;o.shift()}return!0}function In(r,o,c){cs(r)&&c.delete(o)}function Cd(){hi=!1,Yn!==null&&cs(Yn)&&(Yn=null),Ht!==null&&cs(Ht)&&(Ht=null),yr!==null&&cs(yr)&&(yr=null),ls.forEach(In),Xs.forEach(In)}function Zt(r,o){r.blockedOn===o&&(r.blockedOn=null,hi||(hi=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Cd)))}function Fr(r){function o(y){return Zt(y,r)}if(0<gr.length){Zt(gr[0],r);for(var c=1;c<gr.length;c++){var m=gr[c];m.blockedOn===r&&(m.blockedOn=null)}}for(Yn!==null&&Zt(Yn,r),Ht!==null&&Zt(Ht,r),yr!==null&&Zt(yr,r),ls.forEach(o),Xs.forEach(o),c=0;c<vr.length;c++)m=vr[c],m.blockedOn===r&&(m.blockedOn=null);for(;0<vr.length&&(c=vr[0],c.blockedOn===null);)fi(c),c.blockedOn===null&&vr.shift()}var wr=j.ReactCurrentBatchConfig,Zs=!0;function Vo(r,o,c,m){var y=tt,x=wr.transition;wr.transition=null;try{tt=1,Yo(r,o,c,m)}finally{tt=y,wr.transition=x}}function pi(r,o,c,m){var y=tt,x=wr.transition;wr.transition=null;try{tt=4,Yo(r,o,c,m)}finally{tt=y,wr.transition=x}}function Yo(r,o,c,m){if(Zs){var y=Ko(r,o,c,m);if(y===null)Dd(r,o,m,us,c),Yl(r,m);else if(Qs(y,r,o,c,m))m.stopPropagation();else if(Yl(r,m),o&4&&-1<Vl.indexOf(r)){for(;y!==null;){var x=qi(y);if(x!==null&&di(x),x=Ko(r,o,c,m),x===null&&Dd(r,o,m,us,c),x===y)break;y=x}y!==null&&m.stopPropagation()}else Dd(r,o,m,null,c)}}var us=null;function Ko(r,o,c,m){if(us=null,r=vt(m),r=io(r),r!==null)if(o=Mn(r),o===null)r=null;else if(c=o.tag,c===13){if(r=qo(o),r!==null)return r;r=null}else if(c===3){if(o.stateNode.current.memoizedState.isDehydrated)return o.tag===3?o.stateNode.containerInfo:null;r=null}else o!==r&&(r=null);return us=r,null}function Xo(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(zo()){case Vn:return 1;case Bo:return 4;case Pr:case Xt:return 16;case Lr:return 536870912;default:return 16}default:return 16}}var Kn=null,xr=null,Js=null;function mi(){if(Js)return Js;var r,o=xr,c=o.length,m,y="value"in Kn?Kn.value:Kn.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 Js=y.slice(r,1<m?1-m:void 0)}function ds(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 Qo(){return!0}function Zo(){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 H in r)r.hasOwnProperty(H)&&(c=r[H],this[H]=c?c(x):x[H]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?Qo:Zo,this.isPropagationStopped=Zo,this}return J(o.prototype,{preventDefault:function(){this.defaultPrevented=!0;var c=this.nativeEvent;c&&(c.preventDefault?c.preventDefault():typeof c.returnValue!="unknown"&&(c.returnValue=!1),this.isDefaultPrevented=Qo)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=Qo)},persist:function(){},isPersistent:Qo}),o}var zr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},gi=jt(zr),hs=J({},zr,{view:0,detail:0}),Kl=jt(hs),yi,Jt,eo,fs=J({},hs,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ta,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!==eo&&(eo&&r.type==="mousemove"?(yi=r.screenX-eo.screenX,Jt=r.screenY-eo.screenY):Jt=yi=0,eo=r),yi)},movementY:function(r){return"movementY"in r?r.movementY:Jt}}),Br=jt(fs),to=J({},fs,{dataTransfer:0}),vi=jt(to),wi=J({},hs,{relatedTarget:0}),Jo=jt(wi),ea=J({},zr,{animationName:0,elapsedTime:0,pseudoElement:0}),Xl=jt(ea),jd=J({},zr,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),Td=jt(jd),Ql=J({},zr,{data:0}),Zl=jt(Ql),Rd={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},xi={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"},br={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function bi(r){var o=this.nativeEvent;return o.getModifierState?o.getModifierState(r):(r=br[r])?!!o[r]:!1}function ta(){return bi}var Ad=J({},hs,{key:function(r){if(r.key){var o=Rd[r.key]||r.key;if(o!=="Unidentified")return o}return r.type==="keypress"?(r=ds(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?xi[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ta,charCode:function(r){return r.type==="keypress"?ds(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?ds(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),Md=jt(Ad),Jl=J({},fs,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ki=jt(Jl),kr=J({},hs,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ta}),Id=jt(kr),ec=J({},zr,{propertyName:0,elapsedTime:0,pseudoElement:0}),Od=jt(ec),na=J({},fs,{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}),$d=jt(na),an=[9,13,27,32],no=u&&"CompositionEvent"in window,ps=null;u&&"documentMode"in document&&(ps=document.documentMode);var tc=u&&"TextEvent"in window&&!ps,_i=u&&(!no||ps&&8<ps&&11>=ps),ra=" ",ro=!1;function sa(r,o){switch(r){case"keyup":return an.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 Xn=!1;function nc(r,o){switch(r){case"compositionend":return Si(o);case"keypress":return o.which!==32?null:(ro=!0,ra);case"textInput":return r=o.data,r===ra&&ro?null:r;default:return null}}function Ni(r,o){if(Xn)return r==="compositionend"||!no&&sa(r,o)?(r=mi(),Js=xr=Kn=null,Xn=!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 _i&&o.locale!=="ko"?null:o.data;default:return null}}var Ei={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 Ci(r){var o=r&&r.nodeName&&r.nodeName.toLowerCase();return o==="input"?!!Ei[r.type]:o==="textarea"}function $t(r,o,c,m){Io(m),o=hc(o,"onChange"),0<o.length&&(c=new gi("onChange","change",null,c,m),r.push({event:c,listeners:o}))}var ms=null,gs=null;function Pd(r){v0(r,0)}function oa(r){var o=pa(r);if(Ve(o))return r}function rc(r,o){if(r==="change")return o}var ys=!1;if(u){var ji;if(u){var Qn="oninput"in document;if(!Qn){var aa=document.createElement("div");aa.setAttribute("oninput","return;"),Qn=typeof aa.oninput=="function"}ji=Qn}else ji=!1;ys=ji&&(!document.documentMode||9<document.documentMode)}function sc(){ms&&(ms.detachEvent("onpropertychange",oc),gs=ms=null)}function oc(r){if(r.propertyName==="value"&&oa(gs)){var o=[];$t(o,gs,r,vt(r)),Po(Pd,o)}}function Ur(r,o,c){r==="focusin"?(sc(),ms=o,gs=c,ms.attachEvent("onpropertychange",oc)):r==="focusout"&&sc()}function Ti(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return oa(gs)}function Ld(r,o){if(r==="click")return oa(o)}function ac(r,o){if(r==="input"||r==="change")return oa(o)}function ic(r,o){return r===o&&(r!==0||1/r===1/o)||r!==r&&o!==o}var _n=typeof Object.is=="function"?Object.is:ic;function vs(r,o){if(_n(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(!f.call(o,y)||!_n(r[y],o[y]))return!1}return!0}function ia(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function la(r,o){var c=ia(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=ia(c)}}function so(r,o){return r&&o?r===o?!0:r&&r.nodeType===3?!1:o&&o.nodeType===3?so(r,o.parentNode):"contains"in r?r.contains(o):r.compareDocumentPosition?!!(r.compareDocumentPosition(o)&16):!1:!1}function ca(){for(var r=window,o=Le();o instanceof r.HTMLIFrameElement;){try{var c=typeof o.contentWindow.location.href=="string"}catch{c=!1}if(c)r=o.contentWindow;else break;o=Le(r.document)}return o}function Ri(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 lc(r){var o=ca(),c=r.focusedElem,m=r.selectionRange;if(o!==c&&c&&c.ownerDocument&&so(c.ownerDocument.documentElement,c)){if(m!==null&&Ri(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=la(c,x);var T=la(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 cc=u&&"documentMode"in document&&11>=document.documentMode,Wr=null,ua=null,F=null,G=!1;function ce(r,o,c){var m=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;G||Wr==null||Wr!==Le(m)||(m=Wr,"selectionStart"in m&&Ri(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}),F&&vs(F,m)||(F=m,m=hc(ua,"onSelect"),0<m.length&&(o=new gi("onSelect","select",null,o,c),r.push({event:o,listeners:m}),o.target=Wr)))}function he(r,o){var c={};return c[r.toLowerCase()]=o.toLowerCase(),c["Webkit"+r]="webkit"+o,c["Moz"+r]="moz"+o,c}var Ee={animationend:he("Animation","AnimationEnd"),animationiteration:he("Animation","AnimationIteration"),animationstart:he("Animation","AnimationStart"),transitionend:he("Transition","TransitionEnd")},Ae={},He={};u&&(He=document.createElement("div").style,"AnimationEvent"in window||(delete Ee.animationend.animation,delete Ee.animationiteration.animation,delete Ee.animationstart.animation),"TransitionEvent"in window||delete Ee.transitionend.transition);function Ze(r){if(Ae[r])return Ae[r];if(!Ee[r])return r;var o=Ee[r],c;for(c in o)if(o.hasOwnProperty(c)&&c in He)return Ae[r]=o[c];return r}var ht=Ze("animationend"),ot=Ze("animationiteration"),ln=Ze("animationstart"),oo=Ze("transitionend"),Ai=new Map,uc="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 Zn(r,o){Ai.set(r,o),i(o,[r])}for(var Mi=0;Mi<uc.length;Mi++){var da=uc[Mi],Ii=da.toLowerCase(),ao=da[0].toUpperCase()+da.slice(1);Zn(Ii,"on"+ao)}Zn(ht,"onAnimationEnd"),Zn(ot,"onAnimationIteration"),Zn(ln,"onAnimationStart"),Zn("dblclick","onDoubleClick"),Zn("focusin","onFocus"),Zn("focusout","onBlur"),Zn(oo,"onTransitionEnd"),l("onMouseEnter",["mouseout","mouseover"]),l("onMouseLeave",["mouseout","mouseover"]),l("onPointerEnter",["pointerout","pointerover"]),l("onPointerLeave",["pointerout","pointerover"]),i("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),i("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),i("onBeforeInput",["compositionend","keypress","textInput","paste"]),i("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),i("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),i("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Jn="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(" "),Tt=new Set("cancel close invalid load scroll toggle".split(" ").concat(Jn));function Oi(r,o,c){var m=r.type||"unknown-event";r.currentTarget=c,Us(m,o,void 0,r),r.currentTarget=null}function v0(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 H=m[T],ee=H.instance,ue=H.currentTarget;if(H=H.listener,ee!==x&&y.isPropagationStopped())break e;Oi(y,H,ue),x=ee}else for(T=0;T<m.length;T++){if(H=m[T],ee=H.instance,ue=H.currentTarget,H=H.listener,ee!==x&&y.isPropagationStopped())break e;Oi(y,H,ue),x=ee}}}if(Or)throw r=as,Or=!1,as=null,r}function ft(r,o){var c=o[Hd];c===void 0&&(c=o[Hd]=new Set);var m=r+"__bubble";c.has(m)||(w0(o,r,2,!1),c.add(m))}function qd(r,o,c){var m=0;o&&(m|=4),w0(c,r,m,o)}var dc="_reactListening"+Math.random().toString(36).slice(2);function $i(r){if(!r[dc]){r[dc]=!0,s.forEach(function(c){c!=="selectionchange"&&(Tt.has(c)||qd(c,!1,r),qd(c,!0,r))});var o=r.nodeType===9?r:r.ownerDocument;o===null||o[dc]||(o[dc]=!0,qd("selectionchange",!1,o))}}function w0(r,o,c,m){switch(Xo(o)){case 1:var y=Vo;break;case 4:y=pi;break;default:y=Yo}c=y.bind(null,o,c,r),y=void 0,!fr||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 Dd(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 H=m.stateNode.containerInfo;if(H===y||H.nodeType===8&&H.parentNode===y)break;if(T===4)for(T=m.return;T!==null;){var ee=T.tag;if((ee===3||ee===4)&&(ee=T.stateNode.containerInfo,ee===y||ee.nodeType===8&&ee.parentNode===y))return;T=T.return}for(;H!==null;){if(T=io(H),T===null)return;if(ee=T.tag,ee===5||ee===6){m=x=T;continue e}H=H.parentNode}}m=m.return}Po(function(){var ue=x,ye=vt(c),ve=[];e:{var ge=Ai.get(r);if(ge!==void 0){var Ce=gi,Te=r;switch(r){case"keypress":if(ds(c)===0)break e;case"keydown":case"keyup":Ce=Md;break;case"focusin":Te="focus",Ce=Jo;break;case"focusout":Te="blur",Ce=Jo;break;case"beforeblur":case"afterblur":Ce=Jo;break;case"click":if(c.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Ce=Br;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Ce=vi;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Ce=Id;break;case ht:case ot:case ln:Ce=Xl;break;case oo:Ce=Od;break;case"scroll":Ce=Kl;break;case"wheel":Ce=$d;break;case"copy":case"cut":case"paste":Ce=Td;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Ce=ki}var Me=(o&4)!==0,Et=!Me&&r==="scroll",ae=Me?ge!==null?ge+"Capture":null:ge;Me=[];for(var re=ue,le;re!==null;){le=re;var xe=le.stateNode;if(le.tag===5&&xe!==null&&(le=xe,ae!==null&&(xe=Ot(re,ae),xe!=null&&Me.push(Pi(re,xe,le)))),Et)break;re=re.return}0<Me.length&&(ge=new Ce(ge,Te,null,c,ye),ve.push({event:ge,listeners:Me}))}}if((o&7)===0){e:{if(ge=r==="mouseover"||r==="pointerover",Ce=r==="mouseout"||r==="pointerout",ge&&c!==at&&(Te=c.relatedTarget||c.fromElement)&&(io(Te)||Te[Hr]))break e;if((Ce||ge)&&(ge=ye.window===ye?ye:(ge=ye.ownerDocument)?ge.defaultView||ge.parentWindow:window,Ce?(Te=c.relatedTarget||c.toElement,Ce=ue,Te=Te?io(Te):null,Te!==null&&(Et=Mn(Te),Te!==Et||Te.tag!==5&&Te.tag!==6)&&(Te=null)):(Ce=null,Te=ue),Ce!==Te)){if(Me=Br,xe="onMouseLeave",ae="onMouseEnter",re="mouse",(r==="pointerout"||r==="pointerover")&&(Me=ki,xe="onPointerLeave",ae="onPointerEnter",re="pointer"),Et=Ce==null?ge:pa(Ce),le=Te==null?ge:pa(Te),ge=new Me(xe,re+"leave",Ce,c,ye),ge.target=Et,ge.relatedTarget=le,xe=null,io(ye)===ue&&(Me=new Me(ae,re+"enter",Te,c,ye),Me.target=le,Me.relatedTarget=Et,xe=Me),Et=xe,Ce&&Te)t:{for(Me=Ce,ae=Te,re=0,le=Me;le;le=ha(le))re++;for(le=0,xe=ae;xe;xe=ha(xe))le++;for(;0<re-le;)Me=ha(Me),re--;for(;0<le-re;)ae=ha(ae),le--;for(;re--;){if(Me===ae||ae!==null&&Me===ae.alternate)break t;Me=ha(Me),ae=ha(ae)}Me=null}else Me=null;Ce!==null&&x0(ve,ge,Ce,Me,!1),Te!==null&&Et!==null&&x0(ve,Et,Te,Me,!0)}}e:{if(ge=ue?pa(ue):window,Ce=ge.nodeName&&ge.nodeName.toLowerCase(),Ce==="select"||Ce==="input"&&ge.type==="file")var Ie=rc;else if(Ci(ge))if(ys)Ie=ac;else{Ie=Ti;var Fe=Ur}else(Ce=ge.nodeName)&&Ce.toLowerCase()==="input"&&(ge.type==="checkbox"||ge.type==="radio")&&(Ie=Ld);if(Ie&&(Ie=Ie(r,ue))){$t(ve,Ie,c,ye);break e}Fe&&Fe(r,ge,ue),r==="focusout"&&(Fe=ge._wrapperState)&&Fe.controlled&&ge.type==="number"&&Qe(ge,"number",ge.value)}switch(Fe=ue?pa(ue):window,r){case"focusin":(Ci(Fe)||Fe.contentEditable==="true")&&(Wr=Fe,ua=ue,F=null);break;case"focusout":F=ua=Wr=null;break;case"mousedown":G=!0;break;case"contextmenu":case"mouseup":case"dragend":G=!1,ce(ve,c,ye);break;case"selectionchange":if(cc)break;case"keydown":case"keyup":ce(ve,c,ye)}var ze;if(no)e:{switch(r){case"compositionstart":var We="onCompositionStart";break e;case"compositionend":We="onCompositionEnd";break e;case"compositionupdate":We="onCompositionUpdate";break e}We=void 0}else Xn?sa(r,c)&&(We="onCompositionEnd"):r==="keydown"&&c.keyCode===229&&(We="onCompositionStart");We&&(_i&&c.locale!=="ko"&&(Xn||We!=="onCompositionStart"?We==="onCompositionEnd"&&Xn&&(ze=mi()):(Kn=ye,xr="value"in Kn?Kn.value:Kn.textContent,Xn=!0)),Fe=hc(ue,We),0<Fe.length&&(We=new Zl(We,r,null,c,ye),ve.push({event:We,listeners:Fe}),ze?We.data=ze:(ze=Si(c),ze!==null&&(We.data=ze)))),(ze=tc?nc(r,c):Ni(r,c))&&(ue=hc(ue,"onBeforeInput"),0<ue.length&&(ye=new Zl("onBeforeInput","beforeinput",null,c,ye),ve.push({event:ye,listeners:ue}),ye.data=ze))}v0(ve,o)})}function Pi(r,o,c){return{instance:r,listener:o,currentTarget:c}}function hc(r,o){for(var c=o+"Capture",m=[];r!==null;){var y=r,x=y.stateNode;y.tag===5&&x!==null&&(y=x,x=Ot(r,c),x!=null&&m.unshift(Pi(r,x,y)),x=Ot(r,o),x!=null&&m.push(Pi(r,x,y))),r=r.return}return m}function ha(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5);return r||null}function x0(r,o,c,m,y){for(var x=o._reactName,T=[];c!==null&&c!==m;){var H=c,ee=H.alternate,ue=H.stateNode;if(ee!==null&&ee===m)break;H.tag===5&&ue!==null&&(H=ue,y?(ee=Ot(c,x),ee!=null&&T.unshift(Pi(c,ee,H))):y||(ee=Ot(c,x),ee!=null&&T.push(Pi(c,ee,H)))),c=c.return}T.length!==0&&r.push({event:o,listeners:T})}var bA=/\r\n?/g,kA=/\u0000|\uFFFD/g;function b0(r){return(typeof r=="string"?r:""+r).replace(bA,`
|
|
38
|
-
`).replace(kA,"")}function fc(r,o,c){if(o=b0(o),b0(r)!==o&&c)throw Error(n(425))}function pc(){}var Fd=null,zd=null;function Bd(r,o){return r==="textarea"||r==="noscript"||typeof o.children=="string"||typeof o.children=="number"||typeof o.dangerouslySetInnerHTML=="object"&&o.dangerouslySetInnerHTML!==null&&o.dangerouslySetInnerHTML.__html!=null}var Ud=typeof setTimeout=="function"?setTimeout:void 0,_A=typeof clearTimeout=="function"?clearTimeout:void 0,k0=typeof Promise=="function"?Promise:void 0,SA=typeof queueMicrotask=="function"?queueMicrotask:typeof k0<"u"?function(r){return k0.resolve(null).then(r).catch(NA)}:Ud;function NA(r){setTimeout(function(){throw r})}function Wd(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),Fr(o);return}m--}else c!=="$"&&c!=="$?"&&c!=="$!"||m++;c=y}while(c);Fr(o)}function ws(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 _0(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 fa=Math.random().toString(36).slice(2),_r="__reactFiber$"+fa,Li="__reactProps$"+fa,Hr="__reactContainer$"+fa,Hd="__reactEvents$"+fa,EA="__reactListeners$"+fa,CA="__reactHandles$"+fa;function io(r){var o=r[_r];if(o)return o;for(var c=r.parentNode;c;){if(o=c[Hr]||c[_r]){if(c=o.alternate,o.child!==null||c!==null&&c.child!==null)for(r=_0(r);r!==null;){if(c=r[_r])return c;r=_0(r)}return o}r=c,c=r.parentNode}return null}function qi(r){return r=r[_r]||r[Hr],!r||r.tag!==5&&r.tag!==6&&r.tag!==13&&r.tag!==3?null:r}function pa(r){if(r.tag===5||r.tag===6)return r.stateNode;throw Error(n(33))}function mc(r){return r[Li]||null}var Gd=[],ma=-1;function xs(r){return{current:r}}function pt(r){0>ma||(r.current=Gd[ma],Gd[ma]=null,ma--)}function ct(r,o){ma++,Gd[ma]=r.current,r.current=o}var bs={},en=xs(bs),dn=xs(!1),lo=bs;function ga(r,o){var c=r.type.contextTypes;if(!c)return bs;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 hn(r){return r=r.childContextTypes,r!=null}function gc(){pt(dn),pt(en)}function S0(r,o,c){if(en.current!==bs)throw Error(n(168));ct(en,o),ct(dn,c)}function N0(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,U(r)||"Unknown",y));return J({},c,m)}function yc(r){return r=(r=r.stateNode)&&r.__reactInternalMemoizedMergedChildContext||bs,lo=en.current,ct(en,r),ct(dn,dn.current),!0}function E0(r,o,c){var m=r.stateNode;if(!m)throw Error(n(169));c?(r=N0(r,o,lo),m.__reactInternalMemoizedMergedChildContext=r,pt(dn),pt(en),ct(en,r)):pt(dn),ct(dn,c)}var Gr=null,vc=!1,Vd=!1;function C0(r){Gr===null?Gr=[r]:Gr.push(r)}function jA(r){vc=!0,C0(r)}function ks(){if(!Vd&&Gr!==null){Vd=!0;var r=0,o=tt;try{var c=Gr;for(tt=1;r<c.length;r++){var m=c[r];do m=m(!0);while(m!==null)}Gr=null,vc=!1}catch(y){throw Gr!==null&&(Gr=Gr.slice(r+1)),Gn(Vn,ks),y}finally{tt=o,Vd=!1}}return null}var ya=[],va=0,wc=null,xc=0,On=[],$n=0,co=null,Vr=1,Yr="";function uo(r,o){ya[va++]=xc,ya[va++]=wc,wc=r,xc=o}function j0(r,o,c){On[$n++]=Vr,On[$n++]=Yr,On[$n++]=co,co=r;var m=Vr;r=Yr;var y=32-xn(m)-1;m&=~(1<<y),c+=1;var x=32-xn(o)+y;if(30<x){var T=y-y%5;x=(m&(1<<T)-1).toString(32),m>>=T,y-=T,Vr=1<<32-xn(o)+y|c<<y|m,Yr=x+r}else Vr=1<<x|c<<y|m,Yr=r}function Yd(r){r.return!==null&&(uo(r,1),j0(r,1,0))}function Kd(r){for(;r===wc;)wc=ya[--va],ya[va]=null,xc=ya[--va],ya[va]=null;for(;r===co;)co=On[--$n],On[$n]=null,Yr=On[--$n],On[$n]=null,Vr=On[--$n],On[$n]=null}var Sn=null,Nn=null,mt=!1,er=null;function T0(r,o){var c=Dn(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 R0(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,Sn=r,Nn=ws(o.firstChild),!0):!1;case 6:return o=r.pendingProps===""||o.nodeType!==3?null:o,o!==null?(r.stateNode=o,Sn=r,Nn=null,!0):!1;case 13:return o=o.nodeType!==8?null:o,o!==null?(c=co!==null?{id:Vr,overflow:Yr}:null,r.memoizedState={dehydrated:o,treeContext:c,retryLane:1073741824},c=Dn(18,null,null,0),c.stateNode=o,c.return=r,r.child=c,Sn=r,Nn=null,!0):!1;default:return!1}}function Xd(r){return(r.mode&1)!==0&&(r.flags&128)===0}function Qd(r){if(mt){var o=Nn;if(o){var c=o;if(!R0(r,o)){if(Xd(r))throw Error(n(418));o=ws(c.nextSibling);var m=Sn;o&&R0(r,o)?T0(m,c):(r.flags=r.flags&-4097|2,mt=!1,Sn=r)}}else{if(Xd(r))throw Error(n(418));r.flags=r.flags&-4097|2,mt=!1,Sn=r}}}function A0(r){for(r=r.return;r!==null&&r.tag!==5&&r.tag!==3&&r.tag!==13;)r=r.return;Sn=r}function bc(r){if(r!==Sn)return!1;if(!mt)return A0(r),mt=!0,!1;var o;if((o=r.tag!==3)&&!(o=r.tag!==5)&&(o=r.type,o=o!=="head"&&o!=="body"&&!Bd(r.type,r.memoizedProps)),o&&(o=Nn)){if(Xd(r))throw M0(),Error(n(418));for(;o;)T0(r,o),o=ws(o.nextSibling)}if(A0(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){Nn=ws(r.nextSibling);break e}o--}else c!=="$"&&c!=="$!"&&c!=="$?"||o++}r=r.nextSibling}Nn=null}}else Nn=Sn?ws(r.stateNode.nextSibling):null;return!0}function M0(){for(var r=Nn;r;)r=ws(r.nextSibling)}function wa(){Nn=Sn=null,mt=!1}function Zd(r){er===null?er=[r]:er.push(r)}var TA=j.ReactCurrentBatchConfig;function Di(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 H=y.refs;T===null?delete H[x]:H[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 kc(r,o){throw r=Object.prototype.toString.call(o),Error(n(31,r==="[object Object]"?"object with keys {"+Object.keys(o).join(", ")+"}":r))}function I0(r){var o=r._init;return o(r._payload)}function O0(r){function o(ae,re){if(r){var le=ae.deletions;le===null?(ae.deletions=[re],ae.flags|=16):le.push(re)}}function c(ae,re){if(!r)return null;for(;re!==null;)o(ae,re),re=re.sibling;return null}function m(ae,re){for(ae=new Map;re!==null;)re.key!==null?ae.set(re.key,re):ae.set(re.index,re),re=re.sibling;return ae}function y(ae,re){return ae=Rs(ae,re),ae.index=0,ae.sibling=null,ae}function x(ae,re,le){return ae.index=le,r?(le=ae.alternate,le!==null?(le=le.index,le<re?(ae.flags|=2,re):le):(ae.flags|=2,re)):(ae.flags|=1048576,re)}function T(ae){return r&&ae.alternate===null&&(ae.flags|=2),ae}function H(ae,re,le,xe){return re===null||re.tag!==6?(re=Uh(le,ae.mode,xe),re.return=ae,re):(re=y(re,le),re.return=ae,re)}function ee(ae,re,le,xe){var Ie=le.type;return Ie===O?ye(ae,re,le.props.children,xe,le.key):re!==null&&(re.elementType===Ie||typeof Ie=="object"&&Ie!==null&&Ie.$$typeof===B&&I0(Ie)===re.type)?(xe=y(re,le.props),xe.ref=Di(ae,re,le),xe.return=ae,xe):(xe=Gc(le.type,le.key,le.props,null,ae.mode,xe),xe.ref=Di(ae,re,le),xe.return=ae,xe)}function ue(ae,re,le,xe){return re===null||re.tag!==4||re.stateNode.containerInfo!==le.containerInfo||re.stateNode.implementation!==le.implementation?(re=Wh(le,ae.mode,xe),re.return=ae,re):(re=y(re,le.children||[]),re.return=ae,re)}function ye(ae,re,le,xe,Ie){return re===null||re.tag!==7?(re=wo(le,ae.mode,xe,Ie),re.return=ae,re):(re=y(re,le),re.return=ae,re)}function ve(ae,re,le){if(typeof re=="string"&&re!==""||typeof re=="number")return re=Uh(""+re,ae.mode,le),re.return=ae,re;if(typeof re=="object"&&re!==null){switch(re.$$typeof){case M:return le=Gc(re.type,re.key,re.props,null,ae.mode,le),le.ref=Di(ae,null,re),le.return=ae,le;case $:return re=Wh(re,ae.mode,le),re.return=ae,re;case B:var xe=re._init;return ve(ae,xe(re._payload),le)}if(ut(re)||W(re))return re=wo(re,ae.mode,le,null),re.return=ae,re;kc(ae,re)}return null}function ge(ae,re,le,xe){var Ie=re!==null?re.key:null;if(typeof le=="string"&&le!==""||typeof le=="number")return Ie!==null?null:H(ae,re,""+le,xe);if(typeof le=="object"&&le!==null){switch(le.$$typeof){case M:return le.key===Ie?ee(ae,re,le,xe):null;case $:return le.key===Ie?ue(ae,re,le,xe):null;case B:return Ie=le._init,ge(ae,re,Ie(le._payload),xe)}if(ut(le)||W(le))return Ie!==null?null:ye(ae,re,le,xe,null);kc(ae,le)}return null}function Ce(ae,re,le,xe,Ie){if(typeof xe=="string"&&xe!==""||typeof xe=="number")return ae=ae.get(le)||null,H(re,ae,""+xe,Ie);if(typeof xe=="object"&&xe!==null){switch(xe.$$typeof){case M:return ae=ae.get(xe.key===null?le:xe.key)||null,ee(re,ae,xe,Ie);case $:return ae=ae.get(xe.key===null?le:xe.key)||null,ue(re,ae,xe,Ie);case B:var Fe=xe._init;return Ce(ae,re,le,Fe(xe._payload),Ie)}if(ut(xe)||W(xe))return ae=ae.get(le)||null,ye(re,ae,xe,Ie,null);kc(re,xe)}return null}function Te(ae,re,le,xe){for(var Ie=null,Fe=null,ze=re,We=re=0,Bt=null;ze!==null&&We<le.length;We++){ze.index>We?(Bt=ze,ze=null):Bt=ze.sibling;var nt=ge(ae,ze,le[We],xe);if(nt===null){ze===null&&(ze=Bt);break}r&&ze&&nt.alternate===null&&o(ae,ze),re=x(nt,re,We),Fe===null?Ie=nt:Fe.sibling=nt,Fe=nt,ze=Bt}if(We===le.length)return c(ae,ze),mt&&uo(ae,We),Ie;if(ze===null){for(;We<le.length;We++)ze=ve(ae,le[We],xe),ze!==null&&(re=x(ze,re,We),Fe===null?Ie=ze:Fe.sibling=ze,Fe=ze);return mt&&uo(ae,We),Ie}for(ze=m(ae,ze);We<le.length;We++)Bt=Ce(ze,ae,We,le[We],xe),Bt!==null&&(r&&Bt.alternate!==null&&ze.delete(Bt.key===null?We:Bt.key),re=x(Bt,re,We),Fe===null?Ie=Bt:Fe.sibling=Bt,Fe=Bt);return r&&ze.forEach(function(As){return o(ae,As)}),mt&&uo(ae,We),Ie}function Me(ae,re,le,xe){var Ie=W(le);if(typeof Ie!="function")throw Error(n(150));if(le=Ie.call(le),le==null)throw Error(n(151));for(var Fe=Ie=null,ze=re,We=re=0,Bt=null,nt=le.next();ze!==null&&!nt.done;We++,nt=le.next()){ze.index>We?(Bt=ze,ze=null):Bt=ze.sibling;var As=ge(ae,ze,nt.value,xe);if(As===null){ze===null&&(ze=Bt);break}r&&ze&&As.alternate===null&&o(ae,ze),re=x(As,re,We),Fe===null?Ie=As:Fe.sibling=As,Fe=As,ze=Bt}if(nt.done)return c(ae,ze),mt&&uo(ae,We),Ie;if(ze===null){for(;!nt.done;We++,nt=le.next())nt=ve(ae,nt.value,xe),nt!==null&&(re=x(nt,re,We),Fe===null?Ie=nt:Fe.sibling=nt,Fe=nt);return mt&&uo(ae,We),Ie}for(ze=m(ae,ze);!nt.done;We++,nt=le.next())nt=Ce(ze,ae,We,nt.value,xe),nt!==null&&(r&&nt.alternate!==null&&ze.delete(nt.key===null?We:nt.key),re=x(nt,re,We),Fe===null?Ie=nt:Fe.sibling=nt,Fe=nt);return r&&ze.forEach(function(lM){return o(ae,lM)}),mt&&uo(ae,We),Ie}function Et(ae,re,le,xe){if(typeof le=="object"&&le!==null&&le.type===O&&le.key===null&&(le=le.props.children),typeof le=="object"&&le!==null){switch(le.$$typeof){case M:e:{for(var Ie=le.key,Fe=re;Fe!==null;){if(Fe.key===Ie){if(Ie=le.type,Ie===O){if(Fe.tag===7){c(ae,Fe.sibling),re=y(Fe,le.props.children),re.return=ae,ae=re;break e}}else if(Fe.elementType===Ie||typeof Ie=="object"&&Ie!==null&&Ie.$$typeof===B&&I0(Ie)===Fe.type){c(ae,Fe.sibling),re=y(Fe,le.props),re.ref=Di(ae,Fe,le),re.return=ae,ae=re;break e}c(ae,Fe);break}else o(ae,Fe);Fe=Fe.sibling}le.type===O?(re=wo(le.props.children,ae.mode,xe,le.key),re.return=ae,ae=re):(xe=Gc(le.type,le.key,le.props,null,ae.mode,xe),xe.ref=Di(ae,re,le),xe.return=ae,ae=xe)}return T(ae);case $:e:{for(Fe=le.key;re!==null;){if(re.key===Fe)if(re.tag===4&&re.stateNode.containerInfo===le.containerInfo&&re.stateNode.implementation===le.implementation){c(ae,re.sibling),re=y(re,le.children||[]),re.return=ae,ae=re;break e}else{c(ae,re);break}else o(ae,re);re=re.sibling}re=Wh(le,ae.mode,xe),re.return=ae,ae=re}return T(ae);case B:return Fe=le._init,Et(ae,re,Fe(le._payload),xe)}if(ut(le))return Te(ae,re,le,xe);if(W(le))return Me(ae,re,le,xe);kc(ae,le)}return typeof le=="string"&&le!==""||typeof le=="number"?(le=""+le,re!==null&&re.tag===6?(c(ae,re.sibling),re=y(re,le),re.return=ae,ae=re):(c(ae,re),re=Uh(le,ae.mode,xe),re.return=ae,ae=re),T(ae)):c(ae,re)}return Et}var xa=O0(!0),$0=O0(!1),_c=xs(null),Sc=null,ba=null,Jd=null;function eh(){Jd=ba=Sc=null}function th(r){var o=_c.current;pt(_c),r._currentValue=o}function nh(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 ka(r,o){Sc=r,Jd=ba=null,r=r.dependencies,r!==null&&r.firstContext!==null&&((r.lanes&o)!==0&&(fn=!0),r.firstContext=null)}function Pn(r){var o=r._currentValue;if(Jd!==r)if(r={context:r,memoizedValue:o,next:null},ba===null){if(Sc===null)throw Error(n(308));ba=r,Sc.dependencies={lanes:0,firstContext:r}}else ba=ba.next=r;return o}var ho=null;function rh(r){ho===null?ho=[r]:ho.push(r)}function P0(r,o,c,m){var y=o.interleaved;return y===null?(c.next=c,rh(o)):(c.next=y.next,y.next=c),o.interleaved=c,Kr(r,m)}function Kr(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 _s=!1;function sh(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function L0(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 Xr(r,o){return{eventTime:r,lane:o,tag:0,payload:null,callback:null,next:null}}function Ss(r,o,c){var m=r.updateQueue;if(m===null)return null;if(m=m.shared,(et&2)!==0){var y=m.pending;return y===null?o.next=o:(o.next=y.next,y.next=o),m.pending=o,Kr(r,c)}return y=m.interleaved,y===null?(o.next=o,rh(m)):(o.next=y.next,y.next=o),m.interleaved=o,Kr(r,c)}function Nc(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,Ho(r,c)}}function q0(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 Ec(r,o,c,m){var y=r.updateQueue;_s=!1;var x=y.firstBaseUpdate,T=y.lastBaseUpdate,H=y.shared.pending;if(H!==null){y.shared.pending=null;var ee=H,ue=ee.next;ee.next=null,T===null?x=ue:T.next=ue,T=ee;var ye=r.alternate;ye!==null&&(ye=ye.updateQueue,H=ye.lastBaseUpdate,H!==T&&(H===null?ye.firstBaseUpdate=ue:H.next=ue,ye.lastBaseUpdate=ee))}if(x!==null){var ve=y.baseState;T=0,ye=ue=ee=null,H=x;do{var ge=H.lane,Ce=H.eventTime;if((m&ge)===ge){ye!==null&&(ye=ye.next={eventTime:Ce,lane:0,tag:H.tag,payload:H.payload,callback:H.callback,next:null});e:{var Te=r,Me=H;switch(ge=o,Ce=c,Me.tag){case 1:if(Te=Me.payload,typeof Te=="function"){ve=Te.call(Ce,ve,ge);break e}ve=Te;break e;case 3:Te.flags=Te.flags&-65537|128;case 0:if(Te=Me.payload,ge=typeof Te=="function"?Te.call(Ce,ve,ge):Te,ge==null)break e;ve=J({},ve,ge);break e;case 2:_s=!0}}H.callback!==null&&H.lane!==0&&(r.flags|=64,ge=y.effects,ge===null?y.effects=[H]:ge.push(H))}else Ce={eventTime:Ce,lane:ge,tag:H.tag,payload:H.payload,callback:H.callback,next:null},ye===null?(ue=ye=Ce,ee=ve):ye=ye.next=Ce,T|=ge;if(H=H.next,H===null){if(H=y.shared.pending,H===null)break;ge=H,H=ge.next,ge.next=null,y.lastBaseUpdate=ge,y.shared.pending=null}}while(!0);if(ye===null&&(ee=ve),y.baseState=ee,y.firstBaseUpdate=ue,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);mo|=T,r.lanes=T,r.memoizedState=ve}}function D0(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 Fi={},Sr=xs(Fi),zi=xs(Fi),Bi=xs(Fi);function fo(r){if(r===Fi)throw Error(n(174));return r}function oh(r,o){switch(ct(Bi,o),ct(zi,r),ct(Sr,Fi),r=o.nodeType,r){case 9:case 11:o=(o=o.documentElement)?o.namespaceURI:Ue(null,"");break;default:r=r===8?o.parentNode:o,o=r.namespaceURI||null,r=r.tagName,o=Ue(o,r)}pt(Sr),ct(Sr,o)}function _a(){pt(Sr),pt(zi),pt(Bi)}function F0(r){fo(Bi.current);var o=fo(Sr.current),c=Ue(o,r.type);o!==c&&(ct(zi,r),ct(Sr,c))}function ah(r){zi.current===r&&(pt(Sr),pt(zi))}var bt=xs(0);function Cc(r){for(var o=r;o!==null;){if(o.tag===13){var c=o.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||c.data==="$?"||c.data==="$!"))return o}else if(o.tag===19&&o.memoizedProps.revealOrder!==void 0){if((o.flags&128)!==0)return o}else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===r)break;for(;o.sibling===null;){if(o.return===null||o.return===r)return null;o=o.return}o.sibling.return=o.return,o=o.sibling}return null}var ih=[];function lh(){for(var r=0;r<ih.length;r++)ih[r]._workInProgressVersionPrimary=null;ih.length=0}var jc=j.ReactCurrentDispatcher,ch=j.ReactCurrentBatchConfig,po=0,kt=null,Pt=null,Ft=null,Tc=!1,Ui=!1,Wi=0,RA=0;function tn(){throw Error(n(321))}function uh(r,o){if(o===null)return!1;for(var c=0;c<o.length&&c<r.length;c++)if(!_n(r[c],o[c]))return!1;return!0}function dh(r,o,c,m,y,x){if(po=x,kt=o,o.memoizedState=null,o.updateQueue=null,o.lanes=0,jc.current=r===null||r.memoizedState===null?OA:$A,r=c(m,y),Ui){x=0;do{if(Ui=!1,Wi=0,25<=x)throw Error(n(301));x+=1,Ft=Pt=null,o.updateQueue=null,jc.current=PA,r=c(m,y)}while(Ui)}if(jc.current=Mc,o=Pt!==null&&Pt.next!==null,po=0,Ft=Pt=kt=null,Tc=!1,o)throw Error(n(300));return r}function hh(){var r=Wi!==0;return Wi=0,r}function Nr(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ft===null?kt.memoizedState=Ft=r:Ft=Ft.next=r,Ft}function Ln(){if(Pt===null){var r=kt.alternate;r=r!==null?r.memoizedState:null}else r=Pt.next;var o=Ft===null?kt.memoizedState:Ft.next;if(o!==null)Ft=o,Pt=r;else{if(r===null)throw Error(n(310));Pt=r,r={memoizedState:Pt.memoizedState,baseState:Pt.baseState,baseQueue:Pt.baseQueue,queue:Pt.queue,next:null},Ft===null?kt.memoizedState=Ft=r:Ft=Ft.next=r}return Ft}function Hi(r,o){return typeof o=="function"?o(r):o}function fh(r){var o=Ln(),c=o.queue;if(c===null)throw Error(n(311));c.lastRenderedReducer=r;var m=Pt,y=m.baseQueue,x=c.pending;if(x!==null){if(y!==null){var T=y.next;y.next=x.next,x.next=T}m.baseQueue=y=x,c.pending=null}if(y!==null){x=y.next,m=m.baseState;var H=T=null,ee=null,ue=x;do{var ye=ue.lane;if((po&ye)===ye)ee!==null&&(ee=ee.next={lane:0,action:ue.action,hasEagerState:ue.hasEagerState,eagerState:ue.eagerState,next:null}),m=ue.hasEagerState?ue.eagerState:r(m,ue.action);else{var ve={lane:ye,action:ue.action,hasEagerState:ue.hasEagerState,eagerState:ue.eagerState,next:null};ee===null?(H=ee=ve,T=m):ee=ee.next=ve,kt.lanes|=ye,mo|=ye}ue=ue.next}while(ue!==null&&ue!==x);ee===null?T=m:ee.next=H,_n(m,o.memoizedState)||(fn=!0),o.memoizedState=m,o.baseState=T,o.baseQueue=ee,c.lastRenderedState=m}if(r=c.interleaved,r!==null){y=r;do x=y.lane,kt.lanes|=x,mo|=x,y=y.next;while(y!==r)}else y===null&&(c.lanes=0);return[o.memoizedState,c.dispatch]}function ph(r){var o=Ln(),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);_n(x,o.memoizedState)||(fn=!0),o.memoizedState=x,o.baseQueue===null&&(o.baseState=x),c.lastRenderedState=x}return[x,m]}function z0(){}function B0(r,o){var c=kt,m=Ln(),y=o(),x=!_n(m.memoizedState,y);if(x&&(m.memoizedState=y,fn=!0),m=m.queue,mh(H0.bind(null,c,m,r),[r]),m.getSnapshot!==o||x||Ft!==null&&Ft.memoizedState.tag&1){if(c.flags|=2048,Gi(9,W0.bind(null,c,m,y,o),void 0,null),zt===null)throw Error(n(349));(po&30)!==0||U0(c,o,y)}return y}function U0(r,o,c){r.flags|=16384,r={getSnapshot:o,value:c},o=kt.updateQueue,o===null?(o={lastEffect:null,stores:null},kt.updateQueue=o,o.stores=[r]):(c=o.stores,c===null?o.stores=[r]:c.push(r))}function W0(r,o,c,m){o.value=c,o.getSnapshot=m,G0(o)&&V0(r)}function H0(r,o,c){return c(function(){G0(o)&&V0(r)})}function G0(r){var o=r.getSnapshot;r=r.value;try{var c=o();return!_n(r,c)}catch{return!0}}function V0(r){var o=Kr(r,1);o!==null&&sr(o,r,1,-1)}function Y0(r){var o=Nr();return typeof r=="function"&&(r=r()),o.memoizedState=o.baseState=r,r={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Hi,lastRenderedState:r},o.queue=r,r=r.dispatch=IA.bind(null,kt,r),[o.memoizedState,r]}function Gi(r,o,c,m){return r={tag:r,create:o,destroy:c,deps:m,next:null},o=kt.updateQueue,o===null?(o={lastEffect:null,stores:null},kt.updateQueue=o,o.lastEffect=r.next=r):(c=o.lastEffect,c===null?o.lastEffect=r.next=r:(m=c.next,c.next=r,r.next=m,o.lastEffect=r)),r}function K0(){return Ln().memoizedState}function Rc(r,o,c,m){var y=Nr();kt.flags|=r,y.memoizedState=Gi(1|o,c,void 0,m===void 0?null:m)}function Ac(r,o,c,m){var y=Ln();m=m===void 0?null:m;var x=void 0;if(Pt!==null){var T=Pt.memoizedState;if(x=T.destroy,m!==null&&uh(m,T.deps)){y.memoizedState=Gi(o,c,x,m);return}}kt.flags|=r,y.memoizedState=Gi(1|o,c,x,m)}function X0(r,o){return Rc(8390656,8,r,o)}function mh(r,o){return Ac(2048,8,r,o)}function Q0(r,o){return Ac(4,2,r,o)}function Z0(r,o){return Ac(4,4,r,o)}function J0(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 ex(r,o,c){return c=c!=null?c.concat([r]):null,Ac(4,4,J0.bind(null,o,r),c)}function gh(){}function tx(r,o){var c=Ln();o=o===void 0?null:o;var m=c.memoizedState;return m!==null&&o!==null&&uh(o,m[1])?m[0]:(c.memoizedState=[r,o],r)}function nx(r,o){var c=Ln();o=o===void 0?null:o;var m=c.memoizedState;return m!==null&&o!==null&&uh(o,m[1])?m[0]:(r=r(),c.memoizedState=[r,o],r)}function rx(r,o,c){return(po&21)===0?(r.baseState&&(r.baseState=!1,fn=!0),r.memoizedState=c):(_n(c,o)||(c=li(),kt.lanes|=c,mo|=c,r.baseState=!0),o)}function AA(r,o){var c=tt;tt=c!==0&&4>c?c:4,r(!0);var m=ch.transition;ch.transition={};try{r(!1),o()}finally{tt=c,ch.transition=m}}function sx(){return Ln().memoizedState}function MA(r,o,c){var m=js(r);if(c={lane:m,action:c,hasEagerState:!1,eagerState:null,next:null},ox(r))ax(o,c);else if(c=P0(r,o,c,m),c!==null){var y=un();sr(c,r,m,y),ix(c,o,m)}}function IA(r,o,c){var m=js(r),y={lane:m,action:c,hasEagerState:!1,eagerState:null,next:null};if(ox(r))ax(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,H=x(T,c);if(y.hasEagerState=!0,y.eagerState=H,_n(H,T)){var ee=o.interleaved;ee===null?(y.next=y,rh(o)):(y.next=ee.next,ee.next=y),o.interleaved=y;return}}catch{}finally{}c=P0(r,o,y,m),c!==null&&(y=un(),sr(c,r,m,y),ix(c,o,m))}}function ox(r){var o=r.alternate;return r===kt||o!==null&&o===kt}function ax(r,o){Ui=Tc=!0;var c=r.pending;c===null?o.next=o:(o.next=c.next,c.next=o),r.pending=o}function ix(r,o,c){if((c&4194240)!==0){var m=o.lanes;m&=r.pendingLanes,c|=m,o.lanes=c,Ho(r,c)}}var Mc={readContext:Pn,useCallback:tn,useContext:tn,useEffect:tn,useImperativeHandle:tn,useInsertionEffect:tn,useLayoutEffect:tn,useMemo:tn,useReducer:tn,useRef:tn,useState:tn,useDebugValue:tn,useDeferredValue:tn,useTransition:tn,useMutableSource:tn,useSyncExternalStore:tn,useId:tn,unstable_isNewReconciler:!1},OA={readContext:Pn,useCallback:function(r,o){return Nr().memoizedState=[r,o===void 0?null:o],r},useContext:Pn,useEffect:X0,useImperativeHandle:function(r,o,c){return c=c!=null?c.concat([r]):null,Rc(4194308,4,J0.bind(null,o,r),c)},useLayoutEffect:function(r,o){return Rc(4194308,4,r,o)},useInsertionEffect:function(r,o){return Rc(4,2,r,o)},useMemo:function(r,o){var c=Nr();return o=o===void 0?null:o,r=r(),c.memoizedState=[r,o],r},useReducer:function(r,o,c){var m=Nr();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=MA.bind(null,kt,r),[m.memoizedState,r]},useRef:function(r){var o=Nr();return r={current:r},o.memoizedState=r},useState:Y0,useDebugValue:gh,useDeferredValue:function(r){return Nr().memoizedState=r},useTransition:function(){var r=Y0(!1),o=r[0];return r=AA.bind(null,r[1]),Nr().memoizedState=r,[o,r]},useMutableSource:function(){},useSyncExternalStore:function(r,o,c){var m=kt,y=Nr();if(mt){if(c===void 0)throw Error(n(407));c=c()}else{if(c=o(),zt===null)throw Error(n(349));(po&30)!==0||U0(m,o,c)}y.memoizedState=c;var x={value:c,getSnapshot:o};return y.queue=x,X0(H0.bind(null,m,x,r),[r]),m.flags|=2048,Gi(9,W0.bind(null,m,x,c,o),void 0,null),c},useId:function(){var r=Nr(),o=zt.identifierPrefix;if(mt){var c=Yr,m=Vr;c=(m&~(1<<32-xn(m)-1)).toString(32)+c,o=":"+o+"R"+c,c=Wi++,0<c&&(o+="H"+c.toString(32)),o+=":"}else c=RA++,o=":"+o+"r"+c.toString(32)+":";return r.memoizedState=o},unstable_isNewReconciler:!1},$A={readContext:Pn,useCallback:tx,useContext:Pn,useEffect:mh,useImperativeHandle:ex,useInsertionEffect:Q0,useLayoutEffect:Z0,useMemo:nx,useReducer:fh,useRef:K0,useState:function(){return fh(Hi)},useDebugValue:gh,useDeferredValue:function(r){var o=Ln();return rx(o,Pt.memoizedState,r)},useTransition:function(){var r=fh(Hi)[0],o=Ln().memoizedState;return[r,o]},useMutableSource:z0,useSyncExternalStore:B0,useId:sx,unstable_isNewReconciler:!1},PA={readContext:Pn,useCallback:tx,useContext:Pn,useEffect:mh,useImperativeHandle:ex,useInsertionEffect:Q0,useLayoutEffect:Z0,useMemo:nx,useReducer:ph,useRef:K0,useState:function(){return ph(Hi)},useDebugValue:gh,useDeferredValue:function(r){var o=Ln();return Pt===null?o.memoizedState=r:rx(o,Pt.memoizedState,r)},useTransition:function(){var r=ph(Hi)[0],o=Ln().memoizedState;return[r,o]},useMutableSource:z0,useSyncExternalStore:B0,useId:sx,unstable_isNewReconciler:!1};function tr(r,o){if(r&&r.defaultProps){o=J({},o),r=r.defaultProps;for(var c in r)o[c]===void 0&&(o[c]=r[c]);return o}return o}function yh(r,o,c,m){o=r.memoizedState,c=c(m,o),c=c==null?o:J({},o,c),r.memoizedState=c,r.lanes===0&&(r.updateQueue.baseState=c)}var Ic={isMounted:function(r){return(r=r._reactInternals)?Mn(r)===r:!1},enqueueSetState:function(r,o,c){r=r._reactInternals;var m=un(),y=js(r),x=Xr(m,y);x.payload=o,c!=null&&(x.callback=c),o=Ss(r,x,y),o!==null&&(sr(o,r,y,m),Nc(o,r,y))},enqueueReplaceState:function(r,o,c){r=r._reactInternals;var m=un(),y=js(r),x=Xr(m,y);x.tag=1,x.payload=o,c!=null&&(x.callback=c),o=Ss(r,x,y),o!==null&&(sr(o,r,y,m),Nc(o,r,y))},enqueueForceUpdate:function(r,o){r=r._reactInternals;var c=un(),m=js(r),y=Xr(c,m);y.tag=2,o!=null&&(y.callback=o),o=Ss(r,y,m),o!==null&&(sr(o,r,m,c),Nc(o,r,m))}};function lx(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?!vs(c,m)||!vs(y,x):!0}function cx(r,o,c){var m=!1,y=bs,x=o.contextType;return typeof x=="object"&&x!==null?x=Pn(x):(y=hn(o)?lo:en.current,m=o.contextTypes,x=(m=m!=null)?ga(r,y):bs),o=new o(c,x),r.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,o.updater=Ic,r.stateNode=o,o._reactInternals=r,m&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=y,r.__reactInternalMemoizedMaskedChildContext=x),o}function ux(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&&Ic.enqueueReplaceState(o,o.state,null)}function vh(r,o,c,m){var y=r.stateNode;y.props=c,y.state=r.memoizedState,y.refs={},sh(r);var x=o.contextType;typeof x=="object"&&x!==null?y.context=Pn(x):(x=hn(o)?lo:en.current,y.context=ga(r,x)),y.state=r.memoizedState,x=o.getDerivedStateFromProps,typeof x=="function"&&(yh(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&&Ic.enqueueReplaceState(y,y.state,null),Ec(r,c,y,m),y.state=r.memoizedState),typeof y.componentDidMount=="function"&&(r.flags|=4194308)}function Sa(r,o){try{var c="",m=o;do c+=L(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 wh(r,o,c){return{value:r,source:null,stack:c??null,digest:o??null}}function xh(r,o){try{console.error(o.value)}catch(c){setTimeout(function(){throw c})}}var LA=typeof WeakMap=="function"?WeakMap:Map;function dx(r,o,c){c=Xr(-1,c),c.tag=3,c.payload={element:null};var m=o.value;return c.callback=function(){Fc||(Fc=!0,$h=m),xh(r,o)},c}function hx(r,o,c){c=Xr(-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(){xh(r,o)}}var x=r.stateNode;return x!==null&&typeof x.componentDidCatch=="function"&&(c.callback=function(){xh(r,o),typeof m!="function"&&(Es===null?Es=new Set([this]):Es.add(this));var T=o.stack;this.componentDidCatch(o.value,{componentStack:T!==null?T:""})}),c}function fx(r,o,c){var m=r.pingCache;if(m===null){m=r.pingCache=new LA;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=QA.bind(null,r,o,c),o.then(r,r))}function px(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 mx(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=Xr(-1,1),o.tag=2,Ss(c,o,1))),c.lanes|=1),r):(r.flags|=65536,r.lanes=y,r)}var qA=j.ReactCurrentOwner,fn=!1;function cn(r,o,c,m){o.child=r===null?$0(o,null,c,m):xa(o,r.child,c,m)}function gx(r,o,c,m,y){c=c.render;var x=o.ref;return ka(o,y),m=dh(r,o,c,m,x,y),c=hh(),r!==null&&!fn?(o.updateQueue=r.updateQueue,o.flags&=-2053,r.lanes&=~y,Qr(r,o,y)):(mt&&c&&Yd(o),o.flags|=1,cn(r,o,m,y),o.child)}function yx(r,o,c,m,y){if(r===null){var x=c.type;return typeof x=="function"&&!Bh(x)&&x.defaultProps===void 0&&c.compare===null&&c.defaultProps===void 0?(o.tag=15,o.type=x,vx(r,o,x,m,y)):(r=Gc(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:vs,c(T,m)&&r.ref===o.ref)return Qr(r,o,y)}return o.flags|=1,r=Rs(x,m),r.ref=o.ref,r.return=o,o.child=r}function vx(r,o,c,m,y){if(r!==null){var x=r.memoizedProps;if(vs(x,m)&&r.ref===o.ref)if(fn=!1,o.pendingProps=m=x,(r.lanes&y)!==0)(r.flags&131072)!==0&&(fn=!0);else return o.lanes=r.lanes,Qr(r,o,y)}return bh(r,o,c,m,y)}function wx(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},ct(Ea,En),En|=c;else{if((c&1073741824)===0)return r=x!==null?x.baseLanes|c:c,o.lanes=o.childLanes=1073741824,o.memoizedState={baseLanes:r,cachePool:null,transitions:null},o.updateQueue=null,ct(Ea,En),En|=r,null;o.memoizedState={baseLanes:0,cachePool:null,transitions:null},m=x!==null?x.baseLanes:c,ct(Ea,En),En|=m}else x!==null?(m=x.baseLanes|c,o.memoizedState=null):m=c,ct(Ea,En),En|=m;return cn(r,o,y,c),o.child}function xx(r,o){var c=o.ref;(r===null&&c!==null||r!==null&&r.ref!==c)&&(o.flags|=512,o.flags|=2097152)}function bh(r,o,c,m,y){var x=hn(c)?lo:en.current;return x=ga(o,x),ka(o,y),c=dh(r,o,c,m,x,y),m=hh(),r!==null&&!fn?(o.updateQueue=r.updateQueue,o.flags&=-2053,r.lanes&=~y,Qr(r,o,y)):(mt&&m&&Yd(o),o.flags|=1,cn(r,o,c,y),o.child)}function bx(r,o,c,m,y){if(hn(c)){var x=!0;yc(o)}else x=!1;if(ka(o,y),o.stateNode===null)$c(r,o),cx(o,c,m),vh(o,c,m,y),m=!0;else if(r===null){var T=o.stateNode,H=o.memoizedProps;T.props=H;var ee=T.context,ue=c.contextType;typeof ue=="object"&&ue!==null?ue=Pn(ue):(ue=hn(c)?lo:en.current,ue=ga(o,ue));var ye=c.getDerivedStateFromProps,ve=typeof ye=="function"||typeof T.getSnapshotBeforeUpdate=="function";ve||typeof T.UNSAFE_componentWillReceiveProps!="function"&&typeof T.componentWillReceiveProps!="function"||(H!==m||ee!==ue)&&ux(o,T,m,ue),_s=!1;var ge=o.memoizedState;T.state=ge,Ec(o,m,T,y),ee=o.memoizedState,H!==m||ge!==ee||dn.current||_s?(typeof ye=="function"&&(yh(o,c,ye,m),ee=o.memoizedState),(H=_s||lx(o,c,H,m,ge,ee,ue))?(ve||typeof T.UNSAFE_componentWillMount!="function"&&typeof T.componentWillMount!="function"||(typeof T.componentWillMount=="function"&&T.componentWillMount(),typeof T.UNSAFE_componentWillMount=="function"&&T.UNSAFE_componentWillMount()),typeof T.componentDidMount=="function"&&(o.flags|=4194308)):(typeof T.componentDidMount=="function"&&(o.flags|=4194308),o.memoizedProps=m,o.memoizedState=ee),T.props=m,T.state=ee,T.context=ue,m=H):(typeof T.componentDidMount=="function"&&(o.flags|=4194308),m=!1)}else{T=o.stateNode,L0(r,o),H=o.memoizedProps,ue=o.type===o.elementType?H:tr(o.type,H),T.props=ue,ve=o.pendingProps,ge=T.context,ee=c.contextType,typeof ee=="object"&&ee!==null?ee=Pn(ee):(ee=hn(c)?lo:en.current,ee=ga(o,ee));var Ce=c.getDerivedStateFromProps;(ye=typeof Ce=="function"||typeof T.getSnapshotBeforeUpdate=="function")||typeof T.UNSAFE_componentWillReceiveProps!="function"&&typeof T.componentWillReceiveProps!="function"||(H!==ve||ge!==ee)&&ux(o,T,m,ee),_s=!1,ge=o.memoizedState,T.state=ge,Ec(o,m,T,y);var Te=o.memoizedState;H!==ve||ge!==Te||dn.current||_s?(typeof Ce=="function"&&(yh(o,c,Ce,m),Te=o.memoizedState),(ue=_s||lx(o,c,ue,m,ge,Te,ee)||!1)?(ye||typeof T.UNSAFE_componentWillUpdate!="function"&&typeof T.componentWillUpdate!="function"||(typeof T.componentWillUpdate=="function"&&T.componentWillUpdate(m,Te,ee),typeof T.UNSAFE_componentWillUpdate=="function"&&T.UNSAFE_componentWillUpdate(m,Te,ee)),typeof T.componentDidUpdate=="function"&&(o.flags|=4),typeof T.getSnapshotBeforeUpdate=="function"&&(o.flags|=1024)):(typeof T.componentDidUpdate!="function"||H===r.memoizedProps&&ge===r.memoizedState||(o.flags|=4),typeof T.getSnapshotBeforeUpdate!="function"||H===r.memoizedProps&&ge===r.memoizedState||(o.flags|=1024),o.memoizedProps=m,o.memoizedState=Te),T.props=m,T.state=Te,T.context=ee,m=ue):(typeof T.componentDidUpdate!="function"||H===r.memoizedProps&&ge===r.memoizedState||(o.flags|=4),typeof T.getSnapshotBeforeUpdate!="function"||H===r.memoizedProps&&ge===r.memoizedState||(o.flags|=1024),m=!1)}return kh(r,o,c,m,x,y)}function kh(r,o,c,m,y,x){xx(r,o);var T=(o.flags&128)!==0;if(!m&&!T)return y&&E0(o,c,!1),Qr(r,o,x);m=o.stateNode,qA.current=o;var H=T&&typeof c.getDerivedStateFromError!="function"?null:m.render();return o.flags|=1,r!==null&&T?(o.child=xa(o,r.child,null,x),o.child=xa(o,null,H,x)):cn(r,o,H,x),o.memoizedState=m.state,y&&E0(o,c,!0),o.child}function kx(r){var o=r.stateNode;o.pendingContext?S0(r,o.pendingContext,o.pendingContext!==o.context):o.context&&S0(r,o.context,!1),oh(r,o.containerInfo)}function _x(r,o,c,m,y){return wa(),Zd(y),o.flags|=256,cn(r,o,c,m),o.child}var _h={dehydrated:null,treeContext:null,retryLane:0};function Sh(r){return{baseLanes:r,cachePool:null,transitions:null}}function Sx(r,o,c){var m=o.pendingProps,y=bt.current,x=!1,T=(o.flags&128)!==0,H;if((H=T)||(H=r!==null&&r.memoizedState===null?!1:(y&2)!==0),H?(x=!0,o.flags&=-129):(r===null||r.memoizedState!==null)&&(y|=1),ct(bt,y&1),r===null)return Qd(o),r=o.memoizedState,r!==null&&(r=r.dehydrated,r!==null)?((o.mode&1)===0?o.lanes=1:r.data==="$!"?o.lanes=8:o.lanes=1073741824,null):(T=m.children,r=m.fallback,x?(m=o.mode,x=o.child,T={mode:"hidden",children:T},(m&1)===0&&x!==null?(x.childLanes=0,x.pendingProps=T):x=Vc(T,m,0,null),r=wo(r,m,c,null),x.return=o,r.return=o,x.sibling=r,o.child=x,o.child.memoizedState=Sh(c),o.memoizedState=_h,r):Nh(o,T));if(y=r.memoizedState,y!==null&&(H=y.dehydrated,H!==null))return DA(r,o,T,m,H,y,c);if(x){x=m.fallback,T=o.mode,y=r.child,H=y.sibling;var ee={mode:"hidden",children:m.children};return(T&1)===0&&o.child!==y?(m=o.child,m.childLanes=0,m.pendingProps=ee,o.deletions=null):(m=Rs(y,ee),m.subtreeFlags=y.subtreeFlags&14680064),H!==null?x=Rs(H,x):(x=wo(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?Sh(c):{baseLanes:T.baseLanes|c,cachePool:null,transitions:T.transitions},x.memoizedState=T,x.childLanes=r.childLanes&~c,o.memoizedState=_h,m}return x=r.child,r=x.sibling,m=Rs(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 Nh(r,o){return o=Vc({mode:"visible",children:o},r.mode,0,null),o.return=r,r.child=o}function Oc(r,o,c,m){return m!==null&&Zd(m),xa(o,r.child,null,c),r=Nh(o,o.pendingProps.children),r.flags|=2,o.memoizedState=null,r}function DA(r,o,c,m,y,x,T){if(c)return o.flags&256?(o.flags&=-257,m=wh(Error(n(422))),Oc(r,o,T,m)):o.memoizedState!==null?(o.child=r.child,o.flags|=128,null):(x=m.fallback,y=o.mode,m=Vc({mode:"visible",children:m.children},y,0,null),x=wo(x,y,T,null),x.flags|=2,m.return=o,x.return=o,m.sibling=x,o.child=m,(o.mode&1)!==0&&xa(o,r.child,null,T),o.child.memoizedState=Sh(T),o.memoizedState=_h,x);if((o.mode&1)===0)return Oc(r,o,T,null);if(y.data==="$!"){if(m=y.nextSibling&&y.nextSibling.dataset,m)var H=m.dgst;return m=H,x=Error(n(419)),m=wh(x,m,void 0),Oc(r,o,T,m)}if(H=(T&r.childLanes)!==0,fn||H){if(m=zt,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,Kr(r,y),sr(m,r,y,-1))}return zh(),m=wh(Error(n(421))),Oc(r,o,T,m)}return y.data==="$?"?(o.flags|=128,o.child=r.child,o=ZA.bind(null,r),y._reactRetry=o,null):(r=x.treeContext,Nn=ws(y.nextSibling),Sn=o,mt=!0,er=null,r!==null&&(On[$n++]=Vr,On[$n++]=Yr,On[$n++]=co,Vr=r.id,Yr=r.overflow,co=o),o=Nh(o,m.children),o.flags|=4096,o)}function Nx(r,o,c){r.lanes|=o;var m=r.alternate;m!==null&&(m.lanes|=o),nh(r.return,o,c)}function Eh(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 Ex(r,o,c){var m=o.pendingProps,y=m.revealOrder,x=m.tail;if(cn(r,o,m.children,c),m=bt.current,(m&2)!==0)m=m&1|2,o.flags|=128;else{if(r!==null&&(r.flags&128)!==0)e:for(r=o.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&Nx(r,c,o);else if(r.tag===19)Nx(r,c,o);else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===o)break e;for(;r.sibling===null;){if(r.return===null||r.return===o)break e;r=r.return}r.sibling.return=r.return,r=r.sibling}m&=1}if(ct(bt,m),(o.mode&1)===0)o.memoizedState=null;else switch(y){case"forwards":for(c=o.child,y=null;c!==null;)r=c.alternate,r!==null&&Cc(r)===null&&(y=c),c=c.sibling;c=y,c===null?(y=o.child,o.child=null):(y=c.sibling,c.sibling=null),Eh(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&&Cc(r)===null){o.child=y;break}r=y.sibling,y.sibling=c,c=y,y=r}Eh(o,!0,c,null,x);break;case"together":Eh(o,!1,null,null,void 0);break;default:o.memoizedState=null}return o.child}function $c(r,o){(o.mode&1)===0&&r!==null&&(r.alternate=null,o.alternate=null,o.flags|=2)}function Qr(r,o,c){if(r!==null&&(o.dependencies=r.dependencies),mo|=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=Rs(r,r.pendingProps),o.child=c,c.return=o;r.sibling!==null;)r=r.sibling,c=c.sibling=Rs(r,r.pendingProps),c.return=o;c.sibling=null}return o.child}function FA(r,o,c){switch(o.tag){case 3:kx(o),wa();break;case 5:F0(o);break;case 1:hn(o.type)&&yc(o);break;case 4:oh(o,o.stateNode.containerInfo);break;case 10:var m=o.type._context,y=o.memoizedProps.value;ct(_c,m._currentValue),m._currentValue=y;break;case 13:if(m=o.memoizedState,m!==null)return m.dehydrated!==null?(ct(bt,bt.current&1),o.flags|=128,null):(c&o.child.childLanes)!==0?Sx(r,o,c):(ct(bt,bt.current&1),r=Qr(r,o,c),r!==null?r.sibling:null);ct(bt,bt.current&1);break;case 19:if(m=(c&o.childLanes)!==0,(r.flags&128)!==0){if(m)return Ex(r,o,c);o.flags|=128}if(y=o.memoizedState,y!==null&&(y.rendering=null,y.tail=null,y.lastEffect=null),ct(bt,bt.current),m)break;return null;case 22:case 23:return o.lanes=0,wx(r,o,c)}return Qr(r,o,c)}var Cx,Ch,jx,Tx;Cx=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}},Ch=function(){},jx=function(r,o,c,m){var y=r.memoizedProps;if(y!==m){r=o.stateNode,fo(Sr.current);var x=null;switch(c){case"input":y=De(r,y),m=De(r,m),x=[];break;case"select":y=J({},y,{value:void 0}),m=J({},m,{value:void 0}),x=[];break;case"textarea":y=rt(r,y),m=rt(r,m),x=[];break;default:typeof y.onClick!="function"&&typeof m.onClick=="function"&&(r.onclick=pc)}yt(c,m);var T;c=null;for(ue in y)if(!m.hasOwnProperty(ue)&&y.hasOwnProperty(ue)&&y[ue]!=null)if(ue==="style"){var H=y[ue];for(T in H)H.hasOwnProperty(T)&&(c||(c={}),c[T]="")}else ue!=="dangerouslySetInnerHTML"&&ue!=="children"&&ue!=="suppressContentEditableWarning"&&ue!=="suppressHydrationWarning"&&ue!=="autoFocus"&&(a.hasOwnProperty(ue)?x||(x=[]):(x=x||[]).push(ue,null));for(ue in m){var ee=m[ue];if(H=y!=null?y[ue]:void 0,m.hasOwnProperty(ue)&&ee!==H&&(ee!=null||H!=null))if(ue==="style")if(H){for(T in H)!H.hasOwnProperty(T)||ee&&ee.hasOwnProperty(T)||(c||(c={}),c[T]="");for(T in ee)ee.hasOwnProperty(T)&&H[T]!==ee[T]&&(c||(c={}),c[T]=ee[T])}else c||(x||(x=[]),x.push(ue,c)),c=ee;else ue==="dangerouslySetInnerHTML"?(ee=ee?ee.__html:void 0,H=H?H.__html:void 0,ee!=null&&H!==ee&&(x=x||[]).push(ue,ee)):ue==="children"?typeof ee!="string"&&typeof ee!="number"||(x=x||[]).push(ue,""+ee):ue!=="suppressContentEditableWarning"&&ue!=="suppressHydrationWarning"&&(a.hasOwnProperty(ue)?(ee!=null&&ue==="onScroll"&&ft("scroll",r),x||H===ee||(x=[])):(x=x||[]).push(ue,ee))}c&&(x=x||[]).push("style",c);var ue=x;(o.updateQueue=ue)&&(o.flags|=4)}},Tx=function(r,o,c,m){c!==m&&(o.flags|=4)};function Vi(r,o){if(!mt)switch(r.tailMode){case"hidden":o=r.tail;for(var c=null;o!==null;)o.alternate!==null&&(c=o),o=o.sibling;c===null?r.tail=null:c.sibling=null;break;case"collapsed":c=r.tail;for(var m=null;c!==null;)c.alternate!==null&&(m=c),c=c.sibling;m===null?o||r.tail===null?r.tail=null:r.tail.sibling=null:m.sibling=null}}function nn(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 zA(r,o,c){var m=o.pendingProps;switch(Kd(o),o.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return nn(o),null;case 1:return hn(o.type)&&gc(),nn(o),null;case 3:return m=o.stateNode,_a(),pt(dn),pt(en),lh(),m.pendingContext&&(m.context=m.pendingContext,m.pendingContext=null),(r===null||r.child===null)&&(bc(o)?o.flags|=4:r===null||r.memoizedState.isDehydrated&&(o.flags&256)===0||(o.flags|=1024,er!==null&&(qh(er),er=null))),Ch(r,o),nn(o),null;case 5:ah(o);var y=fo(Bi.current);if(c=o.type,r!==null&&o.stateNode!=null)jx(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 nn(o),null}if(r=fo(Sr.current),bc(o)){m=o.stateNode,c=o.type;var x=o.memoizedProps;switch(m[_r]=o,m[Li]=x,r=(o.mode&1)!==0,c){case"dialog":ft("cancel",m),ft("close",m);break;case"iframe":case"object":case"embed":ft("load",m);break;case"video":case"audio":for(y=0;y<Jn.length;y++)ft(Jn[y],m);break;case"source":ft("error",m);break;case"img":case"image":case"link":ft("error",m),ft("load",m);break;case"details":ft("toggle",m);break;case"input":Ne(m,x),ft("invalid",m);break;case"select":m._wrapperState={wasMultiple:!!x.multiple},ft("invalid",m);break;case"textarea":Ye(m,x),ft("invalid",m)}yt(c,x),y=null;for(var T in x)if(x.hasOwnProperty(T)){var H=x[T];T==="children"?typeof H=="string"?m.textContent!==H&&(x.suppressHydrationWarning!==!0&&fc(m.textContent,H,r),y=["children",H]):typeof H=="number"&&m.textContent!==""+H&&(x.suppressHydrationWarning!==!0&&fc(m.textContent,H,r),y=["children",""+H]):a.hasOwnProperty(T)&&H!=null&&T==="onScroll"&&ft("scroll",m)}switch(c){case"input":ke(m),se(m,x,!0);break;case"textarea":ke(m),we(m);break;case"select":case"option":break;default:typeof x.onClick=="function"&&(m.onclick=pc)}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=Pe(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[_r]=o,r[Li]=m,Cx(r,o,!1,!1),o.stateNode=r;e:{switch(T=Re(c,m),c){case"dialog":ft("cancel",r),ft("close",r),y=m;break;case"iframe":case"object":case"embed":ft("load",r),y=m;break;case"video":case"audio":for(y=0;y<Jn.length;y++)ft(Jn[y],r);y=m;break;case"source":ft("error",r),y=m;break;case"img":case"image":case"link":ft("error",r),ft("load",r),y=m;break;case"details":ft("toggle",r),y=m;break;case"input":Ne(r,m),y=De(r,m),ft("invalid",r);break;case"option":y=m;break;case"select":r._wrapperState={wasMultiple:!!m.multiple},y=J({},m,{value:void 0}),ft("invalid",r);break;case"textarea":Ye(r,m),y=rt(r,m),ft("invalid",r);break;default:y=m}yt(c,y),H=y;for(x in H)if(H.hasOwnProperty(x)){var ee=H[x];x==="style"?Be(r,ee):x==="dangerouslySetInnerHTML"?(ee=ee?ee.__html:void 0,ee!=null&&Oe(r,ee)):x==="children"?typeof ee=="string"?(c!=="textarea"||ee!=="")&&oe(r,ee):typeof ee=="number"&&oe(r,""+ee):x!=="suppressContentEditableWarning"&&x!=="suppressHydrationWarning"&&x!=="autoFocus"&&(a.hasOwnProperty(x)?ee!=null&&x==="onScroll"&&ft("scroll",r):ee!=null&&C(r,x,ee,T))}switch(c){case"input":ke(r),se(r,m,!1);break;case"textarea":ke(r),we(r);break;case"option":m.value!=null&&r.setAttribute("value",""+ie(m.value));break;case"select":r.multiple=!!m.multiple,x=m.value,x!=null?lt(r,!!m.multiple,x,!1):m.defaultValue!=null&<(r,!!m.multiple,m.defaultValue,!0);break;default:typeof y.onClick=="function"&&(r.onclick=pc)}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 nn(o),null;case 6:if(r&&o.stateNode!=null)Tx(r,o,r.memoizedProps,m);else{if(typeof m!="string"&&o.stateNode===null)throw Error(n(166));if(c=fo(Bi.current),fo(Sr.current),bc(o)){if(m=o.stateNode,c=o.memoizedProps,m[_r]=o,(x=m.nodeValue!==c)&&(r=Sn,r!==null))switch(r.tag){case 3:fc(m.nodeValue,c,(r.mode&1)!==0);break;case 5:r.memoizedProps.suppressHydrationWarning!==!0&&fc(m.nodeValue,c,(r.mode&1)!==0)}x&&(o.flags|=4)}else m=(c.nodeType===9?c:c.ownerDocument).createTextNode(m),m[_r]=o,o.stateNode=m}return nn(o),null;case 13:if(pt(bt),m=o.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(mt&&Nn!==null&&(o.mode&1)!==0&&(o.flags&128)===0)M0(),wa(),o.flags|=98560,x=!1;else if(x=bc(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[_r]=o}else wa(),(o.flags&128)===0&&(o.memoizedState=null),o.flags|=4;nn(o),x=!1}else er!==null&&(qh(er),er=null),x=!0;if(!x)return o.flags&65536?o:null}return(o.flags&128)!==0?(o.lanes=c,o):(m=m!==null,m!==(r!==null&&r.memoizedState!==null)&&m&&(o.child.flags|=8192,(o.mode&1)!==0&&(r===null||(bt.current&1)!==0?Lt===0&&(Lt=3):zh())),o.updateQueue!==null&&(o.flags|=4),nn(o),null);case 4:return _a(),Ch(r,o),r===null&&$i(o.stateNode.containerInfo),nn(o),null;case 10:return th(o.type._context),nn(o),null;case 17:return hn(o.type)&&gc(),nn(o),null;case 19:if(pt(bt),x=o.memoizedState,x===null)return nn(o),null;if(m=(o.flags&128)!==0,T=x.rendering,T===null)if(m)Vi(x,!1);else{if(Lt!==0||r!==null&&(r.flags&128)!==0)for(r=o.child;r!==null;){if(T=Cc(r),T!==null){for(o.flags|=128,Vi(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 ct(bt,bt.current&1|2),o.child}r=r.sibling}x.tail!==null&&dt()>Ca&&(o.flags|=128,m=!0,Vi(x,!1),o.lanes=4194304)}else{if(!m)if(r=Cc(T),r!==null){if(o.flags|=128,m=!0,c=r.updateQueue,c!==null&&(o.updateQueue=c,o.flags|=4),Vi(x,!0),x.tail===null&&x.tailMode==="hidden"&&!T.alternate&&!mt)return nn(o),null}else 2*dt()-x.renderingStartTime>Ca&&c!==1073741824&&(o.flags|=128,m=!0,Vi(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=dt(),o.sibling=null,c=bt.current,ct(bt,m?c&1|2:c&1),o):(nn(o),null);case 22:case 23:return Fh(),m=o.memoizedState!==null,r!==null&&r.memoizedState!==null!==m&&(o.flags|=8192),m&&(o.mode&1)!==0?(En&1073741824)!==0&&(nn(o),o.subtreeFlags&6&&(o.flags|=8192)):nn(o),null;case 24:return null;case 25:return null}throw Error(n(156,o.tag))}function BA(r,o){switch(Kd(o),o.tag){case 1:return hn(o.type)&&gc(),r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 3:return _a(),pt(dn),pt(en),lh(),r=o.flags,(r&65536)!==0&&(r&128)===0?(o.flags=r&-65537|128,o):null;case 5:return ah(o),null;case 13:if(pt(bt),r=o.memoizedState,r!==null&&r.dehydrated!==null){if(o.alternate===null)throw Error(n(340));wa()}return r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 19:return pt(bt),null;case 4:return _a(),null;case 10:return th(o.type._context),null;case 22:case 23:return Fh(),null;case 24:return null;default:return null}}var Pc=!1,rn=!1,UA=typeof WeakSet=="function"?WeakSet:Set,je=null;function Na(r,o){var c=r.ref;if(c!==null)if(typeof c=="function")try{c(null)}catch(m){St(r,o,m)}else c.current=null}function jh(r,o,c){try{c()}catch(m){St(r,o,m)}}var Rx=!1;function WA(r,o){if(Fd=Zs,r=ca(),Ri(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,H=-1,ee=-1,ue=0,ye=0,ve=r,ge=null;t:for(;;){for(var Ce;ve!==c||y!==0&&ve.nodeType!==3||(H=T+y),ve!==x||m!==0&&ve.nodeType!==3||(ee=T+m),ve.nodeType===3&&(T+=ve.nodeValue.length),(Ce=ve.firstChild)!==null;)ge=ve,ve=Ce;for(;;){if(ve===r)break t;if(ge===c&&++ue===y&&(H=T),ge===x&&++ye===m&&(ee=T),(Ce=ve.nextSibling)!==null)break;ve=ge,ge=ve.parentNode}ve=Ce}c=H===-1||ee===-1?null:{start:H,end:ee}}else c=null}c=c||{start:0,end:0}}else c=null;for(zd={focusedElem:r,selectionRange:c},Zs=!1,je=o;je!==null;)if(o=je,r=o.child,(o.subtreeFlags&1028)!==0&&r!==null)r.return=o,je=r;else for(;je!==null;){o=je;try{var Te=o.alternate;if((o.flags&1024)!==0)switch(o.tag){case 0:case 11:case 15:break;case 1:if(Te!==null){var Me=Te.memoizedProps,Et=Te.memoizedState,ae=o.stateNode,re=ae.getSnapshotBeforeUpdate(o.elementType===o.type?Me:tr(o.type,Me),Et);ae.__reactInternalSnapshotBeforeUpdate=re}break;case 3:var le=o.stateNode.containerInfo;le.nodeType===1?le.textContent="":le.nodeType===9&&le.documentElement&&le.removeChild(le.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(xe){St(o,o.return,xe)}if(r=o.sibling,r!==null){r.return=o.return,je=r;break}je=o.return}return Te=Rx,Rx=!1,Te}function Yi(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&&jh(o,c,x)}y=y.next}while(y!==m)}}function Lc(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 Th(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 Ax(r){var o=r.alternate;o!==null&&(r.alternate=null,Ax(o)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(o=r.stateNode,o!==null&&(delete o[_r],delete o[Li],delete o[Hd],delete o[EA],delete o[CA])),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 Mx(r){return r.tag===5||r.tag===3||r.tag===4}function Ix(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||Mx(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 Rh(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=pc));else if(m!==4&&(r=r.child,r!==null))for(Rh(r,o,c),r=r.sibling;r!==null;)Rh(r,o,c),r=r.sibling}function Ah(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(Ah(r,o,c),r=r.sibling;r!==null;)Ah(r,o,c),r=r.sibling}var Gt=null,nr=!1;function Ns(r,o,c){for(c=c.child;c!==null;)Ox(r,o,c),c=c.sibling}function Ox(r,o,c){if(Qt&&typeof Qt.onCommitFiberUnmount=="function")try{Qt.onCommitFiberUnmount(is,c)}catch{}switch(c.tag){case 5:rn||Na(c,o);case 6:var m=Gt,y=nr;Gt=null,Ns(r,o,c),Gt=m,nr=y,Gt!==null&&(nr?(r=Gt,c=c.stateNode,r.nodeType===8?r.parentNode.removeChild(c):r.removeChild(c)):Gt.removeChild(c.stateNode));break;case 18:Gt!==null&&(nr?(r=Gt,c=c.stateNode,r.nodeType===8?Wd(r.parentNode,c):r.nodeType===1&&Wd(r,c),Fr(r)):Wd(Gt,c.stateNode));break;case 4:m=Gt,y=nr,Gt=c.stateNode.containerInfo,nr=!0,Ns(r,o,c),Gt=m,nr=y;break;case 0:case 11:case 14:case 15:if(!rn&&(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)&&jh(c,o,T),y=y.next}while(y!==m)}Ns(r,o,c);break;case 1:if(!rn&&(Na(c,o),m=c.stateNode,typeof m.componentWillUnmount=="function"))try{m.props=c.memoizedProps,m.state=c.memoizedState,m.componentWillUnmount()}catch(H){St(c,o,H)}Ns(r,o,c);break;case 21:Ns(r,o,c);break;case 22:c.mode&1?(rn=(m=rn)||c.memoizedState!==null,Ns(r,o,c),rn=m):Ns(r,o,c);break;default:Ns(r,o,c)}}function $x(r){var o=r.updateQueue;if(o!==null){r.updateQueue=null;var c=r.stateNode;c===null&&(c=r.stateNode=new UA),o.forEach(function(m){var y=JA.bind(null,r,m);c.has(m)||(c.add(m),m.then(y,y))})}}function rr(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,H=T;e:for(;H!==null;){switch(H.tag){case 5:Gt=H.stateNode,nr=!1;break e;case 3:Gt=H.stateNode.containerInfo,nr=!0;break e;case 4:Gt=H.stateNode.containerInfo,nr=!0;break e}H=H.return}if(Gt===null)throw Error(n(160));Ox(x,T,y),Gt=null,nr=!1;var ee=y.alternate;ee!==null&&(ee.return=null),y.return=null}catch(ue){St(y,o,ue)}}if(o.subtreeFlags&12854)for(o=o.child;o!==null;)Px(o,r),o=o.sibling}function Px(r,o){var c=r.alternate,m=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:if(rr(o,r),Er(r),m&4){try{Yi(3,r,r.return),Lc(3,r)}catch(Me){St(r,r.return,Me)}try{Yi(5,r,r.return)}catch(Me){St(r,r.return,Me)}}break;case 1:rr(o,r),Er(r),m&512&&c!==null&&Na(c,c.return);break;case 5:if(rr(o,r),Er(r),m&512&&c!==null&&Na(c,c.return),r.flags&32){var y=r.stateNode;try{oe(y,"")}catch(Me){St(r,r.return,Me)}}if(m&4&&(y=r.stateNode,y!=null)){var x=r.memoizedProps,T=c!==null?c.memoizedProps:x,H=r.type,ee=r.updateQueue;if(r.updateQueue=null,ee!==null)try{H==="input"&&x.type==="radio"&&x.name!=null&&Ge(y,x),Re(H,T);var ue=Re(H,x);for(T=0;T<ee.length;T+=2){var ye=ee[T],ve=ee[T+1];ye==="style"?Be(y,ve):ye==="dangerouslySetInnerHTML"?Oe(y,ve):ye==="children"?oe(y,ve):C(y,ye,ve,ue)}switch(H){case"input":be(y,x);break;case"textarea":pe(y,x);break;case"select":var ge=y._wrapperState.wasMultiple;y._wrapperState.wasMultiple=!!x.multiple;var Ce=x.value;Ce!=null?lt(y,!!x.multiple,Ce,!1):ge!==!!x.multiple&&(x.defaultValue!=null?lt(y,!!x.multiple,x.defaultValue,!0):lt(y,!!x.multiple,x.multiple?[]:"",!1))}y[Li]=x}catch(Me){St(r,r.return,Me)}}break;case 6:if(rr(o,r),Er(r),m&4){if(r.stateNode===null)throw Error(n(162));y=r.stateNode,x=r.memoizedProps;try{y.nodeValue=x}catch(Me){St(r,r.return,Me)}}break;case 3:if(rr(o,r),Er(r),m&4&&c!==null&&c.memoizedState.isDehydrated)try{Fr(o.containerInfo)}catch(Me){St(r,r.return,Me)}break;case 4:rr(o,r),Er(r);break;case 13:rr(o,r),Er(r),y=r.child,y.flags&8192&&(x=y.memoizedState!==null,y.stateNode.isHidden=x,!x||y.alternate!==null&&y.alternate.memoizedState!==null||(Oh=dt())),m&4&&$x(r);break;case 22:if(ye=c!==null&&c.memoizedState!==null,r.mode&1?(rn=(ue=rn)||ye,rr(o,r),rn=ue):rr(o,r),Er(r),m&8192){if(ue=r.memoizedState!==null,(r.stateNode.isHidden=ue)&&!ye&&(r.mode&1)!==0)for(je=r,ye=r.child;ye!==null;){for(ve=je=ye;je!==null;){switch(ge=je,Ce=ge.child,ge.tag){case 0:case 11:case 14:case 15:Yi(4,ge,ge.return);break;case 1:Na(ge,ge.return);var Te=ge.stateNode;if(typeof Te.componentWillUnmount=="function"){m=ge,c=ge.return;try{o=m,Te.props=o.memoizedProps,Te.state=o.memoizedState,Te.componentWillUnmount()}catch(Me){St(m,c,Me)}}break;case 5:Na(ge,ge.return);break;case 22:if(ge.memoizedState!==null){Dx(ve);continue}}Ce!==null?(Ce.return=ge,je=Ce):Dx(ve)}ye=ye.sibling}e:for(ye=null,ve=r;;){if(ve.tag===5){if(ye===null){ye=ve;try{y=ve.stateNode,ue?(x=y.style,typeof x.setProperty=="function"?x.setProperty("display","none","important"):x.display="none"):(H=ve.stateNode,ee=ve.memoizedProps.style,T=ee!=null&&ee.hasOwnProperty("display")?ee.display:null,H.style.display=_e("display",T))}catch(Me){St(r,r.return,Me)}}}else if(ve.tag===6){if(ye===null)try{ve.stateNode.nodeValue=ue?"":ve.memoizedProps}catch(Me){St(r,r.return,Me)}}else if((ve.tag!==22&&ve.tag!==23||ve.memoizedState===null||ve===r)&&ve.child!==null){ve.child.return=ve,ve=ve.child;continue}if(ve===r)break e;for(;ve.sibling===null;){if(ve.return===null||ve.return===r)break e;ye===ve&&(ye=null),ve=ve.return}ye===ve&&(ye=null),ve.sibling.return=ve.return,ve=ve.sibling}}break;case 19:rr(o,r),Er(r),m&4&&$x(r);break;case 21:break;default:rr(o,r),Er(r)}}function Er(r){var o=r.flags;if(o&2){try{e:{for(var c=r.return;c!==null;){if(Mx(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=Ix(r);Ah(r,x,y);break;case 3:case 4:var T=m.stateNode.containerInfo,H=Ix(r);Rh(r,H,T);break;default:throw Error(n(161))}}catch(ee){St(r,r.return,ee)}r.flags&=-3}o&4096&&(r.flags&=-4097)}function HA(r,o,c){je=r,Lx(r)}function Lx(r,o,c){for(var m=(r.mode&1)!==0;je!==null;){var y=je,x=y.child;if(y.tag===22&&m){var T=y.memoizedState!==null||Pc;if(!T){var H=y.alternate,ee=H!==null&&H.memoizedState!==null||rn;H=Pc;var ue=rn;if(Pc=T,(rn=ee)&&!ue)for(je=y;je!==null;)T=je,ee=T.child,T.tag===22&&T.memoizedState!==null?Fx(y):ee!==null?(ee.return=T,je=ee):Fx(y);for(;x!==null;)je=x,Lx(x),x=x.sibling;je=y,Pc=H,rn=ue}qx(r)}else(y.subtreeFlags&8772)!==0&&x!==null?(x.return=y,je=x):qx(r)}}function qx(r){for(;je!==null;){var o=je;if((o.flags&8772)!==0){var c=o.alternate;try{if((o.flags&8772)!==0)switch(o.tag){case 0:case 11:case 15:rn||Lc(5,o);break;case 1:var m=o.stateNode;if(o.flags&4&&!rn)if(c===null)m.componentDidMount();else{var y=o.elementType===o.type?c.memoizedProps:tr(o.type,c.memoizedProps);m.componentDidUpdate(y,c.memoizedState,m.__reactInternalSnapshotBeforeUpdate)}var x=o.updateQueue;x!==null&&D0(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}D0(o,T,c)}break;case 5:var H=o.stateNode;if(c===null&&o.flags&4){c=H;var ee=o.memoizedProps;switch(o.type){case"button":case"input":case"select":case"textarea":ee.autoFocus&&c.focus();break;case"img":ee.src&&(c.src=ee.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(o.memoizedState===null){var ue=o.alternate;if(ue!==null){var ye=ue.memoizedState;if(ye!==null){var ve=ye.dehydrated;ve!==null&&Fr(ve)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}rn||o.flags&512&&Th(o)}catch(ge){St(o,o.return,ge)}}if(o===r){je=null;break}if(c=o.sibling,c!==null){c.return=o.return,je=c;break}je=o.return}}function Dx(r){for(;je!==null;){var o=je;if(o===r){je=null;break}var c=o.sibling;if(c!==null){c.return=o.return,je=c;break}je=o.return}}function Fx(r){for(;je!==null;){var o=je;try{switch(o.tag){case 0:case 11:case 15:var c=o.return;try{Lc(4,o)}catch(ee){St(o,c,ee)}break;case 1:var m=o.stateNode;if(typeof m.componentDidMount=="function"){var y=o.return;try{m.componentDidMount()}catch(ee){St(o,y,ee)}}var x=o.return;try{Th(o)}catch(ee){St(o,x,ee)}break;case 5:var T=o.return;try{Th(o)}catch(ee){St(o,T,ee)}}}catch(ee){St(o,o.return,ee)}if(o===r){je=null;break}var H=o.sibling;if(H!==null){H.return=o.return,je=H;break}je=o.return}}var GA=Math.ceil,qc=j.ReactCurrentDispatcher,Mh=j.ReactCurrentOwner,qn=j.ReactCurrentBatchConfig,et=0,zt=null,Rt=null,Vt=0,En=0,Ea=xs(0),Lt=0,Ki=null,mo=0,Dc=0,Ih=0,Xi=null,pn=null,Oh=0,Ca=1/0,Zr=null,Fc=!1,$h=null,Es=null,zc=!1,Cs=null,Bc=0,Qi=0,Ph=null,Uc=-1,Wc=0;function un(){return(et&6)!==0?dt():Uc!==-1?Uc:Uc=dt()}function js(r){return(r.mode&1)===0?1:(et&2)!==0&&Vt!==0?Vt&-Vt:TA.transition!==null?(Wc===0&&(Wc=li()),Wc):(r=tt,r!==0||(r=window.event,r=r===void 0?16:Xo(r.type)),r)}function sr(r,o,c,m){if(50<Qi)throw Qi=0,Ph=null,Error(n(185));mr(r,c,m),((et&2)===0||r!==zt)&&(r===zt&&((et&2)===0&&(Dc|=c),Lt===4&&Ts(r,Vt)),mn(r,m),c===1&&et===0&&(o.mode&1)===0&&(Ca=dt()+500,vc&&ks()))}function mn(r,o){var c=r.callbackNode;Gl(r,o);var m=Uo(r,r===zt?Vt:0);if(m===0)c!==null&&Do(c),r.callbackNode=null,r.callbackPriority=0;else if(o=m&-m,r.callbackPriority!==o){if(c!=null&&Do(c),o===1)r.tag===0?jA(Bx.bind(null,r)):C0(Bx.bind(null,r)),SA(function(){(et&6)===0&&ks()}),c=null;else{switch(ui(m)){case 1:c=Vn;break;case 4:c=Bo;break;case 16:c=Pr;break;case 536870912:c=Lr;break;default:c=Pr}c=Xx(c,zx.bind(null,r))}r.callbackPriority=o,r.callbackNode=c}}function zx(r,o){if(Uc=-1,Wc=0,(et&6)!==0)throw Error(n(327));var c=r.callbackNode;if(ja()&&r.callbackNode!==c)return null;var m=Uo(r,r===zt?Vt:0);if(m===0)return null;if((m&30)!==0||(m&r.expiredLanes)!==0||o)o=Hc(r,m);else{o=m;var y=et;et|=2;var x=Wx();(zt!==r||Vt!==o)&&(Zr=null,Ca=dt()+500,yo(r,o));do try{KA();break}catch(H){Ux(r,H)}while(!0);eh(),qc.current=x,et=y,Rt!==null?o=0:(zt=null,Vt=0,o=Lt)}if(o!==0){if(o===2&&(y=pr(r),y!==0&&(m=y,o=Lh(r,y))),o===1)throw c=Ki,yo(r,0),Ts(r,m),mn(r,dt()),c;if(o===6)Ts(r,m);else{if(y=r.current.alternate,(m&30)===0&&!VA(y)&&(o=Hc(r,m),o===2&&(x=pr(r),x!==0&&(m=x,o=Lh(r,x))),o===1))throw c=Ki,yo(r,0),Ts(r,m),mn(r,dt()),c;switch(r.finishedWork=y,r.finishedLanes=m,o){case 0:case 1:throw Error(n(345));case 2:vo(r,pn,Zr);break;case 3:if(Ts(r,m),(m&130023424)===m&&(o=Oh+500-dt(),10<o)){if(Uo(r,0)!==0)break;if(y=r.suspendedLanes,(y&m)!==m){un(),r.pingedLanes|=r.suspendedLanes&y;break}r.timeoutHandle=Ud(vo.bind(null,r,pn,Zr),o);break}vo(r,pn,Zr);break;case 4:if(Ts(r,m),(m&4194240)===m)break;for(o=r.eventTimes,y=-1;0<m;){var T=31-xn(m);x=1<<T,T=o[T],T>y&&(y=T),m&=~x}if(m=y,m=dt()-m,m=(120>m?120:480>m?480:1080>m?1080:1920>m?1920:3e3>m?3e3:4320>m?4320:1960*GA(m/1960))-m,10<m){r.timeoutHandle=Ud(vo.bind(null,r,pn,Zr),m);break}vo(r,pn,Zr);break;case 5:vo(r,pn,Zr);break;default:throw Error(n(329))}}}return mn(r,dt()),r.callbackNode===c?zx.bind(null,r):null}function Lh(r,o){var c=Xi;return r.current.memoizedState.isDehydrated&&(yo(r,o).flags|=256),r=Hc(r,o),r!==2&&(o=pn,pn=c,o!==null&&qh(o)),r}function qh(r){pn===null?pn=r:pn.push.apply(pn,r)}function VA(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(!_n(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 Ts(r,o){for(o&=~Ih,o&=~Dc,r.suspendedLanes|=o,r.pingedLanes&=~o,r=r.expirationTimes;0<o;){var c=31-xn(o),m=1<<c;r[c]=-1,o&=~m}}function Bx(r){if((et&6)!==0)throw Error(n(327));ja();var o=Uo(r,0);if((o&1)===0)return mn(r,dt()),null;var c=Hc(r,o);if(r.tag!==0&&c===2){var m=pr(r);m!==0&&(o=m,c=Lh(r,m))}if(c===1)throw c=Ki,yo(r,0),Ts(r,o),mn(r,dt()),c;if(c===6)throw Error(n(345));return r.finishedWork=r.current.alternate,r.finishedLanes=o,vo(r,pn,Zr),mn(r,dt()),null}function Dh(r,o){var c=et;et|=1;try{return r(o)}finally{et=c,et===0&&(Ca=dt()+500,vc&&ks())}}function go(r){Cs!==null&&Cs.tag===0&&(et&6)===0&&ja();var o=et;et|=1;var c=qn.transition,m=tt;try{if(qn.transition=null,tt=1,r)return r()}finally{tt=m,qn.transition=c,et=o,(et&6)===0&&ks()}}function Fh(){En=Ea.current,pt(Ea)}function yo(r,o){r.finishedWork=null,r.finishedLanes=0;var c=r.timeoutHandle;if(c!==-1&&(r.timeoutHandle=-1,_A(c)),Rt!==null)for(c=Rt.return;c!==null;){var m=c;switch(Kd(m),m.tag){case 1:m=m.type.childContextTypes,m!=null&&gc();break;case 3:_a(),pt(dn),pt(en),lh();break;case 5:ah(m);break;case 4:_a();break;case 13:pt(bt);break;case 19:pt(bt);break;case 10:th(m.type._context);break;case 22:case 23:Fh()}c=c.return}if(zt=r,Rt=r=Rs(r.current,null),Vt=En=o,Lt=0,Ki=null,Ih=Dc=mo=0,pn=Xi=null,ho!==null){for(o=0;o<ho.length;o++)if(c=ho[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}ho=null}return r}function Ux(r,o){do{var c=Rt;try{if(eh(),jc.current=Mc,Tc){for(var m=kt.memoizedState;m!==null;){var y=m.queue;y!==null&&(y.pending=null),m=m.next}Tc=!1}if(po=0,Ft=Pt=kt=null,Ui=!1,Wi=0,Mh.current=null,c===null||c.return===null){Lt=1,Ki=o,Rt=null;break}e:{var x=r,T=c.return,H=c,ee=o;if(o=Vt,H.flags|=32768,ee!==null&&typeof ee=="object"&&typeof ee.then=="function"){var ue=ee,ye=H,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 Ce=px(T);if(Ce!==null){Ce.flags&=-257,mx(Ce,T,H,x,o),Ce.mode&1&&fx(x,ue,o),o=Ce,ee=ue;var Te=o.updateQueue;if(Te===null){var Me=new Set;Me.add(ee),o.updateQueue=Me}else Te.add(ee);break e}else{if((o&1)===0){fx(x,ue,o),zh();break e}ee=Error(n(426))}}else if(mt&&H.mode&1){var Et=px(T);if(Et!==null){(Et.flags&65536)===0&&(Et.flags|=256),mx(Et,T,H,x,o),Zd(Sa(ee,H));break e}}x=ee=Sa(ee,H),Lt!==4&&(Lt=2),Xi===null?Xi=[x]:Xi.push(x),x=T;do{switch(x.tag){case 3:x.flags|=65536,o&=-o,x.lanes|=o;var ae=dx(x,ee,o);q0(x,ae);break e;case 1:H=ee;var re=x.type,le=x.stateNode;if((x.flags&128)===0&&(typeof re.getDerivedStateFromError=="function"||le!==null&&typeof le.componentDidCatch=="function"&&(Es===null||!Es.has(le)))){x.flags|=65536,o&=-o,x.lanes|=o;var xe=hx(x,H,o);q0(x,xe);break e}}x=x.return}while(x!==null)}Gx(c)}catch(Ie){o=Ie,Rt===c&&c!==null&&(Rt=c=c.return);continue}break}while(!0)}function Wx(){var r=qc.current;return qc.current=Mc,r===null?Mc:r}function zh(){(Lt===0||Lt===3||Lt===2)&&(Lt=4),zt===null||(mo&268435455)===0&&(Dc&268435455)===0||Ts(zt,Vt)}function Hc(r,o){var c=et;et|=2;var m=Wx();(zt!==r||Vt!==o)&&(Zr=null,yo(r,o));do try{YA();break}catch(y){Ux(r,y)}while(!0);if(eh(),et=c,qc.current=m,Rt!==null)throw Error(n(261));return zt=null,Vt=0,Lt}function YA(){for(;Rt!==null;)Hx(Rt)}function KA(){for(;Rt!==null&&!Gs();)Hx(Rt)}function Hx(r){var o=Kx(r.alternate,r,En);r.memoizedProps=r.pendingProps,o===null?Gx(r):Rt=o,Mh.current=null}function Gx(r){var o=r;do{var c=o.alternate;if(r=o.return,(o.flags&32768)===0){if(c=zA(c,o,En),c!==null){Rt=c;return}}else{if(c=BA(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 vo(r,o,c){var m=tt,y=qn.transition;try{qn.transition=null,tt=1,XA(r,o,c,m)}finally{qn.transition=y,tt=m}return null}function XA(r,o,c,m){do ja();while(Cs!==null);if((et&6)!==0)throw Error(n(327));c=r.finishedWork;var y=r.finishedLanes;if(c===null)return null;if(r.finishedWork=null,r.finishedLanes=0,c===r.current)throw Error(n(177));r.callbackNode=null,r.callbackPriority=0;var x=c.lanes|c.childLanes;if(ci(r,x),r===zt&&(Rt=zt=null,Vt=0),(c.subtreeFlags&2064)===0&&(c.flags&2064)===0||zc||(zc=!0,Xx(Pr,function(){return ja(),null})),x=(c.flags&15990)!==0,(c.subtreeFlags&15990)!==0||x){x=qn.transition,qn.transition=null;var T=tt;tt=1;var H=et;et|=4,Mh.current=null,WA(r,c),Px(c,r),lc(zd),Zs=!!Fd,zd=Fd=null,r.current=c,HA(c),Fo(),et=H,tt=T,qn.transition=x}else r.current=c;if(zc&&(zc=!1,Cs=r,Bc=y),x=r.pendingLanes,x===0&&(Es=null),xt(c.stateNode),mn(r,dt()),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(Fc)throw Fc=!1,r=$h,$h=null,r;return(Bc&1)!==0&&r.tag!==0&&ja(),x=r.pendingLanes,(x&1)!==0?r===Ph?Qi++:(Qi=0,Ph=r):Qi=0,ks(),null}function ja(){if(Cs!==null){var r=ui(Bc),o=qn.transition,c=tt;try{if(qn.transition=null,tt=16>r?16:r,Cs===null)var m=!1;else{if(r=Cs,Cs=null,Bc=0,(et&6)!==0)throw Error(n(331));var y=et;for(et|=4,je=r.current;je!==null;){var x=je,T=x.child;if((je.flags&16)!==0){var H=x.deletions;if(H!==null){for(var ee=0;ee<H.length;ee++){var ue=H[ee];for(je=ue;je!==null;){var ye=je;switch(ye.tag){case 0:case 11:case 15:Yi(8,ye,x)}var ve=ye.child;if(ve!==null)ve.return=ye,je=ve;else for(;je!==null;){ye=je;var ge=ye.sibling,Ce=ye.return;if(Ax(ye),ye===ue){je=null;break}if(ge!==null){ge.return=Ce,je=ge;break}je=Ce}}}var Te=x.alternate;if(Te!==null){var Me=Te.child;if(Me!==null){Te.child=null;do{var Et=Me.sibling;Me.sibling=null,Me=Et}while(Me!==null)}}je=x}}if((x.subtreeFlags&2064)!==0&&T!==null)T.return=x,je=T;else e:for(;je!==null;){if(x=je,(x.flags&2048)!==0)switch(x.tag){case 0:case 11:case 15:Yi(9,x,x.return)}var ae=x.sibling;if(ae!==null){ae.return=x.return,je=ae;break e}je=x.return}}var re=r.current;for(je=re;je!==null;){T=je;var le=T.child;if((T.subtreeFlags&2064)!==0&&le!==null)le.return=T,je=le;else e:for(T=re;je!==null;){if(H=je,(H.flags&2048)!==0)try{switch(H.tag){case 0:case 11:case 15:Lc(9,H)}}catch(Ie){St(H,H.return,Ie)}if(H===T){je=null;break e}var xe=H.sibling;if(xe!==null){xe.return=H.return,je=xe;break e}je=H.return}}if(et=y,ks(),Qt&&typeof Qt.onPostCommitFiberRoot=="function")try{Qt.onPostCommitFiberRoot(is,r)}catch{}m=!0}return m}finally{tt=c,qn.transition=o}}return!1}function Vx(r,o,c){o=Sa(c,o),o=dx(r,o,1),r=Ss(r,o,1),o=un(),r!==null&&(mr(r,1,o),mn(r,o))}function St(r,o,c){if(r.tag===3)Vx(r,r,c);else for(;o!==null;){if(o.tag===3){Vx(o,r,c);break}else if(o.tag===1){var m=o.stateNode;if(typeof o.type.getDerivedStateFromError=="function"||typeof m.componentDidCatch=="function"&&(Es===null||!Es.has(m))){r=Sa(c,r),r=hx(o,r,1),o=Ss(o,r,1),r=un(),o!==null&&(mr(o,1,r),mn(o,r));break}}o=o.return}}function QA(r,o,c){var m=r.pingCache;m!==null&&m.delete(o),o=un(),r.pingedLanes|=r.suspendedLanes&c,zt===r&&(Vt&c)===c&&(Lt===4||Lt===3&&(Vt&130023424)===Vt&&500>dt()-Oh?yo(r,0):Ih|=c),mn(r,o)}function Yx(r,o){o===0&&((r.mode&1)===0?o=1:(o=Dr,Dr<<=1,(Dr&130023424)===0&&(Dr=4194304)));var c=un();r=Kr(r,o),r!==null&&(mr(r,o,c),mn(r,c))}function ZA(r){var o=r.memoizedState,c=0;o!==null&&(c=o.retryLane),Yx(r,c)}function JA(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),Yx(r,c)}var Kx;Kx=function(r,o,c){if(r!==null)if(r.memoizedProps!==o.pendingProps||dn.current)fn=!0;else{if((r.lanes&c)===0&&(o.flags&128)===0)return fn=!1,FA(r,o,c);fn=(r.flags&131072)!==0}else fn=!1,mt&&(o.flags&1048576)!==0&&j0(o,xc,o.index);switch(o.lanes=0,o.tag){case 2:var m=o.type;$c(r,o),r=o.pendingProps;var y=ga(o,en.current);ka(o,c),y=dh(null,o,m,r,y,c);var x=hh();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,hn(m)?(x=!0,yc(o)):x=!1,o.memoizedState=y.state!==null&&y.state!==void 0?y.state:null,sh(o),y.updater=Ic,o.stateNode=y,y._reactInternals=o,vh(o,m,r,c),o=kh(null,o,m,!0,x,c)):(o.tag=0,mt&&x&&Yd(o),cn(null,o,y,c),o=o.child),o;case 16:m=o.elementType;e:{switch($c(r,o),r=o.pendingProps,y=m._init,m=y(m._payload),o.type=m,y=o.tag=tM(m),r=tr(m,r),y){case 0:o=bh(null,o,m,r,c);break e;case 1:o=bx(null,o,m,r,c);break e;case 11:o=gx(null,o,m,r,c);break e;case 14:o=yx(null,o,m,tr(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:tr(m,y),bh(r,o,m,y,c);case 1:return m=o.type,y=o.pendingProps,y=o.elementType===m?y:tr(m,y),bx(r,o,m,y,c);case 3:e:{if(kx(o),r===null)throw Error(n(387));m=o.pendingProps,x=o.memoizedState,y=x.element,L0(r,o),Ec(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=Sa(Error(n(423)),o),o=_x(r,o,m,c,y);break e}else if(m!==y){y=Sa(Error(n(424)),o),o=_x(r,o,m,c,y);break e}else for(Nn=ws(o.stateNode.containerInfo.firstChild),Sn=o,mt=!0,er=null,c=$0(o,null,m,c),o.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling;else{if(wa(),m===y){o=Qr(r,o,c);break e}cn(r,o,m,c)}o=o.child}return o;case 5:return F0(o),r===null&&Qd(o),m=o.type,y=o.pendingProps,x=r!==null?r.memoizedProps:null,T=y.children,Bd(m,y)?T=null:x!==null&&Bd(m,x)&&(o.flags|=32),xx(r,o),cn(r,o,T,c),o.child;case 6:return r===null&&Qd(o),null;case 13:return Sx(r,o,c);case 4:return oh(o,o.stateNode.containerInfo),m=o.pendingProps,r===null?o.child=xa(o,null,m,c):cn(r,o,m,c),o.child;case 11:return m=o.type,y=o.pendingProps,y=o.elementType===m?y:tr(m,y),gx(r,o,m,y,c);case 7:return cn(r,o,o.pendingProps,c),o.child;case 8:return cn(r,o,o.pendingProps.children,c),o.child;case 12:return cn(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,ct(_c,m._currentValue),m._currentValue=T,x!==null)if(_n(x.value,T)){if(x.children===y.children&&!dn.current){o=Qr(r,o,c);break e}}else for(x=o.child,x!==null&&(x.return=o);x!==null;){var H=x.dependencies;if(H!==null){T=x.child;for(var ee=H.firstContext;ee!==null;){if(ee.context===m){if(x.tag===1){ee=Xr(-1,c&-c),ee.tag=2;var ue=x.updateQueue;if(ue!==null){ue=ue.shared;var ye=ue.pending;ye===null?ee.next=ee:(ee.next=ye.next,ye.next=ee),ue.pending=ee}}x.lanes|=c,ee=x.alternate,ee!==null&&(ee.lanes|=c),nh(x.return,c,o),H.lanes|=c;break}ee=ee.next}}else if(x.tag===10)T=x.type===o.type?null:x.child;else if(x.tag===18){if(T=x.return,T===null)throw Error(n(341));T.lanes|=c,H=T.alternate,H!==null&&(H.lanes|=c),nh(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}cn(r,o,y.children,c),o=o.child}return o;case 9:return y=o.type,m=o.pendingProps.children,ka(o,c),y=Pn(y),m=m(y),o.flags|=1,cn(r,o,m,c),o.child;case 14:return m=o.type,y=tr(m,o.pendingProps),y=tr(m.type,y),yx(r,o,m,y,c);case 15:return vx(r,o,o.type,o.pendingProps,c);case 17:return m=o.type,y=o.pendingProps,y=o.elementType===m?y:tr(m,y),$c(r,o),o.tag=1,hn(m)?(r=!0,yc(o)):r=!1,ka(o,c),cx(o,m,y),vh(o,m,y,c),kh(null,o,m,!0,r,c);case 19:return Ex(r,o,c);case 22:return wx(r,o,c)}throw Error(n(156,o.tag))};function Xx(r,o){return Gn(r,o)}function eM(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 Dn(r,o,c,m){return new eM(r,o,c,m)}function Bh(r){return r=r.prototype,!(!r||!r.isReactComponent)}function tM(r){if(typeof r=="function")return Bh(r)?1:0;if(r!=null){if(r=r.$$typeof,r===V)return 11;if(r===X)return 14}return 2}function Rs(r,o){var c=r.alternate;return c===null?(c=Dn(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 Gc(r,o,c,m,y,x){var T=2;if(m=r,typeof r=="function")Bh(r)&&(T=1);else if(typeof r=="string")T=5;else e:switch(r){case O:return wo(c.children,y,x,o);case z:T=8,y|=8;break;case I:return r=Dn(12,c,o,y|2),r.elementType=I,r.lanes=x,r;case Y:return r=Dn(13,c,o,y),r.elementType=Y,r.lanes=x,r;case R:return r=Dn(19,c,o,y),r.elementType=R,r.lanes=x,r;case ne:return Vc(c,y,x,o);default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case A:T=10;break e;case q:T=9;break e;case V:T=11;break e;case X:T=14;break e;case B:T=16,m=null;break e}throw Error(n(130,r==null?r:typeof r,""))}return o=Dn(T,c,o,y),o.elementType=r,o.type=m,o.lanes=x,o}function wo(r,o,c,m){return r=Dn(7,r,m,o),r.lanes=c,r}function Vc(r,o,c,m){return r=Dn(22,r,m,o),r.elementType=ne,r.lanes=c,r.stateNode={isHidden:!1},r}function Uh(r,o,c){return r=Dn(6,r,null,o),r.lanes=c,r}function Wh(r,o,c){return o=Dn(4,r.children!==null?r.children:[],r.key,o),o.lanes=c,o.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},o}function nM(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=Wo(0),this.expirationTimes=Wo(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Wo(0),this.identifierPrefix=m,this.onRecoverableError=y,this.mutableSourceEagerHydrationData=null}function Hh(r,o,c,m,y,x,T,H,ee){return r=new nM(r,o,c,H,ee),o===1?(o=1,x===!0&&(o|=8)):o=0,x=Dn(3,null,null,o),r.current=x,x.stateNode=r,x.memoizedState={element:m,isDehydrated:c,cache:null,transitions:null,pendingSuspenseBoundaries:null},sh(x),r}function rM(r,o,c){var m=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:$,key:m==null?null:""+m,children:r,containerInfo:o,implementation:c}}function Qx(r){if(!r)return bs;r=r._reactInternals;e:{if(Mn(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(hn(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(hn(c))return N0(r,c,o)}return o}function Zx(r,o,c,m,y,x,T,H,ee){return r=Hh(c,m,!0,r,y,x,T,H,ee),r.context=Qx(null),c=r.current,m=un(),y=js(c),x=Xr(m,y),x.callback=o??null,Ss(c,x,y),r.current.lanes=y,mr(r,y,m),mn(r,m),r}function Yc(r,o,c,m){var y=o.current,x=un(),T=js(y);return c=Qx(c),o.context===null?o.context=c:o.pendingContext=c,o=Xr(x,T),o.payload={element:r},m=m===void 0?null:m,m!==null&&(o.callback=m),r=Ss(y,o,T),r!==null&&(sr(r,y,T,x),Nc(r,y,T)),T}function Kc(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 Jx(r,o){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var c=r.retryLane;r.retryLane=c!==0&&c<o?c:o}}function Gh(r,o){Jx(r,o),(r=r.alternate)&&Jx(r,o)}function sM(){return null}var eb=typeof reportError=="function"?reportError:function(r){console.error(r)};function Vh(r){this._internalRoot=r}Xc.prototype.render=Vh.prototype.render=function(r){var o=this._internalRoot;if(o===null)throw Error(n(409));Yc(r,o,null,null)},Xc.prototype.unmount=Vh.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var o=r.containerInfo;go(function(){Yc(null,r,null,null)}),o[Hr]=null}};function Xc(r){this._internalRoot=r}Xc.prototype.unstable_scheduleHydration=function(r){if(r){var o=Ks();r={blockedOn:null,target:r,priority:o};for(var c=0;c<vr.length&&o!==0&&o<vr[c].priority;c++);vr.splice(c,0,r),c===0&&fi(r)}};function Yh(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function Qc(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11&&(r.nodeType!==8||r.nodeValue!==" react-mount-point-unstable "))}function tb(){}function oM(r,o,c,m,y){if(y){if(typeof m=="function"){var x=m;m=function(){var ue=Kc(T);x.call(ue)}}var T=Zx(o,m,r,0,null,!1,!1,"",tb);return r._reactRootContainer=T,r[Hr]=T.current,$i(r.nodeType===8?r.parentNode:r),go(),T}for(;y=r.lastChild;)r.removeChild(y);if(typeof m=="function"){var H=m;m=function(){var ue=Kc(ee);H.call(ue)}}var ee=Hh(r,0,!1,null,null,!1,!1,"",tb);return r._reactRootContainer=ee,r[Hr]=ee.current,$i(r.nodeType===8?r.parentNode:r),go(function(){Yc(o,ee,c,m)}),ee}function Zc(r,o,c,m,y){var x=c._reactRootContainer;if(x){var T=x;if(typeof y=="function"){var H=y;y=function(){var ee=Kc(T);H.call(ee)}}Yc(o,T,r,y)}else T=oM(c,o,r,y,m);return Kc(T)}di=function(r){switch(r.tag){case 3:var o=r.stateNode;if(o.current.memoizedState.isDehydrated){var c=Vs(o.pendingLanes);c!==0&&(Ho(o,c|1),mn(o,dt()),(et&6)===0&&(Ca=dt()+500,ks()))}break;case 13:go(function(){var m=Kr(r,1);if(m!==null){var y=un();sr(m,r,1,y)}}),Gh(r,1)}},Wt=function(r){if(r.tag===13){var o=Kr(r,134217728);if(o!==null){var c=un();sr(o,r,134217728,c)}Gh(r,134217728)}},Ys=function(r){if(r.tag===13){var o=js(r),c=Kr(r,o);if(c!==null){var m=un();sr(c,r,o,m)}Gh(r,o)}},Ks=function(){return tt},Go=function(r,o){var c=tt;try{return tt=r,o()}finally{tt=c}},wt=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=mc(m);if(!y)throw Error(n(90));Ve(m),be(m,y)}}}break;case"textarea":pe(r,c);break;case"select":o=c.value,o!=null&<(r,!!c.multiple,o,!1)}},$o=Dh,wn=go;var aM={usingClientEntryPoint:!1,Events:[qi,pa,mc,Io,Oo,Dh]},Zi={findFiberByHostInstance:io,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},iM={bundleType:Zi.bundleType,version:Zi.version,rendererPackageName:Zi.rendererPackageName,rendererConfig:Zi.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=$r(r),r===null?null:r.stateNode},findFiberByHostInstance:Zi.findFiberByHostInstance||sM,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 Jc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Jc.isDisabled&&Jc.supportsFiber)try{is=Jc.inject(iM),Qt=Jc}catch{}}return gn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=aM,gn.createPortal=function(r,o){var c=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Yh(o))throw Error(n(200));return rM(r,o,null,c)},gn.createRoot=function(r,o){if(!Yh(r))throw Error(n(299));var c=!1,m="",y=eb;return o!=null&&(o.unstable_strictMode===!0&&(c=!0),o.identifierPrefix!==void 0&&(m=o.identifierPrefix),o.onRecoverableError!==void 0&&(y=o.onRecoverableError)),o=Hh(r,1,!1,null,null,c,!1,m,y),r[Hr]=o.current,$i(r.nodeType===8?r.parentNode:r),new Vh(o)},gn.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=$r(o),r=r===null?null:r.stateNode,r},gn.flushSync=function(r){return go(r)},gn.hydrate=function(r,o,c){if(!Qc(o))throw Error(n(200));return Zc(null,r,o,!0,c)},gn.hydrateRoot=function(r,o,c){if(!Yh(r))throw Error(n(405));var m=c!=null&&c.hydratedSources||null,y=!1,x="",T=eb;if(c!=null&&(c.unstable_strictMode===!0&&(y=!0),c.identifierPrefix!==void 0&&(x=c.identifierPrefix),c.onRecoverableError!==void 0&&(T=c.onRecoverableError)),o=Zx(o,null,r,1,c??null,y,!1,x,T),r[Hr]=o.current,$i(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 Xc(o)},gn.render=function(r,o,c){if(!Qc(o))throw Error(n(200));return Zc(null,r,o,!1,c)},gn.unmountComponentAtNode=function(r){if(!Qc(r))throw Error(n(40));return r._reactRootContainer?(go(function(){Zc(null,null,r,!1,function(){r._reactRootContainer=null,r[Hr]=null})}),!0):!1},gn.unstable_batchedUpdates=Dh,gn.unstable_renderSubtreeIntoContainer=function(r,o,c,m){if(!Qc(c))throw Error(n(200));if(r==null||r._reactInternals===void 0)throw Error(n(38));return Zc(r,o,c,!1,m)},gn.version="18.3.1-next-f1338f8080-20240426",gn}var cb;function GC(){if(cb)return Qh.exports;cb=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(),Qh.exports=pM(),Qh.exports}var ub;function mM(){if(ub)return tu;ub=1;var e=GC();return tu.createRoot=e.createRoot,tu.hydrateRoot=e.hydrateRoot,tu}var gM=mM(),b=Tl();const de=ww(b);function Kt(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=Kt(e[n]))!==""&&(t+=(t&&" ")+s);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var ef={exports:{}},tf={},nf={exports:{}},rf={};/**
|
|
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 db;function yM(){if(db)return rf;db=1;var e=Tl();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,a=e.useEffect,i=e.useLayoutEffect,l=e.useDebugValue;function u(g,v){var w=v(),N=s({inst:{value:w,getSnapshot:v}}),k=N[0].inst,S=N[1];return i(function(){k.value=w,k.getSnapshot=v,f(k)&&S({inst:k})},[g,w,v]),a(function(){return f(k)&&S({inst:k}),g(function(){f(k)&&S({inst:k})})},[g]),l(w),w}function f(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 h=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?p:u;return rf.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:h,rf}var hb;function vM(){return hb||(hb=1,nf.exports=yM()),nf.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 fb;function wM(){if(fb)return tf;fb=1;var e=Tl(),t=vM();function n(p,h){return p===h&&(p!==0||1/p===1/h)||p!==p&&h!==h}var s=typeof Object.is=="function"?Object.is:n,a=t.useSyncExternalStore,i=e.useRef,l=e.useEffect,u=e.useMemo,f=e.useDebugValue;return tf.useSyncExternalStoreWithSelector=function(p,h,g,v,w){var N=i(null);if(N.current===null){var k={hasValue:!1,value:null};N.current=k}else k=N.current;N=u(function(){function _($){if(!E){if(E=!0,C=$,$=v($),w!==void 0&&k.hasValue){var O=k.value;if(w(O,$))return j=O}return j=$}if(O=j,s(C,$))return O;var z=v($);return w!==void 0&&w(O,z)?(C=$,O):(C=$,j=z)}var E=!1,C,j,M=g===void 0?null:g;return[function(){return _(h())},M===null?void 0:function(){return _(M())}]},[h,g,v,w]);var S=a(p,N[0],N[1]);return l(function(){k.hasValue=!0,k.value=S},[S]),f(S),S},tf}var pb;function xM(){return pb||(pb=1,ef.exports=wM()),ef.exports}var bM=xM();const kM=ww(bM),_M={},mb=e=>{let t;const n=new Set,s=(h,g)=>{const v=typeof h=="function"?h(t):h;if(!Object.is(v,t)){const w=t;t=g??(typeof v!="object"||v===null)?v:Object.assign({},t,v),n.forEach(N=>N(t,w))}},a=()=>t,f={setState:s,getState:a,getInitialState:()=>p,subscribe:h=>(n.add(h),()=>n.delete(h)),destroy:()=>{(_M?"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,a,f);return f},SM=e=>e?mb(e):mb,{useDebugValue:NM}=de,{useSyncExternalStoreWithSelector:EM}=kM,CM=e=>e;function VC(e,t=CM,n){const s=EM(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return NM(s),s}const gb=(e,t)=>{const n=SM(e),s=(a,i=t)=>VC(n,a,i);return Object.assign(s,n),s},jM=(e,t)=>e?gb(e,t):gb;function Dt(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,a]of e)if(!Object.is(a,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 TM={value:()=>{}};function Xu(){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 _u(n)}function _u(e){this._=e}function RM(e,t){return e.trim().split(/^|\s+/).map(function(n){var s="",a=n.indexOf(".");if(a>=0&&(s=n.slice(a+1),n=n.slice(0,a)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:s}})}_u.prototype=Xu.prototype={constructor:_u,on:function(e,t){var n=this._,s=RM(e+"",n),a,i=-1,l=s.length;if(arguments.length<2){for(;++i<l;)if((a=(e=s[i]).type)&&(a=AM(n[a],e.name)))return a;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<l;)if(a=(e=s[i]).type)n[a]=yb(n[a],e.name,t);else if(t==null)for(a in n)n[a]=yb(n[a],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new _u(e)},call:function(e,t){if((a=arguments.length-2)>0)for(var n=new Array(a),s=0,a,i;s<a;++s)n[s]=arguments[s+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=this._[e],s=0,a=i.length;s<a;++s)i[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],a=0,i=s.length;a<i;++a)s[a].value.apply(t,n)}};function AM(e,t){for(var n=0,s=e.length,a;n<s;++n)if((a=e[n]).name===t)return a.value}function yb(e,t,n){for(var s=0,a=e.length;s<a;++s)if(e[s].name===t){e[s]=TM,e=e.slice(0,s).concat(e.slice(s+1));break}return n!=null&&e.push({name:t,value:n}),e}var Fv="http://www.w3.org/1999/xhtml";const vb={svg:"http://www.w3.org/2000/svg",xhtml:Fv,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Qu(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),vb.hasOwnProperty(t)?{space:vb[t],local:e}:e}function MM(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Fv&&t.documentElement.namespaceURI===Fv?t.createElement(e):t.createElementNS(n,e)}}function IM(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function YC(e){var t=Qu(e);return(t.local?IM:MM)(t)}function OM(){}function xw(e){return e==null?OM:function(){return this.querySelector(e)}}function $M(e){typeof e!="function"&&(e=xw(e));for(var t=this._groups,n=t.length,s=new Array(n),a=0;a<n;++a)for(var i=t[a],l=i.length,u=s[a]=new Array(l),f,p,h=0;h<l;++h)(f=i[h])&&(p=e.call(f,f.__data__,h,i))&&("__data__"in f&&(p.__data__=f.__data__),u[h]=p);return new Tn(s,this._parents)}function PM(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function LM(){return[]}function KC(e){return e==null?LM:function(){return this.querySelectorAll(e)}}function qM(e){return function(){return PM(e.apply(this,arguments))}}function DM(e){typeof e=="function"?e=qM(e):e=KC(e);for(var t=this._groups,n=t.length,s=[],a=[],i=0;i<n;++i)for(var l=t[i],u=l.length,f,p=0;p<u;++p)(f=l[p])&&(s.push(e.call(f,f.__data__,p,l)),a.push(f));return new Tn(s,a)}function XC(e){return function(){return this.matches(e)}}function QC(e){return function(t){return t.matches(e)}}var FM=Array.prototype.find;function zM(e){return function(){return FM.call(this.children,e)}}function BM(){return this.firstElementChild}function UM(e){return this.select(e==null?BM:zM(typeof e=="function"?e:QC(e)))}var WM=Array.prototype.filter;function HM(){return Array.from(this.children)}function GM(e){return function(){return WM.call(this.children,e)}}function VM(e){return this.selectAll(e==null?HM:GM(typeof e=="function"?e:QC(e)))}function YM(e){typeof e!="function"&&(e=XC(e));for(var t=this._groups,n=t.length,s=new Array(n),a=0;a<n;++a)for(var i=t[a],l=i.length,u=s[a]=[],f,p=0;p<l;++p)(f=i[p])&&e.call(f,f.__data__,p,i)&&u.push(f);return new Tn(s,this._parents)}function ZC(e){return new Array(e.length)}function KM(){return new Tn(this._enter||this._groups.map(ZC),this._parents)}function Mu(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Mu.prototype={constructor:Mu,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 XM(e){return function(){return e}}function QM(e,t,n,s,a,i){for(var l=0,u,f=t.length,p=i.length;l<p;++l)(u=t[l])?(u.__data__=i[l],s[l]=u):n[l]=new Mu(e,i[l]);for(;l<f;++l)(u=t[l])&&(a[l]=u)}function ZM(e,t,n,s,a,i,l){var u,f,p=new Map,h=t.length,g=i.length,v=new Array(h),w;for(u=0;u<h;++u)(f=t[u])&&(v[u]=w=l.call(f,f.__data__,u,t)+"",p.has(w)?a[u]=f:p.set(w,f));for(u=0;u<g;++u)w=l.call(e,i[u],u,i)+"",(f=p.get(w))?(s[u]=f,f.__data__=i[u],p.delete(w)):n[u]=new Mu(e,i[u]);for(u=0;u<h;++u)(f=t[u])&&p.get(v[u])===f&&(a[u]=f)}function JM(e){return e.__data__}function e2(e,t){if(!arguments.length)return Array.from(this,JM);var n=t?ZM:QM,s=this._parents,a=this._groups;typeof e!="function"&&(e=XM(e));for(var i=a.length,l=new Array(i),u=new Array(i),f=new Array(i),p=0;p<i;++p){var h=s[p],g=a[p],v=g.length,w=t2(e.call(h,h&&h.__data__,p,s)),N=w.length,k=u[p]=new Array(N),S=l[p]=new Array(N),_=f[p]=new Array(v);n(h,g,k,S,_,w,t);for(var E=0,C=0,j,M;E<N;++E)if(j=k[E]){for(E>=C&&(C=E+1);!(M=S[C])&&++C<N;);j._next=M||null}}return l=new Tn(l,s),l._enter=u,l._exit=f,l}function t2(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function n2(){return new Tn(this._exit||this._groups.map(ZC),this._parents)}function r2(e,t,n){var s=this.enter(),a=this,i=this.exit();return typeof e=="function"?(s=e(s),s&&(s=s.selection())):s=s.append(e+""),t!=null&&(a=t(a),a&&(a=a.selection())),n==null?i.remove():n(i),s&&a?s.merge(a).order():a}function s2(e){for(var t=e.selection?e.selection():e,n=this._groups,s=t._groups,a=n.length,i=s.length,l=Math.min(a,i),u=new Array(a),f=0;f<l;++f)for(var p=n[f],h=s[f],g=p.length,v=u[f]=new Array(g),w,N=0;N<g;++N)(w=p[N]||h[N])&&(v[N]=w);for(;f<a;++f)u[f]=n[f];return new Tn(u,this._parents)}function o2(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var s=e[t],a=s.length-1,i=s[a],l;--a>=0;)(l=s[a])&&(i&&l.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(l,i),i=l);return this}function a2(e){e||(e=i2);function t(g,v){return g&&v?e(g.__data__,v.__data__):!g-!v}for(var n=this._groups,s=n.length,a=new Array(s),i=0;i<s;++i){for(var l=n[i],u=l.length,f=a[i]=new Array(u),p,h=0;h<u;++h)(p=l[h])&&(f[h]=p);f.sort(t)}return new Tn(a,this._parents).order()}function i2(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function l2(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function c2(){return Array.from(this)}function u2(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var s=e[t],a=0,i=s.length;a<i;++a){var l=s[a];if(l)return l}return null}function d2(){let e=0;for(const t of this)++e;return e}function h2(){return!this.node()}function f2(e){for(var t=this._groups,n=0,s=t.length;n<s;++n)for(var a=t[n],i=0,l=a.length,u;i<l;++i)(u=a[i])&&e.call(u,u.__data__,i,a);return this}function p2(e){return function(){this.removeAttribute(e)}}function m2(e){return function(){this.removeAttributeNS(e.space,e.local)}}function g2(e,t){return function(){this.setAttribute(e,t)}}function y2(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function v2(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function w2(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function x2(e,t){var n=Qu(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?m2:p2:typeof t=="function"?n.local?w2:v2:n.local?y2:g2)(n,t))}function JC(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function b2(e){return function(){this.style.removeProperty(e)}}function k2(e,t,n){return function(){this.style.setProperty(e,t,n)}}function _2(e,t,n){return function(){var s=t.apply(this,arguments);s==null?this.style.removeProperty(e):this.style.setProperty(e,s,n)}}function S2(e,t,n){return arguments.length>1?this.each((t==null?b2:typeof t=="function"?_2:k2)(e,t,n??"")):Wa(this.node(),e)}function Wa(e,t){return e.style.getPropertyValue(t)||JC(e).getComputedStyle(e,null).getPropertyValue(t)}function N2(e){return function(){delete this[e]}}function E2(e,t){return function(){this[e]=t}}function C2(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function j2(e,t){return arguments.length>1?this.each((t==null?N2:typeof t=="function"?C2:E2)(e,t)):this.node()[e]}function ej(e){return e.trim().split(/^|\s+/)}function bw(e){return e.classList||new tj(e)}function tj(e){this._node=e,this._names=ej(e.getAttribute("class")||"")}tj.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 nj(e,t){for(var n=bw(e),s=-1,a=t.length;++s<a;)n.add(t[s])}function rj(e,t){for(var n=bw(e),s=-1,a=t.length;++s<a;)n.remove(t[s])}function T2(e){return function(){nj(this,e)}}function R2(e){return function(){rj(this,e)}}function A2(e,t){return function(){(t.apply(this,arguments)?nj:rj)(this,e)}}function M2(e,t){var n=ej(e+"");if(arguments.length<2){for(var s=bw(this.node()),a=-1,i=n.length;++a<i;)if(!s.contains(n[a]))return!1;return!0}return this.each((typeof t=="function"?A2:t?T2:R2)(n,t))}function I2(){this.textContent=""}function O2(e){return function(){this.textContent=e}}function $2(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function P2(e){return arguments.length?this.each(e==null?I2:(typeof e=="function"?$2:O2)(e)):this.node().textContent}function L2(){this.innerHTML=""}function q2(e){return function(){this.innerHTML=e}}function D2(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function F2(e){return arguments.length?this.each(e==null?L2:(typeof e=="function"?D2:q2)(e)):this.node().innerHTML}function z2(){this.nextSibling&&this.parentNode.appendChild(this)}function B2(){return this.each(z2)}function U2(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function W2(){return this.each(U2)}function H2(e){var t=typeof e=="function"?e:YC(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function G2(){return null}function V2(e,t){var n=typeof e=="function"?e:YC(e),s=t==null?G2:typeof t=="function"?t:xw(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),s.apply(this,arguments)||null)})}function Y2(){var e=this.parentNode;e&&e.removeChild(this)}function K2(){return this.each(Y2)}function X2(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Q2(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Z2(e){return this.select(e?Q2:X2)}function J2(e){return arguments.length?this.property("__data__",e):this.node().__data__}function eI(e){return function(t){e.call(this,t,this.__data__)}}function tI(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 nI(e){return function(){var t=this.__on;if(t){for(var n=0,s=-1,a=t.length,i;n<a;++n)i=t[n],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++s]=i;++s?t.length=s:delete this.__on}}}function rI(e,t,n){return function(){var s=this.__on,a,i=eI(t);if(s){for(var l=0,u=s.length;l<u;++l)if((a=s[l]).type===e.type&&a.name===e.name){this.removeEventListener(a.type,a.listener,a.options),this.addEventListener(a.type,a.listener=i,a.options=n),a.value=t;return}}this.addEventListener(e.type,i,n),a={type:e.type,name:e.name,value:t,listener:i,options:n},s?s.push(a):this.__on=[a]}}function sI(e,t,n){var s=tI(e+""),a,i=s.length,l;if(arguments.length<2){var u=this.node().__on;if(u){for(var f=0,p=u.length,h;f<p;++f)for(a=0,h=u[f];a<i;++a)if((l=s[a]).type===h.type&&l.name===h.name)return h.value}return}for(u=t?rI:nI,a=0;a<i;++a)this.each(u(s[a],t,n));return this}function sj(e,t,n){var s=JC(e),a=s.CustomEvent;typeof a=="function"?a=new a(t,n):(a=s.document.createEvent("Event"),n?(a.initEvent(t,n.bubbles,n.cancelable),a.detail=n.detail):a.initEvent(t,!1,!1)),e.dispatchEvent(a)}function oI(e,t){return function(){return sj(this,e,t)}}function aI(e,t){return function(){return sj(this,e,t.apply(this,arguments))}}function iI(e,t){return this.each((typeof t=="function"?aI:oI)(e,t))}function*lI(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var s=e[t],a=0,i=s.length,l;a<i;++a)(l=s[a])&&(yield l)}var oj=[null];function Tn(e,t){this._groups=e,this._parents=t}function Rl(){return new Tn([[document.documentElement]],oj)}function cI(){return this}Tn.prototype=Rl.prototype={constructor:Tn,select:$M,selectAll:DM,selectChild:UM,selectChildren:VM,filter:YM,data:e2,enter:KM,exit:n2,join:r2,merge:s2,selection:cI,order:o2,sort:a2,call:l2,nodes:c2,node:u2,size:d2,empty:h2,each:f2,attr:x2,style:S2,property:j2,classed:M2,text:P2,html:F2,raise:B2,lower:W2,append:H2,insert:V2,remove:K2,clone:Z2,datum:J2,on:sI,dispatch:iI,[Symbol.iterator]:lI};function zn(e){return typeof e=="string"?new Tn([[document.querySelector(e)]],[document.documentElement]):new Tn([[e]],oj)}function uI(e){let t;for(;t=e.sourceEvent;)e=t;return e}function ar(e,t){if(e=uI(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 a=t.getBoundingClientRect();return[e.clientX-a.left-t.clientLeft,e.clientY-a.top-t.clientTop]}}return[e.pageX,e.pageY]}const dI={passive:!1},gl={capture:!0,passive:!1};function sf(e){e.stopImmediatePropagation()}function Fa(e){e.preventDefault(),e.stopImmediatePropagation()}function aj(e){var t=e.document.documentElement,n=zn(e).on("dragstart.drag",Fa,gl);"onselectstart"in t?n.on("selectstart.drag",Fa,gl):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function ij(e,t){var n=e.document.documentElement,s=zn(e).on("dragstart.drag",null);t&&(s.on("click.drag",Fa,gl),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 nu=e=>()=>e;function zv(e,{sourceEvent:t,subject:n,target:s,identifier:a,active:i,x:l,y:u,dx:f,dy:p,dispatch:h}){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:a,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:l,enumerable:!0,configurable:!0},y:{value:u,enumerable:!0,configurable:!0},dx:{value:f,enumerable:!0,configurable:!0},dy:{value:p,enumerable:!0,configurable:!0},_:{value:h}})}zv.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function hI(e){return!e.ctrlKey&&!e.button}function fI(){return this.parentNode}function pI(e,t){return t??{x:e.x,y:e.y}}function mI(){return navigator.maxTouchPoints||"ontouchstart"in this}function gI(){var e=hI,t=fI,n=pI,s=mI,a={},i=Xu("start","drag","end"),l=0,u,f,p,h,g=0;function v(j){j.on("mousedown.drag",w).filter(s).on("touchstart.drag",S).on("touchmove.drag",_,dI).on("touchend.drag touchcancel.drag",E).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function w(j,M){if(!(h||!e.call(this,j,M))){var $=C(this,t.call(this,j,M),j,M,"mouse");$&&(zn(j.view).on("mousemove.drag",N,gl).on("mouseup.drag",k,gl),aj(j.view),sf(j),p=!1,u=j.clientX,f=j.clientY,$("start",j))}}function N(j){if(Fa(j),!p){var M=j.clientX-u,$=j.clientY-f;p=M*M+$*$>g}a.mouse("drag",j)}function k(j){zn(j.view).on("mousemove.drag mouseup.drag",null),ij(j.view,p),Fa(j),a.mouse("end",j)}function S(j,M){if(e.call(this,j,M)){var $=j.changedTouches,O=t.call(this,j,M),z=$.length,I,A;for(I=0;I<z;++I)(A=C(this,O,j,M,$[I].identifier,$[I]))&&(sf(j),A("start",j,$[I]))}}function _(j){var M=j.changedTouches,$=M.length,O,z;for(O=0;O<$;++O)(z=a[M[O].identifier])&&(Fa(j),z("drag",j,M[O]))}function E(j){var M=j.changedTouches,$=M.length,O,z;for(h&&clearTimeout(h),h=setTimeout(function(){h=null},500),O=0;O<$;++O)(z=a[M[O].identifier])&&(sf(j),z("end",j,M[O]))}function C(j,M,$,O,z,I){var A=i.copy(),q=ar(I||$,M),V,Y,R;if((R=n.call(j,new zv("beforestart",{sourceEvent:$,target:v,identifier:z,active:l,x:q[0],y:q[1],dx:0,dy:0,dispatch:A}),O))!=null)return V=R.x-q[0]||0,Y=R.y-q[1]||0,function X(B,ne,Z){var W=q,J;switch(B){case"start":a[z]=X,J=l++;break;case"end":delete a[z],--l;case"drag":q=ar(Z||ne,M),J=l;break}A.call(B,j,new zv(B,{sourceEvent:ne,subject:R,target:v,identifier:z,active:J,x:q[0]+V,y:q[1]+Y,dx:q[0]-W[0],dy:q[1]-W[1],dispatch:A}),O)}}return v.filter=function(j){return arguments.length?(e=typeof j=="function"?j:nu(!!j),v):e},v.container=function(j){return arguments.length?(t=typeof j=="function"?j:nu(j),v):t},v.subject=function(j){return arguments.length?(n=typeof j=="function"?j:nu(j),v):n},v.touchable=function(j){return arguments.length?(s=typeof j=="function"?j:nu(!!j),v):s},v.on=function(){var j=i.on.apply(i,arguments);return j===i?v:j},v.clickDistance=function(j){return arguments.length?(g=(j=+j)*j,v):Math.sqrt(g)},v}function kw(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function lj(e,t){var n=Object.create(e.prototype);for(var s in t)n[s]=t[s];return n}function Al(){}var yl=.7,Iu=1/yl,za="\\s*([+-]?\\d+)\\s*",vl="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Tr="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",yI=/^#([0-9a-f]{3,8})$/,vI=new RegExp(`^rgb\\(${za},${za},${za}\\)$`),wI=new RegExp(`^rgb\\(${Tr},${Tr},${Tr}\\)$`),xI=new RegExp(`^rgba\\(${za},${za},${za},${vl}\\)$`),bI=new RegExp(`^rgba\\(${Tr},${Tr},${Tr},${vl}\\)$`),kI=new RegExp(`^hsl\\(${vl},${Tr},${Tr}\\)$`),_I=new RegExp(`^hsla\\(${vl},${Tr},${Tr},${vl}\\)$`),wb={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};kw(Al,wl,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:xb,formatHex:xb,formatHex8:SI,formatHsl:NI,formatRgb:bb,toString:bb});function xb(){return this.rgb().formatHex()}function SI(){return this.rgb().formatHex8()}function NI(){return cj(this).formatHsl()}function bb(){return this.rgb().formatRgb()}function wl(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=yI.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?kb(t):n===3?new yn(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?ru(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?ru(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=vI.exec(e))?new yn(t[1],t[2],t[3],1):(t=wI.exec(e))?new yn(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=xI.exec(e))?ru(t[1],t[2],t[3],t[4]):(t=bI.exec(e))?ru(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=kI.exec(e))?Nb(t[1],t[2]/100,t[3]/100,1):(t=_I.exec(e))?Nb(t[1],t[2]/100,t[3]/100,t[4]):wb.hasOwnProperty(e)?kb(wb[e]):e==="transparent"?new yn(NaN,NaN,NaN,0):null}function kb(e){return new yn(e>>16&255,e>>8&255,e&255,1)}function ru(e,t,n,s){return s<=0&&(e=t=n=NaN),new yn(e,t,n,s)}function EI(e){return e instanceof Al||(e=wl(e)),e?(e=e.rgb(),new yn(e.r,e.g,e.b,e.opacity)):new yn}function Bv(e,t,n,s){return arguments.length===1?EI(e):new yn(e,t,n,s??1)}function yn(e,t,n,s){this.r=+e,this.g=+t,this.b=+n,this.opacity=+s}kw(yn,Bv,lj(Al,{brighter(e){return e=e==null?Iu:Math.pow(Iu,e),new yn(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?yl:Math.pow(yl,e),new yn(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new yn(No(this.r),No(this.g),No(this.b),Ou(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:_b,formatHex:_b,formatHex8:CI,formatRgb:Sb,toString:Sb}));function _b(){return`#${_o(this.r)}${_o(this.g)}${_o(this.b)}`}function CI(){return`#${_o(this.r)}${_o(this.g)}${_o(this.b)}${_o((isNaN(this.opacity)?1:this.opacity)*255)}`}function Sb(){const e=Ou(this.opacity);return`${e===1?"rgb(":"rgba("}${No(this.r)}, ${No(this.g)}, ${No(this.b)}${e===1?")":`, ${e})`}`}function Ou(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function No(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function _o(e){return e=No(e),(e<16?"0":"")+e.toString(16)}function Nb(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 cj(e){if(e instanceof ir)return new ir(e.h,e.s,e.l,e.opacity);if(e instanceof Al||(e=wl(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,a=Math.min(t,n,s),i=Math.max(t,n,s),l=NaN,u=i-a,f=(i+a)/2;return u?(t===i?l=(n-s)/u+(n<s)*6:n===i?l=(s-t)/u+2:l=(t-n)/u+4,u/=f<.5?i+a:2-i-a,l*=60):u=f>0&&f<1?0:l,new ir(l,u,f,e.opacity)}function jI(e,t,n,s){return arguments.length===1?cj(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}kw(ir,jI,lj(Al,{brighter(e){return e=e==null?Iu:Math.pow(Iu,e),new ir(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?yl:Math.pow(yl,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,a=2*n-s;return new yn(of(e>=240?e-240:e+120,a,s),of(e,a,s),of(e<120?e+240:e-120,a,s),this.opacity)},clamp(){return new ir(Eb(this.h),su(this.s),su(this.l),Ou(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=Ou(this.opacity);return`${e===1?"hsl(":"hsla("}${Eb(this.h)}, ${su(this.s)*100}%, ${su(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Eb(e){return e=(e||0)%360,e<0?e+360:e}function su(e){return Math.max(0,Math.min(1,e||0))}function of(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 uj=e=>()=>e;function TI(e,t){return function(n){return e+n*t}}function RI(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(s){return Math.pow(e+s*t,n)}}function AI(e){return(e=+e)==1?dj:function(t,n){return n-t?RI(t,n,e):uj(isNaN(t)?n:t)}}function dj(e,t){var n=t-e;return n?TI(e,n):uj(isNaN(e)?t:e)}const Cb=(function e(t){var n=AI(t);function s(a,i){var l=n((a=Bv(a)).r,(i=Bv(i)).r),u=n(a.g,i.g),f=n(a.b,i.b),p=dj(a.opacity,i.opacity);return function(h){return a.r=l(h),a.g=u(h),a.b=f(h),a.opacity=p(h),a+""}}return s.gamma=e,s})(1);function Os(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var Uv=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,af=new RegExp(Uv.source,"g");function MI(e){return function(){return e}}function II(e){return function(t){return e(t)+""}}function OI(e,t){var n=Uv.lastIndex=af.lastIndex=0,s,a,i,l=-1,u=[],f=[];for(e=e+"",t=t+"";(s=Uv.exec(e))&&(a=af.exec(t));)(i=a.index)>n&&(i=t.slice(n,i),u[l]?u[l]+=i:u[++l]=i),(s=s[0])===(a=a[0])?u[l]?u[l]+=a:u[++l]=a:(u[++l]=null,f.push({i:l,x:Os(s,a)})),n=af.lastIndex;return n<t.length&&(i=t.slice(n),u[l]?u[l]+=i:u[++l]=i),u.length<2?f[0]?II(f[0].x):MI(t):(t=f.length,function(p){for(var h=0,g;h<t;++h)u[(g=f[h]).i]=g.x(p);return u.join("")})}var jb=180/Math.PI,Wv={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function hj(e,t,n,s,a,i){var l,u,f;return(l=Math.sqrt(e*e+t*t))&&(e/=l,t/=l),(f=e*n+t*s)&&(n-=e*f,s-=t*f),(u=Math.sqrt(n*n+s*s))&&(n/=u,s/=u,f/=u),e*s<t*n&&(e=-e,t=-t,f=-f,l=-l),{translateX:a,translateY:i,rotate:Math.atan2(t,e)*jb,skewX:Math.atan(f)*jb,scaleX:l,scaleY:u}}var ou;function $I(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Wv:hj(t.a,t.b,t.c,t.d,t.e,t.f)}function PI(e){return e==null||(ou||(ou=document.createElementNS("http://www.w3.org/2000/svg","g")),ou.setAttribute("transform",e),!(e=ou.transform.baseVal.consolidate()))?Wv:(e=e.matrix,hj(e.a,e.b,e.c,e.d,e.e,e.f))}function fj(e,t,n,s){function a(p){return p.length?p.pop()+" ":""}function i(p,h,g,v,w,N){if(p!==g||h!==v){var k=w.push("translate(",null,t,null,n);N.push({i:k-4,x:Os(p,g)},{i:k-2,x:Os(h,v)})}else(g||v)&&w.push("translate("+g+t+v+n)}function l(p,h,g,v){p!==h?(p-h>180?h+=360:h-p>180&&(p+=360),v.push({i:g.push(a(g)+"rotate(",null,s)-2,x:Os(p,h)})):h&&g.push(a(g)+"rotate("+h+s)}function u(p,h,g,v){p!==h?v.push({i:g.push(a(g)+"skewX(",null,s)-2,x:Os(p,h)}):h&&g.push(a(g)+"skewX("+h+s)}function f(p,h,g,v,w,N){if(p!==g||h!==v){var k=w.push(a(w)+"scale(",null,",",null,")");N.push({i:k-4,x:Os(p,g)},{i:k-2,x:Os(h,v)})}else(g!==1||v!==1)&&w.push(a(w)+"scale("+g+","+v+")")}return function(p,h){var g=[],v=[];return p=e(p),h=e(h),i(p.translateX,p.translateY,h.translateX,h.translateY,g,v),l(p.rotate,h.rotate,g,v),u(p.skewX,h.skewX,g,v),f(p.scaleX,p.scaleY,h.scaleX,h.scaleY,g,v),p=h=null,function(w){for(var N=-1,k=v.length,S;++N<k;)g[(S=v[N]).i]=S.x(w);return g.join("")}}}var LI=fj($I,"px, ","px)","deg)"),qI=fj(PI,", ",")",")"),DI=1e-12;function Tb(e){return((e=Math.exp(e))+1/e)/2}function FI(e){return((e=Math.exp(e))-1/e)/2}function zI(e){return((e=Math.exp(2*e))-1)/(e+1)}const BI=(function e(t,n,s){function a(i,l){var u=i[0],f=i[1],p=i[2],h=l[0],g=l[1],v=l[2],w=h-u,N=g-f,k=w*w+N*N,S,_;if(k<DI)_=Math.log(v/p)/t,S=function(O){return[u+O*w,f+O*N,p*Math.exp(t*O*_)]};else{var E=Math.sqrt(k),C=(v*v-p*p+s*k)/(2*p*n*E),j=(v*v-p*p-s*k)/(2*v*n*E),M=Math.log(Math.sqrt(C*C+1)-C),$=Math.log(Math.sqrt(j*j+1)-j);_=($-M)/t,S=function(O){var z=O*_,I=Tb(M),A=p/(n*E)*(I*zI(t*z+M)-FI(M));return[u+A*w,f+A*N,p*I/Tb(t*z+M)]}}return S.duration=_*1e3*t/Math.SQRT2,S}return a.rho=function(i){var l=Math.max(.001,+i),u=l*l,f=u*u;return e(l,u,f)},a})(Math.SQRT2,2,4);var Ha=0,cl=0,el=0,pj=1e3,$u,ul,Pu=0,Co=0,Zu=0,xl=typeof performance=="object"&&performance.now?performance:Date,mj=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function _w(){return Co||(mj(UI),Co=xl.now()+Zu)}function UI(){Co=0}function Lu(){this._call=this._time=this._next=null}Lu.prototype=gj.prototype={constructor:Lu,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?_w():+n)+(t==null?0:+t),!this._next&&ul!==this&&(ul?ul._next=this:$u=this,ul=this),this._call=e,this._time=n,Hv()},stop:function(){this._call&&(this._call=null,this._time=1/0,Hv())}};function gj(e,t,n){var s=new Lu;return s.restart(e,t,n),s}function WI(){_w(),++Ha;for(var e=$u,t;e;)(t=Co-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Ha}function Rb(){Co=(Pu=xl.now())+Zu,Ha=cl=0;try{WI()}finally{Ha=0,GI(),Co=0}}function HI(){var e=xl.now(),t=e-Pu;t>pj&&(Zu-=t,Pu=e)}function GI(){for(var e,t=$u,n,s=1/0;t;)t._call?(s>t._time&&(s=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:$u=n);ul=e,Hv(s)}function Hv(e){if(!Ha){cl&&(cl=clearTimeout(cl));var t=e-Co;t>24?(e<1/0&&(cl=setTimeout(Rb,e-xl.now()-Zu)),el&&(el=clearInterval(el))):(el||(Pu=xl.now(),el=setInterval(HI,pj)),Ha=1,mj(Rb))}}function Ab(e,t,n){var s=new Lu;return t=t==null?0:+t,s.restart(a=>{s.stop(),e(a+t)},t,n),s}var VI=Xu("start","end","cancel","interrupt"),YI=[],yj=0,Mb=1,Gv=2,Su=3,Ib=4,Vv=5,Nu=6;function Ju(e,t,n,s,a,i){var l=e.__transition;if(!l)e.__transition={};else if(n in l)return;KI(e,n,{name:t,index:s,group:a,on:VI,tween:YI,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:yj})}function Sw(e,t){var n=dr(e,t);if(n.state>yj)throw new Error("too late; already scheduled");return n}function Rr(e,t){var n=dr(e,t);if(n.state>Su)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 KI(e,t,n){var s=e.__transition,a;s[t]=n,n.timer=gj(i,0,n.time);function i(p){n.state=Mb,n.timer.restart(l,n.delay,n.time),n.delay<=p&&l(p-n.delay)}function l(p){var h,g,v,w;if(n.state!==Mb)return f();for(h in s)if(w=s[h],w.name===n.name){if(w.state===Su)return Ab(l);w.state===Ib?(w.state=Nu,w.timer.stop(),w.on.call("interrupt",e,e.__data__,w.index,w.group),delete s[h]):+h<t&&(w.state=Nu,w.timer.stop(),w.on.call("cancel",e,e.__data__,w.index,w.group),delete s[h])}if(Ab(function(){n.state===Su&&(n.state=Ib,n.timer.restart(u,n.delay,n.time),u(p))}),n.state=Gv,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Gv){for(n.state=Su,a=new Array(v=n.tween.length),h=0,g=-1;h<v;++h)(w=n.tween[h].value.call(e,e.__data__,n.index,n.group))&&(a[++g]=w);a.length=g+1}}function u(p){for(var h=p<n.duration?n.ease.call(null,p/n.duration):(n.timer.restart(f),n.state=Vv,1),g=-1,v=a.length;++g<v;)a[g].call(e,h);n.state===Vv&&(n.on.call("end",e,e.__data__,n.index,n.group),f())}function f(){n.state=Nu,n.timer.stop(),delete s[t];for(var p in s)return;delete e.__transition}}function Eu(e,t){var n=e.__transition,s,a,i=!0,l;if(n){t=t==null?null:t+"";for(l in n){if((s=n[l]).name!==t){i=!1;continue}a=s.state>Gv&&s.state<Vv,s.state=Nu,s.timer.stop(),s.on.call(a?"interrupt":"cancel",e,e.__data__,s.index,s.group),delete n[l]}i&&delete e.__transition}}function XI(e){return this.each(function(){Eu(this,e)})}function QI(e,t){var n,s;return function(){var a=Rr(this,e),i=a.tween;if(i!==n){s=n=i;for(var l=0,u=s.length;l<u;++l)if(s[l].name===t){s=s.slice(),s.splice(l,1);break}}a.tween=s}}function ZI(e,t,n){var s,a;if(typeof n!="function")throw new Error;return function(){var i=Rr(this,e),l=i.tween;if(l!==s){a=(s=l).slice();for(var u={name:t,value:n},f=0,p=a.length;f<p;++f)if(a[f].name===t){a[f]=u;break}f===p&&a.push(u)}i.tween=a}}function JI(e,t){var n=this._id;if(e+="",arguments.length<2){for(var s=dr(this.node(),n).tween,a=0,i=s.length,l;a<i;++a)if((l=s[a]).name===e)return l.value;return null}return this.each((t==null?QI:ZI)(n,e,t))}function Nw(e,t,n){var s=e._id;return e.each(function(){var a=Rr(this,s);(a.value||(a.value={}))[t]=n.apply(this,arguments)}),function(a){return dr(a,s).value[t]}}function vj(e,t){var n;return(typeof t=="number"?Os:t instanceof wl?Cb:(n=wl(t))?(t=n,Cb):OI)(e,t)}function eO(e){return function(){this.removeAttribute(e)}}function tO(e){return function(){this.removeAttributeNS(e.space,e.local)}}function nO(e,t,n){var s,a=n+"",i;return function(){var l=this.getAttribute(e);return l===a?null:l===s?i:i=t(s=l,n)}}function rO(e,t,n){var s,a=n+"",i;return function(){var l=this.getAttributeNS(e.space,e.local);return l===a?null:l===s?i:i=t(s=l,n)}}function sO(e,t,n){var s,a,i;return function(){var l,u=n(this),f;return u==null?void this.removeAttribute(e):(l=this.getAttribute(e),f=u+"",l===f?null:l===s&&f===a?i:(a=f,i=t(s=l,u)))}}function oO(e,t,n){var s,a,i;return function(){var l,u=n(this),f;return u==null?void this.removeAttributeNS(e.space,e.local):(l=this.getAttributeNS(e.space,e.local),f=u+"",l===f?null:l===s&&f===a?i:(a=f,i=t(s=l,u)))}}function aO(e,t){var n=Qu(e),s=n==="transform"?qI:vj;return this.attrTween(e,typeof t=="function"?(n.local?oO:sO)(n,s,Nw(this,"attr."+e,t)):t==null?(n.local?tO:eO)(n):(n.local?rO:nO)(n,s,t))}function iO(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function lO(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function cO(e,t){var n,s;function a(){var i=t.apply(this,arguments);return i!==s&&(n=(s=i)&&lO(e,i)),n}return a._value=t,a}function uO(e,t){var n,s;function a(){var i=t.apply(this,arguments);return i!==s&&(n=(s=i)&&iO(e,i)),n}return a._value=t,a}function dO(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=Qu(e);return this.tween(n,(s.local?cO:uO)(s,t))}function hO(e,t){return function(){Sw(this,e).delay=+t.apply(this,arguments)}}function fO(e,t){return t=+t,function(){Sw(this,e).delay=t}}function pO(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?hO:fO)(t,e)):dr(this.node(),t).delay}function mO(e,t){return function(){Rr(this,e).duration=+t.apply(this,arguments)}}function gO(e,t){return t=+t,function(){Rr(this,e).duration=t}}function yO(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?mO:gO)(t,e)):dr(this.node(),t).duration}function vO(e,t){if(typeof t!="function")throw new Error;return function(){Rr(this,e).ease=t}}function wO(e){var t=this._id;return arguments.length?this.each(vO(t,e)):dr(this.node(),t).ease}function xO(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Rr(this,e).ease=n}}function bO(e){if(typeof e!="function")throw new Error;return this.each(xO(this._id,e))}function kO(e){typeof e!="function"&&(e=XC(e));for(var t=this._groups,n=t.length,s=new Array(n),a=0;a<n;++a)for(var i=t[a],l=i.length,u=s[a]=[],f,p=0;p<l;++p)(f=i[p])&&e.call(f,f.__data__,p,i)&&u.push(f);return new ns(s,this._parents,this._name,this._id)}function _O(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,s=t.length,a=n.length,i=Math.min(s,a),l=new Array(s),u=0;u<i;++u)for(var f=t[u],p=n[u],h=f.length,g=l[u]=new Array(h),v,w=0;w<h;++w)(v=f[w]||p[w])&&(g[w]=v);for(;u<s;++u)l[u]=t[u];return new ns(l,this._parents,this._name,this._id)}function SO(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 NO(e,t,n){var s,a,i=SO(t)?Sw:Rr;return function(){var l=i(this,e),u=l.on;u!==s&&(a=(s=u).copy()).on(t,n),l.on=a}}function EO(e,t){var n=this._id;return arguments.length<2?dr(this.node(),n).on.on(e):this.each(NO(n,e,t))}function CO(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function jO(){return this.on("end.remove",CO(this._id))}function TO(e){var t=this._name,n=this._id;typeof e!="function"&&(e=xw(e));for(var s=this._groups,a=s.length,i=new Array(a),l=0;l<a;++l)for(var u=s[l],f=u.length,p=i[l]=new Array(f),h,g,v=0;v<f;++v)(h=u[v])&&(g=e.call(h,h.__data__,v,u))&&("__data__"in h&&(g.__data__=h.__data__),p[v]=g,Ju(p[v],t,n,v,p,dr(h,n)));return new ns(i,this._parents,t,n)}function RO(e){var t=this._name,n=this._id;typeof e!="function"&&(e=KC(e));for(var s=this._groups,a=s.length,i=[],l=[],u=0;u<a;++u)for(var f=s[u],p=f.length,h,g=0;g<p;++g)if(h=f[g]){for(var v=e.call(h,h.__data__,g,f),w,N=dr(h,n),k=0,S=v.length;k<S;++k)(w=v[k])&&Ju(w,t,n,k,v,N);i.push(v),l.push(h)}return new ns(i,l,t,n)}var AO=Rl.prototype.constructor;function MO(){return new AO(this._groups,this._parents)}function IO(e,t){var n,s,a;return function(){var i=Wa(this,e),l=(this.style.removeProperty(e),Wa(this,e));return i===l?null:i===n&&l===s?a:a=t(n=i,s=l)}}function wj(e){return function(){this.style.removeProperty(e)}}function OO(e,t,n){var s,a=n+"",i;return function(){var l=Wa(this,e);return l===a?null:l===s?i:i=t(s=l,n)}}function $O(e,t,n){var s,a,i;return function(){var l=Wa(this,e),u=n(this),f=u+"";return u==null&&(f=u=(this.style.removeProperty(e),Wa(this,e))),l===f?null:l===s&&f===a?i:(a=f,i=t(s=l,u))}}function PO(e,t){var n,s,a,i="style."+t,l="end."+i,u;return function(){var f=Rr(this,e),p=f.on,h=f.value[i]==null?u||(u=wj(t)):void 0;(p!==n||a!==h)&&(s=(n=p).copy()).on(l,a=h),f.on=s}}function LO(e,t,n){var s=(e+="")=="transform"?LI:vj;return t==null?this.styleTween(e,IO(e,s)).on("end.style."+e,wj(e)):typeof t=="function"?this.styleTween(e,$O(e,s,Nw(this,"style."+e,t))).each(PO(this._id,e)):this.styleTween(e,OO(e,s,t),n).on("end.style."+e,null)}function qO(e,t,n){return function(s){this.style.setProperty(e,t.call(this,s),n)}}function DO(e,t,n){var s,a;function i(){var l=t.apply(this,arguments);return l!==a&&(s=(a=l)&&qO(e,l,n)),s}return i._value=t,i}function FO(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,DO(e,t,n??""))}function zO(e){return function(){this.textContent=e}}function BO(e){return function(){var t=e(this);this.textContent=t??""}}function UO(e){return this.tween("text",typeof e=="function"?BO(Nw(this,"text",e)):zO(e==null?"":e+""))}function WO(e){return function(t){this.textContent=e.call(this,t)}}function HO(e){var t,n;function s(){var a=e.apply(this,arguments);return a!==n&&(t=(n=a)&&WO(a)),t}return s._value=e,s}function GO(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,HO(e))}function VO(){for(var e=this._name,t=this._id,n=xj(),s=this._groups,a=s.length,i=0;i<a;++i)for(var l=s[i],u=l.length,f,p=0;p<u;++p)if(f=l[p]){var h=dr(f,t);Ju(f,e,n,p,l,{time:h.time+h.delay+h.duration,delay:0,duration:h.duration,ease:h.ease})}return new ns(s,this._parents,e,n)}function YO(){var e,t,n=this,s=n._id,a=n.size();return new Promise(function(i,l){var u={value:l},f={value:function(){--a===0&&i()}};n.each(function(){var p=Rr(this,s),h=p.on;h!==e&&(t=(e=h).copy(),t._.cancel.push(u),t._.interrupt.push(u),t._.end.push(f)),p.on=t}),a===0&&i()})}var KO=0;function ns(e,t,n,s){this._groups=e,this._parents=t,this._name=n,this._id=s}function xj(){return++KO}var Jr=Rl.prototype;ns.prototype={constructor:ns,select:TO,selectAll:RO,selectChild:Jr.selectChild,selectChildren:Jr.selectChildren,filter:kO,merge:_O,selection:MO,transition:VO,call:Jr.call,nodes:Jr.nodes,node:Jr.node,size:Jr.size,empty:Jr.empty,each:Jr.each,on:EO,attr:aO,attrTween:dO,style:LO,styleTween:FO,text:UO,textTween:GO,remove:jO,tween:JI,delay:pO,duration:yO,ease:wO,easeVarying:bO,end:YO,[Symbol.iterator]:Jr[Symbol.iterator]};function XO(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var QO={time:null,delay:0,duration:250,ease:XO};function ZO(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 JO(e){var t,n;e instanceof ns?(t=e._id,e=e._name):(t=xj(),(n=QO).time=_w(),e=e==null?null:e+"");for(var s=this._groups,a=s.length,i=0;i<a;++i)for(var l=s[i],u=l.length,f,p=0;p<u;++p)(f=l[p])&&Ju(f,e,t,p,l,n||ZO(f,t));return new ns(s,this._parents,e,t)}Rl.prototype.interrupt=XI;Rl.prototype.transition=JO;const au=e=>()=>e;function e$(e,{sourceEvent:t,target:n,transform:s,dispatch:a}){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:a}})}function es(e,t,n){this.k=e,this.x=t,this.y=n}es.prototype={constructor:es,scale:function(e){return e===1?this:new es(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new es(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 ts=new es(1,0,0);es.prototype;function lf(e){e.stopImmediatePropagation()}function tl(e){e.preventDefault(),e.stopImmediatePropagation()}function t$(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function n$(){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 Ob(){return this.__zoom||ts}function r$(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function s$(){return navigator.maxTouchPoints||"ontouchstart"in this}function o$(e,t,n){var s=e.invertX(t[0][0])-n[0][0],a=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],l=e.invertY(t[1][1])-n[1][1];return e.translate(a>s?(s+a)/2:Math.min(0,s)||Math.max(0,a),l>i?(i+l)/2:Math.min(0,i)||Math.max(0,l))}function bj(){var e=t$,t=n$,n=o$,s=r$,a=s$,i=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],u=250,f=BI,p=Xu("start","zoom","end"),h,g,v,w=500,N=150,k=0,S=10;function _(R){R.property("__zoom",Ob).on("wheel.zoom",z,{passive:!1}).on("mousedown.zoom",I).on("dblclick.zoom",A).filter(a).on("touchstart.zoom",q).on("touchmove.zoom",V).on("touchend.zoom touchcancel.zoom",Y).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}_.transform=function(R,X,B,ne){var Z=R.selection?R.selection():R;Z.property("__zoom",Ob),R!==Z?M(R,X,B,ne):Z.interrupt().each(function(){$(this,arguments).event(ne).start().zoom(null,typeof X=="function"?X.apply(this,arguments):X).end()})},_.scaleBy=function(R,X,B,ne){_.scaleTo(R,function(){var Z=this.__zoom.k,W=typeof X=="function"?X.apply(this,arguments):X;return Z*W},B,ne)},_.scaleTo=function(R,X,B,ne){_.transform(R,function(){var Z=t.apply(this,arguments),W=this.__zoom,J=B==null?j(Z):typeof B=="function"?B.apply(this,arguments):B,P=W.invert(J),K=typeof X=="function"?X.apply(this,arguments):X;return n(C(E(W,K),J,P),Z,l)},B,ne)},_.translateBy=function(R,X,B,ne){_.transform(R,function(){return n(this.__zoom.translate(typeof X=="function"?X.apply(this,arguments):X,typeof B=="function"?B.apply(this,arguments):B),t.apply(this,arguments),l)},null,ne)},_.translateTo=function(R,X,B,ne,Z){_.transform(R,function(){var W=t.apply(this,arguments),J=this.__zoom,P=ne==null?j(W):typeof ne=="function"?ne.apply(this,arguments):ne;return n(ts.translate(P[0],P[1]).scale(J.k).translate(typeof X=="function"?-X.apply(this,arguments):-X,typeof B=="function"?-B.apply(this,arguments):-B),W,l)},ne,Z)};function E(R,X){return X=Math.max(i[0],Math.min(i[1],X)),X===R.k?R:new es(X,R.x,R.y)}function C(R,X,B){var ne=X[0]-B[0]*R.k,Z=X[1]-B[1]*R.k;return ne===R.x&&Z===R.y?R:new es(R.k,ne,Z)}function j(R){return[(+R[0][0]+ +R[1][0])/2,(+R[0][1]+ +R[1][1])/2]}function M(R,X,B,ne){R.on("start.zoom",function(){$(this,arguments).event(ne).start()}).on("interrupt.zoom end.zoom",function(){$(this,arguments).event(ne).end()}).tween("zoom",function(){var Z=this,W=arguments,J=$(Z,W).event(ne),P=t.apply(Z,W),K=B==null?j(P):typeof B=="function"?B.apply(Z,W):B,te=Math.max(P[1][0]-P[0][0],P[1][1]-P[0][1]),D=Z.__zoom,L=typeof X=="function"?X.apply(Z,W):X,Q=f(D.invert(K).concat(te/D.k),L.invert(K).concat(te/L.k));return function(U){if(U===1)U=L;else{var ie=Q(U),fe=te/ie[2];U=new es(fe,K[0]-ie[0]*fe,K[1]-ie[1]*fe)}J.zoom(null,U)}})}function $(R,X,B){return!B&&R.__zooming||new O(R,X)}function O(R,X){this.that=R,this.args=X,this.active=0,this.sourceEvent=null,this.extent=t.apply(R,X),this.taps=0}O.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,X){return this.mouse&&R!=="mouse"&&(this.mouse[1]=X.invert(this.mouse[0])),this.touch0&&R!=="touch"&&(this.touch0[1]=X.invert(this.touch0[0])),this.touch1&&R!=="touch"&&(this.touch1[1]=X.invert(this.touch1[0])),this.that.__zoom=X,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(R){var X=zn(this.that).datum();p.call(R,this.that,new e$(R,{sourceEvent:this.sourceEvent,target:_,transform:this.that.__zoom,dispatch:p}),X)}};function z(R,...X){if(!e.apply(this,arguments))return;var B=$(this,X).event(R),ne=this.__zoom,Z=Math.max(i[0],Math.min(i[1],ne.k*Math.pow(2,s.apply(this,arguments)))),W=ar(R);if(B.wheel)(B.mouse[0][0]!==W[0]||B.mouse[0][1]!==W[1])&&(B.mouse[1]=ne.invert(B.mouse[0]=W)),clearTimeout(B.wheel);else{if(ne.k===Z)return;B.mouse=[W,ne.invert(W)],Eu(this),B.start()}tl(R),B.wheel=setTimeout(J,N),B.zoom("mouse",n(C(E(ne,Z),B.mouse[0],B.mouse[1]),B.extent,l));function J(){B.wheel=null,B.end()}}function I(R,...X){if(v||!e.apply(this,arguments))return;var B=R.currentTarget,ne=$(this,X,!0).event(R),Z=zn(R.view).on("mousemove.zoom",K,!0).on("mouseup.zoom",te,!0),W=ar(R,B),J=R.clientX,P=R.clientY;aj(R.view),lf(R),ne.mouse=[W,this.__zoom.invert(W)],Eu(this),ne.start();function K(D){if(tl(D),!ne.moved){var L=D.clientX-J,Q=D.clientY-P;ne.moved=L*L+Q*Q>k}ne.event(D).zoom("mouse",n(C(ne.that.__zoom,ne.mouse[0]=ar(D,B),ne.mouse[1]),ne.extent,l))}function te(D){Z.on("mousemove.zoom mouseup.zoom",null),ij(D.view,ne.moved),tl(D),ne.event(D).end()}}function A(R,...X){if(e.apply(this,arguments)){var B=this.__zoom,ne=ar(R.changedTouches?R.changedTouches[0]:R,this),Z=B.invert(ne),W=B.k*(R.shiftKey?.5:2),J=n(C(E(B,W),ne,Z),t.apply(this,X),l);tl(R),u>0?zn(this).transition().duration(u).call(M,J,ne,R):zn(this).call(_.transform,J,ne,R)}}function q(R,...X){if(e.apply(this,arguments)){var B=R.touches,ne=B.length,Z=$(this,X,R.changedTouches.length===ne).event(R),W,J,P,K;for(lf(R),J=0;J<ne;++J)P=B[J],K=ar(P,this),K=[K,this.__zoom.invert(K),P.identifier],Z.touch0?!Z.touch1&&Z.touch0[2]!==K[2]&&(Z.touch1=K,Z.taps=0):(Z.touch0=K,W=!0,Z.taps=1+!!h);h&&(h=clearTimeout(h)),W&&(Z.taps<2&&(g=K[0],h=setTimeout(function(){h=null},w)),Eu(this),Z.start())}}function V(R,...X){if(this.__zooming){var B=$(this,X).event(R),ne=R.changedTouches,Z=ne.length,W,J,P,K;for(tl(R),W=0;W<Z;++W)J=ne[W],P=ar(J,this),B.touch0&&B.touch0[2]===J.identifier?B.touch0[0]=P:B.touch1&&B.touch1[2]===J.identifier&&(B.touch1[0]=P);if(J=B.that.__zoom,B.touch1){var te=B.touch0[0],D=B.touch0[1],L=B.touch1[0],Q=B.touch1[1],U=(U=L[0]-te[0])*U+(U=L[1]-te[1])*U,ie=(ie=Q[0]-D[0])*ie+(ie=Q[1]-D[1])*ie;J=E(J,Math.sqrt(U/ie)),P=[(te[0]+L[0])/2,(te[1]+L[1])/2],K=[(D[0]+Q[0])/2,(D[1]+Q[1])/2]}else if(B.touch0)P=B.touch0[0],K=B.touch0[1];else return;B.zoom("touch",n(C(J,P,K),B.extent,l))}}function Y(R,...X){if(this.__zooming){var B=$(this,X).event(R),ne=R.changedTouches,Z=ne.length,W,J;for(lf(R),v&&clearTimeout(v),v=setTimeout(function(){v=null},w),W=0;W<Z;++W)J=ne[W],B.touch0&&B.touch0[2]===J.identifier?delete B.touch0:B.touch1&&B.touch1[2]===J.identifier&&delete B.touch1;if(B.touch1&&!B.touch0&&(B.touch0=B.touch1,delete B.touch1),B.touch0)B.touch0[1]=this.__zoom.invert(B.touch0[0]);else if(B.end(),B.taps===2&&(J=ar(J,this),Math.hypot(g[0]-J[0],g[1]-J[1])<S)){var P=zn(this).on("dblclick.zoom");P&&P.apply(this,arguments)}}}return _.wheelDelta=function(R){return arguments.length?(s=typeof R=="function"?R:au(+R),_):s},_.filter=function(R){return arguments.length?(e=typeof R=="function"?R:au(!!R),_):e},_.touchable=function(R){return arguments.length?(a=typeof R=="function"?R:au(!!R),_):a},_.extent=function(R){return arguments.length?(t=typeof R=="function"?R:au([[+R[0][0],+R[0][1]],[+R[1][0],+R[1][1]]]),_):t},_.scaleExtent=function(R){return arguments.length?(i[0]=+R[0],i[1]=+R[1],_):[i[0],i[1]]},_.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],_):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},_.constrain=function(R){return arguments.length?(n=R,_):n},_.duration=function(R){return arguments.length?(u=+R,_):u},_.interpolate=function(R){return arguments.length?(f=R,_):f},_.on=function(){var R=p.on.apply(p,arguments);return R===p?_:R},_.clickDistance=function(R){return arguments.length?(k=(R=+R)*R,_):Math.sqrt(k)},_.tapDistance=function(R){return arguments.length?(S=+R,_):S},_}var Ew=GC();const ed=b.createContext(null),a$=ed.Provider,rs={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.`},kj=rs.error001();function it(e,t){const n=b.useContext(ed);if(n===null)throw new Error(kj);return VC(n,e,t)}const Mt=()=>{const e=b.useContext(ed);if(e===null)throw new Error(kj);return b.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},i$=e=>e.userSelectionActive?"none":"all";function Cw({position:e,children:t,className:n,style:s,...a}){const i=it(i$),l=`${e}`.split("-");return de.createElement("div",{className:Kt(["react-flow__panel",n,...l]),style:{...s,pointerEvents:i},...a},t)}function l$({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:de.createElement(Cw,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://reactflow.dev/pro"},de.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}const c$=({x:e,y:t,label:n,labelStyle:s={},labelShowBg:a=!0,labelBgStyle:i={},labelBgPadding:l=[2,4],labelBgBorderRadius:u=2,children:f,className:p,...h})=>{const g=b.useRef(null),[v,w]=b.useState({x:0,y:0,width:0,height:0}),N=Kt(["react-flow__edge-textwrapper",p]);return b.useEffect(()=>{if(g.current){const k=g.current.getBBox();w({x:k.x,y:k.y,width:k.width,height:k.height})}},[n]),typeof n>"u"||!n?null:de.createElement("g",{transform:`translate(${e-v.width/2} ${t-v.height/2})`,className:N,visibility:v.width?"visible":"hidden",...h},a&&de.createElement("rect",{width:v.width+2*l[0],x:-l[0],y:-l[1],height:v.height+2*l[1],className:"react-flow__edge-textbg",style:i,rx:u,ry:u}),de.createElement("text",{className:"react-flow__edge-text",y:v.height/2,dy:"0.3em",ref:g,style:s},n),f)};var u$=b.memo(c$);const jw=e=>({width:e.offsetWidth,height:e.offsetHeight}),Ga=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Tw=(e={x:0,y:0},t)=>({x:Ga(e.x,t[0][0],t[1][0]),y:Ga(e.y,t[0][1],t[1][1])}),$b=(e,t,n)=>e<t?Ga(Math.abs(e-t),1,50)/50:e>n?-Ga(Math.abs(e-n),1,50)/50:0,_j=(e,t)=>{const n=$b(e.x,35,t.width-35)*20,s=$b(e.y,35,t.height-35)*20;return[n,s]},Sj=e=>{var t;return((t=e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},Nj=(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)}),bl=({x:e,y:t,width:n,height:s})=>({x:e,y:t,x2:e+n,y2:t+s}),Ej=({x:e,y:t,x2:n,y2:s})=>({x:e,y:t,width:n-e,height:s-t}),Pb=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),d$=(e,t)=>Ej(Nj(bl(e),bl(t))),Yv=(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)},h$=e=>Bn(e.width)&&Bn(e.height)&&Bn(e.x)&&Bn(e.y),Bn=e=>!isNaN(e)&&isFinite(e),Nt=Symbol.for("internals"),Cj=["Enter"," ","Escape"],f$=(e,t)=>{},p$=e=>"nativeEvent"in e;function Kv(e){var a,i;const t=p$(e)?e.nativeEvent:e,n=((i=(a=t.composedPath)==null?void 0:a.call(t))==null?void 0:i[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 jj=e=>"clientX"in e,Ls=(e,t)=>{var i,l;const n=jj(e),s=n?e.clientX:(i=e.touches)==null?void 0:i[0].clientX,a=n?e.clientY:(l=e.touches)==null?void 0:l[0].clientY;return{x:s-((t==null?void 0:t.left)??0),y:a-((t==null?void 0:t.top)??0)}},qu=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0},Ml=({id:e,path:t,labelX:n,labelY:s,label:a,labelStyle:i,labelShowBg:l,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p,style:h,markerEnd:g,markerStart:v,interactionWidth:w=20})=>de.createElement(de.Fragment,null,de.createElement("path",{id:e,style:h,d:t,fill:"none",className:"react-flow__edge-path",markerEnd:g,markerStart:v}),w&&de.createElement("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:w,className:"react-flow__edge-interaction"}),a&&Bn(n)&&Bn(s)?de.createElement(u$,{x:n,y:s,label:a,labelStyle:i,labelShowBg:l,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p}):null);Ml.displayName="BaseEdge";function nl(e,t,n){return n===void 0?n:s=>{const a=t().edges.find(i=>i.id===e);a&&n(s,{...a})}}function Tj({sourceX:e,sourceY:t,targetX:n,targetY:s}){const a=Math.abs(n-e)/2,i=n<e?n+a:n-a,l=Math.abs(s-t)/2,u=s<t?s+l:s-l;return[i,u,a,l]}function Rj({sourceX:e,sourceY:t,targetX:n,targetY:s,sourceControlX:a,sourceControlY:i,targetControlX:l,targetControlY:u}){const f=e*.125+a*.375+l*.375+n*.125,p=t*.125+i*.375+u*.375+s*.125,h=Math.abs(f-e),g=Math.abs(p-t);return[f,p,h,g]}var jo;(function(e){e.Strict="strict",e.Loose="loose"})(jo||(jo={}));var So;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(So||(So={}));var kl;(function(e){e.Partial="partial",e.Full="full"})(kl||(kl={}));var Ps;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Ps||(Ps={}));var Du;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Du||(Du={}));var $e;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})($e||($e={}));function Lb({pos:e,x1:t,y1:n,x2:s,y2:a}){return e===$e.Left||e===$e.Right?[.5*(t+s),n]:[t,.5*(n+a)]}function Aj({sourceX:e,sourceY:t,sourcePosition:n=$e.Bottom,targetX:s,targetY:a,targetPosition:i=$e.Top}){const[l,u]=Lb({pos:n,x1:e,y1:t,x2:s,y2:a}),[f,p]=Lb({pos:i,x1:s,y1:a,x2:e,y2:t}),[h,g,v,w]=Rj({sourceX:e,sourceY:t,targetX:s,targetY:a,sourceControlX:l,sourceControlY:u,targetControlX:f,targetControlY:p});return[`M${e},${t} C${l},${u} ${f},${p} ${s},${a}`,h,g,v,w]}const Rw=b.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,sourcePosition:a=$e.Bottom,targetPosition:i=$e.Top,label:l,labelStyle:u,labelShowBg:f,labelBgStyle:p,labelBgPadding:h,labelBgBorderRadius:g,style:v,markerEnd:w,markerStart:N,interactionWidth:k})=>{const[S,_,E]=Aj({sourceX:e,sourceY:t,sourcePosition:a,targetX:n,targetY:s,targetPosition:i});return de.createElement(Ml,{path:S,labelX:_,labelY:E,label:l,labelStyle:u,labelShowBg:f,labelBgStyle:p,labelBgPadding:h,labelBgBorderRadius:g,style:v,markerEnd:w,markerStart:N,interactionWidth:k})});Rw.displayName="SimpleBezierEdge";const qb={[$e.Left]:{x:-1,y:0},[$e.Right]:{x:1,y:0},[$e.Top]:{x:0,y:-1},[$e.Bottom]:{x:0,y:1}},m$=({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},Db=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function g$({source:e,sourcePosition:t=$e.Bottom,target:n,targetPosition:s=$e.Top,center:a,offset:i}){const l=qb[t],u=qb[s],f={x:e.x+l.x*i,y:e.y+l.y*i},p={x:n.x+u.x*i,y:n.y+u.y*i},h=m$({source:f,sourcePosition:t,target:p}),g=h.x!==0?"x":"y",v=h[g];let w=[],N,k;const S={x:0,y:0},_={x:0,y:0},[E,C,j,M]=Tj({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[g]*u[g]===-1){N=a.x??E,k=a.y??C;const O=[{x:N,y:f.y},{x:N,y:p.y}],z=[{x:f.x,y:k},{x:p.x,y:k}];l[g]===v?w=g==="x"?O:z:w=g==="x"?z:O}else{const O=[{x:f.x,y:p.y}],z=[{x:p.x,y:f.y}];if(g==="x"?w=l.x===v?z:O:w=l.y===v?O:z,t===s){const Y=Math.abs(e[g]-n[g]);if(Y<=i){const R=Math.min(i-1,i-Y);l[g]===v?S[g]=(f[g]>e[g]?-1:1)*R:_[g]=(p[g]>n[g]?-1:1)*R}}if(t!==s){const Y=g==="x"?"y":"x",R=l[g]===u[Y],X=f[Y]>p[Y],B=f[Y]<p[Y];(l[g]===1&&(!R&&X||R&&B)||l[g]!==1&&(!R&&B||R&&X))&&(w=g==="x"?O:z)}const I={x:f.x+S.x,y:f.y+S.y},A={x:p.x+_.x,y:p.y+_.y},q=Math.max(Math.abs(I.x-w[0].x),Math.abs(A.x-w[0].x)),V=Math.max(Math.abs(I.y-w[0].y),Math.abs(A.y-w[0].y));q>=V?(N=(I.x+A.x)/2,k=w[0].y):(N=w[0].x,k=(I.y+A.y)/2)}return[[e,{x:f.x+S.x,y:f.y+S.y},...w,{x:p.x+_.x,y:p.y+_.y},n],N,k,j,M]}function y$(e,t,n,s){const a=Math.min(Db(e,t)/2,Db(t,n)/2,s),{x:i,y:l}=t;if(e.x===i&&i===n.x||e.y===l&&l===n.y)return`L${i} ${l}`;if(e.y===l){const p=e.x<n.x?-1:1,h=e.y<n.y?1:-1;return`L ${i+a*p},${l}Q ${i},${l} ${i},${l+a*h}`}const u=e.x<n.x?1:-1,f=e.y<n.y?-1:1;return`L ${i},${l+a*f}Q ${i},${l} ${i+a*u},${l}`}function Xv({sourceX:e,sourceY:t,sourcePosition:n=$e.Bottom,targetX:s,targetY:a,targetPosition:i=$e.Top,borderRadius:l=5,centerX:u,centerY:f,offset:p=20}){const[h,g,v,w,N]=g$({source:{x:e,y:t},sourcePosition:n,target:{x:s,y:a},targetPosition:i,center:{x:u,y:f},offset:p});return[h.reduce((S,_,E)=>{let C="";return E>0&&E<h.length-1?C=y$(h[E-1],_,h[E+1],l):C=`${E===0?"M":"L"}${_.x} ${_.y}`,S+=C,S},""),g,v,w,N]}const td=b.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,label:a,labelStyle:i,labelShowBg:l,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p,style:h,sourcePosition:g=$e.Bottom,targetPosition:v=$e.Top,markerEnd:w,markerStart:N,pathOptions:k,interactionWidth:S})=>{const[_,E,C]=Xv({sourceX:e,sourceY:t,sourcePosition:g,targetX:n,targetY:s,targetPosition:v,borderRadius:k==null?void 0:k.borderRadius,offset:k==null?void 0:k.offset});return de.createElement(Ml,{path:_,labelX:E,labelY:C,label:a,labelStyle:i,labelShowBg:l,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p,style:h,markerEnd:w,markerStart:N,interactionWidth:S})});td.displayName="SmoothStepEdge";const Aw=b.memo(e=>{var t;return de.createElement(td,{...e,pathOptions:b.useMemo(()=>{var n;return{borderRadius:0,offset:(n=e.pathOptions)==null?void 0:n.offset}},[(t=e.pathOptions)==null?void 0:t.offset])})});Aw.displayName="StepEdge";function v$({sourceX:e,sourceY:t,targetX:n,targetY:s}){const[a,i,l,u]=Tj({sourceX:e,sourceY:t,targetX:n,targetY:s});return[`M ${e},${t}L ${n},${s}`,a,i,l,u]}const Mw=b.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,label:a,labelStyle:i,labelShowBg:l,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p,style:h,markerEnd:g,markerStart:v,interactionWidth:w})=>{const[N,k,S]=v$({sourceX:e,sourceY:t,targetX:n,targetY:s});return de.createElement(Ml,{path:N,labelX:k,labelY:S,label:a,labelStyle:i,labelShowBg:l,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p,style:h,markerEnd:g,markerStart:v,interactionWidth:w})});Mw.displayName="StraightEdge";function iu(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Fb({pos:e,x1:t,y1:n,x2:s,y2:a,c:i}){switch(e){case $e.Left:return[t-iu(t-s,i),n];case $e.Right:return[t+iu(s-t,i),n];case $e.Top:return[t,n-iu(n-a,i)];case $e.Bottom:return[t,n+iu(a-n,i)]}}function Mj({sourceX:e,sourceY:t,sourcePosition:n=$e.Bottom,targetX:s,targetY:a,targetPosition:i=$e.Top,curvature:l=.25}){const[u,f]=Fb({pos:n,x1:e,y1:t,x2:s,y2:a,c:l}),[p,h]=Fb({pos:i,x1:s,y1:a,x2:e,y2:t,c:l}),[g,v,w,N]=Rj({sourceX:e,sourceY:t,targetX:s,targetY:a,sourceControlX:u,sourceControlY:f,targetControlX:p,targetControlY:h});return[`M${e},${t} C${u},${f} ${p},${h} ${s},${a}`,g,v,w,N]}const Fu=b.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,sourcePosition:a=$e.Bottom,targetPosition:i=$e.Top,label:l,labelStyle:u,labelShowBg:f,labelBgStyle:p,labelBgPadding:h,labelBgBorderRadius:g,style:v,markerEnd:w,markerStart:N,pathOptions:k,interactionWidth:S})=>{const[_,E,C]=Mj({sourceX:e,sourceY:t,sourcePosition:a,targetX:n,targetY:s,targetPosition:i,curvature:k==null?void 0:k.curvature});return de.createElement(Ml,{path:_,labelX:E,labelY:C,label:l,labelStyle:u,labelShowBg:f,labelBgStyle:p,labelBgPadding:h,labelBgBorderRadius:g,style:v,markerEnd:w,markerStart:N,interactionWidth:S})});Fu.displayName="BezierEdge";const Iw=b.createContext(null),w$=Iw.Provider;Iw.Consumer;const x$=()=>b.useContext(Iw),b$=e=>"id"in e&&"source"in e&&"target"in e,k$=({source:e,sourceHandle:t,target:n,targetHandle:s})=>`reactflow__edge-${e}${t||""}-${n}${s||""}`,Qv=(e,t)=>typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(s=>`${s}=${e[s]}`).join("&")}`,_$=(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)),S$=(e,t)=>{if(!e.source||!e.target)return t;let n;return b$(e)?n={...e}:n={...e,id:k$(e)},_$(n,t)?t:t.concat(n)},Zv=({x:e,y:t},[n,s,a],i,[l,u])=>{const f={x:(e-n)/a,y:(t-s)/a};return i?{x:l*Math.round(f.x/l),y:u*Math.round(f.y/u)}:f},Ij=({x:e,y:t},[n,s,a])=>({x:e*a+n,y:t*a+s}),Eo=(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],a={x:e.position.x-n,y:e.position.y-s};return{...a,positionAbsolute:e.positionAbsolute?{x:e.positionAbsolute.x-n,y:e.positionAbsolute.y-s}:a}},nd=(e,t=[0,0])=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((s,a)=>{const{x:i,y:l}=Eo(a,t).positionAbsolute;return Nj(s,bl({x:i,y:l,width:a.width||0,height:a.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Ej(n)},Oj=(e,t,[n,s,a]=[0,0,1],i=!1,l=!1,u=[0,0])=>{const f={x:(t.x-n)/a,y:(t.y-s)/a,width:t.width/a,height:t.height/a},p=[];return e.forEach(h=>{const{width:g,height:v,selectable:w=!0,hidden:N=!1}=h;if(l&&!w||N)return!1;const{positionAbsolute:k}=Eo(h,u),S={x:k.x,y:k.y,width:g||0,height:v||0},_=Yv(f,S),E=typeof g>"u"||typeof v>"u"||g===null||v===null,C=i&&_>0,j=(g||0)*(v||0);(E||C||_>=j||h.dragging)&&p.push(h)}),p},$j=(e,t)=>{const n=e.map(s=>s.id);return t.filter(s=>n.includes(s.source)||n.includes(s.target))},Pj=(e,t,n,s,a,i=.1)=>{const l=t/(e.width*(1+i)),u=n/(e.height*(1+i)),f=Math.min(l,u),p=Ga(f,s,a),h=e.x+e.width/2,g=e.y+e.height/2,v=t/2-h*p,w=n/2-g*p;return{x:v,y:w,zoom:p}},ko=(e,t=0)=>e.transition().duration(t);function zb(e,t,n,s){return(t[n]||[]).reduce((a,i)=>{var l,u;return`${e.id}-${i.id}-${n}`!==s&&a.push({id:i.id||null,type:n,nodeId:e.id,x:(((l=e.positionAbsolute)==null?void 0:l.x)??0)+i.x+i.width/2,y:(((u=e.positionAbsolute)==null?void 0:u.y)??0)+i.y+i.height/2}),a},[])}function N$(e,t,n,s,a,i){const{x:l,y:u}=Ls(e),p=t.elementsFromPoint(l,u).find(N=>N.classList.contains("react-flow__handle"));if(p){const N=p.getAttribute("data-nodeid");if(N){const k=Ow(void 0,p),S=p.getAttribute("data-handleid"),_=i({nodeId:N,id:S,type:k});if(_){const E=a.find(C=>C.nodeId===N&&C.type===k&&C.id===S);return{handle:{id:S,type:k,nodeId:N,x:(E==null?void 0:E.x)||n.x,y:(E==null?void 0:E.y)||n.y},validHandleResult:_}}}}let h=[],g=1/0;if(a.forEach(N=>{const k=Math.sqrt((N.x-n.x)**2+(N.y-n.y)**2);if(k<=s){const S=i(N);k<=g&&(k<g?h=[{handle:N,validHandleResult:S}]:k===g&&h.push({handle:N,validHandleResult:S}),g=k)}}),!h.length)return{handle:null,validHandleResult:Lj()};if(h.length===1)return h[0];const v=h.some(({validHandleResult:N})=>N.isValid),w=h.some(({handle:N})=>N.type==="target");return h.find(({handle:N,validHandleResult:k})=>w?N.type==="target":v?k.isValid:!0)||h[0]}const E$={source:null,target:null,sourceHandle:null,targetHandle:null},Lj=()=>({handleDomNode:null,isValid:!1,connection:E$,endHandle:null});function qj(e,t,n,s,a,i,l){const u=a==="target",f=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={...Lj(),handleDomNode:f};if(f){const h=Ow(void 0,f),g=f.getAttribute("data-nodeid"),v=f.getAttribute("data-handleid"),w=f.classList.contains("connectable"),N=f.classList.contains("connectableend"),k={source:u?g:n,sourceHandle:u?v:s,target:u?n:g,targetHandle:u?s:v};p.connection=k,w&&N&&(t===jo.Strict?u&&h==="source"||!u&&h==="target":g!==n||v!==s)&&(p.endHandle={nodeId:g,handleId:v,type:h},p.isValid=i(k))}return p}function C$({nodes:e,nodeId:t,handleId:n,handleType:s}){return e.reduce((a,i)=>{if(i[Nt]){const{handleBounds:l}=i[Nt];let u=[],f=[];l&&(u=zb(i,l,"source",`${t}-${n}-${s}`),f=zb(i,l,"target",`${t}-${n}-${s}`)),a.push(...u,...f)}return a},[])}function Ow(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function cf(e){e==null||e.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function j$(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}function Dj({event:e,handleId:t,nodeId:n,onConnect:s,isTarget:a,getState:i,setState:l,isValidConnection:u,edgeUpdaterType:f,onReconnectEnd:p}){const h=Sj(e.target),{connectionMode:g,domNode:v,autoPanOnConnect:w,connectionRadius:N,onConnectStart:k,panBy:S,getNodes:_,cancelConnection:E}=i();let C=0,j;const{x:M,y:$}=Ls(e),O=h==null?void 0:h.elementFromPoint(M,$),z=Ow(f,O),I=v==null?void 0:v.getBoundingClientRect();if(!I||!z)return;let A,q=Ls(e,I),V=!1,Y=null,R=!1,X=null;const B=C$({nodes:_(),nodeId:n,handleId:t,handleType:z}),ne=()=>{if(!w)return;const[J,P]=_j(q,I);S({x:J,y:P}),C=requestAnimationFrame(ne)};l({connectionPosition:q,connectionStatus:null,connectionNodeId:n,connectionHandleId:t,connectionHandleType:z,connectionStartHandle:{nodeId:n,handleId:t,type:z},connectionEndHandle:null}),k==null||k(e,{nodeId:n,handleId:t,handleType:z});function Z(J){const{transform:P}=i();q=Ls(J,I);const{handle:K,validHandleResult:te}=N$(J,h,Zv(q,P,!1,[1,1]),N,B,D=>qj(D,g,n,t,a?"target":"source",u,h));if(j=K,V||(ne(),V=!0),X=te.handleDomNode,Y=te.connection,R=te.isValid,l({connectionPosition:j&&R?Ij({x:j.x,y:j.y},P):q,connectionStatus:j$(!!j,R),connectionEndHandle:te.endHandle}),!j&&!R&&!X)return cf(A);Y.source!==Y.target&&X&&(cf(A),A=X,X.classList.add("connecting","react-flow__handle-connecting"),X.classList.toggle("valid",R),X.classList.toggle("react-flow__handle-valid",R))}function W(J){var P,K;(j||X)&&Y&&R&&(s==null||s(Y)),(K=(P=i()).onConnectEnd)==null||K.call(P,J),f&&(p==null||p(J)),cf(A),E(),cancelAnimationFrame(C),V=!1,R=!1,Y=null,X=null,h.removeEventListener("mousemove",Z),h.removeEventListener("mouseup",W),h.removeEventListener("touchmove",Z),h.removeEventListener("touchend",W)}h.addEventListener("mousemove",Z),h.addEventListener("mouseup",W),h.addEventListener("touchmove",Z),h.addEventListener("touchend",W)}const Bb=()=>!0,T$=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),R$=(e,t,n)=>s=>{const{connectionStartHandle:a,connectionEndHandle:i,connectionClickStartHandle:l}=s;return{connecting:(a==null?void 0:a.nodeId)===e&&(a==null?void 0:a.handleId)===t&&(a==null?void 0:a.type)===n||(i==null?void 0:i.nodeId)===e&&(i==null?void 0:i.handleId)===t&&(i==null?void 0:i.type)===n,clickConnecting:(l==null?void 0:l.nodeId)===e&&(l==null?void 0:l.handleId)===t&&(l==null?void 0:l.type)===n}},Fj=b.forwardRef(({type:e="source",position:t=$e.Top,isValidConnection:n,isConnectable:s=!0,isConnectableStart:a=!0,isConnectableEnd:i=!0,id:l,onConnect:u,children:f,className:p,onMouseDown:h,onTouchStart:g,...v},w)=>{var I,A;const N=l||null,k=e==="target",S=Mt(),_=x$(),{connectOnClick:E,noPanClassName:C}=it(T$,Dt),{connecting:j,clickConnecting:M}=it(R$(_,N,e),Dt);_||(A=(I=S.getState()).onError)==null||A.call(I,"010",rs.error010());const $=q=>{const{defaultEdgeOptions:V,onConnect:Y,hasDefaultEdges:R}=S.getState(),X={...V,...q};if(R){const{edges:B,setEdges:ne}=S.getState();ne(S$(X,B))}Y==null||Y(X),u==null||u(X)},O=q=>{if(!_)return;const V=jj(q);a&&(V&&q.button===0||!V)&&Dj({event:q,handleId:N,nodeId:_,onConnect:$,isTarget:k,getState:S.getState,setState:S.setState,isValidConnection:n||S.getState().isValidConnection||Bb}),V?h==null||h(q):g==null||g(q)},z=q=>{const{onClickConnectStart:V,onClickConnectEnd:Y,connectionClickStartHandle:R,connectionMode:X,isValidConnection:B}=S.getState();if(!_||!R&&!a)return;if(!R){V==null||V(q,{nodeId:_,handleId:N,handleType:e}),S.setState({connectionClickStartHandle:{nodeId:_,type:e,handleId:N}});return}const ne=Sj(q.target),Z=n||B||Bb,{connection:W,isValid:J}=qj({nodeId:_,id:N,type:e},X,R.nodeId,R.handleId||null,R.type,Z,ne);J&&$(W),Y==null||Y(q),S.setState({connectionClickStartHandle:null})};return de.createElement("div",{"data-handleid":N,"data-nodeid":_,"data-handlepos":t,"data-id":`${_}-${N}-${e}`,className:Kt(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",C,p,{source:!k,target:k,connectable:s,connectablestart:a,connectableend:i,connecting:M,connectionindicator:s&&(a&&!j||i&&j)}]),onMouseDown:O,onTouchStart:O,onClick:E?z:void 0,ref:w,...v},f)});Fj.displayName="Handle";var Va=b.memo(Fj);const zj=({data:e,isConnectable:t,targetPosition:n=$e.Top,sourcePosition:s=$e.Bottom})=>de.createElement(de.Fragment,null,de.createElement(Va,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,de.createElement(Va,{type:"source",position:s,isConnectable:t}));zj.displayName="DefaultNode";var Jv=b.memo(zj);const Bj=({data:e,isConnectable:t,sourcePosition:n=$e.Bottom})=>de.createElement(de.Fragment,null,e==null?void 0:e.label,de.createElement(Va,{type:"source",position:n,isConnectable:t}));Bj.displayName="InputNode";var Uj=b.memo(Bj);const Wj=({data:e,isConnectable:t,targetPosition:n=$e.Top})=>de.createElement(de.Fragment,null,de.createElement(Va,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label);Wj.displayName="OutputNode";var Hj=b.memo(Wj);const $w=()=>null;$w.displayName="GroupNode";const A$=e=>({selectedNodes:e.getNodes().filter(t=>t.selected),selectedEdges:e.edges.filter(t=>t.selected).map(t=>({...t}))}),lu=e=>e.id;function M$(e,t){return Dt(e.selectedNodes.map(lu),t.selectedNodes.map(lu))&&Dt(e.selectedEdges.map(lu),t.selectedEdges.map(lu))}const Gj=b.memo(({onSelectionChange:e})=>{const t=Mt(),{selectedNodes:n,selectedEdges:s}=it(A$,M$);return b.useEffect(()=>{const a={nodes:n,edges:s};e==null||e(a),t.getState().onSelectionChange.forEach(i=>i(a))},[n,s,e]),null});Gj.displayName="SelectionListener";const I$=e=>!!e.onSelectionChange;function O$({onSelectionChange:e}){const t=it(I$);return e||t?de.createElement(Gj,{onSelectionChange:e}):null}const $$=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 Ta(e,t){b.useEffect(()=>{typeof e<"u"&&t(e)},[e])}function Xe(e,t,n){b.useEffect(()=>{typeof t<"u"&&n({[e]:t})},[t])}const P$=({nodes:e,edges:t,defaultNodes:n,defaultEdges:s,onConnect:a,onConnectStart:i,onConnectEnd:l,onClickConnectStart:u,onClickConnectEnd:f,nodesDraggable:p,nodesConnectable:h,nodesFocusable:g,edgesFocusable:v,edgesUpdatable:w,elevateNodesOnSelect:N,minZoom:k,maxZoom:S,nodeExtent:_,onNodesChange:E,onEdgesChange:C,elementsSelectable:j,connectionMode:M,snapGrid:$,snapToGrid:O,translateExtent:z,connectOnClick:I,defaultEdgeOptions:A,fitView:q,fitViewOptions:V,onNodesDelete:Y,onEdgesDelete:R,onNodeDrag:X,onNodeDragStart:B,onNodeDragStop:ne,onSelectionDrag:Z,onSelectionDragStart:W,onSelectionDragStop:J,noPanClassName:P,nodeOrigin:K,rfId:te,autoPanOnConnect:D,autoPanOnNodeDrag:L,onError:Q,connectionRadius:U,isValidConnection:ie,nodeDragThreshold:fe})=>{const{setNodes:me,setEdges:ke,setDefaultNodesAndEdges:Ve,setMinZoom:Le,setMaxZoom:De,setTranslateExtent:Ne,setNodeExtent:Ge,reset:be}=it($$,Dt),se=Mt();return b.useEffect(()=>{const Qe=s==null?void 0:s.map(ut=>({...ut,...A}));return Ve(n,Qe),()=>{be()}},[]),Xe("defaultEdgeOptions",A,se.setState),Xe("connectionMode",M,se.setState),Xe("onConnect",a,se.setState),Xe("onConnectStart",i,se.setState),Xe("onConnectEnd",l,se.setState),Xe("onClickConnectStart",u,se.setState),Xe("onClickConnectEnd",f,se.setState),Xe("nodesDraggable",p,se.setState),Xe("nodesConnectable",h,se.setState),Xe("nodesFocusable",g,se.setState),Xe("edgesFocusable",v,se.setState),Xe("edgesUpdatable",w,se.setState),Xe("elementsSelectable",j,se.setState),Xe("elevateNodesOnSelect",N,se.setState),Xe("snapToGrid",O,se.setState),Xe("snapGrid",$,se.setState),Xe("onNodesChange",E,se.setState),Xe("onEdgesChange",C,se.setState),Xe("connectOnClick",I,se.setState),Xe("fitViewOnInit",q,se.setState),Xe("fitViewOnInitOptions",V,se.setState),Xe("onNodesDelete",Y,se.setState),Xe("onEdgesDelete",R,se.setState),Xe("onNodeDrag",X,se.setState),Xe("onNodeDragStart",B,se.setState),Xe("onNodeDragStop",ne,se.setState),Xe("onSelectionDrag",Z,se.setState),Xe("onSelectionDragStart",W,se.setState),Xe("onSelectionDragStop",J,se.setState),Xe("noPanClassName",P,se.setState),Xe("nodeOrigin",K,se.setState),Xe("rfId",te,se.setState),Xe("autoPanOnConnect",D,se.setState),Xe("autoPanOnNodeDrag",L,se.setState),Xe("onError",Q,se.setState),Xe("connectionRadius",U,se.setState),Xe("isValidConnection",ie,se.setState),Xe("nodeDragThreshold",fe,se.setState),Ta(e,me),Ta(t,ke),Ta(k,Le),Ta(S,De),Ta(z,Ne),Ta(_,Ge),null},Ub={display:"none"},L$={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Vj="react-flow__node-desc",Yj="react-flow__edge-desc",q$="react-flow__aria-live",D$=e=>e.ariaLiveMessage;function F$({rfId:e}){const t=it(D$);return de.createElement("div",{id:`${q$}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:L$},t)}function z$({rfId:e,disableKeyboardA11y:t}){return de.createElement(de.Fragment,null,de.createElement("div",{id:`${Vj}-${e}`,style:Ub},"Press enter or space to select a node.",!t&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "),de.createElement("div",{id:`${Yj}-${e}`,style:Ub},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!t&&de.createElement(F$,{rfId:e}))}var _l=(e=null,t={actInsideInputWithModifier:!0})=>{const[n,s]=b.useState(!1),a=b.useRef(!1),i=b.useRef(new Set([])),[l,u]=b.useMemo(()=>{if(e!==null){const p=(Array.isArray(e)?e:[e]).filter(g=>typeof g=="string").map(g=>g.split("+")),h=p.reduce((g,v)=>g.concat(...v),[]);return[p,h]}return[[],[]]},[e]);return b.useEffect(()=>{const f=typeof document<"u"?document:null,p=(t==null?void 0:t.target)||f;if(e!==null){const h=w=>{if(a.current=w.ctrlKey||w.metaKey||w.shiftKey,(!a.current||a.current&&!t.actInsideInputWithModifier)&&Kv(w))return!1;const k=Hb(w.code,u);i.current.add(w[k]),Wb(l,i.current,!1)&&(w.preventDefault(),s(!0))},g=w=>{if((!a.current||a.current&&!t.actInsideInputWithModifier)&&Kv(w))return!1;const k=Hb(w.code,u);Wb(l,i.current,!0)?(s(!1),i.current.clear()):i.current.delete(w[k]),w.key==="Meta"&&i.current.clear(),a.current=!1},v=()=>{i.current.clear(),s(!1)};return p==null||p.addEventListener("keydown",h),p==null||p.addEventListener("keyup",g),window.addEventListener("blur",v),()=>{p==null||p.removeEventListener("keydown",h),p==null||p.removeEventListener("keyup",g),window.removeEventListener("blur",v)}}},[e,s]),n};function Wb(e,t,n){return e.filter(s=>n||s.length===t.size).some(s=>s.every(a=>t.has(a)))}function Hb(e,t){return t.includes(e)?"code":"key"}function Kj(e,t,n,s){var u,f;const a=e.parentNode||e.parentId;if(!a)return n;const i=t.get(a),l=Eo(i,s);return Kj(i,t,{x:(n.x??0)+l.x,y:(n.y??0)+l.y,z:(((u=i[Nt])==null?void 0:u.z)??0)>(n.z??0)?((f=i[Nt])==null?void 0:f.z)??0:n.z??0},s)}function Xj(e,t,n){e.forEach(s=>{var i;const a=s.parentNode||s.parentId;if(a&&!e.has(a))throw new Error(`Parent node ${a} not found`);if(a||n!=null&&n[s.id]){const{x:l,y:u,z:f}=Kj(s,e,{...s.position,z:((i=s[Nt])==null?void 0:i.z)??0},t);s.positionAbsolute={x:l,y:u},s[Nt].z=f,n!=null&&n[s.id]&&(s[Nt].isParent=!0)}})}function uf(e,t,n,s){const a=new Map,i={},l=s?1e3:0;return e.forEach(u=>{var w;const f=(Bn(u.zIndex)?u.zIndex:0)+(u.selected?l:0),p=t.get(u.id),h={...u,positionAbsolute:{x:u.position.x,y:u.position.y}},g=u.parentNode||u.parentId;g&&(i[g]=!0);const v=(p==null?void 0:p.type)&&(p==null?void 0:p.type)!==u.type;Object.defineProperty(h,Nt,{enumerable:!1,value:{handleBounds:v||(w=p==null?void 0:p[Nt])==null?void 0:w.handleBounds,z:f}}),a.set(u.id,h)}),Xj(a,n,i),a}function Qj(e,t={}){const{getNodes:n,width:s,height:a,minZoom:i,maxZoom:l,d3Zoom:u,d3Selection:f,fitViewOnInitDone:p,fitViewOnInit:h,nodeOrigin:g}=e(),v=t.initial&&!p&&h;if(u&&f&&(v||!t.initial)){const N=n().filter(S=>{var E;const _=t.includeHiddenNodes?S.width&&S.height:!S.hidden;return(E=t.nodes)!=null&&E.length?_&&t.nodes.some(C=>C.id===S.id):_}),k=N.every(S=>S.width&&S.height);if(N.length>0&&k){const S=nd(N,g),{x:_,y:E,zoom:C}=Pj(S,s,a,t.minZoom??i,t.maxZoom??l,t.padding??.1),j=ts.translate(_,E).scale(C);return typeof t.duration=="number"&&t.duration>0?u.transform(ko(f,t.duration),j):u.transform(f,j),!0}}return!1}function B$(e,t){return e.forEach(n=>{const s=t.get(n.id);s&&t.set(s.id,{...s,[Nt]:s[Nt],selected:n.selected})}),new Map(t)}function U$(e,t){return t.map(n=>{const s=e.find(a=>a.id===n.id);return s&&(n.selected=s.selected),n})}function cu({changedNodes:e,changedEdges:t,get:n,set:s}){const{nodeInternals:a,edges:i,onNodesChange:l,onEdgesChange:u,hasDefaultNodes:f,hasDefaultEdges:p}=n();e!=null&&e.length&&(f&&s({nodeInternals:B$(e,a)}),l==null||l(e)),t!=null&&t.length&&(p&&s({edges:U$(t,i)}),u==null||u(t))}const Ra=()=>{},W$={zoomIn:Ra,zoomOut:Ra,zoomTo:Ra,getZoom:()=>1,setViewport:Ra,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:Ra,fitBounds:Ra,project:e=>e,screenToFlowPosition:e=>e,flowToScreenPosition:e=>e,viewportInitialized:!1},H$=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),G$=()=>{const e=Mt(),{d3Zoom:t,d3Selection:n}=it(H$,Dt);return b.useMemo(()=>n&&t?{zoomIn:a=>t.scaleBy(ko(n,a==null?void 0:a.duration),1.2),zoomOut:a=>t.scaleBy(ko(n,a==null?void 0:a.duration),1/1.2),zoomTo:(a,i)=>t.scaleTo(ko(n,i==null?void 0:i.duration),a),getZoom:()=>e.getState().transform[2],setViewport:(a,i)=>{const[l,u,f]=e.getState().transform,p=ts.translate(a.x??l,a.y??u).scale(a.zoom??f);t.transform(ko(n,i==null?void 0:i.duration),p)},getViewport:()=>{const[a,i,l]=e.getState().transform;return{x:a,y:i,zoom:l}},fitView:a=>Qj(e.getState,a),setCenter:(a,i,l)=>{const{width:u,height:f,maxZoom:p}=e.getState(),h=typeof(l==null?void 0:l.zoom)<"u"?l.zoom:p,g=u/2-a*h,v=f/2-i*h,w=ts.translate(g,v).scale(h);t.transform(ko(n,l==null?void 0:l.duration),w)},fitBounds:(a,i)=>{const{width:l,height:u,minZoom:f,maxZoom:p}=e.getState(),{x:h,y:g,zoom:v}=Pj(a,l,u,f,p,(i==null?void 0:i.padding)??.1),w=ts.translate(h,g).scale(v);t.transform(ko(n,i==null?void 0:i.duration),w)},project:a=>{const{transform:i,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(a,i,l,u)},screenToFlowPosition:a=>{const{transform:i,snapToGrid:l,snapGrid:u,domNode:f}=e.getState();if(!f)return a;const{x:p,y:h}=f.getBoundingClientRect(),g={x:a.x-p,y:a.y-h};return Zv(g,i,l,u)},flowToScreenPosition:a=>{const{transform:i,domNode:l}=e.getState();if(!l)return a;const{x:u,y:f}=l.getBoundingClientRect(),p=Ij(a,i);return{x:p.x+u,y:p.y+f}},viewportInitialized:!0}:W$,[t,n])};function Il(){const e=G$(),t=Mt(),n=b.useCallback(()=>t.getState().getNodes().map(k=>({...k})),[]),s=b.useCallback(k=>t.getState().nodeInternals.get(k),[]),a=b.useCallback(()=>{const{edges:k=[]}=t.getState();return k.map(S=>({...S}))},[]),i=b.useCallback(k=>{const{edges:S=[]}=t.getState();return S.find(_=>_.id===k)},[]),l=b.useCallback(k=>{const{getNodes:S,setNodes:_,hasDefaultNodes:E,onNodesChange:C}=t.getState(),j=S(),M=typeof k=="function"?k(j):k;if(E)_(M);else if(C){const $=M.length===0?j.map(O=>({type:"remove",id:O.id})):M.map(O=>({item:O,type:"reset"}));C($)}},[]),u=b.useCallback(k=>{const{edges:S=[],setEdges:_,hasDefaultEdges:E,onEdgesChange:C}=t.getState(),j=typeof k=="function"?k(S):k;if(E)_(j);else if(C){const M=j.length===0?S.map($=>({type:"remove",id:$.id})):j.map($=>({item:$,type:"reset"}));C(M)}},[]),f=b.useCallback(k=>{const S=Array.isArray(k)?k:[k],{getNodes:_,setNodes:E,hasDefaultNodes:C,onNodesChange:j}=t.getState();if(C){const $=[..._(),...S];E($)}else if(j){const M=S.map($=>({item:$,type:"add"}));j(M)}},[]),p=b.useCallback(k=>{const S=Array.isArray(k)?k:[k],{edges:_=[],setEdges:E,hasDefaultEdges:C,onEdgesChange:j}=t.getState();if(C)E([..._,...S]);else if(j){const M=S.map($=>({item:$,type:"add"}));j(M)}},[]),h=b.useCallback(()=>{const{getNodes:k,edges:S=[],transform:_}=t.getState(),[E,C,j]=_;return{nodes:k().map(M=>({...M})),edges:S.map(M=>({...M})),viewport:{x:E,y:C,zoom:j}}},[]),g=b.useCallback(({nodes:k,edges:S})=>{const{nodeInternals:_,getNodes:E,edges:C,hasDefaultNodes:j,hasDefaultEdges:M,onNodesDelete:$,onEdgesDelete:O,onNodesChange:z,onEdgesChange:I}=t.getState(),A=(k||[]).map(X=>X.id),q=(S||[]).map(X=>X.id),V=E().reduce((X,B)=>{const ne=B.parentNode||B.parentId,Z=!A.includes(B.id)&&ne&&X.find(J=>J.id===ne);return(typeof B.deletable=="boolean"?B.deletable:!0)&&(A.includes(B.id)||Z)&&X.push(B),X},[]),Y=C.filter(X=>typeof X.deletable=="boolean"?X.deletable:!0),R=Y.filter(X=>q.includes(X.id));if(V||R){const X=$j(V,Y),B=[...R,...X],ne=B.reduce((Z,W)=>(Z.includes(W.id)||Z.push(W.id),Z),[]);if((M||j)&&(M&&t.setState({edges:C.filter(Z=>!ne.includes(Z.id))}),j&&(V.forEach(Z=>{_.delete(Z.id)}),t.setState({nodeInternals:new Map(_)}))),ne.length>0&&(O==null||O(B),I&&I(ne.map(Z=>({id:Z,type:"remove"})))),V.length>0&&($==null||$(V),z)){const Z=V.map(W=>({id:W.id,type:"remove"}));z(Z)}}},[]),v=b.useCallback(k=>{const S=h$(k),_=S?null:t.getState().nodeInternals.get(k.id);return!S&&!_?[null,null,S]:[S?k:Pb(_),_,S]},[]),w=b.useCallback((k,S=!0,_)=>{const[E,C,j]=v(k);return E?(_||t.getState().getNodes()).filter(M=>{if(!j&&(M.id===C.id||!M.positionAbsolute))return!1;const $=Pb(M),O=Yv($,E);return S&&O>0||O>=E.width*E.height}):[]},[]),N=b.useCallback((k,S,_=!0)=>{const[E]=v(k);if(!E)return!1;const C=Yv(E,S);return _&&C>0||C>=E.width*E.height},[]);return b.useMemo(()=>({...e,getNodes:n,getNode:s,getEdges:a,getEdge:i,setNodes:l,setEdges:u,addNodes:f,addEdges:p,toObject:h,deleteElements:g,getIntersectingNodes:w,isNodeIntersecting:N}),[e,n,s,a,i,l,u,f,p,h,g,w,N])}const V$={actInsideInputWithModifier:!1};var Y$=({deleteKeyCode:e,multiSelectionKeyCode:t})=>{const n=Mt(),{deleteElements:s}=Il(),a=_l(e,V$),i=_l(t);b.useEffect(()=>{if(a){const{edges:l,getNodes:u}=n.getState(),f=u().filter(h=>h.selected),p=l.filter(h=>h.selected);s({nodes:f,edges:p}),n.setState({nodesSelectionActive:!1})}},[a]),b.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])};function K$(e){const t=Mt();b.useEffect(()=>{let n;const s=()=>{var i,l;if(!e.current)return;const a=jw(e.current);(a.height===0||a.width===0)&&((l=(i=t.getState()).onError)==null||l.call(i,"004",rs.error004())),t.setState({width:a.width||500,height:a.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 Pw={position:"absolute",width:"100%",height:"100%",top:0,left:0},X$=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,uu=e=>({x:e.x,y:e.y,zoom:e.k}),Aa=(e,t)=>e.target.closest(`.${t}`),Gb=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Vb=e=>{const t=e.ctrlKey&&qu()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t},Q$=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),Z$=({onMove:e,onMoveStart:t,onMoveEnd:n,onPaneContextMenu:s,zoomOnScroll:a=!0,zoomOnPinch:i=!0,panOnScroll:l=!1,panOnScrollSpeed:u=.5,panOnScrollMode:f=So.Free,zoomOnDoubleClick:p=!0,elementsSelectable:h,panOnDrag:g=!0,defaultViewport:v,translateExtent:w,minZoom:N,maxZoom:k,zoomActivationKeyCode:S,preventScrolling:_=!0,children:E,noWheelClassName:C,noPanClassName:j})=>{const M=b.useRef(),$=Mt(),O=b.useRef(!1),z=b.useRef(!1),I=b.useRef(null),A=b.useRef({x:0,y:0,zoom:0}),{d3Zoom:q,d3Selection:V,d3ZoomHandler:Y,userSelectionActive:R}=it(Q$,Dt),X=_l(S),B=b.useRef(0),ne=b.useRef(!1),Z=b.useRef();return K$(I),b.useEffect(()=>{if(I.current){const W=I.current.getBoundingClientRect(),J=bj().scaleExtent([N,k]).translateExtent(w),P=zn(I.current).call(J),K=ts.translate(v.x,v.y).scale(Ga(v.zoom,N,k)),te=[[0,0],[W.width,W.height]],D=J.constrain()(K,te,w);J.transform(P,D),J.wheelDelta(Vb),$.setState({d3Zoom:J,d3Selection:P,d3ZoomHandler:P.on("wheel.zoom"),transform:[D.x,D.y,D.k],domNode:I.current.closest(".react-flow")})}},[]),b.useEffect(()=>{V&&q&&(l&&!X&&!R?V.on("wheel.zoom",W=>{if(Aa(W,C))return!1;W.preventDefault(),W.stopImmediatePropagation();const J=V.property("__zoom").k||1;if(W.ctrlKey&&i){const ie=ar(W),fe=Vb(W),me=J*Math.pow(2,fe);q.scaleTo(V,me,ie,W);return}const P=W.deltaMode===1?20:1;let K=f===So.Vertical?0:W.deltaX*P,te=f===So.Horizontal?0:W.deltaY*P;!qu()&&W.shiftKey&&f!==So.Vertical&&(K=W.deltaY*P,te=0),q.translateBy(V,-(K/J)*u,-(te/J)*u,{internal:!0});const D=uu(V.property("__zoom")),{onViewportChangeStart:L,onViewportChange:Q,onViewportChangeEnd:U}=$.getState();clearTimeout(Z.current),ne.current||(ne.current=!0,t==null||t(W,D),L==null||L(D)),ne.current&&(e==null||e(W,D),Q==null||Q(D),Z.current=setTimeout(()=>{n==null||n(W,D),U==null||U(D),ne.current=!1},150))},{passive:!1}):typeof Y<"u"&&V.on("wheel.zoom",function(W,J){if(!_&&W.type==="wheel"&&!W.ctrlKey||Aa(W,C))return null;W.preventDefault(),Y.call(this,W,J)},{passive:!1}))},[R,l,f,V,q,Y,X,i,_,C,t,e,n]),b.useEffect(()=>{q&&q.on("start",W=>{var K,te;if(!W.sourceEvent||W.sourceEvent.internal)return null;B.current=(K=W.sourceEvent)==null?void 0:K.button;const{onViewportChangeStart:J}=$.getState(),P=uu(W.transform);O.current=!0,A.current=P,((te=W.sourceEvent)==null?void 0:te.type)==="mousedown"&&$.setState({paneDragging:!0}),J==null||J(P),t==null||t(W.sourceEvent,P)})},[q,t]),b.useEffect(()=>{q&&(R&&!O.current?q.on("zoom",null):R||q.on("zoom",W=>{var P;const{onViewportChange:J}=$.getState();if($.setState({transform:[W.transform.x,W.transform.y,W.transform.k]}),z.current=!!(s&&Gb(g,B.current??0)),(e||J)&&!((P=W.sourceEvent)!=null&&P.internal)){const K=uu(W.transform);J==null||J(K),e==null||e(W.sourceEvent,K)}}))},[R,q,e,g,s]),b.useEffect(()=>{q&&q.on("end",W=>{if(!W.sourceEvent||W.sourceEvent.internal)return null;const{onViewportChangeEnd:J}=$.getState();if(O.current=!1,$.setState({paneDragging:!1}),s&&Gb(g,B.current??0)&&!z.current&&s(W.sourceEvent),z.current=!1,(n||J)&&X$(A.current,W.transform)){const P=uu(W.transform);A.current=P,clearTimeout(M.current),M.current=setTimeout(()=>{J==null||J(P),n==null||n(W.sourceEvent,P)},l?150:0)}})},[q,l,g,n,s]),b.useEffect(()=>{q&&q.filter(W=>{const J=X||a,P=i&&W.ctrlKey;if((g===!0||Array.isArray(g)&&g.includes(1))&&W.button===1&&W.type==="mousedown"&&(Aa(W,"react-flow__node")||Aa(W,"react-flow__edge")))return!0;if(!g&&!J&&!l&&!p&&!i||R||!p&&W.type==="dblclick"||Aa(W,C)&&W.type==="wheel"||Aa(W,j)&&(W.type!=="wheel"||l&&W.type==="wheel"&&!X)||!i&&W.ctrlKey&&W.type==="wheel"||!J&&!l&&!P&&W.type==="wheel"||!g&&(W.type==="mousedown"||W.type==="touchstart")||Array.isArray(g)&&!g.includes(W.button)&&W.type==="mousedown")return!1;const K=Array.isArray(g)&&g.includes(W.button)||!W.button||W.button<=1;return(!W.ctrlKey||W.type==="wheel")&&K})},[R,q,a,i,l,p,g,h,X]),de.createElement("div",{className:"react-flow__renderer",ref:I,style:Pw},E)},J$=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function eP(){const{userSelectionActive:e,userSelectionRect:t}=it(J$,Dt);return e&&t?de.createElement("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}function Yb(e,t){const n=t.parentNode||t.parentId,s=e.find(a=>a.id===n);if(s){const a=t.position.x+t.width-s.width,i=t.position.y+t.height-s.height;if(a>0||i>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,a>0&&(s.style.width+=a),i>0&&(s.style.height+=i),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 tP(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,a)=>{const i=e.filter(u=>u.id===a.id);if(i.length===0)return s.push(a),s;const l={...a};for(const u of i)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&&Yb(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&&Yb(s,l);break}case"remove":return s}return s.push(l),s},n)}function nP(e,t){return tP(e,t)}const $s=(e,t)=>({id:e,type:"select",selected:t});function La(e,t){return e.reduce((n,s)=>{const a=t.includes(s.id);return!s.selected&&a?(s.selected=!0,n.push($s(s.id,!0))):s.selected&&!a&&(s.selected=!1,n.push($s(s.id,!1))),n},[])}const df=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},rP=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),Zj=b.memo(({isSelecting:e,selectionMode:t=kl.Full,panOnDrag:n,onSelectionStart:s,onSelectionEnd:a,onPaneClick:i,onPaneContextMenu:l,onPaneScroll:u,onPaneMouseEnter:f,onPaneMouseMove:p,onPaneMouseLeave:h,children:g})=>{const v=b.useRef(null),w=Mt(),N=b.useRef(0),k=b.useRef(0),S=b.useRef(),{userSelectionActive:_,elementsSelectable:E,dragging:C}=it(rP,Dt),j=()=>{w.setState({userSelectionActive:!1,userSelectionRect:null}),N.current=0,k.current=0},M=Y=>{i==null||i(Y),w.getState().resetSelectedElements(),w.setState({nodesSelectionActive:!1})},$=Y=>{if(Array.isArray(n)&&(n!=null&&n.includes(2))){Y.preventDefault();return}l==null||l(Y)},O=u?Y=>u(Y):void 0,z=Y=>{const{resetSelectedElements:R,domNode:X}=w.getState();if(S.current=X==null?void 0:X.getBoundingClientRect(),!E||!e||Y.button!==0||Y.target!==v.current||!S.current)return;const{x:B,y:ne}=Ls(Y,S.current);R(),w.setState({userSelectionRect:{width:0,height:0,startX:B,startY:ne,x:B,y:ne}}),s==null||s(Y)},I=Y=>{const{userSelectionRect:R,nodeInternals:X,edges:B,transform:ne,onNodesChange:Z,onEdgesChange:W,nodeOrigin:J,getNodes:P}=w.getState();if(!e||!S.current||!R)return;w.setState({userSelectionActive:!0,nodesSelectionActive:!1});const K=Ls(Y,S.current),te=R.startX??0,D=R.startY??0,L={...R,x:K.x<te?K.x:te,y:K.y<D?K.y:D,width:Math.abs(K.x-te),height:Math.abs(K.y-D)},Q=P(),U=Oj(X,L,ne,t===kl.Partial,!0,J),ie=$j(U,B).map(me=>me.id),fe=U.map(me=>me.id);if(N.current!==fe.length){N.current=fe.length;const me=La(Q,fe);me.length&&(Z==null||Z(me))}if(k.current!==ie.length){k.current=ie.length;const me=La(B,ie);me.length&&(W==null||W(me))}w.setState({userSelectionRect:L})},A=Y=>{if(Y.button!==0)return;const{userSelectionRect:R}=w.getState();!_&&R&&Y.target===v.current&&(M==null||M(Y)),w.setState({nodesSelectionActive:N.current>0}),j(),a==null||a(Y)},q=Y=>{_&&(w.setState({nodesSelectionActive:N.current>0}),a==null||a(Y)),j()},V=E&&(e||_);return de.createElement("div",{className:Kt(["react-flow__pane",{dragging:C,selection:e}]),onClick:V?void 0:df(M,v),onContextMenu:df($,v),onWheel:df(O,v),onMouseEnter:V?void 0:f,onMouseDown:V?z:void 0,onMouseMove:V?I:p,onMouseUp:V?A:void 0,onMouseLeave:V?q:h,ref:v,style:Pw},g,de.createElement(eP,null))});Zj.displayName="Pane";function Jj(e,t){const n=e.parentNode||e.parentId;if(!n)return!1;const s=t.get(n);return s?s.selected?!0:Jj(s,t):!1}function Kb(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 sP(e,t,n,s){return Array.from(e.values()).filter(a=>(a.selected||a.id===s)&&(!a.parentNode||a.parentId||!Jj(a,e))&&(a.draggable||t&&typeof a.draggable>"u")).map(a=>{var i,l;return{id:a.id,position:a.position||{x:0,y:0},positionAbsolute:a.positionAbsolute||{x:0,y:0},distance:{x:n.x-(((i=a.positionAbsolute)==null?void 0:i.x)??0),y:n.y-(((l=a.positionAbsolute)==null?void 0:l.y)??0)},delta:{x:0,y:0},extent:a.extent,parentNode:a.parentNode||a.parentId,parentId:a.parentNode||a.parentId,width:a.width,height:a.height,expandParent:a.expandParent}})}function oP(e,t){return!t||t==="parent"?t:[t[0],[t[1][0]-(e.width||0),t[1][1]-(e.height||0)]]}function eT(e,t,n,s,a=[0,0],i){const l=oP(e,e.extent||s);let u=l;const f=e.parentNode||e.parentId;if(e.extent==="parent"&&!e.expandParent)if(f&&e.width&&e.height){const g=n.get(f),{x:v,y:w}=Eo(g,a).positionAbsolute;u=g&&Bn(v)&&Bn(w)&&Bn(g.width)&&Bn(g.height)?[[v+e.width*a[0],w+e.height*a[1]],[v+g.width-e.width+e.width*a[0],w+g.height-e.height+e.height*a[1]]]:u}else i==null||i("005",rs.error005()),u=l;else if(e.extent&&f&&e.extent!=="parent"){const g=n.get(f),{x:v,y:w}=Eo(g,a).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(f){const g=n.get(f);p=Eo(g,a).positionAbsolute}const h=u&&u!=="parent"?Tw(t,u):t;return{position:{x:h.x-p.x,y:h.y-p.y},positionAbsolute:h}}function hf({nodeId:e,dragItems:t,nodeInternals:n}){const s=t.map(a=>({...n.get(a.id),position:a.position,positionAbsolute:a.positionAbsolute}));return[e?s.find(a=>a.id===e):s[0],s]}const Xb=(e,t,n,s)=>{const a=t.querySelectorAll(e);if(!a||!a.length)return null;const i=Array.from(a),l=t.getBoundingClientRect(),u={x:l.width*s[0],y:l.height*s[1]};return i.map(f=>{const p=f.getBoundingClientRect();return{id:f.getAttribute("data-handleid"),position:f.getAttribute("data-handlepos"),x:(p.left-l.left-u.x)/n,y:(p.top-l.top-u.y)/n,...jw(f)}})};function rl(e,t,n){return n===void 0?n:s=>{const a=t().nodeInternals.get(e);a&&n(s,{...a})}}function ew({id:e,store:t,unselect:n=!1,nodeRef:s}){const{addSelectedNodes:a,unselectNodesAndEdges:i,multiSelectionActive:l,nodeInternals:u,onError:f}=t.getState(),p=u.get(e);if(!p){f==null||f("012",rs.error012(e));return}t.setState({nodesSelectionActive:!1}),p.selected?(n||p.selected&&l)&&(i({nodes:[p],edges:[]}),requestAnimationFrame(()=>{var h;return(h=s==null?void 0:s.current)==null?void 0:h.blur()})):a([e])}function aP(){const e=Mt();return b.useCallback(({sourceEvent:n})=>{const{transform:s,snapGrid:a,snapToGrid:i}=e.getState(),l=n.touches?n.touches[0].clientX:n.clientX,u=n.touches?n.touches[0].clientY:n.clientY,f={x:(l-s[0])/s[2],y:(u-s[1])/s[2]};return{xSnapped:i?a[0]*Math.round(f.x/a[0]):f.x,ySnapped:i?a[1]*Math.round(f.y/a[1]):f.y,...f}},[])}function ff(e){return(t,n,s)=>e==null?void 0:e(t,s)}function tT({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:s,nodeId:a,isSelectable:i,selectNodesOnDrag:l}){const u=Mt(),[f,p]=b.useState(!1),h=b.useRef([]),g=b.useRef({x:null,y:null}),v=b.useRef(0),w=b.useRef(null),N=b.useRef({x:0,y:0}),k=b.useRef(null),S=b.useRef(!1),_=b.useRef(!1),E=b.useRef(!1),C=aP();return b.useEffect(()=>{if(e!=null&&e.current){const j=zn(e.current),M=({x:z,y:I})=>{const{nodeInternals:A,onNodeDrag:q,onSelectionDrag:V,updateNodePositions:Y,nodeExtent:R,snapGrid:X,snapToGrid:B,nodeOrigin:ne,onError:Z}=u.getState();g.current={x:z,y:I};let W=!1,J={x:0,y:0,x2:0,y2:0};if(h.current.length>1&&R){const K=nd(h.current,ne);J=bl(K)}if(h.current=h.current.map(K=>{const te={x:z-K.distance.x,y:I-K.distance.y};B&&(te.x=X[0]*Math.round(te.x/X[0]),te.y=X[1]*Math.round(te.y/X[1]));const D=[[R[0][0],R[0][1]],[R[1][0],R[1][1]]];h.current.length>1&&R&&!K.extent&&(D[0][0]=K.positionAbsolute.x-J.x+R[0][0],D[1][0]=K.positionAbsolute.x+(K.width??0)-J.x2+R[1][0],D[0][1]=K.positionAbsolute.y-J.y+R[0][1],D[1][1]=K.positionAbsolute.y+(K.height??0)-J.y2+R[1][1]);const L=eT(K,te,A,D,ne,Z);return W=W||K.position.x!==L.position.x||K.position.y!==L.position.y,K.position=L.position,K.positionAbsolute=L.positionAbsolute,K}),!W)return;Y(h.current,!0,!0),p(!0);const P=a?q:ff(V);if(P&&k.current){const[K,te]=hf({nodeId:a,dragItems:h.current,nodeInternals:A});P(k.current,K,te)}},$=()=>{if(!w.current)return;const[z,I]=_j(N.current,w.current);if(z!==0||I!==0){const{transform:A,panBy:q}=u.getState();g.current.x=(g.current.x??0)-z/A[2],g.current.y=(g.current.y??0)-I/A[2],q({x:z,y:I})&&M(g.current)}v.current=requestAnimationFrame($)},O=z=>{var ne;const{nodeInternals:I,multiSelectionActive:A,nodesDraggable:q,unselectNodesAndEdges:V,onNodeDragStart:Y,onSelectionDragStart:R}=u.getState();_.current=!0;const X=a?Y:ff(R);(!l||!i)&&!A&&a&&((ne=I.get(a))!=null&&ne.selected||V()),a&&i&&l&&ew({id:a,store:u,nodeRef:e});const B=C(z);if(g.current=B,h.current=sP(I,q,B,a),X&&h.current){const[Z,W]=hf({nodeId:a,dragItems:h.current,nodeInternals:I});X(z.sourceEvent,Z,W)}};if(t)j.on(".drag",null);else{const z=gI().on("start",I=>{const{domNode:A,nodeDragThreshold:q}=u.getState();q===0&&O(I),E.current=!1;const V=C(I);g.current=V,w.current=(A==null?void 0:A.getBoundingClientRect())||null,N.current=Ls(I.sourceEvent,w.current)}).on("drag",I=>{var Y,R;const A=C(I),{autoPanOnNodeDrag:q,nodeDragThreshold:V}=u.getState();if(I.sourceEvent.type==="touchmove"&&I.sourceEvent.touches.length>1&&(E.current=!0),!E.current){if(!S.current&&_.current&&q&&(S.current=!0,$()),!_.current){const X=A.xSnapped-(((Y=g==null?void 0:g.current)==null?void 0:Y.x)??0),B=A.ySnapped-(((R=g==null?void 0:g.current)==null?void 0:R.y)??0);Math.sqrt(X*X+B*B)>V&&O(I)}(g.current.x!==A.xSnapped||g.current.y!==A.ySnapped)&&h.current&&_.current&&(k.current=I.sourceEvent,N.current=Ls(I.sourceEvent,w.current),M(A))}}).on("end",I=>{if(!(!_.current||E.current)&&(p(!1),S.current=!1,_.current=!1,cancelAnimationFrame(v.current),h.current)){const{updateNodePositions:A,nodeInternals:q,onNodeDragStop:V,onSelectionDragStop:Y}=u.getState(),R=a?V:ff(Y);if(A(h.current,!1,!1),R){const[X,B]=hf({nodeId:a,dragItems:h.current,nodeInternals:q});R(I.sourceEvent,X,B)}}}).filter(I=>{const A=I.target;return!I.button&&(!n||!Kb(A,`.${n}`,e))&&(!s||Kb(A,s,e))});return j.call(z),()=>{j.on(".drag",null)}}}},[e,t,n,s,i,u,a,l,C]),f}function nT(){const e=Mt();return b.useCallback(n=>{const{nodeInternals:s,nodeExtent:a,updateNodePositions:i,getNodes:l,snapToGrid:u,snapGrid:f,onError:p,nodesDraggable:h}=e.getState(),g=l().filter(E=>E.selected&&(E.draggable||h&&typeof E.draggable>"u")),v=u?f[0]:5,w=u?f[1]:5,N=n.isShiftPressed?4:1,k=n.x*v*N,S=n.y*w*N,_=g.map(E=>{if(E.positionAbsolute){const C={x:E.positionAbsolute.x+k,y:E.positionAbsolute.y+S};u&&(C.x=f[0]*Math.round(C.x/f[0]),C.y=f[1]*Math.round(C.y/f[1]));const{positionAbsolute:j,position:M}=eT(E,C,s,a,void 0,p);E.position=M,E.positionAbsolute=j}return E});i(_,!0,!1)},[])}const Ba={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var sl=e=>{const t=({id:n,type:s,data:a,xPos:i,yPos:l,xPosOrigin:u,yPosOrigin:f,selected:p,onClick:h,onMouseEnter:g,onMouseMove:v,onMouseLeave:w,onContextMenu:N,onDoubleClick:k,style:S,className:_,isDraggable:E,isSelectable:C,isConnectable:j,isFocusable:M,selectNodesOnDrag:$,sourcePosition:O,targetPosition:z,hidden:I,resizeObserver:A,dragHandle:q,zIndex:V,isParent:Y,noDragClassName:R,noPanClassName:X,initialized:B,disableKeyboardA11y:ne,ariaLabel:Z,rfId:W,hasHandleBounds:J})=>{const P=Mt(),K=b.useRef(null),te=b.useRef(null),D=b.useRef(O),L=b.useRef(z),Q=b.useRef(s),U=C||E||h||g||v||w,ie=nT(),fe=rl(n,P.getState,g),me=rl(n,P.getState,v),ke=rl(n,P.getState,w),Ve=rl(n,P.getState,N),Le=rl(n,P.getState,k),De=be=>{const{nodeDragThreshold:se}=P.getState();if(C&&(!$||!E||se>0)&&ew({id:n,store:P,nodeRef:K}),h){const Qe=P.getState().nodeInternals.get(n);Qe&&h(be,{...Qe})}},Ne=be=>{if(!Kv(be)&&!ne)if(Cj.includes(be.key)&&C){const se=be.key==="Escape";ew({id:n,store:P,unselect:se,nodeRef:K})}else E&&p&&Object.prototype.hasOwnProperty.call(Ba,be.key)&&(P.setState({ariaLiveMessage:`Moved selected node ${be.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~i}, y: ${~~l}`}),ie({x:Ba[be.key].x,y:Ba[be.key].y,isShiftPressed:be.shiftKey}))};b.useEffect(()=>()=>{te.current&&(A==null||A.unobserve(te.current),te.current=null)},[]),b.useEffect(()=>{if(K.current&&!I){const be=K.current;(!B||!J||te.current!==be)&&(te.current&&(A==null||A.unobserve(te.current)),A==null||A.observe(be),te.current=be)}},[I,B,J]),b.useEffect(()=>{const be=Q.current!==s,se=D.current!==O,Qe=L.current!==z;K.current&&(be||se||Qe)&&(be&&(Q.current=s),se&&(D.current=O),Qe&&(L.current=z),P.getState().updateNodeDimensions([{id:n,nodeElement:K.current,forceUpdate:!0}]))},[n,s,O,z]);const Ge=tT({nodeRef:K,disabled:I||!E,noDragClassName:R,handleSelector:q,nodeId:n,isSelectable:C,selectNodesOnDrag:$});return I?null:de.createElement("div",{className:Kt(["react-flow__node",`react-flow__node-${s}`,{[X]:E},_,{selected:p,selectable:C,parent:Y,dragging:Ge}]),ref:K,style:{zIndex:V,transform:`translate(${u}px,${f}px)`,pointerEvents:U?"all":"none",visibility:B?"visible":"hidden",...S},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:fe,onMouseMove:me,onMouseLeave:ke,onContextMenu:Ve,onClick:De,onDoubleClick:Le,onKeyDown:M?Ne:void 0,tabIndex:M?0:void 0,role:M?"button":void 0,"aria-describedby":ne?void 0:`${Vj}-${W}`,"aria-label":Z},de.createElement(w$,{value:n},de.createElement(e,{id:n,data:a,type:s,xPos:i,yPos:l,selected:p,isConnectable:j,sourcePosition:O,targetPosition:z,dragging:Ge,dragHandle:q,zIndex:V})))};return t.displayName="NodeWrapper",b.memo(t)};const iP=e=>{const t=e.getNodes().filter(n=>n.selected);return{...nd(t,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};function lP({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const s=Mt(),{width:a,height:i,x:l,y:u,transformString:f,userSelectionActive:p}=it(iP,Dt),h=nT(),g=b.useRef(null);if(b.useEffect(()=>{var N;n||(N=g.current)==null||N.focus({preventScroll:!0})},[n]),tT({nodeRef:g}),p||!a||!i)return null;const v=e?N=>{const k=s.getState().getNodes().filter(S=>S.selected);e(N,k)}:void 0,w=N=>{Object.prototype.hasOwnProperty.call(Ba,N.key)&&h({x:Ba[N.key].x,y:Ba[N.key].y,isShiftPressed:N.shiftKey})};return de.createElement("div",{className:Kt(["react-flow__nodesselection","react-flow__container",t]),style:{transform:f}},de.createElement("div",{ref:g,className:"react-flow__nodesselection-rect",onContextMenu:v,tabIndex:n?void 0:-1,onKeyDown:n?void 0:w,style:{width:a,height:i,top:u,left:l}}))}var cP=b.memo(lP);const uP=e=>e.nodesSelectionActive,rT=({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:s,onPaneMouseLeave:a,onPaneContextMenu:i,onPaneScroll:l,deleteKeyCode:u,onMove:f,onMoveStart:p,onMoveEnd:h,selectionKeyCode:g,selectionOnDrag:v,selectionMode:w,onSelectionStart:N,onSelectionEnd:k,multiSelectionKeyCode:S,panActivationKeyCode:_,zoomActivationKeyCode:E,elementsSelectable:C,zoomOnScroll:j,zoomOnPinch:M,panOnScroll:$,panOnScrollSpeed:O,panOnScrollMode:z,zoomOnDoubleClick:I,panOnDrag:A,defaultViewport:q,translateExtent:V,minZoom:Y,maxZoom:R,preventScrolling:X,onSelectionContextMenu:B,noWheelClassName:ne,noPanClassName:Z,disableKeyboardA11y:W})=>{const J=it(uP),P=_l(g),K=_l(_),te=K||A,D=K||$,L=P||v&&te!==!0;return Y$({deleteKeyCode:u,multiSelectionKeyCode:S}),de.createElement(Z$,{onMove:f,onMoveStart:p,onMoveEnd:h,onPaneContextMenu:i,elementsSelectable:C,zoomOnScroll:j,zoomOnPinch:M,panOnScroll:D,panOnScrollSpeed:O,panOnScrollMode:z,zoomOnDoubleClick:I,panOnDrag:!P&&te,defaultViewport:q,translateExtent:V,minZoom:Y,maxZoom:R,zoomActivationKeyCode:E,preventScrolling:X,noWheelClassName:ne,noPanClassName:Z},de.createElement(Zj,{onSelectionStart:N,onSelectionEnd:k,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:s,onPaneMouseLeave:a,onPaneContextMenu:i,onPaneScroll:l,panOnDrag:te,isSelecting:!!L,selectionMode:w},e,J&&de.createElement(cP,{onSelectionContextMenu:B,noPanClassName:Z,disableKeyboardA11y:W})))};rT.displayName="FlowRenderer";var dP=b.memo(rT);function hP(e){return it(b.useCallback(n=>e?Oj(n.nodeInternals,{x:0,y:0,width:n.width,height:n.height},n.transform,!0):n.getNodes(),[e]))}function fP(e){const t={input:sl(e.input||Uj),default:sl(e.default||Jv),output:sl(e.output||Hj),group:sl(e.group||$w)},n={},s=Object.keys(e).filter(a=>!["input","default","output","group"].includes(a)).reduce((a,i)=>(a[i]=sl(e[i]||Jv),a),n);return{...t,...s}}const pP=({x:e,y:t,width:n,height:s,origin:a})=>!n||!s?{x:e,y:t}:a[0]<0||a[1]<0||a[0]>1||a[1]>1?{x:e,y:t}:{x:e-n*a[0],y:t-s*a[1]},mP=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),sT=e=>{const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:s,elementsSelectable:a,updateNodeDimensions:i,onError:l}=it(mP,Dt),u=hP(e.onlyRenderVisibleElements),f=b.useRef(),p=b.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const h=new ResizeObserver(g=>{const v=g.map(w=>({id:w.target.getAttribute("data-id"),nodeElement:w.target,forceUpdate:!0}));i(v)});return f.current=h,h},[]);return b.useEffect(()=>()=>{var h;(h=f==null?void 0:f.current)==null||h.disconnect()},[]),de.createElement("div",{className:"react-flow__nodes",style:Pw},u.map(h=>{var M,$,O;let g=h.type||"default";e.nodeTypes[g]||(l==null||l("003",rs.error003(g)),g="default");const v=e.nodeTypes[g]||e.nodeTypes.default,w=!!(h.draggable||t&&typeof h.draggable>"u"),N=!!(h.selectable||a&&typeof h.selectable>"u"),k=!!(h.connectable||n&&typeof h.connectable>"u"),S=!!(h.focusable||s&&typeof h.focusable>"u"),_=e.nodeExtent?Tw(h.positionAbsolute,e.nodeExtent):h.positionAbsolute,E=(_==null?void 0:_.x)??0,C=(_==null?void 0:_.y)??0,j=pP({x:E,y:C,width:h.width??0,height:h.height??0,origin:e.nodeOrigin});return de.createElement(v,{key:h.id,id:h.id,className:h.className,style:h.style,type:g,data:h.data,sourcePosition:h.sourcePosition||$e.Bottom,targetPosition:h.targetPosition||$e.Top,hidden:h.hidden,xPos:E,yPos:C,xPosOrigin:j.x,yPosOrigin:j.y,selectNodesOnDrag:e.selectNodesOnDrag,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,selected:!!h.selected,isDraggable:w,isSelectable:N,isConnectable:k,isFocusable:S,resizeObserver:p,dragHandle:h.dragHandle,zIndex:((M=h[Nt])==null?void 0:M.z)??0,isParent:!!(($=h[Nt])!=null&&$.isParent),noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!h.width&&!!h.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:h.ariaLabel,hasHandleBounds:!!((O=h[Nt])!=null&&O.handleBounds)})}))};sT.displayName="NodeRenderer";var gP=b.memo(sT);const yP=(e,t,n)=>n===$e.Left?e-t:n===$e.Right?e+t:e,vP=(e,t,n)=>n===$e.Top?e-t:n===$e.Bottom?e+t:e,Qb="react-flow__edgeupdater",Zb=({position:e,centerX:t,centerY:n,radius:s=10,onMouseDown:a,onMouseEnter:i,onMouseOut:l,type:u})=>de.createElement("circle",{onMouseDown:a,onMouseEnter:i,onMouseOut:l,className:Kt([Qb,`${Qb}-${u}`]),cx:yP(t,s,e),cy:vP(n,s,e),r:s,stroke:"transparent",fill:"transparent"}),wP=()=>!0;var Ma=e=>{const t=({id:n,className:s,type:a,data:i,onClick:l,onEdgeDoubleClick:u,selected:f,animated:p,label:h,labelStyle:g,labelShowBg:v,labelBgStyle:w,labelBgPadding:N,labelBgBorderRadius:k,style:S,source:_,target:E,sourceX:C,sourceY:j,targetX:M,targetY:$,sourcePosition:O,targetPosition:z,elementsSelectable:I,hidden:A,sourceHandleId:q,targetHandleId:V,onContextMenu:Y,onMouseEnter:R,onMouseMove:X,onMouseLeave:B,reconnectRadius:ne,onReconnect:Z,onReconnectStart:W,onReconnectEnd:J,markerEnd:P,markerStart:K,rfId:te,ariaLabel:D,isFocusable:L,isReconnectable:Q,pathOptions:U,interactionWidth:ie,disableKeyboardA11y:fe})=>{const me=b.useRef(null),[ke,Ve]=b.useState(!1),[Le,De]=b.useState(!1),Ne=Mt(),Ge=b.useMemo(()=>`url('#${Qv(K,te)}')`,[K,te]),be=b.useMemo(()=>`url('#${Qv(P,te)}')`,[P,te]);if(A)return null;const se=Se=>{var Re;const{edges:qe,addSelectedEdges:_e,unselectNodesAndEdges:Be,multiSelectionActive:_t}=Ne.getState(),yt=qe.find(at=>at.id===n);yt&&(I&&(Ne.setState({nodesSelectionActive:!1}),yt.selected&&_t?(Be({nodes:[],edges:[yt]}),(Re=me.current)==null||Re.blur()):_e([n])),l&&l(Se,yt))},Qe=nl(n,Ne.getState,u),ut=nl(n,Ne.getState,Y),lt=nl(n,Ne.getState,R),rt=nl(n,Ne.getState,X),Ye=nl(n,Ne.getState,B),pe=(Se,qe)=>{if(Se.button!==0)return;const{edges:_e,isValidConnection:Be}=Ne.getState(),_t=qe?E:_,yt=(qe?V:q)||null,Re=qe?"target":"source",at=Be||wP,vt=qe,wt=_e.find(An=>An.id===n);De(!0),W==null||W(Se,wt,Re);const sn=An=>{De(!1),J==null||J(An,wt,Re)};Dj({event:Se,handleId:yt,nodeId:_t,onConnect:An=>Z==null?void 0:Z(wt,An),isTarget:vt,getState:Ne.getState,setState:Ne.setState,isValidConnection:at,edgeUpdaterType:Re,onReconnectEnd:sn})},we=Se=>pe(Se,!0),Pe=Se=>pe(Se,!1),Ue=()=>Ve(!0),st=()=>Ve(!1),Oe=!I&&!l,oe=Se=>{var qe;if(!fe&&Cj.includes(Se.key)&&I){const{unselectNodesAndEdges:_e,addSelectedEdges:Be,edges:_t}=Ne.getState();Se.key==="Escape"?((qe=me.current)==null||qe.blur(),_e({edges:[_t.find(Re=>Re.id===n)]})):Be([n])}};return de.createElement("g",{className:Kt(["react-flow__edge",`react-flow__edge-${a}`,s,{selected:f,animated:p,inactive:Oe,updating:ke}]),onClick:se,onDoubleClick:Qe,onContextMenu:ut,onMouseEnter:lt,onMouseMove:rt,onMouseLeave:Ye,onKeyDown:L?oe:void 0,tabIndex:L?0:void 0,role:L?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":D===null?void 0:D||`Edge from ${_} to ${E}`,"aria-describedby":L?`${Yj}-${te}`:void 0,ref:me},!Le&&de.createElement(e,{id:n,source:_,target:E,selected:f,animated:p,label:h,labelStyle:g,labelShowBg:v,labelBgStyle:w,labelBgPadding:N,labelBgBorderRadius:k,data:i,style:S,sourceX:C,sourceY:j,targetX:M,targetY:$,sourcePosition:O,targetPosition:z,sourceHandleId:q,targetHandleId:V,markerStart:Ge,markerEnd:be,pathOptions:U,interactionWidth:ie}),Q&&de.createElement(de.Fragment,null,(Q==="source"||Q===!0)&&de.createElement(Zb,{position:O,centerX:C,centerY:j,radius:ne,onMouseDown:we,onMouseEnter:Ue,onMouseOut:st,type:"source"}),(Q==="target"||Q===!0)&&de.createElement(Zb,{position:z,centerX:M,centerY:$,radius:ne,onMouseDown:Pe,onMouseEnter:Ue,onMouseOut:st,type:"target"})))};return t.displayName="EdgeWrapper",b.memo(t)};function xP(e){const t={default:Ma(e.default||Fu),straight:Ma(e.bezier||Mw),step:Ma(e.step||Aw),smoothstep:Ma(e.step||td),simplebezier:Ma(e.simplebezier||Rw)},n={},s=Object.keys(e).filter(a=>!["default","bezier"].includes(a)).reduce((a,i)=>(a[i]=Ma(e[i]||Fu),a),n);return{...t,...s}}function Jb(e,t,n=null){const s=((n==null?void 0:n.x)||0)+t.x,a=((n==null?void 0:n.y)||0)+t.y,i=(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+i/2,y:a};case $e.Right:return{x:s+i,y:a+l/2};case $e.Bottom:return{x:s+i/2,y:a+l};case $e.Left:return{x:s,y:a+l/2}}}function ek(e,t){return e?e.length===1||!t?e[0]:t&&e.find(n=>n.id===t)||null:null}const bP=(e,t,n,s,a,i)=>{const l=Jb(n,e,t),u=Jb(i,s,a);return{sourceX:l.x,sourceY:l.y,targetX:u.x,targetY:u.y}};function kP({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:s,targetWidth:a,targetHeight:i,width:l,height:u,transform:f}){const p={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+n,t.x+a),y2:Math.max(e.y+s,t.y+i)};p.x===p.x2&&(p.x2+=1),p.y===p.y2&&(p.y2+=1);const h=bl({x:(0-f[0])/f[2],y:(0-f[1])/f[2],width:l/f[2],height:u/f[2]}),g=Math.max(0,Math.min(h.x2,p.x2)-Math.max(h.x,p.x)),v=Math.max(0,Math.min(h.y2,p.y2)-Math.max(h.y,p.y));return Math.ceil(g*v)>0}function tk(e){var s,a,i,l,u;const t=((s=e==null?void 0:e[Nt])==null?void 0:s.handleBounds)||null,n=t&&(e==null?void 0:e.width)&&(e==null?void 0:e.height)&&typeof((a=e==null?void 0:e.positionAbsolute)==null?void 0:a.x)<"u"&&typeof((i=e==null?void 0:e.positionAbsolute)==null?void 0:i.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 _P=[{level:0,isMaxLevel:!0,edges:[]}];function SP(e,t,n=!1){let s=-1;const a=e.reduce((l,u)=>{var h,g;const f=Bn(u.zIndex);let p=f?u.zIndex:0;if(n){const v=t.get(u.target),w=t.get(u.source),N=u.selected||(v==null?void 0:v.selected)||(w==null?void 0:w.selected),k=Math.max(((h=w==null?void 0:w[Nt])==null?void 0:h.z)||0,((g=v==null?void 0:v[Nt])==null?void 0:g.z)||0,1e3);p=(f?u.zIndex:0)+(N?k:0)}return l[p]?l[p].push(u):l[p]=[u],s=p>s?p:s,l},{}),i=Object.entries(a).map(([l,u])=>{const f=+l;return{edges:u,level:f,isMaxLevel:f===s}});return i.length===0?_P:i}function NP(e,t,n){const s=it(b.useCallback(a=>e?a.edges.filter(i=>{const l=t.get(i.source),u=t.get(i.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)&&kP({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:a.width,height:a.height,transform:a.transform})}):a.edges,[e,t]));return SP(s,t,n)}const EP=({color:e="none",strokeWidth:t=1})=>de.createElement("polyline",{style:{stroke:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),CP=({color:e="none",strokeWidth:t=1})=>de.createElement("polyline",{style:{stroke:e,fill:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),nk={[Du.Arrow]:EP,[Du.ArrowClosed]:CP};function jP(e){const t=Mt();return b.useMemo(()=>{var a,i;return Object.prototype.hasOwnProperty.call(nk,e)?nk[e]:((i=(a=t.getState()).onError)==null||i.call(a,"009",rs.error009(e)),null)},[e])}const TP=({id:e,type:t,color:n,width:s=12.5,height:a=12.5,markerUnits:i="strokeWidth",strokeWidth:l,orient:u="auto-start-reverse"})=>{const f=jP(t);return f?de.createElement("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${s}`,markerHeight:`${a}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:u,refX:"0",refY:"0"},de.createElement(f,{color:n,strokeWidth:l})):null},RP=({defaultColor:e,rfId:t})=>n=>{const s=[];return n.edges.reduce((a,i)=>([i.markerStart,i.markerEnd].forEach(l=>{if(l&&typeof l=="object"){const u=Qv(l,t);s.includes(u)||(a.push({id:u,color:l.color||e,...l}),s.push(u))}}),a),[]).sort((a,i)=>a.id.localeCompare(i.id))},oT=({defaultColor:e,rfId:t})=>{const n=it(b.useCallback(RP({defaultColor:e,rfId:t}),[e,t]),(s,a)=>!(s.length!==a.length||s.some((i,l)=>i.id!==a[l].id)));return de.createElement("defs",null,n.map(s=>de.createElement(TP,{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})))};oT.displayName="MarkerDefinitions";var AP=b.memo(oT);const MP=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}),aT=({defaultMarkerColor:e,onlyRenderVisibleElements:t,elevateEdgesOnSelect:n,rfId:s,edgeTypes:a,noPanClassName:i,onEdgeContextMenu:l,onEdgeMouseEnter:u,onEdgeMouseMove:f,onEdgeMouseLeave:p,onEdgeClick:h,onEdgeDoubleClick:g,onReconnect:v,onReconnectStart:w,onReconnectEnd:N,reconnectRadius:k,children:S,disableKeyboardA11y:_})=>{const{edgesFocusable:E,edgesUpdatable:C,elementsSelectable:j,width:M,height:$,connectionMode:O,nodeInternals:z,onError:I}=it(MP,Dt),A=NP(t,z,n);return M?de.createElement(de.Fragment,null,A.map(({level:q,edges:V,isMaxLevel:Y})=>de.createElement("svg",{key:q,style:{zIndex:q},width:M,height:$,className:"react-flow__edges react-flow__container"},Y&&de.createElement(AP,{defaultColor:e,rfId:s}),de.createElement("g",null,V.map(R=>{const[X,B,ne]=tk(z.get(R.source)),[Z,W,J]=tk(z.get(R.target));if(!ne||!J)return null;let P=R.type||"default";a[P]||(I==null||I("011",rs.error011(P)),P="default");const K=a[P]||a.default,te=O===jo.Strict?W.target:(W.target??[]).concat(W.source??[]),D=ek(B.source,R.sourceHandle),L=ek(te,R.targetHandle),Q=(D==null?void 0:D.position)||$e.Bottom,U=(L==null?void 0:L.position)||$e.Top,ie=!!(R.focusable||E&&typeof R.focusable>"u"),fe=R.reconnectable||R.updatable,me=typeof v<"u"&&(fe||C&&typeof fe>"u");if(!D||!L)return I==null||I("008",rs.error008(D,R)),null;const{sourceX:ke,sourceY:Ve,targetX:Le,targetY:De}=bP(X,D,Q,Z,L,U);return de.createElement(K,{key:R.id,id:R.id,className:Kt([R.className,i]),type:P,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:Le,targetY:De,sourcePosition:Q,targetPosition:U,elementsSelectable:j,onContextMenu:l,onMouseEnter:u,onMouseMove:f,onMouseLeave:p,onClick:h,onEdgeDoubleClick:g,onReconnect:v,onReconnectStart:w,onReconnectEnd:N,reconnectRadius:k,rfId:s,ariaLabel:R.ariaLabel,isFocusable:ie,isReconnectable:me,pathOptions:"pathOptions"in R?R.pathOptions:void 0,interactionWidth:R.interactionWidth,disableKeyboardA11y:_})})))),S):null};aT.displayName="EdgeRenderer";var IP=b.memo(aT);const OP=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function $P({children:e}){const t=it(OP);return de.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:t}},e)}function PP(e){const t=Il(),n=b.useRef(!1);b.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const LP={[$e.Left]:$e.Right,[$e.Right]:$e.Left,[$e.Top]:$e.Bottom,[$e.Bottom]:$e.Top},iT=({nodeId:e,handleType:t,style:n,type:s=Ps.Bezier,CustomComponent:a,connectionStatus:i})=>{var $,O,z;const{fromNode:l,handleId:u,toX:f,toY:p,connectionMode:h}=it(b.useCallback(I=>({fromNode:I.nodeInternals.get(e),handleId:I.connectionHandleId,toX:(I.connectionPosition.x-I.transform[0])/I.transform[2],toY:(I.connectionPosition.y-I.transform[1])/I.transform[2],connectionMode:I.connectionMode}),[e]),Dt),g=($=l==null?void 0:l[Nt])==null?void 0:$.handleBounds;let v=g==null?void 0:g[t];if(h===jo.Loose&&(v=v||(g==null?void 0:g[t==="source"?"target":"source"])),!l||!v)return null;const w=u?v.find(I=>I.id===u):v[0],N=w?w.x+w.width/2:(l.width??0)/2,k=w?w.y+w.height/2:l.height??0,S=(((O=l.positionAbsolute)==null?void 0:O.x)??0)+N,_=(((z=l.positionAbsolute)==null?void 0:z.y)??0)+k,E=w==null?void 0:w.position,C=E?LP[E]:null;if(!E||!C)return null;if(a)return de.createElement(a,{connectionLineType:s,connectionLineStyle:n,fromNode:l,fromHandle:w,fromX:S,fromY:_,toX:f,toY:p,fromPosition:E,toPosition:C,connectionStatus:i});let j="";const M={sourceX:S,sourceY:_,sourcePosition:E,targetX:f,targetY:p,targetPosition:C};return s===Ps.Bezier?[j]=Mj(M):s===Ps.Step?[j]=Xv({...M,borderRadius:0}):s===Ps.SmoothStep?[j]=Xv(M):s===Ps.SimpleBezier?[j]=Aj(M):j=`M${S},${_} ${f},${p}`,de.createElement("path",{d:j,fill:"none",className:"react-flow__connection-path",style:n})};iT.displayName="ConnectionLine";const qP=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function DP({containerStyle:e,style:t,type:n,component:s}){const{nodeId:a,handleType:i,nodesConnectable:l,width:u,height:f,connectionStatus:p}=it(qP,Dt);return!(a&&i&&u&&l)?null:de.createElement("svg",{style:e,width:u,height:f,className:"react-flow__edges react-flow__connectionline react-flow__container"},de.createElement("g",{className:Kt(["react-flow__connection",p])},de.createElement(iT,{nodeId:a,handleType:i,style:t,type:n,CustomComponent:s,connectionStatus:p})))}function rk(e,t){return b.useRef(null),Mt(),b.useMemo(()=>t(e),[e])}const lT=({nodeTypes:e,edgeTypes:t,onMove:n,onMoveStart:s,onMoveEnd:a,onInit:i,onNodeClick:l,onEdgeClick:u,onNodeDoubleClick:f,onEdgeDoubleClick:p,onNodeMouseEnter:h,onNodeMouseMove:g,onNodeMouseLeave:v,onNodeContextMenu:w,onSelectionContextMenu:N,onSelectionStart:k,onSelectionEnd:S,connectionLineType:_,connectionLineStyle:E,connectionLineComponent:C,connectionLineContainerStyle:j,selectionKeyCode:M,selectionOnDrag:$,selectionMode:O,multiSelectionKeyCode:z,panActivationKeyCode:I,zoomActivationKeyCode:A,deleteKeyCode:q,onlyRenderVisibleElements:V,elementsSelectable:Y,selectNodesOnDrag:R,defaultViewport:X,translateExtent:B,minZoom:ne,maxZoom:Z,preventScrolling:W,defaultMarkerColor:J,zoomOnScroll:P,zoomOnPinch:K,panOnScroll:te,panOnScrollSpeed:D,panOnScrollMode:L,zoomOnDoubleClick:Q,panOnDrag:U,onPaneClick:ie,onPaneMouseEnter:fe,onPaneMouseMove:me,onPaneMouseLeave:ke,onPaneScroll:Ve,onPaneContextMenu:Le,onEdgeContextMenu:De,onEdgeMouseEnter:Ne,onEdgeMouseMove:Ge,onEdgeMouseLeave:be,onReconnect:se,onReconnectStart:Qe,onReconnectEnd:ut,reconnectRadius:lt,noDragClassName:rt,noWheelClassName:Ye,noPanClassName:pe,elevateEdgesOnSelect:we,disableKeyboardA11y:Pe,nodeOrigin:Ue,nodeExtent:st,rfId:Oe})=>{const oe=rk(e,fP),Se=rk(t,xP);return PP(i),de.createElement(dP,{onPaneClick:ie,onPaneMouseEnter:fe,onPaneMouseMove:me,onPaneMouseLeave:ke,onPaneContextMenu:Le,onPaneScroll:Ve,deleteKeyCode:q,selectionKeyCode:M,selectionOnDrag:$,selectionMode:O,onSelectionStart:k,onSelectionEnd:S,multiSelectionKeyCode:z,panActivationKeyCode:I,zoomActivationKeyCode:A,elementsSelectable:Y,onMove:n,onMoveStart:s,onMoveEnd:a,zoomOnScroll:P,zoomOnPinch:K,zoomOnDoubleClick:Q,panOnScroll:te,panOnScrollSpeed:D,panOnScrollMode:L,panOnDrag:U,defaultViewport:X,translateExtent:B,minZoom:ne,maxZoom:Z,onSelectionContextMenu:N,preventScrolling:W,noDragClassName:rt,noWheelClassName:Ye,noPanClassName:pe,disableKeyboardA11y:Pe},de.createElement($P,null,de.createElement(IP,{edgeTypes:Se,onEdgeClick:u,onEdgeDoubleClick:p,onlyRenderVisibleElements:V,onEdgeContextMenu:De,onEdgeMouseEnter:Ne,onEdgeMouseMove:Ge,onEdgeMouseLeave:be,onReconnect:se,onReconnectStart:Qe,onReconnectEnd:ut,reconnectRadius:lt,defaultMarkerColor:J,noPanClassName:pe,elevateEdgesOnSelect:!!we,disableKeyboardA11y:Pe,rfId:Oe},de.createElement(DP,{style:E,type:_,component:C,containerStyle:j})),de.createElement("div",{className:"react-flow__edgelabel-renderer"}),de.createElement(gP,{nodeTypes:oe,onNodeClick:l,onNodeDoubleClick:f,onNodeMouseEnter:h,onNodeMouseMove:g,onNodeMouseLeave:v,onNodeContextMenu:w,selectNodesOnDrag:R,onlyRenderVisibleElements:V,noPanClassName:pe,noDragClassName:rt,disableKeyboardA11y:Pe,nodeOrigin:Ue,nodeExtent:st,rfId:Oe})))};lT.displayName="GraphView";var FP=b.memo(lT);const tw=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Ms={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:tw,nodeExtent:tw,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:jo.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:f$,isValidConnection:void 0},zP=()=>jM((e,t)=>({...Ms,setNodes:n=>{const{nodeInternals:s,nodeOrigin:a,elevateNodesOnSelect:i}=t();e({nodeInternals:uf(n,s,a,i)})},getNodes:()=>Array.from(t().nodeInternals.values()),setEdges:n=>{const{defaultEdgeOptions:s={}}=t();e({edges:n.map(a=>({...s,...a}))})},setDefaultNodesAndEdges:(n,s)=>{const a=typeof n<"u",i=typeof s<"u",l=a?uf(n,new Map,t().nodeOrigin,t().elevateNodesOnSelect):new Map;e({nodeInternals:l,edges:i?s:[],hasDefaultNodes:a,hasDefaultEdges:i})},updateNodeDimensions:n=>{const{onNodesChange:s,nodeInternals:a,fitViewOnInit:i,fitViewOnInitDone:l,fitViewOnInitOptions:u,domNode:f,nodeOrigin:p}=t(),h=f==null?void 0:f.querySelector(".react-flow__viewport");if(!h)return;const g=window.getComputedStyle(h),{m22:v}=new window.DOMMatrixReadOnly(g.transform),w=n.reduce((k,S)=>{const _=a.get(S.id);if(_!=null&&_.hidden)a.set(_.id,{..._,[Nt]:{..._[Nt],handleBounds:void 0}});else if(_){const E=jw(S.nodeElement);!!(E.width&&E.height&&(_.width!==E.width||_.height!==E.height||S.forceUpdate))&&(a.set(_.id,{..._,[Nt]:{..._[Nt],handleBounds:{source:Xb(".source",S.nodeElement,v,p),target:Xb(".target",S.nodeElement,v,p)}},...E}),k.push({id:_.id,type:"dimensions",dimensions:E}))}return k},[]);Xj(a,p);const N=l||i&&!l&&Qj(t,{initial:!0,...u});e({nodeInternals:new Map(a),fitViewOnInitDone:N}),(w==null?void 0:w.length)>0&&(s==null||s(w))},updateNodePositions:(n,s=!0,a=!1)=>{const{triggerNodeChanges:i}=t(),l=n.map(u=>{const f={id:u.id,type:"position",dragging:a};return s&&(f.positionAbsolute=u.positionAbsolute,f.position=u.position),f});i(l)},triggerNodeChanges:n=>{const{onNodesChange:s,nodeInternals:a,hasDefaultNodes:i,nodeOrigin:l,getNodes:u,elevateNodesOnSelect:f}=t();if(n!=null&&n.length){if(i){const p=nP(n,u()),h=uf(p,a,l,f);e({nodeInternals:h})}s==null||s(n)}},addSelectedNodes:n=>{const{multiSelectionActive:s,edges:a,getNodes:i}=t();let l,u=null;s?l=n.map(f=>$s(f,!0)):(l=La(i(),n),u=La(a,[])),cu({changedNodes:l,changedEdges:u,get:t,set:e})},addSelectedEdges:n=>{const{multiSelectionActive:s,edges:a,getNodes:i}=t();let l,u=null;s?l=n.map(f=>$s(f,!0)):(l=La(a,n),u=La(i(),[])),cu({changedNodes:u,changedEdges:l,get:t,set:e})},unselectNodesAndEdges:({nodes:n,edges:s}={})=>{const{edges:a,getNodes:i}=t(),l=n||i(),u=s||a,f=l.map(h=>(h.selected=!1,$s(h.id,!1))),p=u.map(h=>$s(h.id,!1));cu({changedNodes:f,changedEdges:p,get:t,set:e})},setMinZoom:n=>{const{d3Zoom:s,maxZoom:a}=t();s==null||s.scaleExtent([n,a]),e({minZoom:n})},setMaxZoom:n=>{const{d3Zoom:s,minZoom:a}=t();s==null||s.scaleExtent([a,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(),i=s().filter(u=>u.selected).map(u=>$s(u.id,!1)),l=n.filter(u=>u.selected).map(u=>$s(u.id,!1));cu({changedNodes:i,changedEdges:l,get:t,set:e})},setNodeExtent:n=>{const{nodeInternals:s}=t();s.forEach(a=>{a.positionAbsolute=Tw(a.position,n)}),e({nodeExtent:n,nodeInternals:new Map(s)})},panBy:n=>{const{transform:s,width:a,height:i,d3Zoom:l,d3Selection:u,translateExtent:f}=t();if(!l||!u||!n.x&&!n.y)return!1;const p=ts.translate(s[0]+n.x,s[1]+n.y).scale(s[2]),h=[[0,0],[a,i]],g=l==null?void 0:l.constrain()(p,h,f);return l.transform(u,g),s[0]!==g.x||s[1]!==g.y||s[2]!==g.k},cancelConnection:()=>e({connectionNodeId:Ms.connectionNodeId,connectionHandleId:Ms.connectionHandleId,connectionHandleType:Ms.connectionHandleType,connectionStatus:Ms.connectionStatus,connectionStartHandle:Ms.connectionStartHandle,connectionEndHandle:Ms.connectionEndHandle}),reset:()=>e({...Ms})}),Object.is),Lw=({children:e})=>{const t=b.useRef(null);return t.current||(t.current=zP()),de.createElement(a$,{value:t.current},e)};Lw.displayName="ReactFlowProvider";const cT=({children:e})=>b.useContext(ed)?de.createElement(de.Fragment,null,e):de.createElement(Lw,null,e);cT.displayName="ReactFlowWrapper";const BP={input:Uj,default:Jv,output:Hj,group:$w},UP={default:Fu,straight:Mw,step:Aw,smoothstep:td,simplebezier:Rw},WP=[0,0],HP=[15,15],GP={x:0,y:0,zoom:1},VP={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},uT=b.forwardRef(({nodes:e,edges:t,defaultNodes:n,defaultEdges:s,className:a,nodeTypes:i=BP,edgeTypes:l=UP,onNodeClick:u,onEdgeClick:f,onInit:p,onMove:h,onMoveStart:g,onMoveEnd:v,onConnect:w,onConnectStart:N,onConnectEnd:k,onClickConnectStart:S,onClickConnectEnd:_,onNodeMouseEnter:E,onNodeMouseMove:C,onNodeMouseLeave:j,onNodeContextMenu:M,onNodeDoubleClick:$,onNodeDragStart:O,onNodeDrag:z,onNodeDragStop:I,onNodesDelete:A,onEdgesDelete:q,onSelectionChange:V,onSelectionDragStart:Y,onSelectionDrag:R,onSelectionDragStop:X,onSelectionContextMenu:B,onSelectionStart:ne,onSelectionEnd:Z,connectionMode:W=jo.Strict,connectionLineType:J=Ps.Bezier,connectionLineStyle:P,connectionLineComponent:K,connectionLineContainerStyle:te,deleteKeyCode:D="Backspace",selectionKeyCode:L="Shift",selectionOnDrag:Q=!1,selectionMode:U=kl.Full,panActivationKeyCode:ie="Space",multiSelectionKeyCode:fe=qu()?"Meta":"Control",zoomActivationKeyCode:me=qu()?"Meta":"Control",snapToGrid:ke=!1,snapGrid:Ve=HP,onlyRenderVisibleElements:Le=!1,selectNodesOnDrag:De=!0,nodesDraggable:Ne,nodesConnectable:Ge,nodesFocusable:be,nodeOrigin:se=WP,edgesFocusable:Qe,edgesUpdatable:ut,elementsSelectable:lt,defaultViewport:rt=GP,minZoom:Ye=.5,maxZoom:pe=2,translateExtent:we=tw,preventScrolling:Pe=!0,nodeExtent:Ue,defaultMarkerColor:st="#b1b1b7",zoomOnScroll:Oe=!0,zoomOnPinch:oe=!0,panOnScroll:Se=!1,panOnScrollSpeed:qe=.5,panOnScrollMode:_e=So.Free,zoomOnDoubleClick:Be=!0,panOnDrag:_t=!0,onPaneClick:yt,onPaneMouseEnter:Re,onPaneMouseMove:at,onPaneMouseLeave:vt,onPaneScroll:wt,onPaneContextMenu:sn,children:on,onEdgeContextMenu:An,onEdgeDoubleClick:Io,onEdgeMouseEnter:Oo,onEdgeMouseMove:$o,onEdgeMouseLeave:wn,onEdgeUpdate:zs,onEdgeUpdateStart:Po,onEdgeUpdateEnd:Ot,onReconnect:fr,onReconnectStart:Hn,onReconnectEnd:ai,reconnectRadius:Mr=10,edgeUpdaterRadius:Ir=10,onNodesChange:Or,onEdgesChange:as,noDragClassName:Bs="nodrag",noWheelClassName:Lo="nowheel",noPanClassName:Us="nopan",fitView:Mn=!1,fitViewOptions:qo,connectOnClick:Ws=!0,attributionPosition:ii,proOptions:$r,defaultEdgeOptions:Hs,elevateNodesOnSelect:Gn=!0,elevateEdgesOnSelect:Do=!1,disableKeyboardA11y:Gs=!1,autoPanOnConnect:Fo=!0,autoPanOnNodeDrag:dt=!0,connectionRadius:zo=20,isValidConnection:Vn,onError:Bo,style:Pr,id:Xt,nodeDragThreshold:Lr,...is},Qt)=>{const xt=Xt||"1";return de.createElement("div",{...is,style:{...Pr,...VP},ref:Qt,className:Kt(["react-flow",a]),"data-testid":"rf__wrapper",id:Xt},de.createElement(cT,null,de.createElement(FP,{onInit:p,onMove:h,onMoveStart:g,onMoveEnd:v,onNodeClick:u,onEdgeClick:f,onNodeMouseEnter:E,onNodeMouseMove:C,onNodeMouseLeave:j,onNodeContextMenu:M,onNodeDoubleClick:$,nodeTypes:i,edgeTypes:l,connectionLineType:J,connectionLineStyle:P,connectionLineComponent:K,connectionLineContainerStyle:te,selectionKeyCode:L,selectionOnDrag:Q,selectionMode:U,deleteKeyCode:D,multiSelectionKeyCode:fe,panActivationKeyCode:ie,zoomActivationKeyCode:me,onlyRenderVisibleElements:Le,selectNodesOnDrag:De,defaultViewport:rt,translateExtent:we,minZoom:Ye,maxZoom:pe,preventScrolling:Pe,zoomOnScroll:Oe,zoomOnPinch:oe,zoomOnDoubleClick:Be,panOnScroll:Se,panOnScrollSpeed:qe,panOnScrollMode:_e,panOnDrag:_t,onPaneClick:yt,onPaneMouseEnter:Re,onPaneMouseMove:at,onPaneMouseLeave:vt,onPaneScroll:wt,onPaneContextMenu:sn,onSelectionContextMenu:B,onSelectionStart:ne,onSelectionEnd:Z,onEdgeContextMenu:An,onEdgeDoubleClick:Io,onEdgeMouseEnter:Oo,onEdgeMouseMove:$o,onEdgeMouseLeave:wn,onReconnect:fr??zs,onReconnectStart:Hn??Po,onReconnectEnd:ai??Ot,reconnectRadius:Mr??Ir,defaultMarkerColor:st,noDragClassName:Bs,noWheelClassName:Lo,noPanClassName:Us,elevateEdgesOnSelect:Do,rfId:xt,disableKeyboardA11y:Gs,nodeOrigin:se,nodeExtent:Ue}),de.createElement(P$,{nodes:e,edges:t,defaultNodes:n,defaultEdges:s,onConnect:w,onConnectStart:N,onConnectEnd:k,onClickConnectStart:S,onClickConnectEnd:_,nodesDraggable:Ne,nodesConnectable:Ge,nodesFocusable:be,edgesFocusable:Qe,edgesUpdatable:ut,elementsSelectable:lt,elevateNodesOnSelect:Gn,minZoom:Ye,maxZoom:pe,nodeExtent:Ue,onNodesChange:Or,onEdgesChange:as,snapToGrid:ke,snapGrid:Ve,connectionMode:W,translateExtent:we,connectOnClick:Ws,defaultEdgeOptions:Hs,fitView:Mn,fitViewOptions:qo,onNodesDelete:A,onEdgesDelete:q,onNodeDragStart:O,onNodeDrag:z,onNodeDragStop:I,onSelectionDrag:R,onSelectionDragStart:Y,onSelectionDragStop:X,noPanClassName:Us,nodeOrigin:se,rfId:xt,autoPanOnConnect:Fo,autoPanOnNodeDrag:dt,onError:Bo,connectionRadius:zo,isValidConnection:Vn,nodeDragThreshold:Lr}),de.createElement(O$,{onSelectionChange:V}),on,de.createElement(l$,{proOptions:$r,position:ii}),de.createElement(z$,{rfId:xt,disableKeyboardA11y:Gs})))});uT.displayName="ReactFlow";const YP=e=>({x:e.transform[0],y:e.transform[1],zoom:e.transform[2]});function dT(){return it(YP,Dt)}const hT=({id:e,x:t,y:n,width:s,height:a,style:i,color:l,strokeColor:u,strokeWidth:f,className:p,borderRadius:h,shapeRendering:g,onClick:v,selected:w})=>{const{background:N,backgroundColor:k}=i||{},S=l||N||k;return de.createElement("rect",{className:Kt(["react-flow__minimap-node",{selected:w},p]),x:t,y:n,rx:h,ry:h,width:s,height:a,fill:S,stroke:u,strokeWidth:f,shapeRendering:g,onClick:v?_=>v(_,e):void 0})};hT.displayName="MiniMapNode";var KP=b.memo(hT);const XP=e=>e.nodeOrigin,QP=e=>e.getNodes().filter(t=>!t.hidden&&t.width&&t.height),pf=e=>e instanceof Function?e:()=>e;function ZP({nodeStrokeColor:e="transparent",nodeColor:t="#e2e2e2",nodeClassName:n="",nodeBorderRadius:s=5,nodeStrokeWidth:a=2,nodeComponent:i=KP,onClick:l}){const u=it(QP,Dt),f=it(XP),p=pf(t),h=pf(e),g=pf(n),v=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return de.createElement(de.Fragment,null,u.map(w=>{const{x:N,y:k}=Eo(w,f).positionAbsolute;return de.createElement(i,{key:w.id,x:N,y:k,width:w.width,height:w.height,style:w.style,selected:w.selected,className:g(w),color:p(w),borderRadius:s,strokeColor:h(w),strokeWidth:a,shapeRendering:v,onClick:l,id:w.id})}))}var JP=b.memo(ZP);const eL=200,tL=150,nL=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?d$(nd(t,e.nodeOrigin),n):n,rfId:e.rfId}},rL="react-flow__minimap-desc";function fT({style:e,className:t,nodeStrokeColor:n="transparent",nodeColor:s="#e2e2e2",nodeClassName:a="",nodeBorderRadius:i=5,nodeStrokeWidth:l=2,nodeComponent:u,maskColor:f="rgb(240, 240, 240, 0.6)",maskStrokeColor:p="none",maskStrokeWidth:h=1,position:g="bottom-right",onClick:v,onNodeClick:w,pannable:N=!1,zoomable:k=!1,ariaLabel:S="React Flow mini map",inversePan:_=!1,zoomStep:E=10,offsetScale:C=5}){const j=Mt(),M=b.useRef(null),{boundingRect:$,viewBB:O,rfId:z}=it(nL,Dt),I=(e==null?void 0:e.width)??eL,A=(e==null?void 0:e.height)??tL,q=$.width/I,V=$.height/A,Y=Math.max(q,V),R=Y*I,X=Y*A,B=C*Y,ne=$.x-(R-$.width)/2-B,Z=$.y-(X-$.height)/2-B,W=R+B*2,J=X+B*2,P=`${rL}-${z}`,K=b.useRef(0);K.current=Y,b.useEffect(()=>{if(M.current){const L=zn(M.current),Q=fe=>{const{transform:me,d3Selection:ke,d3Zoom:Ve}=j.getState();if(fe.sourceEvent.type!=="wheel"||!ke||!Ve)return;const Le=-fe.sourceEvent.deltaY*(fe.sourceEvent.deltaMode===1?.05:fe.sourceEvent.deltaMode?1:.002)*E,De=me[2]*Math.pow(2,Le);Ve.scaleTo(ke,De)},U=fe=>{const{transform:me,d3Selection:ke,d3Zoom:Ve,translateExtent:Le,width:De,height:Ne}=j.getState();if(fe.sourceEvent.type!=="mousemove"||!ke||!Ve)return;const Ge=K.current*Math.max(1,me[2])*(_?-1:1),be={x:me[0]-fe.sourceEvent.movementX*Ge,y:me[1]-fe.sourceEvent.movementY*Ge},se=[[0,0],[De,Ne]],Qe=ts.translate(be.x,be.y).scale(me[2]),ut=Ve.constrain()(Qe,se,Le);Ve.transform(ke,ut)},ie=bj().on("zoom",N?U:null).on("zoom.wheel",k?Q:null);return L.call(ie),()=>{L.on("zoom",null)}}},[N,k,_,E]);const te=v?L=>{const Q=ar(L);v(L,{x:Q[0],y:Q[1]})}:void 0,D=w?(L,Q)=>{const U=j.getState().nodeInternals.get(Q);w(L,U)}:void 0;return de.createElement(Cw,{position:g,style:e,className:Kt(["react-flow__minimap",t]),"data-testid":"rf__minimap"},de.createElement("svg",{width:I,height:A,viewBox:`${ne} ${Z} ${W} ${J}`,role:"img","aria-labelledby":P,ref:M,onClick:te},S&&de.createElement("title",{id:P},S),de.createElement(JP,{onClick:D,nodeColor:s,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:a,nodeStrokeWidth:l,nodeComponent:u}),de.createElement("path",{className:"react-flow__minimap-mask",d:`M${ne-B},${Z-B}h${W+B*2}v${J+B*2}h${-W-B*2}z
|
|
57
|
-
M${O.x},${O.y}h${O.width}v${O.height}h${-O.width}z`,fill:f,fillRule:"evenodd",stroke:p,strokeWidth:h,pointerEvents:"none"})))}fT.displayName="MiniMap";var sL=b.memo(fT);function oL(){return de.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},de.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function aL(){return de.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},de.createElement("path",{d:"M0 0h32v4.2H0z"}))}function iL(){return de.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},de.createElement("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"}))}function lL(){return de.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},de.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"}))}function cL(){return de.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},de.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"}))}const jr=({children:e,className:t,...n})=>de.createElement("button",{type:"button",className:Kt(["react-flow__controls-button",t]),...n},e);jr.displayName="ControlButton";const uL=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom}),pT=({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:s=!0,fitViewOptions:a,onZoomIn:i,onZoomOut:l,onFitView:u,onInteractiveChange:f,className:p,children:h,position:g="bottom-left"})=>{const v=Mt(),[w,N]=b.useState(!1),{isInteractive:k,minZoomReached:S,maxZoomReached:_}=it(uL,Dt),{zoomIn:E,zoomOut:C,fitView:j}=Il();if(b.useEffect(()=>{N(!0)},[]),!w)return null;const M=()=>{E(),i==null||i()},$=()=>{C(),l==null||l()},O=()=>{j(a),u==null||u()},z=()=>{v.setState({nodesDraggable:!k,nodesConnectable:!k,elementsSelectable:!k}),f==null||f(!k)};return de.createElement(Cw,{className:Kt(["react-flow__controls",p]),position:g,style:e,"data-testid":"rf__controls"},t&&de.createElement(de.Fragment,null,de.createElement(jr,{onClick:M,className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:_},de.createElement(oL,null)),de.createElement(jr,{onClick:$,className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:S},de.createElement(aL,null))),n&&de.createElement(jr,{className:"react-flow__controls-fitview",onClick:O,title:"fit view","aria-label":"fit view"},de.createElement(iL,null)),s&&de.createElement(jr,{className:"react-flow__controls-interactive",onClick:z,title:"toggle interactivity","aria-label":"toggle interactivity"},k?de.createElement(cL,null):de.createElement(lL,null)),h)};pT.displayName="Controls";var dL=b.memo(pT),cr;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(cr||(cr={}));function hL({color:e,dimensions:t,lineWidth:n}){return de.createElement("path",{stroke:e,strokeWidth:n,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`})}function fL({color:e,radius:t}){return de.createElement("circle",{cx:t,cy:t,r:t,fill:e})}const pL={[cr.Dots]:"#91919a",[cr.Lines]:"#eee",[cr.Cross]:"#e2e2e2"},mL={[cr.Dots]:1,[cr.Lines]:1,[cr.Cross]:6},gL=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function mT({id:e,variant:t=cr.Dots,gap:n=20,size:s,lineWidth:a=1,offset:i=2,color:l,style:u,className:f}){const p=b.useRef(null),{transform:h,patternId:g}=it(gL,Dt),v=l||pL[t],w=s||mL[t],N=t===cr.Dots,k=t===cr.Cross,S=Array.isArray(n)?n:[n,n],_=[S[0]*h[2]||1,S[1]*h[2]||1],E=w*h[2],C=k?[E,E]:_,j=N?[E/i,E/i]:[C[0]/i,C[1]/i];return de.createElement("svg",{className:Kt(["react-flow__background",f]),style:{...u,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:p,"data-testid":"rf__background"},de.createElement("pattern",{id:g+e,x:h[0]%_[0],y:h[1]%_[1],width:_[0],height:_[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${j[0]},-${j[1]})`},N?de.createElement(fL,{color:v,radius:E/i}):de.createElement(hL,{dimensions:C,color:v,lineWidth:a})),de.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${g+e})`}))}mT.displayName="Background";var yL=b.memo(mT);const vL=["us-gov","global","apac","us","eu","jp","au"],wL=new RegExp(`^(?:(?:${vL.join("|")})\\.)?anthropic\\.`,"i");function Ol(e){return e.replace(wL,"")}const xL=["command","cmd","file_path","path","url","pattern","notebook_path"],sk=120,mf=e=>e.length>sk?`${e.slice(0,sk-1)}…`:e;function bL(e){if(typeof e=="string")return e.trim()?mf(e.trim()):null;if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e;for(const n of xL){const s=t[n];if(typeof s=="string"&&s.trim())return mf(s.trim());if(Array.isArray(s)&&s.length>0&&s.every(a=>typeof a=="string")){const a=s.join(" ").trim();if(a)return mf(a)}}return null}function gT(){return{inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0}}function qw(e){const t=e.cache_creation,n=t&&typeof t=="object"?t:e,s=n.ephemeral_1h_input_tokens,a=n.ephemeral_5m_input_tokens;return typeof s!="number"&&typeof a!="number"?{}:{cacheCreate1hTokens:Number(s??0),cacheCreate5mTokens:Number(a??0)}}function kL(e){const t=qw(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 _L(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]=kL(s));return Object.keys(t).length?t:void 0}function yT(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),...qw(n)};for(const s of Object.values(n)){const a=yT(s,t+1);if(a)return a}return null}const SL=/^(?:claude[-_]|gpt[-_]|o\d|codex[-_])/i;function vT(e,t=0){if(!e||typeof e!="object"||t>6)return null;const n=e;if(typeof n.model=="string"&&SL.test(Ol(n.model)))return n.model;for(const s of Object.values(n)){const a=vT(s,t+1);if(a)return a}return null}function nw(){return{agents:new Map,toolIndex:new Map,toolOwner:new Map,activeSubagentStack:new Map,lastSeq:0,seqEpoch:null,totalEvents:0,revision:0}}function qs(e){if(!e)return;const t=e.replace(/\\/g,"/").split("/").filter(Boolean);return t[t.length-1]}function ok(){return{msgsUser:0,msgsAssistant:0,toolUses:0,toolResults:0,systemReminders:0,currentContextTokens:0,memoryFiles:[]}}function $l(e,t){return`${e}::${t}`}function zu(e){return e.agent_type??e.subagent_type??"subagent"}function pl(e){return e.agent_id?e.agent_id:e.parent_tool_use_id?e.parent_tool_use_id:null}function qa(e,t,n,s){const a=t;let i=e.agents.get(a);return i||(i={id:a,sessionId:t,label:"session",kind:"root",state:"active",startedAt:n,lastEventAt:n,tools:[],prompts:[],toolCount:0,childCount:0,synthetic:s,usage:gT()},e.agents.set(a,i),i)}function wT(e,t,n,s){const a=$l(t,n),i=e.agents.get(a);if(!i)return null;!i.cwd&&s.cwd&&(i.cwd=s.cwd,i.cwdBasename=qs(s.cwd));const l=zu(s);return l&&(i.label==="subagent"||!i.label)&&(i.label=l),i}function NL(e,t,n){const s=t.session_id??"unknown",a=pl(t);if(a){const f=wT(e,s,a,t);if(f)return f}const i=e.activeSubagentStack.get(s),l=i&&i.length>0?i[i.length-1]:null;if(l){const f=e.agents.get($l(s,l));if(f)return!f.cwd&&t.cwd&&(f.cwd=t.cwd,f.cwdBasename=qs(t.cwd)),f}const u=qa(e,s,n,t.hook_event_name!=="SessionStart");return!u.cwd&&t.cwd&&(u.cwd=t.cwd,u.cwdBasename=qs(t.cwd)),u.label==="session"&&t.cwd&&(u.label=qs(t.cwd)??"session"),u}function EL(e,t,n,s,a){const i=$l(t,n),l=qa(e,t,a,!0);let u=e.agents.get(i);if(u){!u.cwd&&s.cwd&&(u.cwd=s.cwd,u.cwdBasename=qs(s.cwd));const f=zu(s);return f&&(u.label==="subagent"||!u.label)&&(u.label=f),u}return u={id:i,sessionId:t,label:zu(s),kind:"subagent",parentId:l.id,state:"active",startedAt:a,tools:[],prompts:[],cwd:s.cwd,cwdBasename:qs(s.cwd),toolCount:0,childCount:0,usage:gT()},e.agents.set(i,u),l.childCount+=1,u}function CL(e,t,n){const s=e.activeSubagentStack.get(t)??[];s.includes(n)||(s.push(n),e.activeSubagentStack.set(t,s))}function jL(e,t,n){const s=e.activeSubagentStack.get(t);if(s){for(let a=s.length-1;a>=0;a--)if(s[a]===n){s.splice(a,1);break}s.length===0&&e.activeSubagentStack.delete(t)}}function du(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 ak=200,TL=25;function RL(e,t){const n=t.tools;if(n.length>ak){const s=n.splice(0,n.length-ak);for(const a of s)e.toolIndex.get(a.id)===a&&(e.toolIndex.delete(a.id),e.toolOwner.delete(a.id))}for(let s=n.length-TL-1;s>=0;s--){const a=n[s];if(a.trimmed)break;a.input=void 0,a.response=void 0,a.trimmed=!0}}function AL(e,t,n){const s=e.toolIndex.get(n);if(s)return s;for(let a=t.tools.length-1;a>=0;a--)if(t.tools[a].id===n)return t.tools[a];return null}const ik=2e3;function ML(e,t,n){for(let s=e.prompts.length-1;s>=0;s--){const a=e.prompts[s];if(a.at<t-ik)return!1;if(a.text===n&&a.at<=t+ik)return!0}return!1}function xT(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 Pl(e,t){return t&&(e.revision+=1),t}function IL(e,t,n,s){if(e.agents.size<=n)return!1;const a=p=>p.state==="done"&&p.endedAt!=null&&t-p.endedAt>s,i=[],l=new Map;for(const[p,h]of e.agents){if(h.parentId!=null){const g=l.get(h.parentId);g?g.push(p):l.set(h.parentId,[p])}a(h)&&i.push({id:p,endedAt:h.endedAt})}if(i.length===0)return!1;i.sort((p,h)=>p.endedAt-h.endedAt);let u=0;const f=p=>{const h=e.agents.get(p);h&&(xT(e,h),e.agents.delete(p),u++)};for(const p of i){if(e.agents.size<=n)break;if(!e.agents.has(p.id))continue;const h=(l.get(p.id)??[]).map(g=>e.agents.get(g)).filter(g=>g!=null);if(!h.some(g=>!a(g))){for(const g of h)f(g.id);f(p.id)}}return Pl(e,u>0)}function OL(e,t,n,s){const a=new Map;for(const[p,h]of e.agents){let g=a.get(h.sessionId);g||(g={ids:[],endedAt:0,live:!1,closed:!1},a.set(h.sessionId,g)),g.ids.push(p),h.kind==="root"&&h.closedAt!=null&&(g.closed=!0),h.state==="done"&&h.endedAt!=null?g.endedAt=Math.max(g.endedAt,h.endedAt):g.live=!0}const i=[...a.values()].filter(p=>!p.live&&p.endedAt>0&&t-p.endedAt>s).sort((p,h)=>p.closed===h.closed?p.endedAt-h.endedAt:p.closed?-1:1);let u=[...a.values()].filter(p=>!p.live).length-n;if(u<=0)return!1;let f=!1;for(const p of i){if(u<=0)break;for(const h of p.ids){const g=e.agents.get(h);g&&xT(e,g),e.agents.delete(h)}u--,f=!0}return Pl(e,f)}function $L(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 a=n==null?void 0:n.tool_use_id;return typeof a=="string"&&a.length>0&&e.toolIndex.has(a)}function PL(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 Pl(e,t)}function LL(e,t,n){let s=!1;for(const a of e.agents.values()){if(a.provider==="codex")continue;const i=e.agents.get(a.sessionId),l=(i==null?void 0:i.lastEventAt)??(i==null?void 0:i.startedAt);for(const u of a.tools){const f=Math.max(u.startedAt,l??u.startedAt);u.endedAt==null&&t-f>n&&(u.endedAt=f,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 Pl(e,s)}const lk=90*6e4;function qL(e,t,n){let s=!1;for(const a of e.agents.values()){if(a.kind!=="root")continue;const i=a.lastEventAt??a.startedAt;if(!(t-i<=n)){a.waiting&&(a.waiting=null,s=!0),a.closedAt==null&&(a.closedAt=i),a.state==="active"&&(a.state="done",a.endedAt=i,a.reaped=!0,s=!0);for(const l of e.agents.values())l.sessionId!==a.sessionId||l.kind==="root"||l.state!=="active"||(l.state="done",l.endedAt=i,s=!0);e.activeSubagentStack.delete(a.sessionId)}}return Pl(e,s)}function DL(e){return e==="permission_prompt"?"permission":e==="agent_needs_input"?"asked":e==="idle_prompt"?"idle":null}const FL=new Set(["Notification","ModelObserved","ContextObserved","UsageObserved","SessionNamed"]);function zL(e,t){let n=null;for(const s of e.toolIndex.values()){const a=s.agentId?e.agents.get(s.agentId):void 0;!a||a.sessionId!==t||(!n||s.startedAt>n.startedAt)&&(n=s)}return n}const BL=3e4;function UL(e,t){if(!(!e||!e.name)&&!(t-e.startedAt>BL)&&!(e.startedAt>t))return{name:e.name,preview:bL(e.input)??""}}function WL(e,t,n,s,a){if(n!=="permission")return{kind:n,message:s,since:a};const i=zL(e,t),l={kind:n,message:s,since:a};i!=null&&i.explicitSubagentId&&(l.subagentId=i.explicitSubagentId);const u=UL(i,a);return u&&(l.tool=u),l}function HL(e,t,n){if(e.kind==="idle")return!0;const s=pl(t);return s==null?!0:e.subagentId!=null&&$l(n,s)===e.subagentId}function ck(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??{},a=t.receivedAt,i=s.hook_event_name??"Unknown";if(i==="__clear")return{...nw(),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(!FL.has(i)){const h=e.agents.get(l);h!=null&&h.waiting&&HL(h.waiting,s,l)&&(h.waiting=null)}const u=e.agents.get(l);if(u&&a>(u.lastEventAt??0)&&(u.lastEventAt=a,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 h=e.agents.get(l);h&&(h.contextWindow=s.model_context_window)}if(typeof s.approval_policy=="string"&&s.approval_policy){const h=e.agents.get(l);h&&(h.approvalPolicy=s.approval_policy)}if(typeof s.context_tokens=="number"&&s.context_tokens>=0){const h=e.agents.get(l);h&&(h.context={...h.context??ok(),currentContextTokens:s.context_tokens})}if(i==="ModelObserved"){const h=typeof s.model=="string"?s.model:null;if(h){const v=e.agents.get(l);v&&(v.model=h)}const g=s.subagentModels;if(g&&typeof g=="object")for(const[v,w]of Object.entries(g)){if(typeof w!="string")continue;const N=`${l}::${v}`,k=e.agents.get(N);k&&(k.model=w)}return e}if(i==="ContextObserved"){const h=s.context??null;if(h){const g=e.agents.get(l);if(g){const v=g.context??ok(),w=(k,S)=>typeof h[k]=="number"?h[k]:S,N=Array.isArray(h.memoryFiles)?h.memoryFiles:Array.isArray(h.claudeMdFiles)?h.claudeMdFiles:null;g.context={msgsUser:w("msgsUser",v.msgsUser),msgsAssistant:w("msgsAssistant",v.msgsAssistant),toolUses:w("toolUses",v.toolUses),toolResults:w("toolResults",v.toolResults),systemReminders:w("systemReminders",v.systemReminders),currentContextTokens:w("currentContextTokens",v.currentContextTokens),memoryFiles:N??v.memoryFiles}}}return e}if(i==="SessionNamed"){const h=e.agents.get(l);if(h){const g=typeof s.sessionName=="string"?s.sessionName.trim():"",v=typeof s.sessionTitle=="string"?s.sessionTitle.trim():"";g&&(h.sessionName=g),v&&(h.sessionTitle=v);const w=h.sessionName??"";h.sessionTitle&&w&&h.sessionTitle.toLowerCase()===w.toLowerCase()&&(h.sessionTitle=void 0)}return e}if(i==="UsageObserved"){const h=s.usage??null;if(h){const g=e.agents.get(l);if(g){g.usage.inputTokens=Number(h.input_tokens??0),g.usage.outputTokens=Number(h.output_tokens??0),g.usage.cacheReadTokens=Number(h.cache_read_input_tokens??h.cached_input_tokens??0),g.usage.cacheCreateTokens=Number(h.cache_creation_input_tokens??h.cache_write_input_tokens??0);const v=qw(h);g.usage.cacheCreate1hTokens=v.cacheCreate1hTokens,g.usage.cacheCreate5mTokens=v.cacheCreate5mTokens,typeof h.reasoning_output_tokens=="number"&&(g.usage.reasoningOutputTokens=Number(h.reasoning_output_tokens)),g.usageByModel=_L(s.usageByModel)}}return e}const f=NL(e,s,a);f.provider||(f.provider=s.provider==="codex"?"codex":"claude");const p=vT(s);switch(p&&(f.model=p),i){case"SessionStart":{const h=qa(e,l,a,!1);h.synthetic=!1,h.state="active",h.closedAt=void 0,h.startedAt=h.startedAt||a,!h.cwd&&s.cwd&&(h.cwd=s.cwd,h.cwdBasename=qs(s.cwd)),h.label==="session"&&s.cwd&&(h.label=qs(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<a&&(v.exitAt=a);const h=qa(e,l,a,!1);h.state="active",h.endedAt=void 0,h.closedAt=void 0,h.exitAt=void 0;const g=(typeof s.prompt=="string"?s.prompt:typeof s.message=="string"?s.message:"")??"";g&&!ML(h,a,g)&&(h.prompts.push({at:a,text:g}),h.firstPrompt||(h.firstPrompt=du(g,120)));break}case"PreToolUse":{const h=s.tool_use_id?AL(e,f,s.tool_use_id):null;if(h){s.tool_name&&h.name==="?"&&(h.name=s.tool_name),h.endedAt==null&&!h.trimmed&&s.tool_input!==void 0&&(h.input=s.tool_input,h.inputPreview=du(s.tool_input));break}const g=s.tool_use_id??`${f.id}:${f.toolCount}`,v=pl(s),w={id:g,name:s.tool_name??"?",input:s.tool_input,inputPreview:du(s.tool_input),agentId:f.id,explicitSubagentId:v?$l(l,v):void 0,startedAt:a};f.tools.push(w),f.toolCount+=1,f.state="active",e.toolIndex.set(g,w),e.toolOwner.set(g,f.id),RL(e,f);break}case"PostToolUse":case"PostToolUseFailure":{const h=s.tool_use_id;if(!h)break;let g=e.toolIndex.get(h),v=!1;if(!g)for(const N of e.agents.values()){const k=N.tools.find(S=>S.id===h);if(k){g=k,v=!0;break}}if(!g||g.outcomeApplied)break;g.outcomeApplied=!0,g.outcomeGap=void 0,g.endedAt=a,g.ok=i==="PostToolUse",g.trimmed||(g.response=s.tool_response),i==="PostToolUseFailure"?g.errorPreview=du(s.tool_response):v&&(g.errorPreview=void 0);const w=yT(s.tool_response);w&&(g.usage=w),e.toolIndex.delete(h),e.toolOwner.delete(h);break}case"SubagentStart":{const h=pl(s);if(!h)break;const g=EL(e,l,h,s,a);g.state="active",g.startedAt=g.startedAt||a,g.exitAt=void 0,g.endedAt=void 0;const v=zu(s);v&&(g.label=v),CL(e,l,h);break}case"SubagentStop":{const h=pl(s);if(!h)break;const g=wT(e,l,h,s);if(!g)break;g.state="done",g.endedAt=a,jL(e,l,h);break}case"Stop":case"SessionEnd":{const h=qa(e,l,a,!1);h.state="done",h.endedAt=a,i==="SessionEnd"&&(h.closedAt=a),e.activeSubagentStack.delete(l);break}case"Notification":{const h=DL(s.notification_type);if(!h)break;const g=qa(e,l,a,!1),v=typeof s.message=="string"?s.message:"",w=g.waiting;g.waiting=w&&w.kind===h&&w.message===v?{...w,since:Math.min(w.since,a)}:WL(e,l,h,v,a);break}}return e}function Dw(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 GL={input:2,output:10,cacheRead:.2,cacheWrite:2.5,cacheWrite1h:4},VL=[{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:GL},{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 YL(e){return e?/^(?:gpt[-_]|codex[-_]|o\d)/i.test(e):!1}function Ja(e,t=Date.now()){if(!e)return null;const n=Ol(e);for(const s of VL)if(s.match.test(n))return typeof s.rates=="function"?s.rates(t):s.rates;return null}function bT(e,t){const n=Math.max(0,e.cacheCreate1hTokens??0),s=Math.max(0,e.cacheCreate5mTokens??0),a=Math.max(0,e.cacheCreateTokens-n-s),i=s+a,l=t.cacheWrite1h??t.cacheWrite;return{tokens5m:i,tokens1h:n,usd5m:i*t.cacheWrite/1e6,usd1h:n*l/1e6}}function kT(e,t,n=Date.now()){if(!YL(t))return e.inputTokens;const s=Ja(t,n),a=((s==null?void 0:s.cacheWrite)??0)>0?Math.max(0,e.cacheCreateTokens):0;return Math.max(0,e.inputTokens-e.cacheReadTokens-a)}function Fw(e,t,n=Date.now()){const s=Ja(t,n);if(!s)return{input:0,output:0,cacheRead:0,cacheWrite:0,total:0};const a=kT(e,t,n)*s.input/1e6,i=e.outputTokens*s.output/1e6,l=e.cacheReadTokens*s.cacheRead/1e6,u=bT(e,s),f=u.usd5m+u.usd1h;return{input:a,output:i,cacheRead:l,cacheWrite:f,total:a+i+l+f}}const uk=2e5,KL=1e6,XL=[/\[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],QL=[{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 ZL(e){if(!e)return uk;const t=Ol(e);for(const n of XL)if(n.test(t))return KL;for(const n of QL)if(n.match.test(t))return n.window;return uk}function _T(e,t){return typeof e=="number"&&e>0?e:ZL(t)}const Pa="not priced";function Je(e){if(e<=0)return"—";if(e<.005)return"<1¢";if(e<1){const t=(e*100).toFixed(e<.1?1:0);if(Number(t)<100)return`${t}¢`}return e<100?`$${e.toFixed(2)}`:e<1e4?`$${e.toFixed(0)}`:`$${(e/1e3).toFixed(1)}k`}function zw(e,t){if(e<=0||t<10)return null;const n=e/t,s=n*60;return s>=.01?`${Je(s)}/min`:`${Je(n*3600)}/hr`}function JL(e,t){const n={inputTokens:e.inputTokens+t.inputTokens,outputTokens:e.outputTokens+t.outputTokens,cacheReadTokens:e.cacheReadTokens+t.cacheReadTokens,cacheCreateTokens:e.cacheCreateTokens+t.cacheCreateTokens};return(e.cacheCreate1hTokens!==void 0||e.cacheCreate5mTokens!==void 0||t.cacheCreate1hTokens!==void 0||t.cacheCreate5mTokens!==void 0)&&(n.cacheCreate1hTokens=(e.cacheCreate1hTokens??0)+(t.cacheCreate1hTokens??0),n.cacheCreate5mTokens=(e.cacheCreate5mTokens??0)+(t.cacheCreate5mTokens??0)),(e.reasoningOutputTokens!==void 0||t.reasoningOutputTokens!==void 0)&&(n.reasoningOutputTokens=(e.reasoningOutputTokens??0)+(t.reasoningOutputTokens??0)),n}function e3(e,t){let n=0,s=0,a=0,i=0,l=0,u=0;for(const g of t)n+=g.inputTokens,s+=g.outputTokens,a+=g.cacheReadTokens,i+=g.cacheCreateTokens,l+=g.cacheCreate1hTokens??0,u+=g.cacheCreate5mTokens??0;const f=(g,v)=>Math.max(0,g-v),p={inputTokens:f(e.inputTokens,n),outputTokens:f(e.outputTokens,s),cacheReadTokens:f(e.cacheReadTokens,a),cacheCreateTokens:f(e.cacheCreateTokens,i)};return(e.cacheCreate1hTokens!==void 0||e.cacheCreate5mTokens!==void 0)&&(p.cacheCreate1hTokens=f(e.cacheCreate1hTokens??0,l),p.cacheCreate5mTokens=f(e.cacheCreate5mTokens??0,u)),p.inputTokens+p.outputTokens+p.cacheReadTokens+p.cacheCreateTokens>0?p:null}function Ll(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(i=>({model:i,usage:t[i]})),a=e3(e.usage,s.map(i=>i.usage));if(a){const i=s.findIndex(l=>l.model===e.model);i>=0?s[i]={model:s[i].model,usage:JL(s[i].usage,a)}:s.push({model:e.model,usage:a})}return s}function jn(e,t=Date.now()){const n={input:0,output:0,cacheRead:0,cacheWrite:0,total:0};for(const s of Ll(e)){const a=Fw(s.usage,s.model,t);n.input+=a.input,n.output+=a.output,n.cacheRead+=a.cacheRead,n.cacheWrite+=a.cacheWrite,n.total+=a.total}return n}function rw(e,t=Date.now()){let n=0;for(const s of Ll(e))Ja(s.model,t)==null&&(n+=s.usage.inputTokens+s.usage.outputTokens);return n}function ST(e){const t=[];for(const n of Ll(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 NT(e){return ST(e).filter(t=>t!==e.model)}const t3=new Set(["untrusted","on-request","on-failure"]);function n3(e){return typeof e!="string"||!e?null:t3.has(e)?!0:e==="never"?!1:null}function r3(e){if(e.provider!=="codex"||e.kind!=="root"||e.waiting||e.state!=="active")return null;const t=n3(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 dk(e){return e[0].toUpperCase()+e.slice(1).toLowerCase()}function Ds(e){const t=Ol(e).replace(/[-_]\d{8}(?!\d)/,""),n=t.match(/^claude[-_](opus|sonnet|haiku|fable|mythos)[-_](\d+(?:[-_.]\d+)*)/i);if(n){const a=dk(n[1]),i=n[2].replace(/[-_]/g,".");return`${a} ${i}`}const s=t.match(/^gpt[-_](\d+(?:[-_.]\d+)*)((?:[-_][A-Za-z0-9.]+)*)$/i);if(s){const a=s[1].replace(/[-_]/g,"."),i=s[2].split(/[-_]/).filter(Boolean).map(dk);return[`GPT-${a}`,...i].join(" ")}return e}function rd(e){const t=Ol(e??""),n=t.match(/^claude[-_](opus|sonnet|haiku|fable|mythos)[-_]/i);return n?n[1].toLowerCase():/^gpt[-_]/i.test(t)?"gpt":""}function ql(e){return(e==null?void 0:e.kind)==="permission"||(e==null?void 0:e.kind)==="asked"}function s3(e){const t=[];for(const n of e)n.kind==="root"&&ql(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 o3(e){const t=new Set;for(const n of e)n.state==="active"&&t.add(n.sessionId);return t.size}function sd(e,t){return`${e}@${t.since}`}function ET(e,t){if(!e.tool)return null;const{name:n,preview:s}=e.tool,a=new RegExp(`\\b${n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`,"i").test(t);return s?a?s:`${n} · ${s}`:a?null:n}function a3(e){const t=e.message||"Needs your permission",n=ET(e,t);return n?`${t}
|
|
60
|
-
Likely on: ${n}`:t}function i3(e,t,n,s=!0){if(!s)return[];if(n)return[];const a=[];for(const i of e){if(!ql(i.waiting))continue;const l=sd(i.id,i.waiting);t.has(l)||a.push({key:l,title:i.label,body:a3(i.waiting),sessionId:i.id})}return a}function l3(e,t,n){const s=new Set;for(const i of e)s.add(sd(i.id,i.waiting));const a=new Set;for(const i of n)s.has(i)&&a.add(i);for(const i of t)a.add(i.key);return a}function hk(e){return new Set(e.map(t=>sd(t.id,t.waiting)))}function c3(e,t){return e!==t}function u3(e,t){return t&&e==="default"}function At(e){const t=Math.round(e);return t<1e3?`${t}`:t<1e6?`${(t/1e3).toFixed(1)}k`:t<1e9?`${(t/1e6).toFixed(2)}M`:`${(t/1e9).toFixed(2)}B`}function Bu(e,t,n){const s=(t??n)-e;if(s<1e3)return`${Math.max(0,s)}ms`;const a=Math.floor(s/1e3);if(a<60)return`${a}s`;const i=Math.floor(a/60),l=a%60;return`${i}m ${String(l).padStart(2,"0")}s`}function CT(e,t){if(e.endedAt==null)return t;const n=e.endedAt-e.startedAt;return n<1e3?`${n}ms`:`${(n/1e3).toFixed(2)}s`}function jT(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 d3=1;function h3(){const e=[];let t=0;function n(){let s;for(const a of e)(!s||a.layer>s.layer||a.layer===s.layer&&a.seq>s.seq)&&(s=a);return s}return{push(s,a=0){const i={dismiss:s,layer:a,seq:t++};return e.push(i),()=>{const l=e.indexOf(i);l!==-1&&e.splice(l,1)}},dismissTop(){const s=n();return s?(s.dismiss(),!0):!1},isTop(s){const a=n();return a!=null&&a.dismiss===s},depth(){return e.length}}}const Uu=h3();function f3(e){return e.overlayOpen?"dismiss":e.typing?"blur":"clear-selection"}function fk(e){return String(e.tagName??"").toUpperCase()==="BODY"}function p3(e,t){return!e||!e.isConnected||fk(e)?!1:t==null||fk(t)}const pk="a[href], button, input, select, textarea, [tabindex]";function m3(e){return!e||e.disabled||e.rendered===!1?!1:(e.tabIndex??0)>=0}function g3(e){if(!e||!e.overflowing||e.hasFocusable)return!1;const t=String(e.overflow??"").toLowerCase();return t==="auto"||t==="scroll"}function y3({count:e,index:t,shiftKey:n}){return e<=0?{kind:"hold"}:t<0||t>=e?{kind:"focus",index:n?e-1:0}:!n&&t===e-1?{kind:"focus",index:0}:n&&t===0?{kind:"focus",index:e-1}:{kind:"allow"}}function Bw(e){return e.ctrlKey||e.metaKey||e.altKey}const v3=new Set(["button","checkbox","color","file","image","radio","range","reset","submit"]),w3=new Set(["INPUT","TEXTAREA","SELECT","OPTION","BUTTON","SUMMARY","A"]),x3=new Set(["button","checkbox","combobox","link","listbox","menu","menubar","menuitem","menuitemcheckbox","menuitemradio","option","radio","searchbox","slider","spinbutton","switch","tab","textbox","treeitem"]);function TT(e){return typeof e.tagName=="string"?e.tagName.toUpperCase():""}function Uw(e){if(!e)return!1;if(e.isContentEditable)return!0;const t=TT(e);return t==="TEXTAREA"?!0:t!=="INPUT"?!1:!v3.has(String(e.type??"text").toLowerCase())}function b3(e){if(!e)return!1;if(Uw(e)||w3.has(TT(e)))return!0;const t=typeof e.role=="string"?e.role.trim().toLowerCase():"";return t!==""&&t.split(/\s+/).some(n=>x3.has(n))}function k3({key:e,modalOpen:t,sheetOpen:n}){return t?!(e==="?"&&n):!1}function RT(e){return e?Array.from(e.querySelectorAll("*")).filter(t=>{if(t.matches(pk))return m3({disabled:t.disabled,tabIndex:t.tabIndex,rendered:t.getClientRects().length>0});const n=t.scrollHeight>t.clientHeight;return n&&g3({overflowing:n,overflow:getComputedStyle(t).overflowY,hasFocusable:t.querySelector(pk)!=null})}):[]}function _3(e,t){const n=RT(e);if(!t||!e.contains(t)||n.includes(t))return n;const s=n.findIndex(a=>(t.compareDocumentPosition(a)&Node.DOCUMENT_POSITION_FOLLOWING)!==0);return s===-1?[...n,t]:[...n.slice(0,s),t,...n.slice(s)]}function Rn(e,t={}){const{focusRef:n,layer:s}=t,a=b.useRef(null),i=b.useRef(e);i.current=e;const l=b.useRef(null);l.current===null&&(l.current=()=>i.current());const u=l.current;return b.useEffect(()=>Uu.push(u,s),[u,s]),b.useEffect(()=>{var p;const f=document.activeElement;return(p=(n==null?void 0:n.current)??RT(a.current)[0])==null||p.focus(),()=>{p3(f,document.activeElement)&&f.focus()}},[]),b.useEffect(()=>{const f=p=>{var k;if(p.key!=="Tab"||Bw(p))return;const h=a.current;if(!h)return;const g=document.activeElement;if(!(g!=null&&h.contains(g))&&!Uu.isTop(u))return;const w=_3(h,g),N=y3({count:w.length,index:g?w.indexOf(g):-1,shiftKey:p.shiftKey});N.kind!=="allow"&&(p.preventDefault(),N.kind==="focus"&&((k=w[N.index])==null||k.focus()))};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[u]),a}function S3(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 Fn(e){return e.toLocaleString()}function N3(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(2)} MB`}const E3=60;function C3(e,t=E3){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 j3({agent:e,onClose:t}){var v;const n=b.useRef(null),s=Rn(t,{focusRef:n}),a=e.context,i=e.usage,l=(a==null?void 0:a.currentContextTokens)??0,u=_T(e.contextWindow,e.model),f=Math.min(100,l/u*100),p=jn(e),h=i.inputTokens+i.cacheReadTokens+i.cacheCreateTokens,g=S3(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(f),children:d.jsx("div",{className:"ctx-window-fill",style:{width:`${f}%`}})}),d.jsxs("div",{className:"ctx-window-meta",children:[d.jsxs("span",{className:"ctx-window-pct",children:[f.toFixed(1),"%"]}),d.jsxs("span",{children:[Fn(l)," / ",Fn(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(or,{label:"input tokens",val:Fn(i.inputTokens)}),d.jsx(or,{label:"output tokens",val:Fn(i.outputTokens)}),d.jsx(or,{label:"cache reads",val:Fn(i.cacheReadTokens)}),d.jsx(or,{label:"cache writes",val:Fn(i.cacheCreateTokens)}),d.jsx(or,{label:"cumulative total",val:Fn(h)}),d.jsx(or,{label:"estimated cost",val:Je(p.total),accent:!0})]}),d.jsx("h3",{className:"ctx-section-title",children:"Transcript composition"}),g.compositionCounted?d.jsxs("div",{className:"ctx-grid",children:[d.jsx(or,{label:"user messages",val:Fn((a==null?void 0:a.msgsUser)??0)}),d.jsx(or,{label:"assistant messages",val:Fn((a==null?void 0:a.msgsAssistant)??0)}),d.jsx(or,{label:"tool uses",val:Fn((a==null?void 0:a.toolUses)??0)}),d.jsx(or,{label:"tool results",val:Fn((a==null?void 0:a.toolResults)??0)}),d.jsx(or,{label:"system-reminders",val:Fn((a==null?void 0:a.systemReminders)??0)})]}):d.jsx("div",{className:"ctx-empty",children:g.compositionUncounted}),d.jsx("h3",{className:"ctx-section-title",children:g.memoryHeading}),(((v=a==null?void 0:a.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:a.memoryFiles.map(w=>d.jsxs("li",{children:[d.jsx("span",{className:"ctx-md-path",title:w.path,children:C3(w.path)}),d.jsx("span",{className:"ctx-md-size",children:N3(w.bytes)})]},w.path))})]})})}function or({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 T3({currentContextTokens:e,modelId:t,contextWindow:n,size:s=26,onClick:a}){const i=_T(n,t),l=Math.min(1,e/i),u=s/2-3,f=s/2,p=2*Math.PI*u,h=p*l,g=l>.9?"var(--err)":l>.7?"var(--inflight)":"var(--accent)";return d.jsx("button",{type:"button",className:"ctx-donut",onClick:a,title:`context: ${e.toLocaleString()} / ${i.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:f,cy:f,r:u,stroke:"var(--line)",strokeWidth:"2.5",fill:"none"}),d.jsx("circle",{cx:f,cy:f,r:u,stroke:g,strokeWidth:"2.5",fill:"none",strokeDasharray:`${h} ${p-h}`,strokeDashoffset:p/4,strokeLinecap:"round",style:{transition:"var(--ctx-arc-transition)"}}),d.jsx("text",{x:f,y:f+3,textAnchor:"middle",fontSize:"8",fill:"var(--text)",fontWeight:"600",children:Math.round(l*100)})]})})}function mk(e,t){const n=Ja(t);if(!n)return`model: ${t}
|
|
61
|
-
no published rate in this build — the tokens are counted, the dollars are not`;const s=h=>h.toLocaleString(),a=h=>`$${h}/MTok`,i=Fw(e,t),l=bT(e,n),u=l.tokens1h>0?[`cache w5m${s(l.tokens5m).padStart(14)} × ${a(n.cacheWrite).padEnd(11)} = ${Je(l.usd5m)}`,`cache w1h${s(l.tokens1h).padStart(14)} × ${a(n.cacheWrite1h??n.cacheWrite).padEnd(11)} = ${Je(l.usd1h)}`]:[`cache w ${s(l.tokens5m).padStart(14)} × ${a(n.cacheWrite).padEnd(11)} = ${Je(l.usd5m)}`],f=kT(e,t),p=f===e.inputTokens?"input":"uncached";return[`model: ${t}`,`${p.padEnd(9)}${s(f).padStart(14)} × ${a(n.input).padEnd(11)} = ${Je(i.input)}`,`output ${s(e.outputTokens).padStart(14)} × ${a(n.output).padEnd(11)} = ${Je(i.output)}`,`cache r ${s(e.cacheReadTokens).padStart(14)} × ${a(n.cacheRead).padEnd(11)} = ${Je(i.cacheRead)}`,...u,"─────────────────────────────────────────",`total = ${Je(i.total)}`].join(`
|
|
62
|
-
`)}function gk(e){const t=Ll(e);return t.length<=1?mk(e.usage,e.model):[...t.map(n=>mk(n.usage,n.model)),"═════════════════════════════════════════",`all models = ${Je(jn(e).total)}`].join(`
|
|
63
|
-
`)}function R3({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(" "),a=e.tools.filter(w=>!w.endedAt).length,i=Dw(e.sessionId),l=((v=e.context)==null?void 0:v.currentContextTokens)??0,u=e.kind==="root"&&l>0,f=e.sessionTitle?e.cwd?`${e.cwd}
|
|
64
|
-
${e.sessionTitle}`:e.sessionTitle:e.cwd,p=NT(e),h=p.length>0?`${e.model}
|
|
65
|
-
spend on this card also covers:
|
|
66
|
-
${p.join(`
|
|
67
|
-
`)}`:e.model,g=jT(e.sessionName,e.sessionTitle);return d.jsxs("div",{className:s,style:{"--session-hue":i},children:[d.jsx("span",{className:"accent-stripe"}),d.jsx(Va,{type:"target",position:$e.Left,style:{background:"transparent",border:"none"}}),d.jsxs("div",{className:"head",children:[d.jsxs("div",{className:"title",children:[d.jsx(A3,{state:e.state}),d.jsx("span",{className:"label",title:f,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(T3,{currentContextTokens:l,modelId:e.model,contextWindow:e.contextWindow,onClick:()=>e.onOpenContext(e.sessionId)}),d.jsx("div",{className:"time",title:`Started ${new Date(e.startedAt).toLocaleTimeString()}`,children:Bu(e.startedAt,e.endedAt,n)})]})]}),d.jsxs("div",{className:"sub",children:[e.kind==="root"?"session":"subagent",e.childCount>0&&d.jsxs("span",{className:"spawn-badge",title:`${e.childCount} subagents spawned`,children:["→ ",e.childCount]}),e.cwdBasename&&e.kind==="subagent"?` · ${e.cwdBasename}`:"",e.model?d.jsxs("span",{className:"model-chip","data-family":rd(e.model),title:h,children:[Ds(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(O3,{waiting:e.waiting,now:n}),(()=>{const w=r3(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($3,{tools:e.tools,now:n}),d.jsxs("div",{className:"meta",children:[d.jsxs("span",{children:[d.jsx("b",{children:e.toolCount})," tools"]}),a>0&&d.jsxs("span",{className:"inflight-meta",children:[d.jsx("b",{children:a})," 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=Ja(e.model),N=jn(e),k=rw(e);if(!w&&N.total<=0)return e.usage.inputTokens+e.usage.outputTokens<=0?null:d.jsx("span",{className:"cost-unpriced",title:gk(e),children:Pa});if(N.total<=0)return null;const S=Math.max(0,((e.endedAt??n)-e.startedAt)/1e3),_=e.state==="active"?zw(N.total,S):null,E=gk(e)+(_?`
|
|
68
|
-
burn: ${_}`:"");return d.jsxs("span",{className:"cost-meta",title:E,children:[d.jsxs("b",{children:[Je(N.total),k>0?"+":""]}),_&&d.jsx("span",{className:"cost-rate",children:_})]})})()]}),d.jsx(Va,{type:"source",position:$e.Right,style:{background:"transparent",border:"none"}})]})}function Wu(e){return e==="active"?"live":e==="done"?"done":"err"}function A3({state:e}){return d.jsx("span",{className:`state-pill state-${e}`,children:Wu(e)})}function Sl(e){return e.message?e.message:e.kind==="permission"?"Needs your permission":"Waiting for your input"}function M3(e,t){const n=ET(e,t);return n?`Likely on: ${n}`:null}function I3(e){return e.kind==="idle"?"Your turn":Sl(e)}function O3({waiting:e,now:t}){const n=ql(e),s=Sl(e);return d.jsxs("div",{className:n?"waiting-row permission":"waiting-row idle",title:`${s}
|
|
69
|
-
Blocked for ${Bu(e.since,void 0,t)} — the answer goes in the terminal, not here.`,children:[n?d.jsx("span",{className:"ap-pulse","aria-hidden":!0}):d.jsx("span",{className:"waiting-dot","aria-hidden":!0}),d.jsx("span",{className:"waiting-said",children:I3(e)}),d.jsx("b",{children:Bu(e.since,void 0,t)})]})}function $3({tools:e,now:t}){const i=new Array(24).fill(0);let l=0;for(const N of e){const k=t-N.startedAt;if(k<0||k>=6e4)continue;const S=23-Math.floor(k/2500);S>=0&&S<24&&(i[S]+=1,l+=1)}const u=Math.max(1,...i),f=Math.max(0,...i),p=132,h=14,g=p/24,v=f/(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:h,viewBox:`0 0 ${p} ${h}`,"aria-hidden":!0,children:i.map((N,k)=>{const S=N===0?1.5:Math.max(1.5,N/u*h),_=k===23&&N>0,C=`tool-spark-bar${N>0?" active":""}${_?" latest":""}`;return d.jsx("rect",{x:k*g+.4,y:h-S,width:Math.max(.5,g-1),height:S,rx:.8,className:C},k)})}),d.jsx("span",{className:"tool-spark-label",children:"60s"})]})}function yk(e){if(e==null)return"(none)";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function P3({tool:e,onClose:t}){const n=Rn(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:a=>a.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"tool-modal-title",children:[d.jsxs("header",{className:"modal-head",children:[d.jsxs("div",{className:"modal-title",children:[d.jsx("span",{className:`status-dot ${s}`,"aria-hidden":!0}),d.jsx("span",{id:"tool-modal-title",className:"modal-tool-name",children:e.name}),d.jsxs("span",{className:"modal-tool-id",title:e.id,children:[e.id.slice(0,12),"…"]})]}),d.jsxs("div",{className:"modal-actions",children:[d.jsx("span",{className:"modal-dur",children:CT(e,"in-flight…")}),d.jsx("button",{className:"glyph-btn",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),d.jsxs("section",{className:"modal-body",children:[e.trimmed&&d.jsx("div",{className:"modal-section",children:d.jsx("p",{className:"modal-note",children:"Full payloads for this call were released to keep memory bounded — only the previews below are still held."})}),d.jsxs("div",{className:"modal-section",children:[d.jsx("h4",{children:"Input"}),d.jsx("pre",{children:yk(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…)":yk(e.response??e.errorPreview)})]})]})]})})}const hu=18,vk=26,L3=12;function q3(e){return D3(e.nodeInternals.values())}function D3(e){const t=new Map;for(const a of e){if(a.type!=="agent")continue;const i=a.data;if(!(i!=null&&i.sessionId)||i.exitAt!=null||a.width==null||a.height==null)continue;const l=a.position.x,u=a.position.y,f=l+a.width,p=u+a.height,h=t.get(i.sessionId);h?(h.minX=Math.min(h.minX,l),h.minY=Math.min(h.minY,u),h.maxX=Math.max(h.maxX,f),h.maxY=Math.max(h.maxY,p),i.kind==="root"&&(h.label=xk(i)??h.label),i.kind==="root"&&(h.name=bk(i))):t.set(i.sessionId,{minX:l,minY:u,maxX:f,maxY:p,label:xk(i)??i.sessionId,name:bk(i)})}const n=new Map;for(const a of t.values())n.set(a.label,(n.get(a.label)??0)+1);const s=[];for(const[a,i]of t){const l=(n.get(i.label)??0)>1;s.push({sessionId:a,...U3(i.label,i.name,a,l),x:i.minX-hu,y:i.minY-hu-vk,w:i.maxX-i.minX+hu*2,h:i.maxY-i.minY+hu*2+vk})}return s}const sw=" · ",F3=32,z3=/[\u1100-\u115F\u2E80-\u303E\u3041-\u33FF\u3400-\u4DBF\u4E00-\u9FFF\uA000-\uA4CF\uAC00-\uD7A3\uF900-\uFAFF\uFE30-\uFE6F\uFF00-\uFF60\uFFE0-\uFFE6]/;function wk(e){return z3.test(e)?2:1}function B3(e,t=F3){const n=[...e];let s=0;for(const l of n)s+=wk(l);if(s<=t)return e;const a=[];let i=0;for(const l of n){const u=wk(l);if(i+u>t-1)break;a.push(l),i+=u}for(;a.length&&/[\s\-_.:/]/.test(a[a.length-1]);)a.pop();return`${a.join("")}…`}function U3(e,t,n,s){const a=(t==null?void 0:t.trim())??"",i=s?W3(n):void 0,l=[e,a||void 0,i].filter(Boolean);return{label:e,name:a?B3(a):void 0,shortId:i,fullLabel:l.join(sw)}}function W3(e){const t=e.match(/[a-zA-Z0-9]{4}/);return t?t[0]:e.slice(0,4)}function xk(e){if(e.kind==="root")return e.label}function bk(e){if(e.kind==="root")return jT(e.sessionName,e.sessionTitle).face}function H3({onFit:e}){const{x:t,y:n,zoom:s}=dT(),a=Il(),i=it(q3,G3);if(i.length<=1)return null;const l=f=>{try{const p=a.getNodes().filter(h=>{const g=h.data;return(g==null?void 0:g.sessionId)===f});if(p.length===0)return;a.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:i.map(f=>{const p=Dw(f.sessionId),h={position:"absolute",left:f.x,top:f.y,width:f.w,height:f.h,"--session-hue":p},g={position:"absolute",left:f.x+16,top:f.y-L3,transform:`scale(${Math.min(1,s)/(s||1)})`,transformOrigin:"left top","--session-hue":p};return d.jsxs(de.Fragment,{children:[d.jsx("div",{className:"cluster-card",style:h,"aria-hidden":!0}),d.jsxs("button",{type:"button",className:"cluster-label",style:g,title:`Fit view to ${f.fullLabel}
|
|
70
|
-
drag the wrapper to move the whole session`,onClick:()=>l(f.sessionId),children:[f.label,f.name?d.jsxs(d.Fragment,{children:[sw,d.jsx("span",{className:"cluster-label-name",children:f.name})]}):null,f.shortId?sw+f.shortId:null]})]},f.sessionId)})})}function G3(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){const s=e[n],a=t[n];if(s.sessionId!==a.sessionId||s.label!==a.label||s.name!==a.name||s.shortId!==a.shortId||s.fullLabel!==a.fullLabel||s.x!==a.x||s.y!==a.y||s.w!==a.w||s.h!==a.h)return!1}return!0}function V3({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 Dl={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"}},Y3=Object.fromEntries(Object.entries(Dl).map(([e,t])=>[e,t.category])),K3=Object.fromEntries(Object.entries(Dl).map(([e,t])=>[e,t.emoji])),X3=Object.fromEntries(Object.entries(Dl).map(([e,t])=>[e,t.label])),Q3=new Set(Object.keys(Dl)),Z3=new Set(Object.entries(Dl).filter(([,e])=>e.shell).map(([e])=>e)),kk={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",...Y3};function AT(e){return e.startsWith("mcp__")?"mcp":Object.hasOwn(kk,e)?kk[e]:"other"}const J3=/\btools\.exec_command\s*\(\s*\{[^{}]*?\bcmd\s*:\s*(["'`])((?:\\.|(?!\1)[^\\])*)\1/,e4=/\btools\.([A-Za-z_$][\w$]*)\s*\(/;function t4(e){if(typeof e!="string"||!e)return null;const t=J3.exec(e);if(t){const s=n4(t[2]);if(s.trim())return s}const n=e4.exec(e);return n?n[1]:null}function n4(e){return e.replace(/\\(["'`\\nrt])/g,(t,n)=>n==="n"?`
|
|
71
|
-
`:n==="r"?"\r":n==="t"?" ":n)}const MT=600,r4=4,s4=36,ow=16,o4=60,a4=6,_k=220,Sk=96,i4=28,Nk={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:"📡",...K3};function Ek(e){return e.startsWith("mcp__")?"🔌":Object.hasOwn(Nk,e)?Nk[e]:"✨"}const Ck={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 IT(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 IT(n[1]);for(;;){const i=t.match(/^([A-Z_][A-Z0-9_]*=\S*)\s+/);if(!i)break;t=t.slice(i[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 a=s[1];return a=a.replace(/^.*[/\\]/,""),a=a.replace(/\.(exe|cmd|bat|ps1)$/i,""),a||null}function l4(e){if(typeof e=="string")return e;if(!e||typeof e!="object")return null;const t=e;if(typeof t.script=="string"){const n=t4(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(a=>/^(-Command|-c)$/i.test(a));if(s>=0&&s+1<n.length)return n[s+1]}return n.join(" ")}return typeof t.script=="string"?t.script:null}const c4=new Set(["Bash","PowerShell",...Z3]),u4=Q3;function d4(e,t){return u4.has(e)||e.startsWith("mcp__")?Math.max(Sk,34+t.length*7.5):Sk}function h4(e,t){if(!c4.has(e))return null;const n=l4(t);if(!n)return null;const s=IT(n);return s?{emoji:Object.hasOwn(Ck,s)?Ck[s]:"⚙️",label:s,category:"shell",detail:n}:null}const f4=new Set(["Read","Write","Edit","MultiEdit","NotebookEdit","LS","Glob","apply_patch"]),jk={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:"🗄️"},Tk={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 p4(e){const n=e.replace(/\\/g,"/").replace(/\/+$/,""),s=n.lastIndexOf("/");return s>=0?n.slice(s+1):n}function m4(e){const t=e.toLowerCase();if(Object.hasOwn(Tk,t))return Tk[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(jk,s))return jk[s]}return"📄"}function g4(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 y4(e,t){if(!f4.has(e))return null;const n=g4(e,t);if(!n)return null;const s=p4(n);return s?{emoji:e==="LS"?"📂":m4(s),label:s,category:"file",detail:n}:null}const Rk={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 Ww(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 v4(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 OT(e){const t=e.toLowerCase();return Object.hasOwn(Rk,t)?Rk[t]:void 0}function w4(e,t){const n=Ww(e);if(!n)return null;const{server:s,method:a}=n;if(!a)return null;const i=OT(s);return{emoji:(i==null?void 0:i.emoji)??"🔌",label:a,category:"mcp",detail:i?`${i.name} · ${a}`:`${s} · ${a}`}}function x4(e,t){return h4(e,t)??y4(e,t)??w4(e)}const Ak=X3;function $T(e){const t=Ww(e);if(t){const s=OT(t.server);return s?{emoji:s.emoji,label:s.name}:{emoji:"🔌",label:t.server,hue:v4(t.server)}}const n=Object.hasOwn(Ak,e)?Ak[e]:"";return n?{emoji:Ek(e),label:n}:{emoji:Ek(e),label:e}}function b4(e){let t=null,n="";for(const s of e){const a=Ww(s);if(a){if(!a.server)return null;if(t===null)t=a.server,n=s;else if(a.server!==t)return null}}return t===null?null:$T(n)}function k4(e){return e.endedAt==null?"inflight":e.ok===!1?"err":"done"}function _4(e,t){if(t==null)return 1;const n=e-t;return n<0?1:Math.max(0,1-n/MT)}function S4(e,t){const n=[],s=new Set;for(let a=e.length-1;a>=0&&n.length<t;a--){const i=e[a];s.has(i.id)||(s.add(i.id),n.push(i))}return n.reverse()}function N4(e,t,n,s,a,i){const l=[];for(const u of e.values()){if(!t.has(u.id)||u.exitAt!=null&&i-u.exitAt>MT)continue;const f=s.get(u.id)??n.get(u.id);if(!f)continue;const p=S4(u.tools,r4);if(p.length===0)continue;const h=u.exitAt??null,g=a.get(u.id),v=Math.max((g==null?void 0:g.width)??_k,_k),w=(g==null?void 0:g.height)??130,N=f.x,k=f.y,S=N+v,_=k+w/2;p.forEach((E,C)=>{const j=C*s4,M=N+v+o4,$=k+a4+j,O=_4(i,h),z=E.inputPreview??"",I=k4(E),A=O<.999,q=$T(E.name);l.push({id:`${u.id}::${E.id}`,toolId:E.id,agentId:u.id,toolName:E.name,name:q.label,emoji:q.emoji,status:I,category:AT(E.name),mcpHue:q.hue,inputPreview:z,fade:O,fading:A,worldX:M,worldY:$,anchorX:S,anchorY:_,spawnDx:S-M,spawnDy:_-($+ow)});const V=x4(E.name,E.input);if(V){const Y=d4(E.name,q.label),R=M+Y+i4,X=$,B=M+Y,ne=$+ow;l.push({id:`sub:${u.id}::${E.id}`,toolId:E.id,agentId:u.id,toolName:E.name,name:V.label,emoji:V.emoji,isSub:!0,status:I,category:V.category,inputPreview:V.detail??z,fade:O,fading:A,worldX:R,worldY:X,anchorX:B,anchorY:ne,spawnDx:B-R,spawnDy:0})}})}return l}function E4({agents:e,visibleAgentIds:t,positions:n,pinned:s,measured:a,spotlight:i,hiddenCategories:l,now:u,onOpenTool:f}){const p=N4(e,t,n,s,a,u),h=l&&l.size>0?p.filter(g=>!l.has(g.category)):p;return d.jsx(C4,{bursts:h,spotlight:i,onOpenTool:f})}function C4({bursts:e,spotlight:t,onOpenTool:n}){const{x:s,y:a,zoom:i}=dT();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*i+s,f=l.anchorY*i+a,p=(l.worldX+6)*i+s,h=(l.worldY+ow)*i+a,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} ${f} Q ${g} ${f}, ${p} ${h}`,className:`tool-conn status-${l.status}${l.fading?" fading":""}`,opacity:w},`l:${l.id}`)})}),e.map(l=>{const u=l.worldX*i+s,f=l.worldY*i+a,p={left:`${u}px`,top:`${f}px`,transform:`scale(${i})`,transformOrigin:"left top","--spawn-dx":`${l.spawnDx}px`,"--spawn-dy":`${l.spawnDy}px`},h=l.isSub?`${l.toolName} · ${l.name}`:l.toolName,g=l.inputPreview?`${h} · ${l.inputPreview}`:h,v=n!=null,w=l.mcpHue!=null?{"--mcp-hue":l.mcpHue}:{},k=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":""}${k}`,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 j4(e){const t={input:0,output:0,cacheRead:0,cacheWrite:0,total:0};let n=0,s=0,a=0,i=0;for(const l of e){const u=jn(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,a+=l.usage.cacheReadTokens,i+=l.usage.cacheCreateTokens}return{cost:t,inputTokens:n,outputTokens:s,cacheReadTokens:a,cacheCreateTokens:i,sum:n+s}}const T4="spend on this board",R4="on this board",Mk=`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.`,PT="session spend";function Hw({cost:e,size:t="md"}){const n=e.total;if(n<=0)return null;const s=(i,l,u)=>{if(i<=0)return null;const f=i/n*100;return d.jsx("span",{className:`cb-seg ${l}`,style:{width:`${f}%`},title:`${u}: ${Je(i)} (${f.toFixed(0)}%)`},l)},a=t==="lg";return d.jsxs("div",{className:a?"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 A4({state:e,sessionId:t,onClose:n}){const s=b.useMemo(()=>M4(e,t),[e,t]),a=b.useRef(null),i=Rn(n,{focusRef:a});return s?d.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:d.jsxs("div",{ref:i,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:a,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:PT}),d.jsx("div",{className:"ss-cost",children:Je(s.cost.total)}),s.modelChips.length>0&&d.jsx("div",{className:"ss-models",children:s.modelChips.map(l=>d.jsx("span",{className:"model-chip","data-family":rd(l),title:l,children:Ds(l)},l))})]}),d.jsx("div",{className:"ss-hero-right",children:s.cost.total>0&&d.jsxs(d.Fragment,{children:[d.jsx(Hw,{cost:s.cost,size:"lg"}),d.jsxs("div",{className:"ss-cost-legend",children:[d.jsxs("span",{className:"ssl ssl-in",children:["input ",d.jsx("b",{children:Je(s.cost.input)})]}),d.jsxs("span",{className:"ssl ssl-out",children:["output ",d.jsx("b",{children:Je(s.cost.output)})]}),d.jsxs("span",{className:"ssl ssl-cr",children:["cache r ",d.jsx("b",{children:Je(s.cost.cacheRead)})]}),d.jsxs("span",{className:"ssl ssl-cw",children:["cache w ",d.jsx("b",{children:Je(s.cost.cacheWrite)})]})]})]})})]}),d.jsxs("section",{className:"ss-stats",children:[d.jsx(Ia,{label:"agents",value:s.agentCount}),d.jsx(Ia,{label:"subagents",value:s.subagentCount}),d.jsx(Ia,{label:"tool calls",value:s.toolCount}),d.jsx(Ia,{label:"prompts",value:s.promptCount}),d.jsx(Ia,{label:"tokens",value:s.tokensSum.toLocaleString()}),s.errCount>0&&d.jsx(Ia,{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 Ia({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 M4(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 a={input:0,output:0,cacheRead:0,cacheWrite:0,total:0},i=new Set,l=new Map;let u=0,f=0,p=0,h=0,g=0,v,w=1/0,N=0;for(const C of s){const j=jn(C);a.input+=j.input,a.output+=j.output,a.cacheRead+=j.cacheRead,a.cacheWrite+=j.cacheWrite,a.total+=j.total;for(const M of ST(C))i.add(M);C.model&&i.add(C.model),C.kind==="subagent"&&g++,f+=C.prompts.length,!v&&C.prompts.length>0&&(v=C.prompts[0].text),p+=C.usage.inputTokens+C.usage.outputTokens,u+=C.toolCount,w=Math.min(w,C.startedAt),N=Math.max(N,C.endedAt??Date.now());for(const M of C.tools)l.set(M.name,(l.get(M.name)??0)+1),M.ok===!1&&h++}const k=Math.max(0,N-w),S=Math.floor(k/1e3),_=S<60?`${S}s`:S<3600?`${Math.floor(S/60)}m ${String(S%60).padStart(2,"0")}s`:`${Math.floor(S/3600)}h ${Math.floor(S%3600/60)}m`,E=Array.from(l.entries()).sort((C,j)=>j[1]-C[1]).slice(0,5);return{sessionId:t,label:n.label||n.cwdBasename||"session",cwd:n.cwd,durationLabel:_,cost:a,modelChips:Array.from(i),agentCount:s.length,subagentCount:g,toolCount:u,promptCount:f,tokensSum:p,errCount:h,topTools:E,firstPrompt:v}}function Ik(e){return e.waiting?ql(e.waiting)?0:1:e.state==="active"?2:3}function I4(e,t){const n=[];for(const s of e.agents.values()){if(s.kind!=="root")continue;let a=s.toolCount,i=jn(s).total,l=s.endedAt??s.startedAt;for(const u of e.agents.values()){if(u.sessionId!==s.sessionId||u.kind==="root")continue;a+=u.toolCount,i+=jn(u).total;const f=u.endedAt??u.startedAt;f>l&&(l=f)}n.push({sessionId:s.sessionId,label:s.label||s.cwdBasename||"session",cwdBasename:s.cwdBasename,state:s.state,waiting:s.waiting,modelId:s.model,toolCount:a,cost:i,startedAt:s.startedAt,lastActivity:l})}return n.sort((s,a)=>{const i=Ik(s),l=Ik(a);return i!==l?i-l:s.waiting&&a.waiting?s.waiting.since-a.waiting.since:a.lastActivity-s.lastActivity}),n}function Ok(e,t,n){const s=(t??n)-e;if(s<1e3)return"<1s";const a=Math.floor(s/1e3);if(a<60)return`${a}s`;const i=Math.floor(a/60);return i<60?`${i}m`:`${Math.floor(i/60)}h ${i%60}m`}function O4({state:e,now:t,selectedIds:n,onSelect:s,onClose:a}){const i=b.useMemo(()=>I4(e),[e,e.revision,t]),l=i.filter(f=>f.state==="active").length,u=i.filter(f=>ql(f.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:i.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:a,title:"Hide sidebar (L)","aria-label":"Hide session list",children:"‹"})]}),d.jsxs("div",{className:"sl-rows",children:[i.length===0&&d.jsx("div",{className:"sl-empty",children:"No sessions yet."}),i.map(f=>{const p=n.has(f.sessionId);return d.jsxs("button",{type:"button",className:`sl-row state-${f.state}${p?" selected":""}`,onClick:()=>s(f.sessionId),title:`Focus ${f.label}`,children:[d.jsx("span",{className:`sl-dot state-${f.state}`,"aria-hidden":!0}),d.jsx("span",{className:"vis-hidden",children:Wu(f.state)}),d.jsxs("div",{className:"sl-row-body",children:[d.jsxs("div",{className:"sl-row-head",children:[d.jsx("span",{className:"sl-label",children:f.label}),f.modelId&&d.jsx("span",{className:"model-chip","data-family":rd(f.modelId),title:f.modelId,children:Ds(f.modelId)})]}),d.jsxs("div",{className:"sl-row-meta",children:[d.jsxs("span",{title:"tool calls",children:[d.jsx("b",{children:f.toolCount})," tools"]}),f.cost>0&&d.jsx("span",{className:"sl-cost",title:PT,children:d.jsx("b",{children:Je(f.cost)})}),f.waiting?d.jsxs("span",{className:"sl-waiting",title:[Sl(f.waiting),M3(f.waiting,Sl(f.waiting)),`Blocked since ${new Date(f.waiting.since).toLocaleTimeString()} · started ${new Date(f.startedAt).toLocaleString()}`].filter(Boolean).join(`
|
|
74
|
-
`),children:["waiting ",Ok(f.waiting.since,void 0,t),f.waiting.tool&&d.jsxs("span",{className:"sl-waiting-tool",children:[" · ",f.waiting.tool.name]})]}):d.jsx("span",{className:"sl-elapsed",title:`Started ${new Date(f.startedAt).toLocaleString()}`,children:Ok(f.startedAt,f.state==="active"?void 0:f.lastActivity,t)})]})]})]},f.sessionId)})]})]})}const $4=e=>1-Math.pow(1-e,5),LT=420;function P4(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 L4(e,t,n,s=LT){return n>=s?t:n<=0?e:e+(t-e)*$4(n/s)}function q4(e,t,n,s={}){const a=s.now??(()=>performance.now()),i=s.raf??(w=>requestAnimationFrame(w)),l=s.cancel??(w=>cancelAnimationFrame(w)),u=s.reducedMotion??(()=>typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches),f=s.hidden??(()=>typeof document=="object"&&document.hidden===!0);if(u()||f()||!P4(e,t))return n(t),()=>{};const p=a();let h=0,g=!0;const v=()=>{if(!g)return;const w=a()-p;n(L4(e,t,w)),w<LT&&(h=i(v))};return h=i(v),()=>{g=!1,h&&l(h)}}const aw={cost:0,inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0,sessions:0};function $k(e,t){const n=new Map;for(const s of e){if(s.kind!=="root"||!s.sessionId)continue;const a=jn(s,t);n.set(s.sessionId,{cost:a.total,inputTokens:s.usage.inputTokens,outputTokens:s.usage.outputTokens,cacheReadTokens:s.usage.cacheReadTokens,cacheCreateTokens:s.usage.cacheCreateTokens})}return n}function D4(e,t){if(!e)return aw;const n={...aw};for(const[s,a]of t){const i=e.get(s);if(!i)continue;const l={cost:a.cost-i.cost,inputTokens:a.inputTokens-i.inputTokens,outputTokens:a.outputTokens-i.outputTokens,cacheReadTokens:a.cacheReadTokens-i.cacheReadTokens,cacheCreateTokens:a.cacheCreateTokens-i.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 iw(e,t=new Date){return new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate()-(e-1))).toISOString().slice(0,10).replace(/-/g,"")}const od=[{key:"today",label:"today",noun:"today",hint:"Since midnight, on this machine's clock."},{key:"month",label:"month",noun:"this month",hint:"Since the 1st of this calendar month — not the last 30 days."},{key:"all",label:"all",noun:"all time",hint:"Every transcript on disk, back to 2020."}];function F4(e,t,n=od.length){return n<=0?null:e==="ArrowRight"||e==="ArrowDown"?(t+1)%n:e==="ArrowLeft"||e==="ArrowUp"?(t-1+n)%n:e==="Home"?0:e==="End"?n-1:null}function z4(e,t=new Date){return e==="today"?iw(1,t):e==="month"?iw(t.getDate(),t):"20200101"}const Cn=e=>typeof e=="number"&&Number.isFinite(e)?e:0,Cu=e=>typeof e=="string"?e:"";function qT(e){const t=Array.isArray(e==null?void 0:e.days)?e.days:[],n=new Map;for(const s of t){const a=Array.isArray(s==null?void 0:s.modelBreakdowns)?s.modelBreakdowns:[];for(const i of a){const l=Cu(i==null?void 0:i.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+=Cn(i==null?void 0:i.cost),u.inputTokens+=Cn(i==null?void 0:i.inputTokens),u.outputTokens+=Cn(i==null?void 0:i.outputTokens),u.cacheReadTokens+=Cn(i==null?void 0:i.cacheReadTokens),u.cacheCreateTokens+=Cn(i==null?void 0:i.cacheCreationTokens)}}return[...n.values()].sort((s,a)=>a.cost-s.cost||a.tokens-s.tokens)}function B4(e,t=new Map){const n=Array.isArray(e==null?void 0:e.sessions)?e.sessions:[],s=[];for(const a of n){const i=Cu(a==null?void 0:a.period);if(!i)continue;const l=a==null?void 0:a.metadata,u=typeof(l==null?void 0:l.lastActivity)=="string"?Date.parse(l.lastActivity):NaN;s.push({sessionId:i,label:t.get(i)??null,agent:Cu(a==null?void 0:a.agent)||"claude",cost:Cn(a==null?void 0:a.totalCost),tokens:Cn(a==null?void 0:a.totalTokens),models:Array.isArray(a==null?void 0:a.modelsUsed)?a.modelsUsed.map(Cu).filter(Boolean):[],lastActivityMs:Number.isFinite(u)?u:null})}return s.sort((a,i)=>i.cost-a.cost||i.tokens-a.tokens)}function DT(e){const t=e==null?void 0:e.totals;if(t&&typeof t=="object"){const f=Cn(t.cacheReadTokens),p=Cn(t.cacheCreationTokens),h=Cn(t.inputTokens),g=Cn(t.outputTokens);return{cost:Cn(t.totalCost),inputTokens:h,outputTokens:g,cacheReadTokens:f,cacheCreateTokens:p,tokens:Cn(t.totalTokens)||h+g+f+p}}const n=qT(e),s=f=>n.reduce((p,h)=>p+f(h),0),a=s(f=>f.inputTokens),i=s(f=>f.outputTokens),l=s(f=>f.cacheReadTokens),u=s(f=>f.cacheCreateTokens);return{cost:s(f=>f.cost),inputTokens:a,outputTokens:i,cacheReadTokens:l,cacheCreateTokens:u,tokens:a+i+l+u}}function U4(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 Pk(e,t){var n;return((n=od.find(s=>s.key===(e??t)))==null?void 0:n.noun)??"today"}function W4(e,t,n){const s=e!=null,a=DT(e);return{fromRange:s,cost:s?a.cost+n.cost:t.cost.total,inputTokens:s?a.inputTokens+n.inputTokens:t.inputTokens,outputTokens:s?a.outputTokens+n.outputTokens:t.outputTokens,cacheReadTokens:s?a.cacheReadTokens+n.cacheReadTokens:t.cacheReadTokens,cacheCreateTokens:s?a.cacheCreateTokens+n.cacheCreateTokens:t.cacheCreateTokens,hasCost:s?a.cost>0:t.cost.total>0,tokenSum:s?a.tokens:t.sum,showCostBar:!s}}const H4="1",Lk="agent-dag.schema",G4=["agent-dag.layout","agent-dag.viewport"];function ei(e){if(typeof window>"u")return null;try{return window.localStorage.getItem(e)}catch{return null}}function V4(e,t=H4){let n=null;try{n=e.getItem(Lk)}catch{return[]}if(n===t)return[];const s=[];if(n!==null)for(const a of G4)try{e.getItem(a)!==null&&(e.removeItem(a),s.push(a))}catch{}try{e.setItem(Lk,t)}catch{}return s}const Ut="ccdeck";function FT(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 lw(e){return FT(Math.floor(e/1e3))}function zT(e,t){const n=e-t;if(n<=0)return null;const s=Math.floor(n/86400),a=Math.floor(n%86400/3600),i=Math.floor(n%3600/60);return s>0?`${s}d ${a}h`:a>0?`${a}h ${i}m`:`${i}m`}function Y4(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function K4(e,t,n){const s=new Date(e),a=lw(t-e);return{label:Y4(s,new Date(t))?a:`${a} · ${s.toLocaleDateString(n,{month:"short",day:"numeric"})}`,title:s.toLocaleString(n,{dateStyle:"medium",timeStyle:"medium"})}}function BT(e,t){return{disabled:e!=null&&e!==t,busy:e===t}}function UT(e){return e==null}const cw="self";function Ct(e,t=!1){const n=BT(e?cw:null,cw);return{disabled:t||n.disabled,"aria-busy":n.busy}}function qt(e){return UT(e?cw:null)}function X4(e){return[...e==null?[]:[`#ap-more-${e}`],".accounts-panel .ap-refresh"]}function Q4(e){return e==null||e==="BODY"||e==="HTML"}const WT="agent-dag.usagePeriod";function Z4(){const e=ei(WT);return od.some(t=>t.key===e)?e:"today"}function J4(e){if(!(typeof window>"u"))try{window.localStorage.setItem(WT,e)}catch{}}const HT="agent-dag.usageSessionsOpen";function eq(){return ei(HT)==="1"}function tq(e){if(!(typeof window>"u"))try{window.localStorage.setItem(HT,e?"1":"0")}catch{}}function qk(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 nq(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 gf="__unknown__";function rq(e,t,n,s){const a=Math.max(0,t-s),i=Math.max(0,n-a);if(i<120)return null;const l=Math.min(100,i/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 f=100-e,p=i>0?e/i:0,h=p>0?f/p:1/0,g={label:`${Math.round(u)}% ahead`,color:"var(--warn)",expectedPct:l,isDeficit:!0};if(h<a&&h<86400){const v=Math.floor(h/3600),w=Math.floor(h%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 xo({pct:e,label:t,reset:n,resetAt:s,windowSec:a,limitReached:i,nowSec:l}){const u=Math.min(100,Math.max(0,e)),p=i||u>=90?"var(--err)":u>=70?"var(--warn)":"var(--accent)",h=u===0?"< 1%":`${u}%`,g=u===0?2:u,v=s?zT(s,l):null,w=s&&a?rq(u,s,a,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,i&&d.jsx("span",{className:"qb-limit-badge",title:"Rate limit reached",children:"⛔"})]}),d.jsx("span",{className:"qb-pct",style:{color:p},children:h})]}),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 sq=6e4;function oq(e){const[t,n]=b.useState(null),[s,a]=b.useState(!1),i=b.useRef(null),l=b.useRef(!1),u=async(p=!1)=>{if(!(p&&!qt(l.current))){p&&(l.current=!0,a(!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,a(!1))}}};return b.useEffect(()=>{if(e)return u(!0),i.current=window.setInterval(()=>u(!1),sq),()=>{i.current!=null&&window.clearInterval(i.current)}},[e]),{quota:t,loading:s,refresh:()=>{e&&u(!0)}}}function aq(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 iq(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 GT=6e4,Dk=6e4;function lq(e){const[t,n]=b.useState(null),[s,a]=b.useState(!1),i=b.useRef(null),l=b.useRef(!1),u=async(p=!1)=>{if(!(p&&!qt(l.current))){p&&(l.current=!0,a(!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,a(!1))}}};return b.useEffect(()=>{if(e)return u(!0),i.current=window.setInterval(()=>u(!1),GT),()=>{i.current!=null&&window.clearInterval(i.current)}},[e]),{data:t,loading:s,refresh:()=>{e&&u(!0)}}}function cq(e){const[t,n]=b.useState(null),s=b.useRef(null),a=async()=>{try{const i=await fetch("/api/codex-usage");i.ok&&n(await i.json())}catch{}};return b.useEffect(()=>{if(e)return a(),s.current=window.setInterval(a,GT),()=>{s.current!=null&&window.clearInterval(s.current)}},[e]),{data:t}}function uq(e,t,n){const[s,a]=b.useState(null),[i,l]=b.useState(!1),[u,f]=b.useState(0),p=b.useRef(0);b.useEffect(()=>{const g=()=>document.visibilityState==="visible",v=()=>{g()&&f(k=>k+1)},w=window.setInterval(v,Dk),N=()=>{g()&&Date.now()-p.current>=Dk&&f(k=>k+1)};return document.addEventListener("visibilitychange",N),()=>{window.clearInterval(w),document.removeEventListener("visibilitychange",N)}},[]);const h=b.useRef(t);return b.useEffect(()=>{let g=!0;const v=t!==h.current;h.current=t;const w=e,N=z4(w);return l(!0),fetch(`/api/ccusage?since=${N}${v?"&refresh=1":""}`).then(k=>k.ok?k.json():null).then(k=>{!g||!(k!=null&&k.ok)||(p.current=Date.now(),a({period:w,data:k,baseline:n()}))}).catch(()=>{}).finally(()=>{g&&l(!1)}),()=>{g=!1}},[e,t,u]),{...U4(s,e),loading:i}}function ol(e){const[t,n]=b.useState(e),s=b.useRef(e),a=b.useRef(!0);return b.useEffect(()=>{s.current=t},[t]),b.useEffect(()=>{if(a.current){a.current=!1,s.current=e,n(e);return}return q4(s.current,e,l=>{s.current=l,n(l)})},[e]),t}function dq({state:e,now:t,providers:n,onClose:s}){var rt,Ye;const{quota:a,loading:i,refresh:l}=oq(n.claude),{data:u,loading:f,refresh:p}=lq(n.codex),{data:h}=cq(n.codex),[g,v]=b.useState(()=>Math.floor(Date.now()/1e3));b.useEffect(()=>{const pe=window.setInterval(()=>v(Math.floor(Date.now()/1e3)),3e4);return()=>window.clearInterval(pe)},[]);const{byModel:w,totalCost:N,totalTokens:k,burnRate:S}=b.useMemo(()=>{const pe=new Map;for(const oe of e.agents.values())for(const Se of Ll(oe)){const qe=Se.model??gf,_e=Fw(Se.usage,Se.model),Be=pe.get(qe);Be?(Be.inputTokens+=Se.usage.inputTokens,Be.outputTokens+=Se.usage.outputTokens,Be.cacheReadTokens+=Se.usage.cacheReadTokens,Be.cacheCreateTokens+=Se.usage.cacheCreateTokens,Be.cost.total+=_e.total,Be.cost.input+=_e.input,Be.cost.output+=_e.output,Be.cost.cacheRead+=_e.cacheRead,Be.cost.cacheWrite+=_e.cacheWrite,Be.agentCount++):pe.set(qe,{model:qe,inputTokens:Se.usage.inputTokens,outputTokens:Se.usage.outputTokens,cacheReadTokens:Se.usage.cacheReadTokens,cacheCreateTokens:Se.usage.cacheCreateTokens,cost:{..._e},agentCount:1,priced:Ja(Se.model)!=null})}const we=Array.from(pe.values()).sort((oe,Se)=>Se.cost.total-oe.cost.total||Se.inputTokens+Se.outputTokens-(oe.inputTokens+oe.outputTokens));let Pe=0,Ue=0;for(const oe of e.agents.values()){if(oe.state!=="active")continue;const Se=jn(oe);Pe+=Se.total,Ue=Math.max(Ue,((oe.endedAt??t)-oe.startedAt)/1e3)}const st=Ue>0?zw(Pe,Ue):null,Oe=j4(e.agents.values());return{byModel:we,totalCost:Oe.cost,totalTokens:Oe,burnRate:st}},[e,e.revision,t]),_=b.useMemo(()=>{const pe=[];for(const we of e.agents.values()){if(we.kind!=="root")continue;let Pe=jn(we).total,Ue=we.usage.inputTokens,st=we.usage.outputTokens,Oe=rw(we);for(const oe of e.agents.values())oe.sessionId!==we.sessionId||oe.kind==="root"||(Pe+=jn(oe).total,Ue+=oe.usage.inputTokens,st+=oe.usage.outputTokens,Oe+=rw(oe));pe.push({sessionId:we.sessionId,label:we.label||we.cwdBasename||"session",state:we.state,cost:Pe,inputTokens:Ue,outputTokens:st,unpricedTokens:Oe})}return pe.sort((we,Pe)=>Pe.cost-we.cost||Pe.inputTokens+Pe.outputTokens-(we.inputTokens+we.outputTokens)).slice(0,12)},[e,e.revision]),[E,C]=b.useState(Z4);b.useEffect(()=>{J4(E)},[E]);const[j,M]=b.useState(eq);b.useEffect(()=>{tq(j)},[j]);const $=b.useRef([]),[O,z]=b.useState(0),I=b.useRef(()=>new Map);I.current=()=>$k(e.agents.values(),t);const A=b.useCallback(()=>I.current(),[]),{data:q,shown:V,stale:Y,loading:R,baseline:X}=uq(E,O,A),B=q!=null,ne=R&&Y,Z=b.useMemo(()=>{const pe=new Map;for(const we of e.agents.values()){if(we.kind!=="root"||!we.sessionId)continue;const Pe=we.label||we.cwdBasename;Pe&&pe.set(we.sessionId,Pe)}return pe},[e,e.revision]),W=b.useMemo(()=>{const pe=new Map;for(const we of e.agents.values())we.kind!=="root"||!we.sessionId||pe.set(we.sessionId,we.state);return pe},[e,e.revision]),J=b.useMemo(()=>B?qT(q):[],[q,B]),P=b.useMemo(()=>{if(!B)return[];const pe=B4(q,Z).slice(0,12),we=new Map;for(const Pe of pe)Pe.label&&we.set(Pe.label,(we.get(Pe.label)??0)+1);return pe.map(Pe=>Pe.label&&(we.get(Pe.label)??0)>1?{...Pe,label:`${Pe.label} ${Pe.sessionId.slice(0,4)}`}:Pe)},[q,B,Z]),K=b.useMemo(()=>DT(q),[q]),te=Pk(V,E),D=Y?" up-stale":"",L=b.useMemo(()=>B?D4(X,$k(e.agents.values(),t)):aw,[e,e.revision,X,B,t]),Q=W4(q,{...k,cost:N},L),U=Q.hasCost,ie=Q.tokenSum,fe=ol(Q.cost),me=ol(Q.inputTokens),ke=ol(Q.outputTokens),Ve=ol(Q.cacheReadTokens),Le=ol(Q.cacheCreateTokens),De=w.filter(pe=>pe.cost.total>0||pe.inputTokens+pe.outputTokens>0),Ne=_.filter(pe=>pe.cost>0||pe.inputTokens+pe.outputTokens>0),Ge=B?J.some(pe=>pe.cost<=0&&pe.tokens>0):De.some(pe=>!pe.priced),be=i||f,se=qk(a==null?void 0:a.fetchedAt,g),Qe=qk(u==null?void 0:u.fetchedAt,g),ut=()=>{l(),p(),z(pe=>pe+1)},lt=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"}),S&&d.jsx("span",{className:"up-rate",children:S}),d.jsxs("div",{className:"up-header-right",children:[(n.claude||n.codex)&&d.jsx("button",{type:"button",className:"glyph-btn up-refresh-btn",onClick:ut,...Ct(be),"aria-label":lt,title:lt,children:be?"…":"↻"}),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",se&&!i&&d.jsx("span",{className:"up-section-age",title:nq(a==null?void 0:a.source),children:se})]}),a!=null&&a.ok?d.jsxs("div",{className:"up-quota-bars",children:[a.session5hPct!=null&&d.jsx(xo,{label:"5-hour window",pct:a.session5hPct,reset:a.session5hReset,resetAt:a.session5hResetAt,windowSec:a.session5hWindowSec,nowSec:g}),a.week7dPct!=null&&d.jsx(xo,{label:"7-day window",pct:a.week7dPct,reset:a.week7dReset,resetAt:a.week7dResetAt,windowSec:a.week7dWindowSec,nowSec:g}),a.weekSonnetPct!=null&&d.jsx(xo,{label:"Sonnet (7d)",pct:a.weekSonnetPct,nowSec:g}),a.weekOpusPct!=null&&d.jsx(xo,{label:"Opus (7d)",pct:a.weekOpusPct,nowSec:g})]}):(a==null?void 0:a.ok)===!1?d.jsxs("div",{className:"up-quota-na",children:[d.jsx("span",{children:a.reason==="no_subscription"?"No quota to show.":"Quota unavailable."}),d.jsx("span",{className:"up-quota-hint",children:aq(a.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}),Qe&&!f&&d.jsx("span",{className:"up-section-age",title:"Fetched from the Codex usage endpoint",children:Qe})]}),u!=null&&u.ok?d.jsxs("div",{className:"up-quota-bars",children:[(rt=u.windows)==null?void 0:rt.map(pe=>d.jsx(xo,{label:pe.label,pct:pe.pct,reset:pe.reset??void 0,resetAt:pe.resetAt??void 0,windowSec:pe.windowSec??void 0,limitReached:u.limitReached&&pe.pct>=100,nowSec:g},pe.id)),(Ye=u.extraWindows)==null?void 0:Ye.map(pe=>d.jsx(xo,{label:pe.label,pct:pe.pct,reset:pe.reset??void 0,resetAt:pe.resetAt??void 0,windowSec:pe.windowSec??void 0,nowSec:g},pe.id)),u.creditLimit&&d.jsx(xo,{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 — ${Ut} 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:iq(u.reason)})]}):d.jsx("div",{className:"up-quota-na up-quota-loading",children:"Checking…"}),(h==null?void 0:h.ok)&&h.window7d&&h.window7d.sessionCount>0&&d.jsxs("div",{className:"up-quota-sub",title:`Counted from the rollout files under CODEX_HOME — no network, no account${h.window5h?`
|
|
75
|
-
last 5h: ${At(h.window5h.totalTokens)} tokens · ${h.window5h.sessionCount} session${h.window5h.sessionCount!==1?"s":""}`:""}`,children:[At(h.window7d.totalTokens)," tokens · ",h.window7d.sessionCount," session",h.window7d.sessionCount!==1?"s":""," (7d)"]})]}),B&&d.jsx("div",{className:"uh-range up-period",role:"toolbar","aria-orientation":"horizontal","aria-label":"Period","aria-busy":ne||void 0,onKeyDown:pe=>{var Ue;const we=$.current.indexOf(pe.target);if(we<0)return;const Pe=F4(pe.key,we);Pe!==null&&(pe.preventDefault(),(Ue=$.current[Pe])==null||Ue.focus())},children:od.map((pe,we)=>d.jsx("button",{type:"button",ref:Pe=>{$.current[we]=Pe},tabIndex:E===pe.key?0:-1,"aria-pressed":E===pe.key,"data-pending":E===pe.key&&ne?"":void 0,title:E===pe.key&&ne?`Reading ${pe.noun} from the transcripts on this machine…`:pe.hint,className:"uh-range-btn",onClick:()=>C(pe.key),children:pe.label},pe.key))}),B&&d.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:ne?`Reading ${Pk(E,E)}…`:""}),ie>0?d.jsxs(d.Fragment,{children:[U&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:`up-total${D}`,title:B?void 0:Mk,children:[d.jsx("span",{className:"up-total-value",children:Je(fe)}),d.jsx("span",{className:"up-total-label",children:B?te:T4})]}),Q.showCostBar&&d.jsx(Hw,{cost:N})]}),d.jsxs("div",{className:`up-tokens-row${D}`,title:B?void 0:Mk,children:[d.jsxs("span",{className:"up-tok",children:[d.jsx("span",{className:"up-k",children:"in"}),At(me)]}),d.jsxs("span",{className:"up-tok",children:[d.jsx("span",{className:"up-k",children:"out"}),At(ke)]}),Q.cacheReadTokens>0&&d.jsxs("span",{className:"up-tok",children:[d.jsx("span",{className:"up-k",children:"cache r"}),At(Ve)]}),Q.cacheCreateTokens>0&&d.jsxs("span",{className:"up-tok",children:[d.jsx("span",{className:"up-k",children:"cache c"}),At(Le)]}),!U&&d.jsx("span",{className:"up-tok up-scope",children:R4})]}),(B?J.length:De.length)>0&&d.jsxs("section",{className:`up-section${D}`,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:B?J.map(pe=>d.jsxs("tr",{children:[d.jsx("td",{className:"up-model-name",title:pe.model,children:Ds(pe.model)}),d.jsx("td",{className:"up-num",children:At(pe.tokens)}),pe.cost>0?d.jsx("td",{className:"up-num up-cost-val",children:Je(pe.cost)}):d.jsx("td",{className:"up-num up-unpriced",children:Pa})]},pe.model)):De.map(pe=>d.jsxs("tr",{children:[d.jsx("td",{className:"up-model-name",title:pe.model===gf?"no model reported yet":pe.model,children:pe.model===gf?"unknown":Ds(pe.model)}),d.jsx("td",{className:"up-num",children:At(pe.inputTokens+pe.outputTokens)}),pe.priced?d.jsx("td",{className:"up-num up-cost-val",children:Je(pe.cost.total)}):d.jsx("td",{className:"up-num up-unpriced",children:Pa})]},pe.model))})]})]}),B&&P.length===0&&K.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 ",te," yet — ccusage dates sessions in UTC, and the totals above are your local day."]})]}),(B?P.length:Ne.length)>0&&(()=>{const pe=B?P.length:Ne.length;return d.jsxs("section",{className:`up-section${D}`,children:[d.jsx("h3",{className:"up-section-title",children:d.jsxs("button",{type:"button",className:"up-disclose","aria-expanded":j,"aria-controls":"up-sessions",title:j?"Hide the per-session breakdown":`Show the per-session breakdown — ${pe} session${pe===1?"":"s"}`,onClick:()=>M(we=>!we),children:["By session",B&&d.jsxs("span",{className:"up-section-age",title:`Sessions with activity ${te}, 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 ",te]}),d.jsx("svg",{className:"up-chev",width:"9",height:"9",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:d.jsx("path",{d:"M2.2 3.6 5 6.4 7.8 3.6"})})]})}),d.jsxs("div",{className:"up-sessions",id:"up-sessions",hidden:!j,children:[B&&P.map(we=>{const Pe=W.get(we.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:Wu(Pe)})]}):d.jsx("span",{className:"sl-dot up-dot-past","aria-hidden":!0}),d.jsx("span",{className:`up-session-label${we.label?"":" up-session-id"}`,title:we.label?`${we.label}
|
|
77
|
-
${we.sessionId}`:we.sessionId,children:we.label??we.sessionId.slice(0,8)}),d.jsx("span",{className:"up-session-tokens",children:At(we.tokens)}),we.cost>0?d.jsx("span",{className:"up-session-cost",title:we.models.join(", ")||void 0,children:Je(we.cost)}):d.jsx("span",{className:"up-session-cost up-unpriced",children:Pa})]},we.sessionId)}),!B&&Ne.map(we=>d.jsxs("div",{className:"up-session-row",children:[d.jsx("span",{className:`sl-dot state-${we.state}`,"aria-hidden":!0}),d.jsx("span",{className:"vis-hidden",children:Wu(we.state)}),d.jsx("span",{className:"up-session-label",children:we.label}),d.jsx("span",{className:"up-session-tokens",children:At(we.inputTokens+we.outputTokens)}),we.cost>0?d.jsxs("span",{className:"up-session-cost",title:we.unpricedTokens>0?`${At(we.unpricedTokens)} tokens in this session are on an unpriced model, so this is a floor`:void 0,children:[Je(we.cost),we.unpricedTokens>0?"+":""]}):d.jsx("span",{className:"up-session-cost up-unpriced",children:Pa})]},we.sessionId))]})]})})(),Ge&&d.jsxs("div",{className:"up-hint",children:["“",Pa,"” 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:B?d.jsxs(d.Fragment,{children:["No usage ",te,".",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 Yt={l:30,r:6,t:6,b:2},Is={l:0,r:0,t:2,b:1},ad=104,hq=64;function lr(e,t=100,n=ad,s=Yt){const a=n-s.t-s.b;return s.t+a*(1-Math.max(0,Math.min(t,e))/t)}function VT(e,t,n,s=100,a=ad,i=Yt){if(!e.length)return"";const l=e[e.length-1].t-e[0].t,u=h=>{const g=t-i.l-i.r;return i.l+(l>0?g*(h-e[0].t)/l:g/2)};let f="",p=null;for(const h of e){const g=p&&h.t-p.t<=n*2?"L":"M";f+=`${g}${u(h.t).toFixed(1)} ${lr(h.v,s,a,i).toFixed(1)}`,p=h}return f}function YT(e,t,n,s=100,a=ad,i=Yt){if(e.length<2)return"";const l=a-i.b,u=e[e.length-1].t-e[0].t,f=t-i.l-i.r,p=w=>i.l+(u>0?f*(w-e[0].t)/u:f/2);let h="",g=[];const v=()=>{if(g.length>=2){let w=`M${p(g[0].t).toFixed(1)} ${l}`;for(const N of g)w+=`L${p(N.t).toFixed(1)} ${lr(N.v,s,a,i).toFixed(1)}`;h+=`${w}L${p(g[g.length-1].t).toFixed(1)} ${l}Z`}g=[]};for(const w of e)g.length&&w.t-g[g.length-1].t>n*2&&v(),g.push(w);return v(),h}function fq(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 KT(e,t,n){return n!=null&&e>=n?"hot":t!=null&&e>=t?"warn":""}function pq(e,t,n=s=>ml(s)){const s=e.filter(l=>l.v>0);if(!e.length)return null;if(!s.length)return"never held back";const a=s.length*(t/6e4),i=s[s.length-1];return`held back for ${a===1?"1 minute":`${a} minutes`}, last at ${n(i.t)}`}function ml(e){const t=new Date(e);return`${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}`}function Gw(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),a=n%60;return a?`${s}h ${a}m`:`${s}h`}function mq({group:e,title:t,onClose:n}){const s=Rn(n),[a,i]=b.useState(null);b.useEffect(()=>{let p=!0;const h=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)&&i(w)}catch{}};h();const g=window.setInterval(h,2e4);return()=>{p=!1,window.clearInterval(g)}},[e]);const l=(a==null?void 0:a.series)??[],[u,f]=b.useMemo(()=>{let p=1/0,h=0;for(const g of l)g.points.length&&(p=Math.min(p,g.points[0].t),h=Math.max(h,g.points[g.points.length-1].t));return[Number.isFinite(p)?Math.max(p,(a==null?void 0:a.sinceMs)??0):(a==null?void 0:a.sinceMs)??0,h]},[l,a==null?void 0:a.sinceMs]);return Ew.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}),a&&u>0&&d.jsxs("span",{className:"hist-since",children:["since ",ml(u)," · ",Gw(u,f||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:a==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(gq,{series:p,stepMs:a.stepMs},p.label))})]})}),document.body)}function gq({series:e,stepMs:t}){const n=b.useRef(null),[s,a]=b.useState(560),[i,l]=b.useState(null);b.useEffect(()=>{const O=n.current;if(!O||typeof ResizeObserver>"u")return;const z=new ResizeObserver(([I])=>a(Math.max(160,I.contentRect.width)));return z.observe(O),()=>z.disconnect()},[]);const{points:u,unit:f,warnAt:p,critAt:h,label:g,top:v,restsAtZero:w}=e,N=w?hq:ad,{now:k,peak:S}=fq(u),_=f==="C"?"°C":f,E=g==="Throttling"?pq(u,t):null,C=i!=null?u[i]:null,j=u.length>1?u[u.length-1].t-u[0].t:0,M=O=>{const z=s-Yt.l-Yt.r;return Yt.l+(j>0?z*(O-u[0].t)/j:z/2)},$=O=>{if(u.length<2)return;const z=O.currentTarget.getBoundingClientRect(),I=(O.clientX-z.left-Yt.l)/Math.max(1,z.width-Yt.l-Yt.r),A=u[0].t+j*Math.max(0,Math.min(1,I));let q=0;for(let V=1;V<u.length;V++)Math.abs(u[V].t-A)<Math.abs(u[q].t-A)&&(q=V);l(q)};return d.jsxs("section",{className:"hist-series","aria-label":`${g} history`,children:[d.jsxs("div",{className:"hist-head",children:[d.jsx("span",{className:"hist-label",children:g}),d.jsxs("span",{className:"hist-stats",children:[k!=null&&d.jsxs(d.Fragment,{children:[d.jsx("b",{children:k}),d.jsxs("span",{children:[_," now"]})]}),S!=null&&d.jsxs(d.Fragment,{children:[d.jsx("b",{className:KT(S,p,h),children:S}),d.jsxs("span",{children:[_," peak"]})]})]})]}),d.jsx("div",{className:"hist-plot",ref:n,children:d.jsxs("svg",{className:"hist-chart",width:"100%",height:N,viewBox:`0 0 ${s} ${N}`,preserveAspectRatio:"none",role:"img","aria-label":k==null?`${g}: nothing measured yet`:`${g}: ${k}${_} now, peak ${S}${_}, over ${Gw(u[0].t,u[u.length-1].t)}`,onPointerMove:$,onPointerLeave:()=>l(null),children:[[["warn",p],["hot",h]].map(([O,z])=>z==null||z>v?null:d.jsxs("g",{children:[d.jsx("line",{className:`hist-rule ${O}`,x1:Yt.l,x2:s-Yt.r,y1:lr(z,v,N),y2:lr(z,v,N)}),d.jsx("text",{className:`hist-rule-tag ${O}`,x:2,y:lr(z,v,N)+3,children:z})]},O)),d.jsx("line",{className:"hist-floor",x1:Yt.l,x2:s-Yt.r,y1:N-Yt.b,y2:N-Yt.b}),d.jsx("path",{className:"hist-area",d:YT(u,s,t,v,N)}),d.jsx("path",{className:"hist-line",d:VT(u,s,t,v,N)}),u.length===1&&d.jsx("circle",{className:"hist-dot",cx:M(u[0].t),cy:lr(u[0].v,v,N),r:3}),C&&d.jsxs("g",{children:[d.jsx("line",{className:"hist-cross",x1:M(C.t),x2:M(C.t),y1:Yt.t,y2:N-Yt.b}),d.jsx("circle",{className:"hist-dot",cx:M(C.t),cy:lr(C.v,v,N),r:3})]})]})}),d.jsx("div",{className:"hist-axis",children:C?d.jsxs("span",{className:"hist-at",children:[ml(C.t)," — ",d.jsx("b",{children:C.v}),_]}):d.jsxs(d.Fragment,{children:[d.jsx("span",{children:u.length?ml(u[0].t):""}),d.jsx("span",{children:u.length?ml(u[u.length-1].t):""})]})}),E&&d.jsx("div",{className:"hist-note",children:E})]})}const yq="thermal:Throttling";function vq(e){var n,s,a,i;const t={};e.cpu!=null&&(t["cpu:all"]=e.cpu),(n=e.perCore)!=null&&n.length&&(t["cpu:busiest"]=Math.max(...e.perCore)),e.memory&&(t["mem:physical"]=e.memory.usedPct),e.swap&&e.swap.total>0&&(t["mem:swap"]=Math.round(e.swap.used/e.swap.total*1e3)/10),(s=e.loadavg)!=null&&s.length&&(t["load:1m"]=e.loadavg[0]);for(const l of((a=e.thermal)==null?void 0:a.celsius)??[])t[`thermal:${l.label}`]=l.celsius;return(i=e.thermal)!=null&&i.throttle&&(t[yq]=Math.max(0,100-e.thermal.throttle.speedLimit)),t}function ju(e,t){return t==="C"?`${Math.round(e)}°`:t==="%"?`${Math.round(e)}%`:e.toFixed(2)}function fu(e,t){return Number.isInteger(e)?t==="C"?`${e}°`:t==="%"?`${e}%`:`${e}`:ju(e,t)}const Fk=["cores","memory","load","thermal"],bo=116,Cr=24,wq=60,xq=6e4;function bq(e){return e.points.length?e.restsAtZero?e.points.some(t=>t.v>0):!0:!1}function kq(e){return e.unit==="C"?`${e.label} temp`:e.key==="mem:physical"?"Physical RAM":e.key==="mem:swap"?`${e.label} memory`:e.label}function _q(e,t=wq){return e.points.length<=t?e:{...e,points:e.points.slice(-t)}}function Sq({sys:e}){const[t,n]=b.useState({});b.useEffect(()=>{let l=!0;const u=async()=>{const p=await Promise.all(Fk.map(async h=>{try{const g=await fetch(`/api/system/history?group=${h}`);return g.ok?[h,await g.json()]:[h,null]}catch{return[h,null]}}));l&&n(h=>{const g={...h};for(const[v,w]of p)w!=null&&w.ok&&(g[v]=w);return g})};u();const f=setInterval(()=>void u(),xq);return()=>{l=!1,clearInterval(f)}},[]);const s=b.useMemo(()=>vq(e),[e]),a=b.useMemo(()=>Fk.flatMap(l=>{const u=t[l];return u?u.series.filter(bq).map(f=>({series:_q(f),stepMs:u.stepMs})):[]}),[t]),i=b.useMemo(()=>{let l=1/0,u=-1/0;for(const{series:f}of a){const p=f.points;p.length&&(l=Math.min(l,p[0].t),u=Math.max(u,p[p.length-1].t))}return Number.isFinite(l)?Gw(l,u):"less than a minute"},[a]);return Object.keys(s).length?d.jsx("div",{className:"pl-strip",role:"group","aria-label":`This machine, over the last ${i}`,children:a.map(({series:l,stepMs:u})=>d.jsx(Nq,{series:l,stepMs:u,now:s[l.key],span:i},l.key))}):null}function Nq({series:e,stepMs:t,now:n,span:s}){var w;const{points:a,top:i,unit:l,warnAt:u,critAt:f}=e,p=kq(e),h=n??((w=a[a.length-1])==null?void 0:w.v),g=h==null?"":KT(h,u,f),v=Math.max(...a.map(N=>N.v));return d.jsxs("div",{className:`pl-cell${g?` ${g}`:""}`,title:[`${p} · peak ${ju(v,l)} over the last ${s}`,u!=null?`over ${fu(u,l)} is uncomfortable`:"",f!=null?`over ${fu(f,l)} the machine acts`:""].filter(Boolean).join(" · "),children:[d.jsxs("div",{className:"pl-cell-head",children:[d.jsx("span",{className:"pl-cell-label",children:p}),d.jsx("span",{className:"pl-cell-now",children:h==null?"—":ju(h,l)})]}),d.jsxs("svg",{className:"pl-spark",width:bo,height:Cr,viewBox:`0 0 ${bo} ${Cr}`,preserveAspectRatio:"none","aria-hidden":!0,children:[d.jsx("line",{className:"pl-spark-floor",x1:0,x2:bo,y1:Cr-Is.b,y2:Cr-Is.b}),d.jsx("path",{className:"pl-spark-area",d:YT(a,bo,t,i,Cr,Is)}),u!=null&&d.jsx("line",{className:"pl-rule warn",x1:0,x2:bo,y1:lr(u,i,Cr,Is),y2:lr(u,i,Cr,Is)}),f!=null&&d.jsx("line",{className:"pl-rule hot",x1:0,x2:bo,y1:lr(f,i,Cr,Is),y2:lr(f,i,Cr,Is)}),d.jsx("path",{className:"pl-spark-line",d:VT(a,bo,t,i,Cr,Is)})]}),d.jsxs("span",{className:"vis-hidden",children:["peak ",ju(v,l)," over the last ",s,u!=null&&`, uncomfortable over ${fu(u,l)}`,f!=null&&`, the machine acts over ${fu(f,l)}`]})]})}const Eq={key:"cpu",dir:"desc"};function Cq(e,t){return e.key===t?{...e,dir:e.dir==="asc"?"desc":"asc"}:{key:t,dir:t==="name"||t==="user"?"asc":"desc"}}function jq(e,t){const n=t.dir==="asc"?1:-1,s=i=>t.key==="cpu"?i.cpu:t.key==="mem"?i.mem:t.key==="rss"?i.rssBytes:t.key==="threads"?i.threads:i.uptimeSec,a=(i,l)=>{if(t.key==="name")return n*i.name.localeCompare(l.name,void 0,{sensitivity:"base"});if(t.key==="user"){const p=i.user??"",h=l.user??"";return!p||!h?p===h?0:p?-1:1:n*p.localeCompare(h,void 0,{sensitivity:"base"})}const u=s(i),f=s(l);return u==null||f==null?u==null?f==null?0:1:-1:n*(u-f)};return[...e].sort((i,l)=>a(i,l)||(l.cpu??-1)-(i.cpu??-1)||l.mem-i.mem||i.pid-l.pid)}function Tq(e,t){return e.key!==t?"none":e.dir==="asc"?"ascending":"descending"}const Rq=4e3;function Aq(){const[e,t]=b.useState(null);return b.useEffect(()=>{let n=!0;const s=async()=>{if(document.visibilityState!=="hidden")try{const i=await fetch("/api/system/processes?detail=1");if(!i.ok)return;const l=await i.json();n&&(l!=null&&l.ok)&&t({procs:l.procs??[],total:l.total??0})}catch{}};s();const a=window.setInterval(s,Rq);return()=>{n=!1,window.clearInterval(a)}},[]),e}function Mq(e){if(e==null||!Number.isFinite(e)||e<0)return"—";if(e<1024)return`${Math.round(e)} B`;const t=["KB","MB","GB","TB"];let n=e/1024,s=0;for(;n>=1024&&s<t.length-1;)n/=1024,s++;return`${n>=100?n.toFixed(0):n.toFixed(1)} ${t[s]}`}function Iq(e){return e==null||!Number.isFinite(e)||e<0?"—":e<60?`${Math.floor(e)}s`:e<3600?`${Math.floor(e/60)}m`:e<86400?`${Math.floor(e/3600)}h`:`${Math.floor(e/86400)}d`}function Oq({sys:e,onClose:t}){const n=Rn(t),[s,a]=b.useState(Eq),i=Aq(),l=i?jq(i.procs,s):null;return Ew.createPortal(d.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:d.jsxs("div",{ref:n,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"}),i&&d.jsxs("span",{className:"pl-count",children:[l.length," of ",i.total," running"]}),d.jsx("button",{type:"button",className:"glyph-btn",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),d.jsxs("div",{className:"pl-split",children:[d.jsx("div",{className:"pl-body",children:l==null?d.jsx("p",{className:"pl-empty",children:"Reading the process list…"}):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(Oa,{col:"cpu",label:"cpu",sort:s,onSort:a}),d.jsx(Oa,{col:"rss",label:"memory",note:"Resident set size, which is what ps and Task Manager report; macOS Activity Monitor shows a different figure.",sort:s,onSort:a}),d.jsx(Oa,{col:"threads",label:"threads",sort:s,onSort:a}),d.jsx(Oa,{col:"uptime",label:"up",sort:s,onSort:a}),d.jsx(Oa,{col:"user",label:"user",sort:s,onSort:a}),d.jsx("th",{scope:"col",className:"pl-pid-h",children:"pid"}),d.jsx(Oa,{col:"name",label:"process",note:"Command lines have anything secret-shaped removed, which is a filter and not a guarantee.",sort:s,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",title:`${u.mem.toFixed(1)}% of installed memory`,children:Mq(u.rssBytes)}),d.jsx("td",{className:"sd-num sd-dim",children:u.threads??"—"}),d.jsx("td",{className:"sd-num sd-dim",children:Iq(u.uptimeSec)}),d.jsx("td",{className:"sd-dim pl-user",children:u.user??"—"}),d.jsx("td",{className:"sd-num sd-dim pl-pid",children:u.pid}),d.jsxs("td",{className:"pl-name",children:[u.name,u.cmd&&d.jsxs("span",{className:"pl-cmd",title:u.cmd,children:[" ",u.cmd]})]})]},u.pid))})]})}),d.jsx(Sq,{sys:e})]})]})}),document.body)}function Oa({col:e,label:t,note:n,sort:s,onSort:a}){const i=Tq(s,e);return d.jsx("th",{scope:"col","aria-sort":i,children:d.jsxs("button",{type:"button",className:"sd-sort",title:n?`Sort by ${t}
|
|
78
|
-
|
|
79
|
-
${n}`:`Sort by ${t}`,onClick:()=>a(Cq(s,e)),children:[t,d.jsx("span",{className:"sd-sort-dir","aria-hidden":!0,children:i==="none"?"":i==="ascending"?"↑":"↓"})]})})}const $q=3e3;function Pq(e,t,n){return e>=n?"hot":e>=t?"warn":"calm"}function Lq(e,t,n=Date.now()){const s=Math.max(0,Math.min(100,100-e));return{pct:s,value:`${s}%`,tone:s===0?"calm":s>=30?"hot":"warn",note:s>0?`CPU held to ${e}% of full speed to cool down`:t?`at full speed · held to ${100-t.peak}% ${qq(t.lastMs,n)}`:"running at full speed, and never held back"}}function qq(e,t=Date.now()){const n=Math.max(0,Math.floor((t-e)/6e4));if(n<2)return"just now";if(n<60)return`${n} minutes ago`;const s=Math.floor(n/60);return s===1?"an hour ago":`${s} hours ago`}function al(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 Dq(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 Fq(){const[e,t]=b.useState(null),n=b.useRef(null);return b.useEffect(()=>{let s=!0;const a=async()=>{if(document.visibilityState!=="hidden")try{const f=await fetch("/api/system");if(!f.ok)return;const p=await f.json();s&&(p!=null&&p.ok)&&t(p)}catch{}},i=()=>{n.current==null&&(a(),n.current=window.setInterval(a,$q))},l=()=>{n.current!=null&&(window.clearInterval(n.current),n.current=null)},u=()=>{if(document.visibilityState==="hidden"){l();return}i(),a()};return i(),document.addEventListener("visibilitychange",u),()=>{s=!1,l(),document.removeEventListener("visibilitychange",u)}},[]),e}function zk({usageOpen:e,sub:t,onClose:n,children:s}){return d.jsxs("aside",{className:`sysdetail${e?" 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"}),t&&d.jsx("span",{className:"sd-sub",children:t}),d.jsx("button",{type:"button",className:"glyph-btn sd-close",onClick:n,"aria-label":"Close",title:"Close",children:"×"})]}),s]})}function zq({usageOpen:e,onClose:t}){const n=Fq();if(!n||n.cpu==null||!n.memory)return d.jsx(zk,{usageOpen:e,onClose:t,children:d.jsx("div",{className:"sd-note",children:"reading this machine…"})});const{memory:s,swap:a,perCore:i,loadavg:l,cores:u,uptimeSec:f,platform:p,thermal:h}=n,g=s?s.total-s.available:0,v=p==="win32"?"Commit":"Swap",w=a&&a.total>0?a.used/a.total*100:0;return d.jsxs(zk,{usageOpen:e,sub:`up ${Dq(f)} · ${u} cores`,onClose:t,children:[i&&i.length>0&&d.jsx("div",{className:"sd-section",role:"group","aria-label":"Cores",children:d.jsx(Tu,{group:"cores",title:"Core history",action:"Show core history",label:"Cores",children:d.jsx("div",{className:"sd-cores",style:{"--n":i.length},children:i.map((N,k)=>d.jsx("span",{className:"sd-core",title:`core ${k+1}: ${N}%`,children:d.jsx("span",{className:"sd-core-fill",style:{transform:`scaleY(${Math.max(2,N)/100})`}})},k))})})}),d.jsx("div",{className:"sd-section",role:"group","aria-label":"Memory",children:d.jsxs(Tu,{group:"memory",title:"Memory history",action:"Show memory history",label:"Memory",children:[s&&d.jsx(Hu,{label:"Physical",value:d.jsxs(d.Fragment,{children:[d.jsx("b",{children:al(g)})," of ",al(s.total)]}),pct:s.usedPct,tone:s.usedPct>=90?"warn":"calm",note:`${al(s.available)} available`}),a&&a.total>0&&d.jsx(Hu,{label:v,value:d.jsxs(d.Fragment,{children:[d.jsx("b",{children:al(a.used)})," of ",al(a.total)]}),pct:w,tone:w>=90?"warn":"calm",note:w>=50?"paging to disk":void 0})]})}),l&&d.jsx("div",{className:"sd-section",role:"group","aria-label":"Load average",children:d.jsxs(Tu,{group:"load",title:"Load history",action:"Show load history",label:"Load average",children:[d.jsx("div",{className:"sd-load",children:l.map((N,k)=>d.jsxs("span",{className:`sd-load-item${N>u?" over":""}`,children:[d.jsx("b",{children:N.toFixed(2)}),d.jsx("span",{children:["1m","5m","15m"][k]})]},k))}),d.jsx("div",{className:"sd-note",children:l[0]>u?`${(l[0]/u).toFixed(1)}× more work queued than cores to run it`:`within ${u} cores`})]})}),d.jsx(Bq,{thermal:h}),d.jsx(Uq,{sys:n})]})}function Tu({group:e,title:t,action:n,label:s,children:a}){const[i,l]=b.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:"›"})]}),a]}),i&&d.jsx(mq,{group:e,title:t,onClose:()=>l(!1)})]})}function Bq({thermal:e}){if(!e)return null;const t=e.throttle?Lq(e.throttle.speedLimit,e.heldBack):null;return d.jsx("div",{className:"sd-section",role:"group","aria-label":"Thermal",children:d.jsxs(Tu,{group:"thermal",title:"Thermal history",action:"Show thermal history",label:"Thermal",children:[e.celsius.map(n=>d.jsx(Hu,{label:n.label,value:d.jsxs(d.Fragment,{children:[d.jsx("b",{children:n.celsius})," °C"]}),pct:n.celsius,tone:Pq(n.celsius,n.warnAt,n.critAt)},n.label)),t&&d.jsx(Hu,{label:"Throttling",value:t.value,pct:t.pct,tone:t.tone,note:t.note})]})})}function Uq({sys:e}){const[t,n]=b.useState(!1);return d.jsxs("div",{className:"sd-section",children:[d.jsx("button",{type:"button",className:"sd-open sd-door",onClick:()=>n(!0),"aria-label":"Show every process the deck is watching",children:d.jsxs("span",{className:"sd-door-plate",children:[d.jsxs("span",{className:"sd-door-name",children:["Busiest processes",d.jsx("i",{className:"sd-row-more","aria-hidden":!0,children:"›"})]}),d.jsx("span",{className:"sd-door-sub",children:"every process, with its command line"})]})}),t&&d.jsx(Oq,{sys:e,onClose:()=>n(!1)})]})}function Hu({label:e,value:t,pct:n,tone:s="calm",note:a}){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})`}})}),a&&d.jsx("div",{className:"sd-note",children:a})]})}const Bk=18,Wq=1100,$a=(e,t)=>{const n=Math.sin(e*12.9898+t*78.233)*43758.5453;return n-Math.floor(n)},Hq=Array.from({length:Bk},(e,t)=>{const n=-72+144*t/(Bk-1)+($a(t,1)-.5)*9,s=(n-90)*(Math.PI/180),a=(54+32*Math.cos(n*Math.PI/180))*(.74+$a(t,2)*.52);return{dx:Math.cos(s)*a,dy:Math.sin(s)*a,rot:(t%2?1:-1)*(100+$a(t,3)*260),delay:Math.round($a(t,4)*90),dur:760+Math.round($a(t,5)*260),scale:.8+$a(t,6)*.45,hue:t%4,round:t%3===0}});function Uk({anchor:e}){var a;const[t,n]=b.useState(null),s=typeof window<"u"&&((a=window.matchMedia)==null?void 0:a.call(window,"(prefers-reduced-motion: reduce)").matches);return b.useEffect(()=>{if(s)return;const i=e.current;if(!i)return;const l=i.getBoundingClientRect();n({x:l.left+l.width/2,y:l.top+l.height/2});const u=window.setTimeout(()=>n(null),Wq);return()=>window.clearTimeout(u)},[e,s]),s||!t?null:Ew.createPortal(d.jsx("div",{className:"confetti",style:{left:`${t.x}px`,top:`${t.y}px`},"aria-hidden":!0,children:Hq.map((i,l)=>d.jsx("span",{className:`confetti-bit${i.round?" round":""}`,"data-hue":i.hue,style:{"--dx":`${i.dx.toFixed(1)}px`,"--dy":`${i.dy.toFixed(1)}px`,"--rot":`${i.rot}deg`,"--s":i.scale.toFixed(2),animationDelay:`${i.delay}ms`,animationDuration:`${i.dur}ms, ${i.dur}ms`}},l))}),document.body)}const XT=new Set(["awaiting_url","awaiting_code","registering"]);function Gq(e){return e!=null&&XT.has(e)}function QT(e){return e!=null&&e!=="done"&&!XT.has(e)}const Vq="the sign-in ended before it finished — the deck restarted, or it was cancelled in another tab",Yq="the sign-in did not complete";function Kq({state:e,serverError:t,localError:n}){const s=e==="idle";return{title:s?"Sign-in ended":"Sign-in failed",message:n||t||(s?Vq:Yq)}}const Xq="done";function Qq(){let e=!1;return{shouldAnnounce(t){return t!==Xq?(e=!1,!1):e?!1:(e=!0,!0)}}}function Vw(e,t){return t&&Object.hasOwn(e,t)?e[t]:void 0}const Zq={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 ${Ut}`,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"},Jq={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"},eD=`claude-swap could not read the login keychain — start ${Ut} from a Terminal window rather than a background service`;function uw(e,t){if((e==null?void 0:e.reason)!=="no_cswap"&&/keychain/i.test(Ya(e)))return eD;const n=Vw(Jq,e==null?void 0:e.reason);return n||(e==null?void 0:e.reason)||t}function Ya(e){return((e==null?void 0:e.output)||(e==null?void 0:e.detail)||(e==null?void 0:e.error)||"").trim()}const tD={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"},nD="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 rD(e){return/\bnpx\b/i.test(e)&&/(command not found|not found|not recognized|ENOENT)/i.test(e)}const sD="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",oD="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",aD=e=>/\b(?:ERR_)?MODULE_NOT_FOUND\b|cannot find (?:module|package)/i.test(e),iD=/node_modules[\\/]npm[\\/]bin[\\/]|\bnpm-prefix\.js\b|\bnp[mx][-.][\w.-]*cli\.js\b/i,lD=/[\\/]_npx[\\/]/i,cD=`the copy of ccusage ${Ut} installed for itself`;function uD(e){const t=String((e==null?void 0:e.install)??"").replace(/\s+/g," ").trim();return t.length>240?`${t.slice(0,239)}…`:t}function dD(e,t){const n=hD(e,t),s=uD(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 ${il(n)}`:`there is no managed copy of ccusage on this machine, and the npx fallback failed: ${il(n)}`;case"managed":return`${cD} failed to run: ${il(n)}`;case"path":return e.bin?`the ccusage this deck found at ${e.bin} failed to run: ${il(n)}`:`the ccusage this deck found on your PATH failed to run: ${il(n)}`;default:return n}}const il=e=>/^[A-Z][a-z]/.test(e)?e[0].toLowerCase()+e.slice(1):e;function hD(e,t){const n=Ya(e);if(aD(n)){if(lD.test(n))return oD;if(iD.test(n))return sD}if(rD(n))return nD;const s=Vw(tD,e==null?void 0:e.reason);return s||(e==null?void 0:e.reason)||t}function Da(e,t){if(e!=null&&e.detail)return e.detail;if(e!=null&&e.error&&QT(e.state))return e.error;const n=Vw(Zq,e==null?void 0:e.reason);return n||(e!=null&&e.error?e.error:(e==null?void 0:e.reason)||t)}function fD(e,t,n){if(n<=0||Bw(e))return{kind:"pass"};const s=t>=0&&t<n?t:-1;switch(e.key){case"ArrowRight":return{kind:"select",index:s===-1?0:(s+1)%n};case"ArrowLeft":return{kind:"select",index:s===-1?n-1:(s-1+n)%n};case"Home":return{kind:"select",index:0};case"End":return{kind:"select",index:n-1};default:return{kind:"pass"}}}function ZT(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 pD(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(),a=n.alias||s||`account ${n.num}`,i=[];return n.alias&&s&&i.push(s),s&&(t.get(s.toLowerCase())??0)>1&&i.push(n.org||`slot ${n.num}`),{num:n.num,label:a,sub:i.length?i.join(" · "):null}})}function mD(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 gD(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 yD(e){const t=e.length;if(!t)return"Nothing to import.";const n=p=>e.filter(h=>h.state===p).length,s=[],a=n("imported");a&&s.push(`${a} of ${t} imported`);const i=n("healed");i&&s.push(`${i} 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 f=n("failed");return f&&s.push(`${f} did not arrive`),`${s.join(", ")}.`}const vD=1500,pu=[{id:"login",label:"Sign in"},{id:"paste",label:"Paste a share"}],Wk="aa-panel",Hk=e=>`aa-tab-${e}`;async function ll(e){return(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json().catch(()=>null)}const dw=de.forwardRef((e,t)=>d.jsxs("svg",{className:"aa-mark",viewBox:"0 0 44 44","aria-hidden":!0,ref:t,children:[d.jsx("circle",{className:"aa-mark-ring",cx:"22",cy:"22",r:"20"}),d.jsx("path",{className:"aa-mark-tick",d:"M13.5 22.5 L19.5 28.5 L31 17"})]}));dw.displayName="SuccessMark";function wD({onClose:e,onChanged:t}){const[n,s]=b.useState("login"),[a,i]=b.useState(null),[l,u]=b.useState(""),[f,p]=b.useState(""),[h,g]=b.useState(!1),[v,w]=b.useState(null),[N,k]=b.useState(null),[S,_]=b.useState(null),[E,C]=b.useState(null),j=b.useRef(""),M=b.useRef(!1),$=b.useRef(!1),O=b.useRef(null),z=b.useRef(null),I=b.useRef(null),A=b.useRef(null),q=b.useRef([]),V=b.useRef(!1),Y=b.useCallback(()=>{M.current&&ll({action:"login-cancel"}).catch(()=>{}),e()},[e]),R=Rn(Y,{focusRef:I}),X=b.useCallback(async()=>{if(!qt($.current))return;$.current=!0,g(!0),w(null),M.current=!0;const L=await ll({action:"login"}).catch(()=>null);if($.current=!1,g(!1),!(L!=null&&L.ok)){w(Da(L,"could not start the sign-in"));return}i(L)},[]);b.useEffect(()=>{if(!Gq(a==null?void 0:a.state))return;const L=window.setInterval(async()=>{try{const Q=await fetch("/api/claude-accounts/login");Q.ok&&i(await Q.json())}catch{}},vD);return()=>window.clearInterval(L)},[a]);const B=b.useRef(t);B.current=t;const ne=b.useState(Qq)[0];b.useEffect(()=>{var L;(a==null?void 0:a.state)==="awaiting_code"&&((L=O.current)==null||L.focus()),ne.shouldAnnounce(a==null?void 0:a.state)&&B.current()},[a==null?void 0:a.state,ne]),b.useEffect(()=>{var L;n==="paste"&&!V.current&&((L=z.current)==null||L.focus()),V.current=!1},[n]);const Z=b.useCallback(L=>{var U;const Q=fD(L,pu.findIndex(ie=>ie.id===n),pu.length);Q.kind!=="pass"&&(L.preventDefault(),V.current=!0,s(pu[Q.index].id),(U=q.current[Q.index])==null||U.focus())},[n]),W=b.useCallback(async()=>{var Q;if(!qt($.current))return;$.current=!0,g(!0),w(null);const L=await ll({action:"login-code",code:l}).catch(()=>null);if($.current=!1,g(!1),!(L!=null&&L.ok)){w(Da(L,"the code was not accepted")),L!=null&&L.state&&i(L),(Q=O.current)==null||Q.select();return}u(""),i(L)},[l,a]),J=b.useCallback(async()=>{if(!qt($.current))return;$.current=!0,g(!0),w(null);const L=await ll({action:"import",blob:f}).catch(()=>null);if($.current=!1,g(!1),!(L!=null&&L.ok)){w(Da(L,"the import failed"));return}j.current=f,p(""),C(null),k(L.results??[]),t()},[f,t]),P=b.useCallback(async L=>{const Q=`${L.email}|${L.org??""}`;if(!qt($.current)||!j.current)return;$.current=!0,g(!0),_(Q),C(null);const U=await ll({action:"import",blob:j.current,force:!0,only:{email:L.email,org:L.org??""}}).catch(()=>null);if($.current=!1,g(!1),_(null),!(U!=null&&U.ok)){C({key:Q,text:Da(U,"that account could not be updated")});return}const ie=(U.results??[])[0];ie&&k(fe=>fe&&fe.map(me=>`${me.email}|${me.org??""}`===Q?ie:me)),t()},[t]),K=(a==null?void 0:a.state)==="done"?a.account:null,te=QT(a==null?void 0:a.state)||!!(v&&M.current&&!h),D=Kq({state:a==null?void 0:a.state,serverError:a==null?void 0:a.error,localError:v});return d.jsx("div",{className:"modal-backdrop",onClick:Y,role:"presentation",children:d.jsxs("div",{ref:R,className:"modal aa-modal",onClick:L=>L.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Add a Claude account",children:[d.jsxs("header",{className:"modal-head",children:[d.jsx("div",{className:"modal-title",children:d.jsx("span",{className:"aa-tabs",role:"tablist","aria-label":"How to add the account",onKeyDown:Z,children:pu.map((L,Q)=>d.jsx("button",{type:"button",role:"tab",id:Hk(L.id),ref:U=>{q.current[Q]=U},"aria-selected":n===L.id,"aria-controls":Wk,tabIndex:n===L.id?0:-1,className:`aa-tab${n===L.id?" on":""}`,onClick:()=>{V.current=!1,s(L.id)},children:L.label},L.id))})}),d.jsx("div",{className:"modal-actions",children:d.jsx("button",{type:"button",className:"glyph-btn",onClick:Y,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),d.jsx("section",{className:"modal-body aa-body",id:Wk,role:"tabpanel","aria-labelledby":Hk(n),children:n==="login"?K?d.jsxs("div",{className:"aa-done",children:[d.jsx(dw,{ref:A}),d.jsx(Uk,{anchor:A}),d.jsx("h4",{children:K.added?`Account ${K.num} added`:"Credentials refreshed"}),d.jsxs("p",{className:"aa-note",children:[d.jsx("strong",{children:K.email}),K.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"})]}):(a==null?void 0:a.state)==="awaiting_code"||(a==null?void 0:a.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:a.url??"#",target:"_blank",rel:"noreferrer noopener",children:a.url})]}),d.jsxs("div",{className:"aa-step",children:[d.jsx("h4",{children:"2 · Paste a code, if the page shows one"}),d.jsx("p",{className:"aa-note",children:"It usually finishes on its own — if the page says you are all set, there is nothing to do here."}),d.jsxs("div",{className:"aa-field",children:[d.jsx("input",{ref:O,type:"text",value:l,onChange:L=>u(L.target.value),onKeyDown:L=>{L.key==="Enter"&&l.trim()&&!h&&W()},placeholder:"paste the code here",spellCheck:!1,autoComplete:"off","aria-label":"Sign-in code",disabled:a.state==="registering"}),d.jsx("button",{type:"button",className:"btn primary",...Ct(h,!l.trim()||a.state==="registering"),onClick:W,children:a.state==="registering"?"registering…":"Continue"})]}),(v||a.error)&&d.jsx("p",{className:"aa-err",children:v??a.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."})]})]}):te?d.jsxs("div",{className:"aa-step",children:[d.jsx("h4",{children:D.title}),d.jsx("p",{className:"aa-err",children:D.message}),d.jsx("button",{type:"button",className:"btn",onClick:()=>{M.current=!1,i(null),w(null),X()},children:"Try again"})]}):h||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:I,className:"btn primary",onClick:X,children:"Open the sign-in page"})})]}):N?(()=>{const L=N.filter(Q=>Q.state==="imported").length;return d.jsxs("div",{className:"aa-done",children:[d.jsx(dw,{ref:A}),L>0&&d.jsx(Uk,{anchor:A}),d.jsx("h4",{children:yD(N)}),N.length>0&&d.jsx("ul",{className:"aa-results",children:N.map(Q=>{const U=`${Q.email}|${Q.org??""}`;return d.jsxs("li",{className:`aa-result ${Q.state}`,children:[d.jsx("span",{className:"aa-result-who",children:Q.email||(Q.num?`slot ${Q.num}`:"an account")}),d.jsx("span",{className:"aa-result-what",children:gD(Q.state)}),Q.state==="present"&&d.jsx("button",{type:"button",className:"aa-result-fix","aria-busy":S===U,title:`Overwrite the stored login for ${Q.email} with the one in this share. Do this when that account has stopped working here; if it works, leave it.`,onClick:()=>P(Q),children:S===U?"updating…":"update anyway"}),(E==null?void 0:E.key)===U&&d.jsx("span",{className:"aa-result-err",children:E.text})]},U)})}),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),k(null)},children:"Import another"})]})]})})():d.jsxs("div",{className:"aa-step",children:[d.jsx("h4",{children:"Paste an account shared from another deck"}),d.jsxs("div",{className:"aa-field",children:[d.jsx("input",{ref:z,type:"text",value:f,onChange:L=>p(L.target.value),onKeyDown:L=>{L.key==="Enter"&&f.trim()&&!h&&J()},placeholder:"ccdeck2:…",spellCheck:!1,autoComplete:"off","aria-label":"Shared account"}),d.jsx("button",{type:"button",className:"btn primary",...Ct(h,!f.trim()),onClick:J,children:h?"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 xD(e){return(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json().catch(()=>null)}const bD=1800;function kD({accounts:e,onClose:t,copyText:n}){const[s,a]=b.useState([]),[i,l]=b.useState(null),[u,f]=b.useState(!1),[p,h]=b.useState(null),[g,v]=b.useState(!1),[w,N]=b.useState(()=>Math.floor(Date.now()/1e3)),k=b.useRef(null),S=b.useRef(!1),_=Rn(t,{focusRef:k});b.useEffect(()=>{if(!i)return;N(Math.floor(Date.now()/1e3));const A=window.setInterval(()=>N(Math.floor(Date.now()/1e3)),1e3);return()=>window.clearInterval(A)},[i]);const E=pD(e),C=e.filter(A=>!s.includes(A.num)).map(A=>A.num),j=C.length===e.length,M=A=>a(q=>q.includes(A)?q.filter(V=>V!==A):[...q,A]),$=b.useCallback(async()=>{if(!qt(S.current)||!C.length)return;S.current=!0,f(!0),h(null),v(!1);const A=await xD({action:"share",accounts:C}).catch(()=>null);if(S.current=!1,f(!1),!(A!=null&&A.ok)){h(Da(A,"the share could not be made"));return}l({blob:A.blob,expiresAt:A.expiresAt,shared:A.shared??[],failed:A.failed??[]})},[e,C]),O=i?ZT(i.expiresAt,w):null,z=(O==null?void 0:O.tone)==="gone",I=(i==null?void 0:i.shared.length)??0;return d.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:d.jsxs("div",{ref:_,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:i?d.jsxs("div",{className:"sa-step",children:[d.jsx("h4",{children:z?"This share has expired":I===1?"1 account, ready to paste":`${I} accounts, ready to paste`}),d.jsx("code",{className:`ap-share-blob${z?" sa-dead":""}`,children:i.blob}),d.jsxs("div",{className:"ap-share-foot",children:[d.jsx("button",{type:"button",className:"ap-manage-btn",ref:k,onClick:async()=>{if(z){l(null),$();return}await n(i.blob)&&(v(!0),window.setTimeout(()=>v(!1),bD))},children:z?"make a new share":g?"copied":`copy ${I===1?"the share":"all "+I}`}),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:I===1?"this is the password":`this is ${I} passwords`})," · ",d.jsx("span",{className:`ap-share-expiry ${O==null?void 0:O.tone}`,children:O==null?void 0:O.text})]})]}),i.failed.length>0&&d.jsxs("div",{className:"sa-failed",role:"alert",children:[d.jsx("p",{className:"sa-failed-head",children:i.failed.length===1?"One account is not in this bundle:":`${i.failed.length} accounts are not in this bundle:`}),d.jsx("ul",{className:"sa-list",children:i.failed.map(A=>{var V;const q=!!(A.email&&((V=A.detail)!=null&&V.includes(A.email)));return d.jsxs("li",{children:[!q&&d.jsx("span",{className:"sa-who",children:A.email||`account ${A.num}`}),d.jsx("span",{className:"sa-why",children:A.detail||"could not be exported"})]},`${A.num}-${A.email}`)})})]}),d.jsx("p",{className:"sa-note",children:z?d.jsx(d.Fragment,{children:"Another deck will refuse this text now. Make a new one — the same accounts are still picked."}):d.jsxs(d.Fragment,{children:["Paste it into the other deck with ",d.jsx("strong",{children:"+"})," → ",d.jsx("strong",{children:"Paste a share"}),". Accounts it already holds are left exactly as they are."]})}),d.jsxs("div",{className:"sa-actions",children:[d.jsx("button",{type:"button",className:"btn",onClick:()=>{l(null),v(!1)},children:"Pick again"}),d.jsx("button",{type:"button",className:"btn primary",onClick:t,children:"Done"})]})]}):e.length===0?d.jsxs("div",{className:"sa-step",children:[d.jsx("h4",{children:"Nothing to share"}),d.jsxs("p",{className:"sa-note",children:["This deck is not holding any accounts right now. Sign one in with ",d.jsx("strong",{children:"+"}),", or wait — the panel is still reading the store."]}),d.jsx("div",{className:"sa-actions",children:d.jsx("button",{type:"button",className:"btn primary",ref:k,onClick:t,children:"Close"})})]}):d.jsxs("div",{className:"sa-step",children:[d.jsxs("h4",{children:["Which accounts go to the other ",Ut,"?"]}),d.jsx("p",{className:`sa-count${C.length?"":" empty"}`,children:mD(C.length)}),d.jsx("ul",{className:"sa-list sa-pick",children:E.map(A=>d.jsx("li",{children:d.jsxs("label",{className:"sa-row",children:[d.jsx("input",{type:"checkbox",checked:C.includes(A.num),onChange:()=>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:()=>a(j?e.map(A=>A.num):[]),children:j?"Clear all":"Select all"}),d.jsx("button",{type:"button",className:"btn primary",ref:k,...Ct(u,!C.length),onClick:$,children:u?"making the share…":C.length===0?"Share":C.length===1?"Share 1 account":`Share ${C.length} accounts`})]})]})})]})})}function _D(e,t){const n=new Set(e),s=e.length?Math.max(...e):0;return[...new Set([...e,s+1])].sort((a,i)=>a-i).map(a=>{const i=a===t?"here":n.has(a)?"swap":"free";return{slot:a,kind:i,label:i==="here"?`slot ${a}`:`slot ${a} · ${i}`}})}function SD(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 a=n.swapped===!0&&s!==t;return{menuFor:e.menuFor===t?s:a&&e.menuFor===s?t:e.menuFor,confirmRemove:null,shareFor:null,swapNote:a?{at:s,displaced:t}:null}}function ND(e,t,n){return t!=null&&e.some(s=>s.slot===t)?t:n}function ED(e,t,n){var a;const s=((a=e.find(i=>i.slot===t))==null?void 0:a.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 CD(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 Gk(e){return typeof e.id=="string"&&e.id.startsWith("scoped-")}function Vk(e){const t=e.filter(u=>!Gk(u)),n=e.filter(u=>Gk(u)),s=t.length?t:n,a=t.length?n:[],i=s.reduce((u,f)=>u&&u.pct>=f.pct?u:f,null);let l=null;for(const u of a)i&&u.pct<=i.pct||(!l||u.pct>l.pct)&&(l=u);return{shown:s,rest:a,fuller:l,peak:l??i}}function jD(e,t,n){return e<1?null:t?"fewer":n?`${n.label} ${Math.round(n.pct)}%`:`${e} more`}function TD(e,t,n,s){const a=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.`,i=n===1?"the other window":`the other ${n} windows`;return`${a} ${s?"Hide":"Show"} ${i}.`}const RD="\0";function Yw(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}${RD}${n}`}function AD(e,t){const n=Yw(t);return e.includes(n)?e.filter(s=>s!==n):[...e,n]}function MD(e,t){if(!Array.isArray(t))return e;const n=new Set(t.map(Yw)),s=e.filter(a=>n.has(a));return s.length===e.length?e:s}const ID=64;function OD(e,t){const n=e.trim();return{alias:n,commit:n!==(t??"").trim()}}const $D=Object.freeze({text:"couldn't reach the deck server",reload:!0});async function Yk(e){return e.ok?{ok:!0,status:e.status,body:null}:{ok:!1,status:e.status,body:await e.json().catch(()=>null)}}function PD(e){const t=e.find(s=>!s.ok);if(!t)return null;const n=Ya(t.body);return{text:uw(t.body,`the deck server answered ${t.status}`),...n?{raw:n}:{},reload:!0}}function Kk(e,t){return t?e!=null&&e.reload&&e.text===t.text&&e.raw===t.raw?e:t:e!=null&&e.reload?null:e}function Ru(e,t){if(e==null)return"not seen";const n=Math.max(0,Math.round((t-e)/1e3));if(n<90)return"now";const s=Math.round(n/60);if(s<60)return`${s}m ago`;const a=Math.round(s/60);return a<48?`${a}h ago`:`${Math.round(a/24)}d ago`}function LD(e,t){if(!e)return null;if(e.error)return{text:`could not reach it — ${e.error}`,tone:"bad"};const n=e.done??[];if(!n.length)return{text:`nothing to do · checked ${Ru(e.at,t)}`,tone:"idle"};const s=n.filter(i=>i.ok),a=s.length===1?"account":"accounts";return s.length===n.length?{text:`took ${s.length} ${a} · ${Ru(e.at,t)}`,tone:"ok"}:{text:`took ${s.length} of ${n.length} · ${Ru(e.at,t)}`,tone:"bad"}}function qD(e){const t=(e??"").trim(),n=t.lastIndexOf(":");if(n<=0||n===t.length-1)return null;const s=t.slice(0,n).trim(),a=Number(t.slice(n+1).trim());return!s||!Number.isInteger(a)||a<1||a>65535?null:{addr:s,port:a}}function mu(e,t){return t==null?`Could not ${e} — the deck did not answer.`:t.reason?`Could not ${e} — the deck refused it (${t.reason}).`:`Could not ${e}.`}function DD(e,t){if(e.length!==t.length)return!1;const n=new Set(e);return t.every(s=>n.has(s))}async function FD(e){return(await fetch("/api/prefs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json().catch(()=>null)}async function zD(e){var t;try{if(await Promise.race([((t=navigator.clipboard)==null?void 0:t.writeText(e).then(()=>!0))??Promise.resolve(!1),new Promise(s=>window.setTimeout(()=>s(!1),500))]))return!0}catch{}try{const n=document.createElement("textarea");n.value=e,n.setAttribute("readonly",""),n.style.cssText="position:fixed;top:0;left:0;opacity:0",document.body.appendChild(n),n.select();const s=document.execCommand("copy");return n.remove(),s}catch{return!1}}function BD({accounts:e,onChanged:t}){const[n,s]=b.useState(null),[a,i]=b.useState(!1),[l,u]=b.useState(null),[f,p]=b.useState(!1),[h,g]=b.useState(null),[v,w]=b.useState(""),[N,k]=b.useState([]),[S,_]=b.useState(!1),[E,C]=b.useState(!1),[j,M]=b.useState(null),[$,O]=b.useState(!1),z=b.useRef(!1),I=b.useRef(null),A=b.useRef(null),[q,V]=b.useState(()=>Date.now()),Y=b.useRef(!0),R=b.useCallback(async()=>{var te,D,L,Q;try{const[U,ie]=await Promise.all([fetch("/api/lan").then(fe=>fe.json()),fetch("/api/prefs").then(fe=>fe.json())]);if(!Y.current)return;U!=null&&U.ok&&(s(U),I.current&&DD(I.current,U.shared??[])&&(I.current=null)),ie!=null&&ie.ok&&(i(((D=(te=ie.prefs)==null?void 0:te.lan)==null?void 0:D.hasPassphrase)===!0),k(Array.isArray((Q=(L=ie.prefs)==null?void 0:L.lan)==null?void 0:Q.manual)?ie.prefs.lan.manual:[]))}catch{}},[]);b.useEffect(()=>{Y.current=!0,R();const te=window.setInterval(()=>{V(Date.now()),R()},5e3);return()=>{Y.current=!1,window.clearInterval(te)}},[R]);const X=b.useCallback((te,D)=>{const L=async()=>{var Q,U;z.current=!0,_(!0);try{const ie=await FD({lan:te});return ie!=null&&ie.ok?(i(((U=(Q=ie.prefs)==null?void 0:Q.lan)==null?void 0:U.hasPassphrase)===!0),M(null)):Y.current&&M(mu(D,ie)),await R(),ie}catch{return Y.current&&M(mu(D,null)),null}finally{z.current=!1,Y.current&&_(!1)}};return A.current=(A.current??Promise.resolve()).then(L,L),A.current},[R]),B=b.useCallback(async()=>{var te;if(qt(z.current)){z.current=!0,_(!0),C(!0);try{const L=await(await fetch("/api/lan/sync",{method:"POST"})).json().catch(()=>null);L!=null&&L.ok?(s(L),M(null)):Y.current&&M(mu("check the group",L)),(te=L==null?void 0:L.done)!=null&&te.length&&t()}catch{Y.current&&M(mu("check the group",null))}finally{z.current=!1,Y.current&&(_(!1),C(!1))}}},[t]),ne=b.useCallback(async()=>{if(qt(z.current)){p(!1),u("");try{const te=await fetch("/api/lan/passphrase").then(D=>D.json());Y.current&&(te!=null&&te.ok)&&te.passphrase&&u(D=>D===""?te.passphrase:D)}catch{}}},[]),Z=b.useCallback(()=>{const te=v.trim();if(!te)return;const D=qD(te);if(!D){M(`"${te}" is not an address and a port — try 192.168.1.5:54340.`);return}const L=`${D.addr}:${D.port}`;w(""),M(null),N.includes(L)||X({manual:[...N,L]},"add that address")},[v,N,X]),W=(n==null?void 0:n.enabled)===!0,J=I.current??(n==null?void 0:n.shared)??[],P=new Set(J),K=$||J.length>0;return d.jsxs("div",{className:"ap-auto ap-lan",children:[d.jsxs("div",{className:"ap-auto-head",children:[d.jsx("h3",{className:"ap-auto-title",children:"Local network"}),d.jsxs("button",{type:"button",className:`ap-auto-state${W?" live":""}`,role:"switch","aria-checked":W,"aria-label":"Local network sync",...Ct(S),onClick:()=>{qt(z.current)&&X({enabled:!W},W?"turn this off":"turn this on")},title:W?"Stop finding other decks and stop answering them":"Find other decks on this network that hold the same passphrase",children:[d.jsx("i",{className:W?"ap-pulse":"ap-dot","aria-hidden":!0}),W?"on":"off"]})]}),d.jsx("p",{className:"ap-auto-note",children:"Decks holding the same passphrase heal each other's dead logins. A login you share is a live one, and it cannot be taken back."}),j&&d.jsxs("div",{className:"ap-failure",role:"alert",children:[d.jsx("span",{className:"ap-failure-text",children:j}),d.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>M(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),W&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"ap-lan-row",children:[d.jsx("span",{className:"ap-lan-label",children:"appear as"}),d.jsx("input",{className:"ap-manage-input ap-lan-input","aria-label":"This deck's name on the network",value:h??(n==null?void 0:n.name)??"",placeholder:"this machine",onChange:te=>g(te.target.value),onKeyDown:te=>{te.key!=="Enter"||h==null||(X({name:h},"save the name"),g(null))}}),h!=null&&h!==((n==null?void 0:n.name)??"")&&d.jsx("button",{type:"button",className:"ap-manage-btn",...Ct(S),onClick:()=>{qt(z.current)&&(X({name:h},"save the name"),g(null))},title:"Save the name other decks see",children:"save"})]}),d.jsx("span",{className:"ap-lan-empty",children:"everyone on this network can see this name"}),d.jsxs("div",{className:"ap-lan-row",children:[d.jsx("span",{className:"ap-lan-label",children:"passphrase"}),l==null?d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"ap-lan-set",children:a?"set":"not set yet"}),d.jsx("button",{type:"button",className:"ap-manage-btn",...Ct(S),onClick:()=>void ne(),title:"Open the field with six words this deck generated, or type your own",children:a?"change":"set"})]}):d.jsx("input",{className:"ap-manage-input ap-lan-input",type:"text","aria-label":"Group passphrase",autoComplete:"off",spellCheck:!1,autoFocus:!0,value:l,placeholder:"the same words on every deck",onChange:te=>{u(te.target.value),p(!1)},onKeyDown:te=>{te.key!=="Enter"||!l||(X({passphrase:l},"save the passphrase"),u(null))}})]}),l!=null&&d.jsxs("div",{className:"ap-lan-acts",children:[d.jsx("button",{type:"button",className:"ap-manage-btn",...Ct(S||!l),onClick:async()=>{if(!qt(z.current))return;const te=await zD(l);Y.current&&(te?(p(!0),window.setTimeout(()=>p(!1),1800)):M("Could not reach the clipboard — select the words and copy them."))},title:"Copy it, so the other deck gets it character for character",children:f?"copied":"copy"}),d.jsx("button",{type:"button",className:"ap-manage-btn",...Ct(S||!l),onClick:()=>{qt(z.current)&&(X({passphrase:l},"save the passphrase"),u(null))},title:"Every deck in the group needs these exact words",children:"save"}),d.jsx("button",{type:"button",className:"ap-manage-btn",...Ct(S),onClick:()=>{u(null),p(!1)},children:"cancel"})]}),a&&d.jsxs(d.Fragment,{children:[d.jsx("h4",{className:"ap-lan-sub",children:"share these accounts"}),K?d.jsxs("div",{className:"ap-lan-picks",children:[e.length===0&&d.jsx("span",{className:"ap-lan-empty",children:"no accounts to share yet"}),e.map(te=>d.jsxs("label",{className:"ap-lan-pick",title:te.alive?"Offer this account to the group, so a deck whose copy has died can heal from yours":"This deck cannot use this login, so it has nothing to offer — a deck that can will heal it",children:[d.jsx("input",{type:"checkbox",checked:P.has(te.key),onChange:D=>{const L=new Set(I.current??(n==null?void 0:n.shared)??[]);D.target.checked?L.add(te.key):L.delete(te.key),I.current=[...L],X({shared:[...L]},D.target.checked?"share that account":"stop sharing that account")}}),d.jsx("span",{className:"ap-lan-pick-name",children:te.email}),!te.alive&&d.jsx("span",{className:"ap-lan-dead",children:"dead here"})]},te.key))]}):d.jsx("button",{type:"button",className:"ap-manage-btn ap-lan-open",...Ct(S),onClick:()=>O(!0),title:"Pick which logins this deck offers to the group. Each one you tick is a live login another machine keeps.",children:"choose accounts to share"}),d.jsxs("h4",{className:"ap-lan-sub",children:["in this group",d.jsx("button",{type:"button",className:"ap-manage-btn ap-lan-now",...Ct(S),onClick:()=>void B(),title:"Ask every deck in the group right now instead of waiting for the next minute",children:E?"checking…":"check now"})]}),d.jsxs("div",{className:"ap-lan-peers",children:[((n==null?void 0:n.peers)??[]).length===0&&d.jsxs("span",{className:"ap-lan-empty",children:["no other deck yet — check the passphrase matches, and that this machine's firewall lets ",(n==null?void 0:n.name)||"the deck"," use the network"]}),((n==null?void 0:n.peers)??[]).map(te=>{const D=LD(te.last,q);return d.jsxs("div",{className:"ap-lan-peer",children:[te.manual?d.jsxs("code",{className:"ap-lan-code",children:[te.addr,":",te.port]}):d.jsx("span",{className:"ap-lan-peer-name",children:te.name}),d.jsx("span",{className:"ap-lan-peer-when",children:te.manual?"by address":Ru(te.lastSeen,q)}),te.manual&&d.jsx("button",{type:"button",className:"ap-manage-btn ap-lan-drop",...Ct(S),onClick:()=>{qt(z.current)&&X({manual:N.filter(L=>L!==`${te.addr}:${te.port}`)},"stop dialling that address")},"aria-label":`Stop dialling ${te.addr}:${te.port}`,title:"Stop dialling this address",children:"remove"}),D&&d.jsx("span",{className:`ap-lan-peer-last${D.tone==="bad"?" ap-lan-bad":""}`,children:D.text})]},te.fp)})]}),d.jsxs("div",{className:"ap-lan-row",children:[d.jsx("span",{className:"ap-lan-label",children:"by address"}),d.jsx("input",{className:"ap-manage-input ap-lan-input","aria-label":"Another deck's address",value:v,placeholder:"192.168.1.5:54340",onChange:te=>w(te.target.value),onKeyDown:te=>{te.key==="Enter"&&Z()}}),v.trim()!==""&&d.jsx("button",{type:"button",className:"ap-manage-btn",...Ct(S),onClick:()=>{qt(z.current)&&Z()},title:"Dial this deck directly, for a machine broadcast cannot reach",children:"add"})]}),(n==null?void 0:n.port)!=null&&(n.addrs??[]).length>0&&d.jsxs("p",{className:"ap-auto-note ap-lan-addr",children:["Broadcast does not cross a router, so give the other deck whichever of these it can reach:"," ",(n.addrs??[]).map((te,D)=>d.jsxs("span",{children:[D>0&&" or ",d.jsxs("code",{className:"ap-lan-code",children:[te,":",n.port]})]},te))]})]})]})]})}const Xk=15e3,UD=8e3,yf=1800,WD=3e4,HD=[70,80,85,90,95];function Qk(e,t){return FT(t-Math.floor(e/1e3))}function GD(e,t){if(!e)return"";const n=Math.floor(e/1e3)-t;return n<=0?" · due":n<60?` · next in ${n}s`:` · next in ${Math.round(n/60)}m`}function 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 Zk({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)",a=e.resetAt?zT(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:a?`resets ${a}`:""})]})}async function Jk(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 YD({onClose:e}){var we,Pe,Ue,st,Oe;const[t,n]=b.useState(null),[s,a]=b.useState(null),[i,l]=b.useState(null),[u,f]=b.useState(!1),[p,h]=b.useState(null),[g,v]=b.useState(()=>Math.floor(Date.now()/1e3)),w=b.useRef(null),[N,k]=b.useState(null),[S,_]=b.useState(!1),[E,C]=b.useState(""),[j,M]=b.useState(null),[$,O]=b.useState(null),[z,I]=b.useState(null),[A,q]=b.useState(!1),[V,Y]=b.useState(!1),[R,X]=b.useState(null),[B,ne]=b.useState(null),[Z,W]=b.useState(null),[J,P]=b.useState(null),[K,te]=b.useState(!1),[D,L]=b.useState([]),Q=b.useRef(null),U=b.useCallback(oe=>UT(Q.current)?(Q.current=oe,l(oe),!0):!1,[]),ie=b.useCallback(()=>{Q.current=null,l(null)},[]),fe=(oe,Se=!1)=>{const qe=BT(i,oe);return{disabled:qe.disabled,"aria-busy":qe.busy||Se}},me=b.useCallback(oe=>{window.requestAnimationFrame(()=>{var Se;if(Q4(((Se=document.activeElement)==null?void 0:Se.tagName)??null))for(const qe of X4(oe)){const _e=document.querySelector(qe);if(_e){_e.focus();return}}})},[]),ke=b.useCallback(async(oe=!1)=>{oe&&f(!0);const Se=new AbortController,qe=window.setTimeout(()=>Se.abort(),WD);try{const[_e,Be]=await Promise.all([fetch(`/api/claude-accounts${oe?"?refresh=1":""}`,{signal:Se.signal}),fetch("/api/cswap-auto",{signal:Se.signal})]);if(_e.ok){const yt=await _e.json();n(yt),L(Re=>MD(Re,yt.accounts))}Be.ok&&a(await Be.json());const _t=PD([await Yk(_e),await Yk(Be)]);h(yt=>Kk(yt,_t))}catch{h(_e=>Kk(_e,$D))}finally{window.clearTimeout(qe),oe&&f(!1)}},[]),Ve=b.useCallback(async(oe,Se)=>{if(!U(Se))return null;h(null);try{const _e=await(await fetch("/api/cswap-auto",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(oe)})).json().catch(()=>null);return _e!=null&&_e.ok||h({text:uw(_e,"command failed"),raw:Ya(_e)}),_e}catch{return h({text:"server unreachable"}),null}finally{ie()}},[U,ie]),Le=b.useCallback(async(oe,Se)=>{if(!U(Se))return null;h(null);try{const _e=await(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(oe)})).json().catch(()=>null);return _e!=null&&_e.ok||h({text:Da(_e,"command failed")}),_e}catch{return h({text:"server unreachable"}),null}finally{ie()}},[U,ie]);b.useEffect(()=>(ke(!0),w.current=window.setInterval(()=>ke(!1),Xk),()=>{w.current!=null&&window.clearInterval(w.current)}),[ke]),b.useEffect(()=>{const oe=window.setInterval(()=>v(Math.floor(Date.now()/1e3)),3e4);return()=>window.clearInterval(oe)},[]);const De=((we=s==null?void 0:s.settings["autoswitch.threshold"])==null?void 0:we.value)??"90",Ne=J??De,Ge=CD(Ne,De),be=(Pe=t==null?void 0:t.accounts)==null?void 0:Pe.find(oe=>oe.active),se=((Ue=Vk((be==null?void 0:be.lanes)??[]).peak)==null?void 0:Ue.pct)??null,Qe=se!=null&&se>=Number(De)-15,ut=async oe=>{if(U(`switch-${oe}`)){h(null);try{const qe=await(await fetch("/api/claude-accounts/switch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({account:oe})})).json().catch(()=>null);qe!=null&&qe.ok||h({text:uw(qe,"the switch failed"),raw:Ya(qe)}),await ke(!0)}catch{h({text:"server unreachable"})}finally{ie(),me(oe)}}},lt=async(oe,Se)=>{const{commit:qe,alias:_e}=OD(E,Se);if(qe){const Be=await Le({action:"alias",account:oe,alias:_e},`alias-${oe}`);if(await ke(!0),!(Be!=null&&Be.ok))return;C(_e)}M(oe),window.setTimeout(()=>M(Be=>Be===oe?null:Be),yf)},rt=async(oe,Se)=>{const qe=await Le({action:"move",account:oe,slot:Se},`move-${oe}`),_e=SD({menuFor:N,shareFor:(z==null?void 0:z.num)??null},oe,qe);if(await ke(!0),_e){k(_e.menuFor),O(_e.confirmRemove),_e.shareFor==null&&(I(null),Y(!1)),X(_e.swapNote);const Be=_e.swapNote;Be&&window.setTimeout(()=>X(_t=>_t===Be?null:_t),UD),ne(null),me(_e.menuFor)}return qe},Ye=async(oe,Se,qe)=>{if(qe.sends){const _e=await rt(oe,Se);if(!(_e!=null&&_e.ok))return}W(oe),window.setTimeout(()=>W(_e=>_e===oe?null:_e),yf)},pe=async(oe,Se)=>{if(Se.sends){const qe=await Ve({action:"setting",key:"autoswitch.threshold",value:oe},"threshold");if(await ke(!0),!(qe!=null&&qe.ok))return;P(null)}te(!0),window.setTimeout(()=>te(!1),yf)};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:()=>_(!0),"aria-label":"Add an account",title:"Sign in to another Claude account, or paste one shared from another deck",children:"+"}),(((st=t==null?void 0:t.accounts)==null?void 0:st.length)??0)>0&&d.jsx("button",{type:"button",className:"glyph-btn ap-share-set",onClick:()=>q(!0),"aria-label":"Share accounts with another deck",title:`Copy several accounts to another ${Ut} 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),...fe("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 ",Xk/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:[d.jsx("ul",{className:"ap-list",children:(Oe=t.accounts)==null?void 0:Oe.map(oe=>{const{shown:Se,rest:qe,fuller:_e,peak:Be}=Vk(oe.lanes),_t=D.includes(Yw(oe)),yt=jD(qe.length,_t,_e);return d.jsxs("li",{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${N===oe.num?" on":""}`,"aria-label":`Manage account ${oe.num}`,"aria-expanded":N===oe.num,"aria-controls":N===oe.num?`ap-manage-${oe.num}`:void 0,title:"Share, rename, move, remove",onClick:()=>{k(N===oe.num?null:oe.num),C(oe.alias??""),O(null),I(null),Y(!1),X(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",...fe(`switch-${oe.num}`),onClick:()=>ut(oe.num),title:`Switch to ${oe.alias??oe.email}`,children:i===`switch-${oe.num}`?"…":"switch"})]}),d.jsx("div",{className:"ap-lanes",id:`ap-lanes-${oe.num}`,children:Se.length?d.jsxs(d.Fragment,{children:[Se.map(Re=>d.jsx(Zk,{lane:Re,nowSec:g},Re.id)),_t&&qe.map(Re=>d.jsx(Zk,{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",...fe("recapture"),onClick:async()=>{const Re=await Le({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:i==="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:()=>_(!0),title:"Open the sign-in dialog. Signing in as this account replaces its stored login in place.",children:"sign in again"})]})})(),yt&&d.jsx("button",{type:"button",className:"ap-lanes-more","aria-expanded":_t,"aria-controls":`ap-lanes-${oe.num}`,title:TD(oe.headroom,(Be==null?void 0:Be.label)??null,qe.length,_t),onClick:()=>L(Re=>AD(Re,oe)),children:yt}),(((s==null?void 0:s.enabled)||(s==null?void 0:s.external))&&!oe.active||oe.disabled)&&d.jsx("button",{type:"button",className:"ap-rotate",...fe(`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 ",Qk(oe.fetchedAt,g),GD(oe.nextAt,g)]}):d.jsx("span",{className:"ap-age ap-stale",title:"claude-swap has not read this account yet",children:"never collected"})]}),N===oe.num&&d.jsxs("div",{className:"ap-manage",id:`ap-manage-${oe.num}`,role:"group","aria-label":`Manage account ${oe.num}`,children:[d.jsxs("div",{className:"ap-manage-name",children:[d.jsx("label",{className:"vis-hidden",htmlFor:`ap-alias-${oe.num}`,children:"Alias"}),d.jsx("input",{id:`ap-alias-${oe.num}`,className:"ap-manage-input",type:"text",value:E,onChange:Re=>C(Re.target.value),onKeyDown:Re=>{Re.key==="Enter"&<(oe.num,oe.alias)},maxLength:ID,placeholder:"e.g. work",spellCheck:!1,autoFocus:!0}),d.jsx("button",{type:"button",className:"ap-manage-btn",...fe(`alias-${oe.num}`),onClick:()=>lt(oe.num,oe.alias),title:"A short name to show instead of the email",children:j===oe.num?"saved":"save"})]}),(()=>{const Re=_D((t.accounts??[]).map(wt=>wt.num),oe.num),at=ND(Re,B,oe.num),vt=ED(Re,at,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(at),...fe(`move-${oe.num}`),onChange:wt=>ne(Number(wt.target.value)),children:Re.map(wt=>d.jsx("option",{value:wt.slot,children:wt.label},wt.slot))})}),d.jsx("button",{type:"button",className:"ap-manage-btn",...fe(`move-${oe.num}`),title:vt.title,onClick:()=>Ye(oe.num,at,vt),children:Z===oe.num?vt.done:vt.label})]})})(),d.jsxs("div",{className:"ap-manage-acts",children:[d.jsx("button",{type:"button",className:"ap-manage-btn",...fe(`share-${oe.num}`),title:`Copy this account to another ${Ut}. Anyone who has the text can use the account — treat it as the password. The other deck stops accepting it after 10 minutes; that does not make an escaped copy safe.`,onClick:async()=>{Y(!1);const Re=await Le({action:"share",account:oe.num},`share-${oe.num}`);Re!=null&&Re.ok&&I({num:oe.num,blob:Re.blob,expiresAt:Re.expiresAt})},children:"share"}),d.jsx("button",{type:"button",className:`ap-manage-btn danger${$===oe.num?" armed":""}`,...fe(`rm-${oe.num}`),title:$===oe.num?"This deletes the stored credentials for this account":"Remove this account from claude-swap",onClick:()=>{if($!==oe.num){O(oe.num),window.setTimeout(()=>O(Re=>Re===oe.num?null:Re),4e3);return}O(null),Le({action:"remove",account:oe.num},`rm-${oe.num}`).then(()=>{k(null),ke(!0),me(null)})},children:$===oe.num?"confirm":"remove"})]}),(R==null?void 0:R.at)===oe.num&&(()=>{var vt;const Re=(vt=t.accounts)==null?void 0:vt.find(wt=>wt.num===R.displaced),at=(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: ${at} now holds slot ${R.displaced}.`,children:["swapped with slot ",R.displaced]})})(),(z==null?void 0:z.num)===oe.num&&(()=>{const Re=ZT(z.expiresAt,g),at=Re.tone==="gone";return d.jsxs("div",{className:`ap-share${at?" expired":""}`,children:[d.jsx("code",{className:"ap-share-blob",children:z.blob}),d.jsxs("div",{className:"ap-share-foot",children:[d.jsx("button",{type:"button",className:"ap-manage-btn",...fe(`share-${oe.num}`),onClick:async()=>{if(at){Y(!1);const vt=await Le({action:"share",account:oe.num},`share-${oe.num}`);vt!=null&&vt.ok&&I({num:oe.num,blob:vt.blob,expiresAt:vt.expiresAt});return}await Jk(z.blob)&&(Y(!0),window.setTimeout(()=>Y(!1),1800))},children:at?"make a new share":V?"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:[se!=null&&d.jsxs("span",{className:`ap-auto-now${Qe?" near":""}`,children:[Math.round(se),"%"]}),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,...fe("threshold"),onChange:oe=>P(oe.target.value),children:HD.map(oe=>d.jsxs("option",{value:oe,children:[oe,"%"]},oe))})}),d.jsx("button",{type:"button",className:"ap-manage-btn",...fe("threshold"),title:Ge.title,onClick:()=>pe(Ne,Ge),children:K?Ge.done:Ge.label}),d.jsxs("button",{type:"button",className:`ap-auto-state${s.enabled?" live":""}`,role:"switch","aria-checked":s.enabled,"aria-label":"Auto-switch",...fe("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 ",Qk(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:()=>h(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(BD,{accounts:((t==null?void 0:t.accounts)??[]).map(oe=>({key:`${String(oe.email??"").trim().toLowerCase()}@@${oe.orgUuid??""}`,email:oe.email??"",alive:oe.alive===!0})),onChanged:()=>ke(!0)})]}):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})`:"","."]})]})}),S&&d.jsx(wD,{onClose:()=>_(!1),onChanged:()=>ke(!0)}),A&&d.jsx(kD,{accounts:((t==null?void 0:t.accounts)??[]).map(oe=>({num:oe.num,email:oe.email,alias:oe.alias,org:oe.org})),onClose:()=>q(!1),copyText:Jk})]})}const KD=3e4;function XD({bundle:e,running:t,lastTried:n}){return!t||e===t?!1:n!==t}function QD({bundle:e,running:t,pending:n,lastTried:s}){return t?XD({bundle:e,running:t,lastTried:s})?"reload":n==null||n&&n!==t?"wait":"confirm":"wait"}function ZD(e){return!e||e.state!=="failed"?null:`${typeof e.at=="number"?e.at:0}:${e.error??""}`}function JD({asked:e,reported:t}){return t?t!==e:!1}function JT(e){const t=e.thresholdMs??KD;return!e.enabled||e.kind!=="restart"||!e.canRestart||!e.noticeOpen||!e.visible||e.busy?null:e.idleSince==null||e.now<e.idleSince?t:Math.max(0,t-(e.now-e.idleSince))}function e5(e){const t=Math.max(0,Math.ceil(e/1e3));return t<60?`${t}s`:`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`}function t5(e,t){return e?t==null?"auto when idle":`auto in ${e5(t)}`:"auto-restart off"}function e1(e){let t=0;for(const n of e)n.state==="active"&&t++;return t}function n5(e){return e<=0?{label:"Restart now",clause:"nothing is running"}:{label:"Restart anyway",clause:`${e===1?"1 agent is running":`${e} agents are running`} — their events during the restart are lost`}}function r5(e){const t=JT(e);return t==null?{idleSince:null,restart:!1,remainingMs:null}:e.idleSince==null||e.now<e.idleSince?{idleSince:e.now,restart:!1,remainingMs:t}:{idleSince:e.idleSince,restart:t===0,remainingMs:t}}async function eR(e,t=500){var s;if(!e)return!1;let n=!1;try{n=await Promise.race([((s=navigator.clipboard)==null?void 0:s.writeText(e).then(()=>!0))??Promise.resolve(!1),new Promise(a=>window.setTimeout(()=>a(!1),t))])}catch{n=!1}if(n)return!0;try{const a=document.createElement("textarea");a.value=e,a.setAttribute("readonly",""),a.style.cssText="position:fixed;top:0;left:0;opacity:0",document.body.appendChild(a),a.select(),n=document.execCommand("copy"),a.remove()}catch{n=!1}return n}function s5(e,t){return e==="confirmation"?t.confirmOpen?"clear":"ignore":t.modalOpen||t.confirmOpen?"ignore":"confirm"}function o5(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 a5(e){return e<=0?null:e===1?"the one agent":`all ${e} agents`}function i5(e,t){const n=a5(e),s=n?`removes ${n} on the canvas`:null,a=u=>`This ${s?`${s} and ${u}`:u}`;if(!t)return{note:`${a("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:`${a("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`,f=t.decks>2?`, one of ${t.decks} decks sharing it`:"";return{note:`${a(`leaves the event log alone: ${u}${f}`)}. 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:`${a("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 i=t.decks-1,l=i===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:`${a(`deletes the event log ${i===1?"1 other running deck shares":`${i} 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 l5({agentCount:e,onConfirm:t,onCancel:n}){const s=b.useRef(null),a=Rn(n,{focusRef:s,layer:d3}),[i,l]=b.useState(null);b.useEffect(()=>{let p=!1;return fetch("/api/clear").then(h=>h.ok?h.json():null).then(h=>{p||l(o5(h))}).catch(()=>{}),()=>{p=!0}},[]);const{note:u,confirm:f}=i5(e,i);return d.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:d.jsxs("div",{ref:a,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:f})]})]})]})})}const c5="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.",u5=[{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:"D",action:"detail panel",binds:["d","D"]},{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 d5({onClose:e}){const t=Rn(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:c5}),d.jsx("div",{className:"shortcuts",children:u5.map(n=>d.jsxs(b.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 h5=["done","needs-input"],f5=[{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}]}],p5=[{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}]}],Kw={done:f5,"needs-input":p5},Ka="two";function hw(e,t){const n=Kw[e];return n.find(s=>s.id===t)??n.find(s=>s.id===Ka)??n[0]}function tR(e,t){return Kw[e].some(s=>s.id===t)?t:Ka}hw("done",Ka).notes,hw("needs-input",Ka).notes;const t1=.04,m5=.24,Au=0,Gu=100,fw=5,Nl=50;function El(e){if(!Number.isFinite(e))return Nl;const t=Math.round(e/fw)*fw;return Math.min(Gu,Math.max(Au,t))}function g5(e){if(e==null)return Nl;const t=e.trim();return/^-?\d+(\.\d+)?$/.test(t)?El(Number(t)):Nl}function y5(e){const t=El(e),n=t1+(m5-t1)*(t/Gu);return Math.round(n*1e4)/1e4}function v5(e,t){const n=t.trim,s=typeof n=="number"&&Number.isFinite(n)&&n>0&&n<=1?n:1;return Math.round(y5(e)*s*1e4)/1e4}const w5=160,x5="agent-dag.soundLevel.done",b5="agent-dag.soundLevel.needs-input",k5="agent-dag.soundFigure.done",_5="agent-dag.soundFigure.needs-input",nR={done:x5,"needs-input":b5},rR={done:k5,"needs-input":_5},pw={done:{level:Nl,figure:Ka},"needs-input":{level:Nl,figure:Ka}};function S5(e){const t=n=>({level:g5(e(nR[n])),figure:tR(n,e(rR[n]))});return{done:t("done"),"needs-input":t("needs-input")}}const N5={Stop:"done",Notification:"needs-input"};function E5(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:N5[n]??null}function C5(e={enabled:()=>!0}){const t=e.ctor??(typeof window<"u"?window.AudioContext??window.webkitAudioContext??null:null);let n=null,s=!1;const a=()=>e.enabled()?s&&(n==null?void 0:n.state)==="running"?"ready":"locked":"off",i=()=>{var f;return(f=e.onState)==null?void 0:f.call(e,a())};function l(){var f;if(!(!t||s))try{n=n??new t,(f=n.resume)==null||f.call(n).then(i,()=>{}),s=!0,i()}catch{}}function u(f,p=!1){var N;if(!p&&!e.enabled()||!n||n.state!=="running")return!1;const h=(((N=e.prefs)==null?void 0:N.call(e))??pw)[f]??pw[f],g=hw(f,h.figure),v=v5(h.level,g),w=n.currentTime;for(const k of g.notes){const S=n.createOscillator(),_=n.createGain();S.type=g.type??"sine",S.frequency.value=k.hz;const E=w+k.at,C=E+k.ms/1e3;_.gain.setValueAtTime(1e-4,E),_.gain.exponentialRampToValueAtTime(v,E+.012),_.gain.exponentialRampToValueAtTime(1e-4,C),S.connect(_).connect(n.destination),S.start(E),S.stop(C+.02)}return!0}return{unlock:l,play:u,state:a,get context(){return n}}}const j5="Notify me when a session needs my attention.",T5="Held off for this run — the deck was started with alerts disabled. Your choice is saved for the next start.",n1="Get notified when you're away from this tab.";function R5(e){switch(e){case"granted":return{status:"Enabled",ask:!1,ok:!0,note:n1};case"default":return{status:null,ask:!0,ok:!1,note:n1};case"denied":return{status:"Blocked",ask:!1,ok:!1,note:"Your browser is blocking them; only its own site settings can undo that. You'll still be told once this tab is closed."};default:return{status:"Unavailable",ask:!1,ok:!1,note:"This browser cannot show them. You'll still be told once this tab is closed."}}}const r1={done:"Turn finished","needs-input":"Claude is asking"},A5={done:"Plays when Claude or Codex finishes a turn.","needs-input":"Available in Claude Code only."};function M5({onClose:e,soundOn:t,onToggleSound:n,prefs:s,onLevel:a,onFigure:i,onPreview:l,openerRef:u,notifyOn:f,onToggleNotify:p,notifyVetoed:h,notifyPermission:g,onAskNotify:v}){const w=R5(g),N=f&&!h,k=Rn(e),S=b.useRef(e);return S.current=e,b.useEffect(()=>{const _=E=>{var j,M;const C=E.target;C&&((j=k.current)!=null&&j.contains(C)||(M=u.current)!=null&&M.contains(C)||S.current())};return window.addEventListener("pointerdown",_,!0),()=>window.removeEventListener("pointerdown",_,!0)},[k,u]),d.jsxs("div",{ref:k,id:"sound-menu",className:"sound-menu",role:"dialog","aria-label":"Sound settings",children:[d.jsxs("div",{className:"sm-switches",children:[d.jsxs("label",{className:"sm-switch",children:[d.jsx("span",{className:"sm-switch-label",id:"sm-sound-label",children:"Sounds"}),d.jsx("button",{type:"button",role:"switch","aria-checked":t,"aria-labelledby":"sm-sound-label",className:"sm-toggle",onClick:n,title:"A tone when a turn finishes, and when Claude asks for something",children:d.jsx("span",{className:"sm-toggle-knob"})})]}),d.jsxs("div",{className:"sm-setting",children:[d.jsxs("label",{className:"sm-switch",children:[d.jsx("span",{className:"sm-switch-label",id:"sm-notify-label",children:"Notifications"}),d.jsx("button",{type:"button",role:"switch","aria-checked":f,"aria-labelledby":"sm-notify-label",className:"sm-toggle",onClick:p,title:"A system notification when a session blocks on you",children:d.jsx("span",{className:"sm-toggle-knob"})})]}),d.jsx("p",{className:"sm-note",children:h?T5:j5})]})]}),N&&d.jsxs("section",{className:"sm-channel","aria-labelledby":"sm-channel-name",children:[d.jsxs("div",{className:"sm-channel-head",children:[d.jsx("h3",{className:"sm-channel-name",id:"sm-channel-name",children:"Browser notifications"}),w.ask?d.jsx("button",{type:"button",className:"btn sm-channel-action",onClick:v,children:"Enable"}):d.jsxs("span",{className:"sm-channel-state","data-ok":w.ok||void 0,children:[w.ok&&d.jsx("svg",{width:"9",height:"9",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:d.jsx("path",{d:"M1.5 5.2 3.9 7.6 8.5 2.4"})}),w.status]})]}),d.jsx("p",{className:"sm-note",children:w.note})]}),!t&&d.jsx("span",{id:"sm-preview-note",className:"vis-hidden",children:"Plays even when Sounds is off, so you can set a tone before turning sounds back on."}),d.jsx("div",{className:"sm-tones",children:h5.map(_=>{const E=s[_],C=`sm-level-${_}`,j=`sm-figure-${_}`;return d.jsxs("section",{className:"sm-tone","aria-labelledby":`sm-name-${_}`,children:[d.jsxs("div",{className:"sm-tone-head",children:[d.jsx("h3",{className:"sm-tone-name",id:`sm-name-${_}`,children:r1[_]}),d.jsxs("button",{type:"button",className:"btn sm-hear",onClick:()=>l(_),"aria-label":`Hear the ${r1[_].toLowerCase()} tone`,title:t?"Play this tone now, at what it is set to":"Plays even when Sounds is off","aria-describedby":t?void 0:"sm-preview-note",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:C,children:"Volume"}),d.jsx("input",{id:C,type:"range",min:Au,max:Gu,step:fw,value:E.level,onChange:M=>a(_,Number(M.target.value)),style:{"--sm-level":`${(E.level-Au)/(Gu-Au)*100}%`}}),d.jsxs("span",{className:"sm-read",children:[E.level,"%"]})]}),d.jsxs("div",{className:"sm-row",children:[d.jsx("label",{htmlFor:j,children:"Tone"}),d.jsx("select",{id:j,className:"sm-select",value:E.figure,onChange:M=>i(_,M.target.value),children:Kw[_].map(M=>d.jsx("option",{value:M.id,children:M.label},M.id))})]}),d.jsx("p",{className:"sm-note",children:A5[_]})]},_)})}),d.jsxs("p",{className:"sm-foot",children:[d.jsx("kbd",{children:"M"}),"Mute or unmute sounds anywhere."]})]})}const I5={"//":["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.15.0":[{title:"🔗 Decks on one network heal each other's dead logins",body:`A login dies on the machine that has not used it while the same account keeps working on the machine that has. The fix was a blob copied out of one deck and pasted into another. Now: **Accounts ▸ Local network**, the same passphrase on each deck — it offers you six words — and they find each other and repair themselves.
|
|
80
|
-
|
|
81
|
-
A deck only **adds** an account it does not have, or **replaces one it has proven dead** — proven by Anthropic refusing the token, not guessed. A credential that works is never touched. The passphrase is the only gate; a stranger on the same wifi sees that a deck exists and nothing else.`},{title:"⚠️ What sharing a login actually means",body:`**A login you share is a live one, and it cannot be taken back.** Turning the switch off stops what has not happened yet; a credential that has left your machine is gone, and the only real revocation is signing in again at Anthropic — which ends the session everywhere at once.
|
|
82
|
-
|
|
83
|
-
Sharing a Claude account may also be against Anthropic's terms. Your call; the deck says it once and does not nag.`}],"3.14.0":[{title:"📊 The machine comes back beside the list that covers it",body:`**Busiest processes** opens over the machine panel and hides the very readings that sent you looking. They are back beside the list — cores, memory, swap, queued work, temperature — with up to an hour behind each: a column down the side on a wide screen, a band under the table on a narrow one.
|
|
84
|
-
|
|
85
|
-
Each is drawn against the line it is measured to — memory and swap at 90%, load at your core count, the GPU at 75° and again at 90° — so swap sitting *on* its line is something you see rather than work out. The processor readings get no line on purpose: a CPU at 90% is your machine doing what you asked for. Throttling appears only once your machine has actually been held back, and the band says how much history it really has rather than claiming an hour it has not had.`},{title:"📋 The process dialog's footnote moved onto the columns it was about",body:"A band ran along the bottom of **Busiest processes** saying three things. Two were worth keeping and are now on the header of the column they describe — hover `memory` to read what that number measures, `process` to read that the command-line redaction is a filter rather than a promise.\n\nThe third said the list is the busiest by processor and memory, refreshed every four seconds. The heading, the count beside it and the moving numbers were already saying that."},{title:"📝 These notes render what they were written in",body:`Every note in this dialog is written in Markdown — **bold** for the sentence that carries the change, backticks for a flag or a path — and the dialog printed the string raw. So the first window you see after an upgrade has been showing you \`**this**\`, backticks and all, since the feature shipped: 25 of 52 notes, 52 bold spans, 54 code spans.
|
|
86
|
-
|
|
87
|
-
What you are reading is the first version that does not.
|
|
88
|
-
|
|
89
|
-
No Markdown library came along for it. Counted in the file: bold 52, code 54, links 0, headings 0, lists 0 — and the smallest library that reads all of Markdown is 40KB on a bundle the deck fetches while you wait for it to start.`},{title:"⎋ Esc leaves the machine panel where it is",body:"The × on **This machine** read `Close (Esc)`, so Escape put the panel away. Escape belongs to the canvas — it deselects and hands the keyboard back — and pressing it while you are reading your instruments should not close them.\n\nThe panel now closes the two ways it opens: its ×, and the meter in the topbar. The × says `Close`, and names no key it does not answer."},{title:"🖥 The machine moved out of the topbar and into a button",body:"The small CPU sparkline and memory bar in the topbar are gone. A chip glyph in the icon row beside `$` and the accounts silhouette opens the same **This machine** panel — cores, memory, swap, load, temperature, busiest processes — and the bar stops moving in the corner of your eye.\n\nIt also stops asking. The deck read your machine every three seconds for the life of every tab to feed that meter; it now reads only while the panel is open, and the history behind the readings is kept by the deck itself, so a panel opened an hour from now still has the hour behind it."},{title:"🔎 The panel's eight process rows became one way in",body:"The machine panel drew eight processes in a 280px box: three columns, names cut off mid-word, and a `ps` run every four seconds to keep them moving. **Busiest processes** is a single row you press now, and the dialog behind it is what it always was — every candidate the deck sees, its memory in bytes, threads, user, pid, and the command line that tells you which `node` this one is.\n\nWith that dialog closed, the deck reads no process list at all."},{title:"⏱ The restart banner says whether the press is safe, and shows the fuse",body:"The button read `Restart now` whether the machine was idle or five agents were mid-turn — and the events fired while the server is down are lost for good. It reads **`Restart anyway`** now when something is running, with the count beside it, and `Restart now` with *nothing is running* when the machine is quiet.\n\nThe automatic restart said only `auto when idle`, while a 30-second clock ran where nobody could see it. It counts — **`auto in 18s`** — which is also how you stop it, since the switch is the label. The amber dot pulses only while that clock runs.\n\nThe switch also says `auto-restart off` in words rather than in a colour, both its label and the button are readable in the light theme now, and a tab you are not looking at no longer restarts the deck under the tab you are."}],"3.13.0":[{title:"📊 Usage history stops jumping out from under you",body:`Pressing **H** put \`running ccusage…\` in a box 186px tall. Two to four seconds later the chart, the totals and the legend arrived and the box became 429px — and because the dialog is centred, that growth moved the whole thing **121px upward**, under the cursor that had just pressed something.
|
|
90
|
-
|
|
91
|
-
The chart's place is now reserved from the first frame: the 168px the chart is tall plus the 16px it keeps for its day labels, both taken from the chart's own rule so the placeholder and the thing it holds room for cannot drift apart. The jump goes from 243px to 156px. It deliberately stops there — the totals and the legend are content, the legend's height depends on how many models ran, and reserving those would have meant drawing four plausible empty cards for a reading that had not arrived.
|
|
92
|
-
|
|
93
|
-
What is drawn in the reserved space is **the chart's baseline and nothing else**: one line, in the same colour, at the height the columns will land on. Not a skeleton of grey bars — a skeleton stands in for content, an axis is furniture, and furniture is honest before the data exists. The light on it travels rather than fills, because the deck knows a subprocess is running and does not know how far through your transcripts it has got.
|
|
94
|
-
|
|
95
|
-
Then the days rise out of that line, **oldest first**. The stagger is divided rather than fixed — 200ms of spread whether the range is 7 days or 90 — so the longest range is not also the slowest to appear.
|
|
96
|
-
|
|
97
|
-
With reduced motion both loops and both entrances are off. The reserved space is layout, not animation, and stays outside that rule: asking for less movement gets you the same dialog that does not jump.`},{title:"⏳ The period mark says it is being read",body:"The first read of **today**, **month** or **all** takes two to three seconds — it walks the transcripts on this machine, and the cost is the walk, not the size of the range you asked for. Until now the panel said nothing for the whole of it, so pressing `month` looked like pressing nothing, and the honest response was to press it again.\n\nThe mark under the period now pulses while that read is in flight, and it **pulses rather than fills**: nothing measures how far through the transcripts ccusage has got, so a bar that filled would be inventing a number. Hovering the pending period says which one is being read, and screen readers are told the same thing through a live region rather than being left with a silent button."}],"3.12.0":[{title:"🔍 Busiest processes tells you which one",body:"The list could say what was eating the machine and not **which** of nine identical `Google Chrome Helper` rows was the headless Chrome you left running. It now shows the arguments after the name — `--type=renderer` beside one, `serve admin-portal --port 44440` beside a node — and four columns it did not have: **memory in MB and GB** instead of a percentage, **threads**, **how long it has been up**, and **user**. Every column sorts; press its heading.\n\n**Command lines have anything secret-shaped removed before they leave your machine** — the value of any flag whose name says token, password, key or secret, the password in a URL, and the shapes that identify themselves. It is a filter and not a guarantee: a secret that looks like an ordinary word looks like an ordinary word. The reading happens only while this modal is open, so a deck whose process list you never open never reads a command line at all.\n\n**Memory is resident set size** — what `ps` and Windows Task Manager report. On macOS this is *not* the number Activity Monitor shows in its Memory column; that one is the physical footprint, and on the machine this was built on the two disagree by up to fourteen times on the same process. No unprivileged command reports the footprint quickly, so the deck shows the figure that means the same thing on all three platforms and says which one it is.\n\n**There is no Ports column**, and the reason is the same kind of honesty: Mach ports do not exist on Linux, are not what Windows calls a handle, and on macOS the only way to count them takes four seconds — against a list that refreshes every four."},{title:"🔢 A token count that stays a whole number",body:"Switching the Usage panel from **month** to **today** counted down smoothly and then, for a fraction of a second, showed something like `in 594.3268260610639` where a token count belongs.\n\nThe count was never wrong; the printing was. The figures animate between two readings, so the formatter is handed a fraction on most of its frames — every size above a thousand was already rounded and the one below it was not."}],"3.11.0":[{title:"🗂 The session list waits to be asked for",body:`**BY SESSION in the Usage panel now starts collapsed.** It is the one block in that panel with no ceiling — every other section is two or three rows, or a model table bounded by the models that exist — and it was the reason the panel scrolled at all. Shut, the whole panel is one screen: quota, period, money, models. Press the heading to open it, and it stays open; ccdeck remembers your answer from then on.
|
|
98
|
-
|
|
99
|
-
The count of what is behind it is on the heading's tooltip, so collapsing it does not hide how much there is.
|
|
100
|
-
|
|
101
|
-
**Scrollbars are also gone until you point at the thing that scrolls.** Nothing moves when they appear — the track keeps its width in both states, so no text shifts under the pointer as it arrives.`},{title:"📊 today · month · all, as tabs that remember",body:"**The Usage panel's period switcher is a full-width row of tabs** rather than a pill floating over the column, with a thin cyan mark under the word it belongs to. It governs the figures beneath it, so it now looks like it does.\n\n**Your chosen period survives a reload.** It was the one preference in that panel that did not.\n\n**It costs one Tab stop instead of three.** Tab into the strip, then move with ←/→ or Home/End, and press Enter to choose. Arrowing past a period no longer starts reading it — moving and choosing are separate now, which matters on `all`.\n\nAnd **`month` says which month.** Hover it: this is the calendar month, from the 1st — not the last 30 days. `today` and `all` say what they cover too."},{title:"🔔 Sounds and Notifications are two switches, and Browser notifications is a channel",body:`**The sound menu has been rebuilt.** Sounds and Notifications are real switches now instead of words that read like status. Under them, **Browser notifications** is named as what it is — one of the two ways ccdeck can reach you — rather than sitting there as a third setting that seemed to contradict the one above it.
|
|
102
|
-
|
|
103
|
-
There are two notifiers and they never both fire: the page raises one when the deck is open but hidden, and the server raises one when no page is open at all. Only the first needs a browser permission, which is why the permission belongs to a channel and not to the feature. **Turning Notifications on now asks the browser on that same press** — no second control to hunt for.
|
|
104
|
-
|
|
105
|
-
\`M\` mutes and unmutes sounds from anywhere. **Hear it** plays the tone even when Sounds is off, so you can pick one before turning them back on.`},{title:"🧹 No agent, no empty panel",body:`**The detail panel no longer appears when nothing is selected.** It used to sit there empty, and a tab on the edge of the canvas existed to bring it back after you closed it — both are gone. Select an agent and the panel is there; press **D** to toggle it yourself.
|
|
106
|
-
|
|
107
|
-
The canvas is that much wider whenever you are not reading one agent.`}],"3.10.0":[{title:"🔌 Who else can drive your browser, and where to see it",body:"**Browser Watch has a Remote control section.** The Claude in Chrome extension holds a connection open to Anthropic's relay, and that connection is registered against your **account**, not against this machine — so any Claude Code session signed in to the same account, running anywhere, can enumerate and drive this browser, and nothing prompts you on the machine being driven.\n\nThe panel now says whether that is the case here, and what the extension is actually allowed to do in each profile — enabled or switched off, every site or only the ones it was granted, and which of the powerful APIs it holds. That last part is not what `chrome://extensions` shows you: the per-site list there is enforced by the extension, on itself, while the grant underneath stays exactly as wide as it was.\n\nIf you want it closed, the section hands you the one command that closes it — as text, to paste in your own terminal. **ccdeck never runs it and never asks for your password**, and it never will: no part of this deck elevates, and a dashboard that could raise a password box on request would be a gift to anything else running on the machine. If the block is already in place, the section offers the command that takes it back out. And if something else in your hosts file already points that name somewhere, it says so and leaves the line alone — ccdeck only removes the line ccdeck wrote.\n\nAll of this is two file reads and no network call. It was written some releases ago and, until now, was not connected to any screen.\n\n**Also:** the README said `share` produces a `ccdeck1:` blob. It produces `ccdeck2:` — `ccdeck1:` has been read-only legacy for a while."}],"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.
|
|
108
|
-
|
|
109
|
-
**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.
|
|
110
|
-
|
|
111
|
-
**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.
|
|
112
|
-
|
|
113
|
-
**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.
|
|
114
|
-
|
|
115
|
-
**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.
|
|
116
|
-
|
|
117
|
-
**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.
|
|
118
|
-
|
|
119
|
-
**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.
|
|
120
|
-
|
|
121
|
-
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.
|
|
122
|
-
|
|
123
|
-
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.
|
|
124
|
-
|
|
125
|
-
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.
|
|
126
|
-
|
|
127
|
-
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.
|
|
128
|
-
|
|
129
|
-
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.
|
|
130
|
-
|
|
131
|
-
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.
|
|
132
|
-
|
|
133
|
-
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.
|
|
134
|
-
|
|
135
|
-
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.
|
|
136
|
-
|
|
137
|
-
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.
|
|
138
|
-
|
|
139
|
-
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.
|
|
140
|
-
|
|
141
|
-
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.
|
|
142
|
-
|
|
143
|
-
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.
|
|
144
|
-
|
|
145
|
-
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.
|
|
146
|
-
|
|
147
|
-
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.
|
|
148
|
-
|
|
149
|
-
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.
|
|
150
|
-
|
|
151
|
-
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.
|
|
152
|
-
|
|
153
|
-
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.
|
|
154
|
-
|
|
155
|
-
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.
|
|
156
|
-
|
|
157
|
-
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.
|
|
158
|
-
|
|
159
|
-
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.
|
|
160
|
-
|
|
161
|
-
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.
|
|
162
|
-
|
|
163
|
-
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.
|
|
164
|
-
|
|
165
|
-
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.
|
|
166
|
-
|
|
167
|
-
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.
|
|
168
|
-
|
|
169
|
-
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.
|
|
170
|
-
|
|
171
|
-
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.
|
|
172
|
-
|
|
173
|
-
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.
|
|
174
|
-
|
|
175
|
-
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.
|
|
176
|
-
|
|
177
|
-
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.
|
|
178
|
-
|
|
179
|
-
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.
|
|
180
|
-
|
|
181
|
-
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.
|
|
182
|
-
|
|
183
|
-
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.
|
|
184
|
-
|
|
185
|
-
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.
|
|
186
|
-
|
|
187
|
-
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.
|
|
188
|
-
|
|
189
|
-
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.
|
|
190
|
-
|
|
191
|
-
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.
|
|
192
|
-
|
|
193
|
-
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.
|
|
194
|
-
|
|
195
|
-
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.
|
|
196
|
-
|
|
197
|
-
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.
|
|
198
|
-
|
|
199
|
-
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".
|
|
200
|
-
|
|
201
|
-
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.
|
|
202
|
-
|
|
203
|
-
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.
|
|
204
|
-
|
|
205
|
-
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.
|
|
206
|
-
|
|
207
|
-
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.
|
|
208
|
-
|
|
209
|
-
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.
|
|
210
|
-
|
|
211
|
-
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.
|
|
212
|
-
|
|
213
|
-
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.
|
|
214
|
-
|
|
215
|
-
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.
|
|
216
|
-
|
|
217
|
-
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.
|
|
218
|
-
|
|
219
|
-
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.
|
|
220
|
-
|
|
221
|
-
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.
|
|
222
|
-
|
|
223
|
-
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.
|
|
224
|
-
|
|
225
|
-
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.
|
|
226
|
-
|
|
227
|
-
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.
|
|
228
|
-
|
|
229
|
-
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.
|
|
230
|
-
|
|
231
|
-
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.
|
|
232
|
-
|
|
233
|
-
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.
|
|
234
|
-
|
|
235
|
-
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."}]},Xw="agent-dag.releaseNotesSeen";function s1(e){return e.split(/[.\-+]/).map(t=>parseInt(t,10)).map(t=>Number.isNaN(t)?0:t)}function Xa(e,t){const n=s1(e),s=s1(t);for(let a=0;a<Math.max(n.length,s.length);a++){const i=(n[a]??0)-(s[a]??0);if(i!==0)return i<0?-1:1}return 0}function Qa(e){return typeof e=="string"&&/^\d+\.\d+\.\d+/.test(e)}function O5(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 $5(e){if(!e||typeof e!="object")return[];const t=[];for(const[n,s]of Object.entries(e)){if(!Qa(n)||!Array.isArray(s))continue;const a=s.filter(O5);a.length&&t.push({version:n,notes:a})}return t.sort((n,s)=>Xa(s.version,n.version))}const o1=$5(I5);function sR(e,t,n){return e.filter(s=>Xa(s.version,n)<=0&&(t===null||Xa(s.version,t)>0))}function P5(e,t){return e.filter(n=>Xa(n.version,t)===0)}function L5(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 q5({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&&Qa(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 a=n[0].version;if(!Qa(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 i=Xa(a,t);return i<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.`:i>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 D5=new RegExp("^(?:\\p{Extended_Pictographic}|\\p{Emoji_Modifier}|\\p{Regional_Indicator}|[\\u200D\\uFE0F])+(?= \\S)","u");function F5(e){const t=D5.exec(e);return t?{icon:t[0],rest:e.slice(t[0].length)}:{icon:null,rest:e}}function z5(){if(typeof window>"u")return null;try{return window.localStorage}catch{return null}}function B5(e){if(!e)return null;let t=null;try{t=e.getItem(Xw)}catch{return null}return Qa(t)?t:null}function U5(e){if(!e)return!1;try{return e.getItem(Xw),!0}catch{return!1}}function W5(e,t){if(!e)return!1;try{return e.setItem(Xw,t),!0}catch{return!1}}function H5({stored:e,running:t,notes:n,remembers:s=!0}){if(!Qa(t))return{show:[],record:null,reason:"no-version"};if(!Qa(e)){if(!s)return{show:[],record:t,reason:"cannot-remember"};const l=P5(n,t);return l.length?{show:l,record:t,reason:"welcome"}:{show:[],record:t,reason:"first-run"}}const a=Xa(e,t);if(a===0)return{show:[],record:null,reason:"seen"};if(a>0)return{show:[],record:null,reason:"ahead"};const i=sR(n,e,t);return i.length?{show:i,record:t,reason:"new-notes"}:{show:[],record:t,reason:"nothing-new"}}function G5(e,t){if(/\s|^$/.test(e[t+2]??""))return-1;let n=t+2;for(;n<e.length;){if(e[n]==="`"){const s=e.indexOf("`",n+1);if(s<0)break;n=s+1;continue}if(e.startsWith("**",n)&&!/\s/.test(e[n-1]??" "))return n;n++}return-1}function oR(e,t=!0){const n=[];let s="";const a=()=>{s&&(n.push({kind:"text",text:s}),s="")};let i=0;for(;i<e.length;){if(e[i]==="`"){const l=e.indexOf("`",i+1);if(l>i+1){a(),n.push({kind:"code",text:e.slice(i+1,l)}),i=l+1;continue}}else if(t&&e.startsWith("**",i)){const l=G5(e,i);if(l>0){a(),n.push({kind:"bold",kids:oR(e.slice(i+2,l),!1)}),i=l+2;continue}}s+=e[i],i+=1}return a(),n}function V5({entries:e,since:t,running:n,firstRun:s,onClose:a}){const i=Rn(a),l=L5(e);return d.jsx("div",{className:"modal-backdrop",onClick:a,role:"presentation",children:d.jsxs("div",{ref:i,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:a,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),d.jsxs("section",{className:"modal-body",children:[d.jsx("p",{className:"modal-note",children:q5({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((f,p)=>{const{icon:h,rest:g}=F5(f.title);return d.jsxs("li",{className:"rn-note",children:[d.jsxs("p",{className:"rn-note-title",children:[h&&d.jsx("span",{className:"rn-note-icon",children:h}),g]}),d.jsx("p",{className:"rn-note-body",children:aR(oR(f.body))})]},p)})})]},u.version))]})]})})}function aR(e){return e.map((t,n)=>t.kind==="text"?t.text:t.kind==="code"?d.jsx("code",{className:"rn-code",children:t.text},n):d.jsx("strong",{className:"rn-strong",children:aR(t.kids)},n))}function Y5(e){return e.slice().sort((t,n)=>t.y-n.y||t.x-n.x)}function K5(e,t,n){var l;if(e.length===0)return null;const s=Y5(e),a=t?s.findIndex(u=>u.id===t):-1,i=a===-1?n===1?0:s.length-1:(a+n+s.length)%s.length;return((l=s[i])==null?void 0:l.id)??null}const X5=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Escape","Delete","Backspace"]);function Q5(e,t){return t==null?{kind:"deck",nodeId:null}:e.key==="Enter"||e.key===" "?{kind:"activate",nodeId:t,additive:e.shiftKey}:X5.has(e.key)?{kind:"node",nodeId:t}:{kind:"deck",nodeId:t}}const Z5=new Set(["","BODY","HTML","#DOCUMENT"]);function J5(e){return!e||Uw(e)?!1:!Z5.has(String(e.tagName??"").toUpperCase())}function gu(e,t){if(t.size!==0)for(const n of Array.from(e.keys()))t.has(n)||e.delete(n)}function eF(e,t){let n=!1;for(const a of e)if(!t.has(a)){n=!0;break}if(!n)return e;const s=new Set;for(const a of e)t.has(a)&&s.add(a);return s}function tF(e){const t=new Set;for(const n of e)t.add(n.id),t.add(`group:${n.sessionId}`);return t}function nF(e,t){if(!t||!e.agents.get(t))return null;const s=new Set([t]);let a=t;for(;a;){const l=e.agents.get(a);if(!(l!=null&&l.parentId)||s.has(l.parentId))break;s.add(l.parentId),a=l.parentId}let i=!0;for(;i;){i=!1;for(const l of e.agents.values())l.parentId&&s.has(l.parentId)&&!s.has(l.id)&&(s.add(l.id),i=!0)}return s}function rF(e,t){const n=new Set;for(const s of t){const a=nF(e,s);if(a)for(const i of a)n.add(i)}return n.size>0?n:null}function iR(e,t,n){return!t.has(e)||n.has(e)}function sF(e,t,n,s){return!t.has(e)&&iR(e,n,s)}function oF(e,t,n){const s={x:0,y:0};return t.set(e,s),n.add(e),s}function aF(e,t,n,s){n.set(e,t),s.delete(e)}const iF=40,lF=120;function cF(e,t){let n=null,s=0,a=Number.NEGATIVE_INFINITY;const i=()=>{n=null,a=t.now(),e()},l=()=>{n!=null&&(t.clearTimeout(n),n=null)},u=(f,p,h)=>{if(n!=null){if(s<=f)return;l()}const g=Math.min(h,Math.max(0,f-p));s=f,n=t.setTimeout(i,g)};return{live(f=iF){const p=t.now(),h=Math.max(a+f,p);if(h<=p){l(),i();return}u(h,p,f)},replay(f=lF){l(),s=t.now()+f,n=t.setTimeout(i,f)},flush(){l(),i()},cancel(){l()}}}const uF=1e3;function dF(e={}){const t=Math.max(1,Math.floor(e.limit??uF)),n=e.protect;let s=!1,a=[],i=new Set,l=0,u=0,f=null;return{get paused(){return s},get size(){return a.length},get dropped(){return l},get overflowed(){return l>0},get through(){return u},accept(p){const h=typeof(p==null?void 0:p.seq)=="number"?p.seq:null,g=(p==null?void 0:p.epoch)??null,v=g!==null&&g!==f;v&&(f=g,u=0);const w=h!==null&&!v&&h<=u;if(h!==null&&h>u&&(u=h),!s)return!0;if(w)return!1;if(a.push(p),n!=null&&n(p)&&i.add(p),a.length>t){let N=0;if(i.size<a.length)for(;i.has(a[N]);)N++;const[k]=a.splice(N,1);i.delete(k),l++}return!1},setPaused(p){if(s=p,p)return[];const h=a;return a=[],i=new Set,l=0,h}}}const lR="agent-dag.theme";function hF(e){return e==="light"?"light":"dark"}function fF(){return hF(ei(lR))}function pF({waiting:e,running:t,connected:n=!0}){return{title:e>0?`(${e}) ${Ut}`:Ut,icon:n?e>0?"waiting":t>0?"running":"idle":"offline"}}const yu={offline:"#e05252",waiting:"#c97d12",running:"#2a90d4",idle:"#7e828c"};function vu(e,t){const a=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"?a(` stroke-dasharray="${56.5485.toFixed(2)} ${18.8495.toFixed(2)}" transform="rotate(-58 16 16)"`):a("")+(t==="running"?`<circle cx="16" cy="16" r="5" fill="${e}"/>`:"")}</svg>`}const mF=Object.freeze({offline:`data:image/svg+xml,${encodeURIComponent(vu(yu.offline,"offline"))}`,waiting:`data:image/svg+xml,${encodeURIComponent(vu(yu.waiting,"waiting"))}`,running:`data:image/svg+xml,${encodeURIComponent(vu(yu.running,"running"))}`,idle:`data:image/svg+xml,${encodeURIComponent(vu(yu.idle,"idle"))}`}),gF="No sessions are waiting for you.";function yF(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 vF(e,t){return t!==""?t:e===""?"":gF}function wF(){let e=0;return{begin(){const t=++e;return()=>t===e},cancel(){e++}}}function xF(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 bF(e){return e.claude&&e.codex?"Claude Code and Codex":e.claude?"Claude Code":e.codex?"Codex":null}const a1={claude:"Claude Code",codex:"Codex",opencode:"OpenCode",openclaw:"OpenClaw",copilot:"GitHub Copilot",pi:"pi-agent"};function Qw(e){const t=e.toLowerCase();return Object.hasOwn(a1,t)?a1[t]:t?t[0].toUpperCase()+t.slice(1):""}function kF(e){return e.length<=1?e[0]??"":`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`}function _F(e,t=[]){const n=t.length?kF(t.map(Qw)):bF(e);return n?`via ccusage · local ${n} logs`:"via ccusage · local agent logs"}function SF(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 NF(e,t){const n=t.prefs??pw,s=El(n.done.level),a=El(n["needs-input"].level),i=s===a?`${s}%`:`${s}% and ${a}%`,l=t.on?`Sound: on at ${i} — 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?`
|
|
236
|
-
|
|
237
|
-
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.`:"",f=t.on&&t.locked?`
|
|
238
|
-
|
|
239
|
-
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+f+`
|
|
240
|
-
|
|
241
|
-
Click to set the volume and the sound of each tone, and to hear either one.`}function cR(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 a=t.get(s.agent)??{id:s.agent,cost:0,tokens:0};a.cost+=Number.isFinite(s.totalCost)?s.totalCost:0,a.tokens+=Number.isFinite(s.totalTokens)?s.totalTokens:0,t.set(s.agent,a)}return[...t.values()].sort((n,s)=>s.cost-n.cost||n.id.localeCompare(s.id))}function EF(e){const t=cR([{agents:e}]);return t.length<2?null:t.map(n=>`${Qw(n.id)} ${Je(n.cost)}`).join(" · ")}function i1(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 CF(e,t){if(!(t>0)||!(e>0))return"0%";const n=e/t*100;return n<.1?"<0.1%":`${n.toFixed(1)}%`}function wu(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 jF=[7,14,30,90];function TF(e){const[t,n]=b.useState(null),[s,a]=b.useState(!1),i=b.useState(wF)[0],l=b.useRef(!1),u=(f=!1)=>{if(f&&!qt(l.current))return;const p=i.begin();l.current=f;const h=e;a(!0);const v=`/api/ccusage?since=${iw(h)}${f?"&refresh=1":""}`;fetch(v).then(w=>w.json()).then(w=>{p()&&n({range:h,resp:w})}).catch(()=>{p()&&n({range:h,resp:{ok:!1,reason:"unreachable"}})}).finally(()=>{p()&&(l.current=!1,a(!1))})};return b.useEffect(()=>(u(!1),()=>i.cancel()),[e]),{landed:t,loading:s,reload:()=>u(!0)}}function RF({onClose:e,providers:t}){var z;const[n,s]=b.useState(30),[a,i]=b.useState(null),{landed:l,loading:u,reload:f}=TF(n),p=b.useRef(null),h=Rn(e,{focusRef:p}),g=xF({loading:u,want:n,answer:l&&{range:l.range,ok:l.resp.ok===!0,days:((z=l.resp.days)==null?void 0:z.length)??0}}),v=g.phase==="chart"?l.resp.days??[]:[],w=b.useMemo(()=>v.reduce((I,A)=>Math.max(I,A.totalCost),0),[v]),N=b.useRef(null);b.useLayoutEffect(()=>{const I=N.current;I&&(I.scrollLeft=I.scrollWidth)},[v]);const{totalCost:k,totalTok:S,inOut:_,cacheRead:E,modelCosts:C}=b.useMemo(()=>{let I=0,A=0,q=0,V=0;const Y=new Map;for(const R of v){I+=R.totalCost,A+=R.totalTokens,q+=R.inputTokens+R.outputTokens,V+=R.cacheReadTokens;for(const X of R.modelBreakdowns)Y.set(X.modelName,(Y.get(X.modelName)??0)+X.cost)}return{totalCost:I,totalTok:A,inOut:q,cacheRead:V,modelCosts:Y}},[v]),j=b.useMemo(()=>Array.from(C.entries()).sort((I,A)=>A[1]-I[1]),[C]),M=b.useMemo(()=>cR(v),[v]),$=M.length>1,O=a?v.find(I=>I.period===a)??null:null;return d.jsx("div",{className:"uh-backdrop",onClick:e,role:"presentation",children:d.jsxs("div",{ref:h,className:"uh-modal",onClick:I=>I.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:_F(t,M.map(I=>I.id))})]}),d.jsx("div",{className:"uh-range",role:"group","aria-label":"Range",children:jF.map(I=>d.jsxs("button",{type:"button","aria-pressed":n===I,className:"uh-range-btn",onClick:()=>{s(I),i(null)},children:[I,"d"]},I))}),d.jsx("button",{className:"glyph-btn uh-reload",onClick:f,...Ct(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.jsxs("div",{className:"uh-status uh-status-wait","aria-busy":"true",children:[d.jsx("span",{className:"uh-wait-word",children:l?"running ccusage…":"running ccusage… (first run downloads the package)"}),d.jsx("span",{className:"uh-wait-axis","aria-hidden":!0})]}):g.phase==="error"?d.jsxs("div",{className:"uh-status uh-err",title:Ya(l.resp)||void 0,children:[dD(l.resp,"ccusage did not report usage"),d.jsx("div",{children:d.jsx("button",{className:"btn uh-retry",onClick:f,...Ct(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(xu,{label:"total cost",val:Je(k),accent:!0}),d.jsx(xu,{label:"tokens",val:At(S)}),d.jsx(xu,{label:"input+output",val:At(_)}),d.jsx(xu,{label:"cache reads",val:At(E)})]}),$&&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(I=>d.jsx("span",{className:"uh-agent-seg",style:{width:`${k>0?I.cost/k*100:0}%`,background:i1(I.id)}},I.id))}),d.jsx("div",{className:"uh-agent-keys",children:M.map(I=>d.jsxs("span",{className:"uh-agent-key",title:`${I.id} · ${At(I.tokens)} tokens`,children:[d.jsx("span",{className:"uh-legend-dot",style:{background:i1(I.id)}}),Qw(I.id),d.jsx("span",{className:"uh-agent-cost",children:Je(I.cost)}),d.jsx("span",{className:"uh-agent-share",children:CF(I.cost,k)})]},I.id))})]}),d.jsx("div",{ref:N,className:"uh-chart",role:"group","aria-label":"Daily cost by model",children:v.map((I,A)=>{const q=w>0?I.totalCost/w*100:0,V=I.period===a,Y=`${I.period}, ${Je(I.totalCost)}`;return d.jsxs("button",{className:`uh-bar-col${V?" sel":""}`,onClick:()=>i(V?null:I.period),"aria-pressed":V,"aria-label":Y,title:`${I.period} · ${Je(I.totalCost)}`,style:{flexBasis:`${100/v.length}%`,"--uh-i":A,"--uh-step":`${Math.min(10,200/Math.max(v.length,1))}ms`},children:[d.jsx("div",{className:"uh-bar",style:{height:`${Math.max(q,I.totalCost>0?2:0)}%`},children:I.modelBreakdowns.slice().sort((R,X)=>X.cost-R.cost).map(R=>{const X=I.totalCost>0?R.cost/I.totalCost*100:0;return d.jsx("div",{className:"uh-bar-seg",style:{height:`${X}%`,background:wu(R.modelName)}},R.modelName)})}),d.jsx("span",{className:"uh-bar-label",children:I.period.slice(5)})]},I.period)})}),d.jsx("div",{className:"uh-legend",children:j.map(([I,A])=>d.jsxs("span",{className:"uh-legend-item",title:I,children:[d.jsx("span",{className:"uh-legend-dot",style:{background:wu(I)}}),Ds(I)," ",d.jsx("span",{className:"uh-legend-cost",children:Je(A)})]},I))}),O&&d.jsxs("div",{className:"uh-detail",children:[d.jsxs("div",{className:"uh-detail-head",children:[d.jsx("span",{className:"uh-detail-date",children:O.period}),d.jsx("span",{className:"uh-detail-cost",children:Je(O.totalCost)}),(()=>{var q,V;const A=EF(O.agents)??((V=(q=O.metadata)==null?void 0:q.agents)!=null&&V.length?O.metadata.agents.join(" · "):null);return A?d.jsx("span",{className:"uh-detail-agents",title:A,children:A}):null})()]}),d.jsxs("div",{className:"uh-detail-mini",children:[d.jsx(bu,{label:"input",val:At(O.inputTokens)}),d.jsx(bu,{label:"output",val:At(O.outputTokens)}),d.jsx(bu,{label:"cache write",val:At(O.cacheCreationTokens)}),d.jsx(bu,{label:"cache read",val:At(O.cacheReadTokens)})]}),d.jsx("div",{className:"uh-detail-models",children:O.modelBreakdowns.slice().sort((I,A)=>A.cost-I.cost).map(I=>{const A=O.totalCost>0?I.cost/O.totalCost*100:0;return d.jsxs("div",{className:"uh-model-row",title:I.modelName,children:[d.jsxs("span",{className:"uh-model-name",children:[d.jsx("span",{className:"uh-legend-dot",style:{background:wu(I.modelName)}}),d.jsx("span",{className:"uh-model-label",children:Ds(I.modelName)})]}),d.jsx("span",{className:"uh-model-bar",children:d.jsx("span",{className:"uh-model-bar-fill",style:{width:`${A}%`,background:wu(I.modelName)}})}),d.jsx("span",{className:"uh-model-cost",children:Je(I.cost)})]},I.modelName)})})]})]})]})})}function xu({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 bu({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 AF(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(a=>{const i=a/255;return i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4)});return .2126*s[0]+.7152*s[1]+.0722*s[2]>.5}const l1=1e4,MF=12e3;function IF({browsers:e,findings:t,watching:n,palette:s,now:a=()=>Date.now()}){const i=b.useRef(null),l=b.useRef(null);return l.current={browsers:e,findings:t,watching:n},b.useEffect(()=>{var w;const u=i.current;if(!u)return;const f=u.getContext("2d");if(!f)return;const p=((w=window.matchMedia)==null?void 0:w.call(window,"(prefers-reduced-motion: reduce)").matches)??!1;let h=0,g=!1;const v=()=>{var ne;if(g)return;const N=l.current;if(!N)return;const{browsers:k,findings:S,watching:_}=N,E=s["--accent"]||"#7dd3fc",C=s["--line"]||"#1f2229",j=s["--text-dim"]||"#6e727c",M=AF(s["--bg"]),$=M?42:26,O=M?.85:.65,z=a(),I=Math.min(window.devicePixelRatio||1,2),A=u.clientWidth,q=u.clientHeight;(u.width!==A*I||u.height!==q*I)&&(u.width=A*I,u.height=q*I),f.setTransform(I,0,0,I,0,0),f.clearRect(0,0,A,q);const V=A/2,Y=q/2,R=Math.min(A,q)/2-6;f.strokeStyle=C,f.lineWidth=1,f.globalAlpha=M?1:.9;for(const Z of[.4,.7,1])f.beginPath(),f.arc(V,Y,R*Z,0,Math.PI*2),f.stroke();f.beginPath(),f.moveTo(V-R,Y),f.lineTo(V+R,Y),f.moveTo(V,Y-R),f.lineTo(V,Y+R),f.stroke(),f.globalAlpha=1;const B=(_&&!p?z%l1/l1:0)*Math.PI*2-Math.PI/2;if(_){const Z=(ne=f.createConicGradient)==null?void 0:ne.call(f,B-.85,V,Y);Z&&(Z.addColorStop(0,"transparent"),Z.addColorStop(.85/(Math.PI*2),`color-mix(in srgb, ${E} ${$}%, transparent)`),Z.addColorStop(1,"transparent"),f.fillStyle=Z,f.beginPath(),f.moveTo(V,Y),f.arc(V,Y,R,B-.85,B),f.closePath(),f.fill()),f.strokeStyle=E,f.globalAlpha=O,f.beginPath(),f.moveTo(V,Y),f.lineTo(V+Math.cos(B)*R,Y+Math.sin(B)*R),f.stroke(),f.globalAlpha=1}k.forEach((Z,W)=>{const J=W/Math.max(k.length,1)*Math.PI*2-Math.PI/2,P=Z.lastReadMs===null?1:Math.min(1,(z-Z.lastReadMs)/12e4),K=R*(.42+P*.5),te=V+Math.cos(J)*K,D=Y+Math.sin(J)*K,L=Math.abs((B-J+Math.PI*3)%(Math.PI*2)-Math.PI),Q=_?Math.max(0,1-L/.55):0;f.beginPath(),f.arc(te,D,3+Q*1.6,0,Math.PI*2),f.fillStyle=Z.running?E:j,f.globalAlpha=Z.running?.55+Q*.45:.35,f.fill(),f.globalAlpha=1});for(const Z of S){const W=(z-Z.atMs)/MF;if(W<0||W>1)continue;const P=Math.max(0,k.findIndex(D=>D.key===Z.browser))/Math.max(k.length,1)*Math.PI*2-Math.PI/2,K=V+Math.cos(P)*R*.6,te=Y+Math.sin(P)*R*.6;f.beginPath(),f.arc(K,te,4+W*22,0,Math.PI*2),f.strokeStyle=E,f.globalAlpha=(1-W)*.8,f.lineWidth=1.5,f.stroke(),f.globalAlpha=1}h=requestAnimationFrame(v)};return v(),()=>{g=!0,cancelAnimationFrame(h)}},[a,s]),d.jsx("canvas",{ref:i,className:"bw-radar",role:"img","aria-label":n?`Watching ${e.length} browser${e.length===1?"":"s"}`:"Not watching"})}const c1="agent-dag.browserWatch.seenMs";function OF(e,t){return e.filter(n=>n.startMs>t)}function $F(e,t,n){if(e===null)return null;const s=e+t-n;return s>0?s:null}function PF(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 uR(e){return(e??[]).filter(t=>t.installed&&t.profiles>0)}function u1(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 LF(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,a)=>s+a.programVisits,0)}))}function qF(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 DF(e){const t=e.profiles.filter(s=>s.degraded);if(t.length>0){const s=t[0],a=t.length-1;return{kind:"unreadable",text:`${s.name}/${s.profile} could not be read — ${s.reason??"no reason given"}`+(a>0?`, and ${a} more`:"")+". The watch continues on the profiles it can read."}}const n=uR(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 FF(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 zF(e){return new Date(e).toLocaleDateString(void 0,{weekday:"short",day:"numeric",month:"short"})}function d1(e){const t=Math.round((e.endMs-e.startMs)/6e4);return t<1?"":`${t} min`}function BF({onClose:e,onSeen:t,onWatching:n,palette:s}){const a=Rn(e),[i,l]=b.useState(null),[u,f]=b.useState(null),[p,h]=b.useState(null),[g,v]=b.useState(!1),w=b.useRef(!1),[N,k]=b.useState(null),[S,_]=b.useState(null),[E,C]=b.useState(!1),j=b.useRef(!1),[M,$]=b.useState(!1),[O,z]=b.useState(!1),[I,A]=b.useState(!1),[q,V]=b.useState(!1),[Y,R]=b.useState(!1),[X,B]=b.useState(()=>Date.now());b.useEffect(()=>{const U=setInterval(()=>B(Date.now()),1e3);return()=>clearInterval(U)},[]);const ne=b.useCallback(async U=>{var ie,fe;if(!(U&&!qt(w.current))){w.current=U,v(!0);try{const me=await fetch(`/api/browser-watch${U?"?refresh=1":""}`);if(!me.ok)throw new Error(`the deck answered ${me.status}`);const ke=await me.json();l(ke),j.current||k(((ie=ke==null?void 0:ke.settings)==null?void 0:ie.quietMinutes)??15),n(((fe=ke==null?void 0:ke.settings)==null?void 0:fe.enabled)===!0),f(null)}catch(me){f(me instanceof Error?me.message:String(me))}finally{w.current=!1,v(!1)}}},[n]);b.useEffect(()=>{ne(!1)},[ne]),b.useEffect(()=>{const U=setInterval(()=>{ne(!1)},1e4);return()=>clearInterval(U)},[ne]);const Z=b.useCallback(async U=>{try{await fetch("/api/browser-watch/dismiss",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({host:U.host,startMs:U.startMs})})}finally{await ne(!1)}},[ne]),W=b.useCallback(async U=>{j.current=!0,C(!0);try{const ie=await fetch("/api/browser-watch",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(U)});if(!ie.ok)throw new Error(`the deck answered ${ie.status}`);await ne(!1),h(null)}catch(ie){h(ie instanceof Error?ie.message:String(ie))}finally{j.current=!1,C(!1)}},[ne]),J=b.useRef(t);J.current=t,b.useEffect(()=>()=>J.current(Date.now()),[]);const P=b.useMemo(()=>{const U=[];for(const ie of(i==null?void 0:i.episodes)??[]){const fe=zF(ie.startMs),me=U[U.length-1];me&&me.label===fe?me.episodes.push(ie):U.push({label:fe,episodes:[ie]})}return U},[i]),K=uR(i==null?void 0:i.browsers),te=((i==null?void 0:i.browsers)??[]).filter(U=>!(U.installed&&U.profiles>0)),D=i?DF(i):null,L=K.reduce((U,ie)=>U+ie.profiles,0),Q=i?$F(i.coverage.lastHumanMs,i.coverage.quietMs,X):null;return d.jsx("div",{className:"modal-backdrop",onClick:e,role:"presentation",children:d.jsxs("div",{ref:a,className:"modal bw-modal",onClick:U=>U.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:i?`${L} ${L===1?"profile":"profiles"} · local only`:"local only"})]}),d.jsxs("div",{className:"modal-actions",children:[d.jsx("button",{className:"glyph-btn",onClick:()=>void ne(!0),...Ct(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:[!i&&!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})]})}),i&&D&&d.jsx("p",{className:`bw-trouble ${D.kind}`,role:"status",children:D.text}),i&&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(U=>!U),"aria-expanded":I,"aria-label":"What the sweep and the dots mean",children:"?"})]}),d.jsxs("div",{className:"bw-glance",children:[d.jsx(IF,{browsers:K.map(U=>{var ie;return{key:U.key,name:U.name,running:U.running,lastReadMs:((ie=i.profiles.find(fe=>fe.browser===U.key))==null?void 0:ie.lastWrittenMs)??null}}),findings:i.episodes.slice(0,6).map(U=>({browser:U.browser??null,atMs:U.endMs})),watching:i.settings.enabled,palette:s}),d.jsx("ul",{className:"bw-counts",children:LF(K,i.profiles).map(U=>d.jsxs("li",{children:[d.jsx("span",{className:"bw-count-n",children:U.visits.toLocaleString("en-US")}),d.jsx("span",{className:"bw-count-of",children:U.name})]},U.key))})]}),d.jsx("p",{className:"bw-since",children:"Pages a program opened, since this deck started"}),i.coverage.checkedMs>0&&d.jsxs("p",{className:"bw-since",children:["Last checked ",qF(i.coverage.checkedMs,X),i.coverage.checks>0&&d.jsxs(d.Fragment,{children:[" · ",i.coverage.checks.toLocaleString("en-US")," ",i.coverage.checks===1?"check":"checks"]})]}),Q!==null&&d.jsxs("p",{className:"bw-gate",children:["You are browsing — a program page would count in ",PF(Q)]}),I&&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:()=>V(U=>!U),"aria-expanded":q,"aria-label":"What running, idle and connected to Anthropic mean",children:"?"})]}),q&&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:K.map(U=>d.jsxs("li",{children:[d.jsx("span",{className:`bw-prof-dot${U.running?" on":""}`,"aria-hidden":!0}),d.jsx("span",{className:"bw-prof-name",children:U.name}),d.jsx("span",{className:"bw-prof-state",children:U.running?"running":"idle"}),U.running&&U.relay.state==="live"&&d.jsx("span",{className:"bw-relay",children:"connected to Anthropic"})]},U.key))}),te.length>0&&d.jsxs(d.Fragment,{children:[d.jsxs("button",{className:"bw-why bw-rest-head",onClick:()=>R(U=>!U),"aria-expanded":Y,children:[d.jsx("span",{className:"bw-chev","aria-hidden":!0,children:Y?"▾":"▸"})," ",te.length," not watched"]}),Y&&d.jsxs("p",{className:"bw-rest",children:[te.map(U=>U.name).join(", ")," — not installed, or installed and never opened, so there is no history to read."]})]})]}),i.relay&&d.jsx(UF,{relay:i.relay})]}),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",i.episodes.length>0&&d.jsxs("span",{className:"bw-feed-count",children:[i.episodes.length," ",i.episodes.length===1?"episode":"episodes"]})]}),d.jsx("div",{className:"bw-eps",children:P.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"," ",i.settings.quietMinutes," ",i.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."]}),!i.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."})]}):P.map(U=>d.jsxs("div",{className:"bw-day",children:[d.jsx("h4",{className:"bw-sec-head",children:U.label}),U.episodes.map(ie=>{const fe=`${ie.host}-${ie.startMs}`,me=S===fe;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:()=>_(me?null:fe),"aria-expanded":me,children:[d.jsx("span",{className:"bw-chev","aria-hidden":!0,children:me?"▾":"▸"}),d.jsx("span",{className:"bw-ep-host",children:ie.host}),d.jsxs("span",{className:"bw-ep-meta",children:[FF(ie),d1(ie)&&d.jsxs(d.Fragment,{children:[" · ",d1(ie)]})]}),d.jsxs("span",{className:"bw-ep-count",children:[ie.count," ",ie.count===1?"page":"pages"]})]}),d.jsx("button",{className:"glyph-btn bw-ep-x",onClick:()=>void Z(ie),"aria-label":`Dismiss ${ie.host}`,title:"Dismiss — it leaves this list for good, and stays in the log file",children:"×"})]}),me&&d.jsx("ul",{className:"bw-urls",children:ie.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}`))})]},fe)})]},U.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:[i.log.length," ",i.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:i.log.length===0?d.jsx("p",{className:"bw-note",children:"The deck writes a line here each time it looks at a profile."}):i.log.map(U=>d.jsxs("div",{className:`bw-log-line ${U.level}${U.parts?"":" sys"}`,children:[d.jsx("span",{className:"bw-log-time",children:new Date(U.atMs).toLocaleTimeString("en-GB",{hour12:!1})}),U.parts?d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"bw-log-browser",children:U.parts.browser}),d.jsx("span",{className:"bw-log-profile",title:U.parts.profile,children:U.parts.profile}),d.jsxs("span",{className:"bw-log-value",children:[U.parts.value,U.parts.flagged>0&&d.jsxs("span",{className:"bw-log-flag",children:[" · ",U.parts.flagged," flagged"]})]})]}):d.jsx("span",{className:"bw-log-sys",children:U.text})]},`${U.atMs}-${U.level}-${U.text}`))})]})]})]}),i&&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:N??i.settings.quietMinutes,onChange:U=>{k(Number(U.target.value)),W({quietMinutes:Number(U.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:i.settings.reaction,onChange:U=>void W({reaction:U.target.value}),disabled:!i.settings.enabled,title:i.settings.enabled?"What to do besides writing it down.":"Turn watching on to arm a reaction.",children:(i.reactions??["notify"]).map(U=>d.jsx("option",{value:U,children:U==="notify"?"notify me":U==="close-tab"?"close the tab":"quit the browser"},U))})]}),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:()=>z(U=>!U),"aria-expanded":O,children:[d.jsx("span",{className:"bw-chev","aria-hidden":!0,children:O?"▾":"▸"})," What Browser Watch can access"]}),O&&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(i.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:i.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:()=>h(null),"aria-label":"Dismiss",title:"Dismiss",children:"×"})]})}),i&&d.jsxs("footer",{className:"bw-status",children:[d.jsx("span",{className:`bw-mode-dot${i.settings.enabled?" on":""}`,"aria-hidden":!0}),d.jsx("span",{className:"bw-mode-word",children:u1(i,E).word},u1(i,E).kind),d.jsx("span",{className:"bw-status-text",children:i.coverage.archived===0?i.settings.enabled?"No episodes recorded yet":"No episodes on disk":`${i.coverage.archived} ${i.coverage.archived===1?"episode":"episodes"} on disk`}),d.jsx("button",{className:`glyph-btn bw-gear${M?" on":""}`,onClick:()=>$(U=>!U),"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":i.settings.enabled,"aria-labelledby":"bw-enabled-label",className:"bw-toggle",onClick:()=>void W({enabled:!i.settings.enabled}),title:i.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 UF({relay:e}){const[t,n]=b.useState(!1),[s,a]=b.useState(!1),i=e.killswitch.blocked?"unblock":"block",l=e.command[i],u=b.useCallback(async()=>{await eR(l.command)&&(a(!0),window.setTimeout(()=>a(!1),1600))},[l.command]),f=e.profiles.filter(h=>{var g;return(g=h.report)==null?void 0:g.present}),p=e.profiles.filter(h=>h.report===null);return d.jsxs("section",{className:"bw-sec",children:[d.jsx("h4",{className:"bw-sec-head",children:"Remote control"}),d.jsx("p",{className:`bw-rc-verdict ${e.verdict}`,role:"status",children:e.verdict==="exposed"?"Claude in Chrome is live here, so any Claude Code session signed in to your Anthropic account can drive this browser — from any machine, with no prompt on this one.":e.verdict==="protected"?`The relay is black-holed in ${e.hostsPath}, so no new connection to it can be made from this machine.`:"Claude in Chrome is not installed and enabled in any profile here, so there is nothing for the relay to drive."}),e.killswitch.foreign.length>0&&d.jsxs("p",{className:"bw-rc-foreign",children:["Another entry for this host is already in ",e.hostsPath,", and ccdeck will not touch it:",e.killswitch.foreign.map(h=>d.jsx("code",{className:"bw-path",children:h},h))]}),d.jsxs("button",{className:"bw-why",onClick:()=>n(h=>!h),"aria-expanded":t,children:[d.jsx("span",{className:"bw-chev","aria-hidden":!0,children:t?"▾":"▸"})," ",e.verdict==="protected"?"How to undo the block":"What it can reach, and how to stop it"]}),t&&d.jsxs("div",{className:"bw-rc-body",children:[f.length>0&&d.jsx("dl",{className:"bw-key",children:f.map(h=>d.jsxs(b.Fragment,{children:[d.jsxs("dt",{children:[h.name,h.profile==="Default"?"":` · ${h.profile}`]}),d.jsxs("dd",{children:[h.report.enabled?"enabled":"installed but switched off",h.report.allUrls?", can act on every site":", limited to the sites it was granted",h.report.sensitiveApis.length>0&&d.jsxs(d.Fragment,{children:[" — ",h.report.sensitiveApis.join(", ")]})]})]},`${h.browser}/${h.profile}`))}),p.length>0&&d.jsxs("p",{className:"bw-rc-note",children:[p.map(h=>h.name).join(", ")," — its settings file could not be read, so nothing is claimed about it either way."]}),!e.hostsRead&&d.jsxs("p",{className:"bw-rc-note",children:[e.hostsPath," could not be read, so whether the relay is already blocked is unknown."]}),f.some(h=>h.report.allUrls)&&d.jsxs("p",{className:"bw-rc-note",children:["Narrowing the sites in ",d.jsx("code",{className:"bw-path",children:"chrome://extensions"})," does not change this: the grant is held at the browser level and the per-site list is enforced inside the extension, by the extension."]}),d.jsxs("div",{className:"bw-rc-cmd",children:[d.jsx("code",{children:l.command}),d.jsx("button",{className:"btn bw-rc-copy",onClick:u,children:s?"Copied":"Copy"})]}),d.jsx("p",{className:"bw-rc-note",children:l.note})]})]})}function Zw(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var vf,h1;function WF(){if(h1)return vf;h1=1;function e(){this.__data__=[],this.size=0}return vf=e,vf}var wf,f1;function ti(){if(f1)return wf;f1=1;function e(t,n){return t===n||t!==t&&n!==n}return wf=e,wf}var xf,p1;function id(){if(p1)return xf;p1=1;var e=ti();function t(n,s){for(var a=n.length;a--;)if(e(n[a][0],s))return a;return-1}return xf=t,xf}var bf,m1;function HF(){if(m1)return bf;m1=1;var e=id(),t=Array.prototype,n=t.splice;function s(a){var i=this.__data__,l=e(i,a);if(l<0)return!1;var u=i.length-1;return l==u?i.pop():n.call(i,l,1),--this.size,!0}return bf=s,bf}var kf,g1;function GF(){if(g1)return kf;g1=1;var e=id();function t(n){var s=this.__data__,a=e(s,n);return a<0?void 0:s[a][1]}return kf=t,kf}var _f,y1;function VF(){if(y1)return _f;y1=1;var e=id();function t(n){return e(this.__data__,n)>-1}return _f=t,_f}var Sf,v1;function YF(){if(v1)return Sf;v1=1;var e=id();function t(n,s){var a=this.__data__,i=e(a,n);return i<0?(++this.size,a.push([n,s])):a[i][1]=s,this}return Sf=t,Sf}var Nf,w1;function ld(){if(w1)return Nf;w1=1;var e=WF(),t=HF(),n=GF(),s=VF(),a=YF();function i(l){var u=-1,f=l==null?0:l.length;for(this.clear();++u<f;){var p=l[u];this.set(p[0],p[1])}}return i.prototype.clear=e,i.prototype.delete=t,i.prototype.get=n,i.prototype.has=s,i.prototype.set=a,Nf=i,Nf}var Ef,x1;function KF(){if(x1)return Ef;x1=1;var e=ld();function t(){this.__data__=new e,this.size=0}return Ef=t,Ef}var Cf,b1;function XF(){if(b1)return Cf;b1=1;function e(t){var n=this.__data__,s=n.delete(t);return this.size=n.size,s}return Cf=e,Cf}var jf,k1;function QF(){if(k1)return jf;k1=1;function e(t){return this.__data__.get(t)}return jf=e,jf}var Tf,_1;function ZF(){if(_1)return Tf;_1=1;function e(t){return this.__data__.has(t)}return Tf=e,Tf}var Rf,S1;function dR(){if(S1)return Rf;S1=1;var e=typeof eu=="object"&&eu&&eu.Object===Object&&eu;return Rf=e,Rf}var Af,N1;function hr(){if(N1)return Af;N1=1;var e=dR(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return Af=n,Af}var Mf,E1;function ni(){if(E1)return Mf;E1=1;var e=hr(),t=e.Symbol;return Mf=t,Mf}var If,C1;function JF(){if(C1)return If;C1=1;var e=ni(),t=Object.prototype,n=t.hasOwnProperty,s=t.toString,a=e?e.toStringTag:void 0;function i(l){var u=n.call(l,a),f=l[a];try{l[a]=void 0;var p=!0}catch{}var h=s.call(l);return p&&(u?l[a]=f:delete l[a]),h}return If=i,If}var Of,j1;function e6(){if(j1)return Of;j1=1;var e=Object.prototype,t=e.toString;function n(s){return t.call(s)}return Of=n,Of}var $f,T1;function To(){if(T1)return $f;T1=1;var e=ni(),t=JF(),n=e6(),s="[object Null]",a="[object Undefined]",i=e?e.toStringTag:void 0;function l(u){return u==null?u===void 0?a:s:i&&i in Object(u)?t(u):n(u)}return $f=l,$f}var Pf,R1;function Un(){if(R1)return Pf;R1=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return Pf=e,Pf}var Lf,A1;function Fl(){if(A1)return Lf;A1=1;var e=To(),t=Un(),n="[object AsyncFunction]",s="[object Function]",a="[object GeneratorFunction]",i="[object Proxy]";function l(u){if(!t(u))return!1;var f=e(u);return f==s||f==a||f==n||f==i}return Lf=l,Lf}var qf,M1;function t6(){if(M1)return qf;M1=1;var e=hr(),t=e["__core-js_shared__"];return qf=t,qf}var Df,I1;function n6(){if(I1)return Df;I1=1;var e=t6(),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 Df=n,Df}var Ff,O1;function hR(){if(O1)return Ff;O1=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 Ff=n,Ff}var zf,$1;function r6(){if($1)return zf;$1=1;var e=Fl(),t=n6(),n=Un(),s=hR(),a=/[\\^$.*+?()[\]{}|]/g,i=/^\[object .+?Constructor\]$/,l=Function.prototype,u=Object.prototype,f=l.toString,p=u.hasOwnProperty,h=RegExp("^"+f.call(p).replace(a,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function g(v){if(!n(v)||t(v))return!1;var w=e(v)?h:i;return w.test(s(v))}return zf=g,zf}var Bf,P1;function s6(){if(P1)return Bf;P1=1;function e(t,n){return t==null?void 0:t[n]}return Bf=e,Bf}var Uf,L1;function Ro(){if(L1)return Uf;L1=1;var e=r6(),t=s6();function n(s,a){var i=t(s,a);return e(i)?i:void 0}return Uf=n,Uf}var Wf,q1;function Jw(){if(q1)return Wf;q1=1;var e=Ro(),t=hr(),n=e(t,"Map");return Wf=n,Wf}var Hf,D1;function cd(){if(D1)return Hf;D1=1;var e=Ro(),t=e(Object,"create");return Hf=t,Hf}var Gf,F1;function o6(){if(F1)return Gf;F1=1;var e=cd();function t(){this.__data__=e?e(null):{},this.size=0}return Gf=t,Gf}var Vf,z1;function a6(){if(z1)return Vf;z1=1;function e(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}return Vf=e,Vf}var Yf,B1;function i6(){if(B1)return Yf;B1=1;var e=cd(),t="__lodash_hash_undefined__",n=Object.prototype,s=n.hasOwnProperty;function a(i){var l=this.__data__;if(e){var u=l[i];return u===t?void 0:u}return s.call(l,i)?l[i]:void 0}return Yf=a,Yf}var Kf,U1;function l6(){if(U1)return Kf;U1=1;var e=cd(),t=Object.prototype,n=t.hasOwnProperty;function s(a){var i=this.__data__;return e?i[a]!==void 0:n.call(i,a)}return Kf=s,Kf}var Xf,W1;function c6(){if(W1)return Xf;W1=1;var e=cd(),t="__lodash_hash_undefined__";function n(s,a){var i=this.__data__;return this.size+=this.has(s)?0:1,i[s]=e&&a===void 0?t:a,this}return Xf=n,Xf}var Qf,H1;function u6(){if(H1)return Qf;H1=1;var e=o6(),t=a6(),n=i6(),s=l6(),a=c6();function i(l){var u=-1,f=l==null?0:l.length;for(this.clear();++u<f;){var p=l[u];this.set(p[0],p[1])}}return i.prototype.clear=e,i.prototype.delete=t,i.prototype.get=n,i.prototype.has=s,i.prototype.set=a,Qf=i,Qf}var Zf,G1;function d6(){if(G1)return Zf;G1=1;var e=u6(),t=ld(),n=Jw();function s(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return Zf=s,Zf}var Jf,V1;function h6(){if(V1)return Jf;V1=1;function e(t){var n=typeof t;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?t!=="__proto__":t===null}return Jf=e,Jf}var ep,Y1;function ud(){if(Y1)return ep;Y1=1;var e=h6();function t(n,s){var a=n.__data__;return e(s)?a[typeof s=="string"?"string":"hash"]:a.map}return ep=t,ep}var tp,K1;function f6(){if(K1)return tp;K1=1;var e=ud();function t(n){var s=e(this,n).delete(n);return this.size-=s?1:0,s}return tp=t,tp}var np,X1;function p6(){if(X1)return np;X1=1;var e=ud();function t(n){return e(this,n).get(n)}return np=t,np}var rp,Q1;function m6(){if(Q1)return rp;Q1=1;var e=ud();function t(n){return e(this,n).has(n)}return rp=t,rp}var sp,Z1;function g6(){if(Z1)return sp;Z1=1;var e=ud();function t(n,s){var a=e(this,n),i=a.size;return a.set(n,s),this.size+=a.size==i?0:1,this}return sp=t,sp}var op,J1;function e0(){if(J1)return op;J1=1;var e=d6(),t=f6(),n=p6(),s=m6(),a=g6();function i(l){var u=-1,f=l==null?0:l.length;for(this.clear();++u<f;){var p=l[u];this.set(p[0],p[1])}}return i.prototype.clear=e,i.prototype.delete=t,i.prototype.get=n,i.prototype.has=s,i.prototype.set=a,op=i,op}var ap,e_;function y6(){if(e_)return ap;e_=1;var e=ld(),t=Jw(),n=e0(),s=200;function a(i,l){var u=this.__data__;if(u instanceof e){var f=u.__data__;if(!t||f.length<s-1)return f.push([i,l]),this.size=++u.size,this;u=this.__data__=new n(f)}return u.set(i,l),this.size=u.size,this}return ap=a,ap}var ip,t_;function dd(){if(t_)return ip;t_=1;var e=ld(),t=KF(),n=XF(),s=QF(),a=ZF(),i=y6();function l(u){var f=this.__data__=new e(u);this.size=f.size}return l.prototype.clear=t,l.prototype.delete=n,l.prototype.get=s,l.prototype.has=a,l.prototype.set=i,ip=l,ip}var lp,n_;function t0(){if(n_)return lp;n_=1;function e(t,n){for(var s=-1,a=t==null?0:t.length;++s<a&&n(t[s],s,t)!==!1;);return t}return lp=e,lp}var cp,r_;function fR(){if(r_)return cp;r_=1;var e=Ro(),t=(function(){try{var n=e(Object,"defineProperty");return n({},"",{}),n}catch{}})();return cp=t,cp}var up,s_;function hd(){if(s_)return up;s_=1;var e=fR();function t(n,s,a){s=="__proto__"&&e?e(n,s,{configurable:!0,enumerable:!0,value:a,writable:!0}):n[s]=a}return up=t,up}var dp,o_;function fd(){if(o_)return dp;o_=1;var e=hd(),t=ti(),n=Object.prototype,s=n.hasOwnProperty;function a(i,l,u){var f=i[l];(!(s.call(i,l)&&t(f,u))||u===void 0&&!(l in i))&&e(i,l,u)}return dp=a,dp}var hp,a_;function zl(){if(a_)return hp;a_=1;var e=fd(),t=hd();function n(s,a,i,l){var u=!i;i||(i={});for(var f=-1,p=a.length;++f<p;){var h=a[f],g=l?l(i[h],s[h],h,i,s):void 0;g===void 0&&(g=s[h]),u?t(i,h,g):e(i,h,g)}return i}return hp=n,hp}var fp,i_;function v6(){if(i_)return fp;i_=1;function e(t,n){for(var s=-1,a=Array(t);++s<t;)a[s]=n(s);return a}return fp=e,fp}var pp,l_;function Ar(){if(l_)return pp;l_=1;function e(t){return t!=null&&typeof t=="object"}return pp=e,pp}var mp,c_;function w6(){if(c_)return mp;c_=1;var e=To(),t=Ar(),n="[object Arguments]";function s(a){return t(a)&&e(a)==n}return mp=s,mp}var gp,u_;function Bl(){if(u_)return gp;u_=1;var e=w6(),t=Ar(),n=Object.prototype,s=n.hasOwnProperty,a=n.propertyIsEnumerable,i=e((function(){return arguments})())?e:function(l){return t(l)&&s.call(l,"callee")&&!a.call(l,"callee")};return gp=i,gp}var yp,d_;function It(){if(d_)return yp;d_=1;var e=Array.isArray;return yp=e,yp}var dl={exports:{}},vp,h_;function x6(){if(h_)return vp;h_=1;function e(){return!1}return vp=e,vp}dl.exports;var f_;function ri(){return f_||(f_=1,(function(e,t){var n=hr(),s=x6(),a=t&&!t.nodeType&&t,i=a&&!0&&e&&!e.nodeType&&e,l=i&&i.exports===a,u=l?n.Buffer:void 0,f=u?u.isBuffer:void 0,p=f||s;e.exports=p})(dl,dl.exports)),dl.exports}var wp,p_;function pd(){if(p_)return wp;p_=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function n(s,a){var i=typeof s;return a=a??e,!!a&&(i=="number"||i!="symbol"&&t.test(s))&&s>-1&&s%1==0&&s<a}return wp=n,wp}var xp,m_;function n0(){if(m_)return xp;m_=1;var e=9007199254740991;function t(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=e}return xp=t,xp}var bp,g_;function b6(){if(g_)return bp;g_=1;var e=To(),t=n0(),n=Ar(),s="[object Arguments]",a="[object Array]",i="[object Boolean]",l="[object Date]",u="[object Error]",f="[object Function]",p="[object Map]",h="[object Number]",g="[object Object]",v="[object RegExp]",w="[object Set]",N="[object String]",k="[object WeakMap]",S="[object ArrayBuffer]",_="[object DataView]",E="[object Float32Array]",C="[object Float64Array]",j="[object Int8Array]",M="[object Int16Array]",$="[object Int32Array]",O="[object Uint8Array]",z="[object Uint8ClampedArray]",I="[object Uint16Array]",A="[object Uint32Array]",q={};q[E]=q[C]=q[j]=q[M]=q[$]=q[O]=q[z]=q[I]=q[A]=!0,q[s]=q[a]=q[S]=q[i]=q[_]=q[l]=q[u]=q[f]=q[p]=q[h]=q[g]=q[v]=q[w]=q[N]=q[k]=!1;function V(Y){return n(Y)&&t(Y.length)&&!!q[e(Y)]}return bp=V,bp}var kp,y_;function md(){if(y_)return kp;y_=1;function e(t){return function(n){return t(n)}}return kp=e,kp}var hl={exports:{}};hl.exports;var v_;function r0(){return v_||(v_=1,(function(e,t){var n=dR(),s=t&&!t.nodeType&&t,a=s&&!0&&e&&!e.nodeType&&e,i=a&&a.exports===s,l=i&&n.process,u=(function(){try{var f=a&&a.require&&a.require("util").types;return f||l&&l.binding&&l.binding("util")}catch{}})();e.exports=u})(hl,hl.exports)),hl.exports}var _p,w_;function Ul(){if(w_)return _p;w_=1;var e=b6(),t=md(),n=r0(),s=n&&n.isTypedArray,a=s?t(s):e;return _p=a,_p}var Sp,x_;function pR(){if(x_)return Sp;x_=1;var e=v6(),t=Bl(),n=It(),s=ri(),a=pd(),i=Ul(),l=Object.prototype,u=l.hasOwnProperty;function f(p,h){var g=n(p),v=!g&&t(p),w=!g&&!v&&s(p),N=!g&&!v&&!w&&i(p),k=g||v||w||N,S=k?e(p.length,String):[],_=S.length;for(var E in p)(h||u.call(p,E))&&!(k&&(E=="length"||w&&(E=="offset"||E=="parent")||N&&(E=="buffer"||E=="byteLength"||E=="byteOffset")||a(E,_)))&&S.push(E);return S}return Sp=f,Sp}var Np,b_;function gd(){if(b_)return Np;b_=1;var e=Object.prototype;function t(n){var s=n&&n.constructor,a=typeof s=="function"&&s.prototype||e;return n===a}return Np=t,Np}var Ep,k_;function mR(){if(k_)return Ep;k_=1;function e(t,n){return function(s){return t(n(s))}}return Ep=e,Ep}var Cp,__;function k6(){if(__)return Cp;__=1;var e=mR(),t=e(Object.keys,Object);return Cp=t,Cp}var jp,S_;function s0(){if(S_)return jp;S_=1;var e=gd(),t=k6(),n=Object.prototype,s=n.hasOwnProperty;function a(i){if(!e(i))return t(i);var l=[];for(var u in Object(i))s.call(i,u)&&u!="constructor"&&l.push(u);return l}return jp=a,jp}var Tp,N_;function ss(){if(N_)return Tp;N_=1;var e=Fl(),t=n0();function n(s){return s!=null&&t(s.length)&&!e(s)}return Tp=n,Tp}var Rp,E_;function Fs(){if(E_)return Rp;E_=1;var e=pR(),t=s0(),n=ss();function s(a){return n(a)?e(a):t(a)}return Rp=s,Rp}var Ap,C_;function _6(){if(C_)return Ap;C_=1;var e=zl(),t=Fs();function n(s,a){return s&&e(a,t(a),s)}return Ap=n,Ap}var Mp,j_;function S6(){if(j_)return Mp;j_=1;function e(t){var n=[];if(t!=null)for(var s in Object(t))n.push(s);return n}return Mp=e,Mp}var Ip,T_;function N6(){if(T_)return Ip;T_=1;var e=Un(),t=gd(),n=S6(),s=Object.prototype,a=s.hasOwnProperty;function i(l){if(!e(l))return n(l);var u=t(l),f=[];for(var p in l)p=="constructor"&&(u||!a.call(l,p))||f.push(p);return f}return Ip=i,Ip}var Op,R_;function Ao(){if(R_)return Op;R_=1;var e=pR(),t=N6(),n=ss();function s(a){return n(a)?e(a,!0):t(a)}return Op=s,Op}var $p,A_;function E6(){if(A_)return $p;A_=1;var e=zl(),t=Ao();function n(s,a){return s&&e(a,t(a),s)}return $p=n,$p}var fl={exports:{}};fl.exports;var M_;function gR(){return M_||(M_=1,(function(e,t){var n=hr(),s=t&&!t.nodeType&&t,a=s&&!0&&e&&!e.nodeType&&e,i=a&&a.exports===s,l=i?n.Buffer:void 0,u=l?l.allocUnsafe:void 0;function f(p,h){if(h)return p.slice();var g=p.length,v=u?u(g):new p.constructor(g);return p.copy(v),v}e.exports=f})(fl,fl.exports)),fl.exports}var Pp,I_;function yR(){if(I_)return Pp;I_=1;function e(t,n){var s=-1,a=t.length;for(n||(n=Array(a));++s<a;)n[s]=t[s];return n}return Pp=e,Pp}var Lp,O_;function vR(){if(O_)return Lp;O_=1;function e(t,n){for(var s=-1,a=t==null?0:t.length,i=0,l=[];++s<a;){var u=t[s];n(u,s,t)&&(l[i++]=u)}return l}return Lp=e,Lp}var qp,$_;function wR(){if($_)return qp;$_=1;function e(){return[]}return qp=e,qp}var Dp,P_;function o0(){if(P_)return Dp;P_=1;var e=vR(),t=wR(),n=Object.prototype,s=n.propertyIsEnumerable,a=Object.getOwnPropertySymbols,i=a?function(l){return l==null?[]:(l=Object(l),e(a(l),function(u){return s.call(l,u)}))}:t;return Dp=i,Dp}var Fp,L_;function C6(){if(L_)return Fp;L_=1;var e=zl(),t=o0();function n(s,a){return e(s,t(s),a)}return Fp=n,Fp}var zp,q_;function a0(){if(q_)return zp;q_=1;function e(t,n){for(var s=-1,a=n.length,i=t.length;++s<a;)t[i+s]=n[s];return t}return zp=e,zp}var Bp,D_;function yd(){if(D_)return Bp;D_=1;var e=mR(),t=e(Object.getPrototypeOf,Object);return Bp=t,Bp}var Up,F_;function xR(){if(F_)return Up;F_=1;var e=a0(),t=yd(),n=o0(),s=wR(),a=Object.getOwnPropertySymbols,i=a?function(l){for(var u=[];l;)e(u,n(l)),l=t(l);return u}:s;return Up=i,Up}var Wp,z_;function j6(){if(z_)return Wp;z_=1;var e=zl(),t=xR();function n(s,a){return e(s,t(s),a)}return Wp=n,Wp}var Hp,B_;function bR(){if(B_)return Hp;B_=1;var e=a0(),t=It();function n(s,a,i){var l=a(s);return t(s)?l:e(l,i(s))}return Hp=n,Hp}var Gp,U_;function kR(){if(U_)return Gp;U_=1;var e=bR(),t=o0(),n=Fs();function s(a){return e(a,n,t)}return Gp=s,Gp}var Vp,W_;function T6(){if(W_)return Vp;W_=1;var e=bR(),t=xR(),n=Ao();function s(a){return e(a,n,t)}return Vp=s,Vp}var Yp,H_;function R6(){if(H_)return Yp;H_=1;var e=Ro(),t=hr(),n=e(t,"DataView");return Yp=n,Yp}var Kp,G_;function A6(){if(G_)return Kp;G_=1;var e=Ro(),t=hr(),n=e(t,"Promise");return Kp=n,Kp}var Xp,V_;function _R(){if(V_)return Xp;V_=1;var e=Ro(),t=hr(),n=e(t,"Set");return Xp=n,Xp}var Qp,Y_;function M6(){if(Y_)return Qp;Y_=1;var e=Ro(),t=hr(),n=e(t,"WeakMap");return Qp=n,Qp}var Zp,K_;function si(){if(K_)return Zp;K_=1;var e=R6(),t=Jw(),n=A6(),s=_R(),a=M6(),i=To(),l=hR(),u="[object Map]",f="[object Object]",p="[object Promise]",h="[object Set]",g="[object WeakMap]",v="[object DataView]",w=l(e),N=l(t),k=l(n),S=l(s),_=l(a),E=i;return(e&&E(new e(new ArrayBuffer(1)))!=v||t&&E(new t)!=u||n&&E(n.resolve())!=p||s&&E(new s)!=h||a&&E(new a)!=g)&&(E=function(C){var j=i(C),M=j==f?C.constructor:void 0,$=M?l(M):"";if($)switch($){case w:return v;case N:return u;case k:return p;case S:return h;case _:return g}return j}),Zp=E,Zp}var Jp,X_;function I6(){if(X_)return Jp;X_=1;var e=Object.prototype,t=e.hasOwnProperty;function n(s){var a=s.length,i=new s.constructor(a);return a&&typeof s[0]=="string"&&t.call(s,"index")&&(i.index=s.index,i.input=s.input),i}return Jp=n,Jp}var em,Q_;function SR(){if(Q_)return em;Q_=1;var e=hr(),t=e.Uint8Array;return em=t,em}var tm,Z_;function i0(){if(Z_)return tm;Z_=1;var e=SR();function t(n){var s=new n.constructor(n.byteLength);return new e(s).set(new e(n)),s}return tm=t,tm}var nm,J_;function O6(){if(J_)return nm;J_=1;var e=i0();function t(n,s){var a=s?e(n.buffer):n.buffer;return new n.constructor(a,n.byteOffset,n.byteLength)}return nm=t,nm}var rm,eS;function $6(){if(eS)return rm;eS=1;var e=/\w*$/;function t(n){var s=new n.constructor(n.source,e.exec(n));return s.lastIndex=n.lastIndex,s}return rm=t,rm}var sm,tS;function P6(){if(tS)return sm;tS=1;var e=ni(),t=e?e.prototype:void 0,n=t?t.valueOf:void 0;function s(a){return n?Object(n.call(a)):{}}return sm=s,sm}var om,nS;function NR(){if(nS)return om;nS=1;var e=i0();function t(n,s){var a=s?e(n.buffer):n.buffer;return new n.constructor(a,n.byteOffset,n.length)}return om=t,om}var am,rS;function L6(){if(rS)return am;rS=1;var e=i0(),t=O6(),n=$6(),s=P6(),a=NR(),i="[object Boolean]",l="[object Date]",u="[object Map]",f="[object Number]",p="[object RegExp]",h="[object Set]",g="[object String]",v="[object Symbol]",w="[object ArrayBuffer]",N="[object DataView]",k="[object Float32Array]",S="[object Float64Array]",_="[object Int8Array]",E="[object Int16Array]",C="[object Int32Array]",j="[object Uint8Array]",M="[object Uint8ClampedArray]",$="[object Uint16Array]",O="[object Uint32Array]";function z(I,A,q){var V=I.constructor;switch(A){case w:return e(I);case i:case l:return new V(+I);case N:return t(I,q);case k:case S:case _:case E:case C:case j:case M:case $:case O:return a(I,q);case u:return new V;case f:case g:return new V(I);case p:return n(I);case h:return new V;case v:return s(I)}}return am=z,am}var im,sS;function ER(){if(sS)return im;sS=1;var e=Un(),t=Object.create,n=(function(){function s(){}return function(a){if(!e(a))return{};if(t)return t(a);s.prototype=a;var i=new s;return s.prototype=void 0,i}})();return im=n,im}var lm,oS;function CR(){if(oS)return lm;oS=1;var e=ER(),t=yd(),n=gd();function s(a){return typeof a.constructor=="function"&&!n(a)?e(t(a)):{}}return lm=s,lm}var cm,aS;function q6(){if(aS)return cm;aS=1;var e=si(),t=Ar(),n="[object Map]";function s(a){return t(a)&&e(a)==n}return cm=s,cm}var um,iS;function D6(){if(iS)return um;iS=1;var e=q6(),t=md(),n=r0(),s=n&&n.isMap,a=s?t(s):e;return um=a,um}var dm,lS;function F6(){if(lS)return dm;lS=1;var e=si(),t=Ar(),n="[object Set]";function s(a){return t(a)&&e(a)==n}return dm=s,dm}var hm,cS;function z6(){if(cS)return hm;cS=1;var e=F6(),t=md(),n=r0(),s=n&&n.isSet,a=s?t(s):e;return hm=a,hm}var fm,uS;function jR(){if(uS)return fm;uS=1;var e=dd(),t=t0(),n=fd(),s=_6(),a=E6(),i=gR(),l=yR(),u=C6(),f=j6(),p=kR(),h=T6(),g=si(),v=I6(),w=L6(),N=CR(),k=It(),S=ri(),_=D6(),E=Un(),C=z6(),j=Fs(),M=Ao(),$=1,O=2,z=4,I="[object Arguments]",A="[object Array]",q="[object Boolean]",V="[object Date]",Y="[object Error]",R="[object Function]",X="[object GeneratorFunction]",B="[object Map]",ne="[object Number]",Z="[object Object]",W="[object RegExp]",J="[object Set]",P="[object String]",K="[object Symbol]",te="[object WeakMap]",D="[object ArrayBuffer]",L="[object DataView]",Q="[object Float32Array]",U="[object Float64Array]",ie="[object Int8Array]",fe="[object Int16Array]",me="[object Int32Array]",ke="[object Uint8Array]",Ve="[object Uint8ClampedArray]",Le="[object Uint16Array]",De="[object Uint32Array]",Ne={};Ne[I]=Ne[A]=Ne[D]=Ne[L]=Ne[q]=Ne[V]=Ne[Q]=Ne[U]=Ne[ie]=Ne[fe]=Ne[me]=Ne[B]=Ne[ne]=Ne[Z]=Ne[W]=Ne[J]=Ne[P]=Ne[K]=Ne[ke]=Ne[Ve]=Ne[Le]=Ne[De]=!0,Ne[Y]=Ne[R]=Ne[te]=!1;function Ge(be,se,Qe,ut,lt,rt){var Ye,pe=se&$,we=se&O,Pe=se&z;if(Qe&&(Ye=lt?Qe(be,ut,lt,rt):Qe(be)),Ye!==void 0)return Ye;if(!E(be))return be;var Ue=k(be);if(Ue){if(Ye=v(be),!pe)return l(be,Ye)}else{var st=g(be),Oe=st==R||st==X;if(S(be))return i(be,pe);if(st==Z||st==I||Oe&&!lt){if(Ye=we||Oe?{}:N(be),!pe)return we?f(be,a(Ye,be)):u(be,s(Ye,be))}else{if(!Ne[st])return lt?be:{};Ye=w(be,st,pe)}}rt||(rt=new e);var oe=rt.get(be);if(oe)return oe;rt.set(be,Ye),C(be)?be.forEach(function(_e){Ye.add(Ge(_e,se,Qe,_e,be,rt))}):_(be)&&be.forEach(function(_e,Be){Ye.set(Be,Ge(_e,se,Qe,Be,be,rt))});var Se=Pe?we?h:p:we?M:j,qe=Ue?void 0:Se(be);return t(qe||be,function(_e,Be){qe&&(Be=_e,_e=be[Be]),n(Ye,Be,Ge(_e,se,Qe,Be,be,rt))}),Ye}return fm=Ge,fm}var pm,dS;function B6(){if(dS)return pm;dS=1;var e=jR(),t=4;function n(s){return e(s,t)}return pm=n,pm}var mm,hS;function l0(){if(hS)return mm;hS=1;function e(t){return function(){return t}}return mm=e,mm}var gm,fS;function U6(){if(fS)return gm;fS=1;function e(t){return function(n,s,a){for(var i=-1,l=Object(n),u=a(n),f=u.length;f--;){var p=u[t?f:++i];if(s(l[p],p,l)===!1)break}return n}}return gm=e,gm}var ym,pS;function c0(){if(pS)return ym;pS=1;var e=U6(),t=e();return ym=t,ym}var vm,mS;function u0(){if(mS)return vm;mS=1;var e=c0(),t=Fs();function n(s,a){return s&&e(s,a,t)}return vm=n,vm}var wm,gS;function W6(){if(gS)return wm;gS=1;var e=ss();function t(n,s){return function(a,i){if(a==null)return a;if(!e(a))return n(a,i);for(var l=a.length,u=s?l:-1,f=Object(a);(s?u--:++u<l)&&i(f[u],u,f)!==!1;);return a}}return wm=t,wm}var xm,yS;function vd(){if(yS)return xm;yS=1;var e=u0(),t=W6(),n=t(e);return xm=n,xm}var bm,vS;function Mo(){if(vS)return bm;vS=1;function e(t){return t}return bm=e,bm}var km,wS;function TR(){if(wS)return km;wS=1;var e=Mo();function t(n){return typeof n=="function"?n:e}return km=t,km}var _m,xS;function RR(){if(xS)return _m;xS=1;var e=t0(),t=vd(),n=TR(),s=It();function a(i,l){var u=s(i)?e:t;return u(i,n(l))}return _m=a,_m}var Sm,bS;function AR(){return bS||(bS=1,Sm=RR()),Sm}var Nm,kS;function H6(){if(kS)return Nm;kS=1;var e=vd();function t(n,s){var a=[];return e(n,function(i,l,u){s(i,l,u)&&a.push(i)}),a}return Nm=t,Nm}var Em,_S;function G6(){if(_S)return Em;_S=1;var e="__lodash_hash_undefined__";function t(n){return this.__data__.set(n,e),this}return Em=t,Em}var Cm,SS;function V6(){if(SS)return Cm;SS=1;function e(t){return this.__data__.has(t)}return Cm=e,Cm}var jm,NS;function MR(){if(NS)return jm;NS=1;var e=e0(),t=G6(),n=V6();function s(a){var i=-1,l=a==null?0:a.length;for(this.__data__=new e;++i<l;)this.add(a[i])}return s.prototype.add=s.prototype.push=t,s.prototype.has=n,jm=s,jm}var Tm,ES;function Y6(){if(ES)return Tm;ES=1;function e(t,n){for(var s=-1,a=t==null?0:t.length;++s<a;)if(n(t[s],s,t))return!0;return!1}return Tm=e,Tm}var Rm,CS;function IR(){if(CS)return Rm;CS=1;function e(t,n){return t.has(n)}return Rm=e,Rm}var Am,jS;function OR(){if(jS)return Am;jS=1;var e=MR(),t=Y6(),n=IR(),s=1,a=2;function i(l,u,f,p,h,g){var v=f&s,w=l.length,N=u.length;if(w!=N&&!(v&&N>w))return!1;var k=g.get(l),S=g.get(u);if(k&&S)return k==u&&S==l;var _=-1,E=!0,C=f&a?new e:void 0;for(g.set(l,u),g.set(u,l);++_<w;){var j=l[_],M=u[_];if(p)var $=v?p(M,j,_,u,l,g):p(j,M,_,l,u,g);if($!==void 0){if($)continue;E=!1;break}if(C){if(!t(u,function(O,z){if(!n(C,z)&&(j===O||h(j,O,f,p,g)))return C.push(z)})){E=!1;break}}else if(!(j===M||h(j,M,f,p,g))){E=!1;break}}return g.delete(l),g.delete(u),E}return Am=i,Am}var Mm,TS;function K6(){if(TS)return Mm;TS=1;function e(t){var n=-1,s=Array(t.size);return t.forEach(function(a,i){s[++n]=[i,a]}),s}return Mm=e,Mm}var Im,RS;function d0(){if(RS)return Im;RS=1;function e(t){var n=-1,s=Array(t.size);return t.forEach(function(a){s[++n]=a}),s}return Im=e,Im}var Om,AS;function X6(){if(AS)return Om;AS=1;var e=ni(),t=SR(),n=ti(),s=OR(),a=K6(),i=d0(),l=1,u=2,f="[object Boolean]",p="[object Date]",h="[object Error]",g="[object Map]",v="[object Number]",w="[object RegExp]",N="[object Set]",k="[object String]",S="[object Symbol]",_="[object ArrayBuffer]",E="[object DataView]",C=e?e.prototype:void 0,j=C?C.valueOf:void 0;function M($,O,z,I,A,q,V){switch(z){case E:if($.byteLength!=O.byteLength||$.byteOffset!=O.byteOffset)return!1;$=$.buffer,O=O.buffer;case _:return!($.byteLength!=O.byteLength||!q(new t($),new t(O)));case f:case p:case v:return n(+$,+O);case h:return $.name==O.name&&$.message==O.message;case w:case k:return $==O+"";case g:var Y=a;case N:var R=I&l;if(Y||(Y=i),$.size!=O.size&&!R)return!1;var X=V.get($);if(X)return X==O;I|=u,V.set($,O);var B=s(Y($),Y(O),I,A,q,V);return V.delete($),B;case S:if(j)return j.call($)==j.call(O)}return!1}return Om=M,Om}var $m,MS;function Q6(){if(MS)return $m;MS=1;var e=kR(),t=1,n=Object.prototype,s=n.hasOwnProperty;function a(i,l,u,f,p,h){var g=u&t,v=e(i),w=v.length,N=e(l),k=N.length;if(w!=k&&!g)return!1;for(var S=w;S--;){var _=v[S];if(!(g?_ in l:s.call(l,_)))return!1}var E=h.get(i),C=h.get(l);if(E&&C)return E==l&&C==i;var j=!0;h.set(i,l),h.set(l,i);for(var M=g;++S<w;){_=v[S];var $=i[_],O=l[_];if(f)var z=g?f(O,$,_,l,i,h):f($,O,_,i,l,h);if(!(z===void 0?$===O||p($,O,u,f,h):z)){j=!1;break}M||(M=_=="constructor")}if(j&&!M){var I=i.constructor,A=l.constructor;I!=A&&"constructor"in i&&"constructor"in l&&!(typeof I=="function"&&I instanceof I&&typeof A=="function"&&A instanceof A)&&(j=!1)}return h.delete(i),h.delete(l),j}return $m=a,$m}var Pm,IS;function Z6(){if(IS)return Pm;IS=1;var e=dd(),t=OR(),n=X6(),s=Q6(),a=si(),i=It(),l=ri(),u=Ul(),f=1,p="[object Arguments]",h="[object Array]",g="[object Object]",v=Object.prototype,w=v.hasOwnProperty;function N(k,S,_,E,C,j){var M=i(k),$=i(S),O=M?h:a(k),z=$?h:a(S);O=O==p?g:O,z=z==p?g:z;var I=O==g,A=z==g,q=O==z;if(q&&l(k)){if(!l(S))return!1;M=!0,I=!1}if(q&&!I)return j||(j=new e),M||u(k)?t(k,S,_,E,C,j):n(k,S,O,_,E,C,j);if(!(_&f)){var V=I&&w.call(k,"__wrapped__"),Y=A&&w.call(S,"__wrapped__");if(V||Y){var R=V?k.value():k,X=Y?S.value():S;return j||(j=new e),C(R,X,_,E,j)}}return q?(j||(j=new e),s(k,S,_,E,C,j)):!1}return Pm=N,Pm}var Lm,OS;function $R(){if(OS)return Lm;OS=1;var e=Z6(),t=Ar();function n(s,a,i,l,u){return s===a?!0:s==null||a==null||!t(s)&&!t(a)?s!==s&&a!==a:e(s,a,i,l,n,u)}return Lm=n,Lm}var qm,$S;function J6(){if($S)return qm;$S=1;var e=dd(),t=$R(),n=1,s=2;function a(i,l,u,f){var p=u.length,h=p,g=!f;if(i==null)return!h;for(i=Object(i);p--;){var v=u[p];if(g&&v[2]?v[1]!==i[v[0]]:!(v[0]in i))return!1}for(;++p<h;){v=u[p];var w=v[0],N=i[w],k=v[1];if(g&&v[2]){if(N===void 0&&!(w in i))return!1}else{var S=new e;if(f)var _=f(N,k,w,i,l,S);if(!(_===void 0?t(k,N,n|s,f,S):_))return!1}}return!0}return qm=a,qm}var Dm,PS;function PR(){if(PS)return Dm;PS=1;var e=Un();function t(n){return n===n&&!e(n)}return Dm=t,Dm}var Fm,LS;function ez(){if(LS)return Fm;LS=1;var e=PR(),t=Fs();function n(s){for(var a=t(s),i=a.length;i--;){var l=a[i],u=s[l];a[i]=[l,u,e(u)]}return a}return Fm=n,Fm}var zm,qS;function LR(){if(qS)return zm;qS=1;function e(t,n){return function(s){return s==null?!1:s[t]===n&&(n!==void 0||t in Object(s))}}return zm=e,zm}var Bm,DS;function tz(){if(DS)return Bm;DS=1;var e=J6(),t=ez(),n=LR();function s(a){var i=t(a);return i.length==1&&i[0][2]?n(i[0][0],i[0][1]):function(l){return l===a||e(l,a,i)}}return Bm=s,Bm}var Um,FS;function oi(){if(FS)return Um;FS=1;var e=To(),t=Ar(),n="[object Symbol]";function s(a){return typeof a=="symbol"||t(a)&&e(a)==n}return Um=s,Um}var Wm,zS;function h0(){if(zS)return Wm;zS=1;var e=It(),t=oi(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,s=/^\w*$/;function a(i,l){if(e(i))return!1;var u=typeof i;return u=="number"||u=="symbol"||u=="boolean"||i==null||t(i)?!0:s.test(i)||!n.test(i)||l!=null&&i in Object(l)}return Wm=a,Wm}var Hm,BS;function nz(){if(BS)return Hm;BS=1;var e=e0(),t="Expected a function";function n(s,a){if(typeof s!="function"||a!=null&&typeof a!="function")throw new TypeError(t);var i=function(){var l=arguments,u=a?a.apply(this,l):l[0],f=i.cache;if(f.has(u))return f.get(u);var p=s.apply(this,l);return i.cache=f.set(u,p)||f,p};return i.cache=new(n.Cache||e),i}return n.Cache=e,Hm=n,Hm}var Gm,US;function rz(){if(US)return Gm;US=1;var e=nz(),t=500;function n(s){var a=e(s,function(l){return i.size===t&&i.clear(),l}),i=a.cache;return a}return Gm=n,Gm}var Vm,WS;function sz(){if(WS)return Vm;WS=1;var e=rz(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g,s=e(function(a){var i=[];return a.charCodeAt(0)===46&&i.push(""),a.replace(t,function(l,u,f,p){i.push(f?p.replace(n,"$1"):u||l)}),i});return Vm=s,Vm}var Ym,HS;function wd(){if(HS)return Ym;HS=1;function e(t,n){for(var s=-1,a=t==null?0:t.length,i=Array(a);++s<a;)i[s]=n(t[s],s,t);return i}return Ym=e,Ym}var Km,GS;function oz(){if(GS)return Km;GS=1;var e=ni(),t=wd(),n=It(),s=oi(),a=e?e.prototype:void 0,i=a?a.toString:void 0;function l(u){if(typeof u=="string")return u;if(n(u))return t(u,l)+"";if(s(u))return i?i.call(u):"";var f=u+"";return f=="0"&&1/u==-1/0?"-0":f}return Km=l,Km}var Xm,VS;function qR(){if(VS)return Xm;VS=1;var e=oz();function t(n){return n==null?"":e(n)}return Xm=t,Xm}var Qm,YS;function xd(){if(YS)return Qm;YS=1;var e=It(),t=h0(),n=sz(),s=qR();function a(i,l){return e(i)?i:t(i,l)?[i]:n(s(i))}return Qm=a,Qm}var Zm,KS;function Wl(){if(KS)return Zm;KS=1;var e=oi();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 Jm,XS;function bd(){if(XS)return Jm;XS=1;var e=xd(),t=Wl();function n(s,a){a=e(a,s);for(var i=0,l=a.length;s!=null&&i<l;)s=s[t(a[i++])];return i&&i==l?s:void 0}return Jm=n,Jm}var eg,QS;function az(){if(QS)return eg;QS=1;var e=bd();function t(n,s,a){var i=n==null?void 0:e(n,s);return i===void 0?a:i}return eg=t,eg}var tg,ZS;function iz(){if(ZS)return tg;ZS=1;function e(t,n){return t!=null&&n in Object(t)}return tg=e,tg}var ng,JS;function DR(){if(JS)return ng;JS=1;var e=xd(),t=Bl(),n=It(),s=pd(),a=n0(),i=Wl();function l(u,f,p){f=e(f,u);for(var h=-1,g=f.length,v=!1;++h<g;){var w=i(f[h]);if(!(v=u!=null&&p(u,w)))break;u=u[w]}return v||++h!=g?v:(g=u==null?0:u.length,!!g&&a(g)&&s(w,g)&&(n(u)||t(u)))}return ng=l,ng}var rg,eN;function FR(){if(eN)return rg;eN=1;var e=iz(),t=DR();function n(s,a){return s!=null&&t(s,a,e)}return rg=n,rg}var sg,tN;function lz(){if(tN)return sg;tN=1;var e=$R(),t=az(),n=FR(),s=h0(),a=PR(),i=LR(),l=Wl(),u=1,f=2;function p(h,g){return s(h)&&a(g)?i(l(h),g):function(v){var w=t(v,h);return w===void 0&&w===g?n(v,h):e(g,w,u|f)}}return sg=p,sg}var og,nN;function zR(){if(nN)return og;nN=1;function e(t){return function(n){return n==null?void 0:n[t]}}return og=e,og}var ag,rN;function cz(){if(rN)return ag;rN=1;var e=bd();function t(n){return function(s){return e(s,n)}}return ag=t,ag}var ig,sN;function uz(){if(sN)return ig;sN=1;var e=zR(),t=cz(),n=h0(),s=Wl();function a(i){return n(i)?e(s(i)):t(i)}return ig=a,ig}var lg,oN;function os(){if(oN)return lg;oN=1;var e=tz(),t=lz(),n=Mo(),s=It(),a=uz();function i(l){return typeof l=="function"?l:l==null?n:typeof l=="object"?s(l)?t(l[0],l[1]):e(l):a(l)}return lg=i,lg}var cg,aN;function BR(){if(aN)return cg;aN=1;var e=vR(),t=H6(),n=os(),s=It();function a(i,l){var u=s(i)?e:t;return u(i,n(l,3))}return cg=a,cg}var ug,iN;function dz(){if(iN)return ug;iN=1;var e=Object.prototype,t=e.hasOwnProperty;function n(s,a){return s!=null&&t.call(s,a)}return ug=n,ug}var dg,lN;function UR(){if(lN)return dg;lN=1;var e=dz(),t=DR();function n(s,a){return s!=null&&t(s,a,e)}return dg=n,dg}var hg,cN;function hz(){if(cN)return hg;cN=1;var e=s0(),t=si(),n=Bl(),s=It(),a=ss(),i=ri(),l=gd(),u=Ul(),f="[object Map]",p="[object Set]",h=Object.prototype,g=h.hasOwnProperty;function v(w){if(w==null)return!0;if(a(w)&&(s(w)||typeof w=="string"||typeof w.splice=="function"||i(w)||u(w)||n(w)))return!w.length;var N=t(w);if(N==f||N==p)return!w.size;if(l(w))return!e(w).length;for(var k in w)if(g.call(w,k))return!1;return!0}return hg=v,hg}var fg,uN;function WR(){if(uN)return fg;uN=1;function e(t){return t===void 0}return fg=e,fg}var pg,dN;function HR(){if(dN)return pg;dN=1;var e=vd(),t=ss();function n(s,a){var i=-1,l=t(s)?Array(s.length):[];return e(s,function(u,f,p){l[++i]=a(u,f,p)}),l}return pg=n,pg}var mg,hN;function GR(){if(hN)return mg;hN=1;var e=wd(),t=os(),n=HR(),s=It();function a(i,l){var u=s(i)?e:n;return u(i,t(l,3))}return mg=a,mg}var gg,fN;function fz(){if(fN)return gg;fN=1;function e(t,n,s,a){var i=-1,l=t==null?0:t.length;for(a&&l&&(s=t[++i]);++i<l;)s=n(s,t[i],i,t);return s}return gg=e,gg}var yg,pN;function pz(){if(pN)return yg;pN=1;function e(t,n,s,a,i){return i(t,function(l,u,f){s=a?(a=!1,l):n(s,l,u,f)}),s}return yg=e,yg}var vg,mN;function VR(){if(mN)return vg;mN=1;var e=fz(),t=vd(),n=os(),s=pz(),a=It();function i(l,u,f){var p=a(l)?e:s,h=arguments.length<3;return p(l,n(u,4),f,h,t)}return vg=i,vg}var wg,gN;function mz(){if(gN)return wg;gN=1;var e=To(),t=It(),n=Ar(),s="[object String]";function a(i){return typeof i=="string"||!t(i)&&n(i)&&e(i)==s}return wg=a,wg}var xg,yN;function gz(){if(yN)return xg;yN=1;var e=zR(),t=e("length");return xg=t,xg}var bg,vN;function yz(){if(vN)return bg;vN=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",s="\\u20d0-\\u20ff",a=t+n+s,i="\\ufe0e\\ufe0f",l="\\u200d",u=RegExp("["+l+e+a+i+"]");function f(p){return u.test(p)}return bg=f,bg}var kg,wN;function vz(){if(wN)return kg;wN=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",s="\\u20d0-\\u20ff",a=t+n+s,i="\\ufe0e\\ufe0f",l="["+e+"]",u="["+a+"]",f="\\ud83c[\\udffb-\\udfff]",p="(?:"+u+"|"+f+")",h="[^"+e+"]",g="(?:\\ud83c[\\udde6-\\uddff]){2}",v="[\\ud800-\\udbff][\\udc00-\\udfff]",w="\\u200d",N=p+"?",k="["+i+"]?",S="(?:"+w+"(?:"+[h,g,v].join("|")+")"+k+N+")*",_=k+N+S,E="(?:"+[h+u+"?",u,g,v,l].join("|")+")",C=RegExp(f+"(?="+f+")|"+E+_,"g");function j(M){for(var $=C.lastIndex=0;C.test(M);)++$;return $}return kg=j,kg}var _g,xN;function wz(){if(xN)return _g;xN=1;var e=gz(),t=yz(),n=vz();function s(a){return t(a)?n(a):e(a)}return _g=s,_g}var Sg,bN;function xz(){if(bN)return Sg;bN=1;var e=s0(),t=si(),n=ss(),s=mz(),a=wz(),i="[object Map]",l="[object Set]";function u(f){if(f==null)return 0;if(n(f))return s(f)?a(f):f.length;var p=t(f);return p==i||p==l?f.size:e(f).length}return Sg=u,Sg}var Ng,kN;function bz(){if(kN)return Ng;kN=1;var e=t0(),t=ER(),n=u0(),s=os(),a=yd(),i=It(),l=ri(),u=Fl(),f=Un(),p=Ul();function h(g,v,w){var N=i(g),k=N||l(g)||p(g);if(v=s(v,4),w==null){var S=g&&g.constructor;k?w=N?new S:[]:f(g)?w=u(S)?t(a(g)):{}:w={}}return(k?e:n)(g,function(_,E,C){return v(w,_,E,C)}),w}return Ng=h,Ng}var Eg,_N;function kz(){if(_N)return Eg;_N=1;var e=ni(),t=Bl(),n=It(),s=e?e.isConcatSpreadable:void 0;function a(i){return n(i)||t(i)||!!(s&&i&&i[s])}return Eg=a,Eg}var Cg,SN;function f0(){if(SN)return Cg;SN=1;var e=a0(),t=kz();function n(s,a,i,l,u){var f=-1,p=s.length;for(i||(i=t),u||(u=[]);++f<p;){var h=s[f];a>0&&i(h)?a>1?n(h,a-1,i,l,u):e(u,h):l||(u[u.length]=h)}return u}return Cg=n,Cg}var jg,NN;function _z(){if(NN)return jg;NN=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 jg=e,jg}var Tg,EN;function YR(){if(EN)return Tg;EN=1;var e=_z(),t=Math.max;function n(s,a,i){return a=t(a===void 0?s.length-1:a,0),function(){for(var l=arguments,u=-1,f=t(l.length-a,0),p=Array(f);++u<f;)p[u]=l[a+u];u=-1;for(var h=Array(a+1);++u<a;)h[u]=l[u];return h[a]=i(p),e(s,this,h)}}return Tg=n,Tg}var Rg,CN;function Sz(){if(CN)return Rg;CN=1;var e=l0(),t=fR(),n=Mo(),s=t?function(a,i){return t(a,"toString",{configurable:!0,enumerable:!1,value:e(i),writable:!0})}:n;return Rg=s,Rg}var Ag,jN;function Nz(){if(jN)return Ag;jN=1;var e=800,t=16,n=Date.now;function s(a){var i=0,l=0;return function(){var u=n(),f=t-(u-l);if(l=u,f>0){if(++i>=e)return arguments[0]}else i=0;return a.apply(void 0,arguments)}}return Ag=s,Ag}var Mg,TN;function KR(){if(TN)return Mg;TN=1;var e=Sz(),t=Nz(),n=t(e);return Mg=n,Mg}var Ig,RN;function kd(){if(RN)return Ig;RN=1;var e=Mo(),t=YR(),n=KR();function s(a,i){return n(t(a,i,e),a+"")}return Ig=s,Ig}var Og,AN;function XR(){if(AN)return Og;AN=1;function e(t,n,s,a){for(var i=t.length,l=s+(a?1:-1);a?l--:++l<i;)if(n(t[l],l,t))return l;return-1}return Og=e,Og}var $g,MN;function Ez(){if(MN)return $g;MN=1;function e(t){return t!==t}return $g=e,$g}var Pg,IN;function Cz(){if(IN)return Pg;IN=1;function e(t,n,s){for(var a=s-1,i=t.length;++a<i;)if(t[a]===n)return a;return-1}return Pg=e,Pg}var Lg,ON;function jz(){if(ON)return Lg;ON=1;var e=XR(),t=Ez(),n=Cz();function s(a,i,l){return i===i?n(a,i,l):e(a,t,l)}return Lg=s,Lg}var qg,$N;function Tz(){if($N)return qg;$N=1;var e=jz();function t(n,s){var a=n==null?0:n.length;return!!a&&e(n,s,0)>-1}return qg=t,qg}var Dg,PN;function Rz(){if(PN)return Dg;PN=1;function e(t,n,s){for(var a=-1,i=t==null?0:t.length;++a<i;)if(s(n,t[a]))return!0;return!1}return Dg=e,Dg}var Fg,LN;function Az(){if(LN)return Fg;LN=1;function e(){}return Fg=e,Fg}var zg,qN;function Mz(){if(qN)return zg;qN=1;var e=_R(),t=Az(),n=d0(),s=1/0,a=e&&1/n(new e([,-0]))[1]==s?function(i){return new e(i)}:t;return zg=a,zg}var Bg,DN;function Iz(){if(DN)return Bg;DN=1;var e=MR(),t=Tz(),n=Rz(),s=IR(),a=Mz(),i=d0(),l=200;function u(f,p,h){var g=-1,v=t,w=f.length,N=!0,k=[],S=k;if(h)N=!1,v=n;else if(w>=l){var _=p?null:a(f);if(_)return i(_);N=!1,v=s,S=new e}else S=p?[]:k;e:for(;++g<w;){var E=f[g],C=p?p(E):E;if(E=h||E!==0?E:0,N&&C===C){for(var j=S.length;j--;)if(S[j]===C)continue e;p&&S.push(C),k.push(E)}else v(S,C,h)||(S!==k&&S.push(C),k.push(E))}return k}return Bg=u,Bg}var Ug,FN;function QR(){if(FN)return Ug;FN=1;var e=ss(),t=Ar();function n(s){return t(s)&&e(s)}return Ug=n,Ug}var Wg,zN;function Oz(){if(zN)return Wg;zN=1;var e=f0(),t=kd(),n=Iz(),s=QR(),a=t(function(i){return n(e(i,1,s,!0))});return Wg=a,Wg}var Hg,BN;function $z(){if(BN)return Hg;BN=1;var e=wd();function t(n,s){return e(s,function(a){return n[a]})}return Hg=t,Hg}var Gg,UN;function ZR(){if(UN)return Gg;UN=1;var e=$z(),t=Fs();function n(s){return s==null?[]:e(s,t(s))}return Gg=n,Gg}var Vg,WN;function Wn(){if(WN)return Vg;WN=1;var e;if(typeof Zw=="function")try{e={clone:B6(),constant:l0(),each:AR(),filter:BR(),has:UR(),isArray:It(),isEmpty:hz(),isFunction:Fl(),isUndefined:WR(),keys:Fs(),map:GR(),reduce:VR(),size:xz(),transform:bz(),union:Oz(),values:ZR()}}catch{}return e||(e=window._),Vg=e,Vg}var Yg,HN;function p0(){if(HN)return Yg;HN=1;var e=Wn();Yg=a;var t="\0",n="\0",s="";function a(h){this._isDirected=e.has(h,"directed")?h.directed:!0,this._isMultigraph=e.has(h,"multigraph")?h.multigraph:!1,this._isCompound=e.has(h,"compound")?h.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={}}a.prototype._nodeCount=0,a.prototype._edgeCount=0,a.prototype.isDirected=function(){return this._isDirected},a.prototype.isMultigraph=function(){return this._isMultigraph},a.prototype.isCompound=function(){return this._isCompound},a.prototype.setGraph=function(h){return this._label=h,this},a.prototype.graph=function(){return this._label},a.prototype.setDefaultNodeLabel=function(h){return e.isFunction(h)||(h=e.constant(h)),this._defaultNodeLabelFn=h,this},a.prototype.nodeCount=function(){return this._nodeCount},a.prototype.nodes=function(){return e.keys(this._nodes)},a.prototype.sources=function(){var h=this;return e.filter(this.nodes(),function(g){return e.isEmpty(h._in[g])})},a.prototype.sinks=function(){var h=this;return e.filter(this.nodes(),function(g){return e.isEmpty(h._out[g])})},a.prototype.setNodes=function(h,g){var v=arguments,w=this;return e.each(h,function(N){v.length>1?w.setNode(N,g):w.setNode(N)}),this},a.prototype.setNode=function(h,g){return e.has(this._nodes,h)?(arguments.length>1&&(this._nodes[h]=g),this):(this._nodes[h]=arguments.length>1?g:this._defaultNodeLabelFn(h),this._isCompound&&(this._parent[h]=n,this._children[h]={},this._children[n][h]=!0),this._in[h]={},this._preds[h]={},this._out[h]={},this._sucs[h]={},++this._nodeCount,this)},a.prototype.node=function(h){return this._nodes[h]},a.prototype.hasNode=function(h){return e.has(this._nodes,h)},a.prototype.removeNode=function(h){var g=this;if(e.has(this._nodes,h)){var v=function(w){g.removeEdge(g._edgeObjs[w])};delete this._nodes[h],this._isCompound&&(this._removeFromParentsChildList(h),delete this._parent[h],e.each(this.children(h),function(w){g.setParent(w)}),delete this._children[h]),e.each(e.keys(this._in[h]),v),delete this._in[h],delete this._preds[h],e.each(e.keys(this._out[h]),v),delete this._out[h],delete this._sucs[h],--this._nodeCount}return this},a.prototype.setParent=function(h,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===h)throw new Error("Setting "+g+" as parent of "+h+" would create a cycle");this.setNode(g)}return this.setNode(h),this._removeFromParentsChildList(h),this._parent[h]=g,this._children[g][h]=!0,this},a.prototype._removeFromParentsChildList=function(h){delete this._children[this._parent[h]][h]},a.prototype.parent=function(h){if(this._isCompound){var g=this._parent[h];if(g!==n)return g}},a.prototype.children=function(h){if(e.isUndefined(h)&&(h=n),this._isCompound){var g=this._children[h];if(g)return e.keys(g)}else{if(h===n)return this.nodes();if(this.hasNode(h))return[]}},a.prototype.predecessors=function(h){var g=this._preds[h];if(g)return e.keys(g)},a.prototype.successors=function(h){var g=this._sucs[h];if(g)return e.keys(g)},a.prototype.neighbors=function(h){var g=this.predecessors(h);if(g)return e.union(g,this.successors(h))},a.prototype.isLeaf=function(h){var g;return this.isDirected()?g=this.successors(h):g=this.neighbors(h),g.length===0},a.prototype.filterNodes=function(h){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(k,S){h(S)&&g.setNode(S,k)}),e.each(this._edgeObjs,function(k){g.hasNode(k.v)&&g.hasNode(k.w)&&g.setEdge(k,v.edge(k))});var w={};function N(k){var S=v.parent(k);return S===void 0||g.hasNode(S)?(w[k]=S,S):S in w?w[S]:N(S)}return this._isCompound&&e.each(g.nodes(),function(k){g.setParent(k,N(k))}),g},a.prototype.setDefaultEdgeLabel=function(h){return e.isFunction(h)||(h=e.constant(h)),this._defaultEdgeLabelFn=h,this},a.prototype.edgeCount=function(){return this._edgeCount},a.prototype.edges=function(){return e.values(this._edgeObjs)},a.prototype.setPath=function(h,g){var v=this,w=arguments;return e.reduce(h,function(N,k){return w.length>1?v.setEdge(N,k,g):v.setEdge(N,k),k}),this},a.prototype.setEdge=function(){var h,g,v,w,N=!1,k=arguments[0];typeof k=="object"&&k!==null&&"v"in k?(h=k.v,g=k.w,v=k.name,arguments.length===2&&(w=arguments[1],N=!0)):(h=k,g=arguments[1],v=arguments[3],arguments.length>2&&(w=arguments[2],N=!0)),h=""+h,g=""+g,e.isUndefined(v)||(v=""+v);var S=u(this._isDirected,h,g,v);if(e.has(this._edgeLabels,S))return N&&(this._edgeLabels[S]=w),this;if(!e.isUndefined(v)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(h),this.setNode(g),this._edgeLabels[S]=N?w:this._defaultEdgeLabelFn(h,g,v);var _=f(this._isDirected,h,g,v);return h=_.v,g=_.w,Object.freeze(_),this._edgeObjs[S]=_,i(this._preds[g],h),i(this._sucs[h],g),this._in[g][S]=_,this._out[h][S]=_,this._edgeCount++,this},a.prototype.edge=function(h,g,v){var w=arguments.length===1?p(this._isDirected,arguments[0]):u(this._isDirected,h,g,v);return this._edgeLabels[w]},a.prototype.hasEdge=function(h,g,v){var w=arguments.length===1?p(this._isDirected,arguments[0]):u(this._isDirected,h,g,v);return e.has(this._edgeLabels,w)},a.prototype.removeEdge=function(h,g,v){var w=arguments.length===1?p(this._isDirected,arguments[0]):u(this._isDirected,h,g,v),N=this._edgeObjs[w];return N&&(h=N.v,g=N.w,delete this._edgeLabels[w],delete this._edgeObjs[w],l(this._preds[g],h),l(this._sucs[h],g),delete this._in[g][w],delete this._out[h][w],this._edgeCount--),this},a.prototype.inEdges=function(h,g){var v=this._in[h];if(v){var w=e.values(v);return g?e.filter(w,function(N){return N.v===g}):w}},a.prototype.outEdges=function(h,g){var v=this._out[h];if(v){var w=e.values(v);return g?e.filter(w,function(N){return N.w===g}):w}},a.prototype.nodeEdges=function(h,g){var v=this.inEdges(h,g);if(v)return v.concat(this.outEdges(h,g))};function i(h,g){h[g]?h[g]++:h[g]=1}function l(h,g){--h[g]||delete h[g]}function u(h,g,v,w){var N=""+g,k=""+v;if(!h&&N>k){var S=N;N=k,k=S}return N+s+k+s+(e.isUndefined(w)?t:w)}function f(h,g,v,w){var N=""+g,k=""+v;if(!h&&N>k){var S=N;N=k,k=S}var _={v:N,w:k};return w&&(_.name=w),_}function p(h,g){return u(h,g.v,g.w,g.name)}return Yg}var Kg,GN;function Pz(){return GN||(GN=1,Kg="2.1.8"),Kg}var Xg,VN;function Lz(){return VN||(VN=1,Xg={Graph:p0(),version:Pz()}),Xg}var Qg,YN;function qz(){if(YN)return Qg;YN=1;var e=Wn(),t=p0();Qg={write:n,read:i};function n(l){var u={options:{directed:l.isDirected(),multigraph:l.isMultigraph(),compound:l.isCompound()},nodes:s(l),edges:a(l)};return e.isUndefined(l.graph())||(u.value=e.clone(l.graph())),u}function s(l){return e.map(l.nodes(),function(u){var f=l.node(u),p=l.parent(u),h={v:u};return e.isUndefined(f)||(h.value=f),e.isUndefined(p)||(h.parent=p),h})}function a(l){return e.map(l.edges(),function(u){var f=l.edge(u),p={v:u.v,w:u.w};return e.isUndefined(u.name)||(p.name=u.name),e.isUndefined(f)||(p.value=f),p})}function i(l){var u=new t(l.options).setGraph(l.value);return e.each(l.nodes,function(f){u.setNode(f.v,f.value),f.parent&&u.setParent(f.v,f.parent)}),e.each(l.edges,function(f){u.setEdge({v:f.v,w:f.w,name:f.name},f.value)}),u}return Qg}var Zg,KN;function Dz(){if(KN)return Zg;KN=1;var e=Wn();Zg=t;function t(n){var s={},a=[],i;function l(u){e.has(s,u)||(s[u]=!0,i.push(u),e.each(n.successors(u),l),e.each(n.predecessors(u),l))}return e.each(n.nodes(),function(u){i=[],l(u),i.length&&a.push(i)}),a}return Zg}var Jg,XN;function JR(){if(XN)return Jg;XN=1;var e=Wn();Jg=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 a=this._keyIndices;if(n=String(n),!e.has(a,n)){var i=this._arr,l=i.length;return a[n]=l,i.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 a=this._keyIndices[n];if(s>this._arr[a].priority)throw new Error("New priority is greater than current priority. Key: "+n+" Old: "+this._arr[a].priority+" New: "+s);this._arr[a].priority=s,this._decrease(a)},t.prototype._heapify=function(n){var s=this._arr,a=2*n,i=a+1,l=n;a<s.length&&(l=s[a].priority<s[l].priority?a:l,i<s.length&&(l=s[i].priority<s[l].priority?i:l),l!==n&&(this._swap(n,l),this._heapify(l)))},t.prototype._decrease=function(n){for(var s=this._arr,a=s[n].priority,i;n!==0&&(i=n>>1,!(s[i].priority<a));)this._swap(n,i),n=i},t.prototype._swap=function(n,s){var a=this._arr,i=this._keyIndices,l=a[n],u=a[s];a[n]=u,a[s]=l,i[u.key]=n,i[l.key]=s},Jg}var ey,QN;function eA(){if(QN)return ey;QN=1;var e=Wn(),t=JR();ey=s;var n=e.constant(1);function s(i,l,u,f){return a(i,String(l),u||n,f||function(p){return i.outEdges(p)})}function a(i,l,u,f){var p={},h=new t,g,v,w=function(N){var k=N.v!==g?N.v:N.w,S=p[k],_=u(N),E=v.distance+_;if(_<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+N+" Weight: "+_);E<S.distance&&(S.distance=E,S.predecessor=g,h.decrease(k,E))};for(i.nodes().forEach(function(N){var k=N===l?0:Number.POSITIVE_INFINITY;p[N]={distance:k},h.add(N,k)});h.size()>0&&(g=h.removeMin(),v=p[g],v.distance!==Number.POSITIVE_INFINITY);)f(g).forEach(w);return p}return ey}var ty,ZN;function Fz(){if(ZN)return ty;ZN=1;var e=eA(),t=Wn();ty=n;function n(s,a,i){return t.transform(s.nodes(),function(l,u){l[u]=e(s,u,a,i)},{})}return ty}var ny,JN;function tA(){if(JN)return ny;JN=1;var e=Wn();ny=t;function t(n){var s=0,a=[],i={},l=[];function u(f){var p=i[f]={onStack:!0,lowlink:s,index:s++};if(a.push(f),n.successors(f).forEach(function(v){e.has(i,v)?i[v].onStack&&(p.lowlink=Math.min(p.lowlink,i[v].index)):(u(v),p.lowlink=Math.min(p.lowlink,i[v].lowlink))}),p.lowlink===p.index){var h=[],g;do g=a.pop(),i[g].onStack=!1,h.push(g);while(f!==g);l.push(h)}}return n.nodes().forEach(function(f){e.has(i,f)||u(f)}),l}return ny}var ry,eE;function zz(){if(eE)return ry;eE=1;var e=Wn(),t=tA();ry=n;function n(s){return e.filter(t(s),function(a){return a.length>1||a.length===1&&s.hasEdge(a[0],a[0])})}return ry}var sy,tE;function Bz(){if(tE)return sy;tE=1;var e=Wn();sy=n;var t=e.constant(1);function n(a,i,l){return s(a,i||t,l||function(u){return a.outEdges(u)})}function s(a,i,l){var u={},f=a.nodes();return f.forEach(function(p){u[p]={},u[p][p]={distance:0},f.forEach(function(h){p!==h&&(u[p][h]={distance:Number.POSITIVE_INFINITY})}),l(p).forEach(function(h){var g=h.v===p?h.w:h.v,v=i(h);u[p][g]={distance:v,predecessor:p}})}),f.forEach(function(p){var h=u[p];f.forEach(function(g){var v=u[g];f.forEach(function(w){var N=v[p],k=h[w],S=v[w],_=N.distance+k.distance;_<S.distance&&(S.distance=_,S.predecessor=k.predecessor)})})}),u}return sy}var oy,nE;function nA(){if(nE)return oy;nE=1;var e=Wn();oy=t,t.CycleException=n;function t(s){var a={},i={},l=[];function u(f){if(e.has(i,f))throw new n;e.has(a,f)||(i[f]=!0,a[f]=!0,e.each(s.predecessors(f),u),delete i[f],l.push(f))}if(e.each(s.sinks(),u),e.size(a)!==s.nodeCount())throw new n;return l}function n(){}return n.prototype=new Error,oy}var ay,rE;function Uz(){if(rE)return ay;rE=1;var e=nA();ay=t;function t(n){try{e(n)}catch(s){if(s instanceof e.CycleException)return!1;throw s}return!0}return ay}var iy,sE;function rA(){if(sE)return iy;sE=1;var e=Wn();iy=t;function t(s,a,i){e.isArray(a)||(a=[a]);var l=(s.isDirected()?s.successors:s.neighbors).bind(s),u=[],f={};return e.each(a,function(p){if(!s.hasNode(p))throw new Error("Graph does not have node: "+p);n(s,p,i==="post",f,l,u)}),u}function n(s,a,i,l,u,f){e.has(l,a)||(l[a]=!0,i||f.push(a),e.each(u(a),function(p){n(s,p,i,l,u,f)}),i&&f.push(a))}return iy}var ly,oE;function Wz(){if(oE)return ly;oE=1;var e=rA();ly=t;function t(n,s){return e(n,s,"post")}return ly}var cy,aE;function Hz(){if(aE)return cy;aE=1;var e=rA();cy=t;function t(n,s){return e(n,s,"pre")}return cy}var uy,iE;function Gz(){if(iE)return uy;iE=1;var e=Wn(),t=p0(),n=JR();uy=s;function s(a,i){var l=new t,u={},f=new n,p;function h(v){var w=v.v===p?v.w:v.v,N=f.priority(w);if(N!==void 0){var k=i(v);k<N&&(u[w]=p,f.decrease(w,k))}}if(a.nodeCount()===0)return l;e.each(a.nodes(),function(v){f.add(v,Number.POSITIVE_INFINITY),l.setNode(v)}),f.decrease(a.nodes()[0],0);for(var g=!1;f.size()>0;){if(p=f.removeMin(),e.has(u,p))l.setEdge(p,u[p]);else{if(g)throw new Error("Input graph is not connected: "+a);g=!0}a.nodeEdges(p).forEach(h)}return l}return uy}var dy,lE;function Vz(){return lE||(lE=1,dy={components:Dz(),dijkstra:eA(),dijkstraAll:Fz(),findCycles:zz(),floydWarshall:Bz(),isAcyclic:Uz(),postorder:Wz(),preorder:Hz(),prim:Gz(),tarjan:tA(),topsort:nA()}),dy}var hy,cE;function Yz(){if(cE)return hy;cE=1;var e=Lz();return hy={Graph:e.Graph,json:qz(),alg:Vz(),version:e.version},hy}var fy,uE;function ur(){if(uE)return fy;uE=1;var e;if(typeof Zw=="function")try{e=Yz()}catch{}return e||(e=window.graphlib),fy=e,fy}var py,dE;function Kz(){if(dE)return py;dE=1;var e=jR(),t=1,n=4;function s(a){return e(a,t|n)}return py=s,py}var my,hE;function _d(){if(hE)return my;hE=1;var e=ti(),t=ss(),n=pd(),s=Un();function a(i,l,u){if(!s(u))return!1;var f=typeof l;return(f=="number"?t(u)&&n(l,u.length):f=="string"&&l in u)?e(u[l],i):!1}return my=a,my}var gy,fE;function Xz(){if(fE)return gy;fE=1;var e=kd(),t=ti(),n=_d(),s=Ao(),a=Object.prototype,i=a.hasOwnProperty,l=e(function(u,f){u=Object(u);var p=-1,h=f.length,g=h>2?f[2]:void 0;for(g&&n(f[0],f[1],g)&&(h=1);++p<h;)for(var v=f[p],w=s(v),N=-1,k=w.length;++N<k;){var S=w[N],_=u[S];(_===void 0||t(_,a[S])&&!i.call(u,S))&&(u[S]=v[S])}return u});return gy=l,gy}var yy,pE;function Qz(){if(pE)return yy;pE=1;var e=os(),t=ss(),n=Fs();function s(a){return function(i,l,u){var f=Object(i);if(!t(i)){var p=e(l,3);i=n(i),l=function(g){return p(f[g],g,f)}}var h=a(i,l,u);return h>-1?f[p?i[h]:h]:void 0}}return yy=s,yy}var vy,mE;function Zz(){if(mE)return vy;mE=1;var e=/\s/;function t(n){for(var s=n.length;s--&&e.test(n.charAt(s)););return s}return vy=t,vy}var wy,gE;function Jz(){if(gE)return wy;gE=1;var e=Zz(),t=/^\s+/;function n(s){return s&&s.slice(0,e(s)+1).replace(t,"")}return wy=n,wy}var xy,yE;function eB(){if(yE)return xy;yE=1;var e=Jz(),t=Un(),n=oi(),s=NaN,a=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,l=/^0o[0-7]+$/i,u=parseInt;function f(p){if(typeof p=="number")return p;if(n(p))return s;if(t(p)){var h=typeof p.valueOf=="function"?p.valueOf():p;p=t(h)?h+"":h}if(typeof p!="string")return p===0?p:+p;p=e(p);var g=i.test(p);return g||l.test(p)?u(p.slice(2),g?2:8):a.test(p)?s:+p}return xy=f,xy}var by,vE;function sA(){if(vE)return by;vE=1;var e=eB(),t=1/0,n=17976931348623157e292;function s(a){if(!a)return a===0?a:0;if(a=e(a),a===t||a===-t){var i=a<0?-1:1;return i*n}return a===a?a:0}return by=s,by}var ky,wE;function tB(){if(wE)return ky;wE=1;var e=sA();function t(n){var s=e(n),a=s%1;return s===s?a?s-a:s:0}return ky=t,ky}var _y,xE;function nB(){if(xE)return _y;xE=1;var e=XR(),t=os(),n=tB(),s=Math.max;function a(i,l,u){var f=i==null?0:i.length;if(!f)return-1;var p=u==null?0:n(u);return p<0&&(p=s(f+p,0)),e(i,t(l,3),p)}return _y=a,_y}var Sy,bE;function rB(){if(bE)return Sy;bE=1;var e=Qz(),t=nB(),n=e(t);return Sy=n,Sy}var Ny,kE;function oA(){if(kE)return Ny;kE=1;var e=f0();function t(n){var s=n==null?0:n.length;return s?e(n,1):[]}return Ny=t,Ny}var Ey,_E;function sB(){if(_E)return Ey;_E=1;var e=c0(),t=TR(),n=Ao();function s(a,i){return a==null?a:e(a,t(i),n)}return Ey=s,Ey}var Cy,SE;function oB(){if(SE)return Cy;SE=1;function e(t){var n=t==null?0:t.length;return n?t[n-1]:void 0}return Cy=e,Cy}var jy,NE;function aB(){if(NE)return jy;NE=1;var e=hd(),t=u0(),n=os();function s(a,i){var l={};return i=n(i,3),t(a,function(u,f,p){e(l,f,i(u,f,p))}),l}return jy=s,jy}var Ty,EE;function m0(){if(EE)return Ty;EE=1;var e=oi();function t(n,s,a){for(var i=-1,l=n.length;++i<l;){var u=n[i],f=s(u);if(f!=null&&(p===void 0?f===f&&!e(f):a(f,p)))var p=f,h=u}return h}return Ty=t,Ty}var Ry,CE;function iB(){if(CE)return Ry;CE=1;function e(t,n){return t>n}return Ry=e,Ry}var Ay,jE;function lB(){if(jE)return Ay;jE=1;var e=m0(),t=iB(),n=Mo();function s(a){return a&&a.length?e(a,n,t):void 0}return Ay=s,Ay}var My,TE;function aA(){if(TE)return My;TE=1;var e=hd(),t=ti();function n(s,a,i){(i!==void 0&&!t(s[a],i)||i===void 0&&!(a in s))&&e(s,a,i)}return My=n,My}var Iy,RE;function cB(){if(RE)return Iy;RE=1;var e=To(),t=yd(),n=Ar(),s="[object Object]",a=Function.prototype,i=Object.prototype,l=a.toString,u=i.hasOwnProperty,f=l.call(Object);function p(h){if(!n(h)||e(h)!=s)return!1;var g=t(h);if(g===null)return!0;var v=u.call(g,"constructor")&&g.constructor;return typeof v=="function"&&v instanceof v&&l.call(v)==f}return Iy=p,Iy}var Oy,AE;function iA(){if(AE)return Oy;AE=1;function e(t,n){if(!(n==="constructor"&&typeof t[n]=="function")&&n!="__proto__")return t[n]}return Oy=e,Oy}var $y,ME;function uB(){if(ME)return $y;ME=1;var e=zl(),t=Ao();function n(s){return e(s,t(s))}return $y=n,$y}var Py,IE;function dB(){if(IE)return Py;IE=1;var e=aA(),t=gR(),n=NR(),s=yR(),a=CR(),i=Bl(),l=It(),u=QR(),f=ri(),p=Fl(),h=Un(),g=cB(),v=Ul(),w=iA(),N=uB();function k(S,_,E,C,j,M,$){var O=w(S,E),z=w(_,E),I=$.get(z);if(I){e(S,E,I);return}var A=M?M(O,z,E+"",S,_,$):void 0,q=A===void 0;if(q){var V=l(z),Y=!V&&f(z),R=!V&&!Y&&v(z);A=z,V||Y||R?l(O)?A=O:u(O)?A=s(O):Y?(q=!1,A=t(z,!0)):R?(q=!1,A=n(z,!0)):A=[]:g(z)||i(z)?(A=O,i(O)?A=N(O):(!h(O)||p(O))&&(A=a(z))):q=!1}q&&($.set(z,A),j(A,z,C,M,$),$.delete(z)),e(S,E,A)}return Py=k,Py}var Ly,OE;function hB(){if(OE)return Ly;OE=1;var e=dd(),t=aA(),n=c0(),s=dB(),a=Un(),i=Ao(),l=iA();function u(f,p,h,g,v){f!==p&&n(p,function(w,N){if(v||(v=new e),a(w))s(f,p,N,h,u,g,v);else{var k=g?g(l(f,N),w,N+"",f,p,v):void 0;k===void 0&&(k=w),t(f,N,k)}},i)}return Ly=u,Ly}var qy,$E;function fB(){if($E)return qy;$E=1;var e=kd(),t=_d();function n(s){return e(function(a,i){var l=-1,u=i.length,f=u>1?i[u-1]:void 0,p=u>2?i[2]:void 0;for(f=s.length>3&&typeof f=="function"?(u--,f):void 0,p&&t(i[0],i[1],p)&&(f=u<3?void 0:f,u=1),a=Object(a);++l<u;){var h=i[l];h&&s(a,h,l,f)}return a})}return qy=n,qy}var Dy,PE;function pB(){if(PE)return Dy;PE=1;var e=hB(),t=fB(),n=t(function(s,a,i){e(s,a,i)});return Dy=n,Dy}var Fy,LE;function lA(){if(LE)return Fy;LE=1;function e(t,n){return t<n}return Fy=e,Fy}var zy,qE;function mB(){if(qE)return zy;qE=1;var e=m0(),t=lA(),n=Mo();function s(a){return a&&a.length?e(a,n,t):void 0}return zy=s,zy}var By,DE;function gB(){if(DE)return By;DE=1;var e=m0(),t=os(),n=lA();function s(a,i){return a&&a.length?e(a,t(i,2),n):void 0}return By=s,By}var Uy,FE;function yB(){if(FE)return Uy;FE=1;var e=hr(),t=function(){return e.Date.now()};return Uy=t,Uy}var Wy,zE;function vB(){if(zE)return Wy;zE=1;var e=fd(),t=xd(),n=pd(),s=Un(),a=Wl();function i(l,u,f,p){if(!s(l))return l;u=t(u,l);for(var h=-1,g=u.length,v=g-1,w=l;w!=null&&++h<g;){var N=a(u[h]),k=f;if(N==="__proto__"||N==="constructor"||N==="prototype")return l;if(h!=v){var S=w[N];k=p?p(S,N,w):void 0,k===void 0&&(k=s(S)?S:n(u[h+1])?[]:{})}e(w,N,k),w=w[N]}return l}return Wy=i,Wy}var Hy,BE;function wB(){if(BE)return Hy;BE=1;var e=bd(),t=vB(),n=xd();function s(a,i,l){for(var u=-1,f=i.length,p={};++u<f;){var h=i[u],g=e(a,h);l(g,h)&&t(p,n(h,a),g)}return p}return Hy=s,Hy}var Gy,UE;function xB(){if(UE)return Gy;UE=1;var e=wB(),t=FR();function n(s,a){return e(s,a,function(i,l){return t(s,l)})}return Gy=n,Gy}var Vy,WE;function bB(){if(WE)return Vy;WE=1;var e=oA(),t=YR(),n=KR();function s(a){return n(t(a,void 0,e),a+"")}return Vy=s,Vy}var Yy,HE;function kB(){if(HE)return Yy;HE=1;var e=xB(),t=bB(),n=t(function(s,a){return s==null?{}:e(s,a)});return Yy=n,Yy}var Ky,GE;function _B(){if(GE)return Ky;GE=1;var e=Math.ceil,t=Math.max;function n(s,a,i,l){for(var u=-1,f=t(e((a-s)/(i||1)),0),p=Array(f);f--;)p[l?f:++u]=s,s+=i;return p}return Ky=n,Ky}var Xy,VE;function SB(){if(VE)return Xy;VE=1;var e=_B(),t=_d(),n=sA();function s(a){return function(i,l,u){return u&&typeof u!="number"&&t(i,l,u)&&(l=u=void 0),i=n(i),l===void 0?(l=i,i=0):l=n(l),u=u===void 0?i<l?1:-1:n(u),e(i,l,u,a)}}return Xy=s,Xy}var Qy,YE;function NB(){if(YE)return Qy;YE=1;var e=SB(),t=e();return Qy=t,Qy}var Zy,KE;function EB(){if(KE)return Zy;KE=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 Jy,XE;function CB(){if(XE)return Jy;XE=1;var e=oi();function t(n,s){if(n!==s){var a=n!==void 0,i=n===null,l=n===n,u=e(n),f=s!==void 0,p=s===null,h=s===s,g=e(s);if(!p&&!g&&!u&&n>s||u&&f&&h&&!p&&!g||i&&f&&h||!a&&h||!l)return 1;if(!i&&!u&&!g&&n<s||g&&a&&l&&!i&&!u||p&&a&&l||!f&&l||!h)return-1}return 0}return Jy=t,Jy}var ev,QE;function jB(){if(QE)return ev;QE=1;var e=CB();function t(n,s,a){for(var i=-1,l=n.criteria,u=s.criteria,f=l.length,p=a.length;++i<f;){var h=e(l[i],u[i]);if(h){if(i>=p)return h;var g=a[i];return h*(g=="desc"?-1:1)}}return n.index-s.index}return ev=t,ev}var tv,ZE;function TB(){if(ZE)return tv;ZE=1;var e=wd(),t=bd(),n=os(),s=HR(),a=EB(),i=md(),l=jB(),u=Mo(),f=It();function p(h,g,v){g.length?g=e(g,function(k){return f(k)?function(S){return t(S,k.length===1?k[0]:k)}:k}):g=[u];var w=-1;g=e(g,i(n));var N=s(h,function(k,S,_){var E=e(g,function(C){return C(k)});return{criteria:E,index:++w,value:k}});return a(N,function(k,S){return l(k,S,v)})}return tv=p,tv}var nv,JE;function RB(){if(JE)return nv;JE=1;var e=f0(),t=TB(),n=kd(),s=_d(),a=n(function(i,l){if(i==null)return[];var u=l.length;return u>1&&s(i,l[0],l[1])?l=[]:u>2&&s(l[0],l[1],l[2])&&(l=[l[0]]),t(i,e(l,1),[])});return nv=a,nv}var rv,eC;function AB(){if(eC)return rv;eC=1;var e=qR(),t=0;function n(s){var a=++t;return e(s)+a}return rv=n,rv}var sv,tC;function MB(){if(tC)return sv;tC=1;function e(t,n,s){for(var a=-1,i=t.length,l=n.length,u={};++a<i;){var f=a<l?n[a]:void 0;s(u,t[a],f)}return u}return sv=e,sv}var ov,nC;function IB(){if(nC)return ov;nC=1;var e=fd(),t=MB();function n(s,a){return t(s||[],a||[],e)}return ov=n,ov}var av,rC;function gt(){if(rC)return av;rC=1;var e;if(typeof Zw=="function")try{e={cloneDeep:Kz(),constant:l0(),defaults:Xz(),each:AR(),filter:BR(),find:rB(),flatten:oA(),forEach:RR(),forIn:sB(),has:UR(),isUndefined:WR(),last:oB(),map:GR(),mapValues:aB(),max:lB(),merge:pB(),min:mB(),minBy:gB(),now:yB(),pick:kB(),range:NB(),reduce:VR(),sortBy:RB(),uniqueId:AB(),values:ZR(),zipObject:IB()}}catch{}return e||(e=window._),av=e,av}var iv,sC;function OB(){if(sC)return iv;sC=1,iv=e;function e(){var s={};s._next=s._prev=s,this._sentinel=s}e.prototype.dequeue=function(){var s=this._sentinel,a=s._prev;if(a!==s)return t(a),a},e.prototype.enqueue=function(s){var a=this._sentinel;s._prev&&s._next&&t(s),s._next=a._next,a._next._prev=s,a._next=s,s._prev=a},e.prototype.toString=function(){for(var s=[],a=this._sentinel,i=a._prev;i!==a;)s.push(JSON.stringify(i,n)),i=i._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,a){if(s!=="_next"&&s!=="_prev")return a}return iv}var lv,oC;function $B(){if(oC)return lv;oC=1;var e=gt(),t=ur().Graph,n=OB();lv=a;var s=e.constant(1);function a(p,h){if(p.nodeCount()<=1)return[];var g=u(p,h||s),v=i(g.graph,g.buckets,g.zeroIdx);return e.flatten(e.map(v,function(w){return p.outEdges(w.v,w.w)}),!0)}function i(p,h,g){for(var v=[],w=h[h.length-1],N=h[0],k;p.nodeCount();){for(;k=N.dequeue();)l(p,h,g,k);for(;k=w.dequeue();)l(p,h,g,k);if(p.nodeCount()){for(var S=h.length-2;S>0;--S)if(k=h[S].dequeue(),k){v=v.concat(l(p,h,g,k,!0));break}}}return v}function l(p,h,g,v,w){var N=w?[]:void 0;return e.forEach(p.inEdges(v.v),function(k){var S=p.edge(k),_=p.node(k.v);w&&N.push({v:k.v,w:k.w}),_.out-=S,f(h,g,_)}),e.forEach(p.outEdges(v.v),function(k){var S=p.edge(k),_=k.w,E=p.node(_);E.in-=S,f(h,g,E)}),p.removeNode(v.v),N}function u(p,h){var g=new t,v=0,w=0;e.forEach(p.nodes(),function(S){g.setNode(S,{v:S,in:0,out:0})}),e.forEach(p.edges(),function(S){var _=g.edge(S.v,S.w)||0,E=h(S),C=_+E;g.setEdge(S.v,S.w,C),w=Math.max(w,g.node(S.v).out+=E),v=Math.max(v,g.node(S.w).in+=E)});var N=e.range(w+v+3).map(function(){return new n}),k=v+1;return e.forEach(g.nodes(),function(S){f(N,k,g.node(S))}),{graph:g,buckets:N,zeroIdx:k}}function f(p,h,g){g.out?g.in?p[g.out-g.in+h].enqueue(g):p[p.length-1].enqueue(g):p[0].enqueue(g)}return lv}var cv,aC;function PB(){if(aC)return cv;aC=1;var e=gt(),t=$B();cv={run:n,undo:a};function n(i){var l=i.graph().acyclicer==="greedy"?t(i,u(i)):s(i);e.forEach(l,function(f){var p=i.edge(f);i.removeEdge(f),p.forwardName=f.name,p.reversed=!0,i.setEdge(f.w,f.v,p,e.uniqueId("rev"))});function u(f){return function(p){return f.edge(p).weight}}}function s(i){var l=[],u={},f={};function p(h){e.has(f,h)||(f[h]=!0,u[h]=!0,e.forEach(i.outEdges(h),function(g){e.has(u,g.w)?l.push(g):p(g.w)}),delete u[h])}return e.forEach(i.nodes(),p),l}function a(i){e.forEach(i.edges(),function(l){var u=i.edge(l);if(u.reversed){i.removeEdge(l);var f=u.forwardName;delete u.reversed,delete u.forwardName,i.setEdge(l.w,l.v,u,f)}})}return cv}var uv,iC;function vn(){if(iC)return uv;iC=1;var e=gt(),t=ur().Graph;uv={addDummyNode:n,simplify:s,asNonCompoundGraph:a,successorWeights:i,predecessorWeights:l,intersectRect:u,buildLayerMatrix:f,normalizeRanks:p,removeEmptyRanks:h,addBorderNode:g,maxRank:v,partition:w,time:N,notime:k};function n(S,_,E,C){var j;do j=e.uniqueId(C);while(S.hasNode(j));return E.dummy=_,S.setNode(j,E),j}function s(S){var _=new t().setGraph(S.graph());return e.forEach(S.nodes(),function(E){_.setNode(E,S.node(E))}),e.forEach(S.edges(),function(E){var C=_.edge(E.v,E.w)||{weight:0,minlen:1},j=S.edge(E);_.setEdge(E.v,E.w,{weight:C.weight+j.weight,minlen:Math.max(C.minlen,j.minlen)})}),_}function a(S){var _=new t({multigraph:S.isMultigraph()}).setGraph(S.graph());return e.forEach(S.nodes(),function(E){S.children(E).length||_.setNode(E,S.node(E))}),e.forEach(S.edges(),function(E){_.setEdge(E,S.edge(E))}),_}function i(S){var _=e.map(S.nodes(),function(E){var C={};return e.forEach(S.outEdges(E),function(j){C[j.w]=(C[j.w]||0)+S.edge(j).weight}),C});return e.zipObject(S.nodes(),_)}function l(S){var _=e.map(S.nodes(),function(E){var C={};return e.forEach(S.inEdges(E),function(j){C[j.v]=(C[j.v]||0)+S.edge(j).weight}),C});return e.zipObject(S.nodes(),_)}function u(S,_){var E=S.x,C=S.y,j=_.x-E,M=_.y-C,$=S.width/2,O=S.height/2;if(!j&&!M)throw new Error("Not possible to find intersection inside of the rectangle");var z,I;return Math.abs(M)*$>Math.abs(j)*O?(M<0&&(O=-O),z=O*j/M,I=O):(j<0&&($=-$),z=$,I=$*M/j),{x:E+z,y:C+I}}function f(S){var _=e.map(e.range(v(S)+1),function(){return[]});return e.forEach(S.nodes(),function(E){var C=S.node(E),j=C.rank;e.isUndefined(j)||(_[j][C.order]=E)}),_}function p(S){var _=e.min(e.map(S.nodes(),function(E){return S.node(E).rank}));e.forEach(S.nodes(),function(E){var C=S.node(E);e.has(C,"rank")&&(C.rank-=_)})}function h(S){var _=e.min(e.map(S.nodes(),function(M){return S.node(M).rank})),E=[];e.forEach(S.nodes(),function(M){var $=S.node(M).rank-_;E[$]||(E[$]=[]),E[$].push(M)});var C=0,j=S.graph().nodeRankFactor;e.forEach(E,function(M,$){e.isUndefined(M)&&$%j!==0?--C:C&&e.forEach(M,function(O){S.node(O).rank+=C})})}function g(S,_,E,C){var j={width:0,height:0};return arguments.length>=4&&(j.rank=E,j.order=C),n(S,"border",j,_)}function v(S){return e.max(e.map(S.nodes(),function(_){var E=S.node(_).rank;if(!e.isUndefined(E))return E}))}function w(S,_){var E={lhs:[],rhs:[]};return e.forEach(S,function(C){_(C)?E.lhs.push(C):E.rhs.push(C)}),E}function N(S,_){var E=e.now();try{return _()}finally{console.log(S+" time: "+(e.now()-E)+"ms")}}function k(S,_){return _()}return uv}var dv,lC;function LB(){if(lC)return dv;lC=1;var e=gt(),t=vn();dv={run:n,undo:a};function n(i){i.graph().dummyChains=[],e.forEach(i.edges(),function(l){s(i,l)})}function s(i,l){var u=l.v,f=i.node(u).rank,p=l.w,h=i.node(p).rank,g=l.name,v=i.edge(l),w=v.labelRank;if(h!==f+1){i.removeEdge(l);var N,k,S;for(S=0,++f;f<h;++S,++f)v.points=[],k={width:0,height:0,edgeLabel:v,edgeObj:l,rank:f},N=t.addDummyNode(i,"edge",k,"_d"),f===w&&(k.width=v.width,k.height=v.height,k.dummy="edge-label",k.labelpos=v.labelpos),i.setEdge(u,N,{weight:v.weight},g),S===0&&i.graph().dummyChains.push(N),u=N;i.setEdge(u,p,{weight:v.weight},g)}}function a(i){e.forEach(i.graph().dummyChains,function(l){var u=i.node(l),f=u.edgeLabel,p;for(i.setEdge(u.edgeObj,f);u.dummy;)p=i.successors(l)[0],i.removeNode(l),f.points.push({x:u.x,y:u.y}),u.dummy==="edge-label"&&(f.x=u.x,f.y=u.y,f.width=u.width,f.height=u.height),l=p,u=i.node(l)})}return dv}var hv,cC;function Vu(){if(cC)return hv;cC=1;var e=gt();hv={longestPath:t,slack:n};function t(s){var a={};function i(l){var u=s.node(l);if(e.has(a,l))return u.rank;a[l]=!0;var f=e.min(e.map(s.outEdges(l),function(p){return i(p.w)-s.edge(p).minlen}));return(f===Number.POSITIVE_INFINITY||f===void 0||f===null)&&(f=0),u.rank=f}e.forEach(s.sources(),i)}function n(s,a){return s.node(a.w).rank-s.node(a.v).rank-s.edge(a).minlen}return hv}var fv,uC;function cA(){if(uC)return fv;uC=1;var e=gt(),t=ur().Graph,n=Vu().slack;fv=s;function s(u){var f=new t({directed:!1}),p=u.nodes()[0],h=u.nodeCount();f.setNode(p,{});for(var g,v;a(f,u)<h;)g=i(f,u),v=f.hasNode(g.v)?n(u,g):-n(u,g),l(f,u,v);return f}function a(u,f){function p(h){e.forEach(f.nodeEdges(h),function(g){var v=g.v,w=h===v?g.w:v;!u.hasNode(w)&&!n(f,g)&&(u.setNode(w,{}),u.setEdge(h,w,{}),p(w))})}return e.forEach(u.nodes(),p),u.nodeCount()}function i(u,f){return e.minBy(f.edges(),function(p){if(u.hasNode(p.v)!==u.hasNode(p.w))return n(f,p)})}function l(u,f,p){e.forEach(u.nodes(),function(h){f.node(h).rank+=p})}return fv}var pv,dC;function qB(){if(dC)return pv;dC=1;var e=gt(),t=cA(),n=Vu().slack,s=Vu().longestPath,a=ur().alg.preorder,i=ur().alg.postorder,l=vn().simplify;pv=u,u.initLowLimValues=g,u.initCutValues=f,u.calcCutValue=h,u.leaveEdge=w,u.enterEdge=N,u.exchangeEdges=k;function u(C){C=l(C),s(C);var j=t(C);g(j),f(j,C);for(var M,$;M=w(j);)$=N(j,C,M),k(j,C,M,$)}function f(C,j){var M=i(C,C.nodes());M=M.slice(0,M.length-1),e.forEach(M,function($){p(C,j,$)})}function p(C,j,M){var $=C.node(M),O=$.parent;C.edge(M,O).cutvalue=h(C,j,M)}function h(C,j,M){var $=C.node(M),O=$.parent,z=!0,I=j.edge(M,O),A=0;return I||(z=!1,I=j.edge(O,M)),A=I.weight,e.forEach(j.nodeEdges(M),function(q){var V=q.v===M,Y=V?q.w:q.v;if(Y!==O){var R=V===z,X=j.edge(q).weight;if(A+=R?X:-X,_(C,M,Y)){var B=C.edge(M,Y).cutvalue;A+=R?-B:B}}}),A}function g(C,j){arguments.length<2&&(j=C.nodes()[0]),v(C,{},1,j)}function v(C,j,M,$,O){var z=M,I=C.node($);return j[$]=!0,e.forEach(C.neighbors($),function(A){e.has(j,A)||(M=v(C,j,M,A,$))}),I.low=z,I.lim=M++,O?I.parent=O:delete I.parent,M}function w(C){return e.find(C.edges(),function(j){return C.edge(j).cutvalue<0})}function N(C,j,M){var $=M.v,O=M.w;j.hasEdge($,O)||($=M.w,O=M.v);var z=C.node($),I=C.node(O),A=z,q=!1;z.lim>I.lim&&(A=I,q=!0);var V=e.filter(j.edges(),function(Y){return q===E(C,C.node(Y.v),A)&&q!==E(C,C.node(Y.w),A)});return e.minBy(V,function(Y){return n(j,Y)})}function k(C,j,M,$){var O=M.v,z=M.w;C.removeEdge(O,z),C.setEdge($.v,$.w,{}),g(C),f(C,j),S(C,j)}function S(C,j){var M=e.find(C.nodes(),function(O){return!j.node(O).parent}),$=a(C,M);$=$.slice(1),e.forEach($,function(O){var z=C.node(O).parent,I=j.edge(O,z),A=!1;I||(I=j.edge(z,O),A=!0),j.node(O).rank=j.node(z).rank+(A?I.minlen:-I.minlen)})}function _(C,j,M){return C.hasEdge(j,M)}function E(C,j,M){return M.low<=j.lim&&j.lim<=M.lim}return pv}var mv,hC;function DB(){if(hC)return mv;hC=1;var e=Vu(),t=e.longestPath,n=cA(),s=qB();mv=a;function a(f){switch(f.graph().ranker){case"network-simplex":u(f);break;case"tight-tree":l(f);break;case"longest-path":i(f);break;default:u(f)}}var i=t;function l(f){t(f),n(f)}function u(f){s(f)}return mv}var gv,fC;function FB(){if(fC)return gv;fC=1;var e=gt();gv=t;function t(a){var i=s(a);e.forEach(a.graph().dummyChains,function(l){for(var u=a.node(l),f=u.edgeObj,p=n(a,i,f.v,f.w),h=p.path,g=p.lca,v=0,w=h[v],N=!0;l!==f.w;){if(u=a.node(l),N){for(;(w=h[v])!==g&&a.node(w).maxRank<u.rank;)v++;w===g&&(N=!1)}if(!N){for(;v<h.length-1&&a.node(w=h[v+1]).minRank<=u.rank;)v++;w=h[v]}a.setParent(l,w),l=a.successors(l)[0]}})}function n(a,i,l,u){var f=[],p=[],h=Math.min(i[l].low,i[u].low),g=Math.max(i[l].lim,i[u].lim),v,w;v=l;do v=a.parent(v),f.push(v);while(v&&(i[v].low>h||g>i[v].lim));for(w=v,v=u;(v=a.parent(v))!==w;)p.push(v);return{path:f.concat(p.reverse()),lca:w}}function s(a){var i={},l=0;function u(f){var p=l;e.forEach(a.children(f),u),i[f]={low:p,lim:l++}}return e.forEach(a.children(),u),i}return gv}var yv,pC;function zB(){if(pC)return yv;pC=1;var e=gt(),t=vn();yv={run:n,cleanup:l};function n(u){var f=t.addDummyNode(u,"root",{},"_root"),p=a(u),h=e.max(e.values(p))-1,g=2*h+1;u.graph().nestingRoot=f,e.forEach(u.edges(),function(w){u.edge(w).minlen*=g});var v=i(u)+1;e.forEach(u.children(),function(w){s(u,f,g,v,h,p,w)}),u.graph().nodeRankFactor=g}function s(u,f,p,h,g,v,w){var N=u.children(w);if(!N.length){w!==f&&u.setEdge(f,w,{weight:0,minlen:p});return}var k=t.addBorderNode(u,"_bt"),S=t.addBorderNode(u,"_bb"),_=u.node(w);u.setParent(k,w),_.borderTop=k,u.setParent(S,w),_.borderBottom=S,e.forEach(N,function(E){s(u,f,p,h,g,v,E);var C=u.node(E),j=C.borderTop?C.borderTop:E,M=C.borderBottom?C.borderBottom:E,$=C.borderTop?h:2*h,O=j!==M?1:g-v[w]+1;u.setEdge(k,j,{weight:$,minlen:O,nestingEdge:!0}),u.setEdge(M,S,{weight:$,minlen:O,nestingEdge:!0})}),u.parent(w)||u.setEdge(f,k,{weight:0,minlen:g+v[w]})}function a(u){var f={};function p(h,g){var v=u.children(h);v&&v.length&&e.forEach(v,function(w){p(w,g+1)}),f[h]=g}return e.forEach(u.children(),function(h){p(h,1)}),f}function i(u){return e.reduce(u.edges(),function(f,p){return f+u.edge(p).weight},0)}function l(u){var f=u.graph();u.removeNode(f.nestingRoot),delete f.nestingRoot,e.forEach(u.edges(),function(p){var h=u.edge(p);h.nestingEdge&&u.removeEdge(p)})}return yv}var vv,mC;function BB(){if(mC)return vv;mC=1;var e=gt(),t=vn();vv=n;function n(a){function i(l){var u=a.children(l),f=a.node(l);if(u.length&&e.forEach(u,i),e.has(f,"minRank")){f.borderLeft=[],f.borderRight=[];for(var p=f.minRank,h=f.maxRank+1;p<h;++p)s(a,"borderLeft","_bl",l,f,p),s(a,"borderRight","_br",l,f,p)}}e.forEach(a.children(),i)}function s(a,i,l,u,f,p){var h={width:0,height:0,rank:p,borderType:i},g=f[i][p-1],v=t.addDummyNode(a,"border",h,l);f[i][p]=v,a.setParent(v,u),g&&a.setEdge(g,v,{weight:1})}return vv}var wv,gC;function UB(){if(gC)return wv;gC=1;var e=gt();wv={adjust:t,undo:n};function t(p){var h=p.graph().rankdir.toLowerCase();(h==="lr"||h==="rl")&&s(p)}function n(p){var h=p.graph().rankdir.toLowerCase();(h==="bt"||h==="rl")&&i(p),(h==="lr"||h==="rl")&&(u(p),s(p))}function s(p){e.forEach(p.nodes(),function(h){a(p.node(h))}),e.forEach(p.edges(),function(h){a(p.edge(h))})}function a(p){var h=p.width;p.width=p.height,p.height=h}function i(p){e.forEach(p.nodes(),function(h){l(p.node(h))}),e.forEach(p.edges(),function(h){var g=p.edge(h);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(h){f(p.node(h))}),e.forEach(p.edges(),function(h){var g=p.edge(h);e.forEach(g.points,f),e.has(g,"x")&&f(g)})}function f(p){var h=p.x;p.x=p.y,p.y=h}return wv}var xv,yC;function WB(){if(yC)return xv;yC=1;var e=gt();xv=t;function t(n){var s={},a=e.filter(n.nodes(),function(p){return!n.children(p).length}),i=e.max(e.map(a,function(p){return n.node(p).rank})),l=e.map(e.range(i+1),function(){return[]});function u(p){if(!e.has(s,p)){s[p]=!0;var h=n.node(p);l[h.rank].push(p),e.forEach(n.successors(p),u)}}var f=e.sortBy(a,function(p){return n.node(p).rank});return e.forEach(f,u),l}return xv}var bv,vC;function HB(){if(vC)return bv;vC=1;var e=gt();bv=t;function t(s,a){for(var i=0,l=1;l<a.length;++l)i+=n(s,a[l-1],a[l]);return i}function n(s,a,i){for(var l=e.zipObject(i,e.map(i,function(v,w){return w})),u=e.flatten(e.map(a,function(v){return e.sortBy(e.map(s.outEdges(v),function(w){return{pos:l[w.w],weight:s.edge(w).weight}}),"pos")}),!0),f=1;f<i.length;)f<<=1;var p=2*f-1;f-=1;var h=e.map(new Array(p),function(){return 0}),g=0;return e.forEach(u.forEach(function(v){var w=v.pos+f;h[w]+=v.weight;for(var N=0;w>0;)w%2&&(N+=h[w+1]),w=w-1>>1,h[w]+=v.weight;g+=v.weight*N})),g}return bv}var kv,wC;function GB(){if(wC)return kv;wC=1;var e=gt();kv=t;function t(n,s){return e.map(s,function(a){var i=n.inEdges(a);if(i.length){var l=e.reduce(i,function(u,f){var p=n.edge(f),h=n.node(f.v);return{sum:u.sum+p.weight*h.order,weight:u.weight+p.weight}},{sum:0,weight:0});return{v:a,barycenter:l.sum/l.weight,weight:l.weight}}else return{v:a}})}return kv}var _v,xC;function VB(){if(xC)return _v;xC=1;var e=gt();_v=t;function t(a,i){var l={};e.forEach(a,function(f,p){var h=l[f.v]={indegree:0,in:[],out:[],vs:[f.v],i:p};e.isUndefined(f.barycenter)||(h.barycenter=f.barycenter,h.weight=f.weight)}),e.forEach(i.edges(),function(f){var p=l[f.v],h=l[f.w];!e.isUndefined(p)&&!e.isUndefined(h)&&(h.indegree++,p.out.push(l[f.w]))});var u=e.filter(l,function(f){return!f.indegree});return n(u)}function n(a){var i=[];function l(p){return function(h){h.merged||(e.isUndefined(h.barycenter)||e.isUndefined(p.barycenter)||h.barycenter>=p.barycenter)&&s(p,h)}}function u(p){return function(h){h.in.push(p),--h.indegree===0&&a.push(h)}}for(;a.length;){var f=a.pop();i.push(f),e.forEach(f.in.reverse(),l(f)),e.forEach(f.out,u(f))}return e.map(e.filter(i,function(p){return!p.merged}),function(p){return e.pick(p,["vs","i","barycenter","weight"])})}function s(a,i){var l=0,u=0;a.weight&&(l+=a.barycenter*a.weight,u+=a.weight),i.weight&&(l+=i.barycenter*i.weight,u+=i.weight),a.vs=i.vs.concat(a.vs),a.barycenter=l/u,a.weight=u,a.i=Math.min(i.i,a.i),i.merged=!0}return _v}var Sv,bC;function YB(){if(bC)return Sv;bC=1;var e=gt(),t=vn();Sv=n;function n(i,l){var u=t.partition(i,function(k){return e.has(k,"barycenter")}),f=u.lhs,p=e.sortBy(u.rhs,function(k){return-k.i}),h=[],g=0,v=0,w=0;f.sort(a(!!l)),w=s(h,p,w),e.forEach(f,function(k){w+=k.vs.length,h.push(k.vs),g+=k.barycenter*k.weight,v+=k.weight,w=s(h,p,w)});var N={vs:e.flatten(h,!0)};return v&&(N.barycenter=g/v,N.weight=v),N}function s(i,l,u){for(var f;l.length&&(f=e.last(l)).i<=u;)l.pop(),i.push(f.vs),u++;return u}function a(i){return function(l,u){return l.barycenter<u.barycenter?-1:l.barycenter>u.barycenter?1:i?u.i-l.i:l.i-u.i}}return Sv}var Nv,kC;function KB(){if(kC)return Nv;kC=1;var e=gt(),t=GB(),n=VB(),s=YB();Nv=a;function a(u,f,p,h){var g=u.children(f),v=u.node(f),w=v?v.borderLeft:void 0,N=v?v.borderRight:void 0,k={};w&&(g=e.filter(g,function(M){return M!==w&&M!==N}));var S=t(u,g);e.forEach(S,function(M){if(u.children(M.v).length){var $=a(u,M.v,p,h);k[M.v]=$,e.has($,"barycenter")&&l(M,$)}});var _=n(S,p);i(_,k);var E=s(_,h);if(w&&(E.vs=e.flatten([w,E.vs,N],!0),u.predecessors(w).length)){var C=u.node(u.predecessors(w)[0]),j=u.node(u.predecessors(N)[0]);e.has(E,"barycenter")||(E.barycenter=0,E.weight=0),E.barycenter=(E.barycenter*E.weight+C.order+j.order)/(E.weight+2),E.weight+=2}return E}function i(u,f){e.forEach(u,function(p){p.vs=e.flatten(p.vs.map(function(h){return f[h]?f[h].vs:h}),!0)})}function l(u,f){e.isUndefined(u.barycenter)?(u.barycenter=f.barycenter,u.weight=f.weight):(u.barycenter=(u.barycenter*u.weight+f.barycenter*f.weight)/(u.weight+f.weight),u.weight+=f.weight)}return Nv}var Ev,_C;function XB(){if(_C)return Ev;_C=1;var e=gt(),t=ur().Graph;Ev=n;function n(a,i,l){var u=s(a),f=new t({compound:!0}).setGraph({root:u}).setDefaultNodeLabel(function(p){return a.node(p)});return e.forEach(a.nodes(),function(p){var h=a.node(p),g=a.parent(p);(h.rank===i||h.minRank<=i&&i<=h.maxRank)&&(f.setNode(p),f.setParent(p,g||u),e.forEach(a[l](p),function(v){var w=v.v===p?v.w:v.v,N=f.edge(w,p),k=e.isUndefined(N)?0:N.weight;f.setEdge(w,p,{weight:a.edge(v).weight+k})}),e.has(h,"minRank")&&f.setNode(p,{borderLeft:h.borderLeft[i],borderRight:h.borderRight[i]}))}),f}function s(a){for(var i;a.hasNode(i=e.uniqueId("_root")););return i}return Ev}var Cv,SC;function QB(){if(SC)return Cv;SC=1;var e=gt();Cv=t;function t(n,s,a){var i={},l;e.forEach(a,function(u){for(var f=n.parent(u),p,h;f;){if(p=n.parent(f),p?(h=i[p],i[p]=f):(h=l,l=f),h&&h!==f){s.setEdge(h,f);return}f=p}})}return Cv}var jv,NC;function ZB(){if(NC)return jv;NC=1;var e=gt(),t=WB(),n=HB(),s=KB(),a=XB(),i=QB(),l=ur().Graph,u=vn();jv=f;function f(v){var w=u.maxRank(v),N=p(v,e.range(1,w+1),"inEdges"),k=p(v,e.range(w-1,-1,-1),"outEdges"),S=t(v);g(v,S);for(var _=Number.POSITIVE_INFINITY,E,C=0,j=0;j<4;++C,++j){h(C%2?N:k,C%4>=2),S=u.buildLayerMatrix(v);var M=n(v,S);M<_&&(j=0,E=e.cloneDeep(S),_=M)}g(v,E)}function p(v,w,N){return e.map(w,function(k){return a(v,k,N)})}function h(v,w){var N=new l;e.forEach(v,function(k){var S=k.graph().root,_=s(k,S,N,w);e.forEach(_.vs,function(E,C){k.node(E).order=C}),i(k,N,_.vs)})}function g(v,w){e.forEach(w,function(N){e.forEach(N,function(k,S){v.node(k).order=S})})}return jv}var Tv,EC;function JB(){if(EC)return Tv;EC=1;var e=gt(),t=ur().Graph,n=vn();Tv={positionX:N,findType1Conflicts:s,findType2Conflicts:a,addConflict:l,hasConflict:u,verticalAlignment:f,horizontalCompaction:p,alignCoordinates:v,findSmallestWidthAlignment:g,balance:w};function s(_,E){var C={};function j(M,$){var O=0,z=0,I=M.length,A=e.last($);return e.forEach($,function(q,V){var Y=i(_,q),R=Y?_.node(Y).order:I;(Y||q===A)&&(e.forEach($.slice(z,V+1),function(X){e.forEach(_.predecessors(X),function(B){var ne=_.node(B),Z=ne.order;(Z<O||R<Z)&&!(ne.dummy&&_.node(X).dummy)&&l(C,B,X)})}),z=V+1,O=R)}),$}return e.reduce(E,j),C}function a(_,E){var C={};function j($,O,z,I,A){var q;e.forEach(e.range(O,z),function(V){q=$[V],_.node(q).dummy&&e.forEach(_.predecessors(q),function(Y){var R=_.node(Y);R.dummy&&(R.order<I||R.order>A)&&l(C,Y,q)})})}function M($,O){var z=-1,I,A=0;return e.forEach(O,function(q,V){if(_.node(q).dummy==="border"){var Y=_.predecessors(q);Y.length&&(I=_.node(Y[0]).order,j(O,A,V,z,I),A=V,z=I)}j(O,A,O.length,I,$.length)}),O}return e.reduce(E,M),C}function i(_,E){if(_.node(E).dummy)return e.find(_.predecessors(E),function(C){return _.node(C).dummy})}function l(_,E,C){if(E>C){var j=E;E=C,C=j}var M=_[E];M||(_[E]=M={}),M[C]=!0}function u(_,E,C){if(E>C){var j=E;E=C,C=j}return e.has(_[E],C)}function f(_,E,C,j){var M={},$={},O={};return e.forEach(E,function(z){e.forEach(z,function(I,A){M[I]=I,$[I]=I,O[I]=A})}),e.forEach(E,function(z){var I=-1;e.forEach(z,function(A){var q=j(A);if(q.length){q=e.sortBy(q,function(B){return O[B]});for(var V=(q.length-1)/2,Y=Math.floor(V),R=Math.ceil(V);Y<=R;++Y){var X=q[Y];$[A]===A&&I<O[X]&&!u(C,A,X)&&($[X]=A,$[A]=M[A]=M[X],I=O[X])}}})}),{root:M,align:$}}function p(_,E,C,j,M){var $={},O=h(_,E,C,M),z=M?"borderLeft":"borderRight";function I(V,Y){for(var R=O.nodes(),X=R.pop(),B={};X;)B[X]?V(X):(B[X]=!0,R.push(X),R=R.concat(Y(X))),X=R.pop()}function A(V){$[V]=O.inEdges(V).reduce(function(Y,R){return Math.max(Y,$[R.v]+O.edge(R))},0)}function q(V){var Y=O.outEdges(V).reduce(function(X,B){return Math.min(X,$[B.w]-O.edge(B))},Number.POSITIVE_INFINITY),R=_.node(V);Y!==Number.POSITIVE_INFINITY&&R.borderType!==z&&($[V]=Math.max($[V],Y))}return I(A,O.predecessors.bind(O)),I(q,O.successors.bind(O)),e.forEach(j,function(V){$[V]=$[C[V]]}),$}function h(_,E,C,j){var M=new t,$=_.graph(),O=k($.nodesep,$.edgesep,j);return e.forEach(E,function(z){var I;e.forEach(z,function(A){var q=C[A];if(M.setNode(q),I){var V=C[I],Y=M.edge(V,q);M.setEdge(V,q,Math.max(O(_,A,I),Y||0))}I=A})}),M}function g(_,E){return e.minBy(e.values(E),function(C){var j=Number.NEGATIVE_INFINITY,M=Number.POSITIVE_INFINITY;return e.forIn(C,function($,O){var z=S(_,O)/2;j=Math.max($+z,j),M=Math.min($-z,M)}),j-M})}function v(_,E){var C=e.values(E),j=e.min(C),M=e.max(C);e.forEach(["u","d"],function($){e.forEach(["l","r"],function(O){var z=$+O,I=_[z],A;if(I!==E){var q=e.values(I);A=O==="l"?j-e.min(q):M-e.max(q),A&&(_[z]=e.mapValues(I,function(V){return V+A}))}})})}function w(_,E){return e.mapValues(_.ul,function(C,j){if(E)return _[E.toLowerCase()][j];var M=e.sortBy(e.map(_,j));return(M[1]+M[2])/2})}function N(_){var E=n.buildLayerMatrix(_),C=e.merge(s(_,E),a(_,E)),j={},M;e.forEach(["u","d"],function(O){M=O==="u"?E:e.values(E).reverse(),e.forEach(["l","r"],function(z){z==="r"&&(M=e.map(M,function(V){return e.values(V).reverse()}));var I=(O==="u"?_.predecessors:_.successors).bind(_),A=f(_,M,C,I),q=p(_,M,A.root,A.align,z==="r");z==="r"&&(q=e.mapValues(q,function(V){return-V})),j[O+z]=q})});var $=g(_,j);return v(j,$),w(j,_.graph().align)}function k(_,E,C){return function(j,M,$){var O=j.node(M),z=j.node($),I=0,A;if(I+=O.width/2,e.has(O,"labelpos"))switch(O.labelpos.toLowerCase()){case"l":A=-O.width/2;break;case"r":A=O.width/2;break}if(A&&(I+=C?A:-A),A=0,I+=(O.dummy?E:_)/2,I+=(z.dummy?E:_)/2,I+=z.width/2,e.has(z,"labelpos"))switch(z.labelpos.toLowerCase()){case"l":A=z.width/2;break;case"r":A=-z.width/2;break}return A&&(I+=C?A:-A),A=0,I}}function S(_,E){return _.node(E).width}return Tv}var Rv,CC;function e8(){if(CC)return Rv;CC=1;var e=gt(),t=vn(),n=JB().positionX;Rv=s;function s(i){i=t.asNonCompoundGraph(i),a(i),e.forEach(n(i),function(l,u){i.node(u).x=l})}function a(i){var l=t.buildLayerMatrix(i),u=i.graph().ranksep,f=0;e.forEach(l,function(p){var h=e.max(e.map(p,function(g){return i.node(g).height}));e.forEach(p,function(g){i.node(g).y=f+h/2}),f+=h+u})}return Rv}var Av,jC;function t8(){if(jC)return Av;jC=1;var e=gt(),t=PB(),n=LB(),s=DB(),a=vn().normalizeRanks,i=FB(),l=vn().removeEmptyRanks,u=zB(),f=BB(),p=UB(),h=ZB(),g=e8(),v=vn(),w=ur().Graph;Av=N;function N(D,L){var Q=L&&L.debugTiming?v.time:v.notime;Q("layout",function(){var U=Q(" buildLayoutGraph",function(){return I(D)});Q(" runLayout",function(){k(U,Q)}),Q(" updateInputGraph",function(){S(D,U)})})}function k(D,L){L(" makeSpaceForEdgeLabels",function(){A(D)}),L(" removeSelfEdges",function(){W(D)}),L(" acyclic",function(){t.run(D)}),L(" nestingGraph.run",function(){u.run(D)}),L(" rank",function(){s(v.asNonCompoundGraph(D))}),L(" injectEdgeLabelProxies",function(){q(D)}),L(" removeEmptyRanks",function(){l(D)}),L(" nestingGraph.cleanup",function(){u.cleanup(D)}),L(" normalizeRanks",function(){a(D)}),L(" assignRankMinMax",function(){V(D)}),L(" removeEdgeLabelProxies",function(){Y(D)}),L(" normalize.run",function(){n.run(D)}),L(" parentDummyChains",function(){i(D)}),L(" addBorderSegments",function(){f(D)}),L(" order",function(){h(D)}),L(" insertSelfEdges",function(){J(D)}),L(" adjustCoordinateSystem",function(){p.adjust(D)}),L(" position",function(){g(D)}),L(" positionSelfEdges",function(){P(D)}),L(" removeBorderNodes",function(){Z(D)}),L(" normalize.undo",function(){n.undo(D)}),L(" fixupEdgeLabelCoords",function(){B(D)}),L(" undoCoordinateSystem",function(){p.undo(D)}),L(" translateGraph",function(){R(D)}),L(" assignNodeIntersects",function(){X(D)}),L(" reversePoints",function(){ne(D)}),L(" acyclic.undo",function(){t.undo(D)})}function S(D,L){e.forEach(D.nodes(),function(Q){var U=D.node(Q),ie=L.node(Q);U&&(U.x=ie.x,U.y=ie.y,L.children(Q).length&&(U.width=ie.width,U.height=ie.height))}),e.forEach(D.edges(),function(Q){var U=D.edge(Q),ie=L.edge(Q);U.points=ie.points,e.has(ie,"x")&&(U.x=ie.x,U.y=ie.y)}),D.graph().width=L.graph().width,D.graph().height=L.graph().height}var _=["nodesep","edgesep","ranksep","marginx","marginy"],E={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},C=["acyclicer","ranker","rankdir","align"],j=["width","height"],M={width:0,height:0},$=["minlen","weight","width","height","labeloffset"],O={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},z=["labelpos"];function I(D){var L=new w({multigraph:!0,compound:!0}),Q=te(D.graph());return L.setGraph(e.merge({},E,K(Q,_),e.pick(Q,C))),e.forEach(D.nodes(),function(U){var ie=te(D.node(U));L.setNode(U,e.defaults(K(ie,j),M)),L.setParent(U,D.parent(U))}),e.forEach(D.edges(),function(U){var ie=te(D.edge(U));L.setEdge(U,e.merge({},O,K(ie,$),e.pick(ie,z)))}),L}function A(D){var L=D.graph();L.ranksep/=2,e.forEach(D.edges(),function(Q){var U=D.edge(Q);U.minlen*=2,U.labelpos.toLowerCase()!=="c"&&(L.rankdir==="TB"||L.rankdir==="BT"?U.width+=U.labeloffset:U.height+=U.labeloffset)})}function q(D){e.forEach(D.edges(),function(L){var Q=D.edge(L);if(Q.width&&Q.height){var U=D.node(L.v),ie=D.node(L.w),fe={rank:(ie.rank-U.rank)/2+U.rank,e:L};v.addDummyNode(D,"edge-proxy",fe,"_ep")}})}function V(D){var L=0;e.forEach(D.nodes(),function(Q){var U=D.node(Q);U.borderTop&&(U.minRank=D.node(U.borderTop).rank,U.maxRank=D.node(U.borderBottom).rank,L=e.max(L,U.maxRank))}),D.graph().maxRank=L}function Y(D){e.forEach(D.nodes(),function(L){var Q=D.node(L);Q.dummy==="edge-proxy"&&(D.edge(Q.e).labelRank=Q.rank,D.removeNode(L))})}function R(D){var L=Number.POSITIVE_INFINITY,Q=0,U=Number.POSITIVE_INFINITY,ie=0,fe=D.graph(),me=fe.marginx||0,ke=fe.marginy||0;function Ve(Le){var De=Le.x,Ne=Le.y,Ge=Le.width,be=Le.height;L=Math.min(L,De-Ge/2),Q=Math.max(Q,De+Ge/2),U=Math.min(U,Ne-be/2),ie=Math.max(ie,Ne+be/2)}e.forEach(D.nodes(),function(Le){Ve(D.node(Le))}),e.forEach(D.edges(),function(Le){var De=D.edge(Le);e.has(De,"x")&&Ve(De)}),L-=me,U-=ke,e.forEach(D.nodes(),function(Le){var De=D.node(Le);De.x-=L,De.y-=U}),e.forEach(D.edges(),function(Le){var De=D.edge(Le);e.forEach(De.points,function(Ne){Ne.x-=L,Ne.y-=U}),e.has(De,"x")&&(De.x-=L),e.has(De,"y")&&(De.y-=U)}),fe.width=Q-L+me,fe.height=ie-U+ke}function X(D){e.forEach(D.edges(),function(L){var Q=D.edge(L),U=D.node(L.v),ie=D.node(L.w),fe,me;Q.points?(fe=Q.points[0],me=Q.points[Q.points.length-1]):(Q.points=[],fe=ie,me=U),Q.points.unshift(v.intersectRect(U,fe)),Q.points.push(v.intersectRect(ie,me))})}function B(D){e.forEach(D.edges(),function(L){var Q=D.edge(L);if(e.has(Q,"x"))switch((Q.labelpos==="l"||Q.labelpos==="r")&&(Q.width-=Q.labeloffset),Q.labelpos){case"l":Q.x-=Q.width/2+Q.labeloffset;break;case"r":Q.x+=Q.width/2+Q.labeloffset;break}})}function ne(D){e.forEach(D.edges(),function(L){var Q=D.edge(L);Q.reversed&&Q.points.reverse()})}function Z(D){e.forEach(D.nodes(),function(L){if(D.children(L).length){var Q=D.node(L),U=D.node(Q.borderTop),ie=D.node(Q.borderBottom),fe=D.node(e.last(Q.borderLeft)),me=D.node(e.last(Q.borderRight));Q.width=Math.abs(me.x-fe.x),Q.height=Math.abs(ie.y-U.y),Q.x=fe.x+Q.width/2,Q.y=U.y+Q.height/2}}),e.forEach(D.nodes(),function(L){D.node(L).dummy==="border"&&D.removeNode(L)})}function W(D){e.forEach(D.edges(),function(L){if(L.v===L.w){var Q=D.node(L.v);Q.selfEdges||(Q.selfEdges=[]),Q.selfEdges.push({e:L,label:D.edge(L)}),D.removeEdge(L)}})}function J(D){var L=v.buildLayerMatrix(D);e.forEach(L,function(Q){var U=0;e.forEach(Q,function(ie,fe){var me=D.node(ie);me.order=fe+U,e.forEach(me.selfEdges,function(ke){v.addDummyNode(D,"selfedge",{width:ke.label.width,height:ke.label.height,rank:me.rank,order:fe+ ++U,e:ke.e,label:ke.label},"_se")}),delete me.selfEdges})})}function P(D){e.forEach(D.nodes(),function(L){var Q=D.node(L);if(Q.dummy==="selfedge"){var U=D.node(Q.e.v),ie=U.x+U.width/2,fe=U.y,me=Q.x-ie,ke=U.height/2;D.setEdge(Q.e,Q.label),D.removeNode(L),Q.label.points=[{x:ie+2*me/3,y:fe-ke},{x:ie+5*me/6,y:fe-ke},{x:ie+me,y:fe},{x:ie+5*me/6,y:fe+ke},{x:ie+2*me/3,y:fe+ke}],Q.label.x=Q.x,Q.label.y=Q.y}})}function K(D,L){return e.mapValues(e.pick(D,L),Number)}function te(D){var L={};return e.forEach(D,function(Q,U){L[U.toLowerCase()]=Q}),L}return Av}var Mv,TC;function n8(){if(TC)return Mv;TC=1;var e=gt(),t=vn(),n=ur().Graph;Mv={debugOrdering:s};function s(a){var i=t.buildLayerMatrix(a),l=new n({compound:!0,multigraph:!0}).setGraph({});return e.forEach(a.nodes(),function(u){l.setNode(u,{label:u}),l.setParent(u,"layer"+a.node(u).rank)}),e.forEach(a.edges(),function(u){l.setEdge(u.v,u.w,{},u.name)}),e.forEach(i,function(u,f){var p="layer"+f;l.setNode(p,{rank:"same"}),e.reduce(u,function(h,g){return l.setEdge(h,g,{style:"invis"}),g})}),l}return Mv}var Iv,RC;function r8(){return RC||(RC=1,Iv="0.8.5"),Iv}var Ov,AC;function s8(){return AC||(AC=1,Ov={graphlib:ur(),layout:t8(),debug:n8(),util:{time:vn().time,notime:vn().notime},version:r8()}),Ov}var o8=s8();const MC=ww(o8),Za=240,Yu=130,Ua=74,Sd=72,IC=Ua+Sd;function a8(e,t){var s;let n=Za;for(const a of e)n=Math.max(n,((s=t.get(a.id))==null?void 0:s.width)??Za);return n}const uA=420,i8=2;function Cl(e){var n;return((n=e.data)==null?void 0:n.sessionId)??"_default"}function l8(e,t){return((t==null?void 0:t.get(e))??0)>0?uA:0}function c8(e,t){const n=(t==null?void 0:t.get(e))??0;return n>0?6+n*36:0}function jl(e,t,n){const s=t.get(e);return{w:((s==null?void 0:s.width)??Za)+l8(e,n),h:Math.max((s==null?void 0:s.height)??Yu,c8(e,n))}}function u8(e){return[...e.keys()].sort().map(t=>`${t}:${e.get(t)}`).join("|")}function d8(e,t,n,s,a,i){const l=new MC.graphlib.Graph;l.setDefaultEdgeLabel(()=>({})),l.setGraph({rankdir:n,marginx:0,marginy:0,nodesep:70,ranksep:160,edgesep:30});const u=e.filter(_=>!a.has(_)),f=new Set(u);for(const _ of u){const{w:E,h:C}=jl(_,s,i);l.setNode(_,{width:E,height:C})}for(const _ of t)f.has(_.source)&&f.has(_.target)&&l.setEdge(_.source,_.target);MC.layout(l);const p=new Map;let h=1/0,g=1/0,v=-1/0,w=-1/0;for(const _ of u){const E=l.node(_);if(!E)continue;const C=s.get(_),j=(C==null?void 0:C.width)??Za,M=(C==null?void 0:C.height)??Yu,$=jl(_,s,i),O=E.x-$.w/2,z=E.y-$.h/2;p.set(_,{x:O,y:z}),O<h&&(h=O),z<g&&(g=z),O+j>v&&(v=O+j),z+M>w&&(w=z+M)}if(Number.isFinite(h)&&Number.isFinite(g))for(const[_,E]of p)p.set(_,{x:E.x-h,y:E.y-g});const N=Number.isFinite(v)?v-h:0,k=Number.isFinite(w)?w-g:0;let S=null;for(const _ of e){const E=a.get(_);if(!E)continue;const C=s.get(_),j=(C==null?void 0:C.width)??Za,M=(C==null?void 0:C.height)??Yu;S=S===null?{minX:E.x,minY:E.y,maxX:E.x+j,maxY:E.y+M}:{minX:Math.min(S.minX,E.x),minY:Math.min(S.minY,E.y),maxX:Math.max(S.maxX,E.x+j),maxY:Math.max(S.maxY,E.y+M)}}return{positions:p,width:N,height:k,pinnedBox:S}}function h8(e,t,n={}){const s=n.direction??"LR",a=n.pinned??new Map,i=n.measured??new Map,l=n.lanes,u=new Map;for(const _ of e){const E=Cl(_),C=u.get(E);C?C.push(_.id):u.set(E,[_.id])}const p=Array.from(u.keys()).sort().map(_=>({sid:_,...d8(u.get(_),t,s,i,a,l)})),h=a8(e,i),g=n.availableHeight&&n.availableHeight>0?n.availableHeight:Number.POSITIVE_INFINITY,v=_=>{const E=[[]];let C=0;for(const j of p)E.length<_&&C>0&&C+j.height>g&&(E.push([]),C=0),E[E.length-1].push(j),C+=j.height+IC;return E},w=_=>_.reduce((E,C)=>Math.max(E,C.width),0)+uA;let N=v(n.availableWidth?i8:1);N.length>1&&N.reduce((E,C)=>E+w(C),0)+h*(N.length-1)>(n.availableWidth??0)&&(N=v(1));const k=new Map;let S=0;for(const _ of N){const E=w(_);let C=0;for(const{positions:j,height:M,pinnedBox:$}of _){for(const[z,I]of j)k.set(z,{x:I.x+S,y:I.y+C});let O=C+M;$&&$.maxY>O&&$.minX<S+E&&S<$.maxX&&(O=$.maxY),C=O+IC}S+=E+h}return e.map(_=>{const E=a.get(_.id);if(E)return{..._,position:E};const C=k.get(_.id);return C?{..._,position:C}:_})}function f8(e,t,n,s,a){const l=Ua+Sd,u=60,f=w=>jl(w,s,a),p=new Map(e.map(w=>[w.id,Cl(w)])),h=[],g=e.map(w=>({id:w.id,pos:n.get(w.id)??t.get(w.id)})).filter(w=>w.pos!=null).sort((w,N)=>w.pos.y-N.pos.y||w.pos.x-N.pos.x||w.id.localeCompare(N.id)),v=[];for(const{id:w,pos:N}of g){const{w:k,h:S}=f(w),_=p.get(w)??"_default";if(n.has(w)){h.push({x:N.x,y:N.y,w:k,h:S,sid:_});continue}let E=N.y;for(let C=0;C<h.length+1;C++){const j=h.find(M=>{const $=M.sid===_?24:u,O=M.sid===_?24:l;return N.x<M.x+M.w+$&&M.x<N.x+k+$&&E<M.y+M.h+O&&M.y<E+S+O});if(!j)break;E=j.y+j.h+(j.sid===_?24:l)}E!==N.y&&(t.set(w,{x:N.x,y:E}),v.push(w)),h.push({x:N.x,y:E,w:k,h:S,sid:_})}return v}function p8(e,t,n,s,a,i){const l=k=>jl(k,s,i),u=k=>n.get(k)??t.get(k),f=new Map;for(const k of e){if(!u(k.id))continue;const S=Cl(k),_=f.get(S);_?_.push(k):f.set(S,[k])}const p=new Set;for(const[k,S]of f)S.every(_=>a.has(_.id)&&!n.has(_.id))&&p.add(k);const h=new Map,g=[];for(const k of e){const S=u(k.id);if(!S)continue;const{w:_,h:E}=l(k.id),C=Cl(k);p.has(C)?(h.get(C)??h.set(C,[]).get(C)).push(k):g.push({x:S.x,y:S.y,w:_,h:E})}if(h.size===0)return[];const v=Ua+Sd,w=(k,S,_,E)=>g.some(C=>k<C.x+C.w+Ua&&C.x<k+_+Ua&&S<C.y+C.h+v&&C.y<S+E+v),N=[];for(const k of[...h.keys()].sort()){const S=h.get(k);let _=1/0,E=1/0,C=-1/0,j=-1/0;for(const q of S){const V=u(q.id),{w:Y,h:R}=l(q.id);_=Math.min(_,V.x),E=Math.min(E,V.y),C=Math.max(C,V.x+Y),j=Math.max(j,V.y+R)}const M=C-_,$=j-E,O=[...new Set(g.map(q=>Math.round(q.x)))].sort((q,V)=>q-V),z=O.length?O:[_],I=[0,...g.map(q=>q.y+q.h+v)].sort((q,V)=>q-V);let A=null;e:for(const q of z)for(const V of I){if(V>=E)break;if(!w(q,V,M,$)){A={x:q,y:V};break e}}if(A){const q=A.x-_,V=A.y-E;for(const Y of S){const R=u(Y.id);t.set(Y.id,{x:R.x+q,y:R.y+V})}N.push(k)}for(const q of S){const V=u(q.id),{w:Y,h:R}=l(q.id);g.push({x:V.x,y:V.y,w:Y,h:R})}}return N}function m8(e,t,n,s,a,i=!1,l){const p=Ua+Sd+1,h=8,g=1.75,v=200,w=.7,N=.01,k=A=>jl(A,s,l),S=A=>n.get(A)??t.get(A),_=new Map;for(const A of e){if(!S(A.id))continue;const q=Cl(A),V=_.get(q);V?V.push(A):_.set(q,[A])}const E=[],C=new Set,j=new Set,M=a.size===0;for(const A of[..._.keys()].sort()){const q=_.get(A);let V=1/0,Y=1/0,R=-1/0,X=-1/0,B=!1;for(const J of q){const P=S(J.id),{w:K,h:te}=k(J.id);V=Math.min(V,P.x),Y=Math.min(Y,P.y),R=Math.max(R,P.x+K),X=Math.max(X,P.y+te),n.has(J.id)&&(B=!0)}const ne=R-V,Z=X-Y;j.add(A);const W=a.get(A);W&&(ne>W.w+h||Z>W.h+h)&&C.add(A),a.set(A,{w:ne,h:Z}),E.push({sid:A,members:q.map(J=>J.id),x:V,y:Y,w:ne,h:Z,anchored:B,mass:1})}for(const A of[...a.keys()])j.has(A)||a.delete(A);if(i||M)return[];let $=!1;for(let A=0;A<E.length&&!$;A++)for(let q=A+1;q<E.length;q++){const V=E[A],Y=E[q];if(!(V.anchored&&Y.anchored)&&Math.abs(V.x+V.w/2-(Y.x+Y.w/2))<(V.w+Y.w)/2+61&&Math.abs(V.y+V.h/2-(Y.y+Y.h/2))<(V.h+Y.h)/2+p){$=!0;break}}if(C.size===0&&!$)return[];if(C.size>0)for(const A of E)C.has(A.sid)&&(A.mass=8);else for(const A of E)A.mass=Math.max(1,A.w*A.h/(Za*Yu));const O=new Map(E.map(A=>[A.sid,A.x])),z=new Map(E.map(A=>[A.sid,A.y]));for(let A=0;A<v;A++){const q=new Map,V=new Map;let Y=0;for(let R=0;R<E.length;R++)for(let X=R+1;X<E.length;X++){const B=E[R],ne=E[X];if(B.anchored&&ne.anchored)continue;const Z=B.x+B.w/2,W=B.y+B.h/2,J=ne.x+ne.w/2,P=ne.y+ne.h/2,K=(B.w+ne.w)/2+61-Math.abs(Z-J),te=(B.h+ne.h)/2+p-Math.abs(W-P);if(K<=0||te<=0)continue;const D=(Ye,pe)=>!Ye.anchored&&!(pe<0&&Ye.x<=0),L=(Ye,pe)=>!Ye.anchored&&!(pe<0&&Ye.y<=0),Q=(Ye,pe,we)=>{const Pe=Ye===pe,Ue=Pe?B.sid<ne.sid?-1:1:Math.sign(Ye-pe);return we(B,Ue)||we(ne,-Ue)?Ue:Pe&&(we(B,-Ue)||we(ne,Ue))?-Ue:0},U=Q(Z,J,D),ie=Q(W,P,L),fe=U!==0,me=ie!==0;if(!fe&&!me)continue;const ke=fe&&(!me||K*g<te),[Ve,Le,De,Ne]=ke?[U,K,q,D]:[ie,te,V,L],Ge=Ne(B,Ve),be=Ne(ne,-Ve),se=B.mass,Qe=ne.mass,ut=Ge?be?Qe/(se+Qe):1:0,lt=be?Ge?se/(se+Qe):1:0,rt=Le*w;De.set(B.sid,(De.get(B.sid)??0)+Ve*rt*ut),De.set(ne.sid,(De.get(ne.sid)??0)-Ve*rt*lt),Y+=rt}for(const R of E)R.anchored||(R.x=Math.max(0,R.x+(q.get(R.sid)??0)),R.y=Math.max(0,R.y+(V.get(R.sid)??0)));if(Y<N)break}const I=[];for(const A of E){const q=A.x-O.get(A.sid),V=A.y-z.get(A.sid);if(!(Math.abs(q)<1&&Math.abs(V)<1)){for(const Y of A.members){if(n.has(Y))continue;const R=t.get(Y);R&&t.set(Y,{x:R.x+q,y:R.y+V})}I.push(A.sid)}}return I}const g8=600;function mw(e,t){return!(e.exitAt!=null&&t-e.exitAt>g8||e.kind==="root"&&e.state==="done"&&e.tools.length===0&&e.endedAt!=null&&e.endedAt-e.startedAt<3e3)}function y8(e,t){const n=new Set;for(const s of e.agents.values())mw(s,t)&&n.add(s.id);return n}function v8(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 w8(e,t,n=0){if(!e)return!1;for(const s of t)if(v8(e,s,n))return!0;return!1}const dA="sessionGroup";function x8(e,t){var s;if(e.type===dA)return"transparent";const n=(s=e.data)==null?void 0:s.state;return t(n==="err"?"--err":n==="active"?"--inflight":"--ok")}const hA=["--err","--inflight","--ok","--grid-line","--minimap-mask","--panel","--line","--accent","--text-dim","--bg"];function OC(e){const t={};for(const n of hA)t[n]=e(n);return t}function b8(e){return t=>e[t]??""}function k8(e,t){return hA.every(n=>e[n]===t[n])}function _8(e){const t=new Set(e.pins),n=new Map,s=new Map;for(const[a,i]of e.positions)n.set(a,i),t.has(a)&&s.set(a,i);return{positions:n,pinned:s}}const S8=1200,N8=1e3;function $C(e){return e.lastDeckFitAt>0&&e.at-e.lastDeckFitAt<S8?!1:e.hasSourceEvent?!0:e.lastCanvasInputAt>0&&e.at-e.lastCanvasInputAt<N8}function $v({durationMs:e,documentHidden:t}){return t?!1:Number.isFinite(e)&&e>0}function E8(e,t,n){const s=e.x*t.zoom+t.x,a=e.y*t.zoom+t.y,i=(e.x+e.width)*t.zoom+t.x,l=(e.y+e.height)*t.zoom+t.y;return i>0&&s<n.width&&l>0&&a<n.height}function C8({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 a of n)if(s=!0,E8(a,t,e))return!1;return s}const j8="Update checks are off (AGENTS_DECK_NO_UPDATE_CHECK=1)",Pv="click for what's new";function T8(e){if(e.checkDisabled)return`${j8} · ${Pv}`;if(e.checking)return`Asking npm for the newest release… · ${Pv}`;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 · ${Pv}, and to check npm now`}function R8(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 A8(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 M8(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 gw={kind:"assumed",claude:!0,codex:!0};function I8(e){if(!e||typeof e!="object")return gw;const t=e.providers;if(!t||typeof t!="object")return gw;const n=t;return{kind:"reported",claude:n.claude!==!1,codex:n.codex!==!1}}function Ku(e){const t=Math.max(0,Math.floor(e));return`${t} event${t===1?"":"s"}`}const PC=99;function O8(e){const t=Math.max(0,Math.floor(e));return t>PC?`${PC}+`:String(t)}const $8="Pause the canvas";function P8(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 — ${Ku(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)":`${Ku(e.held)} arrived while paused and will be applied in order when you resume (Space)`}function L8(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 fA="paused · full",q8=(e,t)=>t>0?fA:e>0?`paused · ${O8(e)}`:"paused";function D8(e){const t=Math.max(0,Math.floor(e.dropped??0));return e.connected?e.paused?{tone:"paused",resting:!1,label:q8(e.held,t),widest:fA,title:t>0?`Connected — the pause is full at ${Ku(e.held)}; the oldest are being dropped as new ones arrive. Resume to catch up (Space)`:e.held>0?`Connected — ${Ku(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 LC(e){return typeof window>"u"?"":getComputedStyle(document.documentElement).getPropertyValue(e).trim()||""}const F8={agent:R3,sessionGroup:V3},pA="react-flow__node";function qC(e){var t,n;return!!e&&((n=(t=e.classList)==null?void 0:t.contains)==null?void 0:n.call(t,pA))===!0}function z8(e){try{const t=document.querySelector(`.${pA}[data-id="${CSS.escape(e)}"]`);t==null||t.focus({preventScroll:!0})}catch{}}const B8=["a[href]","button:not(:disabled)","input:not(:disabled)","select:not(:disabled)","textarea:not(:disabled)","summary","[tabindex]"].join(","),U8=420,ku=18,W8=200,H8=5*6e4,G8=6,V8=2*6e4,DC=400,g0="agent-dag.layout",y0="agent-dag.viewport",mA="agent-dag.summariesDismissed",gA="agent-dag.sessionListOpen",yA="agent-dag.detailOpen",vA="agent-dag.usagePanelOpen",wA="agent-dag.systemPanelOpen",FC="agent-dag.accountsPanelOpen",Lv="agent-dag.versionNoticeDismissed",zC="agent-dag.oldNameNoticeDismissed",Y8=15*6e4,qv={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:"},BC="agent-dag.autoRestart",UC="agent-dag.bundleReloadedFor";function K8(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(gA)==="1"}catch{return!1}}function X8(e){if(!(typeof window>"u"))try{window.localStorage.setItem(gA,e?"1":"0")}catch{}}function Q8(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(yA)==="1"}catch{return!1}}function Z8(e){if(!(typeof window>"u"))try{window.localStorage.setItem(yA,e?"1":"0")}catch{}}function J8(){const e=ei(vA);return e===null?!0:e==="1"}function eU(e){if(!(typeof window>"u"))try{window.localStorage.setItem(vA,e?"1":"0")}catch{}}function tU(){return ei(wA)==="1"}function nU(e){if(!(typeof window>"u"))try{window.localStorage.setItem(wA,e?"1":"0")}catch{}}function rU(){if(typeof window>"u")return new Set;try{const e=window.localStorage.getItem(mA);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 WC(e){if(!(typeof window>"u"))try{const t=Array.from(e),n=t.length>200?t.slice(-200):t;window.localStorage.setItem(mA,JSON.stringify(n))}catch{}}function sU(){const e={positions:[],pins:[]};if(typeof window>"u")return e;try{const t=window.localStorage.getItem(g0);if(!t)return e;const n=JSON.parse(t);if(!("v"in n)){const a=Object.entries(n).filter(([,i])=>i&&typeof i.x=="number"&&typeof i.y=="number");return{positions:a,pins:a.map(([i])=>i)}}return{positions:Object.entries(n.positions??{}).filter(([,a])=>a&&typeof a.x=="number"&&typeof a.y=="number"),pins:Array.isArray(n.pins)?n.pins:[]}}catch{return e}}function Dv(e,t){if(!(typeof window>"u"))try{const n={};for(const[s,a]of e)n[s]=a;for(const[s,a]of t)n[s]=a;window.localStorage.setItem(g0,JSON.stringify({v:2,positions:n,pins:Array.from(t.keys())}))}catch{}}function oU(){if(typeof window>"u")return null;try{const e=window.localStorage.getItem(y0);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 aU(e){if(!(typeof window>"u"))try{window.localStorage.setItem(y0,JSON.stringify(e))}catch{}}function HC(){if(!(typeof window>"u")){try{window.localStorage.removeItem(g0)}catch{}try{window.localStorage.removeItem(y0)}catch{}}}function iU(e,t){const n=e.agents.get(t);if(!n)return;const s=[];for(const h of e.agents.values())h.sessionId===t&&s.push(h);const a={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(h=>({id:h.id,kind:h.kind,label:h.label,parentId:h.parentId,state:h.state,startedAt:h.startedAt,endedAt:h.endedAt,model:h.model,cwd:h.cwd,usage:h.usage,prompts:h.prompts,tools:h.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}))}))},i=JSON.stringify(a,null,2),l=new Blob([i],{type:"application/json"}),u=URL.createObjectURL(l),f=document.createElement("a"),p=(n.label||"session").replace(/[^a-z0-9._-]/gi,"_");f.href=u,f.download=`${Ut}-${p}-${t.slice(0,8)}.json`,document.body.appendChild(f),f.click(),document.body.removeChild(f),setTimeout(()=>URL.revokeObjectURL(u),1e3)}const yw={file:"📁",shell:"⚡",web:"🌐",agent:"🤖",task:"📋",plan:"🧭",mcp:"🔌",other:"✨"},vw={file:"file",shell:"shell",web:"web",agent:"agent",task:"task",plan:"plan",mcp:"mcp",other:"other"},xA=AT;function lU(e,t,n,s,a,i,l,u,f,p,h,g,v,w,N,k,S,_){const E=[],C=[];for(const A of e.agents.values()){if(!S.has(A.id))continue;const q=A.exitAt!=null,V=k!=null&&!k.has(A.id),Y=[q?"rf-exiting":"",V?"rf-spotlit-out":""].filter(Boolean).join(" ")||void 0,R=i.get(A.id);if(E.push({id:A.id,type:"agent",position:{x:0,y:0},data:{...A,now:t,onOpenContext:_},className:Y,...R?{width:R.width,height:R.height}:null}),A.parentId&&S.has(A.parentId)){const X=Dw(A.sessionId),B=q,ne=N.size>0&&(N.has(A.id)||N.has(A.parentId)),Z=k!=null&&!k.has(A.id)&&!k.has(A.parentId),W=A.state==="active"?2:1.5,J=ne?W+1.5:W,P=B?.2:Z?.12:1,K=["sess-edge",A.state==="active"?"sess-live":"sess-idle",B?"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)&&!B,type:"smoothstep",style:{"--session-hue":X,strokeWidth:J,opacity:P,transition:"var(--edge-transition)"},className:K})}}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:${u8(j)}`,$=E.filter(A=>sF(A.id,a,h,g));if($.length>0||M!==w.current){if($.length>0){const A=h8(E,C,{direction:"LR",pinned:a,measured:i,availableWidth:n,availableHeight:s,lanes:j});for(const q of A)iR(q.id,h,g)&&aF(q.id,q.position,h,g);p8(E,h,a,i,new Set($.map(q=>q.id)),j)}f8(E,h,a,i,j),w.current=M}const O=m8(E,h,a,i,l,!f||p,j);O.length>0&&u(O),gu(h,e.agents),gu(g,e.agents),gu(a,e.agents),gu(i,tF(e.agents.values()));const z=[];let I=!1;for(const A of E){let q=a.get(A.id)??h.get(A.id);q||(q=oF(A.id,h,g),I=!0),z.push({...A,position:q})}return I&&(w.current=""),{nodes:z,edges:C}}function cU(){return d.jsx(Lw,{children:d.jsx(uU,{})})}function uU(){var lc,cc,Wr,ua;const e=Il(),t=Mt(),n=b.useState(nw)[0],s=b.useRef(n),[,a]=b.useState(0),i=b.useCallback(()=>a(F=>F+1),[]),[l,u]=b.useState(()=>new Set),[f,p]=b.useState(null),[h,g]=b.useState(null),v=b.useCallback((F,G)=>{u(ce=>{if(!G)return new Set([F]);const he=new Set(ce);return he.has(F)?he.delete(F):he.add(F),he}),p(ce=>G&&ce===F?ce:F)},[]),w=b.useCallback(()=>{u(new Set),p(null)},[]),[N,k]=b.useState(null),[S,_]=b.useState(null),E=b.useCallback(F=>_(F),[]),[C,j]=b.useState(!1),[M,$]=b.useState(!1),O=b.useState(rU)[0],[z,I]=b.useState(K8);b.useEffect(()=>{X8(z)},[z]);const[A,q]=b.useState(Q8);b.useEffect(()=>{Z8(A)},[A]);const[V,Y]=b.useState(J8);b.useEffect(()=>{eU(V)},[V]);const[R,X]=b.useState(tU);b.useEffect(()=>{nU(R)},[R]);const[B,ne]=b.useState(()=>{try{const F=window.localStorage.getItem(FC);return F===null?!0:F==="1"}catch{return!0}});b.useEffect(()=>{try{window.localStorage.setItem(FC,B?"1":"0")}catch{}},[B]);const[Z,W]=b.useState(null);b.useEffect(()=>{let F=null;try{F=localStorage.getItem("agent-dag.sound")}catch{}W(F===null?!0:F==="on")},[]);const J=b.useCallback(()=>{W(F=>{var ce;const G=F!==!0;try{localStorage.setItem("agent-dag.sound",G?"on":"off")}catch{}return G&&((ce=Le.current)==null||ce.unlock()),G})},[]),P=b.useCallback(F=>{J()},[J]),K=b.useRef(P);K.current=P;const te=b.useRef(Z);te.current=Z;const[D,L]=b.useState(()=>S5(ei)),Q=b.useRef(D);Q.current=D;const U=b.useRef(null),ie=b.useCallback((F,G=!1)=>{var ce,he;if((ce=Le.current)==null||ce.unlock(),U.current!==null&&clearTimeout(U.current),U.current=null,!G){(he=Le.current)==null||he.play(F,!0);return}U.current=setTimeout(()=>{var Ee;U.current=null,(Ee=Le.current)==null||Ee.play(F,!0)},w5)},[]),fe=b.useCallback((F,G)=>{L(ce=>{const he={level:El(G.level??ce[F].level),figure:tR(F,G.figure??ce[F].figure)};try{localStorage.setItem(nR[F],String(he.level)),localStorage.setItem(rR[F],he.figure)}catch{}return{...ce,[F]:he}}),ie(F,!0)},[ie]);b.useEffect(()=>()=>{U.current!==null&&clearTimeout(U.current)},[]);const[me,ke]=b.useState(!1),Ve=b.useRef(null),Le=b.useRef(null),[De,Ne]=b.useState("locked");b.useEffect(()=>{const F=C5({enabled:()=>te.current===!0,prefs:()=>Q.current,onState:Ne});Le.current=F,Ne(F.state());const G=()=>F.unlock();return window.addEventListener("pointerdown",G,{once:!0,capture:!0}),window.addEventListener("keydown",G,{once:!0,capture:!0}),()=>{window.removeEventListener("pointerdown",G,{capture:!0}),window.removeEventListener("keydown",G,{capture:!0})}},[]);const[Ge,be]=b.useState(!1),[se,Qe]=b.useState(null),[ut,lt]=b.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(Lv)??""}catch{return""}}),[rt,Ye]=b.useState(!1),pe=b.useRef(0),[we,Pe]=b.useState(!1),Ue=b.useCallback((F=!1)=>(F&&(pe.current=Date.now(),Pe(!0)),fetch(F?"/api/version?refresh=1":"/api/version").then(G=>G.ok?G.json():null).then(G=>{G&&Qe(G)}).catch(()=>{}).finally(()=>{F&&Pe(!1)})),[]),st=b.useCallback(()=>{Ue(Date.now()-pe.current>=Y8)},[Ue]);b.useEffect(()=>{Ue();const F=window.setInterval(st,5*6e4),G=()=>{document.visibilityState==="visible"&&st()};return document.addEventListener("visibilitychange",G),()=>{window.clearInterval(F),document.removeEventListener("visibilitychange",G)}},[Ue,st]),b.useEffect(()=>{Ge&&Ue()},[Ge,Ue]);const Oe=(se==null?void 0:se.notice)??null,[oe,Se]=b.useState(null),qe=b.useRef(!1);b.useEffect(()=>{if(qe.current)return;const F=z5(),G=B5(F),ce=H5({stored:G,running:(se==null?void 0:se.running)??null,notes:o1,remembers:U5(F)});ce.reason!=="no-version"&&(qe.current=!0,ce.record&&W5(F,ce.record),ce.show.length&&Se({entries:ce.show,since:G,firstRun:ce.reason==="welcome"}))},[se==null?void 0:se.running]);const _e=(se==null?void 0:se.running)??"3.15.0",Be=b.useMemo(()=>sR(o1,null,_e),[_e]),_t=b.useCallback(()=>{Se({entries:Be,since:null,firstRun:!1})},[Be]),[yt,Re]=b.useState(null),[at,vt]=b.useState(gw);b.useEffect(()=>{let F=!1;return fetch("/api/health").then(G=>G.ok?G.json():null).then(G=>{F||(vt(I8(G)),!(!G||typeof G.workspace!="string")&&Re(G.workspace))}).catch(()=>{}),()=>{F=!0}},[Ge]);const wt=b.useRef(at);wt.current=at;const sn=Oe?`${Oe.kind}:${Oe.to}`:"",on=Oe!=null&&ut!==sn,An=b.useCallback(()=>{lt("");try{window.localStorage.setItem(Lv,"")}catch{}},[]),Io=b.useCallback(()=>{if(Oe){lt(sn);try{window.localStorage.setItem(Lv,sn)}catch{}}},[Oe,sn]),[Oo,$o]=b.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(zC)??""}catch{return""}}),wn=se!=null&&se.invokedAs&&se.invokedAs!==Ut?se.invokedAs:null,zs=wn!=null&&Oo!==wn,Po=b.useCallback(()=>{if(wn){$o(wn);try{window.localStorage.setItem(zC,wn)}catch{}}},[wn]),Ot=((lc=se==null?void 0:se.upgrade)==null?void 0:lc.state)??"idle",fr=ZD(se==null?void 0:se.upgrade),Hn=b.useRef(!1),ai=b.useCallback(async()=>{if(qt(Hn.current||Ot==="running")){Hn.current=!0;try{await fetch("/api/upgrade",{method:"POST"})}catch{}await Ue(),Hn.current=!1}},[Ot,Ue]);b.useEffect(()=>{if(Ot!=="running")return;const F=window.setInterval(Ue,3e3);return()=>window.clearInterval(F)},[Ot,Ue]);const Mr=b.useCallback(async()=>{const F=se==null?void 0:se.command;!F||!await eR(F)||(Ye(!0),window.setTimeout(()=>Ye(!1),1600))},[se==null?void 0:se.command]),Ir=b.useCallback(()=>{I(F=>(F||ne(!1),!F))},[]),Or=b.useCallback(()=>{ne(F=>(F||I(!1),!F))},[]),[as,Bs]=b.useState(!1),[Lo,Us]=b.useState(!1),[Mn,qo]=b.useState(()=>{try{return Number(localStorage.getItem(c1))||0}catch{return 0}}),[Ws,ii]=b.useState([]),[$r,Hs]=b.useState(!1);b.useEffect(()=>{let F=!0;const G=()=>{fetch("/api/browser-watch?live=0").then(he=>he.ok?he.json():null).then(he=>{var Ee;!F||!(he!=null&&he.ok)||(ii(he.episodes??[]),Hs(((Ee=he.settings)==null?void 0:Ee.enabled)===!0))}).catch(()=>{})};G();const ce=setInterval(G,5*6e4);return()=>{F=!1,clearInterval(ce)}},[]);const Gn=b.useMemo(()=>OF(Ws,Mn).length,[Ws,Mn]),[Do,Gs]=b.useState(0),Fo=b.useRef(null),[dt,zo]=b.useState(!1),Vn=b.useRef(null),[Bo,Pr]=b.useState(0),Xt=b.useState(()=>dF({protect:F=>$L(s.current,F)}))[0],[Lr,is]=b.useState(!1),Qt=b.useCallback(()=>{const F=Xt.paused&&Xt.dropped>0,G=Xt.setPaused(!Xt.paused);F&&PL(s.current);for(const ce of G)s.current=ck(s.current,ce);is(Xt.paused)},[Xt]),[xt,xn]=b.useState(Date.now()),[qr,Nd]=b.useState(()=>{if(typeof window>"u")return!0;try{return window.localStorage.getItem(BC)!=="0"}catch{return!0}}),Ed=b.useCallback(()=>{Nd(F=>{const G=!F;try{window.localStorage.setItem(BC,G?"1":"0")}catch{}return G})},[]),[bn,Dr]=b.useState(!1),[Vs,Uo]=b.useState("restart"),[Hl,Gl]=b.useState(null),pr=b.useRef(!1),li=b.useRef(null),Wo=b.useRef(0),mr=b.useCallback(async F=>{if(!qt(pr.current))return;const G=(F==null?void 0:F.upgrade)===!0;pr.current=!0,li.current=fr;const ce=++Wo.current;Uo(G?"npx":"restart"),Dr(!0);try{window.sessionStorage.setItem("agent-dag.restartPending",(Oe==null?void 0:Oe.to)??"")}catch{}try{await fetch("/api/restart",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({upgrade:G})})}catch{}window.setTimeout(()=>{if(Wo.current===ce&&pr.current){pr.current=!1,Dr(!1);try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}}},G?18e4:3e4)},[Oe==null?void 0:Oe.to,fr]),ci=b.useRef(null);b.useEffect(()=>{const F=e1(s.current.agents.values())>0,G=r5({enabled:qr,kind:Oe==null?void 0:Oe.kind,canRestart:(se==null?void 0:se.canRestart)===!0,noticeOpen:on,visible:document.visibilityState==="visible",busy:F,idleSince:ci.current,now:xt});ci.current=G.idleSince,G.restart&&mr()},[qr,Oe==null?void 0:Oe.kind,se==null?void 0:se.canRestart,on,xt,mr]);const Ho=e1(s.current.agents.values()),tt=n5(Ho),ui=JT({enabled:qr,kind:Oe==null?void 0:Oe.kind,canRestart:(se==null?void 0:se.canRestart)===!0,noticeOpen:on,visible:document.visibilityState==="visible",busy:Ho>0,idleSince:ci.current,now:xt});b.useEffect(()=>{const F=se==null?void 0:se.running;let G=null,ce=null;try{G=window.sessionStorage.getItem("agent-dag.restartPending"),ce=window.sessionStorage.getItem(UC)}catch{return}const he=QD({bundle:"3.15.0",running:F,pending:G,lastTried:ce});if(he==="reload"){try{window.sessionStorage.setItem(UC,F??"")}catch{return}window.location.reload();return}if(he!=="confirm")return;try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}pr.current=!1,Dr(!1),Gl(F??null);const Ee=window.setTimeout(()=>Gl(null),6e3);return()=>window.clearTimeout(Ee)},[se==null?void 0:se.running]),b.useEffect(()=>{if(bn&&JD({asked:li.current,reported:fr})){try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}pr.current=!1,Dr(!1)}},[bn,fr]);const di=b.useState(()=>_8(sU()))[0],Wt=b.useRef(di.pinned),Ys=b.useRef(null),Ks=b.useState(()=>oU())[0],[Go,hi]=b.useState(()=>new Set),[gr,Yn]=b.useState(fF),[Ht,yr]=b.useState(()=>OC(LC)),ls=b.useMemo(()=>b8(Ht),[Ht]),Xs=b.useCallback(F=>x8(F,ls),[ls]),vr=b.useMemo(()=>({background:Ht["--panel"],border:`1px solid ${Ht["--line"]}`,borderRadius:8}),[Ht]),[Vl,Yl]=b.useState(!1);b.useEffect(()=>{document.documentElement.dataset.theme=gr;try{window.localStorage.setItem(lR,gr)}catch{}yr(F=>{const G=OC(LC);return k8(F,G)?F:G})},[gr]);const kn=b.useCallback((F,G)=>{if($v({durationMs:G,documentHidden:document.hidden})){e.setViewport(F,{duration:G});return}const{d3Zoom:ce,d3Selection:he}=t.getState(),Ee=he==null?void 0:he.property("__zoom");if(ce&&he&&Ee&&Ee.k>0&&F.zoom>0){ce.transform(he,Ee.scale(F.zoom/Ee.k).translate((F.x-Ee.x)/F.zoom,(F.y-Ee.y)/F.zoom));return}e.setViewport(F,{duration:0})},[e,t]),Qs=b.useRef(null);b.useEffect(()=>{if(!Ks)return;const F=window.setTimeout(()=>{try{kn(Ks,0)}catch{}In.current=Date.now()},60);return()=>window.clearTimeout(F)},[kn,Ks]);const fi=b.useRef(!0);b.useEffect(()=>{const F=new EventSource("/events"),G=cF(i,{now:()=>Date.now(),setTimeout:(ce,he)=>window.setTimeout(ce,he),clearTimeout:ce=>window.clearTimeout(ce)});return F.addEventListener("open",()=>{be(!0),Yl(!0)}),F.addEventListener("error",()=>be(!1)),F.addEventListener("replay-end",()=>{fi.current=!1,G.flush()}),F.addEventListener("hook",ce=>{var he;try{const Ee=JSON.parse(ce.data);if(!Xt.accept(Ee))return;s.current=ck(s.current,Ee);const Ae=Ee.replay===!0||fi.current||Date.now()-Ee.receivedAt>3e4;Ae?G.replay():G.live();const He=E5(Ee,Ae);He&&((he=Le.current)==null||he.play(He))}catch{}}),()=>{F.close(),G.cancel()}},[i]),b.useEffect(()=>{const F=setInterval(()=>{const G=Date.now();xn(G);let ce=LL(s.current,G,lk);qL(s.current,G,lk)&&(ce=!0),IL(s.current,G,W8,H8)&&(ce=!0),OL(s.current,G,G8,V8)&&(ce=!0),u(he=>eF(he,s.current.agents)),p(he=>he!=null&&!s.current.agents.has(he)?null:he),_(he=>he!=null&&!s.current.agents.has(he)?null:he),k(he=>he!=null&&!s.current.agents.has(he)?null:he),ce&&i()},250);return()=>clearInterval(F)},[i]);const cs=b.useRef(null),In=b.useRef(0),Cd=420,Zt=b.useCallback((F=500)=>{try{const Ae=document.querySelector(".canvas-wrap"),He=Array.from(document.querySelectorAll(".react-flow__node")).filter(Tt=>Tt.offsetWidth>0);if(!Ae||He.length===0)return;const Ze=Ae.getBoundingClientRect(),ht=e.getViewport();if(!Number.isFinite(ht.zoom)||ht.zoom<=0)return;const ot=Tt=>(Tt-Ze.left-ht.x)/ht.zoom,ln=Tt=>(Tt-Ze.top-ht.y)/ht.zoom,oo=He.map(Tt=>Tt.getBoundingClientRect()),Ai=Math.min(...oo.map(Tt=>ot(Tt.left))),uc=Math.max(...oo.map(Tt=>ot(Tt.right))),Zn=Math.min(...oo.map(Tt=>ln(Tt.top))),Mi=Math.max(...oo.map(Tt=>ln(Tt.bottom))),da=uc-Ai,Ii=Mi-Zn;if(!(da>0&&Ii>0))return;const ao=Math.max(.2,Math.min(1,(Ze.width-160)/(da+Cd)*.86,(Ze.height-160)/Ii*.86)),Jn={x:80-Ai*ao,y:Math.max(80,(Ze.height-Ii*ao)/2)-Zn*ao,zoom:ao};kn(Jn,F),In.current=Date.now(),Qs.current=$v({durationMs:F,documentHidden:document.hidden})?{target:Jn,until:Date.now()+F+60}:null,window.setTimeout(()=>{var Tt;try{((Tt=Qs.current)==null?void 0:Tt.target)===Jn&&(Qs.current=null);const Oi=e.getViewport();(Math.abs(Oi.zoom-ao)>.01||Math.abs(Oi.x-Jn.x)>2)&&kn(Jn,0)}catch{}},F+60)}catch{}},[e,kn]);b.useEffect(()=>{const F=()=>{if(!document.hidden)return;const G=Qs.current;if(Qs.current=null,!(!G||Date.now()>G.until)){try{kn(G.target,0)}catch{}In.current=Date.now()}};return document.addEventListener("visibilitychange",F),()=>document.removeEventListener("visibilitychange",F)},[kn]);const Fr=b.useRef(""),wr=b.useRef(null),Zs=b.useRef(0),Vo=b.useCallback(()=>{Zs.current=Date.now()},[]),pi=b.useRef(null),Yo=b.useRef(0),us=b.useCallback(()=>{Yo.current=Date.now()},[]),Ko=b.useCallback(F=>({hasSourceEvent:!!F,at:Date.now(),lastDeckFitAt:In.current,lastCanvasInputAt:Yo.current}),[]),Xo="agent-dag.autoFitDisabled",Kn=b.useState(()=>{if(typeof window>"u")return!1;try{return window.localStorage.getItem(Xo)==="1"}catch{return!1}})[0],xr=b.useRef(Kn),[Js,mi]=b.useState(Kn),ds=b.useCallback(()=>{if(!xr.current){xr.current=!0,mi(!0);try{window.localStorage.setItem(Xo,"1")}catch{}}},[]),Qo=b.useCallback(()=>{xr.current=!1,mi(!1);try{window.localStorage.removeItem(Xo)}catch{}Zt(400)},[e,Zt]);b.useEffect(()=>{const F=setInterval(()=>{if(xr.current||Date.now()-Zs.current<800)return;const G=s.current,ce=Date.now(),he=[];for(const Ae of G.agents.values())mw(Ae,ce)&&he.push({id:Ae.id});if(he.length===0)return;const Ee=[];for(const{id:Ae}of he){const He=jt.current.get(Ae),Ze=Wt.current.get(Ae)??Jt.current.get(Ae);!He||!Ze||Ee.push({x:Ze.x,y:Ze.y,width:He.width,height:He.height})}C8({pane:pi.current,viewport:e.getViewport(),boxes:Ee})&&Zt(600)},1500);return()=>clearInterval(F)},[e]);const Zo=b.useRef(!1),jt=b.useRef(new Map),zr=b.useRef(0),gi=b.useCallback(F=>{const G=jt.current;let ce=!1;for(const he of F.nodeInternals.values()){const Ee=he.width,Ae=he.height;if(Ee==null||Ae==null)continue;const He=G.get(he.id);He?(Math.abs(He.height-Ae)>4||Math.abs(He.width-Ee)>4)&&(G.set(he.id,{width:Ee,height:Ae}),ce=!0):(G.set(he.id,{width:Ee,height:Ae}),ce=!0)}return ce&&(zr.current+=1),zr.current},[]),hs=it(gi),[Kl,yi]=b.useState(0);b.useEffect(()=>{let F=0;const G=()=>{const he=jt.current;let Ee=!1;for(const Ae of document.querySelectorAll(".react-flow__node[data-id]")){const He=Ae.getAttribute("data-id");if(!He)continue;const Ze=Ae.offsetWidth,ht=Ae.offsetHeight;if(!Ze||!ht)continue;const ot=he.get(He);(!ot||Math.abs(ot.width-Ze)>4||Math.abs(ot.height-ht)>4)&&(he.set(He,{width:Ze,height:ht}),Ee=!0)}Ee&&yi(Ae=>Ae+1)};if(Zo.current)return;let ce=0;return document.visibilityState==="hidden"?ce=window.setTimeout(G,32):F=requestAnimationFrame(G),()=>{cancelAnimationFrame(F),window.clearTimeout(ce)}});const Jt=b.useRef(di.positions),eo=b.useRef(new Set),fs=b.useRef(""),Br=b.useMemo(()=>{const F=[];for(const G of s.current.agents.values())mw(G,xt)&&F.push(G.id+(G.parentId?`>${G.parentId}`:""));return F.sort(),`${F.join("|")}#sv${hs}.${Kl}`},[s.current,s.current.revision,xt,hs,Kl]),to=b.useRef(null);b.useEffect(()=>(to.current!=null&&window.clearTimeout(to.current),to.current=window.setTimeout(()=>{Dv(Jt.current,Wt.current)},1500),()=>{to.current!=null&&window.clearTimeout(to.current)}),[Br]),b.useEffect(()=>{if(Fr.current===Br)return;const F=Fr.current;if(Fr.current=Br,!F||xr.current)return;Date.now()-In.current>1200&&Zt(400),cs.current&&window.clearTimeout(cs.current),cs.current=window.setTimeout(()=>{xr.current||Zt(500)},280)},[Br,e,Zt]);const vi=b.useMemo(()=>rF(s.current,l),[s.current,s.current.revision,l]),wi=b.useMemo(()=>y8(s.current,xt),[s.current,s.current.revision,xt]),Jo=b.useRef(null),[ea,Xl]=b.useState({w:0,h:0});b.useEffect(()=>{const F=Jo.current;if(!F||typeof ResizeObserver>"u")return;const G=new ResizeObserver(ce=>{var Ee;const he=(Ee=ce[0])==null?void 0:Ee.contentRect;he&&(pi.current={width:he.width,height:he.height},Xl(Ae=>Math.abs(Ae.w-he.width)>40||Math.abs(Ae.h-he.height)>40?{w:he.width,h:he.height}:Ae))});return G.observe(F),pi.current={width:F.clientWidth,height:F.clientHeight},Xl({w:F.clientWidth,h:F.clientHeight}),()=>G.disconnect()},[]);const jd=b.useCallback(F=>{var ce,he;const G=F.target;!(G!=null&&G.closest)||G.closest(B8)!==F.currentTarget||(F.preventDefault(),(he=(ce=document.activeElement)==null?void 0:ce.blur)==null||he.call(ce))},[]),Td=b.useRef(new Map),[Ql,Zl]=b.useState(!1);b.useEffect(()=>{const F=window.setTimeout(()=>Zl(!0),2500);return()=>window.clearTimeout(F)},[]);const[Rd,xi]=b.useState(!1),br=b.useRef(null),[bi,ta]=b.useState(!1),Ad=b.useCallback(()=>{br.current&&(window.clearTimeout(br.current),br.current=null),xi(!1)},[]),Md=b.useCallback(F=>{F.length!==0&&queueMicrotask(()=>{xi(!0),br.current&&window.clearTimeout(br.current),br.current=window.setTimeout(()=>xi(!1),U8+80)})},[]);b.useEffect(()=>()=>{br.current&&window.clearTimeout(br.current)},[]);const Jl=ea.w>0?ea.w*.92:0,ki=ea.h>0?ea.h:0,{nodes:kr,edges:Id}=b.useMemo(()=>lU(s.current,xt,Jl,ki,Wt.current,jt.current,Td.current,Md,Ql,bi,Jt.current,eo.current,Br,fs,l,vi,wi,E),[s.current,s.current.revision,xt,Jl,ki,Ql,bi,Br,l,vi,wi,E,Do]),ec=b.useMemo(()=>{const F=new Map;for(const ce of kr){const he=ce.data;if(!(he!=null&&he.sessionId)||he.exitAt!=null)continue;const Ee=ce.width,Ae=ce.height;if(Ee==null||Ae==null)continue;const He=ce.position.x,Ze=ce.position.y,ht=He+Ee,ot=Ze+Ae,ln=F.get(he.sessionId);ln?(ln.minX=Math.min(ln.minX,He),ln.minY=Math.min(ln.minY,Ze),ln.maxX=Math.max(ln.maxX,ht),ln.maxY=Math.max(ln.maxY,ot)):F.set(he.sessionId,{minX:He,minY:Ze,maxX:ht,maxY:ot})}const G=[];for(const[ce,he]of F){const Ee=he.maxX-he.minX+ku*2,Ae=he.maxY-he.minY+ku*2;G.push({id:`group:${ce}`,type:dA,position:{x:he.minX-ku,y:he.minY-ku},data:{sessionId:ce,w:Ee,h:Ae},width:Ee,height:Ae,style:{width:Ee,height:Ae},zIndex:-1,draggable:!0,selectable:!1,focusable:!1,deletable:!1,connectable:!1})}return G},[kr,xt]),Od=b.useMemo(()=>{const F=[...ec,...kr],G=Vn.current;return!G||G.size===0?F:F.map(ce=>{const he=G.get(ce.id);return he?{...ce,position:he}:ce})},[ec,kr,Bo]),na=b.useMemo(()=>{const F=new Set;for(const G of s.current.agents.values())for(const ce of G.tools)F.add(xA(ce.name));return Object.keys(yw).filter(G=>F.has(G))},[s.current,s.current.revision]);b.useEffect(()=>{if(na.length<=1){zo(!1);return}let F=0;const G=()=>{const ce=Fo.current;if(ce&&!document.hidden){const he=ce.getBoundingClientRect(),Ee=Array.from(document.querySelectorAll(".react-flow__node, .tool-burst")).map(He=>He.getBoundingClientRect()),Ae=w8(he,Ee,8);zo(He=>He===Ae?He:Ae)}F=window.setTimeout(G,300)};return G(),()=>window.clearTimeout(F)},[na.length]);const $d=b.useCallback(F=>{hi(G=>{const ce=new Set(G);return ce.has(F)?ce.delete(F):ce.add(F),ce})},[]),an=f?s.current.agents.get(f):null,no=h?Array.from(s.current.agents.values()).flatMap(F=>F.tools).find(F=>F.id===h)??null:null,ps=b.useCallback(async()=>{try{await fetch("/api/clear",{method:"POST"})}catch{}s.current=nw(),Wt.current.clear(),jt.current.clear(),Jt.current.clear(),fs.current="",HC(),w(),i()},[i,w]),tc=b.useRef(C);tc.current=C;const _i=b.useRef(M);_i.current=M;const ra=b.useRef(!1);ra.current=no!=null||as||S!=null||N!=null||Lo||M||oe!=null;const ro=b.useCallback(F=>{const G=s5(F,{confirmOpen:tc.current,modalOpen:ra.current});G==="confirm"?j(!0):G==="clear"&&(j(!1),ps())},[ps]),sa=b.useCallback(()=>{Wt.current.clear(),Jt.current.clear(),fs.current="",HC(),i(),window.setTimeout(()=>Zt(500),80)},[i,e,Zt]),Si=b.useCallback(()=>Zt(500),[Zt]),Xn=b.useRef(kr);Xn.current=kr;const nc=b.useRef(f);nc.current=f;const Ni=b.useCallback(F=>{const G=Xn.current,ce=K5(G.map(Ae=>({id:Ae.id,x:Ae.position.x,y:Ae.position.y})),nc.current,F),he=ce?G.find(Ae=>Ae.id===ce):void 0;if(!he)return;const Ee=qC(document.activeElement);v(he.id,!1),window.setTimeout(()=>{try{e.fitView({padding:.35,duration:350,nodes:[he]})}catch{}In.current=Date.now(),Ee&&z8(he.id)},30)},[v,e]),Ei=b.useCallback(F=>{v(F,!1),window.setTimeout(()=>{try{const G=Xn.current.find(ce=>ce.id===F);G&&e.fitView({padding:.3,duration:500,nodes:[G]}),In.current=Date.now()}catch{}},60)},[v,e]);b.useEffect(()=>{const F=G=>{var Ze,ht;const ce=G.target,he={tagName:ce==null?void 0:ce.tagName,isContentEditable:ce==null?void 0:ce.isContentEditable,role:(Ze=ce==null?void 0:ce.getAttribute)==null?void 0:Ze.call(ce,"role"),type:ce==null?void 0:ce.type};if(G.key==="Escape"){const ot=f3({overlayOpen:Uu.depth()>0,typing:Uw(he)});ot==="dismiss"?Uu.dismissTop():ot==="blur"?ce==null||ce.blur():(J5(he)&&(ce==null||ce.blur()),w());return}if(Bw(G))return;const Ee=qC(ce)?(ht=ce==null?void 0:ce.getAttribute)==null?void 0:ht.call(ce,"data-id"):null,Ae=Ee&&Xn.current.some(ot=>ot.id===Ee)?Ee:null,He=Q5(G,Ae);if(He.kind==="activate"){G.preventDefault(),v(He.nodeId,He.additive);return}He.kind!=="node"&&(He.nodeId==null&&b3(he)||k3({key:G.key,modalOpen:ra.current,sheetOpen:_i.current})||(G.key===" "&&(G.preventDefault(),Qt()),(G.key==="c"||G.key==="C")&&ro("shortcut"),(G.key==="r"||G.key==="R")&&sa(),(G.key==="f"||G.key==="F")&&Si(),(G.key==="l"||G.key==="L")&&Ir(),(G.key==="d"||G.key==="D")&&q(ot=>!ot),(G.key==="h"||G.key==="H")&&Bs(ot=>!ot),(G.key==="u"||G.key==="U")&&Y(ot=>!ot),(G.key==="a"||G.key==="A")&&wt.current.claude&&Or(),(G.key==="j"||G.key==="J")&&Ni(1),(G.key==="k"||G.key==="K")&&Ni(-1),(G.key==="t"||G.key==="T")&&Yn(ot=>ot==="dark"?"light":"dark"),(G.key==="m"||G.key==="M")&&wt.current.claude&&te.current!==null&&K.current(G.shiftKey),G.key==="?"&&$(ot=>!ot)))};return window.addEventListener("keydown",F),()=>window.removeEventListener("keydown",F)},[ro,sa,Si,w,v,Ni,Qt]);const Ci=s.current.agents.size,$t=b.useMemo(()=>s3(s.current.agents.values()),[s.current,s.current.revision]),ms=b.useMemo(()=>o3(s.current.agents.values()),[s.current,s.current.revision]),gs=b.useRef(null);b.useEffect(()=>{const F=pF({waiting:$t.length,running:ms,connected:Ge}),G=gs.current;if(gs.current=F,(G==null?void 0:G.title)!==F.title&&(document.title=F.title),(G==null?void 0:G.icon)!==F.icon){const ce=document.querySelector('link[rel="icon"]');ce&&(ce.href=mF[F.icon])}},[$t.length,ms,Ge]);const[Pd,oa]=b.useState(""),rc=yF($t);b.useEffect(()=>{oa(F=>vF(F,rc))},[rc]);const[ys,ji]=b.useState(()=>typeof Notification>"u"?"denied":Notification.permission),[Qn,aa]=b.useState(null),[sc,oc]=b.useState(!1),[Ur,Ti]=b.useState(!0),[Ld,ac]=b.useState(!1);b.useEffect(()=>{let F=!0;return fetch("/api/prefs").then(G=>G.ok?G.json():null).then(G=>{var ce;!F||!(G!=null&&G.ok)||(Ti(((ce=G.prefs)==null?void 0:ce.notifications)!==!1),ac(G.notificationsVetoed===!0))}).catch(()=>{}),()=>{F=!1}},[]);const ic=b.useRef(()=>{}),_n=b.useCallback(()=>{const F=!Ur;Ti(F),F&&typeof Notification<"u"&&Notification.permission==="default"&&ic.current(),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({notifications:F})}).then(G=>G.ok?G.json():null).then(G=>{var ce;G!=null&&G.ok&&(Ti(((ce=G.prefs)==null?void 0:ce.notifications)!==!1),ac(G.notificationsVetoed===!0))}).catch(()=>{})},[Ur]),vs=typeof Notification<"u",ia=u3(ys,vs);b.useEffect(()=>{ia&&Ur&&$t.length>0&&oc(!0)},[ia,Ur,$t.length]),b.useEffect(()=>{if(!Qn)return;const G=setTimeout(()=>aa(null),Qn==="blocked"?8e3:4e3);return()=>clearTimeout(G)},[Qn]);const la=b.useCallback(()=>{typeof Notification>"u"||Notification.requestPermission().then(F=>{const G=F;ji(G),G==="granted"?aa("on"):G==="denied"&&aa("blocked")})},[]);ic.current=la;const so=b.useRef(new Set),ca=b.useRef(null),Ri=$t.map(F=>sd(F.id,F.waiting)).join("|");return b.useEffect(()=>{c3(ca.current,ys)&&(ca.current=ys,so.current=hk($t))},[ys]),b.useEffect(()=>{if(typeof Notification>"u"||Notification.permission!=="granted"||ca.current===null)return;const F=typeof document>"u"||!document.hidden,G=i3($t,so.current,F,Ur);for(const ce of G)try{const he=new Notification(ce.title,{body:ce.body,tag:ce.key});he.onclick=()=>{window.focus(),Ei(ce.sessionId),he.close()}}catch{}so.current=F?hk($t):l3($t,G,so.current)},[Ri]),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:Ut}),Oe?d.jsxs("button",{type:"button",className:"v stale",onClick:()=>{_t(),An()},"aria-haspopup":"dialog","aria-label":A8({...Oe,open:on}),title:Oe.kind==="restart"?`Running v${Oe.from}; v${Oe.to} is installed on disk. Restart to pick it up · click for what's new`:`Running v${Oe.from}; v${Oe.to} is on npm · click for what's new`,children:["v",Oe.from,d.jsx("span",{className:"v-dot","aria-hidden":!0})]}):(()=>{const F={running:_e,latest:se==null?void 0:se.latest,latestPending:se==null?void 0:se.latestPending,checkedAgo:se!=null&&se.checkedAt?lw(xt-se.checkedAt):null,checkDisabled:se==null?void 0:se.checkDisabled,checking:we};return d.jsxs("button",{type:"button",className:we?"v checking":"v",onClick:()=>{_t(),Ue(!0)},"aria-busy":we||void 0,"aria-haspopup":"dialog","aria-label":R8(F),title:T8(F),children:["v",F.running]})})()]}),d.jsx("span",{className:"status",children:(()=>{const F=D8({connected:Ge,paused:Lr,held:Xt.size,dropped:Xt.dropped});return F.resting?null:d.jsx("span",{className:`pill ${F.tone}`,title:F.title,children:d.jsxs("span",{className:"pill-box",children:[d.jsx("span",{className:"pill-widest","aria-hidden":!0,children:F.widest}),d.jsx("span",{className:"pill-label",children:F.label})]})})})()}),d.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:Pd}),$t.length>0&&d.jsxs("button",{type:"button",className:"waiting-stat",onClick:()=>Ei($t[0].id),title:`Blocked waiting for you — click to go to the one that has been stuck longest:
|
|
242
|
-
${$t.map(F=>` ${F.label}: ${Sl(F.waiting)} (${lw(xt-F.waiting.since)})`).join(`
|
|
243
|
-
`)}`,"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"]}),sc&&ia&&Ur&&d.jsx("button",{type:"button",className:"notify-ask",onClick:la,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"}),Qn&&d.jsx("span",{className:Qn==="on"?"notify-said":"notify-said notify-said-blocked",role:"status",title:Qn==="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:Qn==="on"?"notifications on":"notifications blocked"})]}),an&&(()=>{const F=jn(an),G=Math.max(0,((an.endedAt??xt)-an.startedAt)/1e3),ce=an.state==="active"?zw(F.total,G):null,he=l.size-1;return d.jsxs("button",{type:"button",className:"selected-ribbon",title:`Fit view to ${an.label}`,onClick:()=>{try{const Ee=kr.find(Ae=>Ae.id===an.id);Ee&&e.fitView({padding:.35,duration:500,nodes:[Ee]}),In.current=Date.now()}catch{}},children:[d.jsx("span",{className:`state-pill state-${an.state}`,children:an.state==="active"?"live":an.state}),d.jsx("span",{className:"selected-label",children:an.label}),F.total>0&&d.jsxs("span",{className:"selected-cost",children:[Je(F.total),ce?d.jsxs("span",{className:"selected-rate",children:[" · ",ce]}):null]}),he>0&&d.jsxs("span",{className:"selected-extra",children:["+",he]}),d.jsx("span",{"aria-hidden":!0,className:"selected-close",onClick:Ee=>{Ee.stopPropagation(),w()},children:"×"})]})})(),d.jsxs("div",{className:"actions",children:[d.jsxs("div",{className:"action-run",children:[d.jsx("button",{className:"btn icon-btn",onClick:Ir,title:`${z?"Hide":"Show"} session list (L)`,"aria-label":"Toggle session list","aria-expanded":z,"aria-controls":z?"session-list":void 0,children:"☰"}),d.jsx("button",{className:"btn icon-btn",onClick:()=>Y(F=>!F),title:`${V?"Hide":"Show"} usage panel (U)`,"aria-label":"Toggle usage panel","aria-expanded":V,"aria-controls":V?"usage-panel":void 0,children:"$"}),at.claude&&d.jsx("button",{className:"btn icon-btn",onClick:Or,title:`${B?"Hide":"Show"} accounts (A)`,"aria-label":"Toggle accounts panel","aria-expanded":B,"aria-controls":B?"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:()=>X(F=>!F),title:`${R?"Hide":"Show"} this machine — cores, memory, temperature`,"aria-label":"Toggle machine detail","aria-expanded":R,"aria-controls":R?"system-panel":void 0,children:d.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round","aria-hidden":!0,children:[d.jsx("rect",{x:"3.6",y:"3.6",width:"6.8",height:"6.8",rx:"1.2"}),d.jsx("path",{d:"M5.8 1.4v2.2M8.2 1.4v2.2M5.8 10.4v2.2M8.2 10.4v2.2M1.4 5.8h2.2M1.4 8.2h2.2M10.4 5.8h2.2M10.4 8.2h2.2"})]})}),d.jsx("button",{className:"btn icon-btn",onClick:()=>Bs(F=>!F),title:"Usage history — ccusage (H)","aria-label":"Open usage history","aria-haspopup":"dialog",children:d.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round","aria-hidden":!0,children:[d.jsx("line",{x1:"3",y1:"11.5",x2:"3",y2:"7"}),d.jsx("line",{x1:"7",y1:"11.5",x2:"7",y2:"3"}),d.jsx("line",{x1:"11",y1:"11.5",x2:"11",y2:"8.5"})]})}),d.jsxs("button",{className:`btn icon-btn bw-btn${Gn>0?" has-findings":$r?" watching":""}`,onClick:()=>Us(F=>!F),title:$r?"Browser watch — watching; the deck is keeping its own copy":"Browser watch — not watching; reading the browser's history live","aria-label":`Browser watch, ${$r?"watching":"not watching"}`+(Gn>0?`, ${Gn} 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"}),$r||Gn>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"})]}),Gn>0&&d.jsx("span",{className:"bw-badge","aria-hidden":!0,children:Gn})]})]}),d.jsxs("div",{className:"action-run",children:[at.claude&&Z!==null&&d.jsxs("div",{className:"sound-slot",children:[d.jsx("button",{ref:Ve,className:"btn icon-btn",onClick:()=>ke(F=>!F),...Ct(!1),title:NF(at,{on:Z===!0,locked:De==="locked",prefs:D}),"aria-label":"Sound settings","aria-haspopup":"dialog","aria-expanded":me,"aria-controls":me?"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"}),Z?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"})]})]})}),me&&d.jsx(M5,{onClose:()=>ke(!1),soundOn:Z===!0,onToggleSound:J,prefs:D,onLevel:(F,G)=>fe(F,{level:G}),onFigure:(F,G)=>fe(F,{figure:G}),onPreview:F=>ie(F),notifyOn:Ur,onToggleNotify:_n,notifyVetoed:Ld,notifyPermission:vs?ys:"unsupported",onAskNotify:la,openerRef:Ve})]}),d.jsx("button",{className:"btn icon-btn",onClick:()=>Yn(F=>F==="dark"?"light":"dark"),title:`Switch to ${gr==="dark"?"light":"dark"} mode (T)`,"aria-label":"Toggle theme",children:gr==="dark"?"☀":"☾"})]})]})]}),Hl?d.jsxs("div",{className:"ver-banner done",role:"status",children:[d.jsx("span",{className:"ver-dot"}),d.jsxs("strong",{children:["Restarted — now running v",Hl,"."]}),d.jsx("span",{className:"ver-sub",children:"The canvas replayed from the event log."})]}):Vl&&!Ge?d.jsxs("div",{className:"conn-banner",role:"alert",children:[d.jsx("span",{className:"conn-dot"}),bn?Vs==="npx"?"Fetching the new version with npx — this can take a minute…":`Restarting ${Ut}…`:(()=>{const F=L8({connected:Ge,paused:Lr});return d.jsxs(d.Fragment,{children:[`Lost connection to the ${Ut} server. Reconnecting…`,F&&d.jsx("span",{className:"conn-sub",children:F})]})})()]}):on&&Oe?d.jsxs("div",{className:`ver-banner ${Oe.kind}`,role:"status",children:[d.jsx("span",{className:`ver-dot${ui==null?"":" armed"}`}),Oe.kind==="restart"?d.jsxs(d.Fragment,{children:[d.jsxs("strong",{children:["v",Oe.to," is installed — this deck still runs v",Oe.from,"."]}),se!=null&&se.canRestart?d.jsxs(d.Fragment,{children:[d.jsx("button",{type:"button",className:"ver-act",onClick:()=>mr(),...Ct(bn),title:`Stop this process and bring it back on the same port. The canvas replays from the event log.
|
|
244
|
-
|
|
245
|
-
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:bn?"restarting…":tt.label}),!bn&&d.jsx("span",{className:"ver-sub",children:tt.clause}),d.jsxs("button",{type:"button",className:`ver-auto${qr?" on":""}`,role:"switch","aria-checked":qr,onClick:Ed,"aria-label":"Auto-restart when idle",title:qr?"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}),d.jsx("span",{"aria-hidden":!0,children:t5(qr,ui)})]})]}):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:[Ut," v",Oe.to," is out — you are on v",Oe.from,"."]}),(se==null?void 0:se.upgradeMode)==="install"&&Ot!=="failed"&&d.jsx("button",{type:"button",className:"ver-act",onClick:ai,...Ct(Ot==="running",Ot==="done"),title:`Runs ${((cc=se==null?void 0:se.upgrade)==null?void 0:cc.command)??(se==null?void 0:se.command)??"npm i -g"} here, then restarts once nothing is running.`,children:Ot==="running"?"installing…":Ot==="done"?"installed":"Update now"}),(se==null?void 0:se.upgradeMode)==="npx"&&(se==null?void 0:se.canRestart)&&d.jsx("button",{type:"button",className:"ver-act",onClick:()=>mr({upgrade:!0}),...Ct(bn),title:`Runs ${se==null?void 0:se.command} and hands it this port. Nothing is installed globally — npx unpacks its own copy.`,children:bn?"fetching…":Ot==="failed"?"Retry update":"Update & restart"}),Ot==="failed"?d.jsxs("span",{className:"ver-sub fail",title:((Wr=se==null?void 0:se.upgrade)==null?void 0:Wr.error)??"",children:[(se==null?void 0:se.upgradeMode)==="npx"?"update failed":"install failed",": ",((ua=se==null?void 0:se.upgrade)==null?void 0:ua.error)??"unknown error"," — run it yourself:"]}):(se==null?void 0:se.upgradeMode)==="npx"?d.jsx("span",{className:"ver-sub",children:se!=null&&se.canRestart?"npx cannot upgrade in place, so the deck re-runs:":qv.npx}):se!=null&&se.upgradeBlocked?d.jsx("span",{className:"ver-sub",children:Object.hasOwn(qv,se.upgradeBlocked)?qv[se.upgradeBlocked]:"cannot install from here"}):null,d.jsxs("button",{type:"button",className:"ver-cmd",onClick:Mr,title:"Copy to clipboard",children:[d.jsx("code",{children:se==null?void 0:se.command}),d.jsx("span",{className:"ver-cmd-hint",children:rt?"copied":"copy"})]})]}),d.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:Io,children:"×"})]}):zs&&wn?d.jsxs("div",{className:"ver-banner",role:"status",children:[d.jsx("span",{className:"ver-dot"}),d.jsxs("strong",{children:[wn," still works — the deck is called ",Ut," now."]}),se!=null&&se.renameFix?d.jsx("span",{className:"ver-sub",children:se.renameFix}):null,d.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:Po,children:"×"})]}):null,V&&d.jsx(dq,{state:s.current,now:xt,providers:at,onClose:()=>Y(!1)}),B&&at.claude&&d.jsx(YD,{onClose:()=>ne(!1)}),R&&d.jsx(zq,{usageOpen:V,onClose:()=>X(!1)}),z&&d.jsx(O4,{state:s.current,now:xt,selectedIds:l,onSelect:Ei,onClose:()=>I(!1)}),d.jsxs("main",{id:"canvas",tabIndex:-1,className:`canvas-wrap${Rd?" bubbling":""}${bi?" dragging-any":""}`,ref:Jo,onMouseDownCapture:jd,onPointerDownCapture:us,onPointerUpCapture:us,onWheelCapture:us,children:[Ci===0&&d.jsx(dU,{live:Ge,everConnected:Vl,providers:at,workspace:yt}),(na.length>1||Go.size>0)&&d.jsx("div",{ref:Fo,className:`cat-filter-bar${dt?" occluded":""}`,role:"group","aria-label":"Filter tools by category",children:na.map(F=>{const G=Go.has(F);return d.jsxs("button",{type:"button",className:`cat-filter${G?" off":""}`,onClick:()=>$d(F),"aria-pressed":!G,title:`${G?"Show":"Hide"} ${vw[F]} tools`,children:[d.jsx("span",{className:"cat-emoji",children:yw[F]}),d.jsx("span",{className:"cat-name",children:vw[F]})]},F)})}),d.jsxs(uT,{nodes:Od,edges:Id,nodeTypes:F8,fitView:!Ks,fitViewOptions:{padding:.25,duration:$v({durationMs:DC,documentHidden:document.hidden})?DC:0},minZoom:.2,maxZoom:1.6,panOnScroll:!0,nodesDraggable:!0,nodesConnectable:!1,selectionOnDrag:!1,nodeDragThreshold:5,onNodeClick:(F,G)=>{if(G.type==="sessionGroup"){w();return}v(G.id,F.shiftKey)},onPaneClick:()=>w(),onMoveStart:F=>{$C(Ko(F))&&ds()},onMove:(F,G)=>{Vo(),$C(Ko(F))&&ds(),wr.current&&window.clearTimeout(wr.current),wr.current=window.setTimeout(()=>aU(G),250)},onNodeDragStart:(F,G)=>{var ce;if(Ad(),Zo.current=!0,Vn.current=new Map,ta(!0),Vo(),ds(),G.type==="sessionGroup"){const he=(ce=G.data)==null?void 0:ce.sessionId,Ee=new Map;if(he)for(const Ae of kr){const He=Ae.data;(He==null?void 0:He.sessionId)===he&&Ee.set(Ae.id,{x:Ae.position.x,y:Ae.position.y})}Ys.current={start:{x:G.position.x,y:G.position.y},members:Ee};return}Wt.current.set(G.id,{x:G.position.x,y:G.position.y})},onNodeDrag:(F,G)=>{var ce;if(Vo(),G.type==="sessionGroup"){const he=Ys.current;if(!he)return;const Ee=G.position.x-he.start.x,Ae=G.position.y-he.start.y;for(const[Ze,ht]of he.members){const ot={x:ht.x+Ee,y:ht.y+Ae};Wt.current.set(Ze,ot),Jt.current.set(Ze,ot)}const He=Vn.current;if(He){for(const[Ze,ht]of he.members)He.set(Ze,{x:ht.x+Ee,y:ht.y+Ae});He.set(G.id,{x:G.position.x,y:G.position.y})}Pr(Ze=>Ze+1);return}Wt.current.set(G.id,{x:G.position.x,y:G.position.y}),Jt.current.set(G.id,{x:G.position.x,y:G.position.y}),(ce=Vn.current)==null||ce.set(G.id,{x:G.position.x,y:G.position.y}),Pr(he=>he+1)},onNodeDragStop:(F,G)=>{if(Vo(),Zo.current=!1,Vn.current=null,ta(!1),Gs(ce=>ce+1),G.type==="sessionGroup"){const ce=Ys.current;if(ce){const he=G.position.x-ce.start.x,Ee=G.position.y-ce.start.y;for(const[Ae,He]of ce.members){const Ze={x:He.x+he,y:He.y+Ee};Wt.current.set(Ae,Ze),Jt.current.set(Ae,Ze)}}Ys.current=null,Dv(Jt.current,Wt.current),Gs(he=>he+1);return}Wt.current.set(G.id,{x:G.position.x,y:G.position.y}),Jt.current.set(G.id,{x:G.position.x,y:G.position.y}),Dv(Jt.current,Wt.current)},children:[d.jsx(yL,{gap:28,size:1,color:Ht["--grid-line"]}),d.jsx(H3,{onFit:()=>{In.current=Date.now()}}),d.jsx(E4,{agents:s.current.agents,visibleAgentIds:wi,positions:Jt.current,pinned:Wt.current,measured:jt.current,spotlight:vi,hiddenCategories:Go,now:xt,onOpenTool:g}),d.jsxs(dL,{showInteractive:!1,children:[d.jsx(jr,{onClick:Qo,title:Js?"Recenter view + re-enable autofit":"Recenter view (autofit already on)","aria-label":"Recenter view",style:Js?{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(jr,{onClick:Qt,title:P8({paused:Lr,held:Xt.size,dropped:Xt.dropped}),"aria-label":$8,"aria-pressed":Lr,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(jr,{onClick:sa,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(jr,{onClick:()=>ro("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(jr,{onClick:()=>$(F=>!F),title:"Keyboard shortcuts (?)","aria-label":"Open the keyboard shortcuts","aria-haspopup":"dialog",children:d.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[d.jsx("path",{d:"M8.6 8.4a3.5 3.5 0 1 1 4.6 3.35c-.85.3-1.2 1-1.2 1.85v1",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),d.jsx("path",{d:"M12 18.4v.2",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",fill:"none"})]})})]}),d.jsx(sL,{zoomable:!0,pannable:!0,nodeColor:Xs,nodeStrokeWidth:2,maskColor:Ht["--minimap-mask"],style:vr})]})]}),A&&an?d.jsxs("aside",{className:"detail","aria-label":"Detail",children:[d.jsx("button",{type:"button",className:"glyph-btn detail-close",title:"Close panel","aria-label":"Close detail panel",onClick:()=>q(!1),children:"×"}),d.jsx(fU,{agent:an,now:xt,onOpenTool:g,onShowSummary:F=>{O.has(F)&&(O.delete(F),WC(O)),k(F)},onExportSession:F=>iU(s.current,F)})]}):null,no&&d.jsx(P3,{tool:no,onClose:()=>g(null)}),as&&d.jsx(RF,{providers:at,onClose:()=>Bs(!1)}),Lo&&d.jsx(BF,{onClose:()=>Us(!1),onSeen:F=>{qo(F);try{localStorage.setItem(c1,String(F))}catch{}},onWatching:Hs,palette:Ht}),S&&(()=>{const F=s.current.agents.get(S);return F?d.jsx(j3,{agent:F,onClose:()=>_(null)}):null})(),N&&d.jsx(A4,{state:s.current,sessionId:N,onClose:()=>{O.add(N),WC(O),k(null)}}),oe&&d.jsx(V5,{entries:oe.entries,since:oe.since,firstRun:oe.firstRun,running:_e,onClose:()=>Se(null)}),M&&d.jsx(d5,{onClose:()=>$(!1)}),C&&d.jsx(l5,{agentCount:Ci,onConfirm:()=>ro("confirmation"),onCancel:()=>j(!1)})]})}function dU({live:e,everConnected:t,providers:n,workspace:s}){const a=!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"})]})]}),a?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:Ut})," is still running in your terminal, then this page will resume automatically."]})]}):hU(n,s)]})}function hU(e,t){const n=M8(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:Ut})," is running."]}),SF(e).map(s=>d.jsx("p",{className:"hint-row",children:s.spans.map((a,i)=>a.code?d.jsx("code",{children:a.text},i):d.jsx("span",{children:a.text},i))},s.provider))]})}function fU({agent:e,now:t,onOpenTool:n,onShowSummary:s,onExportSession:a}){const i=Bu(e.startedAt,e.endedAt,t),l=jn(e),u=l.total>0,f=e.usage.inputTokens+e.usage.outputTokens,p=new Map;for(const N of e.tools){const k=xA(N.name);p.set(k,(p.get(k)??0)+1)}const h=e.tools.filter(N=>N.ok===!1).length,g=e.tools.filter(N=>!N.endedAt).length,v=Array.from(p.entries()).sort((N,k)=>k[1]-N[1]),w=p.has("mcp")?b4(e.tools.map(N=>N.name)):null;return d.jsxs(d.Fragment,{children:[d.jsxs("header",{className:"detail-hero",children:[d.jsxs("div",{className:"hero-line",children:[d.jsx("span",{className:`state-pill state-${e.state}`,children:e.state==="active"?"live":e.state}),d.jsx("h2",{className:"hero-title",title:e.cwd??e.label,children:e.label})]}),d.jsxs("div",{className:"hero-meta",children:[d.jsx("span",{className:"hero-meta-item",children:e.kind}),d.jsx("span",{className:"hero-sep",children:"·"}),d.jsx("span",{className:"hero-meta-item",title:`started ${new Date(e.startedAt).toLocaleString()}`,children:i}),e.model&&(()=>{const N=NT(e);return d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"hero-sep",children:"·"}),d.jsxs("span",{className:"model-chip","data-family":rd(e.model),title:N.length>0?`${e.model}
|
|
246
|
-
spend on this panel also covers:
|
|
247
|
-
${N.join(`
|
|
248
|
-
`)}`:e.model,children:[Ds(e.model),N.length>0?` +${N.length}`:""]})]})})()]}),u&&d.jsxs("div",{className:"hero-cost",children:[d.jsxs("div",{className:"hero-cost-headline",children:[d.jsx("span",{className:"hero-cost-value",children:Je(l.total)}),d.jsx("span",{className:"hero-cost-label",children:"spend"})]}),d.jsx(Hw,{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"}),a&&d.jsx("button",{type:"button",className:"btn hero-action-btn",onClick:()=>a(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"]}),h>0&&d.jsxs("span",{className:"ac-item ac-err",children:[d.jsx("b",{children:h})," err"]})]}),d.jsx("div",{className:"cat-strip",children:v.map(([N,k])=>{const S=N==="mcp"?w:null,_=S==null?void 0:S.hue,E=`${k} ${vw[N]} call${k===1?"":"s"}`;return d.jsxs("span",{className:`cat-chip cat-${N}${_!=null?" mcp-hue":""}`,style:_!=null?{"--mcp-hue":_}:void 0,title:S?`${E}, all to ${S.label}`:E,children:[d.jsx("span",{className:"cat-emoji",children:yw[N]}),d.jsx("span",{className:"cat-count",children:k}),S&&d.jsx("span",{className:"cat-server",children:S.label})]},N)})})]})]}),f>0&&d.jsxs("section",{className:"detail-section",children:[d.jsx("h3",{children:"Tokens"}),d.jsxs("div",{className:"tokens-grid",children:[d.jsxs("div",{children:[d.jsx("span",{className:"k",children:"in"}),d.jsx("b",{children:e.usage.inputTokens.toLocaleString()})]}),d.jsxs("div",{children:[d.jsx("span",{className:"k",children:"out"}),d.jsx("b",{children:e.usage.outputTokens.toLocaleString()})]}),d.jsxs("div",{children:[d.jsx("span",{className:"k",children:"cache r"}),d.jsx("b",{children:e.usage.cacheReadTokens.toLocaleString()})]}),d.jsxs("div",{children:[d.jsx("span",{className:"k",children:"cache c"}),d.jsx("b",{children:e.usage.cacheCreateTokens.toLocaleString()})]})]})]}),d.jsxs("section",{className:"detail-section",children:[d.jsx("h3",{children:"Identity"}),d.jsxs("div",{children:[e.cwd&&d.jsxs("div",{className:"row",children:[d.jsx("span",{className:"k",children:"cwd"}),d.jsx("span",{className:"v",title:e.cwd,children:e.cwd})]}),d.jsxs("div",{className:"row",children:[d.jsx("span",{className:"k",children:"session"}),d.jsxs("span",{className:"v",children:[e.sessionId.slice(0,12),"…"]})]}),e.parentId&&d.jsxs("div",{className:"row",children:[d.jsx("span",{className:"k",children:"parent"}),d.jsxs("span",{className:"v",children:[e.parentId.slice(0,12),"…"]})]})]})]}),e.prompts.length>0&&d.jsxs("section",{className:"detail-section",children:[d.jsxs("h3",{children:["Prompts ",d.jsx("span",{className:"section-count",children:e.prompts.length})]}),d.jsx("div",{className:"prompts",children:e.prompts.slice().reverse().map((N,k)=>{const S=K4(N.at,t);return d.jsxs("div",{className:"prompt-entry",children:[d.jsx("div",{className:"prompt-time",title:S.title,children:S.label}),d.jsx("div",{className:"prompt-text",children:N.text})]},k)})})]}),d.jsxs("section",{className:"detail-section",children:[d.jsxs("h3",{children:["Tool calls ",d.jsx("span",{className:"section-count",children:e.tools.length})]}),e.tools.length===0&&d.jsx("div",{className:"empty",children:"No tool calls yet."}),d.jsx("div",{children:e.tools.slice().reverse().map(N=>d.jsx(mU,{t:N,onClick:()=>n(N.id)},N.id))})]})]})}const pU={inflight:"in-flight",done:"done",err:"error"};function mU({t:e,onClick:t}){const n=e.endedAt==null?"inflight":e.ok===!1?"err":"done",s=CT(e,"…");return d.jsxs("button",{className:"tool clickable",title:e.inputPreview||e.name,onClick:t,children:[d.jsxs("span",{className:"name",children:[d.jsx("span",{className:`status-dot ${n}`,"aria-hidden":!0}),d.jsx("span",{className:"vis-hidden",children:pU[n]}),e.name]}),d.jsx("span",{style:{color:"var(--muted)"},children:s})]})}try{V4(window.localStorage)}catch{}const gU=gM.createRoot(document.getElementById("root"));gU.render(d.jsx(cU,{}));
|