ccdeck 3.27.6 → 3.28.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/bin/deck.js +8 -0
- package/dist/web/assets/{BrowserWatchModal-Co4YHA59.js → BrowserWatchModal-CMCvd-Zt.js} +1 -1
- package/dist/web/assets/{UsageHistoryModal-DuvLGQcU.js → UsageHistoryModal-BRY_LA4K.js} +1 -1
- package/dist/web/assets/index-C6jDY-YA.js +297 -0
- package/dist/web/assets/index-DbwzUUcd.css +1 -0
- package/dist/web/icon-192.png +0 -0
- package/dist/web/icon-512.png +0 -0
- package/dist/web/icon-maskable-512.png +0 -0
- package/dist/web/icon-maskable.svg +21 -0
- package/dist/web/icon.svg +24 -0
- package/dist/web/index.html +20 -2
- package/dist/web/manifest.webmanifest +17 -0
- package/hook/hook.js +75 -4
- package/package.json +1 -1
- package/release-notes.json +3 -1
- package/src/server/app-manifest.mjs +55 -0
- package/src/server/deck-prefs.mjs +14 -6
- package/src/server/deck-probe.mjs +15 -1
- package/src/server/index.mjs +45 -5
- package/src/server/lan-engine.mjs +31 -7
- package/src/server/self-update.mjs +60 -11
- package/src/server/static-cache.mjs +1 -1
- package/src/server/way-back.mjs +104 -0
- package/dist/web/assets/index-Bv8dYdRM.css +0 -1
- package/dist/web/assets/index-CZPbELsO.js +0 -297
|
@@ -0,0 +1,297 @@
|
|
|
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"]'))r(a);new MutationObserver(a=>{for(const l of a)if(l.type==="childList")for(const c of l.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&r(c)}).observe(document,{childList:!0,subtree:!0});function n(a){const l={};return a.integrity&&(l.integrity=a.integrity),a.referrerPolicy&&(l.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?l.credentials="include":a.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function r(a){if(a.ep)return;a.ep=!0;const l=n(a);fetch(a.href,l)}})();var vd=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function w0(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var bp={exports:{}},mc={},kp={exports:{}},ut={};/**
|
|
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 s1;function A$(){if(s1)return ut;s1=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),l=Symbol.for("react.provider"),c=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),m=Symbol.iterator;function y(B){return B===null||typeof B!="object"?null:(B=m&&B[m]||B["@@iterator"],typeof B=="function"?B:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_=Object.assign,k={};function j(B,Y,ue){this.props=B,this.context=Y,this.refs=k,this.updater=ue||w}j.prototype.isReactComponent={},j.prototype.setState=function(B,Y){if(typeof B!="object"&&typeof B!="function"&&B!=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,B,Y,"setState")},j.prototype.forceUpdate=function(B){this.updater.enqueueForceUpdate(this,B,"forceUpdate")};function b(){}b.prototype=j.prototype;function S(B,Y,ue){this.props=B,this.context=Y,this.refs=k,this.updater=ue||w}var E=S.prototype=new b;E.constructor=S,_(E,j.prototype),E.isPureReactComponent=!0;var C=Array.isArray,T=Object.prototype.hasOwnProperty,R={current:null},A={key:!0,ref:!0,__self:!0,__source:!0};function q(B,Y,ue){var G,ee={},L=null,te=null;if(Y!=null)for(G in Y.ref!==void 0&&(te=Y.ref),Y.key!==void 0&&(L=""+Y.key),Y)T.call(Y,G)&&!A.hasOwnProperty(G)&&(ee[G]=Y[G]);var ne=arguments.length-2;if(ne===1)ee.children=ue;else if(1<ne){for(var ie=Array(ne),me=0;me<ne;me++)ie[me]=arguments[me+2];ee.children=ie}if(B&&B.defaultProps)for(G in ne=B.defaultProps,ne)ee[G]===void 0&&(ee[G]=ne[G]);return{$$typeof:e,type:B,key:L,ref:te,props:ee,_owner:R.current}}function F(B,Y){return{$$typeof:e,type:B.type,key:Y,ref:B.ref,props:B.props,_owner:B._owner}}function O(B){return typeof B=="object"&&B!==null&&B.$$typeof===e}function H(B){var Y={"=":"=0",":":"=2"};return"$"+B.replace(/[=:]/g,function(ue){return Y[ue]})}var K=/\/+/g;function X(B,Y){return typeof B=="object"&&B!==null&&B.key!=null?H(""+B.key):Y.toString(36)}function I(B,Y,ue,G,ee){var L=typeof B;(L==="undefined"||L==="boolean")&&(B=null);var te=!1;if(B===null)te=!0;else switch(L){case"string":case"number":te=!0;break;case"object":switch(B.$$typeof){case e:case t:te=!0}}if(te)return te=B,ee=ee(te),B=G===""?"."+X(te,0):G,C(ee)?(ue="",B!=null&&(ue=B.replace(K,"$&/")+"/"),I(ee,Y,ue,"",function(me){return me})):ee!=null&&(O(ee)&&(ee=F(ee,ue+(!ee.key||te&&te.key===ee.key?"":(""+ee.key).replace(K,"$&/")+"/")+B)),Y.push(ee)),1;if(te=0,G=G===""?".":G+":",C(B))for(var ne=0;ne<B.length;ne++){L=B[ne];var ie=G+X(L,ne);te+=I(L,Y,ue,ie,ee)}else if(ie=y(B),typeof ie=="function")for(B=ie.call(B),ne=0;!(L=B.next()).done;)L=L.value,ie=G+X(L,ne++),te+=I(L,Y,ue,ie,ee);else if(L==="object")throw Y=String(B),Error("Objects are not valid as a React child (found: "+(Y==="[object Object]"?"object with keys {"+Object.keys(B).join(", ")+"}":Y)+"). If you meant to render a collection of children, use an array instead.");return te}function Z(B,Y,ue){if(B==null)return B;var G=[],ee=0;return I(B,G,"","",function(L){return Y.call(ue,L,ee++)}),G}function W(B){if(B._status===-1){var Y=B._result;Y=Y(),Y.then(function(ue){(B._status===0||B._status===-1)&&(B._status=1,B._result=ue)},function(ue){(B._status===0||B._status===-1)&&(B._status=2,B._result=ue)}),B._status===-1&&(B._status=0,B._result=Y)}if(B._status===1)return B._result.default;throw B._result}var $={current:null},z={transition:null},U={ReactCurrentDispatcher:$,ReactCurrentBatchConfig:z,ReactCurrentOwner:R};function V(){throw Error("act(...) is not supported in production builds of React.")}return ut.Children={map:Z,forEach:function(B,Y,ue){Z(B,function(){Y.apply(this,arguments)},ue)},count:function(B){var Y=0;return Z(B,function(){Y++}),Y},toArray:function(B){return Z(B,function(Y){return Y})||[]},only:function(B){if(!O(B))throw Error("React.Children.only expected to receive a single React element child.");return B}},ut.Component=j,ut.Fragment=n,ut.Profiler=a,ut.PureComponent=S,ut.StrictMode=r,ut.Suspense=f,ut.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=U,ut.act=V,ut.cloneElement=function(B,Y,ue){if(B==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+B+".");var G=_({},B.props),ee=B.key,L=B.ref,te=B._owner;if(Y!=null){if(Y.ref!==void 0&&(L=Y.ref,te=R.current),Y.key!==void 0&&(ee=""+Y.key),B.type&&B.type.defaultProps)var ne=B.type.defaultProps;for(ie in Y)T.call(Y,ie)&&!A.hasOwnProperty(ie)&&(G[ie]=Y[ie]===void 0&&ne!==void 0?ne[ie]:Y[ie])}var ie=arguments.length-2;if(ie===1)G.children=ue;else if(1<ie){ne=Array(ie);for(var me=0;me<ie;me++)ne[me]=arguments[me+2];G.children=ne}return{$$typeof:e,type:B.type,key:ee,ref:L,props:G,_owner:te}},ut.createContext=function(B){return B={$$typeof:c,_currentValue:B,_currentValue2:B,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},B.Provider={$$typeof:l,_context:B},B.Consumer=B},ut.createElement=q,ut.createFactory=function(B){var Y=q.bind(null,B);return Y.type=B,Y},ut.createRef=function(){return{current:null}},ut.forwardRef=function(B){return{$$typeof:u,render:B}},ut.isValidElement=O,ut.lazy=function(B){return{$$typeof:h,_payload:{_status:-1,_result:B},_init:W}},ut.memo=function(B,Y){return{$$typeof:p,type:B,compare:Y===void 0?null:Y}},ut.startTransition=function(B){var Y=z.transition;z.transition={};try{B()}finally{z.transition=Y}},ut.unstable_act=V,ut.useCallback=function(B,Y){return $.current.useCallback(B,Y)},ut.useContext=function(B){return $.current.useContext(B)},ut.useDebugValue=function(){},ut.useDeferredValue=function(B){return $.current.useDeferredValue(B)},ut.useEffect=function(B,Y){return $.current.useEffect(B,Y)},ut.useId=function(){return $.current.useId()},ut.useImperativeHandle=function(B,Y,ue){return $.current.useImperativeHandle(B,Y,ue)},ut.useInsertionEffect=function(B,Y){return $.current.useInsertionEffect(B,Y)},ut.useLayoutEffect=function(B,Y){return $.current.useLayoutEffect(B,Y)},ut.useMemo=function(B,Y){return $.current.useMemo(B,Y)},ut.useReducer=function(B,Y,ue){return $.current.useReducer(B,Y,ue)},ut.useRef=function(B){return $.current.useRef(B)},ut.useState=function(B){return $.current.useState(B)},ut.useSyncExternalStore=function(B,Y,ue){return $.current.useSyncExternalStore(B,Y,ue)},ut.useTransition=function(){return $.current.useTransition()},ut.version="18.3.1",ut}var a1;function eu(){return a1||(a1=1,kp.exports=A$()),kp.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 o1;function R$(){if(o1)return mc;o1=1;var e=eu(),t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,a=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function c(u,f,p){var h,m={},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)r.call(f,h)&&!l.hasOwnProperty(h)&&(m[h]=f[h]);if(u&&u.defaultProps)for(h in f=u.defaultProps,f)m[h]===void 0&&(m[h]=f[h]);return{$$typeof:t,type:u,key:y,ref:w,props:m,_owner:a.current}}return mc.Fragment=n,mc.jsx=c,mc.jsxs=c,mc}var i1;function M$(){return i1||(i1=1,bp.exports=R$()),bp.exports}var o=M$(),xd={},Np={exports:{}},zn={},_p={exports:{}},Sp={};/**
|
|
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 l1;function I$(){return l1||(l1=1,(function(e){function t(z,U){var V=z.length;z.push(U);e:for(;0<V;){var B=V-1>>>1,Y=z[B];if(0<a(Y,U))z[B]=U,z[V]=Y,V=B;else break e}}function n(z){return z.length===0?null:z[0]}function r(z){if(z.length===0)return null;var U=z[0],V=z.pop();if(V!==U){z[0]=V;e:for(var B=0,Y=z.length,ue=Y>>>1;B<ue;){var G=2*(B+1)-1,ee=z[G],L=G+1,te=z[L];if(0>a(ee,V))L<Y&&0>a(te,ee)?(z[B]=te,z[L]=V,B=L):(z[B]=ee,z[G]=V,B=G);else if(L<Y&&0>a(te,V))z[B]=te,z[L]=V,B=L;else break e}}return U}function a(z,U){var V=z.sortIndex-U.sortIndex;return V!==0?V:z.id-U.id}if(typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var c=Date,u=c.now();e.unstable_now=function(){return c.now()-u}}var f=[],p=[],h=1,m=null,y=3,w=!1,_=!1,k=!1,j=typeof setTimeout=="function"?setTimeout:null,b=typeof clearTimeout=="function"?clearTimeout:null,S=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function E(z){for(var U=n(p);U!==null;){if(U.callback===null)r(p);else if(U.startTime<=z)r(p),U.sortIndex=U.expirationTime,t(f,U);else break;U=n(p)}}function C(z){if(k=!1,E(z),!_)if(n(f)!==null)_=!0,W(T);else{var U=n(p);U!==null&&$(C,U.startTime-z)}}function T(z,U){_=!1,k&&(k=!1,b(q),q=-1),w=!0;var V=y;try{for(E(U),m=n(f);m!==null&&(!(m.expirationTime>U)||z&&!H());){var B=m.callback;if(typeof B=="function"){m.callback=null,y=m.priorityLevel;var Y=B(m.expirationTime<=U);U=e.unstable_now(),typeof Y=="function"?m.callback=Y:m===n(f)&&r(f),E(U)}else r(f);m=n(f)}if(m!==null)var ue=!0;else{var G=n(p);G!==null&&$(C,G.startTime-U),ue=!1}return ue}finally{m=null,y=V,w=!1}}var R=!1,A=null,q=-1,F=5,O=-1;function H(){return!(e.unstable_now()-O<F)}function K(){if(A!==null){var z=e.unstable_now();O=z;var U=!0;try{U=A(!0,z)}finally{U?X():(R=!1,A=null)}}else R=!1}var X;if(typeof S=="function")X=function(){S(K)};else if(typeof MessageChannel<"u"){var I=new MessageChannel,Z=I.port2;I.port1.onmessage=K,X=function(){Z.postMessage(null)}}else X=function(){j(K,0)};function W(z){A=z,R||(R=!0,X())}function $(z,U){q=j(function(){z(e.unstable_now())},U)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(z){z.callback=null},e.unstable_continueExecution=function(){_||w||(_=!0,W(T))},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"):F=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 U=3;break;default:U=y}var V=y;y=U;try{return z()}finally{y=V}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(z,U){switch(z){case 1:case 2:case 3:case 4:case 5:break;default:z=3}var V=y;y=z;try{return U()}finally{y=V}},e.unstable_scheduleCallback=function(z,U,V){var B=e.unstable_now();switch(typeof V=="object"&&V!==null?(V=V.delay,V=typeof V=="number"&&0<V?B+V:B):V=B,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=V+Y,z={id:h++,callback:U,priorityLevel:z,startTime:V,expirationTime:Y,sortIndex:-1},V>B?(z.sortIndex=V,t(p,z),n(f)===null&&z===n(p)&&(k?(b(q),q=-1):k=!0,$(C,V-B))):(z.sortIndex=Y,t(f,z),_||w||(_=!0,W(T))),z},e.unstable_shouldYield=H,e.unstable_wrapCallback=function(z){var U=y;return function(){var V=y;y=U;try{return z.apply(this,arguments)}finally{y=V}}}})(Sp)),Sp}var c1;function $$(){return c1||(c1=1,_p.exports=I$()),_p.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 u1;function O$(){if(u1)return zn;u1=1;var e=eu(),t=$$();function n(s){for(var i="https://reactjs.org/docs/error-decoder.html?invariant="+s,d=1;d<arguments.length;d++)i+="&args[]="+encodeURIComponent(arguments[d]);return"Minified React error #"+s+"; visit "+i+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var r=new Set,a={};function l(s,i){c(s,i),c(s+"Capture",i)}function c(s,i){for(a[s]=i,s=0;s<i.length;s++)r.add(i[s])}var u=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),f=Object.prototype.hasOwnProperty,p=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,h={},m={};function y(s){return f.call(m,s)?!0:f.call(h,s)?!1:p.test(s)?m[s]=!0:(h[s]=!0,!1)}function w(s,i,d,g){if(d!==null&&d.type===0)return!1;switch(typeof i){case"function":case"symbol":return!0;case"boolean":return g?!1:d!==null?!d.acceptsBooleans:(s=s.toLowerCase().slice(0,5),s!=="data-"&&s!=="aria-");default:return!1}}function _(s,i,d,g){if(i===null||typeof i>"u"||w(s,i,d,g))return!0;if(g)return!1;if(d!==null)switch(d.type){case 3:return!i;case 4:return i===!1;case 5:return isNaN(i);case 6:return isNaN(i)||1>i}return!1}function k(s,i,d,g,v,N,M){this.acceptsBooleans=i===2||i===3||i===4,this.attributeName=g,this.attributeNamespace=v,this.mustUseProperty=d,this.propertyName=s,this.type=i,this.sanitizeURL=N,this.removeEmptyString=M}var j={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(s){j[s]=new k(s,0,!1,s,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(s){var i=s[0];j[i]=new k(i,1,!1,s[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(s){j[s]=new k(s,2,!1,s.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(s){j[s]=new k(s,2,!1,s,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(s){j[s]=new k(s,3,!1,s.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(s){j[s]=new k(s,3,!0,s,null,!1,!1)}),["capture","download"].forEach(function(s){j[s]=new k(s,4,!1,s,null,!1,!1)}),["cols","rows","size","span"].forEach(function(s){j[s]=new k(s,6,!1,s,null,!1,!1)}),["rowSpan","start"].forEach(function(s){j[s]=new k(s,5,!1,s.toLowerCase(),null,!1,!1)});var b=/[\-:]([a-z])/g;function S(s){return s[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(s){var i=s.replace(b,S);j[i]=new k(i,1,!1,s,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(s){var i=s.replace(b,S);j[i]=new k(i,1,!1,s,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(s){var i=s.replace(b,S);j[i]=new k(i,1,!1,s,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(s){j[s]=new k(s,1,!1,s.toLowerCase(),null,!1,!1)}),j.xlinkHref=new k("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(s){j[s]=new k(s,1,!1,s.toLowerCase(),null,!0,!0)});function E(s,i,d,g){var v=j.hasOwnProperty(i)?j[i]:null;(v!==null?v.type!==0:g||!(2<i.length)||i[0]!=="o"&&i[0]!=="O"||i[1]!=="n"&&i[1]!=="N")&&(_(i,d,v,g)&&(d=null),g||v===null?y(i)&&(d===null?s.removeAttribute(i):s.setAttribute(i,""+d)):v.mustUseProperty?s[v.propertyName]=d===null?v.type===3?!1:"":d:(i=v.attributeName,g=v.attributeNamespace,d===null?s.removeAttribute(i):(v=v.type,d=v===3||v===4&&d===!0?"":""+d,g?s.setAttributeNS(g,i,d):s.setAttribute(i,d))))}var C=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,T=Symbol.for("react.element"),R=Symbol.for("react.portal"),A=Symbol.for("react.fragment"),q=Symbol.for("react.strict_mode"),F=Symbol.for("react.profiler"),O=Symbol.for("react.provider"),H=Symbol.for("react.context"),K=Symbol.for("react.forward_ref"),X=Symbol.for("react.suspense"),I=Symbol.for("react.suspense_list"),Z=Symbol.for("react.memo"),W=Symbol.for("react.lazy"),$=Symbol.for("react.offscreen"),z=Symbol.iterator;function U(s){return s===null||typeof s!="object"?null:(s=z&&s[z]||s["@@iterator"],typeof s=="function"?s:null)}var V=Object.assign,B;function Y(s){if(B===void 0)try{throw Error()}catch(d){var i=d.stack.trim().match(/\n( *(at )?)/);B=i&&i[1]||""}return`
|
|
34
|
+
`+B+s}var ue=!1;function G(s,i){if(!s||ue)return"";ue=!0;var d=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(i)if(i=function(){throw Error()},Object.defineProperty(i.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(i,[])}catch(fe){var g=fe}Reflect.construct(s,[],i)}else{try{i.call()}catch(fe){g=fe}s.call(i.prototype)}else{try{throw Error()}catch(fe){g=fe}s()}}catch(fe){if(fe&&g&&typeof fe.stack=="string"){for(var v=fe.stack.split(`
|
|
35
|
+
`),N=g.stack.split(`
|
|
36
|
+
`),M=v.length-1,Q=N.length-1;1<=M&&0<=Q&&v[M]!==N[Q];)Q--;for(;1<=M&&0<=Q;M--,Q--)if(v[M]!==N[Q]){if(M!==1||Q!==1)do if(M--,Q--,0>Q||v[M]!==N[Q]){var re=`
|
|
37
|
+
`+v[M].replace(" at new "," at ");return s.displayName&&re.includes("<anonymous>")&&(re=re.replace("<anonymous>",s.displayName)),re}while(1<=M&&0<=Q);break}}}finally{ue=!1,Error.prepareStackTrace=d}return(s=s?s.displayName||s.name:"")?Y(s):""}function ee(s){switch(s.tag){case 5:return Y(s.type);case 16:return Y("Lazy");case 13:return Y("Suspense");case 19:return Y("SuspenseList");case 0:case 2:case 15:return s=G(s.type,!1),s;case 11:return s=G(s.type.render,!1),s;case 1:return s=G(s.type,!0),s;default:return""}}function L(s){if(s==null)return null;if(typeof s=="function")return s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case A:return"Fragment";case R:return"Portal";case F:return"Profiler";case q:return"StrictMode";case X:return"Suspense";case I:return"SuspenseList"}if(typeof s=="object")switch(s.$$typeof){case H:return(s.displayName||"Context")+".Consumer";case O:return(s._context.displayName||"Context")+".Provider";case K:var i=s.render;return s=s.displayName,s||(s=i.displayName||i.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case Z:return i=s.displayName||null,i!==null?i:L(s.type)||"Memo";case W:i=s._payload,s=s._init;try{return L(s(i))}catch{}}return null}function te(s){var i=s.type;switch(s.tag){case 24:return"Cache";case 9:return(i.displayName||"Context")+".Consumer";case 10:return(i._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return s=i.render,s=s.displayName||s.name||"",i.displayName||(s!==""?"ForwardRef("+s+")":"ForwardRef");case 7:return"Fragment";case 5:return i;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return L(i);case 8:return i===q?"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 i=="function")return i.displayName||i.name||null;if(typeof i=="string")return i}return null}function ne(s){switch(typeof s){case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function ie(s){var i=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function me(s){var i=ie(s)?"checked":"value",d=Object.getOwnPropertyDescriptor(s.constructor.prototype,i),g=""+s[i];if(!s.hasOwnProperty(i)&&typeof d<"u"&&typeof d.get=="function"&&typeof d.set=="function"){var v=d.get,N=d.set;return Object.defineProperty(s,i,{configurable:!0,get:function(){return v.call(this)},set:function(M){g=""+M,N.call(this,M)}}),Object.defineProperty(s,i,{enumerable:d.enumerable}),{getValue:function(){return g},setValue:function(M){g=""+M},stopTracking:function(){s._valueTracker=null,delete s[i]}}}}function je(s){s._valueTracker||(s._valueTracker=me(s))}function Oe(s){if(!s)return!1;var i=s._valueTracker;if(!i)return!0;var d=i.getValue(),g="";return s&&(g=ie(s)?s.checked?"true":"false":s.value),s=g,s!==d?(i.setValue(s),!0):!1}function Ve(s){if(s=s||(typeof document<"u"?document:void 0),typeof s>"u")return null;try{return s.activeElement||s.body}catch{return s.body}}function Le(s,i){var d=i.checked;return V({},i,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:d??s._wrapperState.initialChecked})}function Te(s,i){var d=i.defaultValue==null?"":i.defaultValue,g=i.checked!=null?i.checked:i.defaultChecked;d=ne(i.value!=null?i.value:d),s._wrapperState={initialChecked:g,initialValue:d,controlled:i.type==="checkbox"||i.type==="radio"?i.checked!=null:i.value!=null}}function nt(s,i){i=i.checked,i!=null&&E(s,"checked",i,!1)}function _e(s,i){nt(s,i);var d=ne(i.value),g=i.type;if(d!=null)g==="number"?(d===0&&s.value===""||s.value!=d)&&(s.value=""+d):s.value!==""+d&&(s.value=""+d);else if(g==="submit"||g==="reset"){s.removeAttribute("value");return}i.hasOwnProperty("value")?Xe(s,i.type,d):i.hasOwnProperty("defaultValue")&&Xe(s,i.type,ne(i.defaultValue)),i.checked==null&&i.defaultChecked!=null&&(s.defaultChecked=!!i.defaultChecked)}function Se(s,i,d){if(i.hasOwnProperty("value")||i.hasOwnProperty("defaultValue")){var g=i.type;if(!(g!=="submit"&&g!=="reset"||i.value!==void 0&&i.value!==null))return;i=""+s._wrapperState.initialValue,d||i===s.value||(s.value=i),s.defaultValue=i}d=s.name,d!==""&&(s.name=""),s.defaultChecked=!!s._wrapperState.initialChecked,d!==""&&(s.name=d)}function Xe(s,i,d){(i!=="number"||Ve(s.ownerDocument)!==s)&&(d==null?s.defaultValue=""+s._wrapperState.initialValue:s.defaultValue!==""+d&&(s.defaultValue=""+d))}var ot=Array.isArray;function $e(s,i,d,g){if(s=s.options,i){i={};for(var v=0;v<d.length;v++)i["$"+d[v]]=!0;for(d=0;d<s.length;d++)v=i.hasOwnProperty("$"+s[d].value),s[d].selected!==v&&(s[d].selected=v),v&&g&&(s[d].defaultSelected=!0)}else{for(d=""+ne(d),i=null,v=0;v<s.length;v++){if(s[v].value===d){s[v].selected=!0,g&&(s[v].defaultSelected=!0);return}i!==null||s[v].disabled||(i=s[v])}i!==null&&(i.selected=!0)}}function oe(s,i){if(i.dangerouslySetInnerHTML!=null)throw Error(n(91));return V({},i,{value:void 0,defaultValue:void 0,children:""+s._wrapperState.initialValue})}function ye(s,i){var d=i.value;if(d==null){if(d=i.children,i=i.defaultValue,d!=null){if(i!=null)throw Error(n(92));if(ot(d)){if(1<d.length)throw Error(n(93));d=d[0]}i=d}i==null&&(i=""),d=i}s._wrapperState={initialValue:ne(d)}}function Ce(s,i){var d=ne(i.value),g=ne(i.defaultValue);d!=null&&(d=""+d,d!==s.value&&(s.value=d),i.defaultValue==null&&s.defaultValue!==d&&(s.defaultValue=d)),g!=null&&(s.defaultValue=""+g)}function De(s){var i=s.textContent;i===s._wrapperState.initialValue&&i!==""&&i!==null&&(s.value=i)}function qe(s){switch(s){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 rt(s,i){return s==null||s==="http://www.w3.org/1999/xhtml"?qe(i):s==="http://www.w3.org/2000/svg"&&i==="foreignObject"?"http://www.w3.org/1999/xhtml":s}var et,ve=(function(s){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(i,d,g,v){MSApp.execUnsafeLocalFunction(function(){return s(i,d,g,v)})}:s})(function(s,i){if(s.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in s)s.innerHTML=i;else{for(et=et||document.createElement("div"),et.innerHTML="<svg>"+i.valueOf().toString()+"</svg>",i=et.firstChild;s.firstChild;)s.removeChild(s.firstChild);for(;i.firstChild;)s.appendChild(i.firstChild)}});function Re(s,i){if(i){var d=s.firstChild;if(d&&d===s.lastChild&&d.nodeType===3){d.nodeValue=i;return}}s.textContent=i}var Ue={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},pt=["Webkit","ms","Moz","O"];Object.keys(Ue).forEach(function(s){pt.forEach(function(i){i=i+s.charAt(0).toUpperCase()+s.substring(1),Ue[i]=Ue[s]})});function he(s,i,d){return i==null||typeof i=="boolean"||i===""?"":d||typeof i!="number"||i===0||Ue.hasOwnProperty(s)&&Ue[s]?(""+i).trim():i+"px"}function mt(s,i){s=s.style;for(var d in i)if(i.hasOwnProperty(d)){var g=d.indexOf("--")===0,v=he(d,i[d],g);d==="float"&&(d="cssFloat"),g?s.setProperty(d,v):s[d]=v}}var qt=V({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 Tt(s,i){if(i){if(qt[s]&&(i.children!=null||i.dangerouslySetInnerHTML!=null))throw Error(n(137,s));if(i.dangerouslySetInnerHTML!=null){if(i.children!=null)throw Error(n(60));if(typeof i.dangerouslySetInnerHTML!="object"||!("__html"in i.dangerouslySetInnerHTML))throw Error(n(61))}if(i.style!=null&&typeof i.style!="object")throw Error(n(62))}}function jt(s,i){if(s.indexOf("-")===-1)return typeof i.is=="string";switch(s){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 dn=null;function Sn(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var Kt=null,an=null,ge=null;function ht(s){if(s=Ne(s)){if(typeof Kt!="function")throw Error(n(280));var i=s.stateNode;i&&(i=Ze(i),Kt(s.stateNode,s.type,i))}}function tt(s){an?ge?ge.push(s):ge=[s]:an=s}function _t(){if(an){var s=an,i=ge;if(ge=an=null,ht(s),i)for(s=0;s<i.length;s++)ht(i[s])}}function on(s,i){return s(i)}function Gn(){}var Et=!1;function lr(s,i,d){if(Et)return s(i,d);Et=!0;try{return on(s,i,d)}finally{Et=!1,(an!==null||ge!==null)&&(Gn(),_t())}}function gn(s,i){var d=s.stateNode;if(d===null)return null;var g=Ze(d);if(g===null)return null;d=g[i];e:switch(i){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(g=!g.disabled)||(s=s.type,g=!(s==="button"||s==="input"||s==="select"||s==="textarea")),s=!g;break e;default:s=!1}if(s)return null;if(d&&typeof d!="function")throw Error(n(231,i,typeof d));return d}var Yt=!1;if(u)try{var jn={};Object.defineProperty(jn,"passive",{get:function(){Yt=!0}}),window.addEventListener("test",jn,jn),window.removeEventListener("test",jn,jn)}catch{Yt=!1}function Bt(s,i,d,g,v,N,M,Q,re){var fe=Array.prototype.slice.call(arguments,3);try{i.apply(d,fe)}catch(be){this.onError(be)}}var Rn=!1,Kn=null,cr=!1,Mn=null,Ys={onError:function(s){Rn=!0,Kn=s}};function Xs(s,i,d,g,v,N,M,Q,re){Rn=!1,Kn=null,Bt.apply(Ys,arguments)}function ys(s,i,d,g,v,N,M,Q,re){if(Xs.apply(this,arguments),Rn){if(Rn){var fe=Kn;Rn=!1,Kn=null}else throw Error(n(198));cr||(cr=!0,Mn=fe)}}function In(s){var i=s,d=s;if(s.alternate)for(;i.return;)i=i.return;else{s=i;do i=s,(i.flags&4098)!==0&&(d=i.return),s=i.return;while(s)}return i.tag===3?d:null}function yn(s){if(s.tag===13){var i=s.memoizedState;if(i===null&&(s=s.alternate,s!==null&&(i=s.memoizedState)),i!==null)return i.dehydrated}return null}function J(s){if(In(s)!==s)throw Error(n(188))}function Ae(s){var i=s.alternate;if(!i){if(i=In(s),i===null)throw Error(n(188));return i!==s?null:s}for(var d=s,g=i;;){var v=d.return;if(v===null)break;var N=v.alternate;if(N===null){if(g=v.return,g!==null){d=g;continue}break}if(v.child===N.child){for(N=v.child;N;){if(N===d)return J(v),s;if(N===g)return J(v),i;N=N.sibling}throw Error(n(188))}if(d.return!==g.return)d=v,g=N;else{for(var M=!1,Q=v.child;Q;){if(Q===d){M=!0,d=v,g=N;break}if(Q===g){M=!0,g=v,d=N;break}Q=Q.sibling}if(!M){for(Q=N.child;Q;){if(Q===d){M=!0,d=N,g=v;break}if(Q===g){M=!0,g=N,d=v;break}Q=Q.sibling}if(!M)throw Error(n(189))}}if(d.alternate!==g)throw Error(n(190))}if(d.tag!==3)throw Error(n(188));return d.stateNode.current===d?s:i}function Fe(s){return s=Ae(s),s!==null?Ie(s):null}function Ie(s){if(s.tag===5||s.tag===6)return s;for(s=s.child;s!==null;){var i=Ie(s);if(i!==null)return i;s=s.sibling}return null}var Ge=t.unstable_scheduleCallback,yt=t.unstable_cancelCallback,kt=t.unstable_shouldYield,At=t.unstable_requestPaint,bt=t.unstable_now,St=t.unstable_getCurrentPriorityLevel,jr=t.unstable_ImmediatePriority,ws=t.unstable_UserBlockingPriority,Xr=t.unstable_NormalPriority,Ua=t.unstable_LowPriority,Xo=t.unstable_IdlePriority,vs=null,$n=null;function xs(s){if($n&&typeof $n.onCommitFiberRoot=="function")try{$n.onCommitFiberRoot(vs,s,void 0,(s.current.flags&128)===128)}catch{}}var On=Math.clz32?Math.clz32:du,cf=Math.log,Zo=Math.LN2;function du(s){return s>>>=0,s===0?32:31-(cf(s)/Zo|0)|0}var bs=64,Wa=4194304;function Zs(s){switch(s&-s){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 s&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return s&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return s}}function Yn(s,i){var d=s.pendingLanes;if(d===0)return 0;var g=0,v=s.suspendedLanes,N=s.pingedLanes,M=d&268435455;if(M!==0){var Q=M&~v;Q!==0?g=Zs(Q):(N&=M,N!==0&&(g=Zs(N)))}else M=d&~v,M!==0?g=Zs(M):N!==0&&(g=Zs(N));if(g===0)return 0;if(i!==0&&i!==g&&(i&v)===0&&(v=g&-g,N=i&-i,v>=N||v===16&&(N&4194240)!==0))return i;if((g&4)!==0&&(g|=d&16),i=s.entangledLanes,i!==0)for(s=s.entanglements,i&=g;0<i;)d=31-On(i),v=1<<d,g|=s[d],i&=~v;return g}function uf(s,i){switch(s){case 1:case 2:case 4:return i+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 i+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 hu(s,i){for(var d=s.suspendedLanes,g=s.pingedLanes,v=s.expirationTimes,N=s.pendingLanes;0<N;){var M=31-On(N),Q=1<<M,re=v[M];re===-1?((Q&d)===0||(Q&g)!==0)&&(v[M]=uf(Q,i)):re<=i&&(s.expiredLanes|=Q),N&=~Q}}function Qo(s){return s=s.pendingLanes&-1073741825,s!==0?s:s&1073741824?1073741824:0}function fu(){var s=bs;return bs<<=1,(bs&4194240)===0&&(bs=64),s}function Jo(s){for(var i=[],d=0;31>d;d++)i.push(s);return i}function Er(s,i,d){s.pendingLanes|=i,i!==536870912&&(s.suspendedLanes=0,s.pingedLanes=0),s=s.eventTimes,i=31-On(i),s[i]=d}function df(s,i){var d=s.pendingLanes&~i;s.pendingLanes=i,s.suspendedLanes=0,s.pingedLanes=0,s.expiredLanes&=i,s.mutableReadLanes&=i,s.entangledLanes&=i,i=s.entanglements;var g=s.eventTimes;for(s=s.expirationTimes;0<d;){var v=31-On(d),N=1<<v;i[v]=0,g[v]=-1,s[v]=-1,d&=~N}}function ei(s,i){var d=s.entangledLanes|=i;for(s=s.entanglements;d;){var g=31-On(d),v=1<<g;v&i|s[g]&i&&(s[g]|=i),d&=~v}}var lt=0;function Va(s){return s&=-s,1<s?4<s?(s&268435455)!==0?16:536870912:4:1}var pu,Ga,Ut,mu,Cr,Qs=!1,Ka=[],Zr=null,hn=null,Xn=null,Ya=new Map,Xa=new Map,Tr=[],gu="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 ks(s,i){switch(s){case"focusin":case"focusout":Zr=null;break;case"dragenter":case"dragleave":hn=null;break;case"mouseover":case"mouseout":Xn=null;break;case"pointerover":case"pointerout":Ya.delete(i.pointerId);break;case"gotpointercapture":case"lostpointercapture":Xa.delete(i.pointerId)}}function Js(s,i,d,g,v,N){return s===null||s.nativeEvent!==N?(s={blockedOn:i,domEventName:d,eventSystemFlags:g,nativeEvent:N,targetContainers:[v]},i!==null&&(i=Ne(i),i!==null&&Ga(i)),s):(s.eventSystemFlags|=g,i=s.targetContainers,v!==null&&i.indexOf(v)===-1&&i.push(v),s)}function yu(s,i,d,g,v){switch(i){case"focusin":return Zr=Js(Zr,s,i,d,g,v),!0;case"dragenter":return hn=Js(hn,s,i,d,g,v),!0;case"mouseover":return Xn=Js(Xn,s,i,d,g,v),!0;case"pointerover":var N=v.pointerId;return Ya.set(N,Js(Ya.get(N)||null,s,i,d,g,v)),!0;case"gotpointercapture":return N=v.pointerId,Xa.set(N,Js(Xa.get(N)||null,s,i,d,g,v)),!0}return!1}function ea(s){var i=we(s.target);if(i!==null){var d=In(i);if(d!==null){if(i=d.tag,i===13){if(i=yn(d),i!==null){s.blockedOn=i,Cr(s.priority,function(){Ut(d)});return}}else if(i===3&&d.stateNode.current.memoizedState.isDehydrated){s.blockedOn=d.tag===3?d.stateNode.containerInfo:null;return}}}s.blockedOn=null}function ta(s){if(s.blockedOn!==null)return!1;for(var i=s.targetContainers;0<i.length;){var d=ni(s.domEventName,s.eventSystemFlags,i[0],s.nativeEvent);if(d===null){d=s.nativeEvent;var g=new d.constructor(d.type,d);dn=g,d.target.dispatchEvent(g),dn=null}else return i=Ne(d),i!==null&&Ga(i),s.blockedOn=d,!1;i.shift()}return!0}function kl(s,i,d){ta(s)&&d.delete(i)}function wu(){Qs=!1,Zr!==null&&ta(Zr)&&(Zr=null),hn!==null&&ta(hn)&&(hn=null),Xn!==null&&ta(Xn)&&(Xn=null),Ya.forEach(kl),Xa.forEach(kl)}function na(s,i){s.blockedOn===i&&(s.blockedOn=null,Qs||(Qs=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,wu)))}function ra(s){function i(v){return na(v,s)}if(0<Ka.length){na(Ka[0],s);for(var d=1;d<Ka.length;d++){var g=Ka[d];g.blockedOn===s&&(g.blockedOn=null)}}for(Zr!==null&&na(Zr,s),hn!==null&&na(hn,s),Xn!==null&&na(Xn,s),Ya.forEach(i),Xa.forEach(i),d=0;d<Tr.length;d++)g=Tr[d],g.blockedOn===s&&(g.blockedOn=null);for(;0<Tr.length&&(d=Tr[0],d.blockedOn===null);)ea(d),d.blockedOn===null&&Tr.shift()}var Ct=C.ReactCurrentBatchConfig,Ns=!0;function ti(s,i,d,g){var v=lt,N=Ct.transition;Ct.transition=null;try{lt=1,_l(s,i,d,g)}finally{lt=v,Ct.transition=N}}function Nl(s,i,d,g){var v=lt,N=Ct.transition;Ct.transition=null;try{lt=4,_l(s,i,d,g)}finally{lt=v,Ct.transition=N}}function _l(s,i,d,g){if(Ns){var v=ni(s,i,d,g);if(v===null)gi(s,i,g,Ar,d),ks(s,g);else if(yu(v,s,i,d,g))g.stopPropagation();else if(ks(s,g),i&4&&-1<gu.indexOf(s)){for(;v!==null;){var N=Ne(v);if(N!==null&&pu(N),N=ni(s,i,d,g),N===null&&gi(s,i,g,Ar,d),N===v)break;v=N}v!==null&&g.stopPropagation()}else gi(s,i,g,null,d)}}var Ar=null;function ni(s,i,d,g){if(Ar=null,s=Sn(g),s=we(s),s!==null)if(i=In(s),i===null)s=null;else if(d=i.tag,d===13){if(s=yn(i),s!==null)return s;s=null}else if(d===3){if(i.stateNode.current.memoizedState.isDehydrated)return i.tag===3?i.stateNode.containerInfo:null;s=null}else i!==s&&(s=null);return Ar=s,null}function sa(s){switch(s){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(St()){case jr:return 1;case ws:return 4;case Xr:case Ua:return 16;case Xo:return 536870912;default:return 16}default:return 16}}var Qr=null,aa=null,ri=null;function Za(){if(ri)return ri;var s,i=aa,d=i.length,g,v="value"in Qr?Qr.value:Qr.textContent,N=v.length;for(s=0;s<d&&i[s]===v[s];s++);var M=d-s;for(g=1;g<=M&&i[d-g]===v[N-g];g++);return ri=v.slice(s,1<g?1-g:void 0)}function si(s){var i=s.keyCode;return"charCode"in s?(s=s.charCode,s===0&&i===13&&(s=13)):s=i,s===10&&(s=13),32<=s||s===13?s:0}function Zn(){return!0}function vu(){return!1}function wn(s){function i(d,g,v,N,M){this._reactName=d,this._targetInst=v,this.type=g,this.nativeEvent=N,this.target=M,this.currentTarget=null;for(var Q in s)s.hasOwnProperty(Q)&&(d=s[Q],this[Q]=d?d(N):N[Q]);return this.isDefaultPrevented=(N.defaultPrevented!=null?N.defaultPrevented:N.returnValue===!1)?Zn:vu,this.isPropagationStopped=vu,this}return V(i.prototype,{preventDefault:function(){this.defaultPrevented=!0;var d=this.nativeEvent;d&&(d.preventDefault?d.preventDefault():typeof d.returnValue!="unknown"&&(d.returnValue=!1),this.isDefaultPrevented=Zn)},stopPropagation:function(){var d=this.nativeEvent;d&&(d.stopPropagation?d.stopPropagation():typeof d.cancelBubble!="unknown"&&(d.cancelBubble=!0),this.isPropagationStopped=Zn)},persist:function(){},isPersistent:Zn}),i}var oa={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ai=wn(oa),Qa=V({},oa,{view:0,detail:0}),Qn=wn(Qa),Jr,_s,es,Ja=V({},Qa,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ml,button:0,buttons:0,relatedTarget:function(s){return s.relatedTarget===void 0?s.fromElement===s.srcElement?s.toElement:s.fromElement:s.relatedTarget},movementX:function(s){return"movementX"in s?s.movementX:(s!==es&&(es&&s.type==="mousemove"?(Jr=s.screenX-es.screenX,_s=s.screenY-es.screenY):_s=Jr=0,es=s),Jr)},movementY:function(s){return"movementY"in s?s.movementY:_s}}),Sl=wn(Ja),eo=V({},Ja,{dataTransfer:0}),xu=wn(eo),jl=V({},Qa,{relatedTarget:0}),Rr=wn(jl),bu=V({},oa,{animationName:0,elapsedTime:0,pseudoElement:0}),Ln=wn(bu),El=V({},oa,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),Cl=wn(El),ku=V({},oa,{data:0}),to=wn(ku),Tl={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Nu={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"},Al={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Rl(s){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(s):(s=Al[s])?!!i[s]:!1}function Ml(){return Rl}var Ss=V({},Qa,{key:function(s){if(s.key){var i=Tl[s.key]||s.key;if(i!=="Unidentified")return i}return s.type==="keypress"?(s=si(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?Nu[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ml,charCode:function(s){return s.type==="keypress"?si(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?si(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),Il=wn(Ss),_u=V({},Ja,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ia=wn(_u),Su=V({},Qa,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ml}),oi=wn(Su),Mr=V({},oa,{propertyName:0,elapsedTime:0,pseudoElement:0}),$l=wn(Mr),hf=V({},Ja,{deltaX:function(s){return"deltaX"in s?s.deltaX:"wheelDeltaX"in s?-s.wheelDeltaX:0},deltaY:function(s){return"deltaY"in s?s.deltaY:"wheelDeltaY"in s?-s.wheelDeltaY:"wheelDelta"in s?-s.wheelDelta:0},deltaZ:0,deltaMode:0}),ju=wn(hf),Eu=[9,13,27,32],Ol=u&&"CompositionEvent"in window,Rt=null;u&&"documentMode"in document&&(Rt=document.documentMode);var Cu=u&&"TextEvent"in window&&!Rt,no=u&&(!Ol||Rt&&8<Rt&&11>=Rt),js=" ",la=!1;function ii(s,i){switch(s){case"keyup":return Eu.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function li(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var Pn=!1;function ro(s,i){switch(s){case"compositionend":return li(i);case"keypress":return i.which!==32?null:(la=!0,js);case"textInput":return s=i.data,s===js&&la?null:s;default:return null}}function Tu(s,i){if(Pn)return s==="compositionend"||!Ol&&ii(s,i)?(s=Za(),ri=aa=Qr=null,Pn=!1,s):null;switch(s){case"paste":return null;case"keypress":if(!(i.ctrlKey||i.altKey||i.metaKey)||i.ctrlKey&&i.altKey){if(i.char&&1<i.char.length)return i.char;if(i.which)return String.fromCharCode(i.which)}return null;case"compositionend":return no&&i.locale!=="ko"?null:i.data;default:return null}}var ff={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 Au(s){var i=s&&s.nodeName&&s.nodeName.toLowerCase();return i==="input"?!!ff[s.type]:i==="textarea"}function so(s,i,d,g){tt(g),i=yi(i,"onChange"),0<i.length&&(d=new ai("onChange","change",null,d,g),s.push({event:d,listeners:i}))}var ao=null,oo=null;function Ll(s){Kl(s,0)}function Jn(s){var i=Me(s);if(Oe(i))return s}function io(s,i){if(s==="change")return i}var Pl=!1;if(u){var Dl;if(u){var Fl="oninput"in document;if(!Fl){var ts=document.createElement("div");ts.setAttribute("oninput","return;"),Fl=typeof ts.oninput=="function"}Dl=Fl}else Dl=!1;Pl=Dl&&(!document.documentMode||9<document.documentMode)}function ci(){ao&&(ao.detachEvent("onpropertychange",Ru),oo=ao=null)}function Ru(s){if(s.propertyName==="value"&&Jn(oo)){var i=[];so(i,oo,s,Sn(s)),lr(Ll,i)}}function pf(s,i,d){s==="focusin"?(ci(),ao=i,oo=d,ao.attachEvent("onpropertychange",Ru)):s==="focusout"&&ci()}function mf(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return Jn(oo)}function Xt(s,i){if(s==="click")return Jn(i)}function Mu(s,i){if(s==="input"||s==="change")return Jn(i)}function ql(s,i){return s===i&&(s!==0||1/s===1/i)||s!==s&&i!==i}var er=typeof Object.is=="function"?Object.is:ql;function Es(s,i){if(er(s,i))return!0;if(typeof s!="object"||s===null||typeof i!="object"||i===null)return!1;var d=Object.keys(s),g=Object.keys(i);if(d.length!==g.length)return!1;for(g=0;g<d.length;g++){var v=d[g];if(!f.call(i,v)||!er(s[v],i[v]))return!1}return!0}function lo(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function co(s,i){var d=lo(s);s=0;for(var g;d;){if(d.nodeType===3){if(g=s+d.textContent.length,s<=i&&g>=i)return{node:d,offset:i-s};s=g}e:{for(;d;){if(d.nextSibling){d=d.nextSibling;break e}d=d.parentNode}d=void 0}d=lo(d)}}function Iu(s,i){return s&&i?s===i?!0:s&&s.nodeType===3?!1:i&&i.nodeType===3?Iu(s,i.parentNode):"contains"in s?s.contains(i):s.compareDocumentPosition?!!(s.compareDocumentPosition(i)&16):!1:!1}function Ir(){for(var s=window,i=Ve();i instanceof s.HTMLIFrameElement;){try{var d=typeof i.contentWindow.location.href=="string"}catch{d=!1}if(d)s=i.contentWindow;else break;i=Ve(s.document)}return i}function ui(s){var i=s&&s.nodeName&&s.nodeName.toLowerCase();return i&&(i==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||i==="textarea"||s.contentEditable==="true")}function gf(s){var i=Ir(),d=s.focusedElem,g=s.selectionRange;if(i!==d&&d&&d.ownerDocument&&Iu(d.ownerDocument.documentElement,d)){if(g!==null&&ui(d)){if(i=g.start,s=g.end,s===void 0&&(s=i),"selectionStart"in d)d.selectionStart=i,d.selectionEnd=Math.min(s,d.value.length);else if(s=(i=d.ownerDocument||document)&&i.defaultView||window,s.getSelection){s=s.getSelection();var v=d.textContent.length,N=Math.min(g.start,v);g=g.end===void 0?N:Math.min(g.end,v),!s.extend&&N>g&&(v=g,g=N,N=v),v=co(d,N);var M=co(d,g);v&&M&&(s.rangeCount!==1||s.anchorNode!==v.node||s.anchorOffset!==v.offset||s.focusNode!==M.node||s.focusOffset!==M.offset)&&(i=i.createRange(),i.setStart(v.node,v.offset),s.removeAllRanges(),N>g?(s.addRange(i),s.extend(M.node,M.offset)):(i.setEnd(M.node,M.offset),s.addRange(i)))}}for(i=[],s=d;s=s.parentNode;)s.nodeType===1&&i.push({element:s,left:s.scrollLeft,top:s.scrollTop});for(typeof d.focus=="function"&&d.focus(),d=0;d<i.length;d++)s=i[d],s.element.scrollLeft=s.left,s.element.scrollTop=s.top}}var $u=u&&"documentMode"in document&&11>=document.documentMode,Cs=null,Bl=null,ns=null,zl=!1;function di(s,i,d){var g=d.window===d?d.document:d.nodeType===9?d:d.ownerDocument;zl||Cs==null||Cs!==Ve(g)||(g=Cs,"selectionStart"in g&&ui(g)?g={start:g.selectionStart,end:g.selectionEnd}:(g=(g.ownerDocument&&g.ownerDocument.defaultView||window).getSelection(),g={anchorNode:g.anchorNode,anchorOffset:g.anchorOffset,focusNode:g.focusNode,focusOffset:g.focusOffset}),ns&&Es(ns,g)||(ns=g,g=yi(Bl,"onSelect"),0<g.length&&(i=new ai("onSelect","select",null,i,d),s.push({event:i,listeners:g}),i.target=Cs)))}function uo(s,i){var d={};return d[s.toLowerCase()]=i.toLowerCase(),d["Webkit"+s]="webkit"+i,d["Moz"+s]="moz"+i,d}var ca={animationend:uo("Animation","AnimationEnd"),animationiteration:uo("Animation","AnimationIteration"),animationstart:uo("Animation","AnimationStart"),transitionend:uo("Transition","TransitionEnd")},hi={},Hl={};u&&(Hl=document.createElement("div").style,"AnimationEvent"in window||(delete ca.animationend.animation,delete ca.animationiteration.animation,delete ca.animationstart.animation),"TransitionEvent"in window||delete ca.transitionend.transition);function ua(s){if(hi[s])return hi[s];if(!ca[s])return s;var i=ca[s],d;for(d in i)if(i.hasOwnProperty(d)&&d in Hl)return hi[s]=i[d];return s}var ho=ua("animationend"),fi=ua("animationiteration"),Ul=ua("animationstart"),rs=ua("transitionend"),En=new Map,Ou="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 ss(s,i){En.set(s,i),l(i,[s])}for(var Wl=0;Wl<Ou.length;Wl++){var Vl=Ou[Wl],da=Vl.toLowerCase(),pi=Vl[0].toUpperCase()+Vl.slice(1);ss(da,"on"+pi)}ss(ho,"onAnimationEnd"),ss(fi,"onAnimationIteration"),ss(Ul,"onAnimationStart"),ss("dblclick","onDoubleClick"),ss("focusin","onFocus"),ss("focusout","onBlur"),ss(rs,"onTransitionEnd"),c("onMouseEnter",["mouseout","mouseover"]),c("onMouseLeave",["mouseout","mouseover"]),c("onPointerEnter",["pointerout","pointerover"]),c("onPointerLeave",["pointerout","pointerover"]),l("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),l("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),l("onBeforeInput",["compositionend","keypress","textInput","paste"]),l("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),l("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),l("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ts="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(" "),ha=new Set("cancel close invalid load scroll toggle".split(" ").concat(Ts));function Gl(s,i,d){var g=s.type||"unknown-event";s.currentTarget=d,ys(g,i,void 0,s),s.currentTarget=null}function Kl(s,i){i=(i&4)!==0;for(var d=0;d<s.length;d++){var g=s[d],v=g.event;g=g.listeners;e:{var N=void 0;if(i)for(var M=g.length-1;0<=M;M--){var Q=g[M],re=Q.instance,fe=Q.currentTarget;if(Q=Q.listener,re!==N&&v.isPropagationStopped())break e;Gl(v,Q,fe),N=re}else for(M=0;M<g.length;M++){if(Q=g[M],re=Q.instance,fe=Q.currentTarget,Q=Q.listener,re!==N&&v.isPropagationStopped())break e;Gl(v,Q,fe),N=re}}}if(cr)throw s=Mn,cr=!1,Mn=null,s}function it(s,i){var d=i[P];d===void 0&&(d=i[P]=new Set);var g=s+"__bubble";d.has(g)||(Lu(i,s,2,!1),d.add(g))}function mi(s,i,d){var g=0;i&&(g|=4),Lu(d,s,g,i)}var fo="_reactListening"+Math.random().toString(36).slice(2);function po(s){if(!s[fo]){s[fo]=!0,r.forEach(function(d){d!=="selectionchange"&&(ha.has(d)||mi(d,!1,s),mi(d,!0,s))});var i=s.nodeType===9?s:s.ownerDocument;i===null||i[fo]||(i[fo]=!0,mi("selectionchange",!1,i))}}function Lu(s,i,d,g){switch(sa(i)){case 1:var v=ti;break;case 4:v=Nl;break;default:v=_l}d=v.bind(null,i,d,s),v=void 0,!Yt||i!=="touchstart"&&i!=="touchmove"&&i!=="wheel"||(v=!0),g?v!==void 0?s.addEventListener(i,d,{capture:!0,passive:v}):s.addEventListener(i,d,!0):v!==void 0?s.addEventListener(i,d,{passive:v}):s.addEventListener(i,d,!1)}function gi(s,i,d,g,v){var N=g;if((i&1)===0&&(i&2)===0&&g!==null)e:for(;;){if(g===null)return;var M=g.tag;if(M===3||M===4){var Q=g.stateNode.containerInfo;if(Q===v||Q.nodeType===8&&Q.parentNode===v)break;if(M===4)for(M=g.return;M!==null;){var re=M.tag;if((re===3||re===4)&&(re=M.stateNode.containerInfo,re===v||re.nodeType===8&&re.parentNode===v))return;M=M.return}for(;Q!==null;){if(M=we(Q),M===null)return;if(re=M.tag,re===5||re===6){g=N=M;continue e}Q=Q.parentNode}}g=g.return}lr(function(){var fe=N,be=Sn(d),ke=[];e:{var xe=En.get(s);if(xe!==void 0){var Pe=ai,ze=s;switch(s){case"keypress":if(si(d)===0)break e;case"keydown":case"keyup":Pe=Il;break;case"focusin":ze="focus",Pe=Rr;break;case"focusout":ze="blur",Pe=Rr;break;case"beforeblur":case"afterblur":Pe=Rr;break;case"click":if(d.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Pe=Sl;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Pe=xu;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Pe=oi;break;case ho:case fi:case Ul:Pe=Ln;break;case rs:Pe=$l;break;case"scroll":Pe=Qn;break;case"wheel":Pe=ju;break;case"copy":case"cut":case"paste":Pe=Cl;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Pe=ia}var He=(i&4)!==0,Ht=!He&&s==="scroll",ce=He?xe!==null?xe+"Capture":null:xe;He=[];for(var ae=fe,de;ae!==null;){de=ae;var Ee=de.stateNode;if(de.tag===5&&Ee!==null&&(de=Ee,ce!==null&&(Ee=gn(ae,ce),Ee!=null&&He.push(mo(ae,Ee,de)))),Ht)break;ae=ae.return}0<He.length&&(xe=new Pe(xe,ze,null,d,be),ke.push({event:xe,listeners:He}))}}if((i&7)===0){e:{if(xe=s==="mouseover"||s==="pointerover",Pe=s==="mouseout"||s==="pointerout",xe&&d!==dn&&(ze=d.relatedTarget||d.fromElement)&&(we(ze)||ze[D]))break e;if((Pe||xe)&&(xe=be.window===be?be:(xe=be.ownerDocument)?xe.defaultView||xe.parentWindow:window,Pe?(ze=d.relatedTarget||d.toElement,Pe=fe,ze=ze?we(ze):null,ze!==null&&(Ht=In(ze),ze!==Ht||ze.tag!==5&&ze.tag!==6)&&(ze=null)):(Pe=null,ze=fe),Pe!==ze)){if(He=Sl,Ee="onMouseLeave",ce="onMouseEnter",ae="mouse",(s==="pointerout"||s==="pointerover")&&(He=ia,Ee="onPointerLeave",ce="onPointerEnter",ae="pointer"),Ht=Pe==null?xe:Me(Pe),de=ze==null?xe:Me(ze),xe=new He(Ee,ae+"leave",Pe,d,be),xe.target=Ht,xe.relatedTarget=de,Ee=null,we(be)===fe&&(He=new He(ce,ae+"enter",ze,d,be),He.target=de,He.relatedTarget=Ht,Ee=He),Ht=Ee,Pe&&ze)t:{for(He=Pe,ce=ze,ae=0,de=He;de;de=As(de))ae++;for(de=0,Ee=ce;Ee;Ee=As(Ee))de++;for(;0<ae-de;)He=As(He),ae--;for(;0<de-ae;)ce=As(ce),de--;for(;ae--;){if(He===ce||ce!==null&&He===ce.alternate)break t;He=As(He),ce=As(ce)}He=null}else He=null;Pe!==null&&go(ke,xe,Pe,He,!1),ze!==null&&Ht!==null&&go(ke,Ht,ze,He,!0)}}e:{if(xe=fe?Me(fe):window,Pe=xe.nodeName&&xe.nodeName.toLowerCase(),Pe==="select"||Pe==="input"&&xe.type==="file")var We=io;else if(Au(xe))if(Pl)We=Mu;else{We=mf;var Qe=pf}else(Pe=xe.nodeName)&&Pe.toLowerCase()==="input"&&(xe.type==="checkbox"||xe.type==="radio")&&(We=Xt);if(We&&(We=We(s,fe))){so(ke,We,d,be);break e}Qe&&Qe(s,xe,fe),s==="focusout"&&(Qe=xe._wrapperState)&&Qe.controlled&&xe.type==="number"&&Xe(xe,"number",xe.value)}switch(Qe=fe?Me(fe):window,s){case"focusin":(Au(Qe)||Qe.contentEditable==="true")&&(Cs=Qe,Bl=fe,ns=null);break;case"focusout":ns=Bl=Cs=null;break;case"mousedown":zl=!0;break;case"contextmenu":case"mouseup":case"dragend":zl=!1,di(ke,d,be);break;case"selectionchange":if($u)break;case"keydown":case"keyup":di(ke,d,be)}var Je;if(Ol)e:{switch(s){case"compositionstart":var st="onCompositionStart";break e;case"compositionend":st="onCompositionEnd";break e;case"compositionupdate":st="onCompositionUpdate";break e}st=void 0}else Pn?ii(s,d)&&(st="onCompositionEnd"):s==="keydown"&&d.keyCode===229&&(st="onCompositionStart");st&&(no&&d.locale!=="ko"&&(Pn||st!=="onCompositionStart"?st==="onCompositionEnd"&&Pn&&(Je=Za()):(Qr=be,aa="value"in Qr?Qr.value:Qr.textContent,Pn=!0)),Qe=yi(fe,st),0<Qe.length&&(st=new to(st,s,null,d,be),ke.push({event:st,listeners:Qe}),Je?st.data=Je:(Je=li(d),Je!==null&&(st.data=Je)))),(Je=Cu?ro(s,d):Tu(s,d))&&(fe=yi(fe,"onBeforeInput"),0<fe.length&&(be=new to("onBeforeInput","beforeinput",null,d,be),ke.push({event:be,listeners:fe}),be.data=Je))}Kl(ke,i)})}function mo(s,i,d){return{instance:s,listener:i,currentTarget:d}}function yi(s,i){for(var d=i+"Capture",g=[];s!==null;){var v=s,N=v.stateNode;v.tag===5&&N!==null&&(v=N,N=gn(s,d),N!=null&&g.unshift(mo(s,N,v)),N=gn(s,i),N!=null&&g.push(mo(s,N,v))),s=s.return}return g}function As(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5);return s||null}function go(s,i,d,g,v){for(var N=i._reactName,M=[];d!==null&&d!==g;){var Q=d,re=Q.alternate,fe=Q.stateNode;if(re!==null&&re===g)break;Q.tag===5&&fe!==null&&(Q=fe,v?(re=gn(d,N),re!=null&&M.unshift(mo(d,re,Q))):v||(re=gn(d,N),re!=null&&M.push(mo(d,re,Q)))),d=d.return}M.length!==0&&s.push({event:i,listeners:M})}var yf=/\r\n?/g,Rs=/\u0000|\uFFFD/g;function wi(s){return(typeof s=="string"?s:""+s).replace(yf,`
|
|
38
|
+
`).replace(Rs,"")}function Ms(s,i,d){if(i=wi(i),wi(s)!==i&&d)throw Error(n(425))}function fa(){}var Yl=null,vi=null;function xi(s,i){return s==="textarea"||s==="noscript"||typeof i.children=="string"||typeof i.children=="number"||typeof i.dangerouslySetInnerHTML=="object"&&i.dangerouslySetInnerHTML!==null&&i.dangerouslySetInnerHTML.__html!=null}var Xl=typeof setTimeout=="function"?setTimeout:void 0,wf=typeof clearTimeout=="function"?clearTimeout:void 0,Zl=typeof Promise=="function"?Promise:void 0,yo=typeof queueMicrotask=="function"?queueMicrotask:typeof Zl<"u"?function(s){return Zl.resolve(null).then(s).catch(Ql)}:Xl;function Ql(s){setTimeout(function(){throw s})}function Jl(s,i){var d=i,g=0;do{var v=d.nextSibling;if(s.removeChild(d),v&&v.nodeType===8)if(d=v.data,d==="/$"){if(g===0){s.removeChild(v),ra(i);return}g--}else d!=="$"&&d!=="$?"&&d!=="$!"||g++;d=v}while(d);ra(i)}function $r(s){for(;s!=null;s=s.nextSibling){var i=s.nodeType;if(i===1||i===3)break;if(i===8){if(i=s.data,i==="$"||i==="$!"||i==="$?")break;if(i==="/$")return null}}return s}function ec(s){s=s.previousSibling;for(var i=0;s;){if(s.nodeType===8){var d=s.data;if(d==="$"||d==="$!"||d==="$?"){if(i===0)return s;i--}else d==="/$"&&i++}s=s.previousSibling}return null}var Is=Math.random().toString(36).slice(2),tr="__reactFiber$"+Is,pa="__reactProps$"+Is,D="__reactContainer$"+Is,P="__reactEvents$"+Is,se="__reactListeners$"+Is,le="__reactHandles$"+Is;function we(s){var i=s[tr];if(i)return i;for(var d=s.parentNode;d;){if(i=d[D]||d[tr]){if(d=i.alternate,i.child!==null||d!==null&&d.child!==null)for(s=ec(s);s!==null;){if(d=s[tr])return d;s=ec(s)}return i}s=d,d=s.parentNode}return null}function Ne(s){return s=s[tr]||s[D],!s||s.tag!==5&&s.tag!==6&&s.tag!==13&&s.tag!==3?null:s}function Me(s){if(s.tag===5||s.tag===6)return s.stateNode;throw Error(n(33))}function Ze(s){return s[pa]||null}var ft=[],Ye=-1;function Nt(s){return{current:s}}function at(s){0>Ye||(s.current=ft[Ye],ft[Ye]=null,Ye--)}function gt(s,i){Ye++,ft[Ye]=s.current,s.current=i}var Dn={},zt=Nt(Dn),vn=Nt(!1),as=Dn;function os(s,i){var d=s.type.contextTypes;if(!d)return Dn;var g=s.stateNode;if(g&&g.__reactInternalMemoizedUnmaskedChildContext===i)return g.__reactInternalMemoizedMaskedChildContext;var v={},N;for(N in d)v[N]=i[N];return g&&(s=s.stateNode,s.__reactInternalMemoizedUnmaskedChildContext=i,s.__reactInternalMemoizedMaskedChildContext=v),v}function xn(s){return s=s.childContextTypes,s!=null}function wo(){at(vn),at(zt)}function ma(s,i,d){if(zt.current!==Dn)throw Error(n(168));gt(zt,i),gt(vn,d)}function ga(s,i,d){var g=s.stateNode;if(i=i.childContextTypes,typeof g.getChildContext!="function")return d;g=g.getChildContext();for(var v in g)if(!(v in i))throw Error(n(108,te(s)||"Unknown",v));return V({},d,g)}function bi(s){return s=(s=s.stateNode)&&s.__reactInternalMemoizedMergedChildContext||Dn,as=zt.current,gt(zt,s),gt(vn,vn.current),!0}function $t(s,i,d){var g=s.stateNode;if(!g)throw Error(n(169));d?(s=ga(s,i,as),g.__reactInternalMemoizedMergedChildContext=s,at(vn),at(zt),gt(zt,s)):at(vn),gt(vn,d)}var ur=null,Pu=!1,vf=!1;function Tb(s){ur===null?ur=[s]:ur.push(s)}function YI(s){Pu=!0,Tb(s)}function ya(){if(!vf&&ur!==null){vf=!0;var s=0,i=lt;try{var d=ur;for(lt=1;s<d.length;s++){var g=d[s];do g=g(!0);while(g!==null)}ur=null,Pu=!1}catch(v){throw ur!==null&&(ur=ur.slice(s+1)),Ge(jr,ya),v}finally{lt=i,vf=!1}}return null}var ki=[],Ni=0,Du=null,Fu=0,dr=[],hr=0,vo=null,$s=1,Os="";function xo(s,i){ki[Ni++]=Fu,ki[Ni++]=Du,Du=s,Fu=i}function Ab(s,i,d){dr[hr++]=$s,dr[hr++]=Os,dr[hr++]=vo,vo=s;var g=$s;s=Os;var v=32-On(g)-1;g&=~(1<<v),d+=1;var N=32-On(i)+v;if(30<N){var M=v-v%5;N=(g&(1<<M)-1).toString(32),g>>=M,v-=M,$s=1<<32-On(i)+v|d<<v|g,Os=N+s}else $s=1<<N|d<<v|g,Os=s}function xf(s){s.return!==null&&(xo(s,1),Ab(s,1,0))}function bf(s){for(;s===Du;)Du=ki[--Ni],ki[Ni]=null,Fu=ki[--Ni],ki[Ni]=null;for(;s===vo;)vo=dr[--hr],dr[hr]=null,Os=dr[--hr],dr[hr]=null,$s=dr[--hr],dr[hr]=null}var nr=null,rr=null,Mt=!1,Or=null;function Rb(s,i){var d=gr(5,null,null,0);d.elementType="DELETED",d.stateNode=i,d.return=s,i=s.deletions,i===null?(s.deletions=[d],s.flags|=16):i.push(d)}function Mb(s,i){switch(s.tag){case 5:var d=s.type;return i=i.nodeType!==1||d.toLowerCase()!==i.nodeName.toLowerCase()?null:i,i!==null?(s.stateNode=i,nr=s,rr=$r(i.firstChild),!0):!1;case 6:return i=s.pendingProps===""||i.nodeType!==3?null:i,i!==null?(s.stateNode=i,nr=s,rr=null,!0):!1;case 13:return i=i.nodeType!==8?null:i,i!==null?(d=vo!==null?{id:$s,overflow:Os}:null,s.memoizedState={dehydrated:i,treeContext:d,retryLane:1073741824},d=gr(18,null,null,0),d.stateNode=i,d.return=s,s.child=d,nr=s,rr=null,!0):!1;default:return!1}}function kf(s){return(s.mode&1)!==0&&(s.flags&128)===0}function Nf(s){if(Mt){var i=rr;if(i){var d=i;if(!Mb(s,i)){if(kf(s))throw Error(n(418));i=$r(d.nextSibling);var g=nr;i&&Mb(s,i)?Rb(g,d):(s.flags=s.flags&-4097|2,Mt=!1,nr=s)}}else{if(kf(s))throw Error(n(418));s.flags=s.flags&-4097|2,Mt=!1,nr=s}}}function Ib(s){for(s=s.return;s!==null&&s.tag!==5&&s.tag!==3&&s.tag!==13;)s=s.return;nr=s}function qu(s){if(s!==nr)return!1;if(!Mt)return Ib(s),Mt=!0,!1;var i;if((i=s.tag!==3)&&!(i=s.tag!==5)&&(i=s.type,i=i!=="head"&&i!=="body"&&!xi(s.type,s.memoizedProps)),i&&(i=rr)){if(kf(s))throw $b(),Error(n(418));for(;i;)Rb(s,i),i=$r(i.nextSibling)}if(Ib(s),s.tag===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(n(317));e:{for(s=s.nextSibling,i=0;s;){if(s.nodeType===8){var d=s.data;if(d==="/$"){if(i===0){rr=$r(s.nextSibling);break e}i--}else d!=="$"&&d!=="$!"&&d!=="$?"||i++}s=s.nextSibling}rr=null}}else rr=nr?$r(s.stateNode.nextSibling):null;return!0}function $b(){for(var s=rr;s;)s=$r(s.nextSibling)}function _i(){rr=nr=null,Mt=!1}function _f(s){Or===null?Or=[s]:Or.push(s)}var XI=C.ReactCurrentBatchConfig;function tc(s,i,d){if(s=d.ref,s!==null&&typeof s!="function"&&typeof s!="object"){if(d._owner){if(d=d._owner,d){if(d.tag!==1)throw Error(n(309));var g=d.stateNode}if(!g)throw Error(n(147,s));var v=g,N=""+s;return i!==null&&i.ref!==null&&typeof i.ref=="function"&&i.ref._stringRef===N?i.ref:(i=function(M){var Q=v.refs;M===null?delete Q[N]:Q[N]=M},i._stringRef=N,i)}if(typeof s!="string")throw Error(n(284));if(!d._owner)throw Error(n(290,s))}return s}function Bu(s,i){throw s=Object.prototype.toString.call(i),Error(n(31,s==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":s))}function Ob(s){var i=s._init;return i(s._payload)}function Lb(s){function i(ce,ae){if(s){var de=ce.deletions;de===null?(ce.deletions=[ae],ce.flags|=16):de.push(ae)}}function d(ce,ae){if(!s)return null;for(;ae!==null;)i(ce,ae),ae=ae.sibling;return null}function g(ce,ae){for(ce=new Map;ae!==null;)ae.key!==null?ce.set(ae.key,ae):ce.set(ae.index,ae),ae=ae.sibling;return ce}function v(ce,ae){return ce=Sa(ce,ae),ce.index=0,ce.sibling=null,ce}function N(ce,ae,de){return ce.index=de,s?(de=ce.alternate,de!==null?(de=de.index,de<ae?(ce.flags|=2,ae):de):(ce.flags|=2,ae)):(ce.flags|=1048576,ae)}function M(ce){return s&&ce.alternate===null&&(ce.flags|=2),ce}function Q(ce,ae,de,Ee){return ae===null||ae.tag!==6?(ae=mp(de,ce.mode,Ee),ae.return=ce,ae):(ae=v(ae,de),ae.return=ce,ae)}function re(ce,ae,de,Ee){var We=de.type;return We===A?be(ce,ae,de.props.children,Ee,de.key):ae!==null&&(ae.elementType===We||typeof We=="object"&&We!==null&&We.$$typeof===W&&Ob(We)===ae.type)?(Ee=v(ae,de.props),Ee.ref=tc(ce,ae,de),Ee.return=ce,Ee):(Ee=dd(de.type,de.key,de.props,null,ce.mode,Ee),Ee.ref=tc(ce,ae,de),Ee.return=ce,Ee)}function fe(ce,ae,de,Ee){return ae===null||ae.tag!==4||ae.stateNode.containerInfo!==de.containerInfo||ae.stateNode.implementation!==de.implementation?(ae=gp(de,ce.mode,Ee),ae.return=ce,ae):(ae=v(ae,de.children||[]),ae.return=ce,ae)}function be(ce,ae,de,Ee,We){return ae===null||ae.tag!==7?(ae=Co(de,ce.mode,Ee,We),ae.return=ce,ae):(ae=v(ae,de),ae.return=ce,ae)}function ke(ce,ae,de){if(typeof ae=="string"&&ae!==""||typeof ae=="number")return ae=mp(""+ae,ce.mode,de),ae.return=ce,ae;if(typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case T:return de=dd(ae.type,ae.key,ae.props,null,ce.mode,de),de.ref=tc(ce,null,ae),de.return=ce,de;case R:return ae=gp(ae,ce.mode,de),ae.return=ce,ae;case W:var Ee=ae._init;return ke(ce,Ee(ae._payload),de)}if(ot(ae)||U(ae))return ae=Co(ae,ce.mode,de,null),ae.return=ce,ae;Bu(ce,ae)}return null}function xe(ce,ae,de,Ee){var We=ae!==null?ae.key:null;if(typeof de=="string"&&de!==""||typeof de=="number")return We!==null?null:Q(ce,ae,""+de,Ee);if(typeof de=="object"&&de!==null){switch(de.$$typeof){case T:return de.key===We?re(ce,ae,de,Ee):null;case R:return de.key===We?fe(ce,ae,de,Ee):null;case W:return We=de._init,xe(ce,ae,We(de._payload),Ee)}if(ot(de)||U(de))return We!==null?null:be(ce,ae,de,Ee,null);Bu(ce,de)}return null}function Pe(ce,ae,de,Ee,We){if(typeof Ee=="string"&&Ee!==""||typeof Ee=="number")return ce=ce.get(de)||null,Q(ae,ce,""+Ee,We);if(typeof Ee=="object"&&Ee!==null){switch(Ee.$$typeof){case T:return ce=ce.get(Ee.key===null?de:Ee.key)||null,re(ae,ce,Ee,We);case R:return ce=ce.get(Ee.key===null?de:Ee.key)||null,fe(ae,ce,Ee,We);case W:var Qe=Ee._init;return Pe(ce,ae,de,Qe(Ee._payload),We)}if(ot(Ee)||U(Ee))return ce=ce.get(de)||null,be(ae,ce,Ee,We,null);Bu(ae,Ee)}return null}function ze(ce,ae,de,Ee){for(var We=null,Qe=null,Je=ae,st=ae=0,un=null;Je!==null&&st<de.length;st++){Je.index>st?(un=Je,Je=null):un=Je.sibling;var vt=xe(ce,Je,de[st],Ee);if(vt===null){Je===null&&(Je=un);break}s&&Je&&vt.alternate===null&&i(ce,Je),ae=N(vt,ae,st),Qe===null?We=vt:Qe.sibling=vt,Qe=vt,Je=un}if(st===de.length)return d(ce,Je),Mt&&xo(ce,st),We;if(Je===null){for(;st<de.length;st++)Je=ke(ce,de[st],Ee),Je!==null&&(ae=N(Je,ae,st),Qe===null?We=Je:Qe.sibling=Je,Qe=Je);return Mt&&xo(ce,st),We}for(Je=g(ce,Je);st<de.length;st++)un=Pe(Je,ce,st,de[st],Ee),un!==null&&(s&&un.alternate!==null&&Je.delete(un.key===null?st:un.key),ae=N(un,ae,st),Qe===null?We=un:Qe.sibling=un,Qe=un);return s&&Je.forEach(function(ja){return i(ce,ja)}),Mt&&xo(ce,st),We}function He(ce,ae,de,Ee){var We=U(de);if(typeof We!="function")throw Error(n(150));if(de=We.call(de),de==null)throw Error(n(151));for(var Qe=We=null,Je=ae,st=ae=0,un=null,vt=de.next();Je!==null&&!vt.done;st++,vt=de.next()){Je.index>st?(un=Je,Je=null):un=Je.sibling;var ja=xe(ce,Je,vt.value,Ee);if(ja===null){Je===null&&(Je=un);break}s&&Je&&ja.alternate===null&&i(ce,Je),ae=N(ja,ae,st),Qe===null?We=ja:Qe.sibling=ja,Qe=ja,Je=un}if(vt.done)return d(ce,Je),Mt&&xo(ce,st),We;if(Je===null){for(;!vt.done;st++,vt=de.next())vt=ke(ce,vt.value,Ee),vt!==null&&(ae=N(vt,ae,st),Qe===null?We=vt:Qe.sibling=vt,Qe=vt);return Mt&&xo(ce,st),We}for(Je=g(ce,Je);!vt.done;st++,vt=de.next())vt=Pe(Je,ce,st,vt.value,Ee),vt!==null&&(s&&vt.alternate!==null&&Je.delete(vt.key===null?st:vt.key),ae=N(vt,ae,st),Qe===null?We=vt:Qe.sibling=vt,Qe=vt);return s&&Je.forEach(function(T$){return i(ce,T$)}),Mt&&xo(ce,st),We}function Ht(ce,ae,de,Ee){if(typeof de=="object"&&de!==null&&de.type===A&&de.key===null&&(de=de.props.children),typeof de=="object"&&de!==null){switch(de.$$typeof){case T:e:{for(var We=de.key,Qe=ae;Qe!==null;){if(Qe.key===We){if(We=de.type,We===A){if(Qe.tag===7){d(ce,Qe.sibling),ae=v(Qe,de.props.children),ae.return=ce,ce=ae;break e}}else if(Qe.elementType===We||typeof We=="object"&&We!==null&&We.$$typeof===W&&Ob(We)===Qe.type){d(ce,Qe.sibling),ae=v(Qe,de.props),ae.ref=tc(ce,Qe,de),ae.return=ce,ce=ae;break e}d(ce,Qe);break}else i(ce,Qe);Qe=Qe.sibling}de.type===A?(ae=Co(de.props.children,ce.mode,Ee,de.key),ae.return=ce,ce=ae):(Ee=dd(de.type,de.key,de.props,null,ce.mode,Ee),Ee.ref=tc(ce,ae,de),Ee.return=ce,ce=Ee)}return M(ce);case R:e:{for(Qe=de.key;ae!==null;){if(ae.key===Qe)if(ae.tag===4&&ae.stateNode.containerInfo===de.containerInfo&&ae.stateNode.implementation===de.implementation){d(ce,ae.sibling),ae=v(ae,de.children||[]),ae.return=ce,ce=ae;break e}else{d(ce,ae);break}else i(ce,ae);ae=ae.sibling}ae=gp(de,ce.mode,Ee),ae.return=ce,ce=ae}return M(ce);case W:return Qe=de._init,Ht(ce,ae,Qe(de._payload),Ee)}if(ot(de))return ze(ce,ae,de,Ee);if(U(de))return He(ce,ae,de,Ee);Bu(ce,de)}return typeof de=="string"&&de!==""||typeof de=="number"?(de=""+de,ae!==null&&ae.tag===6?(d(ce,ae.sibling),ae=v(ae,de),ae.return=ce,ce=ae):(d(ce,ae),ae=mp(de,ce.mode,Ee),ae.return=ce,ce=ae),M(ce)):d(ce,ae)}return Ht}var Si=Lb(!0),Pb=Lb(!1),zu=Nt(null),Hu=null,ji=null,Sf=null;function jf(){Sf=ji=Hu=null}function Ef(s){var i=zu.current;at(zu),s._currentValue=i}function Cf(s,i,d){for(;s!==null;){var g=s.alternate;if((s.childLanes&i)!==i?(s.childLanes|=i,g!==null&&(g.childLanes|=i)):g!==null&&(g.childLanes&i)!==i&&(g.childLanes|=i),s===d)break;s=s.return}}function Ei(s,i){Hu=s,Sf=ji=null,s=s.dependencies,s!==null&&s.firstContext!==null&&((s.lanes&i)!==0&&(Fn=!0),s.firstContext=null)}function fr(s){var i=s._currentValue;if(Sf!==s)if(s={context:s,memoizedValue:i,next:null},ji===null){if(Hu===null)throw Error(n(308));ji=s,Hu.dependencies={lanes:0,firstContext:s}}else ji=ji.next=s;return i}var bo=null;function Tf(s){bo===null?bo=[s]:bo.push(s)}function Db(s,i,d,g){var v=i.interleaved;return v===null?(d.next=d,Tf(i)):(d.next=v.next,v.next=d),i.interleaved=d,Ls(s,g)}function Ls(s,i){s.lanes|=i;var d=s.alternate;for(d!==null&&(d.lanes|=i),d=s,s=s.return;s!==null;)s.childLanes|=i,d=s.alternate,d!==null&&(d.childLanes|=i),d=s,s=s.return;return d.tag===3?d.stateNode:null}var wa=!1;function Af(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Fb(s,i){s=s.updateQueue,i.updateQueue===s&&(i.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,effects:s.effects})}function Ps(s,i){return{eventTime:s,lane:i,tag:0,payload:null,callback:null,next:null}}function va(s,i,d){var g=s.updateQueue;if(g===null)return null;if(g=g.shared,(wt&2)!==0){var v=g.pending;return v===null?i.next=i:(i.next=v.next,v.next=i),g.pending=i,Ls(s,d)}return v=g.interleaved,v===null?(i.next=i,Tf(g)):(i.next=v.next,v.next=i),g.interleaved=i,Ls(s,d)}function Uu(s,i,d){if(i=i.updateQueue,i!==null&&(i=i.shared,(d&4194240)!==0)){var g=i.lanes;g&=s.pendingLanes,d|=g,i.lanes=d,ei(s,d)}}function qb(s,i){var d=s.updateQueue,g=s.alternate;if(g!==null&&(g=g.updateQueue,d===g)){var v=null,N=null;if(d=d.firstBaseUpdate,d!==null){do{var M={eventTime:d.eventTime,lane:d.lane,tag:d.tag,payload:d.payload,callback:d.callback,next:null};N===null?v=N=M:N=N.next=M,d=d.next}while(d!==null);N===null?v=N=i:N=N.next=i}else v=N=i;d={baseState:g.baseState,firstBaseUpdate:v,lastBaseUpdate:N,shared:g.shared,effects:g.effects},s.updateQueue=d;return}s=d.lastBaseUpdate,s===null?d.firstBaseUpdate=i:s.next=i,d.lastBaseUpdate=i}function Wu(s,i,d,g){var v=s.updateQueue;wa=!1;var N=v.firstBaseUpdate,M=v.lastBaseUpdate,Q=v.shared.pending;if(Q!==null){v.shared.pending=null;var re=Q,fe=re.next;re.next=null,M===null?N=fe:M.next=fe,M=re;var be=s.alternate;be!==null&&(be=be.updateQueue,Q=be.lastBaseUpdate,Q!==M&&(Q===null?be.firstBaseUpdate=fe:Q.next=fe,be.lastBaseUpdate=re))}if(N!==null){var ke=v.baseState;M=0,be=fe=re=null,Q=N;do{var xe=Q.lane,Pe=Q.eventTime;if((g&xe)===xe){be!==null&&(be=be.next={eventTime:Pe,lane:0,tag:Q.tag,payload:Q.payload,callback:Q.callback,next:null});e:{var ze=s,He=Q;switch(xe=i,Pe=d,He.tag){case 1:if(ze=He.payload,typeof ze=="function"){ke=ze.call(Pe,ke,xe);break e}ke=ze;break e;case 3:ze.flags=ze.flags&-65537|128;case 0:if(ze=He.payload,xe=typeof ze=="function"?ze.call(Pe,ke,xe):ze,xe==null)break e;ke=V({},ke,xe);break e;case 2:wa=!0}}Q.callback!==null&&Q.lane!==0&&(s.flags|=64,xe=v.effects,xe===null?v.effects=[Q]:xe.push(Q))}else Pe={eventTime:Pe,lane:xe,tag:Q.tag,payload:Q.payload,callback:Q.callback,next:null},be===null?(fe=be=Pe,re=ke):be=be.next=Pe,M|=xe;if(Q=Q.next,Q===null){if(Q=v.shared.pending,Q===null)break;xe=Q,Q=xe.next,xe.next=null,v.lastBaseUpdate=xe,v.shared.pending=null}}while(!0);if(be===null&&(re=ke),v.baseState=re,v.firstBaseUpdate=fe,v.lastBaseUpdate=be,i=v.shared.interleaved,i!==null){v=i;do M|=v.lane,v=v.next;while(v!==i)}else N===null&&(v.shared.lanes=0);_o|=M,s.lanes=M,s.memoizedState=ke}}function Bb(s,i,d){if(s=i.effects,i.effects=null,s!==null)for(i=0;i<s.length;i++){var g=s[i],v=g.callback;if(v!==null){if(g.callback=null,g=d,typeof v!="function")throw Error(n(191,v));v.call(g)}}}var nc={},is=Nt(nc),rc=Nt(nc),sc=Nt(nc);function ko(s){if(s===nc)throw Error(n(174));return s}function Rf(s,i){switch(gt(sc,i),gt(rc,s),gt(is,nc),s=i.nodeType,s){case 9:case 11:i=(i=i.documentElement)?i.namespaceURI:rt(null,"");break;default:s=s===8?i.parentNode:i,i=s.namespaceURI||null,s=s.tagName,i=rt(i,s)}at(is),gt(is,i)}function Ci(){at(is),at(rc),at(sc)}function zb(s){ko(sc.current);var i=ko(is.current),d=rt(i,s.type);i!==d&&(gt(rc,s),gt(is,d))}function Mf(s){rc.current===s&&(at(is),at(rc))}var Ot=Nt(0);function Vu(s){for(var i=s;i!==null;){if(i.tag===13){var d=i.memoizedState;if(d!==null&&(d=d.dehydrated,d===null||d.data==="$?"||d.data==="$!"))return i}else if(i.tag===19&&i.memoizedProps.revealOrder!==void 0){if((i.flags&128)!==0)return i}else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===s)break;for(;i.sibling===null;){if(i.return===null||i.return===s)return null;i=i.return}i.sibling.return=i.return,i=i.sibling}return null}var If=[];function $f(){for(var s=0;s<If.length;s++)If[s]._workInProgressVersionPrimary=null;If.length=0}var Gu=C.ReactCurrentDispatcher,Of=C.ReactCurrentBatchConfig,No=0,Lt=null,Zt=null,ln=null,Ku=!1,ac=!1,oc=0,ZI=0;function bn(){throw Error(n(321))}function Lf(s,i){if(i===null)return!1;for(var d=0;d<i.length&&d<s.length;d++)if(!er(s[d],i[d]))return!1;return!0}function Pf(s,i,d,g,v,N){if(No=N,Lt=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,Gu.current=s===null||s.memoizedState===null?t$:n$,s=d(g,v),ac){N=0;do{if(ac=!1,oc=0,25<=N)throw Error(n(301));N+=1,ln=Zt=null,i.updateQueue=null,Gu.current=r$,s=d(g,v)}while(ac)}if(Gu.current=Zu,i=Zt!==null&&Zt.next!==null,No=0,ln=Zt=Lt=null,Ku=!1,i)throw Error(n(300));return s}function Df(){var s=oc!==0;return oc=0,s}function ls(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ln===null?Lt.memoizedState=ln=s:ln=ln.next=s,ln}function pr(){if(Zt===null){var s=Lt.alternate;s=s!==null?s.memoizedState:null}else s=Zt.next;var i=ln===null?Lt.memoizedState:ln.next;if(i!==null)ln=i,Zt=s;else{if(s===null)throw Error(n(310));Zt=s,s={memoizedState:Zt.memoizedState,baseState:Zt.baseState,baseQueue:Zt.baseQueue,queue:Zt.queue,next:null},ln===null?Lt.memoizedState=ln=s:ln=ln.next=s}return ln}function ic(s,i){return typeof i=="function"?i(s):i}function Ff(s){var i=pr(),d=i.queue;if(d===null)throw Error(n(311));d.lastRenderedReducer=s;var g=Zt,v=g.baseQueue,N=d.pending;if(N!==null){if(v!==null){var M=v.next;v.next=N.next,N.next=M}g.baseQueue=v=N,d.pending=null}if(v!==null){N=v.next,g=g.baseState;var Q=M=null,re=null,fe=N;do{var be=fe.lane;if((No&be)===be)re!==null&&(re=re.next={lane:0,action:fe.action,hasEagerState:fe.hasEagerState,eagerState:fe.eagerState,next:null}),g=fe.hasEagerState?fe.eagerState:s(g,fe.action);else{var ke={lane:be,action:fe.action,hasEagerState:fe.hasEagerState,eagerState:fe.eagerState,next:null};re===null?(Q=re=ke,M=g):re=re.next=ke,Lt.lanes|=be,_o|=be}fe=fe.next}while(fe!==null&&fe!==N);re===null?M=g:re.next=Q,er(g,i.memoizedState)||(Fn=!0),i.memoizedState=g,i.baseState=M,i.baseQueue=re,d.lastRenderedState=g}if(s=d.interleaved,s!==null){v=s;do N=v.lane,Lt.lanes|=N,_o|=N,v=v.next;while(v!==s)}else v===null&&(d.lanes=0);return[i.memoizedState,d.dispatch]}function qf(s){var i=pr(),d=i.queue;if(d===null)throw Error(n(311));d.lastRenderedReducer=s;var g=d.dispatch,v=d.pending,N=i.memoizedState;if(v!==null){d.pending=null;var M=v=v.next;do N=s(N,M.action),M=M.next;while(M!==v);er(N,i.memoizedState)||(Fn=!0),i.memoizedState=N,i.baseQueue===null&&(i.baseState=N),d.lastRenderedState=N}return[N,g]}function Hb(){}function Ub(s,i){var d=Lt,g=pr(),v=i(),N=!er(g.memoizedState,v);if(N&&(g.memoizedState=v,Fn=!0),g=g.queue,Bf(Gb.bind(null,d,g,s),[s]),g.getSnapshot!==i||N||ln!==null&&ln.memoizedState.tag&1){if(d.flags|=2048,lc(9,Vb.bind(null,d,g,v,i),void 0,null),cn===null)throw Error(n(349));(No&30)!==0||Wb(d,i,v)}return v}function Wb(s,i,d){s.flags|=16384,s={getSnapshot:i,value:d},i=Lt.updateQueue,i===null?(i={lastEffect:null,stores:null},Lt.updateQueue=i,i.stores=[s]):(d=i.stores,d===null?i.stores=[s]:d.push(s))}function Vb(s,i,d,g){i.value=d,i.getSnapshot=g,Kb(i)&&Yb(s)}function Gb(s,i,d){return d(function(){Kb(i)&&Yb(s)})}function Kb(s){var i=s.getSnapshot;s=s.value;try{var d=i();return!er(s,d)}catch{return!0}}function Yb(s){var i=Ls(s,1);i!==null&&Fr(i,s,1,-1)}function Xb(s){var i=ls();return typeof s=="function"&&(s=s()),i.memoizedState=i.baseState=s,s={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:ic,lastRenderedState:s},i.queue=s,s=s.dispatch=e$.bind(null,Lt,s),[i.memoizedState,s]}function lc(s,i,d,g){return s={tag:s,create:i,destroy:d,deps:g,next:null},i=Lt.updateQueue,i===null?(i={lastEffect:null,stores:null},Lt.updateQueue=i,i.lastEffect=s.next=s):(d=i.lastEffect,d===null?i.lastEffect=s.next=s:(g=d.next,d.next=s,s.next=g,i.lastEffect=s)),s}function Zb(){return pr().memoizedState}function Yu(s,i,d,g){var v=ls();Lt.flags|=s,v.memoizedState=lc(1|i,d,void 0,g===void 0?null:g)}function Xu(s,i,d,g){var v=pr();g=g===void 0?null:g;var N=void 0;if(Zt!==null){var M=Zt.memoizedState;if(N=M.destroy,g!==null&&Lf(g,M.deps)){v.memoizedState=lc(i,d,N,g);return}}Lt.flags|=s,v.memoizedState=lc(1|i,d,N,g)}function Qb(s,i){return Yu(8390656,8,s,i)}function Bf(s,i){return Xu(2048,8,s,i)}function Jb(s,i){return Xu(4,2,s,i)}function ek(s,i){return Xu(4,4,s,i)}function tk(s,i){if(typeof i=="function")return s=s(),i(s),function(){i(null)};if(i!=null)return s=s(),i.current=s,function(){i.current=null}}function nk(s,i,d){return d=d!=null?d.concat([s]):null,Xu(4,4,tk.bind(null,i,s),d)}function zf(){}function rk(s,i){var d=pr();i=i===void 0?null:i;var g=d.memoizedState;return g!==null&&i!==null&&Lf(i,g[1])?g[0]:(d.memoizedState=[s,i],s)}function sk(s,i){var d=pr();i=i===void 0?null:i;var g=d.memoizedState;return g!==null&&i!==null&&Lf(i,g[1])?g[0]:(s=s(),d.memoizedState=[s,i],s)}function ak(s,i,d){return(No&21)===0?(s.baseState&&(s.baseState=!1,Fn=!0),s.memoizedState=d):(er(d,i)||(d=fu(),Lt.lanes|=d,_o|=d,s.baseState=!0),i)}function QI(s,i){var d=lt;lt=d!==0&&4>d?d:4,s(!0);var g=Of.transition;Of.transition={};try{s(!1),i()}finally{lt=d,Of.transition=g}}function ok(){return pr().memoizedState}function JI(s,i,d){var g=Na(s);if(d={lane:g,action:d,hasEagerState:!1,eagerState:null,next:null},ik(s))lk(i,d);else if(d=Db(s,i,d,g),d!==null){var v=Tn();Fr(d,s,g,v),ck(d,i,g)}}function e$(s,i,d){var g=Na(s),v={lane:g,action:d,hasEagerState:!1,eagerState:null,next:null};if(ik(s))lk(i,v);else{var N=s.alternate;if(s.lanes===0&&(N===null||N.lanes===0)&&(N=i.lastRenderedReducer,N!==null))try{var M=i.lastRenderedState,Q=N(M,d);if(v.hasEagerState=!0,v.eagerState=Q,er(Q,M)){var re=i.interleaved;re===null?(v.next=v,Tf(i)):(v.next=re.next,re.next=v),i.interleaved=v;return}}catch{}finally{}d=Db(s,i,v,g),d!==null&&(v=Tn(),Fr(d,s,g,v),ck(d,i,g))}}function ik(s){var i=s.alternate;return s===Lt||i!==null&&i===Lt}function lk(s,i){ac=Ku=!0;var d=s.pending;d===null?i.next=i:(i.next=d.next,d.next=i),s.pending=i}function ck(s,i,d){if((d&4194240)!==0){var g=i.lanes;g&=s.pendingLanes,d|=g,i.lanes=d,ei(s,d)}}var Zu={readContext:fr,useCallback:bn,useContext:bn,useEffect:bn,useImperativeHandle:bn,useInsertionEffect:bn,useLayoutEffect:bn,useMemo:bn,useReducer:bn,useRef:bn,useState:bn,useDebugValue:bn,useDeferredValue:bn,useTransition:bn,useMutableSource:bn,useSyncExternalStore:bn,useId:bn,unstable_isNewReconciler:!1},t$={readContext:fr,useCallback:function(s,i){return ls().memoizedState=[s,i===void 0?null:i],s},useContext:fr,useEffect:Qb,useImperativeHandle:function(s,i,d){return d=d!=null?d.concat([s]):null,Yu(4194308,4,tk.bind(null,i,s),d)},useLayoutEffect:function(s,i){return Yu(4194308,4,s,i)},useInsertionEffect:function(s,i){return Yu(4,2,s,i)},useMemo:function(s,i){var d=ls();return i=i===void 0?null:i,s=s(),d.memoizedState=[s,i],s},useReducer:function(s,i,d){var g=ls();return i=d!==void 0?d(i):i,g.memoizedState=g.baseState=i,s={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:i},g.queue=s,s=s.dispatch=JI.bind(null,Lt,s),[g.memoizedState,s]},useRef:function(s){var i=ls();return s={current:s},i.memoizedState=s},useState:Xb,useDebugValue:zf,useDeferredValue:function(s){return ls().memoizedState=s},useTransition:function(){var s=Xb(!1),i=s[0];return s=QI.bind(null,s[1]),ls().memoizedState=s,[i,s]},useMutableSource:function(){},useSyncExternalStore:function(s,i,d){var g=Lt,v=ls();if(Mt){if(d===void 0)throw Error(n(407));d=d()}else{if(d=i(),cn===null)throw Error(n(349));(No&30)!==0||Wb(g,i,d)}v.memoizedState=d;var N={value:d,getSnapshot:i};return v.queue=N,Qb(Gb.bind(null,g,N,s),[s]),g.flags|=2048,lc(9,Vb.bind(null,g,N,d,i),void 0,null),d},useId:function(){var s=ls(),i=cn.identifierPrefix;if(Mt){var d=Os,g=$s;d=(g&~(1<<32-On(g)-1)).toString(32)+d,i=":"+i+"R"+d,d=oc++,0<d&&(i+="H"+d.toString(32)),i+=":"}else d=ZI++,i=":"+i+"r"+d.toString(32)+":";return s.memoizedState=i},unstable_isNewReconciler:!1},n$={readContext:fr,useCallback:rk,useContext:fr,useEffect:Bf,useImperativeHandle:nk,useInsertionEffect:Jb,useLayoutEffect:ek,useMemo:sk,useReducer:Ff,useRef:Zb,useState:function(){return Ff(ic)},useDebugValue:zf,useDeferredValue:function(s){var i=pr();return ak(i,Zt.memoizedState,s)},useTransition:function(){var s=Ff(ic)[0],i=pr().memoizedState;return[s,i]},useMutableSource:Hb,useSyncExternalStore:Ub,useId:ok,unstable_isNewReconciler:!1},r$={readContext:fr,useCallback:rk,useContext:fr,useEffect:Bf,useImperativeHandle:nk,useInsertionEffect:Jb,useLayoutEffect:ek,useMemo:sk,useReducer:qf,useRef:Zb,useState:function(){return qf(ic)},useDebugValue:zf,useDeferredValue:function(s){var i=pr();return Zt===null?i.memoizedState=s:ak(i,Zt.memoizedState,s)},useTransition:function(){var s=qf(ic)[0],i=pr().memoizedState;return[s,i]},useMutableSource:Hb,useSyncExternalStore:Ub,useId:ok,unstable_isNewReconciler:!1};function Lr(s,i){if(s&&s.defaultProps){i=V({},i),s=s.defaultProps;for(var d in s)i[d]===void 0&&(i[d]=s[d]);return i}return i}function Hf(s,i,d,g){i=s.memoizedState,d=d(g,i),d=d==null?i:V({},i,d),s.memoizedState=d,s.lanes===0&&(s.updateQueue.baseState=d)}var Qu={isMounted:function(s){return(s=s._reactInternals)?In(s)===s:!1},enqueueSetState:function(s,i,d){s=s._reactInternals;var g=Tn(),v=Na(s),N=Ps(g,v);N.payload=i,d!=null&&(N.callback=d),i=va(s,N,v),i!==null&&(Fr(i,s,v,g),Uu(i,s,v))},enqueueReplaceState:function(s,i,d){s=s._reactInternals;var g=Tn(),v=Na(s),N=Ps(g,v);N.tag=1,N.payload=i,d!=null&&(N.callback=d),i=va(s,N,v),i!==null&&(Fr(i,s,v,g),Uu(i,s,v))},enqueueForceUpdate:function(s,i){s=s._reactInternals;var d=Tn(),g=Na(s),v=Ps(d,g);v.tag=2,i!=null&&(v.callback=i),i=va(s,v,g),i!==null&&(Fr(i,s,g,d),Uu(i,s,g))}};function uk(s,i,d,g,v,N,M){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(g,N,M):i.prototype&&i.prototype.isPureReactComponent?!Es(d,g)||!Es(v,N):!0}function dk(s,i,d){var g=!1,v=Dn,N=i.contextType;return typeof N=="object"&&N!==null?N=fr(N):(v=xn(i)?as:zt.current,g=i.contextTypes,N=(g=g!=null)?os(s,v):Dn),i=new i(d,N),s.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,i.updater=Qu,s.stateNode=i,i._reactInternals=s,g&&(s=s.stateNode,s.__reactInternalMemoizedUnmaskedChildContext=v,s.__reactInternalMemoizedMaskedChildContext=N),i}function hk(s,i,d,g){s=i.state,typeof i.componentWillReceiveProps=="function"&&i.componentWillReceiveProps(d,g),typeof i.UNSAFE_componentWillReceiveProps=="function"&&i.UNSAFE_componentWillReceiveProps(d,g),i.state!==s&&Qu.enqueueReplaceState(i,i.state,null)}function Uf(s,i,d,g){var v=s.stateNode;v.props=d,v.state=s.memoizedState,v.refs={},Af(s);var N=i.contextType;typeof N=="object"&&N!==null?v.context=fr(N):(N=xn(i)?as:zt.current,v.context=os(s,N)),v.state=s.memoizedState,N=i.getDerivedStateFromProps,typeof N=="function"&&(Hf(s,i,N,d),v.state=s.memoizedState),typeof i.getDerivedStateFromProps=="function"||typeof v.getSnapshotBeforeUpdate=="function"||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(i=v.state,typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount(),i!==v.state&&Qu.enqueueReplaceState(v,v.state,null),Wu(s,d,v,g),v.state=s.memoizedState),typeof v.componentDidMount=="function"&&(s.flags|=4194308)}function Ti(s,i){try{var d="",g=i;do d+=ee(g),g=g.return;while(g);var v=d}catch(N){v=`
|
|
39
|
+
Error generating stack: `+N.message+`
|
|
40
|
+
`+N.stack}return{value:s,source:i,stack:v,digest:null}}function Wf(s,i,d){return{value:s,source:null,stack:d??null,digest:i??null}}function Vf(s,i){try{console.error(i.value)}catch(d){setTimeout(function(){throw d})}}var s$=typeof WeakMap=="function"?WeakMap:Map;function fk(s,i,d){d=Ps(-1,d),d.tag=3,d.payload={element:null};var g=i.value;return d.callback=function(){ad||(ad=!0,ip=g),Vf(s,i)},d}function pk(s,i,d){d=Ps(-1,d),d.tag=3;var g=s.type.getDerivedStateFromError;if(typeof g=="function"){var v=i.value;d.payload=function(){return g(v)},d.callback=function(){Vf(s,i)}}var N=s.stateNode;return N!==null&&typeof N.componentDidCatch=="function"&&(d.callback=function(){Vf(s,i),typeof g!="function"&&(ba===null?ba=new Set([this]):ba.add(this));var M=i.stack;this.componentDidCatch(i.value,{componentStack:M!==null?M:""})}),d}function mk(s,i,d){var g=s.pingCache;if(g===null){g=s.pingCache=new s$;var v=new Set;g.set(i,v)}else v=g.get(i),v===void 0&&(v=new Set,g.set(i,v));v.has(d)||(v.add(d),s=w$.bind(null,s,i,d),i.then(s,s))}function gk(s){do{var i;if((i=s.tag===13)&&(i=s.memoizedState,i=i!==null?i.dehydrated!==null:!0),i)return s;s=s.return}while(s!==null);return null}function yk(s,i,d,g,v){return(s.mode&1)===0?(s===i?s.flags|=65536:(s.flags|=128,d.flags|=131072,d.flags&=-52805,d.tag===1&&(d.alternate===null?d.tag=17:(i=Ps(-1,1),i.tag=2,va(d,i,1))),d.lanes|=1),s):(s.flags|=65536,s.lanes=v,s)}var a$=C.ReactCurrentOwner,Fn=!1;function Cn(s,i,d,g){i.child=s===null?Pb(i,null,d,g):Si(i,s.child,d,g)}function wk(s,i,d,g,v){d=d.render;var N=i.ref;return Ei(i,v),g=Pf(s,i,d,g,N,v),d=Df(),s!==null&&!Fn?(i.updateQueue=s.updateQueue,i.flags&=-2053,s.lanes&=~v,Ds(s,i,v)):(Mt&&d&&xf(i),i.flags|=1,Cn(s,i,g,v),i.child)}function vk(s,i,d,g,v){if(s===null){var N=d.type;return typeof N=="function"&&!pp(N)&&N.defaultProps===void 0&&d.compare===null&&d.defaultProps===void 0?(i.tag=15,i.type=N,xk(s,i,N,g,v)):(s=dd(d.type,null,g,i,i.mode,v),s.ref=i.ref,s.return=i,i.child=s)}if(N=s.child,(s.lanes&v)===0){var M=N.memoizedProps;if(d=d.compare,d=d!==null?d:Es,d(M,g)&&s.ref===i.ref)return Ds(s,i,v)}return i.flags|=1,s=Sa(N,g),s.ref=i.ref,s.return=i,i.child=s}function xk(s,i,d,g,v){if(s!==null){var N=s.memoizedProps;if(Es(N,g)&&s.ref===i.ref)if(Fn=!1,i.pendingProps=g=N,(s.lanes&v)!==0)(s.flags&131072)!==0&&(Fn=!0);else return i.lanes=s.lanes,Ds(s,i,v)}return Gf(s,i,d,g,v)}function bk(s,i,d){var g=i.pendingProps,v=g.children,N=s!==null?s.memoizedState:null;if(g.mode==="hidden")if((i.mode&1)===0)i.memoizedState={baseLanes:0,cachePool:null,transitions:null},gt(Ri,sr),sr|=d;else{if((d&1073741824)===0)return s=N!==null?N.baseLanes|d:d,i.lanes=i.childLanes=1073741824,i.memoizedState={baseLanes:s,cachePool:null,transitions:null},i.updateQueue=null,gt(Ri,sr),sr|=s,null;i.memoizedState={baseLanes:0,cachePool:null,transitions:null},g=N!==null?N.baseLanes:d,gt(Ri,sr),sr|=g}else N!==null?(g=N.baseLanes|d,i.memoizedState=null):g=d,gt(Ri,sr),sr|=g;return Cn(s,i,v,d),i.child}function kk(s,i){var d=i.ref;(s===null&&d!==null||s!==null&&s.ref!==d)&&(i.flags|=512,i.flags|=2097152)}function Gf(s,i,d,g,v){var N=xn(d)?as:zt.current;return N=os(i,N),Ei(i,v),d=Pf(s,i,d,g,N,v),g=Df(),s!==null&&!Fn?(i.updateQueue=s.updateQueue,i.flags&=-2053,s.lanes&=~v,Ds(s,i,v)):(Mt&&g&&xf(i),i.flags|=1,Cn(s,i,d,v),i.child)}function Nk(s,i,d,g,v){if(xn(d)){var N=!0;bi(i)}else N=!1;if(Ei(i,v),i.stateNode===null)ed(s,i),dk(i,d,g),Uf(i,d,g,v),g=!0;else if(s===null){var M=i.stateNode,Q=i.memoizedProps;M.props=Q;var re=M.context,fe=d.contextType;typeof fe=="object"&&fe!==null?fe=fr(fe):(fe=xn(d)?as:zt.current,fe=os(i,fe));var be=d.getDerivedStateFromProps,ke=typeof be=="function"||typeof M.getSnapshotBeforeUpdate=="function";ke||typeof M.UNSAFE_componentWillReceiveProps!="function"&&typeof M.componentWillReceiveProps!="function"||(Q!==g||re!==fe)&&hk(i,M,g,fe),wa=!1;var xe=i.memoizedState;M.state=xe,Wu(i,g,M,v),re=i.memoizedState,Q!==g||xe!==re||vn.current||wa?(typeof be=="function"&&(Hf(i,d,be,g),re=i.memoizedState),(Q=wa||uk(i,d,Q,g,xe,re,fe))?(ke||typeof M.UNSAFE_componentWillMount!="function"&&typeof M.componentWillMount!="function"||(typeof M.componentWillMount=="function"&&M.componentWillMount(),typeof M.UNSAFE_componentWillMount=="function"&&M.UNSAFE_componentWillMount()),typeof M.componentDidMount=="function"&&(i.flags|=4194308)):(typeof M.componentDidMount=="function"&&(i.flags|=4194308),i.memoizedProps=g,i.memoizedState=re),M.props=g,M.state=re,M.context=fe,g=Q):(typeof M.componentDidMount=="function"&&(i.flags|=4194308),g=!1)}else{M=i.stateNode,Fb(s,i),Q=i.memoizedProps,fe=i.type===i.elementType?Q:Lr(i.type,Q),M.props=fe,ke=i.pendingProps,xe=M.context,re=d.contextType,typeof re=="object"&&re!==null?re=fr(re):(re=xn(d)?as:zt.current,re=os(i,re));var Pe=d.getDerivedStateFromProps;(be=typeof Pe=="function"||typeof M.getSnapshotBeforeUpdate=="function")||typeof M.UNSAFE_componentWillReceiveProps!="function"&&typeof M.componentWillReceiveProps!="function"||(Q!==ke||xe!==re)&&hk(i,M,g,re),wa=!1,xe=i.memoizedState,M.state=xe,Wu(i,g,M,v);var ze=i.memoizedState;Q!==ke||xe!==ze||vn.current||wa?(typeof Pe=="function"&&(Hf(i,d,Pe,g),ze=i.memoizedState),(fe=wa||uk(i,d,fe,g,xe,ze,re)||!1)?(be||typeof M.UNSAFE_componentWillUpdate!="function"&&typeof M.componentWillUpdate!="function"||(typeof M.componentWillUpdate=="function"&&M.componentWillUpdate(g,ze,re),typeof M.UNSAFE_componentWillUpdate=="function"&&M.UNSAFE_componentWillUpdate(g,ze,re)),typeof M.componentDidUpdate=="function"&&(i.flags|=4),typeof M.getSnapshotBeforeUpdate=="function"&&(i.flags|=1024)):(typeof M.componentDidUpdate!="function"||Q===s.memoizedProps&&xe===s.memoizedState||(i.flags|=4),typeof M.getSnapshotBeforeUpdate!="function"||Q===s.memoizedProps&&xe===s.memoizedState||(i.flags|=1024),i.memoizedProps=g,i.memoizedState=ze),M.props=g,M.state=ze,M.context=re,g=fe):(typeof M.componentDidUpdate!="function"||Q===s.memoizedProps&&xe===s.memoizedState||(i.flags|=4),typeof M.getSnapshotBeforeUpdate!="function"||Q===s.memoizedProps&&xe===s.memoizedState||(i.flags|=1024),g=!1)}return Kf(s,i,d,g,N,v)}function Kf(s,i,d,g,v,N){kk(s,i);var M=(i.flags&128)!==0;if(!g&&!M)return v&&$t(i,d,!1),Ds(s,i,N);g=i.stateNode,a$.current=i;var Q=M&&typeof d.getDerivedStateFromError!="function"?null:g.render();return i.flags|=1,s!==null&&M?(i.child=Si(i,s.child,null,N),i.child=Si(i,null,Q,N)):Cn(s,i,Q,N),i.memoizedState=g.state,v&&$t(i,d,!0),i.child}function _k(s){var i=s.stateNode;i.pendingContext?ma(s,i.pendingContext,i.pendingContext!==i.context):i.context&&ma(s,i.context,!1),Rf(s,i.containerInfo)}function Sk(s,i,d,g,v){return _i(),_f(v),i.flags|=256,Cn(s,i,d,g),i.child}var Yf={dehydrated:null,treeContext:null,retryLane:0};function Xf(s){return{baseLanes:s,cachePool:null,transitions:null}}function jk(s,i,d){var g=i.pendingProps,v=Ot.current,N=!1,M=(i.flags&128)!==0,Q;if((Q=M)||(Q=s!==null&&s.memoizedState===null?!1:(v&2)!==0),Q?(N=!0,i.flags&=-129):(s===null||s.memoizedState!==null)&&(v|=1),gt(Ot,v&1),s===null)return Nf(i),s=i.memoizedState,s!==null&&(s=s.dehydrated,s!==null)?((i.mode&1)===0?i.lanes=1:s.data==="$!"?i.lanes=8:i.lanes=1073741824,null):(M=g.children,s=g.fallback,N?(g=i.mode,N=i.child,M={mode:"hidden",children:M},(g&1)===0&&N!==null?(N.childLanes=0,N.pendingProps=M):N=hd(M,g,0,null),s=Co(s,g,d,null),N.return=i,s.return=i,N.sibling=s,i.child=N,i.child.memoizedState=Xf(d),i.memoizedState=Yf,s):Zf(i,M));if(v=s.memoizedState,v!==null&&(Q=v.dehydrated,Q!==null))return o$(s,i,M,g,Q,v,d);if(N){N=g.fallback,M=i.mode,v=s.child,Q=v.sibling;var re={mode:"hidden",children:g.children};return(M&1)===0&&i.child!==v?(g=i.child,g.childLanes=0,g.pendingProps=re,i.deletions=null):(g=Sa(v,re),g.subtreeFlags=v.subtreeFlags&14680064),Q!==null?N=Sa(Q,N):(N=Co(N,M,d,null),N.flags|=2),N.return=i,g.return=i,g.sibling=N,i.child=g,g=N,N=i.child,M=s.child.memoizedState,M=M===null?Xf(d):{baseLanes:M.baseLanes|d,cachePool:null,transitions:M.transitions},N.memoizedState=M,N.childLanes=s.childLanes&~d,i.memoizedState=Yf,g}return N=s.child,s=N.sibling,g=Sa(N,{mode:"visible",children:g.children}),(i.mode&1)===0&&(g.lanes=d),g.return=i,g.sibling=null,s!==null&&(d=i.deletions,d===null?(i.deletions=[s],i.flags|=16):d.push(s)),i.child=g,i.memoizedState=null,g}function Zf(s,i){return i=hd({mode:"visible",children:i},s.mode,0,null),i.return=s,s.child=i}function Ju(s,i,d,g){return g!==null&&_f(g),Si(i,s.child,null,d),s=Zf(i,i.pendingProps.children),s.flags|=2,i.memoizedState=null,s}function o$(s,i,d,g,v,N,M){if(d)return i.flags&256?(i.flags&=-257,g=Wf(Error(n(422))),Ju(s,i,M,g)):i.memoizedState!==null?(i.child=s.child,i.flags|=128,null):(N=g.fallback,v=i.mode,g=hd({mode:"visible",children:g.children},v,0,null),N=Co(N,v,M,null),N.flags|=2,g.return=i,N.return=i,g.sibling=N,i.child=g,(i.mode&1)!==0&&Si(i,s.child,null,M),i.child.memoizedState=Xf(M),i.memoizedState=Yf,N);if((i.mode&1)===0)return Ju(s,i,M,null);if(v.data==="$!"){if(g=v.nextSibling&&v.nextSibling.dataset,g)var Q=g.dgst;return g=Q,N=Error(n(419)),g=Wf(N,g,void 0),Ju(s,i,M,g)}if(Q=(M&s.childLanes)!==0,Fn||Q){if(g=cn,g!==null){switch(M&-M){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&(g.suspendedLanes|M))!==0?0:v,v!==0&&v!==N.retryLane&&(N.retryLane=v,Ls(s,v),Fr(g,s,v,-1))}return fp(),g=Wf(Error(n(421))),Ju(s,i,M,g)}return v.data==="$?"?(i.flags|=128,i.child=s.child,i=v$.bind(null,s),v._reactRetry=i,null):(s=N.treeContext,rr=$r(v.nextSibling),nr=i,Mt=!0,Or=null,s!==null&&(dr[hr++]=$s,dr[hr++]=Os,dr[hr++]=vo,$s=s.id,Os=s.overflow,vo=i),i=Zf(i,g.children),i.flags|=4096,i)}function Ek(s,i,d){s.lanes|=i;var g=s.alternate;g!==null&&(g.lanes|=i),Cf(s.return,i,d)}function Qf(s,i,d,g,v){var N=s.memoizedState;N===null?s.memoizedState={isBackwards:i,rendering:null,renderingStartTime:0,last:g,tail:d,tailMode:v}:(N.isBackwards=i,N.rendering=null,N.renderingStartTime=0,N.last=g,N.tail=d,N.tailMode=v)}function Ck(s,i,d){var g=i.pendingProps,v=g.revealOrder,N=g.tail;if(Cn(s,i,g.children,d),g=Ot.current,(g&2)!==0)g=g&1|2,i.flags|=128;else{if(s!==null&&(s.flags&128)!==0)e:for(s=i.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&Ek(s,d,i);else if(s.tag===19)Ek(s,d,i);else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===i)break e;for(;s.sibling===null;){if(s.return===null||s.return===i)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}g&=1}if(gt(Ot,g),(i.mode&1)===0)i.memoizedState=null;else switch(v){case"forwards":for(d=i.child,v=null;d!==null;)s=d.alternate,s!==null&&Vu(s)===null&&(v=d),d=d.sibling;d=v,d===null?(v=i.child,i.child=null):(v=d.sibling,d.sibling=null),Qf(i,!1,v,d,N);break;case"backwards":for(d=null,v=i.child,i.child=null;v!==null;){if(s=v.alternate,s!==null&&Vu(s)===null){i.child=v;break}s=v.sibling,v.sibling=d,d=v,v=s}Qf(i,!0,d,null,N);break;case"together":Qf(i,!1,null,null,void 0);break;default:i.memoizedState=null}return i.child}function ed(s,i){(i.mode&1)===0&&s!==null&&(s.alternate=null,i.alternate=null,i.flags|=2)}function Ds(s,i,d){if(s!==null&&(i.dependencies=s.dependencies),_o|=i.lanes,(d&i.childLanes)===0)return null;if(s!==null&&i.child!==s.child)throw Error(n(153));if(i.child!==null){for(s=i.child,d=Sa(s,s.pendingProps),i.child=d,d.return=i;s.sibling!==null;)s=s.sibling,d=d.sibling=Sa(s,s.pendingProps),d.return=i;d.sibling=null}return i.child}function i$(s,i,d){switch(i.tag){case 3:_k(i),_i();break;case 5:zb(i);break;case 1:xn(i.type)&&bi(i);break;case 4:Rf(i,i.stateNode.containerInfo);break;case 10:var g=i.type._context,v=i.memoizedProps.value;gt(zu,g._currentValue),g._currentValue=v;break;case 13:if(g=i.memoizedState,g!==null)return g.dehydrated!==null?(gt(Ot,Ot.current&1),i.flags|=128,null):(d&i.child.childLanes)!==0?jk(s,i,d):(gt(Ot,Ot.current&1),s=Ds(s,i,d),s!==null?s.sibling:null);gt(Ot,Ot.current&1);break;case 19:if(g=(d&i.childLanes)!==0,(s.flags&128)!==0){if(g)return Ck(s,i,d);i.flags|=128}if(v=i.memoizedState,v!==null&&(v.rendering=null,v.tail=null,v.lastEffect=null),gt(Ot,Ot.current),g)break;return null;case 22:case 23:return i.lanes=0,bk(s,i,d)}return Ds(s,i,d)}var Tk,Jf,Ak,Rk;Tk=function(s,i){for(var d=i.child;d!==null;){if(d.tag===5||d.tag===6)s.appendChild(d.stateNode);else if(d.tag!==4&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===i)break;for(;d.sibling===null;){if(d.return===null||d.return===i)return;d=d.return}d.sibling.return=d.return,d=d.sibling}},Jf=function(){},Ak=function(s,i,d,g){var v=s.memoizedProps;if(v!==g){s=i.stateNode,ko(is.current);var N=null;switch(d){case"input":v=Le(s,v),g=Le(s,g),N=[];break;case"select":v=V({},v,{value:void 0}),g=V({},g,{value:void 0}),N=[];break;case"textarea":v=oe(s,v),g=oe(s,g),N=[];break;default:typeof v.onClick!="function"&&typeof g.onClick=="function"&&(s.onclick=fa)}Tt(d,g);var M;d=null;for(fe in v)if(!g.hasOwnProperty(fe)&&v.hasOwnProperty(fe)&&v[fe]!=null)if(fe==="style"){var Q=v[fe];for(M in Q)Q.hasOwnProperty(M)&&(d||(d={}),d[M]="")}else fe!=="dangerouslySetInnerHTML"&&fe!=="children"&&fe!=="suppressContentEditableWarning"&&fe!=="suppressHydrationWarning"&&fe!=="autoFocus"&&(a.hasOwnProperty(fe)?N||(N=[]):(N=N||[]).push(fe,null));for(fe in g){var re=g[fe];if(Q=v!=null?v[fe]:void 0,g.hasOwnProperty(fe)&&re!==Q&&(re!=null||Q!=null))if(fe==="style")if(Q){for(M in Q)!Q.hasOwnProperty(M)||re&&re.hasOwnProperty(M)||(d||(d={}),d[M]="");for(M in re)re.hasOwnProperty(M)&&Q[M]!==re[M]&&(d||(d={}),d[M]=re[M])}else d||(N||(N=[]),N.push(fe,d)),d=re;else fe==="dangerouslySetInnerHTML"?(re=re?re.__html:void 0,Q=Q?Q.__html:void 0,re!=null&&Q!==re&&(N=N||[]).push(fe,re)):fe==="children"?typeof re!="string"&&typeof re!="number"||(N=N||[]).push(fe,""+re):fe!=="suppressContentEditableWarning"&&fe!=="suppressHydrationWarning"&&(a.hasOwnProperty(fe)?(re!=null&&fe==="onScroll"&&it("scroll",s),N||Q===re||(N=[])):(N=N||[]).push(fe,re))}d&&(N=N||[]).push("style",d);var fe=N;(i.updateQueue=fe)&&(i.flags|=4)}},Rk=function(s,i,d,g){d!==g&&(i.flags|=4)};function cc(s,i){if(!Mt)switch(s.tailMode){case"hidden":i=s.tail;for(var d=null;i!==null;)i.alternate!==null&&(d=i),i=i.sibling;d===null?s.tail=null:d.sibling=null;break;case"collapsed":d=s.tail;for(var g=null;d!==null;)d.alternate!==null&&(g=d),d=d.sibling;g===null?i||s.tail===null?s.tail=null:s.tail.sibling=null:g.sibling=null}}function kn(s){var i=s.alternate!==null&&s.alternate.child===s.child,d=0,g=0;if(i)for(var v=s.child;v!==null;)d|=v.lanes|v.childLanes,g|=v.subtreeFlags&14680064,g|=v.flags&14680064,v.return=s,v=v.sibling;else for(v=s.child;v!==null;)d|=v.lanes|v.childLanes,g|=v.subtreeFlags,g|=v.flags,v.return=s,v=v.sibling;return s.subtreeFlags|=g,s.childLanes=d,i}function l$(s,i,d){var g=i.pendingProps;switch(bf(i),i.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return kn(i),null;case 1:return xn(i.type)&&wo(),kn(i),null;case 3:return g=i.stateNode,Ci(),at(vn),at(zt),$f(),g.pendingContext&&(g.context=g.pendingContext,g.pendingContext=null),(s===null||s.child===null)&&(qu(i)?i.flags|=4:s===null||s.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,Or!==null&&(up(Or),Or=null))),Jf(s,i),kn(i),null;case 5:Mf(i);var v=ko(sc.current);if(d=i.type,s!==null&&i.stateNode!=null)Ak(s,i,d,g,v),s.ref!==i.ref&&(i.flags|=512,i.flags|=2097152);else{if(!g){if(i.stateNode===null)throw Error(n(166));return kn(i),null}if(s=ko(is.current),qu(i)){g=i.stateNode,d=i.type;var N=i.memoizedProps;switch(g[tr]=i,g[pa]=N,s=(i.mode&1)!==0,d){case"dialog":it("cancel",g),it("close",g);break;case"iframe":case"object":case"embed":it("load",g);break;case"video":case"audio":for(v=0;v<Ts.length;v++)it(Ts[v],g);break;case"source":it("error",g);break;case"img":case"image":case"link":it("error",g),it("load",g);break;case"details":it("toggle",g);break;case"input":Te(g,N),it("invalid",g);break;case"select":g._wrapperState={wasMultiple:!!N.multiple},it("invalid",g);break;case"textarea":ye(g,N),it("invalid",g)}Tt(d,N),v=null;for(var M in N)if(N.hasOwnProperty(M)){var Q=N[M];M==="children"?typeof Q=="string"?g.textContent!==Q&&(N.suppressHydrationWarning!==!0&&Ms(g.textContent,Q,s),v=["children",Q]):typeof Q=="number"&&g.textContent!==""+Q&&(N.suppressHydrationWarning!==!0&&Ms(g.textContent,Q,s),v=["children",""+Q]):a.hasOwnProperty(M)&&Q!=null&&M==="onScroll"&&it("scroll",g)}switch(d){case"input":je(g),Se(g,N,!0);break;case"textarea":je(g),De(g);break;case"select":case"option":break;default:typeof N.onClick=="function"&&(g.onclick=fa)}g=v,i.updateQueue=g,g!==null&&(i.flags|=4)}else{M=v.nodeType===9?v:v.ownerDocument,s==="http://www.w3.org/1999/xhtml"&&(s=qe(d)),s==="http://www.w3.org/1999/xhtml"?d==="script"?(s=M.createElement("div"),s.innerHTML="<script><\/script>",s=s.removeChild(s.firstChild)):typeof g.is=="string"?s=M.createElement(d,{is:g.is}):(s=M.createElement(d),d==="select"&&(M=s,g.multiple?M.multiple=!0:g.size&&(M.size=g.size))):s=M.createElementNS(s,d),s[tr]=i,s[pa]=g,Tk(s,i,!1,!1),i.stateNode=s;e:{switch(M=jt(d,g),d){case"dialog":it("cancel",s),it("close",s),v=g;break;case"iframe":case"object":case"embed":it("load",s),v=g;break;case"video":case"audio":for(v=0;v<Ts.length;v++)it(Ts[v],s);v=g;break;case"source":it("error",s),v=g;break;case"img":case"image":case"link":it("error",s),it("load",s),v=g;break;case"details":it("toggle",s),v=g;break;case"input":Te(s,g),v=Le(s,g),it("invalid",s);break;case"option":v=g;break;case"select":s._wrapperState={wasMultiple:!!g.multiple},v=V({},g,{value:void 0}),it("invalid",s);break;case"textarea":ye(s,g),v=oe(s,g),it("invalid",s);break;default:v=g}Tt(d,v),Q=v;for(N in Q)if(Q.hasOwnProperty(N)){var re=Q[N];N==="style"?mt(s,re):N==="dangerouslySetInnerHTML"?(re=re?re.__html:void 0,re!=null&&ve(s,re)):N==="children"?typeof re=="string"?(d!=="textarea"||re!=="")&&Re(s,re):typeof re=="number"&&Re(s,""+re):N!=="suppressContentEditableWarning"&&N!=="suppressHydrationWarning"&&N!=="autoFocus"&&(a.hasOwnProperty(N)?re!=null&&N==="onScroll"&&it("scroll",s):re!=null&&E(s,N,re,M))}switch(d){case"input":je(s),Se(s,g,!1);break;case"textarea":je(s),De(s);break;case"option":g.value!=null&&s.setAttribute("value",""+ne(g.value));break;case"select":s.multiple=!!g.multiple,N=g.value,N!=null?$e(s,!!g.multiple,N,!1):g.defaultValue!=null&&$e(s,!!g.multiple,g.defaultValue,!0);break;default:typeof v.onClick=="function"&&(s.onclick=fa)}switch(d){case"button":case"input":case"select":case"textarea":g=!!g.autoFocus;break e;case"img":g=!0;break e;default:g=!1}}g&&(i.flags|=4)}i.ref!==null&&(i.flags|=512,i.flags|=2097152)}return kn(i),null;case 6:if(s&&i.stateNode!=null)Rk(s,i,s.memoizedProps,g);else{if(typeof g!="string"&&i.stateNode===null)throw Error(n(166));if(d=ko(sc.current),ko(is.current),qu(i)){if(g=i.stateNode,d=i.memoizedProps,g[tr]=i,(N=g.nodeValue!==d)&&(s=nr,s!==null))switch(s.tag){case 3:Ms(g.nodeValue,d,(s.mode&1)!==0);break;case 5:s.memoizedProps.suppressHydrationWarning!==!0&&Ms(g.nodeValue,d,(s.mode&1)!==0)}N&&(i.flags|=4)}else g=(d.nodeType===9?d:d.ownerDocument).createTextNode(g),g[tr]=i,i.stateNode=g}return kn(i),null;case 13:if(at(Ot),g=i.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(Mt&&rr!==null&&(i.mode&1)!==0&&(i.flags&128)===0)$b(),_i(),i.flags|=98560,N=!1;else if(N=qu(i),g!==null&&g.dehydrated!==null){if(s===null){if(!N)throw Error(n(318));if(N=i.memoizedState,N=N!==null?N.dehydrated:null,!N)throw Error(n(317));N[tr]=i}else _i(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;kn(i),N=!1}else Or!==null&&(up(Or),Or=null),N=!0;if(!N)return i.flags&65536?i:null}return(i.flags&128)!==0?(i.lanes=d,i):(g=g!==null,g!==(s!==null&&s.memoizedState!==null)&&g&&(i.child.flags|=8192,(i.mode&1)!==0&&(s===null||(Ot.current&1)!==0?Qt===0&&(Qt=3):fp())),i.updateQueue!==null&&(i.flags|=4),kn(i),null);case 4:return Ci(),Jf(s,i),s===null&&po(i.stateNode.containerInfo),kn(i),null;case 10:return Ef(i.type._context),kn(i),null;case 17:return xn(i.type)&&wo(),kn(i),null;case 19:if(at(Ot),N=i.memoizedState,N===null)return kn(i),null;if(g=(i.flags&128)!==0,M=N.rendering,M===null)if(g)cc(N,!1);else{if(Qt!==0||s!==null&&(s.flags&128)!==0)for(s=i.child;s!==null;){if(M=Vu(s),M!==null){for(i.flags|=128,cc(N,!1),g=M.updateQueue,g!==null&&(i.updateQueue=g,i.flags|=4),i.subtreeFlags=0,g=d,d=i.child;d!==null;)N=d,s=g,N.flags&=14680066,M=N.alternate,M===null?(N.childLanes=0,N.lanes=s,N.child=null,N.subtreeFlags=0,N.memoizedProps=null,N.memoizedState=null,N.updateQueue=null,N.dependencies=null,N.stateNode=null):(N.childLanes=M.childLanes,N.lanes=M.lanes,N.child=M.child,N.subtreeFlags=0,N.deletions=null,N.memoizedProps=M.memoizedProps,N.memoizedState=M.memoizedState,N.updateQueue=M.updateQueue,N.type=M.type,s=M.dependencies,N.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),d=d.sibling;return gt(Ot,Ot.current&1|2),i.child}s=s.sibling}N.tail!==null&&bt()>Mi&&(i.flags|=128,g=!0,cc(N,!1),i.lanes=4194304)}else{if(!g)if(s=Vu(M),s!==null){if(i.flags|=128,g=!0,d=s.updateQueue,d!==null&&(i.updateQueue=d,i.flags|=4),cc(N,!0),N.tail===null&&N.tailMode==="hidden"&&!M.alternate&&!Mt)return kn(i),null}else 2*bt()-N.renderingStartTime>Mi&&d!==1073741824&&(i.flags|=128,g=!0,cc(N,!1),i.lanes=4194304);N.isBackwards?(M.sibling=i.child,i.child=M):(d=N.last,d!==null?d.sibling=M:i.child=M,N.last=M)}return N.tail!==null?(i=N.tail,N.rendering=i,N.tail=i.sibling,N.renderingStartTime=bt(),i.sibling=null,d=Ot.current,gt(Ot,g?d&1|2:d&1),i):(kn(i),null);case 22:case 23:return hp(),g=i.memoizedState!==null,s!==null&&s.memoizedState!==null!==g&&(i.flags|=8192),g&&(i.mode&1)!==0?(sr&1073741824)!==0&&(kn(i),i.subtreeFlags&6&&(i.flags|=8192)):kn(i),null;case 24:return null;case 25:return null}throw Error(n(156,i.tag))}function c$(s,i){switch(bf(i),i.tag){case 1:return xn(i.type)&&wo(),s=i.flags,s&65536?(i.flags=s&-65537|128,i):null;case 3:return Ci(),at(vn),at(zt),$f(),s=i.flags,(s&65536)!==0&&(s&128)===0?(i.flags=s&-65537|128,i):null;case 5:return Mf(i),null;case 13:if(at(Ot),s=i.memoizedState,s!==null&&s.dehydrated!==null){if(i.alternate===null)throw Error(n(340));_i()}return s=i.flags,s&65536?(i.flags=s&-65537|128,i):null;case 19:return at(Ot),null;case 4:return Ci(),null;case 10:return Ef(i.type._context),null;case 22:case 23:return hp(),null;case 24:return null;default:return null}}var td=!1,Nn=!1,u$=typeof WeakSet=="function"?WeakSet:Set,Be=null;function Ai(s,i){var d=s.ref;if(d!==null)if(typeof d=="function")try{d(null)}catch(g){Pt(s,i,g)}else d.current=null}function ep(s,i,d){try{d()}catch(g){Pt(s,i,g)}}var Mk=!1;function d$(s,i){if(Yl=Ns,s=Ir(),ui(s)){if("selectionStart"in s)var d={start:s.selectionStart,end:s.selectionEnd};else e:{d=(d=s.ownerDocument)&&d.defaultView||window;var g=d.getSelection&&d.getSelection();if(g&&g.rangeCount!==0){d=g.anchorNode;var v=g.anchorOffset,N=g.focusNode;g=g.focusOffset;try{d.nodeType,N.nodeType}catch{d=null;break e}var M=0,Q=-1,re=-1,fe=0,be=0,ke=s,xe=null;t:for(;;){for(var Pe;ke!==d||v!==0&&ke.nodeType!==3||(Q=M+v),ke!==N||g!==0&&ke.nodeType!==3||(re=M+g),ke.nodeType===3&&(M+=ke.nodeValue.length),(Pe=ke.firstChild)!==null;)xe=ke,ke=Pe;for(;;){if(ke===s)break t;if(xe===d&&++fe===v&&(Q=M),xe===N&&++be===g&&(re=M),(Pe=ke.nextSibling)!==null)break;ke=xe,xe=ke.parentNode}ke=Pe}d=Q===-1||re===-1?null:{start:Q,end:re}}else d=null}d=d||{start:0,end:0}}else d=null;for(vi={focusedElem:s,selectionRange:d},Ns=!1,Be=i;Be!==null;)if(i=Be,s=i.child,(i.subtreeFlags&1028)!==0&&s!==null)s.return=i,Be=s;else for(;Be!==null;){i=Be;try{var ze=i.alternate;if((i.flags&1024)!==0)switch(i.tag){case 0:case 11:case 15:break;case 1:if(ze!==null){var He=ze.memoizedProps,Ht=ze.memoizedState,ce=i.stateNode,ae=ce.getSnapshotBeforeUpdate(i.elementType===i.type?He:Lr(i.type,He),Ht);ce.__reactInternalSnapshotBeforeUpdate=ae}break;case 3:var de=i.stateNode.containerInfo;de.nodeType===1?de.textContent="":de.nodeType===9&&de.documentElement&&de.removeChild(de.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(Ee){Pt(i,i.return,Ee)}if(s=i.sibling,s!==null){s.return=i.return,Be=s;break}Be=i.return}return ze=Mk,Mk=!1,ze}function uc(s,i,d){var g=i.updateQueue;if(g=g!==null?g.lastEffect:null,g!==null){var v=g=g.next;do{if((v.tag&s)===s){var N=v.destroy;v.destroy=void 0,N!==void 0&&ep(i,d,N)}v=v.next}while(v!==g)}}function nd(s,i){if(i=i.updateQueue,i=i!==null?i.lastEffect:null,i!==null){var d=i=i.next;do{if((d.tag&s)===s){var g=d.create;d.destroy=g()}d=d.next}while(d!==i)}}function tp(s){var i=s.ref;if(i!==null){var d=s.stateNode;switch(s.tag){case 5:s=d;break;default:s=d}typeof i=="function"?i(s):i.current=s}}function Ik(s){var i=s.alternate;i!==null&&(s.alternate=null,Ik(i)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(i=s.stateNode,i!==null&&(delete i[tr],delete i[pa],delete i[P],delete i[se],delete i[le])),s.stateNode=null,s.return=null,s.dependencies=null,s.memoizedProps=null,s.memoizedState=null,s.pendingProps=null,s.stateNode=null,s.updateQueue=null}function $k(s){return s.tag===5||s.tag===3||s.tag===4}function Ok(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||$k(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function np(s,i,d){var g=s.tag;if(g===5||g===6)s=s.stateNode,i?d.nodeType===8?d.parentNode.insertBefore(s,i):d.insertBefore(s,i):(d.nodeType===8?(i=d.parentNode,i.insertBefore(s,d)):(i=d,i.appendChild(s)),d=d._reactRootContainer,d!=null||i.onclick!==null||(i.onclick=fa));else if(g!==4&&(s=s.child,s!==null))for(np(s,i,d),s=s.sibling;s!==null;)np(s,i,d),s=s.sibling}function rp(s,i,d){var g=s.tag;if(g===5||g===6)s=s.stateNode,i?d.insertBefore(s,i):d.appendChild(s);else if(g!==4&&(s=s.child,s!==null))for(rp(s,i,d),s=s.sibling;s!==null;)rp(s,i,d),s=s.sibling}var fn=null,Pr=!1;function xa(s,i,d){for(d=d.child;d!==null;)Lk(s,i,d),d=d.sibling}function Lk(s,i,d){if($n&&typeof $n.onCommitFiberUnmount=="function")try{$n.onCommitFiberUnmount(vs,d)}catch{}switch(d.tag){case 5:Nn||Ai(d,i);case 6:var g=fn,v=Pr;fn=null,xa(s,i,d),fn=g,Pr=v,fn!==null&&(Pr?(s=fn,d=d.stateNode,s.nodeType===8?s.parentNode.removeChild(d):s.removeChild(d)):fn.removeChild(d.stateNode));break;case 18:fn!==null&&(Pr?(s=fn,d=d.stateNode,s.nodeType===8?Jl(s.parentNode,d):s.nodeType===1&&Jl(s,d),ra(s)):Jl(fn,d.stateNode));break;case 4:g=fn,v=Pr,fn=d.stateNode.containerInfo,Pr=!0,xa(s,i,d),fn=g,Pr=v;break;case 0:case 11:case 14:case 15:if(!Nn&&(g=d.updateQueue,g!==null&&(g=g.lastEffect,g!==null))){v=g=g.next;do{var N=v,M=N.destroy;N=N.tag,M!==void 0&&((N&2)!==0||(N&4)!==0)&&ep(d,i,M),v=v.next}while(v!==g)}xa(s,i,d);break;case 1:if(!Nn&&(Ai(d,i),g=d.stateNode,typeof g.componentWillUnmount=="function"))try{g.props=d.memoizedProps,g.state=d.memoizedState,g.componentWillUnmount()}catch(Q){Pt(d,i,Q)}xa(s,i,d);break;case 21:xa(s,i,d);break;case 22:d.mode&1?(Nn=(g=Nn)||d.memoizedState!==null,xa(s,i,d),Nn=g):xa(s,i,d);break;default:xa(s,i,d)}}function Pk(s){var i=s.updateQueue;if(i!==null){s.updateQueue=null;var d=s.stateNode;d===null&&(d=s.stateNode=new u$),i.forEach(function(g){var v=x$.bind(null,s,g);d.has(g)||(d.add(g),g.then(v,v))})}}function Dr(s,i){var d=i.deletions;if(d!==null)for(var g=0;g<d.length;g++){var v=d[g];try{var N=s,M=i,Q=M;e:for(;Q!==null;){switch(Q.tag){case 5:fn=Q.stateNode,Pr=!1;break e;case 3:fn=Q.stateNode.containerInfo,Pr=!0;break e;case 4:fn=Q.stateNode.containerInfo,Pr=!0;break e}Q=Q.return}if(fn===null)throw Error(n(160));Lk(N,M,v),fn=null,Pr=!1;var re=v.alternate;re!==null&&(re.return=null),v.return=null}catch(fe){Pt(v,i,fe)}}if(i.subtreeFlags&12854)for(i=i.child;i!==null;)Dk(i,s),i=i.sibling}function Dk(s,i){var d=s.alternate,g=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:if(Dr(i,s),cs(s),g&4){try{uc(3,s,s.return),nd(3,s)}catch(He){Pt(s,s.return,He)}try{uc(5,s,s.return)}catch(He){Pt(s,s.return,He)}}break;case 1:Dr(i,s),cs(s),g&512&&d!==null&&Ai(d,d.return);break;case 5:if(Dr(i,s),cs(s),g&512&&d!==null&&Ai(d,d.return),s.flags&32){var v=s.stateNode;try{Re(v,"")}catch(He){Pt(s,s.return,He)}}if(g&4&&(v=s.stateNode,v!=null)){var N=s.memoizedProps,M=d!==null?d.memoizedProps:N,Q=s.type,re=s.updateQueue;if(s.updateQueue=null,re!==null)try{Q==="input"&&N.type==="radio"&&N.name!=null&&nt(v,N),jt(Q,M);var fe=jt(Q,N);for(M=0;M<re.length;M+=2){var be=re[M],ke=re[M+1];be==="style"?mt(v,ke):be==="dangerouslySetInnerHTML"?ve(v,ke):be==="children"?Re(v,ke):E(v,be,ke,fe)}switch(Q){case"input":_e(v,N);break;case"textarea":Ce(v,N);break;case"select":var xe=v._wrapperState.wasMultiple;v._wrapperState.wasMultiple=!!N.multiple;var Pe=N.value;Pe!=null?$e(v,!!N.multiple,Pe,!1):xe!==!!N.multiple&&(N.defaultValue!=null?$e(v,!!N.multiple,N.defaultValue,!0):$e(v,!!N.multiple,N.multiple?[]:"",!1))}v[pa]=N}catch(He){Pt(s,s.return,He)}}break;case 6:if(Dr(i,s),cs(s),g&4){if(s.stateNode===null)throw Error(n(162));v=s.stateNode,N=s.memoizedProps;try{v.nodeValue=N}catch(He){Pt(s,s.return,He)}}break;case 3:if(Dr(i,s),cs(s),g&4&&d!==null&&d.memoizedState.isDehydrated)try{ra(i.containerInfo)}catch(He){Pt(s,s.return,He)}break;case 4:Dr(i,s),cs(s);break;case 13:Dr(i,s),cs(s),v=s.child,v.flags&8192&&(N=v.memoizedState!==null,v.stateNode.isHidden=N,!N||v.alternate!==null&&v.alternate.memoizedState!==null||(op=bt())),g&4&&Pk(s);break;case 22:if(be=d!==null&&d.memoizedState!==null,s.mode&1?(Nn=(fe=Nn)||be,Dr(i,s),Nn=fe):Dr(i,s),cs(s),g&8192){if(fe=s.memoizedState!==null,(s.stateNode.isHidden=fe)&&!be&&(s.mode&1)!==0)for(Be=s,be=s.child;be!==null;){for(ke=Be=be;Be!==null;){switch(xe=Be,Pe=xe.child,xe.tag){case 0:case 11:case 14:case 15:uc(4,xe,xe.return);break;case 1:Ai(xe,xe.return);var ze=xe.stateNode;if(typeof ze.componentWillUnmount=="function"){g=xe,d=xe.return;try{i=g,ze.props=i.memoizedProps,ze.state=i.memoizedState,ze.componentWillUnmount()}catch(He){Pt(g,d,He)}}break;case 5:Ai(xe,xe.return);break;case 22:if(xe.memoizedState!==null){Bk(ke);continue}}Pe!==null?(Pe.return=xe,Be=Pe):Bk(ke)}be=be.sibling}e:for(be=null,ke=s;;){if(ke.tag===5){if(be===null){be=ke;try{v=ke.stateNode,fe?(N=v.style,typeof N.setProperty=="function"?N.setProperty("display","none","important"):N.display="none"):(Q=ke.stateNode,re=ke.memoizedProps.style,M=re!=null&&re.hasOwnProperty("display")?re.display:null,Q.style.display=he("display",M))}catch(He){Pt(s,s.return,He)}}}else if(ke.tag===6){if(be===null)try{ke.stateNode.nodeValue=fe?"":ke.memoizedProps}catch(He){Pt(s,s.return,He)}}else if((ke.tag!==22&&ke.tag!==23||ke.memoizedState===null||ke===s)&&ke.child!==null){ke.child.return=ke,ke=ke.child;continue}if(ke===s)break e;for(;ke.sibling===null;){if(ke.return===null||ke.return===s)break e;be===ke&&(be=null),ke=ke.return}be===ke&&(be=null),ke.sibling.return=ke.return,ke=ke.sibling}}break;case 19:Dr(i,s),cs(s),g&4&&Pk(s);break;case 21:break;default:Dr(i,s),cs(s)}}function cs(s){var i=s.flags;if(i&2){try{e:{for(var d=s.return;d!==null;){if($k(d)){var g=d;break e}d=d.return}throw Error(n(160))}switch(g.tag){case 5:var v=g.stateNode;g.flags&32&&(Re(v,""),g.flags&=-33);var N=Ok(s);rp(s,N,v);break;case 3:case 4:var M=g.stateNode.containerInfo,Q=Ok(s);np(s,Q,M);break;default:throw Error(n(161))}}catch(re){Pt(s,s.return,re)}s.flags&=-3}i&4096&&(s.flags&=-4097)}function h$(s,i,d){Be=s,Fk(s)}function Fk(s,i,d){for(var g=(s.mode&1)!==0;Be!==null;){var v=Be,N=v.child;if(v.tag===22&&g){var M=v.memoizedState!==null||td;if(!M){var Q=v.alternate,re=Q!==null&&Q.memoizedState!==null||Nn;Q=td;var fe=Nn;if(td=M,(Nn=re)&&!fe)for(Be=v;Be!==null;)M=Be,re=M.child,M.tag===22&&M.memoizedState!==null?zk(v):re!==null?(re.return=M,Be=re):zk(v);for(;N!==null;)Be=N,Fk(N),N=N.sibling;Be=v,td=Q,Nn=fe}qk(s)}else(v.subtreeFlags&8772)!==0&&N!==null?(N.return=v,Be=N):qk(s)}}function qk(s){for(;Be!==null;){var i=Be;if((i.flags&8772)!==0){var d=i.alternate;try{if((i.flags&8772)!==0)switch(i.tag){case 0:case 11:case 15:Nn||nd(5,i);break;case 1:var g=i.stateNode;if(i.flags&4&&!Nn)if(d===null)g.componentDidMount();else{var v=i.elementType===i.type?d.memoizedProps:Lr(i.type,d.memoizedProps);g.componentDidUpdate(v,d.memoizedState,g.__reactInternalSnapshotBeforeUpdate)}var N=i.updateQueue;N!==null&&Bb(i,N,g);break;case 3:var M=i.updateQueue;if(M!==null){if(d=null,i.child!==null)switch(i.child.tag){case 5:d=i.child.stateNode;break;case 1:d=i.child.stateNode}Bb(i,M,d)}break;case 5:var Q=i.stateNode;if(d===null&&i.flags&4){d=Q;var re=i.memoizedProps;switch(i.type){case"button":case"input":case"select":case"textarea":re.autoFocus&&d.focus();break;case"img":re.src&&(d.src=re.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(i.memoizedState===null){var fe=i.alternate;if(fe!==null){var be=fe.memoizedState;if(be!==null){var ke=be.dehydrated;ke!==null&&ra(ke)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}Nn||i.flags&512&&tp(i)}catch(xe){Pt(i,i.return,xe)}}if(i===s){Be=null;break}if(d=i.sibling,d!==null){d.return=i.return,Be=d;break}Be=i.return}}function Bk(s){for(;Be!==null;){var i=Be;if(i===s){Be=null;break}var d=i.sibling;if(d!==null){d.return=i.return,Be=d;break}Be=i.return}}function zk(s){for(;Be!==null;){var i=Be;try{switch(i.tag){case 0:case 11:case 15:var d=i.return;try{nd(4,i)}catch(re){Pt(i,d,re)}break;case 1:var g=i.stateNode;if(typeof g.componentDidMount=="function"){var v=i.return;try{g.componentDidMount()}catch(re){Pt(i,v,re)}}var N=i.return;try{tp(i)}catch(re){Pt(i,N,re)}break;case 5:var M=i.return;try{tp(i)}catch(re){Pt(i,M,re)}}}catch(re){Pt(i,i.return,re)}if(i===s){Be=null;break}var Q=i.sibling;if(Q!==null){Q.return=i.return,Be=Q;break}Be=i.return}}var f$=Math.ceil,rd=C.ReactCurrentDispatcher,sp=C.ReactCurrentOwner,mr=C.ReactCurrentBatchConfig,wt=0,cn=null,Wt=null,pn=0,sr=0,Ri=Nt(0),Qt=0,dc=null,_o=0,sd=0,ap=0,hc=null,qn=null,op=0,Mi=1/0,Fs=null,ad=!1,ip=null,ba=null,od=!1,ka=null,id=0,fc=0,lp=null,ld=-1,cd=0;function Tn(){return(wt&6)!==0?bt():ld!==-1?ld:ld=bt()}function Na(s){return(s.mode&1)===0?1:(wt&2)!==0&&pn!==0?pn&-pn:XI.transition!==null?(cd===0&&(cd=fu()),cd):(s=lt,s!==0||(s=window.event,s=s===void 0?16:sa(s.type)),s)}function Fr(s,i,d,g){if(50<fc)throw fc=0,lp=null,Error(n(185));Er(s,d,g),((wt&2)===0||s!==cn)&&(s===cn&&((wt&2)===0&&(sd|=d),Qt===4&&_a(s,pn)),Bn(s,g),d===1&&wt===0&&(i.mode&1)===0&&(Mi=bt()+500,Pu&&ya()))}function Bn(s,i){var d=s.callbackNode;hu(s,i);var g=Yn(s,s===cn?pn:0);if(g===0)d!==null&&yt(d),s.callbackNode=null,s.callbackPriority=0;else if(i=g&-g,s.callbackPriority!==i){if(d!=null&&yt(d),i===1)s.tag===0?YI(Uk.bind(null,s)):Tb(Uk.bind(null,s)),yo(function(){(wt&6)===0&&ya()}),d=null;else{switch(Va(g)){case 1:d=jr;break;case 4:d=ws;break;case 16:d=Xr;break;case 536870912:d=Xo;break;default:d=Xr}d=Qk(d,Hk.bind(null,s))}s.callbackPriority=i,s.callbackNode=d}}function Hk(s,i){if(ld=-1,cd=0,(wt&6)!==0)throw Error(n(327));var d=s.callbackNode;if(Ii()&&s.callbackNode!==d)return null;var g=Yn(s,s===cn?pn:0);if(g===0)return null;if((g&30)!==0||(g&s.expiredLanes)!==0||i)i=ud(s,g);else{i=g;var v=wt;wt|=2;var N=Vk();(cn!==s||pn!==i)&&(Fs=null,Mi=bt()+500,jo(s,i));do try{g$();break}catch(Q){Wk(s,Q)}while(!0);jf(),rd.current=N,wt=v,Wt!==null?i=0:(cn=null,pn=0,i=Qt)}if(i!==0){if(i===2&&(v=Qo(s),v!==0&&(g=v,i=cp(s,v))),i===1)throw d=dc,jo(s,0),_a(s,g),Bn(s,bt()),d;if(i===6)_a(s,g);else{if(v=s.current.alternate,(g&30)===0&&!p$(v)&&(i=ud(s,g),i===2&&(N=Qo(s),N!==0&&(g=N,i=cp(s,N))),i===1))throw d=dc,jo(s,0),_a(s,g),Bn(s,bt()),d;switch(s.finishedWork=v,s.finishedLanes=g,i){case 0:case 1:throw Error(n(345));case 2:Eo(s,qn,Fs);break;case 3:if(_a(s,g),(g&130023424)===g&&(i=op+500-bt(),10<i)){if(Yn(s,0)!==0)break;if(v=s.suspendedLanes,(v&g)!==g){Tn(),s.pingedLanes|=s.suspendedLanes&v;break}s.timeoutHandle=Xl(Eo.bind(null,s,qn,Fs),i);break}Eo(s,qn,Fs);break;case 4:if(_a(s,g),(g&4194240)===g)break;for(i=s.eventTimes,v=-1;0<g;){var M=31-On(g);N=1<<M,M=i[M],M>v&&(v=M),g&=~N}if(g=v,g=bt()-g,g=(120>g?120:480>g?480:1080>g?1080:1920>g?1920:3e3>g?3e3:4320>g?4320:1960*f$(g/1960))-g,10<g){s.timeoutHandle=Xl(Eo.bind(null,s,qn,Fs),g);break}Eo(s,qn,Fs);break;case 5:Eo(s,qn,Fs);break;default:throw Error(n(329))}}}return Bn(s,bt()),s.callbackNode===d?Hk.bind(null,s):null}function cp(s,i){var d=hc;return s.current.memoizedState.isDehydrated&&(jo(s,i).flags|=256),s=ud(s,i),s!==2&&(i=qn,qn=d,i!==null&&up(i)),s}function up(s){qn===null?qn=s:qn.push.apply(qn,s)}function p$(s){for(var i=s;;){if(i.flags&16384){var d=i.updateQueue;if(d!==null&&(d=d.stores,d!==null))for(var g=0;g<d.length;g++){var v=d[g],N=v.getSnapshot;v=v.value;try{if(!er(N(),v))return!1}catch{return!1}}}if(d=i.child,i.subtreeFlags&16384&&d!==null)d.return=i,i=d;else{if(i===s)break;for(;i.sibling===null;){if(i.return===null||i.return===s)return!0;i=i.return}i.sibling.return=i.return,i=i.sibling}}return!0}function _a(s,i){for(i&=~ap,i&=~sd,s.suspendedLanes|=i,s.pingedLanes&=~i,s=s.expirationTimes;0<i;){var d=31-On(i),g=1<<d;s[d]=-1,i&=~g}}function Uk(s){if((wt&6)!==0)throw Error(n(327));Ii();var i=Yn(s,0);if((i&1)===0)return Bn(s,bt()),null;var d=ud(s,i);if(s.tag!==0&&d===2){var g=Qo(s);g!==0&&(i=g,d=cp(s,g))}if(d===1)throw d=dc,jo(s,0),_a(s,i),Bn(s,bt()),d;if(d===6)throw Error(n(345));return s.finishedWork=s.current.alternate,s.finishedLanes=i,Eo(s,qn,Fs),Bn(s,bt()),null}function dp(s,i){var d=wt;wt|=1;try{return s(i)}finally{wt=d,wt===0&&(Mi=bt()+500,Pu&&ya())}}function So(s){ka!==null&&ka.tag===0&&(wt&6)===0&&Ii();var i=wt;wt|=1;var d=mr.transition,g=lt;try{if(mr.transition=null,lt=1,s)return s()}finally{lt=g,mr.transition=d,wt=i,(wt&6)===0&&ya()}}function hp(){sr=Ri.current,at(Ri)}function jo(s,i){s.finishedWork=null,s.finishedLanes=0;var d=s.timeoutHandle;if(d!==-1&&(s.timeoutHandle=-1,wf(d)),Wt!==null)for(d=Wt.return;d!==null;){var g=d;switch(bf(g),g.tag){case 1:g=g.type.childContextTypes,g!=null&&wo();break;case 3:Ci(),at(vn),at(zt),$f();break;case 5:Mf(g);break;case 4:Ci();break;case 13:at(Ot);break;case 19:at(Ot);break;case 10:Ef(g.type._context);break;case 22:case 23:hp()}d=d.return}if(cn=s,Wt=s=Sa(s.current,null),pn=sr=i,Qt=0,dc=null,ap=sd=_o=0,qn=hc=null,bo!==null){for(i=0;i<bo.length;i++)if(d=bo[i],g=d.interleaved,g!==null){d.interleaved=null;var v=g.next,N=d.pending;if(N!==null){var M=N.next;N.next=v,g.next=M}d.pending=g}bo=null}return s}function Wk(s,i){do{var d=Wt;try{if(jf(),Gu.current=Zu,Ku){for(var g=Lt.memoizedState;g!==null;){var v=g.queue;v!==null&&(v.pending=null),g=g.next}Ku=!1}if(No=0,ln=Zt=Lt=null,ac=!1,oc=0,sp.current=null,d===null||d.return===null){Qt=1,dc=i,Wt=null;break}e:{var N=s,M=d.return,Q=d,re=i;if(i=pn,Q.flags|=32768,re!==null&&typeof re=="object"&&typeof re.then=="function"){var fe=re,be=Q,ke=be.tag;if((be.mode&1)===0&&(ke===0||ke===11||ke===15)){var xe=be.alternate;xe?(be.updateQueue=xe.updateQueue,be.memoizedState=xe.memoizedState,be.lanes=xe.lanes):(be.updateQueue=null,be.memoizedState=null)}var Pe=gk(M);if(Pe!==null){Pe.flags&=-257,yk(Pe,M,Q,N,i),Pe.mode&1&&mk(N,fe,i),i=Pe,re=fe;var ze=i.updateQueue;if(ze===null){var He=new Set;He.add(re),i.updateQueue=He}else ze.add(re);break e}else{if((i&1)===0){mk(N,fe,i),fp();break e}re=Error(n(426))}}else if(Mt&&Q.mode&1){var Ht=gk(M);if(Ht!==null){(Ht.flags&65536)===0&&(Ht.flags|=256),yk(Ht,M,Q,N,i),_f(Ti(re,Q));break e}}N=re=Ti(re,Q),Qt!==4&&(Qt=2),hc===null?hc=[N]:hc.push(N),N=M;do{switch(N.tag){case 3:N.flags|=65536,i&=-i,N.lanes|=i;var ce=fk(N,re,i);qb(N,ce);break e;case 1:Q=re;var ae=N.type,de=N.stateNode;if((N.flags&128)===0&&(typeof ae.getDerivedStateFromError=="function"||de!==null&&typeof de.componentDidCatch=="function"&&(ba===null||!ba.has(de)))){N.flags|=65536,i&=-i,N.lanes|=i;var Ee=pk(N,Q,i);qb(N,Ee);break e}}N=N.return}while(N!==null)}Kk(d)}catch(We){i=We,Wt===d&&d!==null&&(Wt=d=d.return);continue}break}while(!0)}function Vk(){var s=rd.current;return rd.current=Zu,s===null?Zu:s}function fp(){(Qt===0||Qt===3||Qt===2)&&(Qt=4),cn===null||(_o&268435455)===0&&(sd&268435455)===0||_a(cn,pn)}function ud(s,i){var d=wt;wt|=2;var g=Vk();(cn!==s||pn!==i)&&(Fs=null,jo(s,i));do try{m$();break}catch(v){Wk(s,v)}while(!0);if(jf(),wt=d,rd.current=g,Wt!==null)throw Error(n(261));return cn=null,pn=0,Qt}function m$(){for(;Wt!==null;)Gk(Wt)}function g$(){for(;Wt!==null&&!kt();)Gk(Wt)}function Gk(s){var i=Zk(s.alternate,s,sr);s.memoizedProps=s.pendingProps,i===null?Kk(s):Wt=i,sp.current=null}function Kk(s){var i=s;do{var d=i.alternate;if(s=i.return,(i.flags&32768)===0){if(d=l$(d,i,sr),d!==null){Wt=d;return}}else{if(d=c$(d,i),d!==null){d.flags&=32767,Wt=d;return}if(s!==null)s.flags|=32768,s.subtreeFlags=0,s.deletions=null;else{Qt=6,Wt=null;return}}if(i=i.sibling,i!==null){Wt=i;return}Wt=i=s}while(i!==null);Qt===0&&(Qt=5)}function Eo(s,i,d){var g=lt,v=mr.transition;try{mr.transition=null,lt=1,y$(s,i,d,g)}finally{mr.transition=v,lt=g}return null}function y$(s,i,d,g){do Ii();while(ka!==null);if((wt&6)!==0)throw Error(n(327));d=s.finishedWork;var v=s.finishedLanes;if(d===null)return null;if(s.finishedWork=null,s.finishedLanes=0,d===s.current)throw Error(n(177));s.callbackNode=null,s.callbackPriority=0;var N=d.lanes|d.childLanes;if(df(s,N),s===cn&&(Wt=cn=null,pn=0),(d.subtreeFlags&2064)===0&&(d.flags&2064)===0||od||(od=!0,Qk(Xr,function(){return Ii(),null})),N=(d.flags&15990)!==0,(d.subtreeFlags&15990)!==0||N){N=mr.transition,mr.transition=null;var M=lt;lt=1;var Q=wt;wt|=4,sp.current=null,d$(s,d),Dk(d,s),gf(vi),Ns=!!Yl,vi=Yl=null,s.current=d,h$(d),At(),wt=Q,lt=M,mr.transition=N}else s.current=d;if(od&&(od=!1,ka=s,id=v),N=s.pendingLanes,N===0&&(ba=null),xs(d.stateNode),Bn(s,bt()),i!==null)for(g=s.onRecoverableError,d=0;d<i.length;d++)v=i[d],g(v.value,{componentStack:v.stack,digest:v.digest});if(ad)throw ad=!1,s=ip,ip=null,s;return(id&1)!==0&&s.tag!==0&&Ii(),N=s.pendingLanes,(N&1)!==0?s===lp?fc++:(fc=0,lp=s):fc=0,ya(),null}function Ii(){if(ka!==null){var s=Va(id),i=mr.transition,d=lt;try{if(mr.transition=null,lt=16>s?16:s,ka===null)var g=!1;else{if(s=ka,ka=null,id=0,(wt&6)!==0)throw Error(n(331));var v=wt;for(wt|=4,Be=s.current;Be!==null;){var N=Be,M=N.child;if((Be.flags&16)!==0){var Q=N.deletions;if(Q!==null){for(var re=0;re<Q.length;re++){var fe=Q[re];for(Be=fe;Be!==null;){var be=Be;switch(be.tag){case 0:case 11:case 15:uc(8,be,N)}var ke=be.child;if(ke!==null)ke.return=be,Be=ke;else for(;Be!==null;){be=Be;var xe=be.sibling,Pe=be.return;if(Ik(be),be===fe){Be=null;break}if(xe!==null){xe.return=Pe,Be=xe;break}Be=Pe}}}var ze=N.alternate;if(ze!==null){var He=ze.child;if(He!==null){ze.child=null;do{var Ht=He.sibling;He.sibling=null,He=Ht}while(He!==null)}}Be=N}}if((N.subtreeFlags&2064)!==0&&M!==null)M.return=N,Be=M;else e:for(;Be!==null;){if(N=Be,(N.flags&2048)!==0)switch(N.tag){case 0:case 11:case 15:uc(9,N,N.return)}var ce=N.sibling;if(ce!==null){ce.return=N.return,Be=ce;break e}Be=N.return}}var ae=s.current;for(Be=ae;Be!==null;){M=Be;var de=M.child;if((M.subtreeFlags&2064)!==0&&de!==null)de.return=M,Be=de;else e:for(M=ae;Be!==null;){if(Q=Be,(Q.flags&2048)!==0)try{switch(Q.tag){case 0:case 11:case 15:nd(9,Q)}}catch(We){Pt(Q,Q.return,We)}if(Q===M){Be=null;break e}var Ee=Q.sibling;if(Ee!==null){Ee.return=Q.return,Be=Ee;break e}Be=Q.return}}if(wt=v,ya(),$n&&typeof $n.onPostCommitFiberRoot=="function")try{$n.onPostCommitFiberRoot(vs,s)}catch{}g=!0}return g}finally{lt=d,mr.transition=i}}return!1}function Yk(s,i,d){i=Ti(d,i),i=fk(s,i,1),s=va(s,i,1),i=Tn(),s!==null&&(Er(s,1,i),Bn(s,i))}function Pt(s,i,d){if(s.tag===3)Yk(s,s,d);else for(;i!==null;){if(i.tag===3){Yk(i,s,d);break}else if(i.tag===1){var g=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof g.componentDidCatch=="function"&&(ba===null||!ba.has(g))){s=Ti(d,s),s=pk(i,s,1),i=va(i,s,1),s=Tn(),i!==null&&(Er(i,1,s),Bn(i,s));break}}i=i.return}}function w$(s,i,d){var g=s.pingCache;g!==null&&g.delete(i),i=Tn(),s.pingedLanes|=s.suspendedLanes&d,cn===s&&(pn&d)===d&&(Qt===4||Qt===3&&(pn&130023424)===pn&&500>bt()-op?jo(s,0):ap|=d),Bn(s,i)}function Xk(s,i){i===0&&((s.mode&1)===0?i=1:(i=Wa,Wa<<=1,(Wa&130023424)===0&&(Wa=4194304)));var d=Tn();s=Ls(s,i),s!==null&&(Er(s,i,d),Bn(s,d))}function v$(s){var i=s.memoizedState,d=0;i!==null&&(d=i.retryLane),Xk(s,d)}function x$(s,i){var d=0;switch(s.tag){case 13:var g=s.stateNode,v=s.memoizedState;v!==null&&(d=v.retryLane);break;case 19:g=s.stateNode;break;default:throw Error(n(314))}g!==null&&g.delete(i),Xk(s,d)}var Zk;Zk=function(s,i,d){if(s!==null)if(s.memoizedProps!==i.pendingProps||vn.current)Fn=!0;else{if((s.lanes&d)===0&&(i.flags&128)===0)return Fn=!1,i$(s,i,d);Fn=(s.flags&131072)!==0}else Fn=!1,Mt&&(i.flags&1048576)!==0&&Ab(i,Fu,i.index);switch(i.lanes=0,i.tag){case 2:var g=i.type;ed(s,i),s=i.pendingProps;var v=os(i,zt.current);Ei(i,d),v=Pf(null,i,g,s,v,d);var N=Df();return i.flags|=1,typeof v=="object"&&v!==null&&typeof v.render=="function"&&v.$$typeof===void 0?(i.tag=1,i.memoizedState=null,i.updateQueue=null,xn(g)?(N=!0,bi(i)):N=!1,i.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,Af(i),v.updater=Qu,i.stateNode=v,v._reactInternals=i,Uf(i,g,s,d),i=Kf(null,i,g,!0,N,d)):(i.tag=0,Mt&&N&&xf(i),Cn(null,i,v,d),i=i.child),i;case 16:g=i.elementType;e:{switch(ed(s,i),s=i.pendingProps,v=g._init,g=v(g._payload),i.type=g,v=i.tag=k$(g),s=Lr(g,s),v){case 0:i=Gf(null,i,g,s,d);break e;case 1:i=Nk(null,i,g,s,d);break e;case 11:i=wk(null,i,g,s,d);break e;case 14:i=vk(null,i,g,Lr(g.type,s),d);break e}throw Error(n(306,g,""))}return i;case 0:return g=i.type,v=i.pendingProps,v=i.elementType===g?v:Lr(g,v),Gf(s,i,g,v,d);case 1:return g=i.type,v=i.pendingProps,v=i.elementType===g?v:Lr(g,v),Nk(s,i,g,v,d);case 3:e:{if(_k(i),s===null)throw Error(n(387));g=i.pendingProps,N=i.memoizedState,v=N.element,Fb(s,i),Wu(i,g,null,d);var M=i.memoizedState;if(g=M.element,N.isDehydrated)if(N={element:g,isDehydrated:!1,cache:M.cache,pendingSuspenseBoundaries:M.pendingSuspenseBoundaries,transitions:M.transitions},i.updateQueue.baseState=N,i.memoizedState=N,i.flags&256){v=Ti(Error(n(423)),i),i=Sk(s,i,g,d,v);break e}else if(g!==v){v=Ti(Error(n(424)),i),i=Sk(s,i,g,d,v);break e}else for(rr=$r(i.stateNode.containerInfo.firstChild),nr=i,Mt=!0,Or=null,d=Pb(i,null,g,d),i.child=d;d;)d.flags=d.flags&-3|4096,d=d.sibling;else{if(_i(),g===v){i=Ds(s,i,d);break e}Cn(s,i,g,d)}i=i.child}return i;case 5:return zb(i),s===null&&Nf(i),g=i.type,v=i.pendingProps,N=s!==null?s.memoizedProps:null,M=v.children,xi(g,v)?M=null:N!==null&&xi(g,N)&&(i.flags|=32),kk(s,i),Cn(s,i,M,d),i.child;case 6:return s===null&&Nf(i),null;case 13:return jk(s,i,d);case 4:return Rf(i,i.stateNode.containerInfo),g=i.pendingProps,s===null?i.child=Si(i,null,g,d):Cn(s,i,g,d),i.child;case 11:return g=i.type,v=i.pendingProps,v=i.elementType===g?v:Lr(g,v),wk(s,i,g,v,d);case 7:return Cn(s,i,i.pendingProps,d),i.child;case 8:return Cn(s,i,i.pendingProps.children,d),i.child;case 12:return Cn(s,i,i.pendingProps.children,d),i.child;case 10:e:{if(g=i.type._context,v=i.pendingProps,N=i.memoizedProps,M=v.value,gt(zu,g._currentValue),g._currentValue=M,N!==null)if(er(N.value,M)){if(N.children===v.children&&!vn.current){i=Ds(s,i,d);break e}}else for(N=i.child,N!==null&&(N.return=i);N!==null;){var Q=N.dependencies;if(Q!==null){M=N.child;for(var re=Q.firstContext;re!==null;){if(re.context===g){if(N.tag===1){re=Ps(-1,d&-d),re.tag=2;var fe=N.updateQueue;if(fe!==null){fe=fe.shared;var be=fe.pending;be===null?re.next=re:(re.next=be.next,be.next=re),fe.pending=re}}N.lanes|=d,re=N.alternate,re!==null&&(re.lanes|=d),Cf(N.return,d,i),Q.lanes|=d;break}re=re.next}}else if(N.tag===10)M=N.type===i.type?null:N.child;else if(N.tag===18){if(M=N.return,M===null)throw Error(n(341));M.lanes|=d,Q=M.alternate,Q!==null&&(Q.lanes|=d),Cf(M,d,i),M=N.sibling}else M=N.child;if(M!==null)M.return=N;else for(M=N;M!==null;){if(M===i){M=null;break}if(N=M.sibling,N!==null){N.return=M.return,M=N;break}M=M.return}N=M}Cn(s,i,v.children,d),i=i.child}return i;case 9:return v=i.type,g=i.pendingProps.children,Ei(i,d),v=fr(v),g=g(v),i.flags|=1,Cn(s,i,g,d),i.child;case 14:return g=i.type,v=Lr(g,i.pendingProps),v=Lr(g.type,v),vk(s,i,g,v,d);case 15:return xk(s,i,i.type,i.pendingProps,d);case 17:return g=i.type,v=i.pendingProps,v=i.elementType===g?v:Lr(g,v),ed(s,i),i.tag=1,xn(g)?(s=!0,bi(i)):s=!1,Ei(i,d),dk(i,g,v),Uf(i,g,v,d),Kf(null,i,g,!0,s,d);case 19:return Ck(s,i,d);case 22:return bk(s,i,d)}throw Error(n(156,i.tag))};function Qk(s,i){return Ge(s,i)}function b$(s,i,d,g){this.tag=s,this.key=d,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=i,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=g,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function gr(s,i,d,g){return new b$(s,i,d,g)}function pp(s){return s=s.prototype,!(!s||!s.isReactComponent)}function k$(s){if(typeof s=="function")return pp(s)?1:0;if(s!=null){if(s=s.$$typeof,s===K)return 11;if(s===Z)return 14}return 2}function Sa(s,i){var d=s.alternate;return d===null?(d=gr(s.tag,i,s.key,s.mode),d.elementType=s.elementType,d.type=s.type,d.stateNode=s.stateNode,d.alternate=s,s.alternate=d):(d.pendingProps=i,d.type=s.type,d.flags=0,d.subtreeFlags=0,d.deletions=null),d.flags=s.flags&14680064,d.childLanes=s.childLanes,d.lanes=s.lanes,d.child=s.child,d.memoizedProps=s.memoizedProps,d.memoizedState=s.memoizedState,d.updateQueue=s.updateQueue,i=s.dependencies,d.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext},d.sibling=s.sibling,d.index=s.index,d.ref=s.ref,d}function dd(s,i,d,g,v,N){var M=2;if(g=s,typeof s=="function")pp(s)&&(M=1);else if(typeof s=="string")M=5;else e:switch(s){case A:return Co(d.children,v,N,i);case q:M=8,v|=8;break;case F:return s=gr(12,d,i,v|2),s.elementType=F,s.lanes=N,s;case X:return s=gr(13,d,i,v),s.elementType=X,s.lanes=N,s;case I:return s=gr(19,d,i,v),s.elementType=I,s.lanes=N,s;case $:return hd(d,v,N,i);default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case O:M=10;break e;case H:M=9;break e;case K:M=11;break e;case Z:M=14;break e;case W:M=16,g=null;break e}throw Error(n(130,s==null?s:typeof s,""))}return i=gr(M,d,i,v),i.elementType=s,i.type=g,i.lanes=N,i}function Co(s,i,d,g){return s=gr(7,s,g,i),s.lanes=d,s}function hd(s,i,d,g){return s=gr(22,s,g,i),s.elementType=$,s.lanes=d,s.stateNode={isHidden:!1},s}function mp(s,i,d){return s=gr(6,s,null,i),s.lanes=d,s}function gp(s,i,d){return i=gr(4,s.children!==null?s.children:[],s.key,i),i.lanes=d,i.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},i}function N$(s,i,d,g,v){this.tag=i,this.containerInfo=s,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Jo(0),this.expirationTimes=Jo(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Jo(0),this.identifierPrefix=g,this.onRecoverableError=v,this.mutableSourceEagerHydrationData=null}function yp(s,i,d,g,v,N,M,Q,re){return s=new N$(s,i,d,Q,re),i===1?(i=1,N===!0&&(i|=8)):i=0,N=gr(3,null,null,i),s.current=N,N.stateNode=s,N.memoizedState={element:g,isDehydrated:d,cache:null,transitions:null,pendingSuspenseBoundaries:null},Af(N),s}function _$(s,i,d){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:R,key:g==null?null:""+g,children:s,containerInfo:i,implementation:d}}function Jk(s){if(!s)return Dn;s=s._reactInternals;e:{if(In(s)!==s||s.tag!==1)throw Error(n(170));var i=s;do{switch(i.tag){case 3:i=i.stateNode.context;break e;case 1:if(xn(i.type)){i=i.stateNode.__reactInternalMemoizedMergedChildContext;break e}}i=i.return}while(i!==null);throw Error(n(171))}if(s.tag===1){var d=s.type;if(xn(d))return ga(s,d,i)}return i}function e1(s,i,d,g,v,N,M,Q,re){return s=yp(d,g,!0,s,v,N,M,Q,re),s.context=Jk(null),d=s.current,g=Tn(),v=Na(d),N=Ps(g,v),N.callback=i??null,va(d,N,v),s.current.lanes=v,Er(s,v,g),Bn(s,g),s}function fd(s,i,d,g){var v=i.current,N=Tn(),M=Na(v);return d=Jk(d),i.context===null?i.context=d:i.pendingContext=d,i=Ps(N,M),i.payload={element:s},g=g===void 0?null:g,g!==null&&(i.callback=g),s=va(v,i,M),s!==null&&(Fr(s,v,M,N),Uu(s,v,M)),M}function pd(s){if(s=s.current,!s.child)return null;switch(s.child.tag){case 5:return s.child.stateNode;default:return s.child.stateNode}}function t1(s,i){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var d=s.retryLane;s.retryLane=d!==0&&d<i?d:i}}function wp(s,i){t1(s,i),(s=s.alternate)&&t1(s,i)}function S$(){return null}var n1=typeof reportError=="function"?reportError:function(s){console.error(s)};function vp(s){this._internalRoot=s}md.prototype.render=vp.prototype.render=function(s){var i=this._internalRoot;if(i===null)throw Error(n(409));fd(s,i,null,null)},md.prototype.unmount=vp.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var i=s.containerInfo;So(function(){fd(null,s,null,null)}),i[D]=null}};function md(s){this._internalRoot=s}md.prototype.unstable_scheduleHydration=function(s){if(s){var i=mu();s={blockedOn:null,target:s,priority:i};for(var d=0;d<Tr.length&&i!==0&&i<Tr[d].priority;d++);Tr.splice(d,0,s),d===0&&ea(s)}};function xp(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11)}function gd(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11&&(s.nodeType!==8||s.nodeValue!==" react-mount-point-unstable "))}function r1(){}function j$(s,i,d,g,v){if(v){if(typeof g=="function"){var N=g;g=function(){var fe=pd(M);N.call(fe)}}var M=e1(i,g,s,0,null,!1,!1,"",r1);return s._reactRootContainer=M,s[D]=M.current,po(s.nodeType===8?s.parentNode:s),So(),M}for(;v=s.lastChild;)s.removeChild(v);if(typeof g=="function"){var Q=g;g=function(){var fe=pd(re);Q.call(fe)}}var re=yp(s,0,!1,null,null,!1,!1,"",r1);return s._reactRootContainer=re,s[D]=re.current,po(s.nodeType===8?s.parentNode:s),So(function(){fd(i,re,d,g)}),re}function yd(s,i,d,g,v){var N=d._reactRootContainer;if(N){var M=N;if(typeof v=="function"){var Q=v;v=function(){var re=pd(M);Q.call(re)}}fd(i,M,s,v)}else M=j$(d,i,s,v,g);return pd(M)}pu=function(s){switch(s.tag){case 3:var i=s.stateNode;if(i.current.memoizedState.isDehydrated){var d=Zs(i.pendingLanes);d!==0&&(ei(i,d|1),Bn(i,bt()),(wt&6)===0&&(Mi=bt()+500,ya()))}break;case 13:So(function(){var g=Ls(s,1);if(g!==null){var v=Tn();Fr(g,s,1,v)}}),wp(s,1)}},Ga=function(s){if(s.tag===13){var i=Ls(s,134217728);if(i!==null){var d=Tn();Fr(i,s,134217728,d)}wp(s,134217728)}},Ut=function(s){if(s.tag===13){var i=Na(s),d=Ls(s,i);if(d!==null){var g=Tn();Fr(d,s,i,g)}wp(s,i)}},mu=function(){return lt},Cr=function(s,i){var d=lt;try{return lt=s,i()}finally{lt=d}},Kt=function(s,i,d){switch(i){case"input":if(_e(s,d),i=d.name,d.type==="radio"&&i!=null){for(d=s;d.parentNode;)d=d.parentNode;for(d=d.querySelectorAll("input[name="+JSON.stringify(""+i)+'][type="radio"]'),i=0;i<d.length;i++){var g=d[i];if(g!==s&&g.form===s.form){var v=Ze(g);if(!v)throw Error(n(90));Oe(g),_e(g,v)}}}break;case"textarea":Ce(s,d);break;case"select":i=d.value,i!=null&&$e(s,!!d.multiple,i,!1)}},on=dp,Gn=So;var E$={usingClientEntryPoint:!1,Events:[Ne,Me,Ze,tt,_t,dp]},pc={findFiberByHostInstance:we,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},C$={bundleType:pc.bundleType,version:pc.version,rendererPackageName:pc.rendererPackageName,rendererConfig:pc.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:C.ReactCurrentDispatcher,findHostInstanceByFiber:function(s){return s=Fe(s),s===null?null:s.stateNode},findFiberByHostInstance:pc.findFiberByHostInstance||S$,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 wd=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!wd.isDisabled&&wd.supportsFiber)try{vs=wd.inject(C$),$n=wd}catch{}}return zn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=E$,zn.createPortal=function(s,i){var d=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!xp(i))throw Error(n(200));return _$(s,i,null,d)},zn.createRoot=function(s,i){if(!xp(s))throw Error(n(299));var d=!1,g="",v=n1;return i!=null&&(i.unstable_strictMode===!0&&(d=!0),i.identifierPrefix!==void 0&&(g=i.identifierPrefix),i.onRecoverableError!==void 0&&(v=i.onRecoverableError)),i=yp(s,1,!1,null,null,d,!1,g,v),s[D]=i.current,po(s.nodeType===8?s.parentNode:s),new vp(i)},zn.findDOMNode=function(s){if(s==null)return null;if(s.nodeType===1)return s;var i=s._reactInternals;if(i===void 0)throw typeof s.render=="function"?Error(n(188)):(s=Object.keys(s).join(","),Error(n(268,s)));return s=Fe(i),s=s===null?null:s.stateNode,s},zn.flushSync=function(s){return So(s)},zn.hydrate=function(s,i,d){if(!gd(i))throw Error(n(200));return yd(null,s,i,!0,d)},zn.hydrateRoot=function(s,i,d){if(!xp(s))throw Error(n(405));var g=d!=null&&d.hydratedSources||null,v=!1,N="",M=n1;if(d!=null&&(d.unstable_strictMode===!0&&(v=!0),d.identifierPrefix!==void 0&&(N=d.identifierPrefix),d.onRecoverableError!==void 0&&(M=d.onRecoverableError)),i=e1(i,null,s,1,d??null,v,!1,N,M),s[D]=i.current,po(s),g)for(s=0;s<g.length;s++)d=g[s],v=d._getVersion,v=v(d._source),i.mutableSourceEagerHydrationData==null?i.mutableSourceEagerHydrationData=[d,v]:i.mutableSourceEagerHydrationData.push(d,v);return new md(i)},zn.render=function(s,i,d){if(!gd(i))throw Error(n(200));return yd(null,s,i,!1,d)},zn.unmountComponentAtNode=function(s){if(!gd(s))throw Error(n(40));return s._reactRootContainer?(So(function(){yd(null,null,s,!1,function(){s._reactRootContainer=null,s[D]=null})}),!0):!1},zn.unstable_batchedUpdates=dp,zn.unstable_renderSubtreeIntoContainer=function(s,i,d,g){if(!gd(d))throw Error(n(200));if(s==null||s._reactInternals===void 0)throw Error(n(38));return yd(s,i,d,!1,g)},zn.version="18.3.1-next-f1338f8080-20240426",zn}var d1;function $2(){if(d1)return Np.exports;d1=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(),Np.exports=O$(),Np.exports}var h1;function L$(){if(h1)return xd;h1=1;var e=$2();return xd.createRoot=e.createRoot,xd.hydrateRoot=e.hydrateRoot,xd}var P$=L$();const D$="modulepreload",F$=function(e){return"/"+e},f1={},O2=function(t,n,r){let a=Promise.resolve();if(n&&n.length>0){let c=function(p){return Promise.all(p.map(h=>Promise.resolve(h).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};document.getElementsByTagName("link");const u=document.querySelector("meta[property=csp-nonce]"),f=(u==null?void 0:u.nonce)||(u==null?void 0:u.getAttribute("nonce"));a=c(n.map(p=>{if(p=F$(p),p in f1)return;f1[p]=!0;const h=p.endsWith(".css"),m=h?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${m}`))return;const y=document.createElement("link");if(y.rel=h?"stylesheet":D$,h||(y.as="script"),y.crossOrigin="",y.href=p,f&&y.setAttribute("nonce",f),document.head.appendChild(y),h)return new Promise((w,_)=>{y.addEventListener("load",w),y.addEventListener("error",()=>_(new Error(`Unable to preload CSS for ${p}`)))})}))}function l(c){const u=new Event("vite:preloadError",{cancelable:!0});if(u.payload=c,window.dispatchEvent(u),!u.defaultPrevented)throw c}return a.then(c=>{for(const u of c||[])u.status==="rejected"&&l(u.reason);return t().catch(l)})};var x=eu();const pe=w0(x);function mn(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n<e.length;n++)(r=mn(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var jp={exports:{}},Ep={},Cp={exports:{}},Tp={};/**
|
|
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 p1;function q$(){if(p1)return Tp;p1=1;var e=eu();function t(m,y){return m===y&&(m!==0||1/m===1/y)||m!==m&&y!==y}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,a=e.useEffect,l=e.useLayoutEffect,c=e.useDebugValue;function u(m,y){var w=y(),_=r({inst:{value:w,getSnapshot:y}}),k=_[0].inst,j=_[1];return l(function(){k.value=w,k.getSnapshot=y,f(k)&&j({inst:k})},[m,w,y]),a(function(){return f(k)&&j({inst:k}),m(function(){f(k)&&j({inst:k})})},[m]),c(w),w}function f(m){var y=m.getSnapshot;m=m.value;try{var w=y();return!n(m,w)}catch{return!0}}function p(m,y){return y()}var h=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?p:u;return Tp.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:h,Tp}var m1;function B$(){return m1||(m1=1,Cp.exports=q$()),Cp.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 g1;function z$(){if(g1)return Ep;g1=1;var e=eu(),t=B$();function n(p,h){return p===h&&(p!==0||1/p===1/h)||p!==p&&h!==h}var r=typeof Object.is=="function"?Object.is:n,a=t.useSyncExternalStore,l=e.useRef,c=e.useEffect,u=e.useMemo,f=e.useDebugValue;return Ep.useSyncExternalStoreWithSelector=function(p,h,m,y,w){var _=l(null);if(_.current===null){var k={hasValue:!1,value:null};_.current=k}else k=_.current;_=u(function(){function b(R){if(!S){if(S=!0,E=R,R=y(R),w!==void 0&&k.hasValue){var A=k.value;if(w(A,R))return C=A}return C=R}if(A=C,r(E,R))return A;var q=y(R);return w!==void 0&&w(A,q)?(E=R,A):(E=R,C=q)}var S=!1,E,C,T=m===void 0?null:m;return[function(){return b(h())},T===null?void 0:function(){return b(T())}]},[h,m,y,w]);var j=a(p,_[0],_[1]);return c(function(){k.hasValue=!0,k.value=j},[j]),f(j),j},Ep}var y1;function H$(){return y1||(y1=1,jp.exports=z$()),jp.exports}var U$=H$();const W$=w0(U$),V$={},w1=e=>{let t;const n=new Set,r=(h,m)=>{const y=typeof h=="function"?h(t):h;if(!Object.is(y,t)){const w=t;t=m??(typeof y!="object"||y===null)?y:Object.assign({},t,y),n.forEach(_=>_(t,w))}},a=()=>t,f={setState:r,getState:a,getInitialState:()=>p,subscribe:h=>(n.add(h),()=>n.delete(h)),destroy:()=>{(V$?"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(r,a,f);return f},G$=e=>e?w1(e):w1,{useDebugValue:K$}=pe,{useSyncExternalStoreWithSelector:Y$}=W$,X$=e=>e;function L2(e,t=X$,n){const r=Y$(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return K$(r),r}const v1=(e,t)=>{const n=G$(e),r=(a,l=t)=>L2(n,a,l);return Object.assign(r,n),r},Z$=(e,t)=>e?v1(e,t):v1;function rn(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[r,a]of e)if(!Object.is(a,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}var Q$={value:()=>{}};function jh(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new Kd(n)}function Kd(e){this._=e}function J$(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",a=n.indexOf(".");if(a>=0&&(r=n.slice(a+1),n=n.slice(0,a)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Kd.prototype=jh.prototype={constructor:Kd,on:function(e,t){var n=this._,r=J$(e+"",n),a,l=-1,c=r.length;if(arguments.length<2){for(;++l<c;)if((a=(e=r[l]).type)&&(a=eO(n[a],e.name)))return a;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++l<c;)if(a=(e=r[l]).type)n[a]=x1(n[a],e.name,t);else if(t==null)for(a in n)n[a]=x1(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 Kd(e)},call:function(e,t){if((a=arguments.length-2)>0)for(var n=new Array(a),r=0,a,l;r<a;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(l=this._[e],r=0,a=l.length;r<a;++r)l[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],a=0,l=r.length;a<l;++a)r[a].value.apply(t,n)}};function eO(e,t){for(var n=0,r=e.length,a;n<r;++n)if((a=e[n]).name===t)return a.value}function x1(e,t,n){for(var r=0,a=e.length;r<a;++r)if(e[r].name===t){e[r]=Q$,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var Rx="http://www.w3.org/1999/xhtml";const b1={svg:"http://www.w3.org/2000/svg",xhtml:Rx,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Eh(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),b1.hasOwnProperty(t)?{space:b1[t],local:e}:e}function tO(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Rx&&t.documentElement.namespaceURI===Rx?t.createElement(e):t.createElementNS(n,e)}}function nO(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function P2(e){var t=Eh(e);return(t.local?nO:tO)(t)}function rO(){}function v0(e){return e==null?rO:function(){return this.querySelector(e)}}function sO(e){typeof e!="function"&&(e=v0(e));for(var t=this._groups,n=t.length,r=new Array(n),a=0;a<n;++a)for(var l=t[a],c=l.length,u=r[a]=new Array(c),f,p,h=0;h<c;++h)(f=l[h])&&(p=e.call(f,f.__data__,h,l))&&("__data__"in f&&(p.__data__=f.__data__),u[h]=p);return new ir(r,this._parents)}function aO(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function oO(){return[]}function D2(e){return e==null?oO:function(){return this.querySelectorAll(e)}}function iO(e){return function(){return aO(e.apply(this,arguments))}}function lO(e){typeof e=="function"?e=iO(e):e=D2(e);for(var t=this._groups,n=t.length,r=[],a=[],l=0;l<n;++l)for(var c=t[l],u=c.length,f,p=0;p<u;++p)(f=c[p])&&(r.push(e.call(f,f.__data__,p,c)),a.push(f));return new ir(r,a)}function F2(e){return function(){return this.matches(e)}}function q2(e){return function(t){return t.matches(e)}}var cO=Array.prototype.find;function uO(e){return function(){return cO.call(this.children,e)}}function dO(){return this.firstElementChild}function hO(e){return this.select(e==null?dO:uO(typeof e=="function"?e:q2(e)))}var fO=Array.prototype.filter;function pO(){return Array.from(this.children)}function mO(e){return function(){return fO.call(this.children,e)}}function gO(e){return this.selectAll(e==null?pO:mO(typeof e=="function"?e:q2(e)))}function yO(e){typeof e!="function"&&(e=F2(e));for(var t=this._groups,n=t.length,r=new Array(n),a=0;a<n;++a)for(var l=t[a],c=l.length,u=r[a]=[],f,p=0;p<c;++p)(f=l[p])&&e.call(f,f.__data__,p,l)&&u.push(f);return new ir(r,this._parents)}function B2(e){return new Array(e.length)}function wO(){return new ir(this._enter||this._groups.map(B2),this._parents)}function nh(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}nh.prototype={constructor:nh,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 vO(e){return function(){return e}}function xO(e,t,n,r,a,l){for(var c=0,u,f=t.length,p=l.length;c<p;++c)(u=t[c])?(u.__data__=l[c],r[c]=u):n[c]=new nh(e,l[c]);for(;c<f;++c)(u=t[c])&&(a[c]=u)}function bO(e,t,n,r,a,l,c){var u,f,p=new Map,h=t.length,m=l.length,y=new Array(h),w;for(u=0;u<h;++u)(f=t[u])&&(y[u]=w=c.call(f,f.__data__,u,t)+"",p.has(w)?a[u]=f:p.set(w,f));for(u=0;u<m;++u)w=c.call(e,l[u],u,l)+"",(f=p.get(w))?(r[u]=f,f.__data__=l[u],p.delete(w)):n[u]=new nh(e,l[u]);for(u=0;u<h;++u)(f=t[u])&&p.get(y[u])===f&&(a[u]=f)}function kO(e){return e.__data__}function NO(e,t){if(!arguments.length)return Array.from(this,kO);var n=t?bO:xO,r=this._parents,a=this._groups;typeof e!="function"&&(e=vO(e));for(var l=a.length,c=new Array(l),u=new Array(l),f=new Array(l),p=0;p<l;++p){var h=r[p],m=a[p],y=m.length,w=_O(e.call(h,h&&h.__data__,p,r)),_=w.length,k=u[p]=new Array(_),j=c[p]=new Array(_),b=f[p]=new Array(y);n(h,m,k,j,b,w,t);for(var S=0,E=0,C,T;S<_;++S)if(C=k[S]){for(S>=E&&(E=S+1);!(T=j[E])&&++E<_;);C._next=T||null}}return c=new ir(c,r),c._enter=u,c._exit=f,c}function _O(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function SO(){return new ir(this._exit||this._groups.map(B2),this._parents)}function jO(e,t,n){var r=this.enter(),a=this,l=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(a=t(a),a&&(a=a.selection())),n==null?l.remove():n(l),r&&a?r.merge(a).order():a}function EO(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,a=n.length,l=r.length,c=Math.min(a,l),u=new Array(a),f=0;f<c;++f)for(var p=n[f],h=r[f],m=p.length,y=u[f]=new Array(m),w,_=0;_<m;++_)(w=p[_]||h[_])&&(y[_]=w);for(;f<a;++f)u[f]=n[f];return new ir(u,this._parents)}function CO(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],a=r.length-1,l=r[a],c;--a>=0;)(c=r[a])&&(l&&c.compareDocumentPosition(l)^4&&l.parentNode.insertBefore(c,l),l=c);return this}function TO(e){e||(e=AO);function t(m,y){return m&&y?e(m.__data__,y.__data__):!m-!y}for(var n=this._groups,r=n.length,a=new Array(r),l=0;l<r;++l){for(var c=n[l],u=c.length,f=a[l]=new Array(u),p,h=0;h<u;++h)(p=c[h])&&(f[h]=p);f.sort(t)}return new ir(a,this._parents).order()}function AO(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function RO(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function MO(){return Array.from(this)}function IO(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],a=0,l=r.length;a<l;++a){var c=r[a];if(c)return c}return null}function $O(){let e=0;for(const t of this)++e;return e}function OO(){return!this.node()}function LO(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var a=t[n],l=0,c=a.length,u;l<c;++l)(u=a[l])&&e.call(u,u.__data__,l,a);return this}function PO(e){return function(){this.removeAttribute(e)}}function DO(e){return function(){this.removeAttributeNS(e.space,e.local)}}function FO(e,t){return function(){this.setAttribute(e,t)}}function qO(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function BO(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function zO(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 HO(e,t){var n=Eh(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?DO:PO:typeof t=="function"?n.local?zO:BO:n.local?qO:FO)(n,t))}function z2(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function UO(e){return function(){this.style.removeProperty(e)}}function WO(e,t,n){return function(){this.style.setProperty(e,t,n)}}function VO(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function GO(e,t,n){return arguments.length>1?this.each((t==null?UO:typeof t=="function"?VO:WO)(e,t,n??"")):nl(this.node(),e)}function nl(e,t){return e.style.getPropertyValue(t)||z2(e).getComputedStyle(e,null).getPropertyValue(t)}function KO(e){return function(){delete this[e]}}function YO(e,t){return function(){this[e]=t}}function XO(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function ZO(e,t){return arguments.length>1?this.each((t==null?KO:typeof t=="function"?XO:YO)(e,t)):this.node()[e]}function H2(e){return e.trim().split(/^|\s+/)}function x0(e){return e.classList||new U2(e)}function U2(e){this._node=e,this._names=H2(e.getAttribute("class")||"")}U2.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 W2(e,t){for(var n=x0(e),r=-1,a=t.length;++r<a;)n.add(t[r])}function V2(e,t){for(var n=x0(e),r=-1,a=t.length;++r<a;)n.remove(t[r])}function QO(e){return function(){W2(this,e)}}function JO(e){return function(){V2(this,e)}}function e3(e,t){return function(){(t.apply(this,arguments)?W2:V2)(this,e)}}function t3(e,t){var n=H2(e+"");if(arguments.length<2){for(var r=x0(this.node()),a=-1,l=n.length;++a<l;)if(!r.contains(n[a]))return!1;return!0}return this.each((typeof t=="function"?e3:t?QO:JO)(n,t))}function n3(){this.textContent=""}function r3(e){return function(){this.textContent=e}}function s3(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function a3(e){return arguments.length?this.each(e==null?n3:(typeof e=="function"?s3:r3)(e)):this.node().textContent}function o3(){this.innerHTML=""}function i3(e){return function(){this.innerHTML=e}}function l3(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function c3(e){return arguments.length?this.each(e==null?o3:(typeof e=="function"?l3:i3)(e)):this.node().innerHTML}function u3(){this.nextSibling&&this.parentNode.appendChild(this)}function d3(){return this.each(u3)}function h3(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function f3(){return this.each(h3)}function p3(e){var t=typeof e=="function"?e:P2(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function m3(){return null}function g3(e,t){var n=typeof e=="function"?e:P2(e),r=t==null?m3:typeof t=="function"?t:v0(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function y3(){var e=this.parentNode;e&&e.removeChild(this)}function w3(){return this.each(y3)}function v3(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function x3(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function b3(e){return this.select(e?x3:v3)}function k3(e){return arguments.length?this.property("__data__",e):this.node().__data__}function N3(e){return function(t){e.call(this,t,this.__data__)}}function _3(e){return e.trim().split(/^|\s+/).map(function(t){var n="",r=t.indexOf(".");return r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function S3(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,a=t.length,l;n<a;++n)l=t[n],(!e.type||l.type===e.type)&&l.name===e.name?this.removeEventListener(l.type,l.listener,l.options):t[++r]=l;++r?t.length=r:delete this.__on}}}function j3(e,t,n){return function(){var r=this.__on,a,l=N3(t);if(r){for(var c=0,u=r.length;c<u;++c)if((a=r[c]).type===e.type&&a.name===e.name){this.removeEventListener(a.type,a.listener,a.options),this.addEventListener(a.type,a.listener=l,a.options=n),a.value=t;return}}this.addEventListener(e.type,l,n),a={type:e.type,name:e.name,value:t,listener:l,options:n},r?r.push(a):this.__on=[a]}}function E3(e,t,n){var r=_3(e+""),a,l=r.length,c;if(arguments.length<2){var u=this.node().__on;if(u){for(var f=0,p=u.length,h;f<p;++f)for(a=0,h=u[f];a<l;++a)if((c=r[a]).type===h.type&&c.name===h.name)return h.value}return}for(u=t?j3:S3,a=0;a<l;++a)this.each(u(r[a],t,n));return this}function G2(e,t,n){var r=z2(e),a=r.CustomEvent;typeof a=="function"?a=new a(t,n):(a=r.document.createEvent("Event"),n?(a.initEvent(t,n.bubbles,n.cancelable),a.detail=n.detail):a.initEvent(t,!1,!1)),e.dispatchEvent(a)}function C3(e,t){return function(){return G2(this,e,t)}}function T3(e,t){return function(){return G2(this,e,t.apply(this,arguments))}}function A3(e,t){return this.each((typeof t=="function"?T3:C3)(e,t))}function*R3(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],a=0,l=r.length,c;a<l;++a)(c=r[a])&&(yield c)}var K2=[null];function ir(e,t){this._groups=e,this._parents=t}function tu(){return new ir([[document.documentElement]],K2)}function M3(){return this}ir.prototype=tu.prototype={constructor:ir,select:sO,selectAll:lO,selectChild:hO,selectChildren:gO,filter:yO,data:NO,enter:wO,exit:SO,join:jO,merge:EO,selection:M3,order:CO,sort:TO,call:RO,nodes:MO,node:IO,size:$O,empty:OO,each:LO,attr:HO,style:GO,property:ZO,classed:t3,text:a3,html:c3,raise:d3,lower:f3,append:p3,insert:g3,remove:w3,clone:b3,datum:k3,on:E3,dispatch:A3,[Symbol.iterator]:R3};function vr(e){return typeof e=="string"?new ir([[document.querySelector(e)]],[document.documentElement]):new ir([[e]],K2)}function I3(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Br(e,t){if(e=I3(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.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 $3={passive:!1},Pc={capture:!0,passive:!1};function Ap(e){e.stopImmediatePropagation()}function Zi(e){e.preventDefault(),e.stopImmediatePropagation()}function Y2(e){var t=e.document.documentElement,n=vr(e).on("dragstart.drag",Zi,Pc);"onselectstart"in t?n.on("selectstart.drag",Zi,Pc):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function X2(e,t){var n=e.document.documentElement,r=vr(e).on("dragstart.drag",null);t&&(r.on("click.drag",Zi,Pc),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const bd=e=>()=>e;function Mx(e,{sourceEvent:t,subject:n,target:r,identifier:a,active:l,x:c,y:u,dx:f,dy:p,dispatch:h}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:a,enumerable:!0,configurable:!0},active:{value:l,enumerable:!0,configurable:!0},x:{value:c,enumerable:!0,configurable:!0},y:{value:u,enumerable:!0,configurable:!0},dx:{value:f,enumerable:!0,configurable:!0},dy:{value:p,enumerable:!0,configurable:!0},_:{value:h}})}Mx.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function O3(e){return!e.ctrlKey&&!e.button}function L3(){return this.parentNode}function P3(e,t){return t??{x:e.x,y:e.y}}function D3(){return navigator.maxTouchPoints||"ontouchstart"in this}function F3(){var e=O3,t=L3,n=P3,r=D3,a={},l=jh("start","drag","end"),c=0,u,f,p,h,m=0;function y(C){C.on("mousedown.drag",w).filter(r).on("touchstart.drag",j).on("touchmove.drag",b,$3).on("touchend.drag touchcancel.drag",S).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function w(C,T){if(!(h||!e.call(this,C,T))){var R=E(this,t.call(this,C,T),C,T,"mouse");R&&(vr(C.view).on("mousemove.drag",_,Pc).on("mouseup.drag",k,Pc),Y2(C.view),Ap(C),p=!1,u=C.clientX,f=C.clientY,R("start",C))}}function _(C){if(Zi(C),!p){var T=C.clientX-u,R=C.clientY-f;p=T*T+R*R>m}a.mouse("drag",C)}function k(C){vr(C.view).on("mousemove.drag mouseup.drag",null),X2(C.view,p),Zi(C),a.mouse("end",C)}function j(C,T){if(e.call(this,C,T)){var R=C.changedTouches,A=t.call(this,C,T),q=R.length,F,O;for(F=0;F<q;++F)(O=E(this,A,C,T,R[F].identifier,R[F]))&&(Ap(C),O("start",C,R[F]))}}function b(C){var T=C.changedTouches,R=T.length,A,q;for(A=0;A<R;++A)(q=a[T[A].identifier])&&(Zi(C),q("drag",C,T[A]))}function S(C){var T=C.changedTouches,R=T.length,A,q;for(h&&clearTimeout(h),h=setTimeout(function(){h=null},500),A=0;A<R;++A)(q=a[T[A].identifier])&&(Ap(C),q("end",C,T[A]))}function E(C,T,R,A,q,F){var O=l.copy(),H=Br(F||R,T),K,X,I;if((I=n.call(C,new Mx("beforestart",{sourceEvent:R,target:y,identifier:q,active:c,x:H[0],y:H[1],dx:0,dy:0,dispatch:O}),A))!=null)return K=I.x-H[0]||0,X=I.y-H[1]||0,function Z(W,$,z){var U=H,V;switch(W){case"start":a[q]=Z,V=c++;break;case"end":delete a[q],--c;case"drag":H=Br(z||$,T),V=c;break}O.call(W,C,new Mx(W,{sourceEvent:$,subject:I,target:y,identifier:q,active:V,x:H[0]+K,y:H[1]+X,dx:H[0]-U[0],dy:H[1]-U[1],dispatch:O}),A)}}return y.filter=function(C){return arguments.length?(e=typeof C=="function"?C:bd(!!C),y):e},y.container=function(C){return arguments.length?(t=typeof C=="function"?C:bd(C),y):t},y.subject=function(C){return arguments.length?(n=typeof C=="function"?C:bd(C),y):n},y.touchable=function(C){return arguments.length?(r=typeof C=="function"?C:bd(!!C),y):r},y.on=function(){var C=l.on.apply(l,arguments);return C===l?y:C},y.clickDistance=function(C){return arguments.length?(m=(C=+C)*C,y):Math.sqrt(m)},y}function b0(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Z2(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function nu(){}var Dc=.7,rh=1/Dc,Qi="\\s*([+-]?\\d+)\\s*",Fc="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",ds="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",q3=/^#([0-9a-f]{3,8})$/,B3=new RegExp(`^rgb\\(${Qi},${Qi},${Qi}\\)$`),z3=new RegExp(`^rgb\\(${ds},${ds},${ds}\\)$`),H3=new RegExp(`^rgba\\(${Qi},${Qi},${Qi},${Fc}\\)$`),U3=new RegExp(`^rgba\\(${ds},${ds},${ds},${Fc}\\)$`),W3=new RegExp(`^hsl\\(${Fc},${ds},${ds}\\)$`),V3=new RegExp(`^hsla\\(${Fc},${ds},${ds},${Fc}\\)$`),k1={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};b0(nu,qc,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:N1,formatHex:N1,formatHex8:G3,formatHsl:K3,formatRgb:_1,toString:_1});function N1(){return this.rgb().formatHex()}function G3(){return this.rgb().formatHex8()}function K3(){return Q2(this).formatHsl()}function _1(){return this.rgb().formatRgb()}function qc(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=q3.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?S1(t):n===3?new Un(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?kd(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?kd(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=B3.exec(e))?new Un(t[1],t[2],t[3],1):(t=z3.exec(e))?new Un(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=H3.exec(e))?kd(t[1],t[2],t[3],t[4]):(t=U3.exec(e))?kd(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=W3.exec(e))?C1(t[1],t[2]/100,t[3]/100,1):(t=V3.exec(e))?C1(t[1],t[2]/100,t[3]/100,t[4]):k1.hasOwnProperty(e)?S1(k1[e]):e==="transparent"?new Un(NaN,NaN,NaN,0):null}function S1(e){return new Un(e>>16&255,e>>8&255,e&255,1)}function kd(e,t,n,r){return r<=0&&(e=t=n=NaN),new Un(e,t,n,r)}function Y3(e){return e instanceof nu||(e=qc(e)),e?(e=e.rgb(),new Un(e.r,e.g,e.b,e.opacity)):new Un}function Ix(e,t,n,r){return arguments.length===1?Y3(e):new Un(e,t,n,r??1)}function Un(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}b0(Un,Ix,Z2(nu,{brighter(e){return e=e==null?rh:Math.pow(rh,e),new Un(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Dc:Math.pow(Dc,e),new Un(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Un(Oo(this.r),Oo(this.g),Oo(this.b),sh(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:j1,formatHex:j1,formatHex8:X3,formatRgb:E1,toString:E1}));function j1(){return`#${Mo(this.r)}${Mo(this.g)}${Mo(this.b)}`}function X3(){return`#${Mo(this.r)}${Mo(this.g)}${Mo(this.b)}${Mo((isNaN(this.opacity)?1:this.opacity)*255)}`}function E1(){const e=sh(this.opacity);return`${e===1?"rgb(":"rgba("}${Oo(this.r)}, ${Oo(this.g)}, ${Oo(this.b)}${e===1?")":`, ${e})`}`}function sh(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Oo(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Mo(e){return e=Oo(e),(e<16?"0":"")+e.toString(16)}function C1(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Hr(e,t,n,r)}function Q2(e){if(e instanceof Hr)return new Hr(e.h,e.s,e.l,e.opacity);if(e instanceof nu||(e=qc(e)),!e)return new Hr;if(e instanceof Hr)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,a=Math.min(t,n,r),l=Math.max(t,n,r),c=NaN,u=l-a,f=(l+a)/2;return u?(t===l?c=(n-r)/u+(n<r)*6:n===l?c=(r-t)/u+2:c=(t-n)/u+4,u/=f<.5?l+a:2-l-a,c*=60):u=f>0&&f<1?0:c,new Hr(c,u,f,e.opacity)}function Z3(e,t,n,r){return arguments.length===1?Q2(e):new Hr(e,t,n,r??1)}function Hr(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}b0(Hr,Z3,Z2(nu,{brighter(e){return e=e==null?rh:Math.pow(rh,e),new Hr(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Dc:Math.pow(Dc,e),new Hr(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,r=n+(n<.5?n:1-n)*t,a=2*n-r;return new Un(Rp(e>=240?e-240:e+120,a,r),Rp(e,a,r),Rp(e<120?e+240:e-120,a,r),this.opacity)},clamp(){return new Hr(T1(this.h),Nd(this.s),Nd(this.l),sh(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=sh(this.opacity);return`${e===1?"hsl(":"hsla("}${T1(this.h)}, ${Nd(this.s)*100}%, ${Nd(this.l)*100}%${e===1?")":`, ${e})`}`}}));function T1(e){return e=(e||0)%360,e<0?e+360:e}function Nd(e){return Math.max(0,Math.min(1,e||0))}function Rp(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 J2=e=>()=>e;function Q3(e,t){return function(n){return e+n*t}}function J3(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function eL(e){return(e=+e)==1?eA:function(t,n){return n-t?J3(t,n,e):J2(isNaN(t)?n:t)}}function eA(e,t){var n=t-e;return n?Q3(e,n):J2(isNaN(e)?t:e)}const A1=(function e(t){var n=eL(t);function r(a,l){var c=n((a=Ix(a)).r,(l=Ix(l)).r),u=n(a.g,l.g),f=n(a.b,l.b),p=eA(a.opacity,l.opacity);return function(h){return a.r=c(h),a.g=u(h),a.b=f(h),a.opacity=p(h),a+""}}return r.gamma=e,r})(1);function Ra(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var $x=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Mp=new RegExp($x.source,"g");function tL(e){return function(){return e}}function nL(e){return function(t){return e(t)+""}}function rL(e,t){var n=$x.lastIndex=Mp.lastIndex=0,r,a,l,c=-1,u=[],f=[];for(e=e+"",t=t+"";(r=$x.exec(e))&&(a=Mp.exec(t));)(l=a.index)>n&&(l=t.slice(n,l),u[c]?u[c]+=l:u[++c]=l),(r=r[0])===(a=a[0])?u[c]?u[c]+=a:u[++c]=a:(u[++c]=null,f.push({i:c,x:Ra(r,a)})),n=Mp.lastIndex;return n<t.length&&(l=t.slice(n),u[c]?u[c]+=l:u[++c]=l),u.length<2?f[0]?nL(f[0].x):tL(t):(t=f.length,function(p){for(var h=0,m;h<t;++h)u[(m=f[h]).i]=m.x(p);return u.join("")})}var R1=180/Math.PI,Ox={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function tA(e,t,n,r,a,l){var c,u,f;return(c=Math.sqrt(e*e+t*t))&&(e/=c,t/=c),(f=e*n+t*r)&&(n-=e*f,r-=t*f),(u=Math.sqrt(n*n+r*r))&&(n/=u,r/=u,f/=u),e*r<t*n&&(e=-e,t=-t,f=-f,c=-c),{translateX:a,translateY:l,rotate:Math.atan2(t,e)*R1,skewX:Math.atan(f)*R1,scaleX:c,scaleY:u}}var _d;function sL(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Ox:tA(t.a,t.b,t.c,t.d,t.e,t.f)}function aL(e){return e==null||(_d||(_d=document.createElementNS("http://www.w3.org/2000/svg","g")),_d.setAttribute("transform",e),!(e=_d.transform.baseVal.consolidate()))?Ox:(e=e.matrix,tA(e.a,e.b,e.c,e.d,e.e,e.f))}function nA(e,t,n,r){function a(p){return p.length?p.pop()+" ":""}function l(p,h,m,y,w,_){if(p!==m||h!==y){var k=w.push("translate(",null,t,null,n);_.push({i:k-4,x:Ra(p,m)},{i:k-2,x:Ra(h,y)})}else(m||y)&&w.push("translate("+m+t+y+n)}function c(p,h,m,y){p!==h?(p-h>180?h+=360:h-p>180&&(p+=360),y.push({i:m.push(a(m)+"rotate(",null,r)-2,x:Ra(p,h)})):h&&m.push(a(m)+"rotate("+h+r)}function u(p,h,m,y){p!==h?y.push({i:m.push(a(m)+"skewX(",null,r)-2,x:Ra(p,h)}):h&&m.push(a(m)+"skewX("+h+r)}function f(p,h,m,y,w,_){if(p!==m||h!==y){var k=w.push(a(w)+"scale(",null,",",null,")");_.push({i:k-4,x:Ra(p,m)},{i:k-2,x:Ra(h,y)})}else(m!==1||y!==1)&&w.push(a(w)+"scale("+m+","+y+")")}return function(p,h){var m=[],y=[];return p=e(p),h=e(h),l(p.translateX,p.translateY,h.translateX,h.translateY,m,y),c(p.rotate,h.rotate,m,y),u(p.skewX,h.skewX,m,y),f(p.scaleX,p.scaleY,h.scaleX,h.scaleY,m,y),p=h=null,function(w){for(var _=-1,k=y.length,j;++_<k;)m[(j=y[_]).i]=j.x(w);return m.join("")}}}var oL=nA(sL,"px, ","px)","deg)"),iL=nA(aL,", ",")",")"),lL=1e-12;function M1(e){return((e=Math.exp(e))+1/e)/2}function cL(e){return((e=Math.exp(e))-1/e)/2}function uL(e){return((e=Math.exp(2*e))-1)/(e+1)}const dL=(function e(t,n,r){function a(l,c){var u=l[0],f=l[1],p=l[2],h=c[0],m=c[1],y=c[2],w=h-u,_=m-f,k=w*w+_*_,j,b;if(k<lL)b=Math.log(y/p)/t,j=function(A){return[u+A*w,f+A*_,p*Math.exp(t*A*b)]};else{var S=Math.sqrt(k),E=(y*y-p*p+r*k)/(2*p*n*S),C=(y*y-p*p-r*k)/(2*y*n*S),T=Math.log(Math.sqrt(E*E+1)-E),R=Math.log(Math.sqrt(C*C+1)-C);b=(R-T)/t,j=function(A){var q=A*b,F=M1(T),O=p/(n*S)*(F*uL(t*q+T)-cL(T));return[u+O*w,f+O*_,p*F/M1(t*q+T)]}}return j.duration=b*1e3*t/Math.SQRT2,j}return a.rho=function(l){var c=Math.max(.001,+l),u=c*c,f=u*u;return e(c,u,f)},a})(Math.SQRT2,2,4);var rl=0,jc=0,gc=0,rA=1e3,ah,Ec,oh=0,qo=0,Ch=0,Bc=typeof performance=="object"&&performance.now?performance:Date,sA=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function k0(){return qo||(sA(hL),qo=Bc.now()+Ch)}function hL(){qo=0}function ih(){this._call=this._time=this._next=null}ih.prototype=aA.prototype={constructor:ih,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?k0():+n)+(t==null?0:+t),!this._next&&Ec!==this&&(Ec?Ec._next=this:ah=this,Ec=this),this._call=e,this._time=n,Lx()},stop:function(){this._call&&(this._call=null,this._time=1/0,Lx())}};function aA(e,t,n){var r=new ih;return r.restart(e,t,n),r}function fL(){k0(),++rl;for(var e=ah,t;e;)(t=qo-e._time)>=0&&e._call.call(void 0,t),e=e._next;--rl}function I1(){qo=(oh=Bc.now())+Ch,rl=jc=0;try{fL()}finally{rl=0,mL(),qo=0}}function pL(){var e=Bc.now(),t=e-oh;t>rA&&(Ch-=t,oh=e)}function mL(){for(var e,t=ah,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:ah=n);Ec=e,Lx(r)}function Lx(e){if(!rl){jc&&(jc=clearTimeout(jc));var t=e-qo;t>24?(e<1/0&&(jc=setTimeout(I1,e-Bc.now()-Ch)),gc&&(gc=clearInterval(gc))):(gc||(oh=Bc.now(),gc=setInterval(pL,rA)),rl=1,sA(I1))}}function $1(e,t,n){var r=new ih;return t=t==null?0:+t,r.restart(a=>{r.stop(),e(a+t)},t,n),r}var gL=jh("start","end","cancel","interrupt"),yL=[],oA=0,O1=1,Px=2,Yd=3,L1=4,Dx=5,Xd=6;function Th(e,t,n,r,a,l){var c=e.__transition;if(!c)e.__transition={};else if(n in c)return;wL(e,n,{name:t,index:r,group:a,on:gL,tween:yL,time:l.time,delay:l.delay,duration:l.duration,ease:l.ease,timer:null,state:oA})}function N0(e,t){var n=Kr(e,t);if(n.state>oA)throw new Error("too late; already scheduled");return n}function ps(e,t){var n=Kr(e,t);if(n.state>Yd)throw new Error("too late; already running");return n}function Kr(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function wL(e,t,n){var r=e.__transition,a;r[t]=n,n.timer=aA(l,0,n.time);function l(p){n.state=O1,n.timer.restart(c,n.delay,n.time),n.delay<=p&&c(p-n.delay)}function c(p){var h,m,y,w;if(n.state!==O1)return f();for(h in r)if(w=r[h],w.name===n.name){if(w.state===Yd)return $1(c);w.state===L1?(w.state=Xd,w.timer.stop(),w.on.call("interrupt",e,e.__data__,w.index,w.group),delete r[h]):+h<t&&(w.state=Xd,w.timer.stop(),w.on.call("cancel",e,e.__data__,w.index,w.group),delete r[h])}if($1(function(){n.state===Yd&&(n.state=L1,n.timer.restart(u,n.delay,n.time),u(p))}),n.state=Px,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Px){for(n.state=Yd,a=new Array(y=n.tween.length),h=0,m=-1;h<y;++h)(w=n.tween[h].value.call(e,e.__data__,n.index,n.group))&&(a[++m]=w);a.length=m+1}}function u(p){for(var h=p<n.duration?n.ease.call(null,p/n.duration):(n.timer.restart(f),n.state=Dx,1),m=-1,y=a.length;++m<y;)a[m].call(e,h);n.state===Dx&&(n.on.call("end",e,e.__data__,n.index,n.group),f())}function f(){n.state=Xd,n.timer.stop(),delete r[t];for(var p in r)return;delete e.__transition}}function Zd(e,t){var n=e.__transition,r,a,l=!0,c;if(n){t=t==null?null:t+"";for(c in n){if((r=n[c]).name!==t){l=!1;continue}a=r.state>Px&&r.state<Dx,r.state=Xd,r.timer.stop(),r.on.call(a?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[c]}l&&delete e.__transition}}function vL(e){return this.each(function(){Zd(this,e)})}function xL(e,t){var n,r;return function(){var a=ps(this,e),l=a.tween;if(l!==n){r=n=l;for(var c=0,u=r.length;c<u;++c)if(r[c].name===t){r=r.slice(),r.splice(c,1);break}}a.tween=r}}function bL(e,t,n){var r,a;if(typeof n!="function")throw new Error;return function(){var l=ps(this,e),c=l.tween;if(c!==r){a=(r=c).slice();for(var u={name:t,value:n},f=0,p=a.length;f<p;++f)if(a[f].name===t){a[f]=u;break}f===p&&a.push(u)}l.tween=a}}function kL(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=Kr(this.node(),n).tween,a=0,l=r.length,c;a<l;++a)if((c=r[a]).name===e)return c.value;return null}return this.each((t==null?xL:bL)(n,e,t))}function _0(e,t,n){var r=e._id;return e.each(function(){var a=ps(this,r);(a.value||(a.value={}))[t]=n.apply(this,arguments)}),function(a){return Kr(a,r).value[t]}}function iA(e,t){var n;return(typeof t=="number"?Ra:t instanceof qc?A1:(n=qc(t))?(t=n,A1):rL)(e,t)}function NL(e){return function(){this.removeAttribute(e)}}function _L(e){return function(){this.removeAttributeNS(e.space,e.local)}}function SL(e,t,n){var r,a=n+"",l;return function(){var c=this.getAttribute(e);return c===a?null:c===r?l:l=t(r=c,n)}}function jL(e,t,n){var r,a=n+"",l;return function(){var c=this.getAttributeNS(e.space,e.local);return c===a?null:c===r?l:l=t(r=c,n)}}function EL(e,t,n){var r,a,l;return function(){var c,u=n(this),f;return u==null?void this.removeAttribute(e):(c=this.getAttribute(e),f=u+"",c===f?null:c===r&&f===a?l:(a=f,l=t(r=c,u)))}}function CL(e,t,n){var r,a,l;return function(){var c,u=n(this),f;return u==null?void this.removeAttributeNS(e.space,e.local):(c=this.getAttributeNS(e.space,e.local),f=u+"",c===f?null:c===r&&f===a?l:(a=f,l=t(r=c,u)))}}function TL(e,t){var n=Eh(e),r=n==="transform"?iL:iA;return this.attrTween(e,typeof t=="function"?(n.local?CL:EL)(n,r,_0(this,"attr."+e,t)):t==null?(n.local?_L:NL)(n):(n.local?jL:SL)(n,r,t))}function AL(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function RL(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function ML(e,t){var n,r;function a(){var l=t.apply(this,arguments);return l!==r&&(n=(r=l)&&RL(e,l)),n}return a._value=t,a}function IL(e,t){var n,r;function a(){var l=t.apply(this,arguments);return l!==r&&(n=(r=l)&&AL(e,l)),n}return a._value=t,a}function $L(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 r=Eh(e);return this.tween(n,(r.local?ML:IL)(r,t))}function OL(e,t){return function(){N0(this,e).delay=+t.apply(this,arguments)}}function LL(e,t){return t=+t,function(){N0(this,e).delay=t}}function PL(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?OL:LL)(t,e)):Kr(this.node(),t).delay}function DL(e,t){return function(){ps(this,e).duration=+t.apply(this,arguments)}}function FL(e,t){return t=+t,function(){ps(this,e).duration=t}}function qL(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?DL:FL)(t,e)):Kr(this.node(),t).duration}function BL(e,t){if(typeof t!="function")throw new Error;return function(){ps(this,e).ease=t}}function zL(e){var t=this._id;return arguments.length?this.each(BL(t,e)):Kr(this.node(),t).ease}function HL(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;ps(this,e).ease=n}}function UL(e){if(typeof e!="function")throw new Error;return this.each(HL(this._id,e))}function WL(e){typeof e!="function"&&(e=F2(e));for(var t=this._groups,n=t.length,r=new Array(n),a=0;a<n;++a)for(var l=t[a],c=l.length,u=r[a]=[],f,p=0;p<c;++p)(f=l[p])&&e.call(f,f.__data__,p,l)&&u.push(f);return new Ws(r,this._parents,this._name,this._id)}function VL(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,a=n.length,l=Math.min(r,a),c=new Array(r),u=0;u<l;++u)for(var f=t[u],p=n[u],h=f.length,m=c[u]=new Array(h),y,w=0;w<h;++w)(y=f[w]||p[w])&&(m[w]=y);for(;u<r;++u)c[u]=t[u];return new Ws(c,this._parents,this._name,this._id)}function GL(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 KL(e,t,n){var r,a,l=GL(t)?N0:ps;return function(){var c=l(this,e),u=c.on;u!==r&&(a=(r=u).copy()).on(t,n),c.on=a}}function YL(e,t){var n=this._id;return arguments.length<2?Kr(this.node(),n).on.on(e):this.each(KL(n,e,t))}function XL(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function ZL(){return this.on("end.remove",XL(this._id))}function QL(e){var t=this._name,n=this._id;typeof e!="function"&&(e=v0(e));for(var r=this._groups,a=r.length,l=new Array(a),c=0;c<a;++c)for(var u=r[c],f=u.length,p=l[c]=new Array(f),h,m,y=0;y<f;++y)(h=u[y])&&(m=e.call(h,h.__data__,y,u))&&("__data__"in h&&(m.__data__=h.__data__),p[y]=m,Th(p[y],t,n,y,p,Kr(h,n)));return new Ws(l,this._parents,t,n)}function JL(e){var t=this._name,n=this._id;typeof e!="function"&&(e=D2(e));for(var r=this._groups,a=r.length,l=[],c=[],u=0;u<a;++u)for(var f=r[u],p=f.length,h,m=0;m<p;++m)if(h=f[m]){for(var y=e.call(h,h.__data__,m,f),w,_=Kr(h,n),k=0,j=y.length;k<j;++k)(w=y[k])&&Th(w,t,n,k,y,_);l.push(y),c.push(h)}return new Ws(l,c,t,n)}var eP=tu.prototype.constructor;function tP(){return new eP(this._groups,this._parents)}function nP(e,t){var n,r,a;return function(){var l=nl(this,e),c=(this.style.removeProperty(e),nl(this,e));return l===c?null:l===n&&c===r?a:a=t(n=l,r=c)}}function lA(e){return function(){this.style.removeProperty(e)}}function rP(e,t,n){var r,a=n+"",l;return function(){var c=nl(this,e);return c===a?null:c===r?l:l=t(r=c,n)}}function sP(e,t,n){var r,a,l;return function(){var c=nl(this,e),u=n(this),f=u+"";return u==null&&(f=u=(this.style.removeProperty(e),nl(this,e))),c===f?null:c===r&&f===a?l:(a=f,l=t(r=c,u))}}function aP(e,t){var n,r,a,l="style."+t,c="end."+l,u;return function(){var f=ps(this,e),p=f.on,h=f.value[l]==null?u||(u=lA(t)):void 0;(p!==n||a!==h)&&(r=(n=p).copy()).on(c,a=h),f.on=r}}function oP(e,t,n){var r=(e+="")=="transform"?oL:iA;return t==null?this.styleTween(e,nP(e,r)).on("end.style."+e,lA(e)):typeof t=="function"?this.styleTween(e,sP(e,r,_0(this,"style."+e,t))).each(aP(this._id,e)):this.styleTween(e,rP(e,r,t),n).on("end.style."+e,null)}function iP(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function lP(e,t,n){var r,a;function l(){var c=t.apply(this,arguments);return c!==a&&(r=(a=c)&&iP(e,c,n)),r}return l._value=t,l}function cP(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;return this.tween(r,lP(e,t,n??""))}function uP(e){return function(){this.textContent=e}}function dP(e){return function(){var t=e(this);this.textContent=t??""}}function hP(e){return this.tween("text",typeof e=="function"?dP(_0(this,"text",e)):uP(e==null?"":e+""))}function fP(e){return function(t){this.textContent=e.call(this,t)}}function pP(e){var t,n;function r(){var a=e.apply(this,arguments);return a!==n&&(t=(n=a)&&fP(a)),t}return r._value=e,r}function mP(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,pP(e))}function gP(){for(var e=this._name,t=this._id,n=cA(),r=this._groups,a=r.length,l=0;l<a;++l)for(var c=r[l],u=c.length,f,p=0;p<u;++p)if(f=c[p]){var h=Kr(f,t);Th(f,e,n,p,c,{time:h.time+h.delay+h.duration,delay:0,duration:h.duration,ease:h.ease})}return new Ws(r,this._parents,e,n)}function yP(){var e,t,n=this,r=n._id,a=n.size();return new Promise(function(l,c){var u={value:c},f={value:function(){--a===0&&l()}};n.each(function(){var p=ps(this,r),h=p.on;h!==e&&(t=(e=h).copy(),t._.cancel.push(u),t._.interrupt.push(u),t._.end.push(f)),p.on=t}),a===0&&l()})}var wP=0;function Ws(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function cA(){return++wP}var qs=tu.prototype;Ws.prototype={constructor:Ws,select:QL,selectAll:JL,selectChild:qs.selectChild,selectChildren:qs.selectChildren,filter:WL,merge:VL,selection:tP,transition:gP,call:qs.call,nodes:qs.nodes,node:qs.node,size:qs.size,empty:qs.empty,each:qs.each,on:YL,attr:TL,attrTween:$L,style:oP,styleTween:cP,text:hP,textTween:mP,remove:ZL,tween:kL,delay:PL,duration:qL,ease:zL,easeVarying:UL,end:yP,[Symbol.iterator]:qs[Symbol.iterator]};function vP(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var xP={time:null,delay:0,duration:250,ease:vP};function bP(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 kP(e){var t,n;e instanceof Ws?(t=e._id,e=e._name):(t=cA(),(n=xP).time=k0(),e=e==null?null:e+"");for(var r=this._groups,a=r.length,l=0;l<a;++l)for(var c=r[l],u=c.length,f,p=0;p<u;++p)(f=c[p])&&Th(f,e,t,p,c,n||bP(f,t));return new Ws(r,this._parents,e,t)}tu.prototype.interrupt=vL;tu.prototype.transition=kP;const Sd=e=>()=>e;function NP(e,{sourceEvent:t,target:n,transform:r,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:r,enumerable:!0,configurable:!0},_:{value:a}})}function zs(e,t,n){this.k=e,this.x=t,this.y=n}zs.prototype={constructor:zs,scale:function(e){return e===1?this:new zs(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new zs(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 Us=new zs(1,0,0);zs.prototype;function Ip(e){e.stopImmediatePropagation()}function yc(e){e.preventDefault(),e.stopImmediatePropagation()}function _P(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function SP(){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 P1(){return this.__zoom||Us}function jP(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function EP(){return navigator.maxTouchPoints||"ontouchstart"in this}function CP(e,t,n){var r=e.invertX(t[0][0])-n[0][0],a=e.invertX(t[1][0])-n[1][0],l=e.invertY(t[0][1])-n[0][1],c=e.invertY(t[1][1])-n[1][1];return e.translate(a>r?(r+a)/2:Math.min(0,r)||Math.max(0,a),c>l?(l+c)/2:Math.min(0,l)||Math.max(0,c))}function uA(){var e=_P,t=SP,n=CP,r=jP,a=EP,l=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],u=250,f=dL,p=jh("start","zoom","end"),h,m,y,w=500,_=150,k=0,j=10;function b(I){I.property("__zoom",P1).on("wheel.zoom",q,{passive:!1}).on("mousedown.zoom",F).on("dblclick.zoom",O).filter(a).on("touchstart.zoom",H).on("touchmove.zoom",K).on("touchend.zoom touchcancel.zoom",X).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}b.transform=function(I,Z,W,$){var z=I.selection?I.selection():I;z.property("__zoom",P1),I!==z?T(I,Z,W,$):z.interrupt().each(function(){R(this,arguments).event($).start().zoom(null,typeof Z=="function"?Z.apply(this,arguments):Z).end()})},b.scaleBy=function(I,Z,W,$){b.scaleTo(I,function(){var z=this.__zoom.k,U=typeof Z=="function"?Z.apply(this,arguments):Z;return z*U},W,$)},b.scaleTo=function(I,Z,W,$){b.transform(I,function(){var z=t.apply(this,arguments),U=this.__zoom,V=W==null?C(z):typeof W=="function"?W.apply(this,arguments):W,B=U.invert(V),Y=typeof Z=="function"?Z.apply(this,arguments):Z;return n(E(S(U,Y),V,B),z,c)},W,$)},b.translateBy=function(I,Z,W,$){b.transform(I,function(){return n(this.__zoom.translate(typeof Z=="function"?Z.apply(this,arguments):Z,typeof W=="function"?W.apply(this,arguments):W),t.apply(this,arguments),c)},null,$)},b.translateTo=function(I,Z,W,$,z){b.transform(I,function(){var U=t.apply(this,arguments),V=this.__zoom,B=$==null?C(U):typeof $=="function"?$.apply(this,arguments):$;return n(Us.translate(B[0],B[1]).scale(V.k).translate(typeof Z=="function"?-Z.apply(this,arguments):-Z,typeof W=="function"?-W.apply(this,arguments):-W),U,c)},$,z)};function S(I,Z){return Z=Math.max(l[0],Math.min(l[1],Z)),Z===I.k?I:new zs(Z,I.x,I.y)}function E(I,Z,W){var $=Z[0]-W[0]*I.k,z=Z[1]-W[1]*I.k;return $===I.x&&z===I.y?I:new zs(I.k,$,z)}function C(I){return[(+I[0][0]+ +I[1][0])/2,(+I[0][1]+ +I[1][1])/2]}function T(I,Z,W,$){I.on("start.zoom",function(){R(this,arguments).event($).start()}).on("interrupt.zoom end.zoom",function(){R(this,arguments).event($).end()}).tween("zoom",function(){var z=this,U=arguments,V=R(z,U).event($),B=t.apply(z,U),Y=W==null?C(B):typeof W=="function"?W.apply(z,U):W,ue=Math.max(B[1][0]-B[0][0],B[1][1]-B[0][1]),G=z.__zoom,ee=typeof Z=="function"?Z.apply(z,U):Z,L=f(G.invert(Y).concat(ue/G.k),ee.invert(Y).concat(ue/ee.k));return function(te){if(te===1)te=ee;else{var ne=L(te),ie=ue/ne[2];te=new zs(ie,Y[0]-ne[0]*ie,Y[1]-ne[1]*ie)}V.zoom(null,te)}})}function R(I,Z,W){return!W&&I.__zooming||new A(I,Z)}function A(I,Z){this.that=I,this.args=Z,this.active=0,this.sourceEvent=null,this.extent=t.apply(I,Z),this.taps=0}A.prototype={event:function(I){return I&&(this.sourceEvent=I),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(I,Z){return this.mouse&&I!=="mouse"&&(this.mouse[1]=Z.invert(this.mouse[0])),this.touch0&&I!=="touch"&&(this.touch0[1]=Z.invert(this.touch0[0])),this.touch1&&I!=="touch"&&(this.touch1[1]=Z.invert(this.touch1[0])),this.that.__zoom=Z,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(I){var Z=vr(this.that).datum();p.call(I,this.that,new NP(I,{sourceEvent:this.sourceEvent,target:b,transform:this.that.__zoom,dispatch:p}),Z)}};function q(I,...Z){if(!e.apply(this,arguments))return;var W=R(this,Z).event(I),$=this.__zoom,z=Math.max(l[0],Math.min(l[1],$.k*Math.pow(2,r.apply(this,arguments)))),U=Br(I);if(W.wheel)(W.mouse[0][0]!==U[0]||W.mouse[0][1]!==U[1])&&(W.mouse[1]=$.invert(W.mouse[0]=U)),clearTimeout(W.wheel);else{if($.k===z)return;W.mouse=[U,$.invert(U)],Zd(this),W.start()}yc(I),W.wheel=setTimeout(V,_),W.zoom("mouse",n(E(S($,z),W.mouse[0],W.mouse[1]),W.extent,c));function V(){W.wheel=null,W.end()}}function F(I,...Z){if(y||!e.apply(this,arguments))return;var W=I.currentTarget,$=R(this,Z,!0).event(I),z=vr(I.view).on("mousemove.zoom",Y,!0).on("mouseup.zoom",ue,!0),U=Br(I,W),V=I.clientX,B=I.clientY;Y2(I.view),Ip(I),$.mouse=[U,this.__zoom.invert(U)],Zd(this),$.start();function Y(G){if(yc(G),!$.moved){var ee=G.clientX-V,L=G.clientY-B;$.moved=ee*ee+L*L>k}$.event(G).zoom("mouse",n(E($.that.__zoom,$.mouse[0]=Br(G,W),$.mouse[1]),$.extent,c))}function ue(G){z.on("mousemove.zoom mouseup.zoom",null),X2(G.view,$.moved),yc(G),$.event(G).end()}}function O(I,...Z){if(e.apply(this,arguments)){var W=this.__zoom,$=Br(I.changedTouches?I.changedTouches[0]:I,this),z=W.invert($),U=W.k*(I.shiftKey?.5:2),V=n(E(S(W,U),$,z),t.apply(this,Z),c);yc(I),u>0?vr(this).transition().duration(u).call(T,V,$,I):vr(this).call(b.transform,V,$,I)}}function H(I,...Z){if(e.apply(this,arguments)){var W=I.touches,$=W.length,z=R(this,Z,I.changedTouches.length===$).event(I),U,V,B,Y;for(Ip(I),V=0;V<$;++V)B=W[V],Y=Br(B,this),Y=[Y,this.__zoom.invert(Y),B.identifier],z.touch0?!z.touch1&&z.touch0[2]!==Y[2]&&(z.touch1=Y,z.taps=0):(z.touch0=Y,U=!0,z.taps=1+!!h);h&&(h=clearTimeout(h)),U&&(z.taps<2&&(m=Y[0],h=setTimeout(function(){h=null},w)),Zd(this),z.start())}}function K(I,...Z){if(this.__zooming){var W=R(this,Z).event(I),$=I.changedTouches,z=$.length,U,V,B,Y;for(yc(I),U=0;U<z;++U)V=$[U],B=Br(V,this),W.touch0&&W.touch0[2]===V.identifier?W.touch0[0]=B:W.touch1&&W.touch1[2]===V.identifier&&(W.touch1[0]=B);if(V=W.that.__zoom,W.touch1){var ue=W.touch0[0],G=W.touch0[1],ee=W.touch1[0],L=W.touch1[1],te=(te=ee[0]-ue[0])*te+(te=ee[1]-ue[1])*te,ne=(ne=L[0]-G[0])*ne+(ne=L[1]-G[1])*ne;V=S(V,Math.sqrt(te/ne)),B=[(ue[0]+ee[0])/2,(ue[1]+ee[1])/2],Y=[(G[0]+L[0])/2,(G[1]+L[1])/2]}else if(W.touch0)B=W.touch0[0],Y=W.touch0[1];else return;W.zoom("touch",n(E(V,B,Y),W.extent,c))}}function X(I,...Z){if(this.__zooming){var W=R(this,Z).event(I),$=I.changedTouches,z=$.length,U,V;for(Ip(I),y&&clearTimeout(y),y=setTimeout(function(){y=null},w),U=0;U<z;++U)V=$[U],W.touch0&&W.touch0[2]===V.identifier?delete W.touch0:W.touch1&&W.touch1[2]===V.identifier&&delete W.touch1;if(W.touch1&&!W.touch0&&(W.touch0=W.touch1,delete W.touch1),W.touch0)W.touch0[1]=this.__zoom.invert(W.touch0[0]);else if(W.end(),W.taps===2&&(V=Br(V,this),Math.hypot(m[0]-V[0],m[1]-V[1])<j)){var B=vr(this).on("dblclick.zoom");B&&B.apply(this,arguments)}}}return b.wheelDelta=function(I){return arguments.length?(r=typeof I=="function"?I:Sd(+I),b):r},b.filter=function(I){return arguments.length?(e=typeof I=="function"?I:Sd(!!I),b):e},b.touchable=function(I){return arguments.length?(a=typeof I=="function"?I:Sd(!!I),b):a},b.extent=function(I){return arguments.length?(t=typeof I=="function"?I:Sd([[+I[0][0],+I[0][1]],[+I[1][0],+I[1][1]]]),b):t},b.scaleExtent=function(I){return arguments.length?(l[0]=+I[0],l[1]=+I[1],b):[l[0],l[1]]},b.translateExtent=function(I){return arguments.length?(c[0][0]=+I[0][0],c[1][0]=+I[1][0],c[0][1]=+I[0][1],c[1][1]=+I[1][1],b):[[c[0][0],c[0][1]],[c[1][0],c[1][1]]]},b.constrain=function(I){return arguments.length?(n=I,b):n},b.duration=function(I){return arguments.length?(u=+I,b):u},b.interpolate=function(I){return arguments.length?(f=I,b):f},b.on=function(){var I=p.on.apply(p,arguments);return I===p?b:I},b.clickDistance=function(I){return arguments.length?(k=(I=+I)*I,b):Math.sqrt(k)},b.tapDistance=function(I){return arguments.length?(j=+I,b):j},b}var _n=$2();const Ah=x.createContext(null),TP=Ah.Provider,Vs={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.`},dA=Vs.error001();function xt(e,t){const n=x.useContext(Ah);if(n===null)throw new Error(dA);return L2(n,e,t)}const Vt=()=>{const e=x.useContext(Ah);if(e===null)throw new Error(dA);return x.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},AP=e=>e.userSelectionActive?"none":"all";function S0({position:e,children:t,className:n,style:r,...a}){const l=xt(AP),c=`${e}`.split("-");return pe.createElement("div",{className:mn(["react-flow__panel",n,...c]),style:{...r,pointerEvents:l},...a},t)}function RP({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:pe.createElement(S0,{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"},pe.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}const MP=({x:e,y:t,label:n,labelStyle:r={},labelShowBg:a=!0,labelBgStyle:l={},labelBgPadding:c=[2,4],labelBgBorderRadius:u=2,children:f,className:p,...h})=>{const m=x.useRef(null),[y,w]=x.useState({x:0,y:0,width:0,height:0}),_=mn(["react-flow__edge-textwrapper",p]);return x.useEffect(()=>{if(m.current){const k=m.current.getBBox();w({x:k.x,y:k.y,width:k.width,height:k.height})}},[n]),typeof n>"u"||!n?null:pe.createElement("g",{transform:`translate(${e-y.width/2} ${t-y.height/2})`,className:_,visibility:y.width?"visible":"hidden",...h},a&&pe.createElement("rect",{width:y.width+2*c[0],x:-c[0],y:-c[1],height:y.height+2*c[1],className:"react-flow__edge-textbg",style:l,rx:u,ry:u}),pe.createElement("text",{className:"react-flow__edge-text",y:y.height/2,dy:"0.3em",ref:m,style:r},n),f)};var IP=x.memo(MP);const j0=e=>({width:e.offsetWidth,height:e.offsetHeight}),sl=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),E0=(e={x:0,y:0},t)=>({x:sl(e.x,t[0][0],t[1][0]),y:sl(e.y,t[0][1],t[1][1])}),D1=(e,t,n)=>e<t?sl(Math.abs(e-t),1,50)/50:e>n?-sl(Math.abs(e-n),1,50)/50:0,hA=(e,t)=>{const n=D1(e.x,35,t.width-35)*20,r=D1(e.y,35,t.height-35)*20;return[n,r]},fA=e=>{var t;return((t=e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},pA=(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)}),zc=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),mA=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),F1=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),$P=(e,t)=>mA(pA(zc(e),zc(t))),Fx=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},OP=e=>xr(e.width)&&xr(e.height)&&xr(e.x)&&xr(e.y),xr=e=>!isNaN(e)&&isFinite(e),Ft=Symbol.for("internals"),gA=["Enter"," ","Escape"],LP=(e,t)=>{},PP=e=>"nativeEvent"in e;function qx(e){var a,l;const t=PP(e)?e.nativeEvent:e,n=((l=(a=t.composedPath)==null?void 0:a.call(t))==null?void 0:l[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 yA=e=>"clientX"in e,Pa=(e,t)=>{var l,c;const n=yA(e),r=n?e.clientX:(l=e.touches)==null?void 0:l[0].clientX,a=n?e.clientY:(c=e.touches)==null?void 0:c[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:a-((t==null?void 0:t.top)??0)}},lh=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0},ru=({id:e,path:t,labelX:n,labelY:r,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p,style:h,markerEnd:m,markerStart:y,interactionWidth:w=20})=>pe.createElement(pe.Fragment,null,pe.createElement("path",{id:e,style:h,d:t,fill:"none",className:"react-flow__edge-path",markerEnd:m,markerStart:y}),w&&pe.createElement("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:w,className:"react-flow__edge-interaction"}),a&&xr(n)&&xr(r)?pe.createElement(IP,{x:n,y:r,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p}):null);ru.displayName="BaseEdge";function wc(e,t,n){return n===void 0?n:r=>{const a=t().edges.find(l=>l.id===e);a&&n(r,{...a})}}function wA({sourceX:e,sourceY:t,targetX:n,targetY:r}){const a=Math.abs(n-e)/2,l=n<e?n+a:n-a,c=Math.abs(r-t)/2,u=r<t?r+c:r-c;return[l,u,a,c]}function vA({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:u}){const f=e*.125+a*.375+c*.375+n*.125,p=t*.125+l*.375+u*.375+r*.125,h=Math.abs(f-e),m=Math.abs(p-t);return[f,p,h,m]}var Bo;(function(e){e.Strict="strict",e.Loose="loose"})(Bo||(Bo={}));var Io;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Io||(Io={}));var Hc;(function(e){e.Partial="partial",e.Full="full"})(Hc||(Hc={}));var Ia;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Ia||(Ia={}));var ch;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(ch||(ch={}));var Ke;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Ke||(Ke={}));function q1({pos:e,x1:t,y1:n,x2:r,y2:a}){return e===Ke.Left||e===Ke.Right?[.5*(t+r),n]:[t,.5*(n+a)]}function xA({sourceX:e,sourceY:t,sourcePosition:n=Ke.Bottom,targetX:r,targetY:a,targetPosition:l=Ke.Top}){const[c,u]=q1({pos:n,x1:e,y1:t,x2:r,y2:a}),[f,p]=q1({pos:l,x1:r,y1:a,x2:e,y2:t}),[h,m,y,w]=vA({sourceX:e,sourceY:t,targetX:r,targetY:a,sourceControlX:c,sourceControlY:u,targetControlX:f,targetControlY:p});return[`M${e},${t} C${c},${u} ${f},${p} ${r},${a}`,h,m,y,w]}const C0=x.memo(({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:a=Ke.Bottom,targetPosition:l=Ke.Top,label:c,labelStyle:u,labelShowBg:f,labelBgStyle:p,labelBgPadding:h,labelBgBorderRadius:m,style:y,markerEnd:w,markerStart:_,interactionWidth:k})=>{const[j,b,S]=xA({sourceX:e,sourceY:t,sourcePosition:a,targetX:n,targetY:r,targetPosition:l});return pe.createElement(ru,{path:j,labelX:b,labelY:S,label:c,labelStyle:u,labelShowBg:f,labelBgStyle:p,labelBgPadding:h,labelBgBorderRadius:m,style:y,markerEnd:w,markerStart:_,interactionWidth:k})});C0.displayName="SimpleBezierEdge";const B1={[Ke.Left]:{x:-1,y:0},[Ke.Right]:{x:1,y:0},[Ke.Top]:{x:0,y:-1},[Ke.Bottom]:{x:0,y:1}},DP=({source:e,sourcePosition:t=Ke.Bottom,target:n})=>t===Ke.Left||t===Ke.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},z1=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function FP({source:e,sourcePosition:t=Ke.Bottom,target:n,targetPosition:r=Ke.Top,center:a,offset:l}){const c=B1[t],u=B1[r],f={x:e.x+c.x*l,y:e.y+c.y*l},p={x:n.x+u.x*l,y:n.y+u.y*l},h=DP({source:f,sourcePosition:t,target:p}),m=h.x!==0?"x":"y",y=h[m];let w=[],_,k;const j={x:0,y:0},b={x:0,y:0},[S,E,C,T]=wA({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(c[m]*u[m]===-1){_=a.x??S,k=a.y??E;const A=[{x:_,y:f.y},{x:_,y:p.y}],q=[{x:f.x,y:k},{x:p.x,y:k}];c[m]===y?w=m==="x"?A:q:w=m==="x"?q:A}else{const A=[{x:f.x,y:p.y}],q=[{x:p.x,y:f.y}];if(m==="x"?w=c.x===y?q:A:w=c.y===y?A:q,t===r){const X=Math.abs(e[m]-n[m]);if(X<=l){const I=Math.min(l-1,l-X);c[m]===y?j[m]=(f[m]>e[m]?-1:1)*I:b[m]=(p[m]>n[m]?-1:1)*I}}if(t!==r){const X=m==="x"?"y":"x",I=c[m]===u[X],Z=f[X]>p[X],W=f[X]<p[X];(c[m]===1&&(!I&&Z||I&&W)||c[m]!==1&&(!I&&W||I&&Z))&&(w=m==="x"?A:q)}const F={x:f.x+j.x,y:f.y+j.y},O={x:p.x+b.x,y:p.y+b.y},H=Math.max(Math.abs(F.x-w[0].x),Math.abs(O.x-w[0].x)),K=Math.max(Math.abs(F.y-w[0].y),Math.abs(O.y-w[0].y));H>=K?(_=(F.x+O.x)/2,k=w[0].y):(_=w[0].x,k=(F.y+O.y)/2)}return[[e,{x:f.x+j.x,y:f.y+j.y},...w,{x:p.x+b.x,y:p.y+b.y},n],_,k,C,T]}function qP(e,t,n,r){const a=Math.min(z1(e,t)/2,z1(t,n)/2,r),{x:l,y:c}=t;if(e.x===l&&l===n.x||e.y===c&&c===n.y)return`L${l} ${c}`;if(e.y===c){const p=e.x<n.x?-1:1,h=e.y<n.y?1:-1;return`L ${l+a*p},${c}Q ${l},${c} ${l},${c+a*h}`}const u=e.x<n.x?1:-1,f=e.y<n.y?-1:1;return`L ${l},${c+a*f}Q ${l},${c} ${l+a*u},${c}`}function Bx({sourceX:e,sourceY:t,sourcePosition:n=Ke.Bottom,targetX:r,targetY:a,targetPosition:l=Ke.Top,borderRadius:c=5,centerX:u,centerY:f,offset:p=20}){const[h,m,y,w,_]=FP({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:a},targetPosition:l,center:{x:u,y:f},offset:p});return[h.reduce((j,b,S)=>{let E="";return S>0&&S<h.length-1?E=qP(h[S-1],b,h[S+1],c):E=`${S===0?"M":"L"}${b.x} ${b.y}`,j+=E,j},""),m,y,w,_]}const Rh=x.memo(({sourceX:e,sourceY:t,targetX:n,targetY:r,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p,style:h,sourcePosition:m=Ke.Bottom,targetPosition:y=Ke.Top,markerEnd:w,markerStart:_,pathOptions:k,interactionWidth:j})=>{const[b,S,E]=Bx({sourceX:e,sourceY:t,sourcePosition:m,targetX:n,targetY:r,targetPosition:y,borderRadius:k==null?void 0:k.borderRadius,offset:k==null?void 0:k.offset});return pe.createElement(ru,{path:b,labelX:S,labelY:E,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p,style:h,markerEnd:w,markerStart:_,interactionWidth:j})});Rh.displayName="SmoothStepEdge";const T0=x.memo(e=>{var t;return pe.createElement(Rh,{...e,pathOptions:x.useMemo(()=>{var n;return{borderRadius:0,offset:(n=e.pathOptions)==null?void 0:n.offset}},[(t=e.pathOptions)==null?void 0:t.offset])})});T0.displayName="StepEdge";function BP({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[a,l,c,u]=wA({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,a,l,c,u]}const A0=x.memo(({sourceX:e,sourceY:t,targetX:n,targetY:r,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p,style:h,markerEnd:m,markerStart:y,interactionWidth:w})=>{const[_,k,j]=BP({sourceX:e,sourceY:t,targetX:n,targetY:r});return pe.createElement(ru,{path:_,labelX:k,labelY:j,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p,style:h,markerEnd:m,markerStart:y,interactionWidth:w})});A0.displayName="StraightEdge";function jd(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function H1({pos:e,x1:t,y1:n,x2:r,y2:a,c:l}){switch(e){case Ke.Left:return[t-jd(t-r,l),n];case Ke.Right:return[t+jd(r-t,l),n];case Ke.Top:return[t,n-jd(n-a,l)];case Ke.Bottom:return[t,n+jd(a-n,l)]}}function R0({sourceX:e,sourceY:t,sourcePosition:n=Ke.Bottom,targetX:r,targetY:a,targetPosition:l=Ke.Top,curvature:c=.25}){const[u,f]=H1({pos:n,x1:e,y1:t,x2:r,y2:a,c}),[p,h]=H1({pos:l,x1:r,y1:a,x2:e,y2:t,c}),[m,y,w,_]=vA({sourceX:e,sourceY:t,targetX:r,targetY:a,sourceControlX:u,sourceControlY:f,targetControlX:p,targetControlY:h});return[`M${e},${t} C${u},${f} ${p},${h} ${r},${a}`,m,y,w,_]}const uh=x.memo(({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:a=Ke.Bottom,targetPosition:l=Ke.Top,label:c,labelStyle:u,labelShowBg:f,labelBgStyle:p,labelBgPadding:h,labelBgBorderRadius:m,style:y,markerEnd:w,markerStart:_,pathOptions:k,interactionWidth:j})=>{const[b,S,E]=R0({sourceX:e,sourceY:t,sourcePosition:a,targetX:n,targetY:r,targetPosition:l,curvature:k==null?void 0:k.curvature});return pe.createElement(ru,{path:b,labelX:S,labelY:E,label:c,labelStyle:u,labelShowBg:f,labelBgStyle:p,labelBgPadding:h,labelBgBorderRadius:m,style:y,markerEnd:w,markerStart:_,interactionWidth:j})});uh.displayName="BezierEdge";const M0=x.createContext(null),zP=M0.Provider;M0.Consumer;const HP=()=>x.useContext(M0),UP=e=>"id"in e&&"source"in e&&"target"in e,WP=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`reactflow__edge-${e}${t||""}-${n}${r||""}`,zx=(e,t)=>typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`,VP=(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)),GP=(e,t)=>{if(!e.source||!e.target)return t;let n;return UP(e)?n={...e}:n={...e,id:WP(e)},VP(n,t)?t:t.concat(n)},Hx=({x:e,y:t},[n,r,a],l,[c,u])=>{const f={x:(e-n)/a,y:(t-r)/a};return l?{x:c*Math.round(f.x/c),y:u*Math.round(f.y/u)}:f},bA=({x:e,y:t},[n,r,a])=>({x:e*a+n,y:t*a+r}),Lo=(e,t=[0,0])=>{if(!e)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const n=(e.width??0)*t[0],r=(e.height??0)*t[1],a={x:e.position.x-n,y:e.position.y-r};return{...a,positionAbsolute:e.positionAbsolute?{x:e.positionAbsolute.x-n,y:e.positionAbsolute.y-r}:a}},Mh=(e,t=[0,0])=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,a)=>{const{x:l,y:c}=Lo(a,t).positionAbsolute;return pA(r,zc({x:l,y:c,width:a.width||0,height:a.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return mA(n)},kA=(e,t,[n,r,a]=[0,0,1],l=!1,c=!1,u=[0,0])=>{const f={x:(t.x-n)/a,y:(t.y-r)/a,width:t.width/a,height:t.height/a},p=[];return e.forEach(h=>{const{width:m,height:y,selectable:w=!0,hidden:_=!1}=h;if(c&&!w||_)return!1;const{positionAbsolute:k}=Lo(h,u),j={x:k.x,y:k.y,width:m||0,height:y||0},b=Fx(f,j),S=typeof m>"u"||typeof y>"u"||m===null||y===null,E=l&&b>0,C=(m||0)*(y||0);(S||E||b>=C||h.dragging)&&p.push(h)}),p},NA=(e,t)=>{const n=e.map(r=>r.id);return t.filter(r=>n.includes(r.source)||n.includes(r.target))},_A=(e,t,n,r,a,l=.1)=>{const c=t/(e.width*(1+l)),u=n/(e.height*(1+l)),f=Math.min(c,u),p=sl(f,r,a),h=e.x+e.width/2,m=e.y+e.height/2,y=t/2-h*p,w=n/2-m*p;return{x:y,y:w,zoom:p}},Ao=(e,t=0)=>e.transition().duration(t);function U1(e,t,n,r){return(t[n]||[]).reduce((a,l)=>{var c,u;return`${e.id}-${l.id}-${n}`!==r&&a.push({id:l.id||null,type:n,nodeId:e.id,x:(((c=e.positionAbsolute)==null?void 0:c.x)??0)+l.x+l.width/2,y:(((u=e.positionAbsolute)==null?void 0:u.y)??0)+l.y+l.height/2}),a},[])}function KP(e,t,n,r,a,l){const{x:c,y:u}=Pa(e),p=t.elementsFromPoint(c,u).find(_=>_.classList.contains("react-flow__handle"));if(p){const _=p.getAttribute("data-nodeid");if(_){const k=I0(void 0,p),j=p.getAttribute("data-handleid"),b=l({nodeId:_,id:j,type:k});if(b){const S=a.find(E=>E.nodeId===_&&E.type===k&&E.id===j);return{handle:{id:j,type:k,nodeId:_,x:(S==null?void 0:S.x)||n.x,y:(S==null?void 0:S.y)||n.y},validHandleResult:b}}}}let h=[],m=1/0;if(a.forEach(_=>{const k=Math.sqrt((_.x-n.x)**2+(_.y-n.y)**2);if(k<=r){const j=l(_);k<=m&&(k<m?h=[{handle:_,validHandleResult:j}]:k===m&&h.push({handle:_,validHandleResult:j}),m=k)}}),!h.length)return{handle:null,validHandleResult:SA()};if(h.length===1)return h[0];const y=h.some(({validHandleResult:_})=>_.isValid),w=h.some(({handle:_})=>_.type==="target");return h.find(({handle:_,validHandleResult:k})=>w?_.type==="target":y?k.isValid:!0)||h[0]}const YP={source:null,target:null,sourceHandle:null,targetHandle:null},SA=()=>({handleDomNode:null,isValid:!1,connection:YP,endHandle:null});function jA(e,t,n,r,a,l,c){const u=a==="target",f=c.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={...SA(),handleDomNode:f};if(f){const h=I0(void 0,f),m=f.getAttribute("data-nodeid"),y=f.getAttribute("data-handleid"),w=f.classList.contains("connectable"),_=f.classList.contains("connectableend"),k={source:u?m:n,sourceHandle:u?y:r,target:u?n:m,targetHandle:u?r:y};p.connection=k,w&&_&&(t===Bo.Strict?u&&h==="source"||!u&&h==="target":m!==n||y!==r)&&(p.endHandle={nodeId:m,handleId:y,type:h},p.isValid=l(k))}return p}function XP({nodes:e,nodeId:t,handleId:n,handleType:r}){return e.reduce((a,l)=>{if(l[Ft]){const{handleBounds:c}=l[Ft];let u=[],f=[];c&&(u=U1(l,c,"source",`${t}-${n}-${r}`),f=U1(l,c,"target",`${t}-${n}-${r}`)),a.push(...u,...f)}return a},[])}function I0(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function $p(e){e==null||e.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function ZP(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}function EA({event:e,handleId:t,nodeId:n,onConnect:r,isTarget:a,getState:l,setState:c,isValidConnection:u,edgeUpdaterType:f,onReconnectEnd:p}){const h=fA(e.target),{connectionMode:m,domNode:y,autoPanOnConnect:w,connectionRadius:_,onConnectStart:k,panBy:j,getNodes:b,cancelConnection:S}=l();let E=0,C;const{x:T,y:R}=Pa(e),A=h==null?void 0:h.elementFromPoint(T,R),q=I0(f,A),F=y==null?void 0:y.getBoundingClientRect();if(!F||!q)return;let O,H=Pa(e,F),K=!1,X=null,I=!1,Z=null;const W=XP({nodes:b(),nodeId:n,handleId:t,handleType:q}),$=()=>{if(!w)return;const[V,B]=hA(H,F);j({x:V,y:B}),E=requestAnimationFrame($)};c({connectionPosition:H,connectionStatus:null,connectionNodeId:n,connectionHandleId:t,connectionHandleType:q,connectionStartHandle:{nodeId:n,handleId:t,type:q},connectionEndHandle:null}),k==null||k(e,{nodeId:n,handleId:t,handleType:q});function z(V){const{transform:B}=l();H=Pa(V,F);const{handle:Y,validHandleResult:ue}=KP(V,h,Hx(H,B,!1,[1,1]),_,W,G=>jA(G,m,n,t,a?"target":"source",u,h));if(C=Y,K||($(),K=!0),Z=ue.handleDomNode,X=ue.connection,I=ue.isValid,c({connectionPosition:C&&I?bA({x:C.x,y:C.y},B):H,connectionStatus:ZP(!!C,I),connectionEndHandle:ue.endHandle}),!C&&!I&&!Z)return $p(O);X.source!==X.target&&Z&&($p(O),O=Z,Z.classList.add("connecting","react-flow__handle-connecting"),Z.classList.toggle("valid",I),Z.classList.toggle("react-flow__handle-valid",I))}function U(V){var B,Y;(C||Z)&&X&&I&&(r==null||r(X)),(Y=(B=l()).onConnectEnd)==null||Y.call(B,V),f&&(p==null||p(V)),$p(O),S(),cancelAnimationFrame(E),K=!1,I=!1,X=null,Z=null,h.removeEventListener("mousemove",z),h.removeEventListener("mouseup",U),h.removeEventListener("touchmove",z),h.removeEventListener("touchend",U)}h.addEventListener("mousemove",z),h.addEventListener("mouseup",U),h.addEventListener("touchmove",z),h.addEventListener("touchend",U)}const W1=()=>!0,QP=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),JP=(e,t,n)=>r=>{const{connectionStartHandle:a,connectionEndHandle:l,connectionClickStartHandle:c}=r;return{connecting:(a==null?void 0:a.nodeId)===e&&(a==null?void 0:a.handleId)===t&&(a==null?void 0:a.type)===n||(l==null?void 0:l.nodeId)===e&&(l==null?void 0:l.handleId)===t&&(l==null?void 0:l.type)===n,clickConnecting:(c==null?void 0:c.nodeId)===e&&(c==null?void 0:c.handleId)===t&&(c==null?void 0:c.type)===n}},CA=x.forwardRef(({type:e="source",position:t=Ke.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:a=!0,isConnectableEnd:l=!0,id:c,onConnect:u,children:f,className:p,onMouseDown:h,onTouchStart:m,...y},w)=>{var F,O;const _=c||null,k=e==="target",j=Vt(),b=HP(),{connectOnClick:S,noPanClassName:E}=xt(QP,rn),{connecting:C,clickConnecting:T}=xt(JP(b,_,e),rn);b||(O=(F=j.getState()).onError)==null||O.call(F,"010",Vs.error010());const R=H=>{const{defaultEdgeOptions:K,onConnect:X,hasDefaultEdges:I}=j.getState(),Z={...K,...H};if(I){const{edges:W,setEdges:$}=j.getState();$(GP(Z,W))}X==null||X(Z),u==null||u(Z)},A=H=>{if(!b)return;const K=yA(H);a&&(K&&H.button===0||!K)&&EA({event:H,handleId:_,nodeId:b,onConnect:R,isTarget:k,getState:j.getState,setState:j.setState,isValidConnection:n||j.getState().isValidConnection||W1}),K?h==null||h(H):m==null||m(H)},q=H=>{const{onClickConnectStart:K,onClickConnectEnd:X,connectionClickStartHandle:I,connectionMode:Z,isValidConnection:W}=j.getState();if(!b||!I&&!a)return;if(!I){K==null||K(H,{nodeId:b,handleId:_,handleType:e}),j.setState({connectionClickStartHandle:{nodeId:b,type:e,handleId:_}});return}const $=fA(H.target),z=n||W||W1,{connection:U,isValid:V}=jA({nodeId:b,id:_,type:e},Z,I.nodeId,I.handleId||null,I.type,z,$);V&&R(U),X==null||X(H),j.setState({connectionClickStartHandle:null})};return pe.createElement("div",{"data-handleid":_,"data-nodeid":b,"data-handlepos":t,"data-id":`${b}-${_}-${e}`,className:mn(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",E,p,{source:!k,target:k,connectable:r,connectablestart:a,connectableend:l,connecting:T,connectionindicator:r&&(a&&!C||l&&C)}]),onMouseDown:A,onTouchStart:A,onClick:S?q:void 0,ref:w,...y},f)});CA.displayName="Handle";var zo=x.memo(CA);const TA=({data:e,isConnectable:t,targetPosition:n=Ke.Top,sourcePosition:r=Ke.Bottom})=>pe.createElement(pe.Fragment,null,pe.createElement(zo,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,pe.createElement(zo,{type:"source",position:r,isConnectable:t}));TA.displayName="DefaultNode";var Ux=x.memo(TA);const AA=({data:e,isConnectable:t,sourcePosition:n=Ke.Bottom})=>pe.createElement(pe.Fragment,null,e==null?void 0:e.label,pe.createElement(zo,{type:"source",position:n,isConnectable:t}));AA.displayName="InputNode";var RA=x.memo(AA);const MA=({data:e,isConnectable:t,targetPosition:n=Ke.Top})=>pe.createElement(pe.Fragment,null,pe.createElement(zo,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label);MA.displayName="OutputNode";var IA=x.memo(MA);const $0=()=>null;$0.displayName="GroupNode";const e4=e=>({selectedNodes:e.getNodes().filter(t=>t.selected),selectedEdges:e.edges.filter(t=>t.selected).map(t=>({...t}))}),Ed=e=>e.id;function t4(e,t){return rn(e.selectedNodes.map(Ed),t.selectedNodes.map(Ed))&&rn(e.selectedEdges.map(Ed),t.selectedEdges.map(Ed))}const $A=x.memo(({onSelectionChange:e})=>{const t=Vt(),{selectedNodes:n,selectedEdges:r}=xt(e4,t4);return x.useEffect(()=>{const a={nodes:n,edges:r};e==null||e(a),t.getState().onSelectionChange.forEach(l=>l(a))},[n,r,e]),null});$A.displayName="SelectionListener";const n4=e=>!!e.onSelectionChange;function r4({onSelectionChange:e}){const t=xt(n4);return e||t?pe.createElement($A,{onSelectionChange:e}):null}const s4=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 $i(e,t){x.useEffect(()=>{typeof e<"u"&&t(e)},[e])}function dt(e,t,n){x.useEffect(()=>{typeof t<"u"&&n({[e]:t})},[t])}const a4=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:a,onConnectStart:l,onConnectEnd:c,onClickConnectStart:u,onClickConnectEnd:f,nodesDraggable:p,nodesConnectable:h,nodesFocusable:m,edgesFocusable:y,edgesUpdatable:w,elevateNodesOnSelect:_,minZoom:k,maxZoom:j,nodeExtent:b,onNodesChange:S,onEdgesChange:E,elementsSelectable:C,connectionMode:T,snapGrid:R,snapToGrid:A,translateExtent:q,connectOnClick:F,defaultEdgeOptions:O,fitView:H,fitViewOptions:K,onNodesDelete:X,onEdgesDelete:I,onNodeDrag:Z,onNodeDragStart:W,onNodeDragStop:$,onSelectionDrag:z,onSelectionDragStart:U,onSelectionDragStop:V,noPanClassName:B,nodeOrigin:Y,rfId:ue,autoPanOnConnect:G,autoPanOnNodeDrag:ee,onError:L,connectionRadius:te,isValidConnection:ne,nodeDragThreshold:ie})=>{const{setNodes:me,setEdges:je,setDefaultNodesAndEdges:Oe,setMinZoom:Ve,setMaxZoom:Le,setTranslateExtent:Te,setNodeExtent:nt,reset:_e}=xt(s4,rn),Se=Vt();return x.useEffect(()=>{const Xe=r==null?void 0:r.map(ot=>({...ot,...O}));return Oe(n,Xe),()=>{_e()}},[]),dt("defaultEdgeOptions",O,Se.setState),dt("connectionMode",T,Se.setState),dt("onConnect",a,Se.setState),dt("onConnectStart",l,Se.setState),dt("onConnectEnd",c,Se.setState),dt("onClickConnectStart",u,Se.setState),dt("onClickConnectEnd",f,Se.setState),dt("nodesDraggable",p,Se.setState),dt("nodesConnectable",h,Se.setState),dt("nodesFocusable",m,Se.setState),dt("edgesFocusable",y,Se.setState),dt("edgesUpdatable",w,Se.setState),dt("elementsSelectable",C,Se.setState),dt("elevateNodesOnSelect",_,Se.setState),dt("snapToGrid",A,Se.setState),dt("snapGrid",R,Se.setState),dt("onNodesChange",S,Se.setState),dt("onEdgesChange",E,Se.setState),dt("connectOnClick",F,Se.setState),dt("fitViewOnInit",H,Se.setState),dt("fitViewOnInitOptions",K,Se.setState),dt("onNodesDelete",X,Se.setState),dt("onEdgesDelete",I,Se.setState),dt("onNodeDrag",Z,Se.setState),dt("onNodeDragStart",W,Se.setState),dt("onNodeDragStop",$,Se.setState),dt("onSelectionDrag",z,Se.setState),dt("onSelectionDragStart",U,Se.setState),dt("onSelectionDragStop",V,Se.setState),dt("noPanClassName",B,Se.setState),dt("nodeOrigin",Y,Se.setState),dt("rfId",ue,Se.setState),dt("autoPanOnConnect",G,Se.setState),dt("autoPanOnNodeDrag",ee,Se.setState),dt("onError",L,Se.setState),dt("connectionRadius",te,Se.setState),dt("isValidConnection",ne,Se.setState),dt("nodeDragThreshold",ie,Se.setState),$i(e,me),$i(t,je),$i(k,Ve),$i(j,Le),$i(q,Te),$i(b,nt),null},V1={display:"none"},o4={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},OA="react-flow__node-desc",LA="react-flow__edge-desc",i4="react-flow__aria-live",l4=e=>e.ariaLiveMessage;function c4({rfId:e}){const t=xt(l4);return pe.createElement("div",{id:`${i4}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:o4},t)}function u4({rfId:e,disableKeyboardA11y:t}){return pe.createElement(pe.Fragment,null,pe.createElement("div",{id:`${OA}-${e}`,style:V1},"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."," "),pe.createElement("div",{id:`${LA}-${e}`,style:V1},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!t&&pe.createElement(c4,{rfId:e}))}var Uc=(e=null,t={actInsideInputWithModifier:!0})=>{const[n,r]=x.useState(!1),a=x.useRef(!1),l=x.useRef(new Set([])),[c,u]=x.useMemo(()=>{if(e!==null){const p=(Array.isArray(e)?e:[e]).filter(m=>typeof m=="string").map(m=>m.split("+")),h=p.reduce((m,y)=>m.concat(...y),[]);return[p,h]}return[[],[]]},[e]);return x.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)&&qx(w))return!1;const k=K1(w.code,u);l.current.add(w[k]),G1(c,l.current,!1)&&(w.preventDefault(),r(!0))},m=w=>{if((!a.current||a.current&&!t.actInsideInputWithModifier)&&qx(w))return!1;const k=K1(w.code,u);G1(c,l.current,!0)?(r(!1),l.current.clear()):l.current.delete(w[k]),w.key==="Meta"&&l.current.clear(),a.current=!1},y=()=>{l.current.clear(),r(!1)};return p==null||p.addEventListener("keydown",h),p==null||p.addEventListener("keyup",m),window.addEventListener("blur",y),()=>{p==null||p.removeEventListener("keydown",h),p==null||p.removeEventListener("keyup",m),window.removeEventListener("blur",y)}}},[e,r]),n};function G1(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(a=>t.has(a)))}function K1(e,t){return t.includes(e)?"code":"key"}function PA(e,t,n,r){var u,f;const a=e.parentNode||e.parentId;if(!a)return n;const l=t.get(a),c=Lo(l,r);return PA(l,t,{x:(n.x??0)+c.x,y:(n.y??0)+c.y,z:(((u=l[Ft])==null?void 0:u.z)??0)>(n.z??0)?((f=l[Ft])==null?void 0:f.z)??0:n.z??0},r)}function DA(e,t,n){e.forEach(r=>{var l;const a=r.parentNode||r.parentId;if(a&&!e.has(a))throw new Error(`Parent node ${a} not found`);if(a||n!=null&&n[r.id]){const{x:c,y:u,z:f}=PA(r,e,{...r.position,z:((l=r[Ft])==null?void 0:l.z)??0},t);r.positionAbsolute={x:c,y:u},r[Ft].z=f,n!=null&&n[r.id]&&(r[Ft].isParent=!0)}})}function Op(e,t,n,r){const a=new Map,l={},c=r?1e3:0;return e.forEach(u=>{var w;const f=(xr(u.zIndex)?u.zIndex:0)+(u.selected?c:0),p=t.get(u.id),h={...u,positionAbsolute:{x:u.position.x,y:u.position.y}},m=u.parentNode||u.parentId;m&&(l[m]=!0);const y=(p==null?void 0:p.type)&&(p==null?void 0:p.type)!==u.type;Object.defineProperty(h,Ft,{enumerable:!1,value:{handleBounds:y||(w=p==null?void 0:p[Ft])==null?void 0:w.handleBounds,z:f}}),a.set(u.id,h)}),DA(a,n,l),a}function FA(e,t={}){const{getNodes:n,width:r,height:a,minZoom:l,maxZoom:c,d3Zoom:u,d3Selection:f,fitViewOnInitDone:p,fitViewOnInit:h,nodeOrigin:m}=e(),y=t.initial&&!p&&h;if(u&&f&&(y||!t.initial)){const _=n().filter(j=>{var S;const b=t.includeHiddenNodes?j.width&&j.height:!j.hidden;return(S=t.nodes)!=null&&S.length?b&&t.nodes.some(E=>E.id===j.id):b}),k=_.every(j=>j.width&&j.height);if(_.length>0&&k){const j=Mh(_,m),{x:b,y:S,zoom:E}=_A(j,r,a,t.minZoom??l,t.maxZoom??c,t.padding??.1),C=Us.translate(b,S).scale(E);return typeof t.duration=="number"&&t.duration>0?u.transform(Ao(f,t.duration),C):u.transform(f,C),!0}}return!1}function d4(e,t){return e.forEach(n=>{const r=t.get(n.id);r&&t.set(r.id,{...r,[Ft]:r[Ft],selected:n.selected})}),new Map(t)}function h4(e,t){return t.map(n=>{const r=e.find(a=>a.id===n.id);return r&&(n.selected=r.selected),n})}function Cd({changedNodes:e,changedEdges:t,get:n,set:r}){const{nodeInternals:a,edges:l,onNodesChange:c,onEdgesChange:u,hasDefaultNodes:f,hasDefaultEdges:p}=n();e!=null&&e.length&&(f&&r({nodeInternals:d4(e,a)}),c==null||c(e)),t!=null&&t.length&&(p&&r({edges:h4(t,l)}),u==null||u(t))}const Oi=()=>{},f4={zoomIn:Oi,zoomOut:Oi,zoomTo:Oi,getZoom:()=>1,setViewport:Oi,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:Oi,fitBounds:Oi,project:e=>e,screenToFlowPosition:e=>e,flowToScreenPosition:e=>e,viewportInitialized:!1},p4=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),m4=()=>{const e=Vt(),{d3Zoom:t,d3Selection:n}=xt(p4,rn);return x.useMemo(()=>n&&t?{zoomIn:a=>t.scaleBy(Ao(n,a==null?void 0:a.duration),1.2),zoomOut:a=>t.scaleBy(Ao(n,a==null?void 0:a.duration),1/1.2),zoomTo:(a,l)=>t.scaleTo(Ao(n,l==null?void 0:l.duration),a),getZoom:()=>e.getState().transform[2],setViewport:(a,l)=>{const[c,u,f]=e.getState().transform,p=Us.translate(a.x??c,a.y??u).scale(a.zoom??f);t.transform(Ao(n,l==null?void 0:l.duration),p)},getViewport:()=>{const[a,l,c]=e.getState().transform;return{x:a,y:l,zoom:c}},fitView:a=>FA(e.getState,a),setCenter:(a,l,c)=>{const{width:u,height:f,maxZoom:p}=e.getState(),h=typeof(c==null?void 0:c.zoom)<"u"?c.zoom:p,m=u/2-a*h,y=f/2-l*h,w=Us.translate(m,y).scale(h);t.transform(Ao(n,c==null?void 0:c.duration),w)},fitBounds:(a,l)=>{const{width:c,height:u,minZoom:f,maxZoom:p}=e.getState(),{x:h,y:m,zoom:y}=_A(a,c,u,f,p,(l==null?void 0:l.padding)??.1),w=Us.translate(h,m).scale(y);t.transform(Ao(n,l==null?void 0:l.duration),w)},project:a=>{const{transform:l,snapToGrid:c,snapGrid:u}=e.getState();return console.warn("[DEPRECATED] `project` is deprecated. Instead use `screenToFlowPosition`. There is no need to subtract the react flow bounds anymore! https://reactflow.dev/api-reference/types/react-flow-instance#screen-to-flow-position"),Hx(a,l,c,u)},screenToFlowPosition:a=>{const{transform:l,snapToGrid:c,snapGrid:u,domNode:f}=e.getState();if(!f)return a;const{x:p,y:h}=f.getBoundingClientRect(),m={x:a.x-p,y:a.y-h};return Hx(m,l,c,u)},flowToScreenPosition:a=>{const{transform:l,domNode:c}=e.getState();if(!c)return a;const{x:u,y:f}=c.getBoundingClientRect(),p=bA(a,l);return{x:p.x+u,y:p.y+f}},viewportInitialized:!0}:f4,[t,n])};function Ih(){const e=m4(),t=Vt(),n=x.useCallback(()=>t.getState().getNodes().map(k=>({...k})),[]),r=x.useCallback(k=>t.getState().nodeInternals.get(k),[]),a=x.useCallback(()=>{const{edges:k=[]}=t.getState();return k.map(j=>({...j}))},[]),l=x.useCallback(k=>{const{edges:j=[]}=t.getState();return j.find(b=>b.id===k)},[]),c=x.useCallback(k=>{const{getNodes:j,setNodes:b,hasDefaultNodes:S,onNodesChange:E}=t.getState(),C=j(),T=typeof k=="function"?k(C):k;if(S)b(T);else if(E){const R=T.length===0?C.map(A=>({type:"remove",id:A.id})):T.map(A=>({item:A,type:"reset"}));E(R)}},[]),u=x.useCallback(k=>{const{edges:j=[],setEdges:b,hasDefaultEdges:S,onEdgesChange:E}=t.getState(),C=typeof k=="function"?k(j):k;if(S)b(C);else if(E){const T=C.length===0?j.map(R=>({type:"remove",id:R.id})):C.map(R=>({item:R,type:"reset"}));E(T)}},[]),f=x.useCallback(k=>{const j=Array.isArray(k)?k:[k],{getNodes:b,setNodes:S,hasDefaultNodes:E,onNodesChange:C}=t.getState();if(E){const R=[...b(),...j];S(R)}else if(C){const T=j.map(R=>({item:R,type:"add"}));C(T)}},[]),p=x.useCallback(k=>{const j=Array.isArray(k)?k:[k],{edges:b=[],setEdges:S,hasDefaultEdges:E,onEdgesChange:C}=t.getState();if(E)S([...b,...j]);else if(C){const T=j.map(R=>({item:R,type:"add"}));C(T)}},[]),h=x.useCallback(()=>{const{getNodes:k,edges:j=[],transform:b}=t.getState(),[S,E,C]=b;return{nodes:k().map(T=>({...T})),edges:j.map(T=>({...T})),viewport:{x:S,y:E,zoom:C}}},[]),m=x.useCallback(({nodes:k,edges:j})=>{const{nodeInternals:b,getNodes:S,edges:E,hasDefaultNodes:C,hasDefaultEdges:T,onNodesDelete:R,onEdgesDelete:A,onNodesChange:q,onEdgesChange:F}=t.getState(),O=(k||[]).map(Z=>Z.id),H=(j||[]).map(Z=>Z.id),K=S().reduce((Z,W)=>{const $=W.parentNode||W.parentId,z=!O.includes(W.id)&&$&&Z.find(V=>V.id===$);return(typeof W.deletable=="boolean"?W.deletable:!0)&&(O.includes(W.id)||z)&&Z.push(W),Z},[]),X=E.filter(Z=>typeof Z.deletable=="boolean"?Z.deletable:!0),I=X.filter(Z=>H.includes(Z.id));if(K||I){const Z=NA(K,X),W=[...I,...Z],$=W.reduce((z,U)=>(z.includes(U.id)||z.push(U.id),z),[]);if((T||C)&&(T&&t.setState({edges:E.filter(z=>!$.includes(z.id))}),C&&(K.forEach(z=>{b.delete(z.id)}),t.setState({nodeInternals:new Map(b)}))),$.length>0&&(A==null||A(W),F&&F($.map(z=>({id:z,type:"remove"})))),K.length>0&&(R==null||R(K),q)){const z=K.map(U=>({id:U.id,type:"remove"}));q(z)}}},[]),y=x.useCallback(k=>{const j=OP(k),b=j?null:t.getState().nodeInternals.get(k.id);return!j&&!b?[null,null,j]:[j?k:F1(b),b,j]},[]),w=x.useCallback((k,j=!0,b)=>{const[S,E,C]=y(k);return S?(b||t.getState().getNodes()).filter(T=>{if(!C&&(T.id===E.id||!T.positionAbsolute))return!1;const R=F1(T),A=Fx(R,S);return j&&A>0||A>=S.width*S.height}):[]},[]),_=x.useCallback((k,j,b=!0)=>{const[S]=y(k);if(!S)return!1;const E=Fx(S,j);return b&&E>0||E>=S.width*S.height},[]);return x.useMemo(()=>({...e,getNodes:n,getNode:r,getEdges:a,getEdge:l,setNodes:c,setEdges:u,addNodes:f,addEdges:p,toObject:h,deleteElements:m,getIntersectingNodes:w,isNodeIntersecting:_}),[e,n,r,a,l,c,u,f,p,h,m,w,_])}const g4={actInsideInputWithModifier:!1};var y4=({deleteKeyCode:e,multiSelectionKeyCode:t})=>{const n=Vt(),{deleteElements:r}=Ih(),a=Uc(e,g4),l=Uc(t);x.useEffect(()=>{if(a){const{edges:c,getNodes:u}=n.getState(),f=u().filter(h=>h.selected),p=c.filter(h=>h.selected);r({nodes:f,edges:p}),n.setState({nodesSelectionActive:!1})}},[a]),x.useEffect(()=>{n.setState({multiSelectionActive:l})},[l])};function w4(e){const t=Vt();x.useEffect(()=>{let n;const r=()=>{var l,c;if(!e.current)return;const a=j0(e.current);(a.height===0||a.width===0)&&((c=(l=t.getState()).onError)==null||c.call(l,"004",Vs.error004())),t.setState({width:a.width||500,height:a.height||500})};return r(),window.addEventListener("resize",r),e.current&&(n=new ResizeObserver(()=>r()),n.observe(e.current)),()=>{window.removeEventListener("resize",r),n&&e.current&&n.unobserve(e.current)}},[])}const O0={position:"absolute",width:"100%",height:"100%",top:0,left:0},v4=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,Td=e=>({x:e.x,y:e.y,zoom:e.k}),Li=(e,t)=>e.target.closest(`.${t}`),Y1=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),X1=e=>{const t=e.ctrlKey&&lh()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t},x4=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),b4=({onMove:e,onMoveStart:t,onMoveEnd:n,onPaneContextMenu:r,zoomOnScroll:a=!0,zoomOnPinch:l=!0,panOnScroll:c=!1,panOnScrollSpeed:u=.5,panOnScrollMode:f=Io.Free,zoomOnDoubleClick:p=!0,elementsSelectable:h,panOnDrag:m=!0,defaultViewport:y,translateExtent:w,minZoom:_,maxZoom:k,zoomActivationKeyCode:j,preventScrolling:b=!0,children:S,noWheelClassName:E,noPanClassName:C})=>{const T=x.useRef(),R=Vt(),A=x.useRef(!1),q=x.useRef(!1),F=x.useRef(null),O=x.useRef({x:0,y:0,zoom:0}),{d3Zoom:H,d3Selection:K,d3ZoomHandler:X,userSelectionActive:I}=xt(x4,rn),Z=Uc(j),W=x.useRef(0),$=x.useRef(!1),z=x.useRef();return w4(F),x.useEffect(()=>{if(F.current){const U=F.current.getBoundingClientRect(),V=uA().scaleExtent([_,k]).translateExtent(w),B=vr(F.current).call(V),Y=Us.translate(y.x,y.y).scale(sl(y.zoom,_,k)),ue=[[0,0],[U.width,U.height]],G=V.constrain()(Y,ue,w);V.transform(B,G),V.wheelDelta(X1),R.setState({d3Zoom:V,d3Selection:B,d3ZoomHandler:B.on("wheel.zoom"),transform:[G.x,G.y,G.k],domNode:F.current.closest(".react-flow")})}},[]),x.useEffect(()=>{K&&H&&(c&&!Z&&!I?K.on("wheel.zoom",U=>{if(Li(U,E))return!1;U.preventDefault(),U.stopImmediatePropagation();const V=K.property("__zoom").k||1;if(U.ctrlKey&&l){const ne=Br(U),ie=X1(U),me=V*Math.pow(2,ie);H.scaleTo(K,me,ne,U);return}const B=U.deltaMode===1?20:1;let Y=f===Io.Vertical?0:U.deltaX*B,ue=f===Io.Horizontal?0:U.deltaY*B;!lh()&&U.shiftKey&&f!==Io.Vertical&&(Y=U.deltaY*B,ue=0),H.translateBy(K,-(Y/V)*u,-(ue/V)*u,{internal:!0});const G=Td(K.property("__zoom")),{onViewportChangeStart:ee,onViewportChange:L,onViewportChangeEnd:te}=R.getState();clearTimeout(z.current),$.current||($.current=!0,t==null||t(U,G),ee==null||ee(G)),$.current&&(e==null||e(U,G),L==null||L(G),z.current=setTimeout(()=>{n==null||n(U,G),te==null||te(G),$.current=!1},150))},{passive:!1}):typeof X<"u"&&K.on("wheel.zoom",function(U,V){if(!b&&U.type==="wheel"&&!U.ctrlKey||Li(U,E))return null;U.preventDefault(),X.call(this,U,V)},{passive:!1}))},[I,c,f,K,H,X,Z,l,b,E,t,e,n]),x.useEffect(()=>{H&&H.on("start",U=>{var Y,ue;if(!U.sourceEvent||U.sourceEvent.internal)return null;W.current=(Y=U.sourceEvent)==null?void 0:Y.button;const{onViewportChangeStart:V}=R.getState(),B=Td(U.transform);A.current=!0,O.current=B,((ue=U.sourceEvent)==null?void 0:ue.type)==="mousedown"&&R.setState({paneDragging:!0}),V==null||V(B),t==null||t(U.sourceEvent,B)})},[H,t]),x.useEffect(()=>{H&&(I&&!A.current?H.on("zoom",null):I||H.on("zoom",U=>{var B;const{onViewportChange:V}=R.getState();if(R.setState({transform:[U.transform.x,U.transform.y,U.transform.k]}),q.current=!!(r&&Y1(m,W.current??0)),(e||V)&&!((B=U.sourceEvent)!=null&&B.internal)){const Y=Td(U.transform);V==null||V(Y),e==null||e(U.sourceEvent,Y)}}))},[I,H,e,m,r]),x.useEffect(()=>{H&&H.on("end",U=>{if(!U.sourceEvent||U.sourceEvent.internal)return null;const{onViewportChangeEnd:V}=R.getState();if(A.current=!1,R.setState({paneDragging:!1}),r&&Y1(m,W.current??0)&&!q.current&&r(U.sourceEvent),q.current=!1,(n||V)&&v4(O.current,U.transform)){const B=Td(U.transform);O.current=B,clearTimeout(T.current),T.current=setTimeout(()=>{V==null||V(B),n==null||n(U.sourceEvent,B)},c?150:0)}})},[H,c,m,n,r]),x.useEffect(()=>{H&&H.filter(U=>{const V=Z||a,B=l&&U.ctrlKey;if((m===!0||Array.isArray(m)&&m.includes(1))&&U.button===1&&U.type==="mousedown"&&(Li(U,"react-flow__node")||Li(U,"react-flow__edge")))return!0;if(!m&&!V&&!c&&!p&&!l||I||!p&&U.type==="dblclick"||Li(U,E)&&U.type==="wheel"||Li(U,C)&&(U.type!=="wheel"||c&&U.type==="wheel"&&!Z)||!l&&U.ctrlKey&&U.type==="wheel"||!V&&!c&&!B&&U.type==="wheel"||!m&&(U.type==="mousedown"||U.type==="touchstart")||Array.isArray(m)&&!m.includes(U.button)&&U.type==="mousedown")return!1;const Y=Array.isArray(m)&&m.includes(U.button)||!U.button||U.button<=1;return(!U.ctrlKey||U.type==="wheel")&&Y})},[I,H,a,l,c,p,m,h,Z]),pe.createElement("div",{className:"react-flow__renderer",ref:F,style:O0},S)},k4=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function N4(){const{userSelectionActive:e,userSelectionRect:t}=xt(k4,rn);return e&&t?pe.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 Z1(e,t){const n=t.parentNode||t.parentId,r=e.find(a=>a.id===n);if(r){const a=t.position.x+t.width-r.width,l=t.position.y+t.height-r.height;if(a>0||l>0||t.position.x<0||t.position.y<0){if(r.style={...r.style},r.style.width=r.style.width??r.width,r.style.height=r.style.height??r.height,a>0&&(r.style.width+=a),l>0&&(r.style.height+=l),t.position.x<0){const c=Math.abs(t.position.x);r.position.x=r.position.x-c,r.style.width+=c,t.position.x=0}if(t.position.y<0){const c=Math.abs(t.position.y);r.position.y=r.position.y-c,r.style.height+=c,t.position.y=0}r.width=r.style.width,r.height=r.style.height}}}function _4(e,t){if(e.some(r=>r.type==="reset"))return e.filter(r=>r.type==="reset").map(r=>r.item);const n=e.filter(r=>r.type==="add").map(r=>r.item);return t.reduce((r,a)=>{const l=e.filter(u=>u.id===a.id);if(l.length===0)return r.push(a),r;const c={...a};for(const u of l)if(u)switch(u.type){case"select":{c.selected=u.selected;break}case"position":{typeof u.position<"u"&&(c.position=u.position),typeof u.positionAbsolute<"u"&&(c.positionAbsolute=u.positionAbsolute),typeof u.dragging<"u"&&(c.dragging=u.dragging),c.expandParent&&Z1(r,c);break}case"dimensions":{typeof u.dimensions<"u"&&(c.width=u.dimensions.width,c.height=u.dimensions.height),typeof u.updateStyle<"u"&&(c.style={...c.style||{},...u.dimensions}),typeof u.resizing=="boolean"&&(c.resizing=u.resizing),c.expandParent&&Z1(r,c);break}case"remove":return r}return r.push(c),r},n)}function S4(e,t){return _4(e,t)}const Ma=(e,t)=>({id:e,type:"select",selected:t});function Vi(e,t){return e.reduce((n,r)=>{const a=t.includes(r.id);return!r.selected&&a?(r.selected=!0,n.push(Ma(r.id,!0))):r.selected&&!a&&(r.selected=!1,n.push(Ma(r.id,!1))),n},[])}const Lp=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},j4=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),qA=x.memo(({isSelecting:e,selectionMode:t=Hc.Full,panOnDrag:n,onSelectionStart:r,onSelectionEnd:a,onPaneClick:l,onPaneContextMenu:c,onPaneScroll:u,onPaneMouseEnter:f,onPaneMouseMove:p,onPaneMouseLeave:h,children:m})=>{const y=x.useRef(null),w=Vt(),_=x.useRef(0),k=x.useRef(0),j=x.useRef(),{userSelectionActive:b,elementsSelectable:S,dragging:E}=xt(j4,rn),C=()=>{w.setState({userSelectionActive:!1,userSelectionRect:null}),_.current=0,k.current=0},T=X=>{l==null||l(X),w.getState().resetSelectedElements(),w.setState({nodesSelectionActive:!1})},R=X=>{if(Array.isArray(n)&&(n!=null&&n.includes(2))){X.preventDefault();return}c==null||c(X)},A=u?X=>u(X):void 0,q=X=>{const{resetSelectedElements:I,domNode:Z}=w.getState();if(j.current=Z==null?void 0:Z.getBoundingClientRect(),!S||!e||X.button!==0||X.target!==y.current||!j.current)return;const{x:W,y:$}=Pa(X,j.current);I(),w.setState({userSelectionRect:{width:0,height:0,startX:W,startY:$,x:W,y:$}}),r==null||r(X)},F=X=>{const{userSelectionRect:I,nodeInternals:Z,edges:W,transform:$,onNodesChange:z,onEdgesChange:U,nodeOrigin:V,getNodes:B}=w.getState();if(!e||!j.current||!I)return;w.setState({userSelectionActive:!0,nodesSelectionActive:!1});const Y=Pa(X,j.current),ue=I.startX??0,G=I.startY??0,ee={...I,x:Y.x<ue?Y.x:ue,y:Y.y<G?Y.y:G,width:Math.abs(Y.x-ue),height:Math.abs(Y.y-G)},L=B(),te=kA(Z,ee,$,t===Hc.Partial,!0,V),ne=NA(te,W).map(me=>me.id),ie=te.map(me=>me.id);if(_.current!==ie.length){_.current=ie.length;const me=Vi(L,ie);me.length&&(z==null||z(me))}if(k.current!==ne.length){k.current=ne.length;const me=Vi(W,ne);me.length&&(U==null||U(me))}w.setState({userSelectionRect:ee})},O=X=>{if(X.button!==0)return;const{userSelectionRect:I}=w.getState();!b&&I&&X.target===y.current&&(T==null||T(X)),w.setState({nodesSelectionActive:_.current>0}),C(),a==null||a(X)},H=X=>{b&&(w.setState({nodesSelectionActive:_.current>0}),a==null||a(X)),C()},K=S&&(e||b);return pe.createElement("div",{className:mn(["react-flow__pane",{dragging:E,selection:e}]),onClick:K?void 0:Lp(T,y),onContextMenu:Lp(R,y),onWheel:Lp(A,y),onMouseEnter:K?void 0:f,onMouseDown:K?q:void 0,onMouseMove:K?F:p,onMouseUp:K?O:void 0,onMouseLeave:K?H:h,ref:y,style:O0},m,pe.createElement(N4,null))});qA.displayName="Pane";function BA(e,t){const n=e.parentNode||e.parentId;if(!n)return!1;const r=t.get(n);return r?r.selected?!0:BA(r,t):!1}function Q1(e,t,n){let r=e;do{if(r!=null&&r.matches(t))return!0;if(r===n.current)return!1;r=r.parentElement}while(r);return!1}function E4(e,t,n,r){return Array.from(e.values()).filter(a=>(a.selected||a.id===r)&&(!a.parentNode||a.parentId||!BA(a,e))&&(a.draggable||t&&typeof a.draggable>"u")).map(a=>{var l,c;return{id:a.id,position:a.position||{x:0,y:0},positionAbsolute:a.positionAbsolute||{x:0,y:0},distance:{x:n.x-(((l=a.positionAbsolute)==null?void 0:l.x)??0),y:n.y-(((c=a.positionAbsolute)==null?void 0:c.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 C4(e,t){return!t||t==="parent"?t:[t[0],[t[1][0]-(e.width||0),t[1][1]-(e.height||0)]]}function zA(e,t,n,r,a=[0,0],l){const c=C4(e,e.extent||r);let u=c;const f=e.parentNode||e.parentId;if(e.extent==="parent"&&!e.expandParent)if(f&&e.width&&e.height){const m=n.get(f),{x:y,y:w}=Lo(m,a).positionAbsolute;u=m&&xr(y)&&xr(w)&&xr(m.width)&&xr(m.height)?[[y+e.width*a[0],w+e.height*a[1]],[y+m.width-e.width+e.width*a[0],w+m.height-e.height+e.height*a[1]]]:u}else l==null||l("005",Vs.error005()),u=c;else if(e.extent&&f&&e.extent!=="parent"){const m=n.get(f),{x:y,y:w}=Lo(m,a).positionAbsolute;u=[[e.extent[0][0]+y,e.extent[0][1]+w],[e.extent[1][0]+y,e.extent[1][1]+w]]}let p={x:0,y:0};if(f){const m=n.get(f);p=Lo(m,a).positionAbsolute}const h=u&&u!=="parent"?E0(t,u):t;return{position:{x:h.x-p.x,y:h.y-p.y},positionAbsolute:h}}function Pp({nodeId:e,dragItems:t,nodeInternals:n}){const r=t.map(a=>({...n.get(a.id),position:a.position,positionAbsolute:a.positionAbsolute}));return[e?r.find(a=>a.id===e):r[0],r]}const J1=(e,t,n,r)=>{const a=t.querySelectorAll(e);if(!a||!a.length)return null;const l=Array.from(a),c=t.getBoundingClientRect(),u={x:c.width*r[0],y:c.height*r[1]};return l.map(f=>{const p=f.getBoundingClientRect();return{id:f.getAttribute("data-handleid"),position:f.getAttribute("data-handlepos"),x:(p.left-c.left-u.x)/n,y:(p.top-c.top-u.y)/n,...j0(f)}})};function vc(e,t,n){return n===void 0?n:r=>{const a=t().nodeInternals.get(e);a&&n(r,{...a})}}function Wx({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:a,unselectNodesAndEdges:l,multiSelectionActive:c,nodeInternals:u,onError:f}=t.getState(),p=u.get(e);if(!p){f==null||f("012",Vs.error012(e));return}t.setState({nodesSelectionActive:!1}),p.selected?(n||p.selected&&c)&&(l({nodes:[p],edges:[]}),requestAnimationFrame(()=>{var h;return(h=r==null?void 0:r.current)==null?void 0:h.blur()})):a([e])}function T4(){const e=Vt();return x.useCallback(({sourceEvent:n})=>{const{transform:r,snapGrid:a,snapToGrid:l}=e.getState(),c=n.touches?n.touches[0].clientX:n.clientX,u=n.touches?n.touches[0].clientY:n.clientY,f={x:(c-r[0])/r[2],y:(u-r[1])/r[2]};return{xSnapped:l?a[0]*Math.round(f.x/a[0]):f.x,ySnapped:l?a[1]*Math.round(f.y/a[1]):f.y,...f}},[])}function Dp(e){return(t,n,r)=>e==null?void 0:e(t,r)}function HA({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:a,isSelectable:l,selectNodesOnDrag:c}){const u=Vt(),[f,p]=x.useState(!1),h=x.useRef([]),m=x.useRef({x:null,y:null}),y=x.useRef(0),w=x.useRef(null),_=x.useRef({x:0,y:0}),k=x.useRef(null),j=x.useRef(!1),b=x.useRef(!1),S=x.useRef(!1),E=T4();return x.useEffect(()=>{if(e!=null&&e.current){const C=vr(e.current),T=({x:q,y:F})=>{const{nodeInternals:O,onNodeDrag:H,onSelectionDrag:K,updateNodePositions:X,nodeExtent:I,snapGrid:Z,snapToGrid:W,nodeOrigin:$,onError:z}=u.getState();m.current={x:q,y:F};let U=!1,V={x:0,y:0,x2:0,y2:0};if(h.current.length>1&&I){const Y=Mh(h.current,$);V=zc(Y)}if(h.current=h.current.map(Y=>{const ue={x:q-Y.distance.x,y:F-Y.distance.y};W&&(ue.x=Z[0]*Math.round(ue.x/Z[0]),ue.y=Z[1]*Math.round(ue.y/Z[1]));const G=[[I[0][0],I[0][1]],[I[1][0],I[1][1]]];h.current.length>1&&I&&!Y.extent&&(G[0][0]=Y.positionAbsolute.x-V.x+I[0][0],G[1][0]=Y.positionAbsolute.x+(Y.width??0)-V.x2+I[1][0],G[0][1]=Y.positionAbsolute.y-V.y+I[0][1],G[1][1]=Y.positionAbsolute.y+(Y.height??0)-V.y2+I[1][1]);const ee=zA(Y,ue,O,G,$,z);return U=U||Y.position.x!==ee.position.x||Y.position.y!==ee.position.y,Y.position=ee.position,Y.positionAbsolute=ee.positionAbsolute,Y}),!U)return;X(h.current,!0,!0),p(!0);const B=a?H:Dp(K);if(B&&k.current){const[Y,ue]=Pp({nodeId:a,dragItems:h.current,nodeInternals:O});B(k.current,Y,ue)}},R=()=>{if(!w.current)return;const[q,F]=hA(_.current,w.current);if(q!==0||F!==0){const{transform:O,panBy:H}=u.getState();m.current.x=(m.current.x??0)-q/O[2],m.current.y=(m.current.y??0)-F/O[2],H({x:q,y:F})&&T(m.current)}y.current=requestAnimationFrame(R)},A=q=>{var $;const{nodeInternals:F,multiSelectionActive:O,nodesDraggable:H,unselectNodesAndEdges:K,onNodeDragStart:X,onSelectionDragStart:I}=u.getState();b.current=!0;const Z=a?X:Dp(I);(!c||!l)&&!O&&a&&(($=F.get(a))!=null&&$.selected||K()),a&&l&&c&&Wx({id:a,store:u,nodeRef:e});const W=E(q);if(m.current=W,h.current=E4(F,H,W,a),Z&&h.current){const[z,U]=Pp({nodeId:a,dragItems:h.current,nodeInternals:F});Z(q.sourceEvent,z,U)}};if(t)C.on(".drag",null);else{const q=F3().on("start",F=>{const{domNode:O,nodeDragThreshold:H}=u.getState();H===0&&A(F),S.current=!1;const K=E(F);m.current=K,w.current=(O==null?void 0:O.getBoundingClientRect())||null,_.current=Pa(F.sourceEvent,w.current)}).on("drag",F=>{var X,I;const O=E(F),{autoPanOnNodeDrag:H,nodeDragThreshold:K}=u.getState();if(F.sourceEvent.type==="touchmove"&&F.sourceEvent.touches.length>1&&(S.current=!0),!S.current){if(!j.current&&b.current&&H&&(j.current=!0,R()),!b.current){const Z=O.xSnapped-(((X=m==null?void 0:m.current)==null?void 0:X.x)??0),W=O.ySnapped-(((I=m==null?void 0:m.current)==null?void 0:I.y)??0);Math.sqrt(Z*Z+W*W)>K&&A(F)}(m.current.x!==O.xSnapped||m.current.y!==O.ySnapped)&&h.current&&b.current&&(k.current=F.sourceEvent,_.current=Pa(F.sourceEvent,w.current),T(O))}}).on("end",F=>{if(!(!b.current||S.current)&&(p(!1),j.current=!1,b.current=!1,cancelAnimationFrame(y.current),h.current)){const{updateNodePositions:O,nodeInternals:H,onNodeDragStop:K,onSelectionDragStop:X}=u.getState(),I=a?K:Dp(X);if(O(h.current,!1,!1),I){const[Z,W]=Pp({nodeId:a,dragItems:h.current,nodeInternals:H});I(F.sourceEvent,Z,W)}}}).filter(F=>{const O=F.target;return!F.button&&(!n||!Q1(O,`.${n}`,e))&&(!r||Q1(O,r,e))});return C.call(q),()=>{C.on(".drag",null)}}}},[e,t,n,r,l,u,a,c,E]),f}function UA(){const e=Vt();return x.useCallback(n=>{const{nodeInternals:r,nodeExtent:a,updateNodePositions:l,getNodes:c,snapToGrid:u,snapGrid:f,onError:p,nodesDraggable:h}=e.getState(),m=c().filter(S=>S.selected&&(S.draggable||h&&typeof S.draggable>"u")),y=u?f[0]:5,w=u?f[1]:5,_=n.isShiftPressed?4:1,k=n.x*y*_,j=n.y*w*_,b=m.map(S=>{if(S.positionAbsolute){const E={x:S.positionAbsolute.x+k,y:S.positionAbsolute.y+j};u&&(E.x=f[0]*Math.round(E.x/f[0]),E.y=f[1]*Math.round(E.y/f[1]));const{positionAbsolute:C,position:T}=zA(S,E,r,a,void 0,p);S.position=T,S.positionAbsolute=C}return S});l(b,!0,!1)},[])}const Ji={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var xc=e=>{const t=({id:n,type:r,data:a,xPos:l,yPos:c,xPosOrigin:u,yPosOrigin:f,selected:p,onClick:h,onMouseEnter:m,onMouseMove:y,onMouseLeave:w,onContextMenu:_,onDoubleClick:k,style:j,className:b,isDraggable:S,isSelectable:E,isConnectable:C,isFocusable:T,selectNodesOnDrag:R,sourcePosition:A,targetPosition:q,hidden:F,resizeObserver:O,dragHandle:H,zIndex:K,isParent:X,noDragClassName:I,noPanClassName:Z,initialized:W,disableKeyboardA11y:$,ariaLabel:z,rfId:U,hasHandleBounds:V})=>{const B=Vt(),Y=x.useRef(null),ue=x.useRef(null),G=x.useRef(A),ee=x.useRef(q),L=x.useRef(r),te=E||S||h||m||y||w,ne=UA(),ie=vc(n,B.getState,m),me=vc(n,B.getState,y),je=vc(n,B.getState,w),Oe=vc(n,B.getState,_),Ve=vc(n,B.getState,k),Le=_e=>{const{nodeDragThreshold:Se}=B.getState();if(E&&(!R||!S||Se>0)&&Wx({id:n,store:B,nodeRef:Y}),h){const Xe=B.getState().nodeInternals.get(n);Xe&&h(_e,{...Xe})}},Te=_e=>{if(!qx(_e)&&!$)if(gA.includes(_e.key)&&E){const Se=_e.key==="Escape";Wx({id:n,store:B,unselect:Se,nodeRef:Y})}else S&&p&&Object.prototype.hasOwnProperty.call(Ji,_e.key)&&(B.setState({ariaLiveMessage:`Moved selected node ${_e.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~l}, y: ${~~c}`}),ne({x:Ji[_e.key].x,y:Ji[_e.key].y,isShiftPressed:_e.shiftKey}))};x.useEffect(()=>()=>{ue.current&&(O==null||O.unobserve(ue.current),ue.current=null)},[]),x.useEffect(()=>{if(Y.current&&!F){const _e=Y.current;(!W||!V||ue.current!==_e)&&(ue.current&&(O==null||O.unobserve(ue.current)),O==null||O.observe(_e),ue.current=_e)}},[F,W,V]),x.useEffect(()=>{const _e=L.current!==r,Se=G.current!==A,Xe=ee.current!==q;Y.current&&(_e||Se||Xe)&&(_e&&(L.current=r),Se&&(G.current=A),Xe&&(ee.current=q),B.getState().updateNodeDimensions([{id:n,nodeElement:Y.current,forceUpdate:!0}]))},[n,r,A,q]);const nt=HA({nodeRef:Y,disabled:F||!S,noDragClassName:I,handleSelector:H,nodeId:n,isSelectable:E,selectNodesOnDrag:R});return F?null:pe.createElement("div",{className:mn(["react-flow__node",`react-flow__node-${r}`,{[Z]:S},b,{selected:p,selectable:E,parent:X,dragging:nt}]),ref:Y,style:{zIndex:K,transform:`translate(${u}px,${f}px)`,pointerEvents:te?"all":"none",visibility:W?"visible":"hidden",...j},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:ie,onMouseMove:me,onMouseLeave:je,onContextMenu:Oe,onClick:Le,onDoubleClick:Ve,onKeyDown:T?Te:void 0,tabIndex:T?0:void 0,role:T?"button":void 0,"aria-describedby":$?void 0:`${OA}-${U}`,"aria-label":z},pe.createElement(zP,{value:n},pe.createElement(e,{id:n,data:a,type:r,xPos:l,yPos:c,selected:p,isConnectable:C,sourcePosition:A,targetPosition:q,dragging:nt,dragHandle:H,zIndex:K})))};return t.displayName="NodeWrapper",x.memo(t)};const A4=e=>{const t=e.getNodes().filter(n=>n.selected);return{...Mh(t,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};function R4({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=Vt(),{width:a,height:l,x:c,y:u,transformString:f,userSelectionActive:p}=xt(A4,rn),h=UA(),m=x.useRef(null);if(x.useEffect(()=>{var _;n||(_=m.current)==null||_.focus({preventScroll:!0})},[n]),HA({nodeRef:m}),p||!a||!l)return null;const y=e?_=>{const k=r.getState().getNodes().filter(j=>j.selected);e(_,k)}:void 0,w=_=>{Object.prototype.hasOwnProperty.call(Ji,_.key)&&h({x:Ji[_.key].x,y:Ji[_.key].y,isShiftPressed:_.shiftKey})};return pe.createElement("div",{className:mn(["react-flow__nodesselection","react-flow__container",t]),style:{transform:f}},pe.createElement("div",{ref:m,className:"react-flow__nodesselection-rect",onContextMenu:y,tabIndex:n?void 0:-1,onKeyDown:n?void 0:w,style:{width:a,height:l,top:u,left:c}}))}var M4=x.memo(R4);const I4=e=>e.nodesSelectionActive,WA=({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:a,onPaneContextMenu:l,onPaneScroll:c,deleteKeyCode:u,onMove:f,onMoveStart:p,onMoveEnd:h,selectionKeyCode:m,selectionOnDrag:y,selectionMode:w,onSelectionStart:_,onSelectionEnd:k,multiSelectionKeyCode:j,panActivationKeyCode:b,zoomActivationKeyCode:S,elementsSelectable:E,zoomOnScroll:C,zoomOnPinch:T,panOnScroll:R,panOnScrollSpeed:A,panOnScrollMode:q,zoomOnDoubleClick:F,panOnDrag:O,defaultViewport:H,translateExtent:K,minZoom:X,maxZoom:I,preventScrolling:Z,onSelectionContextMenu:W,noWheelClassName:$,noPanClassName:z,disableKeyboardA11y:U})=>{const V=xt(I4),B=Uc(m),Y=Uc(b),ue=Y||O,G=Y||R,ee=B||y&&ue!==!0;return y4({deleteKeyCode:u,multiSelectionKeyCode:j}),pe.createElement(b4,{onMove:f,onMoveStart:p,onMoveEnd:h,onPaneContextMenu:l,elementsSelectable:E,zoomOnScroll:C,zoomOnPinch:T,panOnScroll:G,panOnScrollSpeed:A,panOnScrollMode:q,zoomOnDoubleClick:F,panOnDrag:!B&&ue,defaultViewport:H,translateExtent:K,minZoom:X,maxZoom:I,zoomActivationKeyCode:S,preventScrolling:Z,noWheelClassName:$,noPanClassName:z},pe.createElement(qA,{onSelectionStart:_,onSelectionEnd:k,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:a,onPaneContextMenu:l,onPaneScroll:c,panOnDrag:ue,isSelecting:!!ee,selectionMode:w},e,V&&pe.createElement(M4,{onSelectionContextMenu:W,noPanClassName:z,disableKeyboardA11y:U})))};WA.displayName="FlowRenderer";var $4=x.memo(WA);function O4(e){return xt(x.useCallback(n=>e?kA(n.nodeInternals,{x:0,y:0,width:n.width,height:n.height},n.transform,!0):n.getNodes(),[e]))}function L4(e){const t={input:xc(e.input||RA),default:xc(e.default||Ux),output:xc(e.output||IA),group:xc(e.group||$0)},n={},r=Object.keys(e).filter(a=>!["input","default","output","group"].includes(a)).reduce((a,l)=>(a[l]=xc(e[l]||Ux),a),n);return{...t,...r}}const P4=({x:e,y:t,width:n,height:r,origin:a})=>!n||!r?{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-r*a[1]},D4=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),VA=e=>{const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:a,updateNodeDimensions:l,onError:c}=xt(D4,rn),u=O4(e.onlyRenderVisibleElements),f=x.useRef(),p=x.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const h=new ResizeObserver(m=>{const y=m.map(w=>({id:w.target.getAttribute("data-id"),nodeElement:w.target,forceUpdate:!0}));l(y)});return f.current=h,h},[]);return x.useEffect(()=>()=>{var h;(h=f==null?void 0:f.current)==null||h.disconnect()},[]),pe.createElement("div",{className:"react-flow__nodes",style:O0},u.map(h=>{var T,R,A;let m=h.type||"default";e.nodeTypes[m]||(c==null||c("003",Vs.error003(m)),m="default");const y=e.nodeTypes[m]||e.nodeTypes.default,w=!!(h.draggable||t&&typeof h.draggable>"u"),_=!!(h.selectable||a&&typeof h.selectable>"u"),k=!!(h.connectable||n&&typeof h.connectable>"u"),j=!!(h.focusable||r&&typeof h.focusable>"u"),b=e.nodeExtent?E0(h.positionAbsolute,e.nodeExtent):h.positionAbsolute,S=(b==null?void 0:b.x)??0,E=(b==null?void 0:b.y)??0,C=P4({x:S,y:E,width:h.width??0,height:h.height??0,origin:e.nodeOrigin});return pe.createElement(y,{key:h.id,id:h.id,className:h.className,style:h.style,type:m,data:h.data,sourcePosition:h.sourcePosition||Ke.Bottom,targetPosition:h.targetPosition||Ke.Top,hidden:h.hidden,xPos:S,yPos:E,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:_,isConnectable:k,isFocusable:j,resizeObserver:p,dragHandle:h.dragHandle,zIndex:((T=h[Ft])==null?void 0:T.z)??0,isParent:!!((R=h[Ft])!=null&&R.isParent),noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!h.width&&!!h.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:h.ariaLabel,hasHandleBounds:!!((A=h[Ft])!=null&&A.handleBounds)})}))};VA.displayName="NodeRenderer";var F4=x.memo(VA);const q4=(e,t,n)=>n===Ke.Left?e-t:n===Ke.Right?e+t:e,B4=(e,t,n)=>n===Ke.Top?e-t:n===Ke.Bottom?e+t:e,eN="react-flow__edgeupdater",tN=({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:a,onMouseEnter:l,onMouseOut:c,type:u})=>pe.createElement("circle",{onMouseDown:a,onMouseEnter:l,onMouseOut:c,className:mn([eN,`${eN}-${u}`]),cx:q4(t,r,e),cy:B4(n,r,e),r,stroke:"transparent",fill:"transparent"}),z4=()=>!0;var Pi=e=>{const t=({id:n,className:r,type:a,data:l,onClick:c,onEdgeDoubleClick:u,selected:f,animated:p,label:h,labelStyle:m,labelShowBg:y,labelBgStyle:w,labelBgPadding:_,labelBgBorderRadius:k,style:j,source:b,target:S,sourceX:E,sourceY:C,targetX:T,targetY:R,sourcePosition:A,targetPosition:q,elementsSelectable:F,hidden:O,sourceHandleId:H,targetHandleId:K,onContextMenu:X,onMouseEnter:I,onMouseMove:Z,onMouseLeave:W,reconnectRadius:$,onReconnect:z,onReconnectStart:U,onReconnectEnd:V,markerEnd:B,markerStart:Y,rfId:ue,ariaLabel:G,isFocusable:ee,isReconnectable:L,pathOptions:te,interactionWidth:ne,disableKeyboardA11y:ie})=>{const me=x.useRef(null),[je,Oe]=x.useState(!1),[Ve,Le]=x.useState(!1),Te=Vt(),nt=x.useMemo(()=>`url('#${zx(Y,ue)}')`,[Y,ue]),_e=x.useMemo(()=>`url('#${zx(B,ue)}')`,[B,ue]);if(O)return null;const Se=Ue=>{var jt;const{edges:pt,addSelectedEdges:he,unselectNodesAndEdges:mt,multiSelectionActive:qt}=Te.getState(),Tt=pt.find(dn=>dn.id===n);Tt&&(F&&(Te.setState({nodesSelectionActive:!1}),Tt.selected&&qt?(mt({nodes:[],edges:[Tt]}),(jt=me.current)==null||jt.blur()):he([n])),c&&c(Ue,Tt))},Xe=wc(n,Te.getState,u),ot=wc(n,Te.getState,X),$e=wc(n,Te.getState,I),oe=wc(n,Te.getState,Z),ye=wc(n,Te.getState,W),Ce=(Ue,pt)=>{if(Ue.button!==0)return;const{edges:he,isValidConnection:mt}=Te.getState(),qt=pt?S:b,Tt=(pt?K:H)||null,jt=pt?"target":"source",dn=mt||z4,Sn=pt,Kt=he.find(ht=>ht.id===n);Le(!0),U==null||U(Ue,Kt,jt);const an=ht=>{Le(!1),V==null||V(ht,Kt,jt)};EA({event:Ue,handleId:Tt,nodeId:qt,onConnect:ht=>z==null?void 0:z(Kt,ht),isTarget:Sn,getState:Te.getState,setState:Te.setState,isValidConnection:dn,edgeUpdaterType:jt,onReconnectEnd:an})},De=Ue=>Ce(Ue,!0),qe=Ue=>Ce(Ue,!1),rt=()=>Oe(!0),et=()=>Oe(!1),ve=!F&&!c,Re=Ue=>{var pt;if(!ie&&gA.includes(Ue.key)&&F){const{unselectNodesAndEdges:he,addSelectedEdges:mt,edges:qt}=Te.getState();Ue.key==="Escape"?((pt=me.current)==null||pt.blur(),he({edges:[qt.find(jt=>jt.id===n)]})):mt([n])}};return pe.createElement("g",{className:mn(["react-flow__edge",`react-flow__edge-${a}`,r,{selected:f,animated:p,inactive:ve,updating:je}]),onClick:Se,onDoubleClick:Xe,onContextMenu:ot,onMouseEnter:$e,onMouseMove:oe,onMouseLeave:ye,onKeyDown:ee?Re:void 0,tabIndex:ee?0:void 0,role:ee?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":G===null?void 0:G||`Edge from ${b} to ${S}`,"aria-describedby":ee?`${LA}-${ue}`:void 0,ref:me},!Ve&&pe.createElement(e,{id:n,source:b,target:S,selected:f,animated:p,label:h,labelStyle:m,labelShowBg:y,labelBgStyle:w,labelBgPadding:_,labelBgBorderRadius:k,data:l,style:j,sourceX:E,sourceY:C,targetX:T,targetY:R,sourcePosition:A,targetPosition:q,sourceHandleId:H,targetHandleId:K,markerStart:nt,markerEnd:_e,pathOptions:te,interactionWidth:ne}),L&&pe.createElement(pe.Fragment,null,(L==="source"||L===!0)&&pe.createElement(tN,{position:A,centerX:E,centerY:C,radius:$,onMouseDown:De,onMouseEnter:rt,onMouseOut:et,type:"source"}),(L==="target"||L===!0)&&pe.createElement(tN,{position:q,centerX:T,centerY:R,radius:$,onMouseDown:qe,onMouseEnter:rt,onMouseOut:et,type:"target"})))};return t.displayName="EdgeWrapper",x.memo(t)};function H4(e){const t={default:Pi(e.default||uh),straight:Pi(e.bezier||A0),step:Pi(e.step||T0),smoothstep:Pi(e.step||Rh),simplebezier:Pi(e.simplebezier||C0)},n={},r=Object.keys(e).filter(a=>!["default","bezier"].includes(a)).reduce((a,l)=>(a[l]=Pi(e[l]||uh),a),n);return{...t,...r}}function nN(e,t,n=null){const r=((n==null?void 0:n.x)||0)+t.x,a=((n==null?void 0:n.y)||0)+t.y,l=(n==null?void 0:n.width)||t.width,c=(n==null?void 0:n.height)||t.height;switch(e){case Ke.Top:return{x:r+l/2,y:a};case Ke.Right:return{x:r+l,y:a+c/2};case Ke.Bottom:return{x:r+l/2,y:a+c};case Ke.Left:return{x:r,y:a+c/2}}}function rN(e,t){return e?e.length===1||!t?e[0]:t&&e.find(n=>n.id===t)||null:null}const U4=(e,t,n,r,a,l)=>{const c=nN(n,e,t),u=nN(l,r,a);return{sourceX:c.x,sourceY:c.y,targetX:u.x,targetY:u.y}};function W4({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:r,targetWidth:a,targetHeight:l,width:c,height:u,transform:f}){const p={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+n,t.x+a),y2:Math.max(e.y+r,t.y+l)};p.x===p.x2&&(p.x2+=1),p.y===p.y2&&(p.y2+=1);const h=zc({x:(0-f[0])/f[2],y:(0-f[1])/f[2],width:c/f[2],height:u/f[2]}),m=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(m*y)>0}function sN(e){var r,a,l,c,u;const t=((r=e==null?void 0:e[Ft])==null?void 0:r.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((l=e==null?void 0:e.positionAbsolute)==null?void 0:l.y)<"u";return[{x:((c=e==null?void 0:e.positionAbsolute)==null?void 0:c.x)||0,y:((u=e==null?void 0:e.positionAbsolute)==null?void 0:u.y)||0,width:(e==null?void 0:e.width)||0,height:(e==null?void 0:e.height)||0},t,!!n]}const V4=[{level:0,isMaxLevel:!0,edges:[]}];function G4(e,t,n=!1){let r=-1;const a=e.reduce((c,u)=>{var h,m;const f=xr(u.zIndex);let p=f?u.zIndex:0;if(n){const y=t.get(u.target),w=t.get(u.source),_=u.selected||(y==null?void 0:y.selected)||(w==null?void 0:w.selected),k=Math.max(((h=w==null?void 0:w[Ft])==null?void 0:h.z)||0,((m=y==null?void 0:y[Ft])==null?void 0:m.z)||0,1e3);p=(f?u.zIndex:0)+(_?k:0)}return c[p]?c[p].push(u):c[p]=[u],r=p>r?p:r,c},{}),l=Object.entries(a).map(([c,u])=>{const f=+c;return{edges:u,level:f,isMaxLevel:f===r}});return l.length===0?V4:l}function K4(e,t,n){const r=xt(x.useCallback(a=>e?a.edges.filter(l=>{const c=t.get(l.source),u=t.get(l.target);return(c==null?void 0:c.width)&&(c==null?void 0:c.height)&&(u==null?void 0:u.width)&&(u==null?void 0:u.height)&&W4({sourcePos:c.positionAbsolute||{x:0,y:0},targetPos:u.positionAbsolute||{x:0,y:0},sourceWidth:c.width,sourceHeight:c.height,targetWidth:u.width,targetHeight:u.height,width:a.width,height:a.height,transform:a.transform})}):a.edges,[e,t]));return G4(r,t,n)}const Y4=({color:e="none",strokeWidth:t=1})=>pe.createElement("polyline",{style:{stroke:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),X4=({color:e="none",strokeWidth:t=1})=>pe.createElement("polyline",{style:{stroke:e,fill:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),aN={[ch.Arrow]:Y4,[ch.ArrowClosed]:X4};function Z4(e){const t=Vt();return x.useMemo(()=>{var a,l;return Object.prototype.hasOwnProperty.call(aN,e)?aN[e]:((l=(a=t.getState()).onError)==null||l.call(a,"009",Vs.error009(e)),null)},[e])}const Q4=({id:e,type:t,color:n,width:r=12.5,height:a=12.5,markerUnits:l="strokeWidth",strokeWidth:c,orient:u="auto-start-reverse"})=>{const f=Z4(t);return f?pe.createElement("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${a}`,viewBox:"-10 -10 20 20",markerUnits:l,orient:u,refX:"0",refY:"0"},pe.createElement(f,{color:n,strokeWidth:c})):null},J4=({defaultColor:e,rfId:t})=>n=>{const r=[];return n.edges.reduce((a,l)=>([l.markerStart,l.markerEnd].forEach(c=>{if(c&&typeof c=="object"){const u=zx(c,t);r.includes(u)||(a.push({id:u,color:c.color||e,...c}),r.push(u))}}),a),[]).sort((a,l)=>a.id.localeCompare(l.id))},GA=({defaultColor:e,rfId:t})=>{const n=xt(x.useCallback(J4({defaultColor:e,rfId:t}),[e,t]),(r,a)=>!(r.length!==a.length||r.some((l,c)=>l.id!==a[c].id)));return pe.createElement("defs",null,n.map(r=>pe.createElement(Q4,{id:r.id,key:r.id,type:r.type,color:r.color,width:r.width,height:r.height,markerUnits:r.markerUnits,strokeWidth:r.strokeWidth,orient:r.orient})))};GA.displayName="MarkerDefinitions";var e5=x.memo(GA);const t5=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}),KA=({defaultMarkerColor:e,onlyRenderVisibleElements:t,elevateEdgesOnSelect:n,rfId:r,edgeTypes:a,noPanClassName:l,onEdgeContextMenu:c,onEdgeMouseEnter:u,onEdgeMouseMove:f,onEdgeMouseLeave:p,onEdgeClick:h,onEdgeDoubleClick:m,onReconnect:y,onReconnectStart:w,onReconnectEnd:_,reconnectRadius:k,children:j,disableKeyboardA11y:b})=>{const{edgesFocusable:S,edgesUpdatable:E,elementsSelectable:C,width:T,height:R,connectionMode:A,nodeInternals:q,onError:F}=xt(t5,rn),O=K4(t,q,n);return T?pe.createElement(pe.Fragment,null,O.map(({level:H,edges:K,isMaxLevel:X})=>pe.createElement("svg",{key:H,style:{zIndex:H},width:T,height:R,className:"react-flow__edges react-flow__container"},X&&pe.createElement(e5,{defaultColor:e,rfId:r}),pe.createElement("g",null,K.map(I=>{const[Z,W,$]=sN(q.get(I.source)),[z,U,V]=sN(q.get(I.target));if(!$||!V)return null;let B=I.type||"default";a[B]||(F==null||F("011",Vs.error011(B)),B="default");const Y=a[B]||a.default,ue=A===Bo.Strict?U.target:(U.target??[]).concat(U.source??[]),G=rN(W.source,I.sourceHandle),ee=rN(ue,I.targetHandle),L=(G==null?void 0:G.position)||Ke.Bottom,te=(ee==null?void 0:ee.position)||Ke.Top,ne=!!(I.focusable||S&&typeof I.focusable>"u"),ie=I.reconnectable||I.updatable,me=typeof y<"u"&&(ie||E&&typeof ie>"u");if(!G||!ee)return F==null||F("008",Vs.error008(G,I)),null;const{sourceX:je,sourceY:Oe,targetX:Ve,targetY:Le}=U4(Z,G,L,z,ee,te);return pe.createElement(Y,{key:I.id,id:I.id,className:mn([I.className,l]),type:B,data:I.data,selected:!!I.selected,animated:!!I.animated,hidden:!!I.hidden,label:I.label,labelStyle:I.labelStyle,labelShowBg:I.labelShowBg,labelBgStyle:I.labelBgStyle,labelBgPadding:I.labelBgPadding,labelBgBorderRadius:I.labelBgBorderRadius,style:I.style,source:I.source,target:I.target,sourceHandleId:I.sourceHandle,targetHandleId:I.targetHandle,markerEnd:I.markerEnd,markerStart:I.markerStart,sourceX:je,sourceY:Oe,targetX:Ve,targetY:Le,sourcePosition:L,targetPosition:te,elementsSelectable:C,onContextMenu:c,onMouseEnter:u,onMouseMove:f,onMouseLeave:p,onClick:h,onEdgeDoubleClick:m,onReconnect:y,onReconnectStart:w,onReconnectEnd:_,reconnectRadius:k,rfId:r,ariaLabel:I.ariaLabel,isFocusable:ne,isReconnectable:me,pathOptions:"pathOptions"in I?I.pathOptions:void 0,interactionWidth:I.interactionWidth,disableKeyboardA11y:b})})))),j):null};KA.displayName="EdgeRenderer";var n5=x.memo(KA);const r5=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function s5({children:e}){const t=xt(r5);return pe.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:t}},e)}function a5(e){const t=Ih(),n=x.useRef(!1);x.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const o5={[Ke.Left]:Ke.Right,[Ke.Right]:Ke.Left,[Ke.Top]:Ke.Bottom,[Ke.Bottom]:Ke.Top},YA=({nodeId:e,handleType:t,style:n,type:r=Ia.Bezier,CustomComponent:a,connectionStatus:l})=>{var R,A,q;const{fromNode:c,handleId:u,toX:f,toY:p,connectionMode:h}=xt(x.useCallback(F=>({fromNode:F.nodeInternals.get(e),handleId:F.connectionHandleId,toX:(F.connectionPosition.x-F.transform[0])/F.transform[2],toY:(F.connectionPosition.y-F.transform[1])/F.transform[2],connectionMode:F.connectionMode}),[e]),rn),m=(R=c==null?void 0:c[Ft])==null?void 0:R.handleBounds;let y=m==null?void 0:m[t];if(h===Bo.Loose&&(y=y||(m==null?void 0:m[t==="source"?"target":"source"])),!c||!y)return null;const w=u?y.find(F=>F.id===u):y[0],_=w?w.x+w.width/2:(c.width??0)/2,k=w?w.y+w.height/2:c.height??0,j=(((A=c.positionAbsolute)==null?void 0:A.x)??0)+_,b=(((q=c.positionAbsolute)==null?void 0:q.y)??0)+k,S=w==null?void 0:w.position,E=S?o5[S]:null;if(!S||!E)return null;if(a)return pe.createElement(a,{connectionLineType:r,connectionLineStyle:n,fromNode:c,fromHandle:w,fromX:j,fromY:b,toX:f,toY:p,fromPosition:S,toPosition:E,connectionStatus:l});let C="";const T={sourceX:j,sourceY:b,sourcePosition:S,targetX:f,targetY:p,targetPosition:E};return r===Ia.Bezier?[C]=R0(T):r===Ia.Step?[C]=Bx({...T,borderRadius:0}):r===Ia.SmoothStep?[C]=Bx(T):r===Ia.SimpleBezier?[C]=xA(T):C=`M${j},${b} ${f},${p}`,pe.createElement("path",{d:C,fill:"none",className:"react-flow__connection-path",style:n})};YA.displayName="ConnectionLine";const i5=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function l5({containerStyle:e,style:t,type:n,component:r}){const{nodeId:a,handleType:l,nodesConnectable:c,width:u,height:f,connectionStatus:p}=xt(i5,rn);return!(a&&l&&u&&c)?null:pe.createElement("svg",{style:e,width:u,height:f,className:"react-flow__edges react-flow__connectionline react-flow__container"},pe.createElement("g",{className:mn(["react-flow__connection",p])},pe.createElement(YA,{nodeId:a,handleType:l,style:t,type:n,CustomComponent:r,connectionStatus:p})))}function oN(e,t){return x.useRef(null),Vt(),x.useMemo(()=>t(e),[e])}const XA=({nodeTypes:e,edgeTypes:t,onMove:n,onMoveStart:r,onMoveEnd:a,onInit:l,onNodeClick:c,onEdgeClick:u,onNodeDoubleClick:f,onEdgeDoubleClick:p,onNodeMouseEnter:h,onNodeMouseMove:m,onNodeMouseLeave:y,onNodeContextMenu:w,onSelectionContextMenu:_,onSelectionStart:k,onSelectionEnd:j,connectionLineType:b,connectionLineStyle:S,connectionLineComponent:E,connectionLineContainerStyle:C,selectionKeyCode:T,selectionOnDrag:R,selectionMode:A,multiSelectionKeyCode:q,panActivationKeyCode:F,zoomActivationKeyCode:O,deleteKeyCode:H,onlyRenderVisibleElements:K,elementsSelectable:X,selectNodesOnDrag:I,defaultViewport:Z,translateExtent:W,minZoom:$,maxZoom:z,preventScrolling:U,defaultMarkerColor:V,zoomOnScroll:B,zoomOnPinch:Y,panOnScroll:ue,panOnScrollSpeed:G,panOnScrollMode:ee,zoomOnDoubleClick:L,panOnDrag:te,onPaneClick:ne,onPaneMouseEnter:ie,onPaneMouseMove:me,onPaneMouseLeave:je,onPaneScroll:Oe,onPaneContextMenu:Ve,onEdgeContextMenu:Le,onEdgeMouseEnter:Te,onEdgeMouseMove:nt,onEdgeMouseLeave:_e,onReconnect:Se,onReconnectStart:Xe,onReconnectEnd:ot,reconnectRadius:$e,noDragClassName:oe,noWheelClassName:ye,noPanClassName:Ce,elevateEdgesOnSelect:De,disableKeyboardA11y:qe,nodeOrigin:rt,nodeExtent:et,rfId:ve})=>{const Re=oN(e,L4),Ue=oN(t,H4);return a5(l),pe.createElement($4,{onPaneClick:ne,onPaneMouseEnter:ie,onPaneMouseMove:me,onPaneMouseLeave:je,onPaneContextMenu:Ve,onPaneScroll:Oe,deleteKeyCode:H,selectionKeyCode:T,selectionOnDrag:R,selectionMode:A,onSelectionStart:k,onSelectionEnd:j,multiSelectionKeyCode:q,panActivationKeyCode:F,zoomActivationKeyCode:O,elementsSelectable:X,onMove:n,onMoveStart:r,onMoveEnd:a,zoomOnScroll:B,zoomOnPinch:Y,zoomOnDoubleClick:L,panOnScroll:ue,panOnScrollSpeed:G,panOnScrollMode:ee,panOnDrag:te,defaultViewport:Z,translateExtent:W,minZoom:$,maxZoom:z,onSelectionContextMenu:_,preventScrolling:U,noDragClassName:oe,noWheelClassName:ye,noPanClassName:Ce,disableKeyboardA11y:qe},pe.createElement(s5,null,pe.createElement(n5,{edgeTypes:Ue,onEdgeClick:u,onEdgeDoubleClick:p,onlyRenderVisibleElements:K,onEdgeContextMenu:Le,onEdgeMouseEnter:Te,onEdgeMouseMove:nt,onEdgeMouseLeave:_e,onReconnect:Se,onReconnectStart:Xe,onReconnectEnd:ot,reconnectRadius:$e,defaultMarkerColor:V,noPanClassName:Ce,elevateEdgesOnSelect:!!De,disableKeyboardA11y:qe,rfId:ve},pe.createElement(l5,{style:S,type:b,component:E,containerStyle:C})),pe.createElement("div",{className:"react-flow__edgelabel-renderer"}),pe.createElement(F4,{nodeTypes:Re,onNodeClick:c,onNodeDoubleClick:f,onNodeMouseEnter:h,onNodeMouseMove:m,onNodeMouseLeave:y,onNodeContextMenu:w,selectNodesOnDrag:I,onlyRenderVisibleElements:K,noPanClassName:Ce,noDragClassName:oe,disableKeyboardA11y:qe,nodeOrigin:rt,nodeExtent:et,rfId:ve})))};XA.displayName="GraphView";var c5=x.memo(XA);const Vx=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Ea={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:Vx,nodeExtent:Vx,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:Bo.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:LP,isValidConnection:void 0},u5=()=>Z$((e,t)=>({...Ea,setNodes:n=>{const{nodeInternals:r,nodeOrigin:a,elevateNodesOnSelect:l}=t();e({nodeInternals:Op(n,r,a,l)})},getNodes:()=>Array.from(t().nodeInternals.values()),setEdges:n=>{const{defaultEdgeOptions:r={}}=t();e({edges:n.map(a=>({...r,...a}))})},setDefaultNodesAndEdges:(n,r)=>{const a=typeof n<"u",l=typeof r<"u",c=a?Op(n,new Map,t().nodeOrigin,t().elevateNodesOnSelect):new Map;e({nodeInternals:c,edges:l?r:[],hasDefaultNodes:a,hasDefaultEdges:l})},updateNodeDimensions:n=>{const{onNodesChange:r,nodeInternals:a,fitViewOnInit:l,fitViewOnInitDone:c,fitViewOnInitOptions:u,domNode:f,nodeOrigin:p}=t(),h=f==null?void 0:f.querySelector(".react-flow__viewport");if(!h)return;const m=window.getComputedStyle(h),{m22:y}=new window.DOMMatrixReadOnly(m.transform),w=n.reduce((k,j)=>{const b=a.get(j.id);if(b!=null&&b.hidden)a.set(b.id,{...b,[Ft]:{...b[Ft],handleBounds:void 0}});else if(b){const S=j0(j.nodeElement);!!(S.width&&S.height&&(b.width!==S.width||b.height!==S.height||j.forceUpdate))&&(a.set(b.id,{...b,[Ft]:{...b[Ft],handleBounds:{source:J1(".source",j.nodeElement,y,p),target:J1(".target",j.nodeElement,y,p)}},...S}),k.push({id:b.id,type:"dimensions",dimensions:S}))}return k},[]);DA(a,p);const _=c||l&&!c&&FA(t,{initial:!0,...u});e({nodeInternals:new Map(a),fitViewOnInitDone:_}),(w==null?void 0:w.length)>0&&(r==null||r(w))},updateNodePositions:(n,r=!0,a=!1)=>{const{triggerNodeChanges:l}=t(),c=n.map(u=>{const f={id:u.id,type:"position",dragging:a};return r&&(f.positionAbsolute=u.positionAbsolute,f.position=u.position),f});l(c)},triggerNodeChanges:n=>{const{onNodesChange:r,nodeInternals:a,hasDefaultNodes:l,nodeOrigin:c,getNodes:u,elevateNodesOnSelect:f}=t();if(n!=null&&n.length){if(l){const p=S4(n,u()),h=Op(p,a,c,f);e({nodeInternals:h})}r==null||r(n)}},addSelectedNodes:n=>{const{multiSelectionActive:r,edges:a,getNodes:l}=t();let c,u=null;r?c=n.map(f=>Ma(f,!0)):(c=Vi(l(),n),u=Vi(a,[])),Cd({changedNodes:c,changedEdges:u,get:t,set:e})},addSelectedEdges:n=>{const{multiSelectionActive:r,edges:a,getNodes:l}=t();let c,u=null;r?c=n.map(f=>Ma(f,!0)):(c=Vi(a,n),u=Vi(l(),[])),Cd({changedNodes:u,changedEdges:c,get:t,set:e})},unselectNodesAndEdges:({nodes:n,edges:r}={})=>{const{edges:a,getNodes:l}=t(),c=n||l(),u=r||a,f=c.map(h=>(h.selected=!1,Ma(h.id,!1))),p=u.map(h=>Ma(h.id,!1));Cd({changedNodes:f,changedEdges:p,get:t,set:e})},setMinZoom:n=>{const{d3Zoom:r,maxZoom:a}=t();r==null||r.scaleExtent([n,a]),e({minZoom:n})},setMaxZoom:n=>{const{d3Zoom:r,minZoom:a}=t();r==null||r.scaleExtent([a,n]),e({maxZoom:n})},setTranslateExtent:n=>{var r;(r=t().d3Zoom)==null||r.translateExtent(n),e({translateExtent:n})},resetSelectedElements:()=>{const{edges:n,getNodes:r}=t(),l=r().filter(u=>u.selected).map(u=>Ma(u.id,!1)),c=n.filter(u=>u.selected).map(u=>Ma(u.id,!1));Cd({changedNodes:l,changedEdges:c,get:t,set:e})},setNodeExtent:n=>{const{nodeInternals:r}=t();r.forEach(a=>{a.positionAbsolute=E0(a.position,n)}),e({nodeExtent:n,nodeInternals:new Map(r)})},panBy:n=>{const{transform:r,width:a,height:l,d3Zoom:c,d3Selection:u,translateExtent:f}=t();if(!c||!u||!n.x&&!n.y)return!1;const p=Us.translate(r[0]+n.x,r[1]+n.y).scale(r[2]),h=[[0,0],[a,l]],m=c==null?void 0:c.constrain()(p,h,f);return c.transform(u,m),r[0]!==m.x||r[1]!==m.y||r[2]!==m.k},cancelConnection:()=>e({connectionNodeId:Ea.connectionNodeId,connectionHandleId:Ea.connectionHandleId,connectionHandleType:Ea.connectionHandleType,connectionStatus:Ea.connectionStatus,connectionStartHandle:Ea.connectionStartHandle,connectionEndHandle:Ea.connectionEndHandle}),reset:()=>e({...Ea})}),Object.is),L0=({children:e})=>{const t=x.useRef(null);return t.current||(t.current=u5()),pe.createElement(TP,{value:t.current},e)};L0.displayName="ReactFlowProvider";const ZA=({children:e})=>x.useContext(Ah)?pe.createElement(pe.Fragment,null,e):pe.createElement(L0,null,e);ZA.displayName="ReactFlowWrapper";const d5={input:RA,default:Ux,output:IA,group:$0},h5={default:uh,straight:A0,step:T0,smoothstep:Rh,simplebezier:C0},f5=[0,0],p5=[15,15],m5={x:0,y:0,zoom:1},g5={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},QA=x.forwardRef(({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:a,nodeTypes:l=d5,edgeTypes:c=h5,onNodeClick:u,onEdgeClick:f,onInit:p,onMove:h,onMoveStart:m,onMoveEnd:y,onConnect:w,onConnectStart:_,onConnectEnd:k,onClickConnectStart:j,onClickConnectEnd:b,onNodeMouseEnter:S,onNodeMouseMove:E,onNodeMouseLeave:C,onNodeContextMenu:T,onNodeDoubleClick:R,onNodeDragStart:A,onNodeDrag:q,onNodeDragStop:F,onNodesDelete:O,onEdgesDelete:H,onSelectionChange:K,onSelectionDragStart:X,onSelectionDrag:I,onSelectionDragStop:Z,onSelectionContextMenu:W,onSelectionStart:$,onSelectionEnd:z,connectionMode:U=Bo.Strict,connectionLineType:V=Ia.Bezier,connectionLineStyle:B,connectionLineComponent:Y,connectionLineContainerStyle:ue,deleteKeyCode:G="Backspace",selectionKeyCode:ee="Shift",selectionOnDrag:L=!1,selectionMode:te=Hc.Full,panActivationKeyCode:ne="Space",multiSelectionKeyCode:ie=lh()?"Meta":"Control",zoomActivationKeyCode:me=lh()?"Meta":"Control",snapToGrid:je=!1,snapGrid:Oe=p5,onlyRenderVisibleElements:Ve=!1,selectNodesOnDrag:Le=!0,nodesDraggable:Te,nodesConnectable:nt,nodesFocusable:_e,nodeOrigin:Se=f5,edgesFocusable:Xe,edgesUpdatable:ot,elementsSelectable:$e,defaultViewport:oe=m5,minZoom:ye=.5,maxZoom:Ce=2,translateExtent:De=Vx,preventScrolling:qe=!0,nodeExtent:rt,defaultMarkerColor:et="#b1b1b7",zoomOnScroll:ve=!0,zoomOnPinch:Re=!0,panOnScroll:Ue=!1,panOnScrollSpeed:pt=.5,panOnScrollMode:he=Io.Free,zoomOnDoubleClick:mt=!0,panOnDrag:qt=!0,onPaneClick:Tt,onPaneMouseEnter:jt,onPaneMouseMove:dn,onPaneMouseLeave:Sn,onPaneScroll:Kt,onPaneContextMenu:an,children:ge,onEdgeContextMenu:ht,onEdgeDoubleClick:tt,onEdgeMouseEnter:_t,onEdgeMouseMove:on,onEdgeMouseLeave:Gn,onEdgeUpdate:Et,onEdgeUpdateStart:lr,onEdgeUpdateEnd:gn,onReconnect:Yt,onReconnectStart:jn,onReconnectEnd:Bt,reconnectRadius:Rn=10,edgeUpdaterRadius:Kn=10,onNodesChange:cr,onEdgesChange:Mn,noDragClassName:Ys="nodrag",noWheelClassName:Xs="nowheel",noPanClassName:ys="nopan",fitView:In=!1,fitViewOptions:yn,connectOnClick:J=!0,attributionPosition:Ae,proOptions:Fe,defaultEdgeOptions:Ie,elevateNodesOnSelect:Ge=!0,elevateEdgesOnSelect:yt=!1,disableKeyboardA11y:kt=!1,autoPanOnConnect:At=!0,autoPanOnNodeDrag:bt=!0,connectionRadius:St=20,isValidConnection:jr,onError:ws,style:Xr,id:Ua,nodeDragThreshold:Xo,...vs},$n)=>{const xs=Ua||"1";return pe.createElement("div",{...vs,style:{...Xr,...g5},ref:$n,className:mn(["react-flow",a]),"data-testid":"rf__wrapper",id:Ua},pe.createElement(ZA,null,pe.createElement(c5,{onInit:p,onMove:h,onMoveStart:m,onMoveEnd:y,onNodeClick:u,onEdgeClick:f,onNodeMouseEnter:S,onNodeMouseMove:E,onNodeMouseLeave:C,onNodeContextMenu:T,onNodeDoubleClick:R,nodeTypes:l,edgeTypes:c,connectionLineType:V,connectionLineStyle:B,connectionLineComponent:Y,connectionLineContainerStyle:ue,selectionKeyCode:ee,selectionOnDrag:L,selectionMode:te,deleteKeyCode:G,multiSelectionKeyCode:ie,panActivationKeyCode:ne,zoomActivationKeyCode:me,onlyRenderVisibleElements:Ve,selectNodesOnDrag:Le,defaultViewport:oe,translateExtent:De,minZoom:ye,maxZoom:Ce,preventScrolling:qe,zoomOnScroll:ve,zoomOnPinch:Re,zoomOnDoubleClick:mt,panOnScroll:Ue,panOnScrollSpeed:pt,panOnScrollMode:he,panOnDrag:qt,onPaneClick:Tt,onPaneMouseEnter:jt,onPaneMouseMove:dn,onPaneMouseLeave:Sn,onPaneScroll:Kt,onPaneContextMenu:an,onSelectionContextMenu:W,onSelectionStart:$,onSelectionEnd:z,onEdgeContextMenu:ht,onEdgeDoubleClick:tt,onEdgeMouseEnter:_t,onEdgeMouseMove:on,onEdgeMouseLeave:Gn,onReconnect:Yt??Et,onReconnectStart:jn??lr,onReconnectEnd:Bt??gn,reconnectRadius:Rn??Kn,defaultMarkerColor:et,noDragClassName:Ys,noWheelClassName:Xs,noPanClassName:ys,elevateEdgesOnSelect:yt,rfId:xs,disableKeyboardA11y:kt,nodeOrigin:Se,nodeExtent:rt}),pe.createElement(a4,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:w,onConnectStart:_,onConnectEnd:k,onClickConnectStart:j,onClickConnectEnd:b,nodesDraggable:Te,nodesConnectable:nt,nodesFocusable:_e,edgesFocusable:Xe,edgesUpdatable:ot,elementsSelectable:$e,elevateNodesOnSelect:Ge,minZoom:ye,maxZoom:Ce,nodeExtent:rt,onNodesChange:cr,onEdgesChange:Mn,snapToGrid:je,snapGrid:Oe,connectionMode:U,translateExtent:De,connectOnClick:J,defaultEdgeOptions:Ie,fitView:In,fitViewOptions:yn,onNodesDelete:O,onEdgesDelete:H,onNodeDragStart:A,onNodeDrag:q,onNodeDragStop:F,onSelectionDrag:I,onSelectionDragStart:X,onSelectionDragStop:Z,noPanClassName:ys,nodeOrigin:Se,rfId:xs,autoPanOnConnect:At,autoPanOnNodeDrag:bt,onError:ws,connectionRadius:St,isValidConnection:jr,nodeDragThreshold:Xo}),pe.createElement(r4,{onSelectionChange:K}),ge,pe.createElement(RP,{proOptions:Fe,position:Ae}),pe.createElement(u4,{rfId:xs,disableKeyboardA11y:kt})))});QA.displayName="ReactFlow";const y5=e=>({x:e.transform[0],y:e.transform[1],zoom:e.transform[2]});function JA(){return xt(y5,rn)}const eR=({id:e,x:t,y:n,width:r,height:a,style:l,color:c,strokeColor:u,strokeWidth:f,className:p,borderRadius:h,shapeRendering:m,onClick:y,selected:w})=>{const{background:_,backgroundColor:k}=l||{},j=c||_||k;return pe.createElement("rect",{className:mn(["react-flow__minimap-node",{selected:w},p]),x:t,y:n,rx:h,ry:h,width:r,height:a,fill:j,stroke:u,strokeWidth:f,shapeRendering:m,onClick:y?b=>y(b,e):void 0})};eR.displayName="MiniMapNode";var w5=x.memo(eR);const v5=e=>e.nodeOrigin,x5=e=>e.getNodes().filter(t=>!t.hidden&&t.width&&t.height),Fp=e=>e instanceof Function?e:()=>e;function b5({nodeStrokeColor:e="transparent",nodeColor:t="#e2e2e2",nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:a=2,nodeComponent:l=w5,onClick:c}){const u=xt(x5,rn),f=xt(v5),p=Fp(t),h=Fp(e),m=Fp(n),y=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return pe.createElement(pe.Fragment,null,u.map(w=>{const{x:_,y:k}=Lo(w,f).positionAbsolute;return pe.createElement(l,{key:w.id,x:_,y:k,width:w.width,height:w.height,style:w.style,selected:w.selected,className:m(w),color:p(w),borderRadius:r,strokeColor:h(w),strokeWidth:a,shapeRendering:y,onClick:c,id:w.id})}))}var k5=x.memo(b5);const N5=200,_5=150,S5=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?$P(Mh(t,e.nodeOrigin),n):n,rfId:e.rfId}},j5="react-flow__minimap-desc";function tR({style:e,className:t,nodeStrokeColor:n="transparent",nodeColor:r="#e2e2e2",nodeClassName:a="",nodeBorderRadius:l=5,nodeStrokeWidth:c=2,nodeComponent:u,maskColor:f="rgb(240, 240, 240, 0.6)",maskStrokeColor:p="none",maskStrokeWidth:h=1,position:m="bottom-right",onClick:y,onNodeClick:w,pannable:_=!1,zoomable:k=!1,ariaLabel:j="React Flow mini map",inversePan:b=!1,zoomStep:S=10,offsetScale:E=5}){const C=Vt(),T=x.useRef(null),{boundingRect:R,viewBB:A,rfId:q}=xt(S5,rn),F=(e==null?void 0:e.width)??N5,O=(e==null?void 0:e.height)??_5,H=R.width/F,K=R.height/O,X=Math.max(H,K),I=X*F,Z=X*O,W=E*X,$=R.x-(I-R.width)/2-W,z=R.y-(Z-R.height)/2-W,U=I+W*2,V=Z+W*2,B=`${j5}-${q}`,Y=x.useRef(0);Y.current=X,x.useEffect(()=>{if(T.current){const ee=vr(T.current),L=ie=>{const{transform:me,d3Selection:je,d3Zoom:Oe}=C.getState();if(ie.sourceEvent.type!=="wheel"||!je||!Oe)return;const Ve=-ie.sourceEvent.deltaY*(ie.sourceEvent.deltaMode===1?.05:ie.sourceEvent.deltaMode?1:.002)*S,Le=me[2]*Math.pow(2,Ve);Oe.scaleTo(je,Le)},te=ie=>{const{transform:me,d3Selection:je,d3Zoom:Oe,translateExtent:Ve,width:Le,height:Te}=C.getState();if(ie.sourceEvent.type!=="mousemove"||!je||!Oe)return;const nt=Y.current*Math.max(1,me[2])*(b?-1:1),_e={x:me[0]-ie.sourceEvent.movementX*nt,y:me[1]-ie.sourceEvent.movementY*nt},Se=[[0,0],[Le,Te]],Xe=Us.translate(_e.x,_e.y).scale(me[2]),ot=Oe.constrain()(Xe,Se,Ve);Oe.transform(je,ot)},ne=uA().on("zoom",_?te:null).on("zoom.wheel",k?L:null);return ee.call(ne),()=>{ee.on("zoom",null)}}},[_,k,b,S]);const ue=y?ee=>{const L=Br(ee);y(ee,{x:L[0],y:L[1]})}:void 0,G=w?(ee,L)=>{const te=C.getState().nodeInternals.get(L);w(ee,te)}:void 0;return pe.createElement(S0,{position:m,style:e,className:mn(["react-flow__minimap",t]),"data-testid":"rf__minimap"},pe.createElement("svg",{width:F,height:O,viewBox:`${$} ${z} ${U} ${V}`,role:"img","aria-labelledby":B,ref:T,onClick:ue},j&&pe.createElement("title",{id:B},j),pe.createElement(k5,{onClick:G,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:l,nodeClassName:a,nodeStrokeWidth:c,nodeComponent:u}),pe.createElement("path",{className:"react-flow__minimap-mask",d:`M${$-W},${z-W}h${U+W*2}v${V+W*2}h${-U-W*2}z
|
|
57
|
+
M${A.x},${A.y}h${A.width}v${A.height}h${-A.width}z`,fill:f,fillRule:"evenodd",stroke:p,strokeWidth:h,pointerEvents:"none"})))}tR.displayName="MiniMap";var E5=x.memo(tR);function C5(){return pe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},pe.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function T5(){return pe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},pe.createElement("path",{d:"M0 0h32v4.2H0z"}))}function A5(){return pe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},pe.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 R5(){return pe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},pe.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 M5(){return pe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},pe.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 wr=({children:e,className:t,...n})=>pe.createElement("button",{type:"button",className:mn(["react-flow__controls-button",t]),...n},e);wr.displayName="ControlButton";const I5=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom}),nR=({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:a,onZoomIn:l,onZoomOut:c,onFitView:u,onInteractiveChange:f,className:p,children:h,position:m="bottom-left"})=>{const y=Vt(),[w,_]=x.useState(!1),{isInteractive:k,minZoomReached:j,maxZoomReached:b}=xt(I5,rn),{zoomIn:S,zoomOut:E,fitView:C}=Ih();if(x.useEffect(()=>{_(!0)},[]),!w)return null;const T=()=>{S(),l==null||l()},R=()=>{E(),c==null||c()},A=()=>{C(a),u==null||u()},q=()=>{y.setState({nodesDraggable:!k,nodesConnectable:!k,elementsSelectable:!k}),f==null||f(!k)};return pe.createElement(S0,{className:mn(["react-flow__controls",p]),position:m,style:e,"data-testid":"rf__controls"},t&&pe.createElement(pe.Fragment,null,pe.createElement(wr,{onClick:T,className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:b},pe.createElement(C5,null)),pe.createElement(wr,{onClick:R,className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:j},pe.createElement(T5,null))),n&&pe.createElement(wr,{className:"react-flow__controls-fitview",onClick:A,title:"fit view","aria-label":"fit view"},pe.createElement(A5,null)),r&&pe.createElement(wr,{className:"react-flow__controls-interactive",onClick:q,title:"toggle interactivity","aria-label":"toggle interactivity"},k?pe.createElement(M5,null):pe.createElement(R5,null)),h)};nR.displayName="Controls";var $5=x.memo(nR),Wr;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Wr||(Wr={}));function O5({color:e,dimensions:t,lineWidth:n}){return pe.createElement("path",{stroke:e,strokeWidth:n,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`})}function L5({color:e,radius:t}){return pe.createElement("circle",{cx:t,cy:t,r:t,fill:e})}const P5={[Wr.Dots]:"#91919a",[Wr.Lines]:"#eee",[Wr.Cross]:"#e2e2e2"},D5={[Wr.Dots]:1,[Wr.Lines]:1,[Wr.Cross]:6},F5=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function rR({id:e,variant:t=Wr.Dots,gap:n=20,size:r,lineWidth:a=1,offset:l=2,color:c,style:u,className:f}){const p=x.useRef(null),{transform:h,patternId:m}=xt(F5,rn),y=c||P5[t],w=r||D5[t],_=t===Wr.Dots,k=t===Wr.Cross,j=Array.isArray(n)?n:[n,n],b=[j[0]*h[2]||1,j[1]*h[2]||1],S=w*h[2],E=k?[S,S]:b,C=_?[S/l,S/l]:[E[0]/l,E[1]/l];return pe.createElement("svg",{className:mn(["react-flow__background",f]),style:{...u,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:p,"data-testid":"rf__background"},pe.createElement("pattern",{id:m+e,x:h[0]%b[0],y:h[1]%b[1],width:b[0],height:b[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${C[0]},-${C[1]})`},_?pe.createElement(L5,{color:y,radius:S/l}):pe.createElement(O5,{dimensions:E,color:y,lineWidth:a})),pe.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${m+e})`}))}rR.displayName="Background";var q5=x.memo(rR);const B5=["us-gov","global","apac","us","eu","jp","au"],z5=new RegExp(`^(?:(?:${B5.join("|")})\\.)?anthropic\\.`,"i");function pl(e){return e.replace(z5,"")}const H5=["command","cmd","file_path","path","url","pattern","notebook_path"],iN=120,qp=e=>e.length>iN?`${e.slice(0,iN-1)}…`:e;function U5(e){if(typeof e=="string")return e.trim()?qp(e.trim()):null;if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e;for(const n of H5){const r=t[n];if(typeof r=="string"&&r.trim())return qp(r.trim());if(Array.isArray(r)&&r.length>0&&r.every(a=>typeof a=="string")){const a=r.join(" ").trim();if(a)return qp(a)}}return null}const W5=/^\s*<task-notification>([\s\S]*?)<\/task-notification>/;function lN(e,t){var n;return((n=new RegExp(`<${t}>([\\s\\S]*?)</${t}>`).exec(e))==null?void 0:n[1].trim())||void 0}const cN={completed:"background task finished",failed:"background task failed",killed:"background task stopped"};function P0(e){const t=W5.exec(e);if(!t)return null;const n=lN(t[1],"status");return{label:(n&&Object.hasOwn(cN,n)?cN[n]:void 0)??"background task update",detail:lN(t[1],"summary")}}function sR(e){return e.filter(t=>!P0(t.text))}const V5=/[0-9a-f]{16,}/i,G5=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function aR(e){return V5.test(e)||G5.test(e)}function K5(e){if(!e)return;const t=e.replace(/\\/g,"/").split("/").filter(Boolean);for(let n=t.length-1;n>=0;n--)if(!aR(t[n]))return t[n];return t[t.length-1]}function oR(){return{inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0}}function D0(e){const t=e.cache_creation,n=t&&typeof t=="object"?t:e,r=n.ephemeral_1h_input_tokens,a=n.ephemeral_5m_input_tokens;return typeof r!="number"&&typeof a!="number"?{}:{cacheCreate1hTokens:Number(r??0),cacheCreate5mTokens:Number(a??0)}}function Y5(e){const t=D0(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 X5(e){if(!e||typeof e!="object"||Array.isArray(e))return;const t={};for(const[n,r]of Object.entries(e))!n||!r||typeof r!="object"||(t[n]=Y5(r));return Object.keys(t).length?t:void 0}function iR(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),...D0(n)};for(const r of Object.values(n)){const a=iR(r,t+1);if(a)return a}return null}const Z5=/^(?:claude[-_]|gpt[-_]|o\d|codex[-_])/i,Q5=new Set(["tool_input","tool_response"]);function lR(e,t=0){if(!e||typeof e!="object"||t>6)return null;const n=e;if(typeof n.model=="string"&&Z5.test(pl(n.model)))return n.model;for(const[r,a]of Object.entries(n)){if(Q5.has(r))continue;const l=lR(a,t+1);if(l)return l}return null}function Gx(){return{agents:new Map,toolIndex:new Map,activeSubagentStack:new Map,subagentTombstones:new Map,pendingSubagentModels:new Map,lastSeq:0,seqEpoch:null,totalEvents:0,revision:0}}function Da(e){return K5(e)}function uN(){return{msgsUser:0,msgsAssistant:0,toolUses:0,toolResults:0,systemReminders:0,currentContextTokens:0,memoryFiles:[]}}function al(e,t){return`${e}::${t}`}function Fa(e,t){return`${e}\0${t}`}function dh(e){const t=e.agent_type??e.subagent_type;return t&&!aR(t)?t:"subagent"}function Ic(e){return e.agent_id?e.agent_id:e.parent_tool_use_id?e.parent_tool_use_id:null}function Gi(e,t,n,r){const a=t;let l=e.agents.get(a);return l||(l={id:a,sessionId:t,label:"session",kind:"root",state:"active",startedAt:n,lastEventAt:n,tools:[],prompts:[],toolCount:0,childCount:0,synthetic:r,usage:oR()},e.agents.set(a,l),l)}function cR(e,t,n,r){const a=al(t,n),l=e.agents.get(a);if(!l)return null;!l.cwd&&r.cwd&&(l.cwd=r.cwd,l.cwdBasename=Da(r.cwd));const c=dh(r);return c&&(l.label==="subagent"||!l.label)&&(l.label=c),l}function J5(e,t,n){const r=t.session_id??"unknown",a=Ic(t);if(a){const f=cR(e,r,a,t);if(f)return f}const l=e.activeSubagentStack.get(r),c=l&&l.length>0?l[l.length-1]:null;if(c){const f=e.agents.get(al(r,c));if(f)return!f.cwd&&t.cwd&&(f.cwd=t.cwd,f.cwdBasename=Da(t.cwd)),f}const u=Gi(e,r,n,t.hook_event_name!=="SessionStart");return!u.cwd&&t.cwd&&(u.cwd=t.cwd,u.cwdBasename=Da(t.cwd)),u.label==="session"&&t.cwd&&(u.label=Da(t.cwd)??"session"),u}function eD(e,t,n,r,a){const l=al(t,n),c=Gi(e,t,a,!0);let u=e.agents.get(l);if(u){!u.cwd&&r.cwd&&(u.cwd=r.cwd,u.cwdBasename=Da(r.cwd));const p=dh(r);return p&&(u.label==="subagent"||!u.label)&&(u.label=p),u}u={id:l,sessionId:t,label:dh(r),kind:"subagent",parentId:c.id,state:"active",startedAt:a,tools:[],prompts:[],cwd:r.cwd,cwdBasename:Da(r.cwd),toolCount:0,childCount:0,usage:oR()},e.agents.set(l,u);const f=e.pendingSubagentModels.get(l);return f&&(u.model=f,e.pendingSubagentModels.delete(l)),c.childCount+=1,u}function tD(e,t,n){const r=e.activeSubagentStack.get(t)??[];r.includes(n)||(r.push(n),e.activeSubagentStack.set(t,r))}function dN(e,t,n){const r=e.activeSubagentStack.get(t);if(r){for(let a=r.length-1;a>=0;a--)if(r[a]===n){r.splice(a,1);break}r.length===0&&e.activeSubagentStack.delete(t)}}function Ad(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 hN=200;function nD(e,t){for(const n of e.values()){const r=n.tools.find(a=>a.id===t);if(r)return r}return null}const rD=25;function sD(e,t){const n=t.tools;if(n.length>hN){const r=n.splice(0,n.length-hN);for(const a of r){const l=Fa(t.sessionId,a.id);e.toolIndex.get(l)===a&&e.toolIndex.delete(l)}}for(let r=n.length-rD-1;r>=0;r--){const a=n[r];if(a.trimmed)break;a.input=void 0,a.response=void 0,a.trimmed=!0}}function aD(e,t,n){const r=e.toolIndex.get(Fa(t.sessionId,n));if(r)return r;for(let a=t.tools.length-1;a>=0;a--)if(t.tools[a].id===n)return t.tools[a];return null}const fN=2e3;function oD(e,t,n){for(let r=e.prompts.length-1;r>=0;r--){const a=e.prompts[r];if(a.at<t-fN)return!1;if(a.text===n&&a.at<=t+fN)return!0}return!1}const Rd=2e3;function iD(e){let t=e.startedAt;for(const n of e.prompts)n.at>t&&(t=n.at);return t}function uR(e,t){for(const n of t.tools){const r=Fa(t.sessionId,n.id);e.toolIndex.get(r)===n&&e.toolIndex.delete(r)}}function su(e,t){return t&&(e.revision+=1),t}function lD(e,t,n,r,a){if(e.agents.size<=n)return!1;const l=m=>m.state==="done"&&m.endedAt!=null&&t-m.endedAt>r,c=[],u=new Map;for(const[m,y]of e.agents){if(y.parentId!=null){const w=u.get(y.parentId);w?w.push(m):u.set(y.parentId,[m])}l(y)&&c.push({id:m,endedAt:y.endedAt})}if(c.length===0)return!1;c.sort((m,y)=>m.endedAt-y.endedAt);let f=0;const p=new Set,h=m=>{const y=e.agents.get(m);y&&(uR(e,y),e.agents.delete(m),p.add(y.sessionId),f++)};for(const m of c){if(e.agents.size<=n)break;if(!e.agents.has(m.id))continue;const y=(u.get(m.id)??[]).map(w=>e.agents.get(w)).filter(w=>w!=null);if(!y.some(w=>!l(w))){for(const w of y)h(w.id);h(m.id)}}if(a&&p.size>0){const m=new Set;for(const y of e.agents.values())m.add(y.sessionId);for(const y of p)m.has(y)||a(y)}return su(e,f>0)}function cD(e,t,n,r,a){const l=new Map;for(const[h,m]of e.agents){let y=l.get(m.sessionId);y||(y={ids:[],endedAt:0,live:!1,closed:!1},l.set(m.sessionId,y)),y.ids.push(h),m.kind==="root"&&m.closedAt!=null&&(y.closed=!0),m.state==="done"&&m.endedAt!=null?y.endedAt=Math.max(y.endedAt,m.endedAt):y.live=!0}const c=[...l].filter(([,h])=>!h.live&&h.endedAt>0&&t-h.endedAt>r).sort(([,h],[,m])=>h.closed===m.closed?h.endedAt-m.endedAt:h.closed?-1:1);let f=[...l.values()].filter(h=>!h.live).length-n;if(f<=0)return!1;let p=!1;for(const[h,m]of c){if(f<=0)break;for(const y of m.ids){const w=e.agents.get(y);w&&uR(e,w),e.agents.delete(y)}for(const y of e.pendingSubagentModels.keys())y.startsWith(`${h}::`)&&e.pendingSubagentModels.delete(y);a==null||a(h),f--,p=!0}return su(e,p)}function uD(e,t){const n=t==null?void 0:t.payload,r=n==null?void 0:n.hook_event_name;if(r!=="PostToolUse"&&r!=="PostToolUseFailure")return!1;const a=n==null?void 0:n.tool_use_id;return typeof a!="string"||a.length===0?!1:e.toolIndex.has(Fa((n==null?void 0:n.session_id)??"unknown",a))}function dD(e){let t=!1;for(const n of e.agents.values())for(const r of n.tools)r.endedAt!=null||r.outcomeGap||(r.outcomeGap=!0,t=!0);return su(e,t)}function hD(e,t,n){let r=!1;for(const a of e.agents.values()){if(a.provider==="codex")continue;const l=e.agents.get(a.sessionId),c=(l==null?void 0:l.lastEventAt)??(l==null?void 0:l.startedAt);for(const u of a.tools){const f=Math.max(u.startedAt,c??u.startedAt);u.endedAt==null&&t-f>n&&(u.endedAt=f,u.ok=!1,u.errorPreview=u.outcomeGap?"no result reached the deck — events were dropped while the deck was paused":"session ended before this call returned",e.toolIndex.delete(Fa(a.sessionId,u.id)),r=!0)}}return su(e,r)}const pN=90*6e4;function fD(e,t,n){let r=!1;for(const a of e.agents.values()){if(a.kind!=="root")continue;const l=a.lastEventAt??a.startedAt;if(!(t-l<=n)){a.waiting&&(a.waiting=null,r=!0),a.closedAt==null&&(a.closedAt=l),a.state==="active"&&(a.state="done",a.endedAt=l,a.reaped=!0,r=!0);for(const c of e.agents.values())c.sessionId!==a.sessionId||c.kind==="root"||c.state!=="active"||(c.state="done",c.endedAt=l,r=!0);e.activeSubagentStack.delete(a.sessionId)}}return su(e,r)}function pD(e){return e==="permission_prompt"?"permission":e==="agent_needs_input"?"asked":e==="idle_prompt"?"idle":null}const mD=new Set(["Notification","ModelObserved","ContextObserved","UsageObserved","SessionNamed","SessionRecapped"]);function gD(e,t){let n=null;for(const r of e.toolIndex.values()){const a=r.agentId?e.agents.get(r.agentId):void 0;!a||a.sessionId!==t||(!n||r.startedAt>n.startedAt)&&(n=r)}return n}const yD=3e4;function wD(e,t){if(!(!e||!e.name)&&!(t-e.startedAt>yD)&&!(e.startedAt>t))return{name:e.name,preview:U5(e.input)??""}}function vD(e,t,n,r,a){if(n!=="permission")return{kind:n,message:r,since:a};const l=gD(e,t),c={kind:n,message:r,since:a};l!=null&&l.explicitSubagentId&&(c.subagentId=l.explicitSubagentId);const u=wD(l,a);return u&&(c.tool=u),c}function xD(e,t,n){if(e.kind==="idle")return!0;const r=Ic(t);return r==null?!0:e.subagentId!=null&&al(n,r)===e.subagentId}function mN(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 r=t.payload??{},a=t.receivedAt,l=r.hook_event_name??"Unknown";if(l==="__clear")return{...Gx(),lastSeq:t.seq,seqEpoch:e.seqEpoch,revision:e.revision+1};e.totalEvents+=1,e.lastSeq=t.seq,e.revision+=1;const c=r.session_id??"unknown";if(!mD.has(l)){const h=e.agents.get(c);h!=null&&h.waiting&&xD(h.waiting,r,c)&&(h.waiting=null)}const u=e.agents.get(c);if(u&&a>(u.lastEventAt??0)&&(u.lastEventAt=a,u.reaped&&(u.reaped=!1,u.state="active",u.endedAt=void 0,u.closedAt=void 0)),typeof r.model_context_window=="number"&&r.model_context_window>0){const h=e.agents.get(c);h&&(h.contextWindow=r.model_context_window)}if(typeof r.approval_policy=="string"&&r.approval_policy){const h=e.agents.get(c);h&&(h.approvalPolicy=r.approval_policy)}if(typeof r.context_tokens=="number"&&r.context_tokens>=0){const h=e.agents.get(c);h&&(h.context={...h.context??uN(),currentContextTokens:r.context_tokens})}if(l==="ModelObserved"){const h=typeof r.model=="string"?r.model:null;if(h){const y=e.agents.get(c);y&&(y.model=h)}const m=r.subagentModels;if(m&&typeof m=="object")for(const[y,w]of Object.entries(m)){if(typeof w!="string")continue;const _=`${c}::${y}`,k=e.agents.get(_);if(k)k.model=w,e.pendingSubagentModels.delete(_);else if(e.pendingSubagentModels.delete(_),e.pendingSubagentModels.set(_,w),e.pendingSubagentModels.size>256){const j=e.pendingSubagentModels.keys().next().value;j!==void 0&&e.pendingSubagentModels.delete(j)}}return e}if(l==="ContextObserved"){const h=r.context??null;if(h){const m=e.agents.get(c);if(m){const y=m.context??uN(),w=(k,j)=>typeof h[k]=="number"?h[k]:j,_=Array.isArray(h.memoryFiles)?h.memoryFiles:Array.isArray(h.claudeMdFiles)?h.claudeMdFiles:null;m.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:_??y.memoryFiles}}}return e}if(l==="SessionNamed"){const h=e.agents.get(c);if(h){const m=typeof r.sessionName=="string"?r.sessionName.trim():"",y=typeof r.sessionTitle=="string"?r.sessionTitle.trim():"";m&&(h.sessionName=m),y&&(h.sessionTitle=y);const w=h.sessionName??"";h.sessionTitle&&w&&h.sessionTitle.toLowerCase()===w.toLowerCase()&&(h.sessionTitle=void 0)}return e}if(l==="SessionRecapped"){const h=e.agents.get(c);if(h){const m=r.recap;m===null?h.recap=void 0:m&&typeof m.text=="string"&&m.text.trim()&&Number.isFinite(m.at)&&(h.recap={text:m.text.trim(),at:m.at})}return e}if(l==="OutputObserved"){const h=r.kind==="thinking"||r.kind==="text"||r.kind==="tool_use"?r.kind:null,m=typeof r.at=="number"&&Number.isFinite(r.at)?r.at:a;if(!h)return e;const y=e.agents.get(c);if(!y||y.lastOutputAt!=null&&m<=y.lastOutputAt)return e;if(y.lastOutputAt=m,h!=="tool_use"){const w=(y.outputs??[]).filter(_=>m-_<bD);w.push(m),y.outputs=w.length>gN?w.slice(-gN):w}return e.revision+=1,e}if(l==="UsageObserved"){const h=r.usage??null;if(h){const m=e.agents.get(c);if(m){m.usage.inputTokens=Number(h.input_tokens??0),m.usage.outputTokens=Number(h.output_tokens??0),m.usage.cacheReadTokens=Number(h.cache_read_input_tokens??h.cached_input_tokens??0),m.usage.cacheCreateTokens=Number(h.cache_creation_input_tokens??h.cache_write_input_tokens??0);const y=D0(h);m.usage.cacheCreate1hTokens=y.cacheCreate1hTokens,m.usage.cacheCreate5mTokens=y.cacheCreate5mTokens,typeof h.reasoning_output_tokens=="number"&&(m.usage.reasoningOutputTokens=Number(h.reasoning_output_tokens)),m.usageByModel=X5(r.usageByModel)}}return e}const f=J5(e,r,a);f.provider||(f.provider=r.provider==="codex"?"codex":"claude");const p=lR(r);switch(p&&(f.model=p),l){case"SessionStart":{const h=Gi(e,c,a,!1);h.synthetic=!1,h.state="active",h.closedAt=void 0,h.endedAt=void 0,h.startedAt=Math.min(h.startedAt??a,a),!h.cwd&&r.cwd&&(h.cwd=r.cwd,h.cwdBasename=Da(r.cwd)),h.label==="session"&&r.cwd&&(h.label=Da(r.cwd)??"session");break}case"UserPromptSubmit":{for(const y of e.agents.values())y.sessionId===c&&y.kind==="subagent"&&y.state==="done"&&y.exitAt==null&&y.endedAt!=null&&y.endedAt<a&&(y.exitAt=a);const h=Gi(e,c,a,!1);h.state="active",h.endedAt=void 0,h.closedAt=void 0,h.exitAt=void 0;const m=(typeof r.prompt=="string"?r.prompt:typeof r.message=="string"?r.message:"")??"";m&&!oD(h,a,m)&&(h.prompts.push({at:a,text:m}),!h.firstPrompt&&!P0(m)&&(h.firstPrompt=Ad(m,120)));break}case"PreToolUse":{const h=r.tool_use_id?aD(e,f,r.tool_use_id):null;if(h){r.tool_name&&h.name==="?"&&(h.name=r.tool_name),h.endedAt==null&&!h.trimmed&&r.tool_input!==void 0&&(h.input=r.tool_input,h.inputPreview=Ad(r.tool_input));break}const m=r.tool_use_id??`${f.id}:${f.toolCount}`,y=Ic(r),w={id:m,name:r.tool_name??"?",input:r.tool_input,inputPreview:Ad(r.tool_input),agentId:f.id,explicitSubagentId:y?al(c,y):void 0,startedAt:a};f.tools.push(w),f.toolCount+=1,f.state="active",e.toolIndex.set(Fa(f.sessionId,m),w),sD(e,f);break}case"PostToolUse":case"PostToolUseFailure":{const h=r.tool_use_id;if(!h)break;const m=Fa(c,h);let y=e.toolIndex.get(m),w=!1;if(!y)for(const k of e.agents.values()){if(k.sessionId!==c)continue;const j=k.tools.find(b=>b.id===h);if(j){y=j,w=!0;break}}if(!y||y.outcomeApplied)break;y.outcomeApplied=!0,y.outcomeGap=void 0,y.endedAt=a,y.ok=l==="PostToolUse",y.trimmed||(y.response=r.tool_response),l==="PostToolUseFailure"?y.errorPreview=Ad(r.tool_response):w&&(y.errorPreview=void 0);const _=iR(r.tool_response);_&&(y.usage=_),e.toolIndex.delete(m);break}case"SubagentStart":{const h=Ic(r);if(!h)break;const m=eD(e,c,h,r,a),y=dh(r);y&&(m.label=y);const w=e.subagentTombstones.get(m.id);w!=null&&e.subagentTombstones.delete(m.id);const _=m.endedAt!=null&&a-m.endedAt<=Rd,k=w!=null&&a-w<=Rd;if(_||k){const j=k?w:m.endedAt;m.state="done",m.endedAt=j,m.startedAt=Math.min(m.startedAt,j),dN(e,c,h);break}m.state="active",m.startedAt=m.startedAt||a,m.exitAt=void 0,m.endedAt=void 0,tD(e,c,h);break}case"SubagentStop":{const h=Ic(r);if(!h)break;const m=cR(e,c,h,r);if(!m){for(const[y,w]of e.subagentTombstones)a-w>Rd&&e.subagentTombstones.delete(y);e.subagentTombstones.set(al(c,h),a);break}m.state="done",m.endedAt=Math.min(m.endedAt??a,a),dN(e,c,h);break}case"Stop":case"SessionEnd":{const h=Gi(e,c,a,!1),m=iD(h);if(a<m)break;const y=h.lastTurnEndAt;if(y!=null&&m>y&&a<=y+Rd)break;h.state="done",h.endedAt=a,h.lastTurnEndAt=a;for(const w of h.provider==="codex"?[]:e.agents.values())if(w.sessionId===c)for(const _ of w.tools)_.endedAt==null&&_.explicitSubagentId==null&&(_.endedAt=a,_.ok=!1,_.errorPreview=_.outcomeGap?"no result reached the deck — events were dropped while the deck was paused":"the turn ended before this call returned",e.toolIndex.delete(Fa(w.sessionId,_.id)));l==="SessionEnd"&&(h.closedAt=a),e.activeSubagentStack.delete(c);break}case"Notification":{const h=pD(r.notification_type);if(!h)break;const m=Gi(e,c,a,!1),y=typeof r.message=="string"?r.message:"",w=m.waiting;m.waiting=w&&w.kind===h&&w.message===y?{...w,since:Math.min(w.since,a)}:vD(e,c,h,y,a);break}}return e}const bD=6e4,gN=64;function hh(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 kD={input:2,output:10,cacheRead:.2,cacheWrite:2.5,cacheWrite1h:4},ND=[{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:kD},{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[-_]6[-_]astra\b(?![-_][A-Za-z])/i,rates:{input:10,output:50,cacheRead:1,cacheWrite:12.5}},{match:/^gpt[-_]5[-_.]6[-_]cyber/i,rates:{input:12.5,output:75,cacheRead:1.25,cacheWrite:15.625}},{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(?![-_][A-Za-z])/i,rates:{input:4,output:20,cacheRead:.4,cacheWrite:5}},{match:/^gpt[-_]5[-_.]5[-_]pro/i,rates:{input:30,output:180,cacheRead:30,cacheWrite:0}},{match:/^gpt[-_]5[-_.]5\b(?![-_][A-Za-z])/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 _D(e){return e?/^(?:gpt[-_]|codex[-_]|o\d)/i.test(e):!1}function ml(e,t=Date.now()){if(!e)return null;const n=pl(e);for(const r of ND)if(r.match.test(n))return typeof r.rates=="function"?r.rates(t):r.rates;return null}function dR(e,t){const n=Math.max(0,e.cacheCreate1hTokens??0),r=Math.max(0,e.cacheCreate5mTokens??0),a=Math.max(0,e.cacheCreateTokens-n-r),l=r+a,c=t.cacheWrite1h??t.cacheWrite;return{tokens5m:l,tokens1h:n,usd5m:l*t.cacheWrite/1e6,usd1h:n*c/1e6}}function hR(e,t,n=Date.now()){if(!_D(t))return e.inputTokens;const r=ml(t,n),a=((r==null?void 0:r.cacheWrite)??0)>0?Math.max(0,e.cacheCreateTokens):0;return Math.max(0,e.inputTokens-e.cacheReadTokens-a)}function $o(e,t,n=Date.now()){const r=ml(t,n);if(!r)return{input:0,output:0,cacheRead:0,cacheWrite:0,total:0};const a=hR(e,t,n)*r.input/1e6,l=e.outputTokens*r.output/1e6,c=e.cacheReadTokens*r.cacheRead/1e6,u=dR(e,r),f=u.usd5m+u.usd1h;return{input:a,output:l,cacheRead:c,cacheWrite:f,total:a+l+c+f}}const yN=2e5,SD=1e6,jD=[/\[1m\]/i,/^claude[-_]opus[-_]5\b/i,/^claude[-_]sonnet[-_]5\b/i,/^claude[-_]opus[-_]4[-_.](?:6|7|8)\b/i,/^claude[-_]sonnet[-_]4[-_.]6\b/i,/^claude[-_](fable|mythos)[-_]5\b/i],ED=[{match:/^gpt[-_]6[-_]astra/i,window:105e4},{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 CD(e){if(!e)return yN;const t=pl(e);for(const n of jD)if(n.test(t))return SD;for(const n of ED)if(n.match.test(t))return n.window;return yN}function fR(e,t){return typeof e=="number"&&e>0?e:CD(t)}const Wi="not priced";function ct(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}¢`}if(e<100){const t=e.toFixed(2);if(Number(t)<100)return`$${t}`}if(e<1e4){const t=e.toFixed(0);if(Number(t)<1e4)return`$${t}`}return`$${(e/1e3).toFixed(1)}k`}function F0(e,t){if(e<=0||t<10)return null;const n=e/t,r=n*60;return r>=.01?`${ct(r)}/min`:`${ct(n*3600)}/hr`}function TD(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 AD(e,t){let n=0,r=0,a=0,l=0,c=0,u=0;for(const m of t)n+=m.inputTokens,r+=m.outputTokens,a+=m.cacheReadTokens,l+=m.cacheCreateTokens,c+=m.cacheCreate1hTokens??0,u+=m.cacheCreate5mTokens??0;const f=(m,y)=>Math.max(0,m-y),p={inputTokens:f(e.inputTokens,n),outputTokens:f(e.outputTokens,r),cacheReadTokens:f(e.cacheReadTokens,a),cacheCreateTokens:f(e.cacheCreateTokens,l)};return(e.cacheCreate1hTokens!==void 0||e.cacheCreate5mTokens!==void 0)&&(p.cacheCreate1hTokens=f(e.cacheCreate1hTokens??0,c),p.cacheCreate5mTokens=f(e.cacheCreate5mTokens??0,u)),p.inputTokens+p.outputTokens+p.cacheReadTokens+p.cacheCreateTokens>0?p:null}function au(e){const t=e.usageByModel,n=t?Object.keys(t):[];if(!t||n.length===0)return[{model:e.model,usage:e.usage}];const r=n.map(l=>({model:l,usage:t[l]})),a=AD(e.usage,r.map(l=>l.usage));if(a){const l=r.findIndex(c=>c.model===e.model);l>=0?r[l]={model:r[l].model,usage:TD(r[l].usage,a)}:r.push({model:e.model,usage:a})}return r}function Vn(e,t=Date.now()){const n={input:0,output:0,cacheRead:0,cacheWrite:0,total:0};for(const r of au(e)){const a=$o(r.usage,r.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 Wc(e,t=Date.now()){let n=0;for(const r of au(e))ml(r.model,t)==null&&(n+=r.usage.inputTokens+r.usage.outputTokens);return n}function pR(e){const t=[];for(const n of au(e)){if(!n.model||t.includes(n.model))continue;const r=n.usage;r.inputTokens+r.outputTokens+r.cacheReadTokens+r.cacheCreateTokens<=0||t.push(n.model)}return t}function mR(e){return pR(e).filter(t=>t!==e.model)}const RD=new Set(["untrusted","on-request","on-failure"]);function MD(e){return typeof e!="string"||!e?null:RD.has(e)?!0:e==="never"?!1:null}function ID(e){if(e.provider!=="codex"||e.kind!=="root"||e.waiting||e.state!=="active")return null;const t=MD(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 wN(e){return e[0].toUpperCase()+e.slice(1).toLowerCase()}function qa(e){const t=pl(e).replace(/[-_]\d{8}(?!\d)/,""),n=t.match(/^claude[-_](opus|sonnet|haiku|fable|mythos)[-_](\d+(?:[-_.]\d+)*)/i);if(n){const a=wN(n[1]),l=n[2].replace(/[-_]/g,".");return`${a} ${l}`}const r=t.match(/^gpt[-_](\d+(?:[-_.]\d+)*)((?:[-_][A-Za-z0-9.]+)*)$/i);if(r){const a=r[1].replace(/[-_]/g,"."),l=r[2].split(/[-_]/).filter(Boolean).map(wN);return[`GPT-${a}`,...l].join(" ")}return e}function $h(e){const t=pl(e??""),n=t.match(/^claude[-_](opus|sonnet|haiku|fable|mythos)[-_]/i);return n?n[1].toLowerCase():/^gpt[-_]/i.test(t)?"gpt":""}function br(e){return(e==null?void 0:e.kind)==="permission"||(e==null?void 0:e.kind)==="asked"}function Bp(e){const t=[];for(const n of e)n.kind==="root"&&br(n.waiting)&&t.push({id:n.id,label:n.label,waiting:n.waiting});return t.sort((n,r)=>n.waiting.since-r.waiting.since)}function $D(e,t){if(e.length===0)return null;const n=e.findIndex(r=>r.id===t);return e[(n+1)%e.length]}function OD(e){const t=new Set;for(const n of e)n.state==="active"&&t.add(n.sessionId);return t.size}function Oh(e,t){return`${e}@${t.since}`}function gR(e,t){if(!e.tool)return null;const{name:n,preview:r}=e.tool,a=new RegExp(`\\b${n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`,"i").test(t);return r?a?r:`${n} · ${r}`:a?null:n}function LD(e){const t=e.message||"Needs your permission",n=gR(e,t);return n?`${t}
|
|
60
|
+
Likely on: ${n}`:t}function PD(e,t,n,r=!0){if(!r)return[];if(n)return[];const a=[];for(const l of e){if(!br(l.waiting))continue;const c=Oh(l.id,l.waiting);t.has(c)||a.push({key:c,title:l.label,body:LD(l.waiting),sessionId:l.id})}return a}function DD(e,t,n){const r=new Set;for(const l of e)r.add(Oh(l.id,l.waiting));const a=new Set;for(const l of n)r.has(l)&&a.add(l);for(const l of t)a.add(l.key);return a}function zp(e){return new Set(e.map(t=>Oh(t.id,t.waiting)))}function FD(e,t){return e!==t}function qD(e,t){return!e&&t!=null}function BD(e,t){return e!==null&&t!=null}function Dt(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 ol(e,t,n){const r=(t??n)-e;if(r<1e3)return`${Math.max(0,r)}ms`;const a=Math.floor(r/1e3);if(a<60)return`${a}s`;const l=Math.floor(a/60),c=a%60;return`${l}m ${String(c).padStart(2,"0")}s`}function yR(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 q0(e,t){const n=typeof e=="string"?e.trim():"",r=typeof t=="string"?t.trim():"";return{face:n||r||void 0,tooltip:r||n||void 0}}const zD=1;function HD(){const e=[];let t=0;function n(){let r;for(const a of e)(!r||a.layer>r.layer||a.layer===r.layer&&a.seq>r.seq)&&(r=a);return r}return{push(r,a=0,l="dialog"){const c={dismiss:r,layer:a,kind:l,seq:t++};return e.push(c),()=>{const u=e.indexOf(c);u!==-1&&e.splice(u,1)}},dismissTop(){const r=n();return r?(r.dismiss(),!0):!1},isTop(r){const a=n();return a!=null&&a.dismiss===r},depth(){return e.length},dialogDepth(){return e.filter(r=>r.kind==="dialog").length}}}const $c=HD(),UD=e=>e==="Escape";function WD(e){return e.overlayOpen?"dismiss":e.typing?"blur":"clear-selection"}function vN(e){return String(e.tagName??"").toUpperCase()==="BODY"}function VD(e,t){return!e||!e.isConnected||vN(e)?!1:t==null||vN(t)}const xN="a[href], button, input, select, textarea, [tabindex]";function GD(e){return!e||e.disabled||e.rendered===!1?!1:(e.tabIndex??0)>=0}function KD(e){if(!e||!e.overflowing||e.hasFocusable)return!1;const t=String(e.overflow??"").toLowerCase();return t==="auto"||t==="scroll"}function YD({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 Lh(e){return e.ctrlKey||e.metaKey||e.altKey}const XD=new Set(["button","checkbox","color","file","image","radio","range","reset","submit"]),ZD=new Set(["INPUT","TEXTAREA","SELECT","OPTION","BUTTON","SUMMARY","A"]),QD=new Set(["button","checkbox","combobox","link","listbox","menu","menubar","menuitem","menuitemcheckbox","menuitemradio","option","radio","searchbox","slider","spinbutton","switch","tab","textbox","treeitem"]);function B0(e){return typeof e.tagName=="string"?e.tagName.toUpperCase():""}function JD(e){return B0(e)==="BUTTON"?!0:(typeof e.role=="string"?e.role.trim().toLowerCase():"").split(/\s+/).includes("button")}function z0(e){if(!e)return!1;if(e.isContentEditable)return!0;const t=B0(e);return t==="TEXTAREA"?!0:t!=="INPUT"?!1:!XD.has(String(e.type??"text").toLowerCase())}function e6(e,t){if(!e)return!1;if(z0(e))return!0;if(t!=null&&t.length===1&&t!==" "&&e.pointerFocused&&JD(e))return!1;if(ZD.has(B0(e)))return!0;const n=typeof e.role=="string"?e.role.trim().toLowerCase():"";return n!==""&&n.split(/\s+/).some(r=>QD.has(r))}function t6({key:e,modalOpen:t,sheetOpen:n}){return t?!(e==="?"&&n):!1}function n6({appModal:e,dialogDepth:t}){return e||t>0}function wR(e){return e?Array.from(e.querySelectorAll("*")).filter(t=>{if(t.matches(xN))return GD({disabled:t.disabled,tabIndex:t.tabIndex,rendered:t.getClientRects().length>0});const n=t.scrollHeight>t.clientHeight;return n&&KD({overflowing:n,overflow:getComputedStyle(t).overflowY,hasFocusable:t.querySelector(xN)!=null})}):[]}function r6(e,t){const n=wR(e);if(!t||!e.contains(t)||n.includes(t))return n;const r=n.findIndex(a=>(t.compareDocumentPosition(a)&Node.DOCUMENT_POSITION_FOLLOWING)!==0);return r===-1?[...n,t]:[...n.slice(0,r),t,...n.slice(r)]}function sn(e,t={}){const{focusRef:n,layer:r,popover:a}=t,l=a?"popover":"dialog",c=x.useRef(null),u=x.useRef(e);u.current=e;const f=x.useRef(null);f.current===null&&(f.current=()=>u.current());const p=f.current;return x.useEffect(()=>$c.push(p,r,l),[p,r,l]),x.useEffect(()=>{var m;const h=document.activeElement;return(m=(n==null?void 0:n.current)??wR(c.current)[0])==null||m.focus(),()=>{VD(h,document.activeElement)&&h.focus()}},[]),x.useEffect(()=>{const h=m=>{var b;if(m.key!=="Tab"||Lh(m))return;const y=c.current;if(!y)return;const w=document.activeElement;if(!(w!=null&&y.contains(w))&&!$c.isTop(p))return;const k=r6(y,w),j=YD({count:k.length,index:w?k.indexOf(w):-1,shiftKey:m.shiftKey});j.kind!=="allow"&&(m.preventDefault(),j.kind==="focus"&&((b=k[j.index])==null||b.focus()))};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[p]),c}function s6(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 yr(e){return e.toLocaleString()}function a6(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(2)} MB`}const o6=60;function i6(e,t=o6){if(e.length<=t)return e;const n=e.slice(e.length-(t-1)),r=n.search(/[/\\]/);return"…"+(r===-1?n:n.slice(r))}function l6({agent:e,onClose:t}){var y;const n=x.useRef(null),r=sn(t,{focusRef:n}),a=e.context,l=e.usage,c=(a==null?void 0:a.currentContextTokens)??0,u=fR(e.contextWindow,e.model),f=Math.min(100,c/u*100),p=Vn(e),h=e.provider==="codex"?l.inputTokens+l.outputTokens:l.inputTokens+l.outputTokens+l.cacheReadTokens+l.cacheCreateTokens,m=s6(e.provider);return o.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:o.jsxs("div",{ref:r,className:"modal ctx-modal",onClick:w=>w.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Context breakdown",children:[o.jsxs("header",{className:"ctx-modal-head",children:[o.jsxs("div",{children:[o.jsxs("div",{className:"ctx-modal-title",children:["Context · ",e.label]}),o.jsx("div",{className:"ctx-modal-sub",children:m.subtitle})]}),o.jsx("button",{type:"button",ref:n,className:"glyph-btn ctx-modal-close",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),o.jsxs("section",{className:"ctx-window-row",children:[o.jsx("div",{className:"ctx-window-bar",role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(f),children:o.jsx("div",{className:"ctx-window-fill",style:{transform:`scaleX(${Math.min(100,Math.max(0,f))/100})`}})}),o.jsxs("div",{className:"ctx-window-meta",children:[o.jsxs("span",{className:"ctx-window-pct",children:[f.toFixed(1),"%"]}),o.jsxs("span",{children:[yr(c)," / ",yr(u)," tok (",m.windowScope,")"]})]})]}),o.jsx("h3",{className:"ctx-section-title",children:"Cumulative usage · whole session"}),o.jsxs("div",{className:"ctx-grid",children:[o.jsx(qr,{label:"input tokens",val:yr(l.inputTokens)}),o.jsx(qr,{label:"output tokens",val:yr(l.outputTokens)}),o.jsx(qr,{label:"cache reads",val:yr(l.cacheReadTokens)}),o.jsx(qr,{label:"cache writes",val:yr(l.cacheCreateTokens)}),o.jsx(qr,{label:"cumulative total",val:yr(h)}),o.jsx(qr,{label:"estimated cost",val:ct(p.total),accent:!0})]}),o.jsx("h3",{className:"ctx-section-title",children:"Transcript composition"}),m.compositionCounted?o.jsxs("div",{className:"ctx-grid",children:[o.jsx(qr,{label:"user messages",val:yr((a==null?void 0:a.msgsUser)??0)}),o.jsx(qr,{label:"assistant messages",val:yr((a==null?void 0:a.msgsAssistant)??0)}),o.jsx(qr,{label:"tool uses",val:yr((a==null?void 0:a.toolUses)??0)}),o.jsx(qr,{label:"tool results",val:yr((a==null?void 0:a.toolResults)??0)}),o.jsx(qr,{label:"system-reminders",val:yr((a==null?void 0:a.systemReminders)??0)})]}):o.jsx("div",{className:"ctx-empty",children:m.compositionUncounted}),o.jsx("h3",{className:"ctx-section-title",children:m.memoryHeading}),(((y=a==null?void 0:a.memoryFiles)==null?void 0:y.length)??0)===0?o.jsx("div",{className:"ctx-empty",children:m.memoryEmpty}):o.jsx("ul",{className:"ctx-md-list",children:a.memoryFiles.map(w=>o.jsxs("li",{children:[o.jsx("span",{className:"ctx-md-path",title:w.path,children:i6(w.path)}),o.jsx("span",{className:"ctx-md-size",children:a6(w.bytes)})]},w.path))})]})})}function qr({label:e,val:t,accent:n}){return o.jsxs("div",{className:`ctx-row${n?" accent":""}`,children:[o.jsx("span",{className:"ctx-row-label",children:e}),o.jsx("span",{className:"ctx-row-val",children:t})]})}function c6({currentContextTokens:e,modelId:t,contextWindow:n,size:r=26,onClick:a}){const l=fR(n,t),c=Math.min(1,e/l),u=r/2-3,f=r/2,p=2*Math.PI*u,h=p*c,m=c>.9?"var(--err)":c>.7?"var(--inflight)":"var(--accent)";return o.jsx("button",{type:"button",className:"ctx-donut",onClick:a,title:`context: ${e.toLocaleString()} / ${l.toLocaleString()} (${(c*100).toFixed(1)}%)`,"aria-label":`Context ${Math.round(c*100)}% of ${l.toLocaleString()} tokens — show breakdown`,children:o.jsxs("svg",{width:r,height:r,viewBox:`0 0 ${r} ${r}`,"aria-hidden":"true",children:[o.jsx("circle",{cx:f,cy:f,r:u,stroke:"var(--line)",strokeWidth:"2.5",fill:"none"}),o.jsx("circle",{cx:f,cy:f,r:u,stroke:m,strokeWidth:"2.5",fill:"none",strokeDasharray:`${h} ${p-h}`,strokeDashoffset:p/4,strokeLinecap:"round",style:{transition:"var(--ctx-arc-transition)"}}),o.jsx("text",{x:f,y:f+3,textAnchor:"middle",fontSize:"8",fill:"var(--text)",fontWeight:"600",children:Math.round(c*100)})]})})}const bN=new Map;function vR(e){let t=bN.get(e);return t||(t={now:Date.now(),listeners:new Set,timer:null},bN.set(e,t)),t}function u6(e,t){const n=vR(e);return n.listeners.add(t),n.timer===null&&(n.now=Date.now(),n.timer=setInterval(()=>{n.now=Date.now();for(const r of n.listeners)r()},e)),()=>{n.listeners.delete(t),n.listeners.size===0&&n.timer!==null&&(clearInterval(n.timer),n.timer=null)}}function d6(e){return vR(e).now}const kN=new Map,NN=new Map;function gl(e=1e3){let t=kN.get(e);t||(t=r=>u6(e,r),kN.set(e,t));let n=NN.get(e);return n||(n=()=>d6(e),NN.set(e,n)),x.useSyncExternalStore(t,n,n)}function Ph(e){const t=e.recap;if(e.kind!=="root"||!t||e.state==="active"||e.closedAt!=null)return null;for(const n of e.prompts)if(n.at>t.at)return null;return t}const h6="1",_N="agent-dag.schema",f6=["agent-dag.layout","agent-dag.viewport"];function ms(e){if(typeof window>"u")return null;try{return window.localStorage.getItem(e)}catch{return null}}function p6(e,t=h6){let n=null;try{n=e.getItem(_N)}catch{return[]}if(n===t)return[];const r=[];if(n!==null)for(const a of f6)try{e.getItem(a)!==null&&(e.removeItem(a),r.push(a))}catch{}try{e.setItem(_N,t)}catch{}return r}const xR="agent-dag.recapsDismissed",SN=200;function m6(){const e=ms(xR);if(!e)return[];try{const t=JSON.parse(e);return Array.isArray(t)?t.filter(n=>typeof n=="string"):[]}catch{return[]}}let il=new Set(m6());const Kx=new Set;let bR=0;function kR(e){return Kx.add(e),()=>{Kx.delete(e)}}function NR(e){if(il=e,bR++,typeof window<"u")try{const t=Array.from(e);window.localStorage.setItem(xR,JSON.stringify(t.length>SN?t.slice(-SN):t))}catch{}for(const t of Kx)t()}function _R(e,t){return`${e}@${t}`}function g6(e){return il.has(e)}function y6(e){if(il.has(e))return;const t=new Set(il);t.add(e),NR(t)}function w6(e){const t=new Set(il);t.delete(e)||t.add(e),NR(t)}function v6(e){return x.useSyncExternalStore(kR,()=>e!=null&&il.has(e),()=>!1)}function H0(e){return`recap:${e}`}function x6(e){return e.startsWith("recap:")}function b6(){return x.useSyncExternalStore(kR,()=>bR,()=>0)}function k6(e){const t=new Map;for(const n of e){if(n.kind!=="subagent"||n.exitAt!=null)continue;let r=t.get(n.sessionId);r||(r={total:0,live:0,done:0,err:0,failed:0},t.set(n.sessionId,r)),r.total+=1,n.state==="active"?r.live+=1:n.state==="err"?r.err+=1:r.done+=1;for(const a of n.tools)a.ok===!1&&(r.failed+=1)}return t}function SR(e){return[`${e.total} ${e.total===1?"subagent":"subagents"}`,e.live>0?`${e.live} live`:null,e.done>0?`${e.done} done`:null,e.err>0?`${e.err} err`:null].filter(Boolean).join(" · ")}function jR(e){return e.live>0?`→ ${e.total} · ${e.live} live`:`→ ${e.total} · done`}function N6(e,t,n){const r=e.kind==="root"?e.waiting:null;if(r&&br(r))return{tone:"warn",long:n.sayWaiting(r),short:r.kind==="permission"?"Needs you":"Asked you"};if(r&&r.kind==="idle"){const l=n.sayWaiting(r);return{tone:"idle",long:l,short:l}}const a=e.tools.filter(l=>l.ok===!1).length;if(a>0)return{tone:"err",long:`${a} tool ${a===1?"call":"calls"} failed`,short:`${a} failed`};if(t&&t.total>0)return{tone:"muted",long:SR(t),short:jR(t)};if(e.state==="active")for(let l=e.tools.length-1;l>=0;l--){const c=e.tools[l];if(c.endedAt!=null)continue;const{name:u,subject:f}=n.describeCall(c);return{tone:"muted",long:f?`${u} · ${f}`:u,short:u}}return null}function Yx(e){return e==="active"?"live":e==="done"?"done":"err"}const Dh={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"}},_6=Object.fromEntries(Object.entries(Dh).map(([e,t])=>[e,t.category])),S6=Object.fromEntries(Object.entries(Dh).map(([e,t])=>[e,t.emoji])),j6=Object.fromEntries(Object.entries(Dh).map(([e,t])=>[e,t.label])),E6=new Set(Object.entries(Dh).filter(([,e])=>e.shell).map(([e])=>e)),jN={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",..._6};function ER(e){return e.startsWith("mcp__")?"mcp":Object.hasOwn(jN,e)?jN[e]:"other"}const C6=/\btools\.exec_command\s*\(\s*\{[^{}]*?\bcmd\s*:\s*(["'`])((?:\\.|(?!\1)[^\\])*)\1/,T6=/\btools\.([A-Za-z_$][\w$]*)\s*\(/;function A6(e){if(typeof e!="string"||!e)return null;const t=C6.exec(e);if(t){const r=R6(t[2]);if(r.trim())return r}const n=T6.exec(e);return n?n[1]:null}function R6(e){return e.replace(/\\(["'`\\nrt])/g,(t,n)=>n==="n"?`
|
|
61
|
+
`:n==="r"?"\r":n==="t"?" ":n)}const CR=600,M6=4,I6=36,Xx=16,$6=60,O6=6,EN=220,L6=96,P6=28,CN={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:"📡",...S6};function TN(e){return e.startsWith("mcp__")?"🔌":Object.hasOwn(CN,e)?CN[e]:"✨"}const AN={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 TR(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 TR(n[1]);for(;;){const l=t.match(/^([A-Z_][A-Z0-9_]*=\S*)\s+/);if(!l)break;t=t.slice(l[0].length)}t=t.replace(/^sudo(?:\s+-\S+)*\s+/,""),t=t.replace(/^(?:time|nohup|xargs)\s+/,"");const r=t.match(/^([^\s|;&<>(]+)/);if(!r)return null;let a=r[1];return/^[A-Za-z0-9_][\w.+-]*$/.test(a.replace(/^.*[/\\]/,""))?(a=a.replace(/^.*[/\\]/,""),a=a.replace(/\.(exe|cmd|bat|ps1)$/i,""),a||null):null}function D6(e){if(typeof e=="string")return e;if(!e||typeof e!="object")return null;const t=e;if(typeof t.script=="string"){const n=A6(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 r=n.findIndex(a=>/^(-Command|-c)$/i.test(a));if(r>=0&&r+1<n.length)return n[r+1]}return n.join(" ")}return typeof t.script=="string"?t.script:null}const F6=new Set(["Bash","PowerShell",...E6]);function q6(e,t){return Math.max(L6,61+[...t].length*6.8)}function B6(e,t){if(!F6.has(e))return null;const n=D6(t);if(!n)return null;const r=TR(n);return r?{emoji:Object.hasOwn(AN,r)?AN[r]:"⚙️",label:r,category:"shell",detail:n}:null}const z6=new Set(["Read","Write","Edit","MultiEdit","NotebookEdit","LS","Glob","apply_patch"]),RN={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:"🗄️"},MN={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 H6(e){const n=e.replace(/\\/g,"/").replace(/\/+$/,""),r=n.lastIndexOf("/");return r>=0?n.slice(r+1):n}function U6(e){const t=e.toLowerCase();if(Object.hasOwn(MN,t))return MN[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 r=t.slice(n+1);if(Object.hasOwn(RN,r))return RN[r]}return"📄"}function W6(e,t){if(!t||typeof t!="object")return null;const n=t;if(e==="apply_patch"&&typeof n.patch=="string"){const r=n.patch.match(/^\*\*\* (?:Update|Add|Delete) File: (.+)$/m);return r?r[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 V6(e,t){if(!z6.has(e))return null;const n=W6(e,t);if(!n)return null;const r=H6(n);return r?{emoji:e==="LS"?"📂":U6(r),label:r,category:"file",detail:n}:null}const IN={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 U0(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 G6(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 AR(e){const t=e.toLowerCase();return Object.hasOwn(IN,t)?IN[t]:void 0}function K6(e,t){const n=U0(e);if(!n)return null;const{server:r,method:a}=n;if(!a)return null;const l=AR(r);return{emoji:(l==null?void 0:l.emoji)??"🔌",label:a,category:"mcp",detail:l?`${l.name} · ${a}`:`${r} · ${a}`}}function RR(e,t){return B6(e,t)??V6(e,t)??K6(e)}function Y6(e,t){var n;return((n=RR(e,t))==null?void 0:n.label)??null}const $N=j6,ON=18;function Cc(e){const t=[...e];return t.length<=ON?e:t.slice(0,ON-1).join("")+"…"}function W0(e){const t=U0(e);if(t){const r=AR(t.server);return r?{emoji:r.emoji,label:Cc(r.name)}:{emoji:"🔌",label:Cc(t.server),hue:G6(t.server)}}const n=Object.hasOwn($N,e)?$N[e]:"";return n?{emoji:TN(e),label:Cc(n)}:{emoji:TN(e),label:Cc(e)}}function X6(e){let t=null,n="";for(const r of e){const a=U0(r);if(a){if(!a.server)return null;if(t===null)t=a.server,n=r;else if(a.server!==t)return null}}return t===null?null:W0(n)}function Z6(e){return e.endedAt==null?"inflight":e.ok===!1?"err":"done"}function Q6(e,t){if(t==null)return 1;const n=e-t;return n<0?1:Math.max(0,1-n/CR)}function J6(e,t){const n=[],r=new Set;for(let a=e.length-1;a>=0&&n.length<t;a--){const l=e[a];r.has(l.id)||(r.add(l.id),n.push(l))}return n.reverse()}function eF(e,t,n,r,a,l){const c=[];for(const u of e.values()){if(!t.has(u.id)||u.exitAt!=null&&l-u.exitAt>CR)continue;const f=r.get(u.id)??n.get(u.id);if(!f)continue;const p=J6(u.tools,M6);if(p.length===0)continue;const h=u.exitAt??null,m=a.get(u.id),y=Math.max((m==null?void 0:m.width)??EN,EN),w=(m==null?void 0:m.height)??130,_=f.x,k=f.y,j=_+y,b=k+w/2;p.forEach((S,E)=>{const C=E*I6,T=_+y+$6,R=k+O6+C,A=Q6(l,h),q=S.inputPreview??"",F=Z6(S),O=A<.999,H=W0(S.name);c.push({id:`${u.id}::${S.id}`,toolId:S.id,agentId:u.id,toolName:S.name,name:H.label,emoji:H.emoji,status:F,category:ER(S.name),mcpHue:H.hue,inputPreview:q,fade:A,fading:O,worldX:T,worldY:R,anchorX:j,anchorY:b,spawnDx:j-T,spawnDy:b-(R+Xx)});const K=RR(S.name,S.input);if(K){const X=q6(S.name,H.label),I=T+X+P6,Z=R,W=T+X,$=R+Xx;c.push({id:`sub:${u.id}::${S.id}`,toolId:S.id,agentId:u.id,toolName:S.name,name:Cc(K.label),emoji:K.emoji,isSub:!0,status:F,category:K.category,inputPreview:K.detail??q,fade:A,fading:O,worldX:I,worldY:Z,anchorX:W,anchorY:$,spawnDx:W-I,spawnDy:0})}})}return c}function tF({agents:e,visibleAgentIds:t,positions:n,pinned:r,measured:a,spotlight:l,hiddenCategories:c,now:u,onOpenTool:f}){const p=eF(e,t,n,r,a,u),h=c&&c.size>0?p.filter(m=>!c.has(m.category)):p;return o.jsx(nF,{bursts:h,spotlight:l,onOpenTool:f})}function nF({bursts:e,spotlight:t,onOpenTool:n}){const{x:r,y:a,zoom:l}=JA();return o.jsxs("div",{className:"tool-bursts-layer","aria-hidden":!0,children:[o.jsx("svg",{className:"tool-bursts-svg",children:e.map(c=>{const u=c.anchorX*l+r,f=c.anchorY*l+a,p=(c.worldX+6)*l+r,h=(c.worldY+Xx)*l+a,m=Math.max(1,p-u),y=Math.min(1,Math.abs(h-f)/m),w=u+m*(.55-.22*y),_=t!=null&&!t.has(c.agentId),k=c.fade*(_?.14:1);return o.jsx("path",{d:`M ${u} ${f} Q ${w} ${f}, ${p} ${h}`,className:`tool-conn status-${c.status}${c.fading?" fading":""}`,opacity:k},`l:${c.id}`)})}),e.map(c=>o.jsx(sF,{b:c,x:r,y:a,zoom:l,dim:t!=null&&!t.has(c.agentId),onOpenTool:n},c.id))]})}function rF(e,t){const n=e.b,r=t.b;return e.x===t.x&&e.y===t.y&&e.zoom===t.zoom&&e.dim===t.dim&&e.onOpenTool===t.onOpenTool&&n.id===r.id&&n.toolId===r.toolId&&n.worldX===r.worldX&&n.worldY===r.worldY&&n.spawnDx===r.spawnDx&&n.spawnDy===r.spawnDy&&n.status===r.status&&n.fading===r.fading&&n.category===r.category&&n.mcpHue===r.mcpHue&&n.isSub===r.isSub&&n.emoji===r.emoji&&n.name===r.name&&n.toolName===r.toolName&&n.inputPreview===r.inputPreview}const sF=x.memo(function({b:t,x:n,y:r,zoom:a,dim:l,onOpenTool:c}){const u=t.worldX*a+n,f=t.worldY*a+r,p={left:`${u}px`,top:`${f}px`,transform:`scale(${a})`,transformOrigin:"left top","--spawn-dx":`${t.spawnDx}px`,"--spawn-dy":`${t.spawnDy}px`},h=t.isSub?`${t.toolName} · ${t.name}`:t.toolName,m=t.inputPreview?`${h} · ${t.inputPreview}`:h,y=c!=null,w=t.mcpHue!=null?{"--mcp-hue":t.mcpHue}:{},_=l?" dim":"";return o.jsx("div",{className:"tool-burst-wrap",style:p,children:o.jsxs("div",{className:`tool-burst cat-${t.category}${t.mcpHue!=null?" mcp-hue":""} status-${t.status}${t.fading?" fading":""}${y?" clickable":""}${t.isSub?" sub":""}${_}`,style:w,title:m,onClick:y?()=>c(t.toolId):void 0,children:[o.jsx("span",{className:"tb-emoji",children:t.emoji}),o.jsx("span",{className:"tb-name",children:t.name}),t.status==="inflight"&&o.jsx("span",{className:"tb-spin"}),t.status==="done"&&o.jsx("span",{className:"tb-mark done",children:"✓"}),t.status==="err"&&o.jsx("span",{className:"tb-mark err",children:"×"})]})})},rF);function MR({kind:e}){return o.jsxs("svg",{className:"state-mark","data-kind":e,viewBox:"0 0 10 10",width:"10",height:"10","aria-hidden":"true",focusable:"false",children:[e==="live"&&o.jsx("circle",{cx:"5",cy:"5",r:"3.2",fill:"currentColor"}),e==="done"&&o.jsx("path",{d:"M2.2 5.3l1.9 1.9 3.8-4.4",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),e==="err"&&o.jsx("path",{d:"M2.8 2.8l4.4 4.4M7.2 2.8l-4.4 4.4",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",fill:"none"})]})}function V0(){return o.jsxs("svg",{className:"alert-mark",viewBox:"0 0 12 12",width:"12",height:"12","aria-hidden":"true",focusable:"false",children:[o.jsx("path",{d:"M6 1.4l4.7 8.3H1.3z",stroke:"currentColor",strokeWidth:"1.3",strokeLinejoin:"round",fill:"none"}),o.jsx("path",{d:"M6 4.6v2.4",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round"}),o.jsx("circle",{cx:"6",cy:"8.35",r:"0.72",fill:"currentColor"})]})}function LN(e,t){const n=ml(t);if(!n)return`model: ${t}
|
|
62
|
+
no published rate in this build — the tokens are counted, the dollars are not`;const r=h=>h.toLocaleString(),a=h=>`$${h}/MTok`,l=$o(e,t),c=dR(e,n),u=c.tokens1h>0?[`cache w5m${r(c.tokens5m).padStart(14)} × ${a(n.cacheWrite).padEnd(11)} = ${ct(c.usd5m)}`,`cache w1h${r(c.tokens1h).padStart(14)} × ${a(n.cacheWrite1h??n.cacheWrite).padEnd(11)} = ${ct(c.usd1h)}`]:[`cache w ${r(c.tokens5m).padStart(14)} × ${a(n.cacheWrite).padEnd(11)} = ${ct(c.usd5m)}`],f=hR(e,t),p=f===e.inputTokens?"input":"uncached";return[`model: ${t}`,`${p.padEnd(9)}${r(f).padStart(14)} × ${a(n.input).padEnd(11)} = ${ct(l.input)}`,`output ${r(e.outputTokens).padStart(14)} × ${a(n.output).padEnd(11)} = ${ct(l.output)}`,`cache r ${r(e.cacheReadTokens).padStart(14)} × ${a(n.cacheRead).padEnd(11)} = ${ct(l.cacheRead)}`,...u,"─────────────────────────────────────────",`total = ${ct(l.total)}`].join(`
|
|
63
|
+
`)}function PN(e){const t=au(e);return t.length<=1?LN(e.usage,e.model):[...t.map(n=>LN(n.usage,n.model)),"═════════════════════════════════════════",`all models = ${ct(Vn(e).total)}`].join(`
|
|
64
|
+
`)}function aF({data:e,selected:t}){var j,b;const n=["agent-node",`state-${e.state}`,e.synthetic?"synthetic":"",t?"selected":""].filter(Boolean).join(" "),r=e.tools.filter(S=>!S.endedAt).length,a=e.tools.filter(S=>S.ok===!1).length,l=hh(e.sessionId),c=((j=e.context)==null?void 0:j.currentContextTokens)??0,u=e.kind==="root"&&c>0,f=e.sessionTitle?e.cwd?`${e.cwd}
|
|
65
|
+
${e.sessionTitle}`:e.sessionTitle:e.cwd,p=mR(e),h=p.length>0?`${e.model}
|
|
66
|
+
spend on this card also covers:
|
|
67
|
+
${p.join(`
|
|
68
|
+
`)}`:e.model,m=q0(e.sessionName,e.sessionTitle),y=Ph(e),w=y?_R(e.sessionId,y.at):null,_=v6(w),k=y!=null&&!_;return o.jsxs("div",{className:n,style:{"--session-hue":l},children:[o.jsx("span",{className:"accent-stripe"}),o.jsx(zo,{type:"target",position:Ke.Left,style:{background:"transparent",border:"none"}}),o.jsxs("div",{className:"head",children:[o.jsxs("div",{className:"title",children:[o.jsx(cF,{state:e.state}),o.jsx("span",{className:"label",title:f,children:e.label}),e.synthetic&&o.jsx("span",{className:"synth-tag",title:"No SessionStart captured — synthesised",children:"?"}),y&&w&&o.jsx("button",{type:"button",className:"glyph-btn recap-pin","aria-label":"Claude Code's recap","aria-expanded":k,title:k?"Hide the recap":"Show Claude Code's recap",onClick:S=>{S.stopPropagation(),w6(w)},children:o.jsx(Vc,{})})]}),o.jsxs("div",{className:"head-right",children:[u&&e.onOpenContext&&o.jsx(c6,{currentContextTokens:c,modelId:e.model,contextWindow:e.contextWindow,onClick:()=>e.onOpenContext(e.sessionId)}),o.jsxs("div",{className:"time",title:e.synthetic?`The deck joined this session after it began, so it has run at least this long — first seen ${new Date(e.startedAt).toLocaleTimeString()}`:`Started ${new Date(e.startedAt).toLocaleTimeString()}`,children:[e.synthetic?"≥ ":"",o.jsx(lF,{start:e.startedAt,end:e.endedAt})]})]})]}),o.jsxs("div",{className:"sub",children:[e.kind==="root"?"session":"subagent",e.childCount>0&&o.jsxs("span",{className:"spawn-badge",title:`${e.childCount} subagents spawned`,children:["→ ",e.childCount]}),e.cwdBasename&&e.kind==="subagent"?` · ${e.cwdBasename}`:"",e.model?o.jsxs("span",{className:"model-chip","data-family":$h(e.model),title:h,children:[qa(e.model),p.length>0?` +${p.length}`:""]}):e.provider==="codex"?o.jsx("span",{className:"model-chip",title:"OpenAI Codex — no model reported yet",children:"Codex"}):null]}),e.kind==="root"&&m.face&&o.jsx("div",{className:"session-name",title:m.tooltip,children:m.face}),e.waiting&&o.jsx(hF,{waiting:e.waiting}),(()=>{const S=ID(e);return S?o.jsxs("div",{className:"approval-blind-row",title:S.detail,children:[o.jsx("span",{className:"approval-blind-dot","aria-hidden":!0}),o.jsx("span",{className:"approval-blind-said",children:S.label})]}):null})(),(e.tools.length>0||(((b=e.outputs)==null?void 0:b.length)??0)>0)&&o.jsx(fF,{tools:e.tools,outputs:e.outputs}),o.jsxs("div",{className:"meta",children:[o.jsxs("span",{children:[o.jsx("b",{children:e.toolCount})," tools"]}),a>0&&o.jsxs("span",{className:"failed-meta",title:`${a} tool ${a===1?"call":"calls"} returned an error`,children:[o.jsx("b",{children:a})," err"]}),r>0&&o.jsxs("span",{className:"inflight-meta",children:[o.jsx("b",{children:r})," in-flight"]}),e.usage.inputTokens+e.usage.outputTokens>0&&o.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:[o.jsx("b",{children:Dt(e.usage.inputTokens+e.usage.outputTokens)})," tok"]}),e.model&&(()=>{const S=ml(e.model),E=Vn(e),C=Wc(e);if(!S&&E.total<=0)return e.usage.inputTokens+e.usage.outputTokens<=0?null:o.jsx("span",{className:"cost-unpriced",title:PN(e),children:Wi});if(E.total<=0)return null;const T=Math.max(0,((e.endedAt??Date.now())-e.startedAt)/1e3),R=e.state==="active"&&!e.synthetic?F0(E.total,T):null,A=PN(e)+(R?`
|
|
69
|
+
burn: ${R}`:"");return o.jsx("span",{className:"cost-meta",title:A,children:o.jsxs("b",{children:[ct(E.total),C>0?"+":""]})})})()]}),o.jsx(iF,{data:e,title:e.kind==="root"?m.face:void 0}),o.jsx(zo,{type:"source",position:Ke.Right,style:{background:"transparent",border:"none"}})]})}const oF=x.memo(aF);function iF({data:e,title:t}){const n=e.kind==="root"&&br(e.waiting),r=N6(e,e.branch,{sayWaiting:G0,describeCall:a=>({name:W0(a.name).label,subject:Y6(a.name,a.input)})});return o.jsxs("div",{className:"lod-face","data-kind":e.kind,"data-alarm":n?"":void 0,"data-signal":r?"":void 0,"aria-hidden":!0,children:[o.jsxs("div",{className:"lod-id",children:[o.jsx(MR,{kind:Yx(e.state)}),o.jsx("span",{className:"lod-name",children:e.label}),r&&o.jsx("span",{className:"lod-inline","data-tone":r.tone,children:r.short}),n&&o.jsx(V0,{})]}),t&&o.jsx("div",{className:"lod-title",children:t}),r&&o.jsxs("div",{className:"lod-signal","data-tone":r.tone,children:[o.jsx("span",{className:"lod-long",children:r.long}),o.jsx("span",{className:"lod-short",children:r.short})]})]})}function lF({start:e,end:t}){const n=gl(1e3);return o.jsx(o.Fragment,{children:ol(e,t,n)})}function ll(e){return e==="active"?"live":e==="done"?"done":"err"}function cF({state:e}){return o.jsx("span",{className:`state-pill state-${e}`,children:ll(e)})}function cl(e){return e.message?e.message:e.kind==="permission"?"Needs your permission":"Waiting for your input"}function uF(e,t=Date.now(),n=!1){const r=e.tools.filter(l=>l.ok===!1).length,a=Vn(e,t).total;return[e.label,e.kind==="root"?"session":"subagent",ll(e.state),br(e.waiting)?cl(e.waiting):null,e.model?qa(e.model):null,`${e.toolCount} ${e.toolCount===1?"tool":"tools"}`,r>0?`${r} failed`:null,a>0?`${ct(a)}${Wc(e,t)>0?"+":""}`:null,n?"selected":null].filter(Boolean).join(", ")}function dF(e,t){const n=gR(e,t);return n?`Likely on: ${n}`:null}function G0(e){return e.kind==="idle"?"Your turn":cl(e)}function hF({waiting:e}){const t=gl(1e3),n=br(e),r=cl(e);return o.jsxs("div",{className:n?"waiting-row permission":"waiting-row idle",title:`${r}
|
|
70
|
+
Blocked for ${ol(e.since,void 0,t)} — the answer goes in the terminal, not here.`,children:[n?o.jsx("span",{className:"ap-pulse","aria-hidden":!0}):o.jsx("span",{className:"waiting-dot","aria-hidden":!0}),o.jsx("span",{className:"waiting-said",children:G0(e)}),o.jsx("b",{children:ol(e.since,void 0,t)})]})}function Vc(){return o.jsxs("svg",{className:"recap-glyph",viewBox:"0 0 12 12",width:"10",height:"10","aria-hidden":"true",focusable:"false",children:[o.jsx("path",{d:"M3.3 3.3l5.4 5.4M8.7 3.3l-5.4 5.4",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",fill:"none"}),o.jsx("circle",{cx:"6",cy:"1.2",r:"1.05",fill:"currentColor"}),o.jsx("circle",{cx:"6",cy:"10.8",r:"1.05",fill:"currentColor"}),o.jsx("circle",{cx:"1.2",cy:"6",r:"1.05",fill:"currentColor"}),o.jsx("circle",{cx:"10.8",cy:"6",r:"1.05",fill:"currentColor"})]})}function fF({tools:e,outputs:t}){const n=gl(1e3),r=6e4,a=24,l=r/a,c=new Array(a).fill(0);let u=0;const f=E=>{const C=n-E;if(C<0||C>=r)return;const T=a-1-Math.floor(C/l);T>=0&&T<a&&(c[T]+=1,u+=1)};for(const E of e)f(E.startedAt);for(const E of t??[])f(E);const p=2,h=Math.max(0,...c),m=132,y=14,w=m/a,_=h/(l/1e3),k=e.filter(E=>n-E.startedAt>=0&&n-E.startedAt<r).length,j=u-k,b=[k>0?`${k} tool ${k===1?"call":"calls"}`:"",j>0?`${j} ${j===1?"block":"blocks"} of thinking and writing`:""].filter(Boolean),S=u===0?"nothing in the last 60s":`${b.join(" · ")} in last 60s · peak ${_.toFixed(1)}/s`;return o.jsxs("div",{className:"tool-spark-row",title:S,children:[o.jsx("svg",{className:"tool-spark",width:m,height:y,viewBox:`0 0 ${m} ${y}`,"aria-hidden":!0,children:c.map((E,C)=>{const T=E===0?1.5:Math.max(1.5,Math.min(1,E/p)*y),R=C===a-1&&E>0,q=`tool-spark-bar${E>0?" active":""}${R?" latest":""}`;return o.jsx("rect",{x:C*w+.4,y:y-T,width:Math.max(.5,w-1),height:T,rx:.8,className:q},R?`landed:${E}`:C)})}),o.jsx("span",{className:"tool-spark-label",children:"60s"})]})}function pF(e,t){return e?t==="gone"?"entering":t==="leaving"?"here":t:t==="gone"?"gone":"leaving"}function Hp(e){return e!=="gone"}function Up(e,t){const[n,r]=x.useState(()=>e?"here":"gone"),a=x.useRef(null);return x.useEffect(()=>{r(l=>pF(e,l))},[e]),x.useEffect(()=>{if(n==="leaving")return a.current=window.setTimeout(()=>r("gone"),t),()=>{a.current!=null&&window.clearTimeout(a.current)}},[n,t]),x.useEffect(()=>{n==="entering"&&r("here")},[n]),n}async function Ba(e,t=500){var r;if(!e)return!1;let n=!1;try{n=await Promise.race([((r=navigator.clipboard)==null?void 0:r.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}const mF=60,gF=6e3,hs=e=>e!=null&&typeof e=="object"&&!Array.isArray(e),ar=e=>typeof e=="string"?e:null;function Ho(e,t=""){if(e==null)return"(none)";if(typeof e=="string")return e;if(typeof e!="object")return String(e);const n=Array.isArray(e),r=n?e.map((l,c)=>[String(c),l]):Object.entries(e);if(r.length===0)return n?"[]":"{}";const a=[];for(const[l,c]of r){const u=n?`${t}-`:`${t}${l}:`;if(typeof c=="string"&&c.includes(`
|
|
71
|
+
`)){a.push(u);for(const f of c.split(`
|
|
72
|
+
`))a.push(`${t} ${f}`)}else if(c!==null&&typeof c=="object"){const f=Ho(c,`${t} `);f==="[]"||f==="{}"?a.push(`${u} ${f}`):a.push(u,f)}else a.push(`${u} ${c===void 0?"(none)":String(c)}`)}return a.join(`
|
|
73
|
+
`)}function yF(e){return e.lines??e.text.split(`
|
|
74
|
+
`).map(t=>({text:t}))}function wF(e,t){if(t)return{shown:e,cut:!1};const n=[];let r=0;for(const a of e){if(n.length===mF)return{shown:n,cut:!0};const l=gF-r;if(a.text.length>l)return n.push({...a,text:`${a.text.slice(0,Math.max(l,0))}…`}),{shown:n,cut:!0};n.push(a),r+=a.text.length+1}return{shown:n,cut:!1}}const An=(e,t,n=!1)=>({...e?{label:e}:{},text:t,...n?{err:!0}:{}}),or=(e,t)=>({label:e,text:t,inline:!0}),IR=(e,t)=>({label:e,text:t.map(n=>n.text).join(`
|
|
75
|
+
`),lines:t});function vF(e,t){return[...e.split(`
|
|
76
|
+
`).map(n=>({text:`- ${n}`,tone:"del"})),...t.split(`
|
|
77
|
+
`).map(n=>({text:`+ ${n}`,tone:"add"}))]}function xF(e){if(!Array.isArray(e)||e.length===0)return null;const t=[];for(const n of e){if(!hs(n)||!Array.isArray(n.lines))return null;t.push({text:`@@ -${n.oldStart},${n.oldLines} +${n.newStart},${n.newLines} @@`,tone:"ctx"});for(const r of n.lines){const a=String(r);t.push(a.startsWith("+")?{text:a,tone:"add"}:a.startsWith("-")?{text:a,tone:"del"}:{text:a})}}return t}function DN(e){if(typeof e=="string")return[An(void 0,e)];if(!hs(e))return[An(void 0,Ho(e))];const t=[],n=ar(e.type);n==="create"&&t.push(or("result","created the file"));const r=xF(e.structuredPatch);return r&&t.push(IR("applied",r)),e.userModified===!0&&t.push(or("note","the user changed it before it was applied")),t.length?t:[or("result",n==="update"?"updated the file":"done")]}function bF(e){const t=typeof e.offset=="number"?e.offset:null,n=typeof e.limit=="number"?e.limit:null;if(t==null&&n==null)return null;const r=t??1;return n!=null?`${r}–${r+n-1}`:`from ${r}`}function kF(e){if(typeof e=="string")return[An(void 0,e)];const t=hs(e)&&hs(e.file)?e.file:null,n=ar(t==null?void 0:t.content);if(t&&n!=null){const a=[],l=Number(t.numLines),c=Number(t.totalLines),u=Number(t.startLine);return Number.isFinite(l)&&Number.isFinite(c)&&c>0&&a.push(or("lines",l>=c?`all ${c}`:Number.isFinite(u)?`${u}–${u+l-1} of ${c}`:`${l} of ${c}`)),a.push(An("content",n)),a}const r=hs(e)?ar(e.type):null;return r&&r!=="text"?[or("result",`${/^[aeiou]/i.test(r)?"an":"a"} ${r} file`)]:[An(void 0,Ho(e))]}function NF(e){if(typeof e=="string")return[An("output",e)];if(!hs(e))return[An(void 0,Ho(e))];const t=ar(e.stdout),n=ar(e.stderr);if(t==null&&n==null)return[An(void 0,Ho(e))];const r=[];return t&&r.push(An("output",t.replace(/\n$/,""))),n&&r.push(An("errors",n.replace(/\n$/,""),!0)),e.interrupted===!0&&r.push(or("note","interrupted before it finished")),r.length?r:[or("output","none")]}function _F(e,t,n){const r=hs(t)?t:null;if(r&&(e==="Edit"||e==="MultiEdit")){const a=ar(r.file_path),l=(e==="MultiEdit"?Array.isArray(r.edits)?r.edits:[]:[r]).filter(hs).filter(c=>ar(c.old_string)!=null&&ar(c.new_string)!=null);if(a&&l.length){const c=[or("file",a)];return l.forEach((u,f)=>{const p=u.replace_all===!0?", every occurrence":"";c.push(IR(l.length>1?`change ${f+1}${p}`:`change${p}`,vF(u.old_string,u.new_string)))}),{input:c,response:DN(n)}}}if(r&&e==="Write"){const a=ar(r.file_path),l=ar(r.content);if(a&&l!=null)return{input:[or("file",a),An("content",l)],response:DN(n)}}if(r&&e==="Read"){const a=ar(r.file_path);if(a){const l=bF(r);return{input:l?[or("file",a),or("lines",l)]:[or("file",a)],response:kF(n)}}}if(r&&e==="Bash"){const a=ar(r.command);if(a!=null){const l=ar(r.description);return{input:l?[An("command",a),or("why",l)]:[An("command",a)],response:NF(n)}}}return{input:[An(void 0,Ho(t))],response:[An(void 0,Ho(n))]}}function FN(e,t,n){if(n==null)return"";if(typeof n=="string")return n;if(hs(n)){if(e==="Bash"&&t==="input"&&typeof n.command=="string")return n.command;if(e==="Bash"&&t==="response"&&(typeof n.stdout=="string"||typeof n.stderr=="string"))return[n.stdout,n.stderr].filter(r=>typeof r=="string"&&r!=="").join(`
|
|
78
|
+
`);if(e==="Read"&&t==="response"&&hs(n.file)&&typeof n.file.content=="string")return n.file.content}try{return JSON.stringify(n,null,2)??String(n)}catch{return String(n)}}function SF({tool:e,onClose:t}){const n=sn(t),r=e.endedAt==null?"inflight":e.ok===!1?"err":"done",a=e.input??e.inputPreview,l=e.response??e.errorPreview,c=_F(e.name,a,l);return o.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:o.jsxs("div",{ref:n,className:"modal",onClick:u=>u.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"tool-modal-title",children:[o.jsxs("header",{className:"modal-head",children:[o.jsxs("div",{className:"modal-title",children:[o.jsx("span",{className:`status-dot ${r}`,"aria-hidden":!0}),o.jsx("span",{id:"tool-modal-title",className:"modal-tool-name",children:e.name}),o.jsxs("span",{className:"modal-tool-id",title:e.id,children:[e.id.slice(0,12),"…"]})]}),o.jsxs("div",{className:"modal-actions",children:[o.jsx("span",{className:"modal-dur",children:yR(e,"in-flight…")}),o.jsx("button",{className:"glyph-btn",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),o.jsxs("section",{className:"modal-body",children:[e.trimmed&&o.jsx("div",{className:"modal-section",children:o.jsx("p",{className:"modal-note",children:"Full payloads for this call were released to keep memory bounded — only the previews below are still held."})}),o.jsxs("div",{className:"modal-section",children:[o.jsxs("div",{className:"tm-head",children:[o.jsx("h4",{children:"Input"}),o.jsx(BN,{text:FN(e.name,"input",a),what:"input"})]}),c.input.map((u,f)=>o.jsx(qN,{block:u},f))]}),o.jsxs("div",{className:"modal-section",children:[o.jsxs("div",{className:"tm-head",children:[o.jsxs("h4",{children:["Response ",r==="err"&&o.jsx("span",{className:"err-tag",children:"error"})]}),e.endedAt!=null&&o.jsx(BN,{text:FN(e.name,"response",l),what:"response"})]}),e.endedAt==null?o.jsx("pre",{children:"(waiting…)"}):c.response.map((u,f)=>o.jsx(qN,{block:u},f))]})]})]})})}const jF={del:"tm-del",add:"tm-add",ctx:"tm-ctx"};function qN({block:e}){const[t,n]=x.useState(!1);if(e.inline)return o.jsxs("p",{className:"tm-inline",children:[e.label&&o.jsx("span",{className:"tm-label",children:e.label}),o.jsx("code",{children:e.text})]});const{shown:r,cut:a}=wF(yF(e),t);return o.jsxs("div",{className:"tm-block",children:[e.label&&o.jsx("span",{className:"tm-label",children:e.label}),o.jsx("pre",{className:e.err?"tm-err":void 0,children:e.lines?r.map((l,c)=>o.jsxs("span",{className:l.tone?jF[l.tone]:void 0,children:[l.text,c<r.length-1?`
|
|
79
|
+
`:""]},c)):r.map(l=>l.text).join(`
|
|
80
|
+
`)}),a&&o.jsx("button",{type:"button",className:"btn tm-more",onClick:()=>n(!0),children:"show all"})]})}function BN({text:e,what:t}){const[n,r]=x.useState(!1),a=x.useRef(!0);return x.useEffect(()=>()=>{a.current=!1},[]),o.jsx("button",{type:"button",className:"btn tm-copy",disabled:!e,"aria-label":n?`The ${t} was copied`:`Copy the ${t}`,onClick:()=>void Ba(e).then(l=>{!l||!a.current||(r(!0),window.setTimeout(()=>{a.current&&r(!1)},1600))}),children:n?"copied":"copy"})}const Md=18,zN=26,EF=12,CF=240;function TF(e,t){return(e+CF)*(t||1)}function AF(e){return RF(e.nodeInternals.values())}function RF(e){const t=new Map;for(const a of e){if(a.type!=="agent"&&a.type!=="recapNote")continue;const l=a.data;if(!(l!=null&&l.sessionId)||l.exitAt!=null||a.width==null||a.height==null)continue;const c=a.position.x,u=a.position.y,f=c+a.width,p=u+a.height,h=t.get(l.sessionId);h?(h.minX=Math.min(h.minX,c),h.minY=Math.min(h.minY,u),h.maxX=Math.max(h.maxX,f),h.maxY=Math.max(h.maxY,p),l.kind==="root"&&(h.label=VN(l)??h.label),l.kind==="root"&&(h.name=GN(l)),l.kind==="root"&&(h.alarm=br(l.waiting)),l.kind==="root"&&(h.branch=WN(l))):t.set(l.sessionId,{minX:c,minY:u,maxX:f,maxY:p,label:VN(l)??l.sessionId,name:GN(l),alarm:l.kind==="root"&&br(l.waiting),branch:WN(l)})}const n=new Map;for(const a of t.values())n.set(a.label,(n.get(a.label)??0)+1);const r=[];for(const[a,l]of t){const c=(n.get(l.label)??0)>1;r.push({sessionId:a,...$F(l.label,l.name,a,c),x:l.minX-Md,y:l.minY-Md-zN,w:l.maxX-l.minX+Md*2,h:l.maxY-l.minY+Md*2+zN,...l.alarm?{alarm:!0}:null,...l.branch?{branch:l.branch}:null})}return r}const Qd=" · ",MF=32,IF=/[\u1100-\u115F\u2E80-\u303E\u3041-\u33FF\u3400-\u4DBF\u4E00-\u9FFF\uA000-\uA4CF\uAC00-\uD7A3\uF900-\uFAFF\uFE30-\uFE6F\uFF00-\uFF60\uFFE0-\uFFE6]/;function HN(e){return IF.test(e)?2:1}function UN(e,t=MF){const n=[...e];let r=0;for(const c of n)r+=HN(c);if(r<=t)return e;const a=[];let l=0;for(const c of n){const u=HN(c);if(l+u>t-1)break;a.push(c),l+=u}for(;a.length&&/[\s\-_.:/]/.test(a[a.length-1]);)a.pop();return`${a.join("")}…`}function $F(e,t,n,r){const a=(t==null?void 0:t.trim())??"",l=r?OF(n):void 0,c=[e,a||void 0,l].filter(Boolean);return{label:UN(e),name:a?UN(a):void 0,shortId:l,fullLabel:c.join(Qd)}}function OF(e){const t=e.match(/[a-zA-Z0-9]{4}/);return t?t[0]:e.slice(0,4)}function WN(e){if(e.kind!=="root")return;const t=e.branch;return t&&t.total>0?jR(t):void 0}function VN(e){if(e.kind==="root")return e.label}function GN(e){if(e.kind==="root")return q0(e.sessionName,e.sessionTitle).face}function LF({onFocusSession:e}){const{x:t,y:n,zoom:r}=JA(),a=xt(AF,PF);if(a.length<=1)return null;const l=u=>{try{e==null||e(u)}catch{}},c={transform:`translate(${t}px, ${n}px) scale(${r})`};return o.jsx("div",{className:"session-clusters",style:c,children:a.map(u=>{const f=hh(u.sessionId),p={position:"absolute",left:0,top:0,transform:`translate(${u.x}px, ${u.y}px)`,width:u.w,height:u.h,"--session-hue":f},h={position:"absolute",left:u.x+16,top:u.y-EF/(r||1),transform:`scale(${1/(r||1)})`,transformOrigin:"left top",maxWidth:TF(u.w,r),"--session-hue":f};return o.jsxs(pe.Fragment,{children:[o.jsx("div",{className:"cluster-card",style:p,"aria-hidden":!0}),o.jsxs("button",{type:"button",className:"cluster-label","data-alarm":u.alarm?"":void 0,style:h,title:`${u.alarm?`Waiting on you
|
|
81
|
+
`:""}Zoom to ${u.fullLabel}
|
|
82
|
+
drag the wrapper to move the whole session`,onClick:()=>l(u.sessionId),children:[u.alarm?o.jsxs(o.Fragment,{children:[o.jsx(V0,{}),o.jsx("span",{className:"cluster-label-said",children:"waiting on you: "})]}):null,u.label,u.branch?o.jsx("span",{className:"cluster-label-branch",children:Qd+u.branch}):null,u.name?o.jsx("span",{className:"cluster-label-name",children:Qd+u.name}):null,u.shortId?o.jsx("span",{className:"cluster-label-id",children:Qd+u.shortId}):null]})]},u.sessionId)})})}function PF(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){const r=e[n],a=t[n];if(r.sessionId!==a.sessionId||r.label!==a.label||r.name!==a.name||r.shortId!==a.shortId||r.alarm!==a.alarm||r.branch!==a.branch||r.fullLabel!==a.fullLabel||r.x!==a.x||r.y!==a.y||r.w!==a.w||r.h!==a.h)return!1}return!0}function DF({data:e}){return o.jsx("div",{className:"session-group-handle",style:{width:(e==null?void 0:e.w)??0,height:(e==null?void 0:e.h)??0}})}function $R(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 Jd(e){return $R(Math.floor(e/1e3))}function OR(e,t){const n=e-t;if(n<=0)return null;const r=Math.floor(n/86400),a=Math.floor(n%86400/3600),l=Math.floor(n%3600/60);return r>0?`${r}d ${a}h`:a>0?`${a}h ${l}m`:`${l}m`}function FF(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function fh(e,t,n){const r=new Date(e),a=Jd(t-e);return{label:FF(r,new Date(t))?a:`${a} · ${r.toLocaleDateString(n,{month:"short",day:"numeric"})}`,title:r.toLocaleString(n,{dateStyle:"medium",timeStyle:"medium"})}}function qF({data:e}){const t=gl(3e4),n=fh(e.recap.at,t);return o.jsxs("div",{className:"recap-note",role:"note","aria-label":"Claude Code's recap",style:{"--session-hue":e.hue},children:[o.jsxs("div",{className:"recap-note-head",children:[o.jsxs("span",{className:"recap-note-mark",children:[o.jsx(Vc,{}),"recap"]}),o.jsx("span",{className:"recap-note-age",title:n.title,children:n.label}),o.jsx("button",{type:"button",className:"glyph-btn recap-note-close","aria-label":"Hide the recap",title:"Hide — the ※ on the card brings it back",onClick:r=>{r.stopPropagation(),y6(e.noteKey)},children:"×"})]}),o.jsx("p",{className:"recap-note-text",children:e.recap.text}),o.jsxs("div",{className:"lod-face recap-face","aria-hidden":!0,children:[o.jsxs("div",{className:"lod-id",children:[o.jsxs("span",{className:"recap-note-mark",children:[o.jsx(Vc,{}),"recap"]}),o.jsx("span",{className:"recap-face-age",children:n.label})]}),o.jsx("p",{className:"recap-face-text",children:e.recap.text})]}),o.jsx(zo,{type:"source",position:Ke.Right,style:{background:"transparent",border:"none"}})]})}function BF({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:a,targetPosition:l,style:c}){const[u]=R0({sourceX:e,sourceY:t,sourcePosition:a,targetX:n,targetY:r,targetPosition:l,curvature:.35});return o.jsxs("g",{className:"recap-tie",style:c,children:[o.jsx("path",{className:"recap-tie-thread",d:u}),o.jsx("path",{className:"recap-tie-beads",d:u}),o.jsx("circle",{className:"recap-tie-end",cx:e,cy:t,r:3.5}),o.jsx("circle",{className:"recap-tie-end",cx:n,cy:r,r:3.5})]})}function zF(e){const t={input:0,output:0,cacheRead:0,cacheWrite:0,total:0};let n=0,r=0,a=0,l=0;for(const c of e){const u=Vn(c);t.input+=u.input,t.output+=u.output,t.cacheRead+=u.cacheRead,t.cacheWrite+=u.cacheWrite,t.total+=u.total,n+=c.usage.inputTokens,r+=c.usage.outputTokens,a+=c.usage.cacheReadTokens,l+=c.usage.cacheCreateTokens}return{cost:t,inputTokens:n,outputTokens:r,cacheReadTokens:a,cacheCreateTokens:l,sum:n+r}}const HF="spend on this board",UF="on this board",KN=`Everything on the board right now, and only that.
|
|
83
|
+
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.
|
|
84
|
+
Press H for the totals ccusage reads off the logs on disk, which do not forget.`,LR="session spend",Zx="__unknown__",WF=12;function VF(e,t=Date.now()){const n=new Map;for(const r of e)for(const a of au(r)){const l=a.model??Zx,c=$o(a.usage,a.model,t),u=n.get(l);u?(u.inputTokens+=a.usage.inputTokens,u.outputTokens+=a.usage.outputTokens,u.cacheReadTokens+=a.usage.cacheReadTokens,u.cacheCreateTokens+=a.usage.cacheCreateTokens,u.cost.total+=c.total,u.cost.input+=c.input,u.cost.output+=c.output,u.cost.cacheRead+=c.cacheRead,u.cost.cacheWrite+=c.cacheWrite,u.agentCount++):n.set(l,{model:l,inputTokens:a.usage.inputTokens,outputTokens:a.usage.outputTokens,cacheReadTokens:a.usage.cacheReadTokens,cacheCreateTokens:a.usage.cacheCreateTokens,cost:{...c},agentCount:1,priced:ml(a.model,t)!=null})}return Array.from(n.values()).sort((r,a)=>a.cost.total-r.cost.total||a.inputTokens+a.outputTokens-(r.inputTokens+r.outputTokens))}function GF(e,t=Date.now()){const n=[...e],r=[];for(const a of n){if(a.kind!=="root")continue;let l=Vn(a,t).total,c=a.usage.inputTokens,u=a.usage.outputTokens,f=Wc(a,t);for(const p of n)p.sessionId!==a.sessionId||p.kind==="root"||(l+=Vn(p,t).total,c+=p.usage.inputTokens,u+=p.usage.outputTokens,f+=Wc(p,t));r.push({sessionId:a.sessionId,label:a.label||a.cwdBasename||"session",state:a.state,cost:l,inputTokens:c,outputTokens:u,unpricedTokens:f})}return r.sort((a,l)=>l.cost-a.cost||l.inputTokens+l.outputTokens-(a.inputTokens+a.outputTokens)).slice(0,WF)}function K0({cost:e,size:t="md"}){const n=e.total;if(n<=0)return null;const r=(l,c,u)=>{if(l<=0)return null;const f=l/n*100;return o.jsx("span",{className:`cb-seg ${c}`,style:{width:`${f}%`},title:`${u}: ${ct(l)} (${f.toFixed(0)}%)`},c)},a=t==="lg";return o.jsxs("div",{className:a?"cost-bar cost-bar-lg":"cost-bar",role:"img","aria-label":"Cost breakdown",children:[r(e.input,"cb-input","input"),r(e.output,"cb-output","output"),r(e.cacheRead,"cb-cache-r","cache read"),r(e.cacheWrite,"cb-cache-w","cache write")]})}function KF({state:e,sessionId:t,onClose:n}){const r=x.useMemo(()=>YF(e,t),[e,t]),a=x.useRef(null),l=sn(n,{focusRef:a});return r?o.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:o.jsxs("div",{ref:l,className:"modal session-summary",onClick:c=>c.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"ss-title",children:[o.jsxs("div",{className:"modal-head",children:[o.jsxs("div",{className:"modal-title",children:[o.jsx("span",{className:"state-pill state-done","aria-hidden":!0,children:"done"}),o.jsx("span",{id:"ss-title",className:"modal-tool-name",title:r.cwd??r.sessionId,children:r.label}),o.jsxs("span",{className:"modal-tool-id",children:["· ",r.sessionId.slice(0,8)]})]}),o.jsxs("div",{className:"modal-actions",children:[o.jsx("span",{className:"modal-dur",title:"Total wall time",children:r.durationLabel}),o.jsx("button",{type:"button",ref:a,className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),o.jsxs("div",{className:"modal-body",children:[o.jsxs("section",{className:"ss-hero",children:[o.jsxs("div",{className:"ss-hero-left",children:[o.jsx("div",{className:"ss-cost-label",children:LR}),o.jsx("div",{className:"ss-cost",children:ct(r.cost.total)}),r.modelChips.length>0&&o.jsx("div",{className:"ss-models",children:r.modelChips.map(c=>o.jsx("span",{className:"model-chip","data-family":$h(c),title:c,children:qa(c)},c))})]}),o.jsx("div",{className:"ss-hero-right",children:r.cost.total>0&&o.jsxs(o.Fragment,{children:[o.jsx(K0,{cost:r.cost,size:"lg"}),o.jsxs("div",{className:"ss-cost-legend",children:[o.jsxs("span",{className:"ssl ssl-in",children:["input ",o.jsx("b",{children:ct(r.cost.input)})]}),o.jsxs("span",{className:"ssl ssl-out",children:["output ",o.jsx("b",{children:ct(r.cost.output)})]}),o.jsxs("span",{className:"ssl ssl-cr",children:["cache r ",o.jsx("b",{children:ct(r.cost.cacheRead)})]}),o.jsxs("span",{className:"ssl ssl-cw",children:["cache w ",o.jsx("b",{children:ct(r.cost.cacheWrite)})]})]})]})})]}),o.jsxs("section",{className:"ss-stats",children:[o.jsx(Di,{label:"agents",value:r.agentCount}),o.jsx(Di,{label:"subagents",value:r.subagentCount}),o.jsx(Di,{label:"tool calls",value:r.toolCount}),o.jsx(Di,{label:"prompts",value:r.promptCount}),o.jsx(Di,{label:"tokens",value:r.tokensSum.toLocaleString()}),r.errCount>0&&o.jsx(Di,{label:"errors",value:r.errCount,tone:"err"})]}),r.topTools.length>0&&o.jsxs("section",{className:"modal-section",children:[o.jsx("h4",{children:"Most-used tools"}),o.jsx("div",{className:"ss-top-tools",children:r.topTools.map(([c,u])=>o.jsxs("div",{className:"ss-tt",children:[o.jsx("span",{className:"ss-tt-name",children:c}),o.jsx("span",{className:"ss-tt-bar",children:o.jsx("span",{className:"ss-tt-bar-fill",style:{width:`${u/r.topTools[0][1]*100}%`}})}),o.jsx("span",{className:"ss-tt-count",children:u})]},c))})]}),r.firstPrompt&&o.jsxs("section",{className:"modal-section",children:[o.jsx("h4",{children:"Opening prompt"}),o.jsx("div",{className:"ss-prompt",children:r.firstPrompt})]})]})]})}):null}function Di({label:e,value:t,tone:n}){return o.jsxs("div",{className:`ss-stat${n?` tone-${n}`:""}`,children:[o.jsx("div",{className:"ss-stat-value",children:t}),o.jsx("div",{className:"ss-stat-label",children:e})]})}function YF(e,t){const n=e.agents.get(t);if(!n)return null;const r=[];for(const E of e.agents.values())E.sessionId===t&&r.push(E);if(r.length===0)return null;const a={input:0,output:0,cacheRead:0,cacheWrite:0,total:0},l=new Set,c=new Map;let u=0,f=0,p=0,h=0,m=0,y,w=1/0,_=0;for(const E of r){const C=Vn(E);a.input+=C.input,a.output+=C.output,a.cacheRead+=C.cacheRead,a.cacheWrite+=C.cacheWrite,a.total+=C.total;for(const R of pR(E))l.add(R);E.model&&l.add(E.model),E.kind==="subagent"&&m++;const T=sR(E.prompts);f+=T.length,!y&&T.length>0&&(y=T[0].text),p+=E.usage.inputTokens+E.usage.outputTokens,u+=E.toolCount,w=Math.min(w,E.startedAt),_=Math.max(_,E.endedAt??Date.now());for(const R of E.tools)c.set(R.name,(c.get(R.name)??0)+1),R.ok===!1&&h++}const k=Math.max(0,_-w),j=Math.floor(k/1e3),b=j<60?`${j}s`:j<3600?`${Math.floor(j/60)}m ${String(j%60).padStart(2,"0")}s`:`${Math.floor(j/3600)}h ${Math.floor(j%3600/60)}m`,S=Array.from(c.entries()).sort((E,C)=>C[1]-E[1]).slice(0,5);return{sessionId:t,label:n.label||n.cwdBasename||"session",cwd:n.cwd,durationLabel:b,cost:a,modelChips:Array.from(l),agentCount:r.length,subagentCount:m,toolCount:u,promptCount:f,tokensSum:p,errCount:h,topTools:S,firstPrompt:y}}function YN(e){return e.waiting?br(e.waiting)?0:1:e.state==="active"?2:3}function XF(e,t){const n=[];for(const r of e.agents.values()){if(r.kind!=="root")continue;let a=r.toolCount,l=Vn(r).total,c=r.endedAt??r.startedAt;for(const u of e.agents.values()){if(u.sessionId!==r.sessionId||u.kind==="root")continue;a+=u.toolCount,l+=Vn(u).total;const f=u.endedAt??u.startedAt;f>c&&(c=f)}n.push({sessionId:r.sessionId,label:r.label||r.cwdBasename||"session",cwdBasename:r.cwdBasename,state:r.state,waiting:r.waiting,recap:Ph(r),modelId:r.model,toolCount:a,cost:l,startedAt:r.startedAt,lastActivity:c})}return n.sort((r,a)=>{const l=YN(r),c=YN(a);return l!==c?l-c:r.waiting&&a.waiting?r.waiting.since-a.waiting.since:a.lastActivity-r.lastActivity}),n}function XN(e,t,n){const r=(t??n)-e;if(r<1e3)return"<1s";const a=Math.floor(r/1e3);if(a<60)return`${a}s`;const l=Math.floor(a/60);return l<60?`${l}m`:`${Math.floor(l/60)}h ${l%60}m`}function ZF({state:e,now:t,selectedIds:n,onSelect:r,onClose:a}){const l=x.useMemo(()=>XF(e),[e,e.revision,t]),c=l.filter(f=>f.state==="active").length,u=l.filter(f=>br(f.waiting)).length;return o.jsxs("aside",{className:"session-list",id:"session-list","aria-label":"Sessions",children:[o.jsxs("div",{className:"sl-header",children:[o.jsxs("h2",{children:["Sessions ",o.jsx("span",{className:"sl-count",children:l.length})]}),u>0&&o.jsxs("span",{className:"sl-waiting-count",children:[u," waiting"]}),c>0&&o.jsxs("span",{className:"sl-live-count",children:[c," live"]}),o.jsx("button",{className:"glyph-btn sl-close",onClick:a,title:"Hide sidebar (L)","aria-label":"Hide session list",children:"‹"})]}),o.jsxs("ul",{className:"sl-rows",children:[l.length===0&&o.jsx("li",{className:"sl-empty",children:"No sessions yet."}),l.map(f=>{const p=n.has(f.sessionId);return o.jsx("li",{className:"sl-row-item",children:o.jsxs("button",{type:"button",className:`sl-row state-${f.state}${p?" selected":""}`,"aria-current":p?"true":void 0,onClick:()=>r(f.sessionId),title:`Focus ${f.label}`,children:[o.jsx("span",{className:`sl-dot state-${f.state}`,"aria-hidden":!0}),o.jsx("span",{className:"vis-hidden",children:ll(f.state)}),o.jsxs("div",{className:"sl-row-body",children:[o.jsxs("div",{className:"sl-row-head",children:[o.jsx("span",{className:"sl-label",children:f.label}),f.modelId&&o.jsx("span",{className:"model-chip","data-family":$h(f.modelId),title:f.modelId,children:qa(f.modelId)})]}),o.jsxs("div",{className:"sl-row-meta",children:[o.jsxs("span",{title:"tool calls",children:[o.jsx("b",{children:f.toolCount})," tools"]}),f.cost>0&&o.jsx("span",{className:"sl-cost",title:LR,children:o.jsx("b",{children:ct(f.cost)})}),f.waiting?o.jsxs("span",{className:"sl-waiting",title:[cl(f.waiting),dF(f.waiting,cl(f.waiting)),`Blocked since ${new Date(f.waiting.since).toLocaleTimeString()} · started ${new Date(f.startedAt).toLocaleString()}`].filter(Boolean).join(`
|
|
85
|
+
`),children:["waiting ",XN(f.waiting.since,void 0,t),f.waiting.tool&&o.jsxs("span",{className:"sl-waiting-tool",children:[" · ",f.waiting.tool.name]})]}):o.jsx("span",{className:"sl-elapsed",title:`Started ${new Date(f.startedAt).toLocaleString()}`,children:XN(f.startedAt,f.state==="active"?void 0:f.lastActivity,t)})]}),f.recap&&o.jsxs("span",{className:"sl-recap",title:f.recap.text,children:[o.jsx(Vc,{}),f.recap.text]})]})]})},f.sessionId)})]})]})}const QF=e=>1-Math.pow(1-e,5),PR=420;function JF(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 r=Math.max(Math.abs(e),Math.abs(t));return r===0||n/r>=.005}function eq(e,t,n,r=PR){return n>=r?t:n<=0?e:e+(t-e)*QF(n/r)}function tq(e,t,n,r={}){const a=r.now??(()=>performance.now()),l=r.raf??(w=>requestAnimationFrame(w)),c=r.cancel??(w=>cancelAnimationFrame(w)),u=r.reducedMotion??(()=>typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches),f=r.hidden??(()=>typeof document=="object"&&document.hidden===!0);if(u()||f()||!JF(e,t))return n(t),()=>{};const p=a();let h=0,m=!0;const y=()=>{if(!m)return;const w=a()-p;n(eq(e,t,w)),w<PR&&(h=l(y))};return h=l(y),()=>{m=!1,h&&c(h)}}const Qx={cost:0,inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0,sessions:0};function nq(e){if(!e.synthetic)return!1;const t=e.usage;return t.inputTokens+t.outputTokens+t.cacheReadTokens+t.cacheCreateTokens<=0}function Wp(e,t){const n=new Map;for(const r of e){if(r.kind!=="root"||!r.sessionId||nq(r))continue;const a=Vn(r,t);n.set(r.sessionId,{cost:a.total,inputTokens:r.usage.inputTokens,outputTokens:r.usage.outputTokens,cacheReadTokens:r.usage.cacheReadTokens,cacheCreateTokens:r.usage.cacheCreateTokens})}return n}function rq(e,t){if(!e)return Qx;const n={...Qx};for(const[r,a]of t){const l=e.get(r);if(!l)continue;const c={cost:a.cost-l.cost,inputTokens:a.inputTokens-l.inputTokens,outputTokens:a.outputTokens-l.outputTokens,cacheReadTokens:a.cacheReadTokens-l.cacheReadTokens,cacheCreateTokens:a.cacheCreateTokens-l.cacheCreateTokens};c.cost<0||c.inputTokens<0||c.outputTokens<0||c.cost===0&&c.inputTokens===0&&c.outputTokens===0&&c.cacheReadTokens===0&&c.cacheCreateTokens===0||(n.cost+=c.cost,n.inputTokens+=Math.max(0,c.inputTokens),n.outputTokens+=Math.max(0,c.outputTokens),n.cacheReadTokens+=Math.max(0,c.cacheReadTokens),n.cacheCreateTokens+=Math.max(0,c.cacheCreateTokens),n.sessions+=1)}return n}function DR(e,t,n){const r=aq*Math.max(1,n/qR);let a=0;for(const[l,c]of t){const u=e.get(l);if(u===void 0)continue;const f=c.cost-u.cost;f>0&&f<=r&&(a+=f)}return a}const ZN={samples:[],last:new Map,watched:0},FR=10*6e4,sq=6e4,qR=5e3,aq=20;function oq(e,t,n){const r=e.samples[e.samples.length-1];if(r&&t-r.t<qR)return e;const a=e.watched+DR(e.last,n,r?t-r.t:0),l=e.samples.filter(c=>t-c.t<=FR);return l.push({t,watched:a}),{samples:l,last:n,watched:a}}function iq(e,t,n){const r=e.samples[0];if(!r)return null;const a=t-r.t;if(a<sq)return null;const l=e.samples[e.samples.length-1].t,c=e.watched+DR(e.last,n,t-l)-r.watched;return c>0?{spent:c,spanSec:a/1e3,spanMin:Math.min(FR/6e4,Math.ceil(a/6e4))}:null}function QN(e,t=new Date){return new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate()-(e-1))).toISOString().slice(0,10).replace(/-/g,"")}const Fh=[{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 lq(e,t,n=Fh.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 cq(e,t=new Date){return e==="today"?QN(1,t):e==="month"?QN(t.getDate(),t):"20200101"}const Hn=e=>typeof e=="number"&&Number.isFinite(e)?e:0,eh=e=>typeof e=="string"?e:"";function BR(e){const t=Array.isArray(e==null?void 0:e.days)?e.days:[],n=new Map;for(const r of t){const a=Array.isArray(r==null?void 0:r.modelBreakdowns)?r.modelBreakdowns:[];for(const l of a){const c=eh(l==null?void 0:l.modelName);if(!c)continue;let u=n.get(c);u||(u={model:c,cost:0,inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0,get tokens(){return this.inputTokens+this.outputTokens+this.cacheReadTokens+this.cacheCreateTokens}},n.set(c,u)),u.cost+=Hn(l==null?void 0:l.cost),u.inputTokens+=Hn(l==null?void 0:l.inputTokens),u.outputTokens+=Hn(l==null?void 0:l.outputTokens),u.cacheReadTokens+=Hn(l==null?void 0:l.cacheReadTokens),u.cacheCreateTokens+=Hn(l==null?void 0:l.cacheCreationTokens)}}return[...n.values()].sort((r,a)=>a.cost-r.cost||a.tokens-r.tokens)}const uq=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function dq(e){var t;return((t=uq.exec(e))==null?void 0:t[0])??e}function hq(e,t=new Map){const n=Array.isArray(e==null?void 0:e.sessions)?e.sessions:[],r=[];for(const a of n){const l=eh(a==null?void 0:a.period);if(!l)continue;const c=dq(l),u=a==null?void 0:a.metadata,f=typeof(u==null?void 0:u.lastActivity)=="string"?Date.parse(u.lastActivity):NaN;r.push({sessionId:c,label:t.get(c)??null,agent:eh(a==null?void 0:a.agent)||"claude",cost:Hn(a==null?void 0:a.totalCost),tokens:Hn(a==null?void 0:a.totalTokens),models:Array.isArray(a==null?void 0:a.modelsUsed)?a.modelsUsed.map(eh).filter(Boolean):[],lastActivityMs:Number.isFinite(f)?f:null})}return r.sort((a,l)=>l.cost-a.cost||l.tokens-a.tokens)}function fq(e,t=Y0(e).cost){const r=(Array.isArray(e==null?void 0:e.sessions)?e.sessions:[]).reduce((l,c)=>l+Hn(c==null?void 0:c.totalCost),0),a=Math.max(.01,t*.01);return{sum:r,total:t,over:r>t+a}}function pq(e,t,n){const r=`Sessions with activity ${e}, and what ccusage puts against each one.`;return t.over?`${r}
|
|
86
|
+
They add up to ${n(t.sum)}, more than the ${n(t.total)} above: what a session cost and what a day cost are two different measurements, and they need not agree.`:r}function Y0(e){const t=e==null?void 0:e.totals;if(t&&typeof t=="object"){const f=Hn(t.cacheReadTokens),p=Hn(t.cacheCreationTokens),h=Hn(t.inputTokens),m=Hn(t.outputTokens);return{cost:Hn(t.totalCost),inputTokens:h,outputTokens:m,cacheReadTokens:f,cacheCreateTokens:p,tokens:Hn(t.totalTokens)||h+m+f+p}}const n=BR(e),r=f=>n.reduce((p,h)=>p+f(h),0),a=r(f=>f.inputTokens),l=r(f=>f.outputTokens),c=r(f=>f.cacheReadTokens),u=r(f=>f.cacheCreateTokens);return{cost:r(f=>f.cost),inputTokens:a,outputTokens:l,cacheReadTokens:c,cacheCreateTokens:u,tokens:a+l+c+u}}function mq(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 JN(e,t){var n;return((n=Fh.find(r=>r.key===(e??t)))==null?void 0:n.noun)??"today"}function gq(e,t,n){const r=e!=null,a=Y0(e);return{fromRange:r,cost:r?a.cost+n.cost:t.cost.total,inputTokens:r?a.inputTokens+n.inputTokens:t.inputTokens,outputTokens:r?a.outputTokens+n.outputTokens:t.outputTokens,cacheReadTokens:r?a.cacheReadTokens+n.cacheReadTokens:t.cacheReadTokens,cacheCreateTokens:r?a.cacheCreateTokens+n.cacheCreateTokens:t.cacheCreateTokens,hasCost:r?a.cost>0:t.cost.total>0,tokenSum:r?a.tokens:t.sum,showCostBar:!r}}const tn="ccdeck";function za(e,t){return{disabled:e!=null&&e!==t,busy:e===t}}function qh(e){return e==null}const Jx="self";function $a(e,t=!1){const n=za(e?Jx:null,Jx);return{disabled:t||n.disabled,"aria-busy":n.busy}}function Hs(e){return qh(e?Jx:null)}function ph({armedFor:e,target:t,armedAt:n,now:r,gapMs:a}){return e!==t?"arm":r-n<a?"ignore":"fire"}function yq(e){return[...e==null?[]:[`#ap-more-${e}`],".accounts-panel .ap-refresh"]}function e_(e){return e==null||e==="BODY"||e==="HTML"}const zR="agent-dag.usagePeriod";function wq(){const e=ms(zR);return Fh.some(t=>t.key===e)?e:"today"}function vq(e){if(!(typeof window>"u"))try{window.localStorage.setItem(zR,e)}catch{}}const HR="agent-dag.usageSessionsOpen";function xq(){return ms(HR)==="1"}function bq(e){if(!(typeof window>"u"))try{window.localStorage.setItem(HR,e?"1":"0")}catch{}}function t_(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 kq(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"}function Nq(e,t,n,r){const a=Math.max(0,t-r),l=Math.max(0,n-a);if(l<120)return null;const c=Math.min(100,l/n*100),u=e-c;if(Math.abs(u)<3)return{label:"on pace",color:"var(--ok)",expectedPct:c,isDeficit:!1};if(u>0){const f=100-e,p=l>0?e/l:0,h=p>0?f/p:1/0,m={label:`${Math.round(u)}% over pace`,color:"var(--warn)",expectedPct:c,isDeficit:!0};if(h<a&&h<86400){const y=Math.floor(h/3600),w=Math.floor(h%3600/60);m.runsOutIn=y>0?`${y}h ${w}m`:`${w}m`}return m}return{label:`${Math.round(-u)}% under pace`,color:"var(--ok)",expectedPct:c,isDeficit:!1}}function Ca({pct:e,label:t,reset:n,resetAt:r,windowSec:a,limitReached:l,nowSec:c}){const u=Math.min(100,Math.max(0,e)),p=l||u>=90?"var(--err)":u>=70?"var(--warn)":"var(--accent)",h=u===0?"< 1%":`${u}%`,m=u===0?2:u,y=r?OR(r,c):null,w=r&&a?Nq(u,r,a,c):null,[_,k]=x.useState(!1),j=x.useId();return o.jsxs("div",{className:"qb-row",children:[o.jsxs("div",{className:"qb-meta",children:[o.jsxs("span",{className:"qb-label",children:[t,l&&o.jsx("span",{className:"qb-limit-badge",title:"Rate limit reached",children:"⛔"})]}),o.jsx("span",{className:"qb-pct",style:{color:p},children:h})]}),o.jsxs("div",{className:"qb-track",children:[o.jsx("div",{className:"qb-fill",style:{transform:`scaleX(${m/100})`,background:p,opacity:u===0?.4:1}}),w&&o.jsx("div",{className:"qb-pace-rail",style:{transform:`translateX(${w.expectedPct}%)`},children:o.jsx("div",{"aria-hidden":!0,className:"qb-pace-marker",style:{background:w.isDeficit?"var(--err)":"var(--ok)"},title:`To last until reset, stay near ${Math.round(w.expectedPct)}% by now`})})]}),o.jsxs("div",{className:"qb-reset-row",children:[y?o.jsxs("span",{className:"qb-reset",children:["resets in ",y]}):n?o.jsxs("span",{className:"qb-reset",children:["resets ",n]}):null,w&&o.jsxs("button",{type:"button",className:"qb-pace",style:{color:w.color},"aria-expanded":_,"aria-controls":_?j:void 0,onClick:()=>k(b=>!b),children:[o.jsx("i",{className:"qb-pace-key","aria-hidden":!0,style:{background:w.isDeficit?"var(--err)":"var(--ok)"}}),w.runsOutIn?`runs out in ${w.runsOutIn}`:w.label]})]}),_&&w&&o.jsxs("div",{id:j,className:"qb-why",children:["To last until reset, stay near ",Math.round(w.expectedPct),"% by now."]})]})}const _q=6e4,Sq=2e4;function jq(e){const[t,n]=x.useState(null),[r,a]=x.useState(!1),l=x.useRef(null),c=x.useRef(!1),u=async(p=!1)=>{if(!(p&&!Hs(c.current))){p&&(c.current=!0,a(!0));try{const m=await fetch(p?"/api/quota?refresh=1":"/api/quota",{signal:AbortSignal.timeout(Sq)});m.ok&&n(await m.json())}catch{}finally{p&&(c.current=!1,a(!1))}}};return x.useEffect(()=>{if(e)return u(!0),l.current=window.setInterval(()=>u(!1),_q),()=>{l.current!=null&&window.clearInterval(l.current)}},[e]),{quota:t,loading:r,refresh:()=>{e&&u(!0)}}}function Eq(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 Cq(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 UR=6e4,n_=6e4;function Tq(e){const[t,n]=x.useState(null),[r,a]=x.useState(!1),l=x.useRef(null),c=x.useRef(!1),u=async(p=!1)=>{if(!(p&&!Hs(c.current))){p&&(c.current=!0,a(!0));try{const m=await fetch(p?"/api/codex-quota?refresh=1":"/api/codex-quota");m.ok&&n(await m.json())}catch{}finally{p&&(c.current=!1,a(!1))}}};return x.useEffect(()=>{if(e)return u(!0),l.current=window.setInterval(()=>u(!1),UR),()=>{l.current!=null&&window.clearInterval(l.current)}},[e]),{data:t,loading:r,refresh:()=>{e&&u(!0)}}}function Aq(e){const[t,n]=x.useState(null),r=x.useRef(null),a=async()=>{try{const l=await fetch("/api/codex-usage");l.ok&&n(await l.json())}catch{}};return x.useEffect(()=>{if(e)return a(),r.current=window.setInterval(a,UR),()=>{r.current!=null&&window.clearInterval(r.current)}},[e]),{data:t}}function Rq(e,t,n){const[r,a]=x.useState(null),[l,c]=x.useState(!1),[u,f]=x.useState(0),p=x.useRef(0);x.useEffect(()=>{const m=()=>document.visibilityState==="visible",y=()=>{m()&&f(k=>k+1)},w=window.setInterval(y,n_),_=()=>{m()&&Date.now()-p.current>=n_&&f(k=>k+1)};return document.addEventListener("visibilitychange",_),()=>{window.clearInterval(w),document.removeEventListener("visibilitychange",_)}},[]);const h=x.useRef(t);return x.useEffect(()=>{let m=!0;const y=t!==h.current;h.current=t;const w=e,_=cq(w);return c(!0),fetch(`/api/ccusage?since=${_}${y?"&refresh=1":""}`).then(k=>k.ok?k.json():null).then(k=>{!m||!(k!=null&&k.ok)||(p.current=Date.now(),a({period:w,data:k,baseline:n()}))}).catch(()=>{}).finally(()=>{m&&c(!1)}),()=>{m=!1}},[e,t,u]),{...mq(r,e),loading:l}}function bc(e){const[t,n]=x.useState(e),r=x.useRef(e),a=x.useRef(!0);return x.useEffect(()=>{r.current=t},[t]),x.useEffect(()=>{if(a.current){a.current=!1,r.current=e,n(e);return}return tq(r.current,e,c=>{r.current=c,n(c)})},[e]),t}function Mq({state:e,now:t,providers:n,leaving:r,onClose:a,liveSince:l=null}){var rt,et;const{quota:c,loading:u,refresh:f}=jq(n.claude),{data:p,loading:h,refresh:m}=Tq(n.codex),{data:y}=Aq(n.codex),[w,_]=x.useState(()=>Math.floor(Date.now()/1e3));x.useEffect(()=>{const ve=window.setInterval(()=>_(Math.floor(Date.now()/1e3)),3e4);return()=>window.clearInterval(ve)},[]);const k=x.useRef(ZN),j=x.useRef(null),{byModel:b,totalCost:S,totalTokens:E,burnRate:C}=x.useMemo(()=>{const ve=VF(e.agents.values()),Re=zF(e.agents.values());j.current!==l&&(j.current=l,k.current=ZN);const Ue=Wp(e.agents.values(),t);l!=null&&(k.current=oq(k.current,t,Ue));const pt=l==null?null:iq(k.current,t,Ue),he=pt?{label:F0(pt.spent,pt.spanSec),spanMin:pt.spanMin}:null;return{byModel:ve,totalCost:Re.cost,totalTokens:Re,burnRate:he}},[e,e.revision,t,l]),T=x.useMemo(()=>GF(e.agents.values()),[e,e.revision]),[R,A]=x.useState(wq);x.useEffect(()=>{vq(R)},[R]);const[q,F]=x.useState(xq);x.useEffect(()=>{bq(q)},[q]);const O=x.useRef([]),[H,K]=x.useState(0),X=x.useRef(()=>new Map);X.current=()=>Wp(e.agents.values(),t);const I=x.useCallback(()=>X.current(),[]),{data:Z,shown:W,stale:$,loading:z,baseline:U}=Rq(R,H,I),V=Z!=null,B=z&&$,Y=x.useMemo(()=>{const ve=new Map;for(const Re of e.agents.values()){if(Re.kind!=="root"||!Re.sessionId)continue;const Ue=Re.label||Re.cwdBasename;Ue&&ve.set(Re.sessionId,Ue)}return ve},[e,e.revision]),ue=x.useMemo(()=>{const ve=new Map;for(const Re of e.agents.values())Re.kind!=="root"||!Re.sessionId||ve.set(Re.sessionId,Re.state);return ve},[e,e.revision]),G=x.useMemo(()=>V?BR(Z):[],[Z,V]),ee=x.useMemo(()=>{if(!V)return[];const ve=hq(Z,Y).slice(0,12),Re=new Map;for(const Ue of ve)Ue.label&&Re.set(Ue.label,(Re.get(Ue.label)??0)+1);return ve.map(Ue=>Ue.label&&(Re.get(Ue.label)??0)>1?{...Ue,label:`${Ue.label} ${Ue.sessionId.slice(0,4)}`}:Ue)},[Z,V,Y]),L=x.useMemo(()=>Y0(Z),[Z]),te=x.useMemo(()=>fq(Z,L.cost),[Z,L.cost]),ne=JN(W,R),ie=$?" up-stale":"",me=x.useMemo(()=>V?rq(U,Wp(e.agents.values(),t)):Qx,[e,e.revision,U,V,t]),je=gq(Z,{...E,cost:S},me),Oe=je.hasCost,Ve=je.tokenSum,Le=bc(je.cost),Te=bc(je.inputTokens),nt=bc(je.outputTokens),_e=bc(je.cacheReadTokens),Se=bc(je.cacheCreateTokens),Xe=b.filter(ve=>ve.cost.total>0||ve.inputTokens+ve.outputTokens>0),ot=T.filter(ve=>ve.cost>0||ve.inputTokens+ve.outputTokens>0),$e=V?G.some(ve=>ve.cost<=0&&ve.tokens>0):Xe.some(ve=>!ve.priced),oe=u||h,ye=t_(c==null?void 0:c.fetchedAt,w),Ce=t_(p==null?void 0:p.fetchedAt,w),De=()=>{f(),m(),K(ve=>ve+1)},qe=n.claude&&n.codex?"Refresh Claude + Codex quota":n.codex?"Refresh Codex quota":"Refresh Claude quota";return o.jsxs("aside",{className:`usage-panel${r?" leaving":""}`,id:"usage-panel","aria-label":"Usage",children:[o.jsxs("div",{className:"up-header",children:[o.jsx("h2",{children:"Usage"}),C&&o.jsxs("span",{className:"up-rate",title:`Spend on this board over the last ${C.spanMin} min`,children:[C.label,o.jsxs("span",{className:"up-rate-span",children:[" · ",C.spanMin," min"]})]}),o.jsxs("div",{className:"up-header-right",children:[(n.claude||n.codex)&&o.jsx("button",{type:"button",className:"glyph-btn up-refresh-btn",onClick:De,...$a(oe),"aria-label":qe,title:qe,children:oe?"…":"↻"}),o.jsx("button",{type:"button",className:"glyph-btn up-close",onClick:a,"aria-label":"Close usage panel",title:"Close (U)",children:"×"})]})]}),n.claude&&o.jsxs("section",{className:"up-section up-quota-section",children:[o.jsxs("h3",{className:"up-section-title",children:["Claude quota",ye&&!u&&o.jsx("span",{className:"up-section-age",title:kq(c==null?void 0:c.source),children:ye})]}),c!=null&&c.ok?o.jsxs("div",{className:"up-quota-bars",children:[c.session5hPct!=null&&o.jsx(Ca,{label:"5-hour window",pct:c.session5hPct,reset:c.session5hReset,resetAt:c.session5hResetAt,windowSec:c.session5hWindowSec,nowSec:w}),c.week7dPct!=null&&o.jsx(Ca,{label:"7-day window",pct:c.week7dPct,reset:c.week7dReset,resetAt:c.week7dResetAt,windowSec:c.week7dWindowSec,nowSec:w}),c.weekSonnetPct!=null&&o.jsx(Ca,{label:"Sonnet (7d)",pct:c.weekSonnetPct,nowSec:w}),c.weekOpusPct!=null&&o.jsx(Ca,{label:"Opus (7d)",pct:c.weekOpusPct,nowSec:w}),c.extraEnabled&&c.extraUsedCredits!=null&&c.extraMonthlyLimit?o.jsx(Ca,{label:`Extra credits (month${c.extraCurrency?`, ${c.extraCurrency}`:""})`,pct:Math.min(100,Math.round(c.extraUsedCredits/c.extraMonthlyLimit*100)),nowSec:w}):c.extraEnabled&&o.jsx("div",{className:"up-quota-sub up-credits",children:"extra usage credits: on"})]}):(c==null?void 0:c.ok)===!1?o.jsxs("div",{className:"up-quota-na",children:[o.jsx("span",{children:c.reason==="no_subscription"?"No quota to show.":"Quota unavailable."}),o.jsx("span",{className:"up-quota-hint",children:Eq(c.reason)})]}):o.jsx("div",{className:"up-quota-na up-quota-loading",children:"Checking…"})]}),n.codex&&o.jsxs("section",{className:"up-section up-quota-section",children:[o.jsxs("h3",{className:"up-section-title",children:["Codex quota",(p==null?void 0:p.ok)&&p.planLabel&&o.jsx("span",{className:"up-plan-badge",children:p.planLabel}),Ce&&!h&&o.jsx("span",{className:"up-section-age",title:"Fetched from the Codex usage endpoint",children:Ce})]}),p!=null&&p.ok?o.jsxs("div",{className:"up-quota-bars",children:[(rt=p.windows)==null?void 0:rt.map(ve=>o.jsx(Ca,{label:ve.label,pct:ve.pct,reset:ve.reset??void 0,resetAt:ve.resetAt??void 0,windowSec:ve.windowSec??void 0,limitReached:p.limitReached&&ve.pct>=100,nowSec:w},ve.id)),(et=p.extraWindows)==null?void 0:et.map(ve=>o.jsx(Ca,{label:ve.label,pct:ve.pct,reset:ve.reset??void 0,resetAt:ve.resetAt??void 0,windowSec:ve.windowSec??void 0,nowSec:w},ve.id)),p.creditLimit&&o.jsx(Ca,{label:`spend cap · $${Math.round(p.creditLimit.used)} of $${Math.round(p.creditLimit.limit)}`,pct:p.creditLimit.usedPct,reset:p.creditLimit.reset??void 0,resetAt:p.creditLimit.resetAt??void 0,limitReached:p.spendControlReached,nowSec:w}),p.creditsBalance&&!p.creditsUnlimited&&o.jsxs("div",{className:"up-quota-sub up-credits",children:["credits: $",p.creditsBalance,p.overageReached&&" · overage limit reached"]}),p.creditsUnlimited&&o.jsx("div",{className:"up-quota-sub up-credits",children:"credits: unlimited"}),p.resetCredits&&p.resetCredits.availableCount>0&&o.jsxs("div",{className:"up-quota-sub up-reset-credits",title:`Redeem in the Codex CLI or ChatGPT — ${tn} only reports them`,children:[p.resetCredits.availableCount," rate-limit reset",p.resetCredits.availableCount!==1?"s":""," available",p.resetCredits.nextExpiryAt&&` · expires ${new Date(p.resetCredits.nextExpiryAt).toLocaleDateString("en-US",{month:"short",day:"numeric"})}`]}),p.promo&&o.jsx("div",{className:"up-quota-sub",children:p.promo}),p.partial&&o.jsx("div",{className:"up-quota-sub up-quota-hint",children:"Partial data — OpenAI returned limits this build doesn't recognise."})]}):(p==null?void 0:p.ok)===!1?o.jsxs("div",{className:"up-quota-na",children:[o.jsx("span",{children:"Quota unavailable."}),o.jsx("span",{className:"up-quota-hint",children:Cq(p.reason)})]}):o.jsx("div",{className:"up-quota-na up-quota-loading",children:"Checking…"}),(y==null?void 0:y.ok)&&y.window7d&&y.window7d.sessionCount>0&&o.jsxs("div",{className:"up-quota-sub",title:`Counted from the rollout files under CODEX_HOME — no network, no account${y.window5h?`
|
|
87
|
+
last 5h: ${Dt(y.window5h.totalTokens)} tokens · ${y.window5h.sessionCount} session${y.window5h.sessionCount!==1?"s":""}`:""}`,children:[Dt(y.window7d.totalTokens)," tokens · ",y.window7d.sessionCount," session",y.window7d.sessionCount!==1?"s":""," (7d)"]})]}),V&&o.jsx("div",{className:"uh-range up-period",role:"toolbar","aria-orientation":"horizontal","aria-label":"Period","aria-busy":B||void 0,onKeyDown:ve=>{var pt;const Re=O.current.indexOf(ve.target);if(Re<0)return;const Ue=lq(ve.key,Re);Ue!==null&&(ve.preventDefault(),(pt=O.current[Ue])==null||pt.focus())},children:Fh.map((ve,Re)=>o.jsx("button",{type:"button",ref:Ue=>{O.current[Re]=Ue},tabIndex:R===ve.key?0:-1,"aria-pressed":R===ve.key,"data-pending":R===ve.key&&B?"":void 0,title:R===ve.key&&B?`Reading ${ve.noun} from the transcripts on this machine…`:ve.hint,className:"uh-range-btn",onClick:()=>A(ve.key),children:ve.label},ve.key))}),V&&o.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:B?`Reading ${JN(R,R)}…`:""}),Ve>0?o.jsxs(o.Fragment,{children:[Oe&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:`up-total${ie}`,title:V?void 0:KN,children:[o.jsx("span",{className:"up-total-value",children:ct(Le)}),o.jsx("span",{className:"up-total-label",children:V?ne:HF})]}),je.showCostBar&&o.jsx(K0,{cost:S})]}),o.jsxs("div",{className:`up-tokens-row${ie}`,title:V?void 0:KN,children:[o.jsxs("span",{className:"up-tok",children:[o.jsx("span",{className:"up-k",children:"in"}),Dt(Te)]}),o.jsxs("span",{className:"up-tok",children:[o.jsx("span",{className:"up-k",children:"out"}),Dt(nt)]}),je.cacheReadTokens>0&&o.jsxs("span",{className:"up-tok",children:[o.jsx("span",{className:"up-k",children:"cache r"}),Dt(_e)]}),je.cacheCreateTokens>0&&o.jsxs("span",{className:"up-tok",children:[o.jsx("span",{className:"up-k",children:"cache c"}),Dt(Se)]}),!Oe&&o.jsx("span",{className:"up-tok up-scope",children:UF})]}),(V?G.length:Xe.length)>0&&o.jsxs("section",{className:`up-section${ie}`,children:[o.jsx("h3",{className:"up-section-title",children:"By model"}),o.jsxs("table",{className:"up-table",children:[o.jsx("thead",{children:o.jsxs("tr",{children:[o.jsx("th",{children:"Model"}),o.jsx("th",{children:"Tokens"}),o.jsx("th",{children:"Cost"})]})}),o.jsx("tbody",{children:V?G.map(ve=>o.jsxs("tr",{children:[o.jsx("td",{className:"up-model-name",title:ve.model,children:qa(ve.model)}),o.jsx("td",{className:"up-num",children:Dt(ve.tokens)}),ve.cost>0?o.jsx("td",{className:"up-num up-cost-val",children:ct(ve.cost)}):o.jsx("td",{className:"up-num up-unpriced",children:Wi})]},ve.model)):Xe.map(ve=>o.jsxs("tr",{children:[o.jsx("td",{className:"up-model-name",title:ve.model===Zx?"no model reported yet":ve.model,children:ve.model===Zx?"unknown":qa(ve.model)}),o.jsx("td",{className:"up-num",children:Dt(ve.inputTokens+ve.outputTokens)}),ve.priced?o.jsx("td",{className:"up-num up-cost-val",children:ct(ve.cost.total)}):o.jsx("td",{className:"up-num up-unpriced",children:Wi})]},ve.model))})]})]}),V&&ee.length===0&&L.tokens>0&&o.jsxs("section",{className:"up-section",children:[o.jsx("h3",{className:"up-section-title",children:"By session"}),o.jsxs("div",{className:"up-hint",children:["No session is dated ",ne," yet — ccusage dates sessions in UTC, and the totals above are your local day."]})]}),(V?ee.length:ot.length)>0&&(()=>{const ve=V?ee.length:ot.length;return o.jsxs("section",{className:`up-section${ie}`,children:[o.jsx("h3",{className:"up-section-title",children:o.jsxs("button",{type:"button",className:"up-disclose","aria-expanded":q,"aria-controls":"up-sessions",title:q?"Hide the per-session breakdown":`Show the per-session breakdown — ${ve} session${ve===1?"":"s"}`,onClick:()=>F(Re=>!Re),children:["By session",V&&o.jsxs("span",{className:"up-section-age",title:pq(ne,te,ct),children:["active ",ne]}),o.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:o.jsx("path",{d:"M2.2 3.6 5 6.4 7.8 3.6"})})]})}),o.jsxs("div",{className:"up-sessions",id:"up-sessions",hidden:!q,children:[V&&ee.map(Re=>{const Ue=ue.get(Re.sessionId);return o.jsxs("div",{className:"up-session-row",children:[Ue?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:`sl-dot state-${Ue}`,"aria-hidden":!0}),o.jsx("span",{className:"vis-hidden",children:ll(Ue)})]}):o.jsx("span",{className:"sl-dot up-dot-past","aria-hidden":!0}),o.jsx("span",{className:`up-session-label${Re.label?"":" up-session-id"}`,title:Re.label?`${Re.label}
|
|
88
|
+
${Re.sessionId}`:Re.sessionId,children:Re.label??Re.sessionId.slice(0,8)}),o.jsx("span",{className:"up-session-tokens",children:Dt(Re.tokens)}),Re.cost>0?o.jsx("span",{className:"up-session-cost",title:Re.models.join(", ")||void 0,children:ct(Re.cost)}):o.jsx("span",{className:"up-session-cost up-unpriced",children:Wi})]},Re.sessionId)}),!V&&ot.map(Re=>o.jsxs("div",{className:"up-session-row",children:[o.jsx("span",{className:`sl-dot state-${Re.state}`,"aria-hidden":!0}),o.jsx("span",{className:"vis-hidden",children:ll(Re.state)}),o.jsx("span",{className:"up-session-label",children:Re.label}),o.jsx("span",{className:"up-session-tokens",children:Dt(Re.inputTokens+Re.outputTokens)}),Re.cost>0?o.jsxs("span",{className:"up-session-cost",title:Re.unpricedTokens>0?`${Dt(Re.unpricedTokens)} tokens in this session are on an unpriced model, so this is a floor`:void 0,children:[ct(Re.cost),Re.unpricedTokens>0?"+":""]}):o.jsx("span",{className:"up-session-cost up-unpriced",children:Wi})]},Re.sessionId))]})]})})(),$e&&o.jsxs("div",{className:"up-hint",children:["“",Wi,"” means this build holds no published rate for that model — those tokens are counted above and their dollars are not."]})]}):o.jsx("div",{className:"up-empty",children:V?o.jsxs(o.Fragment,{children:["No usage ",ne,".",o.jsx("br",{}),"Try a longer period."]}):o.jsxs(o.Fragment,{children:["No usage data yet.",o.jsx("br",{}),"Start a Claude Code or Codex session."]})})]})}function Vp(e){return e<9.95?e.toFixed(1):String(Math.round(e))}function X0(e){const t=Number.isFinite(e)?Math.max(0,e):0;return t<50?{value:"0",unit:"KB/s"}:t<999500?{value:Vp(t/1e3),unit:"KB/s"}:t<9995e5?{value:Vp(t/1e6),unit:"MB/s"}:{value:Vp(t/1e9),unit:"GB/s"}}function Bh(e){const t=Number.isFinite(e)?Math.max(0,e):0;return t<999.5?{value:String(Math.round(t)),unit:"ms"}:{value:(t/1e3).toFixed(1),unit:"s"}}function Gc(e){return e.unit?e.unit==="%"||e.unit==="°C"?`${e.value}${e.unit}`:`${e.value} ${e.unit}`:e.value}function Gp(e,t){return t==="B/s"?X0(e):t==="ms"?Bh(e):{value:String(e),unit:t==="C"?"°C":t}}const Jt={l:30,r:6,t:6,b:2},Ta={l:0,r:0,t:2,b:1},zh=104,Iq=64;function Ur(e,t=100,n=zh,r=Jt){const a=n-r.t-r.b;return r.t+a*(1-Math.max(0,Math.min(t,e))/t)}function WR(e,t,n,r=100,a=zh,l=Jt){if(!e.length)return"";const c=e[e.length-1].t-e[0].t,u=h=>{const m=t-l.l-l.r;return l.l+(c>0?m*(h-e[0].t)/c:m/2)};let f="",p=null;for(const h of e){const m=p&&h.t-p.t<=n*2?"L":"M";f+=`${m}${u(h.t).toFixed(1)} ${Ur(h.v,r,a,l).toFixed(1)}`,p=h}return f}function VR(e,t,n,r=100,a=zh,l=Jt){if(e.length<2)return"";const c=a-l.b,u=e[e.length-1].t-e[0].t,f=t-l.l-l.r,p=w=>l.l+(u>0?f*(w-e[0].t)/u:f/2);let h="",m=[];const y=()=>{if(m.length>=2){let w=`M${p(m[0].t).toFixed(1)} ${c}`;for(const _ of m)w+=`L${p(_.t).toFixed(1)} ${Ur(_.v,r,a,l).toFixed(1)}`;h+=`${w}L${p(m[m.length-1].t).toFixed(1)} ${c}Z`}m=[]};for(const w of e)m.length&&w.t-m[m.length-1].t>n*2&&y(),m.push(w);return y(),h}function $q(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 GR(e,t,n){return n!=null&&e>=n?"hot":t!=null&&e>=t?"warn":""}function Oq(e,t,n=r=>Ro(r)){const r=e.filter(c=>c.v>0);if(!e.length)return null;if(!r.length)return"never held back";const a=r.length*(t/6e4),l=r[r.length-1];return`held back for ${a===1?"1 minute":`${a} minutes`}, last at ${n(l.t)}`}function Ro(e){const t=new Date(e);return`${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}`}function Z0(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 r=Math.floor(n/60),a=n%60;return a?`${r}h ${a}m`:`${r}h`}function Lq({group:e,title:t,onClose:n}){const r=sn(n),[a,l]=x.useState(null);x.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)&&l(w)}catch{}};h();const m=window.setInterval(h,2e4);return()=>{p=!1,window.clearInterval(m)}},[e]);const c=(a==null?void 0:a.series)??[],[u,f]=x.useMemo(()=>{let p=1/0,h=0;for(const m of c)m.points.length&&(p=Math.min(p,m.points[0].t),h=Math.max(h,m.points[m.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]},[c,a==null?void 0:a.sinceMs]);return _n.createPortal(o.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:o.jsxs("div",{ref:r,className:"modal hist-modal",onClick:p=>p.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"hist-modal-title",children:[o.jsxs("div",{className:"modal-head",children:[o.jsx("span",{className:"modal-title",id:"hist-modal-title",children:t}),a&&u>0&&o.jsxs("span",{className:"hist-since",children:["since ",Ro(u)," · ",Z0(u,f||Date.now())]}),o.jsx("button",{type:"button",className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),o.jsx("div",{className:"hist-body",children:a==null?o.jsx("p",{className:"hist-empty",children:"Reading…"}):c.length===0?o.jsx("p",{className:"hist-empty",children:"Nothing has been measured yet."}):c.map(p=>o.jsx(Pq,{series:p,stepMs:a.stepMs},p.label))})]})}),document.body)}function Pq({series:e,stepMs:t}){const n=x.useRef(null),[r,a]=x.useState(560),[l,c]=x.useState(null);x.useEffect(()=>{const F=n.current;if(!F||typeof ResizeObserver>"u")return;const O=new ResizeObserver(([H])=>a(Math.max(160,H.contentRect.width)));return O.observe(F),()=>O.disconnect()},[]);const{points:u,unit:f,warnAt:p,critAt:h,label:m,top:y,restsAtZero:w,changes:_}=e,k=w?Iq:zh,{now:j,peak:b}=$q(u),S=j!=null?Gp(j,f):null,E=b!=null?Gp(b,f):null,C=m==="Throttling"?Oq(u,t):null,T=l!=null?u[l]:null,R=u.length>1?u[u.length-1].t-u[0].t:0,A=F=>{const O=r-Jt.l-Jt.r;return Jt.l+(R>0?O*(F-u[0].t)/R:O/2)},q=F=>{if(u.length<2)return;const O=F.currentTarget.getBoundingClientRect(),H=(F.clientX-O.left-Jt.l)/Math.max(1,O.width-Jt.l-Jt.r),K=u[0].t+R*Math.max(0,Math.min(1,H));let X=0;for(let I=1;I<u.length;I++)Math.abs(u[I].t-K)<Math.abs(u[X].t-K)&&(X=I);c(X)};return o.jsxs("section",{className:"hist-series","aria-label":`${m} history`,children:[o.jsxs("div",{className:"hist-head",children:[o.jsx("span",{className:"hist-label",children:m}),o.jsxs("span",{className:"hist-stats",children:[S&&o.jsxs(o.Fragment,{children:[o.jsx("b",{children:S.value}),o.jsxs("span",{children:[S.unit," now"]})]}),b!=null&&E&&o.jsxs(o.Fragment,{children:[o.jsx("b",{className:GR(b,p,h),children:E.value}),o.jsxs("span",{children:[E.unit," peak"]})]})]})]}),o.jsx("div",{className:"hist-plot",ref:n,children:o.jsxs("svg",{className:"hist-chart",width:"100%",height:k,viewBox:`0 0 ${r} ${k}`,preserveAspectRatio:"none",role:"img","aria-label":S==null||E==null?`${m}: nothing measured yet`:`${m}: ${Gc(S)} now, peak ${Gc(E)}, over ${Z0(u[0].t,u[u.length-1].t)}`,onPointerMove:q,onPointerLeave:()=>c(null),children:[[["warn",p],["hot",h]].map(([F,O])=>O==null||O>y?null:o.jsxs("g",{children:[o.jsx("line",{className:`hist-rule ${F}`,x1:Jt.l,x2:r-Jt.r,y1:Ur(O,y,k),y2:Ur(O,y,k)}),o.jsx("text",{className:`hist-rule-tag ${F}`,x:2,y:Ur(O,y,k)+3,children:O})]},F)),o.jsx("line",{className:"hist-floor",x1:Jt.l,x2:r-Jt.r,y1:k-Jt.b,y2:k-Jt.b}),(_??[]).filter(F=>F.from!=null&&u.length>1&&F.t>=u[0].t&&F.t<=u[u.length-1].t).map(F=>o.jsx("line",{className:"hist-mark",x1:A(F.t),x2:A(F.t),y1:Jt.t,y2:k-Jt.b},F.t)),o.jsx("path",{className:"hist-area",d:VR(u,r,t,y,k)}),o.jsx("path",{className:"hist-line",d:WR(u,r,t,y,k)}),u.length===1&&o.jsx("circle",{className:"hist-dot",cx:A(u[0].t),cy:Ur(u[0].v,y,k),r:3}),T&&o.jsxs("g",{children:[o.jsx("line",{className:"hist-cross",x1:A(T.t),x2:A(T.t),y1:Jt.t,y2:k-Jt.b}),o.jsx("circle",{className:"hist-dot",cx:A(T.t),cy:Ur(T.v,y,k),r:3})]})]})}),o.jsx("div",{className:"hist-axis",children:T?o.jsxs("span",{className:"hist-at",children:[Ro(T.t)," — ",(()=>{const F=Gp(T.v,f);return o.jsxs(o.Fragment,{children:[o.jsx("b",{children:F.value}),F.unit==="%"||F.unit==="°C"||!F.unit?F.unit:` ${F.unit}`]})})()]}):o.jsxs(o.Fragment,{children:[o.jsx("span",{children:u.length?Ro(u[0].t):""}),o.jsx("span",{children:u.length?Ro(u[u.length-1].t):""})]})}),C&&o.jsx("div",{className:"hist-note",children:C}),_==null?void 0:_.slice(-3).map(F=>o.jsx("div",{className:"hist-note hist-route",children:F.from==null?`Since ${Ro(F.t)} — ${F.label}`:`${Ro(F.t)} — ${F.label.charAt(0).toUpperCase()+F.label.slice(1)}`},F.t))]})}function Dq(e,t,n){if(n<=0||Lh(e))return{kind:"pass"};const r=t>=0&&t<n?t:-1;switch(e.key){case"ArrowDown":return{kind:"focus",index:r===-1?0:(r+1)%n};case"ArrowUp":return{kind:"focus",index:r===-1?n-1:(r-1+n)%n};case"Home":return{kind:"focus",index:0};case"End":return{kind:"focus",index:n-1};default:return{kind:"pass"}}}const Oa=4,zr=8;function Q0(e,t,n){const r=n.width-zr-(e.right+Oa),a=e.left-Oa-zr,l=t.width<=r||r>=a?"right":"left",c=l==="right"?e.right+Oa:e.left-Oa-t.width,u=n.height-zr*2,f=t.height<=u,p=f?t.height:Math.max(0,u);return{top:Math.max(zr,Math.min(e.top,n.height-zr-p)),left:Math.max(zr,c),side:l,maxHeight:f?null:p}}function Fq(e,t,n){const r=n.height-zr-(e.bottom+Oa),a=e.top-Oa-zr,l=t.height<=r||r>=a?"below":"above",c=l==="below"?r:a,u=t.height<=c,f=u?t.height:Math.max(0,c),p=l==="below"?e.bottom+Oa:e.top-Oa-f,h=Math.max(zr,Math.min(e.right-t.width,n.width-zr-t.width));return{top:Math.max(zr,p),left:h,side:l,maxHeight:u?null:f}}const KR='[role="menuitem"]';function r_(e){return e?Array.from(e.querySelectorAll(KR)).filter(t=>!t.disabled):[]}function e0({anchorId:e,boundaryId:t,id:n,className:r,role:a,labelledBy:l,start:c="first",onClose:u,children:f}){const p=x.useRef(u);p.current=u;const h=sn(()=>{var k;(k=document.getElementById(e))==null||k.focus(),p.current()},{popover:!0}),m=x.useCallback(()=>{var C;const k=h.current;if(!k)return;const j=document.getElementById(e);if(!j){p.current();return}const b=j.getBoundingClientRect(),S=t?(C=document.getElementById(t))==null?void 0:C.getBoundingClientRect():null;if(S&&(b.bottom<=S.top||b.top>=S.bottom)){k.contains(document.activeElement)&&j.focus({preventScroll:!0}),p.current();return}k.style.maxHeight="";const E=Fq(b,{width:k.offsetWidth,height:k.offsetHeight},{width:window.innerWidth,height:window.innerHeight});k.style.top=`${E.top}px`,k.style.left=`${E.left}px`,k.style.maxHeight=E.maxHeight==null?"":`${E.maxHeight}px`,k.dataset.side=E.side},[e,t,h]);x.useLayoutEffect(()=>{m()}),x.useEffect(()=>{const k=j=>{var b;(b=h.current)!=null&&b.contains(j.target)||m()};return window.addEventListener("scroll",k,!0),window.addEventListener("resize",m),()=>{window.removeEventListener("scroll",k,!0),window.removeEventListener("resize",m)}},[m,h]),x.useEffect(()=>{const k=j=>{var S,E;const b=j.target;!b||(S=h.current)!=null&&S.contains(b)||(E=document.getElementById(e))!=null&&E.contains(b)||p.current()};return window.addEventListener("pointerdown",k,!0),()=>window.removeEventListener("pointerdown",k,!0)},[e,h]),x.useEffect(()=>{var j;if(a!=="menu")return;const k=r_(h.current);(j=c==="last"?k[k.length-1]:k[0])==null||j.focus()},[]);const y=k=>{var j;if(a==="menu"&&k.key==="Tab"){k.stopPropagation(),(j=document.getElementById(e))==null||j.focus(),k.shiftKey&&k.preventDefault(),p.current();return}if(a==="menu"){const b=r_(h.current),S=Dq(k,b.indexOf(document.activeElement),b.length);S.kind==="focus"&&(k.preventDefault(),b[S.index].focus())}k.key.length===1&&k.stopPropagation()},w=k=>{k.target.closest("button, input, select, textarea, code")||k.preventDefault()},_=k=>{if(a!=="menu"||k.pointerType==="touch")return;const j=k.target.closest(KR);j&&!j.disabled&&document.activeElement!==j&&j.focus({preventScroll:!0})};return _n.createPortal(o.jsx("div",{ref:h,id:n,className:`anchored-popover${r?` ${r}`:""}`,role:a,"aria-labelledby":l,onKeyDown:y,onMouseDown:w,onPointerMove:_,children:f}),document.body)}const qq="thermal:Throttling";function Bq(e){var n,r,a,l;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),(r=e.loadavg)!=null&&r.length&&(t["load:1m"]=e.loadavg[0]);for(const c of((a=e.thermal)==null?void 0:a.celsius)??[])t[`thermal:${c.label}`]=c.celsius;return(l=e.thermal)!=null&&l.throttle&&(t[qq]=Math.max(0,100-e.thermal.throttle.speedLimit)),t}function Oc(e,t){return t==="B/s"?Gc(X0(e)):t==="ms"?Gc(Bh(e)):t==="C"?`${Math.round(e)}°`:t==="%"?`${Math.round(e)}%`:e.toFixed(2)}function Id(e,t){return t==="B/s"||t==="ms"||!Number.isInteger(e)?Oc(e,t):t==="C"?`${e}°`:t==="%"?`${e}%`:`${e}`}const s_=["cores","memory","load","thermal"],To=116,us=24,zq=60,Hq=6e4;function Uq(e){return e.points.length?e.restsAtZero?e.points.some(t=>t.v>0):!0:!1}function Wq(e){return e.unit==="C"?`${e.label} temp`:e.key==="mem:physical"?"Physical RAM":e.key==="mem:swap"?`${e.label} memory`:e.label}function Vq(e,t=zq){return e.points.length<=t?e:{...e,points:e.points.slice(-t)}}function Gq({sys:e}){const[t,n]=x.useState({});x.useEffect(()=>{let c=!0;const u=async()=>{const p=await Promise.all(s_.map(async h=>{try{const m=await fetch(`/api/system/history?group=${h}`);return m.ok?[h,await m.json()]:[h,null]}catch{return[h,null]}}));c&&n(h=>{const m={...h};for(const[y,w]of p)w!=null&&w.ok&&(m[y]=w);return m})};u();const f=setInterval(()=>void u(),Hq);return()=>{c=!1,clearInterval(f)}},[]);const r=x.useMemo(()=>Bq(e),[e]),a=x.useMemo(()=>s_.flatMap(c=>{const u=t[c];return u?u.series.filter(Uq).map(f=>({series:Vq(f),stepMs:u.stepMs})):[]}),[t]),l=x.useMemo(()=>{let c=1/0,u=-1/0;for(const{series:f}of a){const p=f.points;p.length&&(c=Math.min(c,p[0].t),u=Math.max(u,p[p.length-1].t))}return Number.isFinite(c)?Z0(c,u):"less than a minute"},[a]);return Object.keys(r).length?o.jsx("div",{className:"pl-strip",role:"group","aria-label":`This machine, over the last ${l}`,children:a.map(({series:c,stepMs:u})=>o.jsx(Kq,{series:c,stepMs:u,now:r[c.key],span:l},c.key))}):null}function Kq({series:e,stepMs:t,now:n,span:r}){var w;const{points:a,top:l,unit:c,warnAt:u,critAt:f}=e,p=Wq(e),h=n??((w=a[a.length-1])==null?void 0:w.v),m=h==null?"":GR(h,u,f),y=Math.max(...a.map(_=>_.v));return o.jsxs("div",{className:`pl-cell${m?` ${m}`:""}`,title:[`${p} · peak ${Oc(y,c)} over the last ${r}`,u!=null?`over ${Id(u,c)} is uncomfortable`:"",f!=null?`over ${Id(f,c)} the machine acts`:""].filter(Boolean).join(" · "),children:[o.jsxs("div",{className:"pl-cell-head",children:[o.jsx("span",{className:"pl-cell-label",children:p}),o.jsx("span",{className:"pl-cell-now",children:h==null?"—":Oc(h,c)})]}),o.jsxs("svg",{className:"pl-spark",width:To,height:us,viewBox:`0 0 ${To} ${us}`,preserveAspectRatio:"none","aria-hidden":!0,children:[o.jsx("line",{className:"pl-spark-floor",x1:0,x2:To,y1:us-Ta.b,y2:us-Ta.b}),o.jsx("path",{className:"pl-spark-area",d:VR(a,To,t,l,us,Ta)}),u!=null&&o.jsx("line",{className:"pl-rule warn",x1:0,x2:To,y1:Ur(u,l,us,Ta),y2:Ur(u,l,us,Ta)}),f!=null&&o.jsx("line",{className:"pl-rule hot",x1:0,x2:To,y1:Ur(f,l,us,Ta),y2:Ur(f,l,us,Ta)}),o.jsx("path",{className:"pl-spark-line",d:WR(a,To,t,l,us,Ta)})]}),o.jsxs("span",{className:"vis-hidden",children:["peak ",Oc(y,c)," over the last ",r,u!=null&&`, uncomfortable over ${Id(u,c)}`,f!=null&&`, the machine acts over ${Id(f,c)}`]})]})}const Yq={key:"cpu",dir:"desc"};function Xq(e,t){return e.key===t?{...e,dir:e.dir==="asc"?"desc":"asc"}:{key:t,dir:t==="name"||t==="user"?"asc":"desc"}}function Zq(e,t){const n=t.dir==="asc"?1:-1,r=l=>t.key==="cpu"?l.cpu:t.key==="mem"?l.mem:t.key==="rss"?l.rssBytes:t.key==="threads"?l.threads:l.uptimeSec,a=(l,c)=>{if(t.key==="name")return n*l.name.localeCompare(c.name,void 0,{sensitivity:"base"});if(t.key==="user"){const p=l.user??"",h=c.user??"";return!p||!h?p===h?0:p?-1:1:n*p.localeCompare(h,void 0,{sensitivity:"base"})}const u=r(l),f=r(c);return u==null||f==null?u==null?f==null?0:1:-1:n*(u-f)};return[...e].sort((l,c)=>a(l,c)||(c.cpu??-1)-(l.cpu??-1)||c.mem-l.mem||l.pid-c.pid)}function Qq(e,t){return e.key!==t?"none":e.dir==="asc"?"ascending":"descending"}const Jq=4e3;function e8(){const[e,t]=x.useState(null);return x.useEffect(()=>{let n=!0;const r=async()=>{if(document.visibilityState!=="hidden")try{const l=await fetch("/api/system/processes?detail=1");if(!l.ok)return;const c=await l.json();n&&(c!=null&&c.ok)&&t({procs:c.procs??[],total:c.total??0})}catch{}};r();const a=window.setInterval(r,Jq);return()=>{n=!1,window.clearInterval(a)}},[]),e}function t8(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,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r++;return`${n>=100?n.toFixed(0):n.toFixed(1)} ${t[r]}`}function n8(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 r8({sys:e,onClose:t}){const n=sn(t),[r,a]=x.useState(Yq),l=e8(),c=l?Zq(l.procs,r):null;return _n.createPortal(o.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:o.jsxs("div",{ref:n,className:"modal pl-modal",onClick:u=>u.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"pl-modal-title",children:[o.jsxs("div",{className:"modal-head",children:[o.jsx("span",{className:"modal-title",id:"pl-modal-title",children:"Busiest processes"}),l&&o.jsxs("span",{className:"pl-count",children:[c.length," of ",l.total," running"]}),o.jsx("button",{type:"button",className:"glyph-btn",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),o.jsxs("div",{className:"pl-split",children:[o.jsx("div",{className:"pl-body",children:c==null?o.jsx("p",{className:"pl-empty",children:"Reading the process list…"}):c.length===0?o.jsx("p",{className:"pl-empty",children:"Could not read the process list on this platform."}):o.jsxs("table",{className:"sd-procs pl-table",children:[o.jsx("thead",{children:o.jsxs("tr",{children:[o.jsx(Fi,{col:"cpu",label:"cpu",sort:r,onSort:a}),o.jsx(Fi,{col:"rss",label:"memory",note:"Resident set size, which is what ps and Task Manager report; macOS Activity Monitor shows a different figure.",sort:r,onSort:a}),o.jsx(Fi,{col:"threads",label:"threads",sort:r,onSort:a}),o.jsx(Fi,{col:"uptime",label:"up",sort:r,onSort:a}),o.jsx(Fi,{col:"user",label:"user",sort:r,onSort:a}),o.jsx("th",{scope:"col",className:"pl-pid-h",children:"pid"}),o.jsx(Fi,{col:"name",label:"process",note:"Command lines have anything secret-shaped removed, which is a filter and not a guarantee.",sort:r,onSort:a})]})}),o.jsx("tbody",{children:c.map(u=>o.jsxs("tr",{children:[o.jsx("td",{className:"sd-num",children:u.cpu==null?"—":u.cpu.toFixed(0)}),o.jsx("td",{className:"sd-num sd-dim",title:`${u.mem.toFixed(1)}% of installed memory`,children:t8(u.rssBytes)}),o.jsx("td",{className:"sd-num sd-dim",children:u.threads??"—"}),o.jsx("td",{className:"sd-num sd-dim",children:n8(u.uptimeSec)}),o.jsx("td",{className:"sd-dim pl-user",children:u.user??"—"}),o.jsx("td",{className:"sd-num sd-dim pl-pid",children:u.pid}),o.jsxs("td",{className:"pl-name",children:[u.name,u.cmd&&o.jsxs("span",{className:"pl-cmd",title:u.cmd,children:[" ",u.cmd]})]})]},u.pid))})]})}),o.jsx(Gq,{sys:e})]})]})}),document.body)}function Fi({col:e,label:t,note:n,sort:r,onSort:a}){const l=Qq(r,e);return o.jsx("th",{scope:"col","aria-sort":l,children:o.jsxs("button",{type:"button",className:"sd-sort",title:n?`Sort by ${t}
|
|
89
|
+
|
|
90
|
+
${n}`:`Sort by ${t}`,onClick:()=>a(Xq(r,e)),children:[t,o.jsx("span",{className:"sd-sort-dir","aria-hidden":!0,children:l==="none"?"":l==="ascending"?"↑":"↓"})]})})}const s8=3e3;function a8(e,t,n){return e>=n?"hot":e>=t?"warn":"calm"}function o8(e,t,n=Date.now()){const r=Math.max(0,Math.min(100,100-e));return{pct:r,value:`${r}%`,tone:r===0?"calm":r>=30?"hot":"warn",note:r>0?`CPU held to ${e}% of full speed to cool down`:t?`at full speed · held to ${100-t.peak}% ${i8(t.lastMs,n)}`:"running at full speed, and never held back"}}function i8(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 r=Math.floor(n/60);return r===1?"an hour ago":`${r} hours ago`}function kc(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 l8(e){const t=Math.floor(e/86400),n=Math.floor(e%86400/3600),r=Math.floor(e%3600/60);return t>0?`${t}d ${n}h`:n>0?`${n}h ${r}m`:`${r}m`}function c8(e){var n,r,a;const t=(r=(n=e.thermal)==null?void 0:n.throttle)==null?void 0:r.speedLimit;return t!=null&&t<100?`throttled to ${t}% of full speed`:e.memory&&e.memory.usedPct>=90?`physical memory ${Math.round(e.memory.usedPct)}% full`:(a=e.network)!=null&&a.api&&e.network.api.ms==null?"the Claude API is not answering":null}function u8(){const[e,t]=x.useState(null),n=x.useRef(null);return x.useEffect(()=>{let r=!0;const a=async()=>{if(document.visibilityState!=="hidden")try{const f=await fetch("/api/system");if(!f.ok)return;const p=await f.json();r&&(p!=null&&p.ok)&&t(p)}catch{}},l=()=>{n.current==null&&(a(),n.current=window.setInterval(a,s8))},c=()=>{n.current!=null&&(window.clearInterval(n.current),n.current=null)},u=()=>{if(document.visibilityState==="hidden"){c();return}l(),a()};return l(),document.addEventListener("visibilitychange",u),()=>{r=!1,c(),document.removeEventListener("visibilitychange",u)}},[]),e}function a_({usageOpen:e,leaving:t,sub:n,flag:r,onClose:a,children:l}){return o.jsxs("aside",{className:`sysdetail${e?" shifted":""}${t?" leaving":""}`,id:"system-panel","aria-labelledby":"sd-title",children:[o.jsxs("div",{className:"sd-top",children:[o.jsxs("div",{className:"sd-head",children:[o.jsx("h2",{className:"sd-title",id:"sd-title",children:"This machine"}),n&&o.jsx("span",{className:"sd-sub",children:n}),o.jsx("button",{type:"button",className:"glyph-btn sd-close",onClick:a,"aria-label":"Close",title:"Close",children:"×"})]}),r&&o.jsx("p",{className:"sd-flag",children:r})]}),l]})}function d8({usageOpen:e,leaving:t,onClose:n}){const r=u8();if(!r||r.cpu==null||!r.memory)return o.jsx(a_,{usageOpen:e,leaving:t,onClose:n,children:o.jsx("div",{className:"sd-note",children:"reading this machine…"})});const{memory:a,swap:l,perCore:c,loadavg:u,cores:f,uptimeSec:p,platform:h,thermal:m,network:y,cpu:w}=r;return o.jsxs(a_,{usageOpen:e,leaving:t,sub:`up ${l8(p)} · ${f} cores`,flag:c8(r),onClose:n,children:[o.jsx(h8,{cpu:w,perCore:c,loadavg:u,cores:f}),o.jsx(f8,{memory:a,swap:l,platform:h}),y&&o.jsx(p8,{network:y}),o.jsx(y8,{thermal:m}),o.jsx(w8,{sys:r})]})}function h8({cpu:e,perCore:t,loadavg:n,cores:r}){const a=!!t&&t.length>0;return!a&&!n?null:o.jsxs("div",{className:"sd-section sd-cpu",role:"group","aria-label":"CPU",children:[a&&o.jsx(Kc,{group:"cores",title:"Core history",action:"Show core history",label:"CPU",value:e==null?null:`${Math.round(e)}%`,children:o.jsx("div",{className:"sd-cores",role:"img","aria-label":`${t.length} logical cores, busiest at ${Math.round(Math.max(...t))}%`,children:t.map((l,c)=>o.jsx("span",{className:"sd-core",title:`logical core ${c+1} · ${l}% busy`,children:o.jsx("span",{className:"sd-core-fill",style:{transform:`scaleY(${Math.max(2,l)/100})`}})},c))})}),n&&o.jsxs(Kc,{group:"load",title:"Load history",action:"Show load history",label:"Load average",hint:"the queue for the cores, counted in tasks rather than as a share of them",children:[o.jsx("div",{className:"sd-figs",title:"The queue for this machine's cores, averaged over one, five and fifteen minutes. A count of tasks, not a share of the CPU.",children:n.map((l,c)=>o.jsx(t0,{value:l.toFixed(2),cap:["1m","5m","15m"][c]},c))}),n[0]>r&&o.jsx("div",{className:"sd-note",children:`${(n[0]/r).toFixed(1)}× more work queued than cores to run it`})]})]})}function f8({memory:e,swap:t,platform:n}){const r=e.total-e.available,a=n==="win32"?"Commit":"Swap",l=t&&t.total>0?t.used/t.total*100:0;return o.jsx("div",{className:"sd-section",role:"group","aria-label":"Memory",children:o.jsxs(Kc,{group:"memory",title:"Memory history",action:"Show memory history",label:"Memory",children:[o.jsx(mh,{label:"Physical",value:o.jsxs(o.Fragment,{children:[o.jsx("b",{children:kc(r)})," of ",kc(e.total)]}),pct:e.usedPct,tone:e.usedPct>=90?"warn":"calm",note:`${kc(e.available)} available`}),t&&t.total>0&&o.jsx(mh,{label:a,value:o.jsxs(o.Fragment,{children:[o.jsx("b",{children:kc(t.used)})," of ",kc(t.total)]}),pct:l,tone:l>=90?"warn":"calm"})]})})}function p8({network:e}){const{down:t,up:n,api:r,route:a}=e,[l,c]=x.useState(!1),u=r&&r.ms!=null?Bh(r.ms):null,f=t!=null&&n!=null;return o.jsxs("div",{className:"sd-section",role:"group","aria-label":"Network",children:[o.jsxs(Kc,{group:"network",title:"Network history",action:"Show network history",label:"Network",children:[(f||u)&&o.jsxs("div",{className:"sd-figs sd-figs-named",children:[f&&[["Download",t],["Upload",n]].map(([p,h])=>{const m=X0(h);return o.jsx(t0,{value:m.value,unit:m.unit,cap:p},p)}),u&&o.jsx(t0,{value:u.value,unit:u.unit,cap:"Claude API"})]}),!f&&o.jsx("div",{className:"sd-note",children:"measuring…"}),r&&r.ms==null&&o.jsx("div",{className:"sd-note sd-note-warn",children:"Can’t reach Claude"})]}),a&&o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",className:"sd-detail",id:"sd-conn","aria-expanded":l,"aria-haspopup":"dialog",onClick:()=>c(p=>!p),children:["Connection details",a.relay&&o.jsx("span",{className:"sd-route-relay",children:" · relayed"}),o.jsx("i",{className:"sd-row-more","aria-hidden":!0,children:"›"})]}),l&&o.jsx(g8,{route:a,api:r,onClose:()=>c(!1)})]})]})}function t0({value:e,unit:t,cap:n}){return t?o.jsxs("span",{className:"sd-fig",children:[o.jsx("span",{className:"sd-fig-cap",children:n}),o.jsxs("span",{className:"sd-fig-read",children:[o.jsx("b",{children:e})," ",o.jsx("span",{className:"sd-fig-unit",children:t})]})]}):o.jsxs("span",{className:"sd-fig",children:[o.jsx("b",{children:e}),o.jsx("span",{className:"sd-fig-cap",children:n})]})}function m8(e){return e.kind==="tailscale-exit"?e.node?`Tailscale exit node ${e.node}`:"a Tailscale exit node":e.kind==="tailscale"?"Tailscale":`${e.name?`${e.name} `:""}VPN${e.iface?` (${e.iface})`:""}`}function g8({route:e,api:t,onClose:n}){return o.jsxs(e0,{anchorId:"sd-conn",boundaryId:"system-panel",id:"sd-conn-pop",className:"sd-pop",role:"dialog",labelledBy:"sd-conn-title",onClose:n,children:[o.jsx("p",{className:"sd-pop-title",id:"sd-conn-title",children:"Connection"}),o.jsxs("dl",{className:"sd-pop-rows",children:[o.jsxs("div",{className:"sd-pop-row",children:[o.jsx("dt",{children:e.to==="claude"?"Traffic to Claude":"Internet traffic"}),o.jsxs("dd",{children:["through ",m8(e)]})]}),e.relay&&o.jsxs("div",{className:"sd-pop-row",children:[o.jsx("dt",{children:"Relay"}),o.jsxs("dd",{children:[o.jsx("span",{className:"sd-route-relay",children:e.relay})," — not a direct path, so every packet carries one more round trip than it has to"]})]}),t&&o.jsxs("div",{className:"sd-pop-row",children:[o.jsx("dt",{children:"Round trip"}),o.jsx("dd",{children:t.ms==null?`${t.host} did not answer`:`${Gc(Bh(t.ms))} to open a connection to ${t.host}`})]}),o.jsxs("div",{className:"sd-pop-row",children:[o.jsx("dt",{children:"Throughput"}),o.jsx("dd",{children:"every interface on this machine, not this path alone"})]})]})]})}function Kc({group:e,title:t,action:n,label:r,value:a,hint:l,children:c}){const[u,f]=x.useState(!1);return o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",className:"sd-open",onClick:()=>f(!0),title:n,"aria-label":a==null?n:`${n}, now ${a}`,"aria-describedby":l?`sd-hint-${e}`:void 0,children:[o.jsxs("div",{className:"sd-h","aria-hidden":!0,children:[r," ",o.jsx("i",{className:"sd-row-more",children:"›"}),a!=null&&o.jsx("span",{className:"sd-h-val",children:a})]}),c]}),l&&o.jsx("span",{id:`sd-hint-${e}`,className:"vis-hidden",children:l}),u&&o.jsx(Lq,{group:e,title:t,onClose:()=>f(!1)})]})}function y8({thermal:e}){if(!e)return null;const t=e.throttle?o8(e.throttle.speedLimit,e.heldBack):null;return o.jsx("div",{className:"sd-section",role:"group","aria-label":"Thermal",children:o.jsxs(Kc,{group:"thermal",title:"Thermal history",action:"Show thermal history",label:"Thermal",children:[e.celsius.map(n=>o.jsx(mh,{label:n.label,value:o.jsxs(o.Fragment,{children:[o.jsx("b",{children:n.celsius})," °C"]}),pct:n.celsius/n.critAt*100,mark:n.warnAt/n.critAt*100,tone:a8(n.celsius,n.warnAt,n.critAt),title:`bar runs 0–${n.critAt} °C · amber from ${n.warnAt} °C, red at ${n.critAt} °C`,trackLabel:`${n.celsius} °C on a bar that runs to ${n.critAt} °C, amber from ${n.warnAt} °C`},n.label)),t&&o.jsx(mh,{label:"Throttling",value:o.jsx("b",{children:t.value}),pct:t.pct,tone:t.tone,note:t.note})]})})}function w8({sys:e}){const[t,n]=x.useState(!1);return o.jsxs("div",{className:"sd-section sd-door-section",children:[o.jsx("button",{type:"button",className:"sd-open sd-door",onClick:()=>n(!0),"aria-label":"Show every process the deck is watching",children:o.jsxs("span",{className:"sd-door-plate",children:[o.jsxs("span",{className:"sd-door-name",children:["Busiest processes",o.jsx("i",{className:"sd-row-more","aria-hidden":!0,children:"›"})]}),o.jsx("span",{className:"sd-door-sub",children:"every process, with its command line"})]})}),t&&o.jsx(r8,{sys:e,onClose:()=>n(!1)})]})}function mh({label:e,value:t,pct:n,tone:r="calm",note:a,mark:l,title:c,trackLabel:u}){return o.jsxs("div",{className:"sd-row",title:c,children:[o.jsxs("div",{className:"sd-row-head",children:[o.jsx("span",{className:"sd-row-label",children:e}),o.jsx("span",{className:"sd-row-val",children:t})]}),o.jsxs("span",{className:"sd-track",role:u?"img":void 0,"aria-label":u,children:[o.jsx("span",{className:`sd-fill${r==="calm"?"":` ${r}`}`,style:{transform:`scaleX(${n<=0?0:Math.max(1,Math.min(100,n))/100})`}}),l!=null&&l>0&&l<100&&o.jsx("span",{className:"sd-mark",style:{left:`${l}%`},"aria-hidden":!0})]}),a&&o.jsx("div",{className:"sd-note",children:a})]})}function o_(e){return{inputTokens:e.i,outputTokens:e.o,cacheReadTokens:e.cr,cacheCreateTokens:e.cc,cacheCreate1hTokens:e.c1h,cacheCreate5mTokens:e.c5m}}function i_(e){let t=0;for(const n of Object.values(e))t+=n.i+n.o+n.cr+n.cc;return t}function v8(e,t,n,r=Date.now()){const a=n.size>0,l=new Map;for(const[E,C]of n){const T=E.indexOf("|"),R=E.slice(0,T),A=E.slice(T+1),q=$o(C.usage,A,r).total,F=q>0?C.cost/q:1;let O=l.get(R);O||(O=new Map,l.set(R,O)),O.set(A,F)}const c=(E,C)=>{const T=l.get(E);return(T==null?void 0:T.get(C))??(T==null?void 0:T.get(pl(C)))??1},u=(E,C)=>{let T=0;for(const[R,A]of Object.entries(E))T+=$o(o_(A),R,r).total*c(C,R);return T},f=new Map,p=[];for(const E of e){const C=new Map;let T=0;for(const R of E.projects){const A=u(R.models,E.day);C.set(R.path,(C.get(R.path)??0)+A),T+=A;let q=f.get(R.path);q||(q={path:R.path,cost:0,tokens:0},f.set(R.path,q)),q.cost+=A,q.tokens+=i_(R.models)}p.push({day:E.day,total:T,byPath:C})}const h=[...f.values()].sort((E,C)=>C.cost-E.cost||C.tokens-E.tokens),m=h.reduce((E,C)=>E+C.cost,0),y=h.reduce((E,C)=>E+C.tokens,0);let w=0,_=0;for(const E of n.values())w+=E.cost;for(const[E,C]of n)_+=$o(C.usage,E.slice(E.indexOf("|")+1),r).total;const k=_>0?w/_:1,j=t?i_(t):0;let b=0;if(t)for(const[E,C]of Object.entries(t))b+=$o(o_(C),E,r).total*k;const S=b>0||j>0?{cost:b,tokens:j}:null;return{projects:h,totalCost:m,totalTokens:y,perDay:p,unattributed:S,reconciled:a}}function YR(e){return/^[A-Za-z]:[\\/]$/.test(e)?e:e.replace(/[\\/]+$/,"")}function Kp(e){const t=YR(e).replace(/\\/g,"/");return/^[A-Za-z]:\//.test(t)?t.toLowerCase():t}function $d(e,t){if(!e)return e;const n=YR(e),r=n.match(/^\/(?:Users|home)\/[^/]+(\/.*)?$/);if(r)return`~${r[1]??""}`;const a=n.replace(/\\/g,"/").match(/^[A-Za-z]:\/Users\/[^/]+(\/.*)?$/i);return a?`~${a[1]??""}`:n.replace(/\\/g,"/")}function x8(e,t){const n=Kp(e);let r;for(const a of t){const l=Kp(a.path);!l||l===n||!n.startsWith(`${l}/`)||(!r||Kp(r.path).length<l.length)&&(r=a)}return r==null?void 0:r.label}const b8=[{days:7,label:"7d"},{days:30,label:"30d"},{days:0,label:"All"}],qi=["var(--usage-blue)","var(--usage-green)","var(--usage-amber)","var(--usage-purple)","var(--usage-indigo)","var(--usage-red)","var(--usage-orange)","var(--usage-zinc)"],k8="var(--usage-zinc)",Yp=6;function l_(e){return`${e.getFullYear()}${String(e.getMonth()+1).padStart(2,"0")}${String(e.getDate()).padStart(2,"0")}`}function N8(e){const t=ct(e),n=/^\$(\d{4,})$/.exec(t);return n?`$${Number(n[1]).toLocaleString("en-US")}`:t}function c_(e,t){if(t<=0||e<=0)return"0%";const n=e/t*100;return n<.01?"<0.01%":n<1?`${n.toFixed(2)}%`:n<10?`${n.toFixed(1)}%`:`${Math.round(n)}%`}function _8(e){const t=/^\d{4}-(\d{2})-(\d{2})$/.exec(e);return t?`${Number(t[1])}/${Number(t[2])}`:e}function S8(e){const t=Math.max(1,Math.ceil(e/6));return n=>n===0||n===e-1||n%t===0}function Xp(e){if(!e)return"";try{return new Date(e).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}catch{return""}}function j8({num:e,name:t,onClose:n}){const[r,a]=x.useState(7),[l,c]=x.useState(null),[u,f]=x.useState(null),[p,h]=x.useState(null),[m,y]=x.useState(()=>new Set),[w,_]=x.useState(!0),[k,j]=x.useState(null),b=x.useRef(null),S=sn(n,{focusRef:b}),E=x.useRef(0);x.useEffect(()=>{const A=++E.current;_(!0),j(null),h(null),y(new Set);const q=r===0?60:r,F=l_(new Date(Date.now()-(q-1)*864e5)),O=l_(new Date),H=fetch(`/api/account-projects?num=${e}&days=${r}`,{credentials:"same-origin"}).then(X=>X.ok?X.json():Promise.reject(new Error(`HTTP ${X.status}`))),K=fetch(`/api/ccusage?since=${F}&until=${O}`,{credentials:"same-origin"}).then(X=>X.ok?X.json():null).catch(()=>null);Promise.all([H,K]).then(([X,I])=>{if(A!==E.current)return;c(X);const Z=I;f(Z&&Z.ok!==!1?Z:null),_(!1)}).catch(X=>{A===E.current&&(j(X.message||"Could not load"),_(!1))})},[e,r]);const C=x.useMemo(()=>{const A=Date.now();if(!l)return null;const q=ne=>typeof ne=="number"&&Number.isFinite(ne)?ne:0,F=new Map;if(u){const ne=Array.isArray(u.days)?u.days:[];for(const ie of ne){const me=typeof ie.period=="string"?ie.period:"",je=Array.isArray(ie.modelBreakdowns)?ie.modelBreakdowns:[];for(const Oe of je){const Ve=typeof Oe.modelName=="string"?Oe.modelName:"";if(!me||!/claude/i.test(Ve))continue;const Le=`${me}|${Ve}`,Te=F.get(Le),nt=Te?Te.usage:{inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0,cacheCreate1hTokens:0,cacheCreate5mTokens:0};nt.inputTokens+=q(Oe.inputTokens),nt.outputTokens+=q(Oe.outputTokens),nt.cacheReadTokens+=q(Oe.cacheReadTokens),nt.cacheCreateTokens+=q(Oe.cacheCreationTokens),Te?Te.cost+=q(Oe.cost):F.set(Le,{cost:q(Oe.cost),usage:nt})}}}const O=v8(l.daily??[],l.unattributed,F,A),H=ne=>ne.replace(/[\\/]+$/,"").split(/[\\/]/).pop()||ne||"(unknown)",K=new Map;for(const ne of O.projects)K.set(H(ne.path),(K.get(H(ne.path))??0)+1);const X=ne=>{const ie=H(ne);if((K.get(ie)??0)<=1)return ie;const me=ne.replace(/[\\/]+$/,"").split(/[\\/]/).slice(-2,-1)[0];return me?`${me}/${ie}`:ie},I=O.projects.map(ne=>({path:ne.path,label:X(ne.path)})),Z=ne=>({path:ne.path,label:X(ne.path),parentLabel:x8(ne.path,I),cost:ne.cost,tokens:ne.tokens}),W=qi[Yp%qi.length],$=new Map,z=[],U=O.projects.slice(0,Yp),V=O.projects.slice(Yp);U.forEach((ne,ie)=>{$.set(ne.path,qi[ie%qi.length]),z.push({key:ne.path,...Z(ne),color:qi[ie%qi.length]})}),V.length&&z.push({key:"__other__",label:`Other · ${V.length} project${V.length>1?"s":""}`,cost:V.reduce((ne,ie)=>ne+ie.cost,0),tokens:V.reduce((ne,ie)=>ne+ie.tokens,0),color:W,muted:!0,members:V.map(Z)});const B=O.totalCost,Y=O.totalTokens,ue=B>0?"cost":"tokens",G=ue==="cost"?B:Y,ee=z.map(ne=>ne.color),L=O.perDay.map(ne=>{const ie=new Map;for(const[me,je]of ne.byPath){const Oe=$.get(me)??W;ie.set(Oe,(ie.get(Oe)??0)+je)}return{day:ne.day,total:ne.total,costByColor:ie}}),te=L.reduce((ne,ie)=>Math.max(ne,ie.total),0);return{rows:z,totalCost:B,totalTokens:Y,basis:ue,denom:G,un:O.unattributed,reconciled:O.reconciled,chart:L,maxDay:te,colorOrder:ee}},[l,u]),T=l!=null&&l.trackedSince?`Tracked since ${Xp(l.trackedSince)}`:"Tracking starts with this version",R=r===0?"all time":`the last ${r} days`;return _n.createPortal(o.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:o.jsxs("div",{ref:S,className:"modal ap-proj-modal",onClick:A=>A.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"ap-proj-title ap-proj-sub",children:[o.jsxs("header",{className:"ap-proj-head",children:[o.jsxs("div",{className:"ap-proj-titlewrap",children:[o.jsx("div",{className:"ap-proj-title",id:"ap-proj-title",children:"Projects"}),o.jsx("div",{className:"ap-proj-sub",id:"ap-proj-sub",title:t,children:t})]}),o.jsx("div",{className:"uh-range",role:"group","aria-label":"Range",children:b8.map(A=>o.jsx("button",{type:"button",className:"uh-range-btn","aria-pressed":r===A.days,onClick:()=>a(A.days),children:A.label},A.days))}),o.jsx("button",{ref:b,className:"glyph-btn ap-proj-close",onClick:n,"aria-label":"Close",children:"×"})]}),o.jsxs("div",{className:"ap-proj-body",children:[w&&o.jsx("div",{className:"ap-proj-state",children:"Loading…"}),!w&&k&&o.jsxs("div",{className:"ap-proj-state ap-proj-error",children:["Couldn’t load this report: ",k]}),!w&&!k&&C&&o.jsx(o.Fragment,{children:C.rows.length===0?o.jsxs("div",{className:"ap-proj-state",children:["No work attributed to this account in ",R,".",o.jsxs("div",{className:"ap-proj-note",children:[T,". Only work from this version onward can be tied to an account."]})]}):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"ap-proj-bar",role:"img","aria-label":`Share of ${ct(C.totalCost)} across ${C.rows.length} projects`,children:C.rows.map(A=>{const q=C.basis==="cost"?A.cost:A.tokens,F=C.denom>0?q/C.denom*100:0;return F<=0?null:o.jsx("span",{className:"ap-proj-seg",style:{width:`${F}%`,background:A.color},title:`${A.label} · ${ct(A.cost)} · ${c_(A.cost,C.totalCost)}${A.tokens?` · ${Dt(A.tokens)} tokens`:""}`},A.key)})}),o.jsxs("div",{className:"ap-proj-totals",children:[o.jsx("span",{className:"ap-proj-total-cost",children:ct(C.totalCost)}),o.jsxs("span",{className:"ap-proj-total-tok",children:[Dt(C.totalTokens)," tokens"]}),o.jsxs("span",{className:"ap-proj-total-win",children:["· ",R]})]}),C.chart.length>0&&o.jsxs("div",{className:"ap-proj-days",children:[o.jsxs("div",{className:"ap-proj-days-cap",children:["By day",C.chart.length>1?" · click a bar":""]}),o.jsx("div",{className:"ap-proj-days-plot",role:"img","aria-label":`Spend across ${C.chart.length} day${C.chart.length>1?"s":""}`,children:C.chart.map(A=>{const q=C.maxDay>0?A.total/C.maxDay*100:0,F=p===A.day,O=C.rows.map(K=>({label:K.label,c:A.costByColor.get(K.color)??0})).filter(K=>K.c>0),H=`${Xp(Date.parse(`${A.day}T00:00:00`))}, ${ct(A.total)}. ${O.map(K=>`${K.label} ${ct(K.c)}`).join(", ")}`;return o.jsx("button",{type:"button",className:`ap-proj-day${F?" selected":""}`,"aria-pressed":F,"aria-label":H,title:`${A.day} · ${ct(A.total)}`,onClick:()=>h(K=>K===A.day?null:A.day),children:o.jsx("span",{className:"ap-proj-col",style:{height:`${q}%`},children:C.colorOrder.map((K,X)=>{const I=A.costByColor.get(K)??0;return I<=0||A.total<=0?null:o.jsx("span",{className:"ap-proj-colseg",style:{height:`${I/A.total*100}%`,background:K}},X)})})},A.day)})}),(()=>{const A=S8(C.chart.length);return o.jsx("div",{className:"ap-proj-days-axis","aria-hidden":"true",children:C.chart.map((q,F)=>o.jsx("div",{className:"ap-proj-axis-cell",children:A(F)?_8(q.day):""},q.day))})})(),(()=>{const A=p?C.chart.find(F=>F.day===p):null;if(!A)return null;const q=C.rows.map(F=>({r:F,c:A.costByColor.get(F.color)??0})).filter(F=>F.c>0);return o.jsxs("div",{className:"ap-proj-day-detail",children:[o.jsxs("div",{className:"ap-proj-day-detail-head",children:[o.jsx("span",{children:Xp(Date.parse(`${A.day}T00:00:00`))}),o.jsx("span",{className:"ap-proj-day-detail-total",children:ct(A.total)})]}),q.map(({r:F,c:O})=>o.jsxs("div",{className:"ap-proj-day-detail-row",children:[o.jsx("span",{className:"ap-proj-dot",style:{background:F.color},"aria-hidden":"true"}),o.jsx("span",{className:"ap-proj-day-detail-name",children:F.label}),o.jsx("span",{className:"ap-proj-day-detail-cost",children:ct(O)})]},F.key))]})})()]}),o.jsx("ul",{className:"ap-proj-list",children:C.rows.map(A=>{const q=C.basis==="cost"?A.cost:A.tokens,F=C.denom>0?q/C.denom*100:0,O=m.has(A.key);return o.jsxs("li",{className:`ap-proj-row${A.muted?" muted":""}${O?" expanded":""}`,children:[o.jsx("span",{className:"ap-proj-dot",style:{background:A.color},"aria-hidden":"true"}),o.jsxs("span",{className:"ap-proj-name",children:[A.label,A.parentLabel&&o.jsxs("span",{className:"ap-proj-parent",children:[" · in ",A.parentLabel]})]}),o.jsx("span",{className:"ap-proj-track",title:`${c_(A.cost,C.totalCost)} of tracked cost`,children:o.jsx("span",{className:"ap-proj-fill",style:{width:`${F}%`,background:A.color}})}),o.jsx("span",{className:"ap-proj-cost",children:ct(A.cost)}),o.jsx("span",{className:"ap-proj-tok",children:Dt(A.tokens)}),o.jsx("button",{type:"button",className:"glyph-btn ap-proj-info","aria-expanded":O,"aria-label":`${O?"Hide":"Show"} location for ${A.label}`,onClick:()=>y(H=>{const K=new Set(H);return K.has(A.key)?K.delete(A.key):K.add(A.key),K}),children:"ⓘ"}),O&&A.path&&o.jsxs("div",{className:"ap-proj-details",children:[o.jsx("code",{className:"ap-proj-path",children:$d(A.path)}),o.jsx("button",{type:"button",className:"ap-proj-copy",onClick:()=>{Ba($d(A.path))},children:"Copy"})]}),O&&A.members&&o.jsx("div",{className:"ap-proj-details ap-proj-other-members",children:A.members.map(H=>o.jsxs("div",{className:"ap-proj-other-member",children:[o.jsxs("div",{className:"ap-proj-other-name",children:[H.label,H.parentLabel&&o.jsxs("span",{className:"ap-proj-parent",children:[" · in ",H.parentLabel]})]}),o.jsx("code",{className:"ap-proj-path",children:$d(H.path)}),o.jsx("span",{className:"ap-proj-cost",children:ct(H.cost)}),o.jsx("span",{className:"ap-proj-tok",children:Dt(H.tokens)}),o.jsx("button",{type:"button",className:"ap-proj-copy","aria-label":`Copy location for ${H.label}`,onClick:()=>{Ba($d(H.path))},children:"Copy"})]},H.path))})]},A.key)})}),C.un&&o.jsxs("div",{className:"ap-proj-unattributed",children:[o.jsx("span",{className:"ap-proj-dot",style:{background:k8},"aria-hidden":"true"}),o.jsxs("div",{className:"ap-proj-un-labels",children:[o.jsx("span",{className:"ap-proj-un-title",children:"Unattributed usage"}),o.jsx("span",{className:"ap-proj-un-tag",children:"Excluded from the project totals"})]}),o.jsx("span",{className:"ap-proj-un-cost",children:N8(C.un.cost)}),o.jsx("span",{className:"ap-proj-un-tok",children:Dt(C.un.tokens)}),o.jsx("div",{className:"ap-proj-note",children:"Work no account could be tied to — from before tracking, or a gap."})]}),o.jsxs("div",{className:"ap-proj-foot",children:[C.reconciled?"Dollars from ccusage · split by activity":"Dollars estimated · ccusage unavailable"," · ",T]})]})})]})]})}),document.body)}const u_=18,E8=1100,Bi=(e,t)=>{const n=Math.sin(e*12.9898+t*78.233)*43758.5453;return n-Math.floor(n)},C8=Array.from({length:u_},(e,t)=>{const n=-72+144*t/(u_-1)+(Bi(t,1)-.5)*9,r=(n-90)*(Math.PI/180),a=(54+32*Math.cos(n*Math.PI/180))*(.74+Bi(t,2)*.52);return{dx:Math.cos(r)*a,dy:Math.sin(r)*a,rot:(t%2?1:-1)*(100+Bi(t,3)*260),delay:Math.round(Bi(t,4)*90),dur:760+Math.round(Bi(t,5)*260),scale:.8+Bi(t,6)*.45,hue:t%4,round:t%3===0}});function d_({anchor:e}){var a;const[t,n]=x.useState(null),r=typeof window<"u"&&((a=window.matchMedia)==null?void 0:a.call(window,"(prefers-reduced-motion: reduce)").matches);return x.useEffect(()=>{if(r)return;const l=e.current;if(!l)return;const c=l.getBoundingClientRect();n({x:c.left+c.width/2,y:c.top+c.height/2});const u=window.setTimeout(()=>n(null),E8);return()=>window.clearTimeout(u)},[e,r]),r||!t?null:_n.createPortal(o.jsx("div",{className:"confetti",style:{left:`${t.x}px`,top:`${t.y}px`},"aria-hidden":!0,children:C8.map((l,c)=>o.jsx("span",{className:`confetti-bit${l.round?" round":""}`,"data-hue":l.hue,style:{"--dx":`${l.dx.toFixed(1)}px`,"--dy":`${l.dy.toFixed(1)}px`,"--rot":`${l.rot}deg`,"--s":l.scale.toFixed(2),animationDelay:`${l.delay}ms`,animationDuration:`${l.dur}ms, ${l.dur}ms`}},c))}),document.body)}const XR=new Set(["awaiting_url","awaiting_code","registering"]);function T8(e){return e!=null&&XR.has(e)}function ZR(e){return e!=null&&e!=="done"&&!XR.has(e)}const A8="the sign-in ended before it finished — the deck restarted, or it was cancelled in another tab",R8="the sign-in did not complete";function M8({state:e,serverError:t,localError:n}){const r=e==="idle";return{title:r?"Sign-in ended":"Sign-in failed",message:n||t||(r?A8:R8)}}function I8({restored:e,activeAccount:t}){if(e!==!1)return null;const n=(t==null?void 0:t.email)||((t==null?void 0:t.num)!=null?`account ${t.num}`:null);return n?`This machine is now signed in as ${n} — the account you were using could not be put back. Switch back from the accounts panel.`:"The account you were using could not be put back — check which account this machine is signed in as from the accounts panel."}function $8({started:e,state:t}){return!e||t==="done"?null:{action:"login-cancel"}}const O8="done";function L8(){let e=!1;return{shouldAnnounce(t){return t!==O8?(e=!1,!1):e?!1:(e=!0,!0)}}}function J0(e,t){return t&&Object.hasOwn(e,t)?e[t]:void 0}const P8={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 ${tn}`,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"},D8={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"},F8=`claude-swap could not read the login keychain — start ${tn} from a Terminal window rather than a background service`,QR={401:"this deck did not accept the page as its own, so nothing was changed",403:"this deck refused a change from this address — open it on the address the deck prints, not through a proxy"};function n0(e,t,n){const r=n==null?null:QR[n];if(r)return r;if((e==null?void 0:e.reason)!=="no_cswap"&&/keychain/i.test(Yc(e)))return F8;const a=J0(D8,e==null?void 0:e.reason);return a||(e==null?void 0:e.reason)||t}function Yc(e){return((e==null?void 0:e.output)||(e==null?void 0:e.detail)||(e==null?void 0:e.error)||"").trim()}const q8={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"},B8="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 z8(e){return/\bnpx\b/i.test(e)&&/(command not found|not found|not recognized|ENOENT)/i.test(e)}const H8="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",U8="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",W8=e=>/\b(?:ERR_)?MODULE_NOT_FOUND\b|cannot find (?:module|package)/i.test(e),V8=/node_modules[\\/]npm[\\/]bin[\\/]|\bnpm-prefix\.js\b|\bnp[mx][-.][\w.-]*cli\.js\b/i,G8=/[\\/]_npx[\\/]/i,K8=`the copy of ccusage ${tn} installed for itself`;function Y8(e){const t=String((e==null?void 0:e.install)??"").replace(/\s+/g," ").trim();return t.length>240?`${t.slice(0,239)}…`:t}function sY(e,t){const n=X8(e,t),r=Y8(e);switch(e==null?void 0:e.stage){case"npx":return r?`ccusage failed on both of its paths. The managed install failed first — ${r} — and the deck then fell back to npx, where ${Nc(n)}`:`there is no managed copy of ccusage on this machine, and the npx fallback failed: ${Nc(n)}`;case"managed":return`${K8} failed to run: ${Nc(n)}`;case"path":return e.bin?`the ccusage this deck found at ${e.bin} failed to run: ${Nc(n)}`:`the ccusage this deck found on your PATH failed to run: ${Nc(n)}`;default:return n}}const Nc=e=>/^[A-Z][a-z]/.test(e)?e[0].toLowerCase()+e.slice(1):e;function X8(e,t){const n=Yc(e);if(W8(n)){if(G8.test(n))return U8;if(V8.test(n))return H8}if(z8(n))return B8;const r=J0(q8,e==null?void 0:e.reason);return r||(e==null?void 0:e.reason)||t}function Ki(e,t,n){const r=n==null?null:QR[n];if(r)return r;if(e!=null&&e.detail)return e.detail;if(e!=null&&e.error&&ZR(e.state))return e.error;const a=J0(P8,e==null?void 0:e.reason);return a||(e!=null&&e.error?e.error:(e==null?void 0:e.reason)||t)}function Z8(e,t,n){if(n<=0||Lh(e))return{kind:"pass"};const r=t>=0&&t<n?t:-1;switch(e.key){case"ArrowRight":return{kind:"select",index:r===-1?0:(r+1)%n};case"ArrowLeft":return{kind:"select",index:r===-1?n-1:(r-1+n)%n};case"Home":return{kind:"select",index:0};case"End":return{kind:"select",index:n-1};default:return{kind:"pass"}}}function JR(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 Q8(e){const t=new Map;for(const n of e){const r=(n.email??"").trim().toLowerCase();r&&t.set(r,(t.get(r)??0)+1)}return e.map(n=>{const r=(n.email??"").trim(),a=n.alias||r||`account ${n.num}`,l=[];return n.alias&&r&&l.push(r),r&&(t.get(r.toLowerCase())??0)>1&&l.push(n.org||`slot ${n.num}`),{num:n.num,label:a,sub:l.length?l.join(" · "):null}})}function J8(e,t){return e.filter(n=>!t.includes(n.num)).map(n=>n.num)}function eB(e,t){return e.includes(t)?e.filter(n=>n!==t):[...e,t]}function tB(e){return e.length?{action:"share",accounts:[...e]}:null}function nB(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 r0(e){return`${e.email}|${e.org??""}`}function rB(e,t,n){return e&&e.map(r=>r0(r)===t?n:r)}function sB(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 aB(e){const t=e.length;if(!t)return"Nothing to import.";const n=p=>e.filter(h=>h.state===p).length,r=[],a=n("imported");a&&r.push(`${a} of ${t} imported`);const l=n("healed");l&&r.push(`${l} had a dead token replaced`);const c=n("updated");c&&r.push(`${c} updated`);const u=n("present");u&&r.push(`${u} already here`);const f=n("failed");return f&&r.push(`${f} did not arrive`),`${r.join(", ")}.`}const oB=1500,Od=[{id:"login",label:"Sign in"},{id:"paste",label:"Paste a share"}],h_="aa-panel",f_=e=>`aa-tab-${e}`;async function _c(e){return(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json().catch(()=>null)}const s0=pe.forwardRef((e,t)=>o.jsxs("svg",{className:"aa-mark",viewBox:"0 0 44 44","aria-hidden":!0,ref:t,children:[o.jsx("circle",{className:"aa-mark-ring",cx:"22",cy:"22",r:"20"}),o.jsx("path",{className:"aa-mark-tick",d:"M13.5 22.5 L19.5 28.5 L31 17"})]}));s0.displayName="SuccessMark";function iB({onClose:e,onChanged:t}){const[n,r]=x.useState("login"),[a,l]=x.useState(null),[c,u]=x.useState(""),[f,p]=x.useState(""),[h,m]=x.useState(!1),[y,w]=x.useState(null),[_,k]=x.useState(null),[j,b]=x.useState(null),[S,E]=x.useState(null),C=x.useRef(""),T=x.useRef(!1),R=x.useRef(!1),A=x.useRef(null),q=x.useRef(null),F=x.useRef(null),O=x.useRef(null),H=x.useRef([]),K=x.useRef(!1),X=x.useCallback(()=>{const L=$8({started:T.current,state:a==null?void 0:a.state});L&&_c(L).catch(()=>{}),e()},[e,a==null?void 0:a.state]),I=sn(X,{focusRef:F}),Z=x.useCallback(async()=>{if(!Hs(R.current))return;R.current=!0,m(!0),w(null),T.current=!0;const L=await _c({action:"login"}).catch(()=>null);if(R.current=!1,m(!1),!(L!=null&&L.ok)){w(Ki(L,"could not start the sign-in"));return}l(L)},[]);x.useEffect(()=>{if(!T8(a==null?void 0:a.state))return;const L=window.setInterval(async()=>{try{const te=await fetch("/api/claude-accounts/login");te.ok&&l(await te.json())}catch{}},oB);return()=>window.clearInterval(L)},[a]);const W=x.useRef(t);W.current=t;const $=x.useState(L8)[0];x.useEffect(()=>{var L;(a==null?void 0:a.state)==="awaiting_code"&&((L=A.current)==null||L.focus()),$.shouldAnnounce(a==null?void 0:a.state)&&W.current()},[a==null?void 0:a.state,$]),x.useEffect(()=>{var L;n==="paste"&&!K.current&&((L=q.current)==null||L.focus()),K.current=!1},[n]);const z=x.useCallback(L=>{var ne;const te=Z8(L,Od.findIndex(ie=>ie.id===n),Od.length);te.kind!=="pass"&&(L.preventDefault(),K.current=!0,r(Od[te.index].id),(ne=H.current[te.index])==null||ne.focus())},[n]),U=x.useCallback(async()=>{var te;if(!Hs(R.current))return;R.current=!0,m(!0),w(null);const L=await _c({action:"login-code",code:c}).catch(()=>null);if(R.current=!1,m(!1),!(L!=null&&L.ok)){w(Ki(L,"the code was not accepted")),L!=null&&L.state&&l(L),(te=A.current)==null||te.select();return}u(""),l(L)},[c,a]),V=x.useCallback(async()=>{if(!Hs(R.current))return;R.current=!0,m(!0),w(null);const L=await _c({action:"import",blob:f}).catch(()=>null);if(R.current=!1,m(!1),!(L!=null&&L.ok)){w(Ki(L,"the import failed"));return}C.current=f,p(""),E(null),k(L.results??[]),t()},[f,t]),B=x.useCallback(async L=>{const te=r0(L);if(!Hs(R.current)||!C.current)return;R.current=!0,m(!0),b(te),E(null);const ne=await _c({action:"import",blob:C.current,force:!0,only:{email:L.email,org:L.org??""}}).catch(()=>null);if(R.current=!1,m(!1),b(null),!(ne!=null&&ne.ok)){E({key:te,text:Ki(ne,"that account could not be updated")});return}const ie=(ne.results??[])[0];ie&&k(me=>rB(me,te,ie)),t()},[t]),Y=(a==null?void 0:a.state)==="done"?a.account:null,ue=I8({restored:a==null?void 0:a.restored,activeAccount:a==null?void 0:a.activeAccount}),G=ZR(a==null?void 0:a.state)||!!(y&&T.current&&!h),ee=M8({state:a==null?void 0:a.state,serverError:a==null?void 0:a.error,localError:y});return _n.createPortal(o.jsx("div",{className:"modal-backdrop",onClick:X,role:"presentation",children:o.jsxs("div",{ref:I,className:"modal aa-modal",onClick:L=>L.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Add a Claude account",children:[o.jsxs("header",{className:"modal-head",children:[o.jsx("div",{className:"modal-title",children:o.jsx("span",{className:"aa-tabs",role:"tablist","aria-label":"How to add the account",onKeyDown:z,children:Od.map((L,te)=>o.jsx("button",{type:"button",role:"tab",id:f_(L.id),ref:ne=>{H.current[te]=ne},"aria-selected":n===L.id,"aria-controls":h_,tabIndex:n===L.id?0:-1,className:`aa-tab${n===L.id?" on":""}`,onClick:()=>{K.current=!1,r(L.id)},children:L.label},L.id))})}),o.jsx("div",{className:"modal-actions",children:o.jsx("button",{type:"button",className:"glyph-btn",onClick:X,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),o.jsx("section",{className:"modal-body aa-body",id:h_,role:"tabpanel","aria-labelledby":f_(n),children:n==="login"?Y?o.jsxs("div",{className:"aa-done",children:[o.jsx(s0,{ref:O}),o.jsx(d_,{anchor:O}),o.jsx("h4",{children:Y.added?`Account ${Y.num} added`:"Credentials refreshed"}),o.jsxs("p",{className:"aa-note",children:[o.jsx("strong",{children:Y.email}),Y.added?ue?" is in the rotation.":" is in the rotation. The account you were using is still active.":" was already managed, so its stored credentials were replaced."]}),ue?o.jsx("p",{className:"aa-note aa-warn",role:"status",children:ue}):null,o.jsx("button",{type:"button",className:"btn primary",onClick:X,children:"Done"})]}):(a==null?void 0:a.state)==="awaiting_code"||(a==null?void 0:a.state)==="registering"?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"aa-step",children:[o.jsx("h4",{children:"1 · Approve in the browser"}),o.jsx("p",{className:"aa-note",children:"A tab should have opened. If not, use this link:"}),o.jsx("a",{className:"aa-link",href:a.url??"#",target:"_blank",rel:"noreferrer noopener",children:a.url})]}),o.jsxs("div",{className:"aa-step",children:[o.jsx("h4",{children:"2 · Paste a code, if the page shows one"}),o.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."}),o.jsxs("div",{className:"aa-field",children:[o.jsx("input",{ref:A,type:"text",value:c,onChange:L=>u(L.target.value),onKeyDown:L=>{L.key==="Enter"&&c.trim()&&!h&&U()},placeholder:"paste the code here",spellCheck:!1,autoComplete:"off","aria-label":"Sign-in code",disabled:a.state==="registering"}),o.jsx("button",{type:"button",className:"btn primary",...$a(h,!c.trim()||a.state==="registering"),onClick:U,children:a.state==="registering"?"registering…":"Continue"})]}),(y||a.error)&&o.jsx("p",{className:"aa-err",children:y??a.error}),o.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."})]})]}):G?o.jsxs("div",{className:"aa-step",children:[o.jsx("h4",{children:ee.title}),o.jsx("p",{className:"aa-err",children:ee.message}),o.jsx("button",{type:"button",className:"btn",onClick:()=>{T.current=!1,l(null),w(null),Z()},children:"Try again"})]}):h||T.current?o.jsx("div",{className:"aa-step",children:o.jsx("p",{className:"aa-note",children:"Asking the claude CLI for a sign-in link…"})}):o.jsxs("div",{className:"aa-step aa-primer",children:[o.jsx("h4",{children:"Sign in to Anthropic"}),o.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."}),o.jsx("div",{className:"aa-actions",children:o.jsx("button",{type:"button",ref:F,className:"btn primary",onClick:Z,children:"Open the sign-in page"})})]}):_?(()=>{const L=_.filter(te=>te.state==="imported").length;return o.jsxs("div",{className:"aa-done",children:[o.jsx(s0,{ref:O}),L>0&&o.jsx(d_,{anchor:O}),o.jsx("h4",{children:aB(_)}),_.length>0&&o.jsx("ul",{className:"aa-results",children:_.map(te=>{const ne=r0(te);return o.jsxs("li",{className:`aa-result ${te.state}`,children:[o.jsx("span",{className:"aa-result-who",children:te.email||(te.num?`slot ${te.num}`:"an account")}),o.jsx("span",{className:"aa-result-what",children:sB(te.state)}),te.state==="present"&&o.jsx("button",{type:"button",className:"aa-result-fix","aria-busy":j===ne,title:`Overwrite the stored login for ${te.email} with the one in this share. Do this when that account has stopped working here; if it works, leave it.`,onClick:()=>B(te),children:j===ne?"updating…":"update anyway"}),(S==null?void 0:S.key)===ne&&o.jsx("span",{className:"aa-result-err",children:S.text})]},ne)})}),o.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",o.jsx("strong",{children:" update anyway"}),"."]}),o.jsxs("div",{className:"aa-actions",children:[o.jsx("button",{type:"button",className:"btn primary",onClick:X,children:"Done"}),o.jsx("button",{type:"button",className:"btn",onClick:()=>{C.current="",E(null),k(null)},children:"Import another"})]})]})})():o.jsxs("div",{className:"aa-step",children:[o.jsx("h4",{children:"Paste an account shared from another deck"}),o.jsxs("div",{className:"aa-field",children:[o.jsx("input",{ref:q,type:"text",value:f,onChange:L=>p(L.target.value),onKeyDown:L=>{L.key==="Enter"&&f.trim()&&!h&&V()},placeholder:"ccdeck2:…",spellCheck:!1,autoComplete:"off","aria-label":"Shared account"}),o.jsx("button",{type:"button",className:"btn primary",...$a(h,!f.trim()),onClick:V,children:h?"importing…":"Import"})]}),y&&o.jsx("p",{className:"aa-err",children:y}),o.jsxs("p",{className:"aa-note",children:["Use ",o.jsx("strong",{children:"share"})," on one account in the other deck, or ",o.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."]})]})})]})}),document.body)}const lB=6;function cB(e,t){const n=e.filter(u=>u.ready);if(t.armed&&e.length>0&&n.length===0)return{text:"Auto-switch has nowhere to go",tone:"bad",free:null};const r=n.length===e.length?`${e.length} ready`:n.length===0?e.length===1?"not ready":`none of ${e.length} ready`:`${n.length} of ${e.length} ready`,a=n.length?"ok":"idle",l=t.strained&&!t.armed?uB(n):null,c=[r];return l!=null&&c.push(`${l}% free`),c.push(t.armed?`auto ${t.threshold??"on"}${t.threshold?"%":""}`:"auto off"),{text:c.join(" · "),tone:a,free:l}}function uB(e){const t=e.map(n=>n.headroom).filter(n=>typeof n=="number");return t.length?Math.max(...t):null}function dB(e){const t=[...e].sort((a,l)=>{if(a.ready!==l.ready)return a.ready?-1:1;if(!a.ready)return a.name.localeCompare(l.name);const c=a.headroom,u=l.headroom;return c==null&&u==null?a.name.localeCompare(l.name):c==null?1:u==null?-1:u-c}),n=t.slice(0,lB),r=t.length-n.length;return{title:e.some(a=>a.ready)?"Where you could switch":"Nothing to switch to",shown:n,rest:r>0?`and ${r} more`:null}}function eM({title:e,steps:t,finish:n,aside:r,onClose:a}){const l=x.useRef(null),c=sn(a,{focusRef:l}),[u,f]=x.useState(0),p=u===t.length-1,h=t[u],m=_=>f(Math.max(0,Math.min(t.length-1,_))),y=_=>{_.key!=="ArrowRight"&&_.key!=="ArrowLeft"||(_.preventDefault(),_.stopPropagation(),m(_.key==="ArrowRight"?u+1:u-1))},w=()=>{if(!p){m(u+1);return}n?n.act():a()};return _n.createPortal(o.jsx("div",{className:"modal-backdrop",onClick:a,role:"presentation",children:o.jsxs("div",{ref:c,className:"modal guide",onClick:_=>_.stopPropagation(),onKeyDown:y,role:"dialog","aria-modal":"true","aria-labelledby":"guide-title",children:[o.jsxs("header",{className:"modal-head",children:[o.jsxs("div",{className:"modal-title",children:[o.jsx("span",{id:"guide-title",className:"modal-tool-name",children:e}),o.jsxs("span",{className:"modal-tool-id",children:[u+1," / ",t.length]})]}),o.jsx("div",{className:"modal-actions",children:o.jsx("button",{type:"button",className:"glyph-btn",onClick:a,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),o.jsxs("section",{className:"modal-body",children:[o.jsx("div",{className:"guide-stage",children:h.art},u),o.jsx("p",{className:"guide-line","aria-live":"polite",children:h.line}),o.jsx("p",{className:"guide-tip",children:h.tip??""}),o.jsxs("div",{className:"guide-foot",children:[o.jsx("div",{className:"guide-dots",children:t.map((_,k)=>o.jsx("button",{type:"button",className:"glyph-btn guide-dot","aria-label":`Step ${k+1} of ${t.length}`,"aria-current":k===u?"step":void 0,onClick:()=>m(k)},k))}),p&&r&&o.jsx("button",{type:"button",className:"ap-lan-word guide-aside",onClick:r.act,children:r.label}),u>0&&o.jsx("button",{type:"button",className:"btn",onClick:()=>m(u-1),children:"Back"}),o.jsx("button",{ref:l,type:"button",className:"btn primary",onClick:w,children:p?(n==null?void 0:n.label)??"Done":"Next"})]})]})]})}),document.body)}const a0={ok:"ga-ok",warn:"ga-warn",accent:"ga-accent",flight:"ga-flight"};function Nr({children:e}){return o.jsx("svg",{className:"guide-art",viewBox:"0 0 440 200","aria-hidden":!0,focusable:"false",children:e})}function kr({x:e,y:t=34,w:n=176,h:r=132,label:a}){return o.jsxs(o.Fragment,{children:[a&&o.jsx("text",{x:e+2,y:t-9,className:"ga-cap",children:a}),o.jsx("rect",{x:e,y:t,width:n,height:r,rx:10,className:"ga-screen"})]})}function Vr({x:e,y:t,email:n,state:r,tone:a,bars:l}){return o.jsxs(o.Fragment,{children:[o.jsx("circle",{cx:e+3,cy:t-4,r:3,className:a0[a]}),o.jsx("text",{x:e+12,y:t,className:"ga-t ga-mono",children:n}),o.jsx("text",{x:e+12,y:t+16,className:`ga-s ${a0[a]}`,children:r}),l==null?void 0:l.map((c,u)=>o.jsxs("g",{children:[o.jsx("text",{x:e,y:t+40+u*18,className:"ga-s",children:u?"7d":"5h"}),o.jsx("rect",{x:e+22,y:t+35+u*18,width:96,height:4,rx:2,className:"ga-track"}),o.jsx("rect",{x:e+22,y:t+35+u*18,width:96*c/100,height:4,rx:2,className:"ga-accent"}),o.jsxs("text",{x:e+148,y:t+40+u*18,className:"ga-s ga-accent",textAnchor:"end",children:[c,"%"]})]},u))]})}function tM({x:e,y:t,on:n}){return o.jsxs(o.Fragment,{children:[o.jsx("rect",{x:e,y:t,width:30,height:18,rx:9,className:n?"ga-switch-on":"ga-switch"}),o.jsx("circle",{cx:n?e+21:e+9,cy:t+9,r:6,className:n?"ga-knob-on":"ga-knob"})]})}function Ld({x:e,y:t,name:n,here:r=!0}){return o.jsxs(o.Fragment,{children:[o.jsx("circle",{cx:e+3,cy:t-4,r:3,className:r?"ga-ok":"ga-dim"}),o.jsx("text",{x:e+12,y:t,className:r?"ga-t":"ga-s",children:n})]})}function p_({x:e,y:t,on:n}){return n?o.jsxs(o.Fragment,{children:[o.jsx("rect",{x:e,y:t,width:12,height:12,rx:3,className:"ga-accent"}),o.jsx("path",{d:`M${e+3} ${t+6.2}l2.3 2.3 4-4.6`,className:"ga-tick"})]}):o.jsx("rect",{x:e+.5,y:t+.5,width:11,height:11,rx:3,className:"ga-box"})}function m_({x:e,y:t,d:n}){return o.jsx("path",{d:n,transform:`translate(${e} ${t})`,className:"ga-glyph"})}function eb({x:e,y:t}){return o.jsx("path",{d:`M${e} ${t}l0 13 3.4-3 2.4 5.2 2-.9-2.4-5.1 4.6-.2z`,className:"ga-pointer"})}function tb(){return o.jsxs(o.Fragment,{children:[o.jsx("circle",{r:9,className:"ga-key-bed"}),o.jsxs("g",{transform:"translate(-6 -6) scale(0.857)",className:"ga-key",children:[o.jsx("circle",{cx:4.6,cy:7,r:2.6}),o.jsx("path",{d:"M7.2 7h5.2M10.6 7v2.2M12.4 7v1.6"})]})]})}function Yi({x:e,y:t,w:n,title:r,sub:a,tone:l}){return o.jsxs(o.Fragment,{children:[o.jsx("rect",{x:e,y:t,width:n,height:40,rx:8,className:"ga-screen"}),o.jsx("rect",{x:e+6,y:t+10,width:3,height:20,rx:1.5,className:a0[l]}),o.jsx("text",{x:e+16,y:t+17,className:"ga-t ga-strong",children:r}),o.jsx("text",{x:e+16,y:t+31,className:"ga-s",children:a})]})}function el({x:e,y:t,label:n,live:r}){return o.jsxs(o.Fragment,{children:[o.jsx("rect",{x:e,y:t,width:46,height:20,rx:10,className:r?"ga-chip-live":"ga-chip"}),o.jsx("text",{x:e+23,y:t+14,className:"ga-s ga-mono",textAnchor:"middle",children:n})]})}function gh({x:e,y:t}){return o.jsxs(o.Fragment,{children:[o.jsx("text",{x:e,y:t,className:"ga-cap",children:"LOCAL NETWORK"}),o.jsx(tM,{x:e+118,y:t-13,on:!0})]})}function hB(){return o.jsxs(Nr,{children:[o.jsx("rect",{x:14,y:14,width:206,height:172,rx:10,className:"ga-screen"}),o.jsx("text",{x:28,y:38,className:"ga-t ga-strong",children:"Sessions"}),o.jsx("text",{x:206,y:38,className:"ga-s ga-warn",textAnchor:"end",children:"1 waiting"}),o.jsx("rect",{x:20,y:50,width:194,height:42,rx:6,className:"ga-bed-warn"}),o.jsx("circle",{cx:33,cy:64,r:7,className:"ga-ring-warn ga-ping"}),o.jsx("circle",{cx:33,cy:64,r:3.5,className:"ga-warn"}),o.jsx("text",{x:44,y:68,className:"ga-t",children:"api-server"}),o.jsx("text",{x:44,y:83,className:"ga-s ga-warn",children:"waiting 6m · Bash"}),o.jsx("circle",{cx:33,cy:108,r:3.5,className:"ga-flight"}),o.jsx("text",{x:44,y:112,className:"ga-t",children:"docs-site"}),o.jsx("text",{x:44,y:127,className:"ga-s",children:"running · 12 tools"}),o.jsx("circle",{cx:33,cy:150,r:3.5,className:"ga-ok"}),o.jsx("text",{x:44,y:154,className:"ga-t",children:"billing"}),o.jsx("text",{x:44,y:169,className:"ga-s",children:"done · $0.84"}),o.jsx("path",{d:"M216 71C234 71 230 100 244 100",className:"ga-arc"}),o.jsx("path",{d:"M239 96l5 4-5 4",className:"ga-arrow"}),o.jsx("rect",{x:248,y:44,width:178,height:112,rx:10,className:"ga-screen"}),o.jsx("text",{x:262,y:64,className:"ga-cap",children:"API-SERVER"}),o.jsx("line",{x1:248,y1:74,x2:426,y2:74,className:"ga-line"}),o.jsx("text",{x:262,y:96,className:"ga-s ga-mono",children:"Bash(npm test)"}),o.jsx("text",{x:262,y:116,className:"ga-t ga-mono ga-warn",children:"Allow this command?"}),o.jsx("text",{x:262,y:136,className:"ga-s ga-mono",children:"> 1. Yes 2. No"})]})}function fB(){return o.jsxs(Nr,{children:[o.jsx("path",{d:"M136 100C166 100 166 38 196 38",className:"ga-edge ga-flow"}),o.jsx("path",{d:"M136 100H196",className:"ga-edge ga-flow"}),o.jsx("path",{d:"M136 100C166 100 166 162 196 162",className:"ga-edge-done"}),o.jsx("path",{d:"M308 38H326M308 100H326",className:"ga-edge"}),o.jsx(Yi,{x:20,y:80,w:116,title:"main",sub:"Opus 5 · 9 tools",tone:"accent"}),o.jsx(Yi,{x:196,y:18,w:112,title:"explore",sub:"Haiku · 14 tools",tone:"flight"}),o.jsx(Yi,{x:196,y:80,w:112,title:"tests",sub:"Sonnet · 6 tools",tone:"flight"}),o.jsx(Yi,{x:196,y:142,w:112,title:"review",sub:"done · 38s",tone:"ok"}),o.jsx(el,{x:326,y:28,label:"Read"}),o.jsx(el,{x:380,y:28,label:"Grep",live:!0}),o.jsx(el,{x:326,y:90,label:"Bash",live:!0})]})}function g_({x:e,y:t,label:n,pct:r,note:a}){return o.jsxs(o.Fragment,{children:[o.jsx("text",{x:e,y:t,className:"ga-s",children:n}),o.jsxs("text",{x:e+194,y:t,className:"ga-s ga-accent",textAnchor:"end",children:[r,"%"]}),o.jsx("rect",{x:e,y:t+7,width:194,height:5,rx:2.5,className:"ga-track"}),o.jsx("rect",{x:e,y:t+7,width:194*r/100,height:5,rx:2.5,className:"ga-accent"}),o.jsx("text",{x:e,y:t+26,className:"ga-s",children:a})]})}function pB(){return o.jsxs(Nr,{children:[o.jsx("rect",{x:14,y:30,width:172,height:140,rx:10,className:"ga-screen"}),o.jsx("text",{x:30,y:56,className:"ga-cap",children:"THIS SESSION"}),o.jsx("text",{x:30,y:98,className:"ga-big",children:"$3.66"}),o.jsx("text",{x:30,y:122,className:"ga-s",children:"Opus 5 · 1.2M tokens"}),o.jsx("text",{x:30,y:150,className:"ga-s",children:"$21.40 today"}),o.jsx("rect",{x:200,y:30,width:226,height:140,rx:10,className:"ga-screen"}),o.jsx("text",{x:216,y:56,className:"ga-cap",children:"CLAUDE QUOTA"}),o.jsx(g_,{x:216,y:80,label:"5-hour window",pct:24,note:"resets in 53m"}),o.jsx(g_,{x:216,y:124,label:"7-day window",pct:61,note:"resets in 4d"})]})}function mB(){return o.jsxs(Nr,{children:[o.jsx("rect",{x:14,y:40,width:172,height:120,rx:10,className:"ga-canvas"}),o.jsx(Yi,{x:30,y:80,w:140,title:"tests",sub:"Sonnet 5 · 6 tools",tone:"flight"}),o.jsx(eb,{x:156,y:106}),o.jsx("path",{d:"M170 92C186 92 184 60 200 60",className:"ga-arc"}),o.jsx("path",{d:"M195 56l5 4-5 4",className:"ga-arrow"}),o.jsx(kr,{x:200,y:22,w:226,h:160}),o.jsx("text",{x:214,y:46,className:"ga-t ga-strong",children:"tests"}),o.jsx("text",{x:412,y:46,className:"ga-s",textAnchor:"end",children:"Sonnet 5 · 38s"}),o.jsx("line",{x1:200,y1:56,x2:426,y2:56,className:"ga-line"}),o.jsx("text",{x:214,y:76,className:"ga-cap",children:"PROMPT"}),o.jsx("text",{x:214,y:92,className:"ga-t",children:"Run the suite and fix what fails"}),o.jsx("text",{x:214,y:116,className:"ga-cap",children:"TOOLS · 6"}),o.jsx(el,{x:214,y:122,label:"Read"}),o.jsx(el,{x:266,y:122,label:"Edit"}),o.jsx(el,{x:318,y:122,label:"Bash",live:!0}),o.jsx("text",{x:214,y:164,className:"ga-cap",children:"TOKENS"}),o.jsx("text",{x:214,y:178,className:"ga-s ga-mono",children:"41k in · 2.1k out · $0.12"})]})}function gB(){const e=[18,24,28,14,22,26,30,16,24,28,20,26];return o.jsxs(Nr,{children:[o.jsx(kr,{x:14,y:20,w:412,h:160}),o.jsx("text",{x:28,y:44,className:"ga-t ga-strong",children:"This machine"}),o.jsx("text",{x:412,y:44,className:"ga-s",textAnchor:"end",children:"12 cores · up 10d"}),o.jsx("line",{x1:14,y1:56,x2:426,y2:56,className:"ga-line"}),o.jsx("text",{x:28,y:76,className:"ga-cap",children:"CORES"}),e.map((t,n)=>o.jsxs("g",{children:[o.jsx("rect",{x:28+n*15,y:82,width:10,height:30,rx:2,className:"ga-track"}),o.jsx("rect",{x:28+n*15,y:112-t,width:10,height:t,rx:2,className:"ga-accent"})]},n)),o.jsx("text",{x:28,y:136,className:"ga-cap",children:"MEMORY"}),o.jsx("rect",{x:28,y:143,width:178,height:5,rx:2.5,className:"ga-track"}),o.jsx("rect",{x:28,y:143,width:105,height:5,rx:2.5,className:"ga-accent"}),o.jsx("text",{x:28,y:165,className:"ga-s",children:"18.9 GB of 32.0 GB"}),o.jsx("text",{x:240,y:76,className:"ga-cap",children:"THERMAL"}),o.jsx("text",{x:240,y:100,className:"ga-big",children:"66 °C"}),o.jsx("text",{x:240,y:118,className:"ga-s ga-ok",children:"running at full speed"}),o.jsx("text",{x:240,y:142,className:"ga-cap",children:"BUSIEST PROCESSES"}),o.jsx("text",{x:240,y:160,className:"ga-s ga-mono",children:"node · claude"}),o.jsx("text",{x:412,y:160,className:"ga-s ga-mono",textAnchor:"end",children:"38%"}),o.jsx("text",{x:240,y:176,className:"ga-s ga-mono",children:"esbuild"}),o.jsx("text",{x:412,y:176,className:"ga-s ga-mono",textAnchor:"end",children:"21%"})]})}function yB(){return o.jsxs(Nr,{children:[o.jsx("rect",{x:14,y:40,width:188,height:120,rx:10,className:"ga-screen"}),o.jsx("text",{x:28,y:60,className:"ga-cap",children:"~/MY-PROJECT"}),o.jsx("line",{x1:14,y1:70,x2:202,y2:70,className:"ga-line"}),o.jsxs("text",{x:28,y:100,className:"ga-t ga-mono",children:[o.jsx("tspan",{className:"ga-accent",children:"$"})," claude"]}),o.jsx("rect",{x:86,y:90,width:7,height:13,className:"ga-caret ga-blink"}),o.jsx("text",{x:28,y:130,className:"ga-s ga-mono",children:"or: codex"}),o.jsx("path",{d:"M210 100H238",className:"ga-arc"}),o.jsx("path",{d:"M233 95l6 5-6 5",className:"ga-arrow"}),o.jsx("rect",{x:250,y:40,width:176,height:120,rx:10,className:"ga-canvas"}),o.jsx("g",{className:"ga-pop",children:o.jsx(Yi,{x:278,y:80,w:120,title:"my-project",sub:"Opus 5 · live",tone:"accent"})})]})}function wB(){return o.jsxs(Nr,{children:[o.jsx(kr,{x:14,y:16,w:232,h:170}),o.jsx("text",{x:28,y:40,className:"ga-t ga-strong",children:"Claude accounts"}),o.jsx(m_,{x:196,y:33,d:"M7 2.2v9.6M2.2 7h9.6"}),o.jsx(m_,{x:220,y:33,d:"M3.3 10.7L10.7 3.3M5.2 3.3h5.5v5.5"}),o.jsx("line",{x1:14,y1:52,x2:246,y2:52,className:"ga-line"}),o.jsx(Vr,{x:28,y:74,email:"work@team.dev",state:"working",tone:"ok",bars:[24,61]}),o.jsx("rect",{x:190,y:62,width:44,height:18,rx:9,className:"ga-accent"}),o.jsx("text",{x:212,y:74,className:"ga-s ga-on-accent",textAnchor:"middle",children:"active"}),o.jsx("line",{x1:14,y1:140,x2:246,y2:140,className:"ga-line"}),o.jsx(Vr,{x:28,y:160,email:"personal@me.dev",state:"signed in",tone:"ok"}),o.jsx("rect",{x:188,y:148,width:46,height:18,rx:9,className:"ga-chip"}),o.jsx("text",{x:211,y:160,className:"ga-s",textAnchor:"middle",children:"switch"}),o.jsx(eb,{x:221,y:161}),o.jsx("path",{d:"M250 40C270 40 262 78 282 78",className:"ga-arc"}),o.jsx("path",{d:"M277 74l5 4-5 4",className:"ga-arrow"}),o.jsx(kr,{x:282,y:62,w:144,h:64,label:"ANOTHER MACHINE"}),o.jsx("g",{className:"ga-pop",children:o.jsx(Vr,{x:296,y:92,email:"work@team.dev",state:"shared here",tone:"ok"})})]})}function vB(){return o.jsxs(Nr,{children:[o.jsx(kr,{x:14,label:"THIS MACHINE"}),o.jsx(gh,{x:28,y:60}),o.jsx("g",{className:"ga-swap-out",children:o.jsx(Vr,{x:28,y:98,email:"work@team.dev",state:"login expired",tone:"warn"})}),o.jsx("g",{className:"ga-swap-in",children:o.jsx(Vr,{x:28,y:98,email:"work@team.dev",state:"working again",tone:"ok",bars:[24,61]})}),o.jsx(kr,{x:250,label:"ANOTHER MACHINE"}),o.jsx(gh,{x:264,y:60}),o.jsx(Vr,{x:264,y:98,email:"work@team.dev",state:"working",tone:"ok",bars:[24,61]}),o.jsx("path",{d:"M246 120C234 80 206 80 194 120",className:"ga-arc"}),o.jsx("g",{className:"ga-travel ga-travel-low",transform:"translate(220 90)",children:o.jsx(tb,{})})]})}const xB=[{art:o.jsx(hB,{}),line:"Sessions waiting on you top the session list, longest wait first.",tip:"A tone and a system notification when one stops to ask. The speaker in the topbar."},{art:o.jsx(fB,{}),line:"Every agent and subagent is a node. Tool calls light up as they run."},{art:o.jsx(mB,{}),line:"Double-click any node: its prompt, every tool call, tokens and timing."},{art:o.jsx(pB,{}),line:"What each session costs, and how much quota is left."},{art:o.jsx(gB,{}),line:"Cores, memory and heat while the agents run, and what is hogging them."},{art:o.jsx(wB,{}),line:"Several Claude accounts: switch, add one, share one to another machine."},{art:o.jsx(vB,{}),line:"Your machines repair each other's expired logins over the local network.",tip:"Open it from the row at the foot of the Claude accounts panel."},{art:o.jsx(yB,{}),line:"Run claude or codex in any folder. It shows up here on its own."}];function bB(){return o.jsxs(Nr,{children:[o.jsx(kr,{x:14,label:"THIS MACHINE"}),o.jsx(Vr,{x:28,y:64,email:"work@team.dev",state:"login expired",tone:"warn"}),o.jsx("rect",{x:40,y:94,width:86,height:20,rx:10,className:"ga-pill-warn"}),o.jsx("text",{x:83,y:108,className:"ga-s ga-warn",textAnchor:"middle",children:"sign in again"}),o.jsx("line",{x1:198,y1:100,x2:242,y2:100,className:"ga-off"}),o.jsx(kr,{x:250,label:"ANOTHER MACHINE"}),o.jsx(Vr,{x:264,y:64,email:"work@team.dev",state:"working",tone:"ok",bars:[24,61]})]})}function kB(){return o.jsxs(Nr,{children:[o.jsx(kr,{x:14,label:"THIS MACHINE"}),o.jsx(gh,{x:28,y:60}),o.jsx(Ld,{x:28,y:92,name:"Ana's MacBook"}),o.jsx(Ld,{x:28,y:114,name:"Dorin's PC"}),o.jsx(kr,{x:250,label:"ANOTHER MACHINE"}),o.jsx(gh,{x:264,y:60}),o.jsx(Ld,{x:264,y:92,name:"Your MacBook"}),o.jsx(Ld,{x:264,y:114,name:"Dorin's PC"}),o.jsx("line",{x1:196,y1:100,x2:244,y2:100,className:"ga-arc"}),o.jsx("circle",{cx:220,cy:100,r:10,className:"ga-ring ga-ping"}),o.jsx("circle",{cx:220,cy:100,r:10,className:"ga-ring ga-ping ga-ping-2"}),o.jsx("circle",{cx:220,cy:100,r:3,className:"ga-accent"})]})}function NB(){return o.jsxs(Nr,{children:[o.jsx("rect",{x:90,y:18,width:260,height:164,rx:10,className:"ga-screen"}),o.jsx("text",{x:106,y:42,className:"ga-t ga-strong",children:"This deck on the network"}),o.jsx("line",{x1:90,y1:54,x2:350,y2:54,className:"ga-line"}),o.jsx("text",{x:106,y:76,className:"ga-cap",children:"SHARE THESE ACCOUNTS"}),o.jsx(p_,{x:106,y:88,on:!0}),o.jsx("text",{x:126,y:98,className:"ga-t ga-mono",children:"work@team.dev"}),o.jsx(p_,{x:106,y:112}),o.jsx("text",{x:126,y:122,className:"ga-s ga-mono",children:"personal@me.dev"}),o.jsx("text",{x:106,y:150,className:"ga-cap",children:"PAIRING"}),o.jsx("text",{x:106,y:168,className:"ga-s",children:"Say yes to every deck that asks"}),o.jsx(tM,{x:304,y:157,on:!0}),o.jsx(eb,{x:115,y:97})]})}function _B(){return o.jsxs(Nr,{children:[o.jsx(kr,{x:14,label:"THIS MACHINE"}),o.jsx("g",{className:"ga-swap-out",children:o.jsx(Vr,{x:28,y:64,email:"work@team.dev",state:"login expired",tone:"warn"})}),o.jsx("g",{className:"ga-swap-in",children:o.jsx(Vr,{x:28,y:64,email:"work@team.dev",state:"working again",tone:"ok",bars:[24,61]})}),o.jsx(kr,{x:250,label:"ANOTHER MACHINE"}),o.jsx(Vr,{x:264,y:64,email:"work@team.dev",state:"working",tone:"ok",bars:[24,61]}),o.jsx("path",{d:"M246 96C234 56 206 56 194 96",className:"ga-arc"}),o.jsx("g",{className:"ga-travel",transform:"translate(220 66)",children:o.jsx(tb,{})})]})}const SB=[{art:o.jsx(bB,{}),line:"A login can expire on one machine while it still works on another."},{art:o.jsx(kB,{}),line:"Both decks are on. They find each other and ask to pair.",tip:"Not showing up? The + in the section reaches a machine by address or invite."},{art:o.jsx(NB,{}),line:"Tick which logins this machine may hand out. Nothing is shared until you do."},{art:o.jsx(_B,{}),line:"An expired login is copied from a paired machine within a minute."}];function jB(){return o.jsxs("svg",{className:"guide-art",viewBox:"0 0 232 60","aria-hidden":!0,focusable:"false",children:[o.jsx("rect",{x:1,y:14,width:78,height:42,rx:7,className:"ga-screen"}),o.jsx("circle",{cx:13,cy:29,r:3,className:"ga-warn"}),o.jsx("rect",{x:21,y:27,width:46,height:4,rx:2,className:"ga-track"}),o.jsx("rect",{x:13,y:39,width:40,height:3,rx:1.5,className:"ga-track"}),o.jsx("rect",{x:153,y:14,width:78,height:42,rx:7,className:"ga-screen"}),o.jsx("circle",{cx:165,cy:29,r:3,className:"ga-ok"}),o.jsx("rect",{x:173,y:27,width:46,height:4,rx:2,className:"ga-track"}),o.jsx("rect",{x:165,y:39,width:40,height:3,rx:1.5,className:"ga-accent"}),o.jsx("path",{d:"M150 36C138 6 94 6 82 36",className:"ga-arc"}),o.jsx("g",{transform:"translate(116 13)",children:o.jsx(tb,{})})]})}const EB={panel:"Nothing here is stuck: whoever pastes an invite is the one dialling out. Ask them for one and paste it behind the + above, where an address can be typed too.",dialog:"Nothing here is stuck: whoever pastes an invite is the one dialling out. Ask them for one and paste it below, or type their address."},CB=1600;function nM({reach:e,where:t}){const[n,r]=x.useState(!1),a=x.useRef(!0);x.useEffect(()=>()=>{a.current=!1},[]);const l=(e==null?void 0:e.steps)??[],c=x.useCallback(async()=>{await Ba(l.join(`
|
|
91
|
+
`))&&a.current&&(r(!0),window.setTimeout(()=>{a.current&&r(!1)},CB))},[l]);if(!(e!=null&&e.blocked))return null;const u=e.shell==="sh";return o.jsxs("div",{className:"ap-lan-reach",children:[o.jsx("p",{className:"lan-warn",children:e.text}),o.jsx("p",{className:"lan-note",children:EB[t]}),l.length>0&&o.jsxs("details",{className:"ap-lan-reach-fix",children:[o.jsx("summary",{children:"or let them find this deck on their own"}),o.jsxs("p",{className:"lan-note",children:[u?o.jsx(o.Fragment,{children:"Run this in a terminal on this machine, then restart the deck."}):o.jsxs(o.Fragment,{children:["Run this in PowerShell ",o.jsx("strong",{children:"as Administrator"}),", then restart the deck."]}),e.category==="Public"&&o.jsx(o.Fragment,{children:" The first line marks this network as a home or office one — leave it out on a network you do not trust."}),e.unsure&&o.jsxs(o.Fragment,{children:[" ",e.unsure]})]}),o.jsx("pre",{className:"ap-lan-cmd",children:o.jsx("code",{children:l.join(`
|
|
92
|
+
`)})}),o.jsx("button",{type:"button",className:"ap-manage-btn",onClick:()=>void c(),title:u?"Copy these lines, then paste them into a terminal":"Copy these lines, then paste them into an elevated PowerShell",children:n?"copied":"copy command"})]})]})}async function Zp(e,t){return(await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json().catch(()=>null)}const TB={not_an_invite:"That is not an invite — paste the whole line they sent you.",expired:"That invite has run out. Ask them for a fresh one.",not_running:"This deck is not on the network yet. Turn Local network on, then try again."},AB={not_running:"This deck is not on the network yet. Turn Local network on, then make one."};function y_(e,t,n){return(t==null?void 0:t.reason)&&e[t.reason]||en(n,t)}function RB({status:e,manual:t,onClose:n,onChanged:r}){const a=x.useRef(null),l=sn(n,{focusRef:a}),[c,u]=x.useState(""),[f,p]=x.useState(""),[h,m]=x.useState(null),[y,w]=x.useState(null),[_,k]=x.useState(null),[j,b]=x.useState(null),[S,E]=x.useState(()=>Date.now());x.useEffect(()=>{const $=window.setInterval(()=>E(Date.now()),1e3);return()=>window.clearInterval($)},[]);const C=x.useRef(!0);x.useEffect(()=>()=>{C.current=!1},[]);const T=x.useRef(null),R=x.useCallback($=>qh(T.current)?(T.current=$,k($),!0):!1,[]),A=x.useCallback(()=>{T.current=null,C.current&&k(null)},[]),q=$=>{const z=za(_,$);return{disabled:z.disabled,"aria-busy":z.busy}},F=$=>(h==null?void 0:h.field)===$?{"aria-invalid":!0,"aria-describedby":"lan-add-failure"}:{},O=$=>m(z=>z&&z.field===$?null:z),H=x.useCallback(async()=>{const $=GB(c);if(!$){m({text:MB(c),field:"addr"});return}const z=`${$.addr}:${$.port}`,U=e.peers.find(V=>V.addr===$.addr&&V.port===$.port&&V.paired);if(U){m({text:`Already paired with ${U.name} at that address.`,field:"addr"});return}if(t.includes(z)){m({text:"This deck already calls that address.",field:"addr"});return}if(R("add"))try{const V=await Zp("/api/prefs",{lan:{manual:[...t,z]}});if(!C.current)return;V!=null&&V.ok?(m(null),u(""),r(),n()):m({text:en("add that address",V),field:"addr"})}catch{C.current&&m({text:en("add that address",null),field:"addr"})}finally{A()}},[c,t,e.peers,r,n,R,A]),K=x.useCallback(async $=>{if(!R(`invite:${$}`))return;const z=$==="make"?"make an invite":"cancel that invite";try{const U=await Zp("/api/lan/invite",{action:$});if(!C.current)return;U!=null&&U.ok?(m(null),w(null),r()):m({text:y_(AB,U,z)})}catch{C.current&&m({text:en(z,null)})}finally{A()}},[r,R,A]),X=x.useCallback(async()=>{const $=f.trim();if(!(!$||!R("join"))){b(null);try{const z=await Zp("/api/lan/invite",{action:"join",token:$});if(!C.current)return;z!=null&&z.ok?(p(""),m(null),r(),n()):(z==null?void 0:z.reason)==="unreachable"&&Array.isArray(z.tried)&&z.tried.length?(b(z.tried),m(null)):(b(null),m({text:y_(TB,z,"use that invite"),field:"join"}))}catch{C.current&&m({text:en("use that invite",null),field:"join"})}finally{A()}}},[f,r,n,R,A]),I=x.useCallback(async($,z)=>{try{await navigator.clipboard.writeText($),w(z),window.setTimeout(()=>{C.current&&w(U=>U===z?null:U)},1600)}catch{m({text:"Could not copy it — select the text and copy it by hand."})}},[]),Z=e.invite&&e.invite.expiresAt>S?e.invite:null,W=e.port!=null?(e.addrs??[]).map($=>`${$}:${e.port}`):[];return _n.createPortal(o.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:o.jsxs("div",{ref:l,className:"modal lan-add",onClick:$=>$.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"lan-add-title",children:[o.jsxs("header",{className:"modal-head",children:[o.jsx("div",{className:"modal-title",children:o.jsx("span",{id:"lan-add-title",className:"modal-tool-name",children:"Add a deck"})}),o.jsx("div",{className:"modal-actions",children:o.jsx("button",{className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),o.jsxs("section",{className:"modal-body",children:[h&&o.jsxs("div",{className:"ap-failure",role:"alert",children:[o.jsx("span",{id:"lan-add-failure",className:"ap-failure-text",children:h.text}),o.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>m(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),o.jsx(nM,{reach:e.reach,where:"dialog"}),o.jsxs("div",{className:"modal-section",children:[o.jsx("h3",{className:"lan-h",children:"By address"}),o.jsxs("div",{className:"ap-lan-row",children:[o.jsx("input",{ref:a,className:"ap-manage-input ap-lan-input","aria-label":"Another deck's address",value:c,placeholder:"192.168.1.5:54340",spellCheck:!1,...F("addr"),onChange:$=>{u($.target.value),O("addr")},onKeyDown:$=>{$.key==="Enter"&&H()}}),c.trim()!==""&&o.jsx("button",{type:"button",className:"ap-manage-btn",...q("add"),onClick:()=>void H(),title:"Add it to the decks this one calls, starting now.",children:"add"})]}),o.jsx("p",{className:"lan-note",children:"This deck calls that address until somebody there accepts."}),e.port!=null&&W.length>0&&o.jsxs("p",{className:"lan-note",children:["They type this deck’s own address into the same field on theirs:"," ",W.map(($,z)=>o.jsxs("span",{children:[z>0&&" or ",o.jsx("code",{className:"ap-lan-code",children:$})]},$)),o.jsx("button",{type:"button",className:"ap-lan-word lan-copy",...q("copy:mine"),onClick:()=>void I(W.join(" "),"mine"),title:"Copy this deck's address, to send to whoever is adding it",children:y==="mine"?"copied":"copy"})]})]}),o.jsxs("div",{className:"modal-section",children:[o.jsxs("h3",{className:"lan-h",children:["With an invite",!Z&&o.jsx("button",{type:"button",className:"ap-lan-word lan-h-act",...q("invite:make"),onClick:()=>void K("make"),title:"One piece of text you send them. They paste it, and the two decks pair — nobody has to press anything here.",children:_==="invite:make"?"making…":"make one to send"})]}),o.jsxs("div",{className:"ap-lan-row",children:[o.jsx("input",{className:"ap-manage-input ap-lan-input","aria-label":"An invite you were sent",value:f,placeholder:"paste one you were sent",spellCheck:!1,...F("join"),onChange:$=>{p($.target.value),b(null),O("join")},onKeyDown:$=>{$.key==="Enter"&&X()}}),f.trim()!==""&&o.jsx("button",{type:"button",className:"ap-manage-btn",...q("join"),onClick:()=>void X(),title:"Reach that deck and pair with it. Nobody has to press anything there.",children:_==="join"?"joining…":"join"})]}),o.jsx("p",{className:"lan-note",children:"Pasting one pairs both decks on the spot — nobody has to accept."}),j&&o.jsxs("div",{className:"ap-lan-tried",children:[o.jsx("span",{className:"lan-note",children:"Nothing answered at any address in that invite. Check that deck is running with its Local network switch on."}),j.map($=>o.jsxs("span",{className:"ap-lan-tried-row",children:[o.jsx("code",{className:"ap-lan-code",children:$.addr}),o.jsx("span",{className:"ap-lan-bad",children:$.why})]},$.addr))]}),Z&&o.jsxs("div",{className:"ap-lan-invite",children:[o.jsxs("div",{className:"ap-lan-invite-head",children:[o.jsx("span",{className:"ap-lan-invite-title",children:"Send this to them"}),o.jsxs("span",{className:"ap-lan-invite-left",children:[XB(Z.expiresAt,S)," left"]})]}),o.jsx("code",{className:"ap-lan-token",children:Z.token}),o.jsxs("div",{className:"ap-lan-acts",children:[o.jsx("button",{type:"button",className:"ap-manage-btn",...q("copy:invite"),onClick:()=>void I(Z.token,"invite"),title:"Copy it, and send it however you already talk to them",children:y==="invite"?"copied":"copy"}),o.jsx("button",{type:"button",className:"ap-manage-btn",...q("invite:withdraw"),onClick:()=>void K("withdraw"),title:"Cancel it. Anybody already holding the text can no longer use it.",children:"cancel"})]}),o.jsx("p",{className:"lan-warn",children:"Anyone who gets this text can pair with this deck until it runs out."})]})]})]})]})}),document.body)}function MB(e){const t=(e??"").trim();if(t==="")return"Type an address and a port, like 192.168.1.5:54340.";if(!t.startsWith("[")&&(t.match(/:/g)??[]).length>1)return"Too many colons to split. Use that deck's IPv4 address or its name, like 192.168.1.5:54340.";if(!t.includes(":"))return`Add the port too, like ${t}:54340.`;const n=t.slice(t.lastIndexOf(":")+1).trim();return n===""?"That is missing its port — try 192.168.1.5:54340.":/^\d+$/.test(n)?`A port runs from 1 to 65535, and this one is ${n}.`:`A port is a number, and this one is "${n}".`}const IB=1e3;function $B(e,t){const n=new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),r=fs(e,t);return`${n} · ${r==="now"?"just now":r}`}function w_(e){return e&&[e.version,e.os,e.arch].filter(Boolean).join(" · ")||null}function OB(){return o.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[o.jsx("path",{d:"M9.6 2.4l2 2L5 11l-2.6.6L3 9z"}),o.jsx("path",{d:"M8.4 3.6l2 2"})]})}function v_(){return o.jsxs("svg",{className:"lan-machine",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[o.jsx("rect",{x:"2.5",y:"3",width:"11",height:"7.5",rx:"1.2"}),o.jsx("path",{d:"M1 13h14"})]})}function Pd({dir:e,gate:t=!1}){const n=t?12:8;return o.jsx("svg",{className:"lan-chev","data-dir":e,"data-gate":t||void 0,width:n,height:"8",viewBox:`0 0 ${n} 8`,fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:o.jsx("path",{d:e==="out"?"M2.8 1L6 4 2.8 7":t?"M1 1v6M9.6 1L6.4 4l3.2 3":"M5.2 1L2 4l3.2 3"})})}const LB={works:"works here",expired:"expired here",missing:"not on this deck"},PB={works:"works there",broken:"broken there",unknown:"not offered by that deck"};function DB(e){const t=e.in&&e.out?"offered both ways":e.in?"offered by that deck":"offered by this deck";return`${LB[e.here]}, ${PB[e.there]}, ${t}${e.usedThere?", in use there":""}.`}function FB({row:e,source:t,status:n,accounts:r,now:a,busy:l,onClose:c,onRename:u,onCheck:f,onVerb:p,onSettings:h,twins:m=[],onUnpair:y}){var jt,dn,Sn,Kt,an;const w=x.useRef(null),_=sn(c,{focusRef:w}),[k,j]=x.useState(null),[b,S]=x.useState(null),[E,C]=x.useState(!1),T=x.useRef(0),[R,A]=x.useState(null),[q,F]=x.useState(!1),[O,H]=x.useState(0),K=x.useRef(null),X=x.useRef(!0);x.useEffect(()=>()=>{X.current=!1},[]);const I=k!=null;x.useEffect(()=>{var ge;I&&((ge=K.current)==null||ge.select())},[I]),x.useEffect(()=>{if(!E)return;const ge=window.setTimeout(()=>C(!1),4e3);return()=>window.clearTimeout(ge)},[E]),x.useEffect(()=>{if(!R)return;const ge=window.setTimeout(()=>A(null),4e3);return()=>window.clearTimeout(ge)},[R]);const Z=ge=>{const ht=za(l,ge);return{disabled:ht.disabled,"aria-busy":ht.busy}},W=async ge=>{const ht=await ge();return X.current&&S(ht),ht==null},{peer:$,stranger:z}=t,U=e.kind==="paired",V=e.self??e.name,B=e.kind!=="dialling",Y=e.kind==="dialling"?null:e.fp,ue=$?$.addr?`${$.addr}:${$.port}`:"":z?z.port?`${z.addr}:${z.port}`:z.addr:e.addr,G=($==null?void 0:$.about)??null,ee=((jt=n.about)==null?void 0:jt.version)??null,L=async ge=>{const ht=ge.trim()===V?"":ge;await W(()=>u(ht))&&j(null)},te=async()=>{if(Y)try{if(await navigator.clipboard.writeText(Y),!X.current)return;F(!0),window.setTimeout(()=>{X.current&&F(!1)},1600)}catch{X.current&&S("Could not copy it — select the fingerprint and copy it by hand.")}},ne=U?$!=null&&$.waiting?$.lastSeen!=null?"not said — it runs an older version":"not said yet — it says when it next calls":$!=null&&$.offers?"not said — it runs an older version":"not reached yet":"shown once paired",ie=w_(n.about),me=w_(G),je=G!=null&&G.version&&ee?az(G.version,ee):null,Oe=$?rM($.last,a):null,Ve=$&&((dn=$.last)!=null&&dn.error)?VB({error:$.last.error,host:$.addr,port:$.port},[...n.strangers??[],...n.pending??[],...(n.peers??[]).filter(ge=>!ge.manual&&ge.addr).map(ge=>({fp:ge.fp,name:ge.name,addr:ge.addr,port:ge.port,at:ge.lastSeen??0}))],a):null,Le=(Sn=$==null?void 0:$.last)!=null&&Sn.error&&Oe&&Oe.text!==$.last.error?$.last.error:null,Te=((Kt=$==null?void 0:$.last)==null?void 0:Kt.done)??[],nt=!!Oe&&!!Le&&!e.quiet&&e.state.startsWith(Oe.text),_e=U||e.kind==="dialling",Se=(($==null?void 0:$.via)??e.via)==="tailscale",Xe=$?$.waiting?null:$.manual?Se?"added by its Tailscale address":"added by address":Se?"over Tailscale":"on this network":e.kind==="nearby"?Se?"heard over Tailscale":"heard on this network":Se?"asked this deck to pair, over Tailscale":"asked this deck to pair",ot=e.tone==="bad"?"bad":U?e.here?"up":"down":"loose",$e=l===`check:${e.fp}`,oe=($==null?void 0:$.offers)??null,ye=ot==="up"?(oe==null?void 0:oe.current)??null:null,Ce=ye&&"key"in ye?ye.key:null,De=!!ye&&"hidden"in ye,qe=!!ye&&"other"in ye,rt=U?iz((oe==null?void 0:oe.accounts)??null,r,n.shared??[],Ce):[],et=rt.filter(ge=>ge.in==null&&ge.out==="cut"),ve=rt.some(ge=>ge.in!=null),Re=rt.some(ge=>ge.out!=null),Ue=new Map(Te.map(ge=>[ge.email,ge])),pt=Te.filter(ge=>!rt.some(ht=>ht.email===ge.email)),he=U?oe?oe.accounts.length===0?"That deck offers nothing. Nobody there has chosen a login to share.":null:$!=null&&$.waiting?"What that deck offers is not known yet. A deck that calls in says so each time it calls — one on an older version never does.":(an=$==null?void 0:$.last)!=null&&an.error?"What that deck offers is not known — the last attempt to ask it did not get through.":"Nobody has asked that deck what it offers yet. The next round asks it.":null,mt=oe&&($!=null&&$.last)&&$.last.at-oe.at>IB?fs(oe.at,a):null,qt=[];U&&($!=null&&$.pairedAt)?qt.push({label:"Paired",value:$B($.pairedAt,a),tone:"meta"}):e.kind==="declined"&&z&&qt.push({label:"Paired",value:`no · you said no ${rb(z.at,a)}`,tone:"meta"}),qt.push({label:"Fingerprint",value:Y?o.jsxs("span",{className:"lan-fp",children:[o.jsx("code",{className:"ap-lan-code",children:Y}),o.jsx("button",{type:"button",className:"ap-lan-word lan-copy",onClick:()=>void te(),"aria-label":q?"Fingerprint copied":"Copy the fingerprint",children:q?"copied":"copy"})]}):"not known — nothing has answered there",tone:Y?void 0:"quiet"});const Tt=m.length?[{row:e,peer:$??null},...m]:[];return _n.createPortal(o.jsx("div",{className:"modal-backdrop",onClick:c,role:"presentation",children:o.jsxs("div",{ref:_,className:"modal lan-peer","data-tone":e.tone,onClick:ge=>ge.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"lan-peer-title","aria-describedby":"lan-peer-sub",children:[o.jsxs("header",{className:"modal-head lan-peer-head",children:[o.jsx("i",{className:e.here?"ap-pulse":"ap-dot","aria-hidden":!0}),o.jsxs("div",{className:"lan-peer-id",children:[I?o.jsxs("form",{className:"lan-peer-edit",onSubmit:ge=>{ge.preventDefault(),L(k??"")},children:[o.jsx("span",{id:"lan-peer-title",className:"vis-hidden",children:e.name}),o.jsx("input",{ref:K,className:"ap-manage-input lan-peer-input",value:k??"",maxLength:48,placeholder:V,"aria-label":"Name for this deck, shown on this deck only",onChange:ge=>j(ge.target.value)}),o.jsx("button",{type:"submit",className:"ap-manage-btn",...Z(`alias:${e.fp}`),children:"save"}),o.jsx("button",{type:"button",className:"ap-manage-btn",onClick:()=>j(null),children:"cancel"})]}):o.jsxs("span",{className:"lan-peer-title",children:[o.jsx("span",{id:"lan-peer-title",className:"lan-peer-name",children:e.name}),B&&o.jsx("button",{type:"button",className:"glyph-btn lan-peer-rename",onClick:()=>{S(null),j(e.name)},"aria-label":`Rename ${e.name} on this deck`,title:"Give it a name of your own. Only this deck sees it.",children:o.jsx(OB,{})})]}),o.jsxs("p",{id:"lan-peer-sub",className:"lan-peer-sub",children:[e.self&&o.jsxs(o.Fragment,{children:["calls itself ",o.jsx("span",{className:"lan-peer-self",children:e.self}),I&&o.jsx("button",{type:"button",className:"ap-lan-word lan-peer-restore",...Z(`alias:${e.fp}`),onClick:()=>void L(""),children:"use this name"}),o.jsx("span",{className:"vis-hidden",children:". "}),!e.quiet&&o.jsx("span",{"aria-hidden":!0,children:" · "})]}),o.jsx("span",{className:e.quiet?"vis-hidden":"lan-peer-state",children:e.state})]})]}),o.jsx("div",{className:"modal-actions",children:o.jsx("button",{ref:w,type:"button",className:"glyph-btn",onClick:c,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),o.jsxs("section",{className:"modal-body lan-peer-body",children:[b&&o.jsxs("div",{className:"ap-failure",role:"alert",children:[o.jsx("span",{className:"ap-failure-text",children:b}),o.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>S(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),o.jsxs("div",{className:"lan-map","data-link":ot,"data-asking":$e||void 0,"data-bus":rt.length>0||void 0,children:[o.jsxs("div",{className:"lan-ends",children:[o.jsxs("p",{className:"lan-end",children:[o.jsx("span",{className:"lan-end-name",children:"This deck"}),ie&&o.jsx("span",{className:"lan-end-runs",children:ie}),U&&n.shareActive===!1&&o.jsx("span",{className:"lan-end-note",children:"current account hidden"})]}),o.jsxs("p",{className:"lan-end","data-side":"there",children:[o.jsx("span",{className:"lan-end-name",children:e.name}),e.kind!=="dialling"&&o.jsxs("span",{className:"lan-end-runs",children:[me??(G?"not said":ne),je?` · ${je<0?"older":"newer"}`:null]}),De&&o.jsx("span",{className:"lan-end-note",children:"current account hidden"}),qe&&o.jsx("span",{className:"lan-end-note",children:"on another account"})]})]}),o.jsxs("div",{className:"lan-link",children:[o.jsx(v_,{}),o.jsxs("span",{className:"lan-span",children:[o.jsxs("span",{className:"lan-wire","aria-hidden":!0,children:[o.jsx("i",{className:"lan-glint","data-dir":"out"}),o.jsx("i",{className:"lan-glint","data-dir":"in"})]}),o.jsx("span",{className:"lan-link-label",children:ue?o.jsx("code",{className:"ap-lan-code",children:ue}):"none here — it calls this deck"})]}),o.jsx(v_,{}),(ue&&Xe||_e)&&o.jsxs("p",{className:"lan-link-sub",children:[ue&&Xe,ue&&Xe&&_e&&" · ",_e&&(Oe?nt?o.jsx("code",{className:"ap-lan-code",children:Le}):o.jsx("span",{className:"lan-round","data-tone":Oe.tone,children:Oe.text.replace(/ · now$/," · just now")}):"not asked yet"),_e&&Le&&!nt&&o.jsx("code",{className:"lan-fact-raw",children:Le})]}),pt.length>0&&o.jsx("ul",{className:"lan-done",children:pt.map(ge=>o.jsxs("li",{"data-ok":ge.ok,children:[ge.email," ",o.jsx("span",{className:"lan-done-what",children:ge.ok?"arrived":"did not arrive"})]},`${ge.email}:${ge.action}`))}),Ve&&o.jsx("p",{className:"lan-note lan-link-note",children:Ve}),($==null?void 0:$.waiting)&&o.jsx("p",{className:"lan-note lan-link-note",children:e.hint})]}),rt.length>0&&o.jsx("ul",{className:"lan-lanes",role:"list","aria-label":`Logins between this deck and ${e.name}`,children:rt.map((ge,ht)=>{const tt=Ue.get(ge.email),_t=ge.out==="live"||ge.in!=null&&ge.in!=="cut";return o.jsxs("li",{role:"listitem",className:"lan-lane","data-tone":ge.tone,"data-draw":ge.in&&ge.out?"both":ge.in?"in":"out","data-used-there":ge.usedThere||void 0,style:{"--i":ht},children:[o.jsx("i",{className:"lan-pip","data-end":"here","data-state":ge.here,"aria-hidden":!0}),o.jsxs("span",{className:"lan-track",children:[o.jsxs("span",{className:"lan-wire","data-flow":_t?"live":"cut","aria-hidden":!0,children:[(ge.in==="live"||ge.in==="wait")&&o.jsx("i",{className:"lan-glint","data-dir":"in","data-tone":ge.in}),ge.out==="live"&&o.jsx("i",{className:"lan-glint","data-dir":"out"})]}),ge.in&&ge.in!=="cut"&&o.jsx(Pd,{dir:"in",gate:ge.in==="blocked"}),ge.out==="live"&&o.jsx(Pd,{dir:"out"}),o.jsx("span",{className:"lan-lane-email",children:ge.email})]}),o.jsx("i",{className:"lan-pip","data-end":"there","data-state":ge.there,"aria-hidden":!0}),o.jsx("span",{className:"vis-hidden",children:DB(ge)}),(ge.caption||tt)&&o.jsxs("span",{className:"lan-lane-note",children:[ge.caption,ge.caption&&tt&&" · ",tt&&o.jsx("span",{className:"lan-lane-done","data-ok":tt.ok,children:tt.ok?"arrived last round":"did not arrive last round"})]})]},ge.key)})},O),U&&o.jsxs(o.Fragment,{children:[et.length>0&&o.jsxs("p",{className:"lan-spent",children:["Paired decks get nothing from ",et.length===1?et[0].email:"the expired ones"," until you sign in again here."]}),he&&o.jsx("p",{className:"lan-empty",children:he}),mt&&o.jsxs("p",{className:"lan-stale",children:["As of ",mt==="now"?"just now":mt,", when it last answered."]}),o.jsxs("div",{className:"lan-legend",children:[ve&&o.jsxs("span",{className:"lan-key",children:[o.jsx("span",{className:"lan-key-wire","data-dir":"in","aria-hidden":!0,children:o.jsx(Pd,{dir:"in"})}),"from ",e.name]}),Re?o.jsxs("span",{className:"lan-key",children:[o.jsx("span",{className:"lan-key-wire","data-dir":"out","aria-hidden":!0,children:o.jsx(Pd,{dir:"out"})}),"from this deck, to every paired deck"]}):o.jsx("span",{className:"lan-key",children:"This deck offers nothing yet."}),o.jsx("button",{type:"button",className:"ap-lan-word lan-legend-act",onClick:h,"aria-label":"Change what this deck offers",children:"change"})]})]})]}),o.jsx("dl",{className:"lan-facts",children:qt.map(ge=>o.jsxs("div",{className:"lan-fact","data-tone":ge.tone,children:[o.jsx("dt",{children:ge.label}),o.jsx("dd",{children:ge.value})]},ge.label))}),Tt.length>1&&o.jsxs("div",{className:"modal-section",children:[o.jsxs("h3",{className:"lan-h",children:[Tt.length," decks on this machine"]}),o.jsx("ul",{className:"lan-twins",role:"list",children:Tt.map((ge,ht)=>{var lr,gn,Yt,jn;const tt=(lr=ge.peer)!=null&&lr.addr?`${ge.peer.addr}:${ge.peer.port}`:ge.row.addr,_t=tt||ge.row.fp,on=(gn=ge.peer)!=null&&gn.pairedAt?fs(ge.peer.pairedAt,a):null,Gn=[(jn=(Yt=ge.peer)==null?void 0:Yt.about)!=null&&jn.version?`runs ${ge.peer.about.version}`:null,on?`paired ${on==="now"?"just now":on}`:null,ge.row.state].filter(Boolean).join(" · "),Et=ge.row.fp;return o.jsxs("li",{role:"listitem",className:"lan-twin","data-tone":ge.row.tone,children:[o.jsx("i",{className:ge.row.here?"ap-pulse":"ap-dot","aria-hidden":!0}),tt?o.jsx("code",{className:"ap-lan-code lan-twin-at",children:tt}):o.jsx("span",{className:"lan-twin-at lan-twin-none",children:"no address here"}),o.jsx("code",{className:"ap-lan-code lan-twin-fp",children:Et}),ht>0&&y&&o.jsx("button",{type:"button",className:`ap-manage-btn danger lan-twin-do${R===Et?" armed":""}`,...Z(`unpair:${Et}`),onKeyDown:Bt=>{Bt.repeat&&Bt.preventDefault()},onClick:()=>{const Bt=Date.now(),Rn=ph({armedFor:R,target:Et,armedAt:T.current,now:Bt,gapMs:yh});if(Rn==="arm"){A(Et),T.current=Bt;return}Rn!=="ignore"&&(A(null),W(()=>y(Et)))},"aria-label":R===Et?`Confirm unpairing ${_t}`:`Unpair ${_t}`,title:R===Et?"Press again to stop talking to this deck. Logins it already has stay with it.":"Stop talking to this one of the machine's decks",children:l===`unpair:${Et}`?"unpairing…":R===Et?"confirm":"unpair"}),o.jsx("span",{className:"lan-twin-meta",children:ht===0?`${Gn} · shown above`:Gn})]},Et)})})]})]}),o.jsxs("footer",{className:"lan-peer-foot",children:[e.kind==="asks"&&o.jsx("p",{className:"lan-foot-note",children:"This deck is now asking to pair. Answer it from the panel behind this."}),U&&!($!=null&&$.waiting)&&o.jsx("button",{type:"button",className:"btn",...Z(`check:${e.fp}`),onClick:()=>void W(f).then(ge=>{ge&&X.current&&H(ht=>ht+1)}),title:"Ask this deck now instead of waiting for the next round",children:l===`check:${e.fp}`?"Checking…":"Check now"}),e.kind==="paired"&&o.jsx("button",{type:"button",className:`btn danger lan-peer-verb${E?" armed":""}`,...Z(`unpair:${e.fp}`),onKeyDown:ge=>{ge.repeat&&ge.preventDefault()},onClick:()=>{const ge=Date.now(),ht=ph({armedFor:E?e.fp:null,target:e.fp,armedAt:T.current,now:ge,gapMs:yh});if(ht==="arm"){C(!0),T.current=ge;return}ht!=="ignore"&&(C(!1),W(p))},"aria-label":E?`Confirm unpairing ${e.name}`:`Unpair ${e.name}`,title:E?"Press again to stop talking to this deck. Logins it already has stay with it.":"Stop talking to this deck from now on",children:l===`unpair:${e.fp}`?"Unpairing…":E?"Confirm unpair":"Unpair"}),e.kind==="nearby"&&o.jsx("button",{type:"button",className:"btn primary lan-peer-verb",...Z(`accept:${e.fp}`),onClick:()=>void W(p),title:"Send it a request. Somebody at that machine has to accept it before anything is shared.",children:l===`accept:${e.fp}`?"Asking…":"Ask to pair"}),e.kind==="dialling"&&o.jsx("button",{type:"button",className:"btn lan-peer-verb",...Z(`drop:${e.fp}`),onClick:()=>void W(p),title:"Stop trying this address. Nothing was ever paired here.",children:l===`drop:${e.fp}`?"Stopping…":"Stop dialling"}),e.kind==="declined"&&o.jsx("button",{type:"button",className:"btn lan-peer-verb",...Z(`allow:${e.fp}`),onClick:()=>void W(p),title:"Take the no back. That deck is still trying, so its request comes round again on its own.",children:l===`allow:${e.fp}`?"Allowing…":"Let it ask again"})]})]})}),document.body)}function qB(e){if(!e.running)return`Tailscale is ${e.state==="Stopped"?"turned off":e.state==="NeedsLogin"||e.state==="NeedsMachineAuth"?"signed out":e.state==="Starting"?"still starting":"not answering"} on this machine`;const t=e.login??"your Tailscale account";return e.on?`${e.devices} online · ${t}`:t}function BB({status:e,accounts:t,onClose:n,onChanged:r}){const a=sn(n),[l,c]=x.useState(null),[u,f]=x.useState(null),[p,h]=x.useState(!1),[m,y]=x.useState(null),w=x.useRef(null),_=K=>{const X=za(m,K);return{disabled:X.disabled,"aria-busy":X.busy}},k=x.useRef(null),j=x.useRef(!0);x.useEffect(()=>()=>{j.current=!1},[]),x.useEffect(()=>{k.current=x_(k.current,e.shared??[],null)},[e.shared]);const b=x.useCallback(async(K,X,I="write")=>{w.current=I,y(I);try{const W=await(await fetch("/api/prefs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({lan:K})})).json().catch(()=>null);return j.current?(W!=null&&W.ok?f(null):f(en(X,W)),r(),(W==null?void 0:W.ok)===!0):!1}catch{return j.current&&f(en(X,null)),!1}finally{w.current=null,j.current&&y(null)}},[r]),S=x.useCallback(async()=>{if(l!=null&&l!==(e.name??"")){if(!await b({name:l},"save the name","name"))return;j.current&&c(null)}n()},[l,e.name,b,n]),E=async()=>{if(!e.fp)return;const K=await Ba(e.fp);if(j.current){if(!K){f("Could not copy it — select the fingerprint and copy it by hand.");return}h(!0),window.setTimeout(()=>{j.current&&h(!1)},1600)}},C=new Set(k.current??e.shared??[]),T=e.autoAsk!==!1,R=e.autoAccept!==!1,A=e.shareActive!==!1,q=e.tailscale??null,F=!!(q!=null&&q.on),O=(q==null?void 0:q.ask)!==!1,H=(q==null?void 0:q.accept)!==!1;return _n.createPortal(o.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:o.jsxs("div",{ref:a,className:"modal lan-modal",onClick:K=>K.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"lan-modal-title",children:[o.jsxs("header",{className:"modal-head",children:[o.jsx("div",{className:"modal-title",children:o.jsx("span",{id:"lan-modal-title",className:"modal-tool-name",children:"This deck on the network"})}),o.jsx("div",{className:"modal-actions",children:o.jsx("button",{className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),o.jsxs("section",{className:"modal-body",children:[u&&o.jsxs("div",{className:"ap-failure",role:"alert",children:[o.jsx("span",{className:"ap-failure-text",children:u}),o.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>f(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),o.jsxs("div",{className:"modal-section",children:[o.jsx("h3",{className:"lan-h",children:"Name"}),o.jsxs("div",{className:"ap-lan-row",children:[o.jsx("span",{className:"ap-lan-label",children:"appear as"}),o.jsx("input",{className:"ap-manage-input ap-lan-input","aria-label":"This deck's name on the network",value:l??e.name??"",placeholder:"this machine",onChange:K=>c(K.target.value),onKeyDown:K=>{K.key!=="Enter"||l==null||(b({name:l},"save the name","name"),c(null))}}),l!=null&&l!==(e.name??"")&&o.jsx("button",{type:"button",className:"ap-manage-btn",..._("name"),onClick:()=>{b({name:l},"save the name","name"),c(null)},title:"Save it. This is the name other decks show for this one.",children:"save"})]}),o.jsxs("div",{className:"ap-lan-row",children:[o.jsx("span",{className:"ap-lan-label",children:"fingerprint"}),e.fp?o.jsxs("span",{className:"lan-fp",children:[o.jsx("code",{className:"ap-lan-code",children:e.fp}),o.jsx("button",{type:"button",className:"ap-lan-word lan-copy",onClick:()=>void E(),"aria-label":p?"Fingerprint copied":"Copy this deck's fingerprint",children:p?"copied":"copy"})]}):o.jsx("span",{className:"ap-lan-label",children:"not known yet"})]})]}),o.jsxs("div",{className:"modal-section",children:[o.jsx("h3",{className:"lan-h",children:"Share these accounts"}),o.jsxs("div",{className:"ap-lan-picks",children:[t.length===0&&o.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(K=>o.jsxs("label",{className:"ap-lan-pick",title:K.alive?"Offer this account to the decks you have paired with, so one whose copy has died can heal from yours. Unticking stops it being offered from now on; it does not take back a copy somebody already has.":"This deck cannot use this login, so it has nothing to offer — a deck that can will heal it",children:[o.jsx("input",{type:"checkbox",checked:C.has(K.key),onChange:X=>{const I=YB(k.current,e.shared??[],K.key,X.target.checked);k.current=I,b({shared:I},X.target.checked?"share that account":"stop sharing that account").then(Z=>{k.current===I&&(k.current=x_(I,e.shared??[],{ok:Z}))})}}),o.jsx("span",{className:"ap-lan-pick-name",children:K.email}),!K.alive&&o.jsx("span",{className:"ap-lan-dead",children:"not working here"})]},K.key))]}),t.length>0&&o.jsxs("div",{className:"lan-switch",children:[o.jsx("span",{className:"lan-switch-what",children:"Show paired decks which of these this deck is using"}),o.jsx("button",{type:"button",className:"switch ap-auto-state",role:"switch","aria-checked":A,"aria-label":"Show paired decks which of these this deck is using",..._("current"),onClick:()=>void b({shareActive:!A},A?"stop showing which account this deck is using":"show which account this deck is using","current"),title:A?"Stop telling paired decks which account this one is on. They read “current account hidden” instead.":"Tell paired decks which of the ticked accounts this one is on. An unticked account is never named.",children:o.jsx("span",{className:"switch-knob"})})]})]}),o.jsxs("div",{className:"modal-section",children:[o.jsx("h3",{className:"lan-h",children:"Pairing"}),o.jsxs("div",{className:"lan-switches",children:[o.jsxs("div",{className:"lan-switch",children:[o.jsx("span",{className:"lan-switch-what",children:"Ask every deck this one finds"}),o.jsx("button",{type:"button",className:"switch ap-auto-state",role:"switch","aria-checked":T,"aria-label":"Ask every deck this one finds",..._("ask"),onClick:()=>void b({autoAsk:!T},T?"stop asking automatically":"ask every deck this one finds","ask"),title:T?"Stop sending requests on their own. You press ask on the row instead.":"Send a pairing request to every deck heard on this network. Somebody over there still has to say yes.",children:o.jsx("span",{className:"switch-knob"})})]}),o.jsxs("div",{className:"lan-switch",children:[o.jsx("span",{className:"lan-switch-what",children:"Say yes to every deck that asks"}),o.jsx("button",{type:"button",className:"switch ap-auto-state",role:"switch","aria-checked":R,"aria-label":"Say yes to every deck that asks","data-tone":"warn",..._("accept"),onKeyDown:K=>{K.repeat&&K.preventDefault()},onClick:()=>void b({autoAccept:!R},R?"stop accepting automatically":"accept every deck that asks","accept"),title:R?"Stop saying yes for you. A deck that asks waits in the panel again.":"Say yes for you. Every deck on this network that asks is paired without anybody being asked here.",children:o.jsx("span",{className:"switch-knob"})})]})]})]}),(q==null?void 0:q.found)&&o.jsxs("div",{className:"modal-section",children:[o.jsx("h3",{className:"lan-h",children:"Tailscale"}),o.jsxs("div",{className:"lan-switches",children:[o.jsxs("div",{className:"lan-switch",children:[o.jsxs("span",{className:"lan-switch-what",children:["Look for my devices",o.jsx("span",{id:"lan-ts-detail",className:"lan-switch-detail",children:qB(q)})]}),o.jsx("button",{type:"button",className:"switch ap-auto-state",role:"switch","aria-checked":F,"aria-label":"Look for my devices over Tailscale","aria-describedby":"lan-ts-detail",..._("tailscale"),onClick:()=>void b({tailscale:!F},F?"stop looking over Tailscale":"look for your devices over Tailscale","tailscale"),title:F?"Stop. Nothing is looked for or answered over the tailnet; decks already paired stay paired.":"Find the decks on your other machines on Tailscale, wherever they are. Only machines signed in to your Tailscale account are asked.",children:o.jsx("span",{className:"switch-knob"})})]}),F&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"lan-switch",children:[o.jsx("span",{className:"lan-switch-what",children:"Ask each device it finds"}),o.jsx("button",{type:"button",className:"switch ap-auto-state",role:"switch","aria-checked":O,"aria-label":"Ask each of my devices it finds over Tailscale",..._("tailscale-ask"),onClick:()=>void b({tailscaleAsk:!O},O?"stop asking your devices automatically":"ask your devices automatically","tailscale-ask"),title:O?"Stop sending requests on their own. You press ask on the row instead.":"Send a pairing request to every deck found on your devices over Tailscale.",children:o.jsx("span",{className:"switch-knob"})})]}),o.jsxs("div",{className:"lan-switch",children:[o.jsx("span",{className:"lan-switch-what",children:"Say yes to each device that asks"}),o.jsx("button",{type:"button",className:"switch ap-auto-state",role:"switch","aria-checked":H,"aria-label":"Say yes to my devices when they ask over Tailscale","data-tone":"warn",..._("tailscale-accept"),onKeyDown:K=>{K.repeat&&K.preventDefault()},onClick:()=>void b({tailscaleAccept:!H},H?"stop accepting your devices automatically":"accept your devices automatically","tailscale-accept"),title:H?"Stop saying yes for you. A device that asks waits in the panel again.":"Say yes for you when a deck on one of your own devices asks. Anybody else on the tailnet still waits for a press.",children:o.jsx("span",{className:"switch-knob"})})]})]})]})]})]}),o.jsxs("footer",{className:"lan-setup-foot",children:[o.jsx("span",{className:"lan-foot-note",children:"Changes are saved as you make them."}),o.jsx("button",{type:"button",className:"btn primary",..._("name"),onClick:()=>void S(),children:"Done"})]})]})}),document.body)}function fs(e,t){if(e==null)return"not seen";const n=Math.max(0,Math.round((t-e)/1e3));if(n<90)return"now";const r=Math.round(n/60);if(r<60)return`${r}m ago`;const a=Math.round(r/60);return a<48?`${a}h ago`:`${Math.round(a/24)}d ago`}const nb={"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"}},zB={ECONNREFUSED:"not listening",EHOSTUNREACH:"no route to it",ENETUNREACH:"no network here",ETIMEDOUT:"no answer",ECONNRESET:"it hung up",EHOSTDOWN:"it is down",ENOTFOUND:"name not found",EACCES:"blocked here",EPIPE:"it hung up"};function HB(e){var r;const t=UB[e];if(t)return t;const n=(r=/\b(E[A-Z]{3,})\b/.exec(e))==null?void 0:r[1];return n&&zB[n]||e}const UB={"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 rM(e,t){if(!e)return null;if(e.error)return nb[e.error]??{text:HB(e.error),tone:"bad"};const n=e.done??[];if(!n.length)return{text:`all logins fine · ${fs(e.at,t)}`,tone:"idle"};const r=n.filter(l=>l.ok),a=r.length===1?"login":"logins";return r.length===n.length?{text:`${r.length} ${a} arrived · ${fs(e.at,t)}`,tone:"ok"}:{text:`${r.length} of ${n.length} logins arrived · ${fs(e.at,t)}`,tone:"bad"}}const WB=9e4;function VB({error:e,host:t,port:n},r,a,l=45317){if(e!=="handshake timed out")return null;const c=(t??"").trim();if(!c)return null;const u=r.filter(p=>p.addr===c&&p.port&&p.at>0&&a-p.at<WB);if(!u.length)return null;const f=[...new Set(u.map(p=>p.port))];if(n!=null&&!f.includes(n)){const p=f.length===1?`port ${f[0]}`:`ports ${f.join(" and ")}`;return`A deck at ${c} is announcing itself on ${p}, not on ${n}. This deck already hears it and dials it there, so this typed row has nothing to reach.`}return`That machine is running the deck — its beacon arrives here every half minute — and what this deck sends back never gets there. That is a firewall on ${c}, not a network fault. Whoever uses it can allow two ports: UDP ${l} and TCP ${n??f[0]}.`}const o0=5e3,sM=6e4,yh=400;function GB(e){const t=(e??"").trim(),n=t.lastIndexOf(":");if(n<=0||n===t.length-1)return null;const r=t.slice(0,n).trim(),a=Number(t.slice(n+1).trim());return!r||!Number.isInteger(a)||a<1||a>65535||r.includes(":")&&!(r.startsWith("[")&&r.endsWith("]"))?null:{addr:r,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 KB(e,t){if(e.length!==t.length)return!1;const n=new Set(e);return t.every(r=>n.has(r))}function YB(e,t,n,r){const a=new Set(e??t);return r?a.add(n):a.delete(n),[...a]}function x_(e,t,n){return e==null||n!=null&&!n.ok||KB(e,t)?null:e}function XB(e,t){const n=Math.max(0,Math.round((e-t)/1e3));return`${Math.floor(n/60)}:${String(n%60).padStart(2,"0")}`}function aM(e,t){var n,r;return(n=e.last)!=null&&n.error&&!nb[e.last.error]?!1:!!((r=e.last)!=null&&r.at&&t-e.last.at<wh||e.lastSeen!=null&&t-e.lastSeen<wh)}const wh=95e3,oM=160,ZB=6,iM=140;function QB(e,t){const n=[],r=[];for(const a of e??[])(aM(a,t)?n:r).push(a);return{online:n,offline:r}}function JB(e){var t;return(t=e.tailscale)!=null&&t.exitNode?"Tailscale sends this machine's local network through an exit node, so decks on this network cannot find this one. Turn on Allow local network access in Tailscale's exit node menu to bring them back.":"This machine sends its local network through a VPN, so decks on this network cannot find this one. Allowing local network access in the VPN brings them back."}function ez(e,t){if(!e)return{text:"checking…",tone:"idle"};if(!e.enabled)return{text:"",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 r=(e.peers??[]).filter(w=>w.paired!==!1||w.met);if(!r.length)return{text:"no deck paired yet",tone:"idle"};const a=r.filter(w=>w.waiting),l=r.filter(w=>!w.waiting),c=a.filter(w=>{var _;return!((_=w.last)!=null&&_.error)&&w.lastSeen!=null&&t-w.lastSeen<wh}),{online:u,offline:f}=QB(l,t),p=[...f,...a.filter(w=>!c.includes(w))],h=u.length+c.length,m=u.filter(w=>{var _;return((_=w.last)==null?void 0:_.error)==="waiting for the other deck to accept this one"});if(h&&m.length===h)return{text:h===1?"1 deck found · waiting for them to accept":`${h} decks found · waiting for them to accept`,tone:"wait"};if(!h)return{text:p.length===1?"this deck cannot reach the one it is paired with":`this deck cannot reach any of its ${p.length} decks`,tone:"bad"};const y=h===1?"1 deck ready":`${h} decks ready`;return{text:p.length?`${y} · ${p.length} away`:y,tone:"ok"}}function tz(e,t,n){if(n)return"checking…";if(e==null)return"not checked yet";const r=fs(e,t);return r==="now"?"checked just now":`checked ${r}`}function rb(e,t){const n=Math.max(0,Math.round((t-e)/1e3));if(n<90)return"just now";const r=Math.round(n/60);return r<60?`${r}m ago`:`${Math.round(r/60)}h ago`}function nz(e,t){if(e==null)return{text:"one-way · has not called yet",here:!1};const n=t-e<wh;return{text:n?"online · one-way, it calls in":`one-way · last online ${fs(e,t)}`,here:n}}function b_(e,t,n){return t?"online":e.lastSeen!=null?`last online ${fs(e.lastSeen,n)}`:e.waiting?"has not called yet":"never reached"}function rz(e,t){var y,w,_,k,j;if(!e)return[];const n=[],r=new Set,a=(b,S)=>b.name.localeCompare(S.name,void 0,{numeric:!0}),l=e.aliases??{},c=(b,S)=>{const E=b?l[b]:void 0;return E&&E!==S?{name:E,self:S}:{name:S}};for(const b of e.pending??[]){if(!(b!=null&&b.fp)||r.has(b.fp))continue;r.add(b.fp);const S=c(b.fp,b.name||b.fp);n.push({fp:b.fp,name:S.name,...S.self?{self:S.self}:{},addr:b.addr??"",kind:"asks",state:`wants to pair · ${rb(b.at,t)}`,tone:"wait",here:!0,hint:`${S.name} at ${b.addr}${b.via==="tailscale"?", over Tailscale,":""} is waiting for an answer.`,...b.via==="tailscale"?{via:"tailscale"}:{}})}const u=[],f=[];for(const b of e.peers??[]){const S=b.peerFp??b.fp;if(!S||r.has(S))continue;r.add(S);const E=rM(b.last,t),C=aM(b,t),T=b.addr?`${b.addr}:${b.port}`:"";if(!b.paired&&b.manual&&!b.met){f.push({fp:T,name:T||b.name||S,addr:b.addr??"",kind:"dialling",state:E?E.text.replace(/ · .*$/,""):"trying…",tone:E?E.tone:"idle",here:!1,hint:(y=b.last)!=null&&y.error?`Nothing has answered at ${T} yet — ${b.last.error}.`:`Dialling ${T} until something answers.`,...b.via==="tailscale"?{via:"tailscale"}:{}});continue}const R=b.waiting?nz(b.lastSeen,t):null,A=R?R.here:C,q=!R&&E?A?`online · ${E.text.replace(/ · .*$/,"")}`:`${E.text.replace(/ · .*$/,"")} · ${b_(b,A,t)}`:R?R.text:b_(b,A,t),F=(w=b.last)!=null&&w.error?nb[b.last.error]:null,O=!R&&A&&!((_=b.last)!=null&&_.error)&&!(((k=b.last)==null?void 0:k.done)??[]).length,H=b.manual&&!b.met?{name:T}:c(S,b.name||S);u.push({fp:S,name:H.name,...H.self?{self:H.self}:{},addr:b.addr??"",kind:"paired",state:q,quiet:O,tone:F?F.tone==="bad"?"bad":"wait":E?E.tone:A?"ok":"idle",here:R?R.here:C,...b.via==="tailscale"?{via:"tailscale"}:{},hint:R?`${H.name} 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. ${b.lastSeen==null?"It has not called since this deck started.":`It last called ${fs(b.lastSeen,t)}.`} Add its address with the + at the top of this section to reach it either way.`:`${H.name}${T?` at ${T}`:""}${(j=b.last)!=null&&j.error?` — ${b.last.error}`:""}`})}n.push(...sz(u).sort(a),...f.sort(a));const p=[];for(const b of e.strangers??[]){if(!(b!=null&&b.fp)||r.has(b.fp))continue;r.add(b.fp);const S=c(b.fp,b.name||b.fp);p.push({fp:b.fp,name:S.name,...S.self?{self:S.self}:{},addr:b.addr??"",kind:"nearby",state:"not paired yet",tone:"idle",here:!0,hint:b.via==="tailscale"?`${S.name} at ${b.addr} is on your tailnet and nothing is shared with it.`:`${S.name} at ${b.addr} is on this network and nothing is shared with it.`,...b.via==="tailscale"?{via:"tailscale"}:{}})}n.push(...p.sort(a));const h=[];for(const b of e.declined??[]){if(!(b!=null&&b.fp)||r.has(b.fp))continue;r.add(b.fp);const S=c(b.fp,b.name||b.fp);h.push({fp:b.fp,name:S.name,...S.self?{self:S.self}:{},addr:b.addr??"",kind:"declined",state:"you said no",tone:"idle",here:!1,hint:`${S.name} asked and was turned away. It is not asking any more.`})}n.push(...h.sort(a));const m=new Map;for(const b of n)m.set(b.name,(m.get(b.name)??0)+1);for(const b of n)(m.get(b.name)??0)<2||!b.addr||(b.state=b.quiet||!b.state?b.addr:`${b.addr} · ${b.state}`,b.quiet=!1);return n}function sz(e){const t=new Map;for(const r of e){const a=t.get(r.name);a?a.push(r):t.set(r.name,[r])}const n=[];for(const r of t.values()){const a=[...new Set(r.filter(l=>l.addr).map(l=>l.addr))];if(a.length>1){for(const l of a)n.push(k_(r.filter(c=>c.addr===l)));n.push(...r.filter(l=>!l.addr))}else n.push(k_(r))}return n}function k_(e){const[t,...n]=[...e].sort((r,a)=>Number(a.here)-Number(r.here)||+!!a.addr-+!!r.addr);return n.length?{...t,twins:n}:t}function N_(e,t){return t?e.map(n=>t[n.fp]?{...n,name:t[n.fp]}:n):e}function __(e,t){if(!e)return{};switch(t.kind){case"paired":return{peer:(e.peers??[]).find(n=>(n.peerFp??n.fp)===t.fp)??null};case"dialling":return{peer:(e.peers??[]).find(n=>n.manual&&!n.met&&`${n.addr}:${n.port}`===t.fp)??null};case"nearby":return{stranger:(e.strangers??[]).find(n=>n.fp===t.fp)??null};case"declined":return{stranger:(e.declined??[]).find(n=>n.fp===t.fp)??null};case"asks":return{stranger:(e.pending??[]).find(n=>n.fp===t.fp)??null}}}function az(e,t){const n=/^(\d+)\.(\d+)\.(\d+)/.exec(e??""),r=/^(\d+)\.(\d+)\.(\d+)/.exec(t??"");if(!n||!r)return null;for(let a=1;a<=3;a++){const l=Number(n[a])-Number(r[a]);if(l)return Math.sign(l)}return 0}function oz(e,t,n){const r=t?t.alive?"works here":"expired here":"not on this deck";if(!e.alive){const a=t&&!t.alive?"neither copy works — sign in again here":null;return{there:"broken there",here:r,note:a,tone:a?"bad":"idle"}}return t?t.alive?{there:"works there",here:r,note:null,tone:"ok"}:n?{there:"works there",here:r,note:"repairs next round",tone:"wait"}:{there:"works there",here:r,note:"share it to repair",tone:"bad"}:{there:"works there",here:r,note:"arrives next round",tone:"wait"}}function iz(e,t,n,r=null){const a=new Map(t.map(f=>[f.key,f])),l=new Set(n),c=[],u=new Set;for(const f of e??[]){if(u.has(f.key))continue;u.add(f.key);const p=a.get(f.key)??null,h=l.has(f.key),m=oz(f,p,h),y=p?p.alive?"works":"expired":"missing",w=!f.alive&&p&&!p.alive?m.note:[y==="works"?null:m.here,f.alive?null:m.there,m.note].filter(Boolean).join(" · ")||null;c.push({key:f.key,email:f.email,here:y,there:f.alive?"works":"broken",in:f.alive?m.tone==="wait"?"wait":m.tone==="bad"?"blocked":"live":"cut",out:h&&p?p.alive?"live":"cut":null,caption:w,tone:m.tone,usedThere:r===f.key})}for(const f of n){const p=a.get(f);!p||u.has(f)||(u.add(f),c.push({key:f,email:p.email,here:p.alive?"works":"expired",there:"unknown",in:null,out:p.alive?"live":"cut",caption:p.alive?null:"expired here",tone:p.alive?"ok":"bad",usedThere:!1}))}return c}async function zi(e,t){return(await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json().catch(()=>null)}function lz({anchorId:e,id:t,rows:n,onHold:r,onLet:a}){const l=x.useRef(null),c=n.filter(y=>y.kind==="paired"),u=c.filter(y=>y.here),f=u.slice(0,ZB),p=c.length-u.length,h=u.length>f.length?`and ${u.length-f.length} more`:p>0?`${p} not on right now`:null,m=x.useCallback(()=>{const y=l.current,w=document.getElementById(e);if(!y||!w)return;const _=Q0(w.getBoundingClientRect(),{width:y.offsetWidth,height:y.offsetHeight},{width:window.innerWidth,height:window.innerHeight});y.style.top=`${_.top}px`,y.style.left=`${_.left}px`,y.style.maxHeight=_.maxHeight==null?"":`${_.maxHeight}px`,y.dataset.side=_.side},[e]);return x.useLayoutEffect(()=>{m()}),x.useEffect(()=>(window.addEventListener("scroll",m,!0),window.addEventListener("resize",m),()=>{window.removeEventListener("scroll",m,!0),window.removeEventListener("resize",m)}),[m]),_n.createPortal(o.jsxs("div",{ref:l,id:t,className:"ap-peek",role:"tooltip",onPointerEnter:r,onPointerLeave:a,children:[o.jsx("p",{className:"ap-peek-title",children:u.length?"On the network now":"Nobody on the network"}),f.length>0&&o.jsx("div",{className:"ap-peek-list",children:f.map(y=>o.jsxs("span",{className:"ap-peek-who",children:[o.jsx("i",{className:"ap-nav-live","aria-hidden":!0}),o.jsxs("span",{children:[y.name,y.via==="tailscale"&&o.jsx("span",{className:"ap-lan-via",children:" · Tailscale"})]})]},`${y.kind}:${y.fp}`))}),h&&o.jsx("p",{className:"ap-peek-rest",children:h})]}),document.body)}function cz(e,t){var l;if(!e)return{text:"checking…",tone:"idle",live:!1};if(!e.enabled)return{text:"Off",tone:"idle",live:!1};if(e.stalled)return{text:"could not start",tone:"bad",live:!1};if(!e.running)return{text:"starting…",tone:"wait",live:!1};const n=t.filter(c=>c.kind==="asks").length;if(n)return{text:n===1?"1 deck wants to pair":`${n} decks want to pair`,tone:"wait",live:!1};if((l=e.reach)!=null&&l.blocked)return{text:"nothing can get in",tone:"bad",live:!1};const r=t.filter(c=>c.kind==="paired");if(!r.length)return{text:"On · none paired yet",tone:"idle",live:!1};const a=r.filter(c=>c.here).length;return a?a===r.length?{text:`${a} online`,tone:"ok",live:!0}:{text:`${a} of ${r.length} online`,tone:"ok",live:!0}:{text:`none of ${r.length} online`,tone:"idle",live:!1}}function uz({accounts:e,onChanged:t,view:n,onOpen:r,onBack:a,closeButton:l}){const[c,u]=x.useState(null),[f,p]=x.useState([]),[h,m]=x.useState(null),[y,w]=x.useState(!1),[_,k]=x.useState(null),j=x.useRef(0),[b,S]=x.useState(!1),[E,C]=x.useState(!1),[T,R]=x.useState(!1),A=x.useRef(0);x.useEffect(()=>()=>window.clearTimeout(A.current),[]);const[q,F]=x.useState(!1),[O,H]=x.useState(null),K=x.useRef(null),X=x.useCallback(oe=>qh(K.current)?(K.current=oe,m(oe),!0):!1,[]),I=x.useCallback(()=>{K.current=null,z.current&&m(null)},[]),Z=oe=>{const ye=za(h,oe);return{disabled:ye.disabled,"aria-busy":ye.busy}},[W,$]=x.useState(()=>Date.now()),z=x.useRef(!0),U=x.useRef(o0),V=x.useCallback(async()=>{var oe,ye;try{const[Ce,De]=await Promise.all([fetch("/api/lan").then(qe=>qe.json()),fetch("/api/prefs").then(qe=>qe.json())]);if(!z.current)return;Ce!=null&&Ce.ok&&u(Ce),De!=null&&De.ok&&p(Array.isArray((ye=(oe=De.prefs)==null?void 0:oe.lan)==null?void 0:ye.manual)?De.prefs.lan.manual:[]),U.current=(Ce==null?void 0:Ce.enabled)===!0?o0:sM}catch{}},[]);x.useEffect(()=>{z.current=!0;let oe=0;const ye=async()=>{$(Date.now()),await V(),z.current&&(oe=window.setTimeout(ye,U.current))};return ye(),()=>{z.current=!1,window.clearTimeout(oe)}},[V]);const B=x.useCallback(async()=>{const oe=(c==null?void 0:c.enabled)===!0;if(X("switch"))try{const ye=await zi("/api/prefs",{lan:{enabled:!oe}});if(!z.current)return;ye!=null&&ye.ok?(H(null),oe||w(!0)):H(en(oe?"turn this off":"turn this on",ye)),await V()}catch{z.current&&H(en(oe?"turn this off":"turn this on",null))}finally{I()}},[c==null?void 0:c.enabled,V,X,I]),Y=x.useCallback(async(oe,ye,Ce)=>{if(!X(`${oe}:${ye}`))return null;let De=null;try{const qe=await zi("/api/lan/peer",{action:oe,fp:ye});if(!z.current)return null;qe!=null&&qe.ok?(u(qe),H(null)):(De=en(Ce,qe),H(De)),await V()}catch{De=en(Ce,null),z.current&&H(De)}finally{I()}return De},[V,X,I]),ue=x.useCallback(async oe=>{if(!X(`drop:${oe}`))return null;let ye=null;try{const Ce=await zi("/api/prefs",{lan:{manual:f.filter(De=>De!==oe)}});if(!z.current)return null;Ce!=null&&Ce.ok?(H(null),t()):(ye=en("stop dialling that address",Ce),H(ye)),await V()}catch{ye=en("stop dialling that address",null),z.current&&H(ye)}finally{I()}return ye},[f,V,t,X,I]),[G,ee]=x.useState(null),L=x.useCallback(async(oe,ye)=>{if(!X(`alias:${oe}`))return"Something else is still being saved. Try again in a moment.";try{const Ce=await zi("/api/lan/peer",{action:"alias",fp:oe,name:ye});return z.current?Ce!=null&&Ce.ok?(u(Ce),null):en("rename that deck",Ce):null}catch{return en("rename that deck",null)}finally{I()}},[X,I]),te=x.useCallback(async oe=>{if(!X(`check:${oe}`))return null;try{const ye=await zi("/api/lan/sync",{fp:oe});return z.current?ye!=null&&ye.ok?(u(ye),t(),null):(ye==null?void 0:ye.reason)==="no_address"?"There is no address here to call it on. It calls this deck, and it is up to date each time it does.":en("check that deck",ye):null}catch{return en("check that deck",null)}finally{I()}},[X,I,t]),ne=x.useCallback(async()=>{if(X("check"))try{const oe=await zi("/api/lan/sync",{});if(!z.current)return;oe!=null&&oe.ok?(u(oe),H(null)):H(en("check the other decks",oe)),t()}catch{z.current&&H(en("check the other decks",null))}finally{I()}},[X,I,t]),ie=(c==null?void 0:c.enabled)===!0,me=rz(c,W),je=G?me.find(oe=>{var ye;return oe.fp===G||((ye=oe.twins)==null?void 0:ye.some(Ce=>Ce.fp===G))})??null:null;x.useEffect(()=>{G&&c&&!je&&ee(null)},[G,c,je]);const Oe=me.filter(oe=>oe.kind==="asks"),Ve=me.filter(oe=>oe.kind!=="asks"),Le=Ve.filter(oe=>oe.here),Te=Ve.filter(oe=>!oe.here),nt=Te.filter(oe=>oe.tone==="bad").length,_e=q||Le.length===0,Se=ez(c,W),Xe=Ve.filter(oe=>oe.kind==="paired").length,ot=cz(c,me),$e=o.jsxs(o.Fragment,{children:[b&&c&&o.jsx(RB,{status:c,manual:f,onClose:()=>S(!1),onChanged:()=>{V(),t()}}),E&&o.jsx(eM,{title:"How Local network works",steps:SB,finish:ie?void 0:{label:"Turn it on",act:()=>{C(!1),B()}},onClose:()=>C(!1)}),y&&c&&o.jsx(BB,{status:{...c,manualRows:f},accounts:e,manual:f,onClose:()=>w(!1),onChanged:()=>{V(),t()}}),je&&c&&o.jsx(FB,{row:je,source:__(c,je),status:c,accounts:e,now:W,busy:h,onClose:()=>ee(null),onRename:oe=>L(je.fp,oe),onCheck:()=>te(je.fp),onVerb:()=>{switch(je.kind){case"paired":return Y("unpair",je.fp,"unpair that deck");case"nearby":return Y("accept",je.fp,"reach that deck");case"declined":return Y("allow",je.fp,"let that deck ask again");case"dialling":return ue(je.fp);default:return Promise.resolve(null)}},onSettings:()=>{ee(null),w(!0)},twins:(je.twins??[]).map(oe=>({row:oe,peer:__(c,oe).peer??null})),onUnpair:oe=>Y("unpair",oe,"unpair that deck")})]});if(!n){const oe=qe=>{window.clearTimeout(A.current),A.current=window.setTimeout(()=>R(!0),qe)},ye=()=>{window.clearTimeout(A.current),A.current=window.setTimeout(()=>R(!1),iM)},Ce=()=>window.clearTimeout(A.current),De=()=>{window.clearTimeout(A.current),R(!1)};return o.jsxs("div",{className:"ap-foot",children:[o.jsxs("button",{type:"button",id:"ap-lan-entry",className:"ap-nav",onClick:()=>{De(),r()},"aria-describedby":T?"ap-lan-peek":void 0,onPointerEnter:qe=>{qe.pointerType==="mouse"&&oe(oM)},onPointerLeave:ye,onFocus:qe=>{qe.target.matches(":focus-visible")&&oe(0)},onBlur:ye,children:[o.jsxs("svg",{className:"ap-nav-glyph",width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[o.jsx("rect",{x:"1.8",y:"2.3",width:"10.4",height:"7.2",rx:"1.2"}),o.jsx("path",{d:"M5 11.9h4M7 9.5v2.4"})]}),o.jsxs("span",{className:"ap-nav-text",children:[o.jsx("span",{className:"ap-nav-name",children:"Local network"}),o.jsxs("span",{className:"ap-nav-state","data-tone":ot.tone,children:[ot.live&&o.jsx("i",{className:"ap-nav-live","aria-hidden":!0}),ot.text]})]}),o.jsx("svg",{className:"ap-nav-chev",width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:o.jsx("path",{d:"M5.6 3.4 9.2 7l-3.6 3.6"})})]}),T&&o.jsx(lz,{anchorId:"ap-lan-entry",id:"ap-lan-peek",rows:me,onHold:Ce,onLet:ye}),o.jsx("p",{className:"vis-hidden",role:"status",children:Se.tone==="ok"?"":Se.text}),$e]})}return o.jsxs("div",{className:"ap-lan-view",children:[o.jsxs("div",{className:"ap-header",children:[o.jsx("button",{type:"button",id:"ap-lan-back",className:"glyph-btn ap-back",onClick:a,"aria-label":"Back to Claude accounts",title:"Back to Claude accounts",children:o.jsx("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:o.jsx("path",{d:"M8.4 3.4 4.8 7l3.6 3.6"})})}),o.jsx("h2",{id:"ap-lan-title",children:"Local network"}),o.jsxs("div",{className:"ap-header-right",children:[ie&&o.jsx("button",{type:"button",className:"glyph-btn ap-lan-plus",onClick:()=>S(!0),"aria-label":"Add a deck",title:"Reach a deck that has not turned up on its own — by address, or with an invite",children:o.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[o.jsx("path",{d:"M6.1 7.9a2.6 2.6 0 0 0 3.7 0l1.9-1.9a2.6 2.6 0 0 0-3.7-3.7l-.9.9"}),o.jsx("path",{d:"M7.9 6.1a2.6 2.6 0 0 0-3.7 0L2.3 8a2.6 2.6 0 0 0 3.7 3.7l.9-.9"})]})}),ie&&Xe>0&&o.jsx("button",{type:"button",className:"glyph-btn ap-lan-check",...Z("check"),onClick:()=>void ne(),"aria-label":h==="check"?"Checking every paired deck":"Check every paired deck now",title:"Ask every paired deck now for anything this deck's expired logins need, instead of waiting for the next round",children:o.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[o.jsx("circle",{cx:"7",cy:"7",r:"1.1",fill:"currentColor",stroke:"none"}),o.jsx("path",{d:"M4.6 4.6a3.4 3.4 0 0 0 0 4.8M9.4 4.6a3.4 3.4 0 0 1 0 4.8"}),o.jsx("path",{d:"M2.6 2.6a6.2 6.2 0 0 0 0 8.8M11.4 2.6a6.2 6.2 0 0 1 0 8.8"})]})}),ie&&o.jsx("button",{type:"button",className:"glyph-btn ap-lan-set",...Z("setup"),onClick:()=>w(!0),"aria-label":"This deck's name and shared logins",title:"This deck's name on the network, and which of its logins it offers",children:o.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round","aria-hidden":!0,children:[o.jsx("path",{d:"M1.8 4.7h10.4M1.8 9.3h10.4"}),o.jsx("circle",{cx:"9.1",cy:"4.7",r:"1.6",fill:"var(--panel)"}),o.jsx("circle",{cx:"4.9",cy:"9.3",r:"1.6",fill:"var(--panel)"})]})}),l]})]}),o.jsx("div",{className:"ap-scroll",id:"ap-lan-scroll",children:o.jsxs("div",{className:"ap-lan",children:[o.jsxs("div",{className:"ap-policy",children:[o.jsx("h3",{className:"ap-auto-title",children:"Sync with paired decks"}),o.jsx("button",{type:"button",className:"switch ap-auto-state",role:"switch","aria-checked":ie,"aria-label":"Sync with paired decks",...Z("switch"),onClick:()=>void B(),title:ie?"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:o.jsx("span",{className:"switch-knob"})})]}),ie&&o.jsx(nM,{reach:c==null?void 0:c.reach,where:"panel"}),ie&&(c==null?void 0:c.deaf)&&o.jsx("p",{className:"ap-lan-fine",children:c.deaf}),ie&&(c==null?void 0:c.lanTunneled)&&o.jsx("p",{className:"ap-lan-fine",children:JB(c)}),!ie&&o.jsxs("button",{type:"button",className:"ap-lan-intro",onClick:()=>C(!0),title:"Four pictures: what this does, and what to do on each machine",children:[o.jsx(jB,{}),o.jsx("span",{className:"ap-lan-intro-text",children:"Paired machines repair each other's expired logins."}),o.jsx("span",{className:"ap-lan-intro-go",children:"See how it works"})]}),o.jsx("p",{className:`ap-lan-status ${Se.tone}`,role:"status",children:Se.tone==="ok"?"":Se.text}),O&&o.jsxs("div",{className:"ap-failure",role:"alert",children:[o.jsx("span",{className:"ap-failure-text",children:O}),o.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>H(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),ie&&o.jsxs(o.Fragment,{children:[Oe.length>0&&o.jsx("div",{className:"ap-lan-asks",role:"alert",children:Oe.map(oe=>o.jsxs("div",{className:"ap-lan-ask",children:[o.jsxs("span",{className:"ap-lan-ask-what",children:[o.jsx("strong",{className:"ap-lan-peer-name",children:oe.name})," at ",o.jsx("code",{className:"ap-lan-code",children:oe.addr})," wants to pair"]}),o.jsxs("span",{className:"ap-lan-ask-fp",children:["fingerprint ",o.jsx("code",{className:"ap-lan-code",children:oe.fp})]}),o.jsxs("span",{className:"ap-lan-ask-acts",children:[o.jsx("button",{type:"button",className:"ap-manage-btn",...Z(`accept:${oe.fp}`),onClick:()=>void Y("accept",oe.fp,"accept that deck"),title:`Talk to this deck from now on. Its fingerprint is ${oe.fp} — check it matches the one on their screen before you accept.`,children:"accept"}),o.jsx("button",{type:"button",className:"ap-manage-btn",...Z(`dismiss:${oe.fp}`),onClick:()=>void Y("dismiss",oe.fp,"decline that request"),title:"Say no. Nothing is shared, and that deck is told rather than left waiting.",children:"decline"})]})]},oe.fp))}),(_e?[...Le,...Te]:Le).length>0&&o.jsx("ul",{className:"ap-lan-here",children:(_e?[...Le,...Te]:Le).map((oe,ye)=>o.jsxs("li",{className:"ap-lan-who","data-tone":oe.tone,children:[o.jsx("i",{className:oe.here?"ap-pulse":"ap-dot","aria-hidden":!0}),o.jsxs("span",{className:"ap-lan-who-name","aria-hidden":!0,children:[oe.name,oe.via==="tailscale"&&o.jsx("span",{className:"ap-lan-via",children:" · Tailscale"})]}),o.jsx("button",{type:"button",className:"ap-lan-who-open","aria-haspopup":"dialog","aria-describedby":`lan-who-state-${ye}`,onClick:()=>ee(oe.fp),children:o.jsxs("span",{className:"vis-hidden",children:[oe.name,oe.via==="tailscale"?", over Tailscale":"",", details"]})}),o.jsx("span",{id:`lan-who-state-${ye}`,className:oe.quiet?"vis-hidden":"ap-lan-who-when",children:oe.state}),oe.kind==="nearby"&&o.jsx("button",{type:"button",className:"ap-manage-btn ap-lan-do",...Z(`accept:${oe.fp}`),onClick:()=>void Y("accept",oe.fp,"reach that deck"),"aria-label":`Ask ${oe.name} to pair`,title:`Send ${oe.name} a request. Somebody at that machine has to accept it before anything is shared. Its fingerprint is ${oe.fp}.`,children:"ask"}),oe.kind==="paired"&&o.jsx("button",{type:"button",className:`ap-manage-btn ap-lan-do danger${_===oe.fp?" armed":""}`,...Z(`unpair:${oe.fp}`),onClick:()=>{const Ce=Date.now(),De=ph({armedFor:_,target:oe.fp,armedAt:j.current,now:Ce,gapMs:yh});if(De==="arm"){k(oe.fp),j.current=Ce,window.setTimeout(()=>k(qe=>qe===oe.fp?null:qe),4e3);return}De!=="ignore"&&(k(null),Y("unpair",oe.fp,"unpair that deck"))},"aria-label":_===oe.fp?`Confirm unpairing ${oe.name}`:`Unpair ${oe.name}`,title:_===oe.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:_===oe.fp?"confirm":"unpair"}),oe.kind==="dialling"&&o.jsx("button",{type:"button",className:"ap-manage-btn ap-lan-do",...Z(`drop:${oe.fp}`),onClick:()=>void ue(oe.fp),"aria-label":`Stop dialling ${oe.name}`,title:"Stop trying this address. Nothing was ever paired here.",children:"stop"}),oe.kind==="declined"&&o.jsx("button",{type:"button",className:"ap-manage-btn ap-lan-do",...Z(`allow:${oe.fp}`),onClick:()=>void Y("allow",oe.fp,"let that deck ask again"),"aria-label":`Let ${oe.name} ask again`,title:"Take the no back. That deck is still trying, so the request comes round again on its own.",children:"allow"})]},`${oe.kind}:${oe.fp}`))}),(Le.length>0&&Te.length>0||ie&&Xe>0)&&o.jsxs("div",{className:"ap-lan-tail",children:[Le.length>0&&Te.length>0&&o.jsxs("button",{type:"button",className:"ap-lan-word ap-lan-more","aria-expanded":q,onClick:()=>F(oe=>!oe),title:q?"Show only the decks that are on":`Show the ${Te.length} deck${Te.length===1?"":"s"} that are not responding right now`,children:[o.jsx("span",{className:`ap-lan-chev${q?" open":""}`,"aria-hidden":!0,children:"›"}),q?"fewer":`${Te.length} more`,!q&&nt>0&&o.jsxs("span",{className:"ap-lan-more-bad",children:[" · ",nt," not responding"]})]}),ie&&Xe>0&&o.jsx("span",{className:"ap-lan-checked",children:tz(c==null?void 0:c.checkedAt,W,h==="check")})]}),Ve.length===0&&Oe.length===0&&!(c!=null&&c.stalled)&&!(c!=null&&c.deaf)&&!(c!=null&&c.lanTunneled)&&o.jsxs(o.Fragment,{children:[o.jsx("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, the link at the top of this view reaches one by address or by invite."}),o.jsx("button",{type:"button",className:"ap-lan-word ap-lan-how",onClick:()=>C(!0),children:"How it works"})]})]})]})}),$e]})}function dz({anchorId:e,id:t,peers:n,onHold:r,onLet:a}){const l=x.useRef(null),{title:c,shown:u,rest:f}=dB(n),p=x.useCallback(()=>{const h=l.current,m=document.getElementById(e);if(!h||!m)return;const y=Q0(m.getBoundingClientRect(),{width:h.offsetWidth,height:h.offsetHeight},{width:window.innerWidth,height:window.innerHeight});h.style.top=`${y.top}px`,h.style.left=`${y.left}px`,h.style.maxHeight=y.maxHeight==null?"":`${y.maxHeight}px`,h.dataset.side=y.side},[e]);return x.useLayoutEffect(()=>{p()}),x.useEffect(()=>(window.addEventListener("scroll",p,!0),window.addEventListener("resize",p),()=>{window.removeEventListener("scroll",p,!0),window.removeEventListener("resize",p)}),[p]),_n.createPortal(o.jsxs("div",{ref:l,id:t,className:"ap-peek ap-fold-peek",role:"tooltip",onPointerEnter:r,onPointerLeave:a,children:[o.jsx("p",{className:"ap-peek-title",children:c}),o.jsx("div",{className:"ap-peek-list",children:u.map(h=>o.jsxs("span",{className:"ap-peek-who ap-fold-who",children:[o.jsx("span",{className:"ap-fold-name",children:h.name}),o.jsx("span",{className:"ap-fold-state","data-tone":h.ready?"ok":h.warn?"warn":"idle",children:h.ready?h.headroom==null?"not read yet":`${h.headroom}% free`:h.why})]},h.key))}),f&&o.jsx("p",{className:"ap-peek-rest",children:f})]}),document.body)}function hz({peers:e,strained:t,armed:n,threshold:r,open:a,onToggle:l}){const[c,u]=x.useState(!1),f=x.useRef(0);x.useEffect(()=>()=>window.clearTimeout(f.current),[]),x.useEffect(()=>{a&&(window.clearTimeout(f.current),u(!1))},[a]);const p=_=>{a||(window.clearTimeout(f.current),f.current=window.setTimeout(()=>u(!0),_))},h=()=>{window.clearTimeout(f.current),f.current=window.setTimeout(()=>u(!1),iM)},m=()=>window.clearTimeout(f.current),y=()=>{window.clearTimeout(f.current),u(!1)},w=cB(e,{strained:t&&!a,armed:n,threshold:r});return o.jsxs("div",{className:"ap-rest",children:[o.jsxs("button",{type:"button",id:"ap-rest-entry",className:"ap-nav","aria-expanded":a,"aria-controls":a?"ap-rest-panel":void 0,"aria-describedby":c?"ap-rest-peek":void 0,onClick:()=>{y(),l()},onPointerEnter:_=>{_.pointerType==="mouse"&&p(oM)},onPointerLeave:h,onFocus:_=>{_.target.matches(":focus-visible")&&p(0)},onBlur:h,children:[o.jsxs("span",{className:"ap-nav-text",children:[o.jsx("span",{className:"ap-nav-name",children:"Other accounts"}),o.jsx("span",{className:"ap-nav-state","data-tone":w.tone,children:w.text})]}),o.jsx("svg",{className:"ap-nav-chev",width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:o.jsx("path",{d:"M5.6 3.4 9.2 7l-3.6 3.6"})})]}),c&&o.jsx(dz,{anchorId:"ap-rest-entry",id:"ap-rest-peek",peers:e,onHold:m,onLet:h})]})}async function fz(e){return(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json().catch(()=>null)}const pz=1800;function mz({accounts:e,onClose:t,copyText:n}){const[r,a]=x.useState([]),[l,c]=x.useState(null),[u,f]=x.useState(!1),[p,h]=x.useState(null),[m,y]=x.useState(!1),[w,_]=x.useState(()=>Math.floor(Date.now()/1e3)),k=x.useRef(null),j=x.useRef(!1),b=sn(t,{focusRef:k});x.useEffect(()=>{if(!l)return;_(Math.floor(Date.now()/1e3));const O=window.setInterval(()=>_(Math.floor(Date.now()/1e3)),1e3);return()=>window.clearInterval(O)},[l]);const S=Q8(e),E=J8(e,r),C=E.length===e.length,T=O=>a(H=>eB(H,O)),R=x.useCallback(async()=>{const O=tB(E);if(!Hs(j.current)||!O)return;j.current=!0,f(!0),h(null),y(!1);const H=await fz(O).catch(()=>null);if(j.current=!1,f(!1),!(H!=null&&H.ok)){h(Ki(H,"the share could not be made"));return}c({blob:H.blob,expiresAt:H.expiresAt,shared:H.shared??[],failed:H.failed??[]})},[e,E]),A=l?JR(l.expiresAt,w):null,q=(A==null?void 0:A.tone)==="gone",F=(l==null?void 0:l.shared.length)??0;return _n.createPortal(o.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:o.jsxs("div",{ref:b,className:"modal sa-modal",onClick:O=>O.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Share accounts with another deck",children:[o.jsxs("header",{className:"modal-head",children:[o.jsx("div",{className:"modal-title",children:o.jsx("h3",{children:"Share accounts"})}),o.jsx("div",{className:"modal-actions",children:o.jsx("button",{type:"button",className:"glyph-btn",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),o.jsx("section",{className:"modal-body sa-body",children:l?o.jsxs("div",{className:"sa-step",children:[o.jsx("h4",{children:q?"This share has expired":F===1?"1 account, ready to paste":`${F} accounts, ready to paste`}),o.jsx("code",{className:`ap-share-blob${q?" sa-dead":""}`,children:l.blob}),o.jsxs("div",{className:"ap-share-foot",children:[o.jsx("button",{type:"button",className:"ap-manage-btn",ref:k,onClick:async()=>{if(q){c(null),R();return}await n(l.blob)&&(y(!0),window.setTimeout(()=>y(!1),pz))},children:q?"make a new share":m?"copied":`copy ${F===1?"the share":"all "+F}`}),o.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:[o.jsx("span",{className:"ap-share-warn",children:F===1?"this is the password":`this is ${F} passwords`})," · ",o.jsx("span",{className:`ap-share-expiry ${A==null?void 0:A.tone}`,children:A==null?void 0:A.text})]})]}),l.failed.length>0&&o.jsxs("div",{className:"sa-failed",role:"alert",children:[o.jsx("p",{className:"sa-failed-head",children:l.failed.length===1?"One account is not in this bundle:":`${l.failed.length} accounts are not in this bundle:`}),o.jsx("ul",{className:"sa-list",children:l.failed.map(O=>{var K;const H=!!(O.email&&((K=O.detail)!=null&&K.includes(O.email)));return o.jsxs("li",{children:[!H&&o.jsx("span",{className:"sa-who",children:O.email||`account ${O.num}`}),o.jsx("span",{className:"sa-why",children:O.detail||"could not be exported"})]},`${O.num}-${O.email}`)})})]}),o.jsx("p",{className:"sa-note",children:q?o.jsx(o.Fragment,{children:"Another deck will refuse this text now. Make a new one — the same accounts are still picked."}):o.jsxs(o.Fragment,{children:["Paste it into the other deck with ",o.jsx("strong",{children:"+"})," → ",o.jsx("strong",{children:"Paste a share"}),". Accounts it already holds are left exactly as they are."]})}),o.jsxs("div",{className:"sa-actions",children:[o.jsx("button",{type:"button",className:"btn",onClick:()=>{c(null),y(!1)},children:"Pick again"}),o.jsx("button",{type:"button",className:"btn primary",onClick:t,children:"Done"})]})]}):e.length===0?o.jsxs("div",{className:"sa-step",children:[o.jsx("h4",{children:"Nothing to share"}),o.jsxs("p",{className:"sa-note",children:["This deck is not holding any accounts right now. Sign one in with ",o.jsx("strong",{children:"+"}),", or wait — the panel is still reading the store."]}),o.jsx("div",{className:"sa-actions",children:o.jsx("button",{type:"button",className:"btn primary",ref:k,onClick:t,children:"Close"})})]}):o.jsxs("div",{className:"sa-step",children:[o.jsxs("h4",{children:["Which accounts go to the other ",tn,"?"]}),o.jsx("p",{className:`sa-count${E.length?"":" empty"}`,children:nB(E.length)}),o.jsx("ul",{className:"sa-list sa-pick",children:S.map(O=>o.jsx("li",{children:o.jsxs("label",{className:"sa-row",children:[o.jsx("input",{type:"checkbox",checked:E.includes(O.num),onChange:()=>T(O.num)}),o.jsx("span",{className:"sa-who",children:O.label}),O.sub&&o.jsx("span",{className:"sa-sub",children:O.sub})]})},O.num))}),p&&o.jsx("p",{className:"aa-err",children:p}),o.jsxs("div",{className:"sa-actions",children:[o.jsx("button",{type:"button",className:"btn",onClick:()=>a(C?e.map(O=>O.num):[]),children:C?"Clear all":"Select all"}),o.jsx("button",{type:"button",className:"btn primary",ref:k,...$a(u,!E.length),onClick:R,children:u?"making the share…":E.length===0?"Share":E.length===1?"Share 1 account":`Share ${E.length} accounts`})]})]})})]})}),document.body)}function gz(e,t){const n=new Set(e),r=e.length?Math.max(...e):0;return[...new Set([...e,r+1])].sort((a,l)=>a-l).map(a=>{const l=a===t?"here":n.has(a)?"swap":"free";return{slot:a,kind:l,label:l==="here"?`slot ${a}`:`slot ${a} · ${l}`}})}function yz(e,t,n){if(!(n!=null&&n.ok))return null;const r=Number.isInteger(n.to)?n.to:null;if(r==null)return{menuFor:null,confirmRemove:null,shareFor:null,swapNote:null};const a=n.swapped===!0&&r!==t;return{menuFor:e.menuFor===t?r:a&&e.menuFor===r?t:e.menuFor,confirmRemove:null,shareFor:null,swapNote:a?{at:r,displaced:t}:null}}function wz(e,t,n){return t!=null&&e.some(r=>r.slot===t)?t:n}function vz(e,t,n){var a;const r=((a=e.find(l=>l.slot===t))==null?void 0:a.kind)??"here";return r==="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}.`}:r==="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 xz(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 S_(e){return typeof e.id=="string"&&e.id.startsWith("scoped-")}function bz(e){const t=e.filter(u=>!S_(u)),n=e.filter(u=>S_(u)),r=t.length?t:n,a=t.length?n:[],l=r.reduce((u,f)=>u&&u.pct>=f.pct?u:f,null);let c=null;for(const u of a)l&&u.pct<=l.pct||(!c||u.pct>c.pct)&&(c=u);return{shown:r,rest:a,fuller:c,peak:c??l}}const kz="\0";function vh(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}${kz}${n}`}function Nz(e,t){const n=vh(t);return e.includes(n)?e.filter(r=>r!==n):[...e,n]}function _z(e,t){if(!Array.isArray(t))return e;const n=new Set(t.map(vh)),r=e.filter(a=>n.has(a));return r.length===e.length?e:r}const Sz=64;function jz(e,t){const n=e.trim();return{alias:n,commit:n!==(t??"").trim()}}function Ez(e,t){return!e||!t||t.some(n=>n.num===e.num&&n.active)?e:null}const Cz=Object.freeze({text:"couldn't reach the deck server",reload:!0}),Tz=Object.freeze({text:"still waiting on the deck server — claude-swap can be slow to answer",reload:!0});async function j_(e){return e.ok?{ok:!0,status:e.status,body:null}:{ok:!1,status:e.status,body:await e.json().catch(()=>null)}}function Az(e){const t=e.find(r=>!r.ok);if(!t)return null;const n=Yc(t.body);return{text:n0(t.body,`the deck server answered ${t.status}`),...n?{raw:n}:{},reload:!0}}function E_(e,t){return t?e!=null&&e.reload&&e.text===t.text&&e.raw===t.raw?e:t:e!=null&&e.reload?null:e}const C_=15e3,Rz=8e3,Mz=1800,Iz=3e4,Qp=[70,80,85,90,95];function Jp(e,t){return $R(t-Math.floor(e/1e3))}function $z(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 Tc(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Oz(e,t){const n="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.";if((e==null?void 0:e.state)==="running")return{text:"resuming…",hint:`${n} The deck is re-capturing it from the login you already have. No sign-in, no switch.`};if((e==null?void 0:e.state)==="failed"){const r=Math.max(1,Math.ceil((e.retryAt/1e3-t)/60)),a=e.reason?`Re-capturing it from the login you already have did not work (${e.reason}).`:"The deck re-captured it from the login you already have, and claude-swap still cannot read it.";return{text:"numbers paused",hint:`${n} ${a} It tries again in ${r}m. No sign-in, no switch.`}}return{text:"numbers paused",hint:n}}function Lz(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 Pz(e){switch(e){case"no_credentials":return{text:"no stored login",hint:"claude-swap holds no credentials for this account, so there is nothing to read its usage with and nothing to switch to. A paired deck that has them sends them on its own; signing in as this account puts them there by hand.",fix:"sign in"};case"relogin_required":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.",fix:"sign in again"};case"keychain_unavailable":return{text:"keychain unreadable",hint:"This is about the deck, not the account: claude-swap could not open your keychain, so it cannot read any account's stored login. A deck started from a background session cannot reach the keychain at all — start it from a terminal, or let it start at login, and this clears."};case"token_expired":return{text:"token expired",hint:"The access token ran out and the refresh was deferred. The next collection retries."};case"foreign_credential":return{text:"wrong credential",hint:"The live credential belongs to a different account. Switching to this one repairs it."};case null:case void 0:return null;default:return{text:e,hint:`claude-swap reported "${e}" for this account.`}}}function Dd(e,t){if(e.staleCopy){const n=Oz(e.repair??null,t);return{text:Tc(n.text),hint:n.hint,fix:null,tone:"quiet",blocksSwitch:!1}}if(e.stopped){const n=Pz(e.collector??null);if(!n)return{text:"Not collecting",hint:"claude-swap has collected nothing for this account in over half a day and has not said why. A paired deck holding a working copy of this account will replace it on its own. To do it by hand, sign in as this account from + Add.",fix:null,tone:"quiet",blocksSwitch:!1};const r=e.collector==="no_credentials"||e.collector==="relogin_required";return{text:Tc(n.text),hint:n.hint,fix:n.fix?Tc(n.fix):null,tone:r||e.collector==="keychain_unavailable"?"warn":"quiet",blocksSwitch:r}}if(e.error){const n=Lz(e.error);return{text:Tc(n.text),hint:n.hint,fix:n.fixable?"Sign in again":null,tone:n.fixable?"warn":"quiet",blocksSwitch:n.fixable}}return null}function em(){return o.jsxs("svg",{className:"ap-warn-glyph",width:"12",height:"12",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[o.jsx("path",{d:"M7 1.9 12.9 12H1.1Z"}),o.jsx("path",{d:"M7 5.6v2.9"}),o.jsx("path",{d:"M7 10.3v.05"})]})}function Dz(e){return e>=90?"hi":e>=70?"mid":void 0}function Fz(e){const t=Number(e);return[...Number.isFinite(t)&&t>0&&!Qp.includes(t)?[...Qp,t]:Qp].sort((r,a)=>r-a)}function qz({lane:e,nowSec:t,frozen:n}){const r=Math.min(100,Math.max(0,e.pct)),a=n?"var(--muted)":r>=90?"var(--err)":r>=70?"var(--warn)":"var(--accent)",l=e.resetAt&&!n?OR(e.resetAt,t):null;return o.jsxs("div",{className:"ap-lane",children:[o.jsx("span",{className:"ap-lane-label",title:e.label,children:e.label}),o.jsx("div",{className:"ap-lane-track",children:o.jsx("div",{className:"ap-lane-fill",style:{width:`${r===0?1.5:r}%`,background:a,opacity:r===0||n?.4:1}})}),o.jsxs("span",{className:"ap-lane-pct",style:{color:a},children:[r,"%"]}),o.jsx("span",{className:"ap-lane-reset",title:l?`${e.label} resets in ${l}`:void 0,children:l&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"vis-hidden",children:"resets in "}),l]})})]})}function Bz({onClose:e,leaving:t}){var ys,In,yn;const[n,r]=x.useState(null),[a,l]=x.useState(null),[c,u]=x.useState(null),[f,p]=x.useState(!1),[h,m]=x.useState(null),[y,w]=x.useState(null),[_,k]=x.useState("accounts"),[j,b]=x.useState(!1),[S,E]=x.useState(null),C=x.useRef(S);C.current=S;const[T,R]=x.useState(()=>Math.floor(Date.now()/1e3)),A=x.useRef(null),[q,F]=x.useState(null),O=(q==null?void 0:q.num)??null,H=x.useRef(q);H.current=q;const[K,X]=x.useState(null),[I,Z]=x.useState(!1),[W,$]=x.useState(""),[z,U]=x.useState(null),V=x.useRef(0),[B,Y]=x.useState(null),[ue,G]=x.useState(!1),[ee,L]=x.useState(!1),[te,ne]=x.useState(null),[ie,me]=x.useState(null),[je,Oe]=x.useState(null),[Ve,Le]=x.useState(null),[Te,nt]=x.useState(!1),_e=x.useRef(null),Se=x.useRef(null),[Xe,ot]=x.useState([]),[$e,oe]=x.useState(!1),ye=x.useRef(null),Ce=x.useCallback(J=>qh(ye.current)?(ye.current=J,u(J),!0):!1,[]),De=x.useCallback(()=>{ye.current=null,u(null)},[]),qe=(J,Ae=!1)=>{const Fe=za(c,J);return{disabled:Fe.disabled,"aria-busy":Fe.busy||Ae}},rt=x.useCallback(J=>{window.requestAnimationFrame(()=>{var Ae;if(e_(((Ae=document.activeElement)==null?void 0:Ae.tagName)??null))for(const Fe of yq(J)){const Ie=document.querySelector(Fe);if(Ie){Ie.focus();return}}})},[]),et=x.useCallback(async(J=!1)=>{J&&p(!0);const Ae=new AbortController,Fe=window.setTimeout(()=>Ae.abort(),Iz);try{const[Ie,Ge]=await Promise.all([fetch(`/api/claude-accounts${J?"?refresh=1":""}`,{signal:Ae.signal}),fetch("/api/cswap-auto",{signal:Ae.signal})]);if(Ie.ok){const kt=await Ie.json();r(kt),ot(At=>_z(At,kt.accounts))}Ge.ok&&l(await Ge.json());const yt=Az([await j_(Ie),await j_(Ge)]);m(kt=>E_(kt,yt))}catch{m(Ie=>E_(Ie,Ae.signal.aborted?Tz:Cz))}finally{window.clearTimeout(Fe),J&&p(!1)}},[]),ve=x.useCallback(async(J,Ae,Fe="panel")=>{if(!Ce(Ae))return null;const Ie=Fe==="menu"?X:m;Ie(null);try{const Ge=await fetch("/api/cswap-auto",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(J)}),yt=await Ge.json().catch(()=>null);return yt!=null&&yt.ok||Ie({text:n0(yt,"command failed",Ge.status),raw:Yc(yt)}),yt}catch{return Ie({text:"server unreachable"}),null}finally{De()}},[Ce,De]),Re=x.useCallback(async(J,Ae)=>{if(!Ce(Ae))return null;m(null),X(null);try{const Fe=await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(J)}),Ie=await Fe.json().catch(()=>null);return Ie!=null&&Ie.ok||X({text:Ki(Ie,"command failed",Fe.status)}),Ie}catch{return X({text:"server unreachable"}),null}finally{De()}},[Ce,De]);x.useEffect(()=>(et(!0),A.current=window.setInterval(()=>et(!1),C_),()=>{A.current!=null&&window.clearInterval(A.current)}),[et]),x.useEffect(()=>{!(n!=null&&n.ok)||!n.accounts||w(J=>Ez(J,n.accounts))},[n]),x.useEffect(()=>{const J=window.setInterval(()=>R(Math.floor(Date.now()/1e3)),3e4);return()=>window.clearInterval(J)},[]);const Ue=((ys=a==null?void 0:a.settings["autoswitch.threshold"])==null?void 0:ys.value)??"90",pt=Ve??Ue,he=xz(pt,Ue),mt=(In=n==null?void 0:n.accounts)==null?void 0:In.find(J=>J.active),qt=mt?Dd(mt,T):null,Tt=(n==null?void 0:n.accounts)??[],jt=mt?Tt.filter(J=>!J.active):[],dn=jt.length?Tt.filter(J=>J.active):Tt,Sn=jt.map(J=>{const Ae=Dd(J,T);return{key:vh(J),name:J.alias??J.email??`account ${J.num}`,ready:!J.disabled&&!(Ae!=null&&Ae.blocksSwitch),why:J.disabled?"held out":Ae!=null&&Ae.blocksSwitch?Ae.text:null,warn:(Ae==null?void 0:Ae.tone)==="warn",headroom:J.headroom}}),Kt=Number(Ue),an=(mt==null?void 0:mt.headroom)!=null&&Number.isFinite(Kt)&&100-mt.headroom>=Kt,ge=(a==null?void 0:a.ok)===!0&&(a.enabled||a.external),ht=J=>$e&&jt.some(Ae=>Ae.num===J)?"ap-rest-list":"ap-scroll",tt=async(J,Ae)=>{if(Ce(`switch-${J}`)){m(null),w(null);try{const Ie=await(await fetch("/api/claude-accounts/switch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({account:J})})).json().catch(()=>null);Ie!=null&&Ie.ok?w({num:J,name:Ae}):m({text:n0(Ie,"the switch failed"),raw:Yc(Ie),row:J}),await et(!0)}catch{m({text:"server unreachable",row:J})}finally{De(),rt(J)}}},_t=x.useCallback(()=>{F(null),X(null),U(null),Y(null),L(!1)},[]),on=(J,Ae="first")=>{_t(),E(null),Oe(null),F({num:J,view:"menu",start:Ae})},Gn=(J,Ae)=>{_t(),E(Fe=>(Fe==null?void 0:Fe.anchor)===Ae?null:{num:J,anchor:Ae})},Et=x.useCallback((J=!1)=>{var Fe;const Ae=C.current;J&&Ae&&((Fe=document.getElementById(Ae.anchor))==null||Fe.focus()),E(null)},[]),lr=()=>{_t(),E(null),k("lan")},gn=x.useRef(_);x.useEffect(()=>{gn.current!==_&&(gn.current=_,window.requestAnimationFrame(()=>{var J;(J=document.getElementById(_==="lan"?"ap-lan-back":"ap-lan-entry"))==null||J.focus()}))},[_]),x.useEffect(()=>{n!=null&&n.ok&&b(!0)},[n==null?void 0:n.ok]);const Yt=x.useCallback(J=>{var Ie,Ge;const Ae=H.current;if(!Ae||J!=null&&Ae.num!==J)return;const Fe=document.getElementById(`ap-menu-${Ae.num}`);(Fe!=null&&Fe.contains(document.activeElement)||e_(((Ie=document.activeElement)==null?void 0:Ie.tagName)??null))&&((Ge=document.getElementById(`ap-more-${Ae.num}`))==null||Ge.focus()),_t()},[_t]);x.useEffect(()=>{t&&(_t(),E(null))},[t,_t]),x.useEffect(()=>{q&&(n!=null&&n.accounts)&&!n.accounts.some(J=>J.num===q.num)&&_t(),S&&(n!=null&&n.accounts)&&!n.accounts.some(J=>J.num===S.num)&&E(null)},[n,q,S,_t]);const jn=async J=>{var Fe;L(!1);const Ae=await Re({action:"share",account:J},`share-${J}`);!(Ae!=null&&Ae.ok)||((Fe=H.current)==null?void 0:Fe.num)!==J||(Y({num:J,blob:Ae.blob,expiresAt:Ae.expiresAt}),F({num:J,view:"share"}))},Bt=async(J,Ae)=>{const{commit:Fe,alias:Ie}=jz(W,Ae);if(Fe){const Ge=await Re({action:"alias",account:J,alias:Ie},`alias-${J}`);if(await et(!0),!(Ge!=null&&Ge.ok))return}Yt(J)},Rn=async(J,Ae)=>{var Ge,yt;const Fe=await Re({action:"move",account:J,slot:Ae},`move-${J}`),Ie=yz({menuFor:((Ge=H.current)==null?void 0:Ge.num)??null,shareFor:(B==null?void 0:B.num)??null},J,Fe);if(await et(!0),Ie){((yt=H.current)==null?void 0:yt.num)===J&&_t(),U(Ie.confirmRemove),Ie.shareFor==null&&(Y(null),L(!1)),me(Ie.swapNote);const kt=Ie.swapNote;kt&&window.setTimeout(()=>me(At=>At===kt?null:At),Rz),Oe(null),rt(Ie.menuFor)}return Fe},Kn=async(J,Ae,Fe)=>{if(!Fe.sends){Yt(J);return}await Rn(J,Ae)},cr=async(J,Ae)=>{if(Ae.sends){const Fe=await ve({action:"setting",key:"autoswitch.threshold",value:J},"threshold");if(await et(!0),!(Fe!=null&&Fe.ok))return;Le(null)}nt(!0),window.setTimeout(()=>{var Fe;document.activeElement===Se.current&&((Fe=_e.current)==null||Fe.focus()),nt(!1)},Mz)},Mn=o.jsx("button",{type:"button",className:"glyph-btn",onClick:e,"aria-label":"Close accounts panel",title:"Close (A)",children:o.jsx("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round","aria-hidden":!0,children:o.jsx("path",{d:"M3.4 3.4l7.2 7.2M10.6 3.4l-7.2 7.2"})})}),Ys=J=>{const{shown:Ae,fuller:Fe}=bz(J.lanes),Ie=Dd(J,T),Ge=J.active||Xe.includes(vh(J)),yt=J.alias??J.email??`account ${J.num}`,kt=J.stale||(Ie==null?void 0:Ie.blocksSwitch)===!0,At=Fe?[...Ae,Fe]:Ae,bt=J.fetchedAt?Jp(J.fetchedAt,T):null;return o.jsxs("li",{className:`ap-account${J.active?" active":""}`,"aria-current":J.active?"true":void 0,"data-open":Ge?"":void 0,"data-frozen":kt?"":void 0,children:[!J.active&&o.jsx("button",{type:"button",className:"ap-row-open",id:`ap-row-${J.num}`,"aria-expanded":Ge,"aria-controls":Ge?`ap-detail-${J.num}`:void 0,"aria-describedby":!Ge&&!(Ie!=null&&Ie.blocksSwitch)?`ap-quota-${J.num}`:void 0,onClick:()=>ot(St=>Nz(St,J)),children:o.jsxs("span",{className:"vis-hidden",children:[yt,", ",Ge?"hide details":"details"]})}),o.jsxs("div",{className:"ap-account-head",children:[J.active?o.jsx("span",{className:"ap-live",title:`Active account · slot ${J.num}`,children:o.jsxs("span",{className:"vis-hidden",children:["Active account, slot ",J.num,":"]})}):o.jsx("span",{className:"ap-num",children:J.num}),J.alias&&o.jsx("span",{className:"ap-alias",title:J.alias,children:J.alias}),o.jsx("span",{className:"ap-email",title:J.email??void 0,children:J.email}),J.disabled&&o.jsx("span",{className:"ap-held",children:"held out"}),!J.active&&!J.disabled&&!(Ie!=null&&Ie.blocksSwitch)&&o.jsx("button",{type:"button",className:"ap-switch",...qe(`switch-${J.num}`),onClick:()=>tt(J.num,yt),"aria-label":`Switch to ${yt}`,title:`Switch to ${J.alias??J.email}`,children:c===`switch-${J.num}`?"…":"Switch"}),o.jsx("button",{type:"button",id:`ap-more-${J.num}`,className:"ap-more","aria-label":`More actions for ${J.email??J.alias??`account ${J.num}`}`,"aria-haspopup":"menu","aria-expanded":O===J.num,"aria-controls":O===J.num?`ap-menu-${J.num}`:void 0,title:"More actions",onClick:()=>O===J.num?Yt():on(J.num),onKeyDown:St=>{St.key!=="ArrowDown"&&St.key!=="ArrowUp"||(St.preventDefault(),on(J.num,St.key==="ArrowUp"?"last":"first"))},children:o.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"currentColor","aria-hidden":!0,children:[o.jsx("circle",{cx:"2.8",cy:"7",r:"1.15"}),o.jsx("circle",{cx:"7",cy:"7",r:"1.15"}),o.jsx("circle",{cx:"11.2",cy:"7",r:"1.15"})]})})]}),(h==null?void 0:h.row)===J.num&&o.jsxs("div",{className:"ap-failure ap-row-failure",role:"alert",children:[o.jsx("span",{className:"ap-failure-text",title:h.raw||void 0,children:h.text}),o.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>m(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),J.active&&(y==null?void 0:y.num)===J.num&&o.jsx("p",{className:"ap-switched",children:"Now active. New sessions start on it; ones already running pick it up on their next message, up to about 30 seconds later on macOS."}),(ie==null?void 0:ie.at)===J.num&&(()=>{const St=Tt.find(ws=>ws.num===ie.displaced),jr=(St==null?void 0:St.alias)??(St==null?void 0:St.email)??"the account that was there";return o.jsxs("p",{className:"ap-note ap-swap-note",title:`Slot ${ie.at} was taken, so the two accounts traded places: ${jr} now holds slot ${ie.displaced}.`,children:["swapped with slot ",ie.displaced]})})(),Ie&&o.jsxs("div",{className:"ap-issue-line",children:[o.jsxs("button",{type:"button",id:`ap-issue-${J.num}`,className:"ap-issue","data-tone":Ie.tone,"aria-haspopup":"dialog","aria-expanded":(S==null?void 0:S.anchor)===`ap-issue-${J.num}`,"aria-controls":(S==null?void 0:S.anchor)===`ap-issue-${J.num}`?"ap-issue-pop":void 0,onClick:()=>Gn(J.num,`ap-issue-${J.num}`),children:[Ie.tone==="warn"&&o.jsx(em,{}),o.jsx("span",{className:"ap-issue-text",children:Ie.text})]}),!Ge&&o.jsx("span",{className:"ap-issue-age",title:"When claude-swap last read this account's usage",children:bt??"never collected"})]}),!Ge&&!(Ie!=null&&Ie.blocksSwitch)&&o.jsxs("p",{className:"ap-quota",id:`ap-quota-${J.num}`,children:[At.length?At.map(St=>o.jsxs("span",{className:"ap-q",children:[o.jsx("span",{className:"ap-q-label",children:St.label})," ",o.jsxs("span",{className:"ap-q-pct","data-level":kt?void 0:Dz(St.pct),children:[Math.round(St.pct),"%"]})]},St.id)):o.jsx("span",{className:"ap-q-label",children:"no usage recorded yet"}),J.stale&&!Ie&&o.jsx("span",{className:"ap-q-age","data-never":bt?void 0:"",title:"When claude-swap last read this account's usage",children:bt??"never collected"})]}),Ge&&o.jsxs("div",{className:"ap-detail",id:`ap-detail-${J.num}`,children:[o.jsx("div",{className:"ap-lanes",children:J.lanes.length?J.lanes.map(St=>o.jsx(qz,{lane:St,nowSec:T,frozen:kt},St.id)):o.jsx("div",{className:"ap-hint",children:"No usage recorded yet."})}),o.jsx("div",{className:"ap-meta",children:J.fetchedAt?o.jsxs("span",{className:`ap-age${J.stale&&!Ie?" 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 ",Jp(J.fetchedAt,T),Ie!=null&&Ie.blocksSwitch?"":$z(J.nextAt,T)]}):o.jsx("span",{className:"ap-age ap-stale",title:"claude-swap has not read this account yet",children:"never collected"})})]})]},J.num)},Xs=n!=null&&n.ok&&(a!=null&&a.ok)?o.jsxs("div",{className:"ap-policy-block",children:[o.jsxs("div",{className:"ap-policy",children:[o.jsx("h3",{className:"ap-auto-title",children:"Auto-switch"}),o.jsx("span",{className:"ap-field",title:"Switch once the active account passes this much of its limit",children:o.jsx("select",{ref:_e,"aria-label":"Switch threshold",value:pt,...qe("threshold"),onChange:J=>Le(J.target.value),children:Fz(Ue).map(J=>o.jsxs("option",{value:J,children:[J,"%"]},J))})}),(he.sends||Te)&&o.jsx("button",{ref:Se,type:"button",className:"ap-manage-btn",...qe("threshold"),title:he.title,onClick:()=>cr(pt,he),children:Te&&!he.sends?he.done:he.label}),o.jsx("button",{type:"button",className:"switch ap-auto-state",role:"switch","aria-checked":a.enabled,"aria-label":"Auto-switch",...qe("enable"),onClick:()=>ve({action:"enable",enabled:!a.enabled},"enable").then(()=>et(!0)),title:a.enabled?"Stop switching accounts automatically":"Switch accounts automatically when the active one nears its limit",children:o.jsx("span",{className:"switch-knob"})})]}),a.external&&o.jsxs("p",{className:"ap-auto-note",children:[o.jsx("i",{className:"ap-pulse","aria-hidden":!0})," A ",o.jsx("code",{children:"cswap auto"})," loop in your terminal is doing the switching. The deck stands down while it runs",a.enabled?" — this toggle takes over when you stop it.":"."]})]}):null;return o.jsxs("aside",{className:`accounts-panel${t?" leaving":""}`,id:"accounts-panel","aria-label":"Claude accounts",children:[_==="accounts"&&o.jsxs("div",{className:"ap-header",children:[o.jsx("h2",{children:"Claude accounts"}),o.jsxs("div",{className:"ap-header-right",children:[o.jsx("button",{type:"button",className:"glyph-btn ap-add",onClick:()=>Z(!0),"aria-label":"Add an account",title:"Sign in to another Claude account, or paste one shared from another deck",children:o.jsx("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round","aria-hidden":!0,children:o.jsx("path",{d:"M7 2.2v9.6M2.2 7h9.6"})})}),(((yn=n==null?void 0:n.accounts)==null?void 0:yn.length)??0)>0&&o.jsx("button",{type:"button",className:"glyph-btn",onClick:()=>G(!0),"aria-label":"Share accounts with another deck",title:`Copy several accounts to another ${tn} in one paste. The text carries a live login for each one — treat it as those passwords.`,children:o.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[o.jsx("path",{d:"M3.3 10.7L10.7 3.3"}),o.jsx("path",{d:"M5.5 3.3h5.2v5.2"})]})}),o.jsx("button",{type:"button",className:"glyph-btn ap-refresh",onClick:()=>et(!0),...qe("reload",f),"aria-label":"Reload accounts",title:"Reload from claude-swap",children:o.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[o.jsx("path",{d:"M11.6 6.2A4.8 4.8 0 1 0 11 9.6"}),o.jsx("path",{d:"M11.9 2.6v3.7h-3.6"})]})}),Mn]})]}),_==="accounts"&&o.jsx("div",{className:"ap-scroll",id:"ap-scroll",children:n==null?h?o.jsxs("div",{className:"ap-empty",role:"alert",children:[o.jsx("span",{title:h.raw||void 0,children:h.text}),o.jsxs("span",{className:"ap-hint",children:["No accounts have arrived, so there is nothing to show yet. The panel keeps trying every ",C_/1e3," seconds."]}),o.jsx("button",{type:"button",className:"ap-fix",disabled:f,onClick:()=>et(!0),children:f?"trying…":"try again"})]}):o.jsx("div",{className:"ap-empty",children:"Checking…"}):n.ok?o.jsxs(o.Fragment,{children:[mt&&(qt==null?void 0:qt.tone)==="warn"&&o.jsxs("div",{className:"ap-notice",children:[o.jsxs("button",{type:"button",id:"ap-notice",className:"ap-issue","data-tone":"warn","aria-haspopup":"dialog","aria-expanded":(S==null?void 0:S.anchor)==="ap-notice","aria-controls":(S==null?void 0:S.anchor)==="ap-notice"?"ap-issue-pop":void 0,onClick:()=>Gn(mt.num,"ap-notice"),children:[o.jsx(em,{}),o.jsx("span",{className:"ap-issue-text",children:"Current account needs attention"})]}),qt.fix&&o.jsx("button",{type:"button",className:"ap-notice-fix",onClick:()=>Z(!0),title:"Open the sign-in dialog. Signing in as this account replaces its stored login in place.",children:"Sign in"})]}),o.jsx("ul",{className:"ap-list",children:dn.map(Ys)}),jt.length>0&&o.jsx(hz,{peers:Sn,strained:an,armed:ge,threshold:a!=null&&a.ok?Ue:null,open:$e,onToggle:()=>oe(J=>!J)}),jt.length>0&&$e&&o.jsxs("div",{className:"ap-rest-panel",id:"ap-rest-panel",children:[o.jsx("ul",{className:"ap-list ap-others",id:"ap-rest-list",children:jt.map(Ys)}),Xs]}),jt.length===0&&Xs,h&&h.row==null&&o.jsxs("div",{className:"ap-failure",role:"alert",children:[o.jsx("span",{className:"ap-failure-text",title:h.raw||void 0,children:h.text}),o.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>m(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),q&&(()=>{var Ie;const J=(Ie=n.accounts)==null?void 0:Ie.find(Ge=>Ge.num===q.num);if(!J)return null;const Ae=`ap-pop-title-${J.num}`,Fe=K&&o.jsx("p",{className:"ap-pop-error",role:"alert",title:K.raw||void 0,children:K.text});return o.jsxs(e0,{anchorId:`ap-more-${J.num}`,boundaryId:ht(J.num),id:`ap-menu-${J.num}`,className:"ap-pop",role:q.view==="menu"?"menu":"dialog",labelledBy:q.view==="menu"?`ap-more-${J.num}`:Ae,start:q.start,onClose:_t,children:[q.view==="menu"&&o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",role:"menuitem",className:"ap-menu-item",onClick:()=>{$(J.alias??""),X(null),F({num:J.num,view:"rename"})},children:"Rename"}),o.jsx("button",{type:"button",role:"menuitem",className:"ap-menu-item",onClick:()=>{Oe(null),X(null),F({num:J.num,view:"move"})},children:"Move to slot…"}),o.jsx("button",{type:"button",role:"menuitem",className:"ap-menu-item",...qe(`share-${J.num}`),title:`Copy this account to another ${tn}. 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:()=>jn(J.num),children:c===`share-${J.num}`?"Sharing…":"Share"}),o.jsx("button",{type:"button",role:"menuitem",className:"ap-menu-item",title:"See how much this account worked in each project",onClick:()=>{ne(J.num),Yt(J.num)},children:"Projects"}),(((a==null?void 0:a.enabled)||(a==null?void 0:a.external))&&!J.active||J.disabled)&&o.jsx("button",{type:"button",role:"menuitem",className:"ap-menu-item",...qe(`rot-${J.num}`),title:J.disabled?"Return this account to auto-rotation":"Hold this account out of auto-rotation",onClick:()=>ve({action:"account",account:J.num,enabled:J.disabled},`rot-${J.num}`,"menu").then(Ge=>{et(!0),Ge!=null&&Ge.ok&&Yt(J.num)}),children:J.disabled?"Put back in rotation":"Hold out of rotation"}),o.jsx("div",{role:"separator",className:"ap-menu-sep"}),o.jsx("button",{type:"button",role:"menuitem",className:`ap-menu-item danger${z===J.num?" armed":""}`,...qe(`rm-${J.num}`),"aria-label":z===J.num?"Confirm remove":void 0,title:z===J.num?"This deletes the stored credentials for this account":"Remove this account from claude-swap",onClick:()=>{const Ge=Date.now(),yt=ph({armedFor:z,target:J.num,armedAt:V.current,now:Ge,gapMs:yh});if(yt==="arm"){U(J.num),V.current=Ge,window.setTimeout(()=>U(kt=>kt===J.num?null:kt),4e3);return}yt!=="ignore"&&(U(null),Re({action:"remove",account:J.num},`rm-${J.num}`).then(kt=>{var At;et(!0),kt!=null&&kt.ok&&(((At=H.current)==null?void 0:At.num)===J.num&&_t(),rt(null))}))},children:c===`rm-${J.num}`?"Removing…":z===J.num?"Confirm":"Remove"}),Fe]}),q.view==="rename"&&o.jsxs("form",{className:"ap-pop-form",onSubmit:Ge=>{Ge.preventDefault(),Bt(J.num,J.alias)},children:[o.jsx("label",{className:"ap-pop-title",id:Ae,htmlFor:`ap-alias-${J.num}`,children:"Rename account"}),o.jsx("input",{id:`ap-alias-${J.num}`,className:"ap-manage-input",type:"text",value:W,onChange:Ge=>$(Ge.target.value),maxLength:Sz,placeholder:"e.g. work",spellCheck:!1,autoComplete:"off",autoFocus:!0,onFocus:Ge=>Ge.currentTarget.select()}),Fe,o.jsxs("div",{className:"ap-pop-actions",children:[o.jsx("button",{type:"button",className:"btn",onClick:()=>Yt(),children:"Cancel"}),o.jsx("button",{type:"submit",className:"btn primary",...qe(`alias-${J.num}`),title:"A short name to show instead of the email",children:c===`alias-${J.num}`?"…":"Save"})]})]}),q.view==="move"&&(()=>{const Ge=gz((n.accounts??[]).map(At=>At.num),J.num),yt=wz(Ge,je,J.num),kt=vz(Ge,yt,J.num);return o.jsxs("div",{className:"ap-pop-form",children:[o.jsx("label",{className:"ap-pop-title",id:Ae,htmlFor:`ap-slot-${J.num}`,children:"Move to slot"}),o.jsx("span",{className:"ap-field",children:o.jsx("select",{id:`ap-slot-${J.num}`,value:String(yt),...qe(`move-${J.num}`),onChange:At=>Oe(Number(At.target.value)),autoFocus:!0,children:Ge.map(At=>o.jsx("option",{value:At.slot,children:At.label},At.slot))})}),Fe,o.jsxs("div",{className:"ap-pop-actions",children:[o.jsx("button",{type:"button",className:"btn",onClick:()=>Yt(),children:"Cancel"}),o.jsx("button",{type:"button",className:"btn primary",...qe(`move-${J.num}`),title:kt.title,onClick:()=>Kn(J.num,yt,kt),children:c===`move-${J.num}`?"…":Tc(kt.label)})]})]})})(),q.view==="share"&&(B==null?void 0:B.num)===J.num&&(()=>{const Ge=JR(B.expiresAt,T),yt=Ge.tone==="gone";return o.jsxs("div",{className:`ap-pop-form ap-share${yt?" expired":""}`,children:[o.jsx("p",{className:"ap-pop-title",id:Ae,children:"Share account"}),o.jsx("code",{className:"ap-share-blob",children:B.blob}),o.jsxs("p",{className:"ap-pop-note",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:[o.jsx("span",{className:"ap-share-warn",children:"This is the password"})," · ",o.jsx("span",{className:`ap-share-expiry ${Ge.tone}`,children:Ge.text})]}),Fe,o.jsxs("div",{className:"ap-pop-actions",children:[o.jsx("button",{type:"button",className:"btn",onClick:()=>Yt(),children:"Done"}),o.jsx("button",{type:"button",className:"btn primary",...qe(`share-${J.num}`),autoFocus:!0,onClick:async()=>{if(yt){await jn(J.num);return}await Ba(B.blob)&&(L(!0),window.setTimeout(()=>L(!1),1800))},children:yt?"Make a new share":ee?"Copied":"Copy"})]})]})})()]})})(),S&&(()=>{var Fe;const J=(Fe=n.accounts)==null?void 0:Fe.find(Ie=>Ie.num===S.num),Ae=J?Dd(J,T):null;return!J||!Ae?null:o.jsx(e0,{anchorId:S.anchor,boundaryId:S.anchor==="ap-notice"?"ap-scroll":ht(J.num),id:"ap-issue-pop",className:"ap-pop ap-issue-pop",role:"dialog",labelledBy:"ap-issue-title",onClose:()=>Et(),children:o.jsxs("div",{className:"ap-pop-form",children:[o.jsxs("p",{className:"ap-pop-title ap-issue-title",id:"ap-issue-title","data-tone":Ae.tone,children:[Ae.tone==="warn"&&o.jsx(em,{}),Ae.text]}),o.jsx("p",{className:"ap-pop-note ap-issue-hint",children:Ae.hint}),o.jsxs("p",{className:"ap-pop-note ap-issue-when",children:[o.jsx("span",{className:"ap-issue-who",children:J.alias??J.email??`account ${J.num}`})," · ",J.fetchedAt?`last collected ${Jp(J.fetchedAt,T)}`:"never collected"]}),o.jsxs("div",{className:"ap-pop-actions",children:[o.jsx("button",{type:"button",className:"btn",onClick:()=>Et(!0),children:"Done"}),Ae.fix&&o.jsx("button",{type:"button",className:"btn primary",onClick:()=>{Et(!0),Z(!0)},title:"Open the sign-in dialog. Signing in as this account puts its login back in this slot — it keeps its slot, its alias and its history.",children:Ae.fix})]})]})})})()]}):o.jsx("div",{className:"ap-empty",children:n.reason==="no_cswap"?o.jsxs(o.Fragment,{children:[o.jsx("span",{children:"claude-swap isn't installed."}),o.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."}),n.hint&&o.jsx("code",{className:"ap-cmd",children:n.hint}),o.jsxs("span",{className:"ap-hint",children:["Then add an account with the ",o.jsx("strong",{children:"+"})," button above."]})]}):n.reason==="no_accounts"?o.jsxs(o.Fragment,{children:[o.jsx("span",{children:"No accounts added yet."}),o.jsxs("span",{className:"ap-hint",children:["claude-swap is installed but has nothing in its store. Use the ",o.jsx("strong",{children:"+"})," above to sign one in, or to paste one shared from another deck."]})]}):o.jsxs(o.Fragment,{children:[o.jsx("span",{children:"Couldn't read the account store."}),o.jsxs("span",{className:"ap-hint",children:["claude-swap is installed, but its store could not be read",n.reason?` (${n.reason})`:"","."]})]})})}),o.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:y?`Now active: ${y.name}`:""}),j&&o.jsx(uz,{accounts:((n==null?void 0:n.accounts)??[]).map(J=>({key:`${String(J.email??"").trim().toLowerCase()}@@${J.orgUuid??""}`,email:J.email??"",alive:J.alive===!0})),onChanged:()=>et(!0),view:_==="lan",onOpen:lr,onBack:()=>k("accounts"),closeButton:Mn}),I&&o.jsx(iB,{onClose:()=>Z(!1),onChanged:()=>et(!0)}),ue&&o.jsx(mz,{accounts:((n==null?void 0:n.accounts)??[]).map(J=>({num:J.num,email:J.email,alias:J.alias,org:J.org})),onClose:()=>G(!1),copyText:Ba}),te!=null&&(()=>{const J=((n==null?void 0:n.accounts)??[]).find(Ae=>Ae.num===te);return J?o.jsx(j8,{num:J.num,name:J.alias??J.email??`account ${J.num}`,onClose:()=>ne(null)}):(ne(null),null)})()]})}const zz=3e4;function Hz({bundle:e,running:t,lastTried:n}){return!t||e===t?!1:n!==t}function Uz({bundle:e,running:t,pending:n,lastTried:r}){return t?Hz({bundle:e,running:t,lastTried:r})?"reload":n==null||n&&n!==t?"wait":"confirm":"wait"}function Wz(e){return!e||e.state!=="failed"?null:`${typeof e.at=="number"?e.at:0}:${e.error??""}`}function Vz({asked:e,reported:t}){return t?t!==e:!1}function lM(e){const t=e.thresholdMs??zz;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 Gz(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 Kz(e,t){return e?t==null?"auto when idle":`auto in ${Gz(t)}`:"auto-restart off"}function T_(e){let t=0;for(const n of e)n.state==="active"&&t++;return t}function Yz(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 Xz(e){const t=lM(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}}function sb(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 tm,A_;function Zz(){if(A_)return tm;A_=1;function e(){this.__data__=[],this.size=0}return tm=e,tm}var nm,R_;function yl(){if(R_)return nm;R_=1;function e(t,n){return t===n||t!==t&&n!==n}return nm=e,nm}var rm,M_;function Hh(){if(M_)return rm;M_=1;var e=yl();function t(n,r){for(var a=n.length;a--;)if(e(n[a][0],r))return a;return-1}return rm=t,rm}var sm,I_;function Qz(){if(I_)return sm;I_=1;var e=Hh(),t=Array.prototype,n=t.splice;function r(a){var l=this.__data__,c=e(l,a);if(c<0)return!1;var u=l.length-1;return c==u?l.pop():n.call(l,c,1),--this.size,!0}return sm=r,sm}var am,$_;function Jz(){if($_)return am;$_=1;var e=Hh();function t(n){var r=this.__data__,a=e(r,n);return a<0?void 0:r[a][1]}return am=t,am}var om,O_;function eH(){if(O_)return om;O_=1;var e=Hh();function t(n){return e(this.__data__,n)>-1}return om=t,om}var im,L_;function tH(){if(L_)return im;L_=1;var e=Hh();function t(n,r){var a=this.__data__,l=e(a,n);return l<0?(++this.size,a.push([n,r])):a[l][1]=r,this}return im=t,im}var lm,P_;function Uh(){if(P_)return lm;P_=1;var e=Zz(),t=Qz(),n=Jz(),r=eH(),a=tH();function l(c){var u=-1,f=c==null?0:c.length;for(this.clear();++u<f;){var p=c[u];this.set(p[0],p[1])}}return l.prototype.clear=e,l.prototype.delete=t,l.prototype.get=n,l.prototype.has=r,l.prototype.set=a,lm=l,lm}var cm,D_;function nH(){if(D_)return cm;D_=1;var e=Uh();function t(){this.__data__=new e,this.size=0}return cm=t,cm}var um,F_;function rH(){if(F_)return um;F_=1;function e(t){var n=this.__data__,r=n.delete(t);return this.size=n.size,r}return um=e,um}var dm,q_;function sH(){if(q_)return dm;q_=1;function e(t){return this.__data__.get(t)}return dm=e,dm}var hm,B_;function aH(){if(B_)return hm;B_=1;function e(t){return this.__data__.has(t)}return hm=e,hm}var fm,z_;function cM(){if(z_)return fm;z_=1;var e=typeof vd=="object"&&vd&&vd.Object===Object&&vd;return fm=e,fm}var pm,H_;function Yr(){if(H_)return pm;H_=1;var e=cM(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return pm=n,pm}var mm,U_;function wl(){if(U_)return mm;U_=1;var e=Yr(),t=e.Symbol;return mm=t,mm}var gm,W_;function oH(){if(W_)return gm;W_=1;var e=wl(),t=Object.prototype,n=t.hasOwnProperty,r=t.toString,a=e?e.toStringTag:void 0;function l(c){var u=n.call(c,a),f=c[a];try{c[a]=void 0;var p=!0}catch{}var h=r.call(c);return p&&(u?c[a]=f:delete c[a]),h}return gm=l,gm}var ym,V_;function iH(){if(V_)return ym;V_=1;var e=Object.prototype,t=e.toString;function n(r){return t.call(r)}return ym=n,ym}var wm,G_;function Vo(){if(G_)return wm;G_=1;var e=wl(),t=oH(),n=iH(),r="[object Null]",a="[object Undefined]",l=e?e.toStringTag:void 0;function c(u){return u==null?u===void 0?a:r:l&&l in Object(u)?t(u):n(u)}return wm=c,wm}var vm,K_;function _r(){if(K_)return vm;K_=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return vm=e,vm}var xm,Y_;function ou(){if(Y_)return xm;Y_=1;var e=Vo(),t=_r(),n="[object AsyncFunction]",r="[object Function]",a="[object GeneratorFunction]",l="[object Proxy]";function c(u){if(!t(u))return!1;var f=e(u);return f==r||f==a||f==n||f==l}return xm=c,xm}var bm,X_;function lH(){if(X_)return bm;X_=1;var e=Yr(),t=e["__core-js_shared__"];return bm=t,bm}var km,Z_;function cH(){if(Z_)return km;Z_=1;var e=lH(),t=(function(){var r=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""})();function n(r){return!!t&&t in r}return km=n,km}var Nm,Q_;function uM(){if(Q_)return Nm;Q_=1;var e=Function.prototype,t=e.toString;function n(r){if(r!=null){try{return t.call(r)}catch{}try{return r+""}catch{}}return""}return Nm=n,Nm}var _m,J_;function uH(){if(J_)return _m;J_=1;var e=ou(),t=cH(),n=_r(),r=uM(),a=/[\\^$.*+?()[\]{}|]/g,l=/^\[object .+?Constructor\]$/,c=Function.prototype,u=Object.prototype,f=c.toString,p=u.hasOwnProperty,h=RegExp("^"+f.call(p).replace(a,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function m(y){if(!n(y)||t(y))return!1;var w=e(y)?h:l;return w.test(r(y))}return _m=m,_m}var Sm,eS;function dH(){if(eS)return Sm;eS=1;function e(t,n){return t==null?void 0:t[n]}return Sm=e,Sm}var jm,tS;function Go(){if(tS)return jm;tS=1;var e=uH(),t=dH();function n(r,a){var l=t(r,a);return e(l)?l:void 0}return jm=n,jm}var Em,nS;function ab(){if(nS)return Em;nS=1;var e=Go(),t=Yr(),n=e(t,"Map");return Em=n,Em}var Cm,rS;function Wh(){if(rS)return Cm;rS=1;var e=Go(),t=e(Object,"create");return Cm=t,Cm}var Tm,sS;function hH(){if(sS)return Tm;sS=1;var e=Wh();function t(){this.__data__=e?e(null):{},this.size=0}return Tm=t,Tm}var Am,aS;function fH(){if(aS)return Am;aS=1;function e(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}return Am=e,Am}var Rm,oS;function pH(){if(oS)return Rm;oS=1;var e=Wh(),t="__lodash_hash_undefined__",n=Object.prototype,r=n.hasOwnProperty;function a(l){var c=this.__data__;if(e){var u=c[l];return u===t?void 0:u}return r.call(c,l)?c[l]:void 0}return Rm=a,Rm}var Mm,iS;function mH(){if(iS)return Mm;iS=1;var e=Wh(),t=Object.prototype,n=t.hasOwnProperty;function r(a){var l=this.__data__;return e?l[a]!==void 0:n.call(l,a)}return Mm=r,Mm}var Im,lS;function gH(){if(lS)return Im;lS=1;var e=Wh(),t="__lodash_hash_undefined__";function n(r,a){var l=this.__data__;return this.size+=this.has(r)?0:1,l[r]=e&&a===void 0?t:a,this}return Im=n,Im}var $m,cS;function yH(){if(cS)return $m;cS=1;var e=hH(),t=fH(),n=pH(),r=mH(),a=gH();function l(c){var u=-1,f=c==null?0:c.length;for(this.clear();++u<f;){var p=c[u];this.set(p[0],p[1])}}return l.prototype.clear=e,l.prototype.delete=t,l.prototype.get=n,l.prototype.has=r,l.prototype.set=a,$m=l,$m}var Om,uS;function wH(){if(uS)return Om;uS=1;var e=yH(),t=Uh(),n=ab();function r(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return Om=r,Om}var Lm,dS;function vH(){if(dS)return Lm;dS=1;function e(t){var n=typeof t;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?t!=="__proto__":t===null}return Lm=e,Lm}var Pm,hS;function Vh(){if(hS)return Pm;hS=1;var e=vH();function t(n,r){var a=n.__data__;return e(r)?a[typeof r=="string"?"string":"hash"]:a.map}return Pm=t,Pm}var Dm,fS;function xH(){if(fS)return Dm;fS=1;var e=Vh();function t(n){var r=e(this,n).delete(n);return this.size-=r?1:0,r}return Dm=t,Dm}var Fm,pS;function bH(){if(pS)return Fm;pS=1;var e=Vh();function t(n){return e(this,n).get(n)}return Fm=t,Fm}var qm,mS;function kH(){if(mS)return qm;mS=1;var e=Vh();function t(n){return e(this,n).has(n)}return qm=t,qm}var Bm,gS;function NH(){if(gS)return Bm;gS=1;var e=Vh();function t(n,r){var a=e(this,n),l=a.size;return a.set(n,r),this.size+=a.size==l?0:1,this}return Bm=t,Bm}var zm,yS;function ob(){if(yS)return zm;yS=1;var e=wH(),t=xH(),n=bH(),r=kH(),a=NH();function l(c){var u=-1,f=c==null?0:c.length;for(this.clear();++u<f;){var p=c[u];this.set(p[0],p[1])}}return l.prototype.clear=e,l.prototype.delete=t,l.prototype.get=n,l.prototype.has=r,l.prototype.set=a,zm=l,zm}var Hm,wS;function _H(){if(wS)return Hm;wS=1;var e=Uh(),t=ab(),n=ob(),r=200;function a(l,c){var u=this.__data__;if(u instanceof e){var f=u.__data__;if(!t||f.length<r-1)return f.push([l,c]),this.size=++u.size,this;u=this.__data__=new n(f)}return u.set(l,c),this.size=u.size,this}return Hm=a,Hm}var Um,vS;function Gh(){if(vS)return Um;vS=1;var e=Uh(),t=nH(),n=rH(),r=sH(),a=aH(),l=_H();function c(u){var f=this.__data__=new e(u);this.size=f.size}return c.prototype.clear=t,c.prototype.delete=n,c.prototype.get=r,c.prototype.has=a,c.prototype.set=l,Um=c,Um}var Wm,xS;function ib(){if(xS)return Wm;xS=1;function e(t,n){for(var r=-1,a=t==null?0:t.length;++r<a&&n(t[r],r,t)!==!1;);return t}return Wm=e,Wm}var Vm,bS;function dM(){if(bS)return Vm;bS=1;var e=Go(),t=(function(){try{var n=e(Object,"defineProperty");return n({},"",{}),n}catch{}})();return Vm=t,Vm}var Gm,kS;function Kh(){if(kS)return Gm;kS=1;var e=dM();function t(n,r,a){r=="__proto__"&&e?e(n,r,{configurable:!0,enumerable:!0,value:a,writable:!0}):n[r]=a}return Gm=t,Gm}var Km,NS;function Yh(){if(NS)return Km;NS=1;var e=Kh(),t=yl(),n=Object.prototype,r=n.hasOwnProperty;function a(l,c,u){var f=l[c];(!(r.call(l,c)&&t(f,u))||u===void 0&&!(c in l))&&e(l,c,u)}return Km=a,Km}var Ym,_S;function iu(){if(_S)return Ym;_S=1;var e=Yh(),t=Kh();function n(r,a,l,c){var u=!l;l||(l={});for(var f=-1,p=a.length;++f<p;){var h=a[f],m=c?c(l[h],r[h],h,l,r):void 0;m===void 0&&(m=r[h]),u?t(l,h,m):e(l,h,m)}return l}return Ym=n,Ym}var Xm,SS;function SH(){if(SS)return Xm;SS=1;function e(t,n){for(var r=-1,a=Array(t);++r<t;)a[r]=n(r);return a}return Xm=e,Xm}var Zm,jS;function gs(){if(jS)return Zm;jS=1;function e(t){return t!=null&&typeof t=="object"}return Zm=e,Zm}var Qm,ES;function jH(){if(ES)return Qm;ES=1;var e=Vo(),t=gs(),n="[object Arguments]";function r(a){return t(a)&&e(a)==n}return Qm=r,Qm}var Jm,CS;function lu(){if(CS)return Jm;CS=1;var e=jH(),t=gs(),n=Object.prototype,r=n.hasOwnProperty,a=n.propertyIsEnumerable,l=e((function(){return arguments})())?e:function(c){return t(c)&&r.call(c,"callee")&&!a.call(c,"callee")};return Jm=l,Jm}var eg,TS;function Gt(){if(TS)return eg;TS=1;var e=Array.isArray;return eg=e,eg}var Ac={exports:{}},tg,AS;function EH(){if(AS)return tg;AS=1;function e(){return!1}return tg=e,tg}Ac.exports;var RS;function vl(){return RS||(RS=1,(function(e,t){var n=Yr(),r=EH(),a=t&&!t.nodeType&&t,l=a&&!0&&e&&!e.nodeType&&e,c=l&&l.exports===a,u=c?n.Buffer:void 0,f=u?u.isBuffer:void 0,p=f||r;e.exports=p})(Ac,Ac.exports)),Ac.exports}var ng,MS;function Xh(){if(MS)return ng;MS=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function n(r,a){var l=typeof r;return a=a??e,!!a&&(l=="number"||l!="symbol"&&t.test(r))&&r>-1&&r%1==0&&r<a}return ng=n,ng}var rg,IS;function lb(){if(IS)return rg;IS=1;var e=9007199254740991;function t(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=e}return rg=t,rg}var sg,$S;function CH(){if($S)return sg;$S=1;var e=Vo(),t=lb(),n=gs(),r="[object Arguments]",a="[object Array]",l="[object Boolean]",c="[object Date]",u="[object Error]",f="[object Function]",p="[object Map]",h="[object Number]",m="[object Object]",y="[object RegExp]",w="[object Set]",_="[object String]",k="[object WeakMap]",j="[object ArrayBuffer]",b="[object DataView]",S="[object Float32Array]",E="[object Float64Array]",C="[object Int8Array]",T="[object Int16Array]",R="[object Int32Array]",A="[object Uint8Array]",q="[object Uint8ClampedArray]",F="[object Uint16Array]",O="[object Uint32Array]",H={};H[S]=H[E]=H[C]=H[T]=H[R]=H[A]=H[q]=H[F]=H[O]=!0,H[r]=H[a]=H[j]=H[l]=H[b]=H[c]=H[u]=H[f]=H[p]=H[h]=H[m]=H[y]=H[w]=H[_]=H[k]=!1;function K(X){return n(X)&&t(X.length)&&!!H[e(X)]}return sg=K,sg}var ag,OS;function Zh(){if(OS)return ag;OS=1;function e(t){return function(n){return t(n)}}return ag=e,ag}var Rc={exports:{}};Rc.exports;var LS;function cb(){return LS||(LS=1,(function(e,t){var n=cM(),r=t&&!t.nodeType&&t,a=r&&!0&&e&&!e.nodeType&&e,l=a&&a.exports===r,c=l&&n.process,u=(function(){try{var f=a&&a.require&&a.require("util").types;return f||c&&c.binding&&c.binding("util")}catch{}})();e.exports=u})(Rc,Rc.exports)),Rc.exports}var og,PS;function cu(){if(PS)return og;PS=1;var e=CH(),t=Zh(),n=cb(),r=n&&n.isTypedArray,a=r?t(r):e;return og=a,og}var ig,DS;function hM(){if(DS)return ig;DS=1;var e=SH(),t=lu(),n=Gt(),r=vl(),a=Xh(),l=cu(),c=Object.prototype,u=c.hasOwnProperty;function f(p,h){var m=n(p),y=!m&&t(p),w=!m&&!y&&r(p),_=!m&&!y&&!w&&l(p),k=m||y||w||_,j=k?e(p.length,String):[],b=j.length;for(var S in p)(h||u.call(p,S))&&!(k&&(S=="length"||w&&(S=="offset"||S=="parent")||_&&(S=="buffer"||S=="byteLength"||S=="byteOffset")||a(S,b)))&&j.push(S);return j}return ig=f,ig}var lg,FS;function Qh(){if(FS)return lg;FS=1;var e=Object.prototype;function t(n){var r=n&&n.constructor,a=typeof r=="function"&&r.prototype||e;return n===a}return lg=t,lg}var cg,qS;function fM(){if(qS)return cg;qS=1;function e(t,n){return function(r){return t(n(r))}}return cg=e,cg}var ug,BS;function TH(){if(BS)return ug;BS=1;var e=fM(),t=e(Object.keys,Object);return ug=t,ug}var dg,zS;function ub(){if(zS)return dg;zS=1;var e=Qh(),t=TH(),n=Object.prototype,r=n.hasOwnProperty;function a(l){if(!e(l))return t(l);var c=[];for(var u in Object(l))r.call(l,u)&&u!="constructor"&&c.push(u);return c}return dg=a,dg}var hg,HS;function Gs(){if(HS)return hg;HS=1;var e=ou(),t=lb();function n(r){return r!=null&&t(r.length)&&!e(r)}return hg=n,hg}var fg,US;function Ha(){if(US)return fg;US=1;var e=hM(),t=ub(),n=Gs();function r(a){return n(a)?e(a):t(a)}return fg=r,fg}var pg,WS;function AH(){if(WS)return pg;WS=1;var e=iu(),t=Ha();function n(r,a){return r&&e(a,t(a),r)}return pg=n,pg}var mg,VS;function RH(){if(VS)return mg;VS=1;function e(t){var n=[];if(t!=null)for(var r in Object(t))n.push(r);return n}return mg=e,mg}var gg,GS;function MH(){if(GS)return gg;GS=1;var e=_r(),t=Qh(),n=RH(),r=Object.prototype,a=r.hasOwnProperty;function l(c){if(!e(c))return n(c);var u=t(c),f=[];for(var p in c)p=="constructor"&&(u||!a.call(c,p))||f.push(p);return f}return gg=l,gg}var yg,KS;function Ko(){if(KS)return yg;KS=1;var e=hM(),t=MH(),n=Gs();function r(a){return n(a)?e(a,!0):t(a)}return yg=r,yg}var wg,YS;function IH(){if(YS)return wg;YS=1;var e=iu(),t=Ko();function n(r,a){return r&&e(a,t(a),r)}return wg=n,wg}var Mc={exports:{}};Mc.exports;var XS;function pM(){return XS||(XS=1,(function(e,t){var n=Yr(),r=t&&!t.nodeType&&t,a=r&&!0&&e&&!e.nodeType&&e,l=a&&a.exports===r,c=l?n.Buffer:void 0,u=c?c.allocUnsafe:void 0;function f(p,h){if(h)return p.slice();var m=p.length,y=u?u(m):new p.constructor(m);return p.copy(y),y}e.exports=f})(Mc,Mc.exports)),Mc.exports}var vg,ZS;function mM(){if(ZS)return vg;ZS=1;function e(t,n){var r=-1,a=t.length;for(n||(n=Array(a));++r<a;)n[r]=t[r];return n}return vg=e,vg}var xg,QS;function gM(){if(QS)return xg;QS=1;function e(t,n){for(var r=-1,a=t==null?0:t.length,l=0,c=[];++r<a;){var u=t[r];n(u,r,t)&&(c[l++]=u)}return c}return xg=e,xg}var bg,JS;function yM(){if(JS)return bg;JS=1;function e(){return[]}return bg=e,bg}var kg,ej;function db(){if(ej)return kg;ej=1;var e=gM(),t=yM(),n=Object.prototype,r=n.propertyIsEnumerable,a=Object.getOwnPropertySymbols,l=a?function(c){return c==null?[]:(c=Object(c),e(a(c),function(u){return r.call(c,u)}))}:t;return kg=l,kg}var Ng,tj;function $H(){if(tj)return Ng;tj=1;var e=iu(),t=db();function n(r,a){return e(r,t(r),a)}return Ng=n,Ng}var _g,nj;function hb(){if(nj)return _g;nj=1;function e(t,n){for(var r=-1,a=n.length,l=t.length;++r<a;)t[l+r]=n[r];return t}return _g=e,_g}var Sg,rj;function Jh(){if(rj)return Sg;rj=1;var e=fM(),t=e(Object.getPrototypeOf,Object);return Sg=t,Sg}var jg,sj;function wM(){if(sj)return jg;sj=1;var e=hb(),t=Jh(),n=db(),r=yM(),a=Object.getOwnPropertySymbols,l=a?function(c){for(var u=[];c;)e(u,n(c)),c=t(c);return u}:r;return jg=l,jg}var Eg,aj;function OH(){if(aj)return Eg;aj=1;var e=iu(),t=wM();function n(r,a){return e(r,t(r),a)}return Eg=n,Eg}var Cg,oj;function vM(){if(oj)return Cg;oj=1;var e=hb(),t=Gt();function n(r,a,l){var c=a(r);return t(r)?c:e(c,l(r))}return Cg=n,Cg}var Tg,ij;function xM(){if(ij)return Tg;ij=1;var e=vM(),t=db(),n=Ha();function r(a){return e(a,n,t)}return Tg=r,Tg}var Ag,lj;function LH(){if(lj)return Ag;lj=1;var e=vM(),t=wM(),n=Ko();function r(a){return e(a,n,t)}return Ag=r,Ag}var Rg,cj;function PH(){if(cj)return Rg;cj=1;var e=Go(),t=Yr(),n=e(t,"DataView");return Rg=n,Rg}var Mg,uj;function DH(){if(uj)return Mg;uj=1;var e=Go(),t=Yr(),n=e(t,"Promise");return Mg=n,Mg}var Ig,dj;function bM(){if(dj)return Ig;dj=1;var e=Go(),t=Yr(),n=e(t,"Set");return Ig=n,Ig}var $g,hj;function FH(){if(hj)return $g;hj=1;var e=Go(),t=Yr(),n=e(t,"WeakMap");return $g=n,$g}var Og,fj;function xl(){if(fj)return Og;fj=1;var e=PH(),t=ab(),n=DH(),r=bM(),a=FH(),l=Vo(),c=uM(),u="[object Map]",f="[object Object]",p="[object Promise]",h="[object Set]",m="[object WeakMap]",y="[object DataView]",w=c(e),_=c(t),k=c(n),j=c(r),b=c(a),S=l;return(e&&S(new e(new ArrayBuffer(1)))!=y||t&&S(new t)!=u||n&&S(n.resolve())!=p||r&&S(new r)!=h||a&&S(new a)!=m)&&(S=function(E){var C=l(E),T=C==f?E.constructor:void 0,R=T?c(T):"";if(R)switch(R){case w:return y;case _:return u;case k:return p;case j:return h;case b:return m}return C}),Og=S,Og}var Lg,pj;function qH(){if(pj)return Lg;pj=1;var e=Object.prototype,t=e.hasOwnProperty;function n(r){var a=r.length,l=new r.constructor(a);return a&&typeof r[0]=="string"&&t.call(r,"index")&&(l.index=r.index,l.input=r.input),l}return Lg=n,Lg}var Pg,mj;function kM(){if(mj)return Pg;mj=1;var e=Yr(),t=e.Uint8Array;return Pg=t,Pg}var Dg,gj;function fb(){if(gj)return Dg;gj=1;var e=kM();function t(n){var r=new n.constructor(n.byteLength);return new e(r).set(new e(n)),r}return Dg=t,Dg}var Fg,yj;function BH(){if(yj)return Fg;yj=1;var e=fb();function t(n,r){var a=r?e(n.buffer):n.buffer;return new n.constructor(a,n.byteOffset,n.byteLength)}return Fg=t,Fg}var qg,wj;function zH(){if(wj)return qg;wj=1;var e=/\w*$/;function t(n){var r=new n.constructor(n.source,e.exec(n));return r.lastIndex=n.lastIndex,r}return qg=t,qg}var Bg,vj;function HH(){if(vj)return Bg;vj=1;var e=wl(),t=e?e.prototype:void 0,n=t?t.valueOf:void 0;function r(a){return n?Object(n.call(a)):{}}return Bg=r,Bg}var zg,xj;function NM(){if(xj)return zg;xj=1;var e=fb();function t(n,r){var a=r?e(n.buffer):n.buffer;return new n.constructor(a,n.byteOffset,n.length)}return zg=t,zg}var Hg,bj;function UH(){if(bj)return Hg;bj=1;var e=fb(),t=BH(),n=zH(),r=HH(),a=NM(),l="[object Boolean]",c="[object Date]",u="[object Map]",f="[object Number]",p="[object RegExp]",h="[object Set]",m="[object String]",y="[object Symbol]",w="[object ArrayBuffer]",_="[object DataView]",k="[object Float32Array]",j="[object Float64Array]",b="[object Int8Array]",S="[object Int16Array]",E="[object Int32Array]",C="[object Uint8Array]",T="[object Uint8ClampedArray]",R="[object Uint16Array]",A="[object Uint32Array]";function q(F,O,H){var K=F.constructor;switch(O){case w:return e(F);case l:case c:return new K(+F);case _:return t(F,H);case k:case j:case b:case S:case E:case C:case T:case R:case A:return a(F,H);case u:return new K;case f:case m:return new K(F);case p:return n(F);case h:return new K;case y:return r(F)}}return Hg=q,Hg}var Ug,kj;function _M(){if(kj)return Ug;kj=1;var e=_r(),t=Object.create,n=(function(){function r(){}return function(a){if(!e(a))return{};if(t)return t(a);r.prototype=a;var l=new r;return r.prototype=void 0,l}})();return Ug=n,Ug}var Wg,Nj;function SM(){if(Nj)return Wg;Nj=1;var e=_M(),t=Jh(),n=Qh();function r(a){return typeof a.constructor=="function"&&!n(a)?e(t(a)):{}}return Wg=r,Wg}var Vg,_j;function WH(){if(_j)return Vg;_j=1;var e=xl(),t=gs(),n="[object Map]";function r(a){return t(a)&&e(a)==n}return Vg=r,Vg}var Gg,Sj;function VH(){if(Sj)return Gg;Sj=1;var e=WH(),t=Zh(),n=cb(),r=n&&n.isMap,a=r?t(r):e;return Gg=a,Gg}var Kg,jj;function GH(){if(jj)return Kg;jj=1;var e=xl(),t=gs(),n="[object Set]";function r(a){return t(a)&&e(a)==n}return Kg=r,Kg}var Yg,Ej;function KH(){if(Ej)return Yg;Ej=1;var e=GH(),t=Zh(),n=cb(),r=n&&n.isSet,a=r?t(r):e;return Yg=a,Yg}var Xg,Cj;function jM(){if(Cj)return Xg;Cj=1;var e=Gh(),t=ib(),n=Yh(),r=AH(),a=IH(),l=pM(),c=mM(),u=$H(),f=OH(),p=xM(),h=LH(),m=xl(),y=qH(),w=UH(),_=SM(),k=Gt(),j=vl(),b=VH(),S=_r(),E=KH(),C=Ha(),T=Ko(),R=1,A=2,q=4,F="[object Arguments]",O="[object Array]",H="[object Boolean]",K="[object Date]",X="[object Error]",I="[object Function]",Z="[object GeneratorFunction]",W="[object Map]",$="[object Number]",z="[object Object]",U="[object RegExp]",V="[object Set]",B="[object String]",Y="[object Symbol]",ue="[object WeakMap]",G="[object ArrayBuffer]",ee="[object DataView]",L="[object Float32Array]",te="[object Float64Array]",ne="[object Int8Array]",ie="[object Int16Array]",me="[object Int32Array]",je="[object Uint8Array]",Oe="[object Uint8ClampedArray]",Ve="[object Uint16Array]",Le="[object Uint32Array]",Te={};Te[F]=Te[O]=Te[G]=Te[ee]=Te[H]=Te[K]=Te[L]=Te[te]=Te[ne]=Te[ie]=Te[me]=Te[W]=Te[$]=Te[z]=Te[U]=Te[V]=Te[B]=Te[Y]=Te[je]=Te[Oe]=Te[Ve]=Te[Le]=!0,Te[X]=Te[I]=Te[ue]=!1;function nt(_e,Se,Xe,ot,$e,oe){var ye,Ce=Se&R,De=Se&A,qe=Se&q;if(Xe&&(ye=$e?Xe(_e,ot,$e,oe):Xe(_e)),ye!==void 0)return ye;if(!S(_e))return _e;var rt=k(_e);if(rt){if(ye=y(_e),!Ce)return c(_e,ye)}else{var et=m(_e),ve=et==I||et==Z;if(j(_e))return l(_e,Ce);if(et==z||et==F||ve&&!$e){if(ye=De||ve?{}:_(_e),!Ce)return De?f(_e,a(ye,_e)):u(_e,r(ye,_e))}else{if(!Te[et])return $e?_e:{};ye=w(_e,et,Ce)}}oe||(oe=new e);var Re=oe.get(_e);if(Re)return Re;oe.set(_e,ye),E(_e)?_e.forEach(function(he){ye.add(nt(he,Se,Xe,he,_e,oe))}):b(_e)&&_e.forEach(function(he,mt){ye.set(mt,nt(he,Se,Xe,mt,_e,oe))});var Ue=qe?De?h:p:De?T:C,pt=rt?void 0:Ue(_e);return t(pt||_e,function(he,mt){pt&&(mt=he,he=_e[mt]),n(ye,mt,nt(he,Se,Xe,mt,_e,oe))}),ye}return Xg=nt,Xg}var Zg,Tj;function YH(){if(Tj)return Zg;Tj=1;var e=jM(),t=4;function n(r){return e(r,t)}return Zg=n,Zg}var Qg,Aj;function pb(){if(Aj)return Qg;Aj=1;function e(t){return function(){return t}}return Qg=e,Qg}var Jg,Rj;function XH(){if(Rj)return Jg;Rj=1;function e(t){return function(n,r,a){for(var l=-1,c=Object(n),u=a(n),f=u.length;f--;){var p=u[t?f:++l];if(r(c[p],p,c)===!1)break}return n}}return Jg=e,Jg}var ey,Mj;function mb(){if(Mj)return ey;Mj=1;var e=XH(),t=e();return ey=t,ey}var ty,Ij;function gb(){if(Ij)return ty;Ij=1;var e=mb(),t=Ha();function n(r,a){return r&&e(r,a,t)}return ty=n,ty}var ny,$j;function ZH(){if($j)return ny;$j=1;var e=Gs();function t(n,r){return function(a,l){if(a==null)return a;if(!e(a))return n(a,l);for(var c=a.length,u=r?c:-1,f=Object(a);(r?u--:++u<c)&&l(f[u],u,f)!==!1;);return a}}return ny=t,ny}var ry,Oj;function ef(){if(Oj)return ry;Oj=1;var e=gb(),t=ZH(),n=t(e);return ry=n,ry}var sy,Lj;function Yo(){if(Lj)return sy;Lj=1;function e(t){return t}return sy=e,sy}var ay,Pj;function EM(){if(Pj)return ay;Pj=1;var e=Yo();function t(n){return typeof n=="function"?n:e}return ay=t,ay}var oy,Dj;function CM(){if(Dj)return oy;Dj=1;var e=ib(),t=ef(),n=EM(),r=Gt();function a(l,c){var u=r(l)?e:t;return u(l,n(c))}return oy=a,oy}var iy,Fj;function TM(){return Fj||(Fj=1,iy=CM()),iy}var ly,qj;function QH(){if(qj)return ly;qj=1;var e=ef();function t(n,r){var a=[];return e(n,function(l,c,u){r(l,c,u)&&a.push(l)}),a}return ly=t,ly}var cy,Bj;function JH(){if(Bj)return cy;Bj=1;var e="__lodash_hash_undefined__";function t(n){return this.__data__.set(n,e),this}return cy=t,cy}var uy,zj;function eU(){if(zj)return uy;zj=1;function e(t){return this.__data__.has(t)}return uy=e,uy}var dy,Hj;function AM(){if(Hj)return dy;Hj=1;var e=ob(),t=JH(),n=eU();function r(a){var l=-1,c=a==null?0:a.length;for(this.__data__=new e;++l<c;)this.add(a[l])}return r.prototype.add=r.prototype.push=t,r.prototype.has=n,dy=r,dy}var hy,Uj;function tU(){if(Uj)return hy;Uj=1;function e(t,n){for(var r=-1,a=t==null?0:t.length;++r<a;)if(n(t[r],r,t))return!0;return!1}return hy=e,hy}var fy,Wj;function RM(){if(Wj)return fy;Wj=1;function e(t,n){return t.has(n)}return fy=e,fy}var py,Vj;function MM(){if(Vj)return py;Vj=1;var e=AM(),t=tU(),n=RM(),r=1,a=2;function l(c,u,f,p,h,m){var y=f&r,w=c.length,_=u.length;if(w!=_&&!(y&&_>w))return!1;var k=m.get(c),j=m.get(u);if(k&&j)return k==u&&j==c;var b=-1,S=!0,E=f&a?new e:void 0;for(m.set(c,u),m.set(u,c);++b<w;){var C=c[b],T=u[b];if(p)var R=y?p(T,C,b,u,c,m):p(C,T,b,c,u,m);if(R!==void 0){if(R)continue;S=!1;break}if(E){if(!t(u,function(A,q){if(!n(E,q)&&(C===A||h(C,A,f,p,m)))return E.push(q)})){S=!1;break}}else if(!(C===T||h(C,T,f,p,m))){S=!1;break}}return m.delete(c),m.delete(u),S}return py=l,py}var my,Gj;function nU(){if(Gj)return my;Gj=1;function e(t){var n=-1,r=Array(t.size);return t.forEach(function(a,l){r[++n]=[l,a]}),r}return my=e,my}var gy,Kj;function yb(){if(Kj)return gy;Kj=1;function e(t){var n=-1,r=Array(t.size);return t.forEach(function(a){r[++n]=a}),r}return gy=e,gy}var yy,Yj;function rU(){if(Yj)return yy;Yj=1;var e=wl(),t=kM(),n=yl(),r=MM(),a=nU(),l=yb(),c=1,u=2,f="[object Boolean]",p="[object Date]",h="[object Error]",m="[object Map]",y="[object Number]",w="[object RegExp]",_="[object Set]",k="[object String]",j="[object Symbol]",b="[object ArrayBuffer]",S="[object DataView]",E=e?e.prototype:void 0,C=E?E.valueOf:void 0;function T(R,A,q,F,O,H,K){switch(q){case S:if(R.byteLength!=A.byteLength||R.byteOffset!=A.byteOffset)return!1;R=R.buffer,A=A.buffer;case b:return!(R.byteLength!=A.byteLength||!H(new t(R),new t(A)));case f:case p:case y:return n(+R,+A);case h:return R.name==A.name&&R.message==A.message;case w:case k:return R==A+"";case m:var X=a;case _:var I=F&c;if(X||(X=l),R.size!=A.size&&!I)return!1;var Z=K.get(R);if(Z)return Z==A;F|=u,K.set(R,A);var W=r(X(R),X(A),F,O,H,K);return K.delete(R),W;case j:if(C)return C.call(R)==C.call(A)}return!1}return yy=T,yy}var wy,Xj;function sU(){if(Xj)return wy;Xj=1;var e=xM(),t=1,n=Object.prototype,r=n.hasOwnProperty;function a(l,c,u,f,p,h){var m=u&t,y=e(l),w=y.length,_=e(c),k=_.length;if(w!=k&&!m)return!1;for(var j=w;j--;){var b=y[j];if(!(m?b in c:r.call(c,b)))return!1}var S=h.get(l),E=h.get(c);if(S&&E)return S==c&&E==l;var C=!0;h.set(l,c),h.set(c,l);for(var T=m;++j<w;){b=y[j];var R=l[b],A=c[b];if(f)var q=m?f(A,R,b,c,l,h):f(R,A,b,l,c,h);if(!(q===void 0?R===A||p(R,A,u,f,h):q)){C=!1;break}T||(T=b=="constructor")}if(C&&!T){var F=l.constructor,O=c.constructor;F!=O&&"constructor"in l&&"constructor"in c&&!(typeof F=="function"&&F instanceof F&&typeof O=="function"&&O instanceof O)&&(C=!1)}return h.delete(l),h.delete(c),C}return wy=a,wy}var vy,Zj;function aU(){if(Zj)return vy;Zj=1;var e=Gh(),t=MM(),n=rU(),r=sU(),a=xl(),l=Gt(),c=vl(),u=cu(),f=1,p="[object Arguments]",h="[object Array]",m="[object Object]",y=Object.prototype,w=y.hasOwnProperty;function _(k,j,b,S,E,C){var T=l(k),R=l(j),A=T?h:a(k),q=R?h:a(j);A=A==p?m:A,q=q==p?m:q;var F=A==m,O=q==m,H=A==q;if(H&&c(k)){if(!c(j))return!1;T=!0,F=!1}if(H&&!F)return C||(C=new e),T||u(k)?t(k,j,b,S,E,C):n(k,j,A,b,S,E,C);if(!(b&f)){var K=F&&w.call(k,"__wrapped__"),X=O&&w.call(j,"__wrapped__");if(K||X){var I=K?k.value():k,Z=X?j.value():j;return C||(C=new e),E(I,Z,b,S,C)}}return H?(C||(C=new e),r(k,j,b,S,E,C)):!1}return vy=_,vy}var xy,Qj;function IM(){if(Qj)return xy;Qj=1;var e=aU(),t=gs();function n(r,a,l,c,u){return r===a?!0:r==null||a==null||!t(r)&&!t(a)?r!==r&&a!==a:e(r,a,l,c,n,u)}return xy=n,xy}var by,Jj;function oU(){if(Jj)return by;Jj=1;var e=Gh(),t=IM(),n=1,r=2;function a(l,c,u,f){var p=u.length,h=p,m=!f;if(l==null)return!h;for(l=Object(l);p--;){var y=u[p];if(m&&y[2]?y[1]!==l[y[0]]:!(y[0]in l))return!1}for(;++p<h;){y=u[p];var w=y[0],_=l[w],k=y[1];if(m&&y[2]){if(_===void 0&&!(w in l))return!1}else{var j=new e;if(f)var b=f(_,k,w,l,c,j);if(!(b===void 0?t(k,_,n|r,f,j):b))return!1}}return!0}return by=a,by}var ky,eE;function $M(){if(eE)return ky;eE=1;var e=_r();function t(n){return n===n&&!e(n)}return ky=t,ky}var Ny,tE;function iU(){if(tE)return Ny;tE=1;var e=$M(),t=Ha();function n(r){for(var a=t(r),l=a.length;l--;){var c=a[l],u=r[c];a[l]=[c,u,e(u)]}return a}return Ny=n,Ny}var _y,nE;function OM(){if(nE)return _y;nE=1;function e(t,n){return function(r){return r==null?!1:r[t]===n&&(n!==void 0||t in Object(r))}}return _y=e,_y}var Sy,rE;function lU(){if(rE)return Sy;rE=1;var e=oU(),t=iU(),n=OM();function r(a){var l=t(a);return l.length==1&&l[0][2]?n(l[0][0],l[0][1]):function(c){return c===a||e(c,a,l)}}return Sy=r,Sy}var jy,sE;function bl(){if(sE)return jy;sE=1;var e=Vo(),t=gs(),n="[object Symbol]";function r(a){return typeof a=="symbol"||t(a)&&e(a)==n}return jy=r,jy}var Ey,aE;function wb(){if(aE)return Ey;aE=1;var e=Gt(),t=bl(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;function a(l,c){if(e(l))return!1;var u=typeof l;return u=="number"||u=="symbol"||u=="boolean"||l==null||t(l)?!0:r.test(l)||!n.test(l)||c!=null&&l in Object(c)}return Ey=a,Ey}var Cy,oE;function cU(){if(oE)return Cy;oE=1;var e=ob(),t="Expected a function";function n(r,a){if(typeof r!="function"||a!=null&&typeof a!="function")throw new TypeError(t);var l=function(){var c=arguments,u=a?a.apply(this,c):c[0],f=l.cache;if(f.has(u))return f.get(u);var p=r.apply(this,c);return l.cache=f.set(u,p)||f,p};return l.cache=new(n.Cache||e),l}return n.Cache=e,Cy=n,Cy}var Ty,iE;function uU(){if(iE)return Ty;iE=1;var e=cU(),t=500;function n(r){var a=e(r,function(c){return l.size===t&&l.clear(),c}),l=a.cache;return a}return Ty=n,Ty}var Ay,lE;function dU(){if(lE)return Ay;lE=1;var e=uU(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g,r=e(function(a){var l=[];return a.charCodeAt(0)===46&&l.push(""),a.replace(t,function(c,u,f,p){l.push(f?p.replace(n,"$1"):u||c)}),l});return Ay=r,Ay}var Ry,cE;function tf(){if(cE)return Ry;cE=1;function e(t,n){for(var r=-1,a=t==null?0:t.length,l=Array(a);++r<a;)l[r]=n(t[r],r,t);return l}return Ry=e,Ry}var My,uE;function hU(){if(uE)return My;uE=1;var e=wl(),t=tf(),n=Gt(),r=bl(),a=e?e.prototype:void 0,l=a?a.toString:void 0;function c(u){if(typeof u=="string")return u;if(n(u))return t(u,c)+"";if(r(u))return l?l.call(u):"";var f=u+"";return f=="0"&&1/u==-1/0?"-0":f}return My=c,My}var Iy,dE;function LM(){if(dE)return Iy;dE=1;var e=hU();function t(n){return n==null?"":e(n)}return Iy=t,Iy}var $y,hE;function nf(){if(hE)return $y;hE=1;var e=Gt(),t=wb(),n=dU(),r=LM();function a(l,c){return e(l)?l:t(l,c)?[l]:n(r(l))}return $y=a,$y}var Oy,fE;function uu(){if(fE)return Oy;fE=1;var e=bl();function t(n){if(typeof n=="string"||e(n))return n;var r=n+"";return r=="0"&&1/n==-1/0?"-0":r}return Oy=t,Oy}var Ly,pE;function rf(){if(pE)return Ly;pE=1;var e=nf(),t=uu();function n(r,a){a=e(a,r);for(var l=0,c=a.length;r!=null&&l<c;)r=r[t(a[l++])];return l&&l==c?r:void 0}return Ly=n,Ly}var Py,mE;function fU(){if(mE)return Py;mE=1;var e=rf();function t(n,r,a){var l=n==null?void 0:e(n,r);return l===void 0?a:l}return Py=t,Py}var Dy,gE;function pU(){if(gE)return Dy;gE=1;function e(t,n){return t!=null&&n in Object(t)}return Dy=e,Dy}var Fy,yE;function PM(){if(yE)return Fy;yE=1;var e=nf(),t=lu(),n=Gt(),r=Xh(),a=lb(),l=uu();function c(u,f,p){f=e(f,u);for(var h=-1,m=f.length,y=!1;++h<m;){var w=l(f[h]);if(!(y=u!=null&&p(u,w)))break;u=u[w]}return y||++h!=m?y:(m=u==null?0:u.length,!!m&&a(m)&&r(w,m)&&(n(u)||t(u)))}return Fy=c,Fy}var qy,wE;function DM(){if(wE)return qy;wE=1;var e=pU(),t=PM();function n(r,a){return r!=null&&t(r,a,e)}return qy=n,qy}var By,vE;function mU(){if(vE)return By;vE=1;var e=IM(),t=fU(),n=DM(),r=wb(),a=$M(),l=OM(),c=uu(),u=1,f=2;function p(h,m){return r(h)&&a(m)?l(c(h),m):function(y){var w=t(y,h);return w===void 0&&w===m?n(y,h):e(m,w,u|f)}}return By=p,By}var zy,xE;function FM(){if(xE)return zy;xE=1;function e(t){return function(n){return n==null?void 0:n[t]}}return zy=e,zy}var Hy,bE;function gU(){if(bE)return Hy;bE=1;var e=rf();function t(n){return function(r){return e(r,n)}}return Hy=t,Hy}var Uy,kE;function yU(){if(kE)return Uy;kE=1;var e=FM(),t=gU(),n=wb(),r=uu();function a(l){return n(l)?e(r(l)):t(l)}return Uy=a,Uy}var Wy,NE;function Ks(){if(NE)return Wy;NE=1;var e=lU(),t=mU(),n=Yo(),r=Gt(),a=yU();function l(c){return typeof c=="function"?c:c==null?n:typeof c=="object"?r(c)?t(c[0],c[1]):e(c):a(c)}return Wy=l,Wy}var Vy,_E;function qM(){if(_E)return Vy;_E=1;var e=gM(),t=QH(),n=Ks(),r=Gt();function a(l,c){var u=r(l)?e:t;return u(l,n(c,3))}return Vy=a,Vy}var Gy,SE;function wU(){if(SE)return Gy;SE=1;var e=Object.prototype,t=e.hasOwnProperty;function n(r,a){return r!=null&&t.call(r,a)}return Gy=n,Gy}var Ky,jE;function BM(){if(jE)return Ky;jE=1;var e=wU(),t=PM();function n(r,a){return r!=null&&t(r,a,e)}return Ky=n,Ky}var Yy,EE;function vU(){if(EE)return Yy;EE=1;var e=ub(),t=xl(),n=lu(),r=Gt(),a=Gs(),l=vl(),c=Qh(),u=cu(),f="[object Map]",p="[object Set]",h=Object.prototype,m=h.hasOwnProperty;function y(w){if(w==null)return!0;if(a(w)&&(r(w)||typeof w=="string"||typeof w.splice=="function"||l(w)||u(w)||n(w)))return!w.length;var _=t(w);if(_==f||_==p)return!w.size;if(c(w))return!e(w).length;for(var k in w)if(m.call(w,k))return!1;return!0}return Yy=y,Yy}var Xy,CE;function zM(){if(CE)return Xy;CE=1;function e(t){return t===void 0}return Xy=e,Xy}var Zy,TE;function HM(){if(TE)return Zy;TE=1;var e=ef(),t=Gs();function n(r,a){var l=-1,c=t(r)?Array(r.length):[];return e(r,function(u,f,p){c[++l]=a(u,f,p)}),c}return Zy=n,Zy}var Qy,AE;function UM(){if(AE)return Qy;AE=1;var e=tf(),t=Ks(),n=HM(),r=Gt();function a(l,c){var u=r(l)?e:n;return u(l,t(c,3))}return Qy=a,Qy}var Jy,RE;function xU(){if(RE)return Jy;RE=1;function e(t,n,r,a){var l=-1,c=t==null?0:t.length;for(a&&c&&(r=t[++l]);++l<c;)r=n(r,t[l],l,t);return r}return Jy=e,Jy}var ew,ME;function bU(){if(ME)return ew;ME=1;function e(t,n,r,a,l){return l(t,function(c,u,f){r=a?(a=!1,c):n(r,c,u,f)}),r}return ew=e,ew}var tw,IE;function WM(){if(IE)return tw;IE=1;var e=xU(),t=ef(),n=Ks(),r=bU(),a=Gt();function l(c,u,f){var p=a(c)?e:r,h=arguments.length<3;return p(c,n(u,4),f,h,t)}return tw=l,tw}var nw,$E;function kU(){if($E)return nw;$E=1;var e=Vo(),t=Gt(),n=gs(),r="[object String]";function a(l){return typeof l=="string"||!t(l)&&n(l)&&e(l)==r}return nw=a,nw}var rw,OE;function NU(){if(OE)return rw;OE=1;var e=FM(),t=e("length");return rw=t,rw}var sw,LE;function _U(){if(LE)return sw;LE=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",r="\\u20d0-\\u20ff",a=t+n+r,l="\\ufe0e\\ufe0f",c="\\u200d",u=RegExp("["+c+e+a+l+"]");function f(p){return u.test(p)}return sw=f,sw}var aw,PE;function SU(){if(PE)return aw;PE=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",r="\\u20d0-\\u20ff",a=t+n+r,l="\\ufe0e\\ufe0f",c="["+e+"]",u="["+a+"]",f="\\ud83c[\\udffb-\\udfff]",p="(?:"+u+"|"+f+")",h="[^"+e+"]",m="(?:\\ud83c[\\udde6-\\uddff]){2}",y="[\\ud800-\\udbff][\\udc00-\\udfff]",w="\\u200d",_=p+"?",k="["+l+"]?",j="(?:"+w+"(?:"+[h,m,y].join("|")+")"+k+_+")*",b=k+_+j,S="(?:"+[h+u+"?",u,m,y,c].join("|")+")",E=RegExp(f+"(?="+f+")|"+S+b,"g");function C(T){for(var R=E.lastIndex=0;E.test(T);)++R;return R}return aw=C,aw}var ow,DE;function jU(){if(DE)return ow;DE=1;var e=NU(),t=_U(),n=SU();function r(a){return t(a)?n(a):e(a)}return ow=r,ow}var iw,FE;function EU(){if(FE)return iw;FE=1;var e=ub(),t=xl(),n=Gs(),r=kU(),a=jU(),l="[object Map]",c="[object Set]";function u(f){if(f==null)return 0;if(n(f))return r(f)?a(f):f.length;var p=t(f);return p==l||p==c?f.size:e(f).length}return iw=u,iw}var lw,qE;function CU(){if(qE)return lw;qE=1;var e=ib(),t=_M(),n=gb(),r=Ks(),a=Jh(),l=Gt(),c=vl(),u=ou(),f=_r(),p=cu();function h(m,y,w){var _=l(m),k=_||c(m)||p(m);if(y=r(y,4),w==null){var j=m&&m.constructor;k?w=_?new j:[]:f(m)?w=u(j)?t(a(m)):{}:w={}}return(k?e:n)(m,function(b,S,E){return y(w,b,S,E)}),w}return lw=h,lw}var cw,BE;function TU(){if(BE)return cw;BE=1;var e=wl(),t=lu(),n=Gt(),r=e?e.isConcatSpreadable:void 0;function a(l){return n(l)||t(l)||!!(r&&l&&l[r])}return cw=a,cw}var uw,zE;function vb(){if(zE)return uw;zE=1;var e=hb(),t=TU();function n(r,a,l,c,u){var f=-1,p=r.length;for(l||(l=t),u||(u=[]);++f<p;){var h=r[f];a>0&&l(h)?a>1?n(h,a-1,l,c,u):e(u,h):c||(u[u.length]=h)}return u}return uw=n,uw}var dw,HE;function AU(){if(HE)return dw;HE=1;function e(t,n,r){switch(r.length){case 0:return t.call(n);case 1:return t.call(n,r[0]);case 2:return t.call(n,r[0],r[1]);case 3:return t.call(n,r[0],r[1],r[2])}return t.apply(n,r)}return dw=e,dw}var hw,UE;function VM(){if(UE)return hw;UE=1;var e=AU(),t=Math.max;function n(r,a,l){return a=t(a===void 0?r.length-1:a,0),function(){for(var c=arguments,u=-1,f=t(c.length-a,0),p=Array(f);++u<f;)p[u]=c[a+u];u=-1;for(var h=Array(a+1);++u<a;)h[u]=c[u];return h[a]=l(p),e(r,this,h)}}return hw=n,hw}var fw,WE;function RU(){if(WE)return fw;WE=1;var e=pb(),t=dM(),n=Yo(),r=t?function(a,l){return t(a,"toString",{configurable:!0,enumerable:!1,value:e(l),writable:!0})}:n;return fw=r,fw}var pw,VE;function MU(){if(VE)return pw;VE=1;var e=800,t=16,n=Date.now;function r(a){var l=0,c=0;return function(){var u=n(),f=t-(u-c);if(c=u,f>0){if(++l>=e)return arguments[0]}else l=0;return a.apply(void 0,arguments)}}return pw=r,pw}var mw,GE;function GM(){if(GE)return mw;GE=1;var e=RU(),t=MU(),n=t(e);return mw=n,mw}var gw,KE;function sf(){if(KE)return gw;KE=1;var e=Yo(),t=VM(),n=GM();function r(a,l){return n(t(a,l,e),a+"")}return gw=r,gw}var yw,YE;function KM(){if(YE)return yw;YE=1;function e(t,n,r,a){for(var l=t.length,c=r+(a?1:-1);a?c--:++c<l;)if(n(t[c],c,t))return c;return-1}return yw=e,yw}var ww,XE;function IU(){if(XE)return ww;XE=1;function e(t){return t!==t}return ww=e,ww}var vw,ZE;function $U(){if(ZE)return vw;ZE=1;function e(t,n,r){for(var a=r-1,l=t.length;++a<l;)if(t[a]===n)return a;return-1}return vw=e,vw}var xw,QE;function OU(){if(QE)return xw;QE=1;var e=KM(),t=IU(),n=$U();function r(a,l,c){return l===l?n(a,l,c):e(a,t,c)}return xw=r,xw}var bw,JE;function LU(){if(JE)return bw;JE=1;var e=OU();function t(n,r){var a=n==null?0:n.length;return!!a&&e(n,r,0)>-1}return bw=t,bw}var kw,eC;function PU(){if(eC)return kw;eC=1;function e(t,n,r){for(var a=-1,l=t==null?0:t.length;++a<l;)if(r(n,t[a]))return!0;return!1}return kw=e,kw}var Nw,tC;function DU(){if(tC)return Nw;tC=1;function e(){}return Nw=e,Nw}var _w,nC;function FU(){if(nC)return _w;nC=1;var e=bM(),t=DU(),n=yb(),r=1/0,a=e&&1/n(new e([,-0]))[1]==r?function(l){return new e(l)}:t;return _w=a,_w}var Sw,rC;function qU(){if(rC)return Sw;rC=1;var e=AM(),t=LU(),n=PU(),r=RM(),a=FU(),l=yb(),c=200;function u(f,p,h){var m=-1,y=t,w=f.length,_=!0,k=[],j=k;if(h)_=!1,y=n;else if(w>=c){var b=p?null:a(f);if(b)return l(b);_=!1,y=r,j=new e}else j=p?[]:k;e:for(;++m<w;){var S=f[m],E=p?p(S):S;if(S=h||S!==0?S:0,_&&E===E){for(var C=j.length;C--;)if(j[C]===E)continue e;p&&j.push(E),k.push(S)}else y(j,E,h)||(j!==k&&j.push(E),k.push(S))}return k}return Sw=u,Sw}var jw,sC;function YM(){if(sC)return jw;sC=1;var e=Gs(),t=gs();function n(r){return t(r)&&e(r)}return jw=n,jw}var Ew,aC;function BU(){if(aC)return Ew;aC=1;var e=vb(),t=sf(),n=qU(),r=YM(),a=t(function(l){return n(e(l,1,r,!0))});return Ew=a,Ew}var Cw,oC;function zU(){if(oC)return Cw;oC=1;var e=tf();function t(n,r){return e(r,function(a){return n[a]})}return Cw=t,Cw}var Tw,iC;function XM(){if(iC)return Tw;iC=1;var e=zU(),t=Ha();function n(r){return r==null?[]:e(r,t(r))}return Tw=n,Tw}var Aw,lC;function Sr(){if(lC)return Aw;lC=1;var e;if(typeof sb=="function")try{e={clone:YH(),constant:pb(),each:TM(),filter:qM(),has:BM(),isArray:Gt(),isEmpty:vU(),isFunction:ou(),isUndefined:zM(),keys:Ha(),map:UM(),reduce:WM(),size:EU(),transform:CU(),union:BU(),values:XM()}}catch{}return e||(e=window._),Aw=e,Aw}var Rw,cC;function xb(){if(cC)return Rw;cC=1;var e=Sr();Rw=a;var t="\0",n="\0",r="";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(m){return e.isEmpty(h._in[m])})},a.prototype.sinks=function(){var h=this;return e.filter(this.nodes(),function(m){return e.isEmpty(h._out[m])})},a.prototype.setNodes=function(h,m){var y=arguments,w=this;return e.each(h,function(_){y.length>1?w.setNode(_,m):w.setNode(_)}),this},a.prototype.setNode=function(h,m){return e.has(this._nodes,h)?(arguments.length>1&&(this._nodes[h]=m),this):(this._nodes[h]=arguments.length>1?m: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 m=this;if(e.has(this._nodes,h)){var y=function(w){m.removeEdge(m._edgeObjs[w])};delete this._nodes[h],this._isCompound&&(this._removeFromParentsChildList(h),delete this._parent[h],e.each(this.children(h),function(w){m.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,m){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(e.isUndefined(m))m=n;else{m+="";for(var y=m;!e.isUndefined(y);y=this.parent(y))if(y===h)throw new Error("Setting "+m+" as parent of "+h+" would create a cycle");this.setNode(m)}return this.setNode(h),this._removeFromParentsChildList(h),this._parent[h]=m,this._children[m][h]=!0,this},a.prototype._removeFromParentsChildList=function(h){delete this._children[this._parent[h]][h]},a.prototype.parent=function(h){if(this._isCompound){var m=this._parent[h];if(m!==n)return m}},a.prototype.children=function(h){if(e.isUndefined(h)&&(h=n),this._isCompound){var m=this._children[h];if(m)return e.keys(m)}else{if(h===n)return this.nodes();if(this.hasNode(h))return[]}},a.prototype.predecessors=function(h){var m=this._preds[h];if(m)return e.keys(m)},a.prototype.successors=function(h){var m=this._sucs[h];if(m)return e.keys(m)},a.prototype.neighbors=function(h){var m=this.predecessors(h);if(m)return e.union(m,this.successors(h))},a.prototype.isLeaf=function(h){var m;return this.isDirected()?m=this.successors(h):m=this.neighbors(h),m.length===0},a.prototype.filterNodes=function(h){var m=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});m.setGraph(this.graph());var y=this;e.each(this._nodes,function(k,j){h(j)&&m.setNode(j,k)}),e.each(this._edgeObjs,function(k){m.hasNode(k.v)&&m.hasNode(k.w)&&m.setEdge(k,y.edge(k))});var w={};function _(k){var j=y.parent(k);return j===void 0||m.hasNode(j)?(w[k]=j,j):j in w?w[j]:_(j)}return this._isCompound&&e.each(m.nodes(),function(k){m.setParent(k,_(k))}),m},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,m){var y=this,w=arguments;return e.reduce(h,function(_,k){return w.length>1?y.setEdge(_,k,m):y.setEdge(_,k),k}),this},a.prototype.setEdge=function(){var h,m,y,w,_=!1,k=arguments[0];typeof k=="object"&&k!==null&&"v"in k?(h=k.v,m=k.w,y=k.name,arguments.length===2&&(w=arguments[1],_=!0)):(h=k,m=arguments[1],y=arguments[3],arguments.length>2&&(w=arguments[2],_=!0)),h=""+h,m=""+m,e.isUndefined(y)||(y=""+y);var j=u(this._isDirected,h,m,y);if(e.has(this._edgeLabels,j))return _&&(this._edgeLabels[j]=w),this;if(!e.isUndefined(y)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(h),this.setNode(m),this._edgeLabels[j]=_?w:this._defaultEdgeLabelFn(h,m,y);var b=f(this._isDirected,h,m,y);return h=b.v,m=b.w,Object.freeze(b),this._edgeObjs[j]=b,l(this._preds[m],h),l(this._sucs[h],m),this._in[m][j]=b,this._out[h][j]=b,this._edgeCount++,this},a.prototype.edge=function(h,m,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):u(this._isDirected,h,m,y);return this._edgeLabels[w]},a.prototype.hasEdge=function(h,m,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):u(this._isDirected,h,m,y);return e.has(this._edgeLabels,w)},a.prototype.removeEdge=function(h,m,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):u(this._isDirected,h,m,y),_=this._edgeObjs[w];return _&&(h=_.v,m=_.w,delete this._edgeLabels[w],delete this._edgeObjs[w],c(this._preds[m],h),c(this._sucs[h],m),delete this._in[m][w],delete this._out[h][w],this._edgeCount--),this},a.prototype.inEdges=function(h,m){var y=this._in[h];if(y){var w=e.values(y);return m?e.filter(w,function(_){return _.v===m}):w}},a.prototype.outEdges=function(h,m){var y=this._out[h];if(y){var w=e.values(y);return m?e.filter(w,function(_){return _.w===m}):w}},a.prototype.nodeEdges=function(h,m){var y=this.inEdges(h,m);if(y)return y.concat(this.outEdges(h,m))};function l(h,m){h[m]?h[m]++:h[m]=1}function c(h,m){--h[m]||delete h[m]}function u(h,m,y,w){var _=""+m,k=""+y;if(!h&&_>k){var j=_;_=k,k=j}return _+r+k+r+(e.isUndefined(w)?t:w)}function f(h,m,y,w){var _=""+m,k=""+y;if(!h&&_>k){var j=_;_=k,k=j}var b={v:_,w:k};return w&&(b.name=w),b}function p(h,m){return u(h,m.v,m.w,m.name)}return Rw}var Mw,uC;function HU(){return uC||(uC=1,Mw="2.1.8"),Mw}var Iw,dC;function UU(){return dC||(dC=1,Iw={Graph:xb(),version:HU()}),Iw}var $w,hC;function WU(){if(hC)return $w;hC=1;var e=Sr(),t=xb();$w={write:n,read:l};function n(c){var u={options:{directed:c.isDirected(),multigraph:c.isMultigraph(),compound:c.isCompound()},nodes:r(c),edges:a(c)};return e.isUndefined(c.graph())||(u.value=e.clone(c.graph())),u}function r(c){return e.map(c.nodes(),function(u){var f=c.node(u),p=c.parent(u),h={v:u};return e.isUndefined(f)||(h.value=f),e.isUndefined(p)||(h.parent=p),h})}function a(c){return e.map(c.edges(),function(u){var f=c.edge(u),p={v:u.v,w:u.w};return e.isUndefined(u.name)||(p.name=u.name),e.isUndefined(f)||(p.value=f),p})}function l(c){var u=new t(c.options).setGraph(c.value);return e.each(c.nodes,function(f){u.setNode(f.v,f.value),f.parent&&u.setParent(f.v,f.parent)}),e.each(c.edges,function(f){u.setEdge({v:f.v,w:f.w,name:f.name},f.value)}),u}return $w}var Ow,fC;function VU(){if(fC)return Ow;fC=1;var e=Sr();Ow=t;function t(n){var r={},a=[],l;function c(u){e.has(r,u)||(r[u]=!0,l.push(u),e.each(n.successors(u),c),e.each(n.predecessors(u),c))}return e.each(n.nodes(),function(u){l=[],c(u),l.length&&a.push(l)}),a}return Ow}var Lw,pC;function ZM(){if(pC)return Lw;pC=1;var e=Sr();Lw=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 r=this._keyIndices[n];if(r!==void 0)return this._arr[r].priority},t.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},t.prototype.add=function(n,r){var a=this._keyIndices;if(n=String(n),!e.has(a,n)){var l=this._arr,c=l.length;return a[n]=c,l.push({key:n,priority:r}),this._decrease(c),!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,r){var a=this._keyIndices[n];if(r>this._arr[a].priority)throw new Error("New priority is greater than current priority. Key: "+n+" Old: "+this._arr[a].priority+" New: "+r);this._arr[a].priority=r,this._decrease(a)},t.prototype._heapify=function(n){var r=this._arr,a=2*n,l=a+1,c=n;a<r.length&&(c=r[a].priority<r[c].priority?a:c,l<r.length&&(c=r[l].priority<r[c].priority?l:c),c!==n&&(this._swap(n,c),this._heapify(c)))},t.prototype._decrease=function(n){for(var r=this._arr,a=r[n].priority,l;n!==0&&(l=n>>1,!(r[l].priority<a));)this._swap(n,l),n=l},t.prototype._swap=function(n,r){var a=this._arr,l=this._keyIndices,c=a[n],u=a[r];a[n]=u,a[r]=c,l[u.key]=n,l[c.key]=r},Lw}var Pw,mC;function QM(){if(mC)return Pw;mC=1;var e=Sr(),t=ZM();Pw=r;var n=e.constant(1);function r(l,c,u,f){return a(l,String(c),u||n,f||function(p){return l.outEdges(p)})}function a(l,c,u,f){var p={},h=new t,m,y,w=function(_){var k=_.v!==m?_.v:_.w,j=p[k],b=u(_),S=y.distance+b;if(b<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+_+" Weight: "+b);S<j.distance&&(j.distance=S,j.predecessor=m,h.decrease(k,S))};for(l.nodes().forEach(function(_){var k=_===c?0:Number.POSITIVE_INFINITY;p[_]={distance:k},h.add(_,k)});h.size()>0&&(m=h.removeMin(),y=p[m],y.distance!==Number.POSITIVE_INFINITY);)f(m).forEach(w);return p}return Pw}var Dw,gC;function GU(){if(gC)return Dw;gC=1;var e=QM(),t=Sr();Dw=n;function n(r,a,l){return t.transform(r.nodes(),function(c,u){c[u]=e(r,u,a,l)},{})}return Dw}var Fw,yC;function JM(){if(yC)return Fw;yC=1;var e=Sr();Fw=t;function t(n){var r=0,a=[],l={},c=[];function u(f){var p=l[f]={onStack:!0,lowlink:r,index:r++};if(a.push(f),n.successors(f).forEach(function(y){e.has(l,y)?l[y].onStack&&(p.lowlink=Math.min(p.lowlink,l[y].index)):(u(y),p.lowlink=Math.min(p.lowlink,l[y].lowlink))}),p.lowlink===p.index){var h=[],m;do m=a.pop(),l[m].onStack=!1,h.push(m);while(f!==m);c.push(h)}}return n.nodes().forEach(function(f){e.has(l,f)||u(f)}),c}return Fw}var qw,wC;function KU(){if(wC)return qw;wC=1;var e=Sr(),t=JM();qw=n;function n(r){return e.filter(t(r),function(a){return a.length>1||a.length===1&&r.hasEdge(a[0],a[0])})}return qw}var Bw,vC;function YU(){if(vC)return Bw;vC=1;var e=Sr();Bw=n;var t=e.constant(1);function n(a,l,c){return r(a,l||t,c||function(u){return a.outEdges(u)})}function r(a,l,c){var u={},f=a.nodes();return f.forEach(function(p){u[p]={},u[p][p]={distance:0},f.forEach(function(h){p!==h&&(u[p][h]={distance:Number.POSITIVE_INFINITY})}),c(p).forEach(function(h){var m=h.v===p?h.w:h.v,y=l(h);u[p][m]={distance:y,predecessor:p}})}),f.forEach(function(p){var h=u[p];f.forEach(function(m){var y=u[m];f.forEach(function(w){var _=y[p],k=h[w],j=y[w],b=_.distance+k.distance;b<j.distance&&(j.distance=b,j.predecessor=k.predecessor)})})}),u}return Bw}var zw,xC;function eI(){if(xC)return zw;xC=1;var e=Sr();zw=t,t.CycleException=n;function t(r){var a={},l={},c=[];function u(f){if(e.has(l,f))throw new n;e.has(a,f)||(l[f]=!0,a[f]=!0,e.each(r.predecessors(f),u),delete l[f],c.push(f))}if(e.each(r.sinks(),u),e.size(a)!==r.nodeCount())throw new n;return c}function n(){}return n.prototype=new Error,zw}var Hw,bC;function XU(){if(bC)return Hw;bC=1;var e=eI();Hw=t;function t(n){try{e(n)}catch(r){if(r instanceof e.CycleException)return!1;throw r}return!0}return Hw}var Uw,kC;function tI(){if(kC)return Uw;kC=1;var e=Sr();Uw=t;function t(r,a,l){e.isArray(a)||(a=[a]);var c=(r.isDirected()?r.successors:r.neighbors).bind(r),u=[],f={};return e.each(a,function(p){if(!r.hasNode(p))throw new Error("Graph does not have node: "+p);n(r,p,l==="post",f,c,u)}),u}function n(r,a,l,c,u,f){e.has(c,a)||(c[a]=!0,l||f.push(a),e.each(u(a),function(p){n(r,p,l,c,u,f)}),l&&f.push(a))}return Uw}var Ww,NC;function ZU(){if(NC)return Ww;NC=1;var e=tI();Ww=t;function t(n,r){return e(n,r,"post")}return Ww}var Vw,_C;function QU(){if(_C)return Vw;_C=1;var e=tI();Vw=t;function t(n,r){return e(n,r,"pre")}return Vw}var Gw,SC;function JU(){if(SC)return Gw;SC=1;var e=Sr(),t=xb(),n=ZM();Gw=r;function r(a,l){var c=new t,u={},f=new n,p;function h(y){var w=y.v===p?y.w:y.v,_=f.priority(w);if(_!==void 0){var k=l(y);k<_&&(u[w]=p,f.decrease(w,k))}}if(a.nodeCount()===0)return c;e.each(a.nodes(),function(y){f.add(y,Number.POSITIVE_INFINITY),c.setNode(y)}),f.decrease(a.nodes()[0],0);for(var m=!1;f.size()>0;){if(p=f.removeMin(),e.has(u,p))c.setEdge(p,u[p]);else{if(m)throw new Error("Input graph is not connected: "+a);m=!0}a.nodeEdges(p).forEach(h)}return c}return Gw}var Kw,jC;function eW(){return jC||(jC=1,Kw={components:VU(),dijkstra:QM(),dijkstraAll:GU(),findCycles:KU(),floydWarshall:YU(),isAcyclic:XU(),postorder:ZU(),preorder:QU(),prim:JU(),tarjan:JM(),topsort:eI()}),Kw}var Yw,EC;function tW(){if(EC)return Yw;EC=1;var e=UU();return Yw={Graph:e.Graph,json:WU(),alg:eW(),version:e.version},Yw}var Xw,CC;function Gr(){if(CC)return Xw;CC=1;var e;if(typeof sb=="function")try{e=tW()}catch{}return e||(e=window.graphlib),Xw=e,Xw}var Zw,TC;function nW(){if(TC)return Zw;TC=1;var e=jM(),t=1,n=4;function r(a){return e(a,t|n)}return Zw=r,Zw}var Qw,AC;function af(){if(AC)return Qw;AC=1;var e=yl(),t=Gs(),n=Xh(),r=_r();function a(l,c,u){if(!r(u))return!1;var f=typeof c;return(f=="number"?t(u)&&n(c,u.length):f=="string"&&c in u)?e(u[c],l):!1}return Qw=a,Qw}var Jw,RC;function rW(){if(RC)return Jw;RC=1;var e=sf(),t=yl(),n=af(),r=Ko(),a=Object.prototype,l=a.hasOwnProperty,c=e(function(u,f){u=Object(u);var p=-1,h=f.length,m=h>2?f[2]:void 0;for(m&&n(f[0],f[1],m)&&(h=1);++p<h;)for(var y=f[p],w=r(y),_=-1,k=w.length;++_<k;){var j=w[_],b=u[j];(b===void 0||t(b,a[j])&&!l.call(u,j))&&(u[j]=y[j])}return u});return Jw=c,Jw}var ev,MC;function sW(){if(MC)return ev;MC=1;var e=Ks(),t=Gs(),n=Ha();function r(a){return function(l,c,u){var f=Object(l);if(!t(l)){var p=e(c,3);l=n(l),c=function(m){return p(f[m],m,f)}}var h=a(l,c,u);return h>-1?f[p?l[h]:h]:void 0}}return ev=r,ev}var tv,IC;function aW(){if(IC)return tv;IC=1;var e=/\s/;function t(n){for(var r=n.length;r--&&e.test(n.charAt(r)););return r}return tv=t,tv}var nv,$C;function oW(){if($C)return nv;$C=1;var e=aW(),t=/^\s+/;function n(r){return r&&r.slice(0,e(r)+1).replace(t,"")}return nv=n,nv}var rv,OC;function iW(){if(OC)return rv;OC=1;var e=oW(),t=_r(),n=bl(),r=NaN,a=/^[-+]0x[0-9a-f]+$/i,l=/^0b[01]+$/i,c=/^0o[0-7]+$/i,u=parseInt;function f(p){if(typeof p=="number")return p;if(n(p))return r;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 m=l.test(p);return m||c.test(p)?u(p.slice(2),m?2:8):a.test(p)?r:+p}return rv=f,rv}var sv,LC;function nI(){if(LC)return sv;LC=1;var e=iW(),t=1/0,n=17976931348623157e292;function r(a){if(!a)return a===0?a:0;if(a=e(a),a===t||a===-t){var l=a<0?-1:1;return l*n}return a===a?a:0}return sv=r,sv}var av,PC;function lW(){if(PC)return av;PC=1;var e=nI();function t(n){var r=e(n),a=r%1;return r===r?a?r-a:r:0}return av=t,av}var ov,DC;function cW(){if(DC)return ov;DC=1;var e=KM(),t=Ks(),n=lW(),r=Math.max;function a(l,c,u){var f=l==null?0:l.length;if(!f)return-1;var p=u==null?0:n(u);return p<0&&(p=r(f+p,0)),e(l,t(c,3),p)}return ov=a,ov}var iv,FC;function uW(){if(FC)return iv;FC=1;var e=sW(),t=cW(),n=e(t);return iv=n,iv}var lv,qC;function rI(){if(qC)return lv;qC=1;var e=vb();function t(n){var r=n==null?0:n.length;return r?e(n,1):[]}return lv=t,lv}var cv,BC;function dW(){if(BC)return cv;BC=1;var e=mb(),t=EM(),n=Ko();function r(a,l){return a==null?a:e(a,t(l),n)}return cv=r,cv}var uv,zC;function hW(){if(zC)return uv;zC=1;function e(t){var n=t==null?0:t.length;return n?t[n-1]:void 0}return uv=e,uv}var dv,HC;function fW(){if(HC)return dv;HC=1;var e=Kh(),t=gb(),n=Ks();function r(a,l){var c={};return l=n(l,3),t(a,function(u,f,p){e(c,f,l(u,f,p))}),c}return dv=r,dv}var hv,UC;function bb(){if(UC)return hv;UC=1;var e=bl();function t(n,r,a){for(var l=-1,c=n.length;++l<c;){var u=n[l],f=r(u);if(f!=null&&(p===void 0?f===f&&!e(f):a(f,p)))var p=f,h=u}return h}return hv=t,hv}var fv,WC;function pW(){if(WC)return fv;WC=1;function e(t,n){return t>n}return fv=e,fv}var pv,VC;function mW(){if(VC)return pv;VC=1;var e=bb(),t=pW(),n=Yo();function r(a){return a&&a.length?e(a,n,t):void 0}return pv=r,pv}var mv,GC;function sI(){if(GC)return mv;GC=1;var e=Kh(),t=yl();function n(r,a,l){(l!==void 0&&!t(r[a],l)||l===void 0&&!(a in r))&&e(r,a,l)}return mv=n,mv}var gv,KC;function gW(){if(KC)return gv;KC=1;var e=Vo(),t=Jh(),n=gs(),r="[object Object]",a=Function.prototype,l=Object.prototype,c=a.toString,u=l.hasOwnProperty,f=c.call(Object);function p(h){if(!n(h)||e(h)!=r)return!1;var m=t(h);if(m===null)return!0;var y=u.call(m,"constructor")&&m.constructor;return typeof y=="function"&&y instanceof y&&c.call(y)==f}return gv=p,gv}var yv,YC;function aI(){if(YC)return yv;YC=1;function e(t,n){if(!(n==="constructor"&&typeof t[n]=="function")&&n!="__proto__")return t[n]}return yv=e,yv}var wv,XC;function yW(){if(XC)return wv;XC=1;var e=iu(),t=Ko();function n(r){return e(r,t(r))}return wv=n,wv}var vv,ZC;function wW(){if(ZC)return vv;ZC=1;var e=sI(),t=pM(),n=NM(),r=mM(),a=SM(),l=lu(),c=Gt(),u=YM(),f=vl(),p=ou(),h=_r(),m=gW(),y=cu(),w=aI(),_=yW();function k(j,b,S,E,C,T,R){var A=w(j,S),q=w(b,S),F=R.get(q);if(F){e(j,S,F);return}var O=T?T(A,q,S+"",j,b,R):void 0,H=O===void 0;if(H){var K=c(q),X=!K&&f(q),I=!K&&!X&&y(q);O=q,K||X||I?c(A)?O=A:u(A)?O=r(A):X?(H=!1,O=t(q,!0)):I?(H=!1,O=n(q,!0)):O=[]:m(q)||l(q)?(O=A,l(A)?O=_(A):(!h(A)||p(A))&&(O=a(q))):H=!1}H&&(R.set(q,O),C(O,q,E,T,R),R.delete(q)),e(j,S,O)}return vv=k,vv}var xv,QC;function vW(){if(QC)return xv;QC=1;var e=Gh(),t=sI(),n=mb(),r=wW(),a=_r(),l=Ko(),c=aI();function u(f,p,h,m,y){f!==p&&n(p,function(w,_){if(y||(y=new e),a(w))r(f,p,_,h,u,m,y);else{var k=m?m(c(f,_),w,_+"",f,p,y):void 0;k===void 0&&(k=w),t(f,_,k)}},l)}return xv=u,xv}var bv,JC;function xW(){if(JC)return bv;JC=1;var e=sf(),t=af();function n(r){return e(function(a,l){var c=-1,u=l.length,f=u>1?l[u-1]:void 0,p=u>2?l[2]:void 0;for(f=r.length>3&&typeof f=="function"?(u--,f):void 0,p&&t(l[0],l[1],p)&&(f=u<3?void 0:f,u=1),a=Object(a);++c<u;){var h=l[c];h&&r(a,h,c,f)}return a})}return bv=n,bv}var kv,eT;function bW(){if(eT)return kv;eT=1;var e=vW(),t=xW(),n=t(function(r,a,l){e(r,a,l)});return kv=n,kv}var Nv,tT;function oI(){if(tT)return Nv;tT=1;function e(t,n){return t<n}return Nv=e,Nv}var _v,nT;function kW(){if(nT)return _v;nT=1;var e=bb(),t=oI(),n=Yo();function r(a){return a&&a.length?e(a,n,t):void 0}return _v=r,_v}var Sv,rT;function NW(){if(rT)return Sv;rT=1;var e=bb(),t=Ks(),n=oI();function r(a,l){return a&&a.length?e(a,t(l,2),n):void 0}return Sv=r,Sv}var jv,sT;function _W(){if(sT)return jv;sT=1;var e=Yr(),t=function(){return e.Date.now()};return jv=t,jv}var Ev,aT;function SW(){if(aT)return Ev;aT=1;var e=Yh(),t=nf(),n=Xh(),r=_r(),a=uu();function l(c,u,f,p){if(!r(c))return c;u=t(u,c);for(var h=-1,m=u.length,y=m-1,w=c;w!=null&&++h<m;){var _=a(u[h]),k=f;if(_==="__proto__"||_==="constructor"||_==="prototype")return c;if(h!=y){var j=w[_];k=p?p(j,_,w):void 0,k===void 0&&(k=r(j)?j:n(u[h+1])?[]:{})}e(w,_,k),w=w[_]}return c}return Ev=l,Ev}var Cv,oT;function jW(){if(oT)return Cv;oT=1;var e=rf(),t=SW(),n=nf();function r(a,l,c){for(var u=-1,f=l.length,p={};++u<f;){var h=l[u],m=e(a,h);c(m,h)&&t(p,n(h,a),m)}return p}return Cv=r,Cv}var Tv,iT;function EW(){if(iT)return Tv;iT=1;var e=jW(),t=DM();function n(r,a){return e(r,a,function(l,c){return t(r,c)})}return Tv=n,Tv}var Av,lT;function CW(){if(lT)return Av;lT=1;var e=rI(),t=VM(),n=GM();function r(a){return n(t(a,void 0,e),a+"")}return Av=r,Av}var Rv,cT;function TW(){if(cT)return Rv;cT=1;var e=EW(),t=CW(),n=t(function(r,a){return r==null?{}:e(r,a)});return Rv=n,Rv}var Mv,uT;function AW(){if(uT)return Mv;uT=1;var e=Math.ceil,t=Math.max;function n(r,a,l,c){for(var u=-1,f=t(e((a-r)/(l||1)),0),p=Array(f);f--;)p[c?f:++u]=r,r+=l;return p}return Mv=n,Mv}var Iv,dT;function RW(){if(dT)return Iv;dT=1;var e=AW(),t=af(),n=nI();function r(a){return function(l,c,u){return u&&typeof u!="number"&&t(l,c,u)&&(c=u=void 0),l=n(l),c===void 0?(c=l,l=0):c=n(c),u=u===void 0?l<c?1:-1:n(u),e(l,c,u,a)}}return Iv=r,Iv}var $v,hT;function MW(){if(hT)return $v;hT=1;var e=RW(),t=e();return $v=t,$v}var Ov,fT;function IW(){if(fT)return Ov;fT=1;function e(t,n){var r=t.length;for(t.sort(n);r--;)t[r]=t[r].value;return t}return Ov=e,Ov}var Lv,pT;function $W(){if(pT)return Lv;pT=1;var e=bl();function t(n,r){if(n!==r){var a=n!==void 0,l=n===null,c=n===n,u=e(n),f=r!==void 0,p=r===null,h=r===r,m=e(r);if(!p&&!m&&!u&&n>r||u&&f&&h&&!p&&!m||l&&f&&h||!a&&h||!c)return 1;if(!l&&!u&&!m&&n<r||m&&a&&c&&!l&&!u||p&&a&&c||!f&&c||!h)return-1}return 0}return Lv=t,Lv}var Pv,mT;function OW(){if(mT)return Pv;mT=1;var e=$W();function t(n,r,a){for(var l=-1,c=n.criteria,u=r.criteria,f=c.length,p=a.length;++l<f;){var h=e(c[l],u[l]);if(h){if(l>=p)return h;var m=a[l];return h*(m=="desc"?-1:1)}}return n.index-r.index}return Pv=t,Pv}var Dv,gT;function LW(){if(gT)return Dv;gT=1;var e=tf(),t=rf(),n=Ks(),r=HM(),a=IW(),l=Zh(),c=OW(),u=Yo(),f=Gt();function p(h,m,y){m.length?m=e(m,function(k){return f(k)?function(j){return t(j,k.length===1?k[0]:k)}:k}):m=[u];var w=-1;m=e(m,l(n));var _=r(h,function(k,j,b){var S=e(m,function(E){return E(k)});return{criteria:S,index:++w,value:k}});return a(_,function(k,j){return c(k,j,y)})}return Dv=p,Dv}var Fv,yT;function PW(){if(yT)return Fv;yT=1;var e=vb(),t=LW(),n=sf(),r=af(),a=n(function(l,c){if(l==null)return[];var u=c.length;return u>1&&r(l,c[0],c[1])?c=[]:u>2&&r(c[0],c[1],c[2])&&(c=[c[0]]),t(l,e(c,1),[])});return Fv=a,Fv}var qv,wT;function DW(){if(wT)return qv;wT=1;var e=LM(),t=0;function n(r){var a=++t;return e(r)+a}return qv=n,qv}var Bv,vT;function FW(){if(vT)return Bv;vT=1;function e(t,n,r){for(var a=-1,l=t.length,c=n.length,u={};++a<l;){var f=a<c?n[a]:void 0;r(u,t[a],f)}return u}return Bv=e,Bv}var zv,xT;function qW(){if(xT)return zv;xT=1;var e=Yh(),t=FW();function n(r,a){return t(r||[],a||[],e)}return zv=n,zv}var Hv,bT;function It(){if(bT)return Hv;bT=1;var e;if(typeof sb=="function")try{e={cloneDeep:nW(),constant:pb(),defaults:rW(),each:TM(),filter:qM(),find:uW(),flatten:rI(),forEach:CM(),forIn:dW(),has:BM(),isUndefined:zM(),last:hW(),map:UM(),mapValues:fW(),max:mW(),merge:bW(),min:kW(),minBy:NW(),now:_W(),pick:TW(),range:MW(),reduce:WM(),sortBy:PW(),uniqueId:DW(),values:XM(),zipObject:qW()}}catch{}return e||(e=window._),Hv=e,Hv}var Uv,kT;function BW(){if(kT)return Uv;kT=1,Uv=e;function e(){var r={};r._next=r._prev=r,this._sentinel=r}e.prototype.dequeue=function(){var r=this._sentinel,a=r._prev;if(a!==r)return t(a),a},e.prototype.enqueue=function(r){var a=this._sentinel;r._prev&&r._next&&t(r),r._next=a._next,a._next._prev=r,a._next=r,r._prev=a},e.prototype.toString=function(){for(var r=[],a=this._sentinel,l=a._prev;l!==a;)r.push(JSON.stringify(l,n)),l=l._prev;return"["+r.join(", ")+"]"};function t(r){r._prev._next=r._next,r._next._prev=r._prev,delete r._next,delete r._prev}function n(r,a){if(r!=="_next"&&r!=="_prev")return a}return Uv}var Wv,NT;function zW(){if(NT)return Wv;NT=1;var e=It(),t=Gr().Graph,n=BW();Wv=a;var r=e.constant(1);function a(p,h){if(p.nodeCount()<=1)return[];var m=u(p,h||r),y=l(m.graph,m.buckets,m.zeroIdx);return e.flatten(e.map(y,function(w){return p.outEdges(w.v,w.w)}),!0)}function l(p,h,m){for(var y=[],w=h[h.length-1],_=h[0],k;p.nodeCount();){for(;k=_.dequeue();)c(p,h,m,k);for(;k=w.dequeue();)c(p,h,m,k);if(p.nodeCount()){for(var j=h.length-2;j>0;--j)if(k=h[j].dequeue(),k){y=y.concat(c(p,h,m,k,!0));break}}}return y}function c(p,h,m,y,w){var _=w?[]:void 0;return e.forEach(p.inEdges(y.v),function(k){var j=p.edge(k),b=p.node(k.v);w&&_.push({v:k.v,w:k.w}),b.out-=j,f(h,m,b)}),e.forEach(p.outEdges(y.v),function(k){var j=p.edge(k),b=k.w,S=p.node(b);S.in-=j,f(h,m,S)}),p.removeNode(y.v),_}function u(p,h){var m=new t,y=0,w=0;e.forEach(p.nodes(),function(j){m.setNode(j,{v:j,in:0,out:0})}),e.forEach(p.edges(),function(j){var b=m.edge(j.v,j.w)||0,S=h(j),E=b+S;m.setEdge(j.v,j.w,E),w=Math.max(w,m.node(j.v).out+=S),y=Math.max(y,m.node(j.w).in+=S)});var _=e.range(w+y+3).map(function(){return new n}),k=y+1;return e.forEach(m.nodes(),function(j){f(_,k,m.node(j))}),{graph:m,buckets:_,zeroIdx:k}}function f(p,h,m){m.out?m.in?p[m.out-m.in+h].enqueue(m):p[p.length-1].enqueue(m):p[0].enqueue(m)}return Wv}var Vv,_T;function HW(){if(_T)return Vv;_T=1;var e=It(),t=zW();Vv={run:n,undo:a};function n(l){var c=l.graph().acyclicer==="greedy"?t(l,u(l)):r(l);e.forEach(c,function(f){var p=l.edge(f);l.removeEdge(f),p.forwardName=f.name,p.reversed=!0,l.setEdge(f.w,f.v,p,e.uniqueId("rev"))});function u(f){return function(p){return f.edge(p).weight}}}function r(l){var c=[],u={},f={};function p(h){e.has(f,h)||(f[h]=!0,u[h]=!0,e.forEach(l.outEdges(h),function(m){e.has(u,m.w)?c.push(m):p(m.w)}),delete u[h])}return e.forEach(l.nodes(),p),c}function a(l){e.forEach(l.edges(),function(c){var u=l.edge(c);if(u.reversed){l.removeEdge(c);var f=u.forwardName;delete u.reversed,delete u.forwardName,l.setEdge(c.w,c.v,u,f)}})}return Vv}var Gv,ST;function Wn(){if(ST)return Gv;ST=1;var e=It(),t=Gr().Graph;Gv={addDummyNode:n,simplify:r,asNonCompoundGraph:a,successorWeights:l,predecessorWeights:c,intersectRect:u,buildLayerMatrix:f,normalizeRanks:p,removeEmptyRanks:h,addBorderNode:m,maxRank:y,partition:w,time:_,notime:k};function n(j,b,S,E){var C;do C=e.uniqueId(E);while(j.hasNode(C));return S.dummy=b,j.setNode(C,S),C}function r(j){var b=new t().setGraph(j.graph());return e.forEach(j.nodes(),function(S){b.setNode(S,j.node(S))}),e.forEach(j.edges(),function(S){var E=b.edge(S.v,S.w)||{weight:0,minlen:1},C=j.edge(S);b.setEdge(S.v,S.w,{weight:E.weight+C.weight,minlen:Math.max(E.minlen,C.minlen)})}),b}function a(j){var b=new t({multigraph:j.isMultigraph()}).setGraph(j.graph());return e.forEach(j.nodes(),function(S){j.children(S).length||b.setNode(S,j.node(S))}),e.forEach(j.edges(),function(S){b.setEdge(S,j.edge(S))}),b}function l(j){var b=e.map(j.nodes(),function(S){var E={};return e.forEach(j.outEdges(S),function(C){E[C.w]=(E[C.w]||0)+j.edge(C).weight}),E});return e.zipObject(j.nodes(),b)}function c(j){var b=e.map(j.nodes(),function(S){var E={};return e.forEach(j.inEdges(S),function(C){E[C.v]=(E[C.v]||0)+j.edge(C).weight}),E});return e.zipObject(j.nodes(),b)}function u(j,b){var S=j.x,E=j.y,C=b.x-S,T=b.y-E,R=j.width/2,A=j.height/2;if(!C&&!T)throw new Error("Not possible to find intersection inside of the rectangle");var q,F;return Math.abs(T)*R>Math.abs(C)*A?(T<0&&(A=-A),q=A*C/T,F=A):(C<0&&(R=-R),q=R,F=R*T/C),{x:S+q,y:E+F}}function f(j){var b=e.map(e.range(y(j)+1),function(){return[]});return e.forEach(j.nodes(),function(S){var E=j.node(S),C=E.rank;e.isUndefined(C)||(b[C][E.order]=S)}),b}function p(j){var b=e.min(e.map(j.nodes(),function(S){return j.node(S).rank}));e.forEach(j.nodes(),function(S){var E=j.node(S);e.has(E,"rank")&&(E.rank-=b)})}function h(j){var b=e.min(e.map(j.nodes(),function(T){return j.node(T).rank})),S=[];e.forEach(j.nodes(),function(T){var R=j.node(T).rank-b;S[R]||(S[R]=[]),S[R].push(T)});var E=0,C=j.graph().nodeRankFactor;e.forEach(S,function(T,R){e.isUndefined(T)&&R%C!==0?--E:E&&e.forEach(T,function(A){j.node(A).rank+=E})})}function m(j,b,S,E){var C={width:0,height:0};return arguments.length>=4&&(C.rank=S,C.order=E),n(j,"border",C,b)}function y(j){return e.max(e.map(j.nodes(),function(b){var S=j.node(b).rank;if(!e.isUndefined(S))return S}))}function w(j,b){var S={lhs:[],rhs:[]};return e.forEach(j,function(E){b(E)?S.lhs.push(E):S.rhs.push(E)}),S}function _(j,b){var S=e.now();try{return b()}finally{console.log(j+" time: "+(e.now()-S)+"ms")}}function k(j,b){return b()}return Gv}var Kv,jT;function UW(){if(jT)return Kv;jT=1;var e=It(),t=Wn();Kv={run:n,undo:a};function n(l){l.graph().dummyChains=[],e.forEach(l.edges(),function(c){r(l,c)})}function r(l,c){var u=c.v,f=l.node(u).rank,p=c.w,h=l.node(p).rank,m=c.name,y=l.edge(c),w=y.labelRank;if(h!==f+1){l.removeEdge(c);var _,k,j;for(j=0,++f;f<h;++j,++f)y.points=[],k={width:0,height:0,edgeLabel:y,edgeObj:c,rank:f},_=t.addDummyNode(l,"edge",k,"_d"),f===w&&(k.width=y.width,k.height=y.height,k.dummy="edge-label",k.labelpos=y.labelpos),l.setEdge(u,_,{weight:y.weight},m),j===0&&l.graph().dummyChains.push(_),u=_;l.setEdge(u,p,{weight:y.weight},m)}}function a(l){e.forEach(l.graph().dummyChains,function(c){var u=l.node(c),f=u.edgeLabel,p;for(l.setEdge(u.edgeObj,f);u.dummy;)p=l.successors(c)[0],l.removeNode(c),f.points.push({x:u.x,y:u.y}),u.dummy==="edge-label"&&(f.x=u.x,f.y=u.y,f.width=u.width,f.height=u.height),c=p,u=l.node(c)})}return Kv}var Yv,ET;function xh(){if(ET)return Yv;ET=1;var e=It();Yv={longestPath:t,slack:n};function t(r){var a={};function l(c){var u=r.node(c);if(e.has(a,c))return u.rank;a[c]=!0;var f=e.min(e.map(r.outEdges(c),function(p){return l(p.w)-r.edge(p).minlen}));return(f===Number.POSITIVE_INFINITY||f===void 0||f===null)&&(f=0),u.rank=f}e.forEach(r.sources(),l)}function n(r,a){return r.node(a.w).rank-r.node(a.v).rank-r.edge(a).minlen}return Yv}var Xv,CT;function iI(){if(CT)return Xv;CT=1;var e=It(),t=Gr().Graph,n=xh().slack;Xv=r;function r(u){var f=new t({directed:!1}),p=u.nodes()[0],h=u.nodeCount();f.setNode(p,{});for(var m,y;a(f,u)<h;)m=l(f,u),y=f.hasNode(m.v)?n(u,m):-n(u,m),c(f,u,y);return f}function a(u,f){function p(h){e.forEach(f.nodeEdges(h),function(m){var y=m.v,w=h===y?m.w:y;!u.hasNode(w)&&!n(f,m)&&(u.setNode(w,{}),u.setEdge(h,w,{}),p(w))})}return e.forEach(u.nodes(),p),u.nodeCount()}function l(u,f){return e.minBy(f.edges(),function(p){if(u.hasNode(p.v)!==u.hasNode(p.w))return n(f,p)})}function c(u,f,p){e.forEach(u.nodes(),function(h){f.node(h).rank+=p})}return Xv}var Zv,TT;function WW(){if(TT)return Zv;TT=1;var e=It(),t=iI(),n=xh().slack,r=xh().longestPath,a=Gr().alg.preorder,l=Gr().alg.postorder,c=Wn().simplify;Zv=u,u.initLowLimValues=m,u.initCutValues=f,u.calcCutValue=h,u.leaveEdge=w,u.enterEdge=_,u.exchangeEdges=k;function u(E){E=c(E),r(E);var C=t(E);m(C),f(C,E);for(var T,R;T=w(C);)R=_(C,E,T),k(C,E,T,R)}function f(E,C){var T=l(E,E.nodes());T=T.slice(0,T.length-1),e.forEach(T,function(R){p(E,C,R)})}function p(E,C,T){var R=E.node(T),A=R.parent;E.edge(T,A).cutvalue=h(E,C,T)}function h(E,C,T){var R=E.node(T),A=R.parent,q=!0,F=C.edge(T,A),O=0;return F||(q=!1,F=C.edge(A,T)),O=F.weight,e.forEach(C.nodeEdges(T),function(H){var K=H.v===T,X=K?H.w:H.v;if(X!==A){var I=K===q,Z=C.edge(H).weight;if(O+=I?Z:-Z,b(E,T,X)){var W=E.edge(T,X).cutvalue;O+=I?-W:W}}}),O}function m(E,C){arguments.length<2&&(C=E.nodes()[0]),y(E,{},1,C)}function y(E,C,T,R,A){var q=T,F=E.node(R);return C[R]=!0,e.forEach(E.neighbors(R),function(O){e.has(C,O)||(T=y(E,C,T,O,R))}),F.low=q,F.lim=T++,A?F.parent=A:delete F.parent,T}function w(E){return e.find(E.edges(),function(C){return E.edge(C).cutvalue<0})}function _(E,C,T){var R=T.v,A=T.w;C.hasEdge(R,A)||(R=T.w,A=T.v);var q=E.node(R),F=E.node(A),O=q,H=!1;q.lim>F.lim&&(O=F,H=!0);var K=e.filter(C.edges(),function(X){return H===S(E,E.node(X.v),O)&&H!==S(E,E.node(X.w),O)});return e.minBy(K,function(X){return n(C,X)})}function k(E,C,T,R){var A=T.v,q=T.w;E.removeEdge(A,q),E.setEdge(R.v,R.w,{}),m(E),f(E,C),j(E,C)}function j(E,C){var T=e.find(E.nodes(),function(A){return!C.node(A).parent}),R=a(E,T);R=R.slice(1),e.forEach(R,function(A){var q=E.node(A).parent,F=C.edge(A,q),O=!1;F||(F=C.edge(q,A),O=!0),C.node(A).rank=C.node(q).rank+(O?F.minlen:-F.minlen)})}function b(E,C,T){return E.hasEdge(C,T)}function S(E,C,T){return T.low<=C.lim&&C.lim<=T.lim}return Zv}var Qv,AT;function VW(){if(AT)return Qv;AT=1;var e=xh(),t=e.longestPath,n=iI(),r=WW();Qv=a;function a(f){switch(f.graph().ranker){case"network-simplex":u(f);break;case"tight-tree":c(f);break;case"longest-path":l(f);break;default:u(f)}}var l=t;function c(f){t(f),n(f)}function u(f){r(f)}return Qv}var Jv,RT;function GW(){if(RT)return Jv;RT=1;var e=It();Jv=t;function t(a){var l=r(a);e.forEach(a.graph().dummyChains,function(c){for(var u=a.node(c),f=u.edgeObj,p=n(a,l,f.v,f.w),h=p.path,m=p.lca,y=0,w=h[y],_=!0;c!==f.w;){if(u=a.node(c),_){for(;(w=h[y])!==m&&a.node(w).maxRank<u.rank;)y++;w===m&&(_=!1)}if(!_){for(;y<h.length-1&&a.node(w=h[y+1]).minRank<=u.rank;)y++;w=h[y]}a.setParent(c,w),c=a.successors(c)[0]}})}function n(a,l,c,u){var f=[],p=[],h=Math.min(l[c].low,l[u].low),m=Math.max(l[c].lim,l[u].lim),y,w;y=c;do y=a.parent(y),f.push(y);while(y&&(l[y].low>h||m>l[y].lim));for(w=y,y=u;(y=a.parent(y))!==w;)p.push(y);return{path:f.concat(p.reverse()),lca:w}}function r(a){var l={},c=0;function u(f){var p=c;e.forEach(a.children(f),u),l[f]={low:p,lim:c++}}return e.forEach(a.children(),u),l}return Jv}var ex,MT;function KW(){if(MT)return ex;MT=1;var e=It(),t=Wn();ex={run:n,cleanup:c};function n(u){var f=t.addDummyNode(u,"root",{},"_root"),p=a(u),h=e.max(e.values(p))-1,m=2*h+1;u.graph().nestingRoot=f,e.forEach(u.edges(),function(w){u.edge(w).minlen*=m});var y=l(u)+1;e.forEach(u.children(),function(w){r(u,f,m,y,h,p,w)}),u.graph().nodeRankFactor=m}function r(u,f,p,h,m,y,w){var _=u.children(w);if(!_.length){w!==f&&u.setEdge(f,w,{weight:0,minlen:p});return}var k=t.addBorderNode(u,"_bt"),j=t.addBorderNode(u,"_bb"),b=u.node(w);u.setParent(k,w),b.borderTop=k,u.setParent(j,w),b.borderBottom=j,e.forEach(_,function(S){r(u,f,p,h,m,y,S);var E=u.node(S),C=E.borderTop?E.borderTop:S,T=E.borderBottom?E.borderBottom:S,R=E.borderTop?h:2*h,A=C!==T?1:m-y[w]+1;u.setEdge(k,C,{weight:R,minlen:A,nestingEdge:!0}),u.setEdge(T,j,{weight:R,minlen:A,nestingEdge:!0})}),u.parent(w)||u.setEdge(f,k,{weight:0,minlen:m+y[w]})}function a(u){var f={};function p(h,m){var y=u.children(h);y&&y.length&&e.forEach(y,function(w){p(w,m+1)}),f[h]=m}return e.forEach(u.children(),function(h){p(h,1)}),f}function l(u){return e.reduce(u.edges(),function(f,p){return f+u.edge(p).weight},0)}function c(u){var f=u.graph();u.removeNode(f.nestingRoot),delete f.nestingRoot,e.forEach(u.edges(),function(p){var h=u.edge(p);h.nestingEdge&&u.removeEdge(p)})}return ex}var tx,IT;function YW(){if(IT)return tx;IT=1;var e=It(),t=Wn();tx=n;function n(a){function l(c){var u=a.children(c),f=a.node(c);if(u.length&&e.forEach(u,l),e.has(f,"minRank")){f.borderLeft=[],f.borderRight=[];for(var p=f.minRank,h=f.maxRank+1;p<h;++p)r(a,"borderLeft","_bl",c,f,p),r(a,"borderRight","_br",c,f,p)}}e.forEach(a.children(),l)}function r(a,l,c,u,f,p){var h={width:0,height:0,rank:p,borderType:l},m=f[l][p-1],y=t.addDummyNode(a,"border",h,c);f[l][p]=y,a.setParent(y,u),m&&a.setEdge(m,y,{weight:1})}return tx}var nx,$T;function XW(){if($T)return nx;$T=1;var e=It();nx={adjust:t,undo:n};function t(p){var h=p.graph().rankdir.toLowerCase();(h==="lr"||h==="rl")&&r(p)}function n(p){var h=p.graph().rankdir.toLowerCase();(h==="bt"||h==="rl")&&l(p),(h==="lr"||h==="rl")&&(u(p),r(p))}function r(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 l(p){e.forEach(p.nodes(),function(h){c(p.node(h))}),e.forEach(p.edges(),function(h){var m=p.edge(h);e.forEach(m.points,c),e.has(m,"y")&&c(m)})}function c(p){p.y=-p.y}function u(p){e.forEach(p.nodes(),function(h){f(p.node(h))}),e.forEach(p.edges(),function(h){var m=p.edge(h);e.forEach(m.points,f),e.has(m,"x")&&f(m)})}function f(p){var h=p.x;p.x=p.y,p.y=h}return nx}var rx,OT;function ZW(){if(OT)return rx;OT=1;var e=It();rx=t;function t(n){var r={},a=e.filter(n.nodes(),function(p){return!n.children(p).length}),l=e.max(e.map(a,function(p){return n.node(p).rank})),c=e.map(e.range(l+1),function(){return[]});function u(p){if(!e.has(r,p)){r[p]=!0;var h=n.node(p);c[h.rank].push(p),e.forEach(n.successors(p),u)}}var f=e.sortBy(a,function(p){return n.node(p).rank});return e.forEach(f,u),c}return rx}var sx,LT;function QW(){if(LT)return sx;LT=1;var e=It();sx=t;function t(r,a){for(var l=0,c=1;c<a.length;++c)l+=n(r,a[c-1],a[c]);return l}function n(r,a,l){for(var c=e.zipObject(l,e.map(l,function(y,w){return w})),u=e.flatten(e.map(a,function(y){return e.sortBy(e.map(r.outEdges(y),function(w){return{pos:c[w.w],weight:r.edge(w).weight}}),"pos")}),!0),f=1;f<l.length;)f<<=1;var p=2*f-1;f-=1;var h=e.map(new Array(p),function(){return 0}),m=0;return e.forEach(u.forEach(function(y){var w=y.pos+f;h[w]+=y.weight;for(var _=0;w>0;)w%2&&(_+=h[w+1]),w=w-1>>1,h[w]+=y.weight;m+=y.weight*_})),m}return sx}var ax,PT;function JW(){if(PT)return ax;PT=1;var e=It();ax=t;function t(n,r){return e.map(r,function(a){var l=n.inEdges(a);if(l.length){var c=e.reduce(l,function(u,f){var p=n.edge(f),h=n.node(f.v);return{sum:u.sum+p.weight*h.order,weight:u.weight+p.weight}},{sum:0,weight:0});return{v:a,barycenter:c.sum/c.weight,weight:c.weight}}else return{v:a}})}return ax}var ox,DT;function e7(){if(DT)return ox;DT=1;var e=It();ox=t;function t(a,l){var c={};e.forEach(a,function(f,p){var h=c[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(l.edges(),function(f){var p=c[f.v],h=c[f.w];!e.isUndefined(p)&&!e.isUndefined(h)&&(h.indegree++,p.out.push(c[f.w]))});var u=e.filter(c,function(f){return!f.indegree});return n(u)}function n(a){var l=[];function c(p){return function(h){h.merged||(e.isUndefined(h.barycenter)||e.isUndefined(p.barycenter)||h.barycenter>=p.barycenter)&&r(p,h)}}function u(p){return function(h){h.in.push(p),--h.indegree===0&&a.push(h)}}for(;a.length;){var f=a.pop();l.push(f),e.forEach(f.in.reverse(),c(f)),e.forEach(f.out,u(f))}return e.map(e.filter(l,function(p){return!p.merged}),function(p){return e.pick(p,["vs","i","barycenter","weight"])})}function r(a,l){var c=0,u=0;a.weight&&(c+=a.barycenter*a.weight,u+=a.weight),l.weight&&(c+=l.barycenter*l.weight,u+=l.weight),a.vs=l.vs.concat(a.vs),a.barycenter=c/u,a.weight=u,a.i=Math.min(l.i,a.i),l.merged=!0}return ox}var ix,FT;function t7(){if(FT)return ix;FT=1;var e=It(),t=Wn();ix=n;function n(l,c){var u=t.partition(l,function(k){return e.has(k,"barycenter")}),f=u.lhs,p=e.sortBy(u.rhs,function(k){return-k.i}),h=[],m=0,y=0,w=0;f.sort(a(!!c)),w=r(h,p,w),e.forEach(f,function(k){w+=k.vs.length,h.push(k.vs),m+=k.barycenter*k.weight,y+=k.weight,w=r(h,p,w)});var _={vs:e.flatten(h,!0)};return y&&(_.barycenter=m/y,_.weight=y),_}function r(l,c,u){for(var f;c.length&&(f=e.last(c)).i<=u;)c.pop(),l.push(f.vs),u++;return u}function a(l){return function(c,u){return c.barycenter<u.barycenter?-1:c.barycenter>u.barycenter?1:l?u.i-c.i:c.i-u.i}}return ix}var lx,qT;function n7(){if(qT)return lx;qT=1;var e=It(),t=JW(),n=e7(),r=t7();lx=a;function a(u,f,p,h){var m=u.children(f),y=u.node(f),w=y?y.borderLeft:void 0,_=y?y.borderRight:void 0,k={};w&&(m=e.filter(m,function(T){return T!==w&&T!==_}));var j=t(u,m);e.forEach(j,function(T){if(u.children(T.v).length){var R=a(u,T.v,p,h);k[T.v]=R,e.has(R,"barycenter")&&c(T,R)}});var b=n(j,p);l(b,k);var S=r(b,h);if(w&&(S.vs=e.flatten([w,S.vs,_],!0),u.predecessors(w).length)){var E=u.node(u.predecessors(w)[0]),C=u.node(u.predecessors(_)[0]);e.has(S,"barycenter")||(S.barycenter=0,S.weight=0),S.barycenter=(S.barycenter*S.weight+E.order+C.order)/(S.weight+2),S.weight+=2}return S}function l(u,f){e.forEach(u,function(p){p.vs=e.flatten(p.vs.map(function(h){return f[h]?f[h].vs:h}),!0)})}function c(u,f){e.isUndefined(u.barycenter)?(u.barycenter=f.barycenter,u.weight=f.weight):(u.barycenter=(u.barycenter*u.weight+f.barycenter*f.weight)/(u.weight+f.weight),u.weight+=f.weight)}return lx}var cx,BT;function r7(){if(BT)return cx;BT=1;var e=It(),t=Gr().Graph;cx=n;function n(a,l,c){var u=r(a),f=new t({compound:!0}).setGraph({root:u}).setDefaultNodeLabel(function(p){return a.node(p)});return e.forEach(a.nodes(),function(p){var h=a.node(p),m=a.parent(p);(h.rank===l||h.minRank<=l&&l<=h.maxRank)&&(f.setNode(p),f.setParent(p,m||u),e.forEach(a[c](p),function(y){var w=y.v===p?y.w:y.v,_=f.edge(w,p),k=e.isUndefined(_)?0:_.weight;f.setEdge(w,p,{weight:a.edge(y).weight+k})}),e.has(h,"minRank")&&f.setNode(p,{borderLeft:h.borderLeft[l],borderRight:h.borderRight[l]}))}),f}function r(a){for(var l;a.hasNode(l=e.uniqueId("_root")););return l}return cx}var ux,zT;function s7(){if(zT)return ux;zT=1;var e=It();ux=t;function t(n,r,a){var l={},c;e.forEach(a,function(u){for(var f=n.parent(u),p,h;f;){if(p=n.parent(f),p?(h=l[p],l[p]=f):(h=c,c=f),h&&h!==f){r.setEdge(h,f);return}f=p}})}return ux}var dx,HT;function a7(){if(HT)return dx;HT=1;var e=It(),t=ZW(),n=QW(),r=n7(),a=r7(),l=s7(),c=Gr().Graph,u=Wn();dx=f;function f(y){var w=u.maxRank(y),_=p(y,e.range(1,w+1),"inEdges"),k=p(y,e.range(w-1,-1,-1),"outEdges"),j=t(y);m(y,j);for(var b=Number.POSITIVE_INFINITY,S,E=0,C=0;C<4;++E,++C){h(E%2?_:k,E%4>=2),j=u.buildLayerMatrix(y);var T=n(y,j);T<b&&(C=0,S=e.cloneDeep(j),b=T)}m(y,S)}function p(y,w,_){return e.map(w,function(k){return a(y,k,_)})}function h(y,w){var _=new c;e.forEach(y,function(k){var j=k.graph().root,b=r(k,j,_,w);e.forEach(b.vs,function(S,E){k.node(S).order=E}),l(k,_,b.vs)})}function m(y,w){e.forEach(w,function(_){e.forEach(_,function(k,j){y.node(k).order=j})})}return dx}var hx,UT;function o7(){if(UT)return hx;UT=1;var e=It(),t=Gr().Graph,n=Wn();hx={positionX:_,findType1Conflicts:r,findType2Conflicts:a,addConflict:c,hasConflict:u,verticalAlignment:f,horizontalCompaction:p,alignCoordinates:y,findSmallestWidthAlignment:m,balance:w};function r(b,S){var E={};function C(T,R){var A=0,q=0,F=T.length,O=e.last(R);return e.forEach(R,function(H,K){var X=l(b,H),I=X?b.node(X).order:F;(X||H===O)&&(e.forEach(R.slice(q,K+1),function(Z){e.forEach(b.predecessors(Z),function(W){var $=b.node(W),z=$.order;(z<A||I<z)&&!($.dummy&&b.node(Z).dummy)&&c(E,W,Z)})}),q=K+1,A=I)}),R}return e.reduce(S,C),E}function a(b,S){var E={};function C(R,A,q,F,O){var H;e.forEach(e.range(A,q),function(K){H=R[K],b.node(H).dummy&&e.forEach(b.predecessors(H),function(X){var I=b.node(X);I.dummy&&(I.order<F||I.order>O)&&c(E,X,H)})})}function T(R,A){var q=-1,F,O=0;return e.forEach(A,function(H,K){if(b.node(H).dummy==="border"){var X=b.predecessors(H);X.length&&(F=b.node(X[0]).order,C(A,O,K,q,F),O=K,q=F)}C(A,O,A.length,F,R.length)}),A}return e.reduce(S,T),E}function l(b,S){if(b.node(S).dummy)return e.find(b.predecessors(S),function(E){return b.node(E).dummy})}function c(b,S,E){if(S>E){var C=S;S=E,E=C}var T=b[S];T||(b[S]=T={}),T[E]=!0}function u(b,S,E){if(S>E){var C=S;S=E,E=C}return e.has(b[S],E)}function f(b,S,E,C){var T={},R={},A={};return e.forEach(S,function(q){e.forEach(q,function(F,O){T[F]=F,R[F]=F,A[F]=O})}),e.forEach(S,function(q){var F=-1;e.forEach(q,function(O){var H=C(O);if(H.length){H=e.sortBy(H,function(W){return A[W]});for(var K=(H.length-1)/2,X=Math.floor(K),I=Math.ceil(K);X<=I;++X){var Z=H[X];R[O]===O&&F<A[Z]&&!u(E,O,Z)&&(R[Z]=O,R[O]=T[O]=T[Z],F=A[Z])}}})}),{root:T,align:R}}function p(b,S,E,C,T){var R={},A=h(b,S,E,T),q=T?"borderLeft":"borderRight";function F(K,X){for(var I=A.nodes(),Z=I.pop(),W={};Z;)W[Z]?K(Z):(W[Z]=!0,I.push(Z),I=I.concat(X(Z))),Z=I.pop()}function O(K){R[K]=A.inEdges(K).reduce(function(X,I){return Math.max(X,R[I.v]+A.edge(I))},0)}function H(K){var X=A.outEdges(K).reduce(function(Z,W){return Math.min(Z,R[W.w]-A.edge(W))},Number.POSITIVE_INFINITY),I=b.node(K);X!==Number.POSITIVE_INFINITY&&I.borderType!==q&&(R[K]=Math.max(R[K],X))}return F(O,A.predecessors.bind(A)),F(H,A.successors.bind(A)),e.forEach(C,function(K){R[K]=R[E[K]]}),R}function h(b,S,E,C){var T=new t,R=b.graph(),A=k(R.nodesep,R.edgesep,C);return e.forEach(S,function(q){var F;e.forEach(q,function(O){var H=E[O];if(T.setNode(H),F){var K=E[F],X=T.edge(K,H);T.setEdge(K,H,Math.max(A(b,O,F),X||0))}F=O})}),T}function m(b,S){return e.minBy(e.values(S),function(E){var C=Number.NEGATIVE_INFINITY,T=Number.POSITIVE_INFINITY;return e.forIn(E,function(R,A){var q=j(b,A)/2;C=Math.max(R+q,C),T=Math.min(R-q,T)}),C-T})}function y(b,S){var E=e.values(S),C=e.min(E),T=e.max(E);e.forEach(["u","d"],function(R){e.forEach(["l","r"],function(A){var q=R+A,F=b[q],O;if(F!==S){var H=e.values(F);O=A==="l"?C-e.min(H):T-e.max(H),O&&(b[q]=e.mapValues(F,function(K){return K+O}))}})})}function w(b,S){return e.mapValues(b.ul,function(E,C){if(S)return b[S.toLowerCase()][C];var T=e.sortBy(e.map(b,C));return(T[1]+T[2])/2})}function _(b){var S=n.buildLayerMatrix(b),E=e.merge(r(b,S),a(b,S)),C={},T;e.forEach(["u","d"],function(A){T=A==="u"?S:e.values(S).reverse(),e.forEach(["l","r"],function(q){q==="r"&&(T=e.map(T,function(K){return e.values(K).reverse()}));var F=(A==="u"?b.predecessors:b.successors).bind(b),O=f(b,T,E,F),H=p(b,T,O.root,O.align,q==="r");q==="r"&&(H=e.mapValues(H,function(K){return-K})),C[A+q]=H})});var R=m(b,C);return y(C,R),w(C,b.graph().align)}function k(b,S,E){return function(C,T,R){var A=C.node(T),q=C.node(R),F=0,O;if(F+=A.width/2,e.has(A,"labelpos"))switch(A.labelpos.toLowerCase()){case"l":O=-A.width/2;break;case"r":O=A.width/2;break}if(O&&(F+=E?O:-O),O=0,F+=(A.dummy?S:b)/2,F+=(q.dummy?S:b)/2,F+=q.width/2,e.has(q,"labelpos"))switch(q.labelpos.toLowerCase()){case"l":O=q.width/2;break;case"r":O=-q.width/2;break}return O&&(F+=E?O:-O),O=0,F}}function j(b,S){return b.node(S).width}return hx}var fx,WT;function i7(){if(WT)return fx;WT=1;var e=It(),t=Wn(),n=o7().positionX;fx=r;function r(l){l=t.asNonCompoundGraph(l),a(l),e.forEach(n(l),function(c,u){l.node(u).x=c})}function a(l){var c=t.buildLayerMatrix(l),u=l.graph().ranksep,f=0;e.forEach(c,function(p){var h=e.max(e.map(p,function(m){return l.node(m).height}));e.forEach(p,function(m){l.node(m).y=f+h/2}),f+=h+u})}return fx}var px,VT;function l7(){if(VT)return px;VT=1;var e=It(),t=HW(),n=UW(),r=VW(),a=Wn().normalizeRanks,l=GW(),c=Wn().removeEmptyRanks,u=KW(),f=YW(),p=XW(),h=a7(),m=i7(),y=Wn(),w=Gr().Graph;px=_;function _(G,ee){var L=ee&&ee.debugTiming?y.time:y.notime;L("layout",function(){var te=L(" buildLayoutGraph",function(){return F(G)});L(" runLayout",function(){k(te,L)}),L(" updateInputGraph",function(){j(G,te)})})}function k(G,ee){ee(" makeSpaceForEdgeLabels",function(){O(G)}),ee(" removeSelfEdges",function(){U(G)}),ee(" acyclic",function(){t.run(G)}),ee(" nestingGraph.run",function(){u.run(G)}),ee(" rank",function(){r(y.asNonCompoundGraph(G))}),ee(" injectEdgeLabelProxies",function(){H(G)}),ee(" removeEmptyRanks",function(){c(G)}),ee(" nestingGraph.cleanup",function(){u.cleanup(G)}),ee(" normalizeRanks",function(){a(G)}),ee(" assignRankMinMax",function(){K(G)}),ee(" removeEdgeLabelProxies",function(){X(G)}),ee(" normalize.run",function(){n.run(G)}),ee(" parentDummyChains",function(){l(G)}),ee(" addBorderSegments",function(){f(G)}),ee(" order",function(){h(G)}),ee(" insertSelfEdges",function(){V(G)}),ee(" adjustCoordinateSystem",function(){p.adjust(G)}),ee(" position",function(){m(G)}),ee(" positionSelfEdges",function(){B(G)}),ee(" removeBorderNodes",function(){z(G)}),ee(" normalize.undo",function(){n.undo(G)}),ee(" fixupEdgeLabelCoords",function(){W(G)}),ee(" undoCoordinateSystem",function(){p.undo(G)}),ee(" translateGraph",function(){I(G)}),ee(" assignNodeIntersects",function(){Z(G)}),ee(" reversePoints",function(){$(G)}),ee(" acyclic.undo",function(){t.undo(G)})}function j(G,ee){e.forEach(G.nodes(),function(L){var te=G.node(L),ne=ee.node(L);te&&(te.x=ne.x,te.y=ne.y,ee.children(L).length&&(te.width=ne.width,te.height=ne.height))}),e.forEach(G.edges(),function(L){var te=G.edge(L),ne=ee.edge(L);te.points=ne.points,e.has(ne,"x")&&(te.x=ne.x,te.y=ne.y)}),G.graph().width=ee.graph().width,G.graph().height=ee.graph().height}var b=["nodesep","edgesep","ranksep","marginx","marginy"],S={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},E=["acyclicer","ranker","rankdir","align"],C=["width","height"],T={width:0,height:0},R=["minlen","weight","width","height","labeloffset"],A={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},q=["labelpos"];function F(G){var ee=new w({multigraph:!0,compound:!0}),L=ue(G.graph());return ee.setGraph(e.merge({},S,Y(L,b),e.pick(L,E))),e.forEach(G.nodes(),function(te){var ne=ue(G.node(te));ee.setNode(te,e.defaults(Y(ne,C),T)),ee.setParent(te,G.parent(te))}),e.forEach(G.edges(),function(te){var ne=ue(G.edge(te));ee.setEdge(te,e.merge({},A,Y(ne,R),e.pick(ne,q)))}),ee}function O(G){var ee=G.graph();ee.ranksep/=2,e.forEach(G.edges(),function(L){var te=G.edge(L);te.minlen*=2,te.labelpos.toLowerCase()!=="c"&&(ee.rankdir==="TB"||ee.rankdir==="BT"?te.width+=te.labeloffset:te.height+=te.labeloffset)})}function H(G){e.forEach(G.edges(),function(ee){var L=G.edge(ee);if(L.width&&L.height){var te=G.node(ee.v),ne=G.node(ee.w),ie={rank:(ne.rank-te.rank)/2+te.rank,e:ee};y.addDummyNode(G,"edge-proxy",ie,"_ep")}})}function K(G){var ee=0;e.forEach(G.nodes(),function(L){var te=G.node(L);te.borderTop&&(te.minRank=G.node(te.borderTop).rank,te.maxRank=G.node(te.borderBottom).rank,ee=e.max(ee,te.maxRank))}),G.graph().maxRank=ee}function X(G){e.forEach(G.nodes(),function(ee){var L=G.node(ee);L.dummy==="edge-proxy"&&(G.edge(L.e).labelRank=L.rank,G.removeNode(ee))})}function I(G){var ee=Number.POSITIVE_INFINITY,L=0,te=Number.POSITIVE_INFINITY,ne=0,ie=G.graph(),me=ie.marginx||0,je=ie.marginy||0;function Oe(Ve){var Le=Ve.x,Te=Ve.y,nt=Ve.width,_e=Ve.height;ee=Math.min(ee,Le-nt/2),L=Math.max(L,Le+nt/2),te=Math.min(te,Te-_e/2),ne=Math.max(ne,Te+_e/2)}e.forEach(G.nodes(),function(Ve){Oe(G.node(Ve))}),e.forEach(G.edges(),function(Ve){var Le=G.edge(Ve);e.has(Le,"x")&&Oe(Le)}),ee-=me,te-=je,e.forEach(G.nodes(),function(Ve){var Le=G.node(Ve);Le.x-=ee,Le.y-=te}),e.forEach(G.edges(),function(Ve){var Le=G.edge(Ve);e.forEach(Le.points,function(Te){Te.x-=ee,Te.y-=te}),e.has(Le,"x")&&(Le.x-=ee),e.has(Le,"y")&&(Le.y-=te)}),ie.width=L-ee+me,ie.height=ne-te+je}function Z(G){e.forEach(G.edges(),function(ee){var L=G.edge(ee),te=G.node(ee.v),ne=G.node(ee.w),ie,me;L.points?(ie=L.points[0],me=L.points[L.points.length-1]):(L.points=[],ie=ne,me=te),L.points.unshift(y.intersectRect(te,ie)),L.points.push(y.intersectRect(ne,me))})}function W(G){e.forEach(G.edges(),function(ee){var L=G.edge(ee);if(e.has(L,"x"))switch((L.labelpos==="l"||L.labelpos==="r")&&(L.width-=L.labeloffset),L.labelpos){case"l":L.x-=L.width/2+L.labeloffset;break;case"r":L.x+=L.width/2+L.labeloffset;break}})}function $(G){e.forEach(G.edges(),function(ee){var L=G.edge(ee);L.reversed&&L.points.reverse()})}function z(G){e.forEach(G.nodes(),function(ee){if(G.children(ee).length){var L=G.node(ee),te=G.node(L.borderTop),ne=G.node(L.borderBottom),ie=G.node(e.last(L.borderLeft)),me=G.node(e.last(L.borderRight));L.width=Math.abs(me.x-ie.x),L.height=Math.abs(ne.y-te.y),L.x=ie.x+L.width/2,L.y=te.y+L.height/2}}),e.forEach(G.nodes(),function(ee){G.node(ee).dummy==="border"&&G.removeNode(ee)})}function U(G){e.forEach(G.edges(),function(ee){if(ee.v===ee.w){var L=G.node(ee.v);L.selfEdges||(L.selfEdges=[]),L.selfEdges.push({e:ee,label:G.edge(ee)}),G.removeEdge(ee)}})}function V(G){var ee=y.buildLayerMatrix(G);e.forEach(ee,function(L){var te=0;e.forEach(L,function(ne,ie){var me=G.node(ne);me.order=ie+te,e.forEach(me.selfEdges,function(je){y.addDummyNode(G,"selfedge",{width:je.label.width,height:je.label.height,rank:me.rank,order:ie+ ++te,e:je.e,label:je.label},"_se")}),delete me.selfEdges})})}function B(G){e.forEach(G.nodes(),function(ee){var L=G.node(ee);if(L.dummy==="selfedge"){var te=G.node(L.e.v),ne=te.x+te.width/2,ie=te.y,me=L.x-ne,je=te.height/2;G.setEdge(L.e,L.label),G.removeNode(ee),L.label.points=[{x:ne+2*me/3,y:ie-je},{x:ne+5*me/6,y:ie-je},{x:ne+me,y:ie},{x:ne+5*me/6,y:ie+je},{x:ne+2*me/3,y:ie+je}],L.label.x=L.x,L.label.y=L.y}})}function Y(G,ee){return e.mapValues(e.pick(G,ee),Number)}function ue(G){var ee={};return e.forEach(G,function(L,te){ee[te.toLowerCase()]=L}),ee}return px}var mx,GT;function c7(){if(GT)return mx;GT=1;var e=It(),t=Wn(),n=Gr().Graph;mx={debugOrdering:r};function r(a){var l=t.buildLayerMatrix(a),c=new n({compound:!0,multigraph:!0}).setGraph({});return e.forEach(a.nodes(),function(u){c.setNode(u,{label:u}),c.setParent(u,"layer"+a.node(u).rank)}),e.forEach(a.edges(),function(u){c.setEdge(u.v,u.w,{},u.name)}),e.forEach(l,function(u,f){var p="layer"+f;c.setNode(p,{rank:"same"}),e.reduce(u,function(h,m){return c.setEdge(h,m,{style:"invis"}),m})}),c}return mx}var gx,KT;function u7(){return KT||(KT=1,gx="0.8.5"),gx}var yx,YT;function d7(){return YT||(YT=1,yx={graphlib:Gr(),layout:l7(),debug:c7(),util:{time:Wn().time,notime:Wn().notime},version:u7()}),yx}var h7=d7();const XT=w0(h7),Uo=240,Xc=130,tl=74,of=72,Lc=tl+of;function lI(e,t){var r;let n=Uo;for(const a of e)n=Math.max(n,((r=t.get(a.id))==null?void 0:r.width)??Uo);return n}const bh=420,cI=1;function f7(e,t,n,r){return Math.min(cI,n/Math.max(1,e),r/Math.max(1,t))}function Wo(e){var n;return((n=e.data)==null?void 0:n.sessionId)??"_default"}function p7(e,t){return((t==null?void 0:t.get(e))??0)>0?bh:0}function m7(e,t){const n=(t==null?void 0:t.get(e))??0;return n>0?6+n*36:0}function Zc(e,t,n){const r=t.get(e);return{w:((r==null?void 0:r.width)??Uo)+p7(e,n),h:Math.max((r==null?void 0:r.height)??Xc,m7(e,n))}}function g7(e){return[...e.keys()].sort().map(t=>`${t}:${e.get(t)}`).join("|")}function y7(e,t,n,r,a,l){const c=new XT.graphlib.Graph;c.setDefaultEdgeLabel(()=>({})),c.setGraph({rankdir:n,marginx:0,marginy:0,nodesep:70,ranksep:160,edgesep:30});const u=e.filter(b=>!a.has(b)),f=new Set(u);for(const b of u){const{w:S,h:E}=Zc(b,r,l);c.setNode(b,{width:S,height:E})}for(const b of t)f.has(b.source)&&f.has(b.target)&&c.setEdge(b.source,b.target);XT.layout(c);const p=new Map;let h=1/0,m=1/0,y=-1/0,w=-1/0;for(const b of u){const S=c.node(b);if(!S)continue;const E=r.get(b),C=(E==null?void 0:E.width)??Uo,T=(E==null?void 0:E.height)??Xc,R=Zc(b,r,l),A=S.x-R.w/2,q=S.y-R.h/2;p.set(b,{x:A,y:q}),A<h&&(h=A),q<m&&(m=q),A+C>y&&(y=A+C),q+T>w&&(w=q+T)}if(Number.isFinite(h)&&Number.isFinite(m))for(const[b,S]of p)p.set(b,{x:S.x-h,y:S.y-m});const _=Number.isFinite(y)?y-h:0,k=Number.isFinite(w)?w-m:0;let j=null;for(const b of e){const S=a.get(b);if(!S)continue;const E=r.get(b),C=(E==null?void 0:E.width)??Uo,T=(E==null?void 0:E.height)??Xc;j=j===null?{minX:S.x,minY:S.y,maxX:S.x+C,maxY:S.y+T}:{minX:Math.min(j.minX,S.x),minY:Math.min(j.minY,S.y),maxX:Math.max(j.maxX,S.x+C),maxY:Math.max(j.maxY,S.y+T)}}return{positions:p,width:_,height:k,pinnedBox:j}}function uI(e,t,n){const r=n.direction??"LR",a=n.pinned??new Map,l=n.measured??new Map,c=n.lanes,u=new Map;for(const h of e){const m=Wo(h),y=u.get(m);y?y.push(h.id):u.set(m,[h.id])}return{laid:Array.from(u.keys()).sort().map(h=>({sid:h,...y7(u.get(h),t,r,l,a,c)})),gap:lI(e,l)}}const dI=e=>e.reduce((t,n)=>Math.max(t,n.width),0)+bh,w7=e=>e.reduce((t,n)=>t+n.height,0)+Lc*Math.max(0,e.length-1);function i0(e,t,n,r){const a=f=>{const p=[[]];let h=0;for(const m of e)h>0&&h+m.height>f&&(p.push([]),h=0),p[p.length-1].push(m),h+=m.height+Lc;return p},l=[];for(let f=0;f<e.length;f++){let p=-Lc;for(let h=f;h<e.length;h++)l.push(p+=e[h].height+Lc)}l.sort((f,p)=>f-p);const c=f=>{let p=0,h=l.length-1;for(;p<h;){const m=p+h>>1;a(l[m]).length<=f?h=m:p=m+1}return a(l[p])};let u=[e];if(n>0&&r>0){const f=h=>f7(h.reduce((m,y)=>m+dI(y),0)+t*(h.length-1),Math.max(...h.map(w7)),n,r);let p=f(u);for(let h=2;h<=e.length;h++){const m=c(h),y=f(m);y>p+1e-9&&(p=y,u=m)}}return u}function v7(e,t,n,r,a){if(!(r.width>0&&r.height>0&&a.width>0&&a.height>0))return!1;const{laid:l,gap:c}=uI(e,t,n);return l.length<2?!1:i0(l,c,r.width,r.height).length!==i0(l,c,a.width,a.height).length}function x7(e,t,n={}){const r=n.pinned??new Map,{laid:a,gap:l}=uI(e,t,n),c=i0(a,l,n.availableWidth??0,n.availableHeight??0),u=new Map;let f=0;for(const p of c){const h=dI(p);let m=0;for(const{positions:y,height:w,pinnedBox:_}of p){for(const[j,b]of y)u.set(j,{x:b.x+f,y:b.y+m});let k=m+w;_&&_.maxY>k&&_.minX<f+h&&f<_.maxX&&(k=_.maxY),m=k+Lc}f+=h+l}return e.map(p=>{const h=r.get(p.id);if(h)return{...p,position:h};const m=u.get(p.id);return m?{...p,position:m}:p})}function b7(e,t,n,r,a){const c=tl+of,u=60,f=w=>Zc(w,r,a),p=new Map(e.map(w=>[w.id,Wo(w)])),h=[],m=e.map(w=>({id:w.id,pos:n.get(w.id)??t.get(w.id)})).filter(w=>w.pos!=null).sort((w,_)=>w.pos.y-_.pos.y||w.pos.x-_.pos.x||w.id.localeCompare(_.id)),y=[];for(const{id:w,pos:_}of m){const{w:k,h:j}=f(w),b=p.get(w)??"_default";if(n.has(w)){h.push({x:_.x,y:_.y,w:k,h:j,sid:b});continue}let S=_.y;for(let E=0;E<h.length+1;E++){const C=h.find(T=>{const R=T.sid===b?24:u,A=T.sid===b?24:c;return _.x<T.x+T.w+R&&T.x<_.x+k+R&&S<T.y+T.h+A&&T.y<S+j+A});if(!C)break;S=C.y+C.h+(C.sid===b?24:c)}S!==_.y&&(t.set(w,{x:_.x,y:S}),y.push(w)),h.push({x:_.x,y:S,w:k,h:j,sid:b})}return y}function k7(e,t,n,r,a,l,c){const u=E=>Zc(E,r,l),f=E=>n.get(E)??t.get(E),p=E=>{const C=r.get(E);return{cw:(C==null?void 0:C.width)??Uo,ch:(C==null?void 0:C.height)??Xc}},h=c!=null&&c.width>0&&c.height>0,m=new Map;for(const E of e){if(!f(E.id))continue;const C=Wo(E),T=m.get(C);T?T.push(E):m.set(C,[E])}const y=new Set;for(const[E,C]of m)C.every(T=>a.has(T.id)&&!n.has(T.id))&&y.add(E);const w=new Map,_=[];for(const E of e){const C=f(E.id);if(!C)continue;const{w:T,h:R}=u(E.id),A=Wo(E);y.has(A)?(w.get(A)??w.set(A,[]).get(A)).push(E):_.push({x:C.x,y:C.y,w:T,h:R,...p(E.id)})}if(w.size===0||h&&_.length===0)return[];const k=tl+of,j=(E,C,T,R)=>_.some(A=>E<A.x+A.w+tl&&A.x<E+T+tl&&C<A.y+A.h+k&&A.y<C+R+k),b=lI(e,r),S=[];for(const E of[...w.keys()].sort()){const C=w.get(E);let T=1/0,R=1/0,A=-1/0,q=-1/0,F=-1/0,O=-1/0;for(const $ of C){const z=f($.id),{w:U,h:V}=u($.id),{cw:B,ch:Y}=p($.id);T=Math.min(T,z.x),R=Math.min(R,z.y),A=Math.max(A,z.x+U),q=Math.max(q,z.y+V),F=Math.max(F,z.x+B),O=Math.max(O,z.y+Y)}const H=A-T,K=q-R,X=[...new Set(_.map($=>Math.round($.x)))].sort(($,z)=>$-z),I=X.length?X:[T],Z=[0,..._.map($=>$.y+$.h+k)].sort(($,z)=>$-z);let W=null;if(h){let $=1/0,z=1/0,U=-1/0,V=-1/0;for(const L of _)$=Math.min($,L.x),z=Math.min(z,L.y),U=Math.max(U,L.x+L.cw),V=Math.max(V,L.y+L.ch);const B=(L,te)=>{const ne=c.width/(Math.max(U,L+F-T)-Math.min($,L)+bh),ie=c.height/(Math.max(V,te+O-R)-Math.min(z,te));return[Math.min(cI,ne,ie),Math.min(ne,ie),Math.max(ne,ie)]},Y=(L,te)=>{for(let ne=0;ne<L.length;ne++){if(L[ne]>te[ne]+1e-9)return!0;if(L[ne]<te[ne]-1e-9)return!1}return!1},ue=Math.round(U+bh+b),G=[...new Set([...Z,z])].sort((L,te)=>L-te);let ee=null;for(const L of[...I,ue])for(const te of G){if(j(L,te,H,K))continue;const ne=B(L,te);(ee===null||Y(ne,ee))&&(ee=ne,W={x:L,y:te})}W&&W.x===T&&W.y===R&&(W=null)}else e:for(const $ of I)for(const z of Z){if(z>=R)break;if(!j($,z,H,K)){W={x:$,y:z};break e}}if(W){const $=W.x-T,z=W.y-R;for(const U of C){const V=f(U.id);t.set(U.id,{x:V.x+$,y:V.y+z})}S.push(E)}for(const $ of C){const z=f($.id),{w:U,h:V}=u($.id);_.push({x:z.x,y:z.y,w:U,h:V,...p($.id)})}}return S}function N7(e,t,n){const r=new Map;for(const a of e){if(t.has(a.id)||!n(a.id))continue;const l=Wo(a);(r.get(l)??r.set(l,[]).get(l)).push(a)}if(r.size===0)return e;for(const a of r.values())a.sort((l,c)=>l.id.localeCompare(c.id));return e.map(a=>{var p;if(t.has(a.id)||n(a.id))return a;const l=r.get(Wo(a));if(!l)return a;const c=(p=a.data)==null?void 0:p.parentId,u=l.find(h=>h.id===c)??l[0],f=n(u.id);return{...a,position:{x:a.position.x+f.x-u.position.x,y:a.position.y+f.y-u.position.y}}})}function _7(e,t,n,r,a,l=!1,c){const p=tl+of+1,h=8,m=1.75,y=200,w=.7,_=.01,k=O=>Zc(O,r,c),j=O=>n.get(O)??t.get(O),b=new Map;for(const O of e){if(!j(O.id))continue;const H=Wo(O),K=b.get(H);K?K.push(O):b.set(H,[O])}const S=[],E=new Set,C=new Set,T=a.size===0;for(const O of[...b.keys()].sort()){const H=b.get(O);let K=1/0,X=1/0,I=-1/0,Z=-1/0,W=!1;for(const V of H){const B=j(V.id),{w:Y,h:ue}=k(V.id);K=Math.min(K,B.x),X=Math.min(X,B.y),I=Math.max(I,B.x+Y),Z=Math.max(Z,B.y+ue),n.has(V.id)&&(W=!0)}const $=I-K,z=Z-X;C.add(O);const U=a.get(O);U&&($>U.w+h||z>U.h+h)&&E.add(O),a.set(O,{w:$,h:z}),S.push({sid:O,members:H.map(V=>V.id),x:K,y:X,w:$,h:z,anchored:W,mass:1})}for(const O of[...a.keys()])C.has(O)||a.delete(O);if(l||T)return[];let R=!1;for(let O=0;O<S.length&&!R;O++)for(let H=O+1;H<S.length;H++){const K=S[O],X=S[H];if(!(K.anchored&&X.anchored)&&Math.abs(K.x+K.w/2-(X.x+X.w/2))<(K.w+X.w)/2+61&&Math.abs(K.y+K.h/2-(X.y+X.h/2))<(K.h+X.h)/2+p){R=!0;break}}if(E.size===0&&!R)return[];if(E.size>0)for(const O of S)E.has(O.sid)&&(O.mass=8);else for(const O of S)O.mass=Math.max(1,O.w*O.h/(Uo*Xc));const A=new Map(S.map(O=>[O.sid,O.x])),q=new Map(S.map(O=>[O.sid,O.y]));for(let O=0;O<y;O++){const H=new Map,K=new Map;let X=0;for(let I=0;I<S.length;I++)for(let Z=I+1;Z<S.length;Z++){const W=S[I],$=S[Z];if(W.anchored&&$.anchored)continue;const z=W.x+W.w/2,U=W.y+W.h/2,V=$.x+$.w/2,B=$.y+$.h/2,Y=(W.w+$.w)/2+61-Math.abs(z-V),ue=(W.h+$.h)/2+p-Math.abs(U-B);if(Y<=0||ue<=0)continue;const G=(ye,Ce)=>!ye.anchored&&!(Ce<0&&ye.x<=0),ee=(ye,Ce)=>!ye.anchored&&!(Ce<0&&ye.y<=0),L=(ye,Ce,De)=>{const qe=ye===Ce,rt=qe?W.sid<$.sid?-1:1:Math.sign(ye-Ce);return De(W,rt)||De($,-rt)?rt:qe&&(De(W,-rt)||De($,rt))?-rt:0},te=L(z,V,G),ne=L(U,B,ee),ie=te!==0,me=ne!==0;if(!ie&&!me)continue;const je=ie&&(!me||Y*m<ue),[Oe,Ve,Le,Te]=je?[te,Y,H,G]:[ne,ue,K,ee],nt=Te(W,Oe),_e=Te($,-Oe),Se=W.mass,Xe=$.mass,ot=nt?_e?Xe/(Se+Xe):1:0,$e=_e?nt?Se/(Se+Xe):1:0,oe=Ve*w;Le.set(W.sid,(Le.get(W.sid)??0)+Oe*oe*ot),Le.set($.sid,(Le.get($.sid)??0)-Oe*oe*$e),X+=oe}for(const I of S)I.anchored||(I.x=Math.max(0,I.x+(H.get(I.sid)??0)),I.y=Math.max(0,I.y+(K.get(I.sid)??0)));if(X<_)break}const F=[];for(const O of S){const H=O.x-A.get(O.sid),K=O.y-q.get(O.sid);if(!(Math.abs(H)<1&&Math.abs(K)<1)){for(const X of O.members){if(n.has(X))continue;const I=t.get(X);I&&t.set(X,{x:I.x+H,y:I.y+K})}F.push(O.sid)}}return F}function th(e,t,n){return!t.has(e)||n.has(e)}function S7(e,t,n,r){return!t.has(e)&&th(e,n,r)}function j7(e,t,n){const r={x:0,y:0};return t.set(e,r),n.add(e),r}function ZT(e,t,n,r){n.set(e,t),r.delete(e)}const E7=200,C7=5*6e4,T7=6,A7=2*6e4;function Fd(e,t){if(t.size!==0)for(const n of Array.from(e.keys()))t.has(n)||e.delete(n)}function R7(e,t){let n=!1;for(const a of e)if(!t.has(a)){n=!0;break}if(!n)return e;const r=new Set;for(const a of e)t.has(a)&&r.add(a);return r}function M7(e){const t=new Set;for(const n of e)t.add(n.id),t.add(`group:${n.sessionId}`),n.kind==="root"&&t.add(H0(n.id));return t}function I7(e){const t=new Set;for(const n of e)t.add(n.id),n.kind==="root"&&t.add(H0(n.id));return t}function $7(e,t){let n=hD(e,t,pN);fD(e,t,pN)&&(n=!0);const r=[],a=l=>{r.push(l)};return lD(e,t,E7,C7,a)&&(n=!0),cD(e,t,T7,A7,a)&&(n=!0),{changed:n,forgotten:r}}const O7=300,QT=130,L7=160,JT=new WeakMap;function P7(e,t){let n=JT.get(e);(!n||n.revision!==e.revision||n.open!==t)&&(n={revision:e.revision,open:t,byId:new Map,branches:k6(e.agents.values())},JT.set(e,n));const{byId:r,branches:a}=n;return l=>{let c=r.get(l.id);if(!c){const u=l.kind==="root"?a.get(l.sessionId):void 0;c=u?{...l,onOpenContext:t,branch:u}:{...l,onOpenContext:t},r.set(l.id,c)}return c}}function l0(e){const t=new Map;for(const n of e.agents.values())n.tools.length>0&&t.set(n.id,Math.min(4,n.tools.length));return t}function D7(e,t,n,r,a,l,c,u,f,p,h,m,y,w,_,k,j,b){var X,I,Z,W;const S=[],E=[],C=P7(e,b);for(const $ of e.agents.values()){if(!j.has($.id))continue;const z=$.exitAt!=null,U=k!=null&&!k.has($.id),V=[z?"rf-exiting":"",U?"rf-spotlit-out":""].filter(Boolean).join(" ")||void 0,B=l.get($.id);if(S.push({id:$.id,type:"agent",position:{x:0,y:0},data:C($),className:V,ariaLabel:uF($,t,_.has($.id)),...B?{width:B.width,height:B.height}:null}),$.parentId&&j.has($.parentId)){const G=hh($.sessionId),ee=z,L=_.size>0&&(_.has($.id)||_.has($.parentId)),te=k!=null&&!k.has($.id)&&!k.has($.parentId),ne=$.state==="active"?2:1.5,ie=L?ne+1.5:ne,me=ee?.2:te?.12:1,je=["sess-edge",$.state==="active"?"sess-live":"sess-idle",ee?"rf-edge-exiting":"",L?"rf-edge-selected":""].filter(Boolean).join(" ");E.push({id:`e:${$.parentId}->${$.id}`,source:$.parentId,target:$.id,animated:($.state==="active"||L)&&!ee,type:"smoothstep",style:{"--session-hue":G,strokeWidth:`calc(${ie}px * var(--edge-k, 1))`,opacity:me,transition:"var(--edge-transition)"},className:je})}const Y=$.kind==="root"?Ph($):null,ue=Y?_R($.sessionId,Y.at):null;if(Y&&ue&&!g6(ue)){const G=H0($.id),ee=hh($.sessionId),L=l.get(G);S.push({id:G,type:"recapNote",position:{x:0,y:0},data:{sessionId:$.sessionId,parentId:$.id,recap:Y,noteKey:ue,hue:ee},className:U?"rf-spotlit-out":void 0,selectable:!1,focusable:!1,ariaLabel:`Claude Code's recap for ${$.label}`,...L?{width:L.width,height:L.height}:null}),E.push({id:`e:recap:${$.id}`,source:G,target:$.id,type:"recapTie",className:"recap-edge",focusable:!1,style:{"--session-hue":ee}})}}const T=l0(e),R=`${y}#lanes:${g7(T)}`,A=new Set(S.filter($=>$.type==="recapNote").map($=>$.id));for(const $ of Array.from(h.keys()))x6($)&&!A.has($)&&!a.has($)&&(h.delete($),m.delete($));const q=S.filter($=>S7($.id,a,h,m));if(q.length>0||R!==w.current){if(q.length>0){const $=N7(x7(S,E,{direction:"LR",pinned:a,measured:l,availableWidth:n,availableHeight:r,lanes:T}),a,z=>th(z,h,m)?void 0:h.get(z));for(const z of $)th(z.id,h,m)&&ZT(z.id,z.position,h,m);k7(S,h,a,l,new Set(q.filter(z=>z.type!=="recapNote").map(z=>z.id)),T,{width:n,height:r});for(const z of q){if(z.type!=="recapNote")continue;const U=(X=z.data)==null?void 0:X.parentId;if(!U)continue;const V=a.get(U)??(th(U,h,m)?void 0:h.get(U));if(!V)continue;const B=((I=l.get(z.id))==null?void 0:I.width)??O7,Y=((Z=l.get(z.id))==null?void 0:Z.height)??QT,ue=((W=l.get(U))==null?void 0:W.height)??QT;ZT(z.id,{x:V.x-L7-B,y:V.y+(ue-Y)/2},h,m)}}b7(S,h,a,l,T),w.current=R}const F=_7(S,h,a,l,c,!f||p,T);F.length>0&&u(F);const O=I7(e.agents.values());Fd(h,O),Fd(m,O),Fd(a,O),Fd(l,M7(e.agents.values()));const H=[];let K=!1;for(const $ of S){let z=a.get($.id)??h.get($.id);z||(z=j7($.id,h,m),K=!0),H.push({...$,position:z})}return K&&(w.current=""),{nodes:H,edges:E}}const F7=1;function q7(e){return{id:e.id,name:e.name,inputPreview:e.inputPreview,startedAt:e.startedAt,endedAt:e.endedAt,ok:e.ok,errorPreview:e.errorPreview,usage:e.usage}}function B7(e,t,n){const r=e.agents.get(t);if(!r)return null;const a=[];for(const l of e.agents.values())l.sessionId===t&&a.push(l);return{schemaVersion:F7,exportedAt:n,sessionId:t,label:r.label,cwd:r.cwd,startedAt:r.startedAt,endedAt:r.endedAt,model:r.model,agents:a.map(l=>({id:l.id,kind:l.kind,label:l.label,parentId:l.parentId,state:l.state,startedAt:l.startedAt,endedAt:l.endedAt,model:l.model,cwd:l.cwd,usage:l.usage,prompts:l.prompts,tools:l.tools.map(q7)}))}}function z7(e,t){const n=(e||"session").replace(/[^a-z0-9._-]/gi,"_");return`${tn}-${n}-${t.slice(0,8)}.json`}function H7(e,t){return e==="confirmation"?t.confirmOpen?"clear":"ignore":t.modalOpen||t.confirmOpen?"ignore":"confirm"}function U7(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 W7(e){return e<=0?null:e===1?"the one agent":`all ${e} agents`}function V7(e,t){const n=W7(e),r=(...c)=>[n?`${n} on the canvas`:null,...c,"layout, pins and selection"].filter(u=>u!==null),a="This cannot be undone.";if(!t)return{goes:r("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"),stays:[],final:a,confirm:"Clear everything"};if(!t.path)return{goes:r(),stays:[],final:`This deck keeps no event log, so nothing on disk changes — and nothing can bring the canvas back. ${a}`,confirm:"Clear everything"};if(!t.mine){const c=t.ownerPort===null?"another running deck owns that file":`the deck on port ${t.ownerPort} owns that file`,u=t.decks>2?`, one of ${t.decks} decks sharing it`:"";return{goes:r(),stays:[`the event log — ${c}${u}`,"restart this deck and the log replays back onto it"],final:null,confirm:"Clear this canvas"}}if(t.decks<=1)return{goes:r("this deck's event log — the file a restarted deck replays to rebuild what you see"),stays:[],final:a,confirm:"Clear everything"};const l=t.decks-1;return{goes:r(`the event log ${l===1?"1 other running deck shares":`${l} other running decks share`} with this one — every session recorded in it, not just the ones drawn here`),stays:[l===1?"what that deck shows, until it restarts — then it is gone there too":"what those decks show, until they restart — then it is gone there too"],final:a,confirm:"Clear everything"}}function G7({agentCount:e,onConfirm:t,onCancel:n}){const r=x.useRef(null),a=sn(n,{focusRef:r,layer:zD}),[l,c]=x.useState(null);x.useEffect(()=>{let m=!1;return fetch("/api/clear").then(y=>y.ok?y.json():null).then(y=>{m||c(U7(y))}).catch(()=>{}),()=>{m=!0}},[]);const{goes:u,stays:f,final:p,confirm:h}=V7(e,l);return o.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:o.jsxs("div",{ref:a,className:"modal clear-confirm",onClick:m=>m.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"clear-confirm-title",children:[o.jsxs("header",{className:"modal-head",children:[o.jsxs("div",{className:"modal-title",children:[o.jsx("span",{className:"status-dot err","aria-hidden":!0}),o.jsx("span",{id:"clear-confirm-title",className:"modal-tool-name",children:"Clear the deck?"})]}),o.jsx("div",{className:"modal-actions",children:o.jsx("button",{type:"button",className:"glyph-btn",onClick:n,"aria-label":"Cancel (Esc)",title:"Cancel (Esc)",children:"×"})})]}),o.jsxs("section",{className:"modal-body",children:[o.jsxs("dl",{className:"cc-plan",children:[o.jsx("dt",{children:"Goes"}),o.jsx("dd",{children:u.map(m=>o.jsx("span",{children:m},m))}),o.jsx("dt",{children:"Stays"}),o.jsx("dd",{children:f.length>0?f.map(m=>o.jsx("span",{children:m},m)):o.jsx("span",{children:"nothing"})})]}),p&&o.jsx("p",{className:"cc-final",children:p}),o.jsxs("div",{className:"cc-actions",children:[o.jsx("button",{type:"button",ref:r,className:"btn",onClick:n,children:"Cancel"}),o.jsx("button",{type:"button",className:"btn danger",onClick:t,children:h})]})]})]})})}const K7="Press Esc first if a key does nothing.",Y7=[{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:"W",action:"the session waiting on you — oldest first, again for the next",binds:["w","W"]},{cap:"F",action:"fit every agent on screen",binds:["f","F"]},{cap:"Z",action:"zoom to the selected agent and its session",binds:["z","Z"]},{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:"S",action:"this machine — cores, memory, temperature",binds:["s","S"]},{cap:"B",action:"Browser Watch",binds:["b","B"]},{cap:"V",action:"the sound menu — volume, tones, notifications",binds:["v","V"]},{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:"a card: go to it and its session",binds:[]},{cap:"double-click",action:"a card: its prompt, every tool call, tokens and timing",binds:[]},{cap:"hover",action:"zoomed out, a card's name, state and numbers",binds:[]},{cap:"click",action:"the topbar speaker opens volume and sound settings",binds:[]}]}];function X7({onClose:e,onTour:t}){const n=sn(e);return o.jsx("div",{className:"modal-backdrop",onClick:e,role:"presentation",children:o.jsxs("div",{ref:n,className:"modal key-help",onClick:r=>r.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"key-help-title",children:[o.jsxs("header",{className:"modal-head",children:[o.jsx("div",{className:"modal-title",children:o.jsx("span",{id:"key-help-title",className:"modal-tool-name",children:"Keyboard shortcuts"})}),o.jsx("div",{className:"modal-actions",children:o.jsx("button",{type:"button",className:"glyph-btn",onClick:e,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),o.jsxs("section",{className:"modal-body",children:[t&&o.jsxs("div",{className:"guide-door",children:[o.jsx("span",{children:"Eight pictures of what the deck shows."}),o.jsx("button",{type:"button",className:"btn",onClick:t,children:"Take the tour"})]}),o.jsx("div",{className:"shortcuts",children:Y7.map(r=>o.jsxs(x.Fragment,{children:[o.jsx("h3",{className:"kh-group",children:r.title}),r.rows.map(a=>o.jsxs("div",{className:"sc",children:[o.jsx("kbd",{children:a.cap}),o.jsx("span",{children:a.action})]},`${r.title}:${a.cap}:${a.action}`))]},r.title))}),o.jsx("p",{className:"kh-foot",children:K7})]})]})})}const Z7=["done","needs-input"],Q7=[{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}]}],J7=[{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}]}],kb={done:Q7,"needs-input":J7},ul="two";function c0(e,t){const n=kb[e];return n.find(r=>r.id===t)??n.find(r=>r.id===ul)??n[0]}function hI(e,t){return kb[e].some(r=>r.id===t)?t:ul}c0("done",ul).notes,c0("needs-input",ul).notes;const e2=.04,e9=.24,Po=0,dl=100,kh=5,Qc=50;function Jc(e){if(!Number.isFinite(e))return Qc;const t=Math.round(e/kh)*kh;return Math.min(dl,Math.max(Po,t))}function fI(e){if(e==null)return Qc;const t=e.trim();return/^-?\d+(\.\d+)?$/.test(t)?Jc(Number(t)):Qc}function t9(e){const t=Jc(e),n=e2+(e9-e2)*(t/dl);return Math.round(n*1e4)/1e4}function n9(e,t){const n=t.trim,r=typeof n=="number"&&Number.isFinite(n)&&n>0&&n<=1?n:1;return Math.round(t9(e)*r*1e4)/1e4}const r9=160,s9="agent-dag.soundLevel.done",a9="agent-dag.soundLevel.needs-input",o9="agent-dag.soundFigure.done",i9="agent-dag.soundFigure.needs-input",pI={done:s9,"needs-input":a9},mI={done:o9,"needs-input":i9},u0={done:{level:Qc,figure:ul},"needs-input":{level:Qc,figure:ul}};function l9(e){const t=n=>({level:fI(e(pI[n])),figure:hI(n,e(mI[n]))});return{done:t("done"),"needs-input":t("needs-input")}}const t2={Stop:"done",Notification:"needs-input"};function c9(e,t){var r;if(t)return null;const n=(r=e==null?void 0:e.payload)==null?void 0:r.hook_event_name;return typeof n!="string"?null:Object.hasOwn(t2,n)?t2[n]:null}function u9(e={enabled:()=>!0}){const t=e.ctor??(typeof window<"u"?window.AudioContext??window.webkitAudioContext??null:null);let n=null,r=!1;const a=()=>e.enabled()?r&&(n==null?void 0:n.state)==="running"?"ready":"locked":"off",l=()=>{var f;return(f=e.onState)==null?void 0:f.call(e,a())};function c(){var f;if(!(!t||r))try{n=n??new t,(f=n.resume)==null||f.call(n).then(l,()=>{}),r=!0,l()}catch{}}function u(f,p=!1){var _;if(!p&&!e.enabled()||!n||n.state!=="running")return!1;const h=(((_=e.prefs)==null?void 0:_.call(e))??u0)[f]??u0[f],m=c0(f,h.figure),y=n9(h.level,m),w=n.currentTime;for(const k of m.notes){const j=n.createOscillator(),b=n.createGain();j.type=m.type??"sine",j.frequency.value=k.hz;const S=w+k.at,E=S+k.ms/1e3;b.gain.setValueAtTime(1e-4,S),b.gain.exponentialRampToValueAtTime(y,S+.012),b.gain.exponentialRampToValueAtTime(1e-4,E),j.connect(b).connect(n.destination),j.start(S),j.stop(E+.02)}return!0}return{unlock:c,play:u,state:a,get context(){return n}}}const d9="With no deck tab open, get a notification wherever a sound would have played.",h9="With the ccdeck window closed, get a notification wherever a sound would have played.";function f9(e){return e?h9:d9}const p9="Held off for this run — the deck was started with alerts disabled. Your choice is saved for the next start.",n2="Get notified when you're away from this tab.";function m9(e){switch(e){case"granted":return{status:"Enabled",ask:!1,ok:!0,note:n2};case"default":return{status:null,ask:!0,ok:!1,note:n2};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."}}}function d0(e=typeof navigator>"u"?"":navigator.userAgent){return/\bccdeck-desktop\/\d/.test(e)}const r2={done:"Turn finished","needs-input":"Claude is asking"},g9={done:"Plays when Claude or Codex finishes a turn.","needs-input":"Available in Claude Code only."};function y9({onClose:e,soundOn:t,onToggleSound:n,prefs:r,onLevel:a,onFigure:l,onPreview:c,openerRef:u,notifyOn:f,onToggleNotify:p,notifyVetoed:h,notifyPermission:m,onAskNotify:y}){const w=m9(m),_=d0(),k=f&&!h&&!_,j=sn(e,{popover:!0}),b=x.useRef(e);return b.current=e,x.useEffect(()=>{const S=E=>{var T,R;const C=E.target;C&&((T=j.current)!=null&&T.contains(C)||(R=u.current)!=null&&R.contains(C)||b.current())};return window.addEventListener("pointerdown",S,!0),()=>window.removeEventListener("pointerdown",S,!0)},[j,u]),o.jsxs("div",{ref:j,id:"sound-menu",className:"sound-menu",role:"dialog","aria-label":"Sound settings",children:[o.jsxs("div",{className:"sm-switches",children:[o.jsxs("label",{className:"sm-switch",children:[o.jsx("span",{className:"sm-switch-label",id:"sm-sound-label",children:"Sounds"}),o.jsx("button",{type:"button",role:"switch","aria-checked":t,"aria-labelledby":"sm-sound-label",className:"switch",onClick:n,title:"A tone when a turn finishes, and when Claude asks for something",children:o.jsx("span",{className:"switch-knob"})})]}),o.jsxs("div",{className:"sm-setting",children:[o.jsxs("label",{className:"sm-switch",children:[o.jsx("span",{className:"sm-switch-label",id:"sm-notify-label",children:"Notifications while closed"}),o.jsx("button",{type:"button",role:"switch","aria-checked":f,"aria-labelledby":"sm-notify-label",className:"switch",onClick:p,title:"With no deck tab open, a notification wherever a sound would play",children:o.jsx("span",{className:"switch-knob"})})]}),o.jsx("p",{className:"sm-note",children:h?p9:f9(_)})]})]}),k&&o.jsxs("section",{className:"sm-channel","aria-labelledby":"sm-channel-name",children:[o.jsxs("div",{className:"sm-channel-head",children:[o.jsx("h3",{className:"sm-channel-name",id:"sm-channel-name",children:"Browser notifications"}),w.ask?o.jsx("button",{type:"button",className:"btn sm-channel-action",onClick:y,children:"Enable"}):o.jsxs("span",{className:"sm-channel-state","data-ok":w.ok||void 0,children:[w.ok&&o.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:o.jsx("path",{d:"M1.5 5.2 3.9 7.6 8.5 2.4"})}),w.status]})]}),o.jsx("p",{className:"sm-note",children:w.note})]}),!t&&o.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."}),o.jsx("div",{className:"sm-tones",children:Z7.map(S=>{const E=r[S],C=`sm-level-${S}`,T=`sm-figure-${S}`;return o.jsxs("section",{className:"sm-tone","aria-labelledby":`sm-name-${S}`,children:[o.jsxs("div",{className:"sm-tone-head",children:[o.jsx("h3",{className:"sm-tone-name",id:`sm-name-${S}`,children:r2[S]}),o.jsxs("button",{type:"button",className:"btn sm-hear",onClick:()=>c(S),"aria-label":`Hear the ${r2[S].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:[o.jsx("svg",{width:"11",height:"11",viewBox:"0 0 12 12",fill:"currentColor","aria-hidden":!0,children:o.jsx("path",{d:"M3 1.6v8.8l7-4.4z"})}),"Hear it"]})]}),o.jsxs("div",{className:"sm-row",children:[o.jsx("label",{htmlFor:C,children:"Volume"}),o.jsx("input",{id:C,type:"range",min:Po,max:dl,step:kh,value:E.level,onChange:R=>a(S,Number(R.target.value)),style:{"--sm-level":`${(E.level-Po)/(dl-Po)*100}%`}}),o.jsxs("span",{className:"sm-read",children:[E.level,"%"]})]}),o.jsxs("div",{className:"sm-row",children:[o.jsx("label",{htmlFor:T,children:"Tone"}),o.jsx("select",{id:T,className:"sm-select",value:E.figure,onChange:R=>l(S,R.target.value),children:kb[S].map(R=>o.jsx("option",{value:R.id,children:R.label},R.id))})]}),o.jsx("p",{className:"sm-note",children:g9[S]})]},S)})}),o.jsxs("p",{className:"sm-foot",children:[o.jsx("kbd",{children:"M"}),"Mute or unmute sounds anywhere."]})]})}const gI="agent-dag.character-enabled",yI="agent-dag.fm-volume",wI="agent-dag.fm-source",w9=[{value:"claude-fm",label:"🎧 Claude FM"},{group:"📻 Lofi Girl",value:"lofi-relax",label:"📚 Relax / study"},{group:"📻 Lofi Girl",value:"lofi-game",label:"🎮 Chill / game"},{group:"📻 Lofi Girl",value:"lofi-vibe",label:"🌅 Vibe / chill"},{group:"📻 Lofi Girl",value:"lofi-sleep",label:"💤 Sleep / chill"},{group:"📻 Radio Mix",value:"radio-mix",label:"📡 Live radio mix"},{group:"📻 Best of Nostalgia",value:"best-of-nostalgia",label:"📼 Best of nostalgia live"},{group:"📻 The Good Life Radio",value:"good-life-radio",label:"🌴 The Good Life Radio"},{group:"☕ Cafe Music BGM",value:"cafe-music-bgm",label:"☕ Cafe music BGM"}];function v9(e){return e==="lofi-relax"||e==="lofi-game"||e==="lofi-vibe"||e==="lofi-sleep"||e==="radio-mix"||e==="best-of-nostalgia"||e==="good-life-radio"||e==="cafe-music-bgm"?e:"claude-fm"}function x9(){return v9(ms(wI))}function b9(e){return e!=="0"}function k9(){return b9(ms(gI))}function N9(e){return fI(e)}function _9(){return N9(ms(yI))}const Hi=["light","dark"],S9={light:"Light",dark:"Dark"},Bs=w9;function j9({theme:e}){return o.jsx("span",{className:"appearance-preview","data-swatch":e,children:o.jsxs("svg",{viewBox:"0 0 112 56","aria-hidden":!0,focusable:"false",children:[o.jsx("rect",{className:"tp-canvas",width:"112",height:"56"}),o.jsx("rect",{className:"tp-surface",width:"112",height:"7"}),o.jsx("rect",{className:"tp-rule",y:"7",width:"112",height:"1"}),o.jsx("rect",{className:"tp-surface",y:"8",width:"25",height:"48"}),o.jsx("rect",{className:"tp-rule",x:"25",y:"8",width:"1",height:"48"}),o.jsx("rect",{className:"tp-card",x:"36.5",y:"27.5",width:"28",height:"14",rx:"2.5"}),o.jsx("rect",{className:"tp-tag",x:"39.5",y:"25.5",width:"13",height:"4",rx:"2"}),o.jsx("rect",{className:"tp-card",x:"76.5",y:"14.5",width:"29",height:"20",rx:"2.5"}),o.jsx("rect",{className:"tp-rule",x:"81",y:"23",width:"20",height:"2",rx:"1"}),o.jsx("rect",{className:"tp-accent",x:"81",y:"23",width:"12",height:"2",rx:"1"})]})})}function E9({theme:e,onTheme:t,characterEnabled:n,onToggleCharacter:r,fmVolume:a,onFmVolume:l,fmSource:c,onFmSource:u,onClose:f}){var C;const p=sn(f),[h,m]=x.useState(!1),[y,w]=x.useState(()=>Math.max(0,Bs.findIndex(T=>T.value===c))),_=x.useRef(null),k=x.useRef(null);x.useEffect(()=>{const T=Bs.findIndex(R=>R.value===c);w(T<0?0:T)},[c]),x.useEffect(()=>{var T;h&&((T=document.getElementById(`appearance-fm-option-${y}`))==null||T.scrollIntoView({block:"nearest"}))},[y,h]),x.useEffect(()=>{if(!h)return;const T=R=>{var q,F;const A=R.target;!((q=_.current)!=null&&q.contains(A))&&!((F=k.current)!=null&&F.contains(A))&&m(!1)};return document.addEventListener("pointerdown",T),()=>document.removeEventListener("pointerdown",T)},[h]);const j=T=>{var A;const R=Bs[T];R&&(w(T),u(R.value),m(!1),(A=_.current)==null||A.focus())},b=T=>{if(UD(T.key)){T.preventDefault(),T.stopPropagation(),m(!1);return}if(T.key==="Enter"||T.key===" "){T.preventDefault(),h?j(y):m(!0);return}T.key!=="ArrowDown"&&T.key!=="ArrowUp"&&T.key!=="Home"&&T.key!=="End"||(T.preventDefault(),m(!0),w(R=>T.key==="Home"?0:T.key==="End"?Bs.length-1:Math.min(Bs.length-1,Math.max(0,R+(T.key==="ArrowDown"?1:-1)))))},S=T=>{var q;if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(T.key))return;T.preventDefault();const A=(Hi.indexOf(e)+(T.key==="ArrowLeft"||T.key==="ArrowUp"?-1:1)+Hi.length)%Hi.length;t(Hi[A]),(q=T.currentTarget.querySelectorAll('[role="radio"]')[A])==null||q.focus()},E=T=>{var A;if(T.key===" "){T.stopPropagation();return}if(T.key!=="t"&&T.key!=="T"||T.ctrlKey||T.metaKey||T.altKey)return;T.preventDefault(),T.stopPropagation();const R=e==="dark"?"light":"dark";t(R),T.target.getAttribute("role")==="radio"&&((A=T.currentTarget.querySelectorAll('[role="radio"]')[Hi.indexOf(R)])==null||A.focus())};return _n.createPortal(o.jsx("div",{className:"modal-backdrop appearance-backdrop",onClick:f,role:"presentation",children:o.jsxs("div",{ref:p,id:"appearance-menu",className:"modal appearance-menu appearance-modal",role:"dialog","aria-modal":"true","aria-labelledby":"appearance-title",onClick:T=>T.stopPropagation(),onKeyDown:E,children:[o.jsxs("div",{className:"appearance-head",children:[o.jsxs("div",{className:"appearance-heading",children:[o.jsx("h2",{id:"appearance-title",className:"appearance-title",children:"Appearance"}),o.jsx("p",{className:"appearance-subtitle",children:"Tune the deck to your workspace."})]}),o.jsx("button",{type:"button",className:"glyph-btn appearance-close",onClick:f,"aria-label":"Close appearance settings",title:"Close (Esc)",children:"×"})]}),o.jsxs("section",{className:"appearance-section","aria-labelledby":"appearance-theme-caption",children:[o.jsxs("div",{className:"appearance-caption",children:[o.jsxs("div",{children:[o.jsx("h3",{id:"appearance-theme-caption",children:"Color theme"}),o.jsx("p",{className:"appearance-section-note",children:"Choose how the dashboard looks."})]}),o.jsx("kbd",{className:"appearance-key","aria-hidden":!0,title:"Press T anywhere to switch themes",children:"T"})]}),o.jsx("div",{className:"appearance-themes",role:"radiogroup","aria-labelledby":"appearance-theme-caption","aria-keyshortcuts":"T",onKeyDown:S,children:Hi.map(T=>o.jsxs("button",{type:"button",className:"appearance-theme",role:"radio","aria-checked":e===T,tabIndex:e===T?0:-1,onClick:()=>t(T),children:[o.jsx(j9,{theme:T}),o.jsxs("span",{className:"appearance-theme-name",children:[S9[T],o.jsx("svg",{className:"appearance-check",viewBox:"0 0 12 12","aria-hidden":!0,focusable:"false",children:o.jsx("path",{d:"M2.5 6.4 4.9 8.7 9.5 3.6"})})]})]},T))})]}),o.jsxs("section",{className:"appearance-section","aria-labelledby":"appearance-fm-caption",children:[o.jsx("div",{className:"appearance-caption",children:o.jsx("h3",{id:"appearance-fm-caption",children:"Music source"})}),o.jsxs("div",{className:"appearance-controls",children:[o.jsxs("div",{className:"appearance-source-row",children:[o.jsx("label",{htmlFor:"appearance-fm-source",children:"Station"}),o.jsxs("div",{className:`appearance-source-picker${h?" is-open":""}`,children:[o.jsxs("button",{ref:_,type:"button",id:"appearance-fm-source",className:"appearance-source-trigger",role:"combobox","aria-haspopup":"listbox","aria-expanded":h,"aria-controls":"appearance-fm-source-list","aria-activedescendant":h?`appearance-fm-option-${y}`:void 0,"aria-describedby":"appearance-fm-source-note",onClick:()=>m(T=>!T),onKeyDown:b,children:[o.jsx("span",{children:((C=Bs.find(T=>T.value===c))==null?void 0:C.label)??Bs[0].label}),o.jsx("svg",{viewBox:"0 0 12 12","aria-hidden":!0,focusable:"false",children:o.jsx("path",{d:"m2.5 4.5 3.5 3 3.5-3"})})]}),h&&o.jsx("div",{ref:k,id:"appearance-fm-source-list",className:"appearance-source-list",role:"listbox","aria-label":"Music stations",children:Bs.map((T,R)=>o.jsxs("div",{children:[T.group&&(R===0||Bs[R-1].group!==T.group)&&o.jsx("div",{className:"appearance-source-group",role:"presentation",children:T.group}),o.jsxs("div",{className:"appearance-source-option",role:"option",id:`appearance-fm-option-${R}`,"aria-selected":c===T.value,"data-highlighted":y===R||void 0,onMouseEnter:()=>w(R),onClick:()=>j(R),children:[o.jsx("span",{children:T.label}),c===T.value&&o.jsx("span",{"aria-hidden":!0,children:"✓"})]})]},T.value))})]})]}),o.jsx("span",{id:"appearance-fm-source-note",className:"vis-hidden",children:"Changing station starts live playback automatically."}),o.jsxs("label",{className:"appearance-row",children:[o.jsx("span",{className:"appearance-row-label",id:"appearance-character-label",children:"Show character on minimap"}),o.jsx("button",{type:"button",className:"switch",role:"switch","aria-checked":n,"aria-labelledby":"appearance-character-label","aria-describedby":"appearance-character-note",onClick:r,children:o.jsx("span",{className:"switch-knob"})}),o.jsx("span",{id:"appearance-character-note",className:"vis-hidden",children:"Shows the animated minimap character and enables music playback."})]}),o.jsxs("div",{className:"sm-row",children:[o.jsx("label",{htmlFor:"appearance-fm-volume",children:"Volume"}),o.jsx("input",{id:"appearance-fm-volume",type:"range",min:Po,max:dl,step:kh,value:a,"aria-describedby":"appearance-fm-volume-note",onChange:T=>l(Number(T.target.value)),style:{"--sm-level":`${(a-Po)/(dl-Po)*100}%`}}),o.jsxs("span",{className:"sm-read",children:[a,"%"]})]})]}),o.jsx("span",{id:"appearance-fm-volume-note",className:"vis-hidden",children:"Controls live music volume."})]})]})}),document.body)}const h0="https://www.youtube-nocookie.com";function C9(e,t,n){const r=new URLSearchParams({...n?{}:{channel:e},enablejsapi:"1",autoplay:"1",playsinline:"1",rel:"0",modestbranding:"1",origin:t});return`${h0}/embed/${n?encodeURIComponent(n):"live_stream"}?${r.toString()}`}function qd(e,t=[]){return JSON.stringify({event:"command",func:e,args:t})}function T9(e="claude-fm"){return JSON.stringify({event:"listening",id:e,channel:"widget"})}const A9=[1,3],R9=[0,2],M9=[2,5,100,101,150];function I9(e){let t=e;if(typeof e=="string")try{t=JSON.parse(e)}catch{return null}if(!t||typeof t!="object")return null;const{event:n,info:r}=t;if(n==="onReady")return{kind:"ready"};if(n==="onError"){const a=typeof r=="number"?r:Number(r==null?void 0:r.errorCode);return Number.isFinite(a)?{kind:"error",code:a}:null}if(n==="onStateChange"||n==="infoDelivery"){const a=typeof r=="number"?r:r==null?void 0:r.playerState;return typeof a!="number"||!Number.isFinite(a)?null:A9.includes(a)?{kind:"playing",playing:!0}:R9.includes(a)?{kind:"playing",playing:!1}:null}return null}const vI=["......aaaaaa......","....aa......aa....","...a..bbbbbs..a...","...cpcbbbbbscpc...","...cpcbebbescpc...","...cpcbbbbbscpc...","...cpcbbbbbscpc...","....ccbbbbbscc....","....bbbbbbbbbs....","....bbbbbbbbbs....","......bbbbbs......","......bb..bs......","......bb..bs......","......bb..bs......"],s2=18,$9=vI.length,xI=new Set(["a","c","p"]);function lf(e=vI){const t=[];return e.forEach((n,r)=>{let a=0;for(;a<n.length;){const l=n[a];if(l==="."){a+=1;continue}let c=1;for(;a+c<n.length&&n[a+c]===l;)c+=1;t.push({x:a,y:r,w:c,cell:l}),a+=c}}),t}const Do=148,a2=6e3,O9=16e3,bI=46,La=34;function L9(e,t,n=Do){let r=-Math.round(t()*n);if(Math.abs(r-e)<La){const a=e-La>=-n?-La:La;r=Math.max(-n,Math.min(0,Math.round(e+a)))}return{to:r,ms:Math.round(Math.abs(r-e)*bI)}}function P9(e){return Math.round(a2+e()*(O9-a2))}const o2=[{kind:"stroll",weight:44},{kind:"tidy",weight:17},{kind:"kick",weight:17},{kind:"sit",weight:12},{kind:"watch",weight:16},{kind:"leave",weight:7},{kind:"fish",weight:12},{kind:"skip",weight:10}];function D9(e){const t=o2.reduce((r,a)=>r+a.weight,0);let n=e()*t;for(const r of o2)if(n-=r.weight,n<0)return r.kind;return"stroll"}const F9=720,q9=260,B9=620,z9=220,i2=520,kI=1600,l2=7e3,H9=15e3,c2=6e3,U9=14e3;function Ui(e,t,n=Do){let r=-Math.round(t()*n);if(Math.abs(r-e)<La){const a=e-La>=-n?-La:La;r=Math.max(-n,Math.min(0,Math.round(e+a)))}return r}const nn=(e,t)=>Math.round(Math.abs(t-e)*bI),W9=120,Bd=0;function V9(e,t){const n=r=>({kind:"litter",at:t,...r});return[{x:t,prop:n({}),act:"walk",ms:nn(e,t)},{x:t,prop:n({}),act:"stoop",ms:F9},{x:Bd,prop:n({held:!0}),act:"carry",ms:nn(t,Bd)},{x:Bd,prop:n({held:!0}),act:"windup",ms:q9},{x:Bd,prop:n({held:!0,leaving:!0}),act:"toss",ms:B9}]}function G9(e,t){const n=t>e?1:-1,r=t-n*Math.min(15,Math.abs(t-e)),a=(l={})=>({kind:"ball",at:t,...l});return[{x:r,prop:a(),act:"walk",ms:nn(e,r)},{x:r,prop:a(),act:"windup",ms:z9,facing:n>0?"right":"left"},{x:r,prop:a({leaving:!0}),act:"kick",ms:i2,facing:n>0?"right":"left"},{x:r,prop:a({leaving:!0}),act:"stand",ms:kI-i2}]}const NI=640;function K9(e,t,n){const r=Math.max(-70,Math.min(-20,t)),a={x:r,prop:null,facing:"left"};return[{x:r,prop:null,act:"walk",ms:nn(e,r)},{...a,act:"sit",ms:600},{...a,act:"cast",ms:900},{...a,act:"fish",ms:6e3+Math.round(n()*4e3)},{...a,act:"reel",ms:1200},{...a,act:"stow",ms:500},{...a,act:"stand",ms:400},{x:0,prop:null,act:"walk",ms:nn(r,0)}]}function Y9(e,t,n){const r=Math.max(-110,Math.min(-30,t)),a={x:r,prop:null};return[{...a,act:"walk",ms:nn(e,r)},{...a,act:"skip-ready",ms:500},{...a,act:"skip",ms:NI*(6+Math.floor(n()*5))},{...a,act:"skip-rest",ms:600},{...a,act:"stand",ms:350},{x:0,prop:null,act:"walk",ms:nn(r,0)}]}function X9(e,t,n){return[{x:t,prop:null,act:"walk",ms:nn(e,t)},{x:t,prop:null,act:"sit",ms:Math.round(c2+n()*(U9-c2))},{x:t,prop:null,act:"stand",ms:400}]}function Z9(e,t,n){t=Math.max(-110,Math.min(0,t));const r=()=>({kind:"scope",at:t,held:!0});return[{x:t,prop:null,act:"walk",ms:nn(e,t)},{x:t,prop:r(),act:"watch",ms:Math.round(l2+n()*(H9-l2))},{x:t,prop:r(),act:"scope-pack",ms:480},{x:t,prop:null,act:"stand",ms:240}]}function wx(e,t,n){return e.facing?e.facing:e.act==="watch"||e.act==="scope-pack"?"left":e.x===t?n:e.x>t?"right":"left"}const Q9=1500,J9=e=>Math.round(1e3*Math.sqrt(2*e/Q9)),eV=115,tV=e=>Math.round(e/eV*1e3),nV=620,rV=200,sV=760,aV=600,oV=240;function iV(e,t,n){const a=-(t.ledgeSpan??Do),l=J9(t.ledgeH),c=tV(t.ledgeH),u=n(),f=n(),p=-Math.round(u*t.floorSpan),h=-Math.round(f*t.floorSpan);return[{x:a,act:"walk",prop:null,ms:nn(e,a)},{x:a,act:"peer",prop:null,ms:nV},{x:a,act:"fall",prop:null,ms:l,place:"floor"},{x:a,act:"land",prop:null,ms:rV,place:"floor"},{x:p,act:"walk",prop:null,ms:nn(a,p),place:"floor",floorFrac:u},{x:h,act:"walk",prop:null,ms:nn(p,h),place:"floor",floorFrac:f},{x:a,act:"walk",prop:null,ms:nn(h,a),place:"floor"},{x:a,act:"lasso",prop:null,ms:sV,place:"floor"},{x:a,act:"rope-throw",prop:null,ms:aV,place:"floor"},{x:a,act:"rope-catch",prop:null,ms:oV,place:"floor"},{x:a,act:"climb",prop:null,ms:c},{x:a,act:"pull-up",prop:null,ms:480}]}function lV(e,t,n){const r=(n==null?void 0:n.ledgeSpan)??Do;switch(D9(t)){case"tidy":return V9(e,Ui(e,t,r));case"kick":return G9(e,Ui(e,t,r));case"sit":return X9(e,Ui(e,t,r),t);case"watch":return Z9(e,Ui(e,t,r),t);case"fish":return K9(e,Ui(e,t,r),t);case"skip":return Y9(e,Ui(e,t,r),t);case"leave":{if(!n||!(n.ledgeH>0)||!(n.floorSpan>0))break;return iV(e,n,t)}}const l=L9(e,t,r);return[{x:l.to,prop:null,act:"walk",ms:l.ms}]}const cV=[".xx.","xxxx",".xx."],uV=["..xx..",".xsxx.","xssxxx","xxxxsx",".xxxx.","..xx.."],dV=["...xx...............","..xaax..............",".xaallx.............","xaallllx............",".xllllllx...........","..xllllllx..........","...xllllllx.........","....xllllllxx.......",".....xllllxsxx..xx..","......xllxsssx.xllxx",".......xxssssxxxllxx","........xssssssxx...",".........xssssx.....","..........xxxx......","..........xax.......",".........xxxxx......","........xx.x.xx.....","........xl.x.lx.....",".......xl..x..lx....",".......xl..x..lx....","......xl...x...lx...","......xl...x...lx...",".....xl....x....lx..","....xxx...xxx...xxx."],vx={litter:cV,ball:uV,scope:dV},_I=["bob","sway","groove"],u2=9e3,hV=16e3,SI=1e3,fV=.08;function pV(e,t){const n=_I.filter(l=>l!==e),r=n[Math.min(n.length-1,Math.floor(t()*n.length))],a=(t()*2-1)*fV;return{dance:r,beatMs:Math.round(SI*(1+a))}}function mV(e){return Math.round(u2+e()*(hV-u2))}const gV=["...hhhhhh...","...hhhhhh...","...kkkkkk...","hhhhhhhhhhhh"],yV=3,wV=-1,f0=11,d2=9,vV=420;function xV(e,t,n){const r=t==="right"?n-e-18:e-18;return(t==="right"?1:-1)*Math.min(vV,Math.max(0,r))}const bV=260,kV=200;function NV(e,t,n){const r=(h,m=nn(e,h))=>({x:h,prop:null,act:"walk",ms:m,place:"floor"});if(!n||n.height<=0)return[r(t)];const a=Math.min(e,t);if(Math.max(e,t)<=n.left||a>=n.right)return[r(t)];const c=t>e,u=c?n.left:n.right,f=c?n.right:n.left,p={place:"floor",riser:n.height,prop:null};return[r(u,nn(e,u)),{...p,x:u,act:"mount",ms:bV},{...p,x:f,act:"walk",ms:nn(u,f)},{x:f,prop:null,act:"dismount",ms:kV,place:"floor"},{x:t,prop:null,act:"walk",ms:nn(f,t),place:"floor"}]}function h2(e){let t=null,n=null,r=0,a=0,l=!1;const c=()=>{t!==null&&clearTimeout(t),t=null},u=()=>{l||e.hidden||!n||t!==null||(a=performance.now(),t=setTimeout(()=>{t=null;const p=n;n=null,p==null||p()},r))},f=()=>{e.hidden&&t!==null?(r=Math.max(0,r-(performance.now()-a)),c()):e.hidden||u()};return e.addEventListener("visibilitychange",f),{schedule(p,h){l||(c(),n=p,r=Math.max(0,h),u())},dispose(){l=!0,c(),n=null,e.removeEventListener("visibilitychange",f)}}}const Sc={"claude-fm":"Claude FM","lofi-relax":"Lofi Girl relax/study","lofi-game":"Lofi Girl chill/game","lofi-vibe":"Lofi Girl vibe/chill","lofi-sleep":"Lofi Girl sleep/chill","radio-mix":"Radio Mix Live","best-of-nostalgia":"Best of Nostalgia Live","good-life-radio":"The Good Life Radio Live","cafe-music-bgm":"Cafe Music BGM Live"},_V={"claude-fm":null,"lofi-relax":null,"lofi-game":null,"lofi-vibe":null,"lofi-sleep":null,"radio-mix":"/api/live-radio-mix","best-of-nostalgia":"/api/best-of-nostalgia","good-life-radio":"/api/good-life-radio","cafe-music-bgm":"/api/cafe-music-bgm"};function xx(e,t){var r;const n=((r=e[0])==null?void 0:r.length)??0;return o.jsx("svg",{viewBox:`0 0 ${n} ${e.length}`,shapeRendering:"crispEdges","aria-hidden":!0,children:lf(e).map(a=>o.jsx("rect",{x:a.x,y:a.y,width:a.w,height:1,fill:a.cell==="s"?"var(--fm-prop-shadow, var(--bg))":a.cell==="l"?"var(--fm-prop-light, var(--text))":a.cell==="a"?"var(--accent)":void 0},`${t}${a.y}-${a.x}`))})}const bx={e:"fm-eye",s:"fm-shade",p:"fm-pad"},Nh=lf().filter(e=>!xI.has(e.cell)),SV=lf().filter(e=>xI.has(e.cell)),f2=Nh.filter(e=>e.cell==="e"),jV=lf(gV),EV=Nh.filter(e=>e.y<f0&&e.cell!=="e").map(e=>{if(e.y!==8&&e.y!==9)return e;const t=Math.max(6,e.x);return{...e,x:t,w:Math.max(0,Math.min(12,e.x+e.w)-t)}}).filter(e=>e.w>0),CV={left:Nh.filter(e=>e.y>=f0&&e.x<d2),right:Nh.filter(e=>e.y>=f0&&e.x>=d2)},p2={litter:xx(vx.litter,"litter"),ball:xx(vx.ball,"ball"),scope:xx(vx.scope,"scope")},TV=x.memo(function({fetchImpl:t,volume:n,source:r="claude-fm"}){const[a,l]=x.useState(null),[c,u]=x.useState(!1),[f,p]=x.useState(!1),[h,m]=x.useState(!1),y=x.useRef(r),[w,_]=x.useState(0),[k,j]=x.useState(0),[b,S]=x.useState(null),[E,C]=x.useState(null),[T,R]=x.useState({x:0,drop:0}),[A,q]=x.useState("ledge"),[F,O]=x.useState("left"),[H,K]=x.useState(0),X=x.useRef(null),[I,Z]=x.useState(()=>document.hidden);x.useEffect(()=>{const L=new Set,te=()=>{var ne;if(document.hidden){for(const ie of((ne=X.current)==null?void 0:ne.getAnimations({subtree:!0}))??[])if(ie.playState==="running"||ie.pending){const me=ie.currentTime;ie.pause(),me!==null&&(ie.currentTime=me),L.add(ie)}}else{for(const ie of L)ie.playState==="paused"&&ie.play();L.clear()}Z(document.hidden)};return te(),document.addEventListener("visibilitychange",te),()=>document.removeEventListener("visibilitychange",te)},[a,c]);const[W,$]=x.useState(null),[z,U]=x.useState(SI),[V,B]=x.useState(()=>{var L;return((L=window.matchMedia)==null?void 0:L.call(window,"(prefers-reduced-motion: reduce)").matches)??!1});x.useEffect(()=>{var ne;const L=(ne=window.matchMedia)==null?void 0:ne.call(window,"(prefers-reduced-motion: reduce)");if(!L)return;const te=()=>B(L.matches);return te(),L.addEventListener("change",te),()=>L.removeEventListener("change",te)},[]);const Y=x.useRef(null),ue=x.useCallback(L=>{var te,ne;(ne=(te=Y.current)==null?void 0:te.contentWindow)==null||ne.postMessage(L,h0)},[]),G=x.useRef(n);if(G.current=n,x.useEffect(()=>{f&&ue(qd("setVolume",[n]))},[n,f,ue]),x.useEffect(()=>{let L=!0;const te=t??fetch,ne=y.current!==r;y.current=r,l(null),u(!1),p(ne),m(ne);const ie=_V[r];if(ie)te(ie).then(me=>me.ok?me.json():null).then(me=>{L&&(me!=null&&me.video)&&l({live:!0,channel:"",video:me.video})}).catch(()=>{});else if(r!=="claude-fm"){const me=r.replace("lofi-","");te(`/api/lofi-girl?station=${encodeURIComponent(me)}`).then(je=>je.ok?je.json():null).then(je=>{L&&(je!=null&&je.video)&&l({live:!0,channel:"",video:je.video})}).catch(()=>{})}else te("/api/claude-fm").then(me=>me.ok?me.json():null).then(me=>{L&&(me!=null&&me.live)&&(me!=null&&me.channel)&&l({live:!0,channel:me.channel})}).catch(()=>{});return()=>{L=!1}},[t,r]),x.useEffect(()=>{if(!f)return;const L=te=>{var ie;if(te.origin!==h0||te.source!==((ie=Y.current)==null?void 0:ie.contentWindow))return;const ne=I9(te.data);if(ne){if(ne.kind==="ready"){ue(qd("setVolume",[G.current])),ue(qd("playVideo"));return}if(ne.kind==="playing"){m(ne.playing);return}M9.includes(ne.code)&&(p(!1),m(!1),u(!0))}};return window.addEventListener("message",L),()=>window.removeEventListener("message",L)},[f,ue]),x.useEffect(()=>{var ot;if(!a||c||V)return;const L=h2(document);let te=0;_($e=>te=$e);let ne=null,ie=0,me=0;const je=$e=>{var qe,rt;const[oe,...ye]=$e;if(!oe){ne=null,S(null),C(null),_e();return}S(oe.act),C(oe.prop),q(oe.place??"ledge"),K(oe.riser??0);const Ce=te,De=Te(oe);if(oe.act==="kick"){const et=(rt=(qe=X.current)==null?void 0:qe.querySelector('.fm-prop[data-prop="ball"]'))==null?void 0:rt.getBoundingClientRect();et&&R({x:xV(et.x,wx(oe,Ce,"left"),window.innerWidth),drop:Math.max(48,window.innerHeight-et.y+24)})}me=oe.act==="walk"?Math.max(nn(Ce,De),W9):oe.ms,oe.act==="carry"&&(me=nn(Ce,De)),j(me),O(et=>wx({...oe,x:De},Ce,et)),_(De),te=De,ne=oe,ie=Date.now(),L.schedule(()=>je(ye),me)},Oe=()=>{const $e=X.current,oe=$e==null?void 0:$e.querySelector(".fm-sprite"),ye=$e==null?void 0:$e.parentElement;if(!$e||!oe||!ye)return null;const Ce=$e.getBoundingClientRect(),De=ye.getBoundingClientRect(),qe=De.right-Ce.right,rt=De.width-qe*2-oe.offsetWidth;return rt>0?rt:null},Ve=()=>{const $e=X.current,oe=$e==null?void 0:$e.querySelector(".fm-walker"),ye=Oe();if(!$e||!oe||ye==null)return;const Ce=$e.getBoundingClientRect().bottom-oe.getBoundingClientRect().bottom;if(Ce>0)return{ledgeH:Ce,floorSpan:ye}},Le=()=>{const $e=X.current,oe=document.querySelector(".autofit-chip");if(!$e||!oe)return null;const ye=$e.getBoundingClientRect(),Ce=oe.getBoundingClientRect();return Ce.width<=0||Ce.height<=0?null:{left:Ce.left-ye.right,right:Ce.right-ye.right,height:Ce.height}},Te=$e=>{const oe=($e.place??"ledge")==="floor",ye=oe?Oe()??Do:Do,Ce=oe&&$e.floorFrac!=null?-Math.round($e.floorFrac*ye):$e.x;return Math.max(-ye,Math.min(0,Ce))},nt=()=>{if(!ne)return;const $e=Te(ne);$e!==te&&(j(Math.max(0,ie+me-Date.now())),O(oe=>wx({...ne,x:$e},te,oe)),_($e),te=$e)},_e=()=>{L.schedule(()=>{const $e=lV(te,Math.random,Ve()),oe=$e.some(De=>De.place==="floor")?Le():null;let ye=te;const Ce=$e.flatMap(De=>{const qe=ye;if(ye=De.x,!(De.place==="floor"&&De.act==="walk"))return[De];const rt=NV(qe,De.x,oe),et=rt.length-1;return De.floorFrac==null?rt:rt.map((ve,Re)=>Re===et?{...ve,floorFrac:De.floorFrac}:ve)});je(Ce)},P9(Math.random))},Se=(ot=X.current)==null?void 0:ot.parentElement,Xe=typeof ResizeObserver>"u"?null:new ResizeObserver(nt);return Se&&Xe&&Xe.observe(Se),_e(),()=>{L.dispose(),Xe==null||Xe.disconnect(),q("ledge"),_($e=>Math.max(-Do,Math.min(0,$e))),j(0),S(null),C(null),K(0)}},[a,c,V]),x.useEffect(()=>{if(!h||V){$(null);return}const L=h2(document),te=ne=>{const ie=pV(ne,Math.random);$(ie.dance),U(ie.beatMs),L.schedule(()=>te(ie.dance),mV(Math.random))};return te(null),()=>L.dispose()},[h,V]),!a||c)return null;const ee=()=>{if(!f){p(!0),m(!0);return}const L=!h;m(L),ue(qd(L?"playVideo":"pauseVideo")),L||p(!1)};return o.jsxs("div",{ref:X,className:"fm","data-suspended":I?"":void 0,"data-place":A,style:{"--fm-beat":`${z}ms`},children:[E&&!E.held&&o.jsx("div",{className:"fm-prop","data-prop":E.kind,"data-leaving":E.leaving?"":void 0,style:{"--fm-prop-x":`${E.at}px`,"--fm-roll-to":`${T.x}px`,"--fm-ball-drop":`${T.drop}px`,"--fm-ball-flight-ms":`${kI}ms`,"--fm-ball-turn":F==="right"?"1080deg":"-1080deg"},children:p2[E.kind]}),(b==="lasso"||b==="rope-throw"||b==="rope-catch"||b==="climb"||b==="pull-up")&&o.jsxs("div",{className:"fm-rope","data-act":b,style:{"--fm-rope-x":`${w}px`,"--fm-rope-ms":`${k}ms`},children:[o.jsx("div",{className:"fm-rope-line"}),o.jsxs("svg",{className:"fm-rope-hook",viewBox:"0 0 9 9",shapeRendering:"crispEdges","aria-hidden":!0,children:[o.jsx("path",{d:"M4 8V3H3V1H1V3H0V5H2V4H3V6H5V4H6V5H8V3H7V1H5V3H4"}),o.jsx("rect",{className:"fm-rope-knot",x:"3",y:"6",width:"3",height:"2"})]})]}),o.jsxs("div",{className:"fm-walker","data-act":b??void 0,"data-place":A,"data-facing":F,style:{"--fm-x":`${w}px`,"--fm-walk-ms":`${k}ms`,"--fm-riser":`${H}px`,"--fm-skip-beat":`${NI}ms`},children:[(E==null?void 0:E.held)&&o.jsx("div",{className:"fm-held","data-prop":E.kind,"data-toss":E.leaving?"":void 0,children:p2[E.kind]}),["cast","fish","reel","stow"].includes(b)&&o.jsxs("svg",{className:"fm-fishing",viewBox:"0 0 24 32",shapeRendering:"crispEdges","aria-hidden":!0,children:[o.jsxs("g",{children:[o.jsx("path",{d:"M24 11H22V9H20V7H18V5H16V3H13V2H8"}),o.jsx("rect",{className:"fm-fishing-grip",x:"21",y:"9",width:"3",height:"3"})]}),o.jsxs("g",{className:"fm-fishing-line",children:[o.jsx("path",{d:"M8 2V26"}),o.jsxs("g",{className:"fm-float",children:[o.jsx("rect",{x:"7",y:"25",width:"3",height:"2"}),o.jsx("rect",{x:"8",y:"24",width:"1",height:"1"})]})]}),o.jsx("path",{className:"fm-ripple",d:"M3 28H6M10 28H14M5 30H12"})]}),["skip-ready","skip","skip-rest"].includes(b)&&o.jsxs("svg",{className:"fm-skipping-rope",viewBox:"0 0 26 26",shapeRendering:"crispEdges","aria-hidden":!0,children:[o.jsx("path",{className:"fm-skip-back",d:"M5 18H3V8H5V5H8V2H18V5H21V8H23V18H21"}),o.jsx("path",{className:"fm-skip-forward",d:"M5 18H3V14H5V11H8V9H18V11H21V14H23V18H21"}),o.jsx("path",{className:"fm-skip-front",d:"M5 18H3V21H5V23H8V25H18V23H21V21H23V18H21"}),o.jsx("path",{className:"fm-skip-return",d:"M5 18H3V19H8V20H18V19H23V18H21"}),o.jsx("path",{className:"fm-skip-handles",d:"M5 17V19M21 17V19"})]}),o.jsx("button",{type:"button",className:"fm-sprite","data-playing":h?"":void 0,"data-dance":h?W??_I[0]:void 0,"aria-pressed":h,onClick:ee,title:h?`Stop ${Sc[r]}`:`Play ${Sc[r]} — streams from YouTube`,"aria-label":h?`Stop ${Sc[r]}`:`Play ${Sc[r]}`,children:o.jsxs("svg",{viewBox:`0 0 ${s2} ${$9}`,shapeRendering:"crispEdges","aria-hidden":!0,children:[o.jsx("g",{className:"fm-gear",children:o.jsx("g",{className:"fm-gear-motion",children:SV.map(L=>o.jsx("rect",{x:L.x,y:L.y,width:L.w,height:1,className:bx[L.cell]},`g${L.y}-${L.x}`))})}),o.jsxs("g",{className:"fm-body",children:[f2.map(L=>o.jsx("rect",{x:L.x,y:L.y,width:L.w,height:1,fill:"var(--accent)"},`eye-bed-${L.x}`)),EV.map(L=>o.jsx("rect",{x:L.x,y:L.y,width:L.w,height:1,className:bx[L.cell]},`b${L.y}-${L.x}`)),o.jsxs("g",{className:"fm-arms",children:[o.jsx("rect",{x:4,y:8,width:2,height:2}),o.jsx("rect",{x:12,y:8,width:1,height:2}),o.jsx("rect",{x:13,y:8,width:1,height:2,className:"fm-shade"})]}),f2.map(L=>o.jsx("rect",{x:L.x-(L.x>=s2/2?1:0)+(F==="right"?1:0),y:L.y,width:L.w,height:1,className:"fm-eye"},`eye-${L.x}`))]}),o.jsx("g",{className:"fm-hat",children:jV.map(L=>o.jsx("rect",{x:yV+L.x,y:wV+L.y,width:L.w,height:1,className:L.cell==="k"?"fm-hatband":void 0},`h${L.y}-${L.x}`))}),(b==="climb"||b==="rope-throw"||b==="rope-catch"||b==="pull-up")&&o.jsxs("g",{className:"fm-grip",children:[o.jsx("path",{className:"fm-grip-left",d:"M5 9H4V4H7V3H9V5H6V9Z"}),o.jsx("path",{className:"fm-grip-right",d:"M12 9H14V6H11V5H9V7H12Z"})]}),(b==="land"||b==="dismount")&&o.jsxs("g",{className:"fm-crouch-legs",children:[o.jsx("path",{d:"M6 11H8V13H6Z"}),o.jsx("path",{d:"M10 11H12V13H10Z"})]}),["sit","cast","fish","reel","stow"].includes(b)&&o.jsxs("g",{className:"fm-seated-legs",children:[o.jsx("path",{className:"fm-seated-far",d:"M10 10H12V11H11V14H8V13H9V11H10Z"}),o.jsx("path",{d:"M6 10H9V11H7V15H4V14H5V11H6Z"})]}),["left","right"].map(L=>o.jsx("g",{className:"fm-leg","data-side":L,children:CV[L].map(te=>o.jsx("rect",{x:te.x,y:te.y,width:te.w,height:1,className:bx[te.cell]},`${L}${te.y}-${te.x}`))},L))]})})]}),f&&(a.channel||a.video)&&o.jsx("iframe",{ref:Y,className:"fm-frame",title:Sc[r],src:C9(a.channel,window.location.origin,a.video),onLoad:()=>ue(T9()),allow:"autoplay; encrypted-media",sandbox:"allow-scripts allow-same-origin allow-presentation"})]})}),AV=15e3;function RV(e){return e.visibilityState==="visible"&&e.hasFocus()}function MV(e,t){return t||e===!0}function IV(){try{if(typeof crypto<"u"&&typeof crypto.randomUUID=="function")return crypto.randomUUID()}catch{}return`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}const $V={"//":["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.","","A release that genuinely has nothing to say is spelled TWICE: no key here,",'and its version written into "//nothing-to-say" below. One spelling on its',"own is ambiguous — a missing key reads the same whether it was a decision","or a forgotten step, and five releases in a row were once forgotten. The list","is what tells the two apart, and release-notes-current-version.test.ts fails","the release whose version is in neither place. Any key opening with // is a","note to the author and never a release."],"//nothing-to-say":["3.23.1","3.23.2","3.23.3","3.23.4","3.26.0","3.26.1","3.26.3","3.26.4","3.26.5","3.27.6","3.27.7","3.28.0"],"3.27.0":[{title:"📊 Projects: where each account spent its work",body:"Each account card's ⋯ menu now breaks its cost down by project, over 7d / 30d / all."}],"3.27.1":[{title:"🎨 Make Appearance easier to tune",body:"The Appearance dialog now has clearer sections, stronger selection states, and a calmer layout for choosing a theme and configuring music. Your existing settings and keyboard shortcuts continue to work."}],"3.27.2":[{title:"💰 Project costs now match Usage",body:"Project cost totals no longer count the same Claude request once for every content block. Existing project history is rebuilt automatically so the totals align with the Usage panel."}],"3.27.3":[{title:"🎵 Station selection works in the desktop app",body:"The music station picker now opens inside ccdeck instead of relying on the operating system popup, so choosing a station works reliably in the Electron app."}],"3.27.4":[{title:"✅ Desktop picker release checks are green",body:"The station picker now keeps the same keyboard, motion, focus, and layout behavior as the rest of ccdeck across desktop and browser builds."}],"3.27.5":[{title:"🧭 The welcome tour stays dismissed",body:"Electron now remembers that you completed the onboarding tour at the deck level, so an update or loopback port change no longer shows the same tour again."},{title:"🎵 The station picker has a clearer finish",body:"The music selector has a tighter trigger, a purposeful chevron, and more deliberate option spacing so it reads like a native part of Appearance."}],"3.25.0":[{title:"🖱️ A click goes to the session, a double-click opens the details",body:"Clicking a card frames it with the rest of its session and leaves the detail panel shut. Double-click a card to open its details; `j`/`k`, the session list, Enter and `D` still open them too."},{title:"🔭 Cards stay readable when you zoom out",body:"At every zoom a card shows its name, its state and anything waiting on you, instead of shrinking to a coloured pill. Hover or focus a card to see it whole. Recap notes read at a distance too, and show the full recap on hover."},{title:"🌐 The Machine panel shows your network",body:"A new Network section shows download, upload and the round trip to Claude's API, and names the route when traffic goes through a VPN or a Tailscale exit node. Those checks run only while the panel is open. The panel is regrouped into CPU, Memory, Network and Thermal, with a flag at the top when something needs attention."},{title:"🎨 See each theme before you pick it",body:"The Appearance menu shows a small preview of the deck in Light and in Dark. Claude FM also keeps its volume when a notification chime plays, instead of dipping under it."}],"3.24.1":[{title:"🎛️ Appearance is one small menu now",body:"The topbar's appearance control opens a compact menu where you can choose Light or Dark and show or hide the character. The character stays on by default, and your choice is remembered."}],"3.24.0":[{title:"🎧 Claude FM plays from the minimap",body:"A small character stands on the minimap's top edge. Press it and the Claude channel's live stream plays; press it again and it stops. It only turns up when the channel is actually broadcasting, so a deck with no network never shows it at all."},{title:"🤠 And it gets on with its day",body:"It walks that edge, tidies up what it finds, kicks a ball along it, sits with its legs over the side, and watches the board through a scope. Now and then it drops onto the canvas and ropes its way back up. Headphones on while the music plays, a hat when it does not."}],"3.23.5":[{title:"🧭 The accounts panel opens on the account you are on",body:"Its windows, its resets and how old the numbers are — whole, at the top of the column. Every other account stands behind one row that says how many of them a switch could actually reach; press it to see them, or rest on it to be shown their names and how much room each has left."},{title:"⚙️ Auto-switch moved in there with them",body:"It is behind that same row now, after the accounts it switches between, rather than at the foot of the panel. The row says `auto 90%` or `auto off` so you can tell what the policy is doing without opening it — and says so in amber when it is armed with nowhere left to go."}],"3.23.0":[{title:"🧭 The accounts column leads with accounts",body:`The live account is the open row: its windows as bars, when each one resets, and how old the numbers are. Every other account rests on the two figures a switch is decided by, and opens with a click when you want the rest.
|
|
93
|
+
|
|
94
|
+
A problem stays on the row — an expired login, one that was never stored, a keychain the deck cannot open — with the reason and the sign-in one press away. Auto-switch is one row now: its threshold and its switch. Local network moved out of the column into a view of its own, reached from a row at the foot that says how many of the paired machines are on right now, and shows which ones when you hover it.`},{title:"💬 A resting session shows Claude Code's recap beside its card",body:"When a session stops, Claude Code's own recap of what it did is drawn beside the card — so a board you come back to says what happened without opening anything."},{title:"🪟 The chrome went quiet",body:`The topbar is borderless, one set of corners runs through the app, the canvas ground is flat, and the minimap, the zoom controls, the type filter and the Machine and Usage panels read as tooling rather than as cards.
|
|
95
|
+
|
|
96
|
+
The canvas also says when auto-fit is off, with one press to bring new sessions back into view.`},{title:"🔍 A tool call's detail reads as the call",body:"A tool call's arguments are shown as the call rather than as escaped JSON, and can be copied."},{title:"🔐 Saying yes to every deck that asks takes two presses",body:"The switch that accepts every pairing request arms first and says what it hands over, so one stray click cannot put this machine's logins on another deck."},{title:"🖐️ Targets, themes and contrast",body:"The panel's smallest controls reach the 24px target floor, and grow further under a finger. A first run follows the system's light or dark setting instead of picking one. Status dots, meters and switch knobs survive a Windows Contrast theme."}],"3.22.15":[{title:"🖱️ Clicking a card opens its details",body:"Selecting an agent is inspecting it: a click, `j`/`k`, a session picked from the list and Enter on a focused card all open the detail panel — prompt, every tool call, tokens, timing. It used to open only with `D`, so anybody who closed it with its × and never found the key did not get it back. The × still closes it until the next selection, and `D` still toggles it.\n\n`D` with nothing selected now picks a card first — the session that has waited longest, or the one `j` would land on — instead of flipping a switch with nothing on screen to show for it."},{title:"⌨️ The keyboard and screen readers reach the whole deck",body:`Shortcuts keep working after a mouse click on a button. A click left focus on the button it pressed, and the key handler leaves a focused control its own keys, so every single-key shortcut was dead until you pressed Esc — with nothing on screen to say so.
|
|
97
|
+
|
|
98
|
+
Tab follows the page now — topbar, the accounts column, the canvas, usage, machine — instead of zig-zagging left and right across it, and a canvas card reached by Tab draws the focus ring. A screen reader hears each card by name, with its kind, state, model and cost, rather than every word on it run together; the machine panel has a heading its region is named by; and the theme button is named for the theme it switches to.
|
|
99
|
+
|
|
100
|
+
With **Reduce motion** set, the camera no longer flies across the canvas to a card.`},{title:"💵 The money figures say what they measure",body:"The usage header's **$/min** is spend over a trailing window, and says which span it measured: `$3.54/min · 2 min`. It used to divide the live agents' cost by how long the longest of them had been running, so one deck read $2.39/min in a tab left open and $19.49/min in a tab opened minutes later.\n\nA quota bar's pace says **over pace** or **under pace**. It said `ahead`, which is how plain English says winning, on the very line meant to warn you that you are burning the window faster than it lasts.\n\nA card's clock reads `≥ 53m 52s` for a session this page joined after it had started, instead of presenting the part it saw as the whole of it — and that card's per-minute burn is left out rather than divided by the short clock."},{title:"↔️ Narrow windows keep every topbar control on screen",body:`At 400px six of the topbar's buttons sat past the right edge and the page scrolled sideways. The readouts give way first now and the controls stay; below 640px the side panels span the window instead of leaving the canvas a sliver; and the category filter wraps inside the canvas rather than being clipped by it.
|
|
101
|
+
|
|
102
|
+
Zoomed out, a card's name and a cluster's label stay readable instead of shrinking to about four pixels — which is the view a board of any size actually sits at.`},{title:"🔑 A paired deck's dialog says which account that machine is on",body:`The lane of the account the other machine is working on takes the accent and a slow ring on that machine's end. An account is named only if that deck shares it: on one it does not share, the dialog reads "on another account" and never which. A new switch under **SHARE THESE ACCOUNTS**, on by default, turns the telling off, and paired decks then read "current account hidden".
|
|
103
|
+
|
|
104
|
+
**This deck on the network** prints this deck's own fingerprint again. A pairing request asks you to match it against the one on the other machine's screen, and no screen here was showing it — so the one check a person can make against a rogue deck could not be made, on the step that hands over logins.`},{title:"💬 The deck's messages send you somewhere worth going",body:'An empty canvas no longer ends with "Make sure ccdeck is running" while the page is plainly connected to it. The capture hints under that line, one per CLI, are the real reasons a canvas stays empty, and they stay. With the stream down the screen says whether this page lost a deck that was there or never found one, in those words, rather than naming the `/events` route nobody who typed `npx ccdeck` has seen.\n\nAnd a slow `claude-swap` now reads as a slow answer — "still waiting on the deck server" — instead of "couldn\'t reach the deck server", which sent people off to restart a server that was fine.'}],"3.22.10":[{title:"🖱️ Icon buttons are easier to hit",body:"Icon buttons react when the pointer is near them — no need to hit the icon exactly."},{title:"🧩 Sessions spread across the canvas",body:"Sessions now spread across the canvas in columns instead of one tall column, and new sessions and subagents land in the free space beside them. Nothing is placed under the Machine or Usage panels. Press R once to rearrange a board you already have."}],"3.21.0":[{title:"🖼️ The deck explains itself in pictures",body:"🎬 First run opens an eight-picture tour instead of the changelog — who is waiting on you, the tree, a node's inside, cost and quota, this machine, accounts, local network, how to start. `Take the tour` on an empty canvas brings it back.\n\n📡 **Local network** has a guide: a card while it is off, `How it works` under an empty list, four pictures ending on `Turn it on`. A machine's row opens its own dialog — address, version and system, the logins it offers, and a name of your own for it. Setup ends on Done.\n\n🔄 The deck updates itself when nobody is looking: no tab focused, no agent mid-turn, thirty seconds quiet. The banner's `auto when idle` switch governs it.\n\n🔑 An account whose numbers were paused resumes on its own, and the panel is titled **Claude accounts** — a Codex login is not in it."}],"3.20.0":[{title:"🟢 The deck keeps running after you close the terminal",body:"`ccdeck` prints the same boot report and gives you the prompt back. The deck stays up, and starts again when you log in.\n\n🛑 **`ccdeck --stop` is the off switch now** — Ctrl+C only cancels a start that is still printing. `--status` says what is running, `--logs` shows what the deck wrote while you were away, and `--foreground` holds the terminal the way every version before this one did.\n\n🔁 Typing `ccdeck` beside a deck that is already up opens **that deck's tab** instead of building a second one. `ccdeck --stop --all` clears any older deck still running from before this version. An `npx` run cannot start at login — `npx ccdeck --install` puts it on your PATH and sets that up.\n\n🔑 An account that will not collect now says which of three things is wrong: **no stored login**, a **login that expired**, or a **keychain the deck cannot open** — with the fix beside it. One with no stored login is filled over the local network by a paired deck that has it.\n\n📡 And decks find each other again on a machine with a VPN up: the beacon was going to an address that never left the machine, so this deck could hear colleagues and none of them could hear it."}],"3.19.0":[{title:"🟢 Local network: fixes and improvements",body:`The list of decks is quiet now. A deck that is **on**, with nothing to repair, is a name and a green mark — no sentence under it. Every healthy row used to carry the same words, so the one row worth reading looked like all the others. A failure, a login that arrived, a machine that is away, still say so, and they are now the only rows with anything written on them.
|
|
105
|
+
|
|
106
|
+
\`unpair\` arrives when you point at a row rather than sitting on every one of them, two machines that share a name show their addresses, and the ↻ turns while a round is out.
|
|
107
|
+
|
|
108
|
+
**Add a deck** is two ways in — by address, or with an invite — with \`make one to send\` beside the invite heading instead of under the paste field, where it read as that field's button. A refused address now says which mistake it was, and an invite that will not work says whether it ran out, was not an invite, or reached nothing.
|
|
109
|
+
|
|
110
|
+
Switching **Local network** on opens your name and shared logins, every time, so nothing goes on the network without you having just seen what goes with it.`}],"3.18.3":[{title:"🟢 The list shows what is on, and folds the rest",body:'A machine that is off, or nearby and unpaired, or one you said no to, is context rather than an answer to "who can I use right now" — so the decks that are **on** lead the list and everything else is one line: `2 more`. Nothing worrying is hidden by it: a deck that cannot be reached is counted in that line, in the warning colour, so the fold says whether it is worth opening.\n\nThe round moved to a **↻ beside the switch**, where the accounts header has kept the same act since it was written, and the line under the state now says when it last ran — `checked 2m ago`, or `not checked yet`. A list that refreshes itself and a list that has stopped used to look identical, and pressing the button to find out was the only way to tell.'}],"3.18.1":[{title:"🔁 A deck stops asking to pair over and over",body:"Several decks on one computer share a config directory, so they start with one key. Each read the others' beacons as somebody wearing its name, took a fresh key, and wrote it to the file the others read — a loop that never settles. Every new key is a **new deck** to everyone else on the network, so one machine sent a fresh pairing request every few seconds and accepting one accomplished nothing: the deck that asked no longer existed by the time the answer arrived.\n\nDecks on one computer now recognise each other as the same machine and leave the key alone. The clash still worth healing — a `~/.claude` copied to a second machine — is unchanged.\n\nThis also collapses the rows: a computer that has run the deck a few times appeared several times on everybody else's panel and is one row now. **Both machines need this version** for that to take effect on the other one's screen.\n\nA deck that answered is no longer counted as unreachable, the list refreshes itself in seconds while somebody is deciding rather than at the next minute, and a failed round says what happened — `not listening`, `no route to it` — with the address and the raw error on the hover."}],"3.18.0":[{title:"🟢 A deck that is switched off no longer reads as on",body:"A paired deck this one has no address for was drawn **live** on the strength of being paired — a machine closed an hour ago still sat under `1 deck ready`. Every row now leads with whether that machine is actually there, and when it last was: `online · 1 login arrived`, `no answer · last online 20m ago`, `never reached`. The mark beside the name is a traffic light — green for a deck that answered, amber for one that cannot be reached, grey for one nothing has heard from.\n\n**+ add a deck** opens a dialog now instead of unfolding inside the panel. An address, an invite and the firewall note never fitted a 288px column, and unfolded they turned a list of machines into a form."}],"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.
|
|
111
|
+
|
|
112
|
+
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.
|
|
113
|
+
|
|
114
|
+
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.
|
|
115
|
+
|
|
116
|
+
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.
|
|
117
|
+
|
|
118
|
+
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.
|
|
119
|
+
|
|
120
|
+
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.
|
|
121
|
+
|
|
122
|
+
What you are reading is the first version that does not.
|
|
123
|
+
|
|
124
|
+
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.
|
|
125
|
+
|
|
126
|
+
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.
|
|
127
|
+
|
|
128
|
+
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.
|
|
129
|
+
|
|
130
|
+
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.
|
|
131
|
+
|
|
132
|
+
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.
|
|
133
|
+
|
|
134
|
+
The count of what is behind it is on the heading's tooltip, so collapsing it does not hide how much there is.
|
|
135
|
+
|
|
136
|
+
**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.
|
|
137
|
+
|
|
138
|
+
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.
|
|
139
|
+
|
|
140
|
+
\`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.
|
|
141
|
+
|
|
142
|
+
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.
|
|
143
|
+
|
|
144
|
+
**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.
|
|
145
|
+
|
|
146
|
+
**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.
|
|
147
|
+
|
|
148
|
+
**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.
|
|
149
|
+
|
|
150
|
+
**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.
|
|
151
|
+
|
|
152
|
+
**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.
|
|
153
|
+
|
|
154
|
+
**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.
|
|
155
|
+
|
|
156
|
+
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.
|
|
157
|
+
|
|
158
|
+
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.
|
|
159
|
+
|
|
160
|
+
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.
|
|
161
|
+
|
|
162
|
+
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.
|
|
163
|
+
|
|
164
|
+
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.
|
|
165
|
+
|
|
166
|
+
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.
|
|
167
|
+
|
|
168
|
+
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.
|
|
169
|
+
|
|
170
|
+
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.
|
|
171
|
+
|
|
172
|
+
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.
|
|
173
|
+
|
|
174
|
+
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.
|
|
175
|
+
|
|
176
|
+
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.
|
|
177
|
+
|
|
178
|
+
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.
|
|
179
|
+
|
|
180
|
+
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.
|
|
181
|
+
|
|
182
|
+
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.
|
|
183
|
+
|
|
184
|
+
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.
|
|
185
|
+
|
|
186
|
+
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.
|
|
187
|
+
|
|
188
|
+
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.
|
|
189
|
+
|
|
190
|
+
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.
|
|
191
|
+
|
|
192
|
+
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.
|
|
193
|
+
|
|
194
|
+
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.
|
|
195
|
+
|
|
196
|
+
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.
|
|
197
|
+
|
|
198
|
+
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.
|
|
199
|
+
|
|
200
|
+
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.
|
|
201
|
+
|
|
202
|
+
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.
|
|
203
|
+
|
|
204
|
+
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.
|
|
205
|
+
|
|
206
|
+
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.
|
|
207
|
+
|
|
208
|
+
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.
|
|
209
|
+
|
|
210
|
+
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.
|
|
211
|
+
|
|
212
|
+
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.
|
|
213
|
+
|
|
214
|
+
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.
|
|
215
|
+
|
|
216
|
+
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.
|
|
217
|
+
|
|
218
|
+
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.
|
|
219
|
+
|
|
220
|
+
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.
|
|
221
|
+
|
|
222
|
+
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.
|
|
223
|
+
|
|
224
|
+
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.
|
|
225
|
+
|
|
226
|
+
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.
|
|
227
|
+
|
|
228
|
+
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.
|
|
229
|
+
|
|
230
|
+
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.
|
|
231
|
+
|
|
232
|
+
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.
|
|
233
|
+
|
|
234
|
+
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".
|
|
235
|
+
|
|
236
|
+
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.
|
|
237
|
+
|
|
238
|
+
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.
|
|
239
|
+
|
|
240
|
+
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.
|
|
241
|
+
|
|
242
|
+
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.
|
|
243
|
+
|
|
244
|
+
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.
|
|
245
|
+
|
|
246
|
+
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.
|
|
247
|
+
|
|
248
|
+
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.
|
|
249
|
+
|
|
250
|
+
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.
|
|
251
|
+
|
|
252
|
+
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.
|
|
253
|
+
|
|
254
|
+
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.
|
|
255
|
+
|
|
256
|
+
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.
|
|
257
|
+
|
|
258
|
+
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.
|
|
259
|
+
|
|
260
|
+
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.
|
|
261
|
+
|
|
262
|
+
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.
|
|
263
|
+
|
|
264
|
+
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.
|
|
265
|
+
|
|
266
|
+
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.
|
|
267
|
+
|
|
268
|
+
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.
|
|
269
|
+
|
|
270
|
+
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.
|
|
271
|
+
|
|
272
|
+
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.
|
|
273
|
+
|
|
274
|
+
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.
|
|
275
|
+
|
|
276
|
+
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.`}],"3.22.1":[{title:"🖥️ A first run now opens This machine too",body:`Accounts and usage already opened themselves the first time you ran the deck; the machine panel did not, and now does. It is the panel that answers "is this box coping" — cores, memory, load, temperature — and somebody meeting the deck for the first time cannot ask for a panel they do not know is there.
|
|
277
|
+
|
|
278
|
+
It only does this when you have never said otherwise. Close it once and it stays closed, on that browser, for good — the same rule the other two panels have always followed. Nothing reopens it behind you.
|
|
279
|
+
|
|
280
|
+
While it is open it polls this machine once every few seconds, and it stops the moment you close it or switch tabs.`}],"3.22.4":[{title:"📈 A card stops looking idle while it is thinking",body:`The activity chart on each card counted tool calls and nothing else, so the time an agent spends reading, reasoning and writing drew as a flat line — measured on this machine, 16.5% of all working time, more than the time spent inside the tools themselves. A session that was busy looked exactly like one that had died, and the only way to tell them apart was to wait and see whether anything ever appeared.
|
|
281
|
+
|
|
282
|
+
It marks that work now. A chart with bars in it means the agent is doing something, whether or not it has called a tool in the last minute; a flat chart means it genuinely is not. Hover it for the split — how many tool calls and how many blocks of thinking and writing landed in the last 60 seconds.
|
|
283
|
+
|
|
284
|
+
Nothing was added to the card and nothing new is polled. The deck already reads each session's transcript for its token counts; this reads the same file for what the model has finished writing, and a session that is quiet costs one file check per second and a half.`}]},Nb="agent-dag.releaseNotesSeen";function m2(e){return e.split(/[.\-+]/).map(t=>parseInt(t,10)).map(t=>Number.isNaN(t)?0:t)}function hl(e,t){const n=m2(e),r=m2(t);for(let a=0;a<Math.max(n.length,r.length);a++){const l=(n[a]??0)-(r[a]??0);if(l!==0)return l<0?-1:1}return 0}function fl(e){return typeof e=="string"&&/^\d+\.\d+\.\d+/.test(e)}function OV(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 LV(e){if(!e||typeof e!="object")return[];const t=[];for(const[n,r]of Object.entries(e)){if(!fl(n)||!Array.isArray(r))continue;const a=r.filter(OV);a.length&&t.push({version:n,notes:a})}return t.sort((n,r)=>hl(r.version,n.version))}const g2=LV($V);function jI(e,t,n){return e.filter(r=>hl(r.version,n)<=0&&(t===null||hl(r.version,t)>0))}function PV(e,t){return e.filter(n=>hl(n.version,t)===0)}function DV(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 FV({since:e,running:t,entries:n,firstRun:r}){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 c=n.length===1?"one release":`${n.length} releases`;return`You were last caught up at v${e}. Since then ${c} changed something you would notice. Clicking the version in the topbar brings this back.`}if(r&&fl(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(!fl(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 l=hl(a,t);return l<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.`:l>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 qV=new RegExp("^(?:\\p{Extended_Pictographic}|\\p{Emoji_Modifier}|\\p{Regional_Indicator}|[\\u200D\\uFE0F])+(?= \\S)","u");function BV(e){const t=qV.exec(e);return t?{icon:t[0],rest:e.slice(t[0].length)}:{icon:null,rest:e}}function y2(){if(typeof window>"u")return null;try{return window.localStorage}catch{return null}}function zV(e){if(!e)return null;let t=null;try{t=e.getItem(Nb)}catch{return null}return fl(t)?t:null}function HV(e){if(!e)return!1;try{return e.getItem(Nb),!0}catch{return!1}}function UV(e,t){if(!e)return!1;try{return e.setItem(Nb,t),!0}catch{return!1}}const EI="agent-dag.tourSeen";function WV(e){if(!e)return!1;try{return e.getItem(EI)==="1"}catch{return!1}}function VV(e){if(!e)return!1;try{return e.setItem(EI,"1"),!0}catch{return!1}}function GV({tourSeen:e,decision:t}){if(t.reason==="no-version"||t.reason==="cannot-remember")return{tour:!1,notes:"none"};if(t.reason==="welcome"||t.reason==="first-run")return{tour:!e,notes:"none"};const n=t.show.length>0;return e?{tour:!1,notes:n?"now":"none"}:{tour:!0,notes:n?"after":"none"}}function KV({stored:e,running:t,notes:n,remembers:r=!0}){if(!fl(t))return{show:[],record:null,reason:"no-version"};if(!fl(e)){if(!r)return{show:[],record:t,reason:"cannot-remember"};const c=PV(n,t);return c.length?{show:c,record:t,reason:"welcome"}:{show:[],record:t,reason:"first-run"}}const a=hl(e,t);if(a===0)return{show:[],record:null,reason:"seen"};if(a>0)return{show:[],record:null,reason:"ahead"};const l=jI(n,e,t);return l.length?{show:l,record:t,reason:"new-notes"}:{show:[],record:t,reason:"nothing-new"}}function YV(e,t){if(/\s|^$/.test(e[t+2]??""))return-1;let n=t+2;for(;n<e.length;){if(e[n]==="`"){const r=e.indexOf("`",n+1);if(r<0)break;n=r+1;continue}if(e.startsWith("**",n)&&!/\s/.test(e[n-1]??" "))return n;n++}return-1}function CI(e,t=!0){const n=[];let r="";const a=()=>{r&&(n.push({kind:"text",text:r}),r="")};let l=0;for(;l<e.length;){if(e[l]==="`"){const c=e.indexOf("`",l+1);if(c>l+1){a(),n.push({kind:"code",text:e.slice(l+1,c)}),l=c+1;continue}}else if(t&&e.startsWith("**",l)){const c=YV(e,l);if(c>0){a(),n.push({kind:"bold",kids:CI(e.slice(l+2,c),!1)}),l=c+2;continue}}r+=e[l],l+=1}return a(),n}function XV({entries:e,since:t,running:n,firstRun:r,onClose:a,onTour:l,onRestart:c}){const u=sn(a),f=DV(e);return o.jsx("div",{className:"modal-backdrop",onClick:a,role:"presentation",children:o.jsxs("div",{ref:u,className:"modal release-notes",onClick:p=>p.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"release-notes-title",children:[o.jsxs("header",{className:"modal-head",children:[o.jsxs("div",{className:"modal-title",children:[o.jsx("span",{id:"release-notes-title",className:"modal-tool-name",children:"What's new"}),f&&o.jsx("span",{className:"modal-tool-id",children:f})]}),o.jsx("div",{className:"modal-actions",children:o.jsx("button",{type:"button",className:"glyph-btn",onClick:a,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),o.jsxs("section",{className:"modal-body",children:[o.jsx("p",{className:"modal-note",children:FV({since:t,running:n,firstRun:r,entries:e})}),l&&o.jsxs("div",{className:"guide-door",children:[o.jsx("span",{children:"Eight pictures of what the deck shows."}),o.jsx("button",{type:"button",className:"btn",onClick:l,children:"Take the tour"})]}),c&&o.jsxs("div",{className:"guide-door",children:[o.jsx("span",{children:"Restart the deck. Sessions, settings and pairings come back as they were."}),o.jsx("button",{type:"button",className:"btn",onClick:c,children:"Restart"})]}),e.map(p=>o.jsxs("section",{className:"modal-section",children:[o.jsxs("h3",{className:"rn-version",children:["v",p.version]}),o.jsx("ul",{className:"rn-notes",children:p.notes.map((h,m)=>{const{icon:y,rest:w}=BV(h.title);return o.jsxs("li",{className:"rn-note",children:[o.jsxs("p",{className:"rn-note-title",children:[y&&o.jsx("span",{className:"rn-note-icon",children:y}),w]}),o.jsx("p",{className:"rn-note-body",children:TI(CI(h.body))})]},m)})})]},p.version))]})]})})}function TI(e){return e.map((t,n)=>t.kind==="text"?t.text:t.kind==="code"?o.jsx("code",{className:"rn-code",children:t.text},n):o.jsx("strong",{className:"rn-strong",children:TI(t.kids)},n))}function ZV(e){return e.slice().sort((t,n)=>t.y-n.y||t.x-n.x)}function QV(e,t,n){var c;if(e.length===0)return null;const r=ZV(e),a=t?r.findIndex(u=>u.id===t):-1,l=a===-1?n===1?0:r.length-1:(a+n+r.length)%r.length;return((c=r[l])==null?void 0:c.id)??null}const JV=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Escape","Delete","Backspace"]);function eG(e,t){return t==null?{kind:"deck",nodeId:null}:e.key==="Enter"||e.key===" "?{kind:"activate",nodeId:t,additive:e.shiftKey}:JV.has(e.key)?{kind:"node",nodeId:t}:{kind:"deck",nodeId:t}}const tG=new Set(["","BODY","HTML","#DOCUMENT"]);function nG(e){return!e||z0(e)?!1:!tG.has(String(e.tagName??"").toUpperCase())}const _b="agent-dag.removedNodes";function rG(e){try{const t=JSON.parse((e==null?void 0:e.getItem(_b))??"[]");return new Set(Array.isArray(t)?t.filter(n=>typeof n=="string"):[])}catch{return new Set}}function sG(e,t){try{e==null||e.setItem(_b,JSON.stringify([...t]))}catch{}}function aG(e,t,n){const r=new Map(e.map(f=>[f.id,f.data.parentId])),a=new Set(n),l=f=>{if(a.has(f))return!0;const p=new Set([f]);let h=r.get(f);for(;h&&!p.has(h);){if(a.has(h))return a.add(f),!0;p.add(h),h=r.get(h)}return!1},c=e.filter(f=>!l(f.id)&&!l(f.data.sessionId??f.id)),u=new Set(c.map(f=>f.id));return{nodes:c,edges:t.filter(f=>u.has(f.source)&&u.has(f.target))}}function oG(e,t){if(!t||!e.agents.get(t))return null;const r=new Set([t]);let a=t;for(;a;){const c=e.agents.get(a);if(!(c!=null&&c.parentId)||r.has(c.parentId))break;r.add(c.parentId),a=c.parentId}let l=!0;for(;l;){l=!1;for(const c of e.agents.values())c.parentId&&r.has(c.parentId)&&!r.has(c.id)&&(r.add(c.id),l=!0)}return r}function iG(e,t){const n=new Set;for(const r of t){const a=oG(e,r);if(a)for(const l of a)n.add(l)}return n.size>0?n:null}const lG=40,cG=120;function uG(e,t){let n=null,r=0,a=Number.NEGATIVE_INFINITY;const l=()=>{n=null,a=t.now(),e()},c=()=>{n!=null&&(t.clearTimeout(n),n=null)},u=(f,p,h)=>{if(n!=null){if(r<=f)return;c()}const m=Math.min(h,Math.max(0,f-p));r=f,n=t.setTimeout(l,m)};return{live(f=lG){const p=t.now(),h=Math.max(a+f,p);if(h<=p){c(),l();return}u(h,p,f)},replay(f=cG){c(),r=t.now()+f,n=t.setTimeout(l,f)},flush(){c(),l()},cancel(){c()}}}const dG=1e3;function hG(e={}){const t=Math.max(1,Math.floor(e.limit??dG)),n=e.protect;let r=!1,a=[],l=new Set,c=0,u=0,f=null;return{get paused(){return r},get size(){return a.length},get dropped(){return c},get overflowed(){return c>0},get through(){return u},accept(p){const h=typeof(p==null?void 0:p.seq)=="number"?p.seq:null,m=(p==null?void 0:p.epoch)??null,y=m!==null&&m!==f;y&&(f=m,u=0);const w=h!==null&&!y&&h<=u;if(h!==null&&h>u&&(u=h),!r)return!0;if(w)return!1;if(a.push(p),n!=null&&n(p)&&l.add(p),a.length>t){let _=0;if(l.size<a.length)for(;l.has(a[_]);)_++;const[k]=a.splice(_,1);l.delete(k),c++}return!1},setPaused(p){if(r=p,p)return[];const h=a;return a=[],l=new Set,c=0,h}}}const AI="agent-dag.theme";function fG(e,t=!1){return e==="light"||e==="dark"?e:t?"light":"dark"}function pG(){try{return window.matchMedia("(prefers-color-scheme: light)").matches}catch{return!1}}function mG(){return fG(ms(AI),pG())}const gG=6,yG="ccdeck-tabs";function wG(e){return e>=gG}function vG(e,t,n){const r=a=>{const l=a.data;(l==null?void 0:l.kind)==="who"&&l.from!==t&&e.postMessage({kind:"here",from:t,to:l.from,streaming:n()})};return e.addEventListener("message",r),{ask(a,l=(c,u)=>setTimeout(c,u)){return new Promise(c=>{const u=new Set,f=p=>{const h=p.data;(h==null?void 0:h.kind)==="here"&&h.to===t&&h.streaming&&u.add(h.from)};e.addEventListener("message",f),e.postMessage({kind:"who",from:t}),l(()=>{e.removeEventListener("message",f),c(u.size)},a)})},leave(){var a;e.removeEventListener("message",r),(a=e.close)==null||a.call(e)}}}function xG({waiting:e,running:t,connected:n=!0}){return{title:e>0?`(${e}) ${tn}`:tn,icon:n?e>0?"waiting":t>0?"running":"idle":"offline"}}const zd={offline:"#e05252",waiting:"#c97d12",running:"#2a90d4",idle:"#7e828c"};function Hd(e,t){const a=c=>`<circle cx="16" cy="16" r="12" fill="none" stroke="${e}" stroke-width="5"${c}/>`;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 bG=Object.freeze({offline:`data:image/svg+xml,${encodeURIComponent(Hd(zd.offline,"offline"))}`,waiting:`data:image/svg+xml,${encodeURIComponent(Hd(zd.waiting,"waiting"))}`,running:`data:image/svg+xml,${encodeURIComponent(Hd(zd.running,"running"))}`,idle:`data:image/svg+xml,${encodeURIComponent(Hd(zd.idle,"idle"))}`}),kG="No sessions are waiting for you.";function NG(e){if(e.length===0)return"";const[t,...n]=e;if(n.length===0)return`${t.label} is waiting for your permission.`;const r=`${n.length} more session${n.length===1?"":"s"}`;return`${t.label} and ${r} are waiting for your permission.`}function w2(e,t,n=kG){return t!==""?t:e===""?"":n}const v2="agent-dag.browserWatch.seenMs";function _G(e,t){return e.filter(n=>n.startMs>t)}function SG(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 r=[...n].sort((a,l)=>(a.at??0)-(l.at??0));return{request:r[0],waiting:r.length-1}}function jG({request:e,waiting:t,busy:n,now:r,onAccept:a,onDecline:l,onLater:c}){const u=x.useRef(null),f=sn(c,{focusRef:u}),p=za(n,"accept"),h=za(n,"dismiss");return o.jsx("div",{className:"modal-backdrop",onClick:c,role:"presentation",children:o.jsxs("div",{ref:f,className:"modal lan-ask",onClick:m=>m.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"lan-ask-title",children:[o.jsxs("header",{className:"modal-head",children:[o.jsxs("div",{className:"modal-title",children:[o.jsx("i",{className:"ap-pulse","aria-hidden":!0}),o.jsx("span",{id:"lan-ask-title",className:"modal-tool-name",children:"A deck wants to pair"})]}),o.jsx("div",{className:"modal-actions",children:o.jsx("button",{type:"button",className:"glyph-btn",onClick:c,"aria-label":"Answer later (Esc)",title:"Answer later (Esc)",children:"×"})})]}),o.jsxs("section",{className:"modal-body",children:[o.jsxs("p",{className:"lan-ask-who",children:[o.jsx("strong",{className:"lan-ask-name",children:e.name})," at ",o.jsx("code",{className:"ap-lan-code",children:e.addr})," · asked ",rb(e.at,r)]}),o.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."}),o.jsxs("p",{className:"lan-ask-fp",children:["Its fingerprint is ",o.jsx("code",{className:"ap-lan-code",children:e.fp})," — that machine shows its own under This deck on the network; the two should match."]}),t>0&&o.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.`}),o.jsxs("div",{className:"lan-ask-acts",children:[o.jsx("button",{type:"button",ref:u,className:"btn",disabled:h.disabled,"aria-busy":h.busy,onClick:l,title:"Nothing is shared. If that deck asks again, this comes back.",children:n==="dismiss"?"declining…":"Decline"}),o.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"})]})]})]})})}const EG=600;function p0(e,t){return!(e.exitAt!=null&&t-e.exitAt>EG||e.kind==="root"&&e.state==="done"&&e.tools.length===0&&e.endedAt!=null&&e.endedAt-e.startedAt<3e3)}function CG(e,t){const n=new Set;for(const r of e.agents.values())p0(r,t)&&n.add(r.id);return n}function TG(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 AG(e,t,n=0){if(!e)return!1;for(const r of t)if(TG(e,r,n))return!0;return!1}const RI="sessionGroup";function RG(e,t){var r,a;if(e.type===RI)return"transparent";if(br((r=e.data)==null?void 0:r.waiting))return t("--warn");if(e.type==="recapNote")return t("--muted");const n=(a=e.data)==null?void 0:a.state;return t(n==="err"?"--err":n==="active"?"--inflight":"--ok")}const MI=["--err","--inflight","--ok","--grid-line","--minimap-mask","--panel","--line","--accent","--text-dim","--bg"];function x2(e){const t={};for(const n of MI)t[n]=e(n);return t}function MG(e){return t=>e[t]??""}function IG(e,t){return MI.every(n=>e[n]===t[n])}function $G(e){const t=new Set(e.pins),n=new Map,r=new Map;for(const[a,l]of e.positions)n.set(a,l),t.has(a)&&r.set(a,l);return{positions:n,pinned:r}}function b2(e){return Object.entries(e??{}).filter(([,t])=>t&&typeof t.x=="number"&&typeof t.y=="number")}function OG(e){const t={positions:[],pins:[]};if(!e)return t;let n;try{n=JSON.parse(e)}catch{return t}if(!n||typeof n!="object")return t;if(!("v"in n)){const a=b2(n);return{positions:a,pins:a.map(([l])=>l)}}const r=n;return{positions:b2(r.positions),pins:Array.isArray(r.pins)?r.pins:[]}}function LG(e,t){const n={};for(const[r,a]of e)n[r]=a;for(const[r,a]of t)n[r]=a;return JSON.stringify({v:2,positions:n,pins:Array.from(t.keys())})}function PG(e){if(!e)return null;let t;try{t=JSON.parse(e)}catch{return null}return!(typeof(t==null?void 0:t.width)=="number"&&typeof(t==null?void 0:t.height)=="number")||!(t.width>0&&t.height>0)?null:{width:t.width,height:t.height}}const II=.2,$I=1.6;function DG(e){if(!e)return null;let t;try{t=JSON.parse(e)}catch{return null}if(!t||typeof t!="object")return null;const{x:n,y:r,zoom:a}=t;return typeof n!="number"||typeof r!="number"||typeof a!="number"||!Number.isFinite(n)||!Number.isFinite(r)||!Number.isFinite(a)||a<II||a>$I?null:{x:n,y:r,zoom:a}}const FG=1200,qG=1e3;function kx(e){return e.lastDeckFitAt>0&&e.at-e.lastDeckFitAt<FG?!1:e.hasSourceEvent?!0:e.lastCanvasInputAt>0&&e.at-e.lastCanvasInputAt<qG}function Ud({durationMs:e,documentHidden:t,reducedMotion:n=BG()}){return t||n?!1:Number.isFinite(e)&&e>0}function BG(){return typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches}function zG(e,t,n){const r=e.x*t.zoom+t.x,a=e.y*t.zoom+t.y,l=(e.x+e.width)*t.zoom+t.x,c=(e.y+e.height)*t.zoom+t.y;return l>0&&r<n.width&&c>0&&a<n.height}function HG({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 r=!1;for(const a of n)if(r=!0,zG(a,t,e))return!1;return r}const Sb=11,OI=7.2,LI=6.6,UG={width:104,height:48},k2={width:96,height:44},PI={width:220,height:103};function WG(e){let t=1/0,n=1/0;for(const r of e)!(r.width>0)||!(r.height>0)||(t=Math.min(t,r.width),n=Math.min(n,r.height));return!Number.isFinite(t)||!Number.isFinite(n)?PI:{width:Math.max(160,t),height:Math.max(72,n)}}function Nx(e,t,n){return e.width*t>=n.width&&e.height*t>=n.height}function VG(e,t,n=PI){if(!Number.isFinite(t)||t<=0)return e??"detail";const r=Sb*t;return e==="detail"?r>=LI?"detail":Nx(n,t,k2)?"compact":"overview":r>=OI?"detail":e==="compact"?Nx(n,t,k2)?"compact":"overview":Nx(n,t,UG)?"compact":"overview"}const GG=OI/Sb,KG=LI/Sb;function YG(e,t){return e>=GG?e:Math.max(e,Math.min(t,KG-.001))}const XG=.8,ZG=1;function QG(e){const t=e.minZoom??XG,n=e.maxZoom??ZG,r=e.fill??.9,a=e.insets.left,l=e.insets.top,c=Math.max(1,e.pane.width-e.insets.left-e.insets.right),u=Math.max(1,e.pane.height-e.insets.top-e.insets.bottom),f=e.context,p=e.anchor,h=Math.min(c/Math.max(1,f.width),u/Math.max(1,f.height))*r,m=Math.max(t,Math.min(n,h)),y=(w,_,k,j,b,S)=>{let E=w+(_-j*m)/2-k*m;const C=b*m+E,T=(b+S)*m+E;return S*m<=_?C<w?E+=w-C:T>w+_&&(E-=T-(w+_)):E+=w-C,E};return{x:y(a,c,f.x,f.width,p.x,p.width),y:y(l,u,f.y,f.height,p.y,p.height),zoom:m}}function JG(e){let t=1/0,n=1/0,r=-1/0,a=-1/0;for(const l of e)t=Math.min(t,l.x),n=Math.min(n,l.y),r=Math.max(r,l.x+l.width),a=Math.max(a,l.y+l.height);return Number.isFinite(t)?{x:t,y:n,width:r-t,height:a-n}:null}let Fo=null,Xi=null;const m0=new Set,g0=()=>{for(const e of m0)e()},eK=e=>(m0.add(e),()=>{m0.delete(e)}),N2=()=>Fo,tK=90;function DI(e){!Xi||e!=null&&Xi.at.id!==e||(clearTimeout(Xi.timer),Xi=null)}function _2(e,t,n="pointer"){DI();const r={id:e,anchor:t,by:n};if(Fo||n==="focus"){Fo=r,g0();return}Xi={at:r,timer:setTimeout(()=>{Xi=null,Fo=r,g0()},tK)}}function Aa(e){DI(e),!(!Fo||e!=null&&Fo.id!==e)&&(Fo=null,g0())}function nK({agentFor:e,recapFor:t,labelFor:n,bounds:r}){const a=x.useSyncExternalStore(eK,N2,N2),l=a?e(a.id):void 0,c=a&&!l?t(a.id):void 0,u=a!=null&&(!l&&!c||!a.anchor.isConnected);return x.useEffect(()=>{u&&a&&Aa(a.id)},[u,a]),!a||u?null:l?o.jsx(sK,{a:l,anchor:a.anchor,parentLabel:l.parentId?n(l.parentId):void 0,bounds:r},a.id):c?o.jsx(rK,{r:c,anchor:a.anchor,bounds:r},a.id):null}function FI(e,t){const n=x.useRef(null),r=x.useCallback(()=>{const a=n.current;if(!a||!e.isConnected)return;const l=Q0(e.getBoundingClientRect(),{width:a.offsetWidth,height:a.offsetHeight},t());a.style.top=`${l.top}px`,a.style.left=`${l.left}px`,a.style.maxHeight=l.maxHeight==null?"":`${l.maxHeight}px`,a.dataset.side=l.side},[e,t]);return x.useLayoutEffect(()=>{r()}),n}function rK({r:e,anchor:t,bounds:n}){const r=FI(t,n),a=gl(3e4),l=fh(e.recap.at,a);return _n.createPortal(o.jsxs("div",{ref:r,className:"ap-peek node-peek recap-peek",role:"tooltip",id:"node-peek",style:{"--session-hue":e.hue},children:[o.jsxs("div",{className:"node-peek-head",children:[o.jsxs("span",{className:"recap-peek-mark",children:[o.jsx(Vc,{}),"recap"]}),o.jsx("span",{className:"node-peek-time",title:l.title,children:l.label})]}),e.sessionLabel&&o.jsx("div",{className:"node-peek-kind",children:o.jsxs("span",{children:["Claude Code's recap of ",e.sessionLabel]})}),o.jsx("p",{className:"recap-peek-text",children:e.recap.text}),o.jsx("p",{className:"node-peek-hint",children:"Click to go to the session · double-click for its details"})]}),document.body)}function sK({a:e,anchor:t,parentLabel:n,bounds:r}){const a=FI(t,r),l=gl(1e3),c=q0(e.sessionName,e.sessionTitle),u=e.tools.filter(_=>_.ok===!1).length,f=e.tools.filter(_=>!_.endedAt).length,p=Vn(e,l).total,h=e.usage.inputTokens+e.usage.outputTokens,m=e.kind==="root"&&br(e.waiting),y=e.kind==="root"?"session":n?`subagent of ${n}`:"subagent",w=[`${e.toolCount} ${e.toolCount===1?"tool":"tools"}`,f>0?`${f} in-flight`:null,h>0?`${Dt(h)} tok`:null,p>0?`${ct(p)}${Wc(e,l)>0?"+":""}`:null].filter(Boolean).join(" · ");return _n.createPortal(o.jsxs("div",{ref:a,className:"ap-peek node-peek",role:"tooltip",id:"node-peek",children:[o.jsxs("div",{className:"node-peek-head",children:[o.jsx("span",{className:"node-peek-name",children:e.label}),o.jsxs("span",{className:"node-peek-time",children:[e.synthetic?"≥ ":"",ol(e.startedAt,e.endedAt,l)]})]}),o.jsxs("div",{className:"node-peek-kind",children:[o.jsxs("span",{className:"node-peek-state","data-kind":Yx(e.state),children:[o.jsx(MR,{kind:Yx(e.state)}),ll(e.state)]}),o.jsx("span",{children:y}),e.model?o.jsx("span",{children:qa(e.model)}):null]}),e.kind==="root"&&c.face&&o.jsx("p",{className:"node-peek-title",children:c.face}),e.kind==="root"&&e.waiting&&o.jsxs("p",{className:`node-peek-wait${m?" warn":""}`,children:[m&&o.jsx(V0,{}),o.jsx("span",{children:G0(e.waiting)}),o.jsx("b",{children:ol(e.waiting.since,void 0,l)})]}),o.jsxs("p",{className:"node-peek-facts",children:[w,u>0&&o.jsxs("span",{className:"node-peek-failed",children:[" · ",u," failed"]})]}),e.branch&&e.branch.total>0&&o.jsx("p",{className:"node-peek-branch",children:SR(e.branch)}),o.jsx("p",{className:"node-peek-hint",children:"Click to go to the session · double-click for details"})]}),document.body)}const aK="Update checks are off (AGENTS_DECK_NO_UPDATE_CHECK=1)",_x="click for what's new";function oK(e){if(e.checkDisabled)return`${aK} · ${_x}`;if(e.checking)return`Asking npm for the newest release… · ${_x}`;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.checkFailedAgo?` · could not reach npm ${e.checkFailedAgo}`:e.checkedAgo?` · checked ${e.checkedAgo}`:"";return`${t}${n} · re-checked periodically · ${_x}, and to check npm now`}function iK(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`:e.checkFailedAgo?`${t} — npm could not be reached ${e.checkFailedAgo}, check again`:`${t} and check npm for a newer release`}function lK(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 qI(e){return e?`${e.kind}:${e.to}`:""}function cK(e,t){return e!=null&&t!==qI(e)}function uK(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 y0={kind:"assumed",claude:!0,codex:!0};function dK(e){if(!e||typeof e!="object")return y0;const t=e.providers;if(!t||typeof t!="object")return y0;const n=t;return{kind:"reported",claude:n.claude!==!1,codex:n.codex!==!1}}function hK(e){return e.claude&&e.codex?"Claude Code and Codex":e.claude?"Claude Code":e.codex?"Codex":null}const S2={claude:"Claude Code",codex:"Codex",opencode:"OpenCode",openclaw:"OpenClaw",copilot:"GitHub Copilot",pi:"pi-agent",zcode:"ZCode"};function fK(e){const t=e.toLowerCase();return Object.hasOwn(S2,t)?S2[t]:t?t[0].toUpperCase()+t.slice(1):""}function pK(e){return e.length<=1?e[0]??"":`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`}function aY(e,t=[]){const n=t.length?pK(t.map(fK)):hK(e);return n?`via ccusage · local ${n} logs`:"via ccusage · local agent logs"}function mK(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 gK(e,t){const n=t.prefs??u0,r=Jc(n.done.level),a=Jc(n["needs-input"].level),l=r===a?`${r}%`:`${r}% and ${a}%`,c=t.on?`Sound: on at ${l} — a tone when a turn finishes, another when Claude asks for you (M)`:"Sound: off — press M, or use the switch in here, for a tone when a turn finishes (M)",u=e.codex?`
|
|
285
|
+
|
|
286
|
+
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?`
|
|
287
|
+
|
|
288
|
+
Waiting for a click: this browser plays no sound until the page has been used at least once. Anything you press unlocks it.`:"";return c+u+f+`
|
|
289
|
+
|
|
290
|
+
Click to set the volume and the sound of each tone, and to hear either one.`}function _h(e){const t=Math.max(0,Math.floor(e));return`${t} event${t===1?"":"s"}`}const j2=99;function yK(e){const t=Math.max(0,Math.floor(e));return t>j2?`${j2}+`:String(t)}const wK="Pause the canvas";function vK(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 — ${_h(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)":`${_h(e.held)} arrived while paused and will be applied in order when you resume (Space)`}function xK(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 BI="paused · full",bK=(e,t)=>t>0?BI:e>0?`paused · ${yK(e)}`:"paused";function kK(e){const t=Math.max(0,Math.floor(e.dropped??0));return e.connected?e.paused?{tone:"paused",resting:!1,label:bK(e.held,t),widest:BI,title:t>0?`Connected — the pause is full at ${_h(e.held)}; the oldest are being dropped as new ones arrive. Resume to catch up (Space)`:e.held>0?`Connected — ${_h(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"}}const NK=x.lazy(()=>O2(()=>import("./UsageHistoryModal-BRY_LA4K.js"),[])),_K=x.lazy(()=>O2(()=>import("./BrowserWatchModal-CMCvd-Zt.js"),[]));function E2(e){return typeof window>"u"?"":getComputedStyle(document.documentElement).getPropertyValue(e).trim()||""}const SK={agent:oF,sessionGroup:DF,recapNote:qF},jK={recapTie:BF},zI="react-flow__node";function Sx(e){var t,n;return!!e&&((n=(t=e.classList)==null?void 0:t.contains)==null?void 0:n.call(t,zI))===!0}const jx=80,Ex=.86;function C2(e){if(!e)return 0;const t=e.getBoundingClientRect();let n=t.right;for(const r of document.querySelectorAll(".sysdetail:not(.leaving), .usage-panel:not(.leaving)")){const a=r.getBoundingClientRect();a.width>0&&a.left>t.left&&(n=Math.min(n,a.left))}return Math.max(0,t.right-n)}function EK(e){try{const t=document.querySelector(`.${zI}[data-id="${CSS.escape(e)}"]`);t==null||t.focus({preventScroll:!0})}catch{}}const CK=["a[href]","button:not(:disabled)","input:not(:disabled)","select:not(:disabled)","textarea:not(:disabled)","summary","[tabindex]"].join(","),TK=420,Wd=18,T2=400,Cx=450,jb="agent-dag.layout",Eb="agent-dag.layoutFrame",Cb="agent-dag.viewport",HI="agent-dag.sessionListOpen",UI="agent-dag.detailOpen",WI="agent-dag.usagePanelOpen",VI="agent-dag.systemPanelOpen",A2="agent-dag.accountsPanelOpen",Tx="agent-dag.versionNoticeDismissed",R2="agent-dag.oldNameNoticeDismissed",AK=15*6e4,Ax={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:",retired_name:"this install came from a name that is no longer published — run:"},Vd="agent-dag.autoRestart",M2="agent-dag.bundleReloadedFor";function RK(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(HI)==="1"}catch{return!1}}function MK(e){if(!(typeof window>"u"))try{window.localStorage.setItem(HI,e?"1":"0")}catch{}}function IK(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(UI)==="1"}catch{return!1}}function $K(e){if(!(typeof window>"u"))try{window.localStorage.setItem(UI,e?"1":"0")}catch{}}function OK(){const e=ms(WI);return e===null?!0:e==="1"}function LK(e){if(!(typeof window>"u"))try{window.localStorage.setItem(WI,e?"1":"0")}catch{}}function PK(){const e=ms(VI);return e===null?!0:e==="1"}function DK(e){if(!(typeof window>"u"))try{window.localStorage.setItem(VI,e?"1":"0")}catch{}}function FK(){if(typeof window>"u")return{positions:[],pins:[]};try{return OG(window.localStorage.getItem(jb))}catch{return{positions:[],pins:[]}}}function Gd(e,t){if(!(typeof window>"u"))try{window.localStorage.setItem(jb,LG(e,t))}catch{}}function qK(){if(typeof window>"u")return null;try{return PG(window.localStorage.getItem(Eb))}catch{return null}}function BK(e){if(!(typeof window>"u"))try{window.localStorage.setItem(Eb,JSON.stringify(e))}catch{}}function zK(){if(typeof window>"u")return null;try{return DG(window.localStorage.getItem(Cb))}catch{return null}}function HK(e){if(!(typeof window>"u"))try{window.localStorage.setItem(Cb,JSON.stringify(e))}catch{}}function I2(){if(!(typeof window>"u")){try{window.localStorage.removeItem(jb)}catch{}try{window.localStorage.removeItem(Cb)}catch{}try{window.localStorage.removeItem(Eb)}catch{}}}function UK(e,t){const n=B7(e,t,new Date().toISOString());if(!n)return;const r=JSON.stringify(n,null,2),a=new Blob([r],{type:"application/json"}),l=URL.createObjectURL(a),c=document.createElement("a");c.href=l,c.download=z7(n.label,t),document.body.appendChild(c),c.click(),document.body.removeChild(c),setTimeout(()=>URL.revokeObjectURL(l),1e3)}const GI={file:"📁",shell:"⚡",web:"🌐",agent:"🤖",task:"📋",plan:"🧭",mcp:"🔌",other:"✨"},WK={file:"M3.4 1.8h4.5l2.7 2.7v7.7H3.4z M7.9 1.8v2.7h2.7",shell:"M2.4 3.8 5.6 7l-3.2 3.2 M7.4 10.6h4.2",web:"M7 1.8a5.2 5.2 0 1 0 0 10.4A5.2 5.2 0 1 0 7 1.8z M1.8 7h10.4 M7 1.8c-1.5 1.4-2.3 3.1-2.3 5.2s.8 3.8 2.3 5.2c1.5-1.4 2.3-3.1 2.3-5.2S8.5 3.2 7 1.8z",agent:"M3.3 4.8h7.4a1.2 1.2 0 0 1 1.2 1.2v4.8a1.2 1.2 0 0 1-1.2 1.2H3.3a1.2 1.2 0 0 1-1.2-1.2V6a1.2 1.2 0 0 1 1.2-1.2z M7 4.8V2.4 M5.3 8.2h.01 M8.7 8.2h.01",task:"M2.2 4l1.2 1.2 2-2.2 M7.4 4.2h4.4 M2.2 9.4l1.2 1.2 2-2.2 M7.4 9.6h4.4",plan:"M7 1.8a5.2 5.2 0 1 0 0 10.4A5.2 5.2 0 1 0 7 1.8z M9 5 8 8 5 9l1-3z",mcp:"M5 1.8v2.6 M9 1.8v2.6 M3.6 4.4h6.8v2.2a3.4 3.4 0 0 1-6.8 0z M7 10v2.2",other:"M3.5 7h.01 M7 7h.01 M10.5 7h.01"};function VK({cat:e}){return o.jsx("svg",{className:"cat-glyph",width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:o.jsx("path",{d:WK[e]})})}const Sh={file:"file",shell:"shell",web:"web",agent:"agent",task:"task",plan:"plan",mcp:"mcp",other:"other"},KI=ER;function GK(){return o.jsx(L0,{children:o.jsx(XK,{})})}const KK=e=>e.transform[2]>=e.maxZoom,YK=e=>e.transform[2]<=e.minZoom;function XK(){var ec,Is,tr,pa;const e=Ih(),t=xt(KK),n=xt(YK),r=Vt(),a=x.useState(Gx)[0],l=x.useRef(a),[c,u]=x.useState(()=>rG(typeof window>"u"?null:window.localStorage)),[,f]=x.useState(0),p=x.useCallback(()=>f(D=>D+1),[]),[h,m]=x.useState(IK);x.useEffect(()=>{$K(h)},[h]);const[y,w]=x.useState(()=>new Set),[_,k]=x.useState(null),[j,b]=x.useState(null),S=x.useCallback((D,P,se=!P)=>{w(le=>{if(!P)return new Set([D]);const we=new Set(le);return we.has(D)?we.delete(D):we.add(D),we}),k(le=>P&&le===D?le:D),!P&&se&&m(!0)},[]),E=x.useCallback(()=>{w(new Set),k(null)},[]),[C,T]=x.useState(null),[R,A]=x.useState(null),q=x.useCallback(D=>A(D),[]),[F,O]=x.useState(!1),[H,K]=x.useState(!1),[X,I]=x.useState(!1),Z=x.useRef(null),[W,$]=x.useState(RK);x.useEffect(()=>{MK(W)},[W]);const[z,U]=x.useState(OK);x.useEffect(()=>{LK(z)},[z]);const[V,B]=x.useState(PK);x.useEffect(()=>{DK(V)},[V]);const Y=x.useRef(!1),[ue,G]=x.useState(()=>{const D=(()=>{try{const P=window.localStorage.getItem(A2);return P===null?!0:P==="1"}catch{return!0}})();return D&&W?(Y.current=!0,!1):D});x.useEffect(()=>{if(!(!ue&&Y.current))try{window.localStorage.setItem(A2,ue?"1":"0")}catch{}},[ue]),x.useEffect(()=>{!W&&Y.current&&(Y.current=!1,G(!0))},[W]);const ee=Up(ue,200),L=Up(z,130),te=Up(V,130),[ne,ie]=x.useState(null);x.useEffect(()=>{let D=null;try{D=localStorage.getItem("agent-dag.sound")}catch{}ie(D===null?!0:D==="on")},[]);const me=x.useCallback(()=>{ie(D=>{var se;const P=D!==!0;try{localStorage.setItem("agent-dag.sound",P?"on":"off")}catch{}return P&&((se=qe.current)==null||se.unlock()),P})},[]),je=x.useCallback(D=>{me()},[me]),Oe=x.useRef(je);Oe.current=je;const Ve=x.useRef(ne);Ve.current=ne;const[Le,Te]=x.useState(()=>l9(ms)),nt=x.useRef(Le);nt.current=Le;const _e=x.useRef(null),Se=x.useCallback((D,P=!1)=>{var se,le;if((se=qe.current)==null||se.unlock(),_e.current!==null&&clearTimeout(_e.current),_e.current=null,!P){(le=qe.current)==null||le.play(D,!0);return}_e.current=setTimeout(()=>{var we;_e.current=null,(we=qe.current)==null||we.play(D,!0)},r9)},[]),Xe=x.useCallback((D,P)=>{Te(se=>{const le={level:Jc(P.level??se[D].level),figure:hI(D,P.figure??se[D].figure)};try{localStorage.setItem(pI[D],String(le.level)),localStorage.setItem(mI[D],le.figure)}catch{}return{...se,[D]:le}}),Se(D,!0)},[Se]);x.useEffect(()=>()=>{_e.current!==null&&clearTimeout(_e.current)},[]);const[ot,$e]=x.useState(!1),oe=x.useRef(null),[ye,Ce]=x.useState(!1),De=x.useRef(null);x.useEffect(()=>{ot&&Ce(!1)},[ot]);const qe=x.useRef(null),[rt,et]=x.useState("locked");x.useEffect(()=>{const D=u9({enabled:()=>Ve.current===!0,prefs:()=>nt.current,onState:et});qe.current=D,et(D.state());const P=()=>D.unlock();return window.addEventListener("pointerdown",P,{once:!0,capture:!0}),window.addEventListener("keydown",P,{once:!0,capture:!0}),()=>{window.removeEventListener("pointerdown",P,{capture:!0}),window.removeEventListener("keydown",P,{capture:!0})}},[]);const[ve,Re]=x.useState(!1),[Ue,pt]=x.useState(!1),[he,mt]=x.useState(null),[qt,Tt]=x.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(Tx)??""}catch{return""}}),[jt,dn]=x.useState(!1),Sn=x.useRef(0),[Kt,an]=x.useState(!1),ge=x.useCallback((D=!1)=>(D&&(Sn.current=Date.now(),an(!0)),fetch(D?"/api/version?refresh=1":"/api/version").then(P=>P.ok?P.json():null).then(P=>{P&&mt(P)}).catch(()=>{}).finally(()=>{D&&an(!1)})),[]),ht=x.useCallback(()=>{ge(Date.now()-Sn.current>=AK)},[ge]);x.useEffect(()=>{ge();const D=window.setInterval(ht,5*6e4),P=()=>{document.visibilityState==="visible"&&ht()};return document.addEventListener("visibilitychange",P),()=>{window.clearInterval(D),document.removeEventListener("visibilitychange",P)}},[ge,ht]),x.useEffect(()=>{ve&&ge()},[ve,ge]),x.useEffect(()=>{const D=IV();let P=null;const se=Me=>{fetch("/api/presence",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({tab:D,looking:Me}),keepalive:!0}).catch(()=>{})},le=()=>{const Me=RV(document);MV(P,Me)&&se(Me),P=Me},we=()=>{P&&se(!1),P=!1};le();const Ne=window.setInterval(le,AV);return window.addEventListener("focus",le),window.addEventListener("blur",le),document.addEventListener("visibilitychange",le),window.addEventListener("pagehide",we),()=>{window.clearInterval(Ne),window.removeEventListener("focus",le),window.removeEventListener("blur",le),document.removeEventListener("visibilitychange",le),window.removeEventListener("pagehide",we),we()}},[]);const tt=(he==null?void 0:he.notice)??null,[_t,on]=x.useState(null),Gn=x.useRef(!1);x.useEffect(()=>{if(Gn.current)return;const D=y2(),P=zV(D),se=KV({stored:P,running:(he==null?void 0:he.running)??null,notes:g2,remembers:HV(D)});if(se.reason==="no-version")return;Gn.current=!0,se.record&&UV(D,se.record);let le=!0;return(async()=>{var ft;let Ne=WV(D);if(d0())try{const Ye=await fetch("/api/prefs");if(!Ye.ok)throw new Error("desktop tour preferences unavailable");const Nt=await Ye.json();if(!(Nt!=null&&Nt.ok))throw new Error("desktop tour preferences unavailable");const at=((ft=Nt.prefs)==null?void 0:ft.tourSeen)===!0;Ne&&!at&&fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({tourSeen:!0}),keepalive:!0}).catch(()=>{}),Ne=Ne||at}catch{Ne=!0}if(!le)return;const Me=GV({tourSeen:Ne,decision:se}),Ze=se.show.length?{entries:se.show,since:P,firstRun:!1}:null;Me.tour&&I(!0),Me.notes==="now"?on(Ze):Me.notes==="after"&&(Z.current=Ze)})(),()=>{le=!1}},[he==null?void 0:he.running]);const Et=(he==null?void 0:he.running)??"3.28.0",lr=x.useMemo(()=>jI(g2,null,Et),[Et]),gn=x.useCallback(()=>{on({entries:lr,since:null,firstRun:!1})},[lr]),[Yt,jn]=x.useState(null),[Bt,Rn]=x.useState(y0);x.useEffect(()=>{let D=!1;return fetch("/api/health").then(P=>P.ok?P.json():null).then(P=>{D||(Rn(dK(P)),!(!P||typeof P.workspace!="string")&&jn(P.workspace))}).catch(()=>{}),()=>{D=!0}},[ve]);const Kn=x.useRef(Bt);Kn.current=Bt;const cr=qI(tt),Mn=cK(tt,qt),Ys=x.useCallback(()=>{Tt("");try{window.localStorage.setItem(Tx,"")}catch{}},[]),Xs=x.useCallback(()=>{if(tt){Tt(cr);try{window.localStorage.setItem(Tx,cr)}catch{}}},[tt,cr]),[ys,In]=x.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(R2)??""}catch{return""}}),yn=he!=null&&he.invokedAs&&he.invokedAs!==tn?he.invokedAs:null,J=yn!=null&&ys!==yn,Ae=x.useCallback(()=>{if(yn){In(yn);try{window.localStorage.setItem(R2,yn)}catch{}}},[yn]),Fe=((ec=he==null?void 0:he.upgrade)==null?void 0:ec.state)??"idle",Ie=Wz(he==null?void 0:he.upgrade),Ge=x.useRef(!1),yt=x.useCallback(async()=>{if(Hs(Ge.current||Fe==="running")){Ge.current=!0;try{await fetch("/api/upgrade",{method:"POST"})}catch{}await ge(),Ge.current=!1}},[Fe,ge]);x.useEffect(()=>{if(Fe!=="running")return;const D=window.setInterval(ge,3e3);return()=>window.clearInterval(D)},[Fe,ge]);const kt=x.useCallback(async()=>{const D=he==null?void 0:he.command;!D||!await Ba(D)||(dn(!0),window.setTimeout(()=>dn(!1),1600))},[he==null?void 0:he.command]),At=x.useCallback(()=>{$(D=>(D||G(P=>(P&&(Y.current=!0),!1)),!D))},[]),bt=x.useCallback(()=>{Y.current=!1,G(D=>(D||$(!1),!D))},[]),[St,jr]=x.useState(!1),[ws,Xr]=x.useState(!1),[Ua,Xo]=x.useState(()=>{try{return Number(localStorage.getItem(v2))||0}catch{return 0}}),[vs,$n]=x.useState([]),[xs,On]=x.useState(!1);x.useEffect(()=>{let D=!0;const P=()=>{fetch("/api/browser-watch?live=0").then(le=>le.ok?le.json():null).then(le=>{var we;!D||!(le!=null&&le.ok)||($n(le.episodes??[]),On(((we=le.settings)==null?void 0:we.enabled)===!0))}).catch(()=>{})};P();const se=setInterval(P,5*6e4);return()=>{D=!1,clearInterval(se)}},[]);const[cf,Zo]=x.useState([]),du=x.useRef(new Set),[bs,Wa]=x.useState(null);x.useEffect(()=>{let D=!0,P=0;const se=()=>{fetch("/api/lan").then(le=>le.ok?le.json():null).then(le=>D?(le!=null&&le.ok&&Zo(N_(Array.isArray(le.pending)?le.pending:[],le.aliases)),le):null).catch(()=>null).then(le=>{D&&(P=window.setTimeout(se,(le==null?void 0:le.enabled)===!0?o0:sM))})};return se(),()=>{D=!1,window.clearTimeout(P)}},[]);const Zs=x.useCallback(async(D,P)=>{if(!bs){Wa(D);try{const le=await(await fetch("/api/lan/peer",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:D,fp:P})})).json().catch(()=>null);le&&Array.isArray(le.pending)?Zo(N_(le.pending,le.aliases)):Zo(we=>we.filter(Ne=>Ne.fp!==P))}catch{}finally{Wa(null)}}},[bs]),Yn=x.useMemo(()=>_G(vs,Ua).length,[vs,Ua]),[uf,hu]=x.useState(0),Qo=x.useRef(null),[fu,Jo]=x.useState(!1),Er=x.useRef(null),[df,ei]=x.useState(0),lt=x.useState(()=>hG({protect:D=>uD(l.current,D)}))[0],[Va,pu]=x.useState(!1),Ga=x.useCallback(()=>{const D=lt.paused&<.dropped>0,P=lt.setPaused(!lt.paused);D&&dD(l.current);for(const se of P)l.current=mN(l.current,se);pu(lt.paused)},[lt]),[Ut,mu]=x.useState(Date.now()),[Cr,Qs]=x.useState(()=>{if(typeof window>"u")return!0;try{return window.localStorage.getItem(Vd)!=="0"}catch{return!0}}),Ka=x.useRef(!1),Zr=x.useCallback(()=>{const D=!Cr;Ka.current=!0;try{window.localStorage.removeItem(Vd)}catch{}Qs(D),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({autoUpdate:D})}).then(P=>P.ok?P.json():null).then(P=>{var se;P!=null&&P.ok&&Qs(((se=P.prefs)==null?void 0:se.autoUpdate)!==!1)}).catch(()=>{})},[Cr]),[hn,Xn]=x.useState(!1),[Ya,Xa]=x.useState("restart"),[Tr,gu]=x.useState(null),ks=x.useRef(!1),Js=x.useRef(null),yu=x.useRef(0),ea=x.useCallback(async D=>{if(!Hs(ks.current))return;const P=(D==null?void 0:D.upgrade)===!0;ks.current=!0,Js.current=Ie;const se=++yu.current;Xa(P?"npx":"restart"),Xn(!0);try{window.sessionStorage.setItem("agent-dag.restartPending",(tt==null?void 0:tt.to)??"")}catch{}try{await fetch("/api/restart",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({upgrade:P})})}catch{}window.setTimeout(()=>{if(yu.current===se&&ks.current){ks.current=!1,Xn(!1);try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}}},P?18e4:3e4)},[tt==null?void 0:tt.to,Ie]),ta=x.useRef(null);x.useEffect(()=>{const D=T_(l.current.agents.values())>0,P=Xz({enabled:Cr,kind:tt==null?void 0:tt.kind,canRestart:(he==null?void 0:he.canRestart)===!0,noticeOpen:Mn,visible:document.visibilityState==="visible",busy:D,idleSince:ta.current,now:Ut});ta.current=P.idleSince,P.restart&&ea()},[Cr,tt==null?void 0:tt.kind,he==null?void 0:he.canRestart,Mn,Ut,ea]);const kl=T_(l.current.agents.values()),wu=Yz(kl),na=lM({enabled:Cr,kind:tt==null?void 0:tt.kind,canRestart:(he==null?void 0:he.canRestart)===!0,noticeOpen:Mn,visible:document.visibilityState==="visible",busy:kl>0,idleSince:ta.current,now:Ut});x.useEffect(()=>{const D=he==null?void 0:he.running;let P=null,se=null;try{P=window.sessionStorage.getItem("agent-dag.restartPending"),se=window.sessionStorage.getItem(M2)}catch{return}const le=Uz({bundle:"3.28.0",running:D,pending:P,lastTried:se});if(le==="reload"){try{window.sessionStorage.setItem(M2,D??"")}catch{return}window.location.reload();return}if(le!=="confirm")return;try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}ks.current=!1,Xn(!1),gu(D??null);const we=window.setTimeout(()=>gu(null),6e3);return()=>window.clearTimeout(we)},[he==null?void 0:he.running]),x.useEffect(()=>{if(hn&&Vz({asked:Js.current,reported:Ie})){try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}ks.current=!1,Xn(!1)}},[hn,Ie]);const ra=x.useState(()=>$G(FK()))[0],Ct=x.useRef(ra.pinned),Ns=x.useRef(null),ti=x.useState(()=>zK())[0],[Nl,_l]=x.useState(()=>new Set),[Ar,ni]=x.useState(mG),[sa,Qr]=x.useState(k9),[aa,ri]=x.useState(_9),[Za,si]=x.useState(x9),[Zn,vu]=x.useState(()=>x2(E2)),wn=x.useMemo(()=>MG(Zn),[Zn]),oa=x.useCallback(D=>RG(D,wn),[wn]),[ai,Qa]=x.useState(!1);x.useEffect(()=>{document.documentElement.dataset.theme=Ar;try{window.localStorage.setItem(AI,Ar)}catch{}vu(D=>{const P=x2(E2);return IG(D,P)?D:P})},[Ar]),x.useEffect(()=>{try{window.localStorage.setItem(gI,sa?"1":"0")}catch{}},[sa]),x.useEffect(()=>{try{window.localStorage.setItem(yI,String(aa))}catch{}},[aa]),x.useEffect(()=>{try{window.localStorage.setItem(wI,Za)}catch{}},[Za]),x.useEffect(()=>{const D=document.querySelector('meta[name="theme-color"]'),P=Zn["--panel"];D&&P&&D.setAttribute("content",P)},[Zn]);const Qn=x.useCallback((D,P)=>{if(Ud({durationMs:P,documentHidden:document.hidden})){e.setViewport(D,{duration:P});return}const{d3Zoom:se,d3Selection:le}=r.getState(),we=le==null?void 0:le.property("__zoom");if(se&&le&&we&&we.k>0&&D.zoom>0){se.transform(le,we.scale(D.zoom/we.k).translate((D.x-we.x)/D.zoom,(D.y-we.y)/D.zoom));return}e.setViewport(D,{duration:0})},[e,r]),Jr=x.useRef(null),_s=x.useRef(0),es=x.useRef(null),Ja=x.useRef(()=>{});x.useEffect(()=>{if(!ti)return;const D=window.setTimeout(()=>{try{Qn(ti,0)}catch{}Rr.current=Date.now()},60);return()=>window.clearTimeout(D)},[Qn,ti]);const Sl=x.useRef(!0),[eo,xu]=x.useState(null);x.useEffect(()=>{const D=new EventSource("/events"),P=uG(p,{now:()=>Date.now(),setTimeout:(Ne,Me)=>window.setTimeout(Ne,Me),clearTimeout:Ne=>window.clearTimeout(Ne)});let se=!1;const le=typeof BroadcastChannel=="function"?vG(new BroadcastChannel(yG),Math.random().toString(36).slice(2),()=>se):null,we=window.setInterval(()=>{se||!le||le.ask(600).then(Ne=>{se||pt(wG(Ne))})},3e3);return D.addEventListener("open",()=>{Re(!0),Qa(!0)}),D.addEventListener("error",()=>{Re(!1),xu(null)}),D.addEventListener("open",()=>{se=!0,pt(!1)}),D.addEventListener("error",()=>{se=!1}),D.addEventListener("replay-end",()=>{Sl.current=!1,P.flush(),xu(Date.now())}),D.addEventListener("hook",Ne=>{var Me;try{const Ze=JSON.parse(Ne.data);if(!lt.accept(Ze))return;l.current=mN(l.current,Ze);const ft=Ze.replay===!0||Sl.current||Date.now()-Ze.receivedAt>3e4;ft?P.replay():P.live();const Ye=c9(Ze,ft);Ye&&((Me=qe.current)==null||Me.play(Ye))}catch{}}),()=>{D.close(),P.cancel(),window.clearInterval(we),le==null||le.leave()}},[p]),x.useEffect(()=>{const D=setInterval(()=>{const P=Date.now();mu(P);const{changed:se,forgotten:le}=$7(l.current,P);le.length>0&&fetch("/api/forget",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({ids:le})}).catch(()=>{}),w(we=>R7(we,l.current.agents)),k(we=>we!=null&&!l.current.agents.has(we)?null:we),A(we=>we!=null&&!l.current.agents.has(we)?null:we),T(we=>we!=null&&!l.current.agents.has(we)?null:we),se&&p()},250);return()=>clearInterval(D)},[p]);const jl=x.useRef(null),Rr=x.useRef(0),bu=420,Ln=x.useCallback((D=500)=>{const P=jx,se=1,le=.2,we=Ex;try{const Ne=document.querySelector(".canvas-wrap"),Me=Array.from(document.querySelectorAll(".react-flow__node")).filter($t=>$t.offsetWidth>0);if(!Ne||Me.length===0)return;const Ze=Ne.getBoundingClientRect(),ft=e.getViewport();if(!Number.isFinite(ft.zoom)||ft.zoom<=0)return;const Ye=$t=>($t-Ze.left-ft.x)/ft.zoom,Nt=$t=>($t-Ze.top-ft.y)/ft.zoom,at=Me.map($t=>$t.getBoundingClientRect()),gt=Math.min(...at.map($t=>Ye($t.left))),Dn=Math.max(...at.map($t=>Ye($t.right))),zt=Math.min(...at.map($t=>Nt($t.top))),vn=Math.max(...at.map($t=>Nt($t.bottom))),as=Dn-gt,os=vn-zt;if(!(as>0&&os>0))return;const xn=C2(Ne),wo=$t=>Math.max(le,Math.min(se,(Ze.width-xn-P*2)/(as+$t)*we,(Ze.height-P*2)/os*we)),ma=YG(wo(bu),wo(0)),ga={x:P-gt*ma,y:Math.max(P,(Ze.height-os*ma)/2)-zt*ma,zoom:ma},bi=++_s.current;Qn(ga,D),Rr.current=Date.now(),Jr.current=Ud({durationMs:D,documentHidden:document.hidden})?{target:ga,until:Date.now()+D+60}:null,window.setTimeout(()=>{var $t;try{if((($t=Jr.current)==null?void 0:$t.target)===ga&&(Jr.current=null),_s.current!==bi)return;const ur=e.getViewport();(Math.abs(ur.zoom-ma)>.01||Math.abs(ur.x-ga.x)>2)&&Qn(ga,0)}catch{}},D+60)}catch{}},[e,Qn]);x.useEffect(()=>{const D=()=>{if(!document.hidden)return;const P=Jr.current;if(Jr.current=null,!(!P||Date.now()>P.until)){try{Qn(P.target,0)}catch{}Rr.current=Date.now()}};return document.addEventListener("visibilitychange",D),()=>document.removeEventListener("visibilitychange",D)},[Qn]);const El=x.useRef(""),Cl=x.useRef(null),ku=x.useRef(0),to=x.useCallback(()=>{ku.current=Date.now()},[]),Tl=x.useRef(null),Nu=x.useRef(0),Al=x.useCallback(()=>{Nu.current=Date.now()},[]),Rl=x.useCallback(D=>({hasSourceEvent:!!D,at:Date.now(),lastDeckFitAt:Rr.current,lastCanvasInputAt:Nu.current}),[]),Ml="agent-dag.autoFitDisabled",Ss=x.useRef(!1),[Il,_u]=x.useState(!1);x.useEffect(()=>{try{window.localStorage.removeItem(Ml)}catch{}},[]);const ia=x.useCallback(()=>{Ss.current||(Ss.current=!0,_u(!0))},[]),Su=x.useCallback(()=>{Ss.current=!1,_u(!1),Ln(400)},[e,Ln]);x.useEffect(()=>{const D=setInterval(()=>{if(Ss.current||Date.now()-ku.current<800)return;const P=l.current,se=Date.now(),le=[];for(const Ne of P.agents.values())p0(Ne,se)&&le.push({id:Ne.id});if(le.length===0)return;const we=[];for(const{id:Ne}of le){const Me=Mr.current.get(Ne),Ze=Ct.current.get(Ne)??Rt.current.get(Ne);!Me||!Ze||we.push({x:Ze.x,y:Ze.y,width:Me.width,height:Me.height})}HG({pane:Tl.current,viewport:e.getViewport(),boxes:we})&&Ln(600)},1500);return()=>clearInterval(D)},[e]);const oi=x.useRef(!1),Mr=x.useRef(new Map),$l=x.useRef(0),hf=x.useCallback(D=>{const P=Mr.current;let se=!1;for(const le of D.nodeInternals.values()){const we=le.width,Ne=le.height;if(we==null||Ne==null)continue;const Me=P.get(le.id);Me?(Math.abs(Me.height-Ne)>4||Math.abs(Me.width-we)>4)&&(P.set(le.id,{width:we,height:Ne}),se=!0):(P.set(le.id,{width:we,height:Ne}),se=!0)}return se&&($l.current+=1),$l.current},[]),ju=xt(hf),[Eu,Ol]=x.useState(0);x.useEffect(()=>{let D=0;const P=()=>{const le=Mr.current;let we=!1;for(const Ne of document.querySelectorAll(".react-flow__node[data-id]")){const Me=Ne.getAttribute("data-id");if(!Me)continue;const Ze=Ne.offsetWidth,ft=Ne.offsetHeight;if(!Ze||!ft)continue;const Ye=le.get(Me);(!Ye||Math.abs(Ye.width-Ze)>4||Math.abs(Ye.height-ft)>4)&&(le.set(Me,{width:Ze,height:ft}),we=!0)}we&&Ol(Ne=>Ne+1)};if(oi.current)return;let se=0;return document.visibilityState==="hidden"?se=window.setTimeout(P,32):D=requestAnimationFrame(P),()=>{cancelAnimationFrame(D),window.clearTimeout(se)}});const Rt=x.useRef(ra.positions),Cu=x.useRef(new Set),no=x.useRef(""),js=x.useMemo(()=>{const D=[];for(const P of l.current.agents.values())p0(P,Ut)&&D.push(P.id+(P.parentId?`>${P.parentId}`:""));return D.sort(),`${D.join("|")}#sv${ju}.${Eu}`},[l.current,l.current.revision,Ut,ju,Eu]),la=x.useRef(null);x.useEffect(()=>(la.current!=null&&window.clearTimeout(la.current),la.current=window.setTimeout(()=>{Gd(Rt.current,Ct.current)},1500),()=>{la.current!=null&&window.clearTimeout(la.current)}),[js]),x.useEffect(()=>{if(El.current===js)return;const D=El.current;if(El.current=js,!D||Ss.current)return;Date.now()-Rr.current>1200&&Ln(400),jl.current&&window.clearTimeout(jl.current),jl.current=window.setTimeout(()=>{Ss.current||Ln(500)},280)},[js,e,Ln]);const ii=x.useMemo(()=>iG(l.current,y),[l.current,l.current.revision,y]),li=x.useMemo(()=>CG(l.current,Ut),[l.current,l.current.revision,Ut]),Pn=x.useRef(null),[ro,Tu]=x.useState({w:0,h:0});x.useEffect(()=>{const D=Pn.current;if(!D||typeof ResizeObserver>"u")return;const P=new ResizeObserver(se=>{var we;const le=(we=se[0])==null?void 0:we.contentRect;le&&(Tl.current={width:le.width,height:le.height},Tu(Ne=>Math.abs(Ne.w-le.width)>40||Math.abs(Ne.h-le.height)>40?{w:le.width,h:le.height}:Ne))});return P.observe(D),Tl.current={width:D.clientWidth,height:D.clientHeight},Tu({w:D.clientWidth,h:D.clientHeight}),()=>P.disconnect()},[]);const ff=x.useCallback(D=>{var se,le;const P=D.target;!(P!=null&&P.closest)||P.closest(CK)!==D.currentTarget||(D.preventDefault(),(le=(se=document.activeElement)==null?void 0:se.blur)==null||le.call(se))},[]),Au=x.useRef(new Map),[so,ao]=x.useState(!1);x.useEffect(()=>{const D=window.setTimeout(()=>ao(!0),2500);return()=>window.clearTimeout(D)},[]);const[oo,Ll]=x.useState(!1),Jn=x.useRef(null),[io,Pl]=x.useState(!1),[Dl,Fl]=x.useState("detail"),ts=x.useRef(null),ci=x.useRef(null),Ru=x.useCallback(()=>{var le;const D=$l.current;if(((le=ci.current)==null?void 0:le.version)===D)return ci.current.card;const P=[];for(const we of l.current.agents.keys()){const Ne=Mr.current.get(we);Ne&&P.push(Ne)}const se=WG(P);return ci.current={version:D,card:se},se},[]),pf=x.useCallback(()=>{Jn.current&&(window.clearTimeout(Jn.current),Jn.current=null),Ll(!1)},[]),mf=x.useCallback(D=>{D.length!==0&&queueMicrotask(()=>{Ll(!0),Jn.current&&window.clearTimeout(Jn.current),Jn.current=window.setTimeout(()=>Ll(!1),TK+80)})},[]);x.useEffect(()=>()=>{Jn.current&&window.clearTimeout(Jn.current)},[]);const Xt=_?l.current.agents.get(_):null,Mu=h&&Xt!=null,[ql,er]=x.useState(0);x.useEffect(()=>{const D=C2(Pn.current);er(P=>Math.abs(P-D)>40?D:P)},[te,L,z,Mu,ro.w]);const Es=x.useRef(ql);Es.current=ql;const lo=ro.w>0?Math.max(0,(ro.w-ql-jx*2)*Ex):0,co=ro.h>0?Math.max(0,(ro.h-jx*2)*Ex):0,Iu=b6(),{nodes:Ir,edges:ui}=x.useMemo(()=>{const D=D7(l.current,Ut,lo,co,Ct.current,Mr.current,Au.current,mf,so,io,Rt.current,Cu.current,js,no,y,ii,li,q);return aG(D.nodes,D.edges,c)},[l.current,l.current.revision,Ut,lo,co,so,io,js,y,ii,li,q,uf,Iu,c]),gf=x.useState(qK)[0],$u=x.useRef(gf);x.useEffect(()=>{if(!so||io)return;const D={width:lo,height:co};if(!(D.width>0&&D.height>0))return;const P=$u.current;if($u.current=D,BK(D),!P||P.width===D.width&&P.height===D.height)return;const se={direction:"LR",pinned:Ct.current,measured:Mr.current,lanes:l0(l.current)};if(!v7(Ir,ui,se,P,D))return;const le=es.current&&Date.now()-es.current.at<1500?es.current.id:null,we=le??da.current,Ne=we?Ct.current.get(we)??Rt.current.get(we):void 0;for(const Me of Array.from(Rt.current.keys()))Ct.current.has(Me)||Rt.current.delete(Me);Cu.current.clear(),no.current="",p(),window.setTimeout(()=>{if(Gd(Rt.current,Ct.current),Ss.current){if(le){Ja.current(le);return}const Me=we?Ct.current.get(we)??Rt.current.get(we):void 0;if(Ne&&Me&&(Me.x!==Ne.x||Me.y!==Ne.y)){const Ze=e.getViewport();_s.current+=1,Qn({x:Ze.x-(Me.x-Ne.x)*Ze.zoom,y:Ze.y-(Me.y-Ne.y)*Ze.zoom,zoom:Ze.zoom},0),Rr.current=Date.now()}return}Ln(500)},80)},[lo,co,so,io,p,Ln,e,Qn]);const Cs=x.useMemo(()=>{const D=new Map;for(const se of Ir){const le=se.data;if(!(le!=null&&le.sessionId)||le.exitAt!=null)continue;const we=se.width,Ne=se.height;if(we==null||Ne==null)continue;const Me=se.position.x,Ze=se.position.y,ft=Me+we,Ye=Ze+Ne,Nt=D.get(le.sessionId);Nt?(Nt.minX=Math.min(Nt.minX,Me),Nt.minY=Math.min(Nt.minY,Ze),Nt.maxX=Math.max(Nt.maxX,ft),Nt.maxY=Math.max(Nt.maxY,Ye)):D.set(le.sessionId,{minX:Me,minY:Ze,maxX:ft,maxY:Ye})}const P=[];for(const[se,le]of D){const we=le.maxX-le.minX+Wd*2,Ne=le.maxY-le.minY+Wd*2;P.push({id:`group:${se}`,type:RI,position:{x:le.minX-Wd,y:le.minY-Wd},data:{sessionId:se,w:we,h:Ne},width:we,height:Ne,style:{width:we,height:Ne},zIndex:-1,draggable:!0,selectable:!1,focusable:!1,deletable:!1,connectable:!1})}return P},[Ir]),Bl=x.useMemo(()=>{const D=[...Cs,...Ir],P=Er.current;return!P||P.size===0?D:D.map(se=>{const le=P.get(se.id);return le?{...se,position:le}:se})},[Cs,Ir,df]),ns=x.useMemo(()=>{const D=new Set;for(const P of l.current.agents.values())for(const se of P.tools)D.add(KI(se.name));return Object.keys(GI).filter(P=>D.has(P))},[l.current,l.current.revision]);x.useEffect(()=>{if(ns.length<=1){Jo(!1);return}let D=0;const P=()=>{const se=Qo.current;if(se&&!document.hidden){const le=se.getBoundingClientRect(),we=Array.from(document.querySelectorAll(".react-flow__node, .tool-burst")).map(Me=>Me.getBoundingClientRect()),Ne=AG(le,we,8);Jo(Me=>Me===Ne?Me:Ne)}D=window.setTimeout(P,300)};return P(),()=>window.clearTimeout(D)},[ns.length]);const zl=x.useCallback(D=>{_l(P=>{const se=new Set(P);return se.has(D)?se.delete(D):se.add(D),se})},[]),di=j?nD(l.current.agents,j):null,uo=x.useCallback(async()=>{try{await fetch("/api/clear",{method:"POST"})}catch{}l.current=Gx(),Ct.current.clear(),Mr.current.clear(),Rt.current.clear(),no.current="",I2(),u(new Set);try{window.localStorage.removeItem(_b)}catch{}E(),p()},[p,E]),ca=x.useCallback(()=>{!_||!l.current.agents.has(_)||(u(D=>{const P=new Set(D);return P.add(_),sG(window.localStorage,P),P}),Ct.current.delete(_),Rt.current.delete(_),E())},[_,E]),hi=x.useRef(F);hi.current=F;const Hl=x.useRef(H);Hl.current=H;const ua=x.useRef(!1);ua.current=di!=null||St||R!=null||X||C!=null||ws||H||_t!=null;const ho=x.useCallback(D=>{const P=H7(D,{confirmOpen:hi.current,modalOpen:ua.current});P==="confirm"?O(!0):P==="clear"&&(O(!1),uo())},[uo]),fi=x.useCallback(()=>{Ct.current.clear(),Rt.current.clear(),no.current="",I2(),p(),window.setTimeout(()=>Ln(500),80)},[p,e,Ln]),Ul=x.useCallback(()=>Ln(500),[Ln]),rs=x.useRef(Ir);rs.current=Ir;const En=x.useCallback(D=>{var Nt;const P=Pn.current,se=l.current.agents.get(D);if(!P||!se)return;const le=l0(l.current),we=(at,gt)=>{const Dn=Mr.current.get(at.id);if(!Dn)return null;const zt=gt&&le.has(at.id)?bu:0;return{x:at.position.x,y:at.position.y,width:Dn.width+zt,height:Dn.height}},Ne=rs.current.find(at=>at.id===D),Me=Ne?we(Ne,!1):null;if(!Me)return;const Ze=[];for(const at of rs.current){if(at.type!=="agent"&&at.type!=="recapNote"||((Nt=at.data)==null?void 0:Nt.sessionId)!==se.sessionId)continue;const gt=we(at,at.type==="agent");gt&&Ze.push(gt)}const ft=P.getBoundingClientRect(),Ye=QG({pane:{width:ft.width,height:ft.height},insets:{top:56,left:72,bottom:32,right:Es.current+32},context:JG(Ze)??Me,anchor:Me});Aa(),ia(),es.current={id:D,at:Date.now()},_s.current+=1,Qn(Ye,Cx),Rr.current=Date.now(),Jr.current=Ud({durationMs:Cx,documentHidden:document.hidden})?{target:Ye,until:Date.now()+Cx+60}:null},[Qn,ia]);Ja.current=En;const Ou=x.useCallback(D=>{const P=rs.current.find(se=>se.id===D&&se.type==="agent");return P?P.data:void 0},[]),ss=x.useCallback(D=>{var P;return(P=l.current.agents.get(D))==null?void 0:P.label},[]),Wl=x.useCallback(D=>{var le;const P=rs.current.find(we=>we.id===D&&we.type==="recapNote");if(!P)return;const se=P.data;return{recap:se.recap,hue:se.hue,sessionLabel:(le=l.current.agents.get(se.parentId))==null?void 0:le.label}},[]),Vl=x.useCallback(()=>{var se;const D=(se=Pn.current)==null?void 0:se.getBoundingClientRect(),P=document.documentElement;return D?{width:D.right-Es.current,height:D.bottom}:{width:P.clientWidth,height:P.clientHeight}},[]),da=x.useRef(_);da.current=_;const pi=x.useCallback(D=>{const P=rs.current.filter(Ne=>Ne.type==="agent"),se=QV(P.map(Ne=>({id:Ne.id,x:Ne.position.x,y:Ne.position.y})),da.current,D),le=se?P.find(Ne=>Ne.id===se):void 0;if(!le)return;const we=Sx(document.activeElement);S(le.id,!1),window.setTimeout(()=>{try{En(le.id)}catch{}we&&EK(le.id)},30)},[S,En]),Ts=x.useRef(null),ha=x.useCallback(D=>{S(D,!1),window.setTimeout(()=>{try{En(D)}catch{}},60)},[S,En]),Gl=x.useRef(null);x.useEffect(()=>{let D=-1/0;const P=()=>{D=performance.now()},se=le=>{Gl.current=performance.now()-D<250?le.target:null};return window.addEventListener("pointerdown",P,!0),window.addEventListener("focusin",se,!0),()=>{window.removeEventListener("pointerdown",P,!0),window.removeEventListener("focusin",se,!0)}},[]),x.useEffect(()=>{const D=P=>{var Ze,ft;const se=P.target,le={tagName:se==null?void 0:se.tagName,isContentEditable:se==null?void 0:se.isContentEditable,role:(Ze=se==null?void 0:se.getAttribute)==null?void 0:Ze.call(se,"role"),type:se==null?void 0:se.type,pointerFocused:se!=null&&se===Gl.current};if(P.key==="Escape"){const Ye=WD({overlayOpen:$c.depth()>0,typing:z0(le)});Ye==="dismiss"?$c.dismissTop():Ye==="blur"?se==null||se.blur():(nG(le)&&(se==null||se.blur()),E());return}if(Lh(P))return;const we=Sx(se)?(ft=se==null?void 0:se.getAttribute)==null?void 0:ft.call(se,"data-id"):null,Ne=we&&rs.current.some(Ye=>Ye.id===we)?we:null,Me=eG(P,Ne);if(Me.kind==="activate"){P.preventDefault(),S(Me.nodeId,Me.additive);return}if(Me.kind!=="node"&&!(Me.nodeId==null&&e6(le,P.key))&&!t6({key:P.key,modalOpen:n6({appModal:ua.current,dialogDepth:$c.dialogDepth()}),sheetOpen:Hl.current})){if(P.key===" "&&(P.preventDefault(),Ga()),(P.key==="c"||P.key==="C")&&ho("shortcut"),(P.key==="r"||P.key==="R")&&fi(),(P.key==="f"||P.key==="F")&&Ul(),(P.key==="z"||P.key==="Z")&&da.current&&En(da.current),(P.key==="l"||P.key==="L")&&At(),P.key==="d"||P.key==="D")if(da.current)m(Ye=>!Ye);else{const Ye=Bp(l.current.agents.values());Ye.length>0?ha(Ye[0].id):pi(1)}if((P.key==="h"||P.key==="H")&&jr(Ye=>!Ye),(P.key==="u"||P.key==="U")&&U(Ye=>!Ye),(P.key==="a"||P.key==="A")&&Kn.current.claude&&bt(),(P.key==="j"||P.key==="J")&&pi(1),(P.key==="k"||P.key==="K")&&pi(-1),P.key==="w"||P.key==="W"){const Ye=$D(Bp(l.current.agents.values()),Ts.current);Ye&&(Ts.current=Ye.id,ha(Ye.id))}(P.key==="t"||P.key==="T")&&ni(Ye=>Ye==="dark"?"light":"dark"),(P.key==="m"||P.key==="M")&&Kn.current.claude&&Ve.current!==null&&Oe.current(P.shiftKey),(P.key==="s"||P.key==="S")&&B(Ye=>!Ye),(P.key==="b"||P.key==="B")&&Xr(Ye=>!Ye),(P.key==="v"||P.key==="V")&&Kn.current.claude&&Ve.current!==null&&$e(Ye=>!Ye),P.key==="?"&&K(Ye=>!Ye)}};return window.addEventListener("keydown",D),()=>window.removeEventListener("keydown",D)},[ho,fi,Ul,E,S,pi,ha,En,Ga]);const Kl=l.current.agents.size,it=x.useMemo(()=>Bp(l.current.agents.values()),[l.current,l.current.revision]),mi=x.useMemo(()=>OD(l.current.agents.values()),[l.current,l.current.revision]),fo=x.useRef(null);x.useEffect(()=>{const D=xG({waiting:it.length,running:mi,connected:ve}),P=fo.current;if(fo.current=D,(P==null?void 0:P.title)!==D.title&&(document.title=D.title),(P==null?void 0:P.icon)!==D.icon){const se=document.querySelector('link[rel="icon"]');se&&(se.href=bG[D.icon])}},[it.length,mi,ve]);const[po,Lu]=x.useState(""),gi=NG(it);x.useEffect(()=>{Lu(D=>w2(D,gi))},[gi]);const[mo,yi]=x.useState(""),As=Yn>0?`Browser watch has ${Yn} unread ${Yn===1?"finding":"findings"}.`:"";x.useEffect(()=>{yi(D=>w2(D,As,"Browser watch has no unread findings."))},[As]);const[go,yf]=x.useState(()=>typeof Notification>"u"?"denied":Notification.permission),[Rs,wi]=x.useState(null),[Ms,fa]=x.useState(!1),[Yl,vi]=x.useState(!1);x.useEffect(()=>{let D=!0;return fetch("/api/prefs").then(P=>P.ok?P.json():null).then(P=>{var se,le,we;if(!(!D||!(P!=null&&P.ok))){if(!Ka.current){let Ne=!1;try{Ne=window.localStorage.getItem(Vd)==="0",window.localStorage.removeItem(Vd)}catch{}Ne&&((se=P.prefs)==null?void 0:se.autoUpdate)!==!1?(Qs(!1),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({autoUpdate:!1})}).catch(()=>{})):Qs(((le=P.prefs)==null?void 0:le.autoUpdate)!==!1)}fa(((we=P.prefs)==null?void 0:we.notifications)===!0),vi(P.notificationsVetoed===!0)}}).catch(()=>{}),()=>{D=!1}},[]);const xi=x.useRef(()=>{}),Xl=x.useCallback(()=>{const D=!Ms;fa(D),D&&typeof Notification<"u"&&Notification.permission==="default"&&xi.current(),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({notifications:D})}).then(P=>P.ok?P.json():null).then(P=>{var se;P!=null&&P.ok&&(fa(((se=P.prefs)==null?void 0:se.notifications)===!0),vi(P.notificationsVetoed===!0))}).catch(()=>{})},[Ms]),wf=typeof Notification<"u";x.useEffect(()=>{if(!Rs)return;const P=setTimeout(()=>wi(null),Rs==="blocked"?8e3:4e3);return()=>clearTimeout(P)},[Rs]);const Zl=x.useCallback(()=>{typeof Notification>"u"||Notification.requestPermission().then(D=>{const P=D;yf(P),P==="granted"?wi("on"):P==="denied"&&wi("blocked")})},[]);xi.current=Zl;const yo=x.useRef(new Set),Ql=x.useRef(null),Jl=it.map(D=>Oh(D.id,D.waiting)).join("|");x.useEffect(()=>{FD(Ql.current,go)&&(Ql.current=go,yo.current=zp(it))},[go]);const $r=x.useRef(!1);return x.useEffect(()=>{qD($r.current,eo)&&($r.current=!0,yo.current=zp(it))},[eo]),x.useEffect(()=>{if(typeof Notification>"u"||Notification.permission!=="granted"||!BD(Ql.current,eo))return;const D=typeof document>"u"||!document.hidden,P=PD(it,yo.current,D,Ms);for(const se of P)try{const le=new Notification(se.title,{body:se.body,tag:se.key});le.onclick=()=>{window.focus(),ha(se.sessionId),le.close()}}catch{}yo.current=D?zp(it):DD(it,P,yo.current)},[Jl,eo]),o.jsxs("div",{className:"app",children:[o.jsx("a",{className:"skip-link",href:"#canvas",children:"Skip to the canvas"}),o.jsxs("header",{className:"topbar",children:[o.jsxs("div",{className:"readout",children:[o.jsxs("div",{className:"brand",children:[o.jsx("span",{className:"logo"}),o.jsx("h1",{children:tn}),tt?o.jsxs("button",{type:"button",className:"v stale",onClick:()=>{gn(),Ys()},"aria-haspopup":"dialog","aria-label":lK({...tt,open:Mn}),title:tt.kind==="restart"?`Running v${tt.from}; v${tt.to} is installed on disk. Restart to pick it up · click for what's new`:`Running v${tt.from}; v${tt.to} is on npm · click for what's new`,children:["v",tt.from,o.jsx("span",{className:"v-dot","aria-hidden":!0})]}):(()=>{const D={running:Et,latest:he==null?void 0:he.latest,latestPending:he==null?void 0:he.latestPending,checkedAgo:he!=null&&he.checkedAt?Jd(Ut-he.checkedAt):null,checkFailedAgo:he!=null&&he.checkFailedAt&&he.checkFailedAt>(he.checkedAt??0)?Jd(Ut-he.checkFailedAt):null,checkDisabled:he==null?void 0:he.checkDisabled,checking:Kt};return o.jsxs("button",{type:"button",className:Kt?"v checking":"v",onClick:()=>{gn(),ge(!0)},"aria-busy":Kt||void 0,"aria-haspopup":"dialog","aria-label":iK(D),title:oK(D),children:["v",D.running]})})()]}),o.jsx("span",{className:"status",children:(()=>{const D=kK({connected:ve,paused:Va,held:lt.size,dropped:lt.dropped});return D.resting?null:o.jsx("span",{className:`pill ${D.tone}`,title:D.title,children:o.jsxs("span",{className:"pill-box",children:[o.jsx("span",{className:"pill-widest","aria-hidden":!0,children:D.widest}),o.jsx("span",{className:"pill-label",children:D.label})]})})})()}),o.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:po}),o.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:mo}),it.length>0&&o.jsxs("button",{type:"button",className:"waiting-stat",onClick:()=>{Ts.current=it[0].id,ha(it[0].id)},title:`Blocked waiting for you — click, or press W, to go to the one that has been stuck longest:
|
|
291
|
+
${it.map(D=>` ${D.label}: ${cl(D.waiting)} (${Jd(Ut-D.waiting.since)})`).join(`
|
|
292
|
+
`)}`,"aria-label":`${it.length} session${it.length===1?"":"s"} waiting for you`,children:[o.jsx("span",{className:"ap-pulse","aria-hidden":!0}),o.jsx("b",{children:it.length})," ",o.jsx("span",{className:"ws-word",children:"waiting"})]}),Rs&&o.jsx("span",{className:Rs==="on"?"notify-said":"notify-said notify-said-blocked",role:"status",title:Rs==="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:Rs==="on"?"notifications on":"notifications blocked"})]}),Xt&&(()=>{const D=Vn(Xt),P=Math.max(0,((Xt.endedAt??Ut)-Xt.startedAt)/1e3),se=Xt.state==="active"?F0(D.total,P):null,le=y.size-1;return o.jsxs("button",{type:"button",className:"selected-ribbon",title:`Zoom to ${Xt.label} and its session (Z)`,onClick:()=>{try{En(Xt.id)}catch{}},children:[o.jsx("span",{className:`state-pill state-${Xt.state}`,children:Xt.state==="active"?"live":Xt.state}),o.jsx("span",{className:"selected-label",children:Xt.label}),D.total>0&&o.jsxs("span",{className:"selected-cost",children:[ct(D.total),se?o.jsxs("span",{className:"selected-rate",children:[" · ",se]}):null]}),le>0&&o.jsxs("span",{className:"selected-extra",children:["+",le]}),o.jsx("span",{"aria-hidden":!0,className:"selected-close",onClick:we=>{we.stopPropagation(),E()},children:"×"})]})})(),Xt&&o.jsx("button",{type:"button",className:"btn danger",onClick:ca,title:`Remove ${Xt.label} from this board`,"aria-label":`Remove ${Xt.label} from the board`,children:"Remove node"}),o.jsxs("div",{className:"actions",children:[o.jsxs("div",{className:"action-run",children:[o.jsxs("button",{className:"btn icon-btn",onClick:At,title:`${W?"Hide":"Show"} session list (L)`,"aria-label":"Toggle session list","aria-expanded":W,"aria-controls":W?"session-list":void 0,children:[o.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:[o.jsx("path",{d:"M5.4 3.6h6.6M5.4 7h6.6M5.4 10.4h6.6"}),o.jsx("path",{d:"M2.2 3.6h.2M2.2 7h.2M2.2 10.4h.2"})]}),o.jsx("span",{className:"tb-word",children:"Session list"})]}),o.jsxs("button",{className:"btn icon-btn",onClick:()=>U(D=>!D),title:`${z?"Hide":"Show"} usage panel (U)`,"aria-label":"Toggle usage panel","aria-expanded":z,"aria-controls":z?"usage-panel":void 0,children:[o.jsxs("svg",{className:"tb-glyph-narrow",width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[o.jsx("path",{d:"M9.4 4.5C9 3.6 8.1 3.1 7 3.1c-1.4 0-2.4.8-2.4 1.9 0 1.2 1.2 1.6 2.4 2s2.4.8 2.4 2c0 1.1-1 1.9-2.4 1.9-1.1 0-2-.5-2.4-1.4"}),o.jsx("path",{d:"M7 1.6v1.5M7 10.9v1.5"})]}),o.jsx("span",{className:"tb-word",children:"Usage"})]}),o.jsxs("button",{className:"btn icon-btn",onClick:()=>jr(D=>!D),title:"Usage history — ccusage (H)","aria-label":"Open usage history","aria-haspopup":"dialog",children:[o.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:[o.jsx("line",{x1:"3",y1:"11.5",x2:"3",y2:"7"}),o.jsx("line",{x1:"7",y1:"11.5",x2:"7",y2:"3"}),o.jsx("line",{x1:"11",y1:"11.5",x2:"11",y2:"8.5"})]}),o.jsx("span",{className:"tb-word",children:"History"})]})]}),o.jsxs("div",{className:"action-run",children:[Bt.claude&&o.jsxs("button",{className:"btn icon-btn",onClick:bt,title:`${ue?"Hide":"Show"} accounts (A)`,"aria-label":"Toggle accounts panel","aria-expanded":ue,"aria-controls":ue?"accounts-panel":void 0,children:[o.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:[o.jsx("circle",{cx:"7",cy:"4.6",r:"2.4"}),o.jsx("path",{d:"M2.4 12c0-2.3 2.1-3.7 4.6-3.7s4.6 1.4 4.6 3.7"})]}),o.jsx("span",{className:"tb-word",children:"Accounts"})]}),o.jsxs("button",{className:"btn icon-btn",onClick:()=>B(D=>!D),title:`${V?"Hide":"Show"} this machine — cores, memory, temperature (S)`,"aria-label":"Toggle machine detail","aria-expanded":V,"aria-controls":V?"system-panel":void 0,children:[o.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:[o.jsx("rect",{x:"3.6",y:"3.6",width:"6.8",height:"6.8",rx:"1.2"}),o.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"})]}),o.jsx("span",{className:"tb-word",children:"Machine"})]}),o.jsxs("button",{className:"btn icon-btn bw-btn",onClick:()=>Xr(D=>!D),title:xs?"Browser watch — watching; the deck is keeping its own copy (B)":"Browser watch — not watching; reading the browser's history live (B)","aria-label":`Browser watch, ${xs?"watching":"not watching"}`+(Yn>0?`, ${Yn} unread`:""),"aria-haspopup":"dialog",children:[o.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:[o.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"}),xs||Yn>0?o.jsx("circle",{cx:"7",cy:"7",r:"1.8",fill:"currentColor",stroke:"none"}):o.jsx("line",{x1:"2.4",y1:"11.6",x2:"11.6",y2:"2.4"})]}),o.jsx("span",{className:"tb-word",children:"Browser watch"}),Yn>0&&o.jsx("span",{className:"bw-badge","aria-hidden":!0,children:Yn})]})]}),o.jsxs("div",{className:"action-run action-run-utility",children:[Bt.claude&&ne!==null&&o.jsxs("div",{className:"sound-slot",children:[o.jsxs("button",{ref:oe,className:"btn icon-btn",onClick:()=>$e(D=>!D),...$a(!1),title:gK(Bt,{on:ne===!0,locked:rt==="locked",prefs:Le}),"aria-label":`Sound settings, ${ne?"on":"off"}`,"aria-haspopup":"dialog","aria-expanded":ot,"aria-controls":ot?"sound-menu":void 0,children:[o.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:[o.jsx("path",{d:"M3.2 5.2h2L7.8 3v8L5.2 8.8h-2z"}),ne?o.jsxs(o.Fragment,{children:[o.jsx("path",{d:"M9.8 5.4a2.4 2.4 0 0 1 0 3.2"}),o.jsx("path",{d:"M11.3 3.9a4.6 4.6 0 0 1 0 6.2"})]}):o.jsxs(o.Fragment,{children:[o.jsx("path",{d:"M10 5.6l2.6 2.8"}),o.jsx("path",{d:"M12.6 5.6L10 8.4"})]})]}),o.jsx("span",{className:"tb-word",children:"Sound"})]}),ot&&o.jsx(y9,{onClose:()=>$e(!1),soundOn:ne===!0,onToggleSound:me,prefs:Le,onLevel:(D,P)=>Xe(D,{level:P}),onFigure:(D,P)=>Xe(D,{figure:P}),onPreview:D=>Se(D),notifyOn:Ms,onToggleNotify:Xl,notifyVetoed:Yl,notifyPermission:wf?go:"unsupported",onAskNotify:Zl,openerRef:oe})]}),o.jsxs("div",{className:"appearance-slot",children:[o.jsx("button",{ref:De,className:"btn icon-btn",onClick:()=>{$e(!1),Ce(D=>!D)},title:"Appearance settings","aria-label":`Appearance settings, ${Ar} theme, character ${sa?"shown":"hidden"}`,"aria-haspopup":"dialog","aria-expanded":ye,"aria-controls":ye?"appearance-menu":void 0,children:Ar==="dark"?o.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:[o.jsx("circle",{cx:"7",cy:"7",r:"2.5"}),o.jsx("path",{d:"M7 1.5v1.2M7 11.3v1.2M1.5 7h1.2M11.3 7h1.2M3.1 3.1l.85.85M10.05 10.05l.85.85M3.1 10.9l.85-.85M10.05 3.95l.85-.85"})]}):o.jsx("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:o.jsx("path",{d:"M11.8 8.4A5 5 0 1 1 5.6 2.2a4 4 0 0 0 6.2 6.2Z"})})}),ye&&o.jsx(E9,{theme:Ar,onTheme:ni,characterEnabled:sa,onToggleCharacter:()=>Qr(D=>!D),fmVolume:aa,onFmVolume:ri,fmSource:Za,onFmSource:si,onClose:()=>Ce(!1)})]})]})]})]}),Tr?o.jsxs("div",{className:"ver-banner done",role:"status",children:[o.jsx("span",{className:"ver-dot"}),o.jsxs("strong",{children:["Restarted — now running v",Tr,"."]}),o.jsx("span",{className:"ver-sub",children:"The canvas replayed from the event log."})]}):ai&&!ve?o.jsxs("div",{className:"conn-banner",role:"alert",children:[o.jsx("span",{className:"conn-dot"}),hn?Ya==="npx"?"Fetching the new version with npx — this can take a minute…":`Restarting ${tn}…`:(()=>{const D=xK({connected:ve,paused:Va});return o.jsxs(o.Fragment,{children:[`Lost connection to the ${tn} server. Reconnecting…`,D&&o.jsx("span",{className:"conn-sub",children:D})]})})()]}):Mn&&tt?o.jsxs("div",{className:`ver-banner ${tt.kind}`,role:"status",children:[o.jsx("span",{className:`ver-dot${na==null?"":" armed"}`}),tt.kind==="restart"?o.jsxs(o.Fragment,{children:[o.jsxs("strong",{children:["v",tt.to," is installed — this deck still runs v",tt.from,"."]}),he!=null&&he.canRestart?o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"ver-act",onClick:()=>ea(),...$a(hn),title:`Stop this process and bring it back on the same port. The canvas replays from the event log.
|
|
293
|
+
|
|
294
|
+
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:hn?"restarting…":wu.label}),!hn&&o.jsx("span",{className:"ver-sub",children:wu.clause}),o.jsxs("label",{className:"ver-auto",children:[o.jsx("button",{type:"button",className:"switch",role:"switch","aria-checked":Cr,onClick:Zr,"aria-label":"Auto-restart when idle",title:Cr?"Updates on its own. While you are here it restarts once nothing has been running for 30 seconds; while you are away it also installs the new version first. Click to require a click instead.":"Only updates when you click. Click to let it update itself when idle or while you are away.",children:o.jsx("span",{className:"switch-knob"})}),o.jsx("span",{"aria-hidden":!0,children:Kz(Cr,na)})]})]}):o.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."})]}):o.jsxs(o.Fragment,{children:[o.jsxs("strong",{children:[tn," v",tt.to," is out — you are on v",tt.from,"."]}),(he==null?void 0:he.upgradeMode)==="install"&&Fe!=="failed"&&o.jsx("button",{type:"button",className:"ver-act",onClick:yt,...$a(Fe==="running",Fe==="done"),title:`Runs ${((Is=he==null?void 0:he.upgrade)==null?void 0:Is.command)??(he==null?void 0:he.command)??"npm i -g"} here, then restarts once nothing is running.`,children:Fe==="running"?"installing…":Fe==="done"?"installed":"Update now"}),(he==null?void 0:he.upgradeMode)==="npx"&&(he==null?void 0:he.canRestart)&&o.jsx("button",{type:"button",className:"ver-act",onClick:()=>ea({upgrade:!0}),...$a(hn),title:`Runs ${he==null?void 0:he.command} and hands it this port. Nothing is installed globally — npx unpacks its own copy.`,children:hn?"fetching…":Fe==="failed"?"Retry update":"Update & restart"}),Fe==="failed"?o.jsxs("span",{className:"ver-sub fail",title:((tr=he==null?void 0:he.upgrade)==null?void 0:tr.error)??"",children:[(he==null?void 0:he.upgradeMode)==="npx"?"update failed":"install failed",": ",((pa=he==null?void 0:he.upgrade)==null?void 0:pa.error)??"unknown error"," — run it yourself:"]}):(he==null?void 0:he.upgradeMode)==="npx"?o.jsx("span",{className:"ver-sub",children:he!=null&&he.canRestart?"npx cannot upgrade in place, so the deck re-runs:":Ax.npx}):he!=null&&he.upgradeBlocked?o.jsx("span",{className:"ver-sub",children:Object.hasOwn(Ax,he.upgradeBlocked)?Ax[he.upgradeBlocked]:"cannot install from here"}):null,o.jsxs("button",{type:"button",className:"ver-cmd",onClick:kt,title:"Copy to clipboard",children:[o.jsx("code",{children:he==null?void 0:he.command}),o.jsx("span",{className:"ver-cmd-hint",children:jt?"copied":"copy"})]})]}),o.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:Xs,children:"×"})]}):J&&yn?o.jsxs("div",{className:"ver-banner",role:"status",children:[o.jsx("span",{className:"ver-dot"}),o.jsxs("strong",{children:[yn," still works — the deck is called ",tn," now."]}),he!=null&&he.renameFix?o.jsx("span",{className:"ver-sub",children:he.renameFix}):null,o.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:Ae,children:"×"})]}):null,Hp(ee)&&Bt.claude&&o.jsx(Bz,{leaving:ee==="leaving",onClose:()=>G(!1)}),W&&o.jsx(ZF,{state:l.current,now:Ut,selectedIds:y,onSelect:ha,onClose:()=>$(!1)}),o.jsxs("main",{id:"canvas",tabIndex:-1,className:`canvas-wrap${oo?" bubbling":""}${io?" dragging-any":""}`,"data-lod":Dl,ref:Pn,onMouseDownCapture:ff,onPointerDownCapture:Al,onPointerUpCapture:Al,onWheelCapture:Al,onFocusCapture:D=>{const P=D.target;if(!Sx(P)||ts.current==null||ts.current==="detail")return;const se=P.getAttribute("data-id");se&&l.current.agents.has(se)&&P.matches(":focus-visible")&&_2(se,P,"focus")},onBlurCapture:D=>{var se,le;const P=(le=(se=D.target).getAttribute)==null?void 0:le.call(se,"data-id");P&&Aa(P)},children:[Kl===0&&(!ve&&Ue?o.jsx(ZK,{}):o.jsx(QK,{live:ve,everConnected:ai,providers:Bt,workspace:Yt,onTour:()=>I(!0)})),(ns.length>1||Nl.size>0)&&o.jsx("div",{ref:Qo,className:`cat-filter-bar${fu?" occluded":""}`,role:"group","aria-label":"Filter tools by category",children:ns.map(D=>{const P=Nl.has(D);return o.jsxs("button",{type:"button",className:`cat-filter${P?" off":""}`,onClick:()=>zl(D),"aria-pressed":!P,title:`${P?"Show":"Hide"} ${Sh[D]} tools`,children:[o.jsx(VK,{cat:D}),o.jsx("span",{className:"cat-name",children:Sh[D]})]},D)})}),o.jsxs(QA,{nodes:Bl,edges:ui,nodeTypes:SK,edgesFocusable:!1,edgeTypes:jK,fitView:!ti,fitViewOptions:{padding:.25,duration:Ud({durationMs:T2,documentHidden:document.hidden})?T2:0},minZoom:II,maxZoom:$I,panOnScroll:!0,nodesDraggable:!0,nodesConnectable:!1,selectionOnDrag:!1,nodeDragThreshold:5,disableKeyboardA11y:!0,deleteKeyCode:null,onNodeClick:(D,P)=>{if(P.type==="sessionGroup"){E();return}const se=P.type==="recapNote"?P.data.parentId:P.id;S(se,D.shiftKey,!1),!D.shiftKey&&(h&&m(!1),Mu?window.setTimeout(()=>{try{En(se)}catch{}},80):En(se))},onPaneClick:()=>{Aa(),E()},onNodeDoubleClick:(D,P)=>{if(P.type!=="agent"&&P.type!=="recapNote")return;const se=P.type==="recapNote"?P.data.parentId:P.id;S(se,!1),window.setTimeout(()=>{try{En(se)}catch{}},80)},onNodeMouseEnter:(D,P)=>{P.type!=="agent"&&P.type!=="recapNote"||oi.current||ts.current==null||ts.current==="detail"||_2(P.id,D.currentTarget)},onNodeMouseLeave:(D,P)=>Aa(P.id),onMoveStart:D=>{Aa(),kx(Rl(D))&&(_s.current+=1),kx(Rl(D))&&ia()},onMove:(D,P)=>{var le,we;to(),kx(Rl(D))&&ia(),(le=Pn.current)==null||le.style.setProperty("--zoom",String(P.zoom));const se=VG(ts.current,P.zoom,Ru());se!==ts.current&&(ts.current=se,(we=Pn.current)==null||we.setAttribute("data-lod",se),Fl(se),se==="detail"&&Aa()),Cl.current&&window.clearTimeout(Cl.current),Cl.current=window.setTimeout(()=>HK(P),250)},onNodeDragStart:(D,P)=>{var se;if(Aa(),pf(),oi.current=!0,Er.current=new Map,Pl(!0),to(),ia(),P.type==="sessionGroup"){const le=(se=P.data)==null?void 0:se.sessionId,we=new Map;if(le)for(const Ne of Ir){const Me=Ne.data;(Me==null?void 0:Me.sessionId)===le&&we.set(Ne.id,{x:Ne.position.x,y:Ne.position.y})}Ns.current={start:{x:P.position.x,y:P.position.y},members:we};return}Ct.current.set(P.id,{x:P.position.x,y:P.position.y})},onNodeDrag:(D,P)=>{var se;if(to(),P.type==="sessionGroup"){const le=Ns.current;if(!le)return;const we=P.position.x-le.start.x,Ne=P.position.y-le.start.y;for(const[Ze,ft]of le.members){const Ye={x:ft.x+we,y:ft.y+Ne};Ct.current.set(Ze,Ye),Rt.current.set(Ze,Ye)}const Me=Er.current;if(Me){for(const[Ze,ft]of le.members)Me.set(Ze,{x:ft.x+we,y:ft.y+Ne});Me.set(P.id,{x:P.position.x,y:P.position.y})}ei(Ze=>Ze+1);return}Ct.current.set(P.id,{x:P.position.x,y:P.position.y}),Rt.current.set(P.id,{x:P.position.x,y:P.position.y}),(se=Er.current)==null||se.set(P.id,{x:P.position.x,y:P.position.y}),ei(le=>le+1)},onNodeDragStop:(D,P)=>{if(to(),oi.current=!1,Er.current=null,Pl(!1),hu(se=>se+1),P.type==="sessionGroup"){const se=Ns.current;if(se){const le=P.position.x-se.start.x,we=P.position.y-se.start.y;for(const[Ne,Me]of se.members){const Ze={x:Me.x+le,y:Me.y+we};Ct.current.set(Ne,Ze),Rt.current.set(Ne,Ze)}}Ns.current=null,Gd(Rt.current,Ct.current),hu(le=>le+1);return}Ct.current.set(P.id,{x:P.position.x,y:P.position.y}),Rt.current.set(P.id,{x:P.position.x,y:P.position.y}),Gd(Rt.current,Ct.current)},children:[o.jsx(q5,{gap:28,size:1,color:Zn["--grid-line"]}),o.jsx(LF,{onFocusSession:En}),o.jsx(tF,{agents:l.current.agents,visibleAgentIds:li,positions:Rt.current,pinned:Ct.current,measured:Mr.current,spotlight:ii,hiddenCategories:Nl,now:Ut,onOpenTool:b}),Il&&o.jsxs("div",{className:"autofit-chip",children:[o.jsx("span",{className:"autofit-state",title:"New sessions are not brought into view while you are moving it yourself",children:"Auto-fit off"}),o.jsx("button",{type:"button",className:"autofit-resume",onClick:Su,title:"Bring new sessions into view again","aria-label":"Resume auto-fit",children:"Resume"})]}),o.jsxs($5,{showInteractive:!1,showFitView:!1,showZoom:!1,children:[o.jsx(wr,{onClick:()=>e.zoomIn(),title:"Zoom in","aria-label":"Zoom in",disabled:t,children:o.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:o.jsx("path",{d:"M12 5v14M5 12h14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})})}),o.jsx(wr,{onClick:()=>e.zoomOut(),title:"Zoom out","aria-label":"Zoom out",disabled:n,children:o.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:o.jsx("path",{d:"M5 12h14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})})}),o.jsx(wr,{onClick:Su,title:Il?"Recenter view + re-enable autofit":"Recenter view (autofit already on)","aria-label":"Recenter view","data-nudge":Il?"":void 0,children:o.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[o.jsx("circle",{cx:"12",cy:"12",r:"3.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),o.jsx("path",{d:"M12 2v4M12 18v4M2 12h4M18 12h4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})]})}),o.jsx(wr,{"data-group-start":"",onClick:Ga,title:vK({paused:Va,held:lt.size,dropped:lt.dropped}),"aria-label":wK,"aria-pressed":Va,children:o.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:o.jsx("path",{d:"M9 5.5v13M15 5.5v13",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})})}),o.jsx(wr,{onClick:fi,title:"Auto-arrange — clear pins (R)","aria-label":"Re-arrange the canvas",children:o.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[o.jsx("rect",{x:"8.5",y:"2",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),o.jsx("rect",{x:"1.5",y:"17",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),o.jsx("rect",{x:"15.5",y:"17",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),o.jsx("path",{d:"M12 7v6.5M5 17v-3.5h14V17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]})}),o.jsx(wr,{"data-group-start":"","data-danger":"",onClick:()=>ho("button"),title:"Clear the canvas and the server's event log — asks first (C)","aria-label":"Clear the canvas",children:o.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[o.jsx("path",{d:"M4 6.2h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"}),o.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"}),o.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"}),o.jsx("path",{d:"M10.3 10.6v6.8M13.7 10.6v6.8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})]})}),o.jsx(wr,{"data-group-start":"",onClick:()=>K(D=>!D),title:"Keyboard shortcuts (?)","aria-label":"Open the keyboard shortcuts","aria-haspopup":"dialog",children:o.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[o.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"}),o.jsx("path",{d:"M12 18.4v.2",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",fill:"none"})]})})]}),o.jsx(E5,{zoomable:!0,pannable:!0,nodeColor:oa,nodeStrokeWidth:2,maskColor:Zn["--minimap-mask"],maskStrokeColor:Zn["--line"]}),sa&&o.jsx(TV,{volume:aa,source:Za})]}),o.jsx(nK,{agentFor:Ou,recapFor:Wl,labelFor:ss,bounds:Vl})]}),Hp(L)&&o.jsx(Mq,{state:l.current,now:Ut,providers:Bt,liveSince:eo,leaving:L==="leaving",onClose:()=>U(!1)}),Hp(te)&&o.jsx(d8,{usageOpen:z,leaving:te==="leaving",onClose:()=>B(!1)}),h&&Xt?o.jsxs("aside",{className:"detail","aria-label":"Detail",children:[o.jsx("button",{type:"button",className:"glyph-btn detail-close",title:"Close panel","aria-label":"Close detail panel",onClick:()=>m(!1),children:"×"}),o.jsx(eY,{agent:Xt,now:Ut,onOpenTool:b,onShowSummary:T,onExportSession:D=>UK(l.current,D)})]}):null,di&&o.jsx(SF,{tool:di,onClose:()=>b(null)}),St&&o.jsx(x.Suspense,{fallback:null,children:o.jsx(NK,{providers:Bt,onClose:()=>jr(!1)})}),ws&&o.jsx(x.Suspense,{fallback:null,children:o.jsx(_K,{onClose:()=>Xr(!1),onSeen:D=>{Xo(D);try{localStorage.setItem(v2,String(D))}catch{}},onWatching:On,palette:Zn})}),R&&(()=>{const D=l.current.agents.get(R);return D?o.jsx(l6,{agent:D,onClose:()=>A(null)}):null})(),C&&o.jsx(KF,{state:l.current,sessionId:C,onClose:()=>T(null)}),_t&&o.jsx(XV,{entries:_t.entries,since:_t.since,firstRun:_t.firstRun,running:Et,onClose:()=>on(null),onTour:()=>{on(null),I(!0)},onRestart:he!=null&&he.canRestart?()=>{on(null),ea()}:void 0}),(()=>{const{request:D,waiting:P}=SG(cf,du.current);return D?o.jsx(jG,{request:D,waiting:P,busy:bs,now:Date.now(),onAccept:()=>void Zs("accept",D.fp),onDecline:()=>void Zs("dismiss",D.fp),onLater:()=>{bs||(du.current.add(D.fp),Zo(se=>[...se]))}}):null})(),H&&o.jsx(X7,{onClose:()=>K(!1),onTour:()=>{K(!1),I(!0)}}),X&&o.jsx(eM,{title:"What the deck shows you",steps:xB,onClose:()=>{I(!1),VV(y2()),d0()&&fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({tourSeen:!0}),keepalive:!0}).catch(()=>{});const D=Z.current;Z.current=null,D&&on(D)}}),F&&o.jsx(G7,{agentCount:Kl,onConfirm:()=>ho("confirmation"),onCancel:()=>O(!1)})]})}function ZK(){return o.jsxs("div",{className:"empty-hero",children:[o.jsxs("div",{className:"orbit-stack","aria-hidden":!0,children:[o.jsx("div",{className:"core"}),o.jsxs("div",{className:"orbit r1",children:[o.jsx("span",{className:"dot"}),o.jsx("span",{className:"dot b"})]}),o.jsxs("div",{className:"orbit r2",children:[o.jsx("span",{className:"dot"}),o.jsx("span",{className:"dot b"})]}),o.jsxs("div",{className:"orbit r3",children:[o.jsx("span",{className:"dot"}),o.jsx("span",{className:"dot b"})]})]}),o.jsxs("h2",{children:["Too many ",tn," tabs are open"]}),o.jsxs("p",{children:["This browser keeps at most six live connections to one address, and other ",o.jsx("code",{children:tn})," tabs are holding them. Close one and this tab connects on its own."]})]})}function QK({live:e,everConnected:t,providers:n,workspace:r,onTour:a}){const l=!e;return o.jsxs("div",{className:"empty-hero",children:[o.jsxs("div",{className:"orbit-stack","aria-hidden":!0,children:[o.jsx("div",{className:"core"}),o.jsxs("div",{className:"orbit r1",children:[o.jsx("span",{className:"dot"}),o.jsx("span",{className:"dot b"})]}),o.jsxs("div",{className:"orbit r2",children:[o.jsx("span",{className:"dot"}),o.jsx("span",{className:"dot b"})]}),o.jsxs("div",{className:"orbit r3",children:[o.jsx("span",{className:"dot"}),o.jsx("span",{className:"dot b"})]})]}),l?o.jsxs(o.Fragment,{children:[o.jsx("h2",{children:t?"Disconnected from server":"Server unreachable"}),o.jsxs("p",{children:[t?"This page lost its connection to ":"This page cannot reach ",o.jsx("code",{children:tn}),". Check that it is still running in your terminal — the page picks up again on its own."]})]}):JK(n,r),!l&&o.jsx("button",{type:"button",className:"btn empty-tour",onClick:a,children:"Take the tour"})]})}function JK(e,t){const n=uK(t);return o.jsxs(o.Fragment,{children:[o.jsx("h2",{children:"Waiting for Claude Code or Codex"}),n.kind==="scoped"?o.jsxs("p",{children:[n.lead," ",o.jsx("code",{children:n.workspace}),n.tail]}):o.jsxs("p",{children:["Run ",o.jsx("code",{children:"claude"})," or ",o.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."]}),mK(e).map(r=>o.jsx("p",{className:"hint-row",children:r.spans.map((a,l)=>a.code?o.jsx("code",{children:a.text},l):o.jsx("span",{children:a.text},l))},r.provider))]})}function eY({agent:e,now:t,onOpenTool:n,onShowSummary:r,onExportSession:a}){const l=`${e.synthetic?"≥ ":""}${ol(e.startedAt,e.endedAt,t)}`,c=Vn(e),u=c.total>0,f=e.usage.inputTokens+e.usage.outputTokens,p=new Map;for(const _ of e.tools){const k=KI(_.name);p.set(k,(p.get(k)??0)+1)}const h=e.tools.filter(_=>_.ok===!1).length,m=e.tools.filter(_=>!_.endedAt).length,y=Array.from(p.entries()).sort((_,k)=>k[1]-_[1]),w=p.has("mcp")?X6(e.tools.map(_=>_.name)):null;return o.jsxs(o.Fragment,{children:[o.jsxs("header",{className:"detail-hero",children:[o.jsxs("div",{className:"hero-line",children:[o.jsx("span",{className:`state-pill state-${e.state}`,children:e.state==="active"?"live":e.state}),o.jsx("h2",{className:"hero-title",title:e.cwd??e.label,children:e.label})]}),o.jsxs("div",{className:"hero-meta",children:[o.jsx("span",{className:"hero-meta-item",children:e.kind==="root"?"session":"subagent"}),o.jsx("span",{className:"hero-sep",children:"·"}),o.jsx("span",{className:"hero-meta-item",title:`started ${new Date(e.startedAt).toLocaleString()}`,children:l}),e.model&&(()=>{const _=mR(e);return o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"hero-sep",children:"·"}),o.jsxs("span",{className:"model-chip","data-family":$h(e.model),title:_.length>0?`${e.model}
|
|
295
|
+
spend on this panel also covers:
|
|
296
|
+
${_.join(`
|
|
297
|
+
`)}`:e.model,children:[qa(e.model),_.length>0?` +${_.length}`:""]})]})})()]}),u&&o.jsxs("div",{className:"hero-cost",children:[o.jsxs("div",{className:"hero-cost-headline",children:[o.jsx("span",{className:"hero-cost-value",children:ct(c.total)}),o.jsx("span",{className:"hero-cost-label",children:"spend"})]}),o.jsx(K0,{cost:c})]}),o.jsxs("div",{className:"hero-actions",children:[e.kind==="root"&&e.state==="done"&&r&&o.jsx("button",{type:"button",className:"btn hero-action-btn",onClick:()=>r(e.sessionId),title:"Reopen the end-of-session recap modal",children:"Show recap"}),a&&o.jsx("button",{type:"button",className:"btn hero-action-btn",onClick:()=>a(e.sessionId),title:"Download this session as JSON",children:"Export JSON"})]})]}),(()=>{const _=Ph(e);if(!_)return null;const k=fh(_.at,t);return o.jsxs("section",{className:"detail-section",children:[o.jsxs("h3",{children:["Recap ",o.jsx("span",{className:"section-count",title:k.title,children:k.label})]}),o.jsx("p",{className:"detail-recap",children:_.text})]})})(),e.tools.length>0&&o.jsxs("section",{className:"detail-section",children:[o.jsx("h3",{children:"Activity"}),o.jsxs("div",{className:"activity-row",children:[o.jsxs("div",{className:"activity-counters",children:[o.jsxs("span",{className:"ac-item",children:[o.jsx("b",{children:e.toolCount})," calls"]}),m>0&&o.jsxs("span",{className:"ac-item ac-live",children:[o.jsx("b",{children:m})," live"]}),h>0&&o.jsxs("span",{className:"ac-item ac-err",children:[o.jsx("b",{children:h})," err"]})]}),o.jsx("div",{className:"cat-strip",children:y.map(([_,k])=>{const j=_==="mcp"?w:null,b=j==null?void 0:j.hue,S=`${k} ${Sh[_]} call${k===1?"":"s"}`;return o.jsxs("span",{className:`cat-chip cat-${_}${b!=null?" mcp-hue":""}`,style:b!=null?{"--mcp-hue":b}:void 0,title:j?`${S}, all to ${j.label}`:S,children:[o.jsx("span",{className:"cat-emoji","aria-hidden":!0,children:GI[_]}),o.jsx("span",{className:"cat-name",children:Sh[_]}),o.jsx("span",{className:"cat-count",children:k}),j&&o.jsx("span",{className:"cat-server",children:j.label})]},_)})})]})]}),f>0&&o.jsxs("section",{className:"detail-section",children:[o.jsx("h3",{children:"Tokens"}),o.jsxs("div",{className:"tokens-grid",children:[o.jsxs("div",{children:[o.jsx("span",{className:"k",children:"in"}),o.jsx("b",{title:e.usage.inputTokens.toLocaleString(),children:Dt(e.usage.inputTokens)})]}),o.jsxs("div",{children:[o.jsx("span",{className:"k",children:"out"}),o.jsx("b",{title:e.usage.outputTokens.toLocaleString(),children:Dt(e.usage.outputTokens)})]}),o.jsxs("div",{children:[o.jsx("span",{className:"k",children:"cache r"}),o.jsx("b",{title:e.usage.cacheReadTokens.toLocaleString(),children:Dt(e.usage.cacheReadTokens)})]}),o.jsxs("div",{children:[o.jsx("span",{className:"k",children:"cache c"}),o.jsx("b",{title:e.usage.cacheCreateTokens.toLocaleString(),children:Dt(e.usage.cacheCreateTokens)})]})]})]}),o.jsxs("section",{className:"detail-section",children:[o.jsx("h3",{children:"Identity"}),o.jsxs("div",{children:[e.cwd&&o.jsxs("div",{className:"row",children:[o.jsx("span",{className:"k",children:"cwd"}),o.jsx("span",{className:"v",title:e.cwd,children:e.cwd})]}),o.jsxs("div",{className:"row",children:[o.jsx("span",{className:"k",children:"session"}),o.jsxs("span",{className:"v",children:[e.sessionId.slice(0,12),"…"]})]}),e.parentId&&o.jsxs("div",{className:"row",children:[o.jsx("span",{className:"k",children:"parent"}),o.jsxs("span",{className:"v",children:[e.parentId.slice(0,12),"…"]})]})]})]}),e.prompts.length>0&&o.jsxs("section",{className:"detail-section",children:[o.jsxs("h3",{children:["Prompts ",o.jsx("span",{className:"section-count",children:sR(e.prompts).length})]}),o.jsx("div",{className:"prompts",children:e.prompts.slice().reverse().map((_,k)=>{const j=fh(_.at,t),b=P0(_.text);return b?o.jsxs("details",{className:"prompt-entry prompt-injected",children:[o.jsxs("summary",{children:[o.jsx("span",{className:"prompt-time",title:j.title,children:j.label}),o.jsx("span",{className:"prompt-injected-label",children:b.label})]}),b.detail&&o.jsx("div",{className:"prompt-injected-detail",children:b.detail})]},k):o.jsxs("div",{className:"prompt-entry",children:[o.jsx("div",{className:"prompt-time",title:j.title,children:j.label}),o.jsx("div",{className:"prompt-text",children:_.text})]},k)})})]}),o.jsxs("section",{className:"detail-section",children:[o.jsxs("h3",{children:["Tool calls ",o.jsx("span",{className:"section-count",children:e.tools.length})]}),e.tools.length===0&&o.jsx("div",{className:"empty",children:"No tool calls yet."}),o.jsx("div",{children:e.tools.slice().reverse().map(_=>o.jsx(nY,{t:_,onClick:()=>n(_.id)},_.id))})]})]})}const tY={inflight:"in-flight",done:"done",err:"error"};function nY({t:e,onClick:t}){const n=e.endedAt==null?"inflight":e.ok===!1?"err":"done",r=yR(e,"…");return o.jsxs("button",{className:"tool clickable",title:e.inputPreview||e.name,onClick:t,children:[o.jsxs("span",{className:"name",children:[o.jsx("span",{className:`status-dot ${n}`,"aria-hidden":!0}),o.jsx("span",{className:"vis-hidden",children:tY[n]}),e.name]}),o.jsx("span",{style:{color:"var(--muted)"},children:r})]})}try{p6(window.localStorage)}catch{}const rY=P$.createRoot(document.getElementById("root"));rY.render(o.jsx(GK,{}));export{v2 as S,fK as a,aY as b,Yc as c,Dt as d,sY as e,ct as f,qa as g,Hs as h,Ba as i,o as j,_G as k,QN as p,x as r,$a as s,sn as u};
|