ccdeck 3.33.1 → 3.34.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/README.md +8 -6
- package/dist/web/assets/{BrowserWatchModal-BTNOQdp5.js → BrowserWatchModal-C9xCXMz4.js} +1 -1
- package/dist/web/assets/{UsageHistoryModal-CIDpgHTW.js → UsageHistoryModal-B-v-iUY5.js} +1 -1
- package/dist/web/assets/index-CgHJ_aHk.js +301 -0
- package/dist/web/assets/index-DglpEGvW.css +1 -0
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/release-notes.json +14 -0
- package/src/server/deck-prefs.mjs +37 -1
- package/src/server/index.mjs +20 -2
- package/src/server/prefs-routes.mjs +7 -2
- package/src/server/reports-routes.mjs +75 -0
- package/src/server/reports.mjs +252 -0
- package/dist/web/assets/index-BIANlQ9A.css +0 -1
- package/dist/web/assets/index-D7ddxIpC.js +0 -299
|
@@ -1,299 +0,0 @@
|
|
|
1
|
-
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const l of i.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();var nu=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Bx(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var If={exports:{}},Xi={},Of={exports:{}},De={};/**
|
|
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 k1;function VL(){if(k1)return De;k1=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),l=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),p=Symbol.iterator;function g(F){return F===null||typeof F!="object"?null:(F=p&&F[p]||F["@@iterator"],typeof F=="function"?F:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},k=Object.assign,x={};function b(F,H,J){this.props=F,this.context=H,this.refs=x,this.updater=J||w}b.prototype.isReactComponent={},b.prototype.setState=function(F,H){if(typeof F!="object"&&typeof F!="function"&&F!=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,F,H,"setState")},b.prototype.forceUpdate=function(F){this.updater.enqueueForceUpdate(this,F,"forceUpdate")};function j(){}j.prototype=b.prototype;function S(F,H,J){this.props=F,this.context=H,this.refs=x,this.updater=J||w}var _=S.prototype=new j;_.constructor=S,k(_,b.prototype),_.isPureReactComponent=!0;var E=Array.isArray,T=Object.prototype.hasOwnProperty,R={current:null},A={key:!0,ref:!0,__self:!0,__source:!0};function U(F,H,J){var W,G={},X=null,Z=null;if(H!=null)for(W in H.ref!==void 0&&(Z=H.ref),H.key!==void 0&&(X=""+H.key),H)T.call(H,W)&&!A.hasOwnProperty(W)&&(G[W]=H[W]);var ee=arguments.length-2;if(ee===1)G.children=J;else if(1<ee){for(var re=Array(ee),ce=0;ce<ee;ce++)re[ce]=arguments[ce+2];G.children=re}if(F&&F.defaultProps)for(W in ee=F.defaultProps,ee)G[W]===void 0&&(G[W]=ee[W]);return{$$typeof:e,type:F,key:X,ref:Z,props:G,_owner:R.current}}function I(F,H){return{$$typeof:e,type:F.type,key:H,ref:F.ref,props:F.props,_owner:F._owner}}function q(F){return typeof F=="object"&&F!==null&&F.$$typeof===e}function P(F){var H={"=":"=0",":":"=2"};return"$"+F.replace(/[=:]/g,function(J){return H[J]})}var O=/\/+/g;function V(F,H){return typeof F=="object"&&F!==null&&F.key!=null?P(""+F.key):H.toString(36)}function $(F,H,J,W,G){var X=typeof F;(X==="undefined"||X==="boolean")&&(F=null);var Z=!1;if(F===null)Z=!0;else switch(X){case"string":case"number":Z=!0;break;case"object":switch(F.$$typeof){case e:case t:Z=!0}}if(Z)return Z=F,G=G(Z),F=W===""?"."+V(Z,0):W,E(G)?(J="",F!=null&&(J=F.replace(O,"$&/")+"/"),$(G,H,J,"",function(ce){return ce})):G!=null&&(q(G)&&(G=I(G,J+(!G.key||Z&&Z.key===G.key?"":(""+G.key).replace(O,"$&/")+"/")+F)),H.push(G)),1;if(Z=0,W=W===""?".":W+":",E(F))for(var ee=0;ee<F.length;ee++){X=F[ee];var re=W+V(X,ee);Z+=$(X,H,J,re,G)}else if(re=g(F),typeof re=="function")for(F=re.call(F),ee=0;!(X=F.next()).done;)X=X.value,re=W+V(X,ee++),Z+=$(X,H,J,re,G);else if(X==="object")throw H=String(F),Error("Objects are not valid as a React child (found: "+(H==="[object Object]"?"object with keys {"+Object.keys(F).join(", ")+"}":H)+"). If you meant to render a collection of children, use an array instead.");return Z}function M(F,H,J){if(F==null)return F;var W=[],G=0;return $(F,W,"","",function(X){return H.call(J,X,G++)}),W}function L(F){if(F._status===-1){var H=F._result;H=H(),H.then(function(J){(F._status===0||F._status===-1)&&(F._status=1,F._result=J)},function(J){(F._status===0||F._status===-1)&&(F._status=2,F._result=J)}),F._status===-1&&(F._status=0,F._result=H)}if(F._status===1)return F._result.default;throw F._result}var Y={current:null},K={transition:null},D={ReactCurrentDispatcher:Y,ReactCurrentBatchConfig:K,ReactCurrentOwner:R};function z(){throw Error("act(...) is not supported in production builds of React.")}return De.Children={map:M,forEach:function(F,H,J){M(F,function(){H.apply(this,arguments)},J)},count:function(F){var H=0;return M(F,function(){H++}),H},toArray:function(F){return M(F,function(H){return H})||[]},only:function(F){if(!q(F))throw Error("React.Children.only expected to receive a single React element child.");return F}},De.Component=b,De.Fragment=n,De.Profiler=s,De.PureComponent=S,De.StrictMode=r,De.Suspense=d,De.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=D,De.act=z,De.cloneElement=function(F,H,J){if(F==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+F+".");var W=k({},F.props),G=F.key,X=F.ref,Z=F._owner;if(H!=null){if(H.ref!==void 0&&(X=H.ref,Z=R.current),H.key!==void 0&&(G=""+H.key),F.type&&F.type.defaultProps)var ee=F.type.defaultProps;for(re in H)T.call(H,re)&&!A.hasOwnProperty(re)&&(W[re]=H[re]===void 0&&ee!==void 0?ee[re]:H[re])}var re=arguments.length-2;if(re===1)W.children=J;else if(1<re){ee=Array(re);for(var ce=0;ce<re;ce++)ee[ce]=arguments[ce+2];W.children=ee}return{$$typeof:e,type:F.type,key:G,ref:X,props:W,_owner:Z}},De.createContext=function(F){return F={$$typeof:l,_currentValue:F,_currentValue2:F,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},F.Provider={$$typeof:i,_context:F},F.Consumer=F},De.createElement=U,De.createFactory=function(F){var H=U.bind(null,F);return H.type=F,H},De.createRef=function(){return{current:null}},De.forwardRef=function(F){return{$$typeof:u,render:F}},De.isValidElement=q,De.lazy=function(F){return{$$typeof:h,_payload:{_status:-1,_result:F},_init:L}},De.memo=function(F,H){return{$$typeof:f,type:F,compare:H===void 0?null:H}},De.startTransition=function(F){var H=K.transition;K.transition={};try{F()}finally{K.transition=H}},De.unstable_act=z,De.useCallback=function(F,H){return Y.current.useCallback(F,H)},De.useContext=function(F){return Y.current.useContext(F)},De.useDebugValue=function(){},De.useDeferredValue=function(F){return Y.current.useDeferredValue(F)},De.useEffect=function(F,H){return Y.current.useEffect(F,H)},De.useId=function(){return Y.current.useId()},De.useImperativeHandle=function(F,H,J){return Y.current.useImperativeHandle(F,H,J)},De.useInsertionEffect=function(F,H){return Y.current.useInsertionEffect(F,H)},De.useLayoutEffect=function(F,H){return Y.current.useLayoutEffect(F,H)},De.useMemo=function(F,H){return Y.current.useMemo(F,H)},De.useReducer=function(F,H,J){return Y.current.useReducer(F,H,J)},De.useRef=function(F){return Y.current.useRef(F)},De.useState=function(F){return Y.current.useState(F)},De.useSyncExternalStore=function(F,H,J){return Y.current.useSyncExternalStore(F,H,J)},De.useTransition=function(){return Y.current.useTransition()},De.version="18.3.1",De}var N1;function Pl(){return N1||(N1=1,Of.exports=VL()),Of.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 j1;function GL(){if(j1)return Xi;j1=1;var e=Pl(),t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,s=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function l(u,d,f){var h,p={},g=null,w=null;f!==void 0&&(g=""+f),d.key!==void 0&&(g=""+d.key),d.ref!==void 0&&(w=d.ref);for(h in d)r.call(d,h)&&!i.hasOwnProperty(h)&&(p[h]=d[h]);if(u&&u.defaultProps)for(h in d=u.defaultProps,d)p[h]===void 0&&(p[h]=d[h]);return{$$typeof:t,type:u,key:g,ref:w,props:p,_owner:s.current}}return Xi.Fragment=n,Xi.jsx=l,Xi.jsxs=l,Xi}var S1;function KL(){return S1||(S1=1,If.exports=GL()),If.exports}var a=KL(),ru={},Lf={exports:{}},an={},Pf={exports:{}},Df={};/**
|
|
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 _1;function YL(){return _1||(_1=1,(function(e){function t(K,D){var z=K.length;K.push(D);e:for(;0<z;){var F=z-1>>>1,H=K[F];if(0<s(H,D))K[F]=D,K[z]=H,z=F;else break e}}function n(K){return K.length===0?null:K[0]}function r(K){if(K.length===0)return null;var D=K[0],z=K.pop();if(z!==D){K[0]=z;e:for(var F=0,H=K.length,J=H>>>1;F<J;){var W=2*(F+1)-1,G=K[W],X=W+1,Z=K[X];if(0>s(G,z))X<H&&0>s(Z,G)?(K[F]=Z,K[X]=z,F=X):(K[F]=G,K[W]=z,F=W);else if(X<H&&0>s(Z,z))K[F]=Z,K[X]=z,F=X;else break e}}return D}function s(K,D){var z=K.sortIndex-D.sortIndex;return z!==0?z:K.id-D.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var l=Date,u=l.now();e.unstable_now=function(){return l.now()-u}}var d=[],f=[],h=1,p=null,g=3,w=!1,k=!1,x=!1,b=typeof setTimeout=="function"?setTimeout:null,j=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 _(K){for(var D=n(f);D!==null;){if(D.callback===null)r(f);else if(D.startTime<=K)r(f),D.sortIndex=D.expirationTime,t(d,D);else break;D=n(f)}}function E(K){if(x=!1,_(K),!k)if(n(d)!==null)k=!0,L(T);else{var D=n(f);D!==null&&Y(E,D.startTime-K)}}function T(K,D){k=!1,x&&(x=!1,j(U),U=-1),w=!0;var z=g;try{for(_(D),p=n(d);p!==null&&(!(p.expirationTime>D)||K&&!P());){var F=p.callback;if(typeof F=="function"){p.callback=null,g=p.priorityLevel;var H=F(p.expirationTime<=D);D=e.unstable_now(),typeof H=="function"?p.callback=H:p===n(d)&&r(d),_(D)}else r(d);p=n(d)}if(p!==null)var J=!0;else{var W=n(f);W!==null&&Y(E,W.startTime-D),J=!1}return J}finally{p=null,g=z,w=!1}}var R=!1,A=null,U=-1,I=5,q=-1;function P(){return!(e.unstable_now()-q<I)}function O(){if(A!==null){var K=e.unstable_now();q=K;var D=!0;try{D=A(!0,K)}finally{D?V():(R=!1,A=null)}}else R=!1}var V;if(typeof S=="function")V=function(){S(O)};else if(typeof MessageChannel<"u"){var $=new MessageChannel,M=$.port2;$.port1.onmessage=O,V=function(){M.postMessage(null)}}else V=function(){b(O,0)};function L(K){A=K,R||(R=!0,V())}function Y(K,D){U=b(function(){K(e.unstable_now())},D)}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(K){K.callback=null},e.unstable_continueExecution=function(){k||w||(k=!0,L(T))},e.unstable_forceFrameRate=function(K){0>K||125<K?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):I=0<K?Math.floor(1e3/K):5},e.unstable_getCurrentPriorityLevel=function(){return g},e.unstable_getFirstCallbackNode=function(){return n(d)},e.unstable_next=function(K){switch(g){case 1:case 2:case 3:var D=3;break;default:D=g}var z=g;g=D;try{return K()}finally{g=z}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(K,D){switch(K){case 1:case 2:case 3:case 4:case 5:break;default:K=3}var z=g;g=K;try{return D()}finally{g=z}},e.unstable_scheduleCallback=function(K,D,z){var F=e.unstable_now();switch(typeof z=="object"&&z!==null?(z=z.delay,z=typeof z=="number"&&0<z?F+z:F):z=F,K){case 1:var H=-1;break;case 2:H=250;break;case 5:H=1073741823;break;case 4:H=1e4;break;default:H=5e3}return H=z+H,K={id:h++,callback:D,priorityLevel:K,startTime:z,expirationTime:H,sortIndex:-1},z>F?(K.sortIndex=z,t(f,K),n(d)===null&&K===n(f)&&(x?(j(U),U=-1):x=!0,Y(E,z-F))):(K.sortIndex=H,t(d,K),k||w||(k=!0,L(T))),K},e.unstable_shouldYield=P,e.unstable_wrapCallback=function(K){var D=g;return function(){var z=g;g=D;try{return K.apply(this,arguments)}finally{g=z}}}})(Df)),Df}var E1;function XL(){return E1||(E1=1,Pf.exports=YL()),Pf.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 C1;function ZL(){if(C1)return an;C1=1;var e=Pl(),t=XL();function n(o){for(var c="https://reactjs.org/docs/error-decoder.html?invariant="+o,m=1;m<arguments.length;m++)c+="&args[]="+encodeURIComponent(arguments[m]);return"Minified React error #"+o+"; visit "+c+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var r=new Set,s={};function i(o,c){l(o,c),l(o+"Capture",c)}function l(o,c){for(s[o]=c,o=0;o<c.length;o++)r.add(c[o])}var u=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),d=Object.prototype.hasOwnProperty,f=/^[: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={},p={};function g(o){return d.call(p,o)?!0:d.call(h,o)?!1:f.test(o)?p[o]=!0:(h[o]=!0,!1)}function w(o,c,m,y){if(m!==null&&m.type===0)return!1;switch(typeof c){case"function":case"symbol":return!0;case"boolean":return y?!1:m!==null?!m.acceptsBooleans:(o=o.toLowerCase().slice(0,5),o!=="data-"&&o!=="aria-");default:return!1}}function k(o,c,m,y){if(c===null||typeof c>"u"||w(o,c,m,y))return!0;if(y)return!1;if(m!==null)switch(m.type){case 3:return!c;case 4:return c===!1;case 5:return isNaN(c);case 6:return isNaN(c)||1>c}return!1}function x(o,c,m,y,N,C,B){this.acceptsBooleans=c===2||c===3||c===4,this.attributeName=y,this.attributeNamespace=N,this.mustUseProperty=m,this.propertyName=o,this.type=c,this.sanitizeURL=C,this.removeEmptyString=B}var b={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(o){b[o]=new x(o,0,!1,o,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(o){var c=o[0];b[c]=new x(c,1,!1,o[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(o){b[o]=new x(o,2,!1,o.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(o){b[o]=new x(o,2,!1,o,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(o){b[o]=new x(o,3,!1,o.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(o){b[o]=new x(o,3,!0,o,null,!1,!1)}),["capture","download"].forEach(function(o){b[o]=new x(o,4,!1,o,null,!1,!1)}),["cols","rows","size","span"].forEach(function(o){b[o]=new x(o,6,!1,o,null,!1,!1)}),["rowSpan","start"].forEach(function(o){b[o]=new x(o,5,!1,o.toLowerCase(),null,!1,!1)});var j=/[\-:]([a-z])/g;function S(o){return o[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(o){var c=o.replace(j,S);b[c]=new x(c,1,!1,o,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(o){var c=o.replace(j,S);b[c]=new x(c,1,!1,o,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(o){var c=o.replace(j,S);b[c]=new x(c,1,!1,o,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(o){b[o]=new x(o,1,!1,o.toLowerCase(),null,!1,!1)}),b.xlinkHref=new x("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(o){b[o]=new x(o,1,!1,o.toLowerCase(),null,!0,!0)});function _(o,c,m,y){var N=b.hasOwnProperty(c)?b[c]:null;(N!==null?N.type!==0:y||!(2<c.length)||c[0]!=="o"&&c[0]!=="O"||c[1]!=="n"&&c[1]!=="N")&&(k(c,m,N,y)&&(m=null),y||N===null?g(c)&&(m===null?o.removeAttribute(c):o.setAttribute(c,""+m)):N.mustUseProperty?o[N.propertyName]=m===null?N.type===3?!1:"":m:(c=N.attributeName,y=N.attributeNamespace,m===null?o.removeAttribute(c):(N=N.type,m=N===3||N===4&&m===!0?"":""+m,y?o.setAttributeNS(y,c,m):o.setAttribute(c,m))))}var E=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"),U=Symbol.for("react.strict_mode"),I=Symbol.for("react.profiler"),q=Symbol.for("react.provider"),P=Symbol.for("react.context"),O=Symbol.for("react.forward_ref"),V=Symbol.for("react.suspense"),$=Symbol.for("react.suspense_list"),M=Symbol.for("react.memo"),L=Symbol.for("react.lazy"),Y=Symbol.for("react.offscreen"),K=Symbol.iterator;function D(o){return o===null||typeof o!="object"?null:(o=K&&o[K]||o["@@iterator"],typeof o=="function"?o:null)}var z=Object.assign,F;function H(o){if(F===void 0)try{throw Error()}catch(m){var c=m.stack.trim().match(/\n( *(at )?)/);F=c&&c[1]||""}return`
|
|
34
|
-
`+F+o}var J=!1;function W(o,c){if(!o||J)return"";J=!0;var m=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(c)if(c=function(){throw Error()},Object.defineProperty(c.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(c,[])}catch(le){var y=le}Reflect.construct(o,[],c)}else{try{c.call()}catch(le){y=le}o.call(c.prototype)}else{try{throw Error()}catch(le){y=le}o()}}catch(le){if(le&&y&&typeof le.stack=="string"){for(var N=le.stack.split(`
|
|
35
|
-
`),C=y.stack.split(`
|
|
36
|
-
`),B=N.length-1,Q=C.length-1;1<=B&&0<=Q&&N[B]!==C[Q];)Q--;for(;1<=B&&0<=Q;B--,Q--)if(N[B]!==C[Q]){if(B!==1||Q!==1)do if(B--,Q--,0>Q||N[B]!==C[Q]){var te=`
|
|
37
|
-
`+N[B].replace(" at new "," at ");return o.displayName&&te.includes("<anonymous>")&&(te=te.replace("<anonymous>",o.displayName)),te}while(1<=B&&0<=Q);break}}}finally{J=!1,Error.prepareStackTrace=m}return(o=o?o.displayName||o.name:"")?H(o):""}function G(o){switch(o.tag){case 5:return H(o.type);case 16:return H("Lazy");case 13:return H("Suspense");case 19:return H("SuspenseList");case 0:case 2:case 15:return o=W(o.type,!1),o;case 11:return o=W(o.type.render,!1),o;case 1:return o=W(o.type,!0),o;default:return""}}function X(o){if(o==null)return null;if(typeof o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case A:return"Fragment";case R:return"Portal";case I:return"Profiler";case U:return"StrictMode";case V:return"Suspense";case $:return"SuspenseList"}if(typeof o=="object")switch(o.$$typeof){case P:return(o.displayName||"Context")+".Consumer";case q:return(o._context.displayName||"Context")+".Provider";case O:var c=o.render;return o=o.displayName,o||(o=c.displayName||c.name||"",o=o!==""?"ForwardRef("+o+")":"ForwardRef"),o;case M:return c=o.displayName||null,c!==null?c:X(o.type)||"Memo";case L:c=o._payload,o=o._init;try{return X(o(c))}catch{}}return null}function Z(o){var c=o.type;switch(o.tag){case 24:return"Cache";case 9:return(c.displayName||"Context")+".Consumer";case 10:return(c._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return o=c.render,o=o.displayName||o.name||"",c.displayName||(o!==""?"ForwardRef("+o+")":"ForwardRef");case 7:return"Fragment";case 5:return c;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return X(c);case 8:return c===U?"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 c=="function")return c.displayName||c.name||null;if(typeof c=="string")return c}return null}function ee(o){switch(typeof o){case"boolean":case"number":case"string":case"undefined":return o;case"object":return o;default:return""}}function re(o){var c=o.type;return(o=o.nodeName)&&o.toLowerCase()==="input"&&(c==="checkbox"||c==="radio")}function ce(o){var c=re(o)?"checked":"value",m=Object.getOwnPropertyDescriptor(o.constructor.prototype,c),y=""+o[c];if(!o.hasOwnProperty(c)&&typeof m<"u"&&typeof m.get=="function"&&typeof m.set=="function"){var N=m.get,C=m.set;return Object.defineProperty(o,c,{configurable:!0,get:function(){return N.call(this)},set:function(B){y=""+B,C.call(this,B)}}),Object.defineProperty(o,c,{enumerable:m.enumerable}),{getValue:function(){return y},setValue:function(B){y=""+B},stopTracking:function(){o._valueTracker=null,delete o[c]}}}}function ie(o){o._valueTracker||(o._valueTracker=ce(o))}function fe(o){if(!o)return!1;var c=o._valueTracker;if(!c)return!0;var m=c.getValue(),y="";return o&&(y=re(o)?o.checked?"true":"false":o.value),o=y,o!==m?(c.setValue(o),!0):!1}function de(o){if(o=o||(typeof document<"u"?document:void 0),typeof o>"u")return null;try{return o.activeElement||o.body}catch{return o.body}}function we(o,c){var m=c.checked;return z({},c,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:m??o._wrapperState.initialChecked})}function xe(o,c){var m=c.defaultValue==null?"":c.defaultValue,y=c.checked!=null?c.checked:c.defaultChecked;m=ee(c.value!=null?c.value:m),o._wrapperState={initialChecked:y,initialValue:m,controlled:c.type==="checkbox"||c.type==="radio"?c.checked!=null:c.value!=null}}function $e(o,c){c=c.checked,c!=null&&_(o,"checked",c,!1)}function be(o,c){$e(o,c);var m=ee(c.value),y=c.type;if(m!=null)y==="number"?(m===0&&o.value===""||o.value!=m)&&(o.value=""+m):o.value!==""+m&&(o.value=""+m);else if(y==="submit"||y==="reset"){o.removeAttribute("value");return}c.hasOwnProperty("value")?se(o,c.type,m):c.hasOwnProperty("defaultValue")&&se(o,c.type,ee(c.defaultValue)),c.checked==null&&c.defaultChecked!=null&&(o.defaultChecked=!!c.defaultChecked)}function he(o,c,m){if(c.hasOwnProperty("value")||c.hasOwnProperty("defaultValue")){var y=c.type;if(!(y!=="submit"&&y!=="reset"||c.value!==void 0&&c.value!==null))return;c=""+o._wrapperState.initialValue,m||c===o.value||(o.value=c),o.defaultValue=c}m=o.name,m!==""&&(o.name=""),o.defaultChecked=!!o._wrapperState.initialChecked,m!==""&&(o.name=m)}function se(o,c,m){(c!=="number"||de(o.ownerDocument)!==o)&&(m==null?o.defaultValue=""+o._wrapperState.initialValue:o.defaultValue!==""+m&&(o.defaultValue=""+m))}var ke=Array.isArray;function Ce(o,c,m,y){if(o=o.options,c){c={};for(var N=0;N<m.length;N++)c["$"+m[N]]=!0;for(m=0;m<o.length;m++)N=c.hasOwnProperty("$"+o[m].value),o[m].selected!==N&&(o[m].selected=N),N&&y&&(o[m].defaultSelected=!0)}else{for(m=""+ee(m),c=null,N=0;N<o.length;N++){if(o[N].value===m){o[N].selected=!0,y&&(o[N].defaultSelected=!0);return}c!==null||o[N].disabled||(c=o[N])}c!==null&&(c.selected=!0)}}function Oe(o,c){if(c.dangerouslySetInnerHTML!=null)throw Error(n(91));return z({},c,{value:void 0,defaultValue:void 0,children:""+o._wrapperState.initialValue})}function Le(o,c){var m=c.value;if(m==null){if(m=c.children,c=c.defaultValue,m!=null){if(c!=null)throw Error(n(92));if(ke(m)){if(1<m.length)throw Error(n(93));m=m[0]}c=m}c==null&&(c=""),m=c}o._wrapperState={initialValue:ee(m)}}function Pe(o,c){var m=ee(c.value),y=ee(c.defaultValue);m!=null&&(m=""+m,m!==o.value&&(o.value=m),c.defaultValue==null&&o.defaultValue!==m&&(o.defaultValue=m)),y!=null&&(o.defaultValue=""+y)}function qe(o){var c=o.textContent;c===o._wrapperState.initialValue&&c!==""&&c!==null&&(o.value=c)}function Ue(o){switch(o){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 et(o,c){return o==null||o==="http://www.w3.org/1999/xhtml"?Ue(c):o==="http://www.w3.org/2000/svg"&&c==="foreignObject"?"http://www.w3.org/1999/xhtml":o}var ze,at=(function(o){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(c,m,y,N){MSApp.execUnsafeLocalFunction(function(){return o(c,m,y,N)})}:o})(function(o,c){if(o.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in o)o.innerHTML=c;else{for(ze=ze||document.createElement("div"),ze.innerHTML="<svg>"+c.valueOf().toString()+"</svg>",c=ze.firstChild;o.firstChild;)o.removeChild(o.firstChild);for(;c.firstChild;)o.appendChild(c.firstChild)}});function gt(o,c){if(c){var m=o.firstChild;if(m&&m===o.lastChild&&m.nodeType===3){m.nodeValue=c;return}}o.textContent=c}var Ie={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},ot=["Webkit","ms","Moz","O"];Object.keys(Ie).forEach(function(o){ot.forEach(function(c){c=c+o.charAt(0).toUpperCase()+o.substring(1),Ie[c]=Ie[o]})});function Je(o,c,m){return c==null||typeof c=="boolean"||c===""?"":m||typeof c!="number"||c===0||Ie.hasOwnProperty(o)&&Ie[o]?(""+c).trim():c+"px"}function it(o,c){o=o.style;for(var m in c)if(c.hasOwnProperty(m)){var y=m.indexOf("--")===0,N=Je(m,c[m],y);m==="float"&&(m="cssFloat"),y?o.setProperty(m,N):o[m]=N}}var Ft=z({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 kt(o,c){if(c){if(Ft[o]&&(c.children!=null||c.dangerouslySetInnerHTML!=null))throw Error(n(137,o));if(c.dangerouslySetInnerHTML!=null){if(c.children!=null)throw Error(n(60));if(typeof c.dangerouslySetInnerHTML!="object"||!("__html"in c.dangerouslySetInnerHTML))throw Error(n(61))}if(c.style!=null&&typeof c.style!="object")throw Error(n(62))}}function Nt(o,c){if(o.indexOf("-")===-1)return typeof c.is=="string";switch(o){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 qt=null;function kn(o){return o=o.target||o.srcElement||window,o.correspondingUseElement&&(o=o.correspondingUseElement),o.nodeType===3?o.parentNode:o}var Gt=null,Bt=null,dn=null;function Kt(o){if(o=Oi(o)){if(typeof Gt!="function")throw Error(n(280));var c=o.stateNode;c&&(c=yc(c),Gt(o.stateNode,o.type,c))}}function as(o){Bt?dn?dn.push(o):dn=[o]:Bt=o}function $r(){if(Bt){var o=Bt,c=dn;if(dn=Bt=null,Kt(o),c)for(o=0;o<c.length;o++)Kt(c[o])}}function os(o,c){return o(c)}function ur(){}var Bn=!1;function is(o,c,m){if(Bn)return o(c,m);Bn=!0;try{return os(o,c,m)}finally{Bn=!1,(Bt!==null||dn!==null)&&(ur(),$r())}}function Nn(o,c){var m=o.stateNode;if(m===null)return null;var y=yc(m);if(y===null)return null;m=y[c];e:switch(c){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(y=!y.disabled)||(o=o.type,y=!(o==="button"||o==="input"||o==="select"||o==="textarea")),o=!y;break e;default:o=!1}if(o)return null;if(m&&typeof m!="function")throw Error(n(231,c,typeof m));return m}var dr=!1;if(u)try{var hn={};Object.defineProperty(hn,"passive",{get:function(){dr=!0}}),window.addEventListener("test",hn,hn),window.removeEventListener("test",hn,hn)}catch{dr=!1}function ls(o,c,m,y,N,C,B,Q,te){var le=Array.prototype.slice.call(arguments,3);try{c.apply(m,le)}catch(me){this.onError(me)}}var jn=!1,yt=null,Un=!1,ge=null,He={onError:function(o){jn=!0,yt=o}};function Ze(o,c,m,y,N,C,B,Q,te){jn=!1,yt=null,ls.apply(He,arguments)}function fn(o,c,m,y,N,C,B,Q,te){if(Ze.apply(this,arguments),jn){if(jn){var le=yt;jn=!1,yt=null}else throw Error(n(198));Un||(Un=!0,ge=le)}}function Ut(o){var c=o,m=o;if(o.alternate)for(;c.return;)c=c.return;else{o=c;do c=o,(c.flags&4098)!==0&&(m=c.return),o=c.return;while(o)}return c.tag===3?m:null}function hr(o){if(o.tag===13){var c=o.memoizedState;if(c===null&&(o=o.alternate,o!==null&&(c=o.memoizedState)),c!==null)return c.dehydrated}return null}function Xs(o){if(Ut(o)!==o)throw Error(n(188))}function cs(o){var c=o.alternate;if(!c){if(c=Ut(o),c===null)throw Error(n(188));return c!==o?null:o}for(var m=o,y=c;;){var N=m.return;if(N===null)break;var C=N.alternate;if(C===null){if(y=N.return,y!==null){m=y;continue}break}if(N.child===C.child){for(C=N.child;C;){if(C===m)return Xs(N),o;if(C===y)return Xs(N),c;C=C.sibling}throw Error(n(188))}if(m.return!==y.return)m=N,y=C;else{for(var B=!1,Q=N.child;Q;){if(Q===m){B=!0,m=N,y=C;break}if(Q===y){B=!0,y=N,m=C;break}Q=Q.sibling}if(!B){for(Q=C.child;Q;){if(Q===m){B=!0,m=C,y=N;break}if(Q===y){B=!0,y=C,m=N;break}Q=Q.sibling}if(!B)throw Error(n(189))}}if(m.alternate!==y)throw Error(n(190))}if(m.tag!==3)throw Error(n(188));return m.stateNode.current===m?o:c}function zn(o){return o=cs(o),o!==null?Va(o):null}function Va(o){if(o.tag===5||o.tag===6)return o;for(o=o.child;o!==null;){var c=Va(o);if(c!==null)return c;o=o.sibling}return null}var Ga=t.unstable_scheduleCallback,fr=t.unstable_cancelCallback,Ka=t.unstable_shouldYield,Ya=t.unstable_requestPaint,Ye=t.unstable_now,us=t.unstable_getCurrentPriorityLevel,pr=t.unstable_ImmediatePriority,Xa=t.unstable_UserBlockingPriority,ds=t.unstable_NormalPriority,Zs=t.unstable_LowPriority,Js=t.unstable_IdlePriority,hs=null,Yt=null;function fs(o){if(Yt&&typeof Yt.onCommitFiberRoot=="function")try{Yt.onCommitFiberRoot(hs,o,void 0,(o.current.flags&128)===128)}catch{}}var jt=Math.clz32?Math.clz32:Zl,oh=Math.log,ih=Math.LN2;function Zl(o){return o>>>=0,o===0?32:31-(oh(o)/ih|0)|0}var Qs=64,ps=4194304;function Ir(o){switch(o&-o){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 o&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return o&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return o}}function Sn(o,c){var m=o.pendingLanes;if(m===0)return 0;var y=0,N=o.suspendedLanes,C=o.pingedLanes,B=m&268435455;if(B!==0){var Q=B&~N;Q!==0?y=Ir(Q):(C&=B,C!==0&&(y=Ir(C)))}else B=m&~N,B!==0?y=Ir(B):C!==0&&(y=Ir(C));if(y===0)return 0;if(c!==0&&c!==y&&(c&N)===0&&(N=y&-y,C=c&-c,N>=C||N===16&&(C&4194240)!==0))return c;if((y&4)!==0&&(y|=m&16),c=o.entangledLanes,c!==0)for(o=o.entanglements,c&=y;0<c;)m=31-jt(c),N=1<<m,y|=o[m],c&=~N;return y}function lh(o,c){switch(o){case 1:case 2:case 4:return c+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 c+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 ch(o,c){for(var m=o.suspendedLanes,y=o.pingedLanes,N=o.expirationTimes,C=o.pendingLanes;0<C;){var B=31-jt(C),Q=1<<B,te=N[B];te===-1?((Q&m)===0||(Q&y)!==0)&&(N[B]=lh(Q,c)):te<=c&&(o.expiredLanes|=Q),C&=~Q}}function gi(o){return o=o.pendingLanes&-1073741825,o!==0?o:o&1073741824?1073741824:0}function yi(){var o=Qs;return Qs<<=1,(Qs&4194240)===0&&(Qs=64),o}function mr(o){for(var c=[],m=0;31>m;m++)c.push(o);return c}function ea(o,c,m){o.pendingLanes|=c,c!==536870912&&(o.suspendedLanes=0,o.pingedLanes=0),o=o.eventTimes,c=31-jt(c),o[c]=m}function Jl(o,c){var m=o.pendingLanes&~c;o.pendingLanes=c,o.suspendedLanes=0,o.pingedLanes=0,o.expiredLanes&=c,o.mutableReadLanes&=c,o.entangledLanes&=c,c=o.entanglements;var y=o.eventTimes;for(o=o.expirationTimes;0<m;){var N=31-jt(m),C=1<<N;c[N]=0,y[N]=-1,o[N]=-1,m&=~C}}function Za(o,c){var m=o.entangledLanes|=c;for(o=o.entanglements;m;){var y=31-jt(m),N=1<<y;N&c|o[y]&c&&(o[y]|=c),m&=~N}}var We=0;function Ql(o){return o&=-o,1<o?4<o?(o&268435455)!==0?16:536870912:4:1}var ec,ta,wi,tc,nc,vi=!1,ms=[],gr=null,Hn=null,yr=null,na=new Map,ra=new Map,Wn=[],uh="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 rc(o,c){switch(o){case"focusin":case"focusout":gr=null;break;case"dragenter":case"dragleave":Hn=null;break;case"mouseover":case"mouseout":yr=null;break;case"pointerover":case"pointerout":na.delete(c.pointerId);break;case"gotpointercapture":case"lostpointercapture":ra.delete(c.pointerId)}}function gs(o,c,m,y,N,C){return o===null||o.nativeEvent!==C?(o={blockedOn:c,domEventName:m,eventSystemFlags:y,nativeEvent:C,targetContainers:[N]},c!==null&&(c=Oi(c),c!==null&&ta(c)),o):(o.eventSystemFlags|=y,c=o.targetContainers,N!==null&&c.indexOf(N)===-1&&c.push(N),o)}function sa(o,c,m,y,N){switch(c){case"focusin":return gr=gs(gr,o,c,m,y,N),!0;case"dragenter":return Hn=gs(Hn,o,c,m,y,N),!0;case"mouseover":return yr=gs(yr,o,c,m,y,N),!0;case"pointerover":var C=N.pointerId;return na.set(C,gs(na.get(C)||null,o,c,m,y,N)),!0;case"gotpointercapture":return C=N.pointerId,ra.set(C,gs(ra.get(C)||null,o,c,m,y,N)),!0}return!1}function xi(o){var c=ca(o.target);if(c!==null){var m=Ut(c);if(m!==null){if(c=m.tag,c===13){if(c=hr(m),c!==null){o.blockedOn=c,nc(o.priority,function(){wi(m)});return}}else if(c===3&&m.stateNode.current.memoizedState.isDehydrated){o.blockedOn=m.tag===3?m.stateNode.containerInfo:null;return}}}o.blockedOn=null}function aa(o){if(o.blockedOn!==null)return!1;for(var c=o.targetContainers;0<c.length;){var m=oa(o.domEventName,o.eventSystemFlags,c[0],o.nativeEvent);if(m===null){m=o.nativeEvent;var y=new m.constructor(m.type,m);qt=y,m.target.dispatchEvent(y),qt=null}else return c=Oi(m),c!==null&&ta(c),o.blockedOn=m,!1;c.shift()}return!0}function bi(o,c,m){aa(o)&&m.delete(c)}function sc(){vi=!1,gr!==null&&aa(gr)&&(gr=null),Hn!==null&&aa(Hn)&&(Hn=null),yr!==null&&aa(yr)&&(yr=null),na.forEach(bi),ra.forEach(bi)}function ys(o,c){o.blockedOn===c&&(o.blockedOn=null,vi||(vi=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,sc)))}function Or(o){function c(N){return ys(N,o)}if(0<ms.length){ys(ms[0],o);for(var m=1;m<ms.length;m++){var y=ms[m];y.blockedOn===o&&(y.blockedOn=null)}}for(gr!==null&&ys(gr,o),Hn!==null&&ys(Hn,o),yr!==null&&ys(yr,o),na.forEach(c),ra.forEach(c),m=0;m<Wn.length;m++)y=Wn[m],y.blockedOn===o&&(y.blockedOn=null);for(;0<Wn.length&&(m=Wn[0],m.blockedOn===null);)xi(m),m.blockedOn===null&&Wn.shift()}var ws=E.ReactCurrentBatchConfig,vs=!0;function ac(o,c,m,y){var N=We,C=ws.transition;ws.transition=null;try{We=1,ki(o,c,m,y)}finally{We=N,ws.transition=C}}function oc(o,c,m,y){var N=We,C=ws.transition;ws.transition=null;try{We=4,ki(o,c,m,y)}finally{We=N,ws.transition=C}}function ki(o,c,m,y){if(vs){var N=oa(o,c,m,y);if(N===null)Nh(o,c,y,Ja,m),rc(o,y);else if(sa(N,o,c,m,y))y.stopPropagation();else if(rc(o,y),c&4&&-1<uh.indexOf(o)){for(;N!==null;){var C=Oi(N);if(C!==null&&ec(C),C=oa(o,c,m,y),C===null&&Nh(o,c,y,Ja,m),C===N)break;N=C}N!==null&&y.stopPropagation()}else Nh(o,c,y,null,m)}}var Ja=null;function oa(o,c,m,y){if(Ja=null,o=kn(y),o=ca(o),o!==null)if(c=Ut(o),c===null)o=null;else if(m=c.tag,m===13){if(o=hr(c),o!==null)return o;o=null}else if(m===3){if(c.stateNode.current.memoizedState.isDehydrated)return c.tag===3?c.stateNode.containerInfo:null;o=null}else c!==o&&(o=null);return Ja=o,null}function ia(o){switch(o){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(us()){case pr:return 1;case Xa:return 4;case ds:case Zs:return 16;case Js:return 536870912;default:return 16}default:return 16}}var wr=null,Lr=null,Qa=null;function ic(){if(Qa)return Qa;var o,c=Lr,m=c.length,y,N="value"in wr?wr.value:wr.textContent,C=N.length;for(o=0;o<m&&c[o]===N[o];o++);var B=m-o;for(y=1;y<=B&&c[m-y]===N[C-y];y++);return Qa=N.slice(o,1<y?1-y:void 0)}function eo(o){var c=o.keyCode;return"charCode"in o?(o=o.charCode,o===0&&c===13&&(o=13)):o=c,o===10&&(o=13),32<=o||o===13?o:0}function la(){return!0}function lc(){return!1}function Xt(o){function c(m,y,N,C,B){this._reactName=m,this._targetInst=N,this.type=y,this.nativeEvent=C,this.target=B,this.currentTarget=null;for(var Q in o)o.hasOwnProperty(Q)&&(m=o[Q],this[Q]=m?m(C):C[Q]);return this.isDefaultPrevented=(C.defaultPrevented!=null?C.defaultPrevented:C.returnValue===!1)?la:lc,this.isPropagationStopped=lc,this}return z(c.prototype,{preventDefault:function(){this.defaultPrevented=!0;var m=this.nativeEvent;m&&(m.preventDefault?m.preventDefault():typeof m.returnValue!="unknown"&&(m.returnValue=!1),this.isDefaultPrevented=la)},stopPropagation:function(){var m=this.nativeEvent;m&&(m.stopPropagation?m.stopPropagation():typeof m.cancelBubble!="unknown"&&(m.cancelBubble=!0),this.isPropagationStopped=la)},persist:function(){},isPersistent:la}),c}var Pr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(o){return o.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Dr=Xt(Pr),xs=z({},Pr,{view:0,detail:0}),Ni=Xt(xs),ji,Fr,Si,cc=z({},xs,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:hh,button:0,buttons:0,relatedTarget:function(o){return o.relatedTarget===void 0?o.fromElement===o.srcElement?o.toElement:o.fromElement:o.relatedTarget},movementX:function(o){return"movementX"in o?o.movementX:(o!==Si&&(Si&&o.type==="mousemove"?(ji=o.screenX-Si.screenX,Fr=o.screenY-Si.screenY):Fr=ji=0,Si=o),ji)},movementY:function(o){return"movementY"in o?o.movementY:Fr}}),db=Xt(cc),xO=z({},cc,{dataTransfer:0}),bO=Xt(xO),kO=z({},xs,{relatedTarget:0}),dh=Xt(kO),NO=z({},Pr,{animationName:0,elapsedTime:0,pseudoElement:0}),jO=Xt(NO),SO=z({},Pr,{clipboardData:function(o){return"clipboardData"in o?o.clipboardData:window.clipboardData}}),_O=Xt(SO),EO=z({},Pr,{data:0}),hb=Xt(EO),CO={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},TO={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"},RO={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function AO(o){var c=this.nativeEvent;return c.getModifierState?c.getModifierState(o):(o=RO[o])?!!c[o]:!1}function hh(){return AO}var MO=z({},xs,{key:function(o){if(o.key){var c=CO[o.key]||o.key;if(c!=="Unidentified")return c}return o.type==="keypress"?(o=eo(o),o===13?"Enter":String.fromCharCode(o)):o.type==="keydown"||o.type==="keyup"?TO[o.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:hh,charCode:function(o){return o.type==="keypress"?eo(o):0},keyCode:function(o){return o.type==="keydown"||o.type==="keyup"?o.keyCode:0},which:function(o){return o.type==="keypress"?eo(o):o.type==="keydown"||o.type==="keyup"?o.keyCode:0}}),$O=Xt(MO),IO=z({},cc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),fb=Xt(IO),OO=z({},xs,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:hh}),LO=Xt(OO),PO=z({},Pr,{propertyName:0,elapsedTime:0,pseudoElement:0}),DO=Xt(PO),FO=z({},cc,{deltaX:function(o){return"deltaX"in o?o.deltaX:"wheelDeltaX"in o?-o.wheelDeltaX:0},deltaY:function(o){return"deltaY"in o?o.deltaY:"wheelDeltaY"in o?-o.wheelDeltaY:"wheelDelta"in o?-o.wheelDelta:0},deltaZ:0,deltaMode:0}),qO=Xt(FO),BO=[9,13,27,32],fh=u&&"CompositionEvent"in window,_i=null;u&&"documentMode"in document&&(_i=document.documentMode);var UO=u&&"TextEvent"in window&&!_i,pb=u&&(!fh||_i&&8<_i&&11>=_i),mb=" ",gb=!1;function yb(o,c){switch(o){case"keyup":return BO.indexOf(c.keyCode)!==-1;case"keydown":return c.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function wb(o){return o=o.detail,typeof o=="object"&&"data"in o?o.data:null}var to=!1;function zO(o,c){switch(o){case"compositionend":return wb(c);case"keypress":return c.which!==32?null:(gb=!0,mb);case"textInput":return o=c.data,o===mb&&gb?null:o;default:return null}}function HO(o,c){if(to)return o==="compositionend"||!fh&&yb(o,c)?(o=ic(),Qa=Lr=wr=null,to=!1,o):null;switch(o){case"paste":return null;case"keypress":if(!(c.ctrlKey||c.altKey||c.metaKey)||c.ctrlKey&&c.altKey){if(c.char&&1<c.char.length)return c.char;if(c.which)return String.fromCharCode(c.which)}return null;case"compositionend":return pb&&c.locale!=="ko"?null:c.data;default:return null}}var WO={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 vb(o){var c=o&&o.nodeName&&o.nodeName.toLowerCase();return c==="input"?!!WO[o.type]:c==="textarea"}function xb(o,c,m,y){as(y),c=pc(c,"onChange"),0<c.length&&(m=new Dr("onChange","change",null,m,y),o.push({event:m,listeners:c}))}var Ei=null,Ci=null;function VO(o){Db(o,0)}function uc(o){var c=oo(o);if(fe(c))return o}function GO(o,c){if(o==="change")return c}var bb=!1;if(u){var ph;if(u){var mh="oninput"in document;if(!mh){var kb=document.createElement("div");kb.setAttribute("oninput","return;"),mh=typeof kb.oninput=="function"}ph=mh}else ph=!1;bb=ph&&(!document.documentMode||9<document.documentMode)}function Nb(){Ei&&(Ei.detachEvent("onpropertychange",jb),Ci=Ei=null)}function jb(o){if(o.propertyName==="value"&&uc(Ci)){var c=[];xb(c,Ci,o,kn(o)),is(VO,c)}}function KO(o,c,m){o==="focusin"?(Nb(),Ei=c,Ci=m,Ei.attachEvent("onpropertychange",jb)):o==="focusout"&&Nb()}function YO(o){if(o==="selectionchange"||o==="keyup"||o==="keydown")return uc(Ci)}function XO(o,c){if(o==="click")return uc(c)}function ZO(o,c){if(o==="input"||o==="change")return uc(c)}function JO(o,c){return o===c&&(o!==0||1/o===1/c)||o!==o&&c!==c}var Vn=typeof Object.is=="function"?Object.is:JO;function Ti(o,c){if(Vn(o,c))return!0;if(typeof o!="object"||o===null||typeof c!="object"||c===null)return!1;var m=Object.keys(o),y=Object.keys(c);if(m.length!==y.length)return!1;for(y=0;y<m.length;y++){var N=m[y];if(!d.call(c,N)||!Vn(o[N],c[N]))return!1}return!0}function Sb(o){for(;o&&o.firstChild;)o=o.firstChild;return o}function _b(o,c){var m=Sb(o);o=0;for(var y;m;){if(m.nodeType===3){if(y=o+m.textContent.length,o<=c&&y>=c)return{node:m,offset:c-o};o=y}e:{for(;m;){if(m.nextSibling){m=m.nextSibling;break e}m=m.parentNode}m=void 0}m=Sb(m)}}function Eb(o,c){return o&&c?o===c?!0:o&&o.nodeType===3?!1:c&&c.nodeType===3?Eb(o,c.parentNode):"contains"in o?o.contains(c):o.compareDocumentPosition?!!(o.compareDocumentPosition(c)&16):!1:!1}function Cb(){for(var o=window,c=de();c instanceof o.HTMLIFrameElement;){try{var m=typeof c.contentWindow.location.href=="string"}catch{m=!1}if(m)o=c.contentWindow;else break;c=de(o.document)}return c}function gh(o){var c=o&&o.nodeName&&o.nodeName.toLowerCase();return c&&(c==="input"&&(o.type==="text"||o.type==="search"||o.type==="tel"||o.type==="url"||o.type==="password")||c==="textarea"||o.contentEditable==="true")}function QO(o){var c=Cb(),m=o.focusedElem,y=o.selectionRange;if(c!==m&&m&&m.ownerDocument&&Eb(m.ownerDocument.documentElement,m)){if(y!==null&&gh(m)){if(c=y.start,o=y.end,o===void 0&&(o=c),"selectionStart"in m)m.selectionStart=c,m.selectionEnd=Math.min(o,m.value.length);else if(o=(c=m.ownerDocument||document)&&c.defaultView||window,o.getSelection){o=o.getSelection();var N=m.textContent.length,C=Math.min(y.start,N);y=y.end===void 0?C:Math.min(y.end,N),!o.extend&&C>y&&(N=y,y=C,C=N),N=_b(m,C);var B=_b(m,y);N&&B&&(o.rangeCount!==1||o.anchorNode!==N.node||o.anchorOffset!==N.offset||o.focusNode!==B.node||o.focusOffset!==B.offset)&&(c=c.createRange(),c.setStart(N.node,N.offset),o.removeAllRanges(),C>y?(o.addRange(c),o.extend(B.node,B.offset)):(c.setEnd(B.node,B.offset),o.addRange(c)))}}for(c=[],o=m;o=o.parentNode;)o.nodeType===1&&c.push({element:o,left:o.scrollLeft,top:o.scrollTop});for(typeof m.focus=="function"&&m.focus(),m=0;m<c.length;m++)o=c[m],o.element.scrollLeft=o.left,o.element.scrollTop=o.top}}var eL=u&&"documentMode"in document&&11>=document.documentMode,no=null,yh=null,Ri=null,wh=!1;function Tb(o,c,m){var y=m.window===m?m.document:m.nodeType===9?m:m.ownerDocument;wh||no==null||no!==de(y)||(y=no,"selectionStart"in y&&gh(y)?y={start:y.selectionStart,end:y.selectionEnd}:(y=(y.ownerDocument&&y.ownerDocument.defaultView||window).getSelection(),y={anchorNode:y.anchorNode,anchorOffset:y.anchorOffset,focusNode:y.focusNode,focusOffset:y.focusOffset}),Ri&&Ti(Ri,y)||(Ri=y,y=pc(yh,"onSelect"),0<y.length&&(c=new Dr("onSelect","select",null,c,m),o.push({event:c,listeners:y}),c.target=no)))}function dc(o,c){var m={};return m[o.toLowerCase()]=c.toLowerCase(),m["Webkit"+o]="webkit"+c,m["Moz"+o]="moz"+c,m}var ro={animationend:dc("Animation","AnimationEnd"),animationiteration:dc("Animation","AnimationIteration"),animationstart:dc("Animation","AnimationStart"),transitionend:dc("Transition","TransitionEnd")},vh={},Rb={};u&&(Rb=document.createElement("div").style,"AnimationEvent"in window||(delete ro.animationend.animation,delete ro.animationiteration.animation,delete ro.animationstart.animation),"TransitionEvent"in window||delete ro.transitionend.transition);function hc(o){if(vh[o])return vh[o];if(!ro[o])return o;var c=ro[o],m;for(m in c)if(c.hasOwnProperty(m)&&m in Rb)return vh[o]=c[m];return o}var Ab=hc("animationend"),Mb=hc("animationiteration"),$b=hc("animationstart"),Ib=hc("transitionend"),Ob=new Map,Lb="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 bs(o,c){Ob.set(o,c),i(c,[o])}for(var xh=0;xh<Lb.length;xh++){var bh=Lb[xh],tL=bh.toLowerCase(),nL=bh[0].toUpperCase()+bh.slice(1);bs(tL,"on"+nL)}bs(Ab,"onAnimationEnd"),bs(Mb,"onAnimationIteration"),bs($b,"onAnimationStart"),bs("dblclick","onDoubleClick"),bs("focusin","onFocus"),bs("focusout","onBlur"),bs(Ib,"onTransitionEnd"),l("onMouseEnter",["mouseout","mouseover"]),l("onMouseLeave",["mouseout","mouseover"]),l("onPointerEnter",["pointerout","pointerover"]),l("onPointerLeave",["pointerout","pointerover"]),i("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),i("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),i("onBeforeInput",["compositionend","keypress","textInput","paste"]),i("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),i("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),i("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ai="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(" "),rL=new Set("cancel close invalid load scroll toggle".split(" ").concat(Ai));function Pb(o,c,m){var y=o.type||"unknown-event";o.currentTarget=m,fn(y,c,void 0,o),o.currentTarget=null}function Db(o,c){c=(c&4)!==0;for(var m=0;m<o.length;m++){var y=o[m],N=y.event;y=y.listeners;e:{var C=void 0;if(c)for(var B=y.length-1;0<=B;B--){var Q=y[B],te=Q.instance,le=Q.currentTarget;if(Q=Q.listener,te!==C&&N.isPropagationStopped())break e;Pb(N,Q,le),C=te}else for(B=0;B<y.length;B++){if(Q=y[B],te=Q.instance,le=Q.currentTarget,Q=Q.listener,te!==C&&N.isPropagationStopped())break e;Pb(N,Q,le),C=te}}}if(Un)throw o=ge,Un=!1,ge=null,o}function nt(o,c){var m=c[Th];m===void 0&&(m=c[Th]=new Set);var y=o+"__bubble";m.has(y)||(Fb(c,o,2,!1),m.add(y))}function kh(o,c,m){var y=0;c&&(y|=4),Fb(m,o,y,c)}var fc="_reactListening"+Math.random().toString(36).slice(2);function Mi(o){if(!o[fc]){o[fc]=!0,r.forEach(function(m){m!=="selectionchange"&&(rL.has(m)||kh(m,!1,o),kh(m,!0,o))});var c=o.nodeType===9?o:o.ownerDocument;c===null||c[fc]||(c[fc]=!0,kh("selectionchange",!1,c))}}function Fb(o,c,m,y){switch(ia(c)){case 1:var N=ac;break;case 4:N=oc;break;default:N=ki}m=N.bind(null,c,m,o),N=void 0,!dr||c!=="touchstart"&&c!=="touchmove"&&c!=="wheel"||(N=!0),y?N!==void 0?o.addEventListener(c,m,{capture:!0,passive:N}):o.addEventListener(c,m,!0):N!==void 0?o.addEventListener(c,m,{passive:N}):o.addEventListener(c,m,!1)}function Nh(o,c,m,y,N){var C=y;if((c&1)===0&&(c&2)===0&&y!==null)e:for(;;){if(y===null)return;var B=y.tag;if(B===3||B===4){var Q=y.stateNode.containerInfo;if(Q===N||Q.nodeType===8&&Q.parentNode===N)break;if(B===4)for(B=y.return;B!==null;){var te=B.tag;if((te===3||te===4)&&(te=B.stateNode.containerInfo,te===N||te.nodeType===8&&te.parentNode===N))return;B=B.return}for(;Q!==null;){if(B=ca(Q),B===null)return;if(te=B.tag,te===5||te===6){y=C=B;continue e}Q=Q.parentNode}}y=y.return}is(function(){var le=C,me=kn(m),ye=[];e:{var pe=Ob.get(o);if(pe!==void 0){var Ne=Dr,Se=o;switch(o){case"keypress":if(eo(m)===0)break e;case"keydown":case"keyup":Ne=$O;break;case"focusin":Se="focus",Ne=dh;break;case"focusout":Se="blur",Ne=dh;break;case"beforeblur":case"afterblur":Ne=dh;break;case"click":if(m.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Ne=db;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Ne=bO;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Ne=LO;break;case Ab:case Mb:case $b:Ne=jO;break;case Ib:Ne=DO;break;case"scroll":Ne=Ni;break;case"wheel":Ne=qO;break;case"copy":case"cut":case"paste":Ne=_O;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Ne=fb}var _e=(c&4)!==0,pt=!_e&&o==="scroll",ae=_e?pe!==null?pe+"Capture":null:pe;_e=[];for(var ne=le,oe;ne!==null;){oe=ne;var ve=oe.stateNode;if(oe.tag===5&&ve!==null&&(oe=ve,ae!==null&&(ve=Nn(ne,ae),ve!=null&&_e.push($i(ne,ve,oe)))),pt)break;ne=ne.return}0<_e.length&&(pe=new Ne(pe,Se,null,m,me),ye.push({event:pe,listeners:_e}))}}if((c&7)===0){e:{if(pe=o==="mouseover"||o==="pointerover",Ne=o==="mouseout"||o==="pointerout",pe&&m!==qt&&(Se=m.relatedTarget||m.fromElement)&&(ca(Se)||Se[qr]))break e;if((Ne||pe)&&(pe=me.window===me?me:(pe=me.ownerDocument)?pe.defaultView||pe.parentWindow:window,Ne?(Se=m.relatedTarget||m.toElement,Ne=le,Se=Se?ca(Se):null,Se!==null&&(pt=Ut(Se),Se!==pt||Se.tag!==5&&Se.tag!==6)&&(Se=null)):(Ne=null,Se=le),Ne!==Se)){if(_e=db,ve="onMouseLeave",ae="onMouseEnter",ne="mouse",(o==="pointerout"||o==="pointerover")&&(_e=fb,ve="onPointerLeave",ae="onPointerEnter",ne="pointer"),pt=Ne==null?pe:oo(Ne),oe=Se==null?pe:oo(Se),pe=new _e(ve,ne+"leave",Ne,m,me),pe.target=pt,pe.relatedTarget=oe,ve=null,ca(me)===le&&(_e=new _e(ae,ne+"enter",Se,m,me),_e.target=oe,_e.relatedTarget=pt,ve=_e),pt=ve,Ne&&Se)t:{for(_e=Ne,ae=Se,ne=0,oe=_e;oe;oe=so(oe))ne++;for(oe=0,ve=ae;ve;ve=so(ve))oe++;for(;0<ne-oe;)_e=so(_e),ne--;for(;0<oe-ne;)ae=so(ae),oe--;for(;ne--;){if(_e===ae||ae!==null&&_e===ae.alternate)break t;_e=so(_e),ae=so(ae)}_e=null}else _e=null;Ne!==null&&qb(ye,pe,Ne,_e,!1),Se!==null&&pt!==null&&qb(ye,pt,Se,_e,!0)}}e:{if(pe=le?oo(le):window,Ne=pe.nodeName&&pe.nodeName.toLowerCase(),Ne==="select"||Ne==="input"&&pe.type==="file")var Ee=GO;else if(vb(pe))if(bb)Ee=ZO;else{Ee=YO;var Re=KO}else(Ne=pe.nodeName)&&Ne.toLowerCase()==="input"&&(pe.type==="checkbox"||pe.type==="radio")&&(Ee=XO);if(Ee&&(Ee=Ee(o,le))){xb(ye,Ee,m,me);break e}Re&&Re(o,pe,le),o==="focusout"&&(Re=pe._wrapperState)&&Re.controlled&&pe.type==="number"&&se(pe,"number",pe.value)}switch(Re=le?oo(le):window,o){case"focusin":(vb(Re)||Re.contentEditable==="true")&&(no=Re,yh=le,Ri=null);break;case"focusout":Ri=yh=no=null;break;case"mousedown":wh=!0;break;case"contextmenu":case"mouseup":case"dragend":wh=!1,Tb(ye,m,me);break;case"selectionchange":if(eL)break;case"keydown":case"keyup":Tb(ye,m,me)}var Ae;if(fh)e:{switch(o){case"compositionstart":var Me="onCompositionStart";break e;case"compositionend":Me="onCompositionEnd";break e;case"compositionupdate":Me="onCompositionUpdate";break e}Me=void 0}else to?yb(o,m)&&(Me="onCompositionEnd"):o==="keydown"&&m.keyCode===229&&(Me="onCompositionStart");Me&&(pb&&m.locale!=="ko"&&(to||Me!=="onCompositionStart"?Me==="onCompositionEnd"&&to&&(Ae=ic()):(wr=me,Lr="value"in wr?wr.value:wr.textContent,to=!0)),Re=pc(le,Me),0<Re.length&&(Me=new hb(Me,o,null,m,me),ye.push({event:Me,listeners:Re}),Ae?Me.data=Ae:(Ae=wb(m),Ae!==null&&(Me.data=Ae)))),(Ae=UO?zO(o,m):HO(o,m))&&(le=pc(le,"onBeforeInput"),0<le.length&&(me=new hb("onBeforeInput","beforeinput",null,m,me),ye.push({event:me,listeners:le}),me.data=Ae))}Db(ye,c)})}function $i(o,c,m){return{instance:o,listener:c,currentTarget:m}}function pc(o,c){for(var m=c+"Capture",y=[];o!==null;){var N=o,C=N.stateNode;N.tag===5&&C!==null&&(N=C,C=Nn(o,m),C!=null&&y.unshift($i(o,C,N)),C=Nn(o,c),C!=null&&y.push($i(o,C,N))),o=o.return}return y}function so(o){if(o===null)return null;do o=o.return;while(o&&o.tag!==5);return o||null}function qb(o,c,m,y,N){for(var C=c._reactName,B=[];m!==null&&m!==y;){var Q=m,te=Q.alternate,le=Q.stateNode;if(te!==null&&te===y)break;Q.tag===5&&le!==null&&(Q=le,N?(te=Nn(m,C),te!=null&&B.unshift($i(m,te,Q))):N||(te=Nn(m,C),te!=null&&B.push($i(m,te,Q)))),m=m.return}B.length!==0&&o.push({event:c,listeners:B})}var sL=/\r\n?/g,aL=/\u0000|\uFFFD/g;function Bb(o){return(typeof o=="string"?o:""+o).replace(sL,`
|
|
38
|
-
`).replace(aL,"")}function mc(o,c,m){if(c=Bb(c),Bb(o)!==c&&m)throw Error(n(425))}function gc(){}var jh=null,Sh=null;function _h(o,c){return o==="textarea"||o==="noscript"||typeof c.children=="string"||typeof c.children=="number"||typeof c.dangerouslySetInnerHTML=="object"&&c.dangerouslySetInnerHTML!==null&&c.dangerouslySetInnerHTML.__html!=null}var Eh=typeof setTimeout=="function"?setTimeout:void 0,oL=typeof clearTimeout=="function"?clearTimeout:void 0,Ub=typeof Promise=="function"?Promise:void 0,iL=typeof queueMicrotask=="function"?queueMicrotask:typeof Ub<"u"?function(o){return Ub.resolve(null).then(o).catch(lL)}:Eh;function lL(o){setTimeout(function(){throw o})}function Ch(o,c){var m=c,y=0;do{var N=m.nextSibling;if(o.removeChild(m),N&&N.nodeType===8)if(m=N.data,m==="/$"){if(y===0){o.removeChild(N),Or(c);return}y--}else m!=="$"&&m!=="$?"&&m!=="$!"||y++;m=N}while(m);Or(c)}function ks(o){for(;o!=null;o=o.nextSibling){var c=o.nodeType;if(c===1||c===3)break;if(c===8){if(c=o.data,c==="$"||c==="$!"||c==="$?")break;if(c==="/$")return null}}return o}function zb(o){o=o.previousSibling;for(var c=0;o;){if(o.nodeType===8){var m=o.data;if(m==="$"||m==="$!"||m==="$?"){if(c===0)return o;c--}else m==="/$"&&c++}o=o.previousSibling}return null}var ao=Math.random().toString(36).slice(2),vr="__reactFiber$"+ao,Ii="__reactProps$"+ao,qr="__reactContainer$"+ao,Th="__reactEvents$"+ao,cL="__reactListeners$"+ao,uL="__reactHandles$"+ao;function ca(o){var c=o[vr];if(c)return c;for(var m=o.parentNode;m;){if(c=m[qr]||m[vr]){if(m=c.alternate,c.child!==null||m!==null&&m.child!==null)for(o=zb(o);o!==null;){if(m=o[vr])return m;o=zb(o)}return c}o=m,m=o.parentNode}return null}function Oi(o){return o=o[vr]||o[qr],!o||o.tag!==5&&o.tag!==6&&o.tag!==13&&o.tag!==3?null:o}function oo(o){if(o.tag===5||o.tag===6)return o.stateNode;throw Error(n(33))}function yc(o){return o[Ii]||null}var Rh=[],io=-1;function Ns(o){return{current:o}}function rt(o){0>io||(o.current=Rh[io],Rh[io]=null,io--)}function tt(o,c){io++,Rh[io]=o.current,o.current=c}var js={},zt=Ns(js),en=Ns(!1),ua=js;function lo(o,c){var m=o.type.contextTypes;if(!m)return js;var y=o.stateNode;if(y&&y.__reactInternalMemoizedUnmaskedChildContext===c)return y.__reactInternalMemoizedMaskedChildContext;var N={},C;for(C in m)N[C]=c[C];return y&&(o=o.stateNode,o.__reactInternalMemoizedUnmaskedChildContext=c,o.__reactInternalMemoizedMaskedChildContext=N),N}function tn(o){return o=o.childContextTypes,o!=null}function wc(){rt(en),rt(zt)}function Hb(o,c,m){if(zt.current!==js)throw Error(n(168));tt(zt,c),tt(en,m)}function Wb(o,c,m){var y=o.stateNode;if(c=c.childContextTypes,typeof y.getChildContext!="function")return m;y=y.getChildContext();for(var N in y)if(!(N in c))throw Error(n(108,Z(o)||"Unknown",N));return z({},m,y)}function vc(o){return o=(o=o.stateNode)&&o.__reactInternalMemoizedMergedChildContext||js,ua=zt.current,tt(zt,o),tt(en,en.current),!0}function Vb(o,c,m){var y=o.stateNode;if(!y)throw Error(n(169));m?(o=Wb(o,c,ua),y.__reactInternalMemoizedMergedChildContext=o,rt(en),rt(zt),tt(zt,o)):rt(en),tt(en,m)}var Br=null,xc=!1,Ah=!1;function Gb(o){Br===null?Br=[o]:Br.push(o)}function dL(o){xc=!0,Gb(o)}function Ss(){if(!Ah&&Br!==null){Ah=!0;var o=0,c=We;try{var m=Br;for(We=1;o<m.length;o++){var y=m[o];do y=y(!0);while(y!==null)}Br=null,xc=!1}catch(N){throw Br!==null&&(Br=Br.slice(o+1)),Ga(pr,Ss),N}finally{We=c,Ah=!1}}return null}var co=[],uo=0,bc=null,kc=0,_n=[],En=0,da=null,Ur=1,zr="";function ha(o,c){co[uo++]=kc,co[uo++]=bc,bc=o,kc=c}function Kb(o,c,m){_n[En++]=Ur,_n[En++]=zr,_n[En++]=da,da=o;var y=Ur;o=zr;var N=32-jt(y)-1;y&=~(1<<N),m+=1;var C=32-jt(c)+N;if(30<C){var B=N-N%5;C=(y&(1<<B)-1).toString(32),y>>=B,N-=B,Ur=1<<32-jt(c)+N|m<<N|y,zr=C+o}else Ur=1<<C|m<<N|y,zr=o}function Mh(o){o.return!==null&&(ha(o,1),Kb(o,1,0))}function $h(o){for(;o===bc;)bc=co[--uo],co[uo]=null,kc=co[--uo],co[uo]=null;for(;o===da;)da=_n[--En],_n[En]=null,zr=_n[--En],_n[En]=null,Ur=_n[--En],_n[En]=null}var pn=null,mn=null,lt=!1,Gn=null;function Yb(o,c){var m=An(5,null,null,0);m.elementType="DELETED",m.stateNode=c,m.return=o,c=o.deletions,c===null?(o.deletions=[m],o.flags|=16):c.push(m)}function Xb(o,c){switch(o.tag){case 5:var m=o.type;return c=c.nodeType!==1||m.toLowerCase()!==c.nodeName.toLowerCase()?null:c,c!==null?(o.stateNode=c,pn=o,mn=ks(c.firstChild),!0):!1;case 6:return c=o.pendingProps===""||c.nodeType!==3?null:c,c!==null?(o.stateNode=c,pn=o,mn=null,!0):!1;case 13:return c=c.nodeType!==8?null:c,c!==null?(m=da!==null?{id:Ur,overflow:zr}:null,o.memoizedState={dehydrated:c,treeContext:m,retryLane:1073741824},m=An(18,null,null,0),m.stateNode=c,m.return=o,o.child=m,pn=o,mn=null,!0):!1;default:return!1}}function Ih(o){return(o.mode&1)!==0&&(o.flags&128)===0}function Oh(o){if(lt){var c=mn;if(c){var m=c;if(!Xb(o,c)){if(Ih(o))throw Error(n(418));c=ks(m.nextSibling);var y=pn;c&&Xb(o,c)?Yb(y,m):(o.flags=o.flags&-4097|2,lt=!1,pn=o)}}else{if(Ih(o))throw Error(n(418));o.flags=o.flags&-4097|2,lt=!1,pn=o}}}function Zb(o){for(o=o.return;o!==null&&o.tag!==5&&o.tag!==3&&o.tag!==13;)o=o.return;pn=o}function Nc(o){if(o!==pn)return!1;if(!lt)return Zb(o),lt=!0,!1;var c;if((c=o.tag!==3)&&!(c=o.tag!==5)&&(c=o.type,c=c!=="head"&&c!=="body"&&!_h(o.type,o.memoizedProps)),c&&(c=mn)){if(Ih(o))throw Jb(),Error(n(418));for(;c;)Yb(o,c),c=ks(c.nextSibling)}if(Zb(o),o.tag===13){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(n(317));e:{for(o=o.nextSibling,c=0;o;){if(o.nodeType===8){var m=o.data;if(m==="/$"){if(c===0){mn=ks(o.nextSibling);break e}c--}else m!=="$"&&m!=="$!"&&m!=="$?"||c++}o=o.nextSibling}mn=null}}else mn=pn?ks(o.stateNode.nextSibling):null;return!0}function Jb(){for(var o=mn;o;)o=ks(o.nextSibling)}function ho(){mn=pn=null,lt=!1}function Lh(o){Gn===null?Gn=[o]:Gn.push(o)}var hL=E.ReactCurrentBatchConfig;function Li(o,c,m){if(o=m.ref,o!==null&&typeof o!="function"&&typeof o!="object"){if(m._owner){if(m=m._owner,m){if(m.tag!==1)throw Error(n(309));var y=m.stateNode}if(!y)throw Error(n(147,o));var N=y,C=""+o;return c!==null&&c.ref!==null&&typeof c.ref=="function"&&c.ref._stringRef===C?c.ref:(c=function(B){var Q=N.refs;B===null?delete Q[C]:Q[C]=B},c._stringRef=C,c)}if(typeof o!="string")throw Error(n(284));if(!m._owner)throw Error(n(290,o))}return o}function jc(o,c){throw o=Object.prototype.toString.call(c),Error(n(31,o==="[object Object]"?"object with keys {"+Object.keys(c).join(", ")+"}":o))}function Qb(o){var c=o._init;return c(o._payload)}function ek(o){function c(ae,ne){if(o){var oe=ae.deletions;oe===null?(ae.deletions=[ne],ae.flags|=16):oe.push(ne)}}function m(ae,ne){if(!o)return null;for(;ne!==null;)c(ae,ne),ne=ne.sibling;return null}function y(ae,ne){for(ae=new Map;ne!==null;)ne.key!==null?ae.set(ne.key,ne):ae.set(ne.index,ne),ne=ne.sibling;return ae}function N(ae,ne){return ae=$s(ae,ne),ae.index=0,ae.sibling=null,ae}function C(ae,ne,oe){return ae.index=oe,o?(oe=ae.alternate,oe!==null?(oe=oe.index,oe<ne?(ae.flags|=2,ne):oe):(ae.flags|=2,ne)):(ae.flags|=1048576,ne)}function B(ae){return o&&ae.alternate===null&&(ae.flags|=2),ae}function Q(ae,ne,oe,ve){return ne===null||ne.tag!==6?(ne=Cf(oe,ae.mode,ve),ne.return=ae,ne):(ne=N(ne,oe),ne.return=ae,ne)}function te(ae,ne,oe,ve){var Ee=oe.type;return Ee===A?me(ae,ne,oe.props.children,ve,oe.key):ne!==null&&(ne.elementType===Ee||typeof Ee=="object"&&Ee!==null&&Ee.$$typeof===L&&Qb(Ee)===ne.type)?(ve=N(ne,oe.props),ve.ref=Li(ae,ne,oe),ve.return=ae,ve):(ve=Kc(oe.type,oe.key,oe.props,null,ae.mode,ve),ve.ref=Li(ae,ne,oe),ve.return=ae,ve)}function le(ae,ne,oe,ve){return ne===null||ne.tag!==4||ne.stateNode.containerInfo!==oe.containerInfo||ne.stateNode.implementation!==oe.implementation?(ne=Tf(oe,ae.mode,ve),ne.return=ae,ne):(ne=N(ne,oe.children||[]),ne.return=ae,ne)}function me(ae,ne,oe,ve,Ee){return ne===null||ne.tag!==7?(ne=xa(oe,ae.mode,ve,Ee),ne.return=ae,ne):(ne=N(ne,oe),ne.return=ae,ne)}function ye(ae,ne,oe){if(typeof ne=="string"&&ne!==""||typeof ne=="number")return ne=Cf(""+ne,ae.mode,oe),ne.return=ae,ne;if(typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case T:return oe=Kc(ne.type,ne.key,ne.props,null,ae.mode,oe),oe.ref=Li(ae,null,ne),oe.return=ae,oe;case R:return ne=Tf(ne,ae.mode,oe),ne.return=ae,ne;case L:var ve=ne._init;return ye(ae,ve(ne._payload),oe)}if(ke(ne)||D(ne))return ne=xa(ne,ae.mode,oe,null),ne.return=ae,ne;jc(ae,ne)}return null}function pe(ae,ne,oe,ve){var Ee=ne!==null?ne.key:null;if(typeof oe=="string"&&oe!==""||typeof oe=="number")return Ee!==null?null:Q(ae,ne,""+oe,ve);if(typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case T:return oe.key===Ee?te(ae,ne,oe,ve):null;case R:return oe.key===Ee?le(ae,ne,oe,ve):null;case L:return Ee=oe._init,pe(ae,ne,Ee(oe._payload),ve)}if(ke(oe)||D(oe))return Ee!==null?null:me(ae,ne,oe,ve,null);jc(ae,oe)}return null}function Ne(ae,ne,oe,ve,Ee){if(typeof ve=="string"&&ve!==""||typeof ve=="number")return ae=ae.get(oe)||null,Q(ne,ae,""+ve,Ee);if(typeof ve=="object"&&ve!==null){switch(ve.$$typeof){case T:return ae=ae.get(ve.key===null?oe:ve.key)||null,te(ne,ae,ve,Ee);case R:return ae=ae.get(ve.key===null?oe:ve.key)||null,le(ne,ae,ve,Ee);case L:var Re=ve._init;return Ne(ae,ne,oe,Re(ve._payload),Ee)}if(ke(ve)||D(ve))return ae=ae.get(oe)||null,me(ne,ae,ve,Ee,null);jc(ne,ve)}return null}function Se(ae,ne,oe,ve){for(var Ee=null,Re=null,Ae=ne,Me=ne=0,$t=null;Ae!==null&&Me<oe.length;Me++){Ae.index>Me?($t=Ae,Ae=null):$t=Ae.sibling;var Ge=pe(ae,Ae,oe[Me],ve);if(Ge===null){Ae===null&&(Ae=$t);break}o&&Ae&&Ge.alternate===null&&c(ae,Ae),ne=C(Ge,ne,Me),Re===null?Ee=Ge:Re.sibling=Ge,Re=Ge,Ae=$t}if(Me===oe.length)return m(ae,Ae),lt&&ha(ae,Me),Ee;if(Ae===null){for(;Me<oe.length;Me++)Ae=ye(ae,oe[Me],ve),Ae!==null&&(ne=C(Ae,ne,Me),Re===null?Ee=Ae:Re.sibling=Ae,Re=Ae);return lt&&ha(ae,Me),Ee}for(Ae=y(ae,Ae);Me<oe.length;Me++)$t=Ne(Ae,ae,Me,oe[Me],ve),$t!==null&&(o&&$t.alternate!==null&&Ae.delete($t.key===null?Me:$t.key),ne=C($t,ne,Me),Re===null?Ee=$t:Re.sibling=$t,Re=$t);return o&&Ae.forEach(function(Is){return c(ae,Is)}),lt&&ha(ae,Me),Ee}function _e(ae,ne,oe,ve){var Ee=D(oe);if(typeof Ee!="function")throw Error(n(150));if(oe=Ee.call(oe),oe==null)throw Error(n(151));for(var Re=Ee=null,Ae=ne,Me=ne=0,$t=null,Ge=oe.next();Ae!==null&&!Ge.done;Me++,Ge=oe.next()){Ae.index>Me?($t=Ae,Ae=null):$t=Ae.sibling;var Is=pe(ae,Ae,Ge.value,ve);if(Is===null){Ae===null&&(Ae=$t);break}o&&Ae&&Is.alternate===null&&c(ae,Ae),ne=C(Is,ne,Me),Re===null?Ee=Is:Re.sibling=Is,Re=Is,Ae=$t}if(Ge.done)return m(ae,Ae),lt&&ha(ae,Me),Ee;if(Ae===null){for(;!Ge.done;Me++,Ge=oe.next())Ge=ye(ae,Ge.value,ve),Ge!==null&&(ne=C(Ge,ne,Me),Re===null?Ee=Ge:Re.sibling=Ge,Re=Ge);return lt&&ha(ae,Me),Ee}for(Ae=y(ae,Ae);!Ge.done;Me++,Ge=oe.next())Ge=Ne(Ae,ae,Me,Ge.value,ve),Ge!==null&&(o&&Ge.alternate!==null&&Ae.delete(Ge.key===null?Me:Ge.key),ne=C(Ge,ne,Me),Re===null?Ee=Ge:Re.sibling=Ge,Re=Ge);return o&&Ae.forEach(function(WL){return c(ae,WL)}),lt&&ha(ae,Me),Ee}function pt(ae,ne,oe,ve){if(typeof oe=="object"&&oe!==null&&oe.type===A&&oe.key===null&&(oe=oe.props.children),typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case T:e:{for(var Ee=oe.key,Re=ne;Re!==null;){if(Re.key===Ee){if(Ee=oe.type,Ee===A){if(Re.tag===7){m(ae,Re.sibling),ne=N(Re,oe.props.children),ne.return=ae,ae=ne;break e}}else if(Re.elementType===Ee||typeof Ee=="object"&&Ee!==null&&Ee.$$typeof===L&&Qb(Ee)===Re.type){m(ae,Re.sibling),ne=N(Re,oe.props),ne.ref=Li(ae,Re,oe),ne.return=ae,ae=ne;break e}m(ae,Re);break}else c(ae,Re);Re=Re.sibling}oe.type===A?(ne=xa(oe.props.children,ae.mode,ve,oe.key),ne.return=ae,ae=ne):(ve=Kc(oe.type,oe.key,oe.props,null,ae.mode,ve),ve.ref=Li(ae,ne,oe),ve.return=ae,ae=ve)}return B(ae);case R:e:{for(Re=oe.key;ne!==null;){if(ne.key===Re)if(ne.tag===4&&ne.stateNode.containerInfo===oe.containerInfo&&ne.stateNode.implementation===oe.implementation){m(ae,ne.sibling),ne=N(ne,oe.children||[]),ne.return=ae,ae=ne;break e}else{m(ae,ne);break}else c(ae,ne);ne=ne.sibling}ne=Tf(oe,ae.mode,ve),ne.return=ae,ae=ne}return B(ae);case L:return Re=oe._init,pt(ae,ne,Re(oe._payload),ve)}if(ke(oe))return Se(ae,ne,oe,ve);if(D(oe))return _e(ae,ne,oe,ve);jc(ae,oe)}return typeof oe=="string"&&oe!==""||typeof oe=="number"?(oe=""+oe,ne!==null&&ne.tag===6?(m(ae,ne.sibling),ne=N(ne,oe),ne.return=ae,ae=ne):(m(ae,ne),ne=Cf(oe,ae.mode,ve),ne.return=ae,ae=ne),B(ae)):m(ae,ne)}return pt}var fo=ek(!0),tk=ek(!1),Sc=Ns(null),_c=null,po=null,Ph=null;function Dh(){Ph=po=_c=null}function Fh(o){var c=Sc.current;rt(Sc),o._currentValue=c}function qh(o,c,m){for(;o!==null;){var y=o.alternate;if((o.childLanes&c)!==c?(o.childLanes|=c,y!==null&&(y.childLanes|=c)):y!==null&&(y.childLanes&c)!==c&&(y.childLanes|=c),o===m)break;o=o.return}}function mo(o,c){_c=o,Ph=po=null,o=o.dependencies,o!==null&&o.firstContext!==null&&((o.lanes&c)!==0&&(nn=!0),o.firstContext=null)}function Cn(o){var c=o._currentValue;if(Ph!==o)if(o={context:o,memoizedValue:c,next:null},po===null){if(_c===null)throw Error(n(308));po=o,_c.dependencies={lanes:0,firstContext:o}}else po=po.next=o;return c}var fa=null;function Bh(o){fa===null?fa=[o]:fa.push(o)}function nk(o,c,m,y){var N=c.interleaved;return N===null?(m.next=m,Bh(c)):(m.next=N.next,N.next=m),c.interleaved=m,Hr(o,y)}function Hr(o,c){o.lanes|=c;var m=o.alternate;for(m!==null&&(m.lanes|=c),m=o,o=o.return;o!==null;)o.childLanes|=c,m=o.alternate,m!==null&&(m.childLanes|=c),m=o,o=o.return;return m.tag===3?m.stateNode:null}var _s=!1;function Uh(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function rk(o,c){o=o.updateQueue,c.updateQueue===o&&(c.updateQueue={baseState:o.baseState,firstBaseUpdate:o.firstBaseUpdate,lastBaseUpdate:o.lastBaseUpdate,shared:o.shared,effects:o.effects})}function Wr(o,c){return{eventTime:o,lane:c,tag:0,payload:null,callback:null,next:null}}function Es(o,c,m){var y=o.updateQueue;if(y===null)return null;if(y=y.shared,(Ve&2)!==0){var N=y.pending;return N===null?c.next=c:(c.next=N.next,N.next=c),y.pending=c,Hr(o,m)}return N=y.interleaved,N===null?(c.next=c,Bh(y)):(c.next=N.next,N.next=c),y.interleaved=c,Hr(o,m)}function Ec(o,c,m){if(c=c.updateQueue,c!==null&&(c=c.shared,(m&4194240)!==0)){var y=c.lanes;y&=o.pendingLanes,m|=y,c.lanes=m,Za(o,m)}}function sk(o,c){var m=o.updateQueue,y=o.alternate;if(y!==null&&(y=y.updateQueue,m===y)){var N=null,C=null;if(m=m.firstBaseUpdate,m!==null){do{var B={eventTime:m.eventTime,lane:m.lane,tag:m.tag,payload:m.payload,callback:m.callback,next:null};C===null?N=C=B:C=C.next=B,m=m.next}while(m!==null);C===null?N=C=c:C=C.next=c}else N=C=c;m={baseState:y.baseState,firstBaseUpdate:N,lastBaseUpdate:C,shared:y.shared,effects:y.effects},o.updateQueue=m;return}o=m.lastBaseUpdate,o===null?m.firstBaseUpdate=c:o.next=c,m.lastBaseUpdate=c}function Cc(o,c,m,y){var N=o.updateQueue;_s=!1;var C=N.firstBaseUpdate,B=N.lastBaseUpdate,Q=N.shared.pending;if(Q!==null){N.shared.pending=null;var te=Q,le=te.next;te.next=null,B===null?C=le:B.next=le,B=te;var me=o.alternate;me!==null&&(me=me.updateQueue,Q=me.lastBaseUpdate,Q!==B&&(Q===null?me.firstBaseUpdate=le:Q.next=le,me.lastBaseUpdate=te))}if(C!==null){var ye=N.baseState;B=0,me=le=te=null,Q=C;do{var pe=Q.lane,Ne=Q.eventTime;if((y&pe)===pe){me!==null&&(me=me.next={eventTime:Ne,lane:0,tag:Q.tag,payload:Q.payload,callback:Q.callback,next:null});e:{var Se=o,_e=Q;switch(pe=c,Ne=m,_e.tag){case 1:if(Se=_e.payload,typeof Se=="function"){ye=Se.call(Ne,ye,pe);break e}ye=Se;break e;case 3:Se.flags=Se.flags&-65537|128;case 0:if(Se=_e.payload,pe=typeof Se=="function"?Se.call(Ne,ye,pe):Se,pe==null)break e;ye=z({},ye,pe);break e;case 2:_s=!0}}Q.callback!==null&&Q.lane!==0&&(o.flags|=64,pe=N.effects,pe===null?N.effects=[Q]:pe.push(Q))}else Ne={eventTime:Ne,lane:pe,tag:Q.tag,payload:Q.payload,callback:Q.callback,next:null},me===null?(le=me=Ne,te=ye):me=me.next=Ne,B|=pe;if(Q=Q.next,Q===null){if(Q=N.shared.pending,Q===null)break;pe=Q,Q=pe.next,pe.next=null,N.lastBaseUpdate=pe,N.shared.pending=null}}while(!0);if(me===null&&(te=ye),N.baseState=te,N.firstBaseUpdate=le,N.lastBaseUpdate=me,c=N.shared.interleaved,c!==null){N=c;do B|=N.lane,N=N.next;while(N!==c)}else C===null&&(N.shared.lanes=0);ga|=B,o.lanes=B,o.memoizedState=ye}}function ak(o,c,m){if(o=c.effects,c.effects=null,o!==null)for(c=0;c<o.length;c++){var y=o[c],N=y.callback;if(N!==null){if(y.callback=null,y=m,typeof N!="function")throw Error(n(191,N));N.call(y)}}}var Pi={},xr=Ns(Pi),Di=Ns(Pi),Fi=Ns(Pi);function pa(o){if(o===Pi)throw Error(n(174));return o}function zh(o,c){switch(tt(Fi,c),tt(Di,o),tt(xr,Pi),o=c.nodeType,o){case 9:case 11:c=(c=c.documentElement)?c.namespaceURI:et(null,"");break;default:o=o===8?c.parentNode:c,c=o.namespaceURI||null,o=o.tagName,c=et(c,o)}rt(xr),tt(xr,c)}function go(){rt(xr),rt(Di),rt(Fi)}function ok(o){pa(Fi.current);var c=pa(xr.current),m=et(c,o.type);c!==m&&(tt(Di,o),tt(xr,m))}function Hh(o){Di.current===o&&(rt(xr),rt(Di))}var ut=Ns(0);function Tc(o){for(var c=o;c!==null;){if(c.tag===13){var m=c.memoizedState;if(m!==null&&(m=m.dehydrated,m===null||m.data==="$?"||m.data==="$!"))return c}else if(c.tag===19&&c.memoizedProps.revealOrder!==void 0){if((c.flags&128)!==0)return c}else if(c.child!==null){c.child.return=c,c=c.child;continue}if(c===o)break;for(;c.sibling===null;){if(c.return===null||c.return===o)return null;c=c.return}c.sibling.return=c.return,c=c.sibling}return null}var Wh=[];function Vh(){for(var o=0;o<Wh.length;o++)Wh[o]._workInProgressVersionPrimary=null;Wh.length=0}var Rc=E.ReactCurrentDispatcher,Gh=E.ReactCurrentBatchConfig,ma=0,dt=null,St=null,At=null,Ac=!1,qi=!1,Bi=0,fL=0;function Ht(){throw Error(n(321))}function Kh(o,c){if(c===null)return!1;for(var m=0;m<c.length&&m<o.length;m++)if(!Vn(o[m],c[m]))return!1;return!0}function Yh(o,c,m,y,N,C){if(ma=C,dt=c,c.memoizedState=null,c.updateQueue=null,c.lanes=0,Rc.current=o===null||o.memoizedState===null?yL:wL,o=m(y,N),qi){C=0;do{if(qi=!1,Bi=0,25<=C)throw Error(n(301));C+=1,At=St=null,c.updateQueue=null,Rc.current=vL,o=m(y,N)}while(qi)}if(Rc.current=Ic,c=St!==null&&St.next!==null,ma=0,At=St=dt=null,Ac=!1,c)throw Error(n(300));return o}function Xh(){var o=Bi!==0;return Bi=0,o}function br(){var o={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return At===null?dt.memoizedState=At=o:At=At.next=o,At}function Tn(){if(St===null){var o=dt.alternate;o=o!==null?o.memoizedState:null}else o=St.next;var c=At===null?dt.memoizedState:At.next;if(c!==null)At=c,St=o;else{if(o===null)throw Error(n(310));St=o,o={memoizedState:St.memoizedState,baseState:St.baseState,baseQueue:St.baseQueue,queue:St.queue,next:null},At===null?dt.memoizedState=At=o:At=At.next=o}return At}function Ui(o,c){return typeof c=="function"?c(o):c}function Zh(o){var c=Tn(),m=c.queue;if(m===null)throw Error(n(311));m.lastRenderedReducer=o;var y=St,N=y.baseQueue,C=m.pending;if(C!==null){if(N!==null){var B=N.next;N.next=C.next,C.next=B}y.baseQueue=N=C,m.pending=null}if(N!==null){C=N.next,y=y.baseState;var Q=B=null,te=null,le=C;do{var me=le.lane;if((ma&me)===me)te!==null&&(te=te.next={lane:0,action:le.action,hasEagerState:le.hasEagerState,eagerState:le.eagerState,next:null}),y=le.hasEagerState?le.eagerState:o(y,le.action);else{var ye={lane:me,action:le.action,hasEagerState:le.hasEagerState,eagerState:le.eagerState,next:null};te===null?(Q=te=ye,B=y):te=te.next=ye,dt.lanes|=me,ga|=me}le=le.next}while(le!==null&&le!==C);te===null?B=y:te.next=Q,Vn(y,c.memoizedState)||(nn=!0),c.memoizedState=y,c.baseState=B,c.baseQueue=te,m.lastRenderedState=y}if(o=m.interleaved,o!==null){N=o;do C=N.lane,dt.lanes|=C,ga|=C,N=N.next;while(N!==o)}else N===null&&(m.lanes=0);return[c.memoizedState,m.dispatch]}function Jh(o){var c=Tn(),m=c.queue;if(m===null)throw Error(n(311));m.lastRenderedReducer=o;var y=m.dispatch,N=m.pending,C=c.memoizedState;if(N!==null){m.pending=null;var B=N=N.next;do C=o(C,B.action),B=B.next;while(B!==N);Vn(C,c.memoizedState)||(nn=!0),c.memoizedState=C,c.baseQueue===null&&(c.baseState=C),m.lastRenderedState=C}return[C,y]}function ik(){}function lk(o,c){var m=dt,y=Tn(),N=c(),C=!Vn(y.memoizedState,N);if(C&&(y.memoizedState=N,nn=!0),y=y.queue,Qh(dk.bind(null,m,y,o),[o]),y.getSnapshot!==c||C||At!==null&&At.memoizedState.tag&1){if(m.flags|=2048,zi(9,uk.bind(null,m,y,N,c),void 0,null),Mt===null)throw Error(n(349));(ma&30)!==0||ck(m,c,N)}return N}function ck(o,c,m){o.flags|=16384,o={getSnapshot:c,value:m},c=dt.updateQueue,c===null?(c={lastEffect:null,stores:null},dt.updateQueue=c,c.stores=[o]):(m=c.stores,m===null?c.stores=[o]:m.push(o))}function uk(o,c,m,y){c.value=m,c.getSnapshot=y,hk(c)&&fk(o)}function dk(o,c,m){return m(function(){hk(c)&&fk(o)})}function hk(o){var c=o.getSnapshot;o=o.value;try{var m=c();return!Vn(o,m)}catch{return!0}}function fk(o){var c=Hr(o,1);c!==null&&Zn(c,o,1,-1)}function pk(o){var c=br();return typeof o=="function"&&(o=o()),c.memoizedState=c.baseState=o,o={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Ui,lastRenderedState:o},c.queue=o,o=o.dispatch=gL.bind(null,dt,o),[c.memoizedState,o]}function zi(o,c,m,y){return o={tag:o,create:c,destroy:m,deps:y,next:null},c=dt.updateQueue,c===null?(c={lastEffect:null,stores:null},dt.updateQueue=c,c.lastEffect=o.next=o):(m=c.lastEffect,m===null?c.lastEffect=o.next=o:(y=m.next,m.next=o,o.next=y,c.lastEffect=o)),o}function mk(){return Tn().memoizedState}function Mc(o,c,m,y){var N=br();dt.flags|=o,N.memoizedState=zi(1|c,m,void 0,y===void 0?null:y)}function $c(o,c,m,y){var N=Tn();y=y===void 0?null:y;var C=void 0;if(St!==null){var B=St.memoizedState;if(C=B.destroy,y!==null&&Kh(y,B.deps)){N.memoizedState=zi(c,m,C,y);return}}dt.flags|=o,N.memoizedState=zi(1|c,m,C,y)}function gk(o,c){return Mc(8390656,8,o,c)}function Qh(o,c){return $c(2048,8,o,c)}function yk(o,c){return $c(4,2,o,c)}function wk(o,c){return $c(4,4,o,c)}function vk(o,c){if(typeof c=="function")return o=o(),c(o),function(){c(null)};if(c!=null)return o=o(),c.current=o,function(){c.current=null}}function xk(o,c,m){return m=m!=null?m.concat([o]):null,$c(4,4,vk.bind(null,c,o),m)}function ef(){}function bk(o,c){var m=Tn();c=c===void 0?null:c;var y=m.memoizedState;return y!==null&&c!==null&&Kh(c,y[1])?y[0]:(m.memoizedState=[o,c],o)}function kk(o,c){var m=Tn();c=c===void 0?null:c;var y=m.memoizedState;return y!==null&&c!==null&&Kh(c,y[1])?y[0]:(o=o(),m.memoizedState=[o,c],o)}function Nk(o,c,m){return(ma&21)===0?(o.baseState&&(o.baseState=!1,nn=!0),o.memoizedState=m):(Vn(m,c)||(m=yi(),dt.lanes|=m,ga|=m,o.baseState=!0),c)}function pL(o,c){var m=We;We=m!==0&&4>m?m:4,o(!0);var y=Gh.transition;Gh.transition={};try{o(!1),c()}finally{We=m,Gh.transition=y}}function jk(){return Tn().memoizedState}function mL(o,c,m){var y=As(o);if(m={lane:y,action:m,hasEagerState:!1,eagerState:null,next:null},Sk(o))_k(c,m);else if(m=nk(o,c,m,y),m!==null){var N=Jt();Zn(m,o,y,N),Ek(m,c,y)}}function gL(o,c,m){var y=As(o),N={lane:y,action:m,hasEagerState:!1,eagerState:null,next:null};if(Sk(o))_k(c,N);else{var C=o.alternate;if(o.lanes===0&&(C===null||C.lanes===0)&&(C=c.lastRenderedReducer,C!==null))try{var B=c.lastRenderedState,Q=C(B,m);if(N.hasEagerState=!0,N.eagerState=Q,Vn(Q,B)){var te=c.interleaved;te===null?(N.next=N,Bh(c)):(N.next=te.next,te.next=N),c.interleaved=N;return}}catch{}finally{}m=nk(o,c,N,y),m!==null&&(N=Jt(),Zn(m,o,y,N),Ek(m,c,y))}}function Sk(o){var c=o.alternate;return o===dt||c!==null&&c===dt}function _k(o,c){qi=Ac=!0;var m=o.pending;m===null?c.next=c:(c.next=m.next,m.next=c),o.pending=c}function Ek(o,c,m){if((m&4194240)!==0){var y=c.lanes;y&=o.pendingLanes,m|=y,c.lanes=m,Za(o,m)}}var Ic={readContext:Cn,useCallback:Ht,useContext:Ht,useEffect:Ht,useImperativeHandle:Ht,useInsertionEffect:Ht,useLayoutEffect:Ht,useMemo:Ht,useReducer:Ht,useRef:Ht,useState:Ht,useDebugValue:Ht,useDeferredValue:Ht,useTransition:Ht,useMutableSource:Ht,useSyncExternalStore:Ht,useId:Ht,unstable_isNewReconciler:!1},yL={readContext:Cn,useCallback:function(o,c){return br().memoizedState=[o,c===void 0?null:c],o},useContext:Cn,useEffect:gk,useImperativeHandle:function(o,c,m){return m=m!=null?m.concat([o]):null,Mc(4194308,4,vk.bind(null,c,o),m)},useLayoutEffect:function(o,c){return Mc(4194308,4,o,c)},useInsertionEffect:function(o,c){return Mc(4,2,o,c)},useMemo:function(o,c){var m=br();return c=c===void 0?null:c,o=o(),m.memoizedState=[o,c],o},useReducer:function(o,c,m){var y=br();return c=m!==void 0?m(c):c,y.memoizedState=y.baseState=c,o={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:c},y.queue=o,o=o.dispatch=mL.bind(null,dt,o),[y.memoizedState,o]},useRef:function(o){var c=br();return o={current:o},c.memoizedState=o},useState:pk,useDebugValue:ef,useDeferredValue:function(o){return br().memoizedState=o},useTransition:function(){var o=pk(!1),c=o[0];return o=pL.bind(null,o[1]),br().memoizedState=o,[c,o]},useMutableSource:function(){},useSyncExternalStore:function(o,c,m){var y=dt,N=br();if(lt){if(m===void 0)throw Error(n(407));m=m()}else{if(m=c(),Mt===null)throw Error(n(349));(ma&30)!==0||ck(y,c,m)}N.memoizedState=m;var C={value:m,getSnapshot:c};return N.queue=C,gk(dk.bind(null,y,C,o),[o]),y.flags|=2048,zi(9,uk.bind(null,y,C,m,c),void 0,null),m},useId:function(){var o=br(),c=Mt.identifierPrefix;if(lt){var m=zr,y=Ur;m=(y&~(1<<32-jt(y)-1)).toString(32)+m,c=":"+c+"R"+m,m=Bi++,0<m&&(c+="H"+m.toString(32)),c+=":"}else m=fL++,c=":"+c+"r"+m.toString(32)+":";return o.memoizedState=c},unstable_isNewReconciler:!1},wL={readContext:Cn,useCallback:bk,useContext:Cn,useEffect:Qh,useImperativeHandle:xk,useInsertionEffect:yk,useLayoutEffect:wk,useMemo:kk,useReducer:Zh,useRef:mk,useState:function(){return Zh(Ui)},useDebugValue:ef,useDeferredValue:function(o){var c=Tn();return Nk(c,St.memoizedState,o)},useTransition:function(){var o=Zh(Ui)[0],c=Tn().memoizedState;return[o,c]},useMutableSource:ik,useSyncExternalStore:lk,useId:jk,unstable_isNewReconciler:!1},vL={readContext:Cn,useCallback:bk,useContext:Cn,useEffect:Qh,useImperativeHandle:xk,useInsertionEffect:yk,useLayoutEffect:wk,useMemo:kk,useReducer:Jh,useRef:mk,useState:function(){return Jh(Ui)},useDebugValue:ef,useDeferredValue:function(o){var c=Tn();return St===null?c.memoizedState=o:Nk(c,St.memoizedState,o)},useTransition:function(){var o=Jh(Ui)[0],c=Tn().memoizedState;return[o,c]},useMutableSource:ik,useSyncExternalStore:lk,useId:jk,unstable_isNewReconciler:!1};function Kn(o,c){if(o&&o.defaultProps){c=z({},c),o=o.defaultProps;for(var m in o)c[m]===void 0&&(c[m]=o[m]);return c}return c}function tf(o,c,m,y){c=o.memoizedState,m=m(y,c),m=m==null?c:z({},c,m),o.memoizedState=m,o.lanes===0&&(o.updateQueue.baseState=m)}var Oc={isMounted:function(o){return(o=o._reactInternals)?Ut(o)===o:!1},enqueueSetState:function(o,c,m){o=o._reactInternals;var y=Jt(),N=As(o),C=Wr(y,N);C.payload=c,m!=null&&(C.callback=m),c=Es(o,C,N),c!==null&&(Zn(c,o,N,y),Ec(c,o,N))},enqueueReplaceState:function(o,c,m){o=o._reactInternals;var y=Jt(),N=As(o),C=Wr(y,N);C.tag=1,C.payload=c,m!=null&&(C.callback=m),c=Es(o,C,N),c!==null&&(Zn(c,o,N,y),Ec(c,o,N))},enqueueForceUpdate:function(o,c){o=o._reactInternals;var m=Jt(),y=As(o),N=Wr(m,y);N.tag=2,c!=null&&(N.callback=c),c=Es(o,N,y),c!==null&&(Zn(c,o,y,m),Ec(c,o,y))}};function Ck(o,c,m,y,N,C,B){return o=o.stateNode,typeof o.shouldComponentUpdate=="function"?o.shouldComponentUpdate(y,C,B):c.prototype&&c.prototype.isPureReactComponent?!Ti(m,y)||!Ti(N,C):!0}function Tk(o,c,m){var y=!1,N=js,C=c.contextType;return typeof C=="object"&&C!==null?C=Cn(C):(N=tn(c)?ua:zt.current,y=c.contextTypes,C=(y=y!=null)?lo(o,N):js),c=new c(m,C),o.memoizedState=c.state!==null&&c.state!==void 0?c.state:null,c.updater=Oc,o.stateNode=c,c._reactInternals=o,y&&(o=o.stateNode,o.__reactInternalMemoizedUnmaskedChildContext=N,o.__reactInternalMemoizedMaskedChildContext=C),c}function Rk(o,c,m,y){o=c.state,typeof c.componentWillReceiveProps=="function"&&c.componentWillReceiveProps(m,y),typeof c.UNSAFE_componentWillReceiveProps=="function"&&c.UNSAFE_componentWillReceiveProps(m,y),c.state!==o&&Oc.enqueueReplaceState(c,c.state,null)}function nf(o,c,m,y){var N=o.stateNode;N.props=m,N.state=o.memoizedState,N.refs={},Uh(o);var C=c.contextType;typeof C=="object"&&C!==null?N.context=Cn(C):(C=tn(c)?ua:zt.current,N.context=lo(o,C)),N.state=o.memoizedState,C=c.getDerivedStateFromProps,typeof C=="function"&&(tf(o,c,C,m),N.state=o.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof N.getSnapshotBeforeUpdate=="function"||typeof N.UNSAFE_componentWillMount!="function"&&typeof N.componentWillMount!="function"||(c=N.state,typeof N.componentWillMount=="function"&&N.componentWillMount(),typeof N.UNSAFE_componentWillMount=="function"&&N.UNSAFE_componentWillMount(),c!==N.state&&Oc.enqueueReplaceState(N,N.state,null),Cc(o,m,N,y),N.state=o.memoizedState),typeof N.componentDidMount=="function"&&(o.flags|=4194308)}function yo(o,c){try{var m="",y=c;do m+=G(y),y=y.return;while(y);var N=m}catch(C){N=`
|
|
39
|
-
Error generating stack: `+C.message+`
|
|
40
|
-
`+C.stack}return{value:o,source:c,stack:N,digest:null}}function rf(o,c,m){return{value:o,source:null,stack:m??null,digest:c??null}}function sf(o,c){try{console.error(c.value)}catch(m){setTimeout(function(){throw m})}}var xL=typeof WeakMap=="function"?WeakMap:Map;function Ak(o,c,m){m=Wr(-1,m),m.tag=3,m.payload={element:null};var y=c.value;return m.callback=function(){Uc||(Uc=!0,xf=y),sf(o,c)},m}function Mk(o,c,m){m=Wr(-1,m),m.tag=3;var y=o.type.getDerivedStateFromError;if(typeof y=="function"){var N=c.value;m.payload=function(){return y(N)},m.callback=function(){sf(o,c)}}var C=o.stateNode;return C!==null&&typeof C.componentDidCatch=="function"&&(m.callback=function(){sf(o,c),typeof y!="function"&&(Ts===null?Ts=new Set([this]):Ts.add(this));var B=c.stack;this.componentDidCatch(c.value,{componentStack:B!==null?B:""})}),m}function $k(o,c,m){var y=o.pingCache;if(y===null){y=o.pingCache=new xL;var N=new Set;y.set(c,N)}else N=y.get(c),N===void 0&&(N=new Set,y.set(c,N));N.has(m)||(N.add(m),o=IL.bind(null,o,c,m),c.then(o,o))}function Ik(o){do{var c;if((c=o.tag===13)&&(c=o.memoizedState,c=c!==null?c.dehydrated!==null:!0),c)return o;o=o.return}while(o!==null);return null}function Ok(o,c,m,y,N){return(o.mode&1)===0?(o===c?o.flags|=65536:(o.flags|=128,m.flags|=131072,m.flags&=-52805,m.tag===1&&(m.alternate===null?m.tag=17:(c=Wr(-1,1),c.tag=2,Es(m,c,1))),m.lanes|=1),o):(o.flags|=65536,o.lanes=N,o)}var bL=E.ReactCurrentOwner,nn=!1;function Zt(o,c,m,y){c.child=o===null?tk(c,null,m,y):fo(c,o.child,m,y)}function Lk(o,c,m,y,N){m=m.render;var C=c.ref;return mo(c,N),y=Yh(o,c,m,y,C,N),m=Xh(),o!==null&&!nn?(c.updateQueue=o.updateQueue,c.flags&=-2053,o.lanes&=~N,Vr(o,c,N)):(lt&&m&&Mh(c),c.flags|=1,Zt(o,c,y,N),c.child)}function Pk(o,c,m,y,N){if(o===null){var C=m.type;return typeof C=="function"&&!Ef(C)&&C.defaultProps===void 0&&m.compare===null&&m.defaultProps===void 0?(c.tag=15,c.type=C,Dk(o,c,C,y,N)):(o=Kc(m.type,null,y,c,c.mode,N),o.ref=c.ref,o.return=c,c.child=o)}if(C=o.child,(o.lanes&N)===0){var B=C.memoizedProps;if(m=m.compare,m=m!==null?m:Ti,m(B,y)&&o.ref===c.ref)return Vr(o,c,N)}return c.flags|=1,o=$s(C,y),o.ref=c.ref,o.return=c,c.child=o}function Dk(o,c,m,y,N){if(o!==null){var C=o.memoizedProps;if(Ti(C,y)&&o.ref===c.ref)if(nn=!1,c.pendingProps=y=C,(o.lanes&N)!==0)(o.flags&131072)!==0&&(nn=!0);else return c.lanes=o.lanes,Vr(o,c,N)}return af(o,c,m,y,N)}function Fk(o,c,m){var y=c.pendingProps,N=y.children,C=o!==null?o.memoizedState:null;if(y.mode==="hidden")if((c.mode&1)===0)c.memoizedState={baseLanes:0,cachePool:null,transitions:null},tt(vo,gn),gn|=m;else{if((m&1073741824)===0)return o=C!==null?C.baseLanes|m:m,c.lanes=c.childLanes=1073741824,c.memoizedState={baseLanes:o,cachePool:null,transitions:null},c.updateQueue=null,tt(vo,gn),gn|=o,null;c.memoizedState={baseLanes:0,cachePool:null,transitions:null},y=C!==null?C.baseLanes:m,tt(vo,gn),gn|=y}else C!==null?(y=C.baseLanes|m,c.memoizedState=null):y=m,tt(vo,gn),gn|=y;return Zt(o,c,N,m),c.child}function qk(o,c){var m=c.ref;(o===null&&m!==null||o!==null&&o.ref!==m)&&(c.flags|=512,c.flags|=2097152)}function af(o,c,m,y,N){var C=tn(m)?ua:zt.current;return C=lo(c,C),mo(c,N),m=Yh(o,c,m,y,C,N),y=Xh(),o!==null&&!nn?(c.updateQueue=o.updateQueue,c.flags&=-2053,o.lanes&=~N,Vr(o,c,N)):(lt&&y&&Mh(c),c.flags|=1,Zt(o,c,m,N),c.child)}function Bk(o,c,m,y,N){if(tn(m)){var C=!0;vc(c)}else C=!1;if(mo(c,N),c.stateNode===null)Pc(o,c),Tk(c,m,y),nf(c,m,y,N),y=!0;else if(o===null){var B=c.stateNode,Q=c.memoizedProps;B.props=Q;var te=B.context,le=m.contextType;typeof le=="object"&&le!==null?le=Cn(le):(le=tn(m)?ua:zt.current,le=lo(c,le));var me=m.getDerivedStateFromProps,ye=typeof me=="function"||typeof B.getSnapshotBeforeUpdate=="function";ye||typeof B.UNSAFE_componentWillReceiveProps!="function"&&typeof B.componentWillReceiveProps!="function"||(Q!==y||te!==le)&&Rk(c,B,y,le),_s=!1;var pe=c.memoizedState;B.state=pe,Cc(c,y,B,N),te=c.memoizedState,Q!==y||pe!==te||en.current||_s?(typeof me=="function"&&(tf(c,m,me,y),te=c.memoizedState),(Q=_s||Ck(c,m,Q,y,pe,te,le))?(ye||typeof B.UNSAFE_componentWillMount!="function"&&typeof B.componentWillMount!="function"||(typeof B.componentWillMount=="function"&&B.componentWillMount(),typeof B.UNSAFE_componentWillMount=="function"&&B.UNSAFE_componentWillMount()),typeof B.componentDidMount=="function"&&(c.flags|=4194308)):(typeof B.componentDidMount=="function"&&(c.flags|=4194308),c.memoizedProps=y,c.memoizedState=te),B.props=y,B.state=te,B.context=le,y=Q):(typeof B.componentDidMount=="function"&&(c.flags|=4194308),y=!1)}else{B=c.stateNode,rk(o,c),Q=c.memoizedProps,le=c.type===c.elementType?Q:Kn(c.type,Q),B.props=le,ye=c.pendingProps,pe=B.context,te=m.contextType,typeof te=="object"&&te!==null?te=Cn(te):(te=tn(m)?ua:zt.current,te=lo(c,te));var Ne=m.getDerivedStateFromProps;(me=typeof Ne=="function"||typeof B.getSnapshotBeforeUpdate=="function")||typeof B.UNSAFE_componentWillReceiveProps!="function"&&typeof B.componentWillReceiveProps!="function"||(Q!==ye||pe!==te)&&Rk(c,B,y,te),_s=!1,pe=c.memoizedState,B.state=pe,Cc(c,y,B,N);var Se=c.memoizedState;Q!==ye||pe!==Se||en.current||_s?(typeof Ne=="function"&&(tf(c,m,Ne,y),Se=c.memoizedState),(le=_s||Ck(c,m,le,y,pe,Se,te)||!1)?(me||typeof B.UNSAFE_componentWillUpdate!="function"&&typeof B.componentWillUpdate!="function"||(typeof B.componentWillUpdate=="function"&&B.componentWillUpdate(y,Se,te),typeof B.UNSAFE_componentWillUpdate=="function"&&B.UNSAFE_componentWillUpdate(y,Se,te)),typeof B.componentDidUpdate=="function"&&(c.flags|=4),typeof B.getSnapshotBeforeUpdate=="function"&&(c.flags|=1024)):(typeof B.componentDidUpdate!="function"||Q===o.memoizedProps&&pe===o.memoizedState||(c.flags|=4),typeof B.getSnapshotBeforeUpdate!="function"||Q===o.memoizedProps&&pe===o.memoizedState||(c.flags|=1024),c.memoizedProps=y,c.memoizedState=Se),B.props=y,B.state=Se,B.context=te,y=le):(typeof B.componentDidUpdate!="function"||Q===o.memoizedProps&&pe===o.memoizedState||(c.flags|=4),typeof B.getSnapshotBeforeUpdate!="function"||Q===o.memoizedProps&&pe===o.memoizedState||(c.flags|=1024),y=!1)}return of(o,c,m,y,C,N)}function of(o,c,m,y,N,C){qk(o,c);var B=(c.flags&128)!==0;if(!y&&!B)return N&&Vb(c,m,!1),Vr(o,c,C);y=c.stateNode,bL.current=c;var Q=B&&typeof m.getDerivedStateFromError!="function"?null:y.render();return c.flags|=1,o!==null&&B?(c.child=fo(c,o.child,null,C),c.child=fo(c,null,Q,C)):Zt(o,c,Q,C),c.memoizedState=y.state,N&&Vb(c,m,!0),c.child}function Uk(o){var c=o.stateNode;c.pendingContext?Hb(o,c.pendingContext,c.pendingContext!==c.context):c.context&&Hb(o,c.context,!1),zh(o,c.containerInfo)}function zk(o,c,m,y,N){return ho(),Lh(N),c.flags|=256,Zt(o,c,m,y),c.child}var lf={dehydrated:null,treeContext:null,retryLane:0};function cf(o){return{baseLanes:o,cachePool:null,transitions:null}}function Hk(o,c,m){var y=c.pendingProps,N=ut.current,C=!1,B=(c.flags&128)!==0,Q;if((Q=B)||(Q=o!==null&&o.memoizedState===null?!1:(N&2)!==0),Q?(C=!0,c.flags&=-129):(o===null||o.memoizedState!==null)&&(N|=1),tt(ut,N&1),o===null)return Oh(c),o=c.memoizedState,o!==null&&(o=o.dehydrated,o!==null)?((c.mode&1)===0?c.lanes=1:o.data==="$!"?c.lanes=8:c.lanes=1073741824,null):(B=y.children,o=y.fallback,C?(y=c.mode,C=c.child,B={mode:"hidden",children:B},(y&1)===0&&C!==null?(C.childLanes=0,C.pendingProps=B):C=Yc(B,y,0,null),o=xa(o,y,m,null),C.return=c,o.return=c,C.sibling=o,c.child=C,c.child.memoizedState=cf(m),c.memoizedState=lf,o):uf(c,B));if(N=o.memoizedState,N!==null&&(Q=N.dehydrated,Q!==null))return kL(o,c,B,y,Q,N,m);if(C){C=y.fallback,B=c.mode,N=o.child,Q=N.sibling;var te={mode:"hidden",children:y.children};return(B&1)===0&&c.child!==N?(y=c.child,y.childLanes=0,y.pendingProps=te,c.deletions=null):(y=$s(N,te),y.subtreeFlags=N.subtreeFlags&14680064),Q!==null?C=$s(Q,C):(C=xa(C,B,m,null),C.flags|=2),C.return=c,y.return=c,y.sibling=C,c.child=y,y=C,C=c.child,B=o.child.memoizedState,B=B===null?cf(m):{baseLanes:B.baseLanes|m,cachePool:null,transitions:B.transitions},C.memoizedState=B,C.childLanes=o.childLanes&~m,c.memoizedState=lf,y}return C=o.child,o=C.sibling,y=$s(C,{mode:"visible",children:y.children}),(c.mode&1)===0&&(y.lanes=m),y.return=c,y.sibling=null,o!==null&&(m=c.deletions,m===null?(c.deletions=[o],c.flags|=16):m.push(o)),c.child=y,c.memoizedState=null,y}function uf(o,c){return c=Yc({mode:"visible",children:c},o.mode,0,null),c.return=o,o.child=c}function Lc(o,c,m,y){return y!==null&&Lh(y),fo(c,o.child,null,m),o=uf(c,c.pendingProps.children),o.flags|=2,c.memoizedState=null,o}function kL(o,c,m,y,N,C,B){if(m)return c.flags&256?(c.flags&=-257,y=rf(Error(n(422))),Lc(o,c,B,y)):c.memoizedState!==null?(c.child=o.child,c.flags|=128,null):(C=y.fallback,N=c.mode,y=Yc({mode:"visible",children:y.children},N,0,null),C=xa(C,N,B,null),C.flags|=2,y.return=c,C.return=c,y.sibling=C,c.child=y,(c.mode&1)!==0&&fo(c,o.child,null,B),c.child.memoizedState=cf(B),c.memoizedState=lf,C);if((c.mode&1)===0)return Lc(o,c,B,null);if(N.data==="$!"){if(y=N.nextSibling&&N.nextSibling.dataset,y)var Q=y.dgst;return y=Q,C=Error(n(419)),y=rf(C,y,void 0),Lc(o,c,B,y)}if(Q=(B&o.childLanes)!==0,nn||Q){if(y=Mt,y!==null){switch(B&-B){case 4:N=2;break;case 16:N=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:N=32;break;case 536870912:N=268435456;break;default:N=0}N=(N&(y.suspendedLanes|B))!==0?0:N,N!==0&&N!==C.retryLane&&(C.retryLane=N,Hr(o,N),Zn(y,o,N,-1))}return _f(),y=rf(Error(n(421))),Lc(o,c,B,y)}return N.data==="$?"?(c.flags|=128,c.child=o.child,c=OL.bind(null,o),N._reactRetry=c,null):(o=C.treeContext,mn=ks(N.nextSibling),pn=c,lt=!0,Gn=null,o!==null&&(_n[En++]=Ur,_n[En++]=zr,_n[En++]=da,Ur=o.id,zr=o.overflow,da=c),c=uf(c,y.children),c.flags|=4096,c)}function Wk(o,c,m){o.lanes|=c;var y=o.alternate;y!==null&&(y.lanes|=c),qh(o.return,c,m)}function df(o,c,m,y,N){var C=o.memoizedState;C===null?o.memoizedState={isBackwards:c,rendering:null,renderingStartTime:0,last:y,tail:m,tailMode:N}:(C.isBackwards=c,C.rendering=null,C.renderingStartTime=0,C.last=y,C.tail=m,C.tailMode=N)}function Vk(o,c,m){var y=c.pendingProps,N=y.revealOrder,C=y.tail;if(Zt(o,c,y.children,m),y=ut.current,(y&2)!==0)y=y&1|2,c.flags|=128;else{if(o!==null&&(o.flags&128)!==0)e:for(o=c.child;o!==null;){if(o.tag===13)o.memoizedState!==null&&Wk(o,m,c);else if(o.tag===19)Wk(o,m,c);else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===c)break e;for(;o.sibling===null;){if(o.return===null||o.return===c)break e;o=o.return}o.sibling.return=o.return,o=o.sibling}y&=1}if(tt(ut,y),(c.mode&1)===0)c.memoizedState=null;else switch(N){case"forwards":for(m=c.child,N=null;m!==null;)o=m.alternate,o!==null&&Tc(o)===null&&(N=m),m=m.sibling;m=N,m===null?(N=c.child,c.child=null):(N=m.sibling,m.sibling=null),df(c,!1,N,m,C);break;case"backwards":for(m=null,N=c.child,c.child=null;N!==null;){if(o=N.alternate,o!==null&&Tc(o)===null){c.child=N;break}o=N.sibling,N.sibling=m,m=N,N=o}df(c,!0,m,null,C);break;case"together":df(c,!1,null,null,void 0);break;default:c.memoizedState=null}return c.child}function Pc(o,c){(c.mode&1)===0&&o!==null&&(o.alternate=null,c.alternate=null,c.flags|=2)}function Vr(o,c,m){if(o!==null&&(c.dependencies=o.dependencies),ga|=c.lanes,(m&c.childLanes)===0)return null;if(o!==null&&c.child!==o.child)throw Error(n(153));if(c.child!==null){for(o=c.child,m=$s(o,o.pendingProps),c.child=m,m.return=c;o.sibling!==null;)o=o.sibling,m=m.sibling=$s(o,o.pendingProps),m.return=c;m.sibling=null}return c.child}function NL(o,c,m){switch(c.tag){case 3:Uk(c),ho();break;case 5:ok(c);break;case 1:tn(c.type)&&vc(c);break;case 4:zh(c,c.stateNode.containerInfo);break;case 10:var y=c.type._context,N=c.memoizedProps.value;tt(Sc,y._currentValue),y._currentValue=N;break;case 13:if(y=c.memoizedState,y!==null)return y.dehydrated!==null?(tt(ut,ut.current&1),c.flags|=128,null):(m&c.child.childLanes)!==0?Hk(o,c,m):(tt(ut,ut.current&1),o=Vr(o,c,m),o!==null?o.sibling:null);tt(ut,ut.current&1);break;case 19:if(y=(m&c.childLanes)!==0,(o.flags&128)!==0){if(y)return Vk(o,c,m);c.flags|=128}if(N=c.memoizedState,N!==null&&(N.rendering=null,N.tail=null,N.lastEffect=null),tt(ut,ut.current),y)break;return null;case 22:case 23:return c.lanes=0,Fk(o,c,m)}return Vr(o,c,m)}var Gk,hf,Kk,Yk;Gk=function(o,c){for(var m=c.child;m!==null;){if(m.tag===5||m.tag===6)o.appendChild(m.stateNode);else if(m.tag!==4&&m.child!==null){m.child.return=m,m=m.child;continue}if(m===c)break;for(;m.sibling===null;){if(m.return===null||m.return===c)return;m=m.return}m.sibling.return=m.return,m=m.sibling}},hf=function(){},Kk=function(o,c,m,y){var N=o.memoizedProps;if(N!==y){o=c.stateNode,pa(xr.current);var C=null;switch(m){case"input":N=we(o,N),y=we(o,y),C=[];break;case"select":N=z({},N,{value:void 0}),y=z({},y,{value:void 0}),C=[];break;case"textarea":N=Oe(o,N),y=Oe(o,y),C=[];break;default:typeof N.onClick!="function"&&typeof y.onClick=="function"&&(o.onclick=gc)}kt(m,y);var B;m=null;for(le in N)if(!y.hasOwnProperty(le)&&N.hasOwnProperty(le)&&N[le]!=null)if(le==="style"){var Q=N[le];for(B in Q)Q.hasOwnProperty(B)&&(m||(m={}),m[B]="")}else le!=="dangerouslySetInnerHTML"&&le!=="children"&&le!=="suppressContentEditableWarning"&&le!=="suppressHydrationWarning"&&le!=="autoFocus"&&(s.hasOwnProperty(le)?C||(C=[]):(C=C||[]).push(le,null));for(le in y){var te=y[le];if(Q=N!=null?N[le]:void 0,y.hasOwnProperty(le)&&te!==Q&&(te!=null||Q!=null))if(le==="style")if(Q){for(B in Q)!Q.hasOwnProperty(B)||te&&te.hasOwnProperty(B)||(m||(m={}),m[B]="");for(B in te)te.hasOwnProperty(B)&&Q[B]!==te[B]&&(m||(m={}),m[B]=te[B])}else m||(C||(C=[]),C.push(le,m)),m=te;else le==="dangerouslySetInnerHTML"?(te=te?te.__html:void 0,Q=Q?Q.__html:void 0,te!=null&&Q!==te&&(C=C||[]).push(le,te)):le==="children"?typeof te!="string"&&typeof te!="number"||(C=C||[]).push(le,""+te):le!=="suppressContentEditableWarning"&&le!=="suppressHydrationWarning"&&(s.hasOwnProperty(le)?(te!=null&&le==="onScroll"&&nt("scroll",o),C||Q===te||(C=[])):(C=C||[]).push(le,te))}m&&(C=C||[]).push("style",m);var le=C;(c.updateQueue=le)&&(c.flags|=4)}},Yk=function(o,c,m,y){m!==y&&(c.flags|=4)};function Hi(o,c){if(!lt)switch(o.tailMode){case"hidden":c=o.tail;for(var m=null;c!==null;)c.alternate!==null&&(m=c),c=c.sibling;m===null?o.tail=null:m.sibling=null;break;case"collapsed":m=o.tail;for(var y=null;m!==null;)m.alternate!==null&&(y=m),m=m.sibling;y===null?c||o.tail===null?o.tail=null:o.tail.sibling=null:y.sibling=null}}function Wt(o){var c=o.alternate!==null&&o.alternate.child===o.child,m=0,y=0;if(c)for(var N=o.child;N!==null;)m|=N.lanes|N.childLanes,y|=N.subtreeFlags&14680064,y|=N.flags&14680064,N.return=o,N=N.sibling;else for(N=o.child;N!==null;)m|=N.lanes|N.childLanes,y|=N.subtreeFlags,y|=N.flags,N.return=o,N=N.sibling;return o.subtreeFlags|=y,o.childLanes=m,c}function jL(o,c,m){var y=c.pendingProps;switch($h(c),c.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Wt(c),null;case 1:return tn(c.type)&&wc(),Wt(c),null;case 3:return y=c.stateNode,go(),rt(en),rt(zt),Vh(),y.pendingContext&&(y.context=y.pendingContext,y.pendingContext=null),(o===null||o.child===null)&&(Nc(c)?c.flags|=4:o===null||o.memoizedState.isDehydrated&&(c.flags&256)===0||(c.flags|=1024,Gn!==null&&(Nf(Gn),Gn=null))),hf(o,c),Wt(c),null;case 5:Hh(c);var N=pa(Fi.current);if(m=c.type,o!==null&&c.stateNode!=null)Kk(o,c,m,y,N),o.ref!==c.ref&&(c.flags|=512,c.flags|=2097152);else{if(!y){if(c.stateNode===null)throw Error(n(166));return Wt(c),null}if(o=pa(xr.current),Nc(c)){y=c.stateNode,m=c.type;var C=c.memoizedProps;switch(y[vr]=c,y[Ii]=C,o=(c.mode&1)!==0,m){case"dialog":nt("cancel",y),nt("close",y);break;case"iframe":case"object":case"embed":nt("load",y);break;case"video":case"audio":for(N=0;N<Ai.length;N++)nt(Ai[N],y);break;case"source":nt("error",y);break;case"img":case"image":case"link":nt("error",y),nt("load",y);break;case"details":nt("toggle",y);break;case"input":xe(y,C),nt("invalid",y);break;case"select":y._wrapperState={wasMultiple:!!C.multiple},nt("invalid",y);break;case"textarea":Le(y,C),nt("invalid",y)}kt(m,C),N=null;for(var B in C)if(C.hasOwnProperty(B)){var Q=C[B];B==="children"?typeof Q=="string"?y.textContent!==Q&&(C.suppressHydrationWarning!==!0&&mc(y.textContent,Q,o),N=["children",Q]):typeof Q=="number"&&y.textContent!==""+Q&&(C.suppressHydrationWarning!==!0&&mc(y.textContent,Q,o),N=["children",""+Q]):s.hasOwnProperty(B)&&Q!=null&&B==="onScroll"&&nt("scroll",y)}switch(m){case"input":ie(y),he(y,C,!0);break;case"textarea":ie(y),qe(y);break;case"select":case"option":break;default:typeof C.onClick=="function"&&(y.onclick=gc)}y=N,c.updateQueue=y,y!==null&&(c.flags|=4)}else{B=N.nodeType===9?N:N.ownerDocument,o==="http://www.w3.org/1999/xhtml"&&(o=Ue(m)),o==="http://www.w3.org/1999/xhtml"?m==="script"?(o=B.createElement("div"),o.innerHTML="<script><\/script>",o=o.removeChild(o.firstChild)):typeof y.is=="string"?o=B.createElement(m,{is:y.is}):(o=B.createElement(m),m==="select"&&(B=o,y.multiple?B.multiple=!0:y.size&&(B.size=y.size))):o=B.createElementNS(o,m),o[vr]=c,o[Ii]=y,Gk(o,c,!1,!1),c.stateNode=o;e:{switch(B=Nt(m,y),m){case"dialog":nt("cancel",o),nt("close",o),N=y;break;case"iframe":case"object":case"embed":nt("load",o),N=y;break;case"video":case"audio":for(N=0;N<Ai.length;N++)nt(Ai[N],o);N=y;break;case"source":nt("error",o),N=y;break;case"img":case"image":case"link":nt("error",o),nt("load",o),N=y;break;case"details":nt("toggle",o),N=y;break;case"input":xe(o,y),N=we(o,y),nt("invalid",o);break;case"option":N=y;break;case"select":o._wrapperState={wasMultiple:!!y.multiple},N=z({},y,{value:void 0}),nt("invalid",o);break;case"textarea":Le(o,y),N=Oe(o,y),nt("invalid",o);break;default:N=y}kt(m,N),Q=N;for(C in Q)if(Q.hasOwnProperty(C)){var te=Q[C];C==="style"?it(o,te):C==="dangerouslySetInnerHTML"?(te=te?te.__html:void 0,te!=null&&at(o,te)):C==="children"?typeof te=="string"?(m!=="textarea"||te!=="")&>(o,te):typeof te=="number"&>(o,""+te):C!=="suppressContentEditableWarning"&&C!=="suppressHydrationWarning"&&C!=="autoFocus"&&(s.hasOwnProperty(C)?te!=null&&C==="onScroll"&&nt("scroll",o):te!=null&&_(o,C,te,B))}switch(m){case"input":ie(o),he(o,y,!1);break;case"textarea":ie(o),qe(o);break;case"option":y.value!=null&&o.setAttribute("value",""+ee(y.value));break;case"select":o.multiple=!!y.multiple,C=y.value,C!=null?Ce(o,!!y.multiple,C,!1):y.defaultValue!=null&&Ce(o,!!y.multiple,y.defaultValue,!0);break;default:typeof N.onClick=="function"&&(o.onclick=gc)}switch(m){case"button":case"input":case"select":case"textarea":y=!!y.autoFocus;break e;case"img":y=!0;break e;default:y=!1}}y&&(c.flags|=4)}c.ref!==null&&(c.flags|=512,c.flags|=2097152)}return Wt(c),null;case 6:if(o&&c.stateNode!=null)Yk(o,c,o.memoizedProps,y);else{if(typeof y!="string"&&c.stateNode===null)throw Error(n(166));if(m=pa(Fi.current),pa(xr.current),Nc(c)){if(y=c.stateNode,m=c.memoizedProps,y[vr]=c,(C=y.nodeValue!==m)&&(o=pn,o!==null))switch(o.tag){case 3:mc(y.nodeValue,m,(o.mode&1)!==0);break;case 5:o.memoizedProps.suppressHydrationWarning!==!0&&mc(y.nodeValue,m,(o.mode&1)!==0)}C&&(c.flags|=4)}else y=(m.nodeType===9?m:m.ownerDocument).createTextNode(y),y[vr]=c,c.stateNode=y}return Wt(c),null;case 13:if(rt(ut),y=c.memoizedState,o===null||o.memoizedState!==null&&o.memoizedState.dehydrated!==null){if(lt&&mn!==null&&(c.mode&1)!==0&&(c.flags&128)===0)Jb(),ho(),c.flags|=98560,C=!1;else if(C=Nc(c),y!==null&&y.dehydrated!==null){if(o===null){if(!C)throw Error(n(318));if(C=c.memoizedState,C=C!==null?C.dehydrated:null,!C)throw Error(n(317));C[vr]=c}else ho(),(c.flags&128)===0&&(c.memoizedState=null),c.flags|=4;Wt(c),C=!1}else Gn!==null&&(Nf(Gn),Gn=null),C=!0;if(!C)return c.flags&65536?c:null}return(c.flags&128)!==0?(c.lanes=m,c):(y=y!==null,y!==(o!==null&&o.memoizedState!==null)&&y&&(c.child.flags|=8192,(c.mode&1)!==0&&(o===null||(ut.current&1)!==0?_t===0&&(_t=3):_f())),c.updateQueue!==null&&(c.flags|=4),Wt(c),null);case 4:return go(),hf(o,c),o===null&&Mi(c.stateNode.containerInfo),Wt(c),null;case 10:return Fh(c.type._context),Wt(c),null;case 17:return tn(c.type)&&wc(),Wt(c),null;case 19:if(rt(ut),C=c.memoizedState,C===null)return Wt(c),null;if(y=(c.flags&128)!==0,B=C.rendering,B===null)if(y)Hi(C,!1);else{if(_t!==0||o!==null&&(o.flags&128)!==0)for(o=c.child;o!==null;){if(B=Tc(o),B!==null){for(c.flags|=128,Hi(C,!1),y=B.updateQueue,y!==null&&(c.updateQueue=y,c.flags|=4),c.subtreeFlags=0,y=m,m=c.child;m!==null;)C=m,o=y,C.flags&=14680066,B=C.alternate,B===null?(C.childLanes=0,C.lanes=o,C.child=null,C.subtreeFlags=0,C.memoizedProps=null,C.memoizedState=null,C.updateQueue=null,C.dependencies=null,C.stateNode=null):(C.childLanes=B.childLanes,C.lanes=B.lanes,C.child=B.child,C.subtreeFlags=0,C.deletions=null,C.memoizedProps=B.memoizedProps,C.memoizedState=B.memoizedState,C.updateQueue=B.updateQueue,C.type=B.type,o=B.dependencies,C.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext}),m=m.sibling;return tt(ut,ut.current&1|2),c.child}o=o.sibling}C.tail!==null&&Ye()>xo&&(c.flags|=128,y=!0,Hi(C,!1),c.lanes=4194304)}else{if(!y)if(o=Tc(B),o!==null){if(c.flags|=128,y=!0,m=o.updateQueue,m!==null&&(c.updateQueue=m,c.flags|=4),Hi(C,!0),C.tail===null&&C.tailMode==="hidden"&&!B.alternate&&!lt)return Wt(c),null}else 2*Ye()-C.renderingStartTime>xo&&m!==1073741824&&(c.flags|=128,y=!0,Hi(C,!1),c.lanes=4194304);C.isBackwards?(B.sibling=c.child,c.child=B):(m=C.last,m!==null?m.sibling=B:c.child=B,C.last=B)}return C.tail!==null?(c=C.tail,C.rendering=c,C.tail=c.sibling,C.renderingStartTime=Ye(),c.sibling=null,m=ut.current,tt(ut,y?m&1|2:m&1),c):(Wt(c),null);case 22:case 23:return Sf(),y=c.memoizedState!==null,o!==null&&o.memoizedState!==null!==y&&(c.flags|=8192),y&&(c.mode&1)!==0?(gn&1073741824)!==0&&(Wt(c),c.subtreeFlags&6&&(c.flags|=8192)):Wt(c),null;case 24:return null;case 25:return null}throw Error(n(156,c.tag))}function SL(o,c){switch($h(c),c.tag){case 1:return tn(c.type)&&wc(),o=c.flags,o&65536?(c.flags=o&-65537|128,c):null;case 3:return go(),rt(en),rt(zt),Vh(),o=c.flags,(o&65536)!==0&&(o&128)===0?(c.flags=o&-65537|128,c):null;case 5:return Hh(c),null;case 13:if(rt(ut),o=c.memoizedState,o!==null&&o.dehydrated!==null){if(c.alternate===null)throw Error(n(340));ho()}return o=c.flags,o&65536?(c.flags=o&-65537|128,c):null;case 19:return rt(ut),null;case 4:return go(),null;case 10:return Fh(c.type._context),null;case 22:case 23:return Sf(),null;case 24:return null;default:return null}}var Dc=!1,Vt=!1,_L=typeof WeakSet=="function"?WeakSet:Set,je=null;function wo(o,c){var m=o.ref;if(m!==null)if(typeof m=="function")try{m(null)}catch(y){ht(o,c,y)}else m.current=null}function ff(o,c,m){try{m()}catch(y){ht(o,c,y)}}var Xk=!1;function EL(o,c){if(jh=vs,o=Cb(),gh(o)){if("selectionStart"in o)var m={start:o.selectionStart,end:o.selectionEnd};else e:{m=(m=o.ownerDocument)&&m.defaultView||window;var y=m.getSelection&&m.getSelection();if(y&&y.rangeCount!==0){m=y.anchorNode;var N=y.anchorOffset,C=y.focusNode;y=y.focusOffset;try{m.nodeType,C.nodeType}catch{m=null;break e}var B=0,Q=-1,te=-1,le=0,me=0,ye=o,pe=null;t:for(;;){for(var Ne;ye!==m||N!==0&&ye.nodeType!==3||(Q=B+N),ye!==C||y!==0&&ye.nodeType!==3||(te=B+y),ye.nodeType===3&&(B+=ye.nodeValue.length),(Ne=ye.firstChild)!==null;)pe=ye,ye=Ne;for(;;){if(ye===o)break t;if(pe===m&&++le===N&&(Q=B),pe===C&&++me===y&&(te=B),(Ne=ye.nextSibling)!==null)break;ye=pe,pe=ye.parentNode}ye=Ne}m=Q===-1||te===-1?null:{start:Q,end:te}}else m=null}m=m||{start:0,end:0}}else m=null;for(Sh={focusedElem:o,selectionRange:m},vs=!1,je=c;je!==null;)if(c=je,o=c.child,(c.subtreeFlags&1028)!==0&&o!==null)o.return=c,je=o;else for(;je!==null;){c=je;try{var Se=c.alternate;if((c.flags&1024)!==0)switch(c.tag){case 0:case 11:case 15:break;case 1:if(Se!==null){var _e=Se.memoizedProps,pt=Se.memoizedState,ae=c.stateNode,ne=ae.getSnapshotBeforeUpdate(c.elementType===c.type?_e:Kn(c.type,_e),pt);ae.__reactInternalSnapshotBeforeUpdate=ne}break;case 3:var oe=c.stateNode.containerInfo;oe.nodeType===1?oe.textContent="":oe.nodeType===9&&oe.documentElement&&oe.removeChild(oe.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(ve){ht(c,c.return,ve)}if(o=c.sibling,o!==null){o.return=c.return,je=o;break}je=c.return}return Se=Xk,Xk=!1,Se}function Wi(o,c,m){var y=c.updateQueue;if(y=y!==null?y.lastEffect:null,y!==null){var N=y=y.next;do{if((N.tag&o)===o){var C=N.destroy;N.destroy=void 0,C!==void 0&&ff(c,m,C)}N=N.next}while(N!==y)}}function Fc(o,c){if(c=c.updateQueue,c=c!==null?c.lastEffect:null,c!==null){var m=c=c.next;do{if((m.tag&o)===o){var y=m.create;m.destroy=y()}m=m.next}while(m!==c)}}function pf(o){var c=o.ref;if(c!==null){var m=o.stateNode;switch(o.tag){case 5:o=m;break;default:o=m}typeof c=="function"?c(o):c.current=o}}function Zk(o){var c=o.alternate;c!==null&&(o.alternate=null,Zk(c)),o.child=null,o.deletions=null,o.sibling=null,o.tag===5&&(c=o.stateNode,c!==null&&(delete c[vr],delete c[Ii],delete c[Th],delete c[cL],delete c[uL])),o.stateNode=null,o.return=null,o.dependencies=null,o.memoizedProps=null,o.memoizedState=null,o.pendingProps=null,o.stateNode=null,o.updateQueue=null}function Jk(o){return o.tag===5||o.tag===3||o.tag===4}function Qk(o){e:for(;;){for(;o.sibling===null;){if(o.return===null||Jk(o.return))return null;o=o.return}for(o.sibling.return=o.return,o=o.sibling;o.tag!==5&&o.tag!==6&&o.tag!==18;){if(o.flags&2||o.child===null||o.tag===4)continue e;o.child.return=o,o=o.child}if(!(o.flags&2))return o.stateNode}}function mf(o,c,m){var y=o.tag;if(y===5||y===6)o=o.stateNode,c?m.nodeType===8?m.parentNode.insertBefore(o,c):m.insertBefore(o,c):(m.nodeType===8?(c=m.parentNode,c.insertBefore(o,m)):(c=m,c.appendChild(o)),m=m._reactRootContainer,m!=null||c.onclick!==null||(c.onclick=gc));else if(y!==4&&(o=o.child,o!==null))for(mf(o,c,m),o=o.sibling;o!==null;)mf(o,c,m),o=o.sibling}function gf(o,c,m){var y=o.tag;if(y===5||y===6)o=o.stateNode,c?m.insertBefore(o,c):m.appendChild(o);else if(y!==4&&(o=o.child,o!==null))for(gf(o,c,m),o=o.sibling;o!==null;)gf(o,c,m),o=o.sibling}var Lt=null,Yn=!1;function Cs(o,c,m){for(m=m.child;m!==null;)e1(o,c,m),m=m.sibling}function e1(o,c,m){if(Yt&&typeof Yt.onCommitFiberUnmount=="function")try{Yt.onCommitFiberUnmount(hs,m)}catch{}switch(m.tag){case 5:Vt||wo(m,c);case 6:var y=Lt,N=Yn;Lt=null,Cs(o,c,m),Lt=y,Yn=N,Lt!==null&&(Yn?(o=Lt,m=m.stateNode,o.nodeType===8?o.parentNode.removeChild(m):o.removeChild(m)):Lt.removeChild(m.stateNode));break;case 18:Lt!==null&&(Yn?(o=Lt,m=m.stateNode,o.nodeType===8?Ch(o.parentNode,m):o.nodeType===1&&Ch(o,m),Or(o)):Ch(Lt,m.stateNode));break;case 4:y=Lt,N=Yn,Lt=m.stateNode.containerInfo,Yn=!0,Cs(o,c,m),Lt=y,Yn=N;break;case 0:case 11:case 14:case 15:if(!Vt&&(y=m.updateQueue,y!==null&&(y=y.lastEffect,y!==null))){N=y=y.next;do{var C=N,B=C.destroy;C=C.tag,B!==void 0&&((C&2)!==0||(C&4)!==0)&&ff(m,c,B),N=N.next}while(N!==y)}Cs(o,c,m);break;case 1:if(!Vt&&(wo(m,c),y=m.stateNode,typeof y.componentWillUnmount=="function"))try{y.props=m.memoizedProps,y.state=m.memoizedState,y.componentWillUnmount()}catch(Q){ht(m,c,Q)}Cs(o,c,m);break;case 21:Cs(o,c,m);break;case 22:m.mode&1?(Vt=(y=Vt)||m.memoizedState!==null,Cs(o,c,m),Vt=y):Cs(o,c,m);break;default:Cs(o,c,m)}}function t1(o){var c=o.updateQueue;if(c!==null){o.updateQueue=null;var m=o.stateNode;m===null&&(m=o.stateNode=new _L),c.forEach(function(y){var N=LL.bind(null,o,y);m.has(y)||(m.add(y),y.then(N,N))})}}function Xn(o,c){var m=c.deletions;if(m!==null)for(var y=0;y<m.length;y++){var N=m[y];try{var C=o,B=c,Q=B;e:for(;Q!==null;){switch(Q.tag){case 5:Lt=Q.stateNode,Yn=!1;break e;case 3:Lt=Q.stateNode.containerInfo,Yn=!0;break e;case 4:Lt=Q.stateNode.containerInfo,Yn=!0;break e}Q=Q.return}if(Lt===null)throw Error(n(160));e1(C,B,N),Lt=null,Yn=!1;var te=N.alternate;te!==null&&(te.return=null),N.return=null}catch(le){ht(N,c,le)}}if(c.subtreeFlags&12854)for(c=c.child;c!==null;)n1(c,o),c=c.sibling}function n1(o,c){var m=o.alternate,y=o.flags;switch(o.tag){case 0:case 11:case 14:case 15:if(Xn(c,o),kr(o),y&4){try{Wi(3,o,o.return),Fc(3,o)}catch(_e){ht(o,o.return,_e)}try{Wi(5,o,o.return)}catch(_e){ht(o,o.return,_e)}}break;case 1:Xn(c,o),kr(o),y&512&&m!==null&&wo(m,m.return);break;case 5:if(Xn(c,o),kr(o),y&512&&m!==null&&wo(m,m.return),o.flags&32){var N=o.stateNode;try{gt(N,"")}catch(_e){ht(o,o.return,_e)}}if(y&4&&(N=o.stateNode,N!=null)){var C=o.memoizedProps,B=m!==null?m.memoizedProps:C,Q=o.type,te=o.updateQueue;if(o.updateQueue=null,te!==null)try{Q==="input"&&C.type==="radio"&&C.name!=null&&$e(N,C),Nt(Q,B);var le=Nt(Q,C);for(B=0;B<te.length;B+=2){var me=te[B],ye=te[B+1];me==="style"?it(N,ye):me==="dangerouslySetInnerHTML"?at(N,ye):me==="children"?gt(N,ye):_(N,me,ye,le)}switch(Q){case"input":be(N,C);break;case"textarea":Pe(N,C);break;case"select":var pe=N._wrapperState.wasMultiple;N._wrapperState.wasMultiple=!!C.multiple;var Ne=C.value;Ne!=null?Ce(N,!!C.multiple,Ne,!1):pe!==!!C.multiple&&(C.defaultValue!=null?Ce(N,!!C.multiple,C.defaultValue,!0):Ce(N,!!C.multiple,C.multiple?[]:"",!1))}N[Ii]=C}catch(_e){ht(o,o.return,_e)}}break;case 6:if(Xn(c,o),kr(o),y&4){if(o.stateNode===null)throw Error(n(162));N=o.stateNode,C=o.memoizedProps;try{N.nodeValue=C}catch(_e){ht(o,o.return,_e)}}break;case 3:if(Xn(c,o),kr(o),y&4&&m!==null&&m.memoizedState.isDehydrated)try{Or(c.containerInfo)}catch(_e){ht(o,o.return,_e)}break;case 4:Xn(c,o),kr(o);break;case 13:Xn(c,o),kr(o),N=o.child,N.flags&8192&&(C=N.memoizedState!==null,N.stateNode.isHidden=C,!C||N.alternate!==null&&N.alternate.memoizedState!==null||(vf=Ye())),y&4&&t1(o);break;case 22:if(me=m!==null&&m.memoizedState!==null,o.mode&1?(Vt=(le=Vt)||me,Xn(c,o),Vt=le):Xn(c,o),kr(o),y&8192){if(le=o.memoizedState!==null,(o.stateNode.isHidden=le)&&!me&&(o.mode&1)!==0)for(je=o,me=o.child;me!==null;){for(ye=je=me;je!==null;){switch(pe=je,Ne=pe.child,pe.tag){case 0:case 11:case 14:case 15:Wi(4,pe,pe.return);break;case 1:wo(pe,pe.return);var Se=pe.stateNode;if(typeof Se.componentWillUnmount=="function"){y=pe,m=pe.return;try{c=y,Se.props=c.memoizedProps,Se.state=c.memoizedState,Se.componentWillUnmount()}catch(_e){ht(y,m,_e)}}break;case 5:wo(pe,pe.return);break;case 22:if(pe.memoizedState!==null){a1(ye);continue}}Ne!==null?(Ne.return=pe,je=Ne):a1(ye)}me=me.sibling}e:for(me=null,ye=o;;){if(ye.tag===5){if(me===null){me=ye;try{N=ye.stateNode,le?(C=N.style,typeof C.setProperty=="function"?C.setProperty("display","none","important"):C.display="none"):(Q=ye.stateNode,te=ye.memoizedProps.style,B=te!=null&&te.hasOwnProperty("display")?te.display:null,Q.style.display=Je("display",B))}catch(_e){ht(o,o.return,_e)}}}else if(ye.tag===6){if(me===null)try{ye.stateNode.nodeValue=le?"":ye.memoizedProps}catch(_e){ht(o,o.return,_e)}}else if((ye.tag!==22&&ye.tag!==23||ye.memoizedState===null||ye===o)&&ye.child!==null){ye.child.return=ye,ye=ye.child;continue}if(ye===o)break e;for(;ye.sibling===null;){if(ye.return===null||ye.return===o)break e;me===ye&&(me=null),ye=ye.return}me===ye&&(me=null),ye.sibling.return=ye.return,ye=ye.sibling}}break;case 19:Xn(c,o),kr(o),y&4&&t1(o);break;case 21:break;default:Xn(c,o),kr(o)}}function kr(o){var c=o.flags;if(c&2){try{e:{for(var m=o.return;m!==null;){if(Jk(m)){var y=m;break e}m=m.return}throw Error(n(160))}switch(y.tag){case 5:var N=y.stateNode;y.flags&32&&(gt(N,""),y.flags&=-33);var C=Qk(o);gf(o,C,N);break;case 3:case 4:var B=y.stateNode.containerInfo,Q=Qk(o);mf(o,Q,B);break;default:throw Error(n(161))}}catch(te){ht(o,o.return,te)}o.flags&=-3}c&4096&&(o.flags&=-4097)}function CL(o,c,m){je=o,r1(o)}function r1(o,c,m){for(var y=(o.mode&1)!==0;je!==null;){var N=je,C=N.child;if(N.tag===22&&y){var B=N.memoizedState!==null||Dc;if(!B){var Q=N.alternate,te=Q!==null&&Q.memoizedState!==null||Vt;Q=Dc;var le=Vt;if(Dc=B,(Vt=te)&&!le)for(je=N;je!==null;)B=je,te=B.child,B.tag===22&&B.memoizedState!==null?o1(N):te!==null?(te.return=B,je=te):o1(N);for(;C!==null;)je=C,r1(C),C=C.sibling;je=N,Dc=Q,Vt=le}s1(o)}else(N.subtreeFlags&8772)!==0&&C!==null?(C.return=N,je=C):s1(o)}}function s1(o){for(;je!==null;){var c=je;if((c.flags&8772)!==0){var m=c.alternate;try{if((c.flags&8772)!==0)switch(c.tag){case 0:case 11:case 15:Vt||Fc(5,c);break;case 1:var y=c.stateNode;if(c.flags&4&&!Vt)if(m===null)y.componentDidMount();else{var N=c.elementType===c.type?m.memoizedProps:Kn(c.type,m.memoizedProps);y.componentDidUpdate(N,m.memoizedState,y.__reactInternalSnapshotBeforeUpdate)}var C=c.updateQueue;C!==null&&ak(c,C,y);break;case 3:var B=c.updateQueue;if(B!==null){if(m=null,c.child!==null)switch(c.child.tag){case 5:m=c.child.stateNode;break;case 1:m=c.child.stateNode}ak(c,B,m)}break;case 5:var Q=c.stateNode;if(m===null&&c.flags&4){m=Q;var te=c.memoizedProps;switch(c.type){case"button":case"input":case"select":case"textarea":te.autoFocus&&m.focus();break;case"img":te.src&&(m.src=te.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(c.memoizedState===null){var le=c.alternate;if(le!==null){var me=le.memoizedState;if(me!==null){var ye=me.dehydrated;ye!==null&&Or(ye)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}Vt||c.flags&512&&pf(c)}catch(pe){ht(c,c.return,pe)}}if(c===o){je=null;break}if(m=c.sibling,m!==null){m.return=c.return,je=m;break}je=c.return}}function a1(o){for(;je!==null;){var c=je;if(c===o){je=null;break}var m=c.sibling;if(m!==null){m.return=c.return,je=m;break}je=c.return}}function o1(o){for(;je!==null;){var c=je;try{switch(c.tag){case 0:case 11:case 15:var m=c.return;try{Fc(4,c)}catch(te){ht(c,m,te)}break;case 1:var y=c.stateNode;if(typeof y.componentDidMount=="function"){var N=c.return;try{y.componentDidMount()}catch(te){ht(c,N,te)}}var C=c.return;try{pf(c)}catch(te){ht(c,C,te)}break;case 5:var B=c.return;try{pf(c)}catch(te){ht(c,B,te)}}}catch(te){ht(c,c.return,te)}if(c===o){je=null;break}var Q=c.sibling;if(Q!==null){Q.return=c.return,je=Q;break}je=c.return}}var TL=Math.ceil,qc=E.ReactCurrentDispatcher,yf=E.ReactCurrentOwner,Rn=E.ReactCurrentBatchConfig,Ve=0,Mt=null,wt=null,Pt=0,gn=0,vo=Ns(0),_t=0,Vi=null,ga=0,Bc=0,wf=0,Gi=null,rn=null,vf=0,xo=1/0,Gr=null,Uc=!1,xf=null,Ts=null,zc=!1,Rs=null,Hc=0,Ki=0,bf=null,Wc=-1,Vc=0;function Jt(){return(Ve&6)!==0?Ye():Wc!==-1?Wc:Wc=Ye()}function As(o){return(o.mode&1)===0?1:(Ve&2)!==0&&Pt!==0?Pt&-Pt:hL.transition!==null?(Vc===0&&(Vc=yi()),Vc):(o=We,o!==0||(o=window.event,o=o===void 0?16:ia(o.type)),o)}function Zn(o,c,m,y){if(50<Ki)throw Ki=0,bf=null,Error(n(185));ea(o,m,y),((Ve&2)===0||o!==Mt)&&(o===Mt&&((Ve&2)===0&&(Bc|=m),_t===4&&Ms(o,Pt)),sn(o,y),m===1&&Ve===0&&(c.mode&1)===0&&(xo=Ye()+500,xc&&Ss()))}function sn(o,c){var m=o.callbackNode;ch(o,c);var y=Sn(o,o===Mt?Pt:0);if(y===0)m!==null&&fr(m),o.callbackNode=null,o.callbackPriority=0;else if(c=y&-y,o.callbackPriority!==c){if(m!=null&&fr(m),c===1)o.tag===0?dL(l1.bind(null,o)):Gb(l1.bind(null,o)),iL(function(){(Ve&6)===0&&Ss()}),m=null;else{switch(Ql(y)){case 1:m=pr;break;case 4:m=Xa;break;case 16:m=ds;break;case 536870912:m=Js;break;default:m=ds}m=g1(m,i1.bind(null,o))}o.callbackPriority=c,o.callbackNode=m}}function i1(o,c){if(Wc=-1,Vc=0,(Ve&6)!==0)throw Error(n(327));var m=o.callbackNode;if(bo()&&o.callbackNode!==m)return null;var y=Sn(o,o===Mt?Pt:0);if(y===0)return null;if((y&30)!==0||(y&o.expiredLanes)!==0||c)c=Gc(o,y);else{c=y;var N=Ve;Ve|=2;var C=u1();(Mt!==o||Pt!==c)&&(Gr=null,xo=Ye()+500,wa(o,c));do try{ML();break}catch(Q){c1(o,Q)}while(!0);Dh(),qc.current=C,Ve=N,wt!==null?c=0:(Mt=null,Pt=0,c=_t)}if(c!==0){if(c===2&&(N=gi(o),N!==0&&(y=N,c=kf(o,N))),c===1)throw m=Vi,wa(o,0),Ms(o,y),sn(o,Ye()),m;if(c===6)Ms(o,y);else{if(N=o.current.alternate,(y&30)===0&&!RL(N)&&(c=Gc(o,y),c===2&&(C=gi(o),C!==0&&(y=C,c=kf(o,C))),c===1))throw m=Vi,wa(o,0),Ms(o,y),sn(o,Ye()),m;switch(o.finishedWork=N,o.finishedLanes=y,c){case 0:case 1:throw Error(n(345));case 2:va(o,rn,Gr);break;case 3:if(Ms(o,y),(y&130023424)===y&&(c=vf+500-Ye(),10<c)){if(Sn(o,0)!==0)break;if(N=o.suspendedLanes,(N&y)!==y){Jt(),o.pingedLanes|=o.suspendedLanes&N;break}o.timeoutHandle=Eh(va.bind(null,o,rn,Gr),c);break}va(o,rn,Gr);break;case 4:if(Ms(o,y),(y&4194240)===y)break;for(c=o.eventTimes,N=-1;0<y;){var B=31-jt(y);C=1<<B,B=c[B],B>N&&(N=B),y&=~C}if(y=N,y=Ye()-y,y=(120>y?120:480>y?480:1080>y?1080:1920>y?1920:3e3>y?3e3:4320>y?4320:1960*TL(y/1960))-y,10<y){o.timeoutHandle=Eh(va.bind(null,o,rn,Gr),y);break}va(o,rn,Gr);break;case 5:va(o,rn,Gr);break;default:throw Error(n(329))}}}return sn(o,Ye()),o.callbackNode===m?i1.bind(null,o):null}function kf(o,c){var m=Gi;return o.current.memoizedState.isDehydrated&&(wa(o,c).flags|=256),o=Gc(o,c),o!==2&&(c=rn,rn=m,c!==null&&Nf(c)),o}function Nf(o){rn===null?rn=o:rn.push.apply(rn,o)}function RL(o){for(var c=o;;){if(c.flags&16384){var m=c.updateQueue;if(m!==null&&(m=m.stores,m!==null))for(var y=0;y<m.length;y++){var N=m[y],C=N.getSnapshot;N=N.value;try{if(!Vn(C(),N))return!1}catch{return!1}}}if(m=c.child,c.subtreeFlags&16384&&m!==null)m.return=c,c=m;else{if(c===o)break;for(;c.sibling===null;){if(c.return===null||c.return===o)return!0;c=c.return}c.sibling.return=c.return,c=c.sibling}}return!0}function Ms(o,c){for(c&=~wf,c&=~Bc,o.suspendedLanes|=c,o.pingedLanes&=~c,o=o.expirationTimes;0<c;){var m=31-jt(c),y=1<<m;o[m]=-1,c&=~y}}function l1(o){if((Ve&6)!==0)throw Error(n(327));bo();var c=Sn(o,0);if((c&1)===0)return sn(o,Ye()),null;var m=Gc(o,c);if(o.tag!==0&&m===2){var y=gi(o);y!==0&&(c=y,m=kf(o,y))}if(m===1)throw m=Vi,wa(o,0),Ms(o,c),sn(o,Ye()),m;if(m===6)throw Error(n(345));return o.finishedWork=o.current.alternate,o.finishedLanes=c,va(o,rn,Gr),sn(o,Ye()),null}function jf(o,c){var m=Ve;Ve|=1;try{return o(c)}finally{Ve=m,Ve===0&&(xo=Ye()+500,xc&&Ss())}}function ya(o){Rs!==null&&Rs.tag===0&&(Ve&6)===0&&bo();var c=Ve;Ve|=1;var m=Rn.transition,y=We;try{if(Rn.transition=null,We=1,o)return o()}finally{We=y,Rn.transition=m,Ve=c,(Ve&6)===0&&Ss()}}function Sf(){gn=vo.current,rt(vo)}function wa(o,c){o.finishedWork=null,o.finishedLanes=0;var m=o.timeoutHandle;if(m!==-1&&(o.timeoutHandle=-1,oL(m)),wt!==null)for(m=wt.return;m!==null;){var y=m;switch($h(y),y.tag){case 1:y=y.type.childContextTypes,y!=null&&wc();break;case 3:go(),rt(en),rt(zt),Vh();break;case 5:Hh(y);break;case 4:go();break;case 13:rt(ut);break;case 19:rt(ut);break;case 10:Fh(y.type._context);break;case 22:case 23:Sf()}m=m.return}if(Mt=o,wt=o=$s(o.current,null),Pt=gn=c,_t=0,Vi=null,wf=Bc=ga=0,rn=Gi=null,fa!==null){for(c=0;c<fa.length;c++)if(m=fa[c],y=m.interleaved,y!==null){m.interleaved=null;var N=y.next,C=m.pending;if(C!==null){var B=C.next;C.next=N,y.next=B}m.pending=y}fa=null}return o}function c1(o,c){do{var m=wt;try{if(Dh(),Rc.current=Ic,Ac){for(var y=dt.memoizedState;y!==null;){var N=y.queue;N!==null&&(N.pending=null),y=y.next}Ac=!1}if(ma=0,At=St=dt=null,qi=!1,Bi=0,yf.current=null,m===null||m.return===null){_t=1,Vi=c,wt=null;break}e:{var C=o,B=m.return,Q=m,te=c;if(c=Pt,Q.flags|=32768,te!==null&&typeof te=="object"&&typeof te.then=="function"){var le=te,me=Q,ye=me.tag;if((me.mode&1)===0&&(ye===0||ye===11||ye===15)){var pe=me.alternate;pe?(me.updateQueue=pe.updateQueue,me.memoizedState=pe.memoizedState,me.lanes=pe.lanes):(me.updateQueue=null,me.memoizedState=null)}var Ne=Ik(B);if(Ne!==null){Ne.flags&=-257,Ok(Ne,B,Q,C,c),Ne.mode&1&&$k(C,le,c),c=Ne,te=le;var Se=c.updateQueue;if(Se===null){var _e=new Set;_e.add(te),c.updateQueue=_e}else Se.add(te);break e}else{if((c&1)===0){$k(C,le,c),_f();break e}te=Error(n(426))}}else if(lt&&Q.mode&1){var pt=Ik(B);if(pt!==null){(pt.flags&65536)===0&&(pt.flags|=256),Ok(pt,B,Q,C,c),Lh(yo(te,Q));break e}}C=te=yo(te,Q),_t!==4&&(_t=2),Gi===null?Gi=[C]:Gi.push(C),C=B;do{switch(C.tag){case 3:C.flags|=65536,c&=-c,C.lanes|=c;var ae=Ak(C,te,c);sk(C,ae);break e;case 1:Q=te;var ne=C.type,oe=C.stateNode;if((C.flags&128)===0&&(typeof ne.getDerivedStateFromError=="function"||oe!==null&&typeof oe.componentDidCatch=="function"&&(Ts===null||!Ts.has(oe)))){C.flags|=65536,c&=-c,C.lanes|=c;var ve=Mk(C,Q,c);sk(C,ve);break e}}C=C.return}while(C!==null)}h1(m)}catch(Ee){c=Ee,wt===m&&m!==null&&(wt=m=m.return);continue}break}while(!0)}function u1(){var o=qc.current;return qc.current=Ic,o===null?Ic:o}function _f(){(_t===0||_t===3||_t===2)&&(_t=4),Mt===null||(ga&268435455)===0&&(Bc&268435455)===0||Ms(Mt,Pt)}function Gc(o,c){var m=Ve;Ve|=2;var y=u1();(Mt!==o||Pt!==c)&&(Gr=null,wa(o,c));do try{AL();break}catch(N){c1(o,N)}while(!0);if(Dh(),Ve=m,qc.current=y,wt!==null)throw Error(n(261));return Mt=null,Pt=0,_t}function AL(){for(;wt!==null;)d1(wt)}function ML(){for(;wt!==null&&!Ka();)d1(wt)}function d1(o){var c=m1(o.alternate,o,gn);o.memoizedProps=o.pendingProps,c===null?h1(o):wt=c,yf.current=null}function h1(o){var c=o;do{var m=c.alternate;if(o=c.return,(c.flags&32768)===0){if(m=jL(m,c,gn),m!==null){wt=m;return}}else{if(m=SL(m,c),m!==null){m.flags&=32767,wt=m;return}if(o!==null)o.flags|=32768,o.subtreeFlags=0,o.deletions=null;else{_t=6,wt=null;return}}if(c=c.sibling,c!==null){wt=c;return}wt=c=o}while(c!==null);_t===0&&(_t=5)}function va(o,c,m){var y=We,N=Rn.transition;try{Rn.transition=null,We=1,$L(o,c,m,y)}finally{Rn.transition=N,We=y}return null}function $L(o,c,m,y){do bo();while(Rs!==null);if((Ve&6)!==0)throw Error(n(327));m=o.finishedWork;var N=o.finishedLanes;if(m===null)return null;if(o.finishedWork=null,o.finishedLanes=0,m===o.current)throw Error(n(177));o.callbackNode=null,o.callbackPriority=0;var C=m.lanes|m.childLanes;if(Jl(o,C),o===Mt&&(wt=Mt=null,Pt=0),(m.subtreeFlags&2064)===0&&(m.flags&2064)===0||zc||(zc=!0,g1(ds,function(){return bo(),null})),C=(m.flags&15990)!==0,(m.subtreeFlags&15990)!==0||C){C=Rn.transition,Rn.transition=null;var B=We;We=1;var Q=Ve;Ve|=4,yf.current=null,EL(o,m),n1(m,o),QO(Sh),vs=!!jh,Sh=jh=null,o.current=m,CL(m),Ya(),Ve=Q,We=B,Rn.transition=C}else o.current=m;if(zc&&(zc=!1,Rs=o,Hc=N),C=o.pendingLanes,C===0&&(Ts=null),fs(m.stateNode),sn(o,Ye()),c!==null)for(y=o.onRecoverableError,m=0;m<c.length;m++)N=c[m],y(N.value,{componentStack:N.stack,digest:N.digest});if(Uc)throw Uc=!1,o=xf,xf=null,o;return(Hc&1)!==0&&o.tag!==0&&bo(),C=o.pendingLanes,(C&1)!==0?o===bf?Ki++:(Ki=0,bf=o):Ki=0,Ss(),null}function bo(){if(Rs!==null){var o=Ql(Hc),c=Rn.transition,m=We;try{if(Rn.transition=null,We=16>o?16:o,Rs===null)var y=!1;else{if(o=Rs,Rs=null,Hc=0,(Ve&6)!==0)throw Error(n(331));var N=Ve;for(Ve|=4,je=o.current;je!==null;){var C=je,B=C.child;if((je.flags&16)!==0){var Q=C.deletions;if(Q!==null){for(var te=0;te<Q.length;te++){var le=Q[te];for(je=le;je!==null;){var me=je;switch(me.tag){case 0:case 11:case 15:Wi(8,me,C)}var ye=me.child;if(ye!==null)ye.return=me,je=ye;else for(;je!==null;){me=je;var pe=me.sibling,Ne=me.return;if(Zk(me),me===le){je=null;break}if(pe!==null){pe.return=Ne,je=pe;break}je=Ne}}}var Se=C.alternate;if(Se!==null){var _e=Se.child;if(_e!==null){Se.child=null;do{var pt=_e.sibling;_e.sibling=null,_e=pt}while(_e!==null)}}je=C}}if((C.subtreeFlags&2064)!==0&&B!==null)B.return=C,je=B;else e:for(;je!==null;){if(C=je,(C.flags&2048)!==0)switch(C.tag){case 0:case 11:case 15:Wi(9,C,C.return)}var ae=C.sibling;if(ae!==null){ae.return=C.return,je=ae;break e}je=C.return}}var ne=o.current;for(je=ne;je!==null;){B=je;var oe=B.child;if((B.subtreeFlags&2064)!==0&&oe!==null)oe.return=B,je=oe;else e:for(B=ne;je!==null;){if(Q=je,(Q.flags&2048)!==0)try{switch(Q.tag){case 0:case 11:case 15:Fc(9,Q)}}catch(Ee){ht(Q,Q.return,Ee)}if(Q===B){je=null;break e}var ve=Q.sibling;if(ve!==null){ve.return=Q.return,je=ve;break e}je=Q.return}}if(Ve=N,Ss(),Yt&&typeof Yt.onPostCommitFiberRoot=="function")try{Yt.onPostCommitFiberRoot(hs,o)}catch{}y=!0}return y}finally{We=m,Rn.transition=c}}return!1}function f1(o,c,m){c=yo(m,c),c=Ak(o,c,1),o=Es(o,c,1),c=Jt(),o!==null&&(ea(o,1,c),sn(o,c))}function ht(o,c,m){if(o.tag===3)f1(o,o,m);else for(;c!==null;){if(c.tag===3){f1(c,o,m);break}else if(c.tag===1){var y=c.stateNode;if(typeof c.type.getDerivedStateFromError=="function"||typeof y.componentDidCatch=="function"&&(Ts===null||!Ts.has(y))){o=yo(m,o),o=Mk(c,o,1),c=Es(c,o,1),o=Jt(),c!==null&&(ea(c,1,o),sn(c,o));break}}c=c.return}}function IL(o,c,m){var y=o.pingCache;y!==null&&y.delete(c),c=Jt(),o.pingedLanes|=o.suspendedLanes&m,Mt===o&&(Pt&m)===m&&(_t===4||_t===3&&(Pt&130023424)===Pt&&500>Ye()-vf?wa(o,0):wf|=m),sn(o,c)}function p1(o,c){c===0&&((o.mode&1)===0?c=1:(c=ps,ps<<=1,(ps&130023424)===0&&(ps=4194304)));var m=Jt();o=Hr(o,c),o!==null&&(ea(o,c,m),sn(o,m))}function OL(o){var c=o.memoizedState,m=0;c!==null&&(m=c.retryLane),p1(o,m)}function LL(o,c){var m=0;switch(o.tag){case 13:var y=o.stateNode,N=o.memoizedState;N!==null&&(m=N.retryLane);break;case 19:y=o.stateNode;break;default:throw Error(n(314))}y!==null&&y.delete(c),p1(o,m)}var m1;m1=function(o,c,m){if(o!==null)if(o.memoizedProps!==c.pendingProps||en.current)nn=!0;else{if((o.lanes&m)===0&&(c.flags&128)===0)return nn=!1,NL(o,c,m);nn=(o.flags&131072)!==0}else nn=!1,lt&&(c.flags&1048576)!==0&&Kb(c,kc,c.index);switch(c.lanes=0,c.tag){case 2:var y=c.type;Pc(o,c),o=c.pendingProps;var N=lo(c,zt.current);mo(c,m),N=Yh(null,c,y,o,N,m);var C=Xh();return c.flags|=1,typeof N=="object"&&N!==null&&typeof N.render=="function"&&N.$$typeof===void 0?(c.tag=1,c.memoizedState=null,c.updateQueue=null,tn(y)?(C=!0,vc(c)):C=!1,c.memoizedState=N.state!==null&&N.state!==void 0?N.state:null,Uh(c),N.updater=Oc,c.stateNode=N,N._reactInternals=c,nf(c,y,o,m),c=of(null,c,y,!0,C,m)):(c.tag=0,lt&&C&&Mh(c),Zt(null,c,N,m),c=c.child),c;case 16:y=c.elementType;e:{switch(Pc(o,c),o=c.pendingProps,N=y._init,y=N(y._payload),c.type=y,N=c.tag=DL(y),o=Kn(y,o),N){case 0:c=af(null,c,y,o,m);break e;case 1:c=Bk(null,c,y,o,m);break e;case 11:c=Lk(null,c,y,o,m);break e;case 14:c=Pk(null,c,y,Kn(y.type,o),m);break e}throw Error(n(306,y,""))}return c;case 0:return y=c.type,N=c.pendingProps,N=c.elementType===y?N:Kn(y,N),af(o,c,y,N,m);case 1:return y=c.type,N=c.pendingProps,N=c.elementType===y?N:Kn(y,N),Bk(o,c,y,N,m);case 3:e:{if(Uk(c),o===null)throw Error(n(387));y=c.pendingProps,C=c.memoizedState,N=C.element,rk(o,c),Cc(c,y,null,m);var B=c.memoizedState;if(y=B.element,C.isDehydrated)if(C={element:y,isDehydrated:!1,cache:B.cache,pendingSuspenseBoundaries:B.pendingSuspenseBoundaries,transitions:B.transitions},c.updateQueue.baseState=C,c.memoizedState=C,c.flags&256){N=yo(Error(n(423)),c),c=zk(o,c,y,m,N);break e}else if(y!==N){N=yo(Error(n(424)),c),c=zk(o,c,y,m,N);break e}else for(mn=ks(c.stateNode.containerInfo.firstChild),pn=c,lt=!0,Gn=null,m=tk(c,null,y,m),c.child=m;m;)m.flags=m.flags&-3|4096,m=m.sibling;else{if(ho(),y===N){c=Vr(o,c,m);break e}Zt(o,c,y,m)}c=c.child}return c;case 5:return ok(c),o===null&&Oh(c),y=c.type,N=c.pendingProps,C=o!==null?o.memoizedProps:null,B=N.children,_h(y,N)?B=null:C!==null&&_h(y,C)&&(c.flags|=32),qk(o,c),Zt(o,c,B,m),c.child;case 6:return o===null&&Oh(c),null;case 13:return Hk(o,c,m);case 4:return zh(c,c.stateNode.containerInfo),y=c.pendingProps,o===null?c.child=fo(c,null,y,m):Zt(o,c,y,m),c.child;case 11:return y=c.type,N=c.pendingProps,N=c.elementType===y?N:Kn(y,N),Lk(o,c,y,N,m);case 7:return Zt(o,c,c.pendingProps,m),c.child;case 8:return Zt(o,c,c.pendingProps.children,m),c.child;case 12:return Zt(o,c,c.pendingProps.children,m),c.child;case 10:e:{if(y=c.type._context,N=c.pendingProps,C=c.memoizedProps,B=N.value,tt(Sc,y._currentValue),y._currentValue=B,C!==null)if(Vn(C.value,B)){if(C.children===N.children&&!en.current){c=Vr(o,c,m);break e}}else for(C=c.child,C!==null&&(C.return=c);C!==null;){var Q=C.dependencies;if(Q!==null){B=C.child;for(var te=Q.firstContext;te!==null;){if(te.context===y){if(C.tag===1){te=Wr(-1,m&-m),te.tag=2;var le=C.updateQueue;if(le!==null){le=le.shared;var me=le.pending;me===null?te.next=te:(te.next=me.next,me.next=te),le.pending=te}}C.lanes|=m,te=C.alternate,te!==null&&(te.lanes|=m),qh(C.return,m,c),Q.lanes|=m;break}te=te.next}}else if(C.tag===10)B=C.type===c.type?null:C.child;else if(C.tag===18){if(B=C.return,B===null)throw Error(n(341));B.lanes|=m,Q=B.alternate,Q!==null&&(Q.lanes|=m),qh(B,m,c),B=C.sibling}else B=C.child;if(B!==null)B.return=C;else for(B=C;B!==null;){if(B===c){B=null;break}if(C=B.sibling,C!==null){C.return=B.return,B=C;break}B=B.return}C=B}Zt(o,c,N.children,m),c=c.child}return c;case 9:return N=c.type,y=c.pendingProps.children,mo(c,m),N=Cn(N),y=y(N),c.flags|=1,Zt(o,c,y,m),c.child;case 14:return y=c.type,N=Kn(y,c.pendingProps),N=Kn(y.type,N),Pk(o,c,y,N,m);case 15:return Dk(o,c,c.type,c.pendingProps,m);case 17:return y=c.type,N=c.pendingProps,N=c.elementType===y?N:Kn(y,N),Pc(o,c),c.tag=1,tn(y)?(o=!0,vc(c)):o=!1,mo(c,m),Tk(c,y,N),nf(c,y,N,m),of(null,c,y,!0,o,m);case 19:return Vk(o,c,m);case 22:return Fk(o,c,m)}throw Error(n(156,c.tag))};function g1(o,c){return Ga(o,c)}function PL(o,c,m,y){this.tag=o,this.key=m,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=c,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=y,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function An(o,c,m,y){return new PL(o,c,m,y)}function Ef(o){return o=o.prototype,!(!o||!o.isReactComponent)}function DL(o){if(typeof o=="function")return Ef(o)?1:0;if(o!=null){if(o=o.$$typeof,o===O)return 11;if(o===M)return 14}return 2}function $s(o,c){var m=o.alternate;return m===null?(m=An(o.tag,c,o.key,o.mode),m.elementType=o.elementType,m.type=o.type,m.stateNode=o.stateNode,m.alternate=o,o.alternate=m):(m.pendingProps=c,m.type=o.type,m.flags=0,m.subtreeFlags=0,m.deletions=null),m.flags=o.flags&14680064,m.childLanes=o.childLanes,m.lanes=o.lanes,m.child=o.child,m.memoizedProps=o.memoizedProps,m.memoizedState=o.memoizedState,m.updateQueue=o.updateQueue,c=o.dependencies,m.dependencies=c===null?null:{lanes:c.lanes,firstContext:c.firstContext},m.sibling=o.sibling,m.index=o.index,m.ref=o.ref,m}function Kc(o,c,m,y,N,C){var B=2;if(y=o,typeof o=="function")Ef(o)&&(B=1);else if(typeof o=="string")B=5;else e:switch(o){case A:return xa(m.children,N,C,c);case U:B=8,N|=8;break;case I:return o=An(12,m,c,N|2),o.elementType=I,o.lanes=C,o;case V:return o=An(13,m,c,N),o.elementType=V,o.lanes=C,o;case $:return o=An(19,m,c,N),o.elementType=$,o.lanes=C,o;case Y:return Yc(m,N,C,c);default:if(typeof o=="object"&&o!==null)switch(o.$$typeof){case q:B=10;break e;case P:B=9;break e;case O:B=11;break e;case M:B=14;break e;case L:B=16,y=null;break e}throw Error(n(130,o==null?o:typeof o,""))}return c=An(B,m,c,N),c.elementType=o,c.type=y,c.lanes=C,c}function xa(o,c,m,y){return o=An(7,o,y,c),o.lanes=m,o}function Yc(o,c,m,y){return o=An(22,o,y,c),o.elementType=Y,o.lanes=m,o.stateNode={isHidden:!1},o}function Cf(o,c,m){return o=An(6,o,null,c),o.lanes=m,o}function Tf(o,c,m){return c=An(4,o.children!==null?o.children:[],o.key,c),c.lanes=m,c.stateNode={containerInfo:o.containerInfo,pendingChildren:null,implementation:o.implementation},c}function FL(o,c,m,y,N){this.tag=c,this.containerInfo=o,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=mr(0),this.expirationTimes=mr(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=mr(0),this.identifierPrefix=y,this.onRecoverableError=N,this.mutableSourceEagerHydrationData=null}function Rf(o,c,m,y,N,C,B,Q,te){return o=new FL(o,c,m,Q,te),c===1?(c=1,C===!0&&(c|=8)):c=0,C=An(3,null,null,c),o.current=C,C.stateNode=o,C.memoizedState={element:y,isDehydrated:m,cache:null,transitions:null,pendingSuspenseBoundaries:null},Uh(C),o}function qL(o,c,m){var y=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:R,key:y==null?null:""+y,children:o,containerInfo:c,implementation:m}}function y1(o){if(!o)return js;o=o._reactInternals;e:{if(Ut(o)!==o||o.tag!==1)throw Error(n(170));var c=o;do{switch(c.tag){case 3:c=c.stateNode.context;break e;case 1:if(tn(c.type)){c=c.stateNode.__reactInternalMemoizedMergedChildContext;break e}}c=c.return}while(c!==null);throw Error(n(171))}if(o.tag===1){var m=o.type;if(tn(m))return Wb(o,m,c)}return c}function w1(o,c,m,y,N,C,B,Q,te){return o=Rf(m,y,!0,o,N,C,B,Q,te),o.context=y1(null),m=o.current,y=Jt(),N=As(m),C=Wr(y,N),C.callback=c??null,Es(m,C,N),o.current.lanes=N,ea(o,N,y),sn(o,y),o}function Xc(o,c,m,y){var N=c.current,C=Jt(),B=As(N);return m=y1(m),c.context===null?c.context=m:c.pendingContext=m,c=Wr(C,B),c.payload={element:o},y=y===void 0?null:y,y!==null&&(c.callback=y),o=Es(N,c,B),o!==null&&(Zn(o,N,B,C),Ec(o,N,B)),B}function Zc(o){if(o=o.current,!o.child)return null;switch(o.child.tag){case 5:return o.child.stateNode;default:return o.child.stateNode}}function v1(o,c){if(o=o.memoizedState,o!==null&&o.dehydrated!==null){var m=o.retryLane;o.retryLane=m!==0&&m<c?m:c}}function Af(o,c){v1(o,c),(o=o.alternate)&&v1(o,c)}function BL(){return null}var x1=typeof reportError=="function"?reportError:function(o){console.error(o)};function Mf(o){this._internalRoot=o}Jc.prototype.render=Mf.prototype.render=function(o){var c=this._internalRoot;if(c===null)throw Error(n(409));Xc(o,c,null,null)},Jc.prototype.unmount=Mf.prototype.unmount=function(){var o=this._internalRoot;if(o!==null){this._internalRoot=null;var c=o.containerInfo;ya(function(){Xc(null,o,null,null)}),c[qr]=null}};function Jc(o){this._internalRoot=o}Jc.prototype.unstable_scheduleHydration=function(o){if(o){var c=tc();o={blockedOn:null,target:o,priority:c};for(var m=0;m<Wn.length&&c!==0&&c<Wn[m].priority;m++);Wn.splice(m,0,o),m===0&&xi(o)}};function $f(o){return!(!o||o.nodeType!==1&&o.nodeType!==9&&o.nodeType!==11)}function Qc(o){return!(!o||o.nodeType!==1&&o.nodeType!==9&&o.nodeType!==11&&(o.nodeType!==8||o.nodeValue!==" react-mount-point-unstable "))}function b1(){}function UL(o,c,m,y,N){if(N){if(typeof y=="function"){var C=y;y=function(){var le=Zc(B);C.call(le)}}var B=w1(c,y,o,0,null,!1,!1,"",b1);return o._reactRootContainer=B,o[qr]=B.current,Mi(o.nodeType===8?o.parentNode:o),ya(),B}for(;N=o.lastChild;)o.removeChild(N);if(typeof y=="function"){var Q=y;y=function(){var le=Zc(te);Q.call(le)}}var te=Rf(o,0,!1,null,null,!1,!1,"",b1);return o._reactRootContainer=te,o[qr]=te.current,Mi(o.nodeType===8?o.parentNode:o),ya(function(){Xc(c,te,m,y)}),te}function eu(o,c,m,y,N){var C=m._reactRootContainer;if(C){var B=C;if(typeof N=="function"){var Q=N;N=function(){var te=Zc(B);Q.call(te)}}Xc(c,B,o,N)}else B=UL(m,c,o,N,y);return Zc(B)}ec=function(o){switch(o.tag){case 3:var c=o.stateNode;if(c.current.memoizedState.isDehydrated){var m=Ir(c.pendingLanes);m!==0&&(Za(c,m|1),sn(c,Ye()),(Ve&6)===0&&(xo=Ye()+500,Ss()))}break;case 13:ya(function(){var y=Hr(o,1);if(y!==null){var N=Jt();Zn(y,o,1,N)}}),Af(o,1)}},ta=function(o){if(o.tag===13){var c=Hr(o,134217728);if(c!==null){var m=Jt();Zn(c,o,134217728,m)}Af(o,134217728)}},wi=function(o){if(o.tag===13){var c=As(o),m=Hr(o,c);if(m!==null){var y=Jt();Zn(m,o,c,y)}Af(o,c)}},tc=function(){return We},nc=function(o,c){var m=We;try{return We=o,c()}finally{We=m}},Gt=function(o,c,m){switch(c){case"input":if(be(o,m),c=m.name,m.type==="radio"&&c!=null){for(m=o;m.parentNode;)m=m.parentNode;for(m=m.querySelectorAll("input[name="+JSON.stringify(""+c)+'][type="radio"]'),c=0;c<m.length;c++){var y=m[c];if(y!==o&&y.form===o.form){var N=yc(y);if(!N)throw Error(n(90));fe(y),be(y,N)}}}break;case"textarea":Pe(o,m);break;case"select":c=m.value,c!=null&&Ce(o,!!m.multiple,c,!1)}},os=jf,ur=ya;var zL={usingClientEntryPoint:!1,Events:[Oi,oo,yc,as,$r,jf]},Yi={findFiberByHostInstance:ca,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},HL={bundleType:Yi.bundleType,version:Yi.version,rendererPackageName:Yi.rendererPackageName,rendererConfig:Yi.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:E.ReactCurrentDispatcher,findHostInstanceByFiber:function(o){return o=zn(o),o===null?null:o.stateNode},findFiberByHostInstance:Yi.findFiberByHostInstance||BL,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 tu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!tu.isDisabled&&tu.supportsFiber)try{hs=tu.inject(HL),Yt=tu}catch{}}return an.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=zL,an.createPortal=function(o,c){var m=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!$f(c))throw Error(n(200));return qL(o,c,null,m)},an.createRoot=function(o,c){if(!$f(o))throw Error(n(299));var m=!1,y="",N=x1;return c!=null&&(c.unstable_strictMode===!0&&(m=!0),c.identifierPrefix!==void 0&&(y=c.identifierPrefix),c.onRecoverableError!==void 0&&(N=c.onRecoverableError)),c=Rf(o,1,!1,null,null,m,!1,y,N),o[qr]=c.current,Mi(o.nodeType===8?o.parentNode:o),new Mf(c)},an.findDOMNode=function(o){if(o==null)return null;if(o.nodeType===1)return o;var c=o._reactInternals;if(c===void 0)throw typeof o.render=="function"?Error(n(188)):(o=Object.keys(o).join(","),Error(n(268,o)));return o=zn(c),o=o===null?null:o.stateNode,o},an.flushSync=function(o){return ya(o)},an.hydrate=function(o,c,m){if(!Qc(c))throw Error(n(200));return eu(null,o,c,!0,m)},an.hydrateRoot=function(o,c,m){if(!$f(o))throw Error(n(405));var y=m!=null&&m.hydratedSources||null,N=!1,C="",B=x1;if(m!=null&&(m.unstable_strictMode===!0&&(N=!0),m.identifierPrefix!==void 0&&(C=m.identifierPrefix),m.onRecoverableError!==void 0&&(B=m.onRecoverableError)),c=w1(c,null,o,1,m??null,N,!1,C,B),o[qr]=c.current,Mi(o),y)for(o=0;o<y.length;o++)m=y[o],N=m._getVersion,N=N(m._source),c.mutableSourceEagerHydrationData==null?c.mutableSourceEagerHydrationData=[m,N]:c.mutableSourceEagerHydrationData.push(m,N);return new Jc(c)},an.render=function(o,c,m){if(!Qc(c))throw Error(n(200));return eu(null,o,c,!1,m)},an.unmountComponentAtNode=function(o){if(!Qc(o))throw Error(n(40));return o._reactRootContainer?(ya(function(){eu(null,null,o,!1,function(){o._reactRootContainer=null,o[qr]=null})}),!0):!1},an.unstable_batchedUpdates=jf,an.unstable_renderSubtreeIntoContainer=function(o,c,m,y){if(!Qc(m))throw Error(n(200));if(o==null||o._reactInternals===void 0)throw Error(n(38));return eu(o,c,m,!1,y)},an.version="18.3.1-next-f1338f8080-20240426",an}var T1;function YR(){if(T1)return Lf.exports;T1=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(),Lf.exports=ZL(),Lf.exports}var R1;function JL(){if(R1)return ru;R1=1;var e=YR();return ru.createRoot=e.createRoot,ru.hydrateRoot=e.hydrateRoot,ru}var QL=JL(),v=Pl();const ue=Bx(v);function Dt(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=Dt(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var Ff={exports:{}},qf={},Bf={exports:{}},Uf={};/**
|
|
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 A1;function eP(){if(A1)return Uf;A1=1;var e=Pl();function t(p,g){return p===g&&(p!==0||1/p===1/g)||p!==p&&g!==g}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,s=e.useEffect,i=e.useLayoutEffect,l=e.useDebugValue;function u(p,g){var w=g(),k=r({inst:{value:w,getSnapshot:g}}),x=k[0].inst,b=k[1];return i(function(){x.value=w,x.getSnapshot=g,d(x)&&b({inst:x})},[p,w,g]),s(function(){return d(x)&&b({inst:x}),p(function(){d(x)&&b({inst:x})})},[p]),l(w),w}function d(p){var g=p.getSnapshot;p=p.value;try{var w=g();return!n(p,w)}catch{return!0}}function f(p,g){return g()}var h=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?f:u;return Uf.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:h,Uf}var M1;function tP(){return M1||(M1=1,Bf.exports=eP()),Bf.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 $1;function nP(){if($1)return qf;$1=1;var e=Pl(),t=tP();function n(f,h){return f===h&&(f!==0||1/f===1/h)||f!==f&&h!==h}var r=typeof Object.is=="function"?Object.is:n,s=t.useSyncExternalStore,i=e.useRef,l=e.useEffect,u=e.useMemo,d=e.useDebugValue;return qf.useSyncExternalStoreWithSelector=function(f,h,p,g,w){var k=i(null);if(k.current===null){var x={hasValue:!1,value:null};k.current=x}else x=k.current;k=u(function(){function j(R){if(!S){if(S=!0,_=R,R=g(R),w!==void 0&&x.hasValue){var A=x.value;if(w(A,R))return E=A}return E=R}if(A=E,r(_,R))return A;var U=g(R);return w!==void 0&&w(A,U)?(_=R,A):(_=R,E=U)}var S=!1,_,E,T=p===void 0?null:p;return[function(){return j(h())},T===null?void 0:function(){return j(T())}]},[h,p,g,w]);var b=s(f,k[0],k[1]);return l(function(){x.hasValue=!0,x.value=b},[b]),d(b),b},qf}var I1;function rP(){return I1||(I1=1,Ff.exports=nP()),Ff.exports}var sP=rP();const aP=Bx(sP),oP={},O1=e=>{let t;const n=new Set,r=(h,p)=>{const g=typeof h=="function"?h(t):h;if(!Object.is(g,t)){const w=t;t=p??(typeof g!="object"||g===null)?g:Object.assign({},t,g),n.forEach(k=>k(t,w))}},s=()=>t,d={setState:r,getState:s,getInitialState:()=>f,subscribe:h=>(n.add(h),()=>n.delete(h)),destroy:()=>{(oP?"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()}},f=t=e(r,s,d);return d},iP=e=>e?O1(e):O1,{useDebugValue:lP}=ue,{useSyncExternalStoreWithSelector:cP}=aP,uP=e=>e;function XR(e,t=uP,n){const r=cP(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return lP(r),r}const L1=(e,t)=>{const n=iP(e),r=(s,i=t)=>XR(n,s,i);return Object.assign(r,n),r},dP=(e,t)=>e?L1(e,t):L1;function Rt(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,s]of e)if(!Object.is(s,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 hP={value:()=>{}};function yd(){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 Eu(n)}function Eu(e){this._=e}function fP(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",s=n.indexOf(".");if(s>=0&&(r=n.slice(s+1),n=n.slice(0,s)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Eu.prototype=yd.prototype={constructor:Eu,on:function(e,t){var n=this._,r=fP(e+"",n),s,i=-1,l=r.length;if(arguments.length<2){for(;++i<l;)if((s=(e=r[i]).type)&&(s=pP(n[s],e.name)))return s;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<l;)if(s=(e=r[i]).type)n[s]=P1(n[s],e.name,t);else if(t==null)for(s in n)n[s]=P1(n[s],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new Eu(e)},call:function(e,t){if((s=arguments.length-2)>0)for(var n=new Array(s),r=0,s,i;r<s;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=this._[e],r=0,s=i.length;r<s;++r)i[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],s=0,i=r.length;s<i;++s)r[s].value.apply(t,n)}};function pP(e,t){for(var n=0,r=e.length,s;n<r;++n)if((s=e[n]).name===t)return s.value}function P1(e,t,n){for(var r=0,s=e.length;r<s;++r)if(e[r].name===t){e[r]=hP,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var Lv="http://www.w3.org/1999/xhtml";const D1={svg:"http://www.w3.org/2000/svg",xhtml:Lv,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function wd(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),D1.hasOwnProperty(t)?{space:D1[t],local:e}:e}function mP(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Lv&&t.documentElement.namespaceURI===Lv?t.createElement(e):t.createElementNS(n,e)}}function gP(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function ZR(e){var t=wd(e);return(t.local?gP:mP)(t)}function yP(){}function Ux(e){return e==null?yP:function(){return this.querySelector(e)}}function wP(e){typeof e!="function"&&(e=Ux(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s)for(var i=t[s],l=i.length,u=r[s]=new Array(l),d,f,h=0;h<l;++h)(d=i[h])&&(f=e.call(d,d.__data__,h,i))&&("__data__"in d&&(f.__data__=d.__data__),u[h]=f);return new bn(r,this._parents)}function vP(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function xP(){return[]}function JR(e){return e==null?xP:function(){return this.querySelectorAll(e)}}function bP(e){return function(){return vP(e.apply(this,arguments))}}function kP(e){typeof e=="function"?e=bP(e):e=JR(e);for(var t=this._groups,n=t.length,r=[],s=[],i=0;i<n;++i)for(var l=t[i],u=l.length,d,f=0;f<u;++f)(d=l[f])&&(r.push(e.call(d,d.__data__,f,l)),s.push(d));return new bn(r,s)}function QR(e){return function(){return this.matches(e)}}function eA(e){return function(t){return t.matches(e)}}var NP=Array.prototype.find;function jP(e){return function(){return NP.call(this.children,e)}}function SP(){return this.firstElementChild}function _P(e){return this.select(e==null?SP:jP(typeof e=="function"?e:eA(e)))}var EP=Array.prototype.filter;function CP(){return Array.from(this.children)}function TP(e){return function(){return EP.call(this.children,e)}}function RP(e){return this.selectAll(e==null?CP:TP(typeof e=="function"?e:eA(e)))}function AP(e){typeof e!="function"&&(e=QR(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s)for(var i=t[s],l=i.length,u=r[s]=[],d,f=0;f<l;++f)(d=i[f])&&e.call(d,d.__data__,f,i)&&u.push(d);return new bn(r,this._parents)}function tA(e){return new Array(e.length)}function MP(){return new bn(this._enter||this._groups.map(tA),this._parents)}function qu(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}qu.prototype={constructor:qu,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 $P(e){return function(){return e}}function IP(e,t,n,r,s,i){for(var l=0,u,d=t.length,f=i.length;l<f;++l)(u=t[l])?(u.__data__=i[l],r[l]=u):n[l]=new qu(e,i[l]);for(;l<d;++l)(u=t[l])&&(s[l]=u)}function OP(e,t,n,r,s,i,l){var u,d,f=new Map,h=t.length,p=i.length,g=new Array(h),w;for(u=0;u<h;++u)(d=t[u])&&(g[u]=w=l.call(d,d.__data__,u,t)+"",f.has(w)?s[u]=d:f.set(w,d));for(u=0;u<p;++u)w=l.call(e,i[u],u,i)+"",(d=f.get(w))?(r[u]=d,d.__data__=i[u],f.delete(w)):n[u]=new qu(e,i[u]);for(u=0;u<h;++u)(d=t[u])&&f.get(g[u])===d&&(s[u]=d)}function LP(e){return e.__data__}function PP(e,t){if(!arguments.length)return Array.from(this,LP);var n=t?OP:IP,r=this._parents,s=this._groups;typeof e!="function"&&(e=$P(e));for(var i=s.length,l=new Array(i),u=new Array(i),d=new Array(i),f=0;f<i;++f){var h=r[f],p=s[f],g=p.length,w=DP(e.call(h,h&&h.__data__,f,r)),k=w.length,x=u[f]=new Array(k),b=l[f]=new Array(k),j=d[f]=new Array(g);n(h,p,x,b,j,w,t);for(var S=0,_=0,E,T;S<k;++S)if(E=x[S]){for(S>=_&&(_=S+1);!(T=b[_])&&++_<k;);E._next=T||null}}return l=new bn(l,r),l._enter=u,l._exit=d,l}function DP(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function FP(){return new bn(this._exit||this._groups.map(tA),this._parents)}function qP(e,t,n){var r=this.enter(),s=this,i=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(s=t(s),s&&(s=s.selection())),n==null?i.remove():n(i),r&&s?r.merge(s).order():s}function BP(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,s=n.length,i=r.length,l=Math.min(s,i),u=new Array(s),d=0;d<l;++d)for(var f=n[d],h=r[d],p=f.length,g=u[d]=new Array(p),w,k=0;k<p;++k)(w=f[k]||h[k])&&(g[k]=w);for(;d<s;++d)u[d]=n[d];return new bn(u,this._parents)}function UP(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],s=r.length-1,i=r[s],l;--s>=0;)(l=r[s])&&(i&&l.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(l,i),i=l);return this}function zP(e){e||(e=HP);function t(p,g){return p&&g?e(p.__data__,g.__data__):!p-!g}for(var n=this._groups,r=n.length,s=new Array(r),i=0;i<r;++i){for(var l=n[i],u=l.length,d=s[i]=new Array(u),f,h=0;h<u;++h)(f=l[h])&&(d[h]=f);d.sort(t)}return new bn(s,this._parents).order()}function HP(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function WP(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function VP(){return Array.from(this)}function GP(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],s=0,i=r.length;s<i;++s){var l=r[s];if(l)return l}return null}function KP(){let e=0;for(const t of this)++e;return e}function YP(){return!this.node()}function XP(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var s=t[n],i=0,l=s.length,u;i<l;++i)(u=s[i])&&e.call(u,u.__data__,i,s);return this}function ZP(e){return function(){this.removeAttribute(e)}}function JP(e){return function(){this.removeAttributeNS(e.space,e.local)}}function QP(e,t){return function(){this.setAttribute(e,t)}}function e3(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function t3(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function n3(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 r3(e,t){var n=wd(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?JP:ZP:typeof t=="function"?n.local?n3:t3:n.local?e3:QP)(n,t))}function nA(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function s3(e){return function(){this.style.removeProperty(e)}}function a3(e,t,n){return function(){this.style.setProperty(e,t,n)}}function o3(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function i3(e,t,n){return arguments.length>1?this.each((t==null?s3:typeof t=="function"?o3:a3)(e,t,n??"")):Go(this.node(),e)}function Go(e,t){return e.style.getPropertyValue(t)||nA(e).getComputedStyle(e,null).getPropertyValue(t)}function l3(e){return function(){delete this[e]}}function c3(e,t){return function(){this[e]=t}}function u3(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function d3(e,t){return arguments.length>1?this.each((t==null?l3:typeof t=="function"?u3:c3)(e,t)):this.node()[e]}function rA(e){return e.trim().split(/^|\s+/)}function zx(e){return e.classList||new sA(e)}function sA(e){this._node=e,this._names=rA(e.getAttribute("class")||"")}sA.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 aA(e,t){for(var n=zx(e),r=-1,s=t.length;++r<s;)n.add(t[r])}function oA(e,t){for(var n=zx(e),r=-1,s=t.length;++r<s;)n.remove(t[r])}function h3(e){return function(){aA(this,e)}}function f3(e){return function(){oA(this,e)}}function p3(e,t){return function(){(t.apply(this,arguments)?aA:oA)(this,e)}}function m3(e,t){var n=rA(e+"");if(arguments.length<2){for(var r=zx(this.node()),s=-1,i=n.length;++s<i;)if(!r.contains(n[s]))return!1;return!0}return this.each((typeof t=="function"?p3:t?h3:f3)(n,t))}function g3(){this.textContent=""}function y3(e){return function(){this.textContent=e}}function w3(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function v3(e){return arguments.length?this.each(e==null?g3:(typeof e=="function"?w3:y3)(e)):this.node().textContent}function x3(){this.innerHTML=""}function b3(e){return function(){this.innerHTML=e}}function k3(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function N3(e){return arguments.length?this.each(e==null?x3:(typeof e=="function"?k3:b3)(e)):this.node().innerHTML}function j3(){this.nextSibling&&this.parentNode.appendChild(this)}function S3(){return this.each(j3)}function _3(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function E3(){return this.each(_3)}function C3(e){var t=typeof e=="function"?e:ZR(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function T3(){return null}function R3(e,t){var n=typeof e=="function"?e:ZR(e),r=t==null?T3:typeof t=="function"?t:Ux(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function A3(){var e=this.parentNode;e&&e.removeChild(this)}function M3(){return this.each(A3)}function $3(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function I3(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function O3(e){return this.select(e?I3:$3)}function L3(e){return arguments.length?this.property("__data__",e):this.node().__data__}function P3(e){return function(t){e.call(this,t,this.__data__)}}function D3(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 F3(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,s=t.length,i;n<s;++n)i=t[n],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++r]=i;++r?t.length=r:delete this.__on}}}function q3(e,t,n){return function(){var r=this.__on,s,i=P3(t);if(r){for(var l=0,u=r.length;l<u;++l)if((s=r[l]).type===e.type&&s.name===e.name){this.removeEventListener(s.type,s.listener,s.options),this.addEventListener(s.type,s.listener=i,s.options=n),s.value=t;return}}this.addEventListener(e.type,i,n),s={type:e.type,name:e.name,value:t,listener:i,options:n},r?r.push(s):this.__on=[s]}}function B3(e,t,n){var r=D3(e+""),s,i=r.length,l;if(arguments.length<2){var u=this.node().__on;if(u){for(var d=0,f=u.length,h;d<f;++d)for(s=0,h=u[d];s<i;++s)if((l=r[s]).type===h.type&&l.name===h.name)return h.value}return}for(u=t?q3:F3,s=0;s<i;++s)this.each(u(r[s],t,n));return this}function iA(e,t,n){var r=nA(e),s=r.CustomEvent;typeof s=="function"?s=new s(t,n):(s=r.document.createEvent("Event"),n?(s.initEvent(t,n.bubbles,n.cancelable),s.detail=n.detail):s.initEvent(t,!1,!1)),e.dispatchEvent(s)}function U3(e,t){return function(){return iA(this,e,t)}}function z3(e,t){return function(){return iA(this,e,t.apply(this,arguments))}}function H3(e,t){return this.each((typeof t=="function"?z3:U3)(e,t))}function*W3(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],s=0,i=r.length,l;s<i;++s)(l=r[s])&&(yield l)}var lA=[null];function bn(e,t){this._groups=e,this._parents=t}function Dl(){return new bn([[document.documentElement]],lA)}function V3(){return this}bn.prototype=Dl.prototype={constructor:bn,select:wP,selectAll:kP,selectChild:_P,selectChildren:RP,filter:AP,data:PP,enter:MP,exit:FP,join:qP,merge:BP,selection:V3,order:UP,sort:zP,call:WP,nodes:VP,node:GP,size:KP,empty:YP,each:XP,attr:r3,style:i3,property:d3,classed:m3,text:v3,html:N3,raise:S3,lower:E3,append:C3,insert:R3,remove:M3,clone:O3,datum:L3,on:B3,dispatch:H3,[Symbol.iterator]:W3};function On(e){return typeof e=="string"?new bn([[document.querySelector(e)]],[document.documentElement]):new bn([[e]],lA)}function G3(e){let t;for(;t=e.sourceEvent;)e=t;return e}function er(e,t){if(e=G3(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 s=t.getBoundingClientRect();return[e.clientX-s.left-t.clientLeft,e.clientY-s.top-t.clientTop]}}return[e.pageX,e.pageY]}const K3={passive:!1},gl={capture:!0,passive:!1};function zf(e){e.stopImmediatePropagation()}function qo(e){e.preventDefault(),e.stopImmediatePropagation()}function cA(e){var t=e.document.documentElement,n=On(e).on("dragstart.drag",qo,gl);"onselectstart"in t?n.on("selectstart.drag",qo,gl):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function uA(e,t){var n=e.document.documentElement,r=On(e).on("dragstart.drag",null);t&&(r.on("click.drag",qo,gl),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 su=e=>()=>e;function Pv(e,{sourceEvent:t,subject:n,target:r,identifier:s,active:i,x:l,y:u,dx:d,dy:f,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:s,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:l,enumerable:!0,configurable:!0},y:{value:u,enumerable:!0,configurable:!0},dx:{value:d,enumerable:!0,configurable:!0},dy:{value:f,enumerable:!0,configurable:!0},_:{value:h}})}Pv.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Y3(e){return!e.ctrlKey&&!e.button}function X3(){return this.parentNode}function Z3(e,t){return t??{x:e.x,y:e.y}}function J3(){return navigator.maxTouchPoints||"ontouchstart"in this}function Q3(){var e=Y3,t=X3,n=Z3,r=J3,s={},i=yd("start","drag","end"),l=0,u,d,f,h,p=0;function g(E){E.on("mousedown.drag",w).filter(r).on("touchstart.drag",b).on("touchmove.drag",j,K3).on("touchend.drag touchcancel.drag",S).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function w(E,T){if(!(h||!e.call(this,E,T))){var R=_(this,t.call(this,E,T),E,T,"mouse");R&&(On(E.view).on("mousemove.drag",k,gl).on("mouseup.drag",x,gl),cA(E.view),zf(E),f=!1,u=E.clientX,d=E.clientY,R("start",E))}}function k(E){if(qo(E),!f){var T=E.clientX-u,R=E.clientY-d;f=T*T+R*R>p}s.mouse("drag",E)}function x(E){On(E.view).on("mousemove.drag mouseup.drag",null),uA(E.view,f),qo(E),s.mouse("end",E)}function b(E,T){if(e.call(this,E,T)){var R=E.changedTouches,A=t.call(this,E,T),U=R.length,I,q;for(I=0;I<U;++I)(q=_(this,A,E,T,R[I].identifier,R[I]))&&(zf(E),q("start",E,R[I]))}}function j(E){var T=E.changedTouches,R=T.length,A,U;for(A=0;A<R;++A)(U=s[T[A].identifier])&&(qo(E),U("drag",E,T[A]))}function S(E){var T=E.changedTouches,R=T.length,A,U;for(h&&clearTimeout(h),h=setTimeout(function(){h=null},500),A=0;A<R;++A)(U=s[T[A].identifier])&&(zf(E),U("end",E,T[A]))}function _(E,T,R,A,U,I){var q=i.copy(),P=er(I||R,T),O,V,$;if(($=n.call(E,new Pv("beforestart",{sourceEvent:R,target:g,identifier:U,active:l,x:P[0],y:P[1],dx:0,dy:0,dispatch:q}),A))!=null)return O=$.x-P[0]||0,V=$.y-P[1]||0,function M(L,Y,K){var D=P,z;switch(L){case"start":s[U]=M,z=l++;break;case"end":delete s[U],--l;case"drag":P=er(K||Y,T),z=l;break}q.call(L,E,new Pv(L,{sourceEvent:Y,subject:$,target:g,identifier:U,active:z,x:P[0]+O,y:P[1]+V,dx:P[0]-D[0],dy:P[1]-D[1],dispatch:q}),A)}}return g.filter=function(E){return arguments.length?(e=typeof E=="function"?E:su(!!E),g):e},g.container=function(E){return arguments.length?(t=typeof E=="function"?E:su(E),g):t},g.subject=function(E){return arguments.length?(n=typeof E=="function"?E:su(E),g):n},g.touchable=function(E){return arguments.length?(r=typeof E=="function"?E:su(!!E),g):r},g.on=function(){var E=i.on.apply(i,arguments);return E===i?g:E},g.clickDistance=function(E){return arguments.length?(p=(E=+E)*E,g):Math.sqrt(p)},g}function Hx(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function dA(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function Fl(){}var yl=.7,Bu=1/yl,Bo="\\s*([+-]?\\d+)\\s*",wl="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Er="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",e4=/^#([0-9a-f]{3,8})$/,t4=new RegExp(`^rgb\\(${Bo},${Bo},${Bo}\\)$`),n4=new RegExp(`^rgb\\(${Er},${Er},${Er}\\)$`),r4=new RegExp(`^rgba\\(${Bo},${Bo},${Bo},${wl}\\)$`),s4=new RegExp(`^rgba\\(${Er},${Er},${Er},${wl}\\)$`),a4=new RegExp(`^hsl\\(${wl},${Er},${Er}\\)$`),o4=new RegExp(`^hsla\\(${wl},${Er},${Er},${wl}\\)$`),F1={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};Hx(Fl,vl,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:q1,formatHex:q1,formatHex8:i4,formatHsl:l4,formatRgb:B1,toString:B1});function q1(){return this.rgb().formatHex()}function i4(){return this.rgb().formatHex8()}function l4(){return hA(this).formatHsl()}function B1(){return this.rgb().formatRgb()}function vl(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=e4.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?U1(t):n===3?new ln(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?au(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?au(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=t4.exec(e))?new ln(t[1],t[2],t[3],1):(t=n4.exec(e))?new ln(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=r4.exec(e))?au(t[1],t[2],t[3],t[4]):(t=s4.exec(e))?au(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=a4.exec(e))?W1(t[1],t[2]/100,t[3]/100,1):(t=o4.exec(e))?W1(t[1],t[2]/100,t[3]/100,t[4]):F1.hasOwnProperty(e)?U1(F1[e]):e==="transparent"?new ln(NaN,NaN,NaN,0):null}function U1(e){return new ln(e>>16&255,e>>8&255,e&255,1)}function au(e,t,n,r){return r<=0&&(e=t=n=NaN),new ln(e,t,n,r)}function c4(e){return e instanceof Fl||(e=vl(e)),e?(e=e.rgb(),new ln(e.r,e.g,e.b,e.opacity)):new ln}function Dv(e,t,n,r){return arguments.length===1?c4(e):new ln(e,t,n,r??1)}function ln(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Hx(ln,Dv,dA(Fl,{brighter(e){return e=e==null?Bu:Math.pow(Bu,e),new ln(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?yl:Math.pow(yl,e),new ln(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ln(Ta(this.r),Ta(this.g),Ta(this.b),Uu(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:z1,formatHex:z1,formatHex8:u4,formatRgb:H1,toString:H1}));function z1(){return`#${_a(this.r)}${_a(this.g)}${_a(this.b)}`}function u4(){return`#${_a(this.r)}${_a(this.g)}${_a(this.b)}${_a((isNaN(this.opacity)?1:this.opacity)*255)}`}function H1(){const e=Uu(this.opacity);return`${e===1?"rgb(":"rgba("}${Ta(this.r)}, ${Ta(this.g)}, ${Ta(this.b)}${e===1?")":`, ${e})`}`}function Uu(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Ta(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function _a(e){return e=Ta(e),(e<16?"0":"")+e.toString(16)}function W1(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new tr(e,t,n,r)}function hA(e){if(e instanceof tr)return new tr(e.h,e.s,e.l,e.opacity);if(e instanceof Fl||(e=vl(e)),!e)return new tr;if(e instanceof tr)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,s=Math.min(t,n,r),i=Math.max(t,n,r),l=NaN,u=i-s,d=(i+s)/2;return u?(t===i?l=(n-r)/u+(n<r)*6:n===i?l=(r-t)/u+2:l=(t-n)/u+4,u/=d<.5?i+s:2-i-s,l*=60):u=d>0&&d<1?0:l,new tr(l,u,d,e.opacity)}function d4(e,t,n,r){return arguments.length===1?hA(e):new tr(e,t,n,r??1)}function tr(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Hx(tr,d4,dA(Fl,{brighter(e){return e=e==null?Bu:Math.pow(Bu,e),new tr(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?yl:Math.pow(yl,e),new tr(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,s=2*n-r;return new ln(Hf(e>=240?e-240:e+120,s,r),Hf(e,s,r),Hf(e<120?e+240:e-120,s,r),this.opacity)},clamp(){return new tr(V1(this.h),ou(this.s),ou(this.l),Uu(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=Uu(this.opacity);return`${e===1?"hsl(":"hsla("}${V1(this.h)}, ${ou(this.s)*100}%, ${ou(this.l)*100}%${e===1?")":`, ${e})`}`}}));function V1(e){return e=(e||0)%360,e<0?e+360:e}function ou(e){return Math.max(0,Math.min(1,e||0))}function Hf(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 fA=e=>()=>e;function h4(e,t){return function(n){return e+n*t}}function f4(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 p4(e){return(e=+e)==1?pA:function(t,n){return n-t?f4(t,n,e):fA(isNaN(t)?n:t)}}function pA(e,t){var n=t-e;return n?h4(e,n):fA(isNaN(e)?t:e)}const G1=(function e(t){var n=p4(t);function r(s,i){var l=n((s=Dv(s)).r,(i=Dv(i)).r),u=n(s.g,i.g),d=n(s.b,i.b),f=pA(s.opacity,i.opacity);return function(h){return s.r=l(h),s.g=u(h),s.b=d(h),s.opacity=f(h),s+""}}return r.gamma=e,r})(1);function Ds(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var Fv=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Wf=new RegExp(Fv.source,"g");function m4(e){return function(){return e}}function g4(e){return function(t){return e(t)+""}}function y4(e,t){var n=Fv.lastIndex=Wf.lastIndex=0,r,s,i,l=-1,u=[],d=[];for(e=e+"",t=t+"";(r=Fv.exec(e))&&(s=Wf.exec(t));)(i=s.index)>n&&(i=t.slice(n,i),u[l]?u[l]+=i:u[++l]=i),(r=r[0])===(s=s[0])?u[l]?u[l]+=s:u[++l]=s:(u[++l]=null,d.push({i:l,x:Ds(r,s)})),n=Wf.lastIndex;return n<t.length&&(i=t.slice(n),u[l]?u[l]+=i:u[++l]=i),u.length<2?d[0]?g4(d[0].x):m4(t):(t=d.length,function(f){for(var h=0,p;h<t;++h)u[(p=d[h]).i]=p.x(f);return u.join("")})}var K1=180/Math.PI,qv={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function mA(e,t,n,r,s,i){var l,u,d;return(l=Math.sqrt(e*e+t*t))&&(e/=l,t/=l),(d=e*n+t*r)&&(n-=e*d,r-=t*d),(u=Math.sqrt(n*n+r*r))&&(n/=u,r/=u,d/=u),e*r<t*n&&(e=-e,t=-t,d=-d,l=-l),{translateX:s,translateY:i,rotate:Math.atan2(t,e)*K1,skewX:Math.atan(d)*K1,scaleX:l,scaleY:u}}var iu;function w4(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?qv:mA(t.a,t.b,t.c,t.d,t.e,t.f)}function v4(e){return e==null||(iu||(iu=document.createElementNS("http://www.w3.org/2000/svg","g")),iu.setAttribute("transform",e),!(e=iu.transform.baseVal.consolidate()))?qv:(e=e.matrix,mA(e.a,e.b,e.c,e.d,e.e,e.f))}function gA(e,t,n,r){function s(f){return f.length?f.pop()+" ":""}function i(f,h,p,g,w,k){if(f!==p||h!==g){var x=w.push("translate(",null,t,null,n);k.push({i:x-4,x:Ds(f,p)},{i:x-2,x:Ds(h,g)})}else(p||g)&&w.push("translate("+p+t+g+n)}function l(f,h,p,g){f!==h?(f-h>180?h+=360:h-f>180&&(f+=360),g.push({i:p.push(s(p)+"rotate(",null,r)-2,x:Ds(f,h)})):h&&p.push(s(p)+"rotate("+h+r)}function u(f,h,p,g){f!==h?g.push({i:p.push(s(p)+"skewX(",null,r)-2,x:Ds(f,h)}):h&&p.push(s(p)+"skewX("+h+r)}function d(f,h,p,g,w,k){if(f!==p||h!==g){var x=w.push(s(w)+"scale(",null,",",null,")");k.push({i:x-4,x:Ds(f,p)},{i:x-2,x:Ds(h,g)})}else(p!==1||g!==1)&&w.push(s(w)+"scale("+p+","+g+")")}return function(f,h){var p=[],g=[];return f=e(f),h=e(h),i(f.translateX,f.translateY,h.translateX,h.translateY,p,g),l(f.rotate,h.rotate,p,g),u(f.skewX,h.skewX,p,g),d(f.scaleX,f.scaleY,h.scaleX,h.scaleY,p,g),f=h=null,function(w){for(var k=-1,x=g.length,b;++k<x;)p[(b=g[k]).i]=b.x(w);return p.join("")}}}var x4=gA(w4,"px, ","px)","deg)"),b4=gA(v4,", ",")",")"),k4=1e-12;function Y1(e){return((e=Math.exp(e))+1/e)/2}function N4(e){return((e=Math.exp(e))-1/e)/2}function j4(e){return((e=Math.exp(2*e))-1)/(e+1)}const S4=(function e(t,n,r){function s(i,l){var u=i[0],d=i[1],f=i[2],h=l[0],p=l[1],g=l[2],w=h-u,k=p-d,x=w*w+k*k,b,j;if(x<k4)j=Math.log(g/f)/t,b=function(A){return[u+A*w,d+A*k,f*Math.exp(t*A*j)]};else{var S=Math.sqrt(x),_=(g*g-f*f+r*x)/(2*f*n*S),E=(g*g-f*f-r*x)/(2*g*n*S),T=Math.log(Math.sqrt(_*_+1)-_),R=Math.log(Math.sqrt(E*E+1)-E);j=(R-T)/t,b=function(A){var U=A*j,I=Y1(T),q=f/(n*S)*(I*j4(t*U+T)-N4(T));return[u+q*w,d+q*k,f*I/Y1(t*U+T)]}}return b.duration=j*1e3*t/Math.SQRT2,b}return s.rho=function(i){var l=Math.max(.001,+i),u=l*l,d=u*u;return e(l,u,d)},s})(Math.SQRT2,2,4);var Ko=0,sl=0,Zi=0,yA=1e3,zu,al,Hu=0,Ia=0,vd=0,xl=typeof performance=="object"&&performance.now?performance:Date,wA=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Wx(){return Ia||(wA(_4),Ia=xl.now()+vd)}function _4(){Ia=0}function Wu(){this._call=this._time=this._next=null}Wu.prototype=vA.prototype={constructor:Wu,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Wx():+n)+(t==null?0:+t),!this._next&&al!==this&&(al?al._next=this:zu=this,al=this),this._call=e,this._time=n,Bv()},stop:function(){this._call&&(this._call=null,this._time=1/0,Bv())}};function vA(e,t,n){var r=new Wu;return r.restart(e,t,n),r}function E4(){Wx(),++Ko;for(var e=zu,t;e;)(t=Ia-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Ko}function X1(){Ia=(Hu=xl.now())+vd,Ko=sl=0;try{E4()}finally{Ko=0,T4(),Ia=0}}function C4(){var e=xl.now(),t=e-Hu;t>yA&&(vd-=t,Hu=e)}function T4(){for(var e,t=zu,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:zu=n);al=e,Bv(r)}function Bv(e){if(!Ko){sl&&(sl=clearTimeout(sl));var t=e-Ia;t>24?(e<1/0&&(sl=setTimeout(X1,e-xl.now()-vd)),Zi&&(Zi=clearInterval(Zi))):(Zi||(Hu=xl.now(),Zi=setInterval(C4,yA)),Ko=1,wA(X1))}}function Z1(e,t,n){var r=new Wu;return t=t==null?0:+t,r.restart(s=>{r.stop(),e(s+t)},t,n),r}var R4=yd("start","end","cancel","interrupt"),A4=[],xA=0,J1=1,Uv=2,Cu=3,Q1=4,zv=5,Tu=6;function xd(e,t,n,r,s,i){var l=e.__transition;if(!l)e.__transition={};else if(n in l)return;M4(e,n,{name:t,index:r,group:s,on:R4,tween:A4,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:xA})}function Vx(e,t){var n=ir(e,t);if(n.state>xA)throw new Error("too late; already scheduled");return n}function Ar(e,t){var n=ir(e,t);if(n.state>Cu)throw new Error("too late; already running");return n}function ir(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function M4(e,t,n){var r=e.__transition,s;r[t]=n,n.timer=vA(i,0,n.time);function i(f){n.state=J1,n.timer.restart(l,n.delay,n.time),n.delay<=f&&l(f-n.delay)}function l(f){var h,p,g,w;if(n.state!==J1)return d();for(h in r)if(w=r[h],w.name===n.name){if(w.state===Cu)return Z1(l);w.state===Q1?(w.state=Tu,w.timer.stop(),w.on.call("interrupt",e,e.__data__,w.index,w.group),delete r[h]):+h<t&&(w.state=Tu,w.timer.stop(),w.on.call("cancel",e,e.__data__,w.index,w.group),delete r[h])}if(Z1(function(){n.state===Cu&&(n.state=Q1,n.timer.restart(u,n.delay,n.time),u(f))}),n.state=Uv,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Uv){for(n.state=Cu,s=new Array(g=n.tween.length),h=0,p=-1;h<g;++h)(w=n.tween[h].value.call(e,e.__data__,n.index,n.group))&&(s[++p]=w);s.length=p+1}}function u(f){for(var h=f<n.duration?n.ease.call(null,f/n.duration):(n.timer.restart(d),n.state=zv,1),p=-1,g=s.length;++p<g;)s[p].call(e,h);n.state===zv&&(n.on.call("end",e,e.__data__,n.index,n.group),d())}function d(){n.state=Tu,n.timer.stop(),delete r[t];for(var f in r)return;delete e.__transition}}function Ru(e,t){var n=e.__transition,r,s,i=!0,l;if(n){t=t==null?null:t+"";for(l in n){if((r=n[l]).name!==t){i=!1;continue}s=r.state>Uv&&r.state<zv,r.state=Tu,r.timer.stop(),r.on.call(s?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[l]}i&&delete e.__transition}}function $4(e){return this.each(function(){Ru(this,e)})}function I4(e,t){var n,r;return function(){var s=Ar(this,e),i=s.tween;if(i!==n){r=n=i;for(var l=0,u=r.length;l<u;++l)if(r[l].name===t){r=r.slice(),r.splice(l,1);break}}s.tween=r}}function O4(e,t,n){var r,s;if(typeof n!="function")throw new Error;return function(){var i=Ar(this,e),l=i.tween;if(l!==r){s=(r=l).slice();for(var u={name:t,value:n},d=0,f=s.length;d<f;++d)if(s[d].name===t){s[d]=u;break}d===f&&s.push(u)}i.tween=s}}function L4(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=ir(this.node(),n).tween,s=0,i=r.length,l;s<i;++s)if((l=r[s]).name===e)return l.value;return null}return this.each((t==null?I4:O4)(n,e,t))}function Gx(e,t,n){var r=e._id;return e.each(function(){var s=Ar(this,r);(s.value||(s.value={}))[t]=n.apply(this,arguments)}),function(s){return ir(s,r).value[t]}}function bA(e,t){var n;return(typeof t=="number"?Ds:t instanceof vl?G1:(n=vl(t))?(t=n,G1):y4)(e,t)}function P4(e){return function(){this.removeAttribute(e)}}function D4(e){return function(){this.removeAttributeNS(e.space,e.local)}}function F4(e,t,n){var r,s=n+"",i;return function(){var l=this.getAttribute(e);return l===s?null:l===r?i:i=t(r=l,n)}}function q4(e,t,n){var r,s=n+"",i;return function(){var l=this.getAttributeNS(e.space,e.local);return l===s?null:l===r?i:i=t(r=l,n)}}function B4(e,t,n){var r,s,i;return function(){var l,u=n(this),d;return u==null?void this.removeAttribute(e):(l=this.getAttribute(e),d=u+"",l===d?null:l===r&&d===s?i:(s=d,i=t(r=l,u)))}}function U4(e,t,n){var r,s,i;return function(){var l,u=n(this),d;return u==null?void this.removeAttributeNS(e.space,e.local):(l=this.getAttributeNS(e.space,e.local),d=u+"",l===d?null:l===r&&d===s?i:(s=d,i=t(r=l,u)))}}function z4(e,t){var n=wd(e),r=n==="transform"?b4:bA;return this.attrTween(e,typeof t=="function"?(n.local?U4:B4)(n,r,Gx(this,"attr."+e,t)):t==null?(n.local?D4:P4)(n):(n.local?q4:F4)(n,r,t))}function H4(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function W4(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function V4(e,t){var n,r;function s(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&W4(e,i)),n}return s._value=t,s}function G4(e,t){var n,r;function s(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&H4(e,i)),n}return s._value=t,s}function K4(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=wd(e);return this.tween(n,(r.local?V4:G4)(r,t))}function Y4(e,t){return function(){Vx(this,e).delay=+t.apply(this,arguments)}}function X4(e,t){return t=+t,function(){Vx(this,e).delay=t}}function Z4(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Y4:X4)(t,e)):ir(this.node(),t).delay}function J4(e,t){return function(){Ar(this,e).duration=+t.apply(this,arguments)}}function Q4(e,t){return t=+t,function(){Ar(this,e).duration=t}}function eD(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?J4:Q4)(t,e)):ir(this.node(),t).duration}function tD(e,t){if(typeof t!="function")throw new Error;return function(){Ar(this,e).ease=t}}function nD(e){var t=this._id;return arguments.length?this.each(tD(t,e)):ir(this.node(),t).ease}function rD(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Ar(this,e).ease=n}}function sD(e){if(typeof e!="function")throw new Error;return this.each(rD(this._id,e))}function aD(e){typeof e!="function"&&(e=QR(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s)for(var i=t[s],l=i.length,u=r[s]=[],d,f=0;f<l;++f)(d=i[f])&&e.call(d,d.__data__,f,i)&&u.push(d);return new Qr(r,this._parents,this._name,this._id)}function oD(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,s=n.length,i=Math.min(r,s),l=new Array(r),u=0;u<i;++u)for(var d=t[u],f=n[u],h=d.length,p=l[u]=new Array(h),g,w=0;w<h;++w)(g=d[w]||f[w])&&(p[w]=g);for(;u<r;++u)l[u]=t[u];return new Qr(l,this._parents,this._name,this._id)}function iD(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 lD(e,t,n){var r,s,i=iD(t)?Vx:Ar;return function(){var l=i(this,e),u=l.on;u!==r&&(s=(r=u).copy()).on(t,n),l.on=s}}function cD(e,t){var n=this._id;return arguments.length<2?ir(this.node(),n).on.on(e):this.each(lD(n,e,t))}function uD(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function dD(){return this.on("end.remove",uD(this._id))}function hD(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Ux(e));for(var r=this._groups,s=r.length,i=new Array(s),l=0;l<s;++l)for(var u=r[l],d=u.length,f=i[l]=new Array(d),h,p,g=0;g<d;++g)(h=u[g])&&(p=e.call(h,h.__data__,g,u))&&("__data__"in h&&(p.__data__=h.__data__),f[g]=p,xd(f[g],t,n,g,f,ir(h,n)));return new Qr(i,this._parents,t,n)}function fD(e){var t=this._name,n=this._id;typeof e!="function"&&(e=JR(e));for(var r=this._groups,s=r.length,i=[],l=[],u=0;u<s;++u)for(var d=r[u],f=d.length,h,p=0;p<f;++p)if(h=d[p]){for(var g=e.call(h,h.__data__,p,d),w,k=ir(h,n),x=0,b=g.length;x<b;++x)(w=g[x])&&xd(w,t,n,x,g,k);i.push(g),l.push(h)}return new Qr(i,l,t,n)}var pD=Dl.prototype.constructor;function mD(){return new pD(this._groups,this._parents)}function gD(e,t){var n,r,s;return function(){var i=Go(this,e),l=(this.style.removeProperty(e),Go(this,e));return i===l?null:i===n&&l===r?s:s=t(n=i,r=l)}}function kA(e){return function(){this.style.removeProperty(e)}}function yD(e,t,n){var r,s=n+"",i;return function(){var l=Go(this,e);return l===s?null:l===r?i:i=t(r=l,n)}}function wD(e,t,n){var r,s,i;return function(){var l=Go(this,e),u=n(this),d=u+"";return u==null&&(d=u=(this.style.removeProperty(e),Go(this,e))),l===d?null:l===r&&d===s?i:(s=d,i=t(r=l,u))}}function vD(e,t){var n,r,s,i="style."+t,l="end."+i,u;return function(){var d=Ar(this,e),f=d.on,h=d.value[i]==null?u||(u=kA(t)):void 0;(f!==n||s!==h)&&(r=(n=f).copy()).on(l,s=h),d.on=r}}function xD(e,t,n){var r=(e+="")=="transform"?x4:bA;return t==null?this.styleTween(e,gD(e,r)).on("end.style."+e,kA(e)):typeof t=="function"?this.styleTween(e,wD(e,r,Gx(this,"style."+e,t))).each(vD(this._id,e)):this.styleTween(e,yD(e,r,t),n).on("end.style."+e,null)}function bD(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function kD(e,t,n){var r,s;function i(){var l=t.apply(this,arguments);return l!==s&&(r=(s=l)&&bD(e,l,n)),r}return i._value=t,i}function ND(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,kD(e,t,n??""))}function jD(e){return function(){this.textContent=e}}function SD(e){return function(){var t=e(this);this.textContent=t??""}}function _D(e){return this.tween("text",typeof e=="function"?SD(Gx(this,"text",e)):jD(e==null?"":e+""))}function ED(e){return function(t){this.textContent=e.call(this,t)}}function CD(e){var t,n;function r(){var s=e.apply(this,arguments);return s!==n&&(t=(n=s)&&ED(s)),t}return r._value=e,r}function TD(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,CD(e))}function RD(){for(var e=this._name,t=this._id,n=NA(),r=this._groups,s=r.length,i=0;i<s;++i)for(var l=r[i],u=l.length,d,f=0;f<u;++f)if(d=l[f]){var h=ir(d,t);xd(d,e,n,f,l,{time:h.time+h.delay+h.duration,delay:0,duration:h.duration,ease:h.ease})}return new Qr(r,this._parents,e,n)}function AD(){var e,t,n=this,r=n._id,s=n.size();return new Promise(function(i,l){var u={value:l},d={value:function(){--s===0&&i()}};n.each(function(){var f=Ar(this,r),h=f.on;h!==e&&(t=(e=h).copy(),t._.cancel.push(u),t._.interrupt.push(u),t._.end.push(d)),f.on=t}),s===0&&i()})}var MD=0;function Qr(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function NA(){return++MD}var Kr=Dl.prototype;Qr.prototype={constructor:Qr,select:hD,selectAll:fD,selectChild:Kr.selectChild,selectChildren:Kr.selectChildren,filter:aD,merge:oD,selection:mD,transition:RD,call:Kr.call,nodes:Kr.nodes,node:Kr.node,size:Kr.size,empty:Kr.empty,each:Kr.each,on:cD,attr:z4,attrTween:K4,style:xD,styleTween:ND,text:_D,textTween:TD,remove:dD,tween:L4,delay:Z4,duration:eD,ease:nD,easeVarying:sD,end:AD,[Symbol.iterator]:Kr[Symbol.iterator]};function $D(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var ID={time:null,delay:0,duration:250,ease:$D};function OD(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 LD(e){var t,n;e instanceof Qr?(t=e._id,e=e._name):(t=NA(),(n=ID).time=Wx(),e=e==null?null:e+"");for(var r=this._groups,s=r.length,i=0;i<s;++i)for(var l=r[i],u=l.length,d,f=0;f<u;++f)(d=l[f])&&xd(d,e,t,f,l,n||OD(d,t));return new Qr(r,this._parents,e,t)}Dl.prototype.interrupt=$4;Dl.prototype.transition=LD;const lu=e=>()=>e;function PD(e,{sourceEvent:t,target:n,transform:r,dispatch:s}){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:s}})}function Yr(e,t,n){this.k=e,this.x=t,this.y=n}Yr.prototype={constructor:Yr,scale:function(e){return e===1?this:new Yr(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Yr(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Xr=new Yr(1,0,0);Yr.prototype;function Vf(e){e.stopImmediatePropagation()}function Ji(e){e.preventDefault(),e.stopImmediatePropagation()}function DD(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function FD(){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 eN(){return this.__zoom||Xr}function qD(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function BD(){return navigator.maxTouchPoints||"ontouchstart"in this}function UD(e,t,n){var r=e.invertX(t[0][0])-n[0][0],s=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],l=e.invertY(t[1][1])-n[1][1];return e.translate(s>r?(r+s)/2:Math.min(0,r)||Math.max(0,s),l>i?(i+l)/2:Math.min(0,i)||Math.max(0,l))}function jA(){var e=DD,t=FD,n=UD,r=qD,s=BD,i=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],u=250,d=S4,f=yd("start","zoom","end"),h,p,g,w=500,k=150,x=0,b=10;function j($){$.property("__zoom",eN).on("wheel.zoom",U,{passive:!1}).on("mousedown.zoom",I).on("dblclick.zoom",q).filter(s).on("touchstart.zoom",P).on("touchmove.zoom",O).on("touchend.zoom touchcancel.zoom",V).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}j.transform=function($,M,L,Y){var K=$.selection?$.selection():$;K.property("__zoom",eN),$!==K?T($,M,L,Y):K.interrupt().each(function(){R(this,arguments).event(Y).start().zoom(null,typeof M=="function"?M.apply(this,arguments):M).end()})},j.scaleBy=function($,M,L,Y){j.scaleTo($,function(){var K=this.__zoom.k,D=typeof M=="function"?M.apply(this,arguments):M;return K*D},L,Y)},j.scaleTo=function($,M,L,Y){j.transform($,function(){var K=t.apply(this,arguments),D=this.__zoom,z=L==null?E(K):typeof L=="function"?L.apply(this,arguments):L,F=D.invert(z),H=typeof M=="function"?M.apply(this,arguments):M;return n(_(S(D,H),z,F),K,l)},L,Y)},j.translateBy=function($,M,L,Y){j.transform($,function(){return n(this.__zoom.translate(typeof M=="function"?M.apply(this,arguments):M,typeof L=="function"?L.apply(this,arguments):L),t.apply(this,arguments),l)},null,Y)},j.translateTo=function($,M,L,Y,K){j.transform($,function(){var D=t.apply(this,arguments),z=this.__zoom,F=Y==null?E(D):typeof Y=="function"?Y.apply(this,arguments):Y;return n(Xr.translate(F[0],F[1]).scale(z.k).translate(typeof M=="function"?-M.apply(this,arguments):-M,typeof L=="function"?-L.apply(this,arguments):-L),D,l)},Y,K)};function S($,M){return M=Math.max(i[0],Math.min(i[1],M)),M===$.k?$:new Yr(M,$.x,$.y)}function _($,M,L){var Y=M[0]-L[0]*$.k,K=M[1]-L[1]*$.k;return Y===$.x&&K===$.y?$:new Yr($.k,Y,K)}function E($){return[(+$[0][0]+ +$[1][0])/2,(+$[0][1]+ +$[1][1])/2]}function T($,M,L,Y){$.on("start.zoom",function(){R(this,arguments).event(Y).start()}).on("interrupt.zoom end.zoom",function(){R(this,arguments).event(Y).end()}).tween("zoom",function(){var K=this,D=arguments,z=R(K,D).event(Y),F=t.apply(K,D),H=L==null?E(F):typeof L=="function"?L.apply(K,D):L,J=Math.max(F[1][0]-F[0][0],F[1][1]-F[0][1]),W=K.__zoom,G=typeof M=="function"?M.apply(K,D):M,X=d(W.invert(H).concat(J/W.k),G.invert(H).concat(J/G.k));return function(Z){if(Z===1)Z=G;else{var ee=X(Z),re=J/ee[2];Z=new Yr(re,H[0]-ee[0]*re,H[1]-ee[1]*re)}z.zoom(null,Z)}})}function R($,M,L){return!L&&$.__zooming||new A($,M)}function A($,M){this.that=$,this.args=M,this.active=0,this.sourceEvent=null,this.extent=t.apply($,M),this.taps=0}A.prototype={event:function($){return $&&(this.sourceEvent=$),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function($,M){return this.mouse&&$!=="mouse"&&(this.mouse[1]=M.invert(this.mouse[0])),this.touch0&&$!=="touch"&&(this.touch0[1]=M.invert(this.touch0[0])),this.touch1&&$!=="touch"&&(this.touch1[1]=M.invert(this.touch1[0])),this.that.__zoom=M,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function($){var M=On(this.that).datum();f.call($,this.that,new PD($,{sourceEvent:this.sourceEvent,target:j,transform:this.that.__zoom,dispatch:f}),M)}};function U($,...M){if(!e.apply(this,arguments))return;var L=R(this,M).event($),Y=this.__zoom,K=Math.max(i[0],Math.min(i[1],Y.k*Math.pow(2,r.apply(this,arguments)))),D=er($);if(L.wheel)(L.mouse[0][0]!==D[0]||L.mouse[0][1]!==D[1])&&(L.mouse[1]=Y.invert(L.mouse[0]=D)),clearTimeout(L.wheel);else{if(Y.k===K)return;L.mouse=[D,Y.invert(D)],Ru(this),L.start()}Ji($),L.wheel=setTimeout(z,k),L.zoom("mouse",n(_(S(Y,K),L.mouse[0],L.mouse[1]),L.extent,l));function z(){L.wheel=null,L.end()}}function I($,...M){if(g||!e.apply(this,arguments))return;var L=$.currentTarget,Y=R(this,M,!0).event($),K=On($.view).on("mousemove.zoom",H,!0).on("mouseup.zoom",J,!0),D=er($,L),z=$.clientX,F=$.clientY;cA($.view),Vf($),Y.mouse=[D,this.__zoom.invert(D)],Ru(this),Y.start();function H(W){if(Ji(W),!Y.moved){var G=W.clientX-z,X=W.clientY-F;Y.moved=G*G+X*X>x}Y.event(W).zoom("mouse",n(_(Y.that.__zoom,Y.mouse[0]=er(W,L),Y.mouse[1]),Y.extent,l))}function J(W){K.on("mousemove.zoom mouseup.zoom",null),uA(W.view,Y.moved),Ji(W),Y.event(W).end()}}function q($,...M){if(e.apply(this,arguments)){var L=this.__zoom,Y=er($.changedTouches?$.changedTouches[0]:$,this),K=L.invert(Y),D=L.k*($.shiftKey?.5:2),z=n(_(S(L,D),Y,K),t.apply(this,M),l);Ji($),u>0?On(this).transition().duration(u).call(T,z,Y,$):On(this).call(j.transform,z,Y,$)}}function P($,...M){if(e.apply(this,arguments)){var L=$.touches,Y=L.length,K=R(this,M,$.changedTouches.length===Y).event($),D,z,F,H;for(Vf($),z=0;z<Y;++z)F=L[z],H=er(F,this),H=[H,this.__zoom.invert(H),F.identifier],K.touch0?!K.touch1&&K.touch0[2]!==H[2]&&(K.touch1=H,K.taps=0):(K.touch0=H,D=!0,K.taps=1+!!h);h&&(h=clearTimeout(h)),D&&(K.taps<2&&(p=H[0],h=setTimeout(function(){h=null},w)),Ru(this),K.start())}}function O($,...M){if(this.__zooming){var L=R(this,M).event($),Y=$.changedTouches,K=Y.length,D,z,F,H;for(Ji($),D=0;D<K;++D)z=Y[D],F=er(z,this),L.touch0&&L.touch0[2]===z.identifier?L.touch0[0]=F:L.touch1&&L.touch1[2]===z.identifier&&(L.touch1[0]=F);if(z=L.that.__zoom,L.touch1){var J=L.touch0[0],W=L.touch0[1],G=L.touch1[0],X=L.touch1[1],Z=(Z=G[0]-J[0])*Z+(Z=G[1]-J[1])*Z,ee=(ee=X[0]-W[0])*ee+(ee=X[1]-W[1])*ee;z=S(z,Math.sqrt(Z/ee)),F=[(J[0]+G[0])/2,(J[1]+G[1])/2],H=[(W[0]+X[0])/2,(W[1]+X[1])/2]}else if(L.touch0)F=L.touch0[0],H=L.touch0[1];else return;L.zoom("touch",n(_(z,F,H),L.extent,l))}}function V($,...M){if(this.__zooming){var L=R(this,M).event($),Y=$.changedTouches,K=Y.length,D,z;for(Vf($),g&&clearTimeout(g),g=setTimeout(function(){g=null},w),D=0;D<K;++D)z=Y[D],L.touch0&&L.touch0[2]===z.identifier?delete L.touch0:L.touch1&&L.touch1[2]===z.identifier&&delete L.touch1;if(L.touch1&&!L.touch0&&(L.touch0=L.touch1,delete L.touch1),L.touch0)L.touch0[1]=this.__zoom.invert(L.touch0[0]);else if(L.end(),L.taps===2&&(z=er(z,this),Math.hypot(p[0]-z[0],p[1]-z[1])<b)){var F=On(this).on("dblclick.zoom");F&&F.apply(this,arguments)}}}return j.wheelDelta=function($){return arguments.length?(r=typeof $=="function"?$:lu(+$),j):r},j.filter=function($){return arguments.length?(e=typeof $=="function"?$:lu(!!$),j):e},j.touchable=function($){return arguments.length?(s=typeof $=="function"?$:lu(!!$),j):s},j.extent=function($){return arguments.length?(t=typeof $=="function"?$:lu([[+$[0][0],+$[0][1]],[+$[1][0],+$[1][1]]]),j):t},j.scaleExtent=function($){return arguments.length?(i[0]=+$[0],i[1]=+$[1],j):[i[0],i[1]]},j.translateExtent=function($){return arguments.length?(l[0][0]=+$[0][0],l[1][0]=+$[1][0],l[0][1]=+$[0][1],l[1][1]=+$[1][1],j):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},j.constrain=function($){return arguments.length?(n=$,j):n},j.duration=function($){return arguments.length?(u=+$,j):u},j.interpolate=function($){return arguments.length?(d=$,j):d},j.on=function(){var $=f.on.apply(f,arguments);return $===f?j:$},j.clickDistance=function($){return arguments.length?(x=($=+$)*$,j):Math.sqrt(x)},j.tapDistance=function($){return arguments.length?(b=+$,j):b},j}var Ot=YR();const bd=v.createContext(null),zD=bd.Provider,es={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.`},SA=es.error001();function Ke(e,t){const n=v.useContext(bd);if(n===null)throw new Error(SA);return XR(n,e,t)}const xt=()=>{const e=v.useContext(bd);if(e===null)throw new Error(SA);return v.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},HD=e=>e.userSelectionActive?"none":"all";function Kx({position:e,children:t,className:n,style:r,...s}){const i=Ke(HD),l=`${e}`.split("-");return ue.createElement("div",{className:Dt(["react-flow__panel",n,...l]),style:{...r,pointerEvents:i},...s},t)}function WD({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:ue.createElement(Kx,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://reactflow.dev/pro"},ue.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}const VD=({x:e,y:t,label:n,labelStyle:r={},labelShowBg:s=!0,labelBgStyle:i={},labelBgPadding:l=[2,4],labelBgBorderRadius:u=2,children:d,className:f,...h})=>{const p=v.useRef(null),[g,w]=v.useState({x:0,y:0,width:0,height:0}),k=Dt(["react-flow__edge-textwrapper",f]);return v.useEffect(()=>{if(p.current){const x=p.current.getBBox();w({x:x.x,y:x.y,width:x.width,height:x.height})}},[n]),typeof n>"u"||!n?null:ue.createElement("g",{transform:`translate(${e-g.width/2} ${t-g.height/2})`,className:k,visibility:g.width?"visible":"hidden",...h},s&&ue.createElement("rect",{width:g.width+2*l[0],x:-l[0],y:-l[1],height:g.height+2*l[1],className:"react-flow__edge-textbg",style:i,rx:u,ry:u}),ue.createElement("text",{className:"react-flow__edge-text",y:g.height/2,dy:"0.3em",ref:p,style:r},n),d)};var GD=v.memo(VD);const Yx=e=>({width:e.offsetWidth,height:e.offsetHeight}),Yo=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Xx=(e={x:0,y:0},t)=>({x:Yo(e.x,t[0][0],t[1][0]),y:Yo(e.y,t[0][1],t[1][1])}),tN=(e,t,n)=>e<t?Yo(Math.abs(e-t),1,50)/50:e>n?-Yo(Math.abs(e-n),1,50)/50:0,_A=(e,t)=>{const n=tN(e.x,35,t.width-35)*20,r=tN(e.y,35,t.height-35)*20;return[n,r]},EA=e=>{var t;return((t=e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},CA=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),bl=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),TA=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),nN=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),KD=(e,t)=>TA(CA(bl(e),bl(t))),Hv=(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)},YD=e=>Ln(e.width)&&Ln(e.height)&&Ln(e.x)&&Ln(e.y),Ln=e=>!isNaN(e)&&isFinite(e),ft=Symbol.for("internals"),RA=["Enter"," ","Escape"],XD=(e,t)=>{},ZD=e=>"nativeEvent"in e;function Wv(e){var s,i;const t=ZD(e)?e.nativeEvent:e,n=((i=(s=t.composedPath)==null?void 0:s.call(t))==null?void 0:i[0])||e.target;return["INPUT","SELECT","TEXTAREA"].includes(n==null?void 0:n.nodeName)||(n==null?void 0:n.hasAttribute("contenteditable"))||!!(n!=null&&n.closest(".nokey"))}const AA=e=>"clientX"in e,Hs=(e,t)=>{var i,l;const n=AA(e),r=n?e.clientX:(i=e.touches)==null?void 0:i[0].clientX,s=n?e.clientY:(l=e.touches)==null?void 0:l[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:s-((t==null?void 0:t.top)??0)}},Vu=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0},ql=({id:e,path:t,labelX:n,labelY:r,label:s,labelStyle:i,labelShowBg:l,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:p,markerStart:g,interactionWidth:w=20})=>ue.createElement(ue.Fragment,null,ue.createElement("path",{id:e,style:h,d:t,fill:"none",className:"react-flow__edge-path",markerEnd:p,markerStart:g}),w&&ue.createElement("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:w,className:"react-flow__edge-interaction"}),s&&Ln(n)&&Ln(r)?ue.createElement(GD,{x:n,y:r,label:s,labelStyle:i,labelShowBg:l,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f}):null);ql.displayName="BaseEdge";function Qi(e,t,n){return n===void 0?n:r=>{const s=t().edges.find(i=>i.id===e);s&&n(r,{...s})}}function MA({sourceX:e,sourceY:t,targetX:n,targetY:r}){const s=Math.abs(n-e)/2,i=n<e?n+s:n-s,l=Math.abs(r-t)/2,u=r<t?r+l:r-l;return[i,u,s,l]}function $A({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:s,sourceControlY:i,targetControlX:l,targetControlY:u}){const d=e*.125+s*.375+l*.375+n*.125,f=t*.125+i*.375+u*.375+r*.125,h=Math.abs(d-e),p=Math.abs(f-t);return[d,f,h,p]}var Oa;(function(e){e.Strict="strict",e.Loose="loose"})(Oa||(Oa={}));var Ea;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Ea||(Ea={}));var kl;(function(e){e.Partial="partial",e.Full="full"})(kl||(kl={}));var qs;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(qs||(qs={}));var Gu;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Gu||(Gu={}));var Te;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Te||(Te={}));function rN({pos:e,x1:t,y1:n,x2:r,y2:s}){return e===Te.Left||e===Te.Right?[.5*(t+r),n]:[t,.5*(n+s)]}function IA({sourceX:e,sourceY:t,sourcePosition:n=Te.Bottom,targetX:r,targetY:s,targetPosition:i=Te.Top}){const[l,u]=rN({pos:n,x1:e,y1:t,x2:r,y2:s}),[d,f]=rN({pos:i,x1:r,y1:s,x2:e,y2:t}),[h,p,g,w]=$A({sourceX:e,sourceY:t,targetX:r,targetY:s,sourceControlX:l,sourceControlY:u,targetControlX:d,targetControlY:f});return[`M${e},${t} C${l},${u} ${d},${f} ${r},${s}`,h,p,g,w]}const Zx=v.memo(({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:s=Te.Bottom,targetPosition:i=Te.Top,label:l,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:g,markerEnd:w,markerStart:k,interactionWidth:x})=>{const[b,j,S]=IA({sourceX:e,sourceY:t,sourcePosition:s,targetX:n,targetY:r,targetPosition:i});return ue.createElement(ql,{path:b,labelX:j,labelY:S,label:l,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:g,markerEnd:w,markerStart:k,interactionWidth:x})});Zx.displayName="SimpleBezierEdge";const sN={[Te.Left]:{x:-1,y:0},[Te.Right]:{x:1,y:0},[Te.Top]:{x:0,y:-1},[Te.Bottom]:{x:0,y:1}},JD=({source:e,sourcePosition:t=Te.Bottom,target:n})=>t===Te.Left||t===Te.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},aN=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function QD({source:e,sourcePosition:t=Te.Bottom,target:n,targetPosition:r=Te.Top,center:s,offset:i}){const l=sN[t],u=sN[r],d={x:e.x+l.x*i,y:e.y+l.y*i},f={x:n.x+u.x*i,y:n.y+u.y*i},h=JD({source:d,sourcePosition:t,target:f}),p=h.x!==0?"x":"y",g=h[p];let w=[],k,x;const b={x:0,y:0},j={x:0,y:0},[S,_,E,T]=MA({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[p]*u[p]===-1){k=s.x??S,x=s.y??_;const A=[{x:k,y:d.y},{x:k,y:f.y}],U=[{x:d.x,y:x},{x:f.x,y:x}];l[p]===g?w=p==="x"?A:U:w=p==="x"?U:A}else{const A=[{x:d.x,y:f.y}],U=[{x:f.x,y:d.y}];if(p==="x"?w=l.x===g?U:A:w=l.y===g?A:U,t===r){const V=Math.abs(e[p]-n[p]);if(V<=i){const $=Math.min(i-1,i-V);l[p]===g?b[p]=(d[p]>e[p]?-1:1)*$:j[p]=(f[p]>n[p]?-1:1)*$}}if(t!==r){const V=p==="x"?"y":"x",$=l[p]===u[V],M=d[V]>f[V],L=d[V]<f[V];(l[p]===1&&(!$&&M||$&&L)||l[p]!==1&&(!$&&L||$&&M))&&(w=p==="x"?A:U)}const I={x:d.x+b.x,y:d.y+b.y},q={x:f.x+j.x,y:f.y+j.y},P=Math.max(Math.abs(I.x-w[0].x),Math.abs(q.x-w[0].x)),O=Math.max(Math.abs(I.y-w[0].y),Math.abs(q.y-w[0].y));P>=O?(k=(I.x+q.x)/2,x=w[0].y):(k=w[0].x,x=(I.y+q.y)/2)}return[[e,{x:d.x+b.x,y:d.y+b.y},...w,{x:f.x+j.x,y:f.y+j.y},n],k,x,E,T]}function e5(e,t,n,r){const s=Math.min(aN(e,t)/2,aN(t,n)/2,r),{x:i,y:l}=t;if(e.x===i&&i===n.x||e.y===l&&l===n.y)return`L${i} ${l}`;if(e.y===l){const f=e.x<n.x?-1:1,h=e.y<n.y?1:-1;return`L ${i+s*f},${l}Q ${i},${l} ${i},${l+s*h}`}const u=e.x<n.x?1:-1,d=e.y<n.y?-1:1;return`L ${i},${l+s*d}Q ${i},${l} ${i+s*u},${l}`}function Vv({sourceX:e,sourceY:t,sourcePosition:n=Te.Bottom,targetX:r,targetY:s,targetPosition:i=Te.Top,borderRadius:l=5,centerX:u,centerY:d,offset:f=20}){const[h,p,g,w,k]=QD({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:s},targetPosition:i,center:{x:u,y:d},offset:f});return[h.reduce((b,j,S)=>{let _="";return S>0&&S<h.length-1?_=e5(h[S-1],j,h[S+1],l):_=`${S===0?"M":"L"}${j.x} ${j.y}`,b+=_,b},""),p,g,w,k]}const kd=v.memo(({sourceX:e,sourceY:t,targetX:n,targetY:r,label:s,labelStyle:i,labelShowBg:l,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,sourcePosition:p=Te.Bottom,targetPosition:g=Te.Top,markerEnd:w,markerStart:k,pathOptions:x,interactionWidth:b})=>{const[j,S,_]=Vv({sourceX:e,sourceY:t,sourcePosition:p,targetX:n,targetY:r,targetPosition:g,borderRadius:x==null?void 0:x.borderRadius,offset:x==null?void 0:x.offset});return ue.createElement(ql,{path:j,labelX:S,labelY:_,label:s,labelStyle:i,labelShowBg:l,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:w,markerStart:k,interactionWidth:b})});kd.displayName="SmoothStepEdge";const Jx=v.memo(e=>{var t;return ue.createElement(kd,{...e,pathOptions:v.useMemo(()=>{var n;return{borderRadius:0,offset:(n=e.pathOptions)==null?void 0:n.offset}},[(t=e.pathOptions)==null?void 0:t.offset])})});Jx.displayName="StepEdge";function t5({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[s,i,l,u]=MA({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,s,i,l,u]}const Qx=v.memo(({sourceX:e,sourceY:t,targetX:n,targetY:r,label:s,labelStyle:i,labelShowBg:l,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:p,markerStart:g,interactionWidth:w})=>{const[k,x,b]=t5({sourceX:e,sourceY:t,targetX:n,targetY:r});return ue.createElement(ql,{path:k,labelX:x,labelY:b,label:s,labelStyle:i,labelShowBg:l,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:p,markerStart:g,interactionWidth:w})});Qx.displayName="StraightEdge";function cu(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function oN({pos:e,x1:t,y1:n,x2:r,y2:s,c:i}){switch(e){case Te.Left:return[t-cu(t-r,i),n];case Te.Right:return[t+cu(r-t,i),n];case Te.Top:return[t,n-cu(n-s,i)];case Te.Bottom:return[t,n+cu(s-n,i)]}}function e0({sourceX:e,sourceY:t,sourcePosition:n=Te.Bottom,targetX:r,targetY:s,targetPosition:i=Te.Top,curvature:l=.25}){const[u,d]=oN({pos:n,x1:e,y1:t,x2:r,y2:s,c:l}),[f,h]=oN({pos:i,x1:r,y1:s,x2:e,y2:t,c:l}),[p,g,w,k]=$A({sourceX:e,sourceY:t,targetX:r,targetY:s,sourceControlX:u,sourceControlY:d,targetControlX:f,targetControlY:h});return[`M${e},${t} C${u},${d} ${f},${h} ${r},${s}`,p,g,w,k]}const Ku=v.memo(({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:s=Te.Bottom,targetPosition:i=Te.Top,label:l,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:g,markerEnd:w,markerStart:k,pathOptions:x,interactionWidth:b})=>{const[j,S,_]=e0({sourceX:e,sourceY:t,sourcePosition:s,targetX:n,targetY:r,targetPosition:i,curvature:x==null?void 0:x.curvature});return ue.createElement(ql,{path:j,labelX:S,labelY:_,label:l,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:g,markerEnd:w,markerStart:k,interactionWidth:b})});Ku.displayName="BezierEdge";const t0=v.createContext(null),n5=t0.Provider;t0.Consumer;const r5=()=>v.useContext(t0),s5=e=>"id"in e&&"source"in e&&"target"in e,a5=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`reactflow__edge-${e}${t||""}-${n}${r||""}`,Gv=(e,t)=>typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`,o5=(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)),i5=(e,t)=>{if(!e.source||!e.target)return t;let n;return s5(e)?n={...e}:n={...e,id:a5(e)},o5(n,t)?t:t.concat(n)},Kv=({x:e,y:t},[n,r,s],i,[l,u])=>{const d={x:(e-n)/s,y:(t-r)/s};return i?{x:l*Math.round(d.x/l),y:u*Math.round(d.y/u)}:d},OA=({x:e,y:t},[n,r,s])=>({x:e*s+n,y:t*s+r}),Ra=(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],s={x:e.position.x-n,y:e.position.y-r};return{...s,positionAbsolute:e.positionAbsolute?{x:e.positionAbsolute.x-n,y:e.positionAbsolute.y-r}:s}},Nd=(e,t=[0,0])=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,s)=>{const{x:i,y:l}=Ra(s,t).positionAbsolute;return CA(r,bl({x:i,y:l,width:s.width||0,height:s.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return TA(n)},LA=(e,t,[n,r,s]=[0,0,1],i=!1,l=!1,u=[0,0])=>{const d={x:(t.x-n)/s,y:(t.y-r)/s,width:t.width/s,height:t.height/s},f=[];return e.forEach(h=>{const{width:p,height:g,selectable:w=!0,hidden:k=!1}=h;if(l&&!w||k)return!1;const{positionAbsolute:x}=Ra(h,u),b={x:x.x,y:x.y,width:p||0,height:g||0},j=Hv(d,b),S=typeof p>"u"||typeof g>"u"||p===null||g===null,_=i&&j>0,E=(p||0)*(g||0);(S||_||j>=E||h.dragging)&&f.push(h)}),f},PA=(e,t)=>{const n=e.map(r=>r.id);return t.filter(r=>n.includes(r.source)||n.includes(r.target))},DA=(e,t,n,r,s,i=.1)=>{const l=t/(e.width*(1+i)),u=n/(e.height*(1+i)),d=Math.min(l,u),f=Yo(d,r,s),h=e.x+e.width/2,p=e.y+e.height/2,g=t/2-h*f,w=n/2-p*f;return{x:g,y:w,zoom:f}},ka=(e,t=0)=>e.transition().duration(t);function iN(e,t,n,r){return(t[n]||[]).reduce((s,i)=>{var l,u;return`${e.id}-${i.id}-${n}`!==r&&s.push({id:i.id||null,type:n,nodeId:e.id,x:(((l=e.positionAbsolute)==null?void 0:l.x)??0)+i.x+i.width/2,y:(((u=e.positionAbsolute)==null?void 0:u.y)??0)+i.y+i.height/2}),s},[])}function l5(e,t,n,r,s,i){const{x:l,y:u}=Hs(e),f=t.elementsFromPoint(l,u).find(k=>k.classList.contains("react-flow__handle"));if(f){const k=f.getAttribute("data-nodeid");if(k){const x=n0(void 0,f),b=f.getAttribute("data-handleid"),j=i({nodeId:k,id:b,type:x});if(j){const S=s.find(_=>_.nodeId===k&&_.type===x&&_.id===b);return{handle:{id:b,type:x,nodeId:k,x:(S==null?void 0:S.x)||n.x,y:(S==null?void 0:S.y)||n.y},validHandleResult:j}}}}let h=[],p=1/0;if(s.forEach(k=>{const x=Math.sqrt((k.x-n.x)**2+(k.y-n.y)**2);if(x<=r){const b=i(k);x<=p&&(x<p?h=[{handle:k,validHandleResult:b}]:x===p&&h.push({handle:k,validHandleResult:b}),p=x)}}),!h.length)return{handle:null,validHandleResult:FA()};if(h.length===1)return h[0];const g=h.some(({validHandleResult:k})=>k.isValid),w=h.some(({handle:k})=>k.type==="target");return h.find(({handle:k,validHandleResult:x})=>w?k.type==="target":g?x.isValid:!0)||h[0]}const c5={source:null,target:null,sourceHandle:null,targetHandle:null},FA=()=>({handleDomNode:null,isValid:!1,connection:c5,endHandle:null});function qA(e,t,n,r,s,i,l){const u=s==="target",d=l.querySelector(`.react-flow__handle[data-id="${e==null?void 0:e.nodeId}-${e==null?void 0:e.id}-${e==null?void 0:e.type}"]`),f={...FA(),handleDomNode:d};if(d){const h=n0(void 0,d),p=d.getAttribute("data-nodeid"),g=d.getAttribute("data-handleid"),w=d.classList.contains("connectable"),k=d.classList.contains("connectableend"),x={source:u?p:n,sourceHandle:u?g:r,target:u?n:p,targetHandle:u?r:g};f.connection=x,w&&k&&(t===Oa.Strict?u&&h==="source"||!u&&h==="target":p!==n||g!==r)&&(f.endHandle={nodeId:p,handleId:g,type:h},f.isValid=i(x))}return f}function u5({nodes:e,nodeId:t,handleId:n,handleType:r}){return e.reduce((s,i)=>{if(i[ft]){const{handleBounds:l}=i[ft];let u=[],d=[];l&&(u=iN(i,l,"source",`${t}-${n}-${r}`),d=iN(i,l,"target",`${t}-${n}-${r}`)),s.push(...u,...d)}return s},[])}function n0(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function Gf(e){e==null||e.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function d5(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}function BA({event:e,handleId:t,nodeId:n,onConnect:r,isTarget:s,getState:i,setState:l,isValidConnection:u,edgeUpdaterType:d,onReconnectEnd:f}){const h=EA(e.target),{connectionMode:p,domNode:g,autoPanOnConnect:w,connectionRadius:k,onConnectStart:x,panBy:b,getNodes:j,cancelConnection:S}=i();let _=0,E;const{x:T,y:R}=Hs(e),A=h==null?void 0:h.elementFromPoint(T,R),U=n0(d,A),I=g==null?void 0:g.getBoundingClientRect();if(!I||!U)return;let q,P=Hs(e,I),O=!1,V=null,$=!1,M=null;const L=u5({nodes:j(),nodeId:n,handleId:t,handleType:U}),Y=()=>{if(!w)return;const[z,F]=_A(P,I);b({x:z,y:F}),_=requestAnimationFrame(Y)};l({connectionPosition:P,connectionStatus:null,connectionNodeId:n,connectionHandleId:t,connectionHandleType:U,connectionStartHandle:{nodeId:n,handleId:t,type:U},connectionEndHandle:null}),x==null||x(e,{nodeId:n,handleId:t,handleType:U});function K(z){const{transform:F}=i();P=Hs(z,I);const{handle:H,validHandleResult:J}=l5(z,h,Kv(P,F,!1,[1,1]),k,L,W=>qA(W,p,n,t,s?"target":"source",u,h));if(E=H,O||(Y(),O=!0),M=J.handleDomNode,V=J.connection,$=J.isValid,l({connectionPosition:E&&$?OA({x:E.x,y:E.y},F):P,connectionStatus:d5(!!E,$),connectionEndHandle:J.endHandle}),!E&&!$&&!M)return Gf(q);V.source!==V.target&&M&&(Gf(q),q=M,M.classList.add("connecting","react-flow__handle-connecting"),M.classList.toggle("valid",$),M.classList.toggle("react-flow__handle-valid",$))}function D(z){var F,H;(E||M)&&V&&$&&(r==null||r(V)),(H=(F=i()).onConnectEnd)==null||H.call(F,z),d&&(f==null||f(z)),Gf(q),S(),cancelAnimationFrame(_),O=!1,$=!1,V=null,M=null,h.removeEventListener("mousemove",K),h.removeEventListener("mouseup",D),h.removeEventListener("touchmove",K),h.removeEventListener("touchend",D)}h.addEventListener("mousemove",K),h.addEventListener("mouseup",D),h.addEventListener("touchmove",K),h.addEventListener("touchend",D)}const lN=()=>!0,h5=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),f5=(e,t,n)=>r=>{const{connectionStartHandle:s,connectionEndHandle:i,connectionClickStartHandle:l}=r;return{connecting:(s==null?void 0:s.nodeId)===e&&(s==null?void 0:s.handleId)===t&&(s==null?void 0:s.type)===n||(i==null?void 0:i.nodeId)===e&&(i==null?void 0:i.handleId)===t&&(i==null?void 0:i.type)===n,clickConnecting:(l==null?void 0:l.nodeId)===e&&(l==null?void 0:l.handleId)===t&&(l==null?void 0:l.type)===n}},UA=v.forwardRef(({type:e="source",position:t=Te.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:s=!0,isConnectableEnd:i=!0,id:l,onConnect:u,children:d,className:f,onMouseDown:h,onTouchStart:p,...g},w)=>{var I,q;const k=l||null,x=e==="target",b=xt(),j=r5(),{connectOnClick:S,noPanClassName:_}=Ke(h5,Rt),{connecting:E,clickConnecting:T}=Ke(f5(j,k,e),Rt);j||(q=(I=b.getState()).onError)==null||q.call(I,"010",es.error010());const R=P=>{const{defaultEdgeOptions:O,onConnect:V,hasDefaultEdges:$}=b.getState(),M={...O,...P};if($){const{edges:L,setEdges:Y}=b.getState();Y(i5(M,L))}V==null||V(M),u==null||u(M)},A=P=>{if(!j)return;const O=AA(P);s&&(O&&P.button===0||!O)&&BA({event:P,handleId:k,nodeId:j,onConnect:R,isTarget:x,getState:b.getState,setState:b.setState,isValidConnection:n||b.getState().isValidConnection||lN}),O?h==null||h(P):p==null||p(P)},U=P=>{const{onClickConnectStart:O,onClickConnectEnd:V,connectionClickStartHandle:$,connectionMode:M,isValidConnection:L}=b.getState();if(!j||!$&&!s)return;if(!$){O==null||O(P,{nodeId:j,handleId:k,handleType:e}),b.setState({connectionClickStartHandle:{nodeId:j,type:e,handleId:k}});return}const Y=EA(P.target),K=n||L||lN,{connection:D,isValid:z}=qA({nodeId:j,id:k,type:e},M,$.nodeId,$.handleId||null,$.type,K,Y);z&&R(D),V==null||V(P),b.setState({connectionClickStartHandle:null})};return ue.createElement("div",{"data-handleid":k,"data-nodeid":j,"data-handlepos":t,"data-id":`${j}-${k}-${e}`,className:Dt(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",_,f,{source:!x,target:x,connectable:r,connectablestart:s,connectableend:i,connecting:T,connectionindicator:r&&(s&&!E||i&&E)}]),onMouseDown:A,onTouchStart:A,onClick:S?U:void 0,ref:w,...g},d)});UA.displayName="Handle";var La=v.memo(UA);const zA=({data:e,isConnectable:t,targetPosition:n=Te.Top,sourcePosition:r=Te.Bottom})=>ue.createElement(ue.Fragment,null,ue.createElement(La,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,ue.createElement(La,{type:"source",position:r,isConnectable:t}));zA.displayName="DefaultNode";var Yv=v.memo(zA);const HA=({data:e,isConnectable:t,sourcePosition:n=Te.Bottom})=>ue.createElement(ue.Fragment,null,e==null?void 0:e.label,ue.createElement(La,{type:"source",position:n,isConnectable:t}));HA.displayName="InputNode";var WA=v.memo(HA);const VA=({data:e,isConnectable:t,targetPosition:n=Te.Top})=>ue.createElement(ue.Fragment,null,ue.createElement(La,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label);VA.displayName="OutputNode";var GA=v.memo(VA);const r0=()=>null;r0.displayName="GroupNode";const p5=e=>({selectedNodes:e.getNodes().filter(t=>t.selected),selectedEdges:e.edges.filter(t=>t.selected).map(t=>({...t}))}),uu=e=>e.id;function m5(e,t){return Rt(e.selectedNodes.map(uu),t.selectedNodes.map(uu))&&Rt(e.selectedEdges.map(uu),t.selectedEdges.map(uu))}const KA=v.memo(({onSelectionChange:e})=>{const t=xt(),{selectedNodes:n,selectedEdges:r}=Ke(p5,m5);return v.useEffect(()=>{const s={nodes:n,edges:r};e==null||e(s),t.getState().onSelectionChange.forEach(i=>i(s))},[n,r,e]),null});KA.displayName="SelectionListener";const g5=e=>!!e.onSelectionChange;function y5({onSelectionChange:e}){const t=Ke(g5);return e||t?ue.createElement(KA,{onSelectionChange:e}):null}const w5=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 ko(e,t){v.useEffect(()=>{typeof e<"u"&&t(e)},[e])}function Fe(e,t,n){v.useEffect(()=>{typeof t<"u"&&n({[e]:t})},[t])}const v5=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:s,onConnectStart:i,onConnectEnd:l,onClickConnectStart:u,onClickConnectEnd:d,nodesDraggable:f,nodesConnectable:h,nodesFocusable:p,edgesFocusable:g,edgesUpdatable:w,elevateNodesOnSelect:k,minZoom:x,maxZoom:b,nodeExtent:j,onNodesChange:S,onEdgesChange:_,elementsSelectable:E,connectionMode:T,snapGrid:R,snapToGrid:A,translateExtent:U,connectOnClick:I,defaultEdgeOptions:q,fitView:P,fitViewOptions:O,onNodesDelete:V,onEdgesDelete:$,onNodeDrag:M,onNodeDragStart:L,onNodeDragStop:Y,onSelectionDrag:K,onSelectionDragStart:D,onSelectionDragStop:z,noPanClassName:F,nodeOrigin:H,rfId:J,autoPanOnConnect:W,autoPanOnNodeDrag:G,onError:X,connectionRadius:Z,isValidConnection:ee,nodeDragThreshold:re})=>{const{setNodes:ce,setEdges:ie,setDefaultNodesAndEdges:fe,setMinZoom:de,setMaxZoom:we,setTranslateExtent:xe,setNodeExtent:$e,reset:be}=Ke(w5,Rt),he=xt();return v.useEffect(()=>{const se=r==null?void 0:r.map(ke=>({...ke,...q}));return fe(n,se),()=>{be()}},[]),Fe("defaultEdgeOptions",q,he.setState),Fe("connectionMode",T,he.setState),Fe("onConnect",s,he.setState),Fe("onConnectStart",i,he.setState),Fe("onConnectEnd",l,he.setState),Fe("onClickConnectStart",u,he.setState),Fe("onClickConnectEnd",d,he.setState),Fe("nodesDraggable",f,he.setState),Fe("nodesConnectable",h,he.setState),Fe("nodesFocusable",p,he.setState),Fe("edgesFocusable",g,he.setState),Fe("edgesUpdatable",w,he.setState),Fe("elementsSelectable",E,he.setState),Fe("elevateNodesOnSelect",k,he.setState),Fe("snapToGrid",A,he.setState),Fe("snapGrid",R,he.setState),Fe("onNodesChange",S,he.setState),Fe("onEdgesChange",_,he.setState),Fe("connectOnClick",I,he.setState),Fe("fitViewOnInit",P,he.setState),Fe("fitViewOnInitOptions",O,he.setState),Fe("onNodesDelete",V,he.setState),Fe("onEdgesDelete",$,he.setState),Fe("onNodeDrag",M,he.setState),Fe("onNodeDragStart",L,he.setState),Fe("onNodeDragStop",Y,he.setState),Fe("onSelectionDrag",K,he.setState),Fe("onSelectionDragStart",D,he.setState),Fe("onSelectionDragStop",z,he.setState),Fe("noPanClassName",F,he.setState),Fe("nodeOrigin",H,he.setState),Fe("rfId",J,he.setState),Fe("autoPanOnConnect",W,he.setState),Fe("autoPanOnNodeDrag",G,he.setState),Fe("onError",X,he.setState),Fe("connectionRadius",Z,he.setState),Fe("isValidConnection",ee,he.setState),Fe("nodeDragThreshold",re,he.setState),ko(e,ce),ko(t,ie),ko(x,de),ko(b,we),ko(U,xe),ko(j,$e),null},cN={display:"none"},x5={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},YA="react-flow__node-desc",XA="react-flow__edge-desc",b5="react-flow__aria-live",k5=e=>e.ariaLiveMessage;function N5({rfId:e}){const t=Ke(k5);return ue.createElement("div",{id:`${b5}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:x5},t)}function j5({rfId:e,disableKeyboardA11y:t}){return ue.createElement(ue.Fragment,null,ue.createElement("div",{id:`${YA}-${e}`,style:cN},"Press enter or space to select a node.",!t&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "),ue.createElement("div",{id:`${XA}-${e}`,style:cN},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!t&&ue.createElement(N5,{rfId:e}))}var Nl=(e=null,t={actInsideInputWithModifier:!0})=>{const[n,r]=v.useState(!1),s=v.useRef(!1),i=v.useRef(new Set([])),[l,u]=v.useMemo(()=>{if(e!==null){const f=(Array.isArray(e)?e:[e]).filter(p=>typeof p=="string").map(p=>p.split("+")),h=f.reduce((p,g)=>p.concat(...g),[]);return[f,h]}return[[],[]]},[e]);return v.useEffect(()=>{const d=typeof document<"u"?document:null,f=(t==null?void 0:t.target)||d;if(e!==null){const h=w=>{if(s.current=w.ctrlKey||w.metaKey||w.shiftKey,(!s.current||s.current&&!t.actInsideInputWithModifier)&&Wv(w))return!1;const x=dN(w.code,u);i.current.add(w[x]),uN(l,i.current,!1)&&(w.preventDefault(),r(!0))},p=w=>{if((!s.current||s.current&&!t.actInsideInputWithModifier)&&Wv(w))return!1;const x=dN(w.code,u);uN(l,i.current,!0)?(r(!1),i.current.clear()):i.current.delete(w[x]),w.key==="Meta"&&i.current.clear(),s.current=!1},g=()=>{i.current.clear(),r(!1)};return f==null||f.addEventListener("keydown",h),f==null||f.addEventListener("keyup",p),window.addEventListener("blur",g),()=>{f==null||f.removeEventListener("keydown",h),f==null||f.removeEventListener("keyup",p),window.removeEventListener("blur",g)}}},[e,r]),n};function uN(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(s=>t.has(s)))}function dN(e,t){return t.includes(e)?"code":"key"}function ZA(e,t,n,r){var u,d;const s=e.parentNode||e.parentId;if(!s)return n;const i=t.get(s),l=Ra(i,r);return ZA(i,t,{x:(n.x??0)+l.x,y:(n.y??0)+l.y,z:(((u=i[ft])==null?void 0:u.z)??0)>(n.z??0)?((d=i[ft])==null?void 0:d.z)??0:n.z??0},r)}function JA(e,t,n){e.forEach(r=>{var i;const s=r.parentNode||r.parentId;if(s&&!e.has(s))throw new Error(`Parent node ${s} not found`);if(s||n!=null&&n[r.id]){const{x:l,y:u,z:d}=ZA(r,e,{...r.position,z:((i=r[ft])==null?void 0:i.z)??0},t);r.positionAbsolute={x:l,y:u},r[ft].z=d,n!=null&&n[r.id]&&(r[ft].isParent=!0)}})}function Kf(e,t,n,r){const s=new Map,i={},l=r?1e3:0;return e.forEach(u=>{var w;const d=(Ln(u.zIndex)?u.zIndex:0)+(u.selected?l:0),f=t.get(u.id),h={...u,positionAbsolute:{x:u.position.x,y:u.position.y}},p=u.parentNode||u.parentId;p&&(i[p]=!0);const g=(f==null?void 0:f.type)&&(f==null?void 0:f.type)!==u.type;Object.defineProperty(h,ft,{enumerable:!1,value:{handleBounds:g||(w=f==null?void 0:f[ft])==null?void 0:w.handleBounds,z:d}}),s.set(u.id,h)}),JA(s,n,i),s}function QA(e,t={}){const{getNodes:n,width:r,height:s,minZoom:i,maxZoom:l,d3Zoom:u,d3Selection:d,fitViewOnInitDone:f,fitViewOnInit:h,nodeOrigin:p}=e(),g=t.initial&&!f&&h;if(u&&d&&(g||!t.initial)){const k=n().filter(b=>{var S;const j=t.includeHiddenNodes?b.width&&b.height:!b.hidden;return(S=t.nodes)!=null&&S.length?j&&t.nodes.some(_=>_.id===b.id):j}),x=k.every(b=>b.width&&b.height);if(k.length>0&&x){const b=Nd(k,p),{x:j,y:S,zoom:_}=DA(b,r,s,t.minZoom??i,t.maxZoom??l,t.padding??.1),E=Xr.translate(j,S).scale(_);return typeof t.duration=="number"&&t.duration>0?u.transform(ka(d,t.duration),E):u.transform(d,E),!0}}return!1}function S5(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 _5(e,t){return t.map(n=>{const r=e.find(s=>s.id===n.id);return r&&(n.selected=r.selected),n})}function du({changedNodes:e,changedEdges:t,get:n,set:r}){const{nodeInternals:s,edges:i,onNodesChange:l,onEdgesChange:u,hasDefaultNodes:d,hasDefaultEdges:f}=n();e!=null&&e.length&&(d&&r({nodeInternals:S5(e,s)}),l==null||l(e)),t!=null&&t.length&&(f&&r({edges:_5(t,i)}),u==null||u(t))}const No=()=>{},E5={zoomIn:No,zoomOut:No,zoomTo:No,getZoom:()=>1,setViewport:No,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:No,fitBounds:No,project:e=>e,screenToFlowPosition:e=>e,flowToScreenPosition:e=>e,viewportInitialized:!1},C5=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),T5=()=>{const e=xt(),{d3Zoom:t,d3Selection:n}=Ke(C5,Rt);return v.useMemo(()=>n&&t?{zoomIn:s=>t.scaleBy(ka(n,s==null?void 0:s.duration),1.2),zoomOut:s=>t.scaleBy(ka(n,s==null?void 0:s.duration),1/1.2),zoomTo:(s,i)=>t.scaleTo(ka(n,i==null?void 0:i.duration),s),getZoom:()=>e.getState().transform[2],setViewport:(s,i)=>{const[l,u,d]=e.getState().transform,f=Xr.translate(s.x??l,s.y??u).scale(s.zoom??d);t.transform(ka(n,i==null?void 0:i.duration),f)},getViewport:()=>{const[s,i,l]=e.getState().transform;return{x:s,y:i,zoom:l}},fitView:s=>QA(e.getState,s),setCenter:(s,i,l)=>{const{width:u,height:d,maxZoom:f}=e.getState(),h=typeof(l==null?void 0:l.zoom)<"u"?l.zoom:f,p=u/2-s*h,g=d/2-i*h,w=Xr.translate(p,g).scale(h);t.transform(ka(n,l==null?void 0:l.duration),w)},fitBounds:(s,i)=>{const{width:l,height:u,minZoom:d,maxZoom:f}=e.getState(),{x:h,y:p,zoom:g}=DA(s,l,u,d,f,(i==null?void 0:i.padding)??.1),w=Xr.translate(h,p).scale(g);t.transform(ka(n,i==null?void 0:i.duration),w)},project:s=>{const{transform:i,snapToGrid:l,snapGrid:u}=e.getState();return console.warn("[DEPRECATED] `project` is deprecated. Instead use `screenToFlowPosition`. There is no need to subtract the react flow bounds anymore! https://reactflow.dev/api-reference/types/react-flow-instance#screen-to-flow-position"),Kv(s,i,l,u)},screenToFlowPosition:s=>{const{transform:i,snapToGrid:l,snapGrid:u,domNode:d}=e.getState();if(!d)return s;const{x:f,y:h}=d.getBoundingClientRect(),p={x:s.x-f,y:s.y-h};return Kv(p,i,l,u)},flowToScreenPosition:s=>{const{transform:i,domNode:l}=e.getState();if(!l)return s;const{x:u,y:d}=l.getBoundingClientRect(),f=OA(s,i);return{x:f.x+u,y:f.y+d}},viewportInitialized:!0}:E5,[t,n])};function oi(){const e=T5(),t=xt(),n=v.useCallback(()=>t.getState().getNodes().map(x=>({...x})),[]),r=v.useCallback(x=>t.getState().nodeInternals.get(x),[]),s=v.useCallback(()=>{const{edges:x=[]}=t.getState();return x.map(b=>({...b}))},[]),i=v.useCallback(x=>{const{edges:b=[]}=t.getState();return b.find(j=>j.id===x)},[]),l=v.useCallback(x=>{const{getNodes:b,setNodes:j,hasDefaultNodes:S,onNodesChange:_}=t.getState(),E=b(),T=typeof x=="function"?x(E):x;if(S)j(T);else if(_){const R=T.length===0?E.map(A=>({type:"remove",id:A.id})):T.map(A=>({item:A,type:"reset"}));_(R)}},[]),u=v.useCallback(x=>{const{edges:b=[],setEdges:j,hasDefaultEdges:S,onEdgesChange:_}=t.getState(),E=typeof x=="function"?x(b):x;if(S)j(E);else if(_){const T=E.length===0?b.map(R=>({type:"remove",id:R.id})):E.map(R=>({item:R,type:"reset"}));_(T)}},[]),d=v.useCallback(x=>{const b=Array.isArray(x)?x:[x],{getNodes:j,setNodes:S,hasDefaultNodes:_,onNodesChange:E}=t.getState();if(_){const R=[...j(),...b];S(R)}else if(E){const T=b.map(R=>({item:R,type:"add"}));E(T)}},[]),f=v.useCallback(x=>{const b=Array.isArray(x)?x:[x],{edges:j=[],setEdges:S,hasDefaultEdges:_,onEdgesChange:E}=t.getState();if(_)S([...j,...b]);else if(E){const T=b.map(R=>({item:R,type:"add"}));E(T)}},[]),h=v.useCallback(()=>{const{getNodes:x,edges:b=[],transform:j}=t.getState(),[S,_,E]=j;return{nodes:x().map(T=>({...T})),edges:b.map(T=>({...T})),viewport:{x:S,y:_,zoom:E}}},[]),p=v.useCallback(({nodes:x,edges:b})=>{const{nodeInternals:j,getNodes:S,edges:_,hasDefaultNodes:E,hasDefaultEdges:T,onNodesDelete:R,onEdgesDelete:A,onNodesChange:U,onEdgesChange:I}=t.getState(),q=(x||[]).map(M=>M.id),P=(b||[]).map(M=>M.id),O=S().reduce((M,L)=>{const Y=L.parentNode||L.parentId,K=!q.includes(L.id)&&Y&&M.find(z=>z.id===Y);return(typeof L.deletable=="boolean"?L.deletable:!0)&&(q.includes(L.id)||K)&&M.push(L),M},[]),V=_.filter(M=>typeof M.deletable=="boolean"?M.deletable:!0),$=V.filter(M=>P.includes(M.id));if(O||$){const M=PA(O,V),L=[...$,...M],Y=L.reduce((K,D)=>(K.includes(D.id)||K.push(D.id),K),[]);if((T||E)&&(T&&t.setState({edges:_.filter(K=>!Y.includes(K.id))}),E&&(O.forEach(K=>{j.delete(K.id)}),t.setState({nodeInternals:new Map(j)}))),Y.length>0&&(A==null||A(L),I&&I(Y.map(K=>({id:K,type:"remove"})))),O.length>0&&(R==null||R(O),U)){const K=O.map(D=>({id:D.id,type:"remove"}));U(K)}}},[]),g=v.useCallback(x=>{const b=YD(x),j=b?null:t.getState().nodeInternals.get(x.id);return!b&&!j?[null,null,b]:[b?x:nN(j),j,b]},[]),w=v.useCallback((x,b=!0,j)=>{const[S,_,E]=g(x);return S?(j||t.getState().getNodes()).filter(T=>{if(!E&&(T.id===_.id||!T.positionAbsolute))return!1;const R=nN(T),A=Hv(R,S);return b&&A>0||A>=S.width*S.height}):[]},[]),k=v.useCallback((x,b,j=!0)=>{const[S]=g(x);if(!S)return!1;const _=Hv(S,b);return j&&_>0||_>=S.width*S.height},[]);return v.useMemo(()=>({...e,getNodes:n,getNode:r,getEdges:s,getEdge:i,setNodes:l,setEdges:u,addNodes:d,addEdges:f,toObject:h,deleteElements:p,getIntersectingNodes:w,isNodeIntersecting:k}),[e,n,r,s,i,l,u,d,f,h,p,w,k])}const R5={actInsideInputWithModifier:!1};var A5=({deleteKeyCode:e,multiSelectionKeyCode:t})=>{const n=xt(),{deleteElements:r}=oi(),s=Nl(e,R5),i=Nl(t);v.useEffect(()=>{if(s){const{edges:l,getNodes:u}=n.getState(),d=u().filter(h=>h.selected),f=l.filter(h=>h.selected);r({nodes:d,edges:f}),n.setState({nodesSelectionActive:!1})}},[s]),v.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])};function M5(e){const t=xt();v.useEffect(()=>{let n;const r=()=>{var i,l;if(!e.current)return;const s=Yx(e.current);(s.height===0||s.width===0)&&((l=(i=t.getState()).onError)==null||l.call(i,"004",es.error004())),t.setState({width:s.width||500,height:s.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 s0={position:"absolute",width:"100%",height:"100%",top:0,left:0},$5=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,hu=e=>({x:e.x,y:e.y,zoom:e.k}),jo=(e,t)=>e.target.closest(`.${t}`),hN=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),fN=e=>{const t=e.ctrlKey&&Vu()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t},I5=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),O5=({onMove:e,onMoveStart:t,onMoveEnd:n,onPaneContextMenu:r,zoomOnScroll:s=!0,zoomOnPinch:i=!0,panOnScroll:l=!1,panOnScrollSpeed:u=.5,panOnScrollMode:d=Ea.Free,zoomOnDoubleClick:f=!0,elementsSelectable:h,panOnDrag:p=!0,defaultViewport:g,translateExtent:w,minZoom:k,maxZoom:x,zoomActivationKeyCode:b,preventScrolling:j=!0,children:S,noWheelClassName:_,noPanClassName:E})=>{const T=v.useRef(),R=xt(),A=v.useRef(!1),U=v.useRef(!1),I=v.useRef(null),q=v.useRef({x:0,y:0,zoom:0}),{d3Zoom:P,d3Selection:O,d3ZoomHandler:V,userSelectionActive:$}=Ke(I5,Rt),M=Nl(b),L=v.useRef(0),Y=v.useRef(!1),K=v.useRef();return M5(I),v.useEffect(()=>{if(I.current){const D=I.current.getBoundingClientRect(),z=jA().scaleExtent([k,x]).translateExtent(w),F=On(I.current).call(z),H=Xr.translate(g.x,g.y).scale(Yo(g.zoom,k,x)),J=[[0,0],[D.width,D.height]],W=z.constrain()(H,J,w);z.transform(F,W),z.wheelDelta(fN),R.setState({d3Zoom:z,d3Selection:F,d3ZoomHandler:F.on("wheel.zoom"),transform:[W.x,W.y,W.k],domNode:I.current.closest(".react-flow")})}},[]),v.useEffect(()=>{O&&P&&(l&&!M&&!$?O.on("wheel.zoom",D=>{if(jo(D,_))return!1;D.preventDefault(),D.stopImmediatePropagation();const z=O.property("__zoom").k||1;if(D.ctrlKey&&i){const ee=er(D),re=fN(D),ce=z*Math.pow(2,re);P.scaleTo(O,ce,ee,D);return}const F=D.deltaMode===1?20:1;let H=d===Ea.Vertical?0:D.deltaX*F,J=d===Ea.Horizontal?0:D.deltaY*F;!Vu()&&D.shiftKey&&d!==Ea.Vertical&&(H=D.deltaY*F,J=0),P.translateBy(O,-(H/z)*u,-(J/z)*u,{internal:!0});const W=hu(O.property("__zoom")),{onViewportChangeStart:G,onViewportChange:X,onViewportChangeEnd:Z}=R.getState();clearTimeout(K.current),Y.current||(Y.current=!0,t==null||t(D,W),G==null||G(W)),Y.current&&(e==null||e(D,W),X==null||X(W),K.current=setTimeout(()=>{n==null||n(D,W),Z==null||Z(W),Y.current=!1},150))},{passive:!1}):typeof V<"u"&&O.on("wheel.zoom",function(D,z){if(!j&&D.type==="wheel"&&!D.ctrlKey||jo(D,_))return null;D.preventDefault(),V.call(this,D,z)},{passive:!1}))},[$,l,d,O,P,V,M,i,j,_,t,e,n]),v.useEffect(()=>{P&&P.on("start",D=>{var H,J;if(!D.sourceEvent||D.sourceEvent.internal)return null;L.current=(H=D.sourceEvent)==null?void 0:H.button;const{onViewportChangeStart:z}=R.getState(),F=hu(D.transform);A.current=!0,q.current=F,((J=D.sourceEvent)==null?void 0:J.type)==="mousedown"&&R.setState({paneDragging:!0}),z==null||z(F),t==null||t(D.sourceEvent,F)})},[P,t]),v.useEffect(()=>{P&&($&&!A.current?P.on("zoom",null):$||P.on("zoom",D=>{var F;const{onViewportChange:z}=R.getState();if(R.setState({transform:[D.transform.x,D.transform.y,D.transform.k]}),U.current=!!(r&&hN(p,L.current??0)),(e||z)&&!((F=D.sourceEvent)!=null&&F.internal)){const H=hu(D.transform);z==null||z(H),e==null||e(D.sourceEvent,H)}}))},[$,P,e,p,r]),v.useEffect(()=>{P&&P.on("end",D=>{if(!D.sourceEvent||D.sourceEvent.internal)return null;const{onViewportChangeEnd:z}=R.getState();if(A.current=!1,R.setState({paneDragging:!1}),r&&hN(p,L.current??0)&&!U.current&&r(D.sourceEvent),U.current=!1,(n||z)&&$5(q.current,D.transform)){const F=hu(D.transform);q.current=F,clearTimeout(T.current),T.current=setTimeout(()=>{z==null||z(F),n==null||n(D.sourceEvent,F)},l?150:0)}})},[P,l,p,n,r]),v.useEffect(()=>{P&&P.filter(D=>{const z=M||s,F=i&&D.ctrlKey;if((p===!0||Array.isArray(p)&&p.includes(1))&&D.button===1&&D.type==="mousedown"&&(jo(D,"react-flow__node")||jo(D,"react-flow__edge")))return!0;if(!p&&!z&&!l&&!f&&!i||$||!f&&D.type==="dblclick"||jo(D,_)&&D.type==="wheel"||jo(D,E)&&(D.type!=="wheel"||l&&D.type==="wheel"&&!M)||!i&&D.ctrlKey&&D.type==="wheel"||!z&&!l&&!F&&D.type==="wheel"||!p&&(D.type==="mousedown"||D.type==="touchstart")||Array.isArray(p)&&!p.includes(D.button)&&D.type==="mousedown")return!1;const H=Array.isArray(p)&&p.includes(D.button)||!D.button||D.button<=1;return(!D.ctrlKey||D.type==="wheel")&&H})},[$,P,s,i,l,f,p,h,M]),ue.createElement("div",{className:"react-flow__renderer",ref:I,style:s0},S)},L5=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function P5(){const{userSelectionActive:e,userSelectionRect:t}=Ke(L5,Rt);return e&&t?ue.createElement("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}function pN(e,t){const n=t.parentNode||t.parentId,r=e.find(s=>s.id===n);if(r){const s=t.position.x+t.width-r.width,i=t.position.y+t.height-r.height;if(s>0||i>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,s>0&&(r.style.width+=s),i>0&&(r.style.height+=i),t.position.x<0){const l=Math.abs(t.position.x);r.position.x=r.position.x-l,r.style.width+=l,t.position.x=0}if(t.position.y<0){const l=Math.abs(t.position.y);r.position.y=r.position.y-l,r.style.height+=l,t.position.y=0}r.width=r.style.width,r.height=r.style.height}}}function D5(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,s)=>{const i=e.filter(u=>u.id===s.id);if(i.length===0)return r.push(s),r;const l={...s};for(const u of i)if(u)switch(u.type){case"select":{l.selected=u.selected;break}case"position":{typeof u.position<"u"&&(l.position=u.position),typeof u.positionAbsolute<"u"&&(l.positionAbsolute=u.positionAbsolute),typeof u.dragging<"u"&&(l.dragging=u.dragging),l.expandParent&&pN(r,l);break}case"dimensions":{typeof u.dimensions<"u"&&(l.width=u.dimensions.width,l.height=u.dimensions.height),typeof u.updateStyle<"u"&&(l.style={...l.style||{},...u.dimensions}),typeof u.resizing=="boolean"&&(l.resizing=u.resizing),l.expandParent&&pN(r,l);break}case"remove":return r}return r.push(l),r},n)}function F5(e,t){return D5(e,t)}const Fs=(e,t)=>({id:e,type:"select",selected:t});function Lo(e,t){return e.reduce((n,r)=>{const s=t.includes(r.id);return!r.selected&&s?(r.selected=!0,n.push(Fs(r.id,!0))):r.selected&&!s&&(r.selected=!1,n.push(Fs(r.id,!1))),n},[])}const Yf=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},q5=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),e2=v.memo(({isSelecting:e,selectionMode:t=kl.Full,panOnDrag:n,onSelectionStart:r,onSelectionEnd:s,onPaneClick:i,onPaneContextMenu:l,onPaneScroll:u,onPaneMouseEnter:d,onPaneMouseMove:f,onPaneMouseLeave:h,children:p})=>{const g=v.useRef(null),w=xt(),k=v.useRef(0),x=v.useRef(0),b=v.useRef(),{userSelectionActive:j,elementsSelectable:S,dragging:_}=Ke(q5,Rt),E=()=>{w.setState({userSelectionActive:!1,userSelectionRect:null}),k.current=0,x.current=0},T=V=>{i==null||i(V),w.getState().resetSelectedElements(),w.setState({nodesSelectionActive:!1})},R=V=>{if(Array.isArray(n)&&(n!=null&&n.includes(2))){V.preventDefault();return}l==null||l(V)},A=u?V=>u(V):void 0,U=V=>{const{resetSelectedElements:$,domNode:M}=w.getState();if(b.current=M==null?void 0:M.getBoundingClientRect(),!S||!e||V.button!==0||V.target!==g.current||!b.current)return;const{x:L,y:Y}=Hs(V,b.current);$(),w.setState({userSelectionRect:{width:0,height:0,startX:L,startY:Y,x:L,y:Y}}),r==null||r(V)},I=V=>{const{userSelectionRect:$,nodeInternals:M,edges:L,transform:Y,onNodesChange:K,onEdgesChange:D,nodeOrigin:z,getNodes:F}=w.getState();if(!e||!b.current||!$)return;w.setState({userSelectionActive:!0,nodesSelectionActive:!1});const H=Hs(V,b.current),J=$.startX??0,W=$.startY??0,G={...$,x:H.x<J?H.x:J,y:H.y<W?H.y:W,width:Math.abs(H.x-J),height:Math.abs(H.y-W)},X=F(),Z=LA(M,G,Y,t===kl.Partial,!0,z),ee=PA(Z,L).map(ce=>ce.id),re=Z.map(ce=>ce.id);if(k.current!==re.length){k.current=re.length;const ce=Lo(X,re);ce.length&&(K==null||K(ce))}if(x.current!==ee.length){x.current=ee.length;const ce=Lo(L,ee);ce.length&&(D==null||D(ce))}w.setState({userSelectionRect:G})},q=V=>{if(V.button!==0)return;const{userSelectionRect:$}=w.getState();!j&&$&&V.target===g.current&&(T==null||T(V)),w.setState({nodesSelectionActive:k.current>0}),E(),s==null||s(V)},P=V=>{j&&(w.setState({nodesSelectionActive:k.current>0}),s==null||s(V)),E()},O=S&&(e||j);return ue.createElement("div",{className:Dt(["react-flow__pane",{dragging:_,selection:e}]),onClick:O?void 0:Yf(T,g),onContextMenu:Yf(R,g),onWheel:Yf(A,g),onMouseEnter:O?void 0:d,onMouseDown:O?U:void 0,onMouseMove:O?I:f,onMouseUp:O?q:void 0,onMouseLeave:O?P:h,ref:g,style:s0},p,ue.createElement(P5,null))});e2.displayName="Pane";function t2(e,t){const n=e.parentNode||e.parentId;if(!n)return!1;const r=t.get(n);return r?r.selected?!0:t2(r,t):!1}function mN(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 B5(e,t,n,r){return Array.from(e.values()).filter(s=>(s.selected||s.id===r)&&(!s.parentNode||s.parentId||!t2(s,e))&&(s.draggable||t&&typeof s.draggable>"u")).map(s=>{var i,l;return{id:s.id,position:s.position||{x:0,y:0},positionAbsolute:s.positionAbsolute||{x:0,y:0},distance:{x:n.x-(((i=s.positionAbsolute)==null?void 0:i.x)??0),y:n.y-(((l=s.positionAbsolute)==null?void 0:l.y)??0)},delta:{x:0,y:0},extent:s.extent,parentNode:s.parentNode||s.parentId,parentId:s.parentNode||s.parentId,width:s.width,height:s.height,expandParent:s.expandParent}})}function U5(e,t){return!t||t==="parent"?t:[t[0],[t[1][0]-(e.width||0),t[1][1]-(e.height||0)]]}function n2(e,t,n,r,s=[0,0],i){const l=U5(e,e.extent||r);let u=l;const d=e.parentNode||e.parentId;if(e.extent==="parent"&&!e.expandParent)if(d&&e.width&&e.height){const p=n.get(d),{x:g,y:w}=Ra(p,s).positionAbsolute;u=p&&Ln(g)&&Ln(w)&&Ln(p.width)&&Ln(p.height)?[[g+e.width*s[0],w+e.height*s[1]],[g+p.width-e.width+e.width*s[0],w+p.height-e.height+e.height*s[1]]]:u}else i==null||i("005",es.error005()),u=l;else if(e.extent&&d&&e.extent!=="parent"){const p=n.get(d),{x:g,y:w}=Ra(p,s).positionAbsolute;u=[[e.extent[0][0]+g,e.extent[0][1]+w],[e.extent[1][0]+g,e.extent[1][1]+w]]}let f={x:0,y:0};if(d){const p=n.get(d);f=Ra(p,s).positionAbsolute}const h=u&&u!=="parent"?Xx(t,u):t;return{position:{x:h.x-f.x,y:h.y-f.y},positionAbsolute:h}}function Xf({nodeId:e,dragItems:t,nodeInternals:n}){const r=t.map(s=>({...n.get(s.id),position:s.position,positionAbsolute:s.positionAbsolute}));return[e?r.find(s=>s.id===e):r[0],r]}const gN=(e,t,n,r)=>{const s=t.querySelectorAll(e);if(!s||!s.length)return null;const i=Array.from(s),l=t.getBoundingClientRect(),u={x:l.width*r[0],y:l.height*r[1]};return i.map(d=>{const f=d.getBoundingClientRect();return{id:d.getAttribute("data-handleid"),position:d.getAttribute("data-handlepos"),x:(f.left-l.left-u.x)/n,y:(f.top-l.top-u.y)/n,...Yx(d)}})};function el(e,t,n){return n===void 0?n:r=>{const s=t().nodeInternals.get(e);s&&n(r,{...s})}}function Xv({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:s,unselectNodesAndEdges:i,multiSelectionActive:l,nodeInternals:u,onError:d}=t.getState(),f=u.get(e);if(!f){d==null||d("012",es.error012(e));return}t.setState({nodesSelectionActive:!1}),f.selected?(n||f.selected&&l)&&(i({nodes:[f],edges:[]}),requestAnimationFrame(()=>{var h;return(h=r==null?void 0:r.current)==null?void 0:h.blur()})):s([e])}function z5(){const e=xt();return v.useCallback(({sourceEvent:n})=>{const{transform:r,snapGrid:s,snapToGrid:i}=e.getState(),l=n.touches?n.touches[0].clientX:n.clientX,u=n.touches?n.touches[0].clientY:n.clientY,d={x:(l-r[0])/r[2],y:(u-r[1])/r[2]};return{xSnapped:i?s[0]*Math.round(d.x/s[0]):d.x,ySnapped:i?s[1]*Math.round(d.y/s[1]):d.y,...d}},[])}function Zf(e){return(t,n,r)=>e==null?void 0:e(t,r)}function r2({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:s,isSelectable:i,selectNodesOnDrag:l}){const u=xt(),[d,f]=v.useState(!1),h=v.useRef([]),p=v.useRef({x:null,y:null}),g=v.useRef(0),w=v.useRef(null),k=v.useRef({x:0,y:0}),x=v.useRef(null),b=v.useRef(!1),j=v.useRef(!1),S=v.useRef(!1),_=z5();return v.useEffect(()=>{if(e!=null&&e.current){const E=On(e.current),T=({x:U,y:I})=>{const{nodeInternals:q,onNodeDrag:P,onSelectionDrag:O,updateNodePositions:V,nodeExtent:$,snapGrid:M,snapToGrid:L,nodeOrigin:Y,onError:K}=u.getState();p.current={x:U,y:I};let D=!1,z={x:0,y:0,x2:0,y2:0};if(h.current.length>1&&$){const H=Nd(h.current,Y);z=bl(H)}if(h.current=h.current.map(H=>{const J={x:U-H.distance.x,y:I-H.distance.y};L&&(J.x=M[0]*Math.round(J.x/M[0]),J.y=M[1]*Math.round(J.y/M[1]));const W=[[$[0][0],$[0][1]],[$[1][0],$[1][1]]];h.current.length>1&&$&&!H.extent&&(W[0][0]=H.positionAbsolute.x-z.x+$[0][0],W[1][0]=H.positionAbsolute.x+(H.width??0)-z.x2+$[1][0],W[0][1]=H.positionAbsolute.y-z.y+$[0][1],W[1][1]=H.positionAbsolute.y+(H.height??0)-z.y2+$[1][1]);const G=n2(H,J,q,W,Y,K);return D=D||H.position.x!==G.position.x||H.position.y!==G.position.y,H.position=G.position,H.positionAbsolute=G.positionAbsolute,H}),!D)return;V(h.current,!0,!0),f(!0);const F=s?P:Zf(O);if(F&&x.current){const[H,J]=Xf({nodeId:s,dragItems:h.current,nodeInternals:q});F(x.current,H,J)}},R=()=>{if(!w.current)return;const[U,I]=_A(k.current,w.current);if(U!==0||I!==0){const{transform:q,panBy:P}=u.getState();p.current.x=(p.current.x??0)-U/q[2],p.current.y=(p.current.y??0)-I/q[2],P({x:U,y:I})&&T(p.current)}g.current=requestAnimationFrame(R)},A=U=>{var Y;const{nodeInternals:I,multiSelectionActive:q,nodesDraggable:P,unselectNodesAndEdges:O,onNodeDragStart:V,onSelectionDragStart:$}=u.getState();j.current=!0;const M=s?V:Zf($);(!l||!i)&&!q&&s&&((Y=I.get(s))!=null&&Y.selected||O()),s&&i&&l&&Xv({id:s,store:u,nodeRef:e});const L=_(U);if(p.current=L,h.current=B5(I,P,L,s),M&&h.current){const[K,D]=Xf({nodeId:s,dragItems:h.current,nodeInternals:I});M(U.sourceEvent,K,D)}};if(t)E.on(".drag",null);else{const U=Q3().on("start",I=>{const{domNode:q,nodeDragThreshold:P}=u.getState();P===0&&A(I),S.current=!1;const O=_(I);p.current=O,w.current=(q==null?void 0:q.getBoundingClientRect())||null,k.current=Hs(I.sourceEvent,w.current)}).on("drag",I=>{var V,$;const q=_(I),{autoPanOnNodeDrag:P,nodeDragThreshold:O}=u.getState();if(I.sourceEvent.type==="touchmove"&&I.sourceEvent.touches.length>1&&(S.current=!0),!S.current){if(!b.current&&j.current&&P&&(b.current=!0,R()),!j.current){const M=q.xSnapped-(((V=p==null?void 0:p.current)==null?void 0:V.x)??0),L=q.ySnapped-((($=p==null?void 0:p.current)==null?void 0:$.y)??0);Math.sqrt(M*M+L*L)>O&&A(I)}(p.current.x!==q.xSnapped||p.current.y!==q.ySnapped)&&h.current&&j.current&&(x.current=I.sourceEvent,k.current=Hs(I.sourceEvent,w.current),T(q))}}).on("end",I=>{if(!(!j.current||S.current)&&(f(!1),b.current=!1,j.current=!1,cancelAnimationFrame(g.current),h.current)){const{updateNodePositions:q,nodeInternals:P,onNodeDragStop:O,onSelectionDragStop:V}=u.getState(),$=s?O:Zf(V);if(q(h.current,!1,!1),$){const[M,L]=Xf({nodeId:s,dragItems:h.current,nodeInternals:P});$(I.sourceEvent,M,L)}}}).filter(I=>{const q=I.target;return!I.button&&(!n||!mN(q,`.${n}`,e))&&(!r||mN(q,r,e))});return E.call(U),()=>{E.on(".drag",null)}}}},[e,t,n,r,i,u,s,l,_]),d}function s2(){const e=xt();return v.useCallback(n=>{const{nodeInternals:r,nodeExtent:s,updateNodePositions:i,getNodes:l,snapToGrid:u,snapGrid:d,onError:f,nodesDraggable:h}=e.getState(),p=l().filter(S=>S.selected&&(S.draggable||h&&typeof S.draggable>"u")),g=u?d[0]:5,w=u?d[1]:5,k=n.isShiftPressed?4:1,x=n.x*g*k,b=n.y*w*k,j=p.map(S=>{if(S.positionAbsolute){const _={x:S.positionAbsolute.x+x,y:S.positionAbsolute.y+b};u&&(_.x=d[0]*Math.round(_.x/d[0]),_.y=d[1]*Math.round(_.y/d[1]));const{positionAbsolute:E,position:T}=n2(S,_,r,s,void 0,f);S.position=T,S.positionAbsolute=E}return S});i(j,!0,!1)},[])}const Uo={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var tl=e=>{const t=({id:n,type:r,data:s,xPos:i,yPos:l,xPosOrigin:u,yPosOrigin:d,selected:f,onClick:h,onMouseEnter:p,onMouseMove:g,onMouseLeave:w,onContextMenu:k,onDoubleClick:x,style:b,className:j,isDraggable:S,isSelectable:_,isConnectable:E,isFocusable:T,selectNodesOnDrag:R,sourcePosition:A,targetPosition:U,hidden:I,resizeObserver:q,dragHandle:P,zIndex:O,isParent:V,noDragClassName:$,noPanClassName:M,initialized:L,disableKeyboardA11y:Y,ariaLabel:K,rfId:D,hasHandleBounds:z})=>{const F=xt(),H=v.useRef(null),J=v.useRef(null),W=v.useRef(A),G=v.useRef(U),X=v.useRef(r),Z=_||S||h||p||g||w,ee=s2(),re=el(n,F.getState,p),ce=el(n,F.getState,g),ie=el(n,F.getState,w),fe=el(n,F.getState,k),de=el(n,F.getState,x),we=be=>{const{nodeDragThreshold:he}=F.getState();if(_&&(!R||!S||he>0)&&Xv({id:n,store:F,nodeRef:H}),h){const se=F.getState().nodeInternals.get(n);se&&h(be,{...se})}},xe=be=>{if(!Wv(be)&&!Y)if(RA.includes(be.key)&&_){const he=be.key==="Escape";Xv({id:n,store:F,unselect:he,nodeRef:H})}else S&&f&&Object.prototype.hasOwnProperty.call(Uo,be.key)&&(F.setState({ariaLiveMessage:`Moved selected node ${be.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~i}, y: ${~~l}`}),ee({x:Uo[be.key].x,y:Uo[be.key].y,isShiftPressed:be.shiftKey}))};v.useEffect(()=>()=>{J.current&&(q==null||q.unobserve(J.current),J.current=null)},[]),v.useEffect(()=>{if(H.current&&!I){const be=H.current;(!L||!z||J.current!==be)&&(J.current&&(q==null||q.unobserve(J.current)),q==null||q.observe(be),J.current=be)}},[I,L,z]),v.useEffect(()=>{const be=X.current!==r,he=W.current!==A,se=G.current!==U;H.current&&(be||he||se)&&(be&&(X.current=r),he&&(W.current=A),se&&(G.current=U),F.getState().updateNodeDimensions([{id:n,nodeElement:H.current,forceUpdate:!0}]))},[n,r,A,U]);const $e=r2({nodeRef:H,disabled:I||!S,noDragClassName:$,handleSelector:P,nodeId:n,isSelectable:_,selectNodesOnDrag:R});return I?null:ue.createElement("div",{className:Dt(["react-flow__node",`react-flow__node-${r}`,{[M]:S},j,{selected:f,selectable:_,parent:V,dragging:$e}]),ref:H,style:{zIndex:O,transform:`translate(${u}px,${d}px)`,pointerEvents:Z?"all":"none",visibility:L?"visible":"hidden",...b},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:re,onMouseMove:ce,onMouseLeave:ie,onContextMenu:fe,onClick:we,onDoubleClick:de,onKeyDown:T?xe:void 0,tabIndex:T?0:void 0,role:T?"button":void 0,"aria-describedby":Y?void 0:`${YA}-${D}`,"aria-label":K},ue.createElement(n5,{value:n},ue.createElement(e,{id:n,data:s,type:r,xPos:i,yPos:l,selected:f,isConnectable:E,sourcePosition:A,targetPosition:U,dragging:$e,dragHandle:P,zIndex:O})))};return t.displayName="NodeWrapper",v.memo(t)};const H5=e=>{const t=e.getNodes().filter(n=>n.selected);return{...Nd(t,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};function W5({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=xt(),{width:s,height:i,x:l,y:u,transformString:d,userSelectionActive:f}=Ke(H5,Rt),h=s2(),p=v.useRef(null);if(v.useEffect(()=>{var k;n||(k=p.current)==null||k.focus({preventScroll:!0})},[n]),r2({nodeRef:p}),f||!s||!i)return null;const g=e?k=>{const x=r.getState().getNodes().filter(b=>b.selected);e(k,x)}:void 0,w=k=>{Object.prototype.hasOwnProperty.call(Uo,k.key)&&h({x:Uo[k.key].x,y:Uo[k.key].y,isShiftPressed:k.shiftKey})};return ue.createElement("div",{className:Dt(["react-flow__nodesselection","react-flow__container",t]),style:{transform:d}},ue.createElement("div",{ref:p,className:"react-flow__nodesselection-rect",onContextMenu:g,tabIndex:n?void 0:-1,onKeyDown:n?void 0:w,style:{width:s,height:i,top:u,left:l}}))}var V5=v.memo(W5);const G5=e=>e.nodesSelectionActive,a2=({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:l,deleteKeyCode:u,onMove:d,onMoveStart:f,onMoveEnd:h,selectionKeyCode:p,selectionOnDrag:g,selectionMode:w,onSelectionStart:k,onSelectionEnd:x,multiSelectionKeyCode:b,panActivationKeyCode:j,zoomActivationKeyCode:S,elementsSelectable:_,zoomOnScroll:E,zoomOnPinch:T,panOnScroll:R,panOnScrollSpeed:A,panOnScrollMode:U,zoomOnDoubleClick:I,panOnDrag:q,defaultViewport:P,translateExtent:O,minZoom:V,maxZoom:$,preventScrolling:M,onSelectionContextMenu:L,noWheelClassName:Y,noPanClassName:K,disableKeyboardA11y:D})=>{const z=Ke(G5),F=Nl(p),H=Nl(j),J=H||q,W=H||R,G=F||g&&J!==!0;return A5({deleteKeyCode:u,multiSelectionKeyCode:b}),ue.createElement(O5,{onMove:d,onMoveStart:f,onMoveEnd:h,onPaneContextMenu:i,elementsSelectable:_,zoomOnScroll:E,zoomOnPinch:T,panOnScroll:W,panOnScrollSpeed:A,panOnScrollMode:U,zoomOnDoubleClick:I,panOnDrag:!F&&J,defaultViewport:P,translateExtent:O,minZoom:V,maxZoom:$,zoomActivationKeyCode:S,preventScrolling:M,noWheelClassName:Y,noPanClassName:K},ue.createElement(e2,{onSelectionStart:k,onSelectionEnd:x,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:l,panOnDrag:J,isSelecting:!!G,selectionMode:w},e,z&&ue.createElement(V5,{onSelectionContextMenu:L,noPanClassName:K,disableKeyboardA11y:D})))};a2.displayName="FlowRenderer";var K5=v.memo(a2);function Y5(e){return Ke(v.useCallback(n=>e?LA(n.nodeInternals,{x:0,y:0,width:n.width,height:n.height},n.transform,!0):n.getNodes(),[e]))}function X5(e){const t={input:tl(e.input||WA),default:tl(e.default||Yv),output:tl(e.output||GA),group:tl(e.group||r0)},n={},r=Object.keys(e).filter(s=>!["input","default","output","group"].includes(s)).reduce((s,i)=>(s[i]=tl(e[i]||Yv),s),n);return{...t,...r}}const Z5=({x:e,y:t,width:n,height:r,origin:s})=>!n||!r?{x:e,y:t}:s[0]<0||s[1]<0||s[0]>1||s[1]>1?{x:e,y:t}:{x:e-n*s[0],y:t-r*s[1]},J5=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),o2=e=>{const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:s,updateNodeDimensions:i,onError:l}=Ke(J5,Rt),u=Y5(e.onlyRenderVisibleElements),d=v.useRef(),f=v.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const h=new ResizeObserver(p=>{const g=p.map(w=>({id:w.target.getAttribute("data-id"),nodeElement:w.target,forceUpdate:!0}));i(g)});return d.current=h,h},[]);return v.useEffect(()=>()=>{var h;(h=d==null?void 0:d.current)==null||h.disconnect()},[]),ue.createElement("div",{className:"react-flow__nodes",style:s0},u.map(h=>{var T,R,A;let p=h.type||"default";e.nodeTypes[p]||(l==null||l("003",es.error003(p)),p="default");const g=e.nodeTypes[p]||e.nodeTypes.default,w=!!(h.draggable||t&&typeof h.draggable>"u"),k=!!(h.selectable||s&&typeof h.selectable>"u"),x=!!(h.connectable||n&&typeof h.connectable>"u"),b=!!(h.focusable||r&&typeof h.focusable>"u"),j=e.nodeExtent?Xx(h.positionAbsolute,e.nodeExtent):h.positionAbsolute,S=(j==null?void 0:j.x)??0,_=(j==null?void 0:j.y)??0,E=Z5({x:S,y:_,width:h.width??0,height:h.height??0,origin:e.nodeOrigin});return ue.createElement(g,{key:h.id,id:h.id,className:h.className,style:h.style,type:p,data:h.data,sourcePosition:h.sourcePosition||Te.Bottom,targetPosition:h.targetPosition||Te.Top,hidden:h.hidden,xPos:S,yPos:_,xPosOrigin:E.x,yPosOrigin:E.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:k,isConnectable:x,isFocusable:b,resizeObserver:f,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)})}))};o2.displayName="NodeRenderer";var Q5=v.memo(o2);const eF=(e,t,n)=>n===Te.Left?e-t:n===Te.Right?e+t:e,tF=(e,t,n)=>n===Te.Top?e-t:n===Te.Bottom?e+t:e,yN="react-flow__edgeupdater",wN=({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:s,onMouseEnter:i,onMouseOut:l,type:u})=>ue.createElement("circle",{onMouseDown:s,onMouseEnter:i,onMouseOut:l,className:Dt([yN,`${yN}-${u}`]),cx:eF(t,r,e),cy:tF(n,r,e),r,stroke:"transparent",fill:"transparent"}),nF=()=>!0;var So=e=>{const t=({id:n,className:r,type:s,data:i,onClick:l,onEdgeDoubleClick:u,selected:d,animated:f,label:h,labelStyle:p,labelShowBg:g,labelBgStyle:w,labelBgPadding:k,labelBgBorderRadius:x,style:b,source:j,target:S,sourceX:_,sourceY:E,targetX:T,targetY:R,sourcePosition:A,targetPosition:U,elementsSelectable:I,hidden:q,sourceHandleId:P,targetHandleId:O,onContextMenu:V,onMouseEnter:$,onMouseMove:M,onMouseLeave:L,reconnectRadius:Y,onReconnect:K,onReconnectStart:D,onReconnectEnd:z,markerEnd:F,markerStart:H,rfId:J,ariaLabel:W,isFocusable:G,isReconnectable:X,pathOptions:Z,interactionWidth:ee,disableKeyboardA11y:re})=>{const ce=v.useRef(null),[ie,fe]=v.useState(!1),[de,we]=v.useState(!1),xe=xt(),$e=v.useMemo(()=>`url('#${Gv(H,J)}')`,[H,J]),be=v.useMemo(()=>`url('#${Gv(F,J)}')`,[F,J]);if(q)return null;const he=Ie=>{var Nt;const{edges:ot,addSelectedEdges:Je,unselectNodesAndEdges:it,multiSelectionActive:Ft}=xe.getState(),kt=ot.find(qt=>qt.id===n);kt&&(I&&(xe.setState({nodesSelectionActive:!1}),kt.selected&&Ft?(it({nodes:[],edges:[kt]}),(Nt=ce.current)==null||Nt.blur()):Je([n])),l&&l(Ie,kt))},se=Qi(n,xe.getState,u),ke=Qi(n,xe.getState,V),Ce=Qi(n,xe.getState,$),Oe=Qi(n,xe.getState,M),Le=Qi(n,xe.getState,L),Pe=(Ie,ot)=>{if(Ie.button!==0)return;const{edges:Je,isValidConnection:it}=xe.getState(),Ft=ot?S:j,kt=(ot?O:P)||null,Nt=ot?"target":"source",qt=it||nF,kn=ot,Gt=Je.find(Kt=>Kt.id===n);we(!0),D==null||D(Ie,Gt,Nt);const Bt=Kt=>{we(!1),z==null||z(Kt,Gt,Nt)};BA({event:Ie,handleId:kt,nodeId:Ft,onConnect:Kt=>K==null?void 0:K(Gt,Kt),isTarget:kn,getState:xe.getState,setState:xe.setState,isValidConnection:qt,edgeUpdaterType:Nt,onReconnectEnd:Bt})},qe=Ie=>Pe(Ie,!0),Ue=Ie=>Pe(Ie,!1),et=()=>fe(!0),ze=()=>fe(!1),at=!I&&!l,gt=Ie=>{var ot;if(!re&&RA.includes(Ie.key)&&I){const{unselectNodesAndEdges:Je,addSelectedEdges:it,edges:Ft}=xe.getState();Ie.key==="Escape"?((ot=ce.current)==null||ot.blur(),Je({edges:[Ft.find(Nt=>Nt.id===n)]})):it([n])}};return ue.createElement("g",{className:Dt(["react-flow__edge",`react-flow__edge-${s}`,r,{selected:d,animated:f,inactive:at,updating:ie}]),onClick:he,onDoubleClick:se,onContextMenu:ke,onMouseEnter:Ce,onMouseMove:Oe,onMouseLeave:Le,onKeyDown:G?gt:void 0,tabIndex:G?0:void 0,role:G?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":W===null?void 0:W||`Edge from ${j} to ${S}`,"aria-describedby":G?`${XA}-${J}`:void 0,ref:ce},!de&&ue.createElement(e,{id:n,source:j,target:S,selected:d,animated:f,label:h,labelStyle:p,labelShowBg:g,labelBgStyle:w,labelBgPadding:k,labelBgBorderRadius:x,data:i,style:b,sourceX:_,sourceY:E,targetX:T,targetY:R,sourcePosition:A,targetPosition:U,sourceHandleId:P,targetHandleId:O,markerStart:$e,markerEnd:be,pathOptions:Z,interactionWidth:ee}),X&&ue.createElement(ue.Fragment,null,(X==="source"||X===!0)&&ue.createElement(wN,{position:A,centerX:_,centerY:E,radius:Y,onMouseDown:qe,onMouseEnter:et,onMouseOut:ze,type:"source"}),(X==="target"||X===!0)&&ue.createElement(wN,{position:U,centerX:T,centerY:R,radius:Y,onMouseDown:Ue,onMouseEnter:et,onMouseOut:ze,type:"target"})))};return t.displayName="EdgeWrapper",v.memo(t)};function rF(e){const t={default:So(e.default||Ku),straight:So(e.bezier||Qx),step:So(e.step||Jx),smoothstep:So(e.step||kd),simplebezier:So(e.simplebezier||Zx)},n={},r=Object.keys(e).filter(s=>!["default","bezier"].includes(s)).reduce((s,i)=>(s[i]=So(e[i]||Ku),s),n);return{...t,...r}}function vN(e,t,n=null){const r=((n==null?void 0:n.x)||0)+t.x,s=((n==null?void 0:n.y)||0)+t.y,i=(n==null?void 0:n.width)||t.width,l=(n==null?void 0:n.height)||t.height;switch(e){case Te.Top:return{x:r+i/2,y:s};case Te.Right:return{x:r+i,y:s+l/2};case Te.Bottom:return{x:r+i/2,y:s+l};case Te.Left:return{x:r,y:s+l/2}}}function xN(e,t){return e?e.length===1||!t?e[0]:t&&e.find(n=>n.id===t)||null:null}const sF=(e,t,n,r,s,i)=>{const l=vN(n,e,t),u=vN(i,r,s);return{sourceX:l.x,sourceY:l.y,targetX:u.x,targetY:u.y}};function aF({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:r,targetWidth:s,targetHeight:i,width:l,height:u,transform:d}){const f={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+n,t.x+s),y2:Math.max(e.y+r,t.y+i)};f.x===f.x2&&(f.x2+=1),f.y===f.y2&&(f.y2+=1);const h=bl({x:(0-d[0])/d[2],y:(0-d[1])/d[2],width:l/d[2],height:u/d[2]}),p=Math.max(0,Math.min(h.x2,f.x2)-Math.max(h.x,f.x)),g=Math.max(0,Math.min(h.y2,f.y2)-Math.max(h.y,f.y));return Math.ceil(p*g)>0}function bN(e){var r,s,i,l,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((s=e==null?void 0:e.positionAbsolute)==null?void 0:s.x)<"u"&&typeof((i=e==null?void 0:e.positionAbsolute)==null?void 0:i.y)<"u";return[{x:((l=e==null?void 0:e.positionAbsolute)==null?void 0:l.x)||0,y:((u=e==null?void 0:e.positionAbsolute)==null?void 0:u.y)||0,width:(e==null?void 0:e.width)||0,height:(e==null?void 0:e.height)||0},t,!!n]}const oF=[{level:0,isMaxLevel:!0,edges:[]}];function iF(e,t,n=!1){let r=-1;const s=e.reduce((l,u)=>{var h,p;const d=Ln(u.zIndex);let f=d?u.zIndex:0;if(n){const g=t.get(u.target),w=t.get(u.source),k=u.selected||(g==null?void 0:g.selected)||(w==null?void 0:w.selected),x=Math.max(((h=w==null?void 0:w[ft])==null?void 0:h.z)||0,((p=g==null?void 0:g[ft])==null?void 0:p.z)||0,1e3);f=(d?u.zIndex:0)+(k?x:0)}return l[f]?l[f].push(u):l[f]=[u],r=f>r?f:r,l},{}),i=Object.entries(s).map(([l,u])=>{const d=+l;return{edges:u,level:d,isMaxLevel:d===r}});return i.length===0?oF:i}function lF(e,t,n){const r=Ke(v.useCallback(s=>e?s.edges.filter(i=>{const l=t.get(i.source),u=t.get(i.target);return(l==null?void 0:l.width)&&(l==null?void 0:l.height)&&(u==null?void 0:u.width)&&(u==null?void 0:u.height)&&aF({sourcePos:l.positionAbsolute||{x:0,y:0},targetPos:u.positionAbsolute||{x:0,y:0},sourceWidth:l.width,sourceHeight:l.height,targetWidth:u.width,targetHeight:u.height,width:s.width,height:s.height,transform:s.transform})}):s.edges,[e,t]));return iF(r,t,n)}const cF=({color:e="none",strokeWidth:t=1})=>ue.createElement("polyline",{style:{stroke:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),uF=({color:e="none",strokeWidth:t=1})=>ue.createElement("polyline",{style:{stroke:e,fill:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),kN={[Gu.Arrow]:cF,[Gu.ArrowClosed]:uF};function dF(e){const t=xt();return v.useMemo(()=>{var s,i;return Object.prototype.hasOwnProperty.call(kN,e)?kN[e]:((i=(s=t.getState()).onError)==null||i.call(s,"009",es.error009(e)),null)},[e])}const hF=({id:e,type:t,color:n,width:r=12.5,height:s=12.5,markerUnits:i="strokeWidth",strokeWidth:l,orient:u="auto-start-reverse"})=>{const d=dF(t);return d?ue.createElement("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${s}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:u,refX:"0",refY:"0"},ue.createElement(d,{color:n,strokeWidth:l})):null},fF=({defaultColor:e,rfId:t})=>n=>{const r=[];return n.edges.reduce((s,i)=>([i.markerStart,i.markerEnd].forEach(l=>{if(l&&typeof l=="object"){const u=Gv(l,t);r.includes(u)||(s.push({id:u,color:l.color||e,...l}),r.push(u))}}),s),[]).sort((s,i)=>s.id.localeCompare(i.id))},i2=({defaultColor:e,rfId:t})=>{const n=Ke(v.useCallback(fF({defaultColor:e,rfId:t}),[e,t]),(r,s)=>!(r.length!==s.length||r.some((i,l)=>i.id!==s[l].id)));return ue.createElement("defs",null,n.map(r=>ue.createElement(hF,{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})))};i2.displayName="MarkerDefinitions";var pF=v.memo(i2);const mF=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}),l2=({defaultMarkerColor:e,onlyRenderVisibleElements:t,elevateEdgesOnSelect:n,rfId:r,edgeTypes:s,noPanClassName:i,onEdgeContextMenu:l,onEdgeMouseEnter:u,onEdgeMouseMove:d,onEdgeMouseLeave:f,onEdgeClick:h,onEdgeDoubleClick:p,onReconnect:g,onReconnectStart:w,onReconnectEnd:k,reconnectRadius:x,children:b,disableKeyboardA11y:j})=>{const{edgesFocusable:S,edgesUpdatable:_,elementsSelectable:E,width:T,height:R,connectionMode:A,nodeInternals:U,onError:I}=Ke(mF,Rt),q=lF(t,U,n);return T?ue.createElement(ue.Fragment,null,q.map(({level:P,edges:O,isMaxLevel:V})=>ue.createElement("svg",{key:P,style:{zIndex:P},width:T,height:R,className:"react-flow__edges react-flow__container"},V&&ue.createElement(pF,{defaultColor:e,rfId:r}),ue.createElement("g",null,O.map($=>{const[M,L,Y]=bN(U.get($.source)),[K,D,z]=bN(U.get($.target));if(!Y||!z)return null;let F=$.type||"default";s[F]||(I==null||I("011",es.error011(F)),F="default");const H=s[F]||s.default,J=A===Oa.Strict?D.target:(D.target??[]).concat(D.source??[]),W=xN(L.source,$.sourceHandle),G=xN(J,$.targetHandle),X=(W==null?void 0:W.position)||Te.Bottom,Z=(G==null?void 0:G.position)||Te.Top,ee=!!($.focusable||S&&typeof $.focusable>"u"),re=$.reconnectable||$.updatable,ce=typeof g<"u"&&(re||_&&typeof re>"u");if(!W||!G)return I==null||I("008",es.error008(W,$)),null;const{sourceX:ie,sourceY:fe,targetX:de,targetY:we}=sF(M,W,X,K,G,Z);return ue.createElement(H,{key:$.id,id:$.id,className:Dt([$.className,i]),type:F,data:$.data,selected:!!$.selected,animated:!!$.animated,hidden:!!$.hidden,label:$.label,labelStyle:$.labelStyle,labelShowBg:$.labelShowBg,labelBgStyle:$.labelBgStyle,labelBgPadding:$.labelBgPadding,labelBgBorderRadius:$.labelBgBorderRadius,style:$.style,source:$.source,target:$.target,sourceHandleId:$.sourceHandle,targetHandleId:$.targetHandle,markerEnd:$.markerEnd,markerStart:$.markerStart,sourceX:ie,sourceY:fe,targetX:de,targetY:we,sourcePosition:X,targetPosition:Z,elementsSelectable:E,onContextMenu:l,onMouseEnter:u,onMouseMove:d,onMouseLeave:f,onClick:h,onEdgeDoubleClick:p,onReconnect:g,onReconnectStart:w,onReconnectEnd:k,reconnectRadius:x,rfId:r,ariaLabel:$.ariaLabel,isFocusable:ee,isReconnectable:ce,pathOptions:"pathOptions"in $?$.pathOptions:void 0,interactionWidth:$.interactionWidth,disableKeyboardA11y:j})})))),b):null};l2.displayName="EdgeRenderer";var gF=v.memo(l2);const yF=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function wF({children:e}){const t=Ke(yF);return ue.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:t}},e)}function vF(e){const t=oi(),n=v.useRef(!1);v.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const xF={[Te.Left]:Te.Right,[Te.Right]:Te.Left,[Te.Top]:Te.Bottom,[Te.Bottom]:Te.Top},c2=({nodeId:e,handleType:t,style:n,type:r=qs.Bezier,CustomComponent:s,connectionStatus:i})=>{var R,A,U;const{fromNode:l,handleId:u,toX:d,toY:f,connectionMode:h}=Ke(v.useCallback(I=>({fromNode:I.nodeInternals.get(e),handleId:I.connectionHandleId,toX:(I.connectionPosition.x-I.transform[0])/I.transform[2],toY:(I.connectionPosition.y-I.transform[1])/I.transform[2],connectionMode:I.connectionMode}),[e]),Rt),p=(R=l==null?void 0:l[ft])==null?void 0:R.handleBounds;let g=p==null?void 0:p[t];if(h===Oa.Loose&&(g=g||(p==null?void 0:p[t==="source"?"target":"source"])),!l||!g)return null;const w=u?g.find(I=>I.id===u):g[0],k=w?w.x+w.width/2:(l.width??0)/2,x=w?w.y+w.height/2:l.height??0,b=(((A=l.positionAbsolute)==null?void 0:A.x)??0)+k,j=(((U=l.positionAbsolute)==null?void 0:U.y)??0)+x,S=w==null?void 0:w.position,_=S?xF[S]:null;if(!S||!_)return null;if(s)return ue.createElement(s,{connectionLineType:r,connectionLineStyle:n,fromNode:l,fromHandle:w,fromX:b,fromY:j,toX:d,toY:f,fromPosition:S,toPosition:_,connectionStatus:i});let E="";const T={sourceX:b,sourceY:j,sourcePosition:S,targetX:d,targetY:f,targetPosition:_};return r===qs.Bezier?[E]=e0(T):r===qs.Step?[E]=Vv({...T,borderRadius:0}):r===qs.SmoothStep?[E]=Vv(T):r===qs.SimpleBezier?[E]=IA(T):E=`M${b},${j} ${d},${f}`,ue.createElement("path",{d:E,fill:"none",className:"react-flow__connection-path",style:n})};c2.displayName="ConnectionLine";const bF=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function kF({containerStyle:e,style:t,type:n,component:r}){const{nodeId:s,handleType:i,nodesConnectable:l,width:u,height:d,connectionStatus:f}=Ke(bF,Rt);return!(s&&i&&u&&l)?null:ue.createElement("svg",{style:e,width:u,height:d,className:"react-flow__edges react-flow__connectionline react-flow__container"},ue.createElement("g",{className:Dt(["react-flow__connection",f])},ue.createElement(c2,{nodeId:s,handleType:i,style:t,type:n,CustomComponent:r,connectionStatus:f})))}function NN(e,t){return v.useRef(null),xt(),v.useMemo(()=>t(e),[e])}const u2=({nodeTypes:e,edgeTypes:t,onMove:n,onMoveStart:r,onMoveEnd:s,onInit:i,onNodeClick:l,onEdgeClick:u,onNodeDoubleClick:d,onEdgeDoubleClick:f,onNodeMouseEnter:h,onNodeMouseMove:p,onNodeMouseLeave:g,onNodeContextMenu:w,onSelectionContextMenu:k,onSelectionStart:x,onSelectionEnd:b,connectionLineType:j,connectionLineStyle:S,connectionLineComponent:_,connectionLineContainerStyle:E,selectionKeyCode:T,selectionOnDrag:R,selectionMode:A,multiSelectionKeyCode:U,panActivationKeyCode:I,zoomActivationKeyCode:q,deleteKeyCode:P,onlyRenderVisibleElements:O,elementsSelectable:V,selectNodesOnDrag:$,defaultViewport:M,translateExtent:L,minZoom:Y,maxZoom:K,preventScrolling:D,defaultMarkerColor:z,zoomOnScroll:F,zoomOnPinch:H,panOnScroll:J,panOnScrollSpeed:W,panOnScrollMode:G,zoomOnDoubleClick:X,panOnDrag:Z,onPaneClick:ee,onPaneMouseEnter:re,onPaneMouseMove:ce,onPaneMouseLeave:ie,onPaneScroll:fe,onPaneContextMenu:de,onEdgeContextMenu:we,onEdgeMouseEnter:xe,onEdgeMouseMove:$e,onEdgeMouseLeave:be,onReconnect:he,onReconnectStart:se,onReconnectEnd:ke,reconnectRadius:Ce,noDragClassName:Oe,noWheelClassName:Le,noPanClassName:Pe,elevateEdgesOnSelect:qe,disableKeyboardA11y:Ue,nodeOrigin:et,nodeExtent:ze,rfId:at})=>{const gt=NN(e,X5),Ie=NN(t,rF);return vF(i),ue.createElement(K5,{onPaneClick:ee,onPaneMouseEnter:re,onPaneMouseMove:ce,onPaneMouseLeave:ie,onPaneContextMenu:de,onPaneScroll:fe,deleteKeyCode:P,selectionKeyCode:T,selectionOnDrag:R,selectionMode:A,onSelectionStart:x,onSelectionEnd:b,multiSelectionKeyCode:U,panActivationKeyCode:I,zoomActivationKeyCode:q,elementsSelectable:V,onMove:n,onMoveStart:r,onMoveEnd:s,zoomOnScroll:F,zoomOnPinch:H,zoomOnDoubleClick:X,panOnScroll:J,panOnScrollSpeed:W,panOnScrollMode:G,panOnDrag:Z,defaultViewport:M,translateExtent:L,minZoom:Y,maxZoom:K,onSelectionContextMenu:k,preventScrolling:D,noDragClassName:Oe,noWheelClassName:Le,noPanClassName:Pe,disableKeyboardA11y:Ue},ue.createElement(wF,null,ue.createElement(gF,{edgeTypes:Ie,onEdgeClick:u,onEdgeDoubleClick:f,onlyRenderVisibleElements:O,onEdgeContextMenu:we,onEdgeMouseEnter:xe,onEdgeMouseMove:$e,onEdgeMouseLeave:be,onReconnect:he,onReconnectStart:se,onReconnectEnd:ke,reconnectRadius:Ce,defaultMarkerColor:z,noPanClassName:Pe,elevateEdgesOnSelect:!!qe,disableKeyboardA11y:Ue,rfId:at},ue.createElement(kF,{style:S,type:j,component:_,containerStyle:E})),ue.createElement("div",{className:"react-flow__edgelabel-renderer"}),ue.createElement(Q5,{nodeTypes:gt,onNodeClick:l,onNodeDoubleClick:d,onNodeMouseEnter:h,onNodeMouseMove:p,onNodeMouseLeave:g,onNodeContextMenu:w,selectNodesOnDrag:$,onlyRenderVisibleElements:O,noPanClassName:Pe,noDragClassName:Oe,disableKeyboardA11y:Ue,nodeOrigin:et,nodeExtent:ze,rfId:at})))};u2.displayName="GraphView";var NF=v.memo(u2);const Zv=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Os={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:Zv,nodeExtent:Zv,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:Oa.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:XD,isValidConnection:void 0},jF=()=>dP((e,t)=>({...Os,setNodes:n=>{const{nodeInternals:r,nodeOrigin:s,elevateNodesOnSelect:i}=t();e({nodeInternals:Kf(n,r,s,i)})},getNodes:()=>Array.from(t().nodeInternals.values()),setEdges:n=>{const{defaultEdgeOptions:r={}}=t();e({edges:n.map(s=>({...r,...s}))})},setDefaultNodesAndEdges:(n,r)=>{const s=typeof n<"u",i=typeof r<"u",l=s?Kf(n,new Map,t().nodeOrigin,t().elevateNodesOnSelect):new Map;e({nodeInternals:l,edges:i?r:[],hasDefaultNodes:s,hasDefaultEdges:i})},updateNodeDimensions:n=>{const{onNodesChange:r,nodeInternals:s,fitViewOnInit:i,fitViewOnInitDone:l,fitViewOnInitOptions:u,domNode:d,nodeOrigin:f}=t(),h=d==null?void 0:d.querySelector(".react-flow__viewport");if(!h)return;const p=window.getComputedStyle(h),{m22:g}=new window.DOMMatrixReadOnly(p.transform),w=n.reduce((x,b)=>{const j=s.get(b.id);if(j!=null&&j.hidden)s.set(j.id,{...j,[ft]:{...j[ft],handleBounds:void 0}});else if(j){const S=Yx(b.nodeElement);!!(S.width&&S.height&&(j.width!==S.width||j.height!==S.height||b.forceUpdate))&&(s.set(j.id,{...j,[ft]:{...j[ft],handleBounds:{source:gN(".source",b.nodeElement,g,f),target:gN(".target",b.nodeElement,g,f)}},...S}),x.push({id:j.id,type:"dimensions",dimensions:S}))}return x},[]);JA(s,f);const k=l||i&&!l&&QA(t,{initial:!0,...u});e({nodeInternals:new Map(s),fitViewOnInitDone:k}),(w==null?void 0:w.length)>0&&(r==null||r(w))},updateNodePositions:(n,r=!0,s=!1)=>{const{triggerNodeChanges:i}=t(),l=n.map(u=>{const d={id:u.id,type:"position",dragging:s};return r&&(d.positionAbsolute=u.positionAbsolute,d.position=u.position),d});i(l)},triggerNodeChanges:n=>{const{onNodesChange:r,nodeInternals:s,hasDefaultNodes:i,nodeOrigin:l,getNodes:u,elevateNodesOnSelect:d}=t();if(n!=null&&n.length){if(i){const f=F5(n,u()),h=Kf(f,s,l,d);e({nodeInternals:h})}r==null||r(n)}},addSelectedNodes:n=>{const{multiSelectionActive:r,edges:s,getNodes:i}=t();let l,u=null;r?l=n.map(d=>Fs(d,!0)):(l=Lo(i(),n),u=Lo(s,[])),du({changedNodes:l,changedEdges:u,get:t,set:e})},addSelectedEdges:n=>{const{multiSelectionActive:r,edges:s,getNodes:i}=t();let l,u=null;r?l=n.map(d=>Fs(d,!0)):(l=Lo(s,n),u=Lo(i(),[])),du({changedNodes:u,changedEdges:l,get:t,set:e})},unselectNodesAndEdges:({nodes:n,edges:r}={})=>{const{edges:s,getNodes:i}=t(),l=n||i(),u=r||s,d=l.map(h=>(h.selected=!1,Fs(h.id,!1))),f=u.map(h=>Fs(h.id,!1));du({changedNodes:d,changedEdges:f,get:t,set:e})},setMinZoom:n=>{const{d3Zoom:r,maxZoom:s}=t();r==null||r.scaleExtent([n,s]),e({minZoom:n})},setMaxZoom:n=>{const{d3Zoom:r,minZoom:s}=t();r==null||r.scaleExtent([s,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(),i=r().filter(u=>u.selected).map(u=>Fs(u.id,!1)),l=n.filter(u=>u.selected).map(u=>Fs(u.id,!1));du({changedNodes:i,changedEdges:l,get:t,set:e})},setNodeExtent:n=>{const{nodeInternals:r}=t();r.forEach(s=>{s.positionAbsolute=Xx(s.position,n)}),e({nodeExtent:n,nodeInternals:new Map(r)})},panBy:n=>{const{transform:r,width:s,height:i,d3Zoom:l,d3Selection:u,translateExtent:d}=t();if(!l||!u||!n.x&&!n.y)return!1;const f=Xr.translate(r[0]+n.x,r[1]+n.y).scale(r[2]),h=[[0,0],[s,i]],p=l==null?void 0:l.constrain()(f,h,d);return l.transform(u,p),r[0]!==p.x||r[1]!==p.y||r[2]!==p.k},cancelConnection:()=>e({connectionNodeId:Os.connectionNodeId,connectionHandleId:Os.connectionHandleId,connectionHandleType:Os.connectionHandleType,connectionStatus:Os.connectionStatus,connectionStartHandle:Os.connectionStartHandle,connectionEndHandle:Os.connectionEndHandle}),reset:()=>e({...Os})}),Object.is),a0=({children:e})=>{const t=v.useRef(null);return t.current||(t.current=jF()),ue.createElement(zD,{value:t.current},e)};a0.displayName="ReactFlowProvider";const d2=({children:e})=>v.useContext(bd)?ue.createElement(ue.Fragment,null,e):ue.createElement(a0,null,e);d2.displayName="ReactFlowWrapper";const SF={input:WA,default:Yv,output:GA,group:r0},_F={default:Ku,straight:Qx,step:Jx,smoothstep:kd,simplebezier:Zx},EF=[0,0],CF=[15,15],TF={x:0,y:0,zoom:1},RF={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},h2=v.forwardRef(({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:s,nodeTypes:i=SF,edgeTypes:l=_F,onNodeClick:u,onEdgeClick:d,onInit:f,onMove:h,onMoveStart:p,onMoveEnd:g,onConnect:w,onConnectStart:k,onConnectEnd:x,onClickConnectStart:b,onClickConnectEnd:j,onNodeMouseEnter:S,onNodeMouseMove:_,onNodeMouseLeave:E,onNodeContextMenu:T,onNodeDoubleClick:R,onNodeDragStart:A,onNodeDrag:U,onNodeDragStop:I,onNodesDelete:q,onEdgesDelete:P,onSelectionChange:O,onSelectionDragStart:V,onSelectionDrag:$,onSelectionDragStop:M,onSelectionContextMenu:L,onSelectionStart:Y,onSelectionEnd:K,connectionMode:D=Oa.Strict,connectionLineType:z=qs.Bezier,connectionLineStyle:F,connectionLineComponent:H,connectionLineContainerStyle:J,deleteKeyCode:W="Backspace",selectionKeyCode:G="Shift",selectionOnDrag:X=!1,selectionMode:Z=kl.Full,panActivationKeyCode:ee="Space",multiSelectionKeyCode:re=Vu()?"Meta":"Control",zoomActivationKeyCode:ce=Vu()?"Meta":"Control",snapToGrid:ie=!1,snapGrid:fe=CF,onlyRenderVisibleElements:de=!1,selectNodesOnDrag:we=!0,nodesDraggable:xe,nodesConnectable:$e,nodesFocusable:be,nodeOrigin:he=EF,edgesFocusable:se,edgesUpdatable:ke,elementsSelectable:Ce,defaultViewport:Oe=TF,minZoom:Le=.5,maxZoom:Pe=2,translateExtent:qe=Zv,preventScrolling:Ue=!0,nodeExtent:et,defaultMarkerColor:ze="#b1b1b7",zoomOnScroll:at=!0,zoomOnPinch:gt=!0,panOnScroll:Ie=!1,panOnScrollSpeed:ot=.5,panOnScrollMode:Je=Ea.Free,zoomOnDoubleClick:it=!0,panOnDrag:Ft=!0,onPaneClick:kt,onPaneMouseEnter:Nt,onPaneMouseMove:qt,onPaneMouseLeave:kn,onPaneScroll:Gt,onPaneContextMenu:Bt,children:dn,onEdgeContextMenu:Kt,onEdgeDoubleClick:as,onEdgeMouseEnter:$r,onEdgeMouseMove:os,onEdgeMouseLeave:ur,onEdgeUpdate:Bn,onEdgeUpdateStart:is,onEdgeUpdateEnd:Nn,onReconnect:dr,onReconnectStart:hn,onReconnectEnd:ls,reconnectRadius:jn=10,edgeUpdaterRadius:yt=10,onNodesChange:Un,onEdgesChange:ge,noDragClassName:He="nodrag",noWheelClassName:Ze="nowheel",noPanClassName:fn="nopan",fitView:Ut=!1,fitViewOptions:hr,connectOnClick:Xs=!0,attributionPosition:cs,proOptions:zn,defaultEdgeOptions:Va,elevateNodesOnSelect:Ga=!0,elevateEdgesOnSelect:fr=!1,disableKeyboardA11y:Ka=!1,autoPanOnConnect:Ya=!0,autoPanOnNodeDrag:Ye=!0,connectionRadius:us=20,isValidConnection:pr,onError:Xa,style:ds,id:Zs,nodeDragThreshold:Js,...hs},Yt)=>{const fs=Zs||"1";return ue.createElement("div",{...hs,style:{...ds,...RF},ref:Yt,className:Dt(["react-flow",s]),"data-testid":"rf__wrapper",id:Zs},ue.createElement(d2,null,ue.createElement(NF,{onInit:f,onMove:h,onMoveStart:p,onMoveEnd:g,onNodeClick:u,onEdgeClick:d,onNodeMouseEnter:S,onNodeMouseMove:_,onNodeMouseLeave:E,onNodeContextMenu:T,onNodeDoubleClick:R,nodeTypes:i,edgeTypes:l,connectionLineType:z,connectionLineStyle:F,connectionLineComponent:H,connectionLineContainerStyle:J,selectionKeyCode:G,selectionOnDrag:X,selectionMode:Z,deleteKeyCode:W,multiSelectionKeyCode:re,panActivationKeyCode:ee,zoomActivationKeyCode:ce,onlyRenderVisibleElements:de,selectNodesOnDrag:we,defaultViewport:Oe,translateExtent:qe,minZoom:Le,maxZoom:Pe,preventScrolling:Ue,zoomOnScroll:at,zoomOnPinch:gt,zoomOnDoubleClick:it,panOnScroll:Ie,panOnScrollSpeed:ot,panOnScrollMode:Je,panOnDrag:Ft,onPaneClick:kt,onPaneMouseEnter:Nt,onPaneMouseMove:qt,onPaneMouseLeave:kn,onPaneScroll:Gt,onPaneContextMenu:Bt,onSelectionContextMenu:L,onSelectionStart:Y,onSelectionEnd:K,onEdgeContextMenu:Kt,onEdgeDoubleClick:as,onEdgeMouseEnter:$r,onEdgeMouseMove:os,onEdgeMouseLeave:ur,onReconnect:dr??Bn,onReconnectStart:hn??is,onReconnectEnd:ls??Nn,reconnectRadius:jn??yt,defaultMarkerColor:ze,noDragClassName:He,noWheelClassName:Ze,noPanClassName:fn,elevateEdgesOnSelect:fr,rfId:fs,disableKeyboardA11y:Ka,nodeOrigin:he,nodeExtent:et}),ue.createElement(v5,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:w,onConnectStart:k,onConnectEnd:x,onClickConnectStart:b,onClickConnectEnd:j,nodesDraggable:xe,nodesConnectable:$e,nodesFocusable:be,edgesFocusable:se,edgesUpdatable:ke,elementsSelectable:Ce,elevateNodesOnSelect:Ga,minZoom:Le,maxZoom:Pe,nodeExtent:et,onNodesChange:Un,onEdgesChange:ge,snapToGrid:ie,snapGrid:fe,connectionMode:D,translateExtent:qe,connectOnClick:Xs,defaultEdgeOptions:Va,fitView:Ut,fitViewOptions:hr,onNodesDelete:q,onEdgesDelete:P,onNodeDragStart:A,onNodeDrag:U,onNodeDragStop:I,onSelectionDrag:$,onSelectionDragStart:V,onSelectionDragStop:M,noPanClassName:fn,nodeOrigin:he,rfId:fs,autoPanOnConnect:Ya,autoPanOnNodeDrag:Ye,onError:Xa,connectionRadius:us,isValidConnection:pr,nodeDragThreshold:Js}),ue.createElement(y5,{onSelectionChange:O}),dn,ue.createElement(WD,{proOptions:zn,position:cs}),ue.createElement(j5,{rfId:fs,disableKeyboardA11y:Ka})))});h2.displayName="ReactFlow";const AF=e=>({x:e.transform[0],y:e.transform[1],zoom:e.transform[2]});function f2(){return Ke(AF,Rt)}const p2=({id:e,x:t,y:n,width:r,height:s,style:i,color:l,strokeColor:u,strokeWidth:d,className:f,borderRadius:h,shapeRendering:p,onClick:g,selected:w})=>{const{background:k,backgroundColor:x}=i||{},b=l||k||x;return ue.createElement("rect",{className:Dt(["react-flow__minimap-node",{selected:w},f]),x:t,y:n,rx:h,ry:h,width:r,height:s,fill:b,stroke:u,strokeWidth:d,shapeRendering:p,onClick:g?j=>g(j,e):void 0})};p2.displayName="MiniMapNode";var MF=v.memo(p2);const $F=e=>e.nodeOrigin,IF=e=>e.getNodes().filter(t=>!t.hidden&&t.width&&t.height),Jf=e=>e instanceof Function?e:()=>e;function OF({nodeStrokeColor:e="transparent",nodeColor:t="#e2e2e2",nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:s=2,nodeComponent:i=MF,onClick:l}){const u=Ke(IF,Rt),d=Ke($F),f=Jf(t),h=Jf(e),p=Jf(n),g=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return ue.createElement(ue.Fragment,null,u.map(w=>{const{x:k,y:x}=Ra(w,d).positionAbsolute;return ue.createElement(i,{key:w.id,x:k,y:x,width:w.width,height:w.height,style:w.style,selected:w.selected,className:p(w),color:f(w),borderRadius:r,strokeColor:h(w),strokeWidth:s,shapeRendering:g,onClick:l,id:w.id})}))}var LF=v.memo(OF);const PF=200,DF=150,FF=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?KD(Nd(t,e.nodeOrigin),n):n,rfId:e.rfId}},qF="react-flow__minimap-desc";function m2({style:e,className:t,nodeStrokeColor:n="transparent",nodeColor:r="#e2e2e2",nodeClassName:s="",nodeBorderRadius:i=5,nodeStrokeWidth:l=2,nodeComponent:u,maskColor:d="rgb(240, 240, 240, 0.6)",maskStrokeColor:f="none",maskStrokeWidth:h=1,position:p="bottom-right",onClick:g,onNodeClick:w,pannable:k=!1,zoomable:x=!1,ariaLabel:b="React Flow mini map",inversePan:j=!1,zoomStep:S=10,offsetScale:_=5}){const E=xt(),T=v.useRef(null),{boundingRect:R,viewBB:A,rfId:U}=Ke(FF,Rt),I=(e==null?void 0:e.width)??PF,q=(e==null?void 0:e.height)??DF,P=R.width/I,O=R.height/q,V=Math.max(P,O),$=V*I,M=V*q,L=_*V,Y=R.x-($-R.width)/2-L,K=R.y-(M-R.height)/2-L,D=$+L*2,z=M+L*2,F=`${qF}-${U}`,H=v.useRef(0);H.current=V,v.useEffect(()=>{if(T.current){const G=On(T.current),X=re=>{const{transform:ce,d3Selection:ie,d3Zoom:fe}=E.getState();if(re.sourceEvent.type!=="wheel"||!ie||!fe)return;const de=-re.sourceEvent.deltaY*(re.sourceEvent.deltaMode===1?.05:re.sourceEvent.deltaMode?1:.002)*S,we=ce[2]*Math.pow(2,de);fe.scaleTo(ie,we)},Z=re=>{const{transform:ce,d3Selection:ie,d3Zoom:fe,translateExtent:de,width:we,height:xe}=E.getState();if(re.sourceEvent.type!=="mousemove"||!ie||!fe)return;const $e=H.current*Math.max(1,ce[2])*(j?-1:1),be={x:ce[0]-re.sourceEvent.movementX*$e,y:ce[1]-re.sourceEvent.movementY*$e},he=[[0,0],[we,xe]],se=Xr.translate(be.x,be.y).scale(ce[2]),ke=fe.constrain()(se,he,de);fe.transform(ie,ke)},ee=jA().on("zoom",k?Z:null).on("zoom.wheel",x?X:null);return G.call(ee),()=>{G.on("zoom",null)}}},[k,x,j,S]);const J=g?G=>{const X=er(G);g(G,{x:X[0],y:X[1]})}:void 0,W=w?(G,X)=>{const Z=E.getState().nodeInternals.get(X);w(G,Z)}:void 0;return ue.createElement(Kx,{position:p,style:e,className:Dt(["react-flow__minimap",t]),"data-testid":"rf__minimap"},ue.createElement("svg",{width:I,height:q,viewBox:`${Y} ${K} ${D} ${z}`,role:"img","aria-labelledby":F,ref:T,onClick:J},b&&ue.createElement("title",{id:F},b),ue.createElement(LF,{onClick:W,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:s,nodeStrokeWidth:l,nodeComponent:u}),ue.createElement("path",{className:"react-flow__minimap-mask",d:`M${Y-L},${K-L}h${D+L*2}v${z+L*2}h${-D-L*2}z
|
|
57
|
-
M${A.x},${A.y}h${A.width}v${A.height}h${-A.width}z`,fill:d,fillRule:"evenodd",stroke:f,strokeWidth:h,pointerEvents:"none"})))}m2.displayName="MiniMap";var BF=v.memo(m2);function UF(){return ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},ue.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function zF(){return ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},ue.createElement("path",{d:"M0 0h32v4.2H0z"}))}function HF(){return ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},ue.createElement("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"}))}function WF(){return ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},ue.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"}))}function VF(){return ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},ue.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"}))}const $n=({children:e,className:t,...n})=>ue.createElement("button",{type:"button",className:Dt(["react-flow__controls-button",t]),...n},e);$n.displayName="ControlButton";const GF=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom}),g2=({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:s,onZoomIn:i,onZoomOut:l,onFitView:u,onInteractiveChange:d,className:f,children:h,position:p="bottom-left"})=>{const g=xt(),[w,k]=v.useState(!1),{isInteractive:x,minZoomReached:b,maxZoomReached:j}=Ke(GF,Rt),{zoomIn:S,zoomOut:_,fitView:E}=oi();if(v.useEffect(()=>{k(!0)},[]),!w)return null;const T=()=>{S(),i==null||i()},R=()=>{_(),l==null||l()},A=()=>{E(s),u==null||u()},U=()=>{g.setState({nodesDraggable:!x,nodesConnectable:!x,elementsSelectable:!x}),d==null||d(!x)};return ue.createElement(Kx,{className:Dt(["react-flow__controls",f]),position:p,style:e,"data-testid":"rf__controls"},t&&ue.createElement(ue.Fragment,null,ue.createElement($n,{onClick:T,className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:j},ue.createElement(UF,null)),ue.createElement($n,{onClick:R,className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:b},ue.createElement(zF,null))),n&&ue.createElement($n,{className:"react-flow__controls-fitview",onClick:A,title:"fit view","aria-label":"fit view"},ue.createElement(HF,null)),r&&ue.createElement($n,{className:"react-flow__controls-interactive",onClick:U,title:"toggle interactivity","aria-label":"toggle interactivity"},x?ue.createElement(VF,null):ue.createElement(WF,null)),h)};g2.displayName="Controls";var KF=v.memo(g2),rr;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(rr||(rr={}));function YF({color:e,dimensions:t,lineWidth:n}){return ue.createElement("path",{stroke:e,strokeWidth:n,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`})}function XF({color:e,radius:t}){return ue.createElement("circle",{cx:t,cy:t,r:t,fill:e})}const ZF={[rr.Dots]:"#91919a",[rr.Lines]:"#eee",[rr.Cross]:"#e2e2e2"},JF={[rr.Dots]:1,[rr.Lines]:1,[rr.Cross]:6},QF=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function y2({id:e,variant:t=rr.Dots,gap:n=20,size:r,lineWidth:s=1,offset:i=2,color:l,style:u,className:d}){const f=v.useRef(null),{transform:h,patternId:p}=Ke(QF,Rt),g=l||ZF[t],w=r||JF[t],k=t===rr.Dots,x=t===rr.Cross,b=Array.isArray(n)?n:[n,n],j=[b[0]*h[2]||1,b[1]*h[2]||1],S=w*h[2],_=x?[S,S]:j,E=k?[S/i,S/i]:[_[0]/i,_[1]/i];return ue.createElement("svg",{className:Dt(["react-flow__background",d]),style:{...u,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:f,"data-testid":"rf__background"},ue.createElement("pattern",{id:p+e,x:h[0]%j[0],y:h[1]%j[1],width:j[0],height:j[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${E[0]},-${E[1]})`},k?ue.createElement(XF,{color:g,radius:S/i}):ue.createElement(YF,{dimensions:_,color:g,lineWidth:s})),ue.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${p+e})`}))}y2.displayName="Background";var e6=v.memo(y2);function t6(e,t){return e?t==="gone"?"entering":t==="leaving"?"here":t:t==="gone"?"gone":"leaving"}function Au(e){return e!=="gone"}function Mu(e,t){const[n,r]=v.useState(()=>e?"here":"gone"),s=v.useRef(null);return v.useEffect(()=>{r(i=>t6(e,i))},[e]),v.useEffect(()=>{if(n==="leaving")return s.current=window.setTimeout(()=>r("gone"),t),()=>{s.current!=null&&window.clearTimeout(s.current)}},[n,t]),v.useEffect(()=>{n==="entering"&&r("here")},[n]),n}const jN="agent-dag.fm-custom-stations",SN="agent-dag.fm-muted",Jv="custom:",n6=/^UC[A-Za-z0-9_-]{22}$/,r6=/^[A-Za-z0-9_-]{11}$/,o0=/^[A-Za-z0-9_-]{1,80}$/,s6=/\.(mp3|aac|ogg)$/i,a6=/\.m3u8$/i,w2=2048,jl=80;function Pa(e){return`${Jv}${e}`}function Xo(e){if(!e.startsWith(Jv))return null;const t=e.slice(Jv.length);return o0.test(t)?t:null}function _N(e){return Xo(e)??e}function o6(e){return e?"This station could not be played. Check its link, pick another, or pick it again to retry.":"This station is not live right now. Pick another, or pick it again later to retry."}function i0(e){var l,u;const t=e.trim();if(t.length>w2)return null;let n;try{n=new URL(t)}catch{return null}if(n.protocol!=="https:"||n.username||n.password)return null;const r=n.toString(),s=n.hostname.toLowerCase();if(s==="youtube.com"||s==="www.youtube.com"||s==="m.youtube.com"){if(n.port)return null;const d=(l=/^\/channel\/([^/]+)(?:\/live)?\/?$/.exec(n.pathname))==null?void 0:l[1];if(d&&n6.test(d))return{kind:"youtube-channel",url:r,channel:d};const f=(u=/^\/@([^/]+)\/live\/?$/.exec(n.pathname))==null?void 0:u[1];if(f&&/^[A-Za-z0-9._-]{1,64}$/.test(f))return{kind:"youtube-handle",url:r,handle:f};if(n.pathname==="/watch"){const h=n.searchParams.get("v")??"";if(r6.test(h))return{kind:"youtube-video",url:r,video:h}}return null}return a6.test(n.pathname)?{kind:"direct-audio",url:r,format:"hls"}:s6.test(n.pathname)?{kind:"direct-audio",url:r,format:"audio"}:null}function i6(e){return e==="1"}function l6(e){if(!e)return[];let t;try{t=JSON.parse(e)}catch{return[]}if(!Array.isArray(t))return[];const n=new Set,r=[];for(const s of t){if(!s||typeof s!="object")continue;const i=typeof s.id=="string"?s.id:"",l=typeof s.name=="string"?s.name.trim():"",u=typeof s.url=="string"?s.url.trim():"",d=i0(u);!o0.test(i)||n.has(i)||!l||l.length>jl||!d||(n.add(i),r.push({id:i,name:l,url:d.url}))}return r}function c6(e,t,n){const r=Xo(e??"");return r&&t.some(s=>s.id===r)?Pa(r):n(e)}function u6(e,t){return e===Pa(t)?"claude-fm":e}function d6(){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)}`}function h6(e,t,n=d6()){const r=e.trim(),s=i0(t);return!r||r.length>jl||!o0.test(n)||!s?null:{id:n,name:r,url:s.url}}const v2=.2,x2=1.6;function f6(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:s}=t;return typeof n!="number"||typeof r!="number"||typeof s!="number"||!Number.isFinite(n)||!Number.isFinite(r)||!Number.isFinite(s)||s<v2||s>x2?null:{x:n,y:r,zoom:s}}function Qv({durationMs:e,documentHidden:t,reducedMotion:n=p6()}){return t||n?!1:Number.isFinite(e)&&e>0}function p6(){return typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches}const m6=["us-gov","global","apac","us","eu","jp","au"],g6=new RegExp(`^(?:(?:${m6.join("|")})\\.)?anthropic\\.`,"i");function ii(e){return e.replace(g6,"")}const y6=/^(?:claude[-_]|gpt[-_]|o\d|codex[-_])/i,w6=new Set(["tool_input","tool_response"]);function b2(e,t=0){if(!e||typeof e!="object"||t>6)return null;const n=e;if(typeof n.model=="string"&&y6.test(ii(n.model)))return n.model;for(const[r,s]of Object.entries(n)){if(w6.has(r))continue;const i=b2(s,t+1);if(i)return i}return null}function l0(){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 Ks(e,t){return`${e}::${t}`}function li(e,t){return`${e}\0${t}`}const v6=/[0-9a-f]{16,}/i,x6=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function k2(e){return v6.test(e)||x6.test(e)}function b6(e){if(!e)return;const t=e.replace(/\\/g,"/").split("/").filter(Boolean);for(let n=t.length-1;n>=0;n--)if(!k2(t[n]))return t[n];return t[t.length-1]}function N2(){return{inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0}}function j2(e){const t=e.cache_creation,n=t&&typeof t=="object"?t:e,r=n.ephemeral_1h_input_tokens,s=n.ephemeral_5m_input_tokens;return typeof r!="number"&&typeof s!="number"?{}:{cacheCreate1hTokens:Number(r??0),cacheCreate5mTokens:Number(s??0)}}function S2(e){const t=j2(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 k6(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]=S2(r));return Object.keys(t).length?t:void 0}function _2(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),...j2(n)};for(const r of Object.values(n)){const s=_2(r,t+1);if(s)return s}return null}function c0(e){return b6(e)}function u0(e){const t=e.agent_type??e.subagent_type;return t&&!k2(t)?t:"subagent"}function Bl(e){return e.agent_id?e.agent_id:e.parent_tool_use_id?e.parent_tool_use_id:null}function Sl(e,t){!e.cwd&&t.cwd&&(e.cwd=t.cwd,e.cwdBasename=c0(t.cwd))}function E2(e,t){e.label==="session"&&t.cwd&&(e.label=c0(t.cwd)??"session")}function C2(e,t){const n=u0(t);n&&(e.label==="subagent"||!e.label)&&(e.label=n)}function ci(e,t,n,r){const s=t;let i=e.agents.get(s);return i||(i={id:s,sessionId:t,label:"session",kind:"root",state:"active",startedAt:n,lastEventAt:n,tools:[],prompts:[],toolCount:0,childCount:0,synthetic:r,usage:N2()},e.agents.set(s,i),i)}function T2(e,t,n,r){const s=Ks(t,n),i=e.agents.get(s);return i?(Sl(i,r),C2(i,r),i):null}function N6(e,t,n){const r=t.session_id??"unknown",s=Bl(t);if(s){const d=T2(e,r,s,t);if(d)return d}const i=e.activeSubagentStack.get(r),l=i&&i.length>0?i[i.length-1]:null;if(l){const d=e.agents.get(Ks(r,l));if(d)return Sl(d,t),d}const u=ci(e,r,n,t.hook_event_name!=="SessionStart");return Sl(u,t),E2(u,t),u}function j6(e,t,n,r,s){const i=Ks(t,n),l=ci(e,t,s,!0);let u=e.agents.get(i);if(u)return Sl(u,r),C2(u,r),u;u={id:i,sessionId:t,label:u0(r),kind:"subagent",parentId:l.id,state:"active",startedAt:s,tools:[],prompts:[],cwd:r.cwd,cwdBasename:c0(r.cwd),toolCount:0,childCount:0,usage:N2()},e.agents.set(i,u);const d=e.pendingSubagentModels.get(i);return d&&(u.model=d,e.pendingSubagentModels.delete(i)),l.childCount+=1,u}function S6(e,t,n){const r=e.activeSubagentStack.get(t)??[];r.includes(n)||(r.push(n),e.activeSubagentStack.set(t,r))}function R2(e,t,n){const r=e.activeSubagentStack.get(t);if(r){for(let s=r.length-1;s>=0;s--)if(r[s]===n){r.splice(s,1);break}r.length===0&&e.activeSubagentStack.delete(t)}}function It(e,t){return Object.hasOwn(e,t)?e[t]:void 0}const _6=/^\s*<task-notification>([\s\S]*?)<\/task-notification>/;function EN(e,t){var n;return((n=new RegExp(`<${t}>([\\s\\S]*?)</${t}>`).exec(e))==null?void 0:n[1].trim())||void 0}const E6={completed:"background task finished",failed:"background task failed",killed:"background task stopped"};function d0(e){const t=_6.exec(e);if(!t)return null;const n=EN(t[1],"status");return{label:(n?It(E6,n):void 0)??"background task update",detail:EN(t[1],"summary")}}function A2(e){return e.filter(t=>!d0(t.text))}const CN=2e3;function C6(e,t,n){for(let r=e.length-1;r>=0;r--){const s=e[r];if(s.at<t-CN)return!1;if(s.text===n&&s.at<=t+CN)return!0}return!1}function T6(e,t,n){if(C6(e,t,n))return!1;let r=e.length;for(;r>0&&e[r-1].at>t;)r--;return e.splice(r,0,{at:t,text:n}),!0}const Yu=2e3;function R6(e){const t=e.prompts[e.prompts.length-1];return t&&t.at>e.startedAt?t.at:e.startedAt}function Xu(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 TN=200;function M2(e,t,n){const r=t.ok===!1;t.ok=n,e&&r===n&&(e.toolErrorCount=(e.toolErrorCount??0)+(n?-1:1))}function $2(e,t){return t.agentId==null?void 0:e.agents.get(t.agentId)}function Qf(e,t,n){const r=e.toolCountByName??(e.toolCountByName=new Map),s=(r.get(t)??0)+n;s>0?r.set(t,s):r.delete(t)}function A6(e,t,n){var r;return((r=e.get(t))==null?void 0:r.tools.find(s=>s.id===n))??null}const M6=25;function $6(e,t){const n=t.tools;if(n.length>TN){const r=n.splice(0,n.length-TN);for(const s of r)O2(e,t,s)}for(let r=n.length-M6-1;r>=0;r--){const s=n[r];if(s.trimmed)break;s.input=void 0,s.response=void 0,s.trimmed=!0}}function I6(e,t,n){const r=e.toolIndex.get(li(t.sessionId,n));if(r)return r;for(let s=t.tools.length-1;s>=0;s--)if(t.tools[s].id===n)return t.tools[s];return null}function I2(e,t){for(const n of t.tools)O2(e,t,n)}function O2(e,t,n){const r=li(t.sessionId,n.id);e.toolIndex.get(r)===n&&e.toolIndex.delete(r)}const O6="no result reached the deck — events were dropped while the deck was paused";function L2(e,t,n,r,s){n.endedAt=r,M2(t,n,!1),n.errorPreview=n.outcomeGap?O6:s,e.toolIndex.delete(li(t.sessionId,n.id))}function L6(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 s=n==null?void 0:n.tool_use_id;return typeof s!="string"||s.length===0?!1:e.toolIndex.has(li((n==null?void 0:n.session_id)??"unknown",s))}function P6(e,t,n,r,s){const i=t.tool_use_id?I6(e,r,t.tool_use_id):null;if(i){if(t.tool_name&&i.name==="?"){i.name=t.tool_name;const f=$2(e,i);f&&(Qf(f,"?",-1),Qf(f,i.name,1))}i.endedAt==null&&!i.trimmed&&t.tool_input!==void 0&&(i.input=t.tool_input,i.inputPreview=Xu(t.tool_input));return}const l=t.tool_use_id??`${r.id}:${r.toolCount}`,u=Bl(t),d={id:l,name:t.tool_name??"?",input:t.tool_input,inputPreview:Xu(t.tool_input),agentId:r.id,explicitSubagentId:u?Ks(n,u):void 0,startedAt:s};r.tools.push(d),r.toolCount+=1,Qf(r,d.name,1),r.state="active",e.toolIndex.set(li(r.sessionId,l),d),$6(e,r)}function D6(e,t,n,r,s){const i=t.tool_use_id;if(!i)return;const l=li(r,i);let u=e.toolIndex.get(l),d=!1;if(!u)for(const h of e.agents.values()){if(h.sessionId!==r)continue;const p=h.tools.find(g=>g.id===i);if(p){u=p,d=!0;break}}if(!u||u.outcomeApplied)return;u.outcomeApplied=!0,u.outcomeGap=void 0,u.endedAt=s,M2($2(e,u),u,n==="PostToolUse"),u.trimmed||(u.response=t.tool_response),n==="PostToolUseFailure"?u.errorPreview=Xu(t.tool_response):d&&(u.errorPreview=void 0);const f=_2(t.tool_response);f&&(u.usage=f),e.toolIndex.delete(l)}function F6(e,t,n){const r=e.agents.get(t);r&&n>(r.lastEventAt??0)&&(r.lastEventAt=n,r.reaped&&(r.reaped=!1,r.state="active",r.endedAt=void 0,r.closedAt=void 0))}function q6(e,t,n,r){const s=ci(e,n,r,!1);s.synthetic=!1,s.state="active",s.closedAt=void 0,s.endedAt=void 0,s.startedAt=Math.min(s.startedAt??r,r),Sl(s,t),E2(s,t)}function B6(e,t,n,r){for(const l of e.agents.values())l.sessionId===n&&l.kind==="subagent"&&l.state==="done"&&l.exitAt==null&&l.endedAt!=null&&l.endedAt<r&&(l.exitAt=r);const s=ci(e,n,r,!1);s.state="active",s.endedAt=void 0,s.closedAt=void 0,s.exitAt=void 0;const i=(typeof t.prompt=="string"?t.prompt:typeof t.message=="string"?t.message:"")??"";i&&T6(s.prompts,r,i)&&!s.firstPrompt&&!d0(i)&&(s.firstPrompt=Xu(i,120))}function U6(e,t,n,r){const s=ci(e,n,r,!1),i=R6(s);if(r<i)return;const l=s.lastTurnEndAt;if(!(l!=null&&i>l&&r<=l+Yu)){s.state="done",s.endedAt=r,s.lastTurnEndAt=r;for(const u of s.provider==="codex"?[]:e.agents.values())if(u.sessionId===n)for(const d of u.tools)d.endedAt==null&&d.explicitSubagentId==null&&L2(e,u,d,r,"the turn ended before this call returned");t==="SessionEnd"&&(s.closedAt=r),e.activeSubagentStack.delete(n)}}function z6(e,t,n,r){const s=Bl(t);if(!s)return;const i=j6(e,n,s,t,r),l=u0(t);l&&(i.label=l);const u=e.subagentTombstones.get(i.id);u!=null&&e.subagentTombstones.delete(i.id);const d=i.endedAt!=null&&r-i.endedAt<=Yu,f=u!=null&&r-u<=Yu;if(d||f){const h=f?u:i.endedAt;i.state="done",i.endedAt=h,i.startedAt=Math.min(i.startedAt,h),R2(e,n,s);return}i.state="active",i.startedAt=i.startedAt||r,i.exitAt=void 0,i.endedAt=void 0,S6(e,n,s)}function H6(e,t,n,r){const s=Bl(t);if(!s)return;const i=T2(e,n,s,t);if(!i){for(const[l,u]of e.subagentTombstones)r-u>Yu&&e.subagentTombstones.delete(l);e.subagentTombstones.set(Ks(n,s),r);return}i.state="done",i.endedAt=Math.min(i.endedAt??r,r),R2(e,n,s)}function P2(){return{msgsUser:0,msgsAssistant:0,toolUses:0,toolResults:0,systemReminders:0,currentContextTokens:0,memoryFiles:[]}}function W6(e,t,n){if(typeof t.model_context_window=="number"&&t.model_context_window>0){const r=e.agents.get(n);r&&(r.contextWindow=t.model_context_window)}if(typeof t.approval_policy=="string"&&t.approval_policy){const r=e.agents.get(n);r&&(r.approvalPolicy=t.approval_policy)}if(typeof t.context_tokens=="number"&&t.context_tokens>=0){const r=e.agents.get(n);r&&(r.context={...r.context??P2(),currentContextTokens:t.context_tokens})}}const V6=6e4,RN=64;function G6(e,t,n){const r=typeof t.model=="string"?t.model:null;if(r){const i=e.agents.get(n);i&&(i.model=r)}const s=t.subagentModels;if(s&&typeof s=="object")for(const[i,l]of Object.entries(s)){if(typeof l!="string")continue;const u=Ks(n,i),d=e.agents.get(u);if(d)d.model=l,e.pendingSubagentModels.delete(u);else if(e.pendingSubagentModels.delete(u),e.pendingSubagentModels.set(u,l),e.pendingSubagentModels.size>256){const f=e.pendingSubagentModels.keys().next().value;f!==void 0&&e.pendingSubagentModels.delete(f)}}}function K6(e,t,n){const r=t.context??null;if(r){const s=e.agents.get(n);if(s){const i=s.context??P2(),l=(d,f)=>typeof r[d]=="number"?r[d]:f,u=Array.isArray(r.memoryFiles)?r.memoryFiles:Array.isArray(r.claudeMdFiles)?r.claudeMdFiles:null;s.context={msgsUser:l("msgsUser",i.msgsUser),msgsAssistant:l("msgsAssistant",i.msgsAssistant),toolUses:l("toolUses",i.toolUses),toolResults:l("toolResults",i.toolResults),systemReminders:l("systemReminders",i.systemReminders),currentContextTokens:l("currentContextTokens",i.currentContextTokens),memoryFiles:u??i.memoryFiles}}}}function Y6(e,t,n){const r=e.agents.get(n);if(r){const s=typeof t.sessionName=="string"?t.sessionName.trim():"",i=typeof t.sessionTitle=="string"?t.sessionTitle.trim():"";s&&(r.sessionName=s),i&&(r.sessionTitle=i);const l=r.sessionName??"";r.sessionTitle&&l&&r.sessionTitle.toLowerCase()===l.toLowerCase()&&(r.sessionTitle=void 0)}}function X6(e,t,n){const r=e.agents.get(n);if(r){const s=t.recap;s===null?r.recap=void 0:s&&typeof s.text=="string"&&s.text.trim()&&Number.isFinite(s.at)&&(r.recap={text:s.text.trim(),at:s.at})}}function Z6(e,t,n,r){const s=t.kind==="thinking"||t.kind==="text"||t.kind==="tool_use"?t.kind:null,i=typeof t.at=="number"&&Number.isFinite(t.at)?t.at:r;if(!s)return;const l=e.agents.get(n);if(l&&!(l.lastOutputAt!=null&&i<=l.lastOutputAt)){if(l.lastOutputAt=i,s!=="tool_use"){const u=(l.outputs??[]).filter(d=>i-d<V6);u.push(i),l.outputs=u.length>RN?u.slice(-RN):u}e.revision+=1}}function J6(e,t,n){const r=t.usage??null;if(r){const s=e.agents.get(n);s&&(Object.assign(s.usage,S2(r)),s.usageByModel=k6(t.usageByModel))}}const Q6=["command","cmd","file_path","path","url","pattern","notebook_path"],AN=120,ep=e=>e.length>AN?`${e.slice(0,AN-1)}…`:e;function eq(e){if(typeof e=="string")return e.trim()?ep(e.trim()):null;if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e;for(const n of Q6){const r=t[n];if(typeof r=="string"&&r.trim())return ep(r.trim());if(Array.isArray(r)&&r.length>0&&r.every(s=>typeof s=="string")){const s=r.join(" ").trim();if(s)return ep(s)}}return null}function tq(e){return e==="permission_prompt"?"permission":e==="agent_needs_input"?"asked":e==="idle_prompt"?"idle":null}const nq=new Set(["Notification","ModelObserved","ContextObserved","UsageObserved","SessionNamed","SessionRecapped","OutputObserved"]);function rq(e,t){let n=null;for(const r of e.toolIndex.values()){const s=r.agentId?e.agents.get(r.agentId):void 0;!s||s.sessionId!==t||(!n||r.startedAt>n.startedAt)&&(n=r)}return n}const sq=3e4;function aq(e,t){if(!(!e||!e.name)&&!(t-e.startedAt>sq)&&!(e.startedAt>t))return{name:e.name,preview:eq(e.input)??""}}function oq(e,t,n,r,s){if(n!=="permission")return{kind:n,message:r,since:s};const i=rq(e,t),l={kind:n,message:r,since:s};i!=null&&i.explicitSubagentId&&(l.subagentId=i.explicitSubagentId);const u=aq(i,s);return u&&(l.tool=u),l}function iq(e,t,n){if(e.kind==="idle")return!0;const r=Bl(t);return r==null?!0:e.subagentId!=null&&Ks(n,r)===e.subagentId}function lq(e,t,n,r){if(!nq.has(t)){const s=e.agents.get(r);s!=null&&s.waiting&&iq(s.waiting,n,r)&&(s.waiting=null)}}function cq(e,t,n,r){const s=tq(t.notification_type);if(!s)return;const i=ci(e,n,r,!1),l=typeof t.message=="string"?t.message:"",u=i.waiting;i.waiting=u&&u.kind===s&&u.message===l?{...u,since:Math.min(u.since,r)}:oq(e,n,s,l,r)}function Ul(e,t){return t&&(e.revision+=1),t}function uq(e,t,n,r,s){if(e.agents.size<=n)return!1;const i=p=>p.state==="done"&&p.endedAt!=null&&t-p.endedAt>r,l=[],u=new Map;for(const[p,g]of e.agents){if(g.parentId!=null){const w=u.get(g.parentId);w?w.push(p):u.set(g.parentId,[p])}i(g)&&l.push({id:p,endedAt:g.endedAt})}if(l.length===0)return!1;l.sort((p,g)=>p.endedAt-g.endedAt);let d=0;const f=new Set,h=p=>{const g=e.agents.get(p);g&&(I2(e,g),e.agents.delete(p),f.add(g.sessionId),d++)};for(const p of l){if(e.agents.size<=n)break;if(!e.agents.has(p.id))continue;const g=(u.get(p.id)??[]).map(w=>e.agents.get(w)).filter(w=>w!=null);if(!g.some(w=>!i(w))){for(const w of g)h(w.id);h(p.id)}}if(s&&f.size>0){const p=new Set;for(const g of e.agents.values())p.add(g.sessionId);for(const g of f)p.has(g)||s(g)}return Ul(e,d>0)}function dq(e,t,n,r,s){const i=new Map;for(const[h,p]of e.agents){let g=i.get(p.sessionId);g||(g={ids:[],endedAt:0,live:!1,closed:!1},i.set(p.sessionId,g)),g.ids.push(h),p.kind==="root"&&p.closedAt!=null&&(g.closed=!0),p.state==="done"&&p.endedAt!=null?g.endedAt=Math.max(g.endedAt,p.endedAt):g.live=!0}const l=[...i].filter(([,h])=>!h.live&&h.endedAt>0&&t-h.endedAt>r).sort(([,h],[,p])=>h.closed===p.closed?h.endedAt-p.endedAt:h.closed?-1:1);let d=[...i.values()].filter(h=>!h.live).length-n;if(d<=0)return!1;let f=!1;for(const[h,p]of l){if(d<=0)break;for(const w of p.ids){const k=e.agents.get(w);k&&I2(e,k),e.agents.delete(w)}const g=Ks(h,"");for(const w of e.pendingSubagentModels.keys())w.startsWith(g)&&e.pendingSubagentModels.delete(w);s==null||s(h),d--,f=!0}return Ul(e,f)}function hq(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 Ul(e,t)}function fq(e,t,n){let r=!1;for(const s of e.agents.values()){if(s.provider==="codex")continue;const i=e.agents.get(s.sessionId),l=(i==null?void 0:i.lastEventAt)??(i==null?void 0:i.startedAt);for(const u of s.tools){const d=Math.max(u.startedAt,l??u.startedAt);u.endedAt==null&&t-d>n&&(L2(e,s,u,d,"session ended before this call returned"),r=!0)}}return Ul(e,r)}const MN=90*6e4;function pq(e,t,n){let r=!1;for(const s of e.agents.values()){if(s.kind!=="root")continue;const i=s.lastEventAt??s.startedAt;if(!(t-i<=n)){s.waiting&&(s.waiting=null,r=!0),s.closedAt==null&&(s.closedAt=i),s.state==="active"&&(s.state="done",s.endedAt=i,s.reaped=!0,r=!0);for(const l of e.agents.values())l.sessionId!==s.sessionId||l.kind==="root"||l.state!=="active"||(l.state="done",l.endedAt=i,r=!0);e.activeSubagentStack.delete(s.sessionId)}}return Ul(e,r)}function Zu(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 D2(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??{},s=t.receivedAt,i=r.hook_event_name??"Unknown";if(i==="__clear")return{...l0(),lastSeq:t.seq,seqEpoch:e.seqEpoch,revision:e.revision+1};e.totalEvents+=1,e.lastSeq=t.seq,e.revision+=1;const l=r.session_id??"unknown";switch(lq(e,i,r,l),F6(e,l,s),W6(e,r,l),i){case"ModelObserved":return G6(e,r,l),e;case"ContextObserved":return K6(e,r,l),e;case"SessionNamed":return Y6(e,r,l),e;case"SessionRecapped":return X6(e,r,l),e;case"OutputObserved":return Z6(e,r,l,s),e;case"UsageObserved":return J6(e,r,l),e}const u=N6(e,r,s);u.provider||(u.provider=r.provider==="codex"?"codex":"claude");const d=b2(r);switch(d&&(u.model=d),i){case"SessionStart":q6(e,r,l,s);break;case"UserPromptSubmit":B6(e,r,l,s);break;case"PreToolUse":P6(e,r,l,u,s);break;case"PostToolUse":case"PostToolUseFailure":D6(e,r,i,l,s);break;case"SubagentStart":z6(e,r,l,s);break;case"SubagentStop":H6(e,r,l,s);break;case"Stop":case"SessionEnd":U6(e,i,l,s);break;case"Notification":cq(e,r,l,s);break}return e}const mq={input:2,output:10,cacheRead:.2,cacheWrite:2.5,cacheWrite1h:4},gq=[{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[-_.]5\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:4,output:20,cacheRead:.2,cacheWrite:5,cacheWrite1h:8}},{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[-_.]5\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:2,output:10,cacheRead:.2,cacheWrite:2.5,cacheWrite1h:4}},{match:/^claude[-_]sonnet[-_]5\b(?![-_.]\d{1,7}(?!\d))/i,rates:mq},{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 yq(e){return e?/^(?:gpt[-_]|codex[-_]|o\d)/i.test(e):!1}function qa(e,t=Date.now()){if(!e)return null;const n=ii(e);for(const r of gq)if(r.match.test(n))return typeof r.rates=="function"?r.rates(t):r.rates;return null}function ul(e,t){return e*t/1e6}function F2(e,t){const n=Math.max(0,e.cacheCreate1hTokens??0),r=Math.max(0,e.cacheCreate5mTokens??0),s=Math.max(0,e.cacheCreateTokens-n-r),i=r+s,l=t.cacheWrite1h??t.cacheWrite;return{tokens5m:i,tokens1h:n,usd5m:ul(i,t.cacheWrite),usd1h:ul(n,l)}}function q2(e,t,n=Date.now()){if(!yq(t))return e.inputTokens;const r=qa(t,n),s=((r==null?void 0:r.cacheWrite)??0)>0?Math.max(0,e.cacheCreateTokens):0;return Math.max(0,e.inputTokens-e.cacheReadTokens-s)}function zo(e,t,n=Date.now()){const r=qa(t,n);if(!r)return{input:0,output:0,cacheRead:0,cacheWrite:0,total:0};const s=ul(q2(e,t,n),r.input),i=ul(e.outputTokens,r.output),l=ul(e.cacheReadTokens,r.cacheRead),u=F2(e,r),d=u.usd5m+u.usd1h;return{input:s,output:i,cacheRead:l,cacheWrite:d,total:s+i+l+d}}const ts="not priced";function dl(e,t,n){const r=e.toFixed(t);return Number(r)<n?r:null}function Be(e){if(e<=0)return"—";if(e<.005)return"<1¢";if(e<1){const t=dl(e*100,e<.1?1:0,100);if(t!==null)return`${t}¢`}if(e<100){const t=dl(e,2,100);if(t!==null)return`$${t}`}if(e<1e4){const t=dl(e,0,1e4);if(t!==null)return`$${t}`}return`$${(e/1e3).toFixed(1)}k`}function h0(e,t){if(e<=0||t<10)return null;const n=e/t,r=n*60;return r>=.01?`${Be(r)}/min`:`${Be(n*3600)}/hr`}function wq(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 vq(e,t){let n=0,r=0,s=0,i=0,l=0,u=0;for(const p of t)n+=p.inputTokens,r+=p.outputTokens,s+=p.cacheReadTokens,i+=p.cacheCreateTokens,l+=p.cacheCreate1hTokens??0,u+=p.cacheCreate5mTokens??0;const d=(p,g)=>Math.max(0,p-g),f={inputTokens:d(e.inputTokens,n),outputTokens:d(e.outputTokens,r),cacheReadTokens:d(e.cacheReadTokens,s),cacheCreateTokens:d(e.cacheCreateTokens,i)};return(e.cacheCreate1hTokens!==void 0||e.cacheCreate5mTokens!==void 0)&&(f.cacheCreate1hTokens=d(e.cacheCreate1hTokens??0,l),f.cacheCreate5mTokens=d(e.cacheCreate5mTokens??0,u)),f.inputTokens+f.outputTokens+f.cacheReadTokens+f.cacheCreateTokens>0?f:null}function zl(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(i=>({model:i,usage:t[i]})),s=vq(e.usage,r.map(i=>i.usage));if(s){const i=r.findIndex(l=>l.model===e.model);i>=0?r[i]={model:r[i].model,usage:wq(r[i].usage,s)}:r.push({model:e.model,usage:s})}return r}function un(e,t=Date.now()){const n={input:0,output:0,cacheRead:0,cacheWrite:0,total:0};for(const r of zl(e)){const s=zo(r.usage,r.model,t);n.input+=s.input,n.output+=s.output,n.cacheRead+=s.cacheRead,n.cacheWrite+=s.cacheWrite,n.total+=s.total}return n}function _l(e,t=Date.now()){let n=0;for(const r of zl(e))qa(r.model,t)==null&&(n+=r.usage.inputTokens+r.usage.outputTokens);return n}function B2(e){const t=[];for(const n of zl(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 U2(e){return B2(e).filter(t=>t!==e.model)}function $N(e,t){const n=qa(t);if(!n)return`model: ${t}
|
|
58
|
-
no published rate in this build — the tokens are counted, the dollars are not`;const r=h=>h.toLocaleString(),s=h=>`$${h}/MTok`,i=zo(e,t),l=F2(e,n),u=l.tokens1h>0?[`cache w5m${r(l.tokens5m).padStart(14)} × ${s(n.cacheWrite).padEnd(11)} = ${Be(l.usd5m)}`,`cache w1h${r(l.tokens1h).padStart(14)} × ${s(n.cacheWrite1h??n.cacheWrite).padEnd(11)} = ${Be(l.usd1h)}`]:[`cache w ${r(l.tokens5m).padStart(14)} × ${s(n.cacheWrite).padEnd(11)} = ${Be(l.usd5m)}`],d=q2(e,t),f=d===e.inputTokens?"input":"uncached";return[`model: ${t}`,`${f.padEnd(9)}${r(d).padStart(14)} × ${s(n.input).padEnd(11)} = ${Be(i.input)}`,`output ${r(e.outputTokens).padStart(14)} × ${s(n.output).padEnd(11)} = ${Be(i.output)}`,`cache r ${r(e.cacheReadTokens).padStart(14)} × ${s(n.cacheRead).padEnd(11)} = ${Be(i.cacheRead)}`,...u,"─────────────────────────────────────────",`total = ${Be(i.total)}`].join(`
|
|
59
|
-
`)}function IN(e){const t=zl(e);return t.length<=1?$N(e.usage,e.model):[...t.map(n=>$N(n.usage,n.model)),"═════════════════════════════════════════",`all models = ${Be(un(e).total)}`].join(`
|
|
60
|
-
`)}function xq(e){if(!e.model)return null;const t=qa(e.model),n=un(e),r=_l(e);if(!t&&n.total<=0)return e.usage.inputTokens+e.usage.outputTokens<=0?null:{kind:"unpriced",tt:IN(e)};if(n.total<=0)return null;const s=Math.max(0,((e.endedAt??Date.now())-e.startedAt)/1e3),i=e.state==="active"&&!e.synthetic?h0(n.total,s):null,l=IN(e)+(i?`
|
|
61
|
-
burn: ${i}`:"");return{kind:"spent",total:n.total,floor:r>0,tt:l}}const bq=new Set(["untrusted","on-request","on-failure"]);function kq(e){return typeof e!="string"||!e?null:bq.has(e)?!0:e==="never"?!1:null}function Nq(e){if(e.provider!=="codex"||e.kind!=="root"||e.waiting||e.state!=="active")return null;const t=kq(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."}
|
|
62
|
-
|
|
63
|
-
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 ON(e){return e[0].toUpperCase()+e.slice(1).toLowerCase()}function Ws(e){const t=ii(e).replace(/[-_]\d{8}(?!\d)/,""),n=t.match(/^claude[-_](opus|sonnet|haiku|fable|mythos)[-_](\d+(?:[-_.]\d+)*)/i);if(n){const s=ON(n[1]),i=n[2].replace(/[-_]/g,".");return`${s} ${i}`}const r=t.match(/^gpt[-_](\d+(?:[-_.]\d+)*)((?:[-_][A-Za-z0-9.]+)*)$/i);if(r){const s=r[1].replace(/[-_]/g,"."),i=r[2].split(/[-_]/).filter(Boolean).map(ON);return[`GPT-${s}`,...i].join(" ")}return e}function jd(e){const t=ii(e??""),n=t.match(/^claude[-_](opus|sonnet|haiku|fable|mythos)[-_]/i);return n?n[1].toLowerCase():/^gpt[-_]/i.test(t)?"gpt":""}function lr(e){return(e==null?void 0:e.kind)==="permission"||(e==null?void 0:e.kind)==="asked"}function ex(e){const t=[];for(const n of e)n.kind==="root"&&lr(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 jq(e,t){if(e.length===0)return null;const n=e.findIndex(r=>r.id===t);return e[(n+1)%e.length]}function Sq(e){const t=new Set;for(const n of e)n.state==="active"&&t.add(n.sessionId);return t.size}function Sd(e,t){return`${e}@${t.since}`}function z2(e,t){if(!e.tool)return null;const{name:n,preview:r}=e.tool,s=new RegExp(`\\b${n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`,"i").test(t);return r?s?r:`${n} · ${r}`:s?null:n}function _q(e){const t=e.message||"Needs your permission",n=z2(e,t);return n?`${t}
|
|
64
|
-
Likely on: ${n}`:t}function Eq(e,t,n,r=!0){if(!r)return[];if(n)return[];const s=[];for(const i of e){if(!lr(i.waiting))continue;const l=Sd(i.id,i.waiting);t.has(l)||s.push({key:l,title:i.label,body:_q(i.waiting),sessionId:i.id})}return s}function Cq(e,t,n){const r=new Set;for(const i of e)r.add(Sd(i.id,i.waiting));const s=new Set;for(const i of n)r.has(i)&&s.add(i);for(const i of t)s.add(i.key);return s}function fu(e){return new Set(e.map(t=>Sd(t.id,t.waiting)))}function Tq(e,t){return e!==t}function Rq(e,t){return!e&&t!=null}function Aq(e,t){return e!==null&&t!=null}function Zo(e){return e==="active"?"live":e==="done"?"done":"err"}function Jo(e){return e.message?e.message:e.kind==="permission"?"Needs your permission":"Waiting for your input"}function Mq(e){return`${e} subagent${e===1?"":"s"} spawned`}function $q(e,t=Date.now(),n=!1){const r=e.tools.filter(i=>i.ok===!1).length,s=un(e,t).total;return[e.label,e.kind==="root"?"session":"subagent",Zo(e.state),lr(e.waiting)?Jo(e.waiting):null,e.model?Ws(e.model):null,`${e.toolCount} ${e.toolCount===1?"tool":"tools"}`,r>0?`${r} failed`:null,s>0?`${Be(s)}${_l(e,t)>0?"+":""}`:null,n?"selected":null].filter(Boolean).join(", ")}function Iq(e,t){const n=z2(e,t);return n?`Likely on: ${n}`:null}function f0(e){return e.kind==="idle"?"Your turn":Jo(e)}function st(e){const t=Math.round(e);if(t<1e3)return`${t}`;if(t<1e6){const n=dl(t/1e3,1,1e3);if(n!==null)return`${n}k`}if(t<1e9){const n=dl(t/1e6,2,1e3);if(n!==null)return`${n}M`}return`${(t/1e9).toFixed(2)}B`}function Qo(e,t,n){const r=(t??n)-e;if(r<1e3)return`${Math.max(0,r)}ms`;const s=Math.floor(r/1e3);if(s<60)return`${s}s`;const i=Math.floor(s/60),l=s%60;return`${i}m ${String(l).padStart(2,"0")}s`}function H2(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 p0(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 LN=["B","KB","MB","GB","TB"];function Na(e){if(e==null||!Number.isFinite(e)||e<0)return"—";if(e===0)return"0 B";let t=e,n=0;for(;n<LN.length-1&&Number(t.toFixed(1))>=1024;)t/=1024,n++;return`${t.toFixed(1)} ${LN[n]}`}const PN=2e5,Oq=1e6,Lq=[/\[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],Pq=[{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 Dq(e){if(!e)return PN;const t=ii(e);for(const n of Lq)if(n.test(t))return Oq;for(const n of Pq)if(n.match.test(t))return n.window;return PN}function W2(e,t){return typeof e=="number"&&e>0?e:Dq(t)}const Fq=1;function qq(){const e=[];let t=0;function n(){let r;for(const s of e)(!r||s.layer>r.layer||s.layer===r.layer&&s.seq>r.seq)&&(r=s);return r}return{push(r,s=0,i="dialog"){const l={dismiss:r,layer:s,kind:i,seq:t++};return e.push(l),()=>{const u=e.indexOf(l);u!==-1&&e.splice(u,1)}},dismissTop(){const r=n();return r?(r.dismiss(),!0):!1},isTop(r){const s=n();return s!=null&&s.dismiss===r},depth(){return e.length},dialogDepth(){return e.filter(r=>r.kind==="dialog").length}}}const hl=qq(),Bq=e=>e==="Escape";function Uq(e){return e.overlayOpen?"dismiss":e.typing?"blur":"clear-selection"}function DN(e){return String(e.tagName??"").toUpperCase()==="BODY"}function zq(e,t){return!e||!e.isConnected||DN(e)?!1:t==null||DN(t)}const FN="a[href], button, input, select, textarea, [tabindex]";function Hq(e){return!e||e.disabled||e.rendered===!1?!1:(e.tabIndex??0)>=0}function Wq(e){if(!e||!e.overflowing||e.hasFocusable)return!1;const t=String(e.overflow??"").toLowerCase();return t==="auto"||t==="scroll"}function Vq({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 _d(e){return e.ctrlKey||e.metaKey||e.altKey}const Gq=new Set(["button","checkbox","color","file","image","radio","range","reset","submit"]),Kq=new Set(["INPUT","TEXTAREA","SELECT","OPTION","BUTTON","SUMMARY","A"]),Yq=new Set(["button","checkbox","combobox","link","listbox","menu","menubar","menuitem","menuitemcheckbox","menuitemradio","option","radio","searchbox","slider","spinbutton","switch","tab","textbox","treeitem"]);function m0(e){return typeof e.tagName=="string"?e.tagName.toUpperCase():""}function Xq(e){return m0(e)==="BUTTON"?!0:(typeof e.role=="string"?e.role.trim().toLowerCase():"").split(/\s+/).includes("button")}function Ed(e){if(!e)return!1;if(e.isContentEditable)return!0;const t=m0(e);return t==="TEXTAREA"?!0:t!=="INPUT"?!1:!Gq.has(String(e.type??"text").toLowerCase())}function Zq(e,t){if(!e)return!1;if(Ed(e))return!0;if(t!=null&&t.length===1&&t!==" "&&e.pointerFocused&&Xq(e))return!1;if(Kq.has(m0(e)))return!0;const n=typeof e.role=="string"?e.role.trim().toLowerCase():"";return n!==""&&n.split(/\s+/).some(r=>Yq.has(r))}function Jq({key:e,modalOpen:t,sheetOpen:n}){return t?!(e==="?"&&n):!1}function Qq({appModal:e,dialogDepth:t}){return e||t>0}function V2(e){return e?Array.from(e.querySelectorAll("*")).filter(t=>{if(t.matches(FN))return Hq({disabled:t.disabled,tabIndex:t.tabIndex,rendered:t.getClientRects().length>0});const n=t.scrollHeight>t.clientHeight;return n&&Wq({overflowing:n,overflow:getComputedStyle(t).overflowY,hasFocusable:t.querySelector(FN)!=null})}):[]}function eB(e,t){const n=V2(e);if(!t||!e.contains(t)||n.includes(t))return n;const r=n.findIndex(s=>(t.compareDocumentPosition(s)&Node.DOCUMENT_POSITION_FOLLOWING)!==0);return r===-1?[...n,t]:[...n.slice(0,r),t,...n.slice(r)]}function mt(e,t={}){const{focusRef:n,layer:r,popover:s}=t,i=s?"popover":"dialog",l=v.useRef(null),u=v.useRef(e);u.current=e;const d=v.useRef(null);d.current===null&&(d.current=()=>u.current());const f=d.current;return v.useEffect(()=>hl.push(f,r,i),[f,r,i]),v.useEffect(()=>{var p;const h=document.activeElement;return(p=(n==null?void 0:n.current)??V2(l.current)[0])==null||p.focus(),()=>{zq(h,document.activeElement)&&h.focus()}},[]),v.useEffect(()=>{const h=p=>{var j;if(p.key!=="Tab"||_d(p))return;const g=l.current;if(!g)return;const w=document.activeElement;if(!(w!=null&&g.contains(w))&&!hl.isTop(f))return;const x=eB(g,w),b=Vq({count:x.length,index:w?x.indexOf(w):-1,shiftKey:p.shiftKey});b.kind!=="allow"&&(p.preventDefault(),b.kind==="focus"&&((j=x[b.index])==null||j.focus()))};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[f]),l}function tB(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 Mn(e){return e.toLocaleString()}const nB=60;function rB(e,t=nB){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 sB({agent:e,onClose:t}){var g;const n=v.useRef(null),r=mt(t,{focusRef:n}),s=e.context,i=e.usage,l=(s==null?void 0:s.currentContextTokens)??0,u=W2(e.contextWindow,e.model),d=Math.min(100,l/u*100),f=un(e),h=e.provider==="codex"?i.inputTokens+i.outputTokens:i.inputTokens+i.outputTokens+i.cacheReadTokens+i.cacheCreateTokens,p=tB(e.provider);return a.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:a.jsxs("div",{ref:r,className:"modal ctx-modal",onClick:w=>w.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Context breakdown",children:[a.jsxs("header",{className:"ctx-modal-head",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"ctx-modal-title",children:["Context · ",e.label]}),a.jsx("div",{className:"ctx-modal-sub",children:p.subtitle})]}),a.jsx("button",{type:"button",ref:n,className:"glyph-btn ctx-modal-close",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),a.jsxs("section",{className:"ctx-window-row",children:[a.jsx("div",{className:"ctx-window-bar",role:"progressbar","aria-label":"Context window used","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(d),children:a.jsx("div",{className:"ctx-window-fill",style:{transform:`scaleX(${Math.min(100,Math.max(0,d))/100})`}})}),a.jsxs("div",{className:"ctx-window-meta",children:[a.jsxs("span",{className:"ctx-window-pct",children:[d.toFixed(1),"%"]}),a.jsxs("span",{children:[Mn(l)," / ",Mn(u)," tok (",p.windowScope,")"]})]})]}),a.jsx("h3",{className:"ctx-section-title",children:"Cumulative usage · whole session"}),a.jsxs("div",{className:"ctx-grid",children:[a.jsx(Jn,{label:"input tokens",val:Mn(i.inputTokens)}),a.jsx(Jn,{label:"output tokens",val:Mn(i.outputTokens)}),a.jsx(Jn,{label:"cache reads",val:Mn(i.cacheReadTokens)}),a.jsx(Jn,{label:"cache writes",val:Mn(i.cacheCreateTokens)}),a.jsx(Jn,{label:"cumulative total",val:Mn(h)}),a.jsx(Jn,{label:"estimated cost",val:Be(f.total),accent:!0})]}),a.jsx("h3",{className:"ctx-section-title",children:"Transcript composition"}),p.compositionCounted?a.jsxs("div",{className:"ctx-grid",children:[a.jsx(Jn,{label:"user messages",val:Mn((s==null?void 0:s.msgsUser)??0)}),a.jsx(Jn,{label:"assistant messages",val:Mn((s==null?void 0:s.msgsAssistant)??0)}),a.jsx(Jn,{label:"tool uses",val:Mn((s==null?void 0:s.toolUses)??0)}),a.jsx(Jn,{label:"tool results",val:Mn((s==null?void 0:s.toolResults)??0)}),a.jsx(Jn,{label:"system-reminders",val:Mn((s==null?void 0:s.systemReminders)??0)})]}):a.jsx("div",{className:"ctx-empty",children:p.compositionUncounted}),a.jsx("h3",{className:"ctx-section-title",children:p.memoryHeading}),(((g=s==null?void 0:s.memoryFiles)==null?void 0:g.length)??0)===0?a.jsx("div",{className:"ctx-empty",children:p.memoryEmpty}):a.jsx("ul",{className:"ctx-md-list",children:s.memoryFiles.map(w=>a.jsxs("li",{children:[a.jsx("span",{className:"ctx-md-path",title:w.path,children:rB(w.path)}),a.jsx("span",{className:"ctx-md-size",children:Na(w.bytes)})]},w.path))})]})})}function Jn({label:e,val:t,accent:n}){return a.jsxs("div",{className:`ctx-row${n?" accent":""}`,children:[a.jsx("span",{className:"ctx-row-label",children:e}),a.jsx("span",{className:"ctx-row-val",children:t})]})}function aB({currentContextTokens:e,modelId:t,contextWindow:n,size:r=26,onClick:s}){const i=W2(n,t),l=Math.min(1,e/i),u=r/2-3,d=r/2,f=2*Math.PI*u,h=f*l,p=l>.9?"var(--err)":l>.7?"var(--warn)":"var(--accent)";return a.jsx("button",{type:"button",className:"ctx-donut",onClick:g=>{g.stopPropagation(),s==null||s()},title:`context: ${e.toLocaleString()} / ${i.toLocaleString()} (${(l*100).toFixed(1)}%)`,"aria-label":`Context ${Math.round(l*100)}% of ${i.toLocaleString()} tokens — show breakdown`,children:a.jsxs("svg",{width:r,height:r,viewBox:`0 0 ${r} ${r}`,"aria-hidden":"true",children:[a.jsx("circle",{cx:d,cy:d,r:u,stroke:"var(--line)",strokeWidth:"2.5",fill:"none"}),a.jsx("circle",{cx:d,cy:d,r:u,stroke:p,strokeWidth:"2.5",fill:"none",strokeDasharray:`${h} ${f-h}`,strokeDashoffset:f/4,strokeLinecap:"round",style:{transition:"var(--ctx-arc-transition)"}}),a.jsx("text",{x:d,y:d+3,textAnchor:"middle",fontSize:"8",fill:"var(--text)",fontWeight:"600",children:Math.round(l*100)})]})})}const qN=new Map;function G2(e){let t=qN.get(e);return t||(t={now:Date.now(),listeners:new Set,timer:null},qN.set(e,t)),t}function oB(e,t){const n=G2(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 iB(e){return G2(e).now}const BN=new Map,UN=new Map;function ui(e=1e3){let t=BN.get(e);t||(t=r=>oB(e,r),BN.set(e,t));let n=UN.get(e);return n||(n=()=>iB(e),UN.set(e,n)),v.useSyncExternalStore(t,n,n)}function Cd(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 lB="1",zN="agent-dag.schema",cB=["agent-dag.layout","agent-dag.viewport"];function Qe(e){if(typeof window>"u")return null;try{return window.localStorage.getItem(e)}catch{return null}}function Xe(e,t){if(!(typeof window>"u"))try{window.localStorage.setItem(e,t)}catch{}}function Zr(e){if(!(typeof window>"u"))try{window.localStorage.removeItem(e)}catch{}}function fl(){if(typeof window>"u")return null;try{return window.localStorage}catch{return null}}function uB(e,t=lB){let n=null;try{n=e.getItem(zN)}catch{return[]}if(n===t)return[];const r=[];if(n!==null)for(const s of cB)try{e.getItem(s)!==null&&(e.removeItem(s),r.push(s))}catch{}try{e.setItem(zN,t)}catch{}return r}const K2="agent-dag.recapsDismissed",HN=200;function dB(){const e=Qe(K2);if(!e)return[];try{const t=JSON.parse(e);return Array.isArray(t)?t.filter(n=>typeof n=="string"):[]}catch{return[]}}let ei=new Set(dB());const tx=new Set;let Y2=0;function X2(e){return tx.add(e),()=>{tx.delete(e)}}function Z2(e){ei=e,Y2++;const t=Array.from(e);Xe(K2,JSON.stringify(t.length>HN?t.slice(-HN):t));for(const n of tx)n()}function J2(e,t){return`${e}@${t}`}function hB(e){return ei.has(e)}function fB(e){if(ei.has(e))return;const t=new Set(ei);t.add(e),Z2(t)}function pB(e){const t=new Set(ei);t.delete(e)||t.add(e),Z2(t)}function mB(e){return v.useSyncExternalStore(X2,()=>e!=null&&ei.has(e),()=>!1)}function g0(e){return`recap:${e}`}function gB(e){return e.startsWith("recap:")}function yB(){return v.useSyncExternalStore(X2,()=>Y2,()=>0)}function wB(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 s of n.tools)s.ok===!1&&(r.failed+=1)}return t}function Q2(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 eM(e){return e.live>0?`→ ${e.total} · ${e.live} live`:`→ ${e.total} · done`}function vB(e,t,n){const r=e.kind==="root"?e.waiting:null;if(r&&lr(r))return{tone:"warn",long:n.sayWaiting(r),short:r.kind==="permission"?"Needs you":"Asked you"};if(r&&r.kind==="idle"){const i=n.sayWaiting(r);return{tone:"idle",long:i,short:i}}const s=e.tools.filter(i=>i.ok===!1).length;if(s>0)return{tone:"err",long:`${s} tool ${s===1?"call":"calls"} failed`,short:`${s} failed`};if(t&&t.total>0)return{tone:"muted",long:Q2(t),short:eM(t)};if(e.state==="active")for(let i=e.tools.length-1;i>=0;i--){const l=e.tools[i];if(l.endedAt!=null)continue;const{name:u,subject:d}=n.describeCall(l);return{tone:"muted",long:d?`${u} · ${d}`:u,short:u}}return null}function nx(e){return e==="active"?"live":e==="done"?"done":"err"}const Td={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"}},xB=Object.fromEntries(Object.entries(Td).map(([e,t])=>[e,t.category])),bB=Object.fromEntries(Object.entries(Td).map(([e,t])=>[e,t.emoji])),kB=Object.fromEntries(Object.entries(Td).map(([e,t])=>[e,t.label])),NB=new Set(Object.entries(Td).filter(([,e])=>e.shell).map(([e])=>e)),jB={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",...xB};function tM(e){return e.startsWith("mcp__")?"mcp":It(jB,e)??"other"}const SB=/\btools\.exec_command\s*\(\s*\{[^{}]*?\bcmd\s*:\s*(["'`])((?:\\.|(?!\1)[^\\])*)\1/,_B=/\btools\.([A-Za-z_$][\w$]*)\s*\(/;function EB(e){if(typeof e!="string"||!e)return null;const t=SB.exec(e);if(t){const r=CB(t[2]);if(r.trim())return r}const n=_B.exec(e);return n?n[1]:null}function CB(e){return e.replace(/\\(["'`\\nrt])/g,(t,n)=>n==="n"?`
|
|
65
|
-
`:n==="r"?"\r":n==="t"?" ":n)}const TB={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:"📡",...bB};function WN(e){return e.startsWith("mcp__")?"🔌":It(TB,e)??"✨"}const RB={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 nM(e){return/^-(?:Command|c)$/i.test(e)||/^-[a-z]+c$/.test(e)}function rM(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+-[A-Za-z]+)+)\s*["']([^"']+)["']/i);if(n&&n[1].trim().split(/\s+/).every(i=>nM(i)||/^-(?:NoProfile|NonInteractive)$/i.test(i)))return rM(n[2]);for(;;){const i=t.match(/^([A-Z_][A-Z0-9_]*=\S*)\s+/);if(!i)break;t=t.slice(i[0].length)}t=t.replace(/^sudo(?:\s+-\S+)*\s+/,""),t=t.replace(/^(?:time|nohup|xargs)\s+/,"");const r=t.match(/^([^\s|;&<>(]+)/);if(!r)return null;let s=r[1];return/^[A-Za-z0-9_][\w.+-]*$/.test(s.replace(/^.*[/\\]/,""))?(s=s.replace(/^.*[/\\]/,""),s=s.replace(/\.(exe|cmd|bat|ps1)$/i,""),s||null):null}function AB(e){if(typeof e=="string")return e;if(!e||typeof e!="object")return null;const t=e;if(typeof t.script=="string"){const n=EB(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(nM);if(r>=0&&r+1<n.length)return n[r+1]}return n.join(" ")}return typeof t.script=="string"?t.script:null}const MB=new Set(["Bash","PowerShell",...NB]);function $B(e,t){if(!MB.has(e))return null;const n=AB(t);if(!n)return null;const r=rM(n);return r?{emoji:It(RB,r)??"⚙️",label:r,category:"shell",detail:n}:null}const IB=new Set(["Read","Write","Edit","MultiEdit","NotebookEdit","LS","Glob","apply_patch"]),OB={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:"🗄️"},LB={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 PB(e){const n=e.replace(/\\/g,"/").replace(/\/+$/,""),r=n.lastIndexOf("/");return r>=0?n.slice(r+1):n}function DB(e){const t=e.toLowerCase(),n=It(LB,t);if(n!==void 0)return n;if(t.startsWith("dockerfile."))return"🐳";if(/\.(test|spec)\.[a-z]+$/.test(t))return"🧪";const r=t.lastIndexOf(".");if(r>0&&r<t.length-1){const s=It(OB,t.slice(r+1));if(s!==void 0)return s}return"📄"}function FB(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 qB(e,t){if(!IB.has(e))return null;const n=FB(e,t);if(!n)return null;const r=PB(n);return r?{emoji:e==="LS"?"📂":DB(r),label:r,category:"file",detail:n}:null}const BB={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 y0(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 UB(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 sM(e){return It(BB,e.toLowerCase())}function zB(e,t){const n=y0(e);if(!n)return null;const{server:r,method:s}=n;if(!s)return null;const i=sM(r);return{emoji:(i==null?void 0:i.emoji)??"🔌",label:s,category:"mcp",detail:i?`${i.name} · ${s}`:`${r} · ${s}`}}function aM(e,t){return $B(e,t)??qB(e,t)??zB(e)}function HB(e,t){var n;return((n=aM(e,t))==null?void 0:n.label)??null}const WB=kB,VN=18;function pu(e){const t=[...e];return t.length<=VN?e:t.slice(0,VN-1).join("")+"…"}const tp=13,VB=6;function GB(e,t){const n=[...e];if(n.length<=tp)return e;const r=n.lastIndexOf("."),s=r>0?n.slice(r):[];return t==="file"&&s.length>1&&s.length<=VB?n.slice(0,tp-1-s.length).join("")+"…"+s.join(""):n.slice(0,tp-1).join("")+"…"}function w0(e){const t=y0(e);if(t){const r=sM(t.server);return r?{emoji:r.emoji,label:pu(r.name)}:{emoji:"🔌",label:pu(t.server),hue:UB(t.server)}}const n=It(WB,e)??"";return n?{emoji:WN(e),label:pu(n)}:{emoji:WN(e),label:pu(e)}}function KB(e){let t=null,n="";for(const r of e){const s=y0(r);if(s){if(!s.server)return null;if(t===null)t=s.server,n=r;else if(s.server!==t)return null}}return t===null?null:w0(n)}const rx=6e4,Ho=24,GN=rx/Ho,np=132,$u=14;function YB(e,t,n){const r=new Array(Ho).fill(0);let s=0;const i=g=>{const w=n-g;if(w<0||w>=rx)return;const k=Ho-1-Math.floor(w/GN);k>=0&&k<Ho&&(r[k]+=1,s+=1)};for(const g of e)i(g.startedAt);for(const g of t??[])i(g);const u=Math.max(0,...r)/(GN/1e3),d=e.filter(g=>n-g.startedAt>=0&&n-g.startedAt<rx).length,f=s-d,h=[d>0?`${d} tool ${d===1?"call":"calls"}`:"",f>0?`${f} ${f===1?"block":"blocks"} of thinking and writing`:""].filter(Boolean),p=s===0?"nothing in the last 60s":`${h.join(" · ")} in last 60s · peak ${u.toFixed(1)}/s`;return{counts:r,title:p}}const XB=2;function ZB(e){return e===0?1.5:Math.max(1.5,Math.min(1,e/XB)*$u)}function oM({kind:e}){return a.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"&&a.jsx("circle",{cx:"5",cy:"5",r:"3.2",fill:"currentColor"}),e==="done"&&a.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"&&a.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 a.jsxs("svg",{className:"alert-mark",viewBox:"0 0 12 12",width:"12",height:"12","aria-hidden":"true",focusable:"false",children:[a.jsx("path",{d:"M6 1.4l4.7 8.3H1.3z",stroke:"currentColor",strokeWidth:"1.3",strokeLinejoin:"round",fill:"none"}),a.jsx("path",{d:"M6 4.6v2.4",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round"}),a.jsx("circle",{cx:"6",cy:"8.35",r:"0.72",fill:"currentColor"})]})}function El(){return a.jsxs("svg",{className:"recap-glyph",viewBox:"0 0 12 12",width:"10",height:"10","aria-hidden":"true",focusable:"false",children:[a.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"}),a.jsx("circle",{cx:"6",cy:"1.2",r:"1.05",fill:"currentColor"}),a.jsx("circle",{cx:"6",cy:"10.8",r:"1.05",fill:"currentColor"}),a.jsx("circle",{cx:"1.2",cy:"6",r:"1.05",fill:"currentColor"}),a.jsx("circle",{cx:"10.8",cy:"6",r:"1.05",fill:"currentColor"})]})}function JB({data:e,selected:t}){var j,S;const n=["agent-node",`state-${e.state}`,e.synthetic?"synthetic":"",t?"selected":""].filter(Boolean).join(" "),r=e.tools.filter(_=>!_.endedAt).length,s=e.tools.filter(_=>_.ok===!1).length,i=Zu(e.sessionId),l=((j=e.context)==null?void 0:j.currentContextTokens)??0,u=e.kind==="root"&&l>0,d=e.sessionTitle?e.cwd?`${e.cwd}
|
|
66
|
-
${e.sessionTitle}`:e.sessionTitle:e.cwd,f=U2(e),h=f.length>0?`${e.model}
|
|
67
|
-
spend on this card also covers:
|
|
68
|
-
${f.join(`
|
|
69
|
-
`)}`:e.model,p=p0(e.sessionName,e.sessionTitle),g=Cd(e),w=g?J2(e.sessionId,g.at):null,k=mB(w),x=g!=null&&!k,b=xq(e);return a.jsxs("div",{className:n,style:{"--session-hue":i},children:[a.jsx("span",{className:"accent-stripe"}),a.jsx(La,{type:"target",position:Te.Left,style:{background:"transparent",border:"none"}}),a.jsxs("div",{className:"head",children:[a.jsxs("div",{className:"title",children:[a.jsx(n8,{state:e.state}),a.jsx("span",{className:"label",title:d,children:e.label}),e.synthetic&&a.jsx("span",{className:"synth-tag",title:"No SessionStart captured — synthesised",children:"?"}),g&&w&&a.jsx("button",{type:"button",className:"glyph-btn recap-pin","aria-label":"Claude Code's recap","aria-expanded":x,title:x?"Hide the recap":"Show Claude Code's recap",onClick:_=>{_.stopPropagation(),pB(w)},children:a.jsx(El,{})})]}),a.jsxs("div",{className:"head-right",children:[u&&e.onOpenContext&&a.jsx(aB,{currentContextTokens:l,modelId:e.model,contextWindow:e.contextWindow,onClick:()=>e.onOpenContext(e.sessionId)}),a.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?"≥ ":"",a.jsx(t8,{start:e.startedAt,end:e.endedAt})]})]})]}),a.jsxs("div",{className:"sub",children:[e.kind==="root"?"session":"subagent",e.childCount>0&&a.jsxs("span",{className:"spawn-badge",title:Mq(e.childCount),children:["→ ",e.childCount]}),e.cwdBasename&&e.kind==="subagent"?` · ${e.cwdBasename}`:"",e.model?a.jsxs("span",{className:"model-chip","data-family":jd(e.model),title:h,children:[Ws(e.model),f.length>0?` +${f.length}`:""]}):e.provider==="codex"?a.jsx("span",{className:"model-chip",title:"OpenAI Codex — no model reported yet",children:"Codex"}):null]}),e.kind==="root"&&p.face&&a.jsx("div",{className:"session-name",title:p.tooltip,children:p.face}),e.waiting&&a.jsx(r8,{waiting:e.waiting}),(()=>{const _=Nq(e);return _?a.jsxs("div",{className:"approval-blind-row",title:_.detail,children:[a.jsx("span",{className:"approval-blind-dot","aria-hidden":!0}),a.jsx("span",{className:"approval-blind-said",children:_.label})]}):null})(),(e.tools.length>0||(((S=e.outputs)==null?void 0:S.length)??0)>0)&&a.jsx(s8,{tools:e.tools,outputs:e.outputs}),a.jsxs("div",{className:"meta",children:[a.jsxs("span",{children:[a.jsx("b",{children:e.toolCount})," ",e.toolCount===1?"tool":"tools"]}),s>0&&a.jsxs("span",{className:"failed-meta",title:`${s} tool ${s===1?"call":"calls"} returned an error`,children:[a.jsx("b",{children:s})," err"]}),r>0&&a.jsxs("span",{className:"inflight-meta",children:[a.jsx("b",{children:r})," in-flight"]}),e.usage.inputTokens+e.usage.outputTokens>0&&a.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:[a.jsx("b",{children:st(e.usage.inputTokens+e.usage.outputTokens)})," tok"]}),(b==null?void 0:b.kind)==="unpriced"&&a.jsx("span",{className:"cost-unpriced",title:b.tt,children:ts}),(b==null?void 0:b.kind)==="spent"&&a.jsx("span",{className:"cost-meta",title:b.tt,children:a.jsxs("b",{children:[Be(b.total),b.floor?"+":""]})})]}),a.jsx(e8,{data:e,title:e.kind==="root"?p.face:void 0}),a.jsx(La,{type:"source",position:Te.Right,style:{background:"transparent",border:"none"}})]})}const QB=v.memo(JB);function e8({data:e,title:t}){const n=e.kind==="root"&&lr(e.waiting),r=vB(e,e.branch,{sayWaiting:f0,describeCall:s=>({name:w0(s.name).label,subject:HB(s.name,s.input)})});return a.jsxs("div",{className:"lod-face","data-kind":e.kind,"data-alarm":n?"":void 0,"data-signal":r?"":void 0,"aria-hidden":!0,children:[a.jsxs("div",{className:"lod-id",children:[a.jsx(oM,{kind:nx(e.state)}),a.jsx("span",{className:"lod-name",children:e.label}),r&&a.jsx("span",{className:"lod-inline","data-tone":r.tone,children:r.short}),n&&a.jsx(v0,{})]}),t&&a.jsx("div",{className:"lod-title",children:t}),r&&a.jsxs("div",{className:"lod-signal","data-tone":r.tone,children:[a.jsx("span",{className:"lod-long",children:r.long}),a.jsx("span",{className:"lod-short",children:r.short})]})]})}function t8({start:e,end:t}){const n=ui(1e3);return a.jsx(a.Fragment,{children:Qo(e,t,n)})}function n8({state:e}){return a.jsx("span",{className:`state-pill state-${e}`,children:Zo(e)})}function r8({waiting:e}){const t=ui(1e3),n=lr(e),r=Jo(e);return a.jsxs("div",{className:n?"waiting-row permission":"waiting-row idle",title:`${r}
|
|
70
|
-
Blocked for ${Qo(e.since,void 0,t)} — the answer goes in the terminal, not here.`,children:[n?a.jsx("span",{className:"ap-pulse","aria-hidden":!0}):a.jsx("span",{className:"waiting-dot","aria-hidden":!0}),a.jsx("span",{className:"waiting-said",children:f0(e)}),a.jsx("b",{children:Qo(e.since,void 0,t)})]})}function s8({tools:e,outputs:t}){const n=ui(1e3),{counts:r,title:s}=YB(e,t,n),i=np/Ho;return a.jsxs("div",{className:"tool-spark-row",title:s,children:[a.jsx("svg",{className:"tool-spark",width:np,height:$u,viewBox:`0 0 ${np} ${$u}`,"aria-hidden":!0,children:r.map((l,u)=>{const d=ZB(l),f=u===Ho-1&&l>0,p=`tool-spark-bar${l>0?" active":""}${f?" latest":""}`;return a.jsx("rect",{x:u*i+.4,y:$u-d,width:Math.max(.5,i-1),height:d,rx:.8,className:p},f?`landed:${l}`:u)})}),a.jsx("span",{className:"tool-spark-label",children:"60s"})]})}function a8({enableAutoFitAndRefit:e}){return a.jsxs("div",{className:"autofit-chip",children:[a.jsx("span",{className:"autofit-state",title:"New sessions are not brought into view while you are moving it yourself",children:"Auto-fit off"}),a.jsx("button",{type:"button",className:"autofit-resume",onClick:e,title:"Bring new sessions into view again","aria-label":"Resume auto-fit",children:"Resume"})]})}function Ju(e){const t=Math.max(0,Math.floor(e));return`${t} event${t===1?"":"s"}`}const KN=99;function o8(e){const t=Math.max(0,Math.floor(e));return t>KN?`${KN}+`:String(t)}const i8="Pause the canvas";function l8(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 — ${Ju(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)":`${Ju(e.held)} arrived while paused and will be applied in order when you resume (Space)`}function c8(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 iM="paused · full",u8=(e,t)=>t>0?iM:e>0?`paused · ${o8(e)}`:"paused";function d8(e){const t=Math.max(0,Math.floor(e.dropped??0));return e.connected?e.paused?{tone:"paused",resting:!1,label:u8(e.held,t),widest:iM,title:t>0?`Connected — the pause is full at ${Ju(e.held)}; the oldest are being dropped as new ones arrive. Resume to catch up (Space)`:e.held>0?`Connected — ${Ju(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 h8=e=>e.transform[2]>=e.maxZoom,f8=e=>e.transform[2]<=e.minZoom;function p8({autoFitDisabled:e,enableAutoFitAndRefit:t,paused:n,pauseGate:r,togglePause:s,handleRelayout:i,requestClear:l,setKeyHelpOpen:u}){const d=oi(),f=Ke(h8),h=Ke(f8);return a.jsxs(KF,{showInteractive:!1,showFitView:!1,showZoom:!1,children:[a.jsx($n,{onClick:()=>{f||d.zoomIn()},title:"Zoom in","aria-label":"Zoom in","aria-disabled":f||void 0,children:a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:a.jsx("path",{d:"M12 5v14M5 12h14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})})}),a.jsx($n,{onClick:()=>{h||d.zoomOut()},title:"Zoom out","aria-label":"Zoom out","aria-disabled":h||void 0,children:a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:a.jsx("path",{d:"M5 12h14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})})}),a.jsx($n,{onClick:t,title:e?"Recenter view + re-enable autofit":"Recenter view (autofit already on)","aria-label":"Recenter view","data-nudge":e?"":void 0,children:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[a.jsx("circle",{cx:"12",cy:"12",r:"3.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),a.jsx("path",{d:"M12 2v4M12 18v4M2 12h4M18 12h4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})]})}),a.jsx($n,{"data-group-start":"",onClick:s,title:l8({paused:n,held:r.size,dropped:r.dropped}),"aria-label":i8,"aria-pressed":n,children:a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:a.jsx("path",{d:"M9 5.5v13M15 5.5v13",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})})}),a.jsx($n,{onClick:i,title:"Auto-arrange — clear pins (R)","aria-label":"Re-arrange the canvas",children:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[a.jsx("rect",{x:"8.5",y:"2",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),a.jsx("rect",{x:"1.5",y:"17",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),a.jsx("rect",{x:"15.5",y:"17",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),a.jsx("path",{d:"M12 7v6.5M5 17v-3.5h14V17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]})}),a.jsx($n,{"data-group-start":"","data-danger":"",onClick:()=>l("button"),title:"Clear the canvas and the server's event log — asks first (C)","aria-label":"Clear the canvas",children:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[a.jsx("path",{d:"M4 6.2h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"}),a.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"}),a.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"}),a.jsx("path",{d:"M10.3 10.6v6.8M13.7 10.6v6.8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})]})}),a.jsx($n,{"data-group-start":"",onClick:()=>u(p=>!p),title:"Keyboard shortcuts (?)","aria-label":"Open the keyboard shortcuts","aria-haspopup":"dialog",children:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[a.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"}),a.jsx("path",{d:"M12 18.4v.2",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",fill:"none"})]})})]})}const Aa=148,YN=6e3,m8=16e3,lM=46,Us=34;function g8(e,t,n=Aa){let r=-Math.round(t()*n);if(Math.abs(r-e)<Us){const s=e-Us>=-n?-Us:Us;r=Math.max(-n,Math.min(0,Math.round(e+s)))}return{to:r,ms:Math.round(Math.abs(r-e)*lM)}}function y8(e){return Math.round(YN+e()*(m8-YN))}const XN=[{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 w8(e){const t=XN.reduce((r,s)=>r+s.weight,0);let n=e()*t;for(const r of XN)if(n-=r.weight,n<0)return r.kind;return"stroll"}const v8=720,x8=260,b8=620,k8=220,ZN=520,cM=1600,JN=7e3,N8=15e3,QN=6e3,j8=14e3;function _o(e,t,n=Aa){let r=-Math.round(t()*n);if(Math.abs(r-e)<Us){const s=e-Us>=-n?-Us:Us;r=Math.max(-n,Math.min(0,Math.round(e+s)))}return r}const Tt=(e,t)=>Math.round(Math.abs(t-e)*lM),S8=120,mu=0;function _8(e,t){const n=r=>({kind:"litter",at:t,...r});return[{x:t,prop:n({}),act:"walk",ms:Tt(e,t)},{x:t,prop:n({}),act:"stoop",ms:v8},{x:mu,prop:n({held:!0}),act:"carry",ms:Tt(t,mu)},{x:mu,prop:n({held:!0}),act:"windup",ms:x8},{x:mu,prop:n({held:!0,leaving:!0}),act:"toss",ms:b8}]}function E8(e,t){const n=t>e?1:-1,r=t-n*Math.min(15,Math.abs(t-e)),s=(i={})=>({kind:"ball",at:t,...i});return[{x:r,prop:s(),act:"walk",ms:Tt(e,r)},{x:r,prop:s(),act:"windup",ms:k8,facing:n>0?"right":"left"},{x:r,prop:s({leaving:!0}),act:"kick",ms:ZN,facing:n>0?"right":"left"},{x:r,prop:s({leaving:!0}),act:"stand",ms:cM-ZN}]}const uM=640;function C8(e,t,n){const r=Math.max(-70,Math.min(-20,t)),s={x:r,prop:null,facing:"left"};return[{x:r,prop:null,act:"walk",ms:Tt(e,r)},{...s,act:"sit",ms:600},{...s,act:"cast",ms:900},{...s,act:"fish",ms:6e3+Math.round(n()*4e3)},{...s,act:"reel",ms:1200},{...s,act:"stow",ms:500},{...s,act:"stand",ms:400},{x:0,prop:null,act:"walk",ms:Tt(r,0)}]}function T8(e,t,n){const r=Math.max(-110,Math.min(-30,t)),s={x:r,prop:null};return[{...s,act:"walk",ms:Tt(e,r)},{...s,act:"skip-ready",ms:500},{...s,act:"skip",ms:uM*(6+Math.floor(n()*5))},{...s,act:"skip-rest",ms:600},{...s,act:"stand",ms:350},{x:0,prop:null,act:"walk",ms:Tt(r,0)}]}function R8(e,t,n){return[{x:t,prop:null,act:"walk",ms:Tt(e,t)},{x:t,prop:null,act:"sit",ms:Math.round(QN+n()*(j8-QN))},{x:t,prop:null,act:"stand",ms:400}]}function A8(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:Tt(e,t)},{x:t,prop:r(),act:"watch",ms:Math.round(JN+n()*(N8-JN))},{x:t,prop:r(),act:"scope-pack",ms:480},{x:t,prop:null,act:"stand",ms:240}]}function rp(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 M8=1500,$8=e=>Math.round(1e3*Math.sqrt(2*e/M8)),I8=115,O8=e=>Math.round(e/I8*1e3),L8=620,P8=200,D8=760,F8=600,q8=240;function B8(e,t,n){const s=-(t.ledgeSpan??Aa),i=$8(t.ledgeH),l=O8(t.ledgeH),u=n(),d=n(),f=-Math.round(u*t.floorSpan),h=-Math.round(d*t.floorSpan);return[{x:s,act:"walk",prop:null,ms:Tt(e,s)},{x:s,act:"peer",prop:null,ms:L8},{x:s,act:"fall",prop:null,ms:i,place:"floor"},{x:s,act:"land",prop:null,ms:P8,place:"floor"},{x:f,act:"walk",prop:null,ms:Tt(s,f),place:"floor",floorFrac:u},{x:h,act:"walk",prop:null,ms:Tt(f,h),place:"floor",floorFrac:d},{x:s,act:"walk",prop:null,ms:Tt(h,s),place:"floor"},{x:s,act:"lasso",prop:null,ms:D8,place:"floor"},{x:s,act:"rope-throw",prop:null,ms:F8,place:"floor"},{x:s,act:"rope-catch",prop:null,ms:q8,place:"floor"},{x:s,act:"climb",prop:null,ms:l},{x:s,act:"pull-up",prop:null,ms:480}]}function U8(e,t,n){const r=(n==null?void 0:n.ledgeSpan)??Aa;switch(w8(t)){case"tidy":return _8(e,_o(e,t,r));case"kick":return E8(e,_o(e,t,r));case"sit":return R8(e,_o(e,t,r),t);case"watch":return A8(e,_o(e,t,r),t);case"fish":return C8(e,_o(e,t,r),t);case"skip":return T8(e,_o(e,t,r),t);case"leave":{if(!n||!(n.ledgeH>0)||!(n.floorSpan>0))break;return B8(e,n,t)}}const i=g8(e,t,r);return[{x:i.to,prop:null,act:"walk",ms:i.ms}]}const z8=420;function H8(e,t,n){const r=t==="right"?n-e-18:e-18;return(t==="right"?1:-1)*Math.min(z8,Math.max(0,r))}const W8=260,V8=200;function G8(e,t,n){const r=(h,p=Tt(e,h))=>({x:h,prop:null,act:"walk",ms:p,place:"floor"});if(!n||n.height<=0)return[r(t)];const s=Math.min(e,t);if(Math.max(e,t)<=n.left||s>=n.right)return[r(t)];const l=t>e,u=l?n.left:n.right,d=l?n.right:n.left,f={place:"floor",riser:n.height,prop:null};return[r(u,Tt(e,u)),{...f,x:u,act:"mount",ms:W8},{...f,x:d,act:"walk",ms:Tt(u,d)},{x:d,prop:null,act:"dismount",ms:V8,place:"floor"},{x:t,prop:null,act:"walk",ms:Tt(d,t),place:"floor"}]}const dM=["bob","sway","groove"],ej=9e3,K8=16e3,hM=1e3,Y8=.08;function X8(e,t){const n=dM.filter(i=>i!==e),r=n[Math.min(n.length-1,Math.floor(t()*n.length))],s=(t()*2-1)*Y8;return{dance:r,beatMs:Math.round(hM*(1+s))}}function Z8(e){return Math.round(ej+e()*(K8-ej))}const fM=["......aaaaaa......","....aa......aa....","...a..bbbbbs..a...","...cpcbbbbbscpc...","...cpcbebbescpc...","...cpcbbbbbscpc...","...cpcbbbbbscpc...","....ccbbbbbscc....","....bbbbbbbbbs....","....bbbbbbbbbs....","......bbbbbs......","......bb..bs......","......bb..bs......","......bb..bs......"],tj=18,J8=fM.length,pM=new Set(["a","c","p"]);function Rd(e=fM){const t=[];return e.forEach((n,r)=>{let s=0;for(;s<n.length;){const i=n[s];if(i==="."){s+=1;continue}let l=1;for(;s+l<n.length&&n[s+l]===i;)l+=1;t.push({x:s,y:r,w:l,cell:i}),s+=l}}),t}const Q8=[".xx.","xxxx",".xx."],eU=["..xx..",".xsxx.","xssxxx","xxxxsx",".xxxx.","..xx.."],tU=["...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."],sp={litter:Q8,ball:eU,scope:tU},nU=["...hhhhhh...","...hhhhhh...","...kkkkkk...","hhhhhhhhhhhh"],rU=3,sU=-1,sx=11,nj=9,ax="https://www.youtube-nocookie.com";function aU(e,t,n){const r=new URLSearchParams({...n?{}:{channel:e},enablejsapi:"1",autoplay:"1",playsinline:"1",rel:"0",modestbranding:"1",origin:t});return`${ax}/embed/${n?encodeURIComponent(n):"live_stream"}?${r.toString()}`}function Eo(e,t=[]){return JSON.stringify({event:"command",func:e,args:t})}function oU(e="claude-fm"){return JSON.stringify({event:"listening",id:e,channel:"widget"})}const iU=[1,3],lU=[0,2],cU=[2,5,100,101,150];function uU(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 s=typeof r=="number"?r:Number(r==null?void 0:r.errorCode);return Number.isFinite(s)?{kind:"error",code:s}:null}if(n==="onStateChange"||n==="infoDelivery"){const s=typeof r=="number"?r:r==null?void 0:r.playerState;return typeof s!="number"||!Number.isFinite(s)?null:iU.includes(s)?{kind:"playing",playing:!0}:lU.includes(s)?{kind:"playing",playing:!1}:null}return null}const dU="modulepreload",hU=function(e){return"/"+e},rj={},x0=function(t,n,r){let s=Promise.resolve();if(n&&n.length>0){let l=function(f){return Promise.all(f.map(h=>Promise.resolve(h).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};document.getElementsByTagName("link");const u=document.querySelector("meta[property=csp-nonce]"),d=(u==null?void 0:u.nonce)||(u==null?void 0:u.getAttribute("nonce"));s=l(n.map(f=>{if(f=hU(f),f in rj)return;rj[f]=!0;const h=f.endsWith(".css"),p=h?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${p}`))return;const g=document.createElement("link");if(g.rel=h?"stylesheet":dU,h||(g.as="script"),g.crossOrigin="",g.href=f,d&&g.setAttribute("nonce",d),document.head.appendChild(g),h)return new Promise((w,k)=>{g.addEventListener("load",w),g.addEventListener("error",()=>k(new Error(`Unable to preload CSS for ${f}`)))})}))}function i(l){const u=new Event("vite:preloadError",{cancelable:!0});if(u.payload=l,window.dispatchEvent(u),!u.defaultPrevented)throw l}return s.then(l=>{for(const u of l||[])u.status==="rejected"&&i(u.reason);return t().catch(i)})},fU={"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 pU({fetchImpl:e,volume:t,muted:n,source:r,playRequest:s,customStation:i,onAvailabilityChange:l}){const[u,d]=v.useState(null),[f,h]=v.useState(!1),[p,g]=v.useState(!1),[w,k]=v.useState(!1),x=v.useRef(s),b=v.useRef(null),j=v.useRef(null),S=v.useRef(null),_=v.useCallback(()=>{var q;(q=j.current)==null||q.destroy(),j.current=null;const I=b.current;I&&(I.pause(),I.removeAttribute("src"),I.load(),b.current=null)},[]),E=v.useCallback(I=>{var q,P;(P=(q=S.current)==null?void 0:q.contentWindow)==null||P.postMessage(I,ax)},[]),T=v.useRef(t);T.current=t;const R=v.useRef(n);R.current=n;const A=v.useCallback((I,q,P)=>{_();const O=new Audio;O.preload="none",O.volume=T.current/100,O.muted=R.current,b.current=O,g(!0),k(!0);const V=()=>b.current===O,$=()=>{_(),g(!1),k(!1)},M=()=>{V()&&($(),h(!0),l==null||l(P,!0))},L=Y=>{if(V()){if(Y instanceof DOMException&&Y.name==="NotAllowedError"){$();return}M()}};O.addEventListener("playing",()=>{V()&&(k(!0),l==null||l(P,!1))}),O.addEventListener("ended",()=>{V()&&$()}),O.addEventListener("error",M,{once:!0}),q&&!O.canPlayType("application/vnd.apple.mpegurl")?x0(async()=>{const{default:Y}=await import("./hls-BFpXDghs.js");return{default:Y}},[]).then(({default:Y})=>{if(!V())return;if(!Y.isSupported()){M();return}const K=new Y;j.current=K,K.on(Y.Events.ERROR,(D,z)=>{z.fatal&&M()}),K.on(Y.Events.MEDIA_ATTACHED,()=>K.loadSource(I)),K.on(Y.Events.MANIFEST_PARSED,()=>{O.play().catch(L)}),K.attachMedia(O)},M):(O.src=I,O.play().catch(L))},[l,_]);return v.useEffect(()=>{p&&(E(Eo("setVolume",[t])),E(Eo(n?"mute":"unMute")),b.current&&(b.current.volume=t/100,b.current.muted=n))},[t,n,p,E]),v.useEffect(()=>{let I=!0;const q=e??fetch,P=x.current!==s;x.current=s,d(null),h(!1),g(P),k(P),_();const O=i&&Pa(i.id)===r?i0(i.url):null;if(O)return O.kind==="direct-audio"?(d({live:!0,channel:"",audio:O.url,hls:O.format==="hls"}),l==null||l(r,!1),P&&A(O.url,O.format==="hls",r),()=>{I=!1}):(q(`/api/fm-station?url=${encodeURIComponent(O.url)}`).then(M=>M.ok?M.json():null).then(M=>{I&&(M!=null&&M.channel||M!=null&&M.video?(d({live:!0,channel:M.channel??"",video:M.video??void 0}),l==null||l(r,!1)):(h(!0),l==null||l(r,!0)))}).catch(()=>{I&&(h(!0),l==null||l(r,!0))}),()=>{I=!1});if(Xo(r))return h(!0),l==null||l(r,!0),()=>{I=!1};const V=r,$=fU[V];if($)q($).then(M=>M.ok?M.json():null).then(M=>{I&&(M!=null&&M.video&&d({live:!0,channel:"",video:M.video}),l==null||l(r,!(M!=null&&M.video)))}).catch(()=>{I&&(l==null||l(r,!0))});else if(V!=="claude-fm"){const M=V.replace("lofi-","");q(`/api/lofi-girl?station=${encodeURIComponent(M)}`).then(L=>L.ok?L.json():null).then(L=>{I&&(L!=null&&L.video&&d({live:!0,channel:"",video:L.video}),l==null||l(r,!(L!=null&&L.video)))}).catch(()=>{I&&(l==null||l(r,!0))})}else q("/api/claude-fm").then(M=>M.ok?M.json():null).then(M=>{if(!I)return;const L=!!(M!=null&&M.live&&(M!=null&&M.channel));L&&d({live:!0,channel:M.channel}),l==null||l(r,!L)}).catch(()=>{I&&(l==null||l(r,!0))});return()=>{I=!1}},[i==null?void 0:i.id,i==null?void 0:i.url,e,l,s,r,A,_]),v.useEffect(()=>()=>_(),[_]),v.useEffect(()=>{if(!p)return;const I=q=>{var O;if(q.origin!==ax||q.source!==((O=S.current)==null?void 0:O.contentWindow))return;const P=uU(q.data);if(P){if(P.kind==="ready"){E(Eo("setVolume",[T.current])),E(Eo(n?"mute":"unMute")),E(Eo("playVideo"));return}if(P.kind==="playing"){k(P.playing);return}cU.includes(P.code)&&(g(!1),k(!1),h(!0),l==null||l(r,!0))}};return window.addEventListener("message",I),()=>window.removeEventListener("message",I)},[p,n,l,E,r]),{probe:u,dead:f,armed:p,playing:w,frame:S,say:E,press:()=>{if(!u)return;if(u.audio){if(p){_(),g(!1),k(!1);return}A(u.audio,u.hls===!0,r);return}if(!p){g(!0),k(!0);return}const I=!w;k(I),E(Eo(I?"playVideo":"pauseVideo")),I||g(!1)}}}function sj(e){let t=null,n=null,r=0,s=0,i=!1;const l=()=>{t!==null&&clearTimeout(t),t=null},u=()=>{i||e.hidden||!n||t!==null||(s=performance.now(),t=setTimeout(()=>{t=null;const f=n;n=null,f==null||f()},r))},d=()=>{e.hidden&&t!==null?(r=Math.max(0,r-(performance.now()-s)),l()):e.hidden||u()};return e.addEventListener("visibilitychange",d),{schedule(f,h){i||(l(),n=f,r=Math.max(0,h),u())},dispose(){i=!0,l(),n=null,e.removeEventListener("visibilitychange",d)}}}function mU(e,t,n){const[r,s]=v.useState(0),[i,l]=v.useState(0),[u,d]=v.useState(null),[f,h]=v.useState(null),[p,g]=v.useState({x:0,drop:0}),[w,k]=v.useState("ledge"),[x,b]=v.useState("left"),[j,S]=v.useState(0),_=v.useRef(null),[E,T]=v.useState(()=>document.hidden);v.useEffect(()=>{const O=new Set,V=()=>{var $;if(document.hidden){for(const M of(($=_.current)==null?void 0:$.getAnimations({subtree:!0}))??[])if(M.playState==="running"||M.pending){const L=M.currentTime;M.pause(),L!==null&&(M.currentTime=L),O.add(M)}}else{for(const M of O)M.playState==="paused"&&M.play();O.clear()}T(document.hidden)};return V(),document.addEventListener("visibilitychange",V),()=>document.removeEventListener("visibilitychange",V)},[e,t]);const[R,A]=v.useState(null),[U,I]=v.useState(hM),[q,P]=v.useState(()=>{var O;return((O=window.matchMedia)==null?void 0:O.call(window,"(prefers-reduced-motion: reduce)").matches)??!1});return v.useEffect(()=>{var $;const O=($=window.matchMedia)==null?void 0:$.call(window,"(prefers-reduced-motion: reduce)");if(!O)return;const V=()=>P(O.matches);return V(),O.addEventListener("change",V),()=>O.removeEventListener("change",V)},[]),v.useEffect(()=>{var X;if(!e||t||q)return;const O=sj(document);let V=0;s(Z=>V=Z);let $=null,M=0,L=0;const Y=Z=>{var fe,de;const[ee,...re]=Z;if(!ee){$=null,d(null),h(null),J();return}d(ee.act),h(ee.prop),k(ee.place??"ledge"),S(ee.riser??0);const ce=V,ie=F(ee);if(ee.act==="kick"){const we=(de=(fe=_.current)==null?void 0:fe.querySelector('.fm-prop[data-prop="ball"]'))==null?void 0:de.getBoundingClientRect();we&&g({x:H8(we.x,rp(ee,ce,"left"),window.innerWidth),drop:Math.max(48,window.innerHeight-we.y+24)})}L=ee.act==="walk"?Math.max(Tt(ce,ie),S8):ee.ms,ee.act==="carry"&&(L=Tt(ce,ie)),l(L),b(we=>rp({...ee,x:ie},ce,we)),s(ie),V=ie,$=ee,M=Date.now(),O.schedule(()=>Y(re),L)},K=()=>{const Z=_.current,ee=Z==null?void 0:Z.querySelector(".fm-sprite"),re=Z==null?void 0:Z.parentElement;if(!Z||!ee||!re)return null;const ce=Z.getBoundingClientRect(),ie=re.getBoundingClientRect(),fe=ie.right-ce.right,de=ie.width-fe*2-ee.offsetWidth;return de>0?de:null},D=()=>{const Z=_.current,ee=Z==null?void 0:Z.querySelector(".fm-walker"),re=K();if(!Z||!ee||re==null)return;const ce=Z.getBoundingClientRect().bottom-ee.getBoundingClientRect().bottom;if(ce>0)return{ledgeH:ce,floorSpan:re}},z=()=>{const Z=_.current,ee=document.querySelector(".autofit-chip");if(!Z||!ee)return null;const re=Z.getBoundingClientRect(),ce=ee.getBoundingClientRect();return ce.width<=0||ce.height<=0?null:{left:ce.left-re.right,right:ce.right-re.right,height:ce.height}},F=Z=>{const ee=(Z.place??"ledge")==="floor",re=ee?K()??Aa:Aa,ce=ee&&Z.floorFrac!=null?-Math.round(Z.floorFrac*re):Z.x;return Math.max(-re,Math.min(0,ce))},H=()=>{if(!$)return;const Z=F($);Z!==V&&(l(Math.max(0,M+L-Date.now())),b(ee=>rp({...$,x:Z},V,ee)),s(Z),V=Z)},J=()=>{O.schedule(()=>{const Z=U8(V,Math.random,D()),ee=Z.some(ie=>ie.place==="floor")?z():null;let re=V;const ce=Z.flatMap(ie=>{const fe=re;if(re=ie.x,!(ie.place==="floor"&&ie.act==="walk"))return[ie];const de=G8(fe,ie.x,ee),we=de.length-1;return ie.floorFrac==null?de:de.map((xe,$e)=>$e===we?{...xe,floorFrac:ie.floorFrac}:xe)});Y(ce)},y8(Math.random))},W=(X=_.current)==null?void 0:X.parentElement,G=typeof ResizeObserver>"u"?null:new ResizeObserver(H);return W&&G&&G.observe(W),J(),()=>{O.dispose(),G==null||G.disconnect(),k("ledge"),s(Z=>Math.max(-Aa,Math.min(0,Z))),l(0),d(null),h(null),S(0)}},[e,t,q]),v.useEffect(()=>{if(!n||q){A(null);return}const O=sj(document),V=$=>{const M=X8($,Math.random);A(M.dance),I(M.beatMs),O.schedule(()=>V(M.dance),Z8(Math.random))};return V(null),()=>O.dispose()},[n,q]),{scene:_,suspended:E,x:r,walkMs:i,act:u,prop:f,ballFlight:p,place:w,facing:x,riser:j,dance:R,beatMs:U}}const ap={e:"fm-eye",s:"fm-shade",p:"fm-pad"},Qu=Rd().filter(e=>!pM.has(e.cell)),gU=Rd().filter(e=>pM.has(e.cell)),aj=Qu.filter(e=>e.cell==="e"),yU=Rd(nU),wU=Qu.filter(e=>e.y<sx&&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),vU={left:Qu.filter(e=>e.y>=sx&&e.x<nj),right:Qu.filter(e=>e.y>=sx&&e.x>=nj)},xU=v.memo(function({act:t,facing:n}){return a.jsxs("svg",{viewBox:`0 0 ${tj} ${J8}`,shapeRendering:"crispEdges","aria-hidden":!0,children:[a.jsx("g",{className:"fm-gear",children:a.jsx("g",{className:"fm-gear-motion",children:gU.map(r=>a.jsx("rect",{x:r.x,y:r.y,width:r.w,height:1,className:ap[r.cell]},`g${r.y}-${r.x}`))})}),a.jsxs("g",{className:"fm-body",children:[aj.map(r=>a.jsx("rect",{x:r.x,y:r.y,width:r.w,height:1,fill:"var(--accent)"},`eye-bed-${r.x}`)),wU.map(r=>a.jsx("rect",{x:r.x,y:r.y,width:r.w,height:1,className:ap[r.cell]},`b${r.y}-${r.x}`)),a.jsxs("g",{className:"fm-arms",children:[a.jsx("rect",{x:4,y:8,width:2,height:2}),a.jsx("rect",{x:12,y:8,width:1,height:2}),a.jsx("rect",{x:13,y:8,width:1,height:2,className:"fm-shade"})]}),aj.map(r=>a.jsx("rect",{x:r.x-(r.x>=tj/2?1:0)+(n==="right"?1:0),y:r.y,width:r.w,height:1,className:"fm-eye"},`eye-${r.x}`))]}),a.jsx("g",{className:"fm-hat",children:yU.map(r=>a.jsx("rect",{x:rU+r.x,y:sU+r.y,width:r.w,height:1,className:r.cell==="k"?"fm-hatband":void 0},`h${r.y}-${r.x}`))}),(t==="climb"||t==="rope-throw"||t==="rope-catch"||t==="pull-up")&&a.jsxs("g",{className:"fm-grip",children:[a.jsx("path",{className:"fm-grip-left",d:"M5 9H4V4H7V3H9V5H6V9Z"}),a.jsx("path",{className:"fm-grip-right",d:"M12 9H14V6H11V5H9V7H12Z"})]}),(t==="land"||t==="dismount")&&a.jsxs("g",{className:"fm-crouch-legs",children:[a.jsx("path",{d:"M6 11H8V13H6Z"}),a.jsx("path",{d:"M10 11H12V13H10Z"})]}),["sit","cast","fish","reel","stow"].includes(t)&&a.jsxs("g",{className:"fm-seated-legs",children:[a.jsx("path",{className:"fm-seated-far",d:"M10 10H12V11H11V14H8V13H9V11H10Z"}),a.jsx("path",{d:"M6 10H9V11H7V15H4V14H5V11H6Z"})]}),["left","right"].map(r=>a.jsx("g",{className:"fm-leg","data-side":r,children:vU[r].map(s=>a.jsx("rect",{x:s.x,y:s.y,width:s.w,height:1,className:ap[s.cell]},`${r}${s.y}-${s.x}`))},r))]})}),bU={"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"};function kU(e,t){return t&&Pa(t.id)===e?t.name:Xo(e)?"Custom FM":bU[e]}function op(e,t){var r;const n=((r=e[0])==null?void 0:r.length)??0;return a.jsx("svg",{viewBox:`0 0 ${n} ${e.length}`,shapeRendering:"crispEdges","aria-hidden":!0,children:Rd(e).map(s=>a.jsx("rect",{x:s.x,y:s.y,width:s.w,height:1,fill:s.cell==="s"?"var(--fm-prop-shadow, var(--bg))":s.cell==="l"?"var(--fm-prop-light, var(--text))":s.cell==="a"?"var(--accent)":void 0},`${t}${s.y}-${s.x}`))})}const oj={litter:op(sp.litter,"litter"),ball:op(sp.ball,"ball"),scope:op(sp.scope,"scope")};function NU(e){try{return new URL(e).host}catch{return"the station's server"}}const jU=v.memo(function({fetchImpl:t,volume:n,muted:r=!1,source:s="claude-fm",playRequest:i=0,customStation:l,onAvailabilityChange:u}){const{probe:d,dead:f,armed:h,playing:p,frame:g,say:w,press:k}=pU({fetchImpl:t,volume:n,muted:r,source:s,playRequest:i,customStation:l,onAvailabilityChange:u}),{scene:x,suspended:b,x:j,walkMs:S,act:_,prop:E,ballFlight:T,place:R,facing:A,riser:U,dance:I,beatMs:q}=mU(d,f,p);if(!d||f)return null;const P=kU(s,l),O=d.audio?NU(d.audio):"YouTube";return a.jsxs("div",{ref:x,className:"fm","data-suspended":b?"":void 0,"data-place":R,style:{"--fm-beat":`${q}ms`},children:[E&&!E.held&&a.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":`${cM}ms`,"--fm-ball-turn":A==="right"?"1080deg":"-1080deg"},children:oj[E.kind]}),(_==="lasso"||_==="rope-throw"||_==="rope-catch"||_==="climb"||_==="pull-up")&&a.jsxs("div",{className:"fm-rope","data-act":_,style:{"--fm-rope-x":`${j}px`,"--fm-rope-ms":`${S}ms`},children:[a.jsx("div",{className:"fm-rope-line"}),a.jsxs("svg",{className:"fm-rope-hook",viewBox:"0 0 9 9",shapeRendering:"crispEdges","aria-hidden":!0,children:[a.jsx("path",{d:"M4 8V3H3V1H1V3H0V5H2V4H3V6H5V4H6V5H8V3H7V1H5V3H4"}),a.jsx("rect",{className:"fm-rope-knot",x:"3",y:"6",width:"3",height:"2"})]})]}),a.jsxs("div",{className:"fm-walker","data-act":_??void 0,"data-place":R,"data-facing":A,style:{"--fm-x":`${j}px`,"--fm-walk-ms":`${S}ms`,"--fm-riser":`${U}px`,"--fm-skip-beat":`${uM}ms`},children:[(E==null?void 0:E.held)&&a.jsx("div",{className:"fm-held","data-prop":E.kind,"data-toss":E.leaving?"":void 0,children:oj[E.kind]}),["cast","fish","reel","stow"].includes(_)&&a.jsxs("svg",{className:"fm-fishing",viewBox:"0 0 24 32",shapeRendering:"crispEdges","aria-hidden":!0,children:[a.jsxs("g",{children:[a.jsx("path",{d:"M24 11H22V9H20V7H18V5H16V3H13V2H8"}),a.jsx("rect",{className:"fm-fishing-grip",x:"21",y:"9",width:"3",height:"3"})]}),a.jsxs("g",{className:"fm-fishing-line",children:[a.jsx("path",{d:"M8 2V26"}),a.jsxs("g",{className:"fm-float",children:[a.jsx("rect",{x:"7",y:"25",width:"3",height:"2"}),a.jsx("rect",{x:"8",y:"24",width:"1",height:"1"})]})]}),a.jsx("path",{className:"fm-ripple",d:"M3 28H6M10 28H14M5 30H12"})]}),["skip-ready","skip","skip-rest"].includes(_)&&a.jsxs("svg",{className:"fm-skipping-rope",viewBox:"0 0 26 26",shapeRendering:"crispEdges","aria-hidden":!0,children:[a.jsx("path",{className:"fm-skip-back",d:"M5 18H3V8H5V5H8V2H18V5H21V8H23V18H21"}),a.jsx("path",{className:"fm-skip-forward",d:"M5 18H3V14H5V11H8V9H18V11H21V14H23V18H21"}),a.jsx("path",{className:"fm-skip-front",d:"M5 18H3V21H5V23H8V25H18V23H21V21H23V18H21"}),a.jsx("path",{className:"fm-skip-return",d:"M5 18H3V19H8V20H18V19H23V18H21"}),a.jsx("path",{className:"fm-skip-handles",d:"M5 17V19M21 17V19"})]}),a.jsx("button",{type:"button",className:"fm-sprite","data-playing":p?"":void 0,"data-dance":p?I??dM[0]:void 0,onClick:k,title:p?`Stop ${P}`:`Play ${P} — streams from ${O}`,"aria-label":p?`Stop ${P}`:`Play ${P}`,children:a.jsx(xU,{act:_,facing:A})})]}),h&&!d.audio&&(d.channel||d.video)&&a.jsx("iframe",{ref:g,className:"fm-frame",title:P,src:aU(d.channel,window.location.origin,d.video),onLoad:()=>w(oU()),allow:"autoplay; encrypted-media",sandbox:"allow-scripts allow-same-origin allow-presentation"})]})});function mM(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 ed(e){return mM(Math.floor(e/1e3))}function Ad(e,t){const n=e-t;if(n<=0)return null;const r=Math.floor(n/86400),s=Math.floor(n%86400/3600),i=Math.floor(n%3600/60);return r>0?`${r}d ${s}h`:s>0?`${s}h ${i}m`:`${i}m`}function SU(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function td(e,t,n){const r=new Date(e),s=ed(t-e);return{label:SU(r,new Date(t))?s:`${s} · ${r.toLocaleDateString(n,{month:"short",day:"numeric"})}`,title:r.toLocaleString(n,{dateStyle:"medium",timeStyle:"medium"})}}function _U({data:e}){const t=ui(3e4),n=td(e.recap.at,t);return a.jsxs("div",{className:"recap-note",role:"note","aria-label":"Claude Code's recap",style:{"--session-hue":e.hue},children:[a.jsxs("div",{className:"recap-note-head",children:[a.jsxs("span",{className:"recap-note-mark",children:[a.jsx(El,{}),"recap"]}),a.jsx("span",{className:"recap-note-age",title:n.title,children:n.label}),a.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(),fB(e.noteKey)},children:"×"})]}),a.jsx("p",{className:"recap-note-text",children:e.recap.text}),a.jsxs("div",{className:"lod-face recap-face","aria-hidden":!0,children:[a.jsxs("div",{className:"lod-id",children:[a.jsxs("span",{className:"recap-note-mark",children:[a.jsx(El,{}),"recap"]}),a.jsx("span",{className:"recap-face-age",children:n.label})]}),a.jsx("p",{className:"recap-face-text",children:e.recap.text})]}),a.jsx(La,{type:"source",position:Te.Right,style:{background:"transparent",border:"none"}})]})}function EU({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:s,targetPosition:i,style:l}){const[u]=e0({sourceX:e,sourceY:t,sourcePosition:s,targetX:n,targetY:r,targetPosition:i,curvature:.35});return a.jsxs("g",{className:"recap-tie",style:l,children:[a.jsx("path",{className:"recap-tie-thread",d:u}),a.jsx("path",{className:"recap-tie-beads",d:u}),a.jsx("circle",{className:"recap-tie-end",cx:e,cy:t,r:3.5}),a.jsx("circle",{className:"recap-tie-end",cx:n,cy:r,r:3.5})]})}function ox(e){return e.replace(/[^a-zA-Z0-9]/g,"")}function b0(e,t){const n=ox(e);return n?n.slice(-t):e.slice(-t)}function gM(e,t,n=4){const r=ox(e);if(!r)return b0(e,n);let s=n;for(const i of t){if(i===e)continue;const l=ox(i);let u=0;for(;u<r.length&&u<l.length&&r[r.length-1-u]===l[l.length-1-u];)u++;s=Math.max(s,u+1)}return r.slice(-s)}const Iu=" · ",CU=32,TU=/[\u1100-\u115F\u2E80-\u303E\u3041-\u33FF\u3400-\u4DBF\u4E00-\u9FFF\uA000-\uA4CF\uAC00-\uD7A3\uF900-\uFAFF\uFE30-\uFE6F\uFF00-\uFF60\uFFE0-\uFFE6]/;function ij(e){return TU.test(e)?2:1}function lj(e,t=CU){const n=[...e];let r=0;for(const l of n)r+=ij(l);if(r<=t)return e;const s=[];let i=0;for(const l of n){const u=ij(l);if(i+u>t-1)break;s.push(l),i+=u}for(;s.length&&/[\s\-_.:/]/.test(s[s.length-1]);)s.pop();return`${s.join("")}…`}function RU(e,t,n,r,s=[]){const i=(t==null?void 0:t.trim())??"",l=r?gM(n,s):void 0,u=[e,i||void 0,l].filter(Boolean);return{label:lj(e),name:i?lj(i):void 0,shortId:l,fullLabel:u.join(Iu)}}const Ca=18,ix=26,yM=12,AU=240;function MU(e,t){return(e+AU)*(t||1)}function $U(e,t){return{position:"absolute",left:0,top:0,transform:`translate(${e.x}px, ${e.y}px)`,width:e.w,height:e.h,"--session-hue":t}}function IU(e,t,n){return{position:"absolute",left:e.x+16,top:e.y-yM/(t||1),transform:`scale(${1/(t||1)})`,transformOrigin:"left top",maxWidth:MU(e.w,t),"--session-hue":n}}function OU(e){const t=new Map;for(const s of e){if(s.type!=="agent"&&s.type!=="recapNote")continue;const i=s.data;if(!(i!=null&&i.sessionId)||i.exitAt!=null||s.width==null||s.height==null)continue;const l=s.position.x,u=s.position.y,d=l+s.width,f=u+s.height,h=t.get(i.sessionId),p=LU(i);h?(h.minX=Math.min(h.minX,l),h.minY=Math.min(h.minY,u),h.maxX=Math.max(h.maxX,d),h.maxY=Math.max(h.maxY,f),p&&(h.label=p.label??h.label,h.name=p.name,h.alarm=p.alarm,h.branch=p.branch)):t.set(i.sessionId,{minX:l,minY:u,maxX:d,maxY:f,label:(p==null?void 0:p.label)??i.sessionId,name:p==null?void 0:p.name,alarm:(p==null?void 0:p.alarm)??!1,branch:p==null?void 0:p.branch})}const n=new Map;for(const[s,i]of t){const l=n.get(i.label);l?l.push(s):n.set(i.label,[s])}const r=[];for(const[s,i]of t){const l=n.get(i.label)??[],u=l.length>1;r.push({sessionId:s,...RU(i.label,i.name,s,u,l),x:i.minX-Ca,y:i.minY-Ca-ix,w:i.maxX-i.minX+Ca*2,h:i.maxY-i.minY+Ca*2+ix,...i.alarm?{alarm:!0}:null,...i.branch?{branch:i.branch}:null})}return r}function LU(e){if(e.kind!=="root")return null;const t=e.branch;return{label:e.label,name:p0(e.sessionName,e.sessionTitle).face,alarm:lr(e.waiting),branch:t&&t.total>0?eM(t):void 0}}function PU(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){const r=e[n],s=t[n];if(r.sessionId!==s.sessionId||r.label!==s.label||r.name!==s.name||r.shortId!==s.shortId||r.alarm!==s.alarm||r.branch!==s.branch||r.fullLabel!==s.fullLabel||r.x!==s.x||r.y!==s.y||r.w!==s.w||r.h!==s.h)return!1}return!0}function DU(e){return OU(e.nodeInternals.values())}function FU({onFocusSession:e}){const{x:t,y:n,zoom:r}=f2(),s=Ke(DU,PU);if(s.length<=1)return null;const i=u=>{try{e==null||e(u)}catch{}},l={transform:`translate(${t}px, ${n}px) scale(${r})`};return a.jsx("div",{className:"session-clusters",style:l,children:s.map(u=>{const d=Zu(u.sessionId),f=$U(u,d),h=IU(u,r,d);return a.jsxs(ue.Fragment,{children:[a.jsx("div",{className:"cluster-card",style:f,"aria-hidden":!0}),a.jsxs("button",{type:"button",className:"cluster-label","data-alarm":u.alarm?"":void 0,style:h,title:`${u.alarm?`Waiting on you
|
|
71
|
-
`:""}Zoom to ${u.fullLabel}
|
|
72
|
-
drag the wrapper to move the whole session`,onClick:()=>i(u.sessionId),children:[u.alarm?a.jsxs(a.Fragment,{children:[a.jsx(v0,{}),a.jsx("span",{className:"cluster-label-said",children:"waiting on you: "})]}):null,u.label,u.branch?a.jsx("span",{className:"cluster-label-branch",children:Iu+u.branch}):null,u.name?a.jsx("span",{className:"cluster-label-name",children:Iu+u.name}):null,u.shortId?a.jsx("span",{className:"cluster-label-id",children:Iu+u.shortId}):null]})]},u.sessionId)})})}function qU({data:e}){return a.jsx("div",{className:"session-group-handle",style:{width:(e==null?void 0:e.w)??0,height:(e==null?void 0:e.h)??0}})}const wM=600,BU=4,UU=36,lx=16,zU=60,HU=6,cj=220,WU=96,VU=28;function GU(e,t){return Math.max(WU,61+[...t].length*6.8)}function KU(e){return e.endedAt==null?"inflight":e.ok===!1?"err":"done"}function YU(e,t){if(t==null)return 1;const n=e-t;return n<0?1:Math.max(0,1-n/wM)}function XU(e,t){const n=[],r=new Set;for(let s=e.length-1;s>=0&&n.length<t;s--){const i=e[s];r.has(i.id)||(r.add(i.id),n.push(i))}return n.reverse()}function ZU(e,t,n,r,s,i){const l=[];for(const u of e.values()){if(!t.has(u.id)||u.exitAt!=null&&i-u.exitAt>wM)continue;const d=r.get(u.id)??n.get(u.id);if(!d)continue;const f=XU(u.tools,BU);if(f.length===0)continue;const h=u.exitAt??null,p=s.get(u.id),g=Math.max((p==null?void 0:p.width)??cj,cj),w=(p==null?void 0:p.height)??130,k=d.x,x=d.y,b=k+g,j=x+w/2;f.forEach((S,_)=>{const E=_*UU,T=k+g+zU,R=x+HU+E,A=YU(i,h),U=S.inputPreview??"",I=KU(S),q=A<.999,P=w0(S.name);l.push({id:`${u.id}::${S.id}`,toolId:S.id,agentId:u.id,toolName:S.name,name:P.label,emoji:P.emoji,status:I,category:tM(S.name),mcpHue:P.hue,inputPreview:U,fade:A,fading:q,worldX:T,worldY:R,anchorX:b,anchorY:j,spawnDx:b-T,spawnDy:j-(R+lx)});const O=aM(S.name,S.input);if(O){const V=GU(S.name,P.label),$=T+V+VU,M=R,L=T+V,Y=R+lx;l.push({id:`sub:${u.id}::${S.id}`,toolId:S.id,agentId:u.id,toolName:S.name,name:GB(O.label,O.category),fullName:O.label,emoji:O.emoji,isSub:!0,status:I,category:O.category,inputPreview:O.detail??U,fade:A,fading:q,worldX:$,worldY:M,anchorX:L,anchorY:Y,spawnDx:L-$,spawnDy:0})}})}return l}function JU({agents:e,visibleAgentIds:t,positions:n,pinned:r,measured:s,spotlight:i,hiddenCategories:l,now:u,onOpenTool:d}){const f=ZU(e,t,n,r,s,u),h=l&&l.size>0?f.filter(p=>!l.has(p.category)):f;return a.jsx(QU,{bursts:h,spotlight:i,onOpenTool:d})}function QU({bursts:e,spotlight:t,onOpenTool:n}){const{x:r,y:s,zoom:i}=f2();return a.jsxs("div",{className:"tool-bursts-layer","aria-hidden":!0,children:[a.jsx("svg",{className:"tool-bursts-svg",children:e.map(l=>{const u=l.anchorX*i+r,d=l.anchorY*i+s,f=(l.worldX+6)*i+r,h=(l.worldY+lx)*i+s,p=Math.max(1,f-u),g=Math.min(1,Math.abs(h-d)/p),w=u+p*(.55-.22*g),k=t!=null&&!t.has(l.agentId),x=l.fade*(k?.14:1);return a.jsx("path",{d:`M ${u} ${d} Q ${w} ${d}, ${f} ${h}`,className:`tool-conn status-${l.status}${l.fading?" fading":""}`,opacity:x},`l:${l.id}`)})}),e.map(l=>a.jsx(tz,{b:l,x:r,y:s,zoom:i,dim:t!=null&&!t.has(l.agentId),onOpenTool:n},l.id))]})}function ez(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.fullName===r.fullName&&n.toolName===r.toolName&&n.inputPreview===r.inputPreview}const tz=v.memo(function({b:t,x:n,y:r,zoom:s,dim:i,onOpenTool:l}){const u=t.worldX*s+n,d=t.worldY*s+r,f={left:`${u}px`,top:`${d}px`,transform:`scale(${s})`,transformOrigin:"left top","--spawn-dx":`${t.spawnDx}px`,"--spawn-dy":`${t.spawnDy}px`},h=t.isSub?`${t.toolName} · ${t.fullName??t.name}`:t.toolName,p=t.inputPreview?`${h} · ${t.inputPreview}`:h,g=l!=null,w=t.mcpHue!=null?{"--mcp-hue":t.mcpHue}:{},k=i?" dim":"";return a.jsx("div",{className:"tool-burst-wrap",style:f,children:a.jsxs("div",{className:`tool-burst cat-${t.category}${t.mcpHue!=null?" mcp-hue":""} status-${t.status}${t.fading?" fading":""}${g?" clickable":""}${t.isSub?" sub":""}${k}`,style:w,title:p,onClick:g?()=>l(t.agentId,t.toolId):void 0,children:[a.jsx("span",{className:"tb-emoji",children:t.emoji}),a.jsx("span",{className:"tb-name",children:t.name}),t.status==="inflight"&&a.jsx("span",{className:"tb-spin"}),t.status==="done"&&a.jsx("span",{className:"tb-mark done",children:"✓"}),t.status==="err"&&a.jsx("span",{className:"tb-mark err",children:"×"})]})})},ez),nz={agent:QB,sessionGroup:qU,recapNote:_U},rz={recapTie:EU},uj=400;function sz({graph:e,layout:t,viewport:n,clicks:r,drag:s,appearance:i,fm:l,autoFit:u,pause:d,stateRef:f,measuredRef:h,hiddenCats:p,now:g,openTool:w,focusAgent:k,requestClear:x,setKeyHelpOpen:b}){const{allNodes:j,edges:S,visibleAgentIds:_,spotlightSet:E}=e,{positionsRef:T,pinnedRef:R,handleRelayout:A}=t,{restoredViewport:U,onMoveStart:I,onMove:q}=n,{onNodeClick:P,onPaneClick:O,onNodeDoubleClick:V,onNodeMouseEnter:$,onNodeMouseLeave:M}=r,{onNodeDragStart:L,onNodeDrag:Y,onNodeDragStop:K}=s,{palette:D,minimapNodeFill:z,characterEnabled:F}=i,{fmVolume:H,fmMuted:J,fmSource:W,fmPlayRequest:G,customFmStations:X,markFmStationAvailability:Z}=l,{autoFitDisabled:ee,enableAutoFitAndRefit:re}=u,{paused:ce,pauseGate:ie,togglePause:fe}=d;return a.jsxs(h2,{nodes:j,edges:S,nodeTypes:nz,edgesFocusable:!1,edgeTypes:rz,fitView:!U,fitViewOptions:{padding:.25,duration:Qv({durationMs:uj,documentHidden:document.hidden})?uj:0},minZoom:v2,maxZoom:x2,panOnScroll:!0,nodesDraggable:!0,nodesConnectable:!1,selectionOnDrag:!1,nodeDragThreshold:5,disableKeyboardA11y:!0,deleteKeyCode:null,onNodeClick:P,onPaneClick:O,onNodeDoubleClick:V,onNodeMouseEnter:$,onNodeMouseLeave:M,onMoveStart:I,onMove:q,onNodeDragStart:L,onNodeDrag:Y,onNodeDragStop:K,children:[a.jsx(e6,{gap:28,size:1,color:D["--grid-line"]}),a.jsx(FU,{onFocusSession:k}),a.jsx(JU,{agents:f.current.agents,visibleAgentIds:_,positions:T.current,pinned:R.current,measured:h.current,spotlight:E,hiddenCategories:p,now:g,onOpenTool:w}),ee&&a.jsx(a8,{enableAutoFitAndRefit:re}),a.jsx(p8,{autoFitDisabled:ee,enableAutoFitAndRefit:re,paused:ce,pauseGate:ie,togglePause:fe,handleRelayout:A,requestClear:x,setKeyHelpOpen:b}),a.jsx(BF,{zoomable:!0,pannable:!0,nodeColor:z,nodeStrokeWidth:2,maskColor:D["--minimap-mask"],maskStrokeColor:D["--line"]}),F&&a.jsx(jU,{volume:H,muted:J,source:W,playRequest:G,customStation:X.find(de=>Pa(de.id)===W),onAvailabilityChange:Z})]})}function az(e){const t={input:0,output:0,cacheRead:0,cacheWrite:0,total:0};let n=0,r=0,s=0,i=0;for(const l of e){const u=un(l);t.input+=u.input,t.output+=u.output,t.cacheRead+=u.cacheRead,t.cacheWrite+=u.cacheWrite,t.total+=u.total,n+=l.usage.inputTokens,r+=l.usage.outputTokens,s+=l.usage.cacheReadTokens,i+=l.usage.cacheCreateTokens}return{cost:t,inputTokens:n,outputTokens:r,cacheReadTokens:s,cacheCreateTokens:i,sum:n+r}}const oz="spend on this board",iz="on this board",dj=`Everything on the board right now, and only that.
|
|
73
|
-
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.
|
|
74
|
-
Press H for the totals ccusage reads off the logs on disk, which do not forget.`,vM="session spend",cx="__unknown__",lz=12;function cz(e,t=Date.now()){const n=new Map;for(const r of e)for(const s of zl(r)){const i=s.model??cx,l=zo(s.usage,s.model,t),u=n.get(i);u?(u.inputTokens+=s.usage.inputTokens,u.outputTokens+=s.usage.outputTokens,u.cacheReadTokens+=s.usage.cacheReadTokens,u.cacheCreateTokens+=s.usage.cacheCreateTokens,u.cost.total+=l.total,u.cost.input+=l.input,u.cost.output+=l.output,u.cost.cacheRead+=l.cacheRead,u.cost.cacheWrite+=l.cacheWrite,u.agentCount++):n.set(i,{model:i,inputTokens:s.usage.inputTokens,outputTokens:s.usage.outputTokens,cacheReadTokens:s.usage.cacheReadTokens,cacheCreateTokens:s.usage.cacheCreateTokens,cost:{...l},agentCount:1,priced:qa(s.model,t)!=null})}return Array.from(n.values()).sort((r,s)=>s.cost.total-r.cost.total||s.inputTokens+s.outputTokens-(r.inputTokens+r.outputTokens))}function uz(e,t=Date.now()){const n=[...e],r=[];for(const s of n){if(s.kind!=="root")continue;let i=un(s,t).total,l=s.usage.inputTokens,u=s.usage.outputTokens,d=_l(s,t);for(const f of n)f.sessionId!==s.sessionId||f.kind==="root"||(i+=un(f,t).total,l+=f.usage.inputTokens,u+=f.usage.outputTokens,d+=_l(f,t));r.push({sessionId:s.sessionId,label:s.label||s.cwdBasename||"session",state:s.state,cost:i,inputTokens:l,outputTokens:u,unpricedTokens:d})}return r.sort((s,i)=>i.cost-s.cost||i.inputTokens+i.outputTokens-(s.inputTokens+s.outputTokens)).slice(0,lz)}function hj(e){return e.waiting?lr(e.waiting)?0:1:e.state==="active"?2:3}function dz(e,t){const n=[];for(const r of e.agents.values()){if(r.kind!=="root")continue;let s=r.toolCount,i=un(r).total,l=r.endedAt??r.startedAt;for(const u of e.agents.values()){if(u.sessionId!==r.sessionId||u.kind==="root")continue;s+=u.toolCount,i+=un(u).total;const d=u.endedAt??u.startedAt;d>l&&(l=d)}n.push({sessionId:r.sessionId,label:r.label||r.cwdBasename||"session",cwdBasename:r.cwdBasename,state:r.state,waiting:r.waiting,recap:Cd(r),modelId:r.model,toolCount:s,cost:i,startedAt:r.startedAt,lastActivity:l})}return n.sort((r,s)=>{const i=hj(r),l=hj(s);return i!==l?i-l:r.waiting&&s.waiting?r.waiting.since-s.waiting.since:s.lastActivity-r.lastActivity}),n}function fj(e,t,n){const r=(t??n)-e;if(r<1e3)return"<1s";const s=Math.floor(r/1e3);if(s<60)return`${s}s`;const i=Math.floor(s/60);return i<60?`${i}m`:`${Math.floor(i/60)}h ${i%60}m`}function hz({state:e,now:t,selectedIds:n,onSelect:r,onClose:s,removedIds:i,onBringBackAll:l}){const u=v.useMemo(()=>dz(e),[e,e.revision,t]),d=u.filter(h=>h.state==="active").length,f=u.filter(h=>lr(h.waiting)).length;return a.jsxs("aside",{className:"session-list",id:"session-list","aria-label":"Sessions",children:[a.jsxs("div",{className:"sl-header",children:[a.jsxs("h2",{children:["Sessions ",a.jsx("span",{className:"sl-count",children:u.length})]}),f>0&&a.jsxs("span",{className:"sl-waiting-count",children:[f," waiting"]}),d>0&&a.jsxs("span",{className:"sl-live-count",children:[d," live"]}),a.jsx("button",{className:"glyph-btn sl-close",onClick:s,title:"Hide sidebar (L)","aria-label":"Hide session list",children:"‹"})]}),a.jsxs("ul",{className:"sl-rows",children:[u.length===0&&a.jsx("li",{className:"sl-empty",children:"No sessions yet."}),u.map(h=>{const p=n.has(h.sessionId),g=(i==null?void 0:i.has(h.sessionId))??!1;return a.jsx("li",{className:"sl-row-item",children:a.jsxs("button",{type:"button",className:`sl-row state-${h.state}${p?" selected":""}${g?" removed":""}`,"aria-current":p?"true":void 0,onClick:()=>r(h.sessionId),title:g?`Bring ${h.label} back to the board`:`Focus ${h.label}`,children:[a.jsx("span",{className:`sl-dot state-${h.state}`,"aria-hidden":!0}),a.jsx("span",{className:"vis-hidden",children:Zo(h.state)}),a.jsxs("div",{className:"sl-row-body",children:[a.jsxs("div",{className:"sl-row-head",children:[a.jsx("span",{className:"sl-label",children:h.label}),g&&a.jsx("span",{className:"sl-removed",children:"off the board"}),h.modelId&&a.jsx("span",{className:"model-chip","data-family":jd(h.modelId),title:h.modelId,children:Ws(h.modelId)})]}),a.jsxs("div",{className:"sl-row-meta",children:[a.jsxs("span",{title:"tool calls",children:[a.jsx("b",{children:h.toolCount})," ",h.toolCount===1?"tool":"tools"]}),h.cost>0&&a.jsx("span",{className:"sl-cost",title:vM,children:a.jsx("b",{children:Be(h.cost)})}),h.waiting?a.jsxs("span",{className:"sl-waiting",title:[Jo(h.waiting),Iq(h.waiting,Jo(h.waiting)),`Blocked since ${new Date(h.waiting.since).toLocaleTimeString()} · started ${new Date(h.startedAt).toLocaleString()}`].filter(Boolean).join(`
|
|
75
|
-
`),children:["waiting ",fj(h.waiting.since,void 0,t),h.waiting.tool&&a.jsxs("span",{className:"sl-waiting-tool",children:[" · ",h.waiting.tool.name]})]}):a.jsx("span",{className:"sl-elapsed",title:`Started ${new Date(h.startedAt).toLocaleString()}`,children:fj(h.startedAt,h.state==="active"?void 0:h.lastActivity,t)})]}),h.recap&&a.jsxs("span",{className:"sl-recap",title:h.recap.text,children:[a.jsx(El,{}),h.recap.text]})]})]})},h.sessionId)})]}),(()=>{const h=(i==null?void 0:i.size)??0;return h===0||!l?null:a.jsx("div",{className:"sl-foot",children:a.jsxs("button",{type:"button",className:"btn sl-bring-back",onClick:p=>{const g=p.currentTarget.closest(".session-list");l(),requestAnimationFrame(()=>{var w;return(w=g==null?void 0:g.querySelector(".sl-row"))==null?void 0:w.focus()})},children:["Bring back ",h," removed ",h===1?"card":"cards"]})})})()]})}const ux={cost:0,inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0,sessions:0};function fz(e){if(!e.synthetic)return!1;const t=e.usage;return t.inputTokens+t.outputTokens+t.cacheReadTokens+t.cacheCreateTokens<=0}function dx(e,t){const n=new Map;for(const r of e){if(r.kind!=="root"||!r.sessionId||fz(r))continue;const s=un(r,t);n.set(r.sessionId,{cost:s.total,inputTokens:r.usage.inputTokens,outputTokens:r.usage.outputTokens,cacheReadTokens:r.usage.cacheReadTokens,cacheCreateTokens:r.usage.cacheCreateTokens})}return n}function pz(e,t){if(!e)return ux;const n={...ux};for(const[r,s]of t){const i=e.get(r);if(!i)continue;const l={cost:s.cost-i.cost,inputTokens:s.inputTokens-i.inputTokens,outputTokens:s.outputTokens-i.outputTokens,cacheReadTokens:s.cacheReadTokens-i.cacheReadTokens,cacheCreateTokens:s.cacheCreateTokens-i.cacheCreateTokens};l.cost<0||l.inputTokens<0||l.outputTokens<0||l.cost===0&&l.inputTokens===0&&l.outputTokens===0&&l.cacheReadTokens===0&&l.cacheCreateTokens===0||(n.cost+=l.cost,n.inputTokens+=Math.max(0,l.inputTokens),n.outputTokens+=Math.max(0,l.outputTokens),n.cacheReadTokens+=Math.max(0,l.cacheReadTokens),n.cacheCreateTokens+=Math.max(0,l.cacheCreateTokens),n.sessions+=1)}return n}function hx(e,t=new Date){return new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate()-(e-1))).toISOString().slice(0,10).replace(/-/g,"")}const Md=[{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 mz(e,t,n=Md.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 xM(e,t=new Date){return e==="today"?hx(1,t):e==="month"?hx(t.getDate(),t):"20200101"}const on=e=>typeof e=="number"&&Number.isFinite(e)?e:0,Ou=e=>typeof e=="string"?e:"";function bM(e){const t=Array.isArray(e==null?void 0:e.days)?e.days:[],n=new Map;for(const r of t){const s=Array.isArray(r==null?void 0:r.modelBreakdowns)?r.modelBreakdowns:[];for(const i of s){const l=Ou(i==null?void 0:i.modelName);if(!l)continue;let u=n.get(l);u||(u={model:l,cost:0,inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0,get tokens(){return this.inputTokens+this.outputTokens+this.cacheReadTokens+this.cacheCreateTokens}},n.set(l,u)),u.cost+=on(i==null?void 0:i.cost),u.inputTokens+=on(i==null?void 0:i.inputTokens),u.outputTokens+=on(i==null?void 0:i.outputTokens),u.cacheReadTokens+=on(i==null?void 0:i.cacheReadTokens),u.cacheCreateTokens+=on(i==null?void 0:i.cacheCreationTokens)}}return[...n.values()].sort((r,s)=>s.cost-r.cost||s.tokens-r.tokens)}const gz=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function yz(e){var t;return((t=gz.exec(e))==null?void 0:t[0])??e}function wz(e,t=new Map){const n=Array.isArray(e==null?void 0:e.sessions)?e.sessions:[],r=[];for(const s of n){const i=Ou(s==null?void 0:s.period);if(!i)continue;const l=yz(i),u=s==null?void 0:s.metadata,d=typeof(u==null?void 0:u.lastActivity)=="string"?Date.parse(u.lastActivity):NaN;r.push({sessionId:l,label:t.get(l)??null,agent:Ou(s==null?void 0:s.agent)||"claude",cost:on(s==null?void 0:s.totalCost),tokens:on(s==null?void 0:s.totalTokens),models:Array.isArray(s==null?void 0:s.modelsUsed)?s.modelsUsed.map(Ou).filter(Boolean):[],lastActivityMs:Number.isFinite(d)?d:null})}return r.sort((s,i)=>i.cost-s.cost||i.tokens-s.tokens)}function vz(e,t=$d(e).cost){const r=(Array.isArray(e==null?void 0:e.sessions)?e.sessions:[]).reduce((i,l)=>i+on(l==null?void 0:l.totalCost),0),s=Math.max(.01,t*.01);return{sum:r,total:t,over:r>t+s}}function xz(e,t,n){const r=`Sessions with activity ${e}, and what ccusage puts against each one.`;return t.over?`${r}
|
|
76
|
-
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 $d(e){const t=e==null?void 0:e.totals;if(t&&typeof t=="object"){const d=on(t.cacheReadTokens),f=on(t.cacheCreationTokens),h=on(t.inputTokens),p=on(t.outputTokens);return{cost:on(t.totalCost),inputTokens:h,outputTokens:p,cacheReadTokens:d,cacheCreateTokens:f,tokens:on(t.totalTokens)||h+p+d+f}}const n=bM(e),r=d=>n.reduce((f,h)=>f+d(h),0),s=r(d=>d.inputTokens),i=r(d=>d.outputTokens),l=r(d=>d.cacheReadTokens),u=r(d=>d.cacheCreateTokens);return{cost:r(d=>d.cost),inputTokens:s,outputTokens:i,cacheReadTokens:l,cacheCreateTokens:u,tokens:s+i+l+u}}function bz(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 kM(e,t){var n;return((n=Md.find(r=>r.key===(e??t)))==null?void 0:n.noun)??"today"}function kz(e,t,n){const r=e!=null,s=$d(e);return{fromRange:r,cost:r?s.cost+n.cost:t.cost.total,inputTokens:r?s.inputTokens+n.inputTokens:t.inputTokens,outputTokens:r?s.outputTokens+n.outputTokens:t.outputTokens,cacheReadTokens:r?s.cacheReadTokens+n.cacheReadTokens:t.cacheReadTokens,cacheCreateTokens:r?s.cacheCreateTokens+n.cacheCreateTokens:t.cacheCreateTokens,hasCost:r?s.cost>0:t.cost.total>0,tokenSum:r?s.tokens:t.sum,showCostBar:!r}}const NM="agent-dag.usagePeriod";function Nz(){const e=Qe(NM);return Md.some(t=>t.key===e)?e:"today"}function jz(e){Xe(NM,e)}const jM="agent-dag.usageSessionsOpen";function Sz(){return Qe(jM)==="1"}function _z(e){Xe(jM,e?"1":"0")}function k0({cost:e,size:t="md"}){const n=e.total;if(n<=0)return null;const r=(i,l,u)=>{if(i<=0)return null;const d=i/n*100;return a.jsx("span",{className:`cb-seg ${l}`,style:{width:`${d}%`},title:`${u}: ${Be(i)} (${d.toFixed(0)}%)`},l)},s=t==="lg";return a.jsxs("div",{className:s?"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")]})}const vt="ccdeck";function SM(e,t){const n=t.nextExpiryAt!=null?` · expires ${new Date(t.nextExpiryAt).toLocaleDateString("en-US",{month:"short",day:"numeric"})}`:"";return`${t.availableCount} ${e}${t.availableCount!==1?"s":""} available${n}`}function Ez({incidents:e}){return a.jsx(a.Fragment,{children:e.map(t=>a.jsxs("a",{className:t.stale?"provider-incident provider-incident-stale":"provider-incident","data-state":t.state,href:t.href,target:"_blank",rel:"noopener noreferrer",title:t.detail,children:[a.jsx("span",{className:"pi-dot","aria-hidden":!0}),a.jsx("span",{className:"pi-name",children:t.name}),a.jsxs("span",{className:"pi-words",children:["· ",t.chipWords]}),a.jsxs("span",{className:"pi-short",children:["· ",t.shortWords]}),t.asOf&&a.jsxs("span",{className:"pi-asof",children:["· as of ",t.asOf]}),a.jsx("span",{className:"pi-go","aria-hidden":!0,children:"↗"}),a.jsxs("span",{className:"vis-hidden",children:[", on ",t.host,", opens in a new tab"]})]},t.provider))})}function _M({incident:e}){return e?a.jsxs("a",{className:e.stale?"up-incident up-incident-stale":"up-incident","data-state":e.state,href:e.href,target:"_blank",rel:"noopener noreferrer",title:e.detail,children:[a.jsx("span",{className:"pi-dot","aria-hidden":!0}),a.jsxs("span",{className:"up-incident-words",children:[a.jsxs("span",{className:"vis-hidden",children:[e.name,": "]}),e.words[0].toUpperCase()+e.words.slice(1),e.asOf?` · as of ${e.asOf}`:""]}),a.jsx("span",{className:"up-incident-go","aria-hidden":!0,children:"↗"}),e.what&&a.jsx("span",{className:"up-incident-what",children:e.what}),a.jsxs("span",{className:"vis-hidden",children:[", on ",e.host,", opens in a new tab"]})]}):null}function Cz(e,t,n,r,s=!1){const i=Math.max(0,t-r),l=Math.max(0,n-i);if(l<120)return null;const u=Math.min(100,l/n*100),d=e-u;if(s||e>=100)return{label:"used up",color:"var(--warn)",expectedPct:u,isDeficit:!0};if(Math.abs(d)<3)return{label:"on pace",color:"var(--ok)",expectedPct:u,isDeficit:!1};if(d>0){const f=100-e,h=l>0?e/l:0,p=h>0?f/h:1/0,g={label:`${Math.round(d)}% over pace`,color:"var(--warn)",expectedPct:u,isDeficit:!0};if(p<i&&p<86400){const w=Math.floor(p/3600),k=Math.floor(p%3600/60);g.runsOutIn=w>0?`${w}h ${k}m`:`${k}m`}return g}return{label:`${Math.round(-d)}% under pace`,color:"var(--ok)",expectedPct:u,isDeficit:!1}}function Bs({pct:e,label:t,reset:n,resetAt:r,windowSec:s,limitReached:i,nowSec:l}){const u=e!=null,d=u?Math.min(100,Math.max(0,e)):0,h=i||d>=90?"var(--err)":d>=70?"var(--warn)":"var(--accent)",p=d<1,g=u?p?"< 1%":`${Math.round(d)}%`:"no reading",w=p?2:d,k=r?Ad(r,l):null,x=u&&r&&s?Cz(d,r,s,l,i):null,[b,j]=v.useState(!1),S=v.useId();return a.jsxs("div",{className:"qb-row",children:[a.jsxs("div",{className:"qb-meta",children:[a.jsxs("span",{className:"qb-label",children:[t,i&&a.jsx("span",{className:"qb-limit-badge",title:"Rate limit reached",children:"⛔"})]}),a.jsx("span",{className:"qb-pct",style:{color:u?h:"var(--muted)"},children:g})]}),a.jsxs("div",{className:"qb-track",children:[u&&a.jsx("div",{className:"qb-fill",style:{transform:`scaleX(${w/100})`,background:h,opacity:p?.4:1}}),x&&a.jsx("div",{className:"qb-pace-rail",style:{transform:`translateX(${x.expectedPct}%)`},children:a.jsx("div",{"aria-hidden":!0,className:"qb-pace-marker",style:{background:x.isDeficit?"var(--err)":"var(--ok)"},title:`To last until reset, stay near ${Math.round(x.expectedPct)}% by now`})})]}),a.jsxs("div",{className:"qb-reset-row",children:[k?a.jsxs("span",{className:"qb-reset",children:["resets in ",k]}):n?a.jsxs("span",{className:"qb-reset",children:["resets ",n]}):null,x&&a.jsxs("button",{type:"button",className:"qb-pace",style:{color:x.color},"aria-expanded":b,"aria-controls":b?S:void 0,onClick:()=>j(_=>!_),children:[a.jsx("i",{className:"qb-pace-key","aria-hidden":!0,style:{background:x.isDeficit?"var(--err)":"var(--ok)"}}),x.runsOutIn?`runs out in ${x.runsOutIn}`:x.label]})]}),b&&x&&a.jsxs("div",{id:S,className:"qb-why",children:["To last until reset, stay near ",Math.round(x.expectedPct),"% by now."]})]})}function EM(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 Tz(e){return e==="claude-swap"?"Read from claude-swap's last collection — costs no request against your usage-endpoint budget. Saved limit resets, which it does not collect, are read separately: every 30 minutes, or 5 on refresh":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 Rz(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 Az(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."}}function Mz({quota:e,quotaLoading:t,nowSec:n,incident:r}){const s=EM(e==null?void 0:e.fetchedAt,n);return a.jsxs("section",{className:"up-section up-quota-section",children:[a.jsxs("h3",{className:"up-section-title",children:["Claude quota",s&&!t&&a.jsx("span",{className:"up-section-age",title:Tz(e==null?void 0:e.source),children:s})]}),a.jsx(_M,{incident:r}),e!=null&&e.ok?a.jsxs("div",{className:"up-quota-bars",children:[e.session5hPct!=null&&a.jsx(Bs,{label:"5-hour window",pct:e.session5hPct,reset:e.session5hReset,resetAt:e.session5hResetAt,windowSec:e.session5hWindowSec,nowSec:n}),a.jsx(Bs,{label:"7-day window",pct:e.week7dPct??null,reset:e.week7dReset,resetAt:e.week7dResetAt,windowSec:e.week7dWindowSec,nowSec:n}),e.weekSonnetPct!=null&&a.jsx(Bs,{label:"Sonnet (7d)",pct:e.weekSonnetPct,nowSec:n}),e.weekOpusPct!=null&&a.jsx(Bs,{label:"Opus (7d)",pct:e.weekOpusPct,nowSec:n}),e.extraEnabled&&e.extraUsedCredits!=null&&e.extraMonthlyLimit?a.jsx(Bs,{label:`Extra credits (month${e.extraCurrency?`, ${e.extraCurrency}`:""})`,pct:Math.min(100,Math.round(e.extraUsedCredits/e.extraMonthlyLimit*100)),nowSec:n}):e.extraEnabled&&a.jsx("div",{className:"up-quota-sub up-credits",children:"extra usage credits: on"}),e.resetCredits&&e.resetCredits.availableCount>0&&a.jsx("div",{className:"up-quota-sub up-reset-credits",title:`Saved in Claude as "Reset for free". Redeem one in Claude on the web or desktop — ${vt} only reports them`,children:SM("limit reset",e.resetCredits)})]}):(e==null?void 0:e.ok)===!1?a.jsxs("div",{className:"up-quota-na",children:[a.jsx("span",{children:e.reason==="no_subscription"?"No quota to show.":"Quota unavailable."}),a.jsx("span",{className:"up-quota-hint",children:Rz(e.reason)})]}):a.jsx("div",{className:"up-quota-na up-quota-loading",children:"Checking…"})]})}function $z({codexQuota:e,codexLoading:t,codexUsage:n,nowSec:r,incident:s}){var l,u;const i=EM(e==null?void 0:e.fetchedAt,r);return a.jsxs("section",{className:"up-section up-quota-section",children:[a.jsxs("h3",{className:"up-section-title",children:["Codex quota",(e==null?void 0:e.ok)&&e.planLabel&&a.jsx("span",{className:"up-plan-badge",children:e.planLabel}),i&&!t&&a.jsx("span",{className:"up-section-age",title:"Fetched from the Codex usage endpoint",children:i})]}),a.jsx(_M,{incident:s}),e!=null&&e.ok?a.jsxs("div",{className:"up-quota-bars",children:[(l=e.windows)==null?void 0:l.map(d=>a.jsx(Bs,{label:d.label,pct:d.pct,reset:d.reset??void 0,resetAt:d.resetAt??void 0,windowSec:d.windowSec??void 0,limitReached:e.limitReached&&d.pct>=100,nowSec:r},d.id)),(u=e.extraWindows)==null?void 0:u.map(d=>a.jsx(Bs,{label:d.label,pct:d.pct,reset:d.reset??void 0,resetAt:d.resetAt??void 0,windowSec:d.windowSec??void 0,nowSec:r},d.id)),e.creditLimit&&a.jsx(Bs,{label:`spend cap · $${Math.round(e.creditLimit.used)} of $${Math.round(e.creditLimit.limit)}`,pct:e.creditLimit.usedPct,reset:e.creditLimit.reset??void 0,resetAt:e.creditLimit.resetAt??void 0,limitReached:e.spendControlReached,nowSec:r}),e.creditsBalance&&!e.creditsUnlimited&&a.jsxs("div",{className:"up-quota-sub up-credits",children:["credits: $",e.creditsBalance,e.overageReached&&" · overage limit reached"]}),e.creditsUnlimited&&a.jsx("div",{className:"up-quota-sub up-credits",children:"credits: unlimited"}),e.resetCredits&&e.resetCredits.availableCount>0&&a.jsx("div",{className:"up-quota-sub up-reset-credits",title:`Redeem in the Codex CLI or ChatGPT — ${vt} only reports them`,children:SM("rate-limit reset",e.resetCredits)}),e.promo&&a.jsx("div",{className:"up-quota-sub",children:e.promo}),e.partial&&a.jsx("div",{className:"up-quota-sub up-quota-hint",children:"Partial data — OpenAI returned limits this build doesn't recognise."})]}):(e==null?void 0:e.ok)===!1?a.jsxs("div",{className:"up-quota-na",children:[a.jsx("span",{children:"Quota unavailable."}),a.jsx("span",{className:"up-quota-hint",children:Az(e.reason)})]}):a.jsx("div",{className:"up-quota-na up-quota-loading",children:"Checking…"}),(n==null?void 0:n.ok)&&n.window7d&&n.window7d.sessionCount>0&&a.jsxs("div",{className:"up-quota-sub",title:`Counted from the rollout files under CODEX_HOME — no network, no account${n.window5h?`
|
|
77
|
-
last 5h: ${st(n.window5h.totalTokens)} tokens · ${n.window5h.sessionCount} session${n.window5h.sessionCount!==1?"s":""}`:""}`,children:[st(n.window7d.totalTokens)," tokens · ",n.window7d.sessionCount," session",n.window7d.sessionCount!==1?"s":""," (7d)"]})]})}function Iz({fromRange:e,rangeModelRows:t,boardModelRows:n}){return a.jsxs("section",{className:"up-section",children:[a.jsx("h3",{className:"up-section-title",children:"By model"}),a.jsxs("table",{className:"up-table",children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{children:"Model"}),a.jsx("th",{children:"Tokens"}),a.jsx("th",{children:"Cost"})]})}),a.jsx("tbody",{children:e?t.map(r=>a.jsxs("tr",{children:[a.jsx("td",{className:"up-model-name",title:r.model,children:Ws(r.model)}),a.jsx("td",{className:"up-num",children:st(r.tokens)}),r.cost>0?a.jsx("td",{className:"up-num up-cost-val",children:Be(r.cost)}):a.jsx("td",{className:"up-num up-unpriced",children:ts})]},r.model)):n.map(r=>a.jsxs("tr",{children:[a.jsx("td",{className:"up-model-name",title:r.model===cx?"no model reported yet":r.model,children:r.model===cx?"unknown":Ws(r.model)}),a.jsx("td",{className:"up-num",children:st(r.inputTokens+r.outputTokens)}),r.priced?a.jsx("td",{className:"up-num up-cost-val",children:Be(r.cost.total)}):a.jsx("td",{className:"up-num up-unpriced",children:ts})]},r.model))})]})]})}function Oz({period:e,rangePending:t,setPeriod:n}){const r=v.useRef([]);return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"uh-range up-period",role:"toolbar","aria-orientation":"horizontal","aria-label":"Period","aria-busy":t||void 0,onKeyDown:s=>{var u;const i=r.current.indexOf(s.target);if(i<0)return;const l=mz(s.key,i);l!==null&&(s.preventDefault(),(u=r.current[l])==null||u.focus())},children:Md.map((s,i)=>a.jsx("button",{type:"button",ref:l=>{r.current[i]=l},tabIndex:e===s.key?0:-1,"aria-pressed":e===s.key,"data-pending":e===s.key&&t?"":void 0,title:e===s.key&&t?`Reading ${s.noun} from the transcripts on this machine…`:s.hint,className:"uh-range-btn",onClick:()=>n(s.key),children:s.label},s.key))}),a.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:t?`Reading ${kM(e,e)}…`:""})]})}function Lz({fromRange:e,rangeSessionRows:t,boardSessionRows:n,boardStates:r,sessionsOpen:s,setSessionsOpen:i,periodNoun:l,sessionScale:u}){const d=e?t.length:n.length;return a.jsxs("section",{className:"up-section",children:[a.jsx("h3",{className:"up-section-title",children:a.jsxs("button",{type:"button",className:"up-disclose","aria-expanded":s,"aria-controls":"up-sessions",title:s?"Hide the per-session breakdown":`Show the per-session breakdown — ${d} session${d===1?"":"s"}`,onClick:()=>i(f=>!f),children:["By session",e&&a.jsxs("span",{className:"up-section-age",title:xz(l,u,Be),children:["active ",l]}),a.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:a.jsx("path",{d:"M2.2 3.6 5 6.4 7.8 3.6"})})]})}),a.jsxs("div",{className:"up-sessions",id:"up-sessions",hidden:!s,children:[e&&t.map(f=>{const h=r.get(f.sessionId);return a.jsxs("div",{className:"up-session-row",children:[h?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:`sl-dot state-${h}`,"aria-hidden":!0}),a.jsx("span",{className:"vis-hidden",children:Zo(h)})]}):a.jsx("span",{className:"sl-dot up-dot-past","aria-hidden":!0}),a.jsx("span",{className:`up-session-label${f.label?"":" up-session-id"}`,title:f.label?`${f.label}
|
|
78
|
-
${f.sessionId}`:f.sessionId,children:f.label??b0(f.sessionId,8)}),a.jsx("span",{className:"up-session-tokens",children:st(f.tokens)}),f.cost>0?a.jsx("span",{className:"up-session-cost",title:f.models.join(", ")||void 0,children:Be(f.cost)}):a.jsx("span",{className:"up-session-cost up-unpriced",children:ts})]},f.sessionId)}),!e&&n.map(f=>a.jsxs("div",{className:"up-session-row",children:[a.jsx("span",{className:`sl-dot state-${f.state}`,"aria-hidden":!0}),a.jsx("span",{className:"vis-hidden",children:Zo(f.state)}),a.jsx("span",{className:"up-session-label",children:f.label}),a.jsx("span",{className:"up-session-tokens",children:st(f.inputTokens+f.outputTokens)}),f.cost>0?a.jsxs("span",{className:"up-session-cost",title:f.unpricedTokens>0?`${st(f.unpricedTokens)} tokens in this session are on an unpriced model, so this is a floor`:void 0,children:[Be(f.cost),f.unpricedTokens>0?"+":""]}):a.jsx("span",{className:"up-session-cost up-unpriced",children:ts})]},f.sessionId))]})]})}function Vs(e,t){return{disabled:e!=null&&e!==t,busy:e===t}}function Id(e){return e==null}const fx="self";function Jr(e,t=!1){const n=Vs(e?fx:null,fx);return{disabled:t||n.disabled,"aria-busy":n.busy}}function Sr(e){return Id(e?fx:null)}const Cl=400;function Tl({armedFor:e,target:t,armedAt:n,now:r,gapMs:s}){return e!==t?"arm":r-n<s?"ignore":"fire"}function CM(e){return[...e==null?[]:[`#ap-more-${e}`],".accounts-panel .ap-refresh"]}function ns(e){return e==null||e==="BODY"||e==="HTML"}const Pz=6e4,Dz=2e4;function Fz(e){const[t,n]=v.useState(null),[r,s]=v.useState(!1),i=v.useRef(null),l=v.useRef(!1),u=async(f=!1)=>{if(!(f&&!Sr(l.current))){f&&(l.current=!0,s(!0));try{const p=await fetch(f?"/api/quota?refresh=1":"/api/quota",{signal:AbortSignal.timeout(Dz)});p.ok&&n(await p.json())}catch{}finally{f&&(l.current=!1,s(!1))}}};return v.useEffect(()=>{if(e)return u(!0),i.current=window.setInterval(()=>u(!1),Pz),()=>{i.current!=null&&window.clearInterval(i.current)}},[e]),{quota:t,loading:r,refresh:()=>{e&&u(!0)}}}const TM=6e4;function qz(e){const[t,n]=v.useState(null),[r,s]=v.useState(!1),i=v.useRef(null),l=v.useRef(!1),u=async(f=!1)=>{if(!(f&&!Sr(l.current))){f&&(l.current=!0,s(!0));try{const p=await fetch(f?"/api/codex-quota?refresh=1":"/api/codex-quota");p.ok&&n(await p.json())}catch{}finally{f&&(l.current=!1,s(!1))}}};return v.useEffect(()=>{if(e)return u(!0),i.current=window.setInterval(()=>u(!1),TM),()=>{i.current!=null&&window.clearInterval(i.current)}},[e]),{data:t,loading:r,refresh:()=>{e&&u(!0)}}}function Bz(e){const[t,n]=v.useState(null),r=v.useRef(null),s=async()=>{try{const i=await fetch("/api/codex-usage");i.ok&&n(await i.json())}catch{}};return v.useEffect(()=>{if(e)return s(),r.current=window.setInterval(s,TM),()=>{r.current!=null&&window.clearInterval(r.current)}},[e]),{data:t}}const pj=6e4;function Uz(e,t,n){const[r,s]=v.useState(null),[i,l]=v.useState(!1),[u,d]=v.useState(0),f=v.useRef(0);v.useEffect(()=>{const p=()=>document.visibilityState==="visible",g=()=>{p()&&d(x=>x+1)},w=window.setInterval(g,pj),k=()=>{p()&&Date.now()-f.current>=pj&&d(x=>x+1)};return document.addEventListener("visibilitychange",k),()=>{window.clearInterval(w),document.removeEventListener("visibilitychange",k)}},[]);const h=v.useRef(t);return v.useEffect(()=>{let p=!0;const g=t!==h.current;h.current=t;const w=e,k=xM(w);return l(!0),fetch(`/api/ccusage?since=${k}${g?"&refresh=1":""}`).then(x=>x.ok?x.json():null).then(x=>{!p||!(x!=null&&x.ok)||(f.current=Date.now(),s({period:w,data:x,baseline:n()}))}).catch(()=>{}).finally(()=>{p&&l(!1)}),()=>{p=!1}},[e,t,u]),{...bz(r,e),loading:i}}const zz=e=>1-Math.pow(1-e,5),RM=420;function Hz(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 Wz(e,t,n,r=RM){return n>=r?t:n<=0?e:e+(t-e)*zz(n/r)}function AM(){return typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches}function mj(e,t,n,r={}){const s=r.now??(()=>performance.now()),i=r.raf??(w=>requestAnimationFrame(w)),l=r.cancel??(w=>cancelAnimationFrame(w)),u=r.reducedMotion??AM,d=r.hidden??(()=>typeof document=="object"&&document.hidden===!0);if(u()||d()||!Hz(e,t))return n(t),()=>{};const f=s();let h=0,p=!0;const g=()=>{if(!p)return;const w=s()-f;n(Wz(e,t,w)),w<RM&&(h=i(g))};return h=i(g),()=>{p=!1,h&&l(h)}}const Vz=typeof window>"u"?v.useEffect:v.useLayoutEffect;function ja(e,{countIn:t=!1}={}){const[n,r]=v.useState(e),s=v.useRef(e),i=v.useRef(!0);return v.useEffect(()=>{s.current=n},[n]),Vz(()=>{!t||AM()||(s.current=0,r(0))},[]),v.useEffect(()=>{if(i.current){if(i.current=!1,t)return mj(0,e,u=>{s.current=u,r(u)});s.current=e,r(e);return}return mj(s.current,e,u=>{s.current=u,r(u)})},[e]),n}function MM(e,t,n){const r=Kz*Math.max(1,n/IM);let s=0;for(const[i,l]of t){const u=e.get(i);if(u===void 0)continue;const d=l.cost-u.cost;d>0&&d<=r&&(s+=d)}return s}const gj={samples:[],last:new Map,watched:0},$M=10*6e4,Gz=6e4,IM=5e3,Kz=20;function Yz(e,t,n){const r=e.samples[e.samples.length-1];if(r&&t-r.t<IM)return e;const s=e.watched+MM(e.last,n,r?t-r.t:0),i=e.samples.filter(l=>t-l.t<=$M);return i.push({t,watched:s}),{samples:i,last:n,watched:s}}function Xz(e,t,n){const r=e.samples[0];if(!r)return null;const s=t-r.t;if(s<Gz)return null;const i=e.samples[e.samples.length-1].t,l=e.watched+MM(e.last,n,t-i)-r.watched;return l>0?{spent:l,spanSec:s/1e3,spanMin:Math.min($M/6e4,Math.ceil(s/6e4))}:null}function Zz(e,t,n){const r=v.useRef(gj),s=v.useRef(null);return v.useMemo(()=>{const i=cz(e.agents.values()),l=az(e.agents.values());s.current!==n&&(s.current=n,r.current=gj);const u=dx(e.agents.values(),t);n!=null&&(r.current=Yz(r.current,t,u));const d=n==null?null:Xz(r.current,t,u),f=d?{label:h0(d.spent,d.spanSec),spanMin:d.spanMin}:null;return{byModel:i,totalCost:l.cost,totalTokens:l,burnRate:f}},[e,e.revision,t,n])}const Jz=3e4;function OM(){const[e,t]=v.useState(()=>Math.floor(Date.now()/1e3));return v.useEffect(()=>{const n=window.setInterval(()=>t(Math.floor(Date.now()/1e3)),Jz);return()=>window.clearInterval(n)},[]),e}function yj(e){return(typeof e.cost=="number"?e.cost:e.cost.total)>0||e.inputTokens+e.outputTokens>0}function Qz(e,t,n){return e?t.some(r=>r.cost<=0&&r.tokens>0):n.some(r=>!r.priced)}function eH(e){return e.claude&&e.codex?"Refresh Claude + Codex quota":e.codex?"Refresh Codex quota":"Refresh Claude quota"}function tH(e){const t=new Map;for(const n of e){if(n.kind!=="root"||!n.sessionId)continue;const r=n.label||n.cwdBasename;r&&t.set(n.sessionId,r)}return t}function nH(e){const t=new Map;for(const n of e)n.kind!=="root"||!n.sessionId||t.set(n.sessionId,n.state);return t}function rH(e){const t=new Map;for(const n of e){if(!n.label)continue;const r=t.get(n.label);r?r.push(n.sessionId):t.set(n.label,[n.sessionId])}return e.map(n=>{const r=n.label?t.get(n.label)??[]:[];return r.length>1?{...n,label:`${n.label} ${gM(n.sessionId,r)}`}:n})}function sH({state:e,now:t,providers:n,incidents:r=[],leaving:s,onClose:i,liveSince:l=null}){const{quota:u,loading:d,refresh:f}=Fz(n.claude),{data:h,loading:p,refresh:g}=qz(n.codex),{data:w}=Bz(n.codex),k=OM(),{byModel:x,totalCost:b,totalTokens:j,burnRate:S}=Zz(e,t,l),_=v.useMemo(()=>uz(e.agents.values()),[e,e.revision]),[E,T]=v.useState(Nz);v.useEffect(()=>{jz(E)},[E]);const[R,A]=v.useState(Sz);v.useEffect(()=>{_z(R)},[R]);const[U,I]=v.useState(0),q=v.useRef(()=>new Map);q.current=()=>l==null?null:dx(e.agents.values(),t);const P=v.useCallback(()=>q.current(),[]),{data:O,shown:V,stale:$,loading:M,baseline:L}=Uz(E,U,P),Y=O!=null,K=M&&$,D=v.useMemo(()=>tH(e.agents.values()),[e,e.revision]),z=v.useMemo(()=>nH(e.agents.values()),[e,e.revision]),F=v.useMemo(()=>Y?bM(O):[],[O,Y]),H=v.useMemo(()=>Y?rH(wz(O,D).slice(0,12)):[],[O,Y,D]),J=v.useMemo(()=>$d(O),[O]),W=v.useMemo(()=>vz(O,J.cost),[O,J.cost]),G=kM(V,E),X=v.useMemo(()=>Y?pz(L,dx(e.agents.values(),t)):ux,[e,e.revision,L,Y,t]),Z=kz(O,{...j,cost:b},X),ee=Z.hasCost,re=Z.tokenSum,ce=ja(Z.cost),ie=ja(Z.inputTokens),fe=ja(Z.outputTokens),de=ja(Z.cacheReadTokens),we=ja(Z.cacheCreateTokens),xe=x.filter(yj),$e=_.filter(yj),be=Qz(Y,F,xe),he=d||p,se=()=>{f(),g(),I(Ce=>Ce+1)},ke=eH(n);return a.jsxs("aside",{className:`usage-panel${s?" leaving":""}`,id:"usage-panel","aria-label":"Usage",children:[a.jsxs("div",{className:"up-header",children:[a.jsx("h2",{children:"Usage"}),S&&a.jsxs("span",{className:"up-rate",title:`Spend on this board over the last ${S.spanMin} min`,children:[S.label,a.jsxs("span",{className:"up-rate-span",children:[" · ",S.spanMin," min"]})]}),a.jsxs("div",{className:"up-header-right",children:[(n.claude||n.codex)&&a.jsx("button",{type:"button",className:"glyph-btn up-refresh-btn",onClick:se,...Jr(he),"aria-label":ke,title:ke,children:he?"…":"↻"}),a.jsx("button",{type:"button",className:"glyph-btn up-close",onClick:i,"aria-label":"Close usage panel",title:"Close (U)",children:"×"})]})]}),n.claude&&a.jsx(Mz,{quota:u,quotaLoading:d,nowSec:k,incident:r.find(Ce=>Ce.provider==="claude")}),n.codex&&a.jsx($z,{codexQuota:h,codexLoading:p,codexUsage:w,nowSec:k,incident:r.find(Ce=>Ce.provider==="codex")}),Y&&a.jsx(Oz,{period:E,rangePending:K,setPeriod:T}),re>0?a.jsxs(a.Fragment,{children:[ee&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"up-total",title:Y?void 0:dj,children:[a.jsx("span",{className:"up-total-value",children:Be(ce)}),a.jsx("span",{className:"up-total-label",children:Y?G:oz})]}),Z.showCostBar&&a.jsx(k0,{cost:b})]}),a.jsxs("div",{className:"up-tokens-row",title:Y?void 0:dj,children:[a.jsxs("span",{className:"up-tok",children:[a.jsx("span",{className:"up-k",children:"in"}),st(ie)]}),a.jsxs("span",{className:"up-tok",children:[a.jsx("span",{className:"up-k",children:"out"}),st(fe)]}),Z.cacheReadTokens>0&&a.jsxs("span",{className:"up-tok",children:[a.jsx("span",{className:"up-k",children:"cache r"}),st(de)]}),Z.cacheCreateTokens>0&&a.jsxs("span",{className:"up-tok",children:[a.jsx("span",{className:"up-k",children:"cache c"}),st(we)]}),!ee&&a.jsx("span",{className:"up-tok up-scope",children:iz})]}),(Y?F.length:xe.length)>0&&a.jsx(Iz,{fromRange:Y,rangeModelRows:F,boardModelRows:xe}),Y&&H.length===0&&J.tokens>0&&a.jsxs("section",{className:"up-section",children:[a.jsx("h3",{className:"up-section-title",children:"By session"}),a.jsxs("div",{className:"up-hint",children:["No session is dated ",G," yet — ccusage dates sessions in UTC, and the totals above are your local day."]})]}),(Y?H.length:$e.length)>0&&a.jsx(Lz,{fromRange:Y,rangeSessionRows:H,boardSessionRows:$e,boardStates:z,sessionsOpen:R,setSessionsOpen:A,periodNoun:G,sessionScale:W}),be&&a.jsxs("div",{className:"up-hint",children:["“",ts,"” means this build holds no published rate for that model — those tokens are counted above and their dollars are not."]})]}):a.jsx("div",{className:"up-empty",children:Y?(V??E)==="all"?a.jsx(a.Fragment,{children:"No usage in any transcript on this machine."}):a.jsxs(a.Fragment,{children:["No usage ",G,".",a.jsx("br",{}),"Try a longer period."]}):a.jsxs(a.Fragment,{children:["No usage data yet.",a.jsx("br",{}),"Start a Claude Code or Codex session."]})})]})}function aH(e,t,n){return e>=n?"hot":e>=t?"warn":"calm"}function oH(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}% ${iH(t.lastMs,n)}`:"running at full speed, and never held back"}}function iH(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 lH(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 cH(e){var n,r,s;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`:(s=e.network)!=null&&s.api&&e.network.api.ms==null?"the Claude API is not answering":null}function uH(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})`:""}`}const dH=3e3;function hH(){const[e,t]=v.useState(null),n=v.useRef(null);return v.useEffect(()=>{let r=!0;const s=async()=>{if(document.visibilityState!=="hidden")try{const d=await fetch("/api/system");if(!d.ok)return;const f=await d.json();r&&(f!=null&&f.ok)&&t(f)}catch{}},i=()=>{n.current==null&&(s(),n.current=window.setInterval(s,dH))},l=()=>{n.current!=null&&(window.clearInterval(n.current),n.current=null)},u=()=>{if(document.visibilityState==="hidden"){l();return}i(),s()};return i(),document.addEventListener("visibilitychange",u),()=>{r=!1,l(),document.removeEventListener("visibilitychange",u)}},[]),e}function ip(e){return e<9.95?e.toFixed(1):String(Math.round(e))}function N0(e){const t=Number.isFinite(e)?Math.max(0,e):0;return t<50?{value:"0",unit:"KB/s"}:t<999500?{value:ip(t/1e3),unit:"KB/s"}:t<9995e5?{value:ip(t/1e6),unit:"MB/s"}:{value:ip(t/1e9),unit:"GB/s"}}function Od(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 Rl(e){return e.unit?e.unit==="%"||e.unit==="°C"?`${e.value}${e.unit}`:`${e.value} ${e.unit}`:e.value}function lp(e,t){return t==="B/s"?N0(e):t==="ms"?Od(e):{value:String(e),unit:t==="C"?"°C":t}}const Et={l:30,r:6,t:6,b:2},Ls={l:0,r:0,t:2,b:1},Ld=104,fH=64;function nr(e,t=100,n=Ld,r=Et){const s=n-r.t-r.b;return r.t+s*(1-Math.max(0,Math.min(t,e))/t)}function LM(e,t,n,r=100,s=Ld,i=Et){if(!e.length)return"";const l=e[e.length-1].t-e[0].t,u=h=>{const p=t-i.l-i.r;return i.l+(l>0?p*(h-e[0].t)/l:p/2)};let d="",f=null;for(const h of e){const p=f&&h.t-f.t<=n*2?"L":"M";d+=`${p}${u(h.t).toFixed(1)} ${nr(h.v,r,s,i).toFixed(1)}`,f=h}return d}function PM(e,t,n,r=100,s=Ld,i=Et){if(e.length<2)return"";const l=s-i.b,u=e[e.length-1].t-e[0].t,d=t-i.l-i.r,f=w=>i.l+(u>0?d*(w-e[0].t)/u:d/2);let h="",p=[];const g=()=>{if(p.length>=2){let w=`M${f(p[0].t).toFixed(1)} ${l}`;for(const k of p)w+=`L${f(k.t).toFixed(1)} ${nr(k.v,r,s,i).toFixed(1)}`;h+=`${w}L${f(p[p.length-1].t).toFixed(1)} ${l}Z`}p=[]};for(const w of e)p.length&&w.t-p[p.length-1].t>n*2&&g(),p.push(w);return g(),h}function pH(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 DM(e,t,n){return n!=null&&e>=n?"hot":t!=null&&e>=t?"warn":""}function mH(e,t,n=r=>Sa(r)){const r=e.filter(l=>l.v>0);if(!e.length)return null;if(!r.length)return"never held back";const s=r.length*(t/6e4),i=r[r.length-1];return`held back for ${s===1?"1 minute":`${s} minutes`}, last at ${n(i.t)}`}function Sa(e){const t=new Date(e);return`${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}`}function j0(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),s=n%60;return s?`${r}h ${s}m`:`${r}h`}function gH({group:e,title:t,onClose:n}){const r=mt(n),[s,i]=v.useState(null);v.useEffect(()=>{let f=!0;const h=async()=>{try{const g=await fetch(`/api/system/history?group=${e}`);if(!g.ok)return;const w=await g.json();f&&(w!=null&&w.ok)&&i(w)}catch{}};h();const p=window.setInterval(h,2e4);return()=>{f=!1,window.clearInterval(p)}},[e]);const l=(s==null?void 0:s.series)??[],[u,d]=v.useMemo(()=>{let f=1/0,h=0;for(const p of l)p.points.length&&(f=Math.min(f,p.points[0].t),h=Math.max(h,p.points[p.points.length-1].t));return[Number.isFinite(f)?Math.max(f,(s==null?void 0:s.sinceMs)??0):(s==null?void 0:s.sinceMs)??0,h]},[l,s==null?void 0:s.sinceMs]);return Ot.createPortal(a.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:a.jsxs("div",{ref:r,className:"modal hist-modal",onClick:f=>f.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"hist-modal-title",children:[a.jsxs("div",{className:"modal-head",children:[a.jsx("span",{className:"modal-title",id:"hist-modal-title",children:t}),s&&u>0&&a.jsxs("span",{className:"hist-since",children:["since ",Sa(u)," · ",j0(u,d||Date.now())]}),a.jsx("button",{type:"button",className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),a.jsx("div",{className:"hist-body",children:s==null?a.jsx("p",{className:"hist-empty",children:"Reading…"}):l.length===0?a.jsx("p",{className:"hist-empty",children:"Nothing has been measured yet."}):l.map(f=>a.jsx(yH,{series:f,stepMs:s.stepMs},f.label))})]})}),document.body)}function yH({series:e,stepMs:t}){const n=v.useRef(null),[r,s]=v.useState(560),[i,l]=v.useState(null);v.useEffect(()=>{const I=n.current;if(!I||typeof ResizeObserver>"u")return;const q=new ResizeObserver(([P])=>s(Math.max(160,P.contentRect.width)));return q.observe(I),()=>q.disconnect()},[]);const{points:u,unit:d,warnAt:f,critAt:h,label:p,top:g,restsAtZero:w,changes:k}=e,x=w?fH:Ld,{now:b,peak:j}=pH(u),S=b!=null?lp(b,d):null,_=j!=null?lp(j,d):null,E=p==="Throttling"?mH(u,t):null,T=i!=null?u[i]:null,R=u.length>1?u[u.length-1].t-u[0].t:0,A=I=>{const q=r-Et.l-Et.r;return Et.l+(R>0?q*(I-u[0].t)/R:q/2)},U=I=>{if(u.length<2)return;const q=I.currentTarget.getBoundingClientRect(),P=(I.clientX-q.left-Et.l)/Math.max(1,q.width-Et.l-Et.r),O=u[0].t+R*Math.max(0,Math.min(1,P));let V=0;for(let $=1;$<u.length;$++)Math.abs(u[$].t-O)<Math.abs(u[V].t-O)&&(V=$);l(V)};return a.jsxs("section",{className:"hist-series","aria-label":`${p} history`,children:[a.jsxs("div",{className:"hist-head",children:[a.jsx("span",{className:"hist-label",children:p}),a.jsxs("span",{className:"hist-stats",children:[S&&a.jsxs(a.Fragment,{children:[a.jsx("b",{children:S.value}),a.jsxs("span",{children:[S.unit," now"]})]}),j!=null&&_&&a.jsxs(a.Fragment,{children:[a.jsx("b",{className:DM(j,f,h),children:_.value}),a.jsxs("span",{children:[_.unit," peak"]})]})]})]}),a.jsx("div",{className:"hist-plot",ref:n,children:a.jsxs("svg",{className:"hist-chart",width:"100%",height:x,viewBox:`0 0 ${r} ${x}`,preserveAspectRatio:"none",role:"img","aria-label":S==null||_==null?`${p}: nothing measured yet`:`${p}: ${Rl(S)} now, peak ${Rl(_)}, over ${j0(u[0].t,u[u.length-1].t)}`,onPointerMove:U,onPointerLeave:()=>l(null),children:[[["warn",f],["hot",h]].map(([I,q])=>q==null||q>g?null:a.jsxs("g",{children:[a.jsx("line",{className:`hist-rule ${I}`,x1:Et.l,x2:r-Et.r,y1:nr(q,g,x),y2:nr(q,g,x)}),a.jsx("text",{className:`hist-rule-tag ${I}`,x:2,y:nr(q,g,x)+3,children:q})]},I)),a.jsx("line",{className:"hist-floor",x1:Et.l,x2:r-Et.r,y1:x-Et.b,y2:x-Et.b}),(k??[]).filter(I=>I.from!=null&&u.length>1&&I.t>=u[0].t&&I.t<=u[u.length-1].t).map(I=>a.jsx("line",{className:"hist-mark",x1:A(I.t),x2:A(I.t),y1:Et.t,y2:x-Et.b},I.t)),a.jsx("path",{className:"hist-area",d:PM(u,r,t,g,x)}),a.jsx("path",{className:"hist-line",d:LM(u,r,t,g,x)}),u.length===1&&a.jsx("circle",{className:"hist-dot",cx:A(u[0].t),cy:nr(u[0].v,g,x),r:3}),T&&a.jsxs("g",{children:[a.jsx("line",{className:"hist-cross",x1:A(T.t),x2:A(T.t),y1:Et.t,y2:x-Et.b}),a.jsx("circle",{className:"hist-dot",cx:A(T.t),cy:nr(T.v,g,x),r:3})]})]})}),a.jsx("div",{className:"hist-axis",children:T?a.jsxs("span",{className:"hist-at",children:[Sa(T.t)," — ",(()=>{const I=lp(T.v,d);return a.jsxs(a.Fragment,{children:[a.jsx("b",{children:I.value}),I.unit==="%"||I.unit==="°C"||!I.unit?I.unit:` ${I.unit}`]})})()]}):a.jsxs(a.Fragment,{children:[a.jsx("span",{children:u.length?Sa(u[0].t):""}),a.jsx("span",{children:u.length?Sa(u[u.length-1].t):""})]})}),E&&a.jsx("div",{className:"hist-note",children:E}),k==null?void 0:k.slice(-3).map(I=>a.jsx("div",{className:"hist-note hist-route",children:I.from==null?`Since ${Sa(I.t)} — ${I.label}`:`${Sa(I.t)} — ${I.label.charAt(0).toUpperCase()+I.label.slice(1)}`},I.t))]})}const wH="thermal:Throttling";function vH(e){var n,r,s,i;const t={};e.cpu!=null&&(t["cpu:all"]=e.cpu),(n=e.perCore)!=null&&n.length&&(t["cpu:busiest"]=Math.max(...e.perCore)),e.memory&&(t["mem:physical"]=e.memory.usedPct),e.swap&&e.swap.total>0&&(t["mem:swap"]=Math.round(e.swap.used/e.swap.total*1e3)/10),(r=e.loadavg)!=null&&r.length&&(t["load:1m"]=e.loadavg[0]);for(const l of((s=e.thermal)==null?void 0:s.celsius)??[])t[`thermal:${l.label}`]=l.celsius;return(i=e.thermal)!=null&&i.throttle&&(t[wH]=Math.max(0,100-e.thermal.throttle.speedLimit)),t}function pl(e,t){return t==="B/s"?Rl(N0(e)):t==="ms"?Rl(Od(e)):t==="C"?`${Math.round(e)}°`:t==="%"?`${Math.round(e)}%`:e.toFixed(2)}function gu(e,t){return t==="B/s"||t==="ms"||!Number.isInteger(e)?pl(e,t):t==="C"?`${e}°`:t==="%"?`${e}%`:`${e}`}const wj=["cores","memory","load","thermal"],ba=116,Nr=24,xH=60,bH=6e4;function kH(e){return e.points.length?e.restsAtZero?e.points.some(t=>t.v>0):!0:!1}function NH(e){return e.unit==="C"?`${e.label} temp`:e.key==="mem:physical"?"Physical RAM":e.key==="mem:swap"?`${e.label} memory`:e.label}function jH(e,t=xH){return e.points.length<=t?e:{...e,points:e.points.slice(-t)}}function SH({sys:e}){const[t,n]=v.useState({});v.useEffect(()=>{let l=!0;const u=async()=>{const f=await Promise.all(wj.map(async h=>{try{const p=await fetch(`/api/system/history?group=${h}`);return p.ok?[h,await p.json()]:[h,null]}catch{return[h,null]}}));l&&n(h=>{const p={...h};for(const[g,w]of f)w!=null&&w.ok&&(p[g]=w);return p})};u();const d=setInterval(()=>void u(),bH);return()=>{l=!1,clearInterval(d)}},[]);const r=v.useMemo(()=>vH(e),[e]),s=v.useMemo(()=>wj.flatMap(l=>{const u=t[l];return u?u.series.filter(kH).map(d=>({series:jH(d),stepMs:u.stepMs})):[]}),[t]),i=v.useMemo(()=>{let l=1/0,u=-1/0;for(const{series:d}of s){const f=d.points;f.length&&(l=Math.min(l,f[0].t),u=Math.max(u,f[f.length-1].t))}return Number.isFinite(l)?j0(l,u):"less than a minute"},[s]);return Object.keys(r).length?a.jsx("div",{className:"pl-strip",role:"group","aria-label":`This machine, over the last ${i}`,children:s.map(({series:l,stepMs:u})=>a.jsx(_H,{series:l,stepMs:u,now:r[l.key],span:i},l.key))}):null}function _H({series:e,stepMs:t,now:n,span:r}){var w;const{points:s,top:i,unit:l,warnAt:u,critAt:d}=e,f=NH(e),h=n??((w=s[s.length-1])==null?void 0:w.v),p=h==null?"":DM(h,u,d),g=Math.max(...s.map(k=>k.v));return a.jsxs("div",{className:`pl-cell${p?` ${p}`:""}`,title:[`${f} · peak ${pl(g,l)} over the last ${r}`,u!=null?`over ${gu(u,l)} is uncomfortable`:"",d!=null?`over ${gu(d,l)} the machine acts`:""].filter(Boolean).join(" · "),children:[a.jsxs("div",{className:"pl-cell-head",children:[a.jsx("span",{className:"pl-cell-label",children:f}),a.jsx("span",{className:"pl-cell-now",children:h==null?"—":pl(h,l)})]}),a.jsxs("svg",{className:"pl-spark",width:ba,height:Nr,viewBox:`0 0 ${ba} ${Nr}`,preserveAspectRatio:"none","aria-hidden":!0,children:[a.jsx("line",{className:"pl-spark-floor",x1:0,x2:ba,y1:Nr-Ls.b,y2:Nr-Ls.b}),a.jsx("path",{className:"pl-spark-area",d:PM(s,ba,t,i,Nr,Ls)}),u!=null&&a.jsx("line",{className:"pl-rule warn",x1:0,x2:ba,y1:nr(u,i,Nr,Ls),y2:nr(u,i,Nr,Ls)}),d!=null&&a.jsx("line",{className:"pl-rule hot",x1:0,x2:ba,y1:nr(d,i,Nr,Ls),y2:nr(d,i,Nr,Ls)}),a.jsx("path",{className:"pl-spark-line",d:LM(s,ba,t,i,Nr,Ls)})]}),a.jsxs("span",{className:"vis-hidden",children:["peak ",pl(g,l)," over the last ",r,u!=null&&`, uncomfortable over ${gu(u,l)}`,d!=null&&`, the machine acts over ${gu(d,l)}`]})]})}const EH={key:"cpu",dir:"desc"};function CH(e,t){return e.key===t?{...e,dir:e.dir==="asc"?"desc":"asc"}:{key:t,dir:t==="name"||t==="user"?"asc":"desc"}}function TH(e,t){const n=t.dir==="asc"?1:-1,r=i=>t.key==="cpu"?i.cpu:t.key==="mem"?i.mem:t.key==="rss"?i.rssBytes:t.key==="threads"?i.threads:i.uptimeSec,s=(i,l)=>{if(t.key==="name")return n*i.name.localeCompare(l.name,void 0,{sensitivity:"base"});if(t.key==="user"){const f=i.user??"",h=l.user??"";return!f||!h?f===h?0:f?-1:1:n*f.localeCompare(h,void 0,{sensitivity:"base"})}const u=r(i),d=r(l);return u==null||d==null?u==null?d==null?0:1:-1:n*(u-d)};return[...e].sort((i,l)=>s(i,l)||(l.cpu??-1)-(i.cpu??-1)||l.mem-i.mem||i.pid-l.pid)}function RH(e,t){return e.key!==t?"none":e.dir==="asc"?"ascending":"descending"}const AH=4e3;function MH(e,t){const n=t!=null&&t.ok&&Array.isArray(t.procs)?t.procs:[];return n.length?{procs:n,total:t.total??0}:e??{procs:[],total:0}}function $H(){const[e,t]=v.useState(null);return v.useEffect(()=>{let n=!0;const r=async()=>{if(document.visibilityState!=="hidden")try{const i=await fetch("/api/system/processes?detail=1");if(!i.ok)return;const l=await i.json();n&&t(u=>MH(u,l))}catch{}};r();const s=window.setInterval(r,AH);return()=>{n=!1,window.clearInterval(s)}},[]),e}function IH(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 OH({sys:e,onClose:t}){const n=mt(t),[r,s]=v.useState(EH),i=$H();return Ot.createPortal(a.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:a.jsx("div",{ref:n,className:"modal pl-modal",onClick:l=>l.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"pl-modal-title",children:a.jsx(LH,{read:i,sort:r,onSort:s,sys:e,onClose:t})})}),document.body)}function LH({read:e,sort:t,onSort:n,sys:r,onClose:s}){const i=e?TH(e.procs,t):null;return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"modal-head",children:[a.jsx("span",{className:"modal-title",id:"pl-modal-title",children:"Busiest processes"}),i!=null&&i.length>0&&a.jsxs("span",{className:"pl-count",children:[i.length," of ",e.total," running"]}),a.jsx("button",{type:"button",className:"glyph-btn",onClick:s,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),a.jsxs("div",{className:"pl-split",children:[a.jsx("div",{className:"pl-body",children:i==null?a.jsx("p",{className:"pl-empty",children:"Reading the process list…"}):i.length===0?a.jsx("p",{className:"pl-empty",children:"Could not read the process list — retrying."}):a.jsxs("table",{className:"sd-procs pl-table",children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx(Co,{col:"cpu",label:"cpu",sort:t,onSort:n}),a.jsx(Co,{col:"rss",label:"memory",note:"Resident set size, which is what ps and Task Manager report; macOS Activity Monitor shows a different figure.",sort:t,onSort:n}),a.jsx(Co,{col:"threads",label:"threads",sort:t,onSort:n}),a.jsx(Co,{col:"uptime",label:"up",sort:t,onSort:n}),a.jsx(Co,{col:"user",label:"user",sort:t,onSort:n}),a.jsx("th",{scope:"col",className:"pl-pid-h",children:"pid"}),a.jsx(Co,{col:"name",label:"process",note:"Command lines have anything secret-shaped removed, which is a filter and not a guarantee.",sort:t,onSort:n})]})}),a.jsx("tbody",{children:i.map(l=>a.jsxs("tr",{children:[a.jsx("td",{className:"sd-num",children:l.cpu==null?"—":l.cpu.toFixed(0)}),a.jsx("td",{className:"sd-num sd-dim",title:`${l.mem.toFixed(1)}% of installed memory`,children:Na(l.rssBytes)}),a.jsx("td",{className:"sd-num sd-dim",children:l.threads??"—"}),a.jsx("td",{className:"sd-num sd-dim",children:IH(l.uptimeSec)}),a.jsx("td",{className:"sd-dim pl-user",children:l.user??"—"}),a.jsx("td",{className:"sd-num sd-dim pl-pid",children:l.pid}),a.jsxs("td",{className:"pl-name",children:[l.name,l.cmd&&a.jsxs("span",{className:"pl-cmd",title:l.cmd,children:[" ",l.cmd]})]})]},l.pid))})]})}),a.jsx(SH,{sys:r})]})]})}function Co({col:e,label:t,note:n,sort:r,onSort:s}){const i=RH(r,e);return a.jsx("th",{scope:"col","aria-sort":i,children:a.jsxs("button",{type:"button",className:"sd-sort",title:n?`Sort by ${t}
|
|
79
|
-
|
|
80
|
-
${n}`:`Sort by ${t}`,onClick:()=>s(CH(r,e)),children:[t,a.jsx("span",{className:"sd-sort-dir","aria-hidden":!0,children:i==="none"?"":i==="ascending"?"↑":"↓"})]})})}function px({value:e,unit:t,cap:n}){return t?a.jsxs("span",{className:"sd-fig",children:[a.jsx("span",{className:"sd-fig-cap",children:n}),a.jsxs("span",{className:"sd-fig-read",children:[a.jsx("b",{children:e})," ",a.jsx("span",{className:"sd-fig-unit",children:t})]})]}):a.jsxs("span",{className:"sd-fig",children:[a.jsx("b",{children:e}),a.jsx("span",{className:"sd-fig-cap",children:n})]})}function Al({group:e,title:t,action:n,label:r,value:s,hint:i,children:l}){const[u,d]=v.useState(!1);return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"sd-reading",children:[a.jsx("button",{type:"button",className:"sd-open",onClick:()=>d(!0),title:n,"aria-label":s==null?`${r}: show history`:`${r}: show history, now ${s}`,"aria-describedby":i?`sd-hint-${e}`:void 0,children:a.jsxs("span",{className:"sd-h","aria-hidden":!0,children:[r," ",a.jsx("i",{className:"sd-row-more",children:"›"}),s!=null&&a.jsx("span",{className:"sd-h-val",children:s})]})}),l]}),i&&a.jsx("span",{id:`sd-hint-${e}`,className:"vis-hidden",children:i}),u&&a.jsx(gH,{group:e,title:t,onClose:()=>d(!1)})]})}function nd({label:e,value:t,pct:n,tone:r="calm",note:s,mark:i,title:l,trackLabel:u}){return a.jsxs("div",{className:"sd-row",title:l,children:[a.jsxs("div",{className:"sd-row-head",children:[a.jsx("span",{className:"sd-row-label",children:e}),a.jsx("span",{className:"sd-row-val",children:t})]}),a.jsxs("span",{className:"sd-track",role:u?"img":void 0,"aria-label":u,children:[a.jsx("span",{className:`sd-fill${r==="calm"?"":` ${r}`}`,style:{transform:`scaleX(${n<=0?0:Math.max(1,Math.min(100,n))/100})`}}),i!=null&&i>0&&i<100&&a.jsx("span",{className:"sd-mark",style:{left:`${i}%`},"aria-hidden":!0})]}),s&&a.jsx("div",{className:"sd-note",children:s})]})}function PH(e,t,n){if(n<=0||_d(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 zs=4,In=8;function S0(e,t,n){const r=n.width-In-(e.right+zs),s=e.left-zs-In,i=t.width<=r||r>=s?"right":"left",l=i==="right"?e.right+zs:e.left-zs-t.width,u=n.height-In*2,d=t.height<=u,f=d?t.height:Math.max(0,u),h=Math.max(In,Math.min(e.top,n.height-In-f)),p=Math.max(In,Math.min(l,n.width-In-t.width));return{top:h,left:p,side:i,maxHeight:d?null:f}}function DH(e,t,n){const r=n.height-In-(e.bottom+zs),s=e.top-zs-In,i=t.height<=r||r>=s?"below":"above",l=i==="below"?r:s,u=t.height<=l,d=u?t.height:Math.max(0,l),f=i==="below"?e.bottom+zs:e.top-zs-d,h=Math.max(In,Math.min(e.right-t.width,n.width-In-t.width));return{top:Math.max(In,f),left:h,side:i,maxHeight:u?null:d}}function FH(e,t,n){return!(!e||t!=null&&t.contains(e)||n!=null&&n.contains(e))}function FM(e,t,n){const r=v.useRef(t);r.current=t;const s=v.useRef(n);s.current=n,v.useEffect(()=>{const i=l=>{FH(l.target,e.current,r.current())&&s.current()};return window.addEventListener("pointerdown",i,!0),()=>window.removeEventListener("pointerdown",i,!0)},[e])}const qM='[role="menuitem"]';function vj(e){return e?Array.from(e.querySelectorAll(qM)).filter(t=>!t.disabled):[]}function _0({anchorId:e,boundaryId:t,id:n,className:r,role:s,labelledBy:i,start:l="first",onClose:u,children:d}){const f=v.useRef(u);f.current=u;const h=mt(()=>{var x;(x=document.getElementById(e))==null||x.focus(),f.current()},{popover:!0}),p=v.useCallback(()=>{var E;const x=h.current;if(!x)return;const b=document.getElementById(e);if(!b){f.current();return}const j=b.getBoundingClientRect(),S=t?(E=document.getElementById(t))==null?void 0:E.getBoundingClientRect():null;if(S&&(j.bottom<=S.top||j.top>=S.bottom)){x.contains(document.activeElement)&&b.focus({preventScroll:!0}),f.current();return}x.style.maxHeight="";const _=DH(j,{width:x.offsetWidth,height:x.offsetHeight},{width:window.innerWidth,height:window.innerHeight});x.style.top=`${_.top}px`,x.style.left=`${_.left}px`,x.style.maxHeight=_.maxHeight==null?"":`${_.maxHeight}px`,x.dataset.side=_.side},[e,t,h]);v.useLayoutEffect(()=>{p()}),v.useEffect(()=>{const x=b=>{var j;(j=h.current)!=null&&j.contains(b.target)||p()};return window.addEventListener("scroll",x,!0),window.addEventListener("resize",p),()=>{window.removeEventListener("scroll",x,!0),window.removeEventListener("resize",p)}},[p,h]),FM(h,()=>document.getElementById(e),u),v.useEffect(()=>{var b;if(s!=="menu")return;const x=vj(h.current);(b=l==="last"?x[x.length-1]:x[0])==null||b.focus()},[]);const g=x=>{var b;if(s==="menu"&&x.key==="Tab"){x.stopPropagation(),(b=document.getElementById(e))==null||b.focus(),x.shiftKey&&x.preventDefault(),f.current();return}if(s==="menu"){const j=vj(h.current),S=PH(x,j.indexOf(document.activeElement),j.length);S.kind==="focus"&&(x.preventDefault(),j[S.index].focus())}x.key.length===1&&x.stopPropagation()},w=x=>{x.target.closest("button, input, select, textarea, code")||x.preventDefault()},k=x=>{if(s!=="menu"||x.pointerType==="touch")return;const b=x.target.closest(qM);b&&!b.disabled&&document.activeElement!==b&&b.focus({preventScroll:!0})};return Ot.createPortal(a.jsx("div",{ref:h,id:n,className:`anchored-popover${r?` ${r}`:""}`,role:s,"aria-labelledby":i,onKeyDown:g,onMouseDown:w,onPointerMove:k,children:d}),document.body)}function qH({network:e}){const{down:t,up:n,api:r,route:s}=e,[i,l]=v.useState(!1),u=r&&r.ms!=null?Od(r.ms):null,d=t!=null&&n!=null;return a.jsxs("div",{className:"sd-section",role:"group","aria-label":"Network",children:[a.jsxs(Al,{group:"network",title:"Network history",action:"Show network history",label:"Network",children:[(d||u)&&a.jsxs("div",{className:"sd-figs sd-figs-named",children:[d&&[["Download",t],["Upload",n]].map(([f,h])=>{const p=N0(h);return a.jsx(px,{value:p.value,unit:p.unit,cap:f},f)}),u&&a.jsx(px,{value:u.value,unit:u.unit,cap:"Claude API"})]}),!d&&a.jsx("div",{className:"sd-note",children:"measuring…"}),r&&r.ms==null&&a.jsx("div",{className:"sd-note sd-note-warn",children:"Can’t reach Claude"})]}),s&&a.jsxs(a.Fragment,{children:[a.jsxs("button",{type:"button",className:"sd-detail",id:"sd-conn","aria-expanded":i,"aria-haspopup":"dialog",onClick:()=>l(f=>!f),children:["Connection details",s.relay&&a.jsx("span",{className:"sd-route-relay",children:" · relayed"}),a.jsx("i",{className:"sd-row-more","aria-hidden":!0,children:"›"})]}),i&&a.jsx(BH,{route:s,api:r,onClose:()=>l(!1)})]})]})}function BH({route:e,api:t,onClose:n}){return a.jsxs(_0,{anchorId:"sd-conn",boundaryId:"system-panel",id:"sd-conn-pop",className:"sd-pop",role:"dialog",labelledBy:"sd-conn-title",onClose:n,children:[a.jsx("p",{className:"sd-pop-title",id:"sd-conn-title",children:"Connection"}),a.jsxs("dl",{className:"sd-pop-rows",children:[a.jsxs("div",{className:"sd-pop-row",children:[a.jsx("dt",{children:e.to==="claude"?"Traffic to Claude":"Internet traffic"}),a.jsxs("dd",{children:["through ",uH(e)]})]}),e.relay&&a.jsxs("div",{className:"sd-pop-row",children:[a.jsx("dt",{children:"Relay"}),a.jsxs("dd",{children:[a.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&&a.jsxs("div",{className:"sd-pop-row",children:[a.jsx("dt",{children:"Round trip"}),a.jsx("dd",{children:t.ms==null?`${t.host} did not answer`:`${Rl(Od(t.ms))} to open a connection to ${t.host}`})]}),a.jsxs("div",{className:"sd-pop-row",children:[a.jsx("dt",{children:"Throughput"}),a.jsx("dd",{children:"every interface on this machine, not this path alone"})]})]})]})}function xj({usageOpen:e,leaving:t,sub:n,flag:r,onClose:s,children:i}){return a.jsxs("aside",{className:`sysdetail${e?" shifted":""}${t?" leaving":""}`,id:"system-panel","aria-labelledby":"sd-title",children:[a.jsxs("div",{className:"sd-top",children:[a.jsxs("div",{className:"sd-head",children:[a.jsx("h2",{className:"sd-title",id:"sd-title",children:"This machine"}),n&&a.jsx("span",{className:"sd-sub",children:n}),a.jsx("button",{type:"button",className:"glyph-btn sd-close",onClick:s,"aria-label":"Close",title:"Close",children:"×"})]}),r&&a.jsx("p",{className:"sd-flag",children:r})]}),i]})}function UH({usageOpen:e,leaving:t,onClose:n}){const r=hH();if(!r||r.cpu==null||!r.memory)return a.jsx(xj,{usageOpen:e,leaving:t,onClose:n,children:a.jsx("div",{className:"sd-note",children:"reading this machine…"})});const{memory:s,swap:i,perCore:l,loadavg:u,cores:d,uptimeSec:f,platform:h,thermal:p,network:g,cpu:w}=r;return a.jsxs(xj,{usageOpen:e,leaving:t,sub:`up ${lH(f)} · ${d} cores`,flag:cH(r),onClose:n,children:[a.jsx(zH,{cpu:w,perCore:l,loadavg:u,cores:d}),a.jsx(HH,{memory:s,swap:i,platform:h}),g&&a.jsx(qH,{network:g}),a.jsx(WH,{thermal:p}),a.jsx(VH,{sys:r})]})}function zH({cpu:e,perCore:t,loadavg:n,cores:r}){const s=!!t&&t.length>0;return!s&&!n?null:a.jsxs("div",{className:"sd-section sd-cpu",role:"group","aria-label":"CPU",children:[s&&a.jsx(Al,{group:"cores",title:"Core history",action:"Show core history",label:"CPU",value:e==null?null:`${Math.round(e)}%`,children:a.jsx("div",{className:"sd-cores",role:"img","aria-label":`${t.length} logical cores, busiest at ${Math.round(Math.max(...t))}%`,children:t.map((i,l)=>a.jsx("span",{className:"sd-core",title:`logical core ${l+1} · ${i}% busy`,children:a.jsx("span",{className:"sd-core-fill",style:{transform:`scaleY(${Math.max(2,i)/100})`}})},l))})}),n&&a.jsxs(Al,{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:[a.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((i,l)=>a.jsx(px,{value:i.toFixed(2),cap:["1m","5m","15m"][l]},l))}),n[0]>r&&a.jsx("div",{className:"sd-note",children:`${(n[0]/r).toFixed(1)}× more work queued than cores to run it`})]})]})}function HH({memory:e,swap:t,platform:n}){const r=e.total-e.available,s=n==="win32"?"Commit":"Swap",i=t&&t.total>0?t.used/t.total*100:0;return a.jsx("div",{className:"sd-section",role:"group","aria-label":"Memory",children:a.jsxs(Al,{group:"memory",title:"Memory history",action:"Show memory history",label:"Memory",children:[a.jsx(nd,{label:"Physical",value:a.jsxs(a.Fragment,{children:[a.jsx("b",{children:Na(r)})," of ",Na(e.total)]}),pct:e.usedPct,tone:e.usedPct>=90?"warn":"calm",note:`${Na(e.available)} available`}),t&&t.total>0&&a.jsx(nd,{label:s,value:a.jsxs(a.Fragment,{children:[a.jsx("b",{children:Na(t.used)})," of ",Na(t.total)]}),pct:i,tone:i>=90?"warn":"calm"})]})})}function WH({thermal:e}){if(!e)return null;const t=e.throttle?oH(e.throttle.speedLimit,e.heldBack):null;return a.jsx("div",{className:"sd-section",role:"group","aria-label":"Thermal",children:a.jsxs(Al,{group:"thermal",title:"Thermal history",action:"Show thermal history",label:"Thermal",children:[e.celsius.map(n=>a.jsx(nd,{label:n.label,value:a.jsxs(a.Fragment,{children:[a.jsx("b",{children:n.celsius})," °C"]}),pct:n.celsius/n.critAt*100,mark:n.warnAt/n.critAt*100,tone:aH(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&&a.jsx(nd,{label:"Throttling",value:a.jsx("b",{children:t.value}),pct:t.pct,tone:t.tone,note:t.note})]})})}function VH({sys:e}){const[t,n]=v.useState(!1);return a.jsxs("div",{className:"sd-section sd-door-section",children:[a.jsx("button",{type:"button",className:"sd-open sd-door",onClick:()=>n(!0),"aria-label":"Busiest processes: show every process the deck is watching",children:a.jsxs("span",{className:"sd-door-plate",children:[a.jsxs("span",{className:"sd-door-name",children:["Busiest processes",a.jsx("i",{className:"sd-row-more","aria-hidden":!0,children:"›"})]}),a.jsx("span",{className:"sd-door-sub",children:"every process, with its command line"})]})}),t&&a.jsx(OH,{sys:e,onClose:()=>n(!1)})]})}function BM(e){return{inputTokens:e.i,outputTokens:e.o,cacheReadTokens:e.cr,cacheCreateTokens:e.cc,cacheCreate1hTokens:e.c1h,cacheCreate5mTokens:e.c5m}}function GH(e){return{...BM(e),cacheCreate1hTokens:0,cacheCreate5mTokens:0}}function UM(e){return e.i+e.o+e.cr+e.cc}function bj(e){let t=0;for(const n of Object.values(e))t+=UM(n);return t}function KH(e){const t=s=>typeof s=="number"&&Number.isFinite(s)?s:0,n=new Map,r=e&&Array.isArray(e.days)?e.days:[];for(const s of r){const i=typeof s.period=="string"?s.period:"",l=Array.isArray(s.modelBreakdowns)?s.modelBreakdowns:[];for(const u of l){const d=typeof u.modelName=="string"?u.modelName:"";if(!i||!/claude/i.test(d)||u.missingPricing===!0)continue;const f=`${i}|${d}`,h=n.get(f),p=h?h.usage:{inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0,cacheCreate1hTokens:0,cacheCreate5mTokens:0};p.inputTokens+=t(u.inputTokens),p.outputTokens+=t(u.outputTokens),p.cacheReadTokens+=t(u.cacheReadTokens),p.cacheCreateTokens+=t(u.cacheCreationTokens),h?h.cost+=t(u.cost):n.set(f,{cost:t(u.cost),usage:p})}}return n}function YH(e,t,n,r=Date.now()){const s=new Map;let i=0,l=0;for(const[T,R]of n){const A=T.indexOf("|"),U=T.slice(0,A),I=T.slice(A+1),q=zo(R.usage,I,r).total;if(!(q>0&&R.cost>0))continue;i+=R.cost,l+=q;let P=s.get(U);P||(P=new Map,s.set(U,P)),P.set(I,R.cost/q)}const u=l>0,d=(T,R)=>{const A=s.get(T);return(A==null?void 0:A.get(R))??(A==null?void 0:A.get(ii(R)))??null},f=new Set,h=(T,R)=>{let A=0,U=0;for(const[I,q]of Object.entries(T)){if(qa(I,r)){const O=R(I);A+=O===null?zo(BM(q),I,r).total:zo(GH(q),I,r).total*O;continue}const P=UM(q);P>0&&(U+=P,f.add(I))}return{cost:A,unpriced:U}},p=new Map,g=[];for(const T of e){const R=new Map,A=new Map;let U=0;for(const I of T.projects){const{cost:q,unpriced:P}=h(I.models,V=>d(T.day,V));R.set(I.path,(R.get(I.path)??0)+q),P>0&&A.set(I.path,(A.get(I.path)??0)+P),U+=q;let O=p.get(I.path);O||(O={path:I.path,cost:0,tokens:0,unpricedTokens:0},p.set(I.path,O)),O.cost+=q,O.tokens+=bj(I.models),O.unpricedTokens+=P}g.push({day:T.day,total:U,byPath:R,unpricedByPath:A})}const w=[...p.values()].sort((T,R)=>R.cost-T.cost||R.tokens-T.tokens),k=w.reduce((T,R)=>T+R.cost,0),x=w.reduce((T,R)=>T+R.tokens,0),b=w.reduce((T,R)=>T+R.unpricedTokens,0),j=u?i/l:null,S=t?bj(t):0,_=t?h(t,()=>j):{cost:0,unpriced:0},E=_.cost>0||S>0?{cost:_.cost,tokens:S,unpricedTokens:_.unpriced}:null;return{projects:w,totalCost:k,totalTokens:x,unpricedTokens:b,perDay:g,unattributed:E,unpricedModels:[...f].sort(),calibrated:u,reconciled:u&&b===0}}function jr(e,t,n=Be){return t>0?e>0?`${n(e)}+`:ts:n(e)}function To(e){return e>0?`${st(e)} of these tokens are on an unpriced model, so this is a floor`:void 0}function XH(e){if(e.length===0)return null;const t=e.length===1,n=t?e[0]:`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`;return t?`${n} is ${ts}: this build holds no published rate for it, so its tokens are counted and its dollars are not.`:`${n} are ${ts}: this build holds no published rate for them, so their tokens are counted and their dollars are not.`}const ZH={phase:"running"},JH={phase:"failed"},QH={gen:0,report:null,error:null,early:null};function eW(e,t){var n,r;if(t.type!=="start"&&t.gen!==e.gen)return e;switch(t.type){case"start":return{...e,gen:t.gen,error:null,early:null};case"report":{const s=((n=e.early)==null?void 0:n.gen)===t.gen?e.early.cost:ZH;return{...e,report:{gen:t.gen,days:t.days,data:t.data,cost:s},early:null}}case"reportFailed":return{...e,report:null,error:t.message,early:null};case"cost":return((r=e.report)==null?void 0:r.gen)===t.gen?{...e,report:{...e.report,cost:t.cost}}:{...e,early:{gen:t.gen,cost:t.cost}}}}function tW(e){var t;return((t=e.report)==null?void 0:t.gen)!==e.gen&&e.error===null}function nW(e){const t=e;return t&&t.ok!==!1?{phase:"ready",range:t}:JH}function rW(e){return`${e.getFullYear()}${String(e.getMonth()+1).padStart(2,"0")}${String(e.getDate()).padStart(2,"0")}`}function sW(e,t,n=Date.now()){const r=t===0?60:t,s=new Date(n),i=hx(r,s),l=rW(s);return{report:`/api/account-projects?num=${e}&days=${t}`,ccusage:`/api/ccusage?since=${i}&until=${l}`}}function aW({num:e,days:t,gen:n,dispatch:r,get:s=(l,u)=>fetch(l,u),now:i=Date.now()}){const l=sW(e,t,i),u={credentials:"same-origin"};s(l.report,u).then(d=>d.ok?d.json():Promise.reject(new Error(`HTTP ${d.status}`))).then(d=>r({type:"report",gen:n,days:t,data:d}),d=>r({type:"reportFailed",gen:n,message:(d==null?void 0:d.message)||"Could not load"})),s(l.ccusage,u).then(d=>d.ok?d.json():null).catch(()=>null).then(d=>r({type:"cost",gen:n,cost:nW(d)}))}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(s=>window.setTimeout(()=>s(!1),t))])}catch{n=!1}if(n)return!0;try{const s=document.createElement("textarea");s.value=e,s.setAttribute("readonly",""),s.style.cssText="position:fixed;top:0;left:0;opacity:0",document.body.appendChild(s),s.select(),n=document.execCommand("copy"),s.remove()}catch{n=!1}return n}function zM(e){return/^[A-Za-z]:[\\/]$/.test(e)?e:e.replace(/[\\/]+$/,"")}function cp(e){const t=zM(e).replace(/\\/g,"/");return/^[A-Za-z]:\//.test(t)?t.toLowerCase():t}function kj(e){if(!e)return e;const t=zM(e),n=t.match(/^\/(?:Users|home)\/[^/]+(\/.*)?$/);if(n)return`~${n[1]??""}`;const r=t.replace(/\\/g,"/").match(/^[A-Za-z]:\/Users\/[^/]+(\/.*)?$/i);return r?`~${r[1]??""}`:t.replace(/\\/g,"/")}function oW(e,t){const n=cp(e);let r;for(const s of t){const i=cp(s.path);!i||i===n||!n.startsWith(`${i}/`)||(!r||cp(r.path).length<i.length)&&(r=s)}return r==null?void 0:r.label}function mx(e){return e===0?"all time":e===1?"today":`the last ${e} days`}function iW(e){return e===1?"No work attributed to this account yet today.":`No work attributed to this account in ${mx(e)}.`}function lW(e){return e===1?7:e===7?30:e===30?0:null}function cW(e,t){return e!==1&&t>0}const uW=[{days:1,label:"Today"},{days:7,label:"7d"},{days:30,label:"30d"},{days:0,label:"All"}],Ro=["var(--usage-blue)","var(--usage-teal)","var(--usage-lime)","var(--usage-purple)","var(--usage-indigo)","var(--usage-pink)","var(--usage-orange)","var(--usage-zinc)"],dW="var(--usage-zinc)",up=6,hW=1600;function fW(e){const t=Be(e),n=/^\$(\d{4,})$/.exec(t);return n?`$${Number(n[1]).toLocaleString("en-US")}`:t}function yu(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 pW(e){const t=/^\d{4}-(\d{2})-(\d{2})$/.exec(e);return t?`${Number(t[1])}/${Number(t[2])}`:e}function mW(e){const t=Math.max(1,Math.ceil(e/6));return n=>n===0||n===e-1||n%t===0}function dp(e){if(!e)return"";try{return new Date(e).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}catch{return""}}function gW({num:e,name:t,onClose:n}){var M,L,Y,K;const[r,s]=v.useState(1),[i,l]=v.useReducer(eW,QH),u=((M=i.report)==null?void 0:M.data)??null,d=((L=i.report)==null?void 0:L.days)??r,f=((Y=i.report)==null?void 0:Y.cost.phase)==="ready"?i.report.cost.range:null,h=((K=i.report)==null?void 0:K.cost.phase)==="running",[p,g]=v.useState(null),[w,k]=v.useState(()=>new Set),x=tW(i),b=i.error,[j,S]=v.useState(null),_=v.useRef(void 0),E=v.useRef(!0);v.useEffect(()=>()=>{E.current=!1,window.clearTimeout(_.current)},[]);const T=v.useRef(null),R=mt(n,{focusRef:T}),A=v.useRef(0);v.useEffect(()=>{const D=++A.current;l({type:"start",gen:D}),g(null),k(new Set),aW({num:e,days:r,gen:D,dispatch:l})},[e,r]);const U=v.useMemo(()=>{const D=Date.now();if(!u)return null;const z=YH(u.daily??[],u.unattributed,KH(f),D),F=he=>he.replace(/[\\/]+$/,"").split(/[\\/]/).pop()||he||"(unknown)",H=new Map;for(const he of z.projects)H.set(F(he.path),(H.get(F(he.path))??0)+1);const J=he=>{const se=F(he);if((H.get(se)??0)<=1)return se;const ke=he.replace(/[\\/]+$/,"").split(/[\\/]/).slice(-2,-1)[0];return ke?`${ke}/${se}`:se},W=z.projects.map(he=>({path:he.path,label:J(he.path)})),G=he=>({path:he.path,label:J(he.path),parentLabel:oW(he.path,W),cost:he.cost,tokens:he.tokens,unpricedTokens:he.unpricedTokens}),X=Ro[up%Ro.length],Z=new Map,ee=[],re=z.projects.slice(0,up),ce=z.projects.slice(up);re.forEach((he,se)=>{Z.set(he.path,Ro[se%Ro.length]),ee.push({key:he.path,...G(he),color:Ro[se%Ro.length]})}),ce.length&&ee.push({key:"__other__",label:`Other · ${ce.length} project${ce.length>1?"s":""}`,cost:ce.reduce((he,se)=>he+se.cost,0),tokens:ce.reduce((he,se)=>he+se.tokens,0),unpricedTokens:ce.reduce((he,se)=>he+se.unpricedTokens,0),color:X,muted:!0,members:ce.map(G)});const ie=z.totalCost,fe=z.totalTokens,de=ie>0&&z.unpricedTokens===0?"cost":"tokens",we=de==="cost"?ie:fe,xe=ee.map(he=>he.color),$e=z.perDay.map(he=>{const se=new Map;for(const[Oe,Le]of he.byPath){const Pe=Z.get(Oe)??X;se.set(Pe,(se.get(Pe)??0)+Le)}const ke=new Map;let Ce=0;for(const[Oe,Le]of he.unpricedByPath){const Pe=Z.get(Oe)??X;ke.set(Pe,(ke.get(Pe)??0)+Le),Ce+=Le}return{day:he.day,total:he.total,costByColor:se,unpricedByColor:ke,unpriced:Ce}}),be=$e.reduce((he,se)=>Math.max(he,se.total),0);return{projectCount:z.projects.length,rows:ee,totalCost:ie,totalTokens:fe,basis:de,denom:we,un:z.unattributed,chart:$e,maxDay:be,colorOrder:xe,unpricedTokens:z.unpricedTokens,unpricedNote:XH(z.unpricedModels),calibrated:z.calibrated,reconciled:z.reconciled}},[u,f]),I=(D,z)=>{Ba(D).then(F=>{E.current&&(window.clearTimeout(_.current),S({path:D,label:z,ok:F}),_.current=window.setTimeout(()=>{E.current&&S(null)},hW))})},q=D=>j!=null&&j.ok&&j.path===D?"Copied":"Copy",P=u!=null&&u.trackedSince?`Tracked since ${dp(u.trackedSince)}`:"Tracking starts with this version",O=mx(d),V=lW(d),$=x&&!!u;return Ot.createPortal(a.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:a.jsxs("div",{ref:R,className:"modal ap-proj-modal",onClick:D=>D.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"ap-proj-title ap-proj-sub",children:[a.jsxs("header",{className:"ap-proj-head",children:[a.jsxs("div",{className:"ap-proj-titlewrap",children:[a.jsx("div",{className:"ap-proj-title",id:"ap-proj-title",children:"Projects"}),a.jsx("div",{className:"ap-proj-sub",id:"ap-proj-sub",title:t,children:t})]}),a.jsx("div",{className:"uh-range",role:"group","aria-label":"Range",children:uW.map(D=>a.jsx("button",{type:"button",className:"uh-range-btn","aria-pressed":r===D.days,onClick:()=>s(D.days),children:D.label},D.days))}),a.jsx("button",{ref:T,className:"glyph-btn ap-proj-close",onClick:n,"aria-label":"Close",children:"×"})]}),a.jsxs("div",{className:`ap-proj-body${$?" refreshing":""}`,"aria-busy":x,children:[x&&!u&&a.jsx("div",{className:"ap-proj-state",children:"Loading…"}),!x&&b&&a.jsxs("div",{className:"ap-proj-state ap-proj-error",children:["Couldn’t load this report: ",b]}),!b&&U&&a.jsx(a.Fragment,{children:U.rows.length===0?a.jsxs("div",{className:"ap-proj-state",children:[$?"Updating…":iW(d),V!=null&&a.jsx("div",{className:"ap-proj-widen-wrap",children:a.jsxs("button",{type:"button",className:"ap-proj-copy",onClick:()=>s(V),children:["Show ",mx(V)]})}),a.jsxs("div",{className:"ap-proj-note",children:[P,". Only work from this version onward can be tied to an account."]})]}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"ap-proj-bar",role:"img","aria-label":`Share of ${U.basis==="cost"?Be(U.totalCost):`${st(U.totalTokens)} tokens`} across ${U.projectCount} project${U.projectCount>1?"s":""}`,children:U.rows.map(D=>{const z=U.basis==="cost"?D.cost:D.tokens,F=U.denom>0?z/U.denom*100:0;if(F<=0)return null;const H=U.basis==="cost"?yu(D.cost,U.totalCost):`${yu(D.tokens,U.totalTokens)} of tokens`;return a.jsx("span",{className:"ap-proj-seg",style:{width:`${F}%`,background:D.color},title:`${D.label} · ${jr(D.cost,D.unpricedTokens)} · ${H}${D.tokens?` · ${st(D.tokens)} tokens`:""}`},D.key)})}),a.jsxs("div",{className:"ap-proj-totals",children:[a.jsx("span",{className:"ap-proj-total-cost",title:To(U.unpricedTokens),children:jr(U.totalCost,U.unpricedTokens)}),a.jsxs("span",{className:"ap-proj-total-tok",children:[st(U.totalTokens)," tokens"]}),a.jsxs("span",{className:"ap-proj-total-win",children:["· ",$?"updating…":O]}),h&&a.jsx("span",{className:"ap-proj-total-pending",children:"Reconciling cost…"})]}),U.unpricedNote&&a.jsx("div",{className:"ap-proj-note",children:U.unpricedNote}),cW(d,U.chart.length)&&a.jsxs("div",{className:"ap-proj-days",children:[a.jsxs("div",{className:"ap-proj-days-cap",children:["By day",U.chart.length>1?" · click a bar":""]}),a.jsx("div",{className:"ap-proj-days-plot",role:"group","aria-label":`Spend across ${U.chart.length} day${U.chart.length>1?"s":""}`,children:U.chart.map(D=>{const z=U.maxDay>0?D.total/U.maxDay*100:0,F=p===D.day,H=U.rows.map(W=>({label:W.label,c:D.costByColor.get(W.color)??0,u:D.unpricedByColor.get(W.color)??0})).filter(W=>W.c>0||W.u>0),J=`${dp(Date.parse(`${D.day}T00:00:00`))}, ${jr(D.total,D.unpriced)}. ${H.map(W=>`${W.label} ${jr(W.c,W.u)}`).join(", ")}`;return a.jsx("button",{type:"button",className:`ap-proj-day${F?" selected":""}`,"aria-pressed":F,"aria-label":J,title:`${D.day} · ${jr(D.total,D.unpriced)}`,onClick:()=>g(W=>W===D.day?null:D.day),children:a.jsx("span",{className:"ap-proj-col",style:{height:`${z}%`},children:U.colorOrder.map((W,G)=>{const X=D.costByColor.get(W)??0;return X<=0||D.total<=0?null:a.jsx("span",{className:"ap-proj-colseg",style:{height:`${X/D.total*100}%`,background:W}},G)})})},D.day)})}),(()=>{const D=mW(U.chart.length);return a.jsx("div",{className:"ap-proj-days-axis","aria-hidden":"true",children:U.chart.map((z,F)=>a.jsx("div",{className:"ap-proj-axis-cell",children:D(F)?pW(z.day):""},z.day))})})(),(()=>{const D=p?U.chart.find(F=>F.day===p):null;if(!D)return null;const z=U.rows.map(F=>({r:F,c:D.costByColor.get(F.color)??0,u:D.unpricedByColor.get(F.color)??0})).filter(F=>F.c>0||F.u>0);return a.jsxs("div",{className:"ap-proj-day-detail",children:[a.jsxs("div",{className:"ap-proj-day-detail-head",children:[a.jsx("span",{children:dp(Date.parse(`${D.day}T00:00:00`))}),a.jsx("span",{className:"ap-proj-day-detail-total",title:To(D.unpriced),children:jr(D.total,D.unpriced)})]}),z.map(({r:F,c:H,u:J})=>a.jsxs("div",{className:"ap-proj-day-detail-row",children:[a.jsx("span",{className:"ap-proj-dot",style:{background:F.color},"aria-hidden":"true"}),a.jsx("span",{className:"ap-proj-day-detail-name",children:F.label}),a.jsx("span",{className:"ap-proj-day-detail-cost",title:To(J),children:jr(H,J)})]},F.key))]})})()]}),a.jsx("ul",{className:"ap-proj-list",children:U.rows.map((D,z)=>{const F=U.basis==="cost"?D.cost:D.tokens,H=U.denom>0?F/U.denom*100:0,J=w.has(D.key),W=`ap-proj-details-${z}`,G=J&&(!!D.path||!!D.members),X=D.members?`${J?"Hide":"Show"} the ${D.members.length} project${D.members.length>1?"s":""} folded into Other`:`${J?"Hide":"Show"} location for ${D.label}`;return a.jsxs("li",{className:`ap-proj-row${D.muted?" muted":""}${J?" expanded":""}`,children:[a.jsx("span",{className:"ap-proj-dot",style:{background:D.color},"aria-hidden":"true"}),a.jsxs("span",{className:"ap-proj-name",children:[D.label,D.parentLabel&&a.jsxs("span",{className:"ap-proj-parent",children:[" · in ",D.parentLabel]})]}),a.jsx("span",{className:"ap-proj-track",title:U.basis==="cost"?`${yu(D.cost,U.totalCost)} of tracked cost`:`${yu(D.tokens,U.totalTokens)} of tracked tokens`,children:a.jsx("span",{className:"ap-proj-fill",style:{width:`${H}%`,background:D.color}})}),a.jsx("span",{className:"ap-proj-cost",title:To(D.unpricedTokens),children:jr(D.cost,D.unpricedTokens)}),a.jsx("span",{className:"ap-proj-tok",children:st(D.tokens)}),a.jsx("button",{type:"button",className:"glyph-btn ap-proj-info","aria-expanded":J,"aria-controls":G?W:void 0,"aria-label":X,onClick:()=>k(Z=>{const ee=new Set(Z);return ee.has(D.key)?ee.delete(D.key):ee.add(D.key),ee}),children:"ⓘ"}),J&&D.path&&a.jsxs("div",{className:"ap-proj-details",id:W,children:[a.jsx("code",{className:"ap-proj-path",children:kj(D.path)}),a.jsx("button",{type:"button",className:"ap-proj-copy","aria-label":`${q(D.path)} location for ${D.label}`,onClick:()=>I(D.path,D.label),children:q(D.path)})]}),J&&D.members&&a.jsx("div",{className:"ap-proj-details ap-proj-other-members",id:W,children:D.members.map(Z=>a.jsxs("div",{className:"ap-proj-other-member",children:[a.jsxs("div",{className:"ap-proj-other-name",children:[Z.label,Z.parentLabel&&a.jsxs("span",{className:"ap-proj-parent",children:[" · in ",Z.parentLabel]})]}),a.jsx("code",{className:"ap-proj-path",children:kj(Z.path)}),a.jsx("span",{className:"ap-proj-cost",title:To(Z.unpricedTokens),children:jr(Z.cost,Z.unpricedTokens)}),a.jsx("span",{className:"ap-proj-tok",children:st(Z.tokens)}),a.jsx("button",{type:"button",className:"ap-proj-copy","aria-label":`${q(Z.path)} location for ${Z.label}`,onClick:()=>I(Z.path,Z.label),children:q(Z.path)})]},Z.path))})]},D.key)})}),U.un&&a.jsxs("div",{className:"ap-proj-unattributed",children:[a.jsx("span",{className:"ap-proj-dot",style:{background:dW},"aria-hidden":"true"}),a.jsxs("div",{className:"ap-proj-un-labels",children:[a.jsx("span",{className:"ap-proj-un-title",children:"Unattributed usage"}),a.jsx("span",{className:"ap-proj-un-tag",children:"Excluded from the project totals"})]}),a.jsx("span",{className:"ap-proj-un-cost",title:To(U.un.unpricedTokens),children:jr(U.un.cost,U.un.unpricedTokens,fW)}),a.jsx("span",{className:"ap-proj-un-tok",children:st(U.un.tokens)}),a.jsx("div",{className:"ap-proj-note",children:"Work no account could be tied to — from before tracking, or a gap."})]}),a.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:j&&(j.ok?`Copied the location of ${j.label}`:`Could not copy the location of ${j.label} — select it and copy it by hand`)}),a.jsxs("div",{className:"ap-proj-foot",children:[h?"Dollars estimated · ccusage still running":U.reconciled?"Dollars from ccusage · split by activity":U.calibrated?"Dollars from ccusage for the priced models · split by activity":f?"Dollars estimated · ccusage could not price this window":"Dollars estimated · ccusage unavailable"," · ",P]})]})})]})]})}),document.body)}function ti(e,t){return mM(t-Math.floor(e/1e3))}function yW(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 E0(){return a.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:[a.jsx("path",{d:"M7 1.9 12.9 12H1.1Z"}),a.jsx("path",{d:"M7 5.6v2.9"}),a.jsx("path",{d:"M7 10.3v.05"})]})}function wW({anchorId:e,boundaryId:t,issue:n,who:r,fetchedAt:s,nowSec:i,onClose:l,onSignIn:u}){return a.jsx(_0,{anchorId:e,boundaryId:t,id:"ap-issue-pop",className:"ap-pop ap-issue-pop",role:"dialog",labelledBy:"ap-issue-title",onClose:()=>l(),children:a.jsxs("div",{className:"ap-pop-form",children:[a.jsxs("p",{className:"ap-pop-title ap-issue-title",id:"ap-issue-title","data-tone":n.tone,children:[n.tone==="warn"&&a.jsx(E0,{}),n.text]}),a.jsx("p",{className:"ap-pop-note ap-issue-hint",children:n.hint}),a.jsxs("p",{className:"ap-pop-note ap-issue-when",children:[a.jsx("span",{className:"ap-issue-who",children:r})," · ",s?`last collected ${ti(s,i)}`:"never collected"]}),a.jsxs("div",{className:"ap-pop-actions",children:[a.jsx("button",{type:"button",className:"btn",onClick:()=>l(!0),children:"Done"}),n.fix&&a.jsx("button",{type:"button",className:"btn primary",onClick:()=>{l(!0),u()},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:n.fix})]})]})})}function ol(e){return e.charAt(0).toUpperCase()+e.slice(1)}function vW(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)),s=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} ${s} It tries again in ${r}m. No sign-in, no switch.`}}return{text:"numbers paused",hint:n}}function xW(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 bW(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 ni(e,t){if(e.staleCopy){const n=vW(e.repair??null,t);return{text:ol(n.text),hint:n.hint,fix:null,tone:"quiet",blocksSwitch:!1}}if(e.stopped){const n=bW(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:ol(n.text),hint:n.hint,fix:n.fix?ol(n.fix):null,tone:r||e.collector==="keychain_unavailable"?"warn":"quiet",blocksSwitch:r}}if(e.error){const n=xW(e.error);return{text:ol(n.text),hint:n.hint,fix:n.fixable?"Sign in again":null,tone:n.fixable?"warn":"quiet",blocksSwitch:n.fixable}}return null}function Nj(e){return typeof e.id=="string"&&e.id.startsWith("scoped-")}function kW(e){const t=e.filter(u=>!Nj(u)),n=e.filter(u=>Nj(u)),r=t.length?t:n,s=t.length?n:[],i=r.reduce((u,d)=>u&&u.pct>=d.pct?u:d,null);let l=null;for(const u of s)i&&u.pct<=i.pct||(!l||u.pct>l.pct)&&(l=u);return{shown:r,rest:s,fuller:l,peak:l??i}}const NW="\0";function _r(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}${NW}${n}`}function jW(e,t,n=_r){const r=n(t);return e.includes(r)?e.filter(s=>s!==r):[...e,r]}const Pd="slot",C0=[{lane:"five_hour",name:"5h"},{lane:"seven_day",name:"7d"}],HM=e=>e.id.startsWith("scoped-");function SW(e){var t;return((t=C0.find(n=>n.lane===e.id))==null?void 0:t.name)??e.label}function _W(e){if(e==="room")return"room";const t=/^(.+):(full|empty)$/.exec(e);return t?t[1]:null}function WM(e){const t=[...new Set(e.flatMap(r=>(r.lanes??[]).filter(HM).map(s=>s.label)))].sort((r,s)=>r.localeCompare(s)),n=[...C0.map(r=>r.name),...t];return[{id:Pd,label:"Slot"},...n.flatMap(r=>[{id:`${r}:full`,label:`${r} · fullest`},{id:`${r}:empty`,label:`${r} · emptiest`}]),{id:"room",label:"Most room"}]}function jj(e,t){const n=C0.find(s=>s.name===t),r=(e.lanes??[]).find(s=>n?s.id===n.lane:HM(s)&&s.label===t);return r&&Number.isFinite(r.pct)?r.pct:null}function EW(e,t,n=()=>!0){const r=[...e],s=f=>[...f.filter(n),...f.filter(h=>!n(h))];if(t==="room")return s(Sj(r,f=>Number.isFinite(f.headroom)?f.headroom:null,"desc"));const i=/^(.+):(full|empty)$/.exec(t);if(!i)return r;const[,l,u]=i;if(!r.some(f=>jj(f,l)!=null))return r;const d=Sj(r,f=>jj(f,l),u==="full"?"desc":"asc");return u==="empty"?s(d):d}function Sj(e,t,n){const r=e.filter(i=>t(i)!=null),s=e.filter(i=>t(i)==null);return r.sort((i,l)=>n==="desc"?t(l)-t(i):t(i)-t(l)),[...r,...s]}function CW(e,t){return WM(t).some(n=>n.id===e)?e:Pd}function VM(e,t){if(!t)return[...e];const n=new Map(t.map((i,l)=>[i,l])),r=e.filter(i=>n.has(_r(i))).sort((i,l)=>n.get(_r(i))-n.get(_r(l))),s=e.filter(i=>!n.has(_r(i)));return[...r,...s]}function T0(e){const t=_r(e);return t.startsWith("slot:")?t:`h:${TW(t)}`}function TW(e){let t=3735928559,n=1103547991;for(let r=0;r<e.length;r++){const s=e.charCodeAt(r);t=Math.imul(t^s,2654435761),n=Math.imul(n^s,1597334677)}return t=Math.imul(t^t>>>16,2246822507)^Math.imul(n^n>>>13,3266489909),n=Math.imul(n^n>>>16,2246822507)^Math.imul(t^t>>>13,3266489909),(4294967296*(2097151&n)+(t>>>0)).toString(36)}const gx={mode:"some",keys:[]};function GM(e,t){const n=e.keys.includes(T0(t));return e.mode==="all"?!n:n}function RW(e,t){return{mode:e.mode,keys:jW(e.keys,t,T0)}}function KM(e,t){return t.length>0&&t.every(n=>GM(e,n))}function AW(e,t){return KM(e,t)?gx:{mode:"all",keys:[]}}function MW(e,t){if(!Array.isArray(t))return e;const n=new Set(t.map(T0)),r=e.keys.filter(s=>n.has(s));return r.length===e.keys.length?e:{mode:e.mode,keys:r}}function $W(e){return e>=90?"hi":e>=70?"mid":void 0}function IW({lane:e,nowSec:t,frozen:n,sortedBy:r}){const s=Math.min(100,Math.max(0,e.pct)),i=n?"var(--muted)":s>=90?"var(--err)":s>=70?"var(--warn)":"var(--accent)",l=e.resetAt&&!n?Ad(e.resetAt,t):null;return a.jsxs("div",{className:"ap-lane","data-sort-key":r?"":void 0,children:[a.jsx("span",{className:"ap-lane-label",title:e.label,children:e.label}),a.jsx("div",{className:"ap-lane-track",children:a.jsx("div",{className:"ap-lane-fill",style:{width:`${s===0?1.5:s}%`,background:i,opacity:s===0||n?.4:1}})}),a.jsxs("span",{className:"ap-lane-pct",style:{color:i},children:[s,"%"]}),a.jsx("span",{className:"ap-lane-reset",title:l?`${e.label} resets in ${l}`:void 0,children:l&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"vis-hidden",children:"resets in "}),l]})})]})}function OW({a:e,nowSec:t,opened:n,onToggleLanes:r,busy:s,pressProps:i,onSwitch:l,menuOpen:u,onOpenMenu:d,onCloseMenu:f,refusal:h,onDismissRefusal:p,switchedHere:g,swapped:w,displaced:k,issueExpanded:x,onOpenIssue:b,sortKey:j=null}){const{shown:S,fuller:_}=kW(e.lanes),E=j==="room"?e.lanes.reduce((O,V)=>O&&O.pct>=V.pct?O:V,null):j?e.lanes.find(O=>SW(O)===j)??null:null,T=ni(e,t),R=e.active||n,A=e.alias??e.email??`account ${e.num}`,U=e.alias&&e.email?`${e.alias} · ${e.email}`:A,I=e.stale||(T==null?void 0:T.blocksSwitch)===!0,q=_?[...S,_]:S,P=e.fetchedAt?ti(e.fetchedAt,t):null;return a.jsxs("li",{className:`ap-account${e.active?" active":""}`,"aria-current":e.active?"true":void 0,"data-open":R?"":void 0,"data-frozen":I?"":void 0,children:[!e.active&&a.jsx("button",{type:"button",className:"ap-row-open",id:`ap-row-${e.num}`,title:U,"aria-expanded":R,"aria-controls":R?`ap-detail-${e.num}`:void 0,"aria-describedby":[e.alias&&e.email?`ap-email-${e.num}`:null,!R&&!(T!=null&&T.blocksSwitch)?`ap-quota-${e.num}`:null].filter(Boolean).join(" ")||void 0,onClick:()=>r(),children:a.jsxs("span",{className:"vis-hidden",children:[A,", ",R?"hide details":"details"]})}),a.jsxs("div",{className:"ap-account-head",children:[e.active?a.jsx("span",{className:"ap-live",title:`Active account · slot ${e.num}`,children:a.jsxs("span",{className:"vis-hidden",children:["Active account, slot ",e.num,":"]})}):a.jsx("span",{className:"ap-num",children:e.num}),e.alias&&a.jsx("span",{className:"ap-alias",title:e.alias,children:e.alias}),a.jsx("span",{className:"ap-email",id:`ap-email-${e.num}`,title:e.email??void 0,children:e.email}),e.disabled&&a.jsx("span",{className:"ap-held",children:"held out"}),!e.active&&!e.disabled&&!(T!=null&&T.blocksSwitch)&&a.jsx("button",{type:"button",className:"ap-switch",...i(`switch-${e.num}`),onClick:()=>l(e.num,A),"aria-label":`Switch to ${A}`,title:`Switch to ${e.alias??e.email}`,children:s===`switch-${e.num}`?"…":"Switch"}),a.jsx("button",{type:"button",id:`ap-more-${e.num}`,className:"ap-more","aria-label":`More actions for ${e.email??e.alias??`account ${e.num}`}`,"aria-haspopup":"menu","aria-expanded":u,"aria-controls":u?`ap-menu-${e.num}`:void 0,title:"More actions",onClick:()=>u?f():d(e.num),onKeyDown:O=>{O.key!=="ArrowDown"&&O.key!=="ArrowUp"||(O.preventDefault(),d(e.num,O.key==="ArrowUp"?"last":"first"))},children:a.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"currentColor","aria-hidden":!0,children:[a.jsx("circle",{cx:"2.8",cy:"7",r:"1.15"}),a.jsx("circle",{cx:"7",cy:"7",r:"1.15"}),a.jsx("circle",{cx:"11.2",cy:"7",r:"1.15"})]})})]}),h&&a.jsxs("div",{className:"ap-failure ap-row-failure",role:"alert",children:[a.jsx("span",{className:"ap-failure-text",title:h.raw||void 0,children:h.text}),a.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>p(),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),e.active&&g&&a.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."}),w&&(()=>{const O=(k==null?void 0:k.alias)??(k==null?void 0:k.email)??"the account that was there";return a.jsxs("p",{className:"ap-note ap-swap-note",title:`Slot ${w.at} was taken, so the two accounts traded places: ${O} now holds slot ${w.displaced}.`,children:["swapped with slot ",w.displaced]})})(),T&&a.jsxs("div",{className:"ap-issue-line",children:[a.jsxs("button",{type:"button",id:`ap-issue-${e.num}`,className:"ap-issue","data-tone":T.tone,"aria-haspopup":"dialog","aria-expanded":x,"aria-controls":x?"ap-issue-pop":void 0,onClick:()=>b(e.num,`ap-issue-${e.num}`),children:[T.tone==="warn"&&a.jsx(E0,{}),a.jsx("span",{className:"ap-issue-text",children:T.text})]}),!R&&a.jsx("span",{className:"ap-issue-age",title:"When claude-swap last read this account's usage",children:P??"never collected"})]}),!R&&!(T!=null&&T.blocksSwitch)&&a.jsxs("p",{className:"ap-quota",id:`ap-quota-${e.num}`,children:[q.length?q.map(O=>a.jsxs("span",{className:"ap-q","data-sort-key":O.id===(E==null?void 0:E.id)?"":void 0,children:[a.jsx("span",{className:"ap-q-label",children:O.label})," ",a.jsxs("span",{className:"ap-q-pct","data-level":I?void 0:$W(O.pct),children:[Math.round(O.pct),"%"]})]},O.id)):a.jsx("span",{className:"ap-q-label",children:"no usage recorded yet"}),e.stale&&!T&&a.jsx("span",{className:"ap-q-age","data-never":P?void 0:"",title:"When claude-swap last read this account's usage",children:P??"never collected"})]}),R&&a.jsxs("div",{className:"ap-detail",id:`ap-detail-${e.num}`,children:[a.jsx("div",{className:"ap-lanes",children:e.lanes.length?e.lanes.map(O=>a.jsx(IW,{lane:O,nowSec:t,frozen:I,sortedBy:O.id===(E==null?void 0:E.id)},O.id)):a.jsx("div",{className:"ap-hint",children:"No usage recorded yet."})}),a.jsx("div",{className:"ap-meta",children:e.fetchedAt?a.jsxs("span",{className:`ap-age${e.stale&&!T?" 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 ",ti(e.fetchedAt,t),T!=null&&T.blocksSwitch?"":yW(e.nextAt,t)]}):a.jsx("span",{className:"ap-age ap-stale",title:"claude-swap has not read this account yet",children:"never collected"})})]})]})}function LW({data:e}){return a.jsx("div",{className:"ap-empty",children:e.reason==="cswap_installing"?a.jsxs(a.Fragment,{children:[a.jsx("span",{children:"Installing claude-swap…"}),a.jsx("span",{className:"ap-hint",children:"The deck is setting it up in the background, so there is nothing to do here. On a new machine this can take a few minutes; the panel fills in by itself when it is done."})]}):e.reason==="no_cswap"?a.jsxs(a.Fragment,{children:[a.jsx("span",{children:"claude-swap isn't installed."}),a.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."}),e.hint&&a.jsx("code",{className:"ap-cmd",children:e.hint}),a.jsxs("span",{className:"ap-hint",children:["Then add an account with the ",a.jsx("strong",{children:"+"})," button above."]})]}):e.reason==="cswap_refused"?a.jsxs(a.Fragment,{children:[a.jsx("span",{children:"claude-swap was installed, but not the version the deck asked for."}),a.jsxs("span",{className:"ap-hint",children:[e.version?`v${e.version} answered`:"A different version answered",e.want?` where ${e.want} was asked for`:"",", so the deck is not driving it. Install the version it asked for, or set AGENTS_DECK_CSWAP to a claude-swap you trust."]})]}):e.reason==="no_accounts"?a.jsxs(a.Fragment,{children:[a.jsx("span",{children:"No accounts added yet."}),a.jsxs("span",{className:"ap-hint",children:["claude-swap is installed but has nothing in its store. Use the ",a.jsx("strong",{children:"+"})," above to sign one in, or to paste one shared from another deck."]})]}):a.jsxs(a.Fragment,{children:[a.jsx("span",{children:"Couldn't read the account store."}),a.jsxs("span",{className:"ap-hint",children:["claude-swap is installed, but its store could not be read",e.reason?` (${e.reason})`:"","."]})]})})}function PW({canShare:e,canReport:t,onAdd:n,onReport:r,onShareSet:s,onReload:i,pressProps:l,reloading:u,closeButton:d}){return a.jsxs("div",{className:"ap-header",children:[a.jsx("h2",{children:"Claude accounts"}),a.jsxs("div",{className:"ap-header-right",children:[a.jsx("button",{type:"button",className:"glyph-btn ap-add",onClick:()=>n(),"aria-label":"Add an account",title:"Sign in to another Claude account, or paste one shared from another deck",children:a.jsx("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round","aria-hidden":!0,children:a.jsx("path",{d:"M7 2.2v9.6M2.2 7h9.6"})})}),t&&a.jsx("button",{type:"button",className:"glyph-btn",onClick:()=>r(),"aria-label":"Account capacity","aria-haspopup":"dialog",title:"Account capacity — how many accounts are ready, and what the 5h and 7d windows have left",children:a.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round","aria-hidden":!0,children:[a.jsx("path",{d:"M2.5 10.9A5.2 5.2 0 1 1 11.5 10.9"}),a.jsx("path",{d:"M7 8.3l2.1-2.1"})]})}),e&&a.jsx("button",{type:"button",className:"glyph-btn",onClick:()=>s(),"aria-label":"Share accounts with another deck",title:`Copy several accounts to another ${vt} in one paste. The text carries a live login for each one — treat it as those passwords.`,children:a.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:[a.jsx("path",{d:"M3.3 10.7L10.7 3.3"}),a.jsx("path",{d:"M5.5 3.3h5.2v5.2"})]})}),a.jsx("button",{type:"button",className:"glyph-btn ap-refresh",onClick:()=>i(),...l("reload",u),"aria-label":"Reload accounts",title:"Reload from claude-swap",children:a.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:[a.jsx("path",{d:"M11.6 6.2A4.8 4.8 0 1 0 11 9.6"}),a.jsx("path",{d:"M11.9 2.6v3.7h-3.6"})]})}),d]})]})}const Ma=[{id:"five_hour",label:"5h",long:"5-hour"},{id:"seven_day",label:"7d",long:"7-day"}];function _j(e){return e.counted?e.pct:e.why==="login"?null:e.estimate}function DW(e){const t=_j(e.five_hour),n=_j(e.seven_day);if(t==null||n==null)return"stale";const r=+(t>=100)+ +(n>=100);return r===0?"ready":r===1?"limited":"exhausted"}function FW(e,t){const n=Ma.map(r=>e.cells[r.id]);for(const r of n)if(!r.counted&&(r.why==="login"||r.why==="none"))return{text:r.say,old:!0};return e.updatedAt==null?{text:"never read",old:!0}:n.every(r=>r.counted)?{text:"now",old:!1}:{text:ti(e.updatedAt,t),old:!0}}const qW=15*6e4,BW=e=>e.alias??e.email??`account ${e.num}`;function Ej(e,t,n){const r=Ma.find(h=>h.id===t).label,s=(e.lanes??[]).find(h=>h.id===t),i=s&&Number.isFinite(s.pct)?UW(s.pct):null,l=ni(e,n),u=(s==null?void 0:s.resetAt)!=null&&s.resetAt<=n,d=(h,p)=>({counted:!1,why:h,say:p,last:i,estimate:i==null?null:u?0:i,resetAt:u?null:(s==null?void 0:s.resetAt)??null});return l!=null&&l.blocksSwitch?d("login",l.text):i==null?d("none",`No ${r} reading`):e.stale||e.fetchedAt==null||n*1e3-e.fetchedAt>qW?d("stale",e.fetchedAt?`Updated ${ti(e.fetchedAt,n)}`:"Never read"):u?d("reset",`Reset ${ti(s.resetAt*1e3,n)}, not updated`):{counted:!0,pct:i,resetAt:s.resetAt}}const UW=e=>Math.min(100,Math.max(0,e));function zW(e,t){const n=Ma.find(f=>f.id===t);let r=0,s=0,i=0;const l=[];for(const f of e){const h=f.cells[t],p=h.counted?h.pct:h.estimate;p!=null&&(r+=p,i++,h.counted&&s++,h.resetAt!=null&&l.push({at:h.resetAt,name:f.name,pct:p}))}const u=l.reduce((f,h)=>!f||h.at<f.at?h:f,null),d=u&&{...u,more:l.filter(f=>f!==u&&f.at-u.at<60).length};return{id:t,label:n.label,long:n.long,reporting:s,included:i,total:e.length,used:i?r/i:null,nextReset:d}}function HW(e,t){const n=e.map(s=>{const i={five_hour:Ej(s,"five_hour",t),seven_day:Ej(s,"seven_day",t)};return{num:s.num,key:_r(s),name:BW(s),active:s.active,heldOut:s.disabled===!0,cells:i,status:DW(i),updatedAt:s.fetchedAt??null}}),r=n.filter(s=>s.status==="ready").length;return{rows:n,windows:Ma.map(s=>zW(n,s.id)),roomInBoth:r}}function rd(e){return e>=100?100:Math.min(99,Math.round(e))}function WW(e){const t=rd(e);return{used:t,available:100-t}}function VW(e,t,n){return e?`${e} These are the last readings.`:t&&n?"The account store could not be read just now. These are the last readings.":null}function YM(e){return e>=90?"hi":e>=70?"mid":void 0}const XM=(e,t,n)=>`${e} ${e===1?t:n}`;function Cj(e){const t=e.more>0?`, and ${XM(e.more,"more account","more accounts")} in the same minute`:"";return`First: ${e.name} (${rd(e.pct)}% used)${t}`}function GW({w:e,nowSec:t}){const n=`ap-report-${e.id}`,r=e.total-e.included,s=r>0&&a.jsxs("p",{className:"ap-report-basis",children:[r," never read"]}),{used:i,available:l}=WW(e.used??0),u=Math.round(ja(l,{countIn:!0}));if(e.used==null)return a.jsxs("section",{className:"ap-report-sum","aria-labelledby":n,children:[a.jsxs("h3",{className:"ap-report-win",id:n,children:[e.long," window"]}),a.jsxs("p",{className:"ap-report-none",children:["No account has a ",e.long," reading yet."]}),s]});const d=e.nextReset?Ad(e.nextReset.at,t):null;return a.jsxs("section",{className:"ap-report-sum","aria-labelledby":n,children:[a.jsxs("h3",{className:"ap-report-win",id:n,children:[e.long," window"]}),a.jsxs("p",{className:"ap-report-left",children:[a.jsxs("b",{children:[u,"%"]})," remaining"]}),a.jsx("div",{className:"ap-report-meter","data-level":YM(i),"aria-hidden":!0,children:a.jsx("i",{style:{"--left":l/100}})}),d&&e.nextReset&&a.jsxs("p",{className:"ap-report-reset",title:Cj(e.nextReset),children:[a.jsxs("span",{children:["Next reset in ",a.jsx("span",{className:"ap-report-num",children:d})]}),a.jsx("span",{"aria-hidden":!0,children:"·"}),a.jsx("span",{className:"ap-report-who",children:e.nextReset.name}),e.nextReset.more>0&&a.jsxs("span",{className:"ap-report-more",children:["+",e.nextReset.more]}),a.jsxs("span",{className:"vis-hidden",children:[". ",Cj(e.nextReset)]})]}),s]})}function KW({cell:e,nowSec:t}){if(!e.counted)return a.jsxs("td",{className:"ap-report-cell","data-uncounted":"",children:[a.jsx("span",{className:"ap-report-pct",children:e.last==null?a.jsxs(a.Fragment,{children:[a.jsx("span",{"aria-hidden":!0,children:"—"}),a.jsx("span",{className:"vis-hidden",children:"no reading"})]}):`${rd(e.last)}%`}),a.jsx("span",{className:"vis-hidden",children:", not counted"})]});const n=e.resetAt!=null?Ad(e.resetAt,t):null;return a.jsxs("td",{className:"ap-report-cell",children:[a.jsxs("span",{className:"ap-report-pct","data-level":YM(e.pct),children:[rd(e.pct),"%"]}),n&&a.jsxs("span",{className:"ap-report-in",children:[a.jsx("span",{className:"vis-hidden",children:"resets in "}),n]})]})}const YW={ready:"Ready",limited:"Limited",exhausted:"Exhausted",stale:"Stale"};function XW({row:e}){return a.jsx("td",{className:"ap-report-state","data-status":e.status,children:a.jsxs("span",{className:"ap-report-state-word",children:[a.jsx("i",{"aria-hidden":!0}),YW[e.status]]})})}function ZW({row:e,nowSec:t}){const n=FW(e,t);return a.jsx("td",{className:"ap-report-upd","data-old":n.old?"":void 0,children:n.text})}function JW(){return a.jsxs("svg",{className:"ap-report-how-mark",viewBox:"0 0 16 16",width:"12",height:"12","aria-hidden":!0,focusable:"false",children:[a.jsx("circle",{cx:"8",cy:"8",r:"6.5",fill:"none",stroke:"currentColor",strokeWidth:"1.4"}),a.jsx("path",{d:"M8 7.2v4.1M8 4.8v.1",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"})]})}function QW({accounts:e,nowSec:t,held:n}){const r=HW(e,t),s=r.rows.length,i=Math.round(ja(r.roomInBoth,{countIn:!0}));return a.jsxs("div",{className:"ap-proj-body ap-report-body",role:"region","aria-label":"Report",children:[n&&a.jsx("p",{className:"ap-report-held",children:n}),a.jsxs("p",{className:"ap-report-lead",children:[a.jsx("b",{children:i})," of ",XM(s,"Claude account","Claude accounts")," ready"]}),a.jsx("div",{className:"ap-report-sums",children:r.windows.map(l=>a.jsx(GW,{w:l,nowSec:t},l.id))}),a.jsxs("table",{className:"ap-report-table",children:[a.jsx("caption",{className:"vis-hidden",children:"Each account's use of each window, and what it can do now"}),a.jsxs("colgroup",{children:[a.jsx("col",{}),Ma.map(l=>a.jsx("col",{className:"ap-report-col-win"},l.id)),a.jsx("col",{className:"ap-report-col-state"}),a.jsx("col",{className:"ap-report-col-upd"})]}),a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{scope:"col",children:"Account"}),Ma.map(l=>a.jsxs("th",{scope:"col",children:[l.label," used"]},l.id)),a.jsx("th",{scope:"col",children:"Status"}),a.jsx("th",{scope:"col",className:"ap-report-upd-h",children:"Updated"})]})}),a.jsx("tbody",{children:r.rows.map((l,u)=>a.jsxs("tr",{"data-active":l.active?"":void 0,style:{"--row":u},children:[a.jsx("th",{scope:"row",className:"ap-report-acct",children:a.jsxs("span",{className:"ap-report-acct-in",children:[a.jsx("span",{className:"ap-report-name",title:l.name,children:l.name}),l.active&&a.jsx("span",{className:"ap-report-current",children:"Current"}),l.heldOut&&a.jsx("span",{className:"ap-report-tag",children:"held out"})]})}),Ma.map(d=>a.jsx(KW,{cell:l.cells[d.id],nowSec:t},d.id)),a.jsx(XW,{row:l}),a.jsx(ZW,{row:l,nowSec:t})]},l.num))})]}),a.jsxs("details",{className:"ap-report-how",children:[a.jsxs("summary",{children:[a.jsx(JW,{}),"How usage is calculated"]}),a.jsxs("div",{className:"ap-report-how-body",children:[a.jsxs("p",{children:["Every account here, at its last reading: ",a.jsx("b",{children:"used"})," is their average, and ",a.jsx("b",{children:"remaining"})," is the rest."]}),a.jsxs("p",{children:[a.jsx("b",{children:"Ready"})," has room in both windows. ",a.jsx("b",{children:"Limited"})," is at the limit of one, and ",a.jsx("b",{children:"Exhausted"})," of both. ",a.jsx("b",{children:"Stale"})," was never read, or is signed out."]})]})]})]})}function e7({accounts:e,order:t,failed:n,nowSec:r,onClose:s}){const i=v.useRef(null),l=mt(s,{focusRef:i}),[u,d]=v.useState(e??[]);v.useEffect(()=>{e&&e.length>0&&d(e)},[e]);const f=VW(n,!e||e.length===0,u.length>0),h=VM(u,t);return Ot.createPortal(a.jsx("div",{className:"modal-backdrop",onClick:s,role:"presentation",children:a.jsxs("div",{ref:l,className:"modal ap-report-modal",onClick:p=>p.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"ap-report-title",children:[a.jsxs("header",{className:"ap-proj-head",children:[a.jsx("div",{className:"ap-proj-titlewrap",children:a.jsx("h2",{className:"ap-proj-title",id:"ap-report-title",children:"Account capacity"})}),a.jsx("button",{ref:i,type:"button",className:"glyph-btn ap-proj-close",onClick:s,"aria-label":"Close",children:"×"})]}),a.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:f??""}),a.jsx(QW,{accounts:h,nowSec:r,held:f})]})}),document.body)}const hp=[70,80,85,90,95];function t7(e){const t=Number(e);return[...Number.isFinite(t)&&t>0&&!hp.includes(t)?[...hp,t]:hp].sort((r,s)=>r-s)}function n7({auto:e,threshold:t,thresholdPick:n,thresholdCtl:r,thresholdSaved:s,thresholdRef:i,thresholdSaveRef:l,proposeThreshold:u,doThreshold:d,pressProps:f,post:h,load:p}){return a.jsxs("div",{className:"ap-policy-block",children:[a.jsxs("div",{className:"ap-policy",children:[a.jsx("h3",{className:"ap-auto-title",children:"Auto-switch"}),a.jsx("span",{className:"ap-field",title:"Switch once the active account passes this much of its limit",children:a.jsx("select",{ref:i,"aria-label":"Switch threshold",value:n,...f("threshold"),onChange:g=>u(g.target.value),children:t7(t).map(g=>a.jsxs("option",{value:g,children:[g,"%"]},g))})}),(r.sends||s)&&a.jsx("button",{ref:l,type:"button",className:"ap-manage-btn",...f("threshold"),title:r.title,onClick:()=>d(n,r),children:s&&!r.sends?r.done:r.label}),a.jsx("button",{type:"button",className:"switch ap-auto-state",role:"switch","aria-checked":e.enabled,"aria-label":"Auto-switch",...f("enable"),onClick:()=>h({action:"enable",enabled:!e.enabled},"enable").then(()=>p(!0)),title:e.enabled?"Stop switching accounts automatically":"Switch accounts automatically when the active one nears its limit",children:a.jsx("span",{className:"switch-knob"})})]}),e.external&&a.jsxs("p",{className:"ap-auto-note",children:[a.jsx("i",{className:"ap-pulse","aria-hidden":!0})," A ",a.jsx("code",{children:"cswap auto"})," loop in your terminal is doing the switching. The deck stands down while it runs",e.enabled?" — this toggle takes over when you stop it.":"."]})]})}const Tj=18,r7=1100,Ao=(e,t)=>{const n=Math.sin(e*12.9898+t*78.233)*43758.5453;return n-Math.floor(n)},s7=Array.from({length:Tj},(e,t)=>{const n=-72+144*t/(Tj-1)+(Ao(t,1)-.5)*9,r=(n-90)*(Math.PI/180),s=(54+32*Math.cos(n*Math.PI/180))*(.74+Ao(t,2)*.52);return{dx:Math.cos(r)*s,dy:Math.sin(r)*s,rot:(t%2?1:-1)*(100+Ao(t,3)*260),delay:Math.round(Ao(t,4)*90),dur:760+Math.round(Ao(t,5)*260),scale:.8+Ao(t,6)*.45,hue:t%4,round:t%3===0}});function Rj({anchor:e}){var s;const[t,n]=v.useState(null),r=typeof window<"u"&&((s=window.matchMedia)==null?void 0:s.call(window,"(prefers-reduced-motion: reduce)").matches);return v.useEffect(()=>{if(r)return;const i=e.current;if(!i)return;const l=i.getBoundingClientRect();n({x:l.left+l.width/2,y:l.top+l.height/2});const u=window.setTimeout(()=>n(null),r7);return()=>window.clearTimeout(u)},[e,r]),r||!t?null:Ot.createPortal(a.jsx("div",{className:"confetti",style:{left:`${t.x}px`,top:`${t.y}px`},"aria-hidden":!0,children:s7.map((i,l)=>a.jsx("span",{className:`confetti-bit${i.round?" round":""}`,"data-hue":i.hue,style:{"--dx":`${i.dx.toFixed(1)}px`,"--dy":`${i.dy.toFixed(1)}px`,"--rot":`${i.rot}deg`,"--s":i.scale.toFixed(2),animationDelay:`${i.delay}ms`,animationDuration:`${i.dur}ms, ${i.dur}ms`}},l))}),document.body)}const ZM=new Set(["awaiting_url","awaiting_code","registering"]);function JM(e){return e!=null&&ZM.has(e)}function QM(e){return e!=null&&e!=="done"&&!ZM.has(e)}const a7="the sign-in ended before it finished — the deck restarted, or it was cancelled in another tab",o7="the sign-in did not complete";function i7({state:e,serverError:t,localError:n}){const r=e==="idle";return{title:r?"Sign-in ended":"Sign-in failed",message:n||t||(r?a7:o7)}}function l7({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 c7({started:e,state:t}){return!e||t==="done"?null:{action:"login-cancel"}}function u7({login:e,started:t,loginError:n,loginBusy:r}){return(e==null?void 0:e.state)==="done"&&e.account?"done":(e==null?void 0:e.state)==="awaiting_code"||(e==null?void 0:e.state)==="registering"?"code":QM(e==null?void 0:e.state)||n&&t&&!r?"ended":r||JM(e==null?void 0:e.state)?"asking":"primer"}const d7="done";function h7(){let e=!1;return{shouldAnnounce(t){return t!==d7?(e=!1,!1):e?!1:(e=!0,!0)}}}function R0(e,t){return t?It(e,t):void 0}const f7={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 ${vt}`,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"},p7={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"},A0=`claude-swap could not read the login keychain — start ${vt} from a Terminal window rather than a background service`,m7={unreadable_here:{short:"Keychain locked on this Mac",long:`${A0}.`},no_credentials_here:{short:"no stored login here",long:"claude-swap still holds no login for it here."},relogin_required_here:{short:"login expired",long:"the imported login was rejected — sign in again on a deck where it still works."},unverified_here:{short:"not checked",long:"claude-swap could not confirm whether this Mac can read it."}};function sd(e){return e?It(m7,e)??null:null}const e$={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 yx(e,t,n){const r=n==null?null:e$[n];if(r)return r;if((e==null?void 0:e.reason)!=="no_cswap"&&/keychain/i.test(Ml(e)))return A0;const s=R0(p7,e==null?void 0:e.reason);return s||(e==null?void 0:e.reason)||t}function Ml(e){return((e==null?void 0:e.output)||(e==null?void 0:e.detail)||(e==null?void 0:e.error)||"").trim()}const g7={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"},y7="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 w7(e){return/\bnpx\b/i.test(e)&&/(command not found|not found|not recognized|ENOENT)/i.test(e)}const v7="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",x7="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",b7=e=>/\b(?:ERR_)?MODULE_NOT_FOUND\b|cannot find (?:module|package)/i.test(e),k7=/node_modules[\\/]npm[\\/]bin[\\/]|\bnpm-prefix\.js\b|\bnp[mx][-.][\w.-]*cli\.js\b/i,N7=/[\\/]_npx[\\/]/i,j7=`the copy of ccusage ${vt} installed for itself`;function S7(e){const t=String((e==null?void 0:e.install)??"").replace(/\s+/g," ").trim();return t.length>240?`${t.slice(0,239)}…`:t}function Ire(e,t){const n=_7(e,t),r=S7(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 ${nl(n)}`:`there is no managed copy of ccusage on this machine, and the npx fallback failed: ${nl(n)}`;case"managed":return`${j7} failed to run: ${nl(n)}`;case"path":return e.bin?`the ccusage this deck found at ${e.bin} failed to run: ${nl(n)}`:`the ccusage this deck found on your PATH failed to run: ${nl(n)}`;default:return n}}const nl=e=>/^[A-Z][a-z]/.test(e)?e[0].toLowerCase()+e.slice(1):e;function _7(e,t){const n=Ml(e);if(b7(n)){if(N7.test(n))return x7;if(k7.test(n))return v7}if(w7(n))return y7;const r=R0(g7,e==null?void 0:e.reason);return r||(e==null?void 0:e.reason)||t}function Po(e,t,n){const r=n==null?null:e$[n];if(r)return r;if(e!=null&&e.detail)return e.detail;if(e!=null&&e.error&&QM(e.state))return e.error;const s=R0(f7,e==null?void 0:e.reason);return s||(e!=null&&e.error?e.error:(e==null?void 0:e.reason)||t)}function E7(e,t,n){if(n<=0||_d(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 t$(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 C7(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(),s=n.alias||r||`account ${n.num}`,i=[];return n.alias&&r&&i.push(r),r&&(t.get(r.toLowerCase())??0)>1&&i.push(n.org||`slot ${n.num}`),{num:n.num,label:s,sub:i.length?i.join(" · "):null}})}function T7(e,t){return e.filter(n=>!t.includes(n.num)).map(n=>n.num)}function R7(e,t){return e.includes(t)?e.filter(n=>n!==t):[...e,t]}function A7(e){return e.length?{action:"share",accounts:[...e]}:null}function M7(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 wx(e){return`${e.email}|${e.org??""}`}function $7(e,t,n){return e&&e.map(r=>wx(r)===t?n:r)}function I7(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 O7(e){const t=e.length;if(!t)return"Nothing to import.";const n=h=>e.filter(p=>p.state===h).length,r=[],s=n("imported");s&&r.push(`${s} of ${t} imported`);const i=n("healed");i&&r.push(`${i} had a dead token replaced`);const l=n("updated");l&&r.push(`${l} updated`);const u=n("present");u&&r.push(`${u} already here`);const d=n("failed");d&&r.push(`${d} did not arrive`);const f=[...new Set(e.map(h=>{var p;return(p=sd(h.check))==null?void 0:p.short}).filter(h=>!!h))];return`${r.join(", ")}${f.length?`, ${f.join(", ")}`:""}.`}const L7=1500,wu=[{id:"login",label:"Sign in"},{id:"paste",label:"Paste a share"}],Aj="aa-panel",Mj=e=>`aa-tab-${e}`;async function rl(e){return(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json().catch(()=>null)}const vx=ue.forwardRef((e,t)=>a.jsxs("svg",{className:"aa-mark",viewBox:"0 0 44 44","aria-hidden":!0,ref:t,children:[a.jsx("circle",{className:"aa-mark-ring",cx:"22",cy:"22",r:"20"}),a.jsx("path",{className:"aa-mark-tick",d:"M13.5 22.5 L19.5 28.5 L31 17"})]}));vx.displayName="SuccessMark";function P7({onClose:e,onChanged:t}){const[n,r]=v.useState("login"),[s,i]=v.useState(null),[l,u]=v.useState(""),[d,f]=v.useState(""),[h,p]=v.useState(!1),[g,w]=v.useState(!1),[k,x]=v.useState(null),[b,j]=v.useState(null),S=h||g,[_,E]=v.useState(null),[T,R]=v.useState(null),[A,U]=v.useState(null),I=v.useRef(""),q=v.useRef(!1),P=v.useRef(!1),O=v.useRef(null),V=v.useRef(null),$=v.useRef(null),M=v.useRef(null),L=v.useRef([]),Y=v.useRef(!1),K=v.useCallback(()=>{const ie=c7({started:q.current,state:s==null?void 0:s.state});ie&&rl(ie).catch(()=>{}),e()},[e,s==null?void 0:s.state]),D=mt(K,{focusRef:$}),z=v.useCallback(async()=>{if(!Sr(P.current))return;P.current=!0,p(!0),x(null),q.current=!0;const ie=await rl({action:"login"}).catch(()=>null);if(P.current=!1,p(!1),!(ie!=null&&ie.ok)){x(Po(ie,"could not start the sign-in"));return}i(ie)},[]);v.useEffect(()=>{if(!JM(s==null?void 0:s.state))return;const ie=window.setInterval(async()=>{try{const fe=await fetch("/api/claude-accounts/login");fe.ok&&i(await fe.json())}catch{}},L7);return()=>window.clearInterval(ie)},[s]);const F=v.useRef(t);F.current=t;const H=v.useState(h7)[0];v.useEffect(()=>{var ie;(s==null?void 0:s.state)==="awaiting_code"&&((ie=O.current)==null||ie.focus()),H.shouldAnnounce(s==null?void 0:s.state)&&F.current()},[s==null?void 0:s.state,H]),v.useEffect(()=>{var ie;n==="paste"&&!Y.current&&((ie=V.current)==null||ie.focus()),Y.current=!1},[n]);const J=v.useCallback(ie=>{var de;const fe=E7(ie,wu.findIndex(we=>we.id===n),wu.length);fe.kind!=="pass"&&(ie.preventDefault(),Y.current=!0,r(wu[fe.index].id),(de=L.current[fe.index])==null||de.focus())},[n]),W=v.useCallback(async()=>{var fe;if(!Sr(P.current))return;P.current=!0,p(!0),x(null);const ie=await rl({action:"login-code",code:l}).catch(()=>null);if(P.current=!1,p(!1),!(ie!=null&&ie.ok)){x(Po(ie,"the code was not accepted")),ie!=null&&ie.state&&i(ie),(fe=O.current)==null||fe.select();return}u(""),i(ie)},[l,s]),G=v.useCallback(async()=>{if(!Sr(P.current))return;P.current=!0,w(!0),j(null);const ie=await rl({action:"import",blob:d}).catch(()=>null);if(P.current=!1,w(!1),!(ie!=null&&ie.ok)){j(Po(ie,"the import failed"));return}I.current=d,f(""),U(null),E(ie.results??[]),t()},[d,t]),X=v.useCallback(async ie=>{const fe=wx(ie);if(!Sr(P.current)||!I.current)return;P.current=!0,w(!0),R(fe),U(null);const de=await rl({action:"import",blob:I.current,force:!0,only:{email:ie.email,org:ie.org??""}}).catch(()=>null);if(P.current=!1,w(!1),R(null),!(de!=null&&de.ok)){U({key:fe,text:Po(de,"that account could not be updated")});return}const we=(de.results??[])[0];we&&E(xe=>$7(xe,fe,we)),t()},[t]),Z=(s==null?void 0:s.state)==="done"?s.account:null,ee=l7({restored:s==null?void 0:s.restored,activeAccount:s==null?void 0:s.activeAccount}),re=u7({login:s,started:q.current,loginError:k,loginBusy:h}),ce=i7({state:s==null?void 0:s.state,serverError:s==null?void 0:s.error,localError:k});return Ot.createPortal(a.jsx("div",{className:"modal-backdrop",onClick:K,role:"presentation",children:a.jsxs("div",{ref:D,className:"modal aa-modal",onClick:ie=>ie.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Add a Claude account",children:[a.jsxs("header",{className:"modal-head",children:[a.jsx("div",{className:"modal-title",children:a.jsx("span",{className:"aa-tabs",role:"tablist","aria-label":"How to add the account",onKeyDown:J,children:wu.map((ie,fe)=>a.jsx("button",{type:"button",role:"tab",id:Mj(ie.id),ref:de=>{L.current[fe]=de},"aria-selected":n===ie.id,"aria-controls":Aj,tabIndex:n===ie.id?0:-1,className:`aa-tab${n===ie.id?" on":""}`,onClick:()=>{Y.current=!1,r(ie.id)},children:ie.label},ie.id))})}),a.jsx("div",{className:"modal-actions",children:a.jsx("button",{type:"button",className:"glyph-btn",onClick:K,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),a.jsx("section",{className:"modal-body aa-body",id:Aj,role:"tabpanel","aria-labelledby":Mj(n),children:n==="login"?re==="done"&&Z?a.jsxs("div",{className:"aa-done",children:[a.jsx(vx,{ref:M}),a.jsx(Rj,{anchor:M}),a.jsx("h4",{children:Z.added?`Account ${Z.num} added`:"Credentials refreshed"}),a.jsxs("p",{className:"aa-note",children:[a.jsx("strong",{children:Z.email}),Z.added?ee?" 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."]}),ee?a.jsx("p",{className:"aa-note aa-warn",role:"status",children:ee}):null,a.jsx("button",{type:"button",className:"btn primary",onClick:K,children:"Done"})]}):re==="code"&&s?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"aa-step",children:[a.jsx("h4",{children:"1 · Approve in the browser"}),a.jsx("p",{className:"aa-note",children:"A tab should have opened. If not, use this link:"}),a.jsx("a",{className:"aa-link",href:s.url??"#",target:"_blank",rel:"noreferrer noopener",children:s.url})]}),a.jsxs("div",{className:"aa-step",children:[a.jsx("h4",{children:"2 · Paste a code, if the page shows one"}),a.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."}),a.jsxs("div",{className:"aa-field",children:[a.jsx("input",{ref:O,type:"text",value:l,onChange:ie=>u(ie.target.value),onKeyDown:ie=>{ie.key==="Enter"&&l.trim()&&!S&&W()},placeholder:"paste the code here",spellCheck:!1,autoComplete:"off","aria-label":"Sign-in code",disabled:s.state==="registering"}),a.jsx("button",{type:"button",className:"btn primary",...Jr(S,!l.trim()||s.state==="registering"),onClick:W,children:s.state==="registering"?"registering…":"Continue"})]}),(k||s.error)&&a.jsx("p",{className:"aa-err",children:k??s.error}),a.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."})]})]}):re==="ended"?a.jsxs("div",{className:"aa-step",children:[a.jsx("h4",{children:ce.title}),a.jsx("p",{className:"aa-err",children:ce.message}),a.jsx("button",{type:"button",className:"btn",onClick:()=>{q.current=!1,i(null),x(null),z()},children:"Try again"})]}):re==="asking"?a.jsx("div",{className:"aa-step",children:a.jsx("p",{className:"aa-note",children:"Asking the claude CLI for a sign-in link…"})}):a.jsxs("div",{className:"aa-step aa-primer",children:[a.jsx("h4",{children:"Sign in to Anthropic"}),a.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."}),a.jsx("div",{className:"aa-actions",children:a.jsx("button",{type:"button",ref:$,className:"btn primary",...Jr(S),onClick:z,children:"Open the sign-in page"})})]}):_?(()=>{const ie=_.filter(de=>de.state==="imported").length,fe=_.some(de=>sd(de.check));return a.jsxs("div",{className:"aa-done",children:[!fe&&a.jsx(vx,{ref:M}),ie>0&&!fe&&a.jsx(Rj,{anchor:M}),a.jsx("h4",{children:O7(_)}),_.length>0&&a.jsx("ul",{className:"aa-results",children:_.map(de=>{const we=wx(de),xe=sd(de.check);return a.jsxs("li",{className:`aa-result ${de.state}`,children:[a.jsx("span",{className:"aa-result-who",children:de.email||(de.num?`slot ${de.num}`:"an account")}),a.jsx("span",{className:"aa-result-what",children:I7(de.state)}),de.state==="present"&&a.jsx("button",{type:"button",className:"aa-result-fix","aria-busy":T===we,title:`Overwrite the stored login for ${de.email} with the one in this share. Do this when that account has stopped working here; if it works, leave it.`,onClick:()=>X(de),children:T===we?"updating…":"update anyway"}),xe&&a.jsx("span",{className:"aa-result-err",children:xe.long}),(A==null?void 0:A.key)===we&&a.jsx("span",{className:"aa-result-err",children:A.text})]},we)})}),a.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",a.jsx("strong",{children:" update anyway"}),"."]}),a.jsxs("div",{className:"aa-actions",children:[a.jsx("button",{type:"button",className:"btn primary",onClick:K,children:"Done"}),a.jsx("button",{type:"button",className:"btn",onClick:()=>{I.current="",U(null),E(null)},children:"Import another"})]})]})})():a.jsxs("div",{className:"aa-step",children:[a.jsx("h4",{children:"Paste an account shared from another deck"}),a.jsxs("div",{className:"aa-field",children:[a.jsx("input",{ref:V,type:"text",value:d,onChange:ie=>f(ie.target.value),onKeyDown:ie=>{ie.key==="Enter"&&d.trim()&&!S&&G()},placeholder:"ccdeck2:…",spellCheck:!1,autoComplete:"off","aria-label":"Shared account"}),a.jsx("button",{type:"button",className:"btn primary",...Jr(S,!d.trim()),onClick:G,children:g?"importing…":"Import"})]}),b&&a.jsx("p",{className:"aa-err",children:b}),a.jsxs("p",{className:"aa-note",children:["Use ",a.jsx("strong",{children:"share"})," on one account in the other deck, or ",a.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)}function D7(e,t){const n=new Set(e),r=e.length?Math.max(...e):0;return[...new Set([...e,r+1])].sort((s,i)=>s-i).map(s=>{const i=s===t?"here":n.has(s)?"swap":"free";return{slot:s,kind:i,label:i==="here"?`slot ${s}`:`slot ${s} · ${i}`}})}function F7(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 s=n.swapped===!0&&r!==t;return{menuFor:e.menuFor===t?r:s&&e.menuFor===r?t:e.menuFor,confirmRemove:null,shareFor:null,swapNote:s?{at:r,displaced:t}:null}}const q7=64;function B7(e,t){const n=e.trim();return{alias:n,commit:n!==(t??"").trim()}}function U7(e,t,n){return t!=null&&e.some(r=>r.slot===t)?t:n}function z7(e,t,n){var s;const r=((s=e.find(i=>i.slot===t))==null?void 0:s.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 H7(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 W7({a:e,slots:t,nowSec:n,boundaryId:r,accountMenu:s,busy:i,pressProps:l,rotating:u,onProjects:d,onRotation:f}){const{menu:h,menuError:p,aliasDraft:g,confirmRemove:w,share:k,shareCopied:x,slotDraft:b,dropMenu:j,closeMenu:S,startRename:_,typeAlias:E,doAlias:T,startMove:R,pickSlot:A,doSlot:U,makeShare:I,copyShare:q,pressRemove:P}=s;if(!h)return null;const O=`ap-pop-title-${e.num}`,V=p&&a.jsx("p",{className:"ap-pop-error",role:"alert",title:p.raw||void 0,children:p.text});return a.jsxs(_0,{anchorId:`ap-more-${e.num}`,boundaryId:r,id:`ap-menu-${e.num}`,className:"ap-pop",role:h.view==="menu"?"menu":"dialog",labelledBy:h.view==="menu"?`ap-more-${e.num}`:O,start:h.start,onClose:j,children:[h.view==="menu"&&a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",role:"menuitem",className:"ap-menu-item",onClick:()=>_(e.num,e.alias),children:"Rename"}),a.jsx("button",{type:"button",role:"menuitem",className:"ap-menu-item",onClick:()=>R(e.num),children:"Move to slot…"}),a.jsx("button",{type:"button",role:"menuitem",className:"ap-menu-item",...l(`share-${e.num}`),title:`Copy this account to another ${vt}. 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:()=>I(e.num),children:i===`share-${e.num}`?"Sharing…":"Share"}),a.jsx("button",{type:"button",role:"menuitem",className:"ap-menu-item",title:"See how much this account worked in each project",onClick:()=>d(),children:"Projects"}),(u&&!e.active||e.disabled)&&a.jsx("button",{type:"button",role:"menuitem",className:"ap-menu-item",...l(`rot-${e.num}`),title:e.disabled?"Return this account to auto-rotation":"Hold this account out of auto-rotation",onClick:()=>f(),children:e.disabled?"Put back in rotation":"Hold out of rotation"}),a.jsx("div",{role:"separator",className:"ap-menu-sep"}),a.jsx("button",{type:"button",role:"menuitem",className:`ap-menu-item danger${w===e.num?" armed":""}`,...l(`rm-${e.num}`),"aria-label":w===e.num?"Confirm remove":void 0,title:w===e.num?"This deletes the stored credentials for this account":"Remove this account from claude-swap",onClick:()=>P(e.num),children:i===`rm-${e.num}`?"Removing…":w===e.num?"Confirm":"Remove"}),V]}),h.view==="rename"&&a.jsxs("form",{className:"ap-pop-form",onSubmit:$=>{$.preventDefault(),T(e.num,e.alias)},children:[a.jsx("label",{className:"ap-pop-title",id:O,htmlFor:`ap-alias-${e.num}`,children:"Rename account"}),a.jsx("input",{id:`ap-alias-${e.num}`,className:"ap-manage-input",type:"text",value:g,onChange:$=>E($.target.value),maxLength:q7,placeholder:"e.g. work",spellCheck:!1,autoComplete:"off",autoFocus:!0,onFocus:$=>$.currentTarget.select()}),V,a.jsxs("div",{className:"ap-pop-actions",children:[a.jsx("button",{type:"button",className:"btn",onClick:()=>S(),children:"Cancel"}),a.jsx("button",{type:"submit",className:"btn primary",...l(`alias-${e.num}`),title:"A short name to show instead of the email",children:i===`alias-${e.num}`?"…":"Save"})]})]}),h.view==="move"&&(()=>{const $=D7(t,e.num),M=U7($,b,e.num),L=z7($,M,e.num);return a.jsxs("div",{className:"ap-pop-form",children:[a.jsx("label",{className:"ap-pop-title",id:O,htmlFor:`ap-slot-${e.num}`,children:"Move to slot"}),a.jsx("span",{className:"ap-field",children:a.jsx("select",{id:`ap-slot-${e.num}`,value:String(M),...l(`move-${e.num}`),onChange:Y=>A(Number(Y.target.value)),autoFocus:!0,children:$.map(Y=>a.jsx("option",{value:Y.slot,children:Y.label},Y.slot))})}),V,a.jsxs("div",{className:"ap-pop-actions",children:[a.jsx("button",{type:"button",className:"btn",onClick:()=>S(),children:"Cancel"}),a.jsx("button",{type:"button",className:"btn primary",...l(`move-${e.num}`),title:L.title,onClick:()=>U(e.num,M,L),children:i===`move-${e.num}`?"…":ol(L.label)})]})]})})(),h.view==="share"&&(k==null?void 0:k.num)===e.num&&(()=>{const $=t$(k.expiresAt,n),M=$.tone==="gone";return a.jsxs("div",{className:"ap-pop-form",children:[a.jsx("p",{className:"ap-pop-title",id:O,children:"Share account"}),a.jsx("code",{className:"ap-share-blob",children:k.blob}),a.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:[a.jsx("span",{className:"ap-share-warn",children:"This is the password"})," · ",a.jsx("span",{className:`ap-share-expiry ${$.tone}`,children:$.text})]}),V,a.jsxs("div",{className:"ap-pop-actions",children:[a.jsx("button",{type:"button",className:"btn",onClick:()=>S(),children:"Done"}),a.jsx("button",{type:"button",className:"btn primary",...l(`share-${e.num}`),autoFocus:!0,onClick:async()=>{if(M){await I(e.num);return}await q(k.blob)},children:M?"Make a new share":x?"Copied":"Copy"})]})]})})()]})}const V7=6;function G7(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`,s=n.length?"ok":"idle",i=t.strained&&!t.armed?K7(n):null,l=[r];return i!=null&&l.push(`${i}% free`),l.push(t.armed?`auto ${t.threshold??"on"}${t.threshold?"%":""}`:"auto off"),{text:l.join(" · "),tone:s,free:i}}function K7(e){const t=e.map(n=>n.headroom).filter(n=>typeof n=="number");return t.length?Math.max(...t):null}function Y7(e){const t=[...e].sort((s,i)=>{if(s.ready!==i.ready)return s.ready?-1:1;if(!s.ready)return s.name.localeCompare(i.name);const l=s.headroom,u=i.headroom;return l==null&&u==null?s.name.localeCompare(i.name):l==null?1:u==null?-1:u-l}),n=t.slice(0,V7),r=t.length-n.length;return{title:e.some(s=>s.ready)?"Where you could switch":"Nothing to switch to",shown:n,rest:r>0?`and ${r} more`:null}}function Cr(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 s=Math.round(r/60);return s<48?`${s}h ago`:`${Math.round(s/24)}d ago`}const X7={keychain_unavailable:{short:"Keychain locked on the other Mac",long:`the other Mac could not export it. On that Mac: ${A0}. The next round brings it.`}};function xx(e){return e.why?It(X7,e.why)??sd(e.why):null}const M0={"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"},"that deck pairs only by invite":{text:"it pairs only by invite",tone:"idle"},"this deck pairs only by invite":{text:"needs an invite · your setting",tone:"idle"}},Z7={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 $j(e){var r;const t=J7[e];if(t)return t;const n=(r=/\b(E[A-Z]{3,})\b/.exec(e))==null?void 0:r[1];return n&&Z7[n]||e}const J7={"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 Dd(e,t){var h;if(!e)return null;if(e.error&&((h=e.done)!=null&&h.length)){const p=Dd({...e,error:void 0},t),g=` · ${Cr(e.at,t)}`;return{...p,text:`${p.text.slice(0,-g.length)}, then ${$j(e.error)}${g}`,tone:"bad"}}if(e.error)return M0[e.error]??{text:$j(e.error),tone:"bad"};const n=e.done??[];if(!n.length)return{text:`all logins fine · ${Cr(e.at,t)}`,tone:"idle"};const r=n.filter(p=>p.ok),s=r.length===1?"login":"logins",i=n.map(p=>({d:p,why:xx(p)})).filter(p=>p.why),l=[...new Set(i.map(p=>p.why.short))],u=l.length?`, ${l.join(", ")}`:"",d=i.length?i.map(p=>`${p.d.email}: ${p.why.long}`).join(" "):void 0,f=Cr(e.at,t);return r.length===n.length?{text:`${r.length} ${s} arrived${u} · ${f}`,tone:i.length?"warn":"ok",...d?{hint:d}:{}}:{text:`${r.length} of ${n.length} logins arrived${u} · ${f}`,tone:"bad",...d?{hint:d}:{}}}const Q7=9e4;function e9({error:e,host:t,port:n},r,s,i=45317){if(e!=="handshake timed out")return null;const l=(t??"").trim();if(!l)return null;const u=r.filter(f=>f.addr===l&&f.port&&f.at>0&&s-f.at<Q7);if(!u.length)return null;const d=[...new Set(u.map(f=>f.port))];if(n!=null&&!d.includes(n)){const f=d.length===1?`port ${d[0]}`:`ports ${d.join(" and ")}`;return`A deck at ${l} is announcing itself on ${f}, 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 ${l}, not a network fault. Whoever uses it can allow two ports: UDP ${i} and TCP ${n??d[0]}.`}function n$(e,t){var n,r;return(n=e.last)!=null&&n.error&&!M0[e.last.error]?!1:!!((r=e.last)!=null&&r.at&&t-e.last.at<bx||e.lastSeen!=null&&t-e.lastSeen<bx)}const bx=95e3;function t9(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(p=>p.paired!==!1||p.met);if(!r.length)return{text:"no deck paired yet",tone:"idle"};const s=p=>p.waiting?r$(p.lastSeen,t):n$(p,t),i=p=>{var g;return!p.waiting&&((g=p.last)==null?void 0:g.error)==="waiting for the other deck to accept this one"},l=e.aliases??{};let u=0,d=0,f=0;for(const p of a$(r,g=>s$(g,g.peerFp??g.fp,l).name,g=>g.addr??"")){const g=p.filter(s);if(!g.length){f++;continue}u++,g.every(i)&&d++}if(u&&d===u)return{text:u===1?"1 deck found · waiting for them to accept":`${u} decks found · waiting for them to accept`,tone:"wait"};if(!u)return{text:f===1?"this deck cannot reach the one it is paired with":`this deck cannot reach any of its ${f} decks`,tone:"bad"};const h=u===1?"1 deck ready":`${u} decks ready`;return{text:f?`${h} · ${f} away`:h,tone:"ok"}}function n9(e,t,n){if(n)return"checking…";if(e==null)return"not checked yet";const r=Cr(e,t);return r==="now"?"checked just now":`checked ${r}`}function $0(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 r$(e,t){return e!=null&&t-e<bx}function r9(e,t){if(e==null)return{text:"one-way · has not called yet",here:!1};const n=r$(e,t);return{text:n?"online · one-way, it calls in":`one-way · last online ${Cr(e,t)}`,here:n}}function Ij(e,t,n){return t?"online":e.lastSeen!=null?`last online ${Cr(e.lastSeen,n)}`:e.waiting?"has not called yet":"never reached"}function s9(e,t){if(!e)return[];const n=[],r=new Set,s=(p,g)=>p.name.localeCompare(g.name,void 0,{numeric:!0}),i=e.aliases??{};for(const p of e.pending??[])!(p!=null&&p.fp)||r.has(p.fp)||(r.add(p.fp),n.push(a9(p,i,t)));const l=[],u=[];for(const p of e.peers??[]){const g=p.peerFp??p.fp;!g||r.has(g)||(r.add(g),!p.paired&&p.manual&&!p.met?u.push(o9(p,g,t)):l.push(i9(p,g,i,t)))}n.push(...u9(l).sort(s),...u.sort(s));const d=[];for(const p of e.strangers??[])!(p!=null&&p.fp)||r.has(p.fp)||(r.add(p.fp),d.push(l9(p,i,e.pairingMode)));n.push(...d.sort(s));const f=[];for(const p of e.declined??[])!(p!=null&&p.fp)||r.has(p.fp)||(r.add(p.fp),f.push(c9(p,i)));n.push(...f.sort(s));const h=new Map;for(const p of n)h.set(p.name,(h.get(p.name)??0)+1);for(const p of n)(h.get(p.name)??0)<2||!p.addr||(p.state=p.quiet||!p.state?p.addr:`${p.addr} · ${p.state}`,p.quiet=!1);return n}function a9(e,t,n){const r=Fd(t,e.fp,e.name||e.fp);return{fp:e.fp,...r,addr:e.addr??"",kind:"asks",state:`wants to pair · ${$0(e.at,n)}`,tone:"wait",here:!0,hint:`${r.name} at ${e.addr}${e.via==="tailscale"?", over Tailscale,":""} is waiting for an answer.`,...qd(e.via)}}function o9(e,t,n){var i;const r=Dd(e.last,n),s=e.addr?`${e.addr}:${e.port}`:"";return{fp:s,name:s||e.name||t,addr:e.addr??"",kind:"dialling",state:r?kx(r):"trying…",tone:r?r.tone:"idle",here:!1,hint:(i=e.last)!=null&&i.error?`Nothing has answered at ${s} yet — ${e.last.error}.`:`Dialling ${s} until something answers.`,...qd(e.via)}}function i9(e,t,n,r){var w,k,x,b;const s=Dd(e.last,r),i=n$(e,r),l=e.addr?`${e.addr}:${e.port}`:"",u=e.waiting?r9(e.lastSeen,r):null,d=u?u.here:i,f=!u&&s?d?`online · ${kx(s)}`:`${kx(s)} · ${Ij(e,d,r)}`:u?u.text:Ij(e,d,r),h=(w=e.last)!=null&&w.error?M0[e.last.error]:null,p=!u&&d&&!((k=e.last)!=null&&k.error)&&!(((x=e.last)==null?void 0:x.done)??[]).length,g=s$(e,t,n);return{fp:t,...g,addr:e.addr??"",kind:"paired",state:f,quiet:p,tone:h?h.tone==="bad"?"bad":"wait":s?s.tone:d?"ok":"idle",here:u?u.here:i,...qd(e.via),hint:u?`${g.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. ${e.lastSeen==null?"It has not called since this deck started.":`It last called ${Cr(e.lastSeen,r)}.`} Add its address through Add a deck, the link at the top of this view, to reach it either way.`:`${g.name}${l?` at ${l}`:""}${(b=e.last)!=null&&b.error?` — ${e.last.error}`:""}${s!=null&&s.hint?` — ${s.hint}`:""}`}}function s$(e,t,n){return e.manual&&!e.met?{name:e.addr?`${e.addr}:${e.port}`:""}:Fd(n,t,e.name||t)}function l9(e,t,n){const r=Fd(t,e.fp,e.name||e.fp);return{fp:e.fp,...r,addr:e.addr??"",kind:"nearby",state:n==="invite"?"needs an invite":"not paired yet",tone:"idle",here:!0,hint:e.via==="tailscale"?`${r.name} at ${e.addr} is on your tailnet and nothing is shared with it.`:`${r.name} at ${e.addr} is on this network and nothing is shared with it.`,...qd(e.via)}}function c9(e,t){const n=Fd(t,e.fp,e.name||e.fp);return{fp:e.fp,...n,addr:e.addr??"",kind:"declined",state:"you said no",tone:"idle",here:!1,hint:`${n.name} asked and was turned away. It is not asking any more.`}}function Fd(e,t,n){const r=t?e[t]:void 0;return r&&r!==n?{name:r,self:n}:{name:n}}function qd(e){return e==="tailscale"?{via:"tailscale"}:{}}function kx(e){return e.text.replace(/ · .*$/,"")}function u9(e){return a$(e,t=>t.name,t=>t.addr).map(d9)}function a$(e,t,n){const r=new Map;for(const i of e){const l=r.get(t(i));l?l.push(i):r.set(t(i),[i])}const s=[];for(const i of r.values()){const l=[...new Set(i.map(n).filter(Boolean))];if(l.length>1){for(const u of l)s.push(i.filter(d=>n(d)===u));for(const u of i)n(u)||s.push([u])}else s.push(i)}return s}function d9(e){const[t,...n]=[...e].sort((r,s)=>Number(s.here)-Number(r.here)||+!!s.addr-+!!r.addr);return n.length?{...t,twins:n}:t}function Oj(e,t){return t?e.map(n=>t[n.fp]?{...n,name:t[n.fp]}:n):e}function ad(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 h9(e,t){var i;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(l=>l.kind==="asks").length;if(n)return{text:n===1?"1 deck wants to pair":`${n} decks want to pair`,tone:"wait",live:!1};if((i=e.reach)!=null&&i.blocked)return{text:"nothing can get in",tone:"bad",live:!1};const r=t.filter(l=>l.kind==="paired");if(!r.length)return{text:"On · none paired yet",tone:"idle",live:!1};const s=r.filter(l=>l.here).length;return s?s===r.length?{text:`${s} online`,tone:"ok",live:!0}:{text:`${s} of ${r.length} online`,tone:"ok",live:!0}:{text:`none of ${r.length} online`,tone:"idle",live:!1}}function f9(e,t){const n=e.filter(h=>h.kind==="asks"),r=e.filter(h=>h.kind!=="asks"),s=r.filter(h=>h.here),i=r.filter(h=>!h.here),l=i.filter(h=>h.tone==="bad").length,u=t||s.length===0,d=u?[...s,...i]:s,f=r.filter(h=>h.kind==="paired").length;return{asks:n,rest:r,live:s,folded:i,troubled:l,showFolded:u,shown:d,paired:f}}const o$=160,i$=140;function p9(){const[e,t]=v.useState(!1),n=v.useRef(0);return v.useEffect(()=>()=>window.clearTimeout(n.current),[]),{peek:e,openPeek:u=>{window.clearTimeout(n.current),n.current=window.setTimeout(()=>t(!0),u)},shutPeek:()=>{window.clearTimeout(n.current),n.current=window.setTimeout(()=>t(!1),i$)},holdPeek:()=>window.clearTimeout(n.current),dropPeek:()=>{window.clearTimeout(n.current),t(!1)}}}function m9(e){var t;return((t=e==null?void 0:e.detail)==null?void 0:t.fix)==="give_back"}function Qn(e,t){return{text:e,giveBack:m9(t),done:!1}}async function g9(){try{return await(await fetch("/api/prefs/give-back",{method:"POST",headers:{"Content-Type":"application/json"},body:"{}"})).json().catch(()=>null)}catch{return null}}const y9={cancelled:"Nothing changed — the password dialog was closed. The folder still belongs to another user.",timed_out:"Nothing changed — the password dialog was not answered in time.",busy:"The password dialog is already open. It may be behind this window."};function w9(e){if(e!=null&&e.ok)return{text:e.changed===!1?"The settings folder is already yours, and the deck has read it again. Try that once more.":"Done — the settings folder is yours again, and the deck has read it again. Try that once more.",giveBack:!1,done:!0};if(e==null)return{text:"Could not give it back — the deck did not answer.",giveBack:!0,done:!1};const t=e.reason?y9[e.reason]:void 0;return t?{text:t,giveBack:!0,done:!1}:{text:"macOS did not give the folder back. The deck's log has the command that does it by hand.",giveBack:!1,done:!1}}const Nx=5e3,l$=6e4;function Ct(e,t){if(t==null)return`Could not ${e} — the deck did not answer.`;const n=t.reason?b9(t.reason,t.detail):void 0;return n?`Could not ${e} — ${n}`:t.reason?`Could not ${e} — the deck refused it (${t.reason}).`:`Could not ${e}.`}const v9={prefs_unreadable:"this deck cannot read its settings file, so it will not write over it. The file may belong to another user, for example after ccdeck was run with sudo. The deck's log names the file.",prefs_not_writable:"this deck is not allowed to save its settings. The settings folder may belong to another user, for example after ccdeck was run with sudo, or another program may be holding the file. The deck's log names the folder."},x9=new Set(["EACCES","EPERM"]);function b9(e,t){const n=v9[e];if(!n)return;const r=e==="prefs_unreadable"&&t?k9(t):void 0,s=t!=null&&t.code&&t.code!=="BADJSON"?` Error code: ${t.code}.`:"";return(r??n)+s}function k9({code:e,owner:t,on:n}){if(e==="BADJSON")return"its settings file is damaged and could not be moved aside, so it will not write over it. The deck's log names the file.";if(n==="folder"&&t==="other")return"this deck cannot open its settings folder, which belongs to another user, for example after ccdeck was run with sudo. The deck's log has the command that gives it back.";if(n==="folder"&&t==="you")return"this deck cannot open its own settings folder, so it will not write over what is in it. The deck's log names the folder.";if(t==="other")return"its settings file belongs to another user and could not be moved aside, so it will not write over it. The deck's log names the file.";if(t==="you")return"this deck cannot read its settings file although the file is yours, so it will not write over it. Something on this machine is blocking the read; the deck's log names the file.";if(e&&!x9.has(e))return"this deck cannot read its settings file, so it will not write over it. The deck's log names the file."}async function Mo(e,t){return(await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json().catch(()=>null)}function N9(e,t){const[n,r]=v.useState(null),[s,i]=v.useState([]),[l,u]=v.useState(null),[d,f]=v.useState(null),h=v.useRef(null),p=v.useCallback(P=>Id(h.current)?(h.current=P,u(P),!0):!1,[]),g=v.useCallback(()=>{h.current=null,b.current&&u(null)},[]),w=P=>{const O=Vs(l,P);return{disabled:O.disabled,"aria-busy":O.busy}},[k,x]=v.useState(()=>Date.now()),b=v.useRef(!0),j=v.useRef(Nx),S=v.useCallback(async()=>{var P,O;try{const[V,$]=await Promise.all([fetch("/api/lan").then(M=>M.json()),fetch("/api/prefs").then(M=>M.json())]);if(!b.current)return;V!=null&&V.ok&&r(V),$!=null&&$.ok&&i(Array.isArray((O=(P=$.prefs)==null?void 0:P.lan)==null?void 0:O.manual)?$.prefs.lan.manual:[]),j.current=(V==null?void 0:V.enabled)===!0?Nx:l$}catch{}},[]);v.useEffect(()=>{b.current=!0;let P=0;const O=async()=>{x(Date.now()),await S(),b.current&&(P=window.setTimeout(O,j.current))};return O(),()=>{b.current=!1,window.clearTimeout(P)}},[S]);const _=v.useCallback(async()=>{const P=(n==null?void 0:n.enabled)===!0;if(p("switch"))try{const O=await Mo("/api/prefs",{lan:{enabled:!P}});if(!b.current)return;O!=null&&O.ok?(f(null),P||t()):f(Qn(Ct(P?"turn this off":"turn this on",O),O)),await S()}catch{b.current&&f(Qn(Ct(P?"turn this off":"turn this on",null)))}finally{g()}},[n==null?void 0:n.enabled,S,p,g,t]),E=v.useCallback(async(P,O,V)=>{if(!p(`${P}:${O}`))return null;let $=null;try{const M=await Mo("/api/lan/peer",{action:P,fp:O});if(!b.current)return null;M!=null&&M.ok?(r(M),f(null)):($=Ct(V,M),f(Qn($,M))),await S()}catch{$=Ct(V,null),b.current&&f(Qn($))}finally{g()}return $},[S,p,g]),T=v.useCallback(async P=>{if(!p(`drop:${P}`))return null;let O=null;try{const V=await Mo("/api/prefs",{lan:{manual:s.filter($=>$!==P)}});if(!b.current)return null;V!=null&&V.ok?(f(null),e()):(O=Ct("stop dialling that address",V),f(Qn(O,V))),await S()}catch{O=Ct("stop dialling that address",null),b.current&&f(Qn(O))}finally{g()}return O},[s,S,e,p,g]),R=v.useCallback(async(P,O)=>{if(!p(`alias:${P}`))return"Something else is still being saved. Try again in a moment.";try{const V=await Mo("/api/lan/peer",{action:"alias",fp:P,name:O});return b.current?V!=null&&V.ok?(r(V),null):Ct("rename that deck",V):null}catch{return Ct("rename that deck",null)}finally{g()}},[p,g]),A=v.useCallback(async P=>{if(!p(`check:${P}`))return null;try{const O=await Mo("/api/lan/sync",{fp:P});return b.current?O!=null&&O.ok?(r(O),e(),null):(O==null?void 0:O.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.":Ct("check that deck",O):null}catch{return Ct("check that deck",null)}finally{g()}},[p,g,e]),U=v.useCallback(async()=>{if(p("check"))try{const P=await Mo("/api/lan/sync",{});if(!b.current)return;P!=null&&P.ok?(r(P),f(null)):f(Qn(Ct("check the other decks",P),P)),e()}catch{b.current&&f(Qn(Ct("check the other decks",null)))}finally{g()}},[p,g,e]);return{status:n,manual:s,now:k,busy:l,failure:d,dismissFailure:()=>f(null),answerGiveBack:P=>{f(P),P.done&&(S(),e())},pressProps:w,load:S,toggle:_,answer:E,dropAddress:T,rename:R,checkOne:A,checkNow:U}}function j9(e){const[t,n]=v.useState(null),r=v.useRef(0);return v.useEffect(()=>{if(t==null)return;const i=window.setTimeout(()=>n(null),4e3);return()=>window.clearTimeout(i)},[t]),{armed:t,pressUnpair:i=>{const l=Date.now(),u=Tl({armedFor:t,target:i.fp,armedAt:r.current,now:l,gapMs:Cl});if(u==="arm"){n(i.fp),r.current=l;return}u!=="ignore"&&(n(null),e("unpair",i.fp,"unpair that deck"))}}}function c$({title:e,steps:t,finish:n,aside:r,onClose:s}){const i=v.useRef(null),l=mt(s,{focusRef:i}),[u,d]=v.useState(0),f=u===t.length-1,h=t[u],p=k=>d(Math.max(0,Math.min(t.length-1,k)));v.useEffect(()=>{var k,x;ns(((k=document.activeElement)==null?void 0:k.tagName)??null)&&((x=i.current)==null||x.focus())},[u]);const g=k=>{k.key!=="ArrowRight"&&k.key!=="ArrowLeft"||(k.preventDefault(),k.stopPropagation(),p(k.key==="ArrowRight"?u+1:u-1))},w=()=>{if(!f){p(u+1);return}n?n.act():s()};return Ot.createPortal(a.jsx("div",{className:"modal-backdrop",onClick:s,role:"presentation",children:a.jsxs("div",{ref:l,className:"modal guide",onClick:k=>k.stopPropagation(),onKeyDown:g,role:"dialog","aria-modal":"true","aria-labelledby":"guide-title",children:[a.jsxs("header",{className:"modal-head",children:[a.jsxs("div",{className:"modal-title",children:[a.jsx("span",{id:"guide-title",className:"modal-tool-name",children:e}),a.jsxs("span",{className:"modal-tool-id",children:[u+1," / ",t.length]})]}),a.jsx("div",{className:"modal-actions",children:a.jsx("button",{type:"button",className:"glyph-btn",onClick:s,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),a.jsxs("section",{className:"modal-body",children:[a.jsx("div",{className:"guide-stage",children:h.art},u),a.jsx("p",{className:"guide-line","aria-live":"polite",children:h.line}),a.jsx("p",{className:"guide-tip",children:h.tip??""}),a.jsxs("div",{className:"guide-foot",children:[a.jsx("div",{className:"guide-dots",children:t.map((k,x)=>a.jsx("button",{type:"button",className:"glyph-btn guide-dot","aria-label":`Step ${x+1} of ${t.length}`,"aria-current":x===u?"step":void 0,onClick:()=>p(x)},x))}),f&&r&&a.jsx("button",{type:"button",className:"ap-lan-word guide-aside",onClick:r.act,children:r.label}),u>0&&a.jsx("button",{type:"button",className:"btn",onClick:()=>p(u-1),children:"Back"}),a.jsx("button",{ref:i,type:"button",className:"btn primary",onClick:w,children:f?(n==null?void 0:n.label)??"Done":"Next"})]})]})]})}),document.body)}const jx={ok:"ga-ok",warn:"ga-warn",accent:"ga-accent",flight:"ga-flight"};function Dn({children:e}){return a.jsx("svg",{className:"guide-art",viewBox:"0 0 440 200","aria-hidden":!0,focusable:"false",children:e})}function Pn({x:e,y:t=34,w:n=176,h:r=132,label:s}){return a.jsxs(a.Fragment,{children:[s&&a.jsx("text",{x:e+2,y:t-9,className:"ga-cap",children:s}),a.jsx("rect",{x:e,y:t,width:n,height:r,rx:10,className:"ga-screen"})]})}function sr({x:e,y:t,email:n,state:r,tone:s,bars:i}){return a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:e+3,cy:t-4,r:3,className:jx[s]}),a.jsx("text",{x:e+12,y:t,className:"ga-t ga-mono",children:n}),a.jsx("text",{x:e+12,y:t+16,className:`ga-s ${jx[s]}`,children:r}),i==null?void 0:i.map((l,u)=>a.jsxs("g",{children:[a.jsx("text",{x:e,y:t+40+u*18,className:"ga-s",children:u?"7d":"5h"}),a.jsx("rect",{x:e+22,y:t+35+u*18,width:96,height:4,rx:2,className:"ga-track"}),a.jsx("rect",{x:e+22,y:t+35+u*18,width:96*l/100,height:4,rx:2,className:"ga-accent"}),a.jsxs("text",{x:e+148,y:t+40+u*18,className:"ga-s ga-accent",textAnchor:"end",children:[l,"%"]})]},u))]})}function u$({x:e,y:t,on:n}){return a.jsxs(a.Fragment,{children:[a.jsx("rect",{x:e,y:t,width:30,height:18,rx:9,className:n?"ga-switch-on":"ga-switch"}),a.jsx("circle",{cx:n?e+21:e+9,cy:t+9,r:6,className:n?"ga-knob-on":"ga-knob"})]})}function vu({x:e,y:t,name:n,here:r=!0}){return a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:e+3,cy:t-4,r:3,className:r?"ga-ok":"ga-dim"}),a.jsx("text",{x:e+12,y:t,className:r?"ga-t":"ga-s",children:n})]})}function Lj({x:e,y:t,on:n}){return n?a.jsxs(a.Fragment,{children:[a.jsx("rect",{x:e,y:t,width:12,height:12,rx:3,className:"ga-accent"}),a.jsx("path",{d:`M${e+3} ${t+6.2}l2.3 2.3 4-4.6`,className:"ga-tick"})]}):a.jsx("rect",{x:e+.5,y:t+.5,width:11,height:11,rx:3,className:"ga-box"})}function Pj({x:e,y:t,d:n}){return a.jsx("path",{d:n,transform:`translate(${e} ${t})`,className:"ga-glyph"})}function I0({x:e,y:t}){return a.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 O0(){return a.jsxs(a.Fragment,{children:[a.jsx("circle",{r:9,className:"ga-key-bed"}),a.jsxs("g",{transform:"translate(-6 -6) scale(0.857)",className:"ga-key",children:[a.jsx("circle",{cx:4.6,cy:7,r:2.6}),a.jsx("path",{d:"M7.2 7h5.2M10.6 7v2.2M12.4 7v1.6"})]})]})}function Do({x:e,y:t,w:n,title:r,sub:s,tone:i}){return a.jsxs(a.Fragment,{children:[a.jsx("rect",{x:e,y:t,width:n,height:40,rx:8,className:"ga-screen"}),a.jsx("rect",{x:e+6,y:t+10,width:3,height:20,rx:1.5,className:jx[i]}),a.jsx("text",{x:e+16,y:t+17,className:"ga-t ga-strong",children:r}),a.jsx("text",{x:e+16,y:t+31,className:"ga-s",children:s})]})}function Wo({x:e,y:t,label:n,live:r}){return a.jsxs(a.Fragment,{children:[a.jsx("rect",{x:e,y:t,width:46,height:20,rx:10,className:r?"ga-chip-live":"ga-chip"}),a.jsx("text",{x:e+23,y:t+14,className:"ga-s ga-mono",textAnchor:"middle",children:n})]})}function od({x:e,y:t}){return a.jsxs(a.Fragment,{children:[a.jsx("text",{x:e,y:t,className:"ga-cap",children:"LOCAL NETWORK"}),a.jsx(u$,{x:e+118,y:t-13,on:!0})]})}function S9(){return a.jsxs(Dn,{children:[a.jsx("rect",{x:14,y:14,width:206,height:172,rx:10,className:"ga-screen"}),a.jsx("text",{x:28,y:38,className:"ga-t ga-strong",children:"Sessions"}),a.jsx("text",{x:206,y:38,className:"ga-s ga-warn",textAnchor:"end",children:"1 waiting"}),a.jsx("rect",{x:20,y:50,width:194,height:42,rx:6,className:"ga-bed-warn"}),a.jsx("circle",{cx:33,cy:64,r:7,className:"ga-ring-warn ga-ping"}),a.jsx("circle",{cx:33,cy:64,r:3.5,className:"ga-warn"}),a.jsx("text",{x:44,y:68,className:"ga-t",children:"api-server"}),a.jsx("text",{x:44,y:83,className:"ga-s ga-warn",children:"waiting 6m · Bash"}),a.jsx("circle",{cx:33,cy:108,r:3.5,className:"ga-flight"}),a.jsx("text",{x:44,y:112,className:"ga-t",children:"docs-site"}),a.jsx("text",{x:44,y:127,className:"ga-s",children:"running · 12 tools"}),a.jsx("circle",{cx:33,cy:150,r:3.5,className:"ga-ok"}),a.jsx("text",{x:44,y:154,className:"ga-t",children:"billing"}),a.jsx("text",{x:44,y:169,className:"ga-s",children:"done · $0.84"}),a.jsx("path",{d:"M216 71C234 71 230 100 244 100",className:"ga-arc"}),a.jsx("path",{d:"M239 96l5 4-5 4",className:"ga-arrow"}),a.jsx("rect",{x:248,y:44,width:178,height:112,rx:10,className:"ga-screen"}),a.jsx("text",{x:262,y:64,className:"ga-cap",children:"API-SERVER"}),a.jsx("line",{x1:248,y1:74,x2:426,y2:74,className:"ga-line"}),a.jsx("text",{x:262,y:96,className:"ga-s ga-mono",children:"Bash(npm test)"}),a.jsx("text",{x:262,y:116,className:"ga-t ga-mono ga-warn",children:"Allow this command?"}),a.jsx("text",{x:262,y:136,className:"ga-s ga-mono",children:"> 1. Yes 2. No"})]})}function _9(){return a.jsxs(Dn,{children:[a.jsx("path",{d:"M136 100C166 100 166 38 196 38",className:"ga-edge ga-flow"}),a.jsx("path",{d:"M136 100H196",className:"ga-edge ga-flow"}),a.jsx("path",{d:"M136 100C166 100 166 162 196 162",className:"ga-edge-done"}),a.jsx("path",{d:"M308 38H326M308 100H326",className:"ga-edge"}),a.jsx(Do,{x:20,y:80,w:116,title:"main",sub:"Opus 5 · 9 tools",tone:"accent"}),a.jsx(Do,{x:196,y:18,w:112,title:"explore",sub:"Haiku · 14 tools",tone:"flight"}),a.jsx(Do,{x:196,y:80,w:112,title:"tests",sub:"Sonnet · 6 tools",tone:"flight"}),a.jsx(Do,{x:196,y:142,w:112,title:"review",sub:"done · 38s",tone:"ok"}),a.jsx(Wo,{x:326,y:28,label:"Read"}),a.jsx(Wo,{x:380,y:28,label:"Grep",live:!0}),a.jsx(Wo,{x:326,y:90,label:"Bash",live:!0})]})}function Dj({x:e,y:t,label:n,pct:r,note:s}){return a.jsxs(a.Fragment,{children:[a.jsx("text",{x:e,y:t,className:"ga-s",children:n}),a.jsxs("text",{x:e+194,y:t,className:"ga-s ga-accent",textAnchor:"end",children:[r,"%"]}),a.jsx("rect",{x:e,y:t+7,width:194,height:5,rx:2.5,className:"ga-track"}),a.jsx("rect",{x:e,y:t+7,width:194*r/100,height:5,rx:2.5,className:"ga-accent"}),a.jsx("text",{x:e,y:t+26,className:"ga-s",children:s})]})}function E9(){return a.jsxs(Dn,{children:[a.jsx("rect",{x:14,y:30,width:172,height:140,rx:10,className:"ga-screen"}),a.jsx("text",{x:30,y:56,className:"ga-cap",children:"THIS SESSION"}),a.jsx("text",{x:30,y:98,className:"ga-big",children:"$3.66"}),a.jsx("text",{x:30,y:122,className:"ga-s",children:"Opus 5 · 1.2M tokens"}),a.jsx("text",{x:30,y:150,className:"ga-s",children:"$21.40 today"}),a.jsx("rect",{x:200,y:30,width:226,height:140,rx:10,className:"ga-screen"}),a.jsx("text",{x:216,y:56,className:"ga-cap",children:"CLAUDE QUOTA"}),a.jsx(Dj,{x:216,y:80,label:"5-hour window",pct:24,note:"resets in 53m"}),a.jsx(Dj,{x:216,y:124,label:"7-day window",pct:61,note:"resets in 4d"})]})}function C9(){return a.jsxs(Dn,{children:[a.jsx("rect",{x:14,y:40,width:172,height:120,rx:10,className:"ga-canvas"}),a.jsx(Do,{x:30,y:80,w:140,title:"tests",sub:"Sonnet 5 · 6 tools",tone:"flight"}),a.jsx(I0,{x:156,y:106}),a.jsx("path",{d:"M170 92C186 92 184 60 200 60",className:"ga-arc"}),a.jsx("path",{d:"M195 56l5 4-5 4",className:"ga-arrow"}),a.jsx(Pn,{x:200,y:22,w:226,h:160}),a.jsx("text",{x:214,y:46,className:"ga-t ga-strong",children:"tests"}),a.jsx("text",{x:412,y:46,className:"ga-s",textAnchor:"end",children:"Sonnet 5 · 38s"}),a.jsx("line",{x1:200,y1:56,x2:426,y2:56,className:"ga-line"}),a.jsx("text",{x:214,y:76,className:"ga-cap",children:"PROMPT"}),a.jsx("text",{x:214,y:92,className:"ga-t",children:"Run the suite and fix what fails"}),a.jsx("text",{x:214,y:116,className:"ga-cap",children:"TOOLS · 6"}),a.jsx(Wo,{x:214,y:122,label:"Read"}),a.jsx(Wo,{x:266,y:122,label:"Edit"}),a.jsx(Wo,{x:318,y:122,label:"Bash",live:!0}),a.jsx("text",{x:214,y:164,className:"ga-cap",children:"TOKENS"}),a.jsx("text",{x:214,y:178,className:"ga-s ga-mono",children:"41k in · 2.1k out · $0.12"})]})}function T9(){const e=[18,24,28,14,22,26,30,16,24,28,20,26];return a.jsxs(Dn,{children:[a.jsx(Pn,{x:14,y:20,w:412,h:160}),a.jsx("text",{x:28,y:44,className:"ga-t ga-strong",children:"This machine"}),a.jsx("text",{x:412,y:44,className:"ga-s",textAnchor:"end",children:"12 cores · up 10d"}),a.jsx("line",{x1:14,y1:56,x2:426,y2:56,className:"ga-line"}),a.jsx("text",{x:28,y:76,className:"ga-cap",children:"CORES"}),e.map((t,n)=>a.jsxs("g",{children:[a.jsx("rect",{x:28+n*15,y:82,width:10,height:30,rx:2,className:"ga-track"}),a.jsx("rect",{x:28+n*15,y:112-t,width:10,height:t,rx:2,className:"ga-accent"})]},n)),a.jsx("text",{x:28,y:136,className:"ga-cap",children:"MEMORY"}),a.jsx("rect",{x:28,y:143,width:178,height:5,rx:2.5,className:"ga-track"}),a.jsx("rect",{x:28,y:143,width:105,height:5,rx:2.5,className:"ga-accent"}),a.jsx("text",{x:28,y:165,className:"ga-s",children:"18.9 GB of 32.0 GB"}),a.jsx("text",{x:240,y:76,className:"ga-cap",children:"THERMAL"}),a.jsx("text",{x:240,y:100,className:"ga-big",children:"66 °C"}),a.jsx("text",{x:240,y:118,className:"ga-s ga-ok",children:"running at full speed"}),a.jsx("text",{x:240,y:142,className:"ga-cap",children:"BUSIEST PROCESSES"}),a.jsx("text",{x:240,y:160,className:"ga-s ga-mono",children:"node · claude"}),a.jsx("text",{x:412,y:160,className:"ga-s ga-mono",textAnchor:"end",children:"38%"}),a.jsx("text",{x:240,y:176,className:"ga-s ga-mono",children:"esbuild"}),a.jsx("text",{x:412,y:176,className:"ga-s ga-mono",textAnchor:"end",children:"21%"})]})}function R9(){return a.jsxs(Dn,{children:[a.jsx("rect",{x:14,y:40,width:188,height:120,rx:10,className:"ga-screen"}),a.jsx("text",{x:28,y:60,className:"ga-cap",children:"~/MY-PROJECT"}),a.jsx("line",{x1:14,y1:70,x2:202,y2:70,className:"ga-line"}),a.jsxs("text",{x:28,y:100,className:"ga-t ga-mono",children:[a.jsx("tspan",{className:"ga-accent",children:"$"})," claude"]}),a.jsx("rect",{x:86,y:90,width:7,height:13,className:"ga-caret ga-blink"}),a.jsx("text",{x:28,y:130,className:"ga-s ga-mono",children:"or: codex"}),a.jsx("path",{d:"M210 100H238",className:"ga-arc"}),a.jsx("path",{d:"M233 95l6 5-6 5",className:"ga-arrow"}),a.jsx("rect",{x:250,y:40,width:176,height:120,rx:10,className:"ga-canvas"}),a.jsx("g",{className:"ga-pop",children:a.jsx(Do,{x:278,y:80,w:120,title:"my-project",sub:"Opus 5 · live",tone:"accent"})})]})}function A9(){return a.jsxs(Dn,{children:[a.jsx(Pn,{x:14,y:16,w:232,h:170}),a.jsx("text",{x:28,y:40,className:"ga-t ga-strong",children:"Claude accounts"}),a.jsx(Pj,{x:196,y:33,d:"M7 2.2v9.6M2.2 7h9.6"}),a.jsx(Pj,{x:220,y:33,d:"M3.3 10.7L10.7 3.3M5.2 3.3h5.5v5.5"}),a.jsx("line",{x1:14,y1:52,x2:246,y2:52,className:"ga-line"}),a.jsx(sr,{x:28,y:74,email:"work@team.dev",state:"working",tone:"ok",bars:[24,61]}),a.jsx("rect",{x:190,y:62,width:44,height:18,rx:9,className:"ga-accent"}),a.jsx("text",{x:212,y:74,className:"ga-s ga-on-accent",textAnchor:"middle",children:"active"}),a.jsx("line",{x1:14,y1:140,x2:246,y2:140,className:"ga-line"}),a.jsx(sr,{x:28,y:160,email:"personal@me.dev",state:"signed in",tone:"ok"}),a.jsx("rect",{x:188,y:148,width:46,height:18,rx:9,className:"ga-chip"}),a.jsx("text",{x:211,y:160,className:"ga-s",textAnchor:"middle",children:"switch"}),a.jsx(I0,{x:221,y:161}),a.jsx("path",{d:"M250 40C270 40 262 78 282 78",className:"ga-arc"}),a.jsx("path",{d:"M277 74l5 4-5 4",className:"ga-arrow"}),a.jsx(Pn,{x:282,y:62,w:144,h:64,label:"ANOTHER MACHINE"}),a.jsx("g",{className:"ga-pop",children:a.jsx(sr,{x:296,y:92,email:"work@team.dev",state:"shared here",tone:"ok"})})]})}function M9(){return a.jsxs(Dn,{children:[a.jsx(Pn,{x:14,label:"THIS MACHINE"}),a.jsx(od,{x:28,y:60}),a.jsx("g",{className:"ga-swap-out",children:a.jsx(sr,{x:28,y:98,email:"work@team.dev",state:"login expired",tone:"warn"})}),a.jsx("g",{className:"ga-swap-in",children:a.jsx(sr,{x:28,y:98,email:"work@team.dev",state:"working again",tone:"ok",bars:[24,61]})}),a.jsx(Pn,{x:250,label:"ANOTHER MACHINE"}),a.jsx(od,{x:264,y:60}),a.jsx(sr,{x:264,y:98,email:"work@team.dev",state:"working",tone:"ok",bars:[24,61]}),a.jsx("path",{d:"M246 120C234 80 206 80 194 120",className:"ga-arc"}),a.jsx("g",{className:"ga-travel ga-travel-low",transform:"translate(220 90)",children:a.jsx(O0,{})})]})}const $9=[{art:a.jsx(S9,{}),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:a.jsx(_9,{}),line:"Every agent and subagent is a node. Tool calls light up as they run."},{art:a.jsx(C9,{}),line:"Double-click any node: its prompt, every tool call, tokens and timing."},{art:a.jsx(E9,{}),line:"What each session costs, and how much quota is left."},{art:a.jsx(T9,{}),line:"Cores, memory and heat while the agents run, and what is hogging them."},{art:a.jsx(A9,{}),line:"Several Claude accounts: switch, add one, share one to another machine."},{art:a.jsx(M9,{}),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:a.jsx(R9,{}),line:"Run claude or codex in any folder. It shows up here on its own."}];function I9(){return a.jsxs(Dn,{children:[a.jsx(Pn,{x:14,label:"THIS MACHINE"}),a.jsx(sr,{x:28,y:64,email:"work@team.dev",state:"login expired",tone:"warn"}),a.jsx("rect",{x:40,y:94,width:86,height:20,rx:10,className:"ga-pill-warn"}),a.jsx("text",{x:83,y:108,className:"ga-s ga-warn",textAnchor:"middle",children:"sign in again"}),a.jsx("line",{x1:198,y1:100,x2:242,y2:100,className:"ga-off"}),a.jsx(Pn,{x:250,label:"ANOTHER MACHINE"}),a.jsx(sr,{x:264,y:64,email:"work@team.dev",state:"working",tone:"ok",bars:[24,61]})]})}function O9(){return a.jsxs(Dn,{children:[a.jsx(Pn,{x:14,label:"THIS MACHINE"}),a.jsx(od,{x:28,y:60}),a.jsx(vu,{x:28,y:92,name:"Ana's MacBook"}),a.jsx(vu,{x:28,y:114,name:"Dorin's PC"}),a.jsx(Pn,{x:250,label:"ANOTHER MACHINE"}),a.jsx(od,{x:264,y:60}),a.jsx(vu,{x:264,y:92,name:"Your MacBook"}),a.jsx(vu,{x:264,y:114,name:"Dorin's PC"}),a.jsx("line",{x1:196,y1:100,x2:244,y2:100,className:"ga-arc"}),a.jsx("circle",{cx:220,cy:100,r:10,className:"ga-ring ga-ping"}),a.jsx("circle",{cx:220,cy:100,r:10,className:"ga-ring ga-ping ga-ping-2"}),a.jsx("circle",{cx:220,cy:100,r:3,className:"ga-accent"})]})}function L9(){return a.jsxs(Dn,{children:[a.jsx("rect",{x:90,y:18,width:260,height:164,rx:10,className:"ga-screen"}),a.jsx("text",{x:106,y:42,className:"ga-t ga-strong",children:"This deck on the network"}),a.jsx("line",{x1:90,y1:54,x2:350,y2:54,className:"ga-line"}),a.jsx("text",{x:106,y:76,className:"ga-cap",children:"SHARE THESE ACCOUNTS"}),a.jsx(Lj,{x:106,y:88,on:!0}),a.jsx("text",{x:126,y:98,className:"ga-t ga-mono",children:"work@team.dev"}),a.jsx(Lj,{x:106,y:112}),a.jsx("text",{x:126,y:122,className:"ga-s ga-mono",children:"personal@me.dev"}),a.jsx("text",{x:106,y:150,className:"ga-cap",children:"PAIRING"}),a.jsx("text",{x:106,y:168,className:"ga-s",children:"Say yes to every deck that asks"}),a.jsx(u$,{x:304,y:157,on:!0}),a.jsx(I0,{x:115,y:97})]})}function P9(){return a.jsxs(Dn,{children:[a.jsx(Pn,{x:14,label:"THIS MACHINE"}),a.jsx("g",{className:"ga-swap-out",children:a.jsx(sr,{x:28,y:64,email:"work@team.dev",state:"login expired",tone:"warn"})}),a.jsx("g",{className:"ga-swap-in",children:a.jsx(sr,{x:28,y:64,email:"work@team.dev",state:"working again",tone:"ok",bars:[24,61]})}),a.jsx(Pn,{x:250,label:"ANOTHER MACHINE"}),a.jsx(sr,{x:264,y:64,email:"work@team.dev",state:"working",tone:"ok",bars:[24,61]}),a.jsx("path",{d:"M246 96C234 56 206 56 194 96",className:"ga-arc"}),a.jsx("g",{className:"ga-travel",transform:"translate(220 66)",children:a.jsx(O0,{})})]})}const D9=[{art:a.jsx(I9,{}),line:"A login can expire on one machine while it still works on another."},{art:a.jsx(O9,{}),line:"Both decks are on. They find each other and ask to pair.",tip:"Not showing up? Add a deck, the link at the top, takes an address or invite."},{art:a.jsx(L9,{}),line:"Tick which logins this machine may hand out. Nothing is shared until you do."},{art:a.jsx(P9,{}),line:"An expired login is copied from a paired machine within a minute."}];function F9(){return a.jsxs("svg",{className:"guide-art",viewBox:"0 0 232 60","aria-hidden":!0,focusable:"false",children:[a.jsx("rect",{x:1,y:14,width:78,height:42,rx:7,className:"ga-screen"}),a.jsx("circle",{cx:13,cy:29,r:3,className:"ga-warn"}),a.jsx("rect",{x:21,y:27,width:46,height:4,rx:2,className:"ga-track"}),a.jsx("rect",{x:13,y:39,width:40,height:3,rx:1.5,className:"ga-track"}),a.jsx("rect",{x:153,y:14,width:78,height:42,rx:7,className:"ga-screen"}),a.jsx("circle",{cx:165,cy:29,r:3,className:"ga-ok"}),a.jsx("rect",{x:173,y:27,width:46,height:4,rx:2,className:"ga-track"}),a.jsx("rect",{x:165,y:39,width:40,height:3,rx:1.5,className:"ga-accent"}),a.jsx("path",{d:"M150 36C138 6 94 6 82 36",className:"ga-arc"}),a.jsx("g",{transform:"translate(116 13)",children:a.jsx(O0,{})})]})}const q9={panel:"Nothing here is stuck: whoever pastes an invite is the one dialling out. Ask them for one and paste it behind Add a deck, the link 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."},B9=1600;function d$({reach:e,where:t}){const[n,r]=v.useState(!1),s=v.useRef(!0);v.useEffect(()=>()=>{s.current=!1},[]);const i=(e==null?void 0:e.steps)??[],l=v.useCallback(async()=>{await Ba(i.join(`
|
|
81
|
-
`))&&s.current&&(r(!0),window.setTimeout(()=>{s.current&&r(!1)},B9))},[i]);if(!(e!=null&&e.blocked))return null;const u=e.shell==="sh";return a.jsxs("div",{className:"ap-lan-reach",children:[a.jsx("p",{className:"lan-warn",children:e.text}),a.jsx("p",{className:"lan-note",children:q9[t]}),i.length>0&&a.jsxs("details",{className:"ap-lan-reach-fix",children:[a.jsx("summary",{children:"or let them find this deck on their own"}),a.jsxs("p",{className:"lan-note",children:[u?a.jsx(a.Fragment,{children:"Run this in a terminal on this machine, then restart the deck."}):a.jsxs(a.Fragment,{children:["Run this in PowerShell ",a.jsx("strong",{children:"as Administrator"}),", then restart the deck."]}),e.category==="Public"&&a.jsx(a.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&&a.jsxs(a.Fragment,{children:[" ",e.unsure]})]}),a.jsx("pre",{className:"ap-lan-cmd",children:a.jsx("code",{children:i.join(`
|
|
82
|
-
`)})}),a.jsx("button",{type:"button",className:"ap-manage-btn",onClick:()=>void l(),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"})]})]})}function U9(e){const t=(e??"").trim(),n=t.lastIndexOf(":");if(n<=0||n===t.length-1)return null;const r=t.slice(0,n).trim(),s=Number(t.slice(n+1).trim());return!r||!Number.isInteger(s)||s<1||s>65535||r.includes(":")&&!(r.startsWith("[")&&r.endsWith("]"))?null:{addr:r,port:s}}function z9(e,t){const n=Math.max(0,Math.round((e-t)/1e3));return`${Math.floor(n/60)}:${String(n%60).padStart(2,"0")}`}async function fp(e,t){return(await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json().catch(()=>null)}const H9={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."},W9={not_running:"This deck is not on the network yet. Turn Local network on, then make one."};function Fj(e,t,n){return(t==null?void 0:t.reason)&&e[t.reason]||Ct(n,t)}function V9({status:e,manual:t,startWith:n,onClose:r,onChanged:s}){const i=v.useRef(null),l=v.useRef(null),u=v.useRef(null),d=v.useRef(null),f=e.pairingMode==="invite",h=mt(r,{focusRef:f?l:i}),[p,g]=v.useState(""),[w,k]=v.useState(""),[x,b]=v.useState(null),[j,S]=v.useState(null),[_,E]=v.useState(null),[T,R]=v.useState(null),[A,U]=v.useState(()=>Date.now());v.useEffect(()=>{const G=window.setInterval(()=>U(Date.now()),1e3);return()=>window.clearInterval(G)},[]);const I=v.useRef(!0);v.useEffect(()=>()=>{I.current=!1},[]);const q=v.useRef(null),P=v.useRef(null),O=v.useCallback(G=>Id(q.current)?(q.current=G,E(G),!0):!1,[]),V=v.useCallback(()=>{q.current=null,I.current&&E(null)},[]),$=G=>{const X=Vs(_,G);return{disabled:X.disabled,"aria-busy":X.busy}},M=G=>(x==null?void 0:x.field)===G?{"aria-invalid":!0,"aria-describedby":"lan-add-failure"}:{},L=G=>b(X=>X&&X.field===G?null:X),Y=v.useCallback(async()=>{if(f)return;const G=U9(p);if(!G){b({text:G9(p),field:"addr"});return}const X=`${G.addr}:${G.port}`,Z=e.peers.find(ee=>ee.addr===G.addr&&ee.port===G.port&&ee.paired);if(Z){b({text:`Already paired with ${Z.name} at that address.`,field:"addr"});return}if(t.includes(X)){b({text:"This deck already calls that address.",field:"addr"});return}if(O("add"))try{const ee=await fp("/api/prefs",{lan:{manual:[...t,X]}});if(!I.current)return;ee!=null&&ee.ok?(b(null),g(""),s(),r()):b({text:Ct("add that address",ee),field:"addr"})}catch{I.current&&b({text:Ct("add that address",null),field:"addr"})}finally{V()}},[p,f,t,e.peers,s,r,O,V]),K=v.useCallback(async G=>{if(!O(`invite:${G}`))return;const X=G==="make"?"make an invite":"cancel that invite";try{const Z=await fp("/api/lan/invite",{action:G});if(!I.current)return;Z!=null&&Z.ok?(P.current=G,b(null),S(null),s()):b({text:Fj(W9,Z,X)})}catch{I.current&&b({text:Ct(X,null)})}finally{V()}},[s,O,V]),D=v.useCallback(async()=>{const G=w.trim();if(!(!G||!O("join"))){R(null);try{const X=await fp("/api/lan/invite",{action:"join",token:G});if(!I.current)return;X!=null&&X.ok?(k(""),b(null),s(),r()):(X==null?void 0:X.reason)==="unreachable"&&Array.isArray(X.tried)&&X.tried.length?(R(X.tried),b(null)):(R(null),b({text:Fj(H9,X,"use that invite"),field:"join"}))}catch{I.current&&b({text:Ct("use that invite",null),field:"join"})}finally{V()}}},[w,s,r,O,V]),z=v.useCallback(async(G,X)=>{try{await navigator.clipboard.writeText(G),S(X),window.setTimeout(()=>{I.current&&S(Z=>Z===X?null:Z)},1600)}catch{b({text:"Could not copy it — select the text and copy it by hand."})}},[]),F=e.invite&&e.invite.expiresAt>A?e.invite:null,H=v.useRef(!1);v.useEffect(()=>{n!=="invite"||H.current||F||(H.current=!0,K("make"))},[n,F,K]);const J=v.useRef(!1);v.useEffect(()=>{var G;n!=="invite"||J.current||!F||(J.current=!0,(G=u.current)==null||G.focus())},[n,F]),v.useEffect(()=>{var X,Z;const G=P.current;!G||G==="make"!=!!F||(P.current=null,ns(((X=document.activeElement)==null?void 0:X.tagName)??null)&&((Z=(G==="make"?u:d).current)==null||Z.focus()))},[F]);const W=e.port!=null?(e.addrs??[]).map(G=>`${G}:${e.port}`):[];return Ot.createPortal(a.jsx("div",{className:"modal-backdrop",onClick:r,role:"presentation",children:a.jsxs("div",{ref:h,className:"modal lan-add",onClick:G=>G.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"lan-add-title",children:[a.jsxs("header",{className:"modal-head",children:[a.jsx("div",{className:"modal-title",children:a.jsx("span",{id:"lan-add-title",className:"modal-tool-name",children:"Add a deck"})}),a.jsx("div",{className:"modal-actions",children:a.jsx("button",{className:"glyph-btn",onClick:r,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),a.jsxs("section",{className:"modal-body",children:[x&&a.jsxs("div",{className:"ap-failure",role:"alert",children:[a.jsx("span",{id:"lan-add-failure",className:"ap-failure-text",children:x.text}),a.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>b(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),a.jsx(d$,{reach:e.reach,where:"dialog"}),f&&a.jsx("div",{className:"modal-section",children:a.jsx("p",{className:"lan-note",children:"Adding by address is off while this deck pairs only by invite."})}),!f&&a.jsxs("div",{className:"modal-section",children:[a.jsx("h3",{className:"lan-h",children:"By address"}),a.jsxs("div",{className:"ap-lan-row",children:[a.jsx("input",{ref:i,className:"ap-manage-input ap-lan-input","aria-label":"Another deck's address",value:p,placeholder:"192.168.1.5:54340",spellCheck:!1,...M("addr"),onChange:G=>{g(G.target.value),L("addr")},onKeyDown:G=>{G.key==="Enter"&&Y()}}),p.trim()!==""&&a.jsx("button",{type:"button",className:"ap-manage-btn",...$("add"),onClick:()=>void Y(),title:"Add it to the decks this one calls, starting now.",children:"add"})]}),a.jsx("p",{className:"lan-note",children:"This deck calls that address until somebody there accepts."}),e.port!=null&&W.length>0&&a.jsxs("p",{className:"lan-note",children:["They type this deck’s own address into the same field on theirs:"," ",W.map((G,X)=>a.jsxs("span",{children:[X>0&&" or ",a.jsx("code",{className:"ap-lan-code",children:G})]},G)),a.jsx("button",{type:"button",className:"ap-lan-word lan-copy",...$("copy:mine"),onClick:()=>void z(W.join(" "),"mine"),title:"Copy this deck's address, to send to whoever is adding it",children:j==="mine"?"copied":"copy"})]})]}),a.jsxs("div",{className:"modal-section",children:[a.jsxs("h3",{className:"lan-h",children:["With an invite",!F&&a.jsx("button",{type:"button",className:"ap-lan-word lan-h-act",ref:d,...$("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"})]}),a.jsxs("div",{className:"ap-lan-row",children:[a.jsx("input",{ref:l,className:"ap-manage-input ap-lan-input","aria-label":"An invite you were sent",value:w,placeholder:"paste one you were sent",spellCheck:!1,...M("join"),onChange:G=>{k(G.target.value),R(null),L("join")},onKeyDown:G=>{G.key==="Enter"&&D()}}),w.trim()!==""&&a.jsx("button",{type:"button",className:"ap-manage-btn",...$("join"),onClick:()=>void D(),title:"Reach that deck and pair with it. Nobody has to press anything there.",children:_==="join"?"joining…":"join"})]}),a.jsx("p",{className:"lan-note",children:"Pasting one pairs both decks on the spot — nobody has to accept."}),T&&a.jsxs("div",{className:"ap-lan-tried",children:[a.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."}),T.map(G=>a.jsxs("span",{className:"ap-lan-tried-row",children:[a.jsx("code",{className:"ap-lan-code",children:G.addr}),a.jsx("span",{className:"ap-lan-bad",children:G.why})]},G.addr))]}),F&&a.jsxs("div",{className:"ap-lan-invite",children:[a.jsxs("div",{className:"ap-lan-invite-head",children:[a.jsx("span",{className:"ap-lan-invite-title",children:"Send this to them"}),a.jsxs("span",{className:"ap-lan-invite-left",id:"lan-invite-left",children:[z9(F.expiresAt,A)," left"]})]}),a.jsx("code",{className:"ap-lan-token",children:F.token}),a.jsxs("div",{className:"ap-lan-acts",children:[a.jsx("button",{type:"button",className:"ap-manage-btn",ref:u,...$("copy:invite"),"aria-label":j==="invite"?"Invite copied":"Copy invite","aria-describedby":"lan-invite-left",onClick:()=>void z(F.token,"invite"),title:"Copy it, and send it however you already talk to them",children:j==="invite"?"copied":"copy"}),a.jsx("button",{type:"button",className:"ap-manage-btn",...$("invite:withdraw"),onClick:()=>void K("withdraw"),title:"Cancel it. Anybody already holding the text can no longer use it.",children:"cancel"})]}),a.jsx("p",{className:"lan-warn",children:"Anyone who gets this text can pair with this deck until it runs out."})]})]})]})]})}),document.body)}function G9(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}".`}function K9({asks:e,pressProps:t,answer:n}){return a.jsx("div",{className:"ap-lan-asks",role:"alert",children:e.map(r=>a.jsxs("div",{className:"ap-lan-ask",children:[a.jsxs("span",{className:"ap-lan-ask-what",children:[a.jsx("strong",{className:"ap-lan-peer-name",children:r.name})," at ",a.jsx("code",{className:"ap-lan-code",children:r.addr})," wants to pair"]}),a.jsxs("span",{className:"ap-lan-ask-fp",id:`lan-ask-fp-${r.fp}`,children:["fingerprint ",a.jsx("code",{className:"ap-lan-code",children:r.fp})]}),a.jsxs("span",{className:"ap-lan-ask-acts",children:[a.jsx("button",{type:"button",className:"ap-manage-btn",...t(`accept:${r.fp}`),"aria-label":`Accept ${r.name}`,"aria-describedby":`lan-ask-fp-${r.fp}`,onClick:()=>void n("accept",r.fp,"accept that deck"),title:`Talk to this deck from now on. Its fingerprint is ${r.fp} — check it matches the one on their screen before you accept.`,children:"accept"}),a.jsx("button",{type:"button",className:"ap-manage-btn",...t(`dismiss:${r.fp}`),"aria-label":`Decline ${r.name}`,"aria-describedby":`lan-ask-fp-${r.fp}`,onClick:()=>void n("dismiss",r.fp,"decline that request"),title:"Say no. Nothing is shared, and that deck is told rather than left waiting.",children:"decline"})]})]},r.fp))})}function Y9({rows:e,pairingMode:t,armed:n,pressProps:r,answer:s,dropAddress:i,onUnpair:l,onOpenPeer:u,onInvite:d}){return a.jsx("ul",{className:"ap-lan-here",children:e.map((f,h)=>a.jsxs("li",{className:"ap-lan-who","data-tone":f.tone,children:[a.jsx("i",{className:f.here?"ap-pulse":"ap-dot","aria-hidden":!0}),a.jsxs("span",{className:"ap-lan-who-name","aria-hidden":!0,children:[f.name,f.via==="tailscale"&&a.jsx("span",{className:"ap-lan-via",children:" · Tailscale"})]}),a.jsx("button",{type:"button",className:"ap-lan-who-open","aria-haspopup":"dialog","aria-describedby":`lan-who-state-${h}`,onClick:()=>u(f.fp),children:a.jsxs("span",{className:"vis-hidden",children:[f.name,f.via==="tailscale"?", over Tailscale":"",", details"]})}),a.jsx("span",{id:`lan-who-state-${h}`,className:f.quiet?"vis-hidden":"ap-lan-who-when",children:f.state}),f.kind==="nearby"&&t!=="invite"&&a.jsx("button",{type:"button",className:"ap-manage-btn ap-lan-do",...r(`accept:${f.fp}`),onClick:()=>void s("accept",f.fp,"reach that deck"),"aria-label":`Ask ${f.name} to pair`,title:`Send ${f.name} a request. Somebody at that machine has to accept it before anything is shared. Its fingerprint is ${f.fp}.`,children:"ask"}),(f.kind==="nearby"||f.kind==="declined")&&t==="invite"&&a.jsx("button",{type:"button",className:"ap-manage-btn ap-lan-do","aria-haspopup":"dialog",onClick:d,"aria-label":`Invite ${f.name} to pair`,title:`This deck pairs only by invite. Make one and send it to whoever is at ${f.name}.`,children:"invite"}),f.kind==="paired"&&a.jsx("button",{type:"button",className:`ap-manage-btn ap-lan-do danger${n===f.fp?" armed":""}`,...r(`unpair:${f.fp}`),onClick:()=>l(f),"aria-label":n===f.fp?`Confirm unpairing ${f.name}`:`Unpair ${f.name}`,title:n===f.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:n===f.fp?"confirm":"unpair"}),f.kind==="dialling"&&a.jsx("button",{type:"button",className:"ap-manage-btn ap-lan-do",...r(`drop:${f.fp}`),onClick:()=>void i(f.fp),"aria-label":`Stop dialling ${f.name}`,title:"Stop trying this address. Nothing was ever paired here.",children:"stop"}),f.kind==="declined"&&t!=="invite"&&a.jsx("button",{type:"button",className:"ap-manage-btn ap-lan-do",...r(`allow:${f.fp}`),onClick:()=>void s("allow",f.fp,"let that deck ask again"),"aria-label":`Let ${f.name} ask again`,title:"Take the no back. That deck is still trying, so the request comes round again on its own.",children:"allow"})]},`${f.kind}:${f.fp}`))})}function X9(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 Z9({on:e,status:t}){return a.jsxs(a.Fragment,{children:[e&&a.jsx(d$,{reach:t==null?void 0:t.reach,where:"panel"}),e&&(t==null?void 0:t.deaf)&&a.jsx("p",{className:"ap-lan-fine",children:t.deaf}),e&&(t==null?void 0:t.lanTunneled)&&a.jsx("p",{className:"ap-lan-fine",children:X9(t)})]})}const qj=["online","offline","loose"],J9={online:0,offline:1,loose:1};function Q9(e){return e.kind==="declined"?null:e.kind==="paired"?e.here?"online":"offline":"loose"}const eV=76,tV=62,nV=96,rV={1:[.62],2:[.58,1]},Bj=.16;function sV(e,t){return Math.PI*(3*(e+t)-Math.sqrt((3*e+t)*(e+3*t)))}function aV(e,t){return t<-Math.abs(e)*.6?"top":"bottom"}function oV(e,t){if(e<=2)return t%2===0?0:90;const n=360/e;return-90+(t%2===0?0:n/2)}function iV(e){return e.map((t,n)=>({...t,i:n})).sort((t,n)=>qj.indexOf(t.tier)-qj.indexOf(n.tier)||+(t.row.via==="tailscale")-+(n.row.via==="tailscale")||t.i-n.i).map(({row:t,tier:n})=>({row:t,tier:n}))}function lV(e,t,n){const r=new Map;for(const g of e){const w=Q9(g);if(!w)continue;const k=J9[w];r.has(k)||r.set(k,[]),r.get(k).push({row:g,tier:w})}const s=[...r.keys()].sort((g,w)=>g-w),i=rV[s.length]??[],l=Math.max(0,t/2-eV),u=Math.max(0,n/2-tV),d=s.map((g,w)=>({ring:g,rx:l*i[w],ry:u*i[w],count:r.get(g).length})),f=[];let h=!1,p=0;return d.forEach((g,w)=>{const k=iV(r.get(g.ring)),x=k.length,b=x>1&&sV(g.rx,g.ry)/x<nV;b&&(h=!0);const S=w===d.length-1?-Bj*(i[w]-(i[w-1]??0)):Bj*(i[w+1]-i[w]),_=oV(x,w);k.forEach(({row:E,tier:T},R)=>{const A=(_+360/x*R)*Math.PI/180,U=b&&R%2===1?1+S/i[w]:1,I=Math.cos(A)*g.rx*U,q=Math.sin(A)*g.ry*U;f.push({row:E,tier:T,ring:g.ring,x:I,y:q,angle:cV(Math.atan2(q,I)*180/Math.PI),dist:Math.hypot(I,q),side:aV(I,q),order:p++})})}),{nodes:f,rings:d,dense:h}}function cV(e){return(e%360+360)%360}function uV(e){const t=n=>e.filter(n).length;return{paired:t(n=>n.kind==="paired"),online:t(n=>n.kind==="paired"&&n.here),offline:t(n=>n.kind==="paired"&&!n.here),nearby:t(n=>n.kind==="nearby"),asks:t(n=>n.kind==="asks"),dialling:t(n=>n.kind==="dialling"),declined:t(n=>n.kind==="declined"),tailnet:t(n=>n.kind!=="declined"&&n.via==="tailscale")}}function dV(e){const t=[];return e.paired===0?t.push("no paired decks yet"):e.online===e.paired?t.push(`${e.paired} paired deck${e.paired===1?"":"s"}, all online`):t.push(`${e.online} of ${e.paired} paired deck${e.paired===1?"":"s"} online`),e.asks&&t.push(`${e.asks} asking to pair`),e.nearby&&t.push(`${e.nearby} nearby, not paired`),e.dialling&&t.push(`${e.dialling} still dialling`),t.join(" · ")}function hV(e,t){switch(e.kind){case"asks":return"wants to pair";case"nearby":return e.state;case"dialling":return"dialling";case"declined":return"declined";case"paired":{if(e.here)return t?fV(t):"online";const n=f$(e);return n?n==="now"?"offline · just now":`offline · ${n}`:e.state.startsWith("one-way")?"one-way · quiet":"offline"}}}function h$(e){if(e.kind!=="paired")return e.via==="tailscale"?`${e.state}, over Tailscale`:e.state;if(e.here)return e.via==="tailscale"?"online, over Tailscale":"online";const t=f$(e),n=t?t==="now"?"offline · last online just now":`offline · last online ${t}`:e.state.startsWith("one-way")?e.state:"offline";return e.via==="tailscale"?`${n}, over Tailscale`:n}function f$(e){var t;return((t=/last online (.+)$/.exec(e.state))==null?void 0:t[1])??null}function fV(e){return e.trim().split(/\s+/).slice(0,2).join(" ")}function pV(e){var r;if(!e)return[];const t=(e.addrs??[]).map(s=>`${s}:${e.port}`),n=(r=e.tailscale)==null?void 0:r.addr;return n&&!(e.addrs??[]).includes(n)&&t.push(`${n}:${e.port}`),t}function Ps(e){let t=e.fp;for(const n of e.twins??[])n.fp<t&&(t=n.fp);return t}function mV(e,t){if(e==null)return t;const n=((t-e)%360+540)%360-180;return e+n}function gV(e,t){const n=/^(\d+)\.(\d+)\.(\d+)/.exec(e??""),r=/^(\d+)\.(\d+)\.(\d+)/.exec(t??"");if(!n||!r)return null;for(let s=1;s<=3;s++){const i=Number(n[s])-Number(r[s]);if(i)return Math.sign(i)}return 0}function yV(e,t,n,r=!0){const s=t?t.alive?t.shareable===!1?"cannot share here":"works here":"expired here":"not on this deck";if(e.alive&&e.shareable===!1)return{there:"cannot share there",here:s,note:null,tone:"idle"};if(!e.alive){const i=t&&!t.alive?"neither copy works — sign in again here":null;return{there:"broken there",here:s,note:i,tone:i?"bad":"idle"}}return t?t.alive?{there:"works there",here:s,note:null,tone:t.shareable===!1?"idle":"ok"}:n?{there:"works there",here:s,note:"repairs next round",tone:"wait"}:{there:"works there",here:s,note:"share it to repair",tone:"bad"}:r||n?{there:"works there",here:s,note:"arrives next round",tone:"wait"}:{there:"works there",here:s,note:"paired automatically — pair by invite to take it",tone:"bad"}}function wV(e,t,n,r=null,s=!0){var f;const i=new Map;for(const h of t)(f=i.get(h.key))!=null&&f.alive||i.set(h.key,h);const l=new Set(n),u=[],d=new Set;for(const h of e??[]){if(d.has(h.key))continue;d.add(h.key);const p=i.get(h.key)??null,g=l.has(h.key),w=yV(h,p,g,s),k=p?p.alive?p.shareable===!1?"unavailable":"works":"expired":"missing",x=!h.alive&&p&&!p.alive?w.note:[k==="works"?null:w.here,h.alive&&h.shareable!==!1?null:w.there,w.note].filter(Boolean).join(" · ")||null;u.push({key:h.key,email:h.email,here:k,there:h.alive?h.shareable===!1?"unavailable":"works":"broken",in:!h.alive||h.shareable===!1?"cut":w.tone==="wait"?"wait":w.tone==="bad"?"blocked":"live",out:g&&p?p.alive&&p.shareable!==!1?"live":"cut":null,caption:x,tone:w.tone,usedThere:r===h.key})}for(const h of n){const p=i.get(h);!p||d.has(h)||(d.add(h),u.push({key:h,email:p.email,here:p.alive?p.shareable===!1?"unavailable":"works":"expired",there:"unknown",in:null,out:p.alive&&p.shareable!==!1?"live":"cut",caption:p.alive?p.shareable===!1?"cannot share here":null:"expired here",tone:p.alive?p.shareable===!1?"idle":"ok":"bad",usedThere:!1}))}return u}const vV=1e3;function p$(e,t){const n=new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),r=Cr(e,t);return`${n} · ${r==="now"?"just now":r}`}function Sx(e){return e&&[e.version,e.os,e.arch].filter(Boolean).join(" · ")||null}const m$={works:"works here",expired:"expired here",missing:"not on this deck",unavailable:"cannot share here"},g$={works:"works there",broken:"broken there",unavailable:"cannot share there",unknown:"not offered by that deck"};function y$(e){const t=e.in&&e.out?"offered both ways":e.in?"offered by that deck":"offered by this deck";return`${m$[e.here]}, ${g$[e.there]}, ${t}${e.usedThere?", in use there":""}.`}function w$({row:e,source:t,status:n,accounts:r,now:s}){var W,G,X,Z,ee;const{peer:i,stranger:l}=t,u=e.kind==="paired",d=e.self??e.name,f=e.kind!=="dialling",h=e.kind==="dialling"?null:e.fp,p=i?i.addr?`${i.addr}:${i.port}`:"":l?l.port?`${l.addr}:${l.port}`:l.addr:e.addr,g=(i==null?void 0:i.about)??null,w=((W=n.about)==null?void 0:W.version)??null,k=u?i!=null&&i.waiting?i.lastSeen!=null?"not said — it runs an older version":"not said yet — it says when it next calls":i!=null&&i.offers?"not said — it runs an older version":"not reached yet":"shown once paired",x=Sx(n.about),b=Sx(g),j=g!=null&&g.version&&w?gV(g.version,w):null,S=i?Dd(i.last,s):null,_=i&&((G=i.last)!=null&&G.error)?e9({error:i.last.error,host:i.addr,port:i.port},[...n.strangers??[],...n.pending??[],...(n.peers??[]).filter(re=>!re.manual&&re.addr).map(re=>({fp:re.fp,name:re.name,addr:re.addr,port:re.port,at:re.lastSeen??0}))],s):null,E=(X=i==null?void 0:i.last)!=null&&X.error&&S&&S.text!==i.last.error?i.last.error:null,T=((Z=i==null?void 0:i.last)==null?void 0:Z.done)??[],R=!!S&&!!E&&!e.quiet&&e.state.startsWith(S.text),A=u||e.kind==="dialling",U=((i==null?void 0:i.via)??e.via)==="tailscale",I=i?i.waiting?null:i.manual?U?"added by its Tailscale address":"added by address":U?"over Tailscale":"on this network":e.kind==="nearby"?U?"heard over Tailscale":"heard on this network":U?"asked this deck to pair, over Tailscale":"asked this deck to pair",q=e.tone==="bad"?"bad":u?e.here?"up":"down":"loose",P=(i==null?void 0:i.offers)??null,O=q==="up"?(P==null?void 0:P.current)??null:null,V=O&&"key"in O?O.key:null,$=!!O&&"hidden"in O,M=!!O&&"other"in O,L=u?wV((P==null?void 0:P.accounts)??null,r,n.shared??[],V,(i==null?void 0:i.autoPaired)!==!0):[],Y=L.filter(re=>re.in==null&&re.out==="cut"),K=L.some(re=>re.in!=null),D=L.some(re=>re.out!=null),z=new Map(T.map(re=>[re.email,re])),F=T.filter(re=>!L.some(ce=>ce.email===re.email)),H=u?P?P.accounts.length===0?"That deck offers nothing. Nobody there has chosen a login to share.":null:i!=null&&i.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.":(ee=i==null?void 0:i.last)!=null&&ee.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,J=P&&(i!=null&&i.last)&&i.last.at-P.at>vV?Cr(P.at,s):null;return{peer:i,stranger:l,paired:u,own:d,canRename:f,fp:h,where:p,about:g,unsaid:k,hereRuns:x,thereRuns:b,order:j,line:S,silence:_,raw:E,echoed:R,showRound:A,how:I,link:q,hiddenThere:$,otherThere:M,lanes:L,spent:Y,taking:K,giving:D,told:z,unplaced:F,unknown:H,stale:J}}function _x(){return a.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:[a.jsx("rect",{x:"2.5",y:"3",width:"11",height:"7.5",rx:"1.2"}),a.jsx("path",{d:"M1 13h14"})]})}function xu({dir:e,gate:t=!1}){const n=t?12:8;return a.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:a.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"})})}function xV({view:e,row:t,status:n,asking:r,drawn:s,onSettings:i}){const{peer:l,paired:u,where:d,about:f,unsaid:h,hereRuns:p,thereRuns:g,order:w,line:k,silence:x,raw:b,echoed:j,showRound:S,how:_,link:E,hiddenThere:T,otherThere:R,lanes:A,spent:U,taking:I,giving:q,told:P,unplaced:O,unknown:V,stale:$}=e;return a.jsxs("div",{className:"lan-map","data-link":E,"data-asking":r||void 0,"data-bus":A.length>0||void 0,children:[a.jsxs("div",{className:"lan-ends",children:[a.jsxs("p",{className:"lan-end",children:[a.jsx("span",{className:"lan-end-name",children:"This deck"}),p&&a.jsx("span",{className:"lan-end-runs",children:p}),u&&n.shareActive===!1&&a.jsx("span",{className:"lan-end-note",children:"current account hidden"})]}),a.jsxs("p",{className:"lan-end","data-side":"there",children:[a.jsx("span",{className:"lan-end-name",children:t.name}),t.kind!=="dialling"&&a.jsxs("span",{className:"lan-end-runs",children:[g??(f?"not said":h),w?` · ${w<0?"older":"newer"}`:null]}),T&&a.jsx("span",{className:"lan-end-note",children:"current account hidden"}),R&&a.jsx("span",{className:"lan-end-note",children:"on another account"})]})]}),a.jsxs("div",{className:"lan-link",children:[a.jsx(_x,{}),a.jsxs("span",{className:"lan-span",children:[a.jsxs("span",{className:"lan-wire","aria-hidden":!0,children:[a.jsx("i",{className:"lan-glint","data-dir":"out"}),a.jsx("i",{className:"lan-glint","data-dir":"in"})]}),a.jsx("span",{className:"lan-link-label",children:d?a.jsx("code",{className:"ap-lan-code",children:d}):"none here — it calls this deck"})]}),a.jsx(_x,{}),(d&&_||S)&&a.jsxs("p",{className:"lan-link-sub",children:[d&&_,d&&_&&S&&" · ",S&&(k?j?a.jsx("code",{className:"ap-lan-code",children:b}):a.jsx("span",{className:"lan-round","data-tone":k.tone,children:k.text.replace(/ · now$/," · just now")}):"not asked yet"),S&&b&&!j&&a.jsx("code",{className:"lan-fact-raw",children:b})]}),O.length>0&&a.jsx("ul",{className:"lan-done",children:O.map(M=>{const L=xx(M);return a.jsxs("li",{"data-ok":M.ok&&!L,children:[M.email," ",a.jsxs("span",{className:"lan-done-what",children:[M.ok?"arrived":"did not arrive",L&&` — ${L.long}`]})]},`${M.email}:${M.action}`)})}),x&&a.jsx("p",{className:"lan-note lan-link-note",children:x}),(l==null?void 0:l.waiting)&&a.jsx("p",{className:"lan-note lan-link-note",children:t.hint}),(k==null?void 0:k.hint)&&a.jsx("p",{className:"lan-note lan-link-note",children:k.hint})]}),A.length>0&&a.jsx("ul",{className:"lan-lanes",role:"list","aria-label":`Logins between this deck and ${t.name}`,children:A.map((M,L)=>{const Y=P.get(M.email),K=Y?xx(Y):null,D=M.out==="live"||M.in!=null&&M.in!=="cut";return a.jsxs("li",{role:"listitem",className:"lan-lane","data-tone":M.tone,"data-draw":M.in&&M.out?"both":M.in?"in":"out","data-used-there":M.usedThere||void 0,style:{"--i":L},children:[a.jsx("i",{className:"lan-pip","data-end":"here","data-state":M.here,"aria-hidden":!0}),a.jsxs("span",{className:"lan-track",children:[a.jsxs("span",{className:"lan-wire","data-flow":D?"live":"cut","aria-hidden":!0,children:[(M.in==="live"||M.in==="wait")&&a.jsx("i",{className:"lan-glint","data-dir":"in","data-tone":M.in}),M.out==="live"&&a.jsx("i",{className:"lan-glint","data-dir":"out"})]}),M.in&&M.in!=="cut"&&a.jsx(xu,{dir:"in",gate:M.in==="blocked"}),M.out==="live"&&a.jsx(xu,{dir:"out"}),a.jsx("span",{className:"lan-lane-email",children:M.email})]}),a.jsx("i",{className:"lan-pip","data-end":"there","data-state":M.there,"aria-hidden":!0}),a.jsx("span",{className:"vis-hidden",children:y$(M)}),(M.caption||Y)&&a.jsxs("span",{className:"lan-lane-note",children:[M.caption,M.caption&&Y&&" · ",Y&&a.jsxs("span",{className:"lan-lane-done","data-ok":Y.ok&&!K,children:[Y.ok?"arrived last round":"did not arrive last round",K&&` — ${K.long}`]})]})]},M.key)})},s),u&&a.jsxs(a.Fragment,{children:[U.length>0&&a.jsxs("p",{className:"lan-spent",children:["Paired decks get nothing from ",U.length===1?U[0].email:"the expired ones"," until you sign in again here."]}),V&&a.jsx("p",{className:"lan-empty",children:V}),$&&a.jsxs("p",{className:"lan-stale",children:["As of ",$==="now"?"just now":$,", when it last answered."]}),a.jsxs("div",{className:"lan-legend",children:[I&&a.jsxs("span",{className:"lan-key",children:[a.jsx("span",{className:"lan-key-wire","data-dir":"in","aria-hidden":!0,children:a.jsx(xu,{dir:"in"})}),"from ",t.name]}),q?a.jsxs("span",{className:"lan-key",children:[a.jsx("span",{className:"lan-key-wire","data-dir":"out","aria-hidden":!0,children:a.jsx(xu,{dir:"out"})}),"from this deck, to every paired deck"]}):a.jsx("span",{className:"lan-key",children:"This deck offers nothing yet."}),a.jsx("button",{type:"button",className:"ap-lan-word lan-legend-act",onClick:i,"aria-label":"Change what this deck offers",children:"change"})]})]})]})}const bV=20,Uj=34,kV=90,NV=5.2,jV=.61803398875;function SV({status:e,rows:t,accounts:n,now:r,covered:s,onOpenDeck:i,onClose:l}){const u=v.useRef(null),d=mt(l,{focusRef:u}),f=v.useRef(null),[h,p]=v.useState(null);v.useLayoutEffect(()=>{const H=f.current;if(!H)return;const J=()=>p(G=>{const X=Math.round(H.clientWidth),Z=Math.round(H.clientHeight);return G&&G.w===X&&G.h===Z?G:{w:X,h:Z}});if(J(),typeof ResizeObserver>"u")return;const W=new ResizeObserver(J);return W.observe(H),()=>W.disconnect()},[]);const g=v.useMemo(()=>h?lV(t,h.w,h.h):null,[t,h]),w=v.useMemo(()=>uV(t),[t]),k=(g==null?void 0:g.nodes)??[],x=v.useRef(new Map),b=v.useMemo(()=>{const H=new Map;for(const J of k){const W=Ps(J.row);H.set(W,mV(x.current.get(W),J.angle))}return x.current=H,H},[k]),[j,S]=v.useState(null),[_,E]=v.useState(null),T=v.useRef(null),R=v.useCallback(H=>{T.current!=null&&window.clearTimeout(T.current),T.current=null,S(H),E(H)},[]),A=v.useCallback(()=>{T.current!=null&&window.clearTimeout(T.current),T.current=window.setTimeout(()=>S(null),kV)},[]);v.useEffect(()=>()=>{T.current!=null&&window.clearTimeout(T.current)},[]);const U=j&&k.some(H=>Ps(H.row)===j)?j:null,I=_?t.find(H=>Ps(H)===_)??null:null;v.useEffect(()=>{_&&!I&&E(null)},[_,I]);const[q,P]=v.useState(null),O=v.useRef(new Map),V=k.findIndex(H=>Ps(H.row)===q),$=V<0?0:V,M=H=>{var X;if(k.length===0)return;const J=H.key==="ArrowRight"||H.key==="ArrowDown"?1:H.key==="ArrowLeft"||H.key==="ArrowUp"?-1:0,W=H.key==="Home"?0:H.key==="End"?k.length-1:J?($+J+k.length)%k.length:null;if(W==null)return;H.preventDefault();const G=Ps(k[W].row);P(G),(X=O.current.get(G))==null||X.focus()},[L,Y]=v.useState(()=>typeof document<"u"&&document.hidden);v.useEffect(()=>{const H=()=>Y(document.hidden);return document.addEventListener("visibilitychange",H),()=>document.removeEventListener("visibilitychange",H)},[]);const K=(e==null?void 0:e.enabled)===!0,D=e?K?dV(w):"Local network is off":"checking…",z=()=>{E(null),S(null)},F=()=>{var H;_&&((H=O.current.get(_))==null||H.focus()),z()};return Ot.createPortal(a.jsx("div",{className:"modal-backdrop",onClick:l,role:"presentation",children:a.jsxs("div",{ref:d,className:"modal nm-modal",onClick:H=>H.stopPropagation(),"data-paused":s||L||void 0,role:"dialog","aria-modal":"true","aria-labelledby":"nm-title","aria-describedby":"nm-sub",children:[a.jsxs("header",{className:"modal-head nm-head",children:[a.jsxs("div",{className:"nm-heading",children:[a.jsx("h2",{id:"nm-title",className:"modal-title nm-title",children:"Network map"}),a.jsx("p",{id:"nm-sub",className:"nm-sub",children:D})]}),a.jsx("div",{className:"modal-actions",children:a.jsx("button",{ref:u,type:"button",className:"glyph-btn",onClick:l,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),a.jsxs("div",{className:"nm-body",children:[a.jsxs("div",{className:"nm-view",children:[a.jsx("div",{ref:f,className:"nm-stage","data-focus":U?"":void 0,"data-dense":(g==null?void 0:g.dense)||void 0,onClick:H=>{H.target===H.currentTarget&&z()},children:h&&g&&a.jsxs(a.Fragment,{children:[a.jsx(_V,{layout:g,w:h.w,h:h.h}),k.map(H=>{const J=Ps(H.row);return a.jsx(EV,{node:H,angle:b.get(J)??H.angle,lit:U===J},J)}),a.jsx(CV,{status:e}),a.jsx("div",{className:"nm-ring",role:"group","aria-label":"Decks around this deck",onKeyDown:M,children:k.map((H,J)=>{var G,X;const W=Ps(H.row);return a.jsx(TV,{node:H,angle:b.get(W)??H.angle,os:(X=(G=ad(e,H.row).peer)==null?void 0:G.about)==null?void 0:X.os,lit:U===W,shown:_===W,tabbable:J===$,register:Z=>{Z?O.current.set(W,Z):O.current.delete(W)},onHold:()=>{P(W),R(W)},onRelease:A,onOpen:()=>i(H.row.fp)},W)})}),k.length===0&&a.jsx(RV,{status:e})]})}),a.jsx(AV,{})]}),a.jsx("aside",{className:"nm-side","aria-label":"Details",children:I&&e?a.jsx($V,{row:I,status:e,accounts:n,now:r,onOpen:()=>i(I.fp),onBack:F},Ps(I)):a.jsx(MV,{status:e,summary:w})})]})]})}),document.body)}function v$(){return a.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:[a.jsx("circle",{cx:"7",cy:"7.4",r:"1.8"}),a.jsx("circle",{cx:"2.4",cy:"2.9",r:"1.2"}),a.jsx("circle",{cx:"11.6",cy:"2.9",r:"1.2"}),a.jsx("circle",{cx:"7",cy:"12.4",r:"1.1"}),a.jsx("path",{d:"M5.7 6.1 3.3 3.8M8.3 6.1l2.4-2.3M7 9.2v2.1"})]})}function _V({layout:e,w:t,h:n}){return a.jsx("svg",{className:"nm-orbits",width:t,height:n,viewBox:`0 0 ${t} ${n}`,"aria-hidden":!0,children:e.rings.map((r,s)=>a.jsx("ellipse",{className:"nm-orbit","data-ring":r.ring,cx:t/2,cy:n/2,rx:r.rx,ry:r.ry,style:{"--ring":s}},r.ring))})}function EV({node:e,angle:t,lit:n}){const r=e.row.kind==="paired"&&e.row.here,s=e.order*jV%1*NV;return a.jsx("span",{className:"nm-wire","aria-hidden":!0,"data-tier":e.tier,"data-via":e.row.via,"data-on":n||void 0,style:{"--nm-a":`${t.toFixed(2)}deg`,"--nm-d":`${e.dist.toFixed(1)}px`,"--from":`${Uj}px`,"--gap":`${Uj+bV}px`,"--i":e.order,"--phase":`${s.toFixed(2)}s`},children:r&&a.jsx("i",{className:"nm-glint"})})}function CV({status:e}){const t=(e==null?void 0:e.enabled)===!0&&e.running;return a.jsxs("div",{className:"nm-core","data-listening":t||void 0,children:[a.jsx("span",{className:"nm-core-orb","aria-hidden":!0}),a.jsxs("span",{className:"nm-core-label",children:[a.jsx("span",{className:"nm-core-name",children:(e==null?void 0:e.name)??"…"}),a.jsx("span",{className:"nm-core-what",children:"this deck"})]})]})}function TV({node:e,angle:t,os:n,lit:r,shown:s,tabbable:i,register:l,onHold:u,onRelease:d,onOpen:f}){const{row:h}=e,p=e.angle*Math.PI/180,g=hV(h,n);return a.jsxs("button",{ref:l,type:"button",className:"nm-node",tabIndex:i?0:-1,"data-tier":e.tier,"data-kind":h.kind,"data-side":e.side,"data-via":h.via,"data-on":r||void 0,"data-shown":s||void 0,"aria-label":`${h.name}: ${h$(h)}. Opens its own dialog.`,style:{"--nm-a":`${t.toFixed(2)}deg`,"--nm-d":`${e.dist.toFixed(1)}px`,"--i":e.order,"--in-x":`${(-Math.cos(p)*14).toFixed(1)}px`,"--in-y":`${(-Math.sin(p)*14).toFixed(1)}px`},onPointerEnter:w=>{w.pointerType==="mouse"&&u()},onPointerLeave:d,onFocus:u,onBlur:d,onClick:f,children:[a.jsx(_x,{}),a.jsx("i",{className:"nm-mark","data-tier":e.tier,"data-kind":h.kind,"aria-hidden":!0}),a.jsxs("span",{className:"nm-label","aria-hidden":!0,children:[a.jsx("span",{className:"nm-name",children:h.name}),a.jsx("span",{className:"nm-cap",children:g})]})]})}function RV({status:e}){const t=(e==null?void 0:e.enabled)===!0;return a.jsx("p",{className:"nm-empty",children:e?t?"No other deck yet. Decks on one network usually find each other within a minute.":"Local network is off, so this deck is not looking for any other.":"Asking this deck about the network…"})}function AV(){return a.jsxs("ul",{className:"nm-legend",children:[a.jsxs("li",{children:[a.jsx("i",{className:"nm-key-mark","data-tier":"online","aria-hidden":!0}),"online"]}),a.jsxs("li",{children:[a.jsx("i",{className:"nm-key-mark","data-tier":"offline","aria-hidden":!0}),"offline"]}),a.jsxs("li",{children:[a.jsx("i",{className:"nm-key-mark","data-tier":"loose","aria-hidden":!0}),"not paired"]}),a.jsxs("li",{children:[a.jsx("i",{className:"nm-key-wire","aria-hidden":!0}),"local network"]}),a.jsxs("li",{children:[a.jsx("i",{className:"nm-key-wire","data-via":"tailscale","aria-hidden":!0}),"Tailscale"]}),a.jsxs("li",{children:[a.jsx("i",{className:"nm-key-glint","aria-hidden":!0}),"a round, out and back"]})]})}function x$({facts:e}){return a.jsx("dl",{className:"lan-facts nm-facts",children:e.map(t=>a.jsxs("div",{className:"lan-fact","data-tone":t.quiet?"quiet":void 0,children:[a.jsx("dt",{children:t.label}),a.jsx("dd",{children:t.value})]},t.label))})}function MV({status:e,summary:t}){const n=pV(e),r=Sx(e==null?void 0:e.about),s=[];r&&s.push({label:"Runs",value:r}),s.push({label:n.length>1?"Addresses":"Address",value:n.length?a.jsx("span",{className:"nm-addrs",children:n.map(l=>a.jsx("code",{className:"ap-lan-code",children:l},l))}):"none yet",quiet:n.length===0}),e!=null&&e.pairingMode&&s.push({label:"Pairing",value:e.pairingMode==="invite"?"by invite only":"asks and answers"});const i=[["online",t.online,"paired, and answering"],["offline",t.offline,"paired, and quiet"],["asks",t.asks,"asking to pair"],["nearby",t.nearby,"nearby, not paired"],["dialling",t.dialling,"addresses still dialling"],["tailnet",t.tailnet,"reached over Tailscale"],["declined",t.declined,"declined, not drawn"]];return a.jsxs("div",{className:"nm-panel","data-view":"network",children:[a.jsx("h3",{className:"nm-panel-name",children:(e==null?void 0:e.name)??"…"}),a.jsx("p",{className:"nm-panel-self",children:"this deck, at the centre of the map"}),a.jsx(x$,{facts:s}),a.jsx("ul",{className:"nm-counts",children:i.filter(([,l])=>l>0).map(([l,u,d])=>a.jsxs("li",{"data-count":l,children:[a.jsx("span",{className:"nm-count-n",children:u}),a.jsx("span",{className:"nm-count-words",children:d})]},l))}),a.jsx("p",{className:"nm-panel-hint",children:"Point at a deck, or reach one with the arrow keys, to see it here. Press it to open its own dialog."})]})}function $V({row:e,status:t,accounts:n,now:r,onOpen:s,onBack:i}){var w,k;const l=w$({row:e,source:ad(t,e),status:t,accounts:n,now:r}),u=[],d=l.how??((w=l.peer)!=null&&w.waiting?"it calls this deck; this deck has no address for it":null);d&&u.push({label:"Reached",value:d}),l.where&&u.push({label:"Address",value:a.jsx("code",{className:"ap-lan-code",children:l.where})}),u.push({label:"Runs",value:l.thereRuns?`${l.thereRuns}${l.order?` · ${l.order<0?"older than this deck":"newer than this deck"}`:""}`:l.unsaid,quiet:!l.thereRuns}),l.paired&&((k=l.peer)!=null&&k.pairedAt)&&u.push({label:"Paired",value:p$(l.peer.pairedAt,r)}),l.hiddenThere&&u.push({label:"Working on",value:"not said — its owner hides it",quiet:!0}),l.otherThere&&u.push({label:"Working on",value:"an account it does not share",quiet:!0});const f=e.kind==="paired"&&e.here||e.kind==="asks",p=l.lanes.slice(0,6),g=l.lanes.length-p.length;return a.jsxs("div",{className:"nm-panel","data-view":"deck","data-tier":e.kind==="paired"?e.here?"online":"offline":"loose",children:[a.jsxs("button",{type:"button",className:"ap-lan-word nm-back",onClick:i,children:[a.jsx("span",{"aria-hidden":!0,children:"‹ "}),"the whole network"]}),a.jsxs("h3",{className:"nm-panel-name",children:[a.jsx("i",{className:f?"ap-pulse":"ap-dot","data-kind":e.kind,"aria-hidden":!0}),e.name]}),e.self&&a.jsxs("p",{className:"nm-panel-self",children:["calls itself ",e.self]}),a.jsx("p",{className:"nm-panel-state","data-kind":e.kind,children:h$(e)}),a.jsx(x$,{facts:u}),l.paired&&a.jsxs("section",{className:"nm-logins","aria-label":"Logins the two decks share",children:[a.jsx("p",{className:"nm-logins-title",children:l.lanes.length===0?"No logins between the two":`${l.lanes.length} login${l.lanes.length===1?"":"s"} between the two`}),p.length>0&&a.jsx("ul",{className:"nm-lanes",children:p.map(x=>a.jsxs("li",{className:"nm-lane","data-tone":x.tone,children:[a.jsx("i",{className:"nm-lane-dot","aria-hidden":!0}),a.jsxs("span",{className:"nm-lane-text","aria-hidden":!0,children:[a.jsx("span",{className:"nm-lane-email",children:x.email}),zj(x)&&a.jsx("span",{className:"nm-lane-said",children:zj(x)})]}),x.usedThere&&a.jsx("span",{className:"nm-lane-used","aria-hidden":!0,children:"in use there"}),a.jsxs("span",{className:"vis-hidden",children:[x.email,": ",y$(x)]})]},x.key))}),g>0&&a.jsxs("p",{className:"nm-lanes-more",children:["and ",g," more in its own dialog"]}),l.unknown&&a.jsx("p",{className:"nm-panel-hint",children:l.unknown})]}),a.jsxs("button",{type:"button",className:"btn nm-open",onClick:s,children:["Open ",e.name]})]})}function zj(e){return e.caption?e.caption:e.tone==="ok"?null:`${m$[e.here]} · ${g$[e.there]}`}const IV=6;function OV({anchorId:e,id:t,rows:n,onHold:r,onLet:s}){const i=v.useRef(null),l=n.filter(g=>g.kind==="paired"),u=l.filter(g=>g.here),d=u.slice(0,IV),f=l.length-u.length,h=u.length>d.length?`and ${u.length-d.length} more`:f>0?`${f} not on right now`:null,p=v.useCallback(()=>{const g=i.current,w=document.getElementById(e);if(!g||!w)return;const k=S0(w.getBoundingClientRect(),{width:g.offsetWidth,height:g.offsetHeight},{width:window.innerWidth,height:window.innerHeight});g.style.top=`${k.top}px`,g.style.left=`${k.left}px`,g.style.maxHeight=k.maxHeight==null?"":`${k.maxHeight}px`,g.dataset.side=k.side},[e]);return v.useLayoutEffect(()=>{p()}),v.useEffect(()=>(window.addEventListener("scroll",p,!0),window.addEventListener("resize",p),()=>{window.removeEventListener("scroll",p,!0),window.removeEventListener("resize",p)}),[p]),Ot.createPortal(a.jsxs("div",{ref:i,id:t,className:"ap-peek",role:"tooltip",onPointerEnter:r,onPointerLeave:s,children:[a.jsx("p",{className:"ap-peek-title",children:u.length?"On the network now":"Nobody on the network"}),d.length>0&&a.jsx("div",{className:"ap-peek-list",children:d.map(g=>a.jsxs("span",{className:"ap-peek-who",children:[a.jsx("i",{className:"ap-nav-live","aria-hidden":!0}),a.jsxs("span",{children:[g.name,g.via==="tailscale"&&a.jsx("span",{className:"ap-lan-via",children:" · Tailscale"})]})]},`${g.kind}:${g.fp}`))}),h&&a.jsx("p",{className:"ap-peek-rest",children:h})]}),document.body)}function LV({entry:e,rows:t,onOpen:n,onMap:r,peek:s,openPeek:i,shutPeek:l,holdPeek:u,dropPeek:d}){return a.jsxs(a.Fragment,{children:[a.jsxs("button",{type:"button",id:"ap-lan-entry",className:"ap-nav",onClick:()=>{d(),n()},"aria-describedby":s?"ap-lan-peek":void 0,onPointerEnter:f=>{f.pointerType==="mouse"&&i(o$)},onPointerLeave:l,onFocus:f=>{f.target.matches(":focus-visible")&&i(0)},onBlur:l,children:[a.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:[a.jsx("rect",{x:"1.8",y:"2.3",width:"10.4",height:"7.2",rx:"1.2"}),a.jsx("path",{d:"M5 11.9h4M7 9.5v2.4"})]}),a.jsxs("span",{className:"ap-nav-text",children:[a.jsx("span",{className:"ap-nav-name",children:"Local network"}),a.jsxs("span",{className:"ap-nav-state","data-tone":e.tone,children:[e.live&&a.jsx("i",{className:"ap-nav-live","aria-hidden":!0}),e.text]})]}),a.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:a.jsx("path",{d:"M5.6 3.4 9.2 7l-3.6 3.6"})})]}),r&&a.jsx("button",{type:"button",className:"ap-lan-map",onClick:()=>{d(),r()},"aria-label":"Show the network map",title:"Network map — every deck this one knows, drawn around it",children:a.jsx(v$,{})}),s&&a.jsx(OV,{anchorId:"ap-lan-entry",id:"ap-lan-peek",rows:t,onHold:u,onLet:l})]})}function PV({row:e,run:t,onVerb:n,onUnpair:r}){const[s,i]=v.useState(!1),l=v.useRef(0),[u,d]=v.useState(null);return v.useEffect(()=>{if(!s)return;const p=window.setTimeout(()=>i(!1),4e3);return()=>window.clearTimeout(p)},[s]),v.useEffect(()=>{if(!u)return;const p=window.setTimeout(()=>d(null),4e3);return()=>window.clearTimeout(p)},[u]),{armed:s,armedTwin:u,pressOwn:()=>{const p=Date.now(),g=Tl({armedFor:s?e.fp:null,target:e.fp,armedAt:l.current,now:p,gapMs:Cl});if(g==="arm"){i(!0),d(null),l.current=p;return}g!=="ignore"&&(i(!1),t(n))},pressTwin:p=>{if(!r)return;const g=Date.now(),w=Tl({armedFor:u,target:p,armedAt:l.current,now:g,gapMs:Cl});if(w==="arm"){d(p),i(!1),l.current=g;return}w!=="ignore"&&(d(null),t(()=>r(p)))}}}function DV({row:e,paired:t,peer:n,status:r,busy:s,press:i,checkNow:l,armed:u,pressOwn:d,run:f,onVerb:h,onInvite:p}){return a.jsxs("footer",{className:"lan-peer-foot",children:[e.kind==="asks"&&a.jsx("p",{className:"lan-foot-note",children:"This deck is now asking to pair. Answer it from the panel behind this."}),t&&!(n!=null&&n.waiting)&&a.jsx("button",{type:"button",className:"btn",...i(`check:${e.fp}`),onClick:l,title:"Ask this deck now instead of waiting for the next round",children:s===`check:${e.fp}`?"Checking…":"Check now"}),e.kind==="paired"&&a.jsx("button",{type:"button",className:`btn danger lan-peer-verb${u?" armed":""}`,...i(`unpair:${e.fp}`),onKeyDown:g=>{g.repeat&&g.preventDefault()},onClick:()=>d(),"aria-label":u?`Confirm unpairing ${e.name}`:`Unpair ${e.name}`,title:u?"Press again to stop talking to this deck. Logins it already has stay with it.":"Stop talking to this deck from now on",children:s===`unpair:${e.fp}`?"Unpairing…":u?"Confirm unpair":"Unpair"}),e.kind==="nearby"&&r.pairingMode!=="invite"&&a.jsx("button",{type:"button",className:"btn primary lan-peer-verb",...i(`accept:${e.fp}`),onClick:()=>void f(h),title:"Send it a request. Somebody at that machine has to accept it before anything is shared.",children:s===`accept:${e.fp}`?"Asking…":"Ask to pair"}),e.kind==="dialling"&&a.jsx("button",{type:"button",className:"btn lan-peer-verb",...i(`drop:${e.fp}`),onClick:()=>void f(h),title:"Stop trying this address. Nothing was ever paired here.",children:s===`drop:${e.fp}`?"Stopping…":"Stop dialling"}),e.kind==="declined"&&r.pairingMode!=="invite"&&a.jsx("button",{type:"button",className:"btn lan-peer-verb",...i(`allow:${e.fp}`),onClick:()=>void f(h),title:"Take the no back. That deck is still trying, so its request comes round again on its own.",children:s===`allow:${e.fp}`?"Allowing…":"Let it ask again"}),(e.kind==="nearby"||e.kind==="declined")&&r.pairingMode==="invite"&&p&&a.jsx("button",{type:"button",className:"btn primary lan-peer-verb",onClick:p,title:"This deck pairs only by invite. Make one and send it to whoever is at that machine.",children:"Invite to pair"})]})}function FV({instances:e,now:t,busy:n,press:r,armedTwin:s,pressTwin:i,onUnpair:l}){return a.jsxs("div",{className:"modal-section",children:[a.jsxs("h3",{className:"lan-h",children:[e.length," decks on this machine"]}),a.jsx("ul",{className:"lan-twins",role:"list",children:e.map((u,d)=>{var k,x,b,j;const f=(k=u.peer)!=null&&k.addr?`${u.peer.addr}:${u.peer.port}`:u.row.addr,h=f||u.row.fp,p=(x=u.peer)!=null&&x.pairedAt?Cr(u.peer.pairedAt,t):null,g=[(j=(b=u.peer)==null?void 0:b.about)!=null&&j.version?`runs ${u.peer.about.version}`:null,p?`paired ${p==="now"?"just now":p}`:null,u.row.state].filter(Boolean).join(" · "),w=u.row.fp;return a.jsxs("li",{role:"listitem",className:"lan-twin","data-tone":u.row.tone,children:[a.jsx("i",{className:u.row.here?"ap-pulse":"ap-dot","aria-hidden":!0}),f?a.jsx("code",{className:"ap-lan-code lan-twin-at",children:f}):a.jsx("span",{className:"lan-twin-at lan-twin-none",children:"no address here"}),a.jsx("code",{className:"ap-lan-code lan-twin-fp",children:w}),d>0&&l&&a.jsx("button",{type:"button",className:`ap-manage-btn danger lan-twin-do${s===w?" armed":""}`,...r(`unpair:${w}`),onKeyDown:S=>{S.repeat&&S.preventDefault()},onClick:()=>i(w),"aria-label":s===w?`Confirm unpairing ${h}`:`Unpair ${h}`,title:s===w?"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:n===`unpair:${w}`?"unpairing…":s===w?"confirm":"unpair"}),a.jsx("span",{className:"lan-twin-meta",children:d===0?`${g} · shown above`:g})]},w)})})]})}function qV(){return a.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:[a.jsx("path",{d:"M9.6 2.4l2 2L5 11l-2.6.6L3 9z"}),a.jsx("path",{d:"M8.4 3.6l2 2"})]})}function BV({row:e,source:t,status:n,accounts:r,now:s,busy:i,onClose:l,onRename:u,onCheck:d,onVerb:f,onSettings:h,onInvite:p,twins:g=[],onUnpair:w}){const k=v.useRef(null),x=mt(l,{focusRef:k}),[b,j]=v.useState(null),[S,_]=v.useState(null),[E,T]=v.useState(!1),[R,A]=v.useState(0),U=v.useRef(null),I=v.useRef(null),q=v.useRef(!0);v.useEffect(()=>()=>{q.current=!1},[]);const P=b!=null;v.useEffect(()=>{var fe;P&&((fe=U.current)==null||fe.select())},[P]);const O=v.useRef(!1);v.useEffect(()=>{var fe,de;O.current&&!P&&ns(((fe=document.activeElement)==null?void 0:fe.tagName)??null)&&((de=I.current)==null||de.focus()),O.current=P},[P]);const V=fe=>{const de=Vs(i,fe);return{disabled:de.disabled,"aria-busy":de.busy}},$=async fe=>{const de=await fe();return q.current&&_(de),de==null},{armed:M,armedTwin:L,pressOwn:Y,pressTwin:K}=PV({row:e,run:$,onVerb:f,onUnpair:w}),D=w$({row:e,source:t,status:n,accounts:r,now:s}),{peer:z,stranger:F,paired:H,own:J,canRename:W,fp:G}=D,X=i===`check:${e.fp}`,Z=async fe=>{const de=fe.trim()===J?"":fe;await $(()=>u(de))&&j(null)},ee=()=>void $(d).then(fe=>{fe&&q.current&&A(de=>de+1)}),re=async()=>{if(G)try{if(await navigator.clipboard.writeText(G),!q.current)return;T(!0),window.setTimeout(()=>{q.current&&T(!1)},1600)}catch{q.current&&_("Could not copy it — select the fingerprint and copy it by hand.")}},ce=[];H&&(z!=null&&z.pairedAt)?ce.push({label:"Paired",value:p$(z.pairedAt,s),tone:"meta"}):e.kind==="declined"&&F&&ce.push({label:"Paired",value:`no · you said no ${$0(F.at,s)}`,tone:"meta"}),ce.push({label:"Fingerprint",value:G?a.jsxs("span",{className:"lan-fp",children:[a.jsx("code",{className:"ap-lan-code",children:G}),a.jsx("button",{type:"button",className:"ap-lan-word lan-copy",onClick:()=>void re(),"aria-label":E?"Fingerprint copied":"Copy the fingerprint",children:E?"copied":"copy"})]}):"not known — nothing has answered there",tone:G?void 0:"quiet"});const ie=g.length?[{row:e,peer:z??null},...g]:[];return Ot.createPortal(a.jsx("div",{className:"modal-backdrop",onClick:l,role:"presentation",children:a.jsxs("div",{ref:x,className:"modal lan-peer","data-tone":e.tone,onClick:fe=>fe.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"lan-peer-title","aria-describedby":"lan-peer-sub",children:[a.jsxs("header",{className:"modal-head lan-peer-head",children:[a.jsx("i",{className:e.here?"ap-pulse":"ap-dot","aria-hidden":!0}),a.jsxs("div",{className:"lan-peer-id",children:[P?a.jsxs("form",{className:"lan-peer-edit",onSubmit:fe=>{fe.preventDefault(),Z(b??"")},children:[a.jsx("span",{id:"lan-peer-title",className:"vis-hidden",children:e.name}),a.jsx("input",{ref:U,className:"ap-manage-input lan-peer-input",value:b??"",maxLength:48,placeholder:J,"aria-label":"Name for this deck, shown on this deck only",onChange:fe=>j(fe.target.value)}),a.jsx("button",{type:"submit",className:"ap-manage-btn",...V(`alias:${e.fp}`),children:"save"}),a.jsx("button",{type:"button",className:"ap-manage-btn",onClick:()=>j(null),children:"cancel"})]}):a.jsxs("span",{className:"lan-peer-title",children:[a.jsx("span",{id:"lan-peer-title",className:"lan-peer-name",children:e.name}),W&&a.jsx("button",{type:"button",className:"glyph-btn lan-peer-rename",ref:I,onClick:()=>{_(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:a.jsx(qV,{})})]}),a.jsxs("p",{id:"lan-peer-sub",className:"lan-peer-sub",children:[e.self&&a.jsxs(a.Fragment,{children:["calls itself ",a.jsx("span",{className:"lan-peer-self",children:e.self}),P&&a.jsx("button",{type:"button",className:"ap-lan-word lan-peer-restore",...V(`alias:${e.fp}`),onClick:()=>void Z(""),children:"use this name"}),a.jsx("span",{className:"vis-hidden",children:". "}),!e.quiet&&a.jsx("span",{"aria-hidden":!0,children:" · "})]}),a.jsx("span",{className:e.quiet?"vis-hidden":"lan-peer-state",children:e.state})]})]}),a.jsx("div",{className:"modal-actions",children:a.jsx("button",{ref:k,type:"button",className:"glyph-btn",onClick:l,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),a.jsxs("section",{className:"modal-body lan-peer-body",children:[S&&a.jsxs("div",{className:"ap-failure",role:"alert",children:[a.jsx("span",{className:"ap-failure-text",children:S}),a.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>_(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),a.jsx(xV,{view:D,row:e,status:n,asking:X,drawn:R,onSettings:h}),a.jsx("dl",{className:"lan-facts",children:ce.map(fe=>a.jsxs("div",{className:"lan-fact","data-tone":fe.tone,children:[a.jsx("dt",{children:fe.label}),a.jsx("dd",{children:fe.value})]},fe.label))}),ie.length>1&&a.jsx(FV,{instances:ie,now:s,busy:i,press:V,armedTwin:L,pressTwin:K,onUnpair:w})]}),a.jsx(DV,{row:e,paired:H,peer:z,status:n,busy:i,press:V,checkNow:ee,armed:M,pressOwn:Y,run:$,onVerb:f,onInvite:p})]})}),document.body)}function id(e,t){const n=v.useRef(!1);return v.useEffect(()=>{var r,s;!e||!n.current||(n.current=!1,ns(((r=document.activeElement)==null?void 0:r.tagName)??null)&&((s=t.current)==null||s.focus()))},[e]),()=>{n.current=!0}}function UV(e,t){if(e.length!==t.length)return!1;const n=new Set(e);return t.every(r=>n.has(r))}function zV(e,t,n,r){const s=new Set(e??t);return r?s.add(n):s.delete(n),[...s]}function Hj(e,t,n){return e==null||n!=null&&!n.ok||UV(e,t)?null:e}function b$({line:e,onDismiss:t,onAnswer:n}){const[r,s]=v.useState(!1),i=v.useRef(!1),l=v.useRef(!0);v.useEffect(()=>(l.current=!0,()=>{l.current=!1}),[]);const u=v.useRef(null),d=v.useRef(null),f=v.useRef(!1);if(v.useEffect(()=>{var p;f.current&&(f.current=!1,e!=null&&e.giveBack||(p=d.current)==null||p.focus())},[e]),!e)return null;const h=async()=>{if(i.current)return;i.current=!0,s(!0);const p=await g9();i.current=!1,l.current&&(s(!1),f.current=document.activeElement===u.current,n(w9(p)))};return a.jsxs("div",{className:e.done?"ap-failure ap-failure-done":"ap-failure",role:"alert",children:[a.jsx("span",{className:"ap-failure-text",children:e.text}),e.giveBack&&a.jsx("button",{ref:u,type:"button",className:"ap-fix ap-give-back","aria-busy":r,onClick:h,title:"Opens macOS's password dialog to make the settings folder yours again",children:r?"waiting for macOS…":"give it back"}),a.jsx("button",{ref:d,type:"button",className:"ap-failure-x",onClick:t,"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]})}function HV(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}const bu="Paused while this deck pairs only by invite. Turn that off above to use it.";function WV({status:e,accounts:t,onClose:n,onChanged:r}){const s=mt(n),[i,l]=v.useState(null),[u,d]=v.useState(null),[f,h]=v.useState(!1),[p,g]=v.useState(null),w=v.useRef(null),k=K=>{const D=Vs(p,K);return{disabled:D.disabled,"aria-busy":D.busy}},x=v.useRef(null),b=v.useRef(!0);v.useEffect(()=>()=>{b.current=!1},[]),v.useEffect(()=>{x.current=Hj(x.current,e.shared??[],null)},[e.shared]);const j=v.useCallback(async(K,D,z="write")=>{w.current=z,g(z);try{const H=await(await fetch("/api/prefs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({lan:K})})).json().catch(()=>null);return b.current?(H!=null&&H.ok?d(null):d(Qn(Ct(D,H),H)),r(),(H==null?void 0:H.ok)===!0):!1}catch{return b.current&&d(Qn(Ct(D,null))),!1}finally{w.current=null,b.current&&g(null)}},[r]),S=v.useCallback(async K=>{const D=await j({name:K},"save the name","name");return D&&b.current&&l(z=>z===K?null:z),D},[j]),_=v.useRef(null),E=i!=null&&i!==(e.name??""),T=id(!E,_),R=v.useCallback(async()=>{E&&!await S(i)||n()},[E,i,S,n]),A=async()=>{if(!e.fp)return;const K=await Ba(e.fp);if(b.current){if(!K){d(Qn("Could not copy it — select the fingerprint and copy it by hand."));return}h(!0),window.setTimeout(()=>{b.current&&h(!1)},1600)}},U=new Set(x.current??e.shared??[]),I=e.autoAsk!==!1,q=e.autoAccept!==!1,P=e.pairingMode==="invite",O=K=>{const D=k(K);return{...D,disabled:D.disabled||P}},V=e.shareActive!==!1,$=e.tailscale??null,M=!!($!=null&&$.on),L=($==null?void 0:$.ask)!==!1,Y=($==null?void 0:$.accept)!==!1;return Ot.createPortal(a.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:a.jsxs("div",{ref:s,className:"modal lan-modal",onClick:K=>K.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"lan-modal-title",children:[a.jsxs("header",{className:"modal-head",children:[a.jsx("div",{className:"modal-title",children:a.jsx("span",{id:"lan-modal-title",className:"modal-tool-name",children:"This deck on the network"})}),a.jsx("div",{className:"modal-actions",children:a.jsx("button",{className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),a.jsxs("section",{className:"modal-body",children:[a.jsx(b$,{line:u,onDismiss:()=>d(null),onAnswer:K=>{d(K),K.done&&r()}}),a.jsxs("div",{className:"modal-section",children:[a.jsx("h3",{className:"lan-h",children:"Name"}),a.jsxs("div",{className:"ap-lan-row",children:[a.jsx("span",{className:"ap-lan-label",children:"appear as"}),a.jsx("input",{ref:_,className:"ap-manage-input ap-lan-input","aria-label":"This deck's name on the network",value:i??e.name??"",placeholder:"this machine",onChange:K=>l(K.target.value),onKeyDown:K=>{K.key!=="Enter"||i==null||S(i)}}),E&&a.jsx("button",{type:"button",className:"ap-manage-btn",...k("name"),onClick:()=>{T(),S(i)},title:"Save it. This is the name other decks show for this one.",children:"save"})]}),a.jsxs("div",{className:"ap-lan-row",children:[a.jsx("span",{className:"ap-lan-label",children:"fingerprint"}),e.fp?a.jsxs("span",{className:"lan-fp",children:[a.jsx("code",{className:"ap-lan-code",children:e.fp}),a.jsx("button",{type:"button",className:"ap-lan-word lan-copy",onClick:()=>void A(),"aria-label":f?"Fingerprint copied":"Copy this deck's fingerprint",children:f?"copied":"copy"})]}):a.jsx("span",{className:"ap-lan-label",children:"not known yet"})]})]}),a.jsxs("div",{className:"modal-section",children:[a.jsx("h3",{className:"lan-h",children:"Share these accounts"}),a.jsxs("div",{className:"ap-lan-picks",children:[t.length===0&&a.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=>a.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:[a.jsx("input",{type:"checkbox",checked:U.has(K.key),onChange:D=>{const z=zV(x.current,e.shared??[],K.key,D.target.checked);x.current=z,j({shared:z},D.target.checked?"share that account":"stop sharing that account").then(F=>{x.current===z&&(x.current=Hj(z,e.shared??[],{ok:F}))})}}),a.jsx("span",{className:"ap-lan-pick-name",children:K.email}),!K.alive&&a.jsx("span",{className:"ap-lan-dead",children:"not working here"})]},K.key))]}),t.length>0&&a.jsxs("div",{className:"lan-switch",children:[a.jsx("span",{className:"lan-switch-what",children:"Show paired decks which of these this deck is using"}),a.jsx("button",{type:"button",className:"switch ap-auto-state",role:"switch","aria-checked":V,"aria-label":"Show paired decks which of these this deck is using",...k("current"),onClick:()=>void j({shareActive:!V},V?"stop showing which account this deck is using":"show which account this deck is using","current"),title:V?"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:a.jsx("span",{className:"switch-knob"})})]})]}),a.jsxs("div",{className:"modal-section",children:[a.jsx("h3",{className:"lan-h",id:"lan-pairing-h",children:"Pairing"}),a.jsx("div",{className:"lan-switches lan-switches-lead",role:"group","aria-labelledby":"lan-pairing-h",children:a.jsxs("div",{className:"lan-switch",children:[a.jsxs("span",{className:"lan-switch-what",children:["Pair new decks only by invite",P&&a.jsx("span",{id:"lan-invite-only-detail",className:"lan-switch-detail",children:"A new deck needs an invite from Add a deck, the link at the top of Local network. Paired decks stay paired."})]}),a.jsx("button",{type:"button",className:"switch ap-auto-state",role:"switch","aria-checked":P,"aria-label":"Pair new decks only by invite","aria-describedby":P?"lan-invite-only-detail":void 0,...k("mode"),onKeyDown:K=>{K.repeat&&K.preventDefault()},onClick:()=>void j({pairingMode:P?"automatic":"invite"},P?"let decks pair on their own again":"pair new decks only by invite","mode"),title:P?"Let decks on this network pair as the two switches below say again.":"Only a deck you send an invite to can pair with this one. Nearby decks can't ask, and requests waiting now are turned away.",children:a.jsx("span",{className:"switch-knob"})})]})}),a.jsxs("div",{className:"lan-auto",role:"group","aria-labelledby":"lan-auto-h",children:[a.jsxs("p",{className:"lan-sub",id:"lan-auto-h",children:["Automatic pairing",P&&a.jsx("span",{className:"lan-sub-state",children:" · paused while pairing is invite-only"})]}),a.jsxs("div",{className:"lan-switches","data-paused":P||void 0,children:[a.jsxs("div",{className:"lan-switch",children:[a.jsx("span",{className:"lan-switch-what",children:"Ask every deck this one finds"}),a.jsx("button",{type:"button",className:"switch ap-auto-state",role:"switch","aria-checked":I,"aria-label":"Ask every deck this one finds",...O("ask"),onClick:()=>void j({autoAsk:!I},I?"stop asking automatically":"ask every deck this one finds","ask"),title:P?bu:I?"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:a.jsx("span",{className:"switch-knob"})})]}),a.jsxs("div",{className:"lan-switch",children:[a.jsx("span",{className:"lan-switch-what",children:"Say yes to every deck that asks"}),a.jsx("button",{type:"button",className:"switch ap-auto-state",role:"switch","aria-checked":q,"aria-label":"Say yes to every deck that asks","data-tone":"warn",...O("accept"),onKeyDown:K=>{K.repeat&&K.preventDefault()},onClick:()=>void j({autoAccept:!q},q?"stop accepting automatically":"accept every deck that asks","accept"),title:P?bu:q?"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:a.jsx("span",{className:"switch-knob"})})]})]})]})]}),($==null?void 0:$.found)&&a.jsxs("div",{className:"modal-section",children:[a.jsx("h3",{className:"lan-h",children:"Tailscale"}),a.jsxs("div",{className:"lan-switches",children:[a.jsxs("div",{className:"lan-switch",children:[a.jsxs("span",{className:"lan-switch-what",children:["Look for my devices",a.jsx("span",{id:"lan-ts-detail",className:"lan-switch-detail",children:HV($)})]}),a.jsx("button",{type:"button",className:"switch ap-auto-state",role:"switch","aria-checked":M,"aria-label":"Look for my devices over Tailscale","aria-describedby":"lan-ts-detail",...k("tailscale"),onClick:()=>void j({tailscale:!M},M?"stop looking over Tailscale":"look for your devices over Tailscale","tailscale"),title:M?"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:a.jsx("span",{className:"switch-knob"})})]}),M&&a.jsxs("div",{className:"lan-auto",role:"group","aria-labelledby":"lan-ts-auto-h",children:[a.jsxs("p",{className:"lan-sub",id:"lan-ts-auto-h",children:["Automatic pairing with my devices",P&&a.jsx("span",{className:"lan-sub-state",children:" · paused while pairing is invite-only"})]}),a.jsxs("div",{className:"lan-switches",children:[a.jsxs("div",{className:"lan-switch","data-paused":P||void 0,children:[a.jsx("span",{className:"lan-switch-what",children:"Ask each device it finds"}),a.jsx("button",{type:"button",className:"switch ap-auto-state",role:"switch","aria-checked":L,"aria-label":"Ask each of my devices it finds over Tailscale",...O("tailscale-ask"),onClick:()=>void j({tailscaleAsk:!L},L?"stop asking your devices automatically":"ask your devices automatically","tailscale-ask"),title:P?bu:L?"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:a.jsx("span",{className:"switch-knob"})})]}),a.jsxs("div",{className:"lan-switch","data-paused":P||void 0,children:[a.jsx("span",{className:"lan-switch-what",children:"Say yes to each device that asks"}),a.jsx("button",{type:"button",className:"switch ap-auto-state",role:"switch","aria-checked":Y,"aria-label":"Say yes to my devices when they ask over Tailscale","data-tone":"warn",...O("tailscale-accept"),onKeyDown:K=>{K.repeat&&K.preventDefault()},onClick:()=>void j({tailscaleAccept:!Y},Y?"stop accepting your devices automatically":"accept your devices automatically","tailscale-accept"),title:P?bu:Y?"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:a.jsx("span",{className:"switch-knob"})})]})]})]})]})]})]}),a.jsxs("footer",{className:"lan-setup-foot",children:[a.jsx("span",{className:"lan-foot-note",children:"Changes are saved as you make them."}),a.jsx("button",{type:"button",className:"btn primary",...k("name"),onClick:()=>void R(),children:"Done"})]})]})}),document.body)}function VV({on:e,status:t,paired:n,busy:r,pressProps:s,checkNow:i,setAddOpen:l,setSetupOpen:u,setMapOpen:d,onBack:f,closeButton:h}){return a.jsxs("div",{className:"ap-header",children:[a.jsx("button",{type:"button",id:"ap-lan-back",className:"glyph-btn ap-back",onClick:f,"aria-label":"Back to Claude accounts",title:"Back to Claude accounts",children:a.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:a.jsx("path",{d:"M8.4 3.4 4.8 7l3.6 3.6"})})}),a.jsx("h2",{id:"ap-lan-title",children:"Local network"}),a.jsxs("div",{className:"ap-header-right",children:[e&&a.jsx("button",{type:"button",className:"glyph-btn",onClick:()=>d(!0),"aria-label":"Show the network map",title:"Network map — every deck this one knows, drawn around it",children:a.jsx(v$,{})}),e&&a.jsx("button",{type:"button",className:"glyph-btn ap-lan-plus",onClick:()=>l("add"),"aria-label":"Add a deck",title:(t==null?void 0:t.pairingMode)==="invite"?"Send an invite, or use one you were sent. This deck pairs only by invite.":"Reach a deck that has not turned up on its own — by address, or with an invite",children:a.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:[a.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"}),a.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"})]})}),e&&n>0&&a.jsx("button",{type:"button",className:"glyph-btn ap-lan-check",...s("check"),onClick:()=>void i(),"aria-label":r==="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:a.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:[a.jsx("circle",{cx:"7",cy:"7",r:"1.1",fill:"currentColor",stroke:"none"}),a.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"}),a.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"})]})}),e&&a.jsx("button",{type:"button",className:"glyph-btn ap-lan-set",...s("setup"),onClick:()=>u(!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:a.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round","aria-hidden":!0,children:[a.jsx("path",{d:"M1.8 4.7h10.4M1.8 9.3h10.4"}),a.jsx("circle",{cx:"9.1",cy:"4.7",r:"1.6",fill:"var(--panel)"}),a.jsx("circle",{cx:"4.9",cy:"9.3",r:"1.6",fill:"var(--panel)"})]})}),h]})]})}function GV({accounts:e,onChanged:t,view:n,onOpen:r,onBack:s,closeButton:i}){const[l,u]=v.useState(!1),[d,f]=v.useState(!1),[h,p]=v.useState(!1),g=p9(),[w,k]=v.useState(!1),{status:x,manual:b,now:j,busy:S,failure:_,dismissFailure:E,answerGiveBack:T,pressProps:R,load:A,toggle:U,answer:I,dropAddress:q,rename:P,checkOne:O,checkNow:V}=N9(t,()=>u(!0)),{armed:$,pressUnpair:M}=j9(I),[L,Y]=v.useState(null),[K,D]=v.useState(!1),z=(x==null?void 0:x.enabled)===!0,F=v.useMemo(()=>s9((x==null?void 0:x.pairingMode)==="invite"&&x?{...x,pending:[]}:x,j),[x,j]),H=L?F.find(de=>{var we;return de.fp===L||((we=de.twins)==null?void 0:we.some(xe=>xe.fp===L))})??null:null;v.useEffect(()=>{L&&x&&!H&&Y(null)},[L,x,H]);const{asks:J,rest:W,live:G,folded:X,troubled:Z,shown:ee,paired:re}=f9(F,w),ce=t9(x,j),ie=h9(x,F),fe=a.jsxs(a.Fragment,{children:[d&&x&&a.jsx(V9,{status:x,manual:b,startWith:d==="invite"?"invite":void 0,onClose:()=>f(!1),onChanged:()=>{A(),t()}}),h&&a.jsx(c$,{title:"How Local network works",steps:D9,finish:z?void 0:{label:"Turn it on",act:()=>{p(!1),U()}},onClose:()=>p(!1)}),l&&x&&a.jsx(WV,{status:{...x,manualRows:b},accounts:e,manual:b,onClose:()=>u(!1),onChanged:()=>{A(),t()}}),K&&a.jsx(SV,{status:x,rows:F,accounts:e,now:j,covered:!!H||l||!!d||h,onOpenDeck:Y,onClose:()=>D(!1)}),H&&x&&a.jsx(BV,{row:H,source:ad(x,H),status:x,accounts:e,now:j,busy:S,onClose:()=>Y(null),onRename:de=>P(H.fp,de),onCheck:()=>O(H.fp),onVerb:()=>{switch(H.kind){case"paired":return I("unpair",H.fp,"unpair that deck");case"nearby":return I("accept",H.fp,"reach that deck");case"declined":return I("allow",H.fp,"let that deck ask again");case"dialling":return q(H.fp);default:return Promise.resolve(null)}},onSettings:()=>{Y(null),u(!0)},onInvite:()=>{Y(null),f("invite")},twins:(H.twins??[]).map(de=>({row:de,peer:ad(x,de).peer??null})),onUnpair:de=>I("unpair",de,"unpair that deck")})]});return n?a.jsxs("div",{className:"ap-lan-view",children:[a.jsx(VV,{on:z,status:x,paired:re,busy:S,pressProps:R,checkNow:V,setAddOpen:f,setSetupOpen:u,setMapOpen:D,onBack:s,closeButton:i}),a.jsx("div",{className:"ap-scroll",id:"ap-lan-scroll",children:a.jsxs("div",{className:"ap-lan",children:[a.jsxs("div",{className:"ap-policy",children:[a.jsx("h3",{className:"ap-auto-title",children:"Sync with paired decks"}),a.jsx("button",{type:"button",className:"switch ap-auto-state",role:"switch","aria-checked":z,"aria-label":"Sync with paired decks",...R("switch"),onClick:()=>void U(),title:z?"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:a.jsx("span",{className:"switch-knob"})})]}),a.jsx(Z9,{on:z,status:x}),!z&&a.jsxs("button",{type:"button",className:"ap-lan-intro",onClick:()=>p(!0),title:"Four pictures: what this does, and what to do on each machine",children:[a.jsx(F9,{}),a.jsx("span",{className:"ap-lan-intro-text",children:"Paired machines repair each other's expired logins."}),a.jsx("span",{className:"ap-lan-intro-go",children:"See how it works"})]}),a.jsx("p",{className:`ap-lan-status ${ce.tone}`,role:"status",children:ce.tone==="ok"?"":ce.text}),a.jsx(b$,{line:_,onDismiss:E,onAnswer:T}),z&&a.jsxs(a.Fragment,{children:[J.length>0&&a.jsx(K9,{asks:J,pressProps:R,answer:I}),ee.length>0&&a.jsx(Y9,{rows:ee,pairingMode:x==null?void 0:x.pairingMode,armed:$,pressProps:R,answer:I,dropAddress:q,onUnpair:M,onOpenPeer:Y,onInvite:()=>f("invite")}),(G.length>0&&X.length>0||z&&re>0)&&a.jsxs("div",{className:"ap-lan-tail",children:[G.length>0&&X.length>0&&a.jsxs("button",{type:"button",className:"ap-lan-word ap-lan-more","aria-expanded":w,onClick:()=>k(de=>!de),title:w?"Show only the decks that are on":`Show the ${X.length} deck${X.length===1?"":"s"} that are not responding right now`,children:[a.jsx("span",{className:`ap-lan-chev${w?" open":""}`,"aria-hidden":!0,children:"›"}),w?"fewer":`${X.length} more`,!w&&Z>0&&a.jsxs("span",{className:"ap-lan-more-bad",children:[" · ",Z," not responding"]})]}),z&&re>0&&a.jsx("span",{className:"ap-lan-checked",children:n9(x==null?void 0:x.checkedAt,j,S==="check")})]}),W.length===0&&J.length===0&&!(x!=null&&x.stalled)&&!(x!=null&&x.deaf)&&!(x!=null&&x.lanTunneled)&&a.jsxs(a.Fragment,{children:[a.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."}),a.jsx("button",{type:"button",className:"ap-lan-word ap-lan-how",onClick:()=>p(!0),children:"How it works"})]})]})]})}),fe]}):a.jsxs("div",{className:"ap-foot",children:[a.jsx(LV,{entry:ie,rows:F,onOpen:r,onMap:z?()=>D(!0):void 0,...g}),a.jsx("p",{className:"vis-hidden",role:"status",children:ce.tone==="ok"?"":ce.text}),fe]})}function KV({anchorId:e,id:t,peers:n,onHold:r,onLet:s}){const i=v.useRef(null),{title:l,shown:u,rest:d}=Y7(n),f=v.useCallback(()=>{const h=i.current,p=document.getElementById(e);if(!h||!p)return;const g=S0(p.getBoundingClientRect(),{width:h.offsetWidth,height:h.offsetHeight},{width:window.innerWidth,height:window.innerHeight});h.style.top=`${g.top}px`,h.style.left=`${g.left}px`,h.style.maxHeight=g.maxHeight==null?"":`${g.maxHeight}px`,h.dataset.side=g.side},[e]);return v.useLayoutEffect(()=>{f()}),v.useEffect(()=>(window.addEventListener("scroll",f,!0),window.addEventListener("resize",f),()=>{window.removeEventListener("scroll",f,!0),window.removeEventListener("resize",f)}),[f]),Ot.createPortal(a.jsxs("div",{ref:i,id:t,className:"ap-peek ap-fold-peek",role:"tooltip",onPointerEnter:r,onPointerLeave:s,children:[a.jsx("p",{className:"ap-peek-title",children:l}),a.jsx("div",{className:"ap-peek-list",children:u.map(h=>a.jsxs("span",{className:"ap-peek-who ap-fold-who",children:[a.jsx("span",{className:"ap-fold-name",children:h.name}),a.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))}),d&&a.jsx("p",{className:"ap-peek-rest",children:d})]}),document.body)}function YV({peers:e,strained:t,armed:n,threshold:r,open:s,onToggle:i,order:l,choices:u,onOrder:d,allOpen:f,onToggleAll:h,held:p=!1}){const[g,w]=v.useState(!1),k=v.useRef(0);v.useEffect(()=>()=>window.clearTimeout(k.current),[]),v.useEffect(()=>{s&&(window.clearTimeout(k.current),w(!1))},[s]);const x=E=>{s||(window.clearTimeout(k.current),k.current=window.setTimeout(()=>w(!0),E))},b=()=>{window.clearTimeout(k.current),k.current=window.setTimeout(()=>w(!1),i$)},j=()=>window.clearTimeout(k.current),S=()=>{window.clearTimeout(k.current),w(!1)},_=G7(e,{strained:t&&!s,armed:n,threshold:r});return a.jsxs("div",{className:"ap-rest",children:[a.jsxs("button",{type:"button",id:"ap-rest-entry",className:"ap-nav","aria-expanded":s,"aria-controls":s?"ap-rest-panel":void 0,"aria-describedby":g?"ap-rest-peek":void 0,onClick:()=>{S(),i()},onPointerEnter:E=>{E.pointerType==="mouse"&&x(o$)},onPointerLeave:b,onFocus:E=>{E.target.matches(":focus-visible")&&x(0)},onBlur:b,children:[a.jsxs("span",{className:"ap-nav-text",children:[a.jsx("span",{className:"ap-nav-name",children:"Other accounts"}),a.jsx("span",{className:"ap-nav-state","data-tone":_.tone,children:_.text})]}),a.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:a.jsx("path",{d:"M5.6 3.4 9.2 7l-3.6 3.6"})})]}),g&&a.jsx(KV,{anchorId:"ap-rest-entry",id:"ap-rest-peek",peers:e,onHold:j,onLet:b}),s&&a.jsx(XV,{order:l,choices:u,onOrder:d,allOpen:f,onToggleAll:h,held:p})]})}function XV({order:e,choices:t,onOrder:n,allOpen:r,onToggleAll:s,held:i}){var d;const l=v.useRef(null);v.useLayoutEffect(()=>{const f=l.current,h=f==null?void 0:f.parentElement;if(!f||!h)return;const p=()=>h.style.setProperty("--rest-tools-w",`${Math.ceil(f.offsetWidth)}px`);if(p(),typeof ResizeObserver>"u")return;const g=new ResizeObserver(p);return g.observe(f),()=>{g.disconnect(),h.style.removeProperty("--rest-tools-w")}},[]);const u=((d=t.find(f=>f.id===e))==null?void 0:d.label)??"Slot";return a.jsxs("div",{className:"ap-rest-tools",ref:l,children:[a.jsxs("span",{className:"ap-rest-sort",children:[a.jsx("select",{value:e,onChange:f=>n(f.target.value),"aria-label":"Order of the other accounts",title:i?`${u} — held where it was while you are in the list`:u,"data-sorted":e===Pd?void 0:"","data-held":i?"":void 0,children:t.map(f=>a.jsx("option",{value:f.id,children:f.label},f.id))}),a.jsx("svg",{width:"9",height:"9",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:a.jsx("path",{d:"M2.5 3.8 5 6.3l2.5-2.5"})})]}),a.jsx("button",{type:"button",className:"ap-rest-all","aria-label":"Expand every account","aria-pressed":r,"aria-controls":"ap-rest-list",title:r?"Collapse every account":"Expand every account",onClick:s,children:a.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:a.jsx("path",{d:r?"M2 7h10M7 1.5V5M5.2 3.2 7 5l1.8-1.8M7 12.5V9M5.2 10.8 7 9l1.8 1.8":"M2 7h10M7 1.5V5M5.2 3.3 7 1.5l1.8 1.8M7 12.5V9M5.2 10.7 7 12.5l1.8-1.8"})})})]})}async function ZV(e){return(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json().catch(()=>null)}const JV=1800;function QV({accounts:e,onClose:t,copyText:n}){const[r,s]=v.useState([]),[i,l]=v.useState(null),[u,d]=v.useState(!1),[f,h]=v.useState(null),[p,g]=v.useState(!1),[w,k]=v.useState(()=>Math.floor(Date.now()/1e3)),x=v.useRef(null),b=v.useRef(!1),j=mt(t,{focusRef:x}),S=id(i!=null,x),_=id(i==null,x);v.useEffect(()=>{if(!i)return;k(Math.floor(Date.now()/1e3));const M=window.setInterval(()=>k(Math.floor(Date.now()/1e3)),1e3);return()=>window.clearInterval(M)},[i]);const E=C7(e),T=T7(e,r),R=T.length===e.length,A=M=>s(L=>R7(L,M)),U=v.useCallback(async()=>{const M=A7(T);if(!Sr(b.current)||!M)return;b.current=!0,d(!0),h(null),g(!1);const L=await ZV(M).catch(()=>null);if(b.current=!1,d(!1),!(L!=null&&L.ok)){h(Po(L,"the share could not be made"));return}l({blob:L.blob,expiresAt:L.expiresAt,shared:L.shared??[],failed:L.failed??[]})},[e,T]),I=i?t$(i.expiresAt,w):null,q=(I==null?void 0:I.tone)==="gone",P=(i==null?void 0:i.shared.length)??0,O=q?"This share has expired":P===1?"1 account, ready to paste":`${P} accounts, ready to paste`,V=P===1?"this is the password":`this is ${P} passwords`,$=i?q?O:`${O} — ${V}`:"";return Ot.createPortal(a.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:a.jsxs("div",{ref:j,className:"modal sa-modal",onClick:M=>M.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Share accounts with another deck",children:[a.jsxs("header",{className:"modal-head",children:[a.jsx("div",{className:"modal-title",children:a.jsx("h3",{children:"Share accounts"})}),a.jsx("div",{className:"modal-actions",children:a.jsx("button",{type:"button",className:"glyph-btn",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),a.jsxs("section",{className:"modal-body sa-body",children:[a.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:$}),i?a.jsxs("div",{className:"sa-step",children:[a.jsx("h4",{children:O}),a.jsx("code",{className:"ap-share-blob",children:i.blob}),a.jsxs("div",{className:"ap-share-foot",children:[a.jsx("button",{type:"button",className:"ap-manage-btn",ref:x,onClick:async()=>{if(q){_(),S(),l(null),U();return}await n(i.blob)&&(g(!0),window.setTimeout(()=>g(!1),JV))},children:q?"make a new share":p?"copied":`copy ${P===1?"the share":"all "+P}`}),a.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:[a.jsx("span",{className:"ap-share-warn",children:V})," · ",a.jsx("span",{className:`ap-share-expiry ${I==null?void 0:I.tone}`,children:I==null?void 0:I.text})]})]}),i.failed.length>0&&a.jsxs("div",{className:"sa-failed",role:"alert",children:[a.jsx("p",{className:"sa-failed-head",children:i.failed.length===1?"One account is not in this bundle:":`${i.failed.length} accounts are not in this bundle:`}),a.jsx("ul",{className:"sa-list",children:i.failed.map(M=>{var Y;const L=!!(M.email&&((Y=M.detail)!=null&&Y.includes(M.email)));return a.jsxs("li",{children:[!L&&a.jsx("span",{className:"sa-who",children:M.email||`account ${M.num}`}),a.jsx("span",{className:"sa-why",children:M.detail||"could not be exported"})]},`${M.num}-${M.email}`)})})]}),a.jsx("p",{className:"sa-note",children:q?a.jsx(a.Fragment,{children:"Another deck will refuse this text now. Make a new one — the same accounts are still picked."}):a.jsxs(a.Fragment,{children:["Paste it into the other deck with ",a.jsx("strong",{children:"+"})," → ",a.jsx("strong",{children:"Paste a share"}),". Accounts it already holds are left exactly as they are."]})}),a.jsxs("div",{className:"sa-actions",children:[a.jsx("button",{type:"button",className:"btn",onClick:()=>{_(),l(null),g(!1)},children:"Pick again"}),a.jsx("button",{type:"button",className:"btn primary",onClick:t,children:"Done"})]})]}):e.length===0?a.jsxs("div",{className:"sa-step",children:[a.jsx("h4",{children:"Nothing to share"}),a.jsxs("p",{className:"sa-note",children:["This deck is not holding any accounts right now. Sign one in with ",a.jsx("strong",{children:"+"}),", or wait — the panel is still reading the store."]}),a.jsx("div",{className:"sa-actions",children:a.jsx("button",{type:"button",className:"btn primary",ref:x,onClick:t,children:"Close"})})]}):a.jsxs("div",{className:"sa-step",children:[a.jsxs("h4",{children:["Which accounts go to the other ",vt,"?"]}),a.jsx("p",{className:`sa-count${T.length?"":" empty"}`,children:M7(T.length)}),a.jsx("ul",{className:"sa-list sa-pick",children:E.map(M=>a.jsx("li",{children:a.jsxs("label",{className:"sa-row",children:[a.jsx("input",{type:"checkbox",checked:T.includes(M.num),onChange:()=>A(M.num)}),a.jsx("span",{className:"sa-who",children:M.label}),M.sub&&a.jsx("span",{className:"sa-sub",children:M.sub})]})},M.num))}),f&&a.jsx("p",{className:"aa-err",role:"alert",children:f}),a.jsxs("div",{className:"sa-actions",children:[a.jsx("button",{type:"button",className:"btn",onClick:()=>s(R?e.map(M=>M.num):[]),children:R?"Clear all":"Select all"}),a.jsx("button",{type:"button",className:"btn primary",ref:x,...Jr(u,!T.length),onClick:()=>{S(),U()},children:u?"making the share…":T.length===0?"Share":T.length===1?"Share 1 account":`Share ${T.length} accounts`})]})]})]})]})}),document.body)}function k$(e,t){var n;return!e.disabled&&!((n=ni(e,t))!=null&&n.blocksSwitch)}function eG(e,t){return e.map(n=>{const r=ni(n,t);return{key:_r(n),name:n.alias??n.email??`account ${n.num}`,ready:k$(n,t),why:n.disabled?"held out":r!=null&&r.blocksSwitch?r.text:null,warn:(r==null?void 0:r.tone)==="warn",headroom:n.headroom}})}function tG(e,t){const n=Number(t);return(e==null?void 0:e.headroom)!=null&&Number.isFinite(n)&&100-e.headroom>=n}function nG(e){return(e==null?void 0:e.ok)===!0&&(e.enabled||e.external)}function rG(e){return e.map(t=>({key:`${String(t.email??"").trim().toLowerCase()}@@${t.orgUuid??""}`,email:t.email??"",alive:t.alive===!0,shareable:t.collector==="ok"||t.collector==null&&!t.active}))}const N$="agent-dag.otherAccountsOrder",j$="agent-dag.otherAccountsOpen";function sG(){const e=Qe(N$);return typeof e=="string"&&e.length>0&&e.length<=64?e:Pd}function aG(e){Xe(N$,e)}function oG(){const e=Qe(j$);if(!e)return gx;try{const t=JSON.parse(e);if(((t==null?void 0:t.mode)==="some"||(t==null?void 0:t.mode)==="all")&&Array.isArray(t.keys)&&t.keys.every(n=>typeof n=="string"))return{mode:t.mode,keys:t.keys.slice(0,200)}}catch{}return gx}function iG(e){Xe(j$,JSON.stringify({mode:e.mode,keys:e.keys.filter(t=>!t.startsWith("slot:"))}))}function lG(){const[e,t]=v.useState(null),n=v.useRef(null),r=v.useCallback(l=>Id(n.current)?(n.current=l,t(l),!0):!1,[]),s=v.useCallback(()=>{n.current=null,t(null)},[]);return{busy:e,claim:r,release:s,pressProps:(l,u=!1)=>{const d=Vs(e,l);return{disabled:d.disabled,"aria-busy":d.busy||u}}}}const cG=8e3,uG=1800,dG=4e3;function hG({claim:e,release:t,load:n,clearFailure:r,rescueFocus:s}){const[i,l]=v.useState(null),u=(i==null?void 0:i.num)??null,d=v.useRef(i);d.current=i;const[f,h]=v.useState(null),[p,g]=v.useState(""),[w,k]=v.useState(null),x=v.useRef(0);v.useEffect(()=>{if(w==null)return;const J=window.setTimeout(()=>k(null),dG);return()=>window.clearTimeout(J)},[w]);const[b,j]=v.useState(null),[S,_]=v.useState(!1),[E,T]=v.useState(null),[R,A]=v.useState(null),U=v.useCallback(async(J,W)=>{if(!e(W))return null;r(),h(null);try{const G=await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(J)}),X=await G.json().catch(()=>null);return X!=null&&X.ok||h({text:Po(X,"command failed",G.status)}),X}catch{return h({text:"server unreachable"}),null}finally{t()}},[e,t,r]),I=v.useCallback(()=>{l(null),h(null),k(null),j(null),_(!1)},[]),q=(J,W="first")=>{I(),A(null),l({num:J,view:"menu",start:W})},P=v.useCallback(J=>{var X,Z;const W=d.current;if(!W||J!=null&&W.num!==J)return;const G=document.getElementById(`ap-menu-${W.num}`);(G!=null&&G.contains(document.activeElement)||ns(((X=document.activeElement)==null?void 0:X.tagName)??null))&&((Z=document.getElementById(`ap-more-${W.num}`))==null||Z.focus()),I()},[I]),O=v.useCallback(J=>h(J),[]),V=(J,W)=>{g(W??""),h(null),l({num:J,view:"rename"})},$=J=>g(J),M=J=>{A(null),h(null),l({num:J,view:"move"})},L=J=>A(J),Y=async J=>{var G;_(!1);const W=await U({action:"share",account:J},`share-${J}`);!(W!=null&&W.ok)||((G=d.current)==null?void 0:G.num)!==J||(j({num:J,blob:W.blob,expiresAt:W.expiresAt}),l({num:J,view:"share"}))},K=async J=>{await Ba(J)&&(_(!0),window.setTimeout(()=>_(!1),uG))},D=async(J,W)=>{const{commit:G,alias:X}=B7(p,W);if(G){const Z=await U({action:"alias",account:J,alias:X},`alias-${J}`);if(await n(!0),!(Z!=null&&Z.ok))return}P(J)},z=async(J,W)=>{var Z,ee,re;const G=await U({action:"move",account:J,slot:W},`move-${J}`),X=F7({menuFor:((Z=d.current)==null?void 0:Z.num)??null,shareFor:(b==null?void 0:b.num)??null},J,G);if(await n(!0),X){if(X.menuFor!=null){const ie=document.getElementById(`ap-menu-${J}`),fe=document.getElementById(`ap-more-${X.menuFor}`);fe&&(ie!=null&&ie.contains(document.activeElement)||ns(((ee=document.activeElement)==null?void 0:ee.tagName)??null))&&fe.focus()}((re=d.current)==null?void 0:re.num)===J&&I(),k(X.confirmRemove),X.shareFor==null&&(j(null),_(!1)),T(X.swapNote);const ce=X.swapNote;ce&&window.setTimeout(()=>T(ie=>ie===ce?null:ie),cG),A(null),s(X.menuFor)}return G};return{menu:i,menuFor:u,menuError:f,aliasDraft:p,confirmRemove:w,share:b,shareCopied:S,slotDraft:R,swapNote:E,showMenu:q,dropMenu:I,closeMenu:P,sayInMenu:O,startRename:V,typeAlias:$,doAlias:D,startMove:M,pickSlot:L,doSlot:async(J,W,G)=>{if(!G.sends){P(J);return}await z(J,W)},makeShare:Y,copyShare:K,pressRemove:J=>{const W=Date.now(),G=Tl({armedFor:w,target:J,armedAt:x.current,now:W,gapMs:Cl});if(G==="arm"){k(J),x.current=W;return}G!=="ignore"&&(k(null),U({action:"remove",account:J},`rm-${J}`).then(X=>{var Z;n(!0),X!=null&&X.ok&&(((Z=d.current)==null?void 0:Z.num)===J&&I(),s(null))}))}}}function fG(e,t){return!e||!t||t.some(n=>n.num===e.num&&n.active)?e:null}function pG({data:e,claim:t,release:n,load:r,sayFailure:s,clearFailure:i,sayInMenu:l,rescueFocus:u}){const[d,f]=v.useState(null),h=v.useCallback(async(g,w,k="panel")=>{if(!t(w))return null;const x=k==="menu"?l:s;x(null);try{const b=await fetch("/api/cswap-auto",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(g)}),j=await b.json().catch(()=>null);return j!=null&&j.ok||x({text:yx(j,"command failed",b.status),raw:Ml(j)}),j}catch{return x({text:"server unreachable"}),null}finally{n()}},[t,n,l,s]);return v.useEffect(()=>{!(e!=null&&e.ok)||!e.accounts||f(g=>fG(g,e.accounts))},[e]),{switched:d,post:h,doSwitch:async(g,w)=>{if(t(`switch-${g}`)){i(),f(null);try{const x=await(await fetch("/api/claude-accounts/switch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({account:g})})).json().catch(()=>null);x!=null&&x.ok?f({num:g,name:w}):s({text:yx(x,"the switch failed"),raw:Ml(x),row:g}),await r(!0)}catch{s({text:"server unreachable",row:g})}finally{n(),u(g)}}}}}const mG=1800;function gG({auto:e,post:t,load:n}){var k;const[r,s]=v.useState(null),[i,l]=v.useState(!1),u=v.useRef(null),d=v.useRef(null),f=((k=e==null?void 0:e.settings["autoswitch.threshold"])==null?void 0:k.value)??"90",h=r??f,p=H7(h,f);return{threshold:f,thresholdPick:h,thresholdCtl:p,thresholdSaved:i,thresholdRef:u,thresholdSaveRef:d,proposeThreshold:x=>s(x),doThreshold:async(x,b)=>{if(b.sends){const j=await t({action:"setting",key:"autoswitch.threshold",value:x},"threshold");if(await n(!0),!(j!=null&&j.ok))return;s(null)}l(!0),window.setTimeout(()=>{var j;document.activeElement===d.current&&((j=u.current)==null||j.focus()),l(!1)},mG)}}}const yG=Object.freeze({text:"couldn't reach the deck server",reload:!0}),wG=Object.freeze({text:"still waiting on the deck server — claude-swap can be slow to answer",reload:!0});async function Wj(e){return e.ok?{ok:!0,status:e.status,body:null}:{ok:!1,status:e.status,body:await e.json().catch(()=>null)}}function vG(e){const t=e.find(r=>!r.ok);if(!t)return null;const n=Ml(t.body);return{text:yx(t.body,`the deck server answered ${t.status}`),...n?{raw:n}:{},reload:!0}}function Vj(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 S$=15e3,xG=3e4;function bG(e){const[t,n]=v.useState(null),[r,s]=v.useState(null),[i,l]=v.useState(!1),[u,d]=v.useState(null),f=v.useRef(null),h=v.useCallback(async(w=!1)=>{w&&l(!0);const k=new AbortController,x=window.setTimeout(()=>k.abort(),xG);try{const[b,j]=await Promise.all([fetch(`/api/claude-accounts${w?"?refresh=1":""}`,{signal:k.signal}),fetch("/api/cswap-auto",{signal:k.signal})]);if(b.ok){const _=await b.json();n(_),e(_)}j.ok&&s(await j.json());const S=vG([await Wj(b),await Wj(j)]);d(_=>Vj(_,S))}catch{d(b=>Vj(b,k.signal.aborted?wG:yG))}finally{window.clearTimeout(x),w&&l(!1)}},[e]);v.useEffect(()=>(h(!0),f.current=window.setInterval(()=>h(!1),S$),()=>{f.current!=null&&window.clearInterval(f.current)}),[h]);const p=v.useCallback(w=>d(w),[]),g=v.useCallback(()=>d(null),[]);return{data:t,auto:r,reloading:i,failure:u,load:h,sayFailure:p,clearFailure:g}}const kG="#ap-rest-entry";function NG(e){return[`#${e}`,kG,...CM(null)]}function jG(e){const t=v.useRef(null),n=s=>{t.current=s.target.id||null},r=s=>{s.target.isConnected&&(t.current=null)};return v.useLayoutEffect(()=>{var i;const s=t.current;if(!(!s||!ns(((i=document.activeElement)==null?void 0:i.tagName)??null)))for(const l of NG(s)){const u=document.querySelector(l);if(u){u.focus();return}}},[e]),{onFocus:n,onBlur:r}}function SG({onClose:e,leaving:t}){var jn,yt,Un;const{busy:n,claim:r,release:s,pressProps:i}=lG(),[l,u]=v.useState("accounts"),[d,f]=v.useState(!1),[h,p]=v.useState(null),g=v.useRef(h);g.current=h;const[w,k]=v.useState(!1),[x,b]=v.useState(!1),[j,S]=v.useState([]),[_,E]=v.useState(!1),[T,R]=v.useState(null),[A,U]=v.useState(oG),[I,q]=v.useState(sG),[P,O]=v.useState(null),[V,$]=v.useState(!1),M=v.useCallback(ge=>U(He=>MW(He,ge.accounts)),[]),{data:L,auto:Y,reloading:K,failure:D,load:z,sayFailure:F,clearFailure:H}=bG(M),J=jG(L),W=v.useCallback(ge=>{window.requestAnimationFrame(()=>{var He;if(ns(((He=document.activeElement)==null?void 0:He.tagName)??null))for(const Ze of CM(ge)){const fn=document.querySelector(Ze);if(fn){fn.focus();return}}})},[]),G=hG({claim:r,release:s,load:z,clearFailure:H,rescueFocus:W}),{menu:X,menuFor:Z,swapNote:ee,showMenu:re,dropMenu:ce,closeMenu:ie,sayInMenu:fe}=G,{switched:de,post:we,doSwitch:xe}=pG({data:L,claim:r,release:s,load:z,sayFailure:F,clearFailure:H,sayInMenu:fe,rescueFocus:W}),{threshold:$e,thresholdPick:be,thresholdCtl:he,thresholdSaved:se,thresholdRef:ke,thresholdSaveRef:Ce,proposeThreshold:Oe,doThreshold:Le}=gG({auto:Y,post:we,load:z}),Pe=OM();v.useEffect(()=>{iG(A)},[A]),v.useEffect(()=>{aG(I)},[I]);const qe=(jn=L==null?void 0:L.accounts)==null?void 0:jn.find(ge=>ge.active),Ue=qe?ni(qe,Pe):null,et=(L==null?void 0:L.accounts)??[],ze=qe?et.filter(ge=>!ge.active):[],at=WM(ze),gt=CW(I,ze),Ie=VM(EW(ze,gt,ge=>k$(ge,Pe)),P),ot=v.useRef(!1),Je=v.useRef(!1),it=v.useRef(!1),Ft=v.useCallback(()=>{!ot.current&&!Je.current&&!it.current&&O(null)},[]),kt=()=>O(ge=>ge??Ie.map(_r)),Nt={onPointerEnter:()=>{ot.current=!0,kt()},onPointerLeave:()=>{ot.current=!1,Ft()},onFocus:ge=>{ge.target.matches(":focus-visible")&&(Je.current=!0,kt())},onBlur:ge=>{ge.currentTarget.contains(ge.relatedTarget)||(Je.current=!1,Ft())}},qt=Z!=null&&ze.some(ge=>ge.num===Z)||h!=null&&ze.some(ge=>ge.num===h.num);v.useEffect(()=>{it.current=qt,qt||Ft()},[qt,Ft]);const kn=V&&ze.length>0;v.useEffect(()=>{kn||(ot.current=Je.current=it.current=!1,O(null))},[kn]);const Gt=v.useRef(!1);v.useEffect(()=>{Gt.current&&ze.length===0&&W(null),Gt.current=ze.length>0},[ze.length,W]);const Bt=Ie.length?et.filter(ge=>ge.active):et,dn=eG(Ie,Pe),Kt=tG(qe,$e),as=nG(Y),$r=ge=>V&&Ie.some(He=>He.num===ge)?"ap-rest-list":"ap-scroll",os=(ge,He="first")=>{re(ge,He),p(null)},ur=(ge,He)=>{ce(),p(Ze=>(Ze==null?void 0:Ze.anchor)===He?null:{num:ge,anchor:He})},Bn=v.useCallback((ge=!1)=>{var Ze;const He=g.current;ge&&He&&((Ze=document.getElementById(He.anchor))==null||Ze.focus()),p(null)},[]),is=()=>{ce(),p(null),u("lan")},Nn=v.useRef(l);v.useEffect(()=>{Nn.current!==l&&(Nn.current=l,window.requestAnimationFrame(()=>{var ge;(ge=document.getElementById(l==="lan"?"ap-lan-back":"ap-lan-entry"))==null||ge.focus()}))},[l]),v.useEffect(()=>{L!=null&&L.ok&&f(!0)},[L==null?void 0:L.ok]),v.useEffect(()=>{t&&(ce(),p(null))},[t,ce]),v.useEffect(()=>{X&&(L!=null&&L.accounts)&&!L.accounts.some(ge=>ge.num===X.num)&&ce(),h&&(L!=null&&L.accounts)&&!L.accounts.some(ge=>ge.num===h.num)&&p(null)},[L,X,h,ce]),v.useEffect(()=>{T==null||!(L!=null&&L.accounts)||L.accounts.some(ge=>ge.num===T.num)||(R(null),W(null))},[L,T,W]);const dr=a.jsx("button",{type:"button",className:"glyph-btn",onClick:e,"aria-label":"Close accounts panel",title:"Close (A)",children:a.jsx("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round","aria-hidden":!0,children:a.jsx("path",{d:"M3.4 3.4l7.2 7.2M10.6 3.4l-7.2 7.2"})})}),hn=ge=>{const He=GM(A,ge),Ze=Z===ge.num,fn=(D==null?void 0:D.row)===ge.num?D:null,Ut=(de==null?void 0:de.num)===ge.num,hr=(ee==null?void 0:ee.at)===ge.num?ee:null,Xs=hr?et.find(zn=>zn.num===hr.displaced):void 0,cs=(h==null?void 0:h.anchor)===`ap-issue-${ge.num}`;return a.jsx(OW,{a:ge,nowSec:Pe,opened:He,onToggleLanes:()=>U(zn=>RW(zn,ge)),busy:n,pressProps:i,onSwitch:xe,menuOpen:Ze,onOpenMenu:os,onCloseMenu:ie,refusal:fn,onDismissRefusal:()=>H(),switchedHere:Ut,swapped:hr,displaced:Xs,issueExpanded:cs,onOpenIssue:ur,sortKey:ge.active?null:_W(gt)},ge.num)},ls=L!=null&&L.ok&&(Y!=null&&Y.ok)?a.jsx(n7,{auto:Y,threshold:$e,thresholdPick:be,thresholdCtl:he,thresholdSaved:se,thresholdRef:ke,thresholdSaveRef:Ce,proposeThreshold:Oe,doThreshold:Le,pressProps:i,post:we,load:z}):null;return a.jsxs("aside",{className:`accounts-panel${t?" leaving":""}`,id:"accounts-panel","aria-label":"Claude accounts",onFocus:J.onFocus,onBlur:J.onBlur,children:[l==="accounts"&&a.jsx(PW,{canShare:(((yt=L==null?void 0:L.accounts)==null?void 0:yt.length)??0)>0,canReport:(((Un=L==null?void 0:L.accounts)==null?void 0:Un.length)??0)>1||x,onAdd:()=>k(!0),onReport:()=>{S([...Bt,...Ie].map(_r)),b(!0)},onShareSet:()=>E(!0),onReload:()=>z(!0),pressProps:i,reloading:K,closeButton:dr}),l==="accounts"&&a.jsx("div",{className:"ap-scroll",id:"ap-scroll",children:L==null?D?a.jsxs("div",{className:"ap-empty",role:"alert",children:[a.jsx("span",{title:D.raw||void 0,children:D.text}),a.jsxs("span",{className:"ap-hint",children:["No accounts have arrived, so there is nothing to show yet. The panel keeps trying every ",S$/1e3," seconds."]}),a.jsx("button",{type:"button",className:"ap-fix",...i("reload",K),onClick:()=>z(!0).then(()=>W(null)),children:K?"trying…":"try again"})]}):a.jsx("div",{className:"ap-empty",children:"Checking…"}):L.ok?a.jsxs(a.Fragment,{children:[qe&&(Ue==null?void 0:Ue.tone)==="warn"&&a.jsxs("div",{className:"ap-notice",children:[a.jsxs("button",{type:"button",id:"ap-notice",className:"ap-issue","data-tone":"warn","aria-haspopup":"dialog","aria-expanded":(h==null?void 0:h.anchor)==="ap-notice","aria-controls":(h==null?void 0:h.anchor)==="ap-notice"?"ap-issue-pop":void 0,onClick:()=>ur(qe.num,"ap-notice"),children:[a.jsx(E0,{}),a.jsx("span",{className:"ap-issue-text",children:"Current account needs attention"})]}),Ue.fix&&a.jsx("button",{type:"button",className:"ap-notice-fix",onClick:()=>k(!0),title:"Open the sign-in dialog. Signing in as this account replaces its stored login in place.",children:"Sign in"})]}),a.jsx("ul",{className:"ap-list",children:Bt.map(hn)}),Ie.length>0&&a.jsx(YV,{peers:dn,strained:Kt,armed:as,threshold:Y!=null&&Y.ok?$e:null,open:V,onToggle:()=>$(ge=>!ge),order:gt,choices:at,onOrder:q,allOpen:KM(A,Ie),onToggleAll:()=>U(ge=>AW(ge,Ie)),held:P!=null}),Ie.length>0&&V&&a.jsxs("div",{className:"ap-rest-panel",id:"ap-rest-panel",children:[a.jsx("ul",{className:"ap-list ap-others",id:"ap-rest-list",...Nt,children:Ie.map(hn)}),ls]}),Ie.length===0&&ls,D&&D.row==null&&a.jsxs("div",{className:"ap-failure",role:"alert",children:[a.jsx("span",{className:"ap-failure-text",title:D.raw||void 0,children:D.text}),a.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>H(),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),X&&(()=>{var He;const ge=(He=L.accounts)==null?void 0:He.find(Ze=>Ze.num===X.num);return ge?a.jsx(W7,{a:ge,accountMenu:G,slots:(L.accounts??[]).map(Ze=>Ze.num),boundaryId:$r(ge.num),nowSec:Pe,busy:n,pressProps:i,rotating:!!(Y!=null&&Y.enabled||Y!=null&&Y.external),onProjects:()=>{R({num:ge.num,name:ge.alias??ge.email??`account ${ge.num}`}),ie(ge.num)},onRotation:()=>we({action:"account",account:ge.num,enabled:ge.disabled},`rot-${ge.num}`,"menu").then(Ze=>{z(!0),Ze!=null&&Ze.ok&&ie(ge.num)})}):null})(),h&&(()=>{var Ze;const ge=(Ze=L.accounts)==null?void 0:Ze.find(fn=>fn.num===h.num),He=ge?ni(ge,Pe):null;return!ge||!He?null:a.jsx(wW,{anchorId:h.anchor,boundaryId:h.anchor==="ap-notice"?"ap-scroll":$r(ge.num),issue:He,who:ge.alias??ge.email??`account ${ge.num}`,fetchedAt:ge.fetchedAt,nowSec:Pe,onClose:Bn,onSignIn:()=>k(!0)})})()]}):a.jsx(LW,{data:L})}),a.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:de?`Now active: ${de.name}`:""}),d&&a.jsx(GV,{accounts:rG((L==null?void 0:L.accounts)??[]),onChanged:()=>z(!0),view:l==="lan",onOpen:is,onBack:()=>u("accounts"),closeButton:dr}),w&&a.jsx(P7,{onClose:()=>k(!1),onChanged:()=>z(!0)}),_&&a.jsx(QV,{accounts:((L==null?void 0:L.accounts)??[]).map(ge=>({num:ge.num,email:ge.email,alias:ge.alias,org:ge.org})),onClose:()=>E(!1),copyText:Ba}),T!=null&&(()=>{var He;const ge=(He=L==null?void 0:L.accounts)==null?void 0:He.find(Ze=>Ze.num===T.num);return L!=null&&L.accounts&&!ge?null:a.jsx(gW,{num:T.num,name:ge?ge.alias??ge.email??`account ${ge.num}`:T.name,onClose:()=>R(null)})})(),x&&a.jsx(e7,{accounts:(L==null?void 0:L.accounts)??null,order:j,failed:D!=null&&D.reload?D.text:null,nowSec:Pe,onClose:()=>b(!1)})]})}const _G=16,EG=120;function CG(e,t,n=0){return e.clientX>=t.left-n&&e.clientX<=t.right+n&&e.clientY>=t.top-n&&e.clientY<=t.bottom+n}function TG(e,t){const n=Math.max(t.left-e.clientX,0,e.clientX-t.right),r=Math.max(t.top-e.clientY,0,e.clientY-t.bottom);return Math.hypot(n,r)}function RG(e,t){return CG(e,t,_G)?"over":TG(e,t)<=EG?"near":"far"}function AG(e){var n,r;if(typeof e.clientX=="number"&&typeof e.clientY=="number")return{clientX:e.clientX,clientY:e.clientY};const t=((n=e.changedTouches)==null?void 0:n[0])??((r=e.touches)==null?void 0:r[0]);return t?{clientX:t.clientX,clientY:t.clientY}:null}function MG(){const[e,t]=v.useState(!1),[n,r]=v.useState(""),[s,i]=v.useState("far"),l=v.useRef(null),u=Mu(e,140),d=v.useCallback(g=>{var x;const w=(x=l.current)==null?void 0:x.getBoundingClientRect(),k=AG(g);return w&&k?RG(k,w):"far"},[]),f=v.useCallback(g=>{g!==null&&(r(g),t(!0)),i("far")},[]),h=v.useCallback(g=>{i(d(g))},[d]),p=v.useCallback((g,w)=>{const k=w&&d(g)==="over";return t(!1),k},[d]);return{trashDragging:e,trashLabel:n,trashState:s,trashZoneRef:l,trashPhase:u,beginTrashDrag:f,trackTrashDrag:h,endTrashDrag:p}}const $G=420;function IG(){const[e,t]=v.useState(!1),n=v.useRef(null),r=v.useCallback(()=>{n.current&&(window.clearTimeout(n.current),n.current=null),t(!1)},[]),s=v.useCallback(i=>{i.length!==0&&queueMicrotask(()=>{t(!0),n.current&&window.clearTimeout(n.current),n.current=window.setTimeout(()=>t(!1),$G+80)})},[]);return v.useEffect(()=>()=>{n.current&&window.clearTimeout(n.current)},[]),{bubbling:e,endBubble:r,onBubble:s}}const L0=11,_$=7.2,E$=6.6,OG={width:104,height:48},Gj={width:96,height:44},C$={width:220,height:103};function LG(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)?C$:{width:Math.max(160,t),height:Math.max(72,n)}}function pp(e,t,n){return e.width*t>=n.width&&e.height*t>=n.height}function PG(e,t,n=C$){if(!Number.isFinite(t)||t<=0)return e??"detail";const r=L0*t;return e==="detail"?r>=E$?"detail":pp(n,t,Gj)?"compact":"overview":r>=_$?"detail":e==="compact"?pp(n,t,Gj)?"compact":"overview":pp(n,t,OG)?"compact":"overview"}const DG=_$/L0,FG=E$/L0;function qG(e,t){return e>=DG?e:Math.max(e,Math.min(t,FG-.001))}const BG=.8,UG=1;function zG({stateRef:e,measuredRef:t,measuredVersionRef:n,canvasRef:r}){const[s,i]=v.useState("detail"),l=v.useRef(null),u=v.useRef(null),d=v.useCallback(()=>{var w;const h=n.current;if(((w=u.current)==null?void 0:w.version)===h)return u.current.card;const p=[];for(const k of e.current.agents.keys()){const x=t.current.get(k);x&&p.push(x)}const g=LG(p);return u.current={version:h,card:g},g},[]),f=v.useCallback(h=>{var g;const p=PG(l.current,h,d());return p===l.current?null:(l.current=p,(g=r.current)==null||g.setAttribute("data-lod",p),i(p),p)},[d,r]);return{lod:s,lodRef:l,applyZoom:f}}const HG=40,WG=120;function VG(e,t){let n=null,r=0,s=Number.NEGATIVE_INFINITY;const i=()=>{n=null,s=t.now(),e()},l=()=>{n!=null&&(t.clearTimeout(n),n=null)},u=(d,f,h)=>{if(n!=null){if(r<=d)return;l()}const p=Math.min(h,Math.max(0,d-f));r=d,n=t.setTimeout(i,p)};return{live(d=HG){const f=t.now(),h=Math.max(s+d,f);if(h<=f){l(),i();return}u(h,f,d)},replay(d=WG){l(),r=t.now()+d,n=t.setTimeout(i,d)},flush(){l(),i()},cancel(){l()}}}const GG=1024*1024,Kj=5,T$=.8,Ex=24,KG="agent-dag.soundCustom.done",YG="agent-dag.soundCustom.needs-input",ml={done:KG,"needs-input":YG};function $l(e){if(e.kind!=="audio")return e;const{bytes:t,...n}=e;return n}function Yj(e){return!e||!/^[a-zA-Z0-9._-]{1,96}$/.test(e)?null:e}function XG(e){return{done:Yj(e(ml.done)),"needs-input":Yj(e(ml["needs-input"]))}}function ZG(e,t){return{done:e.done===t?null:e.done,"needs-input":e["needs-input"]===t?null:e["needs-input"]}}function JG(e){return e.done&&e.done===e["needs-input"]?e.done:null}const QG={wav:"audio/wav",wave:"audio/wav",mp3:"audio/mpeg",ogg:"audio/ogg",oga:"audio/ogg",webm:"audio/webm",m4a:"audio/mp4",mp4:"audio/mp4"},R$=new Set(["audio/wav","audio/x-wav","audio/mpeg","audio/mp3","audio/ogg","audio/webm","audio/mp4"]);function A$(e,t){const n=t.toLowerCase().split(";")[0].trim();if(R$.has(n))return n;const r=e.toLowerCase().split(".").pop()??"";return QG[r]??n}function Xj(e,t){const n=A$(e.name,e.type);if(!R$.has(n))return"Use a WAV, MP3, OGG, or browser-recorded audio file.";if(!Number.isFinite(e.size)||e.size<=0)return"The audio file is empty.";if(e.size>GG)return"Audio must be 1 MB or smaller.";if(t!==void 0){if(!Number.isFinite(t)||t<=0)return"The audio file could not be decoded.";if(t>Kj)return`Audio must be ${Kj} seconds or shorter.`}return null}function Cx(e){return e>=Ex?`There are already ${Ex} custom sounds. Delete one first.`:null}function eK(e,t){const n=e.indexOf(t);return n<0?null:e[n+1]??e[n-1]??null}function tK(e){let t=0;for(const n of e)for(let r=0;r<n.length;r++)t=Math.max(t,Math.abs(n[r]));return t<=1e-5?1:Math.min(16,T$/t)}function M$(){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)}`}async function nK(e,t,n=M$()){var f;const r=((f=e.name)==null?void 0:f.trim())||"Custom sound",s=Xj({name:r,type:e.type,size:e.size});if(s)throw new Error(s);const i=await e.arrayBuffer();let l;try{l=await t(i.slice(0))}catch{throw new Error("The audio file could not be decoded.")}const u=Xj({name:r,type:e.type,size:e.size},l.duration);if(u)throw new Error(u);const d=Array.from({length:l.numberOfChannels},(h,p)=>l.getChannelData(p));return{id:n,name:r.replace(/\.(wav|wave|mp3|ogg|oga|webm|m4a|mp4)$/i,"")||"Custom sound",kind:"audio",mime:A$(r,e.type),duration:l.duration,normalizationGain:tK(d),bytes:i}}function rK(e,t=M$()){const n=e.name.trim()||"Custom voice",r=e.text.trim();if(!r)throw new Error("Enter the words this voice should say.");const s=Number.isFinite(e.rate)?e.rate:1,i=Number.isFinite(e.pitch)?e.pitch:1;return{id:t,name:n,kind:"tts",text:r.slice(0,180),voiceURI:e.voiceURI??"",rate:Math.min(2,Math.max(.5,s)),pitch:Math.min(2,Math.max(.5,i))}}const sK="ccdeck-notification-audio",aK=2,ar="assets",Rr="summaries";function Hl(){return typeof window<"u"?window.ccdeckNotificationAudio??null:null}function oK(){return new Promise((e,t)=>{const n=indexedDB.open(sK,aK);n.onupgradeneeded=r=>{const s=n.result,i=s.objectStoreNames.contains(ar)?n.transaction.objectStore(ar):s.createObjectStore(ar,{keyPath:"id"});if(s.objectStoreNames.contains(Rr))return;const l=s.createObjectStore(Rr,{keyPath:"id"});if(r.oldVersion<1)return;const u=i.openCursor();u.onsuccess=()=>{const d=u.result;d&&(l.put($l(d.value)),d.continue())}},n.onsuccess=()=>e(n.result),n.onerror=()=>t(n.error??new Error("Could not open local audio storage."))})}async function Wl(e,t,n){const r=await oK();try{return await new Promise((s,i)=>{const l=r.transaction(e,t),u=n(l),d=()=>i(l.error??new Error("Local audio storage failed."));l.oncomplete=()=>s(u?u.result:void 0),l.onerror=d,l.onabort=d})}finally{r.close()}}async function iK(){const e=Hl();return e?e.list():typeof indexedDB>"u"?[]:await Wl([Rr],"readonly",t=>t.objectStore(Rr).getAll())??[]}async function lK(e){const t=Hl();return t?t.get(e):typeof indexedDB>"u"?null:await Wl([ar],"readonly",n=>n.objectStore(ar).get(e))??null}async function Zj(e){const t=Hl();if(t){await t.put(e);return}if(typeof indexedDB>"u")throw new Error("Local audio storage is unavailable in this browser.");await Wl([ar,Rr],"readwrite",n=>{n.objectStore(ar).put(e),n.objectStore(Rr).put($l(e))})}async function cK(e,t){const n=Hl();if(n){const r=await n.get(e);r&&await n.put({...r,name:t});return}if(typeof indexedDB>"u")throw new Error("Local audio storage is unavailable in this browser.");await Wl([ar,Rr],"readwrite",r=>{const s=r.objectStore(ar),i=s.get(e);i.onsuccess=()=>{const l=i.result;if(!l)return;const u={...l,name:t};s.put(u),r.objectStore(Rr).put($l(u))}})}async function uK(e){const t=Hl();if(t){await t.remove(e);return}typeof indexedDB>"u"||await Wl([ar,Rr],"readwrite",n=>{n.objectStore(ar).delete(e),n.objectStore(Rr).delete(e)})}const Lu=["done","needs-input"],dK=[{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}]}],hK=[{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}]}],P0={done:dK,"needs-input":hK},vn="two";function Tx(e,t){const n=P0[e];return n.find(r=>r.id===t)??n.find(r=>r.id===vn)??n[0]}function $$(e,t){return P0[e].some(r=>r.id===t)?t:vn}Tx("done",vn).notes,Tx("needs-input",vn).notes;const Jj=.04,I$=.24,Pu=0,ld=100,Rx=5,Da=50;function ri(e){if(!Number.isFinite(e))return Da;const t=Math.round(e/Rx)*Rx;return Math.min(ld,Math.max(Pu,t))}function O$(e){if(e==null)return Da;const t=e.trim();return/^-?\d+(\.\d+)?$/.test(t)?ri(Number(t)):Da}function D0(e){const t=ri(e),n=Jj+(I$-Jj)*(t/ld);return Math.round(n*1e4)/1e4}function fK(e,t){const n=t.trim,r=typeof n=="number"&&Number.isFinite(n)&&n>0&&n<=1?n:1;return Math.round(D0(e)*r*1e4)/1e4}const pK=.012,Qj=1e-4;function mK(e){return Math.min(1,D0(e)/I$)}function gK(e,t){const n=e*(D0(t)/T$);return Math.max(1e-4,n)}const yK=160,wK="agent-dag.soundLevel.done",vK="agent-dag.soundLevel.needs-input",xK="agent-dag.soundFigure.done",bK="agent-dag.soundFigure.needs-input",L$={done:wK,"needs-input":vK},cd={done:xK,"needs-input":bK},Ax={done:{level:Da,figure:vn},"needs-input":{level:Da,figure:vn}};function kK(e){const t=n=>({level:O$(e(L$[n])),figure:$$(n,e(cd[n]))});return{done:t("done"),"needs-input":t("needs-input")}}function NK(e,t){return(e??Ax)[t]??Ax[t]}const jK={Stop:"done",Notification:"needs-input"};function SK(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:It(jK,n)??null}const _K=6,EK="ccdeck-tabs";function CK(e){return e>=_K}function TK(e,t,n){const r=s=>{const i=s.data;(i==null?void 0:i.kind)==="who"&&i.from!==t&&e.postMessage({kind:"here",from:t,to:i.from,streaming:n()})};return e.addEventListener("message",r),{ask(s,i=(l,u)=>setTimeout(l,u)){return new Promise(l=>{const u=new Set,d=f=>{const h=f.data;(h==null?void 0:h.kind)==="here"&&h.to===t&&h.streaming&&u.add(h.from)};e.addEventListener("message",d),e.postMessage({kind:"who",from:t}),i(()=>{e.removeEventListener("message",d),l(u.size)},s)})},leave(){var s;e.removeEventListener("message",r),(s=e.close)==null||s.call(e)}}}function RK({stateRef:e,rerender:t,pauseGate:n,chimesRef:r,desktopUpdateRef:s}){const[i,l]=v.useState(!1),[u,d]=v.useState(!1),[f,h]=v.useState(!1),p=v.useRef(!0),[g,w]=v.useState(null);return v.useEffect(()=>{const k=new EventSource("/events"),x=VG(t,{now:()=>Date.now(),setTimeout:(_,E)=>window.setTimeout(_,E),clearTimeout:_=>window.clearTimeout(_)});let b=!1;const j=typeof BroadcastChannel=="function"?TK(new BroadcastChannel(EK),Math.random().toString(36).slice(2),()=>b):null,S=window.setInterval(()=>{b||!j||j.ask(600).then(_=>{b||d(CK(_))})},3e3);return k.addEventListener("open",()=>{l(!0),h(!0)}),k.addEventListener("error",()=>{l(!1),w(null)}),k.addEventListener("open",()=>{b=!0,d(!1)}),k.addEventListener("error",()=>{b=!1}),k.addEventListener("replay-end",()=>{p.current=!1,x.flush(),w(Date.now())}),k.addEventListener("desktop-update",_=>s.current(_.data)),k.addEventListener("hook",_=>{var E;try{const T=JSON.parse(_.data);if(!n.accept(T))return;e.current=D2(e.current,T);const R=T.replay===!0||p.current||Date.now()-T.receivedAt>3e4;R?x.replay():x.live();const A=SK(T,R);A&&((E=r.current)==null||E.play(A))}catch{}}),()=>{k.close(),x.cancel(),window.clearInterval(S),j==null||j.leave()}},[t]),{live:i,tabCapped:u,everConnected:f,liveSince:g}}const AK=200,MK=5*6e4,$K=6,IK=2*6e4;function ku(e,t){if(t.size!==0)for(const n of Array.from(e.keys()))t.has(n)||e.delete(n)}function OK(e,t){let n=!1;for(const s of e)if(!t.has(s)){n=!0;break}if(!n)return e;const r=new Set;for(const s of e)t.has(s)&&r.add(s);return r}function LK(e){const t=new Set;for(const n of e)t.add(n.id),t.add(`group:${n.sessionId}`),n.kind==="root"&&t.add(g0(n.id));return t}function PK(e){const t=new Set;for(const n of e)t.add(n.id),n.kind==="root"&&t.add(g0(n.id));return t}function DK(e,t){let n=fq(e,t,MN);pq(e,t,MN)&&(n=!0);const r=[],s=i=>{r.push(i)};return uq(e,t,AK,MK,s)&&(n=!0),dq(e,t,$K,IK,s)&&(n=!0),{changed:n,forgotten:r}}function FK(e,t,n){if(!n)return{ids:new Set([t]),primary:t};const r=new Set(e.ids);if(!r.has(t))return r.add(t),{ids:r,primary:t};if(r.delete(t),e.primary!==t)return{ids:r,primary:e.primary};let s=null;for(const i of r)s=i;return{ids:r,primary:s}}function qK(e,t){const[n,r]=v.useState(()=>({ids:new Set,primary:null})),{ids:s,primary:i}=n,l=v.useCallback((f,h,p=!h)=>{r(g=>FK(g,f,h)),!h&&p&&t(!0)},[]),u=v.useCallback(()=>{r({ids:new Set,primary:null})},[]),d=v.useCallback(()=>{r(f=>{const h=OK(f.ids,e.current.agents),p=f.primary!=null&&!e.current.agents.has(f.primary)?null:f.primary;return h===f.ids&&p===f.primary?f:{ids:h,primary:p}})},[e]);return{selectedIds:s,primarySelectedId:i,selectAgent:l,clearSelection:u,pruneSelectionToBoard:d}}function BK({stateRef:e,rerender:t,pruneSelectionToBoard:n,setContextFor:r,setSummaryFor:s}){const[i,l]=v.useState(Date.now());return v.useEffect(()=>{const u=setInterval(()=>{const d=Date.now();l(d);const{changed:f,forgotten:h}=DK(e.current,d);h.length>0&&fetch("/api/forget",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({ids:h})}).catch(()=>{}),n(),r(p=>p!=null&&!e.current.agents.has(p)?null:p),s(p=>p!=null&&!e.current.agents.has(p)?null:p),f&&t()},250);return()=>clearInterval(u)},[t]),i}function F0(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 mp,eS;function UK(){if(eS)return mp;eS=1;function e(){this.__data__=[],this.size=0}return mp=e,mp}var gp,tS;function di(){if(tS)return gp;tS=1;function e(t,n){return t===n||t!==t&&n!==n}return gp=e,gp}var yp,nS;function Bd(){if(nS)return yp;nS=1;var e=di();function t(n,r){for(var s=n.length;s--;)if(e(n[s][0],r))return s;return-1}return yp=t,yp}var wp,rS;function zK(){if(rS)return wp;rS=1;var e=Bd(),t=Array.prototype,n=t.splice;function r(s){var i=this.__data__,l=e(i,s);if(l<0)return!1;var u=i.length-1;return l==u?i.pop():n.call(i,l,1),--this.size,!0}return wp=r,wp}var vp,sS;function HK(){if(sS)return vp;sS=1;var e=Bd();function t(n){var r=this.__data__,s=e(r,n);return s<0?void 0:r[s][1]}return vp=t,vp}var xp,aS;function WK(){if(aS)return xp;aS=1;var e=Bd();function t(n){return e(this.__data__,n)>-1}return xp=t,xp}var bp,oS;function VK(){if(oS)return bp;oS=1;var e=Bd();function t(n,r){var s=this.__data__,i=e(s,n);return i<0?(++this.size,s.push([n,r])):s[i][1]=r,this}return bp=t,bp}var kp,iS;function Ud(){if(iS)return kp;iS=1;var e=UK(),t=zK(),n=HK(),r=WK(),s=VK();function i(l){var u=-1,d=l==null?0:l.length;for(this.clear();++u<d;){var f=l[u];this.set(f[0],f[1])}}return i.prototype.clear=e,i.prototype.delete=t,i.prototype.get=n,i.prototype.has=r,i.prototype.set=s,kp=i,kp}var Np,lS;function GK(){if(lS)return Np;lS=1;var e=Ud();function t(){this.__data__=new e,this.size=0}return Np=t,Np}var jp,cS;function KK(){if(cS)return jp;cS=1;function e(t){var n=this.__data__,r=n.delete(t);return this.size=n.size,r}return jp=e,jp}var Sp,uS;function YK(){if(uS)return Sp;uS=1;function e(t){return this.__data__.get(t)}return Sp=e,Sp}var _p,dS;function XK(){if(dS)return _p;dS=1;function e(t){return this.__data__.has(t)}return _p=e,_p}var Ep,hS;function P$(){if(hS)return Ep;hS=1;var e=typeof nu=="object"&&nu&&nu.Object===Object&νreturn Ep=e,Ep}var Cp,fS;function cr(){if(fS)return Cp;fS=1;var e=P$(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return Cp=n,Cp}var Tp,pS;function hi(){if(pS)return Tp;pS=1;var e=cr(),t=e.Symbol;return Tp=t,Tp}var Rp,mS;function ZK(){if(mS)return Rp;mS=1;var e=hi(),t=Object.prototype,n=t.hasOwnProperty,r=t.toString,s=e?e.toStringTag:void 0;function i(l){var u=n.call(l,s),d=l[s];try{l[s]=void 0;var f=!0}catch{}var h=r.call(l);return f&&(u?l[s]=d:delete l[s]),h}return Rp=i,Rp}var Ap,gS;function JK(){if(gS)return Ap;gS=1;var e=Object.prototype,t=e.toString;function n(r){return t.call(r)}return Ap=n,Ap}var Mp,yS;function Ua(){if(yS)return Mp;yS=1;var e=hi(),t=ZK(),n=JK(),r="[object Null]",s="[object Undefined]",i=e?e.toStringTag:void 0;function l(u){return u==null?u===void 0?s:r:i&&i in Object(u)?t(u):n(u)}return Mp=l,Mp}var $p,wS;function Fn(){if(wS)return $p;wS=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return $p=e,$p}var Ip,vS;function Vl(){if(vS)return Ip;vS=1;var e=Ua(),t=Fn(),n="[object AsyncFunction]",r="[object Function]",s="[object GeneratorFunction]",i="[object Proxy]";function l(u){if(!t(u))return!1;var d=e(u);return d==r||d==s||d==n||d==i}return Ip=l,Ip}var Op,xS;function QK(){if(xS)return Op;xS=1;var e=cr(),t=e["__core-js_shared__"];return Op=t,Op}var Lp,bS;function eY(){if(bS)return Lp;bS=1;var e=QK(),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 Lp=n,Lp}var Pp,kS;function D$(){if(kS)return Pp;kS=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 Pp=n,Pp}var Dp,NS;function tY(){if(NS)return Dp;NS=1;var e=Vl(),t=eY(),n=Fn(),r=D$(),s=/[\\^$.*+?()[\]{}|]/g,i=/^\[object .+?Constructor\]$/,l=Function.prototype,u=Object.prototype,d=l.toString,f=u.hasOwnProperty,h=RegExp("^"+d.call(f).replace(s,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function p(g){if(!n(g)||t(g))return!1;var w=e(g)?h:i;return w.test(r(g))}return Dp=p,Dp}var Fp,jS;function nY(){if(jS)return Fp;jS=1;function e(t,n){return t==null?void 0:t[n]}return Fp=e,Fp}var qp,SS;function za(){if(SS)return qp;SS=1;var e=tY(),t=nY();function n(r,s){var i=t(r,s);return e(i)?i:void 0}return qp=n,qp}var Bp,_S;function q0(){if(_S)return Bp;_S=1;var e=za(),t=cr(),n=e(t,"Map");return Bp=n,Bp}var Up,ES;function zd(){if(ES)return Up;ES=1;var e=za(),t=e(Object,"create");return Up=t,Up}var zp,CS;function rY(){if(CS)return zp;CS=1;var e=zd();function t(){this.__data__=e?e(null):{},this.size=0}return zp=t,zp}var Hp,TS;function sY(){if(TS)return Hp;TS=1;function e(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}return Hp=e,Hp}var Wp,RS;function aY(){if(RS)return Wp;RS=1;var e=zd(),t="__lodash_hash_undefined__",n=Object.prototype,r=n.hasOwnProperty;function s(i){var l=this.__data__;if(e){var u=l[i];return u===t?void 0:u}return r.call(l,i)?l[i]:void 0}return Wp=s,Wp}var Vp,AS;function oY(){if(AS)return Vp;AS=1;var e=zd(),t=Object.prototype,n=t.hasOwnProperty;function r(s){var i=this.__data__;return e?i[s]!==void 0:n.call(i,s)}return Vp=r,Vp}var Gp,MS;function iY(){if(MS)return Gp;MS=1;var e=zd(),t="__lodash_hash_undefined__";function n(r,s){var i=this.__data__;return this.size+=this.has(r)?0:1,i[r]=e&&s===void 0?t:s,this}return Gp=n,Gp}var Kp,$S;function lY(){if($S)return Kp;$S=1;var e=rY(),t=sY(),n=aY(),r=oY(),s=iY();function i(l){var u=-1,d=l==null?0:l.length;for(this.clear();++u<d;){var f=l[u];this.set(f[0],f[1])}}return i.prototype.clear=e,i.prototype.delete=t,i.prototype.get=n,i.prototype.has=r,i.prototype.set=s,Kp=i,Kp}var Yp,IS;function cY(){if(IS)return Yp;IS=1;var e=lY(),t=Ud(),n=q0();function r(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return Yp=r,Yp}var Xp,OS;function uY(){if(OS)return Xp;OS=1;function e(t){var n=typeof t;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?t!=="__proto__":t===null}return Xp=e,Xp}var Zp,LS;function Hd(){if(LS)return Zp;LS=1;var e=uY();function t(n,r){var s=n.__data__;return e(r)?s[typeof r=="string"?"string":"hash"]:s.map}return Zp=t,Zp}var Jp,PS;function dY(){if(PS)return Jp;PS=1;var e=Hd();function t(n){var r=e(this,n).delete(n);return this.size-=r?1:0,r}return Jp=t,Jp}var Qp,DS;function hY(){if(DS)return Qp;DS=1;var e=Hd();function t(n){return e(this,n).get(n)}return Qp=t,Qp}var em,FS;function fY(){if(FS)return em;FS=1;var e=Hd();function t(n){return e(this,n).has(n)}return em=t,em}var tm,qS;function pY(){if(qS)return tm;qS=1;var e=Hd();function t(n,r){var s=e(this,n),i=s.size;return s.set(n,r),this.size+=s.size==i?0:1,this}return tm=t,tm}var nm,BS;function B0(){if(BS)return nm;BS=1;var e=cY(),t=dY(),n=hY(),r=fY(),s=pY();function i(l){var u=-1,d=l==null?0:l.length;for(this.clear();++u<d;){var f=l[u];this.set(f[0],f[1])}}return i.prototype.clear=e,i.prototype.delete=t,i.prototype.get=n,i.prototype.has=r,i.prototype.set=s,nm=i,nm}var rm,US;function mY(){if(US)return rm;US=1;var e=Ud(),t=q0(),n=B0(),r=200;function s(i,l){var u=this.__data__;if(u instanceof e){var d=u.__data__;if(!t||d.length<r-1)return d.push([i,l]),this.size=++u.size,this;u=this.__data__=new n(d)}return u.set(i,l),this.size=u.size,this}return rm=s,rm}var sm,zS;function Wd(){if(zS)return sm;zS=1;var e=Ud(),t=GK(),n=KK(),r=YK(),s=XK(),i=mY();function l(u){var d=this.__data__=new e(u);this.size=d.size}return l.prototype.clear=t,l.prototype.delete=n,l.prototype.get=r,l.prototype.has=s,l.prototype.set=i,sm=l,sm}var am,HS;function U0(){if(HS)return am;HS=1;function e(t,n){for(var r=-1,s=t==null?0:t.length;++r<s&&n(t[r],r,t)!==!1;);return t}return am=e,am}var om,WS;function F$(){if(WS)return om;WS=1;var e=za(),t=(function(){try{var n=e(Object,"defineProperty");return n({},"",{}),n}catch{}})();return om=t,om}var im,VS;function Vd(){if(VS)return im;VS=1;var e=F$();function t(n,r,s){r=="__proto__"&&e?e(n,r,{configurable:!0,enumerable:!0,value:s,writable:!0}):n[r]=s}return im=t,im}var lm,GS;function Gd(){if(GS)return lm;GS=1;var e=Vd(),t=di(),n=Object.prototype,r=n.hasOwnProperty;function s(i,l,u){var d=i[l];(!(r.call(i,l)&&t(d,u))||u===void 0&&!(l in i))&&e(i,l,u)}return lm=s,lm}var cm,KS;function Gl(){if(KS)return cm;KS=1;var e=Gd(),t=Vd();function n(r,s,i,l){var u=!i;i||(i={});for(var d=-1,f=s.length;++d<f;){var h=s[d],p=l?l(i[h],r[h],h,i,r):void 0;p===void 0&&(p=r[h]),u?t(i,h,p):e(i,h,p)}return i}return cm=n,cm}var um,YS;function gY(){if(YS)return um;YS=1;function e(t,n){for(var r=-1,s=Array(t);++r<t;)s[r]=n(r);return s}return um=e,um}var dm,XS;function Mr(){if(XS)return dm;XS=1;function e(t){return t!=null&&typeof t=="object"}return dm=e,dm}var hm,ZS;function yY(){if(ZS)return hm;ZS=1;var e=Ua(),t=Mr(),n="[object Arguments]";function r(s){return t(s)&&e(s)==n}return hm=r,hm}var fm,JS;function Kl(){if(JS)return fm;JS=1;var e=yY(),t=Mr(),n=Object.prototype,r=n.hasOwnProperty,s=n.propertyIsEnumerable,i=e((function(){return arguments})())?e:function(l){return t(l)&&r.call(l,"callee")&&!s.call(l,"callee")};return fm=i,fm}var pm,QS;function bt(){if(QS)return pm;QS=1;var e=Array.isArray;return pm=e,pm}var il={exports:{}},mm,e_;function wY(){if(e_)return mm;e_=1;function e(){return!1}return mm=e,mm}il.exports;var t_;function fi(){return t_||(t_=1,(function(e,t){var n=cr(),r=wY(),s=t&&!t.nodeType&&t,i=s&&!0&&e&&!e.nodeType&&e,l=i&&i.exports===s,u=l?n.Buffer:void 0,d=u?u.isBuffer:void 0,f=d||r;e.exports=f})(il,il.exports)),il.exports}var gm,n_;function Kd(){if(n_)return gm;n_=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function n(r,s){var i=typeof r;return s=s??e,!!s&&(i=="number"||i!="symbol"&&t.test(r))&&r>-1&&r%1==0&&r<s}return gm=n,gm}var ym,r_;function z0(){if(r_)return ym;r_=1;var e=9007199254740991;function t(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=e}return ym=t,ym}var wm,s_;function vY(){if(s_)return wm;s_=1;var e=Ua(),t=z0(),n=Mr(),r="[object Arguments]",s="[object Array]",i="[object Boolean]",l="[object Date]",u="[object Error]",d="[object Function]",f="[object Map]",h="[object Number]",p="[object Object]",g="[object RegExp]",w="[object Set]",k="[object String]",x="[object WeakMap]",b="[object ArrayBuffer]",j="[object DataView]",S="[object Float32Array]",_="[object Float64Array]",E="[object Int8Array]",T="[object Int16Array]",R="[object Int32Array]",A="[object Uint8Array]",U="[object Uint8ClampedArray]",I="[object Uint16Array]",q="[object Uint32Array]",P={};P[S]=P[_]=P[E]=P[T]=P[R]=P[A]=P[U]=P[I]=P[q]=!0,P[r]=P[s]=P[b]=P[i]=P[j]=P[l]=P[u]=P[d]=P[f]=P[h]=P[p]=P[g]=P[w]=P[k]=P[x]=!1;function O(V){return n(V)&&t(V.length)&&!!P[e(V)]}return wm=O,wm}var vm,a_;function Yd(){if(a_)return vm;a_=1;function e(t){return function(n){return t(n)}}return vm=e,vm}var ll={exports:{}};ll.exports;var o_;function H0(){return o_||(o_=1,(function(e,t){var n=P$(),r=t&&!t.nodeType&&t,s=r&&!0&&e&&!e.nodeType&&e,i=s&&s.exports===r,l=i&&n.process,u=(function(){try{var d=s&&s.require&&s.require("util").types;return d||l&&l.binding&&l.binding("util")}catch{}})();e.exports=u})(ll,ll.exports)),ll.exports}var xm,i_;function Yl(){if(i_)return xm;i_=1;var e=vY(),t=Yd(),n=H0(),r=n&&n.isTypedArray,s=r?t(r):e;return xm=s,xm}var bm,l_;function q$(){if(l_)return bm;l_=1;var e=gY(),t=Kl(),n=bt(),r=fi(),s=Kd(),i=Yl(),l=Object.prototype,u=l.hasOwnProperty;function d(f,h){var p=n(f),g=!p&&t(f),w=!p&&!g&&r(f),k=!p&&!g&&!w&&i(f),x=p||g||w||k,b=x?e(f.length,String):[],j=b.length;for(var S in f)(h||u.call(f,S))&&!(x&&(S=="length"||w&&(S=="offset"||S=="parent")||k&&(S=="buffer"||S=="byteLength"||S=="byteOffset")||s(S,j)))&&b.push(S);return b}return bm=d,bm}var km,c_;function Xd(){if(c_)return km;c_=1;var e=Object.prototype;function t(n){var r=n&&n.constructor,s=typeof r=="function"&&r.prototype||e;return n===s}return km=t,km}var Nm,u_;function B$(){if(u_)return Nm;u_=1;function e(t,n){return function(r){return t(n(r))}}return Nm=e,Nm}var jm,d_;function xY(){if(d_)return jm;d_=1;var e=B$(),t=e(Object.keys,Object);return jm=t,jm}var Sm,h_;function W0(){if(h_)return Sm;h_=1;var e=Xd(),t=xY(),n=Object.prototype,r=n.hasOwnProperty;function s(i){if(!e(i))return t(i);var l=[];for(var u in Object(i))r.call(i,u)&&u!="constructor"&&l.push(u);return l}return Sm=s,Sm}var _m,f_;function rs(){if(f_)return _m;f_=1;var e=Vl(),t=z0();function n(r){return r!=null&&t(r.length)&&!e(r)}return _m=n,_m}var Em,p_;function Ys(){if(p_)return Em;p_=1;var e=q$(),t=W0(),n=rs();function r(s){return n(s)?e(s):t(s)}return Em=r,Em}var Cm,m_;function bY(){if(m_)return Cm;m_=1;var e=Gl(),t=Ys();function n(r,s){return r&&e(s,t(s),r)}return Cm=n,Cm}var Tm,g_;function kY(){if(g_)return Tm;g_=1;function e(t){var n=[];if(t!=null)for(var r in Object(t))n.push(r);return n}return Tm=e,Tm}var Rm,y_;function NY(){if(y_)return Rm;y_=1;var e=Fn(),t=Xd(),n=kY(),r=Object.prototype,s=r.hasOwnProperty;function i(l){if(!e(l))return n(l);var u=t(l),d=[];for(var f in l)f=="constructor"&&(u||!s.call(l,f))||d.push(f);return d}return Rm=i,Rm}var Am,w_;function Ha(){if(w_)return Am;w_=1;var e=q$(),t=NY(),n=rs();function r(s){return n(s)?e(s,!0):t(s)}return Am=r,Am}var Mm,v_;function jY(){if(v_)return Mm;v_=1;var e=Gl(),t=Ha();function n(r,s){return r&&e(s,t(s),r)}return Mm=n,Mm}var cl={exports:{}};cl.exports;var x_;function U$(){return x_||(x_=1,(function(e,t){var n=cr(),r=t&&!t.nodeType&&t,s=r&&!0&&e&&!e.nodeType&&e,i=s&&s.exports===r,l=i?n.Buffer:void 0,u=l?l.allocUnsafe:void 0;function d(f,h){if(h)return f.slice();var p=f.length,g=u?u(p):new f.constructor(p);return f.copy(g),g}e.exports=d})(cl,cl.exports)),cl.exports}var $m,b_;function z$(){if(b_)return $m;b_=1;function e(t,n){var r=-1,s=t.length;for(n||(n=Array(s));++r<s;)n[r]=t[r];return n}return $m=e,$m}var Im,k_;function H$(){if(k_)return Im;k_=1;function e(t,n){for(var r=-1,s=t==null?0:t.length,i=0,l=[];++r<s;){var u=t[r];n(u,r,t)&&(l[i++]=u)}return l}return Im=e,Im}var Om,N_;function W$(){if(N_)return Om;N_=1;function e(){return[]}return Om=e,Om}var Lm,j_;function V0(){if(j_)return Lm;j_=1;var e=H$(),t=W$(),n=Object.prototype,r=n.propertyIsEnumerable,s=Object.getOwnPropertySymbols,i=s?function(l){return l==null?[]:(l=Object(l),e(s(l),function(u){return r.call(l,u)}))}:t;return Lm=i,Lm}var Pm,S_;function SY(){if(S_)return Pm;S_=1;var e=Gl(),t=V0();function n(r,s){return e(r,t(r),s)}return Pm=n,Pm}var Dm,__;function G0(){if(__)return Dm;__=1;function e(t,n){for(var r=-1,s=n.length,i=t.length;++r<s;)t[i+r]=n[r];return t}return Dm=e,Dm}var Fm,E_;function Zd(){if(E_)return Fm;E_=1;var e=B$(),t=e(Object.getPrototypeOf,Object);return Fm=t,Fm}var qm,C_;function V$(){if(C_)return qm;C_=1;var e=G0(),t=Zd(),n=V0(),r=W$(),s=Object.getOwnPropertySymbols,i=s?function(l){for(var u=[];l;)e(u,n(l)),l=t(l);return u}:r;return qm=i,qm}var Bm,T_;function _Y(){if(T_)return Bm;T_=1;var e=Gl(),t=V$();function n(r,s){return e(r,t(r),s)}return Bm=n,Bm}var Um,R_;function G$(){if(R_)return Um;R_=1;var e=G0(),t=bt();function n(r,s,i){var l=s(r);return t(r)?l:e(l,i(r))}return Um=n,Um}var zm,A_;function K$(){if(A_)return zm;A_=1;var e=G$(),t=V0(),n=Ys();function r(s){return e(s,n,t)}return zm=r,zm}var Hm,M_;function EY(){if(M_)return Hm;M_=1;var e=G$(),t=V$(),n=Ha();function r(s){return e(s,n,t)}return Hm=r,Hm}var Wm,$_;function CY(){if($_)return Wm;$_=1;var e=za(),t=cr(),n=e(t,"DataView");return Wm=n,Wm}var Vm,I_;function TY(){if(I_)return Vm;I_=1;var e=za(),t=cr(),n=e(t,"Promise");return Vm=n,Vm}var Gm,O_;function Y$(){if(O_)return Gm;O_=1;var e=za(),t=cr(),n=e(t,"Set");return Gm=n,Gm}var Km,L_;function RY(){if(L_)return Km;L_=1;var e=za(),t=cr(),n=e(t,"WeakMap");return Km=n,Km}var Ym,P_;function pi(){if(P_)return Ym;P_=1;var e=CY(),t=q0(),n=TY(),r=Y$(),s=RY(),i=Ua(),l=D$(),u="[object Map]",d="[object Object]",f="[object Promise]",h="[object Set]",p="[object WeakMap]",g="[object DataView]",w=l(e),k=l(t),x=l(n),b=l(r),j=l(s),S=i;return(e&&S(new e(new ArrayBuffer(1)))!=g||t&&S(new t)!=u||n&&S(n.resolve())!=f||r&&S(new r)!=h||s&&S(new s)!=p)&&(S=function(_){var E=i(_),T=E==d?_.constructor:void 0,R=T?l(T):"";if(R)switch(R){case w:return g;case k:return u;case x:return f;case b:return h;case j:return p}return E}),Ym=S,Ym}var Xm,D_;function AY(){if(D_)return Xm;D_=1;var e=Object.prototype,t=e.hasOwnProperty;function n(r){var s=r.length,i=new r.constructor(s);return s&&typeof r[0]=="string"&&t.call(r,"index")&&(i.index=r.index,i.input=r.input),i}return Xm=n,Xm}var Zm,F_;function X$(){if(F_)return Zm;F_=1;var e=cr(),t=e.Uint8Array;return Zm=t,Zm}var Jm,q_;function K0(){if(q_)return Jm;q_=1;var e=X$();function t(n){var r=new n.constructor(n.byteLength);return new e(r).set(new e(n)),r}return Jm=t,Jm}var Qm,B_;function MY(){if(B_)return Qm;B_=1;var e=K0();function t(n,r){var s=r?e(n.buffer):n.buffer;return new n.constructor(s,n.byteOffset,n.byteLength)}return Qm=t,Qm}var eg,U_;function $Y(){if(U_)return eg;U_=1;var e=/\w*$/;function t(n){var r=new n.constructor(n.source,e.exec(n));return r.lastIndex=n.lastIndex,r}return eg=t,eg}var tg,z_;function IY(){if(z_)return tg;z_=1;var e=hi(),t=e?e.prototype:void 0,n=t?t.valueOf:void 0;function r(s){return n?Object(n.call(s)):{}}return tg=r,tg}var ng,H_;function Z$(){if(H_)return ng;H_=1;var e=K0();function t(n,r){var s=r?e(n.buffer):n.buffer;return new n.constructor(s,n.byteOffset,n.length)}return ng=t,ng}var rg,W_;function OY(){if(W_)return rg;W_=1;var e=K0(),t=MY(),n=$Y(),r=IY(),s=Z$(),i="[object Boolean]",l="[object Date]",u="[object Map]",d="[object Number]",f="[object RegExp]",h="[object Set]",p="[object String]",g="[object Symbol]",w="[object ArrayBuffer]",k="[object DataView]",x="[object Float32Array]",b="[object Float64Array]",j="[object Int8Array]",S="[object Int16Array]",_="[object Int32Array]",E="[object Uint8Array]",T="[object Uint8ClampedArray]",R="[object Uint16Array]",A="[object Uint32Array]";function U(I,q,P){var O=I.constructor;switch(q){case w:return e(I);case i:case l:return new O(+I);case k:return t(I,P);case x:case b:case j:case S:case _:case E:case T:case R:case A:return s(I,P);case u:return new O;case d:case p:return new O(I);case f:return n(I);case h:return new O;case g:return r(I)}}return rg=U,rg}var sg,V_;function J$(){if(V_)return sg;V_=1;var e=Fn(),t=Object.create,n=(function(){function r(){}return function(s){if(!e(s))return{};if(t)return t(s);r.prototype=s;var i=new r;return r.prototype=void 0,i}})();return sg=n,sg}var ag,G_;function Q$(){if(G_)return ag;G_=1;var e=J$(),t=Zd(),n=Xd();function r(s){return typeof s.constructor=="function"&&!n(s)?e(t(s)):{}}return ag=r,ag}var og,K_;function LY(){if(K_)return og;K_=1;var e=pi(),t=Mr(),n="[object Map]";function r(s){return t(s)&&e(s)==n}return og=r,og}var ig,Y_;function PY(){if(Y_)return ig;Y_=1;var e=LY(),t=Yd(),n=H0(),r=n&&n.isMap,s=r?t(r):e;return ig=s,ig}var lg,X_;function DY(){if(X_)return lg;X_=1;var e=pi(),t=Mr(),n="[object Set]";function r(s){return t(s)&&e(s)==n}return lg=r,lg}var cg,Z_;function FY(){if(Z_)return cg;Z_=1;var e=DY(),t=Yd(),n=H0(),r=n&&n.isSet,s=r?t(r):e;return cg=s,cg}var ug,J_;function eI(){if(J_)return ug;J_=1;var e=Wd(),t=U0(),n=Gd(),r=bY(),s=jY(),i=U$(),l=z$(),u=SY(),d=_Y(),f=K$(),h=EY(),p=pi(),g=AY(),w=OY(),k=Q$(),x=bt(),b=fi(),j=PY(),S=Fn(),_=FY(),E=Ys(),T=Ha(),R=1,A=2,U=4,I="[object Arguments]",q="[object Array]",P="[object Boolean]",O="[object Date]",V="[object Error]",$="[object Function]",M="[object GeneratorFunction]",L="[object Map]",Y="[object Number]",K="[object Object]",D="[object RegExp]",z="[object Set]",F="[object String]",H="[object Symbol]",J="[object WeakMap]",W="[object ArrayBuffer]",G="[object DataView]",X="[object Float32Array]",Z="[object Float64Array]",ee="[object Int8Array]",re="[object Int16Array]",ce="[object Int32Array]",ie="[object Uint8Array]",fe="[object Uint8ClampedArray]",de="[object Uint16Array]",we="[object Uint32Array]",xe={};xe[I]=xe[q]=xe[W]=xe[G]=xe[P]=xe[O]=xe[X]=xe[Z]=xe[ee]=xe[re]=xe[ce]=xe[L]=xe[Y]=xe[K]=xe[D]=xe[z]=xe[F]=xe[H]=xe[ie]=xe[fe]=xe[de]=xe[we]=!0,xe[V]=xe[$]=xe[J]=!1;function $e(be,he,se,ke,Ce,Oe){var Le,Pe=he&R,qe=he&A,Ue=he&U;if(se&&(Le=Ce?se(be,ke,Ce,Oe):se(be)),Le!==void 0)return Le;if(!S(be))return be;var et=x(be);if(et){if(Le=g(be),!Pe)return l(be,Le)}else{var ze=p(be),at=ze==$||ze==M;if(b(be))return i(be,Pe);if(ze==K||ze==I||at&&!Ce){if(Le=qe||at?{}:k(be),!Pe)return qe?d(be,s(Le,be)):u(be,r(Le,be))}else{if(!xe[ze])return Ce?be:{};Le=w(be,ze,Pe)}}Oe||(Oe=new e);var gt=Oe.get(be);if(gt)return gt;Oe.set(be,Le),_(be)?be.forEach(function(Je){Le.add($e(Je,he,se,Je,be,Oe))}):j(be)&&be.forEach(function(Je,it){Le.set(it,$e(Je,he,se,it,be,Oe))});var Ie=Ue?qe?h:f:qe?T:E,ot=et?void 0:Ie(be);return t(ot||be,function(Je,it){ot&&(it=Je,Je=be[it]),n(Le,it,$e(Je,he,se,it,be,Oe))}),Le}return ug=$e,ug}var dg,Q_;function qY(){if(Q_)return dg;Q_=1;var e=eI(),t=4;function n(r){return e(r,t)}return dg=n,dg}var hg,eE;function Y0(){if(eE)return hg;eE=1;function e(t){return function(){return t}}return hg=e,hg}var fg,tE;function BY(){if(tE)return fg;tE=1;function e(t){return function(n,r,s){for(var i=-1,l=Object(n),u=s(n),d=u.length;d--;){var f=u[t?d:++i];if(r(l[f],f,l)===!1)break}return n}}return fg=e,fg}var pg,nE;function X0(){if(nE)return pg;nE=1;var e=BY(),t=e();return pg=t,pg}var mg,rE;function Z0(){if(rE)return mg;rE=1;var e=X0(),t=Ys();function n(r,s){return r&&e(r,s,t)}return mg=n,mg}var gg,sE;function UY(){if(sE)return gg;sE=1;var e=rs();function t(n,r){return function(s,i){if(s==null)return s;if(!e(s))return n(s,i);for(var l=s.length,u=r?l:-1,d=Object(s);(r?u--:++u<l)&&i(d[u],u,d)!==!1;);return s}}return gg=t,gg}var yg,aE;function Jd(){if(aE)return yg;aE=1;var e=Z0(),t=UY(),n=t(e);return yg=n,yg}var wg,oE;function Wa(){if(oE)return wg;oE=1;function e(t){return t}return wg=e,wg}var vg,iE;function tI(){if(iE)return vg;iE=1;var e=Wa();function t(n){return typeof n=="function"?n:e}return vg=t,vg}var xg,lE;function nI(){if(lE)return xg;lE=1;var e=U0(),t=Jd(),n=tI(),r=bt();function s(i,l){var u=r(i)?e:t;return u(i,n(l))}return xg=s,xg}var bg,cE;function rI(){return cE||(cE=1,bg=nI()),bg}var kg,uE;function zY(){if(uE)return kg;uE=1;var e=Jd();function t(n,r){var s=[];return e(n,function(i,l,u){r(i,l,u)&&s.push(i)}),s}return kg=t,kg}var Ng,dE;function HY(){if(dE)return Ng;dE=1;var e="__lodash_hash_undefined__";function t(n){return this.__data__.set(n,e),this}return Ng=t,Ng}var jg,hE;function WY(){if(hE)return jg;hE=1;function e(t){return this.__data__.has(t)}return jg=e,jg}var Sg,fE;function sI(){if(fE)return Sg;fE=1;var e=B0(),t=HY(),n=WY();function r(s){var i=-1,l=s==null?0:s.length;for(this.__data__=new e;++i<l;)this.add(s[i])}return r.prototype.add=r.prototype.push=t,r.prototype.has=n,Sg=r,Sg}var _g,pE;function VY(){if(pE)return _g;pE=1;function e(t,n){for(var r=-1,s=t==null?0:t.length;++r<s;)if(n(t[r],r,t))return!0;return!1}return _g=e,_g}var Eg,mE;function aI(){if(mE)return Eg;mE=1;function e(t,n){return t.has(n)}return Eg=e,Eg}var Cg,gE;function oI(){if(gE)return Cg;gE=1;var e=sI(),t=VY(),n=aI(),r=1,s=2;function i(l,u,d,f,h,p){var g=d&r,w=l.length,k=u.length;if(w!=k&&!(g&&k>w))return!1;var x=p.get(l),b=p.get(u);if(x&&b)return x==u&&b==l;var j=-1,S=!0,_=d&s?new e:void 0;for(p.set(l,u),p.set(u,l);++j<w;){var E=l[j],T=u[j];if(f)var R=g?f(T,E,j,u,l,p):f(E,T,j,l,u,p);if(R!==void 0){if(R)continue;S=!1;break}if(_){if(!t(u,function(A,U){if(!n(_,U)&&(E===A||h(E,A,d,f,p)))return _.push(U)})){S=!1;break}}else if(!(E===T||h(E,T,d,f,p))){S=!1;break}}return p.delete(l),p.delete(u),S}return Cg=i,Cg}var Tg,yE;function GY(){if(yE)return Tg;yE=1;function e(t){var n=-1,r=Array(t.size);return t.forEach(function(s,i){r[++n]=[i,s]}),r}return Tg=e,Tg}var Rg,wE;function J0(){if(wE)return Rg;wE=1;function e(t){var n=-1,r=Array(t.size);return t.forEach(function(s){r[++n]=s}),r}return Rg=e,Rg}var Ag,vE;function KY(){if(vE)return Ag;vE=1;var e=hi(),t=X$(),n=di(),r=oI(),s=GY(),i=J0(),l=1,u=2,d="[object Boolean]",f="[object Date]",h="[object Error]",p="[object Map]",g="[object Number]",w="[object RegExp]",k="[object Set]",x="[object String]",b="[object Symbol]",j="[object ArrayBuffer]",S="[object DataView]",_=e?e.prototype:void 0,E=_?_.valueOf:void 0;function T(R,A,U,I,q,P,O){switch(U){case S:if(R.byteLength!=A.byteLength||R.byteOffset!=A.byteOffset)return!1;R=R.buffer,A=A.buffer;case j:return!(R.byteLength!=A.byteLength||!P(new t(R),new t(A)));case d:case f:case g:return n(+R,+A);case h:return R.name==A.name&&R.message==A.message;case w:case x:return R==A+"";case p:var V=s;case k:var $=I&l;if(V||(V=i),R.size!=A.size&&!$)return!1;var M=O.get(R);if(M)return M==A;I|=u,O.set(R,A);var L=r(V(R),V(A),I,q,P,O);return O.delete(R),L;case b:if(E)return E.call(R)==E.call(A)}return!1}return Ag=T,Ag}var Mg,xE;function YY(){if(xE)return Mg;xE=1;var e=K$(),t=1,n=Object.prototype,r=n.hasOwnProperty;function s(i,l,u,d,f,h){var p=u&t,g=e(i),w=g.length,k=e(l),x=k.length;if(w!=x&&!p)return!1;for(var b=w;b--;){var j=g[b];if(!(p?j in l:r.call(l,j)))return!1}var S=h.get(i),_=h.get(l);if(S&&_)return S==l&&_==i;var E=!0;h.set(i,l),h.set(l,i);for(var T=p;++b<w;){j=g[b];var R=i[j],A=l[j];if(d)var U=p?d(A,R,j,l,i,h):d(R,A,j,i,l,h);if(!(U===void 0?R===A||f(R,A,u,d,h):U)){E=!1;break}T||(T=j=="constructor")}if(E&&!T){var I=i.constructor,q=l.constructor;I!=q&&"constructor"in i&&"constructor"in l&&!(typeof I=="function"&&I instanceof I&&typeof q=="function"&&q instanceof q)&&(E=!1)}return h.delete(i),h.delete(l),E}return Mg=s,Mg}var $g,bE;function XY(){if(bE)return $g;bE=1;var e=Wd(),t=oI(),n=KY(),r=YY(),s=pi(),i=bt(),l=fi(),u=Yl(),d=1,f="[object Arguments]",h="[object Array]",p="[object Object]",g=Object.prototype,w=g.hasOwnProperty;function k(x,b,j,S,_,E){var T=i(x),R=i(b),A=T?h:s(x),U=R?h:s(b);A=A==f?p:A,U=U==f?p:U;var I=A==p,q=U==p,P=A==U;if(P&&l(x)){if(!l(b))return!1;T=!0,I=!1}if(P&&!I)return E||(E=new e),T||u(x)?t(x,b,j,S,_,E):n(x,b,A,j,S,_,E);if(!(j&d)){var O=I&&w.call(x,"__wrapped__"),V=q&&w.call(b,"__wrapped__");if(O||V){var $=O?x.value():x,M=V?b.value():b;return E||(E=new e),_($,M,j,S,E)}}return P?(E||(E=new e),r(x,b,j,S,_,E)):!1}return $g=k,$g}var Ig,kE;function iI(){if(kE)return Ig;kE=1;var e=XY(),t=Mr();function n(r,s,i,l,u){return r===s?!0:r==null||s==null||!t(r)&&!t(s)?r!==r&&s!==s:e(r,s,i,l,n,u)}return Ig=n,Ig}var Og,NE;function ZY(){if(NE)return Og;NE=1;var e=Wd(),t=iI(),n=1,r=2;function s(i,l,u,d){var f=u.length,h=f,p=!d;if(i==null)return!h;for(i=Object(i);f--;){var g=u[f];if(p&&g[2]?g[1]!==i[g[0]]:!(g[0]in i))return!1}for(;++f<h;){g=u[f];var w=g[0],k=i[w],x=g[1];if(p&&g[2]){if(k===void 0&&!(w in i))return!1}else{var b=new e;if(d)var j=d(k,x,w,i,l,b);if(!(j===void 0?t(x,k,n|r,d,b):j))return!1}}return!0}return Og=s,Og}var Lg,jE;function lI(){if(jE)return Lg;jE=1;var e=Fn();function t(n){return n===n&&!e(n)}return Lg=t,Lg}var Pg,SE;function JY(){if(SE)return Pg;SE=1;var e=lI(),t=Ys();function n(r){for(var s=t(r),i=s.length;i--;){var l=s[i],u=r[l];s[i]=[l,u,e(u)]}return s}return Pg=n,Pg}var Dg,_E;function cI(){if(_E)return Dg;_E=1;function e(t,n){return function(r){return r==null?!1:r[t]===n&&(n!==void 0||t in Object(r))}}return Dg=e,Dg}var Fg,EE;function QY(){if(EE)return Fg;EE=1;var e=ZY(),t=JY(),n=cI();function r(s){var i=t(s);return i.length==1&&i[0][2]?n(i[0][0],i[0][1]):function(l){return l===s||e(l,s,i)}}return Fg=r,Fg}var qg,CE;function mi(){if(CE)return qg;CE=1;var e=Ua(),t=Mr(),n="[object Symbol]";function r(s){return typeof s=="symbol"||t(s)&&e(s)==n}return qg=r,qg}var Bg,TE;function Q0(){if(TE)return Bg;TE=1;var e=bt(),t=mi(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;function s(i,l){if(e(i))return!1;var u=typeof i;return u=="number"||u=="symbol"||u=="boolean"||i==null||t(i)?!0:r.test(i)||!n.test(i)||l!=null&&i in Object(l)}return Bg=s,Bg}var Ug,RE;function eX(){if(RE)return Ug;RE=1;var e=B0(),t="Expected a function";function n(r,s){if(typeof r!="function"||s!=null&&typeof s!="function")throw new TypeError(t);var i=function(){var l=arguments,u=s?s.apply(this,l):l[0],d=i.cache;if(d.has(u))return d.get(u);var f=r.apply(this,l);return i.cache=d.set(u,f)||d,f};return i.cache=new(n.Cache||e),i}return n.Cache=e,Ug=n,Ug}var zg,AE;function tX(){if(AE)return zg;AE=1;var e=eX(),t=500;function n(r){var s=e(r,function(l){return i.size===t&&i.clear(),l}),i=s.cache;return s}return zg=n,zg}var Hg,ME;function nX(){if(ME)return Hg;ME=1;var e=tX(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g,r=e(function(s){var i=[];return s.charCodeAt(0)===46&&i.push(""),s.replace(t,function(l,u,d,f){i.push(d?f.replace(n,"$1"):u||l)}),i});return Hg=r,Hg}var Wg,$E;function Qd(){if($E)return Wg;$E=1;function e(t,n){for(var r=-1,s=t==null?0:t.length,i=Array(s);++r<s;)i[r]=n(t[r],r,t);return i}return Wg=e,Wg}var Vg,IE;function rX(){if(IE)return Vg;IE=1;var e=hi(),t=Qd(),n=bt(),r=mi(),s=e?e.prototype:void 0,i=s?s.toString:void 0;function l(u){if(typeof u=="string")return u;if(n(u))return t(u,l)+"";if(r(u))return i?i.call(u):"";var d=u+"";return d=="0"&&1/u==-1/0?"-0":d}return Vg=l,Vg}var Gg,OE;function uI(){if(OE)return Gg;OE=1;var e=rX();function t(n){return n==null?"":e(n)}return Gg=t,Gg}var Kg,LE;function eh(){if(LE)return Kg;LE=1;var e=bt(),t=Q0(),n=nX(),r=uI();function s(i,l){return e(i)?i:t(i,l)?[i]:n(r(i))}return Kg=s,Kg}var Yg,PE;function Xl(){if(PE)return Yg;PE=1;var e=mi();function t(n){if(typeof n=="string"||e(n))return n;var r=n+"";return r=="0"&&1/n==-1/0?"-0":r}return Yg=t,Yg}var Xg,DE;function th(){if(DE)return Xg;DE=1;var e=eh(),t=Xl();function n(r,s){s=e(s,r);for(var i=0,l=s.length;r!=null&&i<l;)r=r[t(s[i++])];return i&&i==l?r:void 0}return Xg=n,Xg}var Zg,FE;function sX(){if(FE)return Zg;FE=1;var e=th();function t(n,r,s){var i=n==null?void 0:e(n,r);return i===void 0?s:i}return Zg=t,Zg}var Jg,qE;function aX(){if(qE)return Jg;qE=1;function e(t,n){return t!=null&&n in Object(t)}return Jg=e,Jg}var Qg,BE;function dI(){if(BE)return Qg;BE=1;var e=eh(),t=Kl(),n=bt(),r=Kd(),s=z0(),i=Xl();function l(u,d,f){d=e(d,u);for(var h=-1,p=d.length,g=!1;++h<p;){var w=i(d[h]);if(!(g=u!=null&&f(u,w)))break;u=u[w]}return g||++h!=p?g:(p=u==null?0:u.length,!!p&&s(p)&&r(w,p)&&(n(u)||t(u)))}return Qg=l,Qg}var ey,UE;function hI(){if(UE)return ey;UE=1;var e=aX(),t=dI();function n(r,s){return r!=null&&t(r,s,e)}return ey=n,ey}var ty,zE;function oX(){if(zE)return ty;zE=1;var e=iI(),t=sX(),n=hI(),r=Q0(),s=lI(),i=cI(),l=Xl(),u=1,d=2;function f(h,p){return r(h)&&s(p)?i(l(h),p):function(g){var w=t(g,h);return w===void 0&&w===p?n(g,h):e(p,w,u|d)}}return ty=f,ty}var ny,HE;function fI(){if(HE)return ny;HE=1;function e(t){return function(n){return n==null?void 0:n[t]}}return ny=e,ny}var ry,WE;function iX(){if(WE)return ry;WE=1;var e=th();function t(n){return function(r){return e(r,n)}}return ry=t,ry}var sy,VE;function lX(){if(VE)return sy;VE=1;var e=fI(),t=iX(),n=Q0(),r=Xl();function s(i){return n(i)?e(r(i)):t(i)}return sy=s,sy}var ay,GE;function ss(){if(GE)return ay;GE=1;var e=QY(),t=oX(),n=Wa(),r=bt(),s=lX();function i(l){return typeof l=="function"?l:l==null?n:typeof l=="object"?r(l)?t(l[0],l[1]):e(l):s(l)}return ay=i,ay}var oy,KE;function pI(){if(KE)return oy;KE=1;var e=H$(),t=zY(),n=ss(),r=bt();function s(i,l){var u=r(i)?e:t;return u(i,n(l,3))}return oy=s,oy}var iy,YE;function cX(){if(YE)return iy;YE=1;var e=Object.prototype,t=e.hasOwnProperty;function n(r,s){return r!=null&&t.call(r,s)}return iy=n,iy}var ly,XE;function mI(){if(XE)return ly;XE=1;var e=cX(),t=dI();function n(r,s){return r!=null&&t(r,s,e)}return ly=n,ly}var cy,ZE;function uX(){if(ZE)return cy;ZE=1;var e=W0(),t=pi(),n=Kl(),r=bt(),s=rs(),i=fi(),l=Xd(),u=Yl(),d="[object Map]",f="[object Set]",h=Object.prototype,p=h.hasOwnProperty;function g(w){if(w==null)return!0;if(s(w)&&(r(w)||typeof w=="string"||typeof w.splice=="function"||i(w)||u(w)||n(w)))return!w.length;var k=t(w);if(k==d||k==f)return!w.size;if(l(w))return!e(w).length;for(var x in w)if(p.call(w,x))return!1;return!0}return cy=g,cy}var uy,JE;function gI(){if(JE)return uy;JE=1;function e(t){return t===void 0}return uy=e,uy}var dy,QE;function yI(){if(QE)return dy;QE=1;var e=Jd(),t=rs();function n(r,s){var i=-1,l=t(r)?Array(r.length):[];return e(r,function(u,d,f){l[++i]=s(u,d,f)}),l}return dy=n,dy}var hy,eC;function wI(){if(eC)return hy;eC=1;var e=Qd(),t=ss(),n=yI(),r=bt();function s(i,l){var u=r(i)?e:n;return u(i,t(l,3))}return hy=s,hy}var fy,tC;function dX(){if(tC)return fy;tC=1;function e(t,n,r,s){var i=-1,l=t==null?0:t.length;for(s&&l&&(r=t[++i]);++i<l;)r=n(r,t[i],i,t);return r}return fy=e,fy}var py,nC;function hX(){if(nC)return py;nC=1;function e(t,n,r,s,i){return i(t,function(l,u,d){r=s?(s=!1,l):n(r,l,u,d)}),r}return py=e,py}var my,rC;function vI(){if(rC)return my;rC=1;var e=dX(),t=Jd(),n=ss(),r=hX(),s=bt();function i(l,u,d){var f=s(l)?e:r,h=arguments.length<3;return f(l,n(u,4),d,h,t)}return my=i,my}var gy,sC;function fX(){if(sC)return gy;sC=1;var e=Ua(),t=bt(),n=Mr(),r="[object String]";function s(i){return typeof i=="string"||!t(i)&&n(i)&&e(i)==r}return gy=s,gy}var yy,aC;function pX(){if(aC)return yy;aC=1;var e=fI(),t=e("length");return yy=t,yy}var wy,oC;function mX(){if(oC)return wy;oC=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",r="\\u20d0-\\u20ff",s=t+n+r,i="\\ufe0e\\ufe0f",l="\\u200d",u=RegExp("["+l+e+s+i+"]");function d(f){return u.test(f)}return wy=d,wy}var vy,iC;function gX(){if(iC)return vy;iC=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",r="\\u20d0-\\u20ff",s=t+n+r,i="\\ufe0e\\ufe0f",l="["+e+"]",u="["+s+"]",d="\\ud83c[\\udffb-\\udfff]",f="(?:"+u+"|"+d+")",h="[^"+e+"]",p="(?:\\ud83c[\\udde6-\\uddff]){2}",g="[\\ud800-\\udbff][\\udc00-\\udfff]",w="\\u200d",k=f+"?",x="["+i+"]?",b="(?:"+w+"(?:"+[h,p,g].join("|")+")"+x+k+")*",j=x+k+b,S="(?:"+[h+u+"?",u,p,g,l].join("|")+")",_=RegExp(d+"(?="+d+")|"+S+j,"g");function E(T){for(var R=_.lastIndex=0;_.test(T);)++R;return R}return vy=E,vy}var xy,lC;function yX(){if(lC)return xy;lC=1;var e=pX(),t=mX(),n=gX();function r(s){return t(s)?n(s):e(s)}return xy=r,xy}var by,cC;function wX(){if(cC)return by;cC=1;var e=W0(),t=pi(),n=rs(),r=fX(),s=yX(),i="[object Map]",l="[object Set]";function u(d){if(d==null)return 0;if(n(d))return r(d)?s(d):d.length;var f=t(d);return f==i||f==l?d.size:e(d).length}return by=u,by}var ky,uC;function vX(){if(uC)return ky;uC=1;var e=U0(),t=J$(),n=Z0(),r=ss(),s=Zd(),i=bt(),l=fi(),u=Vl(),d=Fn(),f=Yl();function h(p,g,w){var k=i(p),x=k||l(p)||f(p);if(g=r(g,4),w==null){var b=p&&p.constructor;x?w=k?new b:[]:d(p)?w=u(b)?t(s(p)):{}:w={}}return(x?e:n)(p,function(j,S,_){return g(w,j,S,_)}),w}return ky=h,ky}var Ny,dC;function xX(){if(dC)return Ny;dC=1;var e=hi(),t=Kl(),n=bt(),r=e?e.isConcatSpreadable:void 0;function s(i){return n(i)||t(i)||!!(r&&i&&i[r])}return Ny=s,Ny}var jy,hC;function eb(){if(hC)return jy;hC=1;var e=G0(),t=xX();function n(r,s,i,l,u){var d=-1,f=r.length;for(i||(i=t),u||(u=[]);++d<f;){var h=r[d];s>0&&i(h)?s>1?n(h,s-1,i,l,u):e(u,h):l||(u[u.length]=h)}return u}return jy=n,jy}var Sy,fC;function bX(){if(fC)return Sy;fC=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 Sy=e,Sy}var _y,pC;function xI(){if(pC)return _y;pC=1;var e=bX(),t=Math.max;function n(r,s,i){return s=t(s===void 0?r.length-1:s,0),function(){for(var l=arguments,u=-1,d=t(l.length-s,0),f=Array(d);++u<d;)f[u]=l[s+u];u=-1;for(var h=Array(s+1);++u<s;)h[u]=l[u];return h[s]=i(f),e(r,this,h)}}return _y=n,_y}var Ey,mC;function kX(){if(mC)return Ey;mC=1;var e=Y0(),t=F$(),n=Wa(),r=t?function(s,i){return t(s,"toString",{configurable:!0,enumerable:!1,value:e(i),writable:!0})}:n;return Ey=r,Ey}var Cy,gC;function NX(){if(gC)return Cy;gC=1;var e=800,t=16,n=Date.now;function r(s){var i=0,l=0;return function(){var u=n(),d=t-(u-l);if(l=u,d>0){if(++i>=e)return arguments[0]}else i=0;return s.apply(void 0,arguments)}}return Cy=r,Cy}var Ty,yC;function bI(){if(yC)return Ty;yC=1;var e=kX(),t=NX(),n=t(e);return Ty=n,Ty}var Ry,wC;function nh(){if(wC)return Ry;wC=1;var e=Wa(),t=xI(),n=bI();function r(s,i){return n(t(s,i,e),s+"")}return Ry=r,Ry}var Ay,vC;function kI(){if(vC)return Ay;vC=1;function e(t,n,r,s){for(var i=t.length,l=r+(s?1:-1);s?l--:++l<i;)if(n(t[l],l,t))return l;return-1}return Ay=e,Ay}var My,xC;function jX(){if(xC)return My;xC=1;function e(t){return t!==t}return My=e,My}var $y,bC;function SX(){if(bC)return $y;bC=1;function e(t,n,r){for(var s=r-1,i=t.length;++s<i;)if(t[s]===n)return s;return-1}return $y=e,$y}var Iy,kC;function _X(){if(kC)return Iy;kC=1;var e=kI(),t=jX(),n=SX();function r(s,i,l){return i===i?n(s,i,l):e(s,t,l)}return Iy=r,Iy}var Oy,NC;function EX(){if(NC)return Oy;NC=1;var e=_X();function t(n,r){var s=n==null?0:n.length;return!!s&&e(n,r,0)>-1}return Oy=t,Oy}var Ly,jC;function CX(){if(jC)return Ly;jC=1;function e(t,n,r){for(var s=-1,i=t==null?0:t.length;++s<i;)if(r(n,t[s]))return!0;return!1}return Ly=e,Ly}var Py,SC;function TX(){if(SC)return Py;SC=1;function e(){}return Py=e,Py}var Dy,_C;function RX(){if(_C)return Dy;_C=1;var e=Y$(),t=TX(),n=J0(),r=1/0,s=e&&1/n(new e([,-0]))[1]==r?function(i){return new e(i)}:t;return Dy=s,Dy}var Fy,EC;function AX(){if(EC)return Fy;EC=1;var e=sI(),t=EX(),n=CX(),r=aI(),s=RX(),i=J0(),l=200;function u(d,f,h){var p=-1,g=t,w=d.length,k=!0,x=[],b=x;if(h)k=!1,g=n;else if(w>=l){var j=f?null:s(d);if(j)return i(j);k=!1,g=r,b=new e}else b=f?[]:x;e:for(;++p<w;){var S=d[p],_=f?f(S):S;if(S=h||S!==0?S:0,k&&_===_){for(var E=b.length;E--;)if(b[E]===_)continue e;f&&b.push(_),x.push(S)}else g(b,_,h)||(b!==x&&b.push(_),x.push(S))}return x}return Fy=u,Fy}var qy,CC;function NI(){if(CC)return qy;CC=1;var e=rs(),t=Mr();function n(r){return t(r)&&e(r)}return qy=n,qy}var By,TC;function MX(){if(TC)return By;TC=1;var e=eb(),t=nh(),n=AX(),r=NI(),s=t(function(i){return n(e(i,1,r,!0))});return By=s,By}var Uy,RC;function $X(){if(RC)return Uy;RC=1;var e=Qd();function t(n,r){return e(r,function(s){return n[s]})}return Uy=t,Uy}var zy,AC;function jI(){if(AC)return zy;AC=1;var e=$X(),t=Ys();function n(r){return r==null?[]:e(r,t(r))}return zy=n,zy}var Hy,MC;function qn(){if(MC)return Hy;MC=1;var e;if(typeof F0=="function")try{e={clone:qY(),constant:Y0(),each:rI(),filter:pI(),has:mI(),isArray:bt(),isEmpty:uX(),isFunction:Vl(),isUndefined:gI(),keys:Ys(),map:wI(),reduce:vI(),size:wX(),transform:vX(),union:MX(),values:jI()}}catch{}return e||(e=window._),Hy=e,Hy}var Wy,$C;function tb(){if($C)return Wy;$C=1;var e=qn();Wy=s;var t="\0",n="\0",r="";function s(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={}}s.prototype._nodeCount=0,s.prototype._edgeCount=0,s.prototype.isDirected=function(){return this._isDirected},s.prototype.isMultigraph=function(){return this._isMultigraph},s.prototype.isCompound=function(){return this._isCompound},s.prototype.setGraph=function(h){return this._label=h,this},s.prototype.graph=function(){return this._label},s.prototype.setDefaultNodeLabel=function(h){return e.isFunction(h)||(h=e.constant(h)),this._defaultNodeLabelFn=h,this},s.prototype.nodeCount=function(){return this._nodeCount},s.prototype.nodes=function(){return e.keys(this._nodes)},s.prototype.sources=function(){var h=this;return e.filter(this.nodes(),function(p){return e.isEmpty(h._in[p])})},s.prototype.sinks=function(){var h=this;return e.filter(this.nodes(),function(p){return e.isEmpty(h._out[p])})},s.prototype.setNodes=function(h,p){var g=arguments,w=this;return e.each(h,function(k){g.length>1?w.setNode(k,p):w.setNode(k)}),this},s.prototype.setNode=function(h,p){return e.has(this._nodes,h)?(arguments.length>1&&(this._nodes[h]=p),this):(this._nodes[h]=arguments.length>1?p: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)},s.prototype.node=function(h){return this._nodes[h]},s.prototype.hasNode=function(h){return e.has(this._nodes,h)},s.prototype.removeNode=function(h){var p=this;if(e.has(this._nodes,h)){var g=function(w){p.removeEdge(p._edgeObjs[w])};delete this._nodes[h],this._isCompound&&(this._removeFromParentsChildList(h),delete this._parent[h],e.each(this.children(h),function(w){p.setParent(w)}),delete this._children[h]),e.each(e.keys(this._in[h]),g),delete this._in[h],delete this._preds[h],e.each(e.keys(this._out[h]),g),delete this._out[h],delete this._sucs[h],--this._nodeCount}return this},s.prototype.setParent=function(h,p){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(e.isUndefined(p))p=n;else{p+="";for(var g=p;!e.isUndefined(g);g=this.parent(g))if(g===h)throw new Error("Setting "+p+" as parent of "+h+" would create a cycle");this.setNode(p)}return this.setNode(h),this._removeFromParentsChildList(h),this._parent[h]=p,this._children[p][h]=!0,this},s.prototype._removeFromParentsChildList=function(h){delete this._children[this._parent[h]][h]},s.prototype.parent=function(h){if(this._isCompound){var p=this._parent[h];if(p!==n)return p}},s.prototype.children=function(h){if(e.isUndefined(h)&&(h=n),this._isCompound){var p=this._children[h];if(p)return e.keys(p)}else{if(h===n)return this.nodes();if(this.hasNode(h))return[]}},s.prototype.predecessors=function(h){var p=this._preds[h];if(p)return e.keys(p)},s.prototype.successors=function(h){var p=this._sucs[h];if(p)return e.keys(p)},s.prototype.neighbors=function(h){var p=this.predecessors(h);if(p)return e.union(p,this.successors(h))},s.prototype.isLeaf=function(h){var p;return this.isDirected()?p=this.successors(h):p=this.neighbors(h),p.length===0},s.prototype.filterNodes=function(h){var p=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});p.setGraph(this.graph());var g=this;e.each(this._nodes,function(x,b){h(b)&&p.setNode(b,x)}),e.each(this._edgeObjs,function(x){p.hasNode(x.v)&&p.hasNode(x.w)&&p.setEdge(x,g.edge(x))});var w={};function k(x){var b=g.parent(x);return b===void 0||p.hasNode(b)?(w[x]=b,b):b in w?w[b]:k(b)}return this._isCompound&&e.each(p.nodes(),function(x){p.setParent(x,k(x))}),p},s.prototype.setDefaultEdgeLabel=function(h){return e.isFunction(h)||(h=e.constant(h)),this._defaultEdgeLabelFn=h,this},s.prototype.edgeCount=function(){return this._edgeCount},s.prototype.edges=function(){return e.values(this._edgeObjs)},s.prototype.setPath=function(h,p){var g=this,w=arguments;return e.reduce(h,function(k,x){return w.length>1?g.setEdge(k,x,p):g.setEdge(k,x),x}),this},s.prototype.setEdge=function(){var h,p,g,w,k=!1,x=arguments[0];typeof x=="object"&&x!==null&&"v"in x?(h=x.v,p=x.w,g=x.name,arguments.length===2&&(w=arguments[1],k=!0)):(h=x,p=arguments[1],g=arguments[3],arguments.length>2&&(w=arguments[2],k=!0)),h=""+h,p=""+p,e.isUndefined(g)||(g=""+g);var b=u(this._isDirected,h,p,g);if(e.has(this._edgeLabels,b))return k&&(this._edgeLabels[b]=w),this;if(!e.isUndefined(g)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(h),this.setNode(p),this._edgeLabels[b]=k?w:this._defaultEdgeLabelFn(h,p,g);var j=d(this._isDirected,h,p,g);return h=j.v,p=j.w,Object.freeze(j),this._edgeObjs[b]=j,i(this._preds[p],h),i(this._sucs[h],p),this._in[p][b]=j,this._out[h][b]=j,this._edgeCount++,this},s.prototype.edge=function(h,p,g){var w=arguments.length===1?f(this._isDirected,arguments[0]):u(this._isDirected,h,p,g);return this._edgeLabels[w]},s.prototype.hasEdge=function(h,p,g){var w=arguments.length===1?f(this._isDirected,arguments[0]):u(this._isDirected,h,p,g);return e.has(this._edgeLabels,w)},s.prototype.removeEdge=function(h,p,g){var w=arguments.length===1?f(this._isDirected,arguments[0]):u(this._isDirected,h,p,g),k=this._edgeObjs[w];return k&&(h=k.v,p=k.w,delete this._edgeLabels[w],delete this._edgeObjs[w],l(this._preds[p],h),l(this._sucs[h],p),delete this._in[p][w],delete this._out[h][w],this._edgeCount--),this},s.prototype.inEdges=function(h,p){var g=this._in[h];if(g){var w=e.values(g);return p?e.filter(w,function(k){return k.v===p}):w}},s.prototype.outEdges=function(h,p){var g=this._out[h];if(g){var w=e.values(g);return p?e.filter(w,function(k){return k.w===p}):w}},s.prototype.nodeEdges=function(h,p){var g=this.inEdges(h,p);if(g)return g.concat(this.outEdges(h,p))};function i(h,p){h[p]?h[p]++:h[p]=1}function l(h,p){--h[p]||delete h[p]}function u(h,p,g,w){var k=""+p,x=""+g;if(!h&&k>x){var b=k;k=x,x=b}return k+r+x+r+(e.isUndefined(w)?t:w)}function d(h,p,g,w){var k=""+p,x=""+g;if(!h&&k>x){var b=k;k=x,x=b}var j={v:k,w:x};return w&&(j.name=w),j}function f(h,p){return u(h,p.v,p.w,p.name)}return Wy}var Vy,IC;function IX(){return IC||(IC=1,Vy="2.1.8"),Vy}var Gy,OC;function OX(){return OC||(OC=1,Gy={Graph:tb(),version:IX()}),Gy}var Ky,LC;function LX(){if(LC)return Ky;LC=1;var e=qn(),t=tb();Ky={write:n,read:i};function n(l){var u={options:{directed:l.isDirected(),multigraph:l.isMultigraph(),compound:l.isCompound()},nodes:r(l),edges:s(l)};return e.isUndefined(l.graph())||(u.value=e.clone(l.graph())),u}function r(l){return e.map(l.nodes(),function(u){var d=l.node(u),f=l.parent(u),h={v:u};return e.isUndefined(d)||(h.value=d),e.isUndefined(f)||(h.parent=f),h})}function s(l){return e.map(l.edges(),function(u){var d=l.edge(u),f={v:u.v,w:u.w};return e.isUndefined(u.name)||(f.name=u.name),e.isUndefined(d)||(f.value=d),f})}function i(l){var u=new t(l.options).setGraph(l.value);return e.each(l.nodes,function(d){u.setNode(d.v,d.value),d.parent&&u.setParent(d.v,d.parent)}),e.each(l.edges,function(d){u.setEdge({v:d.v,w:d.w,name:d.name},d.value)}),u}return Ky}var Yy,PC;function PX(){if(PC)return Yy;PC=1;var e=qn();Yy=t;function t(n){var r={},s=[],i;function l(u){e.has(r,u)||(r[u]=!0,i.push(u),e.each(n.successors(u),l),e.each(n.predecessors(u),l))}return e.each(n.nodes(),function(u){i=[],l(u),i.length&&s.push(i)}),s}return Yy}var Xy,DC;function SI(){if(DC)return Xy;DC=1;var e=qn();Xy=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 s=this._keyIndices;if(n=String(n),!e.has(s,n)){var i=this._arr,l=i.length;return s[n]=l,i.push({key:n,priority:r}),this._decrease(l),!0}return!1},t.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var n=this._arr.pop();return delete this._keyIndices[n.key],this._heapify(0),n.key},t.prototype.decrease=function(n,r){var s=this._keyIndices[n];if(r>this._arr[s].priority)throw new Error("New priority is greater than current priority. Key: "+n+" Old: "+this._arr[s].priority+" New: "+r);this._arr[s].priority=r,this._decrease(s)},t.prototype._heapify=function(n){var r=this._arr,s=2*n,i=s+1,l=n;s<r.length&&(l=r[s].priority<r[l].priority?s:l,i<r.length&&(l=r[i].priority<r[l].priority?i:l),l!==n&&(this._swap(n,l),this._heapify(l)))},t.prototype._decrease=function(n){for(var r=this._arr,s=r[n].priority,i;n!==0&&(i=n>>1,!(r[i].priority<s));)this._swap(n,i),n=i},t.prototype._swap=function(n,r){var s=this._arr,i=this._keyIndices,l=s[n],u=s[r];s[n]=u,s[r]=l,i[u.key]=n,i[l.key]=r},Xy}var Zy,FC;function _I(){if(FC)return Zy;FC=1;var e=qn(),t=SI();Zy=r;var n=e.constant(1);function r(i,l,u,d){return s(i,String(l),u||n,d||function(f){return i.outEdges(f)})}function s(i,l,u,d){var f={},h=new t,p,g,w=function(k){var x=k.v!==p?k.v:k.w,b=f[x],j=u(k),S=g.distance+j;if(j<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+k+" Weight: "+j);S<b.distance&&(b.distance=S,b.predecessor=p,h.decrease(x,S))};for(i.nodes().forEach(function(k){var x=k===l?0:Number.POSITIVE_INFINITY;f[k]={distance:x},h.add(k,x)});h.size()>0&&(p=h.removeMin(),g=f[p],g.distance!==Number.POSITIVE_INFINITY);)d(p).forEach(w);return f}return Zy}var Jy,qC;function DX(){if(qC)return Jy;qC=1;var e=_I(),t=qn();Jy=n;function n(r,s,i){return t.transform(r.nodes(),function(l,u){l[u]=e(r,u,s,i)},{})}return Jy}var Qy,BC;function EI(){if(BC)return Qy;BC=1;var e=qn();Qy=t;function t(n){var r=0,s=[],i={},l=[];function u(d){var f=i[d]={onStack:!0,lowlink:r,index:r++};if(s.push(d),n.successors(d).forEach(function(g){e.has(i,g)?i[g].onStack&&(f.lowlink=Math.min(f.lowlink,i[g].index)):(u(g),f.lowlink=Math.min(f.lowlink,i[g].lowlink))}),f.lowlink===f.index){var h=[],p;do p=s.pop(),i[p].onStack=!1,h.push(p);while(d!==p);l.push(h)}}return n.nodes().forEach(function(d){e.has(i,d)||u(d)}),l}return Qy}var ew,UC;function FX(){if(UC)return ew;UC=1;var e=qn(),t=EI();ew=n;function n(r){return e.filter(t(r),function(s){return s.length>1||s.length===1&&r.hasEdge(s[0],s[0])})}return ew}var tw,zC;function qX(){if(zC)return tw;zC=1;var e=qn();tw=n;var t=e.constant(1);function n(s,i,l){return r(s,i||t,l||function(u){return s.outEdges(u)})}function r(s,i,l){var u={},d=s.nodes();return d.forEach(function(f){u[f]={},u[f][f]={distance:0},d.forEach(function(h){f!==h&&(u[f][h]={distance:Number.POSITIVE_INFINITY})}),l(f).forEach(function(h){var p=h.v===f?h.w:h.v,g=i(h);u[f][p]={distance:g,predecessor:f}})}),d.forEach(function(f){var h=u[f];d.forEach(function(p){var g=u[p];d.forEach(function(w){var k=g[f],x=h[w],b=g[w],j=k.distance+x.distance;j<b.distance&&(b.distance=j,b.predecessor=x.predecessor)})})}),u}return tw}var nw,HC;function CI(){if(HC)return nw;HC=1;var e=qn();nw=t,t.CycleException=n;function t(r){var s={},i={},l=[];function u(d){if(e.has(i,d))throw new n;e.has(s,d)||(i[d]=!0,s[d]=!0,e.each(r.predecessors(d),u),delete i[d],l.push(d))}if(e.each(r.sinks(),u),e.size(s)!==r.nodeCount())throw new n;return l}function n(){}return n.prototype=new Error,nw}var rw,WC;function BX(){if(WC)return rw;WC=1;var e=CI();rw=t;function t(n){try{e(n)}catch(r){if(r instanceof e.CycleException)return!1;throw r}return!0}return rw}var sw,VC;function TI(){if(VC)return sw;VC=1;var e=qn();sw=t;function t(r,s,i){e.isArray(s)||(s=[s]);var l=(r.isDirected()?r.successors:r.neighbors).bind(r),u=[],d={};return e.each(s,function(f){if(!r.hasNode(f))throw new Error("Graph does not have node: "+f);n(r,f,i==="post",d,l,u)}),u}function n(r,s,i,l,u,d){e.has(l,s)||(l[s]=!0,i||d.push(s),e.each(u(s),function(f){n(r,f,i,l,u,d)}),i&&d.push(s))}return sw}var aw,GC;function UX(){if(GC)return aw;GC=1;var e=TI();aw=t;function t(n,r){return e(n,r,"post")}return aw}var ow,KC;function zX(){if(KC)return ow;KC=1;var e=TI();ow=t;function t(n,r){return e(n,r,"pre")}return ow}var iw,YC;function HX(){if(YC)return iw;YC=1;var e=qn(),t=tb(),n=SI();iw=r;function r(s,i){var l=new t,u={},d=new n,f;function h(g){var w=g.v===f?g.w:g.v,k=d.priority(w);if(k!==void 0){var x=i(g);x<k&&(u[w]=f,d.decrease(w,x))}}if(s.nodeCount()===0)return l;e.each(s.nodes(),function(g){d.add(g,Number.POSITIVE_INFINITY),l.setNode(g)}),d.decrease(s.nodes()[0],0);for(var p=!1;d.size()>0;){if(f=d.removeMin(),e.has(u,f))l.setEdge(f,u[f]);else{if(p)throw new Error("Input graph is not connected: "+s);p=!0}s.nodeEdges(f).forEach(h)}return l}return iw}var lw,XC;function WX(){return XC||(XC=1,lw={components:PX(),dijkstra:_I(),dijkstraAll:DX(),findCycles:FX(),floydWarshall:qX(),isAcyclic:BX(),postorder:UX(),preorder:zX(),prim:HX(),tarjan:EI(),topsort:CI()}),lw}var cw,ZC;function VX(){if(ZC)return cw;ZC=1;var e=OX();return cw={Graph:e.Graph,json:LX(),alg:WX(),version:e.version},cw}var uw,JC;function or(){if(JC)return uw;JC=1;var e;if(typeof F0=="function")try{e=VX()}catch{}return e||(e=window.graphlib),uw=e,uw}var dw,QC;function GX(){if(QC)return dw;QC=1;var e=eI(),t=1,n=4;function r(s){return e(s,t|n)}return dw=r,dw}var hw,eT;function rh(){if(eT)return hw;eT=1;var e=di(),t=rs(),n=Kd(),r=Fn();function s(i,l,u){if(!r(u))return!1;var d=typeof l;return(d=="number"?t(u)&&n(l,u.length):d=="string"&&l in u)?e(u[l],i):!1}return hw=s,hw}var fw,tT;function KX(){if(tT)return fw;tT=1;var e=nh(),t=di(),n=rh(),r=Ha(),s=Object.prototype,i=s.hasOwnProperty,l=e(function(u,d){u=Object(u);var f=-1,h=d.length,p=h>2?d[2]:void 0;for(p&&n(d[0],d[1],p)&&(h=1);++f<h;)for(var g=d[f],w=r(g),k=-1,x=w.length;++k<x;){var b=w[k],j=u[b];(j===void 0||t(j,s[b])&&!i.call(u,b))&&(u[b]=g[b])}return u});return fw=l,fw}var pw,nT;function YX(){if(nT)return pw;nT=1;var e=ss(),t=rs(),n=Ys();function r(s){return function(i,l,u){var d=Object(i);if(!t(i)){var f=e(l,3);i=n(i),l=function(p){return f(d[p],p,d)}}var h=s(i,l,u);return h>-1?d[f?i[h]:h]:void 0}}return pw=r,pw}var mw,rT;function XX(){if(rT)return mw;rT=1;var e=/\s/;function t(n){for(var r=n.length;r--&&e.test(n.charAt(r)););return r}return mw=t,mw}var gw,sT;function ZX(){if(sT)return gw;sT=1;var e=XX(),t=/^\s+/;function n(r){return r&&r.slice(0,e(r)+1).replace(t,"")}return gw=n,gw}var yw,aT;function JX(){if(aT)return yw;aT=1;var e=ZX(),t=Fn(),n=mi(),r=NaN,s=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,l=/^0o[0-7]+$/i,u=parseInt;function d(f){if(typeof f=="number")return f;if(n(f))return r;if(t(f)){var h=typeof f.valueOf=="function"?f.valueOf():f;f=t(h)?h+"":h}if(typeof f!="string")return f===0?f:+f;f=e(f);var p=i.test(f);return p||l.test(f)?u(f.slice(2),p?2:8):s.test(f)?r:+f}return yw=d,yw}var ww,oT;function RI(){if(oT)return ww;oT=1;var e=JX(),t=1/0,n=17976931348623157e292;function r(s){if(!s)return s===0?s:0;if(s=e(s),s===t||s===-t){var i=s<0?-1:1;return i*n}return s===s?s:0}return ww=r,ww}var vw,iT;function QX(){if(iT)return vw;iT=1;var e=RI();function t(n){var r=e(n),s=r%1;return r===r?s?r-s:r:0}return vw=t,vw}var xw,lT;function eZ(){if(lT)return xw;lT=1;var e=kI(),t=ss(),n=QX(),r=Math.max;function s(i,l,u){var d=i==null?0:i.length;if(!d)return-1;var f=u==null?0:n(u);return f<0&&(f=r(d+f,0)),e(i,t(l,3),f)}return xw=s,xw}var bw,cT;function tZ(){if(cT)return bw;cT=1;var e=YX(),t=eZ(),n=e(t);return bw=n,bw}var kw,uT;function AI(){if(uT)return kw;uT=1;var e=eb();function t(n){var r=n==null?0:n.length;return r?e(n,1):[]}return kw=t,kw}var Nw,dT;function nZ(){if(dT)return Nw;dT=1;var e=X0(),t=tI(),n=Ha();function r(s,i){return s==null?s:e(s,t(i),n)}return Nw=r,Nw}var jw,hT;function rZ(){if(hT)return jw;hT=1;function e(t){var n=t==null?0:t.length;return n?t[n-1]:void 0}return jw=e,jw}var Sw,fT;function sZ(){if(fT)return Sw;fT=1;var e=Vd(),t=Z0(),n=ss();function r(s,i){var l={};return i=n(i,3),t(s,function(u,d,f){e(l,d,i(u,d,f))}),l}return Sw=r,Sw}var _w,pT;function nb(){if(pT)return _w;pT=1;var e=mi();function t(n,r,s){for(var i=-1,l=n.length;++i<l;){var u=n[i],d=r(u);if(d!=null&&(f===void 0?d===d&&!e(d):s(d,f)))var f=d,h=u}return h}return _w=t,_w}var Ew,mT;function aZ(){if(mT)return Ew;mT=1;function e(t,n){return t>n}return Ew=e,Ew}var Cw,gT;function oZ(){if(gT)return Cw;gT=1;var e=nb(),t=aZ(),n=Wa();function r(s){return s&&s.length?e(s,n,t):void 0}return Cw=r,Cw}var Tw,yT;function MI(){if(yT)return Tw;yT=1;var e=Vd(),t=di();function n(r,s,i){(i!==void 0&&!t(r[s],i)||i===void 0&&!(s in r))&&e(r,s,i)}return Tw=n,Tw}var Rw,wT;function iZ(){if(wT)return Rw;wT=1;var e=Ua(),t=Zd(),n=Mr(),r="[object Object]",s=Function.prototype,i=Object.prototype,l=s.toString,u=i.hasOwnProperty,d=l.call(Object);function f(h){if(!n(h)||e(h)!=r)return!1;var p=t(h);if(p===null)return!0;var g=u.call(p,"constructor")&&p.constructor;return typeof g=="function"&&g instanceof g&&l.call(g)==d}return Rw=f,Rw}var Aw,vT;function $I(){if(vT)return Aw;vT=1;function e(t,n){if(!(n==="constructor"&&typeof t[n]=="function")&&n!="__proto__")return t[n]}return Aw=e,Aw}var Mw,xT;function lZ(){if(xT)return Mw;xT=1;var e=Gl(),t=Ha();function n(r){return e(r,t(r))}return Mw=n,Mw}var $w,bT;function cZ(){if(bT)return $w;bT=1;var e=MI(),t=U$(),n=Z$(),r=z$(),s=Q$(),i=Kl(),l=bt(),u=NI(),d=fi(),f=Vl(),h=Fn(),p=iZ(),g=Yl(),w=$I(),k=lZ();function x(b,j,S,_,E,T,R){var A=w(b,S),U=w(j,S),I=R.get(U);if(I){e(b,S,I);return}var q=T?T(A,U,S+"",b,j,R):void 0,P=q===void 0;if(P){var O=l(U),V=!O&&d(U),$=!O&&!V&&g(U);q=U,O||V||$?l(A)?q=A:u(A)?q=r(A):V?(P=!1,q=t(U,!0)):$?(P=!1,q=n(U,!0)):q=[]:p(U)||i(U)?(q=A,i(A)?q=k(A):(!h(A)||f(A))&&(q=s(U))):P=!1}P&&(R.set(U,q),E(q,U,_,T,R),R.delete(U)),e(b,S,q)}return $w=x,$w}var Iw,kT;function uZ(){if(kT)return Iw;kT=1;var e=Wd(),t=MI(),n=X0(),r=cZ(),s=Fn(),i=Ha(),l=$I();function u(d,f,h,p,g){d!==f&&n(f,function(w,k){if(g||(g=new e),s(w))r(d,f,k,h,u,p,g);else{var x=p?p(l(d,k),w,k+"",d,f,g):void 0;x===void 0&&(x=w),t(d,k,x)}},i)}return Iw=u,Iw}var Ow,NT;function dZ(){if(NT)return Ow;NT=1;var e=nh(),t=rh();function n(r){return e(function(s,i){var l=-1,u=i.length,d=u>1?i[u-1]:void 0,f=u>2?i[2]:void 0;for(d=r.length>3&&typeof d=="function"?(u--,d):void 0,f&&t(i[0],i[1],f)&&(d=u<3?void 0:d,u=1),s=Object(s);++l<u;){var h=i[l];h&&r(s,h,l,d)}return s})}return Ow=n,Ow}var Lw,jT;function hZ(){if(jT)return Lw;jT=1;var e=uZ(),t=dZ(),n=t(function(r,s,i){e(r,s,i)});return Lw=n,Lw}var Pw,ST;function II(){if(ST)return Pw;ST=1;function e(t,n){return t<n}return Pw=e,Pw}var Dw,_T;function fZ(){if(_T)return Dw;_T=1;var e=nb(),t=II(),n=Wa();function r(s){return s&&s.length?e(s,n,t):void 0}return Dw=r,Dw}var Fw,ET;function pZ(){if(ET)return Fw;ET=1;var e=nb(),t=ss(),n=II();function r(s,i){return s&&s.length?e(s,t(i,2),n):void 0}return Fw=r,Fw}var qw,CT;function mZ(){if(CT)return qw;CT=1;var e=cr(),t=function(){return e.Date.now()};return qw=t,qw}var Bw,TT;function gZ(){if(TT)return Bw;TT=1;var e=Gd(),t=eh(),n=Kd(),r=Fn(),s=Xl();function i(l,u,d,f){if(!r(l))return l;u=t(u,l);for(var h=-1,p=u.length,g=p-1,w=l;w!=null&&++h<p;){var k=s(u[h]),x=d;if(k==="__proto__"||k==="constructor"||k==="prototype")return l;if(h!=g){var b=w[k];x=f?f(b,k,w):void 0,x===void 0&&(x=r(b)?b:n(u[h+1])?[]:{})}e(w,k,x),w=w[k]}return l}return Bw=i,Bw}var Uw,RT;function yZ(){if(RT)return Uw;RT=1;var e=th(),t=gZ(),n=eh();function r(s,i,l){for(var u=-1,d=i.length,f={};++u<d;){var h=i[u],p=e(s,h);l(p,h)&&t(f,n(h,s),p)}return f}return Uw=r,Uw}var zw,AT;function wZ(){if(AT)return zw;AT=1;var e=yZ(),t=hI();function n(r,s){return e(r,s,function(i,l){return t(r,l)})}return zw=n,zw}var Hw,MT;function vZ(){if(MT)return Hw;MT=1;var e=AI(),t=xI(),n=bI();function r(s){return n(t(s,void 0,e),s+"")}return Hw=r,Hw}var Ww,$T;function xZ(){if($T)return Ww;$T=1;var e=wZ(),t=vZ(),n=t(function(r,s){return r==null?{}:e(r,s)});return Ww=n,Ww}var Vw,IT;function bZ(){if(IT)return Vw;IT=1;var e=Math.ceil,t=Math.max;function n(r,s,i,l){for(var u=-1,d=t(e((s-r)/(i||1)),0),f=Array(d);d--;)f[l?d:++u]=r,r+=i;return f}return Vw=n,Vw}var Gw,OT;function kZ(){if(OT)return Gw;OT=1;var e=bZ(),t=rh(),n=RI();function r(s){return function(i,l,u){return u&&typeof u!="number"&&t(i,l,u)&&(l=u=void 0),i=n(i),l===void 0?(l=i,i=0):l=n(l),u=u===void 0?i<l?1:-1:n(u),e(i,l,u,s)}}return Gw=r,Gw}var Kw,LT;function NZ(){if(LT)return Kw;LT=1;var e=kZ(),t=e();return Kw=t,Kw}var Yw,PT;function jZ(){if(PT)return Yw;PT=1;function e(t,n){var r=t.length;for(t.sort(n);r--;)t[r]=t[r].value;return t}return Yw=e,Yw}var Xw,DT;function SZ(){if(DT)return Xw;DT=1;var e=mi();function t(n,r){if(n!==r){var s=n!==void 0,i=n===null,l=n===n,u=e(n),d=r!==void 0,f=r===null,h=r===r,p=e(r);if(!f&&!p&&!u&&n>r||u&&d&&h&&!f&&!p||i&&d&&h||!s&&h||!l)return 1;if(!i&&!u&&!p&&n<r||p&&s&&l&&!i&&!u||f&&s&&l||!d&&l||!h)return-1}return 0}return Xw=t,Xw}var Zw,FT;function _Z(){if(FT)return Zw;FT=1;var e=SZ();function t(n,r,s){for(var i=-1,l=n.criteria,u=r.criteria,d=l.length,f=s.length;++i<d;){var h=e(l[i],u[i]);if(h){if(i>=f)return h;var p=s[i];return h*(p=="desc"?-1:1)}}return n.index-r.index}return Zw=t,Zw}var Jw,qT;function EZ(){if(qT)return Jw;qT=1;var e=Qd(),t=th(),n=ss(),r=yI(),s=jZ(),i=Yd(),l=_Z(),u=Wa(),d=bt();function f(h,p,g){p.length?p=e(p,function(x){return d(x)?function(b){return t(b,x.length===1?x[0]:x)}:x}):p=[u];var w=-1;p=e(p,i(n));var k=r(h,function(x,b,j){var S=e(p,function(_){return _(x)});return{criteria:S,index:++w,value:x}});return s(k,function(x,b){return l(x,b,g)})}return Jw=f,Jw}var Qw,BT;function CZ(){if(BT)return Qw;BT=1;var e=eb(),t=EZ(),n=nh(),r=rh(),s=n(function(i,l){if(i==null)return[];var u=l.length;return u>1&&r(i,l[0],l[1])?l=[]:u>2&&r(l[0],l[1],l[2])&&(l=[l[0]]),t(i,e(l,1),[])});return Qw=s,Qw}var ev,UT;function TZ(){if(UT)return ev;UT=1;var e=uI(),t=0;function n(r){var s=++t;return e(r)+s}return ev=n,ev}var tv,zT;function RZ(){if(zT)return tv;zT=1;function e(t,n,r){for(var s=-1,i=t.length,l=n.length,u={};++s<i;){var d=s<l?n[s]:void 0;r(u,t[s],d)}return u}return tv=e,tv}var nv,HT;function AZ(){if(HT)return nv;HT=1;var e=Gd(),t=RZ();function n(r,s){return t(r||[],s||[],e)}return nv=n,nv}var rv,WT;function ct(){if(WT)return rv;WT=1;var e;if(typeof F0=="function")try{e={cloneDeep:GX(),constant:Y0(),defaults:KX(),each:rI(),filter:pI(),find:tZ(),flatten:AI(),forEach:nI(),forIn:nZ(),has:mI(),isUndefined:gI(),last:rZ(),map:wI(),mapValues:sZ(),max:oZ(),merge:hZ(),min:fZ(),minBy:pZ(),now:mZ(),pick:xZ(),range:NZ(),reduce:vI(),sortBy:CZ(),uniqueId:TZ(),values:jI(),zipObject:AZ()}}catch{}return e||(e=window._),rv=e,rv}var sv,VT;function MZ(){if(VT)return sv;VT=1,sv=e;function e(){var r={};r._next=r._prev=r,this._sentinel=r}e.prototype.dequeue=function(){var r=this._sentinel,s=r._prev;if(s!==r)return t(s),s},e.prototype.enqueue=function(r){var s=this._sentinel;r._prev&&r._next&&t(r),r._next=s._next,s._next._prev=r,s._next=r,r._prev=s},e.prototype.toString=function(){for(var r=[],s=this._sentinel,i=s._prev;i!==s;)r.push(JSON.stringify(i,n)),i=i._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,s){if(r!=="_next"&&r!=="_prev")return s}return sv}var av,GT;function $Z(){if(GT)return av;GT=1;var e=ct(),t=or().Graph,n=MZ();av=s;var r=e.constant(1);function s(f,h){if(f.nodeCount()<=1)return[];var p=u(f,h||r),g=i(p.graph,p.buckets,p.zeroIdx);return e.flatten(e.map(g,function(w){return f.outEdges(w.v,w.w)}),!0)}function i(f,h,p){for(var g=[],w=h[h.length-1],k=h[0],x;f.nodeCount();){for(;x=k.dequeue();)l(f,h,p,x);for(;x=w.dequeue();)l(f,h,p,x);if(f.nodeCount()){for(var b=h.length-2;b>0;--b)if(x=h[b].dequeue(),x){g=g.concat(l(f,h,p,x,!0));break}}}return g}function l(f,h,p,g,w){var k=w?[]:void 0;return e.forEach(f.inEdges(g.v),function(x){var b=f.edge(x),j=f.node(x.v);w&&k.push({v:x.v,w:x.w}),j.out-=b,d(h,p,j)}),e.forEach(f.outEdges(g.v),function(x){var b=f.edge(x),j=x.w,S=f.node(j);S.in-=b,d(h,p,S)}),f.removeNode(g.v),k}function u(f,h){var p=new t,g=0,w=0;e.forEach(f.nodes(),function(b){p.setNode(b,{v:b,in:0,out:0})}),e.forEach(f.edges(),function(b){var j=p.edge(b.v,b.w)||0,S=h(b),_=j+S;p.setEdge(b.v,b.w,_),w=Math.max(w,p.node(b.v).out+=S),g=Math.max(g,p.node(b.w).in+=S)});var k=e.range(w+g+3).map(function(){return new n}),x=g+1;return e.forEach(p.nodes(),function(b){d(k,x,p.node(b))}),{graph:p,buckets:k,zeroIdx:x}}function d(f,h,p){p.out?p.in?f[p.out-p.in+h].enqueue(p):f[f.length-1].enqueue(p):f[0].enqueue(p)}return av}var ov,KT;function IZ(){if(KT)return ov;KT=1;var e=ct(),t=$Z();ov={run:n,undo:s};function n(i){var l=i.graph().acyclicer==="greedy"?t(i,u(i)):r(i);e.forEach(l,function(d){var f=i.edge(d);i.removeEdge(d),f.forwardName=d.name,f.reversed=!0,i.setEdge(d.w,d.v,f,e.uniqueId("rev"))});function u(d){return function(f){return d.edge(f).weight}}}function r(i){var l=[],u={},d={};function f(h){e.has(d,h)||(d[h]=!0,u[h]=!0,e.forEach(i.outEdges(h),function(p){e.has(u,p.w)?l.push(p):f(p.w)}),delete u[h])}return e.forEach(i.nodes(),f),l}function s(i){e.forEach(i.edges(),function(l){var u=i.edge(l);if(u.reversed){i.removeEdge(l);var d=u.forwardName;delete u.reversed,delete u.forwardName,i.setEdge(l.w,l.v,u,d)}})}return ov}var iv,YT;function cn(){if(YT)return iv;YT=1;var e=ct(),t=or().Graph;iv={addDummyNode:n,simplify:r,asNonCompoundGraph:s,successorWeights:i,predecessorWeights:l,intersectRect:u,buildLayerMatrix:d,normalizeRanks:f,removeEmptyRanks:h,addBorderNode:p,maxRank:g,partition:w,time:k,notime:x};function n(b,j,S,_){var E;do E=e.uniqueId(_);while(b.hasNode(E));return S.dummy=j,b.setNode(E,S),E}function r(b){var j=new t().setGraph(b.graph());return e.forEach(b.nodes(),function(S){j.setNode(S,b.node(S))}),e.forEach(b.edges(),function(S){var _=j.edge(S.v,S.w)||{weight:0,minlen:1},E=b.edge(S);j.setEdge(S.v,S.w,{weight:_.weight+E.weight,minlen:Math.max(_.minlen,E.minlen)})}),j}function s(b){var j=new t({multigraph:b.isMultigraph()}).setGraph(b.graph());return e.forEach(b.nodes(),function(S){b.children(S).length||j.setNode(S,b.node(S))}),e.forEach(b.edges(),function(S){j.setEdge(S,b.edge(S))}),j}function i(b){var j=e.map(b.nodes(),function(S){var _={};return e.forEach(b.outEdges(S),function(E){_[E.w]=(_[E.w]||0)+b.edge(E).weight}),_});return e.zipObject(b.nodes(),j)}function l(b){var j=e.map(b.nodes(),function(S){var _={};return e.forEach(b.inEdges(S),function(E){_[E.v]=(_[E.v]||0)+b.edge(E).weight}),_});return e.zipObject(b.nodes(),j)}function u(b,j){var S=b.x,_=b.y,E=j.x-S,T=j.y-_,R=b.width/2,A=b.height/2;if(!E&&!T)throw new Error("Not possible to find intersection inside of the rectangle");var U,I;return Math.abs(T)*R>Math.abs(E)*A?(T<0&&(A=-A),U=A*E/T,I=A):(E<0&&(R=-R),U=R,I=R*T/E),{x:S+U,y:_+I}}function d(b){var j=e.map(e.range(g(b)+1),function(){return[]});return e.forEach(b.nodes(),function(S){var _=b.node(S),E=_.rank;e.isUndefined(E)||(j[E][_.order]=S)}),j}function f(b){var j=e.min(e.map(b.nodes(),function(S){return b.node(S).rank}));e.forEach(b.nodes(),function(S){var _=b.node(S);e.has(_,"rank")&&(_.rank-=j)})}function h(b){var j=e.min(e.map(b.nodes(),function(T){return b.node(T).rank})),S=[];e.forEach(b.nodes(),function(T){var R=b.node(T).rank-j;S[R]||(S[R]=[]),S[R].push(T)});var _=0,E=b.graph().nodeRankFactor;e.forEach(S,function(T,R){e.isUndefined(T)&&R%E!==0?--_:_&&e.forEach(T,function(A){b.node(A).rank+=_})})}function p(b,j,S,_){var E={width:0,height:0};return arguments.length>=4&&(E.rank=S,E.order=_),n(b,"border",E,j)}function g(b){return e.max(e.map(b.nodes(),function(j){var S=b.node(j).rank;if(!e.isUndefined(S))return S}))}function w(b,j){var S={lhs:[],rhs:[]};return e.forEach(b,function(_){j(_)?S.lhs.push(_):S.rhs.push(_)}),S}function k(b,j){var S=e.now();try{return j()}finally{console.log(b+" time: "+(e.now()-S)+"ms")}}function x(b,j){return j()}return iv}var lv,XT;function OZ(){if(XT)return lv;XT=1;var e=ct(),t=cn();lv={run:n,undo:s};function n(i){i.graph().dummyChains=[],e.forEach(i.edges(),function(l){r(i,l)})}function r(i,l){var u=l.v,d=i.node(u).rank,f=l.w,h=i.node(f).rank,p=l.name,g=i.edge(l),w=g.labelRank;if(h!==d+1){i.removeEdge(l);var k,x,b;for(b=0,++d;d<h;++b,++d)g.points=[],x={width:0,height:0,edgeLabel:g,edgeObj:l,rank:d},k=t.addDummyNode(i,"edge",x,"_d"),d===w&&(x.width=g.width,x.height=g.height,x.dummy="edge-label",x.labelpos=g.labelpos),i.setEdge(u,k,{weight:g.weight},p),b===0&&i.graph().dummyChains.push(k),u=k;i.setEdge(u,f,{weight:g.weight},p)}}function s(i){e.forEach(i.graph().dummyChains,function(l){var u=i.node(l),d=u.edgeLabel,f;for(i.setEdge(u.edgeObj,d);u.dummy;)f=i.successors(l)[0],i.removeNode(l),d.points.push({x:u.x,y:u.y}),u.dummy==="edge-label"&&(d.x=u.x,d.y=u.y,d.width=u.width,d.height=u.height),l=f,u=i.node(l)})}return lv}var cv,ZT;function ud(){if(ZT)return cv;ZT=1;var e=ct();cv={longestPath:t,slack:n};function t(r){var s={};function i(l){var u=r.node(l);if(e.has(s,l))return u.rank;s[l]=!0;var d=e.min(e.map(r.outEdges(l),function(f){return i(f.w)-r.edge(f).minlen}));return(d===Number.POSITIVE_INFINITY||d===void 0||d===null)&&(d=0),u.rank=d}e.forEach(r.sources(),i)}function n(r,s){return r.node(s.w).rank-r.node(s.v).rank-r.edge(s).minlen}return cv}var uv,JT;function OI(){if(JT)return uv;JT=1;var e=ct(),t=or().Graph,n=ud().slack;uv=r;function r(u){var d=new t({directed:!1}),f=u.nodes()[0],h=u.nodeCount();d.setNode(f,{});for(var p,g;s(d,u)<h;)p=i(d,u),g=d.hasNode(p.v)?n(u,p):-n(u,p),l(d,u,g);return d}function s(u,d){function f(h){e.forEach(d.nodeEdges(h),function(p){var g=p.v,w=h===g?p.w:g;!u.hasNode(w)&&!n(d,p)&&(u.setNode(w,{}),u.setEdge(h,w,{}),f(w))})}return e.forEach(u.nodes(),f),u.nodeCount()}function i(u,d){return e.minBy(d.edges(),function(f){if(u.hasNode(f.v)!==u.hasNode(f.w))return n(d,f)})}function l(u,d,f){e.forEach(u.nodes(),function(h){d.node(h).rank+=f})}return uv}var dv,QT;function LZ(){if(QT)return dv;QT=1;var e=ct(),t=OI(),n=ud().slack,r=ud().longestPath,s=or().alg.preorder,i=or().alg.postorder,l=cn().simplify;dv=u,u.initLowLimValues=p,u.initCutValues=d,u.calcCutValue=h,u.leaveEdge=w,u.enterEdge=k,u.exchangeEdges=x;function u(_){_=l(_),r(_);var E=t(_);p(E),d(E,_);for(var T,R;T=w(E);)R=k(E,_,T),x(E,_,T,R)}function d(_,E){var T=i(_,_.nodes());T=T.slice(0,T.length-1),e.forEach(T,function(R){f(_,E,R)})}function f(_,E,T){var R=_.node(T),A=R.parent;_.edge(T,A).cutvalue=h(_,E,T)}function h(_,E,T){var R=_.node(T),A=R.parent,U=!0,I=E.edge(T,A),q=0;return I||(U=!1,I=E.edge(A,T)),q=I.weight,e.forEach(E.nodeEdges(T),function(P){var O=P.v===T,V=O?P.w:P.v;if(V!==A){var $=O===U,M=E.edge(P).weight;if(q+=$?M:-M,j(_,T,V)){var L=_.edge(T,V).cutvalue;q+=$?-L:L}}}),q}function p(_,E){arguments.length<2&&(E=_.nodes()[0]),g(_,{},1,E)}function g(_,E,T,R,A){var U=T,I=_.node(R);return E[R]=!0,e.forEach(_.neighbors(R),function(q){e.has(E,q)||(T=g(_,E,T,q,R))}),I.low=U,I.lim=T++,A?I.parent=A:delete I.parent,T}function w(_){return e.find(_.edges(),function(E){return _.edge(E).cutvalue<0})}function k(_,E,T){var R=T.v,A=T.w;E.hasEdge(R,A)||(R=T.w,A=T.v);var U=_.node(R),I=_.node(A),q=U,P=!1;U.lim>I.lim&&(q=I,P=!0);var O=e.filter(E.edges(),function(V){return P===S(_,_.node(V.v),q)&&P!==S(_,_.node(V.w),q)});return e.minBy(O,function(V){return n(E,V)})}function x(_,E,T,R){var A=T.v,U=T.w;_.removeEdge(A,U),_.setEdge(R.v,R.w,{}),p(_),d(_,E),b(_,E)}function b(_,E){var T=e.find(_.nodes(),function(A){return!E.node(A).parent}),R=s(_,T);R=R.slice(1),e.forEach(R,function(A){var U=_.node(A).parent,I=E.edge(A,U),q=!1;I||(I=E.edge(U,A),q=!0),E.node(A).rank=E.node(U).rank+(q?I.minlen:-I.minlen)})}function j(_,E,T){return _.hasEdge(E,T)}function S(_,E,T){return T.low<=E.lim&&E.lim<=T.lim}return dv}var hv,eR;function PZ(){if(eR)return hv;eR=1;var e=ud(),t=e.longestPath,n=OI(),r=LZ();hv=s;function s(d){switch(d.graph().ranker){case"network-simplex":u(d);break;case"tight-tree":l(d);break;case"longest-path":i(d);break;default:u(d)}}var i=t;function l(d){t(d),n(d)}function u(d){r(d)}return hv}var fv,tR;function DZ(){if(tR)return fv;tR=1;var e=ct();fv=t;function t(s){var i=r(s);e.forEach(s.graph().dummyChains,function(l){for(var u=s.node(l),d=u.edgeObj,f=n(s,i,d.v,d.w),h=f.path,p=f.lca,g=0,w=h[g],k=!0;l!==d.w;){if(u=s.node(l),k){for(;(w=h[g])!==p&&s.node(w).maxRank<u.rank;)g++;w===p&&(k=!1)}if(!k){for(;g<h.length-1&&s.node(w=h[g+1]).minRank<=u.rank;)g++;w=h[g]}s.setParent(l,w),l=s.successors(l)[0]}})}function n(s,i,l,u){var d=[],f=[],h=Math.min(i[l].low,i[u].low),p=Math.max(i[l].lim,i[u].lim),g,w;g=l;do g=s.parent(g),d.push(g);while(g&&(i[g].low>h||p>i[g].lim));for(w=g,g=u;(g=s.parent(g))!==w;)f.push(g);return{path:d.concat(f.reverse()),lca:w}}function r(s){var i={},l=0;function u(d){var f=l;e.forEach(s.children(d),u),i[d]={low:f,lim:l++}}return e.forEach(s.children(),u),i}return fv}var pv,nR;function FZ(){if(nR)return pv;nR=1;var e=ct(),t=cn();pv={run:n,cleanup:l};function n(u){var d=t.addDummyNode(u,"root",{},"_root"),f=s(u),h=e.max(e.values(f))-1,p=2*h+1;u.graph().nestingRoot=d,e.forEach(u.edges(),function(w){u.edge(w).minlen*=p});var g=i(u)+1;e.forEach(u.children(),function(w){r(u,d,p,g,h,f,w)}),u.graph().nodeRankFactor=p}function r(u,d,f,h,p,g,w){var k=u.children(w);if(!k.length){w!==d&&u.setEdge(d,w,{weight:0,minlen:f});return}var x=t.addBorderNode(u,"_bt"),b=t.addBorderNode(u,"_bb"),j=u.node(w);u.setParent(x,w),j.borderTop=x,u.setParent(b,w),j.borderBottom=b,e.forEach(k,function(S){r(u,d,f,h,p,g,S);var _=u.node(S),E=_.borderTop?_.borderTop:S,T=_.borderBottom?_.borderBottom:S,R=_.borderTop?h:2*h,A=E!==T?1:p-g[w]+1;u.setEdge(x,E,{weight:R,minlen:A,nestingEdge:!0}),u.setEdge(T,b,{weight:R,minlen:A,nestingEdge:!0})}),u.parent(w)||u.setEdge(d,x,{weight:0,minlen:p+g[w]})}function s(u){var d={};function f(h,p){var g=u.children(h);g&&g.length&&e.forEach(g,function(w){f(w,p+1)}),d[h]=p}return e.forEach(u.children(),function(h){f(h,1)}),d}function i(u){return e.reduce(u.edges(),function(d,f){return d+u.edge(f).weight},0)}function l(u){var d=u.graph();u.removeNode(d.nestingRoot),delete d.nestingRoot,e.forEach(u.edges(),function(f){var h=u.edge(f);h.nestingEdge&&u.removeEdge(f)})}return pv}var mv,rR;function qZ(){if(rR)return mv;rR=1;var e=ct(),t=cn();mv=n;function n(s){function i(l){var u=s.children(l),d=s.node(l);if(u.length&&e.forEach(u,i),e.has(d,"minRank")){d.borderLeft=[],d.borderRight=[];for(var f=d.minRank,h=d.maxRank+1;f<h;++f)r(s,"borderLeft","_bl",l,d,f),r(s,"borderRight","_br",l,d,f)}}e.forEach(s.children(),i)}function r(s,i,l,u,d,f){var h={width:0,height:0,rank:f,borderType:i},p=d[i][f-1],g=t.addDummyNode(s,"border",h,l);d[i][f]=g,s.setParent(g,u),p&&s.setEdge(p,g,{weight:1})}return mv}var gv,sR;function BZ(){if(sR)return gv;sR=1;var e=ct();gv={adjust:t,undo:n};function t(f){var h=f.graph().rankdir.toLowerCase();(h==="lr"||h==="rl")&&r(f)}function n(f){var h=f.graph().rankdir.toLowerCase();(h==="bt"||h==="rl")&&i(f),(h==="lr"||h==="rl")&&(u(f),r(f))}function r(f){e.forEach(f.nodes(),function(h){s(f.node(h))}),e.forEach(f.edges(),function(h){s(f.edge(h))})}function s(f){var h=f.width;f.width=f.height,f.height=h}function i(f){e.forEach(f.nodes(),function(h){l(f.node(h))}),e.forEach(f.edges(),function(h){var p=f.edge(h);e.forEach(p.points,l),e.has(p,"y")&&l(p)})}function l(f){f.y=-f.y}function u(f){e.forEach(f.nodes(),function(h){d(f.node(h))}),e.forEach(f.edges(),function(h){var p=f.edge(h);e.forEach(p.points,d),e.has(p,"x")&&d(p)})}function d(f){var h=f.x;f.x=f.y,f.y=h}return gv}var yv,aR;function UZ(){if(aR)return yv;aR=1;var e=ct();yv=t;function t(n){var r={},s=e.filter(n.nodes(),function(f){return!n.children(f).length}),i=e.max(e.map(s,function(f){return n.node(f).rank})),l=e.map(e.range(i+1),function(){return[]});function u(f){if(!e.has(r,f)){r[f]=!0;var h=n.node(f);l[h.rank].push(f),e.forEach(n.successors(f),u)}}var d=e.sortBy(s,function(f){return n.node(f).rank});return e.forEach(d,u),l}return yv}var wv,oR;function zZ(){if(oR)return wv;oR=1;var e=ct();wv=t;function t(r,s){for(var i=0,l=1;l<s.length;++l)i+=n(r,s[l-1],s[l]);return i}function n(r,s,i){for(var l=e.zipObject(i,e.map(i,function(g,w){return w})),u=e.flatten(e.map(s,function(g){return e.sortBy(e.map(r.outEdges(g),function(w){return{pos:l[w.w],weight:r.edge(w).weight}}),"pos")}),!0),d=1;d<i.length;)d<<=1;var f=2*d-1;d-=1;var h=e.map(new Array(f),function(){return 0}),p=0;return e.forEach(u.forEach(function(g){var w=g.pos+d;h[w]+=g.weight;for(var k=0;w>0;)w%2&&(k+=h[w+1]),w=w-1>>1,h[w]+=g.weight;p+=g.weight*k})),p}return wv}var vv,iR;function HZ(){if(iR)return vv;iR=1;var e=ct();vv=t;function t(n,r){return e.map(r,function(s){var i=n.inEdges(s);if(i.length){var l=e.reduce(i,function(u,d){var f=n.edge(d),h=n.node(d.v);return{sum:u.sum+f.weight*h.order,weight:u.weight+f.weight}},{sum:0,weight:0});return{v:s,barycenter:l.sum/l.weight,weight:l.weight}}else return{v:s}})}return vv}var xv,lR;function WZ(){if(lR)return xv;lR=1;var e=ct();xv=t;function t(s,i){var l={};e.forEach(s,function(d,f){var h=l[d.v]={indegree:0,in:[],out:[],vs:[d.v],i:f};e.isUndefined(d.barycenter)||(h.barycenter=d.barycenter,h.weight=d.weight)}),e.forEach(i.edges(),function(d){var f=l[d.v],h=l[d.w];!e.isUndefined(f)&&!e.isUndefined(h)&&(h.indegree++,f.out.push(l[d.w]))});var u=e.filter(l,function(d){return!d.indegree});return n(u)}function n(s){var i=[];function l(f){return function(h){h.merged||(e.isUndefined(h.barycenter)||e.isUndefined(f.barycenter)||h.barycenter>=f.barycenter)&&r(f,h)}}function u(f){return function(h){h.in.push(f),--h.indegree===0&&s.push(h)}}for(;s.length;){var d=s.pop();i.push(d),e.forEach(d.in.reverse(),l(d)),e.forEach(d.out,u(d))}return e.map(e.filter(i,function(f){return!f.merged}),function(f){return e.pick(f,["vs","i","barycenter","weight"])})}function r(s,i){var l=0,u=0;s.weight&&(l+=s.barycenter*s.weight,u+=s.weight),i.weight&&(l+=i.barycenter*i.weight,u+=i.weight),s.vs=i.vs.concat(s.vs),s.barycenter=l/u,s.weight=u,s.i=Math.min(i.i,s.i),i.merged=!0}return xv}var bv,cR;function VZ(){if(cR)return bv;cR=1;var e=ct(),t=cn();bv=n;function n(i,l){var u=t.partition(i,function(x){return e.has(x,"barycenter")}),d=u.lhs,f=e.sortBy(u.rhs,function(x){return-x.i}),h=[],p=0,g=0,w=0;d.sort(s(!!l)),w=r(h,f,w),e.forEach(d,function(x){w+=x.vs.length,h.push(x.vs),p+=x.barycenter*x.weight,g+=x.weight,w=r(h,f,w)});var k={vs:e.flatten(h,!0)};return g&&(k.barycenter=p/g,k.weight=g),k}function r(i,l,u){for(var d;l.length&&(d=e.last(l)).i<=u;)l.pop(),i.push(d.vs),u++;return u}function s(i){return function(l,u){return l.barycenter<u.barycenter?-1:l.barycenter>u.barycenter?1:i?u.i-l.i:l.i-u.i}}return bv}var kv,uR;function GZ(){if(uR)return kv;uR=1;var e=ct(),t=HZ(),n=WZ(),r=VZ();kv=s;function s(u,d,f,h){var p=u.children(d),g=u.node(d),w=g?g.borderLeft:void 0,k=g?g.borderRight:void 0,x={};w&&(p=e.filter(p,function(T){return T!==w&&T!==k}));var b=t(u,p);e.forEach(b,function(T){if(u.children(T.v).length){var R=s(u,T.v,f,h);x[T.v]=R,e.has(R,"barycenter")&&l(T,R)}});var j=n(b,f);i(j,x);var S=r(j,h);if(w&&(S.vs=e.flatten([w,S.vs,k],!0),u.predecessors(w).length)){var _=u.node(u.predecessors(w)[0]),E=u.node(u.predecessors(k)[0]);e.has(S,"barycenter")||(S.barycenter=0,S.weight=0),S.barycenter=(S.barycenter*S.weight+_.order+E.order)/(S.weight+2),S.weight+=2}return S}function i(u,d){e.forEach(u,function(f){f.vs=e.flatten(f.vs.map(function(h){return d[h]?d[h].vs:h}),!0)})}function l(u,d){e.isUndefined(u.barycenter)?(u.barycenter=d.barycenter,u.weight=d.weight):(u.barycenter=(u.barycenter*u.weight+d.barycenter*d.weight)/(u.weight+d.weight),u.weight+=d.weight)}return kv}var Nv,dR;function KZ(){if(dR)return Nv;dR=1;var e=ct(),t=or().Graph;Nv=n;function n(s,i,l){var u=r(s),d=new t({compound:!0}).setGraph({root:u}).setDefaultNodeLabel(function(f){return s.node(f)});return e.forEach(s.nodes(),function(f){var h=s.node(f),p=s.parent(f);(h.rank===i||h.minRank<=i&&i<=h.maxRank)&&(d.setNode(f),d.setParent(f,p||u),e.forEach(s[l](f),function(g){var w=g.v===f?g.w:g.v,k=d.edge(w,f),x=e.isUndefined(k)?0:k.weight;d.setEdge(w,f,{weight:s.edge(g).weight+x})}),e.has(h,"minRank")&&d.setNode(f,{borderLeft:h.borderLeft[i],borderRight:h.borderRight[i]}))}),d}function r(s){for(var i;s.hasNode(i=e.uniqueId("_root")););return i}return Nv}var jv,hR;function YZ(){if(hR)return jv;hR=1;var e=ct();jv=t;function t(n,r,s){var i={},l;e.forEach(s,function(u){for(var d=n.parent(u),f,h;d;){if(f=n.parent(d),f?(h=i[f],i[f]=d):(h=l,l=d),h&&h!==d){r.setEdge(h,d);return}d=f}})}return jv}var Sv,fR;function XZ(){if(fR)return Sv;fR=1;var e=ct(),t=UZ(),n=zZ(),r=GZ(),s=KZ(),i=YZ(),l=or().Graph,u=cn();Sv=d;function d(g){var w=u.maxRank(g),k=f(g,e.range(1,w+1),"inEdges"),x=f(g,e.range(w-1,-1,-1),"outEdges"),b=t(g);p(g,b);for(var j=Number.POSITIVE_INFINITY,S,_=0,E=0;E<4;++_,++E){h(_%2?k:x,_%4>=2),b=u.buildLayerMatrix(g);var T=n(g,b);T<j&&(E=0,S=e.cloneDeep(b),j=T)}p(g,S)}function f(g,w,k){return e.map(w,function(x){return s(g,x,k)})}function h(g,w){var k=new l;e.forEach(g,function(x){var b=x.graph().root,j=r(x,b,k,w);e.forEach(j.vs,function(S,_){x.node(S).order=_}),i(x,k,j.vs)})}function p(g,w){e.forEach(w,function(k){e.forEach(k,function(x,b){g.node(x).order=b})})}return Sv}var _v,pR;function ZZ(){if(pR)return _v;pR=1;var e=ct(),t=or().Graph,n=cn();_v={positionX:k,findType1Conflicts:r,findType2Conflicts:s,addConflict:l,hasConflict:u,verticalAlignment:d,horizontalCompaction:f,alignCoordinates:g,findSmallestWidthAlignment:p,balance:w};function r(j,S){var _={};function E(T,R){var A=0,U=0,I=T.length,q=e.last(R);return e.forEach(R,function(P,O){var V=i(j,P),$=V?j.node(V).order:I;(V||P===q)&&(e.forEach(R.slice(U,O+1),function(M){e.forEach(j.predecessors(M),function(L){var Y=j.node(L),K=Y.order;(K<A||$<K)&&!(Y.dummy&&j.node(M).dummy)&&l(_,L,M)})}),U=O+1,A=$)}),R}return e.reduce(S,E),_}function s(j,S){var _={};function E(R,A,U,I,q){var P;e.forEach(e.range(A,U),function(O){P=R[O],j.node(P).dummy&&e.forEach(j.predecessors(P),function(V){var $=j.node(V);$.dummy&&($.order<I||$.order>q)&&l(_,V,P)})})}function T(R,A){var U=-1,I,q=0;return e.forEach(A,function(P,O){if(j.node(P).dummy==="border"){var V=j.predecessors(P);V.length&&(I=j.node(V[0]).order,E(A,q,O,U,I),q=O,U=I)}E(A,q,A.length,I,R.length)}),A}return e.reduce(S,T),_}function i(j,S){if(j.node(S).dummy)return e.find(j.predecessors(S),function(_){return j.node(_).dummy})}function l(j,S,_){if(S>_){var E=S;S=_,_=E}var T=j[S];T||(j[S]=T={}),T[_]=!0}function u(j,S,_){if(S>_){var E=S;S=_,_=E}return e.has(j[S],_)}function d(j,S,_,E){var T={},R={},A={};return e.forEach(S,function(U){e.forEach(U,function(I,q){T[I]=I,R[I]=I,A[I]=q})}),e.forEach(S,function(U){var I=-1;e.forEach(U,function(q){var P=E(q);if(P.length){P=e.sortBy(P,function(L){return A[L]});for(var O=(P.length-1)/2,V=Math.floor(O),$=Math.ceil(O);V<=$;++V){var M=P[V];R[q]===q&&I<A[M]&&!u(_,q,M)&&(R[M]=q,R[q]=T[q]=T[M],I=A[M])}}})}),{root:T,align:R}}function f(j,S,_,E,T){var R={},A=h(j,S,_,T),U=T?"borderLeft":"borderRight";function I(O,V){for(var $=A.nodes(),M=$.pop(),L={};M;)L[M]?O(M):(L[M]=!0,$.push(M),$=$.concat(V(M))),M=$.pop()}function q(O){R[O]=A.inEdges(O).reduce(function(V,$){return Math.max(V,R[$.v]+A.edge($))},0)}function P(O){var V=A.outEdges(O).reduce(function(M,L){return Math.min(M,R[L.w]-A.edge(L))},Number.POSITIVE_INFINITY),$=j.node(O);V!==Number.POSITIVE_INFINITY&&$.borderType!==U&&(R[O]=Math.max(R[O],V))}return I(q,A.predecessors.bind(A)),I(P,A.successors.bind(A)),e.forEach(E,function(O){R[O]=R[_[O]]}),R}function h(j,S,_,E){var T=new t,R=j.graph(),A=x(R.nodesep,R.edgesep,E);return e.forEach(S,function(U){var I;e.forEach(U,function(q){var P=_[q];if(T.setNode(P),I){var O=_[I],V=T.edge(O,P);T.setEdge(O,P,Math.max(A(j,q,I),V||0))}I=q})}),T}function p(j,S){return e.minBy(e.values(S),function(_){var E=Number.NEGATIVE_INFINITY,T=Number.POSITIVE_INFINITY;return e.forIn(_,function(R,A){var U=b(j,A)/2;E=Math.max(R+U,E),T=Math.min(R-U,T)}),E-T})}function g(j,S){var _=e.values(S),E=e.min(_),T=e.max(_);e.forEach(["u","d"],function(R){e.forEach(["l","r"],function(A){var U=R+A,I=j[U],q;if(I!==S){var P=e.values(I);q=A==="l"?E-e.min(P):T-e.max(P),q&&(j[U]=e.mapValues(I,function(O){return O+q}))}})})}function w(j,S){return e.mapValues(j.ul,function(_,E){if(S)return j[S.toLowerCase()][E];var T=e.sortBy(e.map(j,E));return(T[1]+T[2])/2})}function k(j){var S=n.buildLayerMatrix(j),_=e.merge(r(j,S),s(j,S)),E={},T;e.forEach(["u","d"],function(A){T=A==="u"?S:e.values(S).reverse(),e.forEach(["l","r"],function(U){U==="r"&&(T=e.map(T,function(O){return e.values(O).reverse()}));var I=(A==="u"?j.predecessors:j.successors).bind(j),q=d(j,T,_,I),P=f(j,T,q.root,q.align,U==="r");U==="r"&&(P=e.mapValues(P,function(O){return-O})),E[A+U]=P})});var R=p(j,E);return g(E,R),w(E,j.graph().align)}function x(j,S,_){return function(E,T,R){var A=E.node(T),U=E.node(R),I=0,q;if(I+=A.width/2,e.has(A,"labelpos"))switch(A.labelpos.toLowerCase()){case"l":q=-A.width/2;break;case"r":q=A.width/2;break}if(q&&(I+=_?q:-q),q=0,I+=(A.dummy?S:j)/2,I+=(U.dummy?S:j)/2,I+=U.width/2,e.has(U,"labelpos"))switch(U.labelpos.toLowerCase()){case"l":q=U.width/2;break;case"r":q=-U.width/2;break}return q&&(I+=_?q:-q),q=0,I}}function b(j,S){return j.node(S).width}return _v}var Ev,mR;function JZ(){if(mR)return Ev;mR=1;var e=ct(),t=cn(),n=ZZ().positionX;Ev=r;function r(i){i=t.asNonCompoundGraph(i),s(i),e.forEach(n(i),function(l,u){i.node(u).x=l})}function s(i){var l=t.buildLayerMatrix(i),u=i.graph().ranksep,d=0;e.forEach(l,function(f){var h=e.max(e.map(f,function(p){return i.node(p).height}));e.forEach(f,function(p){i.node(p).y=d+h/2}),d+=h+u})}return Ev}var Cv,gR;function QZ(){if(gR)return Cv;gR=1;var e=ct(),t=IZ(),n=OZ(),r=PZ(),s=cn().normalizeRanks,i=DZ(),l=cn().removeEmptyRanks,u=FZ(),d=qZ(),f=BZ(),h=XZ(),p=JZ(),g=cn(),w=or().Graph;Cv=k;function k(W,G){var X=G&&G.debugTiming?g.time:g.notime;X("layout",function(){var Z=X(" buildLayoutGraph",function(){return I(W)});X(" runLayout",function(){x(Z,X)}),X(" updateInputGraph",function(){b(W,Z)})})}function x(W,G){G(" makeSpaceForEdgeLabels",function(){q(W)}),G(" removeSelfEdges",function(){D(W)}),G(" acyclic",function(){t.run(W)}),G(" nestingGraph.run",function(){u.run(W)}),G(" rank",function(){r(g.asNonCompoundGraph(W))}),G(" injectEdgeLabelProxies",function(){P(W)}),G(" removeEmptyRanks",function(){l(W)}),G(" nestingGraph.cleanup",function(){u.cleanup(W)}),G(" normalizeRanks",function(){s(W)}),G(" assignRankMinMax",function(){O(W)}),G(" removeEdgeLabelProxies",function(){V(W)}),G(" normalize.run",function(){n.run(W)}),G(" parentDummyChains",function(){i(W)}),G(" addBorderSegments",function(){d(W)}),G(" order",function(){h(W)}),G(" insertSelfEdges",function(){z(W)}),G(" adjustCoordinateSystem",function(){f.adjust(W)}),G(" position",function(){p(W)}),G(" positionSelfEdges",function(){F(W)}),G(" removeBorderNodes",function(){K(W)}),G(" normalize.undo",function(){n.undo(W)}),G(" fixupEdgeLabelCoords",function(){L(W)}),G(" undoCoordinateSystem",function(){f.undo(W)}),G(" translateGraph",function(){$(W)}),G(" assignNodeIntersects",function(){M(W)}),G(" reversePoints",function(){Y(W)}),G(" acyclic.undo",function(){t.undo(W)})}function b(W,G){e.forEach(W.nodes(),function(X){var Z=W.node(X),ee=G.node(X);Z&&(Z.x=ee.x,Z.y=ee.y,G.children(X).length&&(Z.width=ee.width,Z.height=ee.height))}),e.forEach(W.edges(),function(X){var Z=W.edge(X),ee=G.edge(X);Z.points=ee.points,e.has(ee,"x")&&(Z.x=ee.x,Z.y=ee.y)}),W.graph().width=G.graph().width,W.graph().height=G.graph().height}var j=["nodesep","edgesep","ranksep","marginx","marginy"],S={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},_=["acyclicer","ranker","rankdir","align"],E=["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"},U=["labelpos"];function I(W){var G=new w({multigraph:!0,compound:!0}),X=J(W.graph());return G.setGraph(e.merge({},S,H(X,j),e.pick(X,_))),e.forEach(W.nodes(),function(Z){var ee=J(W.node(Z));G.setNode(Z,e.defaults(H(ee,E),T)),G.setParent(Z,W.parent(Z))}),e.forEach(W.edges(),function(Z){var ee=J(W.edge(Z));G.setEdge(Z,e.merge({},A,H(ee,R),e.pick(ee,U)))}),G}function q(W){var G=W.graph();G.ranksep/=2,e.forEach(W.edges(),function(X){var Z=W.edge(X);Z.minlen*=2,Z.labelpos.toLowerCase()!=="c"&&(G.rankdir==="TB"||G.rankdir==="BT"?Z.width+=Z.labeloffset:Z.height+=Z.labeloffset)})}function P(W){e.forEach(W.edges(),function(G){var X=W.edge(G);if(X.width&&X.height){var Z=W.node(G.v),ee=W.node(G.w),re={rank:(ee.rank-Z.rank)/2+Z.rank,e:G};g.addDummyNode(W,"edge-proxy",re,"_ep")}})}function O(W){var G=0;e.forEach(W.nodes(),function(X){var Z=W.node(X);Z.borderTop&&(Z.minRank=W.node(Z.borderTop).rank,Z.maxRank=W.node(Z.borderBottom).rank,G=e.max(G,Z.maxRank))}),W.graph().maxRank=G}function V(W){e.forEach(W.nodes(),function(G){var X=W.node(G);X.dummy==="edge-proxy"&&(W.edge(X.e).labelRank=X.rank,W.removeNode(G))})}function $(W){var G=Number.POSITIVE_INFINITY,X=0,Z=Number.POSITIVE_INFINITY,ee=0,re=W.graph(),ce=re.marginx||0,ie=re.marginy||0;function fe(de){var we=de.x,xe=de.y,$e=de.width,be=de.height;G=Math.min(G,we-$e/2),X=Math.max(X,we+$e/2),Z=Math.min(Z,xe-be/2),ee=Math.max(ee,xe+be/2)}e.forEach(W.nodes(),function(de){fe(W.node(de))}),e.forEach(W.edges(),function(de){var we=W.edge(de);e.has(we,"x")&&fe(we)}),G-=ce,Z-=ie,e.forEach(W.nodes(),function(de){var we=W.node(de);we.x-=G,we.y-=Z}),e.forEach(W.edges(),function(de){var we=W.edge(de);e.forEach(we.points,function(xe){xe.x-=G,xe.y-=Z}),e.has(we,"x")&&(we.x-=G),e.has(we,"y")&&(we.y-=Z)}),re.width=X-G+ce,re.height=ee-Z+ie}function M(W){e.forEach(W.edges(),function(G){var X=W.edge(G),Z=W.node(G.v),ee=W.node(G.w),re,ce;X.points?(re=X.points[0],ce=X.points[X.points.length-1]):(X.points=[],re=ee,ce=Z),X.points.unshift(g.intersectRect(Z,re)),X.points.push(g.intersectRect(ee,ce))})}function L(W){e.forEach(W.edges(),function(G){var X=W.edge(G);if(e.has(X,"x"))switch((X.labelpos==="l"||X.labelpos==="r")&&(X.width-=X.labeloffset),X.labelpos){case"l":X.x-=X.width/2+X.labeloffset;break;case"r":X.x+=X.width/2+X.labeloffset;break}})}function Y(W){e.forEach(W.edges(),function(G){var X=W.edge(G);X.reversed&&X.points.reverse()})}function K(W){e.forEach(W.nodes(),function(G){if(W.children(G).length){var X=W.node(G),Z=W.node(X.borderTop),ee=W.node(X.borderBottom),re=W.node(e.last(X.borderLeft)),ce=W.node(e.last(X.borderRight));X.width=Math.abs(ce.x-re.x),X.height=Math.abs(ee.y-Z.y),X.x=re.x+X.width/2,X.y=Z.y+X.height/2}}),e.forEach(W.nodes(),function(G){W.node(G).dummy==="border"&&W.removeNode(G)})}function D(W){e.forEach(W.edges(),function(G){if(G.v===G.w){var X=W.node(G.v);X.selfEdges||(X.selfEdges=[]),X.selfEdges.push({e:G,label:W.edge(G)}),W.removeEdge(G)}})}function z(W){var G=g.buildLayerMatrix(W);e.forEach(G,function(X){var Z=0;e.forEach(X,function(ee,re){var ce=W.node(ee);ce.order=re+Z,e.forEach(ce.selfEdges,function(ie){g.addDummyNode(W,"selfedge",{width:ie.label.width,height:ie.label.height,rank:ce.rank,order:re+ ++Z,e:ie.e,label:ie.label},"_se")}),delete ce.selfEdges})})}function F(W){e.forEach(W.nodes(),function(G){var X=W.node(G);if(X.dummy==="selfedge"){var Z=W.node(X.e.v),ee=Z.x+Z.width/2,re=Z.y,ce=X.x-ee,ie=Z.height/2;W.setEdge(X.e,X.label),W.removeNode(G),X.label.points=[{x:ee+2*ce/3,y:re-ie},{x:ee+5*ce/6,y:re-ie},{x:ee+ce,y:re},{x:ee+5*ce/6,y:re+ie},{x:ee+2*ce/3,y:re+ie}],X.label.x=X.x,X.label.y=X.y}})}function H(W,G){return e.mapValues(e.pick(W,G),Number)}function J(W){var G={};return e.forEach(W,function(X,Z){G[Z.toLowerCase()]=X}),G}return Cv}var Tv,yR;function eJ(){if(yR)return Tv;yR=1;var e=ct(),t=cn(),n=or().Graph;Tv={debugOrdering:r};function r(s){var i=t.buildLayerMatrix(s),l=new n({compound:!0,multigraph:!0}).setGraph({});return e.forEach(s.nodes(),function(u){l.setNode(u,{label:u}),l.setParent(u,"layer"+s.node(u).rank)}),e.forEach(s.edges(),function(u){l.setEdge(u.v,u.w,{},u.name)}),e.forEach(i,function(u,d){var f="layer"+d;l.setNode(f,{rank:"same"}),e.reduce(u,function(h,p){return l.setEdge(h,p,{style:"invis"}),p})}),l}return Tv}var Rv,wR;function tJ(){return wR||(wR=1,Rv="0.8.5"),Rv}var Av,vR;function nJ(){return vR||(vR=1,Av={graphlib:or(),layout:QZ(),debug:eJ(),util:{time:cn().time,notime:cn().notime},version:tJ()}),Av}var rJ=nJ();const xR=Bx(rJ),dd=240,LI=130,Mx=Ca*2+ix+yM,sJ=72,Vo=Mx+sJ,Du=24,PI=Ca*2+Du,hd=Vo;function DI(e,t){var r;let n=dd;for(const s of e)n=Math.max(n,((r=t.get(s.id))==null?void 0:r.width)??dd);return n}const fd=420,FI=1;function aJ(e,t,n,r){return Math.min(FI,n/Math.max(1,e),r/Math.max(1,t))}function sh(e){var n;return((n=e.data)==null?void 0:n.sessionId)??"_default"}function ah(e,t=()=>!0){const n=new Map;for(const r of e){if(!t(r))continue;const s=sh(r),i=n.get(s);i?i.push(r):n.set(s,[r])}return n}function oJ(e,t){return((t==null?void 0:t.get(e))??0)>0?fd:0}function iJ(e,t){const n=(t==null?void 0:t.get(e))??0;return n>0?6+n*36:0}function pd(e,t){const n=t.get(e);return{w:(n==null?void 0:n.width)??dd,h:(n==null?void 0:n.height)??LI}}function Il(e,t,n){const r=pd(e,t);return{w:r.w+oJ(e,n),h:Math.max(r.h,iJ(e,n))}}function lJ(e){return[...e.keys()].sort().map(t=>`${t}:${e.get(t)}`).join("|")}function cJ(e,t,n){const r=ah(e,s=>!t.has(s.id)&&n(s.id)!=null);if(r.size===0)return e;for(const s of r.values())s.sort((i,l)=>i.id.localeCompare(l.id));return e.map(s=>{var f;if(t.has(s.id)||n(s.id))return s;const i=r.get(sh(s));if(!i)return s;const l=(f=s.data)==null?void 0:f.parentId,u=i.find(h=>h.id===l)??i[0],d=n(u.id);return{...s,position:{x:s.position.x+d.x-u.position.x,y:s.position.y+d.y-u.position.y}}})}function uJ(e,t,n,r,s,i,l){const u=_=>Il(_,r,i),d=_=>n.get(_)??t.get(_),f=_=>{const{w:E,h:T}=pd(_,r);return{cw:E,ch:T}},h=l!=null&&l.width>0&&l.height>0,p=ah(e,_=>d(_.id)!=null),g=new Set;for(const[_,E]of p)E.every(T=>s.has(T.id)&&!n.has(T.id))&&g.add(_);const w=new Map,k=[];for(const _ of e){const E=d(_.id);if(!E)continue;const{w:T,h:R}=u(_.id),A=sh(_);g.has(A)?(w.get(A)??w.set(A,[]).get(A)).push(_):k.push({x:E.x,y:E.y,w:T,h:R,...f(_.id)})}if(w.size===0||h&&k.length===0)return[];const x=hd,b=(_,E,T,R)=>k.some(A=>_<A.x+A.w+Mx&&A.x<_+T+Mx&&E<A.y+A.h+x&&A.y<E+R+x),j=DI(e,r),S=[];for(const _ of[...w.keys()].sort()){const E=w.get(_);let T=1/0,R=1/0,A=-1/0,U=-1/0,I=-1/0,q=-1/0;for(const Y of E){const K=d(Y.id),{w:D,h:z}=u(Y.id),{cw:F,ch:H}=f(Y.id);T=Math.min(T,K.x),R=Math.min(R,K.y),A=Math.max(A,K.x+D),U=Math.max(U,K.y+z),I=Math.max(I,K.x+F),q=Math.max(q,K.y+H)}const P=A-T,O=U-R,V=[...new Set(k.map(Y=>Math.round(Y.x)))].sort((Y,K)=>Y-K),$=V.length?V:[T],M=[0,...k.map(Y=>Y.y+Y.h+x)].sort((Y,K)=>Y-K);let L=null;if(h){let Y=1/0,K=1/0,D=-1/0,z=-1/0;for(const X of k)Y=Math.min(Y,X.x),K=Math.min(K,X.y),D=Math.max(D,X.x+X.cw),z=Math.max(z,X.y+X.ch);const F=(X,Z)=>{const ee=l.width/(Math.max(D,X+I-T)-Math.min(Y,X)+fd),re=l.height/(Math.max(z,Z+q-R)-Math.min(K,Z));return[Math.min(FI,ee,re),Math.min(ee,re),Math.max(ee,re)]},H=(X,Z)=>{for(let ee=0;ee<X.length;ee++){if(X[ee]>Z[ee]+1e-9)return!0;if(X[ee]<Z[ee]-1e-9)return!1}return!1},J=Math.round(D+fd+j),W=[...new Set([...M,K])].sort((X,Z)=>X-Z);let G=null;for(const X of[...$,J])for(const Z of W){if(b(X,Z,P,O))continue;const ee=F(X,Z);(G===null||H(ee,G))&&(G=ee,L={x:X,y:Z})}L&&L.x===T&&L.y===R&&(L=null)}else e:for(const Y of $)for(const K of M){if(K>=R)break;if(!b(Y,K,P,O)){L={x:Y,y:K};break e}}if(L){const Y=L.x-T,K=L.y-R;for(const D of E){const z=d(D.id);t.set(D.id,{x:z.x+Y,y:z.y+K})}S.push(_)}for(const Y of E){const K=d(Y.id),{w:D,h:z}=u(Y.id);k.push({x:K.x,y:K.y,w:D,h:z,...f(Y.id)})}}return S}function dJ(e,t,n,r,s,i){const l=g=>Il(g,r,s),u=new Map(e.map(g=>[g.id,sh(g)])),d=[],f=e.map(g=>({id:g.id,pos:n.get(g.id)??t.get(g.id)})).filter(g=>g.pos!=null).sort((g,w)=>g.pos.y-w.pos.y||g.pos.x-w.pos.x||g.id.localeCompare(w.id)),h=g=>(i==null?void 0:i.has(g))===!0&&!n.has(g);for(const{id:g,pos:w}of f){if(!h(g))continue;const{w:k,h:x}=l(g);d.push({x:w.x,y:w.y,w:k,h:x,sid:u.get(g)??"_default"})}const p=[];for(const{id:g,pos:w}of f){if(h(g))continue;const{w:k,h:x}=l(g),b=u.get(g)??"_default";if(n.has(g)){d.push({x:w.x,y:w.y,w:k,h:x,sid:b});continue}let j=w.y;for(let S=0;S<d.length+1;S++){const _=d.find(E=>{const T=E.sid===b?Du:PI,R=E.sid===b?Du:hd;return w.x<E.x+E.w+T&&E.x<w.x+k+T&&j<E.y+E.h+R&&E.y<j+x+R});if(!_)break;j=_.y+_.h+(_.sid===b?Du:hd)}j!==w.y&&(t.set(g,{x:w.x,y:j}),p.push(g)),d.push({x:w.x,y:j,w:k,h:x,sid:b})}return p}function hJ(e,t,n,r,s,i=!1,l){const d=PI+1,f=hd+1,h=8,p=1.75,g=200,w=.7,k=.01,x=O=>Il(O,r,l),b=O=>n.get(O)??t.get(O),j=ah(e,O=>b(O.id)!=null),S=[],_=new Set,E=new Set,T=s.size===0;for(const O of[...j.keys()].sort()){const V=j.get(O);let $=1/0,M=1/0,L=-1/0,Y=-1/0,K=!1;for(const H of V){const J=b(H.id),{w:W,h:G}=x(H.id);$=Math.min($,J.x),M=Math.min(M,J.y),L=Math.max(L,J.x+W),Y=Math.max(Y,J.y+G),n.has(H.id)&&(K=!0)}const D=L-$,z=Y-M;E.add(O);const F=s.get(O);F&&(D>F.w+h||z>F.h+h)&&_.add(O),s.set(O,{w:D,h:z}),S.push({sid:O,members:V.map(H=>H.id),x:$,y:M,w:D,h:z,anchored:K,mass:1})}for(const O of[...s.keys()])E.has(O)||s.delete(O);if(i||T)return[];let R=!1;for(let O=0;O<S.length&&!R;O++)for(let V=O+1;V<S.length;V++){const $=S[O],M=S[V];if(!($.anchored&&M.anchored)&&Math.abs($.x+$.w/2-(M.x+M.w/2))<($.w+M.w)/2+d&&Math.abs($.y+$.h/2-(M.y+M.h/2))<($.h+M.h)/2+f){R=!0;break}}if(_.size===0&&!R)return[];if(_.size>0)for(const O of S)_.has(O.sid)&&(O.mass=8);else for(const O of S)O.mass=Math.max(1,O.w*O.h/(dd*LI));const A=new Map(S.map(O=>[O.sid,O.x])),U=new Map(S.map(O=>[O.sid,O.y])),I=new Map(S.map(O=>[O.sid,Math.min(0,O.x)])),q=new Map(S.map(O=>[O.sid,Math.min(0,O.y)]));for(let O=0;O<g;O++){const V=new Map,$=new Map;let M=0;for(let L=0;L<S.length;L++)for(let Y=L+1;Y<S.length;Y++){const K=S[L],D=S[Y];if(K.anchored&&D.anchored)continue;const z=K.x+K.w/2,F=K.y+K.h/2,H=D.x+D.w/2,J=D.y+D.h/2,W=(K.w+D.w)/2+d-Math.abs(z-H),G=(K.h+D.h)/2+f-Math.abs(F-J);if(W<=0||G<=0)continue;const X=(qe,Ue)=>!qe.anchored&&!(Ue<0&&qe.x<=I.get(qe.sid)),Z=(qe,Ue)=>!qe.anchored&&!(Ue<0&&qe.y<=q.get(qe.sid)),ee=(qe,Ue,et)=>{const ze=qe===Ue,at=ze?K.sid<D.sid?-1:1:Math.sign(qe-Ue);return et(K,at)||et(D,-at)?at:ze&&(et(K,-at)||et(D,at))?-at:0},re=ee(z,H,X),ce=ee(F,J,Z),ie=re!==0,fe=ce!==0;if(!ie&&!fe)continue;const de=ie&&(!fe||W*p<G),[we,xe,$e,be]=de?[re,W,V,X]:[ce,G,$,Z],he=be(K,we),se=be(D,-we),ke=K.mass,Ce=D.mass,Oe=he?se?Ce/(ke+Ce):1:0,Le=se?he?ke/(ke+Ce):1:0,Pe=xe*w;$e.set(K.sid,($e.get(K.sid)??0)+we*Pe*Oe),$e.set(D.sid,($e.get(D.sid)??0)-we*Pe*Le),M+=Pe}for(const L of S)L.anchored||(L.x=Math.max(I.get(L.sid),L.x+(V.get(L.sid)??0)),L.y=Math.max(q.get(L.sid),L.y+($.get(L.sid)??0)));if(M<k)break}const P=[];for(const O of S){const V=O.x-A.get(O.sid),$=O.y-U.get(O.sid);if(!(Math.abs(V)<1&&Math.abs($)<1)){for(const M of O.members){if(n.has(M))continue;const L=t.get(M);L&&t.set(M,{x:L.x+V,y:L.y+$})}P.push(O.sid)}}return P}function fJ(e,t,n,r,s,i){const l=new xR.graphlib.Graph;l.setDefaultEdgeLabel(()=>({})),l.setGraph({rankdir:n,marginx:0,marginy:0,nodesep:70,ranksep:160,edgesep:30});const u=e.filter(j=>!s.has(j)),d=new Set(u);for(const j of u){const{w:S,h:_}=Il(j,r,i);l.setNode(j,{width:S,height:_})}for(const j of t)d.has(j.source)&&d.has(j.target)&&l.setEdge(j.source,j.target);xR.layout(l);const f=new Map;let h=1/0,p=1/0,g=-1/0,w=-1/0;for(const j of u){const S=l.node(j);if(!S)continue;const{w:_,h:E}=pd(j,r),T=Il(j,r,i),R=S.x-T.w/2,A=S.y-T.h/2;f.set(j,{x:R,y:A}),R<h&&(h=R),A<p&&(p=A),R+_>g&&(g=R+_),A+E>w&&(w=A+E)}if(Number.isFinite(h)&&Number.isFinite(p))for(const[j,S]of f)f.set(j,{x:S.x-h,y:S.y-p});const k=Number.isFinite(g)?g-h:0,x=Number.isFinite(w)?w-p:0;let b=null;for(const j of e){const S=s.get(j);if(!S)continue;const{w:_,h:E}=pd(j,r);b=b===null?{minX:S.x,minY:S.y,maxX:S.x+_,maxY:S.y+E}:{minX:Math.min(b.minX,S.x),minY:Math.min(b.minY,S.y),maxX:Math.max(b.maxX,S.x+_),maxY:Math.max(b.maxY,S.y+E)}}return{positions:f,width:k,height:x,pinnedBox:b}}function qI(e,t,n){const r=n.direction??"LR",s=n.pinned??new Map,i=n.measured??new Map,l=n.lanes,u=ah(e);return{laid:Array.from(u.keys()).sort().map(h=>({sid:h,...fJ(u.get(h).map(p=>p.id),t,r,i,s,l)})),gap:DI(e,i)}}const BI=e=>e.reduce((t,n)=>Math.max(t,n.width),0)+fd,pJ=e=>e.reduce((t,n)=>t+n.height,0)+Vo*Math.max(0,e.length-1);function $x(e,t,n,r){const s=d=>{const f=[[]];let h=0;for(const p of e)h>0&&h+p.height>d&&(f.push([]),h=0),f[f.length-1].push(p),h+=p.height+Vo;return f},i=[];for(let d=0;d<e.length;d++){let f=-Vo;for(let h=d;h<e.length;h++)i.push(f+=e[h].height+Vo)}i.sort((d,f)=>d-f);const l=d=>{let f=0,h=i.length-1;for(;f<h;){const p=f+h>>1;s(i[p]).length<=d?h=p:f=p+1}return s(i[f])};let u=[e];if(n>0&&r>0){const d=h=>aJ(h.reduce((p,g)=>p+BI(g),0)+t*(h.length-1),Math.max(...h.map(pJ)),n,r);let f=d(u);for(let h=2;h<=e.length;h++){const p=l(h),g=d(p);g>f+1e-9&&(f=g,u=p)}}return u}function mJ(e,t,n,r,s){if(!(r.width>0&&r.height>0&&s.width>0&&s.height>0))return!1;const{laid:i,gap:l}=qI(e,t,n);return i.length<2?!1:$x(i,l,r.width,r.height).length!==$x(i,l,s.width,s.height).length}function gJ(e,t,n={}){const r=n.pinned??new Map,{laid:s,gap:i}=qI(e,t,n),l=$x(s,i,n.availableWidth??0,n.availableHeight??0),u=new Map;let d=0;for(const f of l){const h=BI(f);let p=0;for(const{positions:g,height:w,pinnedBox:k}of f){for(const[b,j]of g)u.set(b,{x:j.x+d,y:j.y+p});let x=p+w;k&&k.maxY>x&&k.minX<d+h&&d<k.maxX&&(x=k.maxY),p=x+Vo}d+=h+i}return e.map(f=>{const h=r.get(f.id);if(h)return{...f,position:h};const p=u.get(f.id);return p?{...f,position:p}:f})}function Fu(e,t,n){return!t.has(e)||n.has(e)}function yJ(e,t,n,r){return!t.has(e)&&Fu(e,n,r)}function wJ(e,t,n){const r={x:0,y:0};return t.set(e,r),n.add(e),r}function bR(e,t,n,r){n.set(e,t),r.delete(e)}const vJ=300,kR=130,xJ=160,NR=new WeakMap;function bJ(e,t){let n=NR.get(e);(!n||n.revision!==e.revision||n.open!==t)&&(n={revision:e.revision,open:t,byId:new Map,branches:wB(e.agents.values())},NR.set(e,n));const{byId:r,branches:s}=n;return i=>{let l=r.get(i.id);if(!l){const u=i.kind==="root"?s.get(i.sessionId):void 0;l=u?{...i,onOpenContext:t,branch:u}:{...i,onOpenContext:t},r.set(i.id,l)}return l}}function rb(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 kJ(e,t,n,r,s,i,l,u,d,f,h,p,g,w,k,x,b,j,S,_){var L,Y,K,D;const E=[],T=[],R=bJ(e,j);for(const z of e.agents.values()){if(!b.has(z.id))continue;const F=z.exitAt!=null,H=x!=null&&!x.has(z.id),J=[F?"rf-exiting":"",H?"rf-spotlit-out":""].filter(Boolean).join(" ")||void 0,W=i.get(z.id);if(E.push({id:z.id,type:"agent",position:{x:0,y:0},data:R(z),className:J,ariaLabel:$q(z,t,k.has(z.id)),...W?{width:W.width,height:W.height}:null}),z.parentId&&b.has(z.parentId)){const Z=Zu(z.sessionId),ee=F,re=k.size>0&&(k.has(z.id)||k.has(z.parentId)),ce=x!=null&&!x.has(z.id)&&!x.has(z.parentId),ie=z.state==="active"?2:1.5,fe=re?ie+1.5:ie,de=ee?.2:ce?.12:1,we=["sess-edge",z.state==="active"?"sess-live":"sess-idle",ee?"rf-edge-exiting":"",re?"rf-edge-selected":""].filter(Boolean).join(" ");T.push({id:`e:${z.parentId}->${z.id}`,source:z.parentId,target:z.id,animated:(z.state==="active"||re)&&!ee,type:"smoothstep",style:{"--session-hue":Z,strokeWidth:`calc(${fe}px * var(--edge-k, 1))`,opacity:de,transition:"var(--edge-transition)"},className:we})}const G=z.kind==="root"?Cd(z):null,X=G?J2(z.sessionId,G.at):null;if(G&&X&&!hB(X)){const Z=g0(z.id),ee=Zu(z.sessionId),re=i.get(Z);E.push({id:Z,type:"recapNote",position:{x:0,y:0},data:{sessionId:z.sessionId,parentId:z.id,recap:G,noteKey:X,hue:ee},className:H?"rf-spotlit-out":void 0,selectable:!1,focusable:!1,ariaLabel:`Claude Code's recap for ${z.label}`,...re?{width:re.width,height:re.height}:null}),T.push({id:`e:recap:${z.id}`,source:Z,target:z.id,type:"recapTie",className:"recap-edge",focusable:!1,style:{"--session-hue":ee}})}}const A=rb(e),U=_.size>0&&!(d&&S);U||_.clear();const I=`${g}#lanes:${lJ(A)}${U?"#held":""}`,q=new Set(E.filter(z=>z.type==="recapNote").map(z=>z.id));for(const z of Array.from(h.keys()))S&&gB(z)&&!q.has(z)&&!s.has(z)&&(h.delete(z),p.delete(z));const P=E.filter(z=>yJ(z.id,s,h,p));if(P.length>0||I!==w.current){if(P.length>0){for(const F of P)_.delete(F.id);const z=cJ(gJ(E,T,{direction:"LR",pinned:s,measured:i,availableWidth:n,availableHeight:r,lanes:A}),s,F=>Fu(F,h,p)?void 0:h.get(F));for(const F of z)Fu(F.id,h,p)&&bR(F.id,F.position,h,p);uJ(E,h,s,i,new Set(P.filter(F=>F.type!=="recapNote").map(F=>F.id)),A,{width:n,height:r});for(const F of P){if(F.type!=="recapNote")continue;const H=(L=F.data)==null?void 0:L.parentId;if(!H)continue;const J=s.get(H)??(Fu(H,h,p)?void 0:h.get(H));if(!J)continue;const W=((Y=i.get(F.id))==null?void 0:Y.width)??vJ,G=((K=i.get(F.id))==null?void 0:K.height)??kR,X=((D=i.get(H))==null?void 0:D.height)??kR;bR(F.id,{x:J.x-xJ-W,y:J.y+(X-G)/2},h,p)}}dJ(E,h,s,i,A,U?_:void 0),w.current=I}const O=hJ(E,h,s,i,l,!d||f,A);O.length>0&&u(O);const V=PK(e.agents.values());S&&ku(h,V),ku(p,V),S&&ku(s,V),ku(i,LK(e.agents.values()));const $=[];let M=!1;for(const z of E){let F=s.get(z.id)??h.get(z.id);F||(F=wJ(z.id,h,p),M=!0),$.push({...z,position:F})}return M&&(w.current=""),{nodes:$,edges:T}}function NJ(e){return e.slice().sort((t,n)=>t.y-n.y||t.x-n.x)}function jJ(e,t,n){var l;if(e.length===0)return null;const r=NJ(e),s=t?r.findIndex(u=>u.id===t):-1,i=s===-1?n===1?0:r.length-1:(s+n+r.length)%r.length;return((l=r[i])==null?void 0:l.id)??null}const SJ=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Escape","Backspace"]);function _J(e,t){return t==null?{kind:"deck",nodeId:null}:e.key==="Enter"||e.key===" "?{kind:"activate",nodeId:t,additive:e.shiftKey}:SJ.has(e.key)?{kind:"node",nodeId:t}:{kind:"deck",nodeId:t}}const EJ=new Set(["","BODY","HTML","#DOCUMENT"]);function CJ(e){return!e||Ed(e)?!1:!EJ.has(String(e.tagName??"").toUpperCase())}const UI="react-flow__node";function sb(e){var t,n;return!!e&&((n=(t=e.classList)==null?void 0:t.contains)==null?void 0:n.call(t,UI))===!0}function TJ(e){try{const t=document.querySelector(`.${UI}[data-id="${CSS.escape(e)}"]`);t==null||t.focus({preventScroll:!0})}catch{}}let $a=null,Fo=null;const Ix=new Set,Ox=()=>{for(const e of Ix)e()},RJ=e=>(Ix.add(e),()=>{Ix.delete(e)}),jR=()=>$a,AJ=90;function zI(e){!Fo||e!=null&&Fo.at.id!==e||(clearTimeout(Fo.timer),Fo=null)}function HI(e,t,n="pointer"){zI();const r={id:e,anchor:t,by:n};if($a||n==="focus"){$a=r,Ox();return}Fo={at:r,timer:setTimeout(()=>{Fo=null,$a=r,Ox()},AJ)}}function Gs(e){zI(e),!(!$a||e!=null&&$a.id!==e)&&($a=null,Ox())}function MJ({agentFor:e,recapFor:t,labelFor:n,bounds:r}){const s=v.useSyncExternalStore(RJ,jR,jR),i=s?e(s.id):void 0,l=s&&!i?t(s.id):void 0,u=s!=null&&(!i&&!l||!s.anchor.isConnected);return v.useEffect(()=>{u&&s&&Gs(s.id)},[u,s]),!s||u?null:i?a.jsx(IJ,{a:i,anchor:s.anchor,parentLabel:i.parentId?n(i.parentId):void 0,bounds:r},s.id):l?a.jsx($J,{r:l,anchor:s.anchor,bounds:r},s.id):null}function WI(e,t){const n=v.useRef(null),r=v.useCallback(()=>{const s=n.current;if(!s||!e.isConnected)return;const i=S0(e.getBoundingClientRect(),{width:s.offsetWidth,height:s.offsetHeight},t());s.style.top=`${i.top}px`,s.style.left=`${i.left}px`,s.style.maxHeight=i.maxHeight==null?"":`${i.maxHeight}px`,s.dataset.side=i.side},[e,t]);return v.useLayoutEffect(()=>{r()}),n}function $J({r:e,anchor:t,bounds:n}){const r=WI(t,n),s=ui(3e4),i=td(e.recap.at,s);return Ot.createPortal(a.jsxs("div",{ref:r,className:"ap-peek node-peek recap-peek",role:"tooltip",id:"node-peek",style:{"--session-hue":e.hue},children:[a.jsxs("div",{className:"node-peek-head",children:[a.jsxs("span",{className:"recap-peek-mark",children:[a.jsx(El,{}),"recap"]}),a.jsx("span",{className:"node-peek-time",title:i.title,children:i.label})]}),e.sessionLabel&&a.jsx("div",{className:"node-peek-kind",children:a.jsxs("span",{children:["Claude Code's recap of ",e.sessionLabel]})}),a.jsx("p",{className:"recap-peek-text",children:e.recap.text}),a.jsx("p",{className:"node-peek-hint",children:"Click to go to the session · double-click for its details"})]}),document.body)}function IJ({a:e,anchor:t,parentLabel:n,bounds:r}){const s=WI(t,r),i=ui(1e3),l=p0(e.sessionName,e.sessionTitle),u=e.tools.filter(k=>k.ok===!1).length,d=e.tools.filter(k=>!k.endedAt).length,f=un(e,i).total,h=e.usage.inputTokens+e.usage.outputTokens,p=e.kind==="root"&&lr(e.waiting),g=e.kind==="root"?"session":n?`subagent of ${n}`:"subagent",w=[`${e.toolCount} ${e.toolCount===1?"tool":"tools"}`,d>0?`${d} in-flight`:null,h>0?`${st(h)} tok`:null,f>0?`${Be(f)}${_l(e,i)>0?"+":""}`:null].filter(Boolean).join(" · ");return Ot.createPortal(a.jsxs("div",{ref:s,className:"ap-peek node-peek",role:"tooltip",id:"node-peek",children:[a.jsxs("div",{className:"node-peek-head",children:[a.jsx("span",{className:"node-peek-name",children:e.label}),a.jsxs("span",{className:"node-peek-time",children:[e.synthetic?"≥ ":"",Qo(e.startedAt,e.endedAt,i)]})]}),a.jsxs("div",{className:"node-peek-kind",children:[a.jsxs("span",{className:"node-peek-state","data-kind":nx(e.state),children:[a.jsx(oM,{kind:nx(e.state)}),Zo(e.state)]}),a.jsx("span",{children:g}),e.model?a.jsx("span",{children:Ws(e.model)}):null]}),e.kind==="root"&&l.face&&a.jsx("p",{className:"node-peek-title",children:l.face}),e.kind==="root"&&e.waiting&&a.jsxs("p",{className:`node-peek-wait${p?" warn":""}`,children:[p&&a.jsx(v0,{}),a.jsx("span",{children:f0(e.waiting)}),a.jsx("b",{children:Qo(e.waiting.since,void 0,i)})]}),a.jsxs("p",{className:"node-peek-facts",children:[w,u>0&&a.jsxs("span",{className:"node-peek-failed",children:[" · ",u," failed"]})]}),e.branch&&e.branch.total>0&&a.jsx("p",{className:"node-peek-branch",children:Q2(e.branch)}),a.jsx("p",{className:"node-peek-hint",children:"Click to go to the session · double-click for details"})]}),document.body)}function OJ(e){const t=e.minZoom??BG,n=e.maxZoom??UG,r=e.fill??.9,s=e.insets.left,i=e.insets.top,l=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),d=e.context,f=e.anchor,h=Math.min(l/Math.max(1,d.width),u/Math.max(1,d.height))*r,p=Math.max(t,Math.min(n,h)),g=(w,k,x,b,j,S)=>{let _=w+(k-b*p)/2-x*p;const E=j*p+_,T=(j+S)*p+_;return S*p<=k?E<w?_+=w-E:T>w+k&&(_-=T-(w+k)):_+=w-E,_};return{x:g(s,l,d.x,d.width,f.x,f.width),y:g(i,u,d.y,d.height,f.y,f.height),zoom:p}}function LJ(e){let t=1/0,n=1/0,r=-1/0,s=-1/0;for(const i of e)t=Math.min(t,i.x),n=Math.min(n,i.y),r=Math.max(r,i.x+i.width),s=Math.max(s,i.y+i.height);return Number.isFinite(t)?{x:t,y:n,width:r-t,height:s-n}:null}function xn(e){const t=v.useRef(e);return t.current=e,t}const Lx=80,Px=.86;function VI(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 s=r.getBoundingClientRect();s.width>0&&s.left>t.left&&(n=Math.min(n,s.left))}return Math.max(0,t.right-n)}function PJ({canvasRef:e,canvasSize:t,machinePhase:n,usagePhase:r,usagePanelOpen:s,detailShown:i}){const[l,u]=v.useState(0);v.useEffect(()=>{const p=VI(e.current);u(g=>Math.abs(g-p)>40?p:g)},[n,r,s,i,t.w]);const d=xn(l),f=t.w>0?Math.max(0,(t.w-l-Lx*2)*Px):0,h=t.h>0?Math.max(0,(t.h-Lx*2)*Px):0;return{railInsetRef:d,availableWidth:f,availableHeight:h}}const GI=420;function DJ(){const e=oi(),t=xt(),n=v.useCallback((d,f)=>{if(Qv({durationMs:f,documentHidden:document.hidden})){e.setViewport(d,{duration:f});return}const{d3Zoom:h,d3Selection:p}=t.getState(),g=p==null?void 0:p.property("__zoom");if(h&&p&&g&&g.k>0&&d.zoom>0){h.transform(p,g.scale(d.zoom/g.k).translate((d.x-g.x)/d.zoom,(d.y-g.y)/d.zoom));return}e.setViewport(d,{duration:0})},[e,t]),r=v.useRef(null),s=v.useRef(0),i=v.useRef(0),l=v.useCallback((d,f)=>{const h=++s.current;return n(d,f),i.current=Date.now(),r.current=Qv({durationMs:f,documentHidden:document.hidden})?{target:d,until:Date.now()+f+60}:null,h},[n]),u=v.useCallback((d=500)=>{const f=Lx,h=1,p=.2,g=Px;try{const w=document.querySelector(".canvas-wrap"),k=Array.from(document.querySelectorAll(".react-flow__node")).filter(M=>M.offsetWidth>0);if(!w||k.length===0)return;const x=w.getBoundingClientRect(),b=e.getViewport();if(!Number.isFinite(b.zoom)||b.zoom<=0)return;const j=M=>(M-x.left-b.x)/b.zoom,S=M=>(M-x.top-b.y)/b.zoom,_=k.map(M=>M.getBoundingClientRect()),E=Math.min(..._.map(M=>j(M.left))),T=Math.max(..._.map(M=>j(M.right))),R=Math.min(..._.map(M=>S(M.top))),A=Math.max(..._.map(M=>S(M.bottom))),U=T-E,I=A-R;if(!(U>0&&I>0))return;const q=VI(w),P=M=>Math.max(p,Math.min(h,(x.width-q-f*2)/(U+M)*g,(x.height-f*2)/I*g)),O=qG(P(GI),P(0)),V={x:f-E*O,y:Math.max(f,(x.height-I*O)/2)-R*O,zoom:O},$=l(V,d);window.setTimeout(()=>{var M;try{if(((M=r.current)==null?void 0:M.target)===V&&(r.current=null),s.current!==$)return;const L=e.getViewport();(Math.abs(L.zoom-O)>.01||Math.abs(L.x-V.x)>2)&&n(V,0)}catch{}},d+60)}catch{}},[e,n,l]);return v.useEffect(()=>{const d=()=>{if(!document.hidden)return;const f=r.current;if(r.current=null,!(!f||Date.now()>f.until)){try{n(f.target,0)}catch{}i.current=Date.now()}};return document.addEventListener("visibilitychange",d),()=>document.removeEventListener("visibilitychange",d)},[n]),{applyViewport:n,moveCamera:l,fitLeft:u,cameraEpochRef:s,lastFitTimeRef:i}}const FJ=450;function qJ({canvasRef:e,stateRef:t,measuredRef:n,nodesRef:r,railInsetRef:s,moveCamera:i,disableAutoFit:l,lastFocusRef:u,focusAgentRef:d,selectAgent:f,primarySelectedIdRef:h}){const p=v.useCallback(k=>{var U;const x=e.current,b=t.current.agents.get(k);if(!x||!b)return;const j=rb(t.current),S=(I,q)=>{const P=n.current.get(I.id);if(!P)return null;const O=q&&j.has(I.id)?GI:0;return{x:I.position.x,y:I.position.y,width:P.width+O,height:P.height}},_=r.current.find(I=>I.id===k),E=_?S(_,!1):null;if(!E)return;const T=[];for(const I of r.current){if(I.type!=="agent"&&I.type!=="recapNote"||((U=I.data)==null?void 0:U.sessionId)!==b.sessionId)continue;const q=S(I,I.type==="agent");q&&T.push(q)}const R=x.getBoundingClientRect(),A=OJ({pane:{width:R.width,height:R.height},insets:{top:56,left:72,bottom:32,right:s.current+32},context:LJ(T)??E,anchor:E});Gs(),l(),u.current={id:k,at:Date.now()},i(A,FJ)},[i,l]);d.current=p;const g=v.useCallback(k=>{const x=r.current.filter(_=>_.type==="agent"),b=jJ(x.map(_=>({id:_.id,x:_.position.x,y:_.position.y})),h.current,k),j=b?x.find(_=>_.id===b):void 0;if(!j)return;const S=sb(document.activeElement);f(j.id,!1),window.setTimeout(()=>{try{p(j.id)}catch{}S&&TJ(j.id)},30)},[f,p]),w=v.useCallback(k=>{f(k,!1),window.setTimeout(()=>{try{p(k)}catch{}},60)},[f,p]);return{focusAgent:p,stepAgent:g,focusSession:w}}function BJ({nodesRef:e,stateRef:t,canvasRef:n,railInsetRef:r}){const s=v.useCallback(d=>{const f=e.current.find(h=>h.id===d&&h.type==="agent");return f?f.data:void 0},[]),i=v.useCallback(d=>{var f;return(f=t.current.agents.get(d))==null?void 0:f.label},[]),l=v.useCallback(d=>{var p;const f=e.current.find(g=>g.id===d&&g.type==="recapNote");if(!f)return;const h=f.data;return{recap:h.recap,hue:h.hue,sessionLabel:(p=t.current.agents.get(h.parentId))==null?void 0:p.label}},[]),u=v.useCallback(()=>{var h;const d=(h=n.current)==null?void 0:h.getBoundingClientRect(),f=document.documentElement;return d?{width:d.right-r.current,height:d.bottom}:{width:f.clientWidth,height:f.clientHeight}},[]);return{peekAgent:s,peekLabel:i,peekRecap:l,peekBounds:u}}function UJ(e){const t=new Set(e.pins),n=new Map,r=new Map;for(const[s,i]of e.positions)n.set(s,i),t.has(s)&&r.set(s,i);return{positions:n,pinned:r,restored:new Set(n.keys())}}function SR(e){return Object.entries(e??{}).filter(([,t])=>t&&typeof t.x=="number"&&typeof t.y=="number")}function zJ(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 s=SR(n);return{positions:s,pins:s.map(([i])=>i)}}const r=n;return{positions:SR(r.positions),pins:Array.isArray(r.pins)?r.pins:[]}}function HJ(e,t){const n={};for(const[r,s]of e)n[r]=s;for(const[r,s]of t)n[r]=s;return JSON.stringify({v:2,positions:n,pins:Array.from(t.keys())})}function WJ(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 ab="agent-dag.layout",ob="agent-dag.layoutFrame",ib="agent-dag.viewport";function VJ(){return zJ(Qe(ab))}function Ol(e,t){Xe(ab,HJ(e,t))}function GJ(){return WJ(Qe(ob))}function KI(e){Xe(ob,JSON.stringify(e))}function KJ(){return f6(Qe(ib))}function YJ(e){Xe(ib,JSON.stringify(e))}function YI(){Zr(ab),Zr(ib),Zr(ob)}function XJ(e){const t=v.useState(()=>UJ(VJ()))[0],n=v.useRef(t.pinned),r=v.useRef(t.positions),s=v.useRef(new Set),i=v.useRef(""),[l,u]=v.useState(0),d=v.useState(GJ)[0],f=v.useRef(d),h=v.useCallback(()=>{n.current.clear(),r.current.clear(),i.current="",YI(),u(p=>p+1),window.setTimeout(()=>{Ol(r.current,n.current),f.current&&KI(f.current),e(500)},80)},[e]);return{restoredLayout:t,pinnedRef:n,positionsRef:r,provisionalRef:s,lastLayoutSigRef:i,layoutEpoch:l,setLayoutEpoch:u,lastLayoutFrameRef:f,handleRelayout:h}}function ZJ(e,t){const{positionsRef:n,pinnedRef:r}=t,s=v.useRef(null);v.useEffect(()=>(s.current!=null&&window.clearTimeout(s.current),s.current=window.setTimeout(()=>{Ol(n.current,r.current)},1500),()=>{s.current!=null&&window.clearTimeout(s.current)}),[e])}function JJ({nodes:e,edges:t,settled:n,dragging:r,availableWidth:s,availableHeight:i,layout:l,camera:u,rf:d,measuredRef:f,stateRef:h,lastFocusRef:p,primarySelectedIdRef:g,focusAgentRef:w,autoFitDisabledRef:k}){const{lastLayoutFrameRef:x,pinnedRef:b,positionsRef:j,provisionalRef:S,lastLayoutSigRef:_,setLayoutEpoch:E}=l,{applyViewport:T,fitLeft:R,cameraEpochRef:A,lastFitTimeRef:U}=u;v.useEffect(()=>{if(!n||r)return;const I={width:s,height:i};if(!(I.width>0&&I.height>0))return;const q=x.current;if(x.current=I,KI(I),!q||q.width===I.width&&q.height===I.height)return;const P={direction:"LR",pinned:b.current,measured:f.current,lanes:rb(h.current)};if(!mJ(e,t,P,q,I))return;const O=p.current&&Date.now()-p.current.at<1500?p.current.id:null,V=O??g.current,$=V?b.current.get(V)??j.current.get(V):void 0;for(const M of Array.from(j.current.keys()))b.current.has(M)||j.current.delete(M);S.current.clear(),_.current="",E(M=>M+1),window.setTimeout(()=>{if(Ol(j.current,b.current),k.current){if(O){w.current(O);return}const M=V?b.current.get(V)??j.current.get(V):void 0;if($&&M&&(M.x!==$.x||M.y!==$.y)){const L=d.getViewport();A.current+=1,T({x:L.x-(M.x-$.x)*L.zoom,y:L.y-(M.y-$.y)*L.zoom,zoom:L.zoom},0),U.current=Date.now()}return}R(500)},80)},[s,i,n,r,R,d,T])}const QJ=600;function lb(e,t){return!(e.exitAt!=null&&t-e.exitAt>QJ||e.kind==="root"&&e.state==="done"&&e.tools.length===0&&e.endedAt!=null&&e.endedAt-e.startedAt<3e3)}function eQ(e,t){const n=new Set;for(const r of e.agents.values())lb(r,t)&&n.add(r.id);return n}function tQ(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 nQ(e,t,n=0){if(!e)return!1;for(const r of t)if(tQ(e,r,n))return!0;return!1}function rQ(e,t,n,r,s){const i=[];for(const l of e)!lb(l,t)||n.has(l.id)||i.push(l.id+(l.parentId?`>${l.parentId}`:""));return i.sort(),`${i.join("|")}#sv${r}.${s}`}const cb="agent-dag.removedNodes";function sQ(e){try{const t=JSON.parse((e==null?void 0:e.getItem(cb))??"[]");return new Set(Array.isArray(t)?t.filter(n=>typeof n=="string"):[])}catch{return new Set}}function _R(e,t){try{e==null||e.setItem(cb,JSON.stringify([...t]))}catch{}}function XI(e,t){const n=new Map(e.map(i=>[i.id,i.parentId])),r=new Set(t),s=i=>{if(r.has(i))return!0;const l=new Set([i]);let u=n.get(i);for(;u&&!l.has(u);){if(r.has(u))return r.add(i),!0;l.add(u),u=n.get(u)}return!1};return i=>s(i.id)||s(i.sessionId??i.id)}function aQ(e,t){if(t.size===0)return new Set;const n=[...e],r=XI(n,t);return new Set(n.filter(r).map(s=>s.id))}function oQ(e,t,n){const r=u=>({id:u.id,parentId:u.data.parentId,sessionId:u.data.sessionId}),s=XI(e.map(r),n),i=e.filter(u=>!s(r(u))),l=new Set(i.map(u=>u.id));return{nodes:i,edges:t.filter(u=>l.has(u.source)&&l.has(u.target))}}function iQ(e,t){let n=null;for(const r of t)e.has(r)&&(n??(n=new Set(e)),n.delete(r));return n??e}function lQ(e,t){return t.size===0?[]:[...e].filter(n=>t.has(n.id)).map(n=>n.id)}function cQ(e){let t=e.kind==="subagent"?e.startedAt:-1/0;const n=e.tools[e.tools.length-1];n&&n.startedAt>t&&(t=n.startedAt);const r=e.prompts[e.prompts.length-1];return r&&r.at>t&&(t=r.at),e.lastOutputAt!=null&&e.lastOutputAt>t&&(t=e.lastOutputAt),t}function uQ(e,t,n){let r=null;for(const s of t)e.has(s)||(r??(r=new Map(e)),r.set(s,n));for(const s of e.keys())t.has(s)||(r??(r=new Map(e)),r.delete(s));return r??e}function dQ(e,t,n,r){if(n.size===0)return[];let s=1/0;for(const l of r.values())l<s&&(s=l);const i=new Set;for(const l of t){const u=e.get(l);if(!u)continue;const d=cQ(u);if(d<=s)continue;const f=[],h=new Set,p=w=>{var k;for(let x=w;x&&!h.has(x);x=(k=e.get(x))==null?void 0:k.parentId)h.add(x),n.has(x)&&f.push(x)};p(u.id),p(u.sessionId);let g=-1/0;for(const w of f)g=Math.max(g,r.get(w)??1/0);if(d>g)for(const w of f)i.add(w)}return[...i]}const ZI="sessionGroup";function hQ(e,t){var r,s;if(e.type===ZI)return"transparent";if(lr((r=e.data)==null?void 0:r.waiting))return t("--warn");if(e.type==="recapNote")return t("--muted");const n=(s=e.data)==null?void 0:s.state;return t(n==="err"?"--err":n==="active"?"--inflight":"--ok")}const Nu=Ca;function fQ(e){const t=new Map;for(const r of e){const s=r.data;if(!(s!=null&&s.sessionId)||s.exitAt!=null)continue;const i=r.width,l=r.height;if(i==null||l==null)continue;const u=r.position.x,d=r.position.y,f=u+i,h=d+l,p=t.get(s.sessionId);p?(p.minX=Math.min(p.minX,u),p.minY=Math.min(p.minY,d),p.maxX=Math.max(p.maxX,f),p.maxY=Math.max(p.maxY,h)):t.set(s.sessionId,{minX:u,minY:d,maxX:f,maxY:h})}const n=[];for(const[r,s]of t){const i=s.maxX-s.minX+Nu*2,l=s.maxY-s.minY+Nu*2;n.push({id:`group:${r}`,type:ZI,position:{x:s.minX-Nu,y:s.minY-Nu},data:{sessionId:r,w:i,h:l},width:i,height:l,style:{width:i,height:l},zIndex:-1,draggable:!0,selectable:!1,focusable:!1,deletable:!1,connectable:!1})}return n}function pQ(e,t){if(!t||!e.agents.get(t))return null;const r=new Set([t]);let s=t;for(;s;){const l=e.agents.get(s);if(!(l!=null&&l.parentId)||r.has(l.parentId))break;r.add(l.parentId),s=l.parentId}let i=!0;for(;i;){i=!1;for(const l of e.agents.values())l.parentId&&r.has(l.parentId)&&!r.has(l.id)&&(r.add(l.id),i=!0)}return r}function mQ(e,t){const n=new Set;for(const r of t){const s=pQ(e,r);if(s)for(const i of s)n.add(i)}return n.size>0?n:null}function gQ({stateRef:e,now:t,removedAgentIds:n,sizeVersion:r,domSizeVersion:s}){return v.useMemo(()=>rQ(e.current.agents.values(),t,n,r,s),[e.current,e.current.revision,t,r,s,n])}function yQ({stateRef:e,now:t,availableWidth:n,availableHeight:r,layout:s,measuredRef:i,onBubble:l,settled:u,dragging:d,layoutSig:f,selectedIds:h,openContext:p,historyReplayed:g,removedNodes:w,removedAgentIds:k,dragTick:x,dragPatchRef:b,dragMoveTick:j}){const{pinnedRef:S,positionsRef:_,provisionalRef:E,lastLayoutSigRef:T,restoredLayout:R,layoutEpoch:A}=s,U=v.useMemo(()=>mQ(e.current,h),[e.current,e.current.revision,h]),I=v.useMemo(()=>{const L=eQ(e.current,t);for(const Y of k)L.delete(Y);return L},[e.current,e.current.revision,t,k]),q=v.useRef(new Map),P=yB(),{nodes:O,edges:V}=v.useMemo(()=>{const L=kJ(e.current,t,n,r,S.current,i.current,q.current,l,u,d,_.current,E.current,f,T,h,U,I,p,g,R.restored);return oQ(L.nodes,L.edges,w)},[e.current,e.current.revision,t,n,r,u,d,f,h,U,I,p,x,P,w,A,g]),$=v.useMemo(()=>fQ(O),[O]),M=v.useMemo(()=>{const L=[...$,...O],Y=b.current;return!Y||Y.size===0?L:L.map(K=>{const D=Y.get(K.id);return D?{...K,position:D}:K})},[$,O,j]);return{spotlightSet:U,visibleAgentIds:I,nodes:O,edges:V,allNodes:M}}function wQ(e,t,n){const r=e.x*t.zoom+t.x,s=e.y*t.zoom+t.y,i=(e.x+e.width)*t.zoom+t.x,l=(e.y+e.height)*t.zoom+t.y;return i>0&&r<n.width&&l>0&&s<n.height}function vQ({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 s of n)if(r=!0,wQ(s,t,e))return!1;return r}function xQ({layoutSig:e,rf:t,stateRef:n,measuredRef:r,pinnedRef:s,positionsRef:i,paneSizeRef:l,lastInteractRef:u,autoFitDisabledRef:d,lastFitTimeRef:f,fitLeft:h}){const p=v.useRef(null),g=v.useRef("");v.useEffect(()=>{const w=setInterval(()=>{if(d.current||Date.now()-u.current<800)return;const k=n.current,x=Date.now(),b=[];for(const S of k.agents.values())lb(S,x)&&b.push({id:S.id});if(b.length===0)return;const j=[];for(const{id:S}of b){const _=r.current.get(S),E=s.current.get(S)??i.current.get(S);!_||!E||j.push({x:E.x,y:E.y,width:_.width,height:_.height})}vQ({pane:l.current,viewport:t.getViewport(),boxes:j})&&h(600)},1500);return()=>clearInterval(w)},[t]),v.useEffect(()=>{if(g.current===e)return;const w=g.current;if(g.current=e,!w||d.current)return;Date.now()-f.current>1200&&h(400),p.current&&window.clearTimeout(p.current),p.current=window.setTimeout(()=>{d.current||h(500)},280)},[e,t,h])}function bQ({stateRef:e,pinnedRef:t,positionsRef:n,canvasRef:r,clearSelection:s,primarySelectedId:i}){const[l,u]=v.useState(()=>sQ(fl())),[d,f]=v.useState(null),h=v.useMemo(()=>aQ(e.current.agents.values(),l),[e.current,e.current.revision,l]),p=v.useCallback(j=>{const S=e.current.agents.get(j);S&&(u(_=>{const E=new Set(_);return E.add(j),_R(fl(),E),E}),f({id:j,label:S.label}),t.current.delete(j),n.current.delete(j),s())},[s]),g=v.useCallback(()=>{i&&p(i)},[i,p]),w=d&&l.has(d.id)?d:null;v.useEffect(()=>{var j;d&&((j=r.current)==null||j.focus())},[d]);const k=v.useCallback(j=>{const S=[...j];u(_=>{const E=iQ(_,S);return E!==_&&_R(fl(),E),E})},[]),x=v.useCallback(()=>{k([...l]),f(null)},[k,l]),b=v.useCallback(()=>{u(new Set),f(null),Zr(cb)},[]);return{removedNodes:l,lastRemoval:d,removedAgentIds:h,removeNode:p,removeSelectedNode:g,removalNotice:w,bringBack:k,bringBackAll:x,forgetRemovals:b}}function kQ({stateRef:e,waitingSessions:t,removedAgentIds:n,removedNodes:r,bringBack:s}){const i=v.useRef(new Map);v.useEffect(()=>{i.current=uQ(i.current,r,Date.now());const l=[...lQ(t,n),...dQ(e.current.agents,n,r,i.current)];l.length>0&&s(l)},[t,n,r,s])}function NQ({waiting:e,running:t,connected:n=!0}){return{title:e>0?`(${e}) ${vt}`:vt,icon:n?e>0?"waiting":t>0?"running":"idle":"offline"}}const ju={offline:"#e05252",waiting:"#c97d12",running:"#2a90d4",idle:"#7e828c"};function Su(e,t){const s=l=>`<circle cx="16" cy="16" r="12" fill="none" stroke="${e}" stroke-width="5"${l}/>`;return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">${t==="waiting"?`<circle cx="16" cy="16" r="14.5" fill="${e}"/>`:t==="offline"?s(` stroke-dasharray="${56.5485.toFixed(2)} ${18.8495.toFixed(2)}" transform="rotate(-58 16 16)"`):s("")+(t==="running"?`<circle cx="16" cy="16" r="5" fill="${e}"/>`:"")}</svg>`}const jQ=Object.freeze({offline:`data:image/svg+xml,${encodeURIComponent(Su(ju.offline,"offline"))}`,waiting:`data:image/svg+xml,${encodeURIComponent(Su(ju.waiting,"waiting"))}`,running:`data:image/svg+xml,${encodeURIComponent(Su(ju.running,"running"))}`,idle:`data:image/svg+xml,${encodeURIComponent(Su(ju.idle,"idle"))}`});function SQ({stateRef:e,waitingSessions:t,live:n}){const r=v.useMemo(()=>Sq(e.current.agents.values()),[e.current,e.current.revision]),s=v.useRef(null);v.useEffect(()=>{const i=NQ({waiting:t.length,running:r,connected:n}),l=s.current;if(s.current=i,(l==null?void 0:l.title)!==i.title&&(document.title=i.title),(l==null?void 0:l.icon)!==i.icon){const u=document.querySelector('link[rel="icon"]');u&&(u.href=jQ[i.icon])}},[t.length,r,n])}const _Q=1200,EQ=1e3;function Mv(e){return e.lastDeckFitAt>0&&e.at-e.lastDeckFitAt<_Q?!1:e.hasSourceEvent?!0:e.lastCanvasInputAt>0&&e.at-e.lastCanvasInputAt<EQ}function CQ({applyViewport:e,lastFitTimeRef:t,cameraEpochRef:n,disableAutoFit:r,markInteract:s,canvasRef:i,applyZoom:l}){const u=v.useState(()=>KJ())[0];v.useEffect(()=>{if(!u)return;const k=window.setTimeout(()=>{try{e(u,0)}catch{}t.current=Date.now()},60);return()=>window.clearTimeout(k)},[e,u]);const d=v.useRef(null),f=v.useRef(0),h=v.useCallback(()=>{f.current=Date.now()},[]),p=v.useCallback(k=>({hasSourceEvent:!!k,at:Date.now(),lastDeckFitAt:t.current,lastCanvasInputAt:f.current}),[]);return{restoredViewport:u,markCanvasInput:h,onMoveStart:k=>{Gs(),Mv(p(k))&&(n.current+=1),Mv(p(k))&&r()},onMove:(k,x)=>{var b;s(),Mv(p(k))&&r(),(b=i.current)==null||b.style.setProperty("--zoom",String(x.zoom)),l(x.zoom)==="detail"&&Gs(),d.current&&window.clearTimeout(d.current),d.current=window.setTimeout(()=>YJ(x),250)}}}function TQ({clearSelection:e,selectAgent:t,detailOpen:n,setDetailOpen:r,detailShown:s,focusAgent:i,draggingRef:l,lodRef:u}){return{onNodeClick:(w,k)=>{if(k.type==="sessionGroup"){e();return}const x=k.type==="recapNote"?k.data.parentId:k.id;t(x,w.shiftKey,!1),!w.shiftKey&&(n&&r(!1),s?window.setTimeout(()=>{try{i(x)}catch{}},80):i(x))},onPaneClick:()=>{Gs(),e()},onNodeDoubleClick:(w,k)=>{if(k.type!=="agent"&&k.type!=="recapNote")return;const x=k.type==="recapNote"?k.data.parentId:k.id;t(x,!1),window.setTimeout(()=>{try{i(x)}catch{}},80)},onNodeMouseEnter:(w,k)=>{k.type!=="agent"&&k.type!=="recapNote"||l.current||u.current==null||u.current==="detail"||HI(k.id,w.currentTarget)},onNodeMouseLeave:(w,k)=>Gs(k.id)}}function RQ(){const e=v.useRef(null),t=v.useRef(null),[n,r]=v.useState({w:0,h:0});return v.useEffect(()=>{const s=t.current;if(!s||typeof ResizeObserver>"u")return;const i=new ResizeObserver(l=>{var d;const u=(d=l[0])==null?void 0:d.contentRect;u&&(e.current={width:u.width,height:u.height},r(f=>Math.abs(f.w-u.width)>40||Math.abs(f.h-u.height)>40?{w:u.width,h:u.height}:f))});return i.observe(s),e.current={width:s.clientWidth,height:s.clientHeight},r({w:s.clientWidth,h:s.clientHeight}),()=>i.disconnect()},[]),{canvasRef:t,canvasSize:n,paneSizeRef:e}}function AQ(e){const t=v.useRef(new Map),n=v.useRef(0),r=v.useCallback(u=>{const d=t.current;let f=!1;for(const h of u.nodeInternals.values()){const p=h.width,g=h.height;if(p==null||g==null)continue;const w=d.get(h.id);w?(Math.abs(w.height-g)>4||Math.abs(w.width-p)>4)&&(d.set(h.id,{width:p,height:g}),f=!0):(d.set(h.id,{width:p,height:g}),f=!0)}return f&&(n.current+=1),n.current},[]),s=Ke(r),[i,l]=v.useState(0);return v.useEffect(()=>{let u=0;const d=()=>{const h=t.current;let p=!1;for(const g of document.querySelectorAll(".react-flow__node[data-id]")){const w=g.getAttribute("data-id");if(!w)continue;const k=g.offsetWidth,x=g.offsetHeight;if(!k||!x)continue;const b=h.get(w);(!b||Math.abs(b.width-k)>4||Math.abs(b.height-x)>4)&&(h.set(w,{width:k,height:x}),p=!0)}p&&l(g=>g+1)};if(e.current)return;let f=0;return document.visibilityState==="hidden"?f=window.setTimeout(d,32):u=requestAnimationFrame(d),()=>{cancelAnimationFrame(u),window.clearTimeout(f)}}),{measuredRef:t,measuredVersionRef:n,sizeVersion:s,domSizeVersion:i}}function MQ(){const[e,t]=v.useState(!1);return v.useEffect(()=>{const n=window.setTimeout(()=>t(!0),2500);return()=>window.clearTimeout(n)},[]),e}function $Q(){const e=v.useRef(null);return v.useEffect(()=>{let t=-1/0;const n=()=>{t=performance.now()},r=s=>{e.current=performance.now()-t<250?s.target:null};return window.addEventListener("pointerdown",n,!0),window.addEventListener("focusin",r,!0),()=>{window.removeEventListener("pointerdown",n,!0),window.removeEventListener("focusin",r,!0)}},[]),e}function IQ({pointerFocusRef:e,nodesRef:t,stateRef:n,primarySelectedIdRef:r,providersRef:s,soundOnRef:i,keyHelpOpenRef:l,modalOpenRef:u,waitingCursorRef:d,removeSelectedRef:f,activateSoundRef:h,clearSelection:p,selectAgent:g,focusAgent:w,stepAgent:k,focusSession:x,requestClear:b,handleRelayout:j,handleFit:S,togglePause:_,toggleSessionList:E,toggleAccountsPanel:T,setDetailOpen:R,setUsageHistoryOpen:A,setUsagePanelOpen:U,setMachinePanelOpen:I,setBrowserWatchOpen:q,setSoundMenuOpen:P,setKeyHelpOpen:O,setTheme:V}){v.useEffect(()=>{const $=M=>{var F,H;const L=M.target,Y={tagName:L==null?void 0:L.tagName,isContentEditable:L==null?void 0:L.isContentEditable,role:(F=L==null?void 0:L.getAttribute)==null?void 0:F.call(L,"role"),type:L==null?void 0:L.type,pointerFocused:L!=null&&L===e.current};if(M.key==="Escape"){const J=Uq({overlayOpen:hl.depth()>0,typing:Ed(Y)});J==="dismiss"?hl.dismissTop():J==="blur"?L==null||L.blur():(CJ(Y)&&(L==null||L.blur()),p());return}if(_d(M))return;const K=sb(L)?(H=L==null?void 0:L.getAttribute)==null?void 0:H.call(L,"data-id"):null,D=K&&t.current.some(J=>J.id===K)?K:null,z=_J(M,D);if(z.kind==="activate"){M.preventDefault(),g(z.nodeId,z.additive);return}if(z.kind!=="node"&&!(z.nodeId==null&&Zq(Y,M.key))&&!Jq({key:M.key,modalOpen:Qq({appModal:u.current,dialogDepth:hl.dialogDepth()}),sheetOpen:l.current})){if(M.key===" "&&(M.preventDefault(),_()),(M.key==="c"||M.key==="C")&&b("shortcut"),(M.key==="r"||M.key==="R")&&j(),(M.key==="f"||M.key==="F")&&S(),(M.key==="z"||M.key==="Z")&&r.current&&w(r.current),M.key==="Delete"&&f.current(),(M.key==="l"||M.key==="L")&&E(),M.key==="d"||M.key==="D")if(r.current)R(J=>!J);else{const J=ex(n.current.agents.values());J.length>0?x(J[0].id):k(1)}if((M.key==="h"||M.key==="H")&&A(J=>!J),(M.key==="u"||M.key==="U")&&U(J=>!J),(M.key==="a"||M.key==="A")&&s.current.claude&&T(),(M.key==="j"||M.key==="J")&&k(1),(M.key==="k"||M.key==="K")&&k(-1),M.key==="w"||M.key==="W"){const J=jq(ex(n.current.agents.values()),d.current);J&&(d.current=J.id,x(J.id))}(M.key==="t"||M.key==="T")&&V(J=>J==="dark"?"light":"dark"),(M.key==="m"||M.key==="M")&&s.current.claude&&i.current!==null&&h.current(M.shiftKey),(M.key==="s"||M.key==="S")&&I(J=>!J),(M.key==="b"||M.key==="B")&&q(J=>!J),(M.key==="v"||M.key==="V")&&s.current.claude&&i.current!==null&&P(J=>!J),M.key==="?"&&O(J=>!J)}};return window.addEventListener("keydown",$),()=>window.removeEventListener("keydown",$)},[b,j,S,p,g,k,x,w,_])}function OQ({nodes:e,stateRef:t,pinnedRef:n,positionsRef:r,draggingRef:s,dragPatchRef:i,setDragging:l,setDragMoveTick:u,setDragTick:d,endBubble:f,markInteract:h,disableAutoFit:p,beginTrashDrag:g,trackTrashDrag:w,endTrashDrag:k,removeNode:x}){const b=v.useRef(null);return{onNodeDragStart:(E,T)=>{var R,A;if(Gs(),f(),s.current=!0,i.current=new Map,l(!0),g(T.type==="agent"?((R=t.current.agents.get(T.id))==null?void 0:R.label)??"":null),h(),p(),T.type==="sessionGroup"){const U=(A=T.data)==null?void 0:A.sessionId,I=new Map;if(U)for(const q of e){const P=q.data;(P==null?void 0:P.sessionId)===U&&I.set(q.id,{x:q.position.x,y:q.position.y})}b.current={start:{x:T.position.x,y:T.position.y},members:I};return}n.current.set(T.id,{x:T.position.x,y:T.position.y})},onNodeDrag:(E,T)=>{var R;if(h(),T.type==="agent"&&w(E),T.type==="sessionGroup"){const A=b.current;if(!A)return;const U=T.position.x-A.start.x,I=T.position.y-A.start.y;for(const[P,O]of A.members){const V={x:O.x+U,y:O.y+I};n.current.set(P,V),r.current.set(P,V)}const q=i.current;if(q){for(const[P,O]of A.members)q.set(P,{x:O.x+U,y:O.y+I});q.set(T.id,{x:T.position.x,y:T.position.y})}u(P=>P+1);return}n.current.set(T.id,{x:T.position.x,y:T.position.y}),r.current.set(T.id,{x:T.position.x,y:T.position.y}),(R=i.current)==null||R.set(T.id,{x:T.position.x,y:T.position.y}),u(A=>A+1)},onNodeDragStop:(E,T)=>{h();const R=k(E,T.type==="agent");if(s.current=!1,i.current=null,l(!1),d(A=>A+1),T.type==="sessionGroup"){const A=b.current;if(A){const U=T.position.x-A.start.x,I=T.position.y-A.start.y;for(const[q,P]of A.members){const O={x:P.x+U,y:P.y+I};n.current.set(q,O),r.current.set(q,O)}}b.current=null,Ol(r.current,n.current),d(U=>U+1);return}if(n.current.set(T.id,{x:T.position.x,y:T.position.y}),r.current.set(T.id,{x:T.position.x,y:T.position.y}),R){x(T.id);return}Ol(r.current,n.current)}}}function LQ(e){return e.claude&&e.codex?"Claude Code and Codex":e.claude?"Claude Code":e.codex?"Codex":null}const PQ={claude:"Claude Code",codex:"Codex",opencode:"OpenCode",openclaw:"OpenClaw",copilot:"GitHub Copilot",pi:"pi-agent",zcode:"ZCode"};function DQ(e){const t=e.toLowerCase(),n=It(PQ,t);return n!==void 0?n:t?t[0].toUpperCase()+t.slice(1):""}function FQ(e){return e.length<=1?e[0]??"":`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`}function Ore(e,t=[]){const n=t.length?FQ(t.map(DQ)):LQ(e);return n?`via ccusage · local ${n} logs`:"via ccusage · local agent logs"}function qQ(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 BQ(e,t){const n=t.prefs??Ax,r=ri(n.done.level),s=ri(n["needs-input"].level),i=r===s?`${r}%`:`${r}% and ${s}%`,l=t.on?`Sound: on at ${i} — a tone when a turn finishes, another when Claude asks for you (M)`:"Sound: off — press M, or use the switch in here, for a tone when a turn finishes (M)",u=e.codex?`
|
|
83
|
-
|
|
84
|
-
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.`:"",d=t.on&&t.locked?`
|
|
85
|
-
|
|
86
|
-
Waiting for a click: this browser plays no sound until the page has been used at least once. Anything you press unlocks it.`:"";return l+u+d+`
|
|
87
|
-
|
|
88
|
-
Click to set the volume and the sound of each tone, and to hear either one.`}function UQ(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."}}function zQ(){return a.jsxs("div",{className:"empty-hero",children:[a.jsxs("div",{className:"orbit-stack","aria-hidden":!0,children:[a.jsx("div",{className:"core"}),a.jsxs("div",{className:"orbit r1",children:[a.jsx("span",{className:"dot"}),a.jsx("span",{className:"dot b"})]}),a.jsxs("div",{className:"orbit r2",children:[a.jsx("span",{className:"dot"}),a.jsx("span",{className:"dot b"})]}),a.jsxs("div",{className:"orbit r3",children:[a.jsx("span",{className:"dot"}),a.jsx("span",{className:"dot b"})]})]}),a.jsxs("h2",{children:["Too many ",vt," tabs are open"]}),a.jsxs("p",{children:["This browser keeps at most six live connections to one address, and other ",a.jsx("code",{children:vt})," tabs are holding them. Close one and this tab connects on its own."]})]})}function HQ({live:e,everConnected:t,providers:n,workspace:r,onTour:s}){const i=!e;return a.jsxs("div",{className:"empty-hero",children:[a.jsxs("div",{className:"orbit-stack","aria-hidden":!0,children:[a.jsx("div",{className:"core"}),a.jsxs("div",{className:"orbit r1",children:[a.jsx("span",{className:"dot"}),a.jsx("span",{className:"dot b"})]}),a.jsxs("div",{className:"orbit r2",children:[a.jsx("span",{className:"dot"}),a.jsx("span",{className:"dot b"})]}),a.jsxs("div",{className:"orbit r3",children:[a.jsx("span",{className:"dot"}),a.jsx("span",{className:"dot b"})]})]}),i?a.jsxs(a.Fragment,{children:[a.jsx("h2",{children:t?"Disconnected from server":"Server unreachable"}),a.jsxs("p",{children:[t?"This page lost its connection to ":"This page cannot reach ",a.jsx("code",{children:vt}),". Check that it is still running in your terminal — the page picks up again on its own."]})]}):WQ(n,r),!i&&a.jsx("button",{type:"button",className:"btn empty-tour",onClick:s,children:"Take the tour"})]})}function WQ(e,t){const n=UQ(t);return a.jsxs(a.Fragment,{children:[a.jsx("h2",{children:"Waiting for Claude Code or Codex"}),n.kind==="scoped"?a.jsxs("p",{children:[n.lead," ",a.jsx("code",{children:n.workspace}),n.tail]}):a.jsxs("p",{children:["Run ",a.jsx("code",{children:"claude"})," or ",a.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."]}),qQ(e).map(r=>a.jsx("p",{className:"hint-row",children:r.spans.map((s,i)=>s.code?a.jsx("code",{children:s.text},i):a.jsx("span",{children:s.text},i))},r.provider))]})}const VQ=1;function GQ(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 KQ(e,t,n){const r=e.agents.get(t);if(!r)return null;const s=[];for(const i of e.agents.values())i.sessionId===t&&s.push(i);return{schemaVersion:VQ,exportedAt:n,sessionId:t,label:r.label,cwd:r.cwd,startedAt:r.startedAt,endedAt:r.endedAt,model:r.model,agents:s.map(i=>({id:i.id,kind:i.kind,label:i.label,parentId:i.parentId,state:i.state,startedAt:i.startedAt,endedAt:i.endedAt,model:i.model,cwd:i.cwd,usage:i.usage,prompts:i.prompts,tools:i.tools.map(GQ)}))}}function YQ(e,t){const n=(e||"session").replace(/[^a-z0-9._-]/gi,"_");return`${vt}-${n}-${b0(t,8)}.json`}const JI={file:"📁",shell:"⚡",web:"🌐",agent:"🤖",task:"📋",plan:"🧭",mcp:"🔌",other:"✨"},XQ={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 ZQ({cat:e}){return a.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:a.jsx("path",{d:XQ[e]})})}const md={file:"file",shell:"shell",web:"web",agent:"agent",task:"task",plan:"plan",mcp:"mcp",other:"other"},QI=tM;function JQ({agent:e,now:t,onOpenTool:n,onShowSummary:r,onExportSession:s,onRemove:i}){var x;const l=`${e.synthetic?"≥ ":""}${Qo(e.startedAt,e.endedAt,t)}`,u=un(e),d=u.total>0,f=e.usage.inputTokens+e.usage.outputTokens,h=new Map;for(const[b,j]of e.toolCountByName??[]){const S=QI(b);h.set(S,(h.get(S)??0)+j)}const p=e.toolErrorCount??0,g=e.tools.filter(b=>!b.endedAt).length,w=Array.from(h.entries()).sort((b,j)=>j[1]-b[1]),k=h.has("mcp")?KB(((x=e.toolCountByName)==null?void 0:x.keys())??[]):null;return a.jsxs(a.Fragment,{children:[a.jsxs("header",{className:"detail-hero",children:[a.jsxs("div",{className:"hero-line",children:[a.jsx("span",{className:`state-pill state-${e.state}`,children:e.state==="active"?"live":e.state}),a.jsx("h2",{className:"hero-title",title:e.cwd??e.label,children:e.label})]}),a.jsxs("div",{className:"hero-meta",children:[a.jsx("span",{className:"hero-meta-item",children:e.kind==="root"?"session":"subagent"}),a.jsx("span",{className:"hero-sep",children:"·"}),a.jsx("span",{className:"hero-meta-item",title:`started ${new Date(e.startedAt).toLocaleString()}`,children:l}),e.model&&(()=>{const b=U2(e);return a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"hero-sep",children:"·"}),a.jsxs("span",{className:"model-chip","data-family":jd(e.model),title:b.length>0?`${e.model}
|
|
89
|
-
spend on this panel also covers:
|
|
90
|
-
${b.join(`
|
|
91
|
-
`)}`:e.model,children:[Ws(e.model),b.length>0?` +${b.length}`:""]})]})})()]}),d&&a.jsxs("div",{className:"hero-cost",children:[a.jsxs("div",{className:"hero-cost-headline",children:[a.jsx("span",{className:"hero-cost-value",children:Be(u.total)}),a.jsx("span",{className:"hero-cost-label",children:"spend"})]}),a.jsx(k0,{cost:u})]}),a.jsxs("div",{className:"hero-actions",children:[e.kind==="root"&&e.state==="done"&&r&&a.jsx("button",{type:"button",className:"btn hero-action-btn",onClick:()=>r(e.sessionId),title:"Reopen the end-of-session recap modal",children:"Show recap"}),s&&a.jsx("button",{type:"button",className:"btn hero-action-btn",onClick:()=>s(e.sessionId),title:"Download this session as JSON",children:"Export JSON"}),i&&a.jsx("button",{type:"button",className:"btn hero-action-btn",onClick:i,title:e.kind==="root"?"Take this session's cards off the board (Delete). The session carries on; the session list (L) brings it back":"Take this card and the ones under it off the board (Delete). The session list (L) brings it back",children:"Remove from board"})]})]}),(()=>{const b=Cd(e);if(!b)return null;const j=td(b.at,t);return a.jsxs("section",{className:"detail-section",children:[a.jsxs("h3",{children:["Recap ",a.jsx("span",{className:"section-count",title:j.title,children:j.label})]}),a.jsx("p",{className:"detail-recap",children:b.text})]})})(),e.tools.length>0&&a.jsxs("section",{className:"detail-section",children:[a.jsx("h3",{children:"Activity"}),a.jsxs("div",{className:"activity-row",children:[a.jsxs("div",{className:"activity-counters",children:[a.jsxs("span",{className:"ac-item",children:[a.jsx("b",{children:e.toolCount})," calls"]}),g>0&&a.jsxs("span",{className:"ac-item ac-live",children:[a.jsx("b",{children:g})," live"]}),p>0&&a.jsxs("span",{className:"ac-item ac-err",children:[a.jsx("b",{children:p})," err"]})]}),a.jsx("div",{className:"cat-strip",children:w.map(([b,j])=>{const S=b==="mcp"?k:null,_=S==null?void 0:S.hue,E=`${j} ${md[b]} call${j===1?"":"s"}`;return a.jsxs("span",{className:`cat-chip cat-${b}${_!=null?" mcp-hue":""}`,style:_!=null?{"--mcp-hue":_}:void 0,title:S?`${E}, all to ${S.label}`:E,children:[a.jsx("span",{className:"cat-emoji","aria-hidden":!0,children:JI[b]}),a.jsx("span",{className:"cat-name",children:md[b]}),a.jsx("span",{className:"cat-count",children:j}),S&&a.jsx("span",{className:"cat-server",children:S.label})]},b)})})]})]}),f>0&&a.jsxs("section",{className:"detail-section",children:[a.jsx("h3",{children:"Tokens"}),a.jsxs("div",{className:"tokens-grid",children:[a.jsxs("div",{children:[a.jsx("span",{className:"k",children:"in"}),a.jsx("b",{title:e.usage.inputTokens.toLocaleString(),children:st(e.usage.inputTokens)})]}),a.jsxs("div",{children:[a.jsx("span",{className:"k",children:"out"}),a.jsx("b",{title:e.usage.outputTokens.toLocaleString(),children:st(e.usage.outputTokens)})]}),a.jsxs("div",{children:[a.jsx("span",{className:"k",children:"cache r"}),a.jsx("b",{title:e.usage.cacheReadTokens.toLocaleString(),children:st(e.usage.cacheReadTokens)})]}),a.jsxs("div",{children:[a.jsx("span",{className:"k",children:"cache c"}),a.jsx("b",{title:e.usage.cacheCreateTokens.toLocaleString(),children:st(e.usage.cacheCreateTokens)})]})]})]}),a.jsxs("section",{className:"detail-section",children:[a.jsx("h3",{children:"Identity"}),a.jsxs("div",{children:[e.cwd&&a.jsxs("div",{className:"row",children:[a.jsx("span",{className:"k",children:"cwd"}),a.jsx("span",{className:"v",title:e.cwd,children:e.cwd})]}),a.jsxs("div",{className:"row",children:[a.jsx("span",{className:"k",children:"session"}),a.jsxs("span",{className:"v",children:[e.sessionId.slice(0,12),"…"]})]}),e.parentId&&a.jsxs("div",{className:"row",children:[a.jsx("span",{className:"k",children:"parent"}),a.jsxs("span",{className:"v",children:[e.parentId.slice(0,12),"…"]})]})]})]}),e.prompts.length>0&&a.jsxs("section",{className:"detail-section",children:[a.jsxs("h3",{children:["Prompts ",a.jsx("span",{className:"section-count",children:A2(e.prompts).length})]}),a.jsx("div",{className:"prompts",children:QQ(e.prompts).reverse().map(({pr:b,key:j})=>{const S=td(b.at,t),_=d0(b.text);return _?a.jsxs("details",{className:"prompt-entry prompt-injected",children:[a.jsxs("summary",{children:[a.jsx("span",{className:"prompt-time",title:S.title,children:S.label}),a.jsx("span",{className:"prompt-injected-label",children:_.label})]}),_.detail&&a.jsx("div",{className:"prompt-injected-detail",children:_.detail})]},j):a.jsxs("div",{className:"prompt-entry",children:[a.jsx("div",{className:"prompt-time",title:S.title,children:S.label}),a.jsx("div",{className:"prompt-text",children:b.text})]},j)})})]}),a.jsxs("section",{className:"detail-section",children:[a.jsxs("h3",{children:["Tool calls ",a.jsx("span",{className:"section-count",children:e.tools.length})]}),e.tools.length===0&&a.jsx("div",{className:"empty",children:"No tool calls yet."}),a.jsx("div",{children:e.tools.slice().reverse().map(b=>a.jsx(tee,{t:b,onClick:()=>n(e.id,b.id)},b.id))})]})]})}function QQ(e){const t=new Map;return e.map(n=>{const r=t.get(n.at)??0;return t.set(n.at,r+1),{pr:n,key:r===0?String(n.at):`${n.at}:${r}`}})}const eee={inflight:"in-flight",done:"done",err:"error"};function tee({t:e,onClick:t}){const n=e.endedAt==null?"inflight":e.ok===!1?"err":"done",r=H2(e,"…");return a.jsxs("button",{className:"tool clickable",title:e.inputPreview||e.name,onClick:t,children:[a.jsxs("span",{className:"name",children:[a.jsx("span",{className:`status-dot ${n}`,"aria-hidden":!0}),a.jsx("span",{className:"vis-hidden",children:eee[n]}),e.name]}),a.jsx("span",{style:{color:"var(--muted)"},children:r})]})}function nee(e,t){const n=KQ(e,t,new Date().toISOString());if(!n)return;const r=JSON.stringify(n,null,2),s=new Blob([r],{type:"application/json"}),i=URL.createObjectURL(s),l=document.createElement("a");l.href=i,l.download=YQ(n.label,t),document.body.appendChild(l),l.click(),document.body.removeChild(l),setTimeout(()=>URL.revokeObjectURL(i),1e3)}function ree({selected:e,now:t,openTool:n,setSummaryFor:r,setDetailOpen:s,stateRef:i,removeSelectedNode:l}){return a.jsxs("aside",{className:"detail","aria-label":"Detail",children:[a.jsx("button",{type:"button",className:"glyph-btn detail-close",title:"Close panel","aria-label":"Close detail panel",onClick:()=>s(!1),children:"×"}),a.jsx(JQ,{agent:e,now:t,onOpenTool:n,onShowSummary:r,onExportSession:u=>nee(i.current,u),onRemove:l})]})}function eO({id:e,value:t,onLevel:n,"aria-describedby":r}){return a.jsxs("div",{className:"sm-row",children:[a.jsx("label",{htmlFor:e,children:"Volume"}),a.jsx("input",{id:e,type:"range",min:Pu,max:ld,step:Rx,value:t,"aria-describedby":r,onChange:s=>n(Number(s.target.value)),style:{"--sm-level":`${(t-Pu)/(ld-Pu)*100}%`}}),a.jsxs("span",{className:"sm-read",children:[t,"%"]})]})}const tO="agent-dag.character-enabled",nO="agent-dag.fm-volume",ER="agent-dag.fm-source",see=[{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 aee(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 oee(e){return e!=="0"}function iee(){return oee(Qe(tO))}function lee(e){return O$(e)}function cee(){return lee(Qe(nO))}const $o=["light","dark"],uee={light:"Light",dark:"Dark"},CR=see,Io="Give the station a name.",dee="Use an https YouTube live or channel link, or a .mp3, .aac, .ogg or .m3u8 stream.";function hee({theme:e}){return a.jsx("span",{className:"appearance-preview","data-swatch":e,children:a.jsxs("svg",{viewBox:"0 0 112 56","aria-hidden":!0,focusable:"false",children:[a.jsx("rect",{className:"tp-canvas",width:"112",height:"56"}),a.jsx("rect",{className:"tp-surface",width:"112",height:"7"}),a.jsx("rect",{className:"tp-rule",y:"7",width:"112",height:"1"}),a.jsx("rect",{className:"tp-surface",y:"8",width:"25",height:"48"}),a.jsx("rect",{className:"tp-rule",x:"25",y:"8",width:"1",height:"48"}),a.jsx("rect",{className:"tp-card",x:"36.5",y:"27.5",width:"28",height:"14",rx:"2.5"}),a.jsx("rect",{className:"tp-tag",x:"39.5",y:"25.5",width:"13",height:"4",rx:"2"}),a.jsx("rect",{className:"tp-card",x:"76.5",y:"14.5",width:"29",height:"20",rx:"2.5"}),a.jsx("rect",{className:"tp-rule",x:"81",y:"23",width:"20",height:"2",rx:"1"}),a.jsx("rect",{className:"tp-accent",x:"81",y:"23",width:"12",height:"2",rx:"1"})]})})}function fee({theme:e,onTheme:t,characterEnabled:n,onToggleCharacter:r,fmVolume:s,onFmVolume:i,fmMuted:l,onFmMuted:u,fmSource:d,onFmSource:f,customFmStations:h,unavailableFmStations:p,onAddFmStation:g,onRenameFmStation:w,onRemoveFmStation:k,onClose:x}){var he;const b=mt(x),j=[...CR.map(se=>({...se,label:p.has(se.value)?`${se.label} · not live`:se.label,unavailable:p.has(se.value)})),...h.map(se=>({group:"🎵 Your stations",value:Pa(se.id),label:p.has(se.id)?`${se.name} · unavailable`:se.name,unavailable:p.has(se.id)}))],S=j.some(se=>se.value===d&&se.unavailable),_=[];j.forEach((se,ke)=>{const Ce=_[_.length-1];Ce&&Ce.group===se.group?Ce.indexes.push(ke):_.push({group:se.group,indexes:[ke]})});const[E,T]=v.useState(!1),[R,A]=v.useState(()=>Math.max(0,j.findIndex(se=>se.value===d))),[U,I]=v.useState(!1),[q,P]=v.useState(""),[O,V]=v.useState(""),[$,M]=v.useState(""),[L,Y]=v.useState(!1),[K,D]=v.useState(""),[z,F]=v.useState(""),H=v.useRef(null),J=v.useRef(null),W=v.useRef(null),G=v.useRef(null),X=v.useRef(null),Z=Xo(d),ee=Z?h.find(se=>se.id===Z):void 0;v.useEffect(()=>{const se=j.findIndex(ke=>ke.value===d);A(se<0?0:se)},[d,h,p]),v.useEffect(()=>{Y(!1),D((ee==null?void 0:ee.name)??"")},[ee==null?void 0:ee.id,ee==null?void 0:ee.name]),v.useEffect(()=>{var se;E&&((se=document.getElementById(`appearance-fm-option-${R}`))==null||se.scrollIntoView({block:"nearest"}))},[R,E]),v.useEffect(()=>{if(!E)return;const se=ke=>{var Oe,Le;const Ce=ke.target;!((Oe=H.current)!=null&&Oe.contains(Ce))&&!((Le=X.current)!=null&&Le.contains(Ce))&&T(!1)};return document.addEventListener("pointerdown",se),()=>document.removeEventListener("pointerdown",se)},[E]);const re=se=>{const ke=se.relatedTarget;ke&&!se.currentTarget.contains(ke)&&T(!1)},ce=se=>{var Ce;const ke=j[se];ke&&(A(se),f(ke.value),T(!1),(Ce=H.current)==null||Ce.focus())},ie=se=>{if(Bq(se.key)){if(!E)return;se.preventDefault(),se.stopPropagation(),T(!1);return}if(se.key==="Tab"){T(!1);return}if(se.key==="Enter"||se.key===" "){se.preventDefault(),E?ce(R):T(!0);return}se.key!=="ArrowDown"&&se.key!=="ArrowUp"&&se.key!=="Home"&&se.key!=="End"||(se.preventDefault(),T(!0),A(ke=>se.key==="Home"?0:se.key==="End"?j.length-1:Math.min(j.length-1,Math.max(0,ke+(se.key==="ArrowDown"?1:-1)))))},fe=()=>{var se;return(se=H.current)==null?void 0:se.focus()},de=se=>{var Ce,Oe;if(se.preventDefault(),!q.trim()){M(Io),(Ce=J.current)==null||Ce.focus();return}const ke=h6(q,O);if(!ke){M(dee),(Oe=W.current)==null||Oe.focus();return}g(ke),f(Pa(ke.id)),P(""),V(""),M(""),I(!1),fe()},we=se=>{var ke;if(se.preventDefault(),!!Z){if(!K.trim()){F(Io),(ke=G.current)==null||ke.focus();return}w(Z,K),Y(!1),fe()}},xe=se=>{var Oe;if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(se.key))return;se.preventDefault();const Ce=($o.indexOf(e)+(se.key==="ArrowLeft"||se.key==="ArrowUp"?-1:1)+$o.length)%$o.length;t($o[Ce]),(Oe=se.currentTarget.querySelectorAll('[role="radio"]')[Ce])==null||Oe.focus()},$e=se=>{var Ce;if(se.key===" "){se.stopPropagation();return}if(Ed(se.target)||se.key!=="t"&&se.key!=="T"||se.ctrlKey||se.metaKey||se.altKey)return;se.preventDefault(),se.stopPropagation();const ke=e==="dark"?"light":"dark";t(ke),se.target.getAttribute("role")==="radio"&&((Ce=se.currentTarget.querySelectorAll('[role="radio"]')[$o.indexOf(ke)])==null||Ce.focus())},be=se=>{const ke=j[se],Ce="unavailable"in ke&&ke.unavailable;return a.jsxs("div",{className:"appearance-source-option",role:"option",id:`appearance-fm-option-${se}`,"aria-selected":d===ke.value,"data-highlighted":R===se||void 0,"data-unavailable":Ce||void 0,onMouseEnter:()=>A(se),onClick:()=>ce(se),children:[a.jsx("span",{children:ke.label}),d===ke.value&&a.jsx("span",{"aria-hidden":!0,children:"✓"})]},ke.value)};return Ot.createPortal(a.jsx("div",{className:"modal-backdrop appearance-backdrop",onClick:x,role:"presentation",children:a.jsxs("div",{ref:b,id:"appearance-menu",className:"modal appearance-menu appearance-modal",role:"dialog","aria-modal":"true","aria-labelledby":"appearance-title",onClick:se=>se.stopPropagation(),onKeyDown:$e,children:[a.jsxs("div",{className:"appearance-head",children:[a.jsxs("div",{className:"appearance-heading",children:[a.jsx("h2",{id:"appearance-title",className:"appearance-title",children:"Appearance"}),a.jsx("p",{className:"appearance-subtitle",children:"Tune the deck to your workspace."})]}),a.jsx("button",{type:"button",className:"glyph-btn appearance-close",onClick:x,"aria-label":"Close appearance settings",title:"Close (Esc)",children:"×"})]}),a.jsxs("section",{className:"appearance-section","aria-labelledby":"appearance-theme-caption",children:[a.jsxs("div",{className:"appearance-caption",children:[a.jsxs("div",{children:[a.jsx("h3",{id:"appearance-theme-caption",children:"Color theme"}),a.jsx("p",{className:"appearance-section-note",children:"Choose how the dashboard looks."})]}),a.jsx("kbd",{className:"appearance-key","aria-hidden":!0,title:"Press T anywhere to switch themes",children:"T"})]}),a.jsx("div",{className:"appearance-themes",role:"radiogroup","aria-labelledby":"appearance-theme-caption","aria-keyshortcuts":"T",onKeyDown:xe,children:$o.map(se=>a.jsxs("button",{type:"button",className:"appearance-theme",role:"radio","aria-checked":e===se,tabIndex:e===se?0:-1,onClick:()=>t(se),children:[a.jsx(hee,{theme:se}),a.jsxs("span",{className:"appearance-theme-name",children:[uee[se],a.jsx("svg",{className:"appearance-check",viewBox:"0 0 12 12","aria-hidden":!0,focusable:"false",children:a.jsx("path",{d:"M2.5 6.4 4.9 8.7 9.5 3.6"})})]})]},se))})]}),a.jsxs("section",{className:"appearance-section","aria-labelledby":"appearance-fm-caption",children:[a.jsx("div",{className:"appearance-caption",children:a.jsx("h3",{id:"appearance-fm-caption",children:"Music source"})}),a.jsxs("div",{className:"appearance-controls",children:[a.jsxs("div",{className:"appearance-source-row",children:[a.jsx("label",{htmlFor:"appearance-fm-source",children:"Station"}),a.jsxs("div",{className:`appearance-source-picker${E?" is-open":""}`,onBlur:re,children:[a.jsxs("button",{ref:H,type:"button",id:"appearance-fm-source",className:"appearance-source-trigger",role:"combobox","aria-haspopup":"listbox","aria-expanded":E,"aria-controls":E?"appearance-fm-source-list":void 0,"aria-activedescendant":E?`appearance-fm-option-${R}`:void 0,"aria-describedby":"appearance-fm-source-note",onClick:()=>T(se=>!se),onKeyDown:ie,children:[a.jsx("span",{children:((he=j.find(se=>se.value===d))==null?void 0:he.label)??CR[0].label}),a.jsx("svg",{viewBox:"0 0 12 12","aria-hidden":!0,focusable:"false",children:a.jsx("path",{d:"m2.5 4.5 3.5 3 3.5-3"})})]}),E&&a.jsx("div",{ref:X,id:"appearance-fm-source-list",className:"appearance-source-list",role:"listbox","aria-label":"Music stations",children:_.map((se,ke)=>se.group?a.jsxs("div",{role:"group","aria-labelledby":`appearance-fm-group-${ke}`,children:[a.jsx("div",{id:`appearance-fm-group-${ke}`,className:"appearance-source-group",role:"presentation",children:se.group}),se.indexes.map(be)]},`group-${ke}`):se.indexes.map(be))})]})]}),a.jsx("span",{id:"appearance-fm-source-note",className:"vis-hidden",children:"Changing station starts live playback automatically."}),a.jsx("p",{className:"appearance-fm-status",role:"status",children:S?o6(Xo(d)!==null):""}),a.jsxs("div",{className:"appearance-station-manage",children:[a.jsx("button",{type:"button",className:"btn appearance-station-action","aria-expanded":U,onClick:()=>{I(se=>!se),M("")},children:U?"Cancel":"+ Add station"}),ee&&!L&&a.jsxs("span",{className:"appearance-station-edit",children:[a.jsx("button",{type:"button",className:"btn appearance-station-action",onClick:()=>{D(ee.name),F(""),Y(!0)},children:"Rename"}),a.jsx("button",{type:"button",className:"btn danger appearance-station-action",onClick:()=>{k(ee.id),fe()},children:"Remove"})]})]}),U&&a.jsxs("form",{className:"appearance-station-form",onSubmit:de,noValidate:!0,children:[a.jsxs("label",{className:"appearance-station-field",children:[a.jsx("span",{children:"Station name"}),a.jsx("input",{ref:J,className:"ap-manage-input",value:q,onChange:se=>P(se.target.value),"aria-invalid":$===Io||void 0,"aria-describedby":$===Io?"appearance-station-error":void 0,maxLength:jl,autoFocus:!0})]}),a.jsxs("label",{className:"appearance-station-field",children:[a.jsx("span",{children:"Link"}),a.jsx("input",{ref:W,className:"ap-manage-input",value:O,onChange:se=>V(se.target.value),placeholder:"https://…","aria-invalid":$!==""&&$!==Io||void 0,"aria-describedby":$&&$!==Io?"appearance-station-error":void 0,inputMode:"url",autoComplete:"off",spellCheck:!1,maxLength:w2})]}),a.jsx("button",{type:"submit",className:"btn primary",children:"Add"}),$&&a.jsx("p",{id:"appearance-station-error",className:"appearance-station-error",role:"alert",children:$})]}),ee&&L&&a.jsxs("form",{className:"appearance-station-form is-rename",onSubmit:we,noValidate:!0,children:[a.jsxs("label",{className:"appearance-station-field",children:[a.jsx("span",{children:"Station name"}),a.jsx("input",{ref:G,className:"ap-manage-input",value:K,onChange:se=>D(se.target.value),"aria-invalid":z!==""||void 0,"aria-describedby":z?"appearance-rename-error":void 0,maxLength:jl,autoFocus:!0})]}),a.jsx("button",{type:"submit",className:"btn primary",children:"Save"}),a.jsx("button",{type:"button",className:"btn",onClick:()=>{Y(!1),fe()},children:"Cancel"}),z&&a.jsx("p",{id:"appearance-rename-error",className:"appearance-station-error",role:"alert",children:z})]}),a.jsxs("label",{className:"appearance-row",children:[a.jsx("span",{className:"appearance-row-label",id:"appearance-character-label",children:"Show character on minimap"}),a.jsx("button",{type:"button",className:"switch",role:"switch","aria-checked":n,"aria-labelledby":"appearance-character-label","aria-describedby":"appearance-character-note",onClick:r,children:a.jsx("span",{className:"switch-knob"})}),a.jsx("span",{id:"appearance-character-note",className:"vis-hidden",children:"Shows the animated minimap character and enables music playback."})]}),a.jsx(eO,{id:"appearance-fm-volume",value:s,"aria-describedby":"appearance-fm-volume-note",onLevel:i}),a.jsxs("label",{className:"appearance-row",children:[a.jsx("span",{className:"appearance-row-label",id:"appearance-fm-mute-label",children:"Mute music"}),a.jsx("button",{type:"button",className:"switch",role:"switch","aria-checked":l,"aria-labelledby":"appearance-fm-mute-label",onClick:u,children:a.jsx("span",{className:"switch-knob"})})]})]}),a.jsx("span",{id:"appearance-fm-volume-note",className:"vis-hidden",children:"Controls live music volume."})]})]})}),document.body)}const pee="With no deck tab open, get a notification wherever a sound would have played.",mee="With the ccdeck window closed, get a notification wherever a sound would have played.";function gee(e){return e?mee:pee}const yee="Held off for this run — the deck was started with alerts disabled. Your choice is saved for the next start.",TR="Get notified when you're away from this tab.";function wee(e){switch(e){case"granted":return{status:"Enabled",ask:!1,ok:!0,note:TR};case"default":return{status:null,ask:!0,ok:!1,note:TR};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 Ll(e=typeof navigator>"u"?"":navigator.userAgent){return/\bccdeck-desktop\/\d/.test(e)}const vee=["audio/webm;codecs=opus","audio/ogg;codecs=opus","audio/mp4"];function xee(e){return vee.find(t=>e(t))}const bee=4400;function kee(e){const t=e.split(";")[0];return{name:`Recorded voice.${t==="audio/mp4"?"m4a":t==="audio/ogg"?"ogg":"webm"}`,type:t}}function Nee({full:e,setCustomError:t,runCustom:n,onImportCustom:r}){const[s,i]=v.useState(!1),l=v.useRef(null),u=v.useRef(null),d=v.useRef(!1),f=()=>{var p;u.current!==null&&clearTimeout(u.current),u.current=null,((p=l.current)==null?void 0:p.state)==="recording"&&l.current.stop()},h=async()=>{var g;if(e)return;if(t(""),!((g=navigator.mediaDevices)!=null&&g.getUserMedia)||typeof MediaRecorder>"u"){t("Microphone recording is unavailable in this browser.");return}let p;try{p=await navigator.mediaDevices.getUserMedia({audio:!0})}catch{d.current||t("Microphone access was denied or unavailable.");return}if(d.current||l.current){p.getTracks().forEach(w=>w.stop());return}try{const w=xee(b=>MediaRecorder.isTypeSupported(b)),k=new MediaRecorder(p,w?{mimeType:w}:void 0),x=[];l.current=k,k.ondataavailable=b=>{b.data.size&&x.push(b.data)},k.onerror=()=>t("Recording failed. Please try again."),k.onstop=()=>{p.getTracks().forEach(_=>_.stop()),u.current!==null&&clearTimeout(u.current),u.current=null;const b=l.current===k;if(b&&(l.current=null),i(!1),!b||!x.length)return;const j=kee(k.mimeType),S=new File(x,j.name,{type:j.type});n(()=>r(S))},k.start(200),i(!0),u.current=setTimeout(f,bee)}catch{l.current=null,p.getTracks().forEach(w=>w.stop()),t("This browser cannot record a supported audio format.")}};return v.useEffect(()=>(d.current=!1,()=>{d.current=!0,u.current!==null&&clearTimeout(u.current);const p=l.current;l.current=null,(p==null?void 0:p.state)==="recording"&&p.stop()}),[]),{recording:s,startRecording:h,stopRecording:f}}function jee({full:e,fullProps:t,runCustom:n,onCreateVoice:r}){const[s,i]=v.useState("Custom voice"),[l,u]=v.useState("Your turn"),[d,f]=v.useState(""),[h,p]=v.useState("1"),[g,w]=v.useState("1"),[k,x]=v.useState([]);return v.useEffect(()=>{if(typeof window>"u"||!("speechSynthesis"in window))return;const b=()=>{x(window.speechSynthesis.getVoices())};return b(),window.speechSynthesis.addEventListener("voiceschanged",b),()=>window.speechSynthesis.removeEventListener("voiceschanged",b)},[]),a.jsxs("details",{className:"sm-voice",children:[a.jsxs("summary",{...t,onClick:b=>{const j=b.currentTarget.parentElement;e&&j&&!j.open&&b.preventDefault()},children:[a.jsx("span",{children:"Spoken voice"}),a.jsx("span",{children:"Create from text"})]}),a.jsxs("div",{className:"sm-voice-fields",children:[a.jsxs("label",{children:[a.jsx("span",{children:"Name"}),a.jsx("input",{className:"ap-manage-input",value:s,maxLength:80,onChange:b=>i(b.target.value)})]}),a.jsxs("label",{children:[a.jsx("span",{children:"Text"}),a.jsx("input",{className:"ap-manage-input",value:l,maxLength:180,onChange:b=>u(b.target.value)})]}),a.jsxs("label",{children:[a.jsx("span",{children:"Voice"}),a.jsxs("select",{className:"sm-select",value:d,onChange:b=>f(b.target.value),children:[a.jsx("option",{value:"",children:"System default"}),k.map(b=>a.jsx("option",{value:b.voiceURI,children:b.name},b.voiceURI))]})]}),a.jsxs("div",{className:"sm-voice-pair",children:[a.jsxs("label",{children:[a.jsx("span",{children:"Rate"}),a.jsx("input",{className:"ap-manage-input",type:"number",min:"0.5",max:"2",step:"0.1",value:h,onChange:b=>p(b.target.value)})]}),a.jsxs("label",{children:[a.jsx("span",{children:"Pitch"}),a.jsx("input",{className:"ap-manage-input",type:"number",min:"0.5",max:"2",step:"0.1",value:g,onChange:b=>w(b.target.value)})]})]}),a.jsx("button",{type:"button",className:"btn sm-custom-action",...t,onClick:()=>{e||n(async()=>{await r({name:s,text:l,voiceURI:d,rate:parseFloat(h),pitch:parseFloat(g)}),u("Your turn")})},children:"Add spoken voice"})]})]})}function See({customAssets:e,onImportCustom:t,onCreateVoice:n,onRenameCustom:r,onPreviewCustom:s,onDeleteCustom:i}){const[l,u]=v.useState(""),d=e.length,f=Cx(d),h=f!==null,p=h?{"aria-disabled":!0,"aria-describedby":"sm-custom-full"}:{},[g,w]=v.useState(null),k=v.useRef(0),x=v.useRef(new Map),b=v.useRef(null);v.useEffect(()=>{if(!g)return;const R=window.setTimeout(()=>w(null),4e3);return()=>window.clearTimeout(R)},[g]);const j=async R=>{u("");try{await R()}catch(A){u(A instanceof Error?A.message:"Custom audio could not be saved.")}},S=(R,A)=>{const U=Date.now(),I=Tl({armedFor:g,target:R,armedAt:k.current,now:U,gapMs:Cl});if(I==="arm"){w(R),k.current=U;return}if(I==="ignore")return;w(null);const q=eK(e.map(P=>P.id),R);j(async()=>{var O;await i(R);const P=document.activeElement;P!==A&&!ns((P==null?void 0:P.tagName)??null)||(O=q?x.current.get(q):b.current)==null||O.focus()})},{recording:_,startRecording:E,stopRecording:T}=Nee({full:h,setCustomError:u,runCustom:j,onImportCustom:t});return a.jsxs("section",{className:"sm-custom","aria-labelledby":"sm-custom-title",children:[a.jsxs("div",{className:"sm-custom-head",children:[a.jsx("h3",{className:"sm-tone-name",id:"sm-custom-title",children:"Custom sounds"}),a.jsxs("span",{children:[d," of ",Ex,", kept on this machine"]})]}),h&&a.jsx("p",{className:"sm-note",id:"sm-custom-full",children:f}),a.jsxs("div",{className:"sm-custom-actions",children:[a.jsxs("label",{className:"sm-custom-card sm-file",children:[a.jsxs("span",{className:"sm-custom-card-copy",children:[a.jsx("strong",{children:"Import audio"}),a.jsx("span",{children:"WAV, MP3 or OGG"})]}),a.jsx("span",{className:"btn sm-custom-action","aria-hidden":"true",children:"Choose file"}),a.jsx("input",{ref:b,type:"file",accept:"audio/wav,audio/x-wav,audio/mpeg,audio/mp3,audio/ogg,.wav,.mp3,.ogg",...p,onClick:R=>{h&&R.preventDefault()},onChange:R=>{var U;const A=(U=R.target.files)==null?void 0:U[0];R.currentTarget.value="",A&&!h&&j(()=>t(A))}})]}),a.jsxs("div",{className:"sm-custom-card",children:[a.jsxs("span",{className:"sm-custom-card-copy",children:[a.jsx("strong",{children:"Record a clip"}),a.jsx("span",{children:_?"Recording…":"Up to 5 seconds"})]}),_?a.jsx("button",{type:"button",className:"btn sm-custom-action",onClick:T,children:"Stop & save"}):a.jsx("button",{type:"button",className:"btn sm-custom-action",...p,onClick:()=>void E(),children:"Record"})]})]}),a.jsx(jee,{full:h,fullProps:p,runCustom:j,onCreateVoice:n}),e.length>0&&a.jsx("div",{className:"sm-custom-list",children:e.map(R=>a.jsxs("div",{className:"sm-custom-item",children:[a.jsx("input",{className:"ap-manage-input","aria-label":`Rename ${R.name}`,defaultValue:R.name,maxLength:80,onBlur:A=>{if(!A.target.value.trim()){A.target.value=R.name;return}j(()=>r(R.id,A.target.value))},onKeyDown:A=>{A.key==="Enter"&&A.currentTarget.blur()}}),a.jsx("span",{children:R.kind==="audio"?`${R.duration.toFixed(1)}s`:"Voice"}),a.jsx("button",{type:"button",className:"btn sm-custom-icon","aria-label":`Play ${R.name}`,onClick:()=>s(R.id),children:"Play"}),a.jsx("button",{type:"button",ref:A=>{A?x.current.set(R.id,A):x.current.delete(R.id)},className:`btn sm-custom-icon${g===R.id?" armed":""}`,onKeyDown:A=>{A.repeat&&A.preventDefault()},onClick:A=>S(R.id,A.currentTarget),"aria-label":g===R.id?`Confirm deleting ${R.name}`:`Delete ${R.name}`,title:g===R.id?"Press again to delete this sound. It cannot be brought back.":"Delete this sound",children:g===R.id?"Confirm":"Delete"})]},R.id))}),l&&a.jsx("p",{className:"sm-custom-error",role:"alert",children:l})]})}const Dx="custom:";function RR(e){return`${Dx}${e}`}function _ee(e){return e.startsWith(Dx)?e.slice(Dx.length):null}const AR={done:"Turn finished","needs-input":"Claude is asking"},Eee={done:"Plays when Claude or Codex finishes a turn.","needs-input":"Available in Claude Code only."};function Cee({chime:e,tone:t,soundOn:n,customAssets:r,customSelections:s,onLevel:i,onFigure:l,onPreview:u,onBuiltInSelected:d,onCustomSelected:f}){const h=`sm-level-${e}`,p=`sm-figure-${e}`,g=s[e];return a.jsxs("section",{className:"sm-tone","aria-labelledby":`sm-name-${e}`,children:[a.jsxs("div",{className:"sm-tone-head",children:[a.jsx("h3",{className:"sm-tone-name",id:`sm-name-${e}`,children:AR[e]}),a.jsxs("button",{type:"button",className:"btn sm-hear",onClick:()=>u(e),"aria-label":`Hear the ${AR[e].toLowerCase()} tone`,title:n?"Play this tone now, at what it is set to":"Plays even when Sounds is off","aria-describedby":n?void 0:"sm-preview-note",children:[a.jsx("svg",{width:"11",height:"11",viewBox:"0 0 12 12",fill:"currentColor","aria-hidden":!0,children:a.jsx("path",{d:"M3 1.6v8.8l7-4.4z"})}),"Hear it"]})]}),a.jsx(eO,{id:h,value:t.level,onLevel:w=>i(e,w)}),a.jsxs("div",{className:"sm-row",children:[a.jsx("label",{htmlFor:p,children:"Tone"}),a.jsxs("select",{id:p,className:"sm-select",value:g?RR(g):t.figure,onChange:w=>{const k=w.target.value,x=_ee(k);x!==null?f(e,x):(d(e),l(e,k))},children:[P0[e].map(w=>a.jsx("option",{value:w.id,children:w.label},w.id)),r.length>0&&a.jsx("optgroup",{label:"Custom",children:r.map(w=>a.jsx("option",{value:RR(w.id),children:w.name},w.id))})]})]}),a.jsx("p",{className:"sm-note",children:Eee[e]})]})}function Tee({onClose:e,soundOn:t,onToggleSound:n,prefs:r,onLevel:s,onFigure:i,onPreview:l,openerRef:u,customAssets:d,customSelections:f,onBuiltInSelected:h,onCustomSelected:p,onImportCustom:g,onCreateVoice:w,onRenameCustom:k,onPreviewCustom:x,onDeleteCustom:b,notifyOn:j,onToggleNotify:S,notifyVetoed:_,notifyPermission:E,onAskNotify:T}){var M;const R=wee(E),A=Ll(),U=j&&!_&&!A,I=JG(f),q=((M=d.find(L=>L.id===I))==null?void 0:M.name)??"the same custom sound",P=I?`Both tones use “${q}”. They may be harder to tell apart.`:"",O=mt(e,{popover:!0});FM(O,()=>u.current,e);const V=v.useRef(null),$=id(!R.ask,V);return a.jsxs("div",{ref:O,id:"sound-menu",className:"sound-menu",role:"dialog","aria-label":"Sound settings",children:[a.jsxs("div",{className:"sm-switches",children:[a.jsxs("label",{className:"sm-switch",children:[a.jsx("span",{className:"sm-switch-label",id:"sm-sound-label",children:"Sounds"}),a.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:a.jsx("span",{className:"switch-knob"})})]}),a.jsxs("div",{className:"sm-setting",children:[a.jsxs("label",{className:"sm-switch",children:[a.jsx("span",{className:"sm-switch-label",id:"sm-notify-label",children:"Notifications while closed"}),a.jsx("button",{ref:V,type:"button",role:"switch","aria-checked":j,"aria-labelledby":"sm-notify-label",className:"switch",onClick:S,title:"With no deck tab open, a notification wherever a sound would play",children:a.jsx("span",{className:"switch-knob"})})]}),a.jsx("p",{className:"sm-note",children:_?yee:gee(A)})]})]}),U&&a.jsxs("section",{className:"sm-channel","aria-labelledby":"sm-channel-name",children:[a.jsxs("div",{className:"sm-channel-head",children:[a.jsx("h3",{className:"sm-channel-name",id:"sm-channel-name",children:"Browser notifications"}),R.ask?a.jsx("button",{type:"button",className:"btn sm-channel-action",onClick:()=>{$(),T()},children:"Enable"}):a.jsxs("span",{className:"sm-channel-state","data-ok":R.ok||void 0,children:[R.ok&&a.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:a.jsx("path",{d:"M1.5 5.2 3.9 7.6 8.5 2.4"})}),R.status]})]}),a.jsx("p",{className:"sm-note",children:R.note})]}),!t&&a.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."}),a.jsx("div",{className:"sm-tones",children:Lu.map(L=>a.jsx(Cee,{chime:L,tone:r[L],soundOn:t,customAssets:d,customSelections:f,onLevel:s,onFigure:i,onPreview:l,onBuiltInSelected:h,onCustomSelected:p},L))}),P&&a.jsx("p",{className:"sm-note","aria-hidden":!0,children:P}),a.jsx("p",{className:"vis-hidden",role:"status",children:P}),a.jsx(See,{customAssets:d,onImportCustom:g,onCreateVoice:w,onRenameCustom:k,onPreviewCustom:x,onDeleteCustom:b}),a.jsxs("p",{className:"sm-foot",children:[a.jsx("kbd",{children:"M"}),"Mute or unmute sounds anywhere."]})]})}function Ree({sessionListOpen:e,toggleSessionList:t,usagePanelOpen:n,setUsagePanelOpen:r,setUsageHistoryOpen:s}){return a.jsxs("div",{className:"action-run",children:[a.jsxs("button",{className:"btn icon-btn",onClick:t,title:`${e?"Hide":"Show"} session list (L)`,"aria-label":"Toggle session list","aria-expanded":e,"aria-controls":e?"session-list":void 0,children:[a.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:[a.jsx("path",{d:"M5.4 3.6h6.6M5.4 7h6.6M5.4 10.4h6.6"}),a.jsx("path",{d:"M2.2 3.6h.2M2.2 7h.2M2.2 10.4h.2"})]}),a.jsx("span",{className:"tb-word",children:"Session list"})]}),a.jsxs("button",{className:"btn icon-btn",onClick:()=>r(i=>!i),title:`${n?"Hide":"Show"} usage panel (U)`,"aria-label":"Toggle usage panel","aria-expanded":n,"aria-controls":n?"usage-panel":void 0,children:[a.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:[a.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"}),a.jsx("path",{d:"M7 1.6v1.5M7 10.9v1.5"})]}),a.jsx("span",{className:"tb-word",children:"Usage"})]}),a.jsxs("button",{className:"btn icon-btn",onClick:()=>s(i=>!i),title:"Usage history — ccusage (H)","aria-label":"Open usage history","aria-haspopup":"dialog",children:[a.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:[a.jsx("line",{x1:"3",y1:"11.5",x2:"3",y2:"7"}),a.jsx("line",{x1:"7",y1:"11.5",x2:"7",y2:"3"}),a.jsx("line",{x1:"11",y1:"11.5",x2:"11",y2:"8.5"})]}),a.jsx("span",{className:"tb-word",children:"History"})]})]})}function Aee({providers:e,accountsPanelOpen:t,toggleAccountsPanel:n,machinePanelOpen:r,setMachinePanelOpen:s,watchOn:i,watchUnseen:l,setBrowserWatchOpen:u}){return a.jsxs("div",{className:"action-run",children:[e.claude&&a.jsxs("button",{className:"btn icon-btn",onClick:n,title:`${t?"Hide":"Show"} accounts (A)`,"aria-label":"Toggle accounts panel","aria-expanded":t,"aria-controls":t?"accounts-panel":void 0,children:[a.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:[a.jsx("circle",{cx:"7",cy:"4.6",r:"2.4"}),a.jsx("path",{d:"M2.4 12c0-2.3 2.1-3.7 4.6-3.7s4.6 1.4 4.6 3.7"})]}),a.jsx("span",{className:"tb-word",children:"Accounts"})]}),a.jsxs("button",{className:"btn icon-btn",onClick:()=>s(d=>!d),title:`${r?"Hide":"Show"} this machine — cores, memory, temperature (S)`,"aria-label":"Toggle machine detail","aria-expanded":r,"aria-controls":r?"system-panel":void 0,children:[a.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:[a.jsx("rect",{x:"3.6",y:"3.6",width:"6.8",height:"6.8",rx:"1.2"}),a.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"})]}),a.jsx("span",{className:"tb-word",children:"Machine"})]}),a.jsxs("button",{className:"btn icon-btn bw-btn",onClick:()=>u(d=>!d),title:i?"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, ${i?"watching":"not watching"}`+(l>0?`, ${l} unread`:""),"aria-haspopup":"dialog",children:[a.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:[a.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"}),i||l>0?a.jsx("circle",{cx:"7",cy:"7",r:"1.8",fill:"currentColor",stroke:"none"}):a.jsx("line",{x1:"2.4",y1:"11.6",x2:"11.6",y2:"2.4"})]}),a.jsx("span",{className:"tb-word",children:"Browser watch"}),l>0&&a.jsx("span",{className:"bw-badge","aria-hidden":!0,children:l})]})]})}function Mee({providers:e,sound:t,tones:n,customTones:r,notify:s,chimeState:i,menus:l,appearance:u,fm:d}){const{soundOn:f,toggleSound:h}=t,{tonePrefs:p,previewTone:g,changeTone:w}=n,{customSelections:k,customAssets:x,clearCustomOnly:b,selectCustomTone:j,importNotificationAudio:S,createNotificationVoice:_,renameCustomAsset:E,deleteCustomAsset:T,previewCustomAsset:R}=r,{notifyPermission:A,notifyOn:U,notifyVetoed:I,toggleNotify:q,notifySupported:P,askForNotifications:O}=s,{soundMenuOpen:V,setSoundMenuOpen:$,soundButtonRef:M,appearanceMenuOpen:L,setAppearanceMenuOpen:Y,appearanceButtonRef:K}=l,{theme:D,setTheme:z,characterEnabled:F,setCharacterEnabled:H}=u,{fmVolume:J,setFmVolume:W,fmMuted:G,setFmMuted:X,fmSource:Z,customFmStations:ee,unavailableFmStations:re,addFmStation:ce,renameFmStation:ie,removeFmStation:fe,pickFmSource:de}=d;return a.jsxs("div",{className:"action-run action-run-utility",children:[e.claude&&f!==null&&a.jsxs("div",{className:"sound-slot",children:[a.jsxs("button",{ref:M,className:"btn icon-btn",onClick:()=>$(we=>!we),...Jr(!1),title:BQ(e,{on:f===!0,locked:i==="locked",prefs:p}),"aria-label":`Sound settings, ${f?"on":"off"}`,"aria-haspopup":"dialog","aria-expanded":V,"aria-controls":V?"sound-menu":void 0,children:[a.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:[a.jsx("path",{d:"M3.2 5.2h2L7.8 3v8L5.2 8.8h-2z"}),f?a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M9.8 5.4a2.4 2.4 0 0 1 0 3.2"}),a.jsx("path",{d:"M11.3 3.9a4.6 4.6 0 0 1 0 6.2"})]}):a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M10 5.6l2.6 2.8"}),a.jsx("path",{d:"M12.6 5.6L10 8.4"})]})]}),a.jsx("span",{className:"tb-word",children:"Sound"})]}),V&&a.jsx(Tee,{onClose:()=>$(!1),soundOn:f===!0,onToggleSound:h,prefs:p,onLevel:(we,xe)=>w(we,{level:xe}),onFigure:(we,xe)=>w(we,{figure:xe}),onPreview:we=>g(we),customAssets:x,customSelections:k,onBuiltInSelected:b,onCustomSelected:j,onImportCustom:S,onCreateVoice:_,onRenameCustom:E,onPreviewCustom:R,onDeleteCustom:T,notifyOn:U,onToggleNotify:q,notifyVetoed:I,notifyPermission:P?A:"unsupported",onAskNotify:O,openerRef:M})]}),a.jsxs("div",{className:"appearance-slot",children:[a.jsx("button",{ref:K,className:"btn icon-btn",onClick:()=>{$(!1),Y(we=>!we)},title:"Appearance settings","aria-label":`Appearance settings, ${D} theme, character ${F?"shown":"hidden"}`,"aria-haspopup":"dialog","aria-expanded":L,"aria-controls":L?"appearance-menu":void 0,children:D==="dark"?a.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:[a.jsx("circle",{cx:"7",cy:"7",r:"2.5"}),a.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"})]}):a.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:a.jsx("path",{d:"M11.8 8.4A5 5 0 1 1 5.6 2.2a4 4 0 0 0 6.2 6.2Z"})})}),L&&a.jsx(fee,{theme:D,onTheme:z,characterEnabled:F,onToggleCharacter:()=>H(we=>!we),fmVolume:J,onFmVolume:W,fmMuted:G,onFmMuted:()=>X(we=>!we),fmSource:Z,onFmSource:de,customFmStations:ee,unavailableFmStations:re,onAddFmStation:ce,onRenameFmStation:ie,onRemoveFmStation:fe,onClose:()=>Y(!1)})]})]})}const $ee=5*6e4,Iee=6e4;function Oee({shown:e,tabVisible:t,lastReadAt:n,now:r,lastSince:s,since:i}){return!e||!t?!1:s&&i&&s!==i?!0:n===null||r-n>=$ee}function MR(e=new Date){return xM("month",e)}function Lee(e){const t=$d(e);return{cost:t.cost,tokens:t.tokens}}function $R(e){return e>0?Be(e):"$0.00"}const Pee=new Set(["idle","checking","current","downloading","ready","error"]);function IR(e){if(!e||typeof e!="object")return null;const t=e;if(typeof t.status!="string"||!Pee.has(t.status))return null;const n=typeof t.version=="string"&&t.version.trim()?t.version.trim():null;return t.status==="ready"&&!n?null:{status:t.status,version:n}}function Dee(e){return(e==null?void 0:e.status)==="ready"&&e.version?{version:e.version}:null}function Fee(e=typeof navigator>"u"?"":navigator.userAgent){var t;return((t=/\bccdeck-desktop\/(\d[^\s]*)/.exec(e))==null?void 0:t[1])??null}const gd="Restart to update",rO=3e4;function qee(e=typeof navigator>"u"?"":navigator.userAgent){return/\bMac OS X\b|\bMacintosh\b/.test(e)?"the ccdeck menu in the menu bar":"the ccdeck tray menu"}function Bee(e,t){const n=`v${e} → v${t}`;return{text:n,label:`${n}, update downloaded and verified`,title:`ccdeck v${t} is downloaded and verified · click to open What's new, where ${gd} comes first`}}function Uee(e){const t=e==null?void 0:e.reason;return t==="app_disconnected"||t==="update_not_ready"?t:"refused"}function zee(e,t,n=typeof navigator>"u"?"":navigator.userAgent){const r=qee(n),s=`Use ${gd} in ${r}.`;switch(e){case"app_disconnected":return`Nothing restarted: the app is not connected to this deck, so the request had nowhere to go. ${s}`;case"update_not_ready":return`Nothing restarted: the app no longer has v${t} ready. When it has one, ${gd} is in ${r}.`;case"timeout":return`ccdeck has not restarted after ${rO/1e3} seconds. ${s}`;case"refused":return`Nothing restarted: the deck turned the request down. ${s}`;case"unreachable":return`Nothing restarted: the request did not reach the deck. ${s}`}}const Hee="Update checks are off (AGENTS_DECK_NO_UPDATE_CHECK=1)",$v="click for what's new";function Wee(e){if(e.checkDisabled)return`${Hee} · ${$v}`;if(e.checking)return`Asking npm for the newest release… · ${$v}`;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 · ${$v}, and to check npm now`}function Vee(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 Gee(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 sO(e){return e?`${e.kind}:${e.to}`:""}function Kee(e,t){return e!=null&&t!==sO(e)}function Yee({readyAppUpdate:e,notice:t,noticeOpen:n,version:r,chipVersion:s,versionChecking:i,now:l,openReleaseNotes:u,showNotice:d,loadVersion:f}){return a.jsx(a.Fragment,{children:e?(()=>{const h=Bee(Fee()??s,e.version);return a.jsxs("button",{type:"button",className:"v ready",onClick:u,"aria-haspopup":"dialog","aria-label":h.label,title:h.title,children:[h.text,a.jsx("span",{className:"v-dot","aria-hidden":!0})]})})():t?a.jsxs("button",{type:"button",className:"v stale",onClick:()=>{u(),d()},"aria-haspopup":"dialog","aria-label":Gee({...t,open:n}),title:t.kind==="restart"?`Running v${t.from}; v${t.to} is installed on disk. Restart to pick it up · click for what's new`:`Running v${t.from}; v${t.to} is on npm · click for what's new`,children:["v",t.from,a.jsx("span",{className:"v-dot","aria-hidden":!0})]}):(()=>{const h={running:s,latest:r==null?void 0:r.latest,latestPending:r==null?void 0:r.latestPending,checkedAgo:r!=null&&r.checkedAt?ed(l-r.checkedAt):null,checkFailedAgo:r!=null&&r.checkFailedAt&&r.checkFailedAt>(r.checkedAt??0)?ed(l-r.checkFailedAt):null,checkDisabled:r==null?void 0:r.checkDisabled,checking:i};return a.jsxs("button",{type:"button",className:i?"v checking":"v",onClick:()=>{u(),f(!0)},"aria-busy":i||void 0,"aria-haspopup":"dialog","aria-label":Vee(h),title:Wee(h),children:["v",h.running]})})()})}function Xee({live:e,paused:t,pauseGate:n,monthUsageRef:r,monthlyUsage:s,monthlyUsageUnavailable:i}){return a.jsxs("span",{className:"status",children:[(()=>{const l=d8({connected:e,paused:t,held:n.size,dropped:n.dropped});return l.resting?null:a.jsx("span",{className:`pill ${l.tone}`,title:l.title,children:a.jsxs("span",{className:"pill-box",children:[a.jsx("span",{className:"pill-widest","aria-hidden":!0,children:l.widest}),a.jsx("span",{className:"pill-label",children:l.label})]})})})(),a.jsxs("span",{ref:r,className:"month-usage",title:s?`${s.tokens.toLocaleString()} tokens · ${$R(s.cost)} spent since the 1st of this local calendar month`:i?"Monthly usage is unavailable — ccusage could not be read":"Loading usage since the 1st of this local calendar month",children:[a.jsx("span",{className:"month-usage-label",children:"this month"}),s?a.jsxs(a.Fragment,{children:[a.jsx("b",{children:st(s.tokens)}),a.jsx("span",{className:"month-usage-unit",children:"tokens"}),a.jsx("span",{className:"month-usage-sep","aria-hidden":!0,children:"·"}),a.jsx("b",{children:$R(s.cost)})]}):a.jsx("span",{className:"month-usage-pending",children:i?"unavailable":"…"})]})]})}function Zee({waitingSessions:e,waitingCursorRef:t,focusSession:n,now:r}){return a.jsxs("button",{type:"button",className:"waiting-stat",onClick:()=>{t.current=e[0].id,n(e[0].id)},title:`Blocked waiting for you — click, or press W, to go to the one that has been stuck longest:
|
|
92
|
-
${e.map(s=>` ${s.label}: ${Jo(s.waiting)} (${ed(r-s.waiting.since)})`).join(`
|
|
93
|
-
`)}`,"aria-label":`${e.length} session${e.length===1?"":"s"} waiting for you`,children:[a.jsx("span",{className:"ap-pulse","aria-hidden":!0}),a.jsx("b",{children:e.length})," ",a.jsx("span",{className:"ws-word",children:"waiting"})]})}const Fx={on:"The deck will raise a system notification when a session blocks on you and this tab is in the background",blocked:"Notifications are blocked for this page. Only your browser can undo that — its site settings for this address"};function Jee(e){return e==="on"?`Notifications on. ${Fx.on}.`:e==="blocked"?`${Fx.blocked}.`:""}function Qee({notifySaid:e}){return a.jsx("span",{className:e==="on"?"notify-said":"notify-said notify-said-blocked","aria-hidden":!0,title:Fx[e],children:e==="on"?"notifications on":"notifications blocked"})}function ete({versionCheck:e,welcome:t,desktopUpdate:n,pause:r,monthly:s,announcements:i,notify:l,waitingSessions:u,waitingCursorRef:d,focusSession:f,live:h,now:p,incidents:g}){const{version:w,notice:k,noticeOpen:x,showNotice:b,versionChecking:j,loadVersion:S}=e,{chipVersion:_,openReleaseNotes:E}=t,{readyAppUpdate:T}=n,{paused:R,pauseGate:A}=r,{monthlyUsage:U,monthlyUsageUnavailable:I,monthUsageRef:q}=s,{blockedSaid:P,watchSaid:O,incidentSaid:V}=i,{notifySaid:$}=l;return a.jsxs("div",{className:"readout",children:[a.jsxs("div",{className:"brand",children:[a.jsx("span",{className:"logo"}),a.jsx("h1",{children:vt}),a.jsx(Yee,{readyAppUpdate:T,notice:k,noticeOpen:x,version:w,chipVersion:_,versionChecking:j,now:p,openReleaseNotes:E,showNotice:b,loadVersion:S})]}),a.jsx(Xee,{live:h,paused:R,pauseGate:A,monthUsageRef:q,monthlyUsage:U,monthlyUsageUnavailable:I}),a.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:P}),a.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:O}),a.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:V}),a.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:Jee($)}),a.jsx(Ez,{incidents:g}),u.length>0&&a.jsx(Zee,{waitingSessions:u,waitingCursorRef:d,focusSession:f,now:p}),$&&a.jsx(Qee,{notifySaid:$})]})}function tte({selected:e,now:t,selectedIds:n,focusAgent:r,clearSelection:s}){const i=un(e),l=Math.max(0,((e.endedAt??t)-e.startedAt)/1e3),u=e.state==="active"?h0(i.total,l):null,d=n.size-1;return a.jsxs("button",{type:"button",className:"selected-ribbon",title:`Zoom to ${e.label} and its session (Z)${i.total>0?`
|
|
94
|
-
${Be(i.total)} spent${u?` · ${u}`:""}`:""}`,onClick:()=>{try{r(e.id)}catch{}},children:[a.jsx("span",{className:`state-pill state-${e.state}`,children:e.state==="active"?"live":e.state}),a.jsx("span",{className:"selected-label",children:e.label}),i.total>0&&a.jsxs("span",{className:"selected-cost",children:[Be(i.total),u?a.jsxs("span",{className:"selected-rate",children:[" · ",u]}):null]}),d>0&&a.jsxs("span",{className:"selected-extra",children:["+",d]}),a.jsx("span",{"aria-hidden":!0,className:"selected-close",onClick:f=>{f.stopPropagation(),s()},children:"×"})]})}function nte({catBarRef:e,catBarOccluded:t,presentCats:n,hiddenCats:r,toggleCat:s}){return a.jsx("div",{ref:e,className:`cat-filter-bar${t?" occluded":""}`,role:"group","aria-label":"Filter tools by category",children:n.map(i=>{const l=r.has(i);return a.jsxs("button",{type:"button",className:`cat-filter${l?" off":""}`,onClick:()=>s(i),"aria-pressed":!l,title:`${l?"Show":"Hide"} ${md[i]} tools`,children:[a.jsx(ZQ,{cat:i}),a.jsx("span",{className:"cat-name",children:md[i]})]},i)})})}const rte=["a[href]","button:not(:disabled)","input:not(:disabled)","select:not(:disabled)","textarea:not(:disabled)","summary","[tabindex]"].join(",");function ste(e){var n,r;const t=e.target;!(t!=null&&t.closest)||t.closest(rte)!==e.currentTarget||(e.preventDefault(),(r=(n=document.activeElement)==null?void 0:n.blur)==null||r.call(n))}function ate({trashZoneRef:e,trashState:t,trashPhase:n,trashLabel:r}){return a.jsxs("div",{ref:e,className:`drag-trash-zone ${t}${n==="leaving"?" leaving":""}`,role:"status",children:[a.jsx("svg",{className:"drag-trash-icon",viewBox:"0 0 24 24","aria-hidden":"true",children:a.jsx("path",{d:"M8 7V5.8C8 4.8 8.8 4 9.8 4h4.4c1 0 1.8.8 1.8 1.8V7m-10 0h12M8 10v8m4-8v8m4-8v8M7 7l.7 13h8.6L17 7"})}),a.jsxs("span",{className:"drag-trash-copy",children:[a.jsx("span",{className:"drag-trash-text",children:t==="over"?a.jsxs(a.Fragment,{children:["Release to remove ",a.jsx("strong",{className:"drag-trash-name",children:r||"this card"})]}):"Drop here to remove from the board"}),a.jsx("span",{className:"drag-trash-hint",children:t==="over"?"The session list (L) brings it back":"The session keeps running"})]})]})}function ote({canvasRef:e,bubbling:t,dragging:n,trash:r,zoom:s,viewport:i,stateRef:l,peek:u,children:d}){const{trashDragging:f,trashState:h,trashPhase:p,trashZoneRef:g,trashLabel:w}=r,{lod:k,lodRef:x}=s,{markCanvasInput:b}=i,{peekAgent:j,peekLabel:S,peekRecap:_,peekBounds:E}=u;return a.jsxs("main",{id:"canvas",tabIndex:-1,className:`canvas-wrap${t?" bubbling":""}${n?" dragging-any":""}${f&&h==="over"?" trash-hover":""}`,"data-lod":k,ref:e,onMouseDownCapture:ste,onPointerDownCapture:b,onPointerUpCapture:b,onWheelCapture:b,onFocusCapture:T=>{const R=T.target;if(!sb(R)||x.current==null||x.current==="detail")return;const A=R.getAttribute("data-id");A&&l.current.agents.has(A)&&R.matches(":focus-visible")&&HI(A,R,"focus")},onBlurCapture:T=>{var A,U;const R=(U=(A=T.target).getAttribute)==null?void 0:U.call(A,"data-id");R&&Gs(R)},children:[d,Au(p)&&a.jsx(ate,{trashZoneRef:g,trashState:h,trashPhase:p,trashLabel:w}),a.jsx(MJ,{agentFor:j,recapFor:_,labelFor:S,bounds:E})]})}function ite({restarting:e,restartMode:t,live:n,paused:r}){return a.jsxs("div",{className:"conn-banner",role:"alert",children:[a.jsx("span",{className:"conn-dot"}),e?t==="npx"?"Fetching the new version with npx — this can take a minute…":`Restarting ${vt}…`:(()=>{const s=c8({connected:n,paused:r});return a.jsxs(a.Fragment,{children:[`Lost connection to the ${vt} server. Reconnecting…`,s&&a.jsx("span",{className:"conn-sub",children:s})]})})()]})}function lte({oldName:e,version:t,dismissOldName:n}){return a.jsxs("div",{className:"ver-banner",role:"status",children:[a.jsx("span",{className:"ver-dot"}),a.jsxs("strong",{children:[e," still works — the deck is called ",vt," now."]}),t!=null&&t.renameFix?a.jsx("span",{className:"ver-sub",children:t.renameFix}):null,a.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:n,children:"×"})]})}const cte=3e4;function ute({bundle:e,running:t,lastTried:n}){return!t||e===t?!1:n!==t}function dte({bundle:e,running:t,pending:n,lastTried:r}){return t?ute({bundle:e,running:t,lastTried:r})?"reload":n==null||n&&n!==t?"wait":"confirm":"wait"}function hte(e){return!e||e.state!=="failed"?null:`${typeof e.at=="number"?e.at:0}:${e.error??""}`}function fte({asked:e,reported:t}){return t?t!==e:!1}function aO(e){const t=e.thresholdMs??cte;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 pte(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 mte(e,t){return e?t==null?"auto when idle":`auto in ${pte(t)}`:"auto-restart off"}function OR(e){let t=0;for(const n of e)n.state==="active"&&t++;return t}function gte(e,t=!1){return e<=0&&t?{label:"Restart anyway",clause:"the canvas is paused — running agents cannot be seen"}: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 yte(e){const t=aO(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}}const LR={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:"};function wte({notice:e,version:t,dismissNotice:n,upgradeState:r,startUpgrade:s,copyCommand:i,cmdCopied:l,autoRestart:u,toggleAutoRestart:d,askRestart:f,restartCopy:h,restartFuseMs:p,restarting:g}){var w,k,x;return a.jsxs("div",{className:`ver-banner ${e.kind}`,role:"status",children:[a.jsx("span",{className:`ver-dot${p==null?"":" armed"}`}),e.kind==="restart"?a.jsxs(a.Fragment,{children:[a.jsxs("strong",{children:["v",e.to," is installed — this deck still runs v",e.from,"."]}),t!=null&&t.canRestart?a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"ver-act",onClick:()=>f(),...Jr(g),title:`Stop this process and bring it back on the same port. The canvas replays from the event log.
|
|
95
|
-
|
|
96
|
-
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:g?"restarting…":h.label}),!g&&a.jsx("span",{className:"ver-sub",children:h.clause}),a.jsxs("label",{className:"ver-auto",children:[a.jsx("button",{type:"button",className:"switch",role:"switch","aria-checked":u,onClick:d,"aria-label":"Auto-restart when idle",title:u?"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:a.jsx("span",{className:"switch-knob"})}),a.jsx("span",{"aria-hidden":!0,children:mte(u,p)})]})]}):a.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."})]}):a.jsxs(a.Fragment,{children:[a.jsxs("strong",{children:[vt," v",e.to," is out — you are on v",e.from,"."]}),(t==null?void 0:t.upgradeMode)==="install"&&r!=="failed"&&a.jsx("button",{type:"button",className:"ver-act",onClick:s,...Jr(r==="running",r==="done"),title:`Runs ${((w=t==null?void 0:t.upgrade)==null?void 0:w.command)??(t==null?void 0:t.command)??"npm i -g"} here, then restarts once nothing is running.`,children:r==="running"?"installing…":r==="done"?"installed":"Update now"}),(t==null?void 0:t.upgradeMode)==="npx"&&(t==null?void 0:t.canRestart)&&a.jsx("button",{type:"button",className:"ver-act",onClick:()=>f({upgrade:!0}),...Jr(g),title:`Runs ${t==null?void 0:t.command} and hands it this port. Nothing is installed globally — npx unpacks its own copy.`,children:g?"fetching…":r==="failed"?"Retry update":"Update & restart"}),r==="failed"?a.jsxs("span",{className:"ver-sub fail",title:((k=t==null?void 0:t.upgrade)==null?void 0:k.error)??"",children:[(t==null?void 0:t.upgradeMode)==="npx"?"update failed":"install failed",": ",((x=t==null?void 0:t.upgrade)==null?void 0:x.error)??"unknown error"," — run it yourself:"]}):(t==null?void 0:t.upgradeMode)==="npx"?a.jsx("span",{className:"ver-sub",children:t!=null&&t.canRestart?"npx cannot upgrade in place, so the deck re-runs:":LR.npx}):t!=null&&t.upgradeBlocked?a.jsx("span",{className:"ver-sub",children:It(LR,t.upgradeBlocked)??"cannot install from here"}):null,a.jsxs("button",{type:"button",className:"ver-cmd",onClick:i,title:"Copy to clipboard",children:[a.jsx("code",{children:t==null?void 0:t.command}),a.jsx("span",{className:"ver-cmd-hint",children:l?"copied":"copy"})]})]}),a.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:n,children:"×"})]})}function vte({restart:e,versionCheck:t,upgrade:n,oldNameNotice:r,everConnected:s,live:i,paused:l}){const{autoRestart:u,toggleAutoRestart:d,restarting:f,restartMode:h,restartedTo:p,askRestart:g,restartCopy:w,restartFuseMs:k}=e,{version:x,notice:b,noticeOpen:j,dismissNotice:S}=t,{upgradeState:_,startUpgrade:E,copyCommand:T,cmdCopied:R}=n,{oldName:A,oldNameOpen:U,dismissOldName:I}=r;return p?a.jsxs("div",{className:"ver-banner done",role:"status",children:[a.jsx("span",{className:"ver-dot"}),a.jsxs("strong",{children:["Restarted — now running v",p,"."]}),a.jsx("span",{className:"ver-sub",children:"The canvas replayed from the event log."})]}):s&&!i?a.jsx(ite,{restarting:f,restartMode:h,live:i,paused:l}):j&&b?a.jsx(wte,{notice:b,version:x,dismissNotice:S,upgradeState:_,startUpgrade:E,copyCommand:T,cmdCopied:R,autoRestart:u,toggleAutoRestart:d,askRestart:g,restartCopy:w,restartFuseMs:k,restarting:f}):U&&A?a.jsx(lte,{oldName:A,version:x,dismissOldName:I}):null}function xte(e,t){return e==="confirmation"?t.confirmOpen?"clear":"ignore":t.modalOpen||t.confirmOpen?"ignore":"confirm"}function bte(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 kte(e){return e<=0?null:e===1?"the one agent":`all ${e} agents`}function Nte(e,t){const n=kte(e),r=(...l)=>[n?`${n} on the canvas`:null,...l,"layout, pins and selection"].filter(u=>u!==null),s="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:s,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. ${s}`,confirm:"Clear everything"};if(!t.mine){const l=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 — ${l}${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:s,confirm:"Clear everything"};const i=t.decks-1;return{goes:r(`the event log ${i===1?"1 other running deck shares":`${i} other running decks share`} with this one — every session recorded in it, not just the ones drawn here`),stays:[i===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:s,confirm:"Clear everything"}}function jte({agentCount:e,onConfirm:t,onCancel:n}){const r=v.useRef(null),s=mt(n,{focusRef:r,layer:Fq}),[i,l]=v.useState(null);v.useEffect(()=>{let p=!1;return fetch("/api/clear").then(g=>g.ok?g.json():null).then(g=>{p||l(bte(g))}).catch(()=>{}),()=>{p=!0}},[]);const{goes:u,stays:d,final:f,confirm:h}=Nte(e,i);return a.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:a.jsxs("div",{ref:s,className:"modal clear-confirm",onClick:p=>p.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"clear-confirm-title",children:[a.jsxs("header",{className:"modal-head",children:[a.jsxs("div",{className:"modal-title",children:[a.jsx("span",{className:"status-dot err","aria-hidden":!0}),a.jsx("span",{id:"clear-confirm-title",className:"modal-tool-name",children:"Clear the deck?"})]}),a.jsx("div",{className:"modal-actions",children:a.jsx("button",{type:"button",className:"glyph-btn",onClick:n,"aria-label":"Cancel (Esc)",title:"Cancel (Esc)",children:"×"})})]}),a.jsxs("section",{className:"modal-body",children:[a.jsxs("dl",{className:"cc-plan",children:[a.jsx("dt",{children:"Goes"}),a.jsx("dd",{children:u.map(p=>a.jsx("span",{children:p},p))}),a.jsx("dt",{children:"Stays"}),a.jsx("dd",{children:d.length>0?d.map(p=>a.jsx("span",{children:p},p)):a.jsx("span",{children:"nothing"})})]}),f&&a.jsx("p",{className:"cc-final",children:f}),a.jsxs("div",{className:"cc-actions",children:[a.jsx("button",{type:"button",ref:r,className:"btn",onClick:n,children:"Cancel"}),a.jsx("button",{type:"button",className:"btn danger",onClick:t,children:h})]})]})]})})}const Ste="Press Esc first if a key does nothing.",_te=[{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:"Delete",action:"take the selected card off the board — Undo brings it back",binds:["Delete"]},{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 Ete({onClose:e,onTour:t}){const n=mt(e);return a.jsx("div",{className:"modal-backdrop",onClick:e,role:"presentation",children:a.jsxs("div",{ref:n,className:"modal key-help",onClick:r=>r.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"key-help-title",children:[a.jsxs("header",{className:"modal-head",children:[a.jsx("div",{className:"modal-title",children:a.jsx("span",{id:"key-help-title",className:"modal-tool-name",children:"Keyboard shortcuts"})}),a.jsx("div",{className:"modal-actions",children:a.jsx("button",{type:"button",className:"glyph-btn",onClick:e,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),a.jsxs("section",{className:"modal-body",children:[t&&a.jsxs("div",{className:"guide-door",children:[a.jsx("span",{children:"Eight pictures of what the deck shows."}),a.jsx("button",{type:"button",className:"btn",onClick:t,children:"Take the tour"})]}),a.jsx("div",{className:"shortcuts",children:_te.map(r=>a.jsxs(v.Fragment,{children:[a.jsx("h3",{className:"kh-group",children:r.title}),r.rows.map(s=>a.jsxs("div",{className:"sc",children:[a.jsx("kbd",{children:s.cap}),a.jsx("span",{children:s.action})]},`${r.title}:${s.cap}:${s.action}`))]},r.title))}),a.jsx("p",{className:"kh-foot",children:Ste})]})]})})}function Cte(e,t){const n=(e??[]).filter(s=>s&&typeof s.fp=="string"&&!t.has(s.fp));if(!n.length)return{request:null,waiting:0};const r=[...n].sort((s,i)=>(s.at??0)-(i.at??0));return{request:r[0],waiting:r.length-1}}function Tte({request:e,waiting:t,busy:n,now:r,onAccept:s,onDecline:i,onLater:l}){const u=v.useRef(null),d=mt(l,{focusRef:u}),f=Vs(n,"accept"),h=Vs(n,"dismiss");return a.jsx("div",{className:"modal-backdrop",onClick:l,role:"presentation",children:a.jsxs("div",{ref:d,className:"modal lan-ask",onClick:p=>p.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"lan-ask-title","aria-describedby":"lan-ask-who",children:[a.jsxs("header",{className:"modal-head",children:[a.jsxs("div",{className:"modal-title",children:[a.jsx("i",{className:"ap-pulse","aria-hidden":!0}),a.jsx("span",{id:"lan-ask-title",className:"modal-tool-name",children:"A deck wants to pair"})]}),a.jsx("div",{className:"modal-actions",children:a.jsx("button",{type:"button",className:"glyph-btn",onClick:l,"aria-label":"Answer later (Esc)",title:"Answer later (Esc)",children:"×"})})]}),a.jsxs("section",{className:"modal-body",children:[a.jsxs("p",{id:"lan-ask-who",className:"lan-ask-who",children:[a.jsx("strong",{className:"lan-ask-name",children:e.name})," at ",a.jsx("code",{className:"ap-lan-code",children:e.addr})," · asked ",$0(e.at,r)]}),a.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."}),a.jsxs("p",{className:"lan-ask-fp",children:["Its fingerprint is ",a.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&&a.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.`}),a.jsxs("div",{className:"lan-ask-acts",children:[a.jsx("button",{type:"button",ref:u,className:"btn",disabled:h.disabled,"aria-busy":h.busy,onClick:i,title:"Nothing is shared. If that deck asks again, this comes back.",children:n==="dismiss"?"declining…":"Decline"}),a.jsx("button",{type:"button",className:"btn primary",disabled:f.disabled,"aria-busy":f.busy,onClick:s,title:"Talk to this deck from now on, and repair its expired logins with this deck's own.",children:n==="accept"?"accepting…":"Accept"})]})]})]})})}function Rte({lanPending:e,lanDeferred:t,lanBusy:n,answerLanPair:r,deferLanPair:s}){const{request:i,waiting:l}=Cte(e,t.current);return i?a.jsx(Tte,{request:i,waiting:l,busy:n,now:Date.now(),onAccept:()=>void r("accept",i.fp),onDecline:()=>void r("dismiss",i.fp),onLater:()=>s(i.fp)},i.fp):null}const Ate={"//":["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.28.1","3.29.3","3.29.4","3.29.6","3.29.7","3.29.9","3.33.1"],"3.33.0":[{title:"🪝 Hooks you add in Claude Code are no longer removed",body:"Claude Code's hook editor often files a new hook into the same group as the deck's own. Starting the deck, or uninstalling it, then removed the whole group, and your hook went with it without a word. The deck now takes out only its own command and leaves yours where it was, and the same goes for the old finish-sound hook. `ccdeck --uninstall` also stops the decks that are running, so an update in the background cannot put the hooks back."},{title:"🧵 Resumed Codex sessions show up again",body:"A Codex session picked up with `codex resume`, or one that ran for days, could go dark on the canvas and drop out of the 5-hour and 7-day usage, because the deck only looked in the two newest day folders. It now follows those sessions and counts their tokens. Two Codex sessions in the same folder get different id suffixes, and a `bash -lc` call shows the command it runs."},{title:"🤝 A deck paired by the accept switch brings in less",body:'A deck that paired through the automatic accept switch, and not through an invite, now brings in only the logins you have ticked on this deck, and nothing from it is ticked for sharing onward. Its dialog says "paired automatically — pair by invite to take it". Pairing by invite works as before. A typed address is no longer dropped after one failed round, and the sync port stays the same after a rename.'},{title:"⬆️ Desktop updates install when you expect them",body:'On Windows and Linux a downloaded update now installs when you quit. On a Mac, Quit installs it and the app stays closed. The Linux .deb needs an administrator password to install, so it no longer does that by itself: it waits for "Restart to update" and says a password is coming. "Start at login" now works on Linux, and "Restart ccdeck" stops a deck that has hung.'},{title:"🕵️ Browser Watch waits before it acts, and quits only its own browser",body:"A program's visit is now logged and reacted to once its quiet window has closed, about 16 minutes after it, and not on the first poll, so a visit that is withdrawn no longer quits the browser. On Linux the quit reaction ends only the browser that holds the watched profile; other Chrome channels and headless browsers keep running. When it cannot tell which process that is, it does nothing and says so, which includes a Flatpak Brave."},{title:"🧮 Figures that were off are right",body:`Spend by labelled and workflow subagents counts toward a session's tokens and cost. The Projects report prices 1-hour cache writes the way ccusage does, so its dollars match the Usage panel. After a restart the deck rebuilds its whole event history, where it used to rebuild about a third. On Linux the process list shows what each process is using now, not its lifetime average. A count near a boundary reads "1.00M", and a full quota window says "used up".`},{title:"🔑 The Usage panel's reads answer the deck's own page only",body:"The routes behind the Usage panel (/api/quota, /api/ccusage, /api/codex-usage, /api/codex-quota and /api/cswap-auto) now answer the deck's own page, or a client that sends the deck's token. A script that read them with a plain request gets 401 from this version on. The hook, the desktop app and the `ccdeck` command are not affected."},{title:"🛠️ Smaller fixes you may notice",body:"With the canvas paused, an update no longer restarts the server while an agent is working: it waits until no turn is open. `ccdeck --stop -p4317` stops that one deck. A deck started at login can update itself on Homebrew and nvm setups. Dialogs keep keyboard focus after a button goes away, screen readers hear pairing requests by deck name and the machine panel's readings, dim text is readable in both themes, Windows High Contrast shows what is selected, and below 640px the detail panel opens over the canvas."}],"3.32.2":[{title:"🔒 Self-updates wait until your screen is unlocked",body:"On Linux with GNOME, the app installs an update by itself when you leave it alone, which is often while your screen is locked. GNOME switches the panel's tray off under the lock screen, and a version that started then never showed its icon. The app now waits until you are back before restarting by itself, so its icon comes back with it."}],"3.32.1":[{title:"🔔 The tray icon comes back on Linux",body:"On Linux the app could lose its icon in the panel, after it updated itself or when the panel restarted, and stay without it until it was quit. It now notices within a minute and restarts by itself the next time you are away from its window, the way it installs an update. It does this at most once every six hours, and not again if a restart did not help."},{title:"🔕 A window you closed stays closed after a self-update",body:"When the app restarted by itself to install an update, it opened its window again even if you had closed it, and while that window was open the deck held back its notifications. A window you closed now stays closed."},{title:"🪟 No empty icon when ccdeck is already open",body:'Opening ccdeck again while it was running flashed an empty "…" icon in the Linux panel before bringing the window forward. It now only brings the window forward.'}],"3.32.0":[{title:"🗺️ A map of your network",body:"A new button on the Local network row, and in its view's header, opens a map of every deck around this one. This deck is at the centre and the paired decks that are on stand around it. Further out are the quiet ones, the machines nearby and any deck asking to pair. Wires are solid on your local network and dashed over Tailscale. Pointing at a deck says how it is reached, what it runs and which logins the two share, and pressing it opens that deck's own dialog."}],"3.31.0":[{title:"📊 Account capacity",body:"A gauge button in the accounts panel's header opens Account capacity: how many of your Claude accounts are ready now, what the 5-hour and 7-day windows have left across all of them, and a row for each account with its use, its state (Ready, Limited, Exhausted or Stale) and when it was last read. Each window also says whose reset comes next."},{title:"🚦 Claude and Codex incidents",body:"When Anthropic's or OpenAI's status page reports an incident on something your sessions use, the deck says so in the topbar, the Usage panel and the tray, and every mark links to the status page. A provider with nothing wrong draws nothing."},{title:"↕️ Order your other accounts",body:"The Other accounts row can sort the list by slot, by how full a window is, or by most room, and open every account at once. Both stay as you left them after a reload."},{title:"🔐 A settings folder left by sudo can be given back",body:'On a Mac, running ccdeck once with sudo left its settings folder owned by another user, and every settings change was refused, sharing an account included. The message now offers "give it back": macOS asks for your password, the folder is yours again, and the deck reads its settings back without a restart.'}],"3.30.0":[{title:"🧮 Token counts and costs are no longer doubled",body:"Claude Code writes a reply that has thinking, text and tool calls as several transcript lines, each carrying the whole request's usage. The deck added up every line, so a session's tokens and cost on its card came out close to twice what it was billed, and the context panel counted each part of a reply as its own message. Each request is now counted once. Expect the totals on your cards to come down."},{title:"⏳ Claude's saved limit resets on the Usage panel",body:`When your Claude account has free limit resets to spend ("Reset for free" in Claude's Settings → Usage), the Claude card now says how many there are and when the first one expires, the way the Codex card already did. The deck only reports them; you spend them in Claude's own settings.`},{title:"🔑 LAN invites need the other deck updated",body:`An invite's code is now a long random secret instead of six digits, so nobody else on the network can work it out and pair in your place, and a wrong code is refused by name. An invite made on this version can only be joined from a deck on this version or later: an older deck answers "That is not an invite". Update that deck, or make the invite on the older one and join it here.`},{title:"🔕 AGENTS_DECK_NO_NOTIFY keeps Browser Watch quiet too",body:"A deck started with AGENTS_DECK_NO_NOTIFY=1 still raised a desktop notification for every new Browser Watch finding. It no longer does. The finding is still in the Browser Watch panel and its log, which says why no notification came."},{title:"🛠️ Smaller fixes",body:'Delete removes the card you just clicked. A LAN address you typed stays in the list when a round cannot reach it, and the status line under the LAN switch now agrees with the rows below it. In the desktop app, a dismissed "update is ready" notice stays dismissed after you answer the first-launch question. Sizes read the same in every panel ("1.1 KB"). Faded text stays readable, a keyboard can see the scrollbar, and numbers use a monospaced font on Windows and Linux as well.'}],"3.29.11":[{title:"💲 Claude Sonnet 5.5 has a price",body:`Sessions on Claude Sonnet 5.5 showed "not priced" on the board, and the Projects report could only show a minimum for them. They are now priced at Anthropic's published rate, the same as Sonnet 5: $2 per million input tokens and $10 per million output tokens.`}],"3.29.10":[{title:"💲 Claude Opus 5.5 has a price",body:`Sessions on Claude Opus 5.5 showed "not priced" on the board, and the Projects report counted them as costing nothing, so its totals read far too low. They are now priced at Anthropic's published rate. If a model still has no price, Projects shows its total as a minimum, like $11.19+, and names the model, instead of a total that looks complete.`}],"3.29.8":[{title:"🔁 Removed cards come back when their agent works again",body:"Remove from board is for finished work. If the agent behind a card you removed starts a tool call, gets a new prompt or starts a subagent, the card returns on its own, together with the card it hangs from, and it stays back after a reload. Cards whose agents stay idle stay removed."}],"3.29.1":[{title:"🗂️ One row per project in Projects",body:"The Projects report now counts a session's work under the folder you started it in, the same name its card has on the canvas, instead of adding a row for every folder the agent moved into. The first start after updating re-reads your transcripts once to regroup the report."},{title:"🔔 Tidier custom sounds",body:"Importing a sound, recording one and choosing a spoken voice now sit in compact cards that respond to clicks and focus like the rest of the deck."}],"3.29.0":[{title:"🎵 Your own stations in Claude FM",body:"Add any YouTube live link or radio stream as a station in Appearance, next to the built-in ones, and mute the music without losing your volume. When a station is not live, the picker now says so instead of staying silent."},{title:"🔔 Notification sounds and voices of your own",body:"Pick a local audio file or a spoken voice for each alert, so the sound that means an agent is waiting is one you will recognise."},{title:"🗑️ Drag a card off the board to remove it",body:"Drag a card to the target at the bottom of the canvas to take it off the board, or use Remove from board in the detail panel (Delete). The session keeps running, and the session list (L) brings it back."},{title:"🔐 Optional invite-only pairing",body:"Pairing works as before, with or without an invite. If you want, Local network can now be set to accept only decks that join with an invite you created, so a nearby machine cannot ask to pair on its own."},{title:"🌐 Account sharing between your machines is more reliable",body:"A locked macOS Keychain is explained instead of failing silently, a login that is broken or belongs to another account is never shared, and a sync that stops partway keeps what already arrived."},{title:"📅 Projects opens on Today",body:"The Projects report per account starts with today's work, and an empty window offers the next wider one. The topbar also shows this month's usage, and the desktop app can restart into an update from its own window."}],"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.
|
|
97
|
-
|
|
98
|
-
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.
|
|
99
|
-
|
|
100
|
-
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.
|
|
101
|
-
|
|
102
|
-
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.
|
|
103
|
-
|
|
104
|
-
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.
|
|
105
|
-
|
|
106
|
-
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".
|
|
107
|
-
|
|
108
|
-
**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.
|
|
109
|
-
|
|
110
|
-
\`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.
|
|
111
|
-
|
|
112
|
-
**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.
|
|
113
|
-
|
|
114
|
-
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.
|
|
115
|
-
|
|
116
|
-
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.
|
|
117
|
-
|
|
118
|
-
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.
|
|
119
|
-
|
|
120
|
-
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.
|
|
121
|
-
|
|
122
|
-
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.
|
|
123
|
-
|
|
124
|
-
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.
|
|
125
|
-
|
|
126
|
-
What you are reading is the first version that does not.
|
|
127
|
-
|
|
128
|
-
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.
|
|
129
|
-
|
|
130
|
-
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.
|
|
131
|
-
|
|
132
|
-
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.
|
|
133
|
-
|
|
134
|
-
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.
|
|
135
|
-
|
|
136
|
-
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.
|
|
137
|
-
|
|
138
|
-
The count of what is behind it is on the heading's tooltip, so collapsing it does not hide how much there is.
|
|
139
|
-
|
|
140
|
-
**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.
|
|
141
|
-
|
|
142
|
-
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.
|
|
143
|
-
|
|
144
|
-
\`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.
|
|
145
|
-
|
|
146
|
-
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.
|
|
147
|
-
|
|
148
|
-
**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.
|
|
149
|
-
|
|
150
|
-
**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.
|
|
151
|
-
|
|
152
|
-
**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.
|
|
153
|
-
|
|
154
|
-
**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.
|
|
155
|
-
|
|
156
|
-
**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.
|
|
157
|
-
|
|
158
|
-
**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.
|
|
159
|
-
|
|
160
|
-
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.
|
|
161
|
-
|
|
162
|
-
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.
|
|
163
|
-
|
|
164
|
-
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.
|
|
165
|
-
|
|
166
|
-
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.
|
|
167
|
-
|
|
168
|
-
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.
|
|
169
|
-
|
|
170
|
-
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.
|
|
171
|
-
|
|
172
|
-
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.
|
|
173
|
-
|
|
174
|
-
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.
|
|
175
|
-
|
|
176
|
-
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.
|
|
177
|
-
|
|
178
|
-
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.
|
|
179
|
-
|
|
180
|
-
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.
|
|
181
|
-
|
|
182
|
-
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.
|
|
183
|
-
|
|
184
|
-
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.
|
|
185
|
-
|
|
186
|
-
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.
|
|
187
|
-
|
|
188
|
-
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.
|
|
189
|
-
|
|
190
|
-
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.
|
|
191
|
-
|
|
192
|
-
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.
|
|
193
|
-
|
|
194
|
-
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.
|
|
195
|
-
|
|
196
|
-
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.
|
|
197
|
-
|
|
198
|
-
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.
|
|
199
|
-
|
|
200
|
-
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.
|
|
201
|
-
|
|
202
|
-
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.
|
|
203
|
-
|
|
204
|
-
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.
|
|
205
|
-
|
|
206
|
-
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.
|
|
207
|
-
|
|
208
|
-
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.
|
|
209
|
-
|
|
210
|
-
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.
|
|
211
|
-
|
|
212
|
-
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.
|
|
213
|
-
|
|
214
|
-
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.
|
|
215
|
-
|
|
216
|
-
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.
|
|
217
|
-
|
|
218
|
-
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.
|
|
219
|
-
|
|
220
|
-
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.
|
|
221
|
-
|
|
222
|
-
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.
|
|
223
|
-
|
|
224
|
-
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.
|
|
225
|
-
|
|
226
|
-
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.
|
|
227
|
-
|
|
228
|
-
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.
|
|
229
|
-
|
|
230
|
-
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.
|
|
231
|
-
|
|
232
|
-
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.
|
|
233
|
-
|
|
234
|
-
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.
|
|
235
|
-
|
|
236
|
-
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.
|
|
237
|
-
|
|
238
|
-
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".
|
|
239
|
-
|
|
240
|
-
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.
|
|
241
|
-
|
|
242
|
-
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.
|
|
243
|
-
|
|
244
|
-
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.
|
|
245
|
-
|
|
246
|
-
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.
|
|
247
|
-
|
|
248
|
-
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.
|
|
249
|
-
|
|
250
|
-
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.
|
|
251
|
-
|
|
252
|
-
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.
|
|
253
|
-
|
|
254
|
-
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.
|
|
255
|
-
|
|
256
|
-
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.
|
|
257
|
-
|
|
258
|
-
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.
|
|
259
|
-
|
|
260
|
-
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.
|
|
261
|
-
|
|
262
|
-
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.
|
|
263
|
-
|
|
264
|
-
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.
|
|
265
|
-
|
|
266
|
-
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.
|
|
267
|
-
|
|
268
|
-
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.
|
|
269
|
-
|
|
270
|
-
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.
|
|
271
|
-
|
|
272
|
-
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.
|
|
273
|
-
|
|
274
|
-
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.
|
|
275
|
-
|
|
276
|
-
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.
|
|
277
|
-
|
|
278
|
-
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.
|
|
279
|
-
|
|
280
|
-
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.
|
|
281
|
-
|
|
282
|
-
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.
|
|
283
|
-
|
|
284
|
-
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.
|
|
285
|
-
|
|
286
|
-
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.
|
|
287
|
-
|
|
288
|
-
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.`}]},ub="agent-dag.releaseNotesSeen";function PR(e){return e.split(/[.\-+]/).map(t=>parseInt(t,10)).map(t=>Number.isNaN(t)?0:t)}function si(e,t){const n=PR(e),r=PR(t);for(let s=0;s<Math.max(n.length,r.length);s++){const i=(n[s]??0)-(r[s]??0);if(i!==0)return i<0?-1:1}return 0}function ai(e){return typeof e=="string"&&/^\d+\.\d+\.\d+/.test(e)}function Mte(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 $te(e){if(!e||typeof e!="object")return[];const t=[];for(const[n,r]of Object.entries(e)){if(!ai(n)||!Array.isArray(r))continue;const s=r.filter(Mte);s.length&&t.push({version:n,notes:s})}return t.sort((n,r)=>si(r.version,n.version))}const DR=$te(Ate);function oO(e,t,n){return e.filter(r=>si(r.version,n)<=0&&(t===null||si(r.version,t)>0))}function Ite(e,t){return e.filter(n=>si(n.version,t)===0)}function Ote(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 Lte({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 l=n.length===1?"one release":`${n.length} releases`;return`You were last caught up at v${e}. Since then ${l} changed something you would notice. Clicking the version in the topbar brings this back.`}if(r&&ai(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 s=n[0].version;if(!ai(t))return"Everything this build has to say, newest first. Most releases have nothing here, which is why the deck stays quiet about them.";const i=si(s,t);return i<0?`v${t} — the release you are running — changed nothing you would notice, which most releases do not. Below is the last release that did, and everything before it, newest first.`:i>0?"Everything this build has to say, newest first. Most releases have nothing here, which is why the deck stays quiet about them.":`You are running v${t}, and this is what it changed — and everything before it, newest first. Most releases have nothing here, which is why the deck stays quiet about them.`}const Pte=new RegExp("^(?:\\p{Extended_Pictographic}|\\p{Emoji_Modifier}|\\p{Regional_Indicator}|[\\u200D\\uFE0F])+(?= \\S)","u");function Dte(e){const t=Pte.exec(e);return t?{icon:t[0],rest:e.slice(t[0].length)}:{icon:null,rest:e}}function Fte(e){if(!e)return null;let t=null;try{t=e.getItem(ub)}catch{return null}return ai(t)?t:null}function qte(e){if(!e)return!1;try{return e.getItem(ub),!0}catch{return!1}}function Bte(e,t){if(!e)return!1;try{return e.setItem(ub,t),!0}catch{return!1}}const iO="agent-dag.tourSeen";function Ute(e){if(!e)return!1;try{return e.getItem(iO)==="1"}catch{return!1}}function zte(e){if(!e)return!1;try{return e.setItem(iO,"1"),!0}catch{return!1}}function Hte({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 Wte({stored:e,running:t,notes:n,remembers:r=!0}){if(!ai(t))return{show:[],record:null,reason:"no-version"};if(!ai(e)){if(!r)return{show:[],record:t,reason:"cannot-remember"};const l=Ite(n,t);return l.length?{show:l,record:t,reason:"welcome"}:{show:[],record:t,reason:"first-run"}}const s=si(e,t);if(s===0)return{show:[],record:null,reason:"seen"};if(s>0)return{show:[],record:null,reason:"ahead"};const i=oO(n,e,t);return i.length?{show:i,record:t,reason:"new-notes"}:{show:[],record:t,reason:"nothing-new"}}function Vte(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 lO(e,t=!0){const n=[];let r="";const s=()=>{r&&(n.push({kind:"text",text:r}),r="")};let i=0;for(;i<e.length;){if(e[i]==="`"){const l=e.indexOf("`",i+1);if(l>i+1){s(),n.push({kind:"code",text:e.slice(i+1,l)}),i=l+1;continue}}else if(t&&e.startsWith("**",i)){const l=Vte(e,i);if(l>0){s(),n.push({kind:"bold",kids:lO(e.slice(i+2,l),!1)}),i=l+2;continue}}r+=e[i],i+=1}return s(),n}function Gte({entries:e,since:t,running:n,firstRun:r,onClose:s,onTour:i,updateVersion:l,updateBusy:u,onUpdateRestart:d,updateFailure:f,onRestart:h}){const p=mt(s),g=Ote(e);return a.jsx("div",{className:"modal-backdrop",onClick:s,role:"presentation",children:a.jsxs("div",{ref:p,className:"modal release-notes",onClick:w=>w.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"release-notes-title",children:[a.jsxs("header",{className:"modal-head",children:[a.jsxs("div",{className:"modal-title",children:[a.jsx("span",{id:"release-notes-title",className:"modal-tool-name",children:"What's new"}),g&&a.jsx("span",{className:"modal-tool-id",children:g})]}),a.jsx("div",{className:"modal-actions",children:a.jsx("button",{type:"button",className:"glyph-btn",onClick:s,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),a.jsxs("section",{className:"modal-body",children:[(l||f)&&a.jsxs("div",{className:"rn-update",children:[l&&d&&a.jsxs("div",{className:"guide-door",children:[a.jsxs("span",{children:["ccdeck v",l," is downloaded and verified."]}),a.jsx("button",{type:"button",className:"btn",onClick:d,"aria-busy":u||void 0,children:u?"Restarting…":gd})]}),a.jsx("p",{className:"rn-update-said",role:"status",children:f})]}),a.jsx("p",{className:"modal-note",children:Lte({since:t,running:n,firstRun:r,entries:e})}),i&&!l&&a.jsxs("div",{className:"guide-door",children:[a.jsx("span",{children:"Eight pictures of what the deck shows."}),a.jsx("button",{type:"button",className:"btn",onClick:i,children:"Take the tour"})]}),h&&a.jsxs("div",{className:"guide-door",children:[a.jsx("span",{children:"Restart the deck. Sessions, settings and pairings come back as they were."}),a.jsx("button",{type:"button",className:"btn",onClick:h,children:"Restart"})]}),e.map(w=>a.jsxs("section",{className:"modal-section",children:[a.jsxs("h3",{className:"rn-version",children:["v",w.version]}),a.jsx("ul",{className:"rn-notes",children:w.notes.map((k,x)=>{const{icon:b,rest:j}=Dte(k.title);return a.jsxs("li",{className:"rn-note",children:[a.jsxs("p",{className:"rn-note-title",children:[b&&a.jsx("span",{className:"rn-note-icon",children:b}),j]}),a.jsx("p",{className:"rn-note-body",children:cO(lO(k.body))})]},x)})})]},w.version))]})]})})}function cO(e){return e.map((t,n)=>t.kind==="text"?t.text:t.kind==="code"?a.jsx("code",{className:"rn-code",children:t.text},n):a.jsx("strong",{className:"rn-strong",children:cO(t.kids)},n))}function Kte({state:e,sessionId:t,onClose:n}){const r=v.useMemo(()=>Yte(e,t),[e,t]),s=v.useRef(null),i=mt(n,{focusRef:s});return r?a.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:a.jsxs("div",{ref:i,className:"modal session-summary",onClick:l=>l.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"ss-title",children:[a.jsxs("div",{className:"modal-head",children:[a.jsxs("div",{className:"modal-title",children:[a.jsx("span",{className:"state-pill state-done","aria-hidden":!0,children:"done"}),a.jsx("span",{id:"ss-title",className:"modal-tool-name",title:r.cwd??r.sessionId,children:r.label}),a.jsxs("span",{className:"modal-tool-id",children:["· ",r.sessionId.slice(0,8)]})]}),a.jsxs("div",{className:"modal-actions",children:[a.jsx("span",{className:"modal-dur",title:"Total wall time",children:r.durationLabel}),a.jsx("button",{type:"button",ref:s,className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),a.jsxs("div",{className:"modal-body",children:[a.jsxs("section",{className:"ss-hero",children:[a.jsxs("div",{className:"ss-hero-left",children:[a.jsx("div",{className:"ss-cost-label",children:vM}),a.jsx("div",{className:"ss-cost",children:Be(r.cost.total)}),r.modelChips.length>0&&a.jsx("div",{className:"ss-models",children:r.modelChips.map(l=>a.jsx("span",{className:"model-chip","data-family":jd(l),title:l,children:Ws(l)},l))})]}),a.jsx("div",{className:"ss-hero-right",children:r.cost.total>0&&a.jsxs(a.Fragment,{children:[a.jsx(k0,{cost:r.cost,size:"lg"}),a.jsxs("div",{className:"ss-cost-legend",children:[a.jsxs("span",{className:"ssl ssl-in",children:["input ",a.jsx("b",{children:Be(r.cost.input)})]}),a.jsxs("span",{className:"ssl ssl-out",children:["output ",a.jsx("b",{children:Be(r.cost.output)})]}),a.jsxs("span",{className:"ssl ssl-cr",children:["cache r ",a.jsx("b",{children:Be(r.cost.cacheRead)})]}),a.jsxs("span",{className:"ssl ssl-cw",children:["cache w ",a.jsx("b",{children:Be(r.cost.cacheWrite)})]})]})]})})]}),a.jsxs("section",{className:"ss-stats",children:[a.jsx(Oo,{label:"agents",value:r.agentCount}),a.jsx(Oo,{label:"subagents",value:r.subagentCount}),a.jsx(Oo,{label:"tool calls",value:r.toolCount}),a.jsx(Oo,{label:"prompts",value:r.promptCount}),a.jsx(Oo,{label:"tokens",value:r.tokensSum.toLocaleString()}),r.errCount>0&&a.jsx(Oo,{label:"errors",value:r.errCount,tone:"err"})]}),r.topTools.length>0&&a.jsxs("section",{className:"modal-section",children:[a.jsx("h4",{children:"Most-used tools"}),a.jsx("div",{className:"ss-top-tools",children:r.topTools.map(([l,u])=>a.jsxs("div",{className:"ss-tt",children:[a.jsx("span",{className:"ss-tt-name",children:l}),a.jsx("span",{className:"ss-tt-bar",children:a.jsx("span",{className:"ss-tt-bar-fill",style:{width:`${u/r.topTools[0][1]*100}%`}})}),a.jsx("span",{className:"ss-tt-count",children:u})]},l))})]}),r.firstPrompt&&a.jsxs("section",{className:"modal-section",children:[a.jsx("h4",{children:"Opening prompt"}),a.jsx("div",{className:"ss-prompt",children:r.firstPrompt})]})]})]})}):null}function Oo({label:e,value:t,tone:n}){return a.jsxs("div",{className:`ss-stat${n?` tone-${n}`:""}`,children:[a.jsx("div",{className:"ss-stat-value",children:t}),a.jsx("div",{className:"ss-stat-label",children:e})]})}function Yte(e,t){const n=e.agents.get(t);if(!n)return null;const r=[];for(const _ of e.agents.values())_.sessionId===t&&r.push(_);if(r.length===0)return null;const s={input:0,output:0,cacheRead:0,cacheWrite:0,total:0},i=new Set,l=new Map;let u=0,d=0,f=0,h=0,p=0,g,w=1/0,k=0;for(const _ of r){const E=un(_);s.input+=E.input,s.output+=E.output,s.cacheRead+=E.cacheRead,s.cacheWrite+=E.cacheWrite,s.total+=E.total;for(const R of B2(_))i.add(R);_.model&&i.add(_.model),_.kind==="subagent"&&p++;const T=A2(_.prompts);d+=T.length,!g&&T.length>0&&(g=T[0].text),f+=_.usage.inputTokens+_.usage.outputTokens,u+=_.toolCount,h+=_.toolErrorCount??0;for(const[R,A]of _.toolCountByName??[])l.set(R,(l.get(R)??0)+A);w=Math.min(w,_.startedAt),k=Math.max(k,_.endedAt??Date.now())}const x=Math.max(0,k-w),b=Math.floor(x/1e3),j=b<60?`${b}s`:b<3600?`${Math.floor(b/60)}m ${String(b%60).padStart(2,"0")}s`:`${Math.floor(b/3600)}h ${Math.floor(b%3600/60)}m`,S=Array.from(l.entries()).sort((_,E)=>E[1]-_[1]).slice(0,5);return{sessionId:t,label:n.label||n.cwdBasename||"session",cwd:n.cwd,durationLabel:j,cost:s,modelChips:Array.from(i),agentCount:r.length,subagentCount:p,toolCount:u,promptCount:d,tokensSum:f,errCount:h,topTools:S,firstPrompt:g}}const Xte=60,Zte=6e3,Tr=e=>e!=null&&typeof e=="object"&&!Array.isArray(e),yn=e=>typeof e=="string"?e:null;function Fa(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((i,l)=>[String(l),i]):Object.entries(e);if(r.length===0)return n?"[]":"{}";const s=[];for(const[i,l]of r){const u=n?`${t}-`:`${t}${i}:`;if(typeof l=="string"&&l.includes(`
|
|
289
|
-
`)){s.push(u);for(const d of l.split(`
|
|
290
|
-
`))s.push(`${t} ${d}`)}else if(l!==null&&typeof l=="object"){const d=Fa(l,`${t} `);d==="[]"||d==="{}"?s.push(`${u} ${d}`):s.push(u,d)}else s.push(`${u} ${l===void 0?"(none)":String(l)}`)}return s.join(`
|
|
291
|
-
`)}function Jte(e){return e.lines??e.text.split(`
|
|
292
|
-
`).map(t=>({text:t}))}function uO(e,t){if(t)return{shown:e,cut:!1};const n=[];let r=0;for(const s of e){if(n.length===Xte)return{shown:n,cut:!0};const i=Zte-r;if(s.text.length>i)return n.push({...s,text:`${s.text.slice(0,Math.max(i,0))}…`}),{shown:n,cut:!0};n.push(s),r+=s.text.length+1}return{shown:n,cut:!1}}function Qte(e,t){return uO(e,!1).cut?t?{label:"show less",expanded:!0}:{label:"show all",expanded:!1}:null}const Qt=(e,t,n=!1)=>({...e?{label:e}:{},text:t,...n?{err:!0}:{}}),wn=(e,t)=>({label:e,text:t,inline:!0}),dO=(e,t)=>({label:e,text:t.map(n=>n.text).join(`
|
|
293
|
-
`),lines:t});function ene(e,t){return[...e.split(`
|
|
294
|
-
`).map(n=>({text:`- ${n}`,tone:"del"})),...t.split(`
|
|
295
|
-
`).map(n=>({text:`+ ${n}`,tone:"add"}))]}function tne(e){if(!Array.isArray(e)||e.length===0)return null;const t=[];for(const n of e){if(!Tr(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 s=String(r);t.push(s.startsWith("+")?{text:s,tone:"add"}:s.startsWith("-")?{text:s,tone:"del"}:{text:s})}}return t}function FR(e){if(typeof e=="string")return[Qt(void 0,e)];if(!Tr(e))return[Qt(void 0,Fa(e))];const t=[],n=yn(e.type);n==="create"&&t.push(wn("result","created the file"));const r=tne(e.structuredPatch);return r&&t.push(dO("applied",r)),e.userModified===!0&&t.push(wn("note","the user changed it before it was applied")),t.length?t:[wn("result",n==="update"?"updated the file":"done")]}function nne(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 rne(e){if(typeof e=="string")return[Qt(void 0,e)];const t=Tr(e)&&Tr(e.file)?e.file:null,n=yn(t==null?void 0:t.content);if(t&&n!=null){const s=[],i=Number(t.numLines),l=Number(t.totalLines),u=Number(t.startLine);return Number.isFinite(i)&&Number.isFinite(l)&&l>0&&s.push(wn("lines",i>=l?`all ${l}`:Number.isFinite(u)?`${u}–${u+i-1} of ${l}`:`${i} of ${l}`)),s.push(Qt("content",n)),s}const r=Tr(e)?yn(e.type):null;return r&&r!=="text"?[wn("result",`${/^[aeiou]/i.test(r)?"an":"a"} ${r} file`)]:[Qt(void 0,Fa(e))]}function sne(e){if(typeof e=="string")return[Qt("output",e)];if(!Tr(e))return[Qt(void 0,Fa(e))];const t=yn(e.stdout),n=yn(e.stderr);if(t==null&&n==null)return[Qt(void 0,Fa(e))];const r=[];return t&&r.push(Qt("output",t.replace(/\n$/,""))),n&&r.push(Qt("errors",n.replace(/\n$/,""),!0)),e.interrupted===!0&&r.push(wn("note","interrupted before it finished")),r.length?r:[wn("output","none")]}function ane(e,t,n){const r=Tr(t)?t:null;if(r&&(e==="Edit"||e==="MultiEdit")){const s=yn(r.file_path),i=(e==="MultiEdit"?Array.isArray(r.edits)?r.edits:[]:[r]).filter(Tr).filter(l=>yn(l.old_string)!=null&&yn(l.new_string)!=null);if(s&&i.length){const l=[wn("file",s)];return i.forEach((u,d)=>{const f=u.replace_all===!0?", every occurrence":"";l.push(dO(i.length>1?`change ${d+1}${f}`:`change${f}`,ene(u.old_string,u.new_string)))}),{input:l,response:FR(n)}}}if(r&&e==="Write"){const s=yn(r.file_path),i=yn(r.content);if(s&&i!=null)return{input:[wn("file",s),Qt("content",i)],response:FR(n)}}if(r&&e==="Read"){const s=yn(r.file_path);if(s){const i=nne(r);return{input:i?[wn("file",s),wn("lines",i)]:[wn("file",s)],response:rne(n)}}}if(r&&e==="Bash"){const s=yn(r.command);if(s!=null){const i=yn(r.description);return{input:i?[Qt("command",s),wn("why",i)]:[Qt("command",s)],response:sne(n)}}}return{input:[Qt(void 0,Fa(t))],response:[Qt(void 0,Fa(n))]}}function qR(e,t,n){if(n==null)return"";if(typeof n=="string")return n;if(Tr(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(`
|
|
296
|
-
`);if(e==="Read"&&t==="response"&&Tr(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 one({tool:e,onClose:t}){const n=mt(t),r=e.endedAt==null?"inflight":e.ok===!1?"err":"done",s=e.input??e.inputPreview,i=e.response??e.errorPreview,l=ane(e.name,s,i);return a.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:a.jsxs("div",{ref:n,className:"modal",onClick:u=>u.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"tool-modal-title",children:[a.jsxs("header",{className:"modal-head",children:[a.jsxs("div",{className:"modal-title",children:[a.jsx("span",{className:`status-dot ${r}`,"aria-hidden":!0}),a.jsx("span",{id:"tool-modal-title",className:"modal-tool-name",children:e.name}),a.jsxs("span",{className:"modal-tool-id",title:e.id,children:[e.id.slice(0,12),"…"]})]}),a.jsxs("div",{className:"modal-actions",children:[a.jsx("span",{className:"modal-dur",children:H2(e,"in-flight…")}),a.jsx("button",{className:"glyph-btn",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),a.jsxs("section",{className:"modal-body",children:[e.trimmed&&a.jsx("div",{className:"modal-section",children:a.jsx("p",{className:"modal-note",children:"Full payloads for this call were released to keep memory bounded — only the previews below are still held."})}),a.jsxs("div",{className:"modal-section",children:[a.jsxs("div",{className:"tm-head",children:[a.jsx("h4",{children:"Input"}),a.jsx(UR,{text:qR(e.name,"input",s),what:"input"})]}),l.input.map((u,d)=>a.jsx(BR,{block:u},d))]}),a.jsxs("div",{className:"modal-section",children:[a.jsxs("div",{className:"tm-head",children:[a.jsxs("h4",{children:["Response ",r==="err"&&a.jsx("span",{className:"err-tag",children:"error"})]}),e.endedAt!=null&&a.jsx(UR,{text:qR(e.name,"response",i),what:"response"})]}),e.endedAt==null?a.jsx("pre",{children:"(waiting…)"}):l.response.map((u,d)=>a.jsx(BR,{block:u},d))]})]})]})})}const ine={del:"tm-del",add:"tm-add",ctx:"tm-ctx"};function BR({block:e}){const[t,n]=v.useState(!1);if(e.inline)return a.jsxs("p",{className:"tm-inline",children:[e.label&&a.jsx("span",{className:"tm-label",children:e.label}),a.jsx("code",{children:e.text})]});const r=Jte(e),{shown:s}=uO(r,t),i=Qte(r,t);return a.jsxs("div",{className:"tm-block",children:[e.label&&a.jsx("span",{className:"tm-label",children:e.label}),a.jsx("pre",{className:e.err?"tm-err":void 0,children:e.lines?s.map((l,u)=>a.jsxs("span",{className:l.tone?ine[l.tone]:void 0,children:[l.text,u<s.length-1?`
|
|
297
|
-
`:""]},u)):s.map(l=>l.text).join(`
|
|
298
|
-
`)}),i&&a.jsx("button",{type:"button",className:"btn tm-more","aria-expanded":i.expanded,onClick:()=>n(l=>!l),children:i.label})]})}function UR({text:e,what:t}){const[n,r]=v.useState(!1),s=v.useRef(!0);return v.useEffect(()=>()=>{s.current=!1},[]),a.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(i=>{!i||!s.current||(r(!0),window.setTimeout(()=>{s.current&&r(!1)},1600))}),children:n?"copied":"copy"})}const lne=v.lazy(()=>x0(()=>import("./UsageHistoryModal-CIDpgHTW.js"),[])),cne=v.lazy(()=>x0(()=>import("./BrowserWatchModal-BTNOQdp5.js"),[]));function une({dialogs:e,welcome:t,desktopUpdate:n,versionCheck:r,restart:s,lanPairs:i,clearFlow:l,watchBadge:u,announcements:d,appearance:f,providers:h,stateRef:p,agentCount:g}){const{openedTool:w,setOpenedToolKey:k,usageHistoryOpen:x,setUsageHistoryOpen:b,browserWatchOpen:j,setBrowserWatchOpen:S,contextAgent:_,setContextFor:E,summaryFor:T,setSummaryFor:R,keyHelpOpen:A,setKeyHelpOpen:U}=e,{tourOpen:I,openTour:q,closeTour:P,releaseNotes:O,closeReleaseNotes:V,chipVersion:$}=t,{desktopUpdateRestarting:M,desktopUpdateFailure:L,readyAppUpdate:Y,askDesktopUpdateRestart:K}=n,{version:D}=r,{askRestart:z}=s,{clearConfirmOpen:F,setClearConfirmOpen:H,requestClear:J}=l,{setWatchOn:W,markWatchSeen:G}=u,{setWatchSaid:X}=d,{palette:Z}=f;return a.jsxs(a.Fragment,{children:[w&&a.jsx(one,{tool:w,onClose:()=>k(null)}),x&&a.jsx(v.Suspense,{fallback:null,children:a.jsx(lne,{providers:h,onClose:()=>b(!1)})}),j&&a.jsx(v.Suspense,{fallback:null,children:a.jsx(cne,{onClose:()=>S(!1),onSeen:ee=>{X(""),G(ee)},onWatching:W,palette:Z})}),_&&a.jsx(sB,{agent:_,onClose:()=>E(null)}),T&&a.jsx(Kte,{state:p.current,sessionId:T,onClose:()=>R(null)}),O&&a.jsx(Gte,{entries:O.entries,since:O.since,firstRun:O.firstRun,running:$,onClose:V,onTour:()=>{V(),q()},updateVersion:Y==null?void 0:Y.version,updateBusy:M,updateFailure:L&&(!Y||Y.version===L.version)?zee(L.failure,L.version):void 0,onUpdateRestart:Y?()=>{K(Y.version)}:void 0,onRestart:!Y&&(D!=null&&D.canRestart)?()=>{V(),z()}:void 0}),a.jsx(Rte,{...i}),A&&a.jsx(Ete,{onClose:()=>U(!1),onTour:()=>{U(!1),q()}}),I&&a.jsx(c$,{title:"What the deck shows you",steps:$9,onClose:P}),F&&a.jsx(jte,{agentCount:g,onConfirm:()=>J("confirmation"),onCancel:()=>H(!1)})]})}const dne=1e3;function hne(e={}){const t=Math.max(1,Math.floor(e.limit??dne)),n=e.protect;let r=!1,s=[],i=new Set,l=0,u=0,d=null;return{get paused(){return r},get size(){return s.length},get dropped(){return l},get overflowed(){return l>0},get through(){return u},accept(f){const h=typeof(f==null?void 0:f.seq)=="number"?f.seq:null,p=(f==null?void 0:f.epoch)??null,g=p!==null&&p!==d;g&&(d=p,u=0);const w=h!==null&&!g&&h<=u;if(h!==null&&h>u&&(u=h),!r)return!0;if(w)return!1;if(s.push(f),n!=null&&n(f)&&i.add(f),s.length>t){let k=0;if(i.size<s.length)for(;i.has(s[k]);)k++;const[x]=s.splice(k,1);i.delete(x),l++}return!1},setPaused(f){if(r=f,f)return[];const h=s;return s=[],i=new Set,l=0,h}}}function fne(e){const t=v.useState(()=>hne({protect:i=>L6(e.current,i)}))[0],[n,r]=v.useState(!1),s=v.useCallback(()=>{const i=t.paused&&t.dropped>0,l=t.setPaused(!t.paused);i&&hq(e.current);for(const u of l)e.current=D2(e.current,u);r(t.paused)},[t,e]);return{pauseGate:t,paused:n,togglePause:s}}const qx={kind:"assumed",claude:!0,codex:!0};function pne(e){if(!e||typeof e!="object")return qx;const t=e.providers;if(!t||typeof t!="object")return qx;const n=t;return{kind:"reported",claude:n.claude!==!1,codex:n.codex!==!1}}function mne(e){const[t,n]=v.useState(null),[r,s]=v.useState(qx);v.useEffect(()=>{let l=!1;return fetch("/api/health").then(u=>u.ok?u.json():null).then(u=>{l||(s(pne(u)),!(!u||typeof u.workspace!="string")&&n(u.workspace))}).catch(()=>{}),()=>{l=!0}},[e]);const i=xn(r);return{workspace:t,providers:r,providersRef:i}}const hO=3*6e4,gne=2e4;function yne({fetchReport:e,visible:t,now:n,onReport:r}){let s=0,i=!0;const l=async()=>{if(!t())return;const u=await e();!i||!u||(s=n(),r(u))};return{tick:l,wake:async()=>{t()&&n()-s>=hO&&await l()},stop:()=>{i=!1}}}async function wne(){try{const e=await fetch("/api/provider-status",{signal:AbortSignal.timeout(gne)});return e.ok?await e.json():null}catch{return null}}function vne(e){const[t,n]=v.useState(null);return v.useEffect(()=>{if(!e){n(null);return}const r=yne({fetchReport:wne,visible:()=>document.visibilityState==="visible",now:()=>Date.now(),onReport:n});r.tick();const s=window.setInterval(r.tick,hO),i=()=>{r.wake()};return document.addEventListener("visibilitychange",i),()=>{r.stop(),window.clearInterval(s),document.removeEventListener("visibilitychange",i)}},[e]),t}const xne={degraded:"degraded performance",partial_outage:"partial outage",major_outage:"major outage",maintenance:"maintenance"},bne={degraded:"degraded",partial_outage:"partial outage",major_outage:"major outage",maintenance:"maintenance"},kne={degraded:"degraded",partial_outage:"outage",major_outage:"outage",maintenance:"maint."},Nne={claude:"Claude",codex:"Codex"},jne=new Set(["status.claude.com","status.openai.com"]),Sne=30*6e4,_ne=10*6e4;function Ene(e){if(typeof e!="string")return null;try{const t=new URL(e);return t.protocol==="https:"&&jne.has(t.hostname)?t:null}catch{return null}}function zR(e){return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hourCycle:"h23"})}function Cne(e){const t=Math.floor(e/6e4);return t<1?"just now":t<60?`${t} min ago`:`${Math.floor(t/60)} h ago`}function Tne(e,t){if(!e||typeof e!="object")return null;const n=It(xne,e.state),r=It(Nne,e.provider);if(!n||!r||typeof e.checkedAt!="number"||t-e.checkedAt>Sne)return null;const s=Ene(e.statusPageUrl);if(!s)return null;const i=Array.isArray(e.components)?e.components:[],l=e.stale===!0||t-e.checkedAt>_ne,u=[`${r}: ${n}${e.summary?` — ${e.summary}`:""}`,i.length>0?`Affected: ${i.join(", ")}`:null,e.scope==="page"?`The page's overall status: it names none of ${r}'s components`:null,l?`Last read from ${s.hostname} at ${zR(e.checkedAt)}; this is the last thing it said`:`Reported by ${s.hostname}, checked ${Cne(t-e.checkedAt)}`,"Opens the status page"],d=l?zR(e.checkedAt):null;return{provider:e.provider,state:e.state,name:r,label:`${r} · ${n}${d?` · as of ${d}`:""}`,words:n,chipWords:It(bne,e.state)??n,shortWords:It(kne,e.state)??n,asOf:d,what:e.summary||(i.length>0?i.join(", "):null),href:s.href,host:s.hostname,stale:l,detail:u.filter(Boolean).join(`
|
|
299
|
-
`)}}function Rne(e,t){return!(e!=null&&e.ok)||e.disabled||!Array.isArray(e.providers)?[]:e.providers.map(n=>Tne(n,t)).filter(n=>n!==null)}function Ane(e){return e.map(t=>`${t.name}'s status page reports ${t.state.endsWith("outage")?`a ${t.words}`:t.words}.`).join(" ")}const Mne="The providers' status pages report no incident.";function $ne({version:e,loadVersion:t}){var f;const[n,r]=v.useState(!1),s=((f=e==null?void 0:e.upgrade)==null?void 0:f.state)??"idle",i=hte(e==null?void 0:e.upgrade),l=v.useRef(!1),u=v.useCallback(async()=>{if(Sr(l.current||s==="running")){l.current=!0;try{await fetch("/api/upgrade",{method:"POST"})}catch{}await t(),l.current=!1}},[s,t]);v.useEffect(()=>{if(s!=="running")return;const h=window.setInterval(t,3e3);return()=>window.clearInterval(h)},[s,t]);const d=v.useCallback(async()=>{const h=e==null?void 0:e.command;!h||!await Ba(h)||(r(!0),window.setTimeout(()=>r(!1),1600))},[e==null?void 0:e.command]);return{upgradeState:s,upgradeFailure:i,startUpgrade:u,copyCommand:d,cmdCopied:n}}const HR="agent-dag.browserWatch.seenMs";function Ine(e,t){return e.filter(n=>n.startMs>t)}function One(){const[e,t]=v.useState(()=>Number(Qe(HR))||0),[n,r]=v.useState([]),[s,i]=v.useState(!1);v.useEffect(()=>{let d=!0;const f=()=>{fetch("/api/browser-watch?live=0").then(p=>p.ok?p.json():null).then(p=>{var g;!d||!(p!=null&&p.ok)||(r(p.episodes??[]),i(((g=p.settings)==null?void 0:g.enabled)===!0))}).catch(()=>{})};f();const h=setInterval(f,5*6e4);return()=>{d=!1,clearInterval(h)}},[]);const l=v.useMemo(()=>Ine(n,e).length,[n,e]),u=v.useCallback(d=>{t(d),Xe(HR,String(d))},[]);return{watchOn:s,setWatchOn:i,watchUnseen:l,markWatchSeen:u}}const fO=["--err","--inflight","--ok","--grid-line","--minimap-mask","--panel","--line","--accent","--text-dim","--bg"];function WR(e){const t={};for(const n of fO)t[n]=e(n);return t}function Lne(e){return t=>e[t]??""}function Pne(e,t){return fO.every(n=>e[n]===t[n])}const pO="agent-dag.theme";function Dne(e,t=!1){return e==="light"||e==="dark"?e:t?"light":"dark"}function Fne(){try{return window.matchMedia("(prefers-color-scheme: light)").matches}catch{return!1}}function qne(){return Dne(Qe(pO),Fne())}function VR(e){return typeof window>"u"?"":getComputedStyle(document.documentElement).getPropertyValue(e).trim()||""}function Bne(){const[e,t]=v.useState(qne),[n,r]=v.useState(iee),[s,i]=v.useState(()=>WR(VR)),l=v.useMemo(()=>Lne(s),[s]),u=v.useCallback(d=>hQ(d,l),[l]);return v.useEffect(()=>{document.documentElement.dataset.theme=e,Xe(pO,e),i(d=>{const f=WR(VR);return Pne(d,f)?d:f})},[e]),v.useEffect(()=>{Xe(tO,n?"1":"0")},[n]),v.useEffect(()=>{const d=document.querySelector('meta[name="theme-color"]'),f=s["--panel"];d&&f&&d.setAttribute("content",f)},[s]),{theme:e,setTheme:t,characterEnabled:n,setCharacterEnabled:r,palette:s,minimapNodeFill:u}}function Une(e){const t=v.useRef(null),[n,r]=v.useState(!1),[s,i]=v.useState(()=>new Set),l=v.useMemo(()=>{const d=new Set;for(const f of e.current.agents.values())for(const h of f.tools)d.add(QI(h.name));return Object.keys(JI).filter(f=>d.has(f))},[e.current,e.current.revision]);v.useEffect(()=>{if(l.length<=1){r(!1);return}let d=0;const f=()=>{const h=t.current;if(h&&!document.hidden){const p=h.getBoundingClientRect(),g=Array.from(document.querySelectorAll(".react-flow__node, .tool-burst")).map(k=>k.getBoundingClientRect()),w=nQ(p,g,8);r(k=>k===w?k:w)}d=window.setTimeout(f,300)};return f(),()=>window.clearTimeout(d)},[l.length]);const u=v.useCallback(d=>{i(f=>{const h=new Set(f);return h.has(d)?h.delete(d):h.add(d),h})},[]);return{presentCats:l,hiddenCats:s,toggleCat:u,catBarRef:t,catBarOccluded:n}}function zne(e={enabled:()=>!0}){const t=e.ctor??(typeof window<"u"?window.AudioContext??window.webkitAudioContext??null:null);let n=null;const r=()=>e.enabled()?(n==null?void 0:n.state)==="running"?"ready":"locked":"off",s=()=>{var h;return(h=e.onState)==null?void 0:h.call(e,r())};function i(){var h,p;if(!(!t||(n==null?void 0:n.state)==="running"))try{n||(n=new t,(h=n.addEventListener)==null||h.call(n,"statechange",s)),(p=n.resume)==null||p.call(n).then(s,()=>{}),s()}catch{}}function l(h,p,g=p.figure){if(!n||n.state!=="running")return!1;const w=Tx(h,g),k=fK(p.level,w),x=n.currentTime;for(const b of w.notes){const j=n.createOscillator(),S=n.createGain();j.type=w.type??"sine",j.frequency.value=b.hz;const _=x+b.at,E=_+b.ms/1e3;S.gain.setValueAtTime(Qj,_),S.gain.exponentialRampToValueAtTime(k,_+pK),S.gain.exponentialRampToValueAtTime(Qj,E),j.connect(S).connect(n.destination),j.start(_),j.stop(E+.02)}return!0}async function u(h,p){if(!e.loadCustom)return"unavailable";let g;try{g=await e.loadCustom(h)}catch{return"unavailable"}if(!g)return"missing";if(g.kind==="tts"){if(typeof window>"u"||!("speechSynthesis"in window)||typeof SpeechSynthesisUtterance>"u")return"unavailable";const k=new SpeechSynthesisUtterance(g.text),x=window.speechSynthesis.getVoices();k.voice=x.find(b=>b.voiceURI===g.voiceURI)??null,k.rate=g.rate,k.pitch=g.pitch,k.volume=mK(p.level);try{return window.speechSynthesis.cancel(),window.speechSynthesis.speak(k),"played"}catch{return"unavailable"}}if(!n||n.state!=="running")return"locked";let w;try{w=await n.decodeAudioData(g.bytes.slice(0))}catch{return"broken"}try{const k=n.createBufferSource(),x=n.createGain();return k.buffer=w,x.gain.setValueAtTime(gK(g.normalizationGain,p.level),n.currentTime),k.connect(x).connect(n.destination),k.start(n.currentTime),"played"}catch{return"unavailable"}}function d(h,p=!1){var k,x;if(!p&&!e.enabled())return!1;const g=NK((k=e.prefs)==null?void 0:k.call(e),h),w=((x=e.customSelection)==null?void 0:x.call(e)[h])??null;return w&&e.loadCustom?(u(w,g).then(b=>{var j;b==="played"||b==="locked"||((b==="missing"||b==="broken")&&((j=e.onCustomFailure)==null||j.call(e,h,w)),l(h,{...g,figure:vn},vn))}),!0):!n||n.state!=="running"?!1:l(h,g)}function f(h,p=Da){return u(h,{level:ri(p),figure:vn}),!0}return{unlock:i,play:d,previewCustom:f,state:r,get context(){return n}}}function Hne({chimesRef:e,soundOnRef:t,tonePrefsRef:n,customSelectionsRef:r,fallbackCustomRef:s}){const[i,l]=v.useState("locked");return v.useEffect(()=>{const u=zne({enabled:()=>t.current===!0,prefs:()=>n.current,customSelection:()=>r.current,loadCustom:lK,onCustomFailure:(p,g)=>s.current(p,g),onState:l});e.current=u,l(u.state());const d=["pointerdown","pointerup","keydown"],f=()=>{for(const p of d)window.removeEventListener(p,h,{capture:!0})},h=()=>{var p;u.unlock(),((p=u.context)==null?void 0:p.state)==="running"&&f()};for(const p of d)window.addEventListener(p,h,{capture:!0});return f},[]),{chimeState:i}}function Wne(){const[e,t]=v.useState(cee),[n,r]=v.useState(()=>l6(Qe(jN))),[s,i]=v.useState(()=>i6(Qe(SN))),[l,u]=v.useState(()=>c6(Qe(ER),n,aee)),[d,f]=v.useState(()=>new Set),[h,p]=v.useState(0);v.useEffect(()=>{Xe(nO,String(e))},[e]),v.useEffect(()=>{Xe(SN,s?"1":"0")},[s]),v.useEffect(()=>{Xe(jN,JSON.stringify(n))},[n]),v.useEffect(()=>{Xe(ER,l)},[l]);const g=v.useCallback(j=>{r(S=>S.some(_=>_.id===j.id)?S:[...S,j]),f(S=>{if(!S.has(j.id))return S;const _=new Set(S);return _.delete(j.id),_})},[]),w=v.useCallback((j,S)=>{const _=S.trim();!_||_.length>jl||r(E=>E.map(T=>T.id===j?{...T,name:_}:T))},[]),k=v.useCallback(j=>{r(S=>S.filter(_=>_.id!==j)),u(S=>u6(S,j)),f(S=>{if(!S.has(j))return S;const _=new Set(S);return _.delete(j),_})},[]),x=v.useCallback(j=>{const S=_N(j),_=d.has(S);j===l&&!_||(_&&f(E=>{const T=new Set(E);return T.delete(S),T}),u(j),p(E=>E+1))},[l,d]),b=v.useCallback((j,S)=>{const _=_N(j);f(E=>{if(E.has(_)===S)return E;const R=new Set(E);return S?R.add(_):R.delete(_),R})},[]);return{fmVolume:e,setFmVolume:t,fmMuted:s,setFmMuted:i,fmSource:l,customFmStations:n,unavailableFmStations:d,fmPlayRequest:h,addFmStation:g,renameFmStation:w,removeFmStation:k,pickFmSource:x,markFmStationAvailability:b}}function Vne(e){const[t,n]=v.useState(null),[r,s]=v.useState(!1),[i,l]=v.useState(null),u=v.useRef(0);v.useEffect(()=>{if(!e||!Ll())return;let k=!1;const x=u.current;return fetch("/api/desktop-update").then(b=>b.ok?b.json():null).then(b=>{if(k||u.current!==x)return;const j=IR(b);j&&n(j)}).catch(()=>{}),()=>{k=!0}},[e]);const d=Dee(t),f=v.useRef(!1),h=v.useRef(0),p=v.useRef(0);v.useEffect(()=>()=>window.clearTimeout(h.current),[]);const g=v.useCallback(async k=>{if(!Sr(f.current))return;const x=++p.current;window.clearTimeout(h.current),f.current=!0,s(!0),l(null);const b=j=>{x===p.current&&(window.clearTimeout(h.current),f.current=!1,s(!1),l({failure:j,version:k}))};try{const j=await fetch("/api/desktop-update/restart",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({version:k})});if(!j.ok)return b(Uee(await j.json().catch(()=>null)))}catch{return b("unreachable")}x===p.current&&(h.current=window.setTimeout(()=>b("timeout"),rO))},[]),w=v.useCallback(k=>{if(Ll())try{const x=IR(JSON.parse(k));x&&(u.current++,n(x),x.status!=="ready"&&(p.current++,window.clearTimeout(h.current),f.current=!1,s(!1)))}catch{}},[]);return{desktopUpdateRestarting:r,desktopUpdateFailure:i,readyAppUpdate:d,askDesktopUpdateRestart:g,onDesktopUpdateEvent:w}}const _u="agent-dag.autoRestart",GR="agent-dag.bundleReloadedFor";function Gne({now:e,stateRef:t,version:n,notice:r,noticeOpen:s,upgradeFailure:i,paused:l}){const[u,d]=v.useState(()=>Qe(_u)!=="0"),f=v.useRef(!1),h=v.useCallback(()=>{const q=!u;f.current=!0,Zr(_u),d(q),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({autoUpdate:q})}).then(P=>P.ok?P.json():null).then(P=>{var O;P!=null&&P.ok&&d(((O=P.prefs)==null?void 0:O.autoUpdate)!==!1)}).catch(()=>{})},[u]),[p,g]=v.useState(!1),[w,k]=v.useState("restart"),[x,b]=v.useState(null),j=v.useRef(!1),S=v.useRef(null),_=v.useRef(0),E=v.useRef(null),T=v.useCallback(async q=>{if(!Sr(j.current))return;const P=(q==null?void 0:q.upgrade)===!0,O=(q==null?void 0:q.whenIdle)===!0;j.current=!0,S.current=i;const V=++_.current,$=()=>{k(P?"npx":"restart"),g(!0)};O||$();try{window.sessionStorage.setItem("agent-dag.restartPending",(r==null?void 0:r.to)??"")}catch{}let M=!1;try{const L=await fetch("/api/restart",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(O?{upgrade:P,whenIdle:O}:{upgrade:P})});M=O&&L.status===409}catch{}if(M){j.current=!1,E.current=null;try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}return}O&&$(),window.setTimeout(()=>{if(_.current===V&&j.current){j.current=!1,g(!1);try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}}},P?18e4:3e4)},[r==null?void 0:r.to,i]);v.useEffect(()=>{const q=OR(t.current.agents.values())>0,P=yte({enabled:u,kind:r==null?void 0:r.kind,canRestart:(n==null?void 0:n.canRestart)===!0,noticeOpen:s,visible:document.visibilityState==="visible",busy:q,idleSince:E.current,now:e});E.current=P.idleSince,P.restart&&T({whenIdle:!0})},[u,r==null?void 0:r.kind,n==null?void 0:n.canRestart,s,e,T]);const R=OR(t.current.agents.values()),A=gte(R,l),U=aO({enabled:u,kind:r==null?void 0:r.kind,canRestart:(n==null?void 0:n.canRestart)===!0,noticeOpen:s,visible:document.visibilityState==="visible",busy:R>0,idleSince:E.current,now:e});v.useEffect(()=>{const q=n==null?void 0:n.running;let P=null,O=null;try{P=window.sessionStorage.getItem("agent-dag.restartPending"),O=window.sessionStorage.getItem(GR)}catch{return}const V=dte({bundle:"3.33.1",running:q,pending:P,lastTried:O});if(V==="reload"){try{window.sessionStorage.setItem(GR,q??"")}catch{return}window.location.reload();return}if(V!=="confirm")return;try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}j.current=!1,g(!1),b(q??null);const $=window.setTimeout(()=>b(null),6e3);return()=>window.clearTimeout($)},[n==null?void 0:n.running]),v.useEffect(()=>{if(p&&fte({asked:S.current,reported:i})){try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}j.current=!1,g(!1)}},[p,i]);const I=v.useCallback(q=>{var P,O;if(!f.current){const V=Qe(_u)==="0";Zr(_u),V&&((P=q.prefs)==null?void 0:P.autoUpdate)!==!1?(d(!1),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({autoUpdate:!1})}).catch(()=>{})):d(((O=q.prefs)==null?void 0:O.autoUpdate)!==!1)}},[]);return{autoRestart:u,toggleAutoRestart:h,restarting:p,restartMode:w,restartedTo:x,askRestart:T,restartCopy:A,restartFuseMs:U,loadAutoRestartPrefs:I}}function Kne(){const[e,t]=v.useState([]),n=v.useRef(new Set),[r,s]=v.useState(null);v.useEffect(()=>{let u=!0,d=0;const f=()=>{fetch("/api/lan").then(h=>h.ok?h.json():null).then(h=>u?(h!=null&&h.ok&&t(Oj(Array.isArray(h.pending)?h.pending:[],h.aliases)),h):null).catch(()=>null).then(h=>{u&&(d=window.setTimeout(f,(h==null?void 0:h.enabled)===!0?Nx:l$))})};return f(),()=>{u=!1,window.clearTimeout(d)}},[]);const i=v.useCallback(async(u,d)=>{if(!r){s(u);try{const h=await(await fetch("/api/lan/peer",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:u,fp:d})})).json().catch(()=>null);h&&Array.isArray(h.pending)?t(Oj(h.pending,h.aliases)):t(p=>p.filter(g=>g.fp!==d))}catch{}finally{s(null)}}},[r]),l=v.useCallback(u=>{r||(n.current.add(u),t(d=>[...d]))},[r]);return{lanPending:e,lanDeferred:n,lanBusy:r,answerLanPair:i,deferLanPair:l}}const mO="agent-dag.sessionListOpen",gO="agent-dag.accountsPanelOpen";function Yne(){return Qe(mO)==="1"}function Xne(e){Xe(mO,e?"1":"0")}function Zne(){const e=Qe(gO);return e===null?!0:e==="1"}function Jne(){const[e,t]=v.useState(Yne);v.useEffect(()=>{Xne(e)},[e]);const n=v.useRef(!1),[r,s]=v.useState(()=>{const f=Zne();return f&&e?(n.current=!0,!1):f});v.useEffect(()=>{!r&&n.current||Xe(gO,r?"1":"0")},[r]),v.useEffect(()=>{!e&&n.current&&(n.current=!1,s(!0))},[e]);const i=v.useCallback(()=>{t(f=>(f||s(h=>(h&&(n.current=!0),!1)),!f))},[]),l=v.useCallback(()=>{n.current=!1,s(f=>(f||t(!1),!f))},[]),u=v.useCallback(()=>t(!1),[]),d=v.useCallback(()=>s(!1),[]);return{sessionListOpen:e,accountsPanelOpen:r,toggleSessionList:i,toggleAccountsPanel:l,closeSessionList:u,closeAccountsPanel:d}}const yO="agent-dag.detailOpen",wO="agent-dag.usagePanelOpen",vO="agent-dag.systemPanelOpen";function Qne(){return Qe(yO)==="1"}function ere(e){Xe(yO,e?"1":"0")}function tre(){const e=Qe(wO);return e===null?!0:e==="1"}function nre(e){Xe(wO,e?"1":"0")}function rre(){const e=Qe(vO);return e===null?!0:e==="1"}function sre(e){Xe(vO,e?"1":"0")}function are(){const[e,t]=v.useState(Qne);v.useEffect(()=>{ere(e)},[e]);const[n,r]=v.useState(tre);v.useEffect(()=>{nre(n)},[n]);const[s,i]=v.useState(rre);return v.useEffect(()=>{sre(s)},[s]),{detailOpen:e,setDetailOpen:t,usagePanelOpen:n,setUsagePanelOpen:r,machinePanelOpen:s,setMachinePanelOpen:i}}const ore={permission:"your permission",asked:"your answer"},ire="No sessions are waiting for you.";function lre(e){if(e.length===0)return"";const[t,...n]=e,r=t.waiting.kind,s=n.every(l=>l.waiting.kind===r)?ore[r]??"you":"you";if(n.length===0)return`${t.label} is waiting for ${s}.`;const i=`${n.length} more session${n.length===1?"":"s"}`;return`${t.label} and ${i} are waiting for ${s}.`}function Iv(e,t,n=ire){return t!==""?t:e===""?"":n}function cre({waitingSessions:e,watchUnseen:t,incidents:n=[]}){const[r,s]=v.useState(""),i=lre(e);v.useEffect(()=>{s(g=>Iv(g,i))},[i]);const[l,u]=v.useState(""),d=t>0?`Browser watch has ${t} unread ${t===1?"finding":"findings"}.`:"";v.useEffect(()=>{u(g=>Iv(g,d,"Browser watch has no unread findings."))},[d]);const[f,h]=v.useState(""),p=Ane(n);return v.useEffect(()=>{h(g=>Iv(g,p,Mne))},[p]),{blockedSaid:r,watchSaid:l,setWatchSaid:u,incidentSaid:f}}function ure({waitingSessions:e,liveSince:t,focusSession:n}){const[r,s]=v.useState(()=>typeof Notification>"u"?"denied":Notification.permission),[i,l]=v.useState(null),[u,d]=v.useState(!1),[f,h]=v.useState(!1),p=v.useRef(()=>{}),g=v.useRef(new Set),w=xn(e),k=v.useCallback(()=>{const T=!u;d(T),T&&(g.current=fu(w.current)),T&&typeof Notification<"u"&&Notification.permission==="default"&&p.current(),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({notifications:T})}).then(R=>R.ok?R.json():null).then(R=>{var A;R!=null&&R.ok&&(d(((A=R.prefs)==null?void 0:A.notifications)===!0),h(R.notificationsVetoed===!0))}).catch(()=>{})},[u]),x=typeof Notification<"u";v.useEffect(()=>{if(!i)return;const R=setTimeout(()=>l(null),i==="blocked"?8e3:4e3);return()=>clearTimeout(R)},[i]);const b=v.useCallback(()=>{typeof Notification>"u"||Notification.requestPermission().then(T=>{const R=T;s(R),R==="granted"?l("on"):R==="denied"&&l("blocked")})},[]);p.current=b;const j=v.useRef(null),S=e.map(T=>Sd(T.id,T.waiting)).join("|");v.useEffect(()=>{Tq(j.current,r)&&(j.current=r,g.current=fu(e))},[r]);const _=v.useRef(!1);v.useEffect(()=>{Rq(_.current,t)&&(_.current=!0,g.current=fu(e))},[t]),v.useEffect(()=>{if(typeof Notification>"u"||Notification.permission!=="granted"||!Aq(j.current,t))return;const T=typeof document>"u"||!document.hidden,R=Eq(e,g.current,T,u);for(const A of R)try{const U=new Notification(A.title,{body:A.body,tag:A.key});U.onclick=()=>{window.focus(),n(A.sessionId),U.close()}}catch{}g.current=T?fu(e):Cq(e,R,g.current)},[S,t]);const E=v.useCallback(T=>{var R;d(((R=T.prefs)==null?void 0:R.notifications)===!0),h(T.notificationsVetoed===!0)},[]);return{notifyPermission:r,notifySaid:i,notifyOn:u,notifyVetoed:f,toggleNotify:k,notifySupported:x,askForNotifications:b,loadNotifyPrefs:E}}function dre({openedTool:e,usageHistoryOpen:t,contextFor:n,tourOpen:r,summaryFor:s,browserWatchOpen:i,keyHelpOpen:l,releaseNotes:u}){const d=xn(l),f=v.useRef(!1);return f.current=e!=null||t||n!=null||r||s!=null||i||l||u!=null,{keyHelpOpenRef:d,modalOpenRef:f}}function hre({stateRef:e,tourOpen:t,releaseNotes:n}){const[r,s]=v.useState(null),i=v.useCallback((T,R)=>s({agentId:T,toolId:R}),[]),[l,u]=v.useState(null),[d,f]=v.useState(null),h=v.useCallback(T=>f(T),[]),[p,g]=v.useState(!1),[w,k]=v.useState(!1),[x,b]=v.useState(!1),j=r?A6(e.current.agents,r.agentId,r.toolId):null,S=d?e.current.agents.get(d):void 0,{keyHelpOpenRef:_,modalOpenRef:E}=dre({openedTool:j,usageHistoryOpen:w,contextFor:d,tourOpen:t,summaryFor:l,browserWatchOpen:x,keyHelpOpen:p,releaseNotes:n});return{setOpenedToolKey:s,openTool:i,openedTool:j,summaryFor:l,setSummaryFor:u,contextFor:d,setContextFor:f,openContext:h,contextAgent:S,keyHelpOpen:p,setKeyHelpOpen:g,usageHistoryOpen:w,setUsageHistoryOpen:k,browserWatchOpen:x,setBrowserWatchOpen:b,keyHelpOpenRef:_,modalOpenRef:E}}function fre({stateRef:e,pinnedRef:t,measuredRef:n,positionsRef:r,lastLayoutSigRef:s,forgetRemovals:i,clearSelection:l,rerender:u,modalOpenRef:d}){const[f,h]=v.useState(!1),p=v.useCallback(async()=>{try{await fetch("/api/clear",{method:"POST"})}catch{}e.current=l0(),t.current.clear(),n.current.clear(),r.current.clear(),s.current="",YI(),i(),l(),u()},[u,l,i]),g=xn(f),w=v.useCallback(k=>{const x=xte(k,{confirmOpen:g.current,modalOpen:d.current});x==="confirm"?h(!0):x==="clear"&&(h(!1),p())},[p]);return{clearConfirmOpen:f,setClearConfirmOpen:h,requestClear:w}}const KR="agent-dag.oldNameNoticeDismissed";function pre(e){const[t,n]=v.useState(()=>Qe(KR)??""),r=e!=null&&e.invokedAs&&e.invokedAs!==vt?e.invokedAs:null,s=r!=null&&t!==r,i=v.useCallback(()=>{r&&(n(r),Xe(KR,r))},[r]);return{oldName:r,oldNameOpen:s,dismissOldName:i}}function mre({chimesRef:e,setTonePrefs:t,tonePrefsRef:n,previewTone:r}){const[s,i]=v.useState(()=>XG(Qe)),l=xn(s),[u,d]=v.useState([]),f=v.useCallback(S=>{i(_=>{const E={..._,[S]:null};return l.current=E,E}),Zr(ml[S])},[]),h=v.useCallback((S,_)=>{const E=l.current[S];_&&E!==_||(f(S),t(T=>{const R={...T,[S]:{...T[S],figure:vn}};return n.current=R,R}),Xe(cd[S],vn))},[f]),p=xn(h);v.useEffect(()=>{let S=!0;return iK().then(_=>{if(!S)return;d(_);const E=new Set(_.map(T=>T.id));for(const T of Lu){const R=l.current[T];R&&!E.has(R)&&p.current(T,R)}},()=>{}),()=>{S=!1}},[]);const g=v.useCallback((S,_)=>{if(!u.some(T=>T.id===_))return;const E={...l.current,[S]:_};l.current=E,i(E),Xe(ml[S],_),r(S,!0)},[u,r]),w=v.useCallback(async S=>{var R;const _=Cx(u.length);if(_)throw new Error(_);const E=window.AudioContext??window.webkitAudioContext;if(!E)throw new Error("This browser cannot decode audio files.");const T=new E;try{const A=await nK(S,I=>T.decodeAudioData(I));await Zj(A);const U=$l(A);d(I=>[...I.filter(q=>q.id!==U.id),U])}finally{(R=T.close)==null||R.call(T)}},[u.length]),k=v.useCallback(async S=>{const _=Cx(u.length);if(_)throw new Error(_);const E=rK(S);await Zj(E);const T=$l(E);d(R=>[...R.filter(A=>A.id!==T.id),T])},[u.length]),x=v.useCallback(async(S,_)=>{const E=u.find(R=>R.id===S),T=_.trim().slice(0,80);!E||!T||T===E.name||(await cK(S,T),d(R=>R.map(A=>A.id===S?{...A,name:T}:A)))},[u]),b=v.useCallback(async S=>{await uK(S),d(R=>R.filter(A=>A.id!==S));const _=l.current,E=ZG(_,S);l.current=E,i(E);const T=Lu.filter(R=>_[R]===S);for(const R of T)Zr(ml[R]),Xe(cd[R],vn);T.length>0&&t(R=>{const A={...R};for(const U of T)A[U]={...A[U],figure:vn};return n.current=A,A})},[]),j=v.useCallback(S=>{var T,R;const _=Lu.find(A=>l.current[A]===S),E=_?n.current[_].level:Da;(T=e.current)==null||T.unlock(),(R=e.current)==null||R.previewCustom(S,E)},[]);return{customSelections:s,customSelectionsRef:l,customAssets:u,clearCustomOnly:f,fallbackCustomRef:p,selectCustomTone:g,importNotificationAudio:w,createNotificationVoice:k,renameCustomAsset:x,deleteCustomAsset:b,previewCustomAsset:j}}function gre(e){const[t,n]=v.useState(()=>kK(Qe)),r=xn(t),s=v.useRef(null),i=v.useCallback((u,d=!1)=>{var f,h;if((f=e.current)==null||f.unlock(),s.current!==null&&clearTimeout(s.current),s.current=null,!d){(h=e.current)==null||h.play(u,!0);return}s.current=setTimeout(()=>{var p;s.current=null,(p=e.current)==null||p.play(u,!0)},yK)},[]),l=v.useCallback((u,d)=>{n(f=>{const h={level:ri(d.level??f[u].level),figure:$$(u,d.figure??f[u].figure)};return Xe(L$[u],String(h.level)),Xe(cd[u],h.figure),{...f,[u]:h}}),i(u,!0)},[i]);return v.useEffect(()=>()=>{s.current!==null&&clearTimeout(s.current)},[]),{tonePrefs:t,setTonePrefs:n,tonePrefsRef:r,previewTone:i,changeTone:l}}const yre=15e3;function wre(e){return e.visibilityState==="visible"&&e.hasFocus()}function vre(e,t){return t||e===!0}function xre(){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)}`}function bre(){v.useEffect(()=>{const e=xre();let t=null;const n=l=>{fetch("/api/presence",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({tab:e,looking:l}),keepalive:!0}).catch(()=>{})},r=()=>{const l=wre(document);vre(t,l)&&n(l),t=l},s=()=>{t&&n(!1),t=!1};r();const i=window.setInterval(r,yre);return window.addEventListener("focus",r),window.addEventListener("blur",r),document.addEventListener("visibilitychange",r),window.addEventListener("pagehide",s),()=>{window.clearInterval(i),window.removeEventListener("focus",r),window.removeEventListener("blur",r),document.removeEventListener("visibilitychange",r),window.removeEventListener("pagehide",s),s()}},[])}function kre({loadAutoRestartPrefs:e,loadNotifyPrefs:t}){v.useEffect(()=>{let n=!0;return fetch("/api/prefs").then(r=>r.ok?r.json():null).then(r=>{!n||!(r!=null&&r.ok)||(e(r),t(r))}).catch(()=>{}),()=>{n=!1}},[])}const Ov="agent-dag.versionNoticeDismissed",Nre=15*6e4;function jre(e){const[t,n]=v.useState(null),[r,s]=v.useState(()=>Qe(Ov)??""),i=v.useRef(0),[l,u]=v.useState(!1),d=v.useCallback((x=!1)=>(x&&(i.current=Date.now(),u(!0)),fetch(x?"/api/version?refresh=1":"/api/version").then(b=>b.ok?b.json():null).then(b=>{b&&n(b)}).catch(()=>{}).finally(()=>{x&&u(!1)})),[]),f=v.useCallback(()=>{d(Date.now()-i.current>=Nre)},[d]);v.useEffect(()=>{d();const x=window.setInterval(f,5*6e4),b=()=>{document.visibilityState==="visible"&&f()};return document.addEventListener("visibilitychange",b),()=>{window.clearInterval(x),document.removeEventListener("visibilitychange",b)}},[d,f]),v.useEffect(()=>{e&&d()},[e,d]);const h=(t==null?void 0:t.notice)??null,p=sO(h),g=Kee(h,r),w=v.useCallback(()=>{s(""),Xe(Ov,"")},[]),k=v.useCallback(()=>{h&&(s(p),Xe(Ov,p))},[h,p]);return{version:t,notice:h,noticeOpen:g,showNotice:w,dismissNotice:k,versionChecking:l,loadVersion:d}}function Sre({version:e,readyAppUpdate:t}){const[n,r]=v.useState(!1),s=v.useRef(null),[i,l]=v.useState(null),u=i&&t?t.version:null,d=v.useRef(null);v.useEffect(()=>{!u||d.current===u||(d.current=u,fetch("/api/desktop-update/seen",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({version:u})}).catch(()=>{}))},[u]);const f=v.useRef(!1);v.useEffect(()=>{if(f.current)return;const b=fl(),j=Fte(b),S=Wte({stored:j,running:(e==null?void 0:e.running)??null,notes:DR,remembers:qte(b)});if(S.reason==="no-version")return;f.current=!0,S.record&&Bte(b,S.record);let _=!0;return(async()=>{var U;let T=Ute(b);if(Ll())try{const I=await fetch("/api/prefs");if(!I.ok)throw new Error("desktop tour preferences unavailable");const q=await I.json();if(!(q!=null&&q.ok))throw new Error("desktop tour preferences unavailable");const P=((U=q.prefs)==null?void 0:U.tourSeen)===!0;T&&!P&&fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({tourSeen:!0}),keepalive:!0}).catch(()=>{}),T=T||P}catch{T=!0}if(!_)return;const R=Hte({tourSeen:T,decision:S}),A=S.show.length?{entries:S.show,since:j,firstRun:!1}:null;R.tour&&r(!0),R.notes==="now"?l(A):R.notes==="after"&&(s.current=A)})(),()=>{_=!1}},[e==null?void 0:e.running]);const h=(e==null?void 0:e.running)??"3.33.1",p=v.useMemo(()=>oO(DR,null,h),[h]),g=v.useCallback(()=>{l({entries:p,since:null,firstRun:!1})},[p]),w=v.useCallback(()=>r(!0),[]),k=v.useCallback(()=>l(null),[]),x=v.useCallback(()=>{r(!1),zte(fl()),Ll()&&fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({tourSeen:!0}),keepalive:!0}).catch(()=>{});const b=s.current;s.current=null,b&&l(b)},[]);return{tourOpen:n,openTour:w,closeTour:x,releaseNotes:i,closeReleaseNotes:k,chipVersion:h,openReleaseNotes:g}}function _re(){const[e,t]=v.useState(null),[n,r]=v.useState(!1),s=v.useRef(null);return v.useEffect(()=>{let i=!0,l=!1,u=null,d=null,f="";const h=x=>{i&&(r(!0),x!==f&&t(null))},p=()=>{if(l)return;l=!0,u=Date.now();const x=MR();d=x,fetch(`/api/ccusage?since=${x}`).then(b=>b.ok?b.json():null).then(b=>{if(i){if(!(b!=null&&b.ok)){h(x);return}f=x,t(Lee(b)),r(!1)}}).catch(()=>h(x)).finally(()=>{l=!1})},g=()=>{const x=s.current;Oee({shown:!!x&&x.getClientRects().length>0,tabVisible:document.visibilityState==="visible",lastSince:d,since:MR(),lastReadAt:u,now:Date.now()})&&p()};g();const w=window.setInterval(g,Iee);document.addEventListener("visibilitychange",g);let k=null;return s.current&&typeof ResizeObserver<"u"&&(k=new ResizeObserver(g),k.observe(s.current)),()=>{i=!1,window.clearInterval(w),document.removeEventListener("visibilitychange",g),k==null||k.disconnect()}},[]),{monthlyUsage:e,monthlyUsageUnavailable:n,monthUsageRef:s}}function Ere(e){const[t,n]=v.useState(null);v.useEffect(()=>{const u=Qe("agent-dag.sound");n(u===null?!0:u==="on")},[]);const r=v.useCallback(()=>{n(u=>{var f;const d=u!==!0;return Xe("agent-dag.sound",d?"on":"off"),d&&((f=e.current)==null||f.unlock()),d})},[]),s=v.useCallback(u=>{r()},[r]),i=xn(s),l=xn(t);return{soundOn:t,toggleSound:r,activateSoundRef:i,soundOnRef:l}}function Cre(){const[e,t]=v.useState(!1),n=v.useRef(null),[r,s]=v.useState(!1),i=v.useRef(null);return v.useEffect(()=>{e&&s(!1)},[e]),{soundMenuOpen:e,setSoundMenuOpen:t,soundButtonRef:n,appearanceMenuOpen:r,setAppearanceMenuOpen:s,appearanceButtonRef:i}}const Tre="agent-dag.autoFitDisabled";function Rre(e){const t=v.useRef(!1),[n,r]=v.useState(!1);v.useEffect(()=>{Zr(Tre)},[]);const s=v.useCallback(()=>{t.current||(t.current=!0,r(!0))},[]),i=v.useCallback(()=>{t.current=!1,r(!1),e(400)},[e]);return{autoFitDisabled:n,autoFitDisabledRef:t,disableAutoFit:s,enableAutoFitAndRefit:i}}function Are(){return a.jsx(a0,{children:a.jsx(Mre,{})})}function Mre(){const e=oi(),t=v.useState(l0)[0],n=v.useRef(t),[,r]=v.useState(0),s=v.useCallback(()=>r(Fr=>Fr+1),[]),{detailOpen:i,setDetailOpen:l,usagePanelOpen:u,setUsagePanelOpen:d,machinePanelOpen:f,setMachinePanelOpen:h}=are(),{selectedIds:p,primarySelectedId:g,selectAgent:w,clearSelection:k,pruneSelectionToBoard:x}=qK(n,l),{sessionListOpen:b,accountsPanelOpen:j,toggleSessionList:S,toggleAccountsPanel:_,closeSessionList:E,closeAccountsPanel:T}=Jne(),R=_re(),A=Mu(j,200),U=Mu(u,130),I=Mu(f,130),q=v.useRef(null),P=Ere(q),{activateSoundRef:O,soundOnRef:V}=P,$=gre(q),{setTonePrefs:M,tonePrefsRef:L,previewTone:Y}=$,K=mre({chimesRef:q,setTonePrefs:M,tonePrefsRef:L,previewTone:Y}),{customSelectionsRef:D,fallbackCustomRef:z}=K,F=Cre(),{setSoundMenuOpen:H}=F,{chimeState:J}=Hne({chimesRef:q,soundOnRef:V,tonePrefsRef:L,customSelectionsRef:D,fallbackCustomRef:z}),W=fne(n),{pauseGate:G,paused:X,togglePause:Z}=W,ee=v.useRef(()=>{}),{live:re,tabCapped:ce,everConnected:ie,liveSince:fe}=RK({stateRef:n,rerender:s,pauseGate:G,chimesRef:q,desktopUpdateRef:ee}),de=jre(re),{version:we,notice:xe,noticeOpen:$e,loadVersion:be}=de,he=Vne(re),{readyAppUpdate:se,onDesktopUpdateEvent:ke}=he;ee.current=ke,bre();const Ce=Sre({version:we,readyAppUpdate:se}),{tourOpen:Oe,openTour:Le,releaseNotes:Pe}=Ce,{workspace:qe,providers:Ue,providersRef:et}=mne(re),ze=pre(we),at=$ne({version:we,loadVersion:be}),{upgradeFailure:gt}=at,Ie=hre({stateRef:n,tourOpen:Oe,releaseNotes:Pe}),{openTool:ot,setSummaryFor:Je,setContextFor:it,openContext:Ft,setKeyHelpOpen:kt,setUsageHistoryOpen:Nt,setBrowserWatchOpen:qt,keyHelpOpenRef:kn,modalOpenRef:Gt}=Ie,Bt=One(),{watchOn:dn,watchUnseen:Kt}=Bt,as=Kne(),[$r,os]=v.useState(0),{presentCats:ur,hiddenCats:Bn,toggleCat:is,catBarRef:Nn,catBarOccluded:dr}=Une(n),hn=v.useRef(null),[ls,jn]=v.useState(0),yt=BK({stateRef:n,rerender:s,pruneSelectionToBoard:x,setContextFor:it,setSummaryFor:Je}),Un=vne(Ue.claude||Ue.codex),ge=Rne(Un,yt),He=Gne({now:yt,stateRef:n,version:we,notice:xe,noticeOpen:$e,upgradeFailure:gt,paused:W.paused}),{askRestart:Ze,loadAutoRestartPrefs:fn}=He,Ut=Bne(),{setTheme:hr,palette:Xs}=Ut,cs=Wne(),zn=DJ(),{applyViewport:Va,moveCamera:Ga,fitLeft:fr,cameraEpochRef:Ka,lastFitTimeRef:Ya}=zn,Ye=XJ(fr),{pinnedRef:us,positionsRef:pr,lastLayoutSigRef:Xa,handleRelayout:ds}=Ye,Zs=v.useRef(null),Js=v.useRef(()=>{}),hs=fe!==null,Yt=v.useRef(0),fs=v.useCallback(()=>{Yt.current=Date.now()},[]),{canvasRef:jt,canvasSize:oh,paneSizeRef:ih}=RQ(),Zl=Rre(fr),{autoFitDisabledRef:Qs,disableAutoFit:ps}=Zl,Ir=v.useRef(!1),{measuredRef:Sn,measuredVersionRef:lh,sizeVersion:ch,domSizeVersion:gi}=AQ(Ir),{removedNodes:yi,removedAgentIds:mr,removeNode:ea,removeSelectedNode:Jl,removalNotice:Za,bringBack:We,bringBackAll:Ql,forgetRemovals:ec}=bQ({stateRef:n,pinnedRef:us,positionsRef:pr,canvasRef:jt,clearSelection:k,primarySelectedId:g}),ta=gQ({stateRef:n,now:yt,removedAgentIds:mr,sizeVersion:ch,domSizeVersion:gi});ZJ(ta,Ye),xQ({layoutSig:ta,rf:e,stateRef:n,measuredRef:Sn,pinnedRef:us,positionsRef:pr,paneSizeRef:ih,lastInteractRef:Yt,autoFitDisabledRef:Qs,lastFitTimeRef:Ya,fitLeft:fr});const wi=MQ(),{bubbling:tc,endBubble:nc,onBubble:vi}=IG(),[ms,gr]=v.useState(!1),Hn=MG(),{beginTrashDrag:yr,trackTrashDrag:na,endTrashDrag:ra}=Hn,Wn=zG({stateRef:n,measuredRef:Sn,measuredVersionRef:lh,canvasRef:jt}),{lodRef:uh,applyZoom:rc}=Wn,gs=CQ({applyViewport:Va,lastFitTimeRef:Ya,cameraEpochRef:Ka,disableAutoFit:ps,markInteract:fs,canvasRef:jt,applyZoom:rc}),sa=g?n.current.agents.get(g):null,xi=i&&sa!=null,{railInsetRef:aa,availableWidth:bi,availableHeight:sc}=PJ({canvasRef:jt,canvasSize:oh,machinePhase:I,usagePhase:U,usagePanelOpen:u,detailShown:xi}),ys=yQ({stateRef:n,now:yt,availableWidth:bi,availableHeight:sc,layout:Ye,measuredRef:Sn,onBubble:vi,settled:wi,dragging:ms,layoutSig:ta,selectedIds:p,openContext:Ft,historyReplayed:hs,removedNodes:yi,removedAgentIds:mr,dragTick:$r,dragPatchRef:hn,dragMoveTick:ls}),{nodes:Or,edges:ws}=ys,vs=xn(g);JJ({nodes:Or,edges:ws,settled:wi,dragging:ms,availableWidth:bi,availableHeight:sc,layout:Ye,camera:zn,rf:e,measuredRef:Sn,stateRef:n,lastFocusRef:Zs,primarySelectedIdRef:vs,focusAgentRef:Js,autoFitDisabledRef:Qs});const ac=fre({stateRef:n,pinnedRef:us,measuredRef:Sn,positionsRef:pr,lastLayoutSigRef:Xa,forgetRemovals:ec,clearSelection:k,rerender:s,modalOpenRef:Gt}),{requestClear:oc}=ac,ki=OQ({nodes:Or,stateRef:n,pinnedRef:us,positionsRef:pr,draggingRef:Ir,dragPatchRef:hn,setDragging:gr,setDragMoveTick:jn,setDragTick:os,endBubble:nc,markInteract:fs,disableAutoFit:ps,beginTrashDrag:yr,trackTrashDrag:na,endTrashDrag:ra,removeNode:ea}),Ja=v.useCallback(()=>fr(500),[fr]),oa=xn(Or),{focusAgent:ia,stepAgent:wr,focusSession:Lr}=qJ({canvasRef:jt,stateRef:n,measuredRef:Sn,nodesRef:oa,railInsetRef:aa,moveCamera:Ga,disableAutoFit:ps,lastFocusRef:Zs,focusAgentRef:Js,selectAgent:w,primarySelectedIdRef:vs}),Qa=TQ({clearSelection:k,selectAgent:w,detailOpen:i,setDetailOpen:l,detailShown:xi,focusAgent:ia,draggingRef:Ir,lodRef:uh}),ic=BJ({nodesRef:oa,stateRef:n,canvasRef:jt,railInsetRef:aa}),eo=xn(Jl),la=v.useRef(null),lc=v.useCallback(Fr=>{mr.has(Fr)&&We([Fr]),Lr(Fr)},[mr,We,Lr]),Xt=$Q();IQ({pointerFocusRef:Xt,nodesRef:oa,stateRef:n,primarySelectedIdRef:vs,providersRef:et,soundOnRef:V,keyHelpOpenRef:kn,modalOpenRef:Gt,waitingCursorRef:la,removeSelectedRef:eo,activateSoundRef:O,clearSelection:k,selectAgent:w,focusAgent:ia,stepAgent:wr,focusSession:Lr,requestClear:oc,handleRelayout:ds,handleFit:Ja,togglePause:Z,toggleSessionList:S,toggleAccountsPanel:_,setDetailOpen:l,setUsageHistoryOpen:Nt,setUsagePanelOpen:d,setMachinePanelOpen:h,setBrowserWatchOpen:qt,setSoundMenuOpen:H,setKeyHelpOpen:kt,setTheme:hr});const Pr=n.current.agents.size,Dr=v.useMemo(()=>ex(n.current.agents.values()),[n.current,n.current.revision]);kQ({stateRef:n,waitingSessions:Dr,removedAgentIds:mr,removedNodes:yi,bringBack:We}),SQ({stateRef:n,waitingSessions:Dr,live:re});const xs=cre({waitingSessions:Dr,watchUnseen:Kt,incidents:ge}),Ni=ure({waitingSessions:Dr,liveSince:fe,focusSession:Lr}),{loadNotifyPrefs:ji}=Ni;return kre({loadAutoRestartPrefs:fn,loadNotifyPrefs:ji}),a.jsxs("div",{className:"app",children:[a.jsx("a",{className:"skip-link",href:"#canvas",children:"Skip to the canvas"}),a.jsxs("header",{className:"topbar",children:[a.jsx(ete,{versionCheck:de,welcome:Ce,desktopUpdate:he,pause:W,monthly:R,announcements:xs,notify:Ni,waitingSessions:Dr,waitingCursorRef:la,focusSession:Lr,live:re,now:yt,incidents:ge}),sa&&a.jsx(tte,{selected:sa,now:yt,selectedIds:p,focusAgent:ia,clearSelection:k}),a.jsxs("div",{className:"actions",children:[a.jsx(Ree,{sessionListOpen:b,toggleSessionList:S,usagePanelOpen:u,setUsagePanelOpen:d,setUsageHistoryOpen:Nt}),a.jsx(Aee,{providers:Ue,accountsPanelOpen:j,toggleAccountsPanel:_,machinePanelOpen:f,setMachinePanelOpen:h,watchOn:dn,watchUnseen:Kt,setBrowserWatchOpen:qt}),a.jsx(Mee,{providers:Ue,sound:P,tones:$,customTones:K,notify:Ni,chimeState:J,menus:F,appearance:Ut,fm:cs})]})]}),a.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:Za?`${Za.label} removed from the board.`:""}),a.jsx(vte,{restart:He,versionCheck:de,upgrade:at,oldNameNotice:ze,everConnected:ie,live:re,paused:X}),Au(A)&&Ue.claude&&a.jsx(SG,{leaving:A==="leaving",onClose:T}),b&&a.jsx(hz,{state:n.current,now:yt,selectedIds:p,onSelect:lc,onClose:E,removedIds:mr,onBringBackAll:Ql}),a.jsxs(ote,{canvasRef:jt,bubbling:tc,dragging:ms,trash:Hn,zoom:Wn,viewport:gs,stateRef:n,peek:ic,children:[Pr===0&&(!re&&ce?a.jsx(zQ,{}):a.jsx(HQ,{live:re,everConnected:ie,providers:Ue,workspace:qe,onTour:Le})),(ur.length>1||Bn.size>0)&&a.jsx(nte,{catBarRef:Nn,catBarOccluded:dr,presentCats:ur,hiddenCats:Bn,toggleCat:is}),a.jsx(sz,{graph:ys,layout:Ye,viewport:gs,clicks:Qa,drag:ki,appearance:Ut,fm:cs,autoFit:Zl,pause:W,stateRef:n,measuredRef:Sn,hiddenCats:Bn,now:yt,openTool:ot,focusAgent:ia,requestClear:oc,setKeyHelpOpen:kt})]}),Au(U)&&a.jsx(sH,{state:n.current,now:yt,providers:Ue,incidents:ge,liveSince:fe,leaving:U==="leaving",onClose:()=>d(!1)}),Au(I)&&a.jsx(UH,{usageOpen:u,leaving:I==="leaving",onClose:()=>h(!1)}),i&&sa?a.jsx(ree,{selected:sa,now:yt,openTool:ot,setSummaryFor:Je,setDetailOpen:l,stateRef:n,removeSelectedNode:Jl}):null,a.jsx(une,{dialogs:Ie,welcome:Ce,desktopUpdate:he,versionCheck:de,restart:He,lanPairs:as,clearFlow:ac,watchBadge:Bt,announcements:xs,appearance:Ut,providers:Ue,stateRef:n,agentCount:Pr})]})}try{uB(window.localStorage)}catch{}const $re=QL.createRoot(document.getElementById("root"));$re.render(a.jsx(Are,{}));export{DQ as a,st as b,Ws as c,id as d,Ore as e,Be as f,Jr as g,Ire as h,Ml as i,a as j,ns as k,eK as l,Na as m,Ba as n,hx as p,v as r,Sr as s,mt as u};
|