ccdeck 3.35.1 → 3.36.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-B7wC6HUM.js → BrowserWatchModal-BnNwmF9s.js} +1 -1
- package/dist/web/assets/{UsageHistoryModal-DgfzdQhw.js → UsageHistoryModal-CAsrCgeA.js} +1 -1
- package/dist/web/assets/index-CuVOi3gc.css +1 -0
- package/dist/web/assets/index-MjcQ231B.js +305 -0
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/release-notes.json +2 -1
- package/src/server/cli-versions.mjs +1 -1
- package/src/server/deck-prefs.mjs +2 -2
- package/src/server/index.mjs +5 -4
- package/src/server/reports-routes.mjs +1 -1
- package/src/server/reports.mjs +129 -15
- package/src/server/session-enrichment.mjs +3 -3
- package/src/server/session-tracking.mjs +1 -1
- package/src/server/transcript-scan.mjs +86 -7
- package/dist/web/assets/index-8Q-n811d.css +0 -1
- package/dist/web/assets/index-CR_USWmE.js +0 -304
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
var A3=Object.defineProperty;var M3=(e,t,n)=>t in e?A3(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var D1=(e,t,n)=>M3(e,typeof t!="symbol"?t+"":t,n);(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 o of s)if(o.type==="childList")for(const l of o.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function n(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(s){if(s.ep)return;s.ep=!0;const o=n(s);fetch(s.href,o)}})();var lu=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Qx(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Uf={exports:{}},tl={},zf={exports:{}},Pe={};/**
|
|
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 F1;function $3(){if(F1)return Pe;F1=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"),o=Symbol.for("react.provider"),l=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),p=Symbol.iterator;function g(D){return D===null||typeof D!="object"?null:(D=p&&D[p]||D["@@iterator"],typeof D=="function"?D:null)}var v={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},k=Object.assign,b={};function x(D,Y,J){this.props=D,this.context=Y,this.refs=b,this.updater=J||v}x.prototype.isReactComponent={},x.prototype.setState=function(D,Y){if(typeof D!="object"&&typeof D!="function"&&D!=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,D,Y,"setState")},x.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};function N(){}N.prototype=x.prototype;function S(D,Y,J){this.props=D,this.context=Y,this.refs=b,this.updater=J||v}var _=S.prototype=new N;_.constructor=S,k(_,x.prototype),_.isPureReactComponent=!0;var E=Array.isArray,T=Object.prototype.hasOwnProperty,R={current:null},A={key:!0,ref:!0,__self:!0,__source:!0};function q(D,Y,J){var G,K={},X=null,Z=null;if(Y!=null)for(G in Y.ref!==void 0&&(Z=Y.ref),Y.key!==void 0&&(X=""+Y.key),Y)T.call(Y,G)&&!A.hasOwnProperty(G)&&(K[G]=Y[G]);var ee=arguments.length-2;if(ee===1)K.children=J;else if(1<ee){for(var se=Array(ee),ue=0;ue<ee;ue++)se[ue]=arguments[ue+2];K.children=se}if(D&&D.defaultProps)for(G in ee=D.defaultProps,ee)K[G]===void 0&&(K[G]=ee[G]);return{$$typeof:e,type:D,key:X,ref:Z,props:K,_owner:R.current}}function L(D,Y){return{$$typeof:e,type:D.type,key:Y,ref:D.ref,props:D.props,_owner:D._owner}}function P(D){return typeof D=="object"&&D!==null&&D.$$typeof===e}function I(D){var Y={"=":"=0",":":"=2"};return"$"+D.replace(/[=:]/g,function(J){return Y[J]})}var O=/\/+/g;function U(D,Y){return typeof D=="object"&&D!==null&&D.key!=null?I(""+D.key):Y.toString(36)}function M(D,Y,J,G,K){var X=typeof D;(X==="undefined"||X==="boolean")&&(D=null);var Z=!1;if(D===null)Z=!0;else switch(X){case"string":case"number":Z=!0;break;case"object":switch(D.$$typeof){case e:case t:Z=!0}}if(Z)return Z=D,K=K(Z),D=G===""?"."+U(Z,0):G,E(K)?(J="",D!=null&&(J=D.replace(O,"$&/")+"/"),M(K,Y,J,"",function(ue){return ue})):K!=null&&(P(K)&&(K=L(K,J+(!K.key||Z&&Z.key===K.key?"":(""+K.key).replace(O,"$&/")+"/")+D)),Y.push(K)),1;if(Z=0,G=G===""?".":G+":",E(D))for(var ee=0;ee<D.length;ee++){X=D[ee];var se=G+U(X,ee);Z+=M(X,Y,J,se,K)}else if(se=g(D),typeof se=="function")for(D=se.call(D),ee=0;!(X=D.next()).done;)X=X.value,se=G+U(X,ee++),Z+=M(X,Y,J,se,K);else if(X==="object")throw Y=String(D),Error("Objects are not valid as a React child (found: "+(Y==="[object Object]"?"object with keys {"+Object.keys(D).join(", ")+"}":Y)+"). If you meant to render a collection of children, use an array instead.");return Z}function $(D,Y,J){if(D==null)return D;var G=[],K=0;return M(D,G,"","",function(X){return Y.call(J,X,K++)}),G}function B(D){if(D._status===-1){var Y=D._result;Y=Y(),Y.then(function(J){(D._status===0||D._status===-1)&&(D._status=1,D._result=J)},function(J){(D._status===0||D._status===-1)&&(D._status=2,D._result=J)}),D._status===-1&&(D._status=0,D._result=Y)}if(D._status===1)return D._result.default;throw D._result}var V={current:null},H={transition:null},F={ReactCurrentDispatcher:V,ReactCurrentBatchConfig:H,ReactCurrentOwner:R};function W(){throw Error("act(...) is not supported in production builds of React.")}return Pe.Children={map:$,forEach:function(D,Y,J){$(D,function(){Y.apply(this,arguments)},J)},count:function(D){var Y=0;return $(D,function(){Y++}),Y},toArray:function(D){return $(D,function(Y){return Y})||[]},only:function(D){if(!P(D))throw Error("React.Children.only expected to receive a single React element child.");return D}},Pe.Component=x,Pe.Fragment=n,Pe.Profiler=s,Pe.PureComponent=S,Pe.StrictMode=r,Pe.Suspense=d,Pe.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=F,Pe.act=W,Pe.cloneElement=function(D,Y,J){if(D==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+D+".");var G=k({},D.props),K=D.key,X=D.ref,Z=D._owner;if(Y!=null){if(Y.ref!==void 0&&(X=Y.ref,Z=R.current),Y.key!==void 0&&(K=""+Y.key),D.type&&D.type.defaultProps)var ee=D.type.defaultProps;for(se in Y)T.call(Y,se)&&!A.hasOwnProperty(se)&&(G[se]=Y[se]===void 0&&ee!==void 0?ee[se]:Y[se])}var se=arguments.length-2;if(se===1)G.children=J;else if(1<se){ee=Array(se);for(var ue=0;ue<se;ue++)ee[ue]=arguments[ue+2];G.children=ee}return{$$typeof:e,type:D.type,key:K,ref:X,props:G,_owner:Z}},Pe.createContext=function(D){return D={$$typeof:l,_currentValue:D,_currentValue2:D,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},D.Provider={$$typeof:o,_context:D},D.Consumer=D},Pe.createElement=q,Pe.createFactory=function(D){var Y=q.bind(null,D);return Y.type=D,Y},Pe.createRef=function(){return{current:null}},Pe.forwardRef=function(D){return{$$typeof:u,render:D}},Pe.isValidElement=P,Pe.lazy=function(D){return{$$typeof:f,_payload:{_status:-1,_result:D},_init:B}},Pe.memo=function(D,Y){return{$$typeof:h,type:D,compare:Y===void 0?null:Y}},Pe.startTransition=function(D){var Y=H.transition;H.transition={};try{D()}finally{H.transition=Y}},Pe.unstable_act=W,Pe.useCallback=function(D,Y){return V.current.useCallback(D,Y)},Pe.useContext=function(D){return V.current.useContext(D)},Pe.useDebugValue=function(){},Pe.useDeferredValue=function(D){return V.current.useDeferredValue(D)},Pe.useEffect=function(D,Y){return V.current.useEffect(D,Y)},Pe.useId=function(){return V.current.useId()},Pe.useImperativeHandle=function(D,Y,J){return V.current.useImperativeHandle(D,Y,J)},Pe.useInsertionEffect=function(D,Y){return V.current.useInsertionEffect(D,Y)},Pe.useLayoutEffect=function(D,Y){return V.current.useLayoutEffect(D,Y)},Pe.useMemo=function(D,Y){return V.current.useMemo(D,Y)},Pe.useReducer=function(D,Y,J){return V.current.useReducer(D,Y,J)},Pe.useRef=function(D){return V.current.useRef(D)},Pe.useState=function(D){return V.current.useState(D)},Pe.useSyncExternalStore=function(D,Y,J){return V.current.useSyncExternalStore(D,Y,J)},Pe.useTransition=function(){return V.current.useTransition()},Pe.version="18.3.1",Pe}var q1;function Hl(){return q1||(q1=1,zf.exports=$3()),zf.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 B1;function I3(){if(B1)return tl;B1=1;var e=Hl(),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,o={key:!0,ref:!0,__self:!0,__source:!0};function l(u,d,h){var f,p={},g=null,v=null;h!==void 0&&(g=""+h),d.key!==void 0&&(g=""+d.key),d.ref!==void 0&&(v=d.ref);for(f in d)r.call(d,f)&&!o.hasOwnProperty(f)&&(p[f]=d[f]);if(u&&u.defaultProps)for(f in d=u.defaultProps,d)p[f]===void 0&&(p[f]=d[f]);return{$$typeof:t,type:u,key:g,ref:v,props:p,_owner:s.current}}return tl.Fragment=n,tl.jsx=l,tl.jsxs=l,tl}var U1;function O3(){return U1||(U1=1,Uf.exports=I3()),Uf.exports}var a=O3(),cu={},Wf={exports:{}},ln={},Hf={exports:{}},Vf={};/**
|
|
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 z1;function L3(){return z1||(z1=1,(function(e){function t(H,F){var W=H.length;H.push(F);e:for(;0<W;){var D=W-1>>>1,Y=H[D];if(0<s(Y,F))H[D]=F,H[W]=Y,W=D;else break e}}function n(H){return H.length===0?null:H[0]}function r(H){if(H.length===0)return null;var F=H[0],W=H.pop();if(W!==F){H[0]=W;e:for(var D=0,Y=H.length,J=Y>>>1;D<J;){var G=2*(D+1)-1,K=H[G],X=G+1,Z=H[X];if(0>s(K,W))X<Y&&0>s(Z,K)?(H[D]=Z,H[X]=W,D=X):(H[D]=K,H[G]=W,D=G);else if(X<Y&&0>s(Z,W))H[D]=Z,H[X]=W,D=X;else break e}}return F}function s(H,F){var W=H.sortIndex-F.sortIndex;return W!==0?W:H.id-F.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var l=Date,u=l.now();e.unstable_now=function(){return l.now()-u}}var d=[],h=[],f=1,p=null,g=3,v=!1,k=!1,b=!1,x=typeof setTimeout=="function"?setTimeout:null,N=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 _(H){for(var F=n(h);F!==null;){if(F.callback===null)r(h);else if(F.startTime<=H)r(h),F.sortIndex=F.expirationTime,t(d,F);else break;F=n(h)}}function E(H){if(b=!1,_(H),!k)if(n(d)!==null)k=!0,B(T);else{var F=n(h);F!==null&&V(E,F.startTime-H)}}function T(H,F){k=!1,b&&(b=!1,N(q),q=-1),v=!0;var W=g;try{for(_(F),p=n(d);p!==null&&(!(p.expirationTime>F)||H&&!I());){var D=p.callback;if(typeof D=="function"){p.callback=null,g=p.priorityLevel;var Y=D(p.expirationTime<=F);F=e.unstable_now(),typeof Y=="function"?p.callback=Y:p===n(d)&&r(d),_(F)}else r(d);p=n(d)}if(p!==null)var J=!0;else{var G=n(h);G!==null&&V(E,G.startTime-F),J=!1}return J}finally{p=null,g=W,v=!1}}var R=!1,A=null,q=-1,L=5,P=-1;function I(){return!(e.unstable_now()-P<L)}function O(){if(A!==null){var H=e.unstable_now();P=H;var F=!0;try{F=A(!0,H)}finally{F?U():(R=!1,A=null)}}else R=!1}var U;if(typeof S=="function")U=function(){S(O)};else if(typeof MessageChannel<"u"){var M=new MessageChannel,$=M.port2;M.port1.onmessage=O,U=function(){$.postMessage(null)}}else U=function(){x(O,0)};function B(H){A=H,R||(R=!0,U())}function V(H,F){q=x(function(){H(e.unstable_now())},F)}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(H){H.callback=null},e.unstable_continueExecution=function(){k||v||(k=!0,B(T))},e.unstable_forceFrameRate=function(H){0>H||125<H?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):L=0<H?Math.floor(1e3/H):5},e.unstable_getCurrentPriorityLevel=function(){return g},e.unstable_getFirstCallbackNode=function(){return n(d)},e.unstable_next=function(H){switch(g){case 1:case 2:case 3:var F=3;break;default:F=g}var W=g;g=F;try{return H()}finally{g=W}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(H,F){switch(H){case 1:case 2:case 3:case 4:case 5:break;default:H=3}var W=g;g=H;try{return F()}finally{g=W}},e.unstable_scheduleCallback=function(H,F,W){var D=e.unstable_now();switch(typeof W=="object"&&W!==null?(W=W.delay,W=typeof W=="number"&&0<W?D+W:D):W=D,H){case 1:var Y=-1;break;case 2:Y=250;break;case 5:Y=1073741823;break;case 4:Y=1e4;break;default:Y=5e3}return Y=W+Y,H={id:f++,callback:F,priorityLevel:H,startTime:W,expirationTime:Y,sortIndex:-1},W>D?(H.sortIndex=W,t(h,H),n(d)===null&&H===n(h)&&(b?(N(q),q=-1):b=!0,V(E,W-D))):(H.sortIndex=Y,t(d,H),k||v||(k=!0,B(T))),H},e.unstable_shouldYield=I,e.unstable_wrapCallback=function(H){var F=g;return function(){var W=g;g=F;try{return H.apply(this,arguments)}finally{g=W}}}})(Vf)),Vf}var W1;function P3(){return W1||(W1=1,Hf.exports=L3()),Hf.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 H1;function D3(){if(H1)return ln;H1=1;var e=Hl(),t=P3();function n(i){for(var c="https://reactjs.org/docs/error-decoder.html?invariant="+i,m=1;m<arguments.length;m++)c+="&args[]="+encodeURIComponent(arguments[m]);return"Minified React error #"+i+"; 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 o(i,c){l(i,c),l(i+"Capture",c)}function l(i,c){for(s[i]=c,i=0;i<c.length;i++)r.add(c[i])}var u=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),d=Object.prototype.hasOwnProperty,h=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,f={},p={};function g(i){return d.call(p,i)?!0:d.call(f,i)?!1:h.test(i)?p[i]=!0:(f[i]=!0,!1)}function v(i,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:(i=i.toLowerCase().slice(0,5),i!=="data-"&&i!=="aria-");default:return!1}}function k(i,c,m,y){if(c===null||typeof c>"u"||v(i,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 b(i,c,m,y,j,C,z){this.acceptsBooleans=c===2||c===3||c===4,this.attributeName=y,this.attributeNamespace=j,this.mustUseProperty=m,this.propertyName=i,this.type=c,this.sanitizeURL=C,this.removeEmptyString=z}var x={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(i){x[i]=new b(i,0,!1,i,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(i){var c=i[0];x[c]=new b(c,1,!1,i[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(i){x[i]=new b(i,2,!1,i.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(i){x[i]=new b(i,2,!1,i,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(i){x[i]=new b(i,3,!1,i.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(i){x[i]=new b(i,3,!0,i,null,!1,!1)}),["capture","download"].forEach(function(i){x[i]=new b(i,4,!1,i,null,!1,!1)}),["cols","rows","size","span"].forEach(function(i){x[i]=new b(i,6,!1,i,null,!1,!1)}),["rowSpan","start"].forEach(function(i){x[i]=new b(i,5,!1,i.toLowerCase(),null,!1,!1)});var N=/[\-:]([a-z])/g;function S(i){return i[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(i){var c=i.replace(N,S);x[c]=new b(c,1,!1,i,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(i){var c=i.replace(N,S);x[c]=new b(c,1,!1,i,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(i){var c=i.replace(N,S);x[c]=new b(c,1,!1,i,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(i){x[i]=new b(i,1,!1,i.toLowerCase(),null,!1,!1)}),x.xlinkHref=new b("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(i){x[i]=new b(i,1,!1,i.toLowerCase(),null,!0,!0)});function _(i,c,m,y){var j=x.hasOwnProperty(c)?x[c]:null;(j!==null?j.type!==0:y||!(2<c.length)||c[0]!=="o"&&c[0]!=="O"||c[1]!=="n"&&c[1]!=="N")&&(k(c,m,j,y)&&(m=null),y||j===null?g(c)&&(m===null?i.removeAttribute(c):i.setAttribute(c,""+m)):j.mustUseProperty?i[j.propertyName]=m===null?j.type===3?!1:"":m:(c=j.attributeName,y=j.attributeNamespace,m===null?i.removeAttribute(c):(j=j.type,m=j===3||j===4&&m===!0?"":""+m,y?i.setAttributeNS(y,c,m):i.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"),q=Symbol.for("react.strict_mode"),L=Symbol.for("react.profiler"),P=Symbol.for("react.provider"),I=Symbol.for("react.context"),O=Symbol.for("react.forward_ref"),U=Symbol.for("react.suspense"),M=Symbol.for("react.suspense_list"),$=Symbol.for("react.memo"),B=Symbol.for("react.lazy"),V=Symbol.for("react.offscreen"),H=Symbol.iterator;function F(i){return i===null||typeof i!="object"?null:(i=H&&i[H]||i["@@iterator"],typeof i=="function"?i:null)}var W=Object.assign,D;function Y(i){if(D===void 0)try{throw Error()}catch(m){var c=m.stack.trim().match(/\n( *(at )?)/);D=c&&c[1]||""}return`
|
|
34
|
+
`+D+i}var J=!1;function G(i,c){if(!i||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(ce){var y=ce}Reflect.construct(i,[],c)}else{try{c.call()}catch(ce){y=ce}i.call(c.prototype)}else{try{throw Error()}catch(ce){y=ce}i()}}catch(ce){if(ce&&y&&typeof ce.stack=="string"){for(var j=ce.stack.split(`
|
|
35
|
+
`),C=y.stack.split(`
|
|
36
|
+
`),z=j.length-1,Q=C.length-1;1<=z&&0<=Q&&j[z]!==C[Q];)Q--;for(;1<=z&&0<=Q;z--,Q--)if(j[z]!==C[Q]){if(z!==1||Q!==1)do if(z--,Q--,0>Q||j[z]!==C[Q]){var te=`
|
|
37
|
+
`+j[z].replace(" at new "," at ");return i.displayName&&te.includes("<anonymous>")&&(te=te.replace("<anonymous>",i.displayName)),te}while(1<=z&&0<=Q);break}}}finally{J=!1,Error.prepareStackTrace=m}return(i=i?i.displayName||i.name:"")?Y(i):""}function K(i){switch(i.tag){case 5:return Y(i.type);case 16:return Y("Lazy");case 13:return Y("Suspense");case 19:return Y("SuspenseList");case 0:case 2:case 15:return i=G(i.type,!1),i;case 11:return i=G(i.type.render,!1),i;case 1:return i=G(i.type,!0),i;default:return""}}function X(i){if(i==null)return null;if(typeof i=="function")return i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case A:return"Fragment";case R:return"Portal";case L:return"Profiler";case q:return"StrictMode";case U:return"Suspense";case M:return"SuspenseList"}if(typeof i=="object")switch(i.$$typeof){case I:return(i.displayName||"Context")+".Consumer";case P:return(i._context.displayName||"Context")+".Provider";case O:var c=i.render;return i=i.displayName,i||(i=c.displayName||c.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case $:return c=i.displayName||null,c!==null?c:X(i.type)||"Memo";case B:c=i._payload,i=i._init;try{return X(i(c))}catch{}}return null}function Z(i){var c=i.type;switch(i.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 i=c.render,i=i.displayName||i.name||"",c.displayName||(i!==""?"ForwardRef("+i+")":"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===q?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof c=="function")return c.displayName||c.name||null;if(typeof c=="string")return c}return null}function ee(i){switch(typeof i){case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function se(i){var c=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(c==="checkbox"||c==="radio")}function ue(i){var c=se(i)?"checked":"value",m=Object.getOwnPropertyDescriptor(i.constructor.prototype,c),y=""+i[c];if(!i.hasOwnProperty(c)&&typeof m<"u"&&typeof m.get=="function"&&typeof m.set=="function"){var j=m.get,C=m.set;return Object.defineProperty(i,c,{configurable:!0,get:function(){return j.call(this)},set:function(z){y=""+z,C.call(this,z)}}),Object.defineProperty(i,c,{enumerable:m.enumerable}),{getValue:function(){return y},setValue:function(z){y=""+z},stopTracking:function(){i._valueTracker=null,delete i[c]}}}}function ae(i){i._valueTracker||(i._valueTracker=ue(i))}function re(i){if(!i)return!1;var c=i._valueTracker;if(!c)return!0;var m=c.getValue(),y="";return i&&(y=se(i)?i.checked?"true":"false":i.value),i=y,i!==m?(c.setValue(i),!0):!1}function de(i){if(i=i||(typeof document<"u"?document:void 0),typeof i>"u")return null;try{return i.activeElement||i.body}catch{return i.body}}function me(i,c){var m=c.checked;return W({},c,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:m??i._wrapperState.initialChecked})}function pe(i,c){var m=c.defaultValue==null?"":c.defaultValue,y=c.checked!=null?c.checked:c.defaultChecked;m=ee(c.value!=null?c.value:m),i._wrapperState={initialChecked:y,initialValue:m,controlled:c.type==="checkbox"||c.type==="radio"?c.checked!=null:c.value!=null}}function ke(i,c){c=c.checked,c!=null&&_(i,"checked",c,!1)}function xe(i,c){ke(i,c);var m=ee(c.value),y=c.type;if(m!=null)y==="number"?(m===0&&i.value===""||i.value!=m)&&(i.value=""+m):i.value!==""+m&&(i.value=""+m);else if(y==="submit"||y==="reset"){i.removeAttribute("value");return}c.hasOwnProperty("value")?Te(i,c.type,m):c.hasOwnProperty("defaultValue")&&Te(i,c.type,ee(c.defaultValue)),c.checked==null&&c.defaultChecked!=null&&(i.defaultChecked=!!c.defaultChecked)}function fe(i,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=""+i._wrapperState.initialValue,m||c===i.value||(i.value=c),i.defaultValue=c}m=i.name,m!==""&&(i.name=""),i.defaultChecked=!!i._wrapperState.initialChecked,m!==""&&(i.name=m)}function Te(i,c,m){(c!=="number"||de(i.ownerDocument)!==i)&&(m==null?i.defaultValue=""+i._wrapperState.initialValue:i.defaultValue!==""+m&&(i.defaultValue=""+m))}var Fe=Array.isArray;function Oe(i,c,m,y){if(i=i.options,c){c={};for(var j=0;j<m.length;j++)c["$"+m[j]]=!0;for(m=0;m<i.length;m++)j=c.hasOwnProperty("$"+i[m].value),i[m].selected!==j&&(i[m].selected=j),j&&y&&(i[m].defaultSelected=!0)}else{for(m=""+ee(m),c=null,j=0;j<i.length;j++){if(i[j].value===m){i[j].selected=!0,y&&(i[j].defaultSelected=!0);return}c!==null||i[j].disabled||(c=i[j])}c!==null&&(c.selected=!0)}}function We(i,c){if(c.dangerouslySetInnerHTML!=null)throw Error(n(91));return W({},c,{value:void 0,defaultValue:void 0,children:""+i._wrapperState.initialValue})}function le(i,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(Fe(m)){if(1<m.length)throw Error(n(93));m=m[0]}c=m}c==null&&(c=""),m=c}i._wrapperState={initialValue:ee(m)}}function je(i,c){var m=ee(c.value),y=ee(c.defaultValue);m!=null&&(m=""+m,m!==i.value&&(i.value=m),c.defaultValue==null&&i.defaultValue!==m&&(i.defaultValue=m)),y!=null&&(i.defaultValue=""+y)}function Re(i){var c=i.textContent;c===i._wrapperState.initialValue&&c!==""&&c!==null&&(i.value=c)}function Le(i){switch(i){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(i,c){return i==null||i==="http://www.w3.org/1999/xhtml"?Le(c):i==="http://www.w3.org/2000/svg"&&c==="foreignObject"?"http://www.w3.org/1999/xhtml":i}var rt,Je=(function(i){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(c,m,y,j){MSApp.execUnsafeLocalFunction(function(){return i(c,m,y,j)})}:i})(function(i,c){if(i.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in i)i.innerHTML=c;else{for(rt=rt||document.createElement("div"),rt.innerHTML="<svg>"+c.valueOf().toString()+"</svg>",c=rt.firstChild;i.firstChild;)i.removeChild(i.firstChild);for(;c.firstChild;)i.appendChild(c.firstChild)}});function it(i,c){if(c){var m=i.firstChild;if(m&&m===i.lastChild&&m.nodeType===3){m.nodeValue=c;return}}i.textContent=c}var Ue={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},lt=["Webkit","ms","Moz","O"];Object.keys(Ue).forEach(function(i){lt.forEach(function(c){c=c+i.charAt(0).toUpperCase()+i.substring(1),Ue[c]=Ue[i]})});function He(i,c,m){return c==null||typeof c=="boolean"||c===""?"":m||typeof c!="number"||c===0||Ue.hasOwnProperty(i)&&Ue[i]?(""+c).trim():c+"px"}function ft(i,c){i=i.style;for(var m in c)if(c.hasOwnProperty(m)){var y=m.indexOf("--")===0,j=He(m,c[m],y);m==="float"&&(m="cssFloat"),y?i.setProperty(m,j):i[m]=j}}var Vt=W({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 Xe(i,c){if(c){if(Vt[i]&&(c.children!=null||c.dangerouslySetInnerHTML!=null))throw Error(n(137,i));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 pt(i,c){if(i.indexOf("-")===-1)return typeof c.is=="string";switch(i){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 Ot=null;function fn(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var Lt=null,qt=null,Zt=null;function Bt(i){if(i=qi(i)){if(typeof Lt!="function")throw Error(n(280));var c=i.stateNode;c&&(c=Nc(c),Lt(i.stateNode,i.type,c))}}function pr(i){qt?Zt?Zt.push(i):Zt=[i]:qt=i}function qr(){if(qt){var i=qt,c=Zt;if(Zt=qt=null,Bt(i),c)for(i=0;i<c.length;i++)Bt(c[i])}}function Br(i,c){return i(c)}function ms(){}var mr=!1;function gr(i,c,m){if(mr)return i(c,m);mr=!0;try{return Br(i,c,m)}finally{mr=!1,(qt!==null||Zt!==null)&&(ms(),qr())}}function Nn(i,c){var m=i.stateNode;if(m===null)return null;var y=Nc(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)||(i=i.type,y=!(i==="button"||i==="input"||i==="select"||i==="textarea")),i=!y;break e;default:i=!1}if(i)return null;if(m&&typeof m!="function")throw Error(n(231,c,typeof m));return m}var Ur=!1;if(u)try{var jn={};Object.defineProperty(jn,"passive",{get:function(){Ur=!0}}),window.addEventListener("test",jn,jn),window.removeEventListener("test",jn,jn)}catch{Ur=!1}function gs(i,c,m,y,j,C,z,Q,te){var ce=Array.prototype.slice.call(arguments,3);try{c.apply(m,ce)}catch(we){this.onError(we)}}var zn=!1,Wn=null,vt=!1,yr=null,wr={onError:function(i){zn=!0,Wn=i}};function vr(i,c,m,y,j,C,z,Q,te){zn=!1,Wn=null,gs.apply(wr,arguments)}function ys(i,c,m,y,j,C,z,Q,te){if(vr.apply(this,arguments),zn){if(zn){var ce=Wn;zn=!1,Wn=null}else throw Error(n(198));vt||(vt=!0,yr=ce)}}function Jt(i){var c=i,m=i;if(i.alternate)for(;c.return;)c=c.return;else{i=c;do c=i,(c.flags&4098)!==0&&(m=c.return),i=c.return;while(i)}return c.tag===3?m:null}function ge(i){if(i.tag===13){var c=i.memoizedState;if(c===null&&(i=i.alternate,i!==null&&(c=i.memoizedState)),c!==null)return c.dehydrated}return null}function qe(i){if(Jt(i)!==i)throw Error(n(188))}function Ze(i){var c=i.alternate;if(!c){if(c=Jt(i),c===null)throw Error(n(188));return c!==i?null:i}for(var m=i,y=c;;){var j=m.return;if(j===null)break;var C=j.alternate;if(C===null){if(y=j.return,y!==null){m=y;continue}break}if(j.child===C.child){for(C=j.child;C;){if(C===m)return qe(j),i;if(C===y)return qe(j),c;C=C.sibling}throw Error(n(188))}if(m.return!==y.return)m=j,y=C;else{for(var z=!1,Q=j.child;Q;){if(Q===m){z=!0,m=j,y=C;break}if(Q===y){z=!0,y=j,m=C;break}Q=Q.sibling}if(!z){for(Q=C.child;Q;){if(Q===m){z=!0,m=C,y=j;break}if(Q===y){z=!0,y=C,m=j;break}Q=Q.sibling}if(!z)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?i:c}function Qt(i){return i=Ze(i),i!==null?zr(i):null}function zr(i){if(i.tag===5||i.tag===6)return i;for(i=i.child;i!==null;){var c=zr(i);if(c!==null)return c;i=i.sibling}return null}var xr=t.unstable_scheduleCallback,ws=t.unstable_cancelCallback,Sn=t.unstable_shouldYield,Wr=t.unstable_requestPaint,tt=t.unstable_now,Hr=t.unstable_getCurrentPriorityLevel,br=t.unstable_ImmediatePriority,Vr=t.unstable_UserBlockingPriority,vs=t.unstable_NormalPriority,Va=t.unstable_LowPriority,ea=t.unstable_IdlePriority,Gr=null,en=null;function xs(i){if(en&&typeof en.onCommitFiberRoot=="function")try{en.onCommitFiberRoot(Gr,i,void 0,(i.current.flags&128)===128)}catch{}}var tn=Math.clz32?Math.clz32:gh,Kr=Math.log,mh=Math.LN2;function gh(i){return i>>>=0,i===0?32:31-(Kr(i)/mh|0)|0}var ta=64,na=4194304;function Yr(i){switch(i&-i){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 i&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return i&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return i}}function bs(i,c){var m=i.pendingLanes;if(m===0)return 0;var y=0,j=i.suspendedLanes,C=i.pingedLanes,z=m&268435455;if(z!==0){var Q=z&~j;Q!==0?y=Yr(Q):(C&=z,C!==0&&(y=Yr(C)))}else z=m&~j,z!==0?y=Yr(z):C!==0&&(y=Yr(C));if(y===0)return 0;if(c!==0&&c!==y&&(c&j)===0&&(j=y&-y,C=c&-c,j>=C||j===16&&(C&4194240)!==0))return c;if((y&4)!==0&&(y|=m&16),c=i.entangledLanes,c!==0)for(i=i.entanglements,c&=y;0<c;)m=31-tn(c),j=1<<m,y|=i[m],c&=~j;return y}function Xr(i,c){switch(i){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 yh(i,c){for(var m=i.suspendedLanes,y=i.pingedLanes,j=i.expirationTimes,C=i.pendingLanes;0<C;){var z=31-tn(C),Q=1<<z,te=j[z];te===-1?((Q&m)===0||(Q&y)!==0)&&(j[z]=Xr(Q,c)):te<=c&&(i.expiredLanes|=Q),C&=~Q}}function bi(i){return i=i.pendingLanes&-1073741825,i!==0?i:i&1073741824?1073741824:0}function ac(){var i=ta;return ta<<=1,(ta&4194240)===0&&(ta=64),i}function Ga(i){for(var c=[],m=0;31>m;m++)c.push(i);return c}function _n(i,c,m){i.pendingLanes|=c,c!==536870912&&(i.suspendedLanes=0,i.pingedLanes=0),i=i.eventTimes,c=31-tn(c),i[c]=m}function wh(i,c){var m=i.pendingLanes&~c;i.pendingLanes=c,i.suspendedLanes=0,i.pingedLanes=0,i.expiredLanes&=c,i.mutableReadLanes&=c,i.entangledLanes&=c,c=i.entanglements;var y=i.eventTimes;for(i=i.expirationTimes;0<m;){var j=31-tn(m),C=1<<j;c[j]=0,y[j]=-1,i[j]=-1,m&=~C}}function Ka(i,c){var m=i.entangledLanes|=c;for(i=i.entanglements;m;){var y=31-tn(m),j=1<<y;j&c|i[y]&c&&(i[y]|=c),m&=~j}}var Ve=0;function Ya(i){return i&=-i,1<i?4<i?(i&268435455)!==0?16:536870912:4:1}var oc,ki,Xa,Ni,ic,ji=!1,Za=[],En=null,kr=null,Hn=null,ra=new Map,sa=new Map,Nr=[],lc="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 cc(i,c){switch(i){case"focusin":case"focusout":En=null;break;case"dragenter":case"dragleave":kr=null;break;case"mouseover":case"mouseout":Hn=null;break;case"pointerover":case"pointerout":ra.delete(c.pointerId);break;case"gotpointercapture":case"lostpointercapture":sa.delete(c.pointerId)}}function aa(i,c,m,y,j,C){return i===null||i.nativeEvent!==C?(i={blockedOn:c,domEventName:m,eventSystemFlags:y,nativeEvent:C,targetContainers:[j]},c!==null&&(c=qi(c),c!==null&&ki(c)),i):(i.eventSystemFlags|=y,c=i.targetContainers,j!==null&&c.indexOf(j)===-1&&c.push(j),i)}function uc(i,c,m,y,j){switch(c){case"focusin":return En=aa(En,i,c,m,y,j),!0;case"dragenter":return kr=aa(kr,i,c,m,y,j),!0;case"mouseover":return Hn=aa(Hn,i,c,m,y,j),!0;case"pointerover":var C=j.pointerId;return ra.set(C,aa(ra.get(C)||null,i,c,m,y,j)),!0;case"gotpointercapture":return C=j.pointerId,sa.set(C,aa(sa.get(C)||null,i,c,m,y,j)),!0}return!1}function ks(i){var c=la(i.target);if(c!==null){var m=Jt(c);if(m!==null){if(c=m.tag,c===13){if(c=ge(m),c!==null){i.blockedOn=c,ic(i.priority,function(){Xa(m)});return}}else if(c===3&&m.stateNode.current.memoizedState.isDehydrated){i.blockedOn=m.tag===3?m.stateNode.containerInfo:null;return}}}i.blockedOn=null}function oa(i){if(i.blockedOn!==null)return!1;for(var c=i.targetContainers;0<c.length;){var m=Ei(i.domEventName,i.eventSystemFlags,c[0],i.nativeEvent);if(m===null){m=i.nativeEvent;var y=new m.constructor(m.type,m);Ot=y,m.target.dispatchEvent(y),Ot=null}else return c=qi(m),c!==null&&ki(c),i.blockedOn=m,!1;c.shift()}return!0}function Si(i,c,m){oa(i)&&m.delete(c)}function dc(){ji=!1,En!==null&&oa(En)&&(En=null),kr!==null&&oa(kr)&&(kr=null),Hn!==null&&oa(Hn)&&(Hn=null),ra.forEach(Si),sa.forEach(Si)}function Ns(i,c){i.blockedOn===c&&(i.blockedOn=null,ji||(ji=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,dc)))}function js(i){function c(j){return Ns(j,i)}if(0<Za.length){Ns(Za[0],i);for(var m=1;m<Za.length;m++){var y=Za[m];y.blockedOn===i&&(y.blockedOn=null)}}for(En!==null&&Ns(En,i),kr!==null&&Ns(kr,i),Hn!==null&&Ns(Hn,i),ra.forEach(c),sa.forEach(c),m=0;m<Nr.length;m++)y=Nr[m],y.blockedOn===i&&(y.blockedOn=null);for(;0<Nr.length&&(m=Nr[0],m.blockedOn===null);)ks(m),m.blockedOn===null&&Nr.shift()}var jr=E.ReactCurrentBatchConfig,Ja=!0;function _i(i,c,m,y){var j=Ve,C=jr.transition;jr.transition=null;try{Ve=1,Qa(i,c,m,y)}finally{Ve=j,jr.transition=C}}function hc(i,c,m,y){var j=Ve,C=jr.transition;jr.transition=null;try{Ve=4,Qa(i,c,m,y)}finally{Ve=j,jr.transition=C}}function Qa(i,c,m,y){if(Ja){var j=Ei(i,c,m,y);if(j===null)Ah(i,c,y,eo,m),cc(i,y);else if(uc(j,i,c,m,y))y.stopPropagation();else if(cc(i,y),c&4&&-1<lc.indexOf(i)){for(;j!==null;){var C=qi(j);if(C!==null&&oc(C),C=Ei(i,c,m,y),C===null&&Ah(i,c,y,eo,m),C===j)break;j=C}j!==null&&y.stopPropagation()}else Ah(i,c,y,null,m)}}var eo=null;function Ei(i,c,m,y){if(eo=null,i=fn(y),i=la(i),i!==null)if(c=Jt(i),c===null)i=null;else if(m=c.tag,m===13){if(i=ge(c),i!==null)return i;i=null}else if(m===3){if(c.stateNode.current.memoizedState.isDehydrated)return c.tag===3?c.stateNode.containerInfo:null;i=null}else c!==i&&(i=null);return eo=i,null}function to(i){switch(i){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(Hr()){case br:return 1;case Vr:return 4;case vs:case Va:return 16;case ea:return 536870912;default:return 16}default:return 16}}var pn=null,Ci=null,Sr=null;function fc(){if(Sr)return Sr;var i,c=Ci,m=c.length,y,j="value"in pn?pn.value:pn.textContent,C=j.length;for(i=0;i<m&&c[i]===j[i];i++);var z=m-i;for(y=1;y<=z&&c[m-y]===j[C-y];y++);return Sr=j.slice(i,1<y?1-y:void 0)}function no(i){var c=i.keyCode;return"charCode"in i?(i=i.charCode,i===0&&c===13&&(i=13)):i=c,i===10&&(i=13),32<=i||i===13?i:0}function ro(){return!0}function Ti(){return!1}function Gt(i){function c(m,y,j,C,z){this._reactName=m,this._targetInst=j,this.type=y,this.nativeEvent=C,this.target=z,this.currentTarget=null;for(var Q in i)i.hasOwnProperty(Q)&&(m=i[Q],this[Q]=m?m(C):C[Q]);return this.isDefaultPrevented=(C.defaultPrevented!=null?C.defaultPrevented:C.returnValue===!1)?ro:Ti,this.isPropagationStopped=Ti,this}return W(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=ro)},stopPropagation:function(){var m=this.nativeEvent;m&&(m.stopPropagation?m.stopPropagation():typeof m.cancelBubble!="unknown"&&(m.cancelBubble=!0),this.isPropagationStopped=ro)},persist:function(){},isPersistent:ro}),c}var Ss={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},so=Gt(Ss),Vn=W({},Ss,{view:0,detail:0}),pc=Gt(Vn),ia,Ri,Gn,mc=W({},Vn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:xh,button:0,buttons:0,relatedTarget:function(i){return i.relatedTarget===void 0?i.fromElement===i.srcElement?i.toElement:i.fromElement:i.relatedTarget},movementX:function(i){return"movementX"in i?i.movementX:(i!==Gn&&(Gn&&i.type==="mousemove"?(ia=i.screenX-Gn.screenX,Ri=i.screenY-Gn.screenY):Ri=ia=0,Gn=i),ia)},movementY:function(i){return"movementY"in i?i.movementY:Ri}}),E0=Gt(mc),aL=W({},mc,{dataTransfer:0}),oL=Gt(aL),iL=W({},Vn,{relatedTarget:0}),vh=Gt(iL),lL=W({},Ss,{animationName:0,elapsedTime:0,pseudoElement:0}),cL=Gt(lL),uL=W({},Ss,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),dL=Gt(uL),hL=W({},Ss,{data:0}),C0=Gt(hL),fL={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},pL={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"},mL={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function gL(i){var c=this.nativeEvent;return c.getModifierState?c.getModifierState(i):(i=mL[i])?!!c[i]:!1}function xh(){return gL}var yL=W({},Vn,{key:function(i){if(i.key){var c=fL[i.key]||i.key;if(c!=="Unidentified")return c}return i.type==="keypress"?(i=no(i),i===13?"Enter":String.fromCharCode(i)):i.type==="keydown"||i.type==="keyup"?pL[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:xh,charCode:function(i){return i.type==="keypress"?no(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?no(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),wL=Gt(yL),vL=W({},mc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),T0=Gt(vL),xL=W({},Vn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:xh}),bL=Gt(xL),kL=W({},Ss,{propertyName:0,elapsedTime:0,pseudoElement:0}),NL=Gt(kL),jL=W({},mc,{deltaX:function(i){return"deltaX"in i?i.deltaX:"wheelDeltaX"in i?-i.wheelDeltaX:0},deltaY:function(i){return"deltaY"in i?i.deltaY:"wheelDeltaY"in i?-i.wheelDeltaY:"wheelDelta"in i?-i.wheelDelta:0},deltaZ:0,deltaMode:0}),SL=Gt(jL),_L=[9,13,27,32],bh=u&&"CompositionEvent"in window,Ai=null;u&&"documentMode"in document&&(Ai=document.documentMode);var EL=u&&"TextEvent"in window&&!Ai,R0=u&&(!bh||Ai&&8<Ai&&11>=Ai),A0=" ",M0=!1;function $0(i,c){switch(i){case"keyup":return _L.indexOf(c.keyCode)!==-1;case"keydown":return c.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function I0(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var ao=!1;function CL(i,c){switch(i){case"compositionend":return I0(c);case"keypress":return c.which!==32?null:(M0=!0,A0);case"textInput":return i=c.data,i===A0&&M0?null:i;default:return null}}function TL(i,c){if(ao)return i==="compositionend"||!bh&&$0(i,c)?(i=fc(),Sr=Ci=pn=null,ao=!1,i):null;switch(i){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 R0&&c.locale!=="ko"?null:c.data;default:return null}}var RL={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 O0(i){var c=i&&i.nodeName&&i.nodeName.toLowerCase();return c==="input"?!!RL[i.type]:c==="textarea"}function L0(i,c,m,y){pr(y),c=xc(c,"onChange"),0<c.length&&(m=new so("onChange","change",null,m,y),i.push({event:m,listeners:c}))}var Mi=null,$i=null;function AL(i){ek(i,0)}function gc(i){var c=uo(i);if(re(c))return i}function ML(i,c){if(i==="change")return c}var P0=!1;if(u){var kh;if(u){var Nh="oninput"in document;if(!Nh){var D0=document.createElement("div");D0.setAttribute("oninput","return;"),Nh=typeof D0.oninput=="function"}kh=Nh}else kh=!1;P0=kh&&(!document.documentMode||9<document.documentMode)}function F0(){Mi&&(Mi.detachEvent("onpropertychange",q0),$i=Mi=null)}function q0(i){if(i.propertyName==="value"&&gc($i)){var c=[];L0(c,$i,i,fn(i)),gr(AL,c)}}function $L(i,c,m){i==="focusin"?(F0(),Mi=c,$i=m,Mi.attachEvent("onpropertychange",q0)):i==="focusout"&&F0()}function IL(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return gc($i)}function OL(i,c){if(i==="click")return gc(c)}function LL(i,c){if(i==="input"||i==="change")return gc(c)}function PL(i,c){return i===c&&(i!==0||1/i===1/c)||i!==i&&c!==c}var Kn=typeof Object.is=="function"?Object.is:PL;function Ii(i,c){if(Kn(i,c))return!0;if(typeof i!="object"||i===null||typeof c!="object"||c===null)return!1;var m=Object.keys(i),y=Object.keys(c);if(m.length!==y.length)return!1;for(y=0;y<m.length;y++){var j=m[y];if(!d.call(c,j)||!Kn(i[j],c[j]))return!1}return!0}function B0(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function U0(i,c){var m=B0(i);i=0;for(var y;m;){if(m.nodeType===3){if(y=i+m.textContent.length,i<=c&&y>=c)return{node:m,offset:c-i};i=y}e:{for(;m;){if(m.nextSibling){m=m.nextSibling;break e}m=m.parentNode}m=void 0}m=B0(m)}}function z0(i,c){return i&&c?i===c?!0:i&&i.nodeType===3?!1:c&&c.nodeType===3?z0(i,c.parentNode):"contains"in i?i.contains(c):i.compareDocumentPosition?!!(i.compareDocumentPosition(c)&16):!1:!1}function W0(){for(var i=window,c=de();c instanceof i.HTMLIFrameElement;){try{var m=typeof c.contentWindow.location.href=="string"}catch{m=!1}if(m)i=c.contentWindow;else break;c=de(i.document)}return c}function jh(i){var c=i&&i.nodeName&&i.nodeName.toLowerCase();return c&&(c==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||c==="textarea"||i.contentEditable==="true")}function DL(i){var c=W0(),m=i.focusedElem,y=i.selectionRange;if(c!==m&&m&&m.ownerDocument&&z0(m.ownerDocument.documentElement,m)){if(y!==null&&jh(m)){if(c=y.start,i=y.end,i===void 0&&(i=c),"selectionStart"in m)m.selectionStart=c,m.selectionEnd=Math.min(i,m.value.length);else if(i=(c=m.ownerDocument||document)&&c.defaultView||window,i.getSelection){i=i.getSelection();var j=m.textContent.length,C=Math.min(y.start,j);y=y.end===void 0?C:Math.min(y.end,j),!i.extend&&C>y&&(j=y,y=C,C=j),j=U0(m,C);var z=U0(m,y);j&&z&&(i.rangeCount!==1||i.anchorNode!==j.node||i.anchorOffset!==j.offset||i.focusNode!==z.node||i.focusOffset!==z.offset)&&(c=c.createRange(),c.setStart(j.node,j.offset),i.removeAllRanges(),C>y?(i.addRange(c),i.extend(z.node,z.offset)):(c.setEnd(z.node,z.offset),i.addRange(c)))}}for(c=[],i=m;i=i.parentNode;)i.nodeType===1&&c.push({element:i,left:i.scrollLeft,top:i.scrollTop});for(typeof m.focus=="function"&&m.focus(),m=0;m<c.length;m++)i=c[m],i.element.scrollLeft=i.left,i.element.scrollTop=i.top}}var FL=u&&"documentMode"in document&&11>=document.documentMode,oo=null,Sh=null,Oi=null,_h=!1;function H0(i,c,m){var y=m.window===m?m.document:m.nodeType===9?m:m.ownerDocument;_h||oo==null||oo!==de(y)||(y=oo,"selectionStart"in y&&jh(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}),Oi&&Ii(Oi,y)||(Oi=y,y=xc(Sh,"onSelect"),0<y.length&&(c=new so("onSelect","select",null,c,m),i.push({event:c,listeners:y}),c.target=oo)))}function yc(i,c){var m={};return m[i.toLowerCase()]=c.toLowerCase(),m["Webkit"+i]="webkit"+c,m["Moz"+i]="moz"+c,m}var io={animationend:yc("Animation","AnimationEnd"),animationiteration:yc("Animation","AnimationIteration"),animationstart:yc("Animation","AnimationStart"),transitionend:yc("Transition","TransitionEnd")},Eh={},V0={};u&&(V0=document.createElement("div").style,"AnimationEvent"in window||(delete io.animationend.animation,delete io.animationiteration.animation,delete io.animationstart.animation),"TransitionEvent"in window||delete io.transitionend.transition);function wc(i){if(Eh[i])return Eh[i];if(!io[i])return i;var c=io[i],m;for(m in c)if(c.hasOwnProperty(m)&&m in V0)return Eh[i]=c[m];return i}var G0=wc("animationend"),K0=wc("animationiteration"),Y0=wc("animationstart"),X0=wc("transitionend"),Z0=new Map,J0="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 _s(i,c){Z0.set(i,c),o(c,[i])}for(var Ch=0;Ch<J0.length;Ch++){var Th=J0[Ch],qL=Th.toLowerCase(),BL=Th[0].toUpperCase()+Th.slice(1);_s(qL,"on"+BL)}_s(G0,"onAnimationEnd"),_s(K0,"onAnimationIteration"),_s(Y0,"onAnimationStart"),_s("dblclick","onDoubleClick"),_s("focusin","onFocus"),_s("focusout","onBlur"),_s(X0,"onTransitionEnd"),l("onMouseEnter",["mouseout","mouseover"]),l("onMouseLeave",["mouseout","mouseover"]),l("onPointerEnter",["pointerout","pointerover"]),l("onPointerLeave",["pointerout","pointerover"]),o("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),o("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),o("onBeforeInput",["compositionend","keypress","textInput","paste"]),o("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),o("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),o("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Li="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(" "),UL=new Set("cancel close invalid load scroll toggle".split(" ").concat(Li));function Q0(i,c,m){var y=i.type||"unknown-event";i.currentTarget=m,ys(y,c,void 0,i),i.currentTarget=null}function ek(i,c){c=(c&4)!==0;for(var m=0;m<i.length;m++){var y=i[m],j=y.event;y=y.listeners;e:{var C=void 0;if(c)for(var z=y.length-1;0<=z;z--){var Q=y[z],te=Q.instance,ce=Q.currentTarget;if(Q=Q.listener,te!==C&&j.isPropagationStopped())break e;Q0(j,Q,ce),C=te}else for(z=0;z<y.length;z++){if(Q=y[z],te=Q.instance,ce=Q.currentTarget,Q=Q.listener,te!==C&&j.isPropagationStopped())break e;Q0(j,Q,ce),C=te}}}if(vt)throw i=yr,vt=!1,yr=null,i}function st(i,c){var m=c[Ph];m===void 0&&(m=c[Ph]=new Set);var y=i+"__bubble";m.has(y)||(tk(c,i,2,!1),m.add(y))}function Rh(i,c,m){var y=0;c&&(y|=4),tk(m,i,y,c)}var vc="_reactListening"+Math.random().toString(36).slice(2);function Pi(i){if(!i[vc]){i[vc]=!0,r.forEach(function(m){m!=="selectionchange"&&(UL.has(m)||Rh(m,!1,i),Rh(m,!0,i))});var c=i.nodeType===9?i:i.ownerDocument;c===null||c[vc]||(c[vc]=!0,Rh("selectionchange",!1,c))}}function tk(i,c,m,y){switch(to(c)){case 1:var j=_i;break;case 4:j=hc;break;default:j=Qa}m=j.bind(null,c,m,i),j=void 0,!Ur||c!=="touchstart"&&c!=="touchmove"&&c!=="wheel"||(j=!0),y?j!==void 0?i.addEventListener(c,m,{capture:!0,passive:j}):i.addEventListener(c,m,!0):j!==void 0?i.addEventListener(c,m,{passive:j}):i.addEventListener(c,m,!1)}function Ah(i,c,m,y,j){var C=y;if((c&1)===0&&(c&2)===0&&y!==null)e:for(;;){if(y===null)return;var z=y.tag;if(z===3||z===4){var Q=y.stateNode.containerInfo;if(Q===j||Q.nodeType===8&&Q.parentNode===j)break;if(z===4)for(z=y.return;z!==null;){var te=z.tag;if((te===3||te===4)&&(te=z.stateNode.containerInfo,te===j||te.nodeType===8&&te.parentNode===j))return;z=z.return}for(;Q!==null;){if(z=la(Q),z===null)return;if(te=z.tag,te===5||te===6){y=C=z;continue e}Q=Q.parentNode}}y=y.return}gr(function(){var ce=C,we=fn(m),ve=[];e:{var ye=Z0.get(i);if(ye!==void 0){var Ne=so,_e=i;switch(i){case"keypress":if(no(m)===0)break e;case"keydown":case"keyup":Ne=wL;break;case"focusin":_e="focus",Ne=vh;break;case"focusout":_e="blur",Ne=vh;break;case"beforeblur":case"afterblur":Ne=vh;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=E0;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Ne=oL;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Ne=bL;break;case G0:case K0:case Y0:Ne=cL;break;case X0:Ne=NL;break;case"scroll":Ne=pc;break;case"wheel":Ne=SL;break;case"copy":case"cut":case"paste":Ne=dL;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Ne=T0}var Ee=(c&4)!==0,wt=!Ee&&i==="scroll",oe=Ee?ye!==null?ye+"Capture":null:ye;Ee=[];for(var ne=ce,ie;ne!==null;){ie=ne;var be=ie.stateNode;if(ie.tag===5&&be!==null&&(ie=be,oe!==null&&(be=Nn(ne,oe),be!=null&&Ee.push(Di(ne,be,ie)))),wt)break;ne=ne.return}0<Ee.length&&(ye=new Ne(ye,_e,null,m,we),ve.push({event:ye,listeners:Ee}))}}if((c&7)===0){e:{if(ye=i==="mouseover"||i==="pointerover",Ne=i==="mouseout"||i==="pointerout",ye&&m!==Ot&&(_e=m.relatedTarget||m.fromElement)&&(la(_e)||_e[Zr]))break e;if((Ne||ye)&&(ye=we.window===we?we:(ye=we.ownerDocument)?ye.defaultView||ye.parentWindow:window,Ne?(_e=m.relatedTarget||m.toElement,Ne=ce,_e=_e?la(_e):null,_e!==null&&(wt=Jt(_e),_e!==wt||_e.tag!==5&&_e.tag!==6)&&(_e=null)):(Ne=null,_e=ce),Ne!==_e)){if(Ee=E0,be="onMouseLeave",oe="onMouseEnter",ne="mouse",(i==="pointerout"||i==="pointerover")&&(Ee=T0,be="onPointerLeave",oe="onPointerEnter",ne="pointer"),wt=Ne==null?ye:uo(Ne),ie=_e==null?ye:uo(_e),ye=new Ee(be,ne+"leave",Ne,m,we),ye.target=wt,ye.relatedTarget=ie,be=null,la(we)===ce&&(Ee=new Ee(oe,ne+"enter",_e,m,we),Ee.target=ie,Ee.relatedTarget=wt,be=Ee),wt=be,Ne&&_e)t:{for(Ee=Ne,oe=_e,ne=0,ie=Ee;ie;ie=lo(ie))ne++;for(ie=0,be=oe;be;be=lo(be))ie++;for(;0<ne-ie;)Ee=lo(Ee),ne--;for(;0<ie-ne;)oe=lo(oe),ie--;for(;ne--;){if(Ee===oe||oe!==null&&Ee===oe.alternate)break t;Ee=lo(Ee),oe=lo(oe)}Ee=null}else Ee=null;Ne!==null&&nk(ve,ye,Ne,Ee,!1),_e!==null&&wt!==null&&nk(ve,wt,_e,Ee,!0)}}e:{if(ye=ce?uo(ce):window,Ne=ye.nodeName&&ye.nodeName.toLowerCase(),Ne==="select"||Ne==="input"&&ye.type==="file")var Ce=ML;else if(O0(ye))if(P0)Ce=LL;else{Ce=IL;var Me=$L}else(Ne=ye.nodeName)&&Ne.toLowerCase()==="input"&&(ye.type==="checkbox"||ye.type==="radio")&&(Ce=OL);if(Ce&&(Ce=Ce(i,ce))){L0(ve,Ce,m,we);break e}Me&&Me(i,ye,ce),i==="focusout"&&(Me=ye._wrapperState)&&Me.controlled&&ye.type==="number"&&Te(ye,"number",ye.value)}switch(Me=ce?uo(ce):window,i){case"focusin":(O0(Me)||Me.contentEditable==="true")&&(oo=Me,Sh=ce,Oi=null);break;case"focusout":Oi=Sh=oo=null;break;case"mousedown":_h=!0;break;case"contextmenu":case"mouseup":case"dragend":_h=!1,H0(ve,m,we);break;case"selectionchange":if(FL)break;case"keydown":case"keyup":H0(ve,m,we)}var $e;if(bh)e:{switch(i){case"compositionstart":var Ie="onCompositionStart";break e;case"compositionend":Ie="onCompositionEnd";break e;case"compositionupdate":Ie="onCompositionUpdate";break e}Ie=void 0}else ao?$0(i,m)&&(Ie="onCompositionEnd"):i==="keydown"&&m.keyCode===229&&(Ie="onCompositionStart");Ie&&(R0&&m.locale!=="ko"&&(ao||Ie!=="onCompositionStart"?Ie==="onCompositionEnd"&&ao&&($e=fc()):(pn=we,Ci="value"in pn?pn.value:pn.textContent,ao=!0)),Me=xc(ce,Ie),0<Me.length&&(Ie=new C0(Ie,i,null,m,we),ve.push({event:Ie,listeners:Me}),$e?Ie.data=$e:($e=I0(m),$e!==null&&(Ie.data=$e)))),($e=EL?CL(i,m):TL(i,m))&&(ce=xc(ce,"onBeforeInput"),0<ce.length&&(we=new C0("onBeforeInput","beforeinput",null,m,we),ve.push({event:we,listeners:ce}),we.data=$e))}ek(ve,c)})}function Di(i,c,m){return{instance:i,listener:c,currentTarget:m}}function xc(i,c){for(var m=c+"Capture",y=[];i!==null;){var j=i,C=j.stateNode;j.tag===5&&C!==null&&(j=C,C=Nn(i,m),C!=null&&y.unshift(Di(i,C,j)),C=Nn(i,c),C!=null&&y.push(Di(i,C,j))),i=i.return}return y}function lo(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5);return i||null}function nk(i,c,m,y,j){for(var C=c._reactName,z=[];m!==null&&m!==y;){var Q=m,te=Q.alternate,ce=Q.stateNode;if(te!==null&&te===y)break;Q.tag===5&&ce!==null&&(Q=ce,j?(te=Nn(m,C),te!=null&&z.unshift(Di(m,te,Q))):j||(te=Nn(m,C),te!=null&&z.push(Di(m,te,Q)))),m=m.return}z.length!==0&&i.push({event:c,listeners:z})}var zL=/\r\n?/g,WL=/\u0000|\uFFFD/g;function rk(i){return(typeof i=="string"?i:""+i).replace(zL,`
|
|
38
|
+
`).replace(WL,"")}function bc(i,c,m){if(c=rk(c),rk(i)!==c&&m)throw Error(n(425))}function kc(){}var Mh=null,$h=null;function Ih(i,c){return i==="textarea"||i==="noscript"||typeof c.children=="string"||typeof c.children=="number"||typeof c.dangerouslySetInnerHTML=="object"&&c.dangerouslySetInnerHTML!==null&&c.dangerouslySetInnerHTML.__html!=null}var Oh=typeof setTimeout=="function"?setTimeout:void 0,HL=typeof clearTimeout=="function"?clearTimeout:void 0,sk=typeof Promise=="function"?Promise:void 0,VL=typeof queueMicrotask=="function"?queueMicrotask:typeof sk<"u"?function(i){return sk.resolve(null).then(i).catch(GL)}:Oh;function GL(i){setTimeout(function(){throw i})}function Lh(i,c){var m=c,y=0;do{var j=m.nextSibling;if(i.removeChild(m),j&&j.nodeType===8)if(m=j.data,m==="/$"){if(y===0){i.removeChild(j),js(c);return}y--}else m!=="$"&&m!=="$?"&&m!=="$!"||y++;m=j}while(m);js(c)}function Es(i){for(;i!=null;i=i.nextSibling){var c=i.nodeType;if(c===1||c===3)break;if(c===8){if(c=i.data,c==="$"||c==="$!"||c==="$?")break;if(c==="/$")return null}}return i}function ak(i){i=i.previousSibling;for(var c=0;i;){if(i.nodeType===8){var m=i.data;if(m==="$"||m==="$!"||m==="$?"){if(c===0)return i;c--}else m==="/$"&&c++}i=i.previousSibling}return null}var co=Math.random().toString(36).slice(2),_r="__reactFiber$"+co,Fi="__reactProps$"+co,Zr="__reactContainer$"+co,Ph="__reactEvents$"+co,KL="__reactListeners$"+co,YL="__reactHandles$"+co;function la(i){var c=i[_r];if(c)return c;for(var m=i.parentNode;m;){if(c=m[Zr]||m[_r]){if(m=c.alternate,c.child!==null||m!==null&&m.child!==null)for(i=ak(i);i!==null;){if(m=i[_r])return m;i=ak(i)}return c}i=m,m=i.parentNode}return null}function qi(i){return i=i[_r]||i[Zr],!i||i.tag!==5&&i.tag!==6&&i.tag!==13&&i.tag!==3?null:i}function uo(i){if(i.tag===5||i.tag===6)return i.stateNode;throw Error(n(33))}function Nc(i){return i[Fi]||null}var Dh=[],ho=-1;function Cs(i){return{current:i}}function at(i){0>ho||(i.current=Dh[ho],Dh[ho]=null,ho--)}function nt(i,c){ho++,Dh[ho]=i.current,i.current=c}var Ts={},Ut=Cs(Ts),nn=Cs(!1),ca=Ts;function fo(i,c){var m=i.type.contextTypes;if(!m)return Ts;var y=i.stateNode;if(y&&y.__reactInternalMemoizedUnmaskedChildContext===c)return y.__reactInternalMemoizedMaskedChildContext;var j={},C;for(C in m)j[C]=c[C];return y&&(i=i.stateNode,i.__reactInternalMemoizedUnmaskedChildContext=c,i.__reactInternalMemoizedMaskedChildContext=j),j}function rn(i){return i=i.childContextTypes,i!=null}function jc(){at(nn),at(Ut)}function ok(i,c,m){if(Ut.current!==Ts)throw Error(n(168));nt(Ut,c),nt(nn,m)}function ik(i,c,m){var y=i.stateNode;if(c=c.childContextTypes,typeof y.getChildContext!="function")return m;y=y.getChildContext();for(var j in y)if(!(j in c))throw Error(n(108,Z(i)||"Unknown",j));return W({},m,y)}function Sc(i){return i=(i=i.stateNode)&&i.__reactInternalMemoizedMergedChildContext||Ts,ca=Ut.current,nt(Ut,i),nt(nn,nn.current),!0}function lk(i,c,m){var y=i.stateNode;if(!y)throw Error(n(169));m?(i=ik(i,c,ca),y.__reactInternalMemoizedMergedChildContext=i,at(nn),at(Ut),nt(Ut,i)):at(nn),nt(nn,m)}var Jr=null,_c=!1,Fh=!1;function ck(i){Jr===null?Jr=[i]:Jr.push(i)}function XL(i){_c=!0,ck(i)}function Rs(){if(!Fh&&Jr!==null){Fh=!0;var i=0,c=Ve;try{var m=Jr;for(Ve=1;i<m.length;i++){var y=m[i];do y=y(!0);while(y!==null)}Jr=null,_c=!1}catch(j){throw Jr!==null&&(Jr=Jr.slice(i+1)),xr(br,Rs),j}finally{Ve=c,Fh=!1}}return null}var po=[],mo=0,Ec=null,Cc=0,Cn=[],Tn=0,ua=null,Qr=1,es="";function da(i,c){po[mo++]=Cc,po[mo++]=Ec,Ec=i,Cc=c}function uk(i,c,m){Cn[Tn++]=Qr,Cn[Tn++]=es,Cn[Tn++]=ua,ua=i;var y=Qr;i=es;var j=32-tn(y)-1;y&=~(1<<j),m+=1;var C=32-tn(c)+j;if(30<C){var z=j-j%5;C=(y&(1<<z)-1).toString(32),y>>=z,j-=z,Qr=1<<32-tn(c)+j|m<<j|y,es=C+i}else Qr=1<<C|m<<j|y,es=i}function qh(i){i.return!==null&&(da(i,1),uk(i,1,0))}function Bh(i){for(;i===Ec;)Ec=po[--mo],po[mo]=null,Cc=po[--mo],po[mo]=null;for(;i===ua;)ua=Cn[--Tn],Cn[Tn]=null,es=Cn[--Tn],Cn[Tn]=null,Qr=Cn[--Tn],Cn[Tn]=null}var mn=null,gn=null,ct=!1,Yn=null;function dk(i,c){var m=$n(5,null,null,0);m.elementType="DELETED",m.stateNode=c,m.return=i,c=i.deletions,c===null?(i.deletions=[m],i.flags|=16):c.push(m)}function hk(i,c){switch(i.tag){case 5:var m=i.type;return c=c.nodeType!==1||m.toLowerCase()!==c.nodeName.toLowerCase()?null:c,c!==null?(i.stateNode=c,mn=i,gn=Es(c.firstChild),!0):!1;case 6:return c=i.pendingProps===""||c.nodeType!==3?null:c,c!==null?(i.stateNode=c,mn=i,gn=null,!0):!1;case 13:return c=c.nodeType!==8?null:c,c!==null?(m=ua!==null?{id:Qr,overflow:es}:null,i.memoizedState={dehydrated:c,treeContext:m,retryLane:1073741824},m=$n(18,null,null,0),m.stateNode=c,m.return=i,i.child=m,mn=i,gn=null,!0):!1;default:return!1}}function Uh(i){return(i.mode&1)!==0&&(i.flags&128)===0}function zh(i){if(ct){var c=gn;if(c){var m=c;if(!hk(i,c)){if(Uh(i))throw Error(n(418));c=Es(m.nextSibling);var y=mn;c&&hk(i,c)?dk(y,m):(i.flags=i.flags&-4097|2,ct=!1,mn=i)}}else{if(Uh(i))throw Error(n(418));i.flags=i.flags&-4097|2,ct=!1,mn=i}}}function fk(i){for(i=i.return;i!==null&&i.tag!==5&&i.tag!==3&&i.tag!==13;)i=i.return;mn=i}function Tc(i){if(i!==mn)return!1;if(!ct)return fk(i),ct=!0,!1;var c;if((c=i.tag!==3)&&!(c=i.tag!==5)&&(c=i.type,c=c!=="head"&&c!=="body"&&!Ih(i.type,i.memoizedProps)),c&&(c=gn)){if(Uh(i))throw pk(),Error(n(418));for(;c;)dk(i,c),c=Es(c.nextSibling)}if(fk(i),i.tag===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(n(317));e:{for(i=i.nextSibling,c=0;i;){if(i.nodeType===8){var m=i.data;if(m==="/$"){if(c===0){gn=Es(i.nextSibling);break e}c--}else m!=="$"&&m!=="$!"&&m!=="$?"||c++}i=i.nextSibling}gn=null}}else gn=mn?Es(i.stateNode.nextSibling):null;return!0}function pk(){for(var i=gn;i;)i=Es(i.nextSibling)}function go(){gn=mn=null,ct=!1}function Wh(i){Yn===null?Yn=[i]:Yn.push(i)}var ZL=E.ReactCurrentBatchConfig;function Bi(i,c,m){if(i=m.ref,i!==null&&typeof i!="function"&&typeof i!="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,i));var j=y,C=""+i;return c!==null&&c.ref!==null&&typeof c.ref=="function"&&c.ref._stringRef===C?c.ref:(c=function(z){var Q=j.refs;z===null?delete Q[C]:Q[C]=z},c._stringRef=C,c)}if(typeof i!="string")throw Error(n(284));if(!m._owner)throw Error(n(290,i))}return i}function Rc(i,c){throw i=Object.prototype.toString.call(c),Error(n(31,i==="[object Object]"?"object with keys {"+Object.keys(c).join(", ")+"}":i))}function mk(i){var c=i._init;return c(i._payload)}function gk(i){function c(oe,ne){if(i){var ie=oe.deletions;ie===null?(oe.deletions=[ne],oe.flags|=16):ie.push(ne)}}function m(oe,ne){if(!i)return null;for(;ne!==null;)c(oe,ne),ne=ne.sibling;return null}function y(oe,ne){for(oe=new Map;ne!==null;)ne.key!==null?oe.set(ne.key,ne):oe.set(ne.index,ne),ne=ne.sibling;return oe}function j(oe,ne){return oe=Ds(oe,ne),oe.index=0,oe.sibling=null,oe}function C(oe,ne,ie){return oe.index=ie,i?(ie=oe.alternate,ie!==null?(ie=ie.index,ie<ne?(oe.flags|=2,ne):ie):(oe.flags|=2,ne)):(oe.flags|=1048576,ne)}function z(oe){return i&&oe.alternate===null&&(oe.flags|=2),oe}function Q(oe,ne,ie,be){return ne===null||ne.tag!==6?(ne=Lf(ie,oe.mode,be),ne.return=oe,ne):(ne=j(ne,ie),ne.return=oe,ne)}function te(oe,ne,ie,be){var Ce=ie.type;return Ce===A?we(oe,ne,ie.props.children,be,ie.key):ne!==null&&(ne.elementType===Ce||typeof Ce=="object"&&Ce!==null&&Ce.$$typeof===B&&mk(Ce)===ne.type)?(be=j(ne,ie.props),be.ref=Bi(oe,ne,ie),be.return=oe,be):(be=eu(ie.type,ie.key,ie.props,null,oe.mode,be),be.ref=Bi(oe,ne,ie),be.return=oe,be)}function ce(oe,ne,ie,be){return ne===null||ne.tag!==4||ne.stateNode.containerInfo!==ie.containerInfo||ne.stateNode.implementation!==ie.implementation?(ne=Pf(ie,oe.mode,be),ne.return=oe,ne):(ne=j(ne,ie.children||[]),ne.return=oe,ne)}function we(oe,ne,ie,be,Ce){return ne===null||ne.tag!==7?(ne=va(ie,oe.mode,be,Ce),ne.return=oe,ne):(ne=j(ne,ie),ne.return=oe,ne)}function ve(oe,ne,ie){if(typeof ne=="string"&&ne!==""||typeof ne=="number")return ne=Lf(""+ne,oe.mode,ie),ne.return=oe,ne;if(typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case T:return ie=eu(ne.type,ne.key,ne.props,null,oe.mode,ie),ie.ref=Bi(oe,null,ne),ie.return=oe,ie;case R:return ne=Pf(ne,oe.mode,ie),ne.return=oe,ne;case B:var be=ne._init;return ve(oe,be(ne._payload),ie)}if(Fe(ne)||F(ne))return ne=va(ne,oe.mode,ie,null),ne.return=oe,ne;Rc(oe,ne)}return null}function ye(oe,ne,ie,be){var Ce=ne!==null?ne.key:null;if(typeof ie=="string"&&ie!==""||typeof ie=="number")return Ce!==null?null:Q(oe,ne,""+ie,be);if(typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case T:return ie.key===Ce?te(oe,ne,ie,be):null;case R:return ie.key===Ce?ce(oe,ne,ie,be):null;case B:return Ce=ie._init,ye(oe,ne,Ce(ie._payload),be)}if(Fe(ie)||F(ie))return Ce!==null?null:we(oe,ne,ie,be,null);Rc(oe,ie)}return null}function Ne(oe,ne,ie,be,Ce){if(typeof be=="string"&&be!==""||typeof be=="number")return oe=oe.get(ie)||null,Q(ne,oe,""+be,Ce);if(typeof be=="object"&&be!==null){switch(be.$$typeof){case T:return oe=oe.get(be.key===null?ie:be.key)||null,te(ne,oe,be,Ce);case R:return oe=oe.get(be.key===null?ie:be.key)||null,ce(ne,oe,be,Ce);case B:var Me=be._init;return Ne(oe,ne,ie,Me(be._payload),Ce)}if(Fe(be)||F(be))return oe=oe.get(ie)||null,we(ne,oe,be,Ce,null);Rc(ne,be)}return null}function _e(oe,ne,ie,be){for(var Ce=null,Me=null,$e=ne,Ie=ne=0,Mt=null;$e!==null&&Ie<ie.length;Ie++){$e.index>Ie?(Mt=$e,$e=null):Mt=$e.sibling;var Ge=ye(oe,$e,ie[Ie],be);if(Ge===null){$e===null&&($e=Mt);break}i&&$e&&Ge.alternate===null&&c(oe,$e),ne=C(Ge,ne,Ie),Me===null?Ce=Ge:Me.sibling=Ge,Me=Ge,$e=Mt}if(Ie===ie.length)return m(oe,$e),ct&&da(oe,Ie),Ce;if($e===null){for(;Ie<ie.length;Ie++)$e=ve(oe,ie[Ie],be),$e!==null&&(ne=C($e,ne,Ie),Me===null?Ce=$e:Me.sibling=$e,Me=$e);return ct&&da(oe,Ie),Ce}for($e=y(oe,$e);Ie<ie.length;Ie++)Mt=Ne($e,oe,Ie,ie[Ie],be),Mt!==null&&(i&&Mt.alternate!==null&&$e.delete(Mt.key===null?Ie:Mt.key),ne=C(Mt,ne,Ie),Me===null?Ce=Mt:Me.sibling=Mt,Me=Mt);return i&&$e.forEach(function(Fs){return c(oe,Fs)}),ct&&da(oe,Ie),Ce}function Ee(oe,ne,ie,be){var Ce=F(ie);if(typeof Ce!="function")throw Error(n(150));if(ie=Ce.call(ie),ie==null)throw Error(n(151));for(var Me=Ce=null,$e=ne,Ie=ne=0,Mt=null,Ge=ie.next();$e!==null&&!Ge.done;Ie++,Ge=ie.next()){$e.index>Ie?(Mt=$e,$e=null):Mt=$e.sibling;var Fs=ye(oe,$e,Ge.value,be);if(Fs===null){$e===null&&($e=Mt);break}i&&$e&&Fs.alternate===null&&c(oe,$e),ne=C(Fs,ne,Ie),Me===null?Ce=Fs:Me.sibling=Fs,Me=Fs,$e=Mt}if(Ge.done)return m(oe,$e),ct&&da(oe,Ie),Ce;if($e===null){for(;!Ge.done;Ie++,Ge=ie.next())Ge=ve(oe,Ge.value,be),Ge!==null&&(ne=C(Ge,ne,Ie),Me===null?Ce=Ge:Me.sibling=Ge,Me=Ge);return ct&&da(oe,Ie),Ce}for($e=y(oe,$e);!Ge.done;Ie++,Ge=ie.next())Ge=Ne($e,oe,Ie,Ge.value,be),Ge!==null&&(i&&Ge.alternate!==null&&$e.delete(Ge.key===null?Ie:Ge.key),ne=C(Ge,ne,Ie),Me===null?Ce=Ge:Me.sibling=Ge,Me=Ge);return i&&$e.forEach(function(R3){return c(oe,R3)}),ct&&da(oe,Ie),Ce}function wt(oe,ne,ie,be){if(typeof ie=="object"&&ie!==null&&ie.type===A&&ie.key===null&&(ie=ie.props.children),typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case T:e:{for(var Ce=ie.key,Me=ne;Me!==null;){if(Me.key===Ce){if(Ce=ie.type,Ce===A){if(Me.tag===7){m(oe,Me.sibling),ne=j(Me,ie.props.children),ne.return=oe,oe=ne;break e}}else if(Me.elementType===Ce||typeof Ce=="object"&&Ce!==null&&Ce.$$typeof===B&&mk(Ce)===Me.type){m(oe,Me.sibling),ne=j(Me,ie.props),ne.ref=Bi(oe,Me,ie),ne.return=oe,oe=ne;break e}m(oe,Me);break}else c(oe,Me);Me=Me.sibling}ie.type===A?(ne=va(ie.props.children,oe.mode,be,ie.key),ne.return=oe,oe=ne):(be=eu(ie.type,ie.key,ie.props,null,oe.mode,be),be.ref=Bi(oe,ne,ie),be.return=oe,oe=be)}return z(oe);case R:e:{for(Me=ie.key;ne!==null;){if(ne.key===Me)if(ne.tag===4&&ne.stateNode.containerInfo===ie.containerInfo&&ne.stateNode.implementation===ie.implementation){m(oe,ne.sibling),ne=j(ne,ie.children||[]),ne.return=oe,oe=ne;break e}else{m(oe,ne);break}else c(oe,ne);ne=ne.sibling}ne=Pf(ie,oe.mode,be),ne.return=oe,oe=ne}return z(oe);case B:return Me=ie._init,wt(oe,ne,Me(ie._payload),be)}if(Fe(ie))return _e(oe,ne,ie,be);if(F(ie))return Ee(oe,ne,ie,be);Rc(oe,ie)}return typeof ie=="string"&&ie!==""||typeof ie=="number"?(ie=""+ie,ne!==null&&ne.tag===6?(m(oe,ne.sibling),ne=j(ne,ie),ne.return=oe,oe=ne):(m(oe,ne),ne=Lf(ie,oe.mode,be),ne.return=oe,oe=ne),z(oe)):m(oe,ne)}return wt}var yo=gk(!0),yk=gk(!1),Ac=Cs(null),Mc=null,wo=null,Hh=null;function Vh(){Hh=wo=Mc=null}function Gh(i){var c=Ac.current;at(Ac),i._currentValue=c}function Kh(i,c,m){for(;i!==null;){var y=i.alternate;if((i.childLanes&c)!==c?(i.childLanes|=c,y!==null&&(y.childLanes|=c)):y!==null&&(y.childLanes&c)!==c&&(y.childLanes|=c),i===m)break;i=i.return}}function vo(i,c){Mc=i,Hh=wo=null,i=i.dependencies,i!==null&&i.firstContext!==null&&((i.lanes&c)!==0&&(sn=!0),i.firstContext=null)}function Rn(i){var c=i._currentValue;if(Hh!==i)if(i={context:i,memoizedValue:c,next:null},wo===null){if(Mc===null)throw Error(n(308));wo=i,Mc.dependencies={lanes:0,firstContext:i}}else wo=wo.next=i;return c}var ha=null;function Yh(i){ha===null?ha=[i]:ha.push(i)}function wk(i,c,m,y){var j=c.interleaved;return j===null?(m.next=m,Yh(c)):(m.next=j.next,j.next=m),c.interleaved=m,ts(i,y)}function ts(i,c){i.lanes|=c;var m=i.alternate;for(m!==null&&(m.lanes|=c),m=i,i=i.return;i!==null;)i.childLanes|=c,m=i.alternate,m!==null&&(m.childLanes|=c),m=i,i=i.return;return m.tag===3?m.stateNode:null}var As=!1;function Xh(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function vk(i,c){i=i.updateQueue,c.updateQueue===i&&(c.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,effects:i.effects})}function ns(i,c){return{eventTime:i,lane:c,tag:0,payload:null,callback:null,next:null}}function Ms(i,c,m){var y=i.updateQueue;if(y===null)return null;if(y=y.shared,(ze&2)!==0){var j=y.pending;return j===null?c.next=c:(c.next=j.next,j.next=c),y.pending=c,ts(i,m)}return j=y.interleaved,j===null?(c.next=c,Yh(y)):(c.next=j.next,j.next=c),y.interleaved=c,ts(i,m)}function $c(i,c,m){if(c=c.updateQueue,c!==null&&(c=c.shared,(m&4194240)!==0)){var y=c.lanes;y&=i.pendingLanes,m|=y,c.lanes=m,Ka(i,m)}}function xk(i,c){var m=i.updateQueue,y=i.alternate;if(y!==null&&(y=y.updateQueue,m===y)){var j=null,C=null;if(m=m.firstBaseUpdate,m!==null){do{var z={eventTime:m.eventTime,lane:m.lane,tag:m.tag,payload:m.payload,callback:m.callback,next:null};C===null?j=C=z:C=C.next=z,m=m.next}while(m!==null);C===null?j=C=c:C=C.next=c}else j=C=c;m={baseState:y.baseState,firstBaseUpdate:j,lastBaseUpdate:C,shared:y.shared,effects:y.effects},i.updateQueue=m;return}i=m.lastBaseUpdate,i===null?m.firstBaseUpdate=c:i.next=c,m.lastBaseUpdate=c}function Ic(i,c,m,y){var j=i.updateQueue;As=!1;var C=j.firstBaseUpdate,z=j.lastBaseUpdate,Q=j.shared.pending;if(Q!==null){j.shared.pending=null;var te=Q,ce=te.next;te.next=null,z===null?C=ce:z.next=ce,z=te;var we=i.alternate;we!==null&&(we=we.updateQueue,Q=we.lastBaseUpdate,Q!==z&&(Q===null?we.firstBaseUpdate=ce:Q.next=ce,we.lastBaseUpdate=te))}if(C!==null){var ve=j.baseState;z=0,we=ce=te=null,Q=C;do{var ye=Q.lane,Ne=Q.eventTime;if((y&ye)===ye){we!==null&&(we=we.next={eventTime:Ne,lane:0,tag:Q.tag,payload:Q.payload,callback:Q.callback,next:null});e:{var _e=i,Ee=Q;switch(ye=c,Ne=m,Ee.tag){case 1:if(_e=Ee.payload,typeof _e=="function"){ve=_e.call(Ne,ve,ye);break e}ve=_e;break e;case 3:_e.flags=_e.flags&-65537|128;case 0:if(_e=Ee.payload,ye=typeof _e=="function"?_e.call(Ne,ve,ye):_e,ye==null)break e;ve=W({},ve,ye);break e;case 2:As=!0}}Q.callback!==null&&Q.lane!==0&&(i.flags|=64,ye=j.effects,ye===null?j.effects=[Q]:ye.push(Q))}else Ne={eventTime:Ne,lane:ye,tag:Q.tag,payload:Q.payload,callback:Q.callback,next:null},we===null?(ce=we=Ne,te=ve):we=we.next=Ne,z|=ye;if(Q=Q.next,Q===null){if(Q=j.shared.pending,Q===null)break;ye=Q,Q=ye.next,ye.next=null,j.lastBaseUpdate=ye,j.shared.pending=null}}while(!0);if(we===null&&(te=ve),j.baseState=te,j.firstBaseUpdate=ce,j.lastBaseUpdate=we,c=j.shared.interleaved,c!==null){j=c;do z|=j.lane,j=j.next;while(j!==c)}else C===null&&(j.shared.lanes=0);ma|=z,i.lanes=z,i.memoizedState=ve}}function bk(i,c,m){if(i=c.effects,c.effects=null,i!==null)for(c=0;c<i.length;c++){var y=i[c],j=y.callback;if(j!==null){if(y.callback=null,y=m,typeof j!="function")throw Error(n(191,j));j.call(y)}}}var Ui={},Er=Cs(Ui),zi=Cs(Ui),Wi=Cs(Ui);function fa(i){if(i===Ui)throw Error(n(174));return i}function Zh(i,c){switch(nt(Wi,c),nt(zi,i),nt(Er,Ui),i=c.nodeType,i){case 9:case 11:c=(c=c.documentElement)?c.namespaceURI:et(null,"");break;default:i=i===8?c.parentNode:c,c=i.namespaceURI||null,i=i.tagName,c=et(c,i)}at(Er),nt(Er,c)}function xo(){at(Er),at(zi),at(Wi)}function kk(i){fa(Wi.current);var c=fa(Er.current),m=et(c,i.type);c!==m&&(nt(zi,i),nt(Er,m))}function Jh(i){zi.current===i&&(at(Er),at(zi))}var dt=Cs(0);function Oc(i){for(var c=i;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===i)break;for(;c.sibling===null;){if(c.return===null||c.return===i)return null;c=c.return}c.sibling.return=c.return,c=c.sibling}return null}var Qh=[];function ef(){for(var i=0;i<Qh.length;i++)Qh[i]._workInProgressVersionPrimary=null;Qh.length=0}var Lc=E.ReactCurrentDispatcher,tf=E.ReactCurrentBatchConfig,pa=0,ht=null,jt=null,Rt=null,Pc=!1,Hi=!1,Vi=0,JL=0;function zt(){throw Error(n(321))}function nf(i,c){if(c===null)return!1;for(var m=0;m<c.length&&m<i.length;m++)if(!Kn(i[m],c[m]))return!1;return!0}function rf(i,c,m,y,j,C){if(pa=C,ht=c,c.memoizedState=null,c.updateQueue=null,c.lanes=0,Lc.current=i===null||i.memoizedState===null?n3:r3,i=m(y,j),Hi){C=0;do{if(Hi=!1,Vi=0,25<=C)throw Error(n(301));C+=1,Rt=jt=null,c.updateQueue=null,Lc.current=s3,i=m(y,j)}while(Hi)}if(Lc.current=qc,c=jt!==null&&jt.next!==null,pa=0,Rt=jt=ht=null,Pc=!1,c)throw Error(n(300));return i}function sf(){var i=Vi!==0;return Vi=0,i}function Cr(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Rt===null?ht.memoizedState=Rt=i:Rt=Rt.next=i,Rt}function An(){if(jt===null){var i=ht.alternate;i=i!==null?i.memoizedState:null}else i=jt.next;var c=Rt===null?ht.memoizedState:Rt.next;if(c!==null)Rt=c,jt=i;else{if(i===null)throw Error(n(310));jt=i,i={memoizedState:jt.memoizedState,baseState:jt.baseState,baseQueue:jt.baseQueue,queue:jt.queue,next:null},Rt===null?ht.memoizedState=Rt=i:Rt=Rt.next=i}return Rt}function Gi(i,c){return typeof c=="function"?c(i):c}function af(i){var c=An(),m=c.queue;if(m===null)throw Error(n(311));m.lastRenderedReducer=i;var y=jt,j=y.baseQueue,C=m.pending;if(C!==null){if(j!==null){var z=j.next;j.next=C.next,C.next=z}y.baseQueue=j=C,m.pending=null}if(j!==null){C=j.next,y=y.baseState;var Q=z=null,te=null,ce=C;do{var we=ce.lane;if((pa&we)===we)te!==null&&(te=te.next={lane:0,action:ce.action,hasEagerState:ce.hasEagerState,eagerState:ce.eagerState,next:null}),y=ce.hasEagerState?ce.eagerState:i(y,ce.action);else{var ve={lane:we,action:ce.action,hasEagerState:ce.hasEagerState,eagerState:ce.eagerState,next:null};te===null?(Q=te=ve,z=y):te=te.next=ve,ht.lanes|=we,ma|=we}ce=ce.next}while(ce!==null&&ce!==C);te===null?z=y:te.next=Q,Kn(y,c.memoizedState)||(sn=!0),c.memoizedState=y,c.baseState=z,c.baseQueue=te,m.lastRenderedState=y}if(i=m.interleaved,i!==null){j=i;do C=j.lane,ht.lanes|=C,ma|=C,j=j.next;while(j!==i)}else j===null&&(m.lanes=0);return[c.memoizedState,m.dispatch]}function of(i){var c=An(),m=c.queue;if(m===null)throw Error(n(311));m.lastRenderedReducer=i;var y=m.dispatch,j=m.pending,C=c.memoizedState;if(j!==null){m.pending=null;var z=j=j.next;do C=i(C,z.action),z=z.next;while(z!==j);Kn(C,c.memoizedState)||(sn=!0),c.memoizedState=C,c.baseQueue===null&&(c.baseState=C),m.lastRenderedState=C}return[C,y]}function Nk(){}function jk(i,c){var m=ht,y=An(),j=c(),C=!Kn(y.memoizedState,j);if(C&&(y.memoizedState=j,sn=!0),y=y.queue,lf(Ek.bind(null,m,y,i),[i]),y.getSnapshot!==c||C||Rt!==null&&Rt.memoizedState.tag&1){if(m.flags|=2048,Ki(9,_k.bind(null,m,y,j,c),void 0,null),At===null)throw Error(n(349));(pa&30)!==0||Sk(m,c,j)}return j}function Sk(i,c,m){i.flags|=16384,i={getSnapshot:c,value:m},c=ht.updateQueue,c===null?(c={lastEffect:null,stores:null},ht.updateQueue=c,c.stores=[i]):(m=c.stores,m===null?c.stores=[i]:m.push(i))}function _k(i,c,m,y){c.value=m,c.getSnapshot=y,Ck(c)&&Tk(i)}function Ek(i,c,m){return m(function(){Ck(c)&&Tk(i)})}function Ck(i){var c=i.getSnapshot;i=i.value;try{var m=c();return!Kn(i,m)}catch{return!0}}function Tk(i){var c=ts(i,1);c!==null&&Qn(c,i,1,-1)}function Rk(i){var c=Cr();return typeof i=="function"&&(i=i()),c.memoizedState=c.baseState=i,i={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Gi,lastRenderedState:i},c.queue=i,i=i.dispatch=t3.bind(null,ht,i),[c.memoizedState,i]}function Ki(i,c,m,y){return i={tag:i,create:c,destroy:m,deps:y,next:null},c=ht.updateQueue,c===null?(c={lastEffect:null,stores:null},ht.updateQueue=c,c.lastEffect=i.next=i):(m=c.lastEffect,m===null?c.lastEffect=i.next=i:(y=m.next,m.next=i,i.next=y,c.lastEffect=i)),i}function Ak(){return An().memoizedState}function Dc(i,c,m,y){var j=Cr();ht.flags|=i,j.memoizedState=Ki(1|c,m,void 0,y===void 0?null:y)}function Fc(i,c,m,y){var j=An();y=y===void 0?null:y;var C=void 0;if(jt!==null){var z=jt.memoizedState;if(C=z.destroy,y!==null&&nf(y,z.deps)){j.memoizedState=Ki(c,m,C,y);return}}ht.flags|=i,j.memoizedState=Ki(1|c,m,C,y)}function Mk(i,c){return Dc(8390656,8,i,c)}function lf(i,c){return Fc(2048,8,i,c)}function $k(i,c){return Fc(4,2,i,c)}function Ik(i,c){return Fc(4,4,i,c)}function Ok(i,c){if(typeof c=="function")return i=i(),c(i),function(){c(null)};if(c!=null)return i=i(),c.current=i,function(){c.current=null}}function Lk(i,c,m){return m=m!=null?m.concat([i]):null,Fc(4,4,Ok.bind(null,c,i),m)}function cf(){}function Pk(i,c){var m=An();c=c===void 0?null:c;var y=m.memoizedState;return y!==null&&c!==null&&nf(c,y[1])?y[0]:(m.memoizedState=[i,c],i)}function Dk(i,c){var m=An();c=c===void 0?null:c;var y=m.memoizedState;return y!==null&&c!==null&&nf(c,y[1])?y[0]:(i=i(),m.memoizedState=[i,c],i)}function Fk(i,c,m){return(pa&21)===0?(i.baseState&&(i.baseState=!1,sn=!0),i.memoizedState=m):(Kn(m,c)||(m=ac(),ht.lanes|=m,ma|=m,i.baseState=!0),c)}function QL(i,c){var m=Ve;Ve=m!==0&&4>m?m:4,i(!0);var y=tf.transition;tf.transition={};try{i(!1),c()}finally{Ve=m,tf.transition=y}}function qk(){return An().memoizedState}function e3(i,c,m){var y=Ls(i);if(m={lane:y,action:m,hasEagerState:!1,eagerState:null,next:null},Bk(i))Uk(c,m);else if(m=wk(i,c,m,y),m!==null){var j=Yt();Qn(m,i,y,j),zk(m,c,y)}}function t3(i,c,m){var y=Ls(i),j={lane:y,action:m,hasEagerState:!1,eagerState:null,next:null};if(Bk(i))Uk(c,j);else{var C=i.alternate;if(i.lanes===0&&(C===null||C.lanes===0)&&(C=c.lastRenderedReducer,C!==null))try{var z=c.lastRenderedState,Q=C(z,m);if(j.hasEagerState=!0,j.eagerState=Q,Kn(Q,z)){var te=c.interleaved;te===null?(j.next=j,Yh(c)):(j.next=te.next,te.next=j),c.interleaved=j;return}}catch{}finally{}m=wk(i,c,j,y),m!==null&&(j=Yt(),Qn(m,i,y,j),zk(m,c,y))}}function Bk(i){var c=i.alternate;return i===ht||c!==null&&c===ht}function Uk(i,c){Hi=Pc=!0;var m=i.pending;m===null?c.next=c:(c.next=m.next,m.next=c),i.pending=c}function zk(i,c,m){if((m&4194240)!==0){var y=c.lanes;y&=i.pendingLanes,m|=y,c.lanes=m,Ka(i,m)}}var qc={readContext:Rn,useCallback:zt,useContext:zt,useEffect:zt,useImperativeHandle:zt,useInsertionEffect:zt,useLayoutEffect:zt,useMemo:zt,useReducer:zt,useRef:zt,useState:zt,useDebugValue:zt,useDeferredValue:zt,useTransition:zt,useMutableSource:zt,useSyncExternalStore:zt,useId:zt,unstable_isNewReconciler:!1},n3={readContext:Rn,useCallback:function(i,c){return Cr().memoizedState=[i,c===void 0?null:c],i},useContext:Rn,useEffect:Mk,useImperativeHandle:function(i,c,m){return m=m!=null?m.concat([i]):null,Dc(4194308,4,Ok.bind(null,c,i),m)},useLayoutEffect:function(i,c){return Dc(4194308,4,i,c)},useInsertionEffect:function(i,c){return Dc(4,2,i,c)},useMemo:function(i,c){var m=Cr();return c=c===void 0?null:c,i=i(),m.memoizedState=[i,c],i},useReducer:function(i,c,m){var y=Cr();return c=m!==void 0?m(c):c,y.memoizedState=y.baseState=c,i={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:c},y.queue=i,i=i.dispatch=e3.bind(null,ht,i),[y.memoizedState,i]},useRef:function(i){var c=Cr();return i={current:i},c.memoizedState=i},useState:Rk,useDebugValue:cf,useDeferredValue:function(i){return Cr().memoizedState=i},useTransition:function(){var i=Rk(!1),c=i[0];return i=QL.bind(null,i[1]),Cr().memoizedState=i,[c,i]},useMutableSource:function(){},useSyncExternalStore:function(i,c,m){var y=ht,j=Cr();if(ct){if(m===void 0)throw Error(n(407));m=m()}else{if(m=c(),At===null)throw Error(n(349));(pa&30)!==0||Sk(y,c,m)}j.memoizedState=m;var C={value:m,getSnapshot:c};return j.queue=C,Mk(Ek.bind(null,y,C,i),[i]),y.flags|=2048,Ki(9,_k.bind(null,y,C,m,c),void 0,null),m},useId:function(){var i=Cr(),c=At.identifierPrefix;if(ct){var m=es,y=Qr;m=(y&~(1<<32-tn(y)-1)).toString(32)+m,c=":"+c+"R"+m,m=Vi++,0<m&&(c+="H"+m.toString(32)),c+=":"}else m=JL++,c=":"+c+"r"+m.toString(32)+":";return i.memoizedState=c},unstable_isNewReconciler:!1},r3={readContext:Rn,useCallback:Pk,useContext:Rn,useEffect:lf,useImperativeHandle:Lk,useInsertionEffect:$k,useLayoutEffect:Ik,useMemo:Dk,useReducer:af,useRef:Ak,useState:function(){return af(Gi)},useDebugValue:cf,useDeferredValue:function(i){var c=An();return Fk(c,jt.memoizedState,i)},useTransition:function(){var i=af(Gi)[0],c=An().memoizedState;return[i,c]},useMutableSource:Nk,useSyncExternalStore:jk,useId:qk,unstable_isNewReconciler:!1},s3={readContext:Rn,useCallback:Pk,useContext:Rn,useEffect:lf,useImperativeHandle:Lk,useInsertionEffect:$k,useLayoutEffect:Ik,useMemo:Dk,useReducer:of,useRef:Ak,useState:function(){return of(Gi)},useDebugValue:cf,useDeferredValue:function(i){var c=An();return jt===null?c.memoizedState=i:Fk(c,jt.memoizedState,i)},useTransition:function(){var i=of(Gi)[0],c=An().memoizedState;return[i,c]},useMutableSource:Nk,useSyncExternalStore:jk,useId:qk,unstable_isNewReconciler:!1};function Xn(i,c){if(i&&i.defaultProps){c=W({},c),i=i.defaultProps;for(var m in i)c[m]===void 0&&(c[m]=i[m]);return c}return c}function uf(i,c,m,y){c=i.memoizedState,m=m(y,c),m=m==null?c:W({},c,m),i.memoizedState=m,i.lanes===0&&(i.updateQueue.baseState=m)}var Bc={isMounted:function(i){return(i=i._reactInternals)?Jt(i)===i:!1},enqueueSetState:function(i,c,m){i=i._reactInternals;var y=Yt(),j=Ls(i),C=ns(y,j);C.payload=c,m!=null&&(C.callback=m),c=Ms(i,C,j),c!==null&&(Qn(c,i,j,y),$c(c,i,j))},enqueueReplaceState:function(i,c,m){i=i._reactInternals;var y=Yt(),j=Ls(i),C=ns(y,j);C.tag=1,C.payload=c,m!=null&&(C.callback=m),c=Ms(i,C,j),c!==null&&(Qn(c,i,j,y),$c(c,i,j))},enqueueForceUpdate:function(i,c){i=i._reactInternals;var m=Yt(),y=Ls(i),j=ns(m,y);j.tag=2,c!=null&&(j.callback=c),c=Ms(i,j,y),c!==null&&(Qn(c,i,y,m),$c(c,i,y))}};function Wk(i,c,m,y,j,C,z){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(y,C,z):c.prototype&&c.prototype.isPureReactComponent?!Ii(m,y)||!Ii(j,C):!0}function Hk(i,c,m){var y=!1,j=Ts,C=c.contextType;return typeof C=="object"&&C!==null?C=Rn(C):(j=rn(c)?ca:Ut.current,y=c.contextTypes,C=(y=y!=null)?fo(i,j):Ts),c=new c(m,C),i.memoizedState=c.state!==null&&c.state!==void 0?c.state:null,c.updater=Bc,i.stateNode=c,c._reactInternals=i,y&&(i=i.stateNode,i.__reactInternalMemoizedUnmaskedChildContext=j,i.__reactInternalMemoizedMaskedChildContext=C),c}function Vk(i,c,m,y){i=c.state,typeof c.componentWillReceiveProps=="function"&&c.componentWillReceiveProps(m,y),typeof c.UNSAFE_componentWillReceiveProps=="function"&&c.UNSAFE_componentWillReceiveProps(m,y),c.state!==i&&Bc.enqueueReplaceState(c,c.state,null)}function df(i,c,m,y){var j=i.stateNode;j.props=m,j.state=i.memoizedState,j.refs={},Xh(i);var C=c.contextType;typeof C=="object"&&C!==null?j.context=Rn(C):(C=rn(c)?ca:Ut.current,j.context=fo(i,C)),j.state=i.memoizedState,C=c.getDerivedStateFromProps,typeof C=="function"&&(uf(i,c,C,m),j.state=i.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof j.getSnapshotBeforeUpdate=="function"||typeof j.UNSAFE_componentWillMount!="function"&&typeof j.componentWillMount!="function"||(c=j.state,typeof j.componentWillMount=="function"&&j.componentWillMount(),typeof j.UNSAFE_componentWillMount=="function"&&j.UNSAFE_componentWillMount(),c!==j.state&&Bc.enqueueReplaceState(j,j.state,null),Ic(i,m,j,y),j.state=i.memoizedState),typeof j.componentDidMount=="function"&&(i.flags|=4194308)}function bo(i,c){try{var m="",y=c;do m+=K(y),y=y.return;while(y);var j=m}catch(C){j=`
|
|
39
|
+
Error generating stack: `+C.message+`
|
|
40
|
+
`+C.stack}return{value:i,source:c,stack:j,digest:null}}function hf(i,c,m){return{value:i,source:null,stack:m??null,digest:c??null}}function ff(i,c){try{console.error(c.value)}catch(m){setTimeout(function(){throw m})}}var a3=typeof WeakMap=="function"?WeakMap:Map;function Gk(i,c,m){m=ns(-1,m),m.tag=3,m.payload={element:null};var y=c.value;return m.callback=function(){Kc||(Kc=!0,Cf=y),ff(i,c)},m}function Kk(i,c,m){m=ns(-1,m),m.tag=3;var y=i.type.getDerivedStateFromError;if(typeof y=="function"){var j=c.value;m.payload=function(){return y(j)},m.callback=function(){ff(i,c)}}var C=i.stateNode;return C!==null&&typeof C.componentDidCatch=="function"&&(m.callback=function(){ff(i,c),typeof y!="function"&&(Is===null?Is=new Set([this]):Is.add(this));var z=c.stack;this.componentDidCatch(c.value,{componentStack:z!==null?z:""})}),m}function Yk(i,c,m){var y=i.pingCache;if(y===null){y=i.pingCache=new a3;var j=new Set;y.set(c,j)}else j=y.get(c),j===void 0&&(j=new Set,y.set(c,j));j.has(m)||(j.add(m),i=v3.bind(null,i,c,m),c.then(i,i))}function Xk(i){do{var c;if((c=i.tag===13)&&(c=i.memoizedState,c=c!==null?c.dehydrated!==null:!0),c)return i;i=i.return}while(i!==null);return null}function Zk(i,c,m,y,j){return(i.mode&1)===0?(i===c?i.flags|=65536:(i.flags|=128,m.flags|=131072,m.flags&=-52805,m.tag===1&&(m.alternate===null?m.tag=17:(c=ns(-1,1),c.tag=2,Ms(m,c,1))),m.lanes|=1),i):(i.flags|=65536,i.lanes=j,i)}var o3=E.ReactCurrentOwner,sn=!1;function Kt(i,c,m,y){c.child=i===null?yk(c,null,m,y):yo(c,i.child,m,y)}function Jk(i,c,m,y,j){m=m.render;var C=c.ref;return vo(c,j),y=rf(i,c,m,y,C,j),m=sf(),i!==null&&!sn?(c.updateQueue=i.updateQueue,c.flags&=-2053,i.lanes&=~j,rs(i,c,j)):(ct&&m&&qh(c),c.flags|=1,Kt(i,c,y,j),c.child)}function Qk(i,c,m,y,j){if(i===null){var C=m.type;return typeof C=="function"&&!Of(C)&&C.defaultProps===void 0&&m.compare===null&&m.defaultProps===void 0?(c.tag=15,c.type=C,e1(i,c,C,y,j)):(i=eu(m.type,null,y,c,c.mode,j),i.ref=c.ref,i.return=c,c.child=i)}if(C=i.child,(i.lanes&j)===0){var z=C.memoizedProps;if(m=m.compare,m=m!==null?m:Ii,m(z,y)&&i.ref===c.ref)return rs(i,c,j)}return c.flags|=1,i=Ds(C,y),i.ref=c.ref,i.return=c,c.child=i}function e1(i,c,m,y,j){if(i!==null){var C=i.memoizedProps;if(Ii(C,y)&&i.ref===c.ref)if(sn=!1,c.pendingProps=y=C,(i.lanes&j)!==0)(i.flags&131072)!==0&&(sn=!0);else return c.lanes=i.lanes,rs(i,c,j)}return pf(i,c,m,y,j)}function t1(i,c,m){var y=c.pendingProps,j=y.children,C=i!==null?i.memoizedState:null;if(y.mode==="hidden")if((c.mode&1)===0)c.memoizedState={baseLanes:0,cachePool:null,transitions:null},nt(No,yn),yn|=m;else{if((m&1073741824)===0)return i=C!==null?C.baseLanes|m:m,c.lanes=c.childLanes=1073741824,c.memoizedState={baseLanes:i,cachePool:null,transitions:null},c.updateQueue=null,nt(No,yn),yn|=i,null;c.memoizedState={baseLanes:0,cachePool:null,transitions:null},y=C!==null?C.baseLanes:m,nt(No,yn),yn|=y}else C!==null?(y=C.baseLanes|m,c.memoizedState=null):y=m,nt(No,yn),yn|=y;return Kt(i,c,j,m),c.child}function n1(i,c){var m=c.ref;(i===null&&m!==null||i!==null&&i.ref!==m)&&(c.flags|=512,c.flags|=2097152)}function pf(i,c,m,y,j){var C=rn(m)?ca:Ut.current;return C=fo(c,C),vo(c,j),m=rf(i,c,m,y,C,j),y=sf(),i!==null&&!sn?(c.updateQueue=i.updateQueue,c.flags&=-2053,i.lanes&=~j,rs(i,c,j)):(ct&&y&&qh(c),c.flags|=1,Kt(i,c,m,j),c.child)}function r1(i,c,m,y,j){if(rn(m)){var C=!0;Sc(c)}else C=!1;if(vo(c,j),c.stateNode===null)zc(i,c),Hk(c,m,y),df(c,m,y,j),y=!0;else if(i===null){var z=c.stateNode,Q=c.memoizedProps;z.props=Q;var te=z.context,ce=m.contextType;typeof ce=="object"&&ce!==null?ce=Rn(ce):(ce=rn(m)?ca:Ut.current,ce=fo(c,ce));var we=m.getDerivedStateFromProps,ve=typeof we=="function"||typeof z.getSnapshotBeforeUpdate=="function";ve||typeof z.UNSAFE_componentWillReceiveProps!="function"&&typeof z.componentWillReceiveProps!="function"||(Q!==y||te!==ce)&&Vk(c,z,y,ce),As=!1;var ye=c.memoizedState;z.state=ye,Ic(c,y,z,j),te=c.memoizedState,Q!==y||ye!==te||nn.current||As?(typeof we=="function"&&(uf(c,m,we,y),te=c.memoizedState),(Q=As||Wk(c,m,Q,y,ye,te,ce))?(ve||typeof z.UNSAFE_componentWillMount!="function"&&typeof z.componentWillMount!="function"||(typeof z.componentWillMount=="function"&&z.componentWillMount(),typeof z.UNSAFE_componentWillMount=="function"&&z.UNSAFE_componentWillMount()),typeof z.componentDidMount=="function"&&(c.flags|=4194308)):(typeof z.componentDidMount=="function"&&(c.flags|=4194308),c.memoizedProps=y,c.memoizedState=te),z.props=y,z.state=te,z.context=ce,y=Q):(typeof z.componentDidMount=="function"&&(c.flags|=4194308),y=!1)}else{z=c.stateNode,vk(i,c),Q=c.memoizedProps,ce=c.type===c.elementType?Q:Xn(c.type,Q),z.props=ce,ve=c.pendingProps,ye=z.context,te=m.contextType,typeof te=="object"&&te!==null?te=Rn(te):(te=rn(m)?ca:Ut.current,te=fo(c,te));var Ne=m.getDerivedStateFromProps;(we=typeof Ne=="function"||typeof z.getSnapshotBeforeUpdate=="function")||typeof z.UNSAFE_componentWillReceiveProps!="function"&&typeof z.componentWillReceiveProps!="function"||(Q!==ve||ye!==te)&&Vk(c,z,y,te),As=!1,ye=c.memoizedState,z.state=ye,Ic(c,y,z,j);var _e=c.memoizedState;Q!==ve||ye!==_e||nn.current||As?(typeof Ne=="function"&&(uf(c,m,Ne,y),_e=c.memoizedState),(ce=As||Wk(c,m,ce,y,ye,_e,te)||!1)?(we||typeof z.UNSAFE_componentWillUpdate!="function"&&typeof z.componentWillUpdate!="function"||(typeof z.componentWillUpdate=="function"&&z.componentWillUpdate(y,_e,te),typeof z.UNSAFE_componentWillUpdate=="function"&&z.UNSAFE_componentWillUpdate(y,_e,te)),typeof z.componentDidUpdate=="function"&&(c.flags|=4),typeof z.getSnapshotBeforeUpdate=="function"&&(c.flags|=1024)):(typeof z.componentDidUpdate!="function"||Q===i.memoizedProps&&ye===i.memoizedState||(c.flags|=4),typeof z.getSnapshotBeforeUpdate!="function"||Q===i.memoizedProps&&ye===i.memoizedState||(c.flags|=1024),c.memoizedProps=y,c.memoizedState=_e),z.props=y,z.state=_e,z.context=te,y=ce):(typeof z.componentDidUpdate!="function"||Q===i.memoizedProps&&ye===i.memoizedState||(c.flags|=4),typeof z.getSnapshotBeforeUpdate!="function"||Q===i.memoizedProps&&ye===i.memoizedState||(c.flags|=1024),y=!1)}return mf(i,c,m,y,C,j)}function mf(i,c,m,y,j,C){n1(i,c);var z=(c.flags&128)!==0;if(!y&&!z)return j&&lk(c,m,!1),rs(i,c,C);y=c.stateNode,o3.current=c;var Q=z&&typeof m.getDerivedStateFromError!="function"?null:y.render();return c.flags|=1,i!==null&&z?(c.child=yo(c,i.child,null,C),c.child=yo(c,null,Q,C)):Kt(i,c,Q,C),c.memoizedState=y.state,j&&lk(c,m,!0),c.child}function s1(i){var c=i.stateNode;c.pendingContext?ok(i,c.pendingContext,c.pendingContext!==c.context):c.context&&ok(i,c.context,!1),Zh(i,c.containerInfo)}function a1(i,c,m,y,j){return go(),Wh(j),c.flags|=256,Kt(i,c,m,y),c.child}var gf={dehydrated:null,treeContext:null,retryLane:0};function yf(i){return{baseLanes:i,cachePool:null,transitions:null}}function o1(i,c,m){var y=c.pendingProps,j=dt.current,C=!1,z=(c.flags&128)!==0,Q;if((Q=z)||(Q=i!==null&&i.memoizedState===null?!1:(j&2)!==0),Q?(C=!0,c.flags&=-129):(i===null||i.memoizedState!==null)&&(j|=1),nt(dt,j&1),i===null)return zh(c),i=c.memoizedState,i!==null&&(i=i.dehydrated,i!==null)?((c.mode&1)===0?c.lanes=1:i.data==="$!"?c.lanes=8:c.lanes=1073741824,null):(z=y.children,i=y.fallback,C?(y=c.mode,C=c.child,z={mode:"hidden",children:z},(y&1)===0&&C!==null?(C.childLanes=0,C.pendingProps=z):C=tu(z,y,0,null),i=va(i,y,m,null),C.return=c,i.return=c,C.sibling=i,c.child=C,c.child.memoizedState=yf(m),c.memoizedState=gf,i):wf(c,z));if(j=i.memoizedState,j!==null&&(Q=j.dehydrated,Q!==null))return i3(i,c,z,y,Q,j,m);if(C){C=y.fallback,z=c.mode,j=i.child,Q=j.sibling;var te={mode:"hidden",children:y.children};return(z&1)===0&&c.child!==j?(y=c.child,y.childLanes=0,y.pendingProps=te,c.deletions=null):(y=Ds(j,te),y.subtreeFlags=j.subtreeFlags&14680064),Q!==null?C=Ds(Q,C):(C=va(C,z,m,null),C.flags|=2),C.return=c,y.return=c,y.sibling=C,c.child=y,y=C,C=c.child,z=i.child.memoizedState,z=z===null?yf(m):{baseLanes:z.baseLanes|m,cachePool:null,transitions:z.transitions},C.memoizedState=z,C.childLanes=i.childLanes&~m,c.memoizedState=gf,y}return C=i.child,i=C.sibling,y=Ds(C,{mode:"visible",children:y.children}),(c.mode&1)===0&&(y.lanes=m),y.return=c,y.sibling=null,i!==null&&(m=c.deletions,m===null?(c.deletions=[i],c.flags|=16):m.push(i)),c.child=y,c.memoizedState=null,y}function wf(i,c){return c=tu({mode:"visible",children:c},i.mode,0,null),c.return=i,i.child=c}function Uc(i,c,m,y){return y!==null&&Wh(y),yo(c,i.child,null,m),i=wf(c,c.pendingProps.children),i.flags|=2,c.memoizedState=null,i}function i3(i,c,m,y,j,C,z){if(m)return c.flags&256?(c.flags&=-257,y=hf(Error(n(422))),Uc(i,c,z,y)):c.memoizedState!==null?(c.child=i.child,c.flags|=128,null):(C=y.fallback,j=c.mode,y=tu({mode:"visible",children:y.children},j,0,null),C=va(C,j,z,null),C.flags|=2,y.return=c,C.return=c,y.sibling=C,c.child=y,(c.mode&1)!==0&&yo(c,i.child,null,z),c.child.memoizedState=yf(z),c.memoizedState=gf,C);if((c.mode&1)===0)return Uc(i,c,z,null);if(j.data==="$!"){if(y=j.nextSibling&&j.nextSibling.dataset,y)var Q=y.dgst;return y=Q,C=Error(n(419)),y=hf(C,y,void 0),Uc(i,c,z,y)}if(Q=(z&i.childLanes)!==0,sn||Q){if(y=At,y!==null){switch(z&-z){case 4:j=2;break;case 16:j=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:j=32;break;case 536870912:j=268435456;break;default:j=0}j=(j&(y.suspendedLanes|z))!==0?0:j,j!==0&&j!==C.retryLane&&(C.retryLane=j,ts(i,j),Qn(y,i,j,-1))}return If(),y=hf(Error(n(421))),Uc(i,c,z,y)}return j.data==="$?"?(c.flags|=128,c.child=i.child,c=x3.bind(null,i),j._reactRetry=c,null):(i=C.treeContext,gn=Es(j.nextSibling),mn=c,ct=!0,Yn=null,i!==null&&(Cn[Tn++]=Qr,Cn[Tn++]=es,Cn[Tn++]=ua,Qr=i.id,es=i.overflow,ua=c),c=wf(c,y.children),c.flags|=4096,c)}function i1(i,c,m){i.lanes|=c;var y=i.alternate;y!==null&&(y.lanes|=c),Kh(i.return,c,m)}function vf(i,c,m,y,j){var C=i.memoizedState;C===null?i.memoizedState={isBackwards:c,rendering:null,renderingStartTime:0,last:y,tail:m,tailMode:j}:(C.isBackwards=c,C.rendering=null,C.renderingStartTime=0,C.last=y,C.tail=m,C.tailMode=j)}function l1(i,c,m){var y=c.pendingProps,j=y.revealOrder,C=y.tail;if(Kt(i,c,y.children,m),y=dt.current,(y&2)!==0)y=y&1|2,c.flags|=128;else{if(i!==null&&(i.flags&128)!==0)e:for(i=c.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&i1(i,m,c);else if(i.tag===19)i1(i,m,c);else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===c)break e;for(;i.sibling===null;){if(i.return===null||i.return===c)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}y&=1}if(nt(dt,y),(c.mode&1)===0)c.memoizedState=null;else switch(j){case"forwards":for(m=c.child,j=null;m!==null;)i=m.alternate,i!==null&&Oc(i)===null&&(j=m),m=m.sibling;m=j,m===null?(j=c.child,c.child=null):(j=m.sibling,m.sibling=null),vf(c,!1,j,m,C);break;case"backwards":for(m=null,j=c.child,c.child=null;j!==null;){if(i=j.alternate,i!==null&&Oc(i)===null){c.child=j;break}i=j.sibling,j.sibling=m,m=j,j=i}vf(c,!0,m,null,C);break;case"together":vf(c,!1,null,null,void 0);break;default:c.memoizedState=null}return c.child}function zc(i,c){(c.mode&1)===0&&i!==null&&(i.alternate=null,c.alternate=null,c.flags|=2)}function rs(i,c,m){if(i!==null&&(c.dependencies=i.dependencies),ma|=c.lanes,(m&c.childLanes)===0)return null;if(i!==null&&c.child!==i.child)throw Error(n(153));if(c.child!==null){for(i=c.child,m=Ds(i,i.pendingProps),c.child=m,m.return=c;i.sibling!==null;)i=i.sibling,m=m.sibling=Ds(i,i.pendingProps),m.return=c;m.sibling=null}return c.child}function l3(i,c,m){switch(c.tag){case 3:s1(c),go();break;case 5:kk(c);break;case 1:rn(c.type)&&Sc(c);break;case 4:Zh(c,c.stateNode.containerInfo);break;case 10:var y=c.type._context,j=c.memoizedProps.value;nt(Ac,y._currentValue),y._currentValue=j;break;case 13:if(y=c.memoizedState,y!==null)return y.dehydrated!==null?(nt(dt,dt.current&1),c.flags|=128,null):(m&c.child.childLanes)!==0?o1(i,c,m):(nt(dt,dt.current&1),i=rs(i,c,m),i!==null?i.sibling:null);nt(dt,dt.current&1);break;case 19:if(y=(m&c.childLanes)!==0,(i.flags&128)!==0){if(y)return l1(i,c,m);c.flags|=128}if(j=c.memoizedState,j!==null&&(j.rendering=null,j.tail=null,j.lastEffect=null),nt(dt,dt.current),y)break;return null;case 22:case 23:return c.lanes=0,t1(i,c,m)}return rs(i,c,m)}var c1,xf,u1,d1;c1=function(i,c){for(var m=c.child;m!==null;){if(m.tag===5||m.tag===6)i.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}},xf=function(){},u1=function(i,c,m,y){var j=i.memoizedProps;if(j!==y){i=c.stateNode,fa(Er.current);var C=null;switch(m){case"input":j=me(i,j),y=me(i,y),C=[];break;case"select":j=W({},j,{value:void 0}),y=W({},y,{value:void 0}),C=[];break;case"textarea":j=We(i,j),y=We(i,y),C=[];break;default:typeof j.onClick!="function"&&typeof y.onClick=="function"&&(i.onclick=kc)}Xe(m,y);var z;m=null;for(ce in j)if(!y.hasOwnProperty(ce)&&j.hasOwnProperty(ce)&&j[ce]!=null)if(ce==="style"){var Q=j[ce];for(z in Q)Q.hasOwnProperty(z)&&(m||(m={}),m[z]="")}else ce!=="dangerouslySetInnerHTML"&&ce!=="children"&&ce!=="suppressContentEditableWarning"&&ce!=="suppressHydrationWarning"&&ce!=="autoFocus"&&(s.hasOwnProperty(ce)?C||(C=[]):(C=C||[]).push(ce,null));for(ce in y){var te=y[ce];if(Q=j!=null?j[ce]:void 0,y.hasOwnProperty(ce)&&te!==Q&&(te!=null||Q!=null))if(ce==="style")if(Q){for(z in Q)!Q.hasOwnProperty(z)||te&&te.hasOwnProperty(z)||(m||(m={}),m[z]="");for(z in te)te.hasOwnProperty(z)&&Q[z]!==te[z]&&(m||(m={}),m[z]=te[z])}else m||(C||(C=[]),C.push(ce,m)),m=te;else ce==="dangerouslySetInnerHTML"?(te=te?te.__html:void 0,Q=Q?Q.__html:void 0,te!=null&&Q!==te&&(C=C||[]).push(ce,te)):ce==="children"?typeof te!="string"&&typeof te!="number"||(C=C||[]).push(ce,""+te):ce!=="suppressContentEditableWarning"&&ce!=="suppressHydrationWarning"&&(s.hasOwnProperty(ce)?(te!=null&&ce==="onScroll"&&st("scroll",i),C||Q===te||(C=[])):(C=C||[]).push(ce,te))}m&&(C=C||[]).push("style",m);var ce=C;(c.updateQueue=ce)&&(c.flags|=4)}},d1=function(i,c,m,y){m!==y&&(c.flags|=4)};function Yi(i,c){if(!ct)switch(i.tailMode){case"hidden":c=i.tail;for(var m=null;c!==null;)c.alternate!==null&&(m=c),c=c.sibling;m===null?i.tail=null:m.sibling=null;break;case"collapsed":m=i.tail;for(var y=null;m!==null;)m.alternate!==null&&(y=m),m=m.sibling;y===null?c||i.tail===null?i.tail=null:i.tail.sibling=null:y.sibling=null}}function Wt(i){var c=i.alternate!==null&&i.alternate.child===i.child,m=0,y=0;if(c)for(var j=i.child;j!==null;)m|=j.lanes|j.childLanes,y|=j.subtreeFlags&14680064,y|=j.flags&14680064,j.return=i,j=j.sibling;else for(j=i.child;j!==null;)m|=j.lanes|j.childLanes,y|=j.subtreeFlags,y|=j.flags,j.return=i,j=j.sibling;return i.subtreeFlags|=y,i.childLanes=m,c}function c3(i,c,m){var y=c.pendingProps;switch(Bh(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 rn(c.type)&&jc(),Wt(c),null;case 3:return y=c.stateNode,xo(),at(nn),at(Ut),ef(),y.pendingContext&&(y.context=y.pendingContext,y.pendingContext=null),(i===null||i.child===null)&&(Tc(c)?c.flags|=4:i===null||i.memoizedState.isDehydrated&&(c.flags&256)===0||(c.flags|=1024,Yn!==null&&(Af(Yn),Yn=null))),xf(i,c),Wt(c),null;case 5:Jh(c);var j=fa(Wi.current);if(m=c.type,i!==null&&c.stateNode!=null)u1(i,c,m,y,j),i.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(i=fa(Er.current),Tc(c)){y=c.stateNode,m=c.type;var C=c.memoizedProps;switch(y[_r]=c,y[Fi]=C,i=(c.mode&1)!==0,m){case"dialog":st("cancel",y),st("close",y);break;case"iframe":case"object":case"embed":st("load",y);break;case"video":case"audio":for(j=0;j<Li.length;j++)st(Li[j],y);break;case"source":st("error",y);break;case"img":case"image":case"link":st("error",y),st("load",y);break;case"details":st("toggle",y);break;case"input":pe(y,C),st("invalid",y);break;case"select":y._wrapperState={wasMultiple:!!C.multiple},st("invalid",y);break;case"textarea":le(y,C),st("invalid",y)}Xe(m,C),j=null;for(var z in C)if(C.hasOwnProperty(z)){var Q=C[z];z==="children"?typeof Q=="string"?y.textContent!==Q&&(C.suppressHydrationWarning!==!0&&bc(y.textContent,Q,i),j=["children",Q]):typeof Q=="number"&&y.textContent!==""+Q&&(C.suppressHydrationWarning!==!0&&bc(y.textContent,Q,i),j=["children",""+Q]):s.hasOwnProperty(z)&&Q!=null&&z==="onScroll"&&st("scroll",y)}switch(m){case"input":ae(y),fe(y,C,!0);break;case"textarea":ae(y),Re(y);break;case"select":case"option":break;default:typeof C.onClick=="function"&&(y.onclick=kc)}y=j,c.updateQueue=y,y!==null&&(c.flags|=4)}else{z=j.nodeType===9?j:j.ownerDocument,i==="http://www.w3.org/1999/xhtml"&&(i=Le(m)),i==="http://www.w3.org/1999/xhtml"?m==="script"?(i=z.createElement("div"),i.innerHTML="<script><\/script>",i=i.removeChild(i.firstChild)):typeof y.is=="string"?i=z.createElement(m,{is:y.is}):(i=z.createElement(m),m==="select"&&(z=i,y.multiple?z.multiple=!0:y.size&&(z.size=y.size))):i=z.createElementNS(i,m),i[_r]=c,i[Fi]=y,c1(i,c,!1,!1),c.stateNode=i;e:{switch(z=pt(m,y),m){case"dialog":st("cancel",i),st("close",i),j=y;break;case"iframe":case"object":case"embed":st("load",i),j=y;break;case"video":case"audio":for(j=0;j<Li.length;j++)st(Li[j],i);j=y;break;case"source":st("error",i),j=y;break;case"img":case"image":case"link":st("error",i),st("load",i),j=y;break;case"details":st("toggle",i),j=y;break;case"input":pe(i,y),j=me(i,y),st("invalid",i);break;case"option":j=y;break;case"select":i._wrapperState={wasMultiple:!!y.multiple},j=W({},y,{value:void 0}),st("invalid",i);break;case"textarea":le(i,y),j=We(i,y),st("invalid",i);break;default:j=y}Xe(m,j),Q=j;for(C in Q)if(Q.hasOwnProperty(C)){var te=Q[C];C==="style"?ft(i,te):C==="dangerouslySetInnerHTML"?(te=te?te.__html:void 0,te!=null&&Je(i,te)):C==="children"?typeof te=="string"?(m!=="textarea"||te!=="")&&it(i,te):typeof te=="number"&&it(i,""+te):C!=="suppressContentEditableWarning"&&C!=="suppressHydrationWarning"&&C!=="autoFocus"&&(s.hasOwnProperty(C)?te!=null&&C==="onScroll"&&st("scroll",i):te!=null&&_(i,C,te,z))}switch(m){case"input":ae(i),fe(i,y,!1);break;case"textarea":ae(i),Re(i);break;case"option":y.value!=null&&i.setAttribute("value",""+ee(y.value));break;case"select":i.multiple=!!y.multiple,C=y.value,C!=null?Oe(i,!!y.multiple,C,!1):y.defaultValue!=null&&Oe(i,!!y.multiple,y.defaultValue,!0);break;default:typeof j.onClick=="function"&&(i.onclick=kc)}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(i&&c.stateNode!=null)d1(i,c,i.memoizedProps,y);else{if(typeof y!="string"&&c.stateNode===null)throw Error(n(166));if(m=fa(Wi.current),fa(Er.current),Tc(c)){if(y=c.stateNode,m=c.memoizedProps,y[_r]=c,(C=y.nodeValue!==m)&&(i=mn,i!==null))switch(i.tag){case 3:bc(y.nodeValue,m,(i.mode&1)!==0);break;case 5:i.memoizedProps.suppressHydrationWarning!==!0&&bc(y.nodeValue,m,(i.mode&1)!==0)}C&&(c.flags|=4)}else y=(m.nodeType===9?m:m.ownerDocument).createTextNode(y),y[_r]=c,c.stateNode=y}return Wt(c),null;case 13:if(at(dt),y=c.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(ct&&gn!==null&&(c.mode&1)!==0&&(c.flags&128)===0)pk(),go(),c.flags|=98560,C=!1;else if(C=Tc(c),y!==null&&y.dehydrated!==null){if(i===null){if(!C)throw Error(n(318));if(C=c.memoizedState,C=C!==null?C.dehydrated:null,!C)throw Error(n(317));C[_r]=c}else go(),(c.flags&128)===0&&(c.memoizedState=null),c.flags|=4;Wt(c),C=!1}else Yn!==null&&(Af(Yn),Yn=null),C=!0;if(!C)return c.flags&65536?c:null}return(c.flags&128)!==0?(c.lanes=m,c):(y=y!==null,y!==(i!==null&&i.memoizedState!==null)&&y&&(c.child.flags|=8192,(c.mode&1)!==0&&(i===null||(dt.current&1)!==0?St===0&&(St=3):If())),c.updateQueue!==null&&(c.flags|=4),Wt(c),null);case 4:return xo(),xf(i,c),i===null&&Pi(c.stateNode.containerInfo),Wt(c),null;case 10:return Gh(c.type._context),Wt(c),null;case 17:return rn(c.type)&&jc(),Wt(c),null;case 19:if(at(dt),C=c.memoizedState,C===null)return Wt(c),null;if(y=(c.flags&128)!==0,z=C.rendering,z===null)if(y)Yi(C,!1);else{if(St!==0||i!==null&&(i.flags&128)!==0)for(i=c.child;i!==null;){if(z=Oc(i),z!==null){for(c.flags|=128,Yi(C,!1),y=z.updateQueue,y!==null&&(c.updateQueue=y,c.flags|=4),c.subtreeFlags=0,y=m,m=c.child;m!==null;)C=m,i=y,C.flags&=14680066,z=C.alternate,z===null?(C.childLanes=0,C.lanes=i,C.child=null,C.subtreeFlags=0,C.memoizedProps=null,C.memoizedState=null,C.updateQueue=null,C.dependencies=null,C.stateNode=null):(C.childLanes=z.childLanes,C.lanes=z.lanes,C.child=z.child,C.subtreeFlags=0,C.deletions=null,C.memoizedProps=z.memoizedProps,C.memoizedState=z.memoizedState,C.updateQueue=z.updateQueue,C.type=z.type,i=z.dependencies,C.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),m=m.sibling;return nt(dt,dt.current&1|2),c.child}i=i.sibling}C.tail!==null&&tt()>jo&&(c.flags|=128,y=!0,Yi(C,!1),c.lanes=4194304)}else{if(!y)if(i=Oc(z),i!==null){if(c.flags|=128,y=!0,m=i.updateQueue,m!==null&&(c.updateQueue=m,c.flags|=4),Yi(C,!0),C.tail===null&&C.tailMode==="hidden"&&!z.alternate&&!ct)return Wt(c),null}else 2*tt()-C.renderingStartTime>jo&&m!==1073741824&&(c.flags|=128,y=!0,Yi(C,!1),c.lanes=4194304);C.isBackwards?(z.sibling=c.child,c.child=z):(m=C.last,m!==null?m.sibling=z:c.child=z,C.last=z)}return C.tail!==null?(c=C.tail,C.rendering=c,C.tail=c.sibling,C.renderingStartTime=tt(),c.sibling=null,m=dt.current,nt(dt,y?m&1|2:m&1),c):(Wt(c),null);case 22:case 23:return $f(),y=c.memoizedState!==null,i!==null&&i.memoizedState!==null!==y&&(c.flags|=8192),y&&(c.mode&1)!==0?(yn&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 u3(i,c){switch(Bh(c),c.tag){case 1:return rn(c.type)&&jc(),i=c.flags,i&65536?(c.flags=i&-65537|128,c):null;case 3:return xo(),at(nn),at(Ut),ef(),i=c.flags,(i&65536)!==0&&(i&128)===0?(c.flags=i&-65537|128,c):null;case 5:return Jh(c),null;case 13:if(at(dt),i=c.memoizedState,i!==null&&i.dehydrated!==null){if(c.alternate===null)throw Error(n(340));go()}return i=c.flags,i&65536?(c.flags=i&-65537|128,c):null;case 19:return at(dt),null;case 4:return xo(),null;case 10:return Gh(c.type._context),null;case 22:case 23:return $f(),null;case 24:return null;default:return null}}var Wc=!1,Ht=!1,d3=typeof WeakSet=="function"?WeakSet:Set,Se=null;function ko(i,c){var m=i.ref;if(m!==null)if(typeof m=="function")try{m(null)}catch(y){mt(i,c,y)}else m.current=null}function bf(i,c,m){try{m()}catch(y){mt(i,c,y)}}var h1=!1;function h3(i,c){if(Mh=Ja,i=W0(),jh(i)){if("selectionStart"in i)var m={start:i.selectionStart,end:i.selectionEnd};else e:{m=(m=i.ownerDocument)&&m.defaultView||window;var y=m.getSelection&&m.getSelection();if(y&&y.rangeCount!==0){m=y.anchorNode;var j=y.anchorOffset,C=y.focusNode;y=y.focusOffset;try{m.nodeType,C.nodeType}catch{m=null;break e}var z=0,Q=-1,te=-1,ce=0,we=0,ve=i,ye=null;t:for(;;){for(var Ne;ve!==m||j!==0&&ve.nodeType!==3||(Q=z+j),ve!==C||y!==0&&ve.nodeType!==3||(te=z+y),ve.nodeType===3&&(z+=ve.nodeValue.length),(Ne=ve.firstChild)!==null;)ye=ve,ve=Ne;for(;;){if(ve===i)break t;if(ye===m&&++ce===j&&(Q=z),ye===C&&++we===y&&(te=z),(Ne=ve.nextSibling)!==null)break;ve=ye,ye=ve.parentNode}ve=Ne}m=Q===-1||te===-1?null:{start:Q,end:te}}else m=null}m=m||{start:0,end:0}}else m=null;for($h={focusedElem:i,selectionRange:m},Ja=!1,Se=c;Se!==null;)if(c=Se,i=c.child,(c.subtreeFlags&1028)!==0&&i!==null)i.return=c,Se=i;else for(;Se!==null;){c=Se;try{var _e=c.alternate;if((c.flags&1024)!==0)switch(c.tag){case 0:case 11:case 15:break;case 1:if(_e!==null){var Ee=_e.memoizedProps,wt=_e.memoizedState,oe=c.stateNode,ne=oe.getSnapshotBeforeUpdate(c.elementType===c.type?Ee:Xn(c.type,Ee),wt);oe.__reactInternalSnapshotBeforeUpdate=ne}break;case 3:var ie=c.stateNode.containerInfo;ie.nodeType===1?ie.textContent="":ie.nodeType===9&&ie.documentElement&&ie.removeChild(ie.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(be){mt(c,c.return,be)}if(i=c.sibling,i!==null){i.return=c.return,Se=i;break}Se=c.return}return _e=h1,h1=!1,_e}function Xi(i,c,m){var y=c.updateQueue;if(y=y!==null?y.lastEffect:null,y!==null){var j=y=y.next;do{if((j.tag&i)===i){var C=j.destroy;j.destroy=void 0,C!==void 0&&bf(c,m,C)}j=j.next}while(j!==y)}}function Hc(i,c){if(c=c.updateQueue,c=c!==null?c.lastEffect:null,c!==null){var m=c=c.next;do{if((m.tag&i)===i){var y=m.create;m.destroy=y()}m=m.next}while(m!==c)}}function kf(i){var c=i.ref;if(c!==null){var m=i.stateNode;switch(i.tag){case 5:i=m;break;default:i=m}typeof c=="function"?c(i):c.current=i}}function f1(i){var c=i.alternate;c!==null&&(i.alternate=null,f1(c)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(c=i.stateNode,c!==null&&(delete c[_r],delete c[Fi],delete c[Ph],delete c[KL],delete c[YL])),i.stateNode=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}function p1(i){return i.tag===5||i.tag===3||i.tag===4}function m1(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||p1(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.flags&2||i.child===null||i.tag===4)continue e;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function Nf(i,c,m){var y=i.tag;if(y===5||y===6)i=i.stateNode,c?m.nodeType===8?m.parentNode.insertBefore(i,c):m.insertBefore(i,c):(m.nodeType===8?(c=m.parentNode,c.insertBefore(i,m)):(c=m,c.appendChild(i)),m=m._reactRootContainer,m!=null||c.onclick!==null||(c.onclick=kc));else if(y!==4&&(i=i.child,i!==null))for(Nf(i,c,m),i=i.sibling;i!==null;)Nf(i,c,m),i=i.sibling}function jf(i,c,m){var y=i.tag;if(y===5||y===6)i=i.stateNode,c?m.insertBefore(i,c):m.appendChild(i);else if(y!==4&&(i=i.child,i!==null))for(jf(i,c,m),i=i.sibling;i!==null;)jf(i,c,m),i=i.sibling}var Pt=null,Zn=!1;function $s(i,c,m){for(m=m.child;m!==null;)g1(i,c,m),m=m.sibling}function g1(i,c,m){if(en&&typeof en.onCommitFiberUnmount=="function")try{en.onCommitFiberUnmount(Gr,m)}catch{}switch(m.tag){case 5:Ht||ko(m,c);case 6:var y=Pt,j=Zn;Pt=null,$s(i,c,m),Pt=y,Zn=j,Pt!==null&&(Zn?(i=Pt,m=m.stateNode,i.nodeType===8?i.parentNode.removeChild(m):i.removeChild(m)):Pt.removeChild(m.stateNode));break;case 18:Pt!==null&&(Zn?(i=Pt,m=m.stateNode,i.nodeType===8?Lh(i.parentNode,m):i.nodeType===1&&Lh(i,m),js(i)):Lh(Pt,m.stateNode));break;case 4:y=Pt,j=Zn,Pt=m.stateNode.containerInfo,Zn=!0,$s(i,c,m),Pt=y,Zn=j;break;case 0:case 11:case 14:case 15:if(!Ht&&(y=m.updateQueue,y!==null&&(y=y.lastEffect,y!==null))){j=y=y.next;do{var C=j,z=C.destroy;C=C.tag,z!==void 0&&((C&2)!==0||(C&4)!==0)&&bf(m,c,z),j=j.next}while(j!==y)}$s(i,c,m);break;case 1:if(!Ht&&(ko(m,c),y=m.stateNode,typeof y.componentWillUnmount=="function"))try{y.props=m.memoizedProps,y.state=m.memoizedState,y.componentWillUnmount()}catch(Q){mt(m,c,Q)}$s(i,c,m);break;case 21:$s(i,c,m);break;case 22:m.mode&1?(Ht=(y=Ht)||m.memoizedState!==null,$s(i,c,m),Ht=y):$s(i,c,m);break;default:$s(i,c,m)}}function y1(i){var c=i.updateQueue;if(c!==null){i.updateQueue=null;var m=i.stateNode;m===null&&(m=i.stateNode=new d3),c.forEach(function(y){var j=b3.bind(null,i,y);m.has(y)||(m.add(y),y.then(j,j))})}}function Jn(i,c){var m=c.deletions;if(m!==null)for(var y=0;y<m.length;y++){var j=m[y];try{var C=i,z=c,Q=z;e:for(;Q!==null;){switch(Q.tag){case 5:Pt=Q.stateNode,Zn=!1;break e;case 3:Pt=Q.stateNode.containerInfo,Zn=!0;break e;case 4:Pt=Q.stateNode.containerInfo,Zn=!0;break e}Q=Q.return}if(Pt===null)throw Error(n(160));g1(C,z,j),Pt=null,Zn=!1;var te=j.alternate;te!==null&&(te.return=null),j.return=null}catch(ce){mt(j,c,ce)}}if(c.subtreeFlags&12854)for(c=c.child;c!==null;)w1(c,i),c=c.sibling}function w1(i,c){var m=i.alternate,y=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:if(Jn(c,i),Tr(i),y&4){try{Xi(3,i,i.return),Hc(3,i)}catch(Ee){mt(i,i.return,Ee)}try{Xi(5,i,i.return)}catch(Ee){mt(i,i.return,Ee)}}break;case 1:Jn(c,i),Tr(i),y&512&&m!==null&&ko(m,m.return);break;case 5:if(Jn(c,i),Tr(i),y&512&&m!==null&&ko(m,m.return),i.flags&32){var j=i.stateNode;try{it(j,"")}catch(Ee){mt(i,i.return,Ee)}}if(y&4&&(j=i.stateNode,j!=null)){var C=i.memoizedProps,z=m!==null?m.memoizedProps:C,Q=i.type,te=i.updateQueue;if(i.updateQueue=null,te!==null)try{Q==="input"&&C.type==="radio"&&C.name!=null&&ke(j,C),pt(Q,z);var ce=pt(Q,C);for(z=0;z<te.length;z+=2){var we=te[z],ve=te[z+1];we==="style"?ft(j,ve):we==="dangerouslySetInnerHTML"?Je(j,ve):we==="children"?it(j,ve):_(j,we,ve,ce)}switch(Q){case"input":xe(j,C);break;case"textarea":je(j,C);break;case"select":var ye=j._wrapperState.wasMultiple;j._wrapperState.wasMultiple=!!C.multiple;var Ne=C.value;Ne!=null?Oe(j,!!C.multiple,Ne,!1):ye!==!!C.multiple&&(C.defaultValue!=null?Oe(j,!!C.multiple,C.defaultValue,!0):Oe(j,!!C.multiple,C.multiple?[]:"",!1))}j[Fi]=C}catch(Ee){mt(i,i.return,Ee)}}break;case 6:if(Jn(c,i),Tr(i),y&4){if(i.stateNode===null)throw Error(n(162));j=i.stateNode,C=i.memoizedProps;try{j.nodeValue=C}catch(Ee){mt(i,i.return,Ee)}}break;case 3:if(Jn(c,i),Tr(i),y&4&&m!==null&&m.memoizedState.isDehydrated)try{js(c.containerInfo)}catch(Ee){mt(i,i.return,Ee)}break;case 4:Jn(c,i),Tr(i);break;case 13:Jn(c,i),Tr(i),j=i.child,j.flags&8192&&(C=j.memoizedState!==null,j.stateNode.isHidden=C,!C||j.alternate!==null&&j.alternate.memoizedState!==null||(Ef=tt())),y&4&&y1(i);break;case 22:if(we=m!==null&&m.memoizedState!==null,i.mode&1?(Ht=(ce=Ht)||we,Jn(c,i),Ht=ce):Jn(c,i),Tr(i),y&8192){if(ce=i.memoizedState!==null,(i.stateNode.isHidden=ce)&&!we&&(i.mode&1)!==0)for(Se=i,we=i.child;we!==null;){for(ve=Se=we;Se!==null;){switch(ye=Se,Ne=ye.child,ye.tag){case 0:case 11:case 14:case 15:Xi(4,ye,ye.return);break;case 1:ko(ye,ye.return);var _e=ye.stateNode;if(typeof _e.componentWillUnmount=="function"){y=ye,m=ye.return;try{c=y,_e.props=c.memoizedProps,_e.state=c.memoizedState,_e.componentWillUnmount()}catch(Ee){mt(y,m,Ee)}}break;case 5:ko(ye,ye.return);break;case 22:if(ye.memoizedState!==null){b1(ve);continue}}Ne!==null?(Ne.return=ye,Se=Ne):b1(ve)}we=we.sibling}e:for(we=null,ve=i;;){if(ve.tag===5){if(we===null){we=ve;try{j=ve.stateNode,ce?(C=j.style,typeof C.setProperty=="function"?C.setProperty("display","none","important"):C.display="none"):(Q=ve.stateNode,te=ve.memoizedProps.style,z=te!=null&&te.hasOwnProperty("display")?te.display:null,Q.style.display=He("display",z))}catch(Ee){mt(i,i.return,Ee)}}}else if(ve.tag===6){if(we===null)try{ve.stateNode.nodeValue=ce?"":ve.memoizedProps}catch(Ee){mt(i,i.return,Ee)}}else if((ve.tag!==22&&ve.tag!==23||ve.memoizedState===null||ve===i)&&ve.child!==null){ve.child.return=ve,ve=ve.child;continue}if(ve===i)break e;for(;ve.sibling===null;){if(ve.return===null||ve.return===i)break e;we===ve&&(we=null),ve=ve.return}we===ve&&(we=null),ve.sibling.return=ve.return,ve=ve.sibling}}break;case 19:Jn(c,i),Tr(i),y&4&&y1(i);break;case 21:break;default:Jn(c,i),Tr(i)}}function Tr(i){var c=i.flags;if(c&2){try{e:{for(var m=i.return;m!==null;){if(p1(m)){var y=m;break e}m=m.return}throw Error(n(160))}switch(y.tag){case 5:var j=y.stateNode;y.flags&32&&(it(j,""),y.flags&=-33);var C=m1(i);jf(i,C,j);break;case 3:case 4:var z=y.stateNode.containerInfo,Q=m1(i);Nf(i,Q,z);break;default:throw Error(n(161))}}catch(te){mt(i,i.return,te)}i.flags&=-3}c&4096&&(i.flags&=-4097)}function f3(i,c,m){Se=i,v1(i)}function v1(i,c,m){for(var y=(i.mode&1)!==0;Se!==null;){var j=Se,C=j.child;if(j.tag===22&&y){var z=j.memoizedState!==null||Wc;if(!z){var Q=j.alternate,te=Q!==null&&Q.memoizedState!==null||Ht;Q=Wc;var ce=Ht;if(Wc=z,(Ht=te)&&!ce)for(Se=j;Se!==null;)z=Se,te=z.child,z.tag===22&&z.memoizedState!==null?k1(j):te!==null?(te.return=z,Se=te):k1(j);for(;C!==null;)Se=C,v1(C),C=C.sibling;Se=j,Wc=Q,Ht=ce}x1(i)}else(j.subtreeFlags&8772)!==0&&C!==null?(C.return=j,Se=C):x1(i)}}function x1(i){for(;Se!==null;){var c=Se;if((c.flags&8772)!==0){var m=c.alternate;try{if((c.flags&8772)!==0)switch(c.tag){case 0:case 11:case 15:Ht||Hc(5,c);break;case 1:var y=c.stateNode;if(c.flags&4&&!Ht)if(m===null)y.componentDidMount();else{var j=c.elementType===c.type?m.memoizedProps:Xn(c.type,m.memoizedProps);y.componentDidUpdate(j,m.memoizedState,y.__reactInternalSnapshotBeforeUpdate)}var C=c.updateQueue;C!==null&&bk(c,C,y);break;case 3:var z=c.updateQueue;if(z!==null){if(m=null,c.child!==null)switch(c.child.tag){case 5:m=c.child.stateNode;break;case 1:m=c.child.stateNode}bk(c,z,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 ce=c.alternate;if(ce!==null){var we=ce.memoizedState;if(we!==null){var ve=we.dehydrated;ve!==null&&js(ve)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}Ht||c.flags&512&&kf(c)}catch(ye){mt(c,c.return,ye)}}if(c===i){Se=null;break}if(m=c.sibling,m!==null){m.return=c.return,Se=m;break}Se=c.return}}function b1(i){for(;Se!==null;){var c=Se;if(c===i){Se=null;break}var m=c.sibling;if(m!==null){m.return=c.return,Se=m;break}Se=c.return}}function k1(i){for(;Se!==null;){var c=Se;try{switch(c.tag){case 0:case 11:case 15:var m=c.return;try{Hc(4,c)}catch(te){mt(c,m,te)}break;case 1:var y=c.stateNode;if(typeof y.componentDidMount=="function"){var j=c.return;try{y.componentDidMount()}catch(te){mt(c,j,te)}}var C=c.return;try{kf(c)}catch(te){mt(c,C,te)}break;case 5:var z=c.return;try{kf(c)}catch(te){mt(c,z,te)}}}catch(te){mt(c,c.return,te)}if(c===i){Se=null;break}var Q=c.sibling;if(Q!==null){Q.return=c.return,Se=Q;break}Se=c.return}}var p3=Math.ceil,Vc=E.ReactCurrentDispatcher,Sf=E.ReactCurrentOwner,Mn=E.ReactCurrentBatchConfig,ze=0,At=null,xt=null,Dt=0,yn=0,No=Cs(0),St=0,Zi=null,ma=0,Gc=0,_f=0,Ji=null,an=null,Ef=0,jo=1/0,ss=null,Kc=!1,Cf=null,Is=null,Yc=!1,Os=null,Xc=0,Qi=0,Tf=null,Zc=-1,Jc=0;function Yt(){return(ze&6)!==0?tt():Zc!==-1?Zc:Zc=tt()}function Ls(i){return(i.mode&1)===0?1:(ze&2)!==0&&Dt!==0?Dt&-Dt:ZL.transition!==null?(Jc===0&&(Jc=ac()),Jc):(i=Ve,i!==0||(i=window.event,i=i===void 0?16:to(i.type)),i)}function Qn(i,c,m,y){if(50<Qi)throw Qi=0,Tf=null,Error(n(185));_n(i,m,y),((ze&2)===0||i!==At)&&(i===At&&((ze&2)===0&&(Gc|=m),St===4&&Ps(i,Dt)),on(i,y),m===1&&ze===0&&(c.mode&1)===0&&(jo=tt()+500,_c&&Rs()))}function on(i,c){var m=i.callbackNode;yh(i,c);var y=bs(i,i===At?Dt:0);if(y===0)m!==null&&ws(m),i.callbackNode=null,i.callbackPriority=0;else if(c=y&-y,i.callbackPriority!==c){if(m!=null&&ws(m),c===1)i.tag===0?XL(j1.bind(null,i)):ck(j1.bind(null,i)),VL(function(){(ze&6)===0&&Rs()}),m=null;else{switch(Ya(y)){case 1:m=br;break;case 4:m=Vr;break;case 16:m=vs;break;case 536870912:m=ea;break;default:m=vs}m=M1(m,N1.bind(null,i))}i.callbackPriority=c,i.callbackNode=m}}function N1(i,c){if(Zc=-1,Jc=0,(ze&6)!==0)throw Error(n(327));var m=i.callbackNode;if(So()&&i.callbackNode!==m)return null;var y=bs(i,i===At?Dt:0);if(y===0)return null;if((y&30)!==0||(y&i.expiredLanes)!==0||c)c=Qc(i,y);else{c=y;var j=ze;ze|=2;var C=_1();(At!==i||Dt!==c)&&(ss=null,jo=tt()+500,ya(i,c));do try{y3();break}catch(Q){S1(i,Q)}while(!0);Vh(),Vc.current=C,ze=j,xt!==null?c=0:(At=null,Dt=0,c=St)}if(c!==0){if(c===2&&(j=bi(i),j!==0&&(y=j,c=Rf(i,j))),c===1)throw m=Zi,ya(i,0),Ps(i,y),on(i,tt()),m;if(c===6)Ps(i,y);else{if(j=i.current.alternate,(y&30)===0&&!m3(j)&&(c=Qc(i,y),c===2&&(C=bi(i),C!==0&&(y=C,c=Rf(i,C))),c===1))throw m=Zi,ya(i,0),Ps(i,y),on(i,tt()),m;switch(i.finishedWork=j,i.finishedLanes=y,c){case 0:case 1:throw Error(n(345));case 2:wa(i,an,ss);break;case 3:if(Ps(i,y),(y&130023424)===y&&(c=Ef+500-tt(),10<c)){if(bs(i,0)!==0)break;if(j=i.suspendedLanes,(j&y)!==y){Yt(),i.pingedLanes|=i.suspendedLanes&j;break}i.timeoutHandle=Oh(wa.bind(null,i,an,ss),c);break}wa(i,an,ss);break;case 4:if(Ps(i,y),(y&4194240)===y)break;for(c=i.eventTimes,j=-1;0<y;){var z=31-tn(y);C=1<<z,z=c[z],z>j&&(j=z),y&=~C}if(y=j,y=tt()-y,y=(120>y?120:480>y?480:1080>y?1080:1920>y?1920:3e3>y?3e3:4320>y?4320:1960*p3(y/1960))-y,10<y){i.timeoutHandle=Oh(wa.bind(null,i,an,ss),y);break}wa(i,an,ss);break;case 5:wa(i,an,ss);break;default:throw Error(n(329))}}}return on(i,tt()),i.callbackNode===m?N1.bind(null,i):null}function Rf(i,c){var m=Ji;return i.current.memoizedState.isDehydrated&&(ya(i,c).flags|=256),i=Qc(i,c),i!==2&&(c=an,an=m,c!==null&&Af(c)),i}function Af(i){an===null?an=i:an.push.apply(an,i)}function m3(i){for(var c=i;;){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 j=m[y],C=j.getSnapshot;j=j.value;try{if(!Kn(C(),j))return!1}catch{return!1}}}if(m=c.child,c.subtreeFlags&16384&&m!==null)m.return=c,c=m;else{if(c===i)break;for(;c.sibling===null;){if(c.return===null||c.return===i)return!0;c=c.return}c.sibling.return=c.return,c=c.sibling}}return!0}function Ps(i,c){for(c&=~_f,c&=~Gc,i.suspendedLanes|=c,i.pingedLanes&=~c,i=i.expirationTimes;0<c;){var m=31-tn(c),y=1<<m;i[m]=-1,c&=~y}}function j1(i){if((ze&6)!==0)throw Error(n(327));So();var c=bs(i,0);if((c&1)===0)return on(i,tt()),null;var m=Qc(i,c);if(i.tag!==0&&m===2){var y=bi(i);y!==0&&(c=y,m=Rf(i,y))}if(m===1)throw m=Zi,ya(i,0),Ps(i,c),on(i,tt()),m;if(m===6)throw Error(n(345));return i.finishedWork=i.current.alternate,i.finishedLanes=c,wa(i,an,ss),on(i,tt()),null}function Mf(i,c){var m=ze;ze|=1;try{return i(c)}finally{ze=m,ze===0&&(jo=tt()+500,_c&&Rs())}}function ga(i){Os!==null&&Os.tag===0&&(ze&6)===0&&So();var c=ze;ze|=1;var m=Mn.transition,y=Ve;try{if(Mn.transition=null,Ve=1,i)return i()}finally{Ve=y,Mn.transition=m,ze=c,(ze&6)===0&&Rs()}}function $f(){yn=No.current,at(No)}function ya(i,c){i.finishedWork=null,i.finishedLanes=0;var m=i.timeoutHandle;if(m!==-1&&(i.timeoutHandle=-1,HL(m)),xt!==null)for(m=xt.return;m!==null;){var y=m;switch(Bh(y),y.tag){case 1:y=y.type.childContextTypes,y!=null&&jc();break;case 3:xo(),at(nn),at(Ut),ef();break;case 5:Jh(y);break;case 4:xo();break;case 13:at(dt);break;case 19:at(dt);break;case 10:Gh(y.type._context);break;case 22:case 23:$f()}m=m.return}if(At=i,xt=i=Ds(i.current,null),Dt=yn=c,St=0,Zi=null,_f=Gc=ma=0,an=Ji=null,ha!==null){for(c=0;c<ha.length;c++)if(m=ha[c],y=m.interleaved,y!==null){m.interleaved=null;var j=y.next,C=m.pending;if(C!==null){var z=C.next;C.next=j,y.next=z}m.pending=y}ha=null}return i}function S1(i,c){do{var m=xt;try{if(Vh(),Lc.current=qc,Pc){for(var y=ht.memoizedState;y!==null;){var j=y.queue;j!==null&&(j.pending=null),y=y.next}Pc=!1}if(pa=0,Rt=jt=ht=null,Hi=!1,Vi=0,Sf.current=null,m===null||m.return===null){St=1,Zi=c,xt=null;break}e:{var C=i,z=m.return,Q=m,te=c;if(c=Dt,Q.flags|=32768,te!==null&&typeof te=="object"&&typeof te.then=="function"){var ce=te,we=Q,ve=we.tag;if((we.mode&1)===0&&(ve===0||ve===11||ve===15)){var ye=we.alternate;ye?(we.updateQueue=ye.updateQueue,we.memoizedState=ye.memoizedState,we.lanes=ye.lanes):(we.updateQueue=null,we.memoizedState=null)}var Ne=Xk(z);if(Ne!==null){Ne.flags&=-257,Zk(Ne,z,Q,C,c),Ne.mode&1&&Yk(C,ce,c),c=Ne,te=ce;var _e=c.updateQueue;if(_e===null){var Ee=new Set;Ee.add(te),c.updateQueue=Ee}else _e.add(te);break e}else{if((c&1)===0){Yk(C,ce,c),If();break e}te=Error(n(426))}}else if(ct&&Q.mode&1){var wt=Xk(z);if(wt!==null){(wt.flags&65536)===0&&(wt.flags|=256),Zk(wt,z,Q,C,c),Wh(bo(te,Q));break e}}C=te=bo(te,Q),St!==4&&(St=2),Ji===null?Ji=[C]:Ji.push(C),C=z;do{switch(C.tag){case 3:C.flags|=65536,c&=-c,C.lanes|=c;var oe=Gk(C,te,c);xk(C,oe);break e;case 1:Q=te;var ne=C.type,ie=C.stateNode;if((C.flags&128)===0&&(typeof ne.getDerivedStateFromError=="function"||ie!==null&&typeof ie.componentDidCatch=="function"&&(Is===null||!Is.has(ie)))){C.flags|=65536,c&=-c,C.lanes|=c;var be=Kk(C,Q,c);xk(C,be);break e}}C=C.return}while(C!==null)}C1(m)}catch(Ce){c=Ce,xt===m&&m!==null&&(xt=m=m.return);continue}break}while(!0)}function _1(){var i=Vc.current;return Vc.current=qc,i===null?qc:i}function If(){(St===0||St===3||St===2)&&(St=4),At===null||(ma&268435455)===0&&(Gc&268435455)===0||Ps(At,Dt)}function Qc(i,c){var m=ze;ze|=2;var y=_1();(At!==i||Dt!==c)&&(ss=null,ya(i,c));do try{g3();break}catch(j){S1(i,j)}while(!0);if(Vh(),ze=m,Vc.current=y,xt!==null)throw Error(n(261));return At=null,Dt=0,St}function g3(){for(;xt!==null;)E1(xt)}function y3(){for(;xt!==null&&!Sn();)E1(xt)}function E1(i){var c=A1(i.alternate,i,yn);i.memoizedProps=i.pendingProps,c===null?C1(i):xt=c,Sf.current=null}function C1(i){var c=i;do{var m=c.alternate;if(i=c.return,(c.flags&32768)===0){if(m=c3(m,c,yn),m!==null){xt=m;return}}else{if(m=u3(m,c),m!==null){m.flags&=32767,xt=m;return}if(i!==null)i.flags|=32768,i.subtreeFlags=0,i.deletions=null;else{St=6,xt=null;return}}if(c=c.sibling,c!==null){xt=c;return}xt=c=i}while(c!==null);St===0&&(St=5)}function wa(i,c,m){var y=Ve,j=Mn.transition;try{Mn.transition=null,Ve=1,w3(i,c,m,y)}finally{Mn.transition=j,Ve=y}return null}function w3(i,c,m,y){do So();while(Os!==null);if((ze&6)!==0)throw Error(n(327));m=i.finishedWork;var j=i.finishedLanes;if(m===null)return null;if(i.finishedWork=null,i.finishedLanes=0,m===i.current)throw Error(n(177));i.callbackNode=null,i.callbackPriority=0;var C=m.lanes|m.childLanes;if(wh(i,C),i===At&&(xt=At=null,Dt=0),(m.subtreeFlags&2064)===0&&(m.flags&2064)===0||Yc||(Yc=!0,M1(vs,function(){return So(),null})),C=(m.flags&15990)!==0,(m.subtreeFlags&15990)!==0||C){C=Mn.transition,Mn.transition=null;var z=Ve;Ve=1;var Q=ze;ze|=4,Sf.current=null,h3(i,m),w1(m,i),DL($h),Ja=!!Mh,$h=Mh=null,i.current=m,f3(m),Wr(),ze=Q,Ve=z,Mn.transition=C}else i.current=m;if(Yc&&(Yc=!1,Os=i,Xc=j),C=i.pendingLanes,C===0&&(Is=null),xs(m.stateNode),on(i,tt()),c!==null)for(y=i.onRecoverableError,m=0;m<c.length;m++)j=c[m],y(j.value,{componentStack:j.stack,digest:j.digest});if(Kc)throw Kc=!1,i=Cf,Cf=null,i;return(Xc&1)!==0&&i.tag!==0&&So(),C=i.pendingLanes,(C&1)!==0?i===Tf?Qi++:(Qi=0,Tf=i):Qi=0,Rs(),null}function So(){if(Os!==null){var i=Ya(Xc),c=Mn.transition,m=Ve;try{if(Mn.transition=null,Ve=16>i?16:i,Os===null)var y=!1;else{if(i=Os,Os=null,Xc=0,(ze&6)!==0)throw Error(n(331));var j=ze;for(ze|=4,Se=i.current;Se!==null;){var C=Se,z=C.child;if((Se.flags&16)!==0){var Q=C.deletions;if(Q!==null){for(var te=0;te<Q.length;te++){var ce=Q[te];for(Se=ce;Se!==null;){var we=Se;switch(we.tag){case 0:case 11:case 15:Xi(8,we,C)}var ve=we.child;if(ve!==null)ve.return=we,Se=ve;else for(;Se!==null;){we=Se;var ye=we.sibling,Ne=we.return;if(f1(we),we===ce){Se=null;break}if(ye!==null){ye.return=Ne,Se=ye;break}Se=Ne}}}var _e=C.alternate;if(_e!==null){var Ee=_e.child;if(Ee!==null){_e.child=null;do{var wt=Ee.sibling;Ee.sibling=null,Ee=wt}while(Ee!==null)}}Se=C}}if((C.subtreeFlags&2064)!==0&&z!==null)z.return=C,Se=z;else e:for(;Se!==null;){if(C=Se,(C.flags&2048)!==0)switch(C.tag){case 0:case 11:case 15:Xi(9,C,C.return)}var oe=C.sibling;if(oe!==null){oe.return=C.return,Se=oe;break e}Se=C.return}}var ne=i.current;for(Se=ne;Se!==null;){z=Se;var ie=z.child;if((z.subtreeFlags&2064)!==0&&ie!==null)ie.return=z,Se=ie;else e:for(z=ne;Se!==null;){if(Q=Se,(Q.flags&2048)!==0)try{switch(Q.tag){case 0:case 11:case 15:Hc(9,Q)}}catch(Ce){mt(Q,Q.return,Ce)}if(Q===z){Se=null;break e}var be=Q.sibling;if(be!==null){be.return=Q.return,Se=be;break e}Se=Q.return}}if(ze=j,Rs(),en&&typeof en.onPostCommitFiberRoot=="function")try{en.onPostCommitFiberRoot(Gr,i)}catch{}y=!0}return y}finally{Ve=m,Mn.transition=c}}return!1}function T1(i,c,m){c=bo(m,c),c=Gk(i,c,1),i=Ms(i,c,1),c=Yt(),i!==null&&(_n(i,1,c),on(i,c))}function mt(i,c,m){if(i.tag===3)T1(i,i,m);else for(;c!==null;){if(c.tag===3){T1(c,i,m);break}else if(c.tag===1){var y=c.stateNode;if(typeof c.type.getDerivedStateFromError=="function"||typeof y.componentDidCatch=="function"&&(Is===null||!Is.has(y))){i=bo(m,i),i=Kk(c,i,1),c=Ms(c,i,1),i=Yt(),c!==null&&(_n(c,1,i),on(c,i));break}}c=c.return}}function v3(i,c,m){var y=i.pingCache;y!==null&&y.delete(c),c=Yt(),i.pingedLanes|=i.suspendedLanes&m,At===i&&(Dt&m)===m&&(St===4||St===3&&(Dt&130023424)===Dt&&500>tt()-Ef?ya(i,0):_f|=m),on(i,c)}function R1(i,c){c===0&&((i.mode&1)===0?c=1:(c=na,na<<=1,(na&130023424)===0&&(na=4194304)));var m=Yt();i=ts(i,c),i!==null&&(_n(i,c,m),on(i,m))}function x3(i){var c=i.memoizedState,m=0;c!==null&&(m=c.retryLane),R1(i,m)}function b3(i,c){var m=0;switch(i.tag){case 13:var y=i.stateNode,j=i.memoizedState;j!==null&&(m=j.retryLane);break;case 19:y=i.stateNode;break;default:throw Error(n(314))}y!==null&&y.delete(c),R1(i,m)}var A1;A1=function(i,c,m){if(i!==null)if(i.memoizedProps!==c.pendingProps||nn.current)sn=!0;else{if((i.lanes&m)===0&&(c.flags&128)===0)return sn=!1,l3(i,c,m);sn=(i.flags&131072)!==0}else sn=!1,ct&&(c.flags&1048576)!==0&&uk(c,Cc,c.index);switch(c.lanes=0,c.tag){case 2:var y=c.type;zc(i,c),i=c.pendingProps;var j=fo(c,Ut.current);vo(c,m),j=rf(null,c,y,i,j,m);var C=sf();return c.flags|=1,typeof j=="object"&&j!==null&&typeof j.render=="function"&&j.$$typeof===void 0?(c.tag=1,c.memoizedState=null,c.updateQueue=null,rn(y)?(C=!0,Sc(c)):C=!1,c.memoizedState=j.state!==null&&j.state!==void 0?j.state:null,Xh(c),j.updater=Bc,c.stateNode=j,j._reactInternals=c,df(c,y,i,m),c=mf(null,c,y,!0,C,m)):(c.tag=0,ct&&C&&qh(c),Kt(null,c,j,m),c=c.child),c;case 16:y=c.elementType;e:{switch(zc(i,c),i=c.pendingProps,j=y._init,y=j(y._payload),c.type=y,j=c.tag=N3(y),i=Xn(y,i),j){case 0:c=pf(null,c,y,i,m);break e;case 1:c=r1(null,c,y,i,m);break e;case 11:c=Jk(null,c,y,i,m);break e;case 14:c=Qk(null,c,y,Xn(y.type,i),m);break e}throw Error(n(306,y,""))}return c;case 0:return y=c.type,j=c.pendingProps,j=c.elementType===y?j:Xn(y,j),pf(i,c,y,j,m);case 1:return y=c.type,j=c.pendingProps,j=c.elementType===y?j:Xn(y,j),r1(i,c,y,j,m);case 3:e:{if(s1(c),i===null)throw Error(n(387));y=c.pendingProps,C=c.memoizedState,j=C.element,vk(i,c),Ic(c,y,null,m);var z=c.memoizedState;if(y=z.element,C.isDehydrated)if(C={element:y,isDehydrated:!1,cache:z.cache,pendingSuspenseBoundaries:z.pendingSuspenseBoundaries,transitions:z.transitions},c.updateQueue.baseState=C,c.memoizedState=C,c.flags&256){j=bo(Error(n(423)),c),c=a1(i,c,y,m,j);break e}else if(y!==j){j=bo(Error(n(424)),c),c=a1(i,c,y,m,j);break e}else for(gn=Es(c.stateNode.containerInfo.firstChild),mn=c,ct=!0,Yn=null,m=yk(c,null,y,m),c.child=m;m;)m.flags=m.flags&-3|4096,m=m.sibling;else{if(go(),y===j){c=rs(i,c,m);break e}Kt(i,c,y,m)}c=c.child}return c;case 5:return kk(c),i===null&&zh(c),y=c.type,j=c.pendingProps,C=i!==null?i.memoizedProps:null,z=j.children,Ih(y,j)?z=null:C!==null&&Ih(y,C)&&(c.flags|=32),n1(i,c),Kt(i,c,z,m),c.child;case 6:return i===null&&zh(c),null;case 13:return o1(i,c,m);case 4:return Zh(c,c.stateNode.containerInfo),y=c.pendingProps,i===null?c.child=yo(c,null,y,m):Kt(i,c,y,m),c.child;case 11:return y=c.type,j=c.pendingProps,j=c.elementType===y?j:Xn(y,j),Jk(i,c,y,j,m);case 7:return Kt(i,c,c.pendingProps,m),c.child;case 8:return Kt(i,c,c.pendingProps.children,m),c.child;case 12:return Kt(i,c,c.pendingProps.children,m),c.child;case 10:e:{if(y=c.type._context,j=c.pendingProps,C=c.memoizedProps,z=j.value,nt(Ac,y._currentValue),y._currentValue=z,C!==null)if(Kn(C.value,z)){if(C.children===j.children&&!nn.current){c=rs(i,c,m);break e}}else for(C=c.child,C!==null&&(C.return=c);C!==null;){var Q=C.dependencies;if(Q!==null){z=C.child;for(var te=Q.firstContext;te!==null;){if(te.context===y){if(C.tag===1){te=ns(-1,m&-m),te.tag=2;var ce=C.updateQueue;if(ce!==null){ce=ce.shared;var we=ce.pending;we===null?te.next=te:(te.next=we.next,we.next=te),ce.pending=te}}C.lanes|=m,te=C.alternate,te!==null&&(te.lanes|=m),Kh(C.return,m,c),Q.lanes|=m;break}te=te.next}}else if(C.tag===10)z=C.type===c.type?null:C.child;else if(C.tag===18){if(z=C.return,z===null)throw Error(n(341));z.lanes|=m,Q=z.alternate,Q!==null&&(Q.lanes|=m),Kh(z,m,c),z=C.sibling}else z=C.child;if(z!==null)z.return=C;else for(z=C;z!==null;){if(z===c){z=null;break}if(C=z.sibling,C!==null){C.return=z.return,z=C;break}z=z.return}C=z}Kt(i,c,j.children,m),c=c.child}return c;case 9:return j=c.type,y=c.pendingProps.children,vo(c,m),j=Rn(j),y=y(j),c.flags|=1,Kt(i,c,y,m),c.child;case 14:return y=c.type,j=Xn(y,c.pendingProps),j=Xn(y.type,j),Qk(i,c,y,j,m);case 15:return e1(i,c,c.type,c.pendingProps,m);case 17:return y=c.type,j=c.pendingProps,j=c.elementType===y?j:Xn(y,j),zc(i,c),c.tag=1,rn(y)?(i=!0,Sc(c)):i=!1,vo(c,m),Hk(c,y,j),df(c,y,j,m),mf(null,c,y,!0,i,m);case 19:return l1(i,c,m);case 22:return t1(i,c,m)}throw Error(n(156,c.tag))};function M1(i,c){return xr(i,c)}function k3(i,c,m,y){this.tag=i,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 $n(i,c,m,y){return new k3(i,c,m,y)}function Of(i){return i=i.prototype,!(!i||!i.isReactComponent)}function N3(i){if(typeof i=="function")return Of(i)?1:0;if(i!=null){if(i=i.$$typeof,i===O)return 11;if(i===$)return 14}return 2}function Ds(i,c){var m=i.alternate;return m===null?(m=$n(i.tag,c,i.key,i.mode),m.elementType=i.elementType,m.type=i.type,m.stateNode=i.stateNode,m.alternate=i,i.alternate=m):(m.pendingProps=c,m.type=i.type,m.flags=0,m.subtreeFlags=0,m.deletions=null),m.flags=i.flags&14680064,m.childLanes=i.childLanes,m.lanes=i.lanes,m.child=i.child,m.memoizedProps=i.memoizedProps,m.memoizedState=i.memoizedState,m.updateQueue=i.updateQueue,c=i.dependencies,m.dependencies=c===null?null:{lanes:c.lanes,firstContext:c.firstContext},m.sibling=i.sibling,m.index=i.index,m.ref=i.ref,m}function eu(i,c,m,y,j,C){var z=2;if(y=i,typeof i=="function")Of(i)&&(z=1);else if(typeof i=="string")z=5;else e:switch(i){case A:return va(m.children,j,C,c);case q:z=8,j|=8;break;case L:return i=$n(12,m,c,j|2),i.elementType=L,i.lanes=C,i;case U:return i=$n(13,m,c,j),i.elementType=U,i.lanes=C,i;case M:return i=$n(19,m,c,j),i.elementType=M,i.lanes=C,i;case V:return tu(m,j,C,c);default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case P:z=10;break e;case I:z=9;break e;case O:z=11;break e;case $:z=14;break e;case B:z=16,y=null;break e}throw Error(n(130,i==null?i:typeof i,""))}return c=$n(z,m,c,j),c.elementType=i,c.type=y,c.lanes=C,c}function va(i,c,m,y){return i=$n(7,i,y,c),i.lanes=m,i}function tu(i,c,m,y){return i=$n(22,i,y,c),i.elementType=V,i.lanes=m,i.stateNode={isHidden:!1},i}function Lf(i,c,m){return i=$n(6,i,null,c),i.lanes=m,i}function Pf(i,c,m){return c=$n(4,i.children!==null?i.children:[],i.key,c),c.lanes=m,c.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},c}function j3(i,c,m,y,j){this.tag=c,this.containerInfo=i,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Ga(0),this.expirationTimes=Ga(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ga(0),this.identifierPrefix=y,this.onRecoverableError=j,this.mutableSourceEagerHydrationData=null}function Df(i,c,m,y,j,C,z,Q,te){return i=new j3(i,c,m,Q,te),c===1?(c=1,C===!0&&(c|=8)):c=0,C=$n(3,null,null,c),i.current=C,C.stateNode=i,C.memoizedState={element:y,isDehydrated:m,cache:null,transitions:null,pendingSuspenseBoundaries:null},Xh(C),i}function S3(i,c,m){var y=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:R,key:y==null?null:""+y,children:i,containerInfo:c,implementation:m}}function $1(i){if(!i)return Ts;i=i._reactInternals;e:{if(Jt(i)!==i||i.tag!==1)throw Error(n(170));var c=i;do{switch(c.tag){case 3:c=c.stateNode.context;break e;case 1:if(rn(c.type)){c=c.stateNode.__reactInternalMemoizedMergedChildContext;break e}}c=c.return}while(c!==null);throw Error(n(171))}if(i.tag===1){var m=i.type;if(rn(m))return ik(i,m,c)}return c}function I1(i,c,m,y,j,C,z,Q,te){return i=Df(m,y,!0,i,j,C,z,Q,te),i.context=$1(null),m=i.current,y=Yt(),j=Ls(m),C=ns(y,j),C.callback=c??null,Ms(m,C,j),i.current.lanes=j,_n(i,j,y),on(i,y),i}function nu(i,c,m,y){var j=c.current,C=Yt(),z=Ls(j);return m=$1(m),c.context===null?c.context=m:c.pendingContext=m,c=ns(C,z),c.payload={element:i},y=y===void 0?null:y,y!==null&&(c.callback=y),i=Ms(j,c,z),i!==null&&(Qn(i,j,z,C),$c(i,j,z)),z}function ru(i){if(i=i.current,!i.child)return null;switch(i.child.tag){case 5:return i.child.stateNode;default:return i.child.stateNode}}function O1(i,c){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var m=i.retryLane;i.retryLane=m!==0&&m<c?m:c}}function Ff(i,c){O1(i,c),(i=i.alternate)&&O1(i,c)}function _3(){return null}var L1=typeof reportError=="function"?reportError:function(i){console.error(i)};function qf(i){this._internalRoot=i}su.prototype.render=qf.prototype.render=function(i){var c=this._internalRoot;if(c===null)throw Error(n(409));nu(i,c,null,null)},su.prototype.unmount=qf.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var c=i.containerInfo;ga(function(){nu(null,i,null,null)}),c[Zr]=null}};function su(i){this._internalRoot=i}su.prototype.unstable_scheduleHydration=function(i){if(i){var c=Ni();i={blockedOn:null,target:i,priority:c};for(var m=0;m<Nr.length&&c!==0&&c<Nr[m].priority;m++);Nr.splice(m,0,i),m===0&&ks(i)}};function Bf(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11)}function au(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11&&(i.nodeType!==8||i.nodeValue!==" react-mount-point-unstable "))}function P1(){}function E3(i,c,m,y,j){if(j){if(typeof y=="function"){var C=y;y=function(){var ce=ru(z);C.call(ce)}}var z=I1(c,y,i,0,null,!1,!1,"",P1);return i._reactRootContainer=z,i[Zr]=z.current,Pi(i.nodeType===8?i.parentNode:i),ga(),z}for(;j=i.lastChild;)i.removeChild(j);if(typeof y=="function"){var Q=y;y=function(){var ce=ru(te);Q.call(ce)}}var te=Df(i,0,!1,null,null,!1,!1,"",P1);return i._reactRootContainer=te,i[Zr]=te.current,Pi(i.nodeType===8?i.parentNode:i),ga(function(){nu(c,te,m,y)}),te}function ou(i,c,m,y,j){var C=m._reactRootContainer;if(C){var z=C;if(typeof j=="function"){var Q=j;j=function(){var te=ru(z);Q.call(te)}}nu(c,z,i,j)}else z=E3(m,c,i,j,y);return ru(z)}oc=function(i){switch(i.tag){case 3:var c=i.stateNode;if(c.current.memoizedState.isDehydrated){var m=Yr(c.pendingLanes);m!==0&&(Ka(c,m|1),on(c,tt()),(ze&6)===0&&(jo=tt()+500,Rs()))}break;case 13:ga(function(){var y=ts(i,1);if(y!==null){var j=Yt();Qn(y,i,1,j)}}),Ff(i,1)}},ki=function(i){if(i.tag===13){var c=ts(i,134217728);if(c!==null){var m=Yt();Qn(c,i,134217728,m)}Ff(i,134217728)}},Xa=function(i){if(i.tag===13){var c=Ls(i),m=ts(i,c);if(m!==null){var y=Yt();Qn(m,i,c,y)}Ff(i,c)}},Ni=function(){return Ve},ic=function(i,c){var m=Ve;try{return Ve=i,c()}finally{Ve=m}},Lt=function(i,c,m){switch(c){case"input":if(xe(i,m),c=m.name,m.type==="radio"&&c!=null){for(m=i;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!==i&&y.form===i.form){var j=Nc(y);if(!j)throw Error(n(90));re(y),xe(y,j)}}}break;case"textarea":je(i,m);break;case"select":c=m.value,c!=null&&Oe(i,!!m.multiple,c,!1)}},Br=Mf,ms=ga;var C3={usingClientEntryPoint:!1,Events:[qi,uo,Nc,pr,qr,Mf]},el={findFiberByHostInstance:la,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},T3={bundleType:el.bundleType,version:el.version,rendererPackageName:el.rendererPackageName,rendererConfig:el.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:E.ReactCurrentDispatcher,findHostInstanceByFiber:function(i){return i=Qt(i),i===null?null:i.stateNode},findFiberByHostInstance:el.findFiberByHostInstance||_3,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 iu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!iu.isDisabled&&iu.supportsFiber)try{Gr=iu.inject(T3),en=iu}catch{}}return ln.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=C3,ln.createPortal=function(i,c){var m=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Bf(c))throw Error(n(200));return S3(i,c,null,m)},ln.createRoot=function(i,c){if(!Bf(i))throw Error(n(299));var m=!1,y="",j=L1;return c!=null&&(c.unstable_strictMode===!0&&(m=!0),c.identifierPrefix!==void 0&&(y=c.identifierPrefix),c.onRecoverableError!==void 0&&(j=c.onRecoverableError)),c=Df(i,1,!1,null,null,m,!1,y,j),i[Zr]=c.current,Pi(i.nodeType===8?i.parentNode:i),new qf(c)},ln.findDOMNode=function(i){if(i==null)return null;if(i.nodeType===1)return i;var c=i._reactInternals;if(c===void 0)throw typeof i.render=="function"?Error(n(188)):(i=Object.keys(i).join(","),Error(n(268,i)));return i=Qt(c),i=i===null?null:i.stateNode,i},ln.flushSync=function(i){return ga(i)},ln.hydrate=function(i,c,m){if(!au(c))throw Error(n(200));return ou(null,i,c,!0,m)},ln.hydrateRoot=function(i,c,m){if(!Bf(i))throw Error(n(405));var y=m!=null&&m.hydratedSources||null,j=!1,C="",z=L1;if(m!=null&&(m.unstable_strictMode===!0&&(j=!0),m.identifierPrefix!==void 0&&(C=m.identifierPrefix),m.onRecoverableError!==void 0&&(z=m.onRecoverableError)),c=I1(c,null,i,1,m??null,j,!1,C,z),i[Zr]=c.current,Pi(i),y)for(i=0;i<y.length;i++)m=y[i],j=m._getVersion,j=j(m._source),c.mutableSourceEagerHydrationData==null?c.mutableSourceEagerHydrationData=[m,j]:c.mutableSourceEagerHydrationData.push(m,j);return new su(c)},ln.render=function(i,c,m){if(!au(c))throw Error(n(200));return ou(null,i,c,!1,m)},ln.unmountComponentAtNode=function(i){if(!au(i))throw Error(n(40));return i._reactRootContainer?(ga(function(){ou(null,null,i,!1,function(){i._reactRootContainer=null,i[Zr]=null})}),!0):!1},ln.unstable_batchedUpdates=Mf,ln.unstable_renderSubtreeIntoContainer=function(i,c,m,y){if(!au(m))throw Error(n(200));if(i==null||i._reactInternals===void 0)throw Error(n(38));return ou(i,c,m,!1,y)},ln.version="18.3.1-next-f1338f8080-20240426",ln}var V1;function _A(){if(V1)return Wf.exports;V1=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(),Wf.exports=D3(),Wf.exports}var G1;function F3(){if(G1)return cu;G1=1;var e=_A();return cu.createRoot=e.createRoot,cu.hydrateRoot=e.hydrateRoot,cu}var q3=F3(),w=Hl();const he=Qx(w);function Ft(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=Ft(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var Gf={exports:{}},Kf={},Yf={exports:{}},Xf={};/**
|
|
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 K1;function B3(){if(K1)return Xf;K1=1;var e=Hl();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,o=e.useLayoutEffect,l=e.useDebugValue;function u(p,g){var v=g(),k=r({inst:{value:v,getSnapshot:g}}),b=k[0].inst,x=k[1];return o(function(){b.value=v,b.getSnapshot=g,d(b)&&x({inst:b})},[p,v,g]),s(function(){return d(b)&&x({inst:b}),p(function(){d(b)&&x({inst:b})})},[p]),l(v),v}function d(p){var g=p.getSnapshot;p=p.value;try{var v=g();return!n(p,v)}catch{return!0}}function h(p,g){return g()}var f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?h:u;return Xf.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:f,Xf}var Y1;function U3(){return Y1||(Y1=1,Yf.exports=B3()),Yf.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 X1;function z3(){if(X1)return Kf;X1=1;var e=Hl(),t=U3();function n(h,f){return h===f&&(h!==0||1/h===1/f)||h!==h&&f!==f}var r=typeof Object.is=="function"?Object.is:n,s=t.useSyncExternalStore,o=e.useRef,l=e.useEffect,u=e.useMemo,d=e.useDebugValue;return Kf.useSyncExternalStoreWithSelector=function(h,f,p,g,v){var k=o(null);if(k.current===null){var b={hasValue:!1,value:null};k.current=b}else b=k.current;k=u(function(){function N(R){if(!S){if(S=!0,_=R,R=g(R),v!==void 0&&b.hasValue){var A=b.value;if(v(A,R))return E=A}return E=R}if(A=E,r(_,R))return A;var q=g(R);return v!==void 0&&v(A,q)?(_=R,A):(_=R,E=q)}var S=!1,_,E,T=p===void 0?null:p;return[function(){return N(f())},T===null?void 0:function(){return N(T())}]},[f,p,g,v]);var x=s(h,k[0],k[1]);return l(function(){b.hasValue=!0,b.value=x},[x]),d(x),x},Kf}var Z1;function W3(){return Z1||(Z1=1,Gf.exports=z3()),Gf.exports}var H3=W3();const V3=Qx(H3),G3={},J1=e=>{let t;const n=new Set,r=(f,p)=>{const g=typeof f=="function"?f(t):f;if(!Object.is(g,t)){const v=t;t=p??(typeof g!="object"||g===null)?g:Object.assign({},t,g),n.forEach(k=>k(t,v))}},s=()=>t,d={setState:r,getState:s,getInitialState:()=>h,subscribe:f=>(n.add(f),()=>n.delete(f)),destroy:()=>{(G3?"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()}},h=t=e(r,s,d);return d},K3=e=>e?J1(e):J1,{useDebugValue:Y3}=he,{useSyncExternalStoreWithSelector:X3}=V3,Z3=e=>e;function EA(e,t=Z3,n){const r=X3(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Y3(r),r}const Q1=(e,t)=>{const n=K3(e),r=(s,o=t)=>EA(n,s,o);return Object.assign(r,n),r},J3=(e,t)=>e?Q1(e,t):Q1;function Tt(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 Q3={value:()=>{}};function _d(){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 Lu(n)}function Lu(e){this._=e}function eP(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}})}Lu.prototype=_d.prototype={constructor:Lu,on:function(e,t){var n=this._,r=eP(e+"",n),s,o=-1,l=r.length;if(arguments.length<2){for(;++o<l;)if((s=(e=r[o]).type)&&(s=tP(n[s],e.name)))return s;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++o<l;)if(s=(e=r[o]).type)n[s]=eN(n[s],e.name,t);else if(t==null)for(s in n)n[s]=eN(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 Lu(e)},call:function(e,t){if((s=arguments.length-2)>0)for(var n=new Array(s),r=0,s,o;r<s;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(o=this._[e],r=0,s=o.length;r<s;++r)o[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,o=r.length;s<o;++s)r[s].value.apply(t,n)}};function tP(e,t){for(var n=0,r=e.length,s;n<r;++n)if((s=e[n]).name===t)return s.value}function eN(e,t,n){for(var r=0,s=e.length;r<s;++r)if(e[r].name===t){e[r]=Q3,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var Vv="http://www.w3.org/1999/xhtml";const tN={svg:"http://www.w3.org/2000/svg",xhtml:Vv,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Ed(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),tN.hasOwnProperty(t)?{space:tN[t],local:e}:e}function nP(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Vv&&t.documentElement.namespaceURI===Vv?t.createElement(e):t.createElementNS(n,e)}}function rP(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function CA(e){var t=Ed(e);return(t.local?rP:nP)(t)}function sP(){}function eb(e){return e==null?sP:function(){return this.querySelector(e)}}function aP(e){typeof e!="function"&&(e=eb(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s)for(var o=t[s],l=o.length,u=r[s]=new Array(l),d,h,f=0;f<l;++f)(d=o[f])&&(h=e.call(d,d.__data__,f,o))&&("__data__"in d&&(h.__data__=d.__data__),u[f]=h);return new kn(r,this._parents)}function oP(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function iP(){return[]}function TA(e){return e==null?iP:function(){return this.querySelectorAll(e)}}function lP(e){return function(){return oP(e.apply(this,arguments))}}function cP(e){typeof e=="function"?e=lP(e):e=TA(e);for(var t=this._groups,n=t.length,r=[],s=[],o=0;o<n;++o)for(var l=t[o],u=l.length,d,h=0;h<u;++h)(d=l[h])&&(r.push(e.call(d,d.__data__,h,l)),s.push(d));return new kn(r,s)}function RA(e){return function(){return this.matches(e)}}function AA(e){return function(t){return t.matches(e)}}var uP=Array.prototype.find;function dP(e){return function(){return uP.call(this.children,e)}}function hP(){return this.firstElementChild}function fP(e){return this.select(e==null?hP:dP(typeof e=="function"?e:AA(e)))}var pP=Array.prototype.filter;function mP(){return Array.from(this.children)}function gP(e){return function(){return pP.call(this.children,e)}}function yP(e){return this.selectAll(e==null?mP:gP(typeof e=="function"?e:AA(e)))}function wP(e){typeof e!="function"&&(e=RA(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s)for(var o=t[s],l=o.length,u=r[s]=[],d,h=0;h<l;++h)(d=o[h])&&e.call(d,d.__data__,h,o)&&u.push(d);return new kn(r,this._parents)}function MA(e){return new Array(e.length)}function vP(){return new kn(this._enter||this._groups.map(MA),this._parents)}function Yu(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Yu.prototype={constructor:Yu,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 xP(e){return function(){return e}}function bP(e,t,n,r,s,o){for(var l=0,u,d=t.length,h=o.length;l<h;++l)(u=t[l])?(u.__data__=o[l],r[l]=u):n[l]=new Yu(e,o[l]);for(;l<d;++l)(u=t[l])&&(s[l]=u)}function kP(e,t,n,r,s,o,l){var u,d,h=new Map,f=t.length,p=o.length,g=new Array(f),v;for(u=0;u<f;++u)(d=t[u])&&(g[u]=v=l.call(d,d.__data__,u,t)+"",h.has(v)?s[u]=d:h.set(v,d));for(u=0;u<p;++u)v=l.call(e,o[u],u,o)+"",(d=h.get(v))?(r[u]=d,d.__data__=o[u],h.delete(v)):n[u]=new Yu(e,o[u]);for(u=0;u<f;++u)(d=t[u])&&h.get(g[u])===d&&(s[u]=d)}function NP(e){return e.__data__}function jP(e,t){if(!arguments.length)return Array.from(this,NP);var n=t?kP:bP,r=this._parents,s=this._groups;typeof e!="function"&&(e=xP(e));for(var o=s.length,l=new Array(o),u=new Array(o),d=new Array(o),h=0;h<o;++h){var f=r[h],p=s[h],g=p.length,v=SP(e.call(f,f&&f.__data__,h,r)),k=v.length,b=u[h]=new Array(k),x=l[h]=new Array(k),N=d[h]=new Array(g);n(f,p,b,x,N,v,t);for(var S=0,_=0,E,T;S<k;++S)if(E=b[S]){for(S>=_&&(_=S+1);!(T=x[_])&&++_<k;);E._next=T||null}}return l=new kn(l,r),l._enter=u,l._exit=d,l}function SP(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function _P(){return new kn(this._exit||this._groups.map(MA),this._parents)}function EP(e,t,n){var r=this.enter(),s=this,o=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?o.remove():n(o),r&&s?r.merge(s).order():s}function CP(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,s=n.length,o=r.length,l=Math.min(s,o),u=new Array(s),d=0;d<l;++d)for(var h=n[d],f=r[d],p=h.length,g=u[d]=new Array(p),v,k=0;k<p;++k)(v=h[k]||f[k])&&(g[k]=v);for(;d<s;++d)u[d]=n[d];return new kn(u,this._parents)}function TP(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],s=r.length-1,o=r[s],l;--s>=0;)(l=r[s])&&(o&&l.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(l,o),o=l);return this}function RP(e){e||(e=AP);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),o=0;o<r;++o){for(var l=n[o],u=l.length,d=s[o]=new Array(u),h,f=0;f<u;++f)(h=l[f])&&(d[f]=h);d.sort(t)}return new kn(s,this._parents).order()}function AP(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function MP(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function $P(){return Array.from(this)}function IP(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],s=0,o=r.length;s<o;++s){var l=r[s];if(l)return l}return null}function OP(){let e=0;for(const t of this)++e;return e}function LP(){return!this.node()}function PP(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var s=t[n],o=0,l=s.length,u;o<l;++o)(u=s[o])&&e.call(u,u.__data__,o,s);return this}function DP(e){return function(){this.removeAttribute(e)}}function FP(e){return function(){this.removeAttributeNS(e.space,e.local)}}function qP(e,t){return function(){this.setAttribute(e,t)}}function BP(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function UP(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function zP(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 WP(e,t){var n=Ed(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?FP:DP:typeof t=="function"?n.local?zP:UP:n.local?BP:qP)(n,t))}function $A(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function HP(e){return function(){this.style.removeProperty(e)}}function VP(e,t,n){return function(){this.style.setProperty(e,t,n)}}function GP(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function KP(e,t,n){return arguments.length>1?this.each((t==null?HP:typeof t=="function"?GP:VP)(e,t,n??"")):Jo(this.node(),e)}function Jo(e,t){return e.style.getPropertyValue(t)||$A(e).getComputedStyle(e,null).getPropertyValue(t)}function YP(e){return function(){delete this[e]}}function XP(e,t){return function(){this[e]=t}}function ZP(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function JP(e,t){return arguments.length>1?this.each((t==null?YP:typeof t=="function"?ZP:XP)(e,t)):this.node()[e]}function IA(e){return e.trim().split(/^|\s+/)}function tb(e){return e.classList||new OA(e)}function OA(e){this._node=e,this._names=IA(e.getAttribute("class")||"")}OA.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 LA(e,t){for(var n=tb(e),r=-1,s=t.length;++r<s;)n.add(t[r])}function PA(e,t){for(var n=tb(e),r=-1,s=t.length;++r<s;)n.remove(t[r])}function QP(e){return function(){LA(this,e)}}function e4(e){return function(){PA(this,e)}}function t4(e,t){return function(){(t.apply(this,arguments)?LA:PA)(this,e)}}function n4(e,t){var n=IA(e+"");if(arguments.length<2){for(var r=tb(this.node()),s=-1,o=n.length;++s<o;)if(!r.contains(n[s]))return!1;return!0}return this.each((typeof t=="function"?t4:t?QP:e4)(n,t))}function r4(){this.textContent=""}function s4(e){return function(){this.textContent=e}}function a4(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function o4(e){return arguments.length?this.each(e==null?r4:(typeof e=="function"?a4:s4)(e)):this.node().textContent}function i4(){this.innerHTML=""}function l4(e){return function(){this.innerHTML=e}}function c4(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function u4(e){return arguments.length?this.each(e==null?i4:(typeof e=="function"?c4:l4)(e)):this.node().innerHTML}function d4(){this.nextSibling&&this.parentNode.appendChild(this)}function h4(){return this.each(d4)}function f4(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function p4(){return this.each(f4)}function m4(e){var t=typeof e=="function"?e:CA(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function g4(){return null}function y4(e,t){var n=typeof e=="function"?e:CA(e),r=t==null?g4:typeof t=="function"?t:eb(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function w4(){var e=this.parentNode;e&&e.removeChild(this)}function v4(){return this.each(w4)}function x4(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function b4(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function k4(e){return this.select(e?b4:x4)}function N4(e){return arguments.length?this.property("__data__",e):this.node().__data__}function j4(e){return function(t){e.call(this,t,this.__data__)}}function S4(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 _4(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,s=t.length,o;n<s;++n)o=t[n],(!e.type||o.type===e.type)&&o.name===e.name?this.removeEventListener(o.type,o.listener,o.options):t[++r]=o;++r?t.length=r:delete this.__on}}}function E4(e,t,n){return function(){var r=this.__on,s,o=j4(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=o,s.options=n),s.value=t;return}}this.addEventListener(e.type,o,n),s={type:e.type,name:e.name,value:t,listener:o,options:n},r?r.push(s):this.__on=[s]}}function C4(e,t,n){var r=S4(e+""),s,o=r.length,l;if(arguments.length<2){var u=this.node().__on;if(u){for(var d=0,h=u.length,f;d<h;++d)for(s=0,f=u[d];s<o;++s)if((l=r[s]).type===f.type&&l.name===f.name)return f.value}return}for(u=t?E4:_4,s=0;s<o;++s)this.each(u(r[s],t,n));return this}function DA(e,t,n){var r=$A(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 T4(e,t){return function(){return DA(this,e,t)}}function R4(e,t){return function(){return DA(this,e,t.apply(this,arguments))}}function A4(e,t){return this.each((typeof t=="function"?R4:T4)(e,t))}function*M4(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],s=0,o=r.length,l;s<o;++s)(l=r[s])&&(yield l)}var FA=[null];function kn(e,t){this._groups=e,this._parents=t}function Vl(){return new kn([[document.documentElement]],FA)}function $4(){return this}kn.prototype=Vl.prototype={constructor:kn,select:aP,selectAll:cP,selectChild:fP,selectChildren:yP,filter:wP,data:jP,enter:vP,exit:_P,join:EP,merge:CP,selection:$4,order:TP,sort:RP,call:MP,nodes:$P,node:IP,size:OP,empty:LP,each:PP,attr:WP,style:KP,property:JP,classed:n4,text:o4,html:u4,raise:h4,lower:p4,append:m4,insert:y4,remove:v4,clone:k4,datum:N4,on:C4,dispatch:A4,[Symbol.iterator]:M4};function Pn(e){return typeof e=="string"?new kn([[document.querySelector(e)]],[document.documentElement]):new kn([[e]],FA)}function I4(e){let t;for(;t=e.sourceEvent;)e=t;return e}function rr(e,t){if(e=I4(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 O4={passive:!1},kl={capture:!0,passive:!1};function Zf(e){e.stopImmediatePropagation()}function Ho(e){e.preventDefault(),e.stopImmediatePropagation()}function qA(e){var t=e.document.documentElement,n=Pn(e).on("dragstart.drag",Ho,kl);"onselectstart"in t?n.on("selectstart.drag",Ho,kl):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function BA(e,t){var n=e.document.documentElement,r=Pn(e).on("dragstart.drag",null);t&&(r.on("click.drag",Ho,kl),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 uu=e=>()=>e;function Gv(e,{sourceEvent:t,subject:n,target:r,identifier:s,active:o,x:l,y:u,dx:d,dy:h,dispatch:f}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:s,enumerable:!0,configurable:!0},active:{value:o,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:h,enumerable:!0,configurable:!0},_:{value:f}})}Gv.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function L4(e){return!e.ctrlKey&&!e.button}function P4(){return this.parentNode}function D4(e,t){return t??{x:e.x,y:e.y}}function F4(){return navigator.maxTouchPoints||"ontouchstart"in this}function q4(){var e=L4,t=P4,n=D4,r=F4,s={},o=_d("start","drag","end"),l=0,u,d,h,f,p=0;function g(E){E.on("mousedown.drag",v).filter(r).on("touchstart.drag",x).on("touchmove.drag",N,O4).on("touchend.drag touchcancel.drag",S).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function v(E,T){if(!(f||!e.call(this,E,T))){var R=_(this,t.call(this,E,T),E,T,"mouse");R&&(Pn(E.view).on("mousemove.drag",k,kl).on("mouseup.drag",b,kl),qA(E.view),Zf(E),h=!1,u=E.clientX,d=E.clientY,R("start",E))}}function k(E){if(Ho(E),!h){var T=E.clientX-u,R=E.clientY-d;h=T*T+R*R>p}s.mouse("drag",E)}function b(E){Pn(E.view).on("mousemove.drag mouseup.drag",null),BA(E.view,h),Ho(E),s.mouse("end",E)}function x(E,T){if(e.call(this,E,T)){var R=E.changedTouches,A=t.call(this,E,T),q=R.length,L,P;for(L=0;L<q;++L)(P=_(this,A,E,T,R[L].identifier,R[L]))&&(Zf(E),P("start",E,R[L]))}}function N(E){var T=E.changedTouches,R=T.length,A,q;for(A=0;A<R;++A)(q=s[T[A].identifier])&&(Ho(E),q("drag",E,T[A]))}function S(E){var T=E.changedTouches,R=T.length,A,q;for(f&&clearTimeout(f),f=setTimeout(function(){f=null},500),A=0;A<R;++A)(q=s[T[A].identifier])&&(Zf(E),q("end",E,T[A]))}function _(E,T,R,A,q,L){var P=o.copy(),I=rr(L||R,T),O,U,M;if((M=n.call(E,new Gv("beforestart",{sourceEvent:R,target:g,identifier:q,active:l,x:I[0],y:I[1],dx:0,dy:0,dispatch:P}),A))!=null)return O=M.x-I[0]||0,U=M.y-I[1]||0,function $(B,V,H){var F=I,W;switch(B){case"start":s[q]=$,W=l++;break;case"end":delete s[q],--l;case"drag":I=rr(H||V,T),W=l;break}P.call(B,E,new Gv(B,{sourceEvent:V,subject:M,target:g,identifier:q,active:W,x:I[0]+O,y:I[1]+U,dx:I[0]-F[0],dy:I[1]-F[1],dispatch:P}),A)}}return g.filter=function(E){return arguments.length?(e=typeof E=="function"?E:uu(!!E),g):e},g.container=function(E){return arguments.length?(t=typeof E=="function"?E:uu(E),g):t},g.subject=function(E){return arguments.length?(n=typeof E=="function"?E:uu(E),g):n},g.touchable=function(E){return arguments.length?(r=typeof E=="function"?E:uu(!!E),g):r},g.on=function(){var E=o.on.apply(o,arguments);return E===o?g:E},g.clickDistance=function(E){return arguments.length?(p=(E=+E)*E,g):Math.sqrt(p)},g}function nb(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function UA(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function Gl(){}var Nl=.7,Xu=1/Nl,Vo="\\s*([+-]?\\d+)\\s*",jl="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",$r="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",B4=/^#([0-9a-f]{3,8})$/,U4=new RegExp(`^rgb\\(${Vo},${Vo},${Vo}\\)$`),z4=new RegExp(`^rgb\\(${$r},${$r},${$r}\\)$`),W4=new RegExp(`^rgba\\(${Vo},${Vo},${Vo},${jl}\\)$`),H4=new RegExp(`^rgba\\(${$r},${$r},${$r},${jl}\\)$`),V4=new RegExp(`^hsl\\(${jl},${$r},${$r}\\)$`),G4=new RegExp(`^hsla\\(${jl},${$r},${$r},${jl}\\)$`),nN={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};nb(Gl,Sl,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:rN,formatHex:rN,formatHex8:K4,formatHsl:Y4,formatRgb:sN,toString:sN});function rN(){return this.rgb().formatHex()}function K4(){return this.rgb().formatHex8()}function Y4(){return zA(this).formatHsl()}function sN(){return this.rgb().formatRgb()}function Sl(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=B4.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?aN(t):n===3?new un(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?du(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?du(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=U4.exec(e))?new un(t[1],t[2],t[3],1):(t=z4.exec(e))?new un(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=W4.exec(e))?du(t[1],t[2],t[3],t[4]):(t=H4.exec(e))?du(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=V4.exec(e))?lN(t[1],t[2]/100,t[3]/100,1):(t=G4.exec(e))?lN(t[1],t[2]/100,t[3]/100,t[4]):nN.hasOwnProperty(e)?aN(nN[e]):e==="transparent"?new un(NaN,NaN,NaN,0):null}function aN(e){return new un(e>>16&255,e>>8&255,e&255,1)}function du(e,t,n,r){return r<=0&&(e=t=n=NaN),new un(e,t,n,r)}function X4(e){return e instanceof Gl||(e=Sl(e)),e?(e=e.rgb(),new un(e.r,e.g,e.b,e.opacity)):new un}function Kv(e,t,n,r){return arguments.length===1?X4(e):new un(e,t,n,r??1)}function un(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}nb(un,Kv,UA(Gl,{brighter(e){return e=e==null?Xu:Math.pow(Xu,e),new un(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Nl:Math.pow(Nl,e),new un(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new un(Ca(this.r),Ca(this.g),Ca(this.b),Zu(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:oN,formatHex:oN,formatHex8:Z4,formatRgb:iN,toString:iN}));function oN(){return`#${Sa(this.r)}${Sa(this.g)}${Sa(this.b)}`}function Z4(){return`#${Sa(this.r)}${Sa(this.g)}${Sa(this.b)}${Sa((isNaN(this.opacity)?1:this.opacity)*255)}`}function iN(){const e=Zu(this.opacity);return`${e===1?"rgb(":"rgba("}${Ca(this.r)}, ${Ca(this.g)}, ${Ca(this.b)}${e===1?")":`, ${e})`}`}function Zu(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Ca(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Sa(e){return e=Ca(e),(e<16?"0":"")+e.toString(16)}function lN(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new sr(e,t,n,r)}function zA(e){if(e instanceof sr)return new sr(e.h,e.s,e.l,e.opacity);if(e instanceof Gl||(e=Sl(e)),!e)return new sr;if(e instanceof sr)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,s=Math.min(t,n,r),o=Math.max(t,n,r),l=NaN,u=o-s,d=(o+s)/2;return u?(t===o?l=(n-r)/u+(n<r)*6:n===o?l=(r-t)/u+2:l=(t-n)/u+4,u/=d<.5?o+s:2-o-s,l*=60):u=d>0&&d<1?0:l,new sr(l,u,d,e.opacity)}function J4(e,t,n,r){return arguments.length===1?zA(e):new sr(e,t,n,r??1)}function sr(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}nb(sr,J4,UA(Gl,{brighter(e){return e=e==null?Xu:Math.pow(Xu,e),new sr(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Nl:Math.pow(Nl,e),new sr(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 un(Jf(e>=240?e-240:e+120,s,r),Jf(e,s,r),Jf(e<120?e+240:e-120,s,r),this.opacity)},clamp(){return new sr(cN(this.h),hu(this.s),hu(this.l),Zu(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=Zu(this.opacity);return`${e===1?"hsl(":"hsla("}${cN(this.h)}, ${hu(this.s)*100}%, ${hu(this.l)*100}%${e===1?")":`, ${e})`}`}}));function cN(e){return e=(e||0)%360,e<0?e+360:e}function hu(e){return Math.max(0,Math.min(1,e||0))}function Jf(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 WA=e=>()=>e;function Q4(e,t){return function(n){return e+n*t}}function eD(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 tD(e){return(e=+e)==1?HA:function(t,n){return n-t?eD(t,n,e):WA(isNaN(t)?n:t)}}function HA(e,t){var n=t-e;return n?Q4(e,n):WA(isNaN(e)?t:e)}const uN=(function e(t){var n=tD(t);function r(s,o){var l=n((s=Kv(s)).r,(o=Kv(o)).r),u=n(s.g,o.g),d=n(s.b,o.b),h=HA(s.opacity,o.opacity);return function(f){return s.r=l(f),s.g=u(f),s.b=d(f),s.opacity=h(f),s+""}}return r.gamma=e,r})(1);function Us(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var Yv=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Qf=new RegExp(Yv.source,"g");function nD(e){return function(){return e}}function rD(e){return function(t){return e(t)+""}}function sD(e,t){var n=Yv.lastIndex=Qf.lastIndex=0,r,s,o,l=-1,u=[],d=[];for(e=e+"",t=t+"";(r=Yv.exec(e))&&(s=Qf.exec(t));)(o=s.index)>n&&(o=t.slice(n,o),u[l]?u[l]+=o:u[++l]=o),(r=r[0])===(s=s[0])?u[l]?u[l]+=s:u[++l]=s:(u[++l]=null,d.push({i:l,x:Us(r,s)})),n=Qf.lastIndex;return n<t.length&&(o=t.slice(n),u[l]?u[l]+=o:u[++l]=o),u.length<2?d[0]?rD(d[0].x):nD(t):(t=d.length,function(h){for(var f=0,p;f<t;++f)u[(p=d[f]).i]=p.x(h);return u.join("")})}var dN=180/Math.PI,Xv={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function VA(e,t,n,r,s,o){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:o,rotate:Math.atan2(t,e)*dN,skewX:Math.atan(d)*dN,scaleX:l,scaleY:u}}var fu;function aD(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Xv:VA(t.a,t.b,t.c,t.d,t.e,t.f)}function oD(e){return e==null||(fu||(fu=document.createElementNS("http://www.w3.org/2000/svg","g")),fu.setAttribute("transform",e),!(e=fu.transform.baseVal.consolidate()))?Xv:(e=e.matrix,VA(e.a,e.b,e.c,e.d,e.e,e.f))}function GA(e,t,n,r){function s(h){return h.length?h.pop()+" ":""}function o(h,f,p,g,v,k){if(h!==p||f!==g){var b=v.push("translate(",null,t,null,n);k.push({i:b-4,x:Us(h,p)},{i:b-2,x:Us(f,g)})}else(p||g)&&v.push("translate("+p+t+g+n)}function l(h,f,p,g){h!==f?(h-f>180?f+=360:f-h>180&&(h+=360),g.push({i:p.push(s(p)+"rotate(",null,r)-2,x:Us(h,f)})):f&&p.push(s(p)+"rotate("+f+r)}function u(h,f,p,g){h!==f?g.push({i:p.push(s(p)+"skewX(",null,r)-2,x:Us(h,f)}):f&&p.push(s(p)+"skewX("+f+r)}function d(h,f,p,g,v,k){if(h!==p||f!==g){var b=v.push(s(v)+"scale(",null,",",null,")");k.push({i:b-4,x:Us(h,p)},{i:b-2,x:Us(f,g)})}else(p!==1||g!==1)&&v.push(s(v)+"scale("+p+","+g+")")}return function(h,f){var p=[],g=[];return h=e(h),f=e(f),o(h.translateX,h.translateY,f.translateX,f.translateY,p,g),l(h.rotate,f.rotate,p,g),u(h.skewX,f.skewX,p,g),d(h.scaleX,h.scaleY,f.scaleX,f.scaleY,p,g),h=f=null,function(v){for(var k=-1,b=g.length,x;++k<b;)p[(x=g[k]).i]=x.x(v);return p.join("")}}}var iD=GA(aD,"px, ","px)","deg)"),lD=GA(oD,", ",")",")"),cD=1e-12;function hN(e){return((e=Math.exp(e))+1/e)/2}function uD(e){return((e=Math.exp(e))-1/e)/2}function dD(e){return((e=Math.exp(2*e))-1)/(e+1)}const hD=(function e(t,n,r){function s(o,l){var u=o[0],d=o[1],h=o[2],f=l[0],p=l[1],g=l[2],v=f-u,k=p-d,b=v*v+k*k,x,N;if(b<cD)N=Math.log(g/h)/t,x=function(A){return[u+A*v,d+A*k,h*Math.exp(t*A*N)]};else{var S=Math.sqrt(b),_=(g*g-h*h+r*b)/(2*h*n*S),E=(g*g-h*h-r*b)/(2*g*n*S),T=Math.log(Math.sqrt(_*_+1)-_),R=Math.log(Math.sqrt(E*E+1)-E);N=(R-T)/t,x=function(A){var q=A*N,L=hN(T),P=h/(n*S)*(L*dD(t*q+T)-uD(T));return[u+P*v,d+P*k,h*L/hN(t*q+T)]}}return x.duration=N*1e3*t/Math.SQRT2,x}return s.rho=function(o){var l=Math.max(.001,+o),u=l*l,d=u*u;return e(l,u,d)},s})(Math.SQRT2,2,4);var Qo=0,cl=0,nl=0,KA=1e3,Ju,ul,Qu=0,$a=0,Cd=0,_l=typeof performance=="object"&&performance.now?performance:Date,YA=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function rb(){return $a||(YA(fD),$a=_l.now()+Cd)}function fD(){$a=0}function ed(){this._call=this._time=this._next=null}ed.prototype=XA.prototype={constructor:ed,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?rb():+n)+(t==null?0:+t),!this._next&&ul!==this&&(ul?ul._next=this:Ju=this,ul=this),this._call=e,this._time=n,Zv()},stop:function(){this._call&&(this._call=null,this._time=1/0,Zv())}};function XA(e,t,n){var r=new ed;return r.restart(e,t,n),r}function pD(){rb(),++Qo;for(var e=Ju,t;e;)(t=$a-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Qo}function fN(){$a=(Qu=_l.now())+Cd,Qo=cl=0;try{pD()}finally{Qo=0,gD(),$a=0}}function mD(){var e=_l.now(),t=e-Qu;t>KA&&(Cd-=t,Qu=e)}function gD(){for(var e,t=Ju,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:Ju=n);ul=e,Zv(r)}function Zv(e){if(!Qo){cl&&(cl=clearTimeout(cl));var t=e-$a;t>24?(e<1/0&&(cl=setTimeout(fN,e-_l.now()-Cd)),nl&&(nl=clearInterval(nl))):(nl||(Qu=_l.now(),nl=setInterval(mD,KA)),Qo=1,YA(fN))}}function pN(e,t,n){var r=new ed;return t=t==null?0:+t,r.restart(s=>{r.stop(),e(s+t)},t,n),r}var yD=_d("start","end","cancel","interrupt"),wD=[],ZA=0,mN=1,Jv=2,Pu=3,gN=4,Qv=5,Du=6;function Td(e,t,n,r,s,o){var l=e.__transition;if(!l)e.__transition={};else if(n in l)return;vD(e,n,{name:t,index:r,group:s,on:yD,tween:wD,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:ZA})}function sb(e,t){var n=dr(e,t);if(n.state>ZA)throw new Error("too late; already scheduled");return n}function Dr(e,t){var n=dr(e,t);if(n.state>Pu)throw new Error("too late; already running");return n}function dr(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function vD(e,t,n){var r=e.__transition,s;r[t]=n,n.timer=XA(o,0,n.time);function o(h){n.state=mN,n.timer.restart(l,n.delay,n.time),n.delay<=h&&l(h-n.delay)}function l(h){var f,p,g,v;if(n.state!==mN)return d();for(f in r)if(v=r[f],v.name===n.name){if(v.state===Pu)return pN(l);v.state===gN?(v.state=Du,v.timer.stop(),v.on.call("interrupt",e,e.__data__,v.index,v.group),delete r[f]):+f<t&&(v.state=Du,v.timer.stop(),v.on.call("cancel",e,e.__data__,v.index,v.group),delete r[f])}if(pN(function(){n.state===Pu&&(n.state=gN,n.timer.restart(u,n.delay,n.time),u(h))}),n.state=Jv,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Jv){for(n.state=Pu,s=new Array(g=n.tween.length),f=0,p=-1;f<g;++f)(v=n.tween[f].value.call(e,e.__data__,n.index,n.group))&&(s[++p]=v);s.length=p+1}}function u(h){for(var f=h<n.duration?n.ease.call(null,h/n.duration):(n.timer.restart(d),n.state=Qv,1),p=-1,g=s.length;++p<g;)s[p].call(e,f);n.state===Qv&&(n.on.call("end",e,e.__data__,n.index,n.group),d())}function d(){n.state=Du,n.timer.stop(),delete r[t];for(var h in r)return;delete e.__transition}}function Fu(e,t){var n=e.__transition,r,s,o=!0,l;if(n){t=t==null?null:t+"";for(l in n){if((r=n[l]).name!==t){o=!1;continue}s=r.state>Jv&&r.state<Qv,r.state=Du,r.timer.stop(),r.on.call(s?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[l]}o&&delete e.__transition}}function xD(e){return this.each(function(){Fu(this,e)})}function bD(e,t){var n,r;return function(){var s=Dr(this,e),o=s.tween;if(o!==n){r=n=o;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 kD(e,t,n){var r,s;if(typeof n!="function")throw new Error;return function(){var o=Dr(this,e),l=o.tween;if(l!==r){s=(r=l).slice();for(var u={name:t,value:n},d=0,h=s.length;d<h;++d)if(s[d].name===t){s[d]=u;break}d===h&&s.push(u)}o.tween=s}}function ND(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=dr(this.node(),n).tween,s=0,o=r.length,l;s<o;++s)if((l=r[s]).name===e)return l.value;return null}return this.each((t==null?bD:kD)(n,e,t))}function ab(e,t,n){var r=e._id;return e.each(function(){var s=Dr(this,r);(s.value||(s.value={}))[t]=n.apply(this,arguments)}),function(s){return dr(s,r).value[t]}}function JA(e,t){var n;return(typeof t=="number"?Us:t instanceof Sl?uN:(n=Sl(t))?(t=n,uN):sD)(e,t)}function jD(e){return function(){this.removeAttribute(e)}}function SD(e){return function(){this.removeAttributeNS(e.space,e.local)}}function _D(e,t,n){var r,s=n+"",o;return function(){var l=this.getAttribute(e);return l===s?null:l===r?o:o=t(r=l,n)}}function ED(e,t,n){var r,s=n+"",o;return function(){var l=this.getAttributeNS(e.space,e.local);return l===s?null:l===r?o:o=t(r=l,n)}}function CD(e,t,n){var r,s,o;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?o:(s=d,o=t(r=l,u)))}}function TD(e,t,n){var r,s,o;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?o:(s=d,o=t(r=l,u)))}}function RD(e,t){var n=Ed(e),r=n==="transform"?lD:JA;return this.attrTween(e,typeof t=="function"?(n.local?TD:CD)(n,r,ab(this,"attr."+e,t)):t==null?(n.local?SD:jD)(n):(n.local?ED:_D)(n,r,t))}function AD(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function MD(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function $D(e,t){var n,r;function s(){var o=t.apply(this,arguments);return o!==r&&(n=(r=o)&&MD(e,o)),n}return s._value=t,s}function ID(e,t){var n,r;function s(){var o=t.apply(this,arguments);return o!==r&&(n=(r=o)&&AD(e,o)),n}return s._value=t,s}function OD(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=Ed(e);return this.tween(n,(r.local?$D:ID)(r,t))}function LD(e,t){return function(){sb(this,e).delay=+t.apply(this,arguments)}}function PD(e,t){return t=+t,function(){sb(this,e).delay=t}}function DD(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?LD:PD)(t,e)):dr(this.node(),t).delay}function FD(e,t){return function(){Dr(this,e).duration=+t.apply(this,arguments)}}function qD(e,t){return t=+t,function(){Dr(this,e).duration=t}}function BD(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?FD:qD)(t,e)):dr(this.node(),t).duration}function UD(e,t){if(typeof t!="function")throw new Error;return function(){Dr(this,e).ease=t}}function zD(e){var t=this._id;return arguments.length?this.each(UD(t,e)):dr(this.node(),t).ease}function WD(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Dr(this,e).ease=n}}function HD(e){if(typeof e!="function")throw new Error;return this.each(WD(this._id,e))}function VD(e){typeof e!="function"&&(e=RA(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s)for(var o=t[s],l=o.length,u=r[s]=[],d,h=0;h<l;++h)(d=o[h])&&e.call(d,d.__data__,h,o)&&u.push(d);return new cs(r,this._parents,this._name,this._id)}function GD(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,s=n.length,o=Math.min(r,s),l=new Array(r),u=0;u<o;++u)for(var d=t[u],h=n[u],f=d.length,p=l[u]=new Array(f),g,v=0;v<f;++v)(g=d[v]||h[v])&&(p[v]=g);for(;u<r;++u)l[u]=t[u];return new cs(l,this._parents,this._name,this._id)}function KD(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 YD(e,t,n){var r,s,o=KD(t)?sb:Dr;return function(){var l=o(this,e),u=l.on;u!==r&&(s=(r=u).copy()).on(t,n),l.on=s}}function XD(e,t){var n=this._id;return arguments.length<2?dr(this.node(),n).on.on(e):this.each(YD(n,e,t))}function ZD(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function JD(){return this.on("end.remove",ZD(this._id))}function QD(e){var t=this._name,n=this._id;typeof e!="function"&&(e=eb(e));for(var r=this._groups,s=r.length,o=new Array(s),l=0;l<s;++l)for(var u=r[l],d=u.length,h=o[l]=new Array(d),f,p,g=0;g<d;++g)(f=u[g])&&(p=e.call(f,f.__data__,g,u))&&("__data__"in f&&(p.__data__=f.__data__),h[g]=p,Td(h[g],t,n,g,h,dr(f,n)));return new cs(o,this._parents,t,n)}function e5(e){var t=this._name,n=this._id;typeof e!="function"&&(e=TA(e));for(var r=this._groups,s=r.length,o=[],l=[],u=0;u<s;++u)for(var d=r[u],h=d.length,f,p=0;p<h;++p)if(f=d[p]){for(var g=e.call(f,f.__data__,p,d),v,k=dr(f,n),b=0,x=g.length;b<x;++b)(v=g[b])&&Td(v,t,n,b,g,k);o.push(g),l.push(f)}return new cs(o,l,t,n)}var t5=Vl.prototype.constructor;function n5(){return new t5(this._groups,this._parents)}function r5(e,t){var n,r,s;return function(){var o=Jo(this,e),l=(this.style.removeProperty(e),Jo(this,e));return o===l?null:o===n&&l===r?s:s=t(n=o,r=l)}}function QA(e){return function(){this.style.removeProperty(e)}}function s5(e,t,n){var r,s=n+"",o;return function(){var l=Jo(this,e);return l===s?null:l===r?o:o=t(r=l,n)}}function a5(e,t,n){var r,s,o;return function(){var l=Jo(this,e),u=n(this),d=u+"";return u==null&&(d=u=(this.style.removeProperty(e),Jo(this,e))),l===d?null:l===r&&d===s?o:(s=d,o=t(r=l,u))}}function o5(e,t){var n,r,s,o="style."+t,l="end."+o,u;return function(){var d=Dr(this,e),h=d.on,f=d.value[o]==null?u||(u=QA(t)):void 0;(h!==n||s!==f)&&(r=(n=h).copy()).on(l,s=f),d.on=r}}function i5(e,t,n){var r=(e+="")=="transform"?iD:JA;return t==null?this.styleTween(e,r5(e,r)).on("end.style."+e,QA(e)):typeof t=="function"?this.styleTween(e,a5(e,r,ab(this,"style."+e,t))).each(o5(this._id,e)):this.styleTween(e,s5(e,r,t),n).on("end.style."+e,null)}function l5(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function c5(e,t,n){var r,s;function o(){var l=t.apply(this,arguments);return l!==s&&(r=(s=l)&&l5(e,l,n)),r}return o._value=t,o}function u5(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,c5(e,t,n??""))}function d5(e){return function(){this.textContent=e}}function h5(e){return function(){var t=e(this);this.textContent=t??""}}function f5(e){return this.tween("text",typeof e=="function"?h5(ab(this,"text",e)):d5(e==null?"":e+""))}function p5(e){return function(t){this.textContent=e.call(this,t)}}function m5(e){var t,n;function r(){var s=e.apply(this,arguments);return s!==n&&(t=(n=s)&&p5(s)),t}return r._value=e,r}function g5(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,m5(e))}function y5(){for(var e=this._name,t=this._id,n=e2(),r=this._groups,s=r.length,o=0;o<s;++o)for(var l=r[o],u=l.length,d,h=0;h<u;++h)if(d=l[h]){var f=dr(d,t);Td(d,e,n,h,l,{time:f.time+f.delay+f.duration,delay:0,duration:f.duration,ease:f.ease})}return new cs(r,this._parents,e,n)}function w5(){var e,t,n=this,r=n._id,s=n.size();return new Promise(function(o,l){var u={value:l},d={value:function(){--s===0&&o()}};n.each(function(){var h=Dr(this,r),f=h.on;f!==e&&(t=(e=f).copy(),t._.cancel.push(u),t._.interrupt.push(u),t._.end.push(d)),h.on=t}),s===0&&o()})}var v5=0;function cs(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function e2(){return++v5}var as=Vl.prototype;cs.prototype={constructor:cs,select:QD,selectAll:e5,selectChild:as.selectChild,selectChildren:as.selectChildren,filter:VD,merge:GD,selection:n5,transition:y5,call:as.call,nodes:as.nodes,node:as.node,size:as.size,empty:as.empty,each:as.each,on:XD,attr:RD,attrTween:OD,style:i5,styleTween:u5,text:f5,textTween:g5,remove:JD,tween:ND,delay:DD,duration:BD,ease:zD,easeVarying:HD,end:w5,[Symbol.iterator]:as[Symbol.iterator]};function x5(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var b5={time:null,delay:0,duration:250,ease:x5};function k5(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 N5(e){var t,n;e instanceof cs?(t=e._id,e=e._name):(t=e2(),(n=b5).time=rb(),e=e==null?null:e+"");for(var r=this._groups,s=r.length,o=0;o<s;++o)for(var l=r[o],u=l.length,d,h=0;h<u;++h)(d=l[h])&&Td(d,e,t,h,l,n||k5(d,t));return new cs(r,this._parents,e,t)}Vl.prototype.interrupt=xD;Vl.prototype.transition=N5;const pu=e=>()=>e;function j5(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 os(e,t,n){this.k=e,this.x=t,this.y=n}os.prototype={constructor:os,scale:function(e){return e===1?this:new os(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new os(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 is=new os(1,0,0);os.prototype;function ep(e){e.stopImmediatePropagation()}function rl(e){e.preventDefault(),e.stopImmediatePropagation()}function S5(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function _5(){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 yN(){return this.__zoom||is}function E5(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function C5(){return navigator.maxTouchPoints||"ontouchstart"in this}function T5(e,t,n){var r=e.invertX(t[0][0])-n[0][0],s=e.invertX(t[1][0])-n[1][0],o=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>o?(o+l)/2:Math.min(0,o)||Math.max(0,l))}function t2(){var e=S5,t=_5,n=T5,r=E5,s=C5,o=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],u=250,d=hD,h=_d("start","zoom","end"),f,p,g,v=500,k=150,b=0,x=10;function N(M){M.property("__zoom",yN).on("wheel.zoom",q,{passive:!1}).on("mousedown.zoom",L).on("dblclick.zoom",P).filter(s).on("touchstart.zoom",I).on("touchmove.zoom",O).on("touchend.zoom touchcancel.zoom",U).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}N.transform=function(M,$,B,V){var H=M.selection?M.selection():M;H.property("__zoom",yN),M!==H?T(M,$,B,V):H.interrupt().each(function(){R(this,arguments).event(V).start().zoom(null,typeof $=="function"?$.apply(this,arguments):$).end()})},N.scaleBy=function(M,$,B,V){N.scaleTo(M,function(){var H=this.__zoom.k,F=typeof $=="function"?$.apply(this,arguments):$;return H*F},B,V)},N.scaleTo=function(M,$,B,V){N.transform(M,function(){var H=t.apply(this,arguments),F=this.__zoom,W=B==null?E(H):typeof B=="function"?B.apply(this,arguments):B,D=F.invert(W),Y=typeof $=="function"?$.apply(this,arguments):$;return n(_(S(F,Y),W,D),H,l)},B,V)},N.translateBy=function(M,$,B,V){N.transform(M,function(){return n(this.__zoom.translate(typeof $=="function"?$.apply(this,arguments):$,typeof B=="function"?B.apply(this,arguments):B),t.apply(this,arguments),l)},null,V)},N.translateTo=function(M,$,B,V,H){N.transform(M,function(){var F=t.apply(this,arguments),W=this.__zoom,D=V==null?E(F):typeof V=="function"?V.apply(this,arguments):V;return n(is.translate(D[0],D[1]).scale(W.k).translate(typeof $=="function"?-$.apply(this,arguments):-$,typeof B=="function"?-B.apply(this,arguments):-B),F,l)},V,H)};function S(M,$){return $=Math.max(o[0],Math.min(o[1],$)),$===M.k?M:new os($,M.x,M.y)}function _(M,$,B){var V=$[0]-B[0]*M.k,H=$[1]-B[1]*M.k;return V===M.x&&H===M.y?M:new os(M.k,V,H)}function E(M){return[(+M[0][0]+ +M[1][0])/2,(+M[0][1]+ +M[1][1])/2]}function T(M,$,B,V){M.on("start.zoom",function(){R(this,arguments).event(V).start()}).on("interrupt.zoom end.zoom",function(){R(this,arguments).event(V).end()}).tween("zoom",function(){var H=this,F=arguments,W=R(H,F).event(V),D=t.apply(H,F),Y=B==null?E(D):typeof B=="function"?B.apply(H,F):B,J=Math.max(D[1][0]-D[0][0],D[1][1]-D[0][1]),G=H.__zoom,K=typeof $=="function"?$.apply(H,F):$,X=d(G.invert(Y).concat(J/G.k),K.invert(Y).concat(J/K.k));return function(Z){if(Z===1)Z=K;else{var ee=X(Z),se=J/ee[2];Z=new os(se,Y[0]-ee[0]*se,Y[1]-ee[1]*se)}W.zoom(null,Z)}})}function R(M,$,B){return!B&&M.__zooming||new A(M,$)}function A(M,$){this.that=M,this.args=$,this.active=0,this.sourceEvent=null,this.extent=t.apply(M,$),this.taps=0}A.prototype={event:function(M){return M&&(this.sourceEvent=M),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(M,$){return this.mouse&&M!=="mouse"&&(this.mouse[1]=$.invert(this.mouse[0])),this.touch0&&M!=="touch"&&(this.touch0[1]=$.invert(this.touch0[0])),this.touch1&&M!=="touch"&&(this.touch1[1]=$.invert(this.touch1[0])),this.that.__zoom=$,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(M){var $=Pn(this.that).datum();h.call(M,this.that,new j5(M,{sourceEvent:this.sourceEvent,target:N,transform:this.that.__zoom,dispatch:h}),$)}};function q(M,...$){if(!e.apply(this,arguments))return;var B=R(this,$).event(M),V=this.__zoom,H=Math.max(o[0],Math.min(o[1],V.k*Math.pow(2,r.apply(this,arguments)))),F=rr(M);if(B.wheel)(B.mouse[0][0]!==F[0]||B.mouse[0][1]!==F[1])&&(B.mouse[1]=V.invert(B.mouse[0]=F)),clearTimeout(B.wheel);else{if(V.k===H)return;B.mouse=[F,V.invert(F)],Fu(this),B.start()}rl(M),B.wheel=setTimeout(W,k),B.zoom("mouse",n(_(S(V,H),B.mouse[0],B.mouse[1]),B.extent,l));function W(){B.wheel=null,B.end()}}function L(M,...$){if(g||!e.apply(this,arguments))return;var B=M.currentTarget,V=R(this,$,!0).event(M),H=Pn(M.view).on("mousemove.zoom",Y,!0).on("mouseup.zoom",J,!0),F=rr(M,B),W=M.clientX,D=M.clientY;qA(M.view),ep(M),V.mouse=[F,this.__zoom.invert(F)],Fu(this),V.start();function Y(G){if(rl(G),!V.moved){var K=G.clientX-W,X=G.clientY-D;V.moved=K*K+X*X>b}V.event(G).zoom("mouse",n(_(V.that.__zoom,V.mouse[0]=rr(G,B),V.mouse[1]),V.extent,l))}function J(G){H.on("mousemove.zoom mouseup.zoom",null),BA(G.view,V.moved),rl(G),V.event(G).end()}}function P(M,...$){if(e.apply(this,arguments)){var B=this.__zoom,V=rr(M.changedTouches?M.changedTouches[0]:M,this),H=B.invert(V),F=B.k*(M.shiftKey?.5:2),W=n(_(S(B,F),V,H),t.apply(this,$),l);rl(M),u>0?Pn(this).transition().duration(u).call(T,W,V,M):Pn(this).call(N.transform,W,V,M)}}function I(M,...$){if(e.apply(this,arguments)){var B=M.touches,V=B.length,H=R(this,$,M.changedTouches.length===V).event(M),F,W,D,Y;for(ep(M),W=0;W<V;++W)D=B[W],Y=rr(D,this),Y=[Y,this.__zoom.invert(Y),D.identifier],H.touch0?!H.touch1&&H.touch0[2]!==Y[2]&&(H.touch1=Y,H.taps=0):(H.touch0=Y,F=!0,H.taps=1+!!f);f&&(f=clearTimeout(f)),F&&(H.taps<2&&(p=Y[0],f=setTimeout(function(){f=null},v)),Fu(this),H.start())}}function O(M,...$){if(this.__zooming){var B=R(this,$).event(M),V=M.changedTouches,H=V.length,F,W,D,Y;for(rl(M),F=0;F<H;++F)W=V[F],D=rr(W,this),B.touch0&&B.touch0[2]===W.identifier?B.touch0[0]=D:B.touch1&&B.touch1[2]===W.identifier&&(B.touch1[0]=D);if(W=B.that.__zoom,B.touch1){var J=B.touch0[0],G=B.touch0[1],K=B.touch1[0],X=B.touch1[1],Z=(Z=K[0]-J[0])*Z+(Z=K[1]-J[1])*Z,ee=(ee=X[0]-G[0])*ee+(ee=X[1]-G[1])*ee;W=S(W,Math.sqrt(Z/ee)),D=[(J[0]+K[0])/2,(J[1]+K[1])/2],Y=[(G[0]+X[0])/2,(G[1]+X[1])/2]}else if(B.touch0)D=B.touch0[0],Y=B.touch0[1];else return;B.zoom("touch",n(_(W,D,Y),B.extent,l))}}function U(M,...$){if(this.__zooming){var B=R(this,$).event(M),V=M.changedTouches,H=V.length,F,W;for(ep(M),g&&clearTimeout(g),g=setTimeout(function(){g=null},v),F=0;F<H;++F)W=V[F],B.touch0&&B.touch0[2]===W.identifier?delete B.touch0:B.touch1&&B.touch1[2]===W.identifier&&delete B.touch1;if(B.touch1&&!B.touch0&&(B.touch0=B.touch1,delete B.touch1),B.touch0)B.touch0[1]=this.__zoom.invert(B.touch0[0]);else if(B.end(),B.taps===2&&(W=rr(W,this),Math.hypot(p[0]-W[0],p[1]-W[1])<x)){var D=Pn(this).on("dblclick.zoom");D&&D.apply(this,arguments)}}}return N.wheelDelta=function(M){return arguments.length?(r=typeof M=="function"?M:pu(+M),N):r},N.filter=function(M){return arguments.length?(e=typeof M=="function"?M:pu(!!M),N):e},N.touchable=function(M){return arguments.length?(s=typeof M=="function"?M:pu(!!M),N):s},N.extent=function(M){return arguments.length?(t=typeof M=="function"?M:pu([[+M[0][0],+M[0][1]],[+M[1][0],+M[1][1]]]),N):t},N.scaleExtent=function(M){return arguments.length?(o[0]=+M[0],o[1]=+M[1],N):[o[0],o[1]]},N.translateExtent=function(M){return arguments.length?(l[0][0]=+M[0][0],l[1][0]=+M[1][0],l[0][1]=+M[0][1],l[1][1]=+M[1][1],N):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},N.constrain=function(M){return arguments.length?(n=M,N):n},N.duration=function(M){return arguments.length?(u=+M,N):u},N.interpolate=function(M){return arguments.length?(d=M,N):d},N.on=function(){var M=h.on.apply(h,arguments);return M===h?N:M},N.clickDistance=function(M){return arguments.length?(b=(M=+M)*M,N):Math.sqrt(b)},N.tapDistance=function(M){return arguments.length?(x=+M,N):x},N}var It=_A();const Rd=w.createContext(null),R5=Rd.Provider,us={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.`},n2=us.error001();function Ke(e,t){const n=w.useContext(Rd);if(n===null)throw new Error(n2);return EA(n,e,t)}const kt=()=>{const e=w.useContext(Rd);if(e===null)throw new Error(n2);return w.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},A5=e=>e.userSelectionActive?"none":"all";function ob({position:e,children:t,className:n,style:r,...s}){const o=Ke(A5),l=`${e}`.split("-");return he.createElement("div",{className:Ft(["react-flow__panel",n,...l]),style:{...r,pointerEvents:o},...s},t)}function M5({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:he.createElement(ob,{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"},he.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}const $5=({x:e,y:t,label:n,labelStyle:r={},labelShowBg:s=!0,labelBgStyle:o={},labelBgPadding:l=[2,4],labelBgBorderRadius:u=2,children:d,className:h,...f})=>{const p=w.useRef(null),[g,v]=w.useState({x:0,y:0,width:0,height:0}),k=Ft(["react-flow__edge-textwrapper",h]);return w.useEffect(()=>{if(p.current){const b=p.current.getBBox();v({x:b.x,y:b.y,width:b.width,height:b.height})}},[n]),typeof n>"u"||!n?null:he.createElement("g",{transform:`translate(${e-g.width/2} ${t-g.height/2})`,className:k,visibility:g.width?"visible":"hidden",...f},s&&he.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:o,rx:u,ry:u}),he.createElement("text",{className:"react-flow__edge-text",y:g.height/2,dy:"0.3em",ref:p,style:r},n),d)};var I5=w.memo($5);const ib=e=>({width:e.offsetWidth,height:e.offsetHeight}),ei=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),lb=(e={x:0,y:0},t)=>({x:ei(e.x,t[0][0],t[1][0]),y:ei(e.y,t[0][1],t[1][1])}),wN=(e,t,n)=>e<t?ei(Math.abs(e-t),1,50)/50:e>n?-ei(Math.abs(e-n),1,50)/50:0,r2=(e,t)=>{const n=wN(e.x,35,t.width-35)*20,r=wN(e.y,35,t.height-35)*20;return[n,r]},s2=e=>{var t;return((t=e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},a2=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),El=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),o2=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),vN=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),O5=(e,t)=>o2(a2(El(e),El(t))),ex=(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)},L5=e=>Dn(e.width)&&Dn(e.height)&&Dn(e.x)&&Dn(e.y),Dn=e=>!isNaN(e)&&isFinite(e),gt=Symbol.for("internals"),i2=["Enter"," ","Escape"],P5=(e,t)=>{},D5=e=>"nativeEvent"in e;function tx(e){var s,o;const t=D5(e)?e.nativeEvent:e,n=((o=(s=t.composedPath)==null?void 0:s.call(t))==null?void 0:o[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 l2=e=>"clientX"in e,Ks=(e,t)=>{var o,l;const n=l2(e),r=n?e.clientX:(o=e.touches)==null?void 0:o[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)}},td=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0},Kl=({id:e,path:t,labelX:n,labelY:r,label:s,labelStyle:o,labelShowBg:l,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:h,style:f,markerEnd:p,markerStart:g,interactionWidth:v=20})=>he.createElement(he.Fragment,null,he.createElement("path",{id:e,style:f,d:t,fill:"none",className:"react-flow__edge-path",markerEnd:p,markerStart:g}),v&&he.createElement("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:v,className:"react-flow__edge-interaction"}),s&&Dn(n)&&Dn(r)?he.createElement(I5,{x:n,y:r,label:s,labelStyle:o,labelShowBg:l,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:h}):null);Kl.displayName="BaseEdge";function sl(e,t,n){return n===void 0?n:r=>{const s=t().edges.find(o=>o.id===e);s&&n(r,{...s})}}function c2({sourceX:e,sourceY:t,targetX:n,targetY:r}){const s=Math.abs(n-e)/2,o=n<e?n+s:n-s,l=Math.abs(r-t)/2,u=r<t?r+l:r-l;return[o,u,s,l]}function u2({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:s,sourceControlY:o,targetControlX:l,targetControlY:u}){const d=e*.125+s*.375+l*.375+n*.125,h=t*.125+o*.375+u*.375+r*.125,f=Math.abs(d-e),p=Math.abs(h-t);return[d,h,f,p]}var Ia;(function(e){e.Strict="strict",e.Loose="loose"})(Ia||(Ia={}));var _a;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(_a||(_a={}));var Cl;(function(e){e.Partial="partial",e.Full="full"})(Cl||(Cl={}));var Ws;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Ws||(Ws={}));var nd;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(nd||(nd={}));var Ae;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Ae||(Ae={}));function xN({pos:e,x1:t,y1:n,x2:r,y2:s}){return e===Ae.Left||e===Ae.Right?[.5*(t+r),n]:[t,.5*(n+s)]}function d2({sourceX:e,sourceY:t,sourcePosition:n=Ae.Bottom,targetX:r,targetY:s,targetPosition:o=Ae.Top}){const[l,u]=xN({pos:n,x1:e,y1:t,x2:r,y2:s}),[d,h]=xN({pos:o,x1:r,y1:s,x2:e,y2:t}),[f,p,g,v]=u2({sourceX:e,sourceY:t,targetX:r,targetY:s,sourceControlX:l,sourceControlY:u,targetControlX:d,targetControlY:h});return[`M${e},${t} C${l},${u} ${d},${h} ${r},${s}`,f,p,g,v]}const cb=w.memo(({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:s=Ae.Bottom,targetPosition:o=Ae.Top,label:l,labelStyle:u,labelShowBg:d,labelBgStyle:h,labelBgPadding:f,labelBgBorderRadius:p,style:g,markerEnd:v,markerStart:k,interactionWidth:b})=>{const[x,N,S]=d2({sourceX:e,sourceY:t,sourcePosition:s,targetX:n,targetY:r,targetPosition:o});return he.createElement(Kl,{path:x,labelX:N,labelY:S,label:l,labelStyle:u,labelShowBg:d,labelBgStyle:h,labelBgPadding:f,labelBgBorderRadius:p,style:g,markerEnd:v,markerStart:k,interactionWidth:b})});cb.displayName="SimpleBezierEdge";const bN={[Ae.Left]:{x:-1,y:0},[Ae.Right]:{x:1,y:0},[Ae.Top]:{x:0,y:-1},[Ae.Bottom]:{x:0,y:1}},F5=({source:e,sourcePosition:t=Ae.Bottom,target:n})=>t===Ae.Left||t===Ae.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},kN=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function q5({source:e,sourcePosition:t=Ae.Bottom,target:n,targetPosition:r=Ae.Top,center:s,offset:o}){const l=bN[t],u=bN[r],d={x:e.x+l.x*o,y:e.y+l.y*o},h={x:n.x+u.x*o,y:n.y+u.y*o},f=F5({source:d,sourcePosition:t,target:h}),p=f.x!==0?"x":"y",g=f[p];let v=[],k,b;const x={x:0,y:0},N={x:0,y:0},[S,_,E,T]=c2({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[p]*u[p]===-1){k=s.x??S,b=s.y??_;const A=[{x:k,y:d.y},{x:k,y:h.y}],q=[{x:d.x,y:b},{x:h.x,y:b}];l[p]===g?v=p==="x"?A:q:v=p==="x"?q:A}else{const A=[{x:d.x,y:h.y}],q=[{x:h.x,y:d.y}];if(p==="x"?v=l.x===g?q:A:v=l.y===g?A:q,t===r){const U=Math.abs(e[p]-n[p]);if(U<=o){const M=Math.min(o-1,o-U);l[p]===g?x[p]=(d[p]>e[p]?-1:1)*M:N[p]=(h[p]>n[p]?-1:1)*M}}if(t!==r){const U=p==="x"?"y":"x",M=l[p]===u[U],$=d[U]>h[U],B=d[U]<h[U];(l[p]===1&&(!M&&$||M&&B)||l[p]!==1&&(!M&&B||M&&$))&&(v=p==="x"?A:q)}const L={x:d.x+x.x,y:d.y+x.y},P={x:h.x+N.x,y:h.y+N.y},I=Math.max(Math.abs(L.x-v[0].x),Math.abs(P.x-v[0].x)),O=Math.max(Math.abs(L.y-v[0].y),Math.abs(P.y-v[0].y));I>=O?(k=(L.x+P.x)/2,b=v[0].y):(k=v[0].x,b=(L.y+P.y)/2)}return[[e,{x:d.x+x.x,y:d.y+x.y},...v,{x:h.x+N.x,y:h.y+N.y},n],k,b,E,T]}function B5(e,t,n,r){const s=Math.min(kN(e,t)/2,kN(t,n)/2,r),{x:o,y:l}=t;if(e.x===o&&o===n.x||e.y===l&&l===n.y)return`L${o} ${l}`;if(e.y===l){const h=e.x<n.x?-1:1,f=e.y<n.y?1:-1;return`L ${o+s*h},${l}Q ${o},${l} ${o},${l+s*f}`}const u=e.x<n.x?1:-1,d=e.y<n.y?-1:1;return`L ${o},${l+s*d}Q ${o},${l} ${o+s*u},${l}`}function nx({sourceX:e,sourceY:t,sourcePosition:n=Ae.Bottom,targetX:r,targetY:s,targetPosition:o=Ae.Top,borderRadius:l=5,centerX:u,centerY:d,offset:h=20}){const[f,p,g,v,k]=q5({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:s},targetPosition:o,center:{x:u,y:d},offset:h});return[f.reduce((x,N,S)=>{let _="";return S>0&&S<f.length-1?_=B5(f[S-1],N,f[S+1],l):_=`${S===0?"M":"L"}${N.x} ${N.y}`,x+=_,x},""),p,g,v,k]}const Ad=w.memo(({sourceX:e,sourceY:t,targetX:n,targetY:r,label:s,labelStyle:o,labelShowBg:l,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:h,style:f,sourcePosition:p=Ae.Bottom,targetPosition:g=Ae.Top,markerEnd:v,markerStart:k,pathOptions:b,interactionWidth:x})=>{const[N,S,_]=nx({sourceX:e,sourceY:t,sourcePosition:p,targetX:n,targetY:r,targetPosition:g,borderRadius:b==null?void 0:b.borderRadius,offset:b==null?void 0:b.offset});return he.createElement(Kl,{path:N,labelX:S,labelY:_,label:s,labelStyle:o,labelShowBg:l,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:h,style:f,markerEnd:v,markerStart:k,interactionWidth:x})});Ad.displayName="SmoothStepEdge";const ub=w.memo(e=>{var t;return he.createElement(Ad,{...e,pathOptions:w.useMemo(()=>{var n;return{borderRadius:0,offset:(n=e.pathOptions)==null?void 0:n.offset}},[(t=e.pathOptions)==null?void 0:t.offset])})});ub.displayName="StepEdge";function U5({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[s,o,l,u]=c2({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,s,o,l,u]}const db=w.memo(({sourceX:e,sourceY:t,targetX:n,targetY:r,label:s,labelStyle:o,labelShowBg:l,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:h,style:f,markerEnd:p,markerStart:g,interactionWidth:v})=>{const[k,b,x]=U5({sourceX:e,sourceY:t,targetX:n,targetY:r});return he.createElement(Kl,{path:k,labelX:b,labelY:x,label:s,labelStyle:o,labelShowBg:l,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:h,style:f,markerEnd:p,markerStart:g,interactionWidth:v})});db.displayName="StraightEdge";function mu(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function NN({pos:e,x1:t,y1:n,x2:r,y2:s,c:o}){switch(e){case Ae.Left:return[t-mu(t-r,o),n];case Ae.Right:return[t+mu(r-t,o),n];case Ae.Top:return[t,n-mu(n-s,o)];case Ae.Bottom:return[t,n+mu(s-n,o)]}}function hb({sourceX:e,sourceY:t,sourcePosition:n=Ae.Bottom,targetX:r,targetY:s,targetPosition:o=Ae.Top,curvature:l=.25}){const[u,d]=NN({pos:n,x1:e,y1:t,x2:r,y2:s,c:l}),[h,f]=NN({pos:o,x1:r,y1:s,x2:e,y2:t,c:l}),[p,g,v,k]=u2({sourceX:e,sourceY:t,targetX:r,targetY:s,sourceControlX:u,sourceControlY:d,targetControlX:h,targetControlY:f});return[`M${e},${t} C${u},${d} ${h},${f} ${r},${s}`,p,g,v,k]}const rd=w.memo(({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:s=Ae.Bottom,targetPosition:o=Ae.Top,label:l,labelStyle:u,labelShowBg:d,labelBgStyle:h,labelBgPadding:f,labelBgBorderRadius:p,style:g,markerEnd:v,markerStart:k,pathOptions:b,interactionWidth:x})=>{const[N,S,_]=hb({sourceX:e,sourceY:t,sourcePosition:s,targetX:n,targetY:r,targetPosition:o,curvature:b==null?void 0:b.curvature});return he.createElement(Kl,{path:N,labelX:S,labelY:_,label:l,labelStyle:u,labelShowBg:d,labelBgStyle:h,labelBgPadding:f,labelBgBorderRadius:p,style:g,markerEnd:v,markerStart:k,interactionWidth:x})});rd.displayName="BezierEdge";const fb=w.createContext(null),z5=fb.Provider;fb.Consumer;const W5=()=>w.useContext(fb),H5=e=>"id"in e&&"source"in e&&"target"in e,V5=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`reactflow__edge-${e}${t||""}-${n}${r||""}`,rx=(e,t)=>typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`,G5=(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)),K5=(e,t)=>{if(!e.source||!e.target)return t;let n;return H5(e)?n={...e}:n={...e,id:V5(e)},G5(n,t)?t:t.concat(n)},sx=({x:e,y:t},[n,r,s],o,[l,u])=>{const d={x:(e-n)/s,y:(t-r)/s};return o?{x:l*Math.round(d.x/l),y:u*Math.round(d.y/u)}:d},h2=({x:e,y:t},[n,r,s])=>({x:e*s+n,y:t*s+r}),Ta=(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}},Md=(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:o,y:l}=Ta(s,t).positionAbsolute;return a2(r,El({x:o,y:l,width:s.width||0,height:s.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return o2(n)},f2=(e,t,[n,r,s]=[0,0,1],o=!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},h=[];return e.forEach(f=>{const{width:p,height:g,selectable:v=!0,hidden:k=!1}=f;if(l&&!v||k)return!1;const{positionAbsolute:b}=Ta(f,u),x={x:b.x,y:b.y,width:p||0,height:g||0},N=ex(d,x),S=typeof p>"u"||typeof g>"u"||p===null||g===null,_=o&&N>0,E=(p||0)*(g||0);(S||_||N>=E||f.dragging)&&h.push(f)}),h},p2=(e,t)=>{const n=e.map(r=>r.id);return t.filter(r=>n.includes(r.source)||n.includes(r.target))},m2=(e,t,n,r,s,o=.1)=>{const l=t/(e.width*(1+o)),u=n/(e.height*(1+o)),d=Math.min(l,u),h=ei(d,r,s),f=e.x+e.width/2,p=e.y+e.height/2,g=t/2-f*h,v=n/2-p*h;return{x:g,y:v,zoom:h}},ba=(e,t=0)=>e.transition().duration(t);function jN(e,t,n,r){return(t[n]||[]).reduce((s,o)=>{var l,u;return`${e.id}-${o.id}-${n}`!==r&&s.push({id:o.id||null,type:n,nodeId:e.id,x:(((l=e.positionAbsolute)==null?void 0:l.x)??0)+o.x+o.width/2,y:(((u=e.positionAbsolute)==null?void 0:u.y)??0)+o.y+o.height/2}),s},[])}function Y5(e,t,n,r,s,o){const{x:l,y:u}=Ks(e),h=t.elementsFromPoint(l,u).find(k=>k.classList.contains("react-flow__handle"));if(h){const k=h.getAttribute("data-nodeid");if(k){const b=pb(void 0,h),x=h.getAttribute("data-handleid"),N=o({nodeId:k,id:x,type:b});if(N){const S=s.find(_=>_.nodeId===k&&_.type===b&&_.id===x);return{handle:{id:x,type:b,nodeId:k,x:(S==null?void 0:S.x)||n.x,y:(S==null?void 0:S.y)||n.y},validHandleResult:N}}}}let f=[],p=1/0;if(s.forEach(k=>{const b=Math.sqrt((k.x-n.x)**2+(k.y-n.y)**2);if(b<=r){const x=o(k);b<=p&&(b<p?f=[{handle:k,validHandleResult:x}]:b===p&&f.push({handle:k,validHandleResult:x}),p=b)}}),!f.length)return{handle:null,validHandleResult:g2()};if(f.length===1)return f[0];const g=f.some(({validHandleResult:k})=>k.isValid),v=f.some(({handle:k})=>k.type==="target");return f.find(({handle:k,validHandleResult:b})=>v?k.type==="target":g?b.isValid:!0)||f[0]}const X5={source:null,target:null,sourceHandle:null,targetHandle:null},g2=()=>({handleDomNode:null,isValid:!1,connection:X5,endHandle:null});function y2(e,t,n,r,s,o,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}"]`),h={...g2(),handleDomNode:d};if(d){const f=pb(void 0,d),p=d.getAttribute("data-nodeid"),g=d.getAttribute("data-handleid"),v=d.classList.contains("connectable"),k=d.classList.contains("connectableend"),b={source:u?p:n,sourceHandle:u?g:r,target:u?n:p,targetHandle:u?r:g};h.connection=b,v&&k&&(t===Ia.Strict?u&&f==="source"||!u&&f==="target":p!==n||g!==r)&&(h.endHandle={nodeId:p,handleId:g,type:f},h.isValid=o(b))}return h}function Z5({nodes:e,nodeId:t,handleId:n,handleType:r}){return e.reduce((s,o)=>{if(o[gt]){const{handleBounds:l}=o[gt];let u=[],d=[];l&&(u=jN(o,l,"source",`${t}-${n}-${r}`),d=jN(o,l,"target",`${t}-${n}-${r}`)),s.push(...u,...d)}return s},[])}function pb(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function tp(e){e==null||e.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function J5(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}function w2({event:e,handleId:t,nodeId:n,onConnect:r,isTarget:s,getState:o,setState:l,isValidConnection:u,edgeUpdaterType:d,onReconnectEnd:h}){const f=s2(e.target),{connectionMode:p,domNode:g,autoPanOnConnect:v,connectionRadius:k,onConnectStart:b,panBy:x,getNodes:N,cancelConnection:S}=o();let _=0,E;const{x:T,y:R}=Ks(e),A=f==null?void 0:f.elementFromPoint(T,R),q=pb(d,A),L=g==null?void 0:g.getBoundingClientRect();if(!L||!q)return;let P,I=Ks(e,L),O=!1,U=null,M=!1,$=null;const B=Z5({nodes:N(),nodeId:n,handleId:t,handleType:q}),V=()=>{if(!v)return;const[W,D]=r2(I,L);x({x:W,y:D}),_=requestAnimationFrame(V)};l({connectionPosition:I,connectionStatus:null,connectionNodeId:n,connectionHandleId:t,connectionHandleType:q,connectionStartHandle:{nodeId:n,handleId:t,type:q},connectionEndHandle:null}),b==null||b(e,{nodeId:n,handleId:t,handleType:q});function H(W){const{transform:D}=o();I=Ks(W,L);const{handle:Y,validHandleResult:J}=Y5(W,f,sx(I,D,!1,[1,1]),k,B,G=>y2(G,p,n,t,s?"target":"source",u,f));if(E=Y,O||(V(),O=!0),$=J.handleDomNode,U=J.connection,M=J.isValid,l({connectionPosition:E&&M?h2({x:E.x,y:E.y},D):I,connectionStatus:J5(!!E,M),connectionEndHandle:J.endHandle}),!E&&!M&&!$)return tp(P);U.source!==U.target&&$&&(tp(P),P=$,$.classList.add("connecting","react-flow__handle-connecting"),$.classList.toggle("valid",M),$.classList.toggle("react-flow__handle-valid",M))}function F(W){var D,Y;(E||$)&&U&&M&&(r==null||r(U)),(Y=(D=o()).onConnectEnd)==null||Y.call(D,W),d&&(h==null||h(W)),tp(P),S(),cancelAnimationFrame(_),O=!1,M=!1,U=null,$=null,f.removeEventListener("mousemove",H),f.removeEventListener("mouseup",F),f.removeEventListener("touchmove",H),f.removeEventListener("touchend",F)}f.addEventListener("mousemove",H),f.addEventListener("mouseup",F),f.addEventListener("touchmove",H),f.addEventListener("touchend",F)}const SN=()=>!0,Q5=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),eF=(e,t,n)=>r=>{const{connectionStartHandle:s,connectionEndHandle:o,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||(o==null?void 0:o.nodeId)===e&&(o==null?void 0:o.handleId)===t&&(o==null?void 0:o.type)===n,clickConnecting:(l==null?void 0:l.nodeId)===e&&(l==null?void 0:l.handleId)===t&&(l==null?void 0:l.type)===n}},v2=w.forwardRef(({type:e="source",position:t=Ae.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:s=!0,isConnectableEnd:o=!0,id:l,onConnect:u,children:d,className:h,onMouseDown:f,onTouchStart:p,...g},v)=>{var L,P;const k=l||null,b=e==="target",x=kt(),N=W5(),{connectOnClick:S,noPanClassName:_}=Ke(Q5,Tt),{connecting:E,clickConnecting:T}=Ke(eF(N,k,e),Tt);N||(P=(L=x.getState()).onError)==null||P.call(L,"010",us.error010());const R=I=>{const{defaultEdgeOptions:O,onConnect:U,hasDefaultEdges:M}=x.getState(),$={...O,...I};if(M){const{edges:B,setEdges:V}=x.getState();V(K5($,B))}U==null||U($),u==null||u($)},A=I=>{if(!N)return;const O=l2(I);s&&(O&&I.button===0||!O)&&w2({event:I,handleId:k,nodeId:N,onConnect:R,isTarget:b,getState:x.getState,setState:x.setState,isValidConnection:n||x.getState().isValidConnection||SN}),O?f==null||f(I):p==null||p(I)},q=I=>{const{onClickConnectStart:O,onClickConnectEnd:U,connectionClickStartHandle:M,connectionMode:$,isValidConnection:B}=x.getState();if(!N||!M&&!s)return;if(!M){O==null||O(I,{nodeId:N,handleId:k,handleType:e}),x.setState({connectionClickStartHandle:{nodeId:N,type:e,handleId:k}});return}const V=s2(I.target),H=n||B||SN,{connection:F,isValid:W}=y2({nodeId:N,id:k,type:e},$,M.nodeId,M.handleId||null,M.type,H,V);W&&R(F),U==null||U(I),x.setState({connectionClickStartHandle:null})};return he.createElement("div",{"data-handleid":k,"data-nodeid":N,"data-handlepos":t,"data-id":`${N}-${k}-${e}`,className:Ft(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",_,h,{source:!b,target:b,connectable:r,connectablestart:s,connectableend:o,connecting:T,connectionindicator:r&&(s&&!E||o&&E)}]),onMouseDown:A,onTouchStart:A,onClick:S?q:void 0,ref:v,...g},d)});v2.displayName="Handle";var Oa=w.memo(v2);const x2=({data:e,isConnectable:t,targetPosition:n=Ae.Top,sourcePosition:r=Ae.Bottom})=>he.createElement(he.Fragment,null,he.createElement(Oa,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,he.createElement(Oa,{type:"source",position:r,isConnectable:t}));x2.displayName="DefaultNode";var ax=w.memo(x2);const b2=({data:e,isConnectable:t,sourcePosition:n=Ae.Bottom})=>he.createElement(he.Fragment,null,e==null?void 0:e.label,he.createElement(Oa,{type:"source",position:n,isConnectable:t}));b2.displayName="InputNode";var k2=w.memo(b2);const N2=({data:e,isConnectable:t,targetPosition:n=Ae.Top})=>he.createElement(he.Fragment,null,he.createElement(Oa,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label);N2.displayName="OutputNode";var j2=w.memo(N2);const mb=()=>null;mb.displayName="GroupNode";const tF=e=>({selectedNodes:e.getNodes().filter(t=>t.selected),selectedEdges:e.edges.filter(t=>t.selected).map(t=>({...t}))}),gu=e=>e.id;function nF(e,t){return Tt(e.selectedNodes.map(gu),t.selectedNodes.map(gu))&&Tt(e.selectedEdges.map(gu),t.selectedEdges.map(gu))}const S2=w.memo(({onSelectionChange:e})=>{const t=kt(),{selectedNodes:n,selectedEdges:r}=Ke(tF,nF);return w.useEffect(()=>{const s={nodes:n,edges:r};e==null||e(s),t.getState().onSelectionChange.forEach(o=>o(s))},[n,r,e]),null});S2.displayName="SelectionListener";const rF=e=>!!e.onSelectionChange;function sF({onSelectionChange:e}){const t=Ke(rF);return e||t?he.createElement(S2,{onSelectionChange:e}):null}const aF=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 _o(e,t){w.useEffect(()=>{typeof e<"u"&&t(e)},[e])}function De(e,t,n){w.useEffect(()=>{typeof t<"u"&&n({[e]:t})},[t])}const oF=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:s,onConnectStart:o,onConnectEnd:l,onClickConnectStart:u,onClickConnectEnd:d,nodesDraggable:h,nodesConnectable:f,nodesFocusable:p,edgesFocusable:g,edgesUpdatable:v,elevateNodesOnSelect:k,minZoom:b,maxZoom:x,nodeExtent:N,onNodesChange:S,onEdgesChange:_,elementsSelectable:E,connectionMode:T,snapGrid:R,snapToGrid:A,translateExtent:q,connectOnClick:L,defaultEdgeOptions:P,fitView:I,fitViewOptions:O,onNodesDelete:U,onEdgesDelete:M,onNodeDrag:$,onNodeDragStart:B,onNodeDragStop:V,onSelectionDrag:H,onSelectionDragStart:F,onSelectionDragStop:W,noPanClassName:D,nodeOrigin:Y,rfId:J,autoPanOnConnect:G,autoPanOnNodeDrag:K,onError:X,connectionRadius:Z,isValidConnection:ee,nodeDragThreshold:se})=>{const{setNodes:ue,setEdges:ae,setDefaultNodesAndEdges:re,setMinZoom:de,setMaxZoom:me,setTranslateExtent:pe,setNodeExtent:ke,reset:xe}=Ke(aF,Tt),fe=kt();return w.useEffect(()=>{const Te=r==null?void 0:r.map(Fe=>({...Fe,...P}));return re(n,Te),()=>{xe()}},[]),De("defaultEdgeOptions",P,fe.setState),De("connectionMode",T,fe.setState),De("onConnect",s,fe.setState),De("onConnectStart",o,fe.setState),De("onConnectEnd",l,fe.setState),De("onClickConnectStart",u,fe.setState),De("onClickConnectEnd",d,fe.setState),De("nodesDraggable",h,fe.setState),De("nodesConnectable",f,fe.setState),De("nodesFocusable",p,fe.setState),De("edgesFocusable",g,fe.setState),De("edgesUpdatable",v,fe.setState),De("elementsSelectable",E,fe.setState),De("elevateNodesOnSelect",k,fe.setState),De("snapToGrid",A,fe.setState),De("snapGrid",R,fe.setState),De("onNodesChange",S,fe.setState),De("onEdgesChange",_,fe.setState),De("connectOnClick",L,fe.setState),De("fitViewOnInit",I,fe.setState),De("fitViewOnInitOptions",O,fe.setState),De("onNodesDelete",U,fe.setState),De("onEdgesDelete",M,fe.setState),De("onNodeDrag",$,fe.setState),De("onNodeDragStart",B,fe.setState),De("onNodeDragStop",V,fe.setState),De("onSelectionDrag",H,fe.setState),De("onSelectionDragStart",F,fe.setState),De("onSelectionDragStop",W,fe.setState),De("noPanClassName",D,fe.setState),De("nodeOrigin",Y,fe.setState),De("rfId",J,fe.setState),De("autoPanOnConnect",G,fe.setState),De("autoPanOnNodeDrag",K,fe.setState),De("onError",X,fe.setState),De("connectionRadius",Z,fe.setState),De("isValidConnection",ee,fe.setState),De("nodeDragThreshold",se,fe.setState),_o(e,ue),_o(t,ae),_o(b,de),_o(x,me),_o(q,pe),_o(N,ke),null},_N={display:"none"},iF={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},_2="react-flow__node-desc",E2="react-flow__edge-desc",lF="react-flow__aria-live",cF=e=>e.ariaLiveMessage;function uF({rfId:e}){const t=Ke(cF);return he.createElement("div",{id:`${lF}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:iF},t)}function dF({rfId:e,disableKeyboardA11y:t}){return he.createElement(he.Fragment,null,he.createElement("div",{id:`${_2}-${e}`,style:_N},"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."," "),he.createElement("div",{id:`${E2}-${e}`,style:_N},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!t&&he.createElement(uF,{rfId:e}))}var Tl=(e=null,t={actInsideInputWithModifier:!0})=>{const[n,r]=w.useState(!1),s=w.useRef(!1),o=w.useRef(new Set([])),[l,u]=w.useMemo(()=>{if(e!==null){const h=(Array.isArray(e)?e:[e]).filter(p=>typeof p=="string").map(p=>p.split("+")),f=h.reduce((p,g)=>p.concat(...g),[]);return[h,f]}return[[],[]]},[e]);return w.useEffect(()=>{const d=typeof document<"u"?document:null,h=(t==null?void 0:t.target)||d;if(e!==null){const f=v=>{if(s.current=v.ctrlKey||v.metaKey||v.shiftKey,(!s.current||s.current&&!t.actInsideInputWithModifier)&&tx(v))return!1;const b=CN(v.code,u);o.current.add(v[b]),EN(l,o.current,!1)&&(v.preventDefault(),r(!0))},p=v=>{if((!s.current||s.current&&!t.actInsideInputWithModifier)&&tx(v))return!1;const b=CN(v.code,u);EN(l,o.current,!0)?(r(!1),o.current.clear()):o.current.delete(v[b]),v.key==="Meta"&&o.current.clear(),s.current=!1},g=()=>{o.current.clear(),r(!1)};return h==null||h.addEventListener("keydown",f),h==null||h.addEventListener("keyup",p),window.addEventListener("blur",g),()=>{h==null||h.removeEventListener("keydown",f),h==null||h.removeEventListener("keyup",p),window.removeEventListener("blur",g)}}},[e,r]),n};function EN(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(s=>t.has(s)))}function CN(e,t){return t.includes(e)?"code":"key"}function C2(e,t,n,r){var u,d;const s=e.parentNode||e.parentId;if(!s)return n;const o=t.get(s),l=Ta(o,r);return C2(o,t,{x:(n.x??0)+l.x,y:(n.y??0)+l.y,z:(((u=o[gt])==null?void 0:u.z)??0)>(n.z??0)?((d=o[gt])==null?void 0:d.z)??0:n.z??0},r)}function T2(e,t,n){e.forEach(r=>{var o;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}=C2(r,e,{...r.position,z:((o=r[gt])==null?void 0:o.z)??0},t);r.positionAbsolute={x:l,y:u},r[gt].z=d,n!=null&&n[r.id]&&(r[gt].isParent=!0)}})}function np(e,t,n,r){const s=new Map,o={},l=r?1e3:0;return e.forEach(u=>{var v;const d=(Dn(u.zIndex)?u.zIndex:0)+(u.selected?l:0),h=t.get(u.id),f={...u,positionAbsolute:{x:u.position.x,y:u.position.y}},p=u.parentNode||u.parentId;p&&(o[p]=!0);const g=(h==null?void 0:h.type)&&(h==null?void 0:h.type)!==u.type;Object.defineProperty(f,gt,{enumerable:!1,value:{handleBounds:g||(v=h==null?void 0:h[gt])==null?void 0:v.handleBounds,z:d}}),s.set(u.id,f)}),T2(s,n,o),s}function R2(e,t={}){const{getNodes:n,width:r,height:s,minZoom:o,maxZoom:l,d3Zoom:u,d3Selection:d,fitViewOnInitDone:h,fitViewOnInit:f,nodeOrigin:p}=e(),g=t.initial&&!h&&f;if(u&&d&&(g||!t.initial)){const k=n().filter(x=>{var S;const N=t.includeHiddenNodes?x.width&&x.height:!x.hidden;return(S=t.nodes)!=null&&S.length?N&&t.nodes.some(_=>_.id===x.id):N}),b=k.every(x=>x.width&&x.height);if(k.length>0&&b){const x=Md(k,p),{x:N,y:S,zoom:_}=m2(x,r,s,t.minZoom??o,t.maxZoom??l,t.padding??.1),E=is.translate(N,S).scale(_);return typeof t.duration=="number"&&t.duration>0?u.transform(ba(d,t.duration),E):u.transform(d,E),!0}}return!1}function hF(e,t){return e.forEach(n=>{const r=t.get(n.id);r&&t.set(r.id,{...r,[gt]:r[gt],selected:n.selected})}),new Map(t)}function fF(e,t){return t.map(n=>{const r=e.find(s=>s.id===n.id);return r&&(n.selected=r.selected),n})}function yu({changedNodes:e,changedEdges:t,get:n,set:r}){const{nodeInternals:s,edges:o,onNodesChange:l,onEdgesChange:u,hasDefaultNodes:d,hasDefaultEdges:h}=n();e!=null&&e.length&&(d&&r({nodeInternals:hF(e,s)}),l==null||l(e)),t!=null&&t.length&&(h&&r({edges:fF(t,o)}),u==null||u(t))}const Eo=()=>{},pF={zoomIn:Eo,zoomOut:Eo,zoomTo:Eo,getZoom:()=>1,setViewport:Eo,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:Eo,fitBounds:Eo,project:e=>e,screenToFlowPosition:e=>e,flowToScreenPosition:e=>e,viewportInitialized:!1},mF=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),gF=()=>{const e=kt(),{d3Zoom:t,d3Selection:n}=Ke(mF,Tt);return w.useMemo(()=>n&&t?{zoomIn:s=>t.scaleBy(ba(n,s==null?void 0:s.duration),1.2),zoomOut:s=>t.scaleBy(ba(n,s==null?void 0:s.duration),1/1.2),zoomTo:(s,o)=>t.scaleTo(ba(n,o==null?void 0:o.duration),s),getZoom:()=>e.getState().transform[2],setViewport:(s,o)=>{const[l,u,d]=e.getState().transform,h=is.translate(s.x??l,s.y??u).scale(s.zoom??d);t.transform(ba(n,o==null?void 0:o.duration),h)},getViewport:()=>{const[s,o,l]=e.getState().transform;return{x:s,y:o,zoom:l}},fitView:s=>R2(e.getState,s),setCenter:(s,o,l)=>{const{width:u,height:d,maxZoom:h}=e.getState(),f=typeof(l==null?void 0:l.zoom)<"u"?l.zoom:h,p=u/2-s*f,g=d/2-o*f,v=is.translate(p,g).scale(f);t.transform(ba(n,l==null?void 0:l.duration),v)},fitBounds:(s,o)=>{const{width:l,height:u,minZoom:d,maxZoom:h}=e.getState(),{x:f,y:p,zoom:g}=m2(s,l,u,d,h,(o==null?void 0:o.padding)??.1),v=is.translate(f,p).scale(g);t.transform(ba(n,o==null?void 0:o.duration),v)},project:s=>{const{transform:o,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"),sx(s,o,l,u)},screenToFlowPosition:s=>{const{transform:o,snapToGrid:l,snapGrid:u,domNode:d}=e.getState();if(!d)return s;const{x:h,y:f}=d.getBoundingClientRect(),p={x:s.x-h,y:s.y-f};return sx(p,o,l,u)},flowToScreenPosition:s=>{const{transform:o,domNode:l}=e.getState();if(!l)return s;const{x:u,y:d}=l.getBoundingClientRect(),h=h2(s,o);return{x:h.x+u,y:h.y+d}},viewportInitialized:!0}:pF,[t,n])};function di(){const e=gF(),t=kt(),n=w.useCallback(()=>t.getState().getNodes().map(b=>({...b})),[]),r=w.useCallback(b=>t.getState().nodeInternals.get(b),[]),s=w.useCallback(()=>{const{edges:b=[]}=t.getState();return b.map(x=>({...x}))},[]),o=w.useCallback(b=>{const{edges:x=[]}=t.getState();return x.find(N=>N.id===b)},[]),l=w.useCallback(b=>{const{getNodes:x,setNodes:N,hasDefaultNodes:S,onNodesChange:_}=t.getState(),E=x(),T=typeof b=="function"?b(E):b;if(S)N(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=w.useCallback(b=>{const{edges:x=[],setEdges:N,hasDefaultEdges:S,onEdgesChange:_}=t.getState(),E=typeof b=="function"?b(x):b;if(S)N(E);else if(_){const T=E.length===0?x.map(R=>({type:"remove",id:R.id})):E.map(R=>({item:R,type:"reset"}));_(T)}},[]),d=w.useCallback(b=>{const x=Array.isArray(b)?b:[b],{getNodes:N,setNodes:S,hasDefaultNodes:_,onNodesChange:E}=t.getState();if(_){const R=[...N(),...x];S(R)}else if(E){const T=x.map(R=>({item:R,type:"add"}));E(T)}},[]),h=w.useCallback(b=>{const x=Array.isArray(b)?b:[b],{edges:N=[],setEdges:S,hasDefaultEdges:_,onEdgesChange:E}=t.getState();if(_)S([...N,...x]);else if(E){const T=x.map(R=>({item:R,type:"add"}));E(T)}},[]),f=w.useCallback(()=>{const{getNodes:b,edges:x=[],transform:N}=t.getState(),[S,_,E]=N;return{nodes:b().map(T=>({...T})),edges:x.map(T=>({...T})),viewport:{x:S,y:_,zoom:E}}},[]),p=w.useCallback(({nodes:b,edges:x})=>{const{nodeInternals:N,getNodes:S,edges:_,hasDefaultNodes:E,hasDefaultEdges:T,onNodesDelete:R,onEdgesDelete:A,onNodesChange:q,onEdgesChange:L}=t.getState(),P=(b||[]).map($=>$.id),I=(x||[]).map($=>$.id),O=S().reduce(($,B)=>{const V=B.parentNode||B.parentId,H=!P.includes(B.id)&&V&&$.find(W=>W.id===V);return(typeof B.deletable=="boolean"?B.deletable:!0)&&(P.includes(B.id)||H)&&$.push(B),$},[]),U=_.filter($=>typeof $.deletable=="boolean"?$.deletable:!0),M=U.filter($=>I.includes($.id));if(O||M){const $=p2(O,U),B=[...M,...$],V=B.reduce((H,F)=>(H.includes(F.id)||H.push(F.id),H),[]);if((T||E)&&(T&&t.setState({edges:_.filter(H=>!V.includes(H.id))}),E&&(O.forEach(H=>{N.delete(H.id)}),t.setState({nodeInternals:new Map(N)}))),V.length>0&&(A==null||A(B),L&&L(V.map(H=>({id:H,type:"remove"})))),O.length>0&&(R==null||R(O),q)){const H=O.map(F=>({id:F.id,type:"remove"}));q(H)}}},[]),g=w.useCallback(b=>{const x=L5(b),N=x?null:t.getState().nodeInternals.get(b.id);return!x&&!N?[null,null,x]:[x?b:vN(N),N,x]},[]),v=w.useCallback((b,x=!0,N)=>{const[S,_,E]=g(b);return S?(N||t.getState().getNodes()).filter(T=>{if(!E&&(T.id===_.id||!T.positionAbsolute))return!1;const R=vN(T),A=ex(R,S);return x&&A>0||A>=S.width*S.height}):[]},[]),k=w.useCallback((b,x,N=!0)=>{const[S]=g(b);if(!S)return!1;const _=ex(S,x);return N&&_>0||_>=S.width*S.height},[]);return w.useMemo(()=>({...e,getNodes:n,getNode:r,getEdges:s,getEdge:o,setNodes:l,setEdges:u,addNodes:d,addEdges:h,toObject:f,deleteElements:p,getIntersectingNodes:v,isNodeIntersecting:k}),[e,n,r,s,o,l,u,d,h,f,p,v,k])}const yF={actInsideInputWithModifier:!1};var wF=({deleteKeyCode:e,multiSelectionKeyCode:t})=>{const n=kt(),{deleteElements:r}=di(),s=Tl(e,yF),o=Tl(t);w.useEffect(()=>{if(s){const{edges:l,getNodes:u}=n.getState(),d=u().filter(f=>f.selected),h=l.filter(f=>f.selected);r({nodes:d,edges:h}),n.setState({nodesSelectionActive:!1})}},[s]),w.useEffect(()=>{n.setState({multiSelectionActive:o})},[o])};function vF(e){const t=kt();w.useEffect(()=>{let n;const r=()=>{var o,l;if(!e.current)return;const s=ib(e.current);(s.height===0||s.width===0)&&((l=(o=t.getState()).onError)==null||l.call(o,"004",us.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 gb={position:"absolute",width:"100%",height:"100%",top:0,left:0},xF=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,wu=e=>({x:e.x,y:e.y,zoom:e.k}),Co=(e,t)=>e.target.closest(`.${t}`),TN=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),RN=e=>{const t=e.ctrlKey&&td()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t},bF=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),kF=({onMove:e,onMoveStart:t,onMoveEnd:n,onPaneContextMenu:r,zoomOnScroll:s=!0,zoomOnPinch:o=!0,panOnScroll:l=!1,panOnScrollSpeed:u=.5,panOnScrollMode:d=_a.Free,zoomOnDoubleClick:h=!0,elementsSelectable:f,panOnDrag:p=!0,defaultViewport:g,translateExtent:v,minZoom:k,maxZoom:b,zoomActivationKeyCode:x,preventScrolling:N=!0,children:S,noWheelClassName:_,noPanClassName:E})=>{const T=w.useRef(),R=kt(),A=w.useRef(!1),q=w.useRef(!1),L=w.useRef(null),P=w.useRef({x:0,y:0,zoom:0}),{d3Zoom:I,d3Selection:O,d3ZoomHandler:U,userSelectionActive:M}=Ke(bF,Tt),$=Tl(x),B=w.useRef(0),V=w.useRef(!1),H=w.useRef();return vF(L),w.useEffect(()=>{if(L.current){const F=L.current.getBoundingClientRect(),W=t2().scaleExtent([k,b]).translateExtent(v),D=Pn(L.current).call(W),Y=is.translate(g.x,g.y).scale(ei(g.zoom,k,b)),J=[[0,0],[F.width,F.height]],G=W.constrain()(Y,J,v);W.transform(D,G),W.wheelDelta(RN),R.setState({d3Zoom:W,d3Selection:D,d3ZoomHandler:D.on("wheel.zoom"),transform:[G.x,G.y,G.k],domNode:L.current.closest(".react-flow")})}},[]),w.useEffect(()=>{O&&I&&(l&&!$&&!M?O.on("wheel.zoom",F=>{if(Co(F,_))return!1;F.preventDefault(),F.stopImmediatePropagation();const W=O.property("__zoom").k||1;if(F.ctrlKey&&o){const ee=rr(F),se=RN(F),ue=W*Math.pow(2,se);I.scaleTo(O,ue,ee,F);return}const D=F.deltaMode===1?20:1;let Y=d===_a.Vertical?0:F.deltaX*D,J=d===_a.Horizontal?0:F.deltaY*D;!td()&&F.shiftKey&&d!==_a.Vertical&&(Y=F.deltaY*D,J=0),I.translateBy(O,-(Y/W)*u,-(J/W)*u,{internal:!0});const G=wu(O.property("__zoom")),{onViewportChangeStart:K,onViewportChange:X,onViewportChangeEnd:Z}=R.getState();clearTimeout(H.current),V.current||(V.current=!0,t==null||t(F,G),K==null||K(G)),V.current&&(e==null||e(F,G),X==null||X(G),H.current=setTimeout(()=>{n==null||n(F,G),Z==null||Z(G),V.current=!1},150))},{passive:!1}):typeof U<"u"&&O.on("wheel.zoom",function(F,W){if(!N&&F.type==="wheel"&&!F.ctrlKey||Co(F,_))return null;F.preventDefault(),U.call(this,F,W)},{passive:!1}))},[M,l,d,O,I,U,$,o,N,_,t,e,n]),w.useEffect(()=>{I&&I.on("start",F=>{var Y,J;if(!F.sourceEvent||F.sourceEvent.internal)return null;B.current=(Y=F.sourceEvent)==null?void 0:Y.button;const{onViewportChangeStart:W}=R.getState(),D=wu(F.transform);A.current=!0,P.current=D,((J=F.sourceEvent)==null?void 0:J.type)==="mousedown"&&R.setState({paneDragging:!0}),W==null||W(D),t==null||t(F.sourceEvent,D)})},[I,t]),w.useEffect(()=>{I&&(M&&!A.current?I.on("zoom",null):M||I.on("zoom",F=>{var D;const{onViewportChange:W}=R.getState();if(R.setState({transform:[F.transform.x,F.transform.y,F.transform.k]}),q.current=!!(r&&TN(p,B.current??0)),(e||W)&&!((D=F.sourceEvent)!=null&&D.internal)){const Y=wu(F.transform);W==null||W(Y),e==null||e(F.sourceEvent,Y)}}))},[M,I,e,p,r]),w.useEffect(()=>{I&&I.on("end",F=>{if(!F.sourceEvent||F.sourceEvent.internal)return null;const{onViewportChangeEnd:W}=R.getState();if(A.current=!1,R.setState({paneDragging:!1}),r&&TN(p,B.current??0)&&!q.current&&r(F.sourceEvent),q.current=!1,(n||W)&&xF(P.current,F.transform)){const D=wu(F.transform);P.current=D,clearTimeout(T.current),T.current=setTimeout(()=>{W==null||W(D),n==null||n(F.sourceEvent,D)},l?150:0)}})},[I,l,p,n,r]),w.useEffect(()=>{I&&I.filter(F=>{const W=$||s,D=o&&F.ctrlKey;if((p===!0||Array.isArray(p)&&p.includes(1))&&F.button===1&&F.type==="mousedown"&&(Co(F,"react-flow__node")||Co(F,"react-flow__edge")))return!0;if(!p&&!W&&!l&&!h&&!o||M||!h&&F.type==="dblclick"||Co(F,_)&&F.type==="wheel"||Co(F,E)&&(F.type!=="wheel"||l&&F.type==="wheel"&&!$)||!o&&F.ctrlKey&&F.type==="wheel"||!W&&!l&&!D&&F.type==="wheel"||!p&&(F.type==="mousedown"||F.type==="touchstart")||Array.isArray(p)&&!p.includes(F.button)&&F.type==="mousedown")return!1;const Y=Array.isArray(p)&&p.includes(F.button)||!F.button||F.button<=1;return(!F.ctrlKey||F.type==="wheel")&&Y})},[M,I,s,o,l,h,p,f,$]),he.createElement("div",{className:"react-flow__renderer",ref:L,style:gb},S)},NF=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function jF(){const{userSelectionActive:e,userSelectionRect:t}=Ke(NF,Tt);return e&&t?he.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 AN(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,o=t.position.y+t.height-r.height;if(s>0||o>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),o>0&&(r.style.height+=o),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 SF(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 o=e.filter(u=>u.id===s.id);if(o.length===0)return r.push(s),r;const l={...s};for(const u of o)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&&AN(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&&AN(r,l);break}case"remove":return r}return r.push(l),r},n)}function _F(e,t){return SF(e,t)}const zs=(e,t)=>({id:e,type:"select",selected:t});function Bo(e,t){return e.reduce((n,r)=>{const s=t.includes(r.id);return!r.selected&&s?(r.selected=!0,n.push(zs(r.id,!0))):r.selected&&!s&&(r.selected=!1,n.push(zs(r.id,!1))),n},[])}const rp=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},EF=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),A2=w.memo(({isSelecting:e,selectionMode:t=Cl.Full,panOnDrag:n,onSelectionStart:r,onSelectionEnd:s,onPaneClick:o,onPaneContextMenu:l,onPaneScroll:u,onPaneMouseEnter:d,onPaneMouseMove:h,onPaneMouseLeave:f,children:p})=>{const g=w.useRef(null),v=kt(),k=w.useRef(0),b=w.useRef(0),x=w.useRef(),{userSelectionActive:N,elementsSelectable:S,dragging:_}=Ke(EF,Tt),E=()=>{v.setState({userSelectionActive:!1,userSelectionRect:null}),k.current=0,b.current=0},T=U=>{o==null||o(U),v.getState().resetSelectedElements(),v.setState({nodesSelectionActive:!1})},R=U=>{if(Array.isArray(n)&&(n!=null&&n.includes(2))){U.preventDefault();return}l==null||l(U)},A=u?U=>u(U):void 0,q=U=>{const{resetSelectedElements:M,domNode:$}=v.getState();if(x.current=$==null?void 0:$.getBoundingClientRect(),!S||!e||U.button!==0||U.target!==g.current||!x.current)return;const{x:B,y:V}=Ks(U,x.current);M(),v.setState({userSelectionRect:{width:0,height:0,startX:B,startY:V,x:B,y:V}}),r==null||r(U)},L=U=>{const{userSelectionRect:M,nodeInternals:$,edges:B,transform:V,onNodesChange:H,onEdgesChange:F,nodeOrigin:W,getNodes:D}=v.getState();if(!e||!x.current||!M)return;v.setState({userSelectionActive:!0,nodesSelectionActive:!1});const Y=Ks(U,x.current),J=M.startX??0,G=M.startY??0,K={...M,x:Y.x<J?Y.x:J,y:Y.y<G?Y.y:G,width:Math.abs(Y.x-J),height:Math.abs(Y.y-G)},X=D(),Z=f2($,K,V,t===Cl.Partial,!0,W),ee=p2(Z,B).map(ue=>ue.id),se=Z.map(ue=>ue.id);if(k.current!==se.length){k.current=se.length;const ue=Bo(X,se);ue.length&&(H==null||H(ue))}if(b.current!==ee.length){b.current=ee.length;const ue=Bo(B,ee);ue.length&&(F==null||F(ue))}v.setState({userSelectionRect:K})},P=U=>{if(U.button!==0)return;const{userSelectionRect:M}=v.getState();!N&&M&&U.target===g.current&&(T==null||T(U)),v.setState({nodesSelectionActive:k.current>0}),E(),s==null||s(U)},I=U=>{N&&(v.setState({nodesSelectionActive:k.current>0}),s==null||s(U)),E()},O=S&&(e||N);return he.createElement("div",{className:Ft(["react-flow__pane",{dragging:_,selection:e}]),onClick:O?void 0:rp(T,g),onContextMenu:rp(R,g),onWheel:rp(A,g),onMouseEnter:O?void 0:d,onMouseDown:O?q:void 0,onMouseMove:O?L:h,onMouseUp:O?P:void 0,onMouseLeave:O?I:f,ref:g,style:gb},p,he.createElement(jF,null))});A2.displayName="Pane";function M2(e,t){const n=e.parentNode||e.parentId;if(!n)return!1;const r=t.get(n);return r?r.selected?!0:M2(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 CF(e,t,n,r){return Array.from(e.values()).filter(s=>(s.selected||s.id===r)&&(!s.parentNode||s.parentId||!M2(s,e))&&(s.draggable||t&&typeof s.draggable>"u")).map(s=>{var o,l;return{id:s.id,position:s.position||{x:0,y:0},positionAbsolute:s.positionAbsolute||{x:0,y:0},distance:{x:n.x-(((o=s.positionAbsolute)==null?void 0:o.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 TF(e,t){return!t||t==="parent"?t:[t[0],[t[1][0]-(e.width||0),t[1][1]-(e.height||0)]]}function $2(e,t,n,r,s=[0,0],o){const l=TF(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:v}=Ta(p,s).positionAbsolute;u=p&&Dn(g)&&Dn(v)&&Dn(p.width)&&Dn(p.height)?[[g+e.width*s[0],v+e.height*s[1]],[g+p.width-e.width+e.width*s[0],v+p.height-e.height+e.height*s[1]]]:u}else o==null||o("005",us.error005()),u=l;else if(e.extent&&d&&e.extent!=="parent"){const p=n.get(d),{x:g,y:v}=Ta(p,s).positionAbsolute;u=[[e.extent[0][0]+g,e.extent[0][1]+v],[e.extent[1][0]+g,e.extent[1][1]+v]]}let h={x:0,y:0};if(d){const p=n.get(d);h=Ta(p,s).positionAbsolute}const f=u&&u!=="parent"?lb(t,u):t;return{position:{x:f.x-h.x,y:f.y-h.y},positionAbsolute:f}}function sp({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 $N=(e,t,n,r)=>{const s=t.querySelectorAll(e);if(!s||!s.length)return null;const o=Array.from(s),l=t.getBoundingClientRect(),u={x:l.width*r[0],y:l.height*r[1]};return o.map(d=>{const h=d.getBoundingClientRect();return{id:d.getAttribute("data-handleid"),position:d.getAttribute("data-handlepos"),x:(h.left-l.left-u.x)/n,y:(h.top-l.top-u.y)/n,...ib(d)}})};function al(e,t,n){return n===void 0?n:r=>{const s=t().nodeInternals.get(e);s&&n(r,{...s})}}function ox({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:s,unselectNodesAndEdges:o,multiSelectionActive:l,nodeInternals:u,onError:d}=t.getState(),h=u.get(e);if(!h){d==null||d("012",us.error012(e));return}t.setState({nodesSelectionActive:!1}),h.selected?(n||h.selected&&l)&&(o({nodes:[h],edges:[]}),requestAnimationFrame(()=>{var f;return(f=r==null?void 0:r.current)==null?void 0:f.blur()})):s([e])}function RF(){const e=kt();return w.useCallback(({sourceEvent:n})=>{const{transform:r,snapGrid:s,snapToGrid:o}=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:o?s[0]*Math.round(d.x/s[0]):d.x,ySnapped:o?s[1]*Math.round(d.y/s[1]):d.y,...d}},[])}function ap(e){return(t,n,r)=>e==null?void 0:e(t,r)}function I2({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:s,isSelectable:o,selectNodesOnDrag:l}){const u=kt(),[d,h]=w.useState(!1),f=w.useRef([]),p=w.useRef({x:null,y:null}),g=w.useRef(0),v=w.useRef(null),k=w.useRef({x:0,y:0}),b=w.useRef(null),x=w.useRef(!1),N=w.useRef(!1),S=w.useRef(!1),_=RF();return w.useEffect(()=>{if(e!=null&&e.current){const E=Pn(e.current),T=({x:q,y:L})=>{const{nodeInternals:P,onNodeDrag:I,onSelectionDrag:O,updateNodePositions:U,nodeExtent:M,snapGrid:$,snapToGrid:B,nodeOrigin:V,onError:H}=u.getState();p.current={x:q,y:L};let F=!1,W={x:0,y:0,x2:0,y2:0};if(f.current.length>1&&M){const Y=Md(f.current,V);W=El(Y)}if(f.current=f.current.map(Y=>{const J={x:q-Y.distance.x,y:L-Y.distance.y};B&&(J.x=$[0]*Math.round(J.x/$[0]),J.y=$[1]*Math.round(J.y/$[1]));const G=[[M[0][0],M[0][1]],[M[1][0],M[1][1]]];f.current.length>1&&M&&!Y.extent&&(G[0][0]=Y.positionAbsolute.x-W.x+M[0][0],G[1][0]=Y.positionAbsolute.x+(Y.width??0)-W.x2+M[1][0],G[0][1]=Y.positionAbsolute.y-W.y+M[0][1],G[1][1]=Y.positionAbsolute.y+(Y.height??0)-W.y2+M[1][1]);const K=$2(Y,J,P,G,V,H);return F=F||Y.position.x!==K.position.x||Y.position.y!==K.position.y,Y.position=K.position,Y.positionAbsolute=K.positionAbsolute,Y}),!F)return;U(f.current,!0,!0),h(!0);const D=s?I:ap(O);if(D&&b.current){const[Y,J]=sp({nodeId:s,dragItems:f.current,nodeInternals:P});D(b.current,Y,J)}},R=()=>{if(!v.current)return;const[q,L]=r2(k.current,v.current);if(q!==0||L!==0){const{transform:P,panBy:I}=u.getState();p.current.x=(p.current.x??0)-q/P[2],p.current.y=(p.current.y??0)-L/P[2],I({x:q,y:L})&&T(p.current)}g.current=requestAnimationFrame(R)},A=q=>{var V;const{nodeInternals:L,multiSelectionActive:P,nodesDraggable:I,unselectNodesAndEdges:O,onNodeDragStart:U,onSelectionDragStart:M}=u.getState();N.current=!0;const $=s?U:ap(M);(!l||!o)&&!P&&s&&((V=L.get(s))!=null&&V.selected||O()),s&&o&&l&&ox({id:s,store:u,nodeRef:e});const B=_(q);if(p.current=B,f.current=CF(L,I,B,s),$&&f.current){const[H,F]=sp({nodeId:s,dragItems:f.current,nodeInternals:L});$(q.sourceEvent,H,F)}};if(t)E.on(".drag",null);else{const q=q4().on("start",L=>{const{domNode:P,nodeDragThreshold:I}=u.getState();I===0&&A(L),S.current=!1;const O=_(L);p.current=O,v.current=(P==null?void 0:P.getBoundingClientRect())||null,k.current=Ks(L.sourceEvent,v.current)}).on("drag",L=>{var U,M;const P=_(L),{autoPanOnNodeDrag:I,nodeDragThreshold:O}=u.getState();if(L.sourceEvent.type==="touchmove"&&L.sourceEvent.touches.length>1&&(S.current=!0),!S.current){if(!x.current&&N.current&&I&&(x.current=!0,R()),!N.current){const $=P.xSnapped-(((U=p==null?void 0:p.current)==null?void 0:U.x)??0),B=P.ySnapped-(((M=p==null?void 0:p.current)==null?void 0:M.y)??0);Math.sqrt($*$+B*B)>O&&A(L)}(p.current.x!==P.xSnapped||p.current.y!==P.ySnapped)&&f.current&&N.current&&(b.current=L.sourceEvent,k.current=Ks(L.sourceEvent,v.current),T(P))}}).on("end",L=>{if(!(!N.current||S.current)&&(h(!1),x.current=!1,N.current=!1,cancelAnimationFrame(g.current),f.current)){const{updateNodePositions:P,nodeInternals:I,onNodeDragStop:O,onSelectionDragStop:U}=u.getState(),M=s?O:ap(U);if(P(f.current,!1,!1),M){const[$,B]=sp({nodeId:s,dragItems:f.current,nodeInternals:I});M(L.sourceEvent,$,B)}}}).filter(L=>{const P=L.target;return!L.button&&(!n||!MN(P,`.${n}`,e))&&(!r||MN(P,r,e))});return E.call(q),()=>{E.on(".drag",null)}}}},[e,t,n,r,o,u,s,l,_]),d}function O2(){const e=kt();return w.useCallback(n=>{const{nodeInternals:r,nodeExtent:s,updateNodePositions:o,getNodes:l,snapToGrid:u,snapGrid:d,onError:h,nodesDraggable:f}=e.getState(),p=l().filter(S=>S.selected&&(S.draggable||f&&typeof S.draggable>"u")),g=u?d[0]:5,v=u?d[1]:5,k=n.isShiftPressed?4:1,b=n.x*g*k,x=n.y*v*k,N=p.map(S=>{if(S.positionAbsolute){const _={x:S.positionAbsolute.x+b,y:S.positionAbsolute.y+x};u&&(_.x=d[0]*Math.round(_.x/d[0]),_.y=d[1]*Math.round(_.y/d[1]));const{positionAbsolute:E,position:T}=$2(S,_,r,s,void 0,h);S.position=T,S.positionAbsolute=E}return S});o(N,!0,!1)},[])}const Go={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var ol=e=>{const t=({id:n,type:r,data:s,xPos:o,yPos:l,xPosOrigin:u,yPosOrigin:d,selected:h,onClick:f,onMouseEnter:p,onMouseMove:g,onMouseLeave:v,onContextMenu:k,onDoubleClick:b,style:x,className:N,isDraggable:S,isSelectable:_,isConnectable:E,isFocusable:T,selectNodesOnDrag:R,sourcePosition:A,targetPosition:q,hidden:L,resizeObserver:P,dragHandle:I,zIndex:O,isParent:U,noDragClassName:M,noPanClassName:$,initialized:B,disableKeyboardA11y:V,ariaLabel:H,rfId:F,hasHandleBounds:W})=>{const D=kt(),Y=w.useRef(null),J=w.useRef(null),G=w.useRef(A),K=w.useRef(q),X=w.useRef(r),Z=_||S||f||p||g||v,ee=O2(),se=al(n,D.getState,p),ue=al(n,D.getState,g),ae=al(n,D.getState,v),re=al(n,D.getState,k),de=al(n,D.getState,b),me=xe=>{const{nodeDragThreshold:fe}=D.getState();if(_&&(!R||!S||fe>0)&&ox({id:n,store:D,nodeRef:Y}),f){const Te=D.getState().nodeInternals.get(n);Te&&f(xe,{...Te})}},pe=xe=>{if(!tx(xe)&&!V)if(i2.includes(xe.key)&&_){const fe=xe.key==="Escape";ox({id:n,store:D,unselect:fe,nodeRef:Y})}else S&&h&&Object.prototype.hasOwnProperty.call(Go,xe.key)&&(D.setState({ariaLiveMessage:`Moved selected node ${xe.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~o}, y: ${~~l}`}),ee({x:Go[xe.key].x,y:Go[xe.key].y,isShiftPressed:xe.shiftKey}))};w.useEffect(()=>()=>{J.current&&(P==null||P.unobserve(J.current),J.current=null)},[]),w.useEffect(()=>{if(Y.current&&!L){const xe=Y.current;(!B||!W||J.current!==xe)&&(J.current&&(P==null||P.unobserve(J.current)),P==null||P.observe(xe),J.current=xe)}},[L,B,W]),w.useEffect(()=>{const xe=X.current!==r,fe=G.current!==A,Te=K.current!==q;Y.current&&(xe||fe||Te)&&(xe&&(X.current=r),fe&&(G.current=A),Te&&(K.current=q),D.getState().updateNodeDimensions([{id:n,nodeElement:Y.current,forceUpdate:!0}]))},[n,r,A,q]);const ke=I2({nodeRef:Y,disabled:L||!S,noDragClassName:M,handleSelector:I,nodeId:n,isSelectable:_,selectNodesOnDrag:R});return L?null:he.createElement("div",{className:Ft(["react-flow__node",`react-flow__node-${r}`,{[$]:S},N,{selected:h,selectable:_,parent:U,dragging:ke}]),ref:Y,style:{zIndex:O,transform:`translate(${u}px,${d}px)`,pointerEvents:Z?"all":"none",visibility:B?"visible":"hidden",...x},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:se,onMouseMove:ue,onMouseLeave:ae,onContextMenu:re,onClick:me,onDoubleClick:de,onKeyDown:T?pe:void 0,tabIndex:T?0:void 0,role:T?"button":void 0,"aria-describedby":V?void 0:`${_2}-${F}`,"aria-label":H},he.createElement(z5,{value:n},he.createElement(e,{id:n,data:s,type:r,xPos:o,yPos:l,selected:h,isConnectable:E,sourcePosition:A,targetPosition:q,dragging:ke,dragHandle:I,zIndex:O})))};return t.displayName="NodeWrapper",w.memo(t)};const AF=e=>{const t=e.getNodes().filter(n=>n.selected);return{...Md(t,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};function MF({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=kt(),{width:s,height:o,x:l,y:u,transformString:d,userSelectionActive:h}=Ke(AF,Tt),f=O2(),p=w.useRef(null);if(w.useEffect(()=>{var k;n||(k=p.current)==null||k.focus({preventScroll:!0})},[n]),I2({nodeRef:p}),h||!s||!o)return null;const g=e?k=>{const b=r.getState().getNodes().filter(x=>x.selected);e(k,b)}:void 0,v=k=>{Object.prototype.hasOwnProperty.call(Go,k.key)&&f({x:Go[k.key].x,y:Go[k.key].y,isShiftPressed:k.shiftKey})};return he.createElement("div",{className:Ft(["react-flow__nodesselection","react-flow__container",t]),style:{transform:d}},he.createElement("div",{ref:p,className:"react-flow__nodesselection-rect",onContextMenu:g,tabIndex:n?void 0:-1,onKeyDown:n?void 0:v,style:{width:s,height:o,top:u,left:l}}))}var $F=w.memo(MF);const IF=e=>e.nodesSelectionActive,L2=({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:o,onPaneScroll:l,deleteKeyCode:u,onMove:d,onMoveStart:h,onMoveEnd:f,selectionKeyCode:p,selectionOnDrag:g,selectionMode:v,onSelectionStart:k,onSelectionEnd:b,multiSelectionKeyCode:x,panActivationKeyCode:N,zoomActivationKeyCode:S,elementsSelectable:_,zoomOnScroll:E,zoomOnPinch:T,panOnScroll:R,panOnScrollSpeed:A,panOnScrollMode:q,zoomOnDoubleClick:L,panOnDrag:P,defaultViewport:I,translateExtent:O,minZoom:U,maxZoom:M,preventScrolling:$,onSelectionContextMenu:B,noWheelClassName:V,noPanClassName:H,disableKeyboardA11y:F})=>{const W=Ke(IF),D=Tl(p),Y=Tl(N),J=Y||P,G=Y||R,K=D||g&&J!==!0;return wF({deleteKeyCode:u,multiSelectionKeyCode:x}),he.createElement(kF,{onMove:d,onMoveStart:h,onMoveEnd:f,onPaneContextMenu:o,elementsSelectable:_,zoomOnScroll:E,zoomOnPinch:T,panOnScroll:G,panOnScrollSpeed:A,panOnScrollMode:q,zoomOnDoubleClick:L,panOnDrag:!D&&J,defaultViewport:I,translateExtent:O,minZoom:U,maxZoom:M,zoomActivationKeyCode:S,preventScrolling:$,noWheelClassName:V,noPanClassName:H},he.createElement(A2,{onSelectionStart:k,onSelectionEnd:b,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:o,onPaneScroll:l,panOnDrag:J,isSelecting:!!K,selectionMode:v},e,W&&he.createElement($F,{onSelectionContextMenu:B,noPanClassName:H,disableKeyboardA11y:F})))};L2.displayName="FlowRenderer";var OF=w.memo(L2);function LF(e){return Ke(w.useCallback(n=>e?f2(n.nodeInternals,{x:0,y:0,width:n.width,height:n.height},n.transform,!0):n.getNodes(),[e]))}function PF(e){const t={input:ol(e.input||k2),default:ol(e.default||ax),output:ol(e.output||j2),group:ol(e.group||mb)},n={},r=Object.keys(e).filter(s=>!["input","default","output","group"].includes(s)).reduce((s,o)=>(s[o]=ol(e[o]||ax),s),n);return{...t,...r}}const DF=({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]},FF=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),P2=e=>{const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:s,updateNodeDimensions:o,onError:l}=Ke(FF,Tt),u=LF(e.onlyRenderVisibleElements),d=w.useRef(),h=w.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const f=new ResizeObserver(p=>{const g=p.map(v=>({id:v.target.getAttribute("data-id"),nodeElement:v.target,forceUpdate:!0}));o(g)});return d.current=f,f},[]);return w.useEffect(()=>()=>{var f;(f=d==null?void 0:d.current)==null||f.disconnect()},[]),he.createElement("div",{className:"react-flow__nodes",style:gb},u.map(f=>{var T,R,A;let p=f.type||"default";e.nodeTypes[p]||(l==null||l("003",us.error003(p)),p="default");const g=e.nodeTypes[p]||e.nodeTypes.default,v=!!(f.draggable||t&&typeof f.draggable>"u"),k=!!(f.selectable||s&&typeof f.selectable>"u"),b=!!(f.connectable||n&&typeof f.connectable>"u"),x=!!(f.focusable||r&&typeof f.focusable>"u"),N=e.nodeExtent?lb(f.positionAbsolute,e.nodeExtent):f.positionAbsolute,S=(N==null?void 0:N.x)??0,_=(N==null?void 0:N.y)??0,E=DF({x:S,y:_,width:f.width??0,height:f.height??0,origin:e.nodeOrigin});return he.createElement(g,{key:f.id,id:f.id,className:f.className,style:f.style,type:p,data:f.data,sourcePosition:f.sourcePosition||Ae.Bottom,targetPosition:f.targetPosition||Ae.Top,hidden:f.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:!!f.selected,isDraggable:v,isSelectable:k,isConnectable:b,isFocusable:x,resizeObserver:h,dragHandle:f.dragHandle,zIndex:((T=f[gt])==null?void 0:T.z)??0,isParent:!!((R=f[gt])!=null&&R.isParent),noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!f.width&&!!f.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:f.ariaLabel,hasHandleBounds:!!((A=f[gt])!=null&&A.handleBounds)})}))};P2.displayName="NodeRenderer";var qF=w.memo(P2);const BF=(e,t,n)=>n===Ae.Left?e-t:n===Ae.Right?e+t:e,UF=(e,t,n)=>n===Ae.Top?e-t:n===Ae.Bottom?e+t:e,IN="react-flow__edgeupdater",ON=({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:s,onMouseEnter:o,onMouseOut:l,type:u})=>he.createElement("circle",{onMouseDown:s,onMouseEnter:o,onMouseOut:l,className:Ft([IN,`${IN}-${u}`]),cx:BF(t,r,e),cy:UF(n,r,e),r,stroke:"transparent",fill:"transparent"}),zF=()=>!0;var To=e=>{const t=({id:n,className:r,type:s,data:o,onClick:l,onEdgeDoubleClick:u,selected:d,animated:h,label:f,labelStyle:p,labelShowBg:g,labelBgStyle:v,labelBgPadding:k,labelBgBorderRadius:b,style:x,source:N,target:S,sourceX:_,sourceY:E,targetX:T,targetY:R,sourcePosition:A,targetPosition:q,elementsSelectable:L,hidden:P,sourceHandleId:I,targetHandleId:O,onContextMenu:U,onMouseEnter:M,onMouseMove:$,onMouseLeave:B,reconnectRadius:V,onReconnect:H,onReconnectStart:F,onReconnectEnd:W,markerEnd:D,markerStart:Y,rfId:J,ariaLabel:G,isFocusable:K,isReconnectable:X,pathOptions:Z,interactionWidth:ee,disableKeyboardA11y:se})=>{const ue=w.useRef(null),[ae,re]=w.useState(!1),[de,me]=w.useState(!1),pe=kt(),ke=w.useMemo(()=>`url('#${rx(Y,J)}')`,[Y,J]),xe=w.useMemo(()=>`url('#${rx(D,J)}')`,[D,J]);if(P)return null;const fe=Ue=>{var pt;const{edges:lt,addSelectedEdges:He,unselectNodesAndEdges:ft,multiSelectionActive:Vt}=pe.getState(),Xe=lt.find(Ot=>Ot.id===n);Xe&&(L&&(pe.setState({nodesSelectionActive:!1}),Xe.selected&&Vt?(ft({nodes:[],edges:[Xe]}),(pt=ue.current)==null||pt.blur()):He([n])),l&&l(Ue,Xe))},Te=sl(n,pe.getState,u),Fe=sl(n,pe.getState,U),Oe=sl(n,pe.getState,M),We=sl(n,pe.getState,$),le=sl(n,pe.getState,B),je=(Ue,lt)=>{if(Ue.button!==0)return;const{edges:He,isValidConnection:ft}=pe.getState(),Vt=lt?S:N,Xe=(lt?O:I)||null,pt=lt?"target":"source",Ot=ft||zF,fn=lt,Lt=He.find(Bt=>Bt.id===n);me(!0),F==null||F(Ue,Lt,pt);const qt=Bt=>{me(!1),W==null||W(Bt,Lt,pt)};w2({event:Ue,handleId:Xe,nodeId:Vt,onConnect:Bt=>H==null?void 0:H(Lt,Bt),isTarget:fn,getState:pe.getState,setState:pe.setState,isValidConnection:Ot,edgeUpdaterType:pt,onReconnectEnd:qt})},Re=Ue=>je(Ue,!0),Le=Ue=>je(Ue,!1),et=()=>re(!0),rt=()=>re(!1),Je=!L&&!l,it=Ue=>{var lt;if(!se&&i2.includes(Ue.key)&&L){const{unselectNodesAndEdges:He,addSelectedEdges:ft,edges:Vt}=pe.getState();Ue.key==="Escape"?((lt=ue.current)==null||lt.blur(),He({edges:[Vt.find(pt=>pt.id===n)]})):ft([n])}};return he.createElement("g",{className:Ft(["react-flow__edge",`react-flow__edge-${s}`,r,{selected:d,animated:h,inactive:Je,updating:ae}]),onClick:fe,onDoubleClick:Te,onContextMenu:Fe,onMouseEnter:Oe,onMouseMove:We,onMouseLeave:le,onKeyDown:K?it:void 0,tabIndex:K?0:void 0,role:K?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":G===null?void 0:G||`Edge from ${N} to ${S}`,"aria-describedby":K?`${E2}-${J}`:void 0,ref:ue},!de&&he.createElement(e,{id:n,source:N,target:S,selected:d,animated:h,label:f,labelStyle:p,labelShowBg:g,labelBgStyle:v,labelBgPadding:k,labelBgBorderRadius:b,data:o,style:x,sourceX:_,sourceY:E,targetX:T,targetY:R,sourcePosition:A,targetPosition:q,sourceHandleId:I,targetHandleId:O,markerStart:ke,markerEnd:xe,pathOptions:Z,interactionWidth:ee}),X&&he.createElement(he.Fragment,null,(X==="source"||X===!0)&&he.createElement(ON,{position:A,centerX:_,centerY:E,radius:V,onMouseDown:Re,onMouseEnter:et,onMouseOut:rt,type:"source"}),(X==="target"||X===!0)&&he.createElement(ON,{position:q,centerX:T,centerY:R,radius:V,onMouseDown:Le,onMouseEnter:et,onMouseOut:rt,type:"target"})))};return t.displayName="EdgeWrapper",w.memo(t)};function WF(e){const t={default:To(e.default||rd),straight:To(e.bezier||db),step:To(e.step||ub),smoothstep:To(e.step||Ad),simplebezier:To(e.simplebezier||cb)},n={},r=Object.keys(e).filter(s=>!["default","bezier"].includes(s)).reduce((s,o)=>(s[o]=To(e[o]||rd),s),n);return{...t,...r}}function LN(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,o=(n==null?void 0:n.width)||t.width,l=(n==null?void 0:n.height)||t.height;switch(e){case Ae.Top:return{x:r+o/2,y:s};case Ae.Right:return{x:r+o,y:s+l/2};case Ae.Bottom:return{x:r+o/2,y:s+l};case Ae.Left:return{x:r,y:s+l/2}}}function PN(e,t){return e?e.length===1||!t?e[0]:t&&e.find(n=>n.id===t)||null:null}const HF=(e,t,n,r,s,o)=>{const l=LN(n,e,t),u=LN(o,r,s);return{sourceX:l.x,sourceY:l.y,targetX:u.x,targetY:u.y}};function VF({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:r,targetWidth:s,targetHeight:o,width:l,height:u,transform:d}){const h={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+o)};h.x===h.x2&&(h.x2+=1),h.y===h.y2&&(h.y2+=1);const f=El({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(f.x2,h.x2)-Math.max(f.x,h.x)),g=Math.max(0,Math.min(f.y2,h.y2)-Math.max(f.y,h.y));return Math.ceil(p*g)>0}function DN(e){var r,s,o,l,u;const t=((r=e==null?void 0:e[gt])==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((o=e==null?void 0:e.positionAbsolute)==null?void 0:o.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 GF=[{level:0,isMaxLevel:!0,edges:[]}];function KF(e,t,n=!1){let r=-1;const s=e.reduce((l,u)=>{var f,p;const d=Dn(u.zIndex);let h=d?u.zIndex:0;if(n){const g=t.get(u.target),v=t.get(u.source),k=u.selected||(g==null?void 0:g.selected)||(v==null?void 0:v.selected),b=Math.max(((f=v==null?void 0:v[gt])==null?void 0:f.z)||0,((p=g==null?void 0:g[gt])==null?void 0:p.z)||0,1e3);h=(d?u.zIndex:0)+(k?b:0)}return l[h]?l[h].push(u):l[h]=[u],r=h>r?h:r,l},{}),o=Object.entries(s).map(([l,u])=>{const d=+l;return{edges:u,level:d,isMaxLevel:d===r}});return o.length===0?GF:o}function YF(e,t,n){const r=Ke(w.useCallback(s=>e?s.edges.filter(o=>{const l=t.get(o.source),u=t.get(o.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)&&VF({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 KF(r,t,n)}const XF=({color:e="none",strokeWidth:t=1})=>he.createElement("polyline",{style:{stroke:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),ZF=({color:e="none",strokeWidth:t=1})=>he.createElement("polyline",{style:{stroke:e,fill:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),FN={[nd.Arrow]:XF,[nd.ArrowClosed]:ZF};function JF(e){const t=kt();return w.useMemo(()=>{var s,o;return Object.prototype.hasOwnProperty.call(FN,e)?FN[e]:((o=(s=t.getState()).onError)==null||o.call(s,"009",us.error009(e)),null)},[e])}const QF=({id:e,type:t,color:n,width:r=12.5,height:s=12.5,markerUnits:o="strokeWidth",strokeWidth:l,orient:u="auto-start-reverse"})=>{const d=JF(t);return d?he.createElement("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${s}`,viewBox:"-10 -10 20 20",markerUnits:o,orient:u,refX:"0",refY:"0"},he.createElement(d,{color:n,strokeWidth:l})):null},e6=({defaultColor:e,rfId:t})=>n=>{const r=[];return n.edges.reduce((s,o)=>([o.markerStart,o.markerEnd].forEach(l=>{if(l&&typeof l=="object"){const u=rx(l,t);r.includes(u)||(s.push({id:u,color:l.color||e,...l}),r.push(u))}}),s),[]).sort((s,o)=>s.id.localeCompare(o.id))},D2=({defaultColor:e,rfId:t})=>{const n=Ke(w.useCallback(e6({defaultColor:e,rfId:t}),[e,t]),(r,s)=>!(r.length!==s.length||r.some((o,l)=>o.id!==s[l].id)));return he.createElement("defs",null,n.map(r=>he.createElement(QF,{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})))};D2.displayName="MarkerDefinitions";var t6=w.memo(D2);const n6=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}),F2=({defaultMarkerColor:e,onlyRenderVisibleElements:t,elevateEdgesOnSelect:n,rfId:r,edgeTypes:s,noPanClassName:o,onEdgeContextMenu:l,onEdgeMouseEnter:u,onEdgeMouseMove:d,onEdgeMouseLeave:h,onEdgeClick:f,onEdgeDoubleClick:p,onReconnect:g,onReconnectStart:v,onReconnectEnd:k,reconnectRadius:b,children:x,disableKeyboardA11y:N})=>{const{edgesFocusable:S,edgesUpdatable:_,elementsSelectable:E,width:T,height:R,connectionMode:A,nodeInternals:q,onError:L}=Ke(n6,Tt),P=YF(t,q,n);return T?he.createElement(he.Fragment,null,P.map(({level:I,edges:O,isMaxLevel:U})=>he.createElement("svg",{key:I,style:{zIndex:I},width:T,height:R,className:"react-flow__edges react-flow__container"},U&&he.createElement(t6,{defaultColor:e,rfId:r}),he.createElement("g",null,O.map(M=>{const[$,B,V]=DN(q.get(M.source)),[H,F,W]=DN(q.get(M.target));if(!V||!W)return null;let D=M.type||"default";s[D]||(L==null||L("011",us.error011(D)),D="default");const Y=s[D]||s.default,J=A===Ia.Strict?F.target:(F.target??[]).concat(F.source??[]),G=PN(B.source,M.sourceHandle),K=PN(J,M.targetHandle),X=(G==null?void 0:G.position)||Ae.Bottom,Z=(K==null?void 0:K.position)||Ae.Top,ee=!!(M.focusable||S&&typeof M.focusable>"u"),se=M.reconnectable||M.updatable,ue=typeof g<"u"&&(se||_&&typeof se>"u");if(!G||!K)return L==null||L("008",us.error008(G,M)),null;const{sourceX:ae,sourceY:re,targetX:de,targetY:me}=HF($,G,X,H,K,Z);return he.createElement(Y,{key:M.id,id:M.id,className:Ft([M.className,o]),type:D,data:M.data,selected:!!M.selected,animated:!!M.animated,hidden:!!M.hidden,label:M.label,labelStyle:M.labelStyle,labelShowBg:M.labelShowBg,labelBgStyle:M.labelBgStyle,labelBgPadding:M.labelBgPadding,labelBgBorderRadius:M.labelBgBorderRadius,style:M.style,source:M.source,target:M.target,sourceHandleId:M.sourceHandle,targetHandleId:M.targetHandle,markerEnd:M.markerEnd,markerStart:M.markerStart,sourceX:ae,sourceY:re,targetX:de,targetY:me,sourcePosition:X,targetPosition:Z,elementsSelectable:E,onContextMenu:l,onMouseEnter:u,onMouseMove:d,onMouseLeave:h,onClick:f,onEdgeDoubleClick:p,onReconnect:g,onReconnectStart:v,onReconnectEnd:k,reconnectRadius:b,rfId:r,ariaLabel:M.ariaLabel,isFocusable:ee,isReconnectable:ue,pathOptions:"pathOptions"in M?M.pathOptions:void 0,interactionWidth:M.interactionWidth,disableKeyboardA11y:N})})))),x):null};F2.displayName="EdgeRenderer";var r6=w.memo(F2);const s6=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function a6({children:e}){const t=Ke(s6);return he.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:t}},e)}function o6(e){const t=di(),n=w.useRef(!1);w.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const i6={[Ae.Left]:Ae.Right,[Ae.Right]:Ae.Left,[Ae.Top]:Ae.Bottom,[Ae.Bottom]:Ae.Top},q2=({nodeId:e,handleType:t,style:n,type:r=Ws.Bezier,CustomComponent:s,connectionStatus:o})=>{var R,A,q;const{fromNode:l,handleId:u,toX:d,toY:h,connectionMode:f}=Ke(w.useCallback(L=>({fromNode:L.nodeInternals.get(e),handleId:L.connectionHandleId,toX:(L.connectionPosition.x-L.transform[0])/L.transform[2],toY:(L.connectionPosition.y-L.transform[1])/L.transform[2],connectionMode:L.connectionMode}),[e]),Tt),p=(R=l==null?void 0:l[gt])==null?void 0:R.handleBounds;let g=p==null?void 0:p[t];if(f===Ia.Loose&&(g=g||(p==null?void 0:p[t==="source"?"target":"source"])),!l||!g)return null;const v=u?g.find(L=>L.id===u):g[0],k=v?v.x+v.width/2:(l.width??0)/2,b=v?v.y+v.height/2:l.height??0,x=(((A=l.positionAbsolute)==null?void 0:A.x)??0)+k,N=(((q=l.positionAbsolute)==null?void 0:q.y)??0)+b,S=v==null?void 0:v.position,_=S?i6[S]:null;if(!S||!_)return null;if(s)return he.createElement(s,{connectionLineType:r,connectionLineStyle:n,fromNode:l,fromHandle:v,fromX:x,fromY:N,toX:d,toY:h,fromPosition:S,toPosition:_,connectionStatus:o});let E="";const T={sourceX:x,sourceY:N,sourcePosition:S,targetX:d,targetY:h,targetPosition:_};return r===Ws.Bezier?[E]=hb(T):r===Ws.Step?[E]=nx({...T,borderRadius:0}):r===Ws.SmoothStep?[E]=nx(T):r===Ws.SimpleBezier?[E]=d2(T):E=`M${x},${N} ${d},${h}`,he.createElement("path",{d:E,fill:"none",className:"react-flow__connection-path",style:n})};q2.displayName="ConnectionLine";const l6=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function c6({containerStyle:e,style:t,type:n,component:r}){const{nodeId:s,handleType:o,nodesConnectable:l,width:u,height:d,connectionStatus:h}=Ke(l6,Tt);return!(s&&o&&u&&l)?null:he.createElement("svg",{style:e,width:u,height:d,className:"react-flow__edges react-flow__connectionline react-flow__container"},he.createElement("g",{className:Ft(["react-flow__connection",h])},he.createElement(q2,{nodeId:s,handleType:o,style:t,type:n,CustomComponent:r,connectionStatus:h})))}function qN(e,t){return w.useRef(null),kt(),w.useMemo(()=>t(e),[e])}const B2=({nodeTypes:e,edgeTypes:t,onMove:n,onMoveStart:r,onMoveEnd:s,onInit:o,onNodeClick:l,onEdgeClick:u,onNodeDoubleClick:d,onEdgeDoubleClick:h,onNodeMouseEnter:f,onNodeMouseMove:p,onNodeMouseLeave:g,onNodeContextMenu:v,onSelectionContextMenu:k,onSelectionStart:b,onSelectionEnd:x,connectionLineType:N,connectionLineStyle:S,connectionLineComponent:_,connectionLineContainerStyle:E,selectionKeyCode:T,selectionOnDrag:R,selectionMode:A,multiSelectionKeyCode:q,panActivationKeyCode:L,zoomActivationKeyCode:P,deleteKeyCode:I,onlyRenderVisibleElements:O,elementsSelectable:U,selectNodesOnDrag:M,defaultViewport:$,translateExtent:B,minZoom:V,maxZoom:H,preventScrolling:F,defaultMarkerColor:W,zoomOnScroll:D,zoomOnPinch:Y,panOnScroll:J,panOnScrollSpeed:G,panOnScrollMode:K,zoomOnDoubleClick:X,panOnDrag:Z,onPaneClick:ee,onPaneMouseEnter:se,onPaneMouseMove:ue,onPaneMouseLeave:ae,onPaneScroll:re,onPaneContextMenu:de,onEdgeContextMenu:me,onEdgeMouseEnter:pe,onEdgeMouseMove:ke,onEdgeMouseLeave:xe,onReconnect:fe,onReconnectStart:Te,onReconnectEnd:Fe,reconnectRadius:Oe,noDragClassName:We,noWheelClassName:le,noPanClassName:je,elevateEdgesOnSelect:Re,disableKeyboardA11y:Le,nodeOrigin:et,nodeExtent:rt,rfId:Je})=>{const it=qN(e,PF),Ue=qN(t,WF);return o6(o),he.createElement(OF,{onPaneClick:ee,onPaneMouseEnter:se,onPaneMouseMove:ue,onPaneMouseLeave:ae,onPaneContextMenu:de,onPaneScroll:re,deleteKeyCode:I,selectionKeyCode:T,selectionOnDrag:R,selectionMode:A,onSelectionStart:b,onSelectionEnd:x,multiSelectionKeyCode:q,panActivationKeyCode:L,zoomActivationKeyCode:P,elementsSelectable:U,onMove:n,onMoveStart:r,onMoveEnd:s,zoomOnScroll:D,zoomOnPinch:Y,zoomOnDoubleClick:X,panOnScroll:J,panOnScrollSpeed:G,panOnScrollMode:K,panOnDrag:Z,defaultViewport:$,translateExtent:B,minZoom:V,maxZoom:H,onSelectionContextMenu:k,preventScrolling:F,noDragClassName:We,noWheelClassName:le,noPanClassName:je,disableKeyboardA11y:Le},he.createElement(a6,null,he.createElement(r6,{edgeTypes:Ue,onEdgeClick:u,onEdgeDoubleClick:h,onlyRenderVisibleElements:O,onEdgeContextMenu:me,onEdgeMouseEnter:pe,onEdgeMouseMove:ke,onEdgeMouseLeave:xe,onReconnect:fe,onReconnectStart:Te,onReconnectEnd:Fe,reconnectRadius:Oe,defaultMarkerColor:W,noPanClassName:je,elevateEdgesOnSelect:!!Re,disableKeyboardA11y:Le,rfId:Je},he.createElement(c6,{style:S,type:N,component:_,containerStyle:E})),he.createElement("div",{className:"react-flow__edgelabel-renderer"}),he.createElement(qF,{nodeTypes:it,onNodeClick:l,onNodeDoubleClick:d,onNodeMouseEnter:f,onNodeMouseMove:p,onNodeMouseLeave:g,onNodeContextMenu:v,selectNodesOnDrag:M,onlyRenderVisibleElements:O,noPanClassName:je,noDragClassName:We,disableKeyboardA11y:Le,nodeOrigin:et,nodeExtent:rt,rfId:Je})))};B2.displayName="GraphView";var u6=w.memo(B2);const ix=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],qs={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:ix,nodeExtent:ix,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:Ia.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:[0,0],nodeDragThreshold:0,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesUpdatable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,fitViewOnInit:!1,fitViewOnInitDone:!1,fitViewOnInitOptions:void 0,onSelectionChange:[],multiSelectionActive:!1,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,connectionRadius:20,onError:P5,isValidConnection:void 0},d6=()=>J3((e,t)=>({...qs,setNodes:n=>{const{nodeInternals:r,nodeOrigin:s,elevateNodesOnSelect:o}=t();e({nodeInternals:np(n,r,s,o)})},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",o=typeof r<"u",l=s?np(n,new Map,t().nodeOrigin,t().elevateNodesOnSelect):new Map;e({nodeInternals:l,edges:o?r:[],hasDefaultNodes:s,hasDefaultEdges:o})},updateNodeDimensions:n=>{const{onNodesChange:r,nodeInternals:s,fitViewOnInit:o,fitViewOnInitDone:l,fitViewOnInitOptions:u,domNode:d,nodeOrigin:h}=t(),f=d==null?void 0:d.querySelector(".react-flow__viewport");if(!f)return;const p=window.getComputedStyle(f),{m22:g}=new window.DOMMatrixReadOnly(p.transform),v=n.reduce((b,x)=>{const N=s.get(x.id);if(N!=null&&N.hidden)s.set(N.id,{...N,[gt]:{...N[gt],handleBounds:void 0}});else if(N){const S=ib(x.nodeElement);!!(S.width&&S.height&&(N.width!==S.width||N.height!==S.height||x.forceUpdate))&&(s.set(N.id,{...N,[gt]:{...N[gt],handleBounds:{source:$N(".source",x.nodeElement,g,h),target:$N(".target",x.nodeElement,g,h)}},...S}),b.push({id:N.id,type:"dimensions",dimensions:S}))}return b},[]);T2(s,h);const k=l||o&&!l&&R2(t,{initial:!0,...u});e({nodeInternals:new Map(s),fitViewOnInitDone:k}),(v==null?void 0:v.length)>0&&(r==null||r(v))},updateNodePositions:(n,r=!0,s=!1)=>{const{triggerNodeChanges:o}=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});o(l)},triggerNodeChanges:n=>{const{onNodesChange:r,nodeInternals:s,hasDefaultNodes:o,nodeOrigin:l,getNodes:u,elevateNodesOnSelect:d}=t();if(n!=null&&n.length){if(o){const h=_F(n,u()),f=np(h,s,l,d);e({nodeInternals:f})}r==null||r(n)}},addSelectedNodes:n=>{const{multiSelectionActive:r,edges:s,getNodes:o}=t();let l,u=null;r?l=n.map(d=>zs(d,!0)):(l=Bo(o(),n),u=Bo(s,[])),yu({changedNodes:l,changedEdges:u,get:t,set:e})},addSelectedEdges:n=>{const{multiSelectionActive:r,edges:s,getNodes:o}=t();let l,u=null;r?l=n.map(d=>zs(d,!0)):(l=Bo(s,n),u=Bo(o(),[])),yu({changedNodes:u,changedEdges:l,get:t,set:e})},unselectNodesAndEdges:({nodes:n,edges:r}={})=>{const{edges:s,getNodes:o}=t(),l=n||o(),u=r||s,d=l.map(f=>(f.selected=!1,zs(f.id,!1))),h=u.map(f=>zs(f.id,!1));yu({changedNodes:d,changedEdges:h,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(),o=r().filter(u=>u.selected).map(u=>zs(u.id,!1)),l=n.filter(u=>u.selected).map(u=>zs(u.id,!1));yu({changedNodes:o,changedEdges:l,get:t,set:e})},setNodeExtent:n=>{const{nodeInternals:r}=t();r.forEach(s=>{s.positionAbsolute=lb(s.position,n)}),e({nodeExtent:n,nodeInternals:new Map(r)})},panBy:n=>{const{transform:r,width:s,height:o,d3Zoom:l,d3Selection:u,translateExtent:d}=t();if(!l||!u||!n.x&&!n.y)return!1;const h=is.translate(r[0]+n.x,r[1]+n.y).scale(r[2]),f=[[0,0],[s,o]],p=l==null?void 0:l.constrain()(h,f,d);return l.transform(u,p),r[0]!==p.x||r[1]!==p.y||r[2]!==p.k},cancelConnection:()=>e({connectionNodeId:qs.connectionNodeId,connectionHandleId:qs.connectionHandleId,connectionHandleType:qs.connectionHandleType,connectionStatus:qs.connectionStatus,connectionStartHandle:qs.connectionStartHandle,connectionEndHandle:qs.connectionEndHandle}),reset:()=>e({...qs})}),Object.is),yb=({children:e})=>{const t=w.useRef(null);return t.current||(t.current=d6()),he.createElement(R5,{value:t.current},e)};yb.displayName="ReactFlowProvider";const U2=({children:e})=>w.useContext(Rd)?he.createElement(he.Fragment,null,e):he.createElement(yb,null,e);U2.displayName="ReactFlowWrapper";const h6={input:k2,default:ax,output:j2,group:mb},f6={default:rd,straight:db,step:ub,smoothstep:Ad,simplebezier:cb},p6=[0,0],m6=[15,15],g6={x:0,y:0,zoom:1},y6={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},z2=w.forwardRef(({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:s,nodeTypes:o=h6,edgeTypes:l=f6,onNodeClick:u,onEdgeClick:d,onInit:h,onMove:f,onMoveStart:p,onMoveEnd:g,onConnect:v,onConnectStart:k,onConnectEnd:b,onClickConnectStart:x,onClickConnectEnd:N,onNodeMouseEnter:S,onNodeMouseMove:_,onNodeMouseLeave:E,onNodeContextMenu:T,onNodeDoubleClick:R,onNodeDragStart:A,onNodeDrag:q,onNodeDragStop:L,onNodesDelete:P,onEdgesDelete:I,onSelectionChange:O,onSelectionDragStart:U,onSelectionDrag:M,onSelectionDragStop:$,onSelectionContextMenu:B,onSelectionStart:V,onSelectionEnd:H,connectionMode:F=Ia.Strict,connectionLineType:W=Ws.Bezier,connectionLineStyle:D,connectionLineComponent:Y,connectionLineContainerStyle:J,deleteKeyCode:G="Backspace",selectionKeyCode:K="Shift",selectionOnDrag:X=!1,selectionMode:Z=Cl.Full,panActivationKeyCode:ee="Space",multiSelectionKeyCode:se=td()?"Meta":"Control",zoomActivationKeyCode:ue=td()?"Meta":"Control",snapToGrid:ae=!1,snapGrid:re=m6,onlyRenderVisibleElements:de=!1,selectNodesOnDrag:me=!0,nodesDraggable:pe,nodesConnectable:ke,nodesFocusable:xe,nodeOrigin:fe=p6,edgesFocusable:Te,edgesUpdatable:Fe,elementsSelectable:Oe,defaultViewport:We=g6,minZoom:le=.5,maxZoom:je=2,translateExtent:Re=ix,preventScrolling:Le=!0,nodeExtent:et,defaultMarkerColor:rt="#b1b1b7",zoomOnScroll:Je=!0,zoomOnPinch:it=!0,panOnScroll:Ue=!1,panOnScrollSpeed:lt=.5,panOnScrollMode:He=_a.Free,zoomOnDoubleClick:ft=!0,panOnDrag:Vt=!0,onPaneClick:Xe,onPaneMouseEnter:pt,onPaneMouseMove:Ot,onPaneMouseLeave:fn,onPaneScroll:Lt,onPaneContextMenu:qt,children:Zt,onEdgeContextMenu:Bt,onEdgeDoubleClick:pr,onEdgeMouseEnter:qr,onEdgeMouseMove:Br,onEdgeMouseLeave:ms,onEdgeUpdate:mr,onEdgeUpdateStart:gr,onEdgeUpdateEnd:Nn,onReconnect:Ur,onReconnectStart:jn,onReconnectEnd:gs,reconnectRadius:zn=10,edgeUpdaterRadius:Wn=10,onNodesChange:vt,onEdgesChange:yr,noDragClassName:wr="nodrag",noWheelClassName:vr="nowheel",noPanClassName:ys="nopan",fitView:Jt=!1,fitViewOptions:ge,connectOnClick:qe=!0,attributionPosition:Ze,proOptions:Qt,defaultEdgeOptions:zr,elevateNodesOnSelect:xr=!0,elevateEdgesOnSelect:ws=!1,disableKeyboardA11y:Sn=!1,autoPanOnConnect:Wr=!0,autoPanOnNodeDrag:tt=!0,connectionRadius:Hr=20,isValidConnection:br,onError:Vr,style:vs,id:Va,nodeDragThreshold:ea,...Gr},en)=>{const xs=Va||"1";return he.createElement("div",{...Gr,style:{...vs,...y6},ref:en,className:Ft(["react-flow",s]),"data-testid":"rf__wrapper",id:Va},he.createElement(U2,null,he.createElement(u6,{onInit:h,onMove:f,onMoveStart:p,onMoveEnd:g,onNodeClick:u,onEdgeClick:d,onNodeMouseEnter:S,onNodeMouseMove:_,onNodeMouseLeave:E,onNodeContextMenu:T,onNodeDoubleClick:R,nodeTypes:o,edgeTypes:l,connectionLineType:W,connectionLineStyle:D,connectionLineComponent:Y,connectionLineContainerStyle:J,selectionKeyCode:K,selectionOnDrag:X,selectionMode:Z,deleteKeyCode:G,multiSelectionKeyCode:se,panActivationKeyCode:ee,zoomActivationKeyCode:ue,onlyRenderVisibleElements:de,selectNodesOnDrag:me,defaultViewport:We,translateExtent:Re,minZoom:le,maxZoom:je,preventScrolling:Le,zoomOnScroll:Je,zoomOnPinch:it,zoomOnDoubleClick:ft,panOnScroll:Ue,panOnScrollSpeed:lt,panOnScrollMode:He,panOnDrag:Vt,onPaneClick:Xe,onPaneMouseEnter:pt,onPaneMouseMove:Ot,onPaneMouseLeave:fn,onPaneScroll:Lt,onPaneContextMenu:qt,onSelectionContextMenu:B,onSelectionStart:V,onSelectionEnd:H,onEdgeContextMenu:Bt,onEdgeDoubleClick:pr,onEdgeMouseEnter:qr,onEdgeMouseMove:Br,onEdgeMouseLeave:ms,onReconnect:Ur??mr,onReconnectStart:jn??gr,onReconnectEnd:gs??Nn,reconnectRadius:zn??Wn,defaultMarkerColor:rt,noDragClassName:wr,noWheelClassName:vr,noPanClassName:ys,elevateEdgesOnSelect:ws,rfId:xs,disableKeyboardA11y:Sn,nodeOrigin:fe,nodeExtent:et}),he.createElement(oF,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:v,onConnectStart:k,onConnectEnd:b,onClickConnectStart:x,onClickConnectEnd:N,nodesDraggable:pe,nodesConnectable:ke,nodesFocusable:xe,edgesFocusable:Te,edgesUpdatable:Fe,elementsSelectable:Oe,elevateNodesOnSelect:xr,minZoom:le,maxZoom:je,nodeExtent:et,onNodesChange:vt,onEdgesChange:yr,snapToGrid:ae,snapGrid:re,connectionMode:F,translateExtent:Re,connectOnClick:qe,defaultEdgeOptions:zr,fitView:Jt,fitViewOptions:ge,onNodesDelete:P,onEdgesDelete:I,onNodeDragStart:A,onNodeDrag:q,onNodeDragStop:L,onSelectionDrag:M,onSelectionDragStart:U,onSelectionDragStop:$,noPanClassName:ys,nodeOrigin:fe,rfId:xs,autoPanOnConnect:Wr,autoPanOnNodeDrag:tt,onError:Vr,connectionRadius:Hr,isValidConnection:br,nodeDragThreshold:ea}),he.createElement(sF,{onSelectionChange:O}),Zt,he.createElement(M5,{proOptions:Qt,position:Ze}),he.createElement(dF,{rfId:xs,disableKeyboardA11y:Sn})))});z2.displayName="ReactFlow";const w6=e=>({x:e.transform[0],y:e.transform[1],zoom:e.transform[2]});function W2(){return Ke(w6,Tt)}const H2=({id:e,x:t,y:n,width:r,height:s,style:o,color:l,strokeColor:u,strokeWidth:d,className:h,borderRadius:f,shapeRendering:p,onClick:g,selected:v})=>{const{background:k,backgroundColor:b}=o||{},x=l||k||b;return he.createElement("rect",{className:Ft(["react-flow__minimap-node",{selected:v},h]),x:t,y:n,rx:f,ry:f,width:r,height:s,fill:x,stroke:u,strokeWidth:d,shapeRendering:p,onClick:g?N=>g(N,e):void 0})};H2.displayName="MiniMapNode";var v6=w.memo(H2);const x6=e=>e.nodeOrigin,b6=e=>e.getNodes().filter(t=>!t.hidden&&t.width&&t.height),op=e=>e instanceof Function?e:()=>e;function k6({nodeStrokeColor:e="transparent",nodeColor:t="#e2e2e2",nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:s=2,nodeComponent:o=v6,onClick:l}){const u=Ke(b6,Tt),d=Ke(x6),h=op(t),f=op(e),p=op(n),g=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return he.createElement(he.Fragment,null,u.map(v=>{const{x:k,y:b}=Ta(v,d).positionAbsolute;return he.createElement(o,{key:v.id,x:k,y:b,width:v.width,height:v.height,style:v.style,selected:v.selected,className:p(v),color:h(v),borderRadius:r,strokeColor:f(v),strokeWidth:s,shapeRendering:g,onClick:l,id:v.id})}))}var N6=w.memo(k6);const j6=200,S6=150,_6=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?O5(Md(t,e.nodeOrigin),n):n,rfId:e.rfId}},E6="react-flow__minimap-desc";function V2({style:e,className:t,nodeStrokeColor:n="transparent",nodeColor:r="#e2e2e2",nodeClassName:s="",nodeBorderRadius:o=5,nodeStrokeWidth:l=2,nodeComponent:u,maskColor:d="rgb(240, 240, 240, 0.6)",maskStrokeColor:h="none",maskStrokeWidth:f=1,position:p="bottom-right",onClick:g,onNodeClick:v,pannable:k=!1,zoomable:b=!1,ariaLabel:x="React Flow mini map",inversePan:N=!1,zoomStep:S=10,offsetScale:_=5}){const E=kt(),T=w.useRef(null),{boundingRect:R,viewBB:A,rfId:q}=Ke(_6,Tt),L=(e==null?void 0:e.width)??j6,P=(e==null?void 0:e.height)??S6,I=R.width/L,O=R.height/P,U=Math.max(I,O),M=U*L,$=U*P,B=_*U,V=R.x-(M-R.width)/2-B,H=R.y-($-R.height)/2-B,F=M+B*2,W=$+B*2,D=`${E6}-${q}`,Y=w.useRef(0);Y.current=U,w.useEffect(()=>{if(T.current){const K=Pn(T.current),X=se=>{const{transform:ue,d3Selection:ae,d3Zoom:re}=E.getState();if(se.sourceEvent.type!=="wheel"||!ae||!re)return;const de=-se.sourceEvent.deltaY*(se.sourceEvent.deltaMode===1?.05:se.sourceEvent.deltaMode?1:.002)*S,me=ue[2]*Math.pow(2,de);re.scaleTo(ae,me)},Z=se=>{const{transform:ue,d3Selection:ae,d3Zoom:re,translateExtent:de,width:me,height:pe}=E.getState();if(se.sourceEvent.type!=="mousemove"||!ae||!re)return;const ke=Y.current*Math.max(1,ue[2])*(N?-1:1),xe={x:ue[0]-se.sourceEvent.movementX*ke,y:ue[1]-se.sourceEvent.movementY*ke},fe=[[0,0],[me,pe]],Te=is.translate(xe.x,xe.y).scale(ue[2]),Fe=re.constrain()(Te,fe,de);re.transform(ae,Fe)},ee=t2().on("zoom",k?Z:null).on("zoom.wheel",b?X:null);return K.call(ee),()=>{K.on("zoom",null)}}},[k,b,N,S]);const J=g?K=>{const X=rr(K);g(K,{x:X[0],y:X[1]})}:void 0,G=v?(K,X)=>{const Z=E.getState().nodeInternals.get(X);v(K,Z)}:void 0;return he.createElement(ob,{position:p,style:e,className:Ft(["react-flow__minimap",t]),"data-testid":"rf__minimap"},he.createElement("svg",{width:L,height:P,viewBox:`${V} ${H} ${F} ${W}`,role:"img","aria-labelledby":D,ref:T,onClick:J},x&&he.createElement("title",{id:D},x),he.createElement(N6,{onClick:G,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:o,nodeClassName:s,nodeStrokeWidth:l,nodeComponent:u}),he.createElement("path",{className:"react-flow__minimap-mask",d:`M${V-B},${H-B}h${F+B*2}v${W+B*2}h${-F-B*2}z
|
|
57
|
+
M${A.x},${A.y}h${A.width}v${A.height}h${-A.width}z`,fill:d,fillRule:"evenodd",stroke:h,strokeWidth:f,pointerEvents:"none"})))}V2.displayName="MiniMap";var C6=w.memo(V2);function T6(){return he.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},he.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function R6(){return he.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},he.createElement("path",{d:"M0 0h32v4.2H0z"}))}function A6(){return he.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},he.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 M6(){return he.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},he.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 $6(){return he.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},he.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 On=({children:e,className:t,...n})=>he.createElement("button",{type:"button",className:Ft(["react-flow__controls-button",t]),...n},e);On.displayName="ControlButton";const I6=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:o,onZoomOut:l,onFitView:u,onInteractiveChange:d,className:h,children:f,position:p="bottom-left"})=>{const g=kt(),[v,k]=w.useState(!1),{isInteractive:b,minZoomReached:x,maxZoomReached:N}=Ke(I6,Tt),{zoomIn:S,zoomOut:_,fitView:E}=di();if(w.useEffect(()=>{k(!0)},[]),!v)return null;const T=()=>{S(),o==null||o()},R=()=>{_(),l==null||l()},A=()=>{E(s),u==null||u()},q=()=>{g.setState({nodesDraggable:!b,nodesConnectable:!b,elementsSelectable:!b}),d==null||d(!b)};return he.createElement(ob,{className:Ft(["react-flow__controls",h]),position:p,style:e,"data-testid":"rf__controls"},t&&he.createElement(he.Fragment,null,he.createElement(On,{onClick:T,className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:N},he.createElement(T6,null)),he.createElement(On,{onClick:R,className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:x},he.createElement(R6,null))),n&&he.createElement(On,{className:"react-flow__controls-fitview",onClick:A,title:"fit view","aria-label":"fit view"},he.createElement(A6,null)),r&&he.createElement(On,{className:"react-flow__controls-interactive",onClick:q,title:"toggle interactivity","aria-label":"toggle interactivity"},b?he.createElement($6,null):he.createElement(M6,null)),f)};G2.displayName="Controls";var O6=w.memo(G2),ir;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(ir||(ir={}));function L6({color:e,dimensions:t,lineWidth:n}){return he.createElement("path",{stroke:e,strokeWidth:n,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`})}function P6({color:e,radius:t}){return he.createElement("circle",{cx:t,cy:t,r:t,fill:e})}const D6={[ir.Dots]:"#91919a",[ir.Lines]:"#eee",[ir.Cross]:"#e2e2e2"},F6={[ir.Dots]:1,[ir.Lines]:1,[ir.Cross]:6},q6=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function K2({id:e,variant:t=ir.Dots,gap:n=20,size:r,lineWidth:s=1,offset:o=2,color:l,style:u,className:d}){const h=w.useRef(null),{transform:f,patternId:p}=Ke(q6,Tt),g=l||D6[t],v=r||F6[t],k=t===ir.Dots,b=t===ir.Cross,x=Array.isArray(n)?n:[n,n],N=[x[0]*f[2]||1,x[1]*f[2]||1],S=v*f[2],_=b?[S,S]:N,E=k?[S/o,S/o]:[_[0]/o,_[1]/o];return he.createElement("svg",{className:Ft(["react-flow__background",d]),style:{...u,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:h,"data-testid":"rf__background"},he.createElement("pattern",{id:p+e,x:f[0]%N[0],y:f[1]%N[1],width:N[0],height:N[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${E[0]},-${E[1]})`},k?he.createElement(P6,{color:g,radius:S/o}):he.createElement(L6,{dimensions:_,color:g,lineWidth:s})),he.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${p+e})`}))}K2.displayName="Background";var B6=w.memo(K2);function U6(e,t){return e?t==="gone"?"entering":t==="leaving"?"here":t:t==="gone"?"gone":"leaving"}function qu(e){return e!=="gone"}function Bu(e,t){const[n,r]=w.useState(()=>e?"here":"gone"),s=w.useRef(null);return w.useEffect(()=>{r(o=>U6(e,o))},[e]),w.useEffect(()=>{if(n==="leaving")return s.current=window.setTimeout(()=>r("gone"),t),()=>{s.current!=null&&window.clearTimeout(s.current)}},[n,t]),w.useEffect(()=>{n==="entering"&&r("here")},[n]),n}const BN="agent-dag.fm-custom-stations",UN="agent-dag.fm-muted",lx="custom:",z6=/^UC[A-Za-z0-9_-]{22}$/,W6=/^[A-Za-z0-9_-]{11}$/,wb=/^[A-Za-z0-9_-]{1,80}$/,H6=/\.(mp3|aac|ogg)$/i,V6=/\.m3u8$/i,Y2=2048,Rl=80;function La(e){return`${lx}${e}`}function ti(e){if(!e.startsWith(lx))return null;const t=e.slice(lx.length);return wb.test(t)?t:null}function zN(e){return ti(e)??e}function G6(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 vb(e){var l,u;const t=e.trim();if(t.length>Y2)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&&z6.test(d))return{kind:"youtube-channel",url:r,channel:d};const h=(u=/^\/@([^/]+)\/live\/?$/.exec(n.pathname))==null?void 0:u[1];if(h&&/^[A-Za-z0-9._-]{1,64}$/.test(h))return{kind:"youtube-handle",url:r,handle:h};if(n.pathname==="/watch"){const f=n.searchParams.get("v")??"";if(W6.test(f))return{kind:"youtube-video",url:r,video:f}}return null}return V6.test(n.pathname)?{kind:"direct-audio",url:r,format:"hls"}:H6.test(n.pathname)?{kind:"direct-audio",url:r,format:"audio"}:null}function K6(e){return e==="1"}function Y6(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 o=typeof s.id=="string"?s.id:"",l=typeof s.name=="string"?s.name.trim():"",u=typeof s.url=="string"?s.url.trim():"",d=vb(u);!wb.test(o)||n.has(o)||!l||l.length>Rl||!d||(n.add(o),r.push({id:o,name:l,url:d.url}))}return r}function X6(e,t,n){const r=ti(e??"");return r&&t.some(s=>s.id===r)?La(r):n(e)}function Z6(e,t){return e===La(t)?"claude-fm":e}function J6(){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 Q6(e,t,n=J6()){const r=e.trim(),s=vb(t);return!r||r.length>Rl||!wb.test(n)||!s?null:{id:n,name:r,url:s.url}}const X2=.2,Z2=1.6;function eq(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<X2||s>Z2?null:{x:n,y:r,zoom:s}}function cx({durationMs:e,documentHidden:t,reducedMotion:n=tq()}){return t||n?!1:Number.isFinite(e)&&e>0}function tq(){return typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches}const nq=["us-gov","global","apac","us","eu","jp","au"],rq=new RegExp(`^(?:(?:${nq.join("|")})\\.)?anthropic\\.`,"i");function hi(e){return e.replace(rq,"")}const sq=/^(?:claude[-_]|gpt[-_]|o\d|codex[-_])/i,aq=new Set(["tool_input","tool_response"]);function J2(e,t=0){if(!e||typeof e!="object"||t>6)return null;const n=e;if(typeof n.model=="string"&&sq.test(hi(n.model)))return n.model;for(const[r,s]of Object.entries(n)){if(aq.has(r))continue;const o=J2(s,t+1);if(o)return o}return null}function xb(){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 Js(e,t){return`${e}::${t}`}function fi(e,t){return`${e}\0${t}`}const oq=/[0-9a-f]{16,}/i,iq=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Q2(e){return oq.test(e)||iq.test(e)}function lq(e){if(!e)return;const t=e.replace(/\\/g,"/").split("/").filter(Boolean);for(let n=t.length-1;n>=0;n--)if(!Q2(t[n]))return t[n];return t[t.length-1]}function eM(){return{inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0}}function tM(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 bb(e){const t=tM(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 cq(e){if(!e||typeof e!="object"||Array.isArray(e))return;const t={};for(const[n,r]of Object.entries(e)){if(!n||!r||typeof r!="object")continue;const s=r;t[n]=bb(s);const o=uq(s.speeds);o&&(t[n].bySpeed=o)}return Object.keys(t).length?t:void 0}function uq(e){if(!e||typeof e!="object"||Array.isArray(e))return;const t=Object.entries(e).filter(([n,r])=>n&&r&&typeof r=="object").map(([n,r])=>[n,bb(r)]);return t.length?Object.fromEntries(t):void 0}function nM(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),...tM(n)};for(const r of Object.values(n)){const s=nM(r,t+1);if(s)return s}return null}function kb(e){return lq(e)}function Nb(e){const t=e.agent_type??e.subagent_type;return t&&!Q2(t)?t:"subagent"}function Yl(e){return e.agent_id?e.agent_id:e.parent_tool_use_id?e.parent_tool_use_id:null}function Al(e,t){!e.cwd&&t.cwd&&(e.cwd=t.cwd,e.cwdBasename=kb(t.cwd))}function rM(e,t){e.label==="session"&&t.cwd&&(e.label=kb(t.cwd)??"session")}function sM(e,t){const n=Nb(t);n&&(e.label==="subagent"||!e.label)&&(e.label=n)}function pi(e,t,n,r){const s=t;let o=e.agents.get(s);return o||(o={id:s,sessionId:t,label:"session",kind:"root",state:"active",startedAt:n,lastEventAt:n,tools:[],prompts:[],toolCount:0,childCount:0,synthetic:r,usage:eM()},e.agents.set(s,o),o)}function aM(e,t,n,r){const s=Js(t,n),o=e.agents.get(s);return o?(Al(o,r),sM(o,r),o):null}function dq(e,t,n){const r=t.session_id??"unknown",s=Yl(t);if(s){const d=aM(e,r,s,t);if(d)return d}const o=e.activeSubagentStack.get(r),l=o&&o.length>0?o[o.length-1]:null;if(l){const d=e.agents.get(Js(r,l));if(d)return Al(d,t),d}const u=pi(e,r,n,t.hook_event_name!=="SessionStart");return Al(u,t),rM(u,t),u}function hq(e,t,n,r,s){const o=Js(t,n),l=pi(e,t,s,!0);let u=e.agents.get(o);if(u)return Al(u,r),sM(u,r),u;u={id:o,sessionId:t,label:Nb(r),kind:"subagent",parentId:l.id,state:"active",startedAt:s,tools:[],prompts:[],cwd:r.cwd,cwdBasename:kb(r.cwd),toolCount:0,childCount:0,usage:eM()},e.agents.set(o,u);const d=e.pendingSubagentModels.get(o);return d&&(u.model=d,e.pendingSubagentModels.delete(o)),l.childCount+=1,u}function fq(e,t,n){const r=e.activeSubagentStack.get(t)??[];r.includes(n)||(r.push(n),e.activeSubagentStack.set(t,r))}function oM(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 $t(e,t){return Object.hasOwn(e,t)?e[t]:void 0}const pq=/^\s*<task-notification>([\s\S]*?)<\/task-notification>/;function WN(e,t){var n;return((n=new RegExp(`<${t}>([\\s\\S]*?)</${t}>`).exec(e))==null?void 0:n[1].trim())||void 0}const mq={completed:"background task finished",failed:"background task failed",killed:"background task stopped"};function jb(e){const t=pq.exec(e);if(!t)return null;const n=WN(t[1],"status");return{label:(n?$t(mq,n):void 0)??"background task update",detail:WN(t[1],"summary")}}function iM(e){return e.filter(t=>!jb(t.text))}const HN=2e3;function gq(e,t,n){for(let r=e.length-1;r>=0;r--){const s=e[r];if(s.at<t-HN)return!1;if(s.text===n&&s.at<=t+HN)return!0}return!1}function yq(e,t,n){if(gq(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 sd=2e3;function wq(e){const t=e.prompts[e.prompts.length-1];return t&&t.at>e.startedAt?t.at:e.startedAt}function ad(e,t=80){if(e==null)return"";if(typeof e=="string")return e.length>t?e.slice(0,t-1)+"…":e;try{const n=JSON.stringify(e);return n.length>t?n.slice(0,t-1)+"…":n}catch{return String(e)}}const VN=200;function lM(e,t,n){const r=t.ok===!1;t.ok=n,e&&r===n&&(e.toolErrorCount=(e.toolErrorCount??0)+(n?-1:1))}function cM(e,t){return t.agentId==null?void 0:e.agents.get(t.agentId)}function ip(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 vq(e,t,n){var r;return((r=e.get(t))==null?void 0:r.tools.find(s=>s.id===n))??null}const xq=25;function bq(e,t){const n=t.tools;if(n.length>VN){const r=n.splice(0,n.length-VN);for(const s of r)dM(e,t,s)}for(let r=n.length-xq-1;r>=0;r--){const s=n[r];if(s.trimmed)break;s.input=void 0,s.response=void 0,s.trimmed=!0}}function kq(e,t,n){const r=e.toolIndex.get(fi(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 uM(e,t){for(const n of t.tools)dM(e,t,n)}function dM(e,t,n){const r=fi(t.sessionId,n.id);e.toolIndex.get(r)===n&&e.toolIndex.delete(r)}const Nq="no result reached the deck — events were dropped while the deck was paused";function hM(e,t,n,r,s){n.endedAt=r,lM(t,n,!1),n.errorPreview=n.outcomeGap?Nq:s,e.toolIndex.delete(fi(t.sessionId,n.id))}function jq(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(fi((n==null?void 0:n.session_id)??"unknown",s))}function Sq(e,t,n,r,s){const o=t.tool_use_id?kq(e,r,t.tool_use_id):null;if(o){if(t.tool_name&&o.name==="?"){o.name=t.tool_name;const h=cM(e,o);h&&(ip(h,"?",-1),ip(h,o.name,1))}o.endedAt==null&&!o.trimmed&&t.tool_input!==void 0&&(o.input=t.tool_input,o.inputPreview=ad(t.tool_input));return}const l=t.tool_use_id??`${r.id}:${r.toolCount}`,u=Yl(t),d={id:l,name:t.tool_name??"?",input:t.tool_input,inputPreview:ad(t.tool_input),agentId:r.id,explicitSubagentId:u?Js(n,u):void 0,startedAt:s};r.tools.push(d),r.toolCount+=1,ip(r,d.name,1),r.state="active",e.toolIndex.set(fi(r.sessionId,l),d),bq(e,r)}function _q(e,t,n,r,s){const o=t.tool_use_id;if(!o)return;const l=fi(r,o);let u=e.toolIndex.get(l),d=!1;if(!u)for(const f of e.agents.values()){if(f.sessionId!==r)continue;const p=f.tools.find(g=>g.id===o);if(p){u=p,d=!0;break}}if(!u||u.outcomeApplied)return;u.outcomeApplied=!0,u.outcomeGap=void 0,u.endedAt=s,lM(cM(e,u),u,n==="PostToolUse"),u.trimmed||(u.response=t.tool_response),n==="PostToolUseFailure"?u.errorPreview=ad(t.tool_response):d&&(u.errorPreview=void 0);const h=nM(t.tool_response);h&&(u.usage=h),e.toolIndex.delete(l)}function Eq(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 Cq(e,t,n,r){const s=pi(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),Al(s,t),rM(s,t)}function Tq(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=pi(e,n,r,!1);s.state="active",s.endedAt=void 0,s.closedAt=void 0,s.exitAt=void 0;const o=(typeof t.prompt=="string"?t.prompt:typeof t.message=="string"?t.message:"")??"";o&&yq(s.prompts,r,o)&&!s.firstPrompt&&!jb(o)&&(s.firstPrompt=ad(o,120))}function Rq(e,t,n,r){const s=pi(e,n,r,!1),o=wq(s);if(r<o)return;const l=s.lastTurnEndAt;if(!(l!=null&&o>l&&r<=l+sd)){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&&hM(e,u,d,r,"the turn ended before this call returned");t==="SessionEnd"&&(s.closedAt=r),e.activeSubagentStack.delete(n)}}function Aq(e,t,n,r){const s=Yl(t);if(!s)return;const o=hq(e,n,s,t,r),l=Nb(t);l&&(o.label=l);const u=e.subagentTombstones.get(o.id);u!=null&&e.subagentTombstones.delete(o.id);const d=o.endedAt!=null&&r-o.endedAt<=sd,h=u!=null&&r-u<=sd;if(d||h){const f=h?u:o.endedAt;o.state="done",o.endedAt=f,o.startedAt=Math.min(o.startedAt,f),oM(e,n,s);return}o.state="active",o.startedAt=o.startedAt||r,o.exitAt=void 0,o.endedAt=void 0,fq(e,n,s)}function Mq(e,t,n,r){const s=Yl(t);if(!s)return;const o=aM(e,n,s,t);if(!o){for(const[l,u]of e.subagentTombstones)r-u>sd&&e.subagentTombstones.delete(l);e.subagentTombstones.set(Js(n,s),r);return}o.state="done",o.endedAt=Math.min(o.endedAt??r,r),oM(e,n,s)}function fM(){return{msgsUser:0,msgsAssistant:0,toolUses:0,toolResults:0,systemReminders:0,currentContextTokens:0,memoryFiles:[]}}function $q(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??fM(),currentContextTokens:t.context_tokens})}}const Iq=6e4,GN=64;function Oq(e,t,n){const r=typeof t.model=="string"?t.model:null;if(r){const o=e.agents.get(n);o&&(o.model=r)}const s=t.subagentModels;if(s&&typeof s=="object")for(const[o,l]of Object.entries(s)){if(typeof l!="string")continue;const u=Js(n,o),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 h=e.pendingSubagentModels.keys().next().value;h!==void 0&&e.pendingSubagentModels.delete(h)}}}function Lq(e,t,n){const r=t.context??null;if(r){const s=e.agents.get(n);if(s){const o=s.context??fM(),l=(d,h)=>typeof r[d]=="number"?r[d]:h,u=Array.isArray(r.memoryFiles)?r.memoryFiles:Array.isArray(r.claudeMdFiles)?r.claudeMdFiles:null;s.context={msgsUser:l("msgsUser",o.msgsUser),msgsAssistant:l("msgsAssistant",o.msgsAssistant),toolUses:l("toolUses",o.toolUses),toolResults:l("toolResults",o.toolResults),systemReminders:l("systemReminders",o.systemReminders),currentContextTokens:l("currentContextTokens",o.currentContextTokens),memoryFiles:u??o.memoryFiles}}}}function Pq(e,t,n){const r=e.agents.get(n);if(r){const s=typeof t.sessionName=="string"?t.sessionName.trim():"",o=typeof t.sessionTitle=="string"?t.sessionTitle.trim():"";s&&(r.sessionName=s),o&&(r.sessionTitle=o);const l=r.sessionName??"";r.sessionTitle&&l&&r.sessionTitle.toLowerCase()===l.toLowerCase()&&(r.sessionTitle=void 0)}}function Dq(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 Fq(e,t,n,r){const s=t.kind==="thinking"||t.kind==="text"||t.kind==="tool_use"?t.kind:null,o=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&&o<=l.lastOutputAt)){if(l.lastOutputAt=o,s!=="tool_use"){const u=(l.outputs??[]).filter(d=>o-d<Iq);u.push(o),l.outputs=u.length>GN?u.slice(-GN):u}e.revision+=1}}function qq(e,t,n){const r=t.usage??null;if(r){const s=e.agents.get(n);s&&(Object.assign(s.usage,bb(r)),s.usageByModel=cq(t.usageByModel))}}const Bq=["command","cmd","file_path","path","url","pattern","notebook_path"],KN=120,lp=e=>e.length>KN?`${e.slice(0,KN-1)}…`:e;function Uq(e){if(typeof e=="string")return e.trim()?lp(e.trim()):null;if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e;for(const n of Bq){const r=t[n];if(typeof r=="string"&&r.trim())return lp(r.trim());if(Array.isArray(r)&&r.length>0&&r.every(s=>typeof s=="string")){const s=r.join(" ").trim();if(s)return lp(s)}}return null}function zq(e){return e==="permission_prompt"?"permission":e==="agent_needs_input"?"asked":e==="idle_prompt"?"idle":null}const Wq=new Set(["Notification","ModelObserved","ContextObserved","UsageObserved","SessionNamed","SessionRecapped","OutputObserved"]);function Hq(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 Vq=3e4;function Gq(e,t){if(!(!e||!e.name)&&!(t-e.startedAt>Vq)&&!(e.startedAt>t))return{name:e.name,preview:Uq(e.input)??""}}function Kq(e,t,n,r,s){if(n!=="permission")return{kind:n,message:r,since:s};const o=Hq(e,t),l={kind:n,message:r,since:s};o!=null&&o.explicitSubagentId&&(l.subagentId=o.explicitSubagentId);const u=Gq(o,s);return u&&(l.tool=u),l}function Yq(e,t,n){if(e.kind==="idle")return!0;const r=Yl(t);return r==null?!0:e.subagentId!=null&&Js(n,r)===e.subagentId}function Xq(e,t,n,r){if(!Wq.has(t)){const s=e.agents.get(r);s!=null&&s.waiting&&Yq(s.waiting,n,r)&&(s.waiting=null)}}function Zq(e,t,n,r){const s=zq(t.notification_type);if(!s)return;const o=pi(e,n,r,!1),l=typeof t.message=="string"?t.message:"",u=o.waiting;o.waiting=u&&u.kind===s&&u.message===l?{...u,since:Math.min(u.since,r)}:Kq(e,n,s,l,r)}function Xl(e,t){return t&&(e.revision+=1),t}function Jq(e,t,n,r,s){if(e.agents.size<=n)return!1;const o=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 v=u.get(g.parentId);v?v.push(p):u.set(g.parentId,[p])}o(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 h=new Set,f=p=>{const g=e.agents.get(p);g&&(uM(e,g),e.agents.delete(p),h.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(v=>e.agents.get(v)).filter(v=>v!=null);if(!g.some(v=>!o(v))){for(const v of g)f(v.id);f(p.id)}}if(s&&h.size>0){const p=new Set;for(const g of e.agents.values())p.add(g.sessionId);for(const g of h)p.has(g)||s(g)}return Xl(e,d>0)}function Qq(e,t,n,r,s){const o=new Map;for(const[f,p]of e.agents){let g=o.get(p.sessionId);g||(g={ids:[],endedAt:0,live:!1,closed:!1},o.set(p.sessionId,g)),g.ids.push(f),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=[...o].filter(([,f])=>!f.live&&f.endedAt>0&&t-f.endedAt>r).sort(([,f],[,p])=>f.closed===p.closed?f.endedAt-p.endedAt:f.closed?-1:1);let d=[...o.values()].filter(f=>!f.live).length-n;if(d<=0)return!1;let h=!1;for(const[f,p]of l){if(d<=0)break;for(const v of p.ids){const k=e.agents.get(v);k&&uM(e,k),e.agents.delete(v)}const g=Js(f,"");for(const v of e.pendingSubagentModels.keys())v.startsWith(g)&&e.pendingSubagentModels.delete(v);s==null||s(f),d--,h=!0}return Xl(e,h)}function e8(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 Xl(e,t)}function t8(e,t,n){let r=!1;for(const s of e.agents.values()){if(s.provider==="codex")continue;const o=e.agents.get(s.sessionId),l=(o==null?void 0:o.lastEventAt)??(o==null?void 0:o.startedAt);for(const u of s.tools){const d=Math.max(u.startedAt,l??u.startedAt);u.endedAt==null&&t-d>n&&(hM(e,s,u,d,"session ended before this call returned"),r=!0)}}return Xl(e,r)}const YN=90*6e4;function n8(e,t,n){let r=!1;for(const s of e.agents.values()){if(s.kind!=="root")continue;const o=s.lastEventAt??s.startedAt;if(!(t-o<=n)){s.waiting&&(s.waiting=null,r=!0),s.closedAt==null&&(s.closedAt=o),s.state==="active"&&(s.state="done",s.endedAt=o,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=o,r=!0);e.activeSubagentStack.delete(s.sessionId)}}return Xl(e,r)}function od(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 pM(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,o=r.hook_event_name??"Unknown";if(o==="__clear")return{...xb(),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(Xq(e,o,r,l),Eq(e,l,s),$q(e,r,l),o){case"ModelObserved":return Oq(e,r,l),e;case"ContextObserved":return Lq(e,r,l),e;case"SessionNamed":return Pq(e,r,l),e;case"SessionRecapped":return Dq(e,r,l),e;case"OutputObserved":return Fq(e,r,l,s),e;case"UsageObserved":return qq(e,r,l),e}const u=dq(e,r,s);u.provider||(u.provider=r.provider==="codex"?"codex":"claude");const d=J2(r);switch(d&&(u.model=d),o){case"SessionStart":Cq(e,r,l,s);break;case"UserPromptSubmit":Tq(e,r,l,s);break;case"PreToolUse":Sq(e,r,l,u,s);break;case"PostToolUse":case"PostToolUseFailure":_q(e,r,o,l,s);break;case"SubagentStart":Aq(e,r,l,s);break;case"SubagentStop":Mq(e,r,l,s);break;case"Stop":case"SessionEnd":Rq(e,o,l,s);break;case"Notification":Zq(e,r,l,s);break}return e}const r8={input:2,output:10,cacheRead:.2,cacheWrite:2.5,cacheWrite1h:4},s8=[{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:r8},{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}}],a8=[{match:/^claude[-_]opus[-_]5[-_.]5\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:8,output:40,cacheRead:.4,cacheWrite:10,cacheWrite1h:16}},{match:/^claude[-_]opus[-_]5\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:10,output:50,cacheRead:1,cacheWrite:12.5,cacheWrite1h:20}},{match:/^claude[-_]opus[-_]4[-_.]8\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:10,output:50,cacheRead:1,cacheWrite:12.5,cacheWrite1h:20}}];function o8(e){return e?/^(?:gpt[-_]|codex[-_]|o\d)/i.test(e):!1}function qa(e,t=Date.now(),n=Pa){if(!e)return null;const r=i8.get(n);if(!r)return null;const s=hi(e);for(const o of r)if(o.match.test(s))return typeof o.rates=="function"?o.rates(t):o.rates;return null}const Pa="standard",i8=new Map([[Pa,s8],["fast",a8]]);function gl(e,t){return e*t/1e6}function mM(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),o=r+s,l=t.cacheWrite1h??t.cacheWrite;return{tokens5m:o,tokens1h:n,usd5m:gl(o,t.cacheWrite),usd1h:gl(n,l)}}function gM(e,t,n=Date.now()){if(!o8(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 Ko(e,t,n=Date.now()){const r={input:0,output:0,cacheRead:0,cacheWrite:0,total:0};for(const s of Sb(e)){const o=yM(s.usage,t,s.speed,n);r.input+=o.input,r.output+=o.output,r.cacheRead+=o.cacheRead,r.cacheWrite+=o.cacheWrite,r.total+=o.total}return r}function yM(e,t,n,r=Date.now()){const s=qa(t,r,n);if(!s)return{input:0,output:0,cacheRead:0,cacheWrite:0,total:0};const o=gl(gM(e,t,r),s.input),l=gl(e.outputTokens,s.output),u=gl(e.cacheReadTokens,s.cacheRead),d=mM(e,s),h=d.usd5m+d.usd1h;return{input:o,output:l,cacheRead:u,cacheWrite:h,total:o+l+u+h}}function Sb(e){const t=e.bySpeed?Object.entries(e.bySpeed):[];return t.length===0?[{speed:Pa,usage:e}]:[{speed:Pa,usage:l8(e,t.map(([,n])=>n))},...t.map(([n,r])=>({speed:n,usage:r}))]}function l8(e,t){const n=o=>t.reduce((l,u)=>l+(o(u)??0),0),r=o=>Math.max(0,(o(e)??0)-n(o)),s={inputTokens:r(o=>o.inputTokens),outputTokens:r(o=>o.outputTokens),cacheReadTokens:r(o=>o.cacheReadTokens),cacheCreateTokens:r(o=>o.cacheCreateTokens)};return(e.cacheCreate1hTokens!==void 0||e.cacheCreate5mTokens!==void 0)&&(s.cacheCreate1hTokens=r(o=>o.cacheCreate1hTokens),s.cacheCreate5mTokens=r(o=>o.cacheCreate5mTokens)),e.reasoningOutputTokens!==void 0&&(s.reasoningOutputTokens=e.reasoningOutputTokens),s}const ds="not priced";function yl(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=yl(e*100,e<.1?1:0,100);if(t!==null)return`${t}¢`}if(e<100){const t=yl(e,2,100);if(t!==null)return`$${t}`}if(e<1e4){const t=yl(e,0,1e4);if(t!==null)return`$${t}`}return`$${(e/1e3).toFixed(1)}k`}function _b(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 wM(e,t){const n={inputTokens:e.inputTokens+t.inputTokens,outputTokens:e.outputTokens+t.outputTokens,cacheReadTokens:e.cacheReadTokens+t.cacheReadTokens,cacheCreateTokens:e.cacheCreateTokens+t.cacheCreateTokens};if((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)),e.bySpeed||t.bySpeed){const r=new Map(Object.entries(e.bySpeed??{}));for(const[s,o]of Object.entries(t.bySpeed??{})){const l=r.get(s);r.set(s,l?wM(l,o):o)}n.bySpeed=Object.fromEntries(r)}return n}function c8(e,t){let n=0,r=0,s=0,o=0,l=0,u=0;for(const p of t)n+=p.inputTokens,r+=p.outputTokens,s+=p.cacheReadTokens,o+=p.cacheCreateTokens,l+=p.cacheCreate1hTokens??0,u+=p.cacheCreate5mTokens??0;const d=(p,g)=>Math.max(0,p-g),h={inputTokens:d(e.inputTokens,n),outputTokens:d(e.outputTokens,r),cacheReadTokens:d(e.cacheReadTokens,s),cacheCreateTokens:d(e.cacheCreateTokens,o)};return(e.cacheCreate1hTokens!==void 0||e.cacheCreate5mTokens!==void 0)&&(h.cacheCreate1hTokens=d(e.cacheCreate1hTokens??0,l),h.cacheCreate5mTokens=d(e.cacheCreate5mTokens??0,u)),h.inputTokens+h.outputTokens+h.cacheReadTokens+h.cacheCreateTokens>0?h: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(o=>({model:o,usage:t[o]})),s=c8(e.usage,r.map(o=>o.usage));if(s){const o=r.findIndex(l=>l.model===e.model);o>=0?r[o]={model:r[o].model,usage:wM(r[o].usage,s)}:r.push({model:e.model,usage:s})}return r}function hn(e,t=Date.now()){const n={input:0,output:0,cacheRead:0,cacheWrite:0,total:0};for(const r of Zl(e)){const s=Ko(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 Ml(e,t=Date.now()){let n=0;for(const r of Zl(e))for(const s of Sb(r.usage))qa(r.model,t,s.speed)==null&&(n+=s.usage.inputTokens+s.usage.outputTokens);return n}function vM(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 xM(e){return vM(e).filter(t=>t!==e.model)}function XN(e,t){if(!e.bySpeed)return cp(e,t,Pa);const n=Sb(e).filter(r=>r.speed!==Pa||u8(r.usage));return n.length===1?cp(n[0].usage,t,n[0].speed):[...n.map(r=>cp(r.usage,t,r.speed)),"═════════════════════════════════════════",`all speeds = ${Be(Ko(e,t).total)}`].join(`
|
|
58
|
+
`)}function u8(e){return e.inputTokens+e.outputTokens+e.cacheReadTokens+e.cacheCreateTokens>0}function cp(e,t,n){const r=qa(t,Date.now(),n),s=n===Pa?`model: ${t}`:`model: ${t} · ${n}`;if(!r)return`${s}
|
|
59
|
+
no published rate in this build — the tokens are counted, the dollars are not`;const o=g=>g.toLocaleString(),l=g=>`$${g}/MTok`,u=yM(e,t,n),d=mM(e,r),h=d.tokens1h>0?[`cache w5m${o(d.tokens5m).padStart(14)} × ${l(r.cacheWrite).padEnd(11)} = ${Be(d.usd5m)}`,`cache w1h${o(d.tokens1h).padStart(14)} × ${l(r.cacheWrite1h??r.cacheWrite).padEnd(11)} = ${Be(d.usd1h)}`]:[`cache w ${o(d.tokens5m).padStart(14)} × ${l(r.cacheWrite).padEnd(11)} = ${Be(d.usd5m)}`],f=gM(e,t),p=f===e.inputTokens?"input":"uncached";return[s,`${p.padEnd(9)}${o(f).padStart(14)} × ${l(r.input).padEnd(11)} = ${Be(u.input)}`,`output ${o(e.outputTokens).padStart(14)} × ${l(r.output).padEnd(11)} = ${Be(u.output)}`,`cache r ${o(e.cacheReadTokens).padStart(14)} × ${l(r.cacheRead).padEnd(11)} = ${Be(u.cacheRead)}`,...h,"─────────────────────────────────────────",`total = ${Be(u.total)}`].join(`
|
|
60
|
+
`)}function ZN(e){const t=Zl(e),[n]=t;return t.length<=1?XN(n.usage,n.model):[...t.map(r=>XN(r.usage,r.model)),"═════════════════════════════════════════",`all models = ${Be(hn(e).total)}`].join(`
|
|
61
|
+
`)}function d8(e){if(!e.model)return null;const t=qa(e.model),n=hn(e),r=Ml(e);if(!t&&n.total<=0)return e.usage.inputTokens+e.usage.outputTokens<=0?null:{kind:"unpriced",tt:ZN(e)};if(n.total<=0)return null;const s=Math.max(0,((e.endedAt??Date.now())-e.startedAt)/1e3),o=e.state==="active"&&!e.synthetic?_b(n.total,s):null,l=ZN(e)+(o?`
|
|
62
|
+
burn: ${o}`:"");return{kind:"spent",total:n.total,floor:r>0,tt:l}}const h8=new Set(["untrusted","on-request","on-failure"]);function f8(e){return typeof e!="string"||!e?null:h8.has(e)?!0:e==="never"?!1:null}function p8(e){if(e.provider!=="codex"||e.kind!=="root"||e.waiting||e.state!=="active")return null;const t=f8(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."}
|
|
63
|
+
|
|
64
|
+
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 JN(e){return e[0].toUpperCase()+e.slice(1).toLowerCase()}function Ys(e){const t=hi(e).replace(/[-_]\d{8}(?!\d)/,""),n=t.match(/^claude[-_](opus|sonnet|haiku|fable|mythos)[-_](\d+(?:[-_.]\d+)*)/i);if(n){const s=JN(n[1]),o=n[2].replace(/[-_]/g,".");return`${s} ${o}`}const r=t.match(/^gpt[-_](\d+(?:[-_.]\d+)*)((?:[-_][A-Za-z0-9.]+)*)$/i);if(r){const s=r[1].replace(/[-_]/g,"."),o=r[2].split(/[-_]/).filter(Boolean).map(JN);return[`GPT-${s}`,...o].join(" ")}return e}function $d(e){const t=hi(e??""),n=t.match(/^claude[-_](opus|sonnet|haiku|fable|mythos)[-_]/i);return n?n[1].toLowerCase():/^gpt[-_]/i.test(t)?"gpt":""}function hr(e){return(e==null?void 0:e.kind)==="permission"||(e==null?void 0:e.kind)==="asked"}function ux(e){const t=[];for(const n of e)n.kind==="root"&&hr(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 m8(e,t){if(e.length===0)return null;const n=e.findIndex(r=>r.id===t);return e[(n+1)%e.length]}function g8(e){const t=new Set;for(const n of e)n.state==="active"&&t.add(n.sessionId);return t.size}function Id(e,t){return`${e}@${t.since}`}function bM(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 y8(e){const t=e.message||"Needs your permission",n=bM(e,t);return n?`${t}
|
|
65
|
+
Likely on: ${n}`:t}function w8(e,t,n,r=!0){if(!r)return[];if(n)return[];const s=[];for(const o of e){if(!hr(o.waiting))continue;const l=Id(o.id,o.waiting);t.has(l)||s.push({key:l,title:o.label,body:y8(o.waiting),sessionId:o.id})}return s}function v8(e,t,n){const r=new Set;for(const o of e)r.add(Id(o.id,o.waiting));const s=new Set;for(const o of n)r.has(o)&&s.add(o);for(const o of t)s.add(o.key);return s}function vu(e){return new Set(e.map(t=>Id(t.id,t.waiting)))}function x8(e,t){return e!==t}function b8(e,t){return!e&&t!=null}function k8(e,t){return e!==null&&t!=null}function ni(e){return e==="active"?"live":e==="done"?"done":"err"}function ri(e){return e.message?e.message:e.kind==="permission"?"Needs your permission":"Waiting for your input"}function N8(e){return`${e} subagent${e===1?"":"s"} spawned`}function j8(e,t=Date.now(),n=!1){const r=e.tools.filter(o=>o.ok===!1).length,s=hn(e,t).total;return[e.label,e.kind==="root"?"session":"subagent",ni(e.state),hr(e.waiting)?ri(e.waiting):null,e.model?Ys(e.model):null,`${e.toolCount} ${e.toolCount===1?"tool":"tools"}`,r>0?`${r} failed`:null,s>0?`${Be(s)}${Ml(e,t)>0?"+":""}`:null,n?"selected":null].filter(Boolean).join(", ")}function S8(e,t){const n=bM(e,t);return n?`Likely on: ${n}`:null}function Eb(e){return e.kind==="idle"?"Your turn":ri(e)}function ot(e){const t=Math.round(e);if(t<1e3)return`${t}`;if(t<1e6){const n=yl(t/1e3,1,1e3);if(n!==null)return`${n}k`}if(t<1e9){const n=yl(t/1e6,2,1e3);if(n!==null)return`${n}M`}return`${(t/1e9).toFixed(2)}B`}function si(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 o=Math.floor(s/60),l=s%60;return`${o}m ${String(l).padStart(2,"0")}s`}function kM(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 Cb(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 QN=["B","KB","MB","GB","TB"];function ka(e){if(e==null||!Number.isFinite(e)||e<0)return"—";if(e===0)return"0 B";let t=e,n=0;for(;n<QN.length-1&&Number(t.toFixed(1))>=1024;)t/=1024,n++;return`${t.toFixed(1)} ${QN[n]}`}const ej=2e5,_8=1e6,E8=[/\[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],C8=[{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 T8(e){if(!e)return ej;const t=hi(e);for(const n of E8)if(n.test(t))return _8;for(const n of C8)if(n.match.test(t))return n.window;return ej}function NM(e,t){return typeof e=="number"&&e>0?e:T8(t)}const R8=1;function A8(){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,o="dialog"){const l={dismiss:r,layer:s,kind:o,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 wl=A8(),M8=e=>e==="Escape";function $8(e){return e.overlayOpen?"dismiss":e.typing?"blur":"clear-selection"}function tj(e){return String(e.tagName??"").toUpperCase()==="BODY"}function I8(e,t){return!e||!e.isConnected||tj(e)?!1:t==null||tj(t)}const nj="a[href], button, input, select, textarea, [tabindex]";function O8(e){return!e||e.disabled||e.rendered===!1?!1:(e.tabIndex??0)>=0}function L8(e){if(!e||!e.overflowing||e.hasFocusable)return!1;const t=String(e.overflow??"").toLowerCase();return t==="auto"||t==="scroll"}function P8({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 Od(e){return e.ctrlKey||e.metaKey||e.altKey}const D8=new Set(["button","checkbox","color","file","image","radio","range","reset","submit"]),F8=new Set(["INPUT","TEXTAREA","SELECT","OPTION","BUTTON","SUMMARY","A"]),q8=new Set(["button","checkbox","combobox","link","listbox","menu","menubar","menuitem","menuitemcheckbox","menuitemradio","option","radio","searchbox","slider","spinbutton","switch","tab","textbox","treeitem"]);function Tb(e){return typeof e.tagName=="string"?e.tagName.toUpperCase():""}function B8(e){return Tb(e)==="BUTTON"?!0:(typeof e.role=="string"?e.role.trim().toLowerCase():"").split(/\s+/).includes("button")}function Ld(e){if(!e)return!1;if(e.isContentEditable)return!0;const t=Tb(e);return t==="TEXTAREA"?!0:t!=="INPUT"?!1:!D8.has(String(e.type??"text").toLowerCase())}function U8(e,t){if(!e)return!1;if(Ld(e))return!0;if(t!=null&&t.length===1&&t!==" "&&e.pointerFocused&&B8(e))return!1;if(F8.has(Tb(e)))return!0;const n=typeof e.role=="string"?e.role.trim().toLowerCase():"";return n!==""&&n.split(/\s+/).some(r=>q8.has(r))}function z8({key:e,modalOpen:t,sheetOpen:n}){return t?!(e==="?"&&n):!1}function W8({appModal:e,dialogDepth:t}){return e||t>0}function jM(e){return e?Array.from(e.querySelectorAll("*")).filter(t=>{if(t.matches(nj))return O8({disabled:t.disabled,tabIndex:t.tabIndex,rendered:t.getClientRects().length>0});const n=t.scrollHeight>t.clientHeight;return n&&L8({overflowing:n,overflow:getComputedStyle(t).overflowY,hasFocusable:t.querySelector(nj)!=null})}):[]}function H8(e,t){const n=jM(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 yt(e,t={}){const{focusRef:n,layer:r,popover:s}=t,o=s?"popover":"dialog",l=w.useRef(null),u=w.useRef(e);u.current=e;const d=w.useRef(null);d.current===null&&(d.current=()=>u.current());const h=d.current;return w.useEffect(()=>wl.push(h,r,o),[h,r,o]),w.useEffect(()=>{var p;const f=document.activeElement;return(p=(n==null?void 0:n.current)??jM(l.current)[0])==null||p.focus(),()=>{I8(f,document.activeElement)&&f.focus()}},[]),w.useEffect(()=>{const f=p=>{var N;if(p.key!=="Tab"||Od(p))return;const g=l.current;if(!g)return;const v=document.activeElement;if(!(v!=null&&g.contains(v))&&!wl.isTop(h))return;const b=H8(g,v),x=P8({count:b.length,index:v?b.indexOf(v):-1,shiftKey:p.shiftKey});x.kind!=="allow"&&(p.preventDefault(),x.kind==="focus"&&((N=b[x.index])==null||N.focus()))};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[h]),l}function V8(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 In(e){return e.toLocaleString()}const G8=60;function K8(e,t=G8){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 Y8({agent:e,onClose:t}){var g;const n=w.useRef(null),r=yt(t,{focusRef:n}),s=e.context,o=e.usage,l=(s==null?void 0:s.currentContextTokens)??0,u=NM(e.contextWindow,e.model),d=Math.min(100,l/u*100),h=hn(e),f=e.provider==="codex"?o.inputTokens+o.outputTokens:o.inputTokens+o.outputTokens+o.cacheReadTokens+o.cacheCreateTokens,p=V8(e.provider);return a.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:a.jsxs("div",{ref:r,className:"modal ctx-modal",onClick:v=>v.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:[In(l)," / ",In(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(er,{label:"input tokens",val:In(o.inputTokens)}),a.jsx(er,{label:"output tokens",val:In(o.outputTokens)}),a.jsx(er,{label:"cache reads",val:In(o.cacheReadTokens)}),a.jsx(er,{label:"cache writes",val:In(o.cacheCreateTokens)}),a.jsx(er,{label:"cumulative total",val:In(f)}),a.jsx(er,{label:"estimated cost",val:Be(h.total),accent:!0})]}),a.jsx("h3",{className:"ctx-section-title",children:"Transcript composition"}),p.compositionCounted?a.jsxs("div",{className:"ctx-grid",children:[a.jsx(er,{label:"user messages",val:In((s==null?void 0:s.msgsUser)??0)}),a.jsx(er,{label:"assistant messages",val:In((s==null?void 0:s.msgsAssistant)??0)}),a.jsx(er,{label:"tool uses",val:In((s==null?void 0:s.toolUses)??0)}),a.jsx(er,{label:"tool results",val:In((s==null?void 0:s.toolResults)??0)}),a.jsx(er,{label:"system-reminders",val:In((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(v=>a.jsxs("li",{children:[a.jsx("span",{className:"ctx-md-path",title:v.path,children:K8(v.path)}),a.jsx("span",{className:"ctx-md-size",children:ka(v.bytes)})]},v.path))})]})})}function er({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 X8({currentContextTokens:e,modelId:t,contextWindow:n,size:r=26,onClick:s}){const o=NM(n,t),l=Math.min(1,e/o),u=r/2-3,d=r/2,h=2*Math.PI*u,f=h*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()} / ${o.toLocaleString()} (${(l*100).toFixed(1)}%)`,"aria-label":`Context ${Math.round(l*100)}% of ${o.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:`${f} ${h-f}`,strokeDashoffset:h/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 rj=new Map;function SM(e){let t=rj.get(e);return t||(t={now:Date.now(),listeners:new Set,timer:null},rj.set(e,t)),t}function Z8(e,t){const n=SM(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 J8(e){return SM(e).now}const sj=new Map,aj=new Map;function mi(e=1e3){let t=sj.get(e);t||(t=r=>Z8(e,r),sj.set(e,t));let n=aj.get(e);return n||(n=()=>J8(e),aj.set(e,n)),w.useSyncExternalStore(t,n,n)}function Pd(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 Q8="1",oj="agent-dag.schema",eB=["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 Ye(e,t){if(!(typeof window>"u"))try{window.localStorage.setItem(e,t)}catch{}}function ls(e){if(!(typeof window>"u"))try{window.localStorage.removeItem(e)}catch{}}function vl(){if(typeof window>"u")return null;try{return window.localStorage}catch{return null}}function tB(e,t=Q8){let n=null;try{n=e.getItem(oj)}catch{return[]}if(n===t)return[];const r=[];if(n!==null)for(const s of eB)try{e.getItem(s)!==null&&(e.removeItem(s),r.push(s))}catch{}try{e.setItem(oj,t)}catch{}return r}const _M="agent-dag.recapsDismissed",ij=200;function nB(){const e=Qe(_M);if(!e)return[];try{const t=JSON.parse(e);return Array.isArray(t)?t.filter(n=>typeof n=="string"):[]}catch{return[]}}let ai=new Set(nB());const dx=new Set;let EM=0;function CM(e){return dx.add(e),()=>{dx.delete(e)}}function TM(e){ai=e,EM++;const t=Array.from(e);Ye(_M,JSON.stringify(t.length>ij?t.slice(-ij):t));for(const n of dx)n()}function RM(e,t){return`${e}@${t}`}function rB(e){return ai.has(e)}function sB(e){if(ai.has(e))return;const t=new Set(ai);t.add(e),TM(t)}function aB(e){const t=new Set(ai);t.delete(e)||t.add(e),TM(t)}function oB(e){return w.useSyncExternalStore(CM,()=>e!=null&&ai.has(e),()=>!1)}function Rb(e){return`recap:${e}`}function iB(e){return e.startsWith("recap:")}function lB(){return w.useSyncExternalStore(CM,()=>EM,()=>0)}function cB(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 AM(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 MM(e){return e.live>0?`→ ${e.total} · ${e.live} live`:`→ ${e.total} · done`}function uB(e,t,n){const r=e.kind==="root"?e.waiting:null;if(r&&hr(r))return{tone:"warn",long:n.sayWaiting(r),short:r.kind==="permission"?"Needs you":"Asked you"};if(r&&r.kind==="idle"){const o=n.sayWaiting(r);return{tone:"idle",long:o,short:o}}const s=e.tools.filter(o=>o.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:AM(t),short:MM(t)};if(e.state==="active")for(let o=e.tools.length-1;o>=0;o--){const l=e.tools[o];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 hx(e){return e==="active"?"live":e==="done"?"done":"err"}const Dd={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"}},dB=Object.fromEntries(Object.entries(Dd).map(([e,t])=>[e,t.category])),hB=Object.fromEntries(Object.entries(Dd).map(([e,t])=>[e,t.emoji])),fB=Object.fromEntries(Object.entries(Dd).map(([e,t])=>[e,t.label])),pB=new Set(Object.entries(Dd).filter(([,e])=>e.shell).map(([e])=>e)),mB={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",...dB};function $M(e){return e.startsWith("mcp__")?"mcp":$t(mB,e)??"other"}const gB=/\btools\.exec_command\s*\(\s*\{[^{}]*?\bcmd\s*:\s*(["'`])((?:\\.|(?!\1)[^\\])*)\1/,yB=/\btools\.([A-Za-z_$][\w$]*)\s*\(/;function wB(e){if(typeof e!="string"||!e)return null;const t=gB.exec(e);if(t){const r=vB(t[2]);if(r.trim())return r}const n=yB.exec(e);return n?n[1]:null}function vB(e){return e.replace(/\\(["'`\\nrt])/g,(t,n)=>n==="n"?`
|
|
66
|
+
`:n==="r"?"\r":n==="t"?" ":n)}const xB={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:"📡",...hB};function lj(e){return e.startsWith("mcp__")?"🔌":$t(xB,e)??"✨"}const bB={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 IM(e){return/^-(?:Command|c)$/i.test(e)||/^-[a-z]+c$/.test(e)}function OM(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(o=>IM(o)||/^-(?:NoProfile|NonInteractive)$/i.test(o)))return OM(n[2]);for(;;){const o=t.match(/^([A-Z_][A-Z0-9_]*=\S*)\s+/);if(!o)break;t=t.slice(o[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 kB(e){if(typeof e=="string")return e;if(!e||typeof e!="object")return null;const t=e;if(typeof t.script=="string"){const n=wB(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(IM);if(r>=0&&r+1<n.length)return n[r+1]}return n.join(" ")}return typeof t.script=="string"?t.script:null}const NB=new Set(["Bash","PowerShell",...pB]);function jB(e,t){if(!NB.has(e))return null;const n=kB(t);if(!n)return null;const r=OM(n);return r?{emoji:$t(bB,r)??"⚙️",label:r,category:"shell",detail:n}:null}const SB=new Set(["Read","Write","Edit","MultiEdit","NotebookEdit","LS","Glob","apply_patch"]),_B={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:"🗄️"},EB={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 CB(e){const n=e.replace(/\\/g,"/").replace(/\/+$/,""),r=n.lastIndexOf("/");return r>=0?n.slice(r+1):n}function TB(e){const t=e.toLowerCase(),n=$t(EB,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=$t(_B,t.slice(r+1));if(s!==void 0)return s}return"📄"}function RB(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 AB(e,t){if(!SB.has(e))return null;const n=RB(e,t);if(!n)return null;const r=CB(n);return r?{emoji:e==="LS"?"📂":TB(r),label:r,category:"file",detail:n}:null}const MB={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 Ab(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 $B(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 LM(e){return $t(MB,e.toLowerCase())}function IB(e,t){const n=Ab(e);if(!n)return null;const{server:r,method:s}=n;if(!s)return null;const o=LM(r);return{emoji:(o==null?void 0:o.emoji)??"🔌",label:s,category:"mcp",detail:o?`${o.name} · ${s}`:`${r} · ${s}`}}function PM(e,t){return jB(e,t)??AB(e,t)??IB(e)}function OB(e,t){var n;return((n=PM(e,t))==null?void 0:n.label)??null}const LB=fB,cj=18;function xu(e){const t=[...e];return t.length<=cj?e:t.slice(0,cj-1).join("")+"…"}const up=13,PB=6;function DB(e,t){const n=[...e];if(n.length<=up)return e;const r=n.lastIndexOf("."),s=r>0?n.slice(r):[];return t==="file"&&s.length>1&&s.length<=PB?n.slice(0,up-1-s.length).join("")+"…"+s.join(""):n.slice(0,up-1).join("")+"…"}function Mb(e){const t=Ab(e);if(t){const r=LM(t.server);return r?{emoji:r.emoji,label:xu(r.name)}:{emoji:"🔌",label:xu(t.server),hue:$B(t.server)}}const n=$t(LB,e)??"";return n?{emoji:lj(e),label:xu(n)}:{emoji:lj(e),label:xu(e)}}function FB(e){let t=null,n="";for(const r of e){const s=Ab(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:Mb(n)}const fx=6e4,Yo=24,uj=fx/Yo,dp=132,Uu=14;function qB(e,t,n){const r=new Array(Yo).fill(0);let s=0;const o=g=>{const v=n-g;if(v<0||v>=fx)return;const k=Yo-1-Math.floor(v/uj);k>=0&&k<Yo&&(r[k]+=1,s+=1)};for(const g of e)o(g.startedAt);for(const g of t??[])o(g);const u=Math.max(0,...r)/(uj/1e3),d=e.filter(g=>n-g.startedAt>=0&&n-g.startedAt<fx).length,h=s-d,f=[d>0?`${d} tool ${d===1?"call":"calls"}`:"",h>0?`${h} ${h===1?"block":"blocks"} of thinking and writing`:""].filter(Boolean),p=s===0?"nothing in the last 60s":`${f.join(" · ")} in last 60s · peak ${u.toFixed(1)}/s`;return{counts:r,title:p}}const BB=2;function UB(e){return e===0?1.5:Math.max(1.5,Math.min(1,e/BB)*Uu)}function DM({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 $b(){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 $l(){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 zB({data:e,selected:t}){var N,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,o=od(e.sessionId),l=((N=e.context)==null?void 0:N.currentContextTokens)??0,u=e.kind==="root"&&l>0,d=e.sessionTitle?e.cwd?`${e.cwd}
|
|
67
|
+
${e.sessionTitle}`:e.sessionTitle:e.cwd,h=xM(e),f=h.length>0?`${e.model}
|
|
68
|
+
spend on this card also covers:
|
|
69
|
+
${h.join(`
|
|
70
|
+
`)}`:e.model,p=Cb(e.sessionName,e.sessionTitle),g=Pd(e),v=g?RM(e.sessionId,g.at):null,k=oB(v),b=g!=null&&!k,x=d8(e);return a.jsxs("div",{className:n,style:{"--session-hue":o},children:[a.jsx("span",{className:"accent-stripe"}),a.jsx(Oa,{type:"target",position:Ae.Left,style:{background:"transparent",border:"none"}}),a.jsxs("div",{className:"head",children:[a.jsxs("div",{className:"title",children:[a.jsx(GB,{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&&v&&a.jsx("button",{type:"button",className:"glyph-btn recap-pin","aria-label":"Claude Code's recap","aria-expanded":b,title:b?"Hide the recap":"Show Claude Code's recap",onClick:_=>{_.stopPropagation(),aB(v)},children:a.jsx($l,{})})]}),a.jsxs("div",{className:"head-right",children:[u&&e.onOpenContext&&a.jsx(X8,{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(VB,{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:N8(e.childCount),children:["→ ",e.childCount]}),e.cwdBasename&&e.kind==="subagent"?` · ${e.cwdBasename}`:"",e.model?a.jsxs("span",{className:"model-chip","data-family":$d(e.model),title:f,children:[Ys(e.model),h.length>0?` +${h.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(KB,{waiting:e.waiting}),(()=>{const _=p8(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(YB,{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:ot(e.usage.inputTokens+e.usage.outputTokens)})," tok"]}),(x==null?void 0:x.kind)==="unpriced"&&a.jsx("span",{className:"cost-unpriced",title:x.tt,children:ds}),(x==null?void 0:x.kind)==="spent"&&a.jsx("span",{className:"cost-meta",title:x.tt,children:a.jsxs("b",{children:[Be(x.total),x.floor?"+":""]})})]}),a.jsx(HB,{data:e,title:e.kind==="root"?p.face:void 0}),a.jsx(Oa,{type:"source",position:Ae.Right,style:{background:"transparent",border:"none"}})]})}const WB=w.memo(zB);function HB({data:e,title:t}){const n=e.kind==="root"&&hr(e.waiting),r=uB(e,e.branch,{sayWaiting:Eb,describeCall:s=>({name:Mb(s.name).label,subject:OB(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(DM,{kind:hx(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($b,{})]}),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 VB({start:e,end:t}){const n=mi(1e3);return a.jsx(a.Fragment,{children:si(e,t,n)})}function GB({state:e}){return a.jsx("span",{className:`state-pill state-${e}`,children:ni(e)})}function KB({waiting:e}){const t=mi(1e3),n=hr(e),r=ri(e);return a.jsxs("div",{className:n?"waiting-row permission":"waiting-row idle",title:`${r}
|
|
71
|
+
Blocked for ${si(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:Eb(e)}),a.jsx("b",{children:si(e.since,void 0,t)})]})}function YB({tools:e,outputs:t}){const n=mi(1e3),{counts:r,title:s}=qB(e,t,n),o=dp/Yo;return a.jsxs("div",{className:"tool-spark-row",title:s,children:[a.jsx("svg",{className:"tool-spark",width:dp,height:Uu,viewBox:`0 0 ${dp} ${Uu}`,"aria-hidden":!0,children:r.map((l,u)=>{const d=UB(l),h=u===Yo-1&&l>0,p=`tool-spark-bar${l>0?" active":""}${h?" latest":""}`;return a.jsx("rect",{x:u*o+.4,y:Uu-d,width:Math.max(.5,o-1),height:d,rx:.8,className:p},h?`landed:${l}`:u)})}),a.jsx("span",{className:"tool-spark-label",children:"60s"})]})}function XB({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 id(e){const t=Math.max(0,Math.floor(e));return`${t} event${t===1?"":"s"}`}const dj=99;function ZB(e){const t=Math.max(0,Math.floor(e));return t>dj?`${dj}+`:String(t)}const JB="Pause the canvas";function QB(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 — ${id(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)":`${id(e.held)} arrived while paused and will be applied in order when you resume (Space)`}function eU(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 FM="paused · full",tU=(e,t)=>t>0?FM:e>0?`paused · ${ZB(e)}`:"paused";function nU(e){const t=Math.max(0,Math.floor(e.dropped??0));return e.connected?e.paused?{tone:"paused",resting:!1,label:tU(e.held,t),widest:FM,title:t>0?`Connected — the pause is full at ${id(e.held)}; the oldest are being dropped as new ones arrive. Resume to catch up (Space)`:e.held>0?`Connected — ${id(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 rU=e=>e.transform[2]>=e.maxZoom,sU=e=>e.transform[2]<=e.minZoom;function aU({autoFitDisabled:e,enableAutoFitAndRefit:t,paused:n,pauseGate:r,togglePause:s,handleRelayout:o,requestClear:l,setKeyHelpOpen:u}){const d=di(),h=Ke(rU),f=Ke(sU);return a.jsxs(O6,{showInteractive:!1,showFitView:!1,showZoom:!1,children:[a.jsx(On,{onClick:()=>{h||d.zoomIn()},title:"Zoom in","aria-label":"Zoom in","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:"M12 5v14M5 12h14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})})}),a.jsx(On,{onClick:()=>{f||d.zoomOut()},title:"Zoom out","aria-label":"Zoom out","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:"M5 12h14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})})}),a.jsx(On,{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(On,{"data-group-start":"",onClick:s,title:QB({paused:n,held:r.size,dropped:r.dropped}),"aria-label":JB,"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(On,{onClick:o,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(On,{"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(On,{"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 Ra=148,hj=6e3,oU=16e3,qM=46,Vs=34;function iU(e,t,n=Ra){let r=-Math.round(t()*n);if(Math.abs(r-e)<Vs){const s=e-Vs>=-n?-Vs:Vs;r=Math.max(-n,Math.min(0,Math.round(e+s)))}return{to:r,ms:Math.round(Math.abs(r-e)*qM)}}function lU(e){return Math.round(hj+e()*(oU-hj))}const fj=[{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 cU(e){const t=fj.reduce((r,s)=>r+s.weight,0);let n=e()*t;for(const r of fj)if(n-=r.weight,n<0)return r.kind;return"stroll"}const uU=720,dU=260,hU=620,fU=220,pj=520,BM=1600,mj=7e3,pU=15e3,gj=6e3,mU=14e3;function Ro(e,t,n=Ra){let r=-Math.round(t()*n);if(Math.abs(r-e)<Vs){const s=e-Vs>=-n?-Vs:Vs;r=Math.max(-n,Math.min(0,Math.round(e+s)))}return r}const Ct=(e,t)=>Math.round(Math.abs(t-e)*qM),gU=120,bu=0;function yU(e,t){const n=r=>({kind:"litter",at:t,...r});return[{x:t,prop:n({}),act:"walk",ms:Ct(e,t)},{x:t,prop:n({}),act:"stoop",ms:uU},{x:bu,prop:n({held:!0}),act:"carry",ms:Ct(t,bu)},{x:bu,prop:n({held:!0}),act:"windup",ms:dU},{x:bu,prop:n({held:!0,leaving:!0}),act:"toss",ms:hU}]}function wU(e,t){const n=t>e?1:-1,r=t-n*Math.min(15,Math.abs(t-e)),s=(o={})=>({kind:"ball",at:t,...o});return[{x:r,prop:s(),act:"walk",ms:Ct(e,r)},{x:r,prop:s(),act:"windup",ms:fU,facing:n>0?"right":"left"},{x:r,prop:s({leaving:!0}),act:"kick",ms:pj,facing:n>0?"right":"left"},{x:r,prop:s({leaving:!0}),act:"stand",ms:BM-pj}]}const UM=640;function vU(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:Ct(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:Ct(r,0)}]}function xU(e,t,n){const r=Math.max(-110,Math.min(-30,t)),s={x:r,prop:null};return[{...s,act:"walk",ms:Ct(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:Ct(r,0)}]}function bU(e,t,n){return[{x:t,prop:null,act:"walk",ms:Ct(e,t)},{x:t,prop:null,act:"sit",ms:Math.round(gj+n()*(mU-gj))},{x:t,prop:null,act:"stand",ms:400}]}function kU(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:Ct(e,t)},{x:t,prop:r(),act:"watch",ms:Math.round(mj+n()*(pU-mj))},{x:t,prop:r(),act:"scope-pack",ms:480},{x:t,prop:null,act:"stand",ms:240}]}function hp(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 NU=1500,jU=e=>Math.round(1e3*Math.sqrt(2*e/NU)),SU=115,_U=e=>Math.round(e/SU*1e3),EU=620,CU=200,TU=760,RU=600,AU=240;function MU(e,t,n){const s=-(t.ledgeSpan??Ra),o=jU(t.ledgeH),l=_U(t.ledgeH),u=n(),d=n(),h=-Math.round(u*t.floorSpan),f=-Math.round(d*t.floorSpan);return[{x:s,act:"walk",prop:null,ms:Ct(e,s)},{x:s,act:"peer",prop:null,ms:EU},{x:s,act:"fall",prop:null,ms:o,place:"floor"},{x:s,act:"land",prop:null,ms:CU,place:"floor"},{x:h,act:"walk",prop:null,ms:Ct(s,h),place:"floor",floorFrac:u},{x:f,act:"walk",prop:null,ms:Ct(h,f),place:"floor",floorFrac:d},{x:s,act:"walk",prop:null,ms:Ct(f,s),place:"floor"},{x:s,act:"lasso",prop:null,ms:TU,place:"floor"},{x:s,act:"rope-throw",prop:null,ms:RU,place:"floor"},{x:s,act:"rope-catch",prop:null,ms:AU,place:"floor"},{x:s,act:"climb",prop:null,ms:l},{x:s,act:"pull-up",prop:null,ms:480}]}function $U(e,t,n){const r=(n==null?void 0:n.ledgeSpan)??Ra;switch(cU(t)){case"tidy":return yU(e,Ro(e,t,r));case"kick":return wU(e,Ro(e,t,r));case"sit":return bU(e,Ro(e,t,r),t);case"watch":return kU(e,Ro(e,t,r),t);case"fish":return vU(e,Ro(e,t,r),t);case"skip":return xU(e,Ro(e,t,r),t);case"leave":{if(!n||!(n.ledgeH>0)||!(n.floorSpan>0))break;return MU(e,n,t)}}const o=iU(e,t,r);return[{x:o.to,prop:null,act:"walk",ms:o.ms}]}const IU=420;function OU(e,t,n){const r=t==="right"?n-e-18:e-18;return(t==="right"?1:-1)*Math.min(IU,Math.max(0,r))}const LU=260,PU=200;function DU(e,t,n){const r=(f,p=Ct(e,f))=>({x:f,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,h={place:"floor",riser:n.height,prop:null};return[r(u,Ct(e,u)),{...h,x:u,act:"mount",ms:LU},{...h,x:d,act:"walk",ms:Ct(u,d)},{x:d,prop:null,act:"dismount",ms:PU,place:"floor"},{x:t,prop:null,act:"walk",ms:Ct(d,t),place:"floor"}]}const zM=["bob","sway","groove"],yj=9e3,FU=16e3,WM=1e3,qU=.08;function BU(e,t){const n=zM.filter(o=>o!==e),r=n[Math.min(n.length-1,Math.floor(t()*n.length))],s=(t()*2-1)*qU;return{dance:r,beatMs:Math.round(WM*(1+s))}}function UU(e){return Math.round(yj+e()*(FU-yj))}const HM=["......aaaaaa......","....aa......aa....","...a..bbbbbs..a...","...cpcbbbbbscpc...","...cpcbebbescpc...","...cpcbbbbbscpc...","...cpcbbbbbscpc...","....ccbbbbbscc....","....bbbbbbbbbs....","....bbbbbbbbbs....","......bbbbbs......","......bb..bs......","......bb..bs......","......bb..bs......"],wj=18,zU=HM.length,VM=new Set(["a","c","p"]);function Fd(e=HM){const t=[];return e.forEach((n,r)=>{let s=0;for(;s<n.length;){const o=n[s];if(o==="."){s+=1;continue}let l=1;for(;s+l<n.length&&n[s+l]===o;)l+=1;t.push({x:s,y:r,w:l,cell:o}),s+=l}}),t}const WU=[".xx.","xxxx",".xx."],HU=["..xx..",".xsxx.","xssxxx","xxxxsx",".xxxx.","..xx.."],VU=["...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."],fp={litter:WU,ball:HU,scope:VU},GU=["...hhhhhh...","...hhhhhh...","...kkkkkk...","hhhhhhhhhhhh"],KU=3,YU=-1,px=11,vj=9,mx="https://www.youtube-nocookie.com";function XU(e,t,n){const r=new URLSearchParams({...n?{}:{channel:e},enablejsapi:"1",autoplay:"1",playsinline:"1",rel:"0",modestbranding:"1",origin:t});return`${mx}/embed/${n?encodeURIComponent(n):"live_stream"}?${r.toString()}`}function Ao(e,t=[]){return JSON.stringify({event:"command",func:e,args:t})}function ZU(e="claude-fm"){return JSON.stringify({event:"listening",id:e,channel:"widget"})}const JU=[1,3],QU=[0,2],ez=[2,5,100,101,150];function tz(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:JU.includes(s)?{kind:"playing",playing:!0}:QU.includes(s)?{kind:"playing",playing:!1}:null}return null}const nz="modulepreload",rz=function(e){return"/"+e},xj={},Ib=function(t,n,r){let s=Promise.resolve();if(n&&n.length>0){let l=function(h){return Promise.all(h.map(f=>Promise.resolve(f).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(h=>{if(h=rz(h),h in xj)return;xj[h]=!0;const f=h.endsWith(".css"),p=f?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${p}`))return;const g=document.createElement("link");if(g.rel=f?"stylesheet":nz,f||(g.as="script"),g.crossOrigin="",g.href=h,d&&g.setAttribute("nonce",d),document.head.appendChild(g),f)return new Promise((v,k)=>{g.addEventListener("load",v),g.addEventListener("error",()=>k(new Error(`Unable to preload CSS for ${h}`)))})}))}function o(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"&&o(u.reason);return t().catch(o)})},sz={"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 az({fetchImpl:e,volume:t,muted:n,source:r,playRequest:s,customStation:o,onAvailabilityChange:l}){const[u,d]=w.useState(null),[h,f]=w.useState(!1),[p,g]=w.useState(!1),[v,k]=w.useState(!1),b=w.useRef(s),x=w.useRef(null),N=w.useRef(null),S=w.useRef(null),_=w.useCallback(()=>{var P;(P=N.current)==null||P.destroy(),N.current=null;const L=x.current;L&&(L.pause(),L.removeAttribute("src"),L.load(),x.current=null)},[]),E=w.useCallback(L=>{var P,I;(I=(P=S.current)==null?void 0:P.contentWindow)==null||I.postMessage(L,mx)},[]),T=w.useRef(t);T.current=t;const R=w.useRef(n);R.current=n;const A=w.useCallback((L,P,I)=>{_();const O=new Audio;O.preload="none",O.volume=T.current/100,O.muted=R.current,x.current=O,g(!0),k(!0);const U=()=>x.current===O,M=()=>{_(),g(!1),k(!1)},$=()=>{U()&&(M(),f(!0),l==null||l(I,!0))},B=V=>{if(U()){if(V instanceof DOMException&&V.name==="NotAllowedError"){M();return}$()}};O.addEventListener("playing",()=>{U()&&(k(!0),l==null||l(I,!1))}),O.addEventListener("ended",()=>{U()&&M()}),O.addEventListener("error",$,{once:!0}),P&&!O.canPlayType("application/vnd.apple.mpegurl")?Ib(async()=>{const{default:V}=await import("./hls-BFpXDghs.js");return{default:V}},[]).then(({default:V})=>{if(!U())return;if(!V.isSupported()){$();return}const H=new V;N.current=H,H.on(V.Events.ERROR,(F,W)=>{W.fatal&&$()}),H.on(V.Events.MEDIA_ATTACHED,()=>H.loadSource(L)),H.on(V.Events.MANIFEST_PARSED,()=>{O.play().catch(B)}),H.attachMedia(O)},$):(O.src=L,O.play().catch(B))},[l,_]);return w.useEffect(()=>{p&&(E(Ao("setVolume",[t])),E(Ao(n?"mute":"unMute")),x.current&&(x.current.volume=t/100,x.current.muted=n))},[t,n,p,E]),w.useEffect(()=>{let L=!0;const P=e??fetch,I=b.current!==s;b.current=s,d(null),f(!1),g(I),k(I),_();const O=o&&La(o.id)===r?vb(o.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),I&&A(O.url,O.format==="hls",r),()=>{L=!1}):(P(`/api/fm-station?url=${encodeURIComponent(O.url)}`).then($=>$.ok?$.json():null).then($=>{L&&($!=null&&$.channel||$!=null&&$.video?(d({live:!0,channel:$.channel??"",video:$.video??void 0}),l==null||l(r,!1)):(f(!0),l==null||l(r,!0)))}).catch(()=>{L&&(f(!0),l==null||l(r,!0))}),()=>{L=!1});if(ti(r))return f(!0),l==null||l(r,!0),()=>{L=!1};const U=r,M=sz[U];if(M)P(M).then($=>$.ok?$.json():null).then($=>{L&&($!=null&&$.video&&d({live:!0,channel:"",video:$.video}),l==null||l(r,!($!=null&&$.video)))}).catch(()=>{L&&(l==null||l(r,!0))});else if(U!=="claude-fm"){const $=U.replace("lofi-","");P(`/api/lofi-girl?station=${encodeURIComponent($)}`).then(B=>B.ok?B.json():null).then(B=>{L&&(B!=null&&B.video&&d({live:!0,channel:"",video:B.video}),l==null||l(r,!(B!=null&&B.video)))}).catch(()=>{L&&(l==null||l(r,!0))})}else P("/api/claude-fm").then($=>$.ok?$.json():null).then($=>{if(!L)return;const B=!!($!=null&&$.live&&($!=null&&$.channel));B&&d({live:!0,channel:$.channel}),l==null||l(r,!B)}).catch(()=>{L&&(l==null||l(r,!0))});return()=>{L=!1}},[o==null?void 0:o.id,o==null?void 0:o.url,e,l,s,r,A,_]),w.useEffect(()=>()=>_(),[_]),w.useEffect(()=>{if(!p)return;const L=P=>{var O;if(P.origin!==mx||P.source!==((O=S.current)==null?void 0:O.contentWindow))return;const I=tz(P.data);if(I){if(I.kind==="ready"){E(Ao("setVolume",[T.current])),E(Ao(n?"mute":"unMute")),E(Ao("playVideo"));return}if(I.kind==="playing"){k(I.playing);return}ez.includes(I.code)&&(g(!1),k(!1),f(!0),l==null||l(r,!0))}};return window.addEventListener("message",L),()=>window.removeEventListener("message",L)},[p,n,l,E,r]),{probe:u,dead:h,armed:p,playing:v,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 L=!v;k(L),E(Ao(L?"playVideo":"pauseVideo")),L||g(!1)}}}function bj(e){let t=null,n=null,r=0,s=0,o=!1;const l=()=>{t!==null&&clearTimeout(t),t=null},u=()=>{o||e.hidden||!n||t!==null||(s=performance.now(),t=setTimeout(()=>{t=null;const h=n;n=null,h==null||h()},r))},d=()=>{e.hidden&&t!==null?(r=Math.max(0,r-(performance.now()-s)),l()):e.hidden||u()};return e.addEventListener("visibilitychange",d),{schedule(h,f){o||(l(),n=h,r=Math.max(0,f),u())},dispose(){o=!0,l(),n=null,e.removeEventListener("visibilitychange",d)}}}function oz(e,t,n){const[r,s]=w.useState(0),[o,l]=w.useState(0),[u,d]=w.useState(null),[h,f]=w.useState(null),[p,g]=w.useState({x:0,drop:0}),[v,k]=w.useState("ledge"),[b,x]=w.useState("left"),[N,S]=w.useState(0),_=w.useRef(null),[E,T]=w.useState(()=>document.hidden);w.useEffect(()=>{const O=new Set,U=()=>{var M;if(document.hidden){for(const $ of((M=_.current)==null?void 0:M.getAnimations({subtree:!0}))??[])if($.playState==="running"||$.pending){const B=$.currentTime;$.pause(),B!==null&&($.currentTime=B),O.add($)}}else{for(const $ of O)$.playState==="paused"&&$.play();O.clear()}T(document.hidden)};return U(),document.addEventListener("visibilitychange",U),()=>document.removeEventListener("visibilitychange",U)},[e,t]);const[R,A]=w.useState(null),[q,L]=w.useState(WM),[P,I]=w.useState(()=>{var O;return((O=window.matchMedia)==null?void 0:O.call(window,"(prefers-reduced-motion: reduce)").matches)??!1});return w.useEffect(()=>{var M;const O=(M=window.matchMedia)==null?void 0:M.call(window,"(prefers-reduced-motion: reduce)");if(!O)return;const U=()=>I(O.matches);return U(),O.addEventListener("change",U),()=>O.removeEventListener("change",U)},[]),w.useEffect(()=>{var X;if(!e||t||P)return;const O=bj(document);let U=0;s(Z=>U=Z);let M=null,$=0,B=0;const V=Z=>{var re,de;const[ee,...se]=Z;if(!ee){M=null,d(null),f(null),J();return}d(ee.act),f(ee.prop),k(ee.place??"ledge"),S(ee.riser??0);const ue=U,ae=D(ee);if(ee.act==="kick"){const me=(de=(re=_.current)==null?void 0:re.querySelector('.fm-prop[data-prop="ball"]'))==null?void 0:de.getBoundingClientRect();me&&g({x:OU(me.x,hp(ee,ue,"left"),window.innerWidth),drop:Math.max(48,window.innerHeight-me.y+24)})}B=ee.act==="walk"?Math.max(Ct(ue,ae),gU):ee.ms,ee.act==="carry"&&(B=Ct(ue,ae)),l(B),x(me=>hp({...ee,x:ae},ue,me)),s(ae),U=ae,M=ee,$=Date.now(),O.schedule(()=>V(se),B)},H=()=>{const Z=_.current,ee=Z==null?void 0:Z.querySelector(".fm-sprite"),se=Z==null?void 0:Z.parentElement;if(!Z||!ee||!se)return null;const ue=Z.getBoundingClientRect(),ae=se.getBoundingClientRect(),re=ae.right-ue.right,de=ae.width-re*2-ee.offsetWidth;return de>0?de:null},F=()=>{const Z=_.current,ee=Z==null?void 0:Z.querySelector(".fm-walker"),se=H();if(!Z||!ee||se==null)return;const ue=Z.getBoundingClientRect().bottom-ee.getBoundingClientRect().bottom;if(ue>0)return{ledgeH:ue,floorSpan:se}},W=()=>{const Z=_.current,ee=document.querySelector(".autofit-chip");if(!Z||!ee)return null;const se=Z.getBoundingClientRect(),ue=ee.getBoundingClientRect();return ue.width<=0||ue.height<=0?null:{left:ue.left-se.right,right:ue.right-se.right,height:ue.height}},D=Z=>{const ee=(Z.place??"ledge")==="floor",se=ee?H()??Ra:Ra,ue=ee&&Z.floorFrac!=null?-Math.round(Z.floorFrac*se):Z.x;return Math.max(-se,Math.min(0,ue))},Y=()=>{if(!M)return;const Z=D(M);Z!==U&&(l(Math.max(0,$+B-Date.now())),x(ee=>hp({...M,x:Z},U,ee)),s(Z),U=Z)},J=()=>{O.schedule(()=>{const Z=$U(U,Math.random,F()),ee=Z.some(ae=>ae.place==="floor")?W():null;let se=U;const ue=Z.flatMap(ae=>{const re=se;if(se=ae.x,!(ae.place==="floor"&&ae.act==="walk"))return[ae];const de=DU(re,ae.x,ee),me=de.length-1;return ae.floorFrac==null?de:de.map((pe,ke)=>ke===me?{...pe,floorFrac:ae.floorFrac}:pe)});V(ue)},lU(Math.random))},G=(X=_.current)==null?void 0:X.parentElement,K=typeof ResizeObserver>"u"?null:new ResizeObserver(Y);return G&&K&&K.observe(G),J(),()=>{O.dispose(),K==null||K.disconnect(),k("ledge"),s(Z=>Math.max(-Ra,Math.min(0,Z))),l(0),d(null),f(null),S(0)}},[e,t,P]),w.useEffect(()=>{if(!n||P){A(null);return}const O=bj(document),U=M=>{const $=BU(M,Math.random);A($.dance),L($.beatMs),O.schedule(()=>U($.dance),UU(Math.random))};return U(null),()=>O.dispose()},[n,P]),{scene:_,suspended:E,x:r,walkMs:o,act:u,prop:h,ballFlight:p,place:v,facing:b,riser:N,dance:R,beatMs:q}}const pp={e:"fm-eye",s:"fm-shade",p:"fm-pad"},ld=Fd().filter(e=>!VM.has(e.cell)),iz=Fd().filter(e=>VM.has(e.cell)),kj=ld.filter(e=>e.cell==="e"),lz=Fd(GU),cz=ld.filter(e=>e.y<px&&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),uz={left:ld.filter(e=>e.y>=px&&e.x<vj),right:ld.filter(e=>e.y>=px&&e.x>=vj)},dz=w.memo(function({act:t,facing:n}){return a.jsxs("svg",{viewBox:`0 0 ${wj} ${zU}`,shapeRendering:"crispEdges","aria-hidden":!0,children:[a.jsx("g",{className:"fm-gear",children:a.jsx("g",{className:"fm-gear-motion",children:iz.map(r=>a.jsx("rect",{x:r.x,y:r.y,width:r.w,height:1,className:pp[r.cell]},`g${r.y}-${r.x}`))})}),a.jsxs("g",{className:"fm-body",children:[kj.map(r=>a.jsx("rect",{x:r.x,y:r.y,width:r.w,height:1,fill:"var(--accent)"},`eye-bed-${r.x}`)),cz.map(r=>a.jsx("rect",{x:r.x,y:r.y,width:r.w,height:1,className:pp[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"})]}),kj.map(r=>a.jsx("rect",{x:r.x-(r.x>=wj/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:lz.map(r=>a.jsx("rect",{x:KU+r.x,y:YU+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:uz[r].map(s=>a.jsx("rect",{x:s.x,y:s.y,width:s.w,height:1,className:pp[s.cell]},`${r}${s.y}-${s.x}`))},r))]})}),hz={"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 fz(e,t){return t&&La(t.id)===e?t.name:ti(e)?"Custom FM":hz[e]}function mp(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:Fd(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 Nj={litter:mp(fp.litter,"litter"),ball:mp(fp.ball,"ball"),scope:mp(fp.scope,"scope")};function pz(e){try{return new URL(e).host}catch{return"the station's server"}}const mz=w.memo(function({fetchImpl:t,volume:n,muted:r=!1,source:s="claude-fm",playRequest:o=0,customStation:l,onAvailabilityChange:u}){const{probe:d,dead:h,armed:f,playing:p,frame:g,say:v,press:k}=az({fetchImpl:t,volume:n,muted:r,source:s,playRequest:o,customStation:l,onAvailabilityChange:u}),{scene:b,suspended:x,x:N,walkMs:S,act:_,prop:E,ballFlight:T,place:R,facing:A,riser:q,dance:L,beatMs:P}=oz(d,h,p);if(!d||h)return null;const I=fz(s,l),O=d.audio?pz(d.audio):"YouTube";return a.jsxs("div",{ref:b,className:"fm","data-suspended":x?"":void 0,"data-place":R,style:{"--fm-beat":`${P}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":`${BM}ms`,"--fm-ball-turn":A==="right"?"1080deg":"-1080deg"},children:Nj[E.kind]}),(_==="lasso"||_==="rope-throw"||_==="rope-catch"||_==="climb"||_==="pull-up")&&a.jsxs("div",{className:"fm-rope","data-act":_,style:{"--fm-rope-x":`${N}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":`${N}px`,"--fm-walk-ms":`${S}ms`,"--fm-riser":`${q}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:Nj[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?L??zM[0]:void 0,onClick:k,title:p?`Stop ${I}`:`Play ${I} — streams from ${O}`,"aria-label":p?`Stop ${I}`:`Play ${I}`,children:a.jsx(dz,{act:_,facing:A})})]}),f&&!d.audio&&(d.channel||d.video)&&a.jsx("iframe",{ref:g,className:"fm-frame",title:I,src:XU(d.channel,window.location.origin,d.video),onLoad:()=>v(ZU()),allow:"autoplay; encrypted-media",sandbox:"allow-scripts allow-same-origin allow-presentation"})]})});function GM(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 cd(e){return GM(Math.floor(e/1e3))}function qd(e,t){const n=e-t;if(n<=0)return null;const r=Math.floor(n/86400),s=Math.floor(n%86400/3600),o=Math.floor(n%3600/60);return r>0?`${r}d ${s}h`:s>0?`${s}h ${o}m`:`${o}m`}function gz(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function ud(e,t,n){const r=new Date(e),s=cd(t-e);return{label:gz(r,new Date(t))?s:`${s} · ${r.toLocaleDateString(n,{month:"short",day:"numeric"})}`,title:r.toLocaleString(n,{dateStyle:"medium",timeStyle:"medium"})}}function yz({data:e}){const t=mi(3e4),n=ud(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($l,{}),"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(),sB(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($l,{}),"recap"]}),a.jsx("span",{className:"recap-face-age",children:n.label})]}),a.jsx("p",{className:"recap-face-text",children:e.recap.text})]}),a.jsx(Oa,{type:"source",position:Ae.Right,style:{background:"transparent",border:"none"}})]})}function wz({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:s,targetPosition:o,style:l}){const[u]=hb({sourceX:e,sourceY:t,sourcePosition:s,targetX:n,targetY:r,targetPosition:o,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 gx(e){return e.replace(/[^a-zA-Z0-9]/g,"")}function Ob(e,t){const n=gx(e);return n?n.slice(-t):e.slice(-t)}function KM(e,t,n=4){const r=gx(e);if(!r)return Ob(e,n);let s=n;for(const o of t){if(o===e)continue;const l=gx(o);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 zu=" · ",vz=32,xz=/[\u1100-\u115F\u2E80-\u303E\u3041-\u33FF\u3400-\u4DBF\u4E00-\u9FFF\uA000-\uA4CF\uAC00-\uD7A3\uF900-\uFAFF\uFE30-\uFE6F\uFF00-\uFF60\uFFE0-\uFFE6]/;function jj(e){return xz.test(e)?2:1}function Sj(e,t=vz){const n=[...e];let r=0;for(const l of n)r+=jj(l);if(r<=t)return e;const s=[];let o=0;for(const l of n){const u=jj(l);if(o+u>t-1)break;s.push(l),o+=u}for(;s.length&&/[\s\-_.:/]/.test(s[s.length-1]);)s.pop();return`${s.join("")}…`}function bz(e,t,n,r,s=[]){const o=(t==null?void 0:t.trim())??"",l=r?KM(n,s):void 0,u=[e,o||void 0,l].filter(Boolean);return{label:Sj(e),name:o?Sj(o):void 0,shortId:l,fullLabel:u.join(zu)}}const Ea=18,yx=26,YM=12,kz=240;function Nz(e,t){return(e+kz)*(t||1)}function jz(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 Sz(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:Nz(e.w,t),"--session-hue":n}}function _z(e){const t=new Map;for(const s of e){if(s.type!=="agent"&&s.type!=="recapNote")continue;const o=s.data;if(!(o!=null&&o.sessionId)||o.exitAt!=null||s.width==null||s.height==null)continue;const l=s.position.x,u=s.position.y,d=l+s.width,h=u+s.height,f=t.get(o.sessionId),p=Ez(o);f?(f.minX=Math.min(f.minX,l),f.minY=Math.min(f.minY,u),f.maxX=Math.max(f.maxX,d),f.maxY=Math.max(f.maxY,h),p&&(f.label=p.label??f.label,f.name=p.name,f.alarm=p.alarm,f.branch=p.branch)):t.set(o.sessionId,{minX:l,minY:u,maxX:d,maxY:h,label:(p==null?void 0:p.label)??o.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,o]of t){const l=n.get(o.label);l?l.push(s):n.set(o.label,[s])}const r=[];for(const[s,o]of t){const l=n.get(o.label)??[],u=l.length>1;r.push({sessionId:s,...bz(o.label,o.name,s,u,l),x:o.minX-Ea,y:o.minY-Ea-yx,w:o.maxX-o.minX+Ea*2,h:o.maxY-o.minY+Ea*2+yx,...o.alarm?{alarm:!0}:null,...o.branch?{branch:o.branch}:null})}return r}function Ez(e){if(e.kind!=="root")return null;const t=e.branch;return{label:e.label,name:Cb(e.sessionName,e.sessionTitle).face,alarm:hr(e.waiting),branch:t&&t.total>0?MM(t):void 0}}function Cz(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 Tz(e){return _z(e.nodeInternals.values())}function Rz({onFocusSession:e}){const{x:t,y:n,zoom:r}=W2(),s=Ke(Tz,Cz);if(s.length<=1)return null;const o=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=od(u.sessionId),h=jz(u,d),f=Sz(u,r,d);return a.jsxs(he.Fragment,{children:[a.jsx("div",{className:"cluster-card",style:h,"aria-hidden":!0}),a.jsxs("button",{type:"button",className:"cluster-label","data-alarm":u.alarm?"":void 0,style:f,title:`${u.alarm?`Waiting on you
|
|
72
|
+
`:""}Zoom to ${u.fullLabel}
|
|
73
|
+
drag the wrapper to move the whole session`,onClick:()=>o(u.sessionId),children:[u.alarm?a.jsxs(a.Fragment,{children:[a.jsx($b,{}),a.jsx("span",{className:"cluster-label-said",children:"waiting on you: "})]}):null,u.label,u.branch?a.jsx("span",{className:"cluster-label-branch",children:zu+u.branch}):null,u.name?a.jsx("span",{className:"cluster-label-name",children:zu+u.name}):null,u.shortId?a.jsx("span",{className:"cluster-label-id",children:zu+u.shortId}):null]})]},u.sessionId)})})}function Az({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 XM=600,Mz=4,$z=36,wx=16,Iz=60,Oz=6,_j=220,Lz=96,Pz=28;function Dz(e,t){return Math.max(Lz,61+[...t].length*6.8)}function Fz(e){return e.endedAt==null?"inflight":e.ok===!1?"err":"done"}function qz(e,t){if(t==null)return 1;const n=e-t;return n<0?1:Math.max(0,1-n/XM)}function Bz(e,t){const n=[],r=new Set;for(let s=e.length-1;s>=0&&n.length<t;s--){const o=e[s];r.has(o.id)||(r.add(o.id),n.push(o))}return n.reverse()}function Uz(e,t,n,r,s,o){const l=[];for(const u of e.values()){if(!t.has(u.id)||u.exitAt!=null&&o-u.exitAt>XM)continue;const d=r.get(u.id)??n.get(u.id);if(!d)continue;const h=Bz(u.tools,Mz);if(h.length===0)continue;const f=u.exitAt??null,p=s.get(u.id),g=Math.max((p==null?void 0:p.width)??_j,_j),v=(p==null?void 0:p.height)??130,k=d.x,b=d.y,x=k+g,N=b+v/2;h.forEach((S,_)=>{const E=_*$z,T=k+g+Iz,R=b+Oz+E,A=qz(o,f),q=S.inputPreview??"",L=Fz(S),P=A<.999,I=Mb(S.name);l.push({id:`${u.id}::${S.id}`,toolId:S.id,agentId:u.id,toolName:S.name,name:I.label,emoji:I.emoji,status:L,category:$M(S.name),mcpHue:I.hue,inputPreview:q,fade:A,fading:P,worldX:T,worldY:R,anchorX:x,anchorY:N,spawnDx:x-T,spawnDy:N-(R+wx)});const O=PM(S.name,S.input);if(O){const U=Dz(S.name,I.label),M=T+U+Pz,$=R,B=T+U,V=R+wx;l.push({id:`sub:${u.id}::${S.id}`,toolId:S.id,agentId:u.id,toolName:S.name,name:DB(O.label,O.category),fullName:O.label,emoji:O.emoji,isSub:!0,status:L,category:O.category,inputPreview:O.detail??q,fade:A,fading:P,worldX:M,worldY:$,anchorX:B,anchorY:V,spawnDx:B-M,spawnDy:0})}})}return l}function zz({agents:e,visibleAgentIds:t,positions:n,pinned:r,measured:s,spotlight:o,hiddenCategories:l,now:u,onOpenTool:d}){const h=Uz(e,t,n,r,s,u),f=l&&l.size>0?h.filter(p=>!l.has(p.category)):h;return a.jsx(Wz,{bursts:f,spotlight:o,onOpenTool:d})}function Wz({bursts:e,spotlight:t,onOpenTool:n}){const{x:r,y:s,zoom:o}=W2();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*o+r,d=l.anchorY*o+s,h=(l.worldX+6)*o+r,f=(l.worldY+wx)*o+s,p=Math.max(1,h-u),g=Math.min(1,Math.abs(f-d)/p),v=u+p*(.55-.22*g),k=t!=null&&!t.has(l.agentId),b=l.fade*(k?.14:1);return a.jsx("path",{d:`M ${u} ${d} Q ${v} ${d}, ${h} ${f}`,className:`tool-conn status-${l.status}${l.fading?" fading":""}`,opacity:b},`l:${l.id}`)})}),e.map(l=>a.jsx(Vz,{b:l,x:r,y:s,zoom:o,dim:t!=null&&!t.has(l.agentId),onOpenTool:n},l.id))]})}function Hz(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 Vz=w.memo(function({b:t,x:n,y:r,zoom:s,dim:o,onOpenTool:l}){const u=t.worldX*s+n,d=t.worldY*s+r,h={left:`${u}px`,top:`${d}px`,transform:`scale(${s})`,transformOrigin:"left top","--spawn-dx":`${t.spawnDx}px`,"--spawn-dy":`${t.spawnDy}px`},f=t.isSub?`${t.toolName} · ${t.fullName??t.name}`:t.toolName,p=t.inputPreview?`${f} · ${t.inputPreview}`:f,g=l!=null,v=t.mcpHue!=null?{"--mcp-hue":t.mcpHue}:{},k=o?" dim":"";return a.jsx("div",{className:"tool-burst-wrap",style:h,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:v,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:"×"})]})})},Hz),Gz={agent:WB,sessionGroup:Az,recapNote:yz},Kz={recapTie:wz},Ej=400;function Yz({graph:e,layout:t,viewport:n,clicks:r,drag:s,appearance:o,fm:l,autoFit:u,pause:d,stateRef:h,measuredRef:f,hiddenCats:p,now:g,openTool:v,focusAgent:k,requestClear:b,setKeyHelpOpen:x}){const{allNodes:N,edges:S,visibleAgentIds:_,spotlightSet:E}=e,{positionsRef:T,pinnedRef:R,handleRelayout:A}=t,{restoredViewport:q,onMoveStart:L,onMove:P}=n,{onNodeClick:I,onPaneClick:O,onNodeDoubleClick:U,onNodeMouseEnter:M,onNodeMouseLeave:$}=r,{onNodeDragStart:B,onNodeDrag:V,onNodeDragStop:H}=s,{palette:F,minimapNodeFill:W,characterEnabled:D}=o,{fmVolume:Y,fmMuted:J,fmSource:G,fmPlayRequest:K,customFmStations:X,markFmStationAvailability:Z}=l,{autoFitDisabled:ee,enableAutoFitAndRefit:se}=u,{paused:ue,pauseGate:ae,togglePause:re}=d;return a.jsxs(z2,{nodes:N,edges:S,nodeTypes:Gz,edgesFocusable:!1,edgeTypes:Kz,fitView:!q,fitViewOptions:{padding:.25,duration:cx({durationMs:Ej,documentHidden:document.hidden})?Ej:0},minZoom:X2,maxZoom:Z2,panOnScroll:!0,nodesDraggable:!0,nodesConnectable:!1,selectionOnDrag:!1,nodeDragThreshold:5,disableKeyboardA11y:!0,deleteKeyCode:null,onNodeClick:I,onPaneClick:O,onNodeDoubleClick:U,onNodeMouseEnter:M,onNodeMouseLeave:$,onMoveStart:L,onMove:P,onNodeDragStart:B,onNodeDrag:V,onNodeDragStop:H,children:[a.jsx(B6,{gap:28,size:1,color:F["--grid-line"]}),a.jsx(Rz,{onFocusSession:k}),a.jsx(zz,{agents:h.current.agents,visibleAgentIds:_,positions:T.current,pinned:R.current,measured:f.current,spotlight:E,hiddenCategories:p,now:g,onOpenTool:v}),ee&&a.jsx(XB,{enableAutoFitAndRefit:se}),a.jsx(aU,{autoFitDisabled:ee,enableAutoFitAndRefit:se,paused:ue,pauseGate:ae,togglePause:re,handleRelayout:A,requestClear:b,setKeyHelpOpen:x}),a.jsx(C6,{zoomable:!0,pannable:!0,nodeColor:W,nodeStrokeWidth:2,maskColor:F["--minimap-mask"],maskStrokeColor:F["--line"]}),D&&a.jsx(mz,{volume:Y,muted:J,source:G,playRequest:K,customStation:X.find(de=>La(de.id)===G),onAvailabilityChange:Z})]})}function Xz(e){const t={input:0,output:0,cacheRead:0,cacheWrite:0,total:0};let n=0,r=0,s=0,o=0;for(const l of e){const u=hn(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,o+=l.usage.cacheCreateTokens}return{cost:t,inputTokens:n,outputTokens:r,cacheReadTokens:s,cacheCreateTokens:o,sum:n+r}}const Zz="spend on this board",Jz="on this board",Cj=`Everything on the board right now, and only that.
|
|
74
|
+
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.
|
|
75
|
+
Press H for the totals ccusage reads off the logs on disk, which do not forget.`,ZM="session spend",vx="__unknown__",Qz=12;function eW(e,t=Date.now()){const n=new Map;for(const r of e)for(const s of Zl(r)){const o=s.model??vx,l=Ko(s.usage,s.model,t),u=n.get(o);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(o,{model:o,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 tW(e,t=Date.now()){const n=[...e],r=[];for(const s of n){if(s.kind!=="root")continue;let o=hn(s,t).total,l=s.usage.inputTokens,u=s.usage.outputTokens,d=Ml(s,t);for(const h of n)h.sessionId!==s.sessionId||h.kind==="root"||(o+=hn(h,t).total,l+=h.usage.inputTokens,u+=h.usage.outputTokens,d+=Ml(h,t));r.push({sessionId:s.sessionId,label:s.label||s.cwdBasename||"session",state:s.state,cost:o,inputTokens:l,outputTokens:u,unpricedTokens:d})}return r.sort((s,o)=>o.cost-s.cost||o.inputTokens+o.outputTokens-(s.inputTokens+s.outputTokens)).slice(0,Qz)}function Tj(e){return e.waiting?hr(e.waiting)?0:1:e.state==="active"?2:3}function nW(e,t){const n=[];for(const r of e.agents.values()){if(r.kind!=="root")continue;let s=r.toolCount,o=hn(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,o+=hn(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:Pd(r),modelId:r.model,toolCount:s,cost:o,startedAt:r.startedAt,lastActivity:l})}return n.sort((r,s)=>{const o=Tj(r),l=Tj(s);return o!==l?o-l:r.waiting&&s.waiting?r.waiting.since-s.waiting.since:s.lastActivity-r.lastActivity}),n}function Rj(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 o=Math.floor(s/60);return o<60?`${o}m`:`${Math.floor(o/60)}h ${o%60}m`}function rW({state:e,now:t,selectedIds:n,onSelect:r,onClose:s,removedIds:o,onBringBackAll:l}){const u=w.useMemo(()=>nW(e),[e,e.revision,t]),d=u.filter(f=>f.state==="active").length,h=u.filter(f=>hr(f.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})]}),h>0&&a.jsxs("span",{className:"sl-waiting-count",children:[h," 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(f=>{const p=n.has(f.sessionId),g=(o==null?void 0:o.has(f.sessionId))??!1;return a.jsx("li",{className:"sl-row-item",children:a.jsxs("button",{type:"button",className:`sl-row state-${f.state}${p?" selected":""}${g?" removed":""}`,"aria-current":p?"true":void 0,onClick:()=>r(f.sessionId),title:g?`Bring ${f.label} back to the board`:`Focus ${f.label}`,children:[a.jsx("span",{className:`sl-dot state-${f.state}`,"aria-hidden":!0}),a.jsx("span",{className:"vis-hidden",children:ni(f.state)}),a.jsxs("div",{className:"sl-row-body",children:[a.jsxs("div",{className:"sl-row-head",children:[a.jsx("span",{className:"sl-label",children:f.label}),g&&a.jsx("span",{className:"sl-removed",children:"off the board"}),f.modelId&&a.jsx("span",{className:"model-chip","data-family":$d(f.modelId),title:f.modelId,children:Ys(f.modelId)})]}),a.jsxs("div",{className:"sl-row-meta",children:[a.jsxs("span",{title:"tool calls",children:[a.jsx("b",{children:f.toolCount})," ",f.toolCount===1?"tool":"tools"]}),f.cost>0&&a.jsx("span",{className:"sl-cost",title:ZM,children:a.jsx("b",{children:Be(f.cost)})}),f.waiting?a.jsxs("span",{className:"sl-waiting",title:[ri(f.waiting),S8(f.waiting,ri(f.waiting)),`Blocked since ${new Date(f.waiting.since).toLocaleTimeString()} · started ${new Date(f.startedAt).toLocaleString()}`].filter(Boolean).join(`
|
|
76
|
+
`),children:["waiting ",Rj(f.waiting.since,void 0,t),f.waiting.tool&&a.jsxs("span",{className:"sl-waiting-tool",children:[" · ",f.waiting.tool.name]})]}):a.jsx("span",{className:"sl-elapsed",title:`Started ${new Date(f.startedAt).toLocaleString()}`,children:Rj(f.startedAt,f.state==="active"?void 0:f.lastActivity,t)})]}),f.recap&&a.jsxs("span",{className:"sl-recap",title:f.recap.text,children:[a.jsx($l,{}),f.recap.text]})]})]})},f.sessionId)})]}),(()=>{const f=(o==null?void 0:o.size)??0;return f===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 v;return(v=g==null?void 0:g.querySelector(".sl-row"))==null?void 0:v.focus()})},children:["Bring back ",f," removed ",f===1?"card":"cards"]})})})()]})}const xx={cost:0,inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0,sessions:0};function sW(e){if(!e.synthetic)return!1;const t=e.usage;return t.inputTokens+t.outputTokens+t.cacheReadTokens+t.cacheCreateTokens<=0}function bx(e,t){const n=new Map;for(const r of e){if(r.kind!=="root"||!r.sessionId||sW(r))continue;const s=hn(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 aW(e,t){if(!e)return xx;const n={...xx};for(const[r,s]of t){const o=e.get(r);if(!o)continue;const l={cost:s.cost-o.cost,inputTokens:s.inputTokens-o.inputTokens,outputTokens:s.outputTokens-o.outputTokens,cacheReadTokens:s.cacheReadTokens-o.cacheReadTokens,cacheCreateTokens:s.cacheCreateTokens-o.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 kx(e,t=new Date){return new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate()-(e-1))).toISOString().slice(0,10).replace(/-/g,"")}const Bd=[{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 oW(e,t,n=Bd.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 JM(e,t=new Date){return e==="today"?kx(1,t):e==="month"?kx(t.getDate(),t):"20200101"}const cn=e=>typeof e=="number"&&Number.isFinite(e)?e:0,Wu=e=>typeof e=="string"?e:"";function QM(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 o of s){const l=Wu(o==null?void 0:o.modelName);if(!l)continue;let u=n.get(l);u||(u={model:l,cost:0,inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0,get tokens(){return this.inputTokens+this.outputTokens+this.cacheReadTokens+this.cacheCreateTokens}},n.set(l,u)),u.cost+=cn(o==null?void 0:o.cost),u.inputTokens+=cn(o==null?void 0:o.inputTokens),u.outputTokens+=cn(o==null?void 0:o.outputTokens),u.cacheReadTokens+=cn(o==null?void 0:o.cacheReadTokens),u.cacheCreateTokens+=cn(o==null?void 0:o.cacheCreationTokens)}}return[...n.values()].sort((r,s)=>s.cost-r.cost||s.tokens-r.tokens)}const iW=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function lW(e){var t;return((t=iW.exec(e))==null?void 0:t[0])??e}function cW(e,t=new Map){const n=Array.isArray(e==null?void 0:e.sessions)?e.sessions:[],r=[];for(const s of n){const o=Wu(s==null?void 0:s.period);if(!o)continue;const l=lW(o),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:Wu(s==null?void 0:s.agent)||"claude",cost:cn(s==null?void 0:s.totalCost),tokens:cn(s==null?void 0:s.totalTokens),models:Array.isArray(s==null?void 0:s.modelsUsed)?s.modelsUsed.map(Wu).filter(Boolean):[],lastActivityMs:Number.isFinite(d)?d:null})}return r.sort((s,o)=>o.cost-s.cost||o.tokens-s.tokens)}function uW(e,t=Ud(e).cost){const r=(Array.isArray(e==null?void 0:e.sessions)?e.sessions:[]).reduce((o,l)=>o+cn(l==null?void 0:l.totalCost),0),s=Math.max(.01,t*.01);return{sum:r,total:t,over:r>t+s}}function dW(e,t,n){const r=`Sessions with activity ${e}, and what ccusage puts against each one.`;return t.over?`${r}
|
|
77
|
+
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 Ud(e){const t=e==null?void 0:e.totals;if(t&&typeof t=="object"){const d=cn(t.cacheReadTokens),h=cn(t.cacheCreationTokens),f=cn(t.inputTokens),p=cn(t.outputTokens);return{cost:cn(t.totalCost),inputTokens:f,outputTokens:p,cacheReadTokens:d,cacheCreateTokens:h,tokens:cn(t.totalTokens)||f+p+d+h}}const n=QM(e),r=d=>n.reduce((h,f)=>h+d(f),0),s=r(d=>d.inputTokens),o=r(d=>d.outputTokens),l=r(d=>d.cacheReadTokens),u=r(d=>d.cacheCreateTokens);return{cost:r(d=>d.cost),inputTokens:s,outputTokens:o,cacheReadTokens:l,cacheCreateTokens:u,tokens:s+o+l+u}}function hW(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 e$(e,t){var n;return((n=Bd.find(r=>r.key===(e??t)))==null?void 0:n.noun)??"today"}function fW(e,t,n){const r=e!=null,s=Ud(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 t$="agent-dag.usagePeriod";function pW(){const e=Qe(t$);return Bd.some(t=>t.key===e)?e:"today"}function mW(e){Ye(t$,e)}const n$="agent-dag.usageSessionsOpen";function gW(){return Qe(n$)==="1"}function yW(e){Ye(n$,e?"1":"0")}function Lb({cost:e,size:t="md"}){const n=e.total;if(n<=0)return null;const r=(o,l,u)=>{if(o<=0)return null;const d=o/n*100;return a.jsx("span",{className:`cb-seg ${l}`,style:{width:`${d}%`},title:`${u}: ${Be(o)} (${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 bt="ccdeck";function r$(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 wW({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 s$({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 vW(e,t,n,r,s=!1){const o=Math.max(0,t-r),l=Math.max(0,n-o);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 h=100-e,f=l>0?e/l:0,p=f>0?h/f:1/0,g={label:`${Math.round(d)}% over pace`,color:"var(--warn)",expectedPct:u,isDeficit:!0};if(p<o&&p<86400){const v=Math.floor(p/3600),k=Math.floor(p%3600/60);g.runsOutIn=v>0?`${v}h ${k}m`:`${k}m`}return g}return{label:`${Math.round(-d)}% under pace`,color:"var(--ok)",expectedPct:u,isDeficit:!1}}function Hs({pct:e,label:t,reset:n,resetAt:r,windowSec:s,limitReached:o,nowSec:l}){const u=e!=null,d=u?Math.min(100,Math.max(0,e)):0,f=o||d>=90?"var(--err)":d>=70?"var(--warn)":"var(--accent)",p=d<1,g=u?p?"< 1%":`${Math.round(d)}%`:"no reading",v=p?2:d,k=r?qd(r,l):null,b=u&&r&&s?vW(d,r,s,l,o):null,[x,N]=w.useState(!1),S=w.useId();return a.jsxs("div",{className:"qb-row",children:[a.jsxs("div",{className:"qb-meta",children:[a.jsxs("span",{className:"qb-label",children:[t,o&&a.jsx("span",{className:"qb-limit-badge",title:"Rate limit reached",children:"⛔"})]}),a.jsx("span",{className:"qb-pct",style:{color:u?f:"var(--muted)"},children:g})]}),a.jsxs("div",{className:"qb-track",children:[u&&a.jsx("div",{className:"qb-fill",style:{transform:`scaleX(${v/100})`,background:f,opacity:p?.4:1}}),b&&a.jsx("div",{className:"qb-pace-rail",style:{transform:`translateX(${b.expectedPct}%)`},children:a.jsx("div",{"aria-hidden":!0,className:"qb-pace-marker",style:{background:b.isDeficit?"var(--err)":"var(--ok)"},title:`To last until reset, stay near ${Math.round(b.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,b&&a.jsxs("button",{type:"button",className:"qb-pace",style:{color:b.color},"aria-expanded":x,"aria-controls":x?S:void 0,onClick:()=>N(_=>!_),children:[a.jsx("i",{className:"qb-pace-key","aria-hidden":!0,style:{background:b.isDeficit?"var(--err)":"var(--ok)"}}),b.runsOutIn?`runs out in ${b.runsOutIn}`:b.label]})]}),x&&b&&a.jsxs("div",{id:S,className:"qb-why",children:["To last until reset, stay near ",Math.round(b.expectedPct),"% by now."]})]})}function a$(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 xW(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 bW(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 kW(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 NW({quota:e,quotaLoading:t,nowSec:n,incident:r}){const s=a$(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:xW(e==null?void 0:e.source),children:s})]}),a.jsx(s$,{incident:r}),e!=null&&e.ok?a.jsxs("div",{className:"up-quota-bars",children:[e.session5hPct!=null&&a.jsx(Hs,{label:"5-hour window",pct:e.session5hPct,reset:e.session5hReset,resetAt:e.session5hResetAt,windowSec:e.session5hWindowSec,nowSec:n}),a.jsx(Hs,{label:"7-day window",pct:e.week7dPct??null,reset:e.week7dReset,resetAt:e.week7dResetAt,windowSec:e.week7dWindowSec,nowSec:n}),e.weekSonnetPct!=null&&a.jsx(Hs,{label:"Sonnet (7d)",pct:e.weekSonnetPct,nowSec:n}),e.weekOpusPct!=null&&a.jsx(Hs,{label:"Opus (7d)",pct:e.weekOpusPct,nowSec:n}),e.extraEnabled&&e.extraUsedCredits!=null&&e.extraMonthlyLimit?a.jsx(Hs,{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 — ${bt} only reports them`,children:r$("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:bW(e.reason)})]}):a.jsx("div",{className:"up-quota-na up-quota-loading",children:"Checking…"})]})}function jW({codexQuota:e,codexLoading:t,codexUsage:n,nowSec:r,incident:s}){var l,u;const o=a$(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}),o&&!t&&a.jsx("span",{className:"up-section-age",title:"Fetched from the Codex usage endpoint",children:o})]}),a.jsx(s$,{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(Hs,{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(Hs,{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(Hs,{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 — ${bt} only reports them`,children:r$("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:kW(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?`
|
|
78
|
+
last 5h: ${ot(n.window5h.totalTokens)} tokens · ${n.window5h.sessionCount} session${n.window5h.sessionCount!==1?"s":""}`:""}`,children:[ot(n.window7d.totalTokens)," tokens · ",n.window7d.sessionCount," session",n.window7d.sessionCount!==1?"s":""," (7d)"]})]})}function SW({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:Ys(r.model)}),a.jsx("td",{className:"up-num",children:ot(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:ds})]},r.model)):n.map(r=>a.jsxs("tr",{children:[a.jsx("td",{className:"up-model-name",title:r.model===vx?"no model reported yet":r.model,children:r.model===vx?"unknown":Ys(r.model)}),a.jsx("td",{className:"up-num",children:ot(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:ds})]},r.model))})]})]})}function _W({period:e,rangePending:t,setPeriod:n}){const r=w.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 o=r.current.indexOf(s.target);if(o<0)return;const l=oW(s.key,o);l!==null&&(s.preventDefault(),(u=r.current[l])==null||u.focus())},children:Bd.map((s,o)=>a.jsx("button",{type:"button",ref:l=>{r.current[o]=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 ${e$(e,e)}…`:""})]})}function EW({fromRange:e,rangeSessionRows:t,boardSessionRows:n,boardStates:r,sessionsOpen:s,setSessionsOpen:o,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:()=>o(h=>!h),children:["By session",e&&a.jsxs("span",{className:"up-section-age",title:dW(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(h=>{const f=r.get(h.sessionId);return a.jsxs("div",{className:"up-session-row",children:[f?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:`sl-dot state-${f}`,"aria-hidden":!0}),a.jsx("span",{className:"vis-hidden",children:ni(f)})]}):a.jsx("span",{className:"sl-dot up-dot-past","aria-hidden":!0}),a.jsx("span",{className:`up-session-label${h.label?"":" up-session-id"}`,title:h.label?`${h.label}
|
|
79
|
+
${h.sessionId}`:h.sessionId,children:h.label??Ob(h.sessionId,8)}),a.jsx("span",{className:"up-session-tokens",children:ot(h.tokens)}),h.cost>0?a.jsx("span",{className:"up-session-cost",title:h.models.join(", ")||void 0,children:Be(h.cost)}):a.jsx("span",{className:"up-session-cost up-unpriced",children:ds})]},h.sessionId)}),!e&&n.map(h=>a.jsxs("div",{className:"up-session-row",children:[a.jsx("span",{className:`sl-dot state-${h.state}`,"aria-hidden":!0}),a.jsx("span",{className:"vis-hidden",children:ni(h.state)}),a.jsx("span",{className:"up-session-label",children:h.label}),a.jsx("span",{className:"up-session-tokens",children:ot(h.inputTokens+h.outputTokens)}),h.cost>0?a.jsxs("span",{className:"up-session-cost",title:h.unpricedTokens>0?`${ot(h.unpricedTokens)} tokens in this session are on an unpriced model, so this is a floor`:void 0,children:[Be(h.cost),h.unpricedTokens>0?"+":""]}):a.jsx("span",{className:"up-session-cost up-unpriced",children:ds})]},h.sessionId))]})]})}function Xs(e,t){return{disabled:e!=null&&e!==t,busy:e===t}}function zd(e){return e==null}const Nx="self";function Ir(e,t=!1){const n=Xs(e?Nx:null,Nx);return{disabled:t||n.disabled,"aria-busy":n.busy}}function or(e){return zd(e?Nx:null)}const Il=400;function Ol({armedFor:e,target:t,armedAt:n,now:r,gapMs:s}){return e!==t?"arm":r-n<s?"ignore":"fire"}function o$(e){return[...e==null?[]:[`#ap-more-${e}`],".accounts-panel .ap-refresh"]}function hs(e){return e==null||e==="BODY"||e==="HTML"}const CW=6e4,TW=2e4;function RW(e){const[t,n]=w.useState(null),[r,s]=w.useState(!1),o=w.useRef(null),l=w.useRef(!1),u=async(h=!1)=>{if(!(h&&!or(l.current))){h&&(l.current=!0,s(!0));try{const p=await fetch(h?"/api/quota?refresh=1":"/api/quota",{signal:AbortSignal.timeout(TW)});p.ok&&n(await p.json())}catch{}finally{h&&(l.current=!1,s(!1))}}};return w.useEffect(()=>{if(e)return u(!0),o.current=window.setInterval(()=>u(!1),CW),()=>{o.current!=null&&window.clearInterval(o.current)}},[e]),{quota:t,loading:r,refresh:()=>{e&&u(!0)}}}const i$=6e4;function AW(e){const[t,n]=w.useState(null),[r,s]=w.useState(!1),o=w.useRef(null),l=w.useRef(!1),u=async(h=!1)=>{if(!(h&&!or(l.current))){h&&(l.current=!0,s(!0));try{const p=await fetch(h?"/api/codex-quota?refresh=1":"/api/codex-quota");p.ok&&n(await p.json())}catch{}finally{h&&(l.current=!1,s(!1))}}};return w.useEffect(()=>{if(e)return u(!0),o.current=window.setInterval(()=>u(!1),i$),()=>{o.current!=null&&window.clearInterval(o.current)}},[e]),{data:t,loading:r,refresh:()=>{e&&u(!0)}}}function MW(e){const[t,n]=w.useState(null),r=w.useRef(null),s=async()=>{try{const o=await fetch("/api/codex-usage");o.ok&&n(await o.json())}catch{}};return w.useEffect(()=>{if(e)return s(),r.current=window.setInterval(s,i$),()=>{r.current!=null&&window.clearInterval(r.current)}},[e]),{data:t}}const Aj=6e4;function $W(e,t,n){const[r,s]=w.useState(null),[o,l]=w.useState(!1),[u,d]=w.useState(0),h=w.useRef(0);w.useEffect(()=>{const p=()=>document.visibilityState==="visible",g=()=>{p()&&d(b=>b+1)},v=window.setInterval(g,Aj),k=()=>{p()&&Date.now()-h.current>=Aj&&d(b=>b+1)};return document.addEventListener("visibilitychange",k),()=>{window.clearInterval(v),document.removeEventListener("visibilitychange",k)}},[]);const f=w.useRef(t);return w.useEffect(()=>{let p=!0;const g=t!==f.current;f.current=t;const v=e,k=JM(v);return l(!0),fetch(`/api/ccusage?since=${k}${g?"&refresh=1":""}`).then(b=>b.ok?b.json():null).then(b=>{!p||!(b!=null&&b.ok)||(h.current=Date.now(),s({period:v,data:b,baseline:n()}))}).catch(()=>{}).finally(()=>{p&&l(!1)}),()=>{p=!1}},[e,t,u]),{...hW(r,e),loading:o}}const IW=e=>1-Math.pow(1-e,5),l$=420;function OW(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 LW(e,t,n,r=l$){return n>=r?t:n<=0?e:e+(t-e)*IW(n/r)}function c$(){return typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches}function Mj(e,t,n,r={}){const s=r.now??(()=>performance.now()),o=r.raf??(v=>requestAnimationFrame(v)),l=r.cancel??(v=>cancelAnimationFrame(v)),u=r.reducedMotion??c$,d=r.hidden??(()=>typeof document=="object"&&document.hidden===!0);if(u()||d()||!OW(e,t))return n(t),()=>{};const h=s();let f=0,p=!0;const g=()=>{if(!p)return;const v=s()-h;n(LW(e,t,v)),v<l$&&(f=o(g))};return f=o(g),()=>{p=!1,f&&l(f)}}const PW=typeof window>"u"?w.useEffect:w.useLayoutEffect;function Na(e,{countIn:t=!1}={}){const[n,r]=w.useState(e),s=w.useRef(e),o=w.useRef(!0);return w.useEffect(()=>{s.current=n},[n]),PW(()=>{!t||c$()||(s.current=0,r(0))},[]),w.useEffect(()=>{if(o.current){if(o.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 u$(e,t,n){const r=FW*Math.max(1,n/h$);let s=0;for(const[o,l]of t){const u=e.get(o);if(u===void 0)continue;const d=l.cost-u.cost;d>0&&d<=r&&(s+=d)}return s}const $j={samples:[],last:new Map,watched:0},d$=10*6e4,DW=6e4,h$=5e3,FW=20;function qW(e,t,n){const r=e.samples[e.samples.length-1];if(r&&t-r.t<h$)return e;const s=e.watched+u$(e.last,n,r?t-r.t:0),o=e.samples.filter(l=>t-l.t<=d$);return o.push({t,watched:s}),{samples:o,last:n,watched:s}}function BW(e,t,n){const r=e.samples[0];if(!r)return null;const s=t-r.t;if(s<DW)return null;const o=e.samples[e.samples.length-1].t,l=e.watched+u$(e.last,n,t-o)-r.watched;return l>0?{spent:l,spanSec:s/1e3,spanMin:Math.min(d$/6e4,Math.ceil(s/6e4))}:null}function UW(e,t,n){const r=w.useRef($j),s=w.useRef(null);return w.useMemo(()=>{const o=eW(e.agents.values()),l=Xz(e.agents.values());s.current!==n&&(s.current=n,r.current=$j);const u=bx(e.agents.values(),t);n!=null&&(r.current=qW(r.current,t,u));const d=n==null?null:BW(r.current,t,u),h=d?{label:_b(d.spent,d.spanSec),spanMin:d.spanMin}:null;return{byModel:o,totalCost:l.cost,totalTokens:l,burnRate:h}},[e,e.revision,t,n])}const zW=3e4;function f$(){const[e,t]=w.useState(()=>Math.floor(Date.now()/1e3));return w.useEffect(()=>{const n=window.setInterval(()=>t(Math.floor(Date.now()/1e3)),zW);return()=>window.clearInterval(n)},[]),e}function Ij(e){return(typeof e.cost=="number"?e.cost:e.cost.total)>0||e.inputTokens+e.outputTokens>0}function WW(e,t,n){return e?t.some(r=>r.cost<=0&&r.tokens>0):n.some(r=>!r.priced)}function HW(e){return e.claude&&e.codex?"Refresh Claude + Codex quota":e.codex?"Refresh Codex quota":"Refresh Claude quota"}function VW(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 GW(e){const t=new Map;for(const n of e)n.kind!=="root"||!n.sessionId||t.set(n.sessionId,n.state);return t}function KW(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} ${KM(n.sessionId,r)}`}:n})}function YW({state:e,now:t,providers:n,incidents:r=[],leaving:s,onClose:o,liveSince:l=null}){const{quota:u,loading:d,refresh:h}=RW(n.claude),{data:f,loading:p,refresh:g}=AW(n.codex),{data:v}=MW(n.codex),k=f$(),{byModel:b,totalCost:x,totalTokens:N,burnRate:S}=UW(e,t,l),_=w.useMemo(()=>tW(e.agents.values()),[e,e.revision]),[E,T]=w.useState(pW);w.useEffect(()=>{mW(E)},[E]);const[R,A]=w.useState(gW);w.useEffect(()=>{yW(R)},[R]);const[q,L]=w.useState(0),P=w.useRef(()=>new Map);P.current=()=>l==null?null:bx(e.agents.values(),t);const I=w.useCallback(()=>P.current(),[]),{data:O,shown:U,stale:M,loading:$,baseline:B}=$W(E,q,I),V=O!=null,H=$&&M,F=w.useMemo(()=>VW(e.agents.values()),[e,e.revision]),W=w.useMemo(()=>GW(e.agents.values()),[e,e.revision]),D=w.useMemo(()=>V?QM(O):[],[O,V]),Y=w.useMemo(()=>V?KW(cW(O,F).slice(0,12)):[],[O,V,F]),J=w.useMemo(()=>Ud(O),[O]),G=w.useMemo(()=>uW(O,J.cost),[O,J.cost]),K=e$(U,E),X=w.useMemo(()=>V?aW(B,bx(e.agents.values(),t)):xx,[e,e.revision,B,V,t]),Z=fW(O,{...N,cost:x},X),ee=Z.hasCost,se=Z.tokenSum,ue=Na(Z.cost),ae=Na(Z.inputTokens),re=Na(Z.outputTokens),de=Na(Z.cacheReadTokens),me=Na(Z.cacheCreateTokens),pe=b.filter(Ij),ke=_.filter(Ij),xe=WW(V,D,pe),fe=d||p,Te=()=>{h(),g(),L(Oe=>Oe+1)},Fe=HW(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:Te,...Ir(fe),"aria-label":Fe,title:Fe,children:fe?"…":"↻"}),a.jsx("button",{type:"button",className:"glyph-btn up-close",onClick:o,"aria-label":"Close usage panel",title:"Close (U)",children:"×"})]})]}),n.claude&&a.jsx(NW,{quota:u,quotaLoading:d,nowSec:k,incident:r.find(Oe=>Oe.provider==="claude")}),n.codex&&a.jsx(jW,{codexQuota:f,codexLoading:p,codexUsage:v,nowSec:k,incident:r.find(Oe=>Oe.provider==="codex")}),V&&a.jsx(_W,{period:E,rangePending:H,setPeriod:T}),se>0?a.jsxs(a.Fragment,{children:[ee&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"up-total",title:V?void 0:Cj,children:[a.jsx("span",{className:"up-total-value",children:Be(ue)}),a.jsx("span",{className:"up-total-label",children:V?K:Zz})]}),Z.showCostBar&&a.jsx(Lb,{cost:x})]}),a.jsxs("div",{className:"up-tokens-row",title:V?void 0:Cj,children:[a.jsxs("span",{className:"up-tok",children:[a.jsx("span",{className:"up-k",children:"in"}),ot(ae)]}),a.jsxs("span",{className:"up-tok",children:[a.jsx("span",{className:"up-k",children:"out"}),ot(re)]}),Z.cacheReadTokens>0&&a.jsxs("span",{className:"up-tok",children:[a.jsx("span",{className:"up-k",children:"cache r"}),ot(de)]}),Z.cacheCreateTokens>0&&a.jsxs("span",{className:"up-tok",children:[a.jsx("span",{className:"up-k",children:"cache c"}),ot(me)]}),!ee&&a.jsx("span",{className:"up-tok up-scope",children:Jz})]}),(V?D.length:pe.length)>0&&a.jsx(SW,{fromRange:V,rangeModelRows:D,boardModelRows:pe}),V&&Y.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 ",K," yet — ccusage dates sessions in UTC, and the totals above are your local day."]})]}),(V?Y.length:ke.length)>0&&a.jsx(EW,{fromRange:V,rangeSessionRows:Y,boardSessionRows:ke,boardStates:W,sessionsOpen:R,setSessionsOpen:A,periodNoun:K,sessionScale:G}),xe&&a.jsxs("div",{className:"up-hint",children:["“",ds,"” 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:V?(U??E)==="all"?a.jsx(a.Fragment,{children:"No usage in any transcript on this machine."}):a.jsxs(a.Fragment,{children:["No usage ",K,".",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 XW(e,t,n){return e>=n?"hot":e>=t?"warn":"calm"}function ZW(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}% ${JW(t.lastMs,n)}`:"running at full speed, and never held back"}}function JW(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 QW(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 eH(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 tH(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 nH=3e3;function rH(){const[e,t]=w.useState(null),n=w.useRef(null);return w.useEffect(()=>{let r=!0;const s=async()=>{if(document.visibilityState!=="hidden")try{const d=await fetch("/api/system");if(!d.ok)return;const h=await d.json();r&&(h!=null&&h.ok)&&t(h)}catch{}},o=()=>{n.current==null&&(s(),n.current=window.setInterval(s,nH))},l=()=>{n.current!=null&&(window.clearInterval(n.current),n.current=null)},u=()=>{if(document.visibilityState==="hidden"){l();return}o(),s()};return o(),document.addEventListener("visibilitychange",u),()=>{r=!1,l(),document.removeEventListener("visibilitychange",u)}},[]),e}function sH(e,t){return!e||e.key!==t?"none":e.dir==="asc"?"ascending":"descending"}function dl({col:e,label:t,note:n,sort:r,next:s,onSort:o,className:l}){const u=sH(r,e);return a.jsx("th",{scope:"col","aria-sort":u,className:l,children:a.jsxs("button",{type:"button",className:"sd-sort",title:n?`Sort by ${t}
|
|
80
|
+
|
|
81
|
+
${n}`:`Sort by ${t}`,onClick:()=>o(s(r,e)),children:[t,a.jsx("span",{className:"sd-sort-dir","aria-hidden":!0,children:u==="none"?"":u==="ascending"?"↑":"↓"})]})})}function gp(e){return e<9.95?e.toFixed(1):String(Math.round(e))}function Pb(e){const t=Number.isFinite(e)?Math.max(0,e):0;return t<50?{value:"0",unit:"KB/s"}:t<999500?{value:gp(t/1e3),unit:"KB/s"}:t<9995e5?{value:gp(t/1e6),unit:"MB/s"}:{value:gp(t/1e9),unit:"GB/s"}}function Wd(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 Ll(e){return e.unit?e.unit==="%"||e.unit==="°C"?`${e.value}${e.unit}`:`${e.value} ${e.unit}`:e.value}function yp(e,t){return t==="B/s"?Pb(e):t==="ms"?Wd(e):{value:String(e),unit:t==="C"?"°C":t}}const _t={l:30,r:6,t:6,b:2},Bs={l:0,r:0,t:2,b:1},Hd=104,aH=64;function ar(e,t=100,n=Hd,r=_t){const s=n-r.t-r.b;return r.t+s*(1-Math.max(0,Math.min(t,e))/t)}function p$(e,t,n,r=100,s=Hd,o=_t){if(!e.length)return"";const l=e[e.length-1].t-e[0].t,u=f=>{const p=t-o.l-o.r;return o.l+(l>0?p*(f-e[0].t)/l:p/2)};let d="",h=null;for(const f of e){const p=h&&f.t-h.t<=n*2?"L":"M";d+=`${p}${u(f.t).toFixed(1)} ${ar(f.v,r,s,o).toFixed(1)}`,h=f}return d}function m$(e,t,n,r=100,s=Hd,o=_t){if(e.length<2)return"";const l=s-o.b,u=e[e.length-1].t-e[0].t,d=t-o.l-o.r,h=v=>o.l+(u>0?d*(v-e[0].t)/u:d/2);let f="",p=[];const g=()=>{if(p.length>=2){let v=`M${h(p[0].t).toFixed(1)} ${l}`;for(const k of p)v+=`L${h(k.t).toFixed(1)} ${ar(k.v,r,s,o).toFixed(1)}`;f+=`${v}L${h(p[p.length-1].t).toFixed(1)} ${l}Z`}p=[]};for(const v of e)p.length&&v.t-p[p.length-1].t>n*2&&g(),p.push(v);return g(),f}function oH(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 g$(e,t,n){return n!=null&&e>=n?"hot":t!=null&&e>=t?"warn":""}function iH(e,t,n=r=>ja(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),o=r[r.length-1];return`held back for ${s===1?"1 minute":`${s} minutes`}, last at ${n(o.t)}`}function ja(e){const t=new Date(e);return`${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}`}function Db(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 lH({group:e,title:t,onClose:n}){const r=yt(n),[s,o]=w.useState(null);w.useEffect(()=>{let h=!0;const f=async()=>{try{const g=await fetch(`/api/system/history?group=${e}`);if(!g.ok)return;const v=await g.json();h&&(v!=null&&v.ok)&&o(v)}catch{}};f();const p=window.setInterval(f,2e4);return()=>{h=!1,window.clearInterval(p)}},[e]);const l=(s==null?void 0:s.series)??[],[u,d]=w.useMemo(()=>{let h=1/0,f=0;for(const p of l)p.points.length&&(h=Math.min(h,p.points[0].t),f=Math.max(f,p.points[p.points.length-1].t));return[Number.isFinite(h)?Math.max(h,(s==null?void 0:s.sinceMs)??0):(s==null?void 0:s.sinceMs)??0,f]},[l,s==null?void 0:s.sinceMs]);return It.createPortal(a.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:a.jsxs("div",{ref:r,className:"modal hist-modal",onClick:h=>h.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 ",ja(u)," · ",Db(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(h=>a.jsx(cH,{series:h,stepMs:s.stepMs},h.label))})]})}),document.body)}function cH({series:e,stepMs:t}){const n=w.useRef(null),[r,s]=w.useState(560),[o,l]=w.useState(null);w.useEffect(()=>{const L=n.current;if(!L||typeof ResizeObserver>"u")return;const P=new ResizeObserver(([I])=>s(Math.max(160,I.contentRect.width)));return P.observe(L),()=>P.disconnect()},[]);const{points:u,unit:d,warnAt:h,critAt:f,label:p,top:g,restsAtZero:v,changes:k}=e,b=v?aH:Hd,{now:x,peak:N}=oH(u),S=x!=null?yp(x,d):null,_=N!=null?yp(N,d):null,E=p==="Throttling"?iH(u,t):null,T=o!=null?u[o]:null,R=u.length>1?u[u.length-1].t-u[0].t:0,A=L=>{const P=r-_t.l-_t.r;return _t.l+(R>0?P*(L-u[0].t)/R:P/2)},q=L=>{if(u.length<2)return;const P=L.currentTarget.getBoundingClientRect(),I=(L.clientX-P.left-_t.l)/Math.max(1,P.width-_t.l-_t.r),O=u[0].t+R*Math.max(0,Math.min(1,I));let U=0;for(let M=1;M<u.length;M++)Math.abs(u[M].t-O)<Math.abs(u[U].t-O)&&(U=M);l(U)};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"]})]}),N!=null&&_&&a.jsxs(a.Fragment,{children:[a.jsx("b",{className:g$(N,h,f),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:b,viewBox:`0 0 ${r} ${b}`,preserveAspectRatio:"none",role:"img","aria-label":S==null||_==null?`${p}: nothing measured yet`:`${p}: ${Ll(S)} now, peak ${Ll(_)}, over ${Db(u[0].t,u[u.length-1].t)}`,onPointerMove:q,onPointerLeave:()=>l(null),children:[[["warn",h],["hot",f]].map(([L,P])=>P==null||P>g?null:a.jsxs("g",{children:[a.jsx("line",{className:`hist-rule ${L}`,x1:_t.l,x2:r-_t.r,y1:ar(P,g,b),y2:ar(P,g,b)}),a.jsx("text",{className:`hist-rule-tag ${L}`,x:2,y:ar(P,g,b)+3,children:P})]},L)),a.jsx("line",{className:"hist-floor",x1:_t.l,x2:r-_t.r,y1:b-_t.b,y2:b-_t.b}),(k??[]).filter(L=>L.from!=null&&u.length>1&&L.t>=u[0].t&&L.t<=u[u.length-1].t).map(L=>a.jsx("line",{className:"hist-mark",x1:A(L.t),x2:A(L.t),y1:_t.t,y2:b-_t.b},L.t)),a.jsx("path",{className:"hist-area",d:m$(u,r,t,g,b)}),a.jsx("path",{className:"hist-line",d:p$(u,r,t,g,b)}),u.length===1&&a.jsx("circle",{className:"hist-dot",cx:A(u[0].t),cy:ar(u[0].v,g,b),r:3}),T&&a.jsxs("g",{children:[a.jsx("line",{className:"hist-cross",x1:A(T.t),x2:A(T.t),y1:_t.t,y2:b-_t.b}),a.jsx("circle",{className:"hist-dot",cx:A(T.t),cy:ar(T.v,g,b),r:3})]})]})}),a.jsx("div",{className:"hist-axis",children:T?a.jsxs("span",{className:"hist-at",children:[ja(T.t)," — ",(()=>{const L=yp(T.v,d);return a.jsxs(a.Fragment,{children:[a.jsx("b",{children:L.value}),L.unit==="%"||L.unit==="°C"||!L.unit?L.unit:` ${L.unit}`]})})()]}):a.jsxs(a.Fragment,{children:[a.jsx("span",{children:u.length?ja(u[0].t):""}),a.jsx("span",{children:u.length?ja(u[u.length-1].t):""})]})}),E&&a.jsx("div",{className:"hist-note",children:E}),k==null?void 0:k.slice(-3).map(L=>a.jsx("div",{className:"hist-note hist-route",children:L.from==null?`Since ${ja(L.t)} — ${L.label}`:`${ja(L.t)} — ${L.label.charAt(0).toUpperCase()+L.label.slice(1)}`},L.t))]})}const uH="thermal:Throttling";function dH(e){var n,r,s,o;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(o=e.thermal)!=null&&o.throttle&&(t[uH]=Math.max(0,100-e.thermal.throttle.speedLimit)),t}function xl(e,t){return t==="B/s"?Ll(Pb(e)):t==="ms"?Ll(Wd(e)):t==="C"?`${Math.round(e)}°`:t==="%"?`${Math.round(e)}%`:e.toFixed(2)}function ku(e,t){return t==="B/s"||t==="ms"||!Number.isInteger(e)?xl(e,t):t==="C"?`${e}°`:t==="%"?`${e}%`:`${e}`}const Oj=["cores","memory","load","thermal"],xa=116,Rr=24,hH=60,fH=6e4;function pH(e){return e.points.length?e.restsAtZero?e.points.some(t=>t.v>0):!0:!1}function mH(e){return e.unit==="C"?`${e.label} temp`:e.key==="mem:physical"?"Physical RAM":e.key==="mem:swap"?`${e.label} memory`:e.label}function gH(e,t=hH){return e.points.length<=t?e:{...e,points:e.points.slice(-t)}}function yH({sys:e}){const[t,n]=w.useState({});w.useEffect(()=>{let l=!0;const u=async()=>{const h=await Promise.all(Oj.map(async f=>{try{const p=await fetch(`/api/system/history?group=${f}`);return p.ok?[f,await p.json()]:[f,null]}catch{return[f,null]}}));l&&n(f=>{const p={...f};for(const[g,v]of h)v!=null&&v.ok&&(p[g]=v);return p})};u();const d=setInterval(()=>void u(),fH);return()=>{l=!1,clearInterval(d)}},[]);const r=w.useMemo(()=>dH(e),[e]),s=w.useMemo(()=>Oj.flatMap(l=>{const u=t[l];return u?u.series.filter(pH).map(d=>({series:gH(d),stepMs:u.stepMs})):[]}),[t]),o=w.useMemo(()=>{let l=1/0,u=-1/0;for(const{series:d}of s){const h=d.points;h.length&&(l=Math.min(l,h[0].t),u=Math.max(u,h[h.length-1].t))}return Number.isFinite(l)?Db(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 ${o}`,children:s.map(({series:l,stepMs:u})=>a.jsx(wH,{series:l,stepMs:u,now:r[l.key],span:o},l.key))}):null}function wH({series:e,stepMs:t,now:n,span:r}){var v;const{points:s,top:o,unit:l,warnAt:u,critAt:d}=e,h=mH(e),f=n??((v=s[s.length-1])==null?void 0:v.v),p=f==null?"":g$(f,u,d),g=Math.max(...s.map(k=>k.v));return a.jsxs("div",{className:`pl-cell${p?` ${p}`:""}`,title:[`${h} · peak ${xl(g,l)} over the last ${r}`,u!=null?`over ${ku(u,l)} is uncomfortable`:"",d!=null?`over ${ku(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:h}),a.jsx("span",{className:"pl-cell-now",children:f==null?"—":xl(f,l)})]}),a.jsxs("svg",{className:"pl-spark",width:xa,height:Rr,viewBox:`0 0 ${xa} ${Rr}`,preserveAspectRatio:"none","aria-hidden":!0,children:[a.jsx("line",{className:"pl-spark-floor",x1:0,x2:xa,y1:Rr-Bs.b,y2:Rr-Bs.b}),a.jsx("path",{className:"pl-spark-area",d:m$(s,xa,t,o,Rr,Bs)}),u!=null&&a.jsx("line",{className:"pl-rule warn",x1:0,x2:xa,y1:ar(u,o,Rr,Bs),y2:ar(u,o,Rr,Bs)}),d!=null&&a.jsx("line",{className:"pl-rule hot",x1:0,x2:xa,y1:ar(d,o,Rr,Bs),y2:ar(d,o,Rr,Bs)}),a.jsx("path",{className:"pl-spark-line",d:p$(s,xa,t,o,Rr,Bs)})]}),a.jsxs("span",{className:"vis-hidden",children:["peak ",xl(g,l)," over the last ",r,u!=null&&`, uncomfortable over ${ku(u,l)}`,d!=null&&`, the machine acts over ${ku(d,l)}`]})]})}const y$={key:"cpu",dir:"desc"};function vH(e,t){return e.key===t?{...e,dir:e.dir==="asc"?"desc":"asc"}:{key:t,dir:t==="name"||t==="user"?"asc":"desc"}}function xH(e,t){const n=t.dir==="asc"?1:-1,r=o=>t.key==="cpu"?o.cpu:t.key==="mem"?o.mem:t.key==="rss"?o.rssBytes:t.key==="threads"?o.threads:o.uptimeSec,s=(o,l)=>{if(t.key==="name")return n*o.name.localeCompare(l.name,void 0,{sensitivity:"base"});if(t.key==="user"){const h=o.user??"",f=l.user??"";return!h||!f?h===f?0:h?-1:1:n*h.localeCompare(f,void 0,{sensitivity:"base"})}const u=r(o),d=r(l);return u==null||d==null?u==null?d==null?0:1:-1:n*(u-d)};return[...e].sort((o,l)=>s(o,l)||(l.cpu??-1)-(o.cpu??-1)||l.mem-o.mem||o.pid-l.pid)}const bH=4e3;function kH(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 NH(){const[e,t]=w.useState(null);return w.useEffect(()=>{let n=!0;const r=async()=>{if(document.visibilityState!=="hidden")try{const o=await fetch("/api/system/processes?detail=1");if(!o.ok)return;const l=await o.json();n&&t(u=>kH(u,l))}catch{}};r();const s=window.setInterval(r,bH);return()=>{n=!1,window.clearInterval(s)}},[]),e}function jH(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 SH({sys:e,onClose:t}){const n=yt(t),[r,s]=w.useState(y$),o=NH();return It.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(_H,{read:o,sort:r,onSort:s,sys:e,onClose:t})})}),document.body)}function _H({read:e,sort:t,onSort:n,sys:r,onClose:s}){const o=e?xH(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"}),o!=null&&o.length>0&&a.jsxs("span",{className:"pl-count",children:[o.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:o==null?a.jsx("p",{className:"pl-empty",children:"Reading the process list…"}):o.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(Mo,{col:"cpu",label:"cpu",sort:t,onSort:n}),a.jsx(Mo,{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(Mo,{col:"threads",label:"threads",sort:t,onSort:n}),a.jsx(Mo,{col:"uptime",label:"up",sort:t,onSort:n}),a.jsx(Mo,{col:"user",label:"user",sort:t,onSort:n}),a.jsx("th",{scope:"col",className:"pl-pid-h",children:"pid"}),a.jsx(Mo,{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:o.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:ka(l.rssBytes)}),a.jsx("td",{className:"sd-num sd-dim",children:l.threads??"—"}),a.jsx("td",{className:"sd-num sd-dim",children:jH(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(yH,{sys:r})]})]})}function Mo(e){return a.jsx(dl,{...e,next:(t,n)=>vH(t??y$,n)})}function jx({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 Pl({group:e,title:t,action:n,label:r,value:s,hint:o,children:l}){const[u,d]=w.useState(!1),h=w.useRef(null),f=()=>{var p,g;((p=window.getSelection())==null?void 0:p.isCollapsed)!==!1&&((g=h.current)==null||g.focus({preventScroll:!0}),d(!0))};return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"sd-reading",onClick:f,children:[a.jsx("button",{ref:h,type:"button",className:"sd-open",onClick:()=>d(!0),title:n,"aria-label":s==null?`${r}: show history`:`${r}: show history, now ${s}`,"aria-describedby":o?`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]}),o&&a.jsx("span",{id:`sd-hint-${e}`,className:"vis-hidden",children:o}),u&&a.jsx(lH,{group:e,title:t,onClose:()=>d(!1)})]})}function dd({label:e,value:t,pct:n,tone:r="calm",note:s,mark:o,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})`}}),o!=null&&o>0&&o<100&&a.jsx("span",{className:"sd-mark",style:{left:`${o}%`},"aria-hidden":!0})]}),s&&a.jsx("div",{className:"sd-note",children:s})]})}function EH(e,t,n){if(n<=0||Od(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 Gs=4,Ln=8;function Fb(e,t,n){const r=n.width-Ln-(e.right+Gs),s=e.left-Gs-Ln,o=t.width<=r||r>=s?"right":"left",l=o==="right"?e.right+Gs:e.left-Gs-t.width,u=n.height-Ln*2,d=t.height<=u,h=d?t.height:Math.max(0,u),f=Math.max(Ln,Math.min(e.top,n.height-Ln-h)),p=Math.max(Ln,Math.min(l,n.width-Ln-t.width));return{top:f,left:p,side:o,maxHeight:d?null:h}}function CH(e,t,n){const r=n.height-Ln-(e.bottom+Gs),s=e.top-Gs-Ln,o=t.height<=r||r>=s?"below":"above",l=o==="below"?r:s,u=t.height<=l,d=u?t.height:Math.max(0,l),h=o==="below"?e.bottom+Gs:e.top-Gs-d,f=Math.max(Ln,Math.min(e.right-t.width,n.width-Ln-t.width));return{top:Math.max(Ln,h),left:f,side:o,maxHeight:u?null:d}}function TH(e,t,n){return!(!e||t!=null&&t.contains(e)||n!=null&&n.contains(e))}function w$(e,t,n){const r=w.useRef(t);r.current=t;const s=w.useRef(n);s.current=n,w.useEffect(()=>{const o=l=>{TH(l.target,e.current,r.current())&&s.current()};return window.addEventListener("pointerdown",o,!0),()=>window.removeEventListener("pointerdown",o,!0)},[e])}const v$='[role="menuitem"]';function Lj(e){return e?Array.from(e.querySelectorAll(v$)).filter(t=>!t.disabled):[]}function qb({anchorId:e,boundaryId:t,id:n,className:r,role:s,labelledBy:o,start:l="first",onClose:u,children:d}){const h=w.useRef(u);h.current=u;const f=yt(()=>{var b;(b=document.getElementById(e))==null||b.focus(),h.current()},{popover:!0}),p=w.useCallback(()=>{var E;const b=f.current;if(!b)return;const x=document.getElementById(e);if(!x){h.current();return}const N=x.getBoundingClientRect(),S=t?(E=document.getElementById(t))==null?void 0:E.getBoundingClientRect():null;if(S&&(N.bottom<=S.top||N.top>=S.bottom)){b.contains(document.activeElement)&&x.focus({preventScroll:!0}),h.current();return}b.style.maxHeight="";const _=CH(N,{width:b.offsetWidth,height:b.offsetHeight},{width:window.innerWidth,height:window.innerHeight});b.style.top=`${_.top}px`,b.style.left=`${_.left}px`,b.style.maxHeight=_.maxHeight==null?"":`${_.maxHeight}px`,b.dataset.side=_.side},[e,t,f]);w.useLayoutEffect(()=>{p()}),w.useEffect(()=>{const b=x=>{var N;(N=f.current)!=null&&N.contains(x.target)||p()};return window.addEventListener("scroll",b,!0),window.addEventListener("resize",p),()=>{window.removeEventListener("scroll",b,!0),window.removeEventListener("resize",p)}},[p,f]),w$(f,()=>document.getElementById(e),u),w.useEffect(()=>{var x;if(s!=="menu")return;const b=Lj(f.current);(x=l==="last"?b[b.length-1]:b[0])==null||x.focus()},[]);const g=b=>{var x;if(s==="menu"&&b.key==="Tab"){b.stopPropagation(),(x=document.getElementById(e))==null||x.focus(),b.shiftKey&&b.preventDefault(),h.current();return}if(s==="menu"){const N=Lj(f.current),S=EH(b,N.indexOf(document.activeElement),N.length);S.kind==="focus"&&(b.preventDefault(),N[S.index].focus())}b.key.length===1&&b.stopPropagation()},v=b=>{b.target.closest("button, input, select, textarea, code")||b.preventDefault()},k=b=>{if(s!=="menu"||b.pointerType==="touch")return;const x=b.target.closest(v$);x&&!x.disabled&&document.activeElement!==x&&x.focus({preventScroll:!0})};return It.createPortal(a.jsx("div",{ref:f,id:n,className:`anchored-popover${r?` ${r}`:""}`,role:s,"aria-labelledby":o,onKeyDown:g,onMouseDown:v,onPointerMove:k,children:d}),document.body)}function RH({network:e}){const{down:t,up:n,api:r,route:s}=e,[o,l]=w.useState(!1),u=r&&r.ms!=null?Wd(r.ms):null,d=t!=null&&n!=null;return a.jsxs("div",{className:"sd-section",role:"group","aria-label":"Network",children:[a.jsxs(Pl,{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(([h,f])=>{const p=Pb(f);return a.jsx(jx,{value:p.value,unit:p.unit,cap:h},h)}),u&&a.jsx(jx,{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":o,"aria-haspopup":"dialog",onClick:()=>l(h=>!h),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:"›"})]}),o&&a.jsx(AH,{route:s,api:r,onClose:()=>l(!1)})]})]})}function AH({route:e,api:t,onClose:n}){return a.jsxs(qb,{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 ",tH(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`:`${Ll(Wd(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 Pj({usageOpen:e,leaving:t,sub:n,flag:r,onClose:s,children:o}){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})]}),o]})}function MH({usageOpen:e,leaving:t,onClose:n}){const r=rH();if(!r||r.cpu==null||!r.memory)return a.jsx(Pj,{usageOpen:e,leaving:t,onClose:n,children:a.jsx("div",{className:"sd-note",children:"reading this machine…"})});const{memory:s,swap:o,perCore:l,loadavg:u,cores:d,uptimeSec:h,platform:f,thermal:p,network:g,cpu:v}=r;return a.jsxs(Pj,{usageOpen:e,leaving:t,sub:`up ${QW(h)} · ${d} cores`,flag:eH(r),onClose:n,children:[a.jsx($H,{cpu:v,perCore:l,loadavg:u,cores:d}),a.jsx(IH,{memory:s,swap:o,platform:f}),g&&a.jsx(RH,{network:g}),a.jsx(OH,{thermal:p}),a.jsx(LH,{sys:r})]})}function $H({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(Pl,{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((o,l)=>a.jsx("span",{className:"sd-core",title:`logical core ${l+1} · ${o}% busy`,children:a.jsx("span",{className:"sd-core-fill",style:{transform:`scaleY(${Math.max(2,o)/100})`}})},l))})}),n&&a.jsxs(Pl,{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((o,l)=>a.jsx(jx,{value:o.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 IH({memory:e,swap:t,platform:n}){const r=e.total-e.available,s=n==="win32"?"Commit":"Swap",o=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(Pl,{group:"memory",title:"Memory history",action:"Show memory history",label:"Memory",children:[a.jsx(dd,{label:"Physical",value:a.jsxs(a.Fragment,{children:[a.jsx("b",{children:ka(r)})," of ",ka(e.total)]}),pct:e.usedPct,tone:e.usedPct>=90?"warn":"calm",note:`${ka(e.available)} available`}),t&&t.total>0&&a.jsx(dd,{label:s,value:a.jsxs(a.Fragment,{children:[a.jsx("b",{children:ka(t.used)})," of ",ka(t.total)]}),pct:o,tone:o>=90?"warn":"calm"})]})})}function OH({thermal:e}){if(!e)return null;const t=e.throttle?ZW(e.throttle.speedLimit,e.heldBack):null;return a.jsx("div",{className:"sd-section",role:"group","aria-label":"Thermal",children:a.jsxs(Pl,{group:"thermal",title:"Thermal history",action:"Show thermal history",label:"Thermal",children:[e.celsius.map(n=>a.jsx(dd,{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:XW(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(dd,{label:"Throttling",value:a.jsx("b",{children:t.value}),pct:t.pct,tone:t.tone,note:t.note})]})})}function LH({sys:e}){const[t,n]=w.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(SH,{sys:e,onClose:()=>n(!1)})]})}function x$(e){return{inputTokens:e.i,outputTokens:e.o,cacheReadTokens:e.cr,cacheCreateTokens:e.cc,cacheCreate1hTokens:e.c1h,cacheCreate5mTokens:e.c5m}}function PH(e){return{...x$(e),cacheCreate1hTokens:0,cacheCreate5mTokens:0}}function b$(e){return e.i+e.o+e.cr+e.cc}function Dj(e){let t=0;for(const n of Object.values(e))t+=b$(n);return t}function DH(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 o=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(!o||!/claude/i.test(d)||u.missingPricing===!0)continue;const h=`${o}|${d}`,f=n.get(h),p=f?f.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),f?f.cost+=t(u.cost):n.set(h,{cost:t(u.cost),usage:p})}}return n}function FH(e,t,n,r=Date.now()){const s=new Map;let o=0,l=0;for(const[T,R]of n){const A=T.indexOf("|"),q=T.slice(0,A),L=T.slice(A+1),P=Ko(R.usage,L,r).total;if(!(P>0&&R.cost>0))continue;o+=R.cost,l+=P;let I=s.get(q);I||(I=new Map,s.set(q,I)),I.set(L,R.cost/P)}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(hi(R)))??null},h=new Set,f=(T,R)=>{let A=0,q=0;for(const[L,P]of Object.entries(T)){if(qa(L,r)){const O=R(L);A+=O===null?Ko(x$(P),L,r).total:Ko(PH(P),L,r).total*O;continue}const I=b$(P);I>0&&(q+=I,h.add(L))}return{cost:A,unpriced:q}},p=new Map,g=[];for(const T of e){const R=new Map,A=new Map;let q=0;for(const L of T.projects){const{cost:P,unpriced:I}=f(L.models,U=>d(T.day,U));R.set(L.path,(R.get(L.path)??0)+P),I>0&&A.set(L.path,(A.get(L.path)??0)+I),q+=P;let O=p.get(L.path);O||(O={path:L.path,cost:0,tokens:0,unpricedTokens:0},p.set(L.path,O)),O.cost+=P,O.tokens+=Dj(L.models),O.unpricedTokens+=I}g.push({day:T.day,total:q,byPath:R,unpricedByPath:A})}const v=[...p.values()].sort((T,R)=>R.cost-T.cost||R.tokens-T.tokens),k=v.reduce((T,R)=>T+R.cost,0),b=v.reduce((T,R)=>T+R.tokens,0),x=v.reduce((T,R)=>T+R.unpricedTokens,0),N=u?o/l:null,S=t?Dj(t):0,_=t?f(t,()=>N):{cost:0,unpriced:0},E=_.cost>0||S>0?{cost:_.cost,tokens:S,unpricedTokens:_.unpriced}:null;return{projects:v,totalCost:k,totalTokens:b,unpricedTokens:x,perDay:g,unattributed:E,unpricedModels:[...h].sort(),calibrated:u,reconciled:u&&x===0}}function Ar(e,t,n=Be){return t>0?e>0?`${n(e)}+`:ds:n(e)}function $o(e){return e>0?`${ot(e)} of these tokens are on an unpriced model, so this is a floor`:void 0}function qH(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 ${ds}: this build holds no published rate for it, so its tokens are counted and its dollars are not.`:`${n} are ${ds}: this build holds no published rate for them, so their tokens are counted and their dollars are not.`}const BH={phase:"running"},UH={phase:"failed"},zH={gen:0,report:null,error:null,early:null};function WH(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:BH;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 HH(e){var t;return((t=e.report)==null?void 0:t.gen)!==e.gen&&e.error===null}function VH(e){const t=e;return t&&t.ok!==!1?{phase:"ready",range:t}:UH}function GH(e){return`${e.getFullYear()}${String(e.getMonth()+1).padStart(2,"0")}${String(e.getDate()).padStart(2,"0")}`}function KH(e,t,n=Date.now()){const r=t===0?60:t,s=new Date(n),o=kx(r,s),l=GH(s);return{report:`/api/account-projects?num=${e}&days=${t}`,ccusage:`/api/ccusage?since=${o}&until=${l}`}}function YH({num:e,days:t,gen:n,dispatch:r,get:s=(l,u)=>fetch(l,u),now:o=Date.now()}){const l=KH(e,t,o),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:VH(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 k$(e){return/^[A-Za-z]:[\\/]$/.test(e)?e:e.replace(/[\\/]+$/,"")}function wp(e){const t=k$(e).replace(/\\/g,"/");return/^[A-Za-z]:\//.test(t)?t.toLowerCase():t}function Fj(e){if(!e)return e;const t=k$(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 XH(e,t){const n=wp(e);let r;for(const s of t){const o=wp(s.path);!o||o===n||!n.startsWith(`${o}/`)||(!r||wp(r.path).length<o.length)&&(r=s)}return r==null?void 0:r.label}function Sx(e){return e===0?"all time":e===1?"today":`the last ${e} days`}function ZH(e){return e===1?"No work attributed to this account yet today.":`No work attributed to this account in ${Sx(e)}.`}function JH(e){return e===1?7:e===7?30:e===30?0:null}function QH(e,t){return e!==1&&t>0}const e7=[{days:1,label:"Today"},{days:7,label:"7d"},{days:30,label:"30d"},{days:0,label:"All"}],Io=["var(--usage-blue)","var(--usage-teal)","var(--usage-lime)","var(--usage-purple)","var(--usage-indigo)","var(--usage-pink)","var(--usage-orange)","var(--usage-zinc)"],t7="var(--usage-zinc)",vp=6,n7=1600;function r7(e){const t=Be(e),n=/^\$(\d{4,})$/.exec(t);return n?`$${Number(n[1]).toLocaleString("en-US")}`:t}function Nu(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 s7(e){const t=/^\d{4}-(\d{2})-(\d{2})$/.exec(e);return t?`${Number(t[1])}/${Number(t[2])}`:e}function a7(e){const t=Math.max(1,Math.ceil(e/6));return n=>n===0||n===e-1||n%t===0}function xp(e){if(!e)return"";try{return new Date(e).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}catch{return""}}function o7({num:e,name:t,onClose:n}){var $,B,V,H;const[r,s]=w.useState(1),[o,l]=w.useReducer(WH,zH),u=(($=o.report)==null?void 0:$.data)??null,d=((B=o.report)==null?void 0:B.days)??r,h=((V=o.report)==null?void 0:V.cost.phase)==="ready"?o.report.cost.range:null,f=((H=o.report)==null?void 0:H.cost.phase)==="running",[p,g]=w.useState(null),[v,k]=w.useState(()=>new Set),b=HH(o),x=o.error,[N,S]=w.useState(null),_=w.useRef(void 0),E=w.useRef(!0);w.useEffect(()=>()=>{E.current=!1,window.clearTimeout(_.current)},[]);const T=w.useRef(null),R=yt(n,{focusRef:T}),A=w.useRef(0);w.useEffect(()=>{const F=++A.current;l({type:"start",gen:F}),g(null),k(new Set),YH({num:e,days:r,gen:F,dispatch:l})},[e,r]);const q=w.useMemo(()=>{const F=Date.now();if(!u)return null;const W=FH(u.daily??[],u.unattributed,DH(h),F),D=fe=>fe.replace(/[\\/]+$/,"").split(/[\\/]/).pop()||fe||"(unknown)",Y=new Map;for(const fe of W.projects)Y.set(D(fe.path),(Y.get(D(fe.path))??0)+1);const J=fe=>{const Te=D(fe);if((Y.get(Te)??0)<=1)return Te;const Fe=fe.replace(/[\\/]+$/,"").split(/[\\/]/).slice(-2,-1)[0];return Fe?`${Fe}/${Te}`:Te},G=W.projects.map(fe=>({path:fe.path,label:J(fe.path)})),K=fe=>({path:fe.path,label:J(fe.path),parentLabel:XH(fe.path,G),cost:fe.cost,tokens:fe.tokens,unpricedTokens:fe.unpricedTokens}),X=Io[vp%Io.length],Z=new Map,ee=[],se=W.projects.slice(0,vp),ue=W.projects.slice(vp);se.forEach((fe,Te)=>{Z.set(fe.path,Io[Te%Io.length]),ee.push({key:fe.path,...K(fe),color:Io[Te%Io.length]})}),ue.length&&ee.push({key:"__other__",label:`Other · ${ue.length} project${ue.length>1?"s":""}`,cost:ue.reduce((fe,Te)=>fe+Te.cost,0),tokens:ue.reduce((fe,Te)=>fe+Te.tokens,0),unpricedTokens:ue.reduce((fe,Te)=>fe+Te.unpricedTokens,0),color:X,muted:!0,members:ue.map(K)});const ae=W.totalCost,re=W.totalTokens,de=ae>0&&W.unpricedTokens===0?"cost":"tokens",me=de==="cost"?ae:re,pe=ee.map(fe=>fe.color),ke=W.perDay.map(fe=>{const Te=new Map;for(const[We,le]of fe.byPath){const je=Z.get(We)??X;Te.set(je,(Te.get(je)??0)+le)}const Fe=new Map;let Oe=0;for(const[We,le]of fe.unpricedByPath){const je=Z.get(We)??X;Fe.set(je,(Fe.get(je)??0)+le),Oe+=le}return{day:fe.day,total:fe.total,costByColor:Te,unpricedByColor:Fe,unpriced:Oe}}),xe=ke.reduce((fe,Te)=>Math.max(fe,Te.total),0);return{projectCount:W.projects.length,rows:ee,totalCost:ae,totalTokens:re,basis:de,denom:me,un:W.unattributed,chart:ke,maxDay:xe,colorOrder:pe,unpricedTokens:W.unpricedTokens,unpricedNote:qH(W.unpricedModels),calibrated:W.calibrated,reconciled:W.reconciled}},[u,h]),L=(F,W)=>{Ba(F).then(D=>{E.current&&(window.clearTimeout(_.current),S({path:F,label:W,ok:D}),_.current=window.setTimeout(()=>{E.current&&S(null)},n7))})},P=F=>N!=null&&N.ok&&N.path===F?"Copied":"Copy",I=u!=null&&u.trackedSince?`Tracked since ${xp(u.trackedSince)}`:"Tracking starts with this version",O=Sx(d),U=JH(d),M=b&&!!u;return It.createPortal(a.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:a.jsxs("div",{ref:R,className:"modal ap-proj-modal",onClick:F=>F.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:e7.map(F=>a.jsx("button",{type:"button",className:"uh-range-btn","aria-pressed":r===F.days,onClick:()=>s(F.days),children:F.label},F.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${M?" refreshing":""}`,"aria-busy":b,children:[b&&!u&&a.jsx("div",{className:"ap-proj-state",children:"Loading…"}),!b&&x&&a.jsxs("div",{className:"ap-proj-state ap-proj-error",children:["Couldn’t load this report: ",x]}),!x&&q&&a.jsx(a.Fragment,{children:q.rows.length===0?a.jsxs("div",{className:"ap-proj-state",children:[M?"Updating…":ZH(d),U!=null&&a.jsx("div",{className:"ap-proj-widen-wrap",children:a.jsxs("button",{type:"button",className:"ap-proj-copy",onClick:()=>s(U),children:["Show ",Sx(U)]})}),a.jsxs("div",{className:"ap-proj-note",children:[I,". 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 ${q.basis==="cost"?Be(q.totalCost):`${ot(q.totalTokens)} tokens`} across ${q.projectCount} project${q.projectCount>1?"s":""}`,children:q.rows.map(F=>{const W=q.basis==="cost"?F.cost:F.tokens,D=q.denom>0?W/q.denom*100:0;if(D<=0)return null;const Y=q.basis==="cost"?Nu(F.cost,q.totalCost):`${Nu(F.tokens,q.totalTokens)} of tokens`;return a.jsx("span",{className:"ap-proj-seg",style:{width:`${D}%`,background:F.color},title:`${F.label} · ${Ar(F.cost,F.unpricedTokens)} · ${Y}${F.tokens?` · ${ot(F.tokens)} tokens`:""}`},F.key)})}),a.jsxs("div",{className:"ap-proj-totals",children:[a.jsx("span",{className:"ap-proj-total-cost",title:$o(q.unpricedTokens),children:Ar(q.totalCost,q.unpricedTokens)}),a.jsxs("span",{className:"ap-proj-total-tok",children:[ot(q.totalTokens)," tokens"]}),a.jsxs("span",{className:"ap-proj-total-win",children:["· ",M?"updating…":O]}),f&&a.jsx("span",{className:"ap-proj-total-pending",children:"Reconciling cost…"})]}),q.unpricedNote&&a.jsx("div",{className:"ap-proj-note",children:q.unpricedNote}),QH(d,q.chart.length)&&a.jsxs("div",{className:"ap-proj-days",children:[a.jsxs("div",{className:"ap-proj-days-cap",children:["By day",q.chart.length>1?" · click a bar":""]}),a.jsx("div",{className:"ap-proj-days-plot",role:"group","aria-label":`Spend across ${q.chart.length} day${q.chart.length>1?"s":""}`,children:q.chart.map(F=>{const W=q.maxDay>0?F.total/q.maxDay*100:0,D=p===F.day,Y=q.rows.map(G=>({label:G.label,c:F.costByColor.get(G.color)??0,u:F.unpricedByColor.get(G.color)??0})).filter(G=>G.c>0||G.u>0),J=`${xp(Date.parse(`${F.day}T00:00:00`))}, ${Ar(F.total,F.unpriced)}. ${Y.map(G=>`${G.label} ${Ar(G.c,G.u)}`).join(", ")}`;return a.jsx("button",{type:"button",className:`ap-proj-day${D?" selected":""}`,"aria-pressed":D,"aria-label":J,title:`${F.day} · ${Ar(F.total,F.unpriced)}`,onClick:()=>g(G=>G===F.day?null:F.day),children:a.jsx("span",{className:"ap-proj-col",style:{height:`${W}%`},children:q.colorOrder.map((G,K)=>{const X=F.costByColor.get(G)??0;return X<=0||F.total<=0?null:a.jsx("span",{className:"ap-proj-colseg",style:{height:`${X/F.total*100}%`,background:G}},K)})})},F.day)})}),(()=>{const F=a7(q.chart.length);return a.jsx("div",{className:"ap-proj-days-axis","aria-hidden":"true",children:q.chart.map((W,D)=>a.jsx("div",{className:"ap-proj-axis-cell",children:F(D)?s7(W.day):""},W.day))})})(),(()=>{const F=p?q.chart.find(D=>D.day===p):null;if(!F)return null;const W=q.rows.map(D=>({r:D,c:F.costByColor.get(D.color)??0,u:F.unpricedByColor.get(D.color)??0})).filter(D=>D.c>0||D.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:xp(Date.parse(`${F.day}T00:00:00`))}),a.jsx("span",{className:"ap-proj-day-detail-total",title:$o(F.unpriced),children:Ar(F.total,F.unpriced)})]}),W.map(({r:D,c:Y,u:J})=>a.jsxs("div",{className:"ap-proj-day-detail-row",children:[a.jsx("span",{className:"ap-proj-dot",style:{background:D.color},"aria-hidden":"true"}),a.jsx("span",{className:"ap-proj-day-detail-name",children:D.label}),a.jsx("span",{className:"ap-proj-day-detail-cost",title:$o(J),children:Ar(Y,J)})]},D.key))]})})()]}),a.jsx("ul",{className:"ap-proj-list",children:q.rows.map((F,W)=>{const D=q.basis==="cost"?F.cost:F.tokens,Y=q.denom>0?D/q.denom*100:0,J=v.has(F.key),G=`ap-proj-details-${W}`,K=J&&(!!F.path||!!F.members),X=F.members?`${J?"Hide":"Show"} the ${F.members.length} project${F.members.length>1?"s":""} folded into Other`:`${J?"Hide":"Show"} location for ${F.label}`;return a.jsxs("li",{className:`ap-proj-row${F.muted?" muted":""}${J?" expanded":""}`,children:[a.jsx("span",{className:"ap-proj-dot",style:{background:F.color},"aria-hidden":"true"}),a.jsxs("span",{className:"ap-proj-name",children:[F.label,F.parentLabel&&a.jsxs("span",{className:"ap-proj-parent",children:[" · in ",F.parentLabel]})]}),a.jsx("span",{className:"ap-proj-track",title:q.basis==="cost"?`${Nu(F.cost,q.totalCost)} of tracked cost`:`${Nu(F.tokens,q.totalTokens)} of tracked tokens`,children:a.jsx("span",{className:"ap-proj-fill",style:{width:`${Y}%`,background:F.color}})}),a.jsx("span",{className:"ap-proj-cost",title:$o(F.unpricedTokens),children:Ar(F.cost,F.unpricedTokens)}),a.jsx("span",{className:"ap-proj-tok",children:ot(F.tokens)}),a.jsx("button",{type:"button",className:"glyph-btn ap-proj-info","aria-expanded":J,"aria-controls":K?G:void 0,"aria-label":X,onClick:()=>k(Z=>{const ee=new Set(Z);return ee.has(F.key)?ee.delete(F.key):ee.add(F.key),ee}),children:"ⓘ"}),J&&F.path&&a.jsxs("div",{className:"ap-proj-details",id:G,children:[a.jsx("code",{className:"ap-proj-path",children:Fj(F.path)}),a.jsx("button",{type:"button",className:"ap-proj-copy","aria-label":`${P(F.path)} location for ${F.label}`,onClick:()=>L(F.path,F.label),children:P(F.path)})]}),J&&F.members&&a.jsx("div",{className:"ap-proj-details ap-proj-other-members",id:G,children:F.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:Fj(Z.path)}),a.jsx("span",{className:"ap-proj-cost",title:$o(Z.unpricedTokens),children:Ar(Z.cost,Z.unpricedTokens)}),a.jsx("span",{className:"ap-proj-tok",children:ot(Z.tokens)}),a.jsx("button",{type:"button",className:"ap-proj-copy","aria-label":`${P(Z.path)} location for ${Z.label}`,onClick:()=>L(Z.path,Z.label),children:P(Z.path)})]},Z.path))})]},F.key)})}),q.un&&a.jsxs("div",{className:"ap-proj-unattributed",children:[a.jsx("span",{className:"ap-proj-dot",style:{background:t7},"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:$o(q.un.unpricedTokens),children:Ar(q.un.cost,q.un.unpricedTokens,r7)}),a.jsx("span",{className:"ap-proj-un-tok",children:ot(q.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:N&&(N.ok?`Copied the location of ${N.label}`:`Could not copy the location of ${N.label} — select it and copy it by hand`)}),a.jsxs("div",{className:"ap-proj-foot",children:[f?"Dollars estimated · ccusage still running":q.reconciled?"Dollars from ccusage · split by activity":q.calibrated?"Dollars from ccusage for the priced models · split by activity":h?"Dollars estimated · ccusage could not price this window":"Dollars estimated · ccusage unavailable"," · ",I]})]})})]})]})}),document.body)}function oi(e,t){return GM(t-Math.floor(e/1e3))}function i7(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 Bb(){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 l7({anchorId:e,boundaryId:t,issue:n,who:r,fetchedAt:s,nowSec:o,onClose:l,onSignIn:u,onReport:d}){return a.jsx(qb,{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(Bb,{}),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 ${oi(s,o)}`:"never collected"]}),a.jsxs("div",{className:"ap-pop-actions",children:[d&&a.jsx("button",{type:"button",className:"ap-issue-report",onClick:()=>{l(),d()},children:"Report this"}),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 hl(e){return e.charAt(0).toUpperCase()+e.slice(1)}function c7(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 u7(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 d7(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.`}}}const qj={text:"Login expired on all online decks",hint:"Every paired deck online right now that shares this account holds a copy that has expired too, so none of them can repair this one. Claude retires a login's other copies each time one machine refreshes it, which is how shared copies expire together. Sign in again on any one machine; the others repair from it on their next round."};function ii(e,t,n){const r=f7(e,t);return!r||!(n!=null&&n.noCopyWorksNearby)||!h7(e)?r:{...r,text:qj.text,hint:qj.hint}}function h7(e){return e.staleCopy?!1:e.stopped?e.collector==="relogin_required":e.error==="invalid_grant"||e.error==="no_refresh_token"}function f7(e,t){if(e.staleCopy){const n=c7(e.repair??null,t);return{text:hl(n.text),hint:n.hint,fix:null,tone:"quiet",blocksSwitch:!1}}if(e.stopped){const n=d7(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:hl(n.text),hint:n.hint,fix:n.fix?hl(n.fix):null,tone:r||e.collector==="keychain_unavailable"?"warn":"quiet",blocksSwitch:r}}if(e.error){const n=u7(e.error);return{text:hl(n.text),hint:n.hint,fix:n.fixable?"Sign in again":null,tone:n.fixable?"warn":"quiet",blocksSwitch:n.fixable}}return null}function Bj(e){return typeof e.id=="string"&&e.id.startsWith("scoped-")}function p7(e){const t=e.filter(u=>!Bj(u)),n=e.filter(u=>Bj(u)),r=t.length?t:n,s=t.length?n:[],o=r.reduce((u,d)=>u&&u.pct>=d.pct?u:d,null);let l=null;for(const u of s)o&&u.pct<=o.pct||(!l||u.pct>l.pct)&&(l=u);return{shown:r,rest:s,fuller:l,peak:l??o}}const m7="\0";function Mr(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}${m7}${n}`}function g7(e,t,n=Mr){const r=n(t);return e.includes(r)?e.filter(s=>s!==r):[...e,r]}const Vd="slot",Ub=[{lane:"five_hour",name:"5h"},{lane:"seven_day",name:"7d"}],N$=e=>e.id.startsWith("scoped-");function y7(e){var t;return((t=Ub.find(n=>n.lane===e.id))==null?void 0:t.name)??e.label}function w7(e){if(e==="room")return"room";const t=/^(.+):(full|empty)$/.exec(e);return t?t[1]:null}function j$(e){const t=[...new Set(e.flatMap(r=>(r.lanes??[]).filter(N$).map(s=>s.label)))].sort((r,s)=>r.localeCompare(s)),n=[...Ub.map(r=>r.name),...t];return[{id:Vd,label:"Slot"},...n.flatMap(r=>[{id:`${r}:full`,label:`${r} · fullest`},{id:`${r}:empty`,label:`${r} · emptiest`}]),{id:"room",label:"Most room"}]}function Uj(e,t){const n=Ub.find(s=>s.name===t),r=(e.lanes??[]).find(s=>n?s.id===n.lane:N$(s)&&s.label===t);return r&&Number.isFinite(r.pct)?r.pct:null}function v7(e,t,n=()=>!0){const r=[...e],s=h=>[...h.filter(n),...h.filter(f=>!n(f))];if(t==="room")return s(zj(r,h=>Number.isFinite(h.headroom)?h.headroom:null,"desc"));const o=/^(.+):(full|empty)$/.exec(t);if(!o)return r;const[,l,u]=o;if(!r.some(h=>Uj(h,l)!=null))return r;const d=zj(r,h=>Uj(h,l),u==="full"?"desc":"asc");return u==="empty"?s(d):d}function zj(e,t,n){const r=e.filter(o=>t(o)!=null),s=e.filter(o=>t(o)==null);return r.sort((o,l)=>n==="desc"?t(l)-t(o):t(o)-t(l)),[...r,...s]}function x7(e,t){return j$(t).some(n=>n.id===e)?e:Vd}function _x(e,t){if(!t)return[...e];const n=new Map(t.map((o,l)=>[o,l])),r=e.filter(o=>n.has(Mr(o))).sort((o,l)=>n.get(Mr(o))-n.get(Mr(l))),s=e.filter(o=>!n.has(Mr(o)));return[...r,...s]}function zb(e){const t=Mr(e);return t.startsWith("slot:")?t:`h:${b7(t)}`}function b7(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 Ex={mode:"some",keys:[]};function S$(e,t){const n=e.keys.includes(zb(t));return e.mode==="all"?!n:n}function k7(e,t){return{mode:e.mode,keys:g7(e.keys,t,zb)}}function _$(e,t){return t.length>0&&t.every(n=>S$(e,n))}function N7(e,t){return _$(e,t)?Ex:{mode:"all",keys:[]}}function j7(e,t){if(!Array.isArray(t))return e;const n=new Set(t.map(zb)),r=e.keys.filter(s=>n.has(s));return r.length===e.keys.length?e:{mode:e.mode,keys:r}}function S7(e){return e>=90?"hi":e>=70?"mid":void 0}function _7({lane:e,nowSec:t,frozen:n,sortedBy:r}){const s=Math.min(100,Math.max(0,e.pct)),o=n?"var(--muted)":s>=90?"var(--err)":s>=70?"var(--warn)":"var(--accent)",l=e.resetAt&&!n?qd(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:o,opacity:s===0||n?.4:1}})}),a.jsxs("span",{className:"ap-lane-pct",style:{color:o},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 E7({a:e,nowSec:t,lan:n,opened:r,onToggleLanes:s,busy:o,pressProps:l,onSwitch:u,menuOpen:d,onOpenMenu:h,onCloseMenu:f,refusal:p,onDismissRefusal:g,switchedHere:v,swapped:k,displaced:b,issueExpanded:x,onOpenIssue:N,sortKey:S=null}){const{shown:_,fuller:E}=p7(e.lanes),T=S==="room"?e.lanes.reduce((U,M)=>U&&U.pct>=M.pct?U:M,null):S?e.lanes.find(U=>y7(U)===S)??null:null,R=ii(e,t,n),A=e.active||r,q=e.alias??e.email??`account ${e.num}`,L=e.alias&&e.email?`${e.alias} · ${e.email}`:q,P=e.stale||(R==null?void 0:R.blocksSwitch)===!0,I=E?[..._,E]:_,O=e.fetchedAt?oi(e.fetchedAt,t):null;return a.jsxs("li",{className:`ap-account${e.active?" active":""}`,"aria-current":e.active?"true":void 0,"data-open":A?"":void 0,"data-frozen":P?"":void 0,children:[!e.active&&a.jsx("button",{type:"button",className:"ap-row-open",id:`ap-row-${e.num}`,title:L,"aria-expanded":A,"aria-controls":A?`ap-detail-${e.num}`:void 0,"aria-describedby":[e.alias&&e.email?`ap-email-${e.num}`:null,!A&&!(R!=null&&R.blocksSwitch)?`ap-quota-${e.num}`:null].filter(Boolean).join(" ")||void 0,onClick:()=>s(),children:a.jsxs("span",{className:"vis-hidden",children:[q,", ",A?"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&&!(R!=null&&R.blocksSwitch)&&a.jsx("button",{type:"button",className:"ap-switch",...l(`switch-${e.num}`),onClick:()=>u(e.num,q),"aria-label":`Switch to ${q}`,title:`Switch to ${e.alias??e.email}`,children:o===`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":d,"aria-controls":d?`ap-menu-${e.num}`:void 0,title:"More actions",onClick:()=>d?f():h(e.num),onKeyDown:U=>{U.key!=="ArrowDown"&&U.key!=="ArrowUp"||(U.preventDefault(),h(e.num,U.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"})]})})]}),p&&a.jsxs("div",{className:"ap-failure ap-row-failure",role:"alert",children:[a.jsx("span",{className:"ap-failure-text",title:p.raw||void 0,children:p.text}),a.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>g(),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),e.active&&v&&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."}),k&&(()=>{const U=(b==null?void 0:b.alias)??(b==null?void 0:b.email)??"the account that was there";return a.jsxs("p",{className:"ap-note ap-swap-note",title:`Slot ${k.at} was taken, so the two accounts traded places: ${U} now holds slot ${k.displaced}.`,children:["swapped with slot ",k.displaced]})})(),R&&a.jsxs("div",{className:"ap-issue-line",children:[a.jsxs("button",{type:"button",id:`ap-issue-${e.num}`,className:"ap-issue","data-tone":R.tone,"aria-haspopup":"dialog","aria-expanded":x,"aria-controls":x?"ap-issue-pop":void 0,onClick:()=>N(e.num,`ap-issue-${e.num}`),children:[R.tone==="warn"&&a.jsx(Bb,{}),a.jsx("span",{className:"ap-issue-text",children:R.text})]}),!A&&a.jsx("span",{className:"ap-issue-age",title:"When claude-swap last read this account's usage",children:O??"never collected"})]}),!A&&!(R!=null&&R.blocksSwitch)&&a.jsxs("p",{className:"ap-quota",id:`ap-quota-${e.num}`,children:[I.length?I.map(U=>a.jsxs("span",{className:"ap-q","data-sort-key":U.id===(T==null?void 0:T.id)?"":void 0,children:[a.jsx("span",{className:"ap-q-label",children:U.label})," ",a.jsxs("span",{className:"ap-q-pct","data-level":P?void 0:S7(U.pct),children:[Math.round(U.pct),"%"]})]},U.id)):a.jsx("span",{className:"ap-q-label",children:"no usage recorded yet"}),e.stale&&!R&&a.jsx("span",{className:"ap-q-age","data-never":O?void 0:"",title:"When claude-swap last read this account's usage",children:O??"never collected"})]}),A&&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(U=>a.jsx(_7,{lane:U,nowSec:t,frozen:P,sortedBy:U.id===(T==null?void 0:T.id)},U.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&&!R?" 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 ",oi(e.fetchedAt,t),R!=null&&R.blocksSwitch?"":i7(e.nextAt,t)]}):a.jsx("span",{className:"ap-age ap-stale",title:"claude-swap has not read this account yet",children:"never collected"})})]})]})}function C7({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 T7({canShare:e,canReport:t,onAdd:n,onReport:r,onShareSet:s,onReload:o,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 ${bt} 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:()=>o(),...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 Aa=[{id:"five_hour",label:"5h",long:"5-hour"},{id:"seven_day",label:"7d",long:"7-day"}];function Wj(e){return e.counted?e.pct:e.why==="login"?null:e.estimate}function R7(e){const t=Wj(e.five_hour),n=Wj(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 A7(e,t){const n=Aa.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:oi(e.updatedAt,t),old:!0}}const M7=15*6e4,$7=e=>e.alias??e.email??`account ${e.num}`;function Hj(e,t,n){const r=Aa.find(f=>f.id===t).label,s=(e.lanes??[]).find(f=>f.id===t),o=s&&Number.isFinite(s.pct)?I7(s.pct):null,l=ii(e,n),u=(s==null?void 0:s.resetAt)!=null&&s.resetAt<=n,d=(f,p)=>({counted:!1,why:f,say:p,last:o,estimate:o==null?null:u?0:o,resetAt:u?null:(s==null?void 0:s.resetAt)??null});return l!=null&&l.blocksSwitch?d("login",l.text):o==null?d("none",`No ${r} reading`):e.stale||e.fetchedAt==null||n*1e3-e.fetchedAt>M7?d("stale",e.fetchedAt?`Updated ${oi(e.fetchedAt,n)}`:"Never read"):u?d("reset",`Reset ${oi(s.resetAt*1e3,n)}, not updated`):{counted:!0,pct:o,resetAt:s.resetAt}}const I7=e=>Math.min(100,Math.max(0,e));function O7(e,t){const n=Aa.find(h=>h.id===t);let r=0,s=0,o=0;const l=[];for(const h of e){const f=h.cells[t],p=f.counted?f.pct:f.estimate;p!=null&&(r+=p,o++,f.counted&&s++,f.resetAt!=null&&l.push({at:f.resetAt,name:h.name,pct:p}))}const u=l.reduce((h,f)=>!h||f.at<h.at?f:h,null),d=u&&{...u,more:l.filter(h=>h!==u&&h.at-u.at<60).length};return{id:t,label:n.label,long:n.long,reporting:s,included:o,total:e.length,used:o?r/o:null,nextReset:d}}function E$(e,t){const n=e.map(s=>{const o={five_hour:Hj(s,"five_hour",t),seven_day:Hj(s,"seven_day",t)};return{num:s.num,key:Mr(s),name:$7(s),active:s.active,heldOut:s.disabled===!0,cells:o,status:R7(o),updatedAt:s.fetchedAt??null}}),r=n.filter(s=>s.status==="ready").length;return{rows:n,windows:Aa.map(s=>O7(n,s.id)),roomInBoth:r}}function ju(e,t){return(e==null?void 0:e.key)===t?{key:t,dir:e.dir==="asc"?"desc":"asc"}:{key:t,dir:"asc"}}const L7={ready:0,limited:1,exhausted:2,stale:3};function P7(e){return e.counted?e.pct:e.last}function Vj(e,t){return t==="status"?L7[e.status]:t==="updated"?e.updatedAt==null?null:-e.updatedAt:P7(e.cells[t])}function D7(e,t){if(!t)return[...e];const n=t.dir==="asc"?1:-1,r=new Map(e.map((o,l)=>[o.num,l])),s=(o,l)=>{if(t.key==="account")return n*o.name.localeCompare(l.name,void 0,{sensitivity:"base"});const u=Vj(o,t.key),d=Vj(l,t.key);return u==null||d==null?u==null?d==null?0:1:-1:n*(u-d)};return[...e].sort((o,l)=>s(o,l)||r.get(o.num)-r.get(l.num))}function hd(e){return e>=100?100:Math.min(99,Math.round(e))}function F7(e){const t=hd(e);return{used:t,available:100-t}}function q7(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 C$(e){return e>=90?"hi":e>=70?"mid":void 0}const T$=(e,t,n)=>`${e} ${e===1?t:n}`;function Gj(e){const t=e.more>0?`, and ${T$(e.more,"more account","more accounts")} in the same minute`:"";return`First: ${e.name} (${hd(e.pct)}% used)${t}`}function B7({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:o,available:l}=F7(e.used??0),u=Math.round(Na(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?qd(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":C$(o),"aria-hidden":!0,children:a.jsx("i",{style:{"--left":l/100}})}),d&&e.nextReset&&a.jsxs("p",{className:"ap-report-reset",title:Gj(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:[". ",Gj(e.nextReset)]})]}),s]})}function U7({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"})]}):`${hd(e.last)}%`}),a.jsx("span",{className:"vis-hidden",children:", not counted"})]});const n=e.resetAt!=null?qd(e.resetAt,t):null;return a.jsxs("td",{className:"ap-report-cell",children:[a.jsxs("span",{className:"ap-report-pct","data-level":C$(e.pct),children:[hd(e.pct),"%"]}),n&&a.jsxs("span",{className:"ap-report-in",children:[a.jsx("span",{className:"vis-hidden",children:"resets in "}),n]})]})}const z7={ready:"Ready",limited:"Limited",exhausted:"Exhausted",stale:"Stale"};function W7({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}),z7[e.status]]})})}function H7({row:e,nowSec:t}){const n=A7(e,t);return a.jsx("td",{className:"ap-report-upd","data-old":n.old?"":void 0,children:n.text})}function V7(){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 G7({accounts:e,nowSec:t,held:n,sort:r=null,onSort:s=()=>{}}){const o=E$(e,t),l=o.rows.length,u=Math.round(Na(o.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:u})," of ",T$(l,"Claude account","Claude accounts")," ready"]}),a.jsx("div",{className:"ap-report-sums",children:o.windows.map(d=>a.jsx(B7,{w:d,nowSec:t},d.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",{}),Aa.map(d=>a.jsx("col",{className:"ap-report-col-win"},d.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(dl,{col:"account",label:"Account",sort:r,next:ju,onSort:s}),Aa.map(d=>a.jsx(dl,{col:d.id,label:`${d.label} used`,sort:r,next:ju,onSort:s},d.id)),a.jsx(dl,{col:"status",label:"Status",sort:r,next:ju,onSort:s}),a.jsx(dl,{col:"updated",label:"Updated",className:"ap-report-upd-h",sort:r,next:ju,onSort:s})]})}),a.jsx("tbody",{children:o.rows.map((d,h)=>a.jsxs("tr",{"data-active":d.active?"":void 0,style:{"--row":h},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:d.name,children:d.name}),d.active&&a.jsx("span",{className:"ap-report-current",children:"Current"}),d.heldOut&&a.jsx("span",{className:"ap-report-tag",children:"held out"})]})}),Aa.map(f=>a.jsx(U7,{cell:d.cells[f.id],nowSec:t},f.id)),a.jsx(W7,{row:d}),a.jsx(H7,{row:d,nowSec:t})]},d.num))})]}),a.jsxs("details",{className:"ap-report-how",children:[a.jsxs("summary",{children:[a.jsx(V7,{}),"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 K7({accounts:e,order:t,failed:n,nowSec:r,onClose:s}){const o=w.useRef(null),l=yt(s,{focusRef:o}),[u,d]=w.useState(e??[]);w.useEffect(()=>{e&&e.length>0&&d(e)},[e]);const h=q7(n,!e||e.length===0,u.length>0),[f,p]=w.useState(null),g=_x(u,(f==null?void 0:f.order)??t),v=k=>{const b=E$(_x(u,t),r).rows;p({sort:k,order:D7(b,k).map(x=>x.key)})};return It.createPortal(a.jsx("div",{className:"modal-backdrop",onClick:s,role:"presentation",children:a.jsxs("div",{ref:l,className:"modal ap-report-modal",onClick:k=>k.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:o,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:h??""}),a.jsx(G7,{accounts:g,nowSec:r,held:h,sort:(f==null?void 0:f.sort)??null,onSort:v})]})}),document.body)}const bp=[70,80,85,90,95];function Y7(e){const t=Number(e);return[...Number.isFinite(t)&&t>0&&!bp.includes(t)?[...bp,t]:bp].sort((r,s)=>r-s)}function X7({auto:e,threshold:t,thresholdPick:n,thresholdCtl:r,thresholdSaved:s,thresholdRef:o,thresholdSaveRef:l,proposeThreshold:u,doThreshold:d,pressProps:h,post:f,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:o,"aria-label":"Switch threshold",value:n,...h("threshold"),onChange:g=>u(g.target.value),children:Y7(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",...h("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",...h("enable"),onClick:()=>f({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 Kj=18,Z7=1100,Oo=(e,t)=>{const n=Math.sin(e*12.9898+t*78.233)*43758.5453;return n-Math.floor(n)},J7=Array.from({length:Kj},(e,t)=>{const n=-72+144*t/(Kj-1)+(Oo(t,1)-.5)*9,r=(n-90)*(Math.PI/180),s=(54+32*Math.cos(n*Math.PI/180))*(.74+Oo(t,2)*.52);return{dx:Math.cos(r)*s,dy:Math.sin(r)*s,rot:(t%2?1:-1)*(100+Oo(t,3)*260),delay:Math.round(Oo(t,4)*90),dur:760+Math.round(Oo(t,5)*260),scale:.8+Oo(t,6)*.45,hue:t%4,round:t%3===0}});function Yj({anchor:e}){var s;const[t,n]=w.useState(null),r=typeof window<"u"&&((s=window.matchMedia)==null?void 0:s.call(window,"(prefers-reduced-motion: reduce)").matches);return w.useEffect(()=>{if(r)return;const o=e.current;if(!o)return;const l=o.getBoundingClientRect();n({x:l.left+l.width/2,y:l.top+l.height/2});const u=window.setTimeout(()=>n(null),Z7);return()=>window.clearTimeout(u)},[e,r]),r||!t?null:It.createPortal(a.jsx("div",{className:"confetti",style:{left:`${t.x}px`,top:`${t.y}px`},"aria-hidden":!0,children:J7.map((o,l)=>a.jsx("span",{className:`confetti-bit${o.round?" round":""}`,"data-hue":o.hue,style:{"--dx":`${o.dx.toFixed(1)}px`,"--dy":`${o.dy.toFixed(1)}px`,"--rot":`${o.rot}deg`,"--s":o.scale.toFixed(2),animationDelay:`${o.delay}ms`,animationDuration:`${o.dur}ms, ${o.dur}ms`}},l))}),document.body)}const fd=w.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"})]}));fd.displayName="SuccessMark";const R$=new Set(["awaiting_url","awaiting_code","registering"]);function A$(e){return e!=null&&R$.has(e)}function M$(e){return e!=null&&e!=="done"&&!R$.has(e)}const Q7="the sign-in ended before it finished — the deck restarted, or it was cancelled in another tab",e9="the sign-in did not complete";function t9({state:e,serverError:t,localError:n}){const r=e==="idle";return{title:r?"Sign-in ended":"Sign-in failed",message:n||t||(r?Q7:e9)}}function n9({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 r9({started:e,state:t}){return!e||t==="done"?null:{action:"login-cancel"}}function s9({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":M$(e==null?void 0:e.state)||n&&t&&!r?"ended":r||A$(e==null?void 0:e.state)?"asking":"primer"}const a9="done";function o9(){let e=!1;return{shouldAnnounce(t){return t!==a9?(e=!1,!1):e?!1:(e=!0,!0)}}}function Wb(e,t){return t?$t(e,t):void 0}const i9={already_running:"a sign-in is already in progress",no_url:"the claude CLI did not offer a sign-in link — is it installed?",not_waiting:"that sign-in is no longer waiting for a code",not_prompted:"the CLI has not asked for a code yet",code_rejected:"that code was not accepted — copy it again from the browser",no_verdict:"the claude CLI has not answered — try the code again",empty_code:"paste the code from the browser first",login_failed:"the code was not accepted",no_identity:"signed in, but the CLI still reports nobody logged in",add_failed:"signed in, but claude-swap could not record the account",not_a_share:"that does not look like a shared account — it should start with ccdeck2:",corrupt:"that share is incomplete — copy the whole thing",wrong_version:`that share was made by a newer ${bt}`,expired:"that share has expired — make a new one",import_failed:"claude-swap refused the import",unreadable_export:"claude-swap wrote something this deck could not read — try again, and upgrade it if this repeats",mixed_versions:"claude-swap changed format part-way through — try again",nothing_to_share:"none of those accounts could be exported",too_many:"that is more accounts than one share can carry",not_in_bundle:"that account is not in this share",bad_value:"an alias can only use letters, numbers, spaces, dots, dashes and underscores, up to 64 characters, and cannot start with a dash",bad_email:"that does not look like an email address — it cannot contain spaces or start with a dash"},l9={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"},Hb=`claude-swap could not read the login keychain — start ${bt} from a Terminal window rather than a background service`,c9={unreadable_here:{short:"Keychain locked on this Mac",long:`${Hb}.`},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 pd(e){return e?$t(c9,e)??null:null}const $$={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 Cx(e,t,n){const r=n==null?null:$$[n];if(r)return r;if((e==null?void 0:e.reason)!=="no_cswap"&&/keychain/i.test(Dl(e)))return Hb;const s=Wb(l9,e==null?void 0:e.reason);return s||(e==null?void 0:e.reason)||t}function Dl(e){return((e==null?void 0:e.output)||(e==null?void 0:e.detail)||(e==null?void 0:e.error)||"").trim()}const u9={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"},d9="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 h9(e){return/\bnpx\b/i.test(e)&&/(command not found|not found|not recognized|ENOENT)/i.test(e)}const f9="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",p9="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",m9=e=>/\b(?:ERR_)?MODULE_NOT_FOUND\b|cannot find (?:module|package)/i.test(e),g9=/node_modules[\\/]npm[\\/]bin[\\/]|\bnpm-prefix\.js\b|\bnp[mx][-.][\w.-]*cli\.js\b/i,y9=/[\\/]_npx[\\/]/i,w9=`the copy of ccusage ${bt} installed for itself`;function v9(e){const t=String((e==null?void 0:e.install)??"").replace(/\s+/g," ").trim();return t.length>240?`${t.slice(0,239)}…`:t}function jae(e,t){const n=x9(e,t),r=v9(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 ${il(n)}`:`there is no managed copy of ccusage on this machine, and the npx fallback failed: ${il(n)}`;case"managed":return`${w9} failed to run: ${il(n)}`;case"path":return e.bin?`the ccusage this deck found at ${e.bin} failed to run: ${il(n)}`:`the ccusage this deck found on your PATH failed to run: ${il(n)}`;default:return n}}const il=e=>/^[A-Z][a-z]/.test(e)?e[0].toLowerCase()+e.slice(1):e;function x9(e,t){const n=Dl(e);if(m9(n)){if(y9.test(n))return p9;if(g9.test(n))return f9}if(h9(n))return d9;const r=Wb(u9,e==null?void 0:e.reason);return r||(e==null?void 0:e.reason)||t}function Uo(e,t,n){const r=n==null?null:$$[n];if(r)return r;if(e!=null&&e.detail)return e.detail;if(e!=null&&e.error&&M$(e.state))return e.error;const s=Wb(i9,e==null?void 0:e.reason);return s||(e!=null&&e.error?e.error:(e==null?void 0:e.reason)||t)}function b9(e,t,n){if(n<=0||Od(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 I$(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 k9(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}`,o=[];return n.alias&&r&&o.push(r),r&&(t.get(r.toLowerCase())??0)>1&&o.push(n.org||`slot ${n.num}`),{num:n.num,label:s,sub:o.length?o.join(" · "):null}})}function N9(e,t){return e.filter(n=>!t.includes(n.num)).map(n=>n.num)}function j9(e,t){return e.includes(t)?e.filter(n=>n!==t):[...e,t]}function S9(e){return e.length?{action:"share",accounts:[...e]}:null}function _9(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 Tx(e){return`${e.email}|${e.org??""}`}function E9(e,t,n){return e&&e.map(r=>Tx(r)===t?n:r)}function C9(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 T9(e){const t=e.length;if(!t)return"Nothing to import.";const n=f=>e.filter(p=>p.state===f).length,r=[],s=n("imported");s&&r.push(`${s} of ${t} imported`);const o=n("healed");o&&r.push(`${o} 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 h=[...new Set(e.map(f=>{var p;return(p=pd(f.check))==null?void 0:p.short}).filter(f=>!!f))];return`${r.join(", ")}${h.length?`, ${h.join(", ")}`:""}.`}const R9=1500,Su=[{id:"login",label:"Sign in"},{id:"paste",label:"Paste a share"}],Xj="aa-panel",Zj=e=>`aa-tab-${e}`;async function ll(e){return(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json().catch(()=>null)}function A9({onClose:e,onChanged:t}){const[n,r]=w.useState("login"),[s,o]=w.useState(null),[l,u]=w.useState(""),[d,h]=w.useState(""),[f,p]=w.useState(!1),[g,v]=w.useState(!1),[k,b]=w.useState(null),[x,N]=w.useState(null),S=f||g,[_,E]=w.useState(null),[T,R]=w.useState(null),[A,q]=w.useState(null),L=w.useRef(""),P=w.useRef(!1),I=w.useRef(!1),O=w.useRef(null),U=w.useRef(null),M=w.useRef(null),$=w.useRef(null),B=w.useRef([]),V=w.useRef(!1),H=w.useCallback(()=>{const ae=r9({started:P.current,state:s==null?void 0:s.state});ae&&ll(ae).catch(()=>{}),e()},[e,s==null?void 0:s.state]),F=yt(H,{focusRef:M}),W=w.useCallback(async()=>{if(!or(I.current))return;I.current=!0,p(!0),b(null),P.current=!0;const ae=await ll({action:"login"}).catch(()=>null);if(I.current=!1,p(!1),!(ae!=null&&ae.ok)){b(Uo(ae,"could not start the sign-in"));return}o(ae)},[]);w.useEffect(()=>{if(!A$(s==null?void 0:s.state))return;const ae=window.setInterval(async()=>{try{const re=await fetch("/api/claude-accounts/login");re.ok&&o(await re.json())}catch{}},R9);return()=>window.clearInterval(ae)},[s]);const D=w.useRef(t);D.current=t;const Y=w.useState(o9)[0];w.useEffect(()=>{var ae;(s==null?void 0:s.state)==="awaiting_code"&&((ae=O.current)==null||ae.focus()),Y.shouldAnnounce(s==null?void 0:s.state)&&D.current()},[s==null?void 0:s.state,Y]),w.useEffect(()=>{var ae;n==="paste"&&!V.current&&((ae=U.current)==null||ae.focus()),V.current=!1},[n]);const J=w.useCallback(ae=>{var de;const re=b9(ae,Su.findIndex(me=>me.id===n),Su.length);re.kind!=="pass"&&(ae.preventDefault(),V.current=!0,r(Su[re.index].id),(de=B.current[re.index])==null||de.focus())},[n]),G=w.useCallback(async()=>{var re;if(!or(I.current))return;I.current=!0,p(!0),b(null);const ae=await ll({action:"login-code",code:l}).catch(()=>null);if(I.current=!1,p(!1),!(ae!=null&&ae.ok)){b(Uo(ae,"the code was not accepted")),ae!=null&&ae.state&&o(ae),(re=O.current)==null||re.select();return}u(""),o(ae)},[l,s]),K=w.useCallback(async()=>{if(!or(I.current))return;I.current=!0,v(!0),N(null);const ae=await ll({action:"import",blob:d}).catch(()=>null);if(I.current=!1,v(!1),!(ae!=null&&ae.ok)){N(Uo(ae,"the import failed"));return}L.current=d,h(""),q(null),E(ae.results??[]),t()},[d,t]),X=w.useCallback(async ae=>{const re=Tx(ae);if(!or(I.current)||!L.current)return;I.current=!0,v(!0),R(re),q(null);const de=await ll({action:"import",blob:L.current,force:!0,only:{email:ae.email,org:ae.org??""}}).catch(()=>null);if(I.current=!1,v(!1),R(null),!(de!=null&&de.ok)){q({key:re,text:Uo(de,"that account could not be updated")});return}const me=(de.results??[])[0];me&&E(pe=>E9(pe,re,me)),t()},[t]),Z=(s==null?void 0:s.state)==="done"?s.account:null,ee=n9({restored:s==null?void 0:s.restored,activeAccount:s==null?void 0:s.activeAccount}),se=s9({login:s,started:P.current,loginError:k,loginBusy:f}),ue=t9({state:s==null?void 0:s.state,serverError:s==null?void 0:s.error,localError:k});return It.createPortal(a.jsx("div",{className:"modal-backdrop",onClick:H,role:"presentation",children:a.jsxs("div",{ref:F,className:"modal aa-modal",onClick:ae=>ae.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:Su.map((ae,re)=>a.jsx("button",{type:"button",role:"tab",id:Zj(ae.id),ref:de=>{B.current[re]=de},"aria-selected":n===ae.id,"aria-controls":Xj,tabIndex:n===ae.id?0:-1,className:`aa-tab${n===ae.id?" on":""}`,onClick:()=>{V.current=!1,r(ae.id)},children:ae.label},ae.id))})}),a.jsx("div",{className:"modal-actions",children:a.jsx("button",{type:"button",className:"glyph-btn",onClick:H,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),a.jsx("section",{className:"modal-body aa-body",id:Xj,role:"tabpanel","aria-labelledby":Zj(n),children:n==="login"?se==="done"&&Z?a.jsxs("div",{className:"aa-done",children:[a.jsx(fd,{ref:$}),a.jsx(Yj,{anchor:$}),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:H,children:"Done"})]}):se==="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:ae=>u(ae.target.value),onKeyDown:ae=>{ae.key==="Enter"&&l.trim()&&!S&&G()},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",...Ir(S,!l.trim()||s.state==="registering"),onClick:G,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."})]})]}):se==="ended"?a.jsxs("div",{className:"aa-step",children:[a.jsx("h4",{children:ue.title}),a.jsx("p",{className:"aa-err",children:ue.message}),a.jsx("button",{type:"button",className:"btn",onClick:()=>{P.current=!1,o(null),b(null),W()},children:"Try again"})]}):se==="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:M,className:"btn primary",...Ir(S),onClick:W,children:"Open the sign-in page"})})]}):_?(()=>{const ae=_.filter(de=>de.state==="imported").length,re=_.some(de=>pd(de.check));return a.jsxs("div",{className:"aa-done",children:[!re&&a.jsx(fd,{ref:$}),ae>0&&!re&&a.jsx(Yj,{anchor:$}),a.jsx("h4",{children:T9(_)}),_.length>0&&a.jsx("ul",{className:"aa-results",children:_.map(de=>{const me=Tx(de),pe=pd(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:C9(de.state)}),de.state==="present"&&a.jsx("button",{type:"button",className:"aa-result-fix","aria-busy":T===me,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===me?"updating…":"update anyway"}),pe&&a.jsx("span",{className:"aa-result-err",children:pe.long}),(A==null?void 0:A.key)===me&&a.jsx("span",{className:"aa-result-err",children:A.text})]},me)})}),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:H,children:"Done"}),a.jsx("button",{type:"button",className:"btn",onClick:()=>{L.current="",q(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:U,type:"text",value:d,onChange:ae=>h(ae.target.value),onKeyDown:ae=>{ae.key==="Enter"&&d.trim()&&!S&&K()},placeholder:"ccdeck2:…",spellCheck:!1,autoComplete:"off","aria-label":"Shared account"}),a.jsx("button",{type:"button",className:"btn primary",...Ir(S,!d.trim()),onClick:K,children:g?"importing…":"Import"})]}),x&&a.jsx("p",{className:"aa-err",children:x}),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 M9(e,t){const n=new Set(e),r=e.length?Math.max(...e):0;return[...new Set([...e,r+1])].sort((s,o)=>s-o).map(s=>{const o=s===t?"here":n.has(s)?"swap":"free";return{slot:s,kind:o,label:o==="here"?`slot ${s}`:`slot ${s} · ${o}`}})}function $9(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 I9=64;function O9(e,t){const n=e.trim();return{alias:n,commit:n!==(t??"").trim()}}function L9(e,t,n){return t!=null&&e.some(r=>r.slot===t)?t:n}function P9(e,t,n){var s;const r=((s=e.find(o=>o.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 D9(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 F9({a:e,slots:t,nowSec:n,boundaryId:r,accountMenu:s,busy:o,pressProps:l,rotating:u,onProjects:d,onRotation:h}){const{menu:f,menuError:p,aliasDraft:g,confirmRemove:v,share:k,shareCopied:b,slotDraft:x,dropMenu:N,closeMenu:S,startRename:_,typeAlias:E,doAlias:T,startMove:R,pickSlot:A,doSlot:q,makeShare:L,copyShare:P,pressRemove:I}=s;if(!f)return null;const O=`ap-pop-title-${e.num}`,U=p&&a.jsx("p",{className:"ap-pop-error",role:"alert",title:p.raw||void 0,children:p.text});return a.jsxs(qb,{anchorId:`ap-more-${e.num}`,boundaryId:r,id:`ap-menu-${e.num}`,className:"ap-pop",role:f.view==="menu"?"menu":"dialog",labelledBy:f.view==="menu"?`ap-more-${e.num}`:O,start:f.start,onClose:N,children:[f.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 ${bt}. Anyone who has the text can use the account — treat it as the password. The other deck stops accepting it after 10 minutes; that does not make an escaped copy safe.`,onClick:()=>L(e.num),children:o===`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:()=>h(),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${v===e.num?" armed":""}`,...l(`rm-${e.num}`),"aria-label":v===e.num?"Confirm remove":void 0,title:v===e.num?"This deletes the stored credentials for this account":"Remove this account from claude-swap",onClick:()=>I(e.num),children:o===`rm-${e.num}`?"Removing…":v===e.num?"Confirm":"Remove"}),U]}),f.view==="rename"&&a.jsxs("form",{className:"ap-pop-form",onSubmit:M=>{M.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:M=>E(M.target.value),maxLength:I9,placeholder:"e.g. work",spellCheck:!1,autoComplete:"off",autoFocus:!0,onFocus:M=>M.currentTarget.select()}),U,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:o===`alias-${e.num}`?"…":"Save"})]})]}),f.view==="move"&&(()=>{const M=M9(t,e.num),$=L9(M,x,e.num),B=P9(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($),...l(`move-${e.num}`),onChange:V=>A(Number(V.target.value)),autoFocus:!0,children:M.map(V=>a.jsx("option",{value:V.slot,children:V.label},V.slot))})}),U,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:B.title,onClick:()=>q(e.num,$,B),children:o===`move-${e.num}`?"…":hl(B.label)})]})]})})(),f.view==="share"&&(k==null?void 0:k.num)===e.num&&(()=>{const M=I$(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 ${M.tone}`,children:M.text})]}),U,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($){await L(e.num);return}await P(k.blob)},children:$?"Make a new share":b?"Copied":"Copy"})]})]})})()]})}const q9=6;function B9(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",o=t.strained&&!t.armed?U9(n):null,l=[r];return o!=null&&l.push(`${o}% free`),l.push(t.armed?`auto ${t.threshold??"on"}${t.threshold?"%":""}`:"auto off"),{text:l.join(" · "),tone:s,free:o}}function U9(e){const t=e.map(n=>n.headroom).filter(n=>typeof n=="number");return t.length?Math.max(...t):null}function z9(e){const t=[...e].sort((s,o)=>{if(s.ready!==o.ready)return s.ready?-1:1;if(!s.ready)return s.name.localeCompare(o.name);const l=s.headroom,u=o.headroom;return l==null&&u==null?s.name.localeCompare(o.name):l==null?1:u==null?-1:u-l}),n=t.slice(0,q9),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 Or(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 W9={keychain_unavailable:{short:"Keychain locked on the other Mac",long:`the other Mac could not export it. On that Mac: ${Hb}. The next round brings it.`}};function Rx(e){return e.why?$t(W9,e.why)??pd(e.why):null}const Vb={"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"}},H9={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 Jj(e){var r;const t=V9[e];if(t)return t;const n=(r=/\b(E[A-Z]{3,})\b/.exec(e))==null?void 0:r[1];return n&&H9[n]||e}const V9={"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 Gd(e,t){var f;if(!e)return null;if(e.error&&((f=e.done)!=null&&f.length)){const p=Gd({...e,error:void 0},t),g=` · ${Or(e.at,t)}`;return{...p,text:`${p.text.slice(0,-g.length)}, then ${Jj(e.error)}${g}`,tone:"bad"}}if(e.error)return Vb[e.error]??{text:Jj(e.error),tone:"bad"};const n=e.done??[];if(!n.length)return{text:`all logins fine · ${Or(e.at,t)}`,tone:"idle"};const r=n.filter(p=>p.ok),s=r.length===1?"login":"logins",o=n.map(p=>({d:p,why:Rx(p)})).filter(p=>p.why),l=[...new Set(o.map(p=>p.why.short))],u=l.length?`, ${l.join(", ")}`:"",d=o.length?o.map(p=>`${p.d.email}: ${p.why.long}`).join(" "):void 0,h=Or(e.at,t);return r.length===n.length?{text:`${r.length} ${s} arrived${u} · ${h}`,tone:o.length?"warn":"ok",...d?{hint:d}:{}}:{text:`${r.length} of ${n.length} logins arrived${u} · ${h}`,tone:"bad",...d?{hint:d}:{}}}const G9=9e4;function K9({error:e,host:t,port:n},r,s,o=45317){if(e!=="handshake timed out")return null;const l=(t??"").trim();if(!l)return null;const u=r.filter(h=>h.addr===l&&h.port&&h.at>0&&s-h.at<G9);if(!u.length)return null;const d=[...new Set(u.map(h=>h.port))];if(n!=null&&!d.includes(n)){const h=d.length===1?`port ${d[0]}`:`ports ${d.join(" and ")}`;return`A deck at ${l} is announcing itself on ${h}, 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 ${o} and TCP ${n??d[0]}.`}function Gb(e,t){var n,r;return(n=e.last)!=null&&n.error&&!Vb[e.last.error]?!1:!!((r=e.last)!=null&&r.at&&t-e.last.at<Ax||e.lastSeen!=null&&t-e.lastSeen<Ax)}const Ax=95e3;function Y9(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?O$(p.lastSeen,t):Gb(p,t),o=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,h=0;for(const p of P$(r,g=>L$(g,g.peerFp??g.fp,l).name,g=>g.addr??"")){const g=p.filter(s);if(!g.length){h++;continue}u++,g.every(o)&&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:h===1?"this deck cannot reach the one it is paired with":`this deck cannot reach any of its ${h} decks`,tone:"bad"};const f=u===1?"1 deck ready":`${u} decks ready`;return{text:h?`${f} · ${h} away`:f,tone:"ok"}}function X9(e,t,n){if(n)return"checking…";if(e==null)return"not checked yet";const r=Or(e,t);return r==="now"?"checked just now":`checked ${r}`}function Kb(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 O$(e,t){return e!=null&&t-e<Ax}function Z9(e,t){if(e==null)return{text:"one-way · has not called yet",here:!1};const n=O$(e,t);return{text:n?"online · one-way, it calls in":`one-way · last online ${Or(e,t)}`,here:n}}function Qj(e,t,n){return t?"online":e.lastSeen!=null?`last online ${Or(e.lastSeen,n)}`:e.waiting?"has not called yet":"never reached"}function J9(e,t){if(!e)return[];const n=[],r=new Set,s=(p,g)=>p.name.localeCompare(g.name,void 0,{numeric:!0}),o=e.aliases??{};for(const p of e.pending??[])!(p!=null&&p.fp)||r.has(p.fp)||(r.add(p.fp),n.push(Q9(p,o,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(eV(p,g,t)):l.push(tV(p,g,o,t)))}n.push(...sV(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(nV(p,o,e.pairingMode)));n.push(...d.sort(s));const h=[];for(const p of e.declined??[])!(p!=null&&p.fp)||r.has(p.fp)||(r.add(p.fp),h.push(rV(p,o)));n.push(...h.sort(s));const f=new Map;for(const p of n)f.set(p.name,(f.get(p.name)??0)+1);for(const p of n)(f.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 Q9(e,t,n){const r=Kd(t,e.fp,e.name||e.fp);return{fp:e.fp,...r,addr:e.addr??"",kind:"asks",state:`wants to pair · ${Kb(e.at,n)}`,tone:"wait",here:!0,hint:`${r.name} at ${e.addr}${e.via==="tailscale"?", over Tailscale,":""} is waiting for an answer.`,...Yd(e.via)}}function eV(e,t,n){var o;const r=Gd(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?Mx(r):"trying…",tone:r?r.tone:"idle",here:!1,hint:(o=e.last)!=null&&o.error?`Nothing has answered at ${s} yet — ${e.last.error}.`:`Dialling ${s} until something answers.`,...Yd(e.via)}}function tV(e,t,n,r){var v,k,b,x;const s=Gd(e.last,r),o=Gb(e,r),l=e.addr?`${e.addr}:${e.port}`:"",u=e.waiting?Z9(e.lastSeen,r):null,d=u?u.here:o,h=!u&&s?d?`online · ${Mx(s)}`:`${Mx(s)} · ${Qj(e,d,r)}`:u?u.text:Qj(e,d,r),f=(v=e.last)!=null&&v.error?Vb[e.last.error]:null,p=!u&&d&&!((k=e.last)!=null&&k.error)&&!(((b=e.last)==null?void 0:b.done)??[]).length,g=L$(e,t,n);return{fp:t,...g,addr:e.addr??"",kind:"paired",state:h,quiet:p,tone:f?f.tone==="bad"?"bad":"wait":s?s.tone:d?"ok":"idle",here:u?u.here:o,...Yd(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 ${Or(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}`:""}${(x=e.last)!=null&&x.error?` — ${e.last.error}`:""}${s!=null&&s.hint?` — ${s.hint}`:""}`}}function L$(e,t,n){return e.manual&&!e.met?{name:e.addr?`${e.addr}:${e.port}`:""}:Kd(n,t,e.name||t)}function nV(e,t,n){const r=Kd(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.`,...Yd(e.via)}}function rV(e,t){const n=Kd(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 Kd(e,t,n){const r=t?e[t]:void 0;return r&&r!==n?{name:r,self:n}:{name:n}}function Yd(e){return e==="tailscale"?{via:"tailscale"}:{}}function Mx(e){return e.text.replace(/ · .*$/,"")}function sV(e){return P$(e,t=>t.name,t=>t.addr).map(aV)}function P$(e,t,n){const r=new Map;for(const o of e){const l=r.get(t(o));l?l.push(o):r.set(t(o),[o])}const s=[];for(const o of r.values()){const l=[...new Set(o.map(n).filter(Boolean))];if(l.length>1){for(const u of l)s.push(o.filter(d=>n(d)===u));for(const u of o)n(u)||s.push([u])}else s.push(o)}return s}function aV(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 eS(e,t){return t?e.map(n=>t[n.fp]?{...n,name:t[n.fp]}:n):e}function Fl(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 oV(e,t){var o;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((o=e.reach)!=null&&o.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 iV(e,t){const n=e.filter(f=>f.kind==="asks"),r=e.filter(f=>f.kind!=="asks"),s=r.filter(f=>f.here),o=r.filter(f=>!f.here),l=o.filter(f=>f.tone==="bad").length,u=t||s.length===0,d=u?[...s,...o]:s,h=r.filter(f=>f.kind==="paired").length;return{asks:n,rest:r,live:s,folded:o,troubled:l,showFolded:u,shown:d,paired:h}}function tS(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}))}function lV(e,t,n){if(!(t!=null&&t.enabled)||!(t.shared??[]).includes(e))return!1;const r=(t.peers??[]).filter(s=>s.paired&&Gb(s,n)).map(s=>{var o,l;return(l=(o=s.offers)==null?void 0:o.accounts)==null?void 0:l.find(u=>u.key===e)}).filter(s=>s!=null);return r.length>0&&r.every(s=>!s.alive)}const D$=160,F$=140;function cV(){const[e,t]=w.useState(!1),n=w.useRef(0);return w.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),F$)},holdPeek:()=>window.clearTimeout(n.current),dropPeek:()=>{window.clearTimeout(n.current),t(!1)}}}function uV(e){var t;return((t=e==null?void 0:e.detail)==null?void 0:t.fix)==="give_back"}function nr(e,t){return{text:e,giveBack:uV(t),done:!1}}async function dV(){try{return await(await fetch("/api/prefs/give-back",{method:"POST",headers:{"Content-Type":"application/json"},body:"{}"})).json().catch(()=>null)}catch{return null}}const hV={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 fV(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?hV[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 $x=5e3,q$=6e4;function Et(e,t){if(t==null)return`Could not ${e} — the deck did not answer.`;const n=t.reason?gV(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 pV={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."},mV=new Set(["EACCES","EPERM"]);function gV(e,t){const n=pV[e];if(!n)return;const r=e==="prefs_unreadable"&&t?yV(t):void 0,s=t!=null&&t.code&&t.code!=="BADJSON"?` Error code: ${t.code}.`:"";return(r??n)+s}function yV({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&&!mV.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 Lo(e,t){return(await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json().catch(()=>null)}function wV(e,t){const[n,r]=w.useState(null),[s,o]=w.useState([]),[l,u]=w.useState(null),[d,h]=w.useState(null),f=w.useRef(null),p=w.useCallback(I=>zd(f.current)?(f.current=I,u(I),!0):!1,[]),g=w.useCallback(()=>{f.current=null,x.current&&u(null)},[]),v=I=>{const O=Xs(l,I);return{disabled:O.disabled,"aria-busy":O.busy}},[k,b]=w.useState(()=>Date.now()),x=w.useRef(!0),N=w.useRef($x),S=w.useCallback(async()=>{var I,O;try{const[U,M]=await Promise.all([fetch("/api/lan").then($=>$.json()),fetch("/api/prefs").then($=>$.json())]);if(!x.current)return;U!=null&&U.ok&&r(U),M!=null&&M.ok&&o(Array.isArray((O=(I=M.prefs)==null?void 0:I.lan)==null?void 0:O.manual)?M.prefs.lan.manual:[]),N.current=(U==null?void 0:U.enabled)===!0?$x:q$}catch{}},[]);w.useEffect(()=>{x.current=!0;let I=0;const O=async()=>{b(Date.now()),await S(),x.current&&(I=window.setTimeout(O,N.current))};return O(),()=>{x.current=!1,window.clearTimeout(I)}},[S]);const _=w.useCallback(async()=>{const I=(n==null?void 0:n.enabled)===!0;if(p("switch"))try{const O=await Lo("/api/prefs",{lan:{enabled:!I}});if(!x.current)return;O!=null&&O.ok?(h(null),I||t()):h(nr(Et(I?"turn this off":"turn this on",O),O)),await S()}catch{x.current&&h(nr(Et(I?"turn this off":"turn this on",null)))}finally{g()}},[n==null?void 0:n.enabled,S,p,g,t]),E=w.useCallback(async(I,O,U)=>{if(!p(`${I}:${O}`))return null;let M=null;try{const $=await Lo("/api/lan/peer",{action:I,fp:O});if(!x.current)return null;$!=null&&$.ok?(r($),h(null)):(M=Et(U,$),h(nr(M,$))),await S()}catch{M=Et(U,null),x.current&&h(nr(M))}finally{g()}return M},[S,p,g]),T=w.useCallback(async I=>{if(!p(`drop:${I}`))return null;let O=null;try{const U=await Lo("/api/prefs",{lan:{manual:s.filter(M=>M!==I)}});if(!x.current)return null;U!=null&&U.ok?(h(null),e()):(O=Et("stop dialling that address",U),h(nr(O,U))),await S()}catch{O=Et("stop dialling that address",null),x.current&&h(nr(O))}finally{g()}return O},[s,S,e,p,g]),R=w.useCallback(async(I,O)=>{if(!p(`alias:${I}`))return"Something else is still being saved. Try again in a moment.";try{const U=await Lo("/api/lan/peer",{action:"alias",fp:I,name:O});return x.current?U!=null&&U.ok?(r(U),null):Et("rename that deck",U):null}catch{return Et("rename that deck",null)}finally{g()}},[p,g]),A=w.useCallback(async I=>{if(!p(`check:${I}`))return null;try{const O=await Lo("/api/lan/sync",{fp:I});return x.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.":Et("check that deck",O):null}catch{return Et("check that deck",null)}finally{g()}},[p,g,e]),q=w.useCallback(async()=>{if(p("check"))try{const I=await Lo("/api/lan/sync",{});if(!x.current)return;I!=null&&I.ok?(r(I),h(null)):h(nr(Et("check the other decks",I),I)),e()}catch{x.current&&h(nr(Et("check the other decks",null)))}finally{g()}},[p,g,e]);return{status:n,manual:s,now:k,busy:l,failure:d,dismissFailure:()=>h(null),answerGiveBack:I=>{h(I),I.done&&(S(),e())},pressProps:v,load:S,toggle:_,answer:E,dropAddress:T,rename:R,checkOne:A,checkNow:q}}function vV(e){const[t,n]=w.useState(null),r=w.useRef(0);return w.useEffect(()=>{if(t==null)return;const o=window.setTimeout(()=>n(null),4e3);return()=>window.clearTimeout(o)},[t]),{armed:t,pressUnpair:o=>{const l=Date.now(),u=Ol({armedFor:t,target:o.fp,armedAt:r.current,now:l,gapMs:Il});if(u==="arm"){n(o.fp),r.current=l;return}u!=="ignore"&&(n(null),e("unpair",o.fp,"unpair that deck"))}}}function B$({title:e,steps:t,finish:n,aside:r,onClose:s}){const o=w.useRef(null),l=yt(s,{focusRef:o}),[u,d]=w.useState(0),h=u===t.length-1,f=t[u],p=k=>d(Math.max(0,Math.min(t.length-1,k)));w.useEffect(()=>{var k,b;hs(((k=document.activeElement)==null?void 0:k.tagName)??null)&&((b=o.current)==null||b.focus())},[u]);const g=k=>{k.key!=="ArrowRight"&&k.key!=="ArrowLeft"||(k.preventDefault(),k.stopPropagation(),p(k.key==="ArrowRight"?u+1:u-1))},v=()=>{if(!h){p(u+1);return}n?n.act():s()};return It.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:f.art},u),a.jsx("p",{className:"guide-line","aria-live":"polite",children:f.line}),a.jsx("p",{className:"guide-tip",children:f.tip??""}),a.jsxs("div",{className:"guide-foot",children:[a.jsx("div",{className:"guide-dots",children:t.map((k,b)=>a.jsx("button",{type:"button",className:"glyph-btn guide-dot","aria-label":`Step ${b+1} of ${t.length}`,"aria-current":b===u?"step":void 0,onClick:()=>p(b)},b))}),h&&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:o,type:"button",className:"btn primary",onClick:v,children:h?(n==null?void 0:n.label)??"Done":"Next"})]})]})]})}),document.body)}const Ix={ok:"ga-ok",warn:"ga-warn",accent:"ga-accent",flight:"ga-flight"};function qn({children:e}){return a.jsx("svg",{className:"guide-art",viewBox:"0 0 440 200","aria-hidden":!0,focusable:"false",children:e})}function Fn({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 lr({x:e,y:t,email:n,state:r,tone:s,bars:o}){return a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:e+3,cy:t-4,r:3,className:Ix[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 ${Ix[s]}`,children:r}),o==null?void 0:o.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 _u({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 nS({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 rS({x:e,y:t,d:n}){return a.jsx("path",{d:n,transform:`translate(${e} ${t})`,className:"ga-glyph"})}function Yb({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 Xb(){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 zo({x:e,y:t,w:n,title:r,sub:s,tone:o}){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:Ix[o]}),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 Xo({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 md({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 xV(){return a.jsxs(qn,{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 bV(){return a.jsxs(qn,{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(zo,{x:20,y:80,w:116,title:"main",sub:"Opus 5 · 9 tools",tone:"accent"}),a.jsx(zo,{x:196,y:18,w:112,title:"explore",sub:"Haiku · 14 tools",tone:"flight"}),a.jsx(zo,{x:196,y:80,w:112,title:"tests",sub:"Sonnet · 6 tools",tone:"flight"}),a.jsx(zo,{x:196,y:142,w:112,title:"review",sub:"done · 38s",tone:"ok"}),a.jsx(Xo,{x:326,y:28,label:"Read"}),a.jsx(Xo,{x:380,y:28,label:"Grep",live:!0}),a.jsx(Xo,{x:326,y:90,label:"Bash",live:!0})]})}function sS({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 kV(){return a.jsxs(qn,{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(sS,{x:216,y:80,label:"5-hour window",pct:24,note:"resets in 53m"}),a.jsx(sS,{x:216,y:124,label:"7-day window",pct:61,note:"resets in 4d"})]})}function NV(){return a.jsxs(qn,{children:[a.jsx("rect",{x:14,y:40,width:172,height:120,rx:10,className:"ga-canvas"}),a.jsx(zo,{x:30,y:80,w:140,title:"tests",sub:"Sonnet 5 · 6 tools",tone:"flight"}),a.jsx(Yb,{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(Fn,{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(Xo,{x:214,y:122,label:"Read"}),a.jsx(Xo,{x:266,y:122,label:"Edit"}),a.jsx(Xo,{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 jV(){const e=[18,24,28,14,22,26,30,16,24,28,20,26];return a.jsxs(qn,{children:[a.jsx(Fn,{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 SV(){return a.jsxs(qn,{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(zo,{x:278,y:80,w:120,title:"my-project",sub:"Opus 5 · live",tone:"accent"})})]})}function _V(){return a.jsxs(qn,{children:[a.jsx(Fn,{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(rS,{x:196,y:33,d:"M7 2.2v9.6M2.2 7h9.6"}),a.jsx(rS,{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(lr,{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(lr,{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(Yb,{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(Fn,{x:282,y:62,w:144,h:64,label:"ANOTHER MACHINE"}),a.jsx("g",{className:"ga-pop",children:a.jsx(lr,{x:296,y:92,email:"work@team.dev",state:"shared here",tone:"ok"})})]})}function EV(){return a.jsxs(qn,{children:[a.jsx(Fn,{x:14,label:"THIS MACHINE"}),a.jsx(md,{x:28,y:60}),a.jsx("g",{className:"ga-swap-out",children:a.jsx(lr,{x:28,y:98,email:"work@team.dev",state:"login expired",tone:"warn"})}),a.jsx("g",{className:"ga-swap-in",children:a.jsx(lr,{x:28,y:98,email:"work@team.dev",state:"working again",tone:"ok",bars:[24,61]})}),a.jsx(Fn,{x:250,label:"ANOTHER MACHINE"}),a.jsx(md,{x:264,y:60}),a.jsx(lr,{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(Xb,{})})]})}const CV=[{art:a.jsx(xV,{}),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(bV,{}),line:"Every agent and subagent is a node. Tool calls light up as they run."},{art:a.jsx(NV,{}),line:"Double-click any node: its prompt, every tool call, tokens and timing."},{art:a.jsx(kV,{}),line:"What each session costs, and how much quota is left."},{art:a.jsx(jV,{}),line:"Cores, memory and heat while the agents run, and what is hogging them."},{art:a.jsx(_V,{}),line:"Several Claude accounts: switch, add one, share one to another machine."},{art:a.jsx(EV,{}),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(SV,{}),line:"Run claude or codex in any folder. It shows up here on its own."}];function TV(){return a.jsxs(qn,{children:[a.jsx(Fn,{x:14,label:"THIS MACHINE"}),a.jsx(lr,{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(Fn,{x:250,label:"ANOTHER MACHINE"}),a.jsx(lr,{x:264,y:64,email:"work@team.dev",state:"working",tone:"ok",bars:[24,61]})]})}function RV(){return a.jsxs(qn,{children:[a.jsx(Fn,{x:14,label:"THIS MACHINE"}),a.jsx(md,{x:28,y:60}),a.jsx(_u,{x:28,y:92,name:"Ana's MacBook"}),a.jsx(_u,{x:28,y:114,name:"Dorin's PC"}),a.jsx(Fn,{x:250,label:"ANOTHER MACHINE"}),a.jsx(md,{x:264,y:60}),a.jsx(_u,{x:264,y:92,name:"Your MacBook"}),a.jsx(_u,{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 AV(){return a.jsxs(qn,{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(nS,{x:106,y:88,on:!0}),a.jsx("text",{x:126,y:98,className:"ga-t ga-mono",children:"work@team.dev"}),a.jsx(nS,{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(Yb,{x:115,y:97})]})}function MV(){return a.jsxs(qn,{children:[a.jsx(Fn,{x:14,label:"THIS MACHINE"}),a.jsx("g",{className:"ga-swap-out",children:a.jsx(lr,{x:28,y:64,email:"work@team.dev",state:"login expired",tone:"warn"})}),a.jsx("g",{className:"ga-swap-in",children:a.jsx(lr,{x:28,y:64,email:"work@team.dev",state:"working again",tone:"ok",bars:[24,61]})}),a.jsx(Fn,{x:250,label:"ANOTHER MACHINE"}),a.jsx(lr,{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(Xb,{})})]})}const $V=[{art:a.jsx(TV,{}),line:"A login can expire on one machine while it still works on another."},{art:a.jsx(RV,{}),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(AV,{}),line:"Tick which logins this machine may hand out. Nothing is shared until you do."},{art:a.jsx(MV,{}),line:"An expired login is copied from a paired machine within a minute."}];function IV(){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(Xb,{})})]})}const OV={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."},LV=1600;function z$({reach:e,where:t}){const[n,r]=w.useState(!1),s=w.useRef(!0);w.useEffect(()=>()=>{s.current=!1},[]);const o=(e==null?void 0:e.steps)??[],l=w.useCallback(async()=>{await Ba(o.join(`
|
|
82
|
+
`))&&s.current&&(r(!0),window.setTimeout(()=>{s.current&&r(!1)},LV))},[o]);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:OV[t]}),o.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:o.join(`
|
|
83
|
+
`)})}),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 PV(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 DV(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 kp(e,t){return(await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json().catch(()=>null)}const FV={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."},qV={not_running:"This deck is not on the network yet. Turn Local network on, then make one."};function aS(e,t,n){return(t==null?void 0:t.reason)&&e[t.reason]||Et(n,t)}function BV({status:e,manual:t,startWith:n,onClose:r,onChanged:s}){const o=w.useRef(null),l=w.useRef(null),u=w.useRef(null),d=w.useRef(null),h=e.pairingMode==="invite",f=yt(r,{focusRef:h?l:o}),[p,g]=w.useState(""),[v,k]=w.useState(""),[b,x]=w.useState(null),[N,S]=w.useState(null),[_,E]=w.useState(null),[T,R]=w.useState(null),[A,q]=w.useState(()=>Date.now());w.useEffect(()=>{const K=window.setInterval(()=>q(Date.now()),1e3);return()=>window.clearInterval(K)},[]);const L=w.useRef(!0);w.useEffect(()=>()=>{L.current=!1},[]);const P=w.useRef(null),I=w.useRef(null),O=w.useCallback(K=>zd(P.current)?(P.current=K,E(K),!0):!1,[]),U=w.useCallback(()=>{P.current=null,L.current&&E(null)},[]),M=K=>{const X=Xs(_,K);return{disabled:X.disabled,"aria-busy":X.busy}},$=K=>(b==null?void 0:b.field)===K?{"aria-invalid":!0,"aria-describedby":"lan-add-failure"}:{},B=K=>x(X=>X&&X.field===K?null:X),V=w.useCallback(async()=>{if(h)return;const K=PV(p);if(!K){x({text:UV(p),field:"addr"});return}const X=`${K.addr}:${K.port}`,Z=e.peers.find(ee=>ee.addr===K.addr&&ee.port===K.port&&ee.paired);if(Z){x({text:`Already paired with ${Z.name} at that address.`,field:"addr"});return}if(t.includes(X)){x({text:"This deck already calls that address.",field:"addr"});return}if(O("add"))try{const ee=await kp("/api/prefs",{lan:{manual:[...t,X]}});if(!L.current)return;ee!=null&&ee.ok?(x(null),g(""),s(),r()):x({text:Et("add that address",ee),field:"addr"})}catch{L.current&&x({text:Et("add that address",null),field:"addr"})}finally{U()}},[p,h,t,e.peers,s,r,O,U]),H=w.useCallback(async K=>{if(!O(`invite:${K}`))return;const X=K==="make"?"make an invite":"cancel that invite";try{const Z=await kp("/api/lan/invite",{action:K});if(!L.current)return;Z!=null&&Z.ok?(I.current=K,x(null),S(null),s()):x({text:aS(qV,Z,X)})}catch{L.current&&x({text:Et(X,null)})}finally{U()}},[s,O,U]),F=w.useCallback(async()=>{const K=v.trim();if(!(!K||!O("join"))){R(null);try{const X=await kp("/api/lan/invite",{action:"join",token:K});if(!L.current)return;X!=null&&X.ok?(k(""),x(null),s(),r()):(X==null?void 0:X.reason)==="unreachable"&&Array.isArray(X.tried)&&X.tried.length?(R(X.tried),x(null)):(R(null),x({text:aS(FV,X,"use that invite"),field:"join"}))}catch{L.current&&x({text:Et("use that invite",null),field:"join"})}finally{U()}}},[v,s,r,O,U]),W=w.useCallback(async(K,X)=>{try{await navigator.clipboard.writeText(K),S(X),window.setTimeout(()=>{L.current&&S(Z=>Z===X?null:Z)},1600)}catch{x({text:"Could not copy it — select the text and copy it by hand."})}},[]),D=e.invite&&e.invite.expiresAt>A?e.invite:null,Y=w.useRef(!1);w.useEffect(()=>{n!=="invite"||Y.current||D||(Y.current=!0,H("make"))},[n,D,H]);const J=w.useRef(!1);w.useEffect(()=>{var K;n!=="invite"||J.current||!D||(J.current=!0,(K=u.current)==null||K.focus())},[n,D]),w.useEffect(()=>{var X,Z;const K=I.current;!K||K==="make"!=!!D||(I.current=null,hs(((X=document.activeElement)==null?void 0:X.tagName)??null)&&((Z=(K==="make"?u:d).current)==null||Z.focus()))},[D]);const G=e.port!=null?(e.addrs??[]).map(K=>`${K}:${e.port}`):[];return It.createPortal(a.jsx("div",{className:"modal-backdrop",onClick:r,role:"presentation",children:a.jsxs("div",{ref:f,className:"modal lan-add",onClick:K=>K.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:[b&&a.jsxs("div",{className:"ap-failure",role:"alert",children:[a.jsx("span",{id:"lan-add-failure",className:"ap-failure-text",children:b.text}),a.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>x(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),a.jsx(z$,{reach:e.reach,where:"dialog"}),h&&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."})}),!h&&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:o,className:"ap-manage-input ap-lan-input","aria-label":"Another deck's address",value:p,placeholder:"192.168.1.5:54340",spellCheck:!1,...$("addr"),onChange:K=>{g(K.target.value),B("addr")},onKeyDown:K=>{K.key==="Enter"&&V()}}),p.trim()!==""&&a.jsx("button",{type:"button",className:"ap-manage-btn",...M("add"),onClick:()=>void V(),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&&G.length>0&&a.jsxs("p",{className:"lan-note",children:["They type this deck’s own address into the same field on theirs:"," ",G.map((K,X)=>a.jsxs("span",{children:[X>0&&" or ",a.jsx("code",{className:"ap-lan-code",children:K})]},K)),a.jsx("button",{type:"button",className:"ap-lan-word lan-copy",...M("copy:mine"),onClick:()=>void W(G.join(" "),"mine"),title:"Copy this deck's address, to send to whoever is adding it",children:N==="mine"?"copied":"copy"})]})]}),a.jsxs("div",{className:"modal-section",children:[a.jsxs("h3",{className:"lan-h",children:["With an invite",!D&&a.jsx("button",{type:"button",className:"ap-lan-word lan-h-act",ref:d,...M("invite:make"),onClick:()=>void H("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:v,placeholder:"paste one you were sent",spellCheck:!1,...$("join"),onChange:K=>{k(K.target.value),R(null),B("join")},onKeyDown:K=>{K.key==="Enter"&&F()}}),v.trim()!==""&&a.jsx("button",{type:"button",className:"ap-manage-btn",...M("join"),onClick:()=>void F(),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(K=>a.jsxs("span",{className:"ap-lan-tried-row",children:[a.jsx("code",{className:"ap-lan-code",children:K.addr}),a.jsx("span",{className:"ap-lan-bad",children:K.why})]},K.addr))]}),D&&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:[DV(D.expiresAt,A)," left"]})]}),a.jsx("code",{className:"ap-lan-token",children:D.token}),a.jsxs("div",{className:"ap-lan-acts",children:[a.jsx("button",{type:"button",className:"ap-manage-btn",ref:u,...M("copy:invite"),"aria-label":N==="invite"?"Invite copied":"Copy invite","aria-describedby":"lan-invite-left",onClick:()=>void W(D.token,"invite"),title:"Copy it, and send it however you already talk to them",children:N==="invite"?"copied":"copy"}),a.jsx("button",{type:"button",className:"ap-manage-btn",...M("invite:withdraw"),onClick:()=>void H("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 UV(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 zV({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 WV({rows:e,pairingMode:t,armed:n,pressProps:r,answer:s,dropAddress:o,onUnpair:l,onOpenPeer:u,onInvite:d}){return a.jsx("ul",{className:"ap-lan-here",children:e.map((h,f)=>a.jsxs("li",{className:"ap-lan-who","data-tone":h.tone,children:[a.jsx("i",{className:h.here?"ap-pulse":"ap-dot","aria-hidden":!0}),a.jsxs("span",{className:"ap-lan-who-name","aria-hidden":!0,children:[h.name,h.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-${f}`,onClick:()=>u(h.fp),children:a.jsxs("span",{className:"vis-hidden",children:[h.name,h.via==="tailscale"?", over Tailscale":"",", details"]})}),a.jsx("span",{id:`lan-who-state-${f}`,className:h.quiet?"vis-hidden":"ap-lan-who-when",children:h.state}),h.kind==="nearby"&&t!=="invite"&&a.jsx("button",{type:"button",className:"ap-manage-btn ap-lan-do",...r(`accept:${h.fp}`),onClick:()=>void s("accept",h.fp,"reach that deck"),"aria-label":`Ask ${h.name} to pair`,title:`Send ${h.name} a request. Somebody at that machine has to accept it before anything is shared. Its fingerprint is ${h.fp}.`,children:"ask"}),(h.kind==="nearby"||h.kind==="declined")&&t==="invite"&&a.jsx("button",{type:"button",className:"ap-manage-btn ap-lan-do","aria-haspopup":"dialog",onClick:d,"aria-label":`Invite ${h.name} to pair`,title:`This deck pairs only by invite. Make one and send it to whoever is at ${h.name}.`,children:"invite"}),h.kind==="paired"&&a.jsx("button",{type:"button",className:`ap-manage-btn ap-lan-do danger${n===h.fp?" armed":""}`,...r(`unpair:${h.fp}`),onClick:()=>l(h),"aria-label":n===h.fp?`Confirm unpairing ${h.name}`:`Unpair ${h.name}`,title:n===h.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===h.fp?"confirm":"unpair"}),h.kind==="dialling"&&a.jsx("button",{type:"button",className:"ap-manage-btn ap-lan-do",...r(`drop:${h.fp}`),onClick:()=>void o(h.fp),"aria-label":`Stop dialling ${h.name}`,title:"Stop trying this address. Nothing was ever paired here.",children:"stop"}),h.kind==="declined"&&t!=="invite"&&a.jsx("button",{type:"button",className:"ap-manage-btn ap-lan-do",...r(`allow:${h.fp}`),onClick:()=>void s("allow",h.fp,"let that deck ask again"),"aria-label":`Let ${h.name} ask again`,title:"Take the no back. That deck is still trying, so the request comes round again on its own.",children:"allow"})]},`${h.kind}:${h.fp}`))})}function HV(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 VV({on:e,status:t}){return a.jsxs(a.Fragment,{children:[e&&a.jsx(z$,{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:HV(t)})]})}const oS=["online","offline","loose"],GV={online:0,offline:1,loose:2};function KV(e){return e.kind==="declined"?null:e.kind==="paired"?e.here?"online":"offline":"loose"}const YV=76,XV=62,gd=96,ZV={1:[.62],2:[.58,1],3:[.42,.72,1]},JV=.2,QV=.16,eG=.05,tG=20,nG=17,Eu=7,rG=30,sG=116,aG=6.6,oG=6,iG=e=>Zb(e,null),lG=1.5,cG=80,uG=.45,iS=40,dG=64,hG=150,lS=.3,cS=84,fG=1.3,uS=.16;function Ox(e,t){return Math.PI*(3*(e+t)-Math.sqrt((3*e+t)*(e+3*t)))}function W$(e,t){return t<-Math.abs(e)*.6?"top":"bottom"}function pG(e,t){if(e<=2)return t%2===0?0:90;const n=360/e;return-90+(t%2===0?0:n/2)}function mG(e){return e.map((t,n)=>({...t,i:n})).sort((t,n)=>oS.indexOf(t.tier)-oS.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 dS(e,t){let n=2166136261^t;for(let r=0;r<e.length;r++)n^=e.charCodeAt(r),n=Math.imul(n,16777619);return(n>>>0)%2e4/1e4-1}function gG(e,t,n){const r=[...ZV[e.length]??[]];for(let s=0;s<r.length;s++){const o=e[s];if(o<2)continue;const l=Ox(t*r[s],n*r[s])/o;if(!(l>0)||l>=gd)continue;const u=s+1<r.length?r[s+1]-JV:1;r[s]=Math.max(r[s],Math.min(u,r[s]*(gd/l)*1.02))}return r}const Po=(e,t)=>e.x0<t.x1&&t.x0<e.x1&&e.y0<t.y1&&t.y0<e.y1,Np={h:16,ch:6.1,maxW:100};function yG(e){const t=e?Math.max(80,e.length*7.2+16):128;return{x0:-t/2,y0:32,x1:t/2,y1:66}}function wG(e,t,n,r,s,o){const l=t==="loose"?nG:tG,u=!s||e.kind==="asks",d=u?rG:Np.h,h=s?Np.ch:aG,f=u?o.length:0,p=Math.min(s?Np.maxW:sG,Math.max(2*l,V$(e).length*h,f*oG)),g={x0:n-l,y0:r-l,x1:n+l,y1:r+l},v=W$(n,r)==="top"?{x0:n-p/2,y0:r-l-Eu-d,x1:n+p/2,y1:r-l-Eu}:{x0:n-p/2,y0:r+l+Eu,x1:n+p/2,y1:r+l+Eu+d};return[g,v]}const H$=e=>{const t=e.theta*Math.PI/180;return[Math.cos(t)*e.ring.rx*e.reach,Math.sin(t)*e.ring.ry*e.reach]},Cu=(e,t)=>((e-t)%360+540)%360-180;function hS(e,t,n){const r=new Map;for(const h of e)r.has(h.ring)||r.set(h.ring,[]),r.get(h.ring).push(h);const s=()=>e.map(h=>{const[f,p]=H$(h);return wG(h.row,h.tier,f,p,t,h.caption)}),o=(h,f)=>{if(h.count<=2)return!1;const p=h.theta+f*lG,g=r.get(h.ring),v=360/h.count*uG,k=g[(h.index+1)%h.count],b=g[(h.index-1+h.count)%h.count];return!(f>0?Cu(k.theta,p)>=v:Cu(p,b.theta)>=v)||p<h.lo||p>h.hi?!1:(h.theta=p,!0)},l=([h,f],[p,g])=>Po(f,p)||Po(g,h)||Po(f,g)||Po(h,p),u=([h,f])=>Po(h,n)||Po(f,n);for(let h=0;h<cG;h++){const f=s();let p=!1;for(let g=0;g<e.length;g++){u(f[g])&&(p=o(e[g],Cu(e[g].theta,90)>=0?1:-1)||p);for(let v=g+1;v<e.length;v++){if(!l(f[g],f[v]))continue;const k=e[g],b=e[v],x=b.ring.ring>k.ring.ring||b.ring===k.ring&&v>g?b:k,N=x===b?k:b,S=Cu(x.theta,N.theta)>=0?1:-1;p=o(x,S)||o(N,-S)||p}}if(!p)break}const d=s();for(let h=0;h<d.length;h++){if(u(d[h]))return!1;for(let f=h+1;f<d.length;f++)if(l(d[h],d[f]))return!1}return!0}const vG={online:0,offline:1,loose:1};function xG(e,t,n,r="",s=iG){const o=fS(e,t,n,r,GV,s);if(o.clear||o.layout.rings.length<3)return o.layout;const l=fS(e,t,n,r,vG,s);return l.clear?{...l.layout,folded:!0}:o.layout}function fS(e,t,n,r,s,o){const l=new Map;for(const P of e){const I=KV(P);if(!I)continue;const O=s[I];l.has(O)||l.set(O,[]),l.get(O).push({row:P,tier:I})}const u=[...l.keys()].sort((P,I)=>P-I),d=Math.max(0,t/2-YV),h=Math.max(0,n/2-XV),f=gG(u.map(P=>l.get(P).length),d,h),p=u.map((P,I)=>({ring:P,rx:d*f[I],ry:h*f[I],count:l.get(P).length})),g=p.reduce((P,I)=>P+I.count,0),v=P=>P.row.via==="tailscale",k=[...l.values()].flat().filter(v).length,b=Math.max(0,...p.map(P=>{const I=l.get(P.ring).filter(v).length,O=Ox(P.rx,P.ry);return I>0&&O>0?I*gd*fG/O*360:0})),x=k>0&&k<g?Math.min(hG,Math.max(dG,k/g*360,b)):0,N=iS-x/2,S=iS+x/2,_=[];let E=!1;p.forEach((P,I)=>{const O=mG(l.get(P.ring)),U=O.length,M=U>1&&Ox(P.rx,P.ry)/U<gd;M&&(E=!0);const $=I===p.length-1,B=$?-uS*(f[I]-(f[I-1]??0)):uS*(f[I+1]-f[I]),V=x>0?[{members:O.filter(F=>F.row.via!=="tailscale"),from:S,width:360-x},{members:O.filter(F=>F.row.via==="tailscale"),from:N+360,width:x}]:[{members:O,from:null,width:360}];let H=0;for(const F of V){const W=F.members.length;if(W===0)continue;const D=F.width/W,Y=W>2;F.members.forEach(({row:J,tier:G},K)=>{const X=tr(J),Z=F.from==null?pG(W,I)+D*K:F.from+D*(K+.5),ee=Y?dS(X,1)*QV*D:0,se=M&&H%2===1?1+B/f[I]:1,ue=Y?dS(X,2)*eG:0,ae=D*.3;_.push({row:J,tier:G,ring:P,index:H,count:U,theta:Z+ee,reach:se*(1+($?-Math.abs(ue):ue)),lo:F.from==null?-1/0:F.from+ae,hi:F.from==null?1/0:F.from+F.width-ae,caption:o(J)}),H++})}});const T=yG(r);let R=hS(_,E,T);!R&&!E&&(E=!0,R=hS(_,!0,T));const A=_.map((P,I)=>{const[O,U]=H$(P);return{row:P.row,tier:P.tier,ring:P.ring.ring,x:O,y:U,angle:bG(Math.atan2(U,O)*180/Math.PI),dist:Math.hypot(O,U),side:W$(O,U),order:I}}),q=p.reduce((P,I,O)=>l.get(I.ring).some(v)?Math.max(P,f[O]):P,0),L=x>0?{from:N,to:S,inner:{rx:d*lS,ry:h*lS},outer:{rx:Math.min(t/2-8,d*q+cS),ry:Math.min(n/2-8,h*q+cS)},count:k}:null;return{layout:{nodes:A,rings:p,zone:L,dense:E},clear:R}}function bG(e){return(e%360+360)%360}function kG(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"),oneWay:t(n=>n.kind==="paired"&&!n.here&&n.state.startsWith("one-way"))}}function NG(e){const t=[];return e.asks&&t.push(e.asks===1?"1 deck wants to pair":`${e.asks} decks want to pair`),e.paired===0?t.push("no paired decks yet"):e.paired===1?t.push(e.online?"1 paired deck, online":"1 paired deck, away"):e.online===e.paired?t.push(`${e.paired} paired decks, all online`):t.push(`${e.online} of ${e.paired} paired decks online`),e.nearby&&t.push(`${e.nearby} nearby, not paired`),e.dialling&&t.push(`${e.dialling} still dialling`),t.join(" · ")}function Zb(e,t){switch(e.kind){case"asks":return"wants to pair";case"nearby":return e.state;case"dialling":return G$(e)?`${e.name.slice(e.addr.length)} · dialling`:"dialling";case"declined":return"declined";case"paired":{if(e.here)return t?jG(t):"online";const n=Y$(e);return n?n==="now"?"away · just now":`away · ${n}`:e.state.startsWith("one-way")?"has not called yet":"away"}}}function V$(e){return G$(e)?e.addr:e.name}function G$(e){return e.kind==="dialling"&&!!e.addr&&e.name.startsWith(`${e.addr}:`)}function K$(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=Y$(e),n=t?t==="now"?"away · last online just now":`away · last online ${t}`:e.state.startsWith("one-way")?e.state:"away";return e.via==="tailscale"?`${n}, over Tailscale`:n}function Y$(e){var t;return((t=/last online (.+)$/.exec(e.state))==null?void 0:t[1])??null}function jG(e){return e.trim().split(/\s+/).slice(0,2).join(" ")}function SG(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 tr(e){let t=e.fp;for(const n of e.twins??[])n.fp<t&&(t=n.fp);return t}function _G(e,t){if(e==null)return t;const n=((t-e)%360+540)%360-180;return e+n}function EG(e){return e.asks?e.asks===1?"1 deck wants to pair. Answer it in the Local network list, behind this map.":`${e.asks} decks want to pair. Answer them in the Local network list, behind this map.`:e.oneWay?`${e.oneWay} away deck${e.oneWay===1?" only calls":"s only call"} in, and this deck has no address to call ${e.oneWay===1?"it":"them"} on. Add ${e.oneWay===1?"its address":"their addresses"} through Add a deck to reach ${e.oneWay===1?"it":"them"} both ways.`:e.dialling?e.dialling===1?"1 address has never answered. Open it to stop dialling it.":`${e.dialling} addresses have never answered. Open one to stop dialling it.`:e.nearby?e.nearby===1?"1 deck nearby is not paired. Open it to ask to pair.":`${e.nearby} decks nearby are not paired. Open one to ask to pair.`:null}function CG(e,t){switch(e.kind){case"asks":return"Waiting for your answer, in the Local network list behind this map.";case"dialling":return"Nothing has answered here yet. Its dialog can stop dialling it.";case"nearby":return t==="invite"?"This deck pairs by invite only. Send one from Add a deck.":"Not paired yet. Its dialog can ask to pair.";case"paired":return!e.here&&e.state.startsWith("one-way")?"It can reach this deck, not the other way. Add its address through Add a deck.":null;default:return null}}function TG(e){const t={bad:0,wait:1,idle:2,ok:3};return e.map((n,r)=>({l:n,i:r})).sort((n,r)=>t[n.l.tone]-t[r.l.tone]||n.i-r.i).map(({l:n})=>n)}function RG(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 o=Number(n[s])-Number(r[s]);if(o)return Math.sign(o)}return 0}function AG(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 o=t&&!t.alive?"neither copy works — sign in again here":null;return{there:"broken there",here:s,note:o,tone:o?"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 MG(e,t,n,r=null,s=!0){var h;const o=new Map;for(const f of t)(h=o.get(f.key))!=null&&h.alive||o.set(f.key,f);const l=new Set(n),u=[],d=new Set;for(const f of e??[]){if(d.has(f.key))continue;d.add(f.key);const p=o.get(f.key)??null,g=l.has(f.key),v=AG(f,p,g,s),k=p?p.alive?p.shareable===!1?"unavailable":"works":"expired":"missing",b=!f.alive&&p&&!p.alive?v.note:[k==="works"?null:v.here,f.alive&&f.shareable!==!1?null:v.there,v.note].filter(Boolean).join(" · ")||null;u.push({key:f.key,email:f.email,here:k,there:f.alive?f.shareable===!1?"unavailable":"works":"broken",in:!f.alive||f.shareable===!1?"cut":v.tone==="wait"?"wait":v.tone==="bad"?"blocked":"live",out:g&&p?p.alive&&p.shareable!==!1?"live":"cut":null,caption:b,tone:v.tone,usedThere:r===f.key})}for(const f of n){const p=o.get(f);!p||d.has(f)||(d.add(f),u.push({key:f,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 $G=1e3;function IG(e,t){const n=new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),r=Or(e,t);return`${n} · ${r==="now"?"just now":r}`}function Lx(e){return e&&[e.version,e.os,e.arch].filter(Boolean).join(" · ")||null}const X$={works:"works here",expired:"expired here",missing:"not on this deck",unavailable:"cannot share here"},Z$={works:"works there",broken:"broken there",unavailable:"cannot share there",unknown:"not offered by that deck"};function J$(e){const t=e.in&&e.out?"offered both ways":e.in?"offered by that deck":"offered by this deck";return`${X$[e.here]}, ${Z$[e.there]}, ${t}${e.usedThere?", in use there":""}.`}function Q$({row:e,source:t,status:n,accounts:r,now:s}){var G,K,X,Z,ee;const{peer:o,stranger:l}=t,u=e.kind==="paired",d=e.self??e.name,h=e.kind!=="dialling",f=e.kind==="dialling"?null:e.fp,p=o?o.addr?`${o.addr}:${o.port}`:"":l?l.port?`${l.addr}:${l.port}`:l.addr:e.addr,g=(o==null?void 0:o.about)??null,v=((G=n.about)==null?void 0:G.version)??null,k=u?o!=null&&o.waiting?o.lastSeen!=null?"not said — it runs an older version":"not said yet — it says when it next calls":o!=null&&o.offers?"not said — it runs an older version":"not reached yet":"shown once paired",b=Lx(n.about),x=Lx(g),N=g!=null&&g.version&&v?RG(g.version,v):null,S=o?Gd(o.last,s):null,_=o&&((K=o.last)!=null&&K.error)?K9({error:o.last.error,host:o.addr,port:o.port},[...n.strangers??[],...n.pending??[],...(n.peers??[]).filter(se=>!se.manual&&se.addr).map(se=>({fp:se.fp,name:se.name,addr:se.addr,port:se.port,at:se.lastSeen??0}))],s):null,E=(X=o==null?void 0:o.last)!=null&&X.error&&S&&S.text!==o.last.error?o.last.error:null,T=((Z=o==null?void 0:o.last)==null?void 0:Z.done)??[],R=!!S&&!!E&&!e.quiet&&e.state.startsWith(S.text),A=u||e.kind==="dialling",q=((o==null?void 0:o.via)??e.via)==="tailscale",L=o?o.waiting?null:o.manual?q?"added by its Tailscale address":"added by address":q?"over Tailscale":"on this network":e.kind==="nearby"?q?"heard over Tailscale":"heard on this network":q?"asked this deck to pair, over Tailscale":"asked this deck to pair",P=e.tone==="bad"?"bad":u?e.here?"up":"down":"loose",I=(o==null?void 0:o.offers)??null,O=P==="up"?(I==null?void 0:I.current)??null:null,U=O&&"key"in O?O.key:null,M=!!O&&"hidden"in O,$=!!O&&"other"in O,B=u?MG((I==null?void 0:I.accounts)??null,r,n.shared??[],U,(o==null?void 0:o.autoPaired)!==!0):[],V=B.filter(se=>se.in==null&&se.out==="cut"),H=B.some(se=>se.in!=null),F=B.some(se=>se.out!=null),W=new Map(T.map(se=>[se.email,se])),D=T.filter(se=>!B.some(ue=>ue.email===se.email)),Y=u?I?I.accounts.length===0?"That deck offers nothing. Nobody there has chosen a login to share.":null:o!=null&&o.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=o==null?void 0:o.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=I&&(o!=null&&o.last)&&o.last.at-I.at>$G?Or(I.at,s):null;return{peer:o,stranger:l,paired:u,own:d,canRename:h,fp:f,where:p,about:g,unsaid:k,hereRuns:b,thereRuns:x,order:N,line:S,silence:_,raw:E,echoed:R,showRound:A,how:L,link:P,hiddenThere:M,otherThere:$,lanes:B,spent:V,taking:H,giving:F,told:W,unplaced:D,unknown:Y,stale:J}}function Px(){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 Tu({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 OG({view:e,row:t,status:n,asking:r,drawn:s,onSettings:o}){const{peer:l,paired:u,where:d,about:h,unsaid:f,hereRuns:p,thereRuns:g,order:v,line:k,silence:b,raw:x,echoed:N,showRound:S,how:_,link:E,hiddenThere:T,otherThere:R,lanes:A,spent:q,taking:L,giving:P,told:I,unplaced:O,unknown:U,stale:M}=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??(h?"not said":f),v?` · ${v<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(Px,{}),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(Px,{}),(d&&_||S)&&a.jsxs("p",{className:"lan-link-sub",children:[d&&_,d&&_&&S&&" · ",S&&(k?N?a.jsx("code",{className:"ap-lan-code",children:x}):a.jsx("span",{className:"lan-round","data-tone":k.tone,children:k.text.replace(/ · now$/," · just now")}):"not asked yet"),S&&x&&!N&&a.jsx("code",{className:"lan-fact-raw",children:x})]}),O.length>0&&a.jsx("ul",{className:"lan-done",children:O.map($=>{const B=Rx($);return a.jsxs("li",{"data-ok":$.ok&&!B,children:[$.email," ",a.jsxs("span",{className:"lan-done-what",children:[$.ok?"arrived":"did not arrive",B&&` — ${B.long}`]})]},`${$.email}:${$.action}`)})}),b&&a.jsx("p",{className:"lan-note lan-link-note",children:b}),(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(($,B)=>{const V=I.get($.email),H=V?Rx(V):null,F=$.out==="live"||$.in!=null&&$.in!=="cut";return a.jsxs("li",{role:"listitem",className:"lan-lane","data-tone":$.tone,"data-draw":$.in&&$.out?"both":$.in?"in":"out","data-used-there":$.usedThere||void 0,style:{"--i":B},children:[a.jsx("i",{className:"lan-pip","data-end":"here","data-state":$.here,"aria-hidden":!0}),a.jsxs("span",{className:"lan-track",children:[a.jsxs("span",{className:"lan-wire","data-flow":F?"live":"cut","aria-hidden":!0,children:[($.in==="live"||$.in==="wait")&&a.jsx("i",{className:"lan-glint","data-dir":"in","data-tone":$.in}),$.out==="live"&&a.jsx("i",{className:"lan-glint","data-dir":"out"})]}),$.in&&$.in!=="cut"&&a.jsx(Tu,{dir:"in",gate:$.in==="blocked"}),$.out==="live"&&a.jsx(Tu,{dir:"out"}),a.jsx("span",{className:"lan-lane-email",children:$.email})]}),a.jsx("i",{className:"lan-pip","data-end":"there","data-state":$.there,"aria-hidden":!0}),a.jsx("span",{className:"vis-hidden",children:J$($)}),($.caption||V)&&a.jsxs("span",{className:"lan-lane-note",children:[$.caption,$.caption&&V&&" · ",V&&a.jsxs("span",{className:"lan-lane-done","data-ok":V.ok&&!H,children:[V.ok?"arrived last round":"did not arrive last round",H&&` — ${H.long}`]})]})]},$.key)})},s),u&&a.jsxs(a.Fragment,{children:[q.length>0&&a.jsxs("p",{className:"lan-spent",children:["Paired decks get nothing from ",q.length===1?q[0].email:"the expired ones"," until you sign in again here."]}),U&&a.jsx("p",{className:"lan-empty",children:U}),M&&a.jsxs("p",{className:"lan-stale",children:["As of ",M==="now"?"just now":M,", when it last answered."]}),a.jsxs("div",{className:"lan-legend",children:[L&&a.jsxs("span",{className:"lan-key",children:[a.jsx("span",{className:"lan-key-wire","data-dir":"in","aria-hidden":!0,children:a.jsx(Tu,{dir:"in"})}),"from ",t.name]}),P?a.jsxs("span",{className:"lan-key",children:[a.jsx("span",{className:"lan-key-wire","data-dir":"out","aria-hidden":!0,children:a.jsx(Tu,{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:o,"aria-label":"Change what this deck offers",children:"change"})]})]})]})}const LG=20,PG=17,pS=34,DG=160,FG=80,qG=200,BG=8,mS=6,UG=14,zG=10,WG=.61803398875;function HG({status:e,rows:t,accounts:n,now:r,covered:s,onOpenDeck:o,onClose:l}){const u=w.useRef(null),d=yt(l,{focusRef:u}),h=w.useRef(null),[f,p]=w.useState(null),[g,v]=w.useState(!1),k=w.useRef(null);w.useLayoutEffect(()=>{const re=h.current;if(!re)return;let de=null;const me=()=>{const ke=Math.round(re.clientWidth),xe=Math.round(re.clientHeight);de&&de.w===ke&&de.h===xe||(de&&(v(!0),k.current!=null&&window.clearTimeout(k.current),k.current=window.setTimeout(()=>v(!1),qG)),de={w:ke,h:xe},p(de))};if(me(),typeof ResizeObserver>"u")return;const pe=new ResizeObserver(me);return pe.observe(re),()=>{pe.disconnect(),k.current!=null&&window.clearTimeout(k.current)}},[]);const b=w.useMemo(()=>f?xG(t,f.w,f.h,(e==null?void 0:e.name)??"",re=>{var de,me;return Zb(re,(me=(de=Fl(e,re).peer)==null?void 0:de.about)==null?void 0:me.os)}):null,[t,f,e]),x=w.useMemo(()=>kG(t),[t]),N=(b==null?void 0:b.nodes)??[],S=w.useRef(new Map),_=w.useMemo(()=>{const re=new Map;for(const de of N){const me=tr(de.row);re.set(me,_G(S.current.get(me),de.angle))}return S.current=re,re},[N]),[E,T]=w.useState(null),[R,A]=w.useState(null),[q,L]=w.useState("none"),P=w.useRef(null),I=w.useCallback((re,de)=>{P.current!==re&&(P.current=re,L(de),A(re))},[]),O=w.useRef(null),U=w.useRef(null),M=w.useCallback(()=>{U.current!=null&&window.clearTimeout(U.current),U.current=null},[]),$=w.useCallback((re,de)=>{if(O.current!=null&&window.clearTimeout(O.current),O.current=null,M(),T(re),de==="keyboard"){I(re,"none");return}U.current=window.setTimeout(()=>I(re,P.current?"swap":"full"),FG)},[I,M]),B=w.useCallback(()=>{O.current!=null&&window.clearTimeout(O.current),M(),O.current=window.setTimeout(()=>T(null),DG)},[M]);w.useEffect(()=>()=>{O.current!=null&&window.clearTimeout(O.current),M()},[M]);const V=E&&N.some(re=>tr(re.row)===E)?E:null,H=R?t.find(re=>tr(re)===R)??null:null;w.useEffect(()=>{R&&!H&&I(null,"swap")},[R,H,I]);const[F,W]=w.useState(null),D=w.useRef(new Map),Y=N.findIndex(re=>tr(re.row)===F),J=Y<0?0:Y,G=re=>{var ke;if(N.length===0)return;const de=re.key==="ArrowRight"||re.key==="ArrowDown"?1:re.key==="ArrowLeft"||re.key==="ArrowUp"?-1:0,me=re.key==="Home"?0:re.key==="End"?N.length-1:de?(J+de+N.length)%N.length:null;if(me==null)return;re.preventDefault();const pe=tr(N[me].row);W(pe),(ke=D.current.get(pe))==null||ke.focus()},[K,X]=w.useState(()=>typeof document<"u"&&document.hidden);w.useEffect(()=>{const re=()=>X(document.hidden);return document.addEventListener("visibilitychange",re),()=>document.removeEventListener("visibilitychange",re)},[]);const Z=(e==null?void 0:e.enabled)===!0,ee=e?Z?NG(x):"Local network is off":"checking…",se=()=>{M(),I(null,"swap"),T(null)},ue=V?N.find(re=>tr(re.row)===V)??null:null,ae=()=>{var re;R&&((re=D.current.get(R))==null||re.focus()),se()};return It.createPortal(a.jsx("div",{className:"modal-backdrop",onClick:l,role:"presentation",children:a.jsxs("div",{ref:d,className:"modal nm-modal",onClick:re=>re.stopPropagation(),"data-paused":s||K||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:ee})]}),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:h,className:"nm-stage","data-focus":V?"":void 0,"data-focus-via":ue==null?void 0:ue.row.via,"data-dense":(b==null?void 0:b.dense)||void 0,"data-still":g||void 0,onClick:re=>{re.target===re.currentTarget&&se()},children:f&&b&&a.jsxs(a.Fragment,{children:[a.jsx(VG,{layout:b,w:f.w,h:f.h}),N.map(re=>{const de=tr(re.row);return a.jsx(YG,{node:re,angle:_.get(de)??re.angle,lit:V===de},de)}),a.jsx(XG,{status:e}),a.jsx("span",{id:"nm-ring-hint",className:"vis-hidden",children:"Arrow keys move between decks. Enter opens the deck's own dialog."}),a.jsx("div",{className:"nm-ring",role:"group","aria-label":`Decks around this deck, ${N.length}`,"aria-describedby":"nm-ring-hint",onKeyDown:G,children:N.map((re,de)=>{var pe,ke;const me=tr(re.row);return a.jsx(ZG,{node:re,angle:_.get(me)??re.angle,os:(ke=(pe=Fl(e,re.row).peer)==null?void 0:pe.about)==null?void 0:ke.os,lit:V===me,shown:R===me,tabbable:de===J,register:xe=>{xe?D.current.set(me,xe):D.current.delete(me)},onHold:xe=>{W(me),$(me,xe)},onRelease:B,onOpen:()=>o(re.row.fp)},me)})}),N.length===0&&a.jsx(JG,{status:e})]})}),a.jsx(QG,{})]}),a.jsx("aside",{className:"nm-side","aria-label":"Details",children:H&&e?a.jsx(tK,{row:H,status:e,accounts:n,now:r,entrance:q,onOpen:()=>o(H.fp),onBack:ae},tr(H)):a.jsx(eK,{status:e,summary:x,entrance:q})})]})]})}),document.body)}function eI(){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 VG({layout:e,w:t,h:n}){const{zone:r}=e;return a.jsxs("svg",{className:"nm-orbits",width:t,height:n,viewBox:`0 0 ${t} ${n}`,"aria-hidden":!0,children:[r&&a.jsxs(a.Fragment,{children:[a.jsxs("defs",{children:[a.jsx("path",{id:"nm-zone-arc",d:KG(r,t/2,n/2)}),a.jsxs("radialGradient",{id:"nm-zone-fill",gradientUnits:"userSpaceOnUse",cx:t/2,cy:n/2,r:Math.max(r.outer.rx,r.outer.ry),children:[a.jsx("stop",{className:"nm-zone-stop",offset:"0.2","data-at":"in"}),a.jsx("stop",{className:"nm-zone-stop",offset:"0.5","data-at":"mid"}),a.jsx("stop",{className:"nm-zone-stop",offset:"1","data-at":"out"})]})]}),a.jsx("path",{className:"nm-zone",d:GG(r,t/2,n/2),fill:"url(#nm-zone-fill)"}),a.jsx("text",{className:"nm-zone-label",children:a.jsx("textPath",{href:"#nm-zone-arc",startOffset:"50%",textAnchor:"middle",children:`Tailscale · ${r.count} deck${r.count===1?"":"s"}`})})]}),e.rings.map((s,o)=>a.jsx("ellipse",{className:"nm-orbit","data-ring":s.ring,"data-folded":e.folded&&s.ring===1||void 0,cx:t/2,cy:n/2,rx:s.rx,ry:s.ry,style:{"--ring":o}},s.ring))]})}function gS(e,t,n,r){const s=r*Math.PI/180;return`${(t+Math.cos(s)*e.rx).toFixed(1)},${(n+Math.sin(s)*e.ry).toFixed(1)}`}function GG(e,t,n){const r=e.to-e.from>180?1:0,s=(N,S)=>{const _=S*Math.PI/180;return[t+Math.cos(_)*N.rx,n+Math.sin(_)*N.ry]},o=(N,S)=>S/((N.rx+N.ry)/2)*(180/Math.PI),l=(N,S,_)=>{const E=Math.hypot(S[0]-N[0],S[1]-N[1])||1,T=Math.min(.5,_/E);return[N[0]+(S[0]-N[0])*T,N[1]+(S[1]-N[1])*T]},u=([N,S])=>`${N.toFixed(1)},${S.toFixed(1)}`,d=zG,h=UG,f=o(e.inner,d),p=o(e.outer,h),g=s(e.inner,e.from),v=s(e.outer,e.from),k=s(e.outer,e.to),b=s(e.inner,e.to),x=N=>`${N.rx.toFixed(1)},${N.ry.toFixed(1)}`;return[`M${u(s(e.inner,e.from+f))}`,`Q${u(g)} ${u(l(g,v,d))}`,`L${u(l(v,g,h))}`,`Q${u(v)} ${u(s(e.outer,e.from+p))}`,`A${x(e.outer)} 0 ${r} 1 ${u(s(e.outer,e.to-p))}`,`Q${u(k)} ${u(l(k,b,h))}`,`L${u(l(b,k,d))}`,`Q${u(b)} ${u(s(e.inner,e.to-f))}`,`A${x(e.inner)} 0 ${r} 0 ${u(s(e.inner,e.from+f))}`,"Z"].join(" ")}function KG(e,t,n){const r={rx:e.outer.rx-mS,ry:e.outer.ry-mS},s=e.to-e.from>180?1:0;return`M${gS(r,t,n,e.to)} A${r.rx.toFixed(1)},${r.ry.toFixed(1)} 0 ${s} 0 ${gS(r,t,n,e.from)}`}function YG({node:e,angle:t,lit:n}){const r=e.row.kind==="paired"&&e.row.here,s=e.order*WG%1*BG;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":`${pS}px`,"--gap":`${pS+(e.tier==="loose"?PG:LG)}px`,"--i":e.order,"--phase":`${s.toFixed(2)}s`},children:r&&a.jsx("i",{className:"nm-glint"})})}function XG({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 ZG({node:e,angle:t,os:n,lit:r,shown:s,tabbable:o,register:l,onHold:u,onRelease:d,onOpen:h}){const{row:f}=e,p=`nm-d-${nK(tr(f))}`,g=e.angle*Math.PI/180,v=Zb(f,n);return a.jsxs("button",{ref:l,type:"button",className:"nm-node",tabIndex:o?0:-1,"data-tier":e.tier,"data-kind":f.kind,"data-side":e.side,"data-via":f.via,"data-on":r||void 0,"data-shown":s||void 0,"aria-label":`${f.name}: ${K$(f)}`,"aria-describedby":e.tier==="online"?p:void 0,style:{"--nm-a":`${t.toFixed(2)}deg`,"--nm-d":`${e.dist.toFixed(1)}px`,"--i":e.order,"--in-x":`${(-Math.cos(g)*14).toFixed(1)}px`,"--in-y":`${(-Math.sin(g)*14).toFixed(1)}px`},onPointerEnter:k=>{k.pointerType==="mouse"&&u("pointer")},onPointerLeave:d,onFocus:k=>u(k.currentTarget.matches(":focus-visible")?"keyboard":"pointer"),onBlur:d,onClick:h,children:[a.jsx("i",{className:"nm-halo","data-tier":e.tier,"aria-hidden":!0}),f.kind==="dialling"?a.jsx("i",{className:"nm-addr-dot","aria-hidden":!0}):a.jsx(Px,{}),e.tier!=="online"&&a.jsx("i",{className:"nm-mark","data-tier":e.tier,"data-kind":f.kind,"aria-hidden":!0}),a.jsxs("span",{className:"nm-label","aria-hidden":!0,children:[a.jsx("span",{className:"nm-name",children:V$(f)}),a.jsx("span",{className:"nm-cap",children:v})]}),e.tier==="online"&&a.jsx("span",{id:p,className:"vis-hidden",children:v})]})}function JG({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; one on another network needs its address, through Add a deck in Local network.":"Local network is off, so this deck is not looking for any other.":"Asking this deck about the network…"})}function QG(){return a.jsxs("ul",{className:"nm-legend",children:[a.jsxs("li",{children:[a.jsxs("span",{className:"nm-key","aria-hidden":!0,children:[a.jsx("i",{className:"nm-key-wire","data-tier":"online"}),a.jsx("i",{className:"nm-key-mark","data-tier":"online"})]}),"online"]}),a.jsxs("li",{children:[a.jsxs("span",{className:"nm-key","aria-hidden":!0,children:[a.jsx("i",{className:"nm-key-wire","data-tier":"offline"}),a.jsx("i",{className:"nm-key-mark","data-tier":"offline"})]}),"away"]}),a.jsxs("li",{children:[a.jsxs("span",{className:"nm-key","aria-hidden":!0,children:[a.jsx("i",{className:"nm-key-wire","data-tier":"loose"}),a.jsx("i",{className:"nm-key-mark","data-tier":"loose"})]}),"not paired"]}),a.jsxs("li",{children:[a.jsx("i",{className:"nm-key-zone","aria-hidden":!0}),"over Tailscale"]})]})}function tI({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 eK({status:e,summary:t,entrance:n}){const r=SG(e),s=Lx(e==null?void 0:e.about),o=[];s&&o.push({label:"Runs",value:s}),o.push({label:r.length>1?"Addresses":"Address",value:r.length?a.jsx("span",{className:"nm-addrs",children:r.map(d=>a.jsx("code",{className:"ap-lan-code",children:d},d))}):"none yet",quiet:r.length===0}),e!=null&&e.pairingMode&&o.push({label:"Pairing",value:e.pairingMode==="invite"?"by invite only":"asks and answers"});const l=[{key:"online",n:t.online,words:"online",mark:a.jsx("i",{className:"nm-key-mark","data-tier":"online","aria-hidden":!0})},{key:"away",n:t.offline,words:"away",mark:a.jsx("i",{className:"nm-key-mark","data-tier":"offline","aria-hidden":!0})},{key:"asks",n:t.asks,words:"asking to pair",mark:a.jsx("i",{className:"nm-key-mark","data-tier":"loose","data-kind":"asks","aria-hidden":!0})},{key:"nearby",n:t.nearby,words:"nearby, not paired",mark:a.jsx("i",{className:"nm-key-mark","data-tier":"loose","aria-hidden":!0})},{key:"dialling",n:t.dialling,words:"still dialling",mark:a.jsx("i",{className:"nm-key-mark","data-tier":"loose","aria-hidden":!0})},{key:"declined",n:t.declined,words:"declined, not drawn",mark:a.jsx("i",{"aria-hidden":!0})}],u=EG(t);return a.jsxs("div",{className:"nm-panel","data-view":"network","data-entrance":n,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("ul",{className:"nm-counts",children:l.filter(d=>d.n>0).map(d=>a.jsxs("li",{"data-count":d.key,children:[d.mark,a.jsx("span",{className:"nm-count-n",children:d.n}),a.jsx("span",{className:"nm-count-words",children:d.words})]},d.key))}),t.tailnet>0&&a.jsxs("p",{className:"nm-counts-note",children:[t.tailnet," reached over Tailscale — the shaded slice, lower right"]}),u&&a.jsx("p",{className:"nm-next",children:u}),a.jsx(tI,{facts:o}),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 tK({row:e,status:t,accounts:n,now:r,entrance:s,onOpen:o,onBack:l}){var x;const u=Q$({row:e,source:Fl(t,e),status:t,accounts:n,now:r}),d=[];u.where&&d.push({label:"Address",value:a.jsx("code",{className:"ap-lan-code",children:u.where})}),u.thereRuns&&d.push({label:"Runs",value:`${u.thereRuns}${u.order?` · ${u.order<0?"older than this deck":"newer than this deck"}`:""}`}),u.hiddenThere&&d.push({label:"Signed in to",value:"not said — its owner hides it",quiet:!0}),u.otherThere&&d.push({label:"Signed in to",value:"an account it does not share",quiet:!0});const h=e.kind==="paired"&&e.here||e.kind==="asks",f=CG(e,t.pairingMode),p=TG(u.lanes),g=p.length,v=p.filter(N=>N.tone==="ok").length,k=g===0?"No shared logins":v===g?`${g} shared login${g===1?", fine":"s, all fine"}`:`${g} shared login${g===1?"":"s"} · ${v} fine`,b=u.unknown&&((x=u.peer)!=null&&x.waiting)&&!u.peer.offers?"Its side is not known until it next calls.":u.unknown;return a.jsxs("div",{className:"nm-panel","data-view":"deck","data-entrance":s,"data-tier":e.kind==="paired"?e.here?"online":"offline":"loose",children:[a.jsxs("button",{type:"button",className:"ap-lan-word nm-back",onClick:l,children:[a.jsx("span",{"aria-hidden":!0,children:"‹ "}),"the whole network"]}),a.jsxs("div",{className:"nm-panel-head",children:[a.jsxs("h3",{className:"nm-panel-name",children:[a.jsx("i",{className:h?"ap-pulse":"ap-dot","data-kind":e.kind,"aria-hidden":!0}),a.jsx("span",{className:"nm-panel-title",children:e.name})]}),a.jsx("button",{type:"button",className:"btn nm-open",onClick:o,"aria-label":`Open ${e.name}`,children:"Open"})]}),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:K$(e)}),f&&a.jsx("p",{className:"nm-next",children:f}),d.length>0&&a.jsx(tI,{facts:d}),u.paired&&a.jsxs("section",{className:"nm-logins","aria-label":"Logins the two decks share",children:[a.jsx("p",{className:"nm-logins-title",children:k}),g>0&&a.jsx("ul",{className:"nm-lanes",children:p.map((N,S)=>a.jsxs("li",{className:"nm-lane","data-tone":N.tone,style:{"--k":S},children:[a.jsx("i",{className:"nm-lane-dot","aria-hidden":!0}),a.jsx("span",{className:"nm-lane-email","aria-hidden":!0,children:N.email}),yS(N)&&a.jsx("span",{className:"nm-lane-said","aria-hidden":!0,children:yS(N)}),N.usedThere&&a.jsx("span",{className:"nm-lane-used","aria-hidden":!0,children:"in use there"}),a.jsxs("span",{className:"vis-hidden",children:[N.email,": ",J$(N)]})]},N.key))}),b&&a.jsx("p",{className:"nm-panel-hint",children:b})]})]})}function yS(e){return e.caption?e.caption:e.tone==="ok"?null:`${X$[e.here]} · ${Z$[e.there]}`}function nK(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return(t>>>0).toString(36)}const rK=6;function sK({anchorId:e,id:t,rows:n,onHold:r,onLet:s}){const o=w.useRef(null),l=n.filter(g=>g.kind==="paired"),u=l.filter(g=>g.here),d=u.slice(0,rK),h=l.length-u.length,f=u.length>d.length?`and ${u.length-d.length} more`:h>0?`${h} not on right now`:null,p=w.useCallback(()=>{const g=o.current,v=document.getElementById(e);if(!g||!v)return;const k=Fb(v.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 w.useLayoutEffect(()=>{p()}),w.useEffect(()=>(window.addEventListener("scroll",p,!0),window.addEventListener("resize",p),()=>{window.removeEventListener("scroll",p,!0),window.removeEventListener("resize",p)}),[p]),It.createPortal(a.jsxs("div",{ref:o,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}`))}),f&&a.jsx("p",{className:"ap-peek-rest",children:f})]}),document.body)}function aK({entry:e,rows:t,onOpen:n,onMap:r,peek:s,openPeek:o,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:h=>{h.pointerType==="mouse"&&o(D$)},onPointerLeave:l,onFocus:h=>{h.target.matches(":focus-visible")&&o(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(eI,{})}),s&&a.jsx(sK,{anchorId:"ap-lan-entry",id:"ap-lan-peek",rows:t,onHold:u,onLet:l})]})}function oK({row:e,run:t,onVerb:n,onUnpair:r}){const[s,o]=w.useState(!1),l=w.useRef(0),[u,d]=w.useState(null);return w.useEffect(()=>{if(!s)return;const p=window.setTimeout(()=>o(!1),4e3);return()=>window.clearTimeout(p)},[s]),w.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=Ol({armedFor:s?e.fp:null,target:e.fp,armedAt:l.current,now:p,gapMs:Il});if(g==="arm"){o(!0),d(null),l.current=p;return}g!=="ignore"&&(o(!1),t(n))},pressTwin:p=>{if(!r)return;const g=Date.now(),v=Ol({armedFor:u,target:p,armedAt:l.current,now:g,gapMs:Il});if(v==="arm"){d(p),o(!1),l.current=g;return}v!=="ignore"&&(d(null),t(()=>r(p)))}}}function iK({row:e,paired:t,peer:n,status:r,busy:s,press:o,checkNow:l,armed:u,pressOwn:d,run:h,onVerb:f,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",...o(`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":""}`,...o(`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",...o(`accept:${e.fp}`),onClick:()=>void h(f),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",...o(`drop:${e.fp}`),onClick:()=>void h(f),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",...o(`allow:${e.fp}`),onClick:()=>void h(f),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 lK({instances:e,now:t,busy:n,press:r,armedTwin:s,pressTwin:o,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,b,x,N;const h=(k=u.peer)!=null&&k.addr?`${u.peer.addr}:${u.peer.port}`:u.row.addr,f=h||u.row.fp,p=(b=u.peer)!=null&&b.pairedAt?Or(u.peer.pairedAt,t):null,g=[(N=(x=u.peer)==null?void 0:x.about)!=null&&N.version?`runs ${u.peer.about.version}`:null,p?`paired ${p==="now"?"just now":p}`:null,u.row.state].filter(Boolean).join(" · "),v=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}),h?a.jsx("code",{className:"ap-lan-code lan-twin-at",children:h}):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:v}),d>0&&l&&a.jsx("button",{type:"button",className:`ap-manage-btn danger lan-twin-do${s===v?" armed":""}`,...r(`unpair:${v}`),onKeyDown:S=>{S.repeat&&S.preventDefault()},onClick:()=>o(v),"aria-label":s===v?`Confirm unpairing ${f}`:`Unpair ${f}`,title:s===v?"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:${v}`?"unpairing…":s===v?"confirm":"unpair"}),a.jsx("span",{className:"lan-twin-meta",children:d===0?`${g} · shown above`:g})]},v)})})]})}function cK(){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 uK({row:e,source:t,status:n,accounts:r,now:s,busy:o,onClose:l,onRename:u,onCheck:d,onVerb:h,onSettings:f,onInvite:p,twins:g=[],onUnpair:v}){const k=w.useRef(null),b=yt(l,{focusRef:k}),[x,N]=w.useState(null),[S,_]=w.useState(null),[E,T]=w.useState(!1),[R,A]=w.useState(0),q=w.useRef(null),L=w.useRef(null),P=w.useRef(!0);w.useEffect(()=>()=>{P.current=!1},[]);const I=x!=null;w.useEffect(()=>{var re;I&&((re=q.current)==null||re.select())},[I]);const O=w.useRef(!1);w.useEffect(()=>{var re,de;O.current&&!I&&hs(((re=document.activeElement)==null?void 0:re.tagName)??null)&&((de=L.current)==null||de.focus()),O.current=I},[I]);const U=re=>{const de=Xs(o,re);return{disabled:de.disabled,"aria-busy":de.busy}},M=async re=>{const de=await re();return P.current&&_(de),de==null},{armed:$,armedTwin:B,pressOwn:V,pressTwin:H}=oK({row:e,run:M,onVerb:h,onUnpair:v}),F=Q$({row:e,source:t,status:n,accounts:r,now:s}),{peer:W,stranger:D,paired:Y,own:J,canRename:G,fp:K}=F,X=o===`check:${e.fp}`,Z=async re=>{const de=re.trim()===J?"":re;await M(()=>u(de))&&N(null)},ee=()=>void M(d).then(re=>{re&&P.current&&A(de=>de+1)}),se=async()=>{if(K)try{if(await navigator.clipboard.writeText(K),!P.current)return;T(!0),window.setTimeout(()=>{P.current&&T(!1)},1600)}catch{P.current&&_("Could not copy it — select the fingerprint and copy it by hand.")}},ue=[];Y&&(W!=null&&W.pairedAt)?ue.push({label:"Paired",value:IG(W.pairedAt,s),tone:"meta"}):e.kind==="declined"&&D&&ue.push({label:"Paired",value:`no · you said no ${Kb(D.at,s)}`,tone:"meta"}),ue.push({label:"Fingerprint",value:K?a.jsxs("span",{className:"lan-fp",children:[a.jsx("code",{className:"ap-lan-code",children:K}),a.jsx("button",{type:"button",className:"ap-lan-word lan-copy",onClick:()=>void se(),"aria-label":E?"Fingerprint copied":"Copy the fingerprint",children:E?"copied":"copy"})]}):"not known — nothing has answered there",tone:K?void 0:"quiet"});const ae=g.length?[{row:e,peer:W??null},...g]:[];return It.createPortal(a.jsx("div",{className:"modal-backdrop",onClick:l,role:"presentation",children:a.jsxs("div",{ref:b,className:"modal lan-peer","data-tone":e.tone,onClick:re=>re.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:[I?a.jsxs("form",{className:"lan-peer-edit",onSubmit:re=>{re.preventDefault(),Z(x??"")},children:[a.jsx("span",{id:"lan-peer-title",className:"vis-hidden",children:e.name}),a.jsx("input",{ref:q,className:"ap-manage-input lan-peer-input",value:x??"",maxLength:48,placeholder:J,"aria-label":"Name for this deck, shown on this deck only",onChange:re=>N(re.target.value)}),a.jsx("button",{type:"submit",className:"ap-manage-btn",...U(`alias:${e.fp}`),children:"save"}),a.jsx("button",{type:"button",className:"ap-manage-btn",onClick:()=>N(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}),G&&a.jsx("button",{type:"button",className:"glyph-btn lan-peer-rename",ref:L,onClick:()=>{_(null),N(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(cK,{})})]}),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}),I&&a.jsx("button",{type:"button",className:"ap-lan-word lan-peer-restore",...U(`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(OG,{view:F,row:e,status:n,asking:X,drawn:R,onSettings:f}),a.jsx("dl",{className:"lan-facts",children:ue.map(re=>a.jsxs("div",{className:"lan-fact","data-tone":re.tone,children:[a.jsx("dt",{children:re.label}),a.jsx("dd",{children:re.value})]},re.label))}),ae.length>1&&a.jsx(lK,{instances:ae,now:s,busy:o,press:U,armedTwin:B,pressTwin:H,onUnpair:v})]}),a.jsx(iK,{row:e,paired:Y,peer:W,status:n,busy:o,press:U,checkNow:ee,armed:$,pressOwn:V,run:M,onVerb:h,onInvite:p})]})}),document.body)}function ql(e,t){const n=w.useRef(!1);return w.useEffect(()=>{var r,s;!e||!n.current||(n.current=!1,hs(((r=document.activeElement)==null?void 0:r.tagName)??null)&&((s=t.current)==null||s.focus()))},[e]),()=>{n.current=!0}}function dK(e,t){if(e.length!==t.length)return!1;const n=new Set(e);return t.every(r=>n.has(r))}function hK(e,t,n,r){const s=new Set(e??t);return r?s.add(n):s.delete(n),[...s]}function wS(e,t,n){return e==null||n!=null&&!n.ok||dK(e,t)?null:e}function nI({line:e,onDismiss:t,onAnswer:n}){const[r,s]=w.useState(!1),o=w.useRef(!1),l=w.useRef(!0);w.useEffect(()=>(l.current=!0,()=>{l.current=!1}),[]);const u=w.useRef(null),d=w.useRef(null),h=w.useRef(!1);if(w.useEffect(()=>{var p;h.current&&(h.current=!1,e!=null&&e.giveBack||(p=d.current)==null||p.focus())},[e]),!e)return null;const f=async()=>{if(o.current)return;o.current=!0,s(!0);const p=await dV();o.current=!1,l.current&&(s(!1),h.current=document.activeElement===u.current,n(fV(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:f,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 fK(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 Ru="Paused while this deck pairs only by invite. Turn that off above to use it.";function pK({status:e,accounts:t,onClose:n,onChanged:r}){const s=yt(n),[o,l]=w.useState(null),[u,d]=w.useState(null),[h,f]=w.useState(!1),[p,g]=w.useState(null),v=w.useRef(null),k=H=>{const F=Xs(p,H);return{disabled:F.disabled,"aria-busy":F.busy}},b=w.useRef(null),x=w.useRef(!0);w.useEffect(()=>()=>{x.current=!1},[]),w.useEffect(()=>{b.current=wS(b.current,e.shared??[],null)},[e.shared]);const N=w.useCallback(async(H,F,W="write")=>{v.current=W,g(W);try{const Y=await(await fetch("/api/prefs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({lan:H})})).json().catch(()=>null);return x.current?(Y!=null&&Y.ok?d(null):d(nr(Et(F,Y),Y)),r(),(Y==null?void 0:Y.ok)===!0):!1}catch{return x.current&&d(nr(Et(F,null))),!1}finally{v.current=null,x.current&&g(null)}},[r]),S=w.useCallback(async H=>{const F=await N({name:H},"save the name","name");return F&&x.current&&l(W=>W===H?null:W),F},[N]),_=w.useRef(null),E=o!=null&&o!==(e.name??""),T=ql(!E,_),R=w.useCallback(async()=>{E&&!await S(o)||n()},[E,o,S,n]),A=async()=>{if(!e.fp)return;const H=await Ba(e.fp);if(x.current){if(!H){d(nr("Could not copy it — select the fingerprint and copy it by hand."));return}f(!0),window.setTimeout(()=>{x.current&&f(!1)},1600)}},q=new Set(b.current??e.shared??[]),L=e.autoAsk!==!1,P=e.autoAccept!==!1,I=e.pairingMode==="invite",O=H=>{const F=k(H);return{...F,disabled:F.disabled||I}},U=e.shareActive!==!1,M=e.tailscale??null,$=!!(M!=null&&M.on),B=(M==null?void 0:M.ask)!==!1,V=(M==null?void 0:M.accept)!==!1;return It.createPortal(a.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:a.jsxs("div",{ref:s,className:"modal lan-modal",onClick:H=>H.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(nI,{line:u,onDismiss:()=>d(null),onAnswer:H=>{d(H),H.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:o??e.name??"",placeholder:"this machine",onChange:H=>l(H.target.value),onKeyDown:H=>{H.key!=="Enter"||o==null||S(o)}}),E&&a.jsx("button",{type:"button",className:"ap-manage-btn",...k("name"),onClick:()=>{T(),S(o)},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":h?"Fingerprint copied":"Copy this deck's fingerprint",children:h?"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(H=>a.jsxs("label",{className:"ap-lan-pick",title:H.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:q.has(H.key),onChange:F=>{const W=hK(b.current,e.shared??[],H.key,F.target.checked);b.current=W,N({shared:W},F.target.checked?"share that account":"stop sharing that account").then(D=>{b.current===W&&(b.current=wS(W,e.shared??[],{ok:D}))})}}),a.jsx("span",{className:"ap-lan-pick-name",children:H.email}),!H.alive&&a.jsx("span",{className:"ap-lan-dead",children:"not working here"})]},H.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":U,"aria-label":"Show paired decks which of these this deck is using",...k("current"),onClick:()=>void N({shareActive:!U},U?"stop showing which account this deck is using":"show which account this deck is using","current"),title:U?"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",I&&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":I,"aria-label":"Pair new decks only by invite","aria-describedby":I?"lan-invite-only-detail":void 0,...k("mode"),onKeyDown:H=>{H.repeat&&H.preventDefault()},onClick:()=>void N({pairingMode:I?"automatic":"invite"},I?"let decks pair on their own again":"pair new decks only by invite","mode"),title:I?"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",I&&a.jsx("span",{className:"lan-sub-state",children:" · paused while pairing is invite-only"})]}),a.jsxs("div",{className:"lan-switches","data-paused":I||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":L,"aria-label":"Ask every deck this one finds",...O("ask"),onClick:()=>void N({autoAsk:!L},L?"stop asking automatically":"ask every deck this one finds","ask"),title:I?Ru:L?"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":P,"aria-label":"Say yes to every deck that asks","data-tone":"warn",...O("accept"),onKeyDown:H=>{H.repeat&&H.preventDefault()},onClick:()=>void N({autoAccept:!P},P?"stop accepting automatically":"accept every deck that asks","accept"),title:I?Ru:P?"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"})})]})]})]})]}),(M==null?void 0:M.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:fK(M)})]}),a.jsx("button",{type:"button",className:"switch ap-auto-state",role:"switch","aria-checked":$,"aria-label":"Look for my devices over Tailscale","aria-describedby":"lan-ts-detail",...k("tailscale"),onClick:()=>void N({tailscale:!$},$?"stop looking over Tailscale":"look for your devices over Tailscale","tailscale"),title:$?"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"})})]}),$&&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",I&&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":I||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":B,"aria-label":"Ask each of my devices it finds over Tailscale",...O("tailscale-ask"),onClick:()=>void N({tailscaleAsk:!B},B?"stop asking your devices automatically":"ask your devices automatically","tailscale-ask"),title:I?Ru:B?"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":I||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":V,"aria-label":"Say yes to my devices when they ask over Tailscale","data-tone":"warn",...O("tailscale-accept"),onKeyDown:H=>{H.repeat&&H.preventDefault()},onClick:()=>void N({tailscaleAccept:!V},V?"stop accepting your devices automatically":"accept your devices automatically","tailscale-accept"),title:I?Ru:V?"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 mK({on:e,status:t,paired:n,busy:r,pressProps:s,checkNow:o,setAddOpen:l,setSetupOpen:u,setMapOpen:d,onBack:h,closeButton:f}){return a.jsxs("div",{className:"ap-header",children:[a.jsx("button",{type:"button",id:"ap-lan-back",className:"glyph-btn ap-back",onClick:h,"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(eI,{})}),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 o(),"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)"})]})}),f]})]})}function gK({accounts:e,onChanged:t,onNoCopy:n,view:r,onOpen:s,onBack:o,closeButton:l}){const[u,d]=w.useState(!1),[h,f]=w.useState(!1),[p,g]=w.useState(!1),v=cV(),[k,b]=w.useState(!1),{status:x,manual:N,now:S,busy:_,failure:E,dismissFailure:T,answerGiveBack:R,pressProps:A,load:q,toggle:L,answer:P,dropAddress:I,rename:O,checkOne:U,checkNow:M}=wV(t,()=>d(!0)),{armed:$,pressUnpair:B}=vV(P),[V,H]=w.useState(null),[F,W]=w.useState(!1),D=w.useMemo(()=>e.filter(pe=>lV(pe.key,x??null,S)).map(pe=>pe.key).sort().join(`
|
|
84
|
+
`),[e,x,S]);w.useEffect(()=>{n==null||n(D?D.split(`
|
|
85
|
+
`):[])},[D,n]);const Y=(x==null?void 0:x.enabled)===!0,J=w.useMemo(()=>J9((x==null?void 0:x.pairingMode)==="invite"&&x?{...x,pending:[]}:x,S),[x,S]),G=V?J.find(pe=>{var ke;return pe.fp===V||((ke=pe.twins)==null?void 0:ke.some(xe=>xe.fp===V))})??null:null;w.useEffect(()=>{V&&x&&!G&&H(null)},[V,x,G]);const{asks:K,rest:X,live:Z,folded:ee,troubled:se,shown:ue,paired:ae}=iV(J,k),re=Y9(x,S),de=oV(x,J),me=a.jsxs(a.Fragment,{children:[h&&x&&a.jsx(BV,{status:x,manual:N,startWith:h==="invite"?"invite":void 0,onClose:()=>f(!1),onChanged:()=>{q(),t()}}),p&&a.jsx(B$,{title:"How Local network works",steps:$V,finish:Y?void 0:{label:"Turn it on",act:()=>{g(!1),L()}},onClose:()=>g(!1)}),u&&x&&a.jsx(pK,{status:{...x,manualRows:N},accounts:e,manual:N,onClose:()=>d(!1),onChanged:()=>{q(),t()}}),F&&a.jsx(HG,{status:x,rows:J,accounts:e,now:S,covered:!!G||u||!!h||p,onOpenDeck:H,onClose:()=>W(!1)}),G&&x&&a.jsx(uK,{row:G,source:Fl(x,G),status:x,accounts:e,now:S,busy:_,onClose:()=>H(null),onRename:pe=>O(G.fp,pe),onCheck:()=>U(G.fp),onVerb:()=>{switch(G.kind){case"paired":return P("unpair",G.fp,"unpair that deck");case"nearby":return P("accept",G.fp,"reach that deck");case"declined":return P("allow",G.fp,"let that deck ask again");case"dialling":return I(G.fp);default:return Promise.resolve(null)}},onSettings:()=>{H(null),d(!0)},onInvite:()=>{H(null),f("invite")},twins:(G.twins??[]).map(pe=>({row:pe,peer:Fl(x,pe).peer??null})),onUnpair:pe=>P("unpair",pe,"unpair that deck")})]});return r?a.jsxs("div",{className:"ap-lan-view",children:[a.jsx(mK,{on:Y,status:x,paired:ae,busy:_,pressProps:A,checkNow:M,setAddOpen:f,setSetupOpen:d,setMapOpen:W,onBack:o,closeButton:l}),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":Y,"aria-label":"Sync with paired decks",...A("switch"),onClick:()=>void L(),title:Y?"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(VV,{on:Y,status:x}),!Y&&a.jsxs("button",{type:"button",className:"ap-lan-intro",onClick:()=>g(!0),title:"Four pictures: what this does, and what to do on each machine",children:[a.jsx(IV,{}),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 ${re.tone}`,role:"status",children:re.tone==="ok"?"":re.text}),a.jsx(nI,{line:E,onDismiss:T,onAnswer:R}),Y&&a.jsxs(a.Fragment,{children:[K.length>0&&a.jsx(zV,{asks:K,pressProps:A,answer:P}),ue.length>0&&a.jsx(WV,{rows:ue,pairingMode:x==null?void 0:x.pairingMode,armed:$,pressProps:A,answer:P,dropAddress:I,onUnpair:B,onOpenPeer:H,onInvite:()=>f("invite")}),(Z.length>0&&ee.length>0||Y&&ae>0)&&a.jsxs("div",{className:"ap-lan-tail",children:[Z.length>0&&ee.length>0&&a.jsxs("button",{type:"button",className:"ap-lan-word ap-lan-more","aria-expanded":k,onClick:()=>b(pe=>!pe),title:k?"Show only the decks that are on":`Show the ${ee.length} deck${ee.length===1?"":"s"} that are not responding right now`,children:[a.jsx("span",{className:`ap-lan-chev${k?" open":""}`,"aria-hidden":!0,children:"›"}),k?"fewer":`${ee.length} more`,!k&&se>0&&a.jsxs("span",{className:"ap-lan-more-bad",children:[" · ",se," not responding"]})]}),Y&&ae>0&&a.jsx("span",{className:"ap-lan-checked",children:X9(x==null?void 0:x.checkedAt,S,_==="check")})]}),X.length===0&&K.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:()=>g(!0),children:"How it works"})]})]})]})}),me]}):a.jsxs("div",{className:"ap-foot",children:[a.jsx(aK,{entry:de,rows:J,onOpen:s,onMap:Y?()=>W(!0):void 0,...v}),a.jsx("p",{className:"vis-hidden",role:"status",children:re.tone==="ok"?"":re.text}),me]})}function yK({anchorId:e,id:t,peers:n,onHold:r,onLet:s}){const o=w.useRef(null),{title:l,shown:u,rest:d}=z9(n),h=w.useCallback(()=>{const f=o.current,p=document.getElementById(e);if(!f||!p)return;const g=Fb(p.getBoundingClientRect(),{width:f.offsetWidth,height:f.offsetHeight},{width:window.innerWidth,height:window.innerHeight});f.style.top=`${g.top}px`,f.style.left=`${g.left}px`,f.style.maxHeight=g.maxHeight==null?"":`${g.maxHeight}px`,f.dataset.side=g.side},[e]);return w.useLayoutEffect(()=>{h()}),w.useEffect(()=>(window.addEventListener("scroll",h,!0),window.addEventListener("resize",h),()=>{window.removeEventListener("scroll",h,!0),window.removeEventListener("resize",h)}),[h]),It.createPortal(a.jsxs("div",{ref:o,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(f=>a.jsxs("span",{className:"ap-peek-who ap-fold-who",children:[a.jsx("span",{className:"ap-fold-name",children:f.name}),a.jsx("span",{className:"ap-fold-state","data-tone":f.ready?"ok":f.warn?"warn":"idle",children:f.ready?f.headroom==null?"not read yet":`${f.headroom}% free`:f.why})]},f.key))}),d&&a.jsx("p",{className:"ap-peek-rest",children:d})]}),document.body)}function wK({peers:e,strained:t,armed:n,threshold:r,open:s,onToggle:o,order:l,choices:u,onOrder:d,allOpen:h,onToggleAll:f,held:p=!1}){const[g,v]=w.useState(!1),k=w.useRef(0);w.useEffect(()=>()=>window.clearTimeout(k.current),[]),w.useEffect(()=>{s&&(window.clearTimeout(k.current),v(!1))},[s]);const b=E=>{s||(window.clearTimeout(k.current),k.current=window.setTimeout(()=>v(!0),E))},x=()=>{window.clearTimeout(k.current),k.current=window.setTimeout(()=>v(!1),F$)},N=()=>window.clearTimeout(k.current),S=()=>{window.clearTimeout(k.current),v(!1)},_=B9(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(),o()},onPointerEnter:E=>{E.pointerType==="mouse"&&b(D$)},onPointerLeave:x,onFocus:E=>{E.target.matches(":focus-visible")&&b(0)},onBlur:x,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(yK,{anchorId:"ap-rest-entry",id:"ap-rest-peek",peers:e,onHold:N,onLet:x}),s&&a.jsx(vK,{order:l,choices:u,onOrder:d,allOpen:h,onToggleAll:f,held:p})]})}function vK({order:e,choices:t,onOrder:n,allOpen:r,onToggleAll:s,held:o}){var d;const l=w.useRef(null);w.useLayoutEffect(()=>{const h=l.current,f=h==null?void 0:h.parentElement;if(!h||!f)return;const p=()=>f.style.setProperty("--rest-tools-w",`${Math.ceil(h.offsetWidth)}px`);if(p(),typeof ResizeObserver>"u")return;const g=new ResizeObserver(p);return g.observe(h),()=>{g.disconnect(),f.style.removeProperty("--rest-tools-w")}},[]);const u=((d=t.find(h=>h.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:h=>n(h.target.value),"aria-label":"Order of the other accounts",title:o?`${u} — held where it was while you are in the list`:u,"data-sorted":e===Vd?void 0:"","data-held":o?"":void 0,children:t.map(h=>a.jsx("option",{value:h.id,children:h.label},h.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 xK(e){return(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json().catch(()=>null)}const bK=1800;function kK({accounts:e,onClose:t,copyText:n}){const[r,s]=w.useState([]),[o,l]=w.useState(null),[u,d]=w.useState(!1),[h,f]=w.useState(null),[p,g]=w.useState(!1),[v,k]=w.useState(()=>Math.floor(Date.now()/1e3)),b=w.useRef(null),x=w.useRef(!1),N=yt(t,{focusRef:b}),S=ql(o!=null,b),_=ql(o==null,b);w.useEffect(()=>{if(!o)return;k(Math.floor(Date.now()/1e3));const $=window.setInterval(()=>k(Math.floor(Date.now()/1e3)),1e3);return()=>window.clearInterval($)},[o]);const E=k9(e),T=N9(e,r),R=T.length===e.length,A=$=>s(B=>j9(B,$)),q=w.useCallback(async()=>{const $=S9(T);if(!or(x.current)||!$)return;x.current=!0,d(!0),f(null),g(!1);const B=await xK($).catch(()=>null);if(x.current=!1,d(!1),!(B!=null&&B.ok)){f(Uo(B,"the share could not be made"));return}l({blob:B.blob,expiresAt:B.expiresAt,shared:B.shared??[],failed:B.failed??[]})},[e,T]),L=o?I$(o.expiresAt,v):null,P=(L==null?void 0:L.tone)==="gone",I=(o==null?void 0:o.shared.length)??0,O=P?"This share has expired":I===1?"1 account, ready to paste":`${I} accounts, ready to paste`,U=I===1?"this is the password":`this is ${I} passwords`,M=o?P?O:`${O} — ${U}`:"";return It.createPortal(a.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:a.jsxs("div",{ref:N,className:"modal sa-modal",onClick:$=>$.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:M}),o?a.jsxs("div",{className:"sa-step",children:[a.jsx("h4",{children:O}),a.jsx("code",{className:"ap-share-blob",children:o.blob}),a.jsxs("div",{className:"ap-share-foot",children:[a.jsx("button",{type:"button",className:"ap-manage-btn",ref:b,onClick:async()=>{if(P){_(),S(),l(null),q();return}await n(o.blob)&&(g(!0),window.setTimeout(()=>g(!1),bK))},children:P?"make a new share":p?"copied":`copy ${I===1?"the share":"all "+I}`}),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:U})," · ",a.jsx("span",{className:`ap-share-expiry ${L==null?void 0:L.tone}`,children:L==null?void 0:L.text})]})]}),o.failed.length>0&&a.jsxs("div",{className:"sa-failed",role:"alert",children:[a.jsx("p",{className:"sa-failed-head",children:o.failed.length===1?"One account is not in this bundle:":`${o.failed.length} accounts are not in this bundle:`}),a.jsx("ul",{className:"sa-list",children:o.failed.map($=>{var V;const B=!!($.email&&((V=$.detail)!=null&&V.includes($.email)));return a.jsxs("li",{children:[!B&&a.jsx("span",{className:"sa-who",children:$.email||`account ${$.num}`}),a.jsx("span",{className:"sa-why",children:$.detail||"could not be exported"})]},`${$.num}-${$.email}`)})})]}),a.jsx("p",{className:"sa-note",children:P?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:b,onClick:t,children:"Close"})})]}):a.jsxs("div",{className:"sa-step",children:[a.jsxs("h4",{children:["Which accounts go to the other ",bt,"?"]}),a.jsx("p",{className:`sa-count${T.length?"":" empty"}`,children:_9(T.length)}),a.jsx("ul",{className:"sa-list sa-pick",children:E.map($=>a.jsx("li",{children:a.jsxs("label",{className:"sa-row",children:[a.jsx("input",{type:"checkbox",checked:T.includes($.num),onChange:()=>A($.num)}),a.jsx("span",{className:"sa-who",children:$.label}),$.sub&&a.jsx("span",{className:"sa-sub",children:$.sub})]})},$.num))}),h&&a.jsx("p",{className:"aa-err",role:"alert",children:h}),a.jsxs("div",{className:"sa-actions",children:[a.jsx("button",{type:"button",className:"btn",onClick:()=>s(R?e.map($=>$.num):[]),children:R?"Clear all":"Select all"}),a.jsx("button",{type:"button",className:"btn primary",ref:b,...Ir(u,!T.length),onClick:()=>{S(),q()},children:u?"making the share…":T.length===0?"Share":T.length===1?"Share 1 account":`Share ${T.length} accounts`})]})]})]})]})}),document.body)}function rI(e,t){var n;return!e.disabled&&!((n=ii(e,t))!=null&&n.blocksSwitch)}function NK(e,t,n){return e.map(r=>{const s=ii(r,t,n==null?void 0:n(r));return{key:Mr(r),name:r.alias??r.email??`account ${r.num}`,ready:rI(r,t),why:r.disabled?"held out":s!=null&&s.blocksSwitch?s.text:null,warn:(s==null?void 0:s.tone)==="warn",headroom:r.headroom}})}function jK(e,t){const n=Number(t);return(e==null?void 0:e.headroom)!=null&&Number.isFinite(n)&&100-e.headroom>=n}function SK(e){return(e==null?void 0:e.ok)===!0&&(e.enabled||e.external)}const sI="agent-dag.otherAccountsOrder",aI="agent-dag.otherAccountsOpen";function _K(){const e=Qe(sI);return typeof e=="string"&&e.length>0&&e.length<=64?e:Vd}function EK(e){Ye(sI,e)}function CK(){const e=Qe(aI);if(!e)return Ex;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 Ex}function TK(e){Ye(aI,JSON.stringify({mode:e.mode,keys:e.keys.filter(t=>!t.startsWith("slot:"))}))}function RK(){const[e,t]=w.useState(null),n=w.useRef(null),r=w.useCallback(l=>zd(n.current)?(n.current=l,t(l),!0):!1,[]),s=w.useCallback(()=>{n.current=null,t(null)},[]);return{busy:e,claim:r,release:s,pressProps:(l,u=!1)=>{const d=Xs(e,l);return{disabled:d.disabled,"aria-busy":d.busy||u}}}}const AK=8e3,MK=1800,$K=4e3;function IK({claim:e,release:t,load:n,clearFailure:r,rescueFocus:s}){const[o,l]=w.useState(null),u=(o==null?void 0:o.num)??null,d=w.useRef(o);d.current=o;const[h,f]=w.useState(null),[p,g]=w.useState(""),[v,k]=w.useState(null),b=w.useRef(0);w.useEffect(()=>{if(v==null)return;const J=window.setTimeout(()=>k(null),$K);return()=>window.clearTimeout(J)},[v]);const[x,N]=w.useState(null),[S,_]=w.useState(!1),[E,T]=w.useState(null),[R,A]=w.useState(null),q=w.useCallback(async(J,G)=>{if(!e(G))return null;r(),f(null);try{const K=await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(J)}),X=await K.json().catch(()=>null);return X!=null&&X.ok||f({text:Uo(X,"command failed",K.status)}),X}catch{return f({text:"server unreachable"}),null}finally{t()}},[e,t,r]),L=w.useCallback(()=>{l(null),f(null),k(null),N(null),_(!1)},[]),P=(J,G="first")=>{L(),A(null),l({num:J,view:"menu",start:G})},I=w.useCallback(J=>{var X,Z;const G=d.current;if(!G||J!=null&&G.num!==J)return;const K=document.getElementById(`ap-menu-${G.num}`);(K!=null&&K.contains(document.activeElement)||hs(((X=document.activeElement)==null?void 0:X.tagName)??null))&&((Z=document.getElementById(`ap-more-${G.num}`))==null||Z.focus()),L()},[L]),O=w.useCallback(J=>f(J),[]),U=(J,G)=>{g(G??""),f(null),l({num:J,view:"rename"})},M=J=>g(J),$=J=>{A(null),f(null),l({num:J,view:"move"})},B=J=>A(J),V=async J=>{var K;_(!1);const G=await q({action:"share",account:J},`share-${J}`);!(G!=null&&G.ok)||((K=d.current)==null?void 0:K.num)!==J||(N({num:J,blob:G.blob,expiresAt:G.expiresAt}),l({num:J,view:"share"}))},H=async J=>{await Ba(J)&&(_(!0),window.setTimeout(()=>_(!1),MK))},F=async(J,G)=>{const{commit:K,alias:X}=O9(p,G);if(K){const Z=await q({action:"alias",account:J,alias:X},`alias-${J}`);if(await n(!0),!(Z!=null&&Z.ok))return}I(J)},W=async(J,G)=>{var Z,ee,se;const K=await q({action:"move",account:J,slot:G},`move-${J}`),X=$9({menuFor:((Z=d.current)==null?void 0:Z.num)??null,shareFor:(x==null?void 0:x.num)??null},J,K);if(await n(!0),X){if(X.menuFor!=null){const ae=document.getElementById(`ap-menu-${J}`),re=document.getElementById(`ap-more-${X.menuFor}`);re&&(ae!=null&&ae.contains(document.activeElement)||hs(((ee=document.activeElement)==null?void 0:ee.tagName)??null))&&re.focus()}((se=d.current)==null?void 0:se.num)===J&&L(),k(X.confirmRemove),X.shareFor==null&&(N(null),_(!1)),T(X.swapNote);const ue=X.swapNote;ue&&window.setTimeout(()=>T(ae=>ae===ue?null:ae),AK),A(null),s(X.menuFor)}return K};return{menu:o,menuFor:u,menuError:h,aliasDraft:p,confirmRemove:v,share:x,shareCopied:S,slotDraft:R,swapNote:E,showMenu:P,dropMenu:L,closeMenu:I,sayInMenu:O,startRename:U,typeAlias:M,doAlias:F,startMove:$,pickSlot:B,doSlot:async(J,G,K)=>{if(!K.sends){I(J);return}await W(J,G)},makeShare:V,copyShare:H,pressRemove:J=>{const G=Date.now(),K=Ol({armedFor:v,target:J,armedAt:b.current,now:G,gapMs:Il});if(K==="arm"){k(J),b.current=G;return}K!=="ignore"&&(k(null),q({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&&L(),s(null))}))}}}function OK(e,t){return!e||!t||t.some(n=>n.num===e.num&&n.active)?e:null}function LK({data:e,claim:t,release:n,load:r,sayFailure:s,clearFailure:o,sayInMenu:l,rescueFocus:u}){const[d,h]=w.useState(null),f=w.useCallback(async(g,v,k="panel")=>{if(!t(v))return null;const b=k==="menu"?l:s;b(null);try{const x=await fetch("/api/cswap-auto",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(g)}),N=await x.json().catch(()=>null);return N!=null&&N.ok||b({text:Cx(N,"command failed",x.status),raw:Dl(N)}),N}catch{return b({text:"server unreachable"}),null}finally{n()}},[t,n,l,s]);return w.useEffect(()=>{!(e!=null&&e.ok)||!e.accounts||h(g=>OK(g,e.accounts))},[e]),{switched:d,post:f,doSwitch:async(g,v)=>{if(t(`switch-${g}`)){o(),h(null);try{const b=await(await fetch("/api/claude-accounts/switch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({account:g})})).json().catch(()=>null);b!=null&&b.ok?h({num:g,name:v}):s({text:Cx(b,"the switch failed"),raw:Dl(b),row:g}),await r(!0)}catch{s({text:"server unreachable",row:g})}finally{n(),u(g)}}}}}const PK=1800;function DK({auto:e,post:t,load:n}){var k;const[r,s]=w.useState(null),[o,l]=w.useState(!1),u=w.useRef(null),d=w.useRef(null),h=((k=e==null?void 0:e.settings["autoswitch.threshold"])==null?void 0:k.value)??"90",f=r??h,p=D9(f,h);return{threshold:h,thresholdPick:f,thresholdCtl:p,thresholdSaved:o,thresholdRef:u,thresholdSaveRef:d,proposeThreshold:b=>s(b),doThreshold:async(b,x)=>{if(x.sends){const N=await t({action:"setting",key:"autoswitch.threshold",value:b},"threshold");if(await n(!0),!(N!=null&&N.ok))return;s(null)}l(!0),window.setTimeout(()=>{var N;document.activeElement===d.current&&((N=u.current)==null||N.focus()),l(!1)},PK)}}}const FK=Object.freeze({text:"couldn't reach the deck server",reload:!0}),qK=Object.freeze({text:"still waiting on the deck server — claude-swap can be slow to answer",reload:!0});async function vS(e){return e.ok?{ok:!0,status:e.status,body:null}:{ok:!1,status:e.status,body:await e.json().catch(()=>null)}}function BK(e){const t=e.find(r=>!r.ok);if(!t)return null;const n=Dl(t.body);return{text:Cx(t.body,`the deck server answered ${t.status}`),...n?{raw:n}:{},reload:!0}}function xS(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 oI=15e3,UK=3e4;function zK(e){const[t,n]=w.useState(null),[r,s]=w.useState(null),[o,l]=w.useState(!1),[u,d]=w.useState(null),h=w.useRef(null),f=w.useCallback(async(v=!1)=>{v&&l(!0);const k=new AbortController,b=window.setTimeout(()=>k.abort(),UK);try{const[x,N]=await Promise.all([fetch(`/api/claude-accounts${v?"?refresh=1":""}`,{signal:k.signal}),fetch("/api/cswap-auto",{signal:k.signal})]);if(x.ok){const _=await x.json();n(_),e(_)}N.ok&&s(await N.json());const S=BK([await vS(x),await vS(N)]);d(_=>xS(_,S))}catch{d(x=>xS(x,k.signal.aborted?qK:FK))}finally{window.clearTimeout(b),v&&l(!1)}},[e]);w.useEffect(()=>(f(!0),h.current=window.setInterval(()=>f(!1),oI),()=>{h.current!=null&&window.clearInterval(h.current)}),[f]);const p=w.useCallback(v=>d(v),[]),g=w.useCallback(()=>d(null),[]);return{data:t,auto:r,reloading:o,failure:u,load:f,sayFailure:p,clearFailure:g}}const WK="#ap-rest-entry";function HK(e){return[`#${e}`,WK,...o$(null)]}function VK(e){const t=w.useRef(null),n=s=>{t.current=s.target.id||null},r=s=>{s.target.isConnected&&(t.current=null)};return w.useLayoutEffect(()=>{var o;const s=t.current;if(!(!s||!hs(((o=document.activeElement)==null?void 0:o.tagName)??null)))for(const l of HK(s)){const u=document.querySelector(l);if(u){u.focus();return}}},[e]),{onFocus:n,onBlur:r}}function GK({onClose:e,leaving:t,onReport:n}){var vr,ys,Jt;const{busy:r,claim:s,release:o,pressProps:l}=RK(),[u,d]=w.useState("accounts"),[h,f]=w.useState(!1),[p,g]=w.useState(null),v=w.useRef(p);v.current=p;const[k,b]=w.useState(!1),[x,N]=w.useState(!1),[S,_]=w.useState([]),[E,T]=w.useState(!1),[R,A]=w.useState(null),[q,L]=w.useState(CK),[P,I]=w.useState(_K),[O,U]=w.useState(null),[M,$]=w.useState(!1),B=w.useCallback(ge=>L(qe=>j7(qe,ge.accounts)),[]),{data:V,auto:H,reloading:F,failure:W,load:D,sayFailure:Y,clearFailure:J}=zK(B),G=VK(V),K=w.useCallback(ge=>{window.requestAnimationFrame(()=>{var qe;if(hs(((qe=document.activeElement)==null?void 0:qe.tagName)??null))for(const Ze of o$(ge)){const Qt=document.querySelector(Ze);if(Qt){Qt.focus();return}}})},[]),X=IK({claim:s,release:o,load:D,clearFailure:J,rescueFocus:K}),{menu:Z,menuFor:ee,swapNote:se,showMenu:ue,dropMenu:ae,closeMenu:re,sayInMenu:de}=X,{switched:me,post:pe,doSwitch:ke}=LK({data:V,claim:s,release:o,load:D,sayFailure:Y,clearFailure:J,sayInMenu:de,rescueFocus:K}),{threshold:xe,thresholdPick:fe,thresholdCtl:Te,thresholdSaved:Fe,thresholdRef:Oe,thresholdSaveRef:We,proposeThreshold:le,doThreshold:je}=DK({auto:H,post:pe,load:D}),Re=f$();w.useEffect(()=>{TK(q)},[q]),w.useEffect(()=>{EK(P)},[P]);const[Le,et]=w.useState(()=>new Set),rt=w.useCallback(ge=>et(new Set(ge)),[]),Je=ge=>({noCopyWorksNearby:Le.has(tS([ge])[0].key)}),it=(vr=V==null?void 0:V.accounts)==null?void 0:vr.find(ge=>ge.active),Ue=it?ii(it,Re,Je(it)):null,lt=(V==null?void 0:V.accounts)??[],He=it?lt.filter(ge=>!ge.active):[],ft=j$(He),Vt=x7(P,He),Xe=_x(v7(He,Vt,ge=>rI(ge,Re)),O),pt=w.useRef(!1),Ot=w.useRef(!1),fn=w.useRef(!1),Lt=w.useCallback(()=>{!pt.current&&!Ot.current&&!fn.current&&U(null)},[]),qt=()=>U(ge=>ge??Xe.map(Mr)),Zt={onPointerEnter:()=>{pt.current=!0,qt()},onPointerLeave:()=>{pt.current=!1,Lt()},onFocus:ge=>{ge.target.matches(":focus-visible")&&(Ot.current=!0,qt())},onBlur:ge=>{ge.currentTarget.contains(ge.relatedTarget)||(Ot.current=!1,Lt())}},Bt=ee!=null&&He.some(ge=>ge.num===ee)||p!=null&&He.some(ge=>ge.num===p.num);w.useEffect(()=>{fn.current=Bt,Bt||Lt()},[Bt,Lt]);const pr=M&&He.length>0;w.useEffect(()=>{pr||(pt.current=Ot.current=fn.current=!1,U(null))},[pr]);const qr=w.useRef(!1);w.useEffect(()=>{qr.current&&He.length===0&&K(null),qr.current=He.length>0},[He.length,K]);const Br=Xe.length?lt.filter(ge=>ge.active):lt,ms=NK(Xe,Re,Je),mr=jK(it,xe),gr=SK(H),Nn=ge=>M&&Xe.some(qe=>qe.num===ge)?"ap-rest-list":"ap-scroll",Ur=(ge,qe="first")=>{ue(ge,qe),g(null)},jn=(ge,qe)=>{ae(),g(Ze=>(Ze==null?void 0:Ze.anchor)===qe?null:{num:ge,anchor:qe})},gs=w.useCallback((ge=!1)=>{var Ze;const qe=v.current;ge&&qe&&((Ze=document.getElementById(qe.anchor))==null||Ze.focus()),g(null)},[]),zn=()=>{ae(),g(null),d("lan")},Wn=w.useRef(u);w.useEffect(()=>{Wn.current!==u&&(Wn.current=u,window.requestAnimationFrame(()=>{var ge;(ge=document.getElementById(u==="lan"?"ap-lan-back":"ap-lan-entry"))==null||ge.focus()}))},[u]),w.useEffect(()=>{V!=null&&V.ok&&f(!0)},[V==null?void 0:V.ok]),w.useEffect(()=>{t&&(ae(),g(null))},[t,ae]),w.useEffect(()=>{Z&&(V!=null&&V.accounts)&&!V.accounts.some(ge=>ge.num===Z.num)&&ae(),p&&(V!=null&&V.accounts)&&!V.accounts.some(ge=>ge.num===p.num)&&g(null)},[V,Z,p,ae]),w.useEffect(()=>{R==null||!(V!=null&&V.accounts)||V.accounts.some(ge=>ge.num===R.num)||(A(null),K(null))},[V,R,K]);const vt=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"})})}),yr=ge=>{const qe=S$(q,ge),Ze=ee===ge.num,Qt=(W==null?void 0:W.row)===ge.num?W:null,zr=(me==null?void 0:me.num)===ge.num,xr=(se==null?void 0:se.at)===ge.num?se:null,ws=xr?lt.find(Wr=>Wr.num===xr.displaced):void 0,Sn=(p==null?void 0:p.anchor)===`ap-issue-${ge.num}`;return a.jsx(E7,{a:ge,nowSec:Re,lan:Je(ge),opened:qe,onToggleLanes:()=>L(Wr=>k7(Wr,ge)),busy:r,pressProps:l,onSwitch:ke,menuOpen:Ze,onOpenMenu:Ur,onCloseMenu:re,refusal:Qt,onDismissRefusal:()=>J(),switchedHere:zr,swapped:xr,displaced:ws,issueExpanded:Sn,onOpenIssue:jn,sortKey:ge.active?null:w7(Vt)},ge.num)},wr=V!=null&&V.ok&&(H!=null&&H.ok)?a.jsx(X7,{auto:H,threshold:xe,thresholdPick:fe,thresholdCtl:Te,thresholdSaved:Fe,thresholdRef:Oe,thresholdSaveRef:We,proposeThreshold:le,doThreshold:je,pressProps:l,post:pe,load:D}):null;return a.jsxs("aside",{className:`accounts-panel${t?" leaving":""}`,id:"accounts-panel","aria-label":"Claude accounts",onFocus:G.onFocus,onBlur:G.onBlur,children:[u==="accounts"&&a.jsx(T7,{canShare:(((ys=V==null?void 0:V.accounts)==null?void 0:ys.length)??0)>0,canReport:(((Jt=V==null?void 0:V.accounts)==null?void 0:Jt.length)??0)>1||x,onAdd:()=>b(!0),onReport:()=>{_([...Br,...Xe].map(Mr)),N(!0)},onShareSet:()=>T(!0),onReload:()=>D(!0),pressProps:l,reloading:F,closeButton:vt}),u==="accounts"&&a.jsx("div",{className:"ap-scroll",id:"ap-scroll",children:V==null?W?a.jsxs("div",{className:"ap-empty",role:"alert",children:[a.jsx("span",{title:W.raw||void 0,children:W.text}),a.jsxs("span",{className:"ap-hint",children:["No accounts have arrived, so there is nothing to show yet. The panel keeps trying every ",oI/1e3," seconds."]}),a.jsx("button",{type:"button",className:"ap-fix",...l("reload",F),onClick:()=>D(!0).then(()=>K(null)),children:F?"trying…":"try again"})]}):a.jsx("div",{className:"ap-empty",children:"Checking…"}):V.ok?a.jsxs(a.Fragment,{children:[it&&(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":(p==null?void 0:p.anchor)==="ap-notice","aria-controls":(p==null?void 0:p.anchor)==="ap-notice"?"ap-issue-pop":void 0,onClick:()=>jn(it.num,"ap-notice"),children:[a.jsx(Bb,{}),a.jsx("span",{className:"ap-issue-text",children:"Current account needs attention"})]}),Ue.fix&&a.jsx("button",{type:"button",className:"ap-notice-fix",onClick:()=>b(!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:Br.map(yr)}),Xe.length>0&&a.jsx(wK,{peers:ms,strained:mr,armed:gr,threshold:H!=null&&H.ok?xe:null,open:M,onToggle:()=>$(ge=>!ge),order:Vt,choices:ft,onOrder:I,allOpen:_$(q,Xe),onToggleAll:()=>L(ge=>N7(ge,Xe)),held:O!=null}),Xe.length>0&&M&&a.jsxs("div",{className:"ap-rest-panel",id:"ap-rest-panel",children:[a.jsx("ul",{className:"ap-list ap-others",id:"ap-rest-list",...Zt,children:Xe.map(yr)}),wr]}),Xe.length===0&&wr,W&&W.row==null&&a.jsxs("div",{className:"ap-failure",role:"alert",children:[a.jsx("span",{className:"ap-failure-text",title:W.raw||void 0,children:W.text}),a.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>J(),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),Z&&(()=>{var qe;const ge=(qe=V.accounts)==null?void 0:qe.find(Ze=>Ze.num===Z.num);return ge?a.jsx(F9,{a:ge,accountMenu:X,slots:(V.accounts??[]).map(Ze=>Ze.num),boundaryId:Nn(ge.num),nowSec:Re,busy:r,pressProps:l,rotating:!!(H!=null&&H.enabled||H!=null&&H.external),onProjects:()=>{A({num:ge.num,name:ge.alias??ge.email??`account ${ge.num}`}),re(ge.num)},onRotation:()=>pe({action:"account",account:ge.num,enabled:ge.disabled},`rot-${ge.num}`,"menu").then(Ze=>{D(!0),Ze!=null&&Ze.ok&&re(ge.num)})}):null})(),p&&(()=>{var Ze;const ge=(Ze=V.accounts)==null?void 0:Ze.find(Qt=>Qt.num===p.num),qe=ge?ii(ge,Re,Je(ge)):null;return!ge||!qe?null:a.jsx(l7,{anchorId:p.anchor,boundaryId:p.anchor==="ap-notice"?"ap-scroll":Nn(ge.num),issue:qe,who:ge.alias??ge.email??`account ${ge.num}`,fetchedAt:ge.fetchedAt,nowSec:Re,onClose:gs,onSignIn:()=>b(!0),onReport:n&&(()=>n({initialKind:qe.tone==="warn"?"bug":"other",initialBody:`Account issue: ${qe.text}. ${qe.hint}`}))})})()]}):a.jsx(C7,{data:V})}),a.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:me?`Now active: ${me.name}`:""}),h&&a.jsx(gK,{accounts:tS((V==null?void 0:V.accounts)??[]),onChanged:()=>D(!0),onNoCopy:rt,view:u==="lan",onOpen:zn,onBack:()=>d("accounts"),closeButton:vt}),k&&a.jsx(A9,{onClose:()=>b(!1),onChanged:()=>D(!0)}),E&&a.jsx(kK,{accounts:((V==null?void 0:V.accounts)??[]).map(ge=>({num:ge.num,email:ge.email,alias:ge.alias,org:ge.org})),onClose:()=>T(!1),copyText:Ba}),R!=null&&(()=>{var qe;const ge=(qe=V==null?void 0:V.accounts)==null?void 0:qe.find(Ze=>Ze.num===R.num);return V!=null&&V.accounts&&!ge?null:a.jsx(o7,{num:R.num,name:ge?ge.alias??ge.email??`account ${ge.num}`:R.name,onClose:()=>A(null)})})(),x&&a.jsx(K7,{accounts:(V==null?void 0:V.accounts)??null,order:S,failed:W!=null&&W.reload?W.text:null,nowSec:Re,onClose:()=>N(!1)})]})}const KK=16,YK=120;function XK(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 ZK(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 JK(e,t){return XK(e,t,KK)?"over":ZK(e,t)<=YK?"near":"far"}function QK(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 eY(){const[e,t]=w.useState(!1),[n,r]=w.useState(""),[s,o]=w.useState("far"),l=w.useRef(null),u=Bu(e,140),d=w.useCallback(g=>{var b;const v=(b=l.current)==null?void 0:b.getBoundingClientRect(),k=QK(g);return v&&k?JK(k,v):"far"},[]),h=w.useCallback(g=>{g!==null&&(r(g),t(!0)),o("far")},[]),f=w.useCallback(g=>{o(d(g))},[d]),p=w.useCallback((g,v)=>{const k=v&&d(g)==="over";return t(!1),k},[d]);return{trashDragging:e,trashLabel:n,trashState:s,trashZoneRef:l,trashPhase:u,beginTrashDrag:h,trackTrashDrag:f,endTrashDrag:p}}const tY=420;function nY(){const[e,t]=w.useState(!1),n=w.useRef(null),r=w.useCallback(()=>{n.current&&(window.clearTimeout(n.current),n.current=null),t(!1)},[]),s=w.useCallback(o=>{o.length!==0&&queueMicrotask(()=>{t(!0),n.current&&window.clearTimeout(n.current),n.current=window.setTimeout(()=>t(!1),tY+80)})},[]);return w.useEffect(()=>()=>{n.current&&window.clearTimeout(n.current)},[]),{bubbling:e,endBubble:r,onBubble:s}}const Jb=11,iI=7.2,lI=6.6,rY={width:104,height:48},bS={width:96,height:44},cI={width:220,height:103};function sY(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)?cI:{width:Math.max(160,t),height:Math.max(72,n)}}function jp(e,t,n){return e.width*t>=n.width&&e.height*t>=n.height}function aY(e,t,n=cI){if(!Number.isFinite(t)||t<=0)return e??"detail";const r=Jb*t;return e==="detail"?r>=lI?"detail":jp(n,t,bS)?"compact":"overview":r>=iI?"detail":e==="compact"?jp(n,t,bS)?"compact":"overview":jp(n,t,rY)?"compact":"overview"}const oY=iI/Jb,iY=lI/Jb;function lY(e,t){return e>=oY?e:Math.max(e,Math.min(t,iY-.001))}const cY=.8,uY=1;function dY({stateRef:e,measuredRef:t,measuredVersionRef:n,canvasRef:r}){const[s,o]=w.useState("detail"),l=w.useRef(null),u=w.useRef(null),d=w.useCallback(()=>{var v;const f=n.current;if(((v=u.current)==null?void 0:v.version)===f)return u.current.card;const p=[];for(const k of e.current.agents.keys()){const b=t.current.get(k);b&&p.push(b)}const g=sY(p);return u.current={version:f,card:g},g},[]),h=w.useCallback(f=>{var g;const p=aY(l.current,f,d());return p===l.current?null:(l.current=p,(g=r.current)==null||g.setAttribute("data-lod",p),o(p),p)},[d,r]);return{lod:s,lodRef:l,applyZoom:h}}const hY=40,fY=120;function pY(e,t){let n=null,r=0,s=Number.NEGATIVE_INFINITY;const o=()=>{n=null,s=t.now(),e()},l=()=>{n!=null&&(t.clearTimeout(n),n=null)},u=(d,h,f)=>{if(n!=null){if(r<=d)return;l()}const p=Math.min(f,Math.max(0,d-h));r=d,n=t.setTimeout(o,p)};return{live(d=hY){const h=t.now(),f=Math.max(s+d,h);if(f<=h){l(),o();return}u(f,h,d)},replay(d=fY){l(),r=t.now()+d,n=t.setTimeout(o,d)},flush(){l(),o()},cancel(){l()}}}const mY=1024*1024,kS=5,uI=.8,Dx=24,gY="agent-dag.soundCustom.done",yY="agent-dag.soundCustom.needs-input",bl={done:gY,"needs-input":yY};function Bl(e){if(e.kind!=="audio")return e;const{bytes:t,...n}=e;return n}function NS(e){return!e||!/^[a-zA-Z0-9._-]{1,96}$/.test(e)?null:e}function wY(e){return{done:NS(e(bl.done)),"needs-input":NS(e(bl["needs-input"]))}}function vY(e,t){return{done:e.done===t?null:e.done,"needs-input":e["needs-input"]===t?null:e["needs-input"]}}function xY(e){return e.done&&e.done===e["needs-input"]?e.done:null}const bY={wav:"audio/wav",wave:"audio/wav",mp3:"audio/mpeg",ogg:"audio/ogg",oga:"audio/ogg",webm:"audio/webm",m4a:"audio/mp4",mp4:"audio/mp4"},dI=new Set(["audio/wav","audio/x-wav","audio/mpeg","audio/mp3","audio/ogg","audio/webm","audio/mp4"]);function hI(e,t){const n=t.toLowerCase().split(";")[0].trim();if(dI.has(n))return n;const r=e.toLowerCase().split(".").pop()??"";return bY[r]??n}function jS(e,t){const n=hI(e.name,e.type);if(!dI.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>mY)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>kS)return`Audio must be ${kS} seconds or shorter.`}return null}function Fx(e){return e>=Dx?`There are already ${Dx} custom sounds. Delete one first.`:null}function kY(e,t){const n=e.indexOf(t);return n<0?null:e[n+1]??e[n-1]??null}function NY(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,uI/t)}function fI(){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 jY(e,t,n=fI()){var h;const r=((h=e.name)==null?void 0:h.trim())||"Custom sound",s=jS({name:r,type:e.type,size:e.size});if(s)throw new Error(s);const o=await e.arrayBuffer();let l;try{l=await t(o.slice(0))}catch{throw new Error("The audio file could not be decoded.")}const u=jS({name:r,type:e.type,size:e.size},l.duration);if(u)throw new Error(u);const d=Array.from({length:l.numberOfChannels},(f,p)=>l.getChannelData(p));return{id:n,name:r.replace(/\.(wav|wave|mp3|ogg|oga|webm|m4a|mp4)$/i,"")||"Custom sound",kind:"audio",mime:hI(r,e.type),duration:l.duration,normalizationGain:NY(d),bytes:o}}function SY(e,t=fI()){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,o=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,o))}}const _Y="ccdeck-notification-audio",EY=2,cr="assets",Pr="summaries";function Jl(){return typeof window<"u"?window.ccdeckNotificationAudio??null:null}function CY(){return new Promise((e,t)=>{const n=indexedDB.open(_Y,EY);n.onupgradeneeded=r=>{const s=n.result,o=s.objectStoreNames.contains(cr)?n.transaction.objectStore(cr):s.createObjectStore(cr,{keyPath:"id"});if(s.objectStoreNames.contains(Pr))return;const l=s.createObjectStore(Pr,{keyPath:"id"});if(r.oldVersion<1)return;const u=o.openCursor();u.onsuccess=()=>{const d=u.result;d&&(l.put(Bl(d.value)),d.continue())}},n.onsuccess=()=>e(n.result),n.onerror=()=>t(n.error??new Error("Could not open local audio storage."))})}async function Ql(e,t,n){const r=await CY();try{return await new Promise((s,o)=>{const l=r.transaction(e,t),u=n(l),d=()=>o(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 TY(){const e=Jl();return e?e.list():typeof indexedDB>"u"?[]:await Ql([Pr],"readonly",t=>t.objectStore(Pr).getAll())??[]}async function RY(e){const t=Jl();return t?t.get(e):typeof indexedDB>"u"?null:await Ql([cr],"readonly",n=>n.objectStore(cr).get(e))??null}async function SS(e){const t=Jl();if(t){await t.put(e);return}if(typeof indexedDB>"u")throw new Error("Local audio storage is unavailable in this browser.");await Ql([cr,Pr],"readwrite",n=>{n.objectStore(cr).put(e),n.objectStore(Pr).put(Bl(e))})}async function AY(e,t){const n=Jl();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 Ql([cr,Pr],"readwrite",r=>{const s=r.objectStore(cr),o=s.get(e);o.onsuccess=()=>{const l=o.result;if(!l)return;const u={...l,name:t};s.put(u),r.objectStore(Pr).put(Bl(u))}})}async function MY(e){const t=Jl();if(t){await t.remove(e);return}typeof indexedDB>"u"||await Ql([cr,Pr],"readwrite",n=>{n.objectStore(cr).delete(e),n.objectStore(Pr).delete(e)})}const Hu=["done","needs-input"],$Y=[{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}]}],IY=[{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}]}],Qb={done:$Y,"needs-input":IY},xn="two";function qx(e,t){const n=Qb[e];return n.find(r=>r.id===t)??n.find(r=>r.id===xn)??n[0]}function pI(e,t){return Qb[e].some(r=>r.id===t)?t:xn}qx("done",xn).notes,qx("needs-input",xn).notes;const _S=.04,mI=.24,Vu=0,yd=100,Bx=5,Da=50;function li(e){if(!Number.isFinite(e))return Da;const t=Math.round(e/Bx)*Bx;return Math.min(yd,Math.max(Vu,t))}function gI(e){if(e==null)return Da;const t=e.trim();return/^-?\d+(\.\d+)?$/.test(t)?li(Number(t)):Da}function e0(e){const t=li(e),n=_S+(mI-_S)*(t/yd);return Math.round(n*1e4)/1e4}function OY(e,t){const n=t.trim,r=typeof n=="number"&&Number.isFinite(n)&&n>0&&n<=1?n:1;return Math.round(e0(e)*r*1e4)/1e4}const LY=.012,ES=1e-4;function PY(e){return Math.min(1,e0(e)/mI)}function DY(e,t){const n=e*(e0(t)/uI);return Math.max(1e-4,n)}const FY=160,qY="agent-dag.soundLevel.done",BY="agent-dag.soundLevel.needs-input",UY="agent-dag.soundFigure.done",zY="agent-dag.soundFigure.needs-input",yI={done:qY,"needs-input":BY},wd={done:UY,"needs-input":zY},Ux={done:{level:Da,figure:xn},"needs-input":{level:Da,figure:xn}};function WY(e){const t=n=>({level:gI(e(yI[n])),figure:pI(n,e(wd[n]))});return{done:t("done"),"needs-input":t("needs-input")}}function HY(e,t){return(e??Ux)[t]??Ux[t]}const VY={Stop:"done",Notification:"needs-input"};function GY(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:$t(VY,n)??null}const KY=6,YY="ccdeck-tabs";function XY(e){return e>=KY}function ZY(e,t,n){const r=s=>{const o=s.data;(o==null?void 0:o.kind)==="who"&&o.from!==t&&e.postMessage({kind:"here",from:t,to:o.from,streaming:n()})};return e.addEventListener("message",r),{ask(s,o=(l,u)=>setTimeout(l,u)){return new Promise(l=>{const u=new Set,d=h=>{const f=h.data;(f==null?void 0:f.kind)==="here"&&f.to===t&&f.streaming&&u.add(f.from)};e.addEventListener("message",d),e.postMessage({kind:"who",from:t}),o(()=>{e.removeEventListener("message",d),l(u.size)},s)})},leave(){var s;e.removeEventListener("message",r),(s=e.close)==null||s.call(e)}}}function JY({stateRef:e,rerender:t,pauseGate:n,chimesRef:r,desktopUpdateRef:s}){const[o,l]=w.useState(!1),[u,d]=w.useState(!1),[h,f]=w.useState(!1),p=w.useRef(!0),[g,v]=w.useState(null);return w.useEffect(()=>{const k=new EventSource("/events"),b=pY(t,{now:()=>Date.now(),setTimeout:(_,E)=>window.setTimeout(_,E),clearTimeout:_=>window.clearTimeout(_)});let x=!1;const N=typeof BroadcastChannel=="function"?ZY(new BroadcastChannel(YY),Math.random().toString(36).slice(2),()=>x):null,S=window.setInterval(()=>{x||!N||N.ask(600).then(_=>{x||d(XY(_))})},3e3);return k.addEventListener("open",()=>{l(!0),f(!0)}),k.addEventListener("error",()=>{l(!1),v(null)}),k.addEventListener("open",()=>{x=!0,d(!1)}),k.addEventListener("error",()=>{x=!1}),k.addEventListener("replay-end",()=>{p.current=!1,b.flush(),v(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=pM(e.current,T);const R=T.replay===!0||p.current||Date.now()-T.receivedAt>3e4;R?b.replay():b.live();const A=GY(T,R);A&&((E=r.current)==null||E.play(A))}catch{}}),()=>{k.close(),b.cancel(),window.clearInterval(S),N==null||N.leave()}},[t]),{live:o,tabCapped:u,everConnected:h,liveSince:g}}const QY=200,eX=5*6e4,tX=6,nX=2*6e4;function Au(e,t){if(t.size!==0)for(const n of Array.from(e.keys()))t.has(n)||e.delete(n)}function rX(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 sX(e){const t=new Set;for(const n of e)t.add(n.id),t.add(`group:${n.sessionId}`),n.kind==="root"&&t.add(Rb(n.id));return t}function aX(e){const t=new Set;for(const n of e)t.add(n.id),n.kind==="root"&&t.add(Rb(n.id));return t}function oX(e,t){let n=t8(e,t,YN);n8(e,t,YN)&&(n=!0);const r=[],s=o=>{r.push(o)};return Jq(e,t,QY,eX,s)&&(n=!0),Qq(e,t,tX,nX,s)&&(n=!0),{changed:n,forgotten:r}}function iX(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 o of r)s=o;return{ids:r,primary:s}}function lX(e,t){const[n,r]=w.useState(()=>({ids:new Set,primary:null})),{ids:s,primary:o}=n,l=w.useCallback((h,f,p=!f)=>{r(g=>iX(g,h,f)),!f&&p&&t(!0)},[]),u=w.useCallback(()=>{r({ids:new Set,primary:null})},[]),d=w.useCallback(()=>{r(h=>{const f=rX(h.ids,e.current.agents),p=h.primary!=null&&!e.current.agents.has(h.primary)?null:h.primary;return f===h.ids&&p===h.primary?h:{ids:f,primary:p}})},[e]);return{selectedIds:s,primarySelectedId:o,selectAgent:l,clearSelection:u,pruneSelectionToBoard:d}}function cX({stateRef:e,rerender:t,pruneSelectionToBoard:n,setContextFor:r,setSummaryFor:s}){const[o,l]=w.useState(Date.now());return w.useEffect(()=>{const u=setInterval(()=>{const d=Date.now();l(d);const{changed:h,forgotten:f}=oX(e.current,d);f.length>0&&fetch("/api/forget",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({ids:f})}).catch(()=>{}),n(),r(p=>p!=null&&!e.current.agents.has(p)?null:p),s(p=>p!=null&&!e.current.agents.has(p)?null:p),h&&t()},250);return()=>clearInterval(u)},[t]),o}function t0(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 Sp,CS;function uX(){if(CS)return Sp;CS=1;function e(){this.__data__=[],this.size=0}return Sp=e,Sp}var _p,TS;function gi(){if(TS)return _p;TS=1;function e(t,n){return t===n||t!==t&&n!==n}return _p=e,_p}var Ep,RS;function Xd(){if(RS)return Ep;RS=1;var e=gi();function t(n,r){for(var s=n.length;s--;)if(e(n[s][0],r))return s;return-1}return Ep=t,Ep}var Cp,AS;function dX(){if(AS)return Cp;AS=1;var e=Xd(),t=Array.prototype,n=t.splice;function r(s){var o=this.__data__,l=e(o,s);if(l<0)return!1;var u=o.length-1;return l==u?o.pop():n.call(o,l,1),--this.size,!0}return Cp=r,Cp}var Tp,MS;function hX(){if(MS)return Tp;MS=1;var e=Xd();function t(n){var r=this.__data__,s=e(r,n);return s<0?void 0:r[s][1]}return Tp=t,Tp}var Rp,$S;function fX(){if($S)return Rp;$S=1;var e=Xd();function t(n){return e(this.__data__,n)>-1}return Rp=t,Rp}var Ap,IS;function pX(){if(IS)return Ap;IS=1;var e=Xd();function t(n,r){var s=this.__data__,o=e(s,n);return o<0?(++this.size,s.push([n,r])):s[o][1]=r,this}return Ap=t,Ap}var Mp,OS;function Zd(){if(OS)return Mp;OS=1;var e=uX(),t=dX(),n=hX(),r=fX(),s=pX();function o(l){var u=-1,d=l==null?0:l.length;for(this.clear();++u<d;){var h=l[u];this.set(h[0],h[1])}}return o.prototype.clear=e,o.prototype.delete=t,o.prototype.get=n,o.prototype.has=r,o.prototype.set=s,Mp=o,Mp}var $p,LS;function mX(){if(LS)return $p;LS=1;var e=Zd();function t(){this.__data__=new e,this.size=0}return $p=t,$p}var Ip,PS;function gX(){if(PS)return Ip;PS=1;function e(t){var n=this.__data__,r=n.delete(t);return this.size=n.size,r}return Ip=e,Ip}var Op,DS;function yX(){if(DS)return Op;DS=1;function e(t){return this.__data__.get(t)}return Op=e,Op}var Lp,FS;function wX(){if(FS)return Lp;FS=1;function e(t){return this.__data__.has(t)}return Lp=e,Lp}var Pp,qS;function wI(){if(qS)return Pp;qS=1;var e=typeof lu=="object"&&lu&&lu.Object===Object&&lu;return Pp=e,Pp}var Dp,BS;function fr(){if(BS)return Dp;BS=1;var e=wI(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return Dp=n,Dp}var Fp,US;function yi(){if(US)return Fp;US=1;var e=fr(),t=e.Symbol;return Fp=t,Fp}var qp,zS;function vX(){if(zS)return qp;zS=1;var e=yi(),t=Object.prototype,n=t.hasOwnProperty,r=t.toString,s=e?e.toStringTag:void 0;function o(l){var u=n.call(l,s),d=l[s];try{l[s]=void 0;var h=!0}catch{}var f=r.call(l);return h&&(u?l[s]=d:delete l[s]),f}return qp=o,qp}var Bp,WS;function xX(){if(WS)return Bp;WS=1;var e=Object.prototype,t=e.toString;function n(r){return t.call(r)}return Bp=n,Bp}var Up,HS;function Ua(){if(HS)return Up;HS=1;var e=yi(),t=vX(),n=xX(),r="[object Null]",s="[object Undefined]",o=e?e.toStringTag:void 0;function l(u){return u==null?u===void 0?s:r:o&&o in Object(u)?t(u):n(u)}return Up=l,Up}var zp,VS;function Bn(){if(VS)return zp;VS=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return zp=e,zp}var Wp,GS;function ec(){if(GS)return Wp;GS=1;var e=Ua(),t=Bn(),n="[object AsyncFunction]",r="[object Function]",s="[object GeneratorFunction]",o="[object Proxy]";function l(u){if(!t(u))return!1;var d=e(u);return d==r||d==s||d==n||d==o}return Wp=l,Wp}var Hp,KS;function bX(){if(KS)return Hp;KS=1;var e=fr(),t=e["__core-js_shared__"];return Hp=t,Hp}var Vp,YS;function kX(){if(YS)return Vp;YS=1;var e=bX(),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 Vp=n,Vp}var Gp,XS;function vI(){if(XS)return Gp;XS=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 Gp=n,Gp}var Kp,ZS;function NX(){if(ZS)return Kp;ZS=1;var e=ec(),t=kX(),n=Bn(),r=vI(),s=/[\\^$.*+?()[\]{}|]/g,o=/^\[object .+?Constructor\]$/,l=Function.prototype,u=Object.prototype,d=l.toString,h=u.hasOwnProperty,f=RegExp("^"+d.call(h).replace(s,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function p(g){if(!n(g)||t(g))return!1;var v=e(g)?f:o;return v.test(r(g))}return Kp=p,Kp}var Yp,JS;function jX(){if(JS)return Yp;JS=1;function e(t,n){return t==null?void 0:t[n]}return Yp=e,Yp}var Xp,QS;function za(){if(QS)return Xp;QS=1;var e=NX(),t=jX();function n(r,s){var o=t(r,s);return e(o)?o:void 0}return Xp=n,Xp}var Zp,e_;function n0(){if(e_)return Zp;e_=1;var e=za(),t=fr(),n=e(t,"Map");return Zp=n,Zp}var Jp,t_;function Jd(){if(t_)return Jp;t_=1;var e=za(),t=e(Object,"create");return Jp=t,Jp}var Qp,n_;function SX(){if(n_)return Qp;n_=1;var e=Jd();function t(){this.__data__=e?e(null):{},this.size=0}return Qp=t,Qp}var em,r_;function _X(){if(r_)return em;r_=1;function e(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}return em=e,em}var tm,s_;function EX(){if(s_)return tm;s_=1;var e=Jd(),t="__lodash_hash_undefined__",n=Object.prototype,r=n.hasOwnProperty;function s(o){var l=this.__data__;if(e){var u=l[o];return u===t?void 0:u}return r.call(l,o)?l[o]:void 0}return tm=s,tm}var nm,a_;function CX(){if(a_)return nm;a_=1;var e=Jd(),t=Object.prototype,n=t.hasOwnProperty;function r(s){var o=this.__data__;return e?o[s]!==void 0:n.call(o,s)}return nm=r,nm}var rm,o_;function TX(){if(o_)return rm;o_=1;var e=Jd(),t="__lodash_hash_undefined__";function n(r,s){var o=this.__data__;return this.size+=this.has(r)?0:1,o[r]=e&&s===void 0?t:s,this}return rm=n,rm}var sm,i_;function RX(){if(i_)return sm;i_=1;var e=SX(),t=_X(),n=EX(),r=CX(),s=TX();function o(l){var u=-1,d=l==null?0:l.length;for(this.clear();++u<d;){var h=l[u];this.set(h[0],h[1])}}return o.prototype.clear=e,o.prototype.delete=t,o.prototype.get=n,o.prototype.has=r,o.prototype.set=s,sm=o,sm}var am,l_;function AX(){if(l_)return am;l_=1;var e=RX(),t=Zd(),n=n0();function r(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return am=r,am}var om,c_;function MX(){if(c_)return om;c_=1;function e(t){var n=typeof t;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?t!=="__proto__":t===null}return om=e,om}var im,u_;function Qd(){if(u_)return im;u_=1;var e=MX();function t(n,r){var s=n.__data__;return e(r)?s[typeof r=="string"?"string":"hash"]:s.map}return im=t,im}var lm,d_;function $X(){if(d_)return lm;d_=1;var e=Qd();function t(n){var r=e(this,n).delete(n);return this.size-=r?1:0,r}return lm=t,lm}var cm,h_;function IX(){if(h_)return cm;h_=1;var e=Qd();function t(n){return e(this,n).get(n)}return cm=t,cm}var um,f_;function OX(){if(f_)return um;f_=1;var e=Qd();function t(n){return e(this,n).has(n)}return um=t,um}var dm,p_;function LX(){if(p_)return dm;p_=1;var e=Qd();function t(n,r){var s=e(this,n),o=s.size;return s.set(n,r),this.size+=s.size==o?0:1,this}return dm=t,dm}var hm,m_;function r0(){if(m_)return hm;m_=1;var e=AX(),t=$X(),n=IX(),r=OX(),s=LX();function o(l){var u=-1,d=l==null?0:l.length;for(this.clear();++u<d;){var h=l[u];this.set(h[0],h[1])}}return o.prototype.clear=e,o.prototype.delete=t,o.prototype.get=n,o.prototype.has=r,o.prototype.set=s,hm=o,hm}var fm,g_;function PX(){if(g_)return fm;g_=1;var e=Zd(),t=n0(),n=r0(),r=200;function s(o,l){var u=this.__data__;if(u instanceof e){var d=u.__data__;if(!t||d.length<r-1)return d.push([o,l]),this.size=++u.size,this;u=this.__data__=new n(d)}return u.set(o,l),this.size=u.size,this}return fm=s,fm}var pm,y_;function eh(){if(y_)return pm;y_=1;var e=Zd(),t=mX(),n=gX(),r=yX(),s=wX(),o=PX();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=o,pm=l,pm}var mm,w_;function s0(){if(w_)return mm;w_=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 mm=e,mm}var gm,v_;function xI(){if(v_)return gm;v_=1;var e=za(),t=(function(){try{var n=e(Object,"defineProperty");return n({},"",{}),n}catch{}})();return gm=t,gm}var ym,x_;function th(){if(x_)return ym;x_=1;var e=xI();function t(n,r,s){r=="__proto__"&&e?e(n,r,{configurable:!0,enumerable:!0,value:s,writable:!0}):n[r]=s}return ym=t,ym}var wm,b_;function nh(){if(b_)return wm;b_=1;var e=th(),t=gi(),n=Object.prototype,r=n.hasOwnProperty;function s(o,l,u){var d=o[l];(!(r.call(o,l)&&t(d,u))||u===void 0&&!(l in o))&&e(o,l,u)}return wm=s,wm}var vm,k_;function tc(){if(k_)return vm;k_=1;var e=nh(),t=th();function n(r,s,o,l){var u=!o;o||(o={});for(var d=-1,h=s.length;++d<h;){var f=s[d],p=l?l(o[f],r[f],f,o,r):void 0;p===void 0&&(p=r[f]),u?t(o,f,p):e(o,f,p)}return o}return vm=n,vm}var xm,N_;function DX(){if(N_)return xm;N_=1;function e(t,n){for(var r=-1,s=Array(t);++r<t;)s[r]=n(r);return s}return xm=e,xm}var bm,j_;function Fr(){if(j_)return bm;j_=1;function e(t){return t!=null&&typeof t=="object"}return bm=e,bm}var km,S_;function FX(){if(S_)return km;S_=1;var e=Ua(),t=Fr(),n="[object Arguments]";function r(s){return t(s)&&e(s)==n}return km=r,km}var Nm,__;function nc(){if(__)return Nm;__=1;var e=FX(),t=Fr(),n=Object.prototype,r=n.hasOwnProperty,s=n.propertyIsEnumerable,o=e((function(){return arguments})())?e:function(l){return t(l)&&r.call(l,"callee")&&!s.call(l,"callee")};return Nm=o,Nm}var jm,E_;function Nt(){if(E_)return jm;E_=1;var e=Array.isArray;return jm=e,jm}var fl={exports:{}},Sm,C_;function qX(){if(C_)return Sm;C_=1;function e(){return!1}return Sm=e,Sm}fl.exports;var T_;function wi(){return T_||(T_=1,(function(e,t){var n=fr(),r=qX(),s=t&&!t.nodeType&&t,o=s&&!0&&e&&!e.nodeType&&e,l=o&&o.exports===s,u=l?n.Buffer:void 0,d=u?u.isBuffer:void 0,h=d||r;e.exports=h})(fl,fl.exports)),fl.exports}var _m,R_;function rh(){if(R_)return _m;R_=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function n(r,s){var o=typeof r;return s=s??e,!!s&&(o=="number"||o!="symbol"&&t.test(r))&&r>-1&&r%1==0&&r<s}return _m=n,_m}var Em,A_;function a0(){if(A_)return Em;A_=1;var e=9007199254740991;function t(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=e}return Em=t,Em}var Cm,M_;function BX(){if(M_)return Cm;M_=1;var e=Ua(),t=a0(),n=Fr(),r="[object Arguments]",s="[object Array]",o="[object Boolean]",l="[object Date]",u="[object Error]",d="[object Function]",h="[object Map]",f="[object Number]",p="[object Object]",g="[object RegExp]",v="[object Set]",k="[object String]",b="[object WeakMap]",x="[object ArrayBuffer]",N="[object DataView]",S="[object Float32Array]",_="[object Float64Array]",E="[object Int8Array]",T="[object Int16Array]",R="[object Int32Array]",A="[object Uint8Array]",q="[object Uint8ClampedArray]",L="[object Uint16Array]",P="[object Uint32Array]",I={};I[S]=I[_]=I[E]=I[T]=I[R]=I[A]=I[q]=I[L]=I[P]=!0,I[r]=I[s]=I[x]=I[o]=I[N]=I[l]=I[u]=I[d]=I[h]=I[f]=I[p]=I[g]=I[v]=I[k]=I[b]=!1;function O(U){return n(U)&&t(U.length)&&!!I[e(U)]}return Cm=O,Cm}var Tm,$_;function sh(){if($_)return Tm;$_=1;function e(t){return function(n){return t(n)}}return Tm=e,Tm}var pl={exports:{}};pl.exports;var I_;function o0(){return I_||(I_=1,(function(e,t){var n=wI(),r=t&&!t.nodeType&&t,s=r&&!0&&e&&!e.nodeType&&e,o=s&&s.exports===r,l=o&&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})(pl,pl.exports)),pl.exports}var Rm,O_;function rc(){if(O_)return Rm;O_=1;var e=BX(),t=sh(),n=o0(),r=n&&n.isTypedArray,s=r?t(r):e;return Rm=s,Rm}var Am,L_;function bI(){if(L_)return Am;L_=1;var e=DX(),t=nc(),n=Nt(),r=wi(),s=rh(),o=rc(),l=Object.prototype,u=l.hasOwnProperty;function d(h,f){var p=n(h),g=!p&&t(h),v=!p&&!g&&r(h),k=!p&&!g&&!v&&o(h),b=p||g||v||k,x=b?e(h.length,String):[],N=x.length;for(var S in h)(f||u.call(h,S))&&!(b&&(S=="length"||v&&(S=="offset"||S=="parent")||k&&(S=="buffer"||S=="byteLength"||S=="byteOffset")||s(S,N)))&&x.push(S);return x}return Am=d,Am}var Mm,P_;function ah(){if(P_)return Mm;P_=1;var e=Object.prototype;function t(n){var r=n&&n.constructor,s=typeof r=="function"&&r.prototype||e;return n===s}return Mm=t,Mm}var $m,D_;function kI(){if(D_)return $m;D_=1;function e(t,n){return function(r){return t(n(r))}}return $m=e,$m}var Im,F_;function UX(){if(F_)return Im;F_=1;var e=kI(),t=e(Object.keys,Object);return Im=t,Im}var Om,q_;function i0(){if(q_)return Om;q_=1;var e=ah(),t=UX(),n=Object.prototype,r=n.hasOwnProperty;function s(o){if(!e(o))return t(o);var l=[];for(var u in Object(o))r.call(o,u)&&u!="constructor"&&l.push(u);return l}return Om=s,Om}var Lm,B_;function fs(){if(B_)return Lm;B_=1;var e=ec(),t=a0();function n(r){return r!=null&&t(r.length)&&!e(r)}return Lm=n,Lm}var Pm,U_;function Qs(){if(U_)return Pm;U_=1;var e=bI(),t=i0(),n=fs();function r(s){return n(s)?e(s):t(s)}return Pm=r,Pm}var Dm,z_;function zX(){if(z_)return Dm;z_=1;var e=tc(),t=Qs();function n(r,s){return r&&e(s,t(s),r)}return Dm=n,Dm}var Fm,W_;function WX(){if(W_)return Fm;W_=1;function e(t){var n=[];if(t!=null)for(var r in Object(t))n.push(r);return n}return Fm=e,Fm}var qm,H_;function HX(){if(H_)return qm;H_=1;var e=Bn(),t=ah(),n=WX(),r=Object.prototype,s=r.hasOwnProperty;function o(l){if(!e(l))return n(l);var u=t(l),d=[];for(var h in l)h=="constructor"&&(u||!s.call(l,h))||d.push(h);return d}return qm=o,qm}var Bm,V_;function Wa(){if(V_)return Bm;V_=1;var e=bI(),t=HX(),n=fs();function r(s){return n(s)?e(s,!0):t(s)}return Bm=r,Bm}var Um,G_;function VX(){if(G_)return Um;G_=1;var e=tc(),t=Wa();function n(r,s){return r&&e(s,t(s),r)}return Um=n,Um}var ml={exports:{}};ml.exports;var K_;function NI(){return K_||(K_=1,(function(e,t){var n=fr(),r=t&&!t.nodeType&&t,s=r&&!0&&e&&!e.nodeType&&e,o=s&&s.exports===r,l=o?n.Buffer:void 0,u=l?l.allocUnsafe:void 0;function d(h,f){if(f)return h.slice();var p=h.length,g=u?u(p):new h.constructor(p);return h.copy(g),g}e.exports=d})(ml,ml.exports)),ml.exports}var zm,Y_;function jI(){if(Y_)return zm;Y_=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 zm=e,zm}var Wm,X_;function SI(){if(X_)return Wm;X_=1;function e(t,n){for(var r=-1,s=t==null?0:t.length,o=0,l=[];++r<s;){var u=t[r];n(u,r,t)&&(l[o++]=u)}return l}return Wm=e,Wm}var Hm,Z_;function _I(){if(Z_)return Hm;Z_=1;function e(){return[]}return Hm=e,Hm}var Vm,J_;function l0(){if(J_)return Vm;J_=1;var e=SI(),t=_I(),n=Object.prototype,r=n.propertyIsEnumerable,s=Object.getOwnPropertySymbols,o=s?function(l){return l==null?[]:(l=Object(l),e(s(l),function(u){return r.call(l,u)}))}:t;return Vm=o,Vm}var Gm,Q_;function GX(){if(Q_)return Gm;Q_=1;var e=tc(),t=l0();function n(r,s){return e(r,t(r),s)}return Gm=n,Gm}var Km,eE;function c0(){if(eE)return Km;eE=1;function e(t,n){for(var r=-1,s=n.length,o=t.length;++r<s;)t[o+r]=n[r];return t}return Km=e,Km}var Ym,tE;function oh(){if(tE)return Ym;tE=1;var e=kI(),t=e(Object.getPrototypeOf,Object);return Ym=t,Ym}var Xm,nE;function EI(){if(nE)return Xm;nE=1;var e=c0(),t=oh(),n=l0(),r=_I(),s=Object.getOwnPropertySymbols,o=s?function(l){for(var u=[];l;)e(u,n(l)),l=t(l);return u}:r;return Xm=o,Xm}var Zm,rE;function KX(){if(rE)return Zm;rE=1;var e=tc(),t=EI();function n(r,s){return e(r,t(r),s)}return Zm=n,Zm}var Jm,sE;function CI(){if(sE)return Jm;sE=1;var e=c0(),t=Nt();function n(r,s,o){var l=s(r);return t(r)?l:e(l,o(r))}return Jm=n,Jm}var Qm,aE;function TI(){if(aE)return Qm;aE=1;var e=CI(),t=l0(),n=Qs();function r(s){return e(s,n,t)}return Qm=r,Qm}var eg,oE;function YX(){if(oE)return eg;oE=1;var e=CI(),t=EI(),n=Wa();function r(s){return e(s,n,t)}return eg=r,eg}var tg,iE;function XX(){if(iE)return tg;iE=1;var e=za(),t=fr(),n=e(t,"DataView");return tg=n,tg}var ng,lE;function ZX(){if(lE)return ng;lE=1;var e=za(),t=fr(),n=e(t,"Promise");return ng=n,ng}var rg,cE;function RI(){if(cE)return rg;cE=1;var e=za(),t=fr(),n=e(t,"Set");return rg=n,rg}var sg,uE;function JX(){if(uE)return sg;uE=1;var e=za(),t=fr(),n=e(t,"WeakMap");return sg=n,sg}var ag,dE;function vi(){if(dE)return ag;dE=1;var e=XX(),t=n0(),n=ZX(),r=RI(),s=JX(),o=Ua(),l=vI(),u="[object Map]",d="[object Object]",h="[object Promise]",f="[object Set]",p="[object WeakMap]",g="[object DataView]",v=l(e),k=l(t),b=l(n),x=l(r),N=l(s),S=o;return(e&&S(new e(new ArrayBuffer(1)))!=g||t&&S(new t)!=u||n&&S(n.resolve())!=h||r&&S(new r)!=f||s&&S(new s)!=p)&&(S=function(_){var E=o(_),T=E==d?_.constructor:void 0,R=T?l(T):"";if(R)switch(R){case v:return g;case k:return u;case b:return h;case x:return f;case N:return p}return E}),ag=S,ag}var og,hE;function QX(){if(hE)return og;hE=1;var e=Object.prototype,t=e.hasOwnProperty;function n(r){var s=r.length,o=new r.constructor(s);return s&&typeof r[0]=="string"&&t.call(r,"index")&&(o.index=r.index,o.input=r.input),o}return og=n,og}var ig,fE;function AI(){if(fE)return ig;fE=1;var e=fr(),t=e.Uint8Array;return ig=t,ig}var lg,pE;function u0(){if(pE)return lg;pE=1;var e=AI();function t(n){var r=new n.constructor(n.byteLength);return new e(r).set(new e(n)),r}return lg=t,lg}var cg,mE;function eZ(){if(mE)return cg;mE=1;var e=u0();function t(n,r){var s=r?e(n.buffer):n.buffer;return new n.constructor(s,n.byteOffset,n.byteLength)}return cg=t,cg}var ug,gE;function tZ(){if(gE)return ug;gE=1;var e=/\w*$/;function t(n){var r=new n.constructor(n.source,e.exec(n));return r.lastIndex=n.lastIndex,r}return ug=t,ug}var dg,yE;function nZ(){if(yE)return dg;yE=1;var e=yi(),t=e?e.prototype:void 0,n=t?t.valueOf:void 0;function r(s){return n?Object(n.call(s)):{}}return dg=r,dg}var hg,wE;function MI(){if(wE)return hg;wE=1;var e=u0();function t(n,r){var s=r?e(n.buffer):n.buffer;return new n.constructor(s,n.byteOffset,n.length)}return hg=t,hg}var fg,vE;function rZ(){if(vE)return fg;vE=1;var e=u0(),t=eZ(),n=tZ(),r=nZ(),s=MI(),o="[object Boolean]",l="[object Date]",u="[object Map]",d="[object Number]",h="[object RegExp]",f="[object Set]",p="[object String]",g="[object Symbol]",v="[object ArrayBuffer]",k="[object DataView]",b="[object Float32Array]",x="[object Float64Array]",N="[object Int8Array]",S="[object Int16Array]",_="[object Int32Array]",E="[object Uint8Array]",T="[object Uint8ClampedArray]",R="[object Uint16Array]",A="[object Uint32Array]";function q(L,P,I){var O=L.constructor;switch(P){case v:return e(L);case o:case l:return new O(+L);case k:return t(L,I);case b:case x:case N:case S:case _:case E:case T:case R:case A:return s(L,I);case u:return new O;case d:case p:return new O(L);case h:return n(L);case f:return new O;case g:return r(L)}}return fg=q,fg}var pg,xE;function $I(){if(xE)return pg;xE=1;var e=Bn(),t=Object.create,n=(function(){function r(){}return function(s){if(!e(s))return{};if(t)return t(s);r.prototype=s;var o=new r;return r.prototype=void 0,o}})();return pg=n,pg}var mg,bE;function II(){if(bE)return mg;bE=1;var e=$I(),t=oh(),n=ah();function r(s){return typeof s.constructor=="function"&&!n(s)?e(t(s)):{}}return mg=r,mg}var gg,kE;function sZ(){if(kE)return gg;kE=1;var e=vi(),t=Fr(),n="[object Map]";function r(s){return t(s)&&e(s)==n}return gg=r,gg}var yg,NE;function aZ(){if(NE)return yg;NE=1;var e=sZ(),t=sh(),n=o0(),r=n&&n.isMap,s=r?t(r):e;return yg=s,yg}var wg,jE;function oZ(){if(jE)return wg;jE=1;var e=vi(),t=Fr(),n="[object Set]";function r(s){return t(s)&&e(s)==n}return wg=r,wg}var vg,SE;function iZ(){if(SE)return vg;SE=1;var e=oZ(),t=sh(),n=o0(),r=n&&n.isSet,s=r?t(r):e;return vg=s,vg}var xg,_E;function OI(){if(_E)return xg;_E=1;var e=eh(),t=s0(),n=nh(),r=zX(),s=VX(),o=NI(),l=jI(),u=GX(),d=KX(),h=TI(),f=YX(),p=vi(),g=QX(),v=rZ(),k=II(),b=Nt(),x=wi(),N=aZ(),S=Bn(),_=iZ(),E=Qs(),T=Wa(),R=1,A=2,q=4,L="[object Arguments]",P="[object Array]",I="[object Boolean]",O="[object Date]",U="[object Error]",M="[object Function]",$="[object GeneratorFunction]",B="[object Map]",V="[object Number]",H="[object Object]",F="[object RegExp]",W="[object Set]",D="[object String]",Y="[object Symbol]",J="[object WeakMap]",G="[object ArrayBuffer]",K="[object DataView]",X="[object Float32Array]",Z="[object Float64Array]",ee="[object Int8Array]",se="[object Int16Array]",ue="[object Int32Array]",ae="[object Uint8Array]",re="[object Uint8ClampedArray]",de="[object Uint16Array]",me="[object Uint32Array]",pe={};pe[L]=pe[P]=pe[G]=pe[K]=pe[I]=pe[O]=pe[X]=pe[Z]=pe[ee]=pe[se]=pe[ue]=pe[B]=pe[V]=pe[H]=pe[F]=pe[W]=pe[D]=pe[Y]=pe[ae]=pe[re]=pe[de]=pe[me]=!0,pe[U]=pe[M]=pe[J]=!1;function ke(xe,fe,Te,Fe,Oe,We){var le,je=fe&R,Re=fe&A,Le=fe&q;if(Te&&(le=Oe?Te(xe,Fe,Oe,We):Te(xe)),le!==void 0)return le;if(!S(xe))return xe;var et=b(xe);if(et){if(le=g(xe),!je)return l(xe,le)}else{var rt=p(xe),Je=rt==M||rt==$;if(x(xe))return o(xe,je);if(rt==H||rt==L||Je&&!Oe){if(le=Re||Je?{}:k(xe),!je)return Re?d(xe,s(le,xe)):u(xe,r(le,xe))}else{if(!pe[rt])return Oe?xe:{};le=v(xe,rt,je)}}We||(We=new e);var it=We.get(xe);if(it)return it;We.set(xe,le),_(xe)?xe.forEach(function(He){le.add(ke(He,fe,Te,He,xe,We))}):N(xe)&&xe.forEach(function(He,ft){le.set(ft,ke(He,fe,Te,ft,xe,We))});var Ue=Le?Re?f:h:Re?T:E,lt=et?void 0:Ue(xe);return t(lt||xe,function(He,ft){lt&&(ft=He,He=xe[ft]),n(le,ft,ke(He,fe,Te,ft,xe,We))}),le}return xg=ke,xg}var bg,EE;function lZ(){if(EE)return bg;EE=1;var e=OI(),t=4;function n(r){return e(r,t)}return bg=n,bg}var kg,CE;function d0(){if(CE)return kg;CE=1;function e(t){return function(){return t}}return kg=e,kg}var Ng,TE;function cZ(){if(TE)return Ng;TE=1;function e(t){return function(n,r,s){for(var o=-1,l=Object(n),u=s(n),d=u.length;d--;){var h=u[t?d:++o];if(r(l[h],h,l)===!1)break}return n}}return Ng=e,Ng}var jg,RE;function h0(){if(RE)return jg;RE=1;var e=cZ(),t=e();return jg=t,jg}var Sg,AE;function f0(){if(AE)return Sg;AE=1;var e=h0(),t=Qs();function n(r,s){return r&&e(r,s,t)}return Sg=n,Sg}var _g,ME;function uZ(){if(ME)return _g;ME=1;var e=fs();function t(n,r){return function(s,o){if(s==null)return s;if(!e(s))return n(s,o);for(var l=s.length,u=r?l:-1,d=Object(s);(r?u--:++u<l)&&o(d[u],u,d)!==!1;);return s}}return _g=t,_g}var Eg,$E;function ih(){if($E)return Eg;$E=1;var e=f0(),t=uZ(),n=t(e);return Eg=n,Eg}var Cg,IE;function Ha(){if(IE)return Cg;IE=1;function e(t){return t}return Cg=e,Cg}var Tg,OE;function LI(){if(OE)return Tg;OE=1;var e=Ha();function t(n){return typeof n=="function"?n:e}return Tg=t,Tg}var Rg,LE;function PI(){if(LE)return Rg;LE=1;var e=s0(),t=ih(),n=LI(),r=Nt();function s(o,l){var u=r(o)?e:t;return u(o,n(l))}return Rg=s,Rg}var Ag,PE;function DI(){return PE||(PE=1,Ag=PI()),Ag}var Mg,DE;function dZ(){if(DE)return Mg;DE=1;var e=ih();function t(n,r){var s=[];return e(n,function(o,l,u){r(o,l,u)&&s.push(o)}),s}return Mg=t,Mg}var $g,FE;function hZ(){if(FE)return $g;FE=1;var e="__lodash_hash_undefined__";function t(n){return this.__data__.set(n,e),this}return $g=t,$g}var Ig,qE;function fZ(){if(qE)return Ig;qE=1;function e(t){return this.__data__.has(t)}return Ig=e,Ig}var Og,BE;function FI(){if(BE)return Og;BE=1;var e=r0(),t=hZ(),n=fZ();function r(s){var o=-1,l=s==null?0:s.length;for(this.__data__=new e;++o<l;)this.add(s[o])}return r.prototype.add=r.prototype.push=t,r.prototype.has=n,Og=r,Og}var Lg,UE;function pZ(){if(UE)return Lg;UE=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 Lg=e,Lg}var Pg,zE;function qI(){if(zE)return Pg;zE=1;function e(t,n){return t.has(n)}return Pg=e,Pg}var Dg,WE;function BI(){if(WE)return Dg;WE=1;var e=FI(),t=pZ(),n=qI(),r=1,s=2;function o(l,u,d,h,f,p){var g=d&r,v=l.length,k=u.length;if(v!=k&&!(g&&k>v))return!1;var b=p.get(l),x=p.get(u);if(b&&x)return b==u&&x==l;var N=-1,S=!0,_=d&s?new e:void 0;for(p.set(l,u),p.set(u,l);++N<v;){var E=l[N],T=u[N];if(h)var R=g?h(T,E,N,u,l,p):h(E,T,N,l,u,p);if(R!==void 0){if(R)continue;S=!1;break}if(_){if(!t(u,function(A,q){if(!n(_,q)&&(E===A||f(E,A,d,h,p)))return _.push(q)})){S=!1;break}}else if(!(E===T||f(E,T,d,h,p))){S=!1;break}}return p.delete(l),p.delete(u),S}return Dg=o,Dg}var Fg,HE;function mZ(){if(HE)return Fg;HE=1;function e(t){var n=-1,r=Array(t.size);return t.forEach(function(s,o){r[++n]=[o,s]}),r}return Fg=e,Fg}var qg,VE;function p0(){if(VE)return qg;VE=1;function e(t){var n=-1,r=Array(t.size);return t.forEach(function(s){r[++n]=s}),r}return qg=e,qg}var Bg,GE;function gZ(){if(GE)return Bg;GE=1;var e=yi(),t=AI(),n=gi(),r=BI(),s=mZ(),o=p0(),l=1,u=2,d="[object Boolean]",h="[object Date]",f="[object Error]",p="[object Map]",g="[object Number]",v="[object RegExp]",k="[object Set]",b="[object String]",x="[object Symbol]",N="[object ArrayBuffer]",S="[object DataView]",_=e?e.prototype:void 0,E=_?_.valueOf:void 0;function T(R,A,q,L,P,I,O){switch(q){case S:if(R.byteLength!=A.byteLength||R.byteOffset!=A.byteOffset)return!1;R=R.buffer,A=A.buffer;case N:return!(R.byteLength!=A.byteLength||!I(new t(R),new t(A)));case d:case h:case g:return n(+R,+A);case f:return R.name==A.name&&R.message==A.message;case v:case b:return R==A+"";case p:var U=s;case k:var M=L&l;if(U||(U=o),R.size!=A.size&&!M)return!1;var $=O.get(R);if($)return $==A;L|=u,O.set(R,A);var B=r(U(R),U(A),L,P,I,O);return O.delete(R),B;case x:if(E)return E.call(R)==E.call(A)}return!1}return Bg=T,Bg}var Ug,KE;function yZ(){if(KE)return Ug;KE=1;var e=TI(),t=1,n=Object.prototype,r=n.hasOwnProperty;function s(o,l,u,d,h,f){var p=u&t,g=e(o),v=g.length,k=e(l),b=k.length;if(v!=b&&!p)return!1;for(var x=v;x--;){var N=g[x];if(!(p?N in l:r.call(l,N)))return!1}var S=f.get(o),_=f.get(l);if(S&&_)return S==l&&_==o;var E=!0;f.set(o,l),f.set(l,o);for(var T=p;++x<v;){N=g[x];var R=o[N],A=l[N];if(d)var q=p?d(A,R,N,l,o,f):d(R,A,N,o,l,f);if(!(q===void 0?R===A||h(R,A,u,d,f):q)){E=!1;break}T||(T=N=="constructor")}if(E&&!T){var L=o.constructor,P=l.constructor;L!=P&&"constructor"in o&&"constructor"in l&&!(typeof L=="function"&&L instanceof L&&typeof P=="function"&&P instanceof P)&&(E=!1)}return f.delete(o),f.delete(l),E}return Ug=s,Ug}var zg,YE;function wZ(){if(YE)return zg;YE=1;var e=eh(),t=BI(),n=gZ(),r=yZ(),s=vi(),o=Nt(),l=wi(),u=rc(),d=1,h="[object Arguments]",f="[object Array]",p="[object Object]",g=Object.prototype,v=g.hasOwnProperty;function k(b,x,N,S,_,E){var T=o(b),R=o(x),A=T?f:s(b),q=R?f:s(x);A=A==h?p:A,q=q==h?p:q;var L=A==p,P=q==p,I=A==q;if(I&&l(b)){if(!l(x))return!1;T=!0,L=!1}if(I&&!L)return E||(E=new e),T||u(b)?t(b,x,N,S,_,E):n(b,x,A,N,S,_,E);if(!(N&d)){var O=L&&v.call(b,"__wrapped__"),U=P&&v.call(x,"__wrapped__");if(O||U){var M=O?b.value():b,$=U?x.value():x;return E||(E=new e),_(M,$,N,S,E)}}return I?(E||(E=new e),r(b,x,N,S,_,E)):!1}return zg=k,zg}var Wg,XE;function UI(){if(XE)return Wg;XE=1;var e=wZ(),t=Fr();function n(r,s,o,l,u){return r===s?!0:r==null||s==null||!t(r)&&!t(s)?r!==r&&s!==s:e(r,s,o,l,n,u)}return Wg=n,Wg}var Hg,ZE;function vZ(){if(ZE)return Hg;ZE=1;var e=eh(),t=UI(),n=1,r=2;function s(o,l,u,d){var h=u.length,f=h,p=!d;if(o==null)return!f;for(o=Object(o);h--;){var g=u[h];if(p&&g[2]?g[1]!==o[g[0]]:!(g[0]in o))return!1}for(;++h<f;){g=u[h];var v=g[0],k=o[v],b=g[1];if(p&&g[2]){if(k===void 0&&!(v in o))return!1}else{var x=new e;if(d)var N=d(k,b,v,o,l,x);if(!(N===void 0?t(b,k,n|r,d,x):N))return!1}}return!0}return Hg=s,Hg}var Vg,JE;function zI(){if(JE)return Vg;JE=1;var e=Bn();function t(n){return n===n&&!e(n)}return Vg=t,Vg}var Gg,QE;function xZ(){if(QE)return Gg;QE=1;var e=zI(),t=Qs();function n(r){for(var s=t(r),o=s.length;o--;){var l=s[o],u=r[l];s[o]=[l,u,e(u)]}return s}return Gg=n,Gg}var Kg,eC;function WI(){if(eC)return Kg;eC=1;function e(t,n){return function(r){return r==null?!1:r[t]===n&&(n!==void 0||t in Object(r))}}return Kg=e,Kg}var Yg,tC;function bZ(){if(tC)return Yg;tC=1;var e=vZ(),t=xZ(),n=WI();function r(s){var o=t(s);return o.length==1&&o[0][2]?n(o[0][0],o[0][1]):function(l){return l===s||e(l,s,o)}}return Yg=r,Yg}var Xg,nC;function xi(){if(nC)return Xg;nC=1;var e=Ua(),t=Fr(),n="[object Symbol]";function r(s){return typeof s=="symbol"||t(s)&&e(s)==n}return Xg=r,Xg}var Zg,rC;function m0(){if(rC)return Zg;rC=1;var e=Nt(),t=xi(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;function s(o,l){if(e(o))return!1;var u=typeof o;return u=="number"||u=="symbol"||u=="boolean"||o==null||t(o)?!0:r.test(o)||!n.test(o)||l!=null&&o in Object(l)}return Zg=s,Zg}var Jg,sC;function kZ(){if(sC)return Jg;sC=1;var e=r0(),t="Expected a function";function n(r,s){if(typeof r!="function"||s!=null&&typeof s!="function")throw new TypeError(t);var o=function(){var l=arguments,u=s?s.apply(this,l):l[0],d=o.cache;if(d.has(u))return d.get(u);var h=r.apply(this,l);return o.cache=d.set(u,h)||d,h};return o.cache=new(n.Cache||e),o}return n.Cache=e,Jg=n,Jg}var Qg,aC;function NZ(){if(aC)return Qg;aC=1;var e=kZ(),t=500;function n(r){var s=e(r,function(l){return o.size===t&&o.clear(),l}),o=s.cache;return s}return Qg=n,Qg}var ey,oC;function jZ(){if(oC)return ey;oC=1;var e=NZ(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g,r=e(function(s){var o=[];return s.charCodeAt(0)===46&&o.push(""),s.replace(t,function(l,u,d,h){o.push(d?h.replace(n,"$1"):u||l)}),o});return ey=r,ey}var ty,iC;function lh(){if(iC)return ty;iC=1;function e(t,n){for(var r=-1,s=t==null?0:t.length,o=Array(s);++r<s;)o[r]=n(t[r],r,t);return o}return ty=e,ty}var ny,lC;function SZ(){if(lC)return ny;lC=1;var e=yi(),t=lh(),n=Nt(),r=xi(),s=e?e.prototype:void 0,o=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 o?o.call(u):"";var d=u+"";return d=="0"&&1/u==-1/0?"-0":d}return ny=l,ny}var ry,cC;function HI(){if(cC)return ry;cC=1;var e=SZ();function t(n){return n==null?"":e(n)}return ry=t,ry}var sy,uC;function ch(){if(uC)return sy;uC=1;var e=Nt(),t=m0(),n=jZ(),r=HI();function s(o,l){return e(o)?o:t(o,l)?[o]:n(r(o))}return sy=s,sy}var ay,dC;function sc(){if(dC)return ay;dC=1;var e=xi();function t(n){if(typeof n=="string"||e(n))return n;var r=n+"";return r=="0"&&1/n==-1/0?"-0":r}return ay=t,ay}var oy,hC;function uh(){if(hC)return oy;hC=1;var e=ch(),t=sc();function n(r,s){s=e(s,r);for(var o=0,l=s.length;r!=null&&o<l;)r=r[t(s[o++])];return o&&o==l?r:void 0}return oy=n,oy}var iy,fC;function _Z(){if(fC)return iy;fC=1;var e=uh();function t(n,r,s){var o=n==null?void 0:e(n,r);return o===void 0?s:o}return iy=t,iy}var ly,pC;function EZ(){if(pC)return ly;pC=1;function e(t,n){return t!=null&&n in Object(t)}return ly=e,ly}var cy,mC;function VI(){if(mC)return cy;mC=1;var e=ch(),t=nc(),n=Nt(),r=rh(),s=a0(),o=sc();function l(u,d,h){d=e(d,u);for(var f=-1,p=d.length,g=!1;++f<p;){var v=o(d[f]);if(!(g=u!=null&&h(u,v)))break;u=u[v]}return g||++f!=p?g:(p=u==null?0:u.length,!!p&&s(p)&&r(v,p)&&(n(u)||t(u)))}return cy=l,cy}var uy,gC;function GI(){if(gC)return uy;gC=1;var e=EZ(),t=VI();function n(r,s){return r!=null&&t(r,s,e)}return uy=n,uy}var dy,yC;function CZ(){if(yC)return dy;yC=1;var e=UI(),t=_Z(),n=GI(),r=m0(),s=zI(),o=WI(),l=sc(),u=1,d=2;function h(f,p){return r(f)&&s(p)?o(l(f),p):function(g){var v=t(g,f);return v===void 0&&v===p?n(g,f):e(p,v,u|d)}}return dy=h,dy}var hy,wC;function KI(){if(wC)return hy;wC=1;function e(t){return function(n){return n==null?void 0:n[t]}}return hy=e,hy}var fy,vC;function TZ(){if(vC)return fy;vC=1;var e=uh();function t(n){return function(r){return e(r,n)}}return fy=t,fy}var py,xC;function RZ(){if(xC)return py;xC=1;var e=KI(),t=TZ(),n=m0(),r=sc();function s(o){return n(o)?e(r(o)):t(o)}return py=s,py}var my,bC;function ps(){if(bC)return my;bC=1;var e=bZ(),t=CZ(),n=Ha(),r=Nt(),s=RZ();function o(l){return typeof l=="function"?l:l==null?n:typeof l=="object"?r(l)?t(l[0],l[1]):e(l):s(l)}return my=o,my}var gy,kC;function YI(){if(kC)return gy;kC=1;var e=SI(),t=dZ(),n=ps(),r=Nt();function s(o,l){var u=r(o)?e:t;return u(o,n(l,3))}return gy=s,gy}var yy,NC;function AZ(){if(NC)return yy;NC=1;var e=Object.prototype,t=e.hasOwnProperty;function n(r,s){return r!=null&&t.call(r,s)}return yy=n,yy}var wy,jC;function XI(){if(jC)return wy;jC=1;var e=AZ(),t=VI();function n(r,s){return r!=null&&t(r,s,e)}return wy=n,wy}var vy,SC;function MZ(){if(SC)return vy;SC=1;var e=i0(),t=vi(),n=nc(),r=Nt(),s=fs(),o=wi(),l=ah(),u=rc(),d="[object Map]",h="[object Set]",f=Object.prototype,p=f.hasOwnProperty;function g(v){if(v==null)return!0;if(s(v)&&(r(v)||typeof v=="string"||typeof v.splice=="function"||o(v)||u(v)||n(v)))return!v.length;var k=t(v);if(k==d||k==h)return!v.size;if(l(v))return!e(v).length;for(var b in v)if(p.call(v,b))return!1;return!0}return vy=g,vy}var xy,_C;function ZI(){if(_C)return xy;_C=1;function e(t){return t===void 0}return xy=e,xy}var by,EC;function JI(){if(EC)return by;EC=1;var e=ih(),t=fs();function n(r,s){var o=-1,l=t(r)?Array(r.length):[];return e(r,function(u,d,h){l[++o]=s(u,d,h)}),l}return by=n,by}var ky,CC;function QI(){if(CC)return ky;CC=1;var e=lh(),t=ps(),n=JI(),r=Nt();function s(o,l){var u=r(o)?e:n;return u(o,t(l,3))}return ky=s,ky}var Ny,TC;function $Z(){if(TC)return Ny;TC=1;function e(t,n,r,s){var o=-1,l=t==null?0:t.length;for(s&&l&&(r=t[++o]);++o<l;)r=n(r,t[o],o,t);return r}return Ny=e,Ny}var jy,RC;function IZ(){if(RC)return jy;RC=1;function e(t,n,r,s,o){return o(t,function(l,u,d){r=s?(s=!1,l):n(r,l,u,d)}),r}return jy=e,jy}var Sy,AC;function eO(){if(AC)return Sy;AC=1;var e=$Z(),t=ih(),n=ps(),r=IZ(),s=Nt();function o(l,u,d){var h=s(l)?e:r,f=arguments.length<3;return h(l,n(u,4),d,f,t)}return Sy=o,Sy}var _y,MC;function OZ(){if(MC)return _y;MC=1;var e=Ua(),t=Nt(),n=Fr(),r="[object String]";function s(o){return typeof o=="string"||!t(o)&&n(o)&&e(o)==r}return _y=s,_y}var Ey,$C;function LZ(){if($C)return Ey;$C=1;var e=KI(),t=e("length");return Ey=t,Ey}var Cy,IC;function PZ(){if(IC)return Cy;IC=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",r="\\u20d0-\\u20ff",s=t+n+r,o="\\ufe0e\\ufe0f",l="\\u200d",u=RegExp("["+l+e+s+o+"]");function d(h){return u.test(h)}return Cy=d,Cy}var Ty,OC;function DZ(){if(OC)return Ty;OC=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",r="\\u20d0-\\u20ff",s=t+n+r,o="\\ufe0e\\ufe0f",l="["+e+"]",u="["+s+"]",d="\\ud83c[\\udffb-\\udfff]",h="(?:"+u+"|"+d+")",f="[^"+e+"]",p="(?:\\ud83c[\\udde6-\\uddff]){2}",g="[\\ud800-\\udbff][\\udc00-\\udfff]",v="\\u200d",k=h+"?",b="["+o+"]?",x="(?:"+v+"(?:"+[f,p,g].join("|")+")"+b+k+")*",N=b+k+x,S="(?:"+[f+u+"?",u,p,g,l].join("|")+")",_=RegExp(d+"(?="+d+")|"+S+N,"g");function E(T){for(var R=_.lastIndex=0;_.test(T);)++R;return R}return Ty=E,Ty}var Ry,LC;function FZ(){if(LC)return Ry;LC=1;var e=LZ(),t=PZ(),n=DZ();function r(s){return t(s)?n(s):e(s)}return Ry=r,Ry}var Ay,PC;function qZ(){if(PC)return Ay;PC=1;var e=i0(),t=vi(),n=fs(),r=OZ(),s=FZ(),o="[object Map]",l="[object Set]";function u(d){if(d==null)return 0;if(n(d))return r(d)?s(d):d.length;var h=t(d);return h==o||h==l?d.size:e(d).length}return Ay=u,Ay}var My,DC;function BZ(){if(DC)return My;DC=1;var e=s0(),t=$I(),n=f0(),r=ps(),s=oh(),o=Nt(),l=wi(),u=ec(),d=Bn(),h=rc();function f(p,g,v){var k=o(p),b=k||l(p)||h(p);if(g=r(g,4),v==null){var x=p&&p.constructor;b?v=k?new x:[]:d(p)?v=u(x)?t(s(p)):{}:v={}}return(b?e:n)(p,function(N,S,_){return g(v,N,S,_)}),v}return My=f,My}var $y,FC;function UZ(){if(FC)return $y;FC=1;var e=yi(),t=nc(),n=Nt(),r=e?e.isConcatSpreadable:void 0;function s(o){return n(o)||t(o)||!!(r&&o&&o[r])}return $y=s,$y}var Iy,qC;function g0(){if(qC)return Iy;qC=1;var e=c0(),t=UZ();function n(r,s,o,l,u){var d=-1,h=r.length;for(o||(o=t),u||(u=[]);++d<h;){var f=r[d];s>0&&o(f)?s>1?n(f,s-1,o,l,u):e(u,f):l||(u[u.length]=f)}return u}return Iy=n,Iy}var Oy,BC;function zZ(){if(BC)return Oy;BC=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 Oy=e,Oy}var Ly,UC;function tO(){if(UC)return Ly;UC=1;var e=zZ(),t=Math.max;function n(r,s,o){return s=t(s===void 0?r.length-1:s,0),function(){for(var l=arguments,u=-1,d=t(l.length-s,0),h=Array(d);++u<d;)h[u]=l[s+u];u=-1;for(var f=Array(s+1);++u<s;)f[u]=l[u];return f[s]=o(h),e(r,this,f)}}return Ly=n,Ly}var Py,zC;function WZ(){if(zC)return Py;zC=1;var e=d0(),t=xI(),n=Ha(),r=t?function(s,o){return t(s,"toString",{configurable:!0,enumerable:!1,value:e(o),writable:!0})}:n;return Py=r,Py}var Dy,WC;function HZ(){if(WC)return Dy;WC=1;var e=800,t=16,n=Date.now;function r(s){var o=0,l=0;return function(){var u=n(),d=t-(u-l);if(l=u,d>0){if(++o>=e)return arguments[0]}else o=0;return s.apply(void 0,arguments)}}return Dy=r,Dy}var Fy,HC;function nO(){if(HC)return Fy;HC=1;var e=WZ(),t=HZ(),n=t(e);return Fy=n,Fy}var qy,VC;function dh(){if(VC)return qy;VC=1;var e=Ha(),t=tO(),n=nO();function r(s,o){return n(t(s,o,e),s+"")}return qy=r,qy}var By,GC;function rO(){if(GC)return By;GC=1;function e(t,n,r,s){for(var o=t.length,l=r+(s?1:-1);s?l--:++l<o;)if(n(t[l],l,t))return l;return-1}return By=e,By}var Uy,KC;function VZ(){if(KC)return Uy;KC=1;function e(t){return t!==t}return Uy=e,Uy}var zy,YC;function GZ(){if(YC)return zy;YC=1;function e(t,n,r){for(var s=r-1,o=t.length;++s<o;)if(t[s]===n)return s;return-1}return zy=e,zy}var Wy,XC;function KZ(){if(XC)return Wy;XC=1;var e=rO(),t=VZ(),n=GZ();function r(s,o,l){return o===o?n(s,o,l):e(s,t,l)}return Wy=r,Wy}var Hy,ZC;function YZ(){if(ZC)return Hy;ZC=1;var e=KZ();function t(n,r){var s=n==null?0:n.length;return!!s&&e(n,r,0)>-1}return Hy=t,Hy}var Vy,JC;function XZ(){if(JC)return Vy;JC=1;function e(t,n,r){for(var s=-1,o=t==null?0:t.length;++s<o;)if(r(n,t[s]))return!0;return!1}return Vy=e,Vy}var Gy,QC;function ZZ(){if(QC)return Gy;QC=1;function e(){}return Gy=e,Gy}var Ky,eT;function JZ(){if(eT)return Ky;eT=1;var e=RI(),t=ZZ(),n=p0(),r=1/0,s=e&&1/n(new e([,-0]))[1]==r?function(o){return new e(o)}:t;return Ky=s,Ky}var Yy,tT;function QZ(){if(tT)return Yy;tT=1;var e=FI(),t=YZ(),n=XZ(),r=qI(),s=JZ(),o=p0(),l=200;function u(d,h,f){var p=-1,g=t,v=d.length,k=!0,b=[],x=b;if(f)k=!1,g=n;else if(v>=l){var N=h?null:s(d);if(N)return o(N);k=!1,g=r,x=new e}else x=h?[]:b;e:for(;++p<v;){var S=d[p],_=h?h(S):S;if(S=f||S!==0?S:0,k&&_===_){for(var E=x.length;E--;)if(x[E]===_)continue e;h&&x.push(_),b.push(S)}else g(x,_,f)||(x!==b&&x.push(_),b.push(S))}return b}return Yy=u,Yy}var Xy,nT;function sO(){if(nT)return Xy;nT=1;var e=fs(),t=Fr();function n(r){return t(r)&&e(r)}return Xy=n,Xy}var Zy,rT;function eJ(){if(rT)return Zy;rT=1;var e=g0(),t=dh(),n=QZ(),r=sO(),s=t(function(o){return n(e(o,1,r,!0))});return Zy=s,Zy}var Jy,sT;function tJ(){if(sT)return Jy;sT=1;var e=lh();function t(n,r){return e(r,function(s){return n[s]})}return Jy=t,Jy}var Qy,aT;function aO(){if(aT)return Qy;aT=1;var e=tJ(),t=Qs();function n(r){return r==null?[]:e(r,t(r))}return Qy=n,Qy}var ew,oT;function Un(){if(oT)return ew;oT=1;var e;if(typeof t0=="function")try{e={clone:lZ(),constant:d0(),each:DI(),filter:YI(),has:XI(),isArray:Nt(),isEmpty:MZ(),isFunction:ec(),isUndefined:ZI(),keys:Qs(),map:QI(),reduce:eO(),size:qZ(),transform:BZ(),union:eJ(),values:aO()}}catch{}return e||(e=window._),ew=e,ew}var tw,iT;function y0(){if(iT)return tw;iT=1;var e=Un();tw=s;var t="\0",n="\0",r="";function s(f){this._isDirected=e.has(f,"directed")?f.directed:!0,this._isMultigraph=e.has(f,"multigraph")?f.multigraph:!1,this._isCompound=e.has(f,"compound")?f.compound:!1,this._label=void 0,this._defaultNodeLabelFn=e.constant(void 0),this._defaultEdgeLabelFn=e.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[n]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}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(f){return this._label=f,this},s.prototype.graph=function(){return this._label},s.prototype.setDefaultNodeLabel=function(f){return e.isFunction(f)||(f=e.constant(f)),this._defaultNodeLabelFn=f,this},s.prototype.nodeCount=function(){return this._nodeCount},s.prototype.nodes=function(){return e.keys(this._nodes)},s.prototype.sources=function(){var f=this;return e.filter(this.nodes(),function(p){return e.isEmpty(f._in[p])})},s.prototype.sinks=function(){var f=this;return e.filter(this.nodes(),function(p){return e.isEmpty(f._out[p])})},s.prototype.setNodes=function(f,p){var g=arguments,v=this;return e.each(f,function(k){g.length>1?v.setNode(k,p):v.setNode(k)}),this},s.prototype.setNode=function(f,p){return e.has(this._nodes,f)?(arguments.length>1&&(this._nodes[f]=p),this):(this._nodes[f]=arguments.length>1?p:this._defaultNodeLabelFn(f),this._isCompound&&(this._parent[f]=n,this._children[f]={},this._children[n][f]=!0),this._in[f]={},this._preds[f]={},this._out[f]={},this._sucs[f]={},++this._nodeCount,this)},s.prototype.node=function(f){return this._nodes[f]},s.prototype.hasNode=function(f){return e.has(this._nodes,f)},s.prototype.removeNode=function(f){var p=this;if(e.has(this._nodes,f)){var g=function(v){p.removeEdge(p._edgeObjs[v])};delete this._nodes[f],this._isCompound&&(this._removeFromParentsChildList(f),delete this._parent[f],e.each(this.children(f),function(v){p.setParent(v)}),delete this._children[f]),e.each(e.keys(this._in[f]),g),delete this._in[f],delete this._preds[f],e.each(e.keys(this._out[f]),g),delete this._out[f],delete this._sucs[f],--this._nodeCount}return this},s.prototype.setParent=function(f,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===f)throw new Error("Setting "+p+" as parent of "+f+" would create a cycle");this.setNode(p)}return this.setNode(f),this._removeFromParentsChildList(f),this._parent[f]=p,this._children[p][f]=!0,this},s.prototype._removeFromParentsChildList=function(f){delete this._children[this._parent[f]][f]},s.prototype.parent=function(f){if(this._isCompound){var p=this._parent[f];if(p!==n)return p}},s.prototype.children=function(f){if(e.isUndefined(f)&&(f=n),this._isCompound){var p=this._children[f];if(p)return e.keys(p)}else{if(f===n)return this.nodes();if(this.hasNode(f))return[]}},s.prototype.predecessors=function(f){var p=this._preds[f];if(p)return e.keys(p)},s.prototype.successors=function(f){var p=this._sucs[f];if(p)return e.keys(p)},s.prototype.neighbors=function(f){var p=this.predecessors(f);if(p)return e.union(p,this.successors(f))},s.prototype.isLeaf=function(f){var p;return this.isDirected()?p=this.successors(f):p=this.neighbors(f),p.length===0},s.prototype.filterNodes=function(f){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(b,x){f(x)&&p.setNode(x,b)}),e.each(this._edgeObjs,function(b){p.hasNode(b.v)&&p.hasNode(b.w)&&p.setEdge(b,g.edge(b))});var v={};function k(b){var x=g.parent(b);return x===void 0||p.hasNode(x)?(v[b]=x,x):x in v?v[x]:k(x)}return this._isCompound&&e.each(p.nodes(),function(b){p.setParent(b,k(b))}),p},s.prototype.setDefaultEdgeLabel=function(f){return e.isFunction(f)||(f=e.constant(f)),this._defaultEdgeLabelFn=f,this},s.prototype.edgeCount=function(){return this._edgeCount},s.prototype.edges=function(){return e.values(this._edgeObjs)},s.prototype.setPath=function(f,p){var g=this,v=arguments;return e.reduce(f,function(k,b){return v.length>1?g.setEdge(k,b,p):g.setEdge(k,b),b}),this},s.prototype.setEdge=function(){var f,p,g,v,k=!1,b=arguments[0];typeof b=="object"&&b!==null&&"v"in b?(f=b.v,p=b.w,g=b.name,arguments.length===2&&(v=arguments[1],k=!0)):(f=b,p=arguments[1],g=arguments[3],arguments.length>2&&(v=arguments[2],k=!0)),f=""+f,p=""+p,e.isUndefined(g)||(g=""+g);var x=u(this._isDirected,f,p,g);if(e.has(this._edgeLabels,x))return k&&(this._edgeLabels[x]=v),this;if(!e.isUndefined(g)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(f),this.setNode(p),this._edgeLabels[x]=k?v:this._defaultEdgeLabelFn(f,p,g);var N=d(this._isDirected,f,p,g);return f=N.v,p=N.w,Object.freeze(N),this._edgeObjs[x]=N,o(this._preds[p],f),o(this._sucs[f],p),this._in[p][x]=N,this._out[f][x]=N,this._edgeCount++,this},s.prototype.edge=function(f,p,g){var v=arguments.length===1?h(this._isDirected,arguments[0]):u(this._isDirected,f,p,g);return this._edgeLabels[v]},s.prototype.hasEdge=function(f,p,g){var v=arguments.length===1?h(this._isDirected,arguments[0]):u(this._isDirected,f,p,g);return e.has(this._edgeLabels,v)},s.prototype.removeEdge=function(f,p,g){var v=arguments.length===1?h(this._isDirected,arguments[0]):u(this._isDirected,f,p,g),k=this._edgeObjs[v];return k&&(f=k.v,p=k.w,delete this._edgeLabels[v],delete this._edgeObjs[v],l(this._preds[p],f),l(this._sucs[f],p),delete this._in[p][v],delete this._out[f][v],this._edgeCount--),this},s.prototype.inEdges=function(f,p){var g=this._in[f];if(g){var v=e.values(g);return p?e.filter(v,function(k){return k.v===p}):v}},s.prototype.outEdges=function(f,p){var g=this._out[f];if(g){var v=e.values(g);return p?e.filter(v,function(k){return k.w===p}):v}},s.prototype.nodeEdges=function(f,p){var g=this.inEdges(f,p);if(g)return g.concat(this.outEdges(f,p))};function o(f,p){f[p]?f[p]++:f[p]=1}function l(f,p){--f[p]||delete f[p]}function u(f,p,g,v){var k=""+p,b=""+g;if(!f&&k>b){var x=k;k=b,b=x}return k+r+b+r+(e.isUndefined(v)?t:v)}function d(f,p,g,v){var k=""+p,b=""+g;if(!f&&k>b){var x=k;k=b,b=x}var N={v:k,w:b};return v&&(N.name=v),N}function h(f,p){return u(f,p.v,p.w,p.name)}return tw}var nw,lT;function nJ(){return lT||(lT=1,nw="2.1.8"),nw}var rw,cT;function rJ(){return cT||(cT=1,rw={Graph:y0(),version:nJ()}),rw}var sw,uT;function sJ(){if(uT)return sw;uT=1;var e=Un(),t=y0();sw={write:n,read:o};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),h=l.parent(u),f={v:u};return e.isUndefined(d)||(f.value=d),e.isUndefined(h)||(f.parent=h),f})}function s(l){return e.map(l.edges(),function(u){var d=l.edge(u),h={v:u.v,w:u.w};return e.isUndefined(u.name)||(h.name=u.name),e.isUndefined(d)||(h.value=d),h})}function o(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 sw}var aw,dT;function aJ(){if(dT)return aw;dT=1;var e=Un();aw=t;function t(n){var r={},s=[],o;function l(u){e.has(r,u)||(r[u]=!0,o.push(u),e.each(n.successors(u),l),e.each(n.predecessors(u),l))}return e.each(n.nodes(),function(u){o=[],l(u),o.length&&s.push(o)}),s}return aw}var ow,hT;function oO(){if(hT)return ow;hT=1;var e=Un();ow=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 o=this._arr,l=o.length;return s[n]=l,o.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,o=s+1,l=n;s<r.length&&(l=r[s].priority<r[l].priority?s:l,o<r.length&&(l=r[o].priority<r[l].priority?o:l),l!==n&&(this._swap(n,l),this._heapify(l)))},t.prototype._decrease=function(n){for(var r=this._arr,s=r[n].priority,o;n!==0&&(o=n>>1,!(r[o].priority<s));)this._swap(n,o),n=o},t.prototype._swap=function(n,r){var s=this._arr,o=this._keyIndices,l=s[n],u=s[r];s[n]=u,s[r]=l,o[u.key]=n,o[l.key]=r},ow}var iw,fT;function iO(){if(fT)return iw;fT=1;var e=Un(),t=oO();iw=r;var n=e.constant(1);function r(o,l,u,d){return s(o,String(l),u||n,d||function(h){return o.outEdges(h)})}function s(o,l,u,d){var h={},f=new t,p,g,v=function(k){var b=k.v!==p?k.v:k.w,x=h[b],N=u(k),S=g.distance+N;if(N<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+k+" Weight: "+N);S<x.distance&&(x.distance=S,x.predecessor=p,f.decrease(b,S))};for(o.nodes().forEach(function(k){var b=k===l?0:Number.POSITIVE_INFINITY;h[k]={distance:b},f.add(k,b)});f.size()>0&&(p=f.removeMin(),g=h[p],g.distance!==Number.POSITIVE_INFINITY);)d(p).forEach(v);return h}return iw}var lw,pT;function oJ(){if(pT)return lw;pT=1;var e=iO(),t=Un();lw=n;function n(r,s,o){return t.transform(r.nodes(),function(l,u){l[u]=e(r,u,s,o)},{})}return lw}var cw,mT;function lO(){if(mT)return cw;mT=1;var e=Un();cw=t;function t(n){var r=0,s=[],o={},l=[];function u(d){var h=o[d]={onStack:!0,lowlink:r,index:r++};if(s.push(d),n.successors(d).forEach(function(g){e.has(o,g)?o[g].onStack&&(h.lowlink=Math.min(h.lowlink,o[g].index)):(u(g),h.lowlink=Math.min(h.lowlink,o[g].lowlink))}),h.lowlink===h.index){var f=[],p;do p=s.pop(),o[p].onStack=!1,f.push(p);while(d!==p);l.push(f)}}return n.nodes().forEach(function(d){e.has(o,d)||u(d)}),l}return cw}var uw,gT;function iJ(){if(gT)return uw;gT=1;var e=Un(),t=lO();uw=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 uw}var dw,yT;function lJ(){if(yT)return dw;yT=1;var e=Un();dw=n;var t=e.constant(1);function n(s,o,l){return r(s,o||t,l||function(u){return s.outEdges(u)})}function r(s,o,l){var u={},d=s.nodes();return d.forEach(function(h){u[h]={},u[h][h]={distance:0},d.forEach(function(f){h!==f&&(u[h][f]={distance:Number.POSITIVE_INFINITY})}),l(h).forEach(function(f){var p=f.v===h?f.w:f.v,g=o(f);u[h][p]={distance:g,predecessor:h}})}),d.forEach(function(h){var f=u[h];d.forEach(function(p){var g=u[p];d.forEach(function(v){var k=g[h],b=f[v],x=g[v],N=k.distance+b.distance;N<x.distance&&(x.distance=N,x.predecessor=b.predecessor)})})}),u}return dw}var hw,wT;function cO(){if(wT)return hw;wT=1;var e=Un();hw=t,t.CycleException=n;function t(r){var s={},o={},l=[];function u(d){if(e.has(o,d))throw new n;e.has(s,d)||(o[d]=!0,s[d]=!0,e.each(r.predecessors(d),u),delete o[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,hw}var fw,vT;function cJ(){if(vT)return fw;vT=1;var e=cO();fw=t;function t(n){try{e(n)}catch(r){if(r instanceof e.CycleException)return!1;throw r}return!0}return fw}var pw,xT;function uO(){if(xT)return pw;xT=1;var e=Un();pw=t;function t(r,s,o){e.isArray(s)||(s=[s]);var l=(r.isDirected()?r.successors:r.neighbors).bind(r),u=[],d={};return e.each(s,function(h){if(!r.hasNode(h))throw new Error("Graph does not have node: "+h);n(r,h,o==="post",d,l,u)}),u}function n(r,s,o,l,u,d){e.has(l,s)||(l[s]=!0,o||d.push(s),e.each(u(s),function(h){n(r,h,o,l,u,d)}),o&&d.push(s))}return pw}var mw,bT;function uJ(){if(bT)return mw;bT=1;var e=uO();mw=t;function t(n,r){return e(n,r,"post")}return mw}var gw,kT;function dJ(){if(kT)return gw;kT=1;var e=uO();gw=t;function t(n,r){return e(n,r,"pre")}return gw}var yw,NT;function hJ(){if(NT)return yw;NT=1;var e=Un(),t=y0(),n=oO();yw=r;function r(s,o){var l=new t,u={},d=new n,h;function f(g){var v=g.v===h?g.w:g.v,k=d.priority(v);if(k!==void 0){var b=o(g);b<k&&(u[v]=h,d.decrease(v,b))}}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(h=d.removeMin(),e.has(u,h))l.setEdge(h,u[h]);else{if(p)throw new Error("Input graph is not connected: "+s);p=!0}s.nodeEdges(h).forEach(f)}return l}return yw}var ww,jT;function fJ(){return jT||(jT=1,ww={components:aJ(),dijkstra:iO(),dijkstraAll:oJ(),findCycles:iJ(),floydWarshall:lJ(),isAcyclic:cJ(),postorder:uJ(),preorder:dJ(),prim:hJ(),tarjan:lO(),topsort:cO()}),ww}var vw,ST;function pJ(){if(ST)return vw;ST=1;var e=rJ();return vw={Graph:e.Graph,json:sJ(),alg:fJ(),version:e.version},vw}var xw,_T;function ur(){if(_T)return xw;_T=1;var e;if(typeof t0=="function")try{e=pJ()}catch{}return e||(e=window.graphlib),xw=e,xw}var bw,ET;function mJ(){if(ET)return bw;ET=1;var e=OI(),t=1,n=4;function r(s){return e(s,t|n)}return bw=r,bw}var kw,CT;function hh(){if(CT)return kw;CT=1;var e=gi(),t=fs(),n=rh(),r=Bn();function s(o,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],o):!1}return kw=s,kw}var Nw,TT;function gJ(){if(TT)return Nw;TT=1;var e=dh(),t=gi(),n=hh(),r=Wa(),s=Object.prototype,o=s.hasOwnProperty,l=e(function(u,d){u=Object(u);var h=-1,f=d.length,p=f>2?d[2]:void 0;for(p&&n(d[0],d[1],p)&&(f=1);++h<f;)for(var g=d[h],v=r(g),k=-1,b=v.length;++k<b;){var x=v[k],N=u[x];(N===void 0||t(N,s[x])&&!o.call(u,x))&&(u[x]=g[x])}return u});return Nw=l,Nw}var jw,RT;function yJ(){if(RT)return jw;RT=1;var e=ps(),t=fs(),n=Qs();function r(s){return function(o,l,u){var d=Object(o);if(!t(o)){var h=e(l,3);o=n(o),l=function(p){return h(d[p],p,d)}}var f=s(o,l,u);return f>-1?d[h?o[f]:f]:void 0}}return jw=r,jw}var Sw,AT;function wJ(){if(AT)return Sw;AT=1;var e=/\s/;function t(n){for(var r=n.length;r--&&e.test(n.charAt(r)););return r}return Sw=t,Sw}var _w,MT;function vJ(){if(MT)return _w;MT=1;var e=wJ(),t=/^\s+/;function n(r){return r&&r.slice(0,e(r)+1).replace(t,"")}return _w=n,_w}var Ew,$T;function xJ(){if($T)return Ew;$T=1;var e=vJ(),t=Bn(),n=xi(),r=NaN,s=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,l=/^0o[0-7]+$/i,u=parseInt;function d(h){if(typeof h=="number")return h;if(n(h))return r;if(t(h)){var f=typeof h.valueOf=="function"?h.valueOf():h;h=t(f)?f+"":f}if(typeof h!="string")return h===0?h:+h;h=e(h);var p=o.test(h);return p||l.test(h)?u(h.slice(2),p?2:8):s.test(h)?r:+h}return Ew=d,Ew}var Cw,IT;function dO(){if(IT)return Cw;IT=1;var e=xJ(),t=1/0,n=17976931348623157e292;function r(s){if(!s)return s===0?s:0;if(s=e(s),s===t||s===-t){var o=s<0?-1:1;return o*n}return s===s?s:0}return Cw=r,Cw}var Tw,OT;function bJ(){if(OT)return Tw;OT=1;var e=dO();function t(n){var r=e(n),s=r%1;return r===r?s?r-s:r:0}return Tw=t,Tw}var Rw,LT;function kJ(){if(LT)return Rw;LT=1;var e=rO(),t=ps(),n=bJ(),r=Math.max;function s(o,l,u){var d=o==null?0:o.length;if(!d)return-1;var h=u==null?0:n(u);return h<0&&(h=r(d+h,0)),e(o,t(l,3),h)}return Rw=s,Rw}var Aw,PT;function NJ(){if(PT)return Aw;PT=1;var e=yJ(),t=kJ(),n=e(t);return Aw=n,Aw}var Mw,DT;function hO(){if(DT)return Mw;DT=1;var e=g0();function t(n){var r=n==null?0:n.length;return r?e(n,1):[]}return Mw=t,Mw}var $w,FT;function jJ(){if(FT)return $w;FT=1;var e=h0(),t=LI(),n=Wa();function r(s,o){return s==null?s:e(s,t(o),n)}return $w=r,$w}var Iw,qT;function SJ(){if(qT)return Iw;qT=1;function e(t){var n=t==null?0:t.length;return n?t[n-1]:void 0}return Iw=e,Iw}var Ow,BT;function _J(){if(BT)return Ow;BT=1;var e=th(),t=f0(),n=ps();function r(s,o){var l={};return o=n(o,3),t(s,function(u,d,h){e(l,d,o(u,d,h))}),l}return Ow=r,Ow}var Lw,UT;function w0(){if(UT)return Lw;UT=1;var e=xi();function t(n,r,s){for(var o=-1,l=n.length;++o<l;){var u=n[o],d=r(u);if(d!=null&&(h===void 0?d===d&&!e(d):s(d,h)))var h=d,f=u}return f}return Lw=t,Lw}var Pw,zT;function EJ(){if(zT)return Pw;zT=1;function e(t,n){return t>n}return Pw=e,Pw}var Dw,WT;function CJ(){if(WT)return Dw;WT=1;var e=w0(),t=EJ(),n=Ha();function r(s){return s&&s.length?e(s,n,t):void 0}return Dw=r,Dw}var Fw,HT;function fO(){if(HT)return Fw;HT=1;var e=th(),t=gi();function n(r,s,o){(o!==void 0&&!t(r[s],o)||o===void 0&&!(s in r))&&e(r,s,o)}return Fw=n,Fw}var qw,VT;function TJ(){if(VT)return qw;VT=1;var e=Ua(),t=oh(),n=Fr(),r="[object Object]",s=Function.prototype,o=Object.prototype,l=s.toString,u=o.hasOwnProperty,d=l.call(Object);function h(f){if(!n(f)||e(f)!=r)return!1;var p=t(f);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 qw=h,qw}var Bw,GT;function pO(){if(GT)return Bw;GT=1;function e(t,n){if(!(n==="constructor"&&typeof t[n]=="function")&&n!="__proto__")return t[n]}return Bw=e,Bw}var Uw,KT;function RJ(){if(KT)return Uw;KT=1;var e=tc(),t=Wa();function n(r){return e(r,t(r))}return Uw=n,Uw}var zw,YT;function AJ(){if(YT)return zw;YT=1;var e=fO(),t=NI(),n=MI(),r=jI(),s=II(),o=nc(),l=Nt(),u=sO(),d=wi(),h=ec(),f=Bn(),p=TJ(),g=rc(),v=pO(),k=RJ();function b(x,N,S,_,E,T,R){var A=v(x,S),q=v(N,S),L=R.get(q);if(L){e(x,S,L);return}var P=T?T(A,q,S+"",x,N,R):void 0,I=P===void 0;if(I){var O=l(q),U=!O&&d(q),M=!O&&!U&&g(q);P=q,O||U||M?l(A)?P=A:u(A)?P=r(A):U?(I=!1,P=t(q,!0)):M?(I=!1,P=n(q,!0)):P=[]:p(q)||o(q)?(P=A,o(A)?P=k(A):(!f(A)||h(A))&&(P=s(q))):I=!1}I&&(R.set(q,P),E(P,q,_,T,R),R.delete(q)),e(x,S,P)}return zw=b,zw}var Ww,XT;function MJ(){if(XT)return Ww;XT=1;var e=eh(),t=fO(),n=h0(),r=AJ(),s=Bn(),o=Wa(),l=pO();function u(d,h,f,p,g){d!==h&&n(h,function(v,k){if(g||(g=new e),s(v))r(d,h,k,f,u,p,g);else{var b=p?p(l(d,k),v,k+"",d,h,g):void 0;b===void 0&&(b=v),t(d,k,b)}},o)}return Ww=u,Ww}var Hw,ZT;function $J(){if(ZT)return Hw;ZT=1;var e=dh(),t=hh();function n(r){return e(function(s,o){var l=-1,u=o.length,d=u>1?o[u-1]:void 0,h=u>2?o[2]:void 0;for(d=r.length>3&&typeof d=="function"?(u--,d):void 0,h&&t(o[0],o[1],h)&&(d=u<3?void 0:d,u=1),s=Object(s);++l<u;){var f=o[l];f&&r(s,f,l,d)}return s})}return Hw=n,Hw}var Vw,JT;function IJ(){if(JT)return Vw;JT=1;var e=MJ(),t=$J(),n=t(function(r,s,o){e(r,s,o)});return Vw=n,Vw}var Gw,QT;function mO(){if(QT)return Gw;QT=1;function e(t,n){return t<n}return Gw=e,Gw}var Kw,eR;function OJ(){if(eR)return Kw;eR=1;var e=w0(),t=mO(),n=Ha();function r(s){return s&&s.length?e(s,n,t):void 0}return Kw=r,Kw}var Yw,tR;function LJ(){if(tR)return Yw;tR=1;var e=w0(),t=ps(),n=mO();function r(s,o){return s&&s.length?e(s,t(o,2),n):void 0}return Yw=r,Yw}var Xw,nR;function PJ(){if(nR)return Xw;nR=1;var e=fr(),t=function(){return e.Date.now()};return Xw=t,Xw}var Zw,rR;function DJ(){if(rR)return Zw;rR=1;var e=nh(),t=ch(),n=rh(),r=Bn(),s=sc();function o(l,u,d,h){if(!r(l))return l;u=t(u,l);for(var f=-1,p=u.length,g=p-1,v=l;v!=null&&++f<p;){var k=s(u[f]),b=d;if(k==="__proto__"||k==="constructor"||k==="prototype")return l;if(f!=g){var x=v[k];b=h?h(x,k,v):void 0,b===void 0&&(b=r(x)?x:n(u[f+1])?[]:{})}e(v,k,b),v=v[k]}return l}return Zw=o,Zw}var Jw,sR;function FJ(){if(sR)return Jw;sR=1;var e=uh(),t=DJ(),n=ch();function r(s,o,l){for(var u=-1,d=o.length,h={};++u<d;){var f=o[u],p=e(s,f);l(p,f)&&t(h,n(f,s),p)}return h}return Jw=r,Jw}var Qw,aR;function qJ(){if(aR)return Qw;aR=1;var e=FJ(),t=GI();function n(r,s){return e(r,s,function(o,l){return t(r,l)})}return Qw=n,Qw}var ev,oR;function BJ(){if(oR)return ev;oR=1;var e=hO(),t=tO(),n=nO();function r(s){return n(t(s,void 0,e),s+"")}return ev=r,ev}var tv,iR;function UJ(){if(iR)return tv;iR=1;var e=qJ(),t=BJ(),n=t(function(r,s){return r==null?{}:e(r,s)});return tv=n,tv}var nv,lR;function zJ(){if(lR)return nv;lR=1;var e=Math.ceil,t=Math.max;function n(r,s,o,l){for(var u=-1,d=t(e((s-r)/(o||1)),0),h=Array(d);d--;)h[l?d:++u]=r,r+=o;return h}return nv=n,nv}var rv,cR;function WJ(){if(cR)return rv;cR=1;var e=zJ(),t=hh(),n=dO();function r(s){return function(o,l,u){return u&&typeof u!="number"&&t(o,l,u)&&(l=u=void 0),o=n(o),l===void 0?(l=o,o=0):l=n(l),u=u===void 0?o<l?1:-1:n(u),e(o,l,u,s)}}return rv=r,rv}var sv,uR;function HJ(){if(uR)return sv;uR=1;var e=WJ(),t=e();return sv=t,sv}var av,dR;function VJ(){if(dR)return av;dR=1;function e(t,n){var r=t.length;for(t.sort(n);r--;)t[r]=t[r].value;return t}return av=e,av}var ov,hR;function GJ(){if(hR)return ov;hR=1;var e=xi();function t(n,r){if(n!==r){var s=n!==void 0,o=n===null,l=n===n,u=e(n),d=r!==void 0,h=r===null,f=r===r,p=e(r);if(!h&&!p&&!u&&n>r||u&&d&&f&&!h&&!p||o&&d&&f||!s&&f||!l)return 1;if(!o&&!u&&!p&&n<r||p&&s&&l&&!o&&!u||h&&s&&l||!d&&l||!f)return-1}return 0}return ov=t,ov}var iv,fR;function KJ(){if(fR)return iv;fR=1;var e=GJ();function t(n,r,s){for(var o=-1,l=n.criteria,u=r.criteria,d=l.length,h=s.length;++o<d;){var f=e(l[o],u[o]);if(f){if(o>=h)return f;var p=s[o];return f*(p=="desc"?-1:1)}}return n.index-r.index}return iv=t,iv}var lv,pR;function YJ(){if(pR)return lv;pR=1;var e=lh(),t=uh(),n=ps(),r=JI(),s=VJ(),o=sh(),l=KJ(),u=Ha(),d=Nt();function h(f,p,g){p.length?p=e(p,function(b){return d(b)?function(x){return t(x,b.length===1?b[0]:b)}:b}):p=[u];var v=-1;p=e(p,o(n));var k=r(f,function(b,x,N){var S=e(p,function(_){return _(b)});return{criteria:S,index:++v,value:b}});return s(k,function(b,x){return l(b,x,g)})}return lv=h,lv}var cv,mR;function XJ(){if(mR)return cv;mR=1;var e=g0(),t=YJ(),n=dh(),r=hh(),s=n(function(o,l){if(o==null)return[];var u=l.length;return u>1&&r(o,l[0],l[1])?l=[]:u>2&&r(l[0],l[1],l[2])&&(l=[l[0]]),t(o,e(l,1),[])});return cv=s,cv}var uv,gR;function ZJ(){if(gR)return uv;gR=1;var e=HI(),t=0;function n(r){var s=++t;return e(r)+s}return uv=n,uv}var dv,yR;function JJ(){if(yR)return dv;yR=1;function e(t,n,r){for(var s=-1,o=t.length,l=n.length,u={};++s<o;){var d=s<l?n[s]:void 0;r(u,t[s],d)}return u}return dv=e,dv}var hv,wR;function QJ(){if(wR)return hv;wR=1;var e=nh(),t=JJ();function n(r,s){return t(r||[],s||[],e)}return hv=n,hv}var fv,vR;function ut(){if(vR)return fv;vR=1;var e;if(typeof t0=="function")try{e={cloneDeep:mJ(),constant:d0(),defaults:gJ(),each:DI(),filter:YI(),find:NJ(),flatten:hO(),forEach:PI(),forIn:jJ(),has:XI(),isUndefined:ZI(),last:SJ(),map:QI(),mapValues:_J(),max:CJ(),merge:IJ(),min:OJ(),minBy:LJ(),now:PJ(),pick:UJ(),range:HJ(),reduce:eO(),sortBy:XJ(),uniqueId:ZJ(),values:aO(),zipObject:QJ()}}catch{}return e||(e=window._),fv=e,fv}var pv,xR;function eQ(){if(xR)return pv;xR=1,pv=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,o=s._prev;o!==s;)r.push(JSON.stringify(o,n)),o=o._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 pv}var mv,bR;function tQ(){if(bR)return mv;bR=1;var e=ut(),t=ur().Graph,n=eQ();mv=s;var r=e.constant(1);function s(h,f){if(h.nodeCount()<=1)return[];var p=u(h,f||r),g=o(p.graph,p.buckets,p.zeroIdx);return e.flatten(e.map(g,function(v){return h.outEdges(v.v,v.w)}),!0)}function o(h,f,p){for(var g=[],v=f[f.length-1],k=f[0],b;h.nodeCount();){for(;b=k.dequeue();)l(h,f,p,b);for(;b=v.dequeue();)l(h,f,p,b);if(h.nodeCount()){for(var x=f.length-2;x>0;--x)if(b=f[x].dequeue(),b){g=g.concat(l(h,f,p,b,!0));break}}}return g}function l(h,f,p,g,v){var k=v?[]:void 0;return e.forEach(h.inEdges(g.v),function(b){var x=h.edge(b),N=h.node(b.v);v&&k.push({v:b.v,w:b.w}),N.out-=x,d(f,p,N)}),e.forEach(h.outEdges(g.v),function(b){var x=h.edge(b),N=b.w,S=h.node(N);S.in-=x,d(f,p,S)}),h.removeNode(g.v),k}function u(h,f){var p=new t,g=0,v=0;e.forEach(h.nodes(),function(x){p.setNode(x,{v:x,in:0,out:0})}),e.forEach(h.edges(),function(x){var N=p.edge(x.v,x.w)||0,S=f(x),_=N+S;p.setEdge(x.v,x.w,_),v=Math.max(v,p.node(x.v).out+=S),g=Math.max(g,p.node(x.w).in+=S)});var k=e.range(v+g+3).map(function(){return new n}),b=g+1;return e.forEach(p.nodes(),function(x){d(k,b,p.node(x))}),{graph:p,buckets:k,zeroIdx:b}}function d(h,f,p){p.out?p.in?h[p.out-p.in+f].enqueue(p):h[h.length-1].enqueue(p):h[0].enqueue(p)}return mv}var gv,kR;function nQ(){if(kR)return gv;kR=1;var e=ut(),t=tQ();gv={run:n,undo:s};function n(o){var l=o.graph().acyclicer==="greedy"?t(o,u(o)):r(o);e.forEach(l,function(d){var h=o.edge(d);o.removeEdge(d),h.forwardName=d.name,h.reversed=!0,o.setEdge(d.w,d.v,h,e.uniqueId("rev"))});function u(d){return function(h){return d.edge(h).weight}}}function r(o){var l=[],u={},d={};function h(f){e.has(d,f)||(d[f]=!0,u[f]=!0,e.forEach(o.outEdges(f),function(p){e.has(u,p.w)?l.push(p):h(p.w)}),delete u[f])}return e.forEach(o.nodes(),h),l}function s(o){e.forEach(o.edges(),function(l){var u=o.edge(l);if(u.reversed){o.removeEdge(l);var d=u.forwardName;delete u.reversed,delete u.forwardName,o.setEdge(l.w,l.v,u,d)}})}return gv}var yv,NR;function dn(){if(NR)return yv;NR=1;var e=ut(),t=ur().Graph;yv={addDummyNode:n,simplify:r,asNonCompoundGraph:s,successorWeights:o,predecessorWeights:l,intersectRect:u,buildLayerMatrix:d,normalizeRanks:h,removeEmptyRanks:f,addBorderNode:p,maxRank:g,partition:v,time:k,notime:b};function n(x,N,S,_){var E;do E=e.uniqueId(_);while(x.hasNode(E));return S.dummy=N,x.setNode(E,S),E}function r(x){var N=new t().setGraph(x.graph());return e.forEach(x.nodes(),function(S){N.setNode(S,x.node(S))}),e.forEach(x.edges(),function(S){var _=N.edge(S.v,S.w)||{weight:0,minlen:1},E=x.edge(S);N.setEdge(S.v,S.w,{weight:_.weight+E.weight,minlen:Math.max(_.minlen,E.minlen)})}),N}function s(x){var N=new t({multigraph:x.isMultigraph()}).setGraph(x.graph());return e.forEach(x.nodes(),function(S){x.children(S).length||N.setNode(S,x.node(S))}),e.forEach(x.edges(),function(S){N.setEdge(S,x.edge(S))}),N}function o(x){var N=e.map(x.nodes(),function(S){var _={};return e.forEach(x.outEdges(S),function(E){_[E.w]=(_[E.w]||0)+x.edge(E).weight}),_});return e.zipObject(x.nodes(),N)}function l(x){var N=e.map(x.nodes(),function(S){var _={};return e.forEach(x.inEdges(S),function(E){_[E.v]=(_[E.v]||0)+x.edge(E).weight}),_});return e.zipObject(x.nodes(),N)}function u(x,N){var S=x.x,_=x.y,E=N.x-S,T=N.y-_,R=x.width/2,A=x.height/2;if(!E&&!T)throw new Error("Not possible to find intersection inside of the rectangle");var q,L;return Math.abs(T)*R>Math.abs(E)*A?(T<0&&(A=-A),q=A*E/T,L=A):(E<0&&(R=-R),q=R,L=R*T/E),{x:S+q,y:_+L}}function d(x){var N=e.map(e.range(g(x)+1),function(){return[]});return e.forEach(x.nodes(),function(S){var _=x.node(S),E=_.rank;e.isUndefined(E)||(N[E][_.order]=S)}),N}function h(x){var N=e.min(e.map(x.nodes(),function(S){return x.node(S).rank}));e.forEach(x.nodes(),function(S){var _=x.node(S);e.has(_,"rank")&&(_.rank-=N)})}function f(x){var N=e.min(e.map(x.nodes(),function(T){return x.node(T).rank})),S=[];e.forEach(x.nodes(),function(T){var R=x.node(T).rank-N;S[R]||(S[R]=[]),S[R].push(T)});var _=0,E=x.graph().nodeRankFactor;e.forEach(S,function(T,R){e.isUndefined(T)&&R%E!==0?--_:_&&e.forEach(T,function(A){x.node(A).rank+=_})})}function p(x,N,S,_){var E={width:0,height:0};return arguments.length>=4&&(E.rank=S,E.order=_),n(x,"border",E,N)}function g(x){return e.max(e.map(x.nodes(),function(N){var S=x.node(N).rank;if(!e.isUndefined(S))return S}))}function v(x,N){var S={lhs:[],rhs:[]};return e.forEach(x,function(_){N(_)?S.lhs.push(_):S.rhs.push(_)}),S}function k(x,N){var S=e.now();try{return N()}finally{console.log(x+" time: "+(e.now()-S)+"ms")}}function b(x,N){return N()}return yv}var wv,jR;function rQ(){if(jR)return wv;jR=1;var e=ut(),t=dn();wv={run:n,undo:s};function n(o){o.graph().dummyChains=[],e.forEach(o.edges(),function(l){r(o,l)})}function r(o,l){var u=l.v,d=o.node(u).rank,h=l.w,f=o.node(h).rank,p=l.name,g=o.edge(l),v=g.labelRank;if(f!==d+1){o.removeEdge(l);var k,b,x;for(x=0,++d;d<f;++x,++d)g.points=[],b={width:0,height:0,edgeLabel:g,edgeObj:l,rank:d},k=t.addDummyNode(o,"edge",b,"_d"),d===v&&(b.width=g.width,b.height=g.height,b.dummy="edge-label",b.labelpos=g.labelpos),o.setEdge(u,k,{weight:g.weight},p),x===0&&o.graph().dummyChains.push(k),u=k;o.setEdge(u,h,{weight:g.weight},p)}}function s(o){e.forEach(o.graph().dummyChains,function(l){var u=o.node(l),d=u.edgeLabel,h;for(o.setEdge(u.edgeObj,d);u.dummy;)h=o.successors(l)[0],o.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=h,u=o.node(l)})}return wv}var vv,SR;function vd(){if(SR)return vv;SR=1;var e=ut();vv={longestPath:t,slack:n};function t(r){var s={};function o(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(h){return o(h.w)-r.edge(h).minlen}));return(d===Number.POSITIVE_INFINITY||d===void 0||d===null)&&(d=0),u.rank=d}e.forEach(r.sources(),o)}function n(r,s){return r.node(s.w).rank-r.node(s.v).rank-r.edge(s).minlen}return vv}var xv,_R;function gO(){if(_R)return xv;_R=1;var e=ut(),t=ur().Graph,n=vd().slack;xv=r;function r(u){var d=new t({directed:!1}),h=u.nodes()[0],f=u.nodeCount();d.setNode(h,{});for(var p,g;s(d,u)<f;)p=o(d,u),g=d.hasNode(p.v)?n(u,p):-n(u,p),l(d,u,g);return d}function s(u,d){function h(f){e.forEach(d.nodeEdges(f),function(p){var g=p.v,v=f===g?p.w:g;!u.hasNode(v)&&!n(d,p)&&(u.setNode(v,{}),u.setEdge(f,v,{}),h(v))})}return e.forEach(u.nodes(),h),u.nodeCount()}function o(u,d){return e.minBy(d.edges(),function(h){if(u.hasNode(h.v)!==u.hasNode(h.w))return n(d,h)})}function l(u,d,h){e.forEach(u.nodes(),function(f){d.node(f).rank+=h})}return xv}var bv,ER;function sQ(){if(ER)return bv;ER=1;var e=ut(),t=gO(),n=vd().slack,r=vd().longestPath,s=ur().alg.preorder,o=ur().alg.postorder,l=dn().simplify;bv=u,u.initLowLimValues=p,u.initCutValues=d,u.calcCutValue=f,u.leaveEdge=v,u.enterEdge=k,u.exchangeEdges=b;function u(_){_=l(_),r(_);var E=t(_);p(E),d(E,_);for(var T,R;T=v(E);)R=k(E,_,T),b(E,_,T,R)}function d(_,E){var T=o(_,_.nodes());T=T.slice(0,T.length-1),e.forEach(T,function(R){h(_,E,R)})}function h(_,E,T){var R=_.node(T),A=R.parent;_.edge(T,A).cutvalue=f(_,E,T)}function f(_,E,T){var R=_.node(T),A=R.parent,q=!0,L=E.edge(T,A),P=0;return L||(q=!1,L=E.edge(A,T)),P=L.weight,e.forEach(E.nodeEdges(T),function(I){var O=I.v===T,U=O?I.w:I.v;if(U!==A){var M=O===q,$=E.edge(I).weight;if(P+=M?$:-$,N(_,T,U)){var B=_.edge(T,U).cutvalue;P+=M?-B:B}}}),P}function p(_,E){arguments.length<2&&(E=_.nodes()[0]),g(_,{},1,E)}function g(_,E,T,R,A){var q=T,L=_.node(R);return E[R]=!0,e.forEach(_.neighbors(R),function(P){e.has(E,P)||(T=g(_,E,T,P,R))}),L.low=q,L.lim=T++,A?L.parent=A:delete L.parent,T}function v(_){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 q=_.node(R),L=_.node(A),P=q,I=!1;q.lim>L.lim&&(P=L,I=!0);var O=e.filter(E.edges(),function(U){return I===S(_,_.node(U.v),P)&&I!==S(_,_.node(U.w),P)});return e.minBy(O,function(U){return n(E,U)})}function b(_,E,T,R){var A=T.v,q=T.w;_.removeEdge(A,q),_.setEdge(R.v,R.w,{}),p(_),d(_,E),x(_,E)}function x(_,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 q=_.node(A).parent,L=E.edge(A,q),P=!1;L||(L=E.edge(q,A),P=!0),E.node(A).rank=E.node(q).rank+(P?L.minlen:-L.minlen)})}function N(_,E,T){return _.hasEdge(E,T)}function S(_,E,T){return T.low<=E.lim&&E.lim<=T.lim}return bv}var kv,CR;function aQ(){if(CR)return kv;CR=1;var e=vd(),t=e.longestPath,n=gO(),r=sQ();kv=s;function s(d){switch(d.graph().ranker){case"network-simplex":u(d);break;case"tight-tree":l(d);break;case"longest-path":o(d);break;default:u(d)}}var o=t;function l(d){t(d),n(d)}function u(d){r(d)}return kv}var Nv,TR;function oQ(){if(TR)return Nv;TR=1;var e=ut();Nv=t;function t(s){var o=r(s);e.forEach(s.graph().dummyChains,function(l){for(var u=s.node(l),d=u.edgeObj,h=n(s,o,d.v,d.w),f=h.path,p=h.lca,g=0,v=f[g],k=!0;l!==d.w;){if(u=s.node(l),k){for(;(v=f[g])!==p&&s.node(v).maxRank<u.rank;)g++;v===p&&(k=!1)}if(!k){for(;g<f.length-1&&s.node(v=f[g+1]).minRank<=u.rank;)g++;v=f[g]}s.setParent(l,v),l=s.successors(l)[0]}})}function n(s,o,l,u){var d=[],h=[],f=Math.min(o[l].low,o[u].low),p=Math.max(o[l].lim,o[u].lim),g,v;g=l;do g=s.parent(g),d.push(g);while(g&&(o[g].low>f||p>o[g].lim));for(v=g,g=u;(g=s.parent(g))!==v;)h.push(g);return{path:d.concat(h.reverse()),lca:v}}function r(s){var o={},l=0;function u(d){var h=l;e.forEach(s.children(d),u),o[d]={low:h,lim:l++}}return e.forEach(s.children(),u),o}return Nv}var jv,RR;function iQ(){if(RR)return jv;RR=1;var e=ut(),t=dn();jv={run:n,cleanup:l};function n(u){var d=t.addDummyNode(u,"root",{},"_root"),h=s(u),f=e.max(e.values(h))-1,p=2*f+1;u.graph().nestingRoot=d,e.forEach(u.edges(),function(v){u.edge(v).minlen*=p});var g=o(u)+1;e.forEach(u.children(),function(v){r(u,d,p,g,f,h,v)}),u.graph().nodeRankFactor=p}function r(u,d,h,f,p,g,v){var k=u.children(v);if(!k.length){v!==d&&u.setEdge(d,v,{weight:0,minlen:h});return}var b=t.addBorderNode(u,"_bt"),x=t.addBorderNode(u,"_bb"),N=u.node(v);u.setParent(b,v),N.borderTop=b,u.setParent(x,v),N.borderBottom=x,e.forEach(k,function(S){r(u,d,h,f,p,g,S);var _=u.node(S),E=_.borderTop?_.borderTop:S,T=_.borderBottom?_.borderBottom:S,R=_.borderTop?f:2*f,A=E!==T?1:p-g[v]+1;u.setEdge(b,E,{weight:R,minlen:A,nestingEdge:!0}),u.setEdge(T,x,{weight:R,minlen:A,nestingEdge:!0})}),u.parent(v)||u.setEdge(d,b,{weight:0,minlen:p+g[v]})}function s(u){var d={};function h(f,p){var g=u.children(f);g&&g.length&&e.forEach(g,function(v){h(v,p+1)}),d[f]=p}return e.forEach(u.children(),function(f){h(f,1)}),d}function o(u){return e.reduce(u.edges(),function(d,h){return d+u.edge(h).weight},0)}function l(u){var d=u.graph();u.removeNode(d.nestingRoot),delete d.nestingRoot,e.forEach(u.edges(),function(h){var f=u.edge(h);f.nestingEdge&&u.removeEdge(h)})}return jv}var Sv,AR;function lQ(){if(AR)return Sv;AR=1;var e=ut(),t=dn();Sv=n;function n(s){function o(l){var u=s.children(l),d=s.node(l);if(u.length&&e.forEach(u,o),e.has(d,"minRank")){d.borderLeft=[],d.borderRight=[];for(var h=d.minRank,f=d.maxRank+1;h<f;++h)r(s,"borderLeft","_bl",l,d,h),r(s,"borderRight","_br",l,d,h)}}e.forEach(s.children(),o)}function r(s,o,l,u,d,h){var f={width:0,height:0,rank:h,borderType:o},p=d[o][h-1],g=t.addDummyNode(s,"border",f,l);d[o][h]=g,s.setParent(g,u),p&&s.setEdge(p,g,{weight:1})}return Sv}var _v,MR;function cQ(){if(MR)return _v;MR=1;var e=ut();_v={adjust:t,undo:n};function t(h){var f=h.graph().rankdir.toLowerCase();(f==="lr"||f==="rl")&&r(h)}function n(h){var f=h.graph().rankdir.toLowerCase();(f==="bt"||f==="rl")&&o(h),(f==="lr"||f==="rl")&&(u(h),r(h))}function r(h){e.forEach(h.nodes(),function(f){s(h.node(f))}),e.forEach(h.edges(),function(f){s(h.edge(f))})}function s(h){var f=h.width;h.width=h.height,h.height=f}function o(h){e.forEach(h.nodes(),function(f){l(h.node(f))}),e.forEach(h.edges(),function(f){var p=h.edge(f);e.forEach(p.points,l),e.has(p,"y")&&l(p)})}function l(h){h.y=-h.y}function u(h){e.forEach(h.nodes(),function(f){d(h.node(f))}),e.forEach(h.edges(),function(f){var p=h.edge(f);e.forEach(p.points,d),e.has(p,"x")&&d(p)})}function d(h){var f=h.x;h.x=h.y,h.y=f}return _v}var Ev,$R;function uQ(){if($R)return Ev;$R=1;var e=ut();Ev=t;function t(n){var r={},s=e.filter(n.nodes(),function(h){return!n.children(h).length}),o=e.max(e.map(s,function(h){return n.node(h).rank})),l=e.map(e.range(o+1),function(){return[]});function u(h){if(!e.has(r,h)){r[h]=!0;var f=n.node(h);l[f.rank].push(h),e.forEach(n.successors(h),u)}}var d=e.sortBy(s,function(h){return n.node(h).rank});return e.forEach(d,u),l}return Ev}var Cv,IR;function dQ(){if(IR)return Cv;IR=1;var e=ut();Cv=t;function t(r,s){for(var o=0,l=1;l<s.length;++l)o+=n(r,s[l-1],s[l]);return o}function n(r,s,o){for(var l=e.zipObject(o,e.map(o,function(g,v){return v})),u=e.flatten(e.map(s,function(g){return e.sortBy(e.map(r.outEdges(g),function(v){return{pos:l[v.w],weight:r.edge(v).weight}}),"pos")}),!0),d=1;d<o.length;)d<<=1;var h=2*d-1;d-=1;var f=e.map(new Array(h),function(){return 0}),p=0;return e.forEach(u.forEach(function(g){var v=g.pos+d;f[v]+=g.weight;for(var k=0;v>0;)v%2&&(k+=f[v+1]),v=v-1>>1,f[v]+=g.weight;p+=g.weight*k})),p}return Cv}var Tv,OR;function hQ(){if(OR)return Tv;OR=1;var e=ut();Tv=t;function t(n,r){return e.map(r,function(s){var o=n.inEdges(s);if(o.length){var l=e.reduce(o,function(u,d){var h=n.edge(d),f=n.node(d.v);return{sum:u.sum+h.weight*f.order,weight:u.weight+h.weight}},{sum:0,weight:0});return{v:s,barycenter:l.sum/l.weight,weight:l.weight}}else return{v:s}})}return Tv}var Rv,LR;function fQ(){if(LR)return Rv;LR=1;var e=ut();Rv=t;function t(s,o){var l={};e.forEach(s,function(d,h){var f=l[d.v]={indegree:0,in:[],out:[],vs:[d.v],i:h};e.isUndefined(d.barycenter)||(f.barycenter=d.barycenter,f.weight=d.weight)}),e.forEach(o.edges(),function(d){var h=l[d.v],f=l[d.w];!e.isUndefined(h)&&!e.isUndefined(f)&&(f.indegree++,h.out.push(l[d.w]))});var u=e.filter(l,function(d){return!d.indegree});return n(u)}function n(s){var o=[];function l(h){return function(f){f.merged||(e.isUndefined(f.barycenter)||e.isUndefined(h.barycenter)||f.barycenter>=h.barycenter)&&r(h,f)}}function u(h){return function(f){f.in.push(h),--f.indegree===0&&s.push(f)}}for(;s.length;){var d=s.pop();o.push(d),e.forEach(d.in.reverse(),l(d)),e.forEach(d.out,u(d))}return e.map(e.filter(o,function(h){return!h.merged}),function(h){return e.pick(h,["vs","i","barycenter","weight"])})}function r(s,o){var l=0,u=0;s.weight&&(l+=s.barycenter*s.weight,u+=s.weight),o.weight&&(l+=o.barycenter*o.weight,u+=o.weight),s.vs=o.vs.concat(s.vs),s.barycenter=l/u,s.weight=u,s.i=Math.min(o.i,s.i),o.merged=!0}return Rv}var Av,PR;function pQ(){if(PR)return Av;PR=1;var e=ut(),t=dn();Av=n;function n(o,l){var u=t.partition(o,function(b){return e.has(b,"barycenter")}),d=u.lhs,h=e.sortBy(u.rhs,function(b){return-b.i}),f=[],p=0,g=0,v=0;d.sort(s(!!l)),v=r(f,h,v),e.forEach(d,function(b){v+=b.vs.length,f.push(b.vs),p+=b.barycenter*b.weight,g+=b.weight,v=r(f,h,v)});var k={vs:e.flatten(f,!0)};return g&&(k.barycenter=p/g,k.weight=g),k}function r(o,l,u){for(var d;l.length&&(d=e.last(l)).i<=u;)l.pop(),o.push(d.vs),u++;return u}function s(o){return function(l,u){return l.barycenter<u.barycenter?-1:l.barycenter>u.barycenter?1:o?u.i-l.i:l.i-u.i}}return Av}var Mv,DR;function mQ(){if(DR)return Mv;DR=1;var e=ut(),t=hQ(),n=fQ(),r=pQ();Mv=s;function s(u,d,h,f){var p=u.children(d),g=u.node(d),v=g?g.borderLeft:void 0,k=g?g.borderRight:void 0,b={};v&&(p=e.filter(p,function(T){return T!==v&&T!==k}));var x=t(u,p);e.forEach(x,function(T){if(u.children(T.v).length){var R=s(u,T.v,h,f);b[T.v]=R,e.has(R,"barycenter")&&l(T,R)}});var N=n(x,h);o(N,b);var S=r(N,f);if(v&&(S.vs=e.flatten([v,S.vs,k],!0),u.predecessors(v).length)){var _=u.node(u.predecessors(v)[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 o(u,d){e.forEach(u,function(h){h.vs=e.flatten(h.vs.map(function(f){return d[f]?d[f].vs:f}),!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 Mv}var $v,FR;function gQ(){if(FR)return $v;FR=1;var e=ut(),t=ur().Graph;$v=n;function n(s,o,l){var u=r(s),d=new t({compound:!0}).setGraph({root:u}).setDefaultNodeLabel(function(h){return s.node(h)});return e.forEach(s.nodes(),function(h){var f=s.node(h),p=s.parent(h);(f.rank===o||f.minRank<=o&&o<=f.maxRank)&&(d.setNode(h),d.setParent(h,p||u),e.forEach(s[l](h),function(g){var v=g.v===h?g.w:g.v,k=d.edge(v,h),b=e.isUndefined(k)?0:k.weight;d.setEdge(v,h,{weight:s.edge(g).weight+b})}),e.has(f,"minRank")&&d.setNode(h,{borderLeft:f.borderLeft[o],borderRight:f.borderRight[o]}))}),d}function r(s){for(var o;s.hasNode(o=e.uniqueId("_root")););return o}return $v}var Iv,qR;function yQ(){if(qR)return Iv;qR=1;var e=ut();Iv=t;function t(n,r,s){var o={},l;e.forEach(s,function(u){for(var d=n.parent(u),h,f;d;){if(h=n.parent(d),h?(f=o[h],o[h]=d):(f=l,l=d),f&&f!==d){r.setEdge(f,d);return}d=h}})}return Iv}var Ov,BR;function wQ(){if(BR)return Ov;BR=1;var e=ut(),t=uQ(),n=dQ(),r=mQ(),s=gQ(),o=yQ(),l=ur().Graph,u=dn();Ov=d;function d(g){var v=u.maxRank(g),k=h(g,e.range(1,v+1),"inEdges"),b=h(g,e.range(v-1,-1,-1),"outEdges"),x=t(g);p(g,x);for(var N=Number.POSITIVE_INFINITY,S,_=0,E=0;E<4;++_,++E){f(_%2?k:b,_%4>=2),x=u.buildLayerMatrix(g);var T=n(g,x);T<N&&(E=0,S=e.cloneDeep(x),N=T)}p(g,S)}function h(g,v,k){return e.map(v,function(b){return s(g,b,k)})}function f(g,v){var k=new l;e.forEach(g,function(b){var x=b.graph().root,N=r(b,x,k,v);e.forEach(N.vs,function(S,_){b.node(S).order=_}),o(b,k,N.vs)})}function p(g,v){e.forEach(v,function(k){e.forEach(k,function(b,x){g.node(b).order=x})})}return Ov}var Lv,UR;function vQ(){if(UR)return Lv;UR=1;var e=ut(),t=ur().Graph,n=dn();Lv={positionX:k,findType1Conflicts:r,findType2Conflicts:s,addConflict:l,hasConflict:u,verticalAlignment:d,horizontalCompaction:h,alignCoordinates:g,findSmallestWidthAlignment:p,balance:v};function r(N,S){var _={};function E(T,R){var A=0,q=0,L=T.length,P=e.last(R);return e.forEach(R,function(I,O){var U=o(N,I),M=U?N.node(U).order:L;(U||I===P)&&(e.forEach(R.slice(q,O+1),function($){e.forEach(N.predecessors($),function(B){var V=N.node(B),H=V.order;(H<A||M<H)&&!(V.dummy&&N.node($).dummy)&&l(_,B,$)})}),q=O+1,A=M)}),R}return e.reduce(S,E),_}function s(N,S){var _={};function E(R,A,q,L,P){var I;e.forEach(e.range(A,q),function(O){I=R[O],N.node(I).dummy&&e.forEach(N.predecessors(I),function(U){var M=N.node(U);M.dummy&&(M.order<L||M.order>P)&&l(_,U,I)})})}function T(R,A){var q=-1,L,P=0;return e.forEach(A,function(I,O){if(N.node(I).dummy==="border"){var U=N.predecessors(I);U.length&&(L=N.node(U[0]).order,E(A,P,O,q,L),P=O,q=L)}E(A,P,A.length,L,R.length)}),A}return e.reduce(S,T),_}function o(N,S){if(N.node(S).dummy)return e.find(N.predecessors(S),function(_){return N.node(_).dummy})}function l(N,S,_){if(S>_){var E=S;S=_,_=E}var T=N[S];T||(N[S]=T={}),T[_]=!0}function u(N,S,_){if(S>_){var E=S;S=_,_=E}return e.has(N[S],_)}function d(N,S,_,E){var T={},R={},A={};return e.forEach(S,function(q){e.forEach(q,function(L,P){T[L]=L,R[L]=L,A[L]=P})}),e.forEach(S,function(q){var L=-1;e.forEach(q,function(P){var I=E(P);if(I.length){I=e.sortBy(I,function(B){return A[B]});for(var O=(I.length-1)/2,U=Math.floor(O),M=Math.ceil(O);U<=M;++U){var $=I[U];R[P]===P&&L<A[$]&&!u(_,P,$)&&(R[$]=P,R[P]=T[P]=T[$],L=A[$])}}})}),{root:T,align:R}}function h(N,S,_,E,T){var R={},A=f(N,S,_,T),q=T?"borderLeft":"borderRight";function L(O,U){for(var M=A.nodes(),$=M.pop(),B={};$;)B[$]?O($):(B[$]=!0,M.push($),M=M.concat(U($))),$=M.pop()}function P(O){R[O]=A.inEdges(O).reduce(function(U,M){return Math.max(U,R[M.v]+A.edge(M))},0)}function I(O){var U=A.outEdges(O).reduce(function($,B){return Math.min($,R[B.w]-A.edge(B))},Number.POSITIVE_INFINITY),M=N.node(O);U!==Number.POSITIVE_INFINITY&&M.borderType!==q&&(R[O]=Math.max(R[O],U))}return L(P,A.predecessors.bind(A)),L(I,A.successors.bind(A)),e.forEach(E,function(O){R[O]=R[_[O]]}),R}function f(N,S,_,E){var T=new t,R=N.graph(),A=b(R.nodesep,R.edgesep,E);return e.forEach(S,function(q){var L;e.forEach(q,function(P){var I=_[P];if(T.setNode(I),L){var O=_[L],U=T.edge(O,I);T.setEdge(O,I,Math.max(A(N,P,L),U||0))}L=P})}),T}function p(N,S){return e.minBy(e.values(S),function(_){var E=Number.NEGATIVE_INFINITY,T=Number.POSITIVE_INFINITY;return e.forIn(_,function(R,A){var q=x(N,A)/2;E=Math.max(R+q,E),T=Math.min(R-q,T)}),E-T})}function g(N,S){var _=e.values(S),E=e.min(_),T=e.max(_);e.forEach(["u","d"],function(R){e.forEach(["l","r"],function(A){var q=R+A,L=N[q],P;if(L!==S){var I=e.values(L);P=A==="l"?E-e.min(I):T-e.max(I),P&&(N[q]=e.mapValues(L,function(O){return O+P}))}})})}function v(N,S){return e.mapValues(N.ul,function(_,E){if(S)return N[S.toLowerCase()][E];var T=e.sortBy(e.map(N,E));return(T[1]+T[2])/2})}function k(N){var S=n.buildLayerMatrix(N),_=e.merge(r(N,S),s(N,S)),E={},T;e.forEach(["u","d"],function(A){T=A==="u"?S:e.values(S).reverse(),e.forEach(["l","r"],function(q){q==="r"&&(T=e.map(T,function(O){return e.values(O).reverse()}));var L=(A==="u"?N.predecessors:N.successors).bind(N),P=d(N,T,_,L),I=h(N,T,P.root,P.align,q==="r");q==="r"&&(I=e.mapValues(I,function(O){return-O})),E[A+q]=I})});var R=p(N,E);return g(E,R),v(E,N.graph().align)}function b(N,S,_){return function(E,T,R){var A=E.node(T),q=E.node(R),L=0,P;if(L+=A.width/2,e.has(A,"labelpos"))switch(A.labelpos.toLowerCase()){case"l":P=-A.width/2;break;case"r":P=A.width/2;break}if(P&&(L+=_?P:-P),P=0,L+=(A.dummy?S:N)/2,L+=(q.dummy?S:N)/2,L+=q.width/2,e.has(q,"labelpos"))switch(q.labelpos.toLowerCase()){case"l":P=q.width/2;break;case"r":P=-q.width/2;break}return P&&(L+=_?P:-P),P=0,L}}function x(N,S){return N.node(S).width}return Lv}var Pv,zR;function xQ(){if(zR)return Pv;zR=1;var e=ut(),t=dn(),n=vQ().positionX;Pv=r;function r(o){o=t.asNonCompoundGraph(o),s(o),e.forEach(n(o),function(l,u){o.node(u).x=l})}function s(o){var l=t.buildLayerMatrix(o),u=o.graph().ranksep,d=0;e.forEach(l,function(h){var f=e.max(e.map(h,function(p){return o.node(p).height}));e.forEach(h,function(p){o.node(p).y=d+f/2}),d+=f+u})}return Pv}var Dv,WR;function bQ(){if(WR)return Dv;WR=1;var e=ut(),t=nQ(),n=rQ(),r=aQ(),s=dn().normalizeRanks,o=oQ(),l=dn().removeEmptyRanks,u=iQ(),d=lQ(),h=cQ(),f=wQ(),p=xQ(),g=dn(),v=ur().Graph;Dv=k;function k(G,K){var X=K&&K.debugTiming?g.time:g.notime;X("layout",function(){var Z=X(" buildLayoutGraph",function(){return L(G)});X(" runLayout",function(){b(Z,X)}),X(" updateInputGraph",function(){x(G,Z)})})}function b(G,K){K(" makeSpaceForEdgeLabels",function(){P(G)}),K(" removeSelfEdges",function(){F(G)}),K(" acyclic",function(){t.run(G)}),K(" nestingGraph.run",function(){u.run(G)}),K(" rank",function(){r(g.asNonCompoundGraph(G))}),K(" injectEdgeLabelProxies",function(){I(G)}),K(" removeEmptyRanks",function(){l(G)}),K(" nestingGraph.cleanup",function(){u.cleanup(G)}),K(" normalizeRanks",function(){s(G)}),K(" assignRankMinMax",function(){O(G)}),K(" removeEdgeLabelProxies",function(){U(G)}),K(" normalize.run",function(){n.run(G)}),K(" parentDummyChains",function(){o(G)}),K(" addBorderSegments",function(){d(G)}),K(" order",function(){f(G)}),K(" insertSelfEdges",function(){W(G)}),K(" adjustCoordinateSystem",function(){h.adjust(G)}),K(" position",function(){p(G)}),K(" positionSelfEdges",function(){D(G)}),K(" removeBorderNodes",function(){H(G)}),K(" normalize.undo",function(){n.undo(G)}),K(" fixupEdgeLabelCoords",function(){B(G)}),K(" undoCoordinateSystem",function(){h.undo(G)}),K(" translateGraph",function(){M(G)}),K(" assignNodeIntersects",function(){$(G)}),K(" reversePoints",function(){V(G)}),K(" acyclic.undo",function(){t.undo(G)})}function x(G,K){e.forEach(G.nodes(),function(X){var Z=G.node(X),ee=K.node(X);Z&&(Z.x=ee.x,Z.y=ee.y,K.children(X).length&&(Z.width=ee.width,Z.height=ee.height))}),e.forEach(G.edges(),function(X){var Z=G.edge(X),ee=K.edge(X);Z.points=ee.points,e.has(ee,"x")&&(Z.x=ee.x,Z.y=ee.y)}),G.graph().width=K.graph().width,G.graph().height=K.graph().height}var N=["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"},q=["labelpos"];function L(G){var K=new v({multigraph:!0,compound:!0}),X=J(G.graph());return K.setGraph(e.merge({},S,Y(X,N),e.pick(X,_))),e.forEach(G.nodes(),function(Z){var ee=J(G.node(Z));K.setNode(Z,e.defaults(Y(ee,E),T)),K.setParent(Z,G.parent(Z))}),e.forEach(G.edges(),function(Z){var ee=J(G.edge(Z));K.setEdge(Z,e.merge({},A,Y(ee,R),e.pick(ee,q)))}),K}function P(G){var K=G.graph();K.ranksep/=2,e.forEach(G.edges(),function(X){var Z=G.edge(X);Z.minlen*=2,Z.labelpos.toLowerCase()!=="c"&&(K.rankdir==="TB"||K.rankdir==="BT"?Z.width+=Z.labeloffset:Z.height+=Z.labeloffset)})}function I(G){e.forEach(G.edges(),function(K){var X=G.edge(K);if(X.width&&X.height){var Z=G.node(K.v),ee=G.node(K.w),se={rank:(ee.rank-Z.rank)/2+Z.rank,e:K};g.addDummyNode(G,"edge-proxy",se,"_ep")}})}function O(G){var K=0;e.forEach(G.nodes(),function(X){var Z=G.node(X);Z.borderTop&&(Z.minRank=G.node(Z.borderTop).rank,Z.maxRank=G.node(Z.borderBottom).rank,K=e.max(K,Z.maxRank))}),G.graph().maxRank=K}function U(G){e.forEach(G.nodes(),function(K){var X=G.node(K);X.dummy==="edge-proxy"&&(G.edge(X.e).labelRank=X.rank,G.removeNode(K))})}function M(G){var K=Number.POSITIVE_INFINITY,X=0,Z=Number.POSITIVE_INFINITY,ee=0,se=G.graph(),ue=se.marginx||0,ae=se.marginy||0;function re(de){var me=de.x,pe=de.y,ke=de.width,xe=de.height;K=Math.min(K,me-ke/2),X=Math.max(X,me+ke/2),Z=Math.min(Z,pe-xe/2),ee=Math.max(ee,pe+xe/2)}e.forEach(G.nodes(),function(de){re(G.node(de))}),e.forEach(G.edges(),function(de){var me=G.edge(de);e.has(me,"x")&&re(me)}),K-=ue,Z-=ae,e.forEach(G.nodes(),function(de){var me=G.node(de);me.x-=K,me.y-=Z}),e.forEach(G.edges(),function(de){var me=G.edge(de);e.forEach(me.points,function(pe){pe.x-=K,pe.y-=Z}),e.has(me,"x")&&(me.x-=K),e.has(me,"y")&&(me.y-=Z)}),se.width=X-K+ue,se.height=ee-Z+ae}function $(G){e.forEach(G.edges(),function(K){var X=G.edge(K),Z=G.node(K.v),ee=G.node(K.w),se,ue;X.points?(se=X.points[0],ue=X.points[X.points.length-1]):(X.points=[],se=ee,ue=Z),X.points.unshift(g.intersectRect(Z,se)),X.points.push(g.intersectRect(ee,ue))})}function B(G){e.forEach(G.edges(),function(K){var X=G.edge(K);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 V(G){e.forEach(G.edges(),function(K){var X=G.edge(K);X.reversed&&X.points.reverse()})}function H(G){e.forEach(G.nodes(),function(K){if(G.children(K).length){var X=G.node(K),Z=G.node(X.borderTop),ee=G.node(X.borderBottom),se=G.node(e.last(X.borderLeft)),ue=G.node(e.last(X.borderRight));X.width=Math.abs(ue.x-se.x),X.height=Math.abs(ee.y-Z.y),X.x=se.x+X.width/2,X.y=Z.y+X.height/2}}),e.forEach(G.nodes(),function(K){G.node(K).dummy==="border"&&G.removeNode(K)})}function F(G){e.forEach(G.edges(),function(K){if(K.v===K.w){var X=G.node(K.v);X.selfEdges||(X.selfEdges=[]),X.selfEdges.push({e:K,label:G.edge(K)}),G.removeEdge(K)}})}function W(G){var K=g.buildLayerMatrix(G);e.forEach(K,function(X){var Z=0;e.forEach(X,function(ee,se){var ue=G.node(ee);ue.order=se+Z,e.forEach(ue.selfEdges,function(ae){g.addDummyNode(G,"selfedge",{width:ae.label.width,height:ae.label.height,rank:ue.rank,order:se+ ++Z,e:ae.e,label:ae.label},"_se")}),delete ue.selfEdges})})}function D(G){e.forEach(G.nodes(),function(K){var X=G.node(K);if(X.dummy==="selfedge"){var Z=G.node(X.e.v),ee=Z.x+Z.width/2,se=Z.y,ue=X.x-ee,ae=Z.height/2;G.setEdge(X.e,X.label),G.removeNode(K),X.label.points=[{x:ee+2*ue/3,y:se-ae},{x:ee+5*ue/6,y:se-ae},{x:ee+ue,y:se},{x:ee+5*ue/6,y:se+ae},{x:ee+2*ue/3,y:se+ae}],X.label.x=X.x,X.label.y=X.y}})}function Y(G,K){return e.mapValues(e.pick(G,K),Number)}function J(G){var K={};return e.forEach(G,function(X,Z){K[Z.toLowerCase()]=X}),K}return Dv}var Fv,HR;function kQ(){if(HR)return Fv;HR=1;var e=ut(),t=dn(),n=ur().Graph;Fv={debugOrdering:r};function r(s){var o=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(o,function(u,d){var h="layer"+d;l.setNode(h,{rank:"same"}),e.reduce(u,function(f,p){return l.setEdge(f,p,{style:"invis"}),p})}),l}return Fv}var qv,VR;function NQ(){return VR||(VR=1,qv="0.8.5"),qv}var Bv,GR;function jQ(){return GR||(GR=1,Bv={graphlib:ur(),layout:bQ(),debug:kQ(),util:{time:dn().time,notime:dn().notime},version:NQ()}),Bv}var SQ=jQ();const KR=Qx(SQ),xd=240,yO=130,zx=Ea*2+yx+YM,_Q=72,Zo=zx+_Q,Gu=24,wO=Ea*2+Gu,bd=Zo;function vO(e,t){var r;let n=xd;for(const s of e)n=Math.max(n,((r=t.get(s.id))==null?void 0:r.width)??xd);return n}const kd=420,xO=1;function EQ(e,t,n,r){return Math.min(xO,n/Math.max(1,e),r/Math.max(1,t))}function fh(e){var n;return((n=e.data)==null?void 0:n.sessionId)??"_default"}function ph(e,t=()=>!0){const n=new Map;for(const r of e){if(!t(r))continue;const s=fh(r),o=n.get(s);o?o.push(r):n.set(s,[r])}return n}function CQ(e,t){return((t==null?void 0:t.get(e))??0)>0?kd:0}function TQ(e,t){const n=(t==null?void 0:t.get(e))??0;return n>0?6+n*36:0}function Nd(e,t){const n=t.get(e);return{w:(n==null?void 0:n.width)??xd,h:(n==null?void 0:n.height)??yO}}function Ul(e,t,n){const r=Nd(e,t);return{w:r.w+CQ(e,n),h:Math.max(r.h,TQ(e,n))}}function RQ(e){return[...e.keys()].sort().map(t=>`${t}:${e.get(t)}`).join("|")}function AQ(e,t,n){const r=ph(e,s=>!t.has(s.id)&&n(s.id)!=null);if(r.size===0)return e;for(const s of r.values())s.sort((o,l)=>o.id.localeCompare(l.id));return e.map(s=>{var h;if(t.has(s.id)||n(s.id))return s;const o=r.get(fh(s));if(!o)return s;const l=(h=s.data)==null?void 0:h.parentId,u=o.find(f=>f.id===l)??o[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 MQ(e,t,n,r,s,o,l){const u=_=>Ul(_,r,o),d=_=>n.get(_)??t.get(_),h=_=>{const{w:E,h:T}=Nd(_,r);return{cw:E,ch:T}},f=l!=null&&l.width>0&&l.height>0,p=ph(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 v=new Map,k=[];for(const _ of e){const E=d(_.id);if(!E)continue;const{w:T,h:R}=u(_.id),A=fh(_);g.has(A)?(v.get(A)??v.set(A,[]).get(A)).push(_):k.push({x:E.x,y:E.y,w:T,h:R,...h(_.id)})}if(v.size===0||f&&k.length===0)return[];const b=bd,x=(_,E,T,R)=>k.some(A=>_<A.x+A.w+zx&&A.x<_+T+zx&&E<A.y+A.h+b&&A.y<E+R+b),N=vO(e,r),S=[];for(const _ of[...v.keys()].sort()){const E=v.get(_);let T=1/0,R=1/0,A=-1/0,q=-1/0,L=-1/0,P=-1/0;for(const V of E){const H=d(V.id),{w:F,h:W}=u(V.id),{cw:D,ch:Y}=h(V.id);T=Math.min(T,H.x),R=Math.min(R,H.y),A=Math.max(A,H.x+F),q=Math.max(q,H.y+W),L=Math.max(L,H.x+D),P=Math.max(P,H.y+Y)}const I=A-T,O=q-R,U=[...new Set(k.map(V=>Math.round(V.x)))].sort((V,H)=>V-H),M=U.length?U:[T],$=[0,...k.map(V=>V.y+V.h+b)].sort((V,H)=>V-H);let B=null;if(f){let V=1/0,H=1/0,F=-1/0,W=-1/0;for(const X of k)V=Math.min(V,X.x),H=Math.min(H,X.y),F=Math.max(F,X.x+X.cw),W=Math.max(W,X.y+X.ch);const D=(X,Z)=>{const ee=l.width/(Math.max(F,X+L-T)-Math.min(V,X)+kd),se=l.height/(Math.max(W,Z+P-R)-Math.min(H,Z));return[Math.min(xO,ee,se),Math.min(ee,se),Math.max(ee,se)]},Y=(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(F+kd+N),G=[...new Set([...$,H])].sort((X,Z)=>X-Z);let K=null;for(const X of[...M,J])for(const Z of G){if(x(X,Z,I,O))continue;const ee=D(X,Z);(K===null||Y(ee,K))&&(K=ee,B={x:X,y:Z})}B&&B.x===T&&B.y===R&&(B=null)}else e:for(const V of M)for(const H of $){if(H>=R)break;if(!x(V,H,I,O)){B={x:V,y:H};break e}}if(B){const V=B.x-T,H=B.y-R;for(const F of E){const W=d(F.id);t.set(F.id,{x:W.x+V,y:W.y+H})}S.push(_)}for(const V of E){const H=d(V.id),{w:F,h:W}=u(V.id);k.push({x:H.x,y:H.y,w:F,h:W,...h(V.id)})}}return S}function $Q(e,t,n,r,s,o){const l=g=>Ul(g,r,s),u=new Map(e.map(g=>[g.id,fh(g)])),d=[],h=e.map(g=>({id:g.id,pos:n.get(g.id)??t.get(g.id)})).filter(g=>g.pos!=null).sort((g,v)=>g.pos.y-v.pos.y||g.pos.x-v.pos.x||g.id.localeCompare(v.id)),f=g=>(o==null?void 0:o.has(g))===!0&&!n.has(g);for(const{id:g,pos:v}of h){if(!f(g))continue;const{w:k,h:b}=l(g);d.push({x:v.x,y:v.y,w:k,h:b,sid:u.get(g)??"_default"})}const p=[];for(const{id:g,pos:v}of h){if(f(g))continue;const{w:k,h:b}=l(g),x=u.get(g)??"_default";if(n.has(g)){d.push({x:v.x,y:v.y,w:k,h:b,sid:x});continue}let N=v.y;for(let S=0;S<d.length+1;S++){const _=d.find(E=>{const T=E.sid===x?Gu:wO,R=E.sid===x?Gu:bd;return v.x<E.x+E.w+T&&E.x<v.x+k+T&&N<E.y+E.h+R&&E.y<N+b+R});if(!_)break;N=_.y+_.h+(_.sid===x?Gu:bd)}N!==v.y&&(t.set(g,{x:v.x,y:N}),p.push(g)),d.push({x:v.x,y:N,w:k,h:b,sid:x})}return p}function IQ(e,t,n,r,s,o=!1,l){const d=wO+1,h=bd+1,f=8,p=1.75,g=200,v=.7,k=.01,b=O=>Ul(O,r,l),x=O=>n.get(O)??t.get(O),N=ph(e,O=>x(O.id)!=null),S=[],_=new Set,E=new Set,T=s.size===0;for(const O of[...N.keys()].sort()){const U=N.get(O);let M=1/0,$=1/0,B=-1/0,V=-1/0,H=!1;for(const Y of U){const J=x(Y.id),{w:G,h:K}=b(Y.id);M=Math.min(M,J.x),$=Math.min($,J.y),B=Math.max(B,J.x+G),V=Math.max(V,J.y+K),n.has(Y.id)&&(H=!0)}const F=B-M,W=V-$;E.add(O);const D=s.get(O);D&&(F>D.w+f||W>D.h+f)&&_.add(O),s.set(O,{w:F,h:W}),S.push({sid:O,members:U.map(Y=>Y.id),x:M,y:$,w:F,h:W,anchored:H,mass:1})}for(const O of[...s.keys()])E.has(O)||s.delete(O);if(o||T)return[];let R=!1;for(let O=0;O<S.length&&!R;O++)for(let U=O+1;U<S.length;U++){const M=S[O],$=S[U];if(!(M.anchored&&$.anchored)&&Math.abs(M.x+M.w/2-($.x+$.w/2))<(M.w+$.w)/2+d&&Math.abs(M.y+M.h/2-($.y+$.h/2))<(M.h+$.h)/2+h){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/(xd*yO));const A=new Map(S.map(O=>[O.sid,O.x])),q=new Map(S.map(O=>[O.sid,O.y])),L=new Map(S.map(O=>[O.sid,Math.min(0,O.x)])),P=new Map(S.map(O=>[O.sid,Math.min(0,O.y)]));for(let O=0;O<g;O++){const U=new Map,M=new Map;let $=0;for(let B=0;B<S.length;B++)for(let V=B+1;V<S.length;V++){const H=S[B],F=S[V];if(H.anchored&&F.anchored)continue;const W=H.x+H.w/2,D=H.y+H.h/2,Y=F.x+F.w/2,J=F.y+F.h/2,G=(H.w+F.w)/2+d-Math.abs(W-Y),K=(H.h+F.h)/2+h-Math.abs(D-J);if(G<=0||K<=0)continue;const X=(Re,Le)=>!Re.anchored&&!(Le<0&&Re.x<=L.get(Re.sid)),Z=(Re,Le)=>!Re.anchored&&!(Le<0&&Re.y<=P.get(Re.sid)),ee=(Re,Le,et)=>{const rt=Re===Le,Je=rt?H.sid<F.sid?-1:1:Math.sign(Re-Le);return et(H,Je)||et(F,-Je)?Je:rt&&(et(H,-Je)||et(F,Je))?-Je:0},se=ee(W,Y,X),ue=ee(D,J,Z),ae=se!==0,re=ue!==0;if(!ae&&!re)continue;const de=ae&&(!re||G*p<K),[me,pe,ke,xe]=de?[se,G,U,X]:[ue,K,M,Z],fe=xe(H,me),Te=xe(F,-me),Fe=H.mass,Oe=F.mass,We=fe?Te?Oe/(Fe+Oe):1:0,le=Te?fe?Fe/(Fe+Oe):1:0,je=pe*v;ke.set(H.sid,(ke.get(H.sid)??0)+me*je*We),ke.set(F.sid,(ke.get(F.sid)??0)-me*je*le),$+=je}for(const B of S)B.anchored||(B.x=Math.max(L.get(B.sid),B.x+(U.get(B.sid)??0)),B.y=Math.max(P.get(B.sid),B.y+(M.get(B.sid)??0)));if($<k)break}const I=[];for(const O of S){const U=O.x-A.get(O.sid),M=O.y-q.get(O.sid);if(!(Math.abs(U)<1&&Math.abs(M)<1)){for(const $ of O.members){if(n.has($))continue;const B=t.get($);B&&t.set($,{x:B.x+U,y:B.y+M})}I.push(O.sid)}}return I}function OQ(e,t,n,r,s,o){const l=new KR.graphlib.Graph;l.setDefaultEdgeLabel(()=>({})),l.setGraph({rankdir:n,marginx:0,marginy:0,nodesep:70,ranksep:160,edgesep:30});const u=e.filter(N=>!s.has(N)),d=new Set(u);for(const N of u){const{w:S,h:_}=Ul(N,r,o);l.setNode(N,{width:S,height:_})}for(const N of t)d.has(N.source)&&d.has(N.target)&&l.setEdge(N.source,N.target);KR.layout(l);const h=new Map;let f=1/0,p=1/0,g=-1/0,v=-1/0;for(const N of u){const S=l.node(N);if(!S)continue;const{w:_,h:E}=Nd(N,r),T=Ul(N,r,o),R=S.x-T.w/2,A=S.y-T.h/2;h.set(N,{x:R,y:A}),R<f&&(f=R),A<p&&(p=A),R+_>g&&(g=R+_),A+E>v&&(v=A+E)}if(Number.isFinite(f)&&Number.isFinite(p))for(const[N,S]of h)h.set(N,{x:S.x-f,y:S.y-p});const k=Number.isFinite(g)?g-f:0,b=Number.isFinite(v)?v-p:0;let x=null;for(const N of e){const S=s.get(N);if(!S)continue;const{w:_,h:E}=Nd(N,r);x=x===null?{minX:S.x,minY:S.y,maxX:S.x+_,maxY:S.y+E}:{minX:Math.min(x.minX,S.x),minY:Math.min(x.minY,S.y),maxX:Math.max(x.maxX,S.x+_),maxY:Math.max(x.maxY,S.y+E)}}return{positions:h,width:k,height:b,pinnedBox:x}}function bO(e,t,n){const r=n.direction??"LR",s=n.pinned??new Map,o=n.measured??new Map,l=n.lanes,u=ph(e);return{laid:Array.from(u.keys()).sort().map(f=>({sid:f,...OQ(u.get(f).map(p=>p.id),t,r,o,s,l)})),gap:vO(e,o)}}const kO=e=>e.reduce((t,n)=>Math.max(t,n.width),0)+kd,LQ=e=>e.reduce((t,n)=>t+n.height,0)+Zo*Math.max(0,e.length-1);function Wx(e,t,n,r){const s=d=>{const h=[[]];let f=0;for(const p of e)f>0&&f+p.height>d&&(h.push([]),f=0),h[h.length-1].push(p),f+=p.height+Zo;return h},o=[];for(let d=0;d<e.length;d++){let h=-Zo;for(let f=d;f<e.length;f++)o.push(h+=e[f].height+Zo)}o.sort((d,h)=>d-h);const l=d=>{let h=0,f=o.length-1;for(;h<f;){const p=h+f>>1;s(o[p]).length<=d?f=p:h=p+1}return s(o[h])};let u=[e];if(n>0&&r>0){const d=f=>EQ(f.reduce((p,g)=>p+kO(g),0)+t*(f.length-1),Math.max(...f.map(LQ)),n,r);let h=d(u);for(let f=2;f<=e.length;f++){const p=l(f),g=d(p);g>h+1e-9&&(h=g,u=p)}}return u}function PQ(e,t,n,r,s){if(!(r.width>0&&r.height>0&&s.width>0&&s.height>0))return!1;const{laid:o,gap:l}=bO(e,t,n);return o.length<2?!1:Wx(o,l,r.width,r.height).length!==Wx(o,l,s.width,s.height).length}function DQ(e,t,n={}){const r=n.pinned??new Map,{laid:s,gap:o}=bO(e,t,n),l=Wx(s,o,n.availableWidth??0,n.availableHeight??0),u=new Map;let d=0;for(const h of l){const f=kO(h);let p=0;for(const{positions:g,height:v,pinnedBox:k}of h){for(const[x,N]of g)u.set(x,{x:N.x+d,y:N.y+p});let b=p+v;k&&k.maxY>b&&k.minX<d+f&&d<k.maxX&&(b=k.maxY),p=b+Zo}d+=f+o}return e.map(h=>{const f=r.get(h.id);if(f)return{...h,position:f};const p=u.get(h.id);return p?{...h,position:p}:h})}function Ku(e,t,n){return!t.has(e)||n.has(e)}function FQ(e,t,n,r){return!t.has(e)&&Ku(e,n,r)}function qQ(e,t,n){const r={x:0,y:0};return t.set(e,r),n.add(e),r}function YR(e,t,n,r){n.set(e,t),r.delete(e)}const BQ=300,XR=130,UQ=160,ZR=new WeakMap;function zQ(e,t){let n=ZR.get(e);(!n||n.revision!==e.revision||n.open!==t)&&(n={revision:e.revision,open:t,byId:new Map,branches:cB(e.agents.values())},ZR.set(e,n));const{byId:r,branches:s}=n;return o=>{let l=r.get(o.id);if(!l){const u=o.kind==="root"?s.get(o.sessionId):void 0;l=u?{...o,onOpenContext:t,branch:u}:{...o,onOpenContext:t},r.set(o.id,l)}return l}}function v0(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 WQ(e,t,n,r,s,o,l,u,d,h,f,p,g,v,k,b,x,N,S,_){var B,V,H,F;const E=[],T=[],R=zQ(e,N);for(const W of e.agents.values()){if(!x.has(W.id))continue;const D=W.exitAt!=null,Y=b!=null&&!b.has(W.id),J=[D?"rf-exiting":"",Y?"rf-spotlit-out":""].filter(Boolean).join(" ")||void 0,G=o.get(W.id);if(E.push({id:W.id,type:"agent",position:{x:0,y:0},data:R(W),className:J,ariaLabel:j8(W,t,k.has(W.id)),...G?{width:G.width,height:G.height}:null}),W.parentId&&x.has(W.parentId)){const Z=od(W.sessionId),ee=D,se=k.size>0&&(k.has(W.id)||k.has(W.parentId)),ue=b!=null&&!b.has(W.id)&&!b.has(W.parentId),ae=W.state==="active"?2:1.5,re=se?ae+1.5:ae,de=ee?.2:ue?.12:1,me=["sess-edge",W.state==="active"?"sess-live":"sess-idle",ee?"rf-edge-exiting":"",se?"rf-edge-selected":""].filter(Boolean).join(" ");T.push({id:`e:${W.parentId}->${W.id}`,source:W.parentId,target:W.id,animated:(W.state==="active"||se)&&!ee,type:"smoothstep",style:{"--session-hue":Z,strokeWidth:`calc(${re}px * var(--edge-k, 1))`,opacity:de,transition:"var(--edge-transition)"},className:me})}const K=W.kind==="root"?Pd(W):null,X=K?RM(W.sessionId,K.at):null;if(K&&X&&!rB(X)){const Z=Rb(W.id),ee=od(W.sessionId),se=o.get(Z);E.push({id:Z,type:"recapNote",position:{x:0,y:0},data:{sessionId:W.sessionId,parentId:W.id,recap:K,noteKey:X,hue:ee},className:Y?"rf-spotlit-out":void 0,selectable:!1,focusable:!1,ariaLabel:`Claude Code's recap for ${W.label}`,...se?{width:se.width,height:se.height}:null}),T.push({id:`e:recap:${W.id}`,source:Z,target:W.id,type:"recapTie",className:"recap-edge",focusable:!1,style:{"--session-hue":ee}})}}const A=v0(e),q=_.size>0&&!(d&&S);q||_.clear();const L=`${g}#lanes:${RQ(A)}${q?"#held":""}`,P=new Set(E.filter(W=>W.type==="recapNote").map(W=>W.id));for(const W of Array.from(f.keys()))S&&iB(W)&&!P.has(W)&&!s.has(W)&&(f.delete(W),p.delete(W));const I=E.filter(W=>FQ(W.id,s,f,p));if(I.length>0||L!==v.current){if(I.length>0){for(const D of I)_.delete(D.id);const W=AQ(DQ(E,T,{direction:"LR",pinned:s,measured:o,availableWidth:n,availableHeight:r,lanes:A}),s,D=>Ku(D,f,p)?void 0:f.get(D));for(const D of W)Ku(D.id,f,p)&&YR(D.id,D.position,f,p);MQ(E,f,s,o,new Set(I.filter(D=>D.type!=="recapNote").map(D=>D.id)),A,{width:n,height:r});for(const D of I){if(D.type!=="recapNote")continue;const Y=(B=D.data)==null?void 0:B.parentId;if(!Y)continue;const J=s.get(Y)??(Ku(Y,f,p)?void 0:f.get(Y));if(!J)continue;const G=((V=o.get(D.id))==null?void 0:V.width)??BQ,K=((H=o.get(D.id))==null?void 0:H.height)??XR,X=((F=o.get(Y))==null?void 0:F.height)??XR;YR(D.id,{x:J.x-UQ-G,y:J.y+(X-K)/2},f,p)}}$Q(E,f,s,o,A,q?_:void 0),v.current=L}const O=IQ(E,f,s,o,l,!d||h,A);O.length>0&&u(O);const U=aX(e.agents.values());S&&Au(f,U),Au(p,U),S&&Au(s,U),Au(o,sX(e.agents.values()));const M=[];let $=!1;for(const W of E){let D=s.get(W.id)??f.get(W.id);D||(D=qQ(W.id,f,p),$=!0),M.push({...W,position:D})}return $&&(v.current=""),{nodes:M,edges:T}}function HQ(e){return e.slice().sort((t,n)=>t.y-n.y||t.x-n.x)}function VQ(e,t,n){var l;if(e.length===0)return null;const r=HQ(e),s=t?r.findIndex(u=>u.id===t):-1,o=s===-1?n===1?0:r.length-1:(s+n+r.length)%r.length;return((l=r[o])==null?void 0:l.id)??null}const GQ=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Escape","Backspace"]);function KQ(e,t){return t==null?{kind:"deck",nodeId:null}:e.key==="Enter"||e.key===" "?{kind:"activate",nodeId:t,additive:e.shiftKey}:GQ.has(e.key)?{kind:"node",nodeId:t}:{kind:"deck",nodeId:t}}const YQ=new Set(["","BODY","HTML","#DOCUMENT"]);function XQ(e){return!e||Ld(e)?!1:!YQ.has(String(e.tagName??"").toUpperCase())}const NO="react-flow__node";function x0(e){var t,n;return!!e&&((n=(t=e.classList)==null?void 0:t.contains)==null?void 0:n.call(t,NO))===!0}function ZQ(e){try{const t=document.querySelector(`.${NO}[data-id="${CSS.escape(e)}"]`);t==null||t.focus({preventScroll:!0})}catch{}}let Ma=null,Wo=null;const Hx=new Set,Vx=()=>{for(const e of Hx)e()},JQ=e=>(Hx.add(e),()=>{Hx.delete(e)}),JR=()=>Ma,QQ=90;function jO(e){!Wo||e!=null&&Wo.at.id!==e||(clearTimeout(Wo.timer),Wo=null)}function SO(e,t,n="pointer"){jO();const r={id:e,anchor:t,by:n};if(Ma||n==="focus"){Ma=r,Vx();return}Wo={at:r,timer:setTimeout(()=>{Wo=null,Ma=r,Vx()},QQ)}}function Zs(e){jO(e),!(!Ma||e!=null&&Ma.id!==e)&&(Ma=null,Vx())}function eee({agentFor:e,recapFor:t,labelFor:n,bounds:r}){const s=w.useSyncExternalStore(JQ,JR,JR),o=s?e(s.id):void 0,l=s&&!o?t(s.id):void 0,u=s!=null&&(!o&&!l||!s.anchor.isConnected);return w.useEffect(()=>{u&&s&&Zs(s.id)},[u,s]),!s||u?null:o?a.jsx(nee,{a:o,anchor:s.anchor,parentLabel:o.parentId?n(o.parentId):void 0,bounds:r},s.id):l?a.jsx(tee,{r:l,anchor:s.anchor,bounds:r},s.id):null}function _O(e,t){const n=w.useRef(null),r=w.useCallback(()=>{const s=n.current;if(!s||!e.isConnected)return;const o=Fb(e.getBoundingClientRect(),{width:s.offsetWidth,height:s.offsetHeight},t());s.style.top=`${o.top}px`,s.style.left=`${o.left}px`,s.style.maxHeight=o.maxHeight==null?"":`${o.maxHeight}px`,s.dataset.side=o.side},[e,t]);return w.useLayoutEffect(()=>{r()}),n}function tee({r:e,anchor:t,bounds:n}){const r=_O(t,n),s=mi(3e4),o=ud(e.recap.at,s);return It.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($l,{}),"recap"]}),a.jsx("span",{className:"node-peek-time",title:o.title,children:o.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 nee({a:e,anchor:t,parentLabel:n,bounds:r}){const s=_O(t,r),o=mi(1e3),l=Cb(e.sessionName,e.sessionTitle),u=e.tools.filter(k=>k.ok===!1).length,d=e.tools.filter(k=>!k.endedAt).length,h=hn(e,o).total,f=e.usage.inputTokens+e.usage.outputTokens,p=e.kind==="root"&&hr(e.waiting),g=e.kind==="root"?"session":n?`subagent of ${n}`:"subagent",v=[`${e.toolCount} ${e.toolCount===1?"tool":"tools"}`,d>0?`${d} in-flight`:null,f>0?`${ot(f)} tok`:null,h>0?`${Be(h)}${Ml(e,o)>0?"+":""}`:null].filter(Boolean).join(" · ");return It.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?"≥ ":"",si(e.startedAt,e.endedAt,o)]})]}),a.jsxs("div",{className:"node-peek-kind",children:[a.jsxs("span",{className:"node-peek-state","data-kind":hx(e.state),children:[a.jsx(DM,{kind:hx(e.state)}),ni(e.state)]}),a.jsx("span",{children:g}),e.model?a.jsx("span",{children:Ys(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($b,{}),a.jsx("span",{children:Eb(e.waiting)}),a.jsx("b",{children:si(e.waiting.since,void 0,o)})]}),a.jsxs("p",{className:"node-peek-facts",children:[v,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:AM(e.branch)}),a.jsx("p",{className:"node-peek-hint",children:"Click to go to the session · double-click for details"})]}),document.body)}function ree(e){const t=e.minZoom??cY,n=e.maxZoom??uY,r=e.fill??.9,s=e.insets.left,o=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,h=e.anchor,f=Math.min(l/Math.max(1,d.width),u/Math.max(1,d.height))*r,p=Math.max(t,Math.min(n,f)),g=(v,k,b,x,N,S)=>{let _=v+(k-x*p)/2-b*p;const E=N*p+_,T=(N+S)*p+_;return S*p<=k?E<v?_+=v-E:T>v+k&&(_-=T-(v+k)):_+=v-E,_};return{x:g(s,l,d.x,d.width,h.x,h.width),y:g(o,u,d.y,d.height,h.y,h.height),zoom:p}}function see(e){let t=1/0,n=1/0,r=-1/0,s=-1/0;for(const o of e)t=Math.min(t,o.x),n=Math.min(n,o.y),r=Math.max(r,o.x+o.width),s=Math.max(s,o.y+o.height);return Number.isFinite(t)?{x:t,y:n,width:r-t,height:s-n}:null}function bn(e){const t=w.useRef(e);return t.current=e,t}const Gx=80,Kx=.86;function EO(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 aee({canvasRef:e,canvasSize:t,machinePhase:n,usagePhase:r,usagePanelOpen:s,detailShown:o}){const[l,u]=w.useState(0);w.useEffect(()=>{const p=EO(e.current);u(g=>Math.abs(g-p)>40?p:g)},[n,r,s,o,t.w]);const d=bn(l),h=t.w>0?Math.max(0,(t.w-l-Gx*2)*Kx):0,f=t.h>0?Math.max(0,(t.h-Gx*2)*Kx):0;return{railInsetRef:d,availableWidth:h,availableHeight:f}}const CO=420;function oee(){const e=di(),t=kt(),n=w.useCallback((d,h)=>{if(cx({durationMs:h,documentHidden:document.hidden})){e.setViewport(d,{duration:h});return}const{d3Zoom:f,d3Selection:p}=t.getState(),g=p==null?void 0:p.property("__zoom");if(f&&p&&g&&g.k>0&&d.zoom>0){f.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=w.useRef(null),s=w.useRef(0),o=w.useRef(0),l=w.useCallback((d,h)=>{const f=++s.current;return n(d,h),o.current=Date.now(),r.current=cx({durationMs:h,documentHidden:document.hidden})?{target:d,until:Date.now()+h+60}:null,f},[n]),u=w.useCallback((d=500)=>{const h=Gx,f=1,p=.2,g=Kx;try{const v=document.querySelector(".canvas-wrap"),k=Array.from(document.querySelectorAll(".react-flow__node")).filter($=>$.offsetWidth>0);if(!v||k.length===0)return;const b=v.getBoundingClientRect(),x=e.getViewport();if(!Number.isFinite(x.zoom)||x.zoom<=0)return;const N=$=>($-b.left-x.x)/x.zoom,S=$=>($-b.top-x.y)/x.zoom,_=k.map($=>$.getBoundingClientRect()),E=Math.min(..._.map($=>N($.left))),T=Math.max(..._.map($=>N($.right))),R=Math.min(..._.map($=>S($.top))),A=Math.max(..._.map($=>S($.bottom))),q=T-E,L=A-R;if(!(q>0&&L>0))return;const P=EO(v),I=$=>Math.max(p,Math.min(f,(b.width-P-h*2)/(q+$)*g,(b.height-h*2)/L*g)),O=lY(I(CO),I(0)),U={x:h-E*O,y:Math.max(h,(b.height-L*O)/2)-R*O,zoom:O},M=l(U,d);window.setTimeout(()=>{var $;try{if((($=r.current)==null?void 0:$.target)===U&&(r.current=null),s.current!==M)return;const B=e.getViewport();(Math.abs(B.zoom-O)>.01||Math.abs(B.x-U.x)>2)&&n(U,0)}catch{}},d+60)}catch{}},[e,n,l]);return w.useEffect(()=>{const d=()=>{if(!document.hidden)return;const h=r.current;if(r.current=null,!(!h||Date.now()>h.until)){try{n(h.target,0)}catch{}o.current=Date.now()}};return document.addEventListener("visibilitychange",d),()=>document.removeEventListener("visibilitychange",d)},[n]),{applyViewport:n,moveCamera:l,fitLeft:u,cameraEpochRef:s,lastFitTimeRef:o}}const iee=450;function lee({canvasRef:e,stateRef:t,measuredRef:n,nodesRef:r,railInsetRef:s,moveCamera:o,disableAutoFit:l,lastFocusRef:u,focusAgentRef:d,selectAgent:h,primarySelectedIdRef:f}){const p=w.useCallback(k=>{var q;const b=e.current,x=t.current.agents.get(k);if(!b||!x)return;const N=v0(t.current),S=(L,P)=>{const I=n.current.get(L.id);if(!I)return null;const O=P&&N.has(L.id)?CO:0;return{x:L.position.x,y:L.position.y,width:I.width+O,height:I.height}},_=r.current.find(L=>L.id===k),E=_?S(_,!1):null;if(!E)return;const T=[];for(const L of r.current){if(L.type!=="agent"&&L.type!=="recapNote"||((q=L.data)==null?void 0:q.sessionId)!==x.sessionId)continue;const P=S(L,L.type==="agent");P&&T.push(P)}const R=b.getBoundingClientRect(),A=ree({pane:{width:R.width,height:R.height},insets:{top:56,left:72,bottom:32,right:s.current+32},context:see(T)??E,anchor:E});Zs(),l(),u.current={id:k,at:Date.now()},o(A,iee)},[o,l]);d.current=p;const g=w.useCallback(k=>{const b=r.current.filter(_=>_.type==="agent"),x=VQ(b.map(_=>({id:_.id,x:_.position.x,y:_.position.y})),f.current,k),N=x?b.find(_=>_.id===x):void 0;if(!N)return;const S=x0(document.activeElement);h(N.id,!1),window.setTimeout(()=>{try{p(N.id)}catch{}S&&ZQ(N.id)},30)},[h,p]),v=w.useCallback(k=>{h(k,!1),window.setTimeout(()=>{try{p(k)}catch{}},60)},[h,p]);return{focusAgent:p,stepAgent:g,focusSession:v}}function cee({nodesRef:e,stateRef:t,canvasRef:n,railInsetRef:r}){const s=w.useCallback(d=>{const h=e.current.find(f=>f.id===d&&f.type==="agent");return h?h.data:void 0},[]),o=w.useCallback(d=>{var h;return(h=t.current.agents.get(d))==null?void 0:h.label},[]),l=w.useCallback(d=>{var p;const h=e.current.find(g=>g.id===d&&g.type==="recapNote");if(!h)return;const f=h.data;return{recap:f.recap,hue:f.hue,sessionLabel:(p=t.current.agents.get(f.parentId))==null?void 0:p.label}},[]),u=w.useCallback(()=>{var f;const d=(f=n.current)==null?void 0:f.getBoundingClientRect(),h=document.documentElement;return d?{width:d.right-r.current,height:d.bottom}:{width:h.clientWidth,height:h.clientHeight}},[]);return{peekAgent:s,peekLabel:o,peekRecap:l,peekBounds:u}}function uee(e){const t=new Set(e.pins),n=new Map,r=new Map;for(const[s,o]of e.positions)n.set(s,o),t.has(s)&&r.set(s,o);return{positions:n,pinned:r,restored:new Set(n.keys())}}function QR(e){return Object.entries(e??{}).filter(([,t])=>t&&typeof t.x=="number"&&typeof t.y=="number")}function dee(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=QR(n);return{positions:s,pins:s.map(([o])=>o)}}const r=n;return{positions:QR(r.positions),pins:Array.isArray(r.pins)?r.pins:[]}}function hee(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 fee(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 b0="agent-dag.layout",k0="agent-dag.layoutFrame",N0="agent-dag.viewport";function pee(){return dee(Qe(b0))}function zl(e,t){Ye(b0,hee(e,t))}function mee(){return fee(Qe(k0))}function TO(e){Ye(k0,JSON.stringify(e))}function gee(){return eq(Qe(N0))}function yee(e){Ye(N0,JSON.stringify(e))}function RO(){ls(b0),ls(N0),ls(k0)}function wee(e){const t=w.useState(()=>uee(pee()))[0],n=w.useRef(t.pinned),r=w.useRef(t.positions),s=w.useRef(new Set),o=w.useRef(""),[l,u]=w.useState(0),d=w.useState(mee)[0],h=w.useRef(d),f=w.useCallback(()=>{n.current.clear(),r.current.clear(),o.current="",RO(),u(p=>p+1),window.setTimeout(()=>{zl(r.current,n.current),h.current&&TO(h.current),e(500)},80)},[e]);return{restoredLayout:t,pinnedRef:n,positionsRef:r,provisionalRef:s,lastLayoutSigRef:o,layoutEpoch:l,setLayoutEpoch:u,lastLayoutFrameRef:h,handleRelayout:f}}function vee(e,t){const{positionsRef:n,pinnedRef:r}=t,s=w.useRef(null);w.useEffect(()=>(s.current!=null&&window.clearTimeout(s.current),s.current=window.setTimeout(()=>{zl(n.current,r.current)},1500),()=>{s.current!=null&&window.clearTimeout(s.current)}),[e])}function xee({nodes:e,edges:t,settled:n,dragging:r,availableWidth:s,availableHeight:o,layout:l,camera:u,rf:d,measuredRef:h,stateRef:f,lastFocusRef:p,primarySelectedIdRef:g,focusAgentRef:v,autoFitDisabledRef:k}){const{lastLayoutFrameRef:b,pinnedRef:x,positionsRef:N,provisionalRef:S,lastLayoutSigRef:_,setLayoutEpoch:E}=l,{applyViewport:T,fitLeft:R,cameraEpochRef:A,lastFitTimeRef:q}=u;w.useEffect(()=>{if(!n||r)return;const L={width:s,height:o};if(!(L.width>0&&L.height>0))return;const P=b.current;if(b.current=L,TO(L),!P||P.width===L.width&&P.height===L.height)return;const I={direction:"LR",pinned:x.current,measured:h.current,lanes:v0(f.current)};if(!PQ(e,t,I,P,L))return;const O=p.current&&Date.now()-p.current.at<1500?p.current.id:null,U=O??g.current,M=U?x.current.get(U)??N.current.get(U):void 0;for(const $ of Array.from(N.current.keys()))x.current.has($)||N.current.delete($);S.current.clear(),_.current="",E($=>$+1),window.setTimeout(()=>{if(zl(N.current,x.current),k.current){if(O){v.current(O);return}const $=U?x.current.get(U)??N.current.get(U):void 0;if(M&&$&&($.x!==M.x||$.y!==M.y)){const B=d.getViewport();A.current+=1,T({x:B.x-($.x-M.x)*B.zoom,y:B.y-($.y-M.y)*B.zoom,zoom:B.zoom},0),q.current=Date.now()}return}R(500)},80)},[s,o,n,r,R,d,T])}const bee=600;function j0(e,t){return!(e.exitAt!=null&&t-e.exitAt>bee||e.kind==="root"&&e.state==="done"&&e.tools.length===0&&e.endedAt!=null&&e.endedAt-e.startedAt<3e3)}function kee(e,t){const n=new Set;for(const r of e.agents.values())j0(r,t)&&n.add(r.id);return n}function Nee(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 jee(e,t,n=0){if(!e)return!1;for(const r of t)if(Nee(e,r,n))return!0;return!1}function See(e,t,n,r,s){const o=[];for(const l of e)!j0(l,t)||n.has(l.id)||o.push(l.id+(l.parentId?`>${l.parentId}`:""));return o.sort(),`${o.join("|")}#sv${r}.${s}`}const S0="agent-dag.removedNodes";function _ee(e){try{const t=JSON.parse((e==null?void 0:e.getItem(S0))??"[]");return new Set(Array.isArray(t)?t.filter(n=>typeof n=="string"):[])}catch{return new Set}}function eA(e,t){try{e==null||e.setItem(S0,JSON.stringify([...t]))}catch{}}function AO(e,t){const n=new Map(e.map(o=>[o.id,o.parentId])),r=new Set(t),s=o=>{if(r.has(o))return!0;const l=new Set([o]);let u=n.get(o);for(;u&&!l.has(u);){if(r.has(u))return r.add(o),!0;l.add(u),u=n.get(u)}return!1};return o=>s(o.id)||s(o.sessionId??o.id)}function Eee(e,t){if(t.size===0)return new Set;const n=[...e],r=AO(n,t);return new Set(n.filter(r).map(s=>s.id))}function Cee(e,t,n){const r=u=>({id:u.id,parentId:u.data.parentId,sessionId:u.data.sessionId}),s=AO(e.map(r),n),o=e.filter(u=>!s(r(u))),l=new Set(o.map(u=>u.id));return{nodes:o,edges:t.filter(u=>l.has(u.source)&&l.has(u.target))}}function Tee(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 Ree(e,t){return t.size===0?[]:[...e].filter(n=>t.has(n.id)).map(n=>n.id)}function Aee(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 Mee(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 $ee(e,t,n,r){if(n.size===0)return[];let s=1/0;for(const l of r.values())l<s&&(s=l);const o=new Set;for(const l of t){const u=e.get(l);if(!u)continue;const d=Aee(u);if(d<=s)continue;const h=[],f=new Set,p=v=>{var k;for(let b=v;b&&!f.has(b);b=(k=e.get(b))==null?void 0:k.parentId)f.add(b),n.has(b)&&h.push(b)};p(u.id),p(u.sessionId);let g=-1/0;for(const v of h)g=Math.max(g,r.get(v)??1/0);if(d>g)for(const v of h)o.add(v)}return[...o]}const MO="sessionGroup";function Iee(e,t){var r,s;if(e.type===MO)return"transparent";if(hr((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 Mu=Ea;function Oee(e){const t=new Map;for(const r of e){const s=r.data;if(!(s!=null&&s.sessionId)||s.exitAt!=null)continue;const o=r.width,l=r.height;if(o==null||l==null)continue;const u=r.position.x,d=r.position.y,h=u+o,f=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,h),p.maxY=Math.max(p.maxY,f)):t.set(s.sessionId,{minX:u,minY:d,maxX:h,maxY:f})}const n=[];for(const[r,s]of t){const o=s.maxX-s.minX+Mu*2,l=s.maxY-s.minY+Mu*2;n.push({id:`group:${r}`,type:MO,position:{x:s.minX-Mu,y:s.minY-Mu},data:{sessionId:r,w:o,h:l},width:o,height:l,style:{width:o,height:l},zIndex:-1,draggable:!0,selectable:!1,focusable:!1,deletable:!1,connectable:!1})}return n}function Lee(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 o=!0;for(;o;){o=!1;for(const l of e.agents.values())l.parentId&&r.has(l.parentId)&&!r.has(l.id)&&(r.add(l.id),o=!0)}return r}function Pee(e,t){const n=new Set;for(const r of t){const s=Lee(e,r);if(s)for(const o of s)n.add(o)}return n.size>0?n:null}function Dee({stateRef:e,now:t,removedAgentIds:n,sizeVersion:r,domSizeVersion:s}){return w.useMemo(()=>See(e.current.agents.values(),t,n,r,s),[e.current,e.current.revision,t,r,s,n])}function Fee({stateRef:e,now:t,availableWidth:n,availableHeight:r,layout:s,measuredRef:o,onBubble:l,settled:u,dragging:d,layoutSig:h,selectedIds:f,openContext:p,historyReplayed:g,removedNodes:v,removedAgentIds:k,dragTick:b,dragPatchRef:x,dragMoveTick:N}){const{pinnedRef:S,positionsRef:_,provisionalRef:E,lastLayoutSigRef:T,restoredLayout:R,layoutEpoch:A}=s,q=w.useMemo(()=>Pee(e.current,f),[e.current,e.current.revision,f]),L=w.useMemo(()=>{const B=kee(e.current,t);for(const V of k)B.delete(V);return B},[e.current,e.current.revision,t,k]),P=w.useRef(new Map),I=lB(),{nodes:O,edges:U}=w.useMemo(()=>{const B=WQ(e.current,t,n,r,S.current,o.current,P.current,l,u,d,_.current,E.current,h,T,f,q,L,p,g,R.restored);return Cee(B.nodes,B.edges,v)},[e.current,e.current.revision,t,n,r,u,d,h,f,q,L,p,b,I,v,A,g]),M=w.useMemo(()=>Oee(O),[O]),$=w.useMemo(()=>{const B=[...M,...O],V=x.current;return!V||V.size===0?B:B.map(H=>{const F=V.get(H.id);return F?{...H,position:F}:H})},[M,O,N]);return{spotlightSet:q,visibleAgentIds:L,nodes:O,edges:U,allNodes:$}}function qee(e,t,n){const r=e.x*t.zoom+t.x,s=e.y*t.zoom+t.y,o=(e.x+e.width)*t.zoom+t.x,l=(e.y+e.height)*t.zoom+t.y;return o>0&&r<n.width&&l>0&&s<n.height}function Bee({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,qee(s,t,e))return!1;return r}function Uee({layoutSig:e,rf:t,stateRef:n,measuredRef:r,pinnedRef:s,positionsRef:o,paneSizeRef:l,lastInteractRef:u,autoFitDisabledRef:d,lastFitTimeRef:h,fitLeft:f}){const p=w.useRef(null),g=w.useRef("");w.useEffect(()=>{const v=setInterval(()=>{if(d.current||Date.now()-u.current<800)return;const k=n.current,b=Date.now(),x=[];for(const S of k.agents.values())j0(S,b)&&x.push({id:S.id});if(x.length===0)return;const N=[];for(const{id:S}of x){const _=r.current.get(S),E=s.current.get(S)??o.current.get(S);!_||!E||N.push({x:E.x,y:E.y,width:_.width,height:_.height})}Bee({pane:l.current,viewport:t.getViewport(),boxes:N})&&f(600)},1500);return()=>clearInterval(v)},[t]),w.useEffect(()=>{if(g.current===e)return;const v=g.current;if(g.current=e,!v||d.current)return;Date.now()-h.current>1200&&f(400),p.current&&window.clearTimeout(p.current),p.current=window.setTimeout(()=>{d.current||f(500)},280)},[e,t,f])}function zee({stateRef:e,pinnedRef:t,positionsRef:n,canvasRef:r,clearSelection:s,primarySelectedId:o}){const[l,u]=w.useState(()=>_ee(vl())),[d,h]=w.useState(null),f=w.useMemo(()=>Eee(e.current.agents.values(),l),[e.current,e.current.revision,l]),p=w.useCallback(N=>{const S=e.current.agents.get(N);S&&(u(_=>{const E=new Set(_);return E.add(N),eA(vl(),E),E}),h({id:N,label:S.label}),t.current.delete(N),n.current.delete(N),s())},[s]),g=w.useCallback(()=>{o&&p(o)},[o,p]),v=d&&l.has(d.id)?d:null;w.useEffect(()=>{var N;d&&((N=r.current)==null||N.focus())},[d]);const k=w.useCallback(N=>{const S=[...N];u(_=>{const E=Tee(_,S);return E!==_&&eA(vl(),E),E})},[]),b=w.useCallback(()=>{k([...l]),h(null)},[k,l]),x=w.useCallback(()=>{u(new Set),h(null),ls(S0)},[]);return{removedNodes:l,lastRemoval:d,removedAgentIds:f,removeNode:p,removeSelectedNode:g,removalNotice:v,bringBack:k,bringBackAll:b,forgetRemovals:x}}function Wee({stateRef:e,waitingSessions:t,removedAgentIds:n,removedNodes:r,bringBack:s}){const o=w.useRef(new Map);w.useEffect(()=>{o.current=Mee(o.current,r,Date.now());const l=[...Ree(t,n),...$ee(e.current.agents,n,r,o.current)];l.length>0&&s(l)},[t,n,r,s])}function Hee({waiting:e,running:t,connected:n=!0}){return{title:e>0?`(${e}) ${bt}`:bt,icon:n?e>0?"waiting":t>0?"running":"idle":"offline"}}const $u={offline:"#e05252",waiting:"#c97d12",running:"#2a90d4",idle:"#7e828c"};function Iu(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 Vee=Object.freeze({offline:`data:image/svg+xml,${encodeURIComponent(Iu($u.offline,"offline"))}`,waiting:`data:image/svg+xml,${encodeURIComponent(Iu($u.waiting,"waiting"))}`,running:`data:image/svg+xml,${encodeURIComponent(Iu($u.running,"running"))}`,idle:`data:image/svg+xml,${encodeURIComponent(Iu($u.idle,"idle"))}`});function Gee({stateRef:e,waitingSessions:t,live:n}){const r=w.useMemo(()=>g8(e.current.agents.values()),[e.current,e.current.revision]),s=w.useRef(null);w.useEffect(()=>{const o=Hee({waiting:t.length,running:r,connected:n}),l=s.current;if(s.current=o,(l==null?void 0:l.title)!==o.title&&(document.title=o.title),(l==null?void 0:l.icon)!==o.icon){const u=document.querySelector('link[rel="icon"]');u&&(u.href=Vee[o.icon])}},[t.length,r,n])}const Kee=1200,Yee=1e3;function Uv(e){return e.lastDeckFitAt>0&&e.at-e.lastDeckFitAt<Kee?!1:e.hasSourceEvent?!0:e.lastCanvasInputAt>0&&e.at-e.lastCanvasInputAt<Yee}function Xee({applyViewport:e,lastFitTimeRef:t,cameraEpochRef:n,disableAutoFit:r,markInteract:s,canvasRef:o,applyZoom:l}){const u=w.useState(()=>gee())[0];w.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=w.useRef(null),h=w.useRef(0),f=w.useCallback(()=>{h.current=Date.now()},[]),p=w.useCallback(k=>({hasSourceEvent:!!k,at:Date.now(),lastDeckFitAt:t.current,lastCanvasInputAt:h.current}),[]);return{restoredViewport:u,markCanvasInput:f,onMoveStart:k=>{Zs(),Uv(p(k))&&(n.current+=1),Uv(p(k))&&r()},onMove:(k,b)=>{var x;s(),Uv(p(k))&&r(),(x=o.current)==null||x.style.setProperty("--zoom",String(b.zoom)),l(b.zoom)==="detail"&&Zs(),d.current&&window.clearTimeout(d.current),d.current=window.setTimeout(()=>yee(b),250)}}}function Zee({clearSelection:e,selectAgent:t,detailOpen:n,setDetailOpen:r,detailShown:s,focusAgent:o,draggingRef:l,lodRef:u}){return{onNodeClick:(v,k)=>{if(k.type==="sessionGroup"){e();return}const b=k.type==="recapNote"?k.data.parentId:k.id;t(b,v.shiftKey,!1),!v.shiftKey&&(n&&r(!1),s?window.setTimeout(()=>{try{o(b)}catch{}},80):o(b))},onPaneClick:()=>{Zs(),e()},onNodeDoubleClick:(v,k)=>{if(k.type!=="agent"&&k.type!=="recapNote")return;const b=k.type==="recapNote"?k.data.parentId:k.id;t(b,!1),window.setTimeout(()=>{try{o(b)}catch{}},80)},onNodeMouseEnter:(v,k)=>{k.type!=="agent"&&k.type!=="recapNote"||l.current||u.current==null||u.current==="detail"||SO(k.id,v.currentTarget)},onNodeMouseLeave:(v,k)=>Zs(k.id)}}function Jee(){const e=w.useRef(null),t=w.useRef(null),[n,r]=w.useState({w:0,h:0});return w.useEffect(()=>{const s=t.current;if(!s||typeof ResizeObserver>"u")return;const o=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(h=>Math.abs(h.w-u.width)>40||Math.abs(h.h-u.height)>40?{w:u.width,h:u.height}:h))});return o.observe(s),e.current={width:s.clientWidth,height:s.clientHeight},r({w:s.clientWidth,h:s.clientHeight}),()=>o.disconnect()},[]),{canvasRef:t,canvasSize:n,paneSizeRef:e}}function Qee(e){const t=w.useRef(new Map),n=w.useRef(0),r=w.useCallback(u=>{const d=t.current;let h=!1;for(const f of u.nodeInternals.values()){const p=f.width,g=f.height;if(p==null||g==null)continue;const v=d.get(f.id);v?(Math.abs(v.height-g)>4||Math.abs(v.width-p)>4)&&(d.set(f.id,{width:p,height:g}),h=!0):(d.set(f.id,{width:p,height:g}),h=!0)}return h&&(n.current+=1),n.current},[]),s=Ke(r),[o,l]=w.useState(0);return w.useEffect(()=>{let u=0;const d=()=>{const f=t.current;let p=!1;for(const g of document.querySelectorAll(".react-flow__node[data-id]")){const v=g.getAttribute("data-id");if(!v)continue;const k=g.offsetWidth,b=g.offsetHeight;if(!k||!b)continue;const x=f.get(v);(!x||Math.abs(x.width-k)>4||Math.abs(x.height-b)>4)&&(f.set(v,{width:k,height:b}),p=!0)}p&&l(g=>g+1)};if(e.current)return;let h=0;return document.visibilityState==="hidden"?h=window.setTimeout(d,32):u=requestAnimationFrame(d),()=>{cancelAnimationFrame(u),window.clearTimeout(h)}}),{measuredRef:t,measuredVersionRef:n,sizeVersion:s,domSizeVersion:o}}function ete(){const[e,t]=w.useState(!1);return w.useEffect(()=>{const n=window.setTimeout(()=>t(!0),2500);return()=>window.clearTimeout(n)},[]),e}function tte(){const e=w.useRef(null);return w.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 nte({pointerFocusRef:e,nodesRef:t,stateRef:n,primarySelectedIdRef:r,providersRef:s,soundOnRef:o,keyHelpOpenRef:l,modalOpenRef:u,waitingCursorRef:d,removeSelectedRef:h,activateSoundRef:f,clearSelection:p,selectAgent:g,focusAgent:v,stepAgent:k,focusSession:b,requestClear:x,handleRelayout:N,handleFit:S,togglePause:_,toggleSessionList:E,toggleAccountsPanel:T,setDetailOpen:R,setUsageHistoryOpen:A,setUsagePanelOpen:q,setMachinePanelOpen:L,setBrowserWatchOpen:P,setSoundMenuOpen:I,setKeyHelpOpen:O,setTheme:U}){w.useEffect(()=>{const M=$=>{var D,Y;const B=$.target,V={tagName:B==null?void 0:B.tagName,isContentEditable:B==null?void 0:B.isContentEditable,role:(D=B==null?void 0:B.getAttribute)==null?void 0:D.call(B,"role"),type:B==null?void 0:B.type,pointerFocused:B!=null&&B===e.current};if($.key==="Escape"){const J=$8({overlayOpen:wl.depth()>0,typing:Ld(V)});J==="dismiss"?wl.dismissTop():J==="blur"?B==null||B.blur():(XQ(V)&&(B==null||B.blur()),p());return}if(Od($))return;const H=x0(B)?(Y=B==null?void 0:B.getAttribute)==null?void 0:Y.call(B,"data-id"):null,F=H&&t.current.some(J=>J.id===H)?H:null,W=KQ($,F);if(W.kind==="activate"){$.preventDefault(),g(W.nodeId,W.additive);return}if(W.kind!=="node"&&!(W.nodeId==null&&U8(V,$.key))&&!z8({key:$.key,modalOpen:W8({appModal:u.current,dialogDepth:wl.dialogDepth()}),sheetOpen:l.current})){if($.key===" "&&($.preventDefault(),_()),($.key==="c"||$.key==="C")&&x("shortcut"),($.key==="r"||$.key==="R")&&N(),($.key==="f"||$.key==="F")&&S(),($.key==="z"||$.key==="Z")&&r.current&&v(r.current),$.key==="Delete"&&h.current(),($.key==="l"||$.key==="L")&&E(),$.key==="d"||$.key==="D")if(r.current)R(J=>!J);else{const J=ux(n.current.agents.values());J.length>0?b(J[0].id):k(1)}if(($.key==="h"||$.key==="H")&&A(J=>!J),($.key==="u"||$.key==="U")&&q(J=>!J),($.key==="a"||$.key==="A")&&s.current.claude&&T(),($.key==="j"||$.key==="J")&&k(1),($.key==="k"||$.key==="K")&&k(-1),$.key==="w"||$.key==="W"){const J=m8(ux(n.current.agents.values()),d.current);J&&(d.current=J.id,b(J.id))}($.key==="t"||$.key==="T")&&U(J=>J==="dark"?"light":"dark"),($.key==="m"||$.key==="M")&&s.current.claude&&o.current!==null&&f.current($.shiftKey),($.key==="s"||$.key==="S")&&L(J=>!J),($.key==="b"||$.key==="B")&&P(J=>!J),($.key==="v"||$.key==="V")&&s.current.claude&&o.current!==null&&I(J=>!J),$.key==="?"&&O(J=>!J)}};return window.addEventListener("keydown",M),()=>window.removeEventListener("keydown",M)},[x,N,S,p,g,k,b,v,_])}function rte({nodes:e,stateRef:t,pinnedRef:n,positionsRef:r,draggingRef:s,dragPatchRef:o,setDragging:l,setDragMoveTick:u,setDragTick:d,endBubble:h,markInteract:f,disableAutoFit:p,beginTrashDrag:g,trackTrashDrag:v,endTrashDrag:k,removeNode:b}){const x=w.useRef(null);return{onNodeDragStart:(E,T)=>{var R,A;if(Zs(),h(),s.current=!0,o.current=new Map,l(!0),g(T.type==="agent"?((R=t.current.agents.get(T.id))==null?void 0:R.label)??"":null),f(),p(),T.type==="sessionGroup"){const q=(A=T.data)==null?void 0:A.sessionId,L=new Map;if(q)for(const P of e){const I=P.data;(I==null?void 0:I.sessionId)===q&&L.set(P.id,{x:P.position.x,y:P.position.y})}x.current={start:{x:T.position.x,y:T.position.y},members:L};return}n.current.set(T.id,{x:T.position.x,y:T.position.y})},onNodeDrag:(E,T)=>{var R;if(f(),T.type==="agent"&&v(E),T.type==="sessionGroup"){const A=x.current;if(!A)return;const q=T.position.x-A.start.x,L=T.position.y-A.start.y;for(const[I,O]of A.members){const U={x:O.x+q,y:O.y+L};n.current.set(I,U),r.current.set(I,U)}const P=o.current;if(P){for(const[I,O]of A.members)P.set(I,{x:O.x+q,y:O.y+L});P.set(T.id,{x:T.position.x,y:T.position.y})}u(I=>I+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=o.current)==null||R.set(T.id,{x:T.position.x,y:T.position.y}),u(A=>A+1)},onNodeDragStop:(E,T)=>{f();const R=k(E,T.type==="agent");if(s.current=!1,o.current=null,l(!1),d(A=>A+1),T.type==="sessionGroup"){const A=x.current;if(A){const q=T.position.x-A.start.x,L=T.position.y-A.start.y;for(const[P,I]of A.members){const O={x:I.x+q,y:I.y+L};n.current.set(P,O),r.current.set(P,O)}}x.current=null,zl(r.current,n.current),d(q=>q+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){b(T.id);return}zl(r.current,n.current)}}}function ste(e){return e.claude&&e.codex?"Claude Code and Codex":e.claude?"Claude Code":e.codex?"Codex":null}const ate={claude:"Claude Code",codex:"Codex",opencode:"OpenCode",openclaw:"OpenClaw",copilot:"GitHub Copilot",pi:"pi-agent",zcode:"ZCode"};function ote(e){const t=e.toLowerCase(),n=$t(ate,t);return n!==void 0?n:t?t[0].toUpperCase()+t.slice(1):""}function ite(e){return e.length<=1?e[0]??"":`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`}function Sae(e,t=[]){const n=t.length?ite(t.map(ote)):ste(e);return n?`via ccusage · local ${n} logs`:"via ccusage · local agent logs"}function lte(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 cte(e,t){const n=t.prefs??Ux,r=li(n.done.level),s=li(n["needs-input"].level),o=r===s?`${r}%`:`${r}% and ${s}%`,l=t.on?`Sound: on at ${o} — 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?`
|
|
86
|
+
|
|
87
|
+
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?`
|
|
88
|
+
|
|
89
|
+
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+`
|
|
90
|
+
|
|
91
|
+
Click to set the volume and the sound of each tone, and to hear either one.`}function ute(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 dte(){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 ",bt," tabs are open"]}),a.jsxs("p",{children:["This browser keeps at most six live connections to one address, and other ",a.jsx("code",{children:bt})," tabs are holding them. Close one and this tab connects on its own."]})]})}function hte({live:e,everConnected:t,providers:n,workspace:r,onTour:s}){const o=!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"})]})]}),o?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:bt}),". Check that it is still running in your terminal — the page picks up again on its own."]})]}):fte(n,r),!o&&a.jsx("button",{type:"button",className:"btn empty-tour",onClick:s,children:"Take the tour"})]})}function fte(e,t){const n=ute(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."]}),lte(e).map(r=>a.jsx("p",{className:"hint-row",children:r.spans.map((s,o)=>s.code?a.jsx("code",{children:s.text},o):a.jsx("span",{children:s.text},o))},r.provider))]})}const pte=1;function mte(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 gte(e,t,n){const r=e.agents.get(t);if(!r)return null;const s=[];for(const o of e.agents.values())o.sessionId===t&&s.push(o);return{schemaVersion:pte,exportedAt:n,sessionId:t,label:r.label,cwd:r.cwd,startedAt:r.startedAt,endedAt:r.endedAt,model:r.model,agents:s.map(o=>({id:o.id,kind:o.kind,label:o.label,parentId:o.parentId,state:o.state,startedAt:o.startedAt,endedAt:o.endedAt,model:o.model,cwd:o.cwd,usage:o.usage,prompts:o.prompts,tools:o.tools.map(mte)}))}}function yte(e,t){const n=(e||"session").replace(/[^a-z0-9._-]/gi,"_");return`${bt}-${n}-${Ob(t,8)}.json`}const $O={file:"📁",shell:"⚡",web:"🌐",agent:"🤖",task:"📋",plan:"🧭",mcp:"🔌",other:"✨"},wte={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 vte({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:wte[e]})})}const jd={file:"file",shell:"shell",web:"web",agent:"agent",task:"task",plan:"plan",mcp:"mcp",other:"other"},IO=$M;function xte({agent:e,now:t,onOpenTool:n,onShowSummary:r,onExportSession:s,onRemove:o}){var b;const l=`${e.synthetic?"≥ ":""}${si(e.startedAt,e.endedAt,t)}`,u=hn(e),d=u.total>0,h=e.usage.inputTokens+e.usage.outputTokens,f=new Map;for(const[x,N]of e.toolCountByName??[]){const S=IO(x);f.set(S,(f.get(S)??0)+N)}const p=e.toolErrorCount??0,g=e.tools.filter(x=>!x.endedAt).length,v=Array.from(f.entries()).sort((x,N)=>N[1]-x[1]),k=f.has("mcp")?FB(((b=e.toolCountByName)==null?void 0:b.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 x=xM(e);return a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"hero-sep",children:"·"}),a.jsxs("span",{className:"model-chip","data-family":$d(e.model),title:x.length>0?`${e.model}
|
|
92
|
+
spend on this panel also covers:
|
|
93
|
+
${x.join(`
|
|
94
|
+
`)}`:e.model,children:[Ys(e.model),x.length>0?` +${x.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(Lb,{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"}),o&&a.jsx("button",{type:"button",className:"btn hero-action-btn",onClick:o,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 x=Pd(e);if(!x)return null;const N=ud(x.at,t);return a.jsxs("section",{className:"detail-section",children:[a.jsxs("h3",{children:["Recap ",a.jsx("span",{className:"section-count",title:N.title,children:N.label})]}),a.jsx("p",{className:"detail-recap",children:x.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:v.map(([x,N])=>{const S=x==="mcp"?k:null,_=S==null?void 0:S.hue,E=`${N} ${jd[x]} call${N===1?"":"s"}`;return a.jsxs("span",{className:`cat-chip cat-${x}${_!=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:$O[x]}),a.jsx("span",{className:"cat-name",children:jd[x]}),a.jsx("span",{className:"cat-count",children:N}),S&&a.jsx("span",{className:"cat-server",children:S.label})]},x)})})]})]}),h>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:ot(e.usage.inputTokens)})]}),a.jsxs("div",{children:[a.jsx("span",{className:"k",children:"out"}),a.jsx("b",{title:e.usage.outputTokens.toLocaleString(),children:ot(e.usage.outputTokens)})]}),a.jsxs("div",{children:[a.jsx("span",{className:"k",children:"cache r"}),a.jsx("b",{title:e.usage.cacheReadTokens.toLocaleString(),children:ot(e.usage.cacheReadTokens)})]}),a.jsxs("div",{children:[a.jsx("span",{className:"k",children:"cache c"}),a.jsx("b",{title:e.usage.cacheCreateTokens.toLocaleString(),children:ot(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:iM(e.prompts).length})]}),a.jsx("div",{className:"prompts",children:bte(e.prompts).reverse().map(({pr:x,key:N})=>{const S=ud(x.at,t),_=jb(x.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})]},N):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:x.text})]},N)})})]}),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(x=>a.jsx(Nte,{t:x,onClick:()=>n(e.id,x.id)},x.id))})]})]})}function bte(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 kte={inflight:"in-flight",done:"done",err:"error"};function Nte({t:e,onClick:t}){const n=e.endedAt==null?"inflight":e.ok===!1?"err":"done",r=kM(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:kte[n]}),e.name]}),a.jsx("span",{style:{color:"var(--muted)"},children:r})]})}function jte(e,t){const n=gte(e,t,new Date().toISOString());if(!n)return;const r=JSON.stringify(n,null,2),s=new Blob([r],{type:"application/json"}),o=URL.createObjectURL(s),l=document.createElement("a");l.href=o,l.download=yte(n.label,t),document.body.appendChild(l),l.click(),document.body.removeChild(l),setTimeout(()=>URL.revokeObjectURL(o),1e3)}function Ste({selected:e,now:t,openTool:n,setSummaryFor:r,setDetailOpen:s,stateRef:o,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(xte,{agent:e,now:t,onOpenTool:n,onShowSummary:r,onExportSession:u=>jte(o.current,u),onRemove:l})]})}function OO({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:Vu,max:yd,step:Bx,value:t,"aria-describedby":r,onChange:s=>n(Number(s.target.value)),style:{"--sm-level":`${(t-Vu)/(yd-Vu)*100}%`}}),a.jsxs("span",{className:"sm-read",children:[t,"%"]})]})}const LO="agent-dag.character-enabled",PO="agent-dag.fm-volume",tA="agent-dag.fm-source",_te=[{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 Ete(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 Cte(e){return e!=="0"}function Tte(){return Cte(Qe(LO))}function Rte(e){return gI(e)}function Ate(){return Rte(Qe(PO))}const Do=["light","dark"],Mte={light:"Light",dark:"Dark"},nA=_te,Fo="Give the station a name.",$te="Use an https YouTube live or channel link, or a .mp3, .aac, .ogg or .m3u8 stream.";function Ite({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 Ote({theme:e,onTheme:t,characterEnabled:n,onToggleCharacter:r,fmVolume:s,onFmVolume:o,fmMuted:l,onFmMuted:u,fmSource:d,onFmSource:h,customFmStations:f,unavailableFmStations:p,onAddFmStation:g,onRenameFmStation:v,onRemoveFmStation:k,reportsOn:b,reportsVetoed:x,onToggleReports:N,onFeedback:S,onClose:_}){var We;const E=yt(_),T=[...nA.map(le=>({...le,label:p.has(le.value)?`${le.label} · not live`:le.label,unavailable:p.has(le.value)})),...f.map(le=>({group:"🎵 Your stations",value:La(le.id),label:p.has(le.id)?`${le.name} · unavailable`:le.name,unavailable:p.has(le.id)}))],R=T.some(le=>le.value===d&&le.unavailable),A=[];T.forEach((le,je)=>{const Re=A[A.length-1];Re&&Re.group===le.group?Re.indexes.push(je):A.push({group:le.group,indexes:[je]})});const[q,L]=w.useState(!1),[P,I]=w.useState(()=>Math.max(0,T.findIndex(le=>le.value===d))),[O,U]=w.useState(!1),[M,$]=w.useState(""),[B,V]=w.useState(""),[H,F]=w.useState(""),[W,D]=w.useState(!1),[Y,J]=w.useState(""),[G,K]=w.useState(""),X=w.useRef(null),Z=w.useRef(null),ee=w.useRef(null),se=w.useRef(null),ue=w.useRef(null),ae=ti(d),re=ae?f.find(le=>le.id===ae):void 0;w.useEffect(()=>{const le=T.findIndex(je=>je.value===d);I(le<0?0:le)},[d,f,p]),w.useEffect(()=>{D(!1),J((re==null?void 0:re.name)??"")},[re==null?void 0:re.id,re==null?void 0:re.name]),w.useEffect(()=>{var le;q&&((le=document.getElementById(`appearance-fm-option-${P}`))==null||le.scrollIntoView({block:"nearest"}))},[P,q]),w.useEffect(()=>{if(!q)return;const le=je=>{var Le,et;const Re=je.target;!((Le=X.current)!=null&&Le.contains(Re))&&!((et=ue.current)!=null&&et.contains(Re))&&L(!1)};return document.addEventListener("pointerdown",le),()=>document.removeEventListener("pointerdown",le)},[q]);const de=le=>{const je=le.relatedTarget;je&&!le.currentTarget.contains(je)&&L(!1)},me=le=>{var Re;const je=T[le];je&&(I(le),h(je.value),L(!1),(Re=X.current)==null||Re.focus())},pe=le=>{if(M8(le.key)){if(!q)return;le.preventDefault(),le.stopPropagation(),L(!1);return}if(le.key==="Tab"){L(!1);return}if(le.key==="Enter"||le.key===" "){le.preventDefault(),q?me(P):L(!0);return}le.key!=="ArrowDown"&&le.key!=="ArrowUp"&&le.key!=="Home"&&le.key!=="End"||(le.preventDefault(),L(!0),I(je=>le.key==="Home"?0:le.key==="End"?T.length-1:Math.min(T.length-1,Math.max(0,je+(le.key==="ArrowDown"?1:-1)))))},ke=()=>{var le;return(le=X.current)==null?void 0:le.focus()},xe=le=>{var Re,Le;if(le.preventDefault(),!M.trim()){F(Fo),(Re=Z.current)==null||Re.focus();return}const je=Q6(M,B);if(!je){F($te),(Le=ee.current)==null||Le.focus();return}g(je),h(La(je.id)),$(""),V(""),F(""),U(!1),ke()},fe=le=>{var je;if(le.preventDefault(),!!ae){if(!Y.trim()){K(Fo),(je=se.current)==null||je.focus();return}v(ae,Y),D(!1),ke()}},Te=le=>{var Le;if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(le.key))return;le.preventDefault();const Re=(Do.indexOf(e)+(le.key==="ArrowLeft"||le.key==="ArrowUp"?-1:1)+Do.length)%Do.length;t(Do[Re]),(Le=le.currentTarget.querySelectorAll('[role="radio"]')[Re])==null||Le.focus()},Fe=le=>{var Re;if(le.key===" "){le.stopPropagation();return}if(Ld(le.target)||le.key!=="t"&&le.key!=="T"||le.ctrlKey||le.metaKey||le.altKey)return;le.preventDefault(),le.stopPropagation();const je=e==="dark"?"light":"dark";t(je),le.target.getAttribute("role")==="radio"&&((Re=le.currentTarget.querySelectorAll('[role="radio"]')[Do.indexOf(je)])==null||Re.focus())},Oe=le=>{const je=T[le],Re="unavailable"in je&&je.unavailable;return a.jsxs("div",{className:"appearance-source-option",role:"option",id:`appearance-fm-option-${le}`,"aria-selected":d===je.value,"data-highlighted":P===le||void 0,"data-unavailable":Re||void 0,onMouseEnter:()=>I(le),onClick:()=>me(le),children:[a.jsx("span",{children:je.label}),d===je.value&&a.jsx("span",{"aria-hidden":!0,children:"✓"})]},je.value)};return It.createPortal(a.jsx("div",{className:"modal-backdrop appearance-backdrop",onClick:_,role:"presentation",children:a.jsxs("div",{ref:E,id:"appearance-menu",className:"modal appearance-menu appearance-modal",role:"dialog","aria-modal":"true","aria-labelledby":"appearance-title",onClick:le=>le.stopPropagation(),onKeyDown:Fe,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:_,"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:Te,children:Do.map(le=>a.jsxs("button",{type:"button",className:"appearance-theme",role:"radio","aria-checked":e===le,tabIndex:e===le?0:-1,onClick:()=>t(le),children:[a.jsx(Ite,{theme:le}),a.jsxs("span",{className:"appearance-theme-name",children:[Mte[le],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"})})]})]},le))})]}),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${q?" is-open":""}`,onBlur:de,children:[a.jsxs("button",{ref:X,type:"button",id:"appearance-fm-source",className:"appearance-source-trigger",role:"combobox","aria-haspopup":"listbox","aria-expanded":q,"aria-controls":q?"appearance-fm-source-list":void 0,"aria-activedescendant":q?`appearance-fm-option-${P}`:void 0,"aria-describedby":"appearance-fm-source-note",onClick:()=>L(le=>!le),onKeyDown:pe,children:[a.jsx("span",{children:((We=T.find(le=>le.value===d))==null?void 0:We.label)??nA[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"})})]}),q&&a.jsx("div",{ref:ue,id:"appearance-fm-source-list",className:"appearance-source-list",role:"listbox","aria-label":"Music stations",children:A.map((le,je)=>le.group?a.jsxs("div",{role:"group","aria-labelledby":`appearance-fm-group-${je}`,children:[a.jsx("div",{id:`appearance-fm-group-${je}`,className:"appearance-source-group",role:"presentation",children:le.group}),le.indexes.map(Oe)]},`group-${je}`):le.indexes.map(Oe))})]})]}),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:R?G6(ti(d)!==null):""}),a.jsxs("div",{className:"appearance-station-manage",children:[a.jsx("button",{type:"button",className:"btn appearance-station-action","aria-expanded":O,onClick:()=>{U(le=>!le),F("")},children:O?"Cancel":"+ Add station"}),re&&!W&&a.jsxs("span",{className:"appearance-station-edit",children:[a.jsx("button",{type:"button",className:"btn appearance-station-action",onClick:()=>{J(re.name),K(""),D(!0)},children:"Rename"}),a.jsx("button",{type:"button",className:"btn danger appearance-station-action",onClick:()=>{k(re.id),ke()},children:"Remove"})]})]}),O&&a.jsxs("form",{className:"appearance-station-form",onSubmit:xe,noValidate:!0,children:[a.jsxs("label",{className:"appearance-station-field",children:[a.jsx("span",{children:"Station name"}),a.jsx("input",{ref:Z,className:"ap-manage-input",value:M,onChange:le=>$(le.target.value),"aria-invalid":H===Fo||void 0,"aria-describedby":H===Fo?"appearance-station-error":void 0,maxLength:Rl,autoFocus:!0})]}),a.jsxs("label",{className:"appearance-station-field",children:[a.jsx("span",{children:"Link"}),a.jsx("input",{ref:ee,className:"ap-manage-input",value:B,onChange:le=>V(le.target.value),placeholder:"https://…","aria-invalid":H!==""&&H!==Fo||void 0,"aria-describedby":H&&H!==Fo?"appearance-station-error":void 0,inputMode:"url",autoComplete:"off",spellCheck:!1,maxLength:Y2})]}),a.jsx("button",{type:"submit",className:"btn primary",children:"Add"}),H&&a.jsx("p",{id:"appearance-station-error",className:"appearance-station-error",role:"alert",children:H})]}),re&&W&&a.jsxs("form",{className:"appearance-station-form is-rename",onSubmit:fe,noValidate:!0,children:[a.jsxs("label",{className:"appearance-station-field",children:[a.jsx("span",{children:"Station name"}),a.jsx("input",{ref:se,className:"ap-manage-input",value:Y,onChange:le=>J(le.target.value),"aria-invalid":G!==""||void 0,"aria-describedby":G?"appearance-rename-error":void 0,maxLength:Rl,autoFocus:!0})]}),a.jsx("button",{type:"submit",className:"btn primary",children:"Save"}),a.jsx("button",{type:"button",className:"btn",onClick:()=>{D(!1),ke()},children:"Cancel"}),G&&a.jsx("p",{id:"appearance-rename-error",className:"appearance-station-error",role:"alert",children:G})]}),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(OO,{id:"appearance-fm-volume",value:s,"aria-describedby":"appearance-fm-volume-note",onLevel:o}),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."})]}),a.jsxs("section",{className:"appearance-section","aria-labelledby":"appearance-improve-caption",children:[a.jsx("div",{className:"appearance-caption",children:a.jsx("h3",{id:"appearance-improve-caption",children:"Help improve ccdeck"})}),a.jsxs("div",{className:"appearance-controls",children:[a.jsxs("label",{className:"appearance-row",children:[a.jsx("span",{className:"appearance-row-label",id:"appearance-reports-label",children:"Send usage reports"}),a.jsx("button",{type:"button",className:"switch",role:"switch","aria-checked":b,"aria-labelledby":"appearance-reports-label","aria-describedby":"appearance-reports-note",disabled:x,onClick:N,children:a.jsx("span",{className:"switch-knob"})})]}),a.jsx("p",{id:"appearance-reports-note",className:"appearance-section-note",children:x?"Off: this deck was started with AGENTS_DECK_NO_REPORTS=1 or AGENTS_DECK_NO_INSTALL=1.":"On by default. The deck reports installs, updates, daily use and errors, plus your IP address and a device fingerprint (a stable hashed machine id) — no longer anonymous. Your sessions, prompts and files never leave. Turning it off deletes what was sent."}),a.jsx("div",{className:"appearance-improve-actions",children:a.jsx("button",{type:"button",className:"btn appearance-station-action",onClick:S,children:"Send feedback…"})})]})]})]})}),document.body)}const Lte="With no deck tab open, get a notification wherever a sound would have played.",Pte="With the ccdeck window closed, get a notification wherever a sound would have played.";function Dte(e){return e?Pte:Lte}const Fte="Held off for this run — the deck was started with alerts disabled. Your choice is saved for the next start.",rA="Get notified when you're away from this tab.";function qte(e){switch(e){case"granted":return{status:"Enabled",ask:!1,ok:!0,note:rA};case"default":return{status:null,ask:!0,ok:!1,note:rA};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 Wl(e=typeof navigator>"u"?"":navigator.userAgent){return/\bccdeck-desktop\/\d/.test(e)}const Bte=["audio/webm;codecs=opus","audio/ogg;codecs=opus","audio/mp4"];function Ute(e){return Bte.find(t=>e(t))}const zte=4400;function Wte(e){const t=e.split(";")[0];return{name:`Recorded voice.${t==="audio/mp4"?"m4a":t==="audio/ogg"?"ogg":"webm"}`,type:t}}function Hte({full:e,setCustomError:t,runCustom:n,onImportCustom:r}){const[s,o]=w.useState(!1),l=w.useRef(null),u=w.useRef(null),d=w.useRef(!1),h=()=>{var p;u.current!==null&&clearTimeout(u.current),u.current=null,((p=l.current)==null?void 0:p.state)==="recording"&&l.current.stop()},f=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(v=>v.stop());return}try{const v=Ute(x=>MediaRecorder.isTypeSupported(x)),k=new MediaRecorder(p,v?{mimeType:v}:void 0),b=[];l.current=k,k.ondataavailable=x=>{x.data.size&&b.push(x.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 x=l.current===k;if(x&&(l.current=null),o(!1),!x||!b.length)return;const N=Wte(k.mimeType),S=new File(b,N.name,{type:N.type});n(()=>r(S))},k.start(200),o(!0),u.current=setTimeout(h,zte)}catch{l.current=null,p.getTracks().forEach(v=>v.stop()),t("This browser cannot record a supported audio format.")}};return w.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:f,stopRecording:h}}function Vte({full:e,fullProps:t,runCustom:n,onCreateVoice:r}){const[s,o]=w.useState("Custom voice"),[l,u]=w.useState("Your turn"),[d,h]=w.useState(""),[f,p]=w.useState("1"),[g,v]=w.useState("1"),[k,b]=w.useState([]);return w.useEffect(()=>{if(typeof window>"u"||!("speechSynthesis"in window))return;const x=()=>{b(window.speechSynthesis.getVoices())};return x(),window.speechSynthesis.addEventListener("voiceschanged",x),()=>window.speechSynthesis.removeEventListener("voiceschanged",x)},[]),a.jsxs("details",{className:"sm-voice",children:[a.jsxs("summary",{...t,onClick:x=>{const N=x.currentTarget.parentElement;e&&N&&!N.open&&x.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:x=>o(x.target.value)})]}),a.jsxs("label",{children:[a.jsx("span",{children:"Text"}),a.jsx("input",{className:"ap-manage-input",value:l,maxLength:180,onChange:x=>u(x.target.value)})]}),a.jsxs("label",{children:[a.jsx("span",{children:"Voice"}),a.jsxs("select",{className:"sm-select",value:d,onChange:x=>h(x.target.value),children:[a.jsx("option",{value:"",children:"System default"}),k.map(x=>a.jsx("option",{value:x.voiceURI,children:x.name},x.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:f,onChange:x=>p(x.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:x=>v(x.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(f),pitch:parseFloat(g)}),u("Your turn")})},children:"Add spoken voice"})]})]})}function Gte({customAssets:e,onImportCustom:t,onCreateVoice:n,onRenameCustom:r,onPreviewCustom:s,onDeleteCustom:o}){const[l,u]=w.useState(""),d=e.length,h=Fx(d),f=h!==null,p=f?{"aria-disabled":!0,"aria-describedby":"sm-custom-full"}:{},[g,v]=w.useState(null),k=w.useRef(0),b=w.useRef(new Map),x=w.useRef(null);w.useEffect(()=>{if(!g)return;const R=window.setTimeout(()=>v(null),4e3);return()=>window.clearTimeout(R)},[g]);const N=async R=>{u("");try{await R()}catch(A){u(A instanceof Error?A.message:"Custom audio could not be saved.")}},S=(R,A)=>{const q=Date.now(),L=Ol({armedFor:g,target:R,armedAt:k.current,now:q,gapMs:Il});if(L==="arm"){v(R),k.current=q;return}if(L==="ignore")return;v(null);const P=kY(e.map(I=>I.id),R);N(async()=>{var O;await o(R);const I=document.activeElement;I!==A&&!hs((I==null?void 0:I.tagName)??null)||(O=P?b.current.get(P):x.current)==null||O.focus()})},{recording:_,startRecording:E,stopRecording:T}=Hte({full:f,setCustomError:u,runCustom:N,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 ",Dx,", kept on this machine"]})]}),f&&a.jsx("p",{className:"sm-note",id:"sm-custom-full",children:h}),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:x,type:"file",accept:"audio/wav,audio/x-wav,audio/mpeg,audio/mp3,audio/ogg,.wav,.mp3,.ogg",...p,onClick:R=>{f&&R.preventDefault()},onChange:R=>{var q;const A=(q=R.target.files)==null?void 0:q[0];R.currentTarget.value="",A&&!f&&N(()=>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(Vte,{full:f,fullProps:p,runCustom:N,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}N(()=>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?b.current.set(R.id,A):b.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 Yx="custom:";function sA(e){return`${Yx}${e}`}function Kte(e){return e.startsWith(Yx)?e.slice(Yx.length):null}const aA={done:"Turn finished","needs-input":"Claude is asking"},Yte={done:"Plays when Claude or Codex finishes a turn.","needs-input":"Available in Claude Code only."};function Xte({chime:e,tone:t,soundOn:n,customAssets:r,customSelections:s,onLevel:o,onFigure:l,onPreview:u,onBuiltInSelected:d,onCustomSelected:h}){const f=`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:aA[e]}),a.jsxs("button",{type:"button",className:"btn sm-hear",onClick:()=>u(e),"aria-label":`Hear the ${aA[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(OO,{id:f,value:t.level,onLevel:v=>o(e,v)}),a.jsxs("div",{className:"sm-row",children:[a.jsx("label",{htmlFor:p,children:"Tone"}),a.jsxs("select",{id:p,className:"sm-select",value:g?sA(g):t.figure,onChange:v=>{const k=v.target.value,b=Kte(k);b!==null?h(e,b):(d(e),l(e,k))},children:[Qb[e].map(v=>a.jsx("option",{value:v.id,children:v.label},v.id)),r.length>0&&a.jsx("optgroup",{label:"Custom",children:r.map(v=>a.jsx("option",{value:sA(v.id),children:v.name},v.id))})]})]}),a.jsx("p",{className:"sm-note",children:Yte[e]})]})}function Zte({onClose:e,soundOn:t,onToggleSound:n,prefs:r,onLevel:s,onFigure:o,onPreview:l,openerRef:u,customAssets:d,customSelections:h,onBuiltInSelected:f,onCustomSelected:p,onImportCustom:g,onCreateVoice:v,onRenameCustom:k,onPreviewCustom:b,onDeleteCustom:x,notifyOn:N,onToggleNotify:S,notifyVetoed:_,notifyPermission:E,onAskNotify:T}){var $;const R=qte(E),A=Wl(),q=N&&!_&&!A,L=xY(h),P=(($=d.find(B=>B.id===L))==null?void 0:$.name)??"the same custom sound",I=L?`Both tones use “${P}”. They may be harder to tell apart.`:"",O=yt(e,{popover:!0});w$(O,()=>u.current,e);const U=w.useRef(null),M=ql(!R.ask,U);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:U,type:"button",role:"switch","aria-checked":N,"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:_?Fte:Dte(A)})]})]}),q&&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:()=>{M(),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:Hu.map(B=>a.jsx(Xte,{chime:B,tone:r[B],soundOn:t,customAssets:d,customSelections:h,onLevel:s,onFigure:o,onPreview:l,onBuiltInSelected:f,onCustomSelected:p},B))}),I&&a.jsx("p",{className:"sm-note","aria-hidden":!0,children:I}),a.jsx("p",{className:"vis-hidden",role:"status",children:I}),a.jsx(Gte,{customAssets:d,onImportCustom:g,onCreateVoice:v,onRenameCustom:k,onPreviewCustom:b,onDeleteCustom:x}),a.jsxs("p",{className:"sm-foot",children:[a.jsx("kbd",{children:"M"}),"Mute or unmute sounds anywhere."]})]})}function Jte({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(o=>!o),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(o=>!o),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 Qte({providers:e,accountsPanelOpen:t,toggleAccountsPanel:n,machinePanelOpen:r,setMachinePanelOpen:s,watchOn:o,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:o?"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, ${o?"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"}),o||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 ene({providers:e,sound:t,tones:n,customTones:r,notify:s,chimeState:o,menus:l,appearance:u,fm:d,reports:h,onFeedback:f}){const{soundOn:p,toggleSound:g}=t,{tonePrefs:v,previewTone:k,changeTone:b}=n,{customSelections:x,customAssets:N,clearCustomOnly:S,selectCustomTone:_,importNotificationAudio:E,createNotificationVoice:T,renameCustomAsset:R,deleteCustomAsset:A,previewCustomAsset:q}=r,{notifyPermission:L,notifyOn:P,notifyVetoed:I,toggleNotify:O,notifySupported:U,askForNotifications:M}=s,{soundMenuOpen:$,setSoundMenuOpen:B,soundButtonRef:V,appearanceMenuOpen:H,setAppearanceMenuOpen:F,appearanceButtonRef:W}=l,{theme:D,setTheme:Y,characterEnabled:J,setCharacterEnabled:G}=u,{fmVolume:K,setFmVolume:X,fmMuted:Z,setFmMuted:ee,fmSource:se,customFmStations:ue,unavailableFmStations:ae,addFmStation:re,renameFmStation:de,removeFmStation:me,pickFmSource:pe}=d;return a.jsxs("div",{className:"action-run action-run-utility",children:[e.claude&&p!==null&&a.jsxs("div",{className:"sound-slot",children:[a.jsxs("button",{ref:V,className:"btn icon-btn",onClick:()=>B(ke=>!ke),...Ir(!1),title:cte(e,{on:p===!0,locked:o==="locked",prefs:v}),"aria-label":`Sound settings, ${p?"on":"off"}`,"aria-haspopup":"dialog","aria-expanded":$,"aria-controls":$?"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"}),p?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"})]}),$&&a.jsx(Zte,{onClose:()=>B(!1),soundOn:p===!0,onToggleSound:g,prefs:v,onLevel:(ke,xe)=>b(ke,{level:xe}),onFigure:(ke,xe)=>b(ke,{figure:xe}),onPreview:ke=>k(ke),customAssets:N,customSelections:x,onBuiltInSelected:S,onCustomSelected:_,onImportCustom:E,onCreateVoice:T,onRenameCustom:R,onPreviewCustom:q,onDeleteCustom:A,notifyOn:P,onToggleNotify:O,notifyVetoed:I,notifyPermission:U?L:"unsupported",onAskNotify:M,openerRef:V})]}),a.jsxs("div",{className:"appearance-slot",children:[a.jsx("button",{ref:W,className:"btn icon-btn",onClick:()=>{B(!1),F(ke=>!ke)},title:"Appearance settings","aria-label":`Appearance settings, ${D} theme, character ${J?"shown":"hidden"}`,"aria-haspopup":"dialog","aria-expanded":H,"aria-controls":H?"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"})})}),H&&a.jsx(Ote,{theme:D,onTheme:Y,characterEnabled:J,onToggleCharacter:()=>G(ke=>!ke),fmVolume:K,onFmVolume:X,fmMuted:Z,onFmMuted:()=>ee(ke=>!ke),fmSource:se,onFmSource:pe,customFmStations:ue,unavailableFmStations:ae,onAddFmStation:re,onRenameFmStation:de,onRemoveFmStation:me,reportsOn:h.reportsOn!==!1&&!h.reportsVetoed,reportsVetoed:h.reportsVetoed,onToggleReports:()=>{h.answerReports(h.reportsOn===!1)},onFeedback:()=>{F(!1),f()},onClose:()=>F(!1)})]}),a.jsx("button",{className:"btn icon-btn",onClick:f,title:"Report a problem — tell the people who make ccdeck","aria-label":"Report a problem","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:"M2.2 3.3h9.6v5.3H6.1L3.5 10.8V8.6H2.2Z"}),a.jsx("path",{d:"M7 4.9v1.7"}),a.jsx("path",{d:"M7 7.7v.05"})]})})]})}const tne=5*6e4,nne=6e4;function rne({shown:e,tabVisible:t,lastReadAt:n,now:r,lastSince:s,since:o}){return!e||!t?!1:s&&o&&s!==o?!0:n===null||r-n>=tne}function oA(e=new Date){return JM("month",e)}function sne(e){const t=Ud(e);return{cost:t.cost,tokens:t.tokens}}function iA(e){return e>0?Be(e):"$0.00"}const ane=new Set(["idle","checking","current","downloading","ready","error"]);function lA(e){if(!e||typeof e!="object")return null;const t=e;if(typeof t.status!="string"||!ane.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 one(e){return(e==null?void 0:e.status)==="ready"&&e.version?{version:e.version}:null}function ine(e=typeof navigator>"u"?"":navigator.userAgent){var t;return((t=/\bccdeck-desktop\/(\d[^\s]*)/.exec(e))==null?void 0:t[1])??null}const Sd="Restart to update",DO=3e4;function lne(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 cne(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 ${Sd} comes first`}}function une(e){const t=e==null?void 0:e.reason;return t==="app_disconnected"||t==="update_not_ready"?t:"refused"}function dne(e,t,n=typeof navigator>"u"?"":navigator.userAgent){const r=lne(n),s=`Use ${Sd} 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, ${Sd} is in ${r}.`;case"timeout":return`ccdeck has not restarted after ${DO/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 hne="Update checks are off (AGENTS_DECK_NO_UPDATE_CHECK=1)",zv="click for what's new";function fne(e){if(e.checkDisabled)return`${hne} · ${zv}`;if(e.checking)return`Asking npm for the newest release… · ${zv}`;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 · ${zv}, and to check npm now`}function pne(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 mne(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 FO(e){return e?`${e.kind}:${e.to}`:""}function gne(e,t){return e!=null&&t!==FO(e)}function yne({readyAppUpdate:e,notice:t,noticeOpen:n,version:r,chipVersion:s,versionChecking:o,now:l,openReleaseNotes:u,showNotice:d,loadVersion:h}){return a.jsx(a.Fragment,{children:e?(()=>{const f=cne(ine()??s,e.version);return a.jsxs("button",{type:"button",className:"v ready",onClick:u,"aria-haspopup":"dialog","aria-label":f.label,title:f.title,children:[f.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":mne({...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 f={running:s,latest:r==null?void 0:r.latest,latestPending:r==null?void 0:r.latestPending,checkedAgo:r!=null&&r.checkedAt?cd(l-r.checkedAt):null,checkFailedAgo:r!=null&&r.checkFailedAt&&r.checkFailedAt>(r.checkedAt??0)?cd(l-r.checkFailedAt):null,checkDisabled:r==null?void 0:r.checkDisabled,checking:o};return a.jsxs("button",{type:"button",className:o?"v checking":"v",onClick:()=>{u(),h(!0)},"aria-busy":o||void 0,"aria-haspopup":"dialog","aria-label":pne(f),title:fne(f),children:["v",f.running]})})()})}function wne({live:e,paused:t,pauseGate:n,monthUsageRef:r,monthlyUsage:s,monthlyUsageUnavailable:o}){return a.jsxs("span",{className:"status",children:[(()=>{const l=nU({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 · ${iA(s.cost)} spent since the 1st of this local calendar month`:o?"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:ot(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:iA(s.cost)})]}):a.jsx("span",{className:"month-usage-pending",children:o?"unavailable":"…"})]})]})}function vne({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:
|
|
95
|
+
${e.map(s=>` ${s.label}: ${ri(s.waiting)} (${cd(r-s.waiting.since)})`).join(`
|
|
96
|
+
`)}`,"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 Xx={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 xne(e){return e==="on"?`Notifications on. ${Xx.on}.`:e==="blocked"?`${Xx.blocked}.`:""}function bne({notifySaid:e}){return a.jsx("span",{className:e==="on"?"notify-said":"notify-said notify-said-blocked","aria-hidden":!0,title:Xx[e],children:e==="on"?"notifications on":"notifications blocked"})}function kne({versionCheck:e,welcome:t,desktopUpdate:n,pause:r,monthly:s,announcements:o,notify:l,waitingSessions:u,waitingCursorRef:d,focusSession:h,live:f,now:p,incidents:g}){const{version:v,notice:k,noticeOpen:b,showNotice:x,versionChecking:N,loadVersion:S}=e,{chipVersion:_,openReleaseNotes:E}=t,{readyAppUpdate:T}=n,{paused:R,pauseGate:A}=r,{monthlyUsage:q,monthlyUsageUnavailable:L,monthUsageRef:P}=s,{blockedSaid:I,watchSaid:O,incidentSaid:U}=o,{notifySaid:M}=l;return a.jsxs("div",{className:"readout",children:[a.jsxs("div",{className:"brand",children:[a.jsx("span",{className:"logo"}),a.jsx("h1",{children:bt}),a.jsx(yne,{readyAppUpdate:T,notice:k,noticeOpen:b,version:v,chipVersion:_,versionChecking:N,now:p,openReleaseNotes:E,showNotice:x,loadVersion:S})]}),a.jsx(wne,{live:f,paused:R,pauseGate:A,monthUsageRef:P,monthlyUsage:q,monthlyUsageUnavailable:L}),a.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:I}),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:U}),a.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:xne(M)}),a.jsx(wW,{incidents:g}),u.length>0&&a.jsx(vne,{waitingSessions:u,waitingCursorRef:d,focusSession:h,now:p}),M&&a.jsx(bne,{notifySaid:M})]})}function Nne({selected:e,now:t,selectedIds:n,focusAgent:r,clearSelection:s}){const o=hn(e),l=Math.max(0,((e.endedAt??t)-e.startedAt)/1e3),u=e.state==="active"?_b(o.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)${o.total>0?`
|
|
97
|
+
${Be(o.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}),o.total>0&&a.jsxs("span",{className:"selected-cost",children:[Be(o.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:h=>{h.stopPropagation(),s()},children:"×"})]})}function jne({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(o=>{const l=r.has(o);return a.jsxs("button",{type:"button",className:`cat-filter${l?" off":""}`,onClick:()=>s(o),"aria-pressed":!l,title:`${l?"Show":"Hide"} ${jd[o]} tools`,children:[a.jsx(vte,{cat:o}),a.jsx("span",{className:"cat-name",children:jd[o]})]},o)})})}const Sne=["a[href]","button:not(:disabled)","input:not(:disabled)","select:not(:disabled)","textarea:not(:disabled)","summary","[tabindex]"].join(",");function _ne(e){var n,r;const t=e.target;!(t!=null&&t.closest)||t.closest(Sne)!==e.currentTarget||(e.preventDefault(),(r=(n=document.activeElement)==null?void 0:n.blur)==null||r.call(n))}function Ene({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 Cne({canvasRef:e,bubbling:t,dragging:n,trash:r,zoom:s,viewport:o,stateRef:l,peek:u,children:d}){const{trashDragging:h,trashState:f,trashPhase:p,trashZoneRef:g,trashLabel:v}=r,{lod:k,lodRef:b}=s,{markCanvasInput:x}=o,{peekAgent:N,peekLabel:S,peekRecap:_,peekBounds:E}=u;return a.jsxs("main",{id:"canvas",tabIndex:-1,className:`canvas-wrap${t?" bubbling":""}${n?" dragging-any":""}${h&&f==="over"?" trash-hover":""}`,"data-lod":k,ref:e,onMouseDownCapture:_ne,onPointerDownCapture:x,onPointerUpCapture:x,onWheelCapture:x,onFocusCapture:T=>{const R=T.target;if(!x0(R)||b.current==null||b.current==="detail")return;const A=R.getAttribute("data-id");A&&l.current.agents.has(A)&&R.matches(":focus-visible")&&SO(A,R,"focus")},onBlurCapture:T=>{var A,q;const R=(q=(A=T.target).getAttribute)==null?void 0:q.call(A,"data-id");R&&Zs(R)},children:[d,qu(p)&&a.jsx(Ene,{trashZoneRef:g,trashState:f,trashPhase:p,trashLabel:v}),a.jsx(eee,{agentFor:N,recapFor:_,labelFor:S,bounds:E})]})}function Tne({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 ${bt}…`:(()=>{const s=eU({connected:n,paused:r});return a.jsxs(a.Fragment,{children:[`Lost connection to the ${bt} server. Reconnecting…`,s&&a.jsx("span",{className:"conn-sub",children:s})]})})()]})}function Rne({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 ",bt," 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 Ane=3e4;function Mne({bundle:e,running:t,lastTried:n}){return!t||e===t?!1:n!==t}function $ne({bundle:e,running:t,pending:n,lastTried:r}){return t?Mne({bundle:e,running:t,lastTried:r})?"reload":n==null||n&&n!==t?"wait":"confirm":"wait"}function Ine(e){return!e||e.state!=="failed"?null:`${typeof e.at=="number"?e.at:0}:${e.error??""}`}function One({asked:e,reported:t}){return t?t!==e:!1}function qO(e){const t=e.thresholdMs??Ane;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 Lne(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 Pne(e,t){return e?t==null?"auto when idle":`auto in ${Lne(t)}`:"auto-restart off"}function cA(e){let t=0;for(const n of e)n.state==="active"&&t++;return t}function Dne(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 Fne(e){const t=qO(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 uA={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 qne({notice:e,version:t,dismissNotice:n,upgradeState:r,startUpgrade:s,copyCommand:o,cmdCopied:l,autoRestart:u,toggleAutoRestart:d,askRestart:h,restartCopy:f,restartFuseMs:p,restarting:g}){var v,k,b;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:()=>h(),...Ir(g),title:`Stop this process and bring it back on the same port. The canvas replays from the event log.
|
|
98
|
+
|
|
99
|
+
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…":f.label}),!g&&a.jsx("span",{className:"ver-sub",children:f.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:Pne(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:[bt," 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,...Ir(r==="running",r==="done"),title:`Runs ${((v=t==null?void 0:t.upgrade)==null?void 0:v.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:()=>h({upgrade:!0}),...Ir(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",": ",((b=t==null?void 0:t.upgrade)==null?void 0:b.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:":uA.npx}):t!=null&&t.upgradeBlocked?a.jsx("span",{className:"ver-sub",children:$t(uA,t.upgradeBlocked)??"cannot install from here"}):null,a.jsxs("button",{type:"button",className:"ver-cmd",onClick:o,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 Bne({restart:e,versionCheck:t,upgrade:n,oldNameNotice:r,everConnected:s,live:o,paused:l}){const{autoRestart:u,toggleAutoRestart:d,restarting:h,restartMode:f,restartedTo:p,askRestart:g,restartCopy:v,restartFuseMs:k}=e,{version:b,notice:x,noticeOpen:N,dismissNotice:S}=t,{upgradeState:_,startUpgrade:E,copyCommand:T,cmdCopied:R}=n,{oldName:A,oldNameOpen:q,dismissOldName:L}=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&&!o?a.jsx(Tne,{restarting:h,restartMode:f,live:o,paused:l}):N&&x?a.jsx(qne,{notice:x,version:b,dismissNotice:S,upgradeState:_,startUpgrade:E,copyCommand:T,cmdCopied:R,autoRestart:u,toggleAutoRestart:d,askRestart:g,restartCopy:v,restartFuseMs:k,restarting:h}):q&&A?a.jsx(Rne,{oldName:A,version:b,dismissOldName:L}):null}function Une(e,t){return e==="confirmation"?t.confirmOpen?"clear":"ignore":t.modalOpen||t.confirmOpen?"ignore":"confirm"}function zne(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 Wne(e){return e<=0?null:e===1?"the one agent":`all ${e} agents`}function Hne(e,t){const n=Wne(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 o=t.decks-1;return{goes:r(`the event log ${o===1?"1 other running deck shares":`${o} other running decks share`} with this one — every session recorded in it, not just the ones drawn here`),stays:[o===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 Vne({agentCount:e,onConfirm:t,onCancel:n}){const r=w.useRef(null),s=yt(n,{focusRef:r,layer:R8}),[o,l]=w.useState(null);w.useEffect(()=>{let p=!1;return fetch("/api/clear").then(g=>g.ok?g.json():null).then(g=>{p||l(zne(g))}).catch(()=>{}),()=>{p=!0}},[]);const{goes:u,stays:d,final:h,confirm:f}=Hne(e,o);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"})})]}),h&&a.jsx("p",{className:"cc-final",children:h}),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:f})]})]})]})})}const Zx=[{value:"bug",label:"Something is wrong",hint:"A crash, or something that misbehaves",titlePlaceholder:"A line that names the problem…",bodyLabel:"What went wrong",bodyPlaceholder:"What you did, what you expected, and what happened instead…",bodyMissing:"Say what went wrong."},{value:"idea",label:"An idea",hint:"Something ccdeck could do, or do better",titlePlaceholder:"A line that names the idea…",bodyLabel:"What you would like",bodyPlaceholder:"What it would let you do, and when you would reach for it…",bodyMissing:"Say what you would like."},{value:"other",label:"Something else",hint:"A question, or anything at all",titlePlaceholder:"A line that sums it up…",bodyLabel:"What is on your mind",bodyPlaceholder:"Anything the people who make ccdeck should know…",bodyMissing:"Say what is on your mind."}];function Gne(e){return Zx.find(t=>t.value===e)??Zx[0]}const Kne=3,Yne=120,Xne=1e4,Zne=200,Jne="Give it a title of three characters or more.";function Qne(e,t){const n=[];return e.trim().length<Kne&&n.push("title"),t.trim().length===0&&n.push("body"),n}function ere(e){return e.key==="Enter"&&(e.metaKey||e.ctrlKey)&&!e.altKey&&!e.shiftKey&&!e.isComposing}function tre(e){return e.key==="Enter"&&!e.metaKey&&!e.ctrlKey&&!e.altKey&&!e.shiftKey&&!e.isComposing}function nre(e){return/mac|iphone|ipad/i.test(e)?["⌘","Enter"]:["Ctrl","Enter"]}function rre(e){return[...e].length===1}function sre(){var t;return typeof navigator>"u"?"":((t=navigator.userAgentData)==null?void 0:t.platform)||navigator.platform||""}function dA(e,t){return t==="vetoed"?"This deck was started with AGENTS_DECK_NO_INSTALL=1, which keeps it off the network, so nothing was sent.":e===429||t==="too_many"?"Too much feedback from this network in the last hour. Try again later; your text is still here.":e===400?"The server did not accept this. Check that the title and the text are filled in.":"ccdeck's server could not be reached. Nothing was sent; your text is still here, so try again in a moment."}function are(e){return e==="sending"?"Sending…":e==="sent"?"Sent. It reached the people who make ccdeck.":""}function hA({kind:e}){return a.jsx("svg",{className:"fb-glyph",width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,focusable:"false",children:e==="idea"?a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M7 1.8a3.6 3.6 0 0 0-2.2 6.45c.35.28.5.62.5 1.05v.3h3.4v-.3c0-.43.15-.77.5-1.05A3.6 3.6 0 0 0 7 1.8Z"}),a.jsx("path",{d:"M5.6 11.9h2.8"})]}):a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M2.2 3.3h9.6v5.3H6.1L3.5 10.8V8.6H2.2Z"}),e==="bug"?a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M7 4.9v1.7"}),a.jsx("path",{d:"M7 7.7v.05"})]}):a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M4.9 5.95h.05"}),a.jsx("path",{d:"M7 5.95h.05"}),a.jsx("path",{d:"M9.1 5.95h.05"})]})]})})}function BO({onClose:e,initialKind:t,initialBody:n}){const r=w.useRef(null),s=w.useRef(null),o=w.useRef(null),l=w.useRef(!1),u=yt(e,{focusRef:r}),[d,h]=w.useState(t??"bug"),[f,p]=w.useState(""),[g,v]=w.useState(n??""),[k,b]=w.useState(""),[x,N]=w.useState({state:"idle"}),[S,_]=w.useState(!1),E=ql(x.state==="sent",o),T=Gne(d),R=Qne(f,g),A=S&&R.includes("title"),q=S&&R.includes("body"),L=x.state==="sending",[P,I]=nre(sre());async function O(U){var M;if(U.preventDefault(),!!or(l.current)){if(R.length>0){_(!0),(M=(R[0]==="title"?r:s).current)==null||M.focus();return}E(),l.current=!0,N({state:"sending"});try{const $=await fetch("/api/feedback",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({kind:d,title:f.trim(),body:g.trim(),contact:k.trim()||void 0})}),B=await $.json().catch(()=>null);N($.ok&&(B!=null&&B.ok)?{state:"sent"}:{state:"failed",message:dA($.status,B==null?void 0:B.reason)})}catch{N({state:"failed",message:dA(0,null)})}finally{l.current=!1}}}return a.jsx("div",{className:"modal-backdrop",onClick:e,role:"presentation",children:a.jsxs("div",{ref:u,className:"modal feedback-dialog",onClick:U=>U.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"feedback-title",children:[a.jsxs("header",{className:"modal-head",children:[a.jsx("div",{className:"modal-title",children:a.jsx("span",{id:"feedback-title",className:"modal-tool-name",children:"Send feedback"})}),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.jsx("p",{className:"vis-hidden",role:"status",children:are(x.state)}),x.state==="sent"?a.jsx("section",{className:"modal-body",children:a.jsxs("div",{className:"fb-done",children:[a.jsx(fd,{}),a.jsx("p",{className:"fb-done-title",children:"Thank you"}),a.jsx("p",{className:"fb-done-note",children:"It reached the people who make ccdeck."}),a.jsxs("p",{className:"fb-receipt",children:[a.jsx(hA,{kind:d}),a.jsx("span",{children:f.trim()})]}),a.jsx("button",{ref:o,type:"button",className:"btn primary",onClick:e,children:"Close"})]})}):a.jsxs("form",{className:"fb-form",onSubmit:O,onKeyDown:U=>{ere(U.nativeEvent)&&(U.preventDefault(),U.currentTarget.requestSubmit())},noValidate:!0,children:[a.jsxs("section",{className:"modal-body",children:[a.jsxs("fieldset",{className:"fb-kinds",children:[a.jsx("legend",{className:"vis-hidden",children:"What is it about"}),Zx.map(U=>a.jsxs("label",{className:"fb-kind",children:[a.jsx("input",{type:"radio",name:"feedback-kind",value:U.value,checked:d===U.value,onChange:()=>h(U.value),"aria-labelledby":`fb-kind-name-${U.value}`,"aria-describedby":`fb-kind-hint-${U.value}`}),a.jsx(hA,{kind:U.value}),a.jsx("svg",{className:"fb-kind-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"})}),a.jsx("span",{id:`fb-kind-name-${U.value}`,className:"fb-kind-name",children:U.label}),a.jsx("span",{id:`fb-kind-hint-${U.value}`,className:"fb-kind-hint",children:U.hint})]},U.value))]}),a.jsxs("div",{className:"fb-fields",children:[a.jsxs("div",{className:"fb-field",children:[a.jsx("label",{className:"fb-label",htmlFor:"fb-title",children:"Title"}),a.jsx("input",{ref:r,id:"fb-title",className:"ap-manage-input",type:"text",value:f,maxLength:Yne,placeholder:T.titlePlaceholder,onChange:U=>p(U.target.value),onKeyDown:U=>{var M;tre(U.nativeEvent)&&(U.preventDefault(),(M=s.current)==null||M.focus())},"aria-invalid":A||void 0,"aria-describedby":A?"fb-title-error":void 0,required:!0}),A&&a.jsx("p",{id:"fb-title-error",className:"fb-error",children:Jne})]}),a.jsxs("div",{className:"fb-field",children:[a.jsx("label",{className:"fb-label",htmlFor:"fb-body",children:T.bodyLabel}),a.jsx("textarea",{ref:s,id:"fb-body",className:"ap-manage-input",value:g,maxLength:Xne,rows:6,placeholder:T.bodyPlaceholder,onChange:U=>v(U.target.value),"aria-invalid":q||void 0,"aria-describedby":q?"fb-body-error":void 0,required:!0}),q&&a.jsx("p",{id:"fb-body-error",className:"fb-error",children:T.bodyMissing})]}),a.jsxs("div",{className:"fb-field",children:[a.jsxs("label",{className:"fb-label",htmlFor:"fb-contact",children:["How to reach you, if you want an answer",a.jsx("span",{className:"fb-optional",children:"optional"})]}),a.jsx("input",{id:"fb-contact",className:"ap-manage-input",type:"text",value:k,maxLength:Zne,autoComplete:"email",placeholder:"An email address, or your GitHub @name…",onChange:U=>b(U.target.value)})]})]}),a.jsxs("div",{className:"fb-note",children:[a.jsxs("svg",{className:"fb-glyph",width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,focusable:"false",children:[a.jsx("path",{d:"M1.4 7S3.4 3.4 7 3.4 12.6 7 12.6 7 10.6 10.6 7 10.6 1.4 7 1.4 7Z"}),a.jsx("circle",{cx:"7",cy:"7",r:"1.7"})]}),a.jsx("p",{children:"This goes to the people who make ccdeck, with your ccdeck version and system. They may open a public GitHub issue from it; how to reach you is never put there."})]}),x.state==="failed"&&a.jsx("p",{className:"fb-error",role:"alert",children:x.message})]}),a.jsxs("div",{className:"fb-foot",children:[a.jsxs("span",{className:"fb-shortcut","aria-hidden":"true",children:[a.jsx("kbd",{"data-symbol":rre(P)||void 0,children:P}),a.jsx("kbd",{children:I})," to send"]}),a.jsx("button",{type:"button",className:"btn",onClick:e,children:"Cancel"}),a.jsx("button",{type:"submit",className:"btn primary fb-send","aria-keyshortcuts":"Meta+Enter Control+Enter",...Ir(L),children:L?"Sending…":"Send"})]})]})]})})}const ore="Press Esc first if a key does nothing.",ire=[{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 lre({onClose:e,onTour:t}){const n=yt(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:ire.map(r=>a.jsxs(w.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:ore})]})]})})}function cre(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,o)=>(s.at??0)-(o.at??0));return{request:r[0],waiting:r.length-1}}function ure({request:e,waiting:t,busy:n,now:r,onAccept:s,onDecline:o,onLater:l}){const u=w.useRef(null),d=yt(l,{focusRef:u}),h=Xs(n,"accept"),f=Xs(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 ",Kb(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:f.disabled,"aria-busy":f.busy,onClick:o,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:h.disabled,"aria-busy":h.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 dre({lanPending:e,lanDeferred:t,lanBusy:n,answerLanPair:r,deferLanPair:s}){const{request:o,waiting:l}=cre(e,t.current);return o?a.jsx(ure,{request:o,waiting:l,busy:n,now:Date.now(),onAccept:()=>void r("accept",o.fp),onDecline:()=>void r("dismiss",o.fp),onLater:()=>s(o.fp)},o.fp):null}const hre={"//":["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.35.0","3.35.1","3.36.0"],"3.34.1":[{title:"🗂️ The tray menu stays open while you read it",body:"On Linux the menu behind the tray icon could close by itself while agents were working, often before the row you pressed took the click, so it had to be opened and pressed again. It now changes only when something it says has changed, and stays open while you choose."}],"3.34.0":[{title:"🗺️ The network map shows who you are connected to",body:"Paired decks that are on stand closest to this one, and a light runs along their wires. Paired decks that are away come next, in a colour of their own, with how long they have been gone, and machines that are not paired stand outside in grey. Decks reached over Tailscale sit together in their own shaded slice instead of on dashed wires. Pointing at a deck opens its details beside the map: whether it is there, what to do next if anything, its address and what it runs, and every login the two share, the ones that need a look first."},{title:"🔑 A login that expired everywhere says so",body:`When a shared login expired on this deck and every paired deck that is on held an expired copy too, the row said "Login expired" and waited for a repair that could never come. It now says "Login expired on all online decks". Claude retires a login's other copies each time one machine refreshes it, so shared copies expire together: sign in again on any one machine and the others repair from it on their next round.`},{title:"💬 Send feedback from inside the deck",body:'Appearance settings has a "Send feedback…" button: pick what kind it is, write a title and a few lines, and add a way to reach you if you want an answer. It goes to the people who make ccdeck, who may open a public issue from it, never with your contact in it. If it cannot be sent, the form stays filled in and says why.'}],"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.
|
|
100
|
+
|
|
101
|
+
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.
|
|
102
|
+
|
|
103
|
+
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.
|
|
104
|
+
|
|
105
|
+
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.
|
|
106
|
+
|
|
107
|
+
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.
|
|
108
|
+
|
|
109
|
+
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".
|
|
110
|
+
|
|
111
|
+
**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.
|
|
112
|
+
|
|
113
|
+
\`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.
|
|
114
|
+
|
|
115
|
+
**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.
|
|
116
|
+
|
|
117
|
+
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.
|
|
118
|
+
|
|
119
|
+
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.
|
|
120
|
+
|
|
121
|
+
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.
|
|
122
|
+
|
|
123
|
+
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.
|
|
124
|
+
|
|
125
|
+
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.
|
|
126
|
+
|
|
127
|
+
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.
|
|
128
|
+
|
|
129
|
+
What you are reading is the first version that does not.
|
|
130
|
+
|
|
131
|
+
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.
|
|
132
|
+
|
|
133
|
+
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.
|
|
134
|
+
|
|
135
|
+
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.
|
|
136
|
+
|
|
137
|
+
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.
|
|
138
|
+
|
|
139
|
+
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.
|
|
140
|
+
|
|
141
|
+
The count of what is behind it is on the heading's tooltip, so collapsing it does not hide how much there is.
|
|
142
|
+
|
|
143
|
+
**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.
|
|
144
|
+
|
|
145
|
+
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.
|
|
146
|
+
|
|
147
|
+
\`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.
|
|
148
|
+
|
|
149
|
+
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.
|
|
150
|
+
|
|
151
|
+
**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.
|
|
152
|
+
|
|
153
|
+
**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.
|
|
154
|
+
|
|
155
|
+
**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.
|
|
156
|
+
|
|
157
|
+
**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.
|
|
158
|
+
|
|
159
|
+
**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.
|
|
160
|
+
|
|
161
|
+
**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.
|
|
162
|
+
|
|
163
|
+
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.
|
|
164
|
+
|
|
165
|
+
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.
|
|
166
|
+
|
|
167
|
+
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.
|
|
168
|
+
|
|
169
|
+
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.
|
|
170
|
+
|
|
171
|
+
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.
|
|
172
|
+
|
|
173
|
+
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.
|
|
174
|
+
|
|
175
|
+
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.
|
|
176
|
+
|
|
177
|
+
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.
|
|
178
|
+
|
|
179
|
+
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.
|
|
180
|
+
|
|
181
|
+
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.
|
|
182
|
+
|
|
183
|
+
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.
|
|
184
|
+
|
|
185
|
+
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.
|
|
186
|
+
|
|
187
|
+
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.
|
|
188
|
+
|
|
189
|
+
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.
|
|
190
|
+
|
|
191
|
+
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.
|
|
192
|
+
|
|
193
|
+
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.
|
|
194
|
+
|
|
195
|
+
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.
|
|
196
|
+
|
|
197
|
+
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.
|
|
198
|
+
|
|
199
|
+
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.
|
|
200
|
+
|
|
201
|
+
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.
|
|
202
|
+
|
|
203
|
+
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.
|
|
204
|
+
|
|
205
|
+
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.
|
|
206
|
+
|
|
207
|
+
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.
|
|
208
|
+
|
|
209
|
+
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.
|
|
210
|
+
|
|
211
|
+
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.
|
|
212
|
+
|
|
213
|
+
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.
|
|
214
|
+
|
|
215
|
+
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.
|
|
216
|
+
|
|
217
|
+
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.
|
|
218
|
+
|
|
219
|
+
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.
|
|
220
|
+
|
|
221
|
+
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.
|
|
222
|
+
|
|
223
|
+
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.
|
|
224
|
+
|
|
225
|
+
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.
|
|
226
|
+
|
|
227
|
+
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.
|
|
228
|
+
|
|
229
|
+
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.
|
|
230
|
+
|
|
231
|
+
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.
|
|
232
|
+
|
|
233
|
+
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.
|
|
234
|
+
|
|
235
|
+
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.
|
|
236
|
+
|
|
237
|
+
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.
|
|
238
|
+
|
|
239
|
+
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.
|
|
240
|
+
|
|
241
|
+
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".
|
|
242
|
+
|
|
243
|
+
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.
|
|
244
|
+
|
|
245
|
+
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.
|
|
246
|
+
|
|
247
|
+
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.
|
|
248
|
+
|
|
249
|
+
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.
|
|
250
|
+
|
|
251
|
+
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.
|
|
252
|
+
|
|
253
|
+
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.
|
|
254
|
+
|
|
255
|
+
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.
|
|
256
|
+
|
|
257
|
+
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.
|
|
258
|
+
|
|
259
|
+
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.
|
|
260
|
+
|
|
261
|
+
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.
|
|
262
|
+
|
|
263
|
+
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.
|
|
264
|
+
|
|
265
|
+
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.
|
|
266
|
+
|
|
267
|
+
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.
|
|
268
|
+
|
|
269
|
+
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.
|
|
270
|
+
|
|
271
|
+
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.
|
|
272
|
+
|
|
273
|
+
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.
|
|
274
|
+
|
|
275
|
+
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.
|
|
276
|
+
|
|
277
|
+
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.
|
|
278
|
+
|
|
279
|
+
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.
|
|
280
|
+
|
|
281
|
+
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.
|
|
282
|
+
|
|
283
|
+
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.
|
|
284
|
+
|
|
285
|
+
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.
|
|
286
|
+
|
|
287
|
+
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.
|
|
288
|
+
|
|
289
|
+
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.
|
|
290
|
+
|
|
291
|
+
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.`}]},_0="agent-dag.releaseNotesSeen";function fA(e){return e.split(/[.\-+]/).map(t=>parseInt(t,10)).map(t=>Number.isNaN(t)?0:t)}function ci(e,t){const n=fA(e),r=fA(t);for(let s=0;s<Math.max(n.length,r.length);s++){const o=(n[s]??0)-(r[s]??0);if(o!==0)return o<0?-1:1}return 0}function ui(e){return typeof e=="string"&&/^\d+\.\d+\.\d+/.test(e)}function fre(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 pre(e){if(!e||typeof e!="object")return[];const t=[];for(const[n,r]of Object.entries(e)){if(!ui(n)||!Array.isArray(r))continue;const s=r.filter(fre);s.length&&t.push({version:n,notes:s})}return t.sort((n,r)=>ci(r.version,n.version))}const pA=pre(hre);function UO(e,t,n){return e.filter(r=>ci(r.version,n)<=0&&(t===null||ci(r.version,t)>0))}function mre(e,t){return e.filter(n=>ci(n.version,t)===0)}function gre(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 yre({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&&ui(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(!ui(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 o=ci(s,t);return o<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.`:o>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 wre=new RegExp("^(?:\\p{Extended_Pictographic}|\\p{Emoji_Modifier}|\\p{Regional_Indicator}|[\\u200D\\uFE0F])+(?= \\S)","u");function vre(e){const t=wre.exec(e);return t?{icon:t[0],rest:e.slice(t[0].length)}:{icon:null,rest:e}}function xre(e){if(!e)return null;let t=null;try{t=e.getItem(_0)}catch{return null}return ui(t)?t:null}function bre(e){if(!e)return!1;try{return e.getItem(_0),!0}catch{return!1}}function kre(e,t){if(!e)return!1;try{return e.setItem(_0,t),!0}catch{return!1}}const zO="agent-dag.tourSeen";function Nre(e){if(!e)return!1;try{return e.getItem(zO)==="1"}catch{return!1}}function jre(e){if(!e)return!1;try{return e.setItem(zO,"1"),!0}catch{return!1}}function Sre({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 _re({stored:e,running:t,notes:n,remembers:r=!0}){if(!ui(t))return{show:[],record:null,reason:"no-version"};if(!ui(e)){if(!r)return{show:[],record:t,reason:"cannot-remember"};const l=mre(n,t);return l.length?{show:l,record:t,reason:"welcome"}:{show:[],record:t,reason:"first-run"}}const s=ci(e,t);if(s===0)return{show:[],record:null,reason:"seen"};if(s>0)return{show:[],record:null,reason:"ahead"};const o=UO(n,e,t);return o.length?{show:o,record:t,reason:"new-notes"}:{show:[],record:t,reason:"nothing-new"}}function Ere(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 WO(e,t=!0){const n=[];let r="";const s=()=>{r&&(n.push({kind:"text",text:r}),r="")};let o=0;for(;o<e.length;){if(e[o]==="`"){const l=e.indexOf("`",o+1);if(l>o+1){s(),n.push({kind:"code",text:e.slice(o+1,l)}),o=l+1;continue}}else if(t&&e.startsWith("**",o)){const l=Ere(e,o);if(l>0){s(),n.push({kind:"bold",kids:WO(e.slice(o+2,l),!1)}),o=l+2;continue}}r+=e[o],o+=1}return s(),n}function Cre({entries:e,since:t,running:n,firstRun:r,onClose:s,onTour:o,updateVersion:l,updateBusy:u,onUpdateRestart:d,updateFailure:h,onRestart:f}){const p=yt(s),g=gre(e);return a.jsx("div",{className:"modal-backdrop",onClick:s,role:"presentation",children:a.jsxs("div",{ref:p,className:"modal release-notes",onClick:v=>v.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||h)&&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…":Sd})]}),a.jsx("p",{className:"rn-update-said",role:"status",children:h})]}),a.jsx("p",{className:"modal-note",children:yre({since:t,running:n,firstRun:r,entries:e})}),o&&!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:o,children:"Take the tour"})]}),f&&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:f,children:"Restart"})]}),e.map(v=>a.jsxs("section",{className:"modal-section",children:[a.jsxs("h3",{className:"rn-version",children:["v",v.version]}),a.jsx("ul",{className:"rn-notes",children:v.notes.map((k,b)=>{const{icon:x,rest:N}=vre(k.title);return a.jsxs("li",{className:"rn-note",children:[a.jsxs("p",{className:"rn-note-title",children:[x&&a.jsx("span",{className:"rn-note-icon",children:x}),N]}),a.jsx("p",{className:"rn-note-body",children:HO(WO(k.body))})]},b)})})]},v.version))]})]})})}function HO(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:HO(t.kids)},n))}function Tre({state:e,sessionId:t,onClose:n}){const r=w.useMemo(()=>Rre(e,t),[e,t]),s=w.useRef(null),o=yt(n,{focusRef:s});return r?a.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:a.jsxs("div",{ref:o,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:ZM}),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":$d(l),title:l,children:Ys(l)},l))})]}),a.jsx("div",{className:"ss-hero-right",children:r.cost.total>0&&a.jsxs(a.Fragment,{children:[a.jsx(Lb,{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(qo,{label:"agents",value:r.agentCount}),a.jsx(qo,{label:"subagents",value:r.subagentCount}),a.jsx(qo,{label:"tool calls",value:r.toolCount}),a.jsx(qo,{label:"prompts",value:r.promptCount}),a.jsx(qo,{label:"tokens",value:r.tokensSum.toLocaleString()}),r.errCount>0&&a.jsx(qo,{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 qo({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 Rre(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},o=new Set,l=new Map;let u=0,d=0,h=0,f=0,p=0,g,v=1/0,k=0;for(const _ of r){const E=hn(_);s.input+=E.input,s.output+=E.output,s.cacheRead+=E.cacheRead,s.cacheWrite+=E.cacheWrite,s.total+=E.total;for(const R of vM(_))o.add(R);_.model&&o.add(_.model),_.kind==="subagent"&&p++;const T=iM(_.prompts);d+=T.length,!g&&T.length>0&&(g=T[0].text),h+=_.usage.inputTokens+_.usage.outputTokens,u+=_.toolCount,f+=_.toolErrorCount??0;for(const[R,A]of _.toolCountByName??[])l.set(R,(l.get(R)??0)+A);v=Math.min(v,_.startedAt),k=Math.max(k,_.endedAt??Date.now())}const b=Math.max(0,k-v),x=Math.floor(b/1e3),N=x<60?`${x}s`:x<3600?`${Math.floor(x/60)}m ${String(x%60).padStart(2,"0")}s`:`${Math.floor(x/3600)}h ${Math.floor(x%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:N,cost:s,modelChips:Array.from(o),agentCount:r.length,subagentCount:p,toolCount:u,promptCount:d,tokensSum:h,errCount:f,topTools:S,firstPrompt:g}}const Are=60,Mre=6e3,Lr=e=>e!=null&&typeof e=="object"&&!Array.isArray(e),wn=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((o,l)=>[String(l),o]):Object.entries(e);if(r.length===0)return n?"[]":"{}";const s=[];for(const[o,l]of r){const u=n?`${t}-`:`${t}${o}:`;if(typeof l=="string"&&l.includes(`
|
|
292
|
+
`)){s.push(u);for(const d of l.split(`
|
|
293
|
+
`))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(`
|
|
294
|
+
`)}function $re(e){return e.lines??e.text.split(`
|
|
295
|
+
`).map(t=>({text:t}))}function VO(e,t){if(t)return{shown:e,cut:!1};const n=[];let r=0;for(const s of e){if(n.length===Are)return{shown:n,cut:!0};const o=Mre-r;if(s.text.length>o)return n.push({...s,text:`${s.text.slice(0,Math.max(o,0))}…`}),{shown:n,cut:!0};n.push(s),r+=s.text.length+1}return{shown:n,cut:!1}}function Ire(e,t){return VO(e,!1).cut?t?{label:"show less",expanded:!0}:{label:"show all",expanded:!1}:null}const Xt=(e,t,n=!1)=>({...e?{label:e}:{},text:t,...n?{err:!0}:{}}),vn=(e,t)=>({label:e,text:t,inline:!0}),GO=(e,t)=>({label:e,text:t.map(n=>n.text).join(`
|
|
296
|
+
`),lines:t});function Ore(e,t){return[...e.split(`
|
|
297
|
+
`).map(n=>({text:`- ${n}`,tone:"del"})),...t.split(`
|
|
298
|
+
`).map(n=>({text:`+ ${n}`,tone:"add"}))]}function Lre(e){if(!Array.isArray(e)||e.length===0)return null;const t=[];for(const n of e){if(!Lr(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 mA(e){if(typeof e=="string")return[Xt(void 0,e)];if(!Lr(e))return[Xt(void 0,Fa(e))];const t=[],n=wn(e.type);n==="create"&&t.push(vn("result","created the file"));const r=Lre(e.structuredPatch);return r&&t.push(GO("applied",r)),e.userModified===!0&&t.push(vn("note","the user changed it before it was applied")),t.length?t:[vn("result",n==="update"?"updated the file":"done")]}function Pre(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 Dre(e){if(typeof e=="string")return[Xt(void 0,e)];const t=Lr(e)&&Lr(e.file)?e.file:null,n=wn(t==null?void 0:t.content);if(t&&n!=null){const s=[],o=Number(t.numLines),l=Number(t.totalLines),u=Number(t.startLine);return Number.isFinite(o)&&Number.isFinite(l)&&l>0&&s.push(vn("lines",o>=l?`all ${l}`:Number.isFinite(u)?`${u}–${u+o-1} of ${l}`:`${o} of ${l}`)),s.push(Xt("content",n)),s}const r=Lr(e)?wn(e.type):null;return r&&r!=="text"?[vn("result",`${/^[aeiou]/i.test(r)?"an":"a"} ${r} file`)]:[Xt(void 0,Fa(e))]}function Fre(e){if(typeof e=="string")return[Xt("output",e)];if(!Lr(e))return[Xt(void 0,Fa(e))];const t=wn(e.stdout),n=wn(e.stderr);if(t==null&&n==null)return[Xt(void 0,Fa(e))];const r=[];return t&&r.push(Xt("output",t.replace(/\n$/,""))),n&&r.push(Xt("errors",n.replace(/\n$/,""),!0)),e.interrupted===!0&&r.push(vn("note","interrupted before it finished")),r.length?r:[vn("output","none")]}function qre(e,t,n){const r=Lr(t)?t:null;if(r&&(e==="Edit"||e==="MultiEdit")){const s=wn(r.file_path),o=(e==="MultiEdit"?Array.isArray(r.edits)?r.edits:[]:[r]).filter(Lr).filter(l=>wn(l.old_string)!=null&&wn(l.new_string)!=null);if(s&&o.length){const l=[vn("file",s)];return o.forEach((u,d)=>{const h=u.replace_all===!0?", every occurrence":"";l.push(GO(o.length>1?`change ${d+1}${h}`:`change${h}`,Ore(u.old_string,u.new_string)))}),{input:l,response:mA(n)}}}if(r&&e==="Write"){const s=wn(r.file_path),o=wn(r.content);if(s&&o!=null)return{input:[vn("file",s),Xt("content",o)],response:mA(n)}}if(r&&e==="Read"){const s=wn(r.file_path);if(s){const o=Pre(r);return{input:o?[vn("file",s),vn("lines",o)]:[vn("file",s)],response:Dre(n)}}}if(r&&e==="Bash"){const s=wn(r.command);if(s!=null){const o=wn(r.description);return{input:o?[Xt("command",s),vn("why",o)]:[Xt("command",s)],response:Fre(n)}}}return{input:[Xt(void 0,Fa(t))],response:[Xt(void 0,Fa(n))]}}function gA(e,t,n){if(n==null)return"";if(typeof n=="string")return n;if(Lr(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(`
|
|
299
|
+
`);if(e==="Read"&&t==="response"&&Lr(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 Bre({tool:e,onClose:t}){const n=yt(t),r=e.endedAt==null?"inflight":e.ok===!1?"err":"done",s=e.input??e.inputPreview,o=e.response??e.errorPreview,l=qre(e.name,s,o);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:kM(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(wA,{text:gA(e.name,"input",s),what:"input"})]}),l.input.map((u,d)=>a.jsx(yA,{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(wA,{text:gA(e.name,"response",o),what:"response"})]}),e.endedAt==null?a.jsx("pre",{children:"(waiting…)"}):l.response.map((u,d)=>a.jsx(yA,{block:u},d))]})]})]})})}const Ure={del:"tm-del",add:"tm-add",ctx:"tm-ctx"};function yA({block:e}){const[t,n]=w.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=$re(e),{shown:s}=VO(r,t),o=Ire(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?Ure[l.tone]:void 0,children:[l.text,u<s.length-1?`
|
|
300
|
+
`:""]},u)):s.map(l=>l.text).join(`
|
|
301
|
+
`)}),o&&a.jsx("button",{type:"button",className:"btn tm-more","aria-expanded":o.expanded,onClick:()=>n(l=>!l),children:o.label})]})}function wA({text:e,what:t}){const[n,r]=w.useState(!1),s=w.useRef(!0);return w.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(o=>{!o||!s.current||(r(!0),window.setTimeout(()=>{s.current&&r(!1)},1600))}),children:n?"copied":"copy"})}const zre=w.lazy(()=>Ib(()=>import("./UsageHistoryModal-CAsrCgeA.js"),[])),Wre=w.lazy(()=>Ib(()=>import("./BrowserWatchModal-BnNwmF9s.js"),[]));function Hre({dialogs:e,welcome:t,desktopUpdate:n,versionCheck:r,restart:s,lanPairs:o,clearFlow:l,watchBadge:u,announcements:d,appearance:h,providers:f,stateRef:p,agentCount:g}){const{openedTool:v,setOpenedToolKey:k,usageHistoryOpen:b,setUsageHistoryOpen:x,browserWatchOpen:N,setBrowserWatchOpen:S,contextAgent:_,setContextFor:E,summaryFor:T,setSummaryFor:R,keyHelpOpen:A,setKeyHelpOpen:q,feedbackOpen:L,setFeedbackOpen:P,feedbackPrefill:I,setFeedbackPrefill:O}=e,{tourOpen:U,openTour:M,closeTour:$,releaseNotes:B,closeReleaseNotes:V,chipVersion:H}=t,{desktopUpdateRestarting:F,desktopUpdateFailure:W,readyAppUpdate:D,askDesktopUpdateRestart:Y}=n,{version:J}=r,{askRestart:G}=s,{clearConfirmOpen:K,setClearConfirmOpen:X,requestClear:Z}=l,{setWatchOn:ee,markWatchSeen:se}=u,{setWatchSaid:ue}=d,{palette:ae}=h;return a.jsxs(a.Fragment,{children:[v&&a.jsx(Bre,{tool:v,onClose:()=>k(null)}),b&&a.jsx(w.Suspense,{fallback:null,children:a.jsx(zre,{providers:f,onClose:()=>x(!1)})}),N&&a.jsx(w.Suspense,{fallback:null,children:a.jsx(Wre,{onClose:()=>S(!1),onSeen:re=>{ue(""),se(re)},onWatching:ee,palette:ae})}),_&&a.jsx(Y8,{agent:_,onClose:()=>E(null)}),L&&a.jsx(BO,{initialKind:I==null?void 0:I.initialKind,initialBody:I==null?void 0:I.initialBody,onClose:()=>{P(!1),O(null)}}),T&&a.jsx(Tre,{state:p.current,sessionId:T,onClose:()=>R(null)}),B&&a.jsx(Cre,{entries:B.entries,since:B.since,firstRun:B.firstRun,running:H,onClose:V,onTour:()=>{V(),M()},updateVersion:D==null?void 0:D.version,updateBusy:F,updateFailure:W&&(!D||D.version===W.version)?dne(W.failure,W.version):void 0,onUpdateRestart:D?()=>{Y(D.version)}:void 0,onRestart:!D&&(J!=null&&J.canRestart)?()=>{V(),G()}:void 0}),a.jsx(dre,{...o}),A&&a.jsx(lre,{onClose:()=>q(!1),onTour:()=>{q(!1),M()}}),U&&a.jsx(B$,{title:"What the deck shows you",steps:CV,onClose:$}),K&&a.jsx(Vne,{agentCount:g,onConfirm:()=>Z("confirmation"),onCancel:()=>X(!1)})]})}const Vre=10,KO=500,YO=4e3,Gre=[/ResizeObserver loop/i,/^Script error\.?$/i];function vA(e){return String(e??"").replace(/\/(?:home|Users)\/[^/\s:'"]+/g,"~").replace(/[A-Za-z]:\\(?:Users|Documents and Settings)\\[^\\\r\n:'"]+/gi,"~").replace(/[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/g,"<email>").replace(/\b(?:sk-ant-[A-Za-z0-9_-]{8,}|sk-[A-Za-z0-9_-]{20,}|gh[pousr]_[A-Za-z0-9]{20,}|xox[abpr]-[A-Za-z0-9-]{10,}|eyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}|[A-Fa-f0-9]{40,}|[A-Za-z0-9+_=-]{48,})/g,"<secret>")}const XO=e=>{fetch("/api/client-error",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e),keepalive:!0}).catch(()=>{})};function Kre(e,t,n=XO){const r=String(e??"").slice(0,KO).trim();r&&n({message:r,stack:typeof t=="string"?t.slice(0,YO):void 0})}function Yre(e,t=window,n=XO){let r=0;const s=new Set,o=(d,h)=>{const f=String(d??"").slice(0,KO).trim();!e()||!f||r>=Vre||s.has(f)||Gre.some(p=>p.test(f))||(s.add(f),r++,n({message:f,stack:typeof h=="string"?h.slice(0,YO):void 0}))},l=d=>{var h,f;return o(((h=d.error)==null?void 0:h.message)??d.message,(f=d.error)==null?void 0:f.stack)},u=d=>typeof d.reason=="object"&&d.reason!==null?o(d.reason.message,d.reason.stack):o(d.reason,void 0);return t.addEventListener("error",l),t.addEventListener("unhandledrejection",u),()=>{t.removeEventListener("error",l),t.removeEventListener("unhandledrejection",u)}}const Xre=12;function Zre(e,t){const n=[vA(e).trim()||"The deck threw an error with no message."],r=t==null?void 0:t.trim();if(r){const s=r.split(`
|
|
302
|
+
`).slice(0,Xre).join(`
|
|
303
|
+
`);n.push("",vA(s).trim())}return n.join(`
|
|
304
|
+
`)}class Jre extends w.Component{constructor(){super(...arguments);D1(this,"state",{error:null,componentStack:null,reportOpen:!1})}static getDerivedStateFromError(n){return{error:n}}componentDidCatch(n,r){console.error("ccdeck hit a render error it could not draw past",n,r.componentStack),this.setState({componentStack:r.componentStack??null}),Kre(n.message,n.stack)}render(){const{error:n,componentStack:r,reportOpen:s}=this.state;return n?a.jsxs("div",{className:"error-fallback",role:"alert",children:[a.jsxs("div",{className:"error-fallback-card",children:[a.jsx("p",{className:"error-fallback-title",children:"Something went wrong"}),a.jsx("p",{className:"error-fallback-note",children:"The deck hit an error it could not draw past. Reloading usually clears it — and if it keeps happening, a report tells the people who make ccdeck what broke."}),a.jsxs("div",{className:"error-fallback-actions",children:[a.jsx("button",{type:"button",className:"btn primary",onClick:()=>window.location.reload(),children:"Reload"}),a.jsx("button",{type:"button",className:"btn",onClick:()=>this.setState({reportOpen:!0}),"aria-haspopup":"dialog",children:"Send report"})]})]}),s&&a.jsx(BO,{initialKind:"bug",initialBody:Zre(n.message,r),onClose:()=>this.setState({reportOpen:!1})})]}):this.props.children}}const Qre=1e3;function ese(e={}){const t=Math.max(1,Math.floor(e.limit??Qre)),n=e.protect;let r=!1,s=[],o=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(h){const f=typeof(h==null?void 0:h.seq)=="number"?h.seq:null,p=(h==null?void 0:h.epoch)??null,g=p!==null&&p!==d;g&&(d=p,u=0);const v=f!==null&&!g&&f<=u;if(f!==null&&f>u&&(u=f),!r)return!0;if(v)return!1;if(s.push(h),n!=null&&n(h)&&o.add(h),s.length>t){let k=0;if(o.size<s.length)for(;o.has(s[k]);)k++;const[b]=s.splice(k,1);o.delete(b),l++}return!1},setPaused(h){if(r=h,h)return[];const f=s;return s=[],o=new Set,l=0,f}}}function tse(e){const t=w.useState(()=>ese({protect:o=>jq(e.current,o)}))[0],[n,r]=w.useState(!1),s=w.useCallback(()=>{const o=t.paused&&t.dropped>0,l=t.setPaused(!t.paused);o&&e8(e.current);for(const u of l)e.current=pM(e.current,u);r(t.paused)},[t,e]);return{pauseGate:t,paused:n,togglePause:s}}const Jx={kind:"assumed",claude:!0,codex:!0};function nse(e){if(!e||typeof e!="object")return Jx;const t=e.providers;if(!t||typeof t!="object")return Jx;const n=t;return{kind:"reported",claude:n.claude!==!1,codex:n.codex!==!1}}function rse(e){const[t,n]=w.useState(null),[r,s]=w.useState(Jx);w.useEffect(()=>{let l=!1;return fetch("/api/health").then(u=>u.ok?u.json():null).then(u=>{l||(s(nse(u)),!(!u||typeof u.workspace!="string")&&n(u.workspace))}).catch(()=>{}),()=>{l=!0}},[e]);const o=bn(r);return{workspace:t,providers:r,providersRef:o}}const ZO=3*6e4,sse=2e4;function ase({fetchReport:e,visible:t,now:n,onReport:r}){let s=0,o=!0;const l=async()=>{if(!t())return;const u=await e();!o||!u||(s=n(),r(u))};return{tick:l,wake:async()=>{t()&&n()-s>=ZO&&await l()},stop:()=>{o=!1}}}async function ose(){try{const e=await fetch("/api/provider-status",{signal:AbortSignal.timeout(sse)});return e.ok?await e.json():null}catch{return null}}function ise(e){const[t,n]=w.useState(null);return w.useEffect(()=>{if(!e){n(null);return}const r=ase({fetchReport:ose,visible:()=>document.visibilityState==="visible",now:()=>Date.now(),onReport:n});r.tick();const s=window.setInterval(r.tick,ZO),o=()=>{r.wake()};return document.addEventListener("visibilitychange",o),()=>{r.stop(),window.clearInterval(s),document.removeEventListener("visibilitychange",o)}},[e]),t}const lse={degraded:"degraded performance",partial_outage:"partial outage",major_outage:"major outage",maintenance:"maintenance"},cse={degraded:"degraded",partial_outage:"partial outage",major_outage:"major outage",maintenance:"maintenance"},use={degraded:"degraded",partial_outage:"outage",major_outage:"outage",maintenance:"maint."},dse={claude:"Claude",codex:"Codex"},hse=new Set(["status.claude.com","status.openai.com"]),fse=30*6e4,pse=10*6e4;function mse(e){if(typeof e!="string")return null;try{const t=new URL(e);return t.protocol==="https:"&&hse.has(t.hostname)?t:null}catch{return null}}function xA(e){return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hourCycle:"h23"})}function gse(e){const t=Math.floor(e/6e4);return t<1?"just now":t<60?`${t} min ago`:`${Math.floor(t/60)} h ago`}function yse(e,t){if(!e||typeof e!="object")return null;const n=$t(lse,e.state),r=$t(dse,e.provider);if(!n||!r||typeof e.checkedAt!="number"||t-e.checkedAt>fse)return null;const s=mse(e.statusPageUrl);if(!s)return null;const o=Array.isArray(e.components)?e.components:[],l=e.stale===!0||t-e.checkedAt>pse,u=[`${r}: ${n}${e.summary?` — ${e.summary}`:""}`,o.length>0?`Affected: ${o.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 ${xA(e.checkedAt)}; this is the last thing it said`:`Reported by ${s.hostname}, checked ${gse(t-e.checkedAt)}`,"Opens the status page"],d=l?xA(e.checkedAt):null;return{provider:e.provider,state:e.state,name:r,label:`${r} · ${n}${d?` · as of ${d}`:""}`,words:n,chipWords:$t(cse,e.state)??n,shortWords:$t(use,e.state)??n,asOf:d,what:e.summary||(o.length>0?o.join(", "):null),href:s.href,host:s.hostname,stale:l,detail:u.filter(Boolean).join(`
|
|
305
|
+
`)}}function wse(e,t){return!(e!=null&&e.ok)||e.disabled||!Array.isArray(e.providers)?[]:e.providers.map(n=>yse(n,t)).filter(n=>n!==null)}function vse(e){return e.map(t=>`${t.name}'s status page reports ${t.state.endsWith("outage")?`a ${t.words}`:t.words}.`).join(" ")}const xse="The providers' status pages report no incident.";function bse({version:e,loadVersion:t}){var h;const[n,r]=w.useState(!1),s=((h=e==null?void 0:e.upgrade)==null?void 0:h.state)??"idle",o=Ine(e==null?void 0:e.upgrade),l=w.useRef(!1),u=w.useCallback(async()=>{if(or(l.current||s==="running")){l.current=!0;try{await fetch("/api/upgrade",{method:"POST"})}catch{}await t(),l.current=!1}},[s,t]);w.useEffect(()=>{if(s!=="running")return;const f=window.setInterval(t,3e3);return()=>window.clearInterval(f)},[s,t]);const d=w.useCallback(async()=>{const f=e==null?void 0:e.command;!f||!await Ba(f)||(r(!0),window.setTimeout(()=>r(!1),1600))},[e==null?void 0:e.command]);return{upgradeState:s,upgradeFailure:o,startUpgrade:u,copyCommand:d,cmdCopied:n}}const bA="agent-dag.browserWatch.seenMs";function kse(e,t){return e.filter(n=>n.startMs>t)}function Nse(){const[e,t]=w.useState(()=>Number(Qe(bA))||0),[n,r]=w.useState([]),[s,o]=w.useState(!1);w.useEffect(()=>{let d=!0;const h=()=>{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??[]),o(((g=p.settings)==null?void 0:g.enabled)===!0))}).catch(()=>{})};h();const f=setInterval(h,5*6e4);return()=>{d=!1,clearInterval(f)}},[]);const l=w.useMemo(()=>kse(n,e).length,[n,e]),u=w.useCallback(d=>{t(d),Ye(bA,String(d))},[]);return{watchOn:s,setWatchOn:o,watchUnseen:l,markWatchSeen:u}}const JO=["--err","--inflight","--ok","--grid-line","--minimap-mask","--panel","--line","--accent","--text-dim","--bg"];function kA(e){const t={};for(const n of JO)t[n]=e(n);return t}function jse(e){return t=>e[t]??""}function Sse(e,t){return JO.every(n=>e[n]===t[n])}const QO="agent-dag.theme";function _se(e,t=!1){return e==="light"||e==="dark"?e:t?"light":"dark"}function Ese(){try{return window.matchMedia("(prefers-color-scheme: light)").matches}catch{return!1}}function Cse(){return _se(Qe(QO),Ese())}function NA(e){return typeof window>"u"?"":getComputedStyle(document.documentElement).getPropertyValue(e).trim()||""}function Tse(){const[e,t]=w.useState(Cse),[n,r]=w.useState(Tte),[s,o]=w.useState(()=>kA(NA)),l=w.useMemo(()=>jse(s),[s]),u=w.useCallback(d=>Iee(d,l),[l]);return w.useEffect(()=>{document.documentElement.dataset.theme=e,Ye(QO,e),o(d=>{const h=kA(NA);return Sse(d,h)?d:h})},[e]),w.useEffect(()=>{Ye(LO,n?"1":"0")},[n]),w.useEffect(()=>{const d=document.querySelector('meta[name="theme-color"]'),h=s["--panel"];d&&h&&d.setAttribute("content",h)},[s]),{theme:e,setTheme:t,characterEnabled:n,setCharacterEnabled:r,palette:s,minimapNodeFill:u}}function Rse(e){const t=w.useRef(null),[n,r]=w.useState(!1),[s,o]=w.useState(()=>new Set),l=w.useMemo(()=>{const d=new Set;for(const h of e.current.agents.values())for(const f of h.tools)d.add(IO(f.name));return Object.keys($O).filter(h=>d.has(h))},[e.current,e.current.revision]);w.useEffect(()=>{if(l.length<=1){r(!1);return}let d=0;const h=()=>{const f=t.current;if(f&&!document.hidden){const p=f.getBoundingClientRect(),g=Array.from(document.querySelectorAll(".react-flow__node, .tool-burst")).map(k=>k.getBoundingClientRect()),v=jee(p,g,8);r(k=>k===v?k:v)}d=window.setTimeout(h,300)};return h(),()=>window.clearTimeout(d)},[l.length]);const u=w.useCallback(d=>{o(h=>{const f=new Set(h);return f.has(d)?f.delete(d):f.add(d),f})},[]);return{presentCats:l,hiddenCats:s,toggleCat:u,catBarRef:t,catBarOccluded:n}}function Ase(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 f;return(f=e.onState)==null?void 0:f.call(e,r())};function o(){var f,p;if(!(!t||(n==null?void 0:n.state)==="running"))try{n||(n=new t,(f=n.addEventListener)==null||f.call(n,"statechange",s)),(p=n.resume)==null||p.call(n).then(s,()=>{}),s()}catch{}}function l(f,p,g=p.figure){if(!n||n.state!=="running")return!1;const v=qx(f,g),k=OY(p.level,v),b=n.currentTime;for(const x of v.notes){const N=n.createOscillator(),S=n.createGain();N.type=v.type??"sine",N.frequency.value=x.hz;const _=b+x.at,E=_+x.ms/1e3;S.gain.setValueAtTime(ES,_),S.gain.exponentialRampToValueAtTime(k,_+LY),S.gain.exponentialRampToValueAtTime(ES,E),N.connect(S).connect(n.destination),N.start(_),N.stop(E+.02)}return!0}async function u(f,p){if(!e.loadCustom)return"unavailable";let g;try{g=await e.loadCustom(f)}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),b=window.speechSynthesis.getVoices();k.voice=b.find(x=>x.voiceURI===g.voiceURI)??null,k.rate=g.rate,k.pitch=g.pitch,k.volume=PY(p.level);try{return window.speechSynthesis.cancel(),window.speechSynthesis.speak(k),"played"}catch{return"unavailable"}}if(!n||n.state!=="running")return"locked";let v;try{v=await n.decodeAudioData(g.bytes.slice(0))}catch{return"broken"}try{const k=n.createBufferSource(),b=n.createGain();return k.buffer=v,b.gain.setValueAtTime(DY(g.normalizationGain,p.level),n.currentTime),k.connect(b).connect(n.destination),k.start(n.currentTime),"played"}catch{return"unavailable"}}function d(f,p=!1){var k,b;if(!p&&!e.enabled())return!1;const g=HY((k=e.prefs)==null?void 0:k.call(e),f),v=((b=e.customSelection)==null?void 0:b.call(e)[f])??null;return v&&e.loadCustom?(u(v,g).then(x=>{var N;x==="played"||x==="locked"||((x==="missing"||x==="broken")&&((N=e.onCustomFailure)==null||N.call(e,f,v)),l(f,{...g,figure:xn},xn))}),!0):!n||n.state!=="running"?!1:l(f,g)}function h(f,p=Da){return u(f,{level:li(p),figure:xn}),!0}return{unlock:o,play:d,previewCustom:h,state:r,get context(){return n}}}function Mse({chimesRef:e,soundOnRef:t,tonePrefsRef:n,customSelectionsRef:r,fallbackCustomRef:s}){const[o,l]=w.useState("locked");return w.useEffect(()=>{const u=Ase({enabled:()=>t.current===!0,prefs:()=>n.current,customSelection:()=>r.current,loadCustom:RY,onCustomFailure:(p,g)=>s.current(p,g),onState:l});e.current=u,l(u.state());const d=["pointerdown","pointerup","keydown"],h=()=>{for(const p of d)window.removeEventListener(p,f,{capture:!0})},f=()=>{var p;u.unlock(),((p=u.context)==null?void 0:p.state)==="running"&&h()};for(const p of d)window.addEventListener(p,f,{capture:!0});return h},[]),{chimeState:o}}function $se(){const[e,t]=w.useState(Ate),[n,r]=w.useState(()=>Y6(Qe(BN))),[s,o]=w.useState(()=>K6(Qe(UN))),[l,u]=w.useState(()=>X6(Qe(tA),n,Ete)),[d,h]=w.useState(()=>new Set),[f,p]=w.useState(0);w.useEffect(()=>{Ye(PO,String(e))},[e]),w.useEffect(()=>{Ye(UN,s?"1":"0")},[s]),w.useEffect(()=>{Ye(BN,JSON.stringify(n))},[n]),w.useEffect(()=>{Ye(tA,l)},[l]);const g=w.useCallback(N=>{r(S=>S.some(_=>_.id===N.id)?S:[...S,N]),h(S=>{if(!S.has(N.id))return S;const _=new Set(S);return _.delete(N.id),_})},[]),v=w.useCallback((N,S)=>{const _=S.trim();!_||_.length>Rl||r(E=>E.map(T=>T.id===N?{...T,name:_}:T))},[]),k=w.useCallback(N=>{r(S=>S.filter(_=>_.id!==N)),u(S=>Z6(S,N)),h(S=>{if(!S.has(N))return S;const _=new Set(S);return _.delete(N),_})},[]),b=w.useCallback(N=>{const S=zN(N),_=d.has(S);N===l&&!_||(_&&h(E=>{const T=new Set(E);return T.delete(S),T}),u(N),p(E=>E+1))},[l,d]),x=w.useCallback((N,S)=>{const _=zN(N);h(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:o,fmSource:l,customFmStations:n,unavailableFmStations:d,fmPlayRequest:f,addFmStation:g,renameFmStation:v,removeFmStation:k,pickFmSource:b,markFmStationAvailability:x}}function Ise(e){const[t,n]=w.useState(null),[r,s]=w.useState(!1),[o,l]=w.useState(null),u=w.useRef(0);w.useEffect(()=>{if(!e||!Wl())return;let k=!1;const b=u.current;return fetch("/api/desktop-update").then(x=>x.ok?x.json():null).then(x=>{if(k||u.current!==b)return;const N=lA(x);N&&n(N)}).catch(()=>{}),()=>{k=!0}},[e]);const d=one(t),h=w.useRef(!1),f=w.useRef(0),p=w.useRef(0);w.useEffect(()=>()=>window.clearTimeout(f.current),[]);const g=w.useCallback(async k=>{if(!or(h.current))return;const b=++p.current;window.clearTimeout(f.current),h.current=!0,s(!0),l(null);const x=N=>{b===p.current&&(window.clearTimeout(f.current),h.current=!1,s(!1),l({failure:N,version:k}))};try{const N=await fetch("/api/desktop-update/restart",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({version:k})});if(!N.ok)return x(une(await N.json().catch(()=>null)))}catch{return x("unreachable")}b===p.current&&(f.current=window.setTimeout(()=>x("timeout"),DO))},[]),v=w.useCallback(k=>{if(Wl())try{const b=lA(JSON.parse(k));b&&(u.current++,n(b),b.status!=="ready"&&(p.current++,window.clearTimeout(f.current),h.current=!1,s(!1)))}catch{}},[]);return{desktopUpdateRestarting:r,desktopUpdateFailure:o,readyAppUpdate:d,askDesktopUpdateRestart:g,onDesktopUpdateEvent:v}}const Ou="agent-dag.autoRestart",jA="agent-dag.bundleReloadedFor";function Ose({now:e,stateRef:t,version:n,notice:r,noticeOpen:s,upgradeFailure:o,paused:l}){const[u,d]=w.useState(()=>Qe(Ou)!=="0"),h=w.useRef(!1),f=w.useCallback(()=>{const P=!u;h.current=!0,ls(Ou),d(P),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({autoUpdate:P})}).then(I=>I.ok?I.json():null).then(I=>{var O;I!=null&&I.ok&&d(((O=I.prefs)==null?void 0:O.autoUpdate)!==!1)}).catch(()=>{})},[u]),[p,g]=w.useState(!1),[v,k]=w.useState("restart"),[b,x]=w.useState(null),N=w.useRef(!1),S=w.useRef(null),_=w.useRef(0),E=w.useRef(null),T=w.useCallback(async P=>{if(!or(N.current))return;const I=(P==null?void 0:P.upgrade)===!0,O=(P==null?void 0:P.whenIdle)===!0;N.current=!0,S.current=o;const U=++_.current,M=()=>{k(I?"npx":"restart"),g(!0)};O||M();try{window.sessionStorage.setItem("agent-dag.restartPending",(r==null?void 0:r.to)??"")}catch{}let $=!1;try{const B=await fetch("/api/restart",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(O?{upgrade:I,whenIdle:O}:{upgrade:I})});$=O&&B.status===409}catch{}if($){N.current=!1,E.current=null;try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}return}O&&M(),window.setTimeout(()=>{if(_.current===U&&N.current){N.current=!1,g(!1);try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}}},I?18e4:3e4)},[r==null?void 0:r.to,o]);w.useEffect(()=>{const P=cA(t.current.agents.values())>0,I=Fne({enabled:u,kind:r==null?void 0:r.kind,canRestart:(n==null?void 0:n.canRestart)===!0,noticeOpen:s,visible:document.visibilityState==="visible",busy:P,idleSince:E.current,now:e});E.current=I.idleSince,I.restart&&T({whenIdle:!0})},[u,r==null?void 0:r.kind,n==null?void 0:n.canRestart,s,e,T]);const R=cA(t.current.agents.values()),A=Dne(R,l),q=qO({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});w.useEffect(()=>{const P=n==null?void 0:n.running;let I=null,O=null;try{I=window.sessionStorage.getItem("agent-dag.restartPending"),O=window.sessionStorage.getItem(jA)}catch{return}const U=$ne({bundle:"3.36.0",running:P,pending:I,lastTried:O});if(U==="reload"){try{window.sessionStorage.setItem(jA,P??"")}catch{return}window.location.reload();return}if(U!=="confirm")return;try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}N.current=!1,g(!1),x(P??null);const M=window.setTimeout(()=>x(null),6e3);return()=>window.clearTimeout(M)},[n==null?void 0:n.running]),w.useEffect(()=>{if(p&&One({asked:S.current,reported:o})){try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}N.current=!1,g(!1)}},[p,o]);const L=w.useCallback(P=>{var I,O;if(!h.current){const U=Qe(Ou)==="0";ls(Ou),U&&((I=P.prefs)==null?void 0:I.autoUpdate)!==!1?(d(!1),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({autoUpdate:!1})}).catch(()=>{})):d(((O=P.prefs)==null?void 0:O.autoUpdate)!==!1)}},[]);return{autoRestart:u,toggleAutoRestart:f,restarting:p,restartMode:v,restartedTo:b,askRestart:T,restartCopy:A,restartFuseMs:q,loadAutoRestartPrefs:L}}function Lse(){const[e,t]=w.useState([]),n=w.useRef(new Set),[r,s]=w.useState(null);w.useEffect(()=>{let u=!0,d=0;const h=()=>{fetch("/api/lan").then(f=>f.ok?f.json():null).then(f=>u?(f!=null&&f.ok&&t(eS(Array.isArray(f.pending)?f.pending:[],f.aliases)),f):null).catch(()=>null).then(f=>{u&&(d=window.setTimeout(h,(f==null?void 0:f.enabled)===!0?$x:q$))})};return h(),()=>{u=!1,window.clearTimeout(d)}},[]);const o=w.useCallback(async(u,d)=>{if(!r){s(u);try{const f=await(await fetch("/api/lan/peer",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:u,fp:d})})).json().catch(()=>null);f&&Array.isArray(f.pending)?t(eS(f.pending,f.aliases)):t(p=>p.filter(g=>g.fp!==d))}catch{}finally{s(null)}}},[r]),l=w.useCallback(u=>{r||(n.current.add(u),t(d=>[...d]))},[r]);return{lanPending:e,lanDeferred:n,lanBusy:r,answerLanPair:o,deferLanPair:l}}const eL="agent-dag.sessionListOpen",tL="agent-dag.accountsPanelOpen";function Pse(){return Qe(eL)==="1"}function Dse(e){Ye(eL,e?"1":"0")}function Fse(){const e=Qe(tL);return e===null?!0:e==="1"}function qse(){const[e,t]=w.useState(Pse);w.useEffect(()=>{Dse(e)},[e]);const n=w.useRef(!1),[r,s]=w.useState(()=>{const h=Fse();return h&&e?(n.current=!0,!1):h});w.useEffect(()=>{!r&&n.current||Ye(tL,r?"1":"0")},[r]),w.useEffect(()=>{!e&&n.current&&(n.current=!1,s(!0))},[e]);const o=w.useCallback(()=>{t(h=>(h||s(f=>(f&&(n.current=!0),!1)),!h))},[]),l=w.useCallback(()=>{n.current=!1,s(h=>(h||t(!1),!h))},[]),u=w.useCallback(()=>t(!1),[]),d=w.useCallback(()=>s(!1),[]);return{sessionListOpen:e,accountsPanelOpen:r,toggleSessionList:o,toggleAccountsPanel:l,closeSessionList:u,closeAccountsPanel:d}}const nL="agent-dag.detailOpen",rL="agent-dag.usagePanelOpen",sL="agent-dag.systemPanelOpen";function Bse(){return Qe(nL)==="1"}function Use(e){Ye(nL,e?"1":"0")}function zse(){const e=Qe(rL);return e===null?!0:e==="1"}function Wse(e){Ye(rL,e?"1":"0")}function Hse(){const e=Qe(sL);return e===null?!0:e==="1"}function Vse(e){Ye(sL,e?"1":"0")}function Gse(){const[e,t]=w.useState(Bse);w.useEffect(()=>{Use(e)},[e]);const[n,r]=w.useState(zse);w.useEffect(()=>{Wse(n)},[n]);const[s,o]=w.useState(Hse);return w.useEffect(()=>{Vse(s)},[s]),{detailOpen:e,setDetailOpen:t,usagePanelOpen:n,setUsagePanelOpen:r,machinePanelOpen:s,setMachinePanelOpen:o}}const Kse={permission:"your permission",asked:"your answer"},Yse="No sessions are waiting for you.";function Xse(e){if(e.length===0)return"";const[t,...n]=e,r=t.waiting.kind,s=n.every(l=>l.waiting.kind===r)?Kse[r]??"you":"you";if(n.length===0)return`${t.label} is waiting for ${s}.`;const o=`${n.length} more session${n.length===1?"":"s"}`;return`${t.label} and ${o} are waiting for ${s}.`}function Wv(e,t,n=Yse){return t!==""?t:e===""?"":n}function Zse({waitingSessions:e,watchUnseen:t,incidents:n=[]}){const[r,s]=w.useState(""),o=Xse(e);w.useEffect(()=>{s(g=>Wv(g,o))},[o]);const[l,u]=w.useState(""),d=t>0?`Browser watch has ${t} unread ${t===1?"finding":"findings"}.`:"";w.useEffect(()=>{u(g=>Wv(g,d,"Browser watch has no unread findings."))},[d]);const[h,f]=w.useState(""),p=vse(n);return w.useEffect(()=>{f(g=>Wv(g,p,xse))},[p]),{blockedSaid:r,watchSaid:l,setWatchSaid:u,incidentSaid:h}}function Jse({waitingSessions:e,liveSince:t,focusSession:n}){const[r,s]=w.useState(()=>typeof Notification>"u"?"denied":Notification.permission),[o,l]=w.useState(null),[u,d]=w.useState(!1),[h,f]=w.useState(!1),p=w.useRef(()=>{}),g=w.useRef(new Set),v=bn(e),k=w.useCallback(()=>{const T=!u;d(T),T&&(g.current=vu(v.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),f(R.notificationsVetoed===!0))}).catch(()=>{})},[u]),b=typeof Notification<"u";w.useEffect(()=>{if(!o)return;const R=setTimeout(()=>l(null),o==="blocked"?8e3:4e3);return()=>clearTimeout(R)},[o]);const x=w.useCallback(()=>{typeof Notification>"u"||Notification.requestPermission().then(T=>{const R=T;s(R),R==="granted"?l("on"):R==="denied"&&l("blocked")})},[]);p.current=x;const N=w.useRef(null),S=e.map(T=>Id(T.id,T.waiting)).join("|");w.useEffect(()=>{x8(N.current,r)&&(N.current=r,g.current=vu(e))},[r]);const _=w.useRef(!1);w.useEffect(()=>{b8(_.current,t)&&(_.current=!0,g.current=vu(e))},[t]),w.useEffect(()=>{if(typeof Notification>"u"||Notification.permission!=="granted"||!k8(N.current,t))return;const T=typeof document>"u"||!document.hidden,R=w8(e,g.current,T,u);for(const A of R)try{const q=new Notification(A.title,{body:A.body,tag:A.key});q.onclick=()=>{window.focus(),n(A.sessionId),q.close()}}catch{}g.current=T?vu(e):v8(e,R,g.current)},[S,t]);const E=w.useCallback(T=>{var R;d(((R=T.prefs)==null?void 0:R.notifications)===!0),f(T.notificationsVetoed===!0)},[]);return{notifyPermission:r,notifySaid:o,notifyOn:u,notifyVetoed:h,toggleNotify:k,notifySupported:b,askForNotifications:x,loadNotifyPrefs:E}}function Qse({openedTool:e,usageHistoryOpen:t,contextFor:n,tourOpen:r,summaryFor:s,browserWatchOpen:o,keyHelpOpen:l,releaseNotes:u,feedbackOpen:d}){const h=bn(l),f=w.useRef(!1);return f.current=e!=null||t||n!=null||r||s!=null||o||l||u!=null||d,{keyHelpOpenRef:h,modalOpenRef:f}}function eae({stateRef:e,tourOpen:t,releaseNotes:n}){const[r,s]=w.useState(null),o=w.useCallback((P,I)=>s({agentId:P,toolId:I}),[]),[l,u]=w.useState(null),[d,h]=w.useState(null),f=w.useCallback(P=>h(P),[]),[p,g]=w.useState(!1),[v,k]=w.useState(!1),[b,x]=w.useState(!1),[N,S]=w.useState(!1),[_,E]=w.useState(null),T=w.useCallback(P=>{E(P??null),S(!0)},[]),R=r?vq(e.current.agents,r.agentId,r.toolId):null,A=d?e.current.agents.get(d):void 0,{keyHelpOpenRef:q,modalOpenRef:L}=Qse({openedTool:R,usageHistoryOpen:v,contextFor:d,tourOpen:t,summaryFor:l,browserWatchOpen:b,keyHelpOpen:p,releaseNotes:n,feedbackOpen:N});return{setOpenedToolKey:s,openTool:o,openedTool:R,summaryFor:l,setSummaryFor:u,contextFor:d,setContextFor:h,openContext:f,contextAgent:A,keyHelpOpen:p,setKeyHelpOpen:g,usageHistoryOpen:v,setUsageHistoryOpen:k,browserWatchOpen:b,setBrowserWatchOpen:x,feedbackOpen:N,setFeedbackOpen:S,feedbackPrefill:_,setFeedbackPrefill:E,openFeedback:T,keyHelpOpenRef:q,modalOpenRef:L}}function tae({stateRef:e,pinnedRef:t,measuredRef:n,positionsRef:r,lastLayoutSigRef:s,forgetRemovals:o,clearSelection:l,rerender:u,modalOpenRef:d}){const[h,f]=w.useState(!1),p=w.useCallback(async()=>{try{await fetch("/api/clear",{method:"POST"})}catch{}e.current=xb(),t.current.clear(),n.current.clear(),r.current.clear(),s.current="",RO(),o(),l(),u()},[u,l,o]),g=bn(h),v=w.useCallback(k=>{const b=Une(k,{confirmOpen:g.current,modalOpen:d.current});b==="confirm"?f(!0):b==="clear"&&(f(!1),p())},[p]);return{clearConfirmOpen:h,setClearConfirmOpen:f,requestClear:v}}const SA="agent-dag.oldNameNoticeDismissed";function nae(e){const[t,n]=w.useState(()=>Qe(SA)??""),r=e!=null&&e.invokedAs&&e.invokedAs!==bt?e.invokedAs:null,s=r!=null&&t!==r,o=w.useCallback(()=>{r&&(n(r),Ye(SA,r))},[r]);return{oldName:r,oldNameOpen:s,dismissOldName:o}}function rae({chimesRef:e,setTonePrefs:t,tonePrefsRef:n,previewTone:r}){const[s,o]=w.useState(()=>wY(Qe)),l=bn(s),[u,d]=w.useState([]),h=w.useCallback(S=>{o(_=>{const E={..._,[S]:null};return l.current=E,E}),ls(bl[S])},[]),f=w.useCallback((S,_)=>{const E=l.current[S];_&&E!==_||(h(S),t(T=>{const R={...T,[S]:{...T[S],figure:xn}};return n.current=R,R}),Ye(wd[S],xn))},[h]),p=bn(f);w.useEffect(()=>{let S=!0;return TY().then(_=>{if(!S)return;d(_);const E=new Set(_.map(T=>T.id));for(const T of Hu){const R=l.current[T];R&&!E.has(R)&&p.current(T,R)}},()=>{}),()=>{S=!1}},[]);const g=w.useCallback((S,_)=>{if(!u.some(T=>T.id===_))return;const E={...l.current,[S]:_};l.current=E,o(E),Ye(bl[S],_),r(S,!0)},[u,r]),v=w.useCallback(async S=>{var R;const _=Fx(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 jY(S,L=>T.decodeAudioData(L));await SS(A);const q=Bl(A);d(L=>[...L.filter(P=>P.id!==q.id),q])}finally{(R=T.close)==null||R.call(T)}},[u.length]),k=w.useCallback(async S=>{const _=Fx(u.length);if(_)throw new Error(_);const E=SY(S);await SS(E);const T=Bl(E);d(R=>[...R.filter(A=>A.id!==T.id),T])},[u.length]),b=w.useCallback(async(S,_)=>{const E=u.find(R=>R.id===S),T=_.trim().slice(0,80);!E||!T||T===E.name||(await AY(S,T),d(R=>R.map(A=>A.id===S?{...A,name:T}:A)))},[u]),x=w.useCallback(async S=>{await MY(S),d(R=>R.filter(A=>A.id!==S));const _=l.current,E=vY(_,S);l.current=E,o(E);const T=Hu.filter(R=>_[R]===S);for(const R of T)ls(bl[R]),Ye(wd[R],xn);T.length>0&&t(R=>{const A={...R};for(const q of T)A[q]={...A[q],figure:xn};return n.current=A,A})},[]),N=w.useCallback(S=>{var T,R;const _=Hu.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:h,fallbackCustomRef:p,selectCustomTone:g,importNotificationAudio:v,createNotificationVoice:k,renameCustomAsset:b,deleteCustomAsset:x,previewCustomAsset:N}}function sae(e){const[t,n]=w.useState(()=>WY(Qe)),r=bn(t),s=w.useRef(null),o=w.useCallback((u,d=!1)=>{var h,f;if((h=e.current)==null||h.unlock(),s.current!==null&&clearTimeout(s.current),s.current=null,!d){(f=e.current)==null||f.play(u,!0);return}s.current=setTimeout(()=>{var p;s.current=null,(p=e.current)==null||p.play(u,!0)},FY)},[]),l=w.useCallback((u,d)=>{n(h=>{const f={level:li(d.level??h[u].level),figure:pI(u,d.figure??h[u].figure)};return Ye(yI[u],String(f.level)),Ye(wd[u],f.figure),{...h,[u]:f}}),o(u,!0)},[o]);return w.useEffect(()=>()=>{s.current!==null&&clearTimeout(s.current)},[]),{tonePrefs:t,setTonePrefs:n,tonePrefsRef:r,previewTone:o,changeTone:l}}const aae=15e3;function oae(e){return e.visibilityState==="visible"&&e.hasFocus()}function iae(e,t){return t||e===!0}function lae(){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 cae(){w.useEffect(()=>{const e=lae();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=oae(document);iae(t,l)&&n(l),t=l},s=()=>{t&&n(!1),t=!1};r();const o=window.setInterval(r,aae);return window.addEventListener("focus",r),window.addEventListener("blur",r),document.addEventListener("visibilitychange",r),window.addEventListener("pagehide",s),()=>{window.clearInterval(o),window.removeEventListener("focus",r),window.removeEventListener("blur",r),document.removeEventListener("visibilitychange",r),window.removeEventListener("pagehide",s),s()}},[])}function uae({loadAutoRestartPrefs:e,loadNotifyPrefs:t,loadReportsPrefs:n}){w.useEffect(()=>{let r=!0;return fetch("/api/prefs").then(s=>s.ok?s.json():null).then(s=>{!r||!(s!=null&&s.ok)||(e(s),t(s),n(s))}).catch(()=>{}),()=>{r=!1}},[])}const Hv="agent-dag.versionNoticeDismissed",dae=15*6e4;function hae(e){const[t,n]=w.useState(null),[r,s]=w.useState(()=>Qe(Hv)??""),o=w.useRef(0),[l,u]=w.useState(!1),d=w.useCallback((b=!1)=>(b&&(o.current=Date.now(),u(!0)),fetch(b?"/api/version?refresh=1":"/api/version").then(x=>x.ok?x.json():null).then(x=>{x&&n(x)}).catch(()=>{}).finally(()=>{b&&u(!1)})),[]),h=w.useCallback(()=>{d(Date.now()-o.current>=dae)},[d]);w.useEffect(()=>{d();const b=window.setInterval(h,5*6e4),x=()=>{document.visibilityState==="visible"&&h()};return document.addEventListener("visibilitychange",x),()=>{window.clearInterval(b),document.removeEventListener("visibilitychange",x)}},[d,h]),w.useEffect(()=>{e&&d()},[e,d]);const f=(t==null?void 0:t.notice)??null,p=FO(f),g=gne(f,r),v=w.useCallback(()=>{s(""),Ye(Hv,"")},[]),k=w.useCallback(()=>{f&&(s(p),Ye(Hv,p))},[f,p]);return{version:t,notice:f,noticeOpen:g,showNotice:v,dismissNotice:k,versionChecking:l,loadVersion:d}}function fae({version:e,readyAppUpdate:t}){const[n,r]=w.useState(!1),s=w.useRef(null),[o,l]=w.useState(null),u=o&&t?t.version:null,d=w.useRef(null);w.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 h=w.useRef(!1);w.useEffect(()=>{if(h.current)return;const x=vl(),N=xre(x),S=_re({stored:N,running:(e==null?void 0:e.running)??null,notes:pA,remembers:bre(x)});if(S.reason==="no-version")return;h.current=!0,S.record&&kre(x,S.record);let _=!0;return(async()=>{var q;let T=Nre(x);if(Wl())try{const L=await fetch("/api/prefs");if(!L.ok)throw new Error("desktop tour preferences unavailable");const P=await L.json();if(!(P!=null&&P.ok))throw new Error("desktop tour preferences unavailable");const I=((q=P.prefs)==null?void 0:q.tourSeen)===!0;T&&!I&&fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({tourSeen:!0}),keepalive:!0}).catch(()=>{}),T=T||I}catch{T=!0}if(!_)return;const R=Sre({tourSeen:T,decision:S}),A=S.show.length?{entries:S.show,since:N,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 f=(e==null?void 0:e.running)??"3.36.0",p=w.useMemo(()=>UO(pA,null,f),[f]),g=w.useCallback(()=>{l({entries:p,since:null,firstRun:!1})},[p]),v=w.useCallback(()=>r(!0),[]),k=w.useCallback(()=>l(null),[]),b=w.useCallback(()=>{r(!1),jre(vl()),Wl()&&fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({tourSeen:!0}),keepalive:!0}).catch(()=>{});const x=s.current;s.current=null,x&&l(x)},[]);return{tourOpen:n,openTour:v,closeTour:b,releaseNotes:o,closeReleaseNotes:k,chipVersion:f,openReleaseNotes:g}}function pae(){const[e,t]=w.useState(void 0),[n,r]=w.useState(!1),s=w.useRef(!1);s.current=e===!0&&!n,w.useEffect(()=>Yre(()=>s.current),[]);const o=w.useCallback(u=>{var d;t(((d=u.prefs)==null?void 0:d.reports)!==!1),r(u.reportsVetoed===!0)},[]),l=w.useCallback(async u=>{t(u);try{const h=await(await fetch("/api/reports",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({on:u})})).json();h!=null&&h.ok&&(t(h.reports!==!1),r(h.reportsVetoed===!0))}catch{}},[]);return{reportsOn:e,reportsVetoed:n,loadReportsPrefs:o,answerReports:l}}function mae(){const[e,t]=w.useState(null),[n,r]=w.useState(!1),s=w.useRef(null);return w.useEffect(()=>{let o=!0,l=!1,u=null,d=null,h="";const f=b=>{o&&(r(!0),b!==h&&t(null))},p=()=>{if(l)return;l=!0,u=Date.now();const b=oA();d=b,fetch(`/api/ccusage?since=${b}`).then(x=>x.ok?x.json():null).then(x=>{if(o){if(!(x!=null&&x.ok)){f(b);return}h=b,t(sne(x)),r(!1)}}).catch(()=>f(b)).finally(()=>{l=!1})},g=()=>{const b=s.current;rne({shown:!!b&&b.getClientRects().length>0,tabVisible:document.visibilityState==="visible",lastSince:d,since:oA(),lastReadAt:u,now:Date.now()})&&p()};g();const v=window.setInterval(g,nne);document.addEventListener("visibilitychange",g);let k=null;return s.current&&typeof ResizeObserver<"u"&&(k=new ResizeObserver(g),k.observe(s.current)),()=>{o=!1,window.clearInterval(v),document.removeEventListener("visibilitychange",g),k==null||k.disconnect()}},[]),{monthlyUsage:e,monthlyUsageUnavailable:n,monthUsageRef:s}}function gae(e){const[t,n]=w.useState(null);w.useEffect(()=>{const u=Qe("agent-dag.sound");n(u===null?!0:u==="on")},[]);const r=w.useCallback(()=>{n(u=>{var h;const d=u!==!0;return Ye("agent-dag.sound",d?"on":"off"),d&&((h=e.current)==null||h.unlock()),d})},[]),s=w.useCallback(u=>{r()},[r]),o=bn(s),l=bn(t);return{soundOn:t,toggleSound:r,activateSoundRef:o,soundOnRef:l}}function yae(){const[e,t]=w.useState(!1),n=w.useRef(null),[r,s]=w.useState(!1),o=w.useRef(null);return w.useEffect(()=>{e&&s(!1)},[e]),{soundMenuOpen:e,setSoundMenuOpen:t,soundButtonRef:n,appearanceMenuOpen:r,setAppearanceMenuOpen:s,appearanceButtonRef:o}}const wae="agent-dag.autoFitDisabled";function vae(e){const t=w.useRef(!1),[n,r]=w.useState(!1);w.useEffect(()=>{ls(wae)},[]);const s=w.useCallback(()=>{t.current||(t.current=!0,r(!0))},[]),o=w.useCallback(()=>{t.current=!1,r(!1),e(400)},[e]);return{autoFitDisabled:n,autoFitDisabledRef:t,disableAutoFit:s,enableAutoFitAndRefit:o}}function xae(){return a.jsx(yb,{children:a.jsx(Jre,{children:a.jsx(bae,{})})})}function bae(){const e=di(),t=w.useState(xb)[0],n=w.useRef(t),[,r]=w.useState(0),s=w.useCallback(()=>r(Gn=>Gn+1),[]),{detailOpen:o,setDetailOpen:l,usagePanelOpen:u,setUsagePanelOpen:d,machinePanelOpen:h,setMachinePanelOpen:f}=Gse(),{selectedIds:p,primarySelectedId:g,selectAgent:v,clearSelection:k,pruneSelectionToBoard:b}=lX(n,l),{sessionListOpen:x,accountsPanelOpen:N,toggleSessionList:S,toggleAccountsPanel:_,closeSessionList:E,closeAccountsPanel:T}=qse(),R=mae(),A=Bu(N,200),q=Bu(u,130),L=Bu(h,130),P=w.useRef(null),I=gae(P),{activateSoundRef:O,soundOnRef:U}=I,M=sae(P),{setTonePrefs:$,tonePrefsRef:B,previewTone:V}=M,H=rae({chimesRef:P,setTonePrefs:$,tonePrefsRef:B,previewTone:V}),{customSelectionsRef:F,fallbackCustomRef:W}=H,D=yae(),{setSoundMenuOpen:Y}=D,{chimeState:J}=Mse({chimesRef:P,soundOnRef:U,tonePrefsRef:B,customSelectionsRef:F,fallbackCustomRef:W}),G=tse(n),{pauseGate:K,paused:X,togglePause:Z}=G,ee=w.useRef(()=>{}),{live:se,tabCapped:ue,everConnected:ae,liveSince:re}=JY({stateRef:n,rerender:s,pauseGate:K,chimesRef:P,desktopUpdateRef:ee}),de=hae(se),{version:me,notice:pe,noticeOpen:ke,loadVersion:xe}=de,fe=Ise(se),{readyAppUpdate:Te,onDesktopUpdateEvent:Fe}=fe;ee.current=Fe,cae();const Oe=fae({version:me,readyAppUpdate:Te}),{tourOpen:We,openTour:le,releaseNotes:je}=Oe,{workspace:Re,providers:Le,providersRef:et}=rse(se),rt=nae(me),Je=bse({version:me,loadVersion:xe}),{upgradeFailure:it}=Je,Ue=eae({stateRef:n,tourOpen:We,releaseNotes:je}),{openTool:lt,setSummaryFor:He,setContextFor:ft,openContext:Vt,setKeyHelpOpen:Xe,setUsageHistoryOpen:pt,setBrowserWatchOpen:Ot,keyHelpOpenRef:fn,modalOpenRef:Lt}=Ue,qt=pae(),Zt=Nse(),{watchOn:Bt,watchUnseen:pr}=Zt,qr=Lse(),[Br,ms]=w.useState(0),{presentCats:mr,hiddenCats:gr,toggleCat:Nn,catBarRef:Ur,catBarOccluded:jn}=Rse(n),gs=w.useRef(null),[zn,Wn]=w.useState(0),vt=cX({stateRef:n,rerender:s,pruneSelectionToBoard:b,setContextFor:ft,setSummaryFor:He}),yr=ise(Le.claude||Le.codex),wr=wse(yr,vt),vr=Ose({now:vt,stateRef:n,version:me,notice:pe,noticeOpen:ke,upgradeFailure:it,paused:G.paused}),{askRestart:ys,loadAutoRestartPrefs:Jt}=vr,ge=Tse(),{setTheme:qe,palette:Ze}=ge,Qt=$se(),zr=oee(),{applyViewport:xr,moveCamera:ws,fitLeft:Sn,cameraEpochRef:Wr,lastFitTimeRef:tt}=zr,Hr=wee(Sn),{pinnedRef:br,positionsRef:Vr,lastLayoutSigRef:vs,handleRelayout:Va}=Hr,ea=w.useRef(null),Gr=w.useRef(()=>{}),en=re!==null,xs=w.useRef(0),tn=w.useCallback(()=>{xs.current=Date.now()},[]),{canvasRef:Kr,canvasSize:mh,paneSizeRef:gh}=Jee(),ta=vae(Sn),{autoFitDisabledRef:na,disableAutoFit:Yr}=ta,bs=w.useRef(!1),{measuredRef:Xr,measuredVersionRef:yh,sizeVersion:bi,domSizeVersion:ac}=Qee(bs),{removedNodes:Ga,removedAgentIds:_n,removeNode:wh,removeSelectedNode:Ka,removalNotice:Ve,bringBack:Ya,bringBackAll:oc,forgetRemovals:ki}=zee({stateRef:n,pinnedRef:br,positionsRef:Vr,canvasRef:Kr,clearSelection:k,primarySelectedId:g}),Xa=Dee({stateRef:n,now:vt,removedAgentIds:_n,sizeVersion:bi,domSizeVersion:ac});vee(Xa,Hr),Uee({layoutSig:Xa,rf:e,stateRef:n,measuredRef:Xr,pinnedRef:br,positionsRef:Vr,paneSizeRef:gh,lastInteractRef:xs,autoFitDisabledRef:na,lastFitTimeRef:tt,fitLeft:Sn});const Ni=ete(),{bubbling:ic,endBubble:ji,onBubble:Za}=nY(),[En,kr]=w.useState(!1),Hn=eY(),{beginTrashDrag:ra,trackTrashDrag:sa,endTrashDrag:Nr}=Hn,lc=dY({stateRef:n,measuredRef:Xr,measuredVersionRef:yh,canvasRef:Kr}),{lodRef:cc,applyZoom:aa}=lc,uc=Xee({applyViewport:xr,lastFitTimeRef:tt,cameraEpochRef:Wr,disableAutoFit:Yr,markInteract:tn,canvasRef:Kr,applyZoom:aa}),ks=g?n.current.agents.get(g):null,oa=o&&ks!=null,{railInsetRef:Si,availableWidth:dc,availableHeight:Ns}=aee({canvasRef:Kr,canvasSize:mh,machinePhase:L,usagePhase:q,usagePanelOpen:u,detailShown:oa}),js=Fee({stateRef:n,now:vt,availableWidth:dc,availableHeight:Ns,layout:Hr,measuredRef:Xr,onBubble:Za,settled:Ni,dragging:En,layoutSig:Xa,selectedIds:p,openContext:Vt,historyReplayed:en,removedNodes:Ga,removedAgentIds:_n,dragTick:Br,dragPatchRef:gs,dragMoveTick:zn}),{nodes:jr,edges:Ja}=js,_i=bn(g);xee({nodes:jr,edges:Ja,settled:Ni,dragging:En,availableWidth:dc,availableHeight:Ns,layout:Hr,camera:zr,rf:e,measuredRef:Xr,stateRef:n,lastFocusRef:ea,primarySelectedIdRef:_i,focusAgentRef:Gr,autoFitDisabledRef:na});const hc=tae({stateRef:n,pinnedRef:br,measuredRef:Xr,positionsRef:Vr,lastLayoutSigRef:vs,forgetRemovals:ki,clearSelection:k,rerender:s,modalOpenRef:Lt}),{requestClear:Qa}=hc,eo=rte({nodes:jr,stateRef:n,pinnedRef:br,positionsRef:Vr,draggingRef:bs,dragPatchRef:gs,setDragging:kr,setDragMoveTick:Wn,setDragTick:ms,endBubble:ji,markInteract:tn,disableAutoFit:Yr,beginTrashDrag:ra,trackTrashDrag:sa,endTrashDrag:Nr,removeNode:wh}),Ei=w.useCallback(()=>Sn(500),[Sn]),to=bn(jr),{focusAgent:pn,stepAgent:Ci,focusSession:Sr}=lee({canvasRef:Kr,stateRef:n,measuredRef:Xr,nodesRef:to,railInsetRef:Si,moveCamera:ws,disableAutoFit:Yr,lastFocusRef:ea,focusAgentRef:Gr,selectAgent:v,primarySelectedIdRef:_i}),fc=Zee({clearSelection:k,selectAgent:v,detailOpen:o,setDetailOpen:l,detailShown:oa,focusAgent:pn,draggingRef:bs,lodRef:cc}),no=cee({nodesRef:to,stateRef:n,canvasRef:Kr,railInsetRef:Si}),ro=bn(Ka),Ti=w.useRef(null),Gt=w.useCallback(Gn=>{_n.has(Gn)&&Ya([Gn]),Sr(Gn)},[_n,Ya,Sr]),Ss=tte();nte({pointerFocusRef:Ss,nodesRef:to,stateRef:n,primarySelectedIdRef:_i,providersRef:et,soundOnRef:U,keyHelpOpenRef:fn,modalOpenRef:Lt,waitingCursorRef:Ti,removeSelectedRef:ro,activateSoundRef:O,clearSelection:k,selectAgent:v,focusAgent:pn,stepAgent:Ci,focusSession:Sr,requestClear:Qa,handleRelayout:Va,handleFit:Ei,togglePause:Z,toggleSessionList:S,toggleAccountsPanel:_,setDetailOpen:l,setUsageHistoryOpen:pt,setUsagePanelOpen:d,setMachinePanelOpen:f,setBrowserWatchOpen:Ot,setSoundMenuOpen:Y,setKeyHelpOpen:Xe,setTheme:qe});const so=n.current.agents.size,Vn=w.useMemo(()=>ux(n.current.agents.values()),[n.current,n.current.revision]);Wee({stateRef:n,waitingSessions:Vn,removedAgentIds:_n,removedNodes:Ga,bringBack:Ya}),Gee({stateRef:n,waitingSessions:Vn,live:se});const pc=Zse({waitingSessions:Vn,watchUnseen:pr,incidents:wr}),ia=Jse({waitingSessions:Vn,liveSince:re,focusSession:Sr}),{loadNotifyPrefs:Ri}=ia;return uae({loadAutoRestartPrefs:Jt,loadNotifyPrefs:Ri,loadReportsPrefs:qt.loadReportsPrefs}),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(kne,{versionCheck:de,welcome:Oe,desktopUpdate:fe,pause:G,monthly:R,announcements:pc,notify:ia,waitingSessions:Vn,waitingCursorRef:Ti,focusSession:Sr,live:se,now:vt,incidents:wr}),ks&&a.jsx(Nne,{selected:ks,now:vt,selectedIds:p,focusAgent:pn,clearSelection:k}),a.jsxs("div",{className:"actions",children:[a.jsx(Jte,{sessionListOpen:x,toggleSessionList:S,usagePanelOpen:u,setUsagePanelOpen:d,setUsageHistoryOpen:pt}),a.jsx(Qte,{providers:Le,accountsPanelOpen:N,toggleAccountsPanel:_,machinePanelOpen:h,setMachinePanelOpen:f,watchOn:Bt,watchUnseen:pr,setBrowserWatchOpen:Ot}),a.jsx(ene,{providers:Le,sound:I,tones:M,customTones:H,notify:ia,chimeState:J,menus:D,appearance:ge,fm:Qt,reports:qt,onFeedback:()=>Ue.openFeedback()})]})]}),a.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:Ve?`${Ve.label} removed from the board.`:""}),a.jsx(Bne,{restart:vr,versionCheck:de,upgrade:Je,oldNameNotice:rt,everConnected:ae,live:se,paused:X}),qu(A)&&Le.claude&&a.jsx(GK,{leaving:A==="leaving",onClose:T,onReport:Ue.openFeedback}),x&&a.jsx(rW,{state:n.current,now:vt,selectedIds:p,onSelect:Gt,onClose:E,removedIds:_n,onBringBackAll:oc}),a.jsxs(Cne,{canvasRef:Kr,bubbling:ic,dragging:En,trash:Hn,zoom:lc,viewport:uc,stateRef:n,peek:no,children:[so===0&&(!se&&ue?a.jsx(dte,{}):a.jsx(hte,{live:se,everConnected:ae,providers:Le,workspace:Re,onTour:le})),(mr.length>1||gr.size>0)&&a.jsx(jne,{catBarRef:Ur,catBarOccluded:jn,presentCats:mr,hiddenCats:gr,toggleCat:Nn}),a.jsx(Yz,{graph:js,layout:Hr,viewport:uc,clicks:fc,drag:eo,appearance:ge,fm:Qt,autoFit:ta,pause:G,stateRef:n,measuredRef:Xr,hiddenCats:gr,now:vt,openTool:lt,focusAgent:pn,requestClear:Qa,setKeyHelpOpen:Xe})]}),qu(q)&&a.jsx(YW,{state:n.current,now:vt,providers:Le,incidents:wr,liveSince:re,leaving:q==="leaving",onClose:()=>d(!1)}),qu(L)&&a.jsx(MH,{usageOpen:u,leaving:L==="leaving",onClose:()=>f(!1)}),o&&ks?a.jsx(Ste,{selected:ks,now:vt,openTool:lt,setSummaryFor:He,setDetailOpen:l,stateRef:n,removeSelectedNode:Ka}):null,a.jsx(Hre,{dialogs:Ue,welcome:Oe,desktopUpdate:fe,versionCheck:de,restart:vr,lanPairs:qr,clearFlow:hc,watchBadge:Zt,announcements:pc,appearance:ge,providers:Le,stateRef:n,agentCount:so})]})}try{tB(window.localStorage)}catch{}const kae=q3.createRoot(document.getElementById("root"));kae.render(a.jsx(xae,{}));export{ote as a,ot as b,Ys as c,ql as d,Sae as e,Be as f,Ir as g,jae as h,Dl as i,a as j,hs as k,kY as l,ka as m,Ba as n,kx as p,w as r,or as s,yt as u};
|