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
|
@@ -0,0 +1,260 @@
|
|
|
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 ru=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function _w(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Jh={exports:{}},sl={},ef={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 ab;function fM(){if(ab)return Ke;ab=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"),d=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),g=Symbol.iterator;function y(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(){}},S=Object.assign,k={};function N(P,Y,de){this.props=P,this.context=Y,this.refs=k,this.updater=de||w}N.prototype.isReactComponent={},N.prototype.setState=function(P,Y){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,Y,"setState")},N.prototype.forceUpdate=function(P){this.updater.enqueueForceUpdate(this,P,"forceUpdate")};function _(){}_.prototype=N.prototype;function E(P,Y,de){this.props=P,this.context=Y,this.refs=k,this.updater=de||w}var j=E.prototype=new _;j.constructor=E,S(j,N.prototype),j.isPureReactComponent=!0;var C=Array.isArray,M=Object.prototype.hasOwnProperty,$={current:null},I={key:!0,ref:!0,__self:!0,__source:!0};function F(P,Y,de){var U,z={},Q=null,W=null;if(Y!=null)for(U in Y.ref!==void 0&&(W=Y.ref),Y.key!==void 0&&(Q=""+Y.key),Y)M.call(Y,U)&&!I.hasOwnProperty(U)&&(z[U]=Y[U]);var le=arguments.length-2;if(le===1)z.children=de;else if(1<le){for(var pe=Array(le),ge=0;ge<le;ge++)pe[ge]=arguments[ge+2];z.children=pe}if(P&&P.defaultProps)for(U in le=P.defaultProps,le)z[U]===void 0&&(z[U]=le[U]);return{$$typeof:e,type:P,key:Q,ref:W,props:z,_owner:$.current}}function O(P,Y){return{$$typeof:e,type:P.type,key:Y,ref:P.ref,props:P.props,_owner:P._owner}}function A(P){return typeof P=="object"&&P!==null&&P.$$typeof===e}function L(P){var Y={"=":"=0",":":"=2"};return"$"+P.replace(/[=:]/g,function(de){return Y[de]})}var H=/\/+/g;function X(P,Y){return typeof P=="object"&&P!==null&&P.key!=null?L(""+P.key):Y.toString(36)}function T(P,Y,de,U,z){var Q=typeof P;(Q==="undefined"||Q==="boolean")&&(P=null);var W=!1;if(P===null)W=!0;else switch(Q){case"string":case"number":W=!0;break;case"object":switch(P.$$typeof){case e:case t:W=!0}}if(W)return W=P,z=z(W),P=U===""?"."+X(W,0):U,C(z)?(de="",P!=null&&(de=P.replace(H,"$&/")+"/"),T(z,Y,de,"",function(ge){return ge})):z!=null&&(A(z)&&(z=O(z,de+(!z.key||W&&W.key===z.key?"":(""+z.key).replace(H,"$&/")+"/")+P)),Y.push(z)),1;if(W=0,U=U===""?".":U+":",C(P))for(var le=0;le<P.length;le++){Q=P[le];var pe=U+X(Q,le);W+=T(Q,Y,de,pe,z)}else if(pe=y(P),typeof pe=="function")for(P=pe.call(P),le=0;!(Q=P.next()).done;)Q=Q.value,pe=U+X(Q,le++),W+=T(Q,Y,de,pe,z);else if(Q==="object")throw Y=String(P),Error("Objects are not valid as a React child (found: "+(Y==="[object Object]"?"object with keys {"+Object.keys(P).join(", ")+"}":Y)+"). If you meant to render a collection of children, use an array instead.");return W}function K(P,Y,de){if(P==null)return P;var U=[],z=0;return T(P,U,"","",function(Q){return Y.call(de,Q,z++)}),U}function D(P){if(P._status===-1){var Y=P._result;Y=Y(),Y.then(function(de){(P._status===0||P._status===-1)&&(P._status=1,P._result=de)},function(de){(P._status===0||P._status===-1)&&(P._status=2,P._result=de)}),P._status===-1&&(P._status=0,P._result=Y)}if(P._status===1)return P._result.default;throw P._result}var te={current:null},Z={transition:null},V={ReactCurrentDispatcher:te,ReactCurrentBatchConfig:Z,ReactCurrentOwner:$};function J(){throw Error("act(...) is not supported in production builds of React.")}return Ke.Children={map:K,forEach:function(P,Y,de){K(P,function(){Y.apply(this,arguments)},de)},count:function(P){var Y=0;return K(P,function(){Y++}),Y},toArray:function(P){return K(P,function(Y){return Y})||[]},only:function(P){if(!A(P))throw Error("React.Children.only expected to receive a single React element child.");return P}},Ke.Component=N,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=V,Ke.act=J,Ke.cloneElement=function(P,Y,de){if(P==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+P+".");var U=S({},P.props),z=P.key,Q=P.ref,W=P._owner;if(Y!=null){if(Y.ref!==void 0&&(Q=Y.ref,W=$.current),Y.key!==void 0&&(z=""+Y.key),P.type&&P.type.defaultProps)var le=P.type.defaultProps;for(pe in Y)M.call(Y,pe)&&!I.hasOwnProperty(pe)&&(U[pe]=Y[pe]===void 0&&le!==void 0?le[pe]:Y[pe])}var pe=arguments.length-2;if(pe===1)U.children=de;else if(1<pe){le=Array(pe);for(var ge=0;ge<pe;ge++)le[ge]=arguments[ge+2];U.children=le}return{$$typeof:e,type:P.type,key:z,ref:Q,props:U,_owner:W}},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=F,Ke.createFactory=function(P){var Y=F.bind(null,P);return Y.type=P,Y},Ke.createRef=function(){return{current:null}},Ke.forwardRef=function(P){return{$$typeof:d,render:P}},Ke.isValidElement=A,Ke.lazy=function(P){return{$$typeof:h,_payload:{_status:-1,_result:P},_init:D}},Ke.memo=function(P,Y){return{$$typeof:p,type:P,compare:Y===void 0?null:Y}},Ke.startTransition=function(P){var Y=Z.transition;Z.transition={};try{P()}finally{Z.transition=Y}},Ke.unstable_act=J,Ke.useCallback=function(P,Y){return te.current.useCallback(P,Y)},Ke.useContext=function(P){return te.current.useContext(P)},Ke.useDebugValue=function(){},Ke.useDeferredValue=function(P){return te.current.useDeferredValue(P)},Ke.useEffect=function(P,Y){return te.current.useEffect(P,Y)},Ke.useId=function(){return te.current.useId()},Ke.useImperativeHandle=function(P,Y,de){return te.current.useImperativeHandle(P,Y,de)},Ke.useInsertionEffect=function(P,Y){return te.current.useInsertionEffect(P,Y)},Ke.useLayoutEffect=function(P,Y){return te.current.useLayoutEffect(P,Y)},Ke.useMemo=function(P,Y){return te.current.useMemo(P,Y)},Ke.useReducer=function(P,Y,de){return te.current.useReducer(P,Y,de)},Ke.useRef=function(P){return te.current.useRef(P)},Ke.useState=function(P){return te.current.useState(P)},Ke.useSyncExternalStore=function(P,Y,de){return te.current.useSyncExternalStore(P,Y,de)},Ke.useTransition=function(){return te.current.useTransition()},Ke.version="18.3.1",Ke}var ob;function Ol(){return ob||(ob=1,ef.exports=fM()),ef.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 ib;function pM(){if(ib)return sl;ib=1;var e=Ol(),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(d,f,p){var h,g={},y=null,w=null;p!==void 0&&(y=""+p),f.key!==void 0&&(y=""+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(d&&d.defaultProps)for(h in f=d.defaultProps,f)g[h]===void 0&&(g[h]=f[h]);return{$$typeof:t,type:d,key:y,ref:w,props:g,_owner:a.current}}return sl.Fragment=n,sl.jsx=l,sl.jsxs=l,sl}var lb;function mM(){return lb||(lb=1,Jh.exports=pM()),Jh.exports}var c=mM(),su={},tf={exports:{}},gn={},nf={exports:{}},rf={};/**
|
|
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 cb;function gM(){return cb||(cb=1,(function(e){function t(Z,V){var J=Z.length;Z.push(V);e:for(;0<J;){var P=J-1>>>1,Y=Z[P];if(0<a(Y,V))Z[P]=V,Z[J]=Y,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 V=Z[0],J=Z.pop();if(J!==V){Z[0]=J;e:for(var P=0,Y=Z.length,de=Y>>>1;P<de;){var U=2*(P+1)-1,z=Z[U],Q=U+1,W=Z[Q];if(0>a(z,J))Q<Y&&0>a(W,z)?(Z[P]=W,Z[Q]=J,P=Q):(Z[P]=z,Z[U]=J,P=U);else if(Q<Y&&0>a(W,J))Z[P]=W,Z[Q]=J,P=Q;else break e}}return V}function a(Z,V){var J=Z.sortIndex-V.sortIndex;return J!==0?J:Z.id-V.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var l=Date,d=l.now();e.unstable_now=function(){return l.now()-d}}var f=[],p=[],h=1,g=null,y=3,w=!1,S=!1,k=!1,N=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 j(Z){for(var V=n(p);V!==null;){if(V.callback===null)s(p);else if(V.startTime<=Z)s(p),V.sortIndex=V.expirationTime,t(f,V);else break;V=n(p)}}function C(Z){if(k=!1,j(Z),!S)if(n(f)!==null)S=!0,D(M);else{var V=n(p);V!==null&&te(C,V.startTime-Z)}}function M(Z,V){S=!1,k&&(k=!1,_(F),F=-1),w=!0;var J=y;try{for(j(V),g=n(f);g!==null&&(!(g.expirationTime>V)||Z&&!L());){var P=g.callback;if(typeof P=="function"){g.callback=null,y=g.priorityLevel;var Y=P(g.expirationTime<=V);V=e.unstable_now(),typeof Y=="function"?g.callback=Y:g===n(f)&&s(f),j(V)}else s(f);g=n(f)}if(g!==null)var de=!0;else{var U=n(p);U!==null&&te(C,U.startTime-V),de=!1}return de}finally{g=null,y=J,w=!1}}var $=!1,I=null,F=-1,O=5,A=-1;function L(){return!(e.unstable_now()-A<O)}function H(){if(I!==null){var Z=e.unstable_now();A=Z;var V=!0;try{V=I(!0,Z)}finally{V?X():($=!1,I=null)}}else $=!1}var X;if(typeof E=="function")X=function(){E(H)};else if(typeof MessageChannel<"u"){var T=new MessageChannel,K=T.port2;T.port1.onmessage=H,X=function(){K.postMessage(null)}}else X=function(){N(H,0)};function D(Z){I=Z,$||($=!0,X())}function te(Z,V){F=N(function(){Z(e.unstable_now())},V)}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(){S||w||(S=!0,D(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"):O=0<Z?Math.floor(1e3/Z):5},e.unstable_getCurrentPriorityLevel=function(){return y},e.unstable_getFirstCallbackNode=function(){return n(f)},e.unstable_next=function(Z){switch(y){case 1:case 2:case 3:var V=3;break;default:V=y}var J=y;y=V;try{return Z()}finally{y=J}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(Z,V){switch(Z){case 1:case 2:case 3:case 4:case 5:break;default:Z=3}var J=y;y=Z;try{return V()}finally{y=J}},e.unstable_scheduleCallback=function(Z,V,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 Y=-1;break;case 2:Y=250;break;case 5:Y=1073741823;break;case 4:Y=1e4;break;default:Y=5e3}return Y=J+Y,Z={id:h++,callback:V,priorityLevel:Z,startTime:J,expirationTime:Y,sortIndex:-1},J>P?(Z.sortIndex=J,t(p,Z),n(f)===null&&Z===n(p)&&(k?(_(F),F=-1):k=!0,te(C,J-P))):(Z.sortIndex=Y,t(f,Z),S||w||(S=!0,D(M))),Z},e.unstable_shouldYield=L,e.unstable_wrapCallback=function(Z){var V=y;return function(){var J=y;y=V;try{return Z.apply(this,arguments)}finally{y=J}}}})(rf)),rf}var ub;function yM(){return ub||(ub=1,nf.exports=gM()),nf.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 db;function vM(){if(db)return gn;db=1;var e=Ol(),t=yM();function n(r){for(var o="https://reactjs.org/docs/error-decoder.html?invariant="+r,u=1;u<arguments.length;u++)o+="&args[]="+encodeURIComponent(arguments[u]);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 d=!(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 y(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,u,m){if(u!==null&&u.type===0)return!1;switch(typeof o){case"function":case"symbol":return!0;case"boolean":return m?!1:u!==null?!u.acceptsBooleans:(r=r.toLowerCase().slice(0,5),r!=="data-"&&r!=="aria-");default:return!1}}function S(r,o,u,m){if(o===null||typeof o>"u"||w(r,o,u,m))return!0;if(m)return!1;if(u!==null)switch(u.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,u,m,v,x,R){this.acceptsBooleans=o===2||o===3||o===4,this.attributeName=m,this.attributeNamespace=v,this.mustUseProperty=u,this.propertyName=r,this.type=o,this.sanitizeURL=x,this.removeEmptyString=R}var N={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(r){N[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];N[o]=new k(o,1,!1,r[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(r){N[r]=new k(r,2,!1,r.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(r){N[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){N[r]=new k(r,3,!1,r.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(r){N[r]=new k(r,3,!0,r,null,!1,!1)}),["capture","download"].forEach(function(r){N[r]=new k(r,4,!1,r,null,!1,!1)}),["cols","rows","size","span"].forEach(function(r){N[r]=new k(r,6,!1,r,null,!1,!1)}),["rowSpan","start"].forEach(function(r){N[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);N[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);N[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);N[o]=new k(o,1,!1,r,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(r){N[r]=new k(r,1,!1,r.toLowerCase(),null,!1,!1)}),N.xlinkHref=new k("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(r){N[r]=new k(r,1,!1,r.toLowerCase(),null,!0,!0)});function j(r,o,u,m){var v=N.hasOwnProperty(o)?N[o]:null;(v!==null?v.type!==0:m||!(2<o.length)||o[0]!=="o"&&o[0]!=="O"||o[1]!=="n"&&o[1]!=="N")&&(S(o,u,v,m)&&(u=null),m||v===null?y(o)&&(u===null?r.removeAttribute(o):r.setAttribute(o,""+u)):v.mustUseProperty?r[v.propertyName]=u===null?v.type===3?!1:"":u:(o=v.attributeName,m=v.attributeNamespace,u===null?r.removeAttribute(o):(v=v.type,u=v===3||v===4&&u===!0?"":""+u,m?r.setAttributeNS(m,o,u):r.setAttribute(o,u))))}var C=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,M=Symbol.for("react.element"),$=Symbol.for("react.portal"),I=Symbol.for("react.fragment"),F=Symbol.for("react.strict_mode"),O=Symbol.for("react.profiler"),A=Symbol.for("react.provider"),L=Symbol.for("react.context"),H=Symbol.for("react.forward_ref"),X=Symbol.for("react.suspense"),T=Symbol.for("react.suspense_list"),K=Symbol.for("react.memo"),D=Symbol.for("react.lazy"),te=Symbol.for("react.offscreen"),Z=Symbol.iterator;function V(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 Y(r){if(P===void 0)try{throw Error()}catch(u){var o=u.stack.trim().match(/\n( *(at )?)/);P=o&&o[1]||""}return`
|
|
34
|
+
`+P+r}var de=!1;function U(r,o){if(!r||de)return"";de=!0;var u=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(o)if(o=function(){throw Error()},Object.defineProperty(o.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(o,[])}catch(ue){var m=ue}Reflect.construct(r,[],o)}else{try{o.call()}catch(ue){m=ue}r.call(o.prototype)}else{try{throw Error()}catch(ue){m=ue}r()}}catch(ue){if(ue&&m&&typeof ue.stack=="string"){for(var v=ue.stack.split(`
|
|
35
|
+
`),x=m.stack.split(`
|
|
36
|
+
`),R=v.length-1,G=x.length-1;1<=R&&0<=G&&v[R]!==x[G];)G--;for(;1<=R&&0<=G;R--,G--)if(v[R]!==x[G]){if(R!==1||G!==1)do if(R--,G--,0>G||v[R]!==x[G]){var ee=`
|
|
37
|
+
`+v[R].replace(" at new "," at ");return r.displayName&&ee.includes("<anonymous>")&&(ee=ee.replace("<anonymous>",r.displayName)),ee}while(1<=R&&0<=G);break}}}finally{de=!1,Error.prepareStackTrace=u}return(r=r?r.displayName||r.name:"")?Y(r):""}function z(r){switch(r.tag){case 5:return Y(r.type);case 16:return Y("Lazy");case 13:return Y("Suspense");case 19:return Y("SuspenseList");case 0:case 2:case 15:return r=U(r.type,!1),r;case 11:return r=U(r.type.render,!1),r;case 1:return r=U(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 I:return"Fragment";case $:return"Portal";case O:return"Profiler";case F:return"StrictMode";case X:return"Suspense";case T:return"SuspenseList"}if(typeof r=="object")switch(r.$$typeof){case L:return(r.displayName||"Context")+".Consumer";case A:return(r._context.displayName||"Context")+".Provider";case H:var o=r.render;return r=r.displayName,r||(r=o.displayName||o.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case K:return o=r.displayName||null,o!==null?o:Q(r.type)||"Memo";case D:o=r._payload,r=r._init;try{return Q(r(o))}catch{}}return null}function W(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===F?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o}return null}function le(r){switch(typeof r){case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function pe(r){var o=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(o==="checkbox"||o==="radio")}function ge(r){var o=pe(r)?"checked":"value",u=Object.getOwnPropertyDescriptor(r.constructor.prototype,o),m=""+r[o];if(!r.hasOwnProperty(o)&&typeof u<"u"&&typeof u.get=="function"&&typeof u.set=="function"){var v=u.get,x=u.set;return Object.defineProperty(r,o,{configurable:!0,get:function(){return v.call(this)},set:function(R){m=""+R,x.call(this,R)}}),Object.defineProperty(r,o,{enumerable:u.enumerable}),{getValue:function(){return m},setValue:function(R){m=""+R},stopTracking:function(){r._valueTracker=null,delete r[o]}}}}function Ne(r){r._valueTracker||(r._valueTracker=ge(r))}function ce(r){if(!r)return!1;var o=r._valueTracker;if(!o)return!0;var u=o.getValue(),m="";return r&&(m=pe(r)?r.checked?"true":"false":r.value),r=m,r!==u?(o.setValue(r),!0):!1}function we(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 Ce(r,o){var u=o.checked;return J({},o,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:u??r._wrapperState.initialChecked})}function _e(r,o){var u=o.defaultValue==null?"":o.defaultValue,m=o.checked!=null?o.checked:o.defaultChecked;u=le(o.value!=null?o.value:u),r._wrapperState={initialChecked:m,initialValue:u,controlled:o.type==="checkbox"||o.type==="radio"?o.checked!=null:o.value!=null}}function We(r,o){o=o.checked,o!=null&&j(r,"checked",o,!1)}function Se(r,o){We(r,o);var u=le(o.value),m=o.type;if(u!=null)m==="number"?(u===0&&r.value===""||r.value!=u)&&(r.value=""+u):r.value!==""+u&&(r.value=""+u);else if(m==="submit"||m==="reset"){r.removeAttribute("value");return}o.hasOwnProperty("value")?Qe(r,o.type,u):o.hasOwnProperty("defaultValue")&&Qe(r,o.type,le(o.defaultValue)),o.checked==null&&o.defaultChecked!=null&&(r.defaultChecked=!!o.defaultChecked)}function re(r,o,u){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,u||o===r.value||(r.value=o),r.defaultValue=o}u=r.name,u!==""&&(r.name=""),r.defaultChecked=!!r._wrapperState.initialChecked,u!==""&&(r.name=u)}function Qe(r,o,u){(o!=="number"||we(r.ownerDocument)!==r)&&(u==null?r.defaultValue=""+r._wrapperState.initialValue:r.defaultValue!==""+u&&(r.defaultValue=""+u))}var ft=Array.isArray;function ut(r,o,u,m){if(r=r.options,o){o={};for(var v=0;v<u.length;v++)o["$"+u[v]]=!0;for(u=0;u<r.length;u++)v=o.hasOwnProperty("$"+r[u].value),r[u].selected!==v&&(r[u].selected=v),v&&m&&(r[u].defaultSelected=!0)}else{for(u=""+le(u),o=null,v=0;v<r.length;v++){if(r[v].value===u){r[v].selected=!0,m&&(r[v].defaultSelected=!0);return}o!==null||r[v].disabled||(o=r[v])}o!==null&&(o.selected=!0)}}function at(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 u=o.value;if(u==null){if(u=o.children,o=o.defaultValue,u!=null){if(o!=null)throw Error(n(92));if(ft(u)){if(1<u.length)throw Error(n(93));u=u[0]}o=u}o==null&&(o=""),u=o}r._wrapperState={initialValue:le(u)}}function me(r,o){var u=le(o.value),m=le(o.defaultValue);u!=null&&(u=""+u,u!==r.value&&(r.value=u),o.defaultValue==null&&r.defaultValue!==u&&(r.defaultValue=u)),m!=null&&(r.defaultValue=""+m)}function be(r){var o=r.textContent;o===r._wrapperState.initialValue&&o!==""&&o!==null&&(r.value=o)}function De(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 He(r,o){return r==null||r==="http://www.w3.org/1999/xhtml"?De(o):r==="http://www.w3.org/2000/svg"&&o==="foreignObject"?"http://www.w3.org/1999/xhtml":r}var ot,Le=(function(r){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(o,u,m,v){MSApp.execUnsafeLocalFunction(function(){return r(o,u,m,v)})}:r})(function(r,o){if(r.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in r)r.innerHTML=o;else{for(ot=ot||document.createElement("div"),ot.innerHTML="<svg>"+o.valueOf().toString()+"</svg>",o=ot.firstChild;r.firstChild;)r.removeChild(r.firstChild);for(;o.firstChild;)r.appendChild(o.firstChild)}});function se(r,o){if(o){var u=r.firstChild;if(u&&u===r.lastChild&&u.nodeType===3){u.nodeValue=o;return}}r.textContent=o}var je={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Fe=["Webkit","ms","Moz","O"];Object.keys(je).forEach(function(r){Fe.forEach(function(o){o=o+r.charAt(0).toUpperCase()+r.substring(1),je[o]=je[r]})});function Ee(r,o,u){return o==null||typeof o=="boolean"||o===""?"":u||typeof o!="number"||o===0||je.hasOwnProperty(r)&&je[r]?(""+o).trim():o+"px"}function Ue(r,o){r=r.style;for(var u in o)if(o.hasOwnProperty(u)){var m=u.indexOf("--")===0,v=Ee(u,o[u],m);u==="float"&&(u="cssFloat"),m?r.setProperty(u,v):r[u]=v}}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 vt(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 Oe(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 it=null;function wt(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var xt=null,tn=null,nn=null;function In(r){if(r=Ui(r)){if(typeof xt!="function")throw Error(n(280));var o=r.stateNode;o&&(o=vc(o),xt(r.stateNode,r.type,o))}}function qa(r){tn?nn?nn.push(r):nn=[r]:tn=r}function Da(){if(tn){var r=tn,o=nn;if(nn=tn=null,In(r),o)for(r=0;r<o.length;r++)In(o[r])}}function Fa(r,o){return r(o)}function wn(){}var Bs=!1;function za(r,o,u){if(Bs)return r(o,u);Bs=!0;try{return Fa(r,o,u)}finally{Bs=!1,(tn!==null||nn!==null)&&(wn(),Da())}}function Ot(r,o){var u=r.stateNode;if(u===null)return null;var m=vc(u);if(m===null)return null;u=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(u&&typeof u!="function")throw Error(n(231,o,typeof u));return u}var mr=!1;if(d)try{var Kn={};Object.defineProperty(Kn,"passive",{get:function(){mr=!0}}),window.addEventListener("test",Kn,Kn),window.removeEventListener("test",Kn,Kn)}catch{mr=!1}function li(r,o,u,m,v,x,R,G,ee){var ue=Array.prototype.slice.call(arguments,3);try{o.apply(u,ue)}catch(ve){this.onError(ve)}}var Rr=!1,Ar=null,Mr=!1,is=null,Us={onError:function(r){Rr=!0,Ar=r}};function Ba(r,o,u,m,v,x,R,G,ee){Rr=!1,Ar=null,li.apply(Us,arguments)}function Ws(r,o,u,m,v,x,R,G,ee){if(Ba.apply(this,arguments),Rr){if(Rr){var ue=Ar;Rr=!1,Ar=null}else throw Error(n(198));Mr||(Mr=!0,is=ue)}}function On(r){var o=r,u=r;if(r.alternate)for(;o.return;)o=o.return;else{r=o;do o=r,(o.flags&4098)!==0&&(u=o.return),r=o.return;while(r)}return o.tag===3?u:null}function Ua(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 Hs(r){if(On(r)!==r)throw Error(n(188))}function ci(r){var o=r.alternate;if(!o){if(o=On(r),o===null)throw Error(n(188));return o!==r?null:r}for(var u=r,m=o;;){var v=u.return;if(v===null)break;var x=v.alternate;if(x===null){if(m=v.return,m!==null){u=m;continue}break}if(v.child===x.child){for(x=v.child;x;){if(x===u)return Hs(v),r;if(x===m)return Hs(v),o;x=x.sibling}throw Error(n(188))}if(u.return!==m.return)u=v,m=x;else{for(var R=!1,G=v.child;G;){if(G===u){R=!0,u=v,m=x;break}if(G===m){R=!0,m=v,u=x;break}G=G.sibling}if(!R){for(G=x.child;G;){if(G===u){R=!0,u=x,m=v;break}if(G===m){R=!0,m=x,u=v;break}G=G.sibling}if(!R)throw Error(n(189))}}if(u.alternate!==m)throw Error(n(190))}if(u.tag!==3)throw Error(n(188));return u.stateNode.current===u?r:o}function Ir(r){return r=ci(r),r!==null?Gs(r):null}function Gs(r){if(r.tag===5||r.tag===6)return r;for(r=r.child;r!==null;){var o=Gs(r);if(o!==null)return o;r=r.sibling}return null}var Wa=t.unstable_scheduleCallback,Or=t.unstable_cancelCallback,Vs=t.unstable_shouldYield,ls=t.unstable_requestPaint,dt=t.unstable_now,Ha=t.unstable_getCurrentPriorityLevel,$n=t.unstable_ImmediatePriority,Ga=t.unstable_UserBlockingPriority,$r=t.unstable_NormalPriority,Ys=t.unstable_LowPriority,Va=t.unstable_IdlePriority,Pr=null,Dt=null;function Ks(r){if(Dt&&typeof Dt.onCommitFiberRoot=="function")try{Dt.onCommitFiberRoot(Pr,r,void 0,(r.current.flags&128)===128)}catch{}}var on=Math.clz32?Math.clz32:jd,xn=Math.log,Ya=Math.LN2;function jd(r){return r>>>=0,r===0?32:31-(xn(r)/Ya|0)|0}var cs=64,St=4194304;function Xs(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 Pn(r,o){var u=r.pendingLanes;if(u===0)return 0;var m=0,v=r.suspendedLanes,x=r.pingedLanes,R=u&268435455;if(R!==0){var G=R&~v;G!==0?m=Xs(G):(x&=R,x!==0&&(m=Xs(x)))}else R=u&~v,R!==0?m=Xs(R):x!==0&&(m=Xs(x));if(m===0)return 0;if(o!==0&&o!==m&&(o&v)===0&&(v=m&-m,x=o&-o,v>=x||v===16&&(x&4194240)!==0))return o;if((m&4)!==0&&(m|=u&16),o=r.entangledLanes,o!==0)for(r=r.entanglements,o&=m;0<o;)u=31-on(o),v=1<<u,m|=r[u],o&=~v;return m}function Cd(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 Td(r,o){for(var u=r.suspendedLanes,m=r.pingedLanes,v=r.expirationTimes,x=r.pendingLanes;0<x;){var R=31-on(x),G=1<<R,ee=v[R];ee===-1?((G&u)===0||(G&m)!==0)&&(v[R]=Cd(G,o)):ee<=o&&(r.expiredLanes|=G),x&=~G}}function Ln(r){return r=r.pendingLanes&-1073741825,r!==0?r:r&1073741824?1073741824:0}function Qs(){var r=cs;return cs<<=1,(cs&4194240)===0&&(cs=64),r}function ui(r){for(var o=[],u=0;31>u;u++)o.push(r);return o}function Zs(r,o,u){r.pendingLanes|=o,o!==536870912&&(r.suspendedLanes=0,r.pingedLanes=0),r=r.eventTimes,o=31-on(o),r[o]=u}function Xl(r,o){var u=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<u;){var v=31-on(u),x=1<<v;o[v]=0,m[v]=-1,r[v]=-1,u&=~x}}function Ka(r,o){var u=r.entangledLanes|=o;for(r=r.entanglements;u;){var m=31-on(u),v=1<<m;v&o|r[m]&o&&(r[m]|=o),u&=~v}}var Ze=0;function di(r){return r&=-r,1<r?4<r?(r&268435455)!==0?16:536870912:4:1}var hi,us,Xa,fi,pi,Qa=!1,Js=[],Nt=null,bn=null,kn=null,Lr=new Map,ea=new Map,ln=[],Ql="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function Xn(r,o){switch(r){case"focusin":case"focusout":Nt=null;break;case"dragenter":case"dragleave":bn=null;break;case"mouseover":case"mouseout":kn=null;break;case"pointerover":case"pointerout":Lr.delete(o.pointerId);break;case"gotpointercapture":case"lostpointercapture":ea.delete(o.pointerId)}}function ta(r,o,u,m,v,x){return r===null||r.nativeEvent!==x?(r={blockedOn:o,domEventName:u,eventSystemFlags:m,nativeEvent:x,targetContainers:[v]},o!==null&&(o=Ui(o),o!==null&&us(o)),r):(r.eventSystemFlags|=m,o=r.targetContainers,v!==null&&o.indexOf(v)===-1&&o.push(v),r)}function Zl(r,o,u,m,v){switch(o){case"focusin":return Nt=ta(Nt,r,o,u,m,v),!0;case"dragenter":return bn=ta(bn,r,o,u,m,v),!0;case"mouseover":return kn=ta(kn,r,o,u,m,v),!0;case"pointerover":var x=v.pointerId;return Lr.set(x,ta(Lr.get(x)||null,r,o,u,m,v)),!0;case"gotpointercapture":return x=v.pointerId,ea.set(x,ta(ea.get(x)||null,r,o,u,m,v)),!0}return!1}function Jl(r){var o=ha(r.target);if(o!==null){var u=On(o);if(u!==null){if(o=u.tag,o===13){if(o=Ua(u),o!==null){r.blockedOn=o,pi(r.priority,function(){Xa(u)});return}}else if(o===3&&u.stateNode.current.memoizedState.isDehydrated){r.blockedOn=u.tag===3?u.stateNode.containerInfo:null;return}}}r.blockedOn=null}function Za(r){if(r.blockedOn!==null)return!1;for(var o=r.targetContainers;0<o.length;){var u=na(r.domEventName,r.eventSystemFlags,o[0],r.nativeEvent);if(u===null){u=r.nativeEvent;var m=new u.constructor(u.type,u);it=m,u.target.dispatchEvent(m),it=null}else return o=Ui(u),o!==null&&us(o),r.blockedOn=u,!1;o.shift()}return!0}function mi(r,o,u){Za(r)&&u.delete(o)}function Rd(){Qa=!1,Nt!==null&&Za(Nt)&&(Nt=null),bn!==null&&Za(bn)&&(bn=null),kn!==null&&Za(kn)&&(kn=null),Lr.forEach(mi),ea.forEach(mi)}function _n(r,o){r.blockedOn===o&&(r.blockedOn=null,Qa||(Qa=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Rd)))}function Qn(r){function o(v){return _n(v,r)}if(0<Js.length){_n(Js[0],r);for(var u=1;u<Js.length;u++){var m=Js[u];m.blockedOn===r&&(m.blockedOn=null)}}for(Nt!==null&&_n(Nt,r),bn!==null&&_n(bn,r),kn!==null&&_n(kn,r),Lr.forEach(o),ea.forEach(o),u=0;u<ln.length;u++)m=ln[u],m.blockedOn===r&&(m.blockedOn=null);for(;0<ln.length&&(u=ln[0],u.blockedOn===null);)Jl(u),u.blockedOn===null&&ln.shift()}var qr=C.ReactCurrentBatchConfig,ds=!0;function Zn(r,o,u,m){var v=Ze,x=qr.transition;qr.transition=null;try{Ze=1,cn(r,o,u,m)}finally{Ze=v,qr.transition=x}}function Ad(r,o,u,m){var v=Ze,x=qr.transition;qr.transition=null;try{Ze=4,cn(r,o,u,m)}finally{Ze=v,qr.transition=x}}function cn(r,o,u,m){if(ds){var v=na(r,o,u,m);if(v===null)Ud(r,o,m,hs,u),Xn(r,m);else if(Zl(v,r,o,u,m))m.stopPropagation();else if(Xn(r,m),o&4&&-1<Ql.indexOf(r)){for(;v!==null;){var x=Ui(v);if(x!==null&&hi(x),x=na(r,o,u,m),x===null&&Ud(r,o,m,hs,u),x===v)break;v=x}v!==null&&m.stopPropagation()}else Ud(r,o,m,null,u)}}var hs=null;function na(r,o,u,m){if(hs=null,r=wt(m),r=ha(r),r!==null)if(o=On(r),o===null)r=null;else if(u=o.tag,u===13){if(r=Ua(o),r!==null)return r;r=null}else if(u===3){if(o.stateNode.current.memoizedState.isDehydrated)return o.tag===3?o.stateNode.containerInfo:null;r=null}else o!==r&&(r=null);return hs=r,null}function gi(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(Ha()){case $n:return 1;case Ga:return 4;case $r:case Ys:return 16;case Va:return 536870912;default:return 16}default:return 16}}var Sn=null,ra=null,sa=null;function Ja(){if(sa)return sa;var r,o=ra,u=o.length,m,v="value"in Sn?Sn.value:Sn.textContent,x=v.length;for(r=0;r<u&&o[r]===v[r];r++);var R=u-r;for(m=1;m<=R&&o[u-m]===v[x-m];m++);return sa=v.slice(r,1<m?1-m:void 0)}function aa(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 fs(){return!0}function yi(){return!1}function Tt(r){function o(u,m,v,x,R){this._reactName=u,this._targetInst=v,this.type=m,this.nativeEvent=x,this.target=R,this.currentTarget=null;for(var G in r)r.hasOwnProperty(G)&&(u=r[G],this[G]=u?u(x):x[G]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?fs:yi,this.isPropagationStopped=yi,this}return J(o.prototype,{preventDefault:function(){this.defaultPrevented=!0;var u=this.nativeEvent;u&&(u.preventDefault?u.preventDefault():typeof u.returnValue!="unknown"&&(u.returnValue=!1),this.isDefaultPrevented=fs)},stopPropagation:function(){var u=this.nativeEvent;u&&(u.stopPropagation?u.stopPropagation():typeof u.cancelBubble!="unknown"&&(u.cancelBubble=!0),this.isPropagationStopped=fs)},persist:function(){},isPersistent:fs}),o}var Dr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},eo=Tt(Dr),Fr=J({},Dr,{view:0,detail:0}),Md=Tt(Fr),oa,gr,ps,to=J({},Fr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ro,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!==ps&&(ps&&r.type==="mousemove"?(oa=r.screenX-ps.screenX,gr=r.screenY-ps.screenY):gr=oa=0,ps=r),oa)},movementY:function(r){return"movementY"in r?r.movementY:gr}}),vi=Tt(to),ec=J({},to,{dataTransfer:0}),Id=Tt(ec),un=J({},Fr,{relatedTarget:0}),wi=Tt(un),xi=J({},Dr,{animationName:0,elapsedTime:0,pseudoElement:0}),ms=Tt(xi),ia=J({},Dr,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),bi=Tt(ia),ki=J({},Dr,{data:0}),_i=Tt(ki),no={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},tc={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"},Od={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function $d(r){var o=this.nativeEvent;return o.getModifierState?o.getModifierState(r):(r=Od[r])?!!o[r]:!1}function ro(){return $d}var Pd=J({},Fr,{key:function(r){if(r.key){var o=no[r.key]||r.key;if(o!=="Unidentified")return o}return r.type==="keypress"?(r=aa(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?tc[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ro,charCode:function(r){return r.type==="keypress"?aa(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?aa(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),Ld=Tt(Pd),Si=J({},to,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Jn=Tt(Si),Ni=J({},Fr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ro}),nc=Tt(Ni),qd=J({},Dr,{propertyName:0,elapsedTime:0,pseudoElement:0}),Dd=Tt(qd),rc=J({},to,{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}),sc=Tt(rc),yr=[9,13,27,32],Ei=d&&"CompositionEvent"in window,gs=null;d&&"documentMode"in document&&(gs=document.documentMode);var Fd=d&&"TextEvent"in window&&!gs,la=d&&(!Ei||gs&&8<gs&&11>=gs),ac=" ",Yt=!1;function so(r,o){switch(r){case"keyup":return yr.indexOf(o.keyCode)!==-1;case"keydown":return o.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ji(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var zr=!1;function oc(r,o){switch(r){case"compositionend":return ji(o);case"keypress":return o.which!==32?null:(Yt=!0,ac);case"textInput":return r=o.data,r===ac&&Yt?null:r;default:return null}}function Ci(r,o){if(zr)return r==="compositionend"||!Ei&&so(r,o)?(r=Ja(),sa=ra=Sn=null,zr=!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 la&&o.locale!=="ko"?null:o.data;default:return null}}var ao={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 oo(r){var o=r&&r.nodeName&&r.nodeName.toLowerCase();return o==="input"?!!ao[r.type]:o==="textarea"}function Ti(r,o,u,m){qa(m),o=mc(o,"onChange"),0<o.length&&(u=new eo("onChange","change",null,u,m),r.push({event:u,listeners:o}))}var vr=null,ys=null;function Ri(r){Di(r,0)}function vs(r){var o=mo(r);if(ce(o))return r}function ic(r,o){if(r==="change")return o}var $t=!1;if(d){var io;if(d){var lo="oninput"in document;if(!lo){var lc=document.createElement("div");lc.setAttribute("oninput","return;"),lo=typeof lc.oninput=="function"}io=lo}else io=!1;$t=io&&(!document.documentMode||9<document.documentMode)}function cc(){vr&&(vr.detachEvent("onpropertychange",Ai),ys=vr=null)}function Ai(r){if(r.propertyName==="value"&&vs(ys)){var o=[];Ti(o,ys,r,wt(r)),za(Ri,o)}}function ca(r,o,u){r==="focusin"?(cc(),vr=o,ys=u,vr.attachEvent("onpropertychange",Ai)):r==="focusout"&&cc()}function zd(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return vs(ys)}function Br(r,o){if(r==="click")return vs(o)}function Mi(r,o){if(r==="input"||r==="change")return vs(o)}function Bd(r,o){return r===o&&(r!==0||1/r===1/o)||r!==r&&o!==o}var Nn=typeof Object.is=="function"?Object.is:Bd;function En(r,o){if(Nn(r,o))return!0;if(typeof r!="object"||r===null||typeof o!="object"||o===null)return!1;var u=Object.keys(r),m=Object.keys(o);if(u.length!==m.length)return!1;for(m=0;m<u.length;m++){var v=u[m];if(!f.call(o,v)||!Nn(r[v],o[v]))return!1}return!0}function co(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function uc(r,o){var u=co(r);r=0;for(var m;u;){if(u.nodeType===3){if(m=r+u.textContent.length,r<=o&&m>=o)return{node:u,offset:o-r};r=m}e:{for(;u;){if(u.nextSibling){u=u.nextSibling;break e}u=u.parentNode}u=void 0}u=co(u)}}function Ii(r,o){return r&&o?r===o?!0:r&&r.nodeType===3?!1:o&&o.nodeType===3?Ii(r,o.parentNode):"contains"in r?r.contains(o):r.compareDocumentPosition?!!(r.compareDocumentPosition(o)&16):!1:!1}function Oi(){for(var r=window,o=we();o instanceof r.HTMLIFrameElement;){try{var u=typeof o.contentWindow.location.href=="string"}catch{u=!1}if(u)r=o.contentWindow;else break;o=we(r.document)}return o}function $i(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 dc(r){var o=Oi(),u=r.focusedElem,m=r.selectionRange;if(o!==u&&u&&u.ownerDocument&&Ii(u.ownerDocument.documentElement,u)){if(m!==null&&$i(u)){if(o=m.start,r=m.end,r===void 0&&(r=o),"selectionStart"in u)u.selectionStart=o,u.selectionEnd=Math.min(r,u.value.length);else if(r=(o=u.ownerDocument||document)&&o.defaultView||window,r.getSelection){r=r.getSelection();var v=u.textContent.length,x=Math.min(m.start,v);m=m.end===void 0?x:Math.min(m.end,v),!r.extend&&x>m&&(v=m,m=x,x=v),v=uc(u,x);var R=uc(u,m);v&&R&&(r.rangeCount!==1||r.anchorNode!==v.node||r.anchorOffset!==v.offset||r.focusNode!==R.node||r.focusOffset!==R.offset)&&(o=o.createRange(),o.setStart(v.node,v.offset),r.removeAllRanges(),x>m?(r.addRange(o),r.extend(R.node,R.offset)):(o.setEnd(R.node,R.offset),r.addRange(o)))}}for(o=[],r=u;r=r.parentNode;)r.nodeType===1&&o.push({element:r,left:r.scrollLeft,top:r.scrollTop});for(typeof u.focus=="function"&&u.focus(),u=0;u<o.length;u++)r=o[u],r.element.scrollLeft=r.left,r.element.scrollTop=r.top}}var Pi=d&&"documentMode"in document&&11>=document.documentMode,wr=null,ws=null,Ur=null,Li=!1;function qi(r,o,u){var m=u.window===u?u.document:u.nodeType===9?u:u.ownerDocument;Li||wr==null||wr!==we(m)||(m=wr,"selectionStart"in m&&$i(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}),Ur&&En(Ur,m)||(Ur=m,m=mc(ws,"onSelect"),0<m.length&&(o=new eo("onSelect","select",null,o,u),r.push({event:o,listeners:m}),o.target=wr)))}function ua(r,o){var u={};return u[r.toLowerCase()]=o.toLowerCase(),u["Webkit"+r]="webkit"+o,u["Moz"+r]="moz"+o,u}var Wr={animationend:ua("Animation","AnimationEnd"),animationiteration:ua("Animation","AnimationIteration"),animationstart:ua("Animation","AnimationStart"),transitionend:ua("Transition","TransitionEnd")},uo={},q={};d&&(q=document.createElement("div").style,"AnimationEvent"in window||(delete Wr.animationend.animation,delete Wr.animationiteration.animation,delete Wr.animationstart.animation),"TransitionEvent"in window||delete Wr.transitionend.transition);function B(r){if(uo[r])return uo[r];if(!Wr[r])return r;var o=Wr[r],u;for(u in o)if(o.hasOwnProperty(u)&&u in q)return uo[r]=o[u];return r}var ie=B("animationend"),he=B("animationiteration"),Re=B("animationstart"),Ie=B("transitionend"),Ve=new Map,et="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 rt(r,o){Ve.set(r,o),i(o,[r])}for(var st=0;st<et.length;st++){var Kt=et[st],ho=Kt.toLowerCase(),hc=Kt[0].toUpperCase()+Kt.slice(1);rt(ho,"on"+hc)}rt(ie,"onAnimationEnd"),rt(he,"onAnimationIteration"),rt(Re,"onAnimationStart"),rt("dblclick","onDoubleClick"),rt("focusin","onFocus"),rt("focusout","onBlur"),rt(Ie,"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 da="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(" "),fc=new Set("cancel close invalid load scroll toggle".split(" ").concat(da));function pc(r,o,u){var m=r.type||"unknown-event";r.currentTarget=u,Ws(m,o,void 0,r),r.currentTarget=null}function Di(r,o){o=(o&4)!==0;for(var u=0;u<r.length;u++){var m=r[u],v=m.event;m=m.listeners;e:{var x=void 0;if(o)for(var R=m.length-1;0<=R;R--){var G=m[R],ee=G.instance,ue=G.currentTarget;if(G=G.listener,ee!==x&&v.isPropagationStopped())break e;pc(v,G,ue),x=ee}else for(R=0;R<m.length;R++){if(G=m[R],ee=G.instance,ue=G.currentTarget,G=G.listener,ee!==x&&v.isPropagationStopped())break e;pc(v,G,ue),x=ee}}}if(Mr)throw r=is,Mr=!1,is=null,r}function lt(r,o){var u=o[Kd];u===void 0&&(u=o[Kd]=new Set);var m=r+"__bubble";u.has(m)||(Fi(o,r,2,!1),u.add(m))}function Hr(r,o,u){var m=0;o&&(m|=4),Fi(u,r,m,o)}var xr="_reactListening"+Math.random().toString(36).slice(2);function mt(r){if(!r[xr]){r[xr]=!0,s.forEach(function(u){u!=="selectionchange"&&(fc.has(u)||Hr(u,!1,r),Hr(u,!0,r))});var o=r.nodeType===9?r:r.ownerDocument;o===null||o[xr]||(o[xr]=!0,Hr("selectionchange",!1,o))}}function Fi(r,o,u,m){switch(gi(o)){case 1:var v=Zn;break;case 4:v=Ad;break;default:v=cn}u=v.bind(null,o,u,r),v=void 0,!mr||o!=="touchstart"&&o!=="touchmove"&&o!=="wheel"||(v=!0),m?v!==void 0?r.addEventListener(o,u,{capture:!0,passive:v}):r.addEventListener(o,u,!0):v!==void 0?r.addEventListener(o,u,{passive:v}):r.addEventListener(o,u,!1)}function Ud(r,o,u,m,v){var x=m;if((o&1)===0&&(o&2)===0&&m!==null)e:for(;;){if(m===null)return;var R=m.tag;if(R===3||R===4){var G=m.stateNode.containerInfo;if(G===v||G.nodeType===8&&G.parentNode===v)break;if(R===4)for(R=m.return;R!==null;){var ee=R.tag;if((ee===3||ee===4)&&(ee=R.stateNode.containerInfo,ee===v||ee.nodeType===8&&ee.parentNode===v))return;R=R.return}for(;G!==null;){if(R=ha(G),R===null)return;if(ee=R.tag,ee===5||ee===6){m=x=R;continue e}G=G.parentNode}}m=m.return}za(function(){var ue=x,ve=wt(u),xe=[];e:{var ye=Ve.get(r);if(ye!==void 0){var Te=eo,Me=r;switch(r){case"keypress":if(aa(u)===0)break e;case"keydown":case"keyup":Te=Ld;break;case"focusin":Me="focus",Te=wi;break;case"focusout":Me="blur",Te=wi;break;case"beforeblur":case"afterblur":Te=wi;break;case"click":if(u.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Te=vi;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Te=Id;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Te=nc;break;case ie:case he:case Re:Te=ms;break;case Ie:Te=Dd;break;case"scroll":Te=Md;break;case"wheel":Te=sc;break;case"copy":case"cut":case"paste":Te=bi;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Te=Jn}var $e=(o&4)!==0,Ct=!$e&&r==="scroll",ae=$e?ye!==null?ye+"Capture":null:ye;$e=[];for(var ne=ue,oe;ne!==null;){oe=ne;var ke=oe.stateNode;if(oe.tag===5&&ke!==null&&(oe=ke,ae!==null&&(ke=Ot(ne,ae),ke!=null&&$e.push(zi(ne,ke,oe)))),Ct)break;ne=ne.return}0<$e.length&&(ye=new Te(ye,Me,null,u,ve),xe.push({event:ye,listeners:$e}))}}if((o&7)===0){e:{if(ye=r==="mouseover"||r==="pointerover",Te=r==="mouseout"||r==="pointerout",ye&&u!==it&&(Me=u.relatedTarget||u.fromElement)&&(ha(Me)||Me[Gr]))break e;if((Te||ye)&&(ye=ve.window===ve?ve:(ye=ve.ownerDocument)?ye.defaultView||ye.parentWindow:window,Te?(Me=u.relatedTarget||u.toElement,Te=ue,Me=Me?ha(Me):null,Me!==null&&(Ct=On(Me),Me!==Ct||Me.tag!==5&&Me.tag!==6)&&(Me=null)):(Te=null,Me=ue),Te!==Me)){if($e=vi,ke="onMouseLeave",ae="onMouseEnter",ne="mouse",(r==="pointerout"||r==="pointerover")&&($e=Jn,ke="onPointerLeave",ae="onPointerEnter",ne="pointer"),Ct=Te==null?ye:mo(Te),oe=Me==null?ye:mo(Me),ye=new $e(ke,ne+"leave",Te,u,ve),ye.target=Ct,ye.relatedTarget=oe,ke=null,ha(ve)===ue&&($e=new $e(ae,ne+"enter",Me,u,ve),$e.target=oe,$e.relatedTarget=Ct,ke=$e),Ct=ke,Te&&Me)t:{for($e=Te,ae=Me,ne=0,oe=$e;oe;oe=fo(oe))ne++;for(oe=0,ke=ae;ke;ke=fo(ke))oe++;for(;0<ne-oe;)$e=fo($e),ne--;for(;0<oe-ne;)ae=fo(ae),oe--;for(;ne--;){if($e===ae||ae!==null&&$e===ae.alternate)break t;$e=fo($e),ae=fo(ae)}$e=null}else $e=null;Te!==null&&_0(xe,ye,Te,$e,!1),Me!==null&&Ct!==null&&_0(xe,Ct,Me,$e,!0)}}e:{if(ye=ue?mo(ue):window,Te=ye.nodeName&&ye.nodeName.toLowerCase(),Te==="select"||Te==="input"&&ye.type==="file")var Pe=ic;else if(oo(ye))if($t)Pe=Mi;else{Pe=zd;var ze=ca}else(Te=ye.nodeName)&&Te.toLowerCase()==="input"&&(ye.type==="checkbox"||ye.type==="radio")&&(Pe=Br);if(Pe&&(Pe=Pe(r,ue))){Ti(xe,Pe,u,ve);break e}ze&&ze(r,ye,ue),r==="focusout"&&(ze=ye._wrapperState)&&ze.controlled&&ye.type==="number"&&Qe(ye,"number",ye.value)}switch(ze=ue?mo(ue):window,r){case"focusin":(oo(ze)||ze.contentEditable==="true")&&(wr=ze,ws=ue,Ur=null);break;case"focusout":Ur=ws=wr=null;break;case"mousedown":Li=!0;break;case"contextmenu":case"mouseup":case"dragend":Li=!1,qi(xe,u,ve);break;case"selectionchange":if(Pi)break;case"keydown":case"keyup":qi(xe,u,ve)}var Be;if(Ei)e:{switch(r){case"compositionstart":var Ge="onCompositionStart";break e;case"compositionend":Ge="onCompositionEnd";break e;case"compositionupdate":Ge="onCompositionUpdate";break e}Ge=void 0}else zr?so(r,u)&&(Ge="onCompositionEnd"):r==="keydown"&&u.keyCode===229&&(Ge="onCompositionStart");Ge&&(la&&u.locale!=="ko"&&(zr||Ge!=="onCompositionStart"?Ge==="onCompositionEnd"&&zr&&(Be=Ja()):(Sn=ve,ra="value"in Sn?Sn.value:Sn.textContent,zr=!0)),ze=mc(ue,Ge),0<ze.length&&(Ge=new _i(Ge,r,null,u,ve),xe.push({event:Ge,listeners:ze}),Be?Ge.data=Be:(Be=ji(u),Be!==null&&(Ge.data=Be)))),(Be=Fd?oc(r,u):Ci(r,u))&&(ue=mc(ue,"onBeforeInput"),0<ue.length&&(ve=new _i("onBeforeInput","beforeinput",null,u,ve),xe.push({event:ve,listeners:ue}),ve.data=Be))}Di(xe,o)})}function zi(r,o,u){return{instance:r,listener:o,currentTarget:u}}function mc(r,o){for(var u=o+"Capture",m=[];r!==null;){var v=r,x=v.stateNode;v.tag===5&&x!==null&&(v=x,x=Ot(r,u),x!=null&&m.unshift(zi(r,x,v)),x=Ot(r,o),x!=null&&m.push(zi(r,x,v))),r=r.return}return m}function fo(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5);return r||null}function _0(r,o,u,m,v){for(var x=o._reactName,R=[];u!==null&&u!==m;){var G=u,ee=G.alternate,ue=G.stateNode;if(ee!==null&&ee===m)break;G.tag===5&&ue!==null&&(G=ue,v?(ee=Ot(u,x),ee!=null&&R.unshift(zi(u,ee,G))):v||(ee=Ot(u,x),ee!=null&&R.push(zi(u,ee,G)))),u=u.return}R.length!==0&&r.push({event:o,listeners:R})}var NA=/\r\n?/g,EA=/\u0000|\uFFFD/g;function S0(r){return(typeof r=="string"?r:""+r).replace(NA,`
|
|
38
|
+
`).replace(EA,"")}function gc(r,o,u){if(o=S0(o),S0(r)!==o&&u)throw Error(n(425))}function yc(){}var Wd=null,Hd=null;function Gd(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 Vd=typeof setTimeout=="function"?setTimeout:void 0,jA=typeof clearTimeout=="function"?clearTimeout:void 0,N0=typeof Promise=="function"?Promise:void 0,CA=typeof queueMicrotask=="function"?queueMicrotask:typeof N0<"u"?function(r){return N0.resolve(null).then(r).catch(TA)}:Vd;function TA(r){setTimeout(function(){throw r})}function Yd(r,o){var u=o,m=0;do{var v=u.nextSibling;if(r.removeChild(u),v&&v.nodeType===8)if(u=v.data,u==="/$"){if(m===0){r.removeChild(v),Qn(o);return}m--}else u!=="$"&&u!=="$?"&&u!=="$!"||m++;u=v}while(u);Qn(o)}function xs(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 E0(r){r=r.previousSibling;for(var o=0;r;){if(r.nodeType===8){var u=r.data;if(u==="$"||u==="$!"||u==="$?"){if(o===0)return r;o--}else u==="/$"&&o++}r=r.previousSibling}return null}var po=Math.random().toString(36).slice(2),br="__reactFiber$"+po,Bi="__reactProps$"+po,Gr="__reactContainer$"+po,Kd="__reactEvents$"+po,RA="__reactListeners$"+po,AA="__reactHandles$"+po;function ha(r){var o=r[br];if(o)return o;for(var u=r.parentNode;u;){if(o=u[Gr]||u[br]){if(u=o.alternate,o.child!==null||u!==null&&u.child!==null)for(r=E0(r);r!==null;){if(u=r[br])return u;r=E0(r)}return o}r=u,u=r.parentNode}return null}function Ui(r){return r=r[br]||r[Gr],!r||r.tag!==5&&r.tag!==6&&r.tag!==13&&r.tag!==3?null:r}function mo(r){if(r.tag===5||r.tag===6)return r.stateNode;throw Error(n(33))}function vc(r){return r[Bi]||null}var Xd=[],go=-1;function bs(r){return{current:r}}function pt(r){0>go||(r.current=Xd[go],Xd[go]=null,go--)}function ht(r,o){go++,Xd[go]=r.current,r.current=o}var ks={},Xt=bs(ks),dn=bs(!1),fa=ks;function yo(r,o){var u=r.type.contextTypes;if(!u)return ks;var m=r.stateNode;if(m&&m.__reactInternalMemoizedUnmaskedChildContext===o)return m.__reactInternalMemoizedMaskedChildContext;var v={},x;for(x in u)v[x]=o[x];return m&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=o,r.__reactInternalMemoizedMaskedChildContext=v),v}function hn(r){return r=r.childContextTypes,r!=null}function wc(){pt(dn),pt(Xt)}function j0(r,o,u){if(Xt.current!==ks)throw Error(n(168));ht(Xt,o),ht(dn,u)}function C0(r,o,u){var m=r.stateNode;if(o=o.childContextTypes,typeof m.getChildContext!="function")return u;m=m.getChildContext();for(var v in m)if(!(v in o))throw Error(n(108,W(r)||"Unknown",v));return J({},u,m)}function xc(r){return r=(r=r.stateNode)&&r.__reactInternalMemoizedMergedChildContext||ks,fa=Xt.current,ht(Xt,r),ht(dn,dn.current),!0}function T0(r,o,u){var m=r.stateNode;if(!m)throw Error(n(169));u?(r=C0(r,o,fa),m.__reactInternalMemoizedMergedChildContext=r,pt(dn),pt(Xt),ht(Xt,r)):pt(dn),ht(dn,u)}var Vr=null,bc=!1,Qd=!1;function R0(r){Vr===null?Vr=[r]:Vr.push(r)}function MA(r){bc=!0,R0(r)}function _s(){if(!Qd&&Vr!==null){Qd=!0;var r=0,o=Ze;try{var u=Vr;for(Ze=1;r<u.length;r++){var m=u[r];do m=m(!0);while(m!==null)}Vr=null,bc=!1}catch(v){throw Vr!==null&&(Vr=Vr.slice(r+1)),Wa($n,_s),v}finally{Ze=o,Qd=!1}}return null}var vo=[],wo=0,kc=null,_c=0,qn=[],Dn=0,pa=null,Yr=1,Kr="";function ma(r,o){vo[wo++]=_c,vo[wo++]=kc,kc=r,_c=o}function A0(r,o,u){qn[Dn++]=Yr,qn[Dn++]=Kr,qn[Dn++]=pa,pa=r;var m=Yr;r=Kr;var v=32-on(m)-1;m&=~(1<<v),u+=1;var x=32-on(o)+v;if(30<x){var R=v-v%5;x=(m&(1<<R)-1).toString(32),m>>=R,v-=R,Yr=1<<32-on(o)+v|u<<v|m,Kr=x+r}else Yr=1<<x|u<<v|m,Kr=r}function Zd(r){r.return!==null&&(ma(r,1),A0(r,1,0))}function Jd(r){for(;r===kc;)kc=vo[--wo],vo[wo]=null,_c=vo[--wo],vo[wo]=null;for(;r===pa;)pa=qn[--Dn],qn[Dn]=null,Kr=qn[--Dn],qn[Dn]=null,Yr=qn[--Dn],qn[Dn]=null}var jn=null,Cn=null,gt=!1,er=null;function M0(r,o){var u=Un(5,null,null,0);u.elementType="DELETED",u.stateNode=o,u.return=r,o=r.deletions,o===null?(r.deletions=[u],r.flags|=16):o.push(u)}function I0(r,o){switch(r.tag){case 5:var u=r.type;return o=o.nodeType!==1||u.toLowerCase()!==o.nodeName.toLowerCase()?null:o,o!==null?(r.stateNode=o,jn=r,Cn=xs(o.firstChild),!0):!1;case 6:return o=r.pendingProps===""||o.nodeType!==3?null:o,o!==null?(r.stateNode=o,jn=r,Cn=null,!0):!1;case 13:return o=o.nodeType!==8?null:o,o!==null?(u=pa!==null?{id:Yr,overflow:Kr}:null,r.memoizedState={dehydrated:o,treeContext:u,retryLane:1073741824},u=Un(18,null,null,0),u.stateNode=o,u.return=r,r.child=u,jn=r,Cn=null,!0):!1;default:return!1}}function eh(r){return(r.mode&1)!==0&&(r.flags&128)===0}function th(r){if(gt){var o=Cn;if(o){var u=o;if(!I0(r,o)){if(eh(r))throw Error(n(418));o=xs(u.nextSibling);var m=jn;o&&I0(r,o)?M0(m,u):(r.flags=r.flags&-4097|2,gt=!1,jn=r)}}else{if(eh(r))throw Error(n(418));r.flags=r.flags&-4097|2,gt=!1,jn=r}}}function O0(r){for(r=r.return;r!==null&&r.tag!==5&&r.tag!==3&&r.tag!==13;)r=r.return;jn=r}function Sc(r){if(r!==jn)return!1;if(!gt)return O0(r),gt=!0,!1;var o;if((o=r.tag!==3)&&!(o=r.tag!==5)&&(o=r.type,o=o!=="head"&&o!=="body"&&!Gd(r.type,r.memoizedProps)),o&&(o=Cn)){if(eh(r))throw $0(),Error(n(418));for(;o;)M0(r,o),o=xs(o.nextSibling)}if(O0(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 u=r.data;if(u==="/$"){if(o===0){Cn=xs(r.nextSibling);break e}o--}else u!=="$"&&u!=="$!"&&u!=="$?"||o++}r=r.nextSibling}Cn=null}}else Cn=jn?xs(r.stateNode.nextSibling):null;return!0}function $0(){for(var r=Cn;r;)r=xs(r.nextSibling)}function xo(){Cn=jn=null,gt=!1}function nh(r){er===null?er=[r]:er.push(r)}var IA=C.ReactCurrentBatchConfig;function Wi(r,o,u){if(r=u.ref,r!==null&&typeof r!="function"&&typeof r!="object"){if(u._owner){if(u=u._owner,u){if(u.tag!==1)throw Error(n(309));var m=u.stateNode}if(!m)throw Error(n(147,r));var v=m,x=""+r;return o!==null&&o.ref!==null&&typeof o.ref=="function"&&o.ref._stringRef===x?o.ref:(o=function(R){var G=v.refs;R===null?delete G[x]:G[x]=R},o._stringRef=x,o)}if(typeof r!="string")throw Error(n(284));if(!u._owner)throw Error(n(290,r))}return r}function Nc(r,o){throw r=Object.prototype.toString.call(o),Error(n(31,r==="[object Object]"?"object with keys {"+Object.keys(o).join(", ")+"}":r))}function P0(r){var o=r._init;return o(r._payload)}function L0(r){function o(ae,ne){if(r){var oe=ae.deletions;oe===null?(ae.deletions=[ne],ae.flags|=16):oe.push(ne)}}function u(ae,ne){if(!r)return null;for(;ne!==null;)o(ae,ne),ne=ne.sibling;return null}function m(ae,ne){for(ae=new Map;ne!==null;)ne.key!==null?ae.set(ne.key,ne):ae.set(ne.index,ne),ne=ne.sibling;return ae}function v(ae,ne){return ae=As(ae,ne),ae.index=0,ae.sibling=null,ae}function x(ae,ne,oe){return ae.index=oe,r?(oe=ae.alternate,oe!==null?(oe=oe.index,oe<ne?(ae.flags|=2,ne):oe):(ae.flags|=2,ne)):(ae.flags|=1048576,ne)}function R(ae){return r&&ae.alternate===null&&(ae.flags|=2),ae}function G(ae,ne,oe,ke){return ne===null||ne.tag!==6?(ne=Vh(oe,ae.mode,ke),ne.return=ae,ne):(ne=v(ne,oe),ne.return=ae,ne)}function ee(ae,ne,oe,ke){var Pe=oe.type;return Pe===I?ve(ae,ne,oe.props.children,ke,oe.key):ne!==null&&(ne.elementType===Pe||typeof Pe=="object"&&Pe!==null&&Pe.$$typeof===D&&P0(Pe)===ne.type)?(ke=v(ne,oe.props),ke.ref=Wi(ae,ne,oe),ke.return=ae,ke):(ke=Kc(oe.type,oe.key,oe.props,null,ae.mode,ke),ke.ref=Wi(ae,ne,oe),ke.return=ae,ke)}function ue(ae,ne,oe,ke){return ne===null||ne.tag!==4||ne.stateNode.containerInfo!==oe.containerInfo||ne.stateNode.implementation!==oe.implementation?(ne=Yh(oe,ae.mode,ke),ne.return=ae,ne):(ne=v(ne,oe.children||[]),ne.return=ae,ne)}function ve(ae,ne,oe,ke,Pe){return ne===null||ne.tag!==7?(ne=_a(oe,ae.mode,ke,Pe),ne.return=ae,ne):(ne=v(ne,oe),ne.return=ae,ne)}function xe(ae,ne,oe){if(typeof ne=="string"&&ne!==""||typeof ne=="number")return ne=Vh(""+ne,ae.mode,oe),ne.return=ae,ne;if(typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case M:return oe=Kc(ne.type,ne.key,ne.props,null,ae.mode,oe),oe.ref=Wi(ae,null,ne),oe.return=ae,oe;case $:return ne=Yh(ne,ae.mode,oe),ne.return=ae,ne;case D:var ke=ne._init;return xe(ae,ke(ne._payload),oe)}if(ft(ne)||V(ne))return ne=_a(ne,ae.mode,oe,null),ne.return=ae,ne;Nc(ae,ne)}return null}function ye(ae,ne,oe,ke){var Pe=ne!==null?ne.key:null;if(typeof oe=="string"&&oe!==""||typeof oe=="number")return Pe!==null?null:G(ae,ne,""+oe,ke);if(typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case M:return oe.key===Pe?ee(ae,ne,oe,ke):null;case $:return oe.key===Pe?ue(ae,ne,oe,ke):null;case D:return Pe=oe._init,ye(ae,ne,Pe(oe._payload),ke)}if(ft(oe)||V(oe))return Pe!==null?null:ve(ae,ne,oe,ke,null);Nc(ae,oe)}return null}function Te(ae,ne,oe,ke,Pe){if(typeof ke=="string"&&ke!==""||typeof ke=="number")return ae=ae.get(oe)||null,G(ne,ae,""+ke,Pe);if(typeof ke=="object"&&ke!==null){switch(ke.$$typeof){case M:return ae=ae.get(ke.key===null?oe:ke.key)||null,ee(ne,ae,ke,Pe);case $:return ae=ae.get(ke.key===null?oe:ke.key)||null,ue(ne,ae,ke,Pe);case D:var ze=ke._init;return Te(ae,ne,oe,ze(ke._payload),Pe)}if(ft(ke)||V(ke))return ae=ae.get(oe)||null,ve(ne,ae,ke,Pe,null);Nc(ne,ke)}return null}function Me(ae,ne,oe,ke){for(var Pe=null,ze=null,Be=ne,Ge=ne=0,Bt=null;Be!==null&&Ge<oe.length;Ge++){Be.index>Ge?(Bt=Be,Be=null):Bt=Be.sibling;var nt=ye(ae,Be,oe[Ge],ke);if(nt===null){Be===null&&(Be=Bt);break}r&&Be&&nt.alternate===null&&o(ae,Be),ne=x(nt,ne,Ge),ze===null?Pe=nt:ze.sibling=nt,ze=nt,Be=Bt}if(Ge===oe.length)return u(ae,Be),gt&&ma(ae,Ge),Pe;if(Be===null){for(;Ge<oe.length;Ge++)Be=xe(ae,oe[Ge],ke),Be!==null&&(ne=x(Be,ne,Ge),ze===null?Pe=Be:ze.sibling=Be,ze=Be);return gt&&ma(ae,Ge),Pe}for(Be=m(ae,Be);Ge<oe.length;Ge++)Bt=Te(Be,ae,Ge,oe[Ge],ke),Bt!==null&&(r&&Bt.alternate!==null&&Be.delete(Bt.key===null?Ge:Bt.key),ne=x(Bt,ne,Ge),ze===null?Pe=Bt:ze.sibling=Bt,ze=Bt);return r&&Be.forEach(function(Ms){return o(ae,Ms)}),gt&&ma(ae,Ge),Pe}function $e(ae,ne,oe,ke){var Pe=V(oe);if(typeof Pe!="function")throw Error(n(150));if(oe=Pe.call(oe),oe==null)throw Error(n(151));for(var ze=Pe=null,Be=ne,Ge=ne=0,Bt=null,nt=oe.next();Be!==null&&!nt.done;Ge++,nt=oe.next()){Be.index>Ge?(Bt=Be,Be=null):Bt=Be.sibling;var Ms=ye(ae,Be,nt.value,ke);if(Ms===null){Be===null&&(Be=Bt);break}r&&Be&&Ms.alternate===null&&o(ae,Be),ne=x(Ms,ne,Ge),ze===null?Pe=Ms:ze.sibling=Ms,ze=Ms,Be=Bt}if(nt.done)return u(ae,Be),gt&&ma(ae,Ge),Pe;if(Be===null){for(;!nt.done;Ge++,nt=oe.next())nt=xe(ae,nt.value,ke),nt!==null&&(ne=x(nt,ne,Ge),ze===null?Pe=nt:ze.sibling=nt,ze=nt);return gt&&ma(ae,Ge),Pe}for(Be=m(ae,Be);!nt.done;Ge++,nt=oe.next())nt=Te(Be,ae,Ge,nt.value,ke),nt!==null&&(r&&nt.alternate!==null&&Be.delete(nt.key===null?Ge:nt.key),ne=x(nt,ne,Ge),ze===null?Pe=nt:ze.sibling=nt,ze=nt);return r&&Be.forEach(function(hM){return o(ae,hM)}),gt&&ma(ae,Ge),Pe}function Ct(ae,ne,oe,ke){if(typeof oe=="object"&&oe!==null&&oe.type===I&&oe.key===null&&(oe=oe.props.children),typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case M:e:{for(var Pe=oe.key,ze=ne;ze!==null;){if(ze.key===Pe){if(Pe=oe.type,Pe===I){if(ze.tag===7){u(ae,ze.sibling),ne=v(ze,oe.props.children),ne.return=ae,ae=ne;break e}}else if(ze.elementType===Pe||typeof Pe=="object"&&Pe!==null&&Pe.$$typeof===D&&P0(Pe)===ze.type){u(ae,ze.sibling),ne=v(ze,oe.props),ne.ref=Wi(ae,ze,oe),ne.return=ae,ae=ne;break e}u(ae,ze);break}else o(ae,ze);ze=ze.sibling}oe.type===I?(ne=_a(oe.props.children,ae.mode,ke,oe.key),ne.return=ae,ae=ne):(ke=Kc(oe.type,oe.key,oe.props,null,ae.mode,ke),ke.ref=Wi(ae,ne,oe),ke.return=ae,ae=ke)}return R(ae);case $:e:{for(ze=oe.key;ne!==null;){if(ne.key===ze)if(ne.tag===4&&ne.stateNode.containerInfo===oe.containerInfo&&ne.stateNode.implementation===oe.implementation){u(ae,ne.sibling),ne=v(ne,oe.children||[]),ne.return=ae,ae=ne;break e}else{u(ae,ne);break}else o(ae,ne);ne=ne.sibling}ne=Yh(oe,ae.mode,ke),ne.return=ae,ae=ne}return R(ae);case D:return ze=oe._init,Ct(ae,ne,ze(oe._payload),ke)}if(ft(oe))return Me(ae,ne,oe,ke);if(V(oe))return $e(ae,ne,oe,ke);Nc(ae,oe)}return typeof oe=="string"&&oe!==""||typeof oe=="number"?(oe=""+oe,ne!==null&&ne.tag===6?(u(ae,ne.sibling),ne=v(ne,oe),ne.return=ae,ae=ne):(u(ae,ne),ne=Vh(oe,ae.mode,ke),ne.return=ae,ae=ne),R(ae)):u(ae,ne)}return Ct}var bo=L0(!0),q0=L0(!1),Ec=bs(null),jc=null,ko=null,rh=null;function sh(){rh=ko=jc=null}function ah(r){var o=Ec.current;pt(Ec),r._currentValue=o}function oh(r,o,u){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===u)break;r=r.return}}function _o(r,o){jc=r,rh=ko=null,r=r.dependencies,r!==null&&r.firstContext!==null&&((r.lanes&o)!==0&&(fn=!0),r.firstContext=null)}function Fn(r){var o=r._currentValue;if(rh!==r)if(r={context:r,memoizedValue:o,next:null},ko===null){if(jc===null)throw Error(n(308));ko=r,jc.dependencies={lanes:0,firstContext:r}}else ko=ko.next=r;return o}var ga=null;function ih(r){ga===null?ga=[r]:ga.push(r)}function D0(r,o,u,m){var v=o.interleaved;return v===null?(u.next=u,ih(o)):(u.next=v.next,v.next=u),o.interleaved=u,Xr(r,m)}function Xr(r,o){r.lanes|=o;var u=r.alternate;for(u!==null&&(u.lanes|=o),u=r,r=r.return;r!==null;)r.childLanes|=o,u=r.alternate,u!==null&&(u.childLanes|=o),u=r,r=r.return;return u.tag===3?u.stateNode:null}var Ss=!1;function lh(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function F0(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 Qr(r,o){return{eventTime:r,lane:o,tag:0,payload:null,callback:null,next:null}}function Ns(r,o,u){var m=r.updateQueue;if(m===null)return null;if(m=m.shared,(tt&2)!==0){var v=m.pending;return v===null?o.next=o:(o.next=v.next,v.next=o),m.pending=o,Xr(r,u)}return v=m.interleaved,v===null?(o.next=o,ih(m)):(o.next=v.next,v.next=o),m.interleaved=o,Xr(r,u)}function Cc(r,o,u){if(o=o.updateQueue,o!==null&&(o=o.shared,(u&4194240)!==0)){var m=o.lanes;m&=r.pendingLanes,u|=m,o.lanes=u,Ka(r,u)}}function z0(r,o){var u=r.updateQueue,m=r.alternate;if(m!==null&&(m=m.updateQueue,u===m)){var v=null,x=null;if(u=u.firstBaseUpdate,u!==null){do{var R={eventTime:u.eventTime,lane:u.lane,tag:u.tag,payload:u.payload,callback:u.callback,next:null};x===null?v=x=R:x=x.next=R,u=u.next}while(u!==null);x===null?v=x=o:x=x.next=o}else v=x=o;u={baseState:m.baseState,firstBaseUpdate:v,lastBaseUpdate:x,shared:m.shared,effects:m.effects},r.updateQueue=u;return}r=u.lastBaseUpdate,r===null?u.firstBaseUpdate=o:r.next=o,u.lastBaseUpdate=o}function Tc(r,o,u,m){var v=r.updateQueue;Ss=!1;var x=v.firstBaseUpdate,R=v.lastBaseUpdate,G=v.shared.pending;if(G!==null){v.shared.pending=null;var ee=G,ue=ee.next;ee.next=null,R===null?x=ue:R.next=ue,R=ee;var ve=r.alternate;ve!==null&&(ve=ve.updateQueue,G=ve.lastBaseUpdate,G!==R&&(G===null?ve.firstBaseUpdate=ue:G.next=ue,ve.lastBaseUpdate=ee))}if(x!==null){var xe=v.baseState;R=0,ve=ue=ee=null,G=x;do{var ye=G.lane,Te=G.eventTime;if((m&ye)===ye){ve!==null&&(ve=ve.next={eventTime:Te,lane:0,tag:G.tag,payload:G.payload,callback:G.callback,next:null});e:{var Me=r,$e=G;switch(ye=o,Te=u,$e.tag){case 1:if(Me=$e.payload,typeof Me=="function"){xe=Me.call(Te,xe,ye);break e}xe=Me;break e;case 3:Me.flags=Me.flags&-65537|128;case 0:if(Me=$e.payload,ye=typeof Me=="function"?Me.call(Te,xe,ye):Me,ye==null)break e;xe=J({},xe,ye);break e;case 2:Ss=!0}}G.callback!==null&&G.lane!==0&&(r.flags|=64,ye=v.effects,ye===null?v.effects=[G]:ye.push(G))}else Te={eventTime:Te,lane:ye,tag:G.tag,payload:G.payload,callback:G.callback,next:null},ve===null?(ue=ve=Te,ee=xe):ve=ve.next=Te,R|=ye;if(G=G.next,G===null){if(G=v.shared.pending,G===null)break;ye=G,G=ye.next,ye.next=null,v.lastBaseUpdate=ye,v.shared.pending=null}}while(!0);if(ve===null&&(ee=xe),v.baseState=ee,v.firstBaseUpdate=ue,v.lastBaseUpdate=ve,o=v.shared.interleaved,o!==null){v=o;do R|=v.lane,v=v.next;while(v!==o)}else x===null&&(v.shared.lanes=0);wa|=R,r.lanes=R,r.memoizedState=xe}}function B0(r,o,u){if(r=o.effects,o.effects=null,r!==null)for(o=0;o<r.length;o++){var m=r[o],v=m.callback;if(v!==null){if(m.callback=null,m=u,typeof v!="function")throw Error(n(191,v));v.call(m)}}}var Hi={},kr=bs(Hi),Gi=bs(Hi),Vi=bs(Hi);function ya(r){if(r===Hi)throw Error(n(174));return r}function ch(r,o){switch(ht(Vi,o),ht(Gi,r),ht(kr,Hi),r=o.nodeType,r){case 9:case 11:o=(o=o.documentElement)?o.namespaceURI:He(null,"");break;default:r=r===8?o.parentNode:o,o=r.namespaceURI||null,r=r.tagName,o=He(o,r)}pt(kr),ht(kr,o)}function So(){pt(kr),pt(Gi),pt(Vi)}function U0(r){ya(Vi.current);var o=ya(kr.current),u=He(o,r.type);o!==u&&(ht(Gi,r),ht(kr,u))}function uh(r){Gi.current===r&&(pt(kr),pt(Gi))}var bt=bs(0);function Rc(r){for(var o=r;o!==null;){if(o.tag===13){var u=o.memoizedState;if(u!==null&&(u=u.dehydrated,u===null||u.data==="$?"||u.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 dh=[];function hh(){for(var r=0;r<dh.length;r++)dh[r]._workInProgressVersionPrimary=null;dh.length=0}var Ac=C.ReactCurrentDispatcher,fh=C.ReactCurrentBatchConfig,va=0,kt=null,Pt=null,Ft=null,Mc=!1,Yi=!1,Ki=0,OA=0;function Qt(){throw Error(n(321))}function ph(r,o){if(o===null)return!1;for(var u=0;u<o.length&&u<r.length;u++)if(!Nn(r[u],o[u]))return!1;return!0}function mh(r,o,u,m,v,x){if(va=x,kt=o,o.memoizedState=null,o.updateQueue=null,o.lanes=0,Ac.current=r===null||r.memoizedState===null?qA:DA,r=u(m,v),Yi){x=0;do{if(Yi=!1,Ki=0,25<=x)throw Error(n(301));x+=1,Ft=Pt=null,o.updateQueue=null,Ac.current=FA,r=u(m,v)}while(Yi)}if(Ac.current=$c,o=Pt!==null&&Pt.next!==null,va=0,Ft=Pt=kt=null,Mc=!1,o)throw Error(n(300));return r}function gh(){var r=Ki!==0;return Ki=0,r}function _r(){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 zn(){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 Xi(r,o){return typeof o=="function"?o(r):o}function yh(r){var o=zn(),u=o.queue;if(u===null)throw Error(n(311));u.lastRenderedReducer=r;var m=Pt,v=m.baseQueue,x=u.pending;if(x!==null){if(v!==null){var R=v.next;v.next=x.next,x.next=R}m.baseQueue=v=x,u.pending=null}if(v!==null){x=v.next,m=m.baseState;var G=R=null,ee=null,ue=x;do{var ve=ue.lane;if((va&ve)===ve)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 xe={lane:ve,action:ue.action,hasEagerState:ue.hasEagerState,eagerState:ue.eagerState,next:null};ee===null?(G=ee=xe,R=m):ee=ee.next=xe,kt.lanes|=ve,wa|=ve}ue=ue.next}while(ue!==null&&ue!==x);ee===null?R=m:ee.next=G,Nn(m,o.memoizedState)||(fn=!0),o.memoizedState=m,o.baseState=R,o.baseQueue=ee,u.lastRenderedState=m}if(r=u.interleaved,r!==null){v=r;do x=v.lane,kt.lanes|=x,wa|=x,v=v.next;while(v!==r)}else v===null&&(u.lanes=0);return[o.memoizedState,u.dispatch]}function vh(r){var o=zn(),u=o.queue;if(u===null)throw Error(n(311));u.lastRenderedReducer=r;var m=u.dispatch,v=u.pending,x=o.memoizedState;if(v!==null){u.pending=null;var R=v=v.next;do x=r(x,R.action),R=R.next;while(R!==v);Nn(x,o.memoizedState)||(fn=!0),o.memoizedState=x,o.baseQueue===null&&(o.baseState=x),u.lastRenderedState=x}return[x,m]}function W0(){}function H0(r,o){var u=kt,m=zn(),v=o(),x=!Nn(m.memoizedState,v);if(x&&(m.memoizedState=v,fn=!0),m=m.queue,wh(Y0.bind(null,u,m,r),[r]),m.getSnapshot!==o||x||Ft!==null&&Ft.memoizedState.tag&1){if(u.flags|=2048,Qi(9,V0.bind(null,u,m,v,o),void 0,null),zt===null)throw Error(n(349));(va&30)!==0||G0(u,o,v)}return v}function G0(r,o,u){r.flags|=16384,r={getSnapshot:o,value:u},o=kt.updateQueue,o===null?(o={lastEffect:null,stores:null},kt.updateQueue=o,o.stores=[r]):(u=o.stores,u===null?o.stores=[r]:u.push(r))}function V0(r,o,u,m){o.value=u,o.getSnapshot=m,K0(o)&&X0(r)}function Y0(r,o,u){return u(function(){K0(o)&&X0(r)})}function K0(r){var o=r.getSnapshot;r=r.value;try{var u=o();return!Nn(r,u)}catch{return!0}}function X0(r){var o=Xr(r,1);o!==null&&sr(o,r,1,-1)}function Q0(r){var o=_r();return typeof r=="function"&&(r=r()),o.memoizedState=o.baseState=r,r={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Xi,lastRenderedState:r},o.queue=r,r=r.dispatch=LA.bind(null,kt,r),[o.memoizedState,r]}function Qi(r,o,u,m){return r={tag:r,create:o,destroy:u,deps:m,next:null},o=kt.updateQueue,o===null?(o={lastEffect:null,stores:null},kt.updateQueue=o,o.lastEffect=r.next=r):(u=o.lastEffect,u===null?o.lastEffect=r.next=r:(m=u.next,u.next=r,r.next=m,o.lastEffect=r)),r}function Z0(){return zn().memoizedState}function Ic(r,o,u,m){var v=_r();kt.flags|=r,v.memoizedState=Qi(1|o,u,void 0,m===void 0?null:m)}function Oc(r,o,u,m){var v=zn();m=m===void 0?null:m;var x=void 0;if(Pt!==null){var R=Pt.memoizedState;if(x=R.destroy,m!==null&&ph(m,R.deps)){v.memoizedState=Qi(o,u,x,m);return}}kt.flags|=r,v.memoizedState=Qi(1|o,u,x,m)}function J0(r,o){return Ic(8390656,8,r,o)}function wh(r,o){return Oc(2048,8,r,o)}function ex(r,o){return Oc(4,2,r,o)}function tx(r,o){return Oc(4,4,r,o)}function nx(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 rx(r,o,u){return u=u!=null?u.concat([r]):null,Oc(4,4,nx.bind(null,o,r),u)}function xh(){}function sx(r,o){var u=zn();o=o===void 0?null:o;var m=u.memoizedState;return m!==null&&o!==null&&ph(o,m[1])?m[0]:(u.memoizedState=[r,o],r)}function ax(r,o){var u=zn();o=o===void 0?null:o;var m=u.memoizedState;return m!==null&&o!==null&&ph(o,m[1])?m[0]:(r=r(),u.memoizedState=[r,o],r)}function ox(r,o,u){return(va&21)===0?(r.baseState&&(r.baseState=!1,fn=!0),r.memoizedState=u):(Nn(u,o)||(u=Qs(),kt.lanes|=u,wa|=u,r.baseState=!0),o)}function $A(r,o){var u=Ze;Ze=u!==0&&4>u?u:4,r(!0);var m=fh.transition;fh.transition={};try{r(!1),o()}finally{Ze=u,fh.transition=m}}function ix(){return zn().memoizedState}function PA(r,o,u){var m=Ts(r);if(u={lane:m,action:u,hasEagerState:!1,eagerState:null,next:null},lx(r))cx(o,u);else if(u=D0(r,o,u,m),u!==null){var v=sn();sr(u,r,m,v),ux(u,o,m)}}function LA(r,o,u){var m=Ts(r),v={lane:m,action:u,hasEagerState:!1,eagerState:null,next:null};if(lx(r))cx(o,v);else{var x=r.alternate;if(r.lanes===0&&(x===null||x.lanes===0)&&(x=o.lastRenderedReducer,x!==null))try{var R=o.lastRenderedState,G=x(R,u);if(v.hasEagerState=!0,v.eagerState=G,Nn(G,R)){var ee=o.interleaved;ee===null?(v.next=v,ih(o)):(v.next=ee.next,ee.next=v),o.interleaved=v;return}}catch{}finally{}u=D0(r,o,v,m),u!==null&&(v=sn(),sr(u,r,m,v),ux(u,o,m))}}function lx(r){var o=r.alternate;return r===kt||o!==null&&o===kt}function cx(r,o){Yi=Mc=!0;var u=r.pending;u===null?o.next=o:(o.next=u.next,u.next=o),r.pending=o}function ux(r,o,u){if((u&4194240)!==0){var m=o.lanes;m&=r.pendingLanes,u|=m,o.lanes=u,Ka(r,u)}}var $c={readContext:Fn,useCallback:Qt,useContext:Qt,useEffect:Qt,useImperativeHandle:Qt,useInsertionEffect:Qt,useLayoutEffect:Qt,useMemo:Qt,useReducer:Qt,useRef:Qt,useState:Qt,useDebugValue:Qt,useDeferredValue:Qt,useTransition:Qt,useMutableSource:Qt,useSyncExternalStore:Qt,useId:Qt,unstable_isNewReconciler:!1},qA={readContext:Fn,useCallback:function(r,o){return _r().memoizedState=[r,o===void 0?null:o],r},useContext:Fn,useEffect:J0,useImperativeHandle:function(r,o,u){return u=u!=null?u.concat([r]):null,Ic(4194308,4,nx.bind(null,o,r),u)},useLayoutEffect:function(r,o){return Ic(4194308,4,r,o)},useInsertionEffect:function(r,o){return Ic(4,2,r,o)},useMemo:function(r,o){var u=_r();return o=o===void 0?null:o,r=r(),u.memoizedState=[r,o],r},useReducer:function(r,o,u){var m=_r();return o=u!==void 0?u(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=PA.bind(null,kt,r),[m.memoizedState,r]},useRef:function(r){var o=_r();return r={current:r},o.memoizedState=r},useState:Q0,useDebugValue:xh,useDeferredValue:function(r){return _r().memoizedState=r},useTransition:function(){var r=Q0(!1),o=r[0];return r=$A.bind(null,r[1]),_r().memoizedState=r,[o,r]},useMutableSource:function(){},useSyncExternalStore:function(r,o,u){var m=kt,v=_r();if(gt){if(u===void 0)throw Error(n(407));u=u()}else{if(u=o(),zt===null)throw Error(n(349));(va&30)!==0||G0(m,o,u)}v.memoizedState=u;var x={value:u,getSnapshot:o};return v.queue=x,J0(Y0.bind(null,m,x,r),[r]),m.flags|=2048,Qi(9,V0.bind(null,m,x,u,o),void 0,null),u},useId:function(){var r=_r(),o=zt.identifierPrefix;if(gt){var u=Kr,m=Yr;u=(m&~(1<<32-on(m)-1)).toString(32)+u,o=":"+o+"R"+u,u=Ki++,0<u&&(o+="H"+u.toString(32)),o+=":"}else u=OA++,o=":"+o+"r"+u.toString(32)+":";return r.memoizedState=o},unstable_isNewReconciler:!1},DA={readContext:Fn,useCallback:sx,useContext:Fn,useEffect:wh,useImperativeHandle:rx,useInsertionEffect:ex,useLayoutEffect:tx,useMemo:ax,useReducer:yh,useRef:Z0,useState:function(){return yh(Xi)},useDebugValue:xh,useDeferredValue:function(r){var o=zn();return ox(o,Pt.memoizedState,r)},useTransition:function(){var r=yh(Xi)[0],o=zn().memoizedState;return[r,o]},useMutableSource:W0,useSyncExternalStore:H0,useId:ix,unstable_isNewReconciler:!1},FA={readContext:Fn,useCallback:sx,useContext:Fn,useEffect:wh,useImperativeHandle:rx,useInsertionEffect:ex,useLayoutEffect:tx,useMemo:ax,useReducer:vh,useRef:Z0,useState:function(){return vh(Xi)},useDebugValue:xh,useDeferredValue:function(r){var o=zn();return Pt===null?o.memoizedState=r:ox(o,Pt.memoizedState,r)},useTransition:function(){var r=vh(Xi)[0],o=zn().memoizedState;return[r,o]},useMutableSource:W0,useSyncExternalStore:H0,useId:ix,unstable_isNewReconciler:!1};function tr(r,o){if(r&&r.defaultProps){o=J({},o),r=r.defaultProps;for(var u in r)o[u]===void 0&&(o[u]=r[u]);return o}return o}function bh(r,o,u,m){o=r.memoizedState,u=u(m,o),u=u==null?o:J({},o,u),r.memoizedState=u,r.lanes===0&&(r.updateQueue.baseState=u)}var Pc={isMounted:function(r){return(r=r._reactInternals)?On(r)===r:!1},enqueueSetState:function(r,o,u){r=r._reactInternals;var m=sn(),v=Ts(r),x=Qr(m,v);x.payload=o,u!=null&&(x.callback=u),o=Ns(r,x,v),o!==null&&(sr(o,r,v,m),Cc(o,r,v))},enqueueReplaceState:function(r,o,u){r=r._reactInternals;var m=sn(),v=Ts(r),x=Qr(m,v);x.tag=1,x.payload=o,u!=null&&(x.callback=u),o=Ns(r,x,v),o!==null&&(sr(o,r,v,m),Cc(o,r,v))},enqueueForceUpdate:function(r,o){r=r._reactInternals;var u=sn(),m=Ts(r),v=Qr(u,m);v.tag=2,o!=null&&(v.callback=o),o=Ns(r,v,m),o!==null&&(sr(o,r,m,u),Cc(o,r,m))}};function dx(r,o,u,m,v,x,R){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(m,x,R):o.prototype&&o.prototype.isPureReactComponent?!En(u,m)||!En(v,x):!0}function hx(r,o,u){var m=!1,v=ks,x=o.contextType;return typeof x=="object"&&x!==null?x=Fn(x):(v=hn(o)?fa:Xt.current,m=o.contextTypes,x=(m=m!=null)?yo(r,v):ks),o=new o(u,x),r.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,o.updater=Pc,r.stateNode=o,o._reactInternals=r,m&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=v,r.__reactInternalMemoizedMaskedChildContext=x),o}function fx(r,o,u,m){r=o.state,typeof o.componentWillReceiveProps=="function"&&o.componentWillReceiveProps(u,m),typeof o.UNSAFE_componentWillReceiveProps=="function"&&o.UNSAFE_componentWillReceiveProps(u,m),o.state!==r&&Pc.enqueueReplaceState(o,o.state,null)}function kh(r,o,u,m){var v=r.stateNode;v.props=u,v.state=r.memoizedState,v.refs={},lh(r);var x=o.contextType;typeof x=="object"&&x!==null?v.context=Fn(x):(x=hn(o)?fa:Xt.current,v.context=yo(r,x)),v.state=r.memoizedState,x=o.getDerivedStateFromProps,typeof x=="function"&&(bh(r,o,x,u),v.state=r.memoizedState),typeof o.getDerivedStateFromProps=="function"||typeof v.getSnapshotBeforeUpdate=="function"||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(o=v.state,typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount(),o!==v.state&&Pc.enqueueReplaceState(v,v.state,null),Tc(r,u,v,m),v.state=r.memoizedState),typeof v.componentDidMount=="function"&&(r.flags|=4194308)}function No(r,o){try{var u="",m=o;do u+=z(m),m=m.return;while(m);var v=u}catch(x){v=`
|
|
39
|
+
Error generating stack: `+x.message+`
|
|
40
|
+
`+x.stack}return{value:r,source:o,stack:v,digest:null}}function _h(r,o,u){return{value:r,source:null,stack:u??null,digest:o??null}}function Sh(r,o){try{console.error(o.value)}catch(u){setTimeout(function(){throw u})}}var zA=typeof WeakMap=="function"?WeakMap:Map;function px(r,o,u){u=Qr(-1,u),u.tag=3,u.payload={element:null};var m=o.value;return u.callback=function(){Uc||(Uc=!0,Dh=m),Sh(r,o)},u}function mx(r,o,u){u=Qr(-1,u),u.tag=3;var m=r.type.getDerivedStateFromError;if(typeof m=="function"){var v=o.value;u.payload=function(){return m(v)},u.callback=function(){Sh(r,o)}}var x=r.stateNode;return x!==null&&typeof x.componentDidCatch=="function"&&(u.callback=function(){Sh(r,o),typeof m!="function"&&(js===null?js=new Set([this]):js.add(this));var R=o.stack;this.componentDidCatch(o.value,{componentStack:R!==null?R:""})}),u}function gx(r,o,u){var m=r.pingCache;if(m===null){m=r.pingCache=new zA;var v=new Set;m.set(o,v)}else v=m.get(o),v===void 0&&(v=new Set,m.set(o,v));v.has(u)||(v.add(u),r=tM.bind(null,r,o,u),o.then(r,r))}function yx(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 vx(r,o,u,m,v){return(r.mode&1)===0?(r===o?r.flags|=65536:(r.flags|=128,u.flags|=131072,u.flags&=-52805,u.tag===1&&(u.alternate===null?u.tag=17:(o=Qr(-1,1),o.tag=2,Ns(u,o,1))),u.lanes|=1),r):(r.flags|=65536,r.lanes=v,r)}var BA=C.ReactCurrentOwner,fn=!1;function rn(r,o,u,m){o.child=r===null?q0(o,null,u,m):bo(o,r.child,u,m)}function wx(r,o,u,m,v){u=u.render;var x=o.ref;return _o(o,v),m=mh(r,o,u,m,x,v),u=gh(),r!==null&&!fn?(o.updateQueue=r.updateQueue,o.flags&=-2053,r.lanes&=~v,Zr(r,o,v)):(gt&&u&&Zd(o),o.flags|=1,rn(r,o,m,v),o.child)}function xx(r,o,u,m,v){if(r===null){var x=u.type;return typeof x=="function"&&!Gh(x)&&x.defaultProps===void 0&&u.compare===null&&u.defaultProps===void 0?(o.tag=15,o.type=x,bx(r,o,x,m,v)):(r=Kc(u.type,null,m,o,o.mode,v),r.ref=o.ref,r.return=o,o.child=r)}if(x=r.child,(r.lanes&v)===0){var R=x.memoizedProps;if(u=u.compare,u=u!==null?u:En,u(R,m)&&r.ref===o.ref)return Zr(r,o,v)}return o.flags|=1,r=As(x,m),r.ref=o.ref,r.return=o,o.child=r}function bx(r,o,u,m,v){if(r!==null){var x=r.memoizedProps;if(En(x,m)&&r.ref===o.ref)if(fn=!1,o.pendingProps=m=x,(r.lanes&v)!==0)(r.flags&131072)!==0&&(fn=!0);else return o.lanes=r.lanes,Zr(r,o,v)}return Nh(r,o,u,m,v)}function kx(r,o,u){var m=o.pendingProps,v=m.children,x=r!==null?r.memoizedState:null;if(m.mode==="hidden")if((o.mode&1)===0)o.memoizedState={baseLanes:0,cachePool:null,transitions:null},ht(jo,Tn),Tn|=u;else{if((u&1073741824)===0)return r=x!==null?x.baseLanes|u:u,o.lanes=o.childLanes=1073741824,o.memoizedState={baseLanes:r,cachePool:null,transitions:null},o.updateQueue=null,ht(jo,Tn),Tn|=r,null;o.memoizedState={baseLanes:0,cachePool:null,transitions:null},m=x!==null?x.baseLanes:u,ht(jo,Tn),Tn|=m}else x!==null?(m=x.baseLanes|u,o.memoizedState=null):m=u,ht(jo,Tn),Tn|=m;return rn(r,o,v,u),o.child}function _x(r,o){var u=o.ref;(r===null&&u!==null||r!==null&&r.ref!==u)&&(o.flags|=512,o.flags|=2097152)}function Nh(r,o,u,m,v){var x=hn(u)?fa:Xt.current;return x=yo(o,x),_o(o,v),u=mh(r,o,u,m,x,v),m=gh(),r!==null&&!fn?(o.updateQueue=r.updateQueue,o.flags&=-2053,r.lanes&=~v,Zr(r,o,v)):(gt&&m&&Zd(o),o.flags|=1,rn(r,o,u,v),o.child)}function Sx(r,o,u,m,v){if(hn(u)){var x=!0;xc(o)}else x=!1;if(_o(o,v),o.stateNode===null)qc(r,o),hx(o,u,m),kh(o,u,m,v),m=!0;else if(r===null){var R=o.stateNode,G=o.memoizedProps;R.props=G;var ee=R.context,ue=u.contextType;typeof ue=="object"&&ue!==null?ue=Fn(ue):(ue=hn(u)?fa:Xt.current,ue=yo(o,ue));var ve=u.getDerivedStateFromProps,xe=typeof ve=="function"||typeof R.getSnapshotBeforeUpdate=="function";xe||typeof R.UNSAFE_componentWillReceiveProps!="function"&&typeof R.componentWillReceiveProps!="function"||(G!==m||ee!==ue)&&fx(o,R,m,ue),Ss=!1;var ye=o.memoizedState;R.state=ye,Tc(o,m,R,v),ee=o.memoizedState,G!==m||ye!==ee||dn.current||Ss?(typeof ve=="function"&&(bh(o,u,ve,m),ee=o.memoizedState),(G=Ss||dx(o,u,G,m,ye,ee,ue))?(xe||typeof R.UNSAFE_componentWillMount!="function"&&typeof R.componentWillMount!="function"||(typeof R.componentWillMount=="function"&&R.componentWillMount(),typeof R.UNSAFE_componentWillMount=="function"&&R.UNSAFE_componentWillMount()),typeof R.componentDidMount=="function"&&(o.flags|=4194308)):(typeof R.componentDidMount=="function"&&(o.flags|=4194308),o.memoizedProps=m,o.memoizedState=ee),R.props=m,R.state=ee,R.context=ue,m=G):(typeof R.componentDidMount=="function"&&(o.flags|=4194308),m=!1)}else{R=o.stateNode,F0(r,o),G=o.memoizedProps,ue=o.type===o.elementType?G:tr(o.type,G),R.props=ue,xe=o.pendingProps,ye=R.context,ee=u.contextType,typeof ee=="object"&&ee!==null?ee=Fn(ee):(ee=hn(u)?fa:Xt.current,ee=yo(o,ee));var Te=u.getDerivedStateFromProps;(ve=typeof Te=="function"||typeof R.getSnapshotBeforeUpdate=="function")||typeof R.UNSAFE_componentWillReceiveProps!="function"&&typeof R.componentWillReceiveProps!="function"||(G!==xe||ye!==ee)&&fx(o,R,m,ee),Ss=!1,ye=o.memoizedState,R.state=ye,Tc(o,m,R,v);var Me=o.memoizedState;G!==xe||ye!==Me||dn.current||Ss?(typeof Te=="function"&&(bh(o,u,Te,m),Me=o.memoizedState),(ue=Ss||dx(o,u,ue,m,ye,Me,ee)||!1)?(ve||typeof R.UNSAFE_componentWillUpdate!="function"&&typeof R.componentWillUpdate!="function"||(typeof R.componentWillUpdate=="function"&&R.componentWillUpdate(m,Me,ee),typeof R.UNSAFE_componentWillUpdate=="function"&&R.UNSAFE_componentWillUpdate(m,Me,ee)),typeof R.componentDidUpdate=="function"&&(o.flags|=4),typeof R.getSnapshotBeforeUpdate=="function"&&(o.flags|=1024)):(typeof R.componentDidUpdate!="function"||G===r.memoizedProps&&ye===r.memoizedState||(o.flags|=4),typeof R.getSnapshotBeforeUpdate!="function"||G===r.memoizedProps&&ye===r.memoizedState||(o.flags|=1024),o.memoizedProps=m,o.memoizedState=Me),R.props=m,R.state=Me,R.context=ee,m=ue):(typeof R.componentDidUpdate!="function"||G===r.memoizedProps&&ye===r.memoizedState||(o.flags|=4),typeof R.getSnapshotBeforeUpdate!="function"||G===r.memoizedProps&&ye===r.memoizedState||(o.flags|=1024),m=!1)}return Eh(r,o,u,m,x,v)}function Eh(r,o,u,m,v,x){_x(r,o);var R=(o.flags&128)!==0;if(!m&&!R)return v&&T0(o,u,!1),Zr(r,o,x);m=o.stateNode,BA.current=o;var G=R&&typeof u.getDerivedStateFromError!="function"?null:m.render();return o.flags|=1,r!==null&&R?(o.child=bo(o,r.child,null,x),o.child=bo(o,null,G,x)):rn(r,o,G,x),o.memoizedState=m.state,v&&T0(o,u,!0),o.child}function Nx(r){var o=r.stateNode;o.pendingContext?j0(r,o.pendingContext,o.pendingContext!==o.context):o.context&&j0(r,o.context,!1),ch(r,o.containerInfo)}function Ex(r,o,u,m,v){return xo(),nh(v),o.flags|=256,rn(r,o,u,m),o.child}var jh={dehydrated:null,treeContext:null,retryLane:0};function Ch(r){return{baseLanes:r,cachePool:null,transitions:null}}function jx(r,o,u){var m=o.pendingProps,v=bt.current,x=!1,R=(o.flags&128)!==0,G;if((G=R)||(G=r!==null&&r.memoizedState===null?!1:(v&2)!==0),G?(x=!0,o.flags&=-129):(r===null||r.memoizedState!==null)&&(v|=1),ht(bt,v&1),r===null)return th(o),r=o.memoizedState,r!==null&&(r=r.dehydrated,r!==null)?((o.mode&1)===0?o.lanes=1:r.data==="$!"?o.lanes=8:o.lanes=1073741824,null):(R=m.children,r=m.fallback,x?(m=o.mode,x=o.child,R={mode:"hidden",children:R},(m&1)===0&&x!==null?(x.childLanes=0,x.pendingProps=R):x=Xc(R,m,0,null),r=_a(r,m,u,null),x.return=o,r.return=o,x.sibling=r,o.child=x,o.child.memoizedState=Ch(u),o.memoizedState=jh,r):Th(o,R));if(v=r.memoizedState,v!==null&&(G=v.dehydrated,G!==null))return UA(r,o,R,m,G,v,u);if(x){x=m.fallback,R=o.mode,v=r.child,G=v.sibling;var ee={mode:"hidden",children:m.children};return(R&1)===0&&o.child!==v?(m=o.child,m.childLanes=0,m.pendingProps=ee,o.deletions=null):(m=As(v,ee),m.subtreeFlags=v.subtreeFlags&14680064),G!==null?x=As(G,x):(x=_a(x,R,u,null),x.flags|=2),x.return=o,m.return=o,m.sibling=x,o.child=m,m=x,x=o.child,R=r.child.memoizedState,R=R===null?Ch(u):{baseLanes:R.baseLanes|u,cachePool:null,transitions:R.transitions},x.memoizedState=R,x.childLanes=r.childLanes&~u,o.memoizedState=jh,m}return x=r.child,r=x.sibling,m=As(x,{mode:"visible",children:m.children}),(o.mode&1)===0&&(m.lanes=u),m.return=o,m.sibling=null,r!==null&&(u=o.deletions,u===null?(o.deletions=[r],o.flags|=16):u.push(r)),o.child=m,o.memoizedState=null,m}function Th(r,o){return o=Xc({mode:"visible",children:o},r.mode,0,null),o.return=r,r.child=o}function Lc(r,o,u,m){return m!==null&&nh(m),bo(o,r.child,null,u),r=Th(o,o.pendingProps.children),r.flags|=2,o.memoizedState=null,r}function UA(r,o,u,m,v,x,R){if(u)return o.flags&256?(o.flags&=-257,m=_h(Error(n(422))),Lc(r,o,R,m)):o.memoizedState!==null?(o.child=r.child,o.flags|=128,null):(x=m.fallback,v=o.mode,m=Xc({mode:"visible",children:m.children},v,0,null),x=_a(x,v,R,null),x.flags|=2,m.return=o,x.return=o,m.sibling=x,o.child=m,(o.mode&1)!==0&&bo(o,r.child,null,R),o.child.memoizedState=Ch(R),o.memoizedState=jh,x);if((o.mode&1)===0)return Lc(r,o,R,null);if(v.data==="$!"){if(m=v.nextSibling&&v.nextSibling.dataset,m)var G=m.dgst;return m=G,x=Error(n(419)),m=_h(x,m,void 0),Lc(r,o,R,m)}if(G=(R&r.childLanes)!==0,fn||G){if(m=zt,m!==null){switch(R&-R){case 4:v=2;break;case 16:v=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:v=32;break;case 536870912:v=268435456;break;default:v=0}v=(v&(m.suspendedLanes|R))!==0?0:v,v!==0&&v!==x.retryLane&&(x.retryLane=v,Xr(r,v),sr(m,r,v,-1))}return Hh(),m=_h(Error(n(421))),Lc(r,o,R,m)}return v.data==="$?"?(o.flags|=128,o.child=r.child,o=nM.bind(null,r),v._reactRetry=o,null):(r=x.treeContext,Cn=xs(v.nextSibling),jn=o,gt=!0,er=null,r!==null&&(qn[Dn++]=Yr,qn[Dn++]=Kr,qn[Dn++]=pa,Yr=r.id,Kr=r.overflow,pa=o),o=Th(o,m.children),o.flags|=4096,o)}function Cx(r,o,u){r.lanes|=o;var m=r.alternate;m!==null&&(m.lanes|=o),oh(r.return,o,u)}function Rh(r,o,u,m,v){var x=r.memoizedState;x===null?r.memoizedState={isBackwards:o,rendering:null,renderingStartTime:0,last:m,tail:u,tailMode:v}:(x.isBackwards=o,x.rendering=null,x.renderingStartTime=0,x.last=m,x.tail=u,x.tailMode=v)}function Tx(r,o,u){var m=o.pendingProps,v=m.revealOrder,x=m.tail;if(rn(r,o,m.children,u),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&&Cx(r,u,o);else if(r.tag===19)Cx(r,u,o);else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===o)break e;for(;r.sibling===null;){if(r.return===null||r.return===o)break e;r=r.return}r.sibling.return=r.return,r=r.sibling}m&=1}if(ht(bt,m),(o.mode&1)===0)o.memoizedState=null;else switch(v){case"forwards":for(u=o.child,v=null;u!==null;)r=u.alternate,r!==null&&Rc(r)===null&&(v=u),u=u.sibling;u=v,u===null?(v=o.child,o.child=null):(v=u.sibling,u.sibling=null),Rh(o,!1,v,u,x);break;case"backwards":for(u=null,v=o.child,o.child=null;v!==null;){if(r=v.alternate,r!==null&&Rc(r)===null){o.child=v;break}r=v.sibling,v.sibling=u,u=v,v=r}Rh(o,!0,u,null,x);break;case"together":Rh(o,!1,null,null,void 0);break;default:o.memoizedState=null}return o.child}function qc(r,o){(o.mode&1)===0&&r!==null&&(r.alternate=null,o.alternate=null,o.flags|=2)}function Zr(r,o,u){if(r!==null&&(o.dependencies=r.dependencies),wa|=o.lanes,(u&o.childLanes)===0)return null;if(r!==null&&o.child!==r.child)throw Error(n(153));if(o.child!==null){for(r=o.child,u=As(r,r.pendingProps),o.child=u,u.return=o;r.sibling!==null;)r=r.sibling,u=u.sibling=As(r,r.pendingProps),u.return=o;u.sibling=null}return o.child}function WA(r,o,u){switch(o.tag){case 3:Nx(o),xo();break;case 5:U0(o);break;case 1:hn(o.type)&&xc(o);break;case 4:ch(o,o.stateNode.containerInfo);break;case 10:var m=o.type._context,v=o.memoizedProps.value;ht(Ec,m._currentValue),m._currentValue=v;break;case 13:if(m=o.memoizedState,m!==null)return m.dehydrated!==null?(ht(bt,bt.current&1),o.flags|=128,null):(u&o.child.childLanes)!==0?jx(r,o,u):(ht(bt,bt.current&1),r=Zr(r,o,u),r!==null?r.sibling:null);ht(bt,bt.current&1);break;case 19:if(m=(u&o.childLanes)!==0,(r.flags&128)!==0){if(m)return Tx(r,o,u);o.flags|=128}if(v=o.memoizedState,v!==null&&(v.rendering=null,v.tail=null,v.lastEffect=null),ht(bt,bt.current),m)break;return null;case 22:case 23:return o.lanes=0,kx(r,o,u)}return Zr(r,o,u)}var Rx,Ah,Ax,Mx;Rx=function(r,o){for(var u=o.child;u!==null;){if(u.tag===5||u.tag===6)r.appendChild(u.stateNode);else if(u.tag!==4&&u.child!==null){u.child.return=u,u=u.child;continue}if(u===o)break;for(;u.sibling===null;){if(u.return===null||u.return===o)return;u=u.return}u.sibling.return=u.return,u=u.sibling}},Ah=function(){},Ax=function(r,o,u,m){var v=r.memoizedProps;if(v!==m){r=o.stateNode,ya(kr.current);var x=null;switch(u){case"input":v=Ce(r,v),m=Ce(r,m),x=[];break;case"select":v=J({},v,{value:void 0}),m=J({},m,{value:void 0}),x=[];break;case"textarea":v=at(r,v),m=at(r,m),x=[];break;default:typeof v.onClick!="function"&&typeof m.onClick=="function"&&(r.onclick=yc)}vt(u,m);var R;u=null;for(ue in v)if(!m.hasOwnProperty(ue)&&v.hasOwnProperty(ue)&&v[ue]!=null)if(ue==="style"){var G=v[ue];for(R in G)G.hasOwnProperty(R)&&(u||(u={}),u[R]="")}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(G=v!=null?v[ue]:void 0,m.hasOwnProperty(ue)&&ee!==G&&(ee!=null||G!=null))if(ue==="style")if(G){for(R in G)!G.hasOwnProperty(R)||ee&&ee.hasOwnProperty(R)||(u||(u={}),u[R]="");for(R in ee)ee.hasOwnProperty(R)&&G[R]!==ee[R]&&(u||(u={}),u[R]=ee[R])}else u||(x||(x=[]),x.push(ue,u)),u=ee;else ue==="dangerouslySetInnerHTML"?(ee=ee?ee.__html:void 0,G=G?G.__html:void 0,ee!=null&&G!==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"&<("scroll",r),x||G===ee||(x=[])):(x=x||[]).push(ue,ee))}u&&(x=x||[]).push("style",u);var ue=x;(o.updateQueue=ue)&&(o.flags|=4)}},Mx=function(r,o,u,m){u!==m&&(o.flags|=4)};function Zi(r,o){if(!gt)switch(r.tailMode){case"hidden":o=r.tail;for(var u=null;o!==null;)o.alternate!==null&&(u=o),o=o.sibling;u===null?r.tail=null:u.sibling=null;break;case"collapsed":u=r.tail;for(var m=null;u!==null;)u.alternate!==null&&(m=u),u=u.sibling;m===null?o||r.tail===null?r.tail=null:r.tail.sibling=null:m.sibling=null}}function Zt(r){var o=r.alternate!==null&&r.alternate.child===r.child,u=0,m=0;if(o)for(var v=r.child;v!==null;)u|=v.lanes|v.childLanes,m|=v.subtreeFlags&14680064,m|=v.flags&14680064,v.return=r,v=v.sibling;else for(v=r.child;v!==null;)u|=v.lanes|v.childLanes,m|=v.subtreeFlags,m|=v.flags,v.return=r,v=v.sibling;return r.subtreeFlags|=m,r.childLanes=u,o}function HA(r,o,u){var m=o.pendingProps;switch(Jd(o),o.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Zt(o),null;case 1:return hn(o.type)&&wc(),Zt(o),null;case 3:return m=o.stateNode,So(),pt(dn),pt(Xt),hh(),m.pendingContext&&(m.context=m.pendingContext,m.pendingContext=null),(r===null||r.child===null)&&(Sc(o)?o.flags|=4:r===null||r.memoizedState.isDehydrated&&(o.flags&256)===0||(o.flags|=1024,er!==null&&(Bh(er),er=null))),Ah(r,o),Zt(o),null;case 5:uh(o);var v=ya(Vi.current);if(u=o.type,r!==null&&o.stateNode!=null)Ax(r,o,u,m,v),r.ref!==o.ref&&(o.flags|=512,o.flags|=2097152);else{if(!m){if(o.stateNode===null)throw Error(n(166));return Zt(o),null}if(r=ya(kr.current),Sc(o)){m=o.stateNode,u=o.type;var x=o.memoizedProps;switch(m[br]=o,m[Bi]=x,r=(o.mode&1)!==0,u){case"dialog":lt("cancel",m),lt("close",m);break;case"iframe":case"object":case"embed":lt("load",m);break;case"video":case"audio":for(v=0;v<da.length;v++)lt(da[v],m);break;case"source":lt("error",m);break;case"img":case"image":case"link":lt("error",m),lt("load",m);break;case"details":lt("toggle",m);break;case"input":_e(m,x),lt("invalid",m);break;case"select":m._wrapperState={wasMultiple:!!x.multiple},lt("invalid",m);break;case"textarea":Ye(m,x),lt("invalid",m)}vt(u,x),v=null;for(var R in x)if(x.hasOwnProperty(R)){var G=x[R];R==="children"?typeof G=="string"?m.textContent!==G&&(x.suppressHydrationWarning!==!0&&gc(m.textContent,G,r),v=["children",G]):typeof G=="number"&&m.textContent!==""+G&&(x.suppressHydrationWarning!==!0&&gc(m.textContent,G,r),v=["children",""+G]):a.hasOwnProperty(R)&&G!=null&&R==="onScroll"&<("scroll",m)}switch(u){case"input":Ne(m),re(m,x,!0);break;case"textarea":Ne(m),be(m);break;case"select":case"option":break;default:typeof x.onClick=="function"&&(m.onclick=yc)}m=v,o.updateQueue=m,m!==null&&(o.flags|=4)}else{R=v.nodeType===9?v:v.ownerDocument,r==="http://www.w3.org/1999/xhtml"&&(r=De(u)),r==="http://www.w3.org/1999/xhtml"?u==="script"?(r=R.createElement("div"),r.innerHTML="<script><\/script>",r=r.removeChild(r.firstChild)):typeof m.is=="string"?r=R.createElement(u,{is:m.is}):(r=R.createElement(u),u==="select"&&(R=r,m.multiple?R.multiple=!0:m.size&&(R.size=m.size))):r=R.createElementNS(r,u),r[br]=o,r[Bi]=m,Rx(r,o,!1,!1),o.stateNode=r;e:{switch(R=Oe(u,m),u){case"dialog":lt("cancel",r),lt("close",r),v=m;break;case"iframe":case"object":case"embed":lt("load",r),v=m;break;case"video":case"audio":for(v=0;v<da.length;v++)lt(da[v],r);v=m;break;case"source":lt("error",r),v=m;break;case"img":case"image":case"link":lt("error",r),lt("load",r),v=m;break;case"details":lt("toggle",r),v=m;break;case"input":_e(r,m),v=Ce(r,m),lt("invalid",r);break;case"option":v=m;break;case"select":r._wrapperState={wasMultiple:!!m.multiple},v=J({},m,{value:void 0}),lt("invalid",r);break;case"textarea":Ye(r,m),v=at(r,m),lt("invalid",r);break;default:v=m}vt(u,v),G=v;for(x in G)if(G.hasOwnProperty(x)){var ee=G[x];x==="style"?Ue(r,ee):x==="dangerouslySetInnerHTML"?(ee=ee?ee.__html:void 0,ee!=null&&Le(r,ee)):x==="children"?typeof ee=="string"?(u!=="textarea"||ee!=="")&&se(r,ee):typeof ee=="number"&&se(r,""+ee):x!=="suppressContentEditableWarning"&&x!=="suppressHydrationWarning"&&x!=="autoFocus"&&(a.hasOwnProperty(x)?ee!=null&&x==="onScroll"&<("scroll",r):ee!=null&&j(r,x,ee,R))}switch(u){case"input":Ne(r),re(r,m,!1);break;case"textarea":Ne(r),be(r);break;case"option":m.value!=null&&r.setAttribute("value",""+le(m.value));break;case"select":r.multiple=!!m.multiple,x=m.value,x!=null?ut(r,!!m.multiple,x,!1):m.defaultValue!=null&&ut(r,!!m.multiple,m.defaultValue,!0);break;default:typeof v.onClick=="function"&&(r.onclick=yc)}switch(u){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 Zt(o),null;case 6:if(r&&o.stateNode!=null)Mx(r,o,r.memoizedProps,m);else{if(typeof m!="string"&&o.stateNode===null)throw Error(n(166));if(u=ya(Vi.current),ya(kr.current),Sc(o)){if(m=o.stateNode,u=o.memoizedProps,m[br]=o,(x=m.nodeValue!==u)&&(r=jn,r!==null))switch(r.tag){case 3:gc(m.nodeValue,u,(r.mode&1)!==0);break;case 5:r.memoizedProps.suppressHydrationWarning!==!0&&gc(m.nodeValue,u,(r.mode&1)!==0)}x&&(o.flags|=4)}else m=(u.nodeType===9?u:u.ownerDocument).createTextNode(m),m[br]=o,o.stateNode=m}return Zt(o),null;case 13:if(pt(bt),m=o.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(gt&&Cn!==null&&(o.mode&1)!==0&&(o.flags&128)===0)$0(),xo(),o.flags|=98560,x=!1;else if(x=Sc(o),m!==null&&m.dehydrated!==null){if(r===null){if(!x)throw Error(n(318));if(x=o.memoizedState,x=x!==null?x.dehydrated:null,!x)throw Error(n(317));x[br]=o}else xo(),(o.flags&128)===0&&(o.memoizedState=null),o.flags|=4;Zt(o),x=!1}else er!==null&&(Bh(er),er=null),x=!0;if(!x)return o.flags&65536?o:null}return(o.flags&128)!==0?(o.lanes=u,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):Hh())),o.updateQueue!==null&&(o.flags|=4),Zt(o),null);case 4:return So(),Ah(r,o),r===null&&mt(o.stateNode.containerInfo),Zt(o),null;case 10:return ah(o.type._context),Zt(o),null;case 17:return hn(o.type)&&wc(),Zt(o),null;case 19:if(pt(bt),x=o.memoizedState,x===null)return Zt(o),null;if(m=(o.flags&128)!==0,R=x.rendering,R===null)if(m)Zi(x,!1);else{if(Lt!==0||r!==null&&(r.flags&128)!==0)for(r=o.child;r!==null;){if(R=Rc(r),R!==null){for(o.flags|=128,Zi(x,!1),m=R.updateQueue,m!==null&&(o.updateQueue=m,o.flags|=4),o.subtreeFlags=0,m=u,u=o.child;u!==null;)x=u,r=m,x.flags&=14680066,R=x.alternate,R===null?(x.childLanes=0,x.lanes=r,x.child=null,x.subtreeFlags=0,x.memoizedProps=null,x.memoizedState=null,x.updateQueue=null,x.dependencies=null,x.stateNode=null):(x.childLanes=R.childLanes,x.lanes=R.lanes,x.child=R.child,x.subtreeFlags=0,x.deletions=null,x.memoizedProps=R.memoizedProps,x.memoizedState=R.memoizedState,x.updateQueue=R.updateQueue,x.type=R.type,r=R.dependencies,x.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),u=u.sibling;return ht(bt,bt.current&1|2),o.child}r=r.sibling}x.tail!==null&&dt()>Co&&(o.flags|=128,m=!0,Zi(x,!1),o.lanes=4194304)}else{if(!m)if(r=Rc(R),r!==null){if(o.flags|=128,m=!0,u=r.updateQueue,u!==null&&(o.updateQueue=u,o.flags|=4),Zi(x,!0),x.tail===null&&x.tailMode==="hidden"&&!R.alternate&&!gt)return Zt(o),null}else 2*dt()-x.renderingStartTime>Co&&u!==1073741824&&(o.flags|=128,m=!0,Zi(x,!1),o.lanes=4194304);x.isBackwards?(R.sibling=o.child,o.child=R):(u=x.last,u!==null?u.sibling=R:o.child=R,x.last=R)}return x.tail!==null?(o=x.tail,x.rendering=o,x.tail=o.sibling,x.renderingStartTime=dt(),o.sibling=null,u=bt.current,ht(bt,m?u&1|2:u&1),o):(Zt(o),null);case 22:case 23:return Wh(),m=o.memoizedState!==null,r!==null&&r.memoizedState!==null!==m&&(o.flags|=8192),m&&(o.mode&1)!==0?(Tn&1073741824)!==0&&(Zt(o),o.subtreeFlags&6&&(o.flags|=8192)):Zt(o),null;case 24:return null;case 25:return null}throw Error(n(156,o.tag))}function GA(r,o){switch(Jd(o),o.tag){case 1:return hn(o.type)&&wc(),r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 3:return So(),pt(dn),pt(Xt),hh(),r=o.flags,(r&65536)!==0&&(r&128)===0?(o.flags=r&-65537|128,o):null;case 5:return uh(o),null;case 13:if(pt(bt),r=o.memoizedState,r!==null&&r.dehydrated!==null){if(o.alternate===null)throw Error(n(340));xo()}return r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 19:return pt(bt),null;case 4:return So(),null;case 10:return ah(o.type._context),null;case 22:case 23:return Wh(),null;case 24:return null;default:return null}}var Dc=!1,Jt=!1,VA=typeof WeakSet=="function"?WeakSet:Set,Ae=null;function Eo(r,o){var u=r.ref;if(u!==null)if(typeof u=="function")try{u(null)}catch(m){Et(r,o,m)}else u.current=null}function Mh(r,o,u){try{u()}catch(m){Et(r,o,m)}}var Ix=!1;function YA(r,o){if(Wd=ds,r=Oi(),$i(r)){if("selectionStart"in r)var u={start:r.selectionStart,end:r.selectionEnd};else e:{u=(u=r.ownerDocument)&&u.defaultView||window;var m=u.getSelection&&u.getSelection();if(m&&m.rangeCount!==0){u=m.anchorNode;var v=m.anchorOffset,x=m.focusNode;m=m.focusOffset;try{u.nodeType,x.nodeType}catch{u=null;break e}var R=0,G=-1,ee=-1,ue=0,ve=0,xe=r,ye=null;t:for(;;){for(var Te;xe!==u||v!==0&&xe.nodeType!==3||(G=R+v),xe!==x||m!==0&&xe.nodeType!==3||(ee=R+m),xe.nodeType===3&&(R+=xe.nodeValue.length),(Te=xe.firstChild)!==null;)ye=xe,xe=Te;for(;;){if(xe===r)break t;if(ye===u&&++ue===v&&(G=R),ye===x&&++ve===m&&(ee=R),(Te=xe.nextSibling)!==null)break;xe=ye,ye=xe.parentNode}xe=Te}u=G===-1||ee===-1?null:{start:G,end:ee}}else u=null}u=u||{start:0,end:0}}else u=null;for(Hd={focusedElem:r,selectionRange:u},ds=!1,Ae=o;Ae!==null;)if(o=Ae,r=o.child,(o.subtreeFlags&1028)!==0&&r!==null)r.return=o,Ae=r;else for(;Ae!==null;){o=Ae;try{var Me=o.alternate;if((o.flags&1024)!==0)switch(o.tag){case 0:case 11:case 15:break;case 1:if(Me!==null){var $e=Me.memoizedProps,Ct=Me.memoizedState,ae=o.stateNode,ne=ae.getSnapshotBeforeUpdate(o.elementType===o.type?$e:tr(o.type,$e),Ct);ae.__reactInternalSnapshotBeforeUpdate=ne}break;case 3:var oe=o.stateNode.containerInfo;oe.nodeType===1?oe.textContent="":oe.nodeType===9&&oe.documentElement&&oe.removeChild(oe.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(ke){Et(o,o.return,ke)}if(r=o.sibling,r!==null){r.return=o.return,Ae=r;break}Ae=o.return}return Me=Ix,Ix=!1,Me}function Ji(r,o,u){var m=o.updateQueue;if(m=m!==null?m.lastEffect:null,m!==null){var v=m=m.next;do{if((v.tag&r)===r){var x=v.destroy;v.destroy=void 0,x!==void 0&&Mh(o,u,x)}v=v.next}while(v!==m)}}function Fc(r,o){if(o=o.updateQueue,o=o!==null?o.lastEffect:null,o!==null){var u=o=o.next;do{if((u.tag&r)===r){var m=u.create;u.destroy=m()}u=u.next}while(u!==o)}}function Ih(r){var o=r.ref;if(o!==null){var u=r.stateNode;switch(r.tag){case 5:r=u;break;default:r=u}typeof o=="function"?o(r):o.current=r}}function Ox(r){var o=r.alternate;o!==null&&(r.alternate=null,Ox(o)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(o=r.stateNode,o!==null&&(delete o[br],delete o[Bi],delete o[Kd],delete o[RA],delete o[AA])),r.stateNode=null,r.return=null,r.dependencies=null,r.memoizedProps=null,r.memoizedState=null,r.pendingProps=null,r.stateNode=null,r.updateQueue=null}function $x(r){return r.tag===5||r.tag===3||r.tag===4}function Px(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||$x(r.return))return null;r=r.return}for(r.sibling.return=r.return,r=r.sibling;r.tag!==5&&r.tag!==6&&r.tag!==18;){if(r.flags&2||r.child===null||r.tag===4)continue e;r.child.return=r,r=r.child}if(!(r.flags&2))return r.stateNode}}function Oh(r,o,u){var m=r.tag;if(m===5||m===6)r=r.stateNode,o?u.nodeType===8?u.parentNode.insertBefore(r,o):u.insertBefore(r,o):(u.nodeType===8?(o=u.parentNode,o.insertBefore(r,u)):(o=u,o.appendChild(r)),u=u._reactRootContainer,u!=null||o.onclick!==null||(o.onclick=yc));else if(m!==4&&(r=r.child,r!==null))for(Oh(r,o,u),r=r.sibling;r!==null;)Oh(r,o,u),r=r.sibling}function $h(r,o,u){var m=r.tag;if(m===5||m===6)r=r.stateNode,o?u.insertBefore(r,o):u.appendChild(r);else if(m!==4&&(r=r.child,r!==null))for($h(r,o,u),r=r.sibling;r!==null;)$h(r,o,u),r=r.sibling}var Wt=null,nr=!1;function Es(r,o,u){for(u=u.child;u!==null;)Lx(r,o,u),u=u.sibling}function Lx(r,o,u){if(Dt&&typeof Dt.onCommitFiberUnmount=="function")try{Dt.onCommitFiberUnmount(Pr,u)}catch{}switch(u.tag){case 5:Jt||Eo(u,o);case 6:var m=Wt,v=nr;Wt=null,Es(r,o,u),Wt=m,nr=v,Wt!==null&&(nr?(r=Wt,u=u.stateNode,r.nodeType===8?r.parentNode.removeChild(u):r.removeChild(u)):Wt.removeChild(u.stateNode));break;case 18:Wt!==null&&(nr?(r=Wt,u=u.stateNode,r.nodeType===8?Yd(r.parentNode,u):r.nodeType===1&&Yd(r,u),Qn(r)):Yd(Wt,u.stateNode));break;case 4:m=Wt,v=nr,Wt=u.stateNode.containerInfo,nr=!0,Es(r,o,u),Wt=m,nr=v;break;case 0:case 11:case 14:case 15:if(!Jt&&(m=u.updateQueue,m!==null&&(m=m.lastEffect,m!==null))){v=m=m.next;do{var x=v,R=x.destroy;x=x.tag,R!==void 0&&((x&2)!==0||(x&4)!==0)&&Mh(u,o,R),v=v.next}while(v!==m)}Es(r,o,u);break;case 1:if(!Jt&&(Eo(u,o),m=u.stateNode,typeof m.componentWillUnmount=="function"))try{m.props=u.memoizedProps,m.state=u.memoizedState,m.componentWillUnmount()}catch(G){Et(u,o,G)}Es(r,o,u);break;case 21:Es(r,o,u);break;case 22:u.mode&1?(Jt=(m=Jt)||u.memoizedState!==null,Es(r,o,u),Jt=m):Es(r,o,u);break;default:Es(r,o,u)}}function qx(r){var o=r.updateQueue;if(o!==null){r.updateQueue=null;var u=r.stateNode;u===null&&(u=r.stateNode=new VA),o.forEach(function(m){var v=rM.bind(null,r,m);u.has(m)||(u.add(m),m.then(v,v))})}}function rr(r,o){var u=o.deletions;if(u!==null)for(var m=0;m<u.length;m++){var v=u[m];try{var x=r,R=o,G=R;e:for(;G!==null;){switch(G.tag){case 5:Wt=G.stateNode,nr=!1;break e;case 3:Wt=G.stateNode.containerInfo,nr=!0;break e;case 4:Wt=G.stateNode.containerInfo,nr=!0;break e}G=G.return}if(Wt===null)throw Error(n(160));Lx(x,R,v),Wt=null,nr=!1;var ee=v.alternate;ee!==null&&(ee.return=null),v.return=null}catch(ue){Et(v,o,ue)}}if(o.subtreeFlags&12854)for(o=o.child;o!==null;)Dx(o,r),o=o.sibling}function Dx(r,o){var u=r.alternate,m=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:if(rr(o,r),Sr(r),m&4){try{Ji(3,r,r.return),Fc(3,r)}catch($e){Et(r,r.return,$e)}try{Ji(5,r,r.return)}catch($e){Et(r,r.return,$e)}}break;case 1:rr(o,r),Sr(r),m&512&&u!==null&&Eo(u,u.return);break;case 5:if(rr(o,r),Sr(r),m&512&&u!==null&&Eo(u,u.return),r.flags&32){var v=r.stateNode;try{se(v,"")}catch($e){Et(r,r.return,$e)}}if(m&4&&(v=r.stateNode,v!=null)){var x=r.memoizedProps,R=u!==null?u.memoizedProps:x,G=r.type,ee=r.updateQueue;if(r.updateQueue=null,ee!==null)try{G==="input"&&x.type==="radio"&&x.name!=null&&We(v,x),Oe(G,R);var ue=Oe(G,x);for(R=0;R<ee.length;R+=2){var ve=ee[R],xe=ee[R+1];ve==="style"?Ue(v,xe):ve==="dangerouslySetInnerHTML"?Le(v,xe):ve==="children"?se(v,xe):j(v,ve,xe,ue)}switch(G){case"input":Se(v,x);break;case"textarea":me(v,x);break;case"select":var ye=v._wrapperState.wasMultiple;v._wrapperState.wasMultiple=!!x.multiple;var Te=x.value;Te!=null?ut(v,!!x.multiple,Te,!1):ye!==!!x.multiple&&(x.defaultValue!=null?ut(v,!!x.multiple,x.defaultValue,!0):ut(v,!!x.multiple,x.multiple?[]:"",!1))}v[Bi]=x}catch($e){Et(r,r.return,$e)}}break;case 6:if(rr(o,r),Sr(r),m&4){if(r.stateNode===null)throw Error(n(162));v=r.stateNode,x=r.memoizedProps;try{v.nodeValue=x}catch($e){Et(r,r.return,$e)}}break;case 3:if(rr(o,r),Sr(r),m&4&&u!==null&&u.memoizedState.isDehydrated)try{Qn(o.containerInfo)}catch($e){Et(r,r.return,$e)}break;case 4:rr(o,r),Sr(r);break;case 13:rr(o,r),Sr(r),v=r.child,v.flags&8192&&(x=v.memoizedState!==null,v.stateNode.isHidden=x,!x||v.alternate!==null&&v.alternate.memoizedState!==null||(qh=dt())),m&4&&qx(r);break;case 22:if(ve=u!==null&&u.memoizedState!==null,r.mode&1?(Jt=(ue=Jt)||ve,rr(o,r),Jt=ue):rr(o,r),Sr(r),m&8192){if(ue=r.memoizedState!==null,(r.stateNode.isHidden=ue)&&!ve&&(r.mode&1)!==0)for(Ae=r,ve=r.child;ve!==null;){for(xe=Ae=ve;Ae!==null;){switch(ye=Ae,Te=ye.child,ye.tag){case 0:case 11:case 14:case 15:Ji(4,ye,ye.return);break;case 1:Eo(ye,ye.return);var Me=ye.stateNode;if(typeof Me.componentWillUnmount=="function"){m=ye,u=ye.return;try{o=m,Me.props=o.memoizedProps,Me.state=o.memoizedState,Me.componentWillUnmount()}catch($e){Et(m,u,$e)}}break;case 5:Eo(ye,ye.return);break;case 22:if(ye.memoizedState!==null){Bx(xe);continue}}Te!==null?(Te.return=ye,Ae=Te):Bx(xe)}ve=ve.sibling}e:for(ve=null,xe=r;;){if(xe.tag===5){if(ve===null){ve=xe;try{v=xe.stateNode,ue?(x=v.style,typeof x.setProperty=="function"?x.setProperty("display","none","important"):x.display="none"):(G=xe.stateNode,ee=xe.memoizedProps.style,R=ee!=null&&ee.hasOwnProperty("display")?ee.display:null,G.style.display=Ee("display",R))}catch($e){Et(r,r.return,$e)}}}else if(xe.tag===6){if(ve===null)try{xe.stateNode.nodeValue=ue?"":xe.memoizedProps}catch($e){Et(r,r.return,$e)}}else if((xe.tag!==22&&xe.tag!==23||xe.memoizedState===null||xe===r)&&xe.child!==null){xe.child.return=xe,xe=xe.child;continue}if(xe===r)break e;for(;xe.sibling===null;){if(xe.return===null||xe.return===r)break e;ve===xe&&(ve=null),xe=xe.return}ve===xe&&(ve=null),xe.sibling.return=xe.return,xe=xe.sibling}}break;case 19:rr(o,r),Sr(r),m&4&&qx(r);break;case 21:break;default:rr(o,r),Sr(r)}}function Sr(r){var o=r.flags;if(o&2){try{e:{for(var u=r.return;u!==null;){if($x(u)){var m=u;break e}u=u.return}throw Error(n(160))}switch(m.tag){case 5:var v=m.stateNode;m.flags&32&&(se(v,""),m.flags&=-33);var x=Px(r);$h(r,x,v);break;case 3:case 4:var R=m.stateNode.containerInfo,G=Px(r);Oh(r,G,R);break;default:throw Error(n(161))}}catch(ee){Et(r,r.return,ee)}r.flags&=-3}o&4096&&(r.flags&=-4097)}function KA(r,o,u){Ae=r,Fx(r)}function Fx(r,o,u){for(var m=(r.mode&1)!==0;Ae!==null;){var v=Ae,x=v.child;if(v.tag===22&&m){var R=v.memoizedState!==null||Dc;if(!R){var G=v.alternate,ee=G!==null&&G.memoizedState!==null||Jt;G=Dc;var ue=Jt;if(Dc=R,(Jt=ee)&&!ue)for(Ae=v;Ae!==null;)R=Ae,ee=R.child,R.tag===22&&R.memoizedState!==null?Ux(v):ee!==null?(ee.return=R,Ae=ee):Ux(v);for(;x!==null;)Ae=x,Fx(x),x=x.sibling;Ae=v,Dc=G,Jt=ue}zx(r)}else(v.subtreeFlags&8772)!==0&&x!==null?(x.return=v,Ae=x):zx(r)}}function zx(r){for(;Ae!==null;){var o=Ae;if((o.flags&8772)!==0){var u=o.alternate;try{if((o.flags&8772)!==0)switch(o.tag){case 0:case 11:case 15:Jt||Fc(5,o);break;case 1:var m=o.stateNode;if(o.flags&4&&!Jt)if(u===null)m.componentDidMount();else{var v=o.elementType===o.type?u.memoizedProps:tr(o.type,u.memoizedProps);m.componentDidUpdate(v,u.memoizedState,m.__reactInternalSnapshotBeforeUpdate)}var x=o.updateQueue;x!==null&&B0(o,x,m);break;case 3:var R=o.updateQueue;if(R!==null){if(u=null,o.child!==null)switch(o.child.tag){case 5:u=o.child.stateNode;break;case 1:u=o.child.stateNode}B0(o,R,u)}break;case 5:var G=o.stateNode;if(u===null&&o.flags&4){u=G;var ee=o.memoizedProps;switch(o.type){case"button":case"input":case"select":case"textarea":ee.autoFocus&&u.focus();break;case"img":ee.src&&(u.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 ve=ue.memoizedState;if(ve!==null){var xe=ve.dehydrated;xe!==null&&Qn(xe)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}Jt||o.flags&512&&Ih(o)}catch(ye){Et(o,o.return,ye)}}if(o===r){Ae=null;break}if(u=o.sibling,u!==null){u.return=o.return,Ae=u;break}Ae=o.return}}function Bx(r){for(;Ae!==null;){var o=Ae;if(o===r){Ae=null;break}var u=o.sibling;if(u!==null){u.return=o.return,Ae=u;break}Ae=o.return}}function Ux(r){for(;Ae!==null;){var o=Ae;try{switch(o.tag){case 0:case 11:case 15:var u=o.return;try{Fc(4,o)}catch(ee){Et(o,u,ee)}break;case 1:var m=o.stateNode;if(typeof m.componentDidMount=="function"){var v=o.return;try{m.componentDidMount()}catch(ee){Et(o,v,ee)}}var x=o.return;try{Ih(o)}catch(ee){Et(o,x,ee)}break;case 5:var R=o.return;try{Ih(o)}catch(ee){Et(o,R,ee)}}}catch(ee){Et(o,o.return,ee)}if(o===r){Ae=null;break}var G=o.sibling;if(G!==null){G.return=o.return,Ae=G;break}Ae=o.return}}var XA=Math.ceil,zc=C.ReactCurrentDispatcher,Ph=C.ReactCurrentOwner,Bn=C.ReactCurrentBatchConfig,tt=0,zt=null,Rt=null,Ht=0,Tn=0,jo=bs(0),Lt=0,el=null,wa=0,Bc=0,Lh=0,tl=null,pn=null,qh=0,Co=1/0,Jr=null,Uc=!1,Dh=null,js=null,Wc=!1,Cs=null,Hc=0,nl=0,Fh=null,Gc=-1,Vc=0;function sn(){return(tt&6)!==0?dt():Gc!==-1?Gc:Gc=dt()}function Ts(r){return(r.mode&1)===0?1:(tt&2)!==0&&Ht!==0?Ht&-Ht:IA.transition!==null?(Vc===0&&(Vc=Qs()),Vc):(r=Ze,r!==0||(r=window.event,r=r===void 0?16:gi(r.type)),r)}function sr(r,o,u,m){if(50<nl)throw nl=0,Fh=null,Error(n(185));Zs(r,u,m),((tt&2)===0||r!==zt)&&(r===zt&&((tt&2)===0&&(Bc|=u),Lt===4&&Rs(r,Ht)),mn(r,m),u===1&&tt===0&&(o.mode&1)===0&&(Co=dt()+500,bc&&_s()))}function mn(r,o){var u=r.callbackNode;Td(r,o);var m=Pn(r,r===zt?Ht:0);if(m===0)u!==null&&Or(u),r.callbackNode=null,r.callbackPriority=0;else if(o=m&-m,r.callbackPriority!==o){if(u!=null&&Or(u),o===1)r.tag===0?MA(Hx.bind(null,r)):R0(Hx.bind(null,r)),CA(function(){(tt&6)===0&&_s()}),u=null;else{switch(di(m)){case 1:u=$n;break;case 4:u=Ga;break;case 16:u=$r;break;case 536870912:u=Va;break;default:u=$r}u=Jx(u,Wx.bind(null,r))}r.callbackPriority=o,r.callbackNode=u}}function Wx(r,o){if(Gc=-1,Vc=0,(tt&6)!==0)throw Error(n(327));var u=r.callbackNode;if(To()&&r.callbackNode!==u)return null;var m=Pn(r,r===zt?Ht:0);if(m===0)return null;if((m&30)!==0||(m&r.expiredLanes)!==0||o)o=Yc(r,m);else{o=m;var v=tt;tt|=2;var x=Vx();(zt!==r||Ht!==o)&&(Jr=null,Co=dt()+500,ba(r,o));do try{JA();break}catch(G){Gx(r,G)}while(!0);sh(),zc.current=x,tt=v,Rt!==null?o=0:(zt=null,Ht=0,o=Lt)}if(o!==0){if(o===2&&(v=Ln(r),v!==0&&(m=v,o=zh(r,v))),o===1)throw u=el,ba(r,0),Rs(r,m),mn(r,dt()),u;if(o===6)Rs(r,m);else{if(v=r.current.alternate,(m&30)===0&&!QA(v)&&(o=Yc(r,m),o===2&&(x=Ln(r),x!==0&&(m=x,o=zh(r,x))),o===1))throw u=el,ba(r,0),Rs(r,m),mn(r,dt()),u;switch(r.finishedWork=v,r.finishedLanes=m,o){case 0:case 1:throw Error(n(345));case 2:ka(r,pn,Jr);break;case 3:if(Rs(r,m),(m&130023424)===m&&(o=qh+500-dt(),10<o)){if(Pn(r,0)!==0)break;if(v=r.suspendedLanes,(v&m)!==m){sn(),r.pingedLanes|=r.suspendedLanes&v;break}r.timeoutHandle=Vd(ka.bind(null,r,pn,Jr),o);break}ka(r,pn,Jr);break;case 4:if(Rs(r,m),(m&4194240)===m)break;for(o=r.eventTimes,v=-1;0<m;){var R=31-on(m);x=1<<R,R=o[R],R>v&&(v=R),m&=~x}if(m=v,m=dt()-m,m=(120>m?120:480>m?480:1080>m?1080:1920>m?1920:3e3>m?3e3:4320>m?4320:1960*XA(m/1960))-m,10<m){r.timeoutHandle=Vd(ka.bind(null,r,pn,Jr),m);break}ka(r,pn,Jr);break;case 5:ka(r,pn,Jr);break;default:throw Error(n(329))}}}return mn(r,dt()),r.callbackNode===u?Wx.bind(null,r):null}function zh(r,o){var u=tl;return r.current.memoizedState.isDehydrated&&(ba(r,o).flags|=256),r=Yc(r,o),r!==2&&(o=pn,pn=u,o!==null&&Bh(o)),r}function Bh(r){pn===null?pn=r:pn.push.apply(pn,r)}function QA(r){for(var o=r;;){if(o.flags&16384){var u=o.updateQueue;if(u!==null&&(u=u.stores,u!==null))for(var m=0;m<u.length;m++){var v=u[m],x=v.getSnapshot;v=v.value;try{if(!Nn(x(),v))return!1}catch{return!1}}}if(u=o.child,o.subtreeFlags&16384&&u!==null)u.return=o,o=u;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 Rs(r,o){for(o&=~Lh,o&=~Bc,r.suspendedLanes|=o,r.pingedLanes&=~o,r=r.expirationTimes;0<o;){var u=31-on(o),m=1<<u;r[u]=-1,o&=~m}}function Hx(r){if((tt&6)!==0)throw Error(n(327));To();var o=Pn(r,0);if((o&1)===0)return mn(r,dt()),null;var u=Yc(r,o);if(r.tag!==0&&u===2){var m=Ln(r);m!==0&&(o=m,u=zh(r,m))}if(u===1)throw u=el,ba(r,0),Rs(r,o),mn(r,dt()),u;if(u===6)throw Error(n(345));return r.finishedWork=r.current.alternate,r.finishedLanes=o,ka(r,pn,Jr),mn(r,dt()),null}function Uh(r,o){var u=tt;tt|=1;try{return r(o)}finally{tt=u,tt===0&&(Co=dt()+500,bc&&_s())}}function xa(r){Cs!==null&&Cs.tag===0&&(tt&6)===0&&To();var o=tt;tt|=1;var u=Bn.transition,m=Ze;try{if(Bn.transition=null,Ze=1,r)return r()}finally{Ze=m,Bn.transition=u,tt=o,(tt&6)===0&&_s()}}function Wh(){Tn=jo.current,pt(jo)}function ba(r,o){r.finishedWork=null,r.finishedLanes=0;var u=r.timeoutHandle;if(u!==-1&&(r.timeoutHandle=-1,jA(u)),Rt!==null)for(u=Rt.return;u!==null;){var m=u;switch(Jd(m),m.tag){case 1:m=m.type.childContextTypes,m!=null&&wc();break;case 3:So(),pt(dn),pt(Xt),hh();break;case 5:uh(m);break;case 4:So();break;case 13:pt(bt);break;case 19:pt(bt);break;case 10:ah(m.type._context);break;case 22:case 23:Wh()}u=u.return}if(zt=r,Rt=r=As(r.current,null),Ht=Tn=o,Lt=0,el=null,Lh=Bc=wa=0,pn=tl=null,ga!==null){for(o=0;o<ga.length;o++)if(u=ga[o],m=u.interleaved,m!==null){u.interleaved=null;var v=m.next,x=u.pending;if(x!==null){var R=x.next;x.next=v,m.next=R}u.pending=m}ga=null}return r}function Gx(r,o){do{var u=Rt;try{if(sh(),Ac.current=$c,Mc){for(var m=kt.memoizedState;m!==null;){var v=m.queue;v!==null&&(v.pending=null),m=m.next}Mc=!1}if(va=0,Ft=Pt=kt=null,Yi=!1,Ki=0,Ph.current=null,u===null||u.return===null){Lt=1,el=o,Rt=null;break}e:{var x=r,R=u.return,G=u,ee=o;if(o=Ht,G.flags|=32768,ee!==null&&typeof ee=="object"&&typeof ee.then=="function"){var ue=ee,ve=G,xe=ve.tag;if((ve.mode&1)===0&&(xe===0||xe===11||xe===15)){var ye=ve.alternate;ye?(ve.updateQueue=ye.updateQueue,ve.memoizedState=ye.memoizedState,ve.lanes=ye.lanes):(ve.updateQueue=null,ve.memoizedState=null)}var Te=yx(R);if(Te!==null){Te.flags&=-257,vx(Te,R,G,x,o),Te.mode&1&&gx(x,ue,o),o=Te,ee=ue;var Me=o.updateQueue;if(Me===null){var $e=new Set;$e.add(ee),o.updateQueue=$e}else Me.add(ee);break e}else{if((o&1)===0){gx(x,ue,o),Hh();break e}ee=Error(n(426))}}else if(gt&&G.mode&1){var Ct=yx(R);if(Ct!==null){(Ct.flags&65536)===0&&(Ct.flags|=256),vx(Ct,R,G,x,o),nh(No(ee,G));break e}}x=ee=No(ee,G),Lt!==4&&(Lt=2),tl===null?tl=[x]:tl.push(x),x=R;do{switch(x.tag){case 3:x.flags|=65536,o&=-o,x.lanes|=o;var ae=px(x,ee,o);z0(x,ae);break e;case 1:G=ee;var ne=x.type,oe=x.stateNode;if((x.flags&128)===0&&(typeof ne.getDerivedStateFromError=="function"||oe!==null&&typeof oe.componentDidCatch=="function"&&(js===null||!js.has(oe)))){x.flags|=65536,o&=-o,x.lanes|=o;var ke=mx(x,G,o);z0(x,ke);break e}}x=x.return}while(x!==null)}Kx(u)}catch(Pe){o=Pe,Rt===u&&u!==null&&(Rt=u=u.return);continue}break}while(!0)}function Vx(){var r=zc.current;return zc.current=$c,r===null?$c:r}function Hh(){(Lt===0||Lt===3||Lt===2)&&(Lt=4),zt===null||(wa&268435455)===0&&(Bc&268435455)===0||Rs(zt,Ht)}function Yc(r,o){var u=tt;tt|=2;var m=Vx();(zt!==r||Ht!==o)&&(Jr=null,ba(r,o));do try{ZA();break}catch(v){Gx(r,v)}while(!0);if(sh(),tt=u,zc.current=m,Rt!==null)throw Error(n(261));return zt=null,Ht=0,Lt}function ZA(){for(;Rt!==null;)Yx(Rt)}function JA(){for(;Rt!==null&&!Vs();)Yx(Rt)}function Yx(r){var o=Zx(r.alternate,r,Tn);r.memoizedProps=r.pendingProps,o===null?Kx(r):Rt=o,Ph.current=null}function Kx(r){var o=r;do{var u=o.alternate;if(r=o.return,(o.flags&32768)===0){if(u=HA(u,o,Tn),u!==null){Rt=u;return}}else{if(u=GA(u,o),u!==null){u.flags&=32767,Rt=u;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 ka(r,o,u){var m=Ze,v=Bn.transition;try{Bn.transition=null,Ze=1,eM(r,o,u,m)}finally{Bn.transition=v,Ze=m}return null}function eM(r,o,u,m){do To();while(Cs!==null);if((tt&6)!==0)throw Error(n(327));u=r.finishedWork;var v=r.finishedLanes;if(u===null)return null;if(r.finishedWork=null,r.finishedLanes=0,u===r.current)throw Error(n(177));r.callbackNode=null,r.callbackPriority=0;var x=u.lanes|u.childLanes;if(Xl(r,x),r===zt&&(Rt=zt=null,Ht=0),(u.subtreeFlags&2064)===0&&(u.flags&2064)===0||Wc||(Wc=!0,Jx($r,function(){return To(),null})),x=(u.flags&15990)!==0,(u.subtreeFlags&15990)!==0||x){x=Bn.transition,Bn.transition=null;var R=Ze;Ze=1;var G=tt;tt|=4,Ph.current=null,YA(r,u),Dx(u,r),dc(Hd),ds=!!Wd,Hd=Wd=null,r.current=u,KA(u),ls(),tt=G,Ze=R,Bn.transition=x}else r.current=u;if(Wc&&(Wc=!1,Cs=r,Hc=v),x=r.pendingLanes,x===0&&(js=null),Ks(u.stateNode),mn(r,dt()),o!==null)for(m=r.onRecoverableError,u=0;u<o.length;u++)v=o[u],m(v.value,{componentStack:v.stack,digest:v.digest});if(Uc)throw Uc=!1,r=Dh,Dh=null,r;return(Hc&1)!==0&&r.tag!==0&&To(),x=r.pendingLanes,(x&1)!==0?r===Fh?nl++:(nl=0,Fh=r):nl=0,_s(),null}function To(){if(Cs!==null){var r=di(Hc),o=Bn.transition,u=Ze;try{if(Bn.transition=null,Ze=16>r?16:r,Cs===null)var m=!1;else{if(r=Cs,Cs=null,Hc=0,(tt&6)!==0)throw Error(n(331));var v=tt;for(tt|=4,Ae=r.current;Ae!==null;){var x=Ae,R=x.child;if((Ae.flags&16)!==0){var G=x.deletions;if(G!==null){for(var ee=0;ee<G.length;ee++){var ue=G[ee];for(Ae=ue;Ae!==null;){var ve=Ae;switch(ve.tag){case 0:case 11:case 15:Ji(8,ve,x)}var xe=ve.child;if(xe!==null)xe.return=ve,Ae=xe;else for(;Ae!==null;){ve=Ae;var ye=ve.sibling,Te=ve.return;if(Ox(ve),ve===ue){Ae=null;break}if(ye!==null){ye.return=Te,Ae=ye;break}Ae=Te}}}var Me=x.alternate;if(Me!==null){var $e=Me.child;if($e!==null){Me.child=null;do{var Ct=$e.sibling;$e.sibling=null,$e=Ct}while($e!==null)}}Ae=x}}if((x.subtreeFlags&2064)!==0&&R!==null)R.return=x,Ae=R;else e:for(;Ae!==null;){if(x=Ae,(x.flags&2048)!==0)switch(x.tag){case 0:case 11:case 15:Ji(9,x,x.return)}var ae=x.sibling;if(ae!==null){ae.return=x.return,Ae=ae;break e}Ae=x.return}}var ne=r.current;for(Ae=ne;Ae!==null;){R=Ae;var oe=R.child;if((R.subtreeFlags&2064)!==0&&oe!==null)oe.return=R,Ae=oe;else e:for(R=ne;Ae!==null;){if(G=Ae,(G.flags&2048)!==0)try{switch(G.tag){case 0:case 11:case 15:Fc(9,G)}}catch(Pe){Et(G,G.return,Pe)}if(G===R){Ae=null;break e}var ke=G.sibling;if(ke!==null){ke.return=G.return,Ae=ke;break e}Ae=G.return}}if(tt=v,_s(),Dt&&typeof Dt.onPostCommitFiberRoot=="function")try{Dt.onPostCommitFiberRoot(Pr,r)}catch{}m=!0}return m}finally{Ze=u,Bn.transition=o}}return!1}function Xx(r,o,u){o=No(u,o),o=px(r,o,1),r=Ns(r,o,1),o=sn(),r!==null&&(Zs(r,1,o),mn(r,o))}function Et(r,o,u){if(r.tag===3)Xx(r,r,u);else for(;o!==null;){if(o.tag===3){Xx(o,r,u);break}else if(o.tag===1){var m=o.stateNode;if(typeof o.type.getDerivedStateFromError=="function"||typeof m.componentDidCatch=="function"&&(js===null||!js.has(m))){r=No(u,r),r=mx(o,r,1),o=Ns(o,r,1),r=sn(),o!==null&&(Zs(o,1,r),mn(o,r));break}}o=o.return}}function tM(r,o,u){var m=r.pingCache;m!==null&&m.delete(o),o=sn(),r.pingedLanes|=r.suspendedLanes&u,zt===r&&(Ht&u)===u&&(Lt===4||Lt===3&&(Ht&130023424)===Ht&&500>dt()-qh?ba(r,0):Lh|=u),mn(r,o)}function Qx(r,o){o===0&&((r.mode&1)===0?o=1:(o=St,St<<=1,(St&130023424)===0&&(St=4194304)));var u=sn();r=Xr(r,o),r!==null&&(Zs(r,o,u),mn(r,u))}function nM(r){var o=r.memoizedState,u=0;o!==null&&(u=o.retryLane),Qx(r,u)}function rM(r,o){var u=0;switch(r.tag){case 13:var m=r.stateNode,v=r.memoizedState;v!==null&&(u=v.retryLane);break;case 19:m=r.stateNode;break;default:throw Error(n(314))}m!==null&&m.delete(o),Qx(r,u)}var Zx;Zx=function(r,o,u){if(r!==null)if(r.memoizedProps!==o.pendingProps||dn.current)fn=!0;else{if((r.lanes&u)===0&&(o.flags&128)===0)return fn=!1,WA(r,o,u);fn=(r.flags&131072)!==0}else fn=!1,gt&&(o.flags&1048576)!==0&&A0(o,_c,o.index);switch(o.lanes=0,o.tag){case 2:var m=o.type;qc(r,o),r=o.pendingProps;var v=yo(o,Xt.current);_o(o,u),v=mh(null,o,m,r,v,u);var x=gh();return o.flags|=1,typeof v=="object"&&v!==null&&typeof v.render=="function"&&v.$$typeof===void 0?(o.tag=1,o.memoizedState=null,o.updateQueue=null,hn(m)?(x=!0,xc(o)):x=!1,o.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,lh(o),v.updater=Pc,o.stateNode=v,v._reactInternals=o,kh(o,m,r,u),o=Eh(null,o,m,!0,x,u)):(o.tag=0,gt&&x&&Zd(o),rn(null,o,v,u),o=o.child),o;case 16:m=o.elementType;e:{switch(qc(r,o),r=o.pendingProps,v=m._init,m=v(m._payload),o.type=m,v=o.tag=aM(m),r=tr(m,r),v){case 0:o=Nh(null,o,m,r,u);break e;case 1:o=Sx(null,o,m,r,u);break e;case 11:o=wx(null,o,m,r,u);break e;case 14:o=xx(null,o,m,tr(m.type,r),u);break e}throw Error(n(306,m,""))}return o;case 0:return m=o.type,v=o.pendingProps,v=o.elementType===m?v:tr(m,v),Nh(r,o,m,v,u);case 1:return m=o.type,v=o.pendingProps,v=o.elementType===m?v:tr(m,v),Sx(r,o,m,v,u);case 3:e:{if(Nx(o),r===null)throw Error(n(387));m=o.pendingProps,x=o.memoizedState,v=x.element,F0(r,o),Tc(o,m,null,u);var R=o.memoizedState;if(m=R.element,x.isDehydrated)if(x={element:m,isDehydrated:!1,cache:R.cache,pendingSuspenseBoundaries:R.pendingSuspenseBoundaries,transitions:R.transitions},o.updateQueue.baseState=x,o.memoizedState=x,o.flags&256){v=No(Error(n(423)),o),o=Ex(r,o,m,u,v);break e}else if(m!==v){v=No(Error(n(424)),o),o=Ex(r,o,m,u,v);break e}else for(Cn=xs(o.stateNode.containerInfo.firstChild),jn=o,gt=!0,er=null,u=q0(o,null,m,u),o.child=u;u;)u.flags=u.flags&-3|4096,u=u.sibling;else{if(xo(),m===v){o=Zr(r,o,u);break e}rn(r,o,m,u)}o=o.child}return o;case 5:return U0(o),r===null&&th(o),m=o.type,v=o.pendingProps,x=r!==null?r.memoizedProps:null,R=v.children,Gd(m,v)?R=null:x!==null&&Gd(m,x)&&(o.flags|=32),_x(r,o),rn(r,o,R,u),o.child;case 6:return r===null&&th(o),null;case 13:return jx(r,o,u);case 4:return ch(o,o.stateNode.containerInfo),m=o.pendingProps,r===null?o.child=bo(o,null,m,u):rn(r,o,m,u),o.child;case 11:return m=o.type,v=o.pendingProps,v=o.elementType===m?v:tr(m,v),wx(r,o,m,v,u);case 7:return rn(r,o,o.pendingProps,u),o.child;case 8:return rn(r,o,o.pendingProps.children,u),o.child;case 12:return rn(r,o,o.pendingProps.children,u),o.child;case 10:e:{if(m=o.type._context,v=o.pendingProps,x=o.memoizedProps,R=v.value,ht(Ec,m._currentValue),m._currentValue=R,x!==null)if(Nn(x.value,R)){if(x.children===v.children&&!dn.current){o=Zr(r,o,u);break e}}else for(x=o.child,x!==null&&(x.return=o);x!==null;){var G=x.dependencies;if(G!==null){R=x.child;for(var ee=G.firstContext;ee!==null;){if(ee.context===m){if(x.tag===1){ee=Qr(-1,u&-u),ee.tag=2;var ue=x.updateQueue;if(ue!==null){ue=ue.shared;var ve=ue.pending;ve===null?ee.next=ee:(ee.next=ve.next,ve.next=ee),ue.pending=ee}}x.lanes|=u,ee=x.alternate,ee!==null&&(ee.lanes|=u),oh(x.return,u,o),G.lanes|=u;break}ee=ee.next}}else if(x.tag===10)R=x.type===o.type?null:x.child;else if(x.tag===18){if(R=x.return,R===null)throw Error(n(341));R.lanes|=u,G=R.alternate,G!==null&&(G.lanes|=u),oh(R,u,o),R=x.sibling}else R=x.child;if(R!==null)R.return=x;else for(R=x;R!==null;){if(R===o){R=null;break}if(x=R.sibling,x!==null){x.return=R.return,R=x;break}R=R.return}x=R}rn(r,o,v.children,u),o=o.child}return o;case 9:return v=o.type,m=o.pendingProps.children,_o(o,u),v=Fn(v),m=m(v),o.flags|=1,rn(r,o,m,u),o.child;case 14:return m=o.type,v=tr(m,o.pendingProps),v=tr(m.type,v),xx(r,o,m,v,u);case 15:return bx(r,o,o.type,o.pendingProps,u);case 17:return m=o.type,v=o.pendingProps,v=o.elementType===m?v:tr(m,v),qc(r,o),o.tag=1,hn(m)?(r=!0,xc(o)):r=!1,_o(o,u),hx(o,m,v),kh(o,m,v,u),Eh(null,o,m,!0,r,u);case 19:return Tx(r,o,u);case 22:return kx(r,o,u)}throw Error(n(156,o.tag))};function Jx(r,o){return Wa(r,o)}function sM(r,o,u,m){this.tag=r,this.key=u,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 Un(r,o,u,m){return new sM(r,o,u,m)}function Gh(r){return r=r.prototype,!(!r||!r.isReactComponent)}function aM(r){if(typeof r=="function")return Gh(r)?1:0;if(r!=null){if(r=r.$$typeof,r===H)return 11;if(r===K)return 14}return 2}function As(r,o){var u=r.alternate;return u===null?(u=Un(r.tag,o,r.key,r.mode),u.elementType=r.elementType,u.type=r.type,u.stateNode=r.stateNode,u.alternate=r,r.alternate=u):(u.pendingProps=o,u.type=r.type,u.flags=0,u.subtreeFlags=0,u.deletions=null),u.flags=r.flags&14680064,u.childLanes=r.childLanes,u.lanes=r.lanes,u.child=r.child,u.memoizedProps=r.memoizedProps,u.memoizedState=r.memoizedState,u.updateQueue=r.updateQueue,o=r.dependencies,u.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext},u.sibling=r.sibling,u.index=r.index,u.ref=r.ref,u}function Kc(r,o,u,m,v,x){var R=2;if(m=r,typeof r=="function")Gh(r)&&(R=1);else if(typeof r=="string")R=5;else e:switch(r){case I:return _a(u.children,v,x,o);case F:R=8,v|=8;break;case O:return r=Un(12,u,o,v|2),r.elementType=O,r.lanes=x,r;case X:return r=Un(13,u,o,v),r.elementType=X,r.lanes=x,r;case T:return r=Un(19,u,o,v),r.elementType=T,r.lanes=x,r;case te:return Xc(u,v,x,o);default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case A:R=10;break e;case L:R=9;break e;case H:R=11;break e;case K:R=14;break e;case D:R=16,m=null;break e}throw Error(n(130,r==null?r:typeof r,""))}return o=Un(R,u,o,v),o.elementType=r,o.type=m,o.lanes=x,o}function _a(r,o,u,m){return r=Un(7,r,m,o),r.lanes=u,r}function Xc(r,o,u,m){return r=Un(22,r,m,o),r.elementType=te,r.lanes=u,r.stateNode={isHidden:!1},r}function Vh(r,o,u){return r=Un(6,r,null,o),r.lanes=u,r}function Yh(r,o,u){return o=Un(4,r.children!==null?r.children:[],r.key,o),o.lanes=u,o.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},o}function oM(r,o,u,m,v){this.tag=o,this.containerInfo=r,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=ui(0),this.expirationTimes=ui(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ui(0),this.identifierPrefix=m,this.onRecoverableError=v,this.mutableSourceEagerHydrationData=null}function Kh(r,o,u,m,v,x,R,G,ee){return r=new oM(r,o,u,G,ee),o===1?(o=1,x===!0&&(o|=8)):o=0,x=Un(3,null,null,o),r.current=x,x.stateNode=r,x.memoizedState={element:m,isDehydrated:u,cache:null,transitions:null,pendingSuspenseBoundaries:null},lh(x),r}function iM(r,o,u){var m=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:$,key:m==null?null:""+m,children:r,containerInfo:o,implementation:u}}function eb(r){if(!r)return ks;r=r._reactInternals;e:{if(On(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 u=r.type;if(hn(u))return C0(r,u,o)}return o}function tb(r,o,u,m,v,x,R,G,ee){return r=Kh(u,m,!0,r,v,x,R,G,ee),r.context=eb(null),u=r.current,m=sn(),v=Ts(u),x=Qr(m,v),x.callback=o??null,Ns(u,x,v),r.current.lanes=v,Zs(r,v,m),mn(r,m),r}function Qc(r,o,u,m){var v=o.current,x=sn(),R=Ts(v);return u=eb(u),o.context===null?o.context=u:o.pendingContext=u,o=Qr(x,R),o.payload={element:r},m=m===void 0?null:m,m!==null&&(o.callback=m),r=Ns(v,o,R),r!==null&&(sr(r,v,R,x),Cc(r,v,R)),R}function Zc(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 nb(r,o){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var u=r.retryLane;r.retryLane=u!==0&&u<o?u:o}}function Xh(r,o){nb(r,o),(r=r.alternate)&&nb(r,o)}function lM(){return null}var rb=typeof reportError=="function"?reportError:function(r){console.error(r)};function Qh(r){this._internalRoot=r}Jc.prototype.render=Qh.prototype.render=function(r){var o=this._internalRoot;if(o===null)throw Error(n(409));Qc(r,o,null,null)},Jc.prototype.unmount=Qh.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var o=r.containerInfo;xa(function(){Qc(null,r,null,null)}),o[Gr]=null}};function Jc(r){this._internalRoot=r}Jc.prototype.unstable_scheduleHydration=function(r){if(r){var o=fi();r={blockedOn:null,target:r,priority:o};for(var u=0;u<ln.length&&o!==0&&o<ln[u].priority;u++);ln.splice(u,0,r),u===0&&Jl(r)}};function Zh(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function eu(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11&&(r.nodeType!==8||r.nodeValue!==" react-mount-point-unstable "))}function sb(){}function cM(r,o,u,m,v){if(v){if(typeof m=="function"){var x=m;m=function(){var ue=Zc(R);x.call(ue)}}var R=tb(o,m,r,0,null,!1,!1,"",sb);return r._reactRootContainer=R,r[Gr]=R.current,mt(r.nodeType===8?r.parentNode:r),xa(),R}for(;v=r.lastChild;)r.removeChild(v);if(typeof m=="function"){var G=m;m=function(){var ue=Zc(ee);G.call(ue)}}var ee=Kh(r,0,!1,null,null,!1,!1,"",sb);return r._reactRootContainer=ee,r[Gr]=ee.current,mt(r.nodeType===8?r.parentNode:r),xa(function(){Qc(o,ee,u,m)}),ee}function tu(r,o,u,m,v){var x=u._reactRootContainer;if(x){var R=x;if(typeof v=="function"){var G=v;v=function(){var ee=Zc(R);G.call(ee)}}Qc(o,R,r,v)}else R=cM(u,o,r,v,m);return Zc(R)}hi=function(r){switch(r.tag){case 3:var o=r.stateNode;if(o.current.memoizedState.isDehydrated){var u=Xs(o.pendingLanes);u!==0&&(Ka(o,u|1),mn(o,dt()),(tt&6)===0&&(Co=dt()+500,_s()))}break;case 13:xa(function(){var m=Xr(r,1);if(m!==null){var v=sn();sr(m,r,1,v)}}),Xh(r,1)}},us=function(r){if(r.tag===13){var o=Xr(r,134217728);if(o!==null){var u=sn();sr(o,r,134217728,u)}Xh(r,134217728)}},Xa=function(r){if(r.tag===13){var o=Ts(r),u=Xr(r,o);if(u!==null){var m=sn();sr(u,r,o,m)}Xh(r,o)}},fi=function(){return Ze},pi=function(r,o){var u=Ze;try{return Ze=r,o()}finally{Ze=u}},xt=function(r,o,u){switch(o){case"input":if(Se(r,u),o=u.name,u.type==="radio"&&o!=null){for(u=r;u.parentNode;)u=u.parentNode;for(u=u.querySelectorAll("input[name="+JSON.stringify(""+o)+'][type="radio"]'),o=0;o<u.length;o++){var m=u[o];if(m!==r&&m.form===r.form){var v=vc(m);if(!v)throw Error(n(90));ce(m),Se(m,v)}}}break;case"textarea":me(r,u);break;case"select":o=u.value,o!=null&&ut(r,!!u.multiple,o,!1)}},Fa=Uh,wn=xa;var uM={usingClientEntryPoint:!1,Events:[Ui,mo,vc,qa,Da,Uh]},rl={findFiberByHostInstance:ha,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},dM={bundleType:rl.bundleType,version:rl.version,rendererPackageName:rl.rendererPackageName,rendererConfig:rl.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:C.ReactCurrentDispatcher,findHostInstanceByFiber:function(r){return r=Ir(r),r===null?null:r.stateNode},findFiberByHostInstance:rl.findFiberByHostInstance||lM,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 nu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!nu.isDisabled&&nu.supportsFiber)try{Pr=nu.inject(dM),Dt=nu}catch{}}return gn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=uM,gn.createPortal=function(r,o){var u=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Zh(o))throw Error(n(200));return iM(r,o,null,u)},gn.createRoot=function(r,o){if(!Zh(r))throw Error(n(299));var u=!1,m="",v=rb;return o!=null&&(o.unstable_strictMode===!0&&(u=!0),o.identifierPrefix!==void 0&&(m=o.identifierPrefix),o.onRecoverableError!==void 0&&(v=o.onRecoverableError)),o=Kh(r,1,!1,null,null,u,!1,m,v),r[Gr]=o.current,mt(r.nodeType===8?r.parentNode:r),new Qh(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=Ir(o),r=r===null?null:r.stateNode,r},gn.flushSync=function(r){return xa(r)},gn.hydrate=function(r,o,u){if(!eu(o))throw Error(n(200));return tu(null,r,o,!0,u)},gn.hydrateRoot=function(r,o,u){if(!Zh(r))throw Error(n(405));var m=u!=null&&u.hydratedSources||null,v=!1,x="",R=rb;if(u!=null&&(u.unstable_strictMode===!0&&(v=!0),u.identifierPrefix!==void 0&&(x=u.identifierPrefix),u.onRecoverableError!==void 0&&(R=u.onRecoverableError)),o=tb(o,null,r,1,u??null,v,!1,x,R),r[Gr]=o.current,mt(r),m)for(r=0;r<m.length;r++)u=m[r],v=u._getVersion,v=v(u._source),o.mutableSourceEagerHydrationData==null?o.mutableSourceEagerHydrationData=[u,v]:o.mutableSourceEagerHydrationData.push(u,v);return new Jc(o)},gn.render=function(r,o,u){if(!eu(o))throw Error(n(200));return tu(null,r,o,!1,u)},gn.unmountComponentAtNode=function(r){if(!eu(r))throw Error(n(40));return r._reactRootContainer?(xa(function(){tu(null,null,r,!1,function(){r._reactRootContainer=null,r[Gr]=null})}),!0):!1},gn.unstable_batchedUpdates=Uh,gn.unstable_renderSubtreeIntoContainer=function(r,o,u,m){if(!eu(u))throw Error(n(200));if(r==null||r._reactInternals===void 0)throw Error(n(38));return tu(r,o,u,!1,m)},gn.version="18.3.1-next-f1338f8080-20240426",gn}var hb;function Xj(){if(hb)return tf.exports;hb=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(),tf.exports=vM(),tf.exports}var fb;function wM(){if(fb)return su;fb=1;var e=Xj();return su.createRoot=e.createRoot,su.hydrateRoot=e.hydrateRoot,su}var xM=wM(),b=Ol();const fe=_w(b);function Vt(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=Vt(e[n]))!==""&&(t+=(t&&" ")+s);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var sf={exports:{}},af={},of={exports:{}},lf={};/**
|
|
41
|
+
* @license React
|
|
42
|
+
* use-sync-external-store-shim.production.js
|
|
43
|
+
*
|
|
44
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
45
|
+
*
|
|
46
|
+
* This source code is licensed under the MIT license found in the
|
|
47
|
+
* LICENSE file in the root directory of this source tree.
|
|
48
|
+
*/var pb;function bM(){if(pb)return lf;pb=1;var e=Ol();function t(g,y){return g===y&&(g!==0||1/g===1/y)||g!==g&&y!==y}var n=typeof Object.is=="function"?Object.is:t,s=e.useState,a=e.useEffect,i=e.useLayoutEffect,l=e.useDebugValue;function d(g,y){var w=y(),S=s({inst:{value:w,getSnapshot:y}}),k=S[0].inst,N=S[1];return i(function(){k.value=w,k.getSnapshot=y,f(k)&&N({inst:k})},[g,w,y]),a(function(){return f(k)&&N({inst:k}),g(function(){f(k)&&N({inst:k})})},[g]),l(w),w}function f(g){var y=g.getSnapshot;g=g.value;try{var w=y();return!n(g,w)}catch{return!0}}function p(g,y){return y()}var h=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?p:d;return lf.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:h,lf}var mb;function kM(){return mb||(mb=1,of.exports=bM()),of.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 gb;function _M(){if(gb)return af;gb=1;var e=Ol(),t=kM();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,d=e.useMemo,f=e.useDebugValue;return af.useSyncExternalStoreWithSelector=function(p,h,g,y,w){var S=i(null);if(S.current===null){var k={hasValue:!1,value:null};S.current=k}else k=S.current;S=d(function(){function _($){if(!E){if(E=!0,j=$,$=y($),w!==void 0&&k.hasValue){var I=k.value;if(w(I,$))return C=I}return C=$}if(I=C,s(j,$))return I;var F=y($);return w!==void 0&&w(I,F)?(j=$,I):(j=$,C=F)}var E=!1,j,C,M=g===void 0?null:g;return[function(){return _(h())},M===null?void 0:function(){return _(M())}]},[h,g,y,w]);var N=a(p,S[0],S[1]);return l(function(){k.hasValue=!0,k.value=N},[N]),f(N),N},af}var yb;function SM(){return yb||(yb=1,sf.exports=_M()),sf.exports}var NM=SM();const EM=_w(NM),jM={},vb=e=>{let t;const n=new Set,s=(h,g)=>{const y=typeof h=="function"?h(t):h;if(!Object.is(y,t)){const w=t;t=g??(typeof y!="object"||y===null)?y:Object.assign({},t,y),n.forEach(S=>S(t,w))}},a=()=>t,f={setState:s,getState:a,getInitialState:()=>p,subscribe:h=>(n.add(h),()=>n.delete(h)),destroy:()=>{(jM?"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},CM=e=>e?vb(e):vb,{useDebugValue:TM}=fe,{useSyncExternalStoreWithSelector:RM}=EM,AM=e=>e;function Qj(e,t=AM,n){const s=RM(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return TM(s),s}const wb=(e,t)=>{const n=CM(e),s=(a,i=t)=>Qj(n,a,i);return Object.assign(s,n),s},MM=(e,t)=>e?wb(e,t):wb;function qt(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[s,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 IM={value:()=>{}};function Zu(){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 Nu(n)}function Nu(e){this._=e}function OM(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}})}Nu.prototype=Zu.prototype={constructor:Nu,on:function(e,t){var n=this._,s=OM(e+"",n),a,i=-1,l=s.length;if(arguments.length<2){for(;++i<l;)if((a=(e=s[i]).type)&&(a=$M(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]=xb(n[a],e.name,t);else if(t==null)for(a in n)n[a]=xb(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 Nu(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 $M(e,t){for(var n=0,s=e.length,a;n<s;++n)if((a=e[n]).name===t)return a.value}function xb(e,t,n){for(var s=0,a=e.length;s<a;++s)if(e[s].name===t){e[s]=IM,e=e.slice(0,s).concat(e.slice(s+1));break}return n!=null&&e.push({name:t,value:n}),e}var Wv="http://www.w3.org/1999/xhtml";const bb={svg:"http://www.w3.org/2000/svg",xhtml:Wv,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Ju(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),bb.hasOwnProperty(t)?{space:bb[t],local:e}:e}function PM(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Wv&&t.documentElement.namespaceURI===Wv?t.createElement(e):t.createElementNS(n,e)}}function LM(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Zj(e){var t=Ju(e);return(t.local?LM:PM)(t)}function qM(){}function Sw(e){return e==null?qM:function(){return this.querySelector(e)}}function DM(e){typeof e!="function"&&(e=Sw(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,d=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__),d[h]=p);return new Mn(s,this._parents)}function FM(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function zM(){return[]}function Jj(e){return e==null?zM:function(){return this.querySelectorAll(e)}}function BM(e){return function(){return FM(e.apply(this,arguments))}}function UM(e){typeof e=="function"?e=BM(e):e=Jj(e);for(var t=this._groups,n=t.length,s=[],a=[],i=0;i<n;++i)for(var l=t[i],d=l.length,f,p=0;p<d;++p)(f=l[p])&&(s.push(e.call(f,f.__data__,p,l)),a.push(f));return new Mn(s,a)}function eC(e){return function(){return this.matches(e)}}function tC(e){return function(t){return t.matches(e)}}var WM=Array.prototype.find;function HM(e){return function(){return WM.call(this.children,e)}}function GM(){return this.firstElementChild}function VM(e){return this.select(e==null?GM:HM(typeof e=="function"?e:tC(e)))}var YM=Array.prototype.filter;function KM(){return Array.from(this.children)}function XM(e){return function(){return YM.call(this.children,e)}}function QM(e){return this.selectAll(e==null?KM:XM(typeof e=="function"?e:tC(e)))}function ZM(e){typeof e!="function"&&(e=eC(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,d=s[a]=[],f,p=0;p<l;++p)(f=i[p])&&e.call(f,f.__data__,p,i)&&d.push(f);return new Mn(s,this._parents)}function nC(e){return new Array(e.length)}function JM(){return new Mn(this._enter||this._groups.map(nC),this._parents)}function Ou(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Ou.prototype={constructor:Ou,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function e2(e){return function(){return e}}function t2(e,t,n,s,a,i){for(var l=0,d,f=t.length,p=i.length;l<p;++l)(d=t[l])?(d.__data__=i[l],s[l]=d):n[l]=new Ou(e,i[l]);for(;l<f;++l)(d=t[l])&&(a[l]=d)}function n2(e,t,n,s,a,i,l){var d,f,p=new Map,h=t.length,g=i.length,y=new Array(h),w;for(d=0;d<h;++d)(f=t[d])&&(y[d]=w=l.call(f,f.__data__,d,t)+"",p.has(w)?a[d]=f:p.set(w,f));for(d=0;d<g;++d)w=l.call(e,i[d],d,i)+"",(f=p.get(w))?(s[d]=f,f.__data__=i[d],p.delete(w)):n[d]=new Ou(e,i[d]);for(d=0;d<h;++d)(f=t[d])&&p.get(y[d])===f&&(a[d]=f)}function r2(e){return e.__data__}function s2(e,t){if(!arguments.length)return Array.from(this,r2);var n=t?n2:t2,s=this._parents,a=this._groups;typeof e!="function"&&(e=e2(e));for(var i=a.length,l=new Array(i),d=new Array(i),f=new Array(i),p=0;p<i;++p){var h=s[p],g=a[p],y=g.length,w=a2(e.call(h,h&&h.__data__,p,s)),S=w.length,k=d[p]=new Array(S),N=l[p]=new Array(S),_=f[p]=new Array(y);n(h,g,k,N,_,w,t);for(var E=0,j=0,C,M;E<S;++E)if(C=k[E]){for(E>=j&&(j=E+1);!(M=N[j])&&++j<S;);C._next=M||null}}return l=new Mn(l,s),l._enter=d,l._exit=f,l}function a2(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function o2(){return new Mn(this._exit||this._groups.map(nC),this._parents)}function i2(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 l2(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),d=new Array(a),f=0;f<l;++f)for(var p=n[f],h=s[f],g=p.length,y=d[f]=new Array(g),w,S=0;S<g;++S)(w=p[S]||h[S])&&(y[S]=w);for(;f<a;++f)d[f]=n[f];return new Mn(d,this._parents)}function c2(){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 u2(e){e||(e=d2);function t(g,y){return g&&y?e(g.__data__,y.__data__):!g-!y}for(var n=this._groups,s=n.length,a=new Array(s),i=0;i<s;++i){for(var l=n[i],d=l.length,f=a[i]=new Array(d),p,h=0;h<d;++h)(p=l[h])&&(f[h]=p);f.sort(t)}return new Mn(a,this._parents).order()}function d2(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function h2(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function f2(){return Array.from(this)}function p2(){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 m2(){let e=0;for(const t of this)++e;return e}function g2(){return!this.node()}function y2(e){for(var t=this._groups,n=0,s=t.length;n<s;++n)for(var a=t[n],i=0,l=a.length,d;i<l;++i)(d=a[i])&&e.call(d,d.__data__,i,a);return this}function v2(e){return function(){this.removeAttribute(e)}}function w2(e){return function(){this.removeAttributeNS(e.space,e.local)}}function x2(e,t){return function(){this.setAttribute(e,t)}}function b2(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function k2(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function _2(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 S2(e,t){var n=Ju(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?w2:v2:typeof t=="function"?n.local?_2:k2:n.local?b2:x2)(n,t))}function rC(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function N2(e){return function(){this.style.removeProperty(e)}}function E2(e,t,n){return function(){this.style.setProperty(e,t,n)}}function j2(e,t,n){return function(){var s=t.apply(this,arguments);s==null?this.style.removeProperty(e):this.style.setProperty(e,s,n)}}function C2(e,t,n){return arguments.length>1?this.each((t==null?N2:typeof t=="function"?j2:E2)(e,t,n??"")):Ho(this.node(),e)}function Ho(e,t){return e.style.getPropertyValue(t)||rC(e).getComputedStyle(e,null).getPropertyValue(t)}function T2(e){return function(){delete this[e]}}function R2(e,t){return function(){this[e]=t}}function A2(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function M2(e,t){return arguments.length>1?this.each((t==null?T2:typeof t=="function"?A2:R2)(e,t)):this.node()[e]}function sC(e){return e.trim().split(/^|\s+/)}function Nw(e){return e.classList||new aC(e)}function aC(e){this._node=e,this._names=sC(e.getAttribute("class")||"")}aC.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 oC(e,t){for(var n=Nw(e),s=-1,a=t.length;++s<a;)n.add(t[s])}function iC(e,t){for(var n=Nw(e),s=-1,a=t.length;++s<a;)n.remove(t[s])}function I2(e){return function(){oC(this,e)}}function O2(e){return function(){iC(this,e)}}function $2(e,t){return function(){(t.apply(this,arguments)?oC:iC)(this,e)}}function P2(e,t){var n=sC(e+"");if(arguments.length<2){for(var s=Nw(this.node()),a=-1,i=n.length;++a<i;)if(!s.contains(n[a]))return!1;return!0}return this.each((typeof t=="function"?$2:t?I2:O2)(n,t))}function L2(){this.textContent=""}function q2(e){return function(){this.textContent=e}}function D2(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function F2(e){return arguments.length?this.each(e==null?L2:(typeof e=="function"?D2:q2)(e)):this.node().textContent}function z2(){this.innerHTML=""}function B2(e){return function(){this.innerHTML=e}}function U2(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function W2(e){return arguments.length?this.each(e==null?z2:(typeof e=="function"?U2:B2)(e)):this.node().innerHTML}function H2(){this.nextSibling&&this.parentNode.appendChild(this)}function G2(){return this.each(H2)}function V2(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Y2(){return this.each(V2)}function K2(e){var t=typeof e=="function"?e:Zj(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function X2(){return null}function Q2(e,t){var n=typeof e=="function"?e:Zj(e),s=t==null?X2:typeof t=="function"?t:Sw(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),s.apply(this,arguments)||null)})}function Z2(){var e=this.parentNode;e&&e.removeChild(this)}function J2(){return this.each(Z2)}function eI(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function tI(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function nI(e){return this.select(e?tI:eI)}function rI(e){return arguments.length?this.property("__data__",e):this.node().__data__}function sI(e){return function(t){e.call(this,t,this.__data__)}}function aI(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 oI(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 iI(e,t,n){return function(){var s=this.__on,a,i=sI(t);if(s){for(var l=0,d=s.length;l<d;++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 lI(e,t,n){var s=aI(e+""),a,i=s.length,l;if(arguments.length<2){var d=this.node().__on;if(d){for(var f=0,p=d.length,h;f<p;++f)for(a=0,h=d[f];a<i;++a)if((l=s[a]).type===h.type&&l.name===h.name)return h.value}return}for(d=t?iI:oI,a=0;a<i;++a)this.each(d(s[a],t,n));return this}function lC(e,t,n){var s=rC(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 cI(e,t){return function(){return lC(this,e,t)}}function uI(e,t){return function(){return lC(this,e,t.apply(this,arguments))}}function dI(e,t){return this.each((typeof t=="function"?uI:cI)(e,t))}function*hI(){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 cC=[null];function Mn(e,t){this._groups=e,this._parents=t}function $l(){return new Mn([[document.documentElement]],cC)}function fI(){return this}Mn.prototype=$l.prototype={constructor:Mn,select:DM,selectAll:UM,selectChild:VM,selectChildren:QM,filter:ZM,data:s2,enter:JM,exit:o2,join:i2,merge:l2,selection:fI,order:c2,sort:u2,call:h2,nodes:f2,node:p2,size:m2,empty:g2,each:y2,attr:S2,style:C2,property:M2,classed:P2,text:F2,html:W2,raise:G2,lower:Y2,append:K2,insert:Q2,remove:J2,clone:nI,datum:rI,on:lI,dispatch:dI,[Symbol.iterator]:hI};function Hn(e){return typeof e=="string"?new Mn([[document.querySelector(e)]],[document.documentElement]):new Mn([[e]],cC)}function pI(e){let t;for(;t=e.sourceEvent;)e=t;return e}function or(e,t){if(e=pI(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 mI={passive:!1},bl={capture:!0,passive:!1};function cf(e){e.stopImmediatePropagation()}function zo(e){e.preventDefault(),e.stopImmediatePropagation()}function uC(e){var t=e.document.documentElement,n=Hn(e).on("dragstart.drag",zo,bl);"onselectstart"in t?n.on("selectstart.drag",zo,bl):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function dC(e,t){var n=e.document.documentElement,s=Hn(e).on("dragstart.drag",null);t&&(s.on("click.drag",zo,bl),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 au=e=>()=>e;function Hv(e,{sourceEvent:t,subject:n,target:s,identifier:a,active:i,x:l,y:d,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:d,enumerable:!0,configurable:!0},dx:{value:f,enumerable:!0,configurable:!0},dy:{value:p,enumerable:!0,configurable:!0},_:{value:h}})}Hv.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function gI(e){return!e.ctrlKey&&!e.button}function yI(){return this.parentNode}function vI(e,t){return t??{x:e.x,y:e.y}}function wI(){return navigator.maxTouchPoints||"ontouchstart"in this}function xI(){var e=gI,t=yI,n=vI,s=wI,a={},i=Zu("start","drag","end"),l=0,d,f,p,h,g=0;function y(C){C.on("mousedown.drag",w).filter(s).on("touchstart.drag",N).on("touchmove.drag",_,mI).on("touchend.drag touchcancel.drag",E).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function w(C,M){if(!(h||!e.call(this,C,M))){var $=j(this,t.call(this,C,M),C,M,"mouse");$&&(Hn(C.view).on("mousemove.drag",S,bl).on("mouseup.drag",k,bl),uC(C.view),cf(C),p=!1,d=C.clientX,f=C.clientY,$("start",C))}}function S(C){if(zo(C),!p){var M=C.clientX-d,$=C.clientY-f;p=M*M+$*$>g}a.mouse("drag",C)}function k(C){Hn(C.view).on("mousemove.drag mouseup.drag",null),dC(C.view,p),zo(C),a.mouse("end",C)}function N(C,M){if(e.call(this,C,M)){var $=C.changedTouches,I=t.call(this,C,M),F=$.length,O,A;for(O=0;O<F;++O)(A=j(this,I,C,M,$[O].identifier,$[O]))&&(cf(C),A("start",C,$[O]))}}function _(C){var M=C.changedTouches,$=M.length,I,F;for(I=0;I<$;++I)(F=a[M[I].identifier])&&(zo(C),F("drag",C,M[I]))}function E(C){var M=C.changedTouches,$=M.length,I,F;for(h&&clearTimeout(h),h=setTimeout(function(){h=null},500),I=0;I<$;++I)(F=a[M[I].identifier])&&(cf(C),F("end",C,M[I]))}function j(C,M,$,I,F,O){var A=i.copy(),L=or(O||$,M),H,X,T;if((T=n.call(C,new Hv("beforestart",{sourceEvent:$,target:y,identifier:F,active:l,x:L[0],y:L[1],dx:0,dy:0,dispatch:A}),I))!=null)return H=T.x-L[0]||0,X=T.y-L[1]||0,function K(D,te,Z){var V=L,J;switch(D){case"start":a[F]=K,J=l++;break;case"end":delete a[F],--l;case"drag":L=or(Z||te,M),J=l;break}A.call(D,C,new Hv(D,{sourceEvent:te,subject:T,target:y,identifier:F,active:J,x:L[0]+H,y:L[1]+X,dx:L[0]-V[0],dy:L[1]-V[1],dispatch:A}),I)}}return y.filter=function(C){return arguments.length?(e=typeof C=="function"?C:au(!!C),y):e},y.container=function(C){return arguments.length?(t=typeof C=="function"?C:au(C),y):t},y.subject=function(C){return arguments.length?(n=typeof C=="function"?C:au(C),y):n},y.touchable=function(C){return arguments.length?(s=typeof C=="function"?C:au(!!C),y):s},y.on=function(){var C=i.on.apply(i,arguments);return C===i?y:C},y.clickDistance=function(C){return arguments.length?(g=(C=+C)*C,y):Math.sqrt(g)},y}function Ew(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function hC(e,t){var n=Object.create(e.prototype);for(var s in t)n[s]=t[s];return n}function Pl(){}var kl=.7,$u=1/kl,Bo="\\s*([+-]?\\d+)\\s*",_l="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",jr="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",bI=/^#([0-9a-f]{3,8})$/,kI=new RegExp(`^rgb\\(${Bo},${Bo},${Bo}\\)$`),_I=new RegExp(`^rgb\\(${jr},${jr},${jr}\\)$`),SI=new RegExp(`^rgba\\(${Bo},${Bo},${Bo},${_l}\\)$`),NI=new RegExp(`^rgba\\(${jr},${jr},${jr},${_l}\\)$`),EI=new RegExp(`^hsl\\(${_l},${jr},${jr}\\)$`),jI=new RegExp(`^hsla\\(${_l},${jr},${jr},${_l}\\)$`),kb={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};Ew(Pl,Sl,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:_b,formatHex:_b,formatHex8:CI,formatHsl:TI,formatRgb:Sb,toString:Sb});function _b(){return this.rgb().formatHex()}function CI(){return this.rgb().formatHex8()}function TI(){return fC(this).formatHsl()}function Sb(){return this.rgb().formatRgb()}function Sl(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=bI.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?Nb(t):n===3?new yn(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?ou(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?ou(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=kI.exec(e))?new yn(t[1],t[2],t[3],1):(t=_I.exec(e))?new yn(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=SI.exec(e))?ou(t[1],t[2],t[3],t[4]):(t=NI.exec(e))?ou(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=EI.exec(e))?Cb(t[1],t[2]/100,t[3]/100,1):(t=jI.exec(e))?Cb(t[1],t[2]/100,t[3]/100,t[4]):kb.hasOwnProperty(e)?Nb(kb[e]):e==="transparent"?new yn(NaN,NaN,NaN,0):null}function Nb(e){return new yn(e>>16&255,e>>8&255,e&255,1)}function ou(e,t,n,s){return s<=0&&(e=t=n=NaN),new yn(e,t,n,s)}function RI(e){return e instanceof Pl||(e=Sl(e)),e?(e=e.rgb(),new yn(e.r,e.g,e.b,e.opacity)):new yn}function Gv(e,t,n,s){return arguments.length===1?RI(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}Ew(yn,Gv,hC(Pl,{brighter(e){return e=e==null?$u:Math.pow($u,e),new yn(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?kl:Math.pow(kl,e),new yn(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new yn(Ra(this.r),Ra(this.g),Ra(this.b),Pu(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:Eb,formatHex:Eb,formatHex8:AI,formatRgb:jb,toString:jb}));function Eb(){return`#${Ca(this.r)}${Ca(this.g)}${Ca(this.b)}`}function AI(){return`#${Ca(this.r)}${Ca(this.g)}${Ca(this.b)}${Ca((isNaN(this.opacity)?1:this.opacity)*255)}`}function jb(){const e=Pu(this.opacity);return`${e===1?"rgb(":"rgba("}${Ra(this.r)}, ${Ra(this.g)}, ${Ra(this.b)}${e===1?")":`, ${e})`}`}function Pu(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Ra(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Ca(e){return e=Ra(e),(e<16?"0":"")+e.toString(16)}function Cb(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 fC(e){if(e instanceof ir)return new ir(e.h,e.s,e.l,e.opacity);if(e instanceof Pl||(e=Sl(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,d=i-a,f=(i+a)/2;return d?(t===i?l=(n-s)/d+(n<s)*6:n===i?l=(s-t)/d+2:l=(t-n)/d+4,d/=f<.5?i+a:2-i-a,l*=60):d=f>0&&f<1?0:l,new ir(l,d,f,e.opacity)}function MI(e,t,n,s){return arguments.length===1?fC(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}Ew(ir,MI,hC(Pl,{brighter(e){return e=e==null?$u:Math.pow($u,e),new ir(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?kl:Math.pow(kl,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(uf(e>=240?e-240:e+120,a,s),uf(e,a,s),uf(e<120?e+240:e-120,a,s),this.opacity)},clamp(){return new ir(Tb(this.h),iu(this.s),iu(this.l),Pu(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=Pu(this.opacity);return`${e===1?"hsl(":"hsla("}${Tb(this.h)}, ${iu(this.s)*100}%, ${iu(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Tb(e){return e=(e||0)%360,e<0?e+360:e}function iu(e){return Math.max(0,Math.min(1,e||0))}function uf(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 pC=e=>()=>e;function II(e,t){return function(n){return e+n*t}}function OI(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 $I(e){return(e=+e)==1?mC:function(t,n){return n-t?OI(t,n,e):pC(isNaN(t)?n:t)}}function mC(e,t){var n=t-e;return n?II(e,n):pC(isNaN(e)?t:e)}const Rb=(function e(t){var n=$I(t);function s(a,i){var l=n((a=Gv(a)).r,(i=Gv(i)).r),d=n(a.g,i.g),f=n(a.b,i.b),p=mC(a.opacity,i.opacity);return function(h){return a.r=l(h),a.g=d(h),a.b=f(h),a.opacity=p(h),a+""}}return s.gamma=e,s})(1);function $s(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var Vv=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,df=new RegExp(Vv.source,"g");function PI(e){return function(){return e}}function LI(e){return function(t){return e(t)+""}}function qI(e,t){var n=Vv.lastIndex=df.lastIndex=0,s,a,i,l=-1,d=[],f=[];for(e=e+"",t=t+"";(s=Vv.exec(e))&&(a=df.exec(t));)(i=a.index)>n&&(i=t.slice(n,i),d[l]?d[l]+=i:d[++l]=i),(s=s[0])===(a=a[0])?d[l]?d[l]+=a:d[++l]=a:(d[++l]=null,f.push({i:l,x:$s(s,a)})),n=df.lastIndex;return n<t.length&&(i=t.slice(n),d[l]?d[l]+=i:d[++l]=i),d.length<2?f[0]?LI(f[0].x):PI(t):(t=f.length,function(p){for(var h=0,g;h<t;++h)d[(g=f[h]).i]=g.x(p);return d.join("")})}var Ab=180/Math.PI,Yv={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function gC(e,t,n,s,a,i){var l,d,f;return(l=Math.sqrt(e*e+t*t))&&(e/=l,t/=l),(f=e*n+t*s)&&(n-=e*f,s-=t*f),(d=Math.sqrt(n*n+s*s))&&(n/=d,s/=d,f/=d),e*s<t*n&&(e=-e,t=-t,f=-f,l=-l),{translateX:a,translateY:i,rotate:Math.atan2(t,e)*Ab,skewX:Math.atan(f)*Ab,scaleX:l,scaleY:d}}var lu;function DI(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Yv:gC(t.a,t.b,t.c,t.d,t.e,t.f)}function FI(e){return e==null||(lu||(lu=document.createElementNS("http://www.w3.org/2000/svg","g")),lu.setAttribute("transform",e),!(e=lu.transform.baseVal.consolidate()))?Yv:(e=e.matrix,gC(e.a,e.b,e.c,e.d,e.e,e.f))}function yC(e,t,n,s){function a(p){return p.length?p.pop()+" ":""}function i(p,h,g,y,w,S){if(p!==g||h!==y){var k=w.push("translate(",null,t,null,n);S.push({i:k-4,x:$s(p,g)},{i:k-2,x:$s(h,y)})}else(g||y)&&w.push("translate("+g+t+y+n)}function l(p,h,g,y){p!==h?(p-h>180?h+=360:h-p>180&&(p+=360),y.push({i:g.push(a(g)+"rotate(",null,s)-2,x:$s(p,h)})):h&&g.push(a(g)+"rotate("+h+s)}function d(p,h,g,y){p!==h?y.push({i:g.push(a(g)+"skewX(",null,s)-2,x:$s(p,h)}):h&&g.push(a(g)+"skewX("+h+s)}function f(p,h,g,y,w,S){if(p!==g||h!==y){var k=w.push(a(w)+"scale(",null,",",null,")");S.push({i:k-4,x:$s(p,g)},{i:k-2,x:$s(h,y)})}else(g!==1||y!==1)&&w.push(a(w)+"scale("+g+","+y+")")}return function(p,h){var g=[],y=[];return p=e(p),h=e(h),i(p.translateX,p.translateY,h.translateX,h.translateY,g,y),l(p.rotate,h.rotate,g,y),d(p.skewX,h.skewX,g,y),f(p.scaleX,p.scaleY,h.scaleX,h.scaleY,g,y),p=h=null,function(w){for(var S=-1,k=y.length,N;++S<k;)g[(N=y[S]).i]=N.x(w);return g.join("")}}}var zI=yC(DI,"px, ","px)","deg)"),BI=yC(FI,", ",")",")"),UI=1e-12;function Mb(e){return((e=Math.exp(e))+1/e)/2}function WI(e){return((e=Math.exp(e))-1/e)/2}function HI(e){return((e=Math.exp(2*e))-1)/(e+1)}const GI=(function e(t,n,s){function a(i,l){var d=i[0],f=i[1],p=i[2],h=l[0],g=l[1],y=l[2],w=h-d,S=g-f,k=w*w+S*S,N,_;if(k<UI)_=Math.log(y/p)/t,N=function(I){return[d+I*w,f+I*S,p*Math.exp(t*I*_)]};else{var E=Math.sqrt(k),j=(y*y-p*p+s*k)/(2*p*n*E),C=(y*y-p*p-s*k)/(2*y*n*E),M=Math.log(Math.sqrt(j*j+1)-j),$=Math.log(Math.sqrt(C*C+1)-C);_=($-M)/t,N=function(I){var F=I*_,O=Mb(M),A=p/(n*E)*(O*HI(t*F+M)-WI(M));return[d+A*w,f+A*S,p*O/Mb(t*F+M)]}}return N.duration=_*1e3*t/Math.SQRT2,N}return a.rho=function(i){var l=Math.max(.001,+i),d=l*l,f=d*d;return e(l,d,f)},a})(Math.SQRT2,2,4);var Go=0,pl=0,al=0,vC=1e3,Lu,ml,qu=0,Ma=0,ed=0,Nl=typeof performance=="object"&&performance.now?performance:Date,wC=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function jw(){return Ma||(wC(VI),Ma=Nl.now()+ed)}function VI(){Ma=0}function Du(){this._call=this._time=this._next=null}Du.prototype=xC.prototype={constructor:Du,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?jw():+n)+(t==null?0:+t),!this._next&&ml!==this&&(ml?ml._next=this:Lu=this,ml=this),this._call=e,this._time=n,Kv()},stop:function(){this._call&&(this._call=null,this._time=1/0,Kv())}};function xC(e,t,n){var s=new Du;return s.restart(e,t,n),s}function YI(){jw(),++Go;for(var e=Lu,t;e;)(t=Ma-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Go}function Ib(){Ma=(qu=Nl.now())+ed,Go=pl=0;try{YI()}finally{Go=0,XI(),Ma=0}}function KI(){var e=Nl.now(),t=e-qu;t>vC&&(ed-=t,qu=e)}function XI(){for(var e,t=Lu,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:Lu=n);ml=e,Kv(s)}function Kv(e){if(!Go){pl&&(pl=clearTimeout(pl));var t=e-Ma;t>24?(e<1/0&&(pl=setTimeout(Ib,e-Nl.now()-ed)),al&&(al=clearInterval(al))):(al||(qu=Nl.now(),al=setInterval(KI,vC)),Go=1,wC(Ib))}}function Ob(e,t,n){var s=new Du;return t=t==null?0:+t,s.restart(a=>{s.stop(),e(a+t)},t,n),s}var QI=Zu("start","end","cancel","interrupt"),ZI=[],bC=0,$b=1,Xv=2,Eu=3,Pb=4,Qv=5,ju=6;function td(e,t,n,s,a,i){var l=e.__transition;if(!l)e.__transition={};else if(n in l)return;JI(e,n,{name:t,index:s,group:a,on:QI,tween:ZI,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:bC})}function Cw(e,t){var n=fr(e,t);if(n.state>bC)throw new Error("too late; already scheduled");return n}function Cr(e,t){var n=fr(e,t);if(n.state>Eu)throw new Error("too late; already running");return n}function fr(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function JI(e,t,n){var s=e.__transition,a;s[t]=n,n.timer=xC(i,0,n.time);function i(p){n.state=$b,n.timer.restart(l,n.delay,n.time),n.delay<=p&&l(p-n.delay)}function l(p){var h,g,y,w;if(n.state!==$b)return f();for(h in s)if(w=s[h],w.name===n.name){if(w.state===Eu)return Ob(l);w.state===Pb?(w.state=ju,w.timer.stop(),w.on.call("interrupt",e,e.__data__,w.index,w.group),delete s[h]):+h<t&&(w.state=ju,w.timer.stop(),w.on.call("cancel",e,e.__data__,w.index,w.group),delete s[h])}if(Ob(function(){n.state===Eu&&(n.state=Pb,n.timer.restart(d,n.delay,n.time),d(p))}),n.state=Xv,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Xv){for(n.state=Eu,a=new Array(y=n.tween.length),h=0,g=-1;h<y;++h)(w=n.tween[h].value.call(e,e.__data__,n.index,n.group))&&(a[++g]=w);a.length=g+1}}function d(p){for(var h=p<n.duration?n.ease.call(null,p/n.duration):(n.timer.restart(f),n.state=Qv,1),g=-1,y=a.length;++g<y;)a[g].call(e,h);n.state===Qv&&(n.on.call("end",e,e.__data__,n.index,n.group),f())}function f(){n.state=ju,n.timer.stop(),delete s[t];for(var p in s)return;delete e.__transition}}function Cu(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>Xv&&s.state<Qv,s.state=ju,s.timer.stop(),s.on.call(a?"interrupt":"cancel",e,e.__data__,s.index,s.group),delete n[l]}i&&delete e.__transition}}function eO(e){return this.each(function(){Cu(this,e)})}function tO(e,t){var n,s;return function(){var a=Cr(this,e),i=a.tween;if(i!==n){s=n=i;for(var l=0,d=s.length;l<d;++l)if(s[l].name===t){s=s.slice(),s.splice(l,1);break}}a.tween=s}}function nO(e,t,n){var s,a;if(typeof n!="function")throw new Error;return function(){var i=Cr(this,e),l=i.tween;if(l!==s){a=(s=l).slice();for(var d={name:t,value:n},f=0,p=a.length;f<p;++f)if(a[f].name===t){a[f]=d;break}f===p&&a.push(d)}i.tween=a}}function rO(e,t){var n=this._id;if(e+="",arguments.length<2){for(var s=fr(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?tO:nO)(n,e,t))}function Tw(e,t,n){var s=e._id;return e.each(function(){var a=Cr(this,s);(a.value||(a.value={}))[t]=n.apply(this,arguments)}),function(a){return fr(a,s).value[t]}}function kC(e,t){var n;return(typeof t=="number"?$s:t instanceof Sl?Rb:(n=Sl(t))?(t=n,Rb):qI)(e,t)}function sO(e){return function(){this.removeAttribute(e)}}function aO(e){return function(){this.removeAttributeNS(e.space,e.local)}}function oO(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 iO(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 lO(e,t,n){var s,a,i;return function(){var l,d=n(this),f;return d==null?void this.removeAttribute(e):(l=this.getAttribute(e),f=d+"",l===f?null:l===s&&f===a?i:(a=f,i=t(s=l,d)))}}function cO(e,t,n){var s,a,i;return function(){var l,d=n(this),f;return d==null?void this.removeAttributeNS(e.space,e.local):(l=this.getAttributeNS(e.space,e.local),f=d+"",l===f?null:l===s&&f===a?i:(a=f,i=t(s=l,d)))}}function uO(e,t){var n=Ju(e),s=n==="transform"?BI:kC;return this.attrTween(e,typeof t=="function"?(n.local?cO:lO)(n,s,Tw(this,"attr."+e,t)):t==null?(n.local?aO:sO)(n):(n.local?iO:oO)(n,s,t))}function dO(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function hO(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function fO(e,t){var n,s;function a(){var i=t.apply(this,arguments);return i!==s&&(n=(s=i)&&hO(e,i)),n}return a._value=t,a}function pO(e,t){var n,s;function a(){var i=t.apply(this,arguments);return i!==s&&(n=(s=i)&&dO(e,i)),n}return a._value=t,a}function mO(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=Ju(e);return this.tween(n,(s.local?fO:pO)(s,t))}function gO(e,t){return function(){Cw(this,e).delay=+t.apply(this,arguments)}}function yO(e,t){return t=+t,function(){Cw(this,e).delay=t}}function vO(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?gO:yO)(t,e)):fr(this.node(),t).delay}function wO(e,t){return function(){Cr(this,e).duration=+t.apply(this,arguments)}}function xO(e,t){return t=+t,function(){Cr(this,e).duration=t}}function bO(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?wO:xO)(t,e)):fr(this.node(),t).duration}function kO(e,t){if(typeof t!="function")throw new Error;return function(){Cr(this,e).ease=t}}function _O(e){var t=this._id;return arguments.length?this.each(kO(t,e)):fr(this.node(),t).ease}function SO(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Cr(this,e).ease=n}}function NO(e){if(typeof e!="function")throw new Error;return this.each(SO(this._id,e))}function EO(e){typeof e!="function"&&(e=eC(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,d=s[a]=[],f,p=0;p<l;++p)(f=i[p])&&e.call(f,f.__data__,p,i)&&d.push(f);return new rs(s,this._parents,this._name,this._id)}function jO(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),d=0;d<i;++d)for(var f=t[d],p=n[d],h=f.length,g=l[d]=new Array(h),y,w=0;w<h;++w)(y=f[w]||p[w])&&(g[w]=y);for(;d<s;++d)l[d]=t[d];return new rs(l,this._parents,this._name,this._id)}function CO(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function TO(e,t,n){var s,a,i=CO(t)?Cw:Cr;return function(){var l=i(this,e),d=l.on;d!==s&&(a=(s=d).copy()).on(t,n),l.on=a}}function RO(e,t){var n=this._id;return arguments.length<2?fr(this.node(),n).on.on(e):this.each(TO(n,e,t))}function AO(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function MO(){return this.on("end.remove",AO(this._id))}function IO(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Sw(e));for(var s=this._groups,a=s.length,i=new Array(a),l=0;l<a;++l)for(var d=s[l],f=d.length,p=i[l]=new Array(f),h,g,y=0;y<f;++y)(h=d[y])&&(g=e.call(h,h.__data__,y,d))&&("__data__"in h&&(g.__data__=h.__data__),p[y]=g,td(p[y],t,n,y,p,fr(h,n)));return new rs(i,this._parents,t,n)}function OO(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Jj(e));for(var s=this._groups,a=s.length,i=[],l=[],d=0;d<a;++d)for(var f=s[d],p=f.length,h,g=0;g<p;++g)if(h=f[g]){for(var y=e.call(h,h.__data__,g,f),w,S=fr(h,n),k=0,N=y.length;k<N;++k)(w=y[k])&&td(w,t,n,k,y,S);i.push(y),l.push(h)}return new rs(i,l,t,n)}var $O=$l.prototype.constructor;function PO(){return new $O(this._groups,this._parents)}function LO(e,t){var n,s,a;return function(){var i=Ho(this,e),l=(this.style.removeProperty(e),Ho(this,e));return i===l?null:i===n&&l===s?a:a=t(n=i,s=l)}}function _C(e){return function(){this.style.removeProperty(e)}}function qO(e,t,n){var s,a=n+"",i;return function(){var l=Ho(this,e);return l===a?null:l===s?i:i=t(s=l,n)}}function DO(e,t,n){var s,a,i;return function(){var l=Ho(this,e),d=n(this),f=d+"";return d==null&&(f=d=(this.style.removeProperty(e),Ho(this,e))),l===f?null:l===s&&f===a?i:(a=f,i=t(s=l,d))}}function FO(e,t){var n,s,a,i="style."+t,l="end."+i,d;return function(){var f=Cr(this,e),p=f.on,h=f.value[i]==null?d||(d=_C(t)):void 0;(p!==n||a!==h)&&(s=(n=p).copy()).on(l,a=h),f.on=s}}function zO(e,t,n){var s=(e+="")=="transform"?zI:kC;return t==null?this.styleTween(e,LO(e,s)).on("end.style."+e,_C(e)):typeof t=="function"?this.styleTween(e,DO(e,s,Tw(this,"style."+e,t))).each(FO(this._id,e)):this.styleTween(e,qO(e,s,t),n).on("end.style."+e,null)}function BO(e,t,n){return function(s){this.style.setProperty(e,t.call(this,s),n)}}function UO(e,t,n){var s,a;function i(){var l=t.apply(this,arguments);return l!==a&&(s=(a=l)&&BO(e,l,n)),s}return i._value=t,i}function WO(e,t,n){var s="style."+(e+="");if(arguments.length<2)return(s=this.tween(s))&&s._value;if(t==null)return this.tween(s,null);if(typeof t!="function")throw new Error;return this.tween(s,UO(e,t,n??""))}function HO(e){return function(){this.textContent=e}}function GO(e){return function(){var t=e(this);this.textContent=t??""}}function VO(e){return this.tween("text",typeof e=="function"?GO(Tw(this,"text",e)):HO(e==null?"":e+""))}function YO(e){return function(t){this.textContent=e.call(this,t)}}function KO(e){var t,n;function s(){var a=e.apply(this,arguments);return a!==n&&(t=(n=a)&&YO(a)),t}return s._value=e,s}function XO(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,KO(e))}function QO(){for(var e=this._name,t=this._id,n=SC(),s=this._groups,a=s.length,i=0;i<a;++i)for(var l=s[i],d=l.length,f,p=0;p<d;++p)if(f=l[p]){var h=fr(f,t);td(f,e,n,p,l,{time:h.time+h.delay+h.duration,delay:0,duration:h.duration,ease:h.ease})}return new rs(s,this._parents,e,n)}function ZO(){var e,t,n=this,s=n._id,a=n.size();return new Promise(function(i,l){var d={value:l},f={value:function(){--a===0&&i()}};n.each(function(){var p=Cr(this,s),h=p.on;h!==e&&(t=(e=h).copy(),t._.cancel.push(d),t._.interrupt.push(d),t._.end.push(f)),p.on=t}),a===0&&i()})}var JO=0;function rs(e,t,n,s){this._groups=e,this._parents=t,this._name=n,this._id=s}function SC(){return++JO}var es=$l.prototype;rs.prototype={constructor:rs,select:IO,selectAll:OO,selectChild:es.selectChild,selectChildren:es.selectChildren,filter:EO,merge:jO,selection:PO,transition:QO,call:es.call,nodes:es.nodes,node:es.node,size:es.size,empty:es.empty,each:es.each,on:RO,attr:uO,attrTween:mO,style:zO,styleTween:WO,text:VO,textTween:XO,remove:MO,tween:rO,delay:vO,duration:bO,ease:_O,easeVarying:NO,end:ZO,[Symbol.iterator]:es[Symbol.iterator]};function e$(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var t$={time:null,delay:0,duration:250,ease:e$};function n$(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 r$(e){var t,n;e instanceof rs?(t=e._id,e=e._name):(t=SC(),(n=t$).time=jw(),e=e==null?null:e+"");for(var s=this._groups,a=s.length,i=0;i<a;++i)for(var l=s[i],d=l.length,f,p=0;p<d;++p)(f=l[p])&&td(f,e,t,p,l,n||n$(f,t));return new rs(s,this._parents,e,t)}$l.prototype.interrupt=eO;$l.prototype.transition=r$;const cu=e=>()=>e;function s$(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 ts(e,t,n){this.k=e,this.x=t,this.y=n}ts.prototype={constructor:ts,scale:function(e){return e===1?this:new ts(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new ts(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 ns=new ts(1,0,0);ts.prototype;function hf(e){e.stopImmediatePropagation()}function ol(e){e.preventDefault(),e.stopImmediatePropagation()}function a$(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function o$(){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 Lb(){return this.__zoom||ns}function i$(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function l$(){return navigator.maxTouchPoints||"ontouchstart"in this}function c$(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 NC(){var e=a$,t=o$,n=c$,s=i$,a=l$,i=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],d=250,f=GI,p=Zu("start","zoom","end"),h,g,y,w=500,S=150,k=0,N=10;function _(T){T.property("__zoom",Lb).on("wheel.zoom",F,{passive:!1}).on("mousedown.zoom",O).on("dblclick.zoom",A).filter(a).on("touchstart.zoom",L).on("touchmove.zoom",H).on("touchend.zoom touchcancel.zoom",X).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}_.transform=function(T,K,D,te){var Z=T.selection?T.selection():T;Z.property("__zoom",Lb),T!==Z?M(T,K,D,te):Z.interrupt().each(function(){$(this,arguments).event(te).start().zoom(null,typeof K=="function"?K.apply(this,arguments):K).end()})},_.scaleBy=function(T,K,D,te){_.scaleTo(T,function(){var Z=this.__zoom.k,V=typeof K=="function"?K.apply(this,arguments):K;return Z*V},D,te)},_.scaleTo=function(T,K,D,te){_.transform(T,function(){var Z=t.apply(this,arguments),V=this.__zoom,J=D==null?C(Z):typeof D=="function"?D.apply(this,arguments):D,P=V.invert(J),Y=typeof K=="function"?K.apply(this,arguments):K;return n(j(E(V,Y),J,P),Z,l)},D,te)},_.translateBy=function(T,K,D,te){_.transform(T,function(){return n(this.__zoom.translate(typeof K=="function"?K.apply(this,arguments):K,typeof D=="function"?D.apply(this,arguments):D),t.apply(this,arguments),l)},null,te)},_.translateTo=function(T,K,D,te,Z){_.transform(T,function(){var V=t.apply(this,arguments),J=this.__zoom,P=te==null?C(V):typeof te=="function"?te.apply(this,arguments):te;return n(ns.translate(P[0],P[1]).scale(J.k).translate(typeof K=="function"?-K.apply(this,arguments):-K,typeof D=="function"?-D.apply(this,arguments):-D),V,l)},te,Z)};function E(T,K){return K=Math.max(i[0],Math.min(i[1],K)),K===T.k?T:new ts(K,T.x,T.y)}function j(T,K,D){var te=K[0]-D[0]*T.k,Z=K[1]-D[1]*T.k;return te===T.x&&Z===T.y?T:new ts(T.k,te,Z)}function C(T){return[(+T[0][0]+ +T[1][0])/2,(+T[0][1]+ +T[1][1])/2]}function M(T,K,D,te){T.on("start.zoom",function(){$(this,arguments).event(te).start()}).on("interrupt.zoom end.zoom",function(){$(this,arguments).event(te).end()}).tween("zoom",function(){var Z=this,V=arguments,J=$(Z,V).event(te),P=t.apply(Z,V),Y=D==null?C(P):typeof D=="function"?D.apply(Z,V):D,de=Math.max(P[1][0]-P[0][0],P[1][1]-P[0][1]),U=Z.__zoom,z=typeof K=="function"?K.apply(Z,V):K,Q=f(U.invert(Y).concat(de/U.k),z.invert(Y).concat(de/z.k));return function(W){if(W===1)W=z;else{var le=Q(W),pe=de/le[2];W=new ts(pe,Y[0]-le[0]*pe,Y[1]-le[1]*pe)}J.zoom(null,W)}})}function $(T,K,D){return!D&&T.__zooming||new I(T,K)}function I(T,K){this.that=T,this.args=K,this.active=0,this.sourceEvent=null,this.extent=t.apply(T,K),this.taps=0}I.prototype={event:function(T){return T&&(this.sourceEvent=T),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(T,K){return this.mouse&&T!=="mouse"&&(this.mouse[1]=K.invert(this.mouse[0])),this.touch0&&T!=="touch"&&(this.touch0[1]=K.invert(this.touch0[0])),this.touch1&&T!=="touch"&&(this.touch1[1]=K.invert(this.touch1[0])),this.that.__zoom=K,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(T){var K=Hn(this.that).datum();p.call(T,this.that,new s$(T,{sourceEvent:this.sourceEvent,target:_,transform:this.that.__zoom,dispatch:p}),K)}};function F(T,...K){if(!e.apply(this,arguments))return;var D=$(this,K).event(T),te=this.__zoom,Z=Math.max(i[0],Math.min(i[1],te.k*Math.pow(2,s.apply(this,arguments)))),V=or(T);if(D.wheel)(D.mouse[0][0]!==V[0]||D.mouse[0][1]!==V[1])&&(D.mouse[1]=te.invert(D.mouse[0]=V)),clearTimeout(D.wheel);else{if(te.k===Z)return;D.mouse=[V,te.invert(V)],Cu(this),D.start()}ol(T),D.wheel=setTimeout(J,S),D.zoom("mouse",n(j(E(te,Z),D.mouse[0],D.mouse[1]),D.extent,l));function J(){D.wheel=null,D.end()}}function O(T,...K){if(y||!e.apply(this,arguments))return;var D=T.currentTarget,te=$(this,K,!0).event(T),Z=Hn(T.view).on("mousemove.zoom",Y,!0).on("mouseup.zoom",de,!0),V=or(T,D),J=T.clientX,P=T.clientY;uC(T.view),hf(T),te.mouse=[V,this.__zoom.invert(V)],Cu(this),te.start();function Y(U){if(ol(U),!te.moved){var z=U.clientX-J,Q=U.clientY-P;te.moved=z*z+Q*Q>k}te.event(U).zoom("mouse",n(j(te.that.__zoom,te.mouse[0]=or(U,D),te.mouse[1]),te.extent,l))}function de(U){Z.on("mousemove.zoom mouseup.zoom",null),dC(U.view,te.moved),ol(U),te.event(U).end()}}function A(T,...K){if(e.apply(this,arguments)){var D=this.__zoom,te=or(T.changedTouches?T.changedTouches[0]:T,this),Z=D.invert(te),V=D.k*(T.shiftKey?.5:2),J=n(j(E(D,V),te,Z),t.apply(this,K),l);ol(T),d>0?Hn(this).transition().duration(d).call(M,J,te,T):Hn(this).call(_.transform,J,te,T)}}function L(T,...K){if(e.apply(this,arguments)){var D=T.touches,te=D.length,Z=$(this,K,T.changedTouches.length===te).event(T),V,J,P,Y;for(hf(T),J=0;J<te;++J)P=D[J],Y=or(P,this),Y=[Y,this.__zoom.invert(Y),P.identifier],Z.touch0?!Z.touch1&&Z.touch0[2]!==Y[2]&&(Z.touch1=Y,Z.taps=0):(Z.touch0=Y,V=!0,Z.taps=1+!!h);h&&(h=clearTimeout(h)),V&&(Z.taps<2&&(g=Y[0],h=setTimeout(function(){h=null},w)),Cu(this),Z.start())}}function H(T,...K){if(this.__zooming){var D=$(this,K).event(T),te=T.changedTouches,Z=te.length,V,J,P,Y;for(ol(T),V=0;V<Z;++V)J=te[V],P=or(J,this),D.touch0&&D.touch0[2]===J.identifier?D.touch0[0]=P:D.touch1&&D.touch1[2]===J.identifier&&(D.touch1[0]=P);if(J=D.that.__zoom,D.touch1){var de=D.touch0[0],U=D.touch0[1],z=D.touch1[0],Q=D.touch1[1],W=(W=z[0]-de[0])*W+(W=z[1]-de[1])*W,le=(le=Q[0]-U[0])*le+(le=Q[1]-U[1])*le;J=E(J,Math.sqrt(W/le)),P=[(de[0]+z[0])/2,(de[1]+z[1])/2],Y=[(U[0]+Q[0])/2,(U[1]+Q[1])/2]}else if(D.touch0)P=D.touch0[0],Y=D.touch0[1];else return;D.zoom("touch",n(j(J,P,Y),D.extent,l))}}function X(T,...K){if(this.__zooming){var D=$(this,K).event(T),te=T.changedTouches,Z=te.length,V,J;for(hf(T),y&&clearTimeout(y),y=setTimeout(function(){y=null},w),V=0;V<Z;++V)J=te[V],D.touch0&&D.touch0[2]===J.identifier?delete D.touch0:D.touch1&&D.touch1[2]===J.identifier&&delete D.touch1;if(D.touch1&&!D.touch0&&(D.touch0=D.touch1,delete D.touch1),D.touch0)D.touch0[1]=this.__zoom.invert(D.touch0[0]);else if(D.end(),D.taps===2&&(J=or(J,this),Math.hypot(g[0]-J[0],g[1]-J[1])<N)){var P=Hn(this).on("dblclick.zoom");P&&P.apply(this,arguments)}}}return _.wheelDelta=function(T){return arguments.length?(s=typeof T=="function"?T:cu(+T),_):s},_.filter=function(T){return arguments.length?(e=typeof T=="function"?T:cu(!!T),_):e},_.touchable=function(T){return arguments.length?(a=typeof T=="function"?T:cu(!!T),_):a},_.extent=function(T){return arguments.length?(t=typeof T=="function"?T:cu([[+T[0][0],+T[0][1]],[+T[1][0],+T[1][1]]]),_):t},_.scaleExtent=function(T){return arguments.length?(i[0]=+T[0],i[1]=+T[1],_):[i[0],i[1]]},_.translateExtent=function(T){return arguments.length?(l[0][0]=+T[0][0],l[1][0]=+T[1][0],l[0][1]=+T[0][1],l[1][1]=+T[1][1],_):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},_.constrain=function(T){return arguments.length?(n=T,_):n},_.duration=function(T){return arguments.length?(d=+T,_):d},_.interpolate=function(T){return arguments.length?(f=T,_):f},_.on=function(){var T=p.on.apply(p,arguments);return T===p?_:T},_.clickDistance=function(T){return arguments.length?(k=(T=+T)*T,_):Math.sqrt(k)},_.tapDistance=function(T){return arguments.length?(N=+T,_):N},_}var Rw=Xj();const nd=b.createContext(null),u$=nd.Provider,ss={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.`},EC=ss.error001();function ct(e,t){const n=b.useContext(nd);if(n===null)throw new Error(EC);return Qj(n,e,t)}const Mt=()=>{const e=b.useContext(nd);if(e===null)throw new Error(EC);return b.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},d$=e=>e.userSelectionActive?"none":"all";function Aw({position:e,children:t,className:n,style:s,...a}){const i=ct(d$),l=`${e}`.split("-");return fe.createElement("div",{className:Vt(["react-flow__panel",n,...l]),style:{...s,pointerEvents:i},...a},t)}function h$({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:fe.createElement(Aw,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://reactflow.dev/pro"},fe.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}const f$=({x:e,y:t,label:n,labelStyle:s={},labelShowBg:a=!0,labelBgStyle:i={},labelBgPadding:l=[2,4],labelBgBorderRadius:d=2,children:f,className:p,...h})=>{const g=b.useRef(null),[y,w]=b.useState({x:0,y:0,width:0,height:0}),S=Vt(["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:fe.createElement("g",{transform:`translate(${e-y.width/2} ${t-y.height/2})`,className:S,visibility:y.width?"visible":"hidden",...h},a&&fe.createElement("rect",{width:y.width+2*l[0],x:-l[0],y:-l[1],height:y.height+2*l[1],className:"react-flow__edge-textbg",style:i,rx:d,ry:d}),fe.createElement("text",{className:"react-flow__edge-text",y:y.height/2,dy:"0.3em",ref:g,style:s},n),f)};var p$=b.memo(f$);const Mw=e=>({width:e.offsetWidth,height:e.offsetHeight}),Vo=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Iw=(e={x:0,y:0},t)=>({x:Vo(e.x,t[0][0],t[1][0]),y:Vo(e.y,t[0][1],t[1][1])}),qb=(e,t,n)=>e<t?Vo(Math.abs(e-t),1,50)/50:e>n?-Vo(Math.abs(e-n),1,50)/50:0,jC=(e,t)=>{const n=qb(e.x,35,t.width-35)*20,s=qb(e.y,35,t.height-35)*20;return[n,s]},CC=e=>{var t;return((t=e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},TC=(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)}),El=({x:e,y:t,width:n,height:s})=>({x:e,y:t,x2:e+n,y2:t+s}),RC=({x:e,y:t,x2:n,y2:s})=>({x:e,y:t,width:n-e,height:s-t}),Db=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),m$=(e,t)=>RC(TC(El(e),El(t))),Zv=(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)},g$=e=>Gn(e.width)&&Gn(e.height)&&Gn(e.x)&&Gn(e.y),Gn=e=>!isNaN(e)&&isFinite(e),jt=Symbol.for("internals"),AC=["Enter"," ","Escape"],y$=(e,t)=>{},v$=e=>"nativeEvent"in e;function Jv(e){var a,i;const t=v$(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 MC=e=>"clientX"in e,qs=(e,t)=>{var i,l;const n=MC(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)}},Fu=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0},Ll=({id:e,path:t,labelX:n,labelY:s,label:a,labelStyle:i,labelShowBg:l,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:h,markerEnd:g,markerStart:y,interactionWidth:w=20})=>fe.createElement(fe.Fragment,null,fe.createElement("path",{id:e,style:h,d:t,fill:"none",className:"react-flow__edge-path",markerEnd:g,markerStart:y}),w&&fe.createElement("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:w,className:"react-flow__edge-interaction"}),a&&Gn(n)&&Gn(s)?fe.createElement(p$,{x:n,y:s,label:a,labelStyle:i,labelShowBg:l,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p}):null);Ll.displayName="BaseEdge";function il(e,t,n){return n===void 0?n:s=>{const a=t().edges.find(i=>i.id===e);a&&n(s,{...a})}}function IC({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,d=s<t?s+l:s-l;return[i,d,a,l]}function OC({sourceX:e,sourceY:t,targetX:n,targetY:s,sourceControlX:a,sourceControlY:i,targetControlX:l,targetControlY:d}){const f=e*.125+a*.375+l*.375+n*.125,p=t*.125+i*.375+d*.375+s*.125,h=Math.abs(f-e),g=Math.abs(p-t);return[f,p,h,g]}var Ia;(function(e){e.Strict="strict",e.Loose="loose"})(Ia||(Ia={}));var Ta;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Ta||(Ta={}));var jl;(function(e){e.Partial="partial",e.Full="full"})(jl||(jl={}));var Ls;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Ls||(Ls={}));var zu;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(zu||(zu={}));var qe;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(qe||(qe={}));function Fb({pos:e,x1:t,y1:n,x2:s,y2:a}){return e===qe.Left||e===qe.Right?[.5*(t+s),n]:[t,.5*(n+a)]}function $C({sourceX:e,sourceY:t,sourcePosition:n=qe.Bottom,targetX:s,targetY:a,targetPosition:i=qe.Top}){const[l,d]=Fb({pos:n,x1:e,y1:t,x2:s,y2:a}),[f,p]=Fb({pos:i,x1:s,y1:a,x2:e,y2:t}),[h,g,y,w]=OC({sourceX:e,sourceY:t,targetX:s,targetY:a,sourceControlX:l,sourceControlY:d,targetControlX:f,targetControlY:p});return[`M${e},${t} C${l},${d} ${f},${p} ${s},${a}`,h,g,y,w]}const Ow=b.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,sourcePosition:a=qe.Bottom,targetPosition:i=qe.Top,label:l,labelStyle:d,labelShowBg:f,labelBgStyle:p,labelBgPadding:h,labelBgBorderRadius:g,style:y,markerEnd:w,markerStart:S,interactionWidth:k})=>{const[N,_,E]=$C({sourceX:e,sourceY:t,sourcePosition:a,targetX:n,targetY:s,targetPosition:i});return fe.createElement(Ll,{path:N,labelX:_,labelY:E,label:l,labelStyle:d,labelShowBg:f,labelBgStyle:p,labelBgPadding:h,labelBgBorderRadius:g,style:y,markerEnd:w,markerStart:S,interactionWidth:k})});Ow.displayName="SimpleBezierEdge";const zb={[qe.Left]:{x:-1,y:0},[qe.Right]:{x:1,y:0},[qe.Top]:{x:0,y:-1},[qe.Bottom]:{x:0,y:1}},w$=({source:e,sourcePosition:t=qe.Bottom,target:n})=>t===qe.Left||t===qe.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},Bb=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function x$({source:e,sourcePosition:t=qe.Bottom,target:n,targetPosition:s=qe.Top,center:a,offset:i}){const l=zb[t],d=zb[s],f={x:e.x+l.x*i,y:e.y+l.y*i},p={x:n.x+d.x*i,y:n.y+d.y*i},h=w$({source:f,sourcePosition:t,target:p}),g=h.x!==0?"x":"y",y=h[g];let w=[],S,k;const N={x:0,y:0},_={x:0,y:0},[E,j,C,M]=IC({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[g]*d[g]===-1){S=a.x??E,k=a.y??j;const I=[{x:S,y:f.y},{x:S,y:p.y}],F=[{x:f.x,y:k},{x:p.x,y:k}];l[g]===y?w=g==="x"?I:F:w=g==="x"?F:I}else{const I=[{x:f.x,y:p.y}],F=[{x:p.x,y:f.y}];if(g==="x"?w=l.x===y?F:I:w=l.y===y?I:F,t===s){const X=Math.abs(e[g]-n[g]);if(X<=i){const T=Math.min(i-1,i-X);l[g]===y?N[g]=(f[g]>e[g]?-1:1)*T:_[g]=(p[g]>n[g]?-1:1)*T}}if(t!==s){const X=g==="x"?"y":"x",T=l[g]===d[X],K=f[X]>p[X],D=f[X]<p[X];(l[g]===1&&(!T&&K||T&&D)||l[g]!==1&&(!T&&D||T&&K))&&(w=g==="x"?I:F)}const O={x:f.x+N.x,y:f.y+N.y},A={x:p.x+_.x,y:p.y+_.y},L=Math.max(Math.abs(O.x-w[0].x),Math.abs(A.x-w[0].x)),H=Math.max(Math.abs(O.y-w[0].y),Math.abs(A.y-w[0].y));L>=H?(S=(O.x+A.x)/2,k=w[0].y):(S=w[0].x,k=(O.y+A.y)/2)}return[[e,{x:f.x+N.x,y:f.y+N.y},...w,{x:p.x+_.x,y:p.y+_.y},n],S,k,C,M]}function b$(e,t,n,s){const a=Math.min(Bb(e,t)/2,Bb(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 d=e.x<n.x?1:-1,f=e.y<n.y?-1:1;return`L ${i},${l+a*f}Q ${i},${l} ${i+a*d},${l}`}function ew({sourceX:e,sourceY:t,sourcePosition:n=qe.Bottom,targetX:s,targetY:a,targetPosition:i=qe.Top,borderRadius:l=5,centerX:d,centerY:f,offset:p=20}){const[h,g,y,w,S]=x$({source:{x:e,y:t},sourcePosition:n,target:{x:s,y:a},targetPosition:i,center:{x:d,y:f},offset:p});return[h.reduce((N,_,E)=>{let j="";return E>0&&E<h.length-1?j=b$(h[E-1],_,h[E+1],l):j=`${E===0?"M":"L"}${_.x} ${_.y}`,N+=j,N},""),g,y,w,S]}const rd=b.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,label:a,labelStyle:i,labelShowBg:l,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:h,sourcePosition:g=qe.Bottom,targetPosition:y=qe.Top,markerEnd:w,markerStart:S,pathOptions:k,interactionWidth:N})=>{const[_,E,j]=ew({sourceX:e,sourceY:t,sourcePosition:g,targetX:n,targetY:s,targetPosition:y,borderRadius:k==null?void 0:k.borderRadius,offset:k==null?void 0:k.offset});return fe.createElement(Ll,{path:_,labelX:E,labelY:j,label:a,labelStyle:i,labelShowBg:l,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:h,markerEnd:w,markerStart:S,interactionWidth:N})});rd.displayName="SmoothStepEdge";const $w=b.memo(e=>{var t;return fe.createElement(rd,{...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])})});$w.displayName="StepEdge";function k$({sourceX:e,sourceY:t,targetX:n,targetY:s}){const[a,i,l,d]=IC({sourceX:e,sourceY:t,targetX:n,targetY:s});return[`M ${e},${t}L ${n},${s}`,a,i,l,d]}const Pw=b.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,label:a,labelStyle:i,labelShowBg:l,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:h,markerEnd:g,markerStart:y,interactionWidth:w})=>{const[S,k,N]=k$({sourceX:e,sourceY:t,targetX:n,targetY:s});return fe.createElement(Ll,{path:S,labelX:k,labelY:N,label:a,labelStyle:i,labelShowBg:l,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:h,markerEnd:g,markerStart:y,interactionWidth:w})});Pw.displayName="StraightEdge";function uu(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Ub({pos:e,x1:t,y1:n,x2:s,y2:a,c:i}){switch(e){case qe.Left:return[t-uu(t-s,i),n];case qe.Right:return[t+uu(s-t,i),n];case qe.Top:return[t,n-uu(n-a,i)];case qe.Bottom:return[t,n+uu(a-n,i)]}}function PC({sourceX:e,sourceY:t,sourcePosition:n=qe.Bottom,targetX:s,targetY:a,targetPosition:i=qe.Top,curvature:l=.25}){const[d,f]=Ub({pos:n,x1:e,y1:t,x2:s,y2:a,c:l}),[p,h]=Ub({pos:i,x1:s,y1:a,x2:e,y2:t,c:l}),[g,y,w,S]=OC({sourceX:e,sourceY:t,targetX:s,targetY:a,sourceControlX:d,sourceControlY:f,targetControlX:p,targetControlY:h});return[`M${e},${t} C${d},${f} ${p},${h} ${s},${a}`,g,y,w,S]}const Bu=b.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,sourcePosition:a=qe.Bottom,targetPosition:i=qe.Top,label:l,labelStyle:d,labelShowBg:f,labelBgStyle:p,labelBgPadding:h,labelBgBorderRadius:g,style:y,markerEnd:w,markerStart:S,pathOptions:k,interactionWidth:N})=>{const[_,E,j]=PC({sourceX:e,sourceY:t,sourcePosition:a,targetX:n,targetY:s,targetPosition:i,curvature:k==null?void 0:k.curvature});return fe.createElement(Ll,{path:_,labelX:E,labelY:j,label:l,labelStyle:d,labelShowBg:f,labelBgStyle:p,labelBgPadding:h,labelBgBorderRadius:g,style:y,markerEnd:w,markerStart:S,interactionWidth:N})});Bu.displayName="BezierEdge";const Lw=b.createContext(null),_$=Lw.Provider;Lw.Consumer;const S$=()=>b.useContext(Lw),N$=e=>"id"in e&&"source"in e&&"target"in e,E$=({source:e,sourceHandle:t,target:n,targetHandle:s})=>`reactflow__edge-${e}${t||""}-${n}${s||""}`,tw=(e,t)=>typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(s=>`${s}=${e[s]}`).join("&")}`,j$=(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)),C$=(e,t)=>{if(!e.source||!e.target)return t;let n;return N$(e)?n={...e}:n={...e,id:E$(e)},j$(n,t)?t:t.concat(n)},nw=({x:e,y:t},[n,s,a],i,[l,d])=>{const f={x:(e-n)/a,y:(t-s)/a};return i?{x:l*Math.round(f.x/l),y:d*Math.round(f.y/d)}:f},LC=({x:e,y:t},[n,s,a])=>({x:e*a+n,y:t*a+s}),Aa=(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}},sd=(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}=Aa(a,t).positionAbsolute;return TC(s,El({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 RC(n)},qC=(e,t,[n,s,a]=[0,0,1],i=!1,l=!1,d=[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:y,selectable:w=!0,hidden:S=!1}=h;if(l&&!w||S)return!1;const{positionAbsolute:k}=Aa(h,d),N={x:k.x,y:k.y,width:g||0,height:y||0},_=Zv(f,N),E=typeof g>"u"||typeof y>"u"||g===null||y===null,j=i&&_>0,C=(g||0)*(y||0);(E||j||_>=C||h.dragging)&&p.push(h)}),p},DC=(e,t)=>{const n=e.map(s=>s.id);return t.filter(s=>n.includes(s.source)||n.includes(s.target))},FC=(e,t,n,s,a,i=.1)=>{const l=t/(e.width*(1+i)),d=n/(e.height*(1+i)),f=Math.min(l,d),p=Vo(f,s,a),h=e.x+e.width/2,g=e.y+e.height/2,y=t/2-h*p,w=n/2-g*p;return{x:y,y:w,zoom:p}},ja=(e,t=0)=>e.transition().duration(t);function Wb(e,t,n,s){return(t[n]||[]).reduce((a,i)=>{var l,d;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:(((d=e.positionAbsolute)==null?void 0:d.y)??0)+i.y+i.height/2}),a},[])}function T$(e,t,n,s,a,i){const{x:l,y:d}=qs(e),p=t.elementsFromPoint(l,d).find(S=>S.classList.contains("react-flow__handle"));if(p){const S=p.getAttribute("data-nodeid");if(S){const k=qw(void 0,p),N=p.getAttribute("data-handleid"),_=i({nodeId:S,id:N,type:k});if(_){const E=a.find(j=>j.nodeId===S&&j.type===k&&j.id===N);return{handle:{id:N,type:k,nodeId:S,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(S=>{const k=Math.sqrt((S.x-n.x)**2+(S.y-n.y)**2);if(k<=s){const N=i(S);k<=g&&(k<g?h=[{handle:S,validHandleResult:N}]:k===g&&h.push({handle:S,validHandleResult:N}),g=k)}}),!h.length)return{handle:null,validHandleResult:zC()};if(h.length===1)return h[0];const y=h.some(({validHandleResult:S})=>S.isValid),w=h.some(({handle:S})=>S.type==="target");return h.find(({handle:S,validHandleResult:k})=>w?S.type==="target":y?k.isValid:!0)||h[0]}const R$={source:null,target:null,sourceHandle:null,targetHandle:null},zC=()=>({handleDomNode:null,isValid:!1,connection:R$,endHandle:null});function BC(e,t,n,s,a,i,l){const d=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={...zC(),handleDomNode:f};if(f){const h=qw(void 0,f),g=f.getAttribute("data-nodeid"),y=f.getAttribute("data-handleid"),w=f.classList.contains("connectable"),S=f.classList.contains("connectableend"),k={source:d?g:n,sourceHandle:d?y:s,target:d?n:g,targetHandle:d?s:y};p.connection=k,w&&S&&(t===Ia.Strict?d&&h==="source"||!d&&h==="target":g!==n||y!==s)&&(p.endHandle={nodeId:g,handleId:y,type:h},p.isValid=i(k))}return p}function A$({nodes:e,nodeId:t,handleId:n,handleType:s}){return e.reduce((a,i)=>{if(i[jt]){const{handleBounds:l}=i[jt];let d=[],f=[];l&&(d=Wb(i,l,"source",`${t}-${n}-${s}`),f=Wb(i,l,"target",`${t}-${n}-${s}`)),a.push(...d,...f)}return a},[])}function qw(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function ff(e){e==null||e.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function M$(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}function UC({event:e,handleId:t,nodeId:n,onConnect:s,isTarget:a,getState:i,setState:l,isValidConnection:d,edgeUpdaterType:f,onReconnectEnd:p}){const h=CC(e.target),{connectionMode:g,domNode:y,autoPanOnConnect:w,connectionRadius:S,onConnectStart:k,panBy:N,getNodes:_,cancelConnection:E}=i();let j=0,C;const{x:M,y:$}=qs(e),I=h==null?void 0:h.elementFromPoint(M,$),F=qw(f,I),O=y==null?void 0:y.getBoundingClientRect();if(!O||!F)return;let A,L=qs(e,O),H=!1,X=null,T=!1,K=null;const D=A$({nodes:_(),nodeId:n,handleId:t,handleType:F}),te=()=>{if(!w)return;const[J,P]=jC(L,O);N({x:J,y:P}),j=requestAnimationFrame(te)};l({connectionPosition:L,connectionStatus:null,connectionNodeId:n,connectionHandleId:t,connectionHandleType:F,connectionStartHandle:{nodeId:n,handleId:t,type:F},connectionEndHandle:null}),k==null||k(e,{nodeId:n,handleId:t,handleType:F});function Z(J){const{transform:P}=i();L=qs(J,O);const{handle:Y,validHandleResult:de}=T$(J,h,nw(L,P,!1,[1,1]),S,D,U=>BC(U,g,n,t,a?"target":"source",d,h));if(C=Y,H||(te(),H=!0),K=de.handleDomNode,X=de.connection,T=de.isValid,l({connectionPosition:C&&T?LC({x:C.x,y:C.y},P):L,connectionStatus:M$(!!C,T),connectionEndHandle:de.endHandle}),!C&&!T&&!K)return ff(A);X.source!==X.target&&K&&(ff(A),A=K,K.classList.add("connecting","react-flow__handle-connecting"),K.classList.toggle("valid",T),K.classList.toggle("react-flow__handle-valid",T))}function V(J){var P,Y;(C||K)&&X&&T&&(s==null||s(X)),(Y=(P=i()).onConnectEnd)==null||Y.call(P,J),f&&(p==null||p(J)),ff(A),E(),cancelAnimationFrame(j),H=!1,T=!1,X=null,K=null,h.removeEventListener("mousemove",Z),h.removeEventListener("mouseup",V),h.removeEventListener("touchmove",Z),h.removeEventListener("touchend",V)}h.addEventListener("mousemove",Z),h.addEventListener("mouseup",V),h.addEventListener("touchmove",Z),h.addEventListener("touchend",V)}const Hb=()=>!0,I$=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),O$=(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}},WC=b.forwardRef(({type:e="source",position:t=qe.Top,isValidConnection:n,isConnectable:s=!0,isConnectableStart:a=!0,isConnectableEnd:i=!0,id:l,onConnect:d,children:f,className:p,onMouseDown:h,onTouchStart:g,...y},w)=>{var O,A;const S=l||null,k=e==="target",N=Mt(),_=S$(),{connectOnClick:E,noPanClassName:j}=ct(I$,qt),{connecting:C,clickConnecting:M}=ct(O$(_,S,e),qt);_||(A=(O=N.getState()).onError)==null||A.call(O,"010",ss.error010());const $=L=>{const{defaultEdgeOptions:H,onConnect:X,hasDefaultEdges:T}=N.getState(),K={...H,...L};if(T){const{edges:D,setEdges:te}=N.getState();te(C$(K,D))}X==null||X(K),d==null||d(K)},I=L=>{if(!_)return;const H=MC(L);a&&(H&&L.button===0||!H)&&UC({event:L,handleId:S,nodeId:_,onConnect:$,isTarget:k,getState:N.getState,setState:N.setState,isValidConnection:n||N.getState().isValidConnection||Hb}),H?h==null||h(L):g==null||g(L)},F=L=>{const{onClickConnectStart:H,onClickConnectEnd:X,connectionClickStartHandle:T,connectionMode:K,isValidConnection:D}=N.getState();if(!_||!T&&!a)return;if(!T){H==null||H(L,{nodeId:_,handleId:S,handleType:e}),N.setState({connectionClickStartHandle:{nodeId:_,type:e,handleId:S}});return}const te=CC(L.target),Z=n||D||Hb,{connection:V,isValid:J}=BC({nodeId:_,id:S,type:e},K,T.nodeId,T.handleId||null,T.type,Z,te);J&&$(V),X==null||X(L),N.setState({connectionClickStartHandle:null})};return fe.createElement("div",{"data-handleid":S,"data-nodeid":_,"data-handlepos":t,"data-id":`${_}-${S}-${e}`,className:Vt(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",j,p,{source:!k,target:k,connectable:s,connectablestart:a,connectableend:i,connecting:M,connectionindicator:s&&(a&&!C||i&&C)}]),onMouseDown:I,onTouchStart:I,onClick:E?F:void 0,ref:w,...y},f)});WC.displayName="Handle";var Yo=b.memo(WC);const HC=({data:e,isConnectable:t,targetPosition:n=qe.Top,sourcePosition:s=qe.Bottom})=>fe.createElement(fe.Fragment,null,fe.createElement(Yo,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,fe.createElement(Yo,{type:"source",position:s,isConnectable:t}));HC.displayName="DefaultNode";var rw=b.memo(HC);const GC=({data:e,isConnectable:t,sourcePosition:n=qe.Bottom})=>fe.createElement(fe.Fragment,null,e==null?void 0:e.label,fe.createElement(Yo,{type:"source",position:n,isConnectable:t}));GC.displayName="InputNode";var VC=b.memo(GC);const YC=({data:e,isConnectable:t,targetPosition:n=qe.Top})=>fe.createElement(fe.Fragment,null,fe.createElement(Yo,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label);YC.displayName="OutputNode";var KC=b.memo(YC);const Dw=()=>null;Dw.displayName="GroupNode";const $$=e=>({selectedNodes:e.getNodes().filter(t=>t.selected),selectedEdges:e.edges.filter(t=>t.selected).map(t=>({...t}))}),du=e=>e.id;function P$(e,t){return qt(e.selectedNodes.map(du),t.selectedNodes.map(du))&&qt(e.selectedEdges.map(du),t.selectedEdges.map(du))}const XC=b.memo(({onSelectionChange:e})=>{const t=Mt(),{selectedNodes:n,selectedEdges:s}=ct($$,P$);return b.useEffect(()=>{const a={nodes:n,edges:s};e==null||e(a),t.getState().onSelectionChange.forEach(i=>i(a))},[n,s,e]),null});XC.displayName="SelectionListener";const L$=e=>!!e.onSelectionChange;function q$({onSelectionChange:e}){const t=ct(L$);return e||t?fe.createElement(XC,{onSelectionChange:e}):null}const D$=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 Ro(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 F$=({nodes:e,edges:t,defaultNodes:n,defaultEdges:s,onConnect:a,onConnectStart:i,onConnectEnd:l,onClickConnectStart:d,onClickConnectEnd:f,nodesDraggable:p,nodesConnectable:h,nodesFocusable:g,edgesFocusable:y,edgesUpdatable:w,elevateNodesOnSelect:S,minZoom:k,maxZoom:N,nodeExtent:_,onNodesChange:E,onEdgesChange:j,elementsSelectable:C,connectionMode:M,snapGrid:$,snapToGrid:I,translateExtent:F,connectOnClick:O,defaultEdgeOptions:A,fitView:L,fitViewOptions:H,onNodesDelete:X,onEdgesDelete:T,onNodeDrag:K,onNodeDragStart:D,onNodeDragStop:te,onSelectionDrag:Z,onSelectionDragStart:V,onSelectionDragStop:J,noPanClassName:P,nodeOrigin:Y,rfId:de,autoPanOnConnect:U,autoPanOnNodeDrag:z,onError:Q,connectionRadius:W,isValidConnection:le,nodeDragThreshold:pe})=>{const{setNodes:ge,setEdges:Ne,setDefaultNodesAndEdges:ce,setMinZoom:we,setMaxZoom:Ce,setTranslateExtent:_e,setNodeExtent:We,reset:Se}=ct(D$,qt),re=Mt();return b.useEffect(()=>{const Qe=s==null?void 0:s.map(ft=>({...ft,...A}));return ce(n,Qe),()=>{Se()}},[]),Xe("defaultEdgeOptions",A,re.setState),Xe("connectionMode",M,re.setState),Xe("onConnect",a,re.setState),Xe("onConnectStart",i,re.setState),Xe("onConnectEnd",l,re.setState),Xe("onClickConnectStart",d,re.setState),Xe("onClickConnectEnd",f,re.setState),Xe("nodesDraggable",p,re.setState),Xe("nodesConnectable",h,re.setState),Xe("nodesFocusable",g,re.setState),Xe("edgesFocusable",y,re.setState),Xe("edgesUpdatable",w,re.setState),Xe("elementsSelectable",C,re.setState),Xe("elevateNodesOnSelect",S,re.setState),Xe("snapToGrid",I,re.setState),Xe("snapGrid",$,re.setState),Xe("onNodesChange",E,re.setState),Xe("onEdgesChange",j,re.setState),Xe("connectOnClick",O,re.setState),Xe("fitViewOnInit",L,re.setState),Xe("fitViewOnInitOptions",H,re.setState),Xe("onNodesDelete",X,re.setState),Xe("onEdgesDelete",T,re.setState),Xe("onNodeDrag",K,re.setState),Xe("onNodeDragStart",D,re.setState),Xe("onNodeDragStop",te,re.setState),Xe("onSelectionDrag",Z,re.setState),Xe("onSelectionDragStart",V,re.setState),Xe("onSelectionDragStop",J,re.setState),Xe("noPanClassName",P,re.setState),Xe("nodeOrigin",Y,re.setState),Xe("rfId",de,re.setState),Xe("autoPanOnConnect",U,re.setState),Xe("autoPanOnNodeDrag",z,re.setState),Xe("onError",Q,re.setState),Xe("connectionRadius",W,re.setState),Xe("isValidConnection",le,re.setState),Xe("nodeDragThreshold",pe,re.setState),Ro(e,ge),Ro(t,Ne),Ro(k,we),Ro(N,Ce),Ro(F,_e),Ro(_,We),null},Gb={display:"none"},z$={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},QC="react-flow__node-desc",ZC="react-flow__edge-desc",B$="react-flow__aria-live",U$=e=>e.ariaLiveMessage;function W$({rfId:e}){const t=ct(U$);return fe.createElement("div",{id:`${B$}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:z$},t)}function H$({rfId:e,disableKeyboardA11y:t}){return fe.createElement(fe.Fragment,null,fe.createElement("div",{id:`${QC}-${e}`,style:Gb},"Press enter or space to select a node.",!t&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "),fe.createElement("div",{id:`${ZC}-${e}`,style:Gb},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!t&&fe.createElement(W$,{rfId:e}))}var Cl=(e=null,t={actInsideInputWithModifier:!0})=>{const[n,s]=b.useState(!1),a=b.useRef(!1),i=b.useRef(new Set([])),[l,d]=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,y)=>g.concat(...y),[]);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)&&Jv(w))return!1;const k=Yb(w.code,d);i.current.add(w[k]),Vb(l,i.current,!1)&&(w.preventDefault(),s(!0))},g=w=>{if((!a.current||a.current&&!t.actInsideInputWithModifier)&&Jv(w))return!1;const k=Yb(w.code,d);Vb(l,i.current,!0)?(s(!1),i.current.clear()):i.current.delete(w[k]),w.key==="Meta"&&i.current.clear(),a.current=!1},y=()=>{i.current.clear(),s(!1)};return p==null||p.addEventListener("keydown",h),p==null||p.addEventListener("keyup",g),window.addEventListener("blur",y),()=>{p==null||p.removeEventListener("keydown",h),p==null||p.removeEventListener("keyup",g),window.removeEventListener("blur",y)}}},[e,s]),n};function Vb(e,t,n){return e.filter(s=>n||s.length===t.size).some(s=>s.every(a=>t.has(a)))}function Yb(e,t){return t.includes(e)?"code":"key"}function JC(e,t,n,s){var d,f;const a=e.parentNode||e.parentId;if(!a)return n;const i=t.get(a),l=Aa(i,s);return JC(i,t,{x:(n.x??0)+l.x,y:(n.y??0)+l.y,z:(((d=i[jt])==null?void 0:d.z)??0)>(n.z??0)?((f=i[jt])==null?void 0:f.z)??0:n.z??0},s)}function eT(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:d,z:f}=JC(s,e,{...s.position,z:((i=s[jt])==null?void 0:i.z)??0},t);s.positionAbsolute={x:l,y:d},s[jt].z=f,n!=null&&n[s.id]&&(s[jt].isParent=!0)}})}function pf(e,t,n,s){const a=new Map,i={},l=s?1e3:0;return e.forEach(d=>{var w;const f=(Gn(d.zIndex)?d.zIndex:0)+(d.selected?l:0),p=t.get(d.id),h={...d,positionAbsolute:{x:d.position.x,y:d.position.y}},g=d.parentNode||d.parentId;g&&(i[g]=!0);const y=(p==null?void 0:p.type)&&(p==null?void 0:p.type)!==d.type;Object.defineProperty(h,jt,{enumerable:!1,value:{handleBounds:y||(w=p==null?void 0:p[jt])==null?void 0:w.handleBounds,z:f}}),a.set(d.id,h)}),eT(a,n,i),a}function tT(e,t={}){const{getNodes:n,width:s,height:a,minZoom:i,maxZoom:l,d3Zoom:d,d3Selection:f,fitViewOnInitDone:p,fitViewOnInit:h,nodeOrigin:g}=e(),y=t.initial&&!p&&h;if(d&&f&&(y||!t.initial)){const S=n().filter(N=>{var E;const _=t.includeHiddenNodes?N.width&&N.height:!N.hidden;return(E=t.nodes)!=null&&E.length?_&&t.nodes.some(j=>j.id===N.id):_}),k=S.every(N=>N.width&&N.height);if(S.length>0&&k){const N=sd(S,g),{x:_,y:E,zoom:j}=FC(N,s,a,t.minZoom??i,t.maxZoom??l,t.padding??.1),C=ns.translate(_,E).scale(j);return typeof t.duration=="number"&&t.duration>0?d.transform(ja(f,t.duration),C):d.transform(f,C),!0}}return!1}function G$(e,t){return e.forEach(n=>{const s=t.get(n.id);s&&t.set(s.id,{...s,[jt]:s[jt],selected:n.selected})}),new Map(t)}function V$(e,t){return t.map(n=>{const s=e.find(a=>a.id===n.id);return s&&(n.selected=s.selected),n})}function hu({changedNodes:e,changedEdges:t,get:n,set:s}){const{nodeInternals:a,edges:i,onNodesChange:l,onEdgesChange:d,hasDefaultNodes:f,hasDefaultEdges:p}=n();e!=null&&e.length&&(f&&s({nodeInternals:G$(e,a)}),l==null||l(e)),t!=null&&t.length&&(p&&s({edges:V$(t,i)}),d==null||d(t))}const Ao=()=>{},Y$={zoomIn:Ao,zoomOut:Ao,zoomTo:Ao,getZoom:()=>1,setViewport:Ao,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:Ao,fitBounds:Ao,project:e=>e,screenToFlowPosition:e=>e,flowToScreenPosition:e=>e,viewportInitialized:!1},K$=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),X$=()=>{const e=Mt(),{d3Zoom:t,d3Selection:n}=ct(K$,qt);return b.useMemo(()=>n&&t?{zoomIn:a=>t.scaleBy(ja(n,a==null?void 0:a.duration),1.2),zoomOut:a=>t.scaleBy(ja(n,a==null?void 0:a.duration),1/1.2),zoomTo:(a,i)=>t.scaleTo(ja(n,i==null?void 0:i.duration),a),getZoom:()=>e.getState().transform[2],setViewport:(a,i)=>{const[l,d,f]=e.getState().transform,p=ns.translate(a.x??l,a.y??d).scale(a.zoom??f);t.transform(ja(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=>tT(e.getState,a),setCenter:(a,i,l)=>{const{width:d,height:f,maxZoom:p}=e.getState(),h=typeof(l==null?void 0:l.zoom)<"u"?l.zoom:p,g=d/2-a*h,y=f/2-i*h,w=ns.translate(g,y).scale(h);t.transform(ja(n,l==null?void 0:l.duration),w)},fitBounds:(a,i)=>{const{width:l,height:d,minZoom:f,maxZoom:p}=e.getState(),{x:h,y:g,zoom:y}=FC(a,l,d,f,p,(i==null?void 0:i.padding)??.1),w=ns.translate(h,g).scale(y);t.transform(ja(n,i==null?void 0:i.duration),w)},project:a=>{const{transform:i,snapToGrid:l,snapGrid:d}=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"),nw(a,i,l,d)},screenToFlowPosition:a=>{const{transform:i,snapToGrid:l,snapGrid:d,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 nw(g,i,l,d)},flowToScreenPosition:a=>{const{transform:i,domNode:l}=e.getState();if(!l)return a;const{x:d,y:f}=l.getBoundingClientRect(),p=LC(a,i);return{x:p.x+d,y:p.y+f}},viewportInitialized:!0}:Y$,[t,n])};function ql(){const e=X$(),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(N=>({...N}))},[]),i=b.useCallback(k=>{const{edges:N=[]}=t.getState();return N.find(_=>_.id===k)},[]),l=b.useCallback(k=>{const{getNodes:N,setNodes:_,hasDefaultNodes:E,onNodesChange:j}=t.getState(),C=N(),M=typeof k=="function"?k(C):k;if(E)_(M);else if(j){const $=M.length===0?C.map(I=>({type:"remove",id:I.id})):M.map(I=>({item:I,type:"reset"}));j($)}},[]),d=b.useCallback(k=>{const{edges:N=[],setEdges:_,hasDefaultEdges:E,onEdgesChange:j}=t.getState(),C=typeof k=="function"?k(N):k;if(E)_(C);else if(j){const M=C.length===0?N.map($=>({type:"remove",id:$.id})):C.map($=>({item:$,type:"reset"}));j(M)}},[]),f=b.useCallback(k=>{const N=Array.isArray(k)?k:[k],{getNodes:_,setNodes:E,hasDefaultNodes:j,onNodesChange:C}=t.getState();if(j){const $=[..._(),...N];E($)}else if(C){const M=N.map($=>({item:$,type:"add"}));C(M)}},[]),p=b.useCallback(k=>{const N=Array.isArray(k)?k:[k],{edges:_=[],setEdges:E,hasDefaultEdges:j,onEdgesChange:C}=t.getState();if(j)E([..._,...N]);else if(C){const M=N.map($=>({item:$,type:"add"}));C(M)}},[]),h=b.useCallback(()=>{const{getNodes:k,edges:N=[],transform:_}=t.getState(),[E,j,C]=_;return{nodes:k().map(M=>({...M})),edges:N.map(M=>({...M})),viewport:{x:E,y:j,zoom:C}}},[]),g=b.useCallback(({nodes:k,edges:N})=>{const{nodeInternals:_,getNodes:E,edges:j,hasDefaultNodes:C,hasDefaultEdges:M,onNodesDelete:$,onEdgesDelete:I,onNodesChange:F,onEdgesChange:O}=t.getState(),A=(k||[]).map(K=>K.id),L=(N||[]).map(K=>K.id),H=E().reduce((K,D)=>{const te=D.parentNode||D.parentId,Z=!A.includes(D.id)&&te&&K.find(J=>J.id===te);return(typeof D.deletable=="boolean"?D.deletable:!0)&&(A.includes(D.id)||Z)&&K.push(D),K},[]),X=j.filter(K=>typeof K.deletable=="boolean"?K.deletable:!0),T=X.filter(K=>L.includes(K.id));if(H||T){const K=DC(H,X),D=[...T,...K],te=D.reduce((Z,V)=>(Z.includes(V.id)||Z.push(V.id),Z),[]);if((M||C)&&(M&&t.setState({edges:j.filter(Z=>!te.includes(Z.id))}),C&&(H.forEach(Z=>{_.delete(Z.id)}),t.setState({nodeInternals:new Map(_)}))),te.length>0&&(I==null||I(D),O&&O(te.map(Z=>({id:Z,type:"remove"})))),H.length>0&&($==null||$(H),F)){const Z=H.map(V=>({id:V.id,type:"remove"}));F(Z)}}},[]),y=b.useCallback(k=>{const N=g$(k),_=N?null:t.getState().nodeInternals.get(k.id);return!N&&!_?[null,null,N]:[N?k:Db(_),_,N]},[]),w=b.useCallback((k,N=!0,_)=>{const[E,j,C]=y(k);return E?(_||t.getState().getNodes()).filter(M=>{if(!C&&(M.id===j.id||!M.positionAbsolute))return!1;const $=Db(M),I=Zv($,E);return N&&I>0||I>=E.width*E.height}):[]},[]),S=b.useCallback((k,N,_=!0)=>{const[E]=y(k);if(!E)return!1;const j=Zv(E,N);return _&&j>0||j>=E.width*E.height},[]);return b.useMemo(()=>({...e,getNodes:n,getNode:s,getEdges:a,getEdge:i,setNodes:l,setEdges:d,addNodes:f,addEdges:p,toObject:h,deleteElements:g,getIntersectingNodes:w,isNodeIntersecting:S}),[e,n,s,a,i,l,d,f,p,h,g,w,S])}const Q$={actInsideInputWithModifier:!1};var Z$=({deleteKeyCode:e,multiSelectionKeyCode:t})=>{const n=Mt(),{deleteElements:s}=ql(),a=Cl(e,Q$),i=Cl(t);b.useEffect(()=>{if(a){const{edges:l,getNodes:d}=n.getState(),f=d().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 J$(e){const t=Mt();b.useEffect(()=>{let n;const s=()=>{var i,l;if(!e.current)return;const a=Mw(e.current);(a.height===0||a.width===0)&&((l=(i=t.getState()).onError)==null||l.call(i,"004",ss.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 Fw={position:"absolute",width:"100%",height:"100%",top:0,left:0},eP=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,fu=e=>({x:e.x,y:e.y,zoom:e.k}),Mo=(e,t)=>e.target.closest(`.${t}`),Kb=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Xb=e=>{const t=e.ctrlKey&&Fu()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t},tP=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),nP=({onMove:e,onMoveStart:t,onMoveEnd:n,onPaneContextMenu:s,zoomOnScroll:a=!0,zoomOnPinch:i=!0,panOnScroll:l=!1,panOnScrollSpeed:d=.5,panOnScrollMode:f=Ta.Free,zoomOnDoubleClick:p=!0,elementsSelectable:h,panOnDrag:g=!0,defaultViewport:y,translateExtent:w,minZoom:S,maxZoom:k,zoomActivationKeyCode:N,preventScrolling:_=!0,children:E,noWheelClassName:j,noPanClassName:C})=>{const M=b.useRef(),$=Mt(),I=b.useRef(!1),F=b.useRef(!1),O=b.useRef(null),A=b.useRef({x:0,y:0,zoom:0}),{d3Zoom:L,d3Selection:H,d3ZoomHandler:X,userSelectionActive:T}=ct(tP,qt),K=Cl(N),D=b.useRef(0),te=b.useRef(!1),Z=b.useRef();return J$(O),b.useEffect(()=>{if(O.current){const V=O.current.getBoundingClientRect(),J=NC().scaleExtent([S,k]).translateExtent(w),P=Hn(O.current).call(J),Y=ns.translate(y.x,y.y).scale(Vo(y.zoom,S,k)),de=[[0,0],[V.width,V.height]],U=J.constrain()(Y,de,w);J.transform(P,U),J.wheelDelta(Xb),$.setState({d3Zoom:J,d3Selection:P,d3ZoomHandler:P.on("wheel.zoom"),transform:[U.x,U.y,U.k],domNode:O.current.closest(".react-flow")})}},[]),b.useEffect(()=>{H&&L&&(l&&!K&&!T?H.on("wheel.zoom",V=>{if(Mo(V,j))return!1;V.preventDefault(),V.stopImmediatePropagation();const J=H.property("__zoom").k||1;if(V.ctrlKey&&i){const le=or(V),pe=Xb(V),ge=J*Math.pow(2,pe);L.scaleTo(H,ge,le,V);return}const P=V.deltaMode===1?20:1;let Y=f===Ta.Vertical?0:V.deltaX*P,de=f===Ta.Horizontal?0:V.deltaY*P;!Fu()&&V.shiftKey&&f!==Ta.Vertical&&(Y=V.deltaY*P,de=0),L.translateBy(H,-(Y/J)*d,-(de/J)*d,{internal:!0});const U=fu(H.property("__zoom")),{onViewportChangeStart:z,onViewportChange:Q,onViewportChangeEnd:W}=$.getState();clearTimeout(Z.current),te.current||(te.current=!0,t==null||t(V,U),z==null||z(U)),te.current&&(e==null||e(V,U),Q==null||Q(U),Z.current=setTimeout(()=>{n==null||n(V,U),W==null||W(U),te.current=!1},150))},{passive:!1}):typeof X<"u"&&H.on("wheel.zoom",function(V,J){if(!_&&V.type==="wheel"&&!V.ctrlKey||Mo(V,j))return null;V.preventDefault(),X.call(this,V,J)},{passive:!1}))},[T,l,f,H,L,X,K,i,_,j,t,e,n]),b.useEffect(()=>{L&&L.on("start",V=>{var Y,de;if(!V.sourceEvent||V.sourceEvent.internal)return null;D.current=(Y=V.sourceEvent)==null?void 0:Y.button;const{onViewportChangeStart:J}=$.getState(),P=fu(V.transform);I.current=!0,A.current=P,((de=V.sourceEvent)==null?void 0:de.type)==="mousedown"&&$.setState({paneDragging:!0}),J==null||J(P),t==null||t(V.sourceEvent,P)})},[L,t]),b.useEffect(()=>{L&&(T&&!I.current?L.on("zoom",null):T||L.on("zoom",V=>{var P;const{onViewportChange:J}=$.getState();if($.setState({transform:[V.transform.x,V.transform.y,V.transform.k]}),F.current=!!(s&&Kb(g,D.current??0)),(e||J)&&!((P=V.sourceEvent)!=null&&P.internal)){const Y=fu(V.transform);J==null||J(Y),e==null||e(V.sourceEvent,Y)}}))},[T,L,e,g,s]),b.useEffect(()=>{L&&L.on("end",V=>{if(!V.sourceEvent||V.sourceEvent.internal)return null;const{onViewportChangeEnd:J}=$.getState();if(I.current=!1,$.setState({paneDragging:!1}),s&&Kb(g,D.current??0)&&!F.current&&s(V.sourceEvent),F.current=!1,(n||J)&&eP(A.current,V.transform)){const P=fu(V.transform);A.current=P,clearTimeout(M.current),M.current=setTimeout(()=>{J==null||J(P),n==null||n(V.sourceEvent,P)},l?150:0)}})},[L,l,g,n,s]),b.useEffect(()=>{L&&L.filter(V=>{const J=K||a,P=i&&V.ctrlKey;if((g===!0||Array.isArray(g)&&g.includes(1))&&V.button===1&&V.type==="mousedown"&&(Mo(V,"react-flow__node")||Mo(V,"react-flow__edge")))return!0;if(!g&&!J&&!l&&!p&&!i||T||!p&&V.type==="dblclick"||Mo(V,j)&&V.type==="wheel"||Mo(V,C)&&(V.type!=="wheel"||l&&V.type==="wheel"&&!K)||!i&&V.ctrlKey&&V.type==="wheel"||!J&&!l&&!P&&V.type==="wheel"||!g&&(V.type==="mousedown"||V.type==="touchstart")||Array.isArray(g)&&!g.includes(V.button)&&V.type==="mousedown")return!1;const Y=Array.isArray(g)&&g.includes(V.button)||!V.button||V.button<=1;return(!V.ctrlKey||V.type==="wheel")&&Y})},[T,L,a,i,l,p,g,h,K]),fe.createElement("div",{className:"react-flow__renderer",ref:O,style:Fw},E)},rP=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function sP(){const{userSelectionActive:e,userSelectionRect:t}=ct(rP,qt);return e&&t?fe.createElement("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}function Qb(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 aP(e,t){if(e.some(s=>s.type==="reset"))return e.filter(s=>s.type==="reset").map(s=>s.item);const n=e.filter(s=>s.type==="add").map(s=>s.item);return t.reduce((s,a)=>{const i=e.filter(d=>d.id===a.id);if(i.length===0)return s.push(a),s;const l={...a};for(const d of i)if(d)switch(d.type){case"select":{l.selected=d.selected;break}case"position":{typeof d.position<"u"&&(l.position=d.position),typeof d.positionAbsolute<"u"&&(l.positionAbsolute=d.positionAbsolute),typeof d.dragging<"u"&&(l.dragging=d.dragging),l.expandParent&&Qb(s,l);break}case"dimensions":{typeof d.dimensions<"u"&&(l.width=d.dimensions.width,l.height=d.dimensions.height),typeof d.updateStyle<"u"&&(l.style={...l.style||{},...d.dimensions}),typeof d.resizing=="boolean"&&(l.resizing=d.resizing),l.expandParent&&Qb(s,l);break}case"remove":return s}return s.push(l),s},n)}function oP(e,t){return aP(e,t)}const Ps=(e,t)=>({id:e,type:"select",selected:t});function qo(e,t){return e.reduce((n,s)=>{const a=t.includes(s.id);return!s.selected&&a?(s.selected=!0,n.push(Ps(s.id,!0))):s.selected&&!a&&(s.selected=!1,n.push(Ps(s.id,!1))),n},[])}const mf=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},iP=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),nT=b.memo(({isSelecting:e,selectionMode:t=jl.Full,panOnDrag:n,onSelectionStart:s,onSelectionEnd:a,onPaneClick:i,onPaneContextMenu:l,onPaneScroll:d,onPaneMouseEnter:f,onPaneMouseMove:p,onPaneMouseLeave:h,children:g})=>{const y=b.useRef(null),w=Mt(),S=b.useRef(0),k=b.useRef(0),N=b.useRef(),{userSelectionActive:_,elementsSelectable:E,dragging:j}=ct(iP,qt),C=()=>{w.setState({userSelectionActive:!1,userSelectionRect:null}),S.current=0,k.current=0},M=X=>{i==null||i(X),w.getState().resetSelectedElements(),w.setState({nodesSelectionActive:!1})},$=X=>{if(Array.isArray(n)&&(n!=null&&n.includes(2))){X.preventDefault();return}l==null||l(X)},I=d?X=>d(X):void 0,F=X=>{const{resetSelectedElements:T,domNode:K}=w.getState();if(N.current=K==null?void 0:K.getBoundingClientRect(),!E||!e||X.button!==0||X.target!==y.current||!N.current)return;const{x:D,y:te}=qs(X,N.current);T(),w.setState({userSelectionRect:{width:0,height:0,startX:D,startY:te,x:D,y:te}}),s==null||s(X)},O=X=>{const{userSelectionRect:T,nodeInternals:K,edges:D,transform:te,onNodesChange:Z,onEdgesChange:V,nodeOrigin:J,getNodes:P}=w.getState();if(!e||!N.current||!T)return;w.setState({userSelectionActive:!0,nodesSelectionActive:!1});const Y=qs(X,N.current),de=T.startX??0,U=T.startY??0,z={...T,x:Y.x<de?Y.x:de,y:Y.y<U?Y.y:U,width:Math.abs(Y.x-de),height:Math.abs(Y.y-U)},Q=P(),W=qC(K,z,te,t===jl.Partial,!0,J),le=DC(W,D).map(ge=>ge.id),pe=W.map(ge=>ge.id);if(S.current!==pe.length){S.current=pe.length;const ge=qo(Q,pe);ge.length&&(Z==null||Z(ge))}if(k.current!==le.length){k.current=le.length;const ge=qo(D,le);ge.length&&(V==null||V(ge))}w.setState({userSelectionRect:z})},A=X=>{if(X.button!==0)return;const{userSelectionRect:T}=w.getState();!_&&T&&X.target===y.current&&(M==null||M(X)),w.setState({nodesSelectionActive:S.current>0}),C(),a==null||a(X)},L=X=>{_&&(w.setState({nodesSelectionActive:S.current>0}),a==null||a(X)),C()},H=E&&(e||_);return fe.createElement("div",{className:Vt(["react-flow__pane",{dragging:j,selection:e}]),onClick:H?void 0:mf(M,y),onContextMenu:mf($,y),onWheel:mf(I,y),onMouseEnter:H?void 0:f,onMouseDown:H?F:void 0,onMouseMove:H?O:p,onMouseUp:H?A:void 0,onMouseLeave:H?L:h,ref:y,style:Fw},g,fe.createElement(sP,null))});nT.displayName="Pane";function rT(e,t){const n=e.parentNode||e.parentId;if(!n)return!1;const s=t.get(n);return s?s.selected?!0:rT(s,t):!1}function Zb(e,t,n){let s=e;do{if(s!=null&&s.matches(t))return!0;if(s===n.current)return!1;s=s.parentElement}while(s);return!1}function lP(e,t,n,s){return Array.from(e.values()).filter(a=>(a.selected||a.id===s)&&(!a.parentNode||a.parentId||!rT(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 cP(e,t){return!t||t==="parent"?t:[t[0],[t[1][0]-(e.width||0),t[1][1]-(e.height||0)]]}function sT(e,t,n,s,a=[0,0],i){const l=cP(e,e.extent||s);let d=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:y,y:w}=Aa(g,a).positionAbsolute;d=g&&Gn(y)&&Gn(w)&&Gn(g.width)&&Gn(g.height)?[[y+e.width*a[0],w+e.height*a[1]],[y+g.width-e.width+e.width*a[0],w+g.height-e.height+e.height*a[1]]]:d}else i==null||i("005",ss.error005()),d=l;else if(e.extent&&f&&e.extent!=="parent"){const g=n.get(f),{x:y,y:w}=Aa(g,a).positionAbsolute;d=[[e.extent[0][0]+y,e.extent[0][1]+w],[e.extent[1][0]+y,e.extent[1][1]+w]]}let p={x:0,y:0};if(f){const g=n.get(f);p=Aa(g,a).positionAbsolute}const h=d&&d!=="parent"?Iw(t,d):t;return{position:{x:h.x-p.x,y:h.y-p.y},positionAbsolute:h}}function gf({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 Jb=(e,t,n,s)=>{const a=t.querySelectorAll(e);if(!a||!a.length)return null;const i=Array.from(a),l=t.getBoundingClientRect(),d={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-d.x)/n,y:(p.top-l.top-d.y)/n,...Mw(f)}})};function ll(e,t,n){return n===void 0?n:s=>{const a=t().nodeInternals.get(e);a&&n(s,{...a})}}function sw({id:e,store:t,unselect:n=!1,nodeRef:s}){const{addSelectedNodes:a,unselectNodesAndEdges:i,multiSelectionActive:l,nodeInternals:d,onError:f}=t.getState(),p=d.get(e);if(!p){f==null||f("012",ss.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 uP(){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,d=n.touches?n.touches[0].clientY:n.clientY,f={x:(l-s[0])/s[2],y:(d-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 yf(e){return(t,n,s)=>e==null?void 0:e(t,s)}function aT({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:s,nodeId:a,isSelectable:i,selectNodesOnDrag:l}){const d=Mt(),[f,p]=b.useState(!1),h=b.useRef([]),g=b.useRef({x:null,y:null}),y=b.useRef(0),w=b.useRef(null),S=b.useRef({x:0,y:0}),k=b.useRef(null),N=b.useRef(!1),_=b.useRef(!1),E=b.useRef(!1),j=uP();return b.useEffect(()=>{if(e!=null&&e.current){const C=Hn(e.current),M=({x:F,y:O})=>{const{nodeInternals:A,onNodeDrag:L,onSelectionDrag:H,updateNodePositions:X,nodeExtent:T,snapGrid:K,snapToGrid:D,nodeOrigin:te,onError:Z}=d.getState();g.current={x:F,y:O};let V=!1,J={x:0,y:0,x2:0,y2:0};if(h.current.length>1&&T){const Y=sd(h.current,te);J=El(Y)}if(h.current=h.current.map(Y=>{const de={x:F-Y.distance.x,y:O-Y.distance.y};D&&(de.x=K[0]*Math.round(de.x/K[0]),de.y=K[1]*Math.round(de.y/K[1]));const U=[[T[0][0],T[0][1]],[T[1][0],T[1][1]]];h.current.length>1&&T&&!Y.extent&&(U[0][0]=Y.positionAbsolute.x-J.x+T[0][0],U[1][0]=Y.positionAbsolute.x+(Y.width??0)-J.x2+T[1][0],U[0][1]=Y.positionAbsolute.y-J.y+T[0][1],U[1][1]=Y.positionAbsolute.y+(Y.height??0)-J.y2+T[1][1]);const z=sT(Y,de,A,U,te,Z);return V=V||Y.position.x!==z.position.x||Y.position.y!==z.position.y,Y.position=z.position,Y.positionAbsolute=z.positionAbsolute,Y}),!V)return;X(h.current,!0,!0),p(!0);const P=a?L:yf(H);if(P&&k.current){const[Y,de]=gf({nodeId:a,dragItems:h.current,nodeInternals:A});P(k.current,Y,de)}},$=()=>{if(!w.current)return;const[F,O]=jC(S.current,w.current);if(F!==0||O!==0){const{transform:A,panBy:L}=d.getState();g.current.x=(g.current.x??0)-F/A[2],g.current.y=(g.current.y??0)-O/A[2],L({x:F,y:O})&&M(g.current)}y.current=requestAnimationFrame($)},I=F=>{var te;const{nodeInternals:O,multiSelectionActive:A,nodesDraggable:L,unselectNodesAndEdges:H,onNodeDragStart:X,onSelectionDragStart:T}=d.getState();_.current=!0;const K=a?X:yf(T);(!l||!i)&&!A&&a&&((te=O.get(a))!=null&&te.selected||H()),a&&i&&l&&sw({id:a,store:d,nodeRef:e});const D=j(F);if(g.current=D,h.current=lP(O,L,D,a),K&&h.current){const[Z,V]=gf({nodeId:a,dragItems:h.current,nodeInternals:O});K(F.sourceEvent,Z,V)}};if(t)C.on(".drag",null);else{const F=xI().on("start",O=>{const{domNode:A,nodeDragThreshold:L}=d.getState();L===0&&I(O),E.current=!1;const H=j(O);g.current=H,w.current=(A==null?void 0:A.getBoundingClientRect())||null,S.current=qs(O.sourceEvent,w.current)}).on("drag",O=>{var X,T;const A=j(O),{autoPanOnNodeDrag:L,nodeDragThreshold:H}=d.getState();if(O.sourceEvent.type==="touchmove"&&O.sourceEvent.touches.length>1&&(E.current=!0),!E.current){if(!N.current&&_.current&&L&&(N.current=!0,$()),!_.current){const K=A.xSnapped-(((X=g==null?void 0:g.current)==null?void 0:X.x)??0),D=A.ySnapped-(((T=g==null?void 0:g.current)==null?void 0:T.y)??0);Math.sqrt(K*K+D*D)>H&&I(O)}(g.current.x!==A.xSnapped||g.current.y!==A.ySnapped)&&h.current&&_.current&&(k.current=O.sourceEvent,S.current=qs(O.sourceEvent,w.current),M(A))}}).on("end",O=>{if(!(!_.current||E.current)&&(p(!1),N.current=!1,_.current=!1,cancelAnimationFrame(y.current),h.current)){const{updateNodePositions:A,nodeInternals:L,onNodeDragStop:H,onSelectionDragStop:X}=d.getState(),T=a?H:yf(X);if(A(h.current,!1,!1),T){const[K,D]=gf({nodeId:a,dragItems:h.current,nodeInternals:L});T(O.sourceEvent,K,D)}}}).filter(O=>{const A=O.target;return!O.button&&(!n||!Zb(A,`.${n}`,e))&&(!s||Zb(A,s,e))});return C.call(F),()=>{C.on(".drag",null)}}}},[e,t,n,s,i,d,a,l,j]),f}function oT(){const e=Mt();return b.useCallback(n=>{const{nodeInternals:s,nodeExtent:a,updateNodePositions:i,getNodes:l,snapToGrid:d,snapGrid:f,onError:p,nodesDraggable:h}=e.getState(),g=l().filter(E=>E.selected&&(E.draggable||h&&typeof E.draggable>"u")),y=d?f[0]:5,w=d?f[1]:5,S=n.isShiftPressed?4:1,k=n.x*y*S,N=n.y*w*S,_=g.map(E=>{if(E.positionAbsolute){const j={x:E.positionAbsolute.x+k,y:E.positionAbsolute.y+N};d&&(j.x=f[0]*Math.round(j.x/f[0]),j.y=f[1]*Math.round(j.y/f[1]));const{positionAbsolute:C,position:M}=sT(E,j,s,a,void 0,p);E.position=M,E.positionAbsolute=C}return E});i(_,!0,!1)},[])}const Uo={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var cl=e=>{const t=({id:n,type:s,data:a,xPos:i,yPos:l,xPosOrigin:d,yPosOrigin:f,selected:p,onClick:h,onMouseEnter:g,onMouseMove:y,onMouseLeave:w,onContextMenu:S,onDoubleClick:k,style:N,className:_,isDraggable:E,isSelectable:j,isConnectable:C,isFocusable:M,selectNodesOnDrag:$,sourcePosition:I,targetPosition:F,hidden:O,resizeObserver:A,dragHandle:L,zIndex:H,isParent:X,noDragClassName:T,noPanClassName:K,initialized:D,disableKeyboardA11y:te,ariaLabel:Z,rfId:V,hasHandleBounds:J})=>{const P=Mt(),Y=b.useRef(null),de=b.useRef(null),U=b.useRef(I),z=b.useRef(F),Q=b.useRef(s),W=j||E||h||g||y||w,le=oT(),pe=ll(n,P.getState,g),ge=ll(n,P.getState,y),Ne=ll(n,P.getState,w),ce=ll(n,P.getState,S),we=ll(n,P.getState,k),Ce=Se=>{const{nodeDragThreshold:re}=P.getState();if(j&&(!$||!E||re>0)&&sw({id:n,store:P,nodeRef:Y}),h){const Qe=P.getState().nodeInternals.get(n);Qe&&h(Se,{...Qe})}},_e=Se=>{if(!Jv(Se)&&!te)if(AC.includes(Se.key)&&j){const re=Se.key==="Escape";sw({id:n,store:P,unselect:re,nodeRef:Y})}else E&&p&&Object.prototype.hasOwnProperty.call(Uo,Se.key)&&(P.setState({ariaLiveMessage:`Moved selected node ${Se.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~i}, y: ${~~l}`}),le({x:Uo[Se.key].x,y:Uo[Se.key].y,isShiftPressed:Se.shiftKey}))};b.useEffect(()=>()=>{de.current&&(A==null||A.unobserve(de.current),de.current=null)},[]),b.useEffect(()=>{if(Y.current&&!O){const Se=Y.current;(!D||!J||de.current!==Se)&&(de.current&&(A==null||A.unobserve(de.current)),A==null||A.observe(Se),de.current=Se)}},[O,D,J]),b.useEffect(()=>{const Se=Q.current!==s,re=U.current!==I,Qe=z.current!==F;Y.current&&(Se||re||Qe)&&(Se&&(Q.current=s),re&&(U.current=I),Qe&&(z.current=F),P.getState().updateNodeDimensions([{id:n,nodeElement:Y.current,forceUpdate:!0}]))},[n,s,I,F]);const We=aT({nodeRef:Y,disabled:O||!E,noDragClassName:T,handleSelector:L,nodeId:n,isSelectable:j,selectNodesOnDrag:$});return O?null:fe.createElement("div",{className:Vt(["react-flow__node",`react-flow__node-${s}`,{[K]:E},_,{selected:p,selectable:j,parent:X,dragging:We}]),ref:Y,style:{zIndex:H,transform:`translate(${d}px,${f}px)`,pointerEvents:W?"all":"none",visibility:D?"visible":"hidden",...N},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:pe,onMouseMove:ge,onMouseLeave:Ne,onContextMenu:ce,onClick:Ce,onDoubleClick:we,onKeyDown:M?_e:void 0,tabIndex:M?0:void 0,role:M?"button":void 0,"aria-describedby":te?void 0:`${QC}-${V}`,"aria-label":Z},fe.createElement(_$,{value:n},fe.createElement(e,{id:n,data:a,type:s,xPos:i,yPos:l,selected:p,isConnectable:C,sourcePosition:I,targetPosition:F,dragging:We,dragHandle:L,zIndex:H})))};return t.displayName="NodeWrapper",b.memo(t)};const dP=e=>{const t=e.getNodes().filter(n=>n.selected);return{...sd(t,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};function hP({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const s=Mt(),{width:a,height:i,x:l,y:d,transformString:f,userSelectionActive:p}=ct(dP,qt),h=oT(),g=b.useRef(null);if(b.useEffect(()=>{var S;n||(S=g.current)==null||S.focus({preventScroll:!0})},[n]),aT({nodeRef:g}),p||!a||!i)return null;const y=e?S=>{const k=s.getState().getNodes().filter(N=>N.selected);e(S,k)}:void 0,w=S=>{Object.prototype.hasOwnProperty.call(Uo,S.key)&&h({x:Uo[S.key].x,y:Uo[S.key].y,isShiftPressed:S.shiftKey})};return fe.createElement("div",{className:Vt(["react-flow__nodesselection","react-flow__container",t]),style:{transform:f}},fe.createElement("div",{ref:g,className:"react-flow__nodesselection-rect",onContextMenu:y,tabIndex:n?void 0:-1,onKeyDown:n?void 0:w,style:{width:a,height:i,top:d,left:l}}))}var fP=b.memo(hP);const pP=e=>e.nodesSelectionActive,iT=({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:s,onPaneMouseLeave:a,onPaneContextMenu:i,onPaneScroll:l,deleteKeyCode:d,onMove:f,onMoveStart:p,onMoveEnd:h,selectionKeyCode:g,selectionOnDrag:y,selectionMode:w,onSelectionStart:S,onSelectionEnd:k,multiSelectionKeyCode:N,panActivationKeyCode:_,zoomActivationKeyCode:E,elementsSelectable:j,zoomOnScroll:C,zoomOnPinch:M,panOnScroll:$,panOnScrollSpeed:I,panOnScrollMode:F,zoomOnDoubleClick:O,panOnDrag:A,defaultViewport:L,translateExtent:H,minZoom:X,maxZoom:T,preventScrolling:K,onSelectionContextMenu:D,noWheelClassName:te,noPanClassName:Z,disableKeyboardA11y:V})=>{const J=ct(pP),P=Cl(g),Y=Cl(_),de=Y||A,U=Y||$,z=P||y&&de!==!0;return Z$({deleteKeyCode:d,multiSelectionKeyCode:N}),fe.createElement(nP,{onMove:f,onMoveStart:p,onMoveEnd:h,onPaneContextMenu:i,elementsSelectable:j,zoomOnScroll:C,zoomOnPinch:M,panOnScroll:U,panOnScrollSpeed:I,panOnScrollMode:F,zoomOnDoubleClick:O,panOnDrag:!P&&de,defaultViewport:L,translateExtent:H,minZoom:X,maxZoom:T,zoomActivationKeyCode:E,preventScrolling:K,noWheelClassName:te,noPanClassName:Z},fe.createElement(nT,{onSelectionStart:S,onSelectionEnd:k,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:s,onPaneMouseLeave:a,onPaneContextMenu:i,onPaneScroll:l,panOnDrag:de,isSelecting:!!z,selectionMode:w},e,J&&fe.createElement(fP,{onSelectionContextMenu:D,noPanClassName:Z,disableKeyboardA11y:V})))};iT.displayName="FlowRenderer";var mP=b.memo(iT);function gP(e){return ct(b.useCallback(n=>e?qC(n.nodeInternals,{x:0,y:0,width:n.width,height:n.height},n.transform,!0):n.getNodes(),[e]))}function yP(e){const t={input:cl(e.input||VC),default:cl(e.default||rw),output:cl(e.output||KC),group:cl(e.group||Dw)},n={},s=Object.keys(e).filter(a=>!["input","default","output","group"].includes(a)).reduce((a,i)=>(a[i]=cl(e[i]||rw),a),n);return{...t,...s}}const vP=({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]},wP=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),lT=e=>{const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:s,elementsSelectable:a,updateNodeDimensions:i,onError:l}=ct(wP,qt),d=gP(e.onlyRenderVisibleElements),f=b.useRef(),p=b.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const h=new ResizeObserver(g=>{const y=g.map(w=>({id:w.target.getAttribute("data-id"),nodeElement:w.target,forceUpdate:!0}));i(y)});return f.current=h,h},[]);return b.useEffect(()=>()=>{var h;(h=f==null?void 0:f.current)==null||h.disconnect()},[]),fe.createElement("div",{className:"react-flow__nodes",style:Fw},d.map(h=>{var M,$,I;let g=h.type||"default";e.nodeTypes[g]||(l==null||l("003",ss.error003(g)),g="default");const y=e.nodeTypes[g]||e.nodeTypes.default,w=!!(h.draggable||t&&typeof h.draggable>"u"),S=!!(h.selectable||a&&typeof h.selectable>"u"),k=!!(h.connectable||n&&typeof h.connectable>"u"),N=!!(h.focusable||s&&typeof h.focusable>"u"),_=e.nodeExtent?Iw(h.positionAbsolute,e.nodeExtent):h.positionAbsolute,E=(_==null?void 0:_.x)??0,j=(_==null?void 0:_.y)??0,C=vP({x:E,y:j,width:h.width??0,height:h.height??0,origin:e.nodeOrigin});return fe.createElement(y,{key:h.id,id:h.id,className:h.className,style:h.style,type:g,data:h.data,sourcePosition:h.sourcePosition||qe.Bottom,targetPosition:h.targetPosition||qe.Top,hidden:h.hidden,xPos:E,yPos:j,xPosOrigin:C.x,yPosOrigin:C.y,selectNodesOnDrag:e.selectNodesOnDrag,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,selected:!!h.selected,isDraggable:w,isSelectable:S,isConnectable:k,isFocusable:N,resizeObserver:p,dragHandle:h.dragHandle,zIndex:((M=h[jt])==null?void 0:M.z)??0,isParent:!!(($=h[jt])!=null&&$.isParent),noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!h.width&&!!h.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:h.ariaLabel,hasHandleBounds:!!((I=h[jt])!=null&&I.handleBounds)})}))};lT.displayName="NodeRenderer";var xP=b.memo(lT);const bP=(e,t,n)=>n===qe.Left?e-t:n===qe.Right?e+t:e,kP=(e,t,n)=>n===qe.Top?e-t:n===qe.Bottom?e+t:e,ek="react-flow__edgeupdater",tk=({position:e,centerX:t,centerY:n,radius:s=10,onMouseDown:a,onMouseEnter:i,onMouseOut:l,type:d})=>fe.createElement("circle",{onMouseDown:a,onMouseEnter:i,onMouseOut:l,className:Vt([ek,`${ek}-${d}`]),cx:bP(t,s,e),cy:kP(n,s,e),r:s,stroke:"transparent",fill:"transparent"}),_P=()=>!0;var Io=e=>{const t=({id:n,className:s,type:a,data:i,onClick:l,onEdgeDoubleClick:d,selected:f,animated:p,label:h,labelStyle:g,labelShowBg:y,labelBgStyle:w,labelBgPadding:S,labelBgBorderRadius:k,style:N,source:_,target:E,sourceX:j,sourceY:C,targetX:M,targetY:$,sourcePosition:I,targetPosition:F,elementsSelectable:O,hidden:A,sourceHandleId:L,targetHandleId:H,onContextMenu:X,onMouseEnter:T,onMouseMove:K,onMouseLeave:D,reconnectRadius:te,onReconnect:Z,onReconnectStart:V,onReconnectEnd:J,markerEnd:P,markerStart:Y,rfId:de,ariaLabel:U,isFocusable:z,isReconnectable:Q,pathOptions:W,interactionWidth:le,disableKeyboardA11y:pe})=>{const ge=b.useRef(null),[Ne,ce]=b.useState(!1),[we,Ce]=b.useState(!1),_e=Mt(),We=b.useMemo(()=>`url('#${tw(Y,de)}')`,[Y,de]),Se=b.useMemo(()=>`url('#${tw(P,de)}')`,[P,de]);if(A)return null;const re=je=>{var Oe;const{edges:Fe,addSelectedEdges:Ee,unselectNodesAndEdges:Ue,multiSelectionActive:_t}=_e.getState(),vt=Fe.find(it=>it.id===n);vt&&(O&&(_e.setState({nodesSelectionActive:!1}),vt.selected&&_t?(Ue({nodes:[],edges:[vt]}),(Oe=ge.current)==null||Oe.blur()):Ee([n])),l&&l(je,vt))},Qe=il(n,_e.getState,d),ft=il(n,_e.getState,X),ut=il(n,_e.getState,T),at=il(n,_e.getState,K),Ye=il(n,_e.getState,D),me=(je,Fe)=>{if(je.button!==0)return;const{edges:Ee,isValidConnection:Ue}=_e.getState(),_t=Fe?E:_,vt=(Fe?H:L)||null,Oe=Fe?"target":"source",it=Ue||_P,wt=Fe,xt=Ee.find(In=>In.id===n);Ce(!0),V==null||V(je,xt,Oe);const tn=In=>{Ce(!1),J==null||J(In,xt,Oe)};UC({event:je,handleId:vt,nodeId:_t,onConnect:In=>Z==null?void 0:Z(xt,In),isTarget:wt,getState:_e.getState,setState:_e.setState,isValidConnection:it,edgeUpdaterType:Oe,onReconnectEnd:tn})},be=je=>me(je,!0),De=je=>me(je,!1),He=()=>ce(!0),ot=()=>ce(!1),Le=!O&&!l,se=je=>{var Fe;if(!pe&&AC.includes(je.key)&&O){const{unselectNodesAndEdges:Ee,addSelectedEdges:Ue,edges:_t}=_e.getState();je.key==="Escape"?((Fe=ge.current)==null||Fe.blur(),Ee({edges:[_t.find(Oe=>Oe.id===n)]})):Ue([n])}};return fe.createElement("g",{className:Vt(["react-flow__edge",`react-flow__edge-${a}`,s,{selected:f,animated:p,inactive:Le,updating:Ne}]),onClick:re,onDoubleClick:Qe,onContextMenu:ft,onMouseEnter:ut,onMouseMove:at,onMouseLeave:Ye,onKeyDown:z?se:void 0,tabIndex:z?0:void 0,role:z?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":U===null?void 0:U||`Edge from ${_} to ${E}`,"aria-describedby":z?`${ZC}-${de}`:void 0,ref:ge},!we&&fe.createElement(e,{id:n,source:_,target:E,selected:f,animated:p,label:h,labelStyle:g,labelShowBg:y,labelBgStyle:w,labelBgPadding:S,labelBgBorderRadius:k,data:i,style:N,sourceX:j,sourceY:C,targetX:M,targetY:$,sourcePosition:I,targetPosition:F,sourceHandleId:L,targetHandleId:H,markerStart:We,markerEnd:Se,pathOptions:W,interactionWidth:le}),Q&&fe.createElement(fe.Fragment,null,(Q==="source"||Q===!0)&&fe.createElement(tk,{position:I,centerX:j,centerY:C,radius:te,onMouseDown:be,onMouseEnter:He,onMouseOut:ot,type:"source"}),(Q==="target"||Q===!0)&&fe.createElement(tk,{position:F,centerX:M,centerY:$,radius:te,onMouseDown:De,onMouseEnter:He,onMouseOut:ot,type:"target"})))};return t.displayName="EdgeWrapper",b.memo(t)};function SP(e){const t={default:Io(e.default||Bu),straight:Io(e.bezier||Pw),step:Io(e.step||$w),smoothstep:Io(e.step||rd),simplebezier:Io(e.simplebezier||Ow)},n={},s=Object.keys(e).filter(a=>!["default","bezier"].includes(a)).reduce((a,i)=>(a[i]=Io(e[i]||Bu),a),n);return{...t,...s}}function nk(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 qe.Top:return{x:s+i/2,y:a};case qe.Right:return{x:s+i,y:a+l/2};case qe.Bottom:return{x:s+i/2,y:a+l};case qe.Left:return{x:s,y:a+l/2}}}function rk(e,t){return e?e.length===1||!t?e[0]:t&&e.find(n=>n.id===t)||null:null}const NP=(e,t,n,s,a,i)=>{const l=nk(n,e,t),d=nk(i,s,a);return{sourceX:l.x,sourceY:l.y,targetX:d.x,targetY:d.y}};function EP({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:s,targetWidth:a,targetHeight:i,width:l,height:d,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=El({x:(0-f[0])/f[2],y:(0-f[1])/f[2],width:l/f[2],height:d/f[2]}),g=Math.max(0,Math.min(h.x2,p.x2)-Math.max(h.x,p.x)),y=Math.max(0,Math.min(h.y2,p.y2)-Math.max(h.y,p.y));return Math.ceil(g*y)>0}function sk(e){var s,a,i,l,d;const t=((s=e==null?void 0:e[jt])==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:((d=e==null?void 0:e.positionAbsolute)==null?void 0:d.y)||0,width:(e==null?void 0:e.width)||0,height:(e==null?void 0:e.height)||0},t,!!n]}const jP=[{level:0,isMaxLevel:!0,edges:[]}];function CP(e,t,n=!1){let s=-1;const a=e.reduce((l,d)=>{var h,g;const f=Gn(d.zIndex);let p=f?d.zIndex:0;if(n){const y=t.get(d.target),w=t.get(d.source),S=d.selected||(y==null?void 0:y.selected)||(w==null?void 0:w.selected),k=Math.max(((h=w==null?void 0:w[jt])==null?void 0:h.z)||0,((g=y==null?void 0:y[jt])==null?void 0:g.z)||0,1e3);p=(f?d.zIndex:0)+(S?k:0)}return l[p]?l[p].push(d):l[p]=[d],s=p>s?p:s,l},{}),i=Object.entries(a).map(([l,d])=>{const f=+l;return{edges:d,level:f,isMaxLevel:f===s}});return i.length===0?jP:i}function TP(e,t,n){const s=ct(b.useCallback(a=>e?a.edges.filter(i=>{const l=t.get(i.source),d=t.get(i.target);return(l==null?void 0:l.width)&&(l==null?void 0:l.height)&&(d==null?void 0:d.width)&&(d==null?void 0:d.height)&&EP({sourcePos:l.positionAbsolute||{x:0,y:0},targetPos:d.positionAbsolute||{x:0,y:0},sourceWidth:l.width,sourceHeight:l.height,targetWidth:d.width,targetHeight:d.height,width:a.width,height:a.height,transform:a.transform})}):a.edges,[e,t]));return CP(s,t,n)}const RP=({color:e="none",strokeWidth:t=1})=>fe.createElement("polyline",{style:{stroke:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),AP=({color:e="none",strokeWidth:t=1})=>fe.createElement("polyline",{style:{stroke:e,fill:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),ak={[zu.Arrow]:RP,[zu.ArrowClosed]:AP};function MP(e){const t=Mt();return b.useMemo(()=>{var a,i;return Object.prototype.hasOwnProperty.call(ak,e)?ak[e]:((i=(a=t.getState()).onError)==null||i.call(a,"009",ss.error009(e)),null)},[e])}const IP=({id:e,type:t,color:n,width:s=12.5,height:a=12.5,markerUnits:i="strokeWidth",strokeWidth:l,orient:d="auto-start-reverse"})=>{const f=MP(t);return f?fe.createElement("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${s}`,markerHeight:`${a}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:d,refX:"0",refY:"0"},fe.createElement(f,{color:n,strokeWidth:l})):null},OP=({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 d=tw(l,t);s.includes(d)||(a.push({id:d,color:l.color||e,...l}),s.push(d))}}),a),[]).sort((a,i)=>a.id.localeCompare(i.id))},cT=({defaultColor:e,rfId:t})=>{const n=ct(b.useCallback(OP({defaultColor:e,rfId:t}),[e,t]),(s,a)=>!(s.length!==a.length||s.some((i,l)=>i.id!==a[l].id)));return fe.createElement("defs",null,n.map(s=>fe.createElement(IP,{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})))};cT.displayName="MarkerDefinitions";var $P=b.memo(cT);const PP=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}),uT=({defaultMarkerColor:e,onlyRenderVisibleElements:t,elevateEdgesOnSelect:n,rfId:s,edgeTypes:a,noPanClassName:i,onEdgeContextMenu:l,onEdgeMouseEnter:d,onEdgeMouseMove:f,onEdgeMouseLeave:p,onEdgeClick:h,onEdgeDoubleClick:g,onReconnect:y,onReconnectStart:w,onReconnectEnd:S,reconnectRadius:k,children:N,disableKeyboardA11y:_})=>{const{edgesFocusable:E,edgesUpdatable:j,elementsSelectable:C,width:M,height:$,connectionMode:I,nodeInternals:F,onError:O}=ct(PP,qt),A=TP(t,F,n);return M?fe.createElement(fe.Fragment,null,A.map(({level:L,edges:H,isMaxLevel:X})=>fe.createElement("svg",{key:L,style:{zIndex:L},width:M,height:$,className:"react-flow__edges react-flow__container"},X&&fe.createElement($P,{defaultColor:e,rfId:s}),fe.createElement("g",null,H.map(T=>{const[K,D,te]=sk(F.get(T.source)),[Z,V,J]=sk(F.get(T.target));if(!te||!J)return null;let P=T.type||"default";a[P]||(O==null||O("011",ss.error011(P)),P="default");const Y=a[P]||a.default,de=I===Ia.Strict?V.target:(V.target??[]).concat(V.source??[]),U=rk(D.source,T.sourceHandle),z=rk(de,T.targetHandle),Q=(U==null?void 0:U.position)||qe.Bottom,W=(z==null?void 0:z.position)||qe.Top,le=!!(T.focusable||E&&typeof T.focusable>"u"),pe=T.reconnectable||T.updatable,ge=typeof y<"u"&&(pe||j&&typeof pe>"u");if(!U||!z)return O==null||O("008",ss.error008(U,T)),null;const{sourceX:Ne,sourceY:ce,targetX:we,targetY:Ce}=NP(K,U,Q,Z,z,W);return fe.createElement(Y,{key:T.id,id:T.id,className:Vt([T.className,i]),type:P,data:T.data,selected:!!T.selected,animated:!!T.animated,hidden:!!T.hidden,label:T.label,labelStyle:T.labelStyle,labelShowBg:T.labelShowBg,labelBgStyle:T.labelBgStyle,labelBgPadding:T.labelBgPadding,labelBgBorderRadius:T.labelBgBorderRadius,style:T.style,source:T.source,target:T.target,sourceHandleId:T.sourceHandle,targetHandleId:T.targetHandle,markerEnd:T.markerEnd,markerStart:T.markerStart,sourceX:Ne,sourceY:ce,targetX:we,targetY:Ce,sourcePosition:Q,targetPosition:W,elementsSelectable:C,onContextMenu:l,onMouseEnter:d,onMouseMove:f,onMouseLeave:p,onClick:h,onEdgeDoubleClick:g,onReconnect:y,onReconnectStart:w,onReconnectEnd:S,reconnectRadius:k,rfId:s,ariaLabel:T.ariaLabel,isFocusable:le,isReconnectable:ge,pathOptions:"pathOptions"in T?T.pathOptions:void 0,interactionWidth:T.interactionWidth,disableKeyboardA11y:_})})))),N):null};uT.displayName="EdgeRenderer";var LP=b.memo(uT);const qP=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function DP({children:e}){const t=ct(qP);return fe.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:t}},e)}function FP(e){const t=ql(),n=b.useRef(!1);b.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const zP={[qe.Left]:qe.Right,[qe.Right]:qe.Left,[qe.Top]:qe.Bottom,[qe.Bottom]:qe.Top},dT=({nodeId:e,handleType:t,style:n,type:s=Ls.Bezier,CustomComponent:a,connectionStatus:i})=>{var $,I,F;const{fromNode:l,handleId:d,toX:f,toY:p,connectionMode:h}=ct(b.useCallback(O=>({fromNode:O.nodeInternals.get(e),handleId:O.connectionHandleId,toX:(O.connectionPosition.x-O.transform[0])/O.transform[2],toY:(O.connectionPosition.y-O.transform[1])/O.transform[2],connectionMode:O.connectionMode}),[e]),qt),g=($=l==null?void 0:l[jt])==null?void 0:$.handleBounds;let y=g==null?void 0:g[t];if(h===Ia.Loose&&(y=y||(g==null?void 0:g[t==="source"?"target":"source"])),!l||!y)return null;const w=d?y.find(O=>O.id===d):y[0],S=w?w.x+w.width/2:(l.width??0)/2,k=w?w.y+w.height/2:l.height??0,N=(((I=l.positionAbsolute)==null?void 0:I.x)??0)+S,_=(((F=l.positionAbsolute)==null?void 0:F.y)??0)+k,E=w==null?void 0:w.position,j=E?zP[E]:null;if(!E||!j)return null;if(a)return fe.createElement(a,{connectionLineType:s,connectionLineStyle:n,fromNode:l,fromHandle:w,fromX:N,fromY:_,toX:f,toY:p,fromPosition:E,toPosition:j,connectionStatus:i});let C="";const M={sourceX:N,sourceY:_,sourcePosition:E,targetX:f,targetY:p,targetPosition:j};return s===Ls.Bezier?[C]=PC(M):s===Ls.Step?[C]=ew({...M,borderRadius:0}):s===Ls.SmoothStep?[C]=ew(M):s===Ls.SimpleBezier?[C]=$C(M):C=`M${N},${_} ${f},${p}`,fe.createElement("path",{d:C,fill:"none",className:"react-flow__connection-path",style:n})};dT.displayName="ConnectionLine";const BP=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function UP({containerStyle:e,style:t,type:n,component:s}){const{nodeId:a,handleType:i,nodesConnectable:l,width:d,height:f,connectionStatus:p}=ct(BP,qt);return!(a&&i&&d&&l)?null:fe.createElement("svg",{style:e,width:d,height:f,className:"react-flow__edges react-flow__connectionline react-flow__container"},fe.createElement("g",{className:Vt(["react-flow__connection",p])},fe.createElement(dT,{nodeId:a,handleType:i,style:t,type:n,CustomComponent:s,connectionStatus:p})))}function ok(e,t){return b.useRef(null),Mt(),b.useMemo(()=>t(e),[e])}const hT=({nodeTypes:e,edgeTypes:t,onMove:n,onMoveStart:s,onMoveEnd:a,onInit:i,onNodeClick:l,onEdgeClick:d,onNodeDoubleClick:f,onEdgeDoubleClick:p,onNodeMouseEnter:h,onNodeMouseMove:g,onNodeMouseLeave:y,onNodeContextMenu:w,onSelectionContextMenu:S,onSelectionStart:k,onSelectionEnd:N,connectionLineType:_,connectionLineStyle:E,connectionLineComponent:j,connectionLineContainerStyle:C,selectionKeyCode:M,selectionOnDrag:$,selectionMode:I,multiSelectionKeyCode:F,panActivationKeyCode:O,zoomActivationKeyCode:A,deleteKeyCode:L,onlyRenderVisibleElements:H,elementsSelectable:X,selectNodesOnDrag:T,defaultViewport:K,translateExtent:D,minZoom:te,maxZoom:Z,preventScrolling:V,defaultMarkerColor:J,zoomOnScroll:P,zoomOnPinch:Y,panOnScroll:de,panOnScrollSpeed:U,panOnScrollMode:z,zoomOnDoubleClick:Q,panOnDrag:W,onPaneClick:le,onPaneMouseEnter:pe,onPaneMouseMove:ge,onPaneMouseLeave:Ne,onPaneScroll:ce,onPaneContextMenu:we,onEdgeContextMenu:Ce,onEdgeMouseEnter:_e,onEdgeMouseMove:We,onEdgeMouseLeave:Se,onReconnect:re,onReconnectStart:Qe,onReconnectEnd:ft,reconnectRadius:ut,noDragClassName:at,noWheelClassName:Ye,noPanClassName:me,elevateEdgesOnSelect:be,disableKeyboardA11y:De,nodeOrigin:He,nodeExtent:ot,rfId:Le})=>{const se=ok(e,yP),je=ok(t,SP);return FP(i),fe.createElement(mP,{onPaneClick:le,onPaneMouseEnter:pe,onPaneMouseMove:ge,onPaneMouseLeave:Ne,onPaneContextMenu:we,onPaneScroll:ce,deleteKeyCode:L,selectionKeyCode:M,selectionOnDrag:$,selectionMode:I,onSelectionStart:k,onSelectionEnd:N,multiSelectionKeyCode:F,panActivationKeyCode:O,zoomActivationKeyCode:A,elementsSelectable:X,onMove:n,onMoveStart:s,onMoveEnd:a,zoomOnScroll:P,zoomOnPinch:Y,zoomOnDoubleClick:Q,panOnScroll:de,panOnScrollSpeed:U,panOnScrollMode:z,panOnDrag:W,defaultViewport:K,translateExtent:D,minZoom:te,maxZoom:Z,onSelectionContextMenu:S,preventScrolling:V,noDragClassName:at,noWheelClassName:Ye,noPanClassName:me,disableKeyboardA11y:De},fe.createElement(DP,null,fe.createElement(LP,{edgeTypes:je,onEdgeClick:d,onEdgeDoubleClick:p,onlyRenderVisibleElements:H,onEdgeContextMenu:Ce,onEdgeMouseEnter:_e,onEdgeMouseMove:We,onEdgeMouseLeave:Se,onReconnect:re,onReconnectStart:Qe,onReconnectEnd:ft,reconnectRadius:ut,defaultMarkerColor:J,noPanClassName:me,elevateEdgesOnSelect:!!be,disableKeyboardA11y:De,rfId:Le},fe.createElement(UP,{style:E,type:_,component:j,containerStyle:C})),fe.createElement("div",{className:"react-flow__edgelabel-renderer"}),fe.createElement(xP,{nodeTypes:se,onNodeClick:l,onNodeDoubleClick:f,onNodeMouseEnter:h,onNodeMouseMove:g,onNodeMouseLeave:y,onNodeContextMenu:w,selectNodesOnDrag:T,onlyRenderVisibleElements:H,noPanClassName:me,noDragClassName:at,disableKeyboardA11y:De,nodeOrigin:He,nodeExtent:ot,rfId:Le})))};hT.displayName="GraphView";var WP=b.memo(hT);const aw=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Is={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:aw,nodeExtent:aw,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:Ia.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:y$,isValidConnection:void 0},HP=()=>MM((e,t)=>({...Is,setNodes:n=>{const{nodeInternals:s,nodeOrigin:a,elevateNodesOnSelect:i}=t();e({nodeInternals:pf(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?pf(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:d,domNode:f,nodeOrigin:p}=t(),h=f==null?void 0:f.querySelector(".react-flow__viewport");if(!h)return;const g=window.getComputedStyle(h),{m22:y}=new window.DOMMatrixReadOnly(g.transform),w=n.reduce((k,N)=>{const _=a.get(N.id);if(_!=null&&_.hidden)a.set(_.id,{..._,[jt]:{..._[jt],handleBounds:void 0}});else if(_){const E=Mw(N.nodeElement);!!(E.width&&E.height&&(_.width!==E.width||_.height!==E.height||N.forceUpdate))&&(a.set(_.id,{..._,[jt]:{..._[jt],handleBounds:{source:Jb(".source",N.nodeElement,y,p),target:Jb(".target",N.nodeElement,y,p)}},...E}),k.push({id:_.id,type:"dimensions",dimensions:E}))}return k},[]);eT(a,p);const S=l||i&&!l&&tT(t,{initial:!0,...d});e({nodeInternals:new Map(a),fitViewOnInitDone:S}),(w==null?void 0:w.length)>0&&(s==null||s(w))},updateNodePositions:(n,s=!0,a=!1)=>{const{triggerNodeChanges:i}=t(),l=n.map(d=>{const f={id:d.id,type:"position",dragging:a};return s&&(f.positionAbsolute=d.positionAbsolute,f.position=d.position),f});i(l)},triggerNodeChanges:n=>{const{onNodesChange:s,nodeInternals:a,hasDefaultNodes:i,nodeOrigin:l,getNodes:d,elevateNodesOnSelect:f}=t();if(n!=null&&n.length){if(i){const p=oP(n,d()),h=pf(p,a,l,f);e({nodeInternals:h})}s==null||s(n)}},addSelectedNodes:n=>{const{multiSelectionActive:s,edges:a,getNodes:i}=t();let l,d=null;s?l=n.map(f=>Ps(f,!0)):(l=qo(i(),n),d=qo(a,[])),hu({changedNodes:l,changedEdges:d,get:t,set:e})},addSelectedEdges:n=>{const{multiSelectionActive:s,edges:a,getNodes:i}=t();let l,d=null;s?l=n.map(f=>Ps(f,!0)):(l=qo(a,n),d=qo(i(),[])),hu({changedNodes:d,changedEdges:l,get:t,set:e})},unselectNodesAndEdges:({nodes:n,edges:s}={})=>{const{edges:a,getNodes:i}=t(),l=n||i(),d=s||a,f=l.map(h=>(h.selected=!1,Ps(h.id,!1))),p=d.map(h=>Ps(h.id,!1));hu({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(d=>d.selected).map(d=>Ps(d.id,!1)),l=n.filter(d=>d.selected).map(d=>Ps(d.id,!1));hu({changedNodes:i,changedEdges:l,get:t,set:e})},setNodeExtent:n=>{const{nodeInternals:s}=t();s.forEach(a=>{a.positionAbsolute=Iw(a.position,n)}),e({nodeExtent:n,nodeInternals:new Map(s)})},panBy:n=>{const{transform:s,width:a,height:i,d3Zoom:l,d3Selection:d,translateExtent:f}=t();if(!l||!d||!n.x&&!n.y)return!1;const p=ns.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(d,g),s[0]!==g.x||s[1]!==g.y||s[2]!==g.k},cancelConnection:()=>e({connectionNodeId:Is.connectionNodeId,connectionHandleId:Is.connectionHandleId,connectionHandleType:Is.connectionHandleType,connectionStatus:Is.connectionStatus,connectionStartHandle:Is.connectionStartHandle,connectionEndHandle:Is.connectionEndHandle}),reset:()=>e({...Is})}),Object.is),zw=({children:e})=>{const t=b.useRef(null);return t.current||(t.current=HP()),fe.createElement(u$,{value:t.current},e)};zw.displayName="ReactFlowProvider";const fT=({children:e})=>b.useContext(nd)?fe.createElement(fe.Fragment,null,e):fe.createElement(zw,null,e);fT.displayName="ReactFlowWrapper";const GP={input:VC,default:rw,output:KC,group:Dw},VP={default:Bu,straight:Pw,step:$w,smoothstep:rd,simplebezier:Ow},YP=[0,0],KP=[15,15],XP={x:0,y:0,zoom:1},QP={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},pT=b.forwardRef(({nodes:e,edges:t,defaultNodes:n,defaultEdges:s,className:a,nodeTypes:i=GP,edgeTypes:l=VP,onNodeClick:d,onEdgeClick:f,onInit:p,onMove:h,onMoveStart:g,onMoveEnd:y,onConnect:w,onConnectStart:S,onConnectEnd:k,onClickConnectStart:N,onClickConnectEnd:_,onNodeMouseEnter:E,onNodeMouseMove:j,onNodeMouseLeave:C,onNodeContextMenu:M,onNodeDoubleClick:$,onNodeDragStart:I,onNodeDrag:F,onNodeDragStop:O,onNodesDelete:A,onEdgesDelete:L,onSelectionChange:H,onSelectionDragStart:X,onSelectionDrag:T,onSelectionDragStop:K,onSelectionContextMenu:D,onSelectionStart:te,onSelectionEnd:Z,connectionMode:V=Ia.Strict,connectionLineType:J=Ls.Bezier,connectionLineStyle:P,connectionLineComponent:Y,connectionLineContainerStyle:de,deleteKeyCode:U="Backspace",selectionKeyCode:z="Shift",selectionOnDrag:Q=!1,selectionMode:W=jl.Full,panActivationKeyCode:le="Space",multiSelectionKeyCode:pe=Fu()?"Meta":"Control",zoomActivationKeyCode:ge=Fu()?"Meta":"Control",snapToGrid:Ne=!1,snapGrid:ce=KP,onlyRenderVisibleElements:we=!1,selectNodesOnDrag:Ce=!0,nodesDraggable:_e,nodesConnectable:We,nodesFocusable:Se,nodeOrigin:re=YP,edgesFocusable:Qe,edgesUpdatable:ft,elementsSelectable:ut,defaultViewport:at=XP,minZoom:Ye=.5,maxZoom:me=2,translateExtent:be=aw,preventScrolling:De=!0,nodeExtent:He,defaultMarkerColor:ot="#b1b1b7",zoomOnScroll:Le=!0,zoomOnPinch:se=!0,panOnScroll:je=!1,panOnScrollSpeed:Fe=.5,panOnScrollMode:Ee=Ta.Free,zoomOnDoubleClick:Ue=!0,panOnDrag:_t=!0,onPaneClick:vt,onPaneMouseEnter:Oe,onPaneMouseMove:it,onPaneMouseLeave:wt,onPaneScroll:xt,onPaneContextMenu:tn,children:nn,onEdgeContextMenu:In,onEdgeDoubleClick:qa,onEdgeMouseEnter:Da,onEdgeMouseMove:Fa,onEdgeMouseLeave:wn,onEdgeUpdate:Bs,onEdgeUpdateStart:za,onEdgeUpdateEnd:Ot,onReconnect:mr,onReconnectStart:Kn,onReconnectEnd:li,reconnectRadius:Rr=10,edgeUpdaterRadius:Ar=10,onNodesChange:Mr,onEdgesChange:is,noDragClassName:Us="nodrag",noWheelClassName:Ba="nowheel",noPanClassName:Ws="nopan",fitView:On=!1,fitViewOptions:Ua,connectOnClick:Hs=!0,attributionPosition:ci,proOptions:Ir,defaultEdgeOptions:Gs,elevateNodesOnSelect:Wa=!0,elevateEdgesOnSelect:Or=!1,disableKeyboardA11y:Vs=!1,autoPanOnConnect:ls=!0,autoPanOnNodeDrag:dt=!0,connectionRadius:Ha=20,isValidConnection:$n,onError:Ga,style:$r,id:Ys,nodeDragThreshold:Va,...Pr},Dt)=>{const Ks=Ys||"1";return fe.createElement("div",{...Pr,style:{...$r,...QP},ref:Dt,className:Vt(["react-flow",a]),"data-testid":"rf__wrapper",id:Ys},fe.createElement(fT,null,fe.createElement(WP,{onInit:p,onMove:h,onMoveStart:g,onMoveEnd:y,onNodeClick:d,onEdgeClick:f,onNodeMouseEnter:E,onNodeMouseMove:j,onNodeMouseLeave:C,onNodeContextMenu:M,onNodeDoubleClick:$,nodeTypes:i,edgeTypes:l,connectionLineType:J,connectionLineStyle:P,connectionLineComponent:Y,connectionLineContainerStyle:de,selectionKeyCode:z,selectionOnDrag:Q,selectionMode:W,deleteKeyCode:U,multiSelectionKeyCode:pe,panActivationKeyCode:le,zoomActivationKeyCode:ge,onlyRenderVisibleElements:we,selectNodesOnDrag:Ce,defaultViewport:at,translateExtent:be,minZoom:Ye,maxZoom:me,preventScrolling:De,zoomOnScroll:Le,zoomOnPinch:se,zoomOnDoubleClick:Ue,panOnScroll:je,panOnScrollSpeed:Fe,panOnScrollMode:Ee,panOnDrag:_t,onPaneClick:vt,onPaneMouseEnter:Oe,onPaneMouseMove:it,onPaneMouseLeave:wt,onPaneScroll:xt,onPaneContextMenu:tn,onSelectionContextMenu:D,onSelectionStart:te,onSelectionEnd:Z,onEdgeContextMenu:In,onEdgeDoubleClick:qa,onEdgeMouseEnter:Da,onEdgeMouseMove:Fa,onEdgeMouseLeave:wn,onReconnect:mr??Bs,onReconnectStart:Kn??za,onReconnectEnd:li??Ot,reconnectRadius:Rr??Ar,defaultMarkerColor:ot,noDragClassName:Us,noWheelClassName:Ba,noPanClassName:Ws,elevateEdgesOnSelect:Or,rfId:Ks,disableKeyboardA11y:Vs,nodeOrigin:re,nodeExtent:He}),fe.createElement(F$,{nodes:e,edges:t,defaultNodes:n,defaultEdges:s,onConnect:w,onConnectStart:S,onConnectEnd:k,onClickConnectStart:N,onClickConnectEnd:_,nodesDraggable:_e,nodesConnectable:We,nodesFocusable:Se,edgesFocusable:Qe,edgesUpdatable:ft,elementsSelectable:ut,elevateNodesOnSelect:Wa,minZoom:Ye,maxZoom:me,nodeExtent:He,onNodesChange:Mr,onEdgesChange:is,snapToGrid:Ne,snapGrid:ce,connectionMode:V,translateExtent:be,connectOnClick:Hs,defaultEdgeOptions:Gs,fitView:On,fitViewOptions:Ua,onNodesDelete:A,onEdgesDelete:L,onNodeDragStart:I,onNodeDrag:F,onNodeDragStop:O,onSelectionDrag:T,onSelectionDragStart:X,onSelectionDragStop:K,noPanClassName:Ws,nodeOrigin:re,rfId:Ks,autoPanOnConnect:ls,autoPanOnNodeDrag:dt,onError:Ga,connectionRadius:Ha,isValidConnection:$n,nodeDragThreshold:Va}),fe.createElement(q$,{onSelectionChange:H}),nn,fe.createElement(h$,{proOptions:Ir,position:ci}),fe.createElement(H$,{rfId:Ks,disableKeyboardA11y:Vs})))});pT.displayName="ReactFlow";const ZP=e=>({x:e.transform[0],y:e.transform[1],zoom:e.transform[2]});function mT(){return ct(ZP,qt)}const gT=({id:e,x:t,y:n,width:s,height:a,style:i,color:l,strokeColor:d,strokeWidth:f,className:p,borderRadius:h,shapeRendering:g,onClick:y,selected:w})=>{const{background:S,backgroundColor:k}=i||{},N=l||S||k;return fe.createElement("rect",{className:Vt(["react-flow__minimap-node",{selected:w},p]),x:t,y:n,rx:h,ry:h,width:s,height:a,fill:N,stroke:d,strokeWidth:f,shapeRendering:g,onClick:y?_=>y(_,e):void 0})};gT.displayName="MiniMapNode";var JP=b.memo(gT);const eL=e=>e.nodeOrigin,tL=e=>e.getNodes().filter(t=>!t.hidden&&t.width&&t.height),vf=e=>e instanceof Function?e:()=>e;function nL({nodeStrokeColor:e="transparent",nodeColor:t="#e2e2e2",nodeClassName:n="",nodeBorderRadius:s=5,nodeStrokeWidth:a=2,nodeComponent:i=JP,onClick:l}){const d=ct(tL,qt),f=ct(eL),p=vf(t),h=vf(e),g=vf(n),y=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return fe.createElement(fe.Fragment,null,d.map(w=>{const{x:S,y:k}=Aa(w,f).positionAbsolute;return fe.createElement(i,{key:w.id,x:S,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:y,onClick:l,id:w.id})}))}var rL=b.memo(nL);const sL=200,aL=150,oL=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?m$(sd(t,e.nodeOrigin),n):n,rfId:e.rfId}},iL="react-flow__minimap-desc";function yT({style:e,className:t,nodeStrokeColor:n="transparent",nodeColor:s="#e2e2e2",nodeClassName:a="",nodeBorderRadius:i=5,nodeStrokeWidth:l=2,nodeComponent:d,maskColor:f="rgb(240, 240, 240, 0.6)",maskStrokeColor:p="none",maskStrokeWidth:h=1,position:g="bottom-right",onClick:y,onNodeClick:w,pannable:S=!1,zoomable:k=!1,ariaLabel:N="React Flow mini map",inversePan:_=!1,zoomStep:E=10,offsetScale:j=5}){const C=Mt(),M=b.useRef(null),{boundingRect:$,viewBB:I,rfId:F}=ct(oL,qt),O=(e==null?void 0:e.width)??sL,A=(e==null?void 0:e.height)??aL,L=$.width/O,H=$.height/A,X=Math.max(L,H),T=X*O,K=X*A,D=j*X,te=$.x-(T-$.width)/2-D,Z=$.y-(K-$.height)/2-D,V=T+D*2,J=K+D*2,P=`${iL}-${F}`,Y=b.useRef(0);Y.current=X,b.useEffect(()=>{if(M.current){const z=Hn(M.current),Q=pe=>{const{transform:ge,d3Selection:Ne,d3Zoom:ce}=C.getState();if(pe.sourceEvent.type!=="wheel"||!Ne||!ce)return;const we=-pe.sourceEvent.deltaY*(pe.sourceEvent.deltaMode===1?.05:pe.sourceEvent.deltaMode?1:.002)*E,Ce=ge[2]*Math.pow(2,we);ce.scaleTo(Ne,Ce)},W=pe=>{const{transform:ge,d3Selection:Ne,d3Zoom:ce,translateExtent:we,width:Ce,height:_e}=C.getState();if(pe.sourceEvent.type!=="mousemove"||!Ne||!ce)return;const We=Y.current*Math.max(1,ge[2])*(_?-1:1),Se={x:ge[0]-pe.sourceEvent.movementX*We,y:ge[1]-pe.sourceEvent.movementY*We},re=[[0,0],[Ce,_e]],Qe=ns.translate(Se.x,Se.y).scale(ge[2]),ft=ce.constrain()(Qe,re,we);ce.transform(Ne,ft)},le=NC().on("zoom",S?W:null).on("zoom.wheel",k?Q:null);return z.call(le),()=>{z.on("zoom",null)}}},[S,k,_,E]);const de=y?z=>{const Q=or(z);y(z,{x:Q[0],y:Q[1]})}:void 0,U=w?(z,Q)=>{const W=C.getState().nodeInternals.get(Q);w(z,W)}:void 0;return fe.createElement(Aw,{position:g,style:e,className:Vt(["react-flow__minimap",t]),"data-testid":"rf__minimap"},fe.createElement("svg",{width:O,height:A,viewBox:`${te} ${Z} ${V} ${J}`,role:"img","aria-labelledby":P,ref:M,onClick:de},N&&fe.createElement("title",{id:P},N),fe.createElement(rL,{onClick:U,nodeColor:s,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:a,nodeStrokeWidth:l,nodeComponent:d}),fe.createElement("path",{className:"react-flow__minimap-mask",d:`M${te-D},${Z-D}h${V+D*2}v${J+D*2}h${-V-D*2}z
|
|
57
|
+
M${I.x},${I.y}h${I.width}v${I.height}h${-I.width}z`,fill:f,fillRule:"evenodd",stroke:p,strokeWidth:h,pointerEvents:"none"})))}yT.displayName="MiniMap";var lL=b.memo(yT);function cL(){return fe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},fe.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function uL(){return fe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},fe.createElement("path",{d:"M0 0h32v4.2H0z"}))}function dL(){return fe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},fe.createElement("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"}))}function hL(){return fe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},fe.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"}))}function fL(){return fe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},fe.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"}))}const Er=({children:e,className:t,...n})=>fe.createElement("button",{type:"button",className:Vt(["react-flow__controls-button",t]),...n},e);Er.displayName="ControlButton";const pL=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom}),vT=({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:s=!0,fitViewOptions:a,onZoomIn:i,onZoomOut:l,onFitView:d,onInteractiveChange:f,className:p,children:h,position:g="bottom-left"})=>{const y=Mt(),[w,S]=b.useState(!1),{isInteractive:k,minZoomReached:N,maxZoomReached:_}=ct(pL,qt),{zoomIn:E,zoomOut:j,fitView:C}=ql();if(b.useEffect(()=>{S(!0)},[]),!w)return null;const M=()=>{E(),i==null||i()},$=()=>{j(),l==null||l()},I=()=>{C(a),d==null||d()},F=()=>{y.setState({nodesDraggable:!k,nodesConnectable:!k,elementsSelectable:!k}),f==null||f(!k)};return fe.createElement(Aw,{className:Vt(["react-flow__controls",p]),position:g,style:e,"data-testid":"rf__controls"},t&&fe.createElement(fe.Fragment,null,fe.createElement(Er,{onClick:M,className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:_},fe.createElement(cL,null)),fe.createElement(Er,{onClick:$,className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:N},fe.createElement(uL,null))),n&&fe.createElement(Er,{className:"react-flow__controls-fitview",onClick:I,title:"fit view","aria-label":"fit view"},fe.createElement(dL,null)),s&&fe.createElement(Er,{className:"react-flow__controls-interactive",onClick:F,title:"toggle interactivity","aria-label":"toggle interactivity"},k?fe.createElement(fL,null):fe.createElement(hL,null)),h)};vT.displayName="Controls";var mL=b.memo(vT),dr;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(dr||(dr={}));function gL({color:e,dimensions:t,lineWidth:n}){return fe.createElement("path",{stroke:e,strokeWidth:n,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`})}function yL({color:e,radius:t}){return fe.createElement("circle",{cx:t,cy:t,r:t,fill:e})}const vL={[dr.Dots]:"#91919a",[dr.Lines]:"#eee",[dr.Cross]:"#e2e2e2"},wL={[dr.Dots]:1,[dr.Lines]:1,[dr.Cross]:6},xL=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function wT({id:e,variant:t=dr.Dots,gap:n=20,size:s,lineWidth:a=1,offset:i=2,color:l,style:d,className:f}){const p=b.useRef(null),{transform:h,patternId:g}=ct(xL,qt),y=l||vL[t],w=s||wL[t],S=t===dr.Dots,k=t===dr.Cross,N=Array.isArray(n)?n:[n,n],_=[N[0]*h[2]||1,N[1]*h[2]||1],E=w*h[2],j=k?[E,E]:_,C=S?[E/i,E/i]:[j[0]/i,j[1]/i];return fe.createElement("svg",{className:Vt(["react-flow__background",f]),style:{...d,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:p,"data-testid":"rf__background"},fe.createElement("pattern",{id:g+e,x:h[0]%_[0],y:h[1]%_[1],width:_[0],height:_[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${C[0]},-${C[1]})`},S?fe.createElement(yL,{color:y,radius:E/i}):fe.createElement(gL,{dimensions:j,color:y,lineWidth:a})),fe.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${g+e})`}))}wT.displayName="Background";var bL=b.memo(wT);const kL=["us-gov","global","apac","us","eu","jp","au"],_L=new RegExp(`^(?:(?:${kL.join("|")})\\.)?anthropic\\.`,"i");function Dl(e){return e.replace(_L,"")}const SL=["command","cmd","file_path","path","url","pattern","notebook_path"],ik=120,wf=e=>e.length>ik?`${e.slice(0,ik-1)}…`:e;function NL(e){if(typeof e=="string")return e.trim()?wf(e.trim()):null;if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e;for(const n of SL){const s=t[n];if(typeof s=="string"&&s.trim())return wf(s.trim());if(Array.isArray(s)&&s.length>0&&s.every(a=>typeof a=="string")){const a=s.join(" ").trim();if(a)return wf(a)}}return null}function xT(){return{inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0}}function Bw(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 EL(e){const t=Bw(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 jL(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]=EL(s));return Object.keys(t).length?t:void 0}function bT(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),...Bw(n)};for(const s of Object.values(n)){const a=bT(s,t+1);if(a)return a}return null}const CL=/^(?:claude[-_]|gpt[-_]|o\d|codex[-_])/i;function kT(e,t=0){if(!e||typeof e!="object"||t>6)return null;const n=e;if(typeof n.model=="string"&&CL.test(Dl(n.model)))return n.model;for(const s of Object.values(n)){const a=kT(s,t+1);if(a)return a}return null}function ow(){return{agents:new Map,toolIndex:new Map,toolOwner:new Map,activeSubagentStack:new Map,lastSeq:0,seqEpoch:null,totalEvents:0,revision:0}}function Ds(e){if(!e)return;const t=e.replace(/\\/g,"/").split("/").filter(Boolean);return t[t.length-1]}function lk(){return{msgsUser:0,msgsAssistant:0,toolUses:0,toolResults:0,systemReminders:0,currentContextTokens:0,memoryFiles:[]}}function Fl(e,t){return`${e}::${t}`}function Uu(e){return e.agent_type??e.subagent_type??"subagent"}function wl(e){return e.agent_id?e.agent_id:e.parent_tool_use_id?e.parent_tool_use_id:null}function Do(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:xT()},e.agents.set(a,i),i)}function _T(e,t,n,s){const a=Fl(t,n),i=e.agents.get(a);if(!i)return null;!i.cwd&&s.cwd&&(i.cwd=s.cwd,i.cwdBasename=Ds(s.cwd));const l=Uu(s);return l&&(i.label==="subagent"||!i.label)&&(i.label=l),i}function TL(e,t,n){const s=t.session_id??"unknown",a=wl(t);if(a){const f=_T(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(Fl(s,l));if(f)return!f.cwd&&t.cwd&&(f.cwd=t.cwd,f.cwdBasename=Ds(t.cwd)),f}const d=Do(e,s,n,t.hook_event_name!=="SessionStart");return!d.cwd&&t.cwd&&(d.cwd=t.cwd,d.cwdBasename=Ds(t.cwd)),d.label==="session"&&t.cwd&&(d.label=Ds(t.cwd)??"session"),d}function RL(e,t,n,s,a){const i=Fl(t,n),l=Do(e,t,a,!0);let d=e.agents.get(i);if(d){!d.cwd&&s.cwd&&(d.cwd=s.cwd,d.cwdBasename=Ds(s.cwd));const f=Uu(s);return f&&(d.label==="subagent"||!d.label)&&(d.label=f),d}return d={id:i,sessionId:t,label:Uu(s),kind:"subagent",parentId:l.id,state:"active",startedAt:a,tools:[],prompts:[],cwd:s.cwd,cwdBasename:Ds(s.cwd),toolCount:0,childCount:0,usage:xT()},e.agents.set(i,d),l.childCount+=1,d}function AL(e,t,n){const s=e.activeSubagentStack.get(t)??[];s.includes(n)||(s.push(n),e.activeSubagentStack.set(t,s))}function ML(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 pu(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 ck=200,IL=25;function OL(e,t){const n=t.tools;if(n.length>ck){const s=n.splice(0,n.length-ck);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-IL-1;s>=0;s--){const a=n[s];if(a.trimmed)break;a.input=void 0,a.response=void 0,a.trimmed=!0}}function $L(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 uk=2e3;function PL(e,t,n){for(let s=e.prompts.length-1;s>=0;s--){const a=e.prompts[s];if(a.at<t-uk)return!1;if(a.text===n&&a.at<=t+uk)return!0}return!1}function ST(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 zl(e,t){return t&&(e.revision+=1),t}function LL(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 d=0;const f=p=>{const h=e.agents.get(p);h&&(ST(e,h),e.agents.delete(p),d++)};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 zl(e,d>0)}function qL(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 d=[...a.values()].filter(p=>!p.live).length-n;if(d<=0)return!1;let f=!1;for(const p of i){if(d<=0)break;for(const h of p.ids){const g=e.agents.get(h);g&&ST(e,g),e.agents.delete(h)}d--,f=!0}return zl(e,f)}function DL(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 FL(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 zl(e,t)}function zL(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 d of a.tools){const f=Math.max(d.startedAt,l??d.startedAt);d.endedAt==null&&t-f>n&&(d.endedAt=f,d.ok=!1,d.errorPreview=d.outcomeGap?"no result reached the deck — events were dropped while the deck was paused":"session ended before this call returned",e.toolIndex.delete(d.id),e.toolOwner.delete(d.id),s=!0)}}return zl(e,s)}const dk=90*6e4;function BL(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 zl(e,s)}function UL(e){return e==="permission_prompt"?"permission":e==="agent_needs_input"?"asked":e==="idle_prompt"?"idle":null}const WL=new Set(["Notification","ModelObserved","ContextObserved","UsageObserved","SessionNamed"]);function HL(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 GL=3e4;function VL(e,t){if(!(!e||!e.name)&&!(t-e.startedAt>GL)&&!(e.startedAt>t))return{name:e.name,preview:NL(e.input)??""}}function YL(e,t,n,s,a){if(n!=="permission")return{kind:n,message:s,since:a};const i=HL(e,t),l={kind:n,message:s,since:a};i!=null&&i.explicitSubagentId&&(l.subagentId=i.explicitSubagentId);const d=VL(i,a);return d&&(l.tool=d),l}function KL(e,t,n){if(e.kind==="idle")return!0;const s=wl(t);return s==null?!0:e.subagentId!=null&&Fl(n,s)===e.subagentId}function hk(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{...ow(),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(!WL.has(i)){const h=e.agents.get(l);h!=null&&h.waiting&&KL(h.waiting,s,l)&&(h.waiting=null)}const d=e.agents.get(l);if(d&&a>(d.lastEventAt??0)&&(d.lastEventAt=a,d.reaped&&(d.reaped=!1,d.state="active",d.endedAt=void 0,d.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??lk(),currentContextTokens:s.context_tokens})}if(i==="ModelObserved"){const h=typeof s.model=="string"?s.model:null;if(h){const y=e.agents.get(l);y&&(y.model=h)}const g=s.subagentModels;if(g&&typeof g=="object")for(const[y,w]of Object.entries(g)){if(typeof w!="string")continue;const S=`${l}::${y}`,k=e.agents.get(S);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 y=g.context??lk(),w=(k,N)=>typeof h[k]=="number"?h[k]:N,S=Array.isArray(h.memoryFiles)?h.memoryFiles:Array.isArray(h.claudeMdFiles)?h.claudeMdFiles:null;g.context={msgsUser:w("msgsUser",y.msgsUser),msgsAssistant:w("msgsAssistant",y.msgsAssistant),toolUses:w("toolUses",y.toolUses),toolResults:w("toolResults",y.toolResults),systemReminders:w("systemReminders",y.systemReminders),currentContextTokens:w("currentContextTokens",y.currentContextTokens),memoryFiles:S??y.memoryFiles}}}return e}if(i==="SessionNamed"){const h=e.agents.get(l);if(h){const g=typeof s.sessionName=="string"?s.sessionName.trim():"",y=typeof s.sessionTitle=="string"?s.sessionTitle.trim():"";g&&(h.sessionName=g),y&&(h.sessionTitle=y);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 y=Bw(h);g.usage.cacheCreate1hTokens=y.cacheCreate1hTokens,g.usage.cacheCreate5mTokens=y.cacheCreate5mTokens,typeof h.reasoning_output_tokens=="number"&&(g.usage.reasoningOutputTokens=Number(h.reasoning_output_tokens)),g.usageByModel=jL(s.usageByModel)}}return e}const f=TL(e,s,a);f.provider||(f.provider=s.provider==="codex"?"codex":"claude");const p=kT(s);switch(p&&(f.model=p),i){case"SessionStart":{const h=Do(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=Ds(s.cwd)),h.label==="session"&&s.cwd&&(h.label=Ds(s.cwd)??"session");break}case"UserPromptSubmit":{for(const y of e.agents.values())y.sessionId===l&&y.kind==="subagent"&&y.state==="done"&&y.exitAt==null&&y.endedAt!=null&&y.endedAt<a&&(y.exitAt=a);const h=Do(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&&!PL(h,a,g)&&(h.prompts.push({at:a,text:g}),h.firstPrompt||(h.firstPrompt=pu(g,120)));break}case"PreToolUse":{const h=s.tool_use_id?$L(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=pu(s.tool_input));break}const g=s.tool_use_id??`${f.id}:${f.toolCount}`,y=wl(s),w={id:g,name:s.tool_name??"?",input:s.tool_input,inputPreview:pu(s.tool_input),agentId:f.id,explicitSubagentId:y?Fl(l,y):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),OL(e,f);break}case"PostToolUse":case"PostToolUseFailure":{const h=s.tool_use_id;if(!h)break;let g=e.toolIndex.get(h),y=!1;if(!g)for(const S of e.agents.values()){const k=S.tools.find(N=>N.id===h);if(k){g=k,y=!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=pu(s.tool_response):y&&(g.errorPreview=void 0);const w=bT(s.tool_response);w&&(g.usage=w),e.toolIndex.delete(h),e.toolOwner.delete(h);break}case"SubagentStart":{const h=wl(s);if(!h)break;const g=RL(e,l,h,s,a);g.state="active",g.startedAt=g.startedAt||a,g.exitAt=void 0,g.endedAt=void 0;const y=Uu(s);y&&(g.label=y),AL(e,l,h);break}case"SubagentStop":{const h=wl(s);if(!h)break;const g=_T(e,l,h,s);if(!g)break;g.state="done",g.endedAt=a,ML(e,l,h);break}case"Stop":case"SessionEnd":{const h=Do(e,l,a,!1);h.state="done",h.endedAt=a,i==="SessionEnd"&&(h.closedAt=a),e.activeSubagentStack.delete(l);break}case"Notification":{const h=UL(s.notification_type);if(!h)break;const g=Do(e,l,a,!1),y=typeof s.message=="string"?s.message:"",w=g.waiting;g.waiting=w&&w.kind===h&&w.message===y?{...w,since:Math.min(w.since,a)}:YL(e,l,h,y,a);break}}return e}function Uw(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 XL={input:2,output:10,cacheRead:.2,cacheWrite:2.5,cacheWrite1h:4},QL=[{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:XL},{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 ZL(e){return e?/^(?:gpt[-_]|codex[-_]|o\d)/i.test(e):!1}function ti(e,t=Date.now()){if(!e)return null;const n=Dl(e);for(const s of QL)if(s.match.test(n))return typeof s.rates=="function"?s.rates(t):s.rates;return null}function NT(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 ET(e,t,n=Date.now()){if(!ZL(t))return e.inputTokens;const s=ti(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 Ww(e,t,n=Date.now()){const s=ti(t,n);if(!s)return{input:0,output:0,cacheRead:0,cacheWrite:0,total:0};const a=ET(e,t,n)*s.input/1e6,i=e.outputTokens*s.output/1e6,l=e.cacheReadTokens*s.cacheRead/1e6,d=NT(e,s),f=d.usd5m+d.usd1h;return{input:a,output:i,cacheRead:l,cacheWrite:f,total:a+i+l+f}}const fk=2e5,JL=1e6,e3=[/\[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],t3=[{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 n3(e){if(!e)return fk;const t=Dl(e);for(const n of e3)if(n.test(t))return JL;for(const n of t3)if(n.match.test(t))return n.window;return fk}function jT(e,t){return typeof e=="number"&&e>0?e:n3(t)}const Lo="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 Hw(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 r3(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 s3(e,t){let n=0,s=0,a=0,i=0,l=0,d=0;for(const g of t)n+=g.inputTokens,s+=g.outputTokens,a+=g.cacheReadTokens,i+=g.cacheCreateTokens,l+=g.cacheCreate1hTokens??0,d+=g.cacheCreate5mTokens??0;const f=(g,y)=>Math.max(0,g-y),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,d)),p.inputTokens+p.outputTokens+p.cacheReadTokens+p.cacheCreateTokens>0?p:null}function Bl(e){const t=e.usageByModel,n=t?Object.keys(t):[];if(!t||n.length===0)return[{model:e.model,usage:e.usage}];const s=n.map(i=>({model:i,usage:t[i]})),a=s3(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:r3(s[i].usage,a)}:s.push({model:e.model,usage:a})}return s}function An(e,t=Date.now()){const n={input:0,output:0,cacheRead:0,cacheWrite:0,total:0};for(const s of Bl(e)){const a=Ww(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 iw(e,t=Date.now()){let n=0;for(const s of Bl(e))ti(s.model,t)==null&&(n+=s.usage.inputTokens+s.usage.outputTokens);return n}function CT(e){const t=[];for(const n of Bl(e)){if(!n.model||t.includes(n.model))continue;const s=n.usage;s.inputTokens+s.outputTokens+s.cacheReadTokens+s.cacheCreateTokens<=0||t.push(n.model)}return t}function TT(e){return CT(e).filter(t=>t!==e.model)}const a3=new Set(["untrusted","on-request","on-failure"]);function o3(e){return typeof e!="string"||!e?null:a3.has(e)?!0:e==="never"?!1:null}function i3(e){if(e.provider!=="codex"||e.kind!=="root"||e.waiting||e.state!=="active")return null;const t=o3(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 pk(e){return e[0].toUpperCase()+e.slice(1).toLowerCase()}function Fs(e){const t=Dl(e).replace(/[-_]\d{8}(?!\d)/,""),n=t.match(/^claude[-_](opus|sonnet|haiku|fable|mythos)[-_](\d+(?:[-_.]\d+)*)/i);if(n){const a=pk(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(pk);return[`GPT-${a}`,...i].join(" ")}return e}function ad(e){const t=Dl(e??""),n=t.match(/^claude[-_](opus|sonnet|haiku|fable|mythos)[-_]/i);return n?n[1].toLowerCase():/^gpt[-_]/i.test(t)?"gpt":""}function Ul(e){return(e==null?void 0:e.kind)==="permission"||(e==null?void 0:e.kind)==="asked"}function l3(e){const t=[];for(const n of e)n.kind==="root"&&Ul(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 c3(e){const t=new Set;for(const n of e)n.state==="active"&&t.add(n.sessionId);return t.size}function od(e,t){return`${e}@${t.since}`}function RT(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 u3(e){const t=e.message||"Needs your permission",n=RT(e,t);return n?`${t}
|
|
60
|
+
Likely on: ${n}`:t}function d3(e,t,n,s=!0){if(!s)return[];if(n)return[];const a=[];for(const i of e){if(!Ul(i.waiting))continue;const l=od(i.id,i.waiting);t.has(l)||a.push({key:l,title:i.label,body:u3(i.waiting),sessionId:i.id})}return a}function h3(e,t,n){const s=new Set;for(const i of e)s.add(od(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 mk(e){return new Set(e.map(t=>od(t.id,t.waiting)))}function f3(e,t){return e!==t}function p3(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 Wu(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 AT(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 MT(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 m3=1;function g3(){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 Hu=g3();function y3(e){return e.overlayOpen?"dismiss":e.typing?"blur":"clear-selection"}function gk(e){return String(e.tagName??"").toUpperCase()==="BODY"}function v3(e,t){return!e||!e.isConnected||gk(e)?!1:t==null||gk(t)}const yk="a[href], button, input, select, textarea, [tabindex]";function w3(e){return!e||e.disabled||e.rendered===!1?!1:(e.tabIndex??0)>=0}function x3(e){if(!e||!e.overflowing||e.hasFocusable)return!1;const t=String(e.overflow??"").toLowerCase();return t==="auto"||t==="scroll"}function b3({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 Gw(e){return e.ctrlKey||e.metaKey||e.altKey}const k3=new Set(["button","checkbox","color","file","image","radio","range","reset","submit"]),_3=new Set(["INPUT","TEXTAREA","SELECT","OPTION","BUTTON","SUMMARY","A"]),S3=new Set(["button","checkbox","combobox","link","listbox","menu","menubar","menuitem","menuitemcheckbox","menuitemradio","option","radio","searchbox","slider","spinbutton","switch","tab","textbox","treeitem"]);function IT(e){return typeof e.tagName=="string"?e.tagName.toUpperCase():""}function Vw(e){if(!e)return!1;if(e.isContentEditable)return!0;const t=IT(e);return t==="TEXTAREA"?!0:t!=="INPUT"?!1:!k3.has(String(e.type??"text").toLowerCase())}function N3(e){if(!e)return!1;if(Vw(e)||_3.has(IT(e)))return!0;const t=typeof e.role=="string"?e.role.trim().toLowerCase():"";return t!==""&&t.split(/\s+/).some(n=>S3.has(n))}function E3({key:e,modalOpen:t,sheetOpen:n}){return t?!(e==="?"&&n):!1}function OT(e){return e?Array.from(e.querySelectorAll("*")).filter(t=>{if(t.matches(yk))return w3({disabled:t.disabled,tabIndex:t.tabIndex,rendered:t.getClientRects().length>0});const n=t.scrollHeight>t.clientHeight;return n&&x3({overflowing:n,overflow:getComputedStyle(t).overflowY,hasFocusable:t.querySelector(yk)!=null})}):[]}function j3(e,t){const n=OT(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 an(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 d=l.current;return b.useEffect(()=>Hu.push(d,s),[d,s]),b.useEffect(()=>{var p;const f=document.activeElement;return(p=(n==null?void 0:n.current)??OT(a.current)[0])==null||p.focus(),()=>{v3(f,document.activeElement)&&f.focus()}},[]),b.useEffect(()=>{const f=p=>{var k;if(p.key!=="Tab"||Gw(p))return;const h=a.current;if(!h)return;const g=document.activeElement;if(!(g!=null&&h.contains(g))&&!Hu.isTop(d))return;const w=j3(h,g),S=b3({count:w.length,index:g?w.indexOf(g):-1,shiftKey:p.shiftKey});S.kind!=="allow"&&(p.preventDefault(),S.kind==="focus"&&((k=w[S.index])==null||k.focus()))};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[d]),a}function C3(e){return e==="codex"?{subtitle:"reported by the Codex CLI — as of its most recent request",windowScope:"last request",compositionCounted:!1,compositionUncounted:"Not counted for Codex — the deck reconstructs the session from its rollout file and skips whatever was written before it attached, so a message and tool-call breakdown here would be short by an unknown amount. The window figure above is the CLI's own and is unaffected.",memoryHeading:"AGENTS.md files in scope",memoryEmpty:"No AGENTS.md files found on the path from cwd to the filesystem root, or in $CODEX_HOME."}:{subtitle:"approximation — CC's /context isn't hook-exposed",windowScope:"current turn",compositionCounted:!0,compositionUncounted:"",memoryHeading:"CLAUDE.md files in scope",memoryEmpty:"No CLAUDE.md files found on the path from cwd to ~/.claude."}}function Wn(e){return e.toLocaleString()}function T3(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(2)} MB`}const R3=60;function A3(e,t=R3){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 M3({agent:e,onClose:t}){var y;const n=b.useRef(null),s=an(t,{focusRef:n}),a=e.context,i=e.usage,l=(a==null?void 0:a.currentContextTokens)??0,d=jT(e.contextWindow,e.model),f=Math.min(100,l/d*100),p=An(e),h=i.inputTokens+i.cacheReadTokens+i.cacheCreateTokens,g=C3(e.provider);return c.jsx("div",{className:"ctx-modal-backdrop",onClick:t,role:"presentation",children:c.jsxs("div",{ref:s,className:"ctx-modal",onClick:w=>w.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Context breakdown",children:[c.jsxs("header",{className:"ctx-modal-head",children:[c.jsxs("div",{children:[c.jsxs("div",{className:"ctx-modal-title",children:["Context · ",e.label]}),c.jsx("div",{className:"ctx-modal-sub",children:g.subtitle})]}),c.jsx("button",{type:"button",ref:n,className:"glyph-btn ctx-modal-close",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),c.jsxs("section",{className:"ctx-window-row",children:[c.jsx("div",{className:"ctx-window-bar",role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(f),children:c.jsx("div",{className:"ctx-window-fill",style:{width:`${f}%`}})}),c.jsxs("div",{className:"ctx-window-meta",children:[c.jsxs("span",{className:"ctx-window-pct",children:[f.toFixed(1),"%"]}),c.jsxs("span",{children:[Wn(l)," / ",Wn(d)," tok (",g.windowScope,")"]})]})]}),c.jsx("h3",{className:"ctx-section-title",children:"Cumulative usage · whole session"}),c.jsxs("div",{className:"ctx-grid",children:[c.jsx(ar,{label:"input tokens",val:Wn(i.inputTokens)}),c.jsx(ar,{label:"output tokens",val:Wn(i.outputTokens)}),c.jsx(ar,{label:"cache reads",val:Wn(i.cacheReadTokens)}),c.jsx(ar,{label:"cache writes",val:Wn(i.cacheCreateTokens)}),c.jsx(ar,{label:"cumulative total",val:Wn(h)}),c.jsx(ar,{label:"estimated cost",val:Je(p.total),accent:!0})]}),c.jsx("h3",{className:"ctx-section-title",children:"Transcript composition"}),g.compositionCounted?c.jsxs("div",{className:"ctx-grid",children:[c.jsx(ar,{label:"user messages",val:Wn((a==null?void 0:a.msgsUser)??0)}),c.jsx(ar,{label:"assistant messages",val:Wn((a==null?void 0:a.msgsAssistant)??0)}),c.jsx(ar,{label:"tool uses",val:Wn((a==null?void 0:a.toolUses)??0)}),c.jsx(ar,{label:"tool results",val:Wn((a==null?void 0:a.toolResults)??0)}),c.jsx(ar,{label:"system-reminders",val:Wn((a==null?void 0:a.systemReminders)??0)})]}):c.jsx("div",{className:"ctx-empty",children:g.compositionUncounted}),c.jsx("h3",{className:"ctx-section-title",children:g.memoryHeading}),(((y=a==null?void 0:a.memoryFiles)==null?void 0:y.length)??0)===0?c.jsx("div",{className:"ctx-empty",children:g.memoryEmpty}):c.jsx("ul",{className:"ctx-md-list",children:a.memoryFiles.map(w=>c.jsxs("li",{children:[c.jsx("span",{className:"ctx-md-path",title:w.path,children:A3(w.path)}),c.jsx("span",{className:"ctx-md-size",children:T3(w.bytes)})]},w.path))})]})})}function ar({label:e,val:t,accent:n}){return c.jsxs("div",{className:`ctx-row${n?" accent":""}`,children:[c.jsx("span",{className:"ctx-row-label",children:e}),c.jsx("span",{className:"ctx-row-val",children:t})]})}function I3({currentContextTokens:e,modelId:t,contextWindow:n,size:s=26,onClick:a}){const i=jT(n,t),l=Math.min(1,e/i),d=s/2-3,f=s/2,p=2*Math.PI*d,h=p*l,g=l>.9?"var(--err)":l>.7?"var(--inflight)":"var(--accent)";return c.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:c.jsxs("svg",{width:s,height:s,viewBox:`0 0 ${s} ${s}`,children:[c.jsx("circle",{cx:f,cy:f,r:d,stroke:"var(--line)",strokeWidth:"2.5",fill:"none"}),c.jsx("circle",{cx:f,cy:f,r:d,stroke:g,strokeWidth:"2.5",fill:"none",strokeDasharray:`${h} ${p-h}`,strokeDashoffset:p/4,strokeLinecap:"round",style:{transition:"var(--ctx-arc-transition)"}}),c.jsx("text",{x:f,y:f+3,textAnchor:"middle",fontSize:"8",fill:"var(--text)",fontWeight:"600",children:Math.round(l*100)})]})})}function vk(e,t){const n=ti(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=Ww(e,t),l=NT(e,n),d=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=ET(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)}`,...d,"─────────────────────────────────────────",`total = ${Je(i.total)}`].join(`
|
|
62
|
+
`)}function wk(e){const t=Bl(e);return t.length<=1?vk(e.usage,e.model):[...t.map(n=>vk(n.usage,n.model)),"═════════════════════════════════════════",`all models = ${Je(An(e).total)}`].join(`
|
|
63
|
+
`)}function O3({data:e,selected:t}){var y;const n=e.now??Date.now(),s=["agent-node",`state-${e.state}`,e.synthetic?"synthetic":"",t?"selected":""].filter(Boolean).join(" "),a=e.tools.filter(w=>!w.endedAt).length,i=Uw(e.sessionId),l=((y=e.context)==null?void 0:y.currentContextTokens)??0,d=e.kind==="root"&&l>0,f=e.sessionTitle?e.cwd?`${e.cwd}
|
|
64
|
+
${e.sessionTitle}`:e.sessionTitle:e.cwd,p=TT(e),h=p.length>0?`${e.model}
|
|
65
|
+
spend on this card also covers:
|
|
66
|
+
${p.join(`
|
|
67
|
+
`)}`:e.model,g=MT(e.sessionName,e.sessionTitle);return c.jsxs("div",{className:s,style:{"--session-hue":i},children:[c.jsx("span",{className:"accent-stripe"}),c.jsx(Yo,{type:"target",position:qe.Left,style:{background:"transparent",border:"none"}}),c.jsxs("div",{className:"head",children:[c.jsxs("div",{className:"title",children:[c.jsx($3,{state:e.state}),c.jsx("span",{className:"label",title:f,children:e.label}),e.synthetic&&c.jsx("span",{className:"synth-tag",title:"No SessionStart captured — synthesised",children:"?"})]}),c.jsxs("div",{className:"head-right",children:[d&&e.onOpenContext&&c.jsx(I3,{currentContextTokens:l,modelId:e.model,contextWindow:e.contextWindow,onClick:()=>e.onOpenContext(e.sessionId)}),c.jsx("div",{className:"time",title:`Started ${new Date(e.startedAt).toLocaleTimeString()}`,children:Wu(e.startedAt,e.endedAt,n)})]})]}),c.jsxs("div",{className:"sub",children:[e.kind==="root"?"session":"subagent",e.childCount>0&&c.jsxs("span",{className:"spawn-badge",title:`${e.childCount} subagents spawned`,children:["→ ",e.childCount]}),e.cwdBasename&&e.kind==="subagent"?` · ${e.cwdBasename}`:"",e.model?c.jsxs("span",{className:"model-chip","data-family":ad(e.model),title:h,children:[Fs(e.model),p.length>0?` +${p.length}`:""]}):e.provider==="codex"?c.jsx("span",{className:"model-chip",title:"OpenAI Codex — no model reported yet",children:"Codex"}):null]}),e.kind==="root"&&g.face&&c.jsx("div",{className:"session-name",title:g.tooltip,children:g.face}),e.waiting&&c.jsx(q3,{waiting:e.waiting,now:n}),(()=>{const w=i3(e);return w?c.jsxs("div",{className:"approval-blind-row",title:w.detail,children:[c.jsx("span",{className:"approval-blind-dot","aria-hidden":!0}),c.jsx("span",{className:"approval-blind-said",children:w.label})]}):null})(),e.tools.length>0&&c.jsx(D3,{tools:e.tools,now:n}),c.jsxs("div",{className:"meta",children:[c.jsxs("span",{children:[c.jsx("b",{children:e.toolCount})," tools"]}),a>0&&c.jsxs("span",{className:"inflight-meta",children:[c.jsx("b",{children:a})," in-flight"]}),e.usage.inputTokens+e.usage.outputTokens>0&&c.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:[c.jsx("b",{children:At(e.usage.inputTokens+e.usage.outputTokens)})," tok"]}),e.model&&(()=>{const w=ti(e.model),S=An(e),k=iw(e);if(!w&&S.total<=0)return e.usage.inputTokens+e.usage.outputTokens<=0?null:c.jsx("span",{className:"cost-unpriced",title:wk(e),children:Lo});if(S.total<=0)return null;const N=Math.max(0,((e.endedAt??n)-e.startedAt)/1e3),_=e.state==="active"?Hw(S.total,N):null,E=wk(e)+(_?`
|
|
68
|
+
burn: ${_}`:"");return c.jsxs("span",{className:"cost-meta",title:E,children:[c.jsxs("b",{children:[Je(S.total),k>0?"+":""]}),_&&c.jsx("span",{className:"cost-rate",children:_})]})})()]}),c.jsx(Yo,{type:"source",position:qe.Right,style:{background:"transparent",border:"none"}})]})}function Gu(e){return e==="active"?"live":e==="done"?"done":"err"}function $3({state:e}){return c.jsx("span",{className:`state-pill state-${e}`,children:Gu(e)})}function Tl(e){return e.message?e.message:e.kind==="permission"?"Needs your permission":"Waiting for your input"}function P3(e,t){const n=RT(e,t);return n?`Likely on: ${n}`:null}function L3(e){return e.kind==="idle"?"Your turn":Tl(e)}function q3({waiting:e,now:t}){const n=Ul(e),s=Tl(e);return c.jsxs("div",{className:n?"waiting-row permission":"waiting-row idle",title:`${s}
|
|
69
|
+
Blocked for ${Wu(e.since,void 0,t)} — the answer goes in the terminal, not here.`,children:[n?c.jsx("span",{className:"ap-pulse","aria-hidden":!0}):c.jsx("span",{className:"waiting-dot","aria-hidden":!0}),c.jsx("span",{className:"waiting-said",children:L3(e)}),c.jsx("b",{children:Wu(e.since,void 0,t)})]})}function D3({tools:e,now:t}){const i=new Array(24).fill(0);let l=0;for(const S of e){const k=t-S.startedAt;if(k<0||k>=6e4)continue;const N=23-Math.floor(k/2500);N>=0&&N<24&&(i[N]+=1,l+=1)}const d=Math.max(1,...i),f=Math.max(0,...i),p=132,h=14,g=p/24,y=f/(2500/1e3),w=l===0?"no tool calls in the last 60s":`${l} tool calls in last 60s · peak ${y.toFixed(1)}/s`;return c.jsxs("div",{className:"tool-spark-row",title:w,children:[c.jsx("svg",{className:"tool-spark",width:p,height:h,viewBox:`0 0 ${p} ${h}`,"aria-hidden":!0,children:i.map((S,k)=>{const N=S===0?1.5:Math.max(1.5,S/d*h),_=k===23&&S>0,j=`tool-spark-bar${S>0?" active":""}${_?" latest":""}`;return c.jsx("rect",{x:k*g+.4,y:h-N,width:Math.max(.5,g-1),height:N,rx:.8,className:j},k)})}),c.jsx("span",{className:"tool-spark-label",children:"60s"})]})}function xk(e){if(e==null)return"(none)";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function F3({tool:e,onClose:t}){const n=an(t),s=e.endedAt==null?"inflight":e.ok===!1?"err":"done";return c.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:c.jsxs("div",{ref:n,className:"modal",onClick:a=>a.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"tool-modal-title",children:[c.jsxs("header",{className:"modal-head",children:[c.jsxs("div",{className:"modal-title",children:[c.jsx("span",{className:`status-dot ${s}`,"aria-hidden":!0}),c.jsx("span",{id:"tool-modal-title",className:"modal-tool-name",children:e.name}),c.jsxs("span",{className:"modal-tool-id",title:e.id,children:[e.id.slice(0,12),"…"]})]}),c.jsxs("div",{className:"modal-actions",children:[c.jsx("span",{className:"modal-dur",children:AT(e,"in-flight…")}),c.jsx("button",{className:"glyph-btn",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),c.jsxs("section",{className:"modal-body",children:[e.trimmed&&c.jsx("div",{className:"modal-section",children:c.jsx("p",{className:"modal-note",children:"Full payloads for this call were released to keep memory bounded — only the previews below are still held."})}),c.jsxs("div",{className:"modal-section",children:[c.jsx("h4",{children:"Input"}),c.jsx("pre",{children:xk(e.input??e.inputPreview)})]}),c.jsxs("div",{className:"modal-section",children:[c.jsxs("h4",{children:["Response ",s==="err"&&c.jsx("span",{className:"err-tag",children:"error"})]}),c.jsx("pre",{children:e.endedAt==null?"(waiting…)":xk(e.response??e.errorPreview)})]})]})]})})}const mu=18,bk=26,z3=12;function B3(e){return U3(e.nodeInternals.values())}function U3(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,d=a.position.y,f=l+a.width,p=d+a.height,h=t.get(i.sessionId);h?(h.minX=Math.min(h.minX,l),h.minY=Math.min(h.minY,d),h.maxX=Math.max(h.maxX,f),h.maxY=Math.max(h.maxY,p),i.kind==="root"&&(h.label=_k(i)??h.label),i.kind==="root"&&(h.name=Sk(i))):t.set(i.sessionId,{minX:l,minY:d,maxX:f,maxY:p,label:_k(i)??i.sessionId,name:Sk(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,...V3(i.label,i.name,a,l),x:i.minX-mu,y:i.minY-mu-bk,w:i.maxX-i.minX+mu*2,h:i.maxY-i.minY+mu*2+bk})}return s}const lw=" · ",W3=32,H3=/[\u1100-\u115F\u2E80-\u303E\u3041-\u33FF\u3400-\u4DBF\u4E00-\u9FFF\uA000-\uA4CF\uAC00-\uD7A3\uF900-\uFAFF\uFE30-\uFE6F\uFF00-\uFF60\uFFE0-\uFFE6]/;function kk(e){return H3.test(e)?2:1}function G3(e,t=W3){const n=[...e];let s=0;for(const l of n)s+=kk(l);if(s<=t)return e;const a=[];let i=0;for(const l of n){const d=kk(l);if(i+d>t-1)break;a.push(l),i+=d}for(;a.length&&/[\s\-_.:/]/.test(a[a.length-1]);)a.pop();return`${a.join("")}…`}function V3(e,t,n,s){const a=(t==null?void 0:t.trim())??"",i=s?Y3(n):void 0,l=[e,a||void 0,i].filter(Boolean);return{label:e,name:a?G3(a):void 0,shortId:i,fullLabel:l.join(lw)}}function Y3(e){const t=e.match(/[a-zA-Z0-9]{4}/);return t?t[0]:e.slice(0,4)}function _k(e){if(e.kind==="root")return e.label}function Sk(e){if(e.kind==="root")return MT(e.sessionName,e.sessionTitle).face}function K3({onFit:e}){const{x:t,y:n,zoom:s}=mT(),a=ql(),i=ct(B3,X3);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{}},d={transform:`translate(${t}px, ${n}px) scale(${s})`};return c.jsx("div",{className:"session-clusters",style:d,children:i.map(f=>{const p=Uw(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-z3,transform:`scale(${Math.min(1,s)/(s||1)})`,transformOrigin:"left top","--session-hue":p};return c.jsxs(fe.Fragment,{children:[c.jsx("div",{className:"cluster-card",style:h,"aria-hidden":!0}),c.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?c.jsxs(c.Fragment,{children:[lw,c.jsx("span",{className:"cluster-label-name",children:f.name})]}):null,f.shortId?lw+f.shortId:null]})]},f.sessionId)})})}function X3(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 Q3({data:e}){return c.jsx("div",{className:"session-group-handle",style:{width:(e==null?void 0:e.w)??0,height:(e==null?void 0:e.h)??0}})}const Wl={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"}},Z3=Object.fromEntries(Object.entries(Wl).map(([e,t])=>[e,t.category])),J3=Object.fromEntries(Object.entries(Wl).map(([e,t])=>[e,t.emoji])),e4=Object.fromEntries(Object.entries(Wl).map(([e,t])=>[e,t.label])),t4=new Set(Object.keys(Wl)),n4=new Set(Object.entries(Wl).filter(([,e])=>e.shell).map(([e])=>e)),Nk={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",...Z3};function $T(e){return e.startsWith("mcp__")?"mcp":Object.hasOwn(Nk,e)?Nk[e]:"other"}const r4=/\btools\.exec_command\s*\(\s*\{[^{}]*?\bcmd\s*:\s*(["'`])((?:\\.|(?!\1)[^\\])*)\1/,s4=/\btools\.([A-Za-z_$][\w$]*)\s*\(/;function a4(e){if(typeof e!="string"||!e)return null;const t=r4.exec(e);if(t){const s=o4(t[2]);if(s.trim())return s}const n=s4.exec(e);return n?n[1]:null}function o4(e){return e.replace(/\\(["'`\\nrt])/g,(t,n)=>n==="n"?`
|
|
71
|
+
`:n==="r"?"\r":n==="t"?" ":n)}const PT=600,i4=4,l4=36,cw=16,c4=60,u4=6,Ek=220,jk=96,d4=28,Ck={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:"📡",...J3};function Tk(e){return e.startsWith("mcp__")?"🔌":Object.hasOwn(Ck,e)?Ck[e]:"✨"}const Rk={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 LT(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 LT(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 h4(e){if(typeof e=="string")return e;if(!e||typeof e!="object")return null;const t=e;if(typeof t.script=="string"){const n=a4(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 f4=new Set(["Bash","PowerShell",...n4]),p4=t4;function m4(e,t){return p4.has(e)||e.startsWith("mcp__")?Math.max(jk,34+t.length*7.5):jk}function g4(e,t){if(!f4.has(e))return null;const n=h4(t);if(!n)return null;const s=LT(n);return s?{emoji:Object.hasOwn(Rk,s)?Rk[s]:"⚙️",label:s,category:"shell",detail:n}:null}const y4=new Set(["Read","Write","Edit","MultiEdit","NotebookEdit","LS","Glob","apply_patch"]),Ak={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:"🗄️"},Mk={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 v4(e){const n=e.replace(/\\/g,"/").replace(/\/+$/,""),s=n.lastIndexOf("/");return s>=0?n.slice(s+1):n}function w4(e){const t=e.toLowerCase();if(Object.hasOwn(Mk,t))return Mk[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(Ak,s))return Ak[s]}return"📄"}function x4(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 b4(e,t){if(!y4.has(e))return null;const n=x4(e,t);if(!n)return null;const s=v4(n);return s?{emoji:e==="LS"?"📂":w4(s),label:s,category:"file",detail:n}:null}const Ik={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 Yw(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 k4(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 qT(e){const t=e.toLowerCase();return Object.hasOwn(Ik,t)?Ik[t]:void 0}function _4(e,t){const n=Yw(e);if(!n)return null;const{server:s,method:a}=n;if(!a)return null;const i=qT(s);return{emoji:(i==null?void 0:i.emoji)??"🔌",label:a,category:"mcp",detail:i?`${i.name} · ${a}`:`${s} · ${a}`}}function S4(e,t){return g4(e,t)??b4(e,t)??_4(e)}const Ok=e4;function DT(e){const t=Yw(e);if(t){const s=qT(t.server);return s?{emoji:s.emoji,label:s.name}:{emoji:"🔌",label:t.server,hue:k4(t.server)}}const n=Object.hasOwn(Ok,e)?Ok[e]:"";return n?{emoji:Tk(e),label:n}:{emoji:Tk(e),label:e}}function N4(e){let t=null,n="";for(const s of e){const a=Yw(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:DT(n)}function E4(e){return e.endedAt==null?"inflight":e.ok===!1?"err":"done"}function j4(e,t){if(t==null)return 1;const n=e-t;return n<0?1:Math.max(0,1-n/PT)}function C4(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 T4(e,t,n,s,a,i){const l=[];for(const d of e.values()){if(!t.has(d.id)||d.exitAt!=null&&i-d.exitAt>PT)continue;const f=s.get(d.id)??n.get(d.id);if(!f)continue;const p=C4(d.tools,i4);if(p.length===0)continue;const h=d.exitAt??null,g=a.get(d.id),y=Math.max((g==null?void 0:g.width)??Ek,Ek),w=(g==null?void 0:g.height)??130,S=f.x,k=f.y,N=S+y,_=k+w/2;p.forEach((E,j)=>{const C=j*l4,M=S+y+c4,$=k+u4+C,I=j4(i,h),F=E.inputPreview??"",O=E4(E),A=I<.999,L=DT(E.name);l.push({id:`${d.id}::${E.id}`,toolId:E.id,agentId:d.id,toolName:E.name,name:L.label,emoji:L.emoji,status:O,category:$T(E.name),mcpHue:L.hue,inputPreview:F,fade:I,fading:A,worldX:M,worldY:$,anchorX:N,anchorY:_,spawnDx:N-M,spawnDy:_-($+cw)});const H=S4(E.name,E.input);if(H){const X=m4(E.name,L.label),T=M+X+d4,K=$,D=M+X,te=$+cw;l.push({id:`sub:${d.id}::${E.id}`,toolId:E.id,agentId:d.id,toolName:E.name,name:H.label,emoji:H.emoji,isSub:!0,status:O,category:H.category,inputPreview:H.detail??F,fade:I,fading:A,worldX:T,worldY:K,anchorX:D,anchorY:te,spawnDx:D-T,spawnDy:0})}})}return l}function R4({agents:e,visibleAgentIds:t,positions:n,pinned:s,measured:a,spotlight:i,hiddenCategories:l,now:d,onOpenTool:f}){const p=T4(e,t,n,s,a,d),h=l&&l.size>0?p.filter(g=>!l.has(g.category)):p;return c.jsx(A4,{bursts:h,spotlight:i,onOpenTool:f})}function A4({bursts:e,spotlight:t,onOpenTool:n}){const{x:s,y:a,zoom:i}=mT();return c.jsxs("div",{className:"tool-bursts-layer","aria-hidden":!0,children:[c.jsx("svg",{className:"tool-bursts-svg",children:e.map(l=>{const d=l.anchorX*i+s,f=l.anchorY*i+a,p=(l.worldX+6)*i+s,h=(l.worldY+cw)*i+a,g=d+(p-d)*.55,y=t!=null&&!t.has(l.agentId),w=l.fade*(y?.14:1);return c.jsx("path",{d:`M ${d} ${f} Q ${g} ${f}, ${p} ${h}`,className:`tool-conn status-${l.status}${l.fading?" fading":""}`,opacity:w},`l:${l.id}`)})}),e.map(l=>{const d=l.worldX*i+s,f=l.worldY*i+a,p={left:`${d}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,y=n!=null,w=l.mcpHue!=null?{"--mcp-hue":l.mcpHue}:{},k=t!=null&&!t.has(l.agentId)?" dim":"";return c.jsx("div",{className:"tool-burst-wrap",style:p,children:c.jsxs("div",{className:`tool-burst cat-${l.category}${l.mcpHue!=null?" mcp-hue":""} status-${l.status}${l.fading?" fading":""}${y?" clickable":""}${l.isSub?" sub":""}${k}`,style:w,title:g,onClick:y?()=>n(l.toolId):void 0,children:[c.jsx("span",{className:"tb-emoji",children:l.emoji}),c.jsx("span",{className:"tb-name",children:l.name}),l.status==="inflight"&&c.jsx("span",{className:"tb-spin"}),l.status==="done"&&c.jsx("span",{className:"tb-mark done",children:"✓"}),l.status==="err"&&c.jsx("span",{className:"tb-mark err",children:"×"})]})},l.id)})]})}function M4(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 d=An(l);t.input+=d.input,t.output+=d.output,t.cacheRead+=d.cacheRead,t.cacheWrite+=d.cacheWrite,t.total+=d.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 I4="spend on this board",O4="on this board",$k=`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.`,FT="session spend";function Kw({cost:e,size:t="md"}){const n=e.total;if(n<=0)return null;const s=(i,l,d)=>{if(i<=0)return null;const f=i/n*100;return c.jsx("span",{className:`cb-seg ${l}`,style:{width:`${f}%`},title:`${d}: ${Je(i)} (${f.toFixed(0)}%)`},l)},a=t==="lg";return c.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 $4({state:e,sessionId:t,onClose:n}){const s=b.useMemo(()=>P4(e,t),[e,t]),a=b.useRef(null),i=an(n,{focusRef:a});return s?c.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:c.jsxs("div",{ref:i,className:"modal session-summary",onClick:l=>l.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"ss-title",children:[c.jsxs("div",{className:"modal-head",children:[c.jsxs("div",{className:"modal-title",children:[c.jsx("span",{className:"state-pill state-done","aria-hidden":!0,children:"done"}),c.jsx("span",{id:"ss-title",className:"modal-tool-name",title:s.cwd??s.sessionId,children:s.label}),c.jsxs("span",{className:"modal-tool-id",children:["· ",s.sessionId.slice(0,8)]})]}),c.jsxs("div",{className:"modal-actions",children:[c.jsx("span",{className:"modal-dur",title:"Total wall time",children:s.durationLabel}),c.jsx("button",{type:"button",ref:a,className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),c.jsxs("div",{className:"modal-body",children:[c.jsxs("section",{className:"ss-hero",children:[c.jsxs("div",{className:"ss-hero-left",children:[c.jsx("div",{className:"ss-cost-label",children:FT}),c.jsx("div",{className:"ss-cost",children:Je(s.cost.total)}),s.modelChips.length>0&&c.jsx("div",{className:"ss-models",children:s.modelChips.map(l=>c.jsx("span",{className:"model-chip","data-family":ad(l),title:l,children:Fs(l)},l))})]}),c.jsx("div",{className:"ss-hero-right",children:s.cost.total>0&&c.jsxs(c.Fragment,{children:[c.jsx(Kw,{cost:s.cost,size:"lg"}),c.jsxs("div",{className:"ss-cost-legend",children:[c.jsxs("span",{className:"ssl ssl-in",children:["input ",c.jsx("b",{children:Je(s.cost.input)})]}),c.jsxs("span",{className:"ssl ssl-out",children:["output ",c.jsx("b",{children:Je(s.cost.output)})]}),c.jsxs("span",{className:"ssl ssl-cr",children:["cache r ",c.jsx("b",{children:Je(s.cost.cacheRead)})]}),c.jsxs("span",{className:"ssl ssl-cw",children:["cache w ",c.jsx("b",{children:Je(s.cost.cacheWrite)})]})]})]})})]}),c.jsxs("section",{className:"ss-stats",children:[c.jsx(Oo,{label:"agents",value:s.agentCount}),c.jsx(Oo,{label:"subagents",value:s.subagentCount}),c.jsx(Oo,{label:"tool calls",value:s.toolCount}),c.jsx(Oo,{label:"prompts",value:s.promptCount}),c.jsx(Oo,{label:"tokens",value:s.tokensSum.toLocaleString()}),s.errCount>0&&c.jsx(Oo,{label:"errors",value:s.errCount,tone:"err"})]}),s.topTools.length>0&&c.jsxs("section",{className:"modal-section",children:[c.jsx("h4",{children:"Most-used tools"}),c.jsx("div",{className:"ss-top-tools",children:s.topTools.map(([l,d])=>c.jsxs("div",{className:"ss-tt",children:[c.jsx("span",{className:"ss-tt-name",children:l}),c.jsx("span",{className:"ss-tt-bar",children:c.jsx("span",{className:"ss-tt-bar-fill",style:{width:`${d/s.topTools[0][1]*100}%`}})}),c.jsx("span",{className:"ss-tt-count",children:d})]},l))})]}),s.firstPrompt&&c.jsxs("section",{className:"modal-section",children:[c.jsx("h4",{children:"Opening prompt"}),c.jsx("div",{className:"ss-prompt",children:s.firstPrompt})]})]})]})}):null}function Oo({label:e,value:t,tone:n}){return c.jsxs("div",{className:`ss-stat${n?` tone-${n}`:""}`,children:[c.jsx("div",{className:"ss-stat-value",children:t}),c.jsx("div",{className:"ss-stat-label",children:e})]})}function P4(e,t){const n=e.agents.get(t);if(!n)return null;const s=[];for(const j of e.agents.values())j.sessionId===t&&s.push(j);if(s.length===0)return null;const a={input:0,output:0,cacheRead:0,cacheWrite:0,total:0},i=new Set,l=new Map;let d=0,f=0,p=0,h=0,g=0,y,w=1/0,S=0;for(const j of s){const C=An(j);a.input+=C.input,a.output+=C.output,a.cacheRead+=C.cacheRead,a.cacheWrite+=C.cacheWrite,a.total+=C.total;for(const M of CT(j))i.add(M);j.model&&i.add(j.model),j.kind==="subagent"&&g++,f+=j.prompts.length,!y&&j.prompts.length>0&&(y=j.prompts[0].text),p+=j.usage.inputTokens+j.usage.outputTokens,d+=j.toolCount,w=Math.min(w,j.startedAt),S=Math.max(S,j.endedAt??Date.now());for(const M of j.tools)l.set(M.name,(l.get(M.name)??0)+1),M.ok===!1&&h++}const k=Math.max(0,S-w),N=Math.floor(k/1e3),_=N<60?`${N}s`:N<3600?`${Math.floor(N/60)}m ${String(N%60).padStart(2,"0")}s`:`${Math.floor(N/3600)}h ${Math.floor(N%3600/60)}m`,E=Array.from(l.entries()).sort((j,C)=>C[1]-j[1]).slice(0,5);return{sessionId:t,label:n.label||n.cwdBasename||"session",cwd:n.cwd,durationLabel:_,cost:a,modelChips:Array.from(i),agentCount:s.length,subagentCount:g,toolCount:d,promptCount:f,tokensSum:p,errCount:h,topTools:E,firstPrompt:y}}function Pk(e){return e.waiting?Ul(e.waiting)?0:1:e.state==="active"?2:3}function L4(e,t){const n=[];for(const s of e.agents.values()){if(s.kind!=="root")continue;let a=s.toolCount,i=An(s).total,l=s.endedAt??s.startedAt;for(const d of e.agents.values()){if(d.sessionId!==s.sessionId||d.kind==="root")continue;a+=d.toolCount,i+=An(d).total;const f=d.endedAt??d.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=Pk(s),l=Pk(a);return i!==l?i-l:s.waiting&&a.waiting?s.waiting.since-a.waiting.since:a.lastActivity-s.lastActivity}),n}function Lk(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 q4({state:e,now:t,selectedIds:n,onSelect:s,onClose:a}){const i=b.useMemo(()=>L4(e),[e,e.revision,t]),l=i.filter(f=>f.state==="active").length,d=i.filter(f=>Ul(f.waiting)).length;return c.jsxs("aside",{className:"session-list",id:"session-list","aria-label":"Sessions",children:[c.jsxs("div",{className:"sl-header",children:[c.jsxs("h2",{children:["Sessions ",c.jsx("span",{className:"sl-count",children:i.length})]}),d>0&&c.jsxs("span",{className:"sl-waiting-count",children:[d," waiting"]}),l>0&&c.jsxs("span",{className:"sl-live-count",children:[l," live"]}),c.jsx("button",{className:"glyph-btn sl-close",onClick:a,title:"Hide sidebar (L)","aria-label":"Hide session list",children:"‹"})]}),c.jsxs("div",{className:"sl-rows",children:[i.length===0&&c.jsx("div",{className:"sl-empty",children:"No sessions yet."}),i.map(f=>{const p=n.has(f.sessionId);return c.jsxs("button",{type:"button",className:`sl-row state-${f.state}${p?" selected":""}`,onClick:()=>s(f.sessionId),title:`Focus ${f.label}`,children:[c.jsx("span",{className:`sl-dot state-${f.state}`,"aria-hidden":!0}),c.jsx("span",{className:"vis-hidden",children:Gu(f.state)}),c.jsxs("div",{className:"sl-row-body",children:[c.jsxs("div",{className:"sl-row-head",children:[c.jsx("span",{className:"sl-label",children:f.label}),f.modelId&&c.jsx("span",{className:"model-chip","data-family":ad(f.modelId),title:f.modelId,children:Fs(f.modelId)})]}),c.jsxs("div",{className:"sl-row-meta",children:[c.jsxs("span",{title:"tool calls",children:[c.jsx("b",{children:f.toolCount})," tools"]}),f.cost>0&&c.jsx("span",{className:"sl-cost",title:FT,children:c.jsx("b",{children:Je(f.cost)})}),f.waiting?c.jsxs("span",{className:"sl-waiting",title:[Tl(f.waiting),P3(f.waiting,Tl(f.waiting)),`Blocked since ${new Date(f.waiting.since).toLocaleTimeString()} · started ${new Date(f.startedAt).toLocaleString()}`].filter(Boolean).join(`
|
|
74
|
+
`),children:["waiting ",Lk(f.waiting.since,void 0,t),f.waiting.tool&&c.jsxs("span",{className:"sl-waiting-tool",children:[" · ",f.waiting.tool.name]})]}):c.jsx("span",{className:"sl-elapsed",title:`Started ${new Date(f.startedAt).toLocaleString()}`,children:Lk(f.startedAt,f.state==="active"?void 0:f.lastActivity,t)})]})]})]},f.sessionId)})]})]})}const D4=e=>1-Math.pow(1-e,5),zT=420;function F4(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 z4(e,t,n,s=zT){return n>=s?t:n<=0?e:e+(t-e)*D4(n/s)}function B4(e,t,n,s={}){const a=s.now??(()=>performance.now()),i=s.raf??(w=>requestAnimationFrame(w)),l=s.cancel??(w=>cancelAnimationFrame(w)),d=s.reducedMotion??(()=>typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches),f=s.hidden??(()=>typeof document=="object"&&document.hidden===!0);if(d()||f()||!F4(e,t))return n(t),()=>{};const p=a();let h=0,g=!0;const y=()=>{if(!g)return;const w=a()-p;n(z4(e,t,w)),w<zT&&(h=i(y))};return h=i(y),()=>{g=!1,h&&l(h)}}const uw={cost:0,inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0,sessions:0};function qk(e,t){const n=new Map;for(const s of e){if(s.kind!=="root"||!s.sessionId)continue;const a=An(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 U4(e,t){if(!e)return uw;const n={...uw};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 dw(e,t=new Date){return new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate()-(e-1))).toISOString().slice(0,10).replace(/-/g,"")}const id=[{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 W4(e,t,n=id.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 H4(e,t=new Date){return e==="today"?dw(1,t):e==="month"?dw(t.getDate(),t):"20200101"}const Rn=e=>typeof e=="number"&&Number.isFinite(e)?e:0,Tu=e=>typeof e=="string"?e:"";function BT(e){const t=Array.isArray(e==null?void 0:e.days)?e.days:[],n=new Map;for(const s of t){const a=Array.isArray(s==null?void 0:s.modelBreakdowns)?s.modelBreakdowns:[];for(const i of a){const l=Tu(i==null?void 0:i.modelName);if(!l)continue;let d=n.get(l);d||(d={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,d)),d.cost+=Rn(i==null?void 0:i.cost),d.inputTokens+=Rn(i==null?void 0:i.inputTokens),d.outputTokens+=Rn(i==null?void 0:i.outputTokens),d.cacheReadTokens+=Rn(i==null?void 0:i.cacheReadTokens),d.cacheCreateTokens+=Rn(i==null?void 0:i.cacheCreationTokens)}}return[...n.values()].sort((s,a)=>a.cost-s.cost||a.tokens-s.tokens)}function G4(e,t=new Map){const n=Array.isArray(e==null?void 0:e.sessions)?e.sessions:[],s=[];for(const a of n){const i=Tu(a==null?void 0:a.period);if(!i)continue;const l=a==null?void 0:a.metadata,d=typeof(l==null?void 0:l.lastActivity)=="string"?Date.parse(l.lastActivity):NaN;s.push({sessionId:i,label:t.get(i)??null,agent:Tu(a==null?void 0:a.agent)||"claude",cost:Rn(a==null?void 0:a.totalCost),tokens:Rn(a==null?void 0:a.totalTokens),models:Array.isArray(a==null?void 0:a.modelsUsed)?a.modelsUsed.map(Tu).filter(Boolean):[],lastActivityMs:Number.isFinite(d)?d:null})}return s.sort((a,i)=>i.cost-a.cost||i.tokens-a.tokens)}function UT(e){const t=e==null?void 0:e.totals;if(t&&typeof t=="object"){const f=Rn(t.cacheReadTokens),p=Rn(t.cacheCreationTokens),h=Rn(t.inputTokens),g=Rn(t.outputTokens);return{cost:Rn(t.totalCost),inputTokens:h,outputTokens:g,cacheReadTokens:f,cacheCreateTokens:p,tokens:Rn(t.totalTokens)||h+g+f+p}}const n=BT(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),d=s(f=>f.cacheCreateTokens);return{cost:s(f=>f.cost),inputTokens:a,outputTokens:i,cacheReadTokens:l,cacheCreateTokens:d,tokens:a+i+l+d}}function V4(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 Dk(e,t){var n;return((n=id.find(s=>s.key===(e??t)))==null?void 0:n.noun)??"today"}function Y4(e,t,n){const s=e!=null,a=UT(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 K4="1",Fk="agent-dag.schema",X4=["agent-dag.layout","agent-dag.viewport"];function ni(e){if(typeof window>"u")return null;try{return window.localStorage.getItem(e)}catch{return null}}function Q4(e,t=K4){let n=null;try{n=e.getItem(Fk)}catch{return[]}if(n===t)return[];const s=[];if(n!==null)for(const a of X4)try{e.getItem(a)!==null&&(e.removeItem(a),s.push(a))}catch{}try{e.setItem(Fk,t)}catch{}return s}const Ut="ccdeck";function WT(e){const t=Math.max(0,e);return t<60?"just now":t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}function hw(e){return WT(Math.floor(e/1e3))}function HT(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 Z4(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function J4(e,t,n){const s=new Date(e),a=hw(t-e);return{label:Z4(s,new Date(t))?a:`${a} · ${s.toLocaleDateString(n,{month:"short",day:"numeric"})}`,title:s.toLocaleString(n,{dateStyle:"medium",timeStyle:"medium"})}}function Ko(e,t){return{disabled:e!=null&&e!==t,busy:e===t}}function Xw(e){return e==null}const fw="self";function cr(e,t=!1){const n=Ko(e?fw:null,fw);return{disabled:t||n.disabled,"aria-busy":n.busy}}function ur(e){return Xw(e?fw:null)}function eq(e){return[...e==null?[]:[`#ap-more-${e}`],".accounts-panel .ap-refresh"]}function tq(e){return e==null||e==="BODY"||e==="HTML"}const GT="agent-dag.usagePeriod";function nq(){const e=ni(GT);return id.some(t=>t.key===e)?e:"today"}function rq(e){if(!(typeof window>"u"))try{window.localStorage.setItem(GT,e)}catch{}}const VT="agent-dag.usageSessionsOpen";function sq(){return ni(VT)==="1"}function aq(e){if(!(typeof window>"u"))try{window.localStorage.setItem(VT,e?"1":"0")}catch{}}function zk(e,t){if(!e)return null;const n=t-Math.floor(e/1e3);return n<10?"just now":n<60?`${n}s ago`:n<3600?`${Math.floor(n/60)}m ago`:`${Math.floor(n/3600)}h ago`}function oq(e){return e==="claude-swap"?"Read from claude-swap's last collection — costs no request against your usage-endpoint budget":e==="api"?"Fetched from Anthropic's usage endpoint, at most once every 5 minutes":e==="cli"?"Parsed from `claude /usage`, at most once every 5 minutes":"Last update"}const xf="__unknown__";function iq(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),d=e-l;if(Math.abs(d)<3)return{label:"on pace",color:"var(--ok)",expectedPct:l,isDeficit:!1};if(d>0){const f=100-e,p=i>0?e/i:0,h=p>0?f/p:1/0,g={label:`${Math.round(d)}% ahead`,color:"var(--warn)",expectedPct:l,isDeficit:!0};if(h<a&&h<86400){const y=Math.floor(h/3600),w=Math.floor(h%3600/60);g.runsOutIn=y>0?`${y}h ${w}m`:`${w}m`}return g}return{label:`${Math.round(-d)}% reserve`,color:"var(--ok)",expectedPct:l,isDeficit:!1}}function Sa({pct:e,label:t,reset:n,resetAt:s,windowSec:a,limitReached:i,nowSec:l}){const d=Math.min(100,Math.max(0,e)),p=i||d>=90?"var(--err)":d>=70?"var(--warn)":"var(--accent)",h=d===0?"< 1%":`${d}%`,g=d===0?2:d,y=s?HT(s,l):null,w=s&&a?iq(d,s,a,l):null;return c.jsxs("div",{className:"qb-row",children:[c.jsxs("div",{className:"qb-meta",children:[c.jsxs("span",{className:"qb-label",children:[t,i&&c.jsx("span",{className:"qb-limit-badge",title:"Rate limit reached",children:"⛔"})]}),c.jsx("span",{className:"qb-pct",style:{color:p},children:h})]}),c.jsxs("div",{className:"qb-track",children:[c.jsx("div",{className:"qb-fill",style:{width:`${g}%`,background:p,opacity:d===0?.4:1}}),w&&c.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`})]}),c.jsxs("div",{className:"qb-reset-row",children:[y?c.jsxs("span",{className:"qb-reset",children:["resets in ",y]}):n?c.jsxs("span",{className:"qb-reset",children:["resets ",n]}):null,w&&c.jsx("span",{className:"qb-pace",style:{color:w.color},children:w.runsOutIn?`runs out in ${w.runsOutIn}`:w.label})]})]})}const lq=6e4;function cq(e){const[t,n]=b.useState(null),[s,a]=b.useState(!1),i=b.useRef(null),l=b.useRef(!1),d=async(p=!1)=>{if(!(p&&!ur(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 d(!0),i.current=window.setInterval(()=>d(!1),lq),()=>{i.current!=null&&window.clearInterval(i.current)}},[e]),{quota:t,loading:s,refresh:()=>{e&&d(!0)}}}function uq(e){switch(e){case"no_subscription":return"This install signs in with an API key (or Bedrock/Vertex), which is billed per token and has no session window.";case"rate_limited":return"Anthropic asked the deck to wait — it will retry on its own.";case"waiting":return"Waiting for the next allowed read — or click ↻.";default:return"Run /usage in a claude session, then click ↻"}}function dq(e){switch(e){case"no_token":return"Run codex login to authenticate.";case"api_key_mode":return"API-key login — ChatGPT quota is only available for codex login.";case"refresh_rejected":return"Codex session expired — run codex login.";case"refresh_failed":return"Couldn't refresh the Codex token — click ↻ to retry.";case"untrusted_base_url":return"chatgpt_base_url in ~/.codex/config.toml is not an https OpenAI host, so the token was not sent.";default:return"ChatGPT API unreachable — click ↻ to retry."}}const YT=6e4,Bk=6e4;function hq(e){const[t,n]=b.useState(null),[s,a]=b.useState(!1),i=b.useRef(null),l=b.useRef(!1),d=async(p=!1)=>{if(!(p&&!ur(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 d(!0),i.current=window.setInterval(()=>d(!1),YT),()=>{i.current!=null&&window.clearInterval(i.current)}},[e]),{data:t,loading:s,refresh:()=>{e&&d(!0)}}}function fq(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,YT),()=>{s.current!=null&&window.clearInterval(s.current)}},[e]),{data:t}}function pq(e,t,n){const[s,a]=b.useState(null),[i,l]=b.useState(!1),[d,f]=b.useState(0),p=b.useRef(0);b.useEffect(()=>{const g=()=>document.visibilityState==="visible",y=()=>{g()&&f(k=>k+1)},w=window.setInterval(y,Bk),S=()=>{g()&&Date.now()-p.current>=Bk&&f(k=>k+1)};return document.addEventListener("visibilitychange",S),()=>{window.clearInterval(w),document.removeEventListener("visibilitychange",S)}},[]);const h=b.useRef(t);return b.useEffect(()=>{let g=!0;const y=t!==h.current;h.current=t;const w=e,S=H4(w);return l(!0),fetch(`/api/ccusage?since=${S}${y?"&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,d]),{...V4(s,e),loading:i}}function ul(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 B4(s.current,e,l=>{s.current=l,n(l)})},[e]),t}function mq({state:e,now:t,providers:n,onClose:s}){var at,Ye;const{quota:a,loading:i,refresh:l}=cq(n.claude),{data:d,loading:f,refresh:p}=hq(n.codex),{data:h}=fq(n.codex),[g,y]=b.useState(()=>Math.floor(Date.now()/1e3));b.useEffect(()=>{const me=window.setInterval(()=>y(Math.floor(Date.now()/1e3)),3e4);return()=>window.clearInterval(me)},[]);const{byModel:w,totalCost:S,totalTokens:k,burnRate:N}=b.useMemo(()=>{const me=new Map;for(const se of e.agents.values())for(const je of Bl(se)){const Fe=je.model??xf,Ee=Ww(je.usage,je.model),Ue=me.get(Fe);Ue?(Ue.inputTokens+=je.usage.inputTokens,Ue.outputTokens+=je.usage.outputTokens,Ue.cacheReadTokens+=je.usage.cacheReadTokens,Ue.cacheCreateTokens+=je.usage.cacheCreateTokens,Ue.cost.total+=Ee.total,Ue.cost.input+=Ee.input,Ue.cost.output+=Ee.output,Ue.cost.cacheRead+=Ee.cacheRead,Ue.cost.cacheWrite+=Ee.cacheWrite,Ue.agentCount++):me.set(Fe,{model:Fe,inputTokens:je.usage.inputTokens,outputTokens:je.usage.outputTokens,cacheReadTokens:je.usage.cacheReadTokens,cacheCreateTokens:je.usage.cacheCreateTokens,cost:{...Ee},agentCount:1,priced:ti(je.model)!=null})}const be=Array.from(me.values()).sort((se,je)=>je.cost.total-se.cost.total||je.inputTokens+je.outputTokens-(se.inputTokens+se.outputTokens));let De=0,He=0;for(const se of e.agents.values()){if(se.state!=="active")continue;const je=An(se);De+=je.total,He=Math.max(He,((se.endedAt??t)-se.startedAt)/1e3)}const ot=He>0?Hw(De,He):null,Le=M4(e.agents.values());return{byModel:be,totalCost:Le.cost,totalTokens:Le,burnRate:ot}},[e,e.revision,t]),_=b.useMemo(()=>{const me=[];for(const be of e.agents.values()){if(be.kind!=="root")continue;let De=An(be).total,He=be.usage.inputTokens,ot=be.usage.outputTokens,Le=iw(be);for(const se of e.agents.values())se.sessionId!==be.sessionId||se.kind==="root"||(De+=An(se).total,He+=se.usage.inputTokens,ot+=se.usage.outputTokens,Le+=iw(se));me.push({sessionId:be.sessionId,label:be.label||be.cwdBasename||"session",state:be.state,cost:De,inputTokens:He,outputTokens:ot,unpricedTokens:Le})}return me.sort((be,De)=>De.cost-be.cost||De.inputTokens+De.outputTokens-(be.inputTokens+be.outputTokens)).slice(0,12)},[e,e.revision]),[E,j]=b.useState(nq);b.useEffect(()=>{rq(E)},[E]);const[C,M]=b.useState(sq);b.useEffect(()=>{aq(C)},[C]);const $=b.useRef([]),[I,F]=b.useState(0),O=b.useRef(()=>new Map);O.current=()=>qk(e.agents.values(),t);const A=b.useCallback(()=>O.current(),[]),{data:L,shown:H,stale:X,loading:T,baseline:K}=pq(E,I,A),D=L!=null,te=T&&X,Z=b.useMemo(()=>{const me=new Map;for(const be of e.agents.values()){if(be.kind!=="root"||!be.sessionId)continue;const De=be.label||be.cwdBasename;De&&me.set(be.sessionId,De)}return me},[e,e.revision]),V=b.useMemo(()=>{const me=new Map;for(const be of e.agents.values())be.kind!=="root"||!be.sessionId||me.set(be.sessionId,be.state);return me},[e,e.revision]),J=b.useMemo(()=>D?BT(L):[],[L,D]),P=b.useMemo(()=>{if(!D)return[];const me=G4(L,Z).slice(0,12),be=new Map;for(const De of me)De.label&&be.set(De.label,(be.get(De.label)??0)+1);return me.map(De=>De.label&&(be.get(De.label)??0)>1?{...De,label:`${De.label} ${De.sessionId.slice(0,4)}`}:De)},[L,D,Z]),Y=b.useMemo(()=>UT(L),[L]),de=Dk(H,E),U=X?" up-stale":"",z=b.useMemo(()=>D?U4(K,qk(e.agents.values(),t)):uw,[e,e.revision,K,D,t]),Q=Y4(L,{...k,cost:S},z),W=Q.hasCost,le=Q.tokenSum,pe=ul(Q.cost),ge=ul(Q.inputTokens),Ne=ul(Q.outputTokens),ce=ul(Q.cacheReadTokens),we=ul(Q.cacheCreateTokens),Ce=w.filter(me=>me.cost.total>0||me.inputTokens+me.outputTokens>0),_e=_.filter(me=>me.cost>0||me.inputTokens+me.outputTokens>0),We=D?J.some(me=>me.cost<=0&&me.tokens>0):Ce.some(me=>!me.priced),Se=i||f,re=zk(a==null?void 0:a.fetchedAt,g),Qe=zk(d==null?void 0:d.fetchedAt,g),ft=()=>{l(),p(),F(me=>me+1)},ut=n.claude&&n.codex?"Refresh Claude + Codex quota":n.codex?"Refresh Codex quota":"Refresh Claude quota";return c.jsxs("aside",{className:"usage-panel",id:"usage-panel","aria-label":"Usage",children:[c.jsxs("div",{className:"up-header",children:[c.jsx("h2",{children:"Usage"}),N&&c.jsx("span",{className:"up-rate",children:N}),c.jsxs("div",{className:"up-header-right",children:[(n.claude||n.codex)&&c.jsx("button",{type:"button",className:"glyph-btn up-refresh-btn",onClick:ft,...cr(Se),"aria-label":ut,title:ut,children:Se?"…":"↻"}),c.jsx("button",{type:"button",className:"glyph-btn up-close",onClick:s,"aria-label":"Close usage panel",title:"Close (U)",children:"×"})]})]}),n.claude&&c.jsxs("section",{className:"up-section up-quota-section",children:[c.jsxs("h3",{className:"up-section-title",children:["Claude quota",re&&!i&&c.jsx("span",{className:"up-section-age",title:oq(a==null?void 0:a.source),children:re})]}),a!=null&&a.ok?c.jsxs("div",{className:"up-quota-bars",children:[a.session5hPct!=null&&c.jsx(Sa,{label:"5-hour window",pct:a.session5hPct,reset:a.session5hReset,resetAt:a.session5hResetAt,windowSec:a.session5hWindowSec,nowSec:g}),a.week7dPct!=null&&c.jsx(Sa,{label:"7-day window",pct:a.week7dPct,reset:a.week7dReset,resetAt:a.week7dResetAt,windowSec:a.week7dWindowSec,nowSec:g}),a.weekSonnetPct!=null&&c.jsx(Sa,{label:"Sonnet (7d)",pct:a.weekSonnetPct,nowSec:g}),a.weekOpusPct!=null&&c.jsx(Sa,{label:"Opus (7d)",pct:a.weekOpusPct,nowSec:g})]}):(a==null?void 0:a.ok)===!1?c.jsxs("div",{className:"up-quota-na",children:[c.jsx("span",{children:a.reason==="no_subscription"?"No quota to show.":"Quota unavailable."}),c.jsx("span",{className:"up-quota-hint",children:uq(a.reason)})]}):c.jsx("div",{className:"up-quota-na up-quota-loading",children:"Checking…"})]}),n.codex&&c.jsxs("section",{className:"up-section up-quota-section",children:[c.jsxs("h3",{className:"up-section-title",children:["Codex quota",(d==null?void 0:d.ok)&&d.planLabel&&c.jsx("span",{className:"up-plan-badge",children:d.planLabel}),Qe&&!f&&c.jsx("span",{className:"up-section-age",title:"Fetched from the Codex usage endpoint",children:Qe})]}),d!=null&&d.ok?c.jsxs("div",{className:"up-quota-bars",children:[(at=d.windows)==null?void 0:at.map(me=>c.jsx(Sa,{label:me.label,pct:me.pct,reset:me.reset??void 0,resetAt:me.resetAt??void 0,windowSec:me.windowSec??void 0,limitReached:d.limitReached&&me.pct>=100,nowSec:g},me.id)),(Ye=d.extraWindows)==null?void 0:Ye.map(me=>c.jsx(Sa,{label:me.label,pct:me.pct,reset:me.reset??void 0,resetAt:me.resetAt??void 0,windowSec:me.windowSec??void 0,nowSec:g},me.id)),d.creditLimit&&c.jsx(Sa,{label:`spend cap · $${Math.round(d.creditLimit.used)} of $${Math.round(d.creditLimit.limit)}`,pct:d.creditLimit.usedPct,reset:d.creditLimit.reset??void 0,resetAt:d.creditLimit.resetAt??void 0,limitReached:d.spendControlReached,nowSec:g}),d.creditsBalance&&!d.creditsUnlimited&&c.jsxs("div",{className:"up-quota-sub up-credits",children:["credits: $",d.creditsBalance,d.overageReached&&" · overage limit reached"]}),d.creditsUnlimited&&c.jsx("div",{className:"up-quota-sub up-credits",children:"credits: unlimited"}),d.resetCredits&&d.resetCredits.availableCount>0&&c.jsxs("div",{className:"up-quota-sub up-reset-credits",title:`Redeem in the Codex CLI or ChatGPT — ${Ut} only reports them`,children:[d.resetCredits.availableCount," rate-limit reset",d.resetCredits.availableCount!==1?"s":""," available",d.resetCredits.nextExpiryAt&&` · expires ${new Date(d.resetCredits.nextExpiryAt).toLocaleDateString("en-US",{month:"short",day:"numeric"})}`]}),d.promo&&c.jsx("div",{className:"up-quota-sub",children:d.promo}),d.partial&&c.jsx("div",{className:"up-quota-sub up-quota-hint",children:"Partial data — OpenAI returned limits this build doesn't recognise."})]}):(d==null?void 0:d.ok)===!1?c.jsxs("div",{className:"up-quota-na",children:[c.jsx("span",{children:"Quota unavailable."}),c.jsx("span",{className:"up-quota-hint",children:dq(d.reason)})]}):c.jsx("div",{className:"up-quota-na up-quota-loading",children:"Checking…"}),(h==null?void 0:h.ok)&&h.window7d&&h.window7d.sessionCount>0&&c.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)"]})]}),D&&c.jsx("div",{className:"uh-range up-period",role:"toolbar","aria-orientation":"horizontal","aria-label":"Period","aria-busy":te||void 0,onKeyDown:me=>{var He;const be=$.current.indexOf(me.target);if(be<0)return;const De=W4(me.key,be);De!==null&&(me.preventDefault(),(He=$.current[De])==null||He.focus())},children:id.map((me,be)=>c.jsx("button",{type:"button",ref:De=>{$.current[be]=De},tabIndex:E===me.key?0:-1,"aria-pressed":E===me.key,"data-pending":E===me.key&&te?"":void 0,title:E===me.key&&te?`Reading ${me.noun} from the transcripts on this machine…`:me.hint,className:"uh-range-btn",onClick:()=>j(me.key),children:me.label},me.key))}),D&&c.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:te?`Reading ${Dk(E,E)}…`:""}),le>0?c.jsxs(c.Fragment,{children:[W&&c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:`up-total${U}`,title:D?void 0:$k,children:[c.jsx("span",{className:"up-total-value",children:Je(pe)}),c.jsx("span",{className:"up-total-label",children:D?de:I4})]}),Q.showCostBar&&c.jsx(Kw,{cost:S})]}),c.jsxs("div",{className:`up-tokens-row${U}`,title:D?void 0:$k,children:[c.jsxs("span",{className:"up-tok",children:[c.jsx("span",{className:"up-k",children:"in"}),At(ge)]}),c.jsxs("span",{className:"up-tok",children:[c.jsx("span",{className:"up-k",children:"out"}),At(Ne)]}),Q.cacheReadTokens>0&&c.jsxs("span",{className:"up-tok",children:[c.jsx("span",{className:"up-k",children:"cache r"}),At(ce)]}),Q.cacheCreateTokens>0&&c.jsxs("span",{className:"up-tok",children:[c.jsx("span",{className:"up-k",children:"cache c"}),At(we)]}),!W&&c.jsx("span",{className:"up-tok up-scope",children:O4})]}),(D?J.length:Ce.length)>0&&c.jsxs("section",{className:`up-section${U}`,children:[c.jsx("h3",{className:"up-section-title",children:"By model"}),c.jsxs("table",{className:"up-table",children:[c.jsx("thead",{children:c.jsxs("tr",{children:[c.jsx("th",{children:"Model"}),c.jsx("th",{children:"Tokens"}),c.jsx("th",{children:"Cost"})]})}),c.jsx("tbody",{children:D?J.map(me=>c.jsxs("tr",{children:[c.jsx("td",{className:"up-model-name",title:me.model,children:Fs(me.model)}),c.jsx("td",{className:"up-num",children:At(me.tokens)}),me.cost>0?c.jsx("td",{className:"up-num up-cost-val",children:Je(me.cost)}):c.jsx("td",{className:"up-num up-unpriced",children:Lo})]},me.model)):Ce.map(me=>c.jsxs("tr",{children:[c.jsx("td",{className:"up-model-name",title:me.model===xf?"no model reported yet":me.model,children:me.model===xf?"unknown":Fs(me.model)}),c.jsx("td",{className:"up-num",children:At(me.inputTokens+me.outputTokens)}),me.priced?c.jsx("td",{className:"up-num up-cost-val",children:Je(me.cost.total)}):c.jsx("td",{className:"up-num up-unpriced",children:Lo})]},me.model))})]})]}),D&&P.length===0&&Y.tokens>0&&c.jsxs("section",{className:"up-section",children:[c.jsx("h3",{className:"up-section-title",children:"By session"}),c.jsxs("div",{className:"up-hint",children:["No session is dated ",de," yet — ccusage dates sessions in UTC, and the totals above are your local day."]})]}),(D?P.length:_e.length)>0&&(()=>{const me=D?P.length:_e.length;return c.jsxs("section",{className:`up-section${U}`,children:[c.jsx("h3",{className:"up-section-title",children:c.jsxs("button",{type:"button",className:"up-disclose","aria-expanded":C,"aria-controls":"up-sessions",title:C?"Hide the per-session breakdown":`Show the per-session breakdown — ${me} session${me===1?"":"s"}`,onClick:()=>M(be=>!be),children:["By session",D&&c.jsxs("span",{className:"up-section-age",title:`Sessions with activity ${de}, 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 ",de]}),c.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:c.jsx("path",{d:"M2.2 3.6 5 6.4 7.8 3.6"})})]})}),c.jsxs("div",{className:"up-sessions",id:"up-sessions",hidden:!C,children:[D&&P.map(be=>{const De=V.get(be.sessionId);return c.jsxs("div",{className:"up-session-row",children:[De?c.jsxs(c.Fragment,{children:[c.jsx("span",{className:`sl-dot state-${De}`,"aria-hidden":!0}),c.jsx("span",{className:"vis-hidden",children:Gu(De)})]}):c.jsx("span",{className:"sl-dot up-dot-past","aria-hidden":!0}),c.jsx("span",{className:`up-session-label${be.label?"":" up-session-id"}`,title:be.label?`${be.label}
|
|
77
|
+
${be.sessionId}`:be.sessionId,children:be.label??be.sessionId.slice(0,8)}),c.jsx("span",{className:"up-session-tokens",children:At(be.tokens)}),be.cost>0?c.jsx("span",{className:"up-session-cost",title:be.models.join(", ")||void 0,children:Je(be.cost)}):c.jsx("span",{className:"up-session-cost up-unpriced",children:Lo})]},be.sessionId)}),!D&&_e.map(be=>c.jsxs("div",{className:"up-session-row",children:[c.jsx("span",{className:`sl-dot state-${be.state}`,"aria-hidden":!0}),c.jsx("span",{className:"vis-hidden",children:Gu(be.state)}),c.jsx("span",{className:"up-session-label",children:be.label}),c.jsx("span",{className:"up-session-tokens",children:At(be.inputTokens+be.outputTokens)}),be.cost>0?c.jsxs("span",{className:"up-session-cost",title:be.unpricedTokens>0?`${At(be.unpricedTokens)} tokens in this session are on an unpriced model, so this is a floor`:void 0,children:[Je(be.cost),be.unpricedTokens>0?"+":""]}):c.jsx("span",{className:"up-session-cost up-unpriced",children:Lo})]},be.sessionId))]})]})})(),We&&c.jsxs("div",{className:"up-hint",children:["“",Lo,"” means this build holds no published rate for that model — those tokens are counted above and their dollars are not."]})]}):c.jsx("div",{className:"up-empty",children:D?c.jsxs(c.Fragment,{children:["No usage ",de,".",c.jsx("br",{}),"Try a longer period."]}):c.jsxs(c.Fragment,{children:["No usage data yet.",c.jsx("br",{}),"Start a Claude Code or Codex session."]})})]})}const Gt={l:30,r:6,t:6,b:2},Os={l:0,r:0,t:2,b:1},ld=104,gq=64;function lr(e,t=100,n=ld,s=Gt){const a=n-s.t-s.b;return s.t+a*(1-Math.max(0,Math.min(t,e))/t)}function KT(e,t,n,s=100,a=ld,i=Gt){if(!e.length)return"";const l=e[e.length-1].t-e[0].t,d=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}${d(h.t).toFixed(1)} ${lr(h.v,s,a,i).toFixed(1)}`,p=h}return f}function XT(e,t,n,s=100,a=ld,i=Gt){if(e.length<2)return"";const l=a-i.b,d=e[e.length-1].t-e[0].t,f=t-i.l-i.r,p=w=>i.l+(d>0?f*(w-e[0].t)/d:f/2);let h="",g=[];const y=()=>{if(g.length>=2){let w=`M${p(g[0].t).toFixed(1)} ${l}`;for(const S of g)w+=`L${p(S.t).toFixed(1)} ${lr(S.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&&y(),g.push(w);return y(),h}function yq(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 QT(e,t,n){return n!=null&&e>=n?"hot":t!=null&&e>=t?"warn":""}function vq(e,t,n=s=>xl(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 xl(e){const t=new Date(e);return`${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}`}function Qw(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 wq({group:e,title:t,onClose:n}){const s=an(n),[a,i]=b.useState(null);b.useEffect(()=>{let p=!0;const h=async()=>{try{const y=await fetch(`/api/system/history?group=${e}`);if(!y.ok)return;const w=await y.json();p&&(w!=null&&w.ok)&&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)??[],[d,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 Rw.createPortal(c.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:c.jsxs("div",{ref:s,className:"modal hist-modal",onClick:p=>p.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"hist-modal-title",children:[c.jsxs("div",{className:"modal-head",children:[c.jsx("span",{className:"modal-title",id:"hist-modal-title",children:t}),a&&d>0&&c.jsxs("span",{className:"hist-since",children:["since ",xl(d)," · ",Qw(d,f||Date.now())]}),c.jsx("button",{type:"button",className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),c.jsx("div",{className:"hist-body",children:a==null?c.jsx("p",{className:"hist-empty",children:"Reading…"}):l.length===0?c.jsx("p",{className:"hist-empty",children:"Nothing has been measured yet."}):l.map(p=>c.jsx(xq,{series:p,stepMs:a.stepMs},p.label))})]})}),document.body)}function xq({series:e,stepMs:t}){const n=b.useRef(null),[s,a]=b.useState(560),[i,l]=b.useState(null);b.useEffect(()=>{const I=n.current;if(!I||typeof ResizeObserver>"u")return;const F=new ResizeObserver(([O])=>a(Math.max(160,O.contentRect.width)));return F.observe(I),()=>F.disconnect()},[]);const{points:d,unit:f,warnAt:p,critAt:h,label:g,top:y,restsAtZero:w}=e,S=w?gq:ld,{now:k,peak:N}=yq(d),_=f==="C"?"°C":f,E=g==="Throttling"?vq(d,t):null,j=i!=null?d[i]:null,C=d.length>1?d[d.length-1].t-d[0].t:0,M=I=>{const F=s-Gt.l-Gt.r;return Gt.l+(C>0?F*(I-d[0].t)/C:F/2)},$=I=>{if(d.length<2)return;const F=I.currentTarget.getBoundingClientRect(),O=(I.clientX-F.left-Gt.l)/Math.max(1,F.width-Gt.l-Gt.r),A=d[0].t+C*Math.max(0,Math.min(1,O));let L=0;for(let H=1;H<d.length;H++)Math.abs(d[H].t-A)<Math.abs(d[L].t-A)&&(L=H);l(L)};return c.jsxs("section",{className:"hist-series","aria-label":`${g} history`,children:[c.jsxs("div",{className:"hist-head",children:[c.jsx("span",{className:"hist-label",children:g}),c.jsxs("span",{className:"hist-stats",children:[k!=null&&c.jsxs(c.Fragment,{children:[c.jsx("b",{children:k}),c.jsxs("span",{children:[_," now"]})]}),N!=null&&c.jsxs(c.Fragment,{children:[c.jsx("b",{className:QT(N,p,h),children:N}),c.jsxs("span",{children:[_," peak"]})]})]})]}),c.jsx("div",{className:"hist-plot",ref:n,children:c.jsxs("svg",{className:"hist-chart",width:"100%",height:S,viewBox:`0 0 ${s} ${S}`,preserveAspectRatio:"none",role:"img","aria-label":k==null?`${g}: nothing measured yet`:`${g}: ${k}${_} now, peak ${N}${_}, over ${Qw(d[0].t,d[d.length-1].t)}`,onPointerMove:$,onPointerLeave:()=>l(null),children:[[["warn",p],["hot",h]].map(([I,F])=>F==null||F>y?null:c.jsxs("g",{children:[c.jsx("line",{className:`hist-rule ${I}`,x1:Gt.l,x2:s-Gt.r,y1:lr(F,y,S),y2:lr(F,y,S)}),c.jsx("text",{className:`hist-rule-tag ${I}`,x:2,y:lr(F,y,S)+3,children:F})]},I)),c.jsx("line",{className:"hist-floor",x1:Gt.l,x2:s-Gt.r,y1:S-Gt.b,y2:S-Gt.b}),c.jsx("path",{className:"hist-area",d:XT(d,s,t,y,S)}),c.jsx("path",{className:"hist-line",d:KT(d,s,t,y,S)}),d.length===1&&c.jsx("circle",{className:"hist-dot",cx:M(d[0].t),cy:lr(d[0].v,y,S),r:3}),j&&c.jsxs("g",{children:[c.jsx("line",{className:"hist-cross",x1:M(j.t),x2:M(j.t),y1:Gt.t,y2:S-Gt.b}),c.jsx("circle",{className:"hist-dot",cx:M(j.t),cy:lr(j.v,y,S),r:3})]})]})}),c.jsx("div",{className:"hist-axis",children:j?c.jsxs("span",{className:"hist-at",children:[xl(j.t)," — ",c.jsx("b",{children:j.v}),_]}):c.jsxs(c.Fragment,{children:[c.jsx("span",{children:d.length?xl(d[0].t):""}),c.jsx("span",{children:d.length?xl(d[d.length-1].t):""})]})}),E&&c.jsx("div",{className:"hist-note",children:E})]})}const bq="thermal:Throttling";function kq(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[bq]=Math.max(0,100-e.thermal.throttle.speedLimit)),t}function Ru(e,t){return t==="C"?`${Math.round(e)}°`:t==="%"?`${Math.round(e)}%`:e.toFixed(2)}function gu(e,t){return Number.isInteger(e)?t==="C"?`${e}°`:t==="%"?`${e}%`:`${e}`:Ru(e,t)}const Uk=["cores","memory","load","thermal"],Na=116,Nr=24,_q=60,Sq=6e4;function Nq(e){return e.points.length?e.restsAtZero?e.points.some(t=>t.v>0):!0:!1}function Eq(e){return e.unit==="C"?`${e.label} temp`:e.key==="mem:physical"?"Physical RAM":e.key==="mem:swap"?`${e.label} memory`:e.label}function jq(e,t=_q){return e.points.length<=t?e:{...e,points:e.points.slice(-t)}}function Cq({sys:e}){const[t,n]=b.useState({});b.useEffect(()=>{let l=!0;const d=async()=>{const p=await Promise.all(Uk.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[y,w]of p)w!=null&&w.ok&&(g[y]=w);return g})};d();const f=setInterval(()=>void d(),Sq);return()=>{l=!1,clearInterval(f)}},[]);const s=b.useMemo(()=>kq(e),[e]),a=b.useMemo(()=>Uk.flatMap(l=>{const d=t[l];return d?d.series.filter(Nq).map(f=>({series:jq(f),stepMs:d.stepMs})):[]}),[t]),i=b.useMemo(()=>{let l=1/0,d=-1/0;for(const{series:f}of a){const p=f.points;p.length&&(l=Math.min(l,p[0].t),d=Math.max(d,p[p.length-1].t))}return Number.isFinite(l)?Qw(l,d):"less than a minute"},[a]);return Object.keys(s).length?c.jsx("div",{className:"pl-strip",role:"group","aria-label":`This machine, over the last ${i}`,children:a.map(({series:l,stepMs:d})=>c.jsx(Tq,{series:l,stepMs:d,now:s[l.key],span:i},l.key))}):null}function Tq({series:e,stepMs:t,now:n,span:s}){var w;const{points:a,top:i,unit:l,warnAt:d,critAt:f}=e,p=Eq(e),h=n??((w=a[a.length-1])==null?void 0:w.v),g=h==null?"":QT(h,d,f),y=Math.max(...a.map(S=>S.v));return c.jsxs("div",{className:`pl-cell${g?` ${g}`:""}`,title:[`${p} · peak ${Ru(y,l)} over the last ${s}`,d!=null?`over ${gu(d,l)} is uncomfortable`:"",f!=null?`over ${gu(f,l)} the machine acts`:""].filter(Boolean).join(" · "),children:[c.jsxs("div",{className:"pl-cell-head",children:[c.jsx("span",{className:"pl-cell-label",children:p}),c.jsx("span",{className:"pl-cell-now",children:h==null?"—":Ru(h,l)})]}),c.jsxs("svg",{className:"pl-spark",width:Na,height:Nr,viewBox:`0 0 ${Na} ${Nr}`,preserveAspectRatio:"none","aria-hidden":!0,children:[c.jsx("line",{className:"pl-spark-floor",x1:0,x2:Na,y1:Nr-Os.b,y2:Nr-Os.b}),c.jsx("path",{className:"pl-spark-area",d:XT(a,Na,t,i,Nr,Os)}),d!=null&&c.jsx("line",{className:"pl-rule warn",x1:0,x2:Na,y1:lr(d,i,Nr,Os),y2:lr(d,i,Nr,Os)}),f!=null&&c.jsx("line",{className:"pl-rule hot",x1:0,x2:Na,y1:lr(f,i,Nr,Os),y2:lr(f,i,Nr,Os)}),c.jsx("path",{className:"pl-spark-line",d:KT(a,Na,t,i,Nr,Os)})]}),c.jsxs("span",{className:"vis-hidden",children:["peak ",Ru(y,l)," over the last ",s,d!=null&&`, uncomfortable over ${gu(d,l)}`,f!=null&&`, the machine acts over ${gu(f,l)}`]})]})}const Rq={key:"cpu",dir:"desc"};function Aq(e,t){return e.key===t?{...e,dir:e.dir==="asc"?"desc":"asc"}:{key:t,dir:t==="name"||t==="user"?"asc":"desc"}}function Mq(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 d=s(i),f=s(l);return d==null||f==null?d==null?f==null?0:1:-1:n*(d-f)};return[...e].sort((i,l)=>a(i,l)||(l.cpu??-1)-(i.cpu??-1)||l.mem-i.mem||i.pid-l.pid)}function Iq(e,t){return e.key!==t?"none":e.dir==="asc"?"ascending":"descending"}const Oq=4e3;function $q(){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,Oq);return()=>{n=!1,window.clearInterval(a)}},[]),e}function Pq(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 Lq(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 qq({sys:e,onClose:t}){const n=an(t),[s,a]=b.useState(Rq),i=$q(),l=i?Mq(i.procs,s):null;return Rw.createPortal(c.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:c.jsxs("div",{ref:n,className:"modal pl-modal",onClick:d=>d.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"pl-modal-title",children:[c.jsxs("div",{className:"modal-head",children:[c.jsx("span",{className:"modal-title",id:"pl-modal-title",children:"Busiest processes"}),i&&c.jsxs("span",{className:"pl-count",children:[l.length," of ",i.total," running"]}),c.jsx("button",{type:"button",className:"glyph-btn",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),c.jsxs("div",{className:"pl-split",children:[c.jsx("div",{className:"pl-body",children:l==null?c.jsx("p",{className:"pl-empty",children:"Reading the process list…"}):l.length===0?c.jsx("p",{className:"pl-empty",children:"Could not read the process list on this platform."}):c.jsxs("table",{className:"sd-procs pl-table",children:[c.jsx("thead",{children:c.jsxs("tr",{children:[c.jsx($o,{col:"cpu",label:"cpu",sort:s,onSort:a}),c.jsx($o,{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}),c.jsx($o,{col:"threads",label:"threads",sort:s,onSort:a}),c.jsx($o,{col:"uptime",label:"up",sort:s,onSort:a}),c.jsx($o,{col:"user",label:"user",sort:s,onSort:a}),c.jsx("th",{scope:"col",className:"pl-pid-h",children:"pid"}),c.jsx($o,{col:"name",label:"process",note:"Command lines have anything secret-shaped removed, which is a filter and not a guarantee.",sort:s,onSort:a})]})}),c.jsx("tbody",{children:l.map(d=>c.jsxs("tr",{children:[c.jsx("td",{className:"sd-num",children:d.cpu==null?"—":d.cpu.toFixed(0)}),c.jsx("td",{className:"sd-num sd-dim",title:`${d.mem.toFixed(1)}% of installed memory`,children:Pq(d.rssBytes)}),c.jsx("td",{className:"sd-num sd-dim",children:d.threads??"—"}),c.jsx("td",{className:"sd-num sd-dim",children:Lq(d.uptimeSec)}),c.jsx("td",{className:"sd-dim pl-user",children:d.user??"—"}),c.jsx("td",{className:"sd-num sd-dim pl-pid",children:d.pid}),c.jsxs("td",{className:"pl-name",children:[d.name,d.cmd&&c.jsxs("span",{className:"pl-cmd",title:d.cmd,children:[" ",d.cmd]})]})]},d.pid))})]})}),c.jsx(Cq,{sys:e})]})]})}),document.body)}function $o({col:e,label:t,note:n,sort:s,onSort:a}){const i=Iq(s,e);return c.jsx("th",{scope:"col","aria-sort":i,children:c.jsxs("button",{type:"button",className:"sd-sort",title:n?`Sort by ${t}
|
|
78
|
+
|
|
79
|
+
${n}`:`Sort by ${t}`,onClick:()=>a(Aq(s,e)),children:[t,c.jsx("span",{className:"sd-sort-dir","aria-hidden":!0,children:i==="none"?"":i==="ascending"?"↑":"↓"})]})})}const Dq=3e3;function Fq(e,t,n){return e>=n?"hot":e>=t?"warn":"calm"}function zq(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}% ${Bq(t.lastMs,n)}`:"running at full speed, and never held back"}}function Bq(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 dl(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 Uq(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 Wq(){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,Dq))},l=()=>{n.current!=null&&(window.clearInterval(n.current),n.current=null)},d=()=>{if(document.visibilityState==="hidden"){l();return}i(),a()};return i(),document.addEventListener("visibilitychange",d),()=>{s=!1,l(),document.removeEventListener("visibilitychange",d)}},[]),e}function Wk({usageOpen:e,sub:t,onClose:n,children:s}){return c.jsxs("aside",{className:`sysdetail${e?" shifted":""}`,id:"system-panel","aria-label":"Machine detail",children:[c.jsxs("div",{className:"sd-head",children:[c.jsx("span",{className:"sd-title",children:"This machine"}),t&&c.jsx("span",{className:"sd-sub",children:t}),c.jsx("button",{type:"button",className:"glyph-btn sd-close",onClick:n,"aria-label":"Close",title:"Close",children:"×"})]}),s]})}function Hq({usageOpen:e,onClose:t}){const n=Wq();if(!n||n.cpu==null||!n.memory)return c.jsx(Wk,{usageOpen:e,onClose:t,children:c.jsx("div",{className:"sd-note",children:"reading this machine…"})});const{memory:s,swap:a,perCore:i,loadavg:l,cores:d,uptimeSec:f,platform:p,thermal:h}=n,g=s?s.total-s.available:0,y=p==="win32"?"Commit":"Swap",w=a&&a.total>0?a.used/a.total*100:0;return c.jsxs(Wk,{usageOpen:e,sub:`up ${Uq(f)} · ${d} cores`,onClose:t,children:[i&&i.length>0&&c.jsx("div",{className:"sd-section",role:"group","aria-label":"Cores",children:c.jsx(Au,{group:"cores",title:"Core history",action:"Show core history",label:"Cores",children:c.jsx("div",{className:"sd-cores",style:{"--n":i.length},children:i.map((S,k)=>c.jsx("span",{className:"sd-core",title:`core ${k+1}: ${S}%`,children:c.jsx("span",{className:"sd-core-fill",style:{transform:`scaleY(${Math.max(2,S)/100})`}})},k))})})}),c.jsx("div",{className:"sd-section",role:"group","aria-label":"Memory",children:c.jsxs(Au,{group:"memory",title:"Memory history",action:"Show memory history",label:"Memory",children:[s&&c.jsx(Vu,{label:"Physical",value:c.jsxs(c.Fragment,{children:[c.jsx("b",{children:dl(g)})," of ",dl(s.total)]}),pct:s.usedPct,tone:s.usedPct>=90?"warn":"calm",note:`${dl(s.available)} available`}),a&&a.total>0&&c.jsx(Vu,{label:y,value:c.jsxs(c.Fragment,{children:[c.jsx("b",{children:dl(a.used)})," of ",dl(a.total)]}),pct:w,tone:w>=90?"warn":"calm",note:w>=50?"paging to disk":void 0})]})}),l&&c.jsx("div",{className:"sd-section",role:"group","aria-label":"Load average",children:c.jsxs(Au,{group:"load",title:"Load history",action:"Show load history",label:"Load average",children:[c.jsx("div",{className:"sd-load",children:l.map((S,k)=>c.jsxs("span",{className:`sd-load-item${S>d?" over":""}`,children:[c.jsx("b",{children:S.toFixed(2)}),c.jsx("span",{children:["1m","5m","15m"][k]})]},k))}),c.jsx("div",{className:"sd-note",children:l[0]>d?`${(l[0]/d).toFixed(1)}× more work queued than cores to run it`:`within ${d} cores`})]})}),c.jsx(Gq,{thermal:h}),c.jsx(Vq,{sys:n})]})}function Au({group:e,title:t,action:n,label:s,children:a}){const[i,l]=b.useState(!1);return c.jsxs(c.Fragment,{children:[c.jsxs("button",{type:"button",className:"sd-open",onClick:()=>l(!0),title:n,"aria-label":n,children:[c.jsxs("div",{className:"sd-h","aria-hidden":!0,children:[s," ",c.jsx("i",{className:"sd-row-more",children:"›"})]}),a]}),i&&c.jsx(wq,{group:e,title:t,onClose:()=>l(!1)})]})}function Gq({thermal:e}){if(!e)return null;const t=e.throttle?zq(e.throttle.speedLimit,e.heldBack):null;return c.jsx("div",{className:"sd-section",role:"group","aria-label":"Thermal",children:c.jsxs(Au,{group:"thermal",title:"Thermal history",action:"Show thermal history",label:"Thermal",children:[e.celsius.map(n=>c.jsx(Vu,{label:n.label,value:c.jsxs(c.Fragment,{children:[c.jsx("b",{children:n.celsius})," °C"]}),pct:n.celsius,tone:Fq(n.celsius,n.warnAt,n.critAt)},n.label)),t&&c.jsx(Vu,{label:"Throttling",value:t.value,pct:t.pct,tone:t.tone,note:t.note})]})})}function Vq({sys:e}){const[t,n]=b.useState(!1);return c.jsxs("div",{className:"sd-section",children:[c.jsx("button",{type:"button",className:"sd-open sd-door",onClick:()=>n(!0),"aria-label":"Show every process the deck is watching",children:c.jsxs("span",{className:"sd-door-plate",children:[c.jsxs("span",{className:"sd-door-name",children:["Busiest processes",c.jsx("i",{className:"sd-row-more","aria-hidden":!0,children:"›"})]}),c.jsx("span",{className:"sd-door-sub",children:"every process, with its command line"})]})}),t&&c.jsx(qq,{sys:e,onClose:()=>n(!1)})]})}function Vu({label:e,value:t,pct:n,tone:s="calm",note:a}){return c.jsxs("div",{className:"sd-row",children:[c.jsxs("div",{className:"sd-row-head",children:[c.jsx("span",{className:"sd-row-label",children:e}),c.jsx("span",{className:"sd-row-val",children:t})]}),c.jsx("span",{className:"sd-track",children:c.jsx("span",{className:`sd-fill${s==="calm"?"":` ${s}`}`,style:{transform:`scaleX(${n<=0?0:Math.max(1,Math.min(100,n))/100})`}})}),a&&c.jsx("div",{className:"sd-note",children:a})]})}const Hk=18,Yq=1100,Po=(e,t)=>{const n=Math.sin(e*12.9898+t*78.233)*43758.5453;return n-Math.floor(n)},Kq=Array.from({length:Hk},(e,t)=>{const n=-72+144*t/(Hk-1)+(Po(t,1)-.5)*9,s=(n-90)*(Math.PI/180),a=(54+32*Math.cos(n*Math.PI/180))*(.74+Po(t,2)*.52);return{dx:Math.cos(s)*a,dy:Math.sin(s)*a,rot:(t%2?1:-1)*(100+Po(t,3)*260),delay:Math.round(Po(t,4)*90),dur:760+Math.round(Po(t,5)*260),scale:.8+Po(t,6)*.45,hue:t%4,round:t%3===0}});function Gk({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 d=window.setTimeout(()=>n(null),Yq);return()=>window.clearTimeout(d)},[e,s]),s||!t?null:Rw.createPortal(c.jsx("div",{className:"confetti",style:{left:`${t.x}px`,top:`${t.y}px`},"aria-hidden":!0,children:Kq.map((i,l)=>c.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 ZT=new Set(["awaiting_url","awaiting_code","registering"]);function Xq(e){return e!=null&&ZT.has(e)}function JT(e){return e!=null&&e!=="done"&&!ZT.has(e)}const Qq="the sign-in ended before it finished — the deck restarted, or it was cancelled in another tab",Zq="the sign-in did not complete";function Jq({state:e,serverError:t,localError:n}){const s=e==="idle";return{title:s?"Sign-in ended":"Sign-in failed",message:n||t||(s?Qq:Zq)}}const eD="done";function tD(){let e=!1;return{shouldAnnounce(t){return t!==eD?(e=!1,!1):e?!1:(e=!0,!0)}}}function Zw(e,t){return t&&Object.hasOwn(e,t)?e[t]:void 0}const nD={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"},rD={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"},sD=`claude-swap could not read the login keychain — start ${Ut} from a Terminal window rather than a background service`;function pw(e,t){if((e==null?void 0:e.reason)!=="no_cswap"&&/keychain/i.test(Xo(e)))return sD;const n=Zw(rD,e==null?void 0:e.reason);return n||(e==null?void 0:e.reason)||t}function Xo(e){return((e==null?void 0:e.output)||(e==null?void 0:e.detail)||(e==null?void 0:e.error)||"").trim()}const aD={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"},oD="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 iD(e){return/\bnpx\b/i.test(e)&&/(command not found|not found|not recognized|ENOENT)/i.test(e)}const lD="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",cD="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",uD=e=>/\b(?:ERR_)?MODULE_NOT_FOUND\b|cannot find (?:module|package)/i.test(e),dD=/node_modules[\\/]npm[\\/]bin[\\/]|\bnpm-prefix\.js\b|\bnp[mx][-.][\w.-]*cli\.js\b/i,hD=/[\\/]_npx[\\/]/i,fD=`the copy of ccusage ${Ut} installed for itself`;function pD(e){const t=String((e==null?void 0:e.install)??"").replace(/\s+/g," ").trim();return t.length>240?`${t.slice(0,239)}…`:t}function mD(e,t){const n=gD(e,t),s=pD(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 ${hl(n)}`:`there is no managed copy of ccusage on this machine, and the npx fallback failed: ${hl(n)}`;case"managed":return`${fD} failed to run: ${hl(n)}`;case"path":return e.bin?`the ccusage this deck found at ${e.bin} failed to run: ${hl(n)}`:`the ccusage this deck found on your PATH failed to run: ${hl(n)}`;default:return n}}const hl=e=>/^[A-Z][a-z]/.test(e)?e[0].toLowerCase()+e.slice(1):e;function gD(e,t){const n=Xo(e);if(uD(n)){if(hD.test(n))return cD;if(dD.test(n))return lD}if(iD(n))return oD;const s=Zw(aD,e==null?void 0:e.reason);return s||(e==null?void 0:e.reason)||t}function Fo(e,t){if(e!=null&&e.detail)return e.detail;if(e!=null&&e.error&&JT(e.state))return e.error;const n=Zw(nD,e==null?void 0:e.reason);return n||(e!=null&&e.error?e.error:(e==null?void 0:e.reason)||t)}function yD(e,t,n){if(n<=0||Gw(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 eR(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 vD(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 wD(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 xD(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 bD(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 d=n("present");d&&s.push(`${d} already here`);const f=n("failed");return f&&s.push(`${f} did not arrive`),`${s.join(", ")}.`}const kD=1500,yu=[{id:"login",label:"Sign in"},{id:"paste",label:"Paste a share"}],Vk="aa-panel",Yk=e=>`aa-tab-${e}`;async function fl(e){return(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json().catch(()=>null)}const mw=fe.forwardRef((e,t)=>c.jsxs("svg",{className:"aa-mark",viewBox:"0 0 44 44","aria-hidden":!0,ref:t,children:[c.jsx("circle",{className:"aa-mark-ring",cx:"22",cy:"22",r:"20"}),c.jsx("path",{className:"aa-mark-tick",d:"M13.5 22.5 L19.5 28.5 L31 17"})]}));mw.displayName="SuccessMark";function _D({onClose:e,onChanged:t}){const[n,s]=b.useState("login"),[a,i]=b.useState(null),[l,d]=b.useState(""),[f,p]=b.useState(""),[h,g]=b.useState(!1),[y,w]=b.useState(null),[S,k]=b.useState(null),[N,_]=b.useState(null),[E,j]=b.useState(null),C=b.useRef(""),M=b.useRef(!1),$=b.useRef(!1),I=b.useRef(null),F=b.useRef(null),O=b.useRef(null),A=b.useRef(null),L=b.useRef([]),H=b.useRef(!1),X=b.useCallback(()=>{M.current&&fl({action:"login-cancel"}).catch(()=>{}),e()},[e]),T=an(X,{focusRef:O}),K=b.useCallback(async()=>{if(!ur($.current))return;$.current=!0,g(!0),w(null),M.current=!0;const z=await fl({action:"login"}).catch(()=>null);if($.current=!1,g(!1),!(z!=null&&z.ok)){w(Fo(z,"could not start the sign-in"));return}i(z)},[]);b.useEffect(()=>{if(!Xq(a==null?void 0:a.state))return;const z=window.setInterval(async()=>{try{const Q=await fetch("/api/claude-accounts/login");Q.ok&&i(await Q.json())}catch{}},kD);return()=>window.clearInterval(z)},[a]);const D=b.useRef(t);D.current=t;const te=b.useState(tD)[0];b.useEffect(()=>{var z;(a==null?void 0:a.state)==="awaiting_code"&&((z=I.current)==null||z.focus()),te.shouldAnnounce(a==null?void 0:a.state)&&D.current()},[a==null?void 0:a.state,te]),b.useEffect(()=>{var z;n==="paste"&&!H.current&&((z=F.current)==null||z.focus()),H.current=!1},[n]);const Z=b.useCallback(z=>{var W;const Q=yD(z,yu.findIndex(le=>le.id===n),yu.length);Q.kind!=="pass"&&(z.preventDefault(),H.current=!0,s(yu[Q.index].id),(W=L.current[Q.index])==null||W.focus())},[n]),V=b.useCallback(async()=>{var Q;if(!ur($.current))return;$.current=!0,g(!0),w(null);const z=await fl({action:"login-code",code:l}).catch(()=>null);if($.current=!1,g(!1),!(z!=null&&z.ok)){w(Fo(z,"the code was not accepted")),z!=null&&z.state&&i(z),(Q=I.current)==null||Q.select();return}d(""),i(z)},[l,a]),J=b.useCallback(async()=>{if(!ur($.current))return;$.current=!0,g(!0),w(null);const z=await fl({action:"import",blob:f}).catch(()=>null);if($.current=!1,g(!1),!(z!=null&&z.ok)){w(Fo(z,"the import failed"));return}C.current=f,p(""),j(null),k(z.results??[]),t()},[f,t]),P=b.useCallback(async z=>{const Q=`${z.email}|${z.org??""}`;if(!ur($.current)||!C.current)return;$.current=!0,g(!0),_(Q),j(null);const W=await fl({action:"import",blob:C.current,force:!0,only:{email:z.email,org:z.org??""}}).catch(()=>null);if($.current=!1,g(!1),_(null),!(W!=null&&W.ok)){j({key:Q,text:Fo(W,"that account could not be updated")});return}const le=(W.results??[])[0];le&&k(pe=>pe&&pe.map(ge=>`${ge.email}|${ge.org??""}`===Q?le:ge)),t()},[t]),Y=(a==null?void 0:a.state)==="done"?a.account:null,de=JT(a==null?void 0:a.state)||!!(y&&M.current&&!h),U=Jq({state:a==null?void 0:a.state,serverError:a==null?void 0:a.error,localError:y});return c.jsx("div",{className:"modal-backdrop",onClick:X,role:"presentation",children:c.jsxs("div",{ref:T,className:"modal aa-modal",onClick:z=>z.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Add a Claude account",children:[c.jsxs("header",{className:"modal-head",children:[c.jsx("div",{className:"modal-title",children:c.jsx("span",{className:"aa-tabs",role:"tablist","aria-label":"How to add the account",onKeyDown:Z,children:yu.map((z,Q)=>c.jsx("button",{type:"button",role:"tab",id:Yk(z.id),ref:W=>{L.current[Q]=W},"aria-selected":n===z.id,"aria-controls":Vk,tabIndex:n===z.id?0:-1,className:`aa-tab${n===z.id?" on":""}`,onClick:()=>{H.current=!1,s(z.id)},children:z.label},z.id))})}),c.jsx("div",{className:"modal-actions",children:c.jsx("button",{type:"button",className:"glyph-btn",onClick:X,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),c.jsx("section",{className:"modal-body aa-body",id:Vk,role:"tabpanel","aria-labelledby":Yk(n),children:n==="login"?Y?c.jsxs("div",{className:"aa-done",children:[c.jsx(mw,{ref:A}),c.jsx(Gk,{anchor:A}),c.jsx("h4",{children:Y.added?`Account ${Y.num} added`:"Credentials refreshed"}),c.jsxs("p",{className:"aa-note",children:[c.jsx("strong",{children:Y.email}),Y.added?" is in the rotation. The account you were using is still active.":" was already managed, so its stored credentials were replaced."]}),c.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"?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"aa-step",children:[c.jsx("h4",{children:"1 · Approve in the browser"}),c.jsx("p",{className:"aa-note",children:"A tab should have opened. If not, use this link:"}),c.jsx("a",{className:"aa-link",href:a.url??"#",target:"_blank",rel:"noreferrer noopener",children:a.url})]}),c.jsxs("div",{className:"aa-step",children:[c.jsx("h4",{children:"2 · Paste a code, if the page shows one"}),c.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."}),c.jsxs("div",{className:"aa-field",children:[c.jsx("input",{ref:I,type:"text",value:l,onChange:z=>d(z.target.value),onKeyDown:z=>{z.key==="Enter"&&l.trim()&&!h&&V()},placeholder:"paste the code here",spellCheck:!1,autoComplete:"off","aria-label":"Sign-in code",disabled:a.state==="registering"}),c.jsx("button",{type:"button",className:"btn primary",...cr(h,!l.trim()||a.state==="registering"),onClick:V,children:a.state==="registering"?"registering…":"Continue"})]}),(y||a.error)&&c.jsx("p",{className:"aa-err",children:y??a.error}),c.jsx("p",{className:"aa-note",children:"The code goes straight to the claude CLI on this machine. It is never stored or sent anywhere else."})]})]}):de?c.jsxs("div",{className:"aa-step",children:[c.jsx("h4",{children:U.title}),c.jsx("p",{className:"aa-err",children:U.message}),c.jsx("button",{type:"button",className:"btn",onClick:()=>{M.current=!1,i(null),w(null),K()},children:"Try again"})]}):h||M.current?c.jsx("div",{className:"aa-step",children:c.jsx("p",{className:"aa-note",children:"Asking the claude CLI for a sign-in link…"})}):c.jsxs("div",{className:"aa-step aa-primer",children:[c.jsx("h4",{children:"Sign in to Anthropic"}),c.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."}),c.jsx("div",{className:"aa-actions",children:c.jsx("button",{type:"button",ref:O,className:"btn primary",onClick:K,children:"Open the sign-in page"})})]}):S?(()=>{const z=S.filter(Q=>Q.state==="imported").length;return c.jsxs("div",{className:"aa-done",children:[c.jsx(mw,{ref:A}),z>0&&c.jsx(Gk,{anchor:A}),c.jsx("h4",{children:bD(S)}),S.length>0&&c.jsx("ul",{className:"aa-results",children:S.map(Q=>{const W=`${Q.email}|${Q.org??""}`;return c.jsxs("li",{className:`aa-result ${Q.state}`,children:[c.jsx("span",{className:"aa-result-who",children:Q.email||(Q.num?`slot ${Q.num}`:"an account")}),c.jsx("span",{className:"aa-result-what",children:xD(Q.state)}),Q.state==="present"&&c.jsx("button",{type:"button",className:"aa-result-fix","aria-busy":N===W,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:N===W?"updating…":"update anyway"}),(E==null?void 0:E.key)===W&&c.jsx("span",{className:"aa-result-err",children:E.text})]},W)})}),c.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",c.jsx("strong",{children:" update anyway"}),"."]}),c.jsxs("div",{className:"aa-actions",children:[c.jsx("button",{type:"button",className:"btn primary",onClick:e,children:"Done"}),c.jsx("button",{type:"button",className:"btn",onClick:()=>{C.current="",j(null),k(null)},children:"Import another"})]})]})})():c.jsxs("div",{className:"aa-step",children:[c.jsx("h4",{children:"Paste an account shared from another deck"}),c.jsxs("div",{className:"aa-field",children:[c.jsx("input",{ref:F,type:"text",value:f,onChange:z=>p(z.target.value),onKeyDown:z=>{z.key==="Enter"&&f.trim()&&!h&&J()},placeholder:"ccdeck2:…",spellCheck:!1,autoComplete:"off","aria-label":"Shared account"}),c.jsx("button",{type:"button",className:"btn primary",...cr(h,!f.trim()),onClick:J,children:h?"importing…":"Import"})]}),y&&c.jsx("p",{className:"aa-err",children:y}),c.jsxs("p",{className:"aa-note",children:["Use ",c.jsx("strong",{children:"share"})," on one account in the other deck, or ",c.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 SD(e){return(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json().catch(()=>null)}const ND=1800;function ED({accounts:e,onClose:t,copyText:n}){const[s,a]=b.useState([]),[i,l]=b.useState(null),[d,f]=b.useState(!1),[p,h]=b.useState(null),[g,y]=b.useState(!1),[w,S]=b.useState(()=>Math.floor(Date.now()/1e3)),k=b.useRef(null),N=b.useRef(!1),_=an(t,{focusRef:k});b.useEffect(()=>{if(!i)return;S(Math.floor(Date.now()/1e3));const A=window.setInterval(()=>S(Math.floor(Date.now()/1e3)),1e3);return()=>window.clearInterval(A)},[i]);const E=vD(e),j=e.filter(A=>!s.includes(A.num)).map(A=>A.num),C=j.length===e.length,M=A=>a(L=>L.includes(A)?L.filter(H=>H!==A):[...L,A]),$=b.useCallback(async()=>{if(!ur(N.current)||!j.length)return;N.current=!0,f(!0),h(null),y(!1);const A=await SD({action:"share",accounts:j}).catch(()=>null);if(N.current=!1,f(!1),!(A!=null&&A.ok)){h(Fo(A,"the share could not be made"));return}l({blob:A.blob,expiresAt:A.expiresAt,shared:A.shared??[],failed:A.failed??[]})},[e,j]),I=i?eR(i.expiresAt,w):null,F=(I==null?void 0:I.tone)==="gone",O=(i==null?void 0:i.shared.length)??0;return c.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:c.jsxs("div",{ref:_,className:"modal sa-modal",onClick:A=>A.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Share accounts with another deck",children:[c.jsxs("header",{className:"modal-head",children:[c.jsx("div",{className:"modal-title",children:c.jsx("h3",{children:"Share accounts"})}),c.jsx("div",{className:"modal-actions",children:c.jsx("button",{type:"button",className:"glyph-btn",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),c.jsx("section",{className:"modal-body sa-body",children:i?c.jsxs("div",{className:"sa-step",children:[c.jsx("h4",{children:F?"This share has expired":O===1?"1 account, ready to paste":`${O} accounts, ready to paste`}),c.jsx("code",{className:`ap-share-blob${F?" sa-dead":""}`,children:i.blob}),c.jsxs("div",{className:"ap-share-foot",children:[c.jsx("button",{type:"button",className:"ap-manage-btn",ref:k,onClick:async()=>{if(F){l(null),$();return}await n(i.blob)&&(y(!0),window.setTimeout(()=>y(!1),ND))},children:F?"make a new share":g?"copied":`copy ${O===1?"the share":"all "+O}`}),c.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:[c.jsx("span",{className:"ap-share-warn",children:O===1?"this is the password":`this is ${O} passwords`})," · ",c.jsx("span",{className:`ap-share-expiry ${I==null?void 0:I.tone}`,children:I==null?void 0:I.text})]})]}),i.failed.length>0&&c.jsxs("div",{className:"sa-failed",role:"alert",children:[c.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:`}),c.jsx("ul",{className:"sa-list",children:i.failed.map(A=>{var H;const L=!!(A.email&&((H=A.detail)!=null&&H.includes(A.email)));return c.jsxs("li",{children:[!L&&c.jsx("span",{className:"sa-who",children:A.email||`account ${A.num}`}),c.jsx("span",{className:"sa-why",children:A.detail||"could not be exported"})]},`${A.num}-${A.email}`)})})]}),c.jsx("p",{className:"sa-note",children:F?c.jsx(c.Fragment,{children:"Another deck will refuse this text now. Make a new one — the same accounts are still picked."}):c.jsxs(c.Fragment,{children:["Paste it into the other deck with ",c.jsx("strong",{children:"+"})," → ",c.jsx("strong",{children:"Paste a share"}),". Accounts it already holds are left exactly as they are."]})}),c.jsxs("div",{className:"sa-actions",children:[c.jsx("button",{type:"button",className:"btn",onClick:()=>{l(null),y(!1)},children:"Pick again"}),c.jsx("button",{type:"button",className:"btn primary",onClick:t,children:"Done"})]})]}):e.length===0?c.jsxs("div",{className:"sa-step",children:[c.jsx("h4",{children:"Nothing to share"}),c.jsxs("p",{className:"sa-note",children:["This deck is not holding any accounts right now. Sign one in with ",c.jsx("strong",{children:"+"}),", or wait — the panel is still reading the store."]}),c.jsx("div",{className:"sa-actions",children:c.jsx("button",{type:"button",className:"btn primary",ref:k,onClick:t,children:"Close"})})]}):c.jsxs("div",{className:"sa-step",children:[c.jsxs("h4",{children:["Which accounts go to the other ",Ut,"?"]}),c.jsx("p",{className:`sa-count${j.length?"":" empty"}`,children:wD(j.length)}),c.jsx("ul",{className:"sa-list sa-pick",children:E.map(A=>c.jsx("li",{children:c.jsxs("label",{className:"sa-row",children:[c.jsx("input",{type:"checkbox",checked:j.includes(A.num),onChange:()=>M(A.num)}),c.jsx("span",{className:"sa-who",children:A.label}),A.sub&&c.jsx("span",{className:"sa-sub",children:A.sub})]})},A.num))}),p&&c.jsx("p",{className:"aa-err",children:p}),c.jsxs("div",{className:"sa-actions",children:[c.jsx("button",{type:"button",className:"btn",onClick:()=>a(C?e.map(A=>A.num):[]),children:C?"Clear all":"Select all"}),c.jsx("button",{type:"button",className:"btn primary",ref:k,...cr(d,!j.length),onClick:$,children:d?"making the share…":j.length===0?"Share":j.length===1?"Share 1 account":`Share ${j.length} accounts`})]})]})})]})})}function jD(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 CD(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 TD(e,t,n){return t!=null&&e.some(s=>s.slot===t)?t:n}function RD(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 AD(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 Kk(e){return typeof e.id=="string"&&e.id.startsWith("scoped-")}function Xk(e){const t=e.filter(d=>!Kk(d)),n=e.filter(d=>Kk(d)),s=t.length?t:n,a=t.length?n:[],i=s.reduce((d,f)=>d&&d.pct>=f.pct?d:f,null);let l=null;for(const d of a)i&&d.pct<=i.pct||(!l||d.pct>l.pct)&&(l=d);return{shown:s,rest:a,fuller:l,peak:l??i}}function MD(e,t,n){return e<1?null:t?"fewer":n?`${n.label} ${Math.round(n.pct)}%`:`${e} more`}function ID(e,t,n,s){const 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 OD="\0";function Jw(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}${OD}${n}`}function $D(e,t){const n=Jw(t);return e.includes(n)?e.filter(s=>s!==n):[...e,n]}function PD(e,t){if(!Array.isArray(t))return e;const n=new Set(t.map(Jw)),s=e.filter(a=>n.has(a));return s.length===e.length?e:s}const LD=64;function qD(e,t){const n=e.trim();return{alias:n,commit:n!==(t??"").trim()}}const DD=Object.freeze({text:"couldn't reach the deck server",reload:!0});async function Qk(e){return e.ok?{ok:!0,status:e.status,body:null}:{ok:!1,status:e.status,body:await e.json().catch(()=>null)}}function FD(e){const t=e.find(s=>!s.ok);if(!t)return null;const n=Xo(t.body);return{text:pw(t.body,`the deck server answered ${t.status}`),...n?{raw:n}:{},reload:!0}}function Zk(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 zD({status:e,accounts:t,onClose:n,onChanged:s}){const a=an(n),[i,l]=b.useState(null),[d,f]=b.useState(null),[p,h]=b.useState(null),g=b.useRef(null),y=_=>{const E=Ko(p,_);return{disabled:E.disabled,"aria-busy":E.busy}},w=b.useRef(null),S=b.useRef(!0);b.useEffect(()=>()=>{S.current=!1},[]),b.useEffect(()=>{w.current&&GD(w.current,e.shared??[])&&(w.current=null)},[e.shared]);const k=b.useCallback(async(_,E,j="write")=>{g.current=j,h(j);try{const M=await(await fetch("/api/prefs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({lan:_})})).json().catch(()=>null);return S.current?(M!=null&&M.ok?f(null):f(en(E,M)),s(),(M==null?void 0:M.ok)===!0):!1}catch{return S.current&&f(en(E,null)),!1}finally{g.current=null,S.current&&h(null)}},[s]),N=new Set(w.current??e.shared??[]);return c.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:c.jsxs("div",{ref:a,className:"modal lan-modal",onClick:_=>_.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"lan-modal-title",children:[c.jsxs("header",{className:"modal-head",children:[c.jsx("div",{className:"modal-title",children:c.jsx("span",{id:"lan-modal-title",className:"modal-tool-name",children:"This deck on the network"})}),c.jsx("div",{className:"modal-actions",children:c.jsx("button",{className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),c.jsxs("section",{className:"modal-body",children:[d&&c.jsxs("div",{className:"ap-failure",role:"alert",children:[c.jsx("span",{className:"ap-failure-text",children:d}),c.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>f(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),c.jsxs("div",{className:"modal-section",children:[c.jsx("h3",{className:"lan-h",children:"Name"}),c.jsxs("div",{className:"ap-lan-row",children:[c.jsx("span",{className:"ap-lan-label",children:"appear as"}),c.jsx("input",{className:"ap-manage-input ap-lan-input","aria-label":"This deck's name on the network",value:i??e.name??"",placeholder:"this machine",onChange:_=>l(_.target.value),onKeyDown:_=>{_.key!=="Enter"||i==null||(k({name:i},"save the name","name"),l(null))}}),i!=null&&i!==(e.name??"")&&c.jsx("button",{type:"button",className:"ap-manage-btn",...y("name"),onClick:()=>{k({name:i},"save the name","name"),l(null)},title:"Save it. This is the name other decks show for this one.",children:"save"})]}),c.jsx("p",{className:"lan-note",children:"Everyone on this network can see this name."}),e.fp&&c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"ap-lan-row",children:[c.jsx("span",{className:"ap-lan-label",children:"fingerprint"}),c.jsx("code",{className:"ap-lan-code",children:e.fp})]}),c.jsx("p",{className:"lan-note",children:"Read this out when somebody is deciding whether to accept this deck."})]})]}),c.jsxs("div",{className:"modal-section",children:[c.jsx("h3",{className:"lan-h",children:"Share these accounts"}),c.jsx("p",{className:"lan-warn",children:"A login you tick here is a working one, and another deck keeps its own copy. Unticking stops it being offered from now on — it does not take back a copy somebody already has."}),c.jsxs("div",{className:"ap-lan-picks",children:[t.length===0&&c.jsx("span",{className:"ap-lan-empty",children:"No Claude accounts on this deck yet — add one with + at the top of this panel."}),t.map(_=>c.jsxs("label",{className:"ap-lan-pick",title:_.alive?"Offer this account to the decks you have paired with, so one 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:[c.jsx("input",{type:"checkbox",checked:N.has(_.key),onChange:E=>{const j=new Set(w.current??e.shared??[]);E.target.checked?j.add(_.key):j.delete(_.key),w.current=[...j],k({shared:[...j]},E.target.checked?"share that account":"stop sharing that account")}}),c.jsx("span",{className:"ap-lan-pick-name",children:_.email}),!_.alive&&c.jsx("span",{className:"ap-lan-dead",children:"not working here"})]},_.key))]})]})]})]})})}function Mu(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`}const BD={"waiting for the other deck to accept this one":{text:"waiting for them to say yes",tone:"idle"},"that deck said no":{text:"it said no",tone:"bad"}},UD={"handshake timed out":"no answer","peer closed the connection":"it hung up","peer went quiet":"it stopped mid-sentence","bad reply":"it answered with nonsense","no manifest":"it would not say what it has","bad challenge":"it answered as somebody else","a different deck is answering at that address":"a different deck is at that address","that deck could not prove its own key":"it could not prove who it is","the other deck refused this one's proof":"it would not take this deck's word","the other deck refused this handshake":"it turned this deck away","that deck has this one pinned under a different key":"it knows this deck by another key"};function WD(e,t){if(!e)return null;if(e.error)return BD[e.error]??{text:UD[e.error]??e.error,tone:"bad"};const n=e.done??[];if(!n.length)return{text:`all logins fine · ${Mu(e.at,t)}`,tone:"idle"};const s=n.filter(i=>i.ok),a=s.length===1?"login":"logins";return s.length===n.length?{text:`${s.length} ${a} arrived · ${Mu(e.at,t)}`,tone:"ok"}:{text:`${s.length} of ${n.length} logins arrived · ${Mu(e.at,t)}`,tone:"bad"}}function HD(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 en(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 GD(e,t){if(e.length!==t.length)return!1;const n=new Set(e);return t.every(s=>n.has(s))}function VD(e,t){const n=Math.max(0,Math.round((e-t)/1e3));return`${Math.floor(n/60)}:${String(n%60).padStart(2,"0")}`}function tR(e,t){var n,s;return(n=e.last)!=null&&n.error?!1:!!((s=e.last)!=null&&s.at&&t-e.last.at<Jk||e.lastSeen!=null&&t-e.lastSeen<Jk)}const Jk=95e3;function YD(e,t){const n=[],s=[];for(const a of e??[])(tR(a,t)?n:s).push(a);return{online:n,offline:s}}function KD(e,t){if(!e)return{text:"checking…",tone:"idle"};if(!e.enabled)return{text:"off — this deck is not on the network",tone:"idle"};if(e.stalled)return{text:`could not start — ${e.stalled}`,tone:"bad"};if(!e.running)return{text:"starting…",tone:"wait"};const n=(e.pending??[]).length;if(n)return{text:n===1?"1 deck is waiting for your answer":`${n} decks are waiting for your answer`,tone:"wait"};const s=(e.peers??[]).filter(h=>h.paired!==!1||h.met);if(!s.length)return{text:"no deck paired yet",tone:"idle"};const a=s.filter(h=>{var g;return h.waiting&&!((g=h.last)!=null&&g.error)}),i=s.filter(h=>!a.includes(h)),{online:l,offline:d}=YD(i,t),f=l.length+a.length;if(!f)return{text:d.length===1?"this deck cannot reach the one it is paired with":`this deck cannot reach any of its ${d.length} decks`,tone:"bad"};const p=f===1?"1 deck ready":`${f} decks ready`;return{text:d.length?`${p} · ${d.length} away`:p,tone:"ok"}}function nR(e,t){const n=Math.max(0,Math.round((t-e)/1e3));if(n<90)return"just now";const s=Math.round(n/60);return s<60?`${s}m ago`:`${Math.round(s/60)}h ago`}const XD="one-way · it calls this deck";function QD(e,t){var p;if(!e)return[];const n=[],s=new Set,a=(h,g)=>h.name.localeCompare(g.name,void 0,{numeric:!0});for(const h of e.pending??[])!(h!=null&&h.fp)||s.has(h.fp)||(s.add(h.fp),n.push({fp:h.fp,name:h.name||h.fp,addr:h.addr??"",kind:"asks",state:`wants to pair · ${nR(h.at,t)}`,tone:"wait",here:!0,hint:`${h.name||h.fp} at ${h.addr} is waiting for an answer.`}));const i=[],l=[];for(const h of e.peers??[]){const g=h.peerFp??h.fp;if(!g||s.has(g))continue;s.add(g);const y=WD(h.last,t),w=tR(h,t),S=h.addr?`${h.addr}:${h.port}`:"";if(!h.paired&&h.manual&&!h.met){l.push({fp:S,name:S||h.name||g,addr:h.addr??"",kind:"dialling",state:y?y.text:"trying…",tone:y?y.tone:"idle",here:!1,hint:y?`Nothing has answered at ${S} yet — ${y.text}.`:`Dialling ${S} every minute until something answers.`});continue}i.push({fp:g,name:h.manual&&!h.met?S:h.name||g,addr:h.addr??"",kind:"paired",state:y?y.text:w?"ready":h.waiting?XD:h.lastSeen!=null?Mu(h.lastSeen,t):"away",tone:y?y.tone:w?"ok":"idle",here:w||!!h.waiting&&!((p=h.last)!=null&&p.error),hint:h.waiting&&!y?`${h.name||g} calls this deck, and this deck has no address to call back on — so it can repair its logins from here, and this deck cannot repair from it. Add its address with + add a deck.`:`${h.name||g}${S?` at ${S}`:""}`})}n.push(...i.sort(a),...l.sort(a));const d=[];for(const h of e.strangers??[])!(h!=null&&h.fp)||s.has(h.fp)||(s.add(h.fp),d.push({fp:h.fp,name:h.name||h.fp,addr:h.addr??"",kind:"nearby",state:"not paired yet",tone:"idle",here:!0,hint:`${h.name||h.fp} at ${h.addr} is on this network and nothing is shared with it.`}));n.push(...d.sort(a));const f=[];for(const h of e.declined??[])!(h!=null&&h.fp)||s.has(h.fp)||(s.add(h.fp),f.push({fp:h.fp,name:h.name||h.fp,addr:h.addr??"",kind:"declined",state:"you said no",tone:"idle",here:!1,hint:`${h.name||h.fp} asked and was turned away. It is not asking any more.`}));return n.push(...f.sort(a)),n}async function Ea(e,t){return(await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json().catch(()=>null)}function ZD({accounts:e,onChanged:t}){var Ne;const[n,s]=b.useState(null),[a,i]=b.useState([]),[l,d]=b.useState(null),[f,p]=b.useState(!1),[h,g]=b.useState(null),[y,w]=b.useState(!1),[S,k]=b.useState(""),[N,_]=b.useState(""),[E,j]=b.useState(null),[C,M]=b.useState(null),[$,I]=b.useState(null),F=b.useRef(null),O=b.useCallback(ce=>Xw(F.current)?(F.current=ce,d(ce),!0):!1,[]),A=b.useCallback(()=>{F.current=null,T.current&&d(null)},[]),L=ce=>{const we=Ko(l,ce);return{disabled:we.disabled,"aria-busy":we.busy}},[H,X]=b.useState(()=>Date.now()),T=b.useRef(!0),K=b.useCallback(async()=>{var ce,we;try{const[Ce,_e]=await Promise.all([fetch("/api/lan").then(We=>We.json()),fetch("/api/prefs").then(We=>We.json())]);if(!T.current)return;Ce!=null&&Ce.ok&&s(Ce),_e!=null&&_e.ok&&i(Array.isArray((we=(ce=_e.prefs)==null?void 0:ce.lan)==null?void 0:we.manual)?_e.prefs.lan.manual:[])}catch{}},[]);b.useEffect(()=>{T.current=!0,K();const ce=window.setInterval(()=>{X(Date.now()),K()},5e3);return()=>{T.current=!1,window.clearInterval(ce)}},[K]);const D=b.useCallback(async()=>{const ce=(n==null?void 0:n.enabled)===!0;if(O("switch"))try{const we=await Ea("/api/prefs",{lan:{enabled:!ce}});if(!T.current)return;we!=null&&we.ok?I(null):I(en(ce?"turn this off":"turn this on",we)),await K()}catch{T.current&&I(en(ce?"turn this off":"turn this on",null))}finally{A()}},[n==null?void 0:n.enabled,K,O,A]),te=b.useCallback(async(ce,we,Ce)=>{if(O(`${ce}:${we}`))try{const _e=await Ea("/api/lan/peer",{action:ce,fp:we});if(!T.current)return;_e!=null&&_e.ok?(s(_e),I(null)):I(en(Ce,_e)),await K()}catch{T.current&&I(en(Ce,null))}finally{A()}},[K,O,A]),Z=b.useCallback(async()=>{const ce=HD(S);if(!ce){I("That is not an address and a port — try 192.168.1.5:54340.");return}if(O("add"))try{const we=`${ce.addr}:${ce.port}`,Ce=await Ea("/api/prefs",{lan:{manual:[...a.filter(_e=>_e!==we),we]}});if(!T.current)return;Ce!=null&&Ce.ok?(I(null),k(""),t()):I(en("add that address",Ce)),await K()}catch{T.current&&I(en("add that address",null))}finally{A()}},[S,a,K,t,O,A]),V=b.useCallback(async ce=>{if(O(`drop:${ce}`))try{const we=await Ea("/api/prefs",{lan:{manual:a.filter(Ce=>Ce!==ce)}});if(!T.current)return;we!=null&&we.ok?(I(null),t()):I(en("stop dialling that address",we)),await K()}catch{T.current&&I(en("stop dialling that address",null))}finally{A()}},[a,K,t,O,A]),J=b.useCallback(async ce=>{if(O(`invite:${ce}`))try{const we=await Ea("/api/lan/invite",{action:ce});if(!T.current)return;we!=null&&we.ok?(s(we),I(null),j(null)):I(en(ce==="make"?"make an invite":"cancel that invite",we))}catch{T.current&&I(en(ce==="make"?"make an invite":"cancel that invite",null))}finally{A()}},[O,A]),P=b.useCallback(async()=>{const ce=N.trim();if(!(!ce||!O("join"))){M(null);try{const we=await Ea("/api/lan/invite",{action:"join",token:ce});if(!T.current)return;we!=null&&we.ok?(s(we),_(""),I(null),w(!1),t()):(M(Array.isArray(we==null?void 0:we.tried)?we.tried:null),I(en("use that invite",we))),await K()}catch{T.current&&I(en("use that invite",null))}finally{A()}}},[N,K,t,O,A]),Y=b.useCallback(async()=>{if(O("check"))try{const ce=await Ea("/api/lan/sync",{});if(!T.current)return;ce!=null&&ce.ok?(s(ce),I(null)):I(en("check the other decks",ce)),t()}catch{T.current&&I(en("check the other decks",null))}finally{A()}},[O,A,t]),de=b.useCallback(async(ce,we)=>{try{await navigator.clipboard.writeText(ce),j(we),window.setTimeout(()=>{T.current&&j(Ce=>Ce===we?null:Ce)},1600)}catch{I("Could not copy it — select the text and copy it by hand.")}},[]),U=(n==null?void 0:n.enabled)===!0,z=QD(n,H),Q=z.filter(ce=>ce.kind==="asks"),W=z.filter(ce=>ce.kind!=="asks"),le=KD(n,H),pe=W.filter(ce=>ce.kind==="paired").length,ge=n!=null&&n.invite&&n.invite.expiresAt>H?n.invite:null;return c.jsxs("div",{className:"ap-auto ap-lan",children:[c.jsxs("div",{className:"ap-auto-head",children:[c.jsx("h3",{className:"ap-auto-title",children:"Local network"}),c.jsxs("button",{type:"button",className:`ap-auto-state${U?" live":""}`,role:"switch","aria-checked":U,"aria-label":"Local network sync",...L("switch"),onClick:()=>void D(),title:U?"Stop talking to other decks. Nothing is shared while this is off.":"Let the decks you pair with repair this one's expired logins",children:[c.jsx("i",{className:U?"ap-pulse":"ap-dot","aria-hidden":!0}),U?"on":"off"]})]}),c.jsx("p",{className:"ap-auto-note",children:"Decks you pair with repair each other's expired logins."}),c.jsx("p",{className:`ap-lan-status ${le.tone}`,role:"status",children:le.text}),$&&c.jsxs("div",{className:"ap-failure",role:"alert",children:[c.jsx("span",{className:"ap-failure-text",children:$}),c.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>I(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),U&&c.jsxs(c.Fragment,{children:[Q.length>0&&c.jsx("div",{className:"ap-lan-asks",role:"alert",children:Q.map(ce=>c.jsxs("div",{className:"ap-lan-ask",children:[c.jsxs("span",{className:"ap-lan-ask-what",children:[c.jsx("strong",{className:"ap-lan-peer-name",children:ce.name})," at ",c.jsx("code",{className:"ap-lan-code",children:ce.addr})," wants to pair"]}),c.jsxs("span",{className:"ap-lan-ask-acts",children:[c.jsx("button",{type:"button",className:"ap-manage-btn",...L(`accept:${ce.fp}`),onClick:()=>void te("accept",ce.fp,"accept that deck"),title:`Talk to this deck from now on. Its fingerprint is ${ce.fp} — check it matches the one on their screen before you accept.`,children:"accept"}),c.jsx("button",{type:"button",className:"ap-manage-btn",...L(`dismiss:${ce.fp}`),onClick:()=>void te("dismiss",ce.fp,"decline that request"),title:"Say no. Nothing is shared, and that deck is told rather than left waiting.",children:"decline"})]})]},ce.fp))}),W.length>0&&c.jsx("ul",{className:"ap-lan-here",children:W.map(ce=>c.jsxs("li",{className:"ap-lan-who","data-tone":ce.tone,title:ce.hint,children:[c.jsx("i",{className:ce.here?"ap-pulse":"ap-dot","aria-hidden":!0}),c.jsx("span",{className:"ap-lan-who-name",children:ce.name}),c.jsx("span",{className:"ap-lan-who-when",children:ce.state}),ce.kind==="nearby"&&c.jsx("button",{type:"button",className:"ap-manage-btn ap-lan-do",...L(`accept:${ce.fp}`),onClick:()=>void te("accept",ce.fp,"reach that deck"),"aria-label":`Ask ${ce.name} to pair`,title:`Send ${ce.name} a request. Somebody at that machine has to accept it before anything is shared. Its fingerprint is ${ce.fp}.`,children:"ask"}),ce.kind==="paired"&&c.jsx("button",{type:"button",className:`ap-manage-btn ap-lan-do danger${h===ce.fp?" armed":""}`,...L(`unpair:${ce.fp}`),onClick:()=>{if(h!==ce.fp){g(ce.fp),window.setTimeout(()=>g(we=>we===ce.fp?null:we),4e3);return}g(null),te("unpair",ce.fp,"unpair that deck")},"aria-label":h===ce.fp?`Confirm unpairing ${ce.name}`:`Unpair ${ce.name}`,title:h===ce.fp?"Press again to stop talking to this deck. Logins it already has stay with it.":"Stop talking to this deck from now on",children:h===ce.fp?"sure?":"unpair"}),ce.kind==="dialling"&&c.jsx("button",{type:"button",className:"ap-manage-btn ap-lan-do",...L(`drop:${ce.fp}`),onClick:()=>void V(ce.fp),"aria-label":`Stop dialling ${ce.name}`,title:"Stop trying this address. Nothing was ever paired here.",children:"stop"}),ce.kind==="declined"&&c.jsx("button",{type:"button",className:"ap-manage-btn ap-lan-do",...L(`allow:${ce.fp}`),onClick:()=>void te("allow",ce.fp,"let that deck ask again"),"aria-label":`Let ${ce.name} ask again`,title:"Take the no back. That deck is still trying, so the request comes round again on its own.",children:"allow"})]},`${ce.kind}:${ce.fp}`))}),W.length===0&&Q.length===0&&c.jsxs("p",{className:"ap-lan-fine",children:["No other deck yet. Decks on one network usually find each other on their own; when that has not happened, ",c.jsx("strong",{children:"+ add a deck"})," reaches one by address or by invite."]}),pe>0&&c.jsx("button",{type:"button",className:"ap-manage-btn ap-lan-check",...L("check"),onClick:()=>void Y(),title:"Ask every paired deck now for anything this deck's expired logins need, instead of waiting for the next minute",children:l==="check"?"checking…":"check now"}),c.jsxs("div",{className:"ap-lan-foot",children:[c.jsx("button",{type:"button",className:"ap-lan-word","aria-expanded":y,"aria-controls":"ap-lan-adder",onClick:()=>w(ce=>!ce),title:"Reach a deck that has not turned up on its own — by address, or with an invite",children:y?"− add a deck":"+ add a deck"}),c.jsx("button",{type:"button",className:"ap-lan-word",...L("setup"),onClick:()=>p(!0),title:"This deck's name on the network, and which of its logins it offers",children:"name & shared logins"})]}),y&&c.jsxs("div",{className:"ap-lan-adder",id:"ap-lan-adder",children:[((Ne=n==null?void 0:n.reach)==null?void 0:Ne.blocked)&&c.jsxs("div",{className:"ap-lan-reach",children:[c.jsx("p",{className:"lan-warn",children:n.reach.text}),c.jsxs("p",{className:"lan-note",children:["Nothing here is stuck: a deck that dials out first needs none of this."," ",c.jsx("strong",{children:"Ask them for an invite and paste it below"})," — an invite is dialled by whoever pastes it, so on this machine it has to be pasted rather than made. Typing their address below works the same way."]}),(n.reach.steps??[]).length>0&&c.jsxs("details",{className:"ap-lan-reach-fix",children:[c.jsx("summary",{children:"or let them find this deck on their own"}),c.jsxs("p",{className:"lan-note",children:["Run this in PowerShell ",c.jsx("strong",{children:"as Administrator"}),", then restart the deck.",n.reach.category==="Public"&&c.jsx(c.Fragment,{children:" The first line marks this network as a home or office one — leave it out on a network you do not trust."})]}),c.jsx("pre",{className:"ap-lan-cmd",children:c.jsx("code",{children:(n.reach.steps??[]).join(`
|
|
80
|
+
`)})}),c.jsx("button",{type:"button",className:"ap-manage-btn",...L("copy:fix"),onClick:()=>{var ce;return void de((((ce=n.reach)==null?void 0:ce.steps)??[]).join(`
|
|
81
|
+
`),"fix")},title:"Copy these lines, then paste them into an elevated PowerShell",children:E==="fix"?"copied":"copy command"})]})]}),c.jsxs("div",{className:"ap-lan-row",children:[c.jsx("span",{className:"ap-lan-label",children:"by address"}),c.jsx("input",{className:"ap-manage-input ap-lan-input","aria-label":"Another deck's address",value:S,placeholder:"192.168.1.5:54340",onChange:ce=>k(ce.target.value),onKeyDown:ce=>{ce.key==="Enter"&&Z()}}),S.trim()!==""&&c.jsx("button",{type:"button",className:"ap-manage-btn",...L("add"),onClick:()=>void Z(),title:"Try this address every minute, starting now.",children:"add"})]}),c.jsxs("div",{className:"ap-lan-row",children:[c.jsx("span",{className:"ap-lan-label",children:"an invite"}),c.jsx("input",{className:"ap-manage-input ap-lan-input","aria-label":"An invite you were sent",value:N,placeholder:"paste one you were sent",spellCheck:!1,onChange:ce=>{_(ce.target.value),M(null)},onKeyDown:ce=>{ce.key==="Enter"&&P()}}),N.trim()!==""&&c.jsx("button",{type:"button",className:"ap-manage-btn",...L("join"),onClick:()=>void P(),title:"Reach that deck and pair with it. Nobody has to press anything there.",children:l==="join"?"joining…":"join"})]}),C&&c.jsxs("div",{className:"ap-lan-tried",children:[c.jsx("span",{className:"ap-lan-note",children:"Nothing answered at any address in that invite. Check that deck is running and that its Local network switch is on."}),C.map(ce=>c.jsxs("span",{className:"ap-lan-tried-row",children:[c.jsx("code",{className:"ap-lan-code",children:ce.addr}),c.jsx("span",{className:"ap-lan-bad",children:ce.why})]},ce.addr))]}),ge?c.jsxs("div",{className:"ap-lan-invite",children:[c.jsxs("div",{className:"ap-lan-invite-head",children:[c.jsx("span",{className:"ap-lan-invite-title",children:"Send this to them"}),c.jsxs("span",{className:"ap-lan-invite-left",children:[VD(ge.expiresAt,H)," left"]})]}),c.jsx("code",{className:"ap-lan-token",children:ge.token}),c.jsxs("div",{className:"ap-lan-acts",children:[c.jsx("button",{type:"button",className:"ap-manage-btn",...L("copy"),onClick:()=>void de(ge.token,"invite"),title:"Copy it, and send it however you already talk to them",children:E==="invite"?"copied":"copy"}),c.jsx("button",{type:"button",className:"ap-manage-btn",...L("invite:withdraw"),onClick:()=>void J("withdraw"),title:"Cancel it. Anybody already holding the text can no longer use it.",children:"cancel"})]}),c.jsx("p",{className:"ap-lan-note",children:"They paste it and it pairs itself — nothing to press here. It carries every address this deck has, so they do not have to know which one works."}),c.jsx("p",{className:"ap-lan-warn",children:"Anyone who gets hold of this text can pair with this deck until it runs out."})]}):c.jsx("button",{type:"button",className:"ap-manage-btn ap-lan-mint",...L("invite:make"),onClick:()=>void J("make"),title:"One piece of text you send them. They paste it and the two decks pair.",children:"make an invite for them"})]})]}),f&&n&&c.jsx(zD,{status:{...n,manualRows:a},accounts:e,manual:a,onClose:()=>p(!1),onChanged:()=>{K(),t()}})]})}const e1=15e3,JD=8e3,bf=1800,e5=3e4,t5=[70,80,85,90,95];function t1(e,t){return WT(t-Math.floor(e/1e3))}function n5(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 r5(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 n1({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?HT(e.resetAt,t):null;return c.jsxs("div",{className:"ap-lane",children:[c.jsx("span",{className:"ap-lane-label",children:e.label}),c.jsx("div",{className:"ap-lane-track",children:c.jsx("div",{className:"ap-lane-fill",style:{width:`${n===0?1.5:n}%`,background:s,opacity:n===0?.4:1}})}),c.jsxs("span",{className:"ap-lane-pct",style:{color:s},children:[n,"%"]}),c.jsx("span",{className:"ap-lane-reset",children:a?`resets ${a}`:""})]})}async function r1(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 s5({onClose:e}){var be,De,He,ot,Le;const[t,n]=b.useState(null),[s,a]=b.useState(null),[i,l]=b.useState(null),[d,f]=b.useState(!1),[p,h]=b.useState(null),[g,y]=b.useState(()=>Math.floor(Date.now()/1e3)),w=b.useRef(null),[S,k]=b.useState(null),[N,_]=b.useState(!1),[E,j]=b.useState(""),[C,M]=b.useState(null),[$,I]=b.useState(null),[F,O]=b.useState(null),[A,L]=b.useState(!1),[H,X]=b.useState(!1),[T,K]=b.useState(null),[D,te]=b.useState(null),[Z,V]=b.useState(null),[J,P]=b.useState(null),[Y,de]=b.useState(!1),[U,z]=b.useState([]),Q=b.useRef(null),W=b.useCallback(se=>Xw(Q.current)?(Q.current=se,l(se),!0):!1,[]),le=b.useCallback(()=>{Q.current=null,l(null)},[]),pe=(se,je=!1)=>{const Fe=Ko(i,se);return{disabled:Fe.disabled,"aria-busy":Fe.busy||je}},ge=b.useCallback(se=>{window.requestAnimationFrame(()=>{var je;if(tq(((je=document.activeElement)==null?void 0:je.tagName)??null))for(const Fe of eq(se)){const Ee=document.querySelector(Fe);if(Ee){Ee.focus();return}}})},[]),Ne=b.useCallback(async(se=!1)=>{se&&f(!0);const je=new AbortController,Fe=window.setTimeout(()=>je.abort(),e5);try{const[Ee,Ue]=await Promise.all([fetch(`/api/claude-accounts${se?"?refresh=1":""}`,{signal:je.signal}),fetch("/api/cswap-auto",{signal:je.signal})]);if(Ee.ok){const vt=await Ee.json();n(vt),z(Oe=>PD(Oe,vt.accounts))}Ue.ok&&a(await Ue.json());const _t=FD([await Qk(Ee),await Qk(Ue)]);h(vt=>Zk(vt,_t))}catch{h(Ee=>Zk(Ee,DD))}finally{window.clearTimeout(Fe),se&&f(!1)}},[]),ce=b.useCallback(async(se,je)=>{if(!W(je))return null;h(null);try{const Ee=await(await fetch("/api/cswap-auto",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(se)})).json().catch(()=>null);return Ee!=null&&Ee.ok||h({text:pw(Ee,"command failed"),raw:Xo(Ee)}),Ee}catch{return h({text:"server unreachable"}),null}finally{le()}},[W,le]),we=b.useCallback(async(se,je)=>{if(!W(je))return null;h(null);try{const Ee=await(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(se)})).json().catch(()=>null);return Ee!=null&&Ee.ok||h({text:Fo(Ee,"command failed")}),Ee}catch{return h({text:"server unreachable"}),null}finally{le()}},[W,le]);b.useEffect(()=>(Ne(!0),w.current=window.setInterval(()=>Ne(!1),e1),()=>{w.current!=null&&window.clearInterval(w.current)}),[Ne]),b.useEffect(()=>{const se=window.setInterval(()=>y(Math.floor(Date.now()/1e3)),3e4);return()=>window.clearInterval(se)},[]);const Ce=((be=s==null?void 0:s.settings["autoswitch.threshold"])==null?void 0:be.value)??"90",_e=J??Ce,We=AD(_e,Ce),Se=(De=t==null?void 0:t.accounts)==null?void 0:De.find(se=>se.active),re=((He=Xk((Se==null?void 0:Se.lanes)??[]).peak)==null?void 0:He.pct)??null,Qe=re!=null&&re>=Number(Ce)-15,ft=async se=>{if(W(`switch-${se}`)){h(null);try{const Fe=await(await fetch("/api/claude-accounts/switch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({account:se})})).json().catch(()=>null);Fe!=null&&Fe.ok||h({text:pw(Fe,"the switch failed"),raw:Xo(Fe)}),await Ne(!0)}catch{h({text:"server unreachable"})}finally{le(),ge(se)}}},ut=async(se,je)=>{const{commit:Fe,alias:Ee}=qD(E,je);if(Fe){const Ue=await we({action:"alias",account:se,alias:Ee},`alias-${se}`);if(await Ne(!0),!(Ue!=null&&Ue.ok))return;j(Ee)}M(se),window.setTimeout(()=>M(Ue=>Ue===se?null:Ue),bf)},at=async(se,je)=>{const Fe=await we({action:"move",account:se,slot:je},`move-${se}`),Ee=CD({menuFor:S,shareFor:(F==null?void 0:F.num)??null},se,Fe);if(await Ne(!0),Ee){k(Ee.menuFor),I(Ee.confirmRemove),Ee.shareFor==null&&(O(null),X(!1)),K(Ee.swapNote);const Ue=Ee.swapNote;Ue&&window.setTimeout(()=>K(_t=>_t===Ue?null:_t),JD),te(null),ge(Ee.menuFor)}return Fe},Ye=async(se,je,Fe)=>{if(Fe.sends){const Ee=await at(se,je);if(!(Ee!=null&&Ee.ok))return}V(se),window.setTimeout(()=>V(Ee=>Ee===se?null:Ee),bf)},me=async(se,je)=>{if(je.sends){const Fe=await ce({action:"setting",key:"autoswitch.threshold",value:se},"threshold");if(await Ne(!0),!(Fe!=null&&Fe.ok))return;P(null)}de(!0),window.setTimeout(()=>de(!1),bf)};return c.jsxs("aside",{className:"accounts-panel",id:"accounts-panel","aria-label":"Claude accounts",children:[c.jsxs("div",{className:"ap-header",children:[c.jsx("h2",{children:"Accounts"}),c.jsxs("div",{className:"ap-header-right",children:[c.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:"+"}),(((ot=t==null?void 0:t.accounts)==null?void 0:ot.length)??0)>0&&c.jsx("button",{type:"button",className:"glyph-btn ap-share-set",onClick:()=>L(!0),"aria-label":"Share accounts with another deck",title:`Copy several accounts to another ${Ut} in one paste. The text carries a live login for each one — treat it as those passwords.`,children:"↗"}),c.jsx("button",{type:"button",className:"glyph-btn ap-refresh",onClick:()=>Ne(!0),...pe("reload",d),"aria-label":"Reload accounts",title:"Reload from claude-swap",children:d?"…":"↻"}),c.jsx("button",{type:"button",className:"glyph-btn",onClick:e,"aria-label":"Close accounts panel",title:"Close (A)",children:"×"})]})]}),t==null?p?c.jsxs("div",{className:"ap-empty",role:"alert",children:[c.jsx("span",{title:p.raw||void 0,children:p.text}),c.jsxs("span",{className:"ap-hint",children:["No accounts have arrived, so there is nothing to show yet. The panel keeps trying every ",e1/1e3," seconds."]}),c.jsx("button",{type:"button",className:"ap-fix",disabled:d,onClick:()=>Ne(!0),children:d?"trying…":"try again"})]}):c.jsx("div",{className:"ap-empty",children:"Checking…"}):t.ok?c.jsxs(c.Fragment,{children:[c.jsx("ul",{className:"ap-list",children:(Le=t.accounts)==null?void 0:Le.map(se=>{const{shown:je,rest:Fe,fuller:Ee,peak:Ue}=Xk(se.lanes),_t=U.includes(Jw(se)),vt=MD(Fe.length,_t,Ee);return c.jsxs("li",{className:`ap-account${se.active?" active":""}`,children:[c.jsxs("div",{className:"ap-account-head",children:[c.jsx("span",{className:"ap-num",children:se.num}),se.alias&&c.jsx("span",{className:"ap-alias",title:se.alias,children:se.alias}),c.jsx("span",{className:"ap-email",title:se.email??void 0,children:se.email}),c.jsx("button",{type:"button",id:`ap-more-${se.num}`,className:`ap-more${S===se.num?" on":""}`,"aria-label":`Manage account ${se.num}`,"aria-expanded":S===se.num,"aria-controls":S===se.num?`ap-manage-${se.num}`:void 0,title:"Share, rename, move, remove",onClick:()=>{k(S===se.num?null:se.num),j(se.alias??""),I(null),O(null),X(!1),K(null),M(null),te(null),V(null)},children:"⋯"}),se.active&&c.jsx("span",{className:"ap-badge-active",children:"active"}),se.disabled&&c.jsx("span",{className:"ap-badge-held",children:"held out"}),!se.active&&!se.disabled&&c.jsx("button",{type:"button",className:"ap-manage-btn ap-switch",...pe(`switch-${se.num}`),onClick:()=>ft(se.num),title:`Switch to ${se.alias??se.email}`,children:i===`switch-${se.num}`?"…":"switch"})]}),c.jsx("div",{className:"ap-lanes",id:`ap-lanes-${se.num}`,children:je.length?c.jsxs(c.Fragment,{children:[je.map(Oe=>c.jsx(n1,{lane:Oe,nowSec:g},Oe.id)),_t&&Fe.map(Oe=>c.jsx(n1,{lane:Oe,nowSec:g},Oe.id))]}):c.jsx("div",{className:"ap-hint",children:"No usage recorded yet."})}),c.jsxs("div",{className:"ap-meta",children:[se.staleCopy&&c.jsxs(c.Fragment,{children:[c.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"}),c.jsx("button",{type:"button",className:"ap-fix",...pe("recapture"),onClick:async()=>{const Oe=await we({action:"recapture"},"recapture");Oe!=null&&Oe.ok&&Ne(!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"})]}),se.error&&(()=>{const Oe=r5(se.error);return c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"ap-err",title:Oe.hint,children:Oe.text}),Oe.fixable&&c.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"})]})})(),vt&&c.jsx("button",{type:"button",className:"ap-lanes-more","aria-expanded":_t,"aria-controls":`ap-lanes-${se.num}`,title:ID(se.headroom,(Ue==null?void 0:Ue.label)??null,Fe.length,_t),onClick:()=>z(Oe=>$D(Oe,se)),children:vt}),(((s==null?void 0:s.enabled)||(s==null?void 0:s.external))&&!se.active||se.disabled)&&c.jsx("button",{type:"button",className:"ap-rotate",...pe(`rot-${se.num}`),onClick:()=>ce({action:"account",account:se.num,enabled:se.disabled},`rot-${se.num}`).then(()=>Ne(!0)),title:se.disabled?"Return this account to auto-rotation":"Hold this account out of auto-rotation",children:se.disabled?"put back":"hold out"}),se.fetchedAt?c.jsxs("span",{className:`ap-age${se.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 ",t1(se.fetchedAt,g),n5(se.nextAt,g)]}):c.jsx("span",{className:"ap-age ap-stale",title:"claude-swap has not read this account yet",children:"never collected"})]}),S===se.num&&c.jsxs("div",{className:"ap-manage",id:`ap-manage-${se.num}`,role:"group","aria-label":`Manage account ${se.num}`,children:[c.jsxs("div",{className:"ap-manage-name",children:[c.jsx("label",{className:"vis-hidden",htmlFor:`ap-alias-${se.num}`,children:"Alias"}),c.jsx("input",{id:`ap-alias-${se.num}`,className:"ap-manage-input",type:"text",value:E,onChange:Oe=>j(Oe.target.value),onKeyDown:Oe=>{Oe.key==="Enter"&&ut(se.num,se.alias)},maxLength:LD,placeholder:"e.g. work",spellCheck:!1,autoFocus:!0}),c.jsx("button",{type:"button",className:"ap-manage-btn",...pe(`alias-${se.num}`),onClick:()=>ut(se.num,se.alias),title:"A short name to show instead of the email",children:C===se.num?"saved":"save"})]}),(()=>{const Oe=jD((t.accounts??[]).map(xt=>xt.num),se.num),it=TD(Oe,D,se.num),wt=RD(Oe,it,se.num);return c.jsxs("div",{className:"ap-manage-slot",children:[c.jsx("label",{className:"vis-hidden",htmlFor:`ap-slot-${se.num}`,children:"Slot"}),c.jsx("span",{className:"ap-field",children:c.jsx("select",{id:`ap-slot-${se.num}`,value:String(it),...pe(`move-${se.num}`),onChange:xt=>te(Number(xt.target.value)),children:Oe.map(xt=>c.jsx("option",{value:xt.slot,children:xt.label},xt.slot))})}),c.jsx("button",{type:"button",className:"ap-manage-btn",...pe(`move-${se.num}`),title:wt.title,onClick:()=>Ye(se.num,it,wt),children:Z===se.num?wt.done:wt.label})]})})(),c.jsxs("div",{className:"ap-manage-acts",children:[c.jsx("button",{type:"button",className:"ap-manage-btn",...pe(`share-${se.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()=>{X(!1);const Oe=await we({action:"share",account:se.num},`share-${se.num}`);Oe!=null&&Oe.ok&&O({num:se.num,blob:Oe.blob,expiresAt:Oe.expiresAt})},children:"share"}),c.jsx("button",{type:"button",className:`ap-manage-btn danger${$===se.num?" armed":""}`,...pe(`rm-${se.num}`),title:$===se.num?"This deletes the stored credentials for this account":"Remove this account from claude-swap",onClick:()=>{if($!==se.num){I(se.num),window.setTimeout(()=>I(Oe=>Oe===se.num?null:Oe),4e3);return}I(null),we({action:"remove",account:se.num},`rm-${se.num}`).then(()=>{k(null),Ne(!0),ge(null)})},children:$===se.num?"confirm":"remove"})]}),(T==null?void 0:T.at)===se.num&&(()=>{var wt;const Oe=(wt=t.accounts)==null?void 0:wt.find(xt=>xt.num===T.displaced),it=(Oe==null?void 0:Oe.alias)??(Oe==null?void 0:Oe.email)??"the account that was there";return c.jsxs("span",{className:"ap-manage-hint ap-manage-swap",title:`Slot ${T.at} was taken, so the two accounts traded places: ${it} now holds slot ${T.displaced}.`,children:["swapped with slot ",T.displaced]})})(),(F==null?void 0:F.num)===se.num&&(()=>{const Oe=eR(F.expiresAt,g),it=Oe.tone==="gone";return c.jsxs("div",{className:`ap-share${it?" expired":""}`,children:[c.jsx("code",{className:"ap-share-blob",children:F.blob}),c.jsxs("div",{className:"ap-share-foot",children:[c.jsx("button",{type:"button",className:"ap-manage-btn",...pe(`share-${se.num}`),onClick:async()=>{if(it){X(!1);const wt=await we({action:"share",account:se.num},`share-${se.num}`);wt!=null&&wt.ok&&O({num:se.num,blob:wt.blob,expiresAt:wt.expiresAt});return}await r1(F.blob)&&(X(!0),window.setTimeout(()=>X(!1),1800))},children:it?"make a new share":H?"copied":"copy"}),c.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:[c.jsx("span",{className:"ap-share-warn",children:"this is the password"})," · ",c.jsx("span",{className:`ap-share-expiry ${Oe.tone}`,children:Oe.text})]})]})]})})()]})]},se.num)})}),(s==null?void 0:s.ok)&&c.jsxs("div",{className:"ap-auto",children:[c.jsxs("div",{className:"ap-auto-head",children:[c.jsx("h3",{className:"ap-auto-title",children:"Auto-switch"}),c.jsxs("span",{className:"ap-auto-ctl",children:[re!=null&&c.jsxs("span",{className:`ap-auto-now${Qe?" near":""}`,children:[Math.round(re),"%"]}),c.jsx("span",{className:"ap-field",title:"Switch once the active account passes this much of its limit",children:c.jsx("select",{"aria-label":"Switch threshold",value:_e,...pe("threshold"),onChange:se=>P(se.target.value),children:t5.map(se=>c.jsxs("option",{value:se,children:[se,"%"]},se))})}),c.jsx("button",{type:"button",className:"ap-manage-btn",...pe("threshold"),title:We.title,onClick:()=>me(_e,We),children:Y?We.done:We.label}),c.jsxs("button",{type:"button",className:`ap-auto-state${s.enabled?" live":""}`,role:"switch","aria-checked":s.enabled,"aria-label":"Auto-switch",...pe("enable"),onClick:()=>ce({action:"enable",enabled:!s.enabled},"enable").then(()=>Ne(!0)),title:s.enabled?"Stop switching accounts automatically":"Switch accounts automatically when the active one nears its limit",children:[c.jsx("i",{className:s.enabled?"ap-pulse":"ap-dot","aria-hidden":!0}),s.enabled?"on":"off"]})]})]}),s.external&&c.jsxs("p",{className:"ap-auto-note",children:[c.jsx("i",{className:"ap-pulse","aria-hidden":!0})," A ",c.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&&c.jsx("div",{className:"ap-auto-foot",children:c.jsxs("span",{className:"ap-auto-result",children:["checked ",t1(s.lastTick.at,g)]})})]}),p&&c.jsxs("div",{className:"ap-failure",role:"alert",children:[c.jsx("span",{className:"ap-failure-text",title:p.raw||void 0,children:p.text}),c.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>h(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),c.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."}),c.jsx(ZD,{accounts:((t==null?void 0:t.accounts)??[]).map(se=>({key:`${String(se.email??"").trim().toLowerCase()}@@${se.orgUuid??""}`,email:se.email??"",alive:se.alive===!0})),onChanged:()=>Ne(!0)})]}):c.jsx("div",{className:"ap-empty",children:t.reason==="no_cswap"?c.jsxs(c.Fragment,{children:[c.jsx("span",{children:"claude-swap isn't installed."}),c.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&&c.jsx("code",{className:"ap-cmd",children:t.hint}),c.jsxs("span",{className:"ap-hint",children:["Then add an account with the ",c.jsx("strong",{children:"+"})," button above."]})]}):t.reason==="no_accounts"?c.jsxs(c.Fragment,{children:[c.jsx("span",{children:"No accounts added yet."}),c.jsxs("span",{className:"ap-hint",children:["claude-swap is installed but has nothing in its store. Use the ",c.jsx("strong",{children:"+"})," above to sign one in, or to paste one shared from another deck."]})]}):c.jsxs(c.Fragment,{children:[c.jsx("span",{children:"Couldn't read the account store."}),c.jsxs("span",{className:"ap-hint",children:["claude-swap is installed, but its store could not be read",t.reason?` (${t.reason})`:"","."]})]})}),N&&c.jsx(_D,{onClose:()=>_(!1),onChanged:()=>Ne(!0)}),A&&c.jsx(ED,{accounts:((t==null?void 0:t.accounts)??[]).map(se=>({num:se.num,email:se.email,alias:se.alias,org:se.org})),onClose:()=>L(!1),copyText:r1})]})}const a5=3e4;function o5({bundle:e,running:t,lastTried:n}){return!t||e===t?!1:n!==t}function i5({bundle:e,running:t,pending:n,lastTried:s}){return t?o5({bundle:e,running:t,lastTried:s})?"reload":n==null||n&&n!==t?"wait":"confirm":"wait"}function l5(e){return!e||e.state!=="failed"?null:`${typeof e.at=="number"?e.at:0}:${e.error??""}`}function c5({asked:e,reported:t}){return t?t!==e:!1}function rR(e){const t=e.thresholdMs??a5;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 u5(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 d5(e,t){return e?t==null?"auto when idle":`auto in ${u5(t)}`:"auto-restart off"}function s1(e){let t=0;for(const n of e)n.state==="active"&&t++;return t}function h5(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 f5(e){const t=rR(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 sR(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 p5(e,t){return e==="confirmation"?t.confirmOpen?"clear":"ignore":t.modalOpen||t.confirmOpen?"ignore":"confirm"}function m5(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 g5(e){return e<=0?null:e===1?"the one agent":`all ${e} agents`}function y5(e,t){const n=g5(e),s=n?`removes ${n} on the canvas`:null,a=d=>`This ${s?`${s} and ${d}`:d}`;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 d=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: ${d}${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 v5({agentCount:e,onConfirm:t,onCancel:n}){const s=b.useRef(null),a=an(n,{focusRef:s,layer:m3}),[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(m5(h))}).catch(()=>{}),()=>{p=!0}},[]);const{note:d,confirm:f}=y5(e,i);return c.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:c.jsxs("div",{ref:a,className:"modal clear-confirm",onClick:p=>p.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"clear-confirm-title",children:[c.jsxs("header",{className:"modal-head",children:[c.jsxs("div",{className:"modal-title",children:[c.jsx("span",{className:"status-dot err","aria-hidden":!0}),c.jsx("span",{id:"clear-confirm-title",className:"modal-tool-name",children:"Clear the deck?"})]}),c.jsx("div",{className:"modal-actions",children:c.jsx("button",{type:"button",className:"glyph-btn",onClick:n,"aria-label":"Cancel (Esc)",title:"Cancel (Esc)",children:"×"})})]}),c.jsxs("section",{className:"modal-body",children:[c.jsx("p",{className:"modal-note",children:d}),c.jsxs("div",{className:"cc-actions",children:[c.jsx("button",{type:"button",ref:s,className:"btn",onClick:n,children:"Cancel"}),c.jsx("button",{type:"button",className:"btn danger",onClick:t,children:f})]})]})]})})}const w5="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.",x5=[{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 b5({onClose:e}){const t=an(e);return c.jsx("div",{className:"modal-backdrop",onClick:e,role:"presentation",children:c.jsxs("div",{ref:t,className:"modal key-help",onClick:n=>n.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"key-help-title",children:[c.jsxs("header",{className:"modal-head",children:[c.jsx("div",{className:"modal-title",children:c.jsx("span",{id:"key-help-title",className:"modal-tool-name",children:"Keyboard shortcuts"})}),c.jsx("div",{className:"modal-actions",children:c.jsx("button",{type:"button",className:"glyph-btn",onClick:e,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),c.jsxs("section",{className:"modal-body",children:[c.jsx("p",{className:"modal-note",children:w5}),c.jsx("div",{className:"shortcuts",children:x5.map(n=>c.jsxs(b.Fragment,{children:[c.jsx("h3",{className:"kh-group",children:n.title}),n.rows.map(s=>c.jsxs("div",{className:"sc",children:[c.jsx("kbd",{children:s.cap}),c.jsx("span",{children:s.action})]},`${n.title}:${s.cap}:${s.action}`))]},n.title))})]})]})})}const k5=["done","needs-input"],_5=[{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}]}],S5=[{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}]}],e0={done:_5,"needs-input":S5},Qo="two";function gw(e,t){const n=e0[e];return n.find(s=>s.id===t)??n.find(s=>s.id===Qo)??n[0]}function aR(e,t){return e0[e].some(s=>s.id===t)?t:Qo}gw("done",Qo).notes,gw("needs-input",Qo).notes;const a1=.04,N5=.24,Iu=0,Yu=100,yw=5,Rl=50;function Al(e){if(!Number.isFinite(e))return Rl;const t=Math.round(e/yw)*yw;return Math.min(Yu,Math.max(Iu,t))}function E5(e){if(e==null)return Rl;const t=e.trim();return/^-?\d+(\.\d+)?$/.test(t)?Al(Number(t)):Rl}function j5(e){const t=Al(e),n=a1+(N5-a1)*(t/Yu);return Math.round(n*1e4)/1e4}function C5(e,t){const n=t.trim,s=typeof n=="number"&&Number.isFinite(n)&&n>0&&n<=1?n:1;return Math.round(j5(e)*s*1e4)/1e4}const T5=160,R5="agent-dag.soundLevel.done",A5="agent-dag.soundLevel.needs-input",M5="agent-dag.soundFigure.done",I5="agent-dag.soundFigure.needs-input",oR={done:R5,"needs-input":A5},iR={done:M5,"needs-input":I5},vw={done:{level:Rl,figure:Qo},"needs-input":{level:Rl,figure:Qo}};function O5(e){const t=n=>({level:E5(e(oR[n])),figure:aR(n,e(iR[n]))});return{done:t("done"),"needs-input":t("needs-input")}}const $5={Stop:"done",Notification:"needs-input"};function P5(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:$5[n]??null}function L5(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 d(f,p=!1){var S;if(!p&&!e.enabled()||!n||n.state!=="running")return!1;const h=(((S=e.prefs)==null?void 0:S.call(e))??vw)[f]??vw[f],g=gw(f,h.figure),y=C5(h.level,g),w=n.currentTime;for(const k of g.notes){const N=n.createOscillator(),_=n.createGain();N.type=g.type??"sine",N.frequency.value=k.hz;const E=w+k.at,j=E+k.ms/1e3;_.gain.setValueAtTime(1e-4,E),_.gain.exponentialRampToValueAtTime(y,E+.012),_.gain.exponentialRampToValueAtTime(1e-4,j),N.connect(_).connect(n.destination),N.start(E),N.stop(j+.02)}return!0}return{unlock:l,play:d,state:a,get context(){return n}}}const q5="Notify me when a session needs my attention.",D5="Held off for this run — the deck was started with alerts disabled. Your choice is saved for the next start.",o1="Get notified when you're away from this tab.";function F5(e){switch(e){case"granted":return{status:"Enabled",ask:!1,ok:!0,note:o1};case"default":return{status:null,ask:!0,ok:!1,note:o1};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 i1={done:"Turn finished","needs-input":"Claude is asking"},z5={done:"Plays when Claude or Codex finishes a turn.","needs-input":"Available in Claude Code only."};function B5({onClose:e,soundOn:t,onToggleSound:n,prefs:s,onLevel:a,onFigure:i,onPreview:l,openerRef:d,notifyOn:f,onToggleNotify:p,notifyVetoed:h,notifyPermission:g,onAskNotify:y}){const w=F5(g),S=f&&!h,k=an(e),N=b.useRef(e);return N.current=e,b.useEffect(()=>{const _=E=>{var C,M;const j=E.target;j&&((C=k.current)!=null&&C.contains(j)||(M=d.current)!=null&&M.contains(j)||N.current())};return window.addEventListener("pointerdown",_,!0),()=>window.removeEventListener("pointerdown",_,!0)},[k,d]),c.jsxs("div",{ref:k,id:"sound-menu",className:"sound-menu",role:"dialog","aria-label":"Sound settings",children:[c.jsxs("div",{className:"sm-switches",children:[c.jsxs("label",{className:"sm-switch",children:[c.jsx("span",{className:"sm-switch-label",id:"sm-sound-label",children:"Sounds"}),c.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:c.jsx("span",{className:"sm-toggle-knob"})})]}),c.jsxs("div",{className:"sm-setting",children:[c.jsxs("label",{className:"sm-switch",children:[c.jsx("span",{className:"sm-switch-label",id:"sm-notify-label",children:"Notifications"}),c.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:c.jsx("span",{className:"sm-toggle-knob"})})]}),c.jsx("p",{className:"sm-note",children:h?D5:q5})]})]}),S&&c.jsxs("section",{className:"sm-channel","aria-labelledby":"sm-channel-name",children:[c.jsxs("div",{className:"sm-channel-head",children:[c.jsx("h3",{className:"sm-channel-name",id:"sm-channel-name",children:"Browser notifications"}),w.ask?c.jsx("button",{type:"button",className:"btn sm-channel-action",onClick:y,children:"Enable"}):c.jsxs("span",{className:"sm-channel-state","data-ok":w.ok||void 0,children:[w.ok&&c.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:c.jsx("path",{d:"M1.5 5.2 3.9 7.6 8.5 2.4"})}),w.status]})]}),c.jsx("p",{className:"sm-note",children:w.note})]}),!t&&c.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."}),c.jsx("div",{className:"sm-tones",children:k5.map(_=>{const E=s[_],j=`sm-level-${_}`,C=`sm-figure-${_}`;return c.jsxs("section",{className:"sm-tone","aria-labelledby":`sm-name-${_}`,children:[c.jsxs("div",{className:"sm-tone-head",children:[c.jsx("h3",{className:"sm-tone-name",id:`sm-name-${_}`,children:i1[_]}),c.jsxs("button",{type:"button",className:"btn sm-hear",onClick:()=>l(_),"aria-label":`Hear the ${i1[_].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:[c.jsx("svg",{width:"11",height:"11",viewBox:"0 0 12 12",fill:"currentColor","aria-hidden":!0,children:c.jsx("path",{d:"M3 1.6v8.8l7-4.4z"})}),"Hear it"]})]}),c.jsxs("div",{className:"sm-row",children:[c.jsx("label",{htmlFor:j,children:"Volume"}),c.jsx("input",{id:j,type:"range",min:Iu,max:Yu,step:yw,value:E.level,onChange:M=>a(_,Number(M.target.value)),style:{"--sm-level":`${(E.level-Iu)/(Yu-Iu)*100}%`}}),c.jsxs("span",{className:"sm-read",children:[E.level,"%"]})]}),c.jsxs("div",{className:"sm-row",children:[c.jsx("label",{htmlFor:C,children:"Tone"}),c.jsx("select",{id:C,className:"sm-select",value:E.figure,onChange:M=>i(_,M.target.value),children:e0[_].map(M=>c.jsx("option",{value:M.id,children:M.label},M.id))})]}),c.jsx("p",{className:"sm-note",children:z5[_]})]},_)})}),c.jsxs("p",{className:"sm-foot",children:[c.jsx("kbd",{children:"M"}),"Mute or unmute sounds anywhere."]})]})}const U5={"//":["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.17.0":[{title:"🔔 Pairing is two presses",body:`When another deck asks to pair, the question now arrives **over the deck** rather than in a row three sections down a panel: its name, its address, the fingerprint to compare, **Accept** or **Decline**. Escape means later — the request stays in the panel until you answer it.
|
|
82
|
+
|
|
83
|
+
The rest is one list. Every deck you are paired with, every deck on the network, and every one you turned away, each a row with its state under the name and one verb at the end — and a deck that cannot be reached now reads differently from one that is fine. Saying no also reaches the other machine now, instead of leaving it waiting forever; you can take it back.
|
|
84
|
+
|
|
85
|
+
The dialog behind **setup** is down to the two things it is really about: what this deck is called, and which logins it offers.`}],"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.
|
|
86
|
+
|
|
87
|
+
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.
|
|
88
|
+
|
|
89
|
+
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.
|
|
90
|
+
|
|
91
|
+
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.
|
|
92
|
+
|
|
93
|
+
What you are reading is the first version that does not.
|
|
94
|
+
|
|
95
|
+
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.
|
|
96
|
+
|
|
97
|
+
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.
|
|
98
|
+
|
|
99
|
+
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.
|
|
100
|
+
|
|
101
|
+
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.
|
|
102
|
+
|
|
103
|
+
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.
|
|
104
|
+
|
|
105
|
+
The count of what is behind it is on the heading's tooltip, so collapsing it does not hide how much there is.
|
|
106
|
+
|
|
107
|
+
**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.
|
|
108
|
+
|
|
109
|
+
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.
|
|
110
|
+
|
|
111
|
+
\`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.
|
|
112
|
+
|
|
113
|
+
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.
|
|
114
|
+
|
|
115
|
+
**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.
|
|
116
|
+
|
|
117
|
+
**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.
|
|
118
|
+
|
|
119
|
+
**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.
|
|
120
|
+
|
|
121
|
+
**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.
|
|
122
|
+
|
|
123
|
+
**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.
|
|
124
|
+
|
|
125
|
+
**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.
|
|
126
|
+
|
|
127
|
+
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.
|
|
128
|
+
|
|
129
|
+
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.
|
|
130
|
+
|
|
131
|
+
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.
|
|
132
|
+
|
|
133
|
+
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.
|
|
134
|
+
|
|
135
|
+
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.
|
|
136
|
+
|
|
137
|
+
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.
|
|
138
|
+
|
|
139
|
+
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.
|
|
140
|
+
|
|
141
|
+
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.
|
|
142
|
+
|
|
143
|
+
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.
|
|
144
|
+
|
|
145
|
+
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.
|
|
146
|
+
|
|
147
|
+
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.
|
|
148
|
+
|
|
149
|
+
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.
|
|
150
|
+
|
|
151
|
+
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.
|
|
152
|
+
|
|
153
|
+
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.
|
|
154
|
+
|
|
155
|
+
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.
|
|
156
|
+
|
|
157
|
+
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.
|
|
158
|
+
|
|
159
|
+
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.
|
|
160
|
+
|
|
161
|
+
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.
|
|
162
|
+
|
|
163
|
+
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.
|
|
164
|
+
|
|
165
|
+
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.
|
|
166
|
+
|
|
167
|
+
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.
|
|
168
|
+
|
|
169
|
+
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.
|
|
170
|
+
|
|
171
|
+
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.
|
|
172
|
+
|
|
173
|
+
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.
|
|
174
|
+
|
|
175
|
+
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.
|
|
176
|
+
|
|
177
|
+
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.
|
|
178
|
+
|
|
179
|
+
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.
|
|
180
|
+
|
|
181
|
+
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.
|
|
182
|
+
|
|
183
|
+
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.
|
|
184
|
+
|
|
185
|
+
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.
|
|
186
|
+
|
|
187
|
+
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.
|
|
188
|
+
|
|
189
|
+
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.
|
|
190
|
+
|
|
191
|
+
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.
|
|
192
|
+
|
|
193
|
+
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.
|
|
194
|
+
|
|
195
|
+
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.
|
|
196
|
+
|
|
197
|
+
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.
|
|
198
|
+
|
|
199
|
+
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.
|
|
200
|
+
|
|
201
|
+
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.
|
|
202
|
+
|
|
203
|
+
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.
|
|
204
|
+
|
|
205
|
+
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".
|
|
206
|
+
|
|
207
|
+
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.
|
|
208
|
+
|
|
209
|
+
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.
|
|
210
|
+
|
|
211
|
+
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.
|
|
212
|
+
|
|
213
|
+
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.
|
|
214
|
+
|
|
215
|
+
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.
|
|
216
|
+
|
|
217
|
+
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.
|
|
218
|
+
|
|
219
|
+
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.
|
|
220
|
+
|
|
221
|
+
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.
|
|
222
|
+
|
|
223
|
+
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.
|
|
224
|
+
|
|
225
|
+
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.
|
|
226
|
+
|
|
227
|
+
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.
|
|
228
|
+
|
|
229
|
+
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.
|
|
230
|
+
|
|
231
|
+
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.
|
|
232
|
+
|
|
233
|
+
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.
|
|
234
|
+
|
|
235
|
+
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.
|
|
236
|
+
|
|
237
|
+
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.
|
|
238
|
+
|
|
239
|
+
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.
|
|
240
|
+
|
|
241
|
+
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."}],"3.16.0":[{title:"🤝 Pair two decks with one piece of text",body:`**Accounts ▸ Local network ▸ setup… ▸ make an invite.** Send the text however you already talk to them; they paste it and the two decks are paired. Nobody presses accept, and neither of you has to know which of your addresses the other can reach — the invite carries them all and their deck tries each one.
|
|
242
|
+
|
|
243
|
+
Decks on the same router still find each other on their own and appear under **on this network right now**. An invite is for the case that does not work: another subnet, a VPN, a firewall.
|
|
244
|
+
|
|
245
|
+
The invite lasts 10 minutes and is used once. Anyone who gets hold of the text can pair with your deck until it runs out, so send it the way you would send anything else you would not want forwarded.`},{title:"⚠️ Both machines have to be on this version",body:`The two decks no longer speak the old protocol, and there is no fallback: a 3.15 deck and a 3.16 deck cannot see each other at all. Update both.
|
|
246
|
+
|
|
247
|
+
The group passphrase is gone. If you had one set, that pairing is not carried over — make an invite and pair again. It was replaced because a passphrase that differs by one character produced a closed socket and no other symptom on either machine, and a secret is the one thing a panel must never print, so neither person could check theirs against the other's.`}]},t0="agent-dag.releaseNotesSeen";function l1(e){return e.split(/[.\-+]/).map(t=>parseInt(t,10)).map(t=>Number.isNaN(t)?0:t)}function Zo(e,t){const n=l1(e),s=l1(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 Jo(e){return typeof e=="string"&&/^\d+\.\d+\.\d+/.test(e)}function W5(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 H5(e){if(!e||typeof e!="object")return[];const t=[];for(const[n,s]of Object.entries(e)){if(!Jo(n)||!Array.isArray(s))continue;const a=s.filter(W5);a.length&&t.push({version:n,notes:a})}return t.sort((n,s)=>Zo(s.version,n.version))}const c1=H5(U5);function lR(e,t,n){return e.filter(s=>Zo(s.version,n)<=0&&(t===null||Zo(s.version,t)>0))}function G5(e,t){return e.filter(n=>Zo(n.version,t)===0)}function V5(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 Y5({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&&Jo(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(!Jo(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=Zo(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 K5=new RegExp("^(?:\\p{Extended_Pictographic}|\\p{Emoji_Modifier}|\\p{Regional_Indicator}|[\\u200D\\uFE0F])+(?= \\S)","u");function X5(e){const t=K5.exec(e);return t?{icon:t[0],rest:e.slice(t[0].length)}:{icon:null,rest:e}}function Q5(){if(typeof window>"u")return null;try{return window.localStorage}catch{return null}}function Z5(e){if(!e)return null;let t=null;try{t=e.getItem(t0)}catch{return null}return Jo(t)?t:null}function J5(e){if(!e)return!1;try{return e.getItem(t0),!0}catch{return!1}}function eF(e,t){if(!e)return!1;try{return e.setItem(t0,t),!0}catch{return!1}}function tF({stored:e,running:t,notes:n,remembers:s=!0}){if(!Jo(t))return{show:[],record:null,reason:"no-version"};if(!Jo(e)){if(!s)return{show:[],record:t,reason:"cannot-remember"};const l=G5(n,t);return l.length?{show:l,record:t,reason:"welcome"}:{show:[],record:t,reason:"first-run"}}const a=Zo(e,t);if(a===0)return{show:[],record:null,reason:"seen"};if(a>0)return{show:[],record:null,reason:"ahead"};const i=lR(n,e,t);return i.length?{show:i,record:t,reason:"new-notes"}:{show:[],record:t,reason:"nothing-new"}}function nF(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 cR(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=nF(e,i);if(l>0){a(),n.push({kind:"bold",kids:cR(e.slice(i+2,l),!1)}),i=l+2;continue}}s+=e[i],i+=1}return a(),n}function rF({entries:e,since:t,running:n,firstRun:s,onClose:a}){const i=an(a),l=V5(e);return c.jsx("div",{className:"modal-backdrop",onClick:a,role:"presentation",children:c.jsxs("div",{ref:i,className:"modal release-notes",onClick:d=>d.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"release-notes-title",children:[c.jsxs("header",{className:"modal-head",children:[c.jsxs("div",{className:"modal-title",children:[c.jsx("span",{id:"release-notes-title",className:"modal-tool-name",children:"What's new"}),l&&c.jsx("span",{className:"modal-tool-id",children:l})]}),c.jsx("div",{className:"modal-actions",children:c.jsx("button",{type:"button",className:"glyph-btn",onClick:a,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),c.jsxs("section",{className:"modal-body",children:[c.jsx("p",{className:"modal-note",children:Y5({since:t,running:n,firstRun:s,entries:e})}),e.map(d=>c.jsxs("section",{className:"modal-section",children:[c.jsxs("h3",{className:"rn-version",children:["v",d.version]}),c.jsx("ul",{className:"rn-notes",children:d.notes.map((f,p)=>{const{icon:h,rest:g}=X5(f.title);return c.jsxs("li",{className:"rn-note",children:[c.jsxs("p",{className:"rn-note-title",children:[h&&c.jsx("span",{className:"rn-note-icon",children:h}),g]}),c.jsx("p",{className:"rn-note-body",children:uR(cR(f.body))})]},p)})})]},d.version))]})]})})}function uR(e){return e.map((t,n)=>t.kind==="text"?t.text:t.kind==="code"?c.jsx("code",{className:"rn-code",children:t.text},n):c.jsx("strong",{className:"rn-strong",children:uR(t.kids)},n))}function sF(e){return e.slice().sort((t,n)=>t.y-n.y||t.x-n.x)}function aF(e,t,n){var l;if(e.length===0)return null;const s=sF(e),a=t?s.findIndex(d=>d.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 oF=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Escape","Delete","Backspace"]);function iF(e,t){return t==null?{kind:"deck",nodeId:null}:e.key==="Enter"||e.key===" "?{kind:"activate",nodeId:t,additive:e.shiftKey}:oF.has(e.key)?{kind:"node",nodeId:t}:{kind:"deck",nodeId:t}}const lF=new Set(["","BODY","HTML","#DOCUMENT"]);function cF(e){return!e||Vw(e)?!1:!lF.has(String(e.tagName??"").toUpperCase())}function vu(e,t){if(t.size!==0)for(const n of Array.from(e.keys()))t.has(n)||e.delete(n)}function uF(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 dF(e){const t=new Set;for(const n of e)t.add(n.id),t.add(`group:${n.sessionId}`);return t}function hF(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 fF(e,t){const n=new Set;for(const s of t){const a=hF(e,s);if(a)for(const i of a)n.add(i)}return n.size>0?n:null}function dR(e,t,n){return!t.has(e)||n.has(e)}function pF(e,t,n,s){return!t.has(e)&&dR(e,n,s)}function mF(e,t,n){const s={x:0,y:0};return t.set(e,s),n.add(e),s}function gF(e,t,n,s){n.set(e,t),s.delete(e)}const yF=40,vF=120;function wF(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)},d=(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=yF){const p=t.now(),h=Math.max(a+f,p);if(h<=p){l(),i();return}d(h,p,f)},replay(f=vF){l(),s=t.now()+f,n=t.setTimeout(i,f)},flush(){l(),i()},cancel(){l()}}}const xF=1e3;function bF(e={}){const t=Math.max(1,Math.floor(e.limit??xF)),n=e.protect;let s=!1,a=[],i=new Set,l=0,d=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 d},accept(p){const h=typeof(p==null?void 0:p.seq)=="number"?p.seq:null,g=(p==null?void 0:p.epoch)??null,y=g!==null&&g!==f;y&&(f=g,d=0);const w=h!==null&&!y&&h<=d;if(h!==null&&h>d&&(d=h),!s)return!0;if(w)return!1;if(a.push(p),n!=null&&n(p)&&i.add(p),a.length>t){let S=0;if(i.size<a.length)for(;i.has(a[S]);)S++;const[k]=a.splice(S,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 hR="agent-dag.theme";function kF(e){return e==="light"?"light":"dark"}function _F(){return kF(ni(hR))}function SF({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 wu={offline:"#e05252",waiting:"#c97d12",running:"#2a90d4",idle:"#7e828c"};function xu(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 NF=Object.freeze({offline:`data:image/svg+xml,${encodeURIComponent(xu(wu.offline,"offline"))}`,waiting:`data:image/svg+xml,${encodeURIComponent(xu(wu.waiting,"waiting"))}`,running:`data:image/svg+xml,${encodeURIComponent(xu(wu.running,"running"))}`,idle:`data:image/svg+xml,${encodeURIComponent(xu(wu.idle,"idle"))}`}),EF="No sessions are waiting for you.";function jF(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 CF(e,t){return t!==""?t:e===""?"":EF}function TF(){let e=0;return{begin(){const t=++e;return()=>t===e},cancel(){e++}}}function RF(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 AF(e){return e.claude&&e.codex?"Claude Code and Codex":e.claude?"Claude Code":e.codex?"Codex":null}const u1={claude:"Claude Code",codex:"Codex",opencode:"OpenCode",openclaw:"OpenClaw",copilot:"GitHub Copilot",pi:"pi-agent"};function n0(e){const t=e.toLowerCase();return Object.hasOwn(u1,t)?u1[t]:t?t[0].toUpperCase()+t.slice(1):""}function MF(e){return e.length<=1?e[0]??"":`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`}function IF(e,t=[]){const n=t.length?MF(t.map(n0)):AF(e);return n?`via ccusage · local ${n} logs`:"via ccusage · local agent logs"}function OF(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 $F(e,t){const n=t.prefs??vw,s=Al(n.done.level),a=Al(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)",d=e.codex?`
|
|
248
|
+
|
|
249
|
+
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?`
|
|
250
|
+
|
|
251
|
+
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+d+f+`
|
|
252
|
+
|
|
253
|
+
Click to set the volume and the sound of each tone, and to hear either one.`}function fR(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 PF(e){const t=fR([{agents:e}]);return t.length<2?null:t.map(n=>`${n0(n.id)} ${Je(n.cost)}`).join(" · ")}function d1(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 LF(e,t){if(!(t>0)||!(e>0))return"0%";const n=e/t*100;return n<.1?"<0.1%":`${n.toFixed(1)}%`}function bu(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 qF=[7,14,30,90];function DF(e){const[t,n]=b.useState(null),[s,a]=b.useState(!1),i=b.useState(TF)[0],l=b.useRef(!1),d=(f=!1)=>{if(f&&!ur(l.current))return;const p=i.begin();l.current=f;const h=e;a(!0);const y=`/api/ccusage?since=${dw(h)}${f?"&refresh=1":""}`;fetch(y).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(()=>(d(!1),()=>i.cancel()),[e]),{landed:t,loading:s,reload:()=>d(!0)}}function FF({onClose:e,providers:t}){var F;const[n,s]=b.useState(30),[a,i]=b.useState(null),{landed:l,loading:d,reload:f}=DF(n),p=b.useRef(null),h=an(e,{focusRef:p}),g=RF({loading:d,want:n,answer:l&&{range:l.range,ok:l.resp.ok===!0,days:((F=l.resp.days)==null?void 0:F.length)??0}}),y=g.phase==="chart"?l.resp.days??[]:[],w=b.useMemo(()=>y.reduce((O,A)=>Math.max(O,A.totalCost),0),[y]),S=b.useRef(null);b.useLayoutEffect(()=>{const O=S.current;O&&(O.scrollLeft=O.scrollWidth)},[y]);const{totalCost:k,totalTok:N,inOut:_,cacheRead:E,modelCosts:j}=b.useMemo(()=>{let O=0,A=0,L=0,H=0;const X=new Map;for(const T of y){O+=T.totalCost,A+=T.totalTokens,L+=T.inputTokens+T.outputTokens,H+=T.cacheReadTokens;for(const K of T.modelBreakdowns)X.set(K.modelName,(X.get(K.modelName)??0)+K.cost)}return{totalCost:O,totalTok:A,inOut:L,cacheRead:H,modelCosts:X}},[y]),C=b.useMemo(()=>Array.from(j.entries()).sort((O,A)=>A[1]-O[1]),[j]),M=b.useMemo(()=>fR(y),[y]),$=M.length>1,I=a?y.find(O=>O.period===a)??null:null;return c.jsx("div",{className:"uh-backdrop",onClick:e,role:"presentation",children:c.jsxs("div",{ref:h,className:"uh-modal",onClick:O=>O.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Usage history",children:[c.jsxs("header",{className:"uh-head",children:[c.jsxs("div",{className:"uh-titlewrap",children:[c.jsx("div",{className:"uh-title",children:"Usage history"}),c.jsx("div",{className:"uh-sub",children:IF(t,M.map(O=>O.id))})]}),c.jsx("div",{className:"uh-range",role:"group","aria-label":"Range",children:qF.map(O=>c.jsxs("button",{type:"button","aria-pressed":n===O,className:"uh-range-btn",onClick:()=>{s(O),i(null)},children:[O,"d"]},O))}),c.jsx("button",{className:"glyph-btn uh-reload",onClick:f,...cr(d),title:"Re-run ccusage","aria-label":"Reload",children:d?"…":"↻"}),c.jsx("button",{ref:p,className:"glyph-btn uh-close",onClick:e,"aria-label":"Close",children:"×"})]}),g.phase==="busy"?c.jsxs("div",{className:"uh-status uh-status-wait","aria-busy":"true",children:[c.jsx("span",{className:"uh-wait-word",children:l?"running ccusage…":"running ccusage… (first run downloads the package)"}),c.jsx("span",{className:"uh-wait-axis","aria-hidden":!0})]}):g.phase==="error"?c.jsxs("div",{className:"uh-status uh-err",title:Xo(l.resp)||void 0,children:[mD(l.resp,"ccusage did not report usage"),c.jsx("div",{children:c.jsx("button",{className:"btn uh-retry",onClick:f,...cr(d),children:d?"trying…":"Try again"})})]}):g.phase==="empty"?c.jsx("div",{className:`uh-status${g.stale?" uh-stale":""}`,"aria-busy":g.stale||void 0,children:"no usage in this range"}):c.jsxs("div",{className:g.stale?"uh-stale":void 0,"aria-busy":g.stale||void 0,children:[c.jsxs("div",{className:"uh-totals",children:[c.jsx(ku,{label:"total cost",val:Je(k),accent:!0}),c.jsx(ku,{label:"tokens",val:At(N)}),c.jsx(ku,{label:"input+output",val:At(_)}),c.jsx(ku,{label:"cache reads",val:At(E)})]}),$&&c.jsxs("div",{className:"uh-agents",role:"group","aria-label":"Cost by CLI",children:[c.jsx("div",{className:"uh-agent-bar","aria-hidden":"true",children:M.map(O=>c.jsx("span",{className:"uh-agent-seg",style:{width:`${k>0?O.cost/k*100:0}%`,background:d1(O.id)}},O.id))}),c.jsx("div",{className:"uh-agent-keys",children:M.map(O=>c.jsxs("span",{className:"uh-agent-key",title:`${O.id} · ${At(O.tokens)} tokens`,children:[c.jsx("span",{className:"uh-legend-dot",style:{background:d1(O.id)}}),n0(O.id),c.jsx("span",{className:"uh-agent-cost",children:Je(O.cost)}),c.jsx("span",{className:"uh-agent-share",children:LF(O.cost,k)})]},O.id))})]}),c.jsx("div",{ref:S,className:"uh-chart",role:"group","aria-label":"Daily cost by model",children:y.map((O,A)=>{const L=w>0?O.totalCost/w*100:0,H=O.period===a,X=`${O.period}, ${Je(O.totalCost)}`;return c.jsxs("button",{className:`uh-bar-col${H?" sel":""}`,onClick:()=>i(H?null:O.period),"aria-pressed":H,"aria-label":X,title:`${O.period} · ${Je(O.totalCost)}`,style:{flexBasis:`${100/y.length}%`,"--uh-i":A,"--uh-step":`${Math.min(10,200/Math.max(y.length,1))}ms`},children:[c.jsx("div",{className:"uh-bar",style:{height:`${Math.max(L,O.totalCost>0?2:0)}%`},children:O.modelBreakdowns.slice().sort((T,K)=>K.cost-T.cost).map(T=>{const K=O.totalCost>0?T.cost/O.totalCost*100:0;return c.jsx("div",{className:"uh-bar-seg",style:{height:`${K}%`,background:bu(T.modelName)}},T.modelName)})}),c.jsx("span",{className:"uh-bar-label",children:O.period.slice(5)})]},O.period)})}),c.jsx("div",{className:"uh-legend",children:C.map(([O,A])=>c.jsxs("span",{className:"uh-legend-item",title:O,children:[c.jsx("span",{className:"uh-legend-dot",style:{background:bu(O)}}),Fs(O)," ",c.jsx("span",{className:"uh-legend-cost",children:Je(A)})]},O))}),I&&c.jsxs("div",{className:"uh-detail",children:[c.jsxs("div",{className:"uh-detail-head",children:[c.jsx("span",{className:"uh-detail-date",children:I.period}),c.jsx("span",{className:"uh-detail-cost",children:Je(I.totalCost)}),(()=>{var L,H;const A=PF(I.agents)??((H=(L=I.metadata)==null?void 0:L.agents)!=null&&H.length?I.metadata.agents.join(" · "):null);return A?c.jsx("span",{className:"uh-detail-agents",title:A,children:A}):null})()]}),c.jsxs("div",{className:"uh-detail-mini",children:[c.jsx(_u,{label:"input",val:At(I.inputTokens)}),c.jsx(_u,{label:"output",val:At(I.outputTokens)}),c.jsx(_u,{label:"cache write",val:At(I.cacheCreationTokens)}),c.jsx(_u,{label:"cache read",val:At(I.cacheReadTokens)})]}),c.jsx("div",{className:"uh-detail-models",children:I.modelBreakdowns.slice().sort((O,A)=>A.cost-O.cost).map(O=>{const A=I.totalCost>0?O.cost/I.totalCost*100:0;return c.jsxs("div",{className:"uh-model-row",title:O.modelName,children:[c.jsxs("span",{className:"uh-model-name",children:[c.jsx("span",{className:"uh-legend-dot",style:{background:bu(O.modelName)}}),c.jsx("span",{className:"uh-model-label",children:Fs(O.modelName)})]}),c.jsx("span",{className:"uh-model-bar",children:c.jsx("span",{className:"uh-model-bar-fill",style:{width:`${A}%`,background:bu(O.modelName)}})}),c.jsx("span",{className:"uh-model-cost",children:Je(O.cost)})]},O.modelName)})})]})]})]})})}function ku({label:e,val:t,accent:n}){return c.jsxs("div",{className:"uh-stat",children:[c.jsx("span",{className:`uh-stat-val${n?" accent":""}`,children:t}),c.jsx("span",{className:"uh-stat-label",children:e})]})}function _u({label:e,val:t}){return c.jsxs("div",{className:"uh-ministat",children:[c.jsx("span",{className:"uh-ministat-val",children:t}),c.jsx("span",{className:"uh-ministat-label",children:e})]})}function zF(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 h1=1e4,BF=12e3;function UF({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 d=i.current;if(!d)return;const f=d.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 y=()=>{var te;if(g)return;const S=l.current;if(!S)return;const{browsers:k,findings:N,watching:_}=S,E=s["--accent"]||"#7dd3fc",j=s["--line"]||"#1f2229",C=s["--text-dim"]||"#6e727c",M=zF(s["--bg"]),$=M?42:26,I=M?.85:.65,F=a(),O=Math.min(window.devicePixelRatio||1,2),A=d.clientWidth,L=d.clientHeight;(d.width!==A*O||d.height!==L*O)&&(d.width=A*O,d.height=L*O),f.setTransform(O,0,0,O,0,0),f.clearRect(0,0,A,L);const H=A/2,X=L/2,T=Math.min(A,L)/2-6;f.strokeStyle=j,f.lineWidth=1,f.globalAlpha=M?1:.9;for(const Z of[.4,.7,1])f.beginPath(),f.arc(H,X,T*Z,0,Math.PI*2),f.stroke();f.beginPath(),f.moveTo(H-T,X),f.lineTo(H+T,X),f.moveTo(H,X-T),f.lineTo(H,X+T),f.stroke(),f.globalAlpha=1;const D=(_&&!p?F%h1/h1:0)*Math.PI*2-Math.PI/2;if(_){const Z=(te=f.createConicGradient)==null?void 0:te.call(f,D-.85,H,X);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(H,X),f.arc(H,X,T,D-.85,D),f.closePath(),f.fill()),f.strokeStyle=E,f.globalAlpha=I,f.beginPath(),f.moveTo(H,X),f.lineTo(H+Math.cos(D)*T,X+Math.sin(D)*T),f.stroke(),f.globalAlpha=1}k.forEach((Z,V)=>{const J=V/Math.max(k.length,1)*Math.PI*2-Math.PI/2,P=Z.lastReadMs===null?1:Math.min(1,(F-Z.lastReadMs)/12e4),Y=T*(.42+P*.5),de=H+Math.cos(J)*Y,U=X+Math.sin(J)*Y,z=Math.abs((D-J+Math.PI*3)%(Math.PI*2)-Math.PI),Q=_?Math.max(0,1-z/.55):0;f.beginPath(),f.arc(de,U,3+Q*1.6,0,Math.PI*2),f.fillStyle=Z.running?E:C,f.globalAlpha=Z.running?.55+Q*.45:.35,f.fill(),f.globalAlpha=1});for(const Z of N){const V=(F-Z.atMs)/BF;if(V<0||V>1)continue;const P=Math.max(0,k.findIndex(U=>U.key===Z.browser))/Math.max(k.length,1)*Math.PI*2-Math.PI/2,Y=H+Math.cos(P)*T*.6,de=X+Math.sin(P)*T*.6;f.beginPath(),f.arc(Y,de,4+V*22,0,Math.PI*2),f.strokeStyle=E,f.globalAlpha=(1-V)*.8,f.lineWidth=1.5,f.stroke(),f.globalAlpha=1}h=requestAnimationFrame(y)};return y(),()=>{g=!0,cancelAnimationFrame(h)}},[a,s]),c.jsx("canvas",{ref:i,className:"bw-radar",role:"img","aria-label":n?`Watching ${e.length} browser${e.length===1?"":"s"}`:"Not watching"})}const f1="agent-dag.browserWatch.seenMs";function WF(e,t){return e.filter(n=>n.startMs>t)}function HF(e,t,n){if(e===null)return null;const s=e+t-n;return s>0?s:null}function GF(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 pR(e){return(e??[]).filter(t=>t.installed&&t.profiles>0)}function p1(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 VF(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 YF(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 KF(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=pR(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 XF(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 QF(e){return new Date(e).toLocaleDateString(void 0,{weekday:"short",day:"numeric",month:"short"})}function m1(e){const t=Math.round((e.endMs-e.startMs)/6e4);return t<1?"":`${t} min`}function ZF({onClose:e,onSeen:t,onWatching:n,palette:s}){const a=an(e),[i,l]=b.useState(null),[d,f]=b.useState(null),[p,h]=b.useState(null),[g,y]=b.useState(!1),w=b.useRef(!1),[S,k]=b.useState(null),[N,_]=b.useState(null),[E,j]=b.useState(!1),C=b.useRef(!1),[M,$]=b.useState(!1),[I,F]=b.useState(!1),[O,A]=b.useState(!1),[L,H]=b.useState(!1),[X,T]=b.useState(!1),[K,D]=b.useState(()=>Date.now());b.useEffect(()=>{const W=setInterval(()=>D(Date.now()),1e3);return()=>clearInterval(W)},[]);const te=b.useCallback(async W=>{var le,pe;if(!(W&&!ur(w.current))){w.current=W,y(!0);try{const ge=await fetch(`/api/browser-watch${W?"?refresh=1":""}`);if(!ge.ok)throw new Error(`the deck answered ${ge.status}`);const Ne=await ge.json();l(Ne),C.current||k(((le=Ne==null?void 0:Ne.settings)==null?void 0:le.quietMinutes)??15),n(((pe=Ne==null?void 0:Ne.settings)==null?void 0:pe.enabled)===!0),f(null)}catch(ge){f(ge instanceof Error?ge.message:String(ge))}finally{w.current=!1,y(!1)}}},[n]);b.useEffect(()=>{te(!1)},[te]),b.useEffect(()=>{const W=setInterval(()=>{te(!1)},1e4);return()=>clearInterval(W)},[te]);const Z=b.useCallback(async W=>{try{await fetch("/api/browser-watch/dismiss",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({host:W.host,startMs:W.startMs})})}finally{await te(!1)}},[te]),V=b.useCallback(async W=>{C.current=!0,j(!0);try{const le=await fetch("/api/browser-watch",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(W)});if(!le.ok)throw new Error(`the deck answered ${le.status}`);await te(!1),h(null)}catch(le){h(le instanceof Error?le.message:String(le))}finally{C.current=!1,j(!1)}},[te]),J=b.useRef(t);J.current=t,b.useEffect(()=>()=>J.current(Date.now()),[]);const P=b.useMemo(()=>{const W=[];for(const le of(i==null?void 0:i.episodes)??[]){const pe=QF(le.startMs),ge=W[W.length-1];ge&&ge.label===pe?ge.episodes.push(le):W.push({label:pe,episodes:[le]})}return W},[i]),Y=pR(i==null?void 0:i.browsers),de=((i==null?void 0:i.browsers)??[]).filter(W=>!(W.installed&&W.profiles>0)),U=i?KF(i):null,z=Y.reduce((W,le)=>W+le.profiles,0),Q=i?HF(i.coverage.lastHumanMs,i.coverage.quietMs,K):null;return c.jsx("div",{className:"modal-backdrop",onClick:e,role:"presentation",children:c.jsxs("div",{ref:a,className:"modal bw-modal",onClick:W=>W.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"bw-title",children:[c.jsxs("header",{className:"modal-head",children:[c.jsxs("div",{className:"modal-title",children:[c.jsx("span",{className:"modal-tool-name",id:"bw-title",children:"Browser watch"}),c.jsx("span",{className:"modal-tool-id",children:i?`${z} ${z===1?"profile":"profiles"} · local only`:"local only"})]}),c.jsxs("div",{className:"modal-actions",children:[c.jsx("button",{className:"glyph-btn",onClick:()=>void te(!0),...cr(g),"aria-label":"Re-read every profile now",title:"Re-read every profile now",children:g?"…":"↻"}),c.jsx("button",{className:"glyph-btn",onClick:e,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),c.jsxs("div",{className:"modal-body bw-body",children:[!i&&!d&&c.jsxs("div",{className:"bw-loading",children:[c.jsx("span",{className:"bw-loading-bar","aria-hidden":!0}),c.jsx("p",{children:"Reading each browser's history. The first look copies the file, which takes a moment."})]}),d&&c.jsx("div",{className:"bw-state",children:c.jsxs("div",{className:"bw-row err",children:[c.jsx("span",{className:"bw-dot","aria-hidden":!0}),c.jsx("span",{className:"bw-row-label",children:"Could not read"}),c.jsx("span",{className:"bw-row-detail",children:d})]})}),i&&U&&c.jsx("p",{className:`bw-trouble ${U.kind}`,role:"status",children:U.text}),i&&c.jsxs("div",{className:"bw-work",children:[c.jsxs("aside",{className:"bw-side",children:[c.jsxs("section",{className:"bw-sec",children:[c.jsxs("h4",{className:"bw-sec-head",children:["Activity overview",c.jsx("button",{className:"bw-help",onClick:()=>A(W=>!W),"aria-expanded":O,"aria-label":"What the sweep and the dots mean",children:"?"})]}),c.jsxs("div",{className:"bw-glance",children:[c.jsx(UF,{browsers:Y.map(W=>{var le;return{key:W.key,name:W.name,running:W.running,lastReadMs:((le=i.profiles.find(pe=>pe.browser===W.key))==null?void 0:le.lastWrittenMs)??null}}),findings:i.episodes.slice(0,6).map(W=>({browser:W.browser??null,atMs:W.endMs})),watching:i.settings.enabled,palette:s}),c.jsx("ul",{className:"bw-counts",children:VF(Y,i.profiles).map(W=>c.jsxs("li",{children:[c.jsx("span",{className:"bw-count-n",children:W.visits.toLocaleString("en-US")}),c.jsx("span",{className:"bw-count-of",children:W.name})]},W.key))})]}),c.jsx("p",{className:"bw-since",children:"Pages a program opened, since this deck started"}),i.coverage.checkedMs>0&&c.jsxs("p",{className:"bw-since",children:["Last checked ",YF(i.coverage.checkedMs,K),i.coverage.checks>0&&c.jsxs(c.Fragment,{children:[" · ",i.coverage.checks.toLocaleString("en-US")," ",i.coverage.checks===1?"check":"checks"]})]}),Q!==null&&c.jsxs("p",{className:"bw-gate",children:["You are browsing — a program page would count in ",GF(Q)]}),O&&c.jsxs("dl",{className:"bw-key",children:[c.jsx("dt",{children:"Sweep"}),c.jsx("dd",{children:"one poll of every watched profile"}),c.jsx("dt",{children:"Dot"}),c.jsx("dd",{children:"a browser, further out the longer since it last wrote history"}),c.jsx("dt",{children:"Ring"}),c.jsx("dd",{children:"a finding, leaving the browser it came from"})]})]}),c.jsxs("section",{className:"bw-sec",children:[c.jsxs("h4",{className:"bw-sec-head",children:["Watched profiles",c.jsx("button",{className:"bw-help",onClick:()=>H(W=>!W),"aria-expanded":L,"aria-label":"What running, idle and connected to Anthropic mean",children:"?"})]}),L&&c.jsxs("dl",{className:"bw-key",children:[c.jsx("dt",{children:"Running"}),c.jsx("dd",{children:"the browser has a process on this machine right now"}),c.jsx("dt",{children:"Connected"}),c.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"})]}),c.jsx("ul",{className:"bw-profiles",children:Y.map(W=>c.jsxs("li",{children:[c.jsx("span",{className:`bw-prof-dot${W.running?" on":""}`,"aria-hidden":!0}),c.jsx("span",{className:"bw-prof-name",children:W.name}),c.jsx("span",{className:"bw-prof-state",children:W.running?"running":"idle"}),W.running&&W.relay.state==="live"&&c.jsx("span",{className:"bw-relay",children:"connected to Anthropic"})]},W.key))}),de.length>0&&c.jsxs(c.Fragment,{children:[c.jsxs("button",{className:"bw-why bw-rest-head",onClick:()=>T(W=>!W),"aria-expanded":X,children:[c.jsx("span",{className:"bw-chev","aria-hidden":!0,children:X?"▾":"▸"})," ",de.length," not watched"]}),X&&c.jsxs("p",{className:"bw-rest",children:[de.map(W=>W.name).join(", ")," — not installed, or installed and never opened, so there is no history to read."]})]})]}),i.relay&&c.jsx(JF,{relay:i.relay})]}),c.jsxs("div",{className:"bw-main",children:[c.jsxs("section",{className:"bw-findings",children:[c.jsxs("h4",{className:"bw-sec-head bw-head-row",children:["Findings",i.episodes.length>0&&c.jsxs("span",{className:"bw-feed-count",children:[i.episodes.length," ",i.episodes.length===1?"episode":"episodes"]})]}),c.jsx("div",{className:"bw-eps",children:P.length===0?c.jsxs("div",{className:"bw-empty",children:[c.jsx("p",{className:"bw-empty-head",children:"Nothing found yet"}),c.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&&c.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(W=>c.jsxs("div",{className:"bw-day",children:[c.jsx("h4",{className:"bw-sec-head",children:W.label}),W.episodes.map(le=>{const pe=`${le.host}-${le.startMs}`,ge=N===pe;return c.jsxs("div",{className:`bw-ep${ge?" open":""}`,children:[c.jsxs("div",{className:"bw-ep-row",children:[c.jsxs("button",{className:"bw-ep-head",onClick:()=>_(ge?null:pe),"aria-expanded":ge,children:[c.jsx("span",{className:"bw-chev","aria-hidden":!0,children:ge?"▾":"▸"}),c.jsx("span",{className:"bw-ep-host",children:le.host}),c.jsxs("span",{className:"bw-ep-meta",children:[XF(le),m1(le)&&c.jsxs(c.Fragment,{children:[" · ",m1(le)]})]}),c.jsxs("span",{className:"bw-ep-count",children:[le.count," ",le.count===1?"page":"pages"]})]}),c.jsx("button",{className:"glyph-btn bw-ep-x",onClick:()=>void Z(le),"aria-label":`Dismiss ${le.host}`,title:"Dismiss — it leaves this list for good, and stays in the log file",children:"×"})]}),ge&&c.jsx("ul",{className:"bw-urls",children:le.urls.map((Ne,ce)=>c.jsxs("li",{children:[c.jsx("span",{className:"bw-url-time",children:new Date(Ne.timeMs).toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit",hour12:!1})}),c.jsx("span",{className:"bw-url",children:Ne.url})]},`${Ne.url}-${Ne.timeMs}-${ce}`))})]},pe)})]},W.label))})]}),c.jsxs("section",{className:"bw-feed",children:[c.jsxs("h4",{className:"bw-sec-head bw-head-row",children:["Live activity",c.jsxs("span",{className:"bw-feed-count",children:[i.log.length," ",i.log.length===1?"event":"events"]})]}),c.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."}),c.jsx("div",{className:"bw-log","aria-live":"polite","aria-relevant":"additions",children:i.log.length===0?c.jsx("p",{className:"bw-note",children:"The deck writes a line here each time it looks at a profile."}):i.log.map(W=>c.jsxs("div",{className:`bw-log-line ${W.level}${W.parts?"":" sys"}`,children:[c.jsx("span",{className:"bw-log-time",children:new Date(W.atMs).toLocaleTimeString("en-GB",{hour12:!1})}),W.parts?c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"bw-log-browser",children:W.parts.browser}),c.jsx("span",{className:"bw-log-profile",title:W.parts.profile,children:W.parts.profile}),c.jsxs("span",{className:"bw-log-value",children:[W.parts.value,W.parts.flagged>0&&c.jsxs("span",{className:"bw-log-flag",children:[" · ",W.parts.flagged," flagged"]})]})]}):c.jsx("span",{className:"bw-log-sys",children:W.text})]},`${W.atMs}-${W.level}-${W.text}`))})]})]})]}),i&&M&&c.jsxs("div",{className:"bw-settings",children:[c.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:[c.jsx("span",{children:"Nobody browsing for"}),c.jsxs("select",{value:S??i.settings.quietMinutes,onChange:W=>{k(Number(W.target.value)),V({quietMinutes:Number(W.target.value)})},children:[c.jsx("option",{value:1,children:"1 min"}),c.jsx("option",{value:5,children:"5 min"}),c.jsx("option",{value:15,children:"15 min"}),c.jsx("option",{value:30,children:"30 min"}),c.jsx("option",{value:60,children:"60 min"})]})]}),c.jsxs("label",{children:[c.jsx("span",{children:"When it finds one"}),c.jsx("select",{value:i.settings.reaction,onChange:W=>void V({reaction:W.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(W=>c.jsx("option",{value:W,children:W==="notify"?"notify me":W==="close-tab"?"close the tab":"quit the browser"},W))})]}),c.jsxs("div",{className:"bw-settings-note",children:[c.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. ",c.jsx("strong",{children:"Usually that is your own agent doing what you asked."})]}),c.jsxs("button",{className:"bw-why",onClick:()=>F(W=>!W),"aria-expanded":I,children:[c.jsx("span",{className:"bw-chev","aria-hidden":!0,children:I?"▾":"▸"})," What Browser Watch can access"]}),I&&c.jsxs("dl",{className:"bw-access",children:[c.jsx("dt",{children:"Reads"}),c.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(),"."]}),c.jsx("dt",{children:"Keeps"}),c.jsxs("dd",{children:["Only while the switch is on, and only the episodes it flagged — never your ordinary browsing. In ",c.jsx("code",{className:"bw-path",children:i.coverage.logPath}),", with every address written in full so you can check it yourself."]}),c.jsx("dt",{children:"Sends"}),c.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."}),c.jsx("dt",{children:"Never reads"}),c.jsx("dd",{children:"Anything from before this deck started, cookies, saved passwords, page contents, or any browser profile with no history file."})]})]})]}),p&&c.jsx("div",{className:"bw-state bw-write-err",role:"alert",children:c.jsxs("div",{className:"bw-row err",children:[c.jsx("span",{className:"bw-dot","aria-hidden":!0}),c.jsx("span",{className:"bw-row-label",children:"Could not save that setting"}),c.jsxs("span",{className:"bw-row-detail",children:[p," — the switches below show what is stored, not what you pressed."]}),c.jsx("button",{className:"glyph-btn bw-write-err-x",onClick:()=>h(null),"aria-label":"Dismiss",title:"Dismiss",children:"×"})]})}),i&&c.jsxs("footer",{className:"bw-status",children:[c.jsx("span",{className:`bw-mode-dot${i.settings.enabled?" on":""}`,"aria-hidden":!0}),c.jsx("span",{className:"bw-mode-word",children:p1(i,E).word},p1(i,E).kind),c.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`}),c.jsx("button",{className:`glyph-btn bw-gear${M?" on":""}`,onClick:()=>$(W=>!W),"aria-expanded":M,"aria-label":"Settings",title:"Settings",children:c.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3","aria-hidden":!0,children:[c.jsx("circle",{cx:"7",cy:"7",r:"2.1"}),c.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"})]})}),c.jsxs("label",{className:"bw-switch",htmlFor:"bw-enabled",children:[c.jsx("span",{className:"bw-switch-label",id:"bw-enabled-label",children:"Watch browser activity"}),c.jsx("button",{id:"bw-enabled",type:"button",role:"switch","aria-checked":i.settings.enabled,"aria-labelledby":"bw-enabled-label",className:"bw-toggle",onClick:()=>void V({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:c.jsx("span",{className:"bw-toggle-knob"})})]})]})]})]})})}function JF({relay:e}){const[t,n]=b.useState(!1),[s,a]=b.useState(!1),i=e.killswitch.blocked?"unblock":"block",l=e.command[i],d=b.useCallback(async()=>{await sR(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 c.jsxs("section",{className:"bw-sec",children:[c.jsx("h4",{className:"bw-sec-head",children:"Remote control"}),c.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&&c.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=>c.jsx("code",{className:"bw-path",children:h},h))]}),c.jsxs("button",{className:"bw-why",onClick:()=>n(h=>!h),"aria-expanded":t,children:[c.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&&c.jsxs("div",{className:"bw-rc-body",children:[f.length>0&&c.jsx("dl",{className:"bw-key",children:f.map(h=>c.jsxs(b.Fragment,{children:[c.jsxs("dt",{children:[h.name,h.profile==="Default"?"":` · ${h.profile}`]}),c.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&&c.jsxs(c.Fragment,{children:[" — ",h.report.sensitiveApis.join(", ")]})]})]},`${h.browser}/${h.profile}`))}),p.length>0&&c.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&&c.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)&&c.jsxs("p",{className:"bw-rc-note",children:["Narrowing the sites in ",c.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."]}),c.jsxs("div",{className:"bw-rc-cmd",children:[c.jsx("code",{children:l.command}),c.jsx("button",{className:"btn bw-rc-copy",onClick:d,children:s?"Copied":"Copy"})]}),c.jsx("p",{className:"bw-rc-note",children:l.note})]})]})}function e6(e,t){const n=(e??[]).filter(a=>a&&typeof a.fp=="string"&&!t.has(a.fp));if(!n.length)return{request:null,waiting:0};const s=[...n].sort((a,i)=>(a.at??0)-(i.at??0));return{request:s[0],waiting:s.length-1}}function t6({request:e,waiting:t,busy:n,now:s,onAccept:a,onDecline:i,onLater:l}){const d=b.useRef(null),f=an(l,{focusRef:d}),p=Ko(n,"accept"),h=Ko(n,"dismiss");return c.jsx("div",{className:"modal-backdrop",onClick:l,role:"presentation",children:c.jsxs("div",{ref:f,className:"modal lan-ask",onClick:g=>g.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"lan-ask-title",children:[c.jsxs("header",{className:"modal-head",children:[c.jsxs("div",{className:"modal-title",children:[c.jsx("i",{className:"ap-pulse","aria-hidden":!0}),c.jsx("span",{id:"lan-ask-title",className:"modal-tool-name",children:"A deck wants to pair"})]}),c.jsx("div",{className:"modal-actions",children:c.jsx("button",{type:"button",className:"glyph-btn",onClick:l,"aria-label":"Answer later (Esc)",title:"Answer later (Esc)",children:"×"})})]}),c.jsxs("section",{className:"modal-body",children:[c.jsxs("p",{className:"lan-ask-who",children:[c.jsx("strong",{className:"lan-ask-name",children:e.name})," at ",c.jsx("code",{className:"ap-lan-code",children:e.addr})," · asked ",nR(e.at,s)]}),c.jsx("p",{className:"modal-note",children:"Paired decks repair each other's expired logins. Accept only if you know this machine — what it shares is an account, not a screen."}),c.jsxs("p",{className:"lan-ask-fp",children:["Its fingerprint is ",c.jsx("code",{className:"ap-lan-code",children:e.fp})," — it should match the one on their screen."]}),t>0&&c.jsx("p",{className:"lan-ask-more",children:t===1?"One more deck is waiting behind this one.":`${t} more decks are waiting behind this one.`}),c.jsxs("div",{className:"lan-ask-acts",children:[c.jsx("button",{type:"button",ref:d,className:"btn",disabled:h.disabled,"aria-busy":h.busy,onClick:i,title:"Nothing is shared. If that deck asks again, this comes back.",children:n==="dismiss"?"declining…":"Decline"}),c.jsx("button",{type:"button",className:"btn primary",disabled:p.disabled,"aria-busy":p.busy,onClick:a,title:"Talk to this deck from now on, and repair its expired logins with this deck's own.",children:n==="accept"?"accepting…":"Accept"})]})]})]})})}function r0(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 kf,g1;function n6(){if(g1)return kf;g1=1;function e(){this.__data__=[],this.size=0}return kf=e,kf}var _f,y1;function ri(){if(y1)return _f;y1=1;function e(t,n){return t===n||t!==t&&n!==n}return _f=e,_f}var Sf,v1;function cd(){if(v1)return Sf;v1=1;var e=ri();function t(n,s){for(var a=n.length;a--;)if(e(n[a][0],s))return a;return-1}return Sf=t,Sf}var Nf,w1;function r6(){if(w1)return Nf;w1=1;var e=cd(),t=Array.prototype,n=t.splice;function s(a){var i=this.__data__,l=e(i,a);if(l<0)return!1;var d=i.length-1;return l==d?i.pop():n.call(i,l,1),--this.size,!0}return Nf=s,Nf}var Ef,x1;function s6(){if(x1)return Ef;x1=1;var e=cd();function t(n){var s=this.__data__,a=e(s,n);return a<0?void 0:s[a][1]}return Ef=t,Ef}var jf,b1;function a6(){if(b1)return jf;b1=1;var e=cd();function t(n){return e(this.__data__,n)>-1}return jf=t,jf}var Cf,k1;function o6(){if(k1)return Cf;k1=1;var e=cd();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 Cf=t,Cf}var Tf,_1;function ud(){if(_1)return Tf;_1=1;var e=n6(),t=r6(),n=s6(),s=a6(),a=o6();function i(l){var d=-1,f=l==null?0:l.length;for(this.clear();++d<f;){var p=l[d];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,Tf=i,Tf}var Rf,S1;function i6(){if(S1)return Rf;S1=1;var e=ud();function t(){this.__data__=new e,this.size=0}return Rf=t,Rf}var Af,N1;function l6(){if(N1)return Af;N1=1;function e(t){var n=this.__data__,s=n.delete(t);return this.size=n.size,s}return Af=e,Af}var Mf,E1;function c6(){if(E1)return Mf;E1=1;function e(t){return this.__data__.get(t)}return Mf=e,Mf}var If,j1;function u6(){if(j1)return If;j1=1;function e(t){return this.__data__.has(t)}return If=e,If}var Of,C1;function mR(){if(C1)return Of;C1=1;var e=typeof ru=="object"&&ru&&ru.Object===Object&&ru;return Of=e,Of}var $f,T1;function pr(){if(T1)return $f;T1=1;var e=mR(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return $f=n,$f}var Pf,R1;function si(){if(R1)return Pf;R1=1;var e=pr(),t=e.Symbol;return Pf=t,Pf}var Lf,A1;function d6(){if(A1)return Lf;A1=1;var e=si(),t=Object.prototype,n=t.hasOwnProperty,s=t.toString,a=e?e.toStringTag:void 0;function i(l){var d=n.call(l,a),f=l[a];try{l[a]=void 0;var p=!0}catch{}var h=s.call(l);return p&&(d?l[a]=f:delete l[a]),h}return Lf=i,Lf}var qf,M1;function h6(){if(M1)return qf;M1=1;var e=Object.prototype,t=e.toString;function n(s){return t.call(s)}return qf=n,qf}var Df,I1;function Oa(){if(I1)return Df;I1=1;var e=si(),t=d6(),n=h6(),s="[object Null]",a="[object Undefined]",i=e?e.toStringTag:void 0;function l(d){return d==null?d===void 0?a:s:i&&i in Object(d)?t(d):n(d)}return Df=l,Df}var Ff,O1;function Vn(){if(O1)return Ff;O1=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return Ff=e,Ff}var zf,$1;function Hl(){if($1)return zf;$1=1;var e=Oa(),t=Vn(),n="[object AsyncFunction]",s="[object Function]",a="[object GeneratorFunction]",i="[object Proxy]";function l(d){if(!t(d))return!1;var f=e(d);return f==s||f==a||f==n||f==i}return zf=l,zf}var Bf,P1;function f6(){if(P1)return Bf;P1=1;var e=pr(),t=e["__core-js_shared__"];return Bf=t,Bf}var Uf,L1;function p6(){if(L1)return Uf;L1=1;var e=f6(),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 Uf=n,Uf}var Wf,q1;function gR(){if(q1)return Wf;q1=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 Wf=n,Wf}var Hf,D1;function m6(){if(D1)return Hf;D1=1;var e=Hl(),t=p6(),n=Vn(),s=gR(),a=/[\\^$.*+?()[\]{}|]/g,i=/^\[object .+?Constructor\]$/,l=Function.prototype,d=Object.prototype,f=l.toString,p=d.hasOwnProperty,h=RegExp("^"+f.call(p).replace(a,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function g(y){if(!n(y)||t(y))return!1;var w=e(y)?h:i;return w.test(s(y))}return Hf=g,Hf}var Gf,F1;function g6(){if(F1)return Gf;F1=1;function e(t,n){return t==null?void 0:t[n]}return Gf=e,Gf}var Vf,z1;function $a(){if(z1)return Vf;z1=1;var e=m6(),t=g6();function n(s,a){var i=t(s,a);return e(i)?i:void 0}return Vf=n,Vf}var Yf,B1;function s0(){if(B1)return Yf;B1=1;var e=$a(),t=pr(),n=e(t,"Map");return Yf=n,Yf}var Kf,U1;function dd(){if(U1)return Kf;U1=1;var e=$a(),t=e(Object,"create");return Kf=t,Kf}var Xf,W1;function y6(){if(W1)return Xf;W1=1;var e=dd();function t(){this.__data__=e?e(null):{},this.size=0}return Xf=t,Xf}var Qf,H1;function v6(){if(H1)return Qf;H1=1;function e(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}return Qf=e,Qf}var Zf,G1;function w6(){if(G1)return Zf;G1=1;var e=dd(),t="__lodash_hash_undefined__",n=Object.prototype,s=n.hasOwnProperty;function a(i){var l=this.__data__;if(e){var d=l[i];return d===t?void 0:d}return s.call(l,i)?l[i]:void 0}return Zf=a,Zf}var Jf,V1;function x6(){if(V1)return Jf;V1=1;var e=dd(),t=Object.prototype,n=t.hasOwnProperty;function s(a){var i=this.__data__;return e?i[a]!==void 0:n.call(i,a)}return Jf=s,Jf}var ep,Y1;function b6(){if(Y1)return ep;Y1=1;var e=dd(),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 ep=n,ep}var tp,K1;function k6(){if(K1)return tp;K1=1;var e=y6(),t=v6(),n=w6(),s=x6(),a=b6();function i(l){var d=-1,f=l==null?0:l.length;for(this.clear();++d<f;){var p=l[d];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,tp=i,tp}var np,X1;function _6(){if(X1)return np;X1=1;var e=k6(),t=ud(),n=s0();function s(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return np=s,np}var rp,Q1;function S6(){if(Q1)return rp;Q1=1;function e(t){var n=typeof t;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?t!=="__proto__":t===null}return rp=e,rp}var sp,Z1;function hd(){if(Z1)return sp;Z1=1;var e=S6();function t(n,s){var a=n.__data__;return e(s)?a[typeof s=="string"?"string":"hash"]:a.map}return sp=t,sp}var ap,J1;function N6(){if(J1)return ap;J1=1;var e=hd();function t(n){var s=e(this,n).delete(n);return this.size-=s?1:0,s}return ap=t,ap}var op,e_;function E6(){if(e_)return op;e_=1;var e=hd();function t(n){return e(this,n).get(n)}return op=t,op}var ip,t_;function j6(){if(t_)return ip;t_=1;var e=hd();function t(n){return e(this,n).has(n)}return ip=t,ip}var lp,n_;function C6(){if(n_)return lp;n_=1;var e=hd();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 lp=t,lp}var cp,r_;function a0(){if(r_)return cp;r_=1;var e=_6(),t=N6(),n=E6(),s=j6(),a=C6();function i(l){var d=-1,f=l==null?0:l.length;for(this.clear();++d<f;){var p=l[d];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,cp=i,cp}var up,s_;function T6(){if(s_)return up;s_=1;var e=ud(),t=s0(),n=a0(),s=200;function a(i,l){var d=this.__data__;if(d instanceof e){var f=d.__data__;if(!t||f.length<s-1)return f.push([i,l]),this.size=++d.size,this;d=this.__data__=new n(f)}return d.set(i,l),this.size=d.size,this}return up=a,up}var dp,a_;function fd(){if(a_)return dp;a_=1;var e=ud(),t=i6(),n=l6(),s=c6(),a=u6(),i=T6();function l(d){var f=this.__data__=new e(d);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,dp=l,dp}var hp,o_;function o0(){if(o_)return hp;o_=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 hp=e,hp}var fp,i_;function yR(){if(i_)return fp;i_=1;var e=$a(),t=(function(){try{var n=e(Object,"defineProperty");return n({},"",{}),n}catch{}})();return fp=t,fp}var pp,l_;function pd(){if(l_)return pp;l_=1;var e=yR();function t(n,s,a){s=="__proto__"&&e?e(n,s,{configurable:!0,enumerable:!0,value:a,writable:!0}):n[s]=a}return pp=t,pp}var mp,c_;function md(){if(c_)return mp;c_=1;var e=pd(),t=ri(),n=Object.prototype,s=n.hasOwnProperty;function a(i,l,d){var f=i[l];(!(s.call(i,l)&&t(f,d))||d===void 0&&!(l in i))&&e(i,l,d)}return mp=a,mp}var gp,u_;function Gl(){if(u_)return gp;u_=1;var e=md(),t=pd();function n(s,a,i,l){var d=!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]),d?t(i,h,g):e(i,h,g)}return i}return gp=n,gp}var yp,d_;function R6(){if(d_)return yp;d_=1;function e(t,n){for(var s=-1,a=Array(t);++s<t;)a[s]=n(s);return a}return yp=e,yp}var vp,h_;function Tr(){if(h_)return vp;h_=1;function e(t){return t!=null&&typeof t=="object"}return vp=e,vp}var wp,f_;function A6(){if(f_)return wp;f_=1;var e=Oa(),t=Tr(),n="[object Arguments]";function s(a){return t(a)&&e(a)==n}return wp=s,wp}var xp,p_;function Vl(){if(p_)return xp;p_=1;var e=A6(),t=Tr(),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 xp=i,xp}var bp,m_;function It(){if(m_)return bp;m_=1;var e=Array.isArray;return bp=e,bp}var gl={exports:{}},kp,g_;function M6(){if(g_)return kp;g_=1;function e(){return!1}return kp=e,kp}gl.exports;var y_;function ai(){return y_||(y_=1,(function(e,t){var n=pr(),s=M6(),a=t&&!t.nodeType&&t,i=a&&!0&&e&&!e.nodeType&&e,l=i&&i.exports===a,d=l?n.Buffer:void 0,f=d?d.isBuffer:void 0,p=f||s;e.exports=p})(gl,gl.exports)),gl.exports}var _p,v_;function gd(){if(v_)return _p;v_=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 _p=n,_p}var Sp,w_;function i0(){if(w_)return Sp;w_=1;var e=9007199254740991;function t(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=e}return Sp=t,Sp}var Np,x_;function I6(){if(x_)return Np;x_=1;var e=Oa(),t=i0(),n=Tr(),s="[object Arguments]",a="[object Array]",i="[object Boolean]",l="[object Date]",d="[object Error]",f="[object Function]",p="[object Map]",h="[object Number]",g="[object Object]",y="[object RegExp]",w="[object Set]",S="[object String]",k="[object WeakMap]",N="[object ArrayBuffer]",_="[object DataView]",E="[object Float32Array]",j="[object Float64Array]",C="[object Int8Array]",M="[object Int16Array]",$="[object Int32Array]",I="[object Uint8Array]",F="[object Uint8ClampedArray]",O="[object Uint16Array]",A="[object Uint32Array]",L={};L[E]=L[j]=L[C]=L[M]=L[$]=L[I]=L[F]=L[O]=L[A]=!0,L[s]=L[a]=L[N]=L[i]=L[_]=L[l]=L[d]=L[f]=L[p]=L[h]=L[g]=L[y]=L[w]=L[S]=L[k]=!1;function H(X){return n(X)&&t(X.length)&&!!L[e(X)]}return Np=H,Np}var Ep,b_;function yd(){if(b_)return Ep;b_=1;function e(t){return function(n){return t(n)}}return Ep=e,Ep}var yl={exports:{}};yl.exports;var k_;function l0(){return k_||(k_=1,(function(e,t){var n=mR(),s=t&&!t.nodeType&&t,a=s&&!0&&e&&!e.nodeType&&e,i=a&&a.exports===s,l=i&&n.process,d=(function(){try{var f=a&&a.require&&a.require("util").types;return f||l&&l.binding&&l.binding("util")}catch{}})();e.exports=d})(yl,yl.exports)),yl.exports}var jp,__;function Yl(){if(__)return jp;__=1;var e=I6(),t=yd(),n=l0(),s=n&&n.isTypedArray,a=s?t(s):e;return jp=a,jp}var Cp,S_;function vR(){if(S_)return Cp;S_=1;var e=R6(),t=Vl(),n=It(),s=ai(),a=gd(),i=Yl(),l=Object.prototype,d=l.hasOwnProperty;function f(p,h){var g=n(p),y=!g&&t(p),w=!g&&!y&&s(p),S=!g&&!y&&!w&&i(p),k=g||y||w||S,N=k?e(p.length,String):[],_=N.length;for(var E in p)(h||d.call(p,E))&&!(k&&(E=="length"||w&&(E=="offset"||E=="parent")||S&&(E=="buffer"||E=="byteLength"||E=="byteOffset")||a(E,_)))&&N.push(E);return N}return Cp=f,Cp}var Tp,N_;function vd(){if(N_)return Tp;N_=1;var e=Object.prototype;function t(n){var s=n&&n.constructor,a=typeof s=="function"&&s.prototype||e;return n===a}return Tp=t,Tp}var Rp,E_;function wR(){if(E_)return Rp;E_=1;function e(t,n){return function(s){return t(n(s))}}return Rp=e,Rp}var Ap,j_;function O6(){if(j_)return Ap;j_=1;var e=wR(),t=e(Object.keys,Object);return Ap=t,Ap}var Mp,C_;function c0(){if(C_)return Mp;C_=1;var e=vd(),t=O6(),n=Object.prototype,s=n.hasOwnProperty;function a(i){if(!e(i))return t(i);var l=[];for(var d in Object(i))s.call(i,d)&&d!="constructor"&&l.push(d);return l}return Mp=a,Mp}var Ip,T_;function as(){if(T_)return Ip;T_=1;var e=Hl(),t=i0();function n(s){return s!=null&&t(s.length)&&!e(s)}return Ip=n,Ip}var Op,R_;function zs(){if(R_)return Op;R_=1;var e=vR(),t=c0(),n=as();function s(a){return n(a)?e(a):t(a)}return Op=s,Op}var $p,A_;function $6(){if(A_)return $p;A_=1;var e=Gl(),t=zs();function n(s,a){return s&&e(a,t(a),s)}return $p=n,$p}var Pp,M_;function P6(){if(M_)return Pp;M_=1;function e(t){var n=[];if(t!=null)for(var s in Object(t))n.push(s);return n}return Pp=e,Pp}var Lp,I_;function L6(){if(I_)return Lp;I_=1;var e=Vn(),t=vd(),n=P6(),s=Object.prototype,a=s.hasOwnProperty;function i(l){if(!e(l))return n(l);var d=t(l),f=[];for(var p in l)p=="constructor"&&(d||!a.call(l,p))||f.push(p);return f}return Lp=i,Lp}var qp,O_;function Pa(){if(O_)return qp;O_=1;var e=vR(),t=L6(),n=as();function s(a){return n(a)?e(a,!0):t(a)}return qp=s,qp}var Dp,$_;function q6(){if($_)return Dp;$_=1;var e=Gl(),t=Pa();function n(s,a){return s&&e(a,t(a),s)}return Dp=n,Dp}var vl={exports:{}};vl.exports;var P_;function xR(){return P_||(P_=1,(function(e,t){var n=pr(),s=t&&!t.nodeType&&t,a=s&&!0&&e&&!e.nodeType&&e,i=a&&a.exports===s,l=i?n.Buffer:void 0,d=l?l.allocUnsafe:void 0;function f(p,h){if(h)return p.slice();var g=p.length,y=d?d(g):new p.constructor(g);return p.copy(y),y}e.exports=f})(vl,vl.exports)),vl.exports}var Fp,L_;function bR(){if(L_)return Fp;L_=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 Fp=e,Fp}var zp,q_;function kR(){if(q_)return zp;q_=1;function e(t,n){for(var s=-1,a=t==null?0:t.length,i=0,l=[];++s<a;){var d=t[s];n(d,s,t)&&(l[i++]=d)}return l}return zp=e,zp}var Bp,D_;function _R(){if(D_)return Bp;D_=1;function e(){return[]}return Bp=e,Bp}var Up,F_;function u0(){if(F_)return Up;F_=1;var e=kR(),t=_R(),n=Object.prototype,s=n.propertyIsEnumerable,a=Object.getOwnPropertySymbols,i=a?function(l){return l==null?[]:(l=Object(l),e(a(l),function(d){return s.call(l,d)}))}:t;return Up=i,Up}var Wp,z_;function D6(){if(z_)return Wp;z_=1;var e=Gl(),t=u0();function n(s,a){return e(s,t(s),a)}return Wp=n,Wp}var Hp,B_;function d0(){if(B_)return Hp;B_=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 Hp=e,Hp}var Gp,U_;function wd(){if(U_)return Gp;U_=1;var e=wR(),t=e(Object.getPrototypeOf,Object);return Gp=t,Gp}var Vp,W_;function SR(){if(W_)return Vp;W_=1;var e=d0(),t=wd(),n=u0(),s=_R(),a=Object.getOwnPropertySymbols,i=a?function(l){for(var d=[];l;)e(d,n(l)),l=t(l);return d}:s;return Vp=i,Vp}var Yp,H_;function F6(){if(H_)return Yp;H_=1;var e=Gl(),t=SR();function n(s,a){return e(s,t(s),a)}return Yp=n,Yp}var Kp,G_;function NR(){if(G_)return Kp;G_=1;var e=d0(),t=It();function n(s,a,i){var l=a(s);return t(s)?l:e(l,i(s))}return Kp=n,Kp}var Xp,V_;function ER(){if(V_)return Xp;V_=1;var e=NR(),t=u0(),n=zs();function s(a){return e(a,n,t)}return Xp=s,Xp}var Qp,Y_;function z6(){if(Y_)return Qp;Y_=1;var e=NR(),t=SR(),n=Pa();function s(a){return e(a,n,t)}return Qp=s,Qp}var Zp,K_;function B6(){if(K_)return Zp;K_=1;var e=$a(),t=pr(),n=e(t,"DataView");return Zp=n,Zp}var Jp,X_;function U6(){if(X_)return Jp;X_=1;var e=$a(),t=pr(),n=e(t,"Promise");return Jp=n,Jp}var em,Q_;function jR(){if(Q_)return em;Q_=1;var e=$a(),t=pr(),n=e(t,"Set");return em=n,em}var tm,Z_;function W6(){if(Z_)return tm;Z_=1;var e=$a(),t=pr(),n=e(t,"WeakMap");return tm=n,tm}var nm,J_;function oi(){if(J_)return nm;J_=1;var e=B6(),t=s0(),n=U6(),s=jR(),a=W6(),i=Oa(),l=gR(),d="[object Map]",f="[object Object]",p="[object Promise]",h="[object Set]",g="[object WeakMap]",y="[object DataView]",w=l(e),S=l(t),k=l(n),N=l(s),_=l(a),E=i;return(e&&E(new e(new ArrayBuffer(1)))!=y||t&&E(new t)!=d||n&&E(n.resolve())!=p||s&&E(new s)!=h||a&&E(new a)!=g)&&(E=function(j){var C=i(j),M=C==f?j.constructor:void 0,$=M?l(M):"";if($)switch($){case w:return y;case S:return d;case k:return p;case N:return h;case _:return g}return C}),nm=E,nm}var rm,eS;function H6(){if(eS)return rm;eS=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 rm=n,rm}var sm,tS;function CR(){if(tS)return sm;tS=1;var e=pr(),t=e.Uint8Array;return sm=t,sm}var am,nS;function h0(){if(nS)return am;nS=1;var e=CR();function t(n){var s=new n.constructor(n.byteLength);return new e(s).set(new e(n)),s}return am=t,am}var om,rS;function G6(){if(rS)return om;rS=1;var e=h0();function t(n,s){var a=s?e(n.buffer):n.buffer;return new n.constructor(a,n.byteOffset,n.byteLength)}return om=t,om}var im,sS;function V6(){if(sS)return im;sS=1;var e=/\w*$/;function t(n){var s=new n.constructor(n.source,e.exec(n));return s.lastIndex=n.lastIndex,s}return im=t,im}var lm,aS;function Y6(){if(aS)return lm;aS=1;var e=si(),t=e?e.prototype:void 0,n=t?t.valueOf:void 0;function s(a){return n?Object(n.call(a)):{}}return lm=s,lm}var cm,oS;function TR(){if(oS)return cm;oS=1;var e=h0();function t(n,s){var a=s?e(n.buffer):n.buffer;return new n.constructor(a,n.byteOffset,n.length)}return cm=t,cm}var um,iS;function K6(){if(iS)return um;iS=1;var e=h0(),t=G6(),n=V6(),s=Y6(),a=TR(),i="[object Boolean]",l="[object Date]",d="[object Map]",f="[object Number]",p="[object RegExp]",h="[object Set]",g="[object String]",y="[object Symbol]",w="[object ArrayBuffer]",S="[object DataView]",k="[object Float32Array]",N="[object Float64Array]",_="[object Int8Array]",E="[object Int16Array]",j="[object Int32Array]",C="[object Uint8Array]",M="[object Uint8ClampedArray]",$="[object Uint16Array]",I="[object Uint32Array]";function F(O,A,L){var H=O.constructor;switch(A){case w:return e(O);case i:case l:return new H(+O);case S:return t(O,L);case k:case N:case _:case E:case j:case C:case M:case $:case I:return a(O,L);case d:return new H;case f:case g:return new H(O);case p:return n(O);case h:return new H;case y:return s(O)}}return um=F,um}var dm,lS;function RR(){if(lS)return dm;lS=1;var e=Vn(),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 dm=n,dm}var hm,cS;function AR(){if(cS)return hm;cS=1;var e=RR(),t=wd(),n=vd();function s(a){return typeof a.constructor=="function"&&!n(a)?e(t(a)):{}}return hm=s,hm}var fm,uS;function X6(){if(uS)return fm;uS=1;var e=oi(),t=Tr(),n="[object Map]";function s(a){return t(a)&&e(a)==n}return fm=s,fm}var pm,dS;function Q6(){if(dS)return pm;dS=1;var e=X6(),t=yd(),n=l0(),s=n&&n.isMap,a=s?t(s):e;return pm=a,pm}var mm,hS;function Z6(){if(hS)return mm;hS=1;var e=oi(),t=Tr(),n="[object Set]";function s(a){return t(a)&&e(a)==n}return mm=s,mm}var gm,fS;function J6(){if(fS)return gm;fS=1;var e=Z6(),t=yd(),n=l0(),s=n&&n.isSet,a=s?t(s):e;return gm=a,gm}var ym,pS;function MR(){if(pS)return ym;pS=1;var e=fd(),t=o0(),n=md(),s=$6(),a=q6(),i=xR(),l=bR(),d=D6(),f=F6(),p=ER(),h=z6(),g=oi(),y=H6(),w=K6(),S=AR(),k=It(),N=ai(),_=Q6(),E=Vn(),j=J6(),C=zs(),M=Pa(),$=1,I=2,F=4,O="[object Arguments]",A="[object Array]",L="[object Boolean]",H="[object Date]",X="[object Error]",T="[object Function]",K="[object GeneratorFunction]",D="[object Map]",te="[object Number]",Z="[object Object]",V="[object RegExp]",J="[object Set]",P="[object String]",Y="[object Symbol]",de="[object WeakMap]",U="[object ArrayBuffer]",z="[object DataView]",Q="[object Float32Array]",W="[object Float64Array]",le="[object Int8Array]",pe="[object Int16Array]",ge="[object Int32Array]",Ne="[object Uint8Array]",ce="[object Uint8ClampedArray]",we="[object Uint16Array]",Ce="[object Uint32Array]",_e={};_e[O]=_e[A]=_e[U]=_e[z]=_e[L]=_e[H]=_e[Q]=_e[W]=_e[le]=_e[pe]=_e[ge]=_e[D]=_e[te]=_e[Z]=_e[V]=_e[J]=_e[P]=_e[Y]=_e[Ne]=_e[ce]=_e[we]=_e[Ce]=!0,_e[X]=_e[T]=_e[de]=!1;function We(Se,re,Qe,ft,ut,at){var Ye,me=re&$,be=re&I,De=re&F;if(Qe&&(Ye=ut?Qe(Se,ft,ut,at):Qe(Se)),Ye!==void 0)return Ye;if(!E(Se))return Se;var He=k(Se);if(He){if(Ye=y(Se),!me)return l(Se,Ye)}else{var ot=g(Se),Le=ot==T||ot==K;if(N(Se))return i(Se,me);if(ot==Z||ot==O||Le&&!ut){if(Ye=be||Le?{}:S(Se),!me)return be?f(Se,a(Ye,Se)):d(Se,s(Ye,Se))}else{if(!_e[ot])return ut?Se:{};Ye=w(Se,ot,me)}}at||(at=new e);var se=at.get(Se);if(se)return se;at.set(Se,Ye),j(Se)?Se.forEach(function(Ee){Ye.add(We(Ee,re,Qe,Ee,Se,at))}):_(Se)&&Se.forEach(function(Ee,Ue){Ye.set(Ue,We(Ee,re,Qe,Ue,Se,at))});var je=De?be?h:p:be?M:C,Fe=He?void 0:je(Se);return t(Fe||Se,function(Ee,Ue){Fe&&(Ue=Ee,Ee=Se[Ue]),n(Ye,Ue,We(Ee,re,Qe,Ue,Se,at))}),Ye}return ym=We,ym}var vm,mS;function ez(){if(mS)return vm;mS=1;var e=MR(),t=4;function n(s){return e(s,t)}return vm=n,vm}var wm,gS;function f0(){if(gS)return wm;gS=1;function e(t){return function(){return t}}return wm=e,wm}var xm,yS;function tz(){if(yS)return xm;yS=1;function e(t){return function(n,s,a){for(var i=-1,l=Object(n),d=a(n),f=d.length;f--;){var p=d[t?f:++i];if(s(l[p],p,l)===!1)break}return n}}return xm=e,xm}var bm,vS;function p0(){if(vS)return bm;vS=1;var e=tz(),t=e();return bm=t,bm}var km,wS;function m0(){if(wS)return km;wS=1;var e=p0(),t=zs();function n(s,a){return s&&e(s,a,t)}return km=n,km}var _m,xS;function nz(){if(xS)return _m;xS=1;var e=as();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,d=s?l:-1,f=Object(a);(s?d--:++d<l)&&i(f[d],d,f)!==!1;);return a}}return _m=t,_m}var Sm,bS;function xd(){if(bS)return Sm;bS=1;var e=m0(),t=nz(),n=t(e);return Sm=n,Sm}var Nm,kS;function La(){if(kS)return Nm;kS=1;function e(t){return t}return Nm=e,Nm}var Em,_S;function IR(){if(_S)return Em;_S=1;var e=La();function t(n){return typeof n=="function"?n:e}return Em=t,Em}var jm,SS;function OR(){if(SS)return jm;SS=1;var e=o0(),t=xd(),n=IR(),s=It();function a(i,l){var d=s(i)?e:t;return d(i,n(l))}return jm=a,jm}var Cm,NS;function $R(){return NS||(NS=1,Cm=OR()),Cm}var Tm,ES;function rz(){if(ES)return Tm;ES=1;var e=xd();function t(n,s){var a=[];return e(n,function(i,l,d){s(i,l,d)&&a.push(i)}),a}return Tm=t,Tm}var Rm,jS;function sz(){if(jS)return Rm;jS=1;var e="__lodash_hash_undefined__";function t(n){return this.__data__.set(n,e),this}return Rm=t,Rm}var Am,CS;function az(){if(CS)return Am;CS=1;function e(t){return this.__data__.has(t)}return Am=e,Am}var Mm,TS;function PR(){if(TS)return Mm;TS=1;var e=a0(),t=sz(),n=az();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,Mm=s,Mm}var Im,RS;function oz(){if(RS)return Im;RS=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 Im=e,Im}var Om,AS;function LR(){if(AS)return Om;AS=1;function e(t,n){return t.has(n)}return Om=e,Om}var $m,MS;function qR(){if(MS)return $m;MS=1;var e=PR(),t=oz(),n=LR(),s=1,a=2;function i(l,d,f,p,h,g){var y=f&s,w=l.length,S=d.length;if(w!=S&&!(y&&S>w))return!1;var k=g.get(l),N=g.get(d);if(k&&N)return k==d&&N==l;var _=-1,E=!0,j=f&a?new e:void 0;for(g.set(l,d),g.set(d,l);++_<w;){var C=l[_],M=d[_];if(p)var $=y?p(M,C,_,d,l,g):p(C,M,_,l,d,g);if($!==void 0){if($)continue;E=!1;break}if(j){if(!t(d,function(I,F){if(!n(j,F)&&(C===I||h(C,I,f,p,g)))return j.push(F)})){E=!1;break}}else if(!(C===M||h(C,M,f,p,g))){E=!1;break}}return g.delete(l),g.delete(d),E}return $m=i,$m}var Pm,IS;function iz(){if(IS)return Pm;IS=1;function e(t){var n=-1,s=Array(t.size);return t.forEach(function(a,i){s[++n]=[i,a]}),s}return Pm=e,Pm}var Lm,OS;function g0(){if(OS)return Lm;OS=1;function e(t){var n=-1,s=Array(t.size);return t.forEach(function(a){s[++n]=a}),s}return Lm=e,Lm}var qm,$S;function lz(){if($S)return qm;$S=1;var e=si(),t=CR(),n=ri(),s=qR(),a=iz(),i=g0(),l=1,d=2,f="[object Boolean]",p="[object Date]",h="[object Error]",g="[object Map]",y="[object Number]",w="[object RegExp]",S="[object Set]",k="[object String]",N="[object Symbol]",_="[object ArrayBuffer]",E="[object DataView]",j=e?e.prototype:void 0,C=j?j.valueOf:void 0;function M($,I,F,O,A,L,H){switch(F){case E:if($.byteLength!=I.byteLength||$.byteOffset!=I.byteOffset)return!1;$=$.buffer,I=I.buffer;case _:return!($.byteLength!=I.byteLength||!L(new t($),new t(I)));case f:case p:case y:return n(+$,+I);case h:return $.name==I.name&&$.message==I.message;case w:case k:return $==I+"";case g:var X=a;case S:var T=O&l;if(X||(X=i),$.size!=I.size&&!T)return!1;var K=H.get($);if(K)return K==I;O|=d,H.set($,I);var D=s(X($),X(I),O,A,L,H);return H.delete($),D;case N:if(C)return C.call($)==C.call(I)}return!1}return qm=M,qm}var Dm,PS;function cz(){if(PS)return Dm;PS=1;var e=ER(),t=1,n=Object.prototype,s=n.hasOwnProperty;function a(i,l,d,f,p,h){var g=d&t,y=e(i),w=y.length,S=e(l),k=S.length;if(w!=k&&!g)return!1;for(var N=w;N--;){var _=y[N];if(!(g?_ in l:s.call(l,_)))return!1}var E=h.get(i),j=h.get(l);if(E&&j)return E==l&&j==i;var C=!0;h.set(i,l),h.set(l,i);for(var M=g;++N<w;){_=y[N];var $=i[_],I=l[_];if(f)var F=g?f(I,$,_,l,i,h):f($,I,_,i,l,h);if(!(F===void 0?$===I||p($,I,d,f,h):F)){C=!1;break}M||(M=_=="constructor")}if(C&&!M){var O=i.constructor,A=l.constructor;O!=A&&"constructor"in i&&"constructor"in l&&!(typeof O=="function"&&O instanceof O&&typeof A=="function"&&A instanceof A)&&(C=!1)}return h.delete(i),h.delete(l),C}return Dm=a,Dm}var Fm,LS;function uz(){if(LS)return Fm;LS=1;var e=fd(),t=qR(),n=lz(),s=cz(),a=oi(),i=It(),l=ai(),d=Yl(),f=1,p="[object Arguments]",h="[object Array]",g="[object Object]",y=Object.prototype,w=y.hasOwnProperty;function S(k,N,_,E,j,C){var M=i(k),$=i(N),I=M?h:a(k),F=$?h:a(N);I=I==p?g:I,F=F==p?g:F;var O=I==g,A=F==g,L=I==F;if(L&&l(k)){if(!l(N))return!1;M=!0,O=!1}if(L&&!O)return C||(C=new e),M||d(k)?t(k,N,_,E,j,C):n(k,N,I,_,E,j,C);if(!(_&f)){var H=O&&w.call(k,"__wrapped__"),X=A&&w.call(N,"__wrapped__");if(H||X){var T=H?k.value():k,K=X?N.value():N;return C||(C=new e),j(T,K,_,E,C)}}return L?(C||(C=new e),s(k,N,_,E,j,C)):!1}return Fm=S,Fm}var zm,qS;function DR(){if(qS)return zm;qS=1;var e=uz(),t=Tr();function n(s,a,i,l,d){return s===a?!0:s==null||a==null||!t(s)&&!t(a)?s!==s&&a!==a:e(s,a,i,l,n,d)}return zm=n,zm}var Bm,DS;function dz(){if(DS)return Bm;DS=1;var e=fd(),t=DR(),n=1,s=2;function a(i,l,d,f){var p=d.length,h=p,g=!f;if(i==null)return!h;for(i=Object(i);p--;){var y=d[p];if(g&&y[2]?y[1]!==i[y[0]]:!(y[0]in i))return!1}for(;++p<h;){y=d[p];var w=y[0],S=i[w],k=y[1];if(g&&y[2]){if(S===void 0&&!(w in i))return!1}else{var N=new e;if(f)var _=f(S,k,w,i,l,N);if(!(_===void 0?t(k,S,n|s,f,N):_))return!1}}return!0}return Bm=a,Bm}var Um,FS;function FR(){if(FS)return Um;FS=1;var e=Vn();function t(n){return n===n&&!e(n)}return Um=t,Um}var Wm,zS;function hz(){if(zS)return Wm;zS=1;var e=FR(),t=zs();function n(s){for(var a=t(s),i=a.length;i--;){var l=a[i],d=s[l];a[i]=[l,d,e(d)]}return a}return Wm=n,Wm}var Hm,BS;function zR(){if(BS)return Hm;BS=1;function e(t,n){return function(s){return s==null?!1:s[t]===n&&(n!==void 0||t in Object(s))}}return Hm=e,Hm}var Gm,US;function fz(){if(US)return Gm;US=1;var e=dz(),t=hz(),n=zR();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 Gm=s,Gm}var Vm,WS;function ii(){if(WS)return Vm;WS=1;var e=Oa(),t=Tr(),n="[object Symbol]";function s(a){return typeof a=="symbol"||t(a)&&e(a)==n}return Vm=s,Vm}var Ym,HS;function y0(){if(HS)return Ym;HS=1;var e=It(),t=ii(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,s=/^\w*$/;function a(i,l){if(e(i))return!1;var d=typeof i;return d=="number"||d=="symbol"||d=="boolean"||i==null||t(i)?!0:s.test(i)||!n.test(i)||l!=null&&i in Object(l)}return Ym=a,Ym}var Km,GS;function pz(){if(GS)return Km;GS=1;var e=a0(),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,d=a?a.apply(this,l):l[0],f=i.cache;if(f.has(d))return f.get(d);var p=s.apply(this,l);return i.cache=f.set(d,p)||f,p};return i.cache=new(n.Cache||e),i}return n.Cache=e,Km=n,Km}var Xm,VS;function mz(){if(VS)return Xm;VS=1;var e=pz(),t=500;function n(s){var a=e(s,function(l){return i.size===t&&i.clear(),l}),i=a.cache;return a}return Xm=n,Xm}var Qm,YS;function gz(){if(YS)return Qm;YS=1;var e=mz(),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,d,f,p){i.push(f?p.replace(n,"$1"):d||l)}),i});return Qm=s,Qm}var Zm,KS;function bd(){if(KS)return Zm;KS=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 Zm=e,Zm}var Jm,XS;function yz(){if(XS)return Jm;XS=1;var e=si(),t=bd(),n=It(),s=ii(),a=e?e.prototype:void 0,i=a?a.toString:void 0;function l(d){if(typeof d=="string")return d;if(n(d))return t(d,l)+"";if(s(d))return i?i.call(d):"";var f=d+"";return f=="0"&&1/d==-1/0?"-0":f}return Jm=l,Jm}var eg,QS;function BR(){if(QS)return eg;QS=1;var e=yz();function t(n){return n==null?"":e(n)}return eg=t,eg}var tg,ZS;function kd(){if(ZS)return tg;ZS=1;var e=It(),t=y0(),n=gz(),s=BR();function a(i,l){return e(i)?i:t(i,l)?[i]:n(s(i))}return tg=a,tg}var ng,JS;function Kl(){if(JS)return ng;JS=1;var e=ii();function t(n){if(typeof n=="string"||e(n))return n;var s=n+"";return s=="0"&&1/n==-1/0?"-0":s}return ng=t,ng}var rg,eN;function _d(){if(eN)return rg;eN=1;var e=kd(),t=Kl();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 rg=n,rg}var sg,tN;function vz(){if(tN)return sg;tN=1;var e=_d();function t(n,s,a){var i=n==null?void 0:e(n,s);return i===void 0?a:i}return sg=t,sg}var ag,nN;function wz(){if(nN)return ag;nN=1;function e(t,n){return t!=null&&n in Object(t)}return ag=e,ag}var og,rN;function UR(){if(rN)return og;rN=1;var e=kd(),t=Vl(),n=It(),s=gd(),a=i0(),i=Kl();function l(d,f,p){f=e(f,d);for(var h=-1,g=f.length,y=!1;++h<g;){var w=i(f[h]);if(!(y=d!=null&&p(d,w)))break;d=d[w]}return y||++h!=g?y:(g=d==null?0:d.length,!!g&&a(g)&&s(w,g)&&(n(d)||t(d)))}return og=l,og}var ig,sN;function WR(){if(sN)return ig;sN=1;var e=wz(),t=UR();function n(s,a){return s!=null&&t(s,a,e)}return ig=n,ig}var lg,aN;function xz(){if(aN)return lg;aN=1;var e=DR(),t=vz(),n=WR(),s=y0(),a=FR(),i=zR(),l=Kl(),d=1,f=2;function p(h,g){return s(h)&&a(g)?i(l(h),g):function(y){var w=t(y,h);return w===void 0&&w===g?n(y,h):e(g,w,d|f)}}return lg=p,lg}var cg,oN;function HR(){if(oN)return cg;oN=1;function e(t){return function(n){return n==null?void 0:n[t]}}return cg=e,cg}var ug,iN;function bz(){if(iN)return ug;iN=1;var e=_d();function t(n){return function(s){return e(s,n)}}return ug=t,ug}var dg,lN;function kz(){if(lN)return dg;lN=1;var e=HR(),t=bz(),n=y0(),s=Kl();function a(i){return n(i)?e(s(i)):t(i)}return dg=a,dg}var hg,cN;function os(){if(cN)return hg;cN=1;var e=fz(),t=xz(),n=La(),s=It(),a=kz();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 hg=i,hg}var fg,uN;function GR(){if(uN)return fg;uN=1;var e=kR(),t=rz(),n=os(),s=It();function a(i,l){var d=s(i)?e:t;return d(i,n(l,3))}return fg=a,fg}var pg,dN;function _z(){if(dN)return pg;dN=1;var e=Object.prototype,t=e.hasOwnProperty;function n(s,a){return s!=null&&t.call(s,a)}return pg=n,pg}var mg,hN;function VR(){if(hN)return mg;hN=1;var e=_z(),t=UR();function n(s,a){return s!=null&&t(s,a,e)}return mg=n,mg}var gg,fN;function Sz(){if(fN)return gg;fN=1;var e=c0(),t=oi(),n=Vl(),s=It(),a=as(),i=ai(),l=vd(),d=Yl(),f="[object Map]",p="[object Set]",h=Object.prototype,g=h.hasOwnProperty;function y(w){if(w==null)return!0;if(a(w)&&(s(w)||typeof w=="string"||typeof w.splice=="function"||i(w)||d(w)||n(w)))return!w.length;var S=t(w);if(S==f||S==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 gg=y,gg}var yg,pN;function YR(){if(pN)return yg;pN=1;function e(t){return t===void 0}return yg=e,yg}var vg,mN;function KR(){if(mN)return vg;mN=1;var e=xd(),t=as();function n(s,a){var i=-1,l=t(s)?Array(s.length):[];return e(s,function(d,f,p){l[++i]=a(d,f,p)}),l}return vg=n,vg}var wg,gN;function XR(){if(gN)return wg;gN=1;var e=bd(),t=os(),n=KR(),s=It();function a(i,l){var d=s(i)?e:n;return d(i,t(l,3))}return wg=a,wg}var xg,yN;function Nz(){if(yN)return xg;yN=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 xg=e,xg}var bg,vN;function Ez(){if(vN)return bg;vN=1;function e(t,n,s,a,i){return i(t,function(l,d,f){s=a?(a=!1,l):n(s,l,d,f)}),s}return bg=e,bg}var kg,wN;function QR(){if(wN)return kg;wN=1;var e=Nz(),t=xd(),n=os(),s=Ez(),a=It();function i(l,d,f){var p=a(l)?e:s,h=arguments.length<3;return p(l,n(d,4),f,h,t)}return kg=i,kg}var _g,xN;function jz(){if(xN)return _g;xN=1;var e=Oa(),t=It(),n=Tr(),s="[object String]";function a(i){return typeof i=="string"||!t(i)&&n(i)&&e(i)==s}return _g=a,_g}var Sg,bN;function Cz(){if(bN)return Sg;bN=1;var e=HR(),t=e("length");return Sg=t,Sg}var Ng,kN;function Tz(){if(kN)return Ng;kN=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",s="\\u20d0-\\u20ff",a=t+n+s,i="\\ufe0e\\ufe0f",l="\\u200d",d=RegExp("["+l+e+a+i+"]");function f(p){return d.test(p)}return Ng=f,Ng}var Eg,_N;function Rz(){if(_N)return Eg;_N=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",s="\\u20d0-\\u20ff",a=t+n+s,i="\\ufe0e\\ufe0f",l="["+e+"]",d="["+a+"]",f="\\ud83c[\\udffb-\\udfff]",p="(?:"+d+"|"+f+")",h="[^"+e+"]",g="(?:\\ud83c[\\udde6-\\uddff]){2}",y="[\\ud800-\\udbff][\\udc00-\\udfff]",w="\\u200d",S=p+"?",k="["+i+"]?",N="(?:"+w+"(?:"+[h,g,y].join("|")+")"+k+S+")*",_=k+S+N,E="(?:"+[h+d+"?",d,g,y,l].join("|")+")",j=RegExp(f+"(?="+f+")|"+E+_,"g");function C(M){for(var $=j.lastIndex=0;j.test(M);)++$;return $}return Eg=C,Eg}var jg,SN;function Az(){if(SN)return jg;SN=1;var e=Cz(),t=Tz(),n=Rz();function s(a){return t(a)?n(a):e(a)}return jg=s,jg}var Cg,NN;function Mz(){if(NN)return Cg;NN=1;var e=c0(),t=oi(),n=as(),s=jz(),a=Az(),i="[object Map]",l="[object Set]";function d(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 Cg=d,Cg}var Tg,EN;function Iz(){if(EN)return Tg;EN=1;var e=o0(),t=RR(),n=m0(),s=os(),a=wd(),i=It(),l=ai(),d=Hl(),f=Vn(),p=Yl();function h(g,y,w){var S=i(g),k=S||l(g)||p(g);if(y=s(y,4),w==null){var N=g&&g.constructor;k?w=S?new N:[]:f(g)?w=d(N)?t(a(g)):{}:w={}}return(k?e:n)(g,function(_,E,j){return y(w,_,E,j)}),w}return Tg=h,Tg}var Rg,jN;function Oz(){if(jN)return Rg;jN=1;var e=si(),t=Vl(),n=It(),s=e?e.isConcatSpreadable:void 0;function a(i){return n(i)||t(i)||!!(s&&i&&i[s])}return Rg=a,Rg}var Ag,CN;function v0(){if(CN)return Ag;CN=1;var e=d0(),t=Oz();function n(s,a,i,l,d){var f=-1,p=s.length;for(i||(i=t),d||(d=[]);++f<p;){var h=s[f];a>0&&i(h)?a>1?n(h,a-1,i,l,d):e(d,h):l||(d[d.length]=h)}return d}return Ag=n,Ag}var Mg,TN;function $z(){if(TN)return Mg;TN=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 Mg=e,Mg}var Ig,RN;function ZR(){if(RN)return Ig;RN=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,d=-1,f=t(l.length-a,0),p=Array(f);++d<f;)p[d]=l[a+d];d=-1;for(var h=Array(a+1);++d<a;)h[d]=l[d];return h[a]=i(p),e(s,this,h)}}return Ig=n,Ig}var Og,AN;function Pz(){if(AN)return Og;AN=1;var e=f0(),t=yR(),n=La(),s=t?function(a,i){return t(a,"toString",{configurable:!0,enumerable:!1,value:e(i),writable:!0})}:n;return Og=s,Og}var $g,MN;function Lz(){if(MN)return $g;MN=1;var e=800,t=16,n=Date.now;function s(a){var i=0,l=0;return function(){var d=n(),f=t-(d-l);if(l=d,f>0){if(++i>=e)return arguments[0]}else i=0;return a.apply(void 0,arguments)}}return $g=s,$g}var Pg,IN;function JR(){if(IN)return Pg;IN=1;var e=Pz(),t=Lz(),n=t(e);return Pg=n,Pg}var Lg,ON;function Sd(){if(ON)return Lg;ON=1;var e=La(),t=ZR(),n=JR();function s(a,i){return n(t(a,i,e),a+"")}return Lg=s,Lg}var qg,$N;function eA(){if($N)return qg;$N=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 qg=e,qg}var Dg,PN;function qz(){if(PN)return Dg;PN=1;function e(t){return t!==t}return Dg=e,Dg}var Fg,LN;function Dz(){if(LN)return Fg;LN=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 Fg=e,Fg}var zg,qN;function Fz(){if(qN)return zg;qN=1;var e=eA(),t=qz(),n=Dz();function s(a,i,l){return i===i?n(a,i,l):e(a,t,l)}return zg=s,zg}var Bg,DN;function zz(){if(DN)return Bg;DN=1;var e=Fz();function t(n,s){var a=n==null?0:n.length;return!!a&&e(n,s,0)>-1}return Bg=t,Bg}var Ug,FN;function Bz(){if(FN)return Ug;FN=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 Ug=e,Ug}var Wg,zN;function Uz(){if(zN)return Wg;zN=1;function e(){}return Wg=e,Wg}var Hg,BN;function Wz(){if(BN)return Hg;BN=1;var e=jR(),t=Uz(),n=g0(),s=1/0,a=e&&1/n(new e([,-0]))[1]==s?function(i){return new e(i)}:t;return Hg=a,Hg}var Gg,UN;function Hz(){if(UN)return Gg;UN=1;var e=PR(),t=zz(),n=Bz(),s=LR(),a=Wz(),i=g0(),l=200;function d(f,p,h){var g=-1,y=t,w=f.length,S=!0,k=[],N=k;if(h)S=!1,y=n;else if(w>=l){var _=p?null:a(f);if(_)return i(_);S=!1,y=s,N=new e}else N=p?[]:k;e:for(;++g<w;){var E=f[g],j=p?p(E):E;if(E=h||E!==0?E:0,S&&j===j){for(var C=N.length;C--;)if(N[C]===j)continue e;p&&N.push(j),k.push(E)}else y(N,j,h)||(N!==k&&N.push(j),k.push(E))}return k}return Gg=d,Gg}var Vg,WN;function tA(){if(WN)return Vg;WN=1;var e=as(),t=Tr();function n(s){return t(s)&&e(s)}return Vg=n,Vg}var Yg,HN;function Gz(){if(HN)return Yg;HN=1;var e=v0(),t=Sd(),n=Hz(),s=tA(),a=t(function(i){return n(e(i,1,s,!0))});return Yg=a,Yg}var Kg,GN;function Vz(){if(GN)return Kg;GN=1;var e=bd();function t(n,s){return e(s,function(a){return n[a]})}return Kg=t,Kg}var Xg,VN;function nA(){if(VN)return Xg;VN=1;var e=Vz(),t=zs();function n(s){return s==null?[]:e(s,t(s))}return Xg=n,Xg}var Qg,YN;function Yn(){if(YN)return Qg;YN=1;var e;if(typeof r0=="function")try{e={clone:ez(),constant:f0(),each:$R(),filter:GR(),has:VR(),isArray:It(),isEmpty:Sz(),isFunction:Hl(),isUndefined:YR(),keys:zs(),map:XR(),reduce:QR(),size:Mz(),transform:Iz(),union:Gz(),values:nA()}}catch{}return e||(e=window._),Qg=e,Qg}var Zg,KN;function w0(){if(KN)return Zg;KN=1;var e=Yn();Zg=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 y=arguments,w=this;return e.each(h,function(S){y.length>1?w.setNode(S,g):w.setNode(S)}),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 y=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]),y),delete this._in[h],delete this._preds[h],e.each(e.keys(this._out[h]),y),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 y=g;!e.isUndefined(y);y=this.parent(y))if(y===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 y=this;e.each(this._nodes,function(k,N){h(N)&&g.setNode(N,k)}),e.each(this._edgeObjs,function(k){g.hasNode(k.v)&&g.hasNode(k.w)&&g.setEdge(k,y.edge(k))});var w={};function S(k){var N=y.parent(k);return N===void 0||g.hasNode(N)?(w[k]=N,N):N in w?w[N]:S(N)}return this._isCompound&&e.each(g.nodes(),function(k){g.setParent(k,S(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 y=this,w=arguments;return e.reduce(h,function(S,k){return w.length>1?y.setEdge(S,k,g):y.setEdge(S,k),k}),this},a.prototype.setEdge=function(){var h,g,y,w,S=!1,k=arguments[0];typeof k=="object"&&k!==null&&"v"in k?(h=k.v,g=k.w,y=k.name,arguments.length===2&&(w=arguments[1],S=!0)):(h=k,g=arguments[1],y=arguments[3],arguments.length>2&&(w=arguments[2],S=!0)),h=""+h,g=""+g,e.isUndefined(y)||(y=""+y);var N=d(this._isDirected,h,g,y);if(e.has(this._edgeLabels,N))return S&&(this._edgeLabels[N]=w),this;if(!e.isUndefined(y)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(h),this.setNode(g),this._edgeLabels[N]=S?w:this._defaultEdgeLabelFn(h,g,y);var _=f(this._isDirected,h,g,y);return h=_.v,g=_.w,Object.freeze(_),this._edgeObjs[N]=_,i(this._preds[g],h),i(this._sucs[h],g),this._in[g][N]=_,this._out[h][N]=_,this._edgeCount++,this},a.prototype.edge=function(h,g,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):d(this._isDirected,h,g,y);return this._edgeLabels[w]},a.prototype.hasEdge=function(h,g,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):d(this._isDirected,h,g,y);return e.has(this._edgeLabels,w)},a.prototype.removeEdge=function(h,g,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):d(this._isDirected,h,g,y),S=this._edgeObjs[w];return S&&(h=S.v,g=S.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 y=this._in[h];if(y){var w=e.values(y);return g?e.filter(w,function(S){return S.v===g}):w}},a.prototype.outEdges=function(h,g){var y=this._out[h];if(y){var w=e.values(y);return g?e.filter(w,function(S){return S.w===g}):w}},a.prototype.nodeEdges=function(h,g){var y=this.inEdges(h,g);if(y)return y.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 d(h,g,y,w){var S=""+g,k=""+y;if(!h&&S>k){var N=S;S=k,k=N}return S+s+k+s+(e.isUndefined(w)?t:w)}function f(h,g,y,w){var S=""+g,k=""+y;if(!h&&S>k){var N=S;S=k,k=N}var _={v:S,w:k};return w&&(_.name=w),_}function p(h,g){return d(h,g.v,g.w,g.name)}return Zg}var Jg,XN;function Yz(){return XN||(XN=1,Jg="2.1.8"),Jg}var ey,QN;function Kz(){return QN||(QN=1,ey={Graph:w0(),version:Yz()}),ey}var ty,ZN;function Xz(){if(ZN)return ty;ZN=1;var e=Yn(),t=w0();ty={write:n,read:i};function n(l){var d={options:{directed:l.isDirected(),multigraph:l.isMultigraph(),compound:l.isCompound()},nodes:s(l),edges:a(l)};return e.isUndefined(l.graph())||(d.value=e.clone(l.graph())),d}function s(l){return e.map(l.nodes(),function(d){var f=l.node(d),p=l.parent(d),h={v:d};return e.isUndefined(f)||(h.value=f),e.isUndefined(p)||(h.parent=p),h})}function a(l){return e.map(l.edges(),function(d){var f=l.edge(d),p={v:d.v,w:d.w};return e.isUndefined(d.name)||(p.name=d.name),e.isUndefined(f)||(p.value=f),p})}function i(l){var d=new t(l.options).setGraph(l.value);return e.each(l.nodes,function(f){d.setNode(f.v,f.value),f.parent&&d.setParent(f.v,f.parent)}),e.each(l.edges,function(f){d.setEdge({v:f.v,w:f.w,name:f.name},f.value)}),d}return ty}var ny,JN;function Qz(){if(JN)return ny;JN=1;var e=Yn();ny=t;function t(n){var s={},a=[],i;function l(d){e.has(s,d)||(s[d]=!0,i.push(d),e.each(n.successors(d),l),e.each(n.predecessors(d),l))}return e.each(n.nodes(),function(d){i=[],l(d),i.length&&a.push(i)}),a}return ny}var ry,eE;function rA(){if(eE)return ry;eE=1;var e=Yn();ry=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],d=a[s];a[n]=d,a[s]=l,i[d.key]=n,i[l.key]=s},ry}var sy,tE;function sA(){if(tE)return sy;tE=1;var e=Yn(),t=rA();sy=s;var n=e.constant(1);function s(i,l,d,f){return a(i,String(l),d||n,f||function(p){return i.outEdges(p)})}function a(i,l,d,f){var p={},h=new t,g,y,w=function(S){var k=S.v!==g?S.v:S.w,N=p[k],_=d(S),E=y.distance+_;if(_<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+S+" Weight: "+_);E<N.distance&&(N.distance=E,N.predecessor=g,h.decrease(k,E))};for(i.nodes().forEach(function(S){var k=S===l?0:Number.POSITIVE_INFINITY;p[S]={distance:k},h.add(S,k)});h.size()>0&&(g=h.removeMin(),y=p[g],y.distance!==Number.POSITIVE_INFINITY);)f(g).forEach(w);return p}return sy}var ay,nE;function Zz(){if(nE)return ay;nE=1;var e=sA(),t=Yn();ay=n;function n(s,a,i){return t.transform(s.nodes(),function(l,d){l[d]=e(s,d,a,i)},{})}return ay}var oy,rE;function aA(){if(rE)return oy;rE=1;var e=Yn();oy=t;function t(n){var s=0,a=[],i={},l=[];function d(f){var p=i[f]={onStack:!0,lowlink:s,index:s++};if(a.push(f),n.successors(f).forEach(function(y){e.has(i,y)?i[y].onStack&&(p.lowlink=Math.min(p.lowlink,i[y].index)):(d(y),p.lowlink=Math.min(p.lowlink,i[y].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)||d(f)}),l}return oy}var iy,sE;function Jz(){if(sE)return iy;sE=1;var e=Yn(),t=aA();iy=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 iy}var ly,aE;function eB(){if(aE)return ly;aE=1;var e=Yn();ly=n;var t=e.constant(1);function n(a,i,l){return s(a,i||t,l||function(d){return a.outEdges(d)})}function s(a,i,l){var d={},f=a.nodes();return f.forEach(function(p){d[p]={},d[p][p]={distance:0},f.forEach(function(h){p!==h&&(d[p][h]={distance:Number.POSITIVE_INFINITY})}),l(p).forEach(function(h){var g=h.v===p?h.w:h.v,y=i(h);d[p][g]={distance:y,predecessor:p}})}),f.forEach(function(p){var h=d[p];f.forEach(function(g){var y=d[g];f.forEach(function(w){var S=y[p],k=h[w],N=y[w],_=S.distance+k.distance;_<N.distance&&(N.distance=_,N.predecessor=k.predecessor)})})}),d}return ly}var cy,oE;function oA(){if(oE)return cy;oE=1;var e=Yn();cy=t,t.CycleException=n;function t(s){var a={},i={},l=[];function d(f){if(e.has(i,f))throw new n;e.has(a,f)||(i[f]=!0,a[f]=!0,e.each(s.predecessors(f),d),delete i[f],l.push(f))}if(e.each(s.sinks(),d),e.size(a)!==s.nodeCount())throw new n;return l}function n(){}return n.prototype=new Error,cy}var uy,iE;function tB(){if(iE)return uy;iE=1;var e=oA();uy=t;function t(n){try{e(n)}catch(s){if(s instanceof e.CycleException)return!1;throw s}return!0}return uy}var dy,lE;function iA(){if(lE)return dy;lE=1;var e=Yn();dy=t;function t(s,a,i){e.isArray(a)||(a=[a]);var l=(s.isDirected()?s.successors:s.neighbors).bind(s),d=[],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,d)}),d}function n(s,a,i,l,d,f){e.has(l,a)||(l[a]=!0,i||f.push(a),e.each(d(a),function(p){n(s,p,i,l,d,f)}),i&&f.push(a))}return dy}var hy,cE;function nB(){if(cE)return hy;cE=1;var e=iA();hy=t;function t(n,s){return e(n,s,"post")}return hy}var fy,uE;function rB(){if(uE)return fy;uE=1;var e=iA();fy=t;function t(n,s){return e(n,s,"pre")}return fy}var py,dE;function sB(){if(dE)return py;dE=1;var e=Yn(),t=w0(),n=rA();py=s;function s(a,i){var l=new t,d={},f=new n,p;function h(y){var w=y.v===p?y.w:y.v,S=f.priority(w);if(S!==void 0){var k=i(y);k<S&&(d[w]=p,f.decrease(w,k))}}if(a.nodeCount()===0)return l;e.each(a.nodes(),function(y){f.add(y,Number.POSITIVE_INFINITY),l.setNode(y)}),f.decrease(a.nodes()[0],0);for(var g=!1;f.size()>0;){if(p=f.removeMin(),e.has(d,p))l.setEdge(p,d[p]);else{if(g)throw new Error("Input graph is not connected: "+a);g=!0}a.nodeEdges(p).forEach(h)}return l}return py}var my,hE;function aB(){return hE||(hE=1,my={components:Qz(),dijkstra:sA(),dijkstraAll:Zz(),findCycles:Jz(),floydWarshall:eB(),isAcyclic:tB(),postorder:nB(),preorder:rB(),prim:sB(),tarjan:aA(),topsort:oA()}),my}var gy,fE;function oB(){if(fE)return gy;fE=1;var e=Kz();return gy={Graph:e.Graph,json:Xz(),alg:aB(),version:e.version},gy}var yy,pE;function hr(){if(pE)return yy;pE=1;var e;if(typeof r0=="function")try{e=oB()}catch{}return e||(e=window.graphlib),yy=e,yy}var vy,mE;function iB(){if(mE)return vy;mE=1;var e=MR(),t=1,n=4;function s(a){return e(a,t|n)}return vy=s,vy}var wy,gE;function Nd(){if(gE)return wy;gE=1;var e=ri(),t=as(),n=gd(),s=Vn();function a(i,l,d){if(!s(d))return!1;var f=typeof l;return(f=="number"?t(d)&&n(l,d.length):f=="string"&&l in d)?e(d[l],i):!1}return wy=a,wy}var xy,yE;function lB(){if(yE)return xy;yE=1;var e=Sd(),t=ri(),n=Nd(),s=Pa(),a=Object.prototype,i=a.hasOwnProperty,l=e(function(d,f){d=Object(d);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 y=f[p],w=s(y),S=-1,k=w.length;++S<k;){var N=w[S],_=d[N];(_===void 0||t(_,a[N])&&!i.call(d,N))&&(d[N]=y[N])}return d});return xy=l,xy}var by,vE;function cB(){if(vE)return by;vE=1;var e=os(),t=as(),n=zs();function s(a){return function(i,l,d){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,d);return h>-1?f[p?i[h]:h]:void 0}}return by=s,by}var ky,wE;function uB(){if(wE)return ky;wE=1;var e=/\s/;function t(n){for(var s=n.length;s--&&e.test(n.charAt(s)););return s}return ky=t,ky}var _y,xE;function dB(){if(xE)return _y;xE=1;var e=uB(),t=/^\s+/;function n(s){return s&&s.slice(0,e(s)+1).replace(t,"")}return _y=n,_y}var Sy,bE;function hB(){if(bE)return Sy;bE=1;var e=dB(),t=Vn(),n=ii(),s=NaN,a=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,l=/^0o[0-7]+$/i,d=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)?d(p.slice(2),g?2:8):a.test(p)?s:+p}return Sy=f,Sy}var Ny,kE;function lA(){if(kE)return Ny;kE=1;var e=hB(),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 Ny=s,Ny}var Ey,_E;function fB(){if(_E)return Ey;_E=1;var e=lA();function t(n){var s=e(n),a=s%1;return s===s?a?s-a:s:0}return Ey=t,Ey}var jy,SE;function pB(){if(SE)return jy;SE=1;var e=eA(),t=os(),n=fB(),s=Math.max;function a(i,l,d){var f=i==null?0:i.length;if(!f)return-1;var p=d==null?0:n(d);return p<0&&(p=s(f+p,0)),e(i,t(l,3),p)}return jy=a,jy}var Cy,NE;function mB(){if(NE)return Cy;NE=1;var e=cB(),t=pB(),n=e(t);return Cy=n,Cy}var Ty,EE;function cA(){if(EE)return Ty;EE=1;var e=v0();function t(n){var s=n==null?0:n.length;return s?e(n,1):[]}return Ty=t,Ty}var Ry,jE;function gB(){if(jE)return Ry;jE=1;var e=p0(),t=IR(),n=Pa();function s(a,i){return a==null?a:e(a,t(i),n)}return Ry=s,Ry}var Ay,CE;function yB(){if(CE)return Ay;CE=1;function e(t){var n=t==null?0:t.length;return n?t[n-1]:void 0}return Ay=e,Ay}var My,TE;function vB(){if(TE)return My;TE=1;var e=pd(),t=m0(),n=os();function s(a,i){var l={};return i=n(i,3),t(a,function(d,f,p){e(l,f,i(d,f,p))}),l}return My=s,My}var Iy,RE;function x0(){if(RE)return Iy;RE=1;var e=ii();function t(n,s,a){for(var i=-1,l=n.length;++i<l;){var d=n[i],f=s(d);if(f!=null&&(p===void 0?f===f&&!e(f):a(f,p)))var p=f,h=d}return h}return Iy=t,Iy}var Oy,AE;function wB(){if(AE)return Oy;AE=1;function e(t,n){return t>n}return Oy=e,Oy}var $y,ME;function xB(){if(ME)return $y;ME=1;var e=x0(),t=wB(),n=La();function s(a){return a&&a.length?e(a,n,t):void 0}return $y=s,$y}var Py,IE;function uA(){if(IE)return Py;IE=1;var e=pd(),t=ri();function n(s,a,i){(i!==void 0&&!t(s[a],i)||i===void 0&&!(a in s))&&e(s,a,i)}return Py=n,Py}var Ly,OE;function bB(){if(OE)return Ly;OE=1;var e=Oa(),t=wd(),n=Tr(),s="[object Object]",a=Function.prototype,i=Object.prototype,l=a.toString,d=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 y=d.call(g,"constructor")&&g.constructor;return typeof y=="function"&&y instanceof y&&l.call(y)==f}return Ly=p,Ly}var qy,$E;function dA(){if($E)return qy;$E=1;function e(t,n){if(!(n==="constructor"&&typeof t[n]=="function")&&n!="__proto__")return t[n]}return qy=e,qy}var Dy,PE;function kB(){if(PE)return Dy;PE=1;var e=Gl(),t=Pa();function n(s){return e(s,t(s))}return Dy=n,Dy}var Fy,LE;function _B(){if(LE)return Fy;LE=1;var e=uA(),t=xR(),n=TR(),s=bR(),a=AR(),i=Vl(),l=It(),d=tA(),f=ai(),p=Hl(),h=Vn(),g=bB(),y=Yl(),w=dA(),S=kB();function k(N,_,E,j,C,M,$){var I=w(N,E),F=w(_,E),O=$.get(F);if(O){e(N,E,O);return}var A=M?M(I,F,E+"",N,_,$):void 0,L=A===void 0;if(L){var H=l(F),X=!H&&f(F),T=!H&&!X&&y(F);A=F,H||X||T?l(I)?A=I:d(I)?A=s(I):X?(L=!1,A=t(F,!0)):T?(L=!1,A=n(F,!0)):A=[]:g(F)||i(F)?(A=I,i(I)?A=S(I):(!h(I)||p(I))&&(A=a(F))):L=!1}L&&($.set(F,A),C(A,F,j,M,$),$.delete(F)),e(N,E,A)}return Fy=k,Fy}var zy,qE;function SB(){if(qE)return zy;qE=1;var e=fd(),t=uA(),n=p0(),s=_B(),a=Vn(),i=Pa(),l=dA();function d(f,p,h,g,y){f!==p&&n(p,function(w,S){if(y||(y=new e),a(w))s(f,p,S,h,d,g,y);else{var k=g?g(l(f,S),w,S+"",f,p,y):void 0;k===void 0&&(k=w),t(f,S,k)}},i)}return zy=d,zy}var By,DE;function NB(){if(DE)return By;DE=1;var e=Sd(),t=Nd();function n(s){return e(function(a,i){var l=-1,d=i.length,f=d>1?i[d-1]:void 0,p=d>2?i[2]:void 0;for(f=s.length>3&&typeof f=="function"?(d--,f):void 0,p&&t(i[0],i[1],p)&&(f=d<3?void 0:f,d=1),a=Object(a);++l<d;){var h=i[l];h&&s(a,h,l,f)}return a})}return By=n,By}var Uy,FE;function EB(){if(FE)return Uy;FE=1;var e=SB(),t=NB(),n=t(function(s,a,i){e(s,a,i)});return Uy=n,Uy}var Wy,zE;function hA(){if(zE)return Wy;zE=1;function e(t,n){return t<n}return Wy=e,Wy}var Hy,BE;function jB(){if(BE)return Hy;BE=1;var e=x0(),t=hA(),n=La();function s(a){return a&&a.length?e(a,n,t):void 0}return Hy=s,Hy}var Gy,UE;function CB(){if(UE)return Gy;UE=1;var e=x0(),t=os(),n=hA();function s(a,i){return a&&a.length?e(a,t(i,2),n):void 0}return Gy=s,Gy}var Vy,WE;function TB(){if(WE)return Vy;WE=1;var e=pr(),t=function(){return e.Date.now()};return Vy=t,Vy}var Yy,HE;function RB(){if(HE)return Yy;HE=1;var e=md(),t=kd(),n=gd(),s=Vn(),a=Kl();function i(l,d,f,p){if(!s(l))return l;d=t(d,l);for(var h=-1,g=d.length,y=g-1,w=l;w!=null&&++h<g;){var S=a(d[h]),k=f;if(S==="__proto__"||S==="constructor"||S==="prototype")return l;if(h!=y){var N=w[S];k=p?p(N,S,w):void 0,k===void 0&&(k=s(N)?N:n(d[h+1])?[]:{})}e(w,S,k),w=w[S]}return l}return Yy=i,Yy}var Ky,GE;function AB(){if(GE)return Ky;GE=1;var e=_d(),t=RB(),n=kd();function s(a,i,l){for(var d=-1,f=i.length,p={};++d<f;){var h=i[d],g=e(a,h);l(g,h)&&t(p,n(h,a),g)}return p}return Ky=s,Ky}var Xy,VE;function MB(){if(VE)return Xy;VE=1;var e=AB(),t=WR();function n(s,a){return e(s,a,function(i,l){return t(s,l)})}return Xy=n,Xy}var Qy,YE;function IB(){if(YE)return Qy;YE=1;var e=cA(),t=ZR(),n=JR();function s(a){return n(t(a,void 0,e),a+"")}return Qy=s,Qy}var Zy,KE;function OB(){if(KE)return Zy;KE=1;var e=MB(),t=IB(),n=t(function(s,a){return s==null?{}:e(s,a)});return Zy=n,Zy}var Jy,XE;function $B(){if(XE)return Jy;XE=1;var e=Math.ceil,t=Math.max;function n(s,a,i,l){for(var d=-1,f=t(e((a-s)/(i||1)),0),p=Array(f);f--;)p[l?f:++d]=s,s+=i;return p}return Jy=n,Jy}var ev,QE;function PB(){if(QE)return ev;QE=1;var e=$B(),t=Nd(),n=lA();function s(a){return function(i,l,d){return d&&typeof d!="number"&&t(i,l,d)&&(l=d=void 0),i=n(i),l===void 0?(l=i,i=0):l=n(l),d=d===void 0?i<l?1:-1:n(d),e(i,l,d,a)}}return ev=s,ev}var tv,ZE;function LB(){if(ZE)return tv;ZE=1;var e=PB(),t=e();return tv=t,tv}var nv,JE;function qB(){if(JE)return nv;JE=1;function e(t,n){var s=t.length;for(t.sort(n);s--;)t[s]=t[s].value;return t}return nv=e,nv}var rv,ej;function DB(){if(ej)return rv;ej=1;var e=ii();function t(n,s){if(n!==s){var a=n!==void 0,i=n===null,l=n===n,d=e(n),f=s!==void 0,p=s===null,h=s===s,g=e(s);if(!p&&!g&&!d&&n>s||d&&f&&h&&!p&&!g||i&&f&&h||!a&&h||!l)return 1;if(!i&&!d&&!g&&n<s||g&&a&&l&&!i&&!d||p&&a&&l||!f&&l||!h)return-1}return 0}return rv=t,rv}var sv,tj;function FB(){if(tj)return sv;tj=1;var e=DB();function t(n,s,a){for(var i=-1,l=n.criteria,d=s.criteria,f=l.length,p=a.length;++i<f;){var h=e(l[i],d[i]);if(h){if(i>=p)return h;var g=a[i];return h*(g=="desc"?-1:1)}}return n.index-s.index}return sv=t,sv}var av,nj;function zB(){if(nj)return av;nj=1;var e=bd(),t=_d(),n=os(),s=KR(),a=qB(),i=yd(),l=FB(),d=La(),f=It();function p(h,g,y){g.length?g=e(g,function(k){return f(k)?function(N){return t(N,k.length===1?k[0]:k)}:k}):g=[d];var w=-1;g=e(g,i(n));var S=s(h,function(k,N,_){var E=e(g,function(j){return j(k)});return{criteria:E,index:++w,value:k}});return a(S,function(k,N){return l(k,N,y)})}return av=p,av}var ov,rj;function BB(){if(rj)return ov;rj=1;var e=v0(),t=zB(),n=Sd(),s=Nd(),a=n(function(i,l){if(i==null)return[];var d=l.length;return d>1&&s(i,l[0],l[1])?l=[]:d>2&&s(l[0],l[1],l[2])&&(l=[l[0]]),t(i,e(l,1),[])});return ov=a,ov}var iv,sj;function UB(){if(sj)return iv;sj=1;var e=BR(),t=0;function n(s){var a=++t;return e(s)+a}return iv=n,iv}var lv,aj;function WB(){if(aj)return lv;aj=1;function e(t,n,s){for(var a=-1,i=t.length,l=n.length,d={};++a<i;){var f=a<l?n[a]:void 0;s(d,t[a],f)}return d}return lv=e,lv}var cv,oj;function HB(){if(oj)return cv;oj=1;var e=md(),t=WB();function n(s,a){return t(s||[],a||[],e)}return cv=n,cv}var uv,ij;function yt(){if(ij)return uv;ij=1;var e;if(typeof r0=="function")try{e={cloneDeep:iB(),constant:f0(),defaults:lB(),each:$R(),filter:GR(),find:mB(),flatten:cA(),forEach:OR(),forIn:gB(),has:VR(),isUndefined:YR(),last:yB(),map:XR(),mapValues:vB(),max:xB(),merge:EB(),min:jB(),minBy:CB(),now:TB(),pick:OB(),range:LB(),reduce:QR(),sortBy:BB(),uniqueId:UB(),values:nA(),zipObject:HB()}}catch{}return e||(e=window._),uv=e,uv}var dv,lj;function GB(){if(lj)return dv;lj=1,dv=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 dv}var hv,cj;function VB(){if(cj)return hv;cj=1;var e=yt(),t=hr().Graph,n=GB();hv=a;var s=e.constant(1);function a(p,h){if(p.nodeCount()<=1)return[];var g=d(p,h||s),y=i(g.graph,g.buckets,g.zeroIdx);return e.flatten(e.map(y,function(w){return p.outEdges(w.v,w.w)}),!0)}function i(p,h,g){for(var y=[],w=h[h.length-1],S=h[0],k;p.nodeCount();){for(;k=S.dequeue();)l(p,h,g,k);for(;k=w.dequeue();)l(p,h,g,k);if(p.nodeCount()){for(var N=h.length-2;N>0;--N)if(k=h[N].dequeue(),k){y=y.concat(l(p,h,g,k,!0));break}}}return y}function l(p,h,g,y,w){var S=w?[]:void 0;return e.forEach(p.inEdges(y.v),function(k){var N=p.edge(k),_=p.node(k.v);w&&S.push({v:k.v,w:k.w}),_.out-=N,f(h,g,_)}),e.forEach(p.outEdges(y.v),function(k){var N=p.edge(k),_=k.w,E=p.node(_);E.in-=N,f(h,g,E)}),p.removeNode(y.v),S}function d(p,h){var g=new t,y=0,w=0;e.forEach(p.nodes(),function(N){g.setNode(N,{v:N,in:0,out:0})}),e.forEach(p.edges(),function(N){var _=g.edge(N.v,N.w)||0,E=h(N),j=_+E;g.setEdge(N.v,N.w,j),w=Math.max(w,g.node(N.v).out+=E),y=Math.max(y,g.node(N.w).in+=E)});var S=e.range(w+y+3).map(function(){return new n}),k=y+1;return e.forEach(g.nodes(),function(N){f(S,k,g.node(N))}),{graph:g,buckets:S,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 hv}var fv,uj;function YB(){if(uj)return fv;uj=1;var e=yt(),t=VB();fv={run:n,undo:a};function n(i){var l=i.graph().acyclicer==="greedy"?t(i,d(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 d(f){return function(p){return f.edge(p).weight}}}function s(i){var l=[],d={},f={};function p(h){e.has(f,h)||(f[h]=!0,d[h]=!0,e.forEach(i.outEdges(h),function(g){e.has(d,g.w)?l.push(g):p(g.w)}),delete d[h])}return e.forEach(i.nodes(),p),l}function a(i){e.forEach(i.edges(),function(l){var d=i.edge(l);if(d.reversed){i.removeEdge(l);var f=d.forwardName;delete d.reversed,delete d.forwardName,i.setEdge(l.w,l.v,d,f)}})}return fv}var pv,dj;function vn(){if(dj)return pv;dj=1;var e=yt(),t=hr().Graph;pv={addDummyNode:n,simplify:s,asNonCompoundGraph:a,successorWeights:i,predecessorWeights:l,intersectRect:d,buildLayerMatrix:f,normalizeRanks:p,removeEmptyRanks:h,addBorderNode:g,maxRank:y,partition:w,time:S,notime:k};function n(N,_,E,j){var C;do C=e.uniqueId(j);while(N.hasNode(C));return E.dummy=_,N.setNode(C,E),C}function s(N){var _=new t().setGraph(N.graph());return e.forEach(N.nodes(),function(E){_.setNode(E,N.node(E))}),e.forEach(N.edges(),function(E){var j=_.edge(E.v,E.w)||{weight:0,minlen:1},C=N.edge(E);_.setEdge(E.v,E.w,{weight:j.weight+C.weight,minlen:Math.max(j.minlen,C.minlen)})}),_}function a(N){var _=new t({multigraph:N.isMultigraph()}).setGraph(N.graph());return e.forEach(N.nodes(),function(E){N.children(E).length||_.setNode(E,N.node(E))}),e.forEach(N.edges(),function(E){_.setEdge(E,N.edge(E))}),_}function i(N){var _=e.map(N.nodes(),function(E){var j={};return e.forEach(N.outEdges(E),function(C){j[C.w]=(j[C.w]||0)+N.edge(C).weight}),j});return e.zipObject(N.nodes(),_)}function l(N){var _=e.map(N.nodes(),function(E){var j={};return e.forEach(N.inEdges(E),function(C){j[C.v]=(j[C.v]||0)+N.edge(C).weight}),j});return e.zipObject(N.nodes(),_)}function d(N,_){var E=N.x,j=N.y,C=_.x-E,M=_.y-j,$=N.width/2,I=N.height/2;if(!C&&!M)throw new Error("Not possible to find intersection inside of the rectangle");var F,O;return Math.abs(M)*$>Math.abs(C)*I?(M<0&&(I=-I),F=I*C/M,O=I):(C<0&&($=-$),F=$,O=$*M/C),{x:E+F,y:j+O}}function f(N){var _=e.map(e.range(y(N)+1),function(){return[]});return e.forEach(N.nodes(),function(E){var j=N.node(E),C=j.rank;e.isUndefined(C)||(_[C][j.order]=E)}),_}function p(N){var _=e.min(e.map(N.nodes(),function(E){return N.node(E).rank}));e.forEach(N.nodes(),function(E){var j=N.node(E);e.has(j,"rank")&&(j.rank-=_)})}function h(N){var _=e.min(e.map(N.nodes(),function(M){return N.node(M).rank})),E=[];e.forEach(N.nodes(),function(M){var $=N.node(M).rank-_;E[$]||(E[$]=[]),E[$].push(M)});var j=0,C=N.graph().nodeRankFactor;e.forEach(E,function(M,$){e.isUndefined(M)&&$%C!==0?--j:j&&e.forEach(M,function(I){N.node(I).rank+=j})})}function g(N,_,E,j){var C={width:0,height:0};return arguments.length>=4&&(C.rank=E,C.order=j),n(N,"border",C,_)}function y(N){return e.max(e.map(N.nodes(),function(_){var E=N.node(_).rank;if(!e.isUndefined(E))return E}))}function w(N,_){var E={lhs:[],rhs:[]};return e.forEach(N,function(j){_(j)?E.lhs.push(j):E.rhs.push(j)}),E}function S(N,_){var E=e.now();try{return _()}finally{console.log(N+" time: "+(e.now()-E)+"ms")}}function k(N,_){return _()}return pv}var mv,hj;function KB(){if(hj)return mv;hj=1;var e=yt(),t=vn();mv={run:n,undo:a};function n(i){i.graph().dummyChains=[],e.forEach(i.edges(),function(l){s(i,l)})}function s(i,l){var d=l.v,f=i.node(d).rank,p=l.w,h=i.node(p).rank,g=l.name,y=i.edge(l),w=y.labelRank;if(h!==f+1){i.removeEdge(l);var S,k,N;for(N=0,++f;f<h;++N,++f)y.points=[],k={width:0,height:0,edgeLabel:y,edgeObj:l,rank:f},S=t.addDummyNode(i,"edge",k,"_d"),f===w&&(k.width=y.width,k.height=y.height,k.dummy="edge-label",k.labelpos=y.labelpos),i.setEdge(d,S,{weight:y.weight},g),N===0&&i.graph().dummyChains.push(S),d=S;i.setEdge(d,p,{weight:y.weight},g)}}function a(i){e.forEach(i.graph().dummyChains,function(l){var d=i.node(l),f=d.edgeLabel,p;for(i.setEdge(d.edgeObj,f);d.dummy;)p=i.successors(l)[0],i.removeNode(l),f.points.push({x:d.x,y:d.y}),d.dummy==="edge-label"&&(f.x=d.x,f.y=d.y,f.width=d.width,f.height=d.height),l=p,d=i.node(l)})}return mv}var gv,fj;function Ku(){if(fj)return gv;fj=1;var e=yt();gv={longestPath:t,slack:n};function t(s){var a={};function i(l){var d=s.node(l);if(e.has(a,l))return d.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),d.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 gv}var yv,pj;function fA(){if(pj)return yv;pj=1;var e=yt(),t=hr().Graph,n=Ku().slack;yv=s;function s(d){var f=new t({directed:!1}),p=d.nodes()[0],h=d.nodeCount();f.setNode(p,{});for(var g,y;a(f,d)<h;)g=i(f,d),y=f.hasNode(g.v)?n(d,g):-n(d,g),l(f,d,y);return f}function a(d,f){function p(h){e.forEach(f.nodeEdges(h),function(g){var y=g.v,w=h===y?g.w:y;!d.hasNode(w)&&!n(f,g)&&(d.setNode(w,{}),d.setEdge(h,w,{}),p(w))})}return e.forEach(d.nodes(),p),d.nodeCount()}function i(d,f){return e.minBy(f.edges(),function(p){if(d.hasNode(p.v)!==d.hasNode(p.w))return n(f,p)})}function l(d,f,p){e.forEach(d.nodes(),function(h){f.node(h).rank+=p})}return yv}var vv,mj;function XB(){if(mj)return vv;mj=1;var e=yt(),t=fA(),n=Ku().slack,s=Ku().longestPath,a=hr().alg.preorder,i=hr().alg.postorder,l=vn().simplify;vv=d,d.initLowLimValues=g,d.initCutValues=f,d.calcCutValue=h,d.leaveEdge=w,d.enterEdge=S,d.exchangeEdges=k;function d(j){j=l(j),s(j);var C=t(j);g(C),f(C,j);for(var M,$;M=w(C);)$=S(C,j,M),k(C,j,M,$)}function f(j,C){var M=i(j,j.nodes());M=M.slice(0,M.length-1),e.forEach(M,function($){p(j,C,$)})}function p(j,C,M){var $=j.node(M),I=$.parent;j.edge(M,I).cutvalue=h(j,C,M)}function h(j,C,M){var $=j.node(M),I=$.parent,F=!0,O=C.edge(M,I),A=0;return O||(F=!1,O=C.edge(I,M)),A=O.weight,e.forEach(C.nodeEdges(M),function(L){var H=L.v===M,X=H?L.w:L.v;if(X!==I){var T=H===F,K=C.edge(L).weight;if(A+=T?K:-K,_(j,M,X)){var D=j.edge(M,X).cutvalue;A+=T?-D:D}}}),A}function g(j,C){arguments.length<2&&(C=j.nodes()[0]),y(j,{},1,C)}function y(j,C,M,$,I){var F=M,O=j.node($);return C[$]=!0,e.forEach(j.neighbors($),function(A){e.has(C,A)||(M=y(j,C,M,A,$))}),O.low=F,O.lim=M++,I?O.parent=I:delete O.parent,M}function w(j){return e.find(j.edges(),function(C){return j.edge(C).cutvalue<0})}function S(j,C,M){var $=M.v,I=M.w;C.hasEdge($,I)||($=M.w,I=M.v);var F=j.node($),O=j.node(I),A=F,L=!1;F.lim>O.lim&&(A=O,L=!0);var H=e.filter(C.edges(),function(X){return L===E(j,j.node(X.v),A)&&L!==E(j,j.node(X.w),A)});return e.minBy(H,function(X){return n(C,X)})}function k(j,C,M,$){var I=M.v,F=M.w;j.removeEdge(I,F),j.setEdge($.v,$.w,{}),g(j),f(j,C),N(j,C)}function N(j,C){var M=e.find(j.nodes(),function(I){return!C.node(I).parent}),$=a(j,M);$=$.slice(1),e.forEach($,function(I){var F=j.node(I).parent,O=C.edge(I,F),A=!1;O||(O=C.edge(F,I),A=!0),C.node(I).rank=C.node(F).rank+(A?O.minlen:-O.minlen)})}function _(j,C,M){return j.hasEdge(C,M)}function E(j,C,M){return M.low<=C.lim&&C.lim<=M.lim}return vv}var wv,gj;function QB(){if(gj)return wv;gj=1;var e=Ku(),t=e.longestPath,n=fA(),s=XB();wv=a;function a(f){switch(f.graph().ranker){case"network-simplex":d(f);break;case"tight-tree":l(f);break;case"longest-path":i(f);break;default:d(f)}}var i=t;function l(f){t(f),n(f)}function d(f){s(f)}return wv}var xv,yj;function ZB(){if(yj)return xv;yj=1;var e=yt();xv=t;function t(a){var i=s(a);e.forEach(a.graph().dummyChains,function(l){for(var d=a.node(l),f=d.edgeObj,p=n(a,i,f.v,f.w),h=p.path,g=p.lca,y=0,w=h[y],S=!0;l!==f.w;){if(d=a.node(l),S){for(;(w=h[y])!==g&&a.node(w).maxRank<d.rank;)y++;w===g&&(S=!1)}if(!S){for(;y<h.length-1&&a.node(w=h[y+1]).minRank<=d.rank;)y++;w=h[y]}a.setParent(l,w),l=a.successors(l)[0]}})}function n(a,i,l,d){var f=[],p=[],h=Math.min(i[l].low,i[d].low),g=Math.max(i[l].lim,i[d].lim),y,w;y=l;do y=a.parent(y),f.push(y);while(y&&(i[y].low>h||g>i[y].lim));for(w=y,y=d;(y=a.parent(y))!==w;)p.push(y);return{path:f.concat(p.reverse()),lca:w}}function s(a){var i={},l=0;function d(f){var p=l;e.forEach(a.children(f),d),i[f]={low:p,lim:l++}}return e.forEach(a.children(),d),i}return xv}var bv,vj;function JB(){if(vj)return bv;vj=1;var e=yt(),t=vn();bv={run:n,cleanup:l};function n(d){var f=t.addDummyNode(d,"root",{},"_root"),p=a(d),h=e.max(e.values(p))-1,g=2*h+1;d.graph().nestingRoot=f,e.forEach(d.edges(),function(w){d.edge(w).minlen*=g});var y=i(d)+1;e.forEach(d.children(),function(w){s(d,f,g,y,h,p,w)}),d.graph().nodeRankFactor=g}function s(d,f,p,h,g,y,w){var S=d.children(w);if(!S.length){w!==f&&d.setEdge(f,w,{weight:0,minlen:p});return}var k=t.addBorderNode(d,"_bt"),N=t.addBorderNode(d,"_bb"),_=d.node(w);d.setParent(k,w),_.borderTop=k,d.setParent(N,w),_.borderBottom=N,e.forEach(S,function(E){s(d,f,p,h,g,y,E);var j=d.node(E),C=j.borderTop?j.borderTop:E,M=j.borderBottom?j.borderBottom:E,$=j.borderTop?h:2*h,I=C!==M?1:g-y[w]+1;d.setEdge(k,C,{weight:$,minlen:I,nestingEdge:!0}),d.setEdge(M,N,{weight:$,minlen:I,nestingEdge:!0})}),d.parent(w)||d.setEdge(f,k,{weight:0,minlen:g+y[w]})}function a(d){var f={};function p(h,g){var y=d.children(h);y&&y.length&&e.forEach(y,function(w){p(w,g+1)}),f[h]=g}return e.forEach(d.children(),function(h){p(h,1)}),f}function i(d){return e.reduce(d.edges(),function(f,p){return f+d.edge(p).weight},0)}function l(d){var f=d.graph();d.removeNode(f.nestingRoot),delete f.nestingRoot,e.forEach(d.edges(),function(p){var h=d.edge(p);h.nestingEdge&&d.removeEdge(p)})}return bv}var kv,wj;function e8(){if(wj)return kv;wj=1;var e=yt(),t=vn();kv=n;function n(a){function i(l){var d=a.children(l),f=a.node(l);if(d.length&&e.forEach(d,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,d,f,p){var h={width:0,height:0,rank:p,borderType:i},g=f[i][p-1],y=t.addDummyNode(a,"border",h,l);f[i][p]=y,a.setParent(y,d),g&&a.setEdge(g,y,{weight:1})}return kv}var _v,xj;function t8(){if(xj)return _v;xj=1;var e=yt();_v={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")&&(d(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 d(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 _v}var Sv,bj;function n8(){if(bj)return Sv;bj=1;var e=yt();Sv=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 d(p){if(!e.has(s,p)){s[p]=!0;var h=n.node(p);l[h.rank].push(p),e.forEach(n.successors(p),d)}}var f=e.sortBy(a,function(p){return n.node(p).rank});return e.forEach(f,d),l}return Sv}var Nv,kj;function r8(){if(kj)return Nv;kj=1;var e=yt();Nv=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(y,w){return w})),d=e.flatten(e.map(a,function(y){return e.sortBy(e.map(s.outEdges(y),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(d.forEach(function(y){var w=y.pos+f;h[w]+=y.weight;for(var S=0;w>0;)w%2&&(S+=h[w+1]),w=w-1>>1,h[w]+=y.weight;g+=y.weight*S})),g}return Nv}var Ev,_j;function s8(){if(_j)return Ev;_j=1;var e=yt();Ev=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(d,f){var p=n.edge(f),h=n.node(f.v);return{sum:d.sum+p.weight*h.order,weight:d.weight+p.weight}},{sum:0,weight:0});return{v:a,barycenter:l.sum/l.weight,weight:l.weight}}else return{v:a}})}return Ev}var jv,Sj;function a8(){if(Sj)return jv;Sj=1;var e=yt();jv=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 d=e.filter(l,function(f){return!f.indegree});return n(d)}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 d(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,d(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,d=0;a.weight&&(l+=a.barycenter*a.weight,d+=a.weight),i.weight&&(l+=i.barycenter*i.weight,d+=i.weight),a.vs=i.vs.concat(a.vs),a.barycenter=l/d,a.weight=d,a.i=Math.min(i.i,a.i),i.merged=!0}return jv}var Cv,Nj;function o8(){if(Nj)return Cv;Nj=1;var e=yt(),t=vn();Cv=n;function n(i,l){var d=t.partition(i,function(k){return e.has(k,"barycenter")}),f=d.lhs,p=e.sortBy(d.rhs,function(k){return-k.i}),h=[],g=0,y=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,y+=k.weight,w=s(h,p,w)});var S={vs:e.flatten(h,!0)};return y&&(S.barycenter=g/y,S.weight=y),S}function s(i,l,d){for(var f;l.length&&(f=e.last(l)).i<=d;)l.pop(),i.push(f.vs),d++;return d}function a(i){return function(l,d){return l.barycenter<d.barycenter?-1:l.barycenter>d.barycenter?1:i?d.i-l.i:l.i-d.i}}return Cv}var Tv,Ej;function i8(){if(Ej)return Tv;Ej=1;var e=yt(),t=s8(),n=a8(),s=o8();Tv=a;function a(d,f,p,h){var g=d.children(f),y=d.node(f),w=y?y.borderLeft:void 0,S=y?y.borderRight:void 0,k={};w&&(g=e.filter(g,function(M){return M!==w&&M!==S}));var N=t(d,g);e.forEach(N,function(M){if(d.children(M.v).length){var $=a(d,M.v,p,h);k[M.v]=$,e.has($,"barycenter")&&l(M,$)}});var _=n(N,p);i(_,k);var E=s(_,h);if(w&&(E.vs=e.flatten([w,E.vs,S],!0),d.predecessors(w).length)){var j=d.node(d.predecessors(w)[0]),C=d.node(d.predecessors(S)[0]);e.has(E,"barycenter")||(E.barycenter=0,E.weight=0),E.barycenter=(E.barycenter*E.weight+j.order+C.order)/(E.weight+2),E.weight+=2}return E}function i(d,f){e.forEach(d,function(p){p.vs=e.flatten(p.vs.map(function(h){return f[h]?f[h].vs:h}),!0)})}function l(d,f){e.isUndefined(d.barycenter)?(d.barycenter=f.barycenter,d.weight=f.weight):(d.barycenter=(d.barycenter*d.weight+f.barycenter*f.weight)/(d.weight+f.weight),d.weight+=f.weight)}return Tv}var Rv,jj;function l8(){if(jj)return Rv;jj=1;var e=yt(),t=hr().Graph;Rv=n;function n(a,i,l){var d=s(a),f=new t({compound:!0}).setGraph({root:d}).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||d),e.forEach(a[l](p),function(y){var w=y.v===p?y.w:y.v,S=f.edge(w,p),k=e.isUndefined(S)?0:S.weight;f.setEdge(w,p,{weight:a.edge(y).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 Rv}var Av,Cj;function c8(){if(Cj)return Av;Cj=1;var e=yt();Av=t;function t(n,s,a){var i={},l;e.forEach(a,function(d){for(var f=n.parent(d),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 Av}var Mv,Tj;function u8(){if(Tj)return Mv;Tj=1;var e=yt(),t=n8(),n=r8(),s=i8(),a=l8(),i=c8(),l=hr().Graph,d=vn();Mv=f;function f(y){var w=d.maxRank(y),S=p(y,e.range(1,w+1),"inEdges"),k=p(y,e.range(w-1,-1,-1),"outEdges"),N=t(y);g(y,N);for(var _=Number.POSITIVE_INFINITY,E,j=0,C=0;C<4;++j,++C){h(j%2?S:k,j%4>=2),N=d.buildLayerMatrix(y);var M=n(y,N);M<_&&(C=0,E=e.cloneDeep(N),_=M)}g(y,E)}function p(y,w,S){return e.map(w,function(k){return a(y,k,S)})}function h(y,w){var S=new l;e.forEach(y,function(k){var N=k.graph().root,_=s(k,N,S,w);e.forEach(_.vs,function(E,j){k.node(E).order=j}),i(k,S,_.vs)})}function g(y,w){e.forEach(w,function(S){e.forEach(S,function(k,N){y.node(k).order=N})})}return Mv}var Iv,Rj;function d8(){if(Rj)return Iv;Rj=1;var e=yt(),t=hr().Graph,n=vn();Iv={positionX:S,findType1Conflicts:s,findType2Conflicts:a,addConflict:l,hasConflict:d,verticalAlignment:f,horizontalCompaction:p,alignCoordinates:y,findSmallestWidthAlignment:g,balance:w};function s(_,E){var j={};function C(M,$){var I=0,F=0,O=M.length,A=e.last($);return e.forEach($,function(L,H){var X=i(_,L),T=X?_.node(X).order:O;(X||L===A)&&(e.forEach($.slice(F,H+1),function(K){e.forEach(_.predecessors(K),function(D){var te=_.node(D),Z=te.order;(Z<I||T<Z)&&!(te.dummy&&_.node(K).dummy)&&l(j,D,K)})}),F=H+1,I=T)}),$}return e.reduce(E,C),j}function a(_,E){var j={};function C($,I,F,O,A){var L;e.forEach(e.range(I,F),function(H){L=$[H],_.node(L).dummy&&e.forEach(_.predecessors(L),function(X){var T=_.node(X);T.dummy&&(T.order<O||T.order>A)&&l(j,X,L)})})}function M($,I){var F=-1,O,A=0;return e.forEach(I,function(L,H){if(_.node(L).dummy==="border"){var X=_.predecessors(L);X.length&&(O=_.node(X[0]).order,C(I,A,H,F,O),A=H,F=O)}C(I,A,I.length,O,$.length)}),I}return e.reduce(E,M),j}function i(_,E){if(_.node(E).dummy)return e.find(_.predecessors(E),function(j){return _.node(j).dummy})}function l(_,E,j){if(E>j){var C=E;E=j,j=C}var M=_[E];M||(_[E]=M={}),M[j]=!0}function d(_,E,j){if(E>j){var C=E;E=j,j=C}return e.has(_[E],j)}function f(_,E,j,C){var M={},$={},I={};return e.forEach(E,function(F){e.forEach(F,function(O,A){M[O]=O,$[O]=O,I[O]=A})}),e.forEach(E,function(F){var O=-1;e.forEach(F,function(A){var L=C(A);if(L.length){L=e.sortBy(L,function(D){return I[D]});for(var H=(L.length-1)/2,X=Math.floor(H),T=Math.ceil(H);X<=T;++X){var K=L[X];$[A]===A&&O<I[K]&&!d(j,A,K)&&($[K]=A,$[A]=M[A]=M[K],O=I[K])}}})}),{root:M,align:$}}function p(_,E,j,C,M){var $={},I=h(_,E,j,M),F=M?"borderLeft":"borderRight";function O(H,X){for(var T=I.nodes(),K=T.pop(),D={};K;)D[K]?H(K):(D[K]=!0,T.push(K),T=T.concat(X(K))),K=T.pop()}function A(H){$[H]=I.inEdges(H).reduce(function(X,T){return Math.max(X,$[T.v]+I.edge(T))},0)}function L(H){var X=I.outEdges(H).reduce(function(K,D){return Math.min(K,$[D.w]-I.edge(D))},Number.POSITIVE_INFINITY),T=_.node(H);X!==Number.POSITIVE_INFINITY&&T.borderType!==F&&($[H]=Math.max($[H],X))}return O(A,I.predecessors.bind(I)),O(L,I.successors.bind(I)),e.forEach(C,function(H){$[H]=$[j[H]]}),$}function h(_,E,j,C){var M=new t,$=_.graph(),I=k($.nodesep,$.edgesep,C);return e.forEach(E,function(F){var O;e.forEach(F,function(A){var L=j[A];if(M.setNode(L),O){var H=j[O],X=M.edge(H,L);M.setEdge(H,L,Math.max(I(_,A,O),X||0))}O=A})}),M}function g(_,E){return e.minBy(e.values(E),function(j){var C=Number.NEGATIVE_INFINITY,M=Number.POSITIVE_INFINITY;return e.forIn(j,function($,I){var F=N(_,I)/2;C=Math.max($+F,C),M=Math.min($-F,M)}),C-M})}function y(_,E){var j=e.values(E),C=e.min(j),M=e.max(j);e.forEach(["u","d"],function($){e.forEach(["l","r"],function(I){var F=$+I,O=_[F],A;if(O!==E){var L=e.values(O);A=I==="l"?C-e.min(L):M-e.max(L),A&&(_[F]=e.mapValues(O,function(H){return H+A}))}})})}function w(_,E){return e.mapValues(_.ul,function(j,C){if(E)return _[E.toLowerCase()][C];var M=e.sortBy(e.map(_,C));return(M[1]+M[2])/2})}function S(_){var E=n.buildLayerMatrix(_),j=e.merge(s(_,E),a(_,E)),C={},M;e.forEach(["u","d"],function(I){M=I==="u"?E:e.values(E).reverse(),e.forEach(["l","r"],function(F){F==="r"&&(M=e.map(M,function(H){return e.values(H).reverse()}));var O=(I==="u"?_.predecessors:_.successors).bind(_),A=f(_,M,j,O),L=p(_,M,A.root,A.align,F==="r");F==="r"&&(L=e.mapValues(L,function(H){return-H})),C[I+F]=L})});var $=g(_,C);return y(C,$),w(C,_.graph().align)}function k(_,E,j){return function(C,M,$){var I=C.node(M),F=C.node($),O=0,A;if(O+=I.width/2,e.has(I,"labelpos"))switch(I.labelpos.toLowerCase()){case"l":A=-I.width/2;break;case"r":A=I.width/2;break}if(A&&(O+=j?A:-A),A=0,O+=(I.dummy?E:_)/2,O+=(F.dummy?E:_)/2,O+=F.width/2,e.has(F,"labelpos"))switch(F.labelpos.toLowerCase()){case"l":A=F.width/2;break;case"r":A=-F.width/2;break}return A&&(O+=j?A:-A),A=0,O}}function N(_,E){return _.node(E).width}return Iv}var Ov,Aj;function h8(){if(Aj)return Ov;Aj=1;var e=yt(),t=vn(),n=d8().positionX;Ov=s;function s(i){i=t.asNonCompoundGraph(i),a(i),e.forEach(n(i),function(l,d){i.node(d).x=l})}function a(i){var l=t.buildLayerMatrix(i),d=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+d})}return Ov}var $v,Mj;function f8(){if(Mj)return $v;Mj=1;var e=yt(),t=YB(),n=KB(),s=QB(),a=vn().normalizeRanks,i=ZB(),l=vn().removeEmptyRanks,d=JB(),f=e8(),p=t8(),h=u8(),g=h8(),y=vn(),w=hr().Graph;$v=S;function S(U,z){var Q=z&&z.debugTiming?y.time:y.notime;Q("layout",function(){var W=Q(" buildLayoutGraph",function(){return O(U)});Q(" runLayout",function(){k(W,Q)}),Q(" updateInputGraph",function(){N(U,W)})})}function k(U,z){z(" makeSpaceForEdgeLabels",function(){A(U)}),z(" removeSelfEdges",function(){V(U)}),z(" acyclic",function(){t.run(U)}),z(" nestingGraph.run",function(){d.run(U)}),z(" rank",function(){s(y.asNonCompoundGraph(U))}),z(" injectEdgeLabelProxies",function(){L(U)}),z(" removeEmptyRanks",function(){l(U)}),z(" nestingGraph.cleanup",function(){d.cleanup(U)}),z(" normalizeRanks",function(){a(U)}),z(" assignRankMinMax",function(){H(U)}),z(" removeEdgeLabelProxies",function(){X(U)}),z(" normalize.run",function(){n.run(U)}),z(" parentDummyChains",function(){i(U)}),z(" addBorderSegments",function(){f(U)}),z(" order",function(){h(U)}),z(" insertSelfEdges",function(){J(U)}),z(" adjustCoordinateSystem",function(){p.adjust(U)}),z(" position",function(){g(U)}),z(" positionSelfEdges",function(){P(U)}),z(" removeBorderNodes",function(){Z(U)}),z(" normalize.undo",function(){n.undo(U)}),z(" fixupEdgeLabelCoords",function(){D(U)}),z(" undoCoordinateSystem",function(){p.undo(U)}),z(" translateGraph",function(){T(U)}),z(" assignNodeIntersects",function(){K(U)}),z(" reversePoints",function(){te(U)}),z(" acyclic.undo",function(){t.undo(U)})}function N(U,z){e.forEach(U.nodes(),function(Q){var W=U.node(Q),le=z.node(Q);W&&(W.x=le.x,W.y=le.y,z.children(Q).length&&(W.width=le.width,W.height=le.height))}),e.forEach(U.edges(),function(Q){var W=U.edge(Q),le=z.edge(Q);W.points=le.points,e.has(le,"x")&&(W.x=le.x,W.y=le.y)}),U.graph().width=z.graph().width,U.graph().height=z.graph().height}var _=["nodesep","edgesep","ranksep","marginx","marginy"],E={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},j=["acyclicer","ranker","rankdir","align"],C=["width","height"],M={width:0,height:0},$=["minlen","weight","width","height","labeloffset"],I={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},F=["labelpos"];function O(U){var z=new w({multigraph:!0,compound:!0}),Q=de(U.graph());return z.setGraph(e.merge({},E,Y(Q,_),e.pick(Q,j))),e.forEach(U.nodes(),function(W){var le=de(U.node(W));z.setNode(W,e.defaults(Y(le,C),M)),z.setParent(W,U.parent(W))}),e.forEach(U.edges(),function(W){var le=de(U.edge(W));z.setEdge(W,e.merge({},I,Y(le,$),e.pick(le,F)))}),z}function A(U){var z=U.graph();z.ranksep/=2,e.forEach(U.edges(),function(Q){var W=U.edge(Q);W.minlen*=2,W.labelpos.toLowerCase()!=="c"&&(z.rankdir==="TB"||z.rankdir==="BT"?W.width+=W.labeloffset:W.height+=W.labeloffset)})}function L(U){e.forEach(U.edges(),function(z){var Q=U.edge(z);if(Q.width&&Q.height){var W=U.node(z.v),le=U.node(z.w),pe={rank:(le.rank-W.rank)/2+W.rank,e:z};y.addDummyNode(U,"edge-proxy",pe,"_ep")}})}function H(U){var z=0;e.forEach(U.nodes(),function(Q){var W=U.node(Q);W.borderTop&&(W.minRank=U.node(W.borderTop).rank,W.maxRank=U.node(W.borderBottom).rank,z=e.max(z,W.maxRank))}),U.graph().maxRank=z}function X(U){e.forEach(U.nodes(),function(z){var Q=U.node(z);Q.dummy==="edge-proxy"&&(U.edge(Q.e).labelRank=Q.rank,U.removeNode(z))})}function T(U){var z=Number.POSITIVE_INFINITY,Q=0,W=Number.POSITIVE_INFINITY,le=0,pe=U.graph(),ge=pe.marginx||0,Ne=pe.marginy||0;function ce(we){var Ce=we.x,_e=we.y,We=we.width,Se=we.height;z=Math.min(z,Ce-We/2),Q=Math.max(Q,Ce+We/2),W=Math.min(W,_e-Se/2),le=Math.max(le,_e+Se/2)}e.forEach(U.nodes(),function(we){ce(U.node(we))}),e.forEach(U.edges(),function(we){var Ce=U.edge(we);e.has(Ce,"x")&&ce(Ce)}),z-=ge,W-=Ne,e.forEach(U.nodes(),function(we){var Ce=U.node(we);Ce.x-=z,Ce.y-=W}),e.forEach(U.edges(),function(we){var Ce=U.edge(we);e.forEach(Ce.points,function(_e){_e.x-=z,_e.y-=W}),e.has(Ce,"x")&&(Ce.x-=z),e.has(Ce,"y")&&(Ce.y-=W)}),pe.width=Q-z+ge,pe.height=le-W+Ne}function K(U){e.forEach(U.edges(),function(z){var Q=U.edge(z),W=U.node(z.v),le=U.node(z.w),pe,ge;Q.points?(pe=Q.points[0],ge=Q.points[Q.points.length-1]):(Q.points=[],pe=le,ge=W),Q.points.unshift(y.intersectRect(W,pe)),Q.points.push(y.intersectRect(le,ge))})}function D(U){e.forEach(U.edges(),function(z){var Q=U.edge(z);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 te(U){e.forEach(U.edges(),function(z){var Q=U.edge(z);Q.reversed&&Q.points.reverse()})}function Z(U){e.forEach(U.nodes(),function(z){if(U.children(z).length){var Q=U.node(z),W=U.node(Q.borderTop),le=U.node(Q.borderBottom),pe=U.node(e.last(Q.borderLeft)),ge=U.node(e.last(Q.borderRight));Q.width=Math.abs(ge.x-pe.x),Q.height=Math.abs(le.y-W.y),Q.x=pe.x+Q.width/2,Q.y=W.y+Q.height/2}}),e.forEach(U.nodes(),function(z){U.node(z).dummy==="border"&&U.removeNode(z)})}function V(U){e.forEach(U.edges(),function(z){if(z.v===z.w){var Q=U.node(z.v);Q.selfEdges||(Q.selfEdges=[]),Q.selfEdges.push({e:z,label:U.edge(z)}),U.removeEdge(z)}})}function J(U){var z=y.buildLayerMatrix(U);e.forEach(z,function(Q){var W=0;e.forEach(Q,function(le,pe){var ge=U.node(le);ge.order=pe+W,e.forEach(ge.selfEdges,function(Ne){y.addDummyNode(U,"selfedge",{width:Ne.label.width,height:Ne.label.height,rank:ge.rank,order:pe+ ++W,e:Ne.e,label:Ne.label},"_se")}),delete ge.selfEdges})})}function P(U){e.forEach(U.nodes(),function(z){var Q=U.node(z);if(Q.dummy==="selfedge"){var W=U.node(Q.e.v),le=W.x+W.width/2,pe=W.y,ge=Q.x-le,Ne=W.height/2;U.setEdge(Q.e,Q.label),U.removeNode(z),Q.label.points=[{x:le+2*ge/3,y:pe-Ne},{x:le+5*ge/6,y:pe-Ne},{x:le+ge,y:pe},{x:le+5*ge/6,y:pe+Ne},{x:le+2*ge/3,y:pe+Ne}],Q.label.x=Q.x,Q.label.y=Q.y}})}function Y(U,z){return e.mapValues(e.pick(U,z),Number)}function de(U){var z={};return e.forEach(U,function(Q,W){z[W.toLowerCase()]=Q}),z}return $v}var Pv,Ij;function p8(){if(Ij)return Pv;Ij=1;var e=yt(),t=vn(),n=hr().Graph;Pv={debugOrdering:s};function s(a){var i=t.buildLayerMatrix(a),l=new n({compound:!0,multigraph:!0}).setGraph({});return e.forEach(a.nodes(),function(d){l.setNode(d,{label:d}),l.setParent(d,"layer"+a.node(d).rank)}),e.forEach(a.edges(),function(d){l.setEdge(d.v,d.w,{},d.name)}),e.forEach(i,function(d,f){var p="layer"+f;l.setNode(p,{rank:"same"}),e.reduce(d,function(h,g){return l.setEdge(h,g,{style:"invis"}),g})}),l}return Pv}var Lv,Oj;function m8(){return Oj||(Oj=1,Lv="0.8.5"),Lv}var qv,$j;function g8(){return $j||($j=1,qv={graphlib:hr(),layout:f8(),debug:p8(),util:{time:vn().time,notime:vn().notime},version:m8()}),qv}var y8=g8();const Pj=_w(y8),ei=240,Xu=130,Wo=74,Ed=72,Lj=Wo+Ed;function v8(e,t){var s;let n=ei;for(const a of e)n=Math.max(n,((s=t.get(a.id))==null?void 0:s.width)??ei);return n}const pA=420,w8=2;function Ml(e){var n;return((n=e.data)==null?void 0:n.sessionId)??"_default"}function x8(e,t){return((t==null?void 0:t.get(e))??0)>0?pA:0}function b8(e,t){const n=(t==null?void 0:t.get(e))??0;return n>0?6+n*36:0}function Il(e,t,n){const s=t.get(e);return{w:((s==null?void 0:s.width)??ei)+x8(e,n),h:Math.max((s==null?void 0:s.height)??Xu,b8(e,n))}}function k8(e){return[...e.keys()].sort().map(t=>`${t}:${e.get(t)}`).join("|")}function _8(e,t,n,s,a,i){const l=new Pj.graphlib.Graph;l.setDefaultEdgeLabel(()=>({})),l.setGraph({rankdir:n,marginx:0,marginy:0,nodesep:70,ranksep:160,edgesep:30});const d=e.filter(_=>!a.has(_)),f=new Set(d);for(const _ of d){const{w:E,h:j}=Il(_,s,i);l.setNode(_,{width:E,height:j})}for(const _ of t)f.has(_.source)&&f.has(_.target)&&l.setEdge(_.source,_.target);Pj.layout(l);const p=new Map;let h=1/0,g=1/0,y=-1/0,w=-1/0;for(const _ of d){const E=l.node(_);if(!E)continue;const j=s.get(_),C=(j==null?void 0:j.width)??ei,M=(j==null?void 0:j.height)??Xu,$=Il(_,s,i),I=E.x-$.w/2,F=E.y-$.h/2;p.set(_,{x:I,y:F}),I<h&&(h=I),F<g&&(g=F),I+C>y&&(y=I+C),F+M>w&&(w=F+M)}if(Number.isFinite(h)&&Number.isFinite(g))for(const[_,E]of p)p.set(_,{x:E.x-h,y:E.y-g});const S=Number.isFinite(y)?y-h:0,k=Number.isFinite(w)?w-g:0;let N=null;for(const _ of e){const E=a.get(_);if(!E)continue;const j=s.get(_),C=(j==null?void 0:j.width)??ei,M=(j==null?void 0:j.height)??Xu;N=N===null?{minX:E.x,minY:E.y,maxX:E.x+C,maxY:E.y+M}:{minX:Math.min(N.minX,E.x),minY:Math.min(N.minY,E.y),maxX:Math.max(N.maxX,E.x+C),maxY:Math.max(N.maxY,E.y+M)}}return{positions:p,width:S,height:k,pinnedBox:N}}function S8(e,t,n={}){const s=n.direction??"LR",a=n.pinned??new Map,i=n.measured??new Map,l=n.lanes,d=new Map;for(const _ of e){const E=Ml(_),j=d.get(E);j?j.push(_.id):d.set(E,[_.id])}const p=Array.from(d.keys()).sort().map(_=>({sid:_,..._8(d.get(_),t,s,i,a,l)})),h=v8(e,i),g=n.availableHeight&&n.availableHeight>0?n.availableHeight:Number.POSITIVE_INFINITY,y=_=>{const E=[[]];let j=0;for(const C of p)E.length<_&&j>0&&j+C.height>g&&(E.push([]),j=0),E[E.length-1].push(C),j+=C.height+Lj;return E},w=_=>_.reduce((E,j)=>Math.max(E,j.width),0)+pA;let S=y(n.availableWidth?w8:1);S.length>1&&S.reduce((E,j)=>E+w(j),0)+h*(S.length-1)>(n.availableWidth??0)&&(S=y(1));const k=new Map;let N=0;for(const _ of S){const E=w(_);let j=0;for(const{positions:C,height:M,pinnedBox:$}of _){for(const[F,O]of C)k.set(F,{x:O.x+N,y:O.y+j});let I=j+M;$&&$.maxY>I&&$.minX<N+E&&N<$.maxX&&(I=$.maxY),j=I+Lj}N+=E+h}return e.map(_=>{const E=a.get(_.id);if(E)return{..._,position:E};const j=k.get(_.id);return j?{..._,position:j}:_})}function N8(e,t,n,s,a){const l=Wo+Ed,d=60,f=w=>Il(w,s,a),p=new Map(e.map(w=>[w.id,Ml(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,S)=>w.pos.y-S.pos.y||w.pos.x-S.pos.x||w.id.localeCompare(S.id)),y=[];for(const{id:w,pos:S}of g){const{w:k,h:N}=f(w),_=p.get(w)??"_default";if(n.has(w)){h.push({x:S.x,y:S.y,w:k,h:N,sid:_});continue}let E=S.y;for(let j=0;j<h.length+1;j++){const C=h.find(M=>{const $=M.sid===_?24:d,I=M.sid===_?24:l;return S.x<M.x+M.w+$&&M.x<S.x+k+$&&E<M.y+M.h+I&&M.y<E+N+I});if(!C)break;E=C.y+C.h+(C.sid===_?24:l)}E!==S.y&&(t.set(w,{x:S.x,y:E}),y.push(w)),h.push({x:S.x,y:E,w:k,h:N,sid:_})}return y}function E8(e,t,n,s,a,i){const l=k=>Il(k,s,i),d=k=>n.get(k)??t.get(k),f=new Map;for(const k of e){if(!d(k.id))continue;const N=Ml(k),_=f.get(N);_?_.push(k):f.set(N,[k])}const p=new Set;for(const[k,N]of f)N.every(_=>a.has(_.id)&&!n.has(_.id))&&p.add(k);const h=new Map,g=[];for(const k of e){const N=d(k.id);if(!N)continue;const{w:_,h:E}=l(k.id),j=Ml(k);p.has(j)?(h.get(j)??h.set(j,[]).get(j)).push(k):g.push({x:N.x,y:N.y,w:_,h:E})}if(h.size===0)return[];const y=Wo+Ed,w=(k,N,_,E)=>g.some(j=>k<j.x+j.w+Wo&&j.x<k+_+Wo&&N<j.y+j.h+y&&j.y<N+E+y),S=[];for(const k of[...h.keys()].sort()){const N=h.get(k);let _=1/0,E=1/0,j=-1/0,C=-1/0;for(const L of N){const H=d(L.id),{w:X,h:T}=l(L.id);_=Math.min(_,H.x),E=Math.min(E,H.y),j=Math.max(j,H.x+X),C=Math.max(C,H.y+T)}const M=j-_,$=C-E,I=[...new Set(g.map(L=>Math.round(L.x)))].sort((L,H)=>L-H),F=I.length?I:[_],O=[0,...g.map(L=>L.y+L.h+y)].sort((L,H)=>L-H);let A=null;e:for(const L of F)for(const H of O){if(H>=E)break;if(!w(L,H,M,$)){A={x:L,y:H};break e}}if(A){const L=A.x-_,H=A.y-E;for(const X of N){const T=d(X.id);t.set(X.id,{x:T.x+L,y:T.y+H})}S.push(k)}for(const L of N){const H=d(L.id),{w:X,h:T}=l(L.id);g.push({x:H.x,y:H.y,w:X,h:T})}}return S}function j8(e,t,n,s,a,i=!1,l){const p=Wo+Ed+1,h=8,g=1.75,y=200,w=.7,S=.01,k=A=>Il(A,s,l),N=A=>n.get(A)??t.get(A),_=new Map;for(const A of e){if(!N(A.id))continue;const L=Ml(A),H=_.get(L);H?H.push(A):_.set(L,[A])}const E=[],j=new Set,C=new Set,M=a.size===0;for(const A of[..._.keys()].sort()){const L=_.get(A);let H=1/0,X=1/0,T=-1/0,K=-1/0,D=!1;for(const J of L){const P=N(J.id),{w:Y,h:de}=k(J.id);H=Math.min(H,P.x),X=Math.min(X,P.y),T=Math.max(T,P.x+Y),K=Math.max(K,P.y+de),n.has(J.id)&&(D=!0)}const te=T-H,Z=K-X;C.add(A);const V=a.get(A);V&&(te>V.w+h||Z>V.h+h)&&j.add(A),a.set(A,{w:te,h:Z}),E.push({sid:A,members:L.map(J=>J.id),x:H,y:X,w:te,h:Z,anchored:D,mass:1})}for(const A of[...a.keys()])C.has(A)||a.delete(A);if(i||M)return[];let $=!1;for(let A=0;A<E.length&&!$;A++)for(let L=A+1;L<E.length;L++){const H=E[A],X=E[L];if(!(H.anchored&&X.anchored)&&Math.abs(H.x+H.w/2-(X.x+X.w/2))<(H.w+X.w)/2+61&&Math.abs(H.y+H.h/2-(X.y+X.h/2))<(H.h+X.h)/2+p){$=!0;break}}if(j.size===0&&!$)return[];if(j.size>0)for(const A of E)j.has(A.sid)&&(A.mass=8);else for(const A of E)A.mass=Math.max(1,A.w*A.h/(ei*Xu));const I=new Map(E.map(A=>[A.sid,A.x])),F=new Map(E.map(A=>[A.sid,A.y]));for(let A=0;A<y;A++){const L=new Map,H=new Map;let X=0;for(let T=0;T<E.length;T++)for(let K=T+1;K<E.length;K++){const D=E[T],te=E[K];if(D.anchored&&te.anchored)continue;const Z=D.x+D.w/2,V=D.y+D.h/2,J=te.x+te.w/2,P=te.y+te.h/2,Y=(D.w+te.w)/2+61-Math.abs(Z-J),de=(D.h+te.h)/2+p-Math.abs(V-P);if(Y<=0||de<=0)continue;const U=(Ye,me)=>!Ye.anchored&&!(me<0&&Ye.x<=0),z=(Ye,me)=>!Ye.anchored&&!(me<0&&Ye.y<=0),Q=(Ye,me,be)=>{const De=Ye===me,He=De?D.sid<te.sid?-1:1:Math.sign(Ye-me);return be(D,He)||be(te,-He)?He:De&&(be(D,-He)||be(te,He))?-He:0},W=Q(Z,J,U),le=Q(V,P,z),pe=W!==0,ge=le!==0;if(!pe&&!ge)continue;const Ne=pe&&(!ge||Y*g<de),[ce,we,Ce,_e]=Ne?[W,Y,L,U]:[le,de,H,z],We=_e(D,ce),Se=_e(te,-ce),re=D.mass,Qe=te.mass,ft=We?Se?Qe/(re+Qe):1:0,ut=Se?We?re/(re+Qe):1:0,at=we*w;Ce.set(D.sid,(Ce.get(D.sid)??0)+ce*at*ft),Ce.set(te.sid,(Ce.get(te.sid)??0)-ce*at*ut),X+=at}for(const T of E)T.anchored||(T.x=Math.max(0,T.x+(L.get(T.sid)??0)),T.y=Math.max(0,T.y+(H.get(T.sid)??0)));if(X<S)break}const O=[];for(const A of E){const L=A.x-I.get(A.sid),H=A.y-F.get(A.sid);if(!(Math.abs(L)<1&&Math.abs(H)<1)){for(const X of A.members){if(n.has(X))continue;const T=t.get(X);T&&t.set(X,{x:T.x+L,y:T.y+H})}O.push(A.sid)}}return O}const C8=600;function ww(e,t){return!(e.exitAt!=null&&t-e.exitAt>C8||e.kind==="root"&&e.state==="done"&&e.tools.length===0&&e.endedAt!=null&&e.endedAt-e.startedAt<3e3)}function T8(e,t){const n=new Set;for(const s of e.agents.values())ww(s,t)&&n.add(s.id);return n}function R8(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 A8(e,t,n=0){if(!e)return!1;for(const s of t)if(R8(e,s,n))return!0;return!1}const mA="sessionGroup";function M8(e,t){var s;if(e.type===mA)return"transparent";const n=(s=e.data)==null?void 0:s.state;return t(n==="err"?"--err":n==="active"?"--inflight":"--ok")}const gA=["--err","--inflight","--ok","--grid-line","--minimap-mask","--panel","--line","--accent","--text-dim","--bg"];function qj(e){const t={};for(const n of gA)t[n]=e(n);return t}function I8(e){return t=>e[t]??""}function O8(e,t){return gA.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 P8=1200,L8=1e3;function Dj(e){return e.lastDeckFitAt>0&&e.at-e.lastDeckFitAt<P8?!1:e.hasSourceEvent?!0:e.lastCanvasInputAt>0&&e.at-e.lastCanvasInputAt<L8}function Dv({durationMs:e,documentHidden:t}){return t?!1:Number.isFinite(e)&&e>0}function q8(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 D8({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,q8(a,t,e))return!1;return s}const F8="Update checks are off (AGENTS_DECK_NO_UPDATE_CHECK=1)",Fv="click for what's new";function z8(e){if(e.checkDisabled)return`${F8} · ${Fv}`;if(e.checking)return`Asking npm for the newest release… · ${Fv}`;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 · ${Fv}, and to check npm now`}function B8(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 U8(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 W8(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 xw={kind:"assumed",claude:!0,codex:!0};function H8(e){if(!e||typeof e!="object")return xw;const t=e.providers;if(!t||typeof t!="object")return xw;const n=t;return{kind:"reported",claude:n.claude!==!1,codex:n.codex!==!1}}function Qu(e){const t=Math.max(0,Math.floor(e));return`${t} event${t===1?"":"s"}`}const Fj=99;function G8(e){const t=Math.max(0,Math.floor(e));return t>Fj?`${Fj}+`:String(t)}const V8="Pause the canvas";function Y8(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 — ${Qu(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)":`${Qu(e.held)} arrived while paused and will be applied in order when you resume (Space)`}function K8(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 yA="paused · full",X8=(e,t)=>t>0?yA:e>0?`paused · ${G8(e)}`:"paused";function Q8(e){const t=Math.max(0,Math.floor(e.dropped??0));return e.connected?e.paused?{tone:"paused",resting:!1,label:X8(e.held,t),widest:yA,title:t>0?`Connected — the pause is full at ${Qu(e.held)}; the oldest are being dropped as new ones arrive. Resume to catch up (Space)`:e.held>0?`Connected — ${Qu(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 zj(e){return typeof window>"u"?"":getComputedStyle(document.documentElement).getPropertyValue(e).trim()||""}const Z8={agent:O3,sessionGroup:Q3},vA="react-flow__node";function Bj(e){var t,n;return!!e&&((n=(t=e.classList)==null?void 0:t.contains)==null?void 0:n.call(t,vA))===!0}function J8(e){try{const t=document.querySelector(`.${vA}[data-id="${CSS.escape(e)}"]`);t==null||t.focus({preventScroll:!0})}catch{}}const eU=["a[href]","button:not(:disabled)","input:not(:disabled)","select:not(:disabled)","textarea:not(:disabled)","summary","[tabindex]"].join(","),tU=420,Su=18,nU=200,rU=5*6e4,sU=6,aU=2*6e4,Uj=400,b0="agent-dag.layout",k0="agent-dag.viewport",wA="agent-dag.summariesDismissed",xA="agent-dag.sessionListOpen",bA="agent-dag.detailOpen",kA="agent-dag.usagePanelOpen",_A="agent-dag.systemPanelOpen",Wj="agent-dag.accountsPanelOpen",zv="agent-dag.versionNoticeDismissed",Hj="agent-dag.oldNameNoticeDismissed",oU=15*6e4,Bv={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:"},Gj="agent-dag.autoRestart",Vj="agent-dag.bundleReloadedFor";function iU(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(xA)==="1"}catch{return!1}}function lU(e){if(!(typeof window>"u"))try{window.localStorage.setItem(xA,e?"1":"0")}catch{}}function cU(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(bA)==="1"}catch{return!1}}function uU(e){if(!(typeof window>"u"))try{window.localStorage.setItem(bA,e?"1":"0")}catch{}}function dU(){const e=ni(kA);return e===null?!0:e==="1"}function hU(e){if(!(typeof window>"u"))try{window.localStorage.setItem(kA,e?"1":"0")}catch{}}function fU(){return ni(_A)==="1"}function pU(e){if(!(typeof window>"u"))try{window.localStorage.setItem(_A,e?"1":"0")}catch{}}function mU(){if(typeof window>"u")return new Set;try{const e=window.localStorage.getItem(wA);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 Yj(e){if(!(typeof window>"u"))try{const t=Array.from(e),n=t.length>200?t.slice(-200):t;window.localStorage.setItem(wA,JSON.stringify(n))}catch{}}function gU(){const e={positions:[],pins:[]};if(typeof window>"u")return e;try{const t=window.localStorage.getItem(b0);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 Uv(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(b0,JSON.stringify({v:2,positions:n,pins:Array.from(t.keys())}))}catch{}}function yU(){if(typeof window>"u")return null;try{const e=window.localStorage.getItem(k0);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 vU(e){if(!(typeof window>"u"))try{window.localStorage.setItem(k0,JSON.stringify(e))}catch{}}function Kj(){if(!(typeof window>"u")){try{window.localStorage.removeItem(b0)}catch{}try{window.localStorage.removeItem(k0)}catch{}}}function wU(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"}),d=URL.createObjectURL(l),f=document.createElement("a"),p=(n.label||"session").replace(/[^a-z0-9._-]/gi,"_");f.href=d,f.download=`${Ut}-${p}-${t.slice(0,8)}.json`,document.body.appendChild(f),f.click(),document.body.removeChild(f),setTimeout(()=>URL.revokeObjectURL(d),1e3)}const bw={file:"📁",shell:"⚡",web:"🌐",agent:"🤖",task:"📋",plan:"🧭",mcp:"🔌",other:"✨"},kw={file:"file",shell:"shell",web:"web",agent:"agent",task:"task",plan:"plan",mcp:"mcp",other:"other"},SA=$T;function xU(e,t,n,s,a,i,l,d,f,p,h,g,y,w,S,k,N,_){const E=[],j=[];for(const A of e.agents.values()){if(!N.has(A.id))continue;const L=A.exitAt!=null,H=k!=null&&!k.has(A.id),X=[L?"rf-exiting":"",H?"rf-spotlit-out":""].filter(Boolean).join(" ")||void 0,T=i.get(A.id);if(E.push({id:A.id,type:"agent",position:{x:0,y:0},data:{...A,now:t,onOpenContext:_},className:X,...T?{width:T.width,height:T.height}:null}),A.parentId&&N.has(A.parentId)){const K=Uw(A.sessionId),D=L,te=S.size>0&&(S.has(A.id)||S.has(A.parentId)),Z=k!=null&&!k.has(A.id)&&!k.has(A.parentId),V=A.state==="active"?2:1.5,J=te?V+1.5:V,P=D?.2:Z?.12:1,Y=["sess-edge",A.state==="active"?"sess-live":"sess-idle",D?"rf-edge-exiting":"",te?"rf-edge-selected":""].filter(Boolean).join(" ");j.push({id:`e:${A.parentId}->${A.id}`,source:A.parentId,target:A.id,animated:(A.state==="active"||te)&&!D,type:"smoothstep",style:{"--session-hue":K,strokeWidth:J,opacity:P,transition:"var(--edge-transition)"},className:Y})}}const C=new Map;for(const A of e.agents.values())A.tools.length>0&&C.set(A.id,Math.min(4,A.tools.length));const M=`${y}#lanes:${k8(C)}`,$=E.filter(A=>pF(A.id,a,h,g));if($.length>0||M!==w.current){if($.length>0){const A=S8(E,j,{direction:"LR",pinned:a,measured:i,availableWidth:n,availableHeight:s,lanes:C});for(const L of A)dR(L.id,h,g)&&gF(L.id,L.position,h,g);E8(E,h,a,i,new Set($.map(L=>L.id)),C)}N8(E,h,a,i,C),w.current=M}const I=j8(E,h,a,i,l,!f||p,C);I.length>0&&d(I),vu(h,e.agents),vu(g,e.agents),vu(a,e.agents),vu(i,dF(e.agents.values()));const F=[];let O=!1;for(const A of E){let L=a.get(A.id)??h.get(A.id);L||(L=mF(A.id,h,g),O=!0),F.push({...A,position:L})}return O&&(w.current=""),{nodes:F,edges:j}}function bU(){return c.jsx(zw,{children:c.jsx(kU,{})})}function kU(){var qi,ua,Wr,uo;const e=ql(),t=Mt(),n=b.useState(ow)[0],s=b.useRef(n),[,a]=b.useState(0),i=b.useCallback(()=>a(q=>q+1),[]),[l,d]=b.useState(()=>new Set),[f,p]=b.useState(null),[h,g]=b.useState(null),y=b.useCallback((q,B)=>{d(ie=>{if(!B)return new Set([q]);const he=new Set(ie);return he.has(q)?he.delete(q):he.add(q),he}),p(ie=>B&&ie===q?ie:q)},[]),w=b.useCallback(()=>{d(new Set),p(null)},[]),[S,k]=b.useState(null),[N,_]=b.useState(null),E=b.useCallback(q=>_(q),[]),[j,C]=b.useState(!1),[M,$]=b.useState(!1),I=b.useState(mU)[0],[F,O]=b.useState(iU);b.useEffect(()=>{lU(F)},[F]);const[A,L]=b.useState(cU);b.useEffect(()=>{uU(A)},[A]);const[H,X]=b.useState(dU);b.useEffect(()=>{hU(H)},[H]);const[T,K]=b.useState(fU);b.useEffect(()=>{pU(T)},[T]);const[D,te]=b.useState(()=>{try{const q=window.localStorage.getItem(Wj);return q===null?!0:q==="1"}catch{return!0}});b.useEffect(()=>{try{window.localStorage.setItem(Wj,D?"1":"0")}catch{}},[D]);const[Z,V]=b.useState(null);b.useEffect(()=>{let q=null;try{q=localStorage.getItem("agent-dag.sound")}catch{}V(q===null?!0:q==="on")},[]);const J=b.useCallback(()=>{V(q=>{var ie;const B=q!==!0;try{localStorage.setItem("agent-dag.sound",B?"on":"off")}catch{}return B&&((ie=we.current)==null||ie.unlock()),B})},[]),P=b.useCallback(q=>{J()},[J]),Y=b.useRef(P);Y.current=P;const de=b.useRef(Z);de.current=Z;const[U,z]=b.useState(()=>O5(ni)),Q=b.useRef(U);Q.current=U;const W=b.useRef(null),le=b.useCallback((q,B=!1)=>{var ie,he;if((ie=we.current)==null||ie.unlock(),W.current!==null&&clearTimeout(W.current),W.current=null,!B){(he=we.current)==null||he.play(q,!0);return}W.current=setTimeout(()=>{var Re;W.current=null,(Re=we.current)==null||Re.play(q,!0)},T5)},[]),pe=b.useCallback((q,B)=>{z(ie=>{const he={level:Al(B.level??ie[q].level),figure:aR(q,B.figure??ie[q].figure)};try{localStorage.setItem(oR[q],String(he.level)),localStorage.setItem(iR[q],he.figure)}catch{}return{...ie,[q]:he}}),le(q,!0)},[le]);b.useEffect(()=>()=>{W.current!==null&&clearTimeout(W.current)},[]);const[ge,Ne]=b.useState(!1),ce=b.useRef(null),we=b.useRef(null),[Ce,_e]=b.useState("locked");b.useEffect(()=>{const q=L5({enabled:()=>de.current===!0,prefs:()=>Q.current,onState:_e});we.current=q,_e(q.state());const B=()=>q.unlock();return window.addEventListener("pointerdown",B,{once:!0,capture:!0}),window.addEventListener("keydown",B,{once:!0,capture:!0}),()=>{window.removeEventListener("pointerdown",B,{capture:!0}),window.removeEventListener("keydown",B,{capture:!0})}},[]);const[We,Se]=b.useState(!1),[re,Qe]=b.useState(null),[ft,ut]=b.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(zv)??""}catch{return""}}),[at,Ye]=b.useState(!1),me=b.useRef(0),[be,De]=b.useState(!1),He=b.useCallback((q=!1)=>(q&&(me.current=Date.now(),De(!0)),fetch(q?"/api/version?refresh=1":"/api/version").then(B=>B.ok?B.json():null).then(B=>{B&&Qe(B)}).catch(()=>{}).finally(()=>{q&&De(!1)})),[]),ot=b.useCallback(()=>{He(Date.now()-me.current>=oU)},[He]);b.useEffect(()=>{He();const q=window.setInterval(ot,5*6e4),B=()=>{document.visibilityState==="visible"&&ot()};return document.addEventListener("visibilitychange",B),()=>{window.clearInterval(q),document.removeEventListener("visibilitychange",B)}},[He,ot]),b.useEffect(()=>{We&&He()},[We,He]);const Le=(re==null?void 0:re.notice)??null,[se,je]=b.useState(null),Fe=b.useRef(!1);b.useEffect(()=>{if(Fe.current)return;const q=Q5(),B=Z5(q),ie=tF({stored:B,running:(re==null?void 0:re.running)??null,notes:c1,remembers:J5(q)});ie.reason!=="no-version"&&(Fe.current=!0,ie.record&&eF(q,ie.record),ie.show.length&&je({entries:ie.show,since:B,firstRun:ie.reason==="welcome"}))},[re==null?void 0:re.running]);const Ee=(re==null?void 0:re.running)??"3.17.0",Ue=b.useMemo(()=>lR(c1,null,Ee),[Ee]),_t=b.useCallback(()=>{je({entries:Ue,since:null,firstRun:!1})},[Ue]),[vt,Oe]=b.useState(null),[it,wt]=b.useState(xw);b.useEffect(()=>{let q=!1;return fetch("/api/health").then(B=>B.ok?B.json():null).then(B=>{q||(wt(H8(B)),!(!B||typeof B.workspace!="string")&&Oe(B.workspace))}).catch(()=>{}),()=>{q=!0}},[We]);const xt=b.useRef(it);xt.current=it;const tn=Le?`${Le.kind}:${Le.to}`:"",nn=Le!=null&&ft!==tn,In=b.useCallback(()=>{ut("");try{window.localStorage.setItem(zv,"")}catch{}},[]),qa=b.useCallback(()=>{if(Le){ut(tn);try{window.localStorage.setItem(zv,tn)}catch{}}},[Le,tn]),[Da,Fa]=b.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(Hj)??""}catch{return""}}),wn=re!=null&&re.invokedAs&&re.invokedAs!==Ut?re.invokedAs:null,Bs=wn!=null&&Da!==wn,za=b.useCallback(()=>{if(wn){Fa(wn);try{window.localStorage.setItem(Hj,wn)}catch{}}},[wn]),Ot=((qi=re==null?void 0:re.upgrade)==null?void 0:qi.state)??"idle",mr=l5(re==null?void 0:re.upgrade),Kn=b.useRef(!1),li=b.useCallback(async()=>{if(ur(Kn.current||Ot==="running")){Kn.current=!0;try{await fetch("/api/upgrade",{method:"POST"})}catch{}await He(),Kn.current=!1}},[Ot,He]);b.useEffect(()=>{if(Ot!=="running")return;const q=window.setInterval(He,3e3);return()=>window.clearInterval(q)},[Ot,He]);const Rr=b.useCallback(async()=>{const q=re==null?void 0:re.command;!q||!await sR(q)||(Ye(!0),window.setTimeout(()=>Ye(!1),1600))},[re==null?void 0:re.command]),Ar=b.useCallback(()=>{O(q=>(q||te(!1),!q))},[]),Mr=b.useCallback(()=>{te(q=>(q||O(!1),!q))},[]),[is,Us]=b.useState(!1),[Ba,Ws]=b.useState(!1),[On,Ua]=b.useState(()=>{try{return Number(localStorage.getItem(f1))||0}catch{return 0}}),[Hs,ci]=b.useState([]),[Ir,Gs]=b.useState(!1);b.useEffect(()=>{let q=!0;const B=()=>{fetch("/api/browser-watch?live=0").then(he=>he.ok?he.json():null).then(he=>{var Re;!q||!(he!=null&&he.ok)||(ci(he.episodes??[]),Gs(((Re=he.settings)==null?void 0:Re.enabled)===!0))}).catch(()=>{})};B();const ie=setInterval(B,5*6e4);return()=>{q=!1,clearInterval(ie)}},[]);const[Wa,Or]=b.useState([]),Vs=b.useRef(new Set),[ls,dt]=b.useState(null);b.useEffect(()=>{let q=!0;const B=()=>{fetch("/api/lan").then(he=>he.ok?he.json():null).then(he=>{!q||!(he!=null&&he.ok)||Or(Array.isArray(he.pending)?he.pending:[])}).catch(()=>{})};B();const ie=setInterval(B,5e3);return()=>{q=!1,clearInterval(ie)}},[]);const Ha=b.useCallback(async(q,B)=>{if(!ls){dt(q);try{const he=await(await fetch("/api/lan/peer",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:q,fp:B})})).json().catch(()=>null);he&&Array.isArray(he.pending)?Or(he.pending):Or(Re=>Re.filter(Ie=>Ie.fp!==B))}catch{}finally{dt(null)}}},[ls]),$n=b.useMemo(()=>WF(Hs,On).length,[Hs,On]),[Ga,$r]=b.useState(0),Ys=b.useRef(null),[Va,Pr]=b.useState(!1),Dt=b.useRef(null),[Ks,on]=b.useState(0),xn=b.useState(()=>bF({protect:q=>DL(s.current,q)}))[0],[Ya,jd]=b.useState(!1),cs=b.useCallback(()=>{const q=xn.paused&&xn.dropped>0,B=xn.setPaused(!xn.paused);q&&FL(s.current);for(const ie of B)s.current=hk(s.current,ie);jd(xn.paused)},[xn]),[St,Xs]=b.useState(Date.now()),[Pn,Cd]=b.useState(()=>{if(typeof window>"u")return!0;try{return window.localStorage.getItem(Gj)!=="0"}catch{return!0}}),Td=b.useCallback(()=>{Cd(q=>{const B=!q;try{window.localStorage.setItem(Gj,B?"1":"0")}catch{}return B})},[]),[Ln,Qs]=b.useState(!1),[ui,Zs]=b.useState("restart"),[Xl,Ka]=b.useState(null),Ze=b.useRef(!1),di=b.useRef(null),hi=b.useRef(0),us=b.useCallback(async q=>{if(!ur(Ze.current))return;const B=(q==null?void 0:q.upgrade)===!0;Ze.current=!0,di.current=mr;const ie=++hi.current;Zs(B?"npx":"restart"),Qs(!0);try{window.sessionStorage.setItem("agent-dag.restartPending",(Le==null?void 0:Le.to)??"")}catch{}try{await fetch("/api/restart",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({upgrade:B})})}catch{}window.setTimeout(()=>{if(hi.current===ie&&Ze.current){Ze.current=!1,Qs(!1);try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}}},B?18e4:3e4)},[Le==null?void 0:Le.to,mr]),Xa=b.useRef(null);b.useEffect(()=>{const q=s1(s.current.agents.values())>0,B=f5({enabled:Pn,kind:Le==null?void 0:Le.kind,canRestart:(re==null?void 0:re.canRestart)===!0,noticeOpen:nn,visible:document.visibilityState==="visible",busy:q,idleSince:Xa.current,now:St});Xa.current=B.idleSince,B.restart&&us()},[Pn,Le==null?void 0:Le.kind,re==null?void 0:re.canRestart,nn,St,us]);const fi=s1(s.current.agents.values()),pi=h5(fi),Qa=rR({enabled:Pn,kind:Le==null?void 0:Le.kind,canRestart:(re==null?void 0:re.canRestart)===!0,noticeOpen:nn,visible:document.visibilityState==="visible",busy:fi>0,idleSince:Xa.current,now:St});b.useEffect(()=>{const q=re==null?void 0:re.running;let B=null,ie=null;try{B=window.sessionStorage.getItem("agent-dag.restartPending"),ie=window.sessionStorage.getItem(Vj)}catch{return}const he=i5({bundle:"3.17.0",running:q,pending:B,lastTried:ie});if(he==="reload"){try{window.sessionStorage.setItem(Vj,q??"")}catch{return}window.location.reload();return}if(he!=="confirm")return;try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}Ze.current=!1,Qs(!1),Ka(q??null);const Re=window.setTimeout(()=>Ka(null),6e3);return()=>window.clearTimeout(Re)},[re==null?void 0:re.running]),b.useEffect(()=>{if(Ln&&c5({asked:di.current,reported:mr})){try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}Ze.current=!1,Qs(!1)}},[Ln,mr]);const Js=b.useState(()=>$8(gU()))[0],Nt=b.useRef(Js.pinned),bn=b.useRef(null),kn=b.useState(()=>yU())[0],[Lr,ea]=b.useState(()=>new Set),[ln,Ql]=b.useState(_F),[Xn,ta]=b.useState(()=>qj(zj)),Zl=b.useMemo(()=>I8(Xn),[Xn]),Jl=b.useCallback(q=>M8(q,Zl),[Zl]),Za=b.useMemo(()=>({background:Xn["--panel"],border:`1px solid ${Xn["--line"]}`,borderRadius:8}),[Xn]),[mi,Rd]=b.useState(!1);b.useEffect(()=>{document.documentElement.dataset.theme=ln;try{window.localStorage.setItem(hR,ln)}catch{}ta(q=>{const B=qj(zj);return O8(q,B)?q:B})},[ln]);const _n=b.useCallback((q,B)=>{if(Dv({durationMs:B,documentHidden:document.hidden})){e.setViewport(q,{duration:B});return}const{d3Zoom:ie,d3Selection:he}=t.getState(),Re=he==null?void 0:he.property("__zoom");if(ie&&he&&Re&&Re.k>0&&q.zoom>0){ie.transform(he,Re.scale(q.zoom/Re.k).translate((q.x-Re.x)/q.zoom,(q.y-Re.y)/q.zoom));return}e.setViewport(q,{duration:0})},[e,t]),Qn=b.useRef(null);b.useEffect(()=>{if(!kn)return;const q=window.setTimeout(()=>{try{_n(kn,0)}catch{}Zn.current=Date.now()},60);return()=>window.clearTimeout(q)},[_n,kn]);const qr=b.useRef(!0);b.useEffect(()=>{const q=new EventSource("/events"),B=wF(i,{now:()=>Date.now(),setTimeout:(ie,he)=>window.setTimeout(ie,he),clearTimeout:ie=>window.clearTimeout(ie)});return q.addEventListener("open",()=>{Se(!0),Rd(!0)}),q.addEventListener("error",()=>Se(!1)),q.addEventListener("replay-end",()=>{qr.current=!1,B.flush()}),q.addEventListener("hook",ie=>{var he;try{const Re=JSON.parse(ie.data);if(!xn.accept(Re))return;s.current=hk(s.current,Re);const Ie=Re.replay===!0||qr.current||Date.now()-Re.receivedAt>3e4;Ie?B.replay():B.live();const Ve=P5(Re,Ie);Ve&&((he=we.current)==null||he.play(Ve))}catch{}}),()=>{q.close(),B.cancel()}},[i]),b.useEffect(()=>{const q=setInterval(()=>{const B=Date.now();Xs(B);let ie=zL(s.current,B,dk);BL(s.current,B,dk)&&(ie=!0),LL(s.current,B,nU,rU)&&(ie=!0),qL(s.current,B,sU,aU)&&(ie=!0),d(he=>uF(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),ie&&i()},250);return()=>clearInterval(q)},[i]);const ds=b.useRef(null),Zn=b.useRef(0),Ad=420,cn=b.useCallback((q=500)=>{try{const Ie=document.querySelector(".canvas-wrap"),Ve=Array.from(document.querySelectorAll(".react-flow__node")).filter(mt=>mt.offsetWidth>0);if(!Ie||Ve.length===0)return;const et=Ie.getBoundingClientRect(),rt=e.getViewport();if(!Number.isFinite(rt.zoom)||rt.zoom<=0)return;const st=mt=>(mt-et.left-rt.x)/rt.zoom,Kt=mt=>(mt-et.top-rt.y)/rt.zoom,ho=Ve.map(mt=>mt.getBoundingClientRect()),hc=Math.min(...ho.map(mt=>st(mt.left))),da=Math.max(...ho.map(mt=>st(mt.right))),fc=Math.min(...ho.map(mt=>Kt(mt.top))),pc=Math.max(...ho.map(mt=>Kt(mt.bottom))),Di=da-hc,lt=pc-fc;if(!(Di>0&<>0))return;const Hr=Math.max(.2,Math.min(1,(et.width-160)/(Di+Ad)*.86,(et.height-160)/lt*.86)),xr={x:80-hc*Hr,y:Math.max(80,(et.height-lt*Hr)/2)-fc*Hr,zoom:Hr};_n(xr,q),Zn.current=Date.now(),Qn.current=Dv({durationMs:q,documentHidden:document.hidden})?{target:xr,until:Date.now()+q+60}:null,window.setTimeout(()=>{var mt;try{((mt=Qn.current)==null?void 0:mt.target)===xr&&(Qn.current=null);const Fi=e.getViewport();(Math.abs(Fi.zoom-Hr)>.01||Math.abs(Fi.x-xr.x)>2)&&_n(xr,0)}catch{}},q+60)}catch{}},[e,_n]);b.useEffect(()=>{const q=()=>{if(!document.hidden)return;const B=Qn.current;if(Qn.current=null,!(!B||Date.now()>B.until)){try{_n(B.target,0)}catch{}Zn.current=Date.now()}};return document.addEventListener("visibilitychange",q),()=>document.removeEventListener("visibilitychange",q)},[_n]);const hs=b.useRef(""),na=b.useRef(null),gi=b.useRef(0),Sn=b.useCallback(()=>{gi.current=Date.now()},[]),ra=b.useRef(null),sa=b.useRef(0),Ja=b.useCallback(()=>{sa.current=Date.now()},[]),aa=b.useCallback(q=>({hasSourceEvent:!!q,at:Date.now(),lastDeckFitAt:Zn.current,lastCanvasInputAt:sa.current}),[]),fs="agent-dag.autoFitDisabled",yi=b.useState(()=>{if(typeof window>"u")return!1;try{return window.localStorage.getItem(fs)==="1"}catch{return!1}})[0],Tt=b.useRef(yi),[Dr,eo]=b.useState(yi),Fr=b.useCallback(()=>{if(!Tt.current){Tt.current=!0,eo(!0);try{window.localStorage.setItem(fs,"1")}catch{}}},[]),Md=b.useCallback(()=>{Tt.current=!1,eo(!1);try{window.localStorage.removeItem(fs)}catch{}cn(400)},[e,cn]);b.useEffect(()=>{const q=setInterval(()=>{if(Tt.current||Date.now()-gi.current<800)return;const B=s.current,ie=Date.now(),he=[];for(const Ie of B.agents.values())ww(Ie,ie)&&he.push({id:Ie.id});if(he.length===0)return;const Re=[];for(const{id:Ie}of he){const Ve=gr.current.get(Ie),et=Nt.current.get(Ie)??un.current.get(Ie);!Ve||!et||Re.push({x:et.x,y:et.y,width:Ve.width,height:Ve.height})}D8({pane:ra.current,viewport:e.getViewport(),boxes:Re})&&cn(600)},1500);return()=>clearInterval(q)},[e]);const oa=b.useRef(!1),gr=b.useRef(new Map),ps=b.useRef(0),to=b.useCallback(q=>{const B=gr.current;let ie=!1;for(const he of q.nodeInternals.values()){const Re=he.width,Ie=he.height;if(Re==null||Ie==null)continue;const Ve=B.get(he.id);Ve?(Math.abs(Ve.height-Ie)>4||Math.abs(Ve.width-Re)>4)&&(B.set(he.id,{width:Re,height:Ie}),ie=!0):(B.set(he.id,{width:Re,height:Ie}),ie=!0)}return ie&&(ps.current+=1),ps.current},[]),vi=ct(to),[ec,Id]=b.useState(0);b.useEffect(()=>{let q=0;const B=()=>{const he=gr.current;let Re=!1;for(const Ie of document.querySelectorAll(".react-flow__node[data-id]")){const Ve=Ie.getAttribute("data-id");if(!Ve)continue;const et=Ie.offsetWidth,rt=Ie.offsetHeight;if(!et||!rt)continue;const st=he.get(Ve);(!st||Math.abs(st.width-et)>4||Math.abs(st.height-rt)>4)&&(he.set(Ve,{width:et,height:rt}),Re=!0)}Re&&Id(Ie=>Ie+1)};if(oa.current)return;let ie=0;return document.visibilityState==="hidden"?ie=window.setTimeout(B,32):q=requestAnimationFrame(B),()=>{cancelAnimationFrame(q),window.clearTimeout(ie)}});const un=b.useRef(Js.positions),wi=b.useRef(new Set),xi=b.useRef(""),ms=b.useMemo(()=>{const q=[];for(const B of s.current.agents.values())ww(B,St)&&q.push(B.id+(B.parentId?`>${B.parentId}`:""));return q.sort(),`${q.join("|")}#sv${vi}.${ec}`},[s.current,s.current.revision,St,vi,ec]),ia=b.useRef(null);b.useEffect(()=>(ia.current!=null&&window.clearTimeout(ia.current),ia.current=window.setTimeout(()=>{Uv(un.current,Nt.current)},1500),()=>{ia.current!=null&&window.clearTimeout(ia.current)}),[ms]),b.useEffect(()=>{if(hs.current===ms)return;const q=hs.current;if(hs.current=ms,!q||Tt.current)return;Date.now()-Zn.current>1200&&cn(400),ds.current&&window.clearTimeout(ds.current),ds.current=window.setTimeout(()=>{Tt.current||cn(500)},280)},[ms,e,cn]);const bi=b.useMemo(()=>fF(s.current,l),[s.current,s.current.revision,l]),ki=b.useMemo(()=>T8(s.current,St),[s.current,s.current.revision,St]),_i=b.useRef(null),[no,tc]=b.useState({w:0,h:0});b.useEffect(()=>{const q=_i.current;if(!q||typeof ResizeObserver>"u")return;const B=new ResizeObserver(ie=>{var Re;const he=(Re=ie[0])==null?void 0:Re.contentRect;he&&(ra.current={width:he.width,height:he.height},tc(Ie=>Math.abs(Ie.w-he.width)>40||Math.abs(Ie.h-he.height)>40?{w:he.width,h:he.height}:Ie))});return B.observe(q),ra.current={width:q.clientWidth,height:q.clientHeight},tc({w:q.clientWidth,h:q.clientHeight}),()=>B.disconnect()},[]);const Od=b.useCallback(q=>{var ie,he;const B=q.target;!(B!=null&&B.closest)||B.closest(eU)!==q.currentTarget||(q.preventDefault(),(he=(ie=document.activeElement)==null?void 0:ie.blur)==null||he.call(ie))},[]),$d=b.useRef(new Map),[ro,Pd]=b.useState(!1);b.useEffect(()=>{const q=window.setTimeout(()=>Pd(!0),2500);return()=>window.clearTimeout(q)},[]);const[Ld,Si]=b.useState(!1),Jn=b.useRef(null),[Ni,nc]=b.useState(!1),qd=b.useCallback(()=>{Jn.current&&(window.clearTimeout(Jn.current),Jn.current=null),Si(!1)},[]),Dd=b.useCallback(q=>{q.length!==0&&queueMicrotask(()=>{Si(!0),Jn.current&&window.clearTimeout(Jn.current),Jn.current=window.setTimeout(()=>Si(!1),tU+80)})},[]);b.useEffect(()=>()=>{Jn.current&&window.clearTimeout(Jn.current)},[]);const rc=no.w>0?no.w*.92:0,sc=no.h>0?no.h:0,{nodes:yr,edges:Ei}=b.useMemo(()=>xU(s.current,St,rc,sc,Nt.current,gr.current,$d.current,Dd,ro,Ni,un.current,wi.current,ms,xi,l,bi,ki,E),[s.current,s.current.revision,St,rc,sc,ro,Ni,ms,l,bi,ki,E,Ga]),gs=b.useMemo(()=>{const q=new Map;for(const ie of yr){const he=ie.data;if(!(he!=null&&he.sessionId)||he.exitAt!=null)continue;const Re=ie.width,Ie=ie.height;if(Re==null||Ie==null)continue;const Ve=ie.position.x,et=ie.position.y,rt=Ve+Re,st=et+Ie,Kt=q.get(he.sessionId);Kt?(Kt.minX=Math.min(Kt.minX,Ve),Kt.minY=Math.min(Kt.minY,et),Kt.maxX=Math.max(Kt.maxX,rt),Kt.maxY=Math.max(Kt.maxY,st)):q.set(he.sessionId,{minX:Ve,minY:et,maxX:rt,maxY:st})}const B=[];for(const[ie,he]of q){const Re=he.maxX-he.minX+Su*2,Ie=he.maxY-he.minY+Su*2;B.push({id:`group:${ie}`,type:mA,position:{x:he.minX-Su,y:he.minY-Su},data:{sessionId:ie,w:Re,h:Ie},width:Re,height:Ie,style:{width:Re,height:Ie},zIndex:-1,draggable:!0,selectable:!1,focusable:!1,deletable:!1,connectable:!1})}return B},[yr,St]),Fd=b.useMemo(()=>{const q=[...gs,...yr],B=Dt.current;return!B||B.size===0?q:q.map(ie=>{const he=B.get(ie.id);return he?{...ie,position:he}:ie})},[gs,yr,Ks]),la=b.useMemo(()=>{const q=new Set;for(const B of s.current.agents.values())for(const ie of B.tools)q.add(SA(ie.name));return Object.keys(bw).filter(B=>q.has(B))},[s.current,s.current.revision]);b.useEffect(()=>{if(la.length<=1){Pr(!1);return}let q=0;const B=()=>{const ie=Ys.current;if(ie&&!document.hidden){const he=ie.getBoundingClientRect(),Re=Array.from(document.querySelectorAll(".react-flow__node, .tool-burst")).map(Ve=>Ve.getBoundingClientRect()),Ie=A8(he,Re,8);Pr(Ve=>Ve===Ie?Ve:Ie)}q=window.setTimeout(B,300)};return B(),()=>window.clearTimeout(q)},[la.length]);const ac=b.useCallback(q=>{ea(B=>{const ie=new Set(B);return ie.has(q)?ie.delete(q):ie.add(q),ie})},[]),Yt=f?s.current.agents.get(f):null,so=h?Array.from(s.current.agents.values()).flatMap(q=>q.tools).find(q=>q.id===h)??null:null,ji=b.useCallback(async()=>{try{await fetch("/api/clear",{method:"POST"})}catch{}s.current=ow(),Nt.current.clear(),gr.current.clear(),un.current.clear(),xi.current="",Kj(),w(),i()},[i,w]),zr=b.useRef(j);zr.current=j;const oc=b.useRef(M);oc.current=M;const Ci=b.useRef(!1);Ci.current=so!=null||is||N!=null||S!=null||Ba||M||se!=null;const ao=b.useCallback(q=>{const B=p5(q,{confirmOpen:zr.current,modalOpen:Ci.current});B==="confirm"?C(!0):B==="clear"&&(C(!1),ji())},[ji]),oo=b.useCallback(()=>{Nt.current.clear(),un.current.clear(),xi.current="",Kj(),i(),window.setTimeout(()=>cn(500),80)},[i,e,cn]),Ti=b.useCallback(()=>cn(500),[cn]),vr=b.useRef(yr);vr.current=yr;const ys=b.useRef(f);ys.current=f;const Ri=b.useCallback(q=>{const B=vr.current,ie=aF(B.map(Ie=>({id:Ie.id,x:Ie.position.x,y:Ie.position.y})),ys.current,q),he=ie?B.find(Ie=>Ie.id===ie):void 0;if(!he)return;const Re=Bj(document.activeElement);y(he.id,!1),window.setTimeout(()=>{try{e.fitView({padding:.35,duration:350,nodes:[he]})}catch{}Zn.current=Date.now(),Re&&J8(he.id)},30)},[y,e]),vs=b.useCallback(q=>{y(q,!1),window.setTimeout(()=>{try{const B=vr.current.find(ie=>ie.id===q);B&&e.fitView({padding:.3,duration:500,nodes:[B]}),Zn.current=Date.now()}catch{}},60)},[y,e]);b.useEffect(()=>{const q=B=>{var et,rt;const ie=B.target,he={tagName:ie==null?void 0:ie.tagName,isContentEditable:ie==null?void 0:ie.isContentEditable,role:(et=ie==null?void 0:ie.getAttribute)==null?void 0:et.call(ie,"role"),type:ie==null?void 0:ie.type};if(B.key==="Escape"){const st=y3({overlayOpen:Hu.depth()>0,typing:Vw(he)});st==="dismiss"?Hu.dismissTop():st==="blur"?ie==null||ie.blur():(cF(he)&&(ie==null||ie.blur()),w());return}if(Gw(B))return;const Re=Bj(ie)?(rt=ie==null?void 0:ie.getAttribute)==null?void 0:rt.call(ie,"data-id"):null,Ie=Re&&vr.current.some(st=>st.id===Re)?Re:null,Ve=iF(B,Ie);if(Ve.kind==="activate"){B.preventDefault(),y(Ve.nodeId,Ve.additive);return}Ve.kind!=="node"&&(Ve.nodeId==null&&N3(he)||E3({key:B.key,modalOpen:Ci.current,sheetOpen:oc.current})||(B.key===" "&&(B.preventDefault(),cs()),(B.key==="c"||B.key==="C")&&ao("shortcut"),(B.key==="r"||B.key==="R")&&oo(),(B.key==="f"||B.key==="F")&&Ti(),(B.key==="l"||B.key==="L")&&Ar(),(B.key==="d"||B.key==="D")&&L(st=>!st),(B.key==="h"||B.key==="H")&&Us(st=>!st),(B.key==="u"||B.key==="U")&&X(st=>!st),(B.key==="a"||B.key==="A")&&xt.current.claude&&Mr(),(B.key==="j"||B.key==="J")&&Ri(1),(B.key==="k"||B.key==="K")&&Ri(-1),(B.key==="t"||B.key==="T")&&Ql(st=>st==="dark"?"light":"dark"),(B.key==="m"||B.key==="M")&&xt.current.claude&&de.current!==null&&Y.current(B.shiftKey),B.key==="?"&&$(st=>!st)))};return window.addEventListener("keydown",q),()=>window.removeEventListener("keydown",q)},[ao,oo,Ti,w,y,Ri,cs]);const ic=s.current.agents.size,$t=b.useMemo(()=>l3(s.current.agents.values()),[s.current,s.current.revision]),io=b.useMemo(()=>c3(s.current.agents.values()),[s.current,s.current.revision]),lo=b.useRef(null);b.useEffect(()=>{const q=SF({waiting:$t.length,running:io,connected:We}),B=lo.current;if(lo.current=q,(B==null?void 0:B.title)!==q.title&&(document.title=q.title),(B==null?void 0:B.icon)!==q.icon){const ie=document.querySelector('link[rel="icon"]');ie&&(ie.href=NF[q.icon])}},[$t.length,io,We]);const[lc,cc]=b.useState(""),Ai=jF($t);b.useEffect(()=>{cc(q=>CF(q,Ai))},[Ai]);const[ca,zd]=b.useState(()=>typeof Notification>"u"?"denied":Notification.permission),[Br,Mi]=b.useState(null),[Bd,Nn]=b.useState(!1),[En,co]=b.useState(!0),[uc,Ii]=b.useState(!1);b.useEffect(()=>{let q=!0;return fetch("/api/prefs").then(B=>B.ok?B.json():null).then(B=>{var ie;!q||!(B!=null&&B.ok)||(co(((ie=B.prefs)==null?void 0:ie.notifications)!==!1),Ii(B.notificationsVetoed===!0))}).catch(()=>{}),()=>{q=!1}},[]);const Oi=b.useRef(()=>{}),$i=b.useCallback(()=>{const q=!En;co(q),q&&typeof Notification<"u"&&Notification.permission==="default"&&Oi.current(),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({notifications:q})}).then(B=>B.ok?B.json():null).then(B=>{var ie;B!=null&&B.ok&&(co(((ie=B.prefs)==null?void 0:ie.notifications)!==!1),Ii(B.notificationsVetoed===!0))}).catch(()=>{})},[En]),dc=typeof Notification<"u",Pi=p3(ca,dc);b.useEffect(()=>{Pi&&En&&$t.length>0&&Nn(!0)},[Pi,En,$t.length]),b.useEffect(()=>{if(!Br)return;const B=setTimeout(()=>Mi(null),Br==="blocked"?8e3:4e3);return()=>clearTimeout(B)},[Br]);const wr=b.useCallback(()=>{typeof Notification>"u"||Notification.requestPermission().then(q=>{const B=q;zd(B),B==="granted"?Mi("on"):B==="denied"&&Mi("blocked")})},[]);Oi.current=wr;const ws=b.useRef(new Set),Ur=b.useRef(null),Li=$t.map(q=>od(q.id,q.waiting)).join("|");return b.useEffect(()=>{f3(Ur.current,ca)&&(Ur.current=ca,ws.current=mk($t))},[ca]),b.useEffect(()=>{if(typeof Notification>"u"||Notification.permission!=="granted"||Ur.current===null)return;const q=typeof document>"u"||!document.hidden,B=d3($t,ws.current,q,En);for(const ie of B)try{const he=new Notification(ie.title,{body:ie.body,tag:ie.key});he.onclick=()=>{window.focus(),vs(ie.sessionId),he.close()}}catch{}ws.current=q?mk($t):h3($t,B,ws.current)},[Li]),c.jsxs("div",{className:"app",children:[c.jsx("a",{className:"skip-link",href:"#canvas",children:"Skip to the canvas"}),c.jsxs("header",{className:"topbar",children:[c.jsxs("div",{className:"readout",children:[c.jsxs("div",{className:"brand",children:[c.jsx("span",{className:"logo"}),c.jsx("h1",{children:Ut}),Le?c.jsxs("button",{type:"button",className:"v stale",onClick:()=>{_t(),In()},"aria-haspopup":"dialog","aria-label":U8({...Le,open:nn}),title:Le.kind==="restart"?`Running v${Le.from}; v${Le.to} is installed on disk. Restart to pick it up · click for what's new`:`Running v${Le.from}; v${Le.to} is on npm · click for what's new`,children:["v",Le.from,c.jsx("span",{className:"v-dot","aria-hidden":!0})]}):(()=>{const q={running:Ee,latest:re==null?void 0:re.latest,latestPending:re==null?void 0:re.latestPending,checkedAgo:re!=null&&re.checkedAt?hw(St-re.checkedAt):null,checkDisabled:re==null?void 0:re.checkDisabled,checking:be};return c.jsxs("button",{type:"button",className:be?"v checking":"v",onClick:()=>{_t(),He(!0)},"aria-busy":be||void 0,"aria-haspopup":"dialog","aria-label":B8(q),title:z8(q),children:["v",q.running]})})()]}),c.jsx("span",{className:"status",children:(()=>{const q=Q8({connected:We,paused:Ya,held:xn.size,dropped:xn.dropped});return q.resting?null:c.jsx("span",{className:`pill ${q.tone}`,title:q.title,children:c.jsxs("span",{className:"pill-box",children:[c.jsx("span",{className:"pill-widest","aria-hidden":!0,children:q.widest}),c.jsx("span",{className:"pill-label",children:q.label})]})})})()}),c.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:lc}),$t.length>0&&c.jsxs("button",{type:"button",className:"waiting-stat",onClick:()=>vs($t[0].id),title:`Blocked waiting for you — click to go to the one that has been stuck longest:
|
|
254
|
+
${$t.map(q=>` ${q.label}: ${Tl(q.waiting)} (${hw(St-q.waiting.since)})`).join(`
|
|
255
|
+
`)}`,"aria-label":`${$t.length} session${$t.length===1?"":"s"} waiting for you`,children:[c.jsx("span",{className:"ap-pulse","aria-hidden":!0}),c.jsx("b",{children:$t.length})," waiting"]}),Bd&&Pi&&En&&c.jsx("button",{type:"button",className:"notify-ask",onClick:wr,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"}),Br&&c.jsx("span",{className:Br==="on"?"notify-said":"notify-said notify-said-blocked",role:"status",title:Br==="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:Br==="on"?"notifications on":"notifications blocked"})]}),Yt&&(()=>{const q=An(Yt),B=Math.max(0,((Yt.endedAt??St)-Yt.startedAt)/1e3),ie=Yt.state==="active"?Hw(q.total,B):null,he=l.size-1;return c.jsxs("button",{type:"button",className:"selected-ribbon",title:`Fit view to ${Yt.label}`,onClick:()=>{try{const Re=yr.find(Ie=>Ie.id===Yt.id);Re&&e.fitView({padding:.35,duration:500,nodes:[Re]}),Zn.current=Date.now()}catch{}},children:[c.jsx("span",{className:`state-pill state-${Yt.state}`,children:Yt.state==="active"?"live":Yt.state}),c.jsx("span",{className:"selected-label",children:Yt.label}),q.total>0&&c.jsxs("span",{className:"selected-cost",children:[Je(q.total),ie?c.jsxs("span",{className:"selected-rate",children:[" · ",ie]}):null]}),he>0&&c.jsxs("span",{className:"selected-extra",children:["+",he]}),c.jsx("span",{"aria-hidden":!0,className:"selected-close",onClick:Re=>{Re.stopPropagation(),w()},children:"×"})]})})(),c.jsxs("div",{className:"actions",children:[c.jsxs("div",{className:"action-run",children:[c.jsx("button",{className:"btn icon-btn",onClick:Ar,title:`${F?"Hide":"Show"} session list (L)`,"aria-label":"Toggle session list","aria-expanded":F,"aria-controls":F?"session-list":void 0,children:"☰"}),c.jsx("button",{className:"btn icon-btn",onClick:()=>X(q=>!q),title:`${H?"Hide":"Show"} usage panel (U)`,"aria-label":"Toggle usage panel","aria-expanded":H,"aria-controls":H?"usage-panel":void 0,children:"$"}),it.claude&&c.jsx("button",{className:"btn icon-btn",onClick:Mr,title:`${D?"Hide":"Show"} accounts (A)`,"aria-label":"Toggle accounts panel","aria-expanded":D,"aria-controls":D?"accounts-panel":void 0,children:c.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:[c.jsx("circle",{cx:"7",cy:"4.6",r:"2.4"}),c.jsx("path",{d:"M2.4 12c0-2.3 2.1-3.7 4.6-3.7s4.6 1.4 4.6 3.7"})]})}),c.jsx("button",{className:"btn icon-btn",onClick:()=>K(q=>!q),title:`${T?"Hide":"Show"} this machine — cores, memory, temperature`,"aria-label":"Toggle machine detail","aria-expanded":T,"aria-controls":T?"system-panel":void 0,children:c.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round","aria-hidden":!0,children:[c.jsx("rect",{x:"3.6",y:"3.6",width:"6.8",height:"6.8",rx:"1.2"}),c.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"})]})}),c.jsx("button",{className:"btn icon-btn",onClick:()=>Us(q=>!q),title:"Usage history — ccusage (H)","aria-label":"Open usage history","aria-haspopup":"dialog",children:c.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round","aria-hidden":!0,children:[c.jsx("line",{x1:"3",y1:"11.5",x2:"3",y2:"7"}),c.jsx("line",{x1:"7",y1:"11.5",x2:"7",y2:"3"}),c.jsx("line",{x1:"11",y1:"11.5",x2:"11",y2:"8.5"})]})}),c.jsxs("button",{className:`btn icon-btn bw-btn${$n>0?" has-findings":Ir?" watching":""}`,onClick:()=>Ws(q=>!q),title:Ir?"Browser watch — watching; the deck is keeping its own copy":"Browser watch — not watching; reading the browser's history live","aria-label":`Browser watch, ${Ir?"watching":"not watching"}`+($n>0?`, ${$n} unread`:""),"aria-haspopup":"dialog",children:[c.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5","aria-hidden":!0,children:[c.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"}),Ir||$n>0?c.jsx("circle",{cx:"7",cy:"7",r:"1.8",fill:"currentColor",stroke:"none"}):c.jsx("line",{x1:"2.4",y1:"11.6",x2:"11.6",y2:"2.4"})]}),$n>0&&c.jsx("span",{className:"bw-badge","aria-hidden":!0,children:$n})]})]}),c.jsxs("div",{className:"action-run",children:[it.claude&&Z!==null&&c.jsxs("div",{className:"sound-slot",children:[c.jsx("button",{ref:ce,className:"btn icon-btn",onClick:()=>Ne(q=>!q),...cr(!1),title:$F(it,{on:Z===!0,locked:Ce==="locked",prefs:U}),"aria-label":"Sound settings","aria-haspopup":"dialog","aria-expanded":ge,"aria-controls":ge?"sound-menu":void 0,children:c.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:[c.jsx("path",{d:"M3.2 5.2h2L7.8 3v8L5.2 8.8h-2z"}),Z?c.jsxs(c.Fragment,{children:[c.jsx("path",{d:"M9.8 5.4a2.4 2.4 0 0 1 0 3.2"}),c.jsx("path",{d:"M11.3 3.9a4.6 4.6 0 0 1 0 6.2"})]}):c.jsxs(c.Fragment,{children:[c.jsx("path",{d:"M10 5.6l2.6 2.8"}),c.jsx("path",{d:"M12.6 5.6L10 8.4"})]})]})}),ge&&c.jsx(B5,{onClose:()=>Ne(!1),soundOn:Z===!0,onToggleSound:J,prefs:U,onLevel:(q,B)=>pe(q,{level:B}),onFigure:(q,B)=>pe(q,{figure:B}),onPreview:q=>le(q),notifyOn:En,onToggleNotify:$i,notifyVetoed:uc,notifyPermission:dc?ca:"unsupported",onAskNotify:wr,openerRef:ce})]}),c.jsx("button",{className:"btn icon-btn",onClick:()=>Ql(q=>q==="dark"?"light":"dark"),title:`Switch to ${ln==="dark"?"light":"dark"} mode (T)`,"aria-label":"Toggle theme",children:ln==="dark"?"☀":"☾"})]})]})]}),Xl?c.jsxs("div",{className:"ver-banner done",role:"status",children:[c.jsx("span",{className:"ver-dot"}),c.jsxs("strong",{children:["Restarted — now running v",Xl,"."]}),c.jsx("span",{className:"ver-sub",children:"The canvas replayed from the event log."})]}):mi&&!We?c.jsxs("div",{className:"conn-banner",role:"alert",children:[c.jsx("span",{className:"conn-dot"}),Ln?ui==="npx"?"Fetching the new version with npx — this can take a minute…":`Restarting ${Ut}…`:(()=>{const q=K8({connected:We,paused:Ya});return c.jsxs(c.Fragment,{children:[`Lost connection to the ${Ut} server. Reconnecting…`,q&&c.jsx("span",{className:"conn-sub",children:q})]})})()]}):nn&&Le?c.jsxs("div",{className:`ver-banner ${Le.kind}`,role:"status",children:[c.jsx("span",{className:`ver-dot${Qa==null?"":" armed"}`}),Le.kind==="restart"?c.jsxs(c.Fragment,{children:[c.jsxs("strong",{children:["v",Le.to," is installed — this deck still runs v",Le.from,"."]}),re!=null&&re.canRestart?c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",className:"ver-act",onClick:()=>us(),...cr(Ln),title:`Stop this process and bring it back on the same port. The canvas replays from the event log.
|
|
256
|
+
|
|
257
|
+
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:Ln?"restarting…":pi.label}),!Ln&&c.jsx("span",{className:"ver-sub",children:pi.clause}),c.jsxs("button",{type:"button",className:`ver-auto${Pn?" on":""}`,role:"switch","aria-checked":Pn,onClick:Td,"aria-label":"Auto-restart when idle",title:Pn?"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:[c.jsx("i",{"aria-hidden":!0}),c.jsx("span",{"aria-hidden":!0,children:d5(Pn,Qa)})]})]}):c.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."})]}):c.jsxs(c.Fragment,{children:[c.jsxs("strong",{children:[Ut," v",Le.to," is out — you are on v",Le.from,"."]}),(re==null?void 0:re.upgradeMode)==="install"&&Ot!=="failed"&&c.jsx("button",{type:"button",className:"ver-act",onClick:li,...cr(Ot==="running",Ot==="done"),title:`Runs ${((ua=re==null?void 0:re.upgrade)==null?void 0:ua.command)??(re==null?void 0:re.command)??"npm i -g"} here, then restarts once nothing is running.`,children:Ot==="running"?"installing…":Ot==="done"?"installed":"Update now"}),(re==null?void 0:re.upgradeMode)==="npx"&&(re==null?void 0:re.canRestart)&&c.jsx("button",{type:"button",className:"ver-act",onClick:()=>us({upgrade:!0}),...cr(Ln),title:`Runs ${re==null?void 0:re.command} and hands it this port. Nothing is installed globally — npx unpacks its own copy.`,children:Ln?"fetching…":Ot==="failed"?"Retry update":"Update & restart"}),Ot==="failed"?c.jsxs("span",{className:"ver-sub fail",title:((Wr=re==null?void 0:re.upgrade)==null?void 0:Wr.error)??"",children:[(re==null?void 0:re.upgradeMode)==="npx"?"update failed":"install failed",": ",((uo=re==null?void 0:re.upgrade)==null?void 0:uo.error)??"unknown error"," — run it yourself:"]}):(re==null?void 0:re.upgradeMode)==="npx"?c.jsx("span",{className:"ver-sub",children:re!=null&&re.canRestart?"npx cannot upgrade in place, so the deck re-runs:":Bv.npx}):re!=null&&re.upgradeBlocked?c.jsx("span",{className:"ver-sub",children:Object.hasOwn(Bv,re.upgradeBlocked)?Bv[re.upgradeBlocked]:"cannot install from here"}):null,c.jsxs("button",{type:"button",className:"ver-cmd",onClick:Rr,title:"Copy to clipboard",children:[c.jsx("code",{children:re==null?void 0:re.command}),c.jsx("span",{className:"ver-cmd-hint",children:at?"copied":"copy"})]})]}),c.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:qa,children:"×"})]}):Bs&&wn?c.jsxs("div",{className:"ver-banner",role:"status",children:[c.jsx("span",{className:"ver-dot"}),c.jsxs("strong",{children:[wn," still works — the deck is called ",Ut," now."]}),re!=null&&re.renameFix?c.jsx("span",{className:"ver-sub",children:re.renameFix}):null,c.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:za,children:"×"})]}):null,H&&c.jsx(mq,{state:s.current,now:St,providers:it,onClose:()=>X(!1)}),D&&it.claude&&c.jsx(s5,{onClose:()=>te(!1)}),T&&c.jsx(Hq,{usageOpen:H,onClose:()=>K(!1)}),F&&c.jsx(q4,{state:s.current,now:St,selectedIds:l,onSelect:vs,onClose:()=>O(!1)}),c.jsxs("main",{id:"canvas",tabIndex:-1,className:`canvas-wrap${Ld?" bubbling":""}${Ni?" dragging-any":""}`,ref:_i,onMouseDownCapture:Od,onPointerDownCapture:Ja,onPointerUpCapture:Ja,onWheelCapture:Ja,children:[ic===0&&c.jsx(_U,{live:We,everConnected:mi,providers:it,workspace:vt}),(la.length>1||Lr.size>0)&&c.jsx("div",{ref:Ys,className:`cat-filter-bar${Va?" occluded":""}`,role:"group","aria-label":"Filter tools by category",children:la.map(q=>{const B=Lr.has(q);return c.jsxs("button",{type:"button",className:`cat-filter${B?" off":""}`,onClick:()=>ac(q),"aria-pressed":!B,title:`${B?"Show":"Hide"} ${kw[q]} tools`,children:[c.jsx("span",{className:"cat-emoji",children:bw[q]}),c.jsx("span",{className:"cat-name",children:kw[q]})]},q)})}),c.jsxs(pT,{nodes:Fd,edges:Ei,nodeTypes:Z8,fitView:!kn,fitViewOptions:{padding:.25,duration:Dv({durationMs:Uj,documentHidden:document.hidden})?Uj:0},minZoom:.2,maxZoom:1.6,panOnScroll:!0,nodesDraggable:!0,nodesConnectable:!1,selectionOnDrag:!1,nodeDragThreshold:5,onNodeClick:(q,B)=>{if(B.type==="sessionGroup"){w();return}y(B.id,q.shiftKey)},onPaneClick:()=>w(),onMoveStart:q=>{Dj(aa(q))&&Fr()},onMove:(q,B)=>{Sn(),Dj(aa(q))&&Fr(),na.current&&window.clearTimeout(na.current),na.current=window.setTimeout(()=>vU(B),250)},onNodeDragStart:(q,B)=>{var ie;if(qd(),oa.current=!0,Dt.current=new Map,nc(!0),Sn(),Fr(),B.type==="sessionGroup"){const he=(ie=B.data)==null?void 0:ie.sessionId,Re=new Map;if(he)for(const Ie of yr){const Ve=Ie.data;(Ve==null?void 0:Ve.sessionId)===he&&Re.set(Ie.id,{x:Ie.position.x,y:Ie.position.y})}bn.current={start:{x:B.position.x,y:B.position.y},members:Re};return}Nt.current.set(B.id,{x:B.position.x,y:B.position.y})},onNodeDrag:(q,B)=>{var ie;if(Sn(),B.type==="sessionGroup"){const he=bn.current;if(!he)return;const Re=B.position.x-he.start.x,Ie=B.position.y-he.start.y;for(const[et,rt]of he.members){const st={x:rt.x+Re,y:rt.y+Ie};Nt.current.set(et,st),un.current.set(et,st)}const Ve=Dt.current;if(Ve){for(const[et,rt]of he.members)Ve.set(et,{x:rt.x+Re,y:rt.y+Ie});Ve.set(B.id,{x:B.position.x,y:B.position.y})}on(et=>et+1);return}Nt.current.set(B.id,{x:B.position.x,y:B.position.y}),un.current.set(B.id,{x:B.position.x,y:B.position.y}),(ie=Dt.current)==null||ie.set(B.id,{x:B.position.x,y:B.position.y}),on(he=>he+1)},onNodeDragStop:(q,B)=>{if(Sn(),oa.current=!1,Dt.current=null,nc(!1),$r(ie=>ie+1),B.type==="sessionGroup"){const ie=bn.current;if(ie){const he=B.position.x-ie.start.x,Re=B.position.y-ie.start.y;for(const[Ie,Ve]of ie.members){const et={x:Ve.x+he,y:Ve.y+Re};Nt.current.set(Ie,et),un.current.set(Ie,et)}}bn.current=null,Uv(un.current,Nt.current),$r(he=>he+1);return}Nt.current.set(B.id,{x:B.position.x,y:B.position.y}),un.current.set(B.id,{x:B.position.x,y:B.position.y}),Uv(un.current,Nt.current)},children:[c.jsx(bL,{gap:28,size:1,color:Xn["--grid-line"]}),c.jsx(K3,{onFit:()=>{Zn.current=Date.now()}}),c.jsx(R4,{agents:s.current.agents,visibleAgentIds:ki,positions:un.current,pinned:Nt.current,measured:gr.current,spotlight:bi,hiddenCategories:Lr,now:St,onOpenTool:g}),c.jsxs(mL,{showInteractive:!1,children:[c.jsx(Er,{onClick:Md,title:Dr?"Recenter view + re-enable autofit":"Recenter view (autofit already on)","aria-label":"Recenter view",style:Dr?{color:"var(--accent)"}:void 0,children:c.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[c.jsx("circle",{cx:"12",cy:"12",r:"3.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),c.jsx("path",{d:"M12 2v4M12 18v4M2 12h4M18 12h4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})]})}),c.jsx(Er,{onClick:cs,title:Y8({paused:Ya,held:xn.size,dropped:xn.dropped}),"aria-label":V8,"aria-pressed":Ya,children:c.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:c.jsx("path",{d:"M9 5.5v13M15 5.5v13",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})})}),c.jsx(Er,{onClick:oo,title:"Auto-arrange — clear pins (R)","aria-label":"Re-arrange the canvas",children:c.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[c.jsx("rect",{x:"8.5",y:"2",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),c.jsx("rect",{x:"1.5",y:"17",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),c.jsx("rect",{x:"15.5",y:"17",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),c.jsx("path",{d:"M12 7v6.5M5 17v-3.5h14V17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]})}),c.jsx(Er,{onClick:()=>ao("button"),title:"Clear the canvas and the server's event log — asks first (C)","aria-label":"Clear the canvas",children:c.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[c.jsx("path",{d:"M4 6.2h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"}),c.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"}),c.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"}),c.jsx("path",{d:"M10.3 10.6v6.8M13.7 10.6v6.8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})]})}),c.jsx(Er,{onClick:()=>$(q=>!q),title:"Keyboard shortcuts (?)","aria-label":"Open the keyboard shortcuts","aria-haspopup":"dialog",children:c.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[c.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"}),c.jsx("path",{d:"M12 18.4v.2",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",fill:"none"})]})})]}),c.jsx(lL,{zoomable:!0,pannable:!0,nodeColor:Jl,nodeStrokeWidth:2,maskColor:Xn["--minimap-mask"],style:Za})]})]}),A&&Yt?c.jsxs("aside",{className:"detail","aria-label":"Detail",children:[c.jsx("button",{type:"button",className:"glyph-btn detail-close",title:"Close panel","aria-label":"Close detail panel",onClick:()=>L(!1),children:"×"}),c.jsx(NU,{agent:Yt,now:St,onOpenTool:g,onShowSummary:q=>{I.has(q)&&(I.delete(q),Yj(I)),k(q)},onExportSession:q=>wU(s.current,q)})]}):null,so&&c.jsx(F3,{tool:so,onClose:()=>g(null)}),is&&c.jsx(FF,{providers:it,onClose:()=>Us(!1)}),Ba&&c.jsx(ZF,{onClose:()=>Ws(!1),onSeen:q=>{Ua(q);try{localStorage.setItem(f1,String(q))}catch{}},onWatching:Gs,palette:Xn}),N&&(()=>{const q=s.current.agents.get(N);return q?c.jsx(M3,{agent:q,onClose:()=>_(null)}):null})(),S&&c.jsx($4,{state:s.current,sessionId:S,onClose:()=>{I.add(S),Yj(I),k(null)}}),se&&c.jsx(rF,{entries:se.entries,since:se.since,firstRun:se.firstRun,running:Ee,onClose:()=>je(null)}),(()=>{const{request:q,waiting:B}=e6(Wa,Vs.current);return q?c.jsx(t6,{request:q,waiting:B,busy:ls,now:Date.now(),onAccept:()=>void Ha("accept",q.fp),onDecline:()=>void Ha("dismiss",q.fp),onLater:()=>{ls||(Vs.current.add(q.fp),Or(ie=>[...ie]))}}):null})(),M&&c.jsx(b5,{onClose:()=>$(!1)}),j&&c.jsx(v5,{agentCount:ic,onConfirm:()=>ao("confirmation"),onCancel:()=>C(!1)})]})}function _U({live:e,everConnected:t,providers:n,workspace:s}){const a=!e;return c.jsxs("div",{className:"empty-hero",children:[c.jsxs("div",{className:"orbit-stack","aria-hidden":!0,children:[c.jsx("div",{className:"core"}),c.jsxs("div",{className:"orbit r1",children:[c.jsx("span",{className:"dot"}),c.jsx("span",{className:"dot b"})]}),c.jsxs("div",{className:"orbit r2",children:[c.jsx("span",{className:"dot"}),c.jsx("span",{className:"dot b"})]}),c.jsxs("div",{className:"orbit r3",children:[c.jsx("span",{className:"dot"}),c.jsx("span",{className:"dot b"})]})]}),a?c.jsxs(c.Fragment,{children:[c.jsx("h2",{children:t?"Disconnected from server":"Server unreachable"}),c.jsxs("p",{children:["The browser cannot reach ",c.jsx("code",{children:"/events"}),". Check that",c.jsx("code",{children:Ut})," is still running in your terminal, then this page will resume automatically."]})]}):SU(n,s)]})}function SU(e,t){const n=W8(t);return c.jsxs(c.Fragment,{children:[c.jsx("h2",{children:"Waiting for Claude Code or Codex"}),n.kind==="scoped"?c.jsxs("p",{children:[n.lead," ",c.jsx("code",{children:n.workspace}),n.tail]}):c.jsxs("p",{children:["Run ",c.jsx("code",{children:"claude"})," or ",c.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."]}),c.jsxs("p",{className:"hint-row",children:["Not seeing anything? Make sure ",c.jsx("code",{children:Ut})," is running."]}),OF(e).map(s=>c.jsx("p",{className:"hint-row",children:s.spans.map((a,i)=>a.code?c.jsx("code",{children:a.text},i):c.jsx("span",{children:a.text},i))},s.provider))]})}function NU({agent:e,now:t,onOpenTool:n,onShowSummary:s,onExportSession:a}){const i=Wu(e.startedAt,e.endedAt,t),l=An(e),d=l.total>0,f=e.usage.inputTokens+e.usage.outputTokens,p=new Map;for(const S of e.tools){const k=SA(S.name);p.set(k,(p.get(k)??0)+1)}const h=e.tools.filter(S=>S.ok===!1).length,g=e.tools.filter(S=>!S.endedAt).length,y=Array.from(p.entries()).sort((S,k)=>k[1]-S[1]),w=p.has("mcp")?N4(e.tools.map(S=>S.name)):null;return c.jsxs(c.Fragment,{children:[c.jsxs("header",{className:"detail-hero",children:[c.jsxs("div",{className:"hero-line",children:[c.jsx("span",{className:`state-pill state-${e.state}`,children:e.state==="active"?"live":e.state}),c.jsx("h2",{className:"hero-title",title:e.cwd??e.label,children:e.label})]}),c.jsxs("div",{className:"hero-meta",children:[c.jsx("span",{className:"hero-meta-item",children:e.kind}),c.jsx("span",{className:"hero-sep",children:"·"}),c.jsx("span",{className:"hero-meta-item",title:`started ${new Date(e.startedAt).toLocaleString()}`,children:i}),e.model&&(()=>{const S=TT(e);return c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"hero-sep",children:"·"}),c.jsxs("span",{className:"model-chip","data-family":ad(e.model),title:S.length>0?`${e.model}
|
|
258
|
+
spend on this panel also covers:
|
|
259
|
+
${S.join(`
|
|
260
|
+
`)}`:e.model,children:[Fs(e.model),S.length>0?` +${S.length}`:""]})]})})()]}),d&&c.jsxs("div",{className:"hero-cost",children:[c.jsxs("div",{className:"hero-cost-headline",children:[c.jsx("span",{className:"hero-cost-value",children:Je(l.total)}),c.jsx("span",{className:"hero-cost-label",children:"spend"})]}),c.jsx(Kw,{cost:l})]}),c.jsxs("div",{className:"hero-actions",children:[e.kind==="root"&&e.state==="done"&&s&&c.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&&c.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&&c.jsxs("section",{className:"detail-section",children:[c.jsx("h3",{children:"Activity"}),c.jsxs("div",{className:"activity-row",children:[c.jsxs("div",{className:"activity-counters",children:[c.jsxs("span",{className:"ac-item",children:[c.jsx("b",{children:e.toolCount})," calls"]}),g>0&&c.jsxs("span",{className:"ac-item ac-live",children:[c.jsx("b",{children:g})," live"]}),h>0&&c.jsxs("span",{className:"ac-item ac-err",children:[c.jsx("b",{children:h})," err"]})]}),c.jsx("div",{className:"cat-strip",children:y.map(([S,k])=>{const N=S==="mcp"?w:null,_=N==null?void 0:N.hue,E=`${k} ${kw[S]} call${k===1?"":"s"}`;return c.jsxs("span",{className:`cat-chip cat-${S}${_!=null?" mcp-hue":""}`,style:_!=null?{"--mcp-hue":_}:void 0,title:N?`${E}, all to ${N.label}`:E,children:[c.jsx("span",{className:"cat-emoji",children:bw[S]}),c.jsx("span",{className:"cat-count",children:k}),N&&c.jsx("span",{className:"cat-server",children:N.label})]},S)})})]})]}),f>0&&c.jsxs("section",{className:"detail-section",children:[c.jsx("h3",{children:"Tokens"}),c.jsxs("div",{className:"tokens-grid",children:[c.jsxs("div",{children:[c.jsx("span",{className:"k",children:"in"}),c.jsx("b",{children:e.usage.inputTokens.toLocaleString()})]}),c.jsxs("div",{children:[c.jsx("span",{className:"k",children:"out"}),c.jsx("b",{children:e.usage.outputTokens.toLocaleString()})]}),c.jsxs("div",{children:[c.jsx("span",{className:"k",children:"cache r"}),c.jsx("b",{children:e.usage.cacheReadTokens.toLocaleString()})]}),c.jsxs("div",{children:[c.jsx("span",{className:"k",children:"cache c"}),c.jsx("b",{children:e.usage.cacheCreateTokens.toLocaleString()})]})]})]}),c.jsxs("section",{className:"detail-section",children:[c.jsx("h3",{children:"Identity"}),c.jsxs("div",{children:[e.cwd&&c.jsxs("div",{className:"row",children:[c.jsx("span",{className:"k",children:"cwd"}),c.jsx("span",{className:"v",title:e.cwd,children:e.cwd})]}),c.jsxs("div",{className:"row",children:[c.jsx("span",{className:"k",children:"session"}),c.jsxs("span",{className:"v",children:[e.sessionId.slice(0,12),"…"]})]}),e.parentId&&c.jsxs("div",{className:"row",children:[c.jsx("span",{className:"k",children:"parent"}),c.jsxs("span",{className:"v",children:[e.parentId.slice(0,12),"…"]})]})]})]}),e.prompts.length>0&&c.jsxs("section",{className:"detail-section",children:[c.jsxs("h3",{children:["Prompts ",c.jsx("span",{className:"section-count",children:e.prompts.length})]}),c.jsx("div",{className:"prompts",children:e.prompts.slice().reverse().map((S,k)=>{const N=J4(S.at,t);return c.jsxs("div",{className:"prompt-entry",children:[c.jsx("div",{className:"prompt-time",title:N.title,children:N.label}),c.jsx("div",{className:"prompt-text",children:S.text})]},k)})})]}),c.jsxs("section",{className:"detail-section",children:[c.jsxs("h3",{children:["Tool calls ",c.jsx("span",{className:"section-count",children:e.tools.length})]}),e.tools.length===0&&c.jsx("div",{className:"empty",children:"No tool calls yet."}),c.jsx("div",{children:e.tools.slice().reverse().map(S=>c.jsx(jU,{t:S,onClick:()=>n(S.id)},S.id))})]})]})}const EU={inflight:"in-flight",done:"done",err:"error"};function jU({t:e,onClick:t}){const n=e.endedAt==null?"inflight":e.ok===!1?"err":"done",s=AT(e,"…");return c.jsxs("button",{className:"tool clickable",title:e.inputPreview||e.name,onClick:t,children:[c.jsxs("span",{className:"name",children:[c.jsx("span",{className:`status-dot ${n}`,"aria-hidden":!0}),c.jsx("span",{className:"vis-hidden",children:EU[n]}),e.name]}),c.jsx("span",{style:{color:"var(--muted)"},children:s})]})}try{Q4(window.localStorage)}catch{}const CU=xM.createRoot(document.getElementById("root"));CU.render(c.jsx(bU,{}));
|