agent-dag 3.3.0 → 3.4.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.
@@ -0,0 +1,171 @@
1
+ (function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))s(i);new MutationObserver(i=>{for(const a of i)if(a.type==="childList")for(const l of a.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&s(l)}).observe(document,{childList:!0,subtree:!0});function n(i){const a={};return i.integrity&&(a.integrity=i.integrity),i.referrerPolicy&&(a.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?a.credentials="include":i.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function s(i){if(i.ep)return;i.ep=!0;const a=n(i);fetch(i.href,a)}})();var Lc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Jy(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Rf={exports:{}},La={},Af={exports:{}},Ke={};/**
2
+ * @license React
3
+ * react.production.min.js
4
+ *
5
+ * Copyright (c) Facebook, Inc. and its affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var Hx;function FA(){if(Hx)return Ke;Hx=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),l=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),g=Symbol.iterator;function y($){return $===null||typeof $!="object"?null:($=g&&$[g]||$["@@iterator"],typeof $=="function"?$:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},N=Object.assign,b={};function _($,V,J){this.props=$,this.context=V,this.refs=b,this.updater=J||w}_.prototype.isReactComponent={},_.prototype.setState=function($,V){if(typeof $!="object"&&typeof $!="function"&&$!=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,$,V,"setState")},_.prototype.forceUpdate=function($){this.updater.enqueueForceUpdate(this,$,"forceUpdate")};function k(){}k.prototype=_.prototype;function E($,V,J){this.props=$,this.context=V,this.refs=b,this.updater=J||w}var j=E.prototype=new k;j.constructor=E,N(j,_.prototype),j.isPureReactComponent=!0;var C=Array.isArray,I=Object.prototype.hasOwnProperty,P={current:null},O={key:!0,ref:!0,__self:!0,__source:!0};function F($,V,J){var D,L={},X=null,se=null;if(V!=null)for(D in V.ref!==void 0&&(se=V.ref),V.key!==void 0&&(X=""+V.key),V)I.call(V,D)&&!O.hasOwnProperty(D)&&(L[D]=V[D]);var fe=arguments.length-2;if(fe===1)L.children=J;else if(1<fe){for(var pe=Array(fe),xe=0;xe<fe;xe++)pe[xe]=arguments[xe+2];L.children=pe}if($&&$.defaultProps)for(D in fe=$.defaultProps,fe)L[D]===void 0&&(L[D]=fe[D]);return{$$typeof:e,type:$,key:X,ref:se,props:L,_owner:P.current}}function M($,V){return{$$typeof:e,type:$.type,key:V,ref:$.ref,props:$.props,_owner:$._owner}}function A($){return typeof $=="object"&&$!==null&&$.$$typeof===e}function q($){var V={"=":"=0",":":"=2"};return"$"+$.replace(/[=:]/g,function(J){return V[J]})}var W=/\/+/g;function K($,V){return typeof $=="object"&&$!==null&&$.key!=null?q(""+$.key):V.toString(36)}function T($,V,J,D,L){var X=typeof $;(X==="undefined"||X==="boolean")&&($=null);var se=!1;if($===null)se=!0;else switch(X){case"string":case"number":se=!0;break;case"object":switch($.$$typeof){case e:case t:se=!0}}if(se)return se=$,L=L(se),$=D===""?"."+K(se,0):D,C(L)?(J="",$!=null&&(J=$.replace(W,"$&/")+"/"),T(L,V,J,"",function(xe){return xe})):L!=null&&(A(L)&&(L=M(L,J+(!L.key||se&&se.key===L.key?"":(""+L.key).replace(W,"$&/")+"/")+$)),V.push(L)),1;if(se=0,D=D===""?".":D+":",C($))for(var fe=0;fe<$.length;fe++){X=$[fe];var pe=D+K(X,fe);se+=T(X,V,J,pe,L)}else if(pe=y($),typeof pe=="function")for($=pe.call($),fe=0;!(X=$.next()).done;)X=X.value,pe=D+K(X,fe++),se+=T(X,V,J,pe,L);else if(X==="object")throw V=String($),Error("Objects are not valid as a React child (found: "+(V==="[object Object]"?"object with keys {"+Object.keys($).join(", ")+"}":V)+"). If you meant to render a collection of children, use an array instead.");return se}function Z($,V,J){if($==null)return $;var D=[],L=0;return T($,D,"","",function(X){return V.call(J,X,L++)}),D}function U($){if($._status===-1){var V=$._result;V=V(),V.then(function(J){($._status===0||$._status===-1)&&($._status=1,$._result=J)},function(J){($._status===0||$._status===-1)&&($._status=2,$._result=J)}),$._status===-1&&($._status=0,$._result=V)}if($._status===1)return $._result.default;throw $._result}var re={current:null},Q={transition:null},H={ReactCurrentDispatcher:re,ReactCurrentBatchConfig:Q,ReactCurrentOwner:P};function te(){throw Error("act(...) is not supported in production builds of React.")}return Ke.Children={map:Z,forEach:function($,V,J){Z($,function(){V.apply(this,arguments)},J)},count:function($){var V=0;return Z($,function(){V++}),V},toArray:function($){return Z($,function(V){return V})||[]},only:function($){if(!A($))throw Error("React.Children.only expected to receive a single React element child.");return $}},Ke.Component=_,Ke.Fragment=n,Ke.Profiler=i,Ke.PureComponent=E,Ke.StrictMode=s,Ke.Suspense=h,Ke.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=H,Ke.act=te,Ke.cloneElement=function($,V,J){if($==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+$+".");var D=N({},$.props),L=$.key,X=$.ref,se=$._owner;if(V!=null){if(V.ref!==void 0&&(X=V.ref,se=P.current),V.key!==void 0&&(L=""+V.key),$.type&&$.type.defaultProps)var fe=$.type.defaultProps;for(pe in V)I.call(V,pe)&&!O.hasOwnProperty(pe)&&(D[pe]=V[pe]===void 0&&fe!==void 0?fe[pe]:V[pe])}var pe=arguments.length-2;if(pe===1)D.children=J;else if(1<pe){fe=Array(pe);for(var xe=0;xe<pe;xe++)fe[xe]=arguments[xe+2];D.children=fe}return{$$typeof:e,type:$.type,key:L,ref:X,props:D,_owner:se}},Ke.createContext=function($){return $={$$typeof:l,_currentValue:$,_currentValue2:$,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},$.Provider={$$typeof:a,_context:$},$.Consumer=$},Ke.createElement=F,Ke.createFactory=function($){var V=F.bind(null,$);return V.type=$,V},Ke.createRef=function(){return{current:null}},Ke.forwardRef=function($){return{$$typeof:u,render:$}},Ke.isValidElement=A,Ke.lazy=function($){return{$$typeof:f,_payload:{_status:-1,_result:$},_init:U}},Ke.memo=function($,V){return{$$typeof:p,type:$,compare:V===void 0?null:V}},Ke.startTransition=function($){var V=Q.transition;Q.transition={};try{$()}finally{Q.transition=V}},Ke.unstable_act=te,Ke.useCallback=function($,V){return re.current.useCallback($,V)},Ke.useContext=function($){return re.current.useContext($)},Ke.useDebugValue=function(){},Ke.useDeferredValue=function($){return re.current.useDeferredValue($)},Ke.useEffect=function($,V){return re.current.useEffect($,V)},Ke.useId=function(){return re.current.useId()},Ke.useImperativeHandle=function($,V,J){return re.current.useImperativeHandle($,V,J)},Ke.useInsertionEffect=function($,V){return re.current.useInsertionEffect($,V)},Ke.useLayoutEffect=function($,V){return re.current.useLayoutEffect($,V)},Ke.useMemo=function($,V){return re.current.useMemo($,V)},Ke.useReducer=function($,V,J){return re.current.useReducer($,V,J)},Ke.useRef=function($){return re.current.useRef($)},Ke.useState=function($){return re.current.useState($)},Ke.useSyncExternalStore=function($,V,J){return re.current.useSyncExternalStore($,V,J)},Ke.useTransition=function(){return re.current.useTransition()},Ke.version="18.3.1",Ke}var Gx;function fl(){return Gx||(Gx=1,Af.exports=FA()),Af.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 Vx;function zA(){if(Vx)return La;Vx=1;var e=fl(),t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,i=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a={key:!0,ref:!0,__self:!0,__source:!0};function l(u,h,p){var f,g={},y=null,w=null;p!==void 0&&(y=""+p),h.key!==void 0&&(y=""+h.key),h.ref!==void 0&&(w=h.ref);for(f in h)s.call(h,f)&&!a.hasOwnProperty(f)&&(g[f]=h[f]);if(u&&u.defaultProps)for(f in h=u.defaultProps,h)g[f]===void 0&&(g[f]=h[f]);return{$$typeof:t,type:u,key:y,ref:w,props:g,_owner:i.current}}return La.Fragment=n,La.jsx=l,La.jsxs=l,La}var Yx;function BA(){return Yx||(Yx=1,Rf.exports=zA()),Rf.exports}var d=BA(),qc={},Mf={exports:{}},fn={},If={exports:{}},Of={};/**
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 Kx;function UA(){return Kx||(Kx=1,(function(e){function t(Q,H){var te=Q.length;Q.push(H);e:for(;0<te;){var $=te-1>>>1,V=Q[$];if(0<i(V,H))Q[$]=H,Q[te]=V,te=$;else break e}}function n(Q){return Q.length===0?null:Q[0]}function s(Q){if(Q.length===0)return null;var H=Q[0],te=Q.pop();if(te!==H){Q[0]=te;e:for(var $=0,V=Q.length,J=V>>>1;$<J;){var D=2*($+1)-1,L=Q[D],X=D+1,se=Q[X];if(0>i(L,te))X<V&&0>i(se,L)?(Q[$]=se,Q[X]=te,$=X):(Q[$]=L,Q[D]=te,$=D);else if(X<V&&0>i(se,te))Q[$]=se,Q[X]=te,$=X;else break e}}return H}function i(Q,H){var te=Q.sortIndex-H.sortIndex;return te!==0?te:Q.id-H.id}if(typeof performance=="object"&&typeof performance.now=="function"){var a=performance;e.unstable_now=function(){return a.now()}}else{var l=Date,u=l.now();e.unstable_now=function(){return l.now()-u}}var h=[],p=[],f=1,g=null,y=3,w=!1,N=!1,b=!1,_=typeof setTimeout=="function"?setTimeout:null,k=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function j(Q){for(var H=n(p);H!==null;){if(H.callback===null)s(p);else if(H.startTime<=Q)s(p),H.sortIndex=H.expirationTime,t(h,H);else break;H=n(p)}}function C(Q){if(b=!1,j(Q),!N)if(n(h)!==null)N=!0,U(I);else{var H=n(p);H!==null&&re(C,H.startTime-Q)}}function I(Q,H){N=!1,b&&(b=!1,k(F),F=-1),w=!0;var te=y;try{for(j(H),g=n(h);g!==null&&(!(g.expirationTime>H)||Q&&!q());){var $=g.callback;if(typeof $=="function"){g.callback=null,y=g.priorityLevel;var V=$(g.expirationTime<=H);H=e.unstable_now(),typeof V=="function"?g.callback=V:g===n(h)&&s(h),j(H)}else s(h);g=n(h)}if(g!==null)var J=!0;else{var D=n(p);D!==null&&re(C,D.startTime-H),J=!1}return J}finally{g=null,y=te,w=!1}}var P=!1,O=null,F=-1,M=5,A=-1;function q(){return!(e.unstable_now()-A<M)}function W(){if(O!==null){var Q=e.unstable_now();A=Q;var H=!0;try{H=O(!0,Q)}finally{H?K():(P=!1,O=null)}}else P=!1}var K;if(typeof E=="function")K=function(){E(W)};else if(typeof MessageChannel<"u"){var T=new MessageChannel,Z=T.port2;T.port1.onmessage=W,K=function(){Z.postMessage(null)}}else K=function(){_(W,0)};function U(Q){O=Q,P||(P=!0,K())}function re(Q,H){F=_(function(){Q(e.unstable_now())},H)}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(Q){Q.callback=null},e.unstable_continueExecution=function(){N||w||(N=!0,U(I))},e.unstable_forceFrameRate=function(Q){0>Q||125<Q?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):M=0<Q?Math.floor(1e3/Q):5},e.unstable_getCurrentPriorityLevel=function(){return y},e.unstable_getFirstCallbackNode=function(){return n(h)},e.unstable_next=function(Q){switch(y){case 1:case 2:case 3:var H=3;break;default:H=y}var te=y;y=H;try{return Q()}finally{y=te}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(Q,H){switch(Q){case 1:case 2:case 3:case 4:case 5:break;default:Q=3}var te=y;y=Q;try{return H()}finally{y=te}},e.unstable_scheduleCallback=function(Q,H,te){var $=e.unstable_now();switch(typeof te=="object"&&te!==null?(te=te.delay,te=typeof te=="number"&&0<te?$+te:$):te=$,Q){case 1:var V=-1;break;case 2:V=250;break;case 5:V=1073741823;break;case 4:V=1e4;break;default:V=5e3}return V=te+V,Q={id:f++,callback:H,priorityLevel:Q,startTime:te,expirationTime:V,sortIndex:-1},te>$?(Q.sortIndex=te,t(p,Q),n(h)===null&&Q===n(p)&&(b?(k(F),F=-1):b=!0,re(C,te-$))):(Q.sortIndex=V,t(h,Q),N||w||(N=!0,U(I))),Q},e.unstable_shouldYield=q,e.unstable_wrapCallback=function(Q){var H=y;return function(){var te=y;y=H;try{return Q.apply(this,arguments)}finally{y=te}}}})(Of)),Of}var Xx;function WA(){return Xx||(Xx=1,If.exports=UA()),If.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 Qx;function HA(){if(Qx)return fn;Qx=1;var e=fl(),t=WA();function n(r){for(var o="https://reactjs.org/docs/error-decoder.html?invariant="+r,c=1;c<arguments.length;c++)o+="&args[]="+encodeURIComponent(arguments[c]);return"Minified React error #"+r+"; visit "+o+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var s=new Set,i={};function a(r,o){l(r,o),l(r+"Capture",o)}function l(r,o){for(i[r]=o,r=0;r<o.length;r++)s.add(o[r])}var u=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),h=Object.prototype.hasOwnProperty,p=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,f={},g={};function y(r){return h.call(g,r)?!0:h.call(f,r)?!1:p.test(r)?g[r]=!0:(f[r]=!0,!1)}function w(r,o,c,m){if(c!==null&&c.type===0)return!1;switch(typeof o){case"function":case"symbol":return!0;case"boolean":return m?!1:c!==null?!c.acceptsBooleans:(r=r.toLowerCase().slice(0,5),r!=="data-"&&r!=="aria-");default:return!1}}function N(r,o,c,m){if(o===null||typeof o>"u"||w(r,o,c,m))return!0;if(m)return!1;if(c!==null)switch(c.type){case 3:return!o;case 4:return o===!1;case 5:return isNaN(o);case 6:return isNaN(o)||1>o}return!1}function b(r,o,c,m,v,x,R){this.acceptsBooleans=o===2||o===3||o===4,this.attributeName=m,this.attributeNamespace=v,this.mustUseProperty=c,this.propertyName=r,this.type=o,this.sanitizeURL=x,this.removeEmptyString=R}var _={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(r){_[r]=new b(r,0,!1,r,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(r){var o=r[0];_[o]=new b(o,1,!1,r[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(r){_[r]=new b(r,2,!1,r.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(r){_[r]=new b(r,2,!1,r,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(r){_[r]=new b(r,3,!1,r.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(r){_[r]=new b(r,3,!0,r,null,!1,!1)}),["capture","download"].forEach(function(r){_[r]=new b(r,4,!1,r,null,!1,!1)}),["cols","rows","size","span"].forEach(function(r){_[r]=new b(r,6,!1,r,null,!1,!1)}),["rowSpan","start"].forEach(function(r){_[r]=new b(r,5,!1,r.toLowerCase(),null,!1,!1)});var k=/[\-:]([a-z])/g;function E(r){return r[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(r){var o=r.replace(k,E);_[o]=new b(o,1,!1,r,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(r){var o=r.replace(k,E);_[o]=new b(o,1,!1,r,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(r){var o=r.replace(k,E);_[o]=new b(o,1,!1,r,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(r){_[r]=new b(r,1,!1,r.toLowerCase(),null,!1,!1)}),_.xlinkHref=new b("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(r){_[r]=new b(r,1,!1,r.toLowerCase(),null,!0,!0)});function j(r,o,c,m){var v=_.hasOwnProperty(o)?_[o]:null;(v!==null?v.type!==0:m||!(2<o.length)||o[0]!=="o"&&o[0]!=="O"||o[1]!=="n"&&o[1]!=="N")&&(N(o,c,v,m)&&(c=null),m||v===null?y(o)&&(c===null?r.removeAttribute(o):r.setAttribute(o,""+c)):v.mustUseProperty?r[v.propertyName]=c===null?v.type===3?!1:"":c:(o=v.attributeName,m=v.attributeNamespace,c===null?r.removeAttribute(o):(v=v.type,c=v===3||v===4&&c===!0?"":""+c,m?r.setAttributeNS(m,o,c):r.setAttribute(o,c))))}var C=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,I=Symbol.for("react.element"),P=Symbol.for("react.portal"),O=Symbol.for("react.fragment"),F=Symbol.for("react.strict_mode"),M=Symbol.for("react.profiler"),A=Symbol.for("react.provider"),q=Symbol.for("react.context"),W=Symbol.for("react.forward_ref"),K=Symbol.for("react.suspense"),T=Symbol.for("react.suspense_list"),Z=Symbol.for("react.memo"),U=Symbol.for("react.lazy"),re=Symbol.for("react.offscreen"),Q=Symbol.iterator;function H(r){return r===null||typeof r!="object"?null:(r=Q&&r[Q]||r["@@iterator"],typeof r=="function"?r:null)}var te=Object.assign,$;function V(r){if($===void 0)try{throw Error()}catch(c){var o=c.stack.trim().match(/\n( *(at )?)/);$=o&&o[1]||""}return`
34
+ `+$+r}var J=!1;function D(r,o){if(!r||J)return"";J=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(o)if(o=function(){throw Error()},Object.defineProperty(o.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(o,[])}catch(ce){var m=ce}Reflect.construct(r,[],o)}else{try{o.call()}catch(ce){m=ce}r.call(o.prototype)}else{try{throw Error()}catch(ce){m=ce}r()}}catch(ce){if(ce&&m&&typeof ce.stack=="string"){for(var v=ce.stack.split(`
35
+ `),x=m.stack.split(`
36
+ `),R=v.length-1,B=x.length-1;1<=R&&0<=B&&v[R]!==x[B];)B--;for(;1<=R&&0<=B;R--,B--)if(v[R]!==x[B]){if(R!==1||B!==1)do if(R--,B--,0>B||v[R]!==x[B]){var ee=`
37
+ `+v[R].replace(" at new "," at ");return r.displayName&&ee.includes("<anonymous>")&&(ee=ee.replace("<anonymous>",r.displayName)),ee}while(1<=R&&0<=B);break}}}finally{J=!1,Error.prepareStackTrace=c}return(r=r?r.displayName||r.name:"")?V(r):""}function L(r){switch(r.tag){case 5:return V(r.type);case 16:return V("Lazy");case 13:return V("Suspense");case 19:return V("SuspenseList");case 0:case 2:case 15:return r=D(r.type,!1),r;case 11:return r=D(r.type.render,!1),r;case 1:return r=D(r.type,!0),r;default:return""}}function X(r){if(r==null)return null;if(typeof r=="function")return r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case O:return"Fragment";case P:return"Portal";case M:return"Profiler";case F:return"StrictMode";case K:return"Suspense";case T:return"SuspenseList"}if(typeof r=="object")switch(r.$$typeof){case q:return(r.displayName||"Context")+".Consumer";case A:return(r._context.displayName||"Context")+".Provider";case W:var o=r.render;return r=r.displayName,r||(r=o.displayName||o.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case Z:return o=r.displayName||null,o!==null?o:X(r.type)||"Memo";case U:o=r._payload,r=r._init;try{return X(r(o))}catch{}}return null}function se(r){var o=r.type;switch(r.tag){case 24:return"Cache";case 9:return(o.displayName||"Context")+".Consumer";case 10:return(o._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return r=o.render,r=r.displayName||r.name||"",o.displayName||(r!==""?"ForwardRef("+r+")":"ForwardRef");case 7:return"Fragment";case 5:return o;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return X(o);case 8:return o===F?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o}return null}function fe(r){switch(typeof r){case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function pe(r){var o=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(o==="checkbox"||o==="radio")}function xe(r){var o=pe(r)?"checked":"value",c=Object.getOwnPropertyDescriptor(r.constructor.prototype,o),m=""+r[o];if(!r.hasOwnProperty(o)&&typeof c<"u"&&typeof c.get=="function"&&typeof c.set=="function"){var v=c.get,x=c.set;return Object.defineProperty(r,o,{configurable:!0,get:function(){return v.call(this)},set:function(R){m=""+R,x.call(this,R)}}),Object.defineProperty(r,o,{enumerable:c.enumerable}),{getValue:function(){return m},setValue:function(R){m=""+R},stopTracking:function(){r._valueTracker=null,delete r[o]}}}}function je(r){r._valueTracker||(r._valueTracker=xe(r))}function He(r){if(!r)return!1;var o=r._valueTracker;if(!o)return!0;var c=o.getValue(),m="";return r&&(m=pe(r)?r.checked?"true":"false":r.value),r=m,r!==c?(o.setValue(r),!0):!1}function De(r){if(r=r||(typeof document<"u"?document:void 0),typeof r>"u")return null;try{return r.activeElement||r.body}catch{return r.body}}function Me(r,o){var c=o.checked;return te({},o,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:c??r._wrapperState.initialChecked})}function _e(r,o){var c=o.defaultValue==null?"":o.defaultValue,m=o.checked!=null?o.checked:o.defaultChecked;c=fe(o.value!=null?o.value:c),r._wrapperState={initialChecked:m,initialValue:c,controlled:o.type==="checkbox"||o.type==="radio"?o.checked!=null:o.value!=null}}function G(r,o){o=o.checked,o!=null&&j(r,"checked",o,!1)}function he(r,o){G(r,o);var c=fe(o.value),m=o.type;if(c!=null)m==="number"?(c===0&&r.value===""||r.value!=c)&&(r.value=""+c):r.value!==""+c&&(r.value=""+c);else if(m==="submit"||m==="reset"){r.removeAttribute("value");return}o.hasOwnProperty("value")?We(r,o.type,c):o.hasOwnProperty("defaultValue")&&We(r,o.type,fe(o.defaultValue)),o.checked==null&&o.defaultChecked!=null&&(r.defaultChecked=!!o.defaultChecked)}function ve(r,o,c){if(o.hasOwnProperty("value")||o.hasOwnProperty("defaultValue")){var m=o.type;if(!(m!=="submit"&&m!=="reset"||o.value!==void 0&&o.value!==null))return;o=""+r._wrapperState.initialValue,c||o===r.value||(r.value=o),r.defaultValue=o}c=r.name,c!==""&&(r.name=""),r.defaultChecked=!!r._wrapperState.initialChecked,c!==""&&(r.name=c)}function We(r,o,c){(o!=="number"||De(r.ownerDocument)!==r)&&(c==null?r.defaultValue=""+r._wrapperState.initialValue:r.defaultValue!==""+c&&(r.defaultValue=""+c))}var at=Array.isArray;function rt(r,o,c,m){if(r=r.options,o){o={};for(var v=0;v<c.length;v++)o["$"+c[v]]=!0;for(c=0;c<r.length;c++)v=o.hasOwnProperty("$"+r[c].value),r[c].selected!==v&&(r[c].selected=v),v&&m&&(r[c].defaultSelected=!0)}else{for(c=""+fe(c),o=null,v=0;v<r.length;v++){if(r[v].value===c){r[v].selected=!0,m&&(r[v].defaultSelected=!0);return}o!==null||r[v].disabled||(o=r[v])}o!==null&&(o.selected=!0)}}function Be(r,o){if(o.dangerouslySetInnerHTML!=null)throw Error(n(91));return te({},o,{value:void 0,defaultValue:void 0,children:""+r._wrapperState.initialValue})}function Ie(r,o){var c=o.value;if(c==null){if(c=o.children,o=o.defaultValue,c!=null){if(o!=null)throw Error(n(92));if(at(c)){if(1<c.length)throw Error(n(93));c=c[0]}o=c}o==null&&(o=""),c=o}r._wrapperState={initialValue:fe(c)}}function Je(r,o){var c=fe(o.value),m=fe(o.defaultValue);c!=null&&(c=""+c,c!==r.value&&(r.value=c),o.defaultValue==null&&r.defaultValue!==c&&(r.defaultValue=c)),m!=null&&(r.defaultValue=""+m)}function Ge(r){var o=r.textContent;o===r._wrapperState.initialValue&&o!==""&&o!==null&&(r.value=o)}function Qe(r){switch(r){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Oe(r,o){return r==null||r==="http://www.w3.org/1999/xhtml"?Qe(o):r==="http://www.w3.org/2000/svg"&&o==="foreignObject"?"http://www.w3.org/1999/xhtml":r}var lt,Mt=(function(r){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(o,c,m,v){MSApp.execUnsafeLocalFunction(function(){return r(o,c,m,v)})}:r})(function(r,o){if(r.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in r)r.innerHTML=o;else{for(lt=lt||document.createElement("div"),lt.innerHTML="<svg>"+o.valueOf().toString()+"</svg>",o=lt.firstChild;r.firstChild;)r.removeChild(r.firstChild);for(;o.firstChild;)r.appendChild(o.firstChild)}});function ae(r,o){if(o){var c=r.firstChild;if(c&&c===r.lastChild&&c.nodeType===3){c.nodeValue=o;return}}r.textContent=o}var $e={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Fe=["Webkit","ms","Moz","O"];Object.keys($e).forEach(function(r){Fe.forEach(function(o){o=o+r.charAt(0).toUpperCase()+r.substring(1),$e[o]=$e[r]})});function Ne(r,o,c){return o==null||typeof o=="boolean"||o===""?"":c||typeof o!="number"||o===0||$e.hasOwnProperty(r)&&$e[r]?(""+o).trim():o+"px"}function Ye(r,o){r=r.style;for(var c in o)if(o.hasOwnProperty(c)){var m=c.indexOf("--")===0,v=Ne(c,o[c],m);c==="float"&&(c="cssFloat"),m?r.setProperty(c,v):r[c]=v}}var Et=te({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 st(r,o){if(o){if(Et[r]&&(o.children!=null||o.dangerouslySetInnerHTML!=null))throw Error(n(137,r));if(o.dangerouslySetInnerHTML!=null){if(o.children!=null)throw Error(n(60));if(typeof o.dangerouslySetInnerHTML!="object"||!("__html"in o.dangerouslySetInnerHTML))throw Error(n(61))}if(o.style!=null&&typeof o.style!="object")throw Error(n(62))}}function Te(r,o){if(r.indexOf("-")===-1)return typeof o.is=="string";switch(r){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var xt=null;function ut(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var kt=null,Nn=null,zn=null;function En(r){if(r=_a(r)){if(typeof kt!="function")throw Error(n(280));var o=r.stateNode;o&&(o=Zl(o),kt(r.stateNode,r.type,o))}}function jo(r){Nn?zn?zn.push(r):zn=[r]:Nn=r}function mn(){if(Nn){var r=Nn,o=zn;if(zn=Nn=null,En(r),o)for(r=0;r<o.length;r++)En(o[r])}}function Co(r,o){return r(o)}function To(){}var Bt=!1;function Cr(r,o,c){if(Bt)return r(o,c);Bt=!0;try{return Co(r,o,c)}finally{Bt=!1,(Nn!==null||zn!==null)&&(To(),mn())}}function Bn(r,o){var c=r.stateNode;if(c===null)return null;var m=Zl(c);if(m===null)return null;c=m[o];e:switch(o){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(m=!m.disabled)||(r=r.type,m=!(r==="button"||r==="input"||r==="select"||r==="textarea")),r=!m;break e;default:r=!1}if(r)return null;if(c&&typeof c!="function")throw Error(n(231,o,typeof c));return c}var Ps=!1;if(u)try{var Tr={};Object.defineProperty(Tr,"passive",{get:function(){Ps=!0}}),window.addEventListener("test",Tr,Tr),window.removeEventListener("test",Tr,Tr)}catch{Ps=!1}function Qi(r,o,c,m,v,x,R,B,ee){var ce=Array.prototype.slice.call(arguments,3);try{o.apply(c,ce)}catch(ge){this.onError(ge)}}var fr=!1,Rr=null,hr=!1,es=null,Ro={onError:function(r){fr=!0,Rr=r}};function Ao(r,o,c,m,v,x,R,B,ee){fr=!1,Rr=null,Qi.apply(Ro,arguments)}function Mo(r,o,c,m,v,x,R,B,ee){if(Ao.apply(this,arguments),fr){if(fr){var ce=Rr;fr=!1,Rr=null}else throw Error(n(198));hr||(hr=!0,es=ce)}}function jn(r){var o=r,c=r;if(r.alternate)for(;o.return;)o=o.return;else{r=o;do o=r,(o.flags&4098)!==0&&(c=o.return),r=o.return;while(r)}return o.tag===3?c:null}function Io(r){if(r.tag===13){var o=r.memoizedState;if(o===null&&(r=r.alternate,r!==null&&(o=r.memoizedState)),o!==null)return o.dehydrated}return null}function Ar(r){if(jn(r)!==r)throw Error(n(188))}function Oo(r){var o=r.alternate;if(!o){if(o=jn(r),o===null)throw Error(n(188));return o!==r?null:r}for(var c=r,m=o;;){var v=c.return;if(v===null)break;var x=v.alternate;if(x===null){if(m=v.return,m!==null){c=m;continue}break}if(v.child===x.child){for(x=v.child;x;){if(x===c)return Ar(v),r;if(x===m)return Ar(v),o;x=x.sibling}throw Error(n(188))}if(c.return!==m.return)c=v,m=x;else{for(var R=!1,B=v.child;B;){if(B===c){R=!0,c=v,m=x;break}if(B===m){R=!0,m=v,c=x;break}B=B.sibling}if(!R){for(B=x.child;B;){if(B===c){R=!0,c=x,m=v;break}if(B===m){R=!0,m=x,c=v;break}B=B.sibling}if(!R)throw Error(n(189))}}if(c.alternate!==m)throw Error(n(190))}if(c.tag!==3)throw Error(n(188));return c.stateNode.current===c?r:o}function Un(r){return r=Oo(r),r!==null?Po(r):null}function Po(r){if(r.tag===5||r.tag===6)return r;for(r=r.child;r!==null;){var o=Po(r);if(o!==null)return o;r=r.sibling}return null}var $s=t.unstable_scheduleCallback,Ls=t.unstable_cancelCallback,$o=t.unstable_shouldYield,Lo=t.unstable_requestPaint,ot=t.unstable_now,Zi=t.unstable_getCurrentPriorityLevel,ts=t.unstable_ImmediatePriority,Gt=t.unstable_UserBlockingPriority,Wn=t.unstable_NormalPriority,qo=t.unstable_LowPriority,ns=t.unstable_IdlePriority,mt=null,sn=null;function Hn(r){if(sn&&typeof sn.onCommitFiberRoot=="function")try{sn.onCommitFiberRoot(mt,r,void 0,(r.current.flags&128)===128)}catch{}}var gn=Math.clz32?Math.clz32:Do,rd=Math.log,Mr=Math.LN2;function Do(r){return r>>>=0,r===0?32:31-(rd(r)/Mr|0)|0}var Fo=64,zo=4194304;function rs(r){switch(r&-r){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return r&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return r&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return r}}function qs(r,o){var c=r.pendingLanes;if(c===0)return 0;var m=0,v=r.suspendedLanes,x=r.pingedLanes,R=c&268435455;if(R!==0){var B=R&~v;B!==0?m=rs(B):(x&=R,x!==0&&(m=rs(x)))}else R=c&~v,R!==0?m=rs(R):x!==0&&(m=rs(x));if(m===0)return 0;if(o!==0&&o!==m&&(o&v)===0&&(v=m&-m,x=o&-o,v>=x||v===16&&(x&4194240)!==0))return o;if((m&4)!==0&&(m|=c&16),o=r.entangledLanes,o!==0)for(r=r.entanglements,o&=m;0<o;)c=31-gn(o),v=1<<c,m|=r[c],o&=~v;return m}function ss(r,o){switch(r){case 1:case 2:case 4:return o+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return o+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function jl(r,o){for(var c=r.suspendedLanes,m=r.pingedLanes,v=r.expirationTimes,x=r.pendingLanes;0<x;){var R=31-gn(x),B=1<<R,ee=v[R];ee===-1?((B&c)===0||(B&m)!==0)&&(v[R]=ss(B,o)):ee<=o&&(r.expiredLanes|=B),x&=~B}}function Bo(r){return r=r.pendingLanes&-1073741825,r!==0?r:r&1073741824?1073741824:0}function Ds(){var r=Fo;return Fo<<=1,(Fo&4194240)===0&&(Fo=64),r}function Uo(r){for(var o=[],c=0;31>c;c++)o.push(r);return o}function os(r,o,c){r.pendingLanes|=o,o!==536870912&&(r.suspendedLanes=0,r.pingedLanes=0),r=r.eventTimes,o=31-gn(o),r[o]=c}function Jt(r,o){var c=r.pendingLanes&~o;r.pendingLanes=o,r.suspendedLanes=0,r.pingedLanes=0,r.expiredLanes&=o,r.mutableReadLanes&=o,r.entangledLanes&=o,o=r.entanglements;var m=r.eventTimes;for(r=r.expirationTimes;0<c;){var v=31-gn(c),x=1<<v;o[v]=0,m[v]=-1,r[v]=-1,c&=~x}}function is(r,o){var c=r.entangledLanes|=o;for(r=r.entanglements;c;){var m=31-gn(c),v=1<<m;v&o|r[m]&o&&(r[m]|=o),c&=~v}}var Ze=0;function Ji(r){return r&=-r,1<r?4<r?(r&268435455)!==0?16:536870912:4:1}var Cl,Ir,ea,Gn,Tl,Wo=!1,Ho=[],pr=null,Vn=null,mr=null,vn=new Map,Yn=new Map,Kn=[],ta="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function Xn(r,o){switch(r){case"focusin":case"focusout":pr=null;break;case"dragenter":case"dragleave":Vn=null;break;case"mouseover":case"mouseout":mr=null;break;case"pointerover":case"pointerout":vn.delete(o.pointerId);break;case"gotpointercapture":case"lostpointercapture":Yn.delete(o.pointerId)}}function Fs(r,o,c,m,v,x){return r===null||r.nativeEvent!==x?(r={blockedOn:o,domEventName:c,eventSystemFlags:m,nativeEvent:x,targetContainers:[v]},o!==null&&(o=_a(o),o!==null&&Ir(o)),r):(r.eventSystemFlags|=m,o=r.targetContainers,v!==null&&o.indexOf(v)===-1&&o.push(v),r)}function Cn(r,o,c,m,v){switch(o){case"focusin":return pr=Fs(pr,r,o,c,m,v),!0;case"dragenter":return Vn=Fs(Vn,r,o,c,m,v),!0;case"mouseover":return mr=Fs(mr,r,o,c,m,v),!0;case"pointerover":var x=v.pointerId;return vn.set(x,Fs(vn.get(x)||null,r,o,c,m,v)),!0;case"gotpointercapture":return x=v.pointerId,Yn.set(x,Fs(Yn.get(x)||null,r,o,c,m,v)),!0}return!1}function Go(r){var o=eo(r.target);if(o!==null){var c=jn(o);if(c!==null){if(o=c.tag,o===13){if(o=Io(c),o!==null){r.blockedOn=o,Tl(r.priority,function(){ea(c)});return}}else if(o===3&&c.stateNode.current.memoizedState.isDehydrated){r.blockedOn=c.tag===3?c.stateNode.containerInfo:null;return}}}r.blockedOn=null}function as(r){if(r.blockedOn!==null)return!1;for(var o=r.targetContainers;0<o.length;){var c=Yo(r.domEventName,r.eventSystemFlags,o[0],r.nativeEvent);if(c===null){c=r.nativeEvent;var m=new c.constructor(c.type,c);xt=m,c.target.dispatchEvent(m),xt=null}else return o=_a(c),o!==null&&Ir(o),r.blockedOn=c,!1;o.shift()}return!0}function na(r,o,c){as(r)&&c.delete(o)}function Vo(){Wo=!1,pr!==null&&as(pr)&&(pr=null),Vn!==null&&as(Vn)&&(Vn=null),mr!==null&&as(mr)&&(mr=null),vn.forEach(na),Yn.forEach(na)}function Or(r,o){r.blockedOn===o&&(r.blockedOn=null,Wo||(Wo=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Vo)))}function ls(r){function o(v){return Or(v,r)}if(0<Ho.length){Or(Ho[0],r);for(var c=1;c<Ho.length;c++){var m=Ho[c];m.blockedOn===r&&(m.blockedOn=null)}}for(pr!==null&&Or(pr,r),Vn!==null&&Or(Vn,r),mr!==null&&Or(mr,r),vn.forEach(o),Yn.forEach(o),c=0;c<Kn.length;c++)m=Kn[c],m.blockedOn===r&&(m.blockedOn=null);for(;0<Kn.length&&(c=Kn[0],c.blockedOn===null);)Go(c),c.blockedOn===null&&Kn.shift()}var gr=C.ReactCurrentBatchConfig,zs=!0;function ra(r,o,c,m){var v=Ze,x=gr.transition;gr.transition=null;try{Ze=1,vr(r,o,c,m)}finally{Ze=v,gr.transition=x}}function Rl(r,o,c,m){var v=Ze,x=gr.transition;gr.transition=null;try{Ze=4,vr(r,o,c,m)}finally{Ze=v,gr.transition=x}}function vr(r,o,c,m){if(zs){var v=Yo(r,o,c,m);if(v===null)wd(r,o,m,Bs,c),Xn(r,m);else if(Cn(v,r,o,c,m))m.stopPropagation();else if(Xn(r,m),o&4&&-1<ta.indexOf(r)){for(;v!==null;){var x=_a(v);if(x!==null&&Cl(x),x=Yo(r,o,c,m),x===null&&wd(r,o,m,Bs,c),x===v)break;v=x}v!==null&&m.stopPropagation()}else wd(r,o,m,null,c)}}var Bs=null;function Yo(r,o,c,m){if(Bs=null,r=ut(m),r=eo(r),r!==null)if(o=jn(r),o===null)r=null;else if(c=o.tag,c===13){if(r=Io(o),r!==null)return r;r=null}else if(c===3){if(o.stateNode.current.memoizedState.isDehydrated)return o.tag===3?o.stateNode.containerInfo:null;r=null}else o!==r&&(r=null);return Bs=r,null}function Ko(r){switch(r){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(Zi()){case ts:return 1;case Gt:return 4;case Wn:case qo:return 16;case ns:return 536870912;default:return 16}default:return 16}}var yr=null,Us=null,Qn=null;function sa(){if(Qn)return Qn;var r,o=Us,c=o.length,m,v="value"in yr?yr.value:yr.textContent,x=v.length;for(r=0;r<c&&o[r]===v[r];r++);var R=c-r;for(m=1;m<=R&&o[c-m]===v[x-m];m++);return Qn=v.slice(r,1<m?1-m:void 0)}function Xo(r){var o=r.keyCode;return"charCode"in r?(r=r.charCode,r===0&&o===13&&(r=13)):r=o,r===10&&(r=13),32<=r||r===13?r:0}function Ws(){return!0}function oa(){return!1}function en(r){function o(c,m,v,x,R){this._reactName=c,this._targetInst=v,this.type=m,this.nativeEvent=x,this.target=R,this.currentTarget=null;for(var B in r)r.hasOwnProperty(B)&&(c=r[B],this[B]=c?c(x):x[B]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?Ws:oa,this.isPropagationStopped=oa,this}return te(o.prototype,{preventDefault:function(){this.defaultPrevented=!0;var c=this.nativeEvent;c&&(c.preventDefault?c.preventDefault():typeof c.returnValue!="unknown"&&(c.returnValue=!1),this.isDefaultPrevented=Ws)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=Ws)},persist:function(){},isPersistent:Ws}),o}var It={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ia=en(It),Pr=te({},It,{view:0,detail:0}),cs=en(Pr),$r,Hs,Lr,Gs=te({},Pr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Tn,button:0,buttons:0,relatedTarget:function(r){return r.relatedTarget===void 0?r.fromElement===r.srcElement?r.toElement:r.fromElement:r.relatedTarget},movementX:function(r){return"movementX"in r?r.movementX:(r!==Lr&&(Lr&&r.type==="mousemove"?($r=r.screenX-Lr.screenX,Hs=r.screenY-Lr.screenY):Hs=$r=0,Lr=r),$r)},movementY:function(r){return"movementY"in r?r.movementY:Hs}}),Vs=en(Gs),Al=te({},Gs,{dataTransfer:0}),sd=en(Al),od=te({},Pr,{relatedTarget:0}),Qo=en(od),id=te({},It,{animationName:0,elapsedTime:0,pseudoElement:0}),ad=en(id),aa=te({},It,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),wr=en(aa),la=te({},It,{data:0}),ca=en(la),ld={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},cd={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 Il(r){var o=this.nativeEvent;return o.getModifierState?o.getModifierState(r):(r=Ml[r])?!!o[r]:!1}function Tn(){return Il}var ud=te({},Pr,{key:function(r){if(r.key){var o=ld[r.key]||r.key;if(o!=="Unidentified")return o}return r.type==="keypress"?(r=Xo(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?cd[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Tn,charCode:function(r){return r.type==="keypress"?Xo(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?Xo(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),Ol=en(ud),dd=te({},Gs,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Ys=en(dd),fd=te({},Pr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Tn}),tn=en(fd),ua=te({},It,{propertyName:0,elapsedTime:0,pseudoElement:0}),Pl=en(ua),$l=te({},Gs,{deltaX:function(r){return"deltaX"in r?r.deltaX:"wheelDeltaX"in r?-r.wheelDeltaX:0},deltaY:function(r){return"deltaY"in r?r.deltaY:"wheelDeltaY"in r?-r.wheelDeltaY:"wheelDelta"in r?-r.wheelDelta:0},deltaZ:0,deltaMode:0}),Ll=en($l),da=[9,13,27,32],us=u&&"CompositionEvent"in window,qr=null;u&&"documentMode"in document&&(qr=document.documentMode);var ql=u&&"TextEvent"in window&&!qr,Ks=u&&(!us||qr&&8<qr&&11>=qr),fa=" ",Zo=!1;function ha(r,o){switch(r){case"keyup":return da.indexOf(o.keyCode)!==-1;case"keydown":return o.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Jo(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var Vt=!1;function Dl(r,o){switch(r){case"compositionend":return Jo(o);case"keypress":return o.which!==32?null:(Zo=!0,fa);case"textInput":return r=o.data,r===fa&&Zo?null:r;default:return null}}function Fl(r,o){if(Vt)return r==="compositionend"||!us&&ha(r,o)?(r=sa(),Qn=Us=yr=null,Vt=!1,r):null;switch(r){case"paste":return null;case"keypress":if(!(o.ctrlKey||o.altKey||o.metaKey)||o.ctrlKey&&o.altKey){if(o.char&&1<o.char.length)return o.char;if(o.which)return String.fromCharCode(o.which)}return null;case"compositionend":return Ks&&o.locale!=="ko"?null:o.data;default:return null}}var hd={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 zl(r){var o=r&&r.nodeName&&r.nodeName.toLowerCase();return o==="input"?!!hd[r.type]:o==="textarea"}function pa(r,o,c,m){jo(m),o=Kl(o,"onChange"),0<o.length&&(c=new ia("onChange","change",null,c,m),r.push({event:c,listeners:o}))}var Lt=null,ds=null;function Bl(r){a0(r,0)}function Xs(r){var o=si(r);if(He(o))return r}function Ul(r,o){if(r==="change")return o}var z=!1;if(u){var Y;if(u){var le="oninput"in document;if(!le){var de=document.createElement("div");de.setAttribute("oninput","return;"),le=typeof de.oninput=="function"}Y=le}else Y=!1;z=Y&&(!document.documentMode||9<document.documentMode)}function be(){Lt&&(Lt.detachEvent("onpropertychange",Ce),ds=Lt=null)}function Ce(r){if(r.propertyName==="value"&&Xs(ds)){var o=[];pa(o,ds,r,ut(r)),Cr(Bl,o)}}function Ue(r,o,c){r==="focusin"?(be(),Lt=o,ds=c,Lt.attachEvent("onpropertychange",Ce)):r==="focusout"&&be()}function tt(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return Xs(ds)}function gt(r,o){if(r==="click")return Xs(o)}function ct(r,o){if(r==="input"||r==="change")return Xs(o)}function on(r,o){return r===o&&(r!==0||1/r===1/o)||r!==r&&o!==o}var Yt=typeof Object.is=="function"?Object.is:on;function fs(r,o){if(Yt(r,o))return!0;if(typeof r!="object"||r===null||typeof o!="object"||o===null)return!1;var c=Object.keys(r),m=Object.keys(o);if(c.length!==m.length)return!1;for(m=0;m<c.length;m++){var v=c[m];if(!h.call(o,v)||!Yt(r[v],o[v]))return!1}return!0}function Wl(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function ma(r,o){var c=Wl(r);r=0;for(var m;c;){if(c.nodeType===3){if(m=r+c.textContent.length,r<=o&&m>=o)return{node:c,offset:o-r};r=m}e:{for(;c;){if(c.nextSibling){c=c.nextSibling;break e}c=c.parentNode}c=void 0}c=Wl(c)}}function Hl(r,o){return r&&o?r===o?!0:r&&r.nodeType===3?!1:o&&o.nodeType===3?Hl(r,o.parentNode):"contains"in r?r.contains(o):r.compareDocumentPosition?!!(r.compareDocumentPosition(o)&16):!1:!1}function ga(){for(var r=window,o=De();o instanceof r.HTMLIFrameElement;){try{var c=typeof o.contentWindow.location.href=="string"}catch{c=!1}if(c)r=o.contentWindow;else break;o=De(r.document)}return o}function Qs(r){var o=r&&r.nodeName&&r.nodeName.toLowerCase();return o&&(o==="input"&&(r.type==="text"||r.type==="search"||r.type==="tel"||r.type==="url"||r.type==="password")||o==="textarea"||r.contentEditable==="true")}function Zs(r){var o=ga(),c=r.focusedElem,m=r.selectionRange;if(o!==c&&c&&c.ownerDocument&&Hl(c.ownerDocument.documentElement,c)){if(m!==null&&Qs(c)){if(o=m.start,r=m.end,r===void 0&&(r=o),"selectionStart"in c)c.selectionStart=o,c.selectionEnd=Math.min(r,c.value.length);else if(r=(o=c.ownerDocument||document)&&o.defaultView||window,r.getSelection){r=r.getSelection();var v=c.textContent.length,x=Math.min(m.start,v);m=m.end===void 0?x:Math.min(m.end,v),!r.extend&&x>m&&(v=m,m=x,x=v),v=ma(c,x);var R=ma(c,m);v&&R&&(r.rangeCount!==1||r.anchorNode!==v.node||r.anchorOffset!==v.offset||r.focusNode!==R.node||r.focusOffset!==R.offset)&&(o=o.createRange(),o.setStart(v.node,v.offset),r.removeAllRanges(),x>m?(r.addRange(o),r.extend(R.node,R.offset)):(o.setEnd(R.node,R.offset),r.addRange(o)))}}for(o=[],r=c;r=r.parentNode;)r.nodeType===1&&o.push({element:r,left:r.scrollLeft,top:r.scrollTop});for(typeof c.focus=="function"&&c.focus(),c=0;c<o.length;c++)r=o[c],r.element.scrollLeft=r.left,r.element.scrollTop=r.top}}var Js=u&&"documentMode"in document&&11>=document.documentMode,ft=null,ei=null,va=null,pd=!1;function Zw(r,o,c){var m=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;pd||ft==null||ft!==De(m)||(m=ft,"selectionStart"in m&&Qs(m)?m={start:m.selectionStart,end:m.selectionEnd}:(m=(m.ownerDocument&&m.ownerDocument.defaultView||window).getSelection(),m={anchorNode:m.anchorNode,anchorOffset:m.anchorOffset,focusNode:m.focusNode,focusOffset:m.focusOffset}),va&&fs(va,m)||(va=m,m=Kl(ei,"onSelect"),0<m.length&&(o=new ia("onSelect","select",null,o,c),r.push({event:o,listeners:m}),o.target=ft)))}function Gl(r,o){var c={};return c[r.toLowerCase()]=o.toLowerCase(),c["Webkit"+r]="webkit"+o,c["Moz"+r]="moz"+o,c}var ti={animationend:Gl("Animation","AnimationEnd"),animationiteration:Gl("Animation","AnimationIteration"),animationstart:Gl("Animation","AnimationStart"),transitionend:Gl("Transition","TransitionEnd")},md={},Jw={};u&&(Jw=document.createElement("div").style,"AnimationEvent"in window||(delete ti.animationend.animation,delete ti.animationiteration.animation,delete ti.animationstart.animation),"TransitionEvent"in window||delete ti.transitionend.transition);function Vl(r){if(md[r])return md[r];if(!ti[r])return r;var o=ti[r],c;for(c in o)if(o.hasOwnProperty(c)&&c in Jw)return md[r]=o[c];return r}var e0=Vl("animationend"),t0=Vl("animationiteration"),n0=Vl("animationstart"),r0=Vl("transitionend"),s0=new Map,o0="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 hs(r,o){s0.set(r,o),a(o,[r])}for(var gd=0;gd<o0.length;gd++){var vd=o0[gd],KR=vd.toLowerCase(),XR=vd[0].toUpperCase()+vd.slice(1);hs(KR,"on"+XR)}hs(e0,"onAnimationEnd"),hs(t0,"onAnimationIteration"),hs(n0,"onAnimationStart"),hs("dblclick","onDoubleClick"),hs("focusin","onFocus"),hs("focusout","onBlur"),hs(r0,"onTransitionEnd"),l("onMouseEnter",["mouseout","mouseover"]),l("onMouseLeave",["mouseout","mouseover"]),l("onPointerEnter",["pointerout","pointerover"]),l("onPointerLeave",["pointerout","pointerover"]),a("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),a("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),a("onBeforeInput",["compositionend","keypress","textInput","paste"]),a("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),a("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),a("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ya="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(" "),QR=new Set("cancel close invalid load scroll toggle".split(" ").concat(ya));function i0(r,o,c){var m=r.type||"unknown-event";r.currentTarget=c,Mo(m,o,void 0,r),r.currentTarget=null}function a0(r,o){o=(o&4)!==0;for(var c=0;c<r.length;c++){var m=r[c],v=m.event;m=m.listeners;e:{var x=void 0;if(o)for(var R=m.length-1;0<=R;R--){var B=m[R],ee=B.instance,ce=B.currentTarget;if(B=B.listener,ee!==x&&v.isPropagationStopped())break e;i0(v,B,ce),x=ee}else for(R=0;R<m.length;R++){if(B=m[R],ee=B.instance,ce=B.currentTarget,B=B.listener,ee!==x&&v.isPropagationStopped())break e;i0(v,B,ce),x=ee}}}if(hr)throw r=es,hr=!1,es=null,r}function ht(r,o){var c=o[Nd];c===void 0&&(c=o[Nd]=new Set);var m=r+"__bubble";c.has(m)||(l0(o,r,2,!1),c.add(m))}function yd(r,o,c){var m=0;o&&(m|=4),l0(c,r,m,o)}var Yl="_reactListening"+Math.random().toString(36).slice(2);function wa(r){if(!r[Yl]){r[Yl]=!0,s.forEach(function(c){c!=="selectionchange"&&(QR.has(c)||yd(c,!1,r),yd(c,!0,r))});var o=r.nodeType===9?r:r.ownerDocument;o===null||o[Yl]||(o[Yl]=!0,yd("selectionchange",!1,o))}}function l0(r,o,c,m){switch(Ko(o)){case 1:var v=ra;break;case 4:v=Rl;break;default:v=vr}c=v.bind(null,o,c,r),v=void 0,!Ps||o!=="touchstart"&&o!=="touchmove"&&o!=="wheel"||(v=!0),m?v!==void 0?r.addEventListener(o,c,{capture:!0,passive:v}):r.addEventListener(o,c,!0):v!==void 0?r.addEventListener(o,c,{passive:v}):r.addEventListener(o,c,!1)}function wd(r,o,c,m,v){var x=m;if((o&1)===0&&(o&2)===0&&m!==null)e:for(;;){if(m===null)return;var R=m.tag;if(R===3||R===4){var B=m.stateNode.containerInfo;if(B===v||B.nodeType===8&&B.parentNode===v)break;if(R===4)for(R=m.return;R!==null;){var ee=R.tag;if((ee===3||ee===4)&&(ee=R.stateNode.containerInfo,ee===v||ee.nodeType===8&&ee.parentNode===v))return;R=R.return}for(;B!==null;){if(R=eo(B),R===null)return;if(ee=R.tag,ee===5||ee===6){m=x=R;continue e}B=B.parentNode}}m=m.return}Cr(function(){var ce=x,ge=ut(c),ye=[];e:{var me=s0.get(r);if(me!==void 0){var ke=ia,Ee=r;switch(r){case"keypress":if(Xo(c)===0)break e;case"keydown":case"keyup":ke=Ol;break;case"focusin":Ee="focus",ke=Qo;break;case"focusout":Ee="blur",ke=Qo;break;case"beforeblur":case"afterblur":ke=Qo;break;case"click":if(c.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ke=Vs;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ke=sd;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ke=tn;break;case e0:case t0:case n0:ke=ad;break;case r0:ke=Pl;break;case"scroll":ke=cs;break;case"wheel":ke=Ll;break;case"copy":case"cut":case"paste":ke=wr;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ke=Ys}var Re=(o&4)!==0,jt=!Re&&r==="scroll",oe=Re?me!==null?me+"Capture":null:me;Re=[];for(var ne=ce,ie;ne!==null;){ie=ne;var we=ie.stateNode;if(ie.tag===5&&we!==null&&(ie=we,oe!==null&&(we=Bn(ne,oe),we!=null&&Re.push(xa(ne,we,ie)))),jt)break;ne=ne.return}0<Re.length&&(me=new ke(me,Ee,null,c,ge),ye.push({event:me,listeners:Re}))}}if((o&7)===0){e:{if(me=r==="mouseover"||r==="pointerover",ke=r==="mouseout"||r==="pointerout",me&&c!==xt&&(Ee=c.relatedTarget||c.fromElement)&&(eo(Ee)||Ee[Dr]))break e;if((ke||me)&&(me=ge.window===ge?ge:(me=ge.ownerDocument)?me.defaultView||me.parentWindow:window,ke?(Ee=c.relatedTarget||c.toElement,ke=ce,Ee=Ee?eo(Ee):null,Ee!==null&&(jt=jn(Ee),Ee!==jt||Ee.tag!==5&&Ee.tag!==6)&&(Ee=null)):(ke=null,Ee=ce),ke!==Ee)){if(Re=Vs,we="onMouseLeave",oe="onMouseEnter",ne="mouse",(r==="pointerout"||r==="pointerover")&&(Re=Ys,we="onPointerLeave",oe="onPointerEnter",ne="pointer"),jt=ke==null?me:si(ke),ie=Ee==null?me:si(Ee),me=new Re(we,ne+"leave",ke,c,ge),me.target=jt,me.relatedTarget=ie,we=null,eo(ge)===ce&&(Re=new Re(oe,ne+"enter",Ee,c,ge),Re.target=ie,Re.relatedTarget=jt,we=Re),jt=we,ke&&Ee)t:{for(Re=ke,oe=Ee,ne=0,ie=Re;ie;ie=ni(ie))ne++;for(ie=0,we=oe;we;we=ni(we))ie++;for(;0<ne-ie;)Re=ni(Re),ne--;for(;0<ie-ne;)oe=ni(oe),ie--;for(;ne--;){if(Re===oe||oe!==null&&Re===oe.alternate)break t;Re=ni(Re),oe=ni(oe)}Re=null}else Re=null;ke!==null&&c0(ye,me,ke,Re,!1),Ee!==null&&jt!==null&&c0(ye,jt,Ee,Re,!0)}}e:{if(me=ce?si(ce):window,ke=me.nodeName&&me.nodeName.toLowerCase(),ke==="select"||ke==="input"&&me.type==="file")var Ae=Ul;else if(zl(me))if(z)Ae=ct;else{Ae=tt;var Le=Ue}else(ke=me.nodeName)&&ke.toLowerCase()==="input"&&(me.type==="checkbox"||me.type==="radio")&&(Ae=gt);if(Ae&&(Ae=Ae(r,ce))){pa(ye,Ae,c,ge);break e}Le&&Le(r,me,ce),r==="focusout"&&(Le=me._wrapperState)&&Le.controlled&&me.type==="number"&&We(me,"number",me.value)}switch(Le=ce?si(ce):window,r){case"focusin":(zl(Le)||Le.contentEditable==="true")&&(ft=Le,ei=ce,va=null);break;case"focusout":va=ei=ft=null;break;case"mousedown":pd=!0;break;case"contextmenu":case"mouseup":case"dragend":pd=!1,Zw(ye,c,ge);break;case"selectionchange":if(Js)break;case"keydown":case"keyup":Zw(ye,c,ge)}var qe;if(us)e:{switch(r){case"compositionstart":var ze="onCompositionStart";break e;case"compositionend":ze="onCompositionEnd";break e;case"compositionupdate":ze="onCompositionUpdate";break e}ze=void 0}else Vt?ha(r,c)&&(ze="onCompositionEnd"):r==="keydown"&&c.keyCode===229&&(ze="onCompositionStart");ze&&(Ks&&c.locale!=="ko"&&(Vt||ze!=="onCompositionStart"?ze==="onCompositionEnd"&&Vt&&(qe=sa()):(yr=ge,Us="value"in yr?yr.value:yr.textContent,Vt=!0)),Le=Kl(ce,ze),0<Le.length&&(ze=new ca(ze,r,null,c,ge),ye.push({event:ze,listeners:Le}),qe?ze.data=qe:(qe=Jo(c),qe!==null&&(ze.data=qe)))),(qe=ql?Dl(r,c):Fl(r,c))&&(ce=Kl(ce,"onBeforeInput"),0<ce.length&&(ge=new ca("onBeforeInput","beforeinput",null,c,ge),ye.push({event:ge,listeners:ce}),ge.data=qe))}a0(ye,o)})}function xa(r,o,c){return{instance:r,listener:o,currentTarget:c}}function Kl(r,o){for(var c=o+"Capture",m=[];r!==null;){var v=r,x=v.stateNode;v.tag===5&&x!==null&&(v=x,x=Bn(r,c),x!=null&&m.unshift(xa(r,x,v)),x=Bn(r,o),x!=null&&m.push(xa(r,x,v))),r=r.return}return m}function ni(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5);return r||null}function c0(r,o,c,m,v){for(var x=o._reactName,R=[];c!==null&&c!==m;){var B=c,ee=B.alternate,ce=B.stateNode;if(ee!==null&&ee===m)break;B.tag===5&&ce!==null&&(B=ce,v?(ee=Bn(c,x),ee!=null&&R.unshift(xa(c,ee,B))):v||(ee=Bn(c,x),ee!=null&&R.push(xa(c,ee,B)))),c=c.return}R.length!==0&&r.push({event:o,listeners:R})}var ZR=/\r\n?/g,JR=/\u0000|\uFFFD/g;function u0(r){return(typeof r=="string"?r:""+r).replace(ZR,`
38
+ `).replace(JR,"")}function Xl(r,o,c){if(o=u0(o),u0(r)!==o&&c)throw Error(n(425))}function Ql(){}var xd=null,bd=null;function _d(r,o){return r==="textarea"||r==="noscript"||typeof o.children=="string"||typeof o.children=="number"||typeof o.dangerouslySetInnerHTML=="object"&&o.dangerouslySetInnerHTML!==null&&o.dangerouslySetInnerHTML.__html!=null}var kd=typeof setTimeout=="function"?setTimeout:void 0,eA=typeof clearTimeout=="function"?clearTimeout:void 0,d0=typeof Promise=="function"?Promise:void 0,tA=typeof queueMicrotask=="function"?queueMicrotask:typeof d0<"u"?function(r){return d0.resolve(null).then(r).catch(nA)}:kd;function nA(r){setTimeout(function(){throw r})}function Sd(r,o){var c=o,m=0;do{var v=c.nextSibling;if(r.removeChild(c),v&&v.nodeType===8)if(c=v.data,c==="/$"){if(m===0){r.removeChild(v),ls(o);return}m--}else c!=="$"&&c!=="$?"&&c!=="$!"||m++;c=v}while(c);ls(o)}function ps(r){for(;r!=null;r=r.nextSibling){var o=r.nodeType;if(o===1||o===3)break;if(o===8){if(o=r.data,o==="$"||o==="$!"||o==="$?")break;if(o==="/$")return null}}return r}function f0(r){r=r.previousSibling;for(var o=0;r;){if(r.nodeType===8){var c=r.data;if(c==="$"||c==="$!"||c==="$?"){if(o===0)return r;o--}else c==="/$"&&o++}r=r.previousSibling}return null}var ri=Math.random().toString(36).slice(2),xr="__reactFiber$"+ri,ba="__reactProps$"+ri,Dr="__reactContainer$"+ri,Nd="__reactEvents$"+ri,rA="__reactListeners$"+ri,sA="__reactHandles$"+ri;function eo(r){var o=r[xr];if(o)return o;for(var c=r.parentNode;c;){if(o=c[Dr]||c[xr]){if(c=o.alternate,o.child!==null||c!==null&&c.child!==null)for(r=f0(r);r!==null;){if(c=r[xr])return c;r=f0(r)}return o}r=c,c=r.parentNode}return null}function _a(r){return r=r[xr]||r[Dr],!r||r.tag!==5&&r.tag!==6&&r.tag!==13&&r.tag!==3?null:r}function si(r){if(r.tag===5||r.tag===6)return r.stateNode;throw Error(n(33))}function Zl(r){return r[ba]||null}var Ed=[],oi=-1;function ms(r){return{current:r}}function pt(r){0>oi||(r.current=Ed[oi],Ed[oi]=null,oi--)}function dt(r,o){oi++,Ed[oi]=r.current,r.current=o}var gs={},Kt=ms(gs),an=ms(!1),to=gs;function ii(r,o){var c=r.type.contextTypes;if(!c)return gs;var m=r.stateNode;if(m&&m.__reactInternalMemoizedUnmaskedChildContext===o)return m.__reactInternalMemoizedMaskedChildContext;var v={},x;for(x in c)v[x]=o[x];return m&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=o,r.__reactInternalMemoizedMaskedChildContext=v),v}function ln(r){return r=r.childContextTypes,r!=null}function Jl(){pt(an),pt(Kt)}function h0(r,o,c){if(Kt.current!==gs)throw Error(n(168));dt(Kt,o),dt(an,c)}function p0(r,o,c){var m=r.stateNode;if(o=o.childContextTypes,typeof m.getChildContext!="function")return c;m=m.getChildContext();for(var v in m)if(!(v in o))throw Error(n(108,se(r)||"Unknown",v));return te({},c,m)}function ec(r){return r=(r=r.stateNode)&&r.__reactInternalMemoizedMergedChildContext||gs,to=Kt.current,dt(Kt,r),dt(an,an.current),!0}function m0(r,o,c){var m=r.stateNode;if(!m)throw Error(n(169));c?(r=p0(r,o,to),m.__reactInternalMemoizedMergedChildContext=r,pt(an),pt(Kt),dt(Kt,r)):pt(an),dt(an,c)}var Fr=null,tc=!1,jd=!1;function g0(r){Fr===null?Fr=[r]:Fr.push(r)}function oA(r){tc=!0,g0(r)}function vs(){if(!jd&&Fr!==null){jd=!0;var r=0,o=Ze;try{var c=Fr;for(Ze=1;r<c.length;r++){var m=c[r];do m=m(!0);while(m!==null)}Fr=null,tc=!1}catch(v){throw Fr!==null&&(Fr=Fr.slice(r+1)),$s(ts,vs),v}finally{Ze=o,jd=!1}}return null}var ai=[],li=0,nc=null,rc=0,Rn=[],An=0,no=null,zr=1,Br="";function ro(r,o){ai[li++]=rc,ai[li++]=nc,nc=r,rc=o}function v0(r,o,c){Rn[An++]=zr,Rn[An++]=Br,Rn[An++]=no,no=r;var m=zr;r=Br;var v=32-gn(m)-1;m&=~(1<<v),c+=1;var x=32-gn(o)+v;if(30<x){var R=v-v%5;x=(m&(1<<R)-1).toString(32),m>>=R,v-=R,zr=1<<32-gn(o)+v|c<<v|m,Br=x+r}else zr=1<<x|c<<v|m,Br=r}function Cd(r){r.return!==null&&(ro(r,1),v0(r,1,0))}function Td(r){for(;r===nc;)nc=ai[--li],ai[li]=null,rc=ai[--li],ai[li]=null;for(;r===no;)no=Rn[--An],Rn[An]=null,Br=Rn[--An],Rn[An]=null,zr=Rn[--An],Rn[An]=null}var yn=null,wn=null,vt=!1,Zn=null;function y0(r,o){var c=Pn(5,null,null,0);c.elementType="DELETED",c.stateNode=o,c.return=r,o=r.deletions,o===null?(r.deletions=[c],r.flags|=16):o.push(c)}function w0(r,o){switch(r.tag){case 5:var c=r.type;return o=o.nodeType!==1||c.toLowerCase()!==o.nodeName.toLowerCase()?null:o,o!==null?(r.stateNode=o,yn=r,wn=ps(o.firstChild),!0):!1;case 6:return o=r.pendingProps===""||o.nodeType!==3?null:o,o!==null?(r.stateNode=o,yn=r,wn=null,!0):!1;case 13:return o=o.nodeType!==8?null:o,o!==null?(c=no!==null?{id:zr,overflow:Br}:null,r.memoizedState={dehydrated:o,treeContext:c,retryLane:1073741824},c=Pn(18,null,null,0),c.stateNode=o,c.return=r,r.child=c,yn=r,wn=null,!0):!1;default:return!1}}function Rd(r){return(r.mode&1)!==0&&(r.flags&128)===0}function Ad(r){if(vt){var o=wn;if(o){var c=o;if(!w0(r,o)){if(Rd(r))throw Error(n(418));o=ps(c.nextSibling);var m=yn;o&&w0(r,o)?y0(m,c):(r.flags=r.flags&-4097|2,vt=!1,yn=r)}}else{if(Rd(r))throw Error(n(418));r.flags=r.flags&-4097|2,vt=!1,yn=r}}}function x0(r){for(r=r.return;r!==null&&r.tag!==5&&r.tag!==3&&r.tag!==13;)r=r.return;yn=r}function sc(r){if(r!==yn)return!1;if(!vt)return x0(r),vt=!0,!1;var o;if((o=r.tag!==3)&&!(o=r.tag!==5)&&(o=r.type,o=o!=="head"&&o!=="body"&&!_d(r.type,r.memoizedProps)),o&&(o=wn)){if(Rd(r))throw b0(),Error(n(418));for(;o;)y0(r,o),o=ps(o.nextSibling)}if(x0(r),r.tag===13){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(n(317));e:{for(r=r.nextSibling,o=0;r;){if(r.nodeType===8){var c=r.data;if(c==="/$"){if(o===0){wn=ps(r.nextSibling);break e}o--}else c!=="$"&&c!=="$!"&&c!=="$?"||o++}r=r.nextSibling}wn=null}}else wn=yn?ps(r.stateNode.nextSibling):null;return!0}function b0(){for(var r=wn;r;)r=ps(r.nextSibling)}function ci(){wn=yn=null,vt=!1}function Md(r){Zn===null?Zn=[r]:Zn.push(r)}var iA=C.ReactCurrentBatchConfig;function ka(r,o,c){if(r=c.ref,r!==null&&typeof r!="function"&&typeof r!="object"){if(c._owner){if(c=c._owner,c){if(c.tag!==1)throw Error(n(309));var m=c.stateNode}if(!m)throw Error(n(147,r));var v=m,x=""+r;return o!==null&&o.ref!==null&&typeof o.ref=="function"&&o.ref._stringRef===x?o.ref:(o=function(R){var B=v.refs;R===null?delete B[x]:B[x]=R},o._stringRef=x,o)}if(typeof r!="string")throw Error(n(284));if(!c._owner)throw Error(n(290,r))}return r}function oc(r,o){throw r=Object.prototype.toString.call(o),Error(n(31,r==="[object Object]"?"object with keys {"+Object.keys(o).join(", ")+"}":r))}function _0(r){var o=r._init;return o(r._payload)}function k0(r){function o(oe,ne){if(r){var ie=oe.deletions;ie===null?(oe.deletions=[ne],oe.flags|=16):ie.push(ne)}}function c(oe,ne){if(!r)return null;for(;ne!==null;)o(oe,ne),ne=ne.sibling;return null}function m(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 v(oe,ne){return oe=Ns(oe,ne),oe.index=0,oe.sibling=null,oe}function x(oe,ne,ie){return oe.index=ie,r?(ie=oe.alternate,ie!==null?(ie=ie.index,ie<ne?(oe.flags|=2,ne):ie):(oe.flags|=2,ne)):(oe.flags|=1048576,ne)}function R(oe){return r&&oe.alternate===null&&(oe.flags|=2),oe}function B(oe,ne,ie,we){return ne===null||ne.tag!==6?(ne=Sf(ie,oe.mode,we),ne.return=oe,ne):(ne=v(ne,ie),ne.return=oe,ne)}function ee(oe,ne,ie,we){var Ae=ie.type;return Ae===O?ge(oe,ne,ie.props.children,we,ie.key):ne!==null&&(ne.elementType===Ae||typeof Ae=="object"&&Ae!==null&&Ae.$$typeof===U&&_0(Ae)===ne.type)?(we=v(ne,ie.props),we.ref=ka(oe,ne,ie),we.return=oe,we):(we=Tc(ie.type,ie.key,ie.props,null,oe.mode,we),we.ref=ka(oe,ne,ie),we.return=oe,we)}function ce(oe,ne,ie,we){return ne===null||ne.tag!==4||ne.stateNode.containerInfo!==ie.containerInfo||ne.stateNode.implementation!==ie.implementation?(ne=Nf(ie,oe.mode,we),ne.return=oe,ne):(ne=v(ne,ie.children||[]),ne.return=oe,ne)}function ge(oe,ne,ie,we,Ae){return ne===null||ne.tag!==7?(ne=fo(ie,oe.mode,we,Ae),ne.return=oe,ne):(ne=v(ne,ie),ne.return=oe,ne)}function ye(oe,ne,ie){if(typeof ne=="string"&&ne!==""||typeof ne=="number")return ne=Sf(""+ne,oe.mode,ie),ne.return=oe,ne;if(typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case I:return ie=Tc(ne.type,ne.key,ne.props,null,oe.mode,ie),ie.ref=ka(oe,null,ne),ie.return=oe,ie;case P:return ne=Nf(ne,oe.mode,ie),ne.return=oe,ne;case U:var we=ne._init;return ye(oe,we(ne._payload),ie)}if(at(ne)||H(ne))return ne=fo(ne,oe.mode,ie,null),ne.return=oe,ne;oc(oe,ne)}return null}function me(oe,ne,ie,we){var Ae=ne!==null?ne.key:null;if(typeof ie=="string"&&ie!==""||typeof ie=="number")return Ae!==null?null:B(oe,ne,""+ie,we);if(typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case I:return ie.key===Ae?ee(oe,ne,ie,we):null;case P:return ie.key===Ae?ce(oe,ne,ie,we):null;case U:return Ae=ie._init,me(oe,ne,Ae(ie._payload),we)}if(at(ie)||H(ie))return Ae!==null?null:ge(oe,ne,ie,we,null);oc(oe,ie)}return null}function ke(oe,ne,ie,we,Ae){if(typeof we=="string"&&we!==""||typeof we=="number")return oe=oe.get(ie)||null,B(ne,oe,""+we,Ae);if(typeof we=="object"&&we!==null){switch(we.$$typeof){case I:return oe=oe.get(we.key===null?ie:we.key)||null,ee(ne,oe,we,Ae);case P:return oe=oe.get(we.key===null?ie:we.key)||null,ce(ne,oe,we,Ae);case U:var Le=we._init;return ke(oe,ne,ie,Le(we._payload),Ae)}if(at(we)||H(we))return oe=oe.get(ie)||null,ge(ne,oe,we,Ae,null);oc(ne,we)}return null}function Ee(oe,ne,ie,we){for(var Ae=null,Le=null,qe=ne,ze=ne=0,Ft=null;qe!==null&&ze<ie.length;ze++){qe.index>ze?(Ft=qe,qe=null):Ft=qe.sibling;var nt=me(oe,qe,ie[ze],we);if(nt===null){qe===null&&(qe=Ft);break}r&&qe&&nt.alternate===null&&o(oe,qe),ne=x(nt,ne,ze),Le===null?Ae=nt:Le.sibling=nt,Le=nt,qe=Ft}if(ze===ie.length)return c(oe,qe),vt&&ro(oe,ze),Ae;if(qe===null){for(;ze<ie.length;ze++)qe=ye(oe,ie[ze],we),qe!==null&&(ne=x(qe,ne,ze),Le===null?Ae=qe:Le.sibling=qe,Le=qe);return vt&&ro(oe,ze),Ae}for(qe=m(oe,qe);ze<ie.length;ze++)Ft=ke(qe,oe,ze,ie[ze],we),Ft!==null&&(r&&Ft.alternate!==null&&qe.delete(Ft.key===null?ze:Ft.key),ne=x(Ft,ne,ze),Le===null?Ae=Ft:Le.sibling=Ft,Le=Ft);return r&&qe.forEach(function(Es){return o(oe,Es)}),vt&&ro(oe,ze),Ae}function Re(oe,ne,ie,we){var Ae=H(ie);if(typeof Ae!="function")throw Error(n(150));if(ie=Ae.call(ie),ie==null)throw Error(n(151));for(var Le=Ae=null,qe=ne,ze=ne=0,Ft=null,nt=ie.next();qe!==null&&!nt.done;ze++,nt=ie.next()){qe.index>ze?(Ft=qe,qe=null):Ft=qe.sibling;var Es=me(oe,qe,nt.value,we);if(Es===null){qe===null&&(qe=Ft);break}r&&qe&&Es.alternate===null&&o(oe,qe),ne=x(Es,ne,ze),Le===null?Ae=Es:Le.sibling=Es,Le=Es,qe=Ft}if(nt.done)return c(oe,qe),vt&&ro(oe,ze),Ae;if(qe===null){for(;!nt.done;ze++,nt=ie.next())nt=ye(oe,nt.value,we),nt!==null&&(ne=x(nt,ne,ze),Le===null?Ae=nt:Le.sibling=nt,Le=nt);return vt&&ro(oe,ze),Ae}for(qe=m(oe,qe);!nt.done;ze++,nt=ie.next())nt=ke(qe,oe,ze,nt.value,we),nt!==null&&(r&&nt.alternate!==null&&qe.delete(nt.key===null?ze:nt.key),ne=x(nt,ne,ze),Le===null?Ae=nt:Le.sibling=nt,Le=nt);return r&&qe.forEach(function(DA){return o(oe,DA)}),vt&&ro(oe,ze),Ae}function jt(oe,ne,ie,we){if(typeof ie=="object"&&ie!==null&&ie.type===O&&ie.key===null&&(ie=ie.props.children),typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case I:e:{for(var Ae=ie.key,Le=ne;Le!==null;){if(Le.key===Ae){if(Ae=ie.type,Ae===O){if(Le.tag===7){c(oe,Le.sibling),ne=v(Le,ie.props.children),ne.return=oe,oe=ne;break e}}else if(Le.elementType===Ae||typeof Ae=="object"&&Ae!==null&&Ae.$$typeof===U&&_0(Ae)===Le.type){c(oe,Le.sibling),ne=v(Le,ie.props),ne.ref=ka(oe,Le,ie),ne.return=oe,oe=ne;break e}c(oe,Le);break}else o(oe,Le);Le=Le.sibling}ie.type===O?(ne=fo(ie.props.children,oe.mode,we,ie.key),ne.return=oe,oe=ne):(we=Tc(ie.type,ie.key,ie.props,null,oe.mode,we),we.ref=ka(oe,ne,ie),we.return=oe,oe=we)}return R(oe);case P:e:{for(Le=ie.key;ne!==null;){if(ne.key===Le)if(ne.tag===4&&ne.stateNode.containerInfo===ie.containerInfo&&ne.stateNode.implementation===ie.implementation){c(oe,ne.sibling),ne=v(ne,ie.children||[]),ne.return=oe,oe=ne;break e}else{c(oe,ne);break}else o(oe,ne);ne=ne.sibling}ne=Nf(ie,oe.mode,we),ne.return=oe,oe=ne}return R(oe);case U:return Le=ie._init,jt(oe,ne,Le(ie._payload),we)}if(at(ie))return Ee(oe,ne,ie,we);if(H(ie))return Re(oe,ne,ie,we);oc(oe,ie)}return typeof ie=="string"&&ie!==""||typeof ie=="number"?(ie=""+ie,ne!==null&&ne.tag===6?(c(oe,ne.sibling),ne=v(ne,ie),ne.return=oe,oe=ne):(c(oe,ne),ne=Sf(ie,oe.mode,we),ne.return=oe,oe=ne),R(oe)):c(oe,ne)}return jt}var ui=k0(!0),S0=k0(!1),ic=ms(null),ac=null,di=null,Id=null;function Od(){Id=di=ac=null}function Pd(r){var o=ic.current;pt(ic),r._currentValue=o}function $d(r,o,c){for(;r!==null;){var m=r.alternate;if((r.childLanes&o)!==o?(r.childLanes|=o,m!==null&&(m.childLanes|=o)):m!==null&&(m.childLanes&o)!==o&&(m.childLanes|=o),r===c)break;r=r.return}}function fi(r,o){ac=r,Id=di=null,r=r.dependencies,r!==null&&r.firstContext!==null&&((r.lanes&o)!==0&&(cn=!0),r.firstContext=null)}function Mn(r){var o=r._currentValue;if(Id!==r)if(r={context:r,memoizedValue:o,next:null},di===null){if(ac===null)throw Error(n(308));di=r,ac.dependencies={lanes:0,firstContext:r}}else di=di.next=r;return o}var so=null;function Ld(r){so===null?so=[r]:so.push(r)}function N0(r,o,c,m){var v=o.interleaved;return v===null?(c.next=c,Ld(o)):(c.next=v.next,v.next=c),o.interleaved=c,Ur(r,m)}function Ur(r,o){r.lanes|=o;var c=r.alternate;for(c!==null&&(c.lanes|=o),c=r,r=r.return;r!==null;)r.childLanes|=o,c=r.alternate,c!==null&&(c.childLanes|=o),c=r,r=r.return;return c.tag===3?c.stateNode:null}var ys=!1;function qd(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function E0(r,o){r=r.updateQueue,o.updateQueue===r&&(o.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,effects:r.effects})}function Wr(r,o){return{eventTime:r,lane:o,tag:0,payload:null,callback:null,next:null}}function ws(r,o,c){var m=r.updateQueue;if(m===null)return null;if(m=m.shared,(et&2)!==0){var v=m.pending;return v===null?o.next=o:(o.next=v.next,v.next=o),m.pending=o,Ur(r,c)}return v=m.interleaved,v===null?(o.next=o,Ld(m)):(o.next=v.next,v.next=o),m.interleaved=o,Ur(r,c)}function lc(r,o,c){if(o=o.updateQueue,o!==null&&(o=o.shared,(c&4194240)!==0)){var m=o.lanes;m&=r.pendingLanes,c|=m,o.lanes=c,is(r,c)}}function j0(r,o){var c=r.updateQueue,m=r.alternate;if(m!==null&&(m=m.updateQueue,c===m)){var v=null,x=null;if(c=c.firstBaseUpdate,c!==null){do{var R={eventTime:c.eventTime,lane:c.lane,tag:c.tag,payload:c.payload,callback:c.callback,next:null};x===null?v=x=R:x=x.next=R,c=c.next}while(c!==null);x===null?v=x=o:x=x.next=o}else v=x=o;c={baseState:m.baseState,firstBaseUpdate:v,lastBaseUpdate:x,shared:m.shared,effects:m.effects},r.updateQueue=c;return}r=c.lastBaseUpdate,r===null?c.firstBaseUpdate=o:r.next=o,c.lastBaseUpdate=o}function cc(r,o,c,m){var v=r.updateQueue;ys=!1;var x=v.firstBaseUpdate,R=v.lastBaseUpdate,B=v.shared.pending;if(B!==null){v.shared.pending=null;var ee=B,ce=ee.next;ee.next=null,R===null?x=ce:R.next=ce,R=ee;var ge=r.alternate;ge!==null&&(ge=ge.updateQueue,B=ge.lastBaseUpdate,B!==R&&(B===null?ge.firstBaseUpdate=ce:B.next=ce,ge.lastBaseUpdate=ee))}if(x!==null){var ye=v.baseState;R=0,ge=ce=ee=null,B=x;do{var me=B.lane,ke=B.eventTime;if((m&me)===me){ge!==null&&(ge=ge.next={eventTime:ke,lane:0,tag:B.tag,payload:B.payload,callback:B.callback,next:null});e:{var Ee=r,Re=B;switch(me=o,ke=c,Re.tag){case 1:if(Ee=Re.payload,typeof Ee=="function"){ye=Ee.call(ke,ye,me);break e}ye=Ee;break e;case 3:Ee.flags=Ee.flags&-65537|128;case 0:if(Ee=Re.payload,me=typeof Ee=="function"?Ee.call(ke,ye,me):Ee,me==null)break e;ye=te({},ye,me);break e;case 2:ys=!0}}B.callback!==null&&B.lane!==0&&(r.flags|=64,me=v.effects,me===null?v.effects=[B]:me.push(B))}else ke={eventTime:ke,lane:me,tag:B.tag,payload:B.payload,callback:B.callback,next:null},ge===null?(ce=ge=ke,ee=ye):ge=ge.next=ke,R|=me;if(B=B.next,B===null){if(B=v.shared.pending,B===null)break;me=B,B=me.next,me.next=null,v.lastBaseUpdate=me,v.shared.pending=null}}while(!0);if(ge===null&&(ee=ye),v.baseState=ee,v.firstBaseUpdate=ce,v.lastBaseUpdate=ge,o=v.shared.interleaved,o!==null){v=o;do R|=v.lane,v=v.next;while(v!==o)}else x===null&&(v.shared.lanes=0);ao|=R,r.lanes=R,r.memoizedState=ye}}function C0(r,o,c){if(r=o.effects,o.effects=null,r!==null)for(o=0;o<r.length;o++){var m=r[o],v=m.callback;if(v!==null){if(m.callback=null,m=c,typeof v!="function")throw Error(n(191,v));v.call(m)}}}var Sa={},br=ms(Sa),Na=ms(Sa),Ea=ms(Sa);function oo(r){if(r===Sa)throw Error(n(174));return r}function Dd(r,o){switch(dt(Ea,o),dt(Na,r),dt(br,Sa),r=o.nodeType,r){case 9:case 11:o=(o=o.documentElement)?o.namespaceURI:Oe(null,"");break;default:r=r===8?o.parentNode:o,o=r.namespaceURI||null,r=r.tagName,o=Oe(o,r)}pt(br),dt(br,o)}function hi(){pt(br),pt(Na),pt(Ea)}function T0(r){oo(Ea.current);var o=oo(br.current),c=Oe(o,r.type);o!==c&&(dt(Na,r),dt(br,c))}function Fd(r){Na.current===r&&(pt(br),pt(Na))}var bt=ms(0);function uc(r){for(var o=r;o!==null;){if(o.tag===13){var c=o.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||c.data==="$?"||c.data==="$!"))return o}else if(o.tag===19&&o.memoizedProps.revealOrder!==void 0){if((o.flags&128)!==0)return o}else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===r)break;for(;o.sibling===null;){if(o.return===null||o.return===r)return null;o=o.return}o.sibling.return=o.return,o=o.sibling}return null}var zd=[];function Bd(){for(var r=0;r<zd.length;r++)zd[r]._workInProgressVersionPrimary=null;zd.length=0}var dc=C.ReactCurrentDispatcher,Ud=C.ReactCurrentBatchConfig,io=0,_t=null,Ot=null,qt=null,fc=!1,ja=!1,Ca=0,aA=0;function Xt(){throw Error(n(321))}function Wd(r,o){if(o===null)return!1;for(var c=0;c<o.length&&c<r.length;c++)if(!Yt(r[c],o[c]))return!1;return!0}function Hd(r,o,c,m,v,x){if(io=x,_t=o,o.memoizedState=null,o.updateQueue=null,o.lanes=0,dc.current=r===null||r.memoizedState===null?dA:fA,r=c(m,v),ja){x=0;do{if(ja=!1,Ca=0,25<=x)throw Error(n(301));x+=1,qt=Ot=null,o.updateQueue=null,dc.current=hA,r=c(m,v)}while(ja)}if(dc.current=mc,o=Ot!==null&&Ot.next!==null,io=0,qt=Ot=_t=null,fc=!1,o)throw Error(n(300));return r}function Gd(){var r=Ca!==0;return Ca=0,r}function _r(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return qt===null?_t.memoizedState=qt=r:qt=qt.next=r,qt}function In(){if(Ot===null){var r=_t.alternate;r=r!==null?r.memoizedState:null}else r=Ot.next;var o=qt===null?_t.memoizedState:qt.next;if(o!==null)qt=o,Ot=r;else{if(r===null)throw Error(n(310));Ot=r,r={memoizedState:Ot.memoizedState,baseState:Ot.baseState,baseQueue:Ot.baseQueue,queue:Ot.queue,next:null},qt===null?_t.memoizedState=qt=r:qt=qt.next=r}return qt}function Ta(r,o){return typeof o=="function"?o(r):o}function Vd(r){var o=In(),c=o.queue;if(c===null)throw Error(n(311));c.lastRenderedReducer=r;var m=Ot,v=m.baseQueue,x=c.pending;if(x!==null){if(v!==null){var R=v.next;v.next=x.next,x.next=R}m.baseQueue=v=x,c.pending=null}if(v!==null){x=v.next,m=m.baseState;var B=R=null,ee=null,ce=x;do{var ge=ce.lane;if((io&ge)===ge)ee!==null&&(ee=ee.next={lane:0,action:ce.action,hasEagerState:ce.hasEagerState,eagerState:ce.eagerState,next:null}),m=ce.hasEagerState?ce.eagerState:r(m,ce.action);else{var ye={lane:ge,action:ce.action,hasEagerState:ce.hasEagerState,eagerState:ce.eagerState,next:null};ee===null?(B=ee=ye,R=m):ee=ee.next=ye,_t.lanes|=ge,ao|=ge}ce=ce.next}while(ce!==null&&ce!==x);ee===null?R=m:ee.next=B,Yt(m,o.memoizedState)||(cn=!0),o.memoizedState=m,o.baseState=R,o.baseQueue=ee,c.lastRenderedState=m}if(r=c.interleaved,r!==null){v=r;do x=v.lane,_t.lanes|=x,ao|=x,v=v.next;while(v!==r)}else v===null&&(c.lanes=0);return[o.memoizedState,c.dispatch]}function Yd(r){var o=In(),c=o.queue;if(c===null)throw Error(n(311));c.lastRenderedReducer=r;var m=c.dispatch,v=c.pending,x=o.memoizedState;if(v!==null){c.pending=null;var R=v=v.next;do x=r(x,R.action),R=R.next;while(R!==v);Yt(x,o.memoizedState)||(cn=!0),o.memoizedState=x,o.baseQueue===null&&(o.baseState=x),c.lastRenderedState=x}return[x,m]}function R0(){}function A0(r,o){var c=_t,m=In(),v=o(),x=!Yt(m.memoizedState,v);if(x&&(m.memoizedState=v,cn=!0),m=m.queue,Kd(O0.bind(null,c,m,r),[r]),m.getSnapshot!==o||x||qt!==null&&qt.memoizedState.tag&1){if(c.flags|=2048,Ra(9,I0.bind(null,c,m,v,o),void 0,null),Dt===null)throw Error(n(349));(io&30)!==0||M0(c,o,v)}return v}function M0(r,o,c){r.flags|=16384,r={getSnapshot:o,value:c},o=_t.updateQueue,o===null?(o={lastEffect:null,stores:null},_t.updateQueue=o,o.stores=[r]):(c=o.stores,c===null?o.stores=[r]:c.push(r))}function I0(r,o,c,m){o.value=c,o.getSnapshot=m,P0(o)&&$0(r)}function O0(r,o,c){return c(function(){P0(o)&&$0(r)})}function P0(r){var o=r.getSnapshot;r=r.value;try{var c=o();return!Yt(r,c)}catch{return!0}}function $0(r){var o=Ur(r,1);o!==null&&nr(o,r,1,-1)}function L0(r){var o=_r();return typeof r=="function"&&(r=r()),o.memoizedState=o.baseState=r,r={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Ta,lastRenderedState:r},o.queue=r,r=r.dispatch=uA.bind(null,_t,r),[o.memoizedState,r]}function Ra(r,o,c,m){return r={tag:r,create:o,destroy:c,deps:m,next:null},o=_t.updateQueue,o===null?(o={lastEffect:null,stores:null},_t.updateQueue=o,o.lastEffect=r.next=r):(c=o.lastEffect,c===null?o.lastEffect=r.next=r:(m=c.next,c.next=r,r.next=m,o.lastEffect=r)),r}function q0(){return In().memoizedState}function hc(r,o,c,m){var v=_r();_t.flags|=r,v.memoizedState=Ra(1|o,c,void 0,m===void 0?null:m)}function pc(r,o,c,m){var v=In();m=m===void 0?null:m;var x=void 0;if(Ot!==null){var R=Ot.memoizedState;if(x=R.destroy,m!==null&&Wd(m,R.deps)){v.memoizedState=Ra(o,c,x,m);return}}_t.flags|=r,v.memoizedState=Ra(1|o,c,x,m)}function D0(r,o){return hc(8390656,8,r,o)}function Kd(r,o){return pc(2048,8,r,o)}function F0(r,o){return pc(4,2,r,o)}function z0(r,o){return pc(4,4,r,o)}function B0(r,o){if(typeof o=="function")return r=r(),o(r),function(){o(null)};if(o!=null)return r=r(),o.current=r,function(){o.current=null}}function U0(r,o,c){return c=c!=null?c.concat([r]):null,pc(4,4,B0.bind(null,o,r),c)}function Xd(){}function W0(r,o){var c=In();o=o===void 0?null:o;var m=c.memoizedState;return m!==null&&o!==null&&Wd(o,m[1])?m[0]:(c.memoizedState=[r,o],r)}function H0(r,o){var c=In();o=o===void 0?null:o;var m=c.memoizedState;return m!==null&&o!==null&&Wd(o,m[1])?m[0]:(r=r(),c.memoizedState=[r,o],r)}function G0(r,o,c){return(io&21)===0?(r.baseState&&(r.baseState=!1,cn=!0),r.memoizedState=c):(Yt(c,o)||(c=Ds(),_t.lanes|=c,ao|=c,r.baseState=!0),o)}function lA(r,o){var c=Ze;Ze=c!==0&&4>c?c:4,r(!0);var m=Ud.transition;Ud.transition={};try{r(!1),o()}finally{Ze=c,Ud.transition=m}}function V0(){return In().memoizedState}function cA(r,o,c){var m=ks(r);if(c={lane:m,action:c,hasEagerState:!1,eagerState:null,next:null},Y0(r))K0(o,c);else if(c=N0(r,o,c,m),c!==null){var v=rn();nr(c,r,m,v),X0(c,o,m)}}function uA(r,o,c){var m=ks(r),v={lane:m,action:c,hasEagerState:!1,eagerState:null,next:null};if(Y0(r))K0(o,v);else{var x=r.alternate;if(r.lanes===0&&(x===null||x.lanes===0)&&(x=o.lastRenderedReducer,x!==null))try{var R=o.lastRenderedState,B=x(R,c);if(v.hasEagerState=!0,v.eagerState=B,Yt(B,R)){var ee=o.interleaved;ee===null?(v.next=v,Ld(o)):(v.next=ee.next,ee.next=v),o.interleaved=v;return}}catch{}finally{}c=N0(r,o,v,m),c!==null&&(v=rn(),nr(c,r,m,v),X0(c,o,m))}}function Y0(r){var o=r.alternate;return r===_t||o!==null&&o===_t}function K0(r,o){ja=fc=!0;var c=r.pending;c===null?o.next=o:(o.next=c.next,c.next=o),r.pending=o}function X0(r,o,c){if((c&4194240)!==0){var m=o.lanes;m&=r.pendingLanes,c|=m,o.lanes=c,is(r,c)}}var mc={readContext:Mn,useCallback:Xt,useContext:Xt,useEffect:Xt,useImperativeHandle:Xt,useInsertionEffect:Xt,useLayoutEffect:Xt,useMemo:Xt,useReducer:Xt,useRef:Xt,useState:Xt,useDebugValue:Xt,useDeferredValue:Xt,useTransition:Xt,useMutableSource:Xt,useSyncExternalStore:Xt,useId:Xt,unstable_isNewReconciler:!1},dA={readContext:Mn,useCallback:function(r,o){return _r().memoizedState=[r,o===void 0?null:o],r},useContext:Mn,useEffect:D0,useImperativeHandle:function(r,o,c){return c=c!=null?c.concat([r]):null,hc(4194308,4,B0.bind(null,o,r),c)},useLayoutEffect:function(r,o){return hc(4194308,4,r,o)},useInsertionEffect:function(r,o){return hc(4,2,r,o)},useMemo:function(r,o){var c=_r();return o=o===void 0?null:o,r=r(),c.memoizedState=[r,o],r},useReducer:function(r,o,c){var m=_r();return o=c!==void 0?c(o):o,m.memoizedState=m.baseState=o,r={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:o},m.queue=r,r=r.dispatch=cA.bind(null,_t,r),[m.memoizedState,r]},useRef:function(r){var o=_r();return r={current:r},o.memoizedState=r},useState:L0,useDebugValue:Xd,useDeferredValue:function(r){return _r().memoizedState=r},useTransition:function(){var r=L0(!1),o=r[0];return r=lA.bind(null,r[1]),_r().memoizedState=r,[o,r]},useMutableSource:function(){},useSyncExternalStore:function(r,o,c){var m=_t,v=_r();if(vt){if(c===void 0)throw Error(n(407));c=c()}else{if(c=o(),Dt===null)throw Error(n(349));(io&30)!==0||M0(m,o,c)}v.memoizedState=c;var x={value:c,getSnapshot:o};return v.queue=x,D0(O0.bind(null,m,x,r),[r]),m.flags|=2048,Ra(9,I0.bind(null,m,x,c,o),void 0,null),c},useId:function(){var r=_r(),o=Dt.identifierPrefix;if(vt){var c=Br,m=zr;c=(m&~(1<<32-gn(m)-1)).toString(32)+c,o=":"+o+"R"+c,c=Ca++,0<c&&(o+="H"+c.toString(32)),o+=":"}else c=aA++,o=":"+o+"r"+c.toString(32)+":";return r.memoizedState=o},unstable_isNewReconciler:!1},fA={readContext:Mn,useCallback:W0,useContext:Mn,useEffect:Kd,useImperativeHandle:U0,useInsertionEffect:F0,useLayoutEffect:z0,useMemo:H0,useReducer:Vd,useRef:q0,useState:function(){return Vd(Ta)},useDebugValue:Xd,useDeferredValue:function(r){var o=In();return G0(o,Ot.memoizedState,r)},useTransition:function(){var r=Vd(Ta)[0],o=In().memoizedState;return[r,o]},useMutableSource:R0,useSyncExternalStore:A0,useId:V0,unstable_isNewReconciler:!1},hA={readContext:Mn,useCallback:W0,useContext:Mn,useEffect:Kd,useImperativeHandle:U0,useInsertionEffect:F0,useLayoutEffect:z0,useMemo:H0,useReducer:Yd,useRef:q0,useState:function(){return Yd(Ta)},useDebugValue:Xd,useDeferredValue:function(r){var o=In();return Ot===null?o.memoizedState=r:G0(o,Ot.memoizedState,r)},useTransition:function(){var r=Yd(Ta)[0],o=In().memoizedState;return[r,o]},useMutableSource:R0,useSyncExternalStore:A0,useId:V0,unstable_isNewReconciler:!1};function Jn(r,o){if(r&&r.defaultProps){o=te({},o),r=r.defaultProps;for(var c in r)o[c]===void 0&&(o[c]=r[c]);return o}return o}function Qd(r,o,c,m){o=r.memoizedState,c=c(m,o),c=c==null?o:te({},o,c),r.memoizedState=c,r.lanes===0&&(r.updateQueue.baseState=c)}var gc={isMounted:function(r){return(r=r._reactInternals)?jn(r)===r:!1},enqueueSetState:function(r,o,c){r=r._reactInternals;var m=rn(),v=ks(r),x=Wr(m,v);x.payload=o,c!=null&&(x.callback=c),o=ws(r,x,v),o!==null&&(nr(o,r,v,m),lc(o,r,v))},enqueueReplaceState:function(r,o,c){r=r._reactInternals;var m=rn(),v=ks(r),x=Wr(m,v);x.tag=1,x.payload=o,c!=null&&(x.callback=c),o=ws(r,x,v),o!==null&&(nr(o,r,v,m),lc(o,r,v))},enqueueForceUpdate:function(r,o){r=r._reactInternals;var c=rn(),m=ks(r),v=Wr(c,m);v.tag=2,o!=null&&(v.callback=o),o=ws(r,v,m),o!==null&&(nr(o,r,m,c),lc(o,r,m))}};function Q0(r,o,c,m,v,x,R){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(m,x,R):o.prototype&&o.prototype.isPureReactComponent?!fs(c,m)||!fs(v,x):!0}function Z0(r,o,c){var m=!1,v=gs,x=o.contextType;return typeof x=="object"&&x!==null?x=Mn(x):(v=ln(o)?to:Kt.current,m=o.contextTypes,x=(m=m!=null)?ii(r,v):gs),o=new o(c,x),r.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,o.updater=gc,r.stateNode=o,o._reactInternals=r,m&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=v,r.__reactInternalMemoizedMaskedChildContext=x),o}function J0(r,o,c,m){r=o.state,typeof o.componentWillReceiveProps=="function"&&o.componentWillReceiveProps(c,m),typeof o.UNSAFE_componentWillReceiveProps=="function"&&o.UNSAFE_componentWillReceiveProps(c,m),o.state!==r&&gc.enqueueReplaceState(o,o.state,null)}function Zd(r,o,c,m){var v=r.stateNode;v.props=c,v.state=r.memoizedState,v.refs={},qd(r);var x=o.contextType;typeof x=="object"&&x!==null?v.context=Mn(x):(x=ln(o)?to:Kt.current,v.context=ii(r,x)),v.state=r.memoizedState,x=o.getDerivedStateFromProps,typeof x=="function"&&(Qd(r,o,x,c),v.state=r.memoizedState),typeof o.getDerivedStateFromProps=="function"||typeof v.getSnapshotBeforeUpdate=="function"||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(o=v.state,typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount(),o!==v.state&&gc.enqueueReplaceState(v,v.state,null),cc(r,c,v,m),v.state=r.memoizedState),typeof v.componentDidMount=="function"&&(r.flags|=4194308)}function pi(r,o){try{var c="",m=o;do c+=L(m),m=m.return;while(m);var v=c}catch(x){v=`
39
+ Error generating stack: `+x.message+`
40
+ `+x.stack}return{value:r,source:o,stack:v,digest:null}}function Jd(r,o,c){return{value:r,source:null,stack:c??null,digest:o??null}}function ef(r,o){try{console.error(o.value)}catch(c){setTimeout(function(){throw c})}}var pA=typeof WeakMap=="function"?WeakMap:Map;function ex(r,o,c){c=Wr(-1,c),c.tag=3,c.payload={element:null};var m=o.value;return c.callback=function(){kc||(kc=!0,gf=m),ef(r,o)},c}function tx(r,o,c){c=Wr(-1,c),c.tag=3;var m=r.type.getDerivedStateFromError;if(typeof m=="function"){var v=o.value;c.payload=function(){return m(v)},c.callback=function(){ef(r,o)}}var x=r.stateNode;return x!==null&&typeof x.componentDidCatch=="function"&&(c.callback=function(){ef(r,o),typeof m!="function"&&(bs===null?bs=new Set([this]):bs.add(this));var R=o.stack;this.componentDidCatch(o.value,{componentStack:R!==null?R:""})}),c}function nx(r,o,c){var m=r.pingCache;if(m===null){m=r.pingCache=new pA;var v=new Set;m.set(o,v)}else v=m.get(o),v===void 0&&(v=new Set,m.set(o,v));v.has(c)||(v.add(c),r=CA.bind(null,r,o,c),o.then(r,r))}function rx(r){do{var o;if((o=r.tag===13)&&(o=r.memoizedState,o=o!==null?o.dehydrated!==null:!0),o)return r;r=r.return}while(r!==null);return null}function sx(r,o,c,m,v){return(r.mode&1)===0?(r===o?r.flags|=65536:(r.flags|=128,c.flags|=131072,c.flags&=-52805,c.tag===1&&(c.alternate===null?c.tag=17:(o=Wr(-1,1),o.tag=2,ws(c,o,1))),c.lanes|=1),r):(r.flags|=65536,r.lanes=v,r)}var mA=C.ReactCurrentOwner,cn=!1;function nn(r,o,c,m){o.child=r===null?S0(o,null,c,m):ui(o,r.child,c,m)}function ox(r,o,c,m,v){c=c.render;var x=o.ref;return fi(o,v),m=Hd(r,o,c,m,x,v),c=Gd(),r!==null&&!cn?(o.updateQueue=r.updateQueue,o.flags&=-2053,r.lanes&=~v,Hr(r,o,v)):(vt&&c&&Cd(o),o.flags|=1,nn(r,o,m,v),o.child)}function ix(r,o,c,m,v){if(r===null){var x=c.type;return typeof x=="function"&&!kf(x)&&x.defaultProps===void 0&&c.compare===null&&c.defaultProps===void 0?(o.tag=15,o.type=x,ax(r,o,x,m,v)):(r=Tc(c.type,null,m,o,o.mode,v),r.ref=o.ref,r.return=o,o.child=r)}if(x=r.child,(r.lanes&v)===0){var R=x.memoizedProps;if(c=c.compare,c=c!==null?c:fs,c(R,m)&&r.ref===o.ref)return Hr(r,o,v)}return o.flags|=1,r=Ns(x,m),r.ref=o.ref,r.return=o,o.child=r}function ax(r,o,c,m,v){if(r!==null){var x=r.memoizedProps;if(fs(x,m)&&r.ref===o.ref)if(cn=!1,o.pendingProps=m=x,(r.lanes&v)!==0)(r.flags&131072)!==0&&(cn=!0);else return o.lanes=r.lanes,Hr(r,o,v)}return tf(r,o,c,m,v)}function lx(r,o,c){var m=o.pendingProps,v=m.children,x=r!==null?r.memoizedState:null;if(m.mode==="hidden")if((o.mode&1)===0)o.memoizedState={baseLanes:0,cachePool:null,transitions:null},dt(gi,xn),xn|=c;else{if((c&1073741824)===0)return r=x!==null?x.baseLanes|c:c,o.lanes=o.childLanes=1073741824,o.memoizedState={baseLanes:r,cachePool:null,transitions:null},o.updateQueue=null,dt(gi,xn),xn|=r,null;o.memoizedState={baseLanes:0,cachePool:null,transitions:null},m=x!==null?x.baseLanes:c,dt(gi,xn),xn|=m}else x!==null?(m=x.baseLanes|c,o.memoizedState=null):m=c,dt(gi,xn),xn|=m;return nn(r,o,v,c),o.child}function cx(r,o){var c=o.ref;(r===null&&c!==null||r!==null&&r.ref!==c)&&(o.flags|=512,o.flags|=2097152)}function tf(r,o,c,m,v){var x=ln(c)?to:Kt.current;return x=ii(o,x),fi(o,v),c=Hd(r,o,c,m,x,v),m=Gd(),r!==null&&!cn?(o.updateQueue=r.updateQueue,o.flags&=-2053,r.lanes&=~v,Hr(r,o,v)):(vt&&m&&Cd(o),o.flags|=1,nn(r,o,c,v),o.child)}function ux(r,o,c,m,v){if(ln(c)){var x=!0;ec(o)}else x=!1;if(fi(o,v),o.stateNode===null)yc(r,o),Z0(o,c,m),Zd(o,c,m,v),m=!0;else if(r===null){var R=o.stateNode,B=o.memoizedProps;R.props=B;var ee=R.context,ce=c.contextType;typeof ce=="object"&&ce!==null?ce=Mn(ce):(ce=ln(c)?to:Kt.current,ce=ii(o,ce));var ge=c.getDerivedStateFromProps,ye=typeof ge=="function"||typeof R.getSnapshotBeforeUpdate=="function";ye||typeof R.UNSAFE_componentWillReceiveProps!="function"&&typeof R.componentWillReceiveProps!="function"||(B!==m||ee!==ce)&&J0(o,R,m,ce),ys=!1;var me=o.memoizedState;R.state=me,cc(o,m,R,v),ee=o.memoizedState,B!==m||me!==ee||an.current||ys?(typeof ge=="function"&&(Qd(o,c,ge,m),ee=o.memoizedState),(B=ys||Q0(o,c,B,m,me,ee,ce))?(ye||typeof R.UNSAFE_componentWillMount!="function"&&typeof R.componentWillMount!="function"||(typeof R.componentWillMount=="function"&&R.componentWillMount(),typeof R.UNSAFE_componentWillMount=="function"&&R.UNSAFE_componentWillMount()),typeof R.componentDidMount=="function"&&(o.flags|=4194308)):(typeof R.componentDidMount=="function"&&(o.flags|=4194308),o.memoizedProps=m,o.memoizedState=ee),R.props=m,R.state=ee,R.context=ce,m=B):(typeof R.componentDidMount=="function"&&(o.flags|=4194308),m=!1)}else{R=o.stateNode,E0(r,o),B=o.memoizedProps,ce=o.type===o.elementType?B:Jn(o.type,B),R.props=ce,ye=o.pendingProps,me=R.context,ee=c.contextType,typeof ee=="object"&&ee!==null?ee=Mn(ee):(ee=ln(c)?to:Kt.current,ee=ii(o,ee));var ke=c.getDerivedStateFromProps;(ge=typeof ke=="function"||typeof R.getSnapshotBeforeUpdate=="function")||typeof R.UNSAFE_componentWillReceiveProps!="function"&&typeof R.componentWillReceiveProps!="function"||(B!==ye||me!==ee)&&J0(o,R,m,ee),ys=!1,me=o.memoizedState,R.state=me,cc(o,m,R,v);var Ee=o.memoizedState;B!==ye||me!==Ee||an.current||ys?(typeof ke=="function"&&(Qd(o,c,ke,m),Ee=o.memoizedState),(ce=ys||Q0(o,c,ce,m,me,Ee,ee)||!1)?(ge||typeof R.UNSAFE_componentWillUpdate!="function"&&typeof R.componentWillUpdate!="function"||(typeof R.componentWillUpdate=="function"&&R.componentWillUpdate(m,Ee,ee),typeof R.UNSAFE_componentWillUpdate=="function"&&R.UNSAFE_componentWillUpdate(m,Ee,ee)),typeof R.componentDidUpdate=="function"&&(o.flags|=4),typeof R.getSnapshotBeforeUpdate=="function"&&(o.flags|=1024)):(typeof R.componentDidUpdate!="function"||B===r.memoizedProps&&me===r.memoizedState||(o.flags|=4),typeof R.getSnapshotBeforeUpdate!="function"||B===r.memoizedProps&&me===r.memoizedState||(o.flags|=1024),o.memoizedProps=m,o.memoizedState=Ee),R.props=m,R.state=Ee,R.context=ee,m=ce):(typeof R.componentDidUpdate!="function"||B===r.memoizedProps&&me===r.memoizedState||(o.flags|=4),typeof R.getSnapshotBeforeUpdate!="function"||B===r.memoizedProps&&me===r.memoizedState||(o.flags|=1024),m=!1)}return nf(r,o,c,m,x,v)}function nf(r,o,c,m,v,x){cx(r,o);var R=(o.flags&128)!==0;if(!m&&!R)return v&&m0(o,c,!1),Hr(r,o,x);m=o.stateNode,mA.current=o;var B=R&&typeof c.getDerivedStateFromError!="function"?null:m.render();return o.flags|=1,r!==null&&R?(o.child=ui(o,r.child,null,x),o.child=ui(o,null,B,x)):nn(r,o,B,x),o.memoizedState=m.state,v&&m0(o,c,!0),o.child}function dx(r){var o=r.stateNode;o.pendingContext?h0(r,o.pendingContext,o.pendingContext!==o.context):o.context&&h0(r,o.context,!1),Dd(r,o.containerInfo)}function fx(r,o,c,m,v){return ci(),Md(v),o.flags|=256,nn(r,o,c,m),o.child}var rf={dehydrated:null,treeContext:null,retryLane:0};function sf(r){return{baseLanes:r,cachePool:null,transitions:null}}function hx(r,o,c){var m=o.pendingProps,v=bt.current,x=!1,R=(o.flags&128)!==0,B;if((B=R)||(B=r!==null&&r.memoizedState===null?!1:(v&2)!==0),B?(x=!0,o.flags&=-129):(r===null||r.memoizedState!==null)&&(v|=1),dt(bt,v&1),r===null)return Ad(o),r=o.memoizedState,r!==null&&(r=r.dehydrated,r!==null)?((o.mode&1)===0?o.lanes=1:r.data==="$!"?o.lanes=8:o.lanes=1073741824,null):(R=m.children,r=m.fallback,x?(m=o.mode,x=o.child,R={mode:"hidden",children:R},(m&1)===0&&x!==null?(x.childLanes=0,x.pendingProps=R):x=Rc(R,m,0,null),r=fo(r,m,c,null),x.return=o,r.return=o,x.sibling=r,o.child=x,o.child.memoizedState=sf(c),o.memoizedState=rf,r):of(o,R));if(v=r.memoizedState,v!==null&&(B=v.dehydrated,B!==null))return gA(r,o,R,m,B,v,c);if(x){x=m.fallback,R=o.mode,v=r.child,B=v.sibling;var ee={mode:"hidden",children:m.children};return(R&1)===0&&o.child!==v?(m=o.child,m.childLanes=0,m.pendingProps=ee,o.deletions=null):(m=Ns(v,ee),m.subtreeFlags=v.subtreeFlags&14680064),B!==null?x=Ns(B,x):(x=fo(x,R,c,null),x.flags|=2),x.return=o,m.return=o,m.sibling=x,o.child=m,m=x,x=o.child,R=r.child.memoizedState,R=R===null?sf(c):{baseLanes:R.baseLanes|c,cachePool:null,transitions:R.transitions},x.memoizedState=R,x.childLanes=r.childLanes&~c,o.memoizedState=rf,m}return x=r.child,r=x.sibling,m=Ns(x,{mode:"visible",children:m.children}),(o.mode&1)===0&&(m.lanes=c),m.return=o,m.sibling=null,r!==null&&(c=o.deletions,c===null?(o.deletions=[r],o.flags|=16):c.push(r)),o.child=m,o.memoizedState=null,m}function of(r,o){return o=Rc({mode:"visible",children:o},r.mode,0,null),o.return=r,r.child=o}function vc(r,o,c,m){return m!==null&&Md(m),ui(o,r.child,null,c),r=of(o,o.pendingProps.children),r.flags|=2,o.memoizedState=null,r}function gA(r,o,c,m,v,x,R){if(c)return o.flags&256?(o.flags&=-257,m=Jd(Error(n(422))),vc(r,o,R,m)):o.memoizedState!==null?(o.child=r.child,o.flags|=128,null):(x=m.fallback,v=o.mode,m=Rc({mode:"visible",children:m.children},v,0,null),x=fo(x,v,R,null),x.flags|=2,m.return=o,x.return=o,m.sibling=x,o.child=m,(o.mode&1)!==0&&ui(o,r.child,null,R),o.child.memoizedState=sf(R),o.memoizedState=rf,x);if((o.mode&1)===0)return vc(r,o,R,null);if(v.data==="$!"){if(m=v.nextSibling&&v.nextSibling.dataset,m)var B=m.dgst;return m=B,x=Error(n(419)),m=Jd(x,m,void 0),vc(r,o,R,m)}if(B=(R&r.childLanes)!==0,cn||B){if(m=Dt,m!==null){switch(R&-R){case 4:v=2;break;case 16:v=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:v=32;break;case 536870912:v=268435456;break;default:v=0}v=(v&(m.suspendedLanes|R))!==0?0:v,v!==0&&v!==x.retryLane&&(x.retryLane=v,Ur(r,v),nr(m,r,v,-1))}return _f(),m=Jd(Error(n(421))),vc(r,o,R,m)}return v.data==="$?"?(o.flags|=128,o.child=r.child,o=TA.bind(null,r),v._reactRetry=o,null):(r=x.treeContext,wn=ps(v.nextSibling),yn=o,vt=!0,Zn=null,r!==null&&(Rn[An++]=zr,Rn[An++]=Br,Rn[An++]=no,zr=r.id,Br=r.overflow,no=o),o=of(o,m.children),o.flags|=4096,o)}function px(r,o,c){r.lanes|=o;var m=r.alternate;m!==null&&(m.lanes|=o),$d(r.return,o,c)}function af(r,o,c,m,v){var x=r.memoizedState;x===null?r.memoizedState={isBackwards:o,rendering:null,renderingStartTime:0,last:m,tail:c,tailMode:v}:(x.isBackwards=o,x.rendering=null,x.renderingStartTime=0,x.last=m,x.tail=c,x.tailMode=v)}function mx(r,o,c){var m=o.pendingProps,v=m.revealOrder,x=m.tail;if(nn(r,o,m.children,c),m=bt.current,(m&2)!==0)m=m&1|2,o.flags|=128;else{if(r!==null&&(r.flags&128)!==0)e:for(r=o.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&px(r,c,o);else if(r.tag===19)px(r,c,o);else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===o)break e;for(;r.sibling===null;){if(r.return===null||r.return===o)break e;r=r.return}r.sibling.return=r.return,r=r.sibling}m&=1}if(dt(bt,m),(o.mode&1)===0)o.memoizedState=null;else switch(v){case"forwards":for(c=o.child,v=null;c!==null;)r=c.alternate,r!==null&&uc(r)===null&&(v=c),c=c.sibling;c=v,c===null?(v=o.child,o.child=null):(v=c.sibling,c.sibling=null),af(o,!1,v,c,x);break;case"backwards":for(c=null,v=o.child,o.child=null;v!==null;){if(r=v.alternate,r!==null&&uc(r)===null){o.child=v;break}r=v.sibling,v.sibling=c,c=v,v=r}af(o,!0,c,null,x);break;case"together":af(o,!1,null,null,void 0);break;default:o.memoizedState=null}return o.child}function yc(r,o){(o.mode&1)===0&&r!==null&&(r.alternate=null,o.alternate=null,o.flags|=2)}function Hr(r,o,c){if(r!==null&&(o.dependencies=r.dependencies),ao|=o.lanes,(c&o.childLanes)===0)return null;if(r!==null&&o.child!==r.child)throw Error(n(153));if(o.child!==null){for(r=o.child,c=Ns(r,r.pendingProps),o.child=c,c.return=o;r.sibling!==null;)r=r.sibling,c=c.sibling=Ns(r,r.pendingProps),c.return=o;c.sibling=null}return o.child}function vA(r,o,c){switch(o.tag){case 3:dx(o),ci();break;case 5:T0(o);break;case 1:ln(o.type)&&ec(o);break;case 4:Dd(o,o.stateNode.containerInfo);break;case 10:var m=o.type._context,v=o.memoizedProps.value;dt(ic,m._currentValue),m._currentValue=v;break;case 13:if(m=o.memoizedState,m!==null)return m.dehydrated!==null?(dt(bt,bt.current&1),o.flags|=128,null):(c&o.child.childLanes)!==0?hx(r,o,c):(dt(bt,bt.current&1),r=Hr(r,o,c),r!==null?r.sibling:null);dt(bt,bt.current&1);break;case 19:if(m=(c&o.childLanes)!==0,(r.flags&128)!==0){if(m)return mx(r,o,c);o.flags|=128}if(v=o.memoizedState,v!==null&&(v.rendering=null,v.tail=null,v.lastEffect=null),dt(bt,bt.current),m)break;return null;case 22:case 23:return o.lanes=0,lx(r,o,c)}return Hr(r,o,c)}var gx,lf,vx,yx;gx=function(r,o){for(var c=o.child;c!==null;){if(c.tag===5||c.tag===6)r.appendChild(c.stateNode);else if(c.tag!==4&&c.child!==null){c.child.return=c,c=c.child;continue}if(c===o)break;for(;c.sibling===null;){if(c.return===null||c.return===o)return;c=c.return}c.sibling.return=c.return,c=c.sibling}},lf=function(){},vx=function(r,o,c,m){var v=r.memoizedProps;if(v!==m){r=o.stateNode,oo(br.current);var x=null;switch(c){case"input":v=Me(r,v),m=Me(r,m),x=[];break;case"select":v=te({},v,{value:void 0}),m=te({},m,{value:void 0}),x=[];break;case"textarea":v=Be(r,v),m=Be(r,m),x=[];break;default:typeof v.onClick!="function"&&typeof m.onClick=="function"&&(r.onclick=Ql)}st(c,m);var R;c=null;for(ce in v)if(!m.hasOwnProperty(ce)&&v.hasOwnProperty(ce)&&v[ce]!=null)if(ce==="style"){var B=v[ce];for(R in B)B.hasOwnProperty(R)&&(c||(c={}),c[R]="")}else ce!=="dangerouslySetInnerHTML"&&ce!=="children"&&ce!=="suppressContentEditableWarning"&&ce!=="suppressHydrationWarning"&&ce!=="autoFocus"&&(i.hasOwnProperty(ce)?x||(x=[]):(x=x||[]).push(ce,null));for(ce in m){var ee=m[ce];if(B=v!=null?v[ce]:void 0,m.hasOwnProperty(ce)&&ee!==B&&(ee!=null||B!=null))if(ce==="style")if(B){for(R in B)!B.hasOwnProperty(R)||ee&&ee.hasOwnProperty(R)||(c||(c={}),c[R]="");for(R in ee)ee.hasOwnProperty(R)&&B[R]!==ee[R]&&(c||(c={}),c[R]=ee[R])}else c||(x||(x=[]),x.push(ce,c)),c=ee;else ce==="dangerouslySetInnerHTML"?(ee=ee?ee.__html:void 0,B=B?B.__html:void 0,ee!=null&&B!==ee&&(x=x||[]).push(ce,ee)):ce==="children"?typeof ee!="string"&&typeof ee!="number"||(x=x||[]).push(ce,""+ee):ce!=="suppressContentEditableWarning"&&ce!=="suppressHydrationWarning"&&(i.hasOwnProperty(ce)?(ee!=null&&ce==="onScroll"&&ht("scroll",r),x||B===ee||(x=[])):(x=x||[]).push(ce,ee))}c&&(x=x||[]).push("style",c);var ce=x;(o.updateQueue=ce)&&(o.flags|=4)}},yx=function(r,o,c,m){c!==m&&(o.flags|=4)};function Aa(r,o){if(!vt)switch(r.tailMode){case"hidden":o=r.tail;for(var c=null;o!==null;)o.alternate!==null&&(c=o),o=o.sibling;c===null?r.tail=null:c.sibling=null;break;case"collapsed":c=r.tail;for(var m=null;c!==null;)c.alternate!==null&&(m=c),c=c.sibling;m===null?o||r.tail===null?r.tail=null:r.tail.sibling=null:m.sibling=null}}function Qt(r){var o=r.alternate!==null&&r.alternate.child===r.child,c=0,m=0;if(o)for(var v=r.child;v!==null;)c|=v.lanes|v.childLanes,m|=v.subtreeFlags&14680064,m|=v.flags&14680064,v.return=r,v=v.sibling;else for(v=r.child;v!==null;)c|=v.lanes|v.childLanes,m|=v.subtreeFlags,m|=v.flags,v.return=r,v=v.sibling;return r.subtreeFlags|=m,r.childLanes=c,o}function yA(r,o,c){var m=o.pendingProps;switch(Td(o),o.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Qt(o),null;case 1:return ln(o.type)&&Jl(),Qt(o),null;case 3:return m=o.stateNode,hi(),pt(an),pt(Kt),Bd(),m.pendingContext&&(m.context=m.pendingContext,m.pendingContext=null),(r===null||r.child===null)&&(sc(o)?o.flags|=4:r===null||r.memoizedState.isDehydrated&&(o.flags&256)===0||(o.flags|=1024,Zn!==null&&(wf(Zn),Zn=null))),lf(r,o),Qt(o),null;case 5:Fd(o);var v=oo(Ea.current);if(c=o.type,r!==null&&o.stateNode!=null)vx(r,o,c,m,v),r.ref!==o.ref&&(o.flags|=512,o.flags|=2097152);else{if(!m){if(o.stateNode===null)throw Error(n(166));return Qt(o),null}if(r=oo(br.current),sc(o)){m=o.stateNode,c=o.type;var x=o.memoizedProps;switch(m[xr]=o,m[ba]=x,r=(o.mode&1)!==0,c){case"dialog":ht("cancel",m),ht("close",m);break;case"iframe":case"object":case"embed":ht("load",m);break;case"video":case"audio":for(v=0;v<ya.length;v++)ht(ya[v],m);break;case"source":ht("error",m);break;case"img":case"image":case"link":ht("error",m),ht("load",m);break;case"details":ht("toggle",m);break;case"input":_e(m,x),ht("invalid",m);break;case"select":m._wrapperState={wasMultiple:!!x.multiple},ht("invalid",m);break;case"textarea":Ie(m,x),ht("invalid",m)}st(c,x),v=null;for(var R in x)if(x.hasOwnProperty(R)){var B=x[R];R==="children"?typeof B=="string"?m.textContent!==B&&(x.suppressHydrationWarning!==!0&&Xl(m.textContent,B,r),v=["children",B]):typeof B=="number"&&m.textContent!==""+B&&(x.suppressHydrationWarning!==!0&&Xl(m.textContent,B,r),v=["children",""+B]):i.hasOwnProperty(R)&&B!=null&&R==="onScroll"&&ht("scroll",m)}switch(c){case"input":je(m),ve(m,x,!0);break;case"textarea":je(m),Ge(m);break;case"select":case"option":break;default:typeof x.onClick=="function"&&(m.onclick=Ql)}m=v,o.updateQueue=m,m!==null&&(o.flags|=4)}else{R=v.nodeType===9?v:v.ownerDocument,r==="http://www.w3.org/1999/xhtml"&&(r=Qe(c)),r==="http://www.w3.org/1999/xhtml"?c==="script"?(r=R.createElement("div"),r.innerHTML="<script><\/script>",r=r.removeChild(r.firstChild)):typeof m.is=="string"?r=R.createElement(c,{is:m.is}):(r=R.createElement(c),c==="select"&&(R=r,m.multiple?R.multiple=!0:m.size&&(R.size=m.size))):r=R.createElementNS(r,c),r[xr]=o,r[ba]=m,gx(r,o,!1,!1),o.stateNode=r;e:{switch(R=Te(c,m),c){case"dialog":ht("cancel",r),ht("close",r),v=m;break;case"iframe":case"object":case"embed":ht("load",r),v=m;break;case"video":case"audio":for(v=0;v<ya.length;v++)ht(ya[v],r);v=m;break;case"source":ht("error",r),v=m;break;case"img":case"image":case"link":ht("error",r),ht("load",r),v=m;break;case"details":ht("toggle",r),v=m;break;case"input":_e(r,m),v=Me(r,m),ht("invalid",r);break;case"option":v=m;break;case"select":r._wrapperState={wasMultiple:!!m.multiple},v=te({},m,{value:void 0}),ht("invalid",r);break;case"textarea":Ie(r,m),v=Be(r,m),ht("invalid",r);break;default:v=m}st(c,v),B=v;for(x in B)if(B.hasOwnProperty(x)){var ee=B[x];x==="style"?Ye(r,ee):x==="dangerouslySetInnerHTML"?(ee=ee?ee.__html:void 0,ee!=null&&Mt(r,ee)):x==="children"?typeof ee=="string"?(c!=="textarea"||ee!=="")&&ae(r,ee):typeof ee=="number"&&ae(r,""+ee):x!=="suppressContentEditableWarning"&&x!=="suppressHydrationWarning"&&x!=="autoFocus"&&(i.hasOwnProperty(x)?ee!=null&&x==="onScroll"&&ht("scroll",r):ee!=null&&j(r,x,ee,R))}switch(c){case"input":je(r),ve(r,m,!1);break;case"textarea":je(r),Ge(r);break;case"option":m.value!=null&&r.setAttribute("value",""+fe(m.value));break;case"select":r.multiple=!!m.multiple,x=m.value,x!=null?rt(r,!!m.multiple,x,!1):m.defaultValue!=null&&rt(r,!!m.multiple,m.defaultValue,!0);break;default:typeof v.onClick=="function"&&(r.onclick=Ql)}switch(c){case"button":case"input":case"select":case"textarea":m=!!m.autoFocus;break e;case"img":m=!0;break e;default:m=!1}}m&&(o.flags|=4)}o.ref!==null&&(o.flags|=512,o.flags|=2097152)}return Qt(o),null;case 6:if(r&&o.stateNode!=null)yx(r,o,r.memoizedProps,m);else{if(typeof m!="string"&&o.stateNode===null)throw Error(n(166));if(c=oo(Ea.current),oo(br.current),sc(o)){if(m=o.stateNode,c=o.memoizedProps,m[xr]=o,(x=m.nodeValue!==c)&&(r=yn,r!==null))switch(r.tag){case 3:Xl(m.nodeValue,c,(r.mode&1)!==0);break;case 5:r.memoizedProps.suppressHydrationWarning!==!0&&Xl(m.nodeValue,c,(r.mode&1)!==0)}x&&(o.flags|=4)}else m=(c.nodeType===9?c:c.ownerDocument).createTextNode(m),m[xr]=o,o.stateNode=m}return Qt(o),null;case 13:if(pt(bt),m=o.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(vt&&wn!==null&&(o.mode&1)!==0&&(o.flags&128)===0)b0(),ci(),o.flags|=98560,x=!1;else if(x=sc(o),m!==null&&m.dehydrated!==null){if(r===null){if(!x)throw Error(n(318));if(x=o.memoizedState,x=x!==null?x.dehydrated:null,!x)throw Error(n(317));x[xr]=o}else ci(),(o.flags&128)===0&&(o.memoizedState=null),o.flags|=4;Qt(o),x=!1}else Zn!==null&&(wf(Zn),Zn=null),x=!0;if(!x)return o.flags&65536?o:null}return(o.flags&128)!==0?(o.lanes=c,o):(m=m!==null,m!==(r!==null&&r.memoizedState!==null)&&m&&(o.child.flags|=8192,(o.mode&1)!==0&&(r===null||(bt.current&1)!==0?Pt===0&&(Pt=3):_f())),o.updateQueue!==null&&(o.flags|=4),Qt(o),null);case 4:return hi(),lf(r,o),r===null&&wa(o.stateNode.containerInfo),Qt(o),null;case 10:return Pd(o.type._context),Qt(o),null;case 17:return ln(o.type)&&Jl(),Qt(o),null;case 19:if(pt(bt),x=o.memoizedState,x===null)return Qt(o),null;if(m=(o.flags&128)!==0,R=x.rendering,R===null)if(m)Aa(x,!1);else{if(Pt!==0||r!==null&&(r.flags&128)!==0)for(r=o.child;r!==null;){if(R=uc(r),R!==null){for(o.flags|=128,Aa(x,!1),m=R.updateQueue,m!==null&&(o.updateQueue=m,o.flags|=4),o.subtreeFlags=0,m=c,c=o.child;c!==null;)x=c,r=m,x.flags&=14680066,R=x.alternate,R===null?(x.childLanes=0,x.lanes=r,x.child=null,x.subtreeFlags=0,x.memoizedProps=null,x.memoizedState=null,x.updateQueue=null,x.dependencies=null,x.stateNode=null):(x.childLanes=R.childLanes,x.lanes=R.lanes,x.child=R.child,x.subtreeFlags=0,x.deletions=null,x.memoizedProps=R.memoizedProps,x.memoizedState=R.memoizedState,x.updateQueue=R.updateQueue,x.type=R.type,r=R.dependencies,x.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),c=c.sibling;return dt(bt,bt.current&1|2),o.child}r=r.sibling}x.tail!==null&&ot()>vi&&(o.flags|=128,m=!0,Aa(x,!1),o.lanes=4194304)}else{if(!m)if(r=uc(R),r!==null){if(o.flags|=128,m=!0,c=r.updateQueue,c!==null&&(o.updateQueue=c,o.flags|=4),Aa(x,!0),x.tail===null&&x.tailMode==="hidden"&&!R.alternate&&!vt)return Qt(o),null}else 2*ot()-x.renderingStartTime>vi&&c!==1073741824&&(o.flags|=128,m=!0,Aa(x,!1),o.lanes=4194304);x.isBackwards?(R.sibling=o.child,o.child=R):(c=x.last,c!==null?c.sibling=R:o.child=R,x.last=R)}return x.tail!==null?(o=x.tail,x.rendering=o,x.tail=o.sibling,x.renderingStartTime=ot(),o.sibling=null,c=bt.current,dt(bt,m?c&1|2:c&1),o):(Qt(o),null);case 22:case 23:return bf(),m=o.memoizedState!==null,r!==null&&r.memoizedState!==null!==m&&(o.flags|=8192),m&&(o.mode&1)!==0?(xn&1073741824)!==0&&(Qt(o),o.subtreeFlags&6&&(o.flags|=8192)):Qt(o),null;case 24:return null;case 25:return null}throw Error(n(156,o.tag))}function wA(r,o){switch(Td(o),o.tag){case 1:return ln(o.type)&&Jl(),r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 3:return hi(),pt(an),pt(Kt),Bd(),r=o.flags,(r&65536)!==0&&(r&128)===0?(o.flags=r&-65537|128,o):null;case 5:return Fd(o),null;case 13:if(pt(bt),r=o.memoizedState,r!==null&&r.dehydrated!==null){if(o.alternate===null)throw Error(n(340));ci()}return r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 19:return pt(bt),null;case 4:return hi(),null;case 10:return Pd(o.type._context),null;case 22:case 23:return bf(),null;case 24:return null;default:return null}}var wc=!1,Zt=!1,xA=typeof WeakSet=="function"?WeakSet:Set,Se=null;function mi(r,o){var c=r.ref;if(c!==null)if(typeof c=="function")try{c(null)}catch(m){St(r,o,m)}else c.current=null}function cf(r,o,c){try{c()}catch(m){St(r,o,m)}}var wx=!1;function bA(r,o){if(xd=zs,r=ga(),Qs(r)){if("selectionStart"in r)var c={start:r.selectionStart,end:r.selectionEnd};else e:{c=(c=r.ownerDocument)&&c.defaultView||window;var m=c.getSelection&&c.getSelection();if(m&&m.rangeCount!==0){c=m.anchorNode;var v=m.anchorOffset,x=m.focusNode;m=m.focusOffset;try{c.nodeType,x.nodeType}catch{c=null;break e}var R=0,B=-1,ee=-1,ce=0,ge=0,ye=r,me=null;t:for(;;){for(var ke;ye!==c||v!==0&&ye.nodeType!==3||(B=R+v),ye!==x||m!==0&&ye.nodeType!==3||(ee=R+m),ye.nodeType===3&&(R+=ye.nodeValue.length),(ke=ye.firstChild)!==null;)me=ye,ye=ke;for(;;){if(ye===r)break t;if(me===c&&++ce===v&&(B=R),me===x&&++ge===m&&(ee=R),(ke=ye.nextSibling)!==null)break;ye=me,me=ye.parentNode}ye=ke}c=B===-1||ee===-1?null:{start:B,end:ee}}else c=null}c=c||{start:0,end:0}}else c=null;for(bd={focusedElem:r,selectionRange:c},zs=!1,Se=o;Se!==null;)if(o=Se,r=o.child,(o.subtreeFlags&1028)!==0&&r!==null)r.return=o,Se=r;else for(;Se!==null;){o=Se;try{var Ee=o.alternate;if((o.flags&1024)!==0)switch(o.tag){case 0:case 11:case 15:break;case 1:if(Ee!==null){var Re=Ee.memoizedProps,jt=Ee.memoizedState,oe=o.stateNode,ne=oe.getSnapshotBeforeUpdate(o.elementType===o.type?Re:Jn(o.type,Re),jt);oe.__reactInternalSnapshotBeforeUpdate=ne}break;case 3:var ie=o.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(we){St(o,o.return,we)}if(r=o.sibling,r!==null){r.return=o.return,Se=r;break}Se=o.return}return Ee=wx,wx=!1,Ee}function Ma(r,o,c){var m=o.updateQueue;if(m=m!==null?m.lastEffect:null,m!==null){var v=m=m.next;do{if((v.tag&r)===r){var x=v.destroy;v.destroy=void 0,x!==void 0&&cf(o,c,x)}v=v.next}while(v!==m)}}function xc(r,o){if(o=o.updateQueue,o=o!==null?o.lastEffect:null,o!==null){var c=o=o.next;do{if((c.tag&r)===r){var m=c.create;c.destroy=m()}c=c.next}while(c!==o)}}function uf(r){var o=r.ref;if(o!==null){var c=r.stateNode;switch(r.tag){case 5:r=c;break;default:r=c}typeof o=="function"?o(r):o.current=r}}function xx(r){var o=r.alternate;o!==null&&(r.alternate=null,xx(o)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(o=r.stateNode,o!==null&&(delete o[xr],delete o[ba],delete o[Nd],delete o[rA],delete o[sA])),r.stateNode=null,r.return=null,r.dependencies=null,r.memoizedProps=null,r.memoizedState=null,r.pendingProps=null,r.stateNode=null,r.updateQueue=null}function bx(r){return r.tag===5||r.tag===3||r.tag===4}function _x(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||bx(r.return))return null;r=r.return}for(r.sibling.return=r.return,r=r.sibling;r.tag!==5&&r.tag!==6&&r.tag!==18;){if(r.flags&2||r.child===null||r.tag===4)continue e;r.child.return=r,r=r.child}if(!(r.flags&2))return r.stateNode}}function df(r,o,c){var m=r.tag;if(m===5||m===6)r=r.stateNode,o?c.nodeType===8?c.parentNode.insertBefore(r,o):c.insertBefore(r,o):(c.nodeType===8?(o=c.parentNode,o.insertBefore(r,c)):(o=c,o.appendChild(r)),c=c._reactRootContainer,c!=null||o.onclick!==null||(o.onclick=Ql));else if(m!==4&&(r=r.child,r!==null))for(df(r,o,c),r=r.sibling;r!==null;)df(r,o,c),r=r.sibling}function ff(r,o,c){var m=r.tag;if(m===5||m===6)r=r.stateNode,o?c.insertBefore(r,o):c.appendChild(r);else if(m!==4&&(r=r.child,r!==null))for(ff(r,o,c),r=r.sibling;r!==null;)ff(r,o,c),r=r.sibling}var Ut=null,er=!1;function xs(r,o,c){for(c=c.child;c!==null;)kx(r,o,c),c=c.sibling}function kx(r,o,c){if(sn&&typeof sn.onCommitFiberUnmount=="function")try{sn.onCommitFiberUnmount(mt,c)}catch{}switch(c.tag){case 5:Zt||mi(c,o);case 6:var m=Ut,v=er;Ut=null,xs(r,o,c),Ut=m,er=v,Ut!==null&&(er?(r=Ut,c=c.stateNode,r.nodeType===8?r.parentNode.removeChild(c):r.removeChild(c)):Ut.removeChild(c.stateNode));break;case 18:Ut!==null&&(er?(r=Ut,c=c.stateNode,r.nodeType===8?Sd(r.parentNode,c):r.nodeType===1&&Sd(r,c),ls(r)):Sd(Ut,c.stateNode));break;case 4:m=Ut,v=er,Ut=c.stateNode.containerInfo,er=!0,xs(r,o,c),Ut=m,er=v;break;case 0:case 11:case 14:case 15:if(!Zt&&(m=c.updateQueue,m!==null&&(m=m.lastEffect,m!==null))){v=m=m.next;do{var x=v,R=x.destroy;x=x.tag,R!==void 0&&((x&2)!==0||(x&4)!==0)&&cf(c,o,R),v=v.next}while(v!==m)}xs(r,o,c);break;case 1:if(!Zt&&(mi(c,o),m=c.stateNode,typeof m.componentWillUnmount=="function"))try{m.props=c.memoizedProps,m.state=c.memoizedState,m.componentWillUnmount()}catch(B){St(c,o,B)}xs(r,o,c);break;case 21:xs(r,o,c);break;case 22:c.mode&1?(Zt=(m=Zt)||c.memoizedState!==null,xs(r,o,c),Zt=m):xs(r,o,c);break;default:xs(r,o,c)}}function Sx(r){var o=r.updateQueue;if(o!==null){r.updateQueue=null;var c=r.stateNode;c===null&&(c=r.stateNode=new xA),o.forEach(function(m){var v=RA.bind(null,r,m);c.has(m)||(c.add(m),m.then(v,v))})}}function tr(r,o){var c=o.deletions;if(c!==null)for(var m=0;m<c.length;m++){var v=c[m];try{var x=r,R=o,B=R;e:for(;B!==null;){switch(B.tag){case 5:Ut=B.stateNode,er=!1;break e;case 3:Ut=B.stateNode.containerInfo,er=!0;break e;case 4:Ut=B.stateNode.containerInfo,er=!0;break e}B=B.return}if(Ut===null)throw Error(n(160));kx(x,R,v),Ut=null,er=!1;var ee=v.alternate;ee!==null&&(ee.return=null),v.return=null}catch(ce){St(v,o,ce)}}if(o.subtreeFlags&12854)for(o=o.child;o!==null;)Nx(o,r),o=o.sibling}function Nx(r,o){var c=r.alternate,m=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:if(tr(o,r),kr(r),m&4){try{Ma(3,r,r.return),xc(3,r)}catch(Re){St(r,r.return,Re)}try{Ma(5,r,r.return)}catch(Re){St(r,r.return,Re)}}break;case 1:tr(o,r),kr(r),m&512&&c!==null&&mi(c,c.return);break;case 5:if(tr(o,r),kr(r),m&512&&c!==null&&mi(c,c.return),r.flags&32){var v=r.stateNode;try{ae(v,"")}catch(Re){St(r,r.return,Re)}}if(m&4&&(v=r.stateNode,v!=null)){var x=r.memoizedProps,R=c!==null?c.memoizedProps:x,B=r.type,ee=r.updateQueue;if(r.updateQueue=null,ee!==null)try{B==="input"&&x.type==="radio"&&x.name!=null&&G(v,x),Te(B,R);var ce=Te(B,x);for(R=0;R<ee.length;R+=2){var ge=ee[R],ye=ee[R+1];ge==="style"?Ye(v,ye):ge==="dangerouslySetInnerHTML"?Mt(v,ye):ge==="children"?ae(v,ye):j(v,ge,ye,ce)}switch(B){case"input":he(v,x);break;case"textarea":Je(v,x);break;case"select":var me=v._wrapperState.wasMultiple;v._wrapperState.wasMultiple=!!x.multiple;var ke=x.value;ke!=null?rt(v,!!x.multiple,ke,!1):me!==!!x.multiple&&(x.defaultValue!=null?rt(v,!!x.multiple,x.defaultValue,!0):rt(v,!!x.multiple,x.multiple?[]:"",!1))}v[ba]=x}catch(Re){St(r,r.return,Re)}}break;case 6:if(tr(o,r),kr(r),m&4){if(r.stateNode===null)throw Error(n(162));v=r.stateNode,x=r.memoizedProps;try{v.nodeValue=x}catch(Re){St(r,r.return,Re)}}break;case 3:if(tr(o,r),kr(r),m&4&&c!==null&&c.memoizedState.isDehydrated)try{ls(o.containerInfo)}catch(Re){St(r,r.return,Re)}break;case 4:tr(o,r),kr(r);break;case 13:tr(o,r),kr(r),v=r.child,v.flags&8192&&(x=v.memoizedState!==null,v.stateNode.isHidden=x,!x||v.alternate!==null&&v.alternate.memoizedState!==null||(mf=ot())),m&4&&Sx(r);break;case 22:if(ge=c!==null&&c.memoizedState!==null,r.mode&1?(Zt=(ce=Zt)||ge,tr(o,r),Zt=ce):tr(o,r),kr(r),m&8192){if(ce=r.memoizedState!==null,(r.stateNode.isHidden=ce)&&!ge&&(r.mode&1)!==0)for(Se=r,ge=r.child;ge!==null;){for(ye=Se=ge;Se!==null;){switch(me=Se,ke=me.child,me.tag){case 0:case 11:case 14:case 15:Ma(4,me,me.return);break;case 1:mi(me,me.return);var Ee=me.stateNode;if(typeof Ee.componentWillUnmount=="function"){m=me,c=me.return;try{o=m,Ee.props=o.memoizedProps,Ee.state=o.memoizedState,Ee.componentWillUnmount()}catch(Re){St(m,c,Re)}}break;case 5:mi(me,me.return);break;case 22:if(me.memoizedState!==null){Cx(ye);continue}}ke!==null?(ke.return=me,Se=ke):Cx(ye)}ge=ge.sibling}e:for(ge=null,ye=r;;){if(ye.tag===5){if(ge===null){ge=ye;try{v=ye.stateNode,ce?(x=v.style,typeof x.setProperty=="function"?x.setProperty("display","none","important"):x.display="none"):(B=ye.stateNode,ee=ye.memoizedProps.style,R=ee!=null&&ee.hasOwnProperty("display")?ee.display:null,B.style.display=Ne("display",R))}catch(Re){St(r,r.return,Re)}}}else if(ye.tag===6){if(ge===null)try{ye.stateNode.nodeValue=ce?"":ye.memoizedProps}catch(Re){St(r,r.return,Re)}}else if((ye.tag!==22&&ye.tag!==23||ye.memoizedState===null||ye===r)&&ye.child!==null){ye.child.return=ye,ye=ye.child;continue}if(ye===r)break e;for(;ye.sibling===null;){if(ye.return===null||ye.return===r)break e;ge===ye&&(ge=null),ye=ye.return}ge===ye&&(ge=null),ye.sibling.return=ye.return,ye=ye.sibling}}break;case 19:tr(o,r),kr(r),m&4&&Sx(r);break;case 21:break;default:tr(o,r),kr(r)}}function kr(r){var o=r.flags;if(o&2){try{e:{for(var c=r.return;c!==null;){if(bx(c)){var m=c;break e}c=c.return}throw Error(n(160))}switch(m.tag){case 5:var v=m.stateNode;m.flags&32&&(ae(v,""),m.flags&=-33);var x=_x(r);ff(r,x,v);break;case 3:case 4:var R=m.stateNode.containerInfo,B=_x(r);df(r,B,R);break;default:throw Error(n(161))}}catch(ee){St(r,r.return,ee)}r.flags&=-3}o&4096&&(r.flags&=-4097)}function _A(r,o,c){Se=r,Ex(r)}function Ex(r,o,c){for(var m=(r.mode&1)!==0;Se!==null;){var v=Se,x=v.child;if(v.tag===22&&m){var R=v.memoizedState!==null||wc;if(!R){var B=v.alternate,ee=B!==null&&B.memoizedState!==null||Zt;B=wc;var ce=Zt;if(wc=R,(Zt=ee)&&!ce)for(Se=v;Se!==null;)R=Se,ee=R.child,R.tag===22&&R.memoizedState!==null?Tx(v):ee!==null?(ee.return=R,Se=ee):Tx(v);for(;x!==null;)Se=x,Ex(x),x=x.sibling;Se=v,wc=B,Zt=ce}jx(r)}else(v.subtreeFlags&8772)!==0&&x!==null?(x.return=v,Se=x):jx(r)}}function jx(r){for(;Se!==null;){var o=Se;if((o.flags&8772)!==0){var c=o.alternate;try{if((o.flags&8772)!==0)switch(o.tag){case 0:case 11:case 15:Zt||xc(5,o);break;case 1:var m=o.stateNode;if(o.flags&4&&!Zt)if(c===null)m.componentDidMount();else{var v=o.elementType===o.type?c.memoizedProps:Jn(o.type,c.memoizedProps);m.componentDidUpdate(v,c.memoizedState,m.__reactInternalSnapshotBeforeUpdate)}var x=o.updateQueue;x!==null&&C0(o,x,m);break;case 3:var R=o.updateQueue;if(R!==null){if(c=null,o.child!==null)switch(o.child.tag){case 5:c=o.child.stateNode;break;case 1:c=o.child.stateNode}C0(o,R,c)}break;case 5:var B=o.stateNode;if(c===null&&o.flags&4){c=B;var ee=o.memoizedProps;switch(o.type){case"button":case"input":case"select":case"textarea":ee.autoFocus&&c.focus();break;case"img":ee.src&&(c.src=ee.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(o.memoizedState===null){var ce=o.alternate;if(ce!==null){var ge=ce.memoizedState;if(ge!==null){var ye=ge.dehydrated;ye!==null&&ls(ye)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}Zt||o.flags&512&&uf(o)}catch(me){St(o,o.return,me)}}if(o===r){Se=null;break}if(c=o.sibling,c!==null){c.return=o.return,Se=c;break}Se=o.return}}function Cx(r){for(;Se!==null;){var o=Se;if(o===r){Se=null;break}var c=o.sibling;if(c!==null){c.return=o.return,Se=c;break}Se=o.return}}function Tx(r){for(;Se!==null;){var o=Se;try{switch(o.tag){case 0:case 11:case 15:var c=o.return;try{xc(4,o)}catch(ee){St(o,c,ee)}break;case 1:var m=o.stateNode;if(typeof m.componentDidMount=="function"){var v=o.return;try{m.componentDidMount()}catch(ee){St(o,v,ee)}}var x=o.return;try{uf(o)}catch(ee){St(o,x,ee)}break;case 5:var R=o.return;try{uf(o)}catch(ee){St(o,R,ee)}}}catch(ee){St(o,o.return,ee)}if(o===r){Se=null;break}var B=o.sibling;if(B!==null){B.return=o.return,Se=B;break}Se=o.return}}var kA=Math.ceil,bc=C.ReactCurrentDispatcher,hf=C.ReactCurrentOwner,On=C.ReactCurrentBatchConfig,et=0,Dt=null,Tt=null,Wt=0,xn=0,gi=ms(0),Pt=0,Ia=null,ao=0,_c=0,pf=0,Oa=null,un=null,mf=0,vi=1/0,Gr=null,kc=!1,gf=null,bs=null,Sc=!1,_s=null,Nc=0,Pa=0,vf=null,Ec=-1,jc=0;function rn(){return(et&6)!==0?ot():Ec!==-1?Ec:Ec=ot()}function ks(r){return(r.mode&1)===0?1:(et&2)!==0&&Wt!==0?Wt&-Wt:iA.transition!==null?(jc===0&&(jc=Ds()),jc):(r=Ze,r!==0||(r=window.event,r=r===void 0?16:Ko(r.type)),r)}function nr(r,o,c,m){if(50<Pa)throw Pa=0,vf=null,Error(n(185));os(r,c,m),((et&2)===0||r!==Dt)&&(r===Dt&&((et&2)===0&&(_c|=c),Pt===4&&Ss(r,Wt)),dn(r,m),c===1&&et===0&&(o.mode&1)===0&&(vi=ot()+500,tc&&vs()))}function dn(r,o){var c=r.callbackNode;jl(r,o);var m=qs(r,r===Dt?Wt:0);if(m===0)c!==null&&Ls(c),r.callbackNode=null,r.callbackPriority=0;else if(o=m&-m,r.callbackPriority!==o){if(c!=null&&Ls(c),o===1)r.tag===0?oA(Ax.bind(null,r)):g0(Ax.bind(null,r)),tA(function(){(et&6)===0&&vs()}),c=null;else{switch(Ji(m)){case 1:c=ts;break;case 4:c=Gt;break;case 16:c=Wn;break;case 536870912:c=ns;break;default:c=Wn}c=Dx(c,Rx.bind(null,r))}r.callbackPriority=o,r.callbackNode=c}}function Rx(r,o){if(Ec=-1,jc=0,(et&6)!==0)throw Error(n(327));var c=r.callbackNode;if(yi()&&r.callbackNode!==c)return null;var m=qs(r,r===Dt?Wt:0);if(m===0)return null;if((m&30)!==0||(m&r.expiredLanes)!==0||o)o=Cc(r,m);else{o=m;var v=et;et|=2;var x=Ix();(Dt!==r||Wt!==o)&&(Gr=null,vi=ot()+500,co(r,o));do try{EA();break}catch(B){Mx(r,B)}while(!0);Od(),bc.current=x,et=v,Tt!==null?o=0:(Dt=null,Wt=0,o=Pt)}if(o!==0){if(o===2&&(v=Bo(r),v!==0&&(m=v,o=yf(r,v))),o===1)throw c=Ia,co(r,0),Ss(r,m),dn(r,ot()),c;if(o===6)Ss(r,m);else{if(v=r.current.alternate,(m&30)===0&&!SA(v)&&(o=Cc(r,m),o===2&&(x=Bo(r),x!==0&&(m=x,o=yf(r,x))),o===1))throw c=Ia,co(r,0),Ss(r,m),dn(r,ot()),c;switch(r.finishedWork=v,r.finishedLanes=m,o){case 0:case 1:throw Error(n(345));case 2:uo(r,un,Gr);break;case 3:if(Ss(r,m),(m&130023424)===m&&(o=mf+500-ot(),10<o)){if(qs(r,0)!==0)break;if(v=r.suspendedLanes,(v&m)!==m){rn(),r.pingedLanes|=r.suspendedLanes&v;break}r.timeoutHandle=kd(uo.bind(null,r,un,Gr),o);break}uo(r,un,Gr);break;case 4:if(Ss(r,m),(m&4194240)===m)break;for(o=r.eventTimes,v=-1;0<m;){var R=31-gn(m);x=1<<R,R=o[R],R>v&&(v=R),m&=~x}if(m=v,m=ot()-m,m=(120>m?120:480>m?480:1080>m?1080:1920>m?1920:3e3>m?3e3:4320>m?4320:1960*kA(m/1960))-m,10<m){r.timeoutHandle=kd(uo.bind(null,r,un,Gr),m);break}uo(r,un,Gr);break;case 5:uo(r,un,Gr);break;default:throw Error(n(329))}}}return dn(r,ot()),r.callbackNode===c?Rx.bind(null,r):null}function yf(r,o){var c=Oa;return r.current.memoizedState.isDehydrated&&(co(r,o).flags|=256),r=Cc(r,o),r!==2&&(o=un,un=c,o!==null&&wf(o)),r}function wf(r){un===null?un=r:un.push.apply(un,r)}function SA(r){for(var o=r;;){if(o.flags&16384){var c=o.updateQueue;if(c!==null&&(c=c.stores,c!==null))for(var m=0;m<c.length;m++){var v=c[m],x=v.getSnapshot;v=v.value;try{if(!Yt(x(),v))return!1}catch{return!1}}}if(c=o.child,o.subtreeFlags&16384&&c!==null)c.return=o,o=c;else{if(o===r)break;for(;o.sibling===null;){if(o.return===null||o.return===r)return!0;o=o.return}o.sibling.return=o.return,o=o.sibling}}return!0}function Ss(r,o){for(o&=~pf,o&=~_c,r.suspendedLanes|=o,r.pingedLanes&=~o,r=r.expirationTimes;0<o;){var c=31-gn(o),m=1<<c;r[c]=-1,o&=~m}}function Ax(r){if((et&6)!==0)throw Error(n(327));yi();var o=qs(r,0);if((o&1)===0)return dn(r,ot()),null;var c=Cc(r,o);if(r.tag!==0&&c===2){var m=Bo(r);m!==0&&(o=m,c=yf(r,m))}if(c===1)throw c=Ia,co(r,0),Ss(r,o),dn(r,ot()),c;if(c===6)throw Error(n(345));return r.finishedWork=r.current.alternate,r.finishedLanes=o,uo(r,un,Gr),dn(r,ot()),null}function xf(r,o){var c=et;et|=1;try{return r(o)}finally{et=c,et===0&&(vi=ot()+500,tc&&vs())}}function lo(r){_s!==null&&_s.tag===0&&(et&6)===0&&yi();var o=et;et|=1;var c=On.transition,m=Ze;try{if(On.transition=null,Ze=1,r)return r()}finally{Ze=m,On.transition=c,et=o,(et&6)===0&&vs()}}function bf(){xn=gi.current,pt(gi)}function co(r,o){r.finishedWork=null,r.finishedLanes=0;var c=r.timeoutHandle;if(c!==-1&&(r.timeoutHandle=-1,eA(c)),Tt!==null)for(c=Tt.return;c!==null;){var m=c;switch(Td(m),m.tag){case 1:m=m.type.childContextTypes,m!=null&&Jl();break;case 3:hi(),pt(an),pt(Kt),Bd();break;case 5:Fd(m);break;case 4:hi();break;case 13:pt(bt);break;case 19:pt(bt);break;case 10:Pd(m.type._context);break;case 22:case 23:bf()}c=c.return}if(Dt=r,Tt=r=Ns(r.current,null),Wt=xn=o,Pt=0,Ia=null,pf=_c=ao=0,un=Oa=null,so!==null){for(o=0;o<so.length;o++)if(c=so[o],m=c.interleaved,m!==null){c.interleaved=null;var v=m.next,x=c.pending;if(x!==null){var R=x.next;x.next=v,m.next=R}c.pending=m}so=null}return r}function Mx(r,o){do{var c=Tt;try{if(Od(),dc.current=mc,fc){for(var m=_t.memoizedState;m!==null;){var v=m.queue;v!==null&&(v.pending=null),m=m.next}fc=!1}if(io=0,qt=Ot=_t=null,ja=!1,Ca=0,hf.current=null,c===null||c.return===null){Pt=1,Ia=o,Tt=null;break}e:{var x=r,R=c.return,B=c,ee=o;if(o=Wt,B.flags|=32768,ee!==null&&typeof ee=="object"&&typeof ee.then=="function"){var ce=ee,ge=B,ye=ge.tag;if((ge.mode&1)===0&&(ye===0||ye===11||ye===15)){var me=ge.alternate;me?(ge.updateQueue=me.updateQueue,ge.memoizedState=me.memoizedState,ge.lanes=me.lanes):(ge.updateQueue=null,ge.memoizedState=null)}var ke=rx(R);if(ke!==null){ke.flags&=-257,sx(ke,R,B,x,o),ke.mode&1&&nx(x,ce,o),o=ke,ee=ce;var Ee=o.updateQueue;if(Ee===null){var Re=new Set;Re.add(ee),o.updateQueue=Re}else Ee.add(ee);break e}else{if((o&1)===0){nx(x,ce,o),_f();break e}ee=Error(n(426))}}else if(vt&&B.mode&1){var jt=rx(R);if(jt!==null){(jt.flags&65536)===0&&(jt.flags|=256),sx(jt,R,B,x,o),Md(pi(ee,B));break e}}x=ee=pi(ee,B),Pt!==4&&(Pt=2),Oa===null?Oa=[x]:Oa.push(x),x=R;do{switch(x.tag){case 3:x.flags|=65536,o&=-o,x.lanes|=o;var oe=ex(x,ee,o);j0(x,oe);break e;case 1:B=ee;var ne=x.type,ie=x.stateNode;if((x.flags&128)===0&&(typeof ne.getDerivedStateFromError=="function"||ie!==null&&typeof ie.componentDidCatch=="function"&&(bs===null||!bs.has(ie)))){x.flags|=65536,o&=-o,x.lanes|=o;var we=tx(x,B,o);j0(x,we);break e}}x=x.return}while(x!==null)}Px(c)}catch(Ae){o=Ae,Tt===c&&c!==null&&(Tt=c=c.return);continue}break}while(!0)}function Ix(){var r=bc.current;return bc.current=mc,r===null?mc:r}function _f(){(Pt===0||Pt===3||Pt===2)&&(Pt=4),Dt===null||(ao&268435455)===0&&(_c&268435455)===0||Ss(Dt,Wt)}function Cc(r,o){var c=et;et|=2;var m=Ix();(Dt!==r||Wt!==o)&&(Gr=null,co(r,o));do try{NA();break}catch(v){Mx(r,v)}while(!0);if(Od(),et=c,bc.current=m,Tt!==null)throw Error(n(261));return Dt=null,Wt=0,Pt}function NA(){for(;Tt!==null;)Ox(Tt)}function EA(){for(;Tt!==null&&!$o();)Ox(Tt)}function Ox(r){var o=qx(r.alternate,r,xn);r.memoizedProps=r.pendingProps,o===null?Px(r):Tt=o,hf.current=null}function Px(r){var o=r;do{var c=o.alternate;if(r=o.return,(o.flags&32768)===0){if(c=yA(c,o,xn),c!==null){Tt=c;return}}else{if(c=wA(c,o),c!==null){c.flags&=32767,Tt=c;return}if(r!==null)r.flags|=32768,r.subtreeFlags=0,r.deletions=null;else{Pt=6,Tt=null;return}}if(o=o.sibling,o!==null){Tt=o;return}Tt=o=r}while(o!==null);Pt===0&&(Pt=5)}function uo(r,o,c){var m=Ze,v=On.transition;try{On.transition=null,Ze=1,jA(r,o,c,m)}finally{On.transition=v,Ze=m}return null}function jA(r,o,c,m){do yi();while(_s!==null);if((et&6)!==0)throw Error(n(327));c=r.finishedWork;var v=r.finishedLanes;if(c===null)return null;if(r.finishedWork=null,r.finishedLanes=0,c===r.current)throw Error(n(177));r.callbackNode=null,r.callbackPriority=0;var x=c.lanes|c.childLanes;if(Jt(r,x),r===Dt&&(Tt=Dt=null,Wt=0),(c.subtreeFlags&2064)===0&&(c.flags&2064)===0||Sc||(Sc=!0,Dx(Wn,function(){return yi(),null})),x=(c.flags&15990)!==0,(c.subtreeFlags&15990)!==0||x){x=On.transition,On.transition=null;var R=Ze;Ze=1;var B=et;et|=4,hf.current=null,bA(r,c),Nx(c,r),Zs(bd),zs=!!xd,bd=xd=null,r.current=c,_A(c),Lo(),et=B,Ze=R,On.transition=x}else r.current=c;if(Sc&&(Sc=!1,_s=r,Nc=v),x=r.pendingLanes,x===0&&(bs=null),Hn(c.stateNode),dn(r,ot()),o!==null)for(m=r.onRecoverableError,c=0;c<o.length;c++)v=o[c],m(v.value,{componentStack:v.stack,digest:v.digest});if(kc)throw kc=!1,r=gf,gf=null,r;return(Nc&1)!==0&&r.tag!==0&&yi(),x=r.pendingLanes,(x&1)!==0?r===vf?Pa++:(Pa=0,vf=r):Pa=0,vs(),null}function yi(){if(_s!==null){var r=Ji(Nc),o=On.transition,c=Ze;try{if(On.transition=null,Ze=16>r?16:r,_s===null)var m=!1;else{if(r=_s,_s=null,Nc=0,(et&6)!==0)throw Error(n(331));var v=et;for(et|=4,Se=r.current;Se!==null;){var x=Se,R=x.child;if((Se.flags&16)!==0){var B=x.deletions;if(B!==null){for(var ee=0;ee<B.length;ee++){var ce=B[ee];for(Se=ce;Se!==null;){var ge=Se;switch(ge.tag){case 0:case 11:case 15:Ma(8,ge,x)}var ye=ge.child;if(ye!==null)ye.return=ge,Se=ye;else for(;Se!==null;){ge=Se;var me=ge.sibling,ke=ge.return;if(xx(ge),ge===ce){Se=null;break}if(me!==null){me.return=ke,Se=me;break}Se=ke}}}var Ee=x.alternate;if(Ee!==null){var Re=Ee.child;if(Re!==null){Ee.child=null;do{var jt=Re.sibling;Re.sibling=null,Re=jt}while(Re!==null)}}Se=x}}if((x.subtreeFlags&2064)!==0&&R!==null)R.return=x,Se=R;else e:for(;Se!==null;){if(x=Se,(x.flags&2048)!==0)switch(x.tag){case 0:case 11:case 15:Ma(9,x,x.return)}var oe=x.sibling;if(oe!==null){oe.return=x.return,Se=oe;break e}Se=x.return}}var ne=r.current;for(Se=ne;Se!==null;){R=Se;var ie=R.child;if((R.subtreeFlags&2064)!==0&&ie!==null)ie.return=R,Se=ie;else e:for(R=ne;Se!==null;){if(B=Se,(B.flags&2048)!==0)try{switch(B.tag){case 0:case 11:case 15:xc(9,B)}}catch(Ae){St(B,B.return,Ae)}if(B===R){Se=null;break e}var we=B.sibling;if(we!==null){we.return=B.return,Se=we;break e}Se=B.return}}if(et=v,vs(),sn&&typeof sn.onPostCommitFiberRoot=="function")try{sn.onPostCommitFiberRoot(mt,r)}catch{}m=!0}return m}finally{Ze=c,On.transition=o}}return!1}function $x(r,o,c){o=pi(c,o),o=ex(r,o,1),r=ws(r,o,1),o=rn(),r!==null&&(os(r,1,o),dn(r,o))}function St(r,o,c){if(r.tag===3)$x(r,r,c);else for(;o!==null;){if(o.tag===3){$x(o,r,c);break}else if(o.tag===1){var m=o.stateNode;if(typeof o.type.getDerivedStateFromError=="function"||typeof m.componentDidCatch=="function"&&(bs===null||!bs.has(m))){r=pi(c,r),r=tx(o,r,1),o=ws(o,r,1),r=rn(),o!==null&&(os(o,1,r),dn(o,r));break}}o=o.return}}function CA(r,o,c){var m=r.pingCache;m!==null&&m.delete(o),o=rn(),r.pingedLanes|=r.suspendedLanes&c,Dt===r&&(Wt&c)===c&&(Pt===4||Pt===3&&(Wt&130023424)===Wt&&500>ot()-mf?co(r,0):pf|=c),dn(r,o)}function Lx(r,o){o===0&&((r.mode&1)===0?o=1:(o=zo,zo<<=1,(zo&130023424)===0&&(zo=4194304)));var c=rn();r=Ur(r,o),r!==null&&(os(r,o,c),dn(r,c))}function TA(r){var o=r.memoizedState,c=0;o!==null&&(c=o.retryLane),Lx(r,c)}function RA(r,o){var c=0;switch(r.tag){case 13:var m=r.stateNode,v=r.memoizedState;v!==null&&(c=v.retryLane);break;case 19:m=r.stateNode;break;default:throw Error(n(314))}m!==null&&m.delete(o),Lx(r,c)}var qx;qx=function(r,o,c){if(r!==null)if(r.memoizedProps!==o.pendingProps||an.current)cn=!0;else{if((r.lanes&c)===0&&(o.flags&128)===0)return cn=!1,vA(r,o,c);cn=(r.flags&131072)!==0}else cn=!1,vt&&(o.flags&1048576)!==0&&v0(o,rc,o.index);switch(o.lanes=0,o.tag){case 2:var m=o.type;yc(r,o),r=o.pendingProps;var v=ii(o,Kt.current);fi(o,c),v=Hd(null,o,m,r,v,c);var x=Gd();return o.flags|=1,typeof v=="object"&&v!==null&&typeof v.render=="function"&&v.$$typeof===void 0?(o.tag=1,o.memoizedState=null,o.updateQueue=null,ln(m)?(x=!0,ec(o)):x=!1,o.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,qd(o),v.updater=gc,o.stateNode=v,v._reactInternals=o,Zd(o,m,r,c),o=nf(null,o,m,!0,x,c)):(o.tag=0,vt&&x&&Cd(o),nn(null,o,v,c),o=o.child),o;case 16:m=o.elementType;e:{switch(yc(r,o),r=o.pendingProps,v=m._init,m=v(m._payload),o.type=m,v=o.tag=MA(m),r=Jn(m,r),v){case 0:o=tf(null,o,m,r,c);break e;case 1:o=ux(null,o,m,r,c);break e;case 11:o=ox(null,o,m,r,c);break e;case 14:o=ix(null,o,m,Jn(m.type,r),c);break e}throw Error(n(306,m,""))}return o;case 0:return m=o.type,v=o.pendingProps,v=o.elementType===m?v:Jn(m,v),tf(r,o,m,v,c);case 1:return m=o.type,v=o.pendingProps,v=o.elementType===m?v:Jn(m,v),ux(r,o,m,v,c);case 3:e:{if(dx(o),r===null)throw Error(n(387));m=o.pendingProps,x=o.memoizedState,v=x.element,E0(r,o),cc(o,m,null,c);var R=o.memoizedState;if(m=R.element,x.isDehydrated)if(x={element:m,isDehydrated:!1,cache:R.cache,pendingSuspenseBoundaries:R.pendingSuspenseBoundaries,transitions:R.transitions},o.updateQueue.baseState=x,o.memoizedState=x,o.flags&256){v=pi(Error(n(423)),o),o=fx(r,o,m,c,v);break e}else if(m!==v){v=pi(Error(n(424)),o),o=fx(r,o,m,c,v);break e}else for(wn=ps(o.stateNode.containerInfo.firstChild),yn=o,vt=!0,Zn=null,c=S0(o,null,m,c),o.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling;else{if(ci(),m===v){o=Hr(r,o,c);break e}nn(r,o,m,c)}o=o.child}return o;case 5:return T0(o),r===null&&Ad(o),m=o.type,v=o.pendingProps,x=r!==null?r.memoizedProps:null,R=v.children,_d(m,v)?R=null:x!==null&&_d(m,x)&&(o.flags|=32),cx(r,o),nn(r,o,R,c),o.child;case 6:return r===null&&Ad(o),null;case 13:return hx(r,o,c);case 4:return Dd(o,o.stateNode.containerInfo),m=o.pendingProps,r===null?o.child=ui(o,null,m,c):nn(r,o,m,c),o.child;case 11:return m=o.type,v=o.pendingProps,v=o.elementType===m?v:Jn(m,v),ox(r,o,m,v,c);case 7:return nn(r,o,o.pendingProps,c),o.child;case 8:return nn(r,o,o.pendingProps.children,c),o.child;case 12:return nn(r,o,o.pendingProps.children,c),o.child;case 10:e:{if(m=o.type._context,v=o.pendingProps,x=o.memoizedProps,R=v.value,dt(ic,m._currentValue),m._currentValue=R,x!==null)if(Yt(x.value,R)){if(x.children===v.children&&!an.current){o=Hr(r,o,c);break e}}else for(x=o.child,x!==null&&(x.return=o);x!==null;){var B=x.dependencies;if(B!==null){R=x.child;for(var ee=B.firstContext;ee!==null;){if(ee.context===m){if(x.tag===1){ee=Wr(-1,c&-c),ee.tag=2;var ce=x.updateQueue;if(ce!==null){ce=ce.shared;var ge=ce.pending;ge===null?ee.next=ee:(ee.next=ge.next,ge.next=ee),ce.pending=ee}}x.lanes|=c,ee=x.alternate,ee!==null&&(ee.lanes|=c),$d(x.return,c,o),B.lanes|=c;break}ee=ee.next}}else if(x.tag===10)R=x.type===o.type?null:x.child;else if(x.tag===18){if(R=x.return,R===null)throw Error(n(341));R.lanes|=c,B=R.alternate,B!==null&&(B.lanes|=c),$d(R,c,o),R=x.sibling}else R=x.child;if(R!==null)R.return=x;else for(R=x;R!==null;){if(R===o){R=null;break}if(x=R.sibling,x!==null){x.return=R.return,R=x;break}R=R.return}x=R}nn(r,o,v.children,c),o=o.child}return o;case 9:return v=o.type,m=o.pendingProps.children,fi(o,c),v=Mn(v),m=m(v),o.flags|=1,nn(r,o,m,c),o.child;case 14:return m=o.type,v=Jn(m,o.pendingProps),v=Jn(m.type,v),ix(r,o,m,v,c);case 15:return ax(r,o,o.type,o.pendingProps,c);case 17:return m=o.type,v=o.pendingProps,v=o.elementType===m?v:Jn(m,v),yc(r,o),o.tag=1,ln(m)?(r=!0,ec(o)):r=!1,fi(o,c),Z0(o,m,v),Zd(o,m,v,c),nf(null,o,m,!0,r,c);case 19:return mx(r,o,c);case 22:return lx(r,o,c)}throw Error(n(156,o.tag))};function Dx(r,o){return $s(r,o)}function AA(r,o,c,m){this.tag=r,this.key=c,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=o,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=m,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Pn(r,o,c,m){return new AA(r,o,c,m)}function kf(r){return r=r.prototype,!(!r||!r.isReactComponent)}function MA(r){if(typeof r=="function")return kf(r)?1:0;if(r!=null){if(r=r.$$typeof,r===W)return 11;if(r===Z)return 14}return 2}function Ns(r,o){var c=r.alternate;return c===null?(c=Pn(r.tag,o,r.key,r.mode),c.elementType=r.elementType,c.type=r.type,c.stateNode=r.stateNode,c.alternate=r,r.alternate=c):(c.pendingProps=o,c.type=r.type,c.flags=0,c.subtreeFlags=0,c.deletions=null),c.flags=r.flags&14680064,c.childLanes=r.childLanes,c.lanes=r.lanes,c.child=r.child,c.memoizedProps=r.memoizedProps,c.memoizedState=r.memoizedState,c.updateQueue=r.updateQueue,o=r.dependencies,c.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext},c.sibling=r.sibling,c.index=r.index,c.ref=r.ref,c}function Tc(r,o,c,m,v,x){var R=2;if(m=r,typeof r=="function")kf(r)&&(R=1);else if(typeof r=="string")R=5;else e:switch(r){case O:return fo(c.children,v,x,o);case F:R=8,v|=8;break;case M:return r=Pn(12,c,o,v|2),r.elementType=M,r.lanes=x,r;case K:return r=Pn(13,c,o,v),r.elementType=K,r.lanes=x,r;case T:return r=Pn(19,c,o,v),r.elementType=T,r.lanes=x,r;case re:return Rc(c,v,x,o);default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case A:R=10;break e;case q:R=9;break e;case W:R=11;break e;case Z:R=14;break e;case U:R=16,m=null;break e}throw Error(n(130,r==null?r:typeof r,""))}return o=Pn(R,c,o,v),o.elementType=r,o.type=m,o.lanes=x,o}function fo(r,o,c,m){return r=Pn(7,r,m,o),r.lanes=c,r}function Rc(r,o,c,m){return r=Pn(22,r,m,o),r.elementType=re,r.lanes=c,r.stateNode={isHidden:!1},r}function Sf(r,o,c){return r=Pn(6,r,null,o),r.lanes=c,r}function Nf(r,o,c){return o=Pn(4,r.children!==null?r.children:[],r.key,o),o.lanes=c,o.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},o}function IA(r,o,c,m,v){this.tag=o,this.containerInfo=r,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Uo(0),this.expirationTimes=Uo(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Uo(0),this.identifierPrefix=m,this.onRecoverableError=v,this.mutableSourceEagerHydrationData=null}function Ef(r,o,c,m,v,x,R,B,ee){return r=new IA(r,o,c,B,ee),o===1?(o=1,x===!0&&(o|=8)):o=0,x=Pn(3,null,null,o),r.current=x,x.stateNode=r,x.memoizedState={element:m,isDehydrated:c,cache:null,transitions:null,pendingSuspenseBoundaries:null},qd(x),r}function OA(r,o,c){var m=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:P,key:m==null?null:""+m,children:r,containerInfo:o,implementation:c}}function Fx(r){if(!r)return gs;r=r._reactInternals;e:{if(jn(r)!==r||r.tag!==1)throw Error(n(170));var o=r;do{switch(o.tag){case 3:o=o.stateNode.context;break e;case 1:if(ln(o.type)){o=o.stateNode.__reactInternalMemoizedMergedChildContext;break e}}o=o.return}while(o!==null);throw Error(n(171))}if(r.tag===1){var c=r.type;if(ln(c))return p0(r,c,o)}return o}function zx(r,o,c,m,v,x,R,B,ee){return r=Ef(c,m,!0,r,v,x,R,B,ee),r.context=Fx(null),c=r.current,m=rn(),v=ks(c),x=Wr(m,v),x.callback=o??null,ws(c,x,v),r.current.lanes=v,os(r,v,m),dn(r,m),r}function Ac(r,o,c,m){var v=o.current,x=rn(),R=ks(v);return c=Fx(c),o.context===null?o.context=c:o.pendingContext=c,o=Wr(x,R),o.payload={element:r},m=m===void 0?null:m,m!==null&&(o.callback=m),r=ws(v,o,R),r!==null&&(nr(r,v,R,x),lc(r,v,R)),R}function Mc(r){if(r=r.current,!r.child)return null;switch(r.child.tag){case 5:return r.child.stateNode;default:return r.child.stateNode}}function Bx(r,o){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var c=r.retryLane;r.retryLane=c!==0&&c<o?c:o}}function jf(r,o){Bx(r,o),(r=r.alternate)&&Bx(r,o)}function PA(){return null}var Ux=typeof reportError=="function"?reportError:function(r){console.error(r)};function Cf(r){this._internalRoot=r}Ic.prototype.render=Cf.prototype.render=function(r){var o=this._internalRoot;if(o===null)throw Error(n(409));Ac(r,o,null,null)},Ic.prototype.unmount=Cf.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var o=r.containerInfo;lo(function(){Ac(null,r,null,null)}),o[Dr]=null}};function Ic(r){this._internalRoot=r}Ic.prototype.unstable_scheduleHydration=function(r){if(r){var o=Gn();r={blockedOn:null,target:r,priority:o};for(var c=0;c<Kn.length&&o!==0&&o<Kn[c].priority;c++);Kn.splice(c,0,r),c===0&&Go(r)}};function Tf(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function Oc(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11&&(r.nodeType!==8||r.nodeValue!==" react-mount-point-unstable "))}function Wx(){}function $A(r,o,c,m,v){if(v){if(typeof m=="function"){var x=m;m=function(){var ce=Mc(R);x.call(ce)}}var R=zx(o,m,r,0,null,!1,!1,"",Wx);return r._reactRootContainer=R,r[Dr]=R.current,wa(r.nodeType===8?r.parentNode:r),lo(),R}for(;v=r.lastChild;)r.removeChild(v);if(typeof m=="function"){var B=m;m=function(){var ce=Mc(ee);B.call(ce)}}var ee=Ef(r,0,!1,null,null,!1,!1,"",Wx);return r._reactRootContainer=ee,r[Dr]=ee.current,wa(r.nodeType===8?r.parentNode:r),lo(function(){Ac(o,ee,c,m)}),ee}function Pc(r,o,c,m,v){var x=c._reactRootContainer;if(x){var R=x;if(typeof v=="function"){var B=v;v=function(){var ee=Mc(R);B.call(ee)}}Ac(o,R,r,v)}else R=$A(c,o,r,v,m);return Mc(R)}Cl=function(r){switch(r.tag){case 3:var o=r.stateNode;if(o.current.memoizedState.isDehydrated){var c=rs(o.pendingLanes);c!==0&&(is(o,c|1),dn(o,ot()),(et&6)===0&&(vi=ot()+500,vs()))}break;case 13:lo(function(){var m=Ur(r,1);if(m!==null){var v=rn();nr(m,r,1,v)}}),jf(r,1)}},Ir=function(r){if(r.tag===13){var o=Ur(r,134217728);if(o!==null){var c=rn();nr(o,r,134217728,c)}jf(r,134217728)}},ea=function(r){if(r.tag===13){var o=ks(r),c=Ur(r,o);if(c!==null){var m=rn();nr(c,r,o,m)}jf(r,o)}},Gn=function(){return Ze},Tl=function(r,o){var c=Ze;try{return Ze=r,o()}finally{Ze=c}},kt=function(r,o,c){switch(o){case"input":if(he(r,c),o=c.name,c.type==="radio"&&o!=null){for(c=r;c.parentNode;)c=c.parentNode;for(c=c.querySelectorAll("input[name="+JSON.stringify(""+o)+'][type="radio"]'),o=0;o<c.length;o++){var m=c[o];if(m!==r&&m.form===r.form){var v=Zl(m);if(!v)throw Error(n(90));He(m),he(m,v)}}}break;case"textarea":Je(r,c);break;case"select":o=c.value,o!=null&&rt(r,!!c.multiple,o,!1)}},Co=xf,To=lo;var LA={usingClientEntryPoint:!1,Events:[_a,si,Zl,jo,mn,xf]},$a={findFiberByHostInstance:eo,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},qA={bundleType:$a.bundleType,version:$a.version,rendererPackageName:$a.rendererPackageName,rendererConfig:$a.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:C.ReactCurrentDispatcher,findHostInstanceByFiber:function(r){return r=Un(r),r===null?null:r.stateNode},findFiberByHostInstance:$a.findFiberByHostInstance||PA,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 $c=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!$c.isDisabled&&$c.supportsFiber)try{mt=$c.inject(qA),sn=$c}catch{}}return fn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=LA,fn.createPortal=function(r,o){var c=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Tf(o))throw Error(n(200));return OA(r,o,null,c)},fn.createRoot=function(r,o){if(!Tf(r))throw Error(n(299));var c=!1,m="",v=Ux;return o!=null&&(o.unstable_strictMode===!0&&(c=!0),o.identifierPrefix!==void 0&&(m=o.identifierPrefix),o.onRecoverableError!==void 0&&(v=o.onRecoverableError)),o=Ef(r,1,!1,null,null,c,!1,m,v),r[Dr]=o.current,wa(r.nodeType===8?r.parentNode:r),new Cf(o)},fn.findDOMNode=function(r){if(r==null)return null;if(r.nodeType===1)return r;var o=r._reactInternals;if(o===void 0)throw typeof r.render=="function"?Error(n(188)):(r=Object.keys(r).join(","),Error(n(268,r)));return r=Un(o),r=r===null?null:r.stateNode,r},fn.flushSync=function(r){return lo(r)},fn.hydrate=function(r,o,c){if(!Oc(o))throw Error(n(200));return Pc(null,r,o,!0,c)},fn.hydrateRoot=function(r,o,c){if(!Tf(r))throw Error(n(405));var m=c!=null&&c.hydratedSources||null,v=!1,x="",R=Ux;if(c!=null&&(c.unstable_strictMode===!0&&(v=!0),c.identifierPrefix!==void 0&&(x=c.identifierPrefix),c.onRecoverableError!==void 0&&(R=c.onRecoverableError)),o=zx(o,null,r,1,c??null,v,!1,x,R),r[Dr]=o.current,wa(r),m)for(r=0;r<m.length;r++)c=m[r],v=c._getVersion,v=v(c._source),o.mutableSourceEagerHydrationData==null?o.mutableSourceEagerHydrationData=[c,v]:o.mutableSourceEagerHydrationData.push(c,v);return new Ic(o)},fn.render=function(r,o,c){if(!Oc(o))throw Error(n(200));return Pc(null,r,o,!1,c)},fn.unmountComponentAtNode=function(r){if(!Oc(r))throw Error(n(40));return r._reactRootContainer?(lo(function(){Pc(null,null,r,!1,function(){r._reactRootContainer=null,r[Dr]=null})}),!0):!1},fn.unstable_batchedUpdates=xf,fn.unstable_renderSubtreeIntoContainer=function(r,o,c,m){if(!Oc(c))throw Error(n(200));if(r==null||r._reactInternals===void 0)throw Error(n(38));return Pc(r,o,c,!1,m)},fn.version="18.3.1-next-f1338f8080-20240426",fn}var Zx;function Ej(){if(Zx)return Mf.exports;Zx=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(),Mf.exports=HA(),Mf.exports}var Jx;function GA(){if(Jx)return qc;Jx=1;var e=Ej();return qc.createRoot=e.createRoot,qc.hydrateRoot=e.hydrateRoot,qc}var VA=GA(),S=fl();const ue=Jy(S);function Ht(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,s;n<e.length;n++)(s=Ht(e[n]))!==""&&(t+=(t&&" ")+s);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var Pf={exports:{}},$f={},Lf={exports:{}},qf={};/**
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 eb;function YA(){if(eb)return qf;eb=1;var e=fl();function t(g,y){return g===y&&(g!==0||1/g===1/y)||g!==g&&y!==y}var n=typeof Object.is=="function"?Object.is:t,s=e.useState,i=e.useEffect,a=e.useLayoutEffect,l=e.useDebugValue;function u(g,y){var w=y(),N=s({inst:{value:w,getSnapshot:y}}),b=N[0].inst,_=N[1];return a(function(){b.value=w,b.getSnapshot=y,h(b)&&_({inst:b})},[g,w,y]),i(function(){return h(b)&&_({inst:b}),g(function(){h(b)&&_({inst:b})})},[g]),l(w),w}function h(g){var y=g.getSnapshot;g=g.value;try{var w=y();return!n(g,w)}catch{return!0}}function p(g,y){return y()}var f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?p:u;return qf.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:f,qf}var tb;function KA(){return tb||(tb=1,Lf.exports=YA()),Lf.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 nb;function XA(){if(nb)return $f;nb=1;var e=fl(),t=KA();function n(p,f){return p===f&&(p!==0||1/p===1/f)||p!==p&&f!==f}var s=typeof Object.is=="function"?Object.is:n,i=t.useSyncExternalStore,a=e.useRef,l=e.useEffect,u=e.useMemo,h=e.useDebugValue;return $f.useSyncExternalStoreWithSelector=function(p,f,g,y,w){var N=a(null);if(N.current===null){var b={hasValue:!1,value:null};N.current=b}else b=N.current;N=u(function(){function k(P){if(!E){if(E=!0,j=P,P=y(P),w!==void 0&&b.hasValue){var O=b.value;if(w(O,P))return C=O}return C=P}if(O=C,s(j,P))return O;var F=y(P);return w!==void 0&&w(O,F)?(j=P,O):(j=P,C=F)}var E=!1,j,C,I=g===void 0?null:g;return[function(){return k(f())},I===null?void 0:function(){return k(I())}]},[f,g,y,w]);var _=i(p,N[0],N[1]);return l(function(){b.hasValue=!0,b.value=_},[_]),h(_),_},$f}var rb;function QA(){return rb||(rb=1,Pf.exports=XA()),Pf.exports}var ZA=QA();const JA=Jy(ZA),e2={},sb=e=>{let t;const n=new Set,s=(f,g)=>{const y=typeof f=="function"?f(t):f;if(!Object.is(y,t)){const w=t;t=g??(typeof y!="object"||y===null)?y:Object.assign({},t,y),n.forEach(N=>N(t,w))}},i=()=>t,h={setState:s,getState:i,getInitialState:()=>p,subscribe:f=>(n.add(f),()=>n.delete(f)),destroy:()=>{(e2?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},p=t=e(s,i,h);return h},t2=e=>e?sb(e):sb,{useDebugValue:n2}=ue,{useSyncExternalStoreWithSelector:r2}=JA,s2=e=>e;function jj(e,t=s2,n){const s=r2(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return n2(s),s}const ob=(e,t)=>{const n=t2(e),s=(i,a=t)=>jj(n,i,a);return Object.assign(s,n),s},o2=(e,t)=>e?ob(e,t):ob;function $t(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[s,i]of e)if(!Object.is(i,t.get(s)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const s of e)if(!t.has(s))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const s of n)if(!Object.prototype.hasOwnProperty.call(t,s)||!Object.is(e[s],t[s]))return!1;return!0}var i2={value:()=>{}};function Cu(){for(var e=0,t=arguments.length,n={},s;e<t;++e){if(!(s=arguments[e]+"")||s in n||/[\s.]/.test(s))throw new Error("illegal type: "+s);n[s]=[]}return new su(n)}function su(e){this._=e}function a2(e,t){return e.trim().split(/^|\s+/).map(function(n){var s="",i=n.indexOf(".");if(i>=0&&(s=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:s}})}su.prototype=Cu.prototype={constructor:su,on:function(e,t){var n=this._,s=a2(e+"",n),i,a=-1,l=s.length;if(arguments.length<2){for(;++a<l;)if((i=(e=s[a]).type)&&(i=l2(n[i],e.name)))return i;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++a<l;)if(i=(e=s[a]).type)n[i]=ib(n[i],e.name,t);else if(t==null)for(i in n)n[i]=ib(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new su(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=new Array(i),s=0,i,a;s<i;++s)n[s]=arguments[s+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(a=this._[e],s=0,i=a.length;s<i;++s)a[s].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var s=this._[e],i=0,a=s.length;i<a;++i)s[i].value.apply(t,n)}};function l2(e,t){for(var n=0,s=e.length,i;n<s;++n)if((i=e[n]).name===t)return i.value}function ib(e,t,n){for(var s=0,i=e.length;s<i;++s)if(e[s].name===t){e[s]=i2,e=e.slice(0,s).concat(e.slice(s+1));break}return n!=null&&e.push({name:t,value:n}),e}var xy="http://www.w3.org/1999/xhtml";const ab={svg:"http://www.w3.org/2000/svg",xhtml:xy,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Tu(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),ab.hasOwnProperty(t)?{space:ab[t],local:e}:e}function c2(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===xy&&t.documentElement.namespaceURI===xy?t.createElement(e):t.createElementNS(n,e)}}function u2(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Cj(e){var t=Tu(e);return(t.local?u2:c2)(t)}function d2(){}function ew(e){return e==null?d2:function(){return this.querySelector(e)}}function f2(e){typeof e!="function"&&(e=ew(e));for(var t=this._groups,n=t.length,s=new Array(n),i=0;i<n;++i)for(var a=t[i],l=a.length,u=s[i]=new Array(l),h,p,f=0;f<l;++f)(h=a[f])&&(p=e.call(h,h.__data__,f,a))&&("__data__"in h&&(p.__data__=h.__data__),u[f]=p);return new kn(s,this._parents)}function h2(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function p2(){return[]}function Tj(e){return e==null?p2:function(){return this.querySelectorAll(e)}}function m2(e){return function(){return h2(e.apply(this,arguments))}}function g2(e){typeof e=="function"?e=m2(e):e=Tj(e);for(var t=this._groups,n=t.length,s=[],i=[],a=0;a<n;++a)for(var l=t[a],u=l.length,h,p=0;p<u;++p)(h=l[p])&&(s.push(e.call(h,h.__data__,p,l)),i.push(h));return new kn(s,i)}function Rj(e){return function(){return this.matches(e)}}function Aj(e){return function(t){return t.matches(e)}}var v2=Array.prototype.find;function y2(e){return function(){return v2.call(this.children,e)}}function w2(){return this.firstElementChild}function x2(e){return this.select(e==null?w2:y2(typeof e=="function"?e:Aj(e)))}var b2=Array.prototype.filter;function _2(){return Array.from(this.children)}function k2(e){return function(){return b2.call(this.children,e)}}function S2(e){return this.selectAll(e==null?_2:k2(typeof e=="function"?e:Aj(e)))}function N2(e){typeof e!="function"&&(e=Rj(e));for(var t=this._groups,n=t.length,s=new Array(n),i=0;i<n;++i)for(var a=t[i],l=a.length,u=s[i]=[],h,p=0;p<l;++p)(h=a[p])&&e.call(h,h.__data__,p,a)&&u.push(h);return new kn(s,this._parents)}function Mj(e){return new Array(e.length)}function E2(){return new kn(this._enter||this._groups.map(Mj),this._parents)}function uu(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}uu.prototype={constructor:uu,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 j2(e){return function(){return e}}function C2(e,t,n,s,i,a){for(var l=0,u,h=t.length,p=a.length;l<p;++l)(u=t[l])?(u.__data__=a[l],s[l]=u):n[l]=new uu(e,a[l]);for(;l<h;++l)(u=t[l])&&(i[l]=u)}function T2(e,t,n,s,i,a,l){var u,h,p=new Map,f=t.length,g=a.length,y=new Array(f),w;for(u=0;u<f;++u)(h=t[u])&&(y[u]=w=l.call(h,h.__data__,u,t)+"",p.has(w)?i[u]=h:p.set(w,h));for(u=0;u<g;++u)w=l.call(e,a[u],u,a)+"",(h=p.get(w))?(s[u]=h,h.__data__=a[u],p.delete(w)):n[u]=new uu(e,a[u]);for(u=0;u<f;++u)(h=t[u])&&p.get(y[u])===h&&(i[u]=h)}function R2(e){return e.__data__}function A2(e,t){if(!arguments.length)return Array.from(this,R2);var n=t?T2:C2,s=this._parents,i=this._groups;typeof e!="function"&&(e=j2(e));for(var a=i.length,l=new Array(a),u=new Array(a),h=new Array(a),p=0;p<a;++p){var f=s[p],g=i[p],y=g.length,w=M2(e.call(f,f&&f.__data__,p,s)),N=w.length,b=u[p]=new Array(N),_=l[p]=new Array(N),k=h[p]=new Array(y);n(f,g,b,_,k,w,t);for(var E=0,j=0,C,I;E<N;++E)if(C=b[E]){for(E>=j&&(j=E+1);!(I=_[j])&&++j<N;);C._next=I||null}}return l=new kn(l,s),l._enter=u,l._exit=h,l}function M2(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function I2(){return new kn(this._exit||this._groups.map(Mj),this._parents)}function O2(e,t,n){var s=this.enter(),i=this,a=this.exit();return typeof e=="function"?(s=e(s),s&&(s=s.selection())):s=s.append(e+""),t!=null&&(i=t(i),i&&(i=i.selection())),n==null?a.remove():n(a),s&&i?s.merge(i).order():i}function P2(e){for(var t=e.selection?e.selection():e,n=this._groups,s=t._groups,i=n.length,a=s.length,l=Math.min(i,a),u=new Array(i),h=0;h<l;++h)for(var p=n[h],f=s[h],g=p.length,y=u[h]=new Array(g),w,N=0;N<g;++N)(w=p[N]||f[N])&&(y[N]=w);for(;h<i;++h)u[h]=n[h];return new kn(u,this._parents)}function $2(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var s=e[t],i=s.length-1,a=s[i],l;--i>=0;)(l=s[i])&&(a&&l.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(l,a),a=l);return this}function L2(e){e||(e=q2);function t(g,y){return g&&y?e(g.__data__,y.__data__):!g-!y}for(var n=this._groups,s=n.length,i=new Array(s),a=0;a<s;++a){for(var l=n[a],u=l.length,h=i[a]=new Array(u),p,f=0;f<u;++f)(p=l[f])&&(h[f]=p);h.sort(t)}return new kn(i,this._parents).order()}function q2(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function D2(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function F2(){return Array.from(this)}function z2(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var s=e[t],i=0,a=s.length;i<a;++i){var l=s[i];if(l)return l}return null}function B2(){let e=0;for(const t of this)++e;return e}function U2(){return!this.node()}function W2(e){for(var t=this._groups,n=0,s=t.length;n<s;++n)for(var i=t[n],a=0,l=i.length,u;a<l;++a)(u=i[a])&&e.call(u,u.__data__,a,i);return this}function H2(e){return function(){this.removeAttribute(e)}}function G2(e){return function(){this.removeAttributeNS(e.space,e.local)}}function V2(e,t){return function(){this.setAttribute(e,t)}}function Y2(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function K2(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function X2(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 Q2(e,t){var n=Tu(e);if(arguments.length<2){var s=this.node();return n.local?s.getAttributeNS(n.space,n.local):s.getAttribute(n)}return this.each((t==null?n.local?G2:H2:typeof t=="function"?n.local?X2:K2:n.local?Y2:V2)(n,t))}function Ij(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Z2(e){return function(){this.style.removeProperty(e)}}function J2(e,t,n){return function(){this.style.setProperty(e,t,n)}}function eM(e,t,n){return function(){var s=t.apply(this,arguments);s==null?this.style.removeProperty(e):this.style.setProperty(e,s,n)}}function tM(e,t,n){return arguments.length>1?this.each((t==null?Z2:typeof t=="function"?eM:J2)(e,t,n??"")):$i(this.node(),e)}function $i(e,t){return e.style.getPropertyValue(t)||Ij(e).getComputedStyle(e,null).getPropertyValue(t)}function nM(e){return function(){delete this[e]}}function rM(e,t){return function(){this[e]=t}}function sM(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function oM(e,t){return arguments.length>1?this.each((t==null?nM:typeof t=="function"?sM:rM)(e,t)):this.node()[e]}function Oj(e){return e.trim().split(/^|\s+/)}function tw(e){return e.classList||new Pj(e)}function Pj(e){this._node=e,this._names=Oj(e.getAttribute("class")||"")}Pj.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 $j(e,t){for(var n=tw(e),s=-1,i=t.length;++s<i;)n.add(t[s])}function Lj(e,t){for(var n=tw(e),s=-1,i=t.length;++s<i;)n.remove(t[s])}function iM(e){return function(){$j(this,e)}}function aM(e){return function(){Lj(this,e)}}function lM(e,t){return function(){(t.apply(this,arguments)?$j:Lj)(this,e)}}function cM(e,t){var n=Oj(e+"");if(arguments.length<2){for(var s=tw(this.node()),i=-1,a=n.length;++i<a;)if(!s.contains(n[i]))return!1;return!0}return this.each((typeof t=="function"?lM:t?iM:aM)(n,t))}function uM(){this.textContent=""}function dM(e){return function(){this.textContent=e}}function fM(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function hM(e){return arguments.length?this.each(e==null?uM:(typeof e=="function"?fM:dM)(e)):this.node().textContent}function pM(){this.innerHTML=""}function mM(e){return function(){this.innerHTML=e}}function gM(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function vM(e){return arguments.length?this.each(e==null?pM:(typeof e=="function"?gM:mM)(e)):this.node().innerHTML}function yM(){this.nextSibling&&this.parentNode.appendChild(this)}function wM(){return this.each(yM)}function xM(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function bM(){return this.each(xM)}function _M(e){var t=typeof e=="function"?e:Cj(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function kM(){return null}function SM(e,t){var n=typeof e=="function"?e:Cj(e),s=t==null?kM:typeof t=="function"?t:ew(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),s.apply(this,arguments)||null)})}function NM(){var e=this.parentNode;e&&e.removeChild(this)}function EM(){return this.each(NM)}function jM(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function CM(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function TM(e){return this.select(e?CM:jM)}function RM(e){return arguments.length?this.property("__data__",e):this.node().__data__}function AM(e){return function(t){e.call(this,t,this.__data__)}}function MM(e){return e.trim().split(/^|\s+/).map(function(t){var n="",s=t.indexOf(".");return s>=0&&(n=t.slice(s+1),t=t.slice(0,s)),{type:t,name:n}})}function IM(e){return function(){var t=this.__on;if(t){for(var n=0,s=-1,i=t.length,a;n<i;++n)a=t[n],(!e.type||a.type===e.type)&&a.name===e.name?this.removeEventListener(a.type,a.listener,a.options):t[++s]=a;++s?t.length=s:delete this.__on}}}function OM(e,t,n){return function(){var s=this.__on,i,a=AM(t);if(s){for(var l=0,u=s.length;l<u;++l)if((i=s[l]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=a,i.options=n),i.value=t;return}}this.addEventListener(e.type,a,n),i={type:e.type,name:e.name,value:t,listener:a,options:n},s?s.push(i):this.__on=[i]}}function PM(e,t,n){var s=MM(e+""),i,a=s.length,l;if(arguments.length<2){var u=this.node().__on;if(u){for(var h=0,p=u.length,f;h<p;++h)for(i=0,f=u[h];i<a;++i)if((l=s[i]).type===f.type&&l.name===f.name)return f.value}return}for(u=t?OM:IM,i=0;i<a;++i)this.each(u(s[i],t,n));return this}function qj(e,t,n){var s=Ij(e),i=s.CustomEvent;typeof i=="function"?i=new i(t,n):(i=s.document.createEvent("Event"),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function $M(e,t){return function(){return qj(this,e,t)}}function LM(e,t){return function(){return qj(this,e,t.apply(this,arguments))}}function qM(e,t){return this.each((typeof t=="function"?LM:$M)(e,t))}function*DM(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var s=e[t],i=0,a=s.length,l;i<a;++i)(l=s[i])&&(yield l)}var Dj=[null];function kn(e,t){this._groups=e,this._parents=t}function hl(){return new kn([[document.documentElement]],Dj)}function FM(){return this}kn.prototype=hl.prototype={constructor:kn,select:f2,selectAll:g2,selectChild:x2,selectChildren:S2,filter:N2,data:A2,enter:E2,exit:I2,join:O2,merge:P2,selection:FM,order:$2,sort:L2,call:D2,nodes:F2,node:z2,size:B2,empty:U2,each:W2,attr:Q2,style:tM,property:oM,classed:cM,text:hM,html:vM,raise:wM,lower:bM,append:_M,insert:SM,remove:EM,clone:TM,datum:RM,on:PM,dispatch:qM,[Symbol.iterator]:DM};function Ln(e){return typeof e=="string"?new kn([[document.querySelector(e)]],[document.documentElement]):new kn([[e]],Dj)}function zM(e){let t;for(;t=e.sourceEvent;)e=t;return e}function sr(e,t){if(e=zM(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var s=n.createSVGPoint();return s.x=e.clientX,s.y=e.clientY,s=s.matrixTransform(t.getScreenCTM().inverse()),[s.x,s.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}const BM={passive:!1},el={capture:!0,passive:!1};function Df(e){e.stopImmediatePropagation()}function Ri(e){e.preventDefault(),e.stopImmediatePropagation()}function Fj(e){var t=e.document.documentElement,n=Ln(e).on("dragstart.drag",Ri,el);"onselectstart"in t?n.on("selectstart.drag",Ri,el):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function zj(e,t){var n=e.document.documentElement,s=Ln(e).on("dragstart.drag",null);t&&(s.on("click.drag",Ri,el),setTimeout(function(){s.on("click.drag",null)},0)),"onselectstart"in n?s.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const Dc=e=>()=>e;function by(e,{sourceEvent:t,subject:n,target:s,identifier:i,active:a,x:l,y:u,dx:h,dy:p,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:s,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:l,enumerable:!0,configurable:!0},y:{value:u,enumerable:!0,configurable:!0},dx:{value:h,enumerable:!0,configurable:!0},dy:{value:p,enumerable:!0,configurable:!0},_:{value:f}})}by.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function UM(e){return!e.ctrlKey&&!e.button}function WM(){return this.parentNode}function HM(e,t){return t??{x:e.x,y:e.y}}function GM(){return navigator.maxTouchPoints||"ontouchstart"in this}function VM(){var e=UM,t=WM,n=HM,s=GM,i={},a=Cu("start","drag","end"),l=0,u,h,p,f,g=0;function y(C){C.on("mousedown.drag",w).filter(s).on("touchstart.drag",_).on("touchmove.drag",k,BM).on("touchend.drag touchcancel.drag",E).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function w(C,I){if(!(f||!e.call(this,C,I))){var P=j(this,t.call(this,C,I),C,I,"mouse");P&&(Ln(C.view).on("mousemove.drag",N,el).on("mouseup.drag",b,el),Fj(C.view),Df(C),p=!1,u=C.clientX,h=C.clientY,P("start",C))}}function N(C){if(Ri(C),!p){var I=C.clientX-u,P=C.clientY-h;p=I*I+P*P>g}i.mouse("drag",C)}function b(C){Ln(C.view).on("mousemove.drag mouseup.drag",null),zj(C.view,p),Ri(C),i.mouse("end",C)}function _(C,I){if(e.call(this,C,I)){var P=C.changedTouches,O=t.call(this,C,I),F=P.length,M,A;for(M=0;M<F;++M)(A=j(this,O,C,I,P[M].identifier,P[M]))&&(Df(C),A("start",C,P[M]))}}function k(C){var I=C.changedTouches,P=I.length,O,F;for(O=0;O<P;++O)(F=i[I[O].identifier])&&(Ri(C),F("drag",C,I[O]))}function E(C){var I=C.changedTouches,P=I.length,O,F;for(f&&clearTimeout(f),f=setTimeout(function(){f=null},500),O=0;O<P;++O)(F=i[I[O].identifier])&&(Df(C),F("end",C,I[O]))}function j(C,I,P,O,F,M){var A=a.copy(),q=sr(M||P,I),W,K,T;if((T=n.call(C,new by("beforestart",{sourceEvent:P,target:y,identifier:F,active:l,x:q[0],y:q[1],dx:0,dy:0,dispatch:A}),O))!=null)return W=T.x-q[0]||0,K=T.y-q[1]||0,function Z(U,re,Q){var H=q,te;switch(U){case"start":i[F]=Z,te=l++;break;case"end":delete i[F],--l;case"drag":q=sr(Q||re,I),te=l;break}A.call(U,C,new by(U,{sourceEvent:re,subject:T,target:y,identifier:F,active:te,x:q[0]+W,y:q[1]+K,dx:q[0]-H[0],dy:q[1]-H[1],dispatch:A}),O)}}return y.filter=function(C){return arguments.length?(e=typeof C=="function"?C:Dc(!!C),y):e},y.container=function(C){return arguments.length?(t=typeof C=="function"?C:Dc(C),y):t},y.subject=function(C){return arguments.length?(n=typeof C=="function"?C:Dc(C),y):n},y.touchable=function(C){return arguments.length?(s=typeof C=="function"?C:Dc(!!C),y):s},y.on=function(){var C=a.on.apply(a,arguments);return C===a?y:C},y.clickDistance=function(C){return arguments.length?(g=(C=+C)*C,y):Math.sqrt(g)},y}function nw(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Bj(e,t){var n=Object.create(e.prototype);for(var s in t)n[s]=t[s];return n}function pl(){}var tl=.7,du=1/tl,Ai="\\s*([+-]?\\d+)\\s*",nl="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Nr="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",YM=/^#([0-9a-f]{3,8})$/,KM=new RegExp(`^rgb\\(${Ai},${Ai},${Ai}\\)$`),XM=new RegExp(`^rgb\\(${Nr},${Nr},${Nr}\\)$`),QM=new RegExp(`^rgba\\(${Ai},${Ai},${Ai},${nl}\\)$`),ZM=new RegExp(`^rgba\\(${Nr},${Nr},${Nr},${nl}\\)$`),JM=new RegExp(`^hsl\\(${nl},${Nr},${Nr}\\)$`),eI=new RegExp(`^hsla\\(${nl},${Nr},${Nr},${nl}\\)$`),lb={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};nw(pl,rl,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:cb,formatHex:cb,formatHex8:tI,formatHsl:nI,formatRgb:ub,toString:ub});function cb(){return this.rgb().formatHex()}function tI(){return this.rgb().formatHex8()}function nI(){return Uj(this).formatHsl()}function ub(){return this.rgb().formatRgb()}function rl(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=YM.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?db(t):n===3?new hn(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Fc(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Fc(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=KM.exec(e))?new hn(t[1],t[2],t[3],1):(t=XM.exec(e))?new hn(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=QM.exec(e))?Fc(t[1],t[2],t[3],t[4]):(t=ZM.exec(e))?Fc(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=JM.exec(e))?pb(t[1],t[2]/100,t[3]/100,1):(t=eI.exec(e))?pb(t[1],t[2]/100,t[3]/100,t[4]):lb.hasOwnProperty(e)?db(lb[e]):e==="transparent"?new hn(NaN,NaN,NaN,0):null}function db(e){return new hn(e>>16&255,e>>8&255,e&255,1)}function Fc(e,t,n,s){return s<=0&&(e=t=n=NaN),new hn(e,t,n,s)}function rI(e){return e instanceof pl||(e=rl(e)),e?(e=e.rgb(),new hn(e.r,e.g,e.b,e.opacity)):new hn}function _y(e,t,n,s){return arguments.length===1?rI(e):new hn(e,t,n,s??1)}function hn(e,t,n,s){this.r=+e,this.g=+t,this.b=+n,this.opacity=+s}nw(hn,_y,Bj(pl,{brighter(e){return e=e==null?du:Math.pow(du,e),new hn(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?tl:Math.pow(tl,e),new hn(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new hn(wo(this.r),wo(this.g),wo(this.b),fu(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:fb,formatHex:fb,formatHex8:sI,formatRgb:hb,toString:hb}));function fb(){return`#${vo(this.r)}${vo(this.g)}${vo(this.b)}`}function sI(){return`#${vo(this.r)}${vo(this.g)}${vo(this.b)}${vo((isNaN(this.opacity)?1:this.opacity)*255)}`}function hb(){const e=fu(this.opacity);return`${e===1?"rgb(":"rgba("}${wo(this.r)}, ${wo(this.g)}, ${wo(this.b)}${e===1?")":`, ${e})`}`}function fu(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function wo(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function vo(e){return e=wo(e),(e<16?"0":"")+e.toString(16)}function pb(e,t,n,s){return s<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new or(e,t,n,s)}function Uj(e){if(e instanceof or)return new or(e.h,e.s,e.l,e.opacity);if(e instanceof pl||(e=rl(e)),!e)return new or;if(e instanceof or)return e;e=e.rgb();var t=e.r/255,n=e.g/255,s=e.b/255,i=Math.min(t,n,s),a=Math.max(t,n,s),l=NaN,u=a-i,h=(a+i)/2;return u?(t===a?l=(n-s)/u+(n<s)*6:n===a?l=(s-t)/u+2:l=(t-n)/u+4,u/=h<.5?a+i:2-a-i,l*=60):u=h>0&&h<1?0:l,new or(l,u,h,e.opacity)}function oI(e,t,n,s){return arguments.length===1?Uj(e):new or(e,t,n,s??1)}function or(e,t,n,s){this.h=+e,this.s=+t,this.l=+n,this.opacity=+s}nw(or,oI,Bj(pl,{brighter(e){return e=e==null?du:Math.pow(du,e),new or(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?tl:Math.pow(tl,e),new or(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,s=n+(n<.5?n:1-n)*t,i=2*n-s;return new hn(Ff(e>=240?e-240:e+120,i,s),Ff(e,i,s),Ff(e<120?e+240:e-120,i,s),this.opacity)},clamp(){return new or(mb(this.h),zc(this.s),zc(this.l),fu(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=fu(this.opacity);return`${e===1?"hsl(":"hsla("}${mb(this.h)}, ${zc(this.s)*100}%, ${zc(this.l)*100}%${e===1?")":`, ${e})`}`}}));function mb(e){return e=(e||0)%360,e<0?e+360:e}function zc(e){return Math.max(0,Math.min(1,e||0))}function Ff(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 Wj=e=>()=>e;function iI(e,t){return function(n){return e+n*t}}function aI(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(s){return Math.pow(e+s*t,n)}}function lI(e){return(e=+e)==1?Hj:function(t,n){return n-t?aI(t,n,e):Wj(isNaN(t)?n:t)}}function Hj(e,t){var n=t-e;return n?iI(e,n):Wj(isNaN(e)?t:e)}const gb=(function e(t){var n=lI(t);function s(i,a){var l=n((i=_y(i)).r,(a=_y(a)).r),u=n(i.g,a.g),h=n(i.b,a.b),p=Hj(i.opacity,a.opacity);return function(f){return i.r=l(f),i.g=u(f),i.b=h(f),i.opacity=p(f),i+""}}return s.gamma=e,s})(1);function Cs(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var ky=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,zf=new RegExp(ky.source,"g");function cI(e){return function(){return e}}function uI(e){return function(t){return e(t)+""}}function dI(e,t){var n=ky.lastIndex=zf.lastIndex=0,s,i,a,l=-1,u=[],h=[];for(e=e+"",t=t+"";(s=ky.exec(e))&&(i=zf.exec(t));)(a=i.index)>n&&(a=t.slice(n,a),u[l]?u[l]+=a:u[++l]=a),(s=s[0])===(i=i[0])?u[l]?u[l]+=i:u[++l]=i:(u[++l]=null,h.push({i:l,x:Cs(s,i)})),n=zf.lastIndex;return n<t.length&&(a=t.slice(n),u[l]?u[l]+=a:u[++l]=a),u.length<2?h[0]?uI(h[0].x):cI(t):(t=h.length,function(p){for(var f=0,g;f<t;++f)u[(g=h[f]).i]=g.x(p);return u.join("")})}var vb=180/Math.PI,Sy={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Gj(e,t,n,s,i,a){var l,u,h;return(l=Math.sqrt(e*e+t*t))&&(e/=l,t/=l),(h=e*n+t*s)&&(n-=e*h,s-=t*h),(u=Math.sqrt(n*n+s*s))&&(n/=u,s/=u,h/=u),e*s<t*n&&(e=-e,t=-t,h=-h,l=-l),{translateX:i,translateY:a,rotate:Math.atan2(t,e)*vb,skewX:Math.atan(h)*vb,scaleX:l,scaleY:u}}var Bc;function fI(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Sy:Gj(t.a,t.b,t.c,t.d,t.e,t.f)}function hI(e){return e==null||(Bc||(Bc=document.createElementNS("http://www.w3.org/2000/svg","g")),Bc.setAttribute("transform",e),!(e=Bc.transform.baseVal.consolidate()))?Sy:(e=e.matrix,Gj(e.a,e.b,e.c,e.d,e.e,e.f))}function Vj(e,t,n,s){function i(p){return p.length?p.pop()+" ":""}function a(p,f,g,y,w,N){if(p!==g||f!==y){var b=w.push("translate(",null,t,null,n);N.push({i:b-4,x:Cs(p,g)},{i:b-2,x:Cs(f,y)})}else(g||y)&&w.push("translate("+g+t+y+n)}function l(p,f,g,y){p!==f?(p-f>180?f+=360:f-p>180&&(p+=360),y.push({i:g.push(i(g)+"rotate(",null,s)-2,x:Cs(p,f)})):f&&g.push(i(g)+"rotate("+f+s)}function u(p,f,g,y){p!==f?y.push({i:g.push(i(g)+"skewX(",null,s)-2,x:Cs(p,f)}):f&&g.push(i(g)+"skewX("+f+s)}function h(p,f,g,y,w,N){if(p!==g||f!==y){var b=w.push(i(w)+"scale(",null,",",null,")");N.push({i:b-4,x:Cs(p,g)},{i:b-2,x:Cs(f,y)})}else(g!==1||y!==1)&&w.push(i(w)+"scale("+g+","+y+")")}return function(p,f){var g=[],y=[];return p=e(p),f=e(f),a(p.translateX,p.translateY,f.translateX,f.translateY,g,y),l(p.rotate,f.rotate,g,y),u(p.skewX,f.skewX,g,y),h(p.scaleX,p.scaleY,f.scaleX,f.scaleY,g,y),p=f=null,function(w){for(var N=-1,b=y.length,_;++N<b;)g[(_=y[N]).i]=_.x(w);return g.join("")}}}var pI=Vj(fI,"px, ","px)","deg)"),mI=Vj(hI,", ",")",")"),gI=1e-12;function yb(e){return((e=Math.exp(e))+1/e)/2}function vI(e){return((e=Math.exp(e))-1/e)/2}function yI(e){return((e=Math.exp(2*e))-1)/(e+1)}const wI=(function e(t,n,s){function i(a,l){var u=a[0],h=a[1],p=a[2],f=l[0],g=l[1],y=l[2],w=f-u,N=g-h,b=w*w+N*N,_,k;if(b<gI)k=Math.log(y/p)/t,_=function(O){return[u+O*w,h+O*N,p*Math.exp(t*O*k)]};else{var E=Math.sqrt(b),j=(y*y-p*p+s*b)/(2*p*n*E),C=(y*y-p*p-s*b)/(2*y*n*E),I=Math.log(Math.sqrt(j*j+1)-j),P=Math.log(Math.sqrt(C*C+1)-C);k=(P-I)/t,_=function(O){var F=O*k,M=yb(I),A=p/(n*E)*(M*yI(t*F+I)-vI(I));return[u+A*w,h+A*N,p*M/yb(t*F+I)]}}return _.duration=k*1e3*t/Math.SQRT2,_}return i.rho=function(a){var l=Math.max(.001,+a),u=l*l,h=u*u;return e(l,u,h)},i})(Math.SQRT2,2,4);var Li=0,Va=0,qa=0,Yj=1e3,hu,Ya,pu=0,bo=0,Ru=0,sl=typeof performance=="object"&&performance.now?performance:Date,Kj=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function rw(){return bo||(Kj(xI),bo=sl.now()+Ru)}function xI(){bo=0}function mu(){this._call=this._time=this._next=null}mu.prototype=Xj.prototype={constructor:mu,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?rw():+n)+(t==null?0:+t),!this._next&&Ya!==this&&(Ya?Ya._next=this:hu=this,Ya=this),this._call=e,this._time=n,Ny()},stop:function(){this._call&&(this._call=null,this._time=1/0,Ny())}};function Xj(e,t,n){var s=new mu;return s.restart(e,t,n),s}function bI(){rw(),++Li;for(var e=hu,t;e;)(t=bo-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Li}function wb(){bo=(pu=sl.now())+Ru,Li=Va=0;try{bI()}finally{Li=0,kI(),bo=0}}function _I(){var e=sl.now(),t=e-pu;t>Yj&&(Ru-=t,pu=e)}function kI(){for(var e,t=hu,n,s=1/0;t;)t._call?(s>t._time&&(s=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:hu=n);Ya=e,Ny(s)}function Ny(e){if(!Li){Va&&(Va=clearTimeout(Va));var t=e-bo;t>24?(e<1/0&&(Va=setTimeout(wb,e-sl.now()-Ru)),qa&&(qa=clearInterval(qa))):(qa||(pu=sl.now(),qa=setInterval(_I,Yj)),Li=1,Kj(wb))}}function xb(e,t,n){var s=new mu;return t=t==null?0:+t,s.restart(i=>{s.stop(),e(i+t)},t,n),s}var SI=Cu("start","end","cancel","interrupt"),NI=[],Qj=0,bb=1,Ey=2,ou=3,_b=4,jy=5,iu=6;function Au(e,t,n,s,i,a){var l=e.__transition;if(!l)e.__transition={};else if(n in l)return;EI(e,n,{name:t,index:s,group:i,on:SI,tween:NI,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:Qj})}function sw(e,t){var n=ur(e,t);if(n.state>Qj)throw new Error("too late; already scheduled");return n}function Er(e,t){var n=ur(e,t);if(n.state>ou)throw new Error("too late; already running");return n}function ur(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function EI(e,t,n){var s=e.__transition,i;s[t]=n,n.timer=Xj(a,0,n.time);function a(p){n.state=bb,n.timer.restart(l,n.delay,n.time),n.delay<=p&&l(p-n.delay)}function l(p){var f,g,y,w;if(n.state!==bb)return h();for(f in s)if(w=s[f],w.name===n.name){if(w.state===ou)return xb(l);w.state===_b?(w.state=iu,w.timer.stop(),w.on.call("interrupt",e,e.__data__,w.index,w.group),delete s[f]):+f<t&&(w.state=iu,w.timer.stop(),w.on.call("cancel",e,e.__data__,w.index,w.group),delete s[f])}if(xb(function(){n.state===ou&&(n.state=_b,n.timer.restart(u,n.delay,n.time),u(p))}),n.state=Ey,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Ey){for(n.state=ou,i=new Array(y=n.tween.length),f=0,g=-1;f<y;++f)(w=n.tween[f].value.call(e,e.__data__,n.index,n.group))&&(i[++g]=w);i.length=g+1}}function u(p){for(var f=p<n.duration?n.ease.call(null,p/n.duration):(n.timer.restart(h),n.state=jy,1),g=-1,y=i.length;++g<y;)i[g].call(e,f);n.state===jy&&(n.on.call("end",e,e.__data__,n.index,n.group),h())}function h(){n.state=iu,n.timer.stop(),delete s[t];for(var p in s)return;delete e.__transition}}function au(e,t){var n=e.__transition,s,i,a=!0,l;if(n){t=t==null?null:t+"";for(l in n){if((s=n[l]).name!==t){a=!1;continue}i=s.state>Ey&&s.state<jy,s.state=iu,s.timer.stop(),s.on.call(i?"interrupt":"cancel",e,e.__data__,s.index,s.group),delete n[l]}a&&delete e.__transition}}function jI(e){return this.each(function(){au(this,e)})}function CI(e,t){var n,s;return function(){var i=Er(this,e),a=i.tween;if(a!==n){s=n=a;for(var l=0,u=s.length;l<u;++l)if(s[l].name===t){s=s.slice(),s.splice(l,1);break}}i.tween=s}}function TI(e,t,n){var s,i;if(typeof n!="function")throw new Error;return function(){var a=Er(this,e),l=a.tween;if(l!==s){i=(s=l).slice();for(var u={name:t,value:n},h=0,p=i.length;h<p;++h)if(i[h].name===t){i[h]=u;break}h===p&&i.push(u)}a.tween=i}}function RI(e,t){var n=this._id;if(e+="",arguments.length<2){for(var s=ur(this.node(),n).tween,i=0,a=s.length,l;i<a;++i)if((l=s[i]).name===e)return l.value;return null}return this.each((t==null?CI:TI)(n,e,t))}function ow(e,t,n){var s=e._id;return e.each(function(){var i=Er(this,s);(i.value||(i.value={}))[t]=n.apply(this,arguments)}),function(i){return ur(i,s).value[t]}}function Zj(e,t){var n;return(typeof t=="number"?Cs:t instanceof rl?gb:(n=rl(t))?(t=n,gb):dI)(e,t)}function AI(e){return function(){this.removeAttribute(e)}}function MI(e){return function(){this.removeAttributeNS(e.space,e.local)}}function II(e,t,n){var s,i=n+"",a;return function(){var l=this.getAttribute(e);return l===i?null:l===s?a:a=t(s=l,n)}}function OI(e,t,n){var s,i=n+"",a;return function(){var l=this.getAttributeNS(e.space,e.local);return l===i?null:l===s?a:a=t(s=l,n)}}function PI(e,t,n){var s,i,a;return function(){var l,u=n(this),h;return u==null?void this.removeAttribute(e):(l=this.getAttribute(e),h=u+"",l===h?null:l===s&&h===i?a:(i=h,a=t(s=l,u)))}}function $I(e,t,n){var s,i,a;return function(){var l,u=n(this),h;return u==null?void this.removeAttributeNS(e.space,e.local):(l=this.getAttributeNS(e.space,e.local),h=u+"",l===h?null:l===s&&h===i?a:(i=h,a=t(s=l,u)))}}function LI(e,t){var n=Tu(e),s=n==="transform"?mI:Zj;return this.attrTween(e,typeof t=="function"?(n.local?$I:PI)(n,s,ow(this,"attr."+e,t)):t==null?(n.local?MI:AI)(n):(n.local?OI:II)(n,s,t))}function qI(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function DI(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function FI(e,t){var n,s;function i(){var a=t.apply(this,arguments);return a!==s&&(n=(s=a)&&DI(e,a)),n}return i._value=t,i}function zI(e,t){var n,s;function i(){var a=t.apply(this,arguments);return a!==s&&(n=(s=a)&&qI(e,a)),n}return i._value=t,i}function BI(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var s=Tu(e);return this.tween(n,(s.local?FI:zI)(s,t))}function UI(e,t){return function(){sw(this,e).delay=+t.apply(this,arguments)}}function WI(e,t){return t=+t,function(){sw(this,e).delay=t}}function HI(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?UI:WI)(t,e)):ur(this.node(),t).delay}function GI(e,t){return function(){Er(this,e).duration=+t.apply(this,arguments)}}function VI(e,t){return t=+t,function(){Er(this,e).duration=t}}function YI(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?GI:VI)(t,e)):ur(this.node(),t).duration}function KI(e,t){if(typeof t!="function")throw new Error;return function(){Er(this,e).ease=t}}function XI(e){var t=this._id;return arguments.length?this.each(KI(t,e)):ur(this.node(),t).ease}function QI(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Er(this,e).ease=n}}function ZI(e){if(typeof e!="function")throw new Error;return this.each(QI(this._id,e))}function JI(e){typeof e!="function"&&(e=Rj(e));for(var t=this._groups,n=t.length,s=new Array(n),i=0;i<n;++i)for(var a=t[i],l=a.length,u=s[i]=[],h,p=0;p<l;++p)(h=a[p])&&e.call(h,h.__data__,p,a)&&u.push(h);return new Xr(s,this._parents,this._name,this._id)}function eO(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,s=t.length,i=n.length,a=Math.min(s,i),l=new Array(s),u=0;u<a;++u)for(var h=t[u],p=n[u],f=h.length,g=l[u]=new Array(f),y,w=0;w<f;++w)(y=h[w]||p[w])&&(g[w]=y);for(;u<s;++u)l[u]=t[u];return new Xr(l,this._parents,this._name,this._id)}function tO(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function nO(e,t,n){var s,i,a=tO(t)?sw:Er;return function(){var l=a(this,e),u=l.on;u!==s&&(i=(s=u).copy()).on(t,n),l.on=i}}function rO(e,t){var n=this._id;return arguments.length<2?ur(this.node(),n).on.on(e):this.each(nO(n,e,t))}function sO(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function oO(){return this.on("end.remove",sO(this._id))}function iO(e){var t=this._name,n=this._id;typeof e!="function"&&(e=ew(e));for(var s=this._groups,i=s.length,a=new Array(i),l=0;l<i;++l)for(var u=s[l],h=u.length,p=a[l]=new Array(h),f,g,y=0;y<h;++y)(f=u[y])&&(g=e.call(f,f.__data__,y,u))&&("__data__"in f&&(g.__data__=f.__data__),p[y]=g,Au(p[y],t,n,y,p,ur(f,n)));return new Xr(a,this._parents,t,n)}function aO(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Tj(e));for(var s=this._groups,i=s.length,a=[],l=[],u=0;u<i;++u)for(var h=s[u],p=h.length,f,g=0;g<p;++g)if(f=h[g]){for(var y=e.call(f,f.__data__,g,h),w,N=ur(f,n),b=0,_=y.length;b<_;++b)(w=y[b])&&Au(w,t,n,b,y,N);a.push(y),l.push(f)}return new Xr(a,l,t,n)}var lO=hl.prototype.constructor;function cO(){return new lO(this._groups,this._parents)}function uO(e,t){var n,s,i;return function(){var a=$i(this,e),l=(this.style.removeProperty(e),$i(this,e));return a===l?null:a===n&&l===s?i:i=t(n=a,s=l)}}function Jj(e){return function(){this.style.removeProperty(e)}}function dO(e,t,n){var s,i=n+"",a;return function(){var l=$i(this,e);return l===i?null:l===s?a:a=t(s=l,n)}}function fO(e,t,n){var s,i,a;return function(){var l=$i(this,e),u=n(this),h=u+"";return u==null&&(h=u=(this.style.removeProperty(e),$i(this,e))),l===h?null:l===s&&h===i?a:(i=h,a=t(s=l,u))}}function hO(e,t){var n,s,i,a="style."+t,l="end."+a,u;return function(){var h=Er(this,e),p=h.on,f=h.value[a]==null?u||(u=Jj(t)):void 0;(p!==n||i!==f)&&(s=(n=p).copy()).on(l,i=f),h.on=s}}function pO(e,t,n){var s=(e+="")=="transform"?pI:Zj;return t==null?this.styleTween(e,uO(e,s)).on("end.style."+e,Jj(e)):typeof t=="function"?this.styleTween(e,fO(e,s,ow(this,"style."+e,t))).each(hO(this._id,e)):this.styleTween(e,dO(e,s,t),n).on("end.style."+e,null)}function mO(e,t,n){return function(s){this.style.setProperty(e,t.call(this,s),n)}}function gO(e,t,n){var s,i;function a(){var l=t.apply(this,arguments);return l!==i&&(s=(i=l)&&mO(e,l,n)),s}return a._value=t,a}function vO(e,t,n){var s="style."+(e+="");if(arguments.length<2)return(s=this.tween(s))&&s._value;if(t==null)return this.tween(s,null);if(typeof t!="function")throw new Error;return this.tween(s,gO(e,t,n??""))}function yO(e){return function(){this.textContent=e}}function wO(e){return function(){var t=e(this);this.textContent=t??""}}function xO(e){return this.tween("text",typeof e=="function"?wO(ow(this,"text",e)):yO(e==null?"":e+""))}function bO(e){return function(t){this.textContent=e.call(this,t)}}function _O(e){var t,n;function s(){var i=e.apply(this,arguments);return i!==n&&(t=(n=i)&&bO(i)),t}return s._value=e,s}function kO(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,_O(e))}function SO(){for(var e=this._name,t=this._id,n=eC(),s=this._groups,i=s.length,a=0;a<i;++a)for(var l=s[a],u=l.length,h,p=0;p<u;++p)if(h=l[p]){var f=ur(h,t);Au(h,e,n,p,l,{time:f.time+f.delay+f.duration,delay:0,duration:f.duration,ease:f.ease})}return new Xr(s,this._parents,e,n)}function NO(){var e,t,n=this,s=n._id,i=n.size();return new Promise(function(a,l){var u={value:l},h={value:function(){--i===0&&a()}};n.each(function(){var p=Er(this,s),f=p.on;f!==e&&(t=(e=f).copy(),t._.cancel.push(u),t._.interrupt.push(u),t._.end.push(h)),p.on=t}),i===0&&a()})}var EO=0;function Xr(e,t,n,s){this._groups=e,this._parents=t,this._name=n,this._id=s}function eC(){return++EO}var Vr=hl.prototype;Xr.prototype={constructor:Xr,select:iO,selectAll:aO,selectChild:Vr.selectChild,selectChildren:Vr.selectChildren,filter:JI,merge:eO,selection:cO,transition:SO,call:Vr.call,nodes:Vr.nodes,node:Vr.node,size:Vr.size,empty:Vr.empty,each:Vr.each,on:rO,attr:LI,attrTween:BI,style:pO,styleTween:vO,text:xO,textTween:kO,remove:oO,tween:RI,delay:HI,duration:YI,ease:XI,easeVarying:ZI,end:NO,[Symbol.iterator]:Vr[Symbol.iterator]};function jO(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var CO={time:null,delay:0,duration:250,ease:jO};function TO(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 RO(e){var t,n;e instanceof Xr?(t=e._id,e=e._name):(t=eC(),(n=CO).time=rw(),e=e==null?null:e+"");for(var s=this._groups,i=s.length,a=0;a<i;++a)for(var l=s[a],u=l.length,h,p=0;p<u;++p)(h=l[p])&&Au(h,e,t,p,l,n||TO(h,t));return new Xr(s,this._parents,e,t)}hl.prototype.interrupt=jI;hl.prototype.transition=RO;const Uc=e=>()=>e;function AO(e,{sourceEvent:t,target:n,transform:s,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:s,enumerable:!0,configurable:!0},_:{value:i}})}function Yr(e,t,n){this.k=e,this.x=t,this.y=n}Yr.prototype={constructor:Yr,scale:function(e){return e===1?this:new Yr(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Yr(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Kr=new Yr(1,0,0);Yr.prototype;function Bf(e){e.stopImmediatePropagation()}function Da(e){e.preventDefault(),e.stopImmediatePropagation()}function MO(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function IO(){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 kb(){return this.__zoom||Kr}function OO(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function PO(){return navigator.maxTouchPoints||"ontouchstart"in this}function $O(e,t,n){var s=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],a=e.invertY(t[0][1])-n[0][1],l=e.invertY(t[1][1])-n[1][1];return e.translate(i>s?(s+i)/2:Math.min(0,s)||Math.max(0,i),l>a?(a+l)/2:Math.min(0,a)||Math.max(0,l))}function tC(){var e=MO,t=IO,n=$O,s=OO,i=PO,a=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],u=250,h=wI,p=Cu("start","zoom","end"),f,g,y,w=500,N=150,b=0,_=10;function k(T){T.property("__zoom",kb).on("wheel.zoom",F,{passive:!1}).on("mousedown.zoom",M).on("dblclick.zoom",A).filter(i).on("touchstart.zoom",q).on("touchmove.zoom",W).on("touchend.zoom touchcancel.zoom",K).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}k.transform=function(T,Z,U,re){var Q=T.selection?T.selection():T;Q.property("__zoom",kb),T!==Q?I(T,Z,U,re):Q.interrupt().each(function(){P(this,arguments).event(re).start().zoom(null,typeof Z=="function"?Z.apply(this,arguments):Z).end()})},k.scaleBy=function(T,Z,U,re){k.scaleTo(T,function(){var Q=this.__zoom.k,H=typeof Z=="function"?Z.apply(this,arguments):Z;return Q*H},U,re)},k.scaleTo=function(T,Z,U,re){k.transform(T,function(){var Q=t.apply(this,arguments),H=this.__zoom,te=U==null?C(Q):typeof U=="function"?U.apply(this,arguments):U,$=H.invert(te),V=typeof Z=="function"?Z.apply(this,arguments):Z;return n(j(E(H,V),te,$),Q,l)},U,re)},k.translateBy=function(T,Z,U,re){k.transform(T,function(){return n(this.__zoom.translate(typeof Z=="function"?Z.apply(this,arguments):Z,typeof U=="function"?U.apply(this,arguments):U),t.apply(this,arguments),l)},null,re)},k.translateTo=function(T,Z,U,re,Q){k.transform(T,function(){var H=t.apply(this,arguments),te=this.__zoom,$=re==null?C(H):typeof re=="function"?re.apply(this,arguments):re;return n(Kr.translate($[0],$[1]).scale(te.k).translate(typeof Z=="function"?-Z.apply(this,arguments):-Z,typeof U=="function"?-U.apply(this,arguments):-U),H,l)},re,Q)};function E(T,Z){return Z=Math.max(a[0],Math.min(a[1],Z)),Z===T.k?T:new Yr(Z,T.x,T.y)}function j(T,Z,U){var re=Z[0]-U[0]*T.k,Q=Z[1]-U[1]*T.k;return re===T.x&&Q===T.y?T:new Yr(T.k,re,Q)}function C(T){return[(+T[0][0]+ +T[1][0])/2,(+T[0][1]+ +T[1][1])/2]}function I(T,Z,U,re){T.on("start.zoom",function(){P(this,arguments).event(re).start()}).on("interrupt.zoom end.zoom",function(){P(this,arguments).event(re).end()}).tween("zoom",function(){var Q=this,H=arguments,te=P(Q,H).event(re),$=t.apply(Q,H),V=U==null?C($):typeof U=="function"?U.apply(Q,H):U,J=Math.max($[1][0]-$[0][0],$[1][1]-$[0][1]),D=Q.__zoom,L=typeof Z=="function"?Z.apply(Q,H):Z,X=h(D.invert(V).concat(J/D.k),L.invert(V).concat(J/L.k));return function(se){if(se===1)se=L;else{var fe=X(se),pe=J/fe[2];se=new Yr(pe,V[0]-fe[0]*pe,V[1]-fe[1]*pe)}te.zoom(null,se)}})}function P(T,Z,U){return!U&&T.__zooming||new O(T,Z)}function O(T,Z){this.that=T,this.args=Z,this.active=0,this.sourceEvent=null,this.extent=t.apply(T,Z),this.taps=0}O.prototype={event:function(T){return T&&(this.sourceEvent=T),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(T,Z){return this.mouse&&T!=="mouse"&&(this.mouse[1]=Z.invert(this.mouse[0])),this.touch0&&T!=="touch"&&(this.touch0[1]=Z.invert(this.touch0[0])),this.touch1&&T!=="touch"&&(this.touch1[1]=Z.invert(this.touch1[0])),this.that.__zoom=Z,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(T){var Z=Ln(this.that).datum();p.call(T,this.that,new AO(T,{sourceEvent:this.sourceEvent,target:k,transform:this.that.__zoom,dispatch:p}),Z)}};function F(T,...Z){if(!e.apply(this,arguments))return;var U=P(this,Z).event(T),re=this.__zoom,Q=Math.max(a[0],Math.min(a[1],re.k*Math.pow(2,s.apply(this,arguments)))),H=sr(T);if(U.wheel)(U.mouse[0][0]!==H[0]||U.mouse[0][1]!==H[1])&&(U.mouse[1]=re.invert(U.mouse[0]=H)),clearTimeout(U.wheel);else{if(re.k===Q)return;U.mouse=[H,re.invert(H)],au(this),U.start()}Da(T),U.wheel=setTimeout(te,N),U.zoom("mouse",n(j(E(re,Q),U.mouse[0],U.mouse[1]),U.extent,l));function te(){U.wheel=null,U.end()}}function M(T,...Z){if(y||!e.apply(this,arguments))return;var U=T.currentTarget,re=P(this,Z,!0).event(T),Q=Ln(T.view).on("mousemove.zoom",V,!0).on("mouseup.zoom",J,!0),H=sr(T,U),te=T.clientX,$=T.clientY;Fj(T.view),Bf(T),re.mouse=[H,this.__zoom.invert(H)],au(this),re.start();function V(D){if(Da(D),!re.moved){var L=D.clientX-te,X=D.clientY-$;re.moved=L*L+X*X>b}re.event(D).zoom("mouse",n(j(re.that.__zoom,re.mouse[0]=sr(D,U),re.mouse[1]),re.extent,l))}function J(D){Q.on("mousemove.zoom mouseup.zoom",null),zj(D.view,re.moved),Da(D),re.event(D).end()}}function A(T,...Z){if(e.apply(this,arguments)){var U=this.__zoom,re=sr(T.changedTouches?T.changedTouches[0]:T,this),Q=U.invert(re),H=U.k*(T.shiftKey?.5:2),te=n(j(E(U,H),re,Q),t.apply(this,Z),l);Da(T),u>0?Ln(this).transition().duration(u).call(I,te,re,T):Ln(this).call(k.transform,te,re,T)}}function q(T,...Z){if(e.apply(this,arguments)){var U=T.touches,re=U.length,Q=P(this,Z,T.changedTouches.length===re).event(T),H,te,$,V;for(Bf(T),te=0;te<re;++te)$=U[te],V=sr($,this),V=[V,this.__zoom.invert(V),$.identifier],Q.touch0?!Q.touch1&&Q.touch0[2]!==V[2]&&(Q.touch1=V,Q.taps=0):(Q.touch0=V,H=!0,Q.taps=1+!!f);f&&(f=clearTimeout(f)),H&&(Q.taps<2&&(g=V[0],f=setTimeout(function(){f=null},w)),au(this),Q.start())}}function W(T,...Z){if(this.__zooming){var U=P(this,Z).event(T),re=T.changedTouches,Q=re.length,H,te,$,V;for(Da(T),H=0;H<Q;++H)te=re[H],$=sr(te,this),U.touch0&&U.touch0[2]===te.identifier?U.touch0[0]=$:U.touch1&&U.touch1[2]===te.identifier&&(U.touch1[0]=$);if(te=U.that.__zoom,U.touch1){var J=U.touch0[0],D=U.touch0[1],L=U.touch1[0],X=U.touch1[1],se=(se=L[0]-J[0])*se+(se=L[1]-J[1])*se,fe=(fe=X[0]-D[0])*fe+(fe=X[1]-D[1])*fe;te=E(te,Math.sqrt(se/fe)),$=[(J[0]+L[0])/2,(J[1]+L[1])/2],V=[(D[0]+X[0])/2,(D[1]+X[1])/2]}else if(U.touch0)$=U.touch0[0],V=U.touch0[1];else return;U.zoom("touch",n(j(te,$,V),U.extent,l))}}function K(T,...Z){if(this.__zooming){var U=P(this,Z).event(T),re=T.changedTouches,Q=re.length,H,te;for(Bf(T),y&&clearTimeout(y),y=setTimeout(function(){y=null},w),H=0;H<Q;++H)te=re[H],U.touch0&&U.touch0[2]===te.identifier?delete U.touch0:U.touch1&&U.touch1[2]===te.identifier&&delete U.touch1;if(U.touch1&&!U.touch0&&(U.touch0=U.touch1,delete U.touch1),U.touch0)U.touch0[1]=this.__zoom.invert(U.touch0[0]);else if(U.end(),U.taps===2&&(te=sr(te,this),Math.hypot(g[0]-te[0],g[1]-te[1])<_)){var $=Ln(this).on("dblclick.zoom");$&&$.apply(this,arguments)}}}return k.wheelDelta=function(T){return arguments.length?(s=typeof T=="function"?T:Uc(+T),k):s},k.filter=function(T){return arguments.length?(e=typeof T=="function"?T:Uc(!!T),k):e},k.touchable=function(T){return arguments.length?(i=typeof T=="function"?T:Uc(!!T),k):i},k.extent=function(T){return arguments.length?(t=typeof T=="function"?T:Uc([[+T[0][0],+T[0][1]],[+T[1][0],+T[1][1]]]),k):t},k.scaleExtent=function(T){return arguments.length?(a[0]=+T[0],a[1]=+T[1],k):[a[0],a[1]]},k.translateExtent=function(T){return arguments.length?(l[0][0]=+T[0][0],l[1][0]=+T[1][0],l[0][1]=+T[0][1],l[1][1]=+T[1][1],k):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},k.constrain=function(T){return arguments.length?(n=T,k):n},k.duration=function(T){return arguments.length?(u=+T,k):u},k.interpolate=function(T){return arguments.length?(h=T,k):h},k.on=function(){var T=p.on.apply(p,arguments);return T===p?k:T},k.clickDistance=function(T){return arguments.length?(b=(T=+T)*T,k):Math.sqrt(b)},k.tapDistance=function(T){return arguments.length?(_=+T,k):_},k}var iw=Ej();const Mu=S.createContext(null),LO=Mu.Provider,Qr={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.`},nC=Qr.error001();function it(e,t){const n=S.useContext(Mu);if(n===null)throw new Error(nC);return jj(n,e,t)}const Rt=()=>{const e=S.useContext(Mu);if(e===null)throw new Error(nC);return S.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},qO=e=>e.userSelectionActive?"none":"all";function aw({position:e,children:t,className:n,style:s,...i}){const a=it(qO),l=`${e}`.split("-");return ue.createElement("div",{className:Ht(["react-flow__panel",n,...l]),style:{...s,pointerEvents:a},...i},t)}function DO({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:ue.createElement(aw,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://reactflow.dev/pro"},ue.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}const FO=({x:e,y:t,label:n,labelStyle:s={},labelShowBg:i=!0,labelBgStyle:a={},labelBgPadding:l=[2,4],labelBgBorderRadius:u=2,children:h,className:p,...f})=>{const g=S.useRef(null),[y,w]=S.useState({x:0,y:0,width:0,height:0}),N=Ht(["react-flow__edge-textwrapper",p]);return S.useEffect(()=>{if(g.current){const b=g.current.getBBox();w({x:b.x,y:b.y,width:b.width,height:b.height})}},[n]),typeof n>"u"||!n?null:ue.createElement("g",{transform:`translate(${e-y.width/2} ${t-y.height/2})`,className:N,visibility:y.width?"visible":"hidden",...f},i&&ue.createElement("rect",{width:y.width+2*l[0],x:-l[0],y:-l[1],height:y.height+2*l[1],className:"react-flow__edge-textbg",style:a,rx:u,ry:u}),ue.createElement("text",{className:"react-flow__edge-text",y:y.height/2,dy:"0.3em",ref:g,style:s},n),h)};var zO=S.memo(FO);const lw=e=>({width:e.offsetWidth,height:e.offsetHeight}),qi=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),cw=(e={x:0,y:0},t)=>({x:qi(e.x,t[0][0],t[1][0]),y:qi(e.y,t[0][1],t[1][1])}),Sb=(e,t,n)=>e<t?qi(Math.abs(e-t),1,50)/50:e>n?-qi(Math.abs(e-n),1,50)/50:0,rC=(e,t)=>{const n=Sb(e.x,35,t.width-35)*20,s=Sb(e.y,35,t.height-35)*20;return[n,s]},sC=e=>{var t;return((t=e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},oC=(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)}),ol=({x:e,y:t,width:n,height:s})=>({x:e,y:t,x2:e+n,y2:t+s}),iC=({x:e,y:t,x2:n,y2:s})=>({x:e,y:t,width:n-e,height:s-t}),Nb=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),BO=(e,t)=>iC(oC(ol(e),ol(t))),Cy=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),s=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*s)},UO=e=>qn(e.width)&&qn(e.height)&&qn(e.x)&&qn(e.y),qn=e=>!isNaN(e)&&isFinite(e),Nt=Symbol.for("internals"),aC=["Enter"," ","Escape"],WO=(e,t)=>{},HO=e=>"nativeEvent"in e;function Ty(e){var i,a;const t=HO(e)?e.nativeEvent:e,n=((a=(i=t.composedPath)==null?void 0:i.call(t))==null?void 0:a[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 lC=e=>"clientX"in e,As=(e,t)=>{var a,l;const n=lC(e),s=n?e.clientX:(a=e.touches)==null?void 0:a[0].clientX,i=n?e.clientY:(l=e.touches)==null?void 0:l[0].clientY;return{x:s-((t==null?void 0:t.left)??0),y:i-((t==null?void 0:t.top)??0)}},gu=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0},ml=({id:e,path:t,labelX:n,labelY:s,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:p,style:f,markerEnd:g,markerStart:y,interactionWidth:w=20})=>ue.createElement(ue.Fragment,null,ue.createElement("path",{id:e,style:f,d:t,fill:"none",className:"react-flow__edge-path",markerEnd:g,markerStart:y}),w&&ue.createElement("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:w,className:"react-flow__edge-interaction"}),i&&qn(n)&&qn(s)?ue.createElement(zO,{x:n,y:s,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:p}):null);ml.displayName="BaseEdge";function Fa(e,t,n){return n===void 0?n:s=>{const i=t().edges.find(a=>a.id===e);i&&n(s,{...i})}}function cC({sourceX:e,sourceY:t,targetX:n,targetY:s}){const i=Math.abs(n-e)/2,a=n<e?n+i:n-i,l=Math.abs(s-t)/2,u=s<t?s+l:s-l;return[a,u,i,l]}function uC({sourceX:e,sourceY:t,targetX:n,targetY:s,sourceControlX:i,sourceControlY:a,targetControlX:l,targetControlY:u}){const h=e*.125+i*.375+l*.375+n*.125,p=t*.125+a*.375+u*.375+s*.125,f=Math.abs(h-e),g=Math.abs(p-t);return[h,p,f,g]}var _o;(function(e){e.Strict="strict",e.Loose="loose"})(_o||(_o={}));var yo;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(yo||(yo={}));var il;(function(e){e.Partial="partial",e.Full="full"})(il||(il={}));var Rs;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Rs||(Rs={}));var vu;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(vu||(vu={}));var Pe;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Pe||(Pe={}));function Eb({pos:e,x1:t,y1:n,x2:s,y2:i}){return e===Pe.Left||e===Pe.Right?[.5*(t+s),n]:[t,.5*(n+i)]}function dC({sourceX:e,sourceY:t,sourcePosition:n=Pe.Bottom,targetX:s,targetY:i,targetPosition:a=Pe.Top}){const[l,u]=Eb({pos:n,x1:e,y1:t,x2:s,y2:i}),[h,p]=Eb({pos:a,x1:s,y1:i,x2:e,y2:t}),[f,g,y,w]=uC({sourceX:e,sourceY:t,targetX:s,targetY:i,sourceControlX:l,sourceControlY:u,targetControlX:h,targetControlY:p});return[`M${e},${t} C${l},${u} ${h},${p} ${s},${i}`,f,g,y,w]}const uw=S.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,sourcePosition:i=Pe.Bottom,targetPosition:a=Pe.Top,label:l,labelStyle:u,labelShowBg:h,labelBgStyle:p,labelBgPadding:f,labelBgBorderRadius:g,style:y,markerEnd:w,markerStart:N,interactionWidth:b})=>{const[_,k,E]=dC({sourceX:e,sourceY:t,sourcePosition:i,targetX:n,targetY:s,targetPosition:a});return ue.createElement(ml,{path:_,labelX:k,labelY:E,label:l,labelStyle:u,labelShowBg:h,labelBgStyle:p,labelBgPadding:f,labelBgBorderRadius:g,style:y,markerEnd:w,markerStart:N,interactionWidth:b})});uw.displayName="SimpleBezierEdge";const jb={[Pe.Left]:{x:-1,y:0},[Pe.Right]:{x:1,y:0},[Pe.Top]:{x:0,y:-1},[Pe.Bottom]:{x:0,y:1}},GO=({source:e,sourcePosition:t=Pe.Bottom,target:n})=>t===Pe.Left||t===Pe.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},Cb=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function VO({source:e,sourcePosition:t=Pe.Bottom,target:n,targetPosition:s=Pe.Top,center:i,offset:a}){const l=jb[t],u=jb[s],h={x:e.x+l.x*a,y:e.y+l.y*a},p={x:n.x+u.x*a,y:n.y+u.y*a},f=GO({source:h,sourcePosition:t,target:p}),g=f.x!==0?"x":"y",y=f[g];let w=[],N,b;const _={x:0,y:0},k={x:0,y:0},[E,j,C,I]=cC({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[g]*u[g]===-1){N=i.x??E,b=i.y??j;const O=[{x:N,y:h.y},{x:N,y:p.y}],F=[{x:h.x,y:b},{x:p.x,y:b}];l[g]===y?w=g==="x"?O:F:w=g==="x"?F:O}else{const O=[{x:h.x,y:p.y}],F=[{x:p.x,y:h.y}];if(g==="x"?w=l.x===y?F:O:w=l.y===y?O:F,t===s){const K=Math.abs(e[g]-n[g]);if(K<=a){const T=Math.min(a-1,a-K);l[g]===y?_[g]=(h[g]>e[g]?-1:1)*T:k[g]=(p[g]>n[g]?-1:1)*T}}if(t!==s){const K=g==="x"?"y":"x",T=l[g]===u[K],Z=h[K]>p[K],U=h[K]<p[K];(l[g]===1&&(!T&&Z||T&&U)||l[g]!==1&&(!T&&U||T&&Z))&&(w=g==="x"?O:F)}const M={x:h.x+_.x,y:h.y+_.y},A={x:p.x+k.x,y:p.y+k.y},q=Math.max(Math.abs(M.x-w[0].x),Math.abs(A.x-w[0].x)),W=Math.max(Math.abs(M.y-w[0].y),Math.abs(A.y-w[0].y));q>=W?(N=(M.x+A.x)/2,b=w[0].y):(N=w[0].x,b=(M.y+A.y)/2)}return[[e,{x:h.x+_.x,y:h.y+_.y},...w,{x:p.x+k.x,y:p.y+k.y},n],N,b,C,I]}function YO(e,t,n,s){const i=Math.min(Cb(e,t)/2,Cb(t,n)/2,s),{x:a,y:l}=t;if(e.x===a&&a===n.x||e.y===l&&l===n.y)return`L${a} ${l}`;if(e.y===l){const p=e.x<n.x?-1:1,f=e.y<n.y?1:-1;return`L ${a+i*p},${l}Q ${a},${l} ${a},${l+i*f}`}const u=e.x<n.x?1:-1,h=e.y<n.y?-1:1;return`L ${a},${l+i*h}Q ${a},${l} ${a+i*u},${l}`}function Ry({sourceX:e,sourceY:t,sourcePosition:n=Pe.Bottom,targetX:s,targetY:i,targetPosition:a=Pe.Top,borderRadius:l=5,centerX:u,centerY:h,offset:p=20}){const[f,g,y,w,N]=VO({source:{x:e,y:t},sourcePosition:n,target:{x:s,y:i},targetPosition:a,center:{x:u,y:h},offset:p});return[f.reduce((_,k,E)=>{let j="";return E>0&&E<f.length-1?j=YO(f[E-1],k,f[E+1],l):j=`${E===0?"M":"L"}${k.x} ${k.y}`,_+=j,_},""),g,y,w,N]}const Iu=S.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:p,style:f,sourcePosition:g=Pe.Bottom,targetPosition:y=Pe.Top,markerEnd:w,markerStart:N,pathOptions:b,interactionWidth:_})=>{const[k,E,j]=Ry({sourceX:e,sourceY:t,sourcePosition:g,targetX:n,targetY:s,targetPosition:y,borderRadius:b==null?void 0:b.borderRadius,offset:b==null?void 0:b.offset});return ue.createElement(ml,{path:k,labelX:E,labelY:j,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:p,style:f,markerEnd:w,markerStart:N,interactionWidth:_})});Iu.displayName="SmoothStepEdge";const dw=S.memo(e=>{var t;return ue.createElement(Iu,{...e,pathOptions:S.useMemo(()=>{var n;return{borderRadius:0,offset:(n=e.pathOptions)==null?void 0:n.offset}},[(t=e.pathOptions)==null?void 0:t.offset])})});dw.displayName="StepEdge";function KO({sourceX:e,sourceY:t,targetX:n,targetY:s}){const[i,a,l,u]=cC({sourceX:e,sourceY:t,targetX:n,targetY:s});return[`M ${e},${t}L ${n},${s}`,i,a,l,u]}const fw=S.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:p,style:f,markerEnd:g,markerStart:y,interactionWidth:w})=>{const[N,b,_]=KO({sourceX:e,sourceY:t,targetX:n,targetY:s});return ue.createElement(ml,{path:N,labelX:b,labelY:_,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:p,style:f,markerEnd:g,markerStart:y,interactionWidth:w})});fw.displayName="StraightEdge";function Wc(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Tb({pos:e,x1:t,y1:n,x2:s,y2:i,c:a}){switch(e){case Pe.Left:return[t-Wc(t-s,a),n];case Pe.Right:return[t+Wc(s-t,a),n];case Pe.Top:return[t,n-Wc(n-i,a)];case Pe.Bottom:return[t,n+Wc(i-n,a)]}}function fC({sourceX:e,sourceY:t,sourcePosition:n=Pe.Bottom,targetX:s,targetY:i,targetPosition:a=Pe.Top,curvature:l=.25}){const[u,h]=Tb({pos:n,x1:e,y1:t,x2:s,y2:i,c:l}),[p,f]=Tb({pos:a,x1:s,y1:i,x2:e,y2:t,c:l}),[g,y,w,N]=uC({sourceX:e,sourceY:t,targetX:s,targetY:i,sourceControlX:u,sourceControlY:h,targetControlX:p,targetControlY:f});return[`M${e},${t} C${u},${h} ${p},${f} ${s},${i}`,g,y,w,N]}const yu=S.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,sourcePosition:i=Pe.Bottom,targetPosition:a=Pe.Top,label:l,labelStyle:u,labelShowBg:h,labelBgStyle:p,labelBgPadding:f,labelBgBorderRadius:g,style:y,markerEnd:w,markerStart:N,pathOptions:b,interactionWidth:_})=>{const[k,E,j]=fC({sourceX:e,sourceY:t,sourcePosition:i,targetX:n,targetY:s,targetPosition:a,curvature:b==null?void 0:b.curvature});return ue.createElement(ml,{path:k,labelX:E,labelY:j,label:l,labelStyle:u,labelShowBg:h,labelBgStyle:p,labelBgPadding:f,labelBgBorderRadius:g,style:y,markerEnd:w,markerStart:N,interactionWidth:_})});yu.displayName="BezierEdge";const hw=S.createContext(null),XO=hw.Provider;hw.Consumer;const QO=()=>S.useContext(hw),ZO=e=>"id"in e&&"source"in e&&"target"in e,JO=({source:e,sourceHandle:t,target:n,targetHandle:s})=>`reactflow__edge-${e}${t||""}-${n}${s||""}`,Ay=(e,t)=>typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(s=>`${s}=${e[s]}`).join("&")}`,eP=(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)),tP=(e,t)=>{if(!e.source||!e.target)return t;let n;return ZO(e)?n={...e}:n={...e,id:JO(e)},eP(n,t)?t:t.concat(n)},My=({x:e,y:t},[n,s,i],a,[l,u])=>{const h={x:(e-n)/i,y:(t-s)/i};return a?{x:l*Math.round(h.x/l),y:u*Math.round(h.y/u)}:h},hC=({x:e,y:t},[n,s,i])=>({x:e*i+n,y:t*i+s}),xo=(e,t=[0,0])=>{if(!e)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const n=(e.width??0)*t[0],s=(e.height??0)*t[1],i={x:e.position.x-n,y:e.position.y-s};return{...i,positionAbsolute:e.positionAbsolute?{x:e.positionAbsolute.x-n,y:e.positionAbsolute.y-s}:i}},Ou=(e,t=[0,0])=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((s,i)=>{const{x:a,y:l}=xo(i,t).positionAbsolute;return oC(s,ol({x:a,y:l,width:i.width||0,height:i.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return iC(n)},pC=(e,t,[n,s,i]=[0,0,1],a=!1,l=!1,u=[0,0])=>{const h={x:(t.x-n)/i,y:(t.y-s)/i,width:t.width/i,height:t.height/i},p=[];return e.forEach(f=>{const{width:g,height:y,selectable:w=!0,hidden:N=!1}=f;if(l&&!w||N)return!1;const{positionAbsolute:b}=xo(f,u),_={x:b.x,y:b.y,width:g||0,height:y||0},k=Cy(h,_),E=typeof g>"u"||typeof y>"u"||g===null||y===null,j=a&&k>0,C=(g||0)*(y||0);(E||j||k>=C||f.dragging)&&p.push(f)}),p},mC=(e,t)=>{const n=e.map(s=>s.id);return t.filter(s=>n.includes(s.source)||n.includes(s.target))},gC=(e,t,n,s,i,a=.1)=>{const l=t/(e.width*(1+a)),u=n/(e.height*(1+a)),h=Math.min(l,u),p=qi(h,s,i),f=e.x+e.width/2,g=e.y+e.height/2,y=t/2-f*p,w=n/2-g*p;return{x:y,y:w,zoom:p}},po=(e,t=0)=>e.transition().duration(t);function Rb(e,t,n,s){return(t[n]||[]).reduce((i,a)=>{var l,u;return`${e.id}-${a.id}-${n}`!==s&&i.push({id:a.id||null,type:n,nodeId:e.id,x:(((l=e.positionAbsolute)==null?void 0:l.x)??0)+a.x+a.width/2,y:(((u=e.positionAbsolute)==null?void 0:u.y)??0)+a.y+a.height/2}),i},[])}function nP(e,t,n,s,i,a){const{x:l,y:u}=As(e),p=t.elementsFromPoint(l,u).find(N=>N.classList.contains("react-flow__handle"));if(p){const N=p.getAttribute("data-nodeid");if(N){const b=pw(void 0,p),_=p.getAttribute("data-handleid"),k=a({nodeId:N,id:_,type:b});if(k){const E=i.find(j=>j.nodeId===N&&j.type===b&&j.id===_);return{handle:{id:_,type:b,nodeId:N,x:(E==null?void 0:E.x)||n.x,y:(E==null?void 0:E.y)||n.y},validHandleResult:k}}}}let f=[],g=1/0;if(i.forEach(N=>{const b=Math.sqrt((N.x-n.x)**2+(N.y-n.y)**2);if(b<=s){const _=a(N);b<=g&&(b<g?f=[{handle:N,validHandleResult:_}]:b===g&&f.push({handle:N,validHandleResult:_}),g=b)}}),!f.length)return{handle:null,validHandleResult:vC()};if(f.length===1)return f[0];const y=f.some(({validHandleResult:N})=>N.isValid),w=f.some(({handle:N})=>N.type==="target");return f.find(({handle:N,validHandleResult:b})=>w?N.type==="target":y?b.isValid:!0)||f[0]}const rP={source:null,target:null,sourceHandle:null,targetHandle:null},vC=()=>({handleDomNode:null,isValid:!1,connection:rP,endHandle:null});function yC(e,t,n,s,i,a,l){const u=i==="target",h=l.querySelector(`.react-flow__handle[data-id="${e==null?void 0:e.nodeId}-${e==null?void 0:e.id}-${e==null?void 0:e.type}"]`),p={...vC(),handleDomNode:h};if(h){const f=pw(void 0,h),g=h.getAttribute("data-nodeid"),y=h.getAttribute("data-handleid"),w=h.classList.contains("connectable"),N=h.classList.contains("connectableend"),b={source:u?g:n,sourceHandle:u?y:s,target:u?n:g,targetHandle:u?s:y};p.connection=b,w&&N&&(t===_o.Strict?u&&f==="source"||!u&&f==="target":g!==n||y!==s)&&(p.endHandle={nodeId:g,handleId:y,type:f},p.isValid=a(b))}return p}function sP({nodes:e,nodeId:t,handleId:n,handleType:s}){return e.reduce((i,a)=>{if(a[Nt]){const{handleBounds:l}=a[Nt];let u=[],h=[];l&&(u=Rb(a,l,"source",`${t}-${n}-${s}`),h=Rb(a,l,"target",`${t}-${n}-${s}`)),i.push(...u,...h)}return i},[])}function pw(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function Uf(e){e==null||e.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function oP(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}function wC({event:e,handleId:t,nodeId:n,onConnect:s,isTarget:i,getState:a,setState:l,isValidConnection:u,edgeUpdaterType:h,onReconnectEnd:p}){const f=sC(e.target),{connectionMode:g,domNode:y,autoPanOnConnect:w,connectionRadius:N,onConnectStart:b,panBy:_,getNodes:k,cancelConnection:E}=a();let j=0,C;const{x:I,y:P}=As(e),O=f==null?void 0:f.elementFromPoint(I,P),F=pw(h,O),M=y==null?void 0:y.getBoundingClientRect();if(!M||!F)return;let A,q=As(e,M),W=!1,K=null,T=!1,Z=null;const U=sP({nodes:k(),nodeId:n,handleId:t,handleType:F}),re=()=>{if(!w)return;const[te,$]=rC(q,M);_({x:te,y:$}),j=requestAnimationFrame(re)};l({connectionPosition:q,connectionStatus:null,connectionNodeId:n,connectionHandleId:t,connectionHandleType:F,connectionStartHandle:{nodeId:n,handleId:t,type:F},connectionEndHandle:null}),b==null||b(e,{nodeId:n,handleId:t,handleType:F});function Q(te){const{transform:$}=a();q=As(te,M);const{handle:V,validHandleResult:J}=nP(te,f,My(q,$,!1,[1,1]),N,U,D=>yC(D,g,n,t,i?"target":"source",u,f));if(C=V,W||(re(),W=!0),Z=J.handleDomNode,K=J.connection,T=J.isValid,l({connectionPosition:C&&T?hC({x:C.x,y:C.y},$):q,connectionStatus:oP(!!C,T),connectionEndHandle:J.endHandle}),!C&&!T&&!Z)return Uf(A);K.source!==K.target&&Z&&(Uf(A),A=Z,Z.classList.add("connecting","react-flow__handle-connecting"),Z.classList.toggle("valid",T),Z.classList.toggle("react-flow__handle-valid",T))}function H(te){var $,V;(C||Z)&&K&&T&&(s==null||s(K)),(V=($=a()).onConnectEnd)==null||V.call($,te),h&&(p==null||p(te)),Uf(A),E(),cancelAnimationFrame(j),W=!1,T=!1,K=null,Z=null,f.removeEventListener("mousemove",Q),f.removeEventListener("mouseup",H),f.removeEventListener("touchmove",Q),f.removeEventListener("touchend",H)}f.addEventListener("mousemove",Q),f.addEventListener("mouseup",H),f.addEventListener("touchmove",Q),f.addEventListener("touchend",H)}const Ab=()=>!0,iP=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),aP=(e,t,n)=>s=>{const{connectionStartHandle:i,connectionEndHandle:a,connectionClickStartHandle:l}=s;return{connecting:(i==null?void 0:i.nodeId)===e&&(i==null?void 0:i.handleId)===t&&(i==null?void 0:i.type)===n||(a==null?void 0:a.nodeId)===e&&(a==null?void 0:a.handleId)===t&&(a==null?void 0:a.type)===n,clickConnecting:(l==null?void 0:l.nodeId)===e&&(l==null?void 0:l.handleId)===t&&(l==null?void 0:l.type)===n}},xC=S.forwardRef(({type:e="source",position:t=Pe.Top,isValidConnection:n,isConnectable:s=!0,isConnectableStart:i=!0,isConnectableEnd:a=!0,id:l,onConnect:u,children:h,className:p,onMouseDown:f,onTouchStart:g,...y},w)=>{var M,A;const N=l||null,b=e==="target",_=Rt(),k=QO(),{connectOnClick:E,noPanClassName:j}=it(iP,$t),{connecting:C,clickConnecting:I}=it(aP(k,N,e),$t);k||(A=(M=_.getState()).onError)==null||A.call(M,"010",Qr.error010());const P=q=>{const{defaultEdgeOptions:W,onConnect:K,hasDefaultEdges:T}=_.getState(),Z={...W,...q};if(T){const{edges:U,setEdges:re}=_.getState();re(tP(Z,U))}K==null||K(Z),u==null||u(Z)},O=q=>{if(!k)return;const W=lC(q);i&&(W&&q.button===0||!W)&&wC({event:q,handleId:N,nodeId:k,onConnect:P,isTarget:b,getState:_.getState,setState:_.setState,isValidConnection:n||_.getState().isValidConnection||Ab}),W?f==null||f(q):g==null||g(q)},F=q=>{const{onClickConnectStart:W,onClickConnectEnd:K,connectionClickStartHandle:T,connectionMode:Z,isValidConnection:U}=_.getState();if(!k||!T&&!i)return;if(!T){W==null||W(q,{nodeId:k,handleId:N,handleType:e}),_.setState({connectionClickStartHandle:{nodeId:k,type:e,handleId:N}});return}const re=sC(q.target),Q=n||U||Ab,{connection:H,isValid:te}=yC({nodeId:k,id:N,type:e},Z,T.nodeId,T.handleId||null,T.type,Q,re);te&&P(H),K==null||K(q),_.setState({connectionClickStartHandle:null})};return ue.createElement("div",{"data-handleid":N,"data-nodeid":k,"data-handlepos":t,"data-id":`${k}-${N}-${e}`,className:Ht(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",j,p,{source:!b,target:b,connectable:s,connectablestart:i,connectableend:a,connecting:I,connectionindicator:s&&(i&&!C||a&&C)}]),onMouseDown:O,onTouchStart:O,onClick:E?F:void 0,ref:w,...y},h)});xC.displayName="Handle";var Di=S.memo(xC);const bC=({data:e,isConnectable:t,targetPosition:n=Pe.Top,sourcePosition:s=Pe.Bottom})=>ue.createElement(ue.Fragment,null,ue.createElement(Di,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,ue.createElement(Di,{type:"source",position:s,isConnectable:t}));bC.displayName="DefaultNode";var Iy=S.memo(bC);const _C=({data:e,isConnectable:t,sourcePosition:n=Pe.Bottom})=>ue.createElement(ue.Fragment,null,e==null?void 0:e.label,ue.createElement(Di,{type:"source",position:n,isConnectable:t}));_C.displayName="InputNode";var kC=S.memo(_C);const SC=({data:e,isConnectable:t,targetPosition:n=Pe.Top})=>ue.createElement(ue.Fragment,null,ue.createElement(Di,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label);SC.displayName="OutputNode";var NC=S.memo(SC);const mw=()=>null;mw.displayName="GroupNode";const lP=e=>({selectedNodes:e.getNodes().filter(t=>t.selected),selectedEdges:e.edges.filter(t=>t.selected).map(t=>({...t}))}),Hc=e=>e.id;function cP(e,t){return $t(e.selectedNodes.map(Hc),t.selectedNodes.map(Hc))&&$t(e.selectedEdges.map(Hc),t.selectedEdges.map(Hc))}const EC=S.memo(({onSelectionChange:e})=>{const t=Rt(),{selectedNodes:n,selectedEdges:s}=it(lP,cP);return S.useEffect(()=>{const i={nodes:n,edges:s};e==null||e(i),t.getState().onSelectionChange.forEach(a=>a(i))},[n,s,e]),null});EC.displayName="SelectionListener";const uP=e=>!!e.onSelectionChange;function dP({onSelectionChange:e}){const t=it(uP);return e||t?ue.createElement(EC,{onSelectionChange:e}):null}const fP=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 wi(e,t){S.useEffect(()=>{typeof e<"u"&&t(e)},[e])}function Xe(e,t,n){S.useEffect(()=>{typeof t<"u"&&n({[e]:t})},[t])}const hP=({nodes:e,edges:t,defaultNodes:n,defaultEdges:s,onConnect:i,onConnectStart:a,onConnectEnd:l,onClickConnectStart:u,onClickConnectEnd:h,nodesDraggable:p,nodesConnectable:f,nodesFocusable:g,edgesFocusable:y,edgesUpdatable:w,elevateNodesOnSelect:N,minZoom:b,maxZoom:_,nodeExtent:k,onNodesChange:E,onEdgesChange:j,elementsSelectable:C,connectionMode:I,snapGrid:P,snapToGrid:O,translateExtent:F,connectOnClick:M,defaultEdgeOptions:A,fitView:q,fitViewOptions:W,onNodesDelete:K,onEdgesDelete:T,onNodeDrag:Z,onNodeDragStart:U,onNodeDragStop:re,onSelectionDrag:Q,onSelectionDragStart:H,onSelectionDragStop:te,noPanClassName:$,nodeOrigin:V,rfId:J,autoPanOnConnect:D,autoPanOnNodeDrag:L,onError:X,connectionRadius:se,isValidConnection:fe,nodeDragThreshold:pe})=>{const{setNodes:xe,setEdges:je,setDefaultNodesAndEdges:He,setMinZoom:De,setMaxZoom:Me,setTranslateExtent:_e,setNodeExtent:G,reset:he}=it(fP,$t),ve=Rt();return S.useEffect(()=>{const We=s==null?void 0:s.map(at=>({...at,...A}));return He(n,We),()=>{he()}},[]),Xe("defaultEdgeOptions",A,ve.setState),Xe("connectionMode",I,ve.setState),Xe("onConnect",i,ve.setState),Xe("onConnectStart",a,ve.setState),Xe("onConnectEnd",l,ve.setState),Xe("onClickConnectStart",u,ve.setState),Xe("onClickConnectEnd",h,ve.setState),Xe("nodesDraggable",p,ve.setState),Xe("nodesConnectable",f,ve.setState),Xe("nodesFocusable",g,ve.setState),Xe("edgesFocusable",y,ve.setState),Xe("edgesUpdatable",w,ve.setState),Xe("elementsSelectable",C,ve.setState),Xe("elevateNodesOnSelect",N,ve.setState),Xe("snapToGrid",O,ve.setState),Xe("snapGrid",P,ve.setState),Xe("onNodesChange",E,ve.setState),Xe("onEdgesChange",j,ve.setState),Xe("connectOnClick",M,ve.setState),Xe("fitViewOnInit",q,ve.setState),Xe("fitViewOnInitOptions",W,ve.setState),Xe("onNodesDelete",K,ve.setState),Xe("onEdgesDelete",T,ve.setState),Xe("onNodeDrag",Z,ve.setState),Xe("onNodeDragStart",U,ve.setState),Xe("onNodeDragStop",re,ve.setState),Xe("onSelectionDrag",Q,ve.setState),Xe("onSelectionDragStart",H,ve.setState),Xe("onSelectionDragStop",te,ve.setState),Xe("noPanClassName",$,ve.setState),Xe("nodeOrigin",V,ve.setState),Xe("rfId",J,ve.setState),Xe("autoPanOnConnect",D,ve.setState),Xe("autoPanOnNodeDrag",L,ve.setState),Xe("onError",X,ve.setState),Xe("connectionRadius",se,ve.setState),Xe("isValidConnection",fe,ve.setState),Xe("nodeDragThreshold",pe,ve.setState),wi(e,xe),wi(t,je),wi(b,De),wi(_,Me),wi(F,_e),wi(k,G),null},Mb={display:"none"},pP={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},jC="react-flow__node-desc",CC="react-flow__edge-desc",mP="react-flow__aria-live",gP=e=>e.ariaLiveMessage;function vP({rfId:e}){const t=it(gP);return ue.createElement("div",{id:`${mP}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:pP},t)}function yP({rfId:e,disableKeyboardA11y:t}){return ue.createElement(ue.Fragment,null,ue.createElement("div",{id:`${jC}-${e}`,style:Mb},"Press enter or space to select a node.",!t&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "),ue.createElement("div",{id:`${CC}-${e}`,style:Mb},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!t&&ue.createElement(vP,{rfId:e}))}var al=(e=null,t={actInsideInputWithModifier:!0})=>{const[n,s]=S.useState(!1),i=S.useRef(!1),a=S.useRef(new Set([])),[l,u]=S.useMemo(()=>{if(e!==null){const p=(Array.isArray(e)?e:[e]).filter(g=>typeof g=="string").map(g=>g.split("+")),f=p.reduce((g,y)=>g.concat(...y),[]);return[p,f]}return[[],[]]},[e]);return S.useEffect(()=>{const h=typeof document<"u"?document:null,p=(t==null?void 0:t.target)||h;if(e!==null){const f=w=>{if(i.current=w.ctrlKey||w.metaKey||w.shiftKey,(!i.current||i.current&&!t.actInsideInputWithModifier)&&Ty(w))return!1;const b=Ob(w.code,u);a.current.add(w[b]),Ib(l,a.current,!1)&&(w.preventDefault(),s(!0))},g=w=>{if((!i.current||i.current&&!t.actInsideInputWithModifier)&&Ty(w))return!1;const b=Ob(w.code,u);Ib(l,a.current,!0)?(s(!1),a.current.clear()):a.current.delete(w[b]),w.key==="Meta"&&a.current.clear(),i.current=!1},y=()=>{a.current.clear(),s(!1)};return p==null||p.addEventListener("keydown",f),p==null||p.addEventListener("keyup",g),window.addEventListener("blur",y),()=>{p==null||p.removeEventListener("keydown",f),p==null||p.removeEventListener("keyup",g),window.removeEventListener("blur",y)}}},[e,s]),n};function Ib(e,t,n){return e.filter(s=>n||s.length===t.size).some(s=>s.every(i=>t.has(i)))}function Ob(e,t){return t.includes(e)?"code":"key"}function TC(e,t,n,s){var u,h;const i=e.parentNode||e.parentId;if(!i)return n;const a=t.get(i),l=xo(a,s);return TC(a,t,{x:(n.x??0)+l.x,y:(n.y??0)+l.y,z:(((u=a[Nt])==null?void 0:u.z)??0)>(n.z??0)?((h=a[Nt])==null?void 0:h.z)??0:n.z??0},s)}function RC(e,t,n){e.forEach(s=>{var a;const i=s.parentNode||s.parentId;if(i&&!e.has(i))throw new Error(`Parent node ${i} not found`);if(i||n!=null&&n[s.id]){const{x:l,y:u,z:h}=TC(s,e,{...s.position,z:((a=s[Nt])==null?void 0:a.z)??0},t);s.positionAbsolute={x:l,y:u},s[Nt].z=h,n!=null&&n[s.id]&&(s[Nt].isParent=!0)}})}function Wf(e,t,n,s){const i=new Map,a={},l=s?1e3:0;return e.forEach(u=>{var w;const h=(qn(u.zIndex)?u.zIndex:0)+(u.selected?l:0),p=t.get(u.id),f={...u,positionAbsolute:{x:u.position.x,y:u.position.y}},g=u.parentNode||u.parentId;g&&(a[g]=!0);const y=(p==null?void 0:p.type)&&(p==null?void 0:p.type)!==u.type;Object.defineProperty(f,Nt,{enumerable:!1,value:{handleBounds:y||(w=p==null?void 0:p[Nt])==null?void 0:w.handleBounds,z:h}}),i.set(u.id,f)}),RC(i,n,a),i}function AC(e,t={}){const{getNodes:n,width:s,height:i,minZoom:a,maxZoom:l,d3Zoom:u,d3Selection:h,fitViewOnInitDone:p,fitViewOnInit:f,nodeOrigin:g}=e(),y=t.initial&&!p&&f;if(u&&h&&(y||!t.initial)){const N=n().filter(_=>{var E;const k=t.includeHiddenNodes?_.width&&_.height:!_.hidden;return(E=t.nodes)!=null&&E.length?k&&t.nodes.some(j=>j.id===_.id):k}),b=N.every(_=>_.width&&_.height);if(N.length>0&&b){const _=Ou(N,g),{x:k,y:E,zoom:j}=gC(_,s,i,t.minZoom??a,t.maxZoom??l,t.padding??.1),C=Kr.translate(k,E).scale(j);return typeof t.duration=="number"&&t.duration>0?u.transform(po(h,t.duration),C):u.transform(h,C),!0}}return!1}function wP(e,t){return e.forEach(n=>{const s=t.get(n.id);s&&t.set(s.id,{...s,[Nt]:s[Nt],selected:n.selected})}),new Map(t)}function xP(e,t){return t.map(n=>{const s=e.find(i=>i.id===n.id);return s&&(n.selected=s.selected),n})}function Gc({changedNodes:e,changedEdges:t,get:n,set:s}){const{nodeInternals:i,edges:a,onNodesChange:l,onEdgesChange:u,hasDefaultNodes:h,hasDefaultEdges:p}=n();e!=null&&e.length&&(h&&s({nodeInternals:wP(e,i)}),l==null||l(e)),t!=null&&t.length&&(p&&s({edges:xP(t,a)}),u==null||u(t))}const xi=()=>{},bP={zoomIn:xi,zoomOut:xi,zoomTo:xi,getZoom:()=>1,setViewport:xi,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:xi,fitBounds:xi,project:e=>e,screenToFlowPosition:e=>e,flowToScreenPosition:e=>e,viewportInitialized:!1},_P=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),kP=()=>{const e=Rt(),{d3Zoom:t,d3Selection:n}=it(_P,$t);return S.useMemo(()=>n&&t?{zoomIn:i=>t.scaleBy(po(n,i==null?void 0:i.duration),1.2),zoomOut:i=>t.scaleBy(po(n,i==null?void 0:i.duration),1/1.2),zoomTo:(i,a)=>t.scaleTo(po(n,a==null?void 0:a.duration),i),getZoom:()=>e.getState().transform[2],setViewport:(i,a)=>{const[l,u,h]=e.getState().transform,p=Kr.translate(i.x??l,i.y??u).scale(i.zoom??h);t.transform(po(n,a==null?void 0:a.duration),p)},getViewport:()=>{const[i,a,l]=e.getState().transform;return{x:i,y:a,zoom:l}},fitView:i=>AC(e.getState,i),setCenter:(i,a,l)=>{const{width:u,height:h,maxZoom:p}=e.getState(),f=typeof(l==null?void 0:l.zoom)<"u"?l.zoom:p,g=u/2-i*f,y=h/2-a*f,w=Kr.translate(g,y).scale(f);t.transform(po(n,l==null?void 0:l.duration),w)},fitBounds:(i,a)=>{const{width:l,height:u,minZoom:h,maxZoom:p}=e.getState(),{x:f,y:g,zoom:y}=gC(i,l,u,h,p,(a==null?void 0:a.padding)??.1),w=Kr.translate(f,g).scale(y);t.transform(po(n,a==null?void 0:a.duration),w)},project:i=>{const{transform:a,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"),My(i,a,l,u)},screenToFlowPosition:i=>{const{transform:a,snapToGrid:l,snapGrid:u,domNode:h}=e.getState();if(!h)return i;const{x:p,y:f}=h.getBoundingClientRect(),g={x:i.x-p,y:i.y-f};return My(g,a,l,u)},flowToScreenPosition:i=>{const{transform:a,domNode:l}=e.getState();if(!l)return i;const{x:u,y:h}=l.getBoundingClientRect(),p=hC(i,a);return{x:p.x+u,y:p.y+h}},viewportInitialized:!0}:bP,[t,n])};function gl(){const e=kP(),t=Rt(),n=S.useCallback(()=>t.getState().getNodes().map(b=>({...b})),[]),s=S.useCallback(b=>t.getState().nodeInternals.get(b),[]),i=S.useCallback(()=>{const{edges:b=[]}=t.getState();return b.map(_=>({..._}))},[]),a=S.useCallback(b=>{const{edges:_=[]}=t.getState();return _.find(k=>k.id===b)},[]),l=S.useCallback(b=>{const{getNodes:_,setNodes:k,hasDefaultNodes:E,onNodesChange:j}=t.getState(),C=_(),I=typeof b=="function"?b(C):b;if(E)k(I);else if(j){const P=I.length===0?C.map(O=>({type:"remove",id:O.id})):I.map(O=>({item:O,type:"reset"}));j(P)}},[]),u=S.useCallback(b=>{const{edges:_=[],setEdges:k,hasDefaultEdges:E,onEdgesChange:j}=t.getState(),C=typeof b=="function"?b(_):b;if(E)k(C);else if(j){const I=C.length===0?_.map(P=>({type:"remove",id:P.id})):C.map(P=>({item:P,type:"reset"}));j(I)}},[]),h=S.useCallback(b=>{const _=Array.isArray(b)?b:[b],{getNodes:k,setNodes:E,hasDefaultNodes:j,onNodesChange:C}=t.getState();if(j){const P=[...k(),..._];E(P)}else if(C){const I=_.map(P=>({item:P,type:"add"}));C(I)}},[]),p=S.useCallback(b=>{const _=Array.isArray(b)?b:[b],{edges:k=[],setEdges:E,hasDefaultEdges:j,onEdgesChange:C}=t.getState();if(j)E([...k,..._]);else if(C){const I=_.map(P=>({item:P,type:"add"}));C(I)}},[]),f=S.useCallback(()=>{const{getNodes:b,edges:_=[],transform:k}=t.getState(),[E,j,C]=k;return{nodes:b().map(I=>({...I})),edges:_.map(I=>({...I})),viewport:{x:E,y:j,zoom:C}}},[]),g=S.useCallback(({nodes:b,edges:_})=>{const{nodeInternals:k,getNodes:E,edges:j,hasDefaultNodes:C,hasDefaultEdges:I,onNodesDelete:P,onEdgesDelete:O,onNodesChange:F,onEdgesChange:M}=t.getState(),A=(b||[]).map(Z=>Z.id),q=(_||[]).map(Z=>Z.id),W=E().reduce((Z,U)=>{const re=U.parentNode||U.parentId,Q=!A.includes(U.id)&&re&&Z.find(te=>te.id===re);return(typeof U.deletable=="boolean"?U.deletable:!0)&&(A.includes(U.id)||Q)&&Z.push(U),Z},[]),K=j.filter(Z=>typeof Z.deletable=="boolean"?Z.deletable:!0),T=K.filter(Z=>q.includes(Z.id));if(W||T){const Z=mC(W,K),U=[...T,...Z],re=U.reduce((Q,H)=>(Q.includes(H.id)||Q.push(H.id),Q),[]);if((I||C)&&(I&&t.setState({edges:j.filter(Q=>!re.includes(Q.id))}),C&&(W.forEach(Q=>{k.delete(Q.id)}),t.setState({nodeInternals:new Map(k)}))),re.length>0&&(O==null||O(U),M&&M(re.map(Q=>({id:Q,type:"remove"})))),W.length>0&&(P==null||P(W),F)){const Q=W.map(H=>({id:H.id,type:"remove"}));F(Q)}}},[]),y=S.useCallback(b=>{const _=UO(b),k=_?null:t.getState().nodeInternals.get(b.id);return!_&&!k?[null,null,_]:[_?b:Nb(k),k,_]},[]),w=S.useCallback((b,_=!0,k)=>{const[E,j,C]=y(b);return E?(k||t.getState().getNodes()).filter(I=>{if(!C&&(I.id===j.id||!I.positionAbsolute))return!1;const P=Nb(I),O=Cy(P,E);return _&&O>0||O>=E.width*E.height}):[]},[]),N=S.useCallback((b,_,k=!0)=>{const[E]=y(b);if(!E)return!1;const j=Cy(E,_);return k&&j>0||j>=E.width*E.height},[]);return S.useMemo(()=>({...e,getNodes:n,getNode:s,getEdges:i,getEdge:a,setNodes:l,setEdges:u,addNodes:h,addEdges:p,toObject:f,deleteElements:g,getIntersectingNodes:w,isNodeIntersecting:N}),[e,n,s,i,a,l,u,h,p,f,g,w,N])}const SP={actInsideInputWithModifier:!1};var NP=({deleteKeyCode:e,multiSelectionKeyCode:t})=>{const n=Rt(),{deleteElements:s}=gl(),i=al(e,SP),a=al(t);S.useEffect(()=>{if(i){const{edges:l,getNodes:u}=n.getState(),h=u().filter(f=>f.selected),p=l.filter(f=>f.selected);s({nodes:h,edges:p}),n.setState({nodesSelectionActive:!1})}},[i]),S.useEffect(()=>{n.setState({multiSelectionActive:a})},[a])};function EP(e){const t=Rt();S.useEffect(()=>{let n;const s=()=>{var a,l;if(!e.current)return;const i=lw(e.current);(i.height===0||i.width===0)&&((l=(a=t.getState()).onError)==null||l.call(a,"004",Qr.error004())),t.setState({width:i.width||500,height:i.height||500})};return s(),window.addEventListener("resize",s),e.current&&(n=new ResizeObserver(()=>s()),n.observe(e.current)),()=>{window.removeEventListener("resize",s),n&&e.current&&n.unobserve(e.current)}},[])}const gw={position:"absolute",width:"100%",height:"100%",top:0,left:0},jP=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,Vc=e=>({x:e.x,y:e.y,zoom:e.k}),bi=(e,t)=>e.target.closest(`.${t}`),Pb=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),$b=e=>{const t=e.ctrlKey&&gu()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t},CP=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),TP=({onMove:e,onMoveStart:t,onMoveEnd:n,onPaneContextMenu:s,zoomOnScroll:i=!0,zoomOnPinch:a=!0,panOnScroll:l=!1,panOnScrollSpeed:u=.5,panOnScrollMode:h=yo.Free,zoomOnDoubleClick:p=!0,elementsSelectable:f,panOnDrag:g=!0,defaultViewport:y,translateExtent:w,minZoom:N,maxZoom:b,zoomActivationKeyCode:_,preventScrolling:k=!0,children:E,noWheelClassName:j,noPanClassName:C})=>{const I=S.useRef(),P=Rt(),O=S.useRef(!1),F=S.useRef(!1),M=S.useRef(null),A=S.useRef({x:0,y:0,zoom:0}),{d3Zoom:q,d3Selection:W,d3ZoomHandler:K,userSelectionActive:T}=it(CP,$t),Z=al(_),U=S.useRef(0),re=S.useRef(!1),Q=S.useRef();return EP(M),S.useEffect(()=>{if(M.current){const H=M.current.getBoundingClientRect(),te=tC().scaleExtent([N,b]).translateExtent(w),$=Ln(M.current).call(te),V=Kr.translate(y.x,y.y).scale(qi(y.zoom,N,b)),J=[[0,0],[H.width,H.height]],D=te.constrain()(V,J,w);te.transform($,D),te.wheelDelta($b),P.setState({d3Zoom:te,d3Selection:$,d3ZoomHandler:$.on("wheel.zoom"),transform:[D.x,D.y,D.k],domNode:M.current.closest(".react-flow")})}},[]),S.useEffect(()=>{W&&q&&(l&&!Z&&!T?W.on("wheel.zoom",H=>{if(bi(H,j))return!1;H.preventDefault(),H.stopImmediatePropagation();const te=W.property("__zoom").k||1;if(H.ctrlKey&&a){const fe=sr(H),pe=$b(H),xe=te*Math.pow(2,pe);q.scaleTo(W,xe,fe,H);return}const $=H.deltaMode===1?20:1;let V=h===yo.Vertical?0:H.deltaX*$,J=h===yo.Horizontal?0:H.deltaY*$;!gu()&&H.shiftKey&&h!==yo.Vertical&&(V=H.deltaY*$,J=0),q.translateBy(W,-(V/te)*u,-(J/te)*u,{internal:!0});const D=Vc(W.property("__zoom")),{onViewportChangeStart:L,onViewportChange:X,onViewportChangeEnd:se}=P.getState();clearTimeout(Q.current),re.current||(re.current=!0,t==null||t(H,D),L==null||L(D)),re.current&&(e==null||e(H,D),X==null||X(D),Q.current=setTimeout(()=>{n==null||n(H,D),se==null||se(D),re.current=!1},150))},{passive:!1}):typeof K<"u"&&W.on("wheel.zoom",function(H,te){if(!k&&H.type==="wheel"&&!H.ctrlKey||bi(H,j))return null;H.preventDefault(),K.call(this,H,te)},{passive:!1}))},[T,l,h,W,q,K,Z,a,k,j,t,e,n]),S.useEffect(()=>{q&&q.on("start",H=>{var V,J;if(!H.sourceEvent||H.sourceEvent.internal)return null;U.current=(V=H.sourceEvent)==null?void 0:V.button;const{onViewportChangeStart:te}=P.getState(),$=Vc(H.transform);O.current=!0,A.current=$,((J=H.sourceEvent)==null?void 0:J.type)==="mousedown"&&P.setState({paneDragging:!0}),te==null||te($),t==null||t(H.sourceEvent,$)})},[q,t]),S.useEffect(()=>{q&&(T&&!O.current?q.on("zoom",null):T||q.on("zoom",H=>{var $;const{onViewportChange:te}=P.getState();if(P.setState({transform:[H.transform.x,H.transform.y,H.transform.k]}),F.current=!!(s&&Pb(g,U.current??0)),(e||te)&&!(($=H.sourceEvent)!=null&&$.internal)){const V=Vc(H.transform);te==null||te(V),e==null||e(H.sourceEvent,V)}}))},[T,q,e,g,s]),S.useEffect(()=>{q&&q.on("end",H=>{if(!H.sourceEvent||H.sourceEvent.internal)return null;const{onViewportChangeEnd:te}=P.getState();if(O.current=!1,P.setState({paneDragging:!1}),s&&Pb(g,U.current??0)&&!F.current&&s(H.sourceEvent),F.current=!1,(n||te)&&jP(A.current,H.transform)){const $=Vc(H.transform);A.current=$,clearTimeout(I.current),I.current=setTimeout(()=>{te==null||te($),n==null||n(H.sourceEvent,$)},l?150:0)}})},[q,l,g,n,s]),S.useEffect(()=>{q&&q.filter(H=>{const te=Z||i,$=a&&H.ctrlKey;if((g===!0||Array.isArray(g)&&g.includes(1))&&H.button===1&&H.type==="mousedown"&&(bi(H,"react-flow__node")||bi(H,"react-flow__edge")))return!0;if(!g&&!te&&!l&&!p&&!a||T||!p&&H.type==="dblclick"||bi(H,j)&&H.type==="wheel"||bi(H,C)&&(H.type!=="wheel"||l&&H.type==="wheel"&&!Z)||!a&&H.ctrlKey&&H.type==="wheel"||!te&&!l&&!$&&H.type==="wheel"||!g&&(H.type==="mousedown"||H.type==="touchstart")||Array.isArray(g)&&!g.includes(H.button)&&H.type==="mousedown")return!1;const V=Array.isArray(g)&&g.includes(H.button)||!H.button||H.button<=1;return(!H.ctrlKey||H.type==="wheel")&&V})},[T,q,i,a,l,p,g,f,Z]),ue.createElement("div",{className:"react-flow__renderer",ref:M,style:gw},E)},RP=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function AP(){const{userSelectionActive:e,userSelectionRect:t}=it(RP,$t);return e&&t?ue.createElement("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}function Lb(e,t){const n=t.parentNode||t.parentId,s=e.find(i=>i.id===n);if(s){const i=t.position.x+t.width-s.width,a=t.position.y+t.height-s.height;if(i>0||a>0||t.position.x<0||t.position.y<0){if(s.style={...s.style},s.style.width=s.style.width??s.width,s.style.height=s.style.height??s.height,i>0&&(s.style.width+=i),a>0&&(s.style.height+=a),t.position.x<0){const l=Math.abs(t.position.x);s.position.x=s.position.x-l,s.style.width+=l,t.position.x=0}if(t.position.y<0){const l=Math.abs(t.position.y);s.position.y=s.position.y-l,s.style.height+=l,t.position.y=0}s.width=s.style.width,s.height=s.style.height}}}function MP(e,t){if(e.some(s=>s.type==="reset"))return e.filter(s=>s.type==="reset").map(s=>s.item);const n=e.filter(s=>s.type==="add").map(s=>s.item);return t.reduce((s,i)=>{const a=e.filter(u=>u.id===i.id);if(a.length===0)return s.push(i),s;const l={...i};for(const u of a)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&&Lb(s,l);break}case"dimensions":{typeof u.dimensions<"u"&&(l.width=u.dimensions.width,l.height=u.dimensions.height),typeof u.updateStyle<"u"&&(l.style={...l.style||{},...u.dimensions}),typeof u.resizing=="boolean"&&(l.resizing=u.resizing),l.expandParent&&Lb(s,l);break}case"remove":return s}return s.push(l),s},n)}function IP(e,t){return MP(e,t)}const Ts=(e,t)=>({id:e,type:"select",selected:t});function ji(e,t){return e.reduce((n,s)=>{const i=t.includes(s.id);return!s.selected&&i?(s.selected=!0,n.push(Ts(s.id,!0))):s.selected&&!i&&(s.selected=!1,n.push(Ts(s.id,!1))),n},[])}const Hf=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},OP=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),MC=S.memo(({isSelecting:e,selectionMode:t=il.Full,panOnDrag:n,onSelectionStart:s,onSelectionEnd:i,onPaneClick:a,onPaneContextMenu:l,onPaneScroll:u,onPaneMouseEnter:h,onPaneMouseMove:p,onPaneMouseLeave:f,children:g})=>{const y=S.useRef(null),w=Rt(),N=S.useRef(0),b=S.useRef(0),_=S.useRef(),{userSelectionActive:k,elementsSelectable:E,dragging:j}=it(OP,$t),C=()=>{w.setState({userSelectionActive:!1,userSelectionRect:null}),N.current=0,b.current=0},I=K=>{a==null||a(K),w.getState().resetSelectedElements(),w.setState({nodesSelectionActive:!1})},P=K=>{if(Array.isArray(n)&&(n!=null&&n.includes(2))){K.preventDefault();return}l==null||l(K)},O=u?K=>u(K):void 0,F=K=>{const{resetSelectedElements:T,domNode:Z}=w.getState();if(_.current=Z==null?void 0:Z.getBoundingClientRect(),!E||!e||K.button!==0||K.target!==y.current||!_.current)return;const{x:U,y:re}=As(K,_.current);T(),w.setState({userSelectionRect:{width:0,height:0,startX:U,startY:re,x:U,y:re}}),s==null||s(K)},M=K=>{const{userSelectionRect:T,nodeInternals:Z,edges:U,transform:re,onNodesChange:Q,onEdgesChange:H,nodeOrigin:te,getNodes:$}=w.getState();if(!e||!_.current||!T)return;w.setState({userSelectionActive:!0,nodesSelectionActive:!1});const V=As(K,_.current),J=T.startX??0,D=T.startY??0,L={...T,x:V.x<J?V.x:J,y:V.y<D?V.y:D,width:Math.abs(V.x-J),height:Math.abs(V.y-D)},X=$(),se=pC(Z,L,re,t===il.Partial,!0,te),fe=mC(se,U).map(xe=>xe.id),pe=se.map(xe=>xe.id);if(N.current!==pe.length){N.current=pe.length;const xe=ji(X,pe);xe.length&&(Q==null||Q(xe))}if(b.current!==fe.length){b.current=fe.length;const xe=ji(U,fe);xe.length&&(H==null||H(xe))}w.setState({userSelectionRect:L})},A=K=>{if(K.button!==0)return;const{userSelectionRect:T}=w.getState();!k&&T&&K.target===y.current&&(I==null||I(K)),w.setState({nodesSelectionActive:N.current>0}),C(),i==null||i(K)},q=K=>{k&&(w.setState({nodesSelectionActive:N.current>0}),i==null||i(K)),C()},W=E&&(e||k);return ue.createElement("div",{className:Ht(["react-flow__pane",{dragging:j,selection:e}]),onClick:W?void 0:Hf(I,y),onContextMenu:Hf(P,y),onWheel:Hf(O,y),onMouseEnter:W?void 0:h,onMouseDown:W?F:void 0,onMouseMove:W?M:p,onMouseUp:W?A:void 0,onMouseLeave:W?q:f,ref:y,style:gw},g,ue.createElement(AP,null))});MC.displayName="Pane";function IC(e,t){const n=e.parentNode||e.parentId;if(!n)return!1;const s=t.get(n);return s?s.selected?!0:IC(s,t):!1}function qb(e,t,n){let s=e;do{if(s!=null&&s.matches(t))return!0;if(s===n.current)return!1;s=s.parentElement}while(s);return!1}function PP(e,t,n,s){return Array.from(e.values()).filter(i=>(i.selected||i.id===s)&&(!i.parentNode||i.parentId||!IC(i,e))&&(i.draggable||t&&typeof i.draggable>"u")).map(i=>{var a,l;return{id:i.id,position:i.position||{x:0,y:0},positionAbsolute:i.positionAbsolute||{x:0,y:0},distance:{x:n.x-(((a=i.positionAbsolute)==null?void 0:a.x)??0),y:n.y-(((l=i.positionAbsolute)==null?void 0:l.y)??0)},delta:{x:0,y:0},extent:i.extent,parentNode:i.parentNode||i.parentId,parentId:i.parentNode||i.parentId,width:i.width,height:i.height,expandParent:i.expandParent}})}function $P(e,t){return!t||t==="parent"?t:[t[0],[t[1][0]-(e.width||0),t[1][1]-(e.height||0)]]}function OC(e,t,n,s,i=[0,0],a){const l=$P(e,e.extent||s);let u=l;const h=e.parentNode||e.parentId;if(e.extent==="parent"&&!e.expandParent)if(h&&e.width&&e.height){const g=n.get(h),{x:y,y:w}=xo(g,i).positionAbsolute;u=g&&qn(y)&&qn(w)&&qn(g.width)&&qn(g.height)?[[y+e.width*i[0],w+e.height*i[1]],[y+g.width-e.width+e.width*i[0],w+g.height-e.height+e.height*i[1]]]:u}else a==null||a("005",Qr.error005()),u=l;else if(e.extent&&h&&e.extent!=="parent"){const g=n.get(h),{x:y,y:w}=xo(g,i).positionAbsolute;u=[[e.extent[0][0]+y,e.extent[0][1]+w],[e.extent[1][0]+y,e.extent[1][1]+w]]}let p={x:0,y:0};if(h){const g=n.get(h);p=xo(g,i).positionAbsolute}const f=u&&u!=="parent"?cw(t,u):t;return{position:{x:f.x-p.x,y:f.y-p.y},positionAbsolute:f}}function Gf({nodeId:e,dragItems:t,nodeInternals:n}){const s=t.map(i=>({...n.get(i.id),position:i.position,positionAbsolute:i.positionAbsolute}));return[e?s.find(i=>i.id===e):s[0],s]}const Db=(e,t,n,s)=>{const i=t.querySelectorAll(e);if(!i||!i.length)return null;const a=Array.from(i),l=t.getBoundingClientRect(),u={x:l.width*s[0],y:l.height*s[1]};return a.map(h=>{const p=h.getBoundingClientRect();return{id:h.getAttribute("data-handleid"),position:h.getAttribute("data-handlepos"),x:(p.left-l.left-u.x)/n,y:(p.top-l.top-u.y)/n,...lw(h)}})};function za(e,t,n){return n===void 0?n:s=>{const i=t().nodeInternals.get(e);i&&n(s,{...i})}}function Oy({id:e,store:t,unselect:n=!1,nodeRef:s}){const{addSelectedNodes:i,unselectNodesAndEdges:a,multiSelectionActive:l,nodeInternals:u,onError:h}=t.getState(),p=u.get(e);if(!p){h==null||h("012",Qr.error012(e));return}t.setState({nodesSelectionActive:!1}),p.selected?(n||p.selected&&l)&&(a({nodes:[p],edges:[]}),requestAnimationFrame(()=>{var f;return(f=s==null?void 0:s.current)==null?void 0:f.blur()})):i([e])}function LP(){const e=Rt();return S.useCallback(({sourceEvent:n})=>{const{transform:s,snapGrid:i,snapToGrid:a}=e.getState(),l=n.touches?n.touches[0].clientX:n.clientX,u=n.touches?n.touches[0].clientY:n.clientY,h={x:(l-s[0])/s[2],y:(u-s[1])/s[2]};return{xSnapped:a?i[0]*Math.round(h.x/i[0]):h.x,ySnapped:a?i[1]*Math.round(h.y/i[1]):h.y,...h}},[])}function Vf(e){return(t,n,s)=>e==null?void 0:e(t,s)}function PC({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:s,nodeId:i,isSelectable:a,selectNodesOnDrag:l}){const u=Rt(),[h,p]=S.useState(!1),f=S.useRef([]),g=S.useRef({x:null,y:null}),y=S.useRef(0),w=S.useRef(null),N=S.useRef({x:0,y:0}),b=S.useRef(null),_=S.useRef(!1),k=S.useRef(!1),E=S.useRef(!1),j=LP();return S.useEffect(()=>{if(e!=null&&e.current){const C=Ln(e.current),I=({x:F,y:M})=>{const{nodeInternals:A,onNodeDrag:q,onSelectionDrag:W,updateNodePositions:K,nodeExtent:T,snapGrid:Z,snapToGrid:U,nodeOrigin:re,onError:Q}=u.getState();g.current={x:F,y:M};let H=!1,te={x:0,y:0,x2:0,y2:0};if(f.current.length>1&&T){const V=Ou(f.current,re);te=ol(V)}if(f.current=f.current.map(V=>{const J={x:F-V.distance.x,y:M-V.distance.y};U&&(J.x=Z[0]*Math.round(J.x/Z[0]),J.y=Z[1]*Math.round(J.y/Z[1]));const D=[[T[0][0],T[0][1]],[T[1][0],T[1][1]]];f.current.length>1&&T&&!V.extent&&(D[0][0]=V.positionAbsolute.x-te.x+T[0][0],D[1][0]=V.positionAbsolute.x+(V.width??0)-te.x2+T[1][0],D[0][1]=V.positionAbsolute.y-te.y+T[0][1],D[1][1]=V.positionAbsolute.y+(V.height??0)-te.y2+T[1][1]);const L=OC(V,J,A,D,re,Q);return H=H||V.position.x!==L.position.x||V.position.y!==L.position.y,V.position=L.position,V.positionAbsolute=L.positionAbsolute,V}),!H)return;K(f.current,!0,!0),p(!0);const $=i?q:Vf(W);if($&&b.current){const[V,J]=Gf({nodeId:i,dragItems:f.current,nodeInternals:A});$(b.current,V,J)}},P=()=>{if(!w.current)return;const[F,M]=rC(N.current,w.current);if(F!==0||M!==0){const{transform:A,panBy:q}=u.getState();g.current.x=(g.current.x??0)-F/A[2],g.current.y=(g.current.y??0)-M/A[2],q({x:F,y:M})&&I(g.current)}y.current=requestAnimationFrame(P)},O=F=>{var re;const{nodeInternals:M,multiSelectionActive:A,nodesDraggable:q,unselectNodesAndEdges:W,onNodeDragStart:K,onSelectionDragStart:T}=u.getState();k.current=!0;const Z=i?K:Vf(T);(!l||!a)&&!A&&i&&((re=M.get(i))!=null&&re.selected||W()),i&&a&&l&&Oy({id:i,store:u,nodeRef:e});const U=j(F);if(g.current=U,f.current=PP(M,q,U,i),Z&&f.current){const[Q,H]=Gf({nodeId:i,dragItems:f.current,nodeInternals:M});Z(F.sourceEvent,Q,H)}};if(t)C.on(".drag",null);else{const F=VM().on("start",M=>{const{domNode:A,nodeDragThreshold:q}=u.getState();q===0&&O(M),E.current=!1;const W=j(M);g.current=W,w.current=(A==null?void 0:A.getBoundingClientRect())||null,N.current=As(M.sourceEvent,w.current)}).on("drag",M=>{var K,T;const A=j(M),{autoPanOnNodeDrag:q,nodeDragThreshold:W}=u.getState();if(M.sourceEvent.type==="touchmove"&&M.sourceEvent.touches.length>1&&(E.current=!0),!E.current){if(!_.current&&k.current&&q&&(_.current=!0,P()),!k.current){const Z=A.xSnapped-(((K=g==null?void 0:g.current)==null?void 0:K.x)??0),U=A.ySnapped-(((T=g==null?void 0:g.current)==null?void 0:T.y)??0);Math.sqrt(Z*Z+U*U)>W&&O(M)}(g.current.x!==A.xSnapped||g.current.y!==A.ySnapped)&&f.current&&k.current&&(b.current=M.sourceEvent,N.current=As(M.sourceEvent,w.current),I(A))}}).on("end",M=>{if(!(!k.current||E.current)&&(p(!1),_.current=!1,k.current=!1,cancelAnimationFrame(y.current),f.current)){const{updateNodePositions:A,nodeInternals:q,onNodeDragStop:W,onSelectionDragStop:K}=u.getState(),T=i?W:Vf(K);if(A(f.current,!1,!1),T){const[Z,U]=Gf({nodeId:i,dragItems:f.current,nodeInternals:q});T(M.sourceEvent,Z,U)}}}).filter(M=>{const A=M.target;return!M.button&&(!n||!qb(A,`.${n}`,e))&&(!s||qb(A,s,e))});return C.call(F),()=>{C.on(".drag",null)}}}},[e,t,n,s,a,u,i,l,j]),h}function $C(){const e=Rt();return S.useCallback(n=>{const{nodeInternals:s,nodeExtent:i,updateNodePositions:a,getNodes:l,snapToGrid:u,snapGrid:h,onError:p,nodesDraggable:f}=e.getState(),g=l().filter(E=>E.selected&&(E.draggable||f&&typeof E.draggable>"u")),y=u?h[0]:5,w=u?h[1]:5,N=n.isShiftPressed?4:1,b=n.x*y*N,_=n.y*w*N,k=g.map(E=>{if(E.positionAbsolute){const j={x:E.positionAbsolute.x+b,y:E.positionAbsolute.y+_};u&&(j.x=h[0]*Math.round(j.x/h[0]),j.y=h[1]*Math.round(j.y/h[1]));const{positionAbsolute:C,position:I}=OC(E,j,s,i,void 0,p);E.position=I,E.positionAbsolute=C}return E});a(k,!0,!1)},[])}const Mi={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var Ba=e=>{const t=({id:n,type:s,data:i,xPos:a,yPos:l,xPosOrigin:u,yPosOrigin:h,selected:p,onClick:f,onMouseEnter:g,onMouseMove:y,onMouseLeave:w,onContextMenu:N,onDoubleClick:b,style:_,className:k,isDraggable:E,isSelectable:j,isConnectable:C,isFocusable:I,selectNodesOnDrag:P,sourcePosition:O,targetPosition:F,hidden:M,resizeObserver:A,dragHandle:q,zIndex:W,isParent:K,noDragClassName:T,noPanClassName:Z,initialized:U,disableKeyboardA11y:re,ariaLabel:Q,rfId:H,hasHandleBounds:te})=>{const $=Rt(),V=S.useRef(null),J=S.useRef(null),D=S.useRef(O),L=S.useRef(F),X=S.useRef(s),se=j||E||f||g||y||w,fe=$C(),pe=za(n,$.getState,g),xe=za(n,$.getState,y),je=za(n,$.getState,w),He=za(n,$.getState,N),De=za(n,$.getState,b),Me=he=>{const{nodeDragThreshold:ve}=$.getState();if(j&&(!P||!E||ve>0)&&Oy({id:n,store:$,nodeRef:V}),f){const We=$.getState().nodeInternals.get(n);We&&f(he,{...We})}},_e=he=>{if(!Ty(he)&&!re)if(aC.includes(he.key)&&j){const ve=he.key==="Escape";Oy({id:n,store:$,unselect:ve,nodeRef:V})}else E&&p&&Object.prototype.hasOwnProperty.call(Mi,he.key)&&($.setState({ariaLiveMessage:`Moved selected node ${he.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~a}, y: ${~~l}`}),fe({x:Mi[he.key].x,y:Mi[he.key].y,isShiftPressed:he.shiftKey}))};S.useEffect(()=>()=>{J.current&&(A==null||A.unobserve(J.current),J.current=null)},[]),S.useEffect(()=>{if(V.current&&!M){const he=V.current;(!U||!te||J.current!==he)&&(J.current&&(A==null||A.unobserve(J.current)),A==null||A.observe(he),J.current=he)}},[M,U,te]),S.useEffect(()=>{const he=X.current!==s,ve=D.current!==O,We=L.current!==F;V.current&&(he||ve||We)&&(he&&(X.current=s),ve&&(D.current=O),We&&(L.current=F),$.getState().updateNodeDimensions([{id:n,nodeElement:V.current,forceUpdate:!0}]))},[n,s,O,F]);const G=PC({nodeRef:V,disabled:M||!E,noDragClassName:T,handleSelector:q,nodeId:n,isSelectable:j,selectNodesOnDrag:P});return M?null:ue.createElement("div",{className:Ht(["react-flow__node",`react-flow__node-${s}`,{[Z]:E},k,{selected:p,selectable:j,parent:K,dragging:G}]),ref:V,style:{zIndex:W,transform:`translate(${u}px,${h}px)`,pointerEvents:se?"all":"none",visibility:U?"visible":"hidden",..._},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:pe,onMouseMove:xe,onMouseLeave:je,onContextMenu:He,onClick:Me,onDoubleClick:De,onKeyDown:I?_e:void 0,tabIndex:I?0:void 0,role:I?"button":void 0,"aria-describedby":re?void 0:`${jC}-${H}`,"aria-label":Q},ue.createElement(XO,{value:n},ue.createElement(e,{id:n,data:i,type:s,xPos:a,yPos:l,selected:p,isConnectable:C,sourcePosition:O,targetPosition:F,dragging:G,dragHandle:q,zIndex:W})))};return t.displayName="NodeWrapper",S.memo(t)};const qP=e=>{const t=e.getNodes().filter(n=>n.selected);return{...Ou(t,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};function DP({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const s=Rt(),{width:i,height:a,x:l,y:u,transformString:h,userSelectionActive:p}=it(qP,$t),f=$C(),g=S.useRef(null);if(S.useEffect(()=>{var N;n||(N=g.current)==null||N.focus({preventScroll:!0})},[n]),PC({nodeRef:g}),p||!i||!a)return null;const y=e?N=>{const b=s.getState().getNodes().filter(_=>_.selected);e(N,b)}:void 0,w=N=>{Object.prototype.hasOwnProperty.call(Mi,N.key)&&f({x:Mi[N.key].x,y:Mi[N.key].y,isShiftPressed:N.shiftKey})};return ue.createElement("div",{className:Ht(["react-flow__nodesselection","react-flow__container",t]),style:{transform:h}},ue.createElement("div",{ref:g,className:"react-flow__nodesselection-rect",onContextMenu:y,tabIndex:n?void 0:-1,onKeyDown:n?void 0:w,style:{width:i,height:a,top:u,left:l}}))}var FP=S.memo(DP);const zP=e=>e.nodesSelectionActive,LC=({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:s,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:l,deleteKeyCode:u,onMove:h,onMoveStart:p,onMoveEnd:f,selectionKeyCode:g,selectionOnDrag:y,selectionMode:w,onSelectionStart:N,onSelectionEnd:b,multiSelectionKeyCode:_,panActivationKeyCode:k,zoomActivationKeyCode:E,elementsSelectable:j,zoomOnScroll:C,zoomOnPinch:I,panOnScroll:P,panOnScrollSpeed:O,panOnScrollMode:F,zoomOnDoubleClick:M,panOnDrag:A,defaultViewport:q,translateExtent:W,minZoom:K,maxZoom:T,preventScrolling:Z,onSelectionContextMenu:U,noWheelClassName:re,noPanClassName:Q,disableKeyboardA11y:H})=>{const te=it(zP),$=al(g),V=al(k),J=V||A,D=V||P,L=$||y&&J!==!0;return NP({deleteKeyCode:u,multiSelectionKeyCode:_}),ue.createElement(TP,{onMove:h,onMoveStart:p,onMoveEnd:f,onPaneContextMenu:a,elementsSelectable:j,zoomOnScroll:C,zoomOnPinch:I,panOnScroll:D,panOnScrollSpeed:O,panOnScrollMode:F,zoomOnDoubleClick:M,panOnDrag:!$&&J,defaultViewport:q,translateExtent:W,minZoom:K,maxZoom:T,zoomActivationKeyCode:E,preventScrolling:Z,noWheelClassName:re,noPanClassName:Q},ue.createElement(MC,{onSelectionStart:N,onSelectionEnd:b,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:s,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:l,panOnDrag:J,isSelecting:!!L,selectionMode:w},e,te&&ue.createElement(FP,{onSelectionContextMenu:U,noPanClassName:Q,disableKeyboardA11y:H})))};LC.displayName="FlowRenderer";var BP=S.memo(LC);function UP(e){return it(S.useCallback(n=>e?pC(n.nodeInternals,{x:0,y:0,width:n.width,height:n.height},n.transform,!0):n.getNodes(),[e]))}function WP(e){const t={input:Ba(e.input||kC),default:Ba(e.default||Iy),output:Ba(e.output||NC),group:Ba(e.group||mw)},n={},s=Object.keys(e).filter(i=>!["input","default","output","group"].includes(i)).reduce((i,a)=>(i[a]=Ba(e[a]||Iy),i),n);return{...t,...s}}const HP=({x:e,y:t,width:n,height:s,origin:i})=>!n||!s?{x:e,y:t}:i[0]<0||i[1]<0||i[0]>1||i[1]>1?{x:e,y:t}:{x:e-n*i[0],y:t-s*i[1]},GP=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),qC=e=>{const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:s,elementsSelectable:i,updateNodeDimensions:a,onError:l}=it(GP,$t),u=UP(e.onlyRenderVisibleElements),h=S.useRef(),p=S.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const f=new ResizeObserver(g=>{const y=g.map(w=>({id:w.target.getAttribute("data-id"),nodeElement:w.target,forceUpdate:!0}));a(y)});return h.current=f,f},[]);return S.useEffect(()=>()=>{var f;(f=h==null?void 0:h.current)==null||f.disconnect()},[]),ue.createElement("div",{className:"react-flow__nodes",style:gw},u.map(f=>{var I,P,O;let g=f.type||"default";e.nodeTypes[g]||(l==null||l("003",Qr.error003(g)),g="default");const y=e.nodeTypes[g]||e.nodeTypes.default,w=!!(f.draggable||t&&typeof f.draggable>"u"),N=!!(f.selectable||i&&typeof f.selectable>"u"),b=!!(f.connectable||n&&typeof f.connectable>"u"),_=!!(f.focusable||s&&typeof f.focusable>"u"),k=e.nodeExtent?cw(f.positionAbsolute,e.nodeExtent):f.positionAbsolute,E=(k==null?void 0:k.x)??0,j=(k==null?void 0:k.y)??0,C=HP({x:E,y:j,width:f.width??0,height:f.height??0,origin:e.nodeOrigin});return ue.createElement(y,{key:f.id,id:f.id,className:f.className,style:f.style,type:g,data:f.data,sourcePosition:f.sourcePosition||Pe.Bottom,targetPosition:f.targetPosition||Pe.Top,hidden:f.hidden,xPos:E,yPos:j,xPosOrigin:C.x,yPosOrigin:C.y,selectNodesOnDrag:e.selectNodesOnDrag,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,selected:!!f.selected,isDraggable:w,isSelectable:N,isConnectable:b,isFocusable:_,resizeObserver:p,dragHandle:f.dragHandle,zIndex:((I=f[Nt])==null?void 0:I.z)??0,isParent:!!((P=f[Nt])!=null&&P.isParent),noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!f.width&&!!f.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:f.ariaLabel,hasHandleBounds:!!((O=f[Nt])!=null&&O.handleBounds)})}))};qC.displayName="NodeRenderer";var VP=S.memo(qC);const YP=(e,t,n)=>n===Pe.Left?e-t:n===Pe.Right?e+t:e,KP=(e,t,n)=>n===Pe.Top?e-t:n===Pe.Bottom?e+t:e,Fb="react-flow__edgeupdater",zb=({position:e,centerX:t,centerY:n,radius:s=10,onMouseDown:i,onMouseEnter:a,onMouseOut:l,type:u})=>ue.createElement("circle",{onMouseDown:i,onMouseEnter:a,onMouseOut:l,className:Ht([Fb,`${Fb}-${u}`]),cx:YP(t,s,e),cy:KP(n,s,e),r:s,stroke:"transparent",fill:"transparent"}),XP=()=>!0;var _i=e=>{const t=({id:n,className:s,type:i,data:a,onClick:l,onEdgeDoubleClick:u,selected:h,animated:p,label:f,labelStyle:g,labelShowBg:y,labelBgStyle:w,labelBgPadding:N,labelBgBorderRadius:b,style:_,source:k,target:E,sourceX:j,sourceY:C,targetX:I,targetY:P,sourcePosition:O,targetPosition:F,elementsSelectable:M,hidden:A,sourceHandleId:q,targetHandleId:W,onContextMenu:K,onMouseEnter:T,onMouseMove:Z,onMouseLeave:U,reconnectRadius:re,onReconnect:Q,onReconnectStart:H,onReconnectEnd:te,markerEnd:$,markerStart:V,rfId:J,ariaLabel:D,isFocusable:L,isReconnectable:X,pathOptions:se,interactionWidth:fe,disableKeyboardA11y:pe})=>{const xe=S.useRef(null),[je,He]=S.useState(!1),[De,Me]=S.useState(!1),_e=Rt(),G=S.useMemo(()=>`url('#${Ay(V,J)}')`,[V,J]),he=S.useMemo(()=>`url('#${Ay($,J)}')`,[$,J]);if(A)return null;const ve=$e=>{var Te;const{edges:Fe,addSelectedEdges:Ne,unselectNodesAndEdges:Ye,multiSelectionActive:Et}=_e.getState(),st=Fe.find(xt=>xt.id===n);st&&(M&&(_e.setState({nodesSelectionActive:!1}),st.selected&&Et?(Ye({nodes:[],edges:[st]}),(Te=xe.current)==null||Te.blur()):Ne([n])),l&&l($e,st))},We=Fa(n,_e.getState,u),at=Fa(n,_e.getState,K),rt=Fa(n,_e.getState,T),Be=Fa(n,_e.getState,Z),Ie=Fa(n,_e.getState,U),Je=($e,Fe)=>{if($e.button!==0)return;const{edges:Ne,isValidConnection:Ye}=_e.getState(),Et=Fe?E:k,st=(Fe?W:q)||null,Te=Fe?"target":"source",xt=Ye||XP,ut=Fe,kt=Ne.find(En=>En.id===n);Me(!0),H==null||H($e,kt,Te);const Nn=En=>{Me(!1),te==null||te(En,kt,Te)};wC({event:$e,handleId:st,nodeId:Et,onConnect:En=>Q==null?void 0:Q(kt,En),isTarget:ut,getState:_e.getState,setState:_e.setState,isValidConnection:xt,edgeUpdaterType:Te,onReconnectEnd:Nn})},Ge=$e=>Je($e,!0),Qe=$e=>Je($e,!1),Oe=()=>He(!0),lt=()=>He(!1),Mt=!M&&!l,ae=$e=>{var Fe;if(!pe&&aC.includes($e.key)&&M){const{unselectNodesAndEdges:Ne,addSelectedEdges:Ye,edges:Et}=_e.getState();$e.key==="Escape"?((Fe=xe.current)==null||Fe.blur(),Ne({edges:[Et.find(Te=>Te.id===n)]})):Ye([n])}};return ue.createElement("g",{className:Ht(["react-flow__edge",`react-flow__edge-${i}`,s,{selected:h,animated:p,inactive:Mt,updating:je}]),onClick:ve,onDoubleClick:We,onContextMenu:at,onMouseEnter:rt,onMouseMove:Be,onMouseLeave:Ie,onKeyDown:L?ae:void 0,tabIndex:L?0:void 0,role:L?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":D===null?void 0:D||`Edge from ${k} to ${E}`,"aria-describedby":L?`${CC}-${J}`:void 0,ref:xe},!De&&ue.createElement(e,{id:n,source:k,target:E,selected:h,animated:p,label:f,labelStyle:g,labelShowBg:y,labelBgStyle:w,labelBgPadding:N,labelBgBorderRadius:b,data:a,style:_,sourceX:j,sourceY:C,targetX:I,targetY:P,sourcePosition:O,targetPosition:F,sourceHandleId:q,targetHandleId:W,markerStart:G,markerEnd:he,pathOptions:se,interactionWidth:fe}),X&&ue.createElement(ue.Fragment,null,(X==="source"||X===!0)&&ue.createElement(zb,{position:O,centerX:j,centerY:C,radius:re,onMouseDown:Ge,onMouseEnter:Oe,onMouseOut:lt,type:"source"}),(X==="target"||X===!0)&&ue.createElement(zb,{position:F,centerX:I,centerY:P,radius:re,onMouseDown:Qe,onMouseEnter:Oe,onMouseOut:lt,type:"target"})))};return t.displayName="EdgeWrapper",S.memo(t)};function QP(e){const t={default:_i(e.default||yu),straight:_i(e.bezier||fw),step:_i(e.step||dw),smoothstep:_i(e.step||Iu),simplebezier:_i(e.simplebezier||uw)},n={},s=Object.keys(e).filter(i=>!["default","bezier"].includes(i)).reduce((i,a)=>(i[a]=_i(e[a]||yu),i),n);return{...t,...s}}function Bb(e,t,n=null){const s=((n==null?void 0:n.x)||0)+t.x,i=((n==null?void 0:n.y)||0)+t.y,a=(n==null?void 0:n.width)||t.width,l=(n==null?void 0:n.height)||t.height;switch(e){case Pe.Top:return{x:s+a/2,y:i};case Pe.Right:return{x:s+a,y:i+l/2};case Pe.Bottom:return{x:s+a/2,y:i+l};case Pe.Left:return{x:s,y:i+l/2}}}function Ub(e,t){return e?e.length===1||!t?e[0]:t&&e.find(n=>n.id===t)||null:null}const ZP=(e,t,n,s,i,a)=>{const l=Bb(n,e,t),u=Bb(a,s,i);return{sourceX:l.x,sourceY:l.y,targetX:u.x,targetY:u.y}};function JP({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:s,targetWidth:i,targetHeight:a,width:l,height:u,transform:h}){const p={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+n,t.x+i),y2:Math.max(e.y+s,t.y+a)};p.x===p.x2&&(p.x2+=1),p.y===p.y2&&(p.y2+=1);const f=ol({x:(0-h[0])/h[2],y:(0-h[1])/h[2],width:l/h[2],height:u/h[2]}),g=Math.max(0,Math.min(f.x2,p.x2)-Math.max(f.x,p.x)),y=Math.max(0,Math.min(f.y2,p.y2)-Math.max(f.y,p.y));return Math.ceil(g*y)>0}function Wb(e){var s,i,a,l,u;const t=((s=e==null?void 0:e[Nt])==null?void 0:s.handleBounds)||null,n=t&&(e==null?void 0:e.width)&&(e==null?void 0:e.height)&&typeof((i=e==null?void 0:e.positionAbsolute)==null?void 0:i.x)<"u"&&typeof((a=e==null?void 0:e.positionAbsolute)==null?void 0:a.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 e$=[{level:0,isMaxLevel:!0,edges:[]}];function t$(e,t,n=!1){let s=-1;const i=e.reduce((l,u)=>{var f,g;const h=qn(u.zIndex);let p=h?u.zIndex:0;if(n){const y=t.get(u.target),w=t.get(u.source),N=u.selected||(y==null?void 0:y.selected)||(w==null?void 0:w.selected),b=Math.max(((f=w==null?void 0:w[Nt])==null?void 0:f.z)||0,((g=y==null?void 0:y[Nt])==null?void 0:g.z)||0,1e3);p=(h?u.zIndex:0)+(N?b:0)}return l[p]?l[p].push(u):l[p]=[u],s=p>s?p:s,l},{}),a=Object.entries(i).map(([l,u])=>{const h=+l;return{edges:u,level:h,isMaxLevel:h===s}});return a.length===0?e$:a}function n$(e,t,n){const s=it(S.useCallback(i=>e?i.edges.filter(a=>{const l=t.get(a.source),u=t.get(a.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)&&JP({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:i.width,height:i.height,transform:i.transform})}):i.edges,[e,t]));return t$(s,t,n)}const r$=({color:e="none",strokeWidth:t=1})=>ue.createElement("polyline",{style:{stroke:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),s$=({color:e="none",strokeWidth:t=1})=>ue.createElement("polyline",{style:{stroke:e,fill:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),Hb={[vu.Arrow]:r$,[vu.ArrowClosed]:s$};function o$(e){const t=Rt();return S.useMemo(()=>{var i,a;return Object.prototype.hasOwnProperty.call(Hb,e)?Hb[e]:((a=(i=t.getState()).onError)==null||a.call(i,"009",Qr.error009(e)),null)},[e])}const i$=({id:e,type:t,color:n,width:s=12.5,height:i=12.5,markerUnits:a="strokeWidth",strokeWidth:l,orient:u="auto-start-reverse"})=>{const h=o$(t);return h?ue.createElement("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${s}`,markerHeight:`${i}`,viewBox:"-10 -10 20 20",markerUnits:a,orient:u,refX:"0",refY:"0"},ue.createElement(h,{color:n,strokeWidth:l})):null},a$=({defaultColor:e,rfId:t})=>n=>{const s=[];return n.edges.reduce((i,a)=>([a.markerStart,a.markerEnd].forEach(l=>{if(l&&typeof l=="object"){const u=Ay(l,t);s.includes(u)||(i.push({id:u,color:l.color||e,...l}),s.push(u))}}),i),[]).sort((i,a)=>i.id.localeCompare(a.id))},DC=({defaultColor:e,rfId:t})=>{const n=it(S.useCallback(a$({defaultColor:e,rfId:t}),[e,t]),(s,i)=>!(s.length!==i.length||s.some((a,l)=>a.id!==i[l].id)));return ue.createElement("defs",null,n.map(s=>ue.createElement(i$,{id:s.id,key:s.id,type:s.type,color:s.color,width:s.width,height:s.height,markerUnits:s.markerUnits,strokeWidth:s.strokeWidth,orient:s.orient})))};DC.displayName="MarkerDefinitions";var l$=S.memo(DC);const c$=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}),FC=({defaultMarkerColor:e,onlyRenderVisibleElements:t,elevateEdgesOnSelect:n,rfId:s,edgeTypes:i,noPanClassName:a,onEdgeContextMenu:l,onEdgeMouseEnter:u,onEdgeMouseMove:h,onEdgeMouseLeave:p,onEdgeClick:f,onEdgeDoubleClick:g,onReconnect:y,onReconnectStart:w,onReconnectEnd:N,reconnectRadius:b,children:_,disableKeyboardA11y:k})=>{const{edgesFocusable:E,edgesUpdatable:j,elementsSelectable:C,width:I,height:P,connectionMode:O,nodeInternals:F,onError:M}=it(c$,$t),A=n$(t,F,n);return I?ue.createElement(ue.Fragment,null,A.map(({level:q,edges:W,isMaxLevel:K})=>ue.createElement("svg",{key:q,style:{zIndex:q},width:I,height:P,className:"react-flow__edges react-flow__container"},K&&ue.createElement(l$,{defaultColor:e,rfId:s}),ue.createElement("g",null,W.map(T=>{const[Z,U,re]=Wb(F.get(T.source)),[Q,H,te]=Wb(F.get(T.target));if(!re||!te)return null;let $=T.type||"default";i[$]||(M==null||M("011",Qr.error011($)),$="default");const V=i[$]||i.default,J=O===_o.Strict?H.target:(H.target??[]).concat(H.source??[]),D=Ub(U.source,T.sourceHandle),L=Ub(J,T.targetHandle),X=(D==null?void 0:D.position)||Pe.Bottom,se=(L==null?void 0:L.position)||Pe.Top,fe=!!(T.focusable||E&&typeof T.focusable>"u"),pe=T.reconnectable||T.updatable,xe=typeof y<"u"&&(pe||j&&typeof pe>"u");if(!D||!L)return M==null||M("008",Qr.error008(D,T)),null;const{sourceX:je,sourceY:He,targetX:De,targetY:Me}=ZP(Z,D,X,Q,L,se);return ue.createElement(V,{key:T.id,id:T.id,className:Ht([T.className,a]),type:$,data:T.data,selected:!!T.selected,animated:!!T.animated,hidden:!!T.hidden,label:T.label,labelStyle:T.labelStyle,labelShowBg:T.labelShowBg,labelBgStyle:T.labelBgStyle,labelBgPadding:T.labelBgPadding,labelBgBorderRadius:T.labelBgBorderRadius,style:T.style,source:T.source,target:T.target,sourceHandleId:T.sourceHandle,targetHandleId:T.targetHandle,markerEnd:T.markerEnd,markerStart:T.markerStart,sourceX:je,sourceY:He,targetX:De,targetY:Me,sourcePosition:X,targetPosition:se,elementsSelectable:C,onContextMenu:l,onMouseEnter:u,onMouseMove:h,onMouseLeave:p,onClick:f,onEdgeDoubleClick:g,onReconnect:y,onReconnectStart:w,onReconnectEnd:N,reconnectRadius:b,rfId:s,ariaLabel:T.ariaLabel,isFocusable:fe,isReconnectable:xe,pathOptions:"pathOptions"in T?T.pathOptions:void 0,interactionWidth:T.interactionWidth,disableKeyboardA11y:k})})))),_):null};FC.displayName="EdgeRenderer";var u$=S.memo(FC);const d$=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function f$({children:e}){const t=it(d$);return ue.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:t}},e)}function h$(e){const t=gl(),n=S.useRef(!1);S.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const p$={[Pe.Left]:Pe.Right,[Pe.Right]:Pe.Left,[Pe.Top]:Pe.Bottom,[Pe.Bottom]:Pe.Top},zC=({nodeId:e,handleType:t,style:n,type:s=Rs.Bezier,CustomComponent:i,connectionStatus:a})=>{var P,O,F;const{fromNode:l,handleId:u,toX:h,toY:p,connectionMode:f}=it(S.useCallback(M=>({fromNode:M.nodeInternals.get(e),handleId:M.connectionHandleId,toX:(M.connectionPosition.x-M.transform[0])/M.transform[2],toY:(M.connectionPosition.y-M.transform[1])/M.transform[2],connectionMode:M.connectionMode}),[e]),$t),g=(P=l==null?void 0:l[Nt])==null?void 0:P.handleBounds;let y=g==null?void 0:g[t];if(f===_o.Loose&&(y=y||(g==null?void 0:g[t==="source"?"target":"source"])),!l||!y)return null;const w=u?y.find(M=>M.id===u):y[0],N=w?w.x+w.width/2:(l.width??0)/2,b=w?w.y+w.height/2:l.height??0,_=(((O=l.positionAbsolute)==null?void 0:O.x)??0)+N,k=(((F=l.positionAbsolute)==null?void 0:F.y)??0)+b,E=w==null?void 0:w.position,j=E?p$[E]:null;if(!E||!j)return null;if(i)return ue.createElement(i,{connectionLineType:s,connectionLineStyle:n,fromNode:l,fromHandle:w,fromX:_,fromY:k,toX:h,toY:p,fromPosition:E,toPosition:j,connectionStatus:a});let C="";const I={sourceX:_,sourceY:k,sourcePosition:E,targetX:h,targetY:p,targetPosition:j};return s===Rs.Bezier?[C]=fC(I):s===Rs.Step?[C]=Ry({...I,borderRadius:0}):s===Rs.SmoothStep?[C]=Ry(I):s===Rs.SimpleBezier?[C]=dC(I):C=`M${_},${k} ${h},${p}`,ue.createElement("path",{d:C,fill:"none",className:"react-flow__connection-path",style:n})};zC.displayName="ConnectionLine";const m$=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function g$({containerStyle:e,style:t,type:n,component:s}){const{nodeId:i,handleType:a,nodesConnectable:l,width:u,height:h,connectionStatus:p}=it(m$,$t);return!(i&&a&&u&&l)?null:ue.createElement("svg",{style:e,width:u,height:h,className:"react-flow__edges react-flow__connectionline react-flow__container"},ue.createElement("g",{className:Ht(["react-flow__connection",p])},ue.createElement(zC,{nodeId:i,handleType:a,style:t,type:n,CustomComponent:s,connectionStatus:p})))}function Gb(e,t){return S.useRef(null),Rt(),S.useMemo(()=>t(e),[e])}const BC=({nodeTypes:e,edgeTypes:t,onMove:n,onMoveStart:s,onMoveEnd:i,onInit:a,onNodeClick:l,onEdgeClick:u,onNodeDoubleClick:h,onEdgeDoubleClick:p,onNodeMouseEnter:f,onNodeMouseMove:g,onNodeMouseLeave:y,onNodeContextMenu:w,onSelectionContextMenu:N,onSelectionStart:b,onSelectionEnd:_,connectionLineType:k,connectionLineStyle:E,connectionLineComponent:j,connectionLineContainerStyle:C,selectionKeyCode:I,selectionOnDrag:P,selectionMode:O,multiSelectionKeyCode:F,panActivationKeyCode:M,zoomActivationKeyCode:A,deleteKeyCode:q,onlyRenderVisibleElements:W,elementsSelectable:K,selectNodesOnDrag:T,defaultViewport:Z,translateExtent:U,minZoom:re,maxZoom:Q,preventScrolling:H,defaultMarkerColor:te,zoomOnScroll:$,zoomOnPinch:V,panOnScroll:J,panOnScrollSpeed:D,panOnScrollMode:L,zoomOnDoubleClick:X,panOnDrag:se,onPaneClick:fe,onPaneMouseEnter:pe,onPaneMouseMove:xe,onPaneMouseLeave:je,onPaneScroll:He,onPaneContextMenu:De,onEdgeContextMenu:Me,onEdgeMouseEnter:_e,onEdgeMouseMove:G,onEdgeMouseLeave:he,onReconnect:ve,onReconnectStart:We,onReconnectEnd:at,reconnectRadius:rt,noDragClassName:Be,noWheelClassName:Ie,noPanClassName:Je,elevateEdgesOnSelect:Ge,disableKeyboardA11y:Qe,nodeOrigin:Oe,nodeExtent:lt,rfId:Mt})=>{const ae=Gb(e,WP),$e=Gb(t,QP);return h$(a),ue.createElement(BP,{onPaneClick:fe,onPaneMouseEnter:pe,onPaneMouseMove:xe,onPaneMouseLeave:je,onPaneContextMenu:De,onPaneScroll:He,deleteKeyCode:q,selectionKeyCode:I,selectionOnDrag:P,selectionMode:O,onSelectionStart:b,onSelectionEnd:_,multiSelectionKeyCode:F,panActivationKeyCode:M,zoomActivationKeyCode:A,elementsSelectable:K,onMove:n,onMoveStart:s,onMoveEnd:i,zoomOnScroll:$,zoomOnPinch:V,zoomOnDoubleClick:X,panOnScroll:J,panOnScrollSpeed:D,panOnScrollMode:L,panOnDrag:se,defaultViewport:Z,translateExtent:U,minZoom:re,maxZoom:Q,onSelectionContextMenu:N,preventScrolling:H,noDragClassName:Be,noWheelClassName:Ie,noPanClassName:Je,disableKeyboardA11y:Qe},ue.createElement(f$,null,ue.createElement(u$,{edgeTypes:$e,onEdgeClick:u,onEdgeDoubleClick:p,onlyRenderVisibleElements:W,onEdgeContextMenu:Me,onEdgeMouseEnter:_e,onEdgeMouseMove:G,onEdgeMouseLeave:he,onReconnect:ve,onReconnectStart:We,onReconnectEnd:at,reconnectRadius:rt,defaultMarkerColor:te,noPanClassName:Je,elevateEdgesOnSelect:!!Ge,disableKeyboardA11y:Qe,rfId:Mt},ue.createElement(g$,{style:E,type:k,component:j,containerStyle:C})),ue.createElement("div",{className:"react-flow__edgelabel-renderer"}),ue.createElement(VP,{nodeTypes:ae,onNodeClick:l,onNodeDoubleClick:h,onNodeMouseEnter:f,onNodeMouseMove:g,onNodeMouseLeave:y,onNodeContextMenu:w,selectNodesOnDrag:T,onlyRenderVisibleElements:W,noPanClassName:Je,noDragClassName:Be,disableKeyboardA11y:Qe,nodeOrigin:Oe,nodeExtent:lt,rfId:Mt})))};BC.displayName="GraphView";var v$=S.memo(BC);const Py=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],js={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:Py,nodeExtent:Py,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:_o.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:WO,isValidConnection:void 0},y$=()=>o2((e,t)=>({...js,setNodes:n=>{const{nodeInternals:s,nodeOrigin:i,elevateNodesOnSelect:a}=t();e({nodeInternals:Wf(n,s,i,a)})},getNodes:()=>Array.from(t().nodeInternals.values()),setEdges:n=>{const{defaultEdgeOptions:s={}}=t();e({edges:n.map(i=>({...s,...i}))})},setDefaultNodesAndEdges:(n,s)=>{const i=typeof n<"u",a=typeof s<"u",l=i?Wf(n,new Map,t().nodeOrigin,t().elevateNodesOnSelect):new Map;e({nodeInternals:l,edges:a?s:[],hasDefaultNodes:i,hasDefaultEdges:a})},updateNodeDimensions:n=>{const{onNodesChange:s,nodeInternals:i,fitViewOnInit:a,fitViewOnInitDone:l,fitViewOnInitOptions:u,domNode:h,nodeOrigin:p}=t(),f=h==null?void 0:h.querySelector(".react-flow__viewport");if(!f)return;const g=window.getComputedStyle(f),{m22:y}=new window.DOMMatrixReadOnly(g.transform),w=n.reduce((b,_)=>{const k=i.get(_.id);if(k!=null&&k.hidden)i.set(k.id,{...k,[Nt]:{...k[Nt],handleBounds:void 0}});else if(k){const E=lw(_.nodeElement);!!(E.width&&E.height&&(k.width!==E.width||k.height!==E.height||_.forceUpdate))&&(i.set(k.id,{...k,[Nt]:{...k[Nt],handleBounds:{source:Db(".source",_.nodeElement,y,p),target:Db(".target",_.nodeElement,y,p)}},...E}),b.push({id:k.id,type:"dimensions",dimensions:E}))}return b},[]);RC(i,p);const N=l||a&&!l&&AC(t,{initial:!0,...u});e({nodeInternals:new Map(i),fitViewOnInitDone:N}),(w==null?void 0:w.length)>0&&(s==null||s(w))},updateNodePositions:(n,s=!0,i=!1)=>{const{triggerNodeChanges:a}=t(),l=n.map(u=>{const h={id:u.id,type:"position",dragging:i};return s&&(h.positionAbsolute=u.positionAbsolute,h.position=u.position),h});a(l)},triggerNodeChanges:n=>{const{onNodesChange:s,nodeInternals:i,hasDefaultNodes:a,nodeOrigin:l,getNodes:u,elevateNodesOnSelect:h}=t();if(n!=null&&n.length){if(a){const p=IP(n,u()),f=Wf(p,i,l,h);e({nodeInternals:f})}s==null||s(n)}},addSelectedNodes:n=>{const{multiSelectionActive:s,edges:i,getNodes:a}=t();let l,u=null;s?l=n.map(h=>Ts(h,!0)):(l=ji(a(),n),u=ji(i,[])),Gc({changedNodes:l,changedEdges:u,get:t,set:e})},addSelectedEdges:n=>{const{multiSelectionActive:s,edges:i,getNodes:a}=t();let l,u=null;s?l=n.map(h=>Ts(h,!0)):(l=ji(i,n),u=ji(a(),[])),Gc({changedNodes:u,changedEdges:l,get:t,set:e})},unselectNodesAndEdges:({nodes:n,edges:s}={})=>{const{edges:i,getNodes:a}=t(),l=n||a(),u=s||i,h=l.map(f=>(f.selected=!1,Ts(f.id,!1))),p=u.map(f=>Ts(f.id,!1));Gc({changedNodes:h,changedEdges:p,get:t,set:e})},setMinZoom:n=>{const{d3Zoom:s,maxZoom:i}=t();s==null||s.scaleExtent([n,i]),e({minZoom:n})},setMaxZoom:n=>{const{d3Zoom:s,minZoom:i}=t();s==null||s.scaleExtent([i,n]),e({maxZoom:n})},setTranslateExtent:n=>{var s;(s=t().d3Zoom)==null||s.translateExtent(n),e({translateExtent:n})},resetSelectedElements:()=>{const{edges:n,getNodes:s}=t(),a=s().filter(u=>u.selected).map(u=>Ts(u.id,!1)),l=n.filter(u=>u.selected).map(u=>Ts(u.id,!1));Gc({changedNodes:a,changedEdges:l,get:t,set:e})},setNodeExtent:n=>{const{nodeInternals:s}=t();s.forEach(i=>{i.positionAbsolute=cw(i.position,n)}),e({nodeExtent:n,nodeInternals:new Map(s)})},panBy:n=>{const{transform:s,width:i,height:a,d3Zoom:l,d3Selection:u,translateExtent:h}=t();if(!l||!u||!n.x&&!n.y)return!1;const p=Kr.translate(s[0]+n.x,s[1]+n.y).scale(s[2]),f=[[0,0],[i,a]],g=l==null?void 0:l.constrain()(p,f,h);return l.transform(u,g),s[0]!==g.x||s[1]!==g.y||s[2]!==g.k},cancelConnection:()=>e({connectionNodeId:js.connectionNodeId,connectionHandleId:js.connectionHandleId,connectionHandleType:js.connectionHandleType,connectionStatus:js.connectionStatus,connectionStartHandle:js.connectionStartHandle,connectionEndHandle:js.connectionEndHandle}),reset:()=>e({...js})}),Object.is),vw=({children:e})=>{const t=S.useRef(null);return t.current||(t.current=y$()),ue.createElement(LO,{value:t.current},e)};vw.displayName="ReactFlowProvider";const UC=({children:e})=>S.useContext(Mu)?ue.createElement(ue.Fragment,null,e):ue.createElement(vw,null,e);UC.displayName="ReactFlowWrapper";const w$={input:kC,default:Iy,output:NC,group:mw},x$={default:yu,straight:fw,step:dw,smoothstep:Iu,simplebezier:uw},b$=[0,0],_$=[15,15],k$={x:0,y:0,zoom:1},S$={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},WC=S.forwardRef(({nodes:e,edges:t,defaultNodes:n,defaultEdges:s,className:i,nodeTypes:a=w$,edgeTypes:l=x$,onNodeClick:u,onEdgeClick:h,onInit:p,onMove:f,onMoveStart:g,onMoveEnd:y,onConnect:w,onConnectStart:N,onConnectEnd:b,onClickConnectStart:_,onClickConnectEnd:k,onNodeMouseEnter:E,onNodeMouseMove:j,onNodeMouseLeave:C,onNodeContextMenu:I,onNodeDoubleClick:P,onNodeDragStart:O,onNodeDrag:F,onNodeDragStop:M,onNodesDelete:A,onEdgesDelete:q,onSelectionChange:W,onSelectionDragStart:K,onSelectionDrag:T,onSelectionDragStop:Z,onSelectionContextMenu:U,onSelectionStart:re,onSelectionEnd:Q,connectionMode:H=_o.Strict,connectionLineType:te=Rs.Bezier,connectionLineStyle:$,connectionLineComponent:V,connectionLineContainerStyle:J,deleteKeyCode:D="Backspace",selectionKeyCode:L="Shift",selectionOnDrag:X=!1,selectionMode:se=il.Full,panActivationKeyCode:fe="Space",multiSelectionKeyCode:pe=gu()?"Meta":"Control",zoomActivationKeyCode:xe=gu()?"Meta":"Control",snapToGrid:je=!1,snapGrid:He=_$,onlyRenderVisibleElements:De=!1,selectNodesOnDrag:Me=!0,nodesDraggable:_e,nodesConnectable:G,nodesFocusable:he,nodeOrigin:ve=b$,edgesFocusable:We,edgesUpdatable:at,elementsSelectable:rt,defaultViewport:Be=k$,minZoom:Ie=.5,maxZoom:Je=2,translateExtent:Ge=Py,preventScrolling:Qe=!0,nodeExtent:Oe,defaultMarkerColor:lt="#b1b1b7",zoomOnScroll:Mt=!0,zoomOnPinch:ae=!0,panOnScroll:$e=!1,panOnScrollSpeed:Fe=.5,panOnScrollMode:Ne=yo.Free,zoomOnDoubleClick:Ye=!0,panOnDrag:Et=!0,onPaneClick:st,onPaneMouseEnter:Te,onPaneMouseMove:xt,onPaneMouseLeave:ut,onPaneScroll:kt,onPaneContextMenu:Nn,children:zn,onEdgeContextMenu:En,onEdgeDoubleClick:jo,onEdgeMouseEnter:mn,onEdgeMouseMove:Co,onEdgeMouseLeave:To,onEdgeUpdate:Bt,onEdgeUpdateStart:Cr,onEdgeUpdateEnd:Bn,onReconnect:Ps,onReconnectStart:Tr,onReconnectEnd:Qi,reconnectRadius:fr=10,edgeUpdaterRadius:Rr=10,onNodesChange:hr,onEdgesChange:es,noDragClassName:Ro="nodrag",noWheelClassName:Ao="nowheel",noPanClassName:Mo="nopan",fitView:jn=!1,fitViewOptions:Io,connectOnClick:Ar=!0,attributionPosition:Oo,proOptions:Un,defaultEdgeOptions:Po,elevateNodesOnSelect:$s=!0,elevateEdgesOnSelect:Ls=!1,disableKeyboardA11y:$o=!1,autoPanOnConnect:Lo=!0,autoPanOnNodeDrag:ot=!0,connectionRadius:Zi=20,isValidConnection:ts,onError:Gt,style:Wn,id:qo,nodeDragThreshold:ns,...mt},sn)=>{const Hn=qo||"1";return ue.createElement("div",{...mt,style:{...Wn,...S$},ref:sn,className:Ht(["react-flow",i]),"data-testid":"rf__wrapper",id:qo},ue.createElement(UC,null,ue.createElement(v$,{onInit:p,onMove:f,onMoveStart:g,onMoveEnd:y,onNodeClick:u,onEdgeClick:h,onNodeMouseEnter:E,onNodeMouseMove:j,onNodeMouseLeave:C,onNodeContextMenu:I,onNodeDoubleClick:P,nodeTypes:a,edgeTypes:l,connectionLineType:te,connectionLineStyle:$,connectionLineComponent:V,connectionLineContainerStyle:J,selectionKeyCode:L,selectionOnDrag:X,selectionMode:se,deleteKeyCode:D,multiSelectionKeyCode:pe,panActivationKeyCode:fe,zoomActivationKeyCode:xe,onlyRenderVisibleElements:De,selectNodesOnDrag:Me,defaultViewport:Be,translateExtent:Ge,minZoom:Ie,maxZoom:Je,preventScrolling:Qe,zoomOnScroll:Mt,zoomOnPinch:ae,zoomOnDoubleClick:Ye,panOnScroll:$e,panOnScrollSpeed:Fe,panOnScrollMode:Ne,panOnDrag:Et,onPaneClick:st,onPaneMouseEnter:Te,onPaneMouseMove:xt,onPaneMouseLeave:ut,onPaneScroll:kt,onPaneContextMenu:Nn,onSelectionContextMenu:U,onSelectionStart:re,onSelectionEnd:Q,onEdgeContextMenu:En,onEdgeDoubleClick:jo,onEdgeMouseEnter:mn,onEdgeMouseMove:Co,onEdgeMouseLeave:To,onReconnect:Ps??Bt,onReconnectStart:Tr??Cr,onReconnectEnd:Qi??Bn,reconnectRadius:fr??Rr,defaultMarkerColor:lt,noDragClassName:Ro,noWheelClassName:Ao,noPanClassName:Mo,elevateEdgesOnSelect:Ls,rfId:Hn,disableKeyboardA11y:$o,nodeOrigin:ve,nodeExtent:Oe}),ue.createElement(hP,{nodes:e,edges:t,defaultNodes:n,defaultEdges:s,onConnect:w,onConnectStart:N,onConnectEnd:b,onClickConnectStart:_,onClickConnectEnd:k,nodesDraggable:_e,nodesConnectable:G,nodesFocusable:he,edgesFocusable:We,edgesUpdatable:at,elementsSelectable:rt,elevateNodesOnSelect:$s,minZoom:Ie,maxZoom:Je,nodeExtent:Oe,onNodesChange:hr,onEdgesChange:es,snapToGrid:je,snapGrid:He,connectionMode:H,translateExtent:Ge,connectOnClick:Ar,defaultEdgeOptions:Po,fitView:jn,fitViewOptions:Io,onNodesDelete:A,onEdgesDelete:q,onNodeDragStart:O,onNodeDrag:F,onNodeDragStop:M,onSelectionDrag:T,onSelectionDragStart:K,onSelectionDragStop:Z,noPanClassName:Mo,nodeOrigin:ve,rfId:Hn,autoPanOnConnect:Lo,autoPanOnNodeDrag:ot,onError:Gt,connectionRadius:Zi,isValidConnection:ts,nodeDragThreshold:ns}),ue.createElement(dP,{onSelectionChange:W}),zn,ue.createElement(DO,{proOptions:Un,position:Oo}),ue.createElement(yP,{rfId:Hn,disableKeyboardA11y:$o})))});WC.displayName="ReactFlow";const N$=e=>({x:e.transform[0],y:e.transform[1],zoom:e.transform[2]});function HC(){return it(N$,$t)}const GC=({id:e,x:t,y:n,width:s,height:i,style:a,color:l,strokeColor:u,strokeWidth:h,className:p,borderRadius:f,shapeRendering:g,onClick:y,selected:w})=>{const{background:N,backgroundColor:b}=a||{},_=l||N||b;return ue.createElement("rect",{className:Ht(["react-flow__minimap-node",{selected:w},p]),x:t,y:n,rx:f,ry:f,width:s,height:i,fill:_,stroke:u,strokeWidth:h,shapeRendering:g,onClick:y?k=>y(k,e):void 0})};GC.displayName="MiniMapNode";var E$=S.memo(GC);const j$=e=>e.nodeOrigin,C$=e=>e.getNodes().filter(t=>!t.hidden&&t.width&&t.height),Yf=e=>e instanceof Function?e:()=>e;function T$({nodeStrokeColor:e="transparent",nodeColor:t="#e2e2e2",nodeClassName:n="",nodeBorderRadius:s=5,nodeStrokeWidth:i=2,nodeComponent:a=E$,onClick:l}){const u=it(C$,$t),h=it(j$),p=Yf(t),f=Yf(e),g=Yf(n),y=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return ue.createElement(ue.Fragment,null,u.map(w=>{const{x:N,y:b}=xo(w,h).positionAbsolute;return ue.createElement(a,{key:w.id,x:N,y:b,width:w.width,height:w.height,style:w.style,selected:w.selected,className:g(w),color:p(w),borderRadius:s,strokeColor:f(w),strokeWidth:i,shapeRendering:y,onClick:l,id:w.id})}))}var R$=S.memo(T$);const A$=200,M$=150,I$=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?BO(Ou(t,e.nodeOrigin),n):n,rfId:e.rfId}},O$="react-flow__minimap-desc";function VC({style:e,className:t,nodeStrokeColor:n="transparent",nodeColor:s="#e2e2e2",nodeClassName:i="",nodeBorderRadius:a=5,nodeStrokeWidth:l=2,nodeComponent:u,maskColor:h="rgb(240, 240, 240, 0.6)",maskStrokeColor:p="none",maskStrokeWidth:f=1,position:g="bottom-right",onClick:y,onNodeClick:w,pannable:N=!1,zoomable:b=!1,ariaLabel:_="React Flow mini map",inversePan:k=!1,zoomStep:E=10,offsetScale:j=5}){const C=Rt(),I=S.useRef(null),{boundingRect:P,viewBB:O,rfId:F}=it(I$,$t),M=(e==null?void 0:e.width)??A$,A=(e==null?void 0:e.height)??M$,q=P.width/M,W=P.height/A,K=Math.max(q,W),T=K*M,Z=K*A,U=j*K,re=P.x-(T-P.width)/2-U,Q=P.y-(Z-P.height)/2-U,H=T+U*2,te=Z+U*2,$=`${O$}-${F}`,V=S.useRef(0);V.current=K,S.useEffect(()=>{if(I.current){const L=Ln(I.current),X=pe=>{const{transform:xe,d3Selection:je,d3Zoom:He}=C.getState();if(pe.sourceEvent.type!=="wheel"||!je||!He)return;const De=-pe.sourceEvent.deltaY*(pe.sourceEvent.deltaMode===1?.05:pe.sourceEvent.deltaMode?1:.002)*E,Me=xe[2]*Math.pow(2,De);He.scaleTo(je,Me)},se=pe=>{const{transform:xe,d3Selection:je,d3Zoom:He,translateExtent:De,width:Me,height:_e}=C.getState();if(pe.sourceEvent.type!=="mousemove"||!je||!He)return;const G=V.current*Math.max(1,xe[2])*(k?-1:1),he={x:xe[0]-pe.sourceEvent.movementX*G,y:xe[1]-pe.sourceEvent.movementY*G},ve=[[0,0],[Me,_e]],We=Kr.translate(he.x,he.y).scale(xe[2]),at=He.constrain()(We,ve,De);He.transform(je,at)},fe=tC().on("zoom",N?se:null).on("zoom.wheel",b?X:null);return L.call(fe),()=>{L.on("zoom",null)}}},[N,b,k,E]);const J=y?L=>{const X=sr(L);y(L,{x:X[0],y:X[1]})}:void 0,D=w?(L,X)=>{const se=C.getState().nodeInternals.get(X);w(L,se)}:void 0;return ue.createElement(aw,{position:g,style:e,className:Ht(["react-flow__minimap",t]),"data-testid":"rf__minimap"},ue.createElement("svg",{width:M,height:A,viewBox:`${re} ${Q} ${H} ${te}`,role:"img","aria-labelledby":$,ref:I,onClick:J},_&&ue.createElement("title",{id:$},_),ue.createElement(R$,{onClick:D,nodeColor:s,nodeStrokeColor:n,nodeBorderRadius:a,nodeClassName:i,nodeStrokeWidth:l,nodeComponent:u}),ue.createElement("path",{className:"react-flow__minimap-mask",d:`M${re-U},${Q-U}h${H+U*2}v${te+U*2}h${-H-U*2}z
57
+ M${O.x},${O.y}h${O.width}v${O.height}h${-O.width}z`,fill:h,fillRule:"evenodd",stroke:p,strokeWidth:f,pointerEvents:"none"})))}VC.displayName="MiniMap";var P$=S.memo(VC);function $$(){return ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},ue.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function L$(){return ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},ue.createElement("path",{d:"M0 0h32v4.2H0z"}))}function q$(){return ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},ue.createElement("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"}))}function D$(){return ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},ue.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"}))}function F$(){return ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},ue.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"}))}const Sr=({children:e,className:t,...n})=>ue.createElement("button",{type:"button",className:Ht(["react-flow__controls-button",t]),...n},e);Sr.displayName="ControlButton";const z$=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom}),YC=({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:s=!0,fitViewOptions:i,onZoomIn:a,onZoomOut:l,onFitView:u,onInteractiveChange:h,className:p,children:f,position:g="bottom-left"})=>{const y=Rt(),[w,N]=S.useState(!1),{isInteractive:b,minZoomReached:_,maxZoomReached:k}=it(z$,$t),{zoomIn:E,zoomOut:j,fitView:C}=gl();if(S.useEffect(()=>{N(!0)},[]),!w)return null;const I=()=>{E(),a==null||a()},P=()=>{j(),l==null||l()},O=()=>{C(i),u==null||u()},F=()=>{y.setState({nodesDraggable:!b,nodesConnectable:!b,elementsSelectable:!b}),h==null||h(!b)};return ue.createElement(aw,{className:Ht(["react-flow__controls",p]),position:g,style:e,"data-testid":"rf__controls"},t&&ue.createElement(ue.Fragment,null,ue.createElement(Sr,{onClick:I,className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:k},ue.createElement($$,null)),ue.createElement(Sr,{onClick:P,className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:_},ue.createElement(L$,null))),n&&ue.createElement(Sr,{className:"react-flow__controls-fitview",onClick:O,title:"fit view","aria-label":"fit view"},ue.createElement(q$,null)),s&&ue.createElement(Sr,{className:"react-flow__controls-interactive",onClick:F,title:"toggle interactivity","aria-label":"toggle interactivity"},b?ue.createElement(F$,null):ue.createElement(D$,null)),f)};YC.displayName="Controls";var B$=S.memo(YC),lr;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(lr||(lr={}));function U$({color:e,dimensions:t,lineWidth:n}){return ue.createElement("path",{stroke:e,strokeWidth:n,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`})}function W$({color:e,radius:t}){return ue.createElement("circle",{cx:t,cy:t,r:t,fill:e})}const H$={[lr.Dots]:"#91919a",[lr.Lines]:"#eee",[lr.Cross]:"#e2e2e2"},G$={[lr.Dots]:1,[lr.Lines]:1,[lr.Cross]:6},V$=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function KC({id:e,variant:t=lr.Dots,gap:n=20,size:s,lineWidth:i=1,offset:a=2,color:l,style:u,className:h}){const p=S.useRef(null),{transform:f,patternId:g}=it(V$,$t),y=l||H$[t],w=s||G$[t],N=t===lr.Dots,b=t===lr.Cross,_=Array.isArray(n)?n:[n,n],k=[_[0]*f[2]||1,_[1]*f[2]||1],E=w*f[2],j=b?[E,E]:k,C=N?[E/a,E/a]:[j[0]/a,j[1]/a];return ue.createElement("svg",{className:Ht(["react-flow__background",h]),style:{...u,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:p,"data-testid":"rf__background"},ue.createElement("pattern",{id:g+e,x:f[0]%k[0],y:f[1]%k[1],width:k[0],height:k[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${C[0]},-${C[1]})`},N?ue.createElement(W$,{color:y,radius:E/a}):ue.createElement(U$,{dimensions:j,color:y,lineWidth:i})),ue.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${g+e})`}))}KC.displayName="Background";var Y$=S.memo(KC);const K$=["us-gov","global","apac","us","eu","jp","au"],X$=new RegExp(`^(?:(?:${K$.join("|")})\\.)?anthropic\\.`,"i");function vl(e){return e.replace(X$,"")}function XC(){return{inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0}}function yw(e){const t=e.cache_creation,n=t&&typeof t=="object"?t:e,s=n.ephemeral_1h_input_tokens,i=n.ephemeral_5m_input_tokens;return typeof s!="number"&&typeof i!="number"?{}:{cacheCreate1hTokens:Number(s??0),cacheCreate5mTokens:Number(i??0)}}function Q$(e){const t=yw(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 Z$(e){if(!e||typeof e!="object"||Array.isArray(e))return;const t={};for(const[n,s]of Object.entries(e))!n||!s||typeof s!="object"||(t[n]=Q$(s));return Object.keys(t).length?t:void 0}function QC(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),...yw(n)};for(const s of Object.values(n)){const i=QC(s,t+1);if(i)return i}return null}const J$=/^(?:claude[-_]|gpt[-_]|o\d|codex[-_])/i;function ZC(e,t=0){if(!e||typeof e!="object"||t>6)return null;const n=e;if(typeof n.model=="string"&&J$.test(vl(n.model)))return n.model;for(const s of Object.values(n)){const i=ZC(s,t+1);if(i)return i}return null}function $y(){return{agents:new Map,toolIndex:new Map,toolOwner:new Map,activeSubagentStack:new Map,lastSeq:0,seqEpoch:null,totalEvents:0,revision:0}}function Ms(e){if(!e)return;const t=e.replace(/\\/g,"/").split("/").filter(Boolean);return t[t.length-1]}function Vb(){return{msgsUser:0,msgsAssistant:0,toolUses:0,toolResults:0,systemReminders:0,currentContextTokens:0,memoryFiles:[]}}function yl(e,t){return`${e}::${t}`}function wu(e){return e.agent_type??e.subagent_type??"subagent"}function Za(e){return e.agent_id?e.agent_id:e.parent_tool_use_id?e.parent_tool_use_id:null}function Ci(e,t,n,s){const i=t;let a=e.agents.get(i);return a||(a={id:i,sessionId:t,label:"session",kind:"root",state:"active",startedAt:n,lastEventAt:n,tools:[],prompts:[],toolCount:0,childCount:0,synthetic:s,usage:XC()},e.agents.set(i,a),a)}function JC(e,t,n,s){const i=yl(t,n),a=e.agents.get(i);if(!a)return null;!a.cwd&&s.cwd&&(a.cwd=s.cwd,a.cwdBasename=Ms(s.cwd));const l=wu(s);return l&&(a.label==="subagent"||!a.label)&&(a.label=l),a}function eL(e,t,n){const s=t.session_id??"unknown",i=Za(t);if(i){const h=JC(e,s,i,t);if(h)return h}const a=e.activeSubagentStack.get(s),l=a&&a.length>0?a[a.length-1]:null;if(l){const h=e.agents.get(yl(s,l));if(h)return!h.cwd&&t.cwd&&(h.cwd=t.cwd,h.cwdBasename=Ms(t.cwd)),h}const u=Ci(e,s,n,t.hook_event_name!=="SessionStart");return!u.cwd&&t.cwd&&(u.cwd=t.cwd,u.cwdBasename=Ms(t.cwd)),u.label==="session"&&t.cwd&&(u.label=Ms(t.cwd)??"session"),u}function tL(e,t,n,s,i){const a=yl(t,n),l=Ci(e,t,i,!0);let u=e.agents.get(a);if(u){!u.cwd&&s.cwd&&(u.cwd=s.cwd,u.cwdBasename=Ms(s.cwd));const h=wu(s);return h&&(u.label==="subagent"||!u.label)&&(u.label=h),u}return u={id:a,sessionId:t,label:wu(s),kind:"subagent",parentId:l.id,state:"active",startedAt:i,tools:[],prompts:[],cwd:s.cwd,cwdBasename:Ms(s.cwd),toolCount:0,childCount:0,usage:XC()},e.agents.set(a,u),l.childCount+=1,u}function nL(e,t,n){const s=e.activeSubagentStack.get(t)??[];s.includes(n)||(s.push(n),e.activeSubagentStack.set(t,s))}function rL(e,t,n){const s=e.activeSubagentStack.get(t);if(s){for(let i=s.length-1;i>=0;i--)if(s[i]===n){s.splice(i,1);break}s.length===0&&e.activeSubagentStack.delete(t)}}function Yc(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 Yb=200,sL=25;function oL(e,t){const n=t.tools;if(n.length>Yb){const s=n.splice(0,n.length-Yb);for(const i of s)e.toolIndex.get(i.id)===i&&(e.toolIndex.delete(i.id),e.toolOwner.delete(i.id))}for(let s=n.length-sL-1;s>=0;s--){const i=n[s];if(i.trimmed)break;i.input=void 0,i.response=void 0,i.trimmed=!0}}function iL(e,t,n){const s=e.toolIndex.get(n);if(s)return s;for(let i=t.tools.length-1;i>=0;i--)if(t.tools[i].id===n)return t.tools[i];return null}const Kb=2e3;function aL(e,t,n){for(let s=e.prompts.length-1;s>=0;s--){const i=e.prompts[s];if(i.at<t-Kb)return!1;if(i.text===n&&i.at<=t+Kb)return!0}return!1}function eT(e,t){for(const n of t.tools)e.toolIndex.get(n.id)===n&&e.toolIndex.delete(n.id),e.toolOwner.get(n.id)===t.id&&e.toolOwner.delete(n.id)}function wl(e,t){return t&&(e.revision+=1),t}function lL(e,t,n,s){if(e.agents.size<=n)return!1;const i=p=>p.state==="done"&&p.endedAt!=null&&t-p.endedAt>s,a=[],l=new Map;for(const[p,f]of e.agents){if(f.parentId!=null){const g=l.get(f.parentId);g?g.push(p):l.set(f.parentId,[p])}i(f)&&a.push({id:p,endedAt:f.endedAt})}if(a.length===0)return!1;a.sort((p,f)=>p.endedAt-f.endedAt);let u=0;const h=p=>{const f=e.agents.get(p);f&&(eT(e,f),e.agents.delete(p),u++)};for(const p of a){if(e.agents.size<=n)break;if(!e.agents.has(p.id))continue;const f=(l.get(p.id)??[]).map(g=>e.agents.get(g)).filter(g=>g!=null);if(!f.some(g=>!i(g))){for(const g of f)h(g.id);h(p.id)}}return wl(e,u>0)}function cL(e,t,n,s){const i=new Map;for(const[p,f]of e.agents){let g=i.get(f.sessionId);g||(g={ids:[],endedAt:0,live:!1,closed:!1},i.set(f.sessionId,g)),g.ids.push(p),f.kind==="root"&&f.closedAt!=null&&(g.closed=!0),f.state==="done"&&f.endedAt!=null?g.endedAt=Math.max(g.endedAt,f.endedAt):g.live=!0}const a=[...i.values()].filter(p=>!p.live&&p.endedAt>0&&t-p.endedAt>s).sort((p,f)=>p.closed===f.closed?p.endedAt-f.endedAt:p.closed?-1:1);let u=[...i.values()].filter(p=>!p.live).length-n;if(u<=0)return!1;let h=!1;for(const p of a){if(u<=0)break;for(const f of p.ids){const g=e.agents.get(f);g&&eT(e,g),e.agents.delete(f)}u--,h=!0}return wl(e,h)}function uL(e,t){const n=t==null?void 0:t.payload,s=n==null?void 0:n.hook_event_name;if(s!=="PostToolUse"&&s!=="PostToolUseFailure")return!1;const i=n==null?void 0:n.tool_use_id;return typeof i=="string"&&i.length>0&&e.toolIndex.has(i)}function dL(e){let t=!1;for(const n of e.agents.values())for(const s of n.tools)s.endedAt!=null||s.outcomeGap||(s.outcomeGap=!0,t=!0);return wl(e,t)}function fL(e,t,n){let s=!1;for(const i of e.agents.values()){if(i.provider==="codex")continue;const a=e.agents.get(i.sessionId),l=(a==null?void 0:a.lastEventAt)??(a==null?void 0:a.startedAt);for(const u of i.tools){const h=Math.max(u.startedAt,l??u.startedAt);u.endedAt==null&&t-h>n&&(u.endedAt=h,u.ok=!1,u.errorPreview=u.outcomeGap?"no result reached the deck — events were dropped while the deck was paused":"session ended before this call returned",e.toolIndex.delete(u.id),e.toolOwner.delete(u.id),s=!0)}}return wl(e,s)}const Xb=90*6e4;function hL(e,t,n){let s=!1;for(const i of e.agents.values()){if(i.kind!=="root")continue;const a=i.lastEventAt??i.startedAt;if(!(t-a<=n)){i.waiting&&(i.waiting=null,s=!0),i.closedAt==null&&(i.closedAt=a),i.state==="active"&&(i.state="done",i.endedAt=a,i.reaped=!0,s=!0);for(const l of e.agents.values())l.sessionId!==i.sessionId||l.kind==="root"||l.state!=="active"||(l.state="done",l.endedAt=a,s=!0);e.activeSubagentStack.delete(i.sessionId)}}return wl(e,s)}function pL(e){return e==="permission_prompt"?"permission":e==="idle_prompt"?"idle":null}const mL=new Set(["Notification","ModelObserved","ContextObserved","UsageObserved","SessionNamed"]);function gL(e,t){let n=null;for(const s of e.toolIndex.values()){const i=s.agentId?e.agents.get(s.agentId):void 0;!i||i.sessionId!==t||(!n||s.startedAt>n.startedAt)&&(n=s)}return n==null?void 0:n.explicitSubagentId}function vL(e,t,n,s,i){const a=n==="permission"?gL(e,t):void 0;return a?{kind:n,message:s,since:i,subagentId:a}:{kind:n,message:s,since:i}}function yL(e,t,n){if(e.kind!=="permission")return!0;const s=Za(t);return s==null?!0:e.subagentId!=null&&yl(n,s)===e.subagentId}function Qb(e,t){const n=t.epoch??null;if(n!==null&&n!==e.seqEpoch)e.seqEpoch=n,e.lastSeq=0;else if(t.seq<=e.lastSeq)return e;const s=t.payload??{},i=t.receivedAt,a=s.hook_event_name??"Unknown";if(a==="__clear")return{...$y(),lastSeq:t.seq,seqEpoch:e.seqEpoch,revision:e.revision+1};e.totalEvents+=1,e.lastSeq=t.seq,e.revision+=1;const l=s.session_id??"unknown";if(!mL.has(a)){const f=e.agents.get(l);f!=null&&f.waiting&&yL(f.waiting,s,l)&&(f.waiting=null)}const u=e.agents.get(l);if(u&&i>(u.lastEventAt??0)&&(u.lastEventAt=i,u.reaped&&(u.reaped=!1,u.state="active",u.endedAt=void 0,u.closedAt=void 0)),typeof s.model_context_window=="number"&&s.model_context_window>0){const f=e.agents.get(l);f&&(f.contextWindow=s.model_context_window)}if(typeof s.approval_policy=="string"&&s.approval_policy){const f=e.agents.get(l);f&&(f.approvalPolicy=s.approval_policy)}if(typeof s.context_tokens=="number"&&s.context_tokens>=0){const f=e.agents.get(l);f&&(f.context={...f.context??Vb(),currentContextTokens:s.context_tokens})}if(a==="ModelObserved"){const f=typeof s.model=="string"?s.model:null;if(f){const y=e.agents.get(l);y&&(y.model=f)}const g=s.subagentModels;if(g&&typeof g=="object")for(const[y,w]of Object.entries(g)){if(typeof w!="string")continue;const N=`${l}::${y}`,b=e.agents.get(N);b&&(b.model=w)}return e}if(a==="ContextObserved"){const f=s.context??null;if(f){const g=e.agents.get(l);if(g){const y=g.context??Vb(),w=(b,_)=>typeof f[b]=="number"?f[b]:_,N=Array.isArray(f.memoryFiles)?f.memoryFiles:Array.isArray(f.claudeMdFiles)?f.claudeMdFiles:null;g.context={msgsUser:w("msgsUser",y.msgsUser),msgsAssistant:w("msgsAssistant",y.msgsAssistant),toolUses:w("toolUses",y.toolUses),toolResults:w("toolResults",y.toolResults),systemReminders:w("systemReminders",y.systemReminders),currentContextTokens:w("currentContextTokens",y.currentContextTokens),memoryFiles:N??y.memoryFiles}}}return e}if(a==="SessionNamed"){const f=e.agents.get(l);if(f){const g=typeof s.sessionName=="string"?s.sessionName.trim():"",y=typeof s.sessionTitle=="string"?s.sessionTitle.trim():"";g&&(f.sessionName=g),y&&(f.sessionTitle=y);const w=f.sessionName??"";f.sessionTitle&&w&&f.sessionTitle.toLowerCase()===w.toLowerCase()&&(f.sessionTitle=void 0)}return e}if(a==="UsageObserved"){const f=s.usage??null;if(f){const g=e.agents.get(l);if(g){g.usage.inputTokens=Number(f.input_tokens??0),g.usage.outputTokens=Number(f.output_tokens??0),g.usage.cacheReadTokens=Number(f.cache_read_input_tokens??f.cached_input_tokens??0),g.usage.cacheCreateTokens=Number(f.cache_creation_input_tokens??f.cache_write_input_tokens??0);const y=yw(f);g.usage.cacheCreate1hTokens=y.cacheCreate1hTokens,g.usage.cacheCreate5mTokens=y.cacheCreate5mTokens,typeof f.reasoning_output_tokens=="number"&&(g.usage.reasoningOutputTokens=Number(f.reasoning_output_tokens)),g.usageByModel=Z$(s.usageByModel)}}return e}const h=eL(e,s,i);h.provider||(h.provider=s.provider==="codex"?"codex":"claude");const p=ZC(s);switch(p&&(h.model=p),a){case"SessionStart":{const f=Ci(e,l,i,!1);f.synthetic=!1,f.state="active",f.closedAt=void 0,f.startedAt=f.startedAt||i,!f.cwd&&s.cwd&&(f.cwd=s.cwd,f.cwdBasename=Ms(s.cwd)),f.label==="session"&&s.cwd&&(f.label=Ms(s.cwd)??"session");break}case"UserPromptSubmit":{for(const y of e.agents.values())y.sessionId===l&&y.kind==="subagent"&&y.state==="done"&&y.exitAt==null&&y.endedAt!=null&&y.endedAt<i&&(y.exitAt=i);const f=Ci(e,l,i,!1);f.state="active",f.endedAt=void 0,f.closedAt=void 0,f.exitAt=void 0;const g=(typeof s.prompt=="string"?s.prompt:typeof s.message=="string"?s.message:"")??"";g&&!aL(f,i,g)&&(f.prompts.push({at:i,text:g}),f.firstPrompt||(f.firstPrompt=Yc(g,120)));break}case"PreToolUse":{const f=s.tool_use_id?iL(e,h,s.tool_use_id):null;if(f){s.tool_name&&f.name==="?"&&(f.name=s.tool_name),f.endedAt==null&&!f.trimmed&&s.tool_input!==void 0&&(f.input=s.tool_input,f.inputPreview=Yc(s.tool_input));break}const g=s.tool_use_id??`${h.id}:${h.toolCount}`,y=Za(s),w={id:g,name:s.tool_name??"?",input:s.tool_input,inputPreview:Yc(s.tool_input),agentId:h.id,explicitSubagentId:y?yl(l,y):void 0,startedAt:i};h.tools.push(w),h.toolCount+=1,h.state="active",e.toolIndex.set(g,w),e.toolOwner.set(g,h.id),oL(e,h);break}case"PostToolUse":case"PostToolUseFailure":{const f=s.tool_use_id;if(!f)break;let g=e.toolIndex.get(f),y=!1;if(!g)for(const N of e.agents.values()){const b=N.tools.find(_=>_.id===f);if(b){g=b,y=!0;break}}if(!g||g.outcomeApplied)break;g.outcomeApplied=!0,g.outcomeGap=void 0,g.endedAt=i,g.ok=a==="PostToolUse",g.trimmed||(g.response=s.tool_response),a==="PostToolUseFailure"?g.errorPreview=Yc(s.tool_response):y&&(g.errorPreview=void 0);const w=QC(s.tool_response);w&&(g.usage=w),e.toolIndex.delete(f),e.toolOwner.delete(f);break}case"SubagentStart":{const f=Za(s);if(!f)break;const g=tL(e,l,f,s,i);g.state="active",g.startedAt=g.startedAt||i,g.exitAt=void 0,g.endedAt=void 0;const y=wu(s);y&&(g.label=y),nL(e,l,f);break}case"SubagentStop":{const f=Za(s);if(!f)break;const g=JC(e,l,f,s);if(!g)break;g.state="done",g.endedAt=i,rL(e,l,f);break}case"Stop":case"SessionEnd":{const f=Ci(e,l,i,!1);f.state="done",f.endedAt=i,a==="SessionEnd"&&(f.closedAt=i),e.activeSubagentStack.delete(l);break}case"Notification":{const f=pL(s.notification_type);if(!f)break;const g=Ci(e,l,i,!1),y=typeof s.message=="string"?s.message:"",w=g.waiting;g.waiting=w&&w.kind===f&&w.message===y?{...w,since:Math.min(w.since,i)}:vL(e,l,f,y,i);break}}return e}function ww(e){let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t^e.charCodeAt(n);return Math.abs(t)%360}const wL={input:2,output:10,cacheRead:.2,cacheWrite:2.5,cacheWrite1h:4},xL=[{match:/^claude[-_](fable|mythos)[-_]5[-_.]1\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:10,output:50,cacheRead:.25,cacheWrite:12.5,cacheWrite1h:20}},{match:/^claude[-_](fable|mythos)[-_]5\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:10,output:50,cacheRead:1,cacheWrite:12.5,cacheWrite1h:20}},{match:/^claude[-_]opus[-_]5\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:5,output:25,cacheRead:.5,cacheWrite:6.25,cacheWrite1h:10}},{match:/^claude[-_]sonnet[-_]5\b(?![-_.]\d{1,7}(?!\d))/i,rates:wL},{match:/^claude[-_]opus[-_]4[-_.](?:5|6|7|8)\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:5,output:25,cacheRead:.5,cacheWrite:6.25,cacheWrite1h:10}},{match:/^claude[-_]opus[-_]4(?:[-_.]1)?\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75,cacheWrite1h:30}},{match:/^claude[-_]sonnet[-_]4[-_.](?:5|6)\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:3,output:15,cacheRead:.3,cacheWrite:3.75,cacheWrite1h:6}},{match:/^claude[-_]sonnet[-_]4\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:3,output:15,cacheRead:.3,cacheWrite:3.75,cacheWrite1h:6}},{match:/^claude[-_]haiku[-_]4[-_.]5\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:1,output:5,cacheRead:.1,cacheWrite:1.25,cacheWrite1h:2}},{match:/^claude[-_]haiku[-_]3[-_.]5\b(?![-_.]\d{1,7}(?!\d))/i,rates:{input:.8,output:4,cacheRead:.08,cacheWrite:1,cacheWrite1h:1.6}},{match:/^gpt[-_]5[-_.]6[-_]cyber/i,rates:{input:12.5,output:75,cacheRead:1.25,cacheWrite:0}},{match:/^gpt[-_]5[-_.]6[-_]luna/i,rates:{input:.2,output:1.2,cacheRead:.02,cacheWrite:.25}},{match:/^gpt[-_]5[-_.]6[-_]terra/i,rates:{input:2,output:12,cacheRead:.2,cacheWrite:2.5}},{match:/^gpt[-_]5[-_.]6(?:[-_]sol)?\b/i,rates:{input:5,output:30,cacheRead:.5,cacheWrite:6.25}},{match:/^gpt[-_]5[-_.]5[-_]pro/i,rates:{input:30,output:180,cacheRead:30,cacheWrite:0}},{match:/^gpt[-_]5[-_.]5\b/i,rates:{input:5,output:30,cacheRead:.5,cacheWrite:0}},{match:/^gpt[-_]5[-_.]4[-_]pro/i,rates:{input:30,output:180,cacheRead:3,cacheWrite:0}},{match:/^gpt[-_]5[-_.]4[-_]mini/i,rates:{input:.75,output:4.5,cacheRead:.075,cacheWrite:0}},{match:/^gpt[-_]5[-_.]4[-_]nano/i,rates:{input:.2,output:1.25,cacheRead:.02,cacheWrite:0}},{match:/^gpt[-_]5[-_.]4\b/i,rates:{input:2.5,output:15,cacheRead:.25,cacheWrite:0}},{match:/^gpt[-_]5[-_.]3[-_]codex/i,rates:{input:1.75,output:14,cacheRead:.175,cacheWrite:0}},{match:/^gpt[-_]5[-_.]2[-_]pro/i,rates:{input:21,output:168,cacheRead:21,cacheWrite:0}},{match:/^gpt[-_]5[-_.]2\b/i,rates:{input:1.75,output:14,cacheRead:.175,cacheWrite:0}},{match:/^gpt[-_]5[-_.]1[-_]codex[-_]mini/i,rates:{input:.25,output:2,cacheRead:.025,cacheWrite:0}},{match:/^gpt[-_]5[-_.]1(?!\d)/i,rates:{input:1.25,output:10,cacheRead:.125,cacheWrite:0}},{match:/^gpt[-_]5[-_]pro\b/i,rates:{input:15,output:120,cacheRead:15,cacheWrite:0}},{match:/^gpt[-_]5[-_]mini/i,rates:{input:.25,output:2,cacheRead:.025,cacheWrite:0}},{match:/^gpt[-_]5[-_]nano/i,rates:{input:.05,output:.4,cacheRead:.005,cacheWrite:0}},{match:/^gpt[-_]5(?![-_.]\d)/i,rates:{input:1.25,output:10,cacheRead:.125,cacheWrite:0}},{match:/^codex[-_]mini/i,rates:{input:1.5,output:6,cacheRead:.375,cacheWrite:0}},{match:/^o1[-_]pro/i,rates:{input:150,output:600,cacheRead:150,cacheWrite:0}},{match:/^o1[-_]mini/i,rates:{input:1.1,output:4.4,cacheRead:.55,cacheWrite:0}},{match:/^o1\b/i,rates:{input:15,output:60,cacheRead:7.5,cacheWrite:0}},{match:/^o3[-_]deep[-_]research/i,rates:{input:10,output:40,cacheRead:2.5,cacheWrite:0}},{match:/^o3[-_]mini/i,rates:{input:1.1,output:4.4,cacheRead:.55,cacheWrite:0}},{match:/^o3[-_]pro/i,rates:{input:20,output:80,cacheRead:20,cacheWrite:0}},{match:/^o4[-_]mini[-_]deep[-_]research/i,rates:{input:2,output:8,cacheRead:.5,cacheWrite:0}},{match:/^o4[-_]mini/i,rates:{input:1.1,output:4.4,cacheRead:.275,cacheWrite:0}},{match:/^o3\b/i,rates:{input:2,output:8,cacheRead:.5,cacheWrite:0}}];function bL(e){return e?/^(?:gpt[-_]|codex[-_]|o\d)/i.test(e):!1}function Hi(e,t=Date.now()){if(!e)return null;const n=vl(e);for(const s of xL)if(s.match.test(n))return typeof s.rates=="function"?s.rates(t):s.rates;return null}function tT(e,t){const n=Math.max(0,e.cacheCreate1hTokens??0),s=Math.max(0,e.cacheCreate5mTokens??0),i=Math.max(0,e.cacheCreateTokens-n-s),a=s+i,l=t.cacheWrite1h??t.cacheWrite;return{tokens5m:a,tokens1h:n,usd5m:a*t.cacheWrite/1e6,usd1h:n*l/1e6}}function nT(e,t,n=Date.now()){if(!bL(t))return e.inputTokens;const s=Hi(t,n),i=((s==null?void 0:s.cacheWrite)??0)>0?Math.max(0,e.cacheCreateTokens):0;return Math.max(0,e.inputTokens-e.cacheReadTokens-i)}function xw(e,t,n=Date.now()){const s=Hi(t,n);if(!s)return{input:0,output:0,cacheRead:0,cacheWrite:0,total:0};const i=nT(e,t,n)*s.input/1e6,a=e.outputTokens*s.output/1e6,l=e.cacheReadTokens*s.cacheRead/1e6,u=tT(e,s),h=u.usd5m+u.usd1h;return{input:i,output:a,cacheRead:l,cacheWrite:h,total:i+a+l+h}}const Zb=2e5,_L=1e6,kL=[/\[1m\]/i,/^claude[-_]opus[-_]5\b/i,/^claude[-_]sonnet[-_]5\b/i,/^claude[-_]opus[-_]4[-_.](?:5|6|7|8)\b/i,/^claude[-_]sonnet[-_]4[-_.]6\b/i,/^claude[-_](fable|mythos)[-_]5\b/i],SL=[{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 NL(e){if(!e)return Zb;const t=vl(e);for(const n of kL)if(n.test(t))return _L;for(const n of SL)if(n.match.test(t))return n.window;return Zb}function rT(e,t){return typeof e=="number"&&e>0?e:NL(t)}const Ei="not priced";function Ve(e){if(e<=0)return"—";if(e<.005)return"<1¢";if(e<1){const t=(e*100).toFixed(e<.1?1:0);if(Number(t)<100)return`${t}¢`}return e<100?`$${e.toFixed(2)}`:e<1e4?`$${e.toFixed(0)}`:`$${(e/1e3).toFixed(1)}k`}function xu(e,t){if(e<=0||t<10)return null;const n=e/t,s=n*60;return s>=.01?`${Ve(s)}/min`:`${Ve(n*3600)}/hr`}function EL(e,t){const n={inputTokens:e.inputTokens+t.inputTokens,outputTokens:e.outputTokens+t.outputTokens,cacheReadTokens:e.cacheReadTokens+t.cacheReadTokens,cacheCreateTokens:e.cacheCreateTokens+t.cacheCreateTokens};return(e.cacheCreate1hTokens!==void 0||e.cacheCreate5mTokens!==void 0||t.cacheCreate1hTokens!==void 0||t.cacheCreate5mTokens!==void 0)&&(n.cacheCreate1hTokens=(e.cacheCreate1hTokens??0)+(t.cacheCreate1hTokens??0),n.cacheCreate5mTokens=(e.cacheCreate5mTokens??0)+(t.cacheCreate5mTokens??0)),(e.reasoningOutputTokens!==void 0||t.reasoningOutputTokens!==void 0)&&(n.reasoningOutputTokens=(e.reasoningOutputTokens??0)+(t.reasoningOutputTokens??0)),n}function jL(e,t){let n=0,s=0,i=0,a=0,l=0,u=0;for(const g of t)n+=g.inputTokens,s+=g.outputTokens,i+=g.cacheReadTokens,a+=g.cacheCreateTokens,l+=g.cacheCreate1hTokens??0,u+=g.cacheCreate5mTokens??0;const h=(g,y)=>Math.max(0,g-y),p={inputTokens:h(e.inputTokens,n),outputTokens:h(e.outputTokens,s),cacheReadTokens:h(e.cacheReadTokens,i),cacheCreateTokens:h(e.cacheCreateTokens,a)};return(e.cacheCreate1hTokens!==void 0||e.cacheCreate5mTokens!==void 0)&&(p.cacheCreate1hTokens=h(e.cacheCreate1hTokens??0,l),p.cacheCreate5mTokens=h(e.cacheCreate5mTokens??0,u)),p.inputTokens+p.outputTokens+p.cacheReadTokens+p.cacheCreateTokens>0?p:null}function xl(e){const t=e.usageByModel,n=t?Object.keys(t):[];if(!t||n.length===0)return[{model:e.model,usage:e.usage}];const s=n.map(a=>({model:a,usage:t[a]})),i=jL(e.usage,s.map(a=>a.usage));if(i){const a=s.findIndex(l=>l.model===e.model);a>=0?s[a]={model:s[a].model,usage:EL(s[a].usage,i)}:s.push({model:e.model,usage:i})}return s}function _n(e,t=Date.now()){const n={input:0,output:0,cacheRead:0,cacheWrite:0,total:0};for(const s of xl(e)){const i=xw(s.usage,s.model,t);n.input+=i.input,n.output+=i.output,n.cacheRead+=i.cacheRead,n.cacheWrite+=i.cacheWrite,n.total+=i.total}return n}function Ly(e,t=Date.now()){let n=0;for(const s of xl(e))Hi(s.model,t)==null&&(n+=s.usage.inputTokens+s.usage.outputTokens);return n}function sT(e){const t=[];for(const n of xl(e)){if(!n.model||t.includes(n.model))continue;const s=n.usage;s.inputTokens+s.outputTokens+s.cacheReadTokens+s.cacheCreateTokens<=0||t.push(n.model)}return t}function oT(e){return sT(e).filter(t=>t!==e.model)}const CL=new Set(["untrusted","on-request","on-failure"]);function TL(e){return typeof e!="string"||!e?null:CL.has(e)?!0:e==="never"?!1:null}function RL(e){if(e.provider!=="codex"||e.kind!=="root"||e.waiting||e.state!=="active")return null;const t=TL(e.approvalPolicy);return t===!1?null:{label:"approvals not visible",detail:`${t===!0?`This session's approval policy is "${e.approvalPolicy}", so Codex can stop and ask you to approve a command.`:"This session's approval policy has not been read yet, so it may be able to stop and ask you to approve a command."}
58
+
59
+ Codex writes no approval request to its rollout files, which are the only thing this deck can read — so when it does ask, this card, the sidebar, the topbar count, the tab title and the favicon will all stay silent. Check the terminal.`}}function Jb(e){return e[0].toUpperCase()+e.slice(1).toLowerCase()}function Is(e){const t=vl(e).replace(/[-_]\d{8}(?!\d)/,""),n=t.match(/^claude[-_](opus|sonnet|haiku|fable|mythos)[-_](\d+(?:[-_.]\d+)*)/i);if(n){const i=Jb(n[1]),a=n[2].replace(/[-_]/g,".");return`${i} ${a}`}const s=t.match(/^gpt[-_](\d+(?:[-_.]\d+)*)((?:[-_][A-Za-z0-9.]+)*)$/i);if(s){const i=s[1].replace(/[-_]/g,"."),a=s[2].split(/[-_]/).filter(Boolean).map(Jb);return[`GPT-${i}`,...a].join(" ")}return e}function Pu(e){const t=vl(e??""),n=t.match(/^claude[-_](opus|sonnet|haiku|fable|mythos)[-_]/i);return n?n[1].toLowerCase():/^gpt[-_]/i.test(t)?"gpt":""}function Ct(e){return e<1e3?`${e}`:e<1e6?`${(e/1e3).toFixed(1)}k`:e<1e9?`${(e/1e6).toFixed(2)}M`:`${(e/1e9).toFixed(2)}B`}function bu(e,t,n){const s=(t??n)-e;if(s<1e3)return`${Math.max(0,s)}ms`;const i=Math.floor(s/1e3);if(i<60)return`${i}s`;const a=Math.floor(i/60),l=i%60;return`${a}m ${String(l).padStart(2,"0")}s`}function iT(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 aT(e,t){const n=typeof e=="string"?e.trim():"",s=typeof t=="string"?t.trim():"";return{face:n||s||void 0,tooltip:s||n||void 0}}const AL=1,lT=-1;function ML(){const e=[];let t=0;function n(){let s;for(const i of e)(!s||i.layer>s.layer||i.layer===s.layer&&i.seq>s.seq)&&(s=i);return s}return{push(s,i=0){const a={dismiss:s,layer:i,seq:t++};return e.push(a),()=>{const l=e.indexOf(a);l!==-1&&e.splice(l,1)}},dismissTop(){const s=n();return s?(s.dismiss(),!0):!1},isTop(s){const i=n();return i!=null&&i.dismiss===s},depth(){return e.length},topIsPanel(){const s=n();return s!=null&&s.layer===lT}}}const Ii=ML();function IL(e){return e.overlayOpen&&!e.panelOnTop?"dismiss":e.typing?"blur":e.overlayOpen?"dismiss":"clear-selection"}function e1(e){return String(e.tagName??"").toUpperCase()==="BODY"}function OL(e,t){return!e||!e.isConnected||e1(e)?!1:t==null||e1(t)}const t1="a[href], button, input, select, textarea, [tabindex]";function PL(e){return!e||e.disabled||e.rendered===!1?!1:(e.tabIndex??0)>=0}function $L(e){if(!e||!e.overflowing||e.hasFocusable)return!1;const t=String(e.overflow??"").toLowerCase();return t==="auto"||t==="scroll"}function LL({count:e,index:t,shiftKey:n}){return e<=0?{kind:"hold"}:t<0||t>=e?{kind:"focus",index:n?e-1:0}:!n&&t===e-1?{kind:"focus",index:0}:n&&t===0?{kind:"focus",index:e-1}:{kind:"allow"}}function bw(e){return e.ctrlKey||e.metaKey||e.altKey}const qL=new Set(["button","checkbox","color","file","image","radio","range","reset","submit"]),DL=new Set(["INPUT","TEXTAREA","SELECT","OPTION","BUTTON","SUMMARY","A"]),FL=new Set(["button","checkbox","combobox","link","listbox","menu","menubar","menuitem","menuitemcheckbox","menuitemradio","option","radio","searchbox","slider","spinbutton","switch","tab","textbox","treeitem"]);function cT(e){return typeof e.tagName=="string"?e.tagName.toUpperCase():""}function _w(e){if(!e)return!1;if(e.isContentEditable)return!0;const t=cT(e);return t==="TEXTAREA"?!0:t!=="INPUT"?!1:!qL.has(String(e.type??"text").toLowerCase())}function zL(e){if(!e)return!1;if(_w(e)||DL.has(cT(e)))return!0;const t=typeof e.role=="string"?e.role.trim().toLowerCase():"";return t!==""&&t.split(/\s+/).some(n=>FL.has(n))}function BL({key:e,modalOpen:t,sheetOpen:n}){return t?!(e==="?"&&n):!1}function uT(e){return e?Array.from(e.querySelectorAll("*")).filter(t=>{if(t.matches(t1))return PL({disabled:t.disabled,tabIndex:t.tabIndex,rendered:t.getClientRects().length>0});const n=t.scrollHeight>t.clientHeight;return n&&$L({overflowing:n,overflow:getComputedStyle(t).overflowY,hasFocusable:t.querySelector(t1)!=null})}):[]}function UL(e,t){const n=uT(e);if(!t||!e.contains(t)||n.includes(t))return n;const s=n.findIndex(i=>(t.compareDocumentPosition(i)&Node.DOCUMENT_POSITION_FOLLOWING)!==0);return s===-1?[...n,t]:[...n.slice(0,s),t,...n.slice(s)]}function Sn(e,t={}){const{focusRef:n,layer:s}=t,i=S.useRef(null),a=S.useRef(e);a.current=e;const l=S.useRef(null);l.current===null&&(l.current=()=>a.current());const u=l.current;return S.useEffect(()=>Ii.push(u,s),[u,s]),S.useEffect(()=>{var p;const h=document.activeElement;return(p=(n==null?void 0:n.current)??uT(i.current)[0])==null||p.focus(),()=>{OL(h,document.activeElement)&&h.focus()}},[]),S.useEffect(()=>{const h=p=>{var b;if(p.key!=="Tab"||bw(p))return;const f=i.current;if(!f)return;const g=document.activeElement;if(!(g!=null&&f.contains(g))&&!Ii.isTop(u))return;const w=UL(f,g),N=LL({count:w.length,index:g?w.indexOf(g):-1,shiftKey:p.shiftKey});N.kind!=="allow"&&(p.preventDefault(),N.kind==="focus"&&((b=w[N.index])==null||b.focus()))};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[u]),i}function WL(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 $n(e){return e.toLocaleString()}function HL(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(2)} MB`}const GL=60;function VL(e,t=GL){if(e.length<=t)return e;const n=e.slice(e.length-(t-1)),s=n.search(/[/\\]/);return"…"+(s===-1?n:n.slice(s))}function YL({agent:e,onClose:t}){var y;const n=S.useRef(null),s=Sn(t,{focusRef:n}),i=e.context,a=e.usage,l=(i==null?void 0:i.currentContextTokens)??0,u=rT(e.contextWindow,e.model),h=Math.min(100,l/u*100),p=_n(e),f=a.inputTokens+a.cacheReadTokens+a.cacheCreateTokens,g=WL(e.provider);return d.jsx("div",{className:"ctx-modal-backdrop",onClick:t,role:"presentation",children:d.jsxs("div",{ref:s,className:"ctx-modal",onClick:w=>w.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Context breakdown",children:[d.jsxs("header",{className:"ctx-modal-head",children:[d.jsxs("div",{children:[d.jsxs("div",{className:"ctx-modal-title",children:["Context · ",e.label]}),d.jsx("div",{className:"ctx-modal-sub",children:g.subtitle})]}),d.jsx("button",{type:"button",ref:n,className:"glyph-btn ctx-modal-close",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),d.jsxs("section",{className:"ctx-window-row",children:[d.jsx("div",{className:"ctx-window-bar",role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(h),children:d.jsx("div",{className:"ctx-window-fill",style:{width:`${h}%`}})}),d.jsxs("div",{className:"ctx-window-meta",children:[d.jsxs("span",{className:"ctx-window-pct",children:[h.toFixed(1),"%"]}),d.jsxs("span",{children:[$n(l)," / ",$n(u)," tok (",g.windowScope,")"]})]})]}),d.jsx("h3",{className:"ctx-section-title",children:"Cumulative usage · whole session"}),d.jsxs("div",{className:"ctx-grid",children:[d.jsx(rr,{label:"input tokens",val:$n(a.inputTokens)}),d.jsx(rr,{label:"output tokens",val:$n(a.outputTokens)}),d.jsx(rr,{label:"cache reads",val:$n(a.cacheReadTokens)}),d.jsx(rr,{label:"cache writes",val:$n(a.cacheCreateTokens)}),d.jsx(rr,{label:"cumulative total",val:$n(f)}),d.jsx(rr,{label:"estimated cost",val:Ve(p.total),accent:!0})]}),d.jsx("h3",{className:"ctx-section-title",children:"Transcript composition"}),g.compositionCounted?d.jsxs("div",{className:"ctx-grid",children:[d.jsx(rr,{label:"user messages",val:$n((i==null?void 0:i.msgsUser)??0)}),d.jsx(rr,{label:"assistant messages",val:$n((i==null?void 0:i.msgsAssistant)??0)}),d.jsx(rr,{label:"tool uses",val:$n((i==null?void 0:i.toolUses)??0)}),d.jsx(rr,{label:"tool results",val:$n((i==null?void 0:i.toolResults)??0)}),d.jsx(rr,{label:"system-reminders",val:$n((i==null?void 0:i.systemReminders)??0)})]}):d.jsx("div",{className:"ctx-empty",children:g.compositionUncounted}),d.jsx("h3",{className:"ctx-section-title",children:g.memoryHeading}),(((y=i==null?void 0:i.memoryFiles)==null?void 0:y.length)??0)===0?d.jsx("div",{className:"ctx-empty",children:g.memoryEmpty}):d.jsx("ul",{className:"ctx-md-list",children:i.memoryFiles.map(w=>d.jsxs("li",{children:[d.jsx("span",{className:"ctx-md-path",title:w.path,children:VL(w.path)}),d.jsx("span",{className:"ctx-md-size",children:HL(w.bytes)})]},w.path))})]})})}function rr({label:e,val:t,accent:n}){return d.jsxs("div",{className:`ctx-row${n?" accent":""}`,children:[d.jsx("span",{className:"ctx-row-label",children:e}),d.jsx("span",{className:"ctx-row-val",children:t})]})}function KL({currentContextTokens:e,modelId:t,contextWindow:n,size:s=26,onClick:i}){const a=rT(n,t),l=Math.min(1,e/a),u=s/2-3,h=s/2,p=2*Math.PI*u,f=p*l,g=l>.9?"var(--err)":l>.7?"var(--inflight)":"var(--accent)";return d.jsx("button",{type:"button",className:"ctx-donut",onClick:i,title:`context: ${e.toLocaleString()} / ${a.toLocaleString()} (${(l*100).toFixed(1)}%)`,"aria-label":"Show context breakdown",children:d.jsxs("svg",{width:s,height:s,viewBox:`0 0 ${s} ${s}`,children:[d.jsx("circle",{cx:h,cy:h,r:u,stroke:"var(--line)",strokeWidth:"2.5",fill:"none"}),d.jsx("circle",{cx:h,cy:h,r:u,stroke:g,strokeWidth:"2.5",fill:"none",strokeDasharray:`${f} ${p-f}`,strokeDashoffset:p/4,strokeLinecap:"round",style:{transition:"var(--ctx-arc-transition)"}}),d.jsx("text",{x:h,y:h+3,textAnchor:"middle",fontSize:"8",fill:"var(--text)",fontWeight:"600",children:Math.round(l*100)})]})})}function n1(e,t){const n=Hi(t);if(!n)return`model: ${t}
60
+ no published rate in this build — the tokens are counted, the dollars are not`;const s=f=>f.toLocaleString(),i=f=>`$${f}/MTok`,a=xw(e,t),l=tT(e,n),u=l.tokens1h>0?[`cache w5m${s(l.tokens5m).padStart(14)} × ${i(n.cacheWrite).padEnd(11)} = ${Ve(l.usd5m)}`,`cache w1h${s(l.tokens1h).padStart(14)} × ${i(n.cacheWrite1h??n.cacheWrite).padEnd(11)} = ${Ve(l.usd1h)}`]:[`cache w ${s(l.tokens5m).padStart(14)} × ${i(n.cacheWrite).padEnd(11)} = ${Ve(l.usd5m)}`],h=nT(e,t),p=h===e.inputTokens?"input":"uncached";return[`model: ${t}`,`${p.padEnd(9)}${s(h).padStart(14)} × ${i(n.input).padEnd(11)} = ${Ve(a.input)}`,`output ${s(e.outputTokens).padStart(14)} × ${i(n.output).padEnd(11)} = ${Ve(a.output)}`,`cache r ${s(e.cacheReadTokens).padStart(14)} × ${i(n.cacheRead).padEnd(11)} = ${Ve(a.cacheRead)}`,...u,"─────────────────────────────────────────",`total = ${Ve(a.total)}`].join(`
61
+ `)}function r1(e){const t=xl(e);return t.length<=1?n1(e.usage,e.model):[...t.map(n=>n1(n.usage,n.model)),"═════════════════════════════════════════",`all models = ${Ve(_n(e).total)}`].join(`
62
+ `)}function XL({data:e,selected:t}){var y;const n=e.now??Date.now(),s=["agent-node",`state-${e.state}`,e.synthetic?"synthetic":"",t?"selected":""].filter(Boolean).join(" "),i=e.tools.filter(w=>!w.endedAt).length,a=ww(e.sessionId),l=((y=e.context)==null?void 0:y.currentContextTokens)??0,u=e.kind==="root"&&l>0,h=e.sessionTitle?e.cwd?`${e.cwd}
63
+ ${e.sessionTitle}`:e.sessionTitle:e.cwd,p=oT(e),f=p.length>0?`${e.model}
64
+ spend on this card also covers:
65
+ ${p.join(`
66
+ `)}`:e.model,g=aT(e.sessionName,e.sessionTitle);return d.jsxs("div",{className:s,style:{"--session-hue":a},children:[d.jsx("span",{className:"accent-stripe"}),d.jsx(Di,{type:"target",position:Pe.Left,style:{background:"transparent",border:"none"}}),d.jsxs("div",{className:"head",children:[d.jsxs("div",{className:"title",children:[d.jsx(QL,{state:e.state}),d.jsx("span",{className:"label",title:h,children:e.label}),e.synthetic&&d.jsx("span",{className:"synth-tag",title:"No SessionStart captured — synthesised",children:"?"})]}),d.jsxs("div",{className:"head-right",children:[u&&e.onOpenContext&&d.jsx(KL,{currentContextTokens:l,modelId:e.model,contextWindow:e.contextWindow,onClick:()=>e.onOpenContext(e.sessionId)}),d.jsx("div",{className:"time",title:`Started ${new Date(e.startedAt).toLocaleTimeString()}`,children:bu(e.startedAt,e.endedAt,n)})]})]}),d.jsxs("div",{className:"sub",children:[e.kind==="root"?"session":"subagent",e.childCount>0&&d.jsxs("span",{className:"spawn-badge",title:`${e.childCount} subagents spawned`,children:["→ ",e.childCount]}),e.cwdBasename&&e.kind==="subagent"?` · ${e.cwdBasename}`:"",e.model?d.jsxs("span",{className:"model-chip","data-family":Pu(e.model),title:f,children:[Is(e.model),p.length>0?` +${p.length}`:""]}):e.provider==="codex"?d.jsx("span",{className:"model-chip",title:"OpenAI Codex — no model reported yet",children:"Codex"}):null]}),e.kind==="root"&&g.face&&d.jsx("div",{className:"session-name",title:g.tooltip,children:g.face}),e.waiting&&d.jsx(JL,{waiting:e.waiting,now:n}),(()=>{const w=RL(e);return w?d.jsxs("div",{className:"approval-blind-row",title:w.detail,children:[d.jsx("span",{className:"approval-blind-dot","aria-hidden":!0}),d.jsx("span",{className:"approval-blind-said",children:w.label})]}):null})(),e.tools.length>0&&d.jsx(e3,{tools:e.tools,now:n}),d.jsxs("div",{className:"meta",children:[d.jsxs("span",{children:[d.jsx("b",{children:e.toolCount})," tools"]}),i>0&&d.jsxs("span",{className:"inflight-meta",children:[d.jsx("b",{children:i})," in-flight"]}),e.usage.inputTokens+e.usage.outputTokens>0&&d.jsxs("span",{className:"tokens-meta",title:`in:${e.usage.inputTokens} out:${e.usage.outputTokens} cache-r:${e.usage.cacheReadTokens} cache-c:${e.usage.cacheCreateTokens}${(e.usage.reasoningOutputTokens??0)>0?` reasoning:${e.usage.reasoningOutputTokens}`:""}`,children:[d.jsx("b",{children:Ct(e.usage.inputTokens+e.usage.outputTokens)})," tok"]}),e.model&&(()=>{const w=Hi(e.model),N=_n(e),b=Ly(e);if(!w&&N.total<=0)return e.usage.inputTokens+e.usage.outputTokens<=0?null:d.jsx("span",{className:"cost-unpriced",title:r1(e),children:Ei});if(N.total<=0)return null;const _=Math.max(0,((e.endedAt??n)-e.startedAt)/1e3),k=e.state==="active"?xu(N.total,_):null,E=r1(e)+(k?`
67
+ burn: ${k}`:"");return d.jsxs("span",{className:"cost-meta",title:E,children:[d.jsxs("b",{children:[Ve(N.total),b>0?"+":""]}),k&&d.jsx("span",{className:"cost-rate",children:k})]})})()]}),d.jsx(Di,{type:"source",position:Pe.Right,style:{background:"transparent",border:"none"}})]})}function _u(e){return e==="active"?"live":e==="done"?"done":"err"}function QL({state:e}){return d.jsx("span",{className:`state-pill state-${e}`,children:_u(e)})}function $u(e){return e.message?e.message:e.kind==="permission"?"Needs your permission":"Waiting for your input"}function ZL(e){return e.kind==="permission"?$u(e):"Your turn"}function JL({waiting:e,now:t}){const n=e.kind==="permission",s=$u(e);return d.jsxs("div",{className:n?"waiting-row permission":"waiting-row idle",title:`${s}
68
+ Blocked for ${bu(e.since,void 0,t)} — the answer goes in the terminal, not here.`,children:[n?d.jsx("span",{className:"ap-pulse","aria-hidden":!0}):d.jsx("span",{className:"waiting-dot","aria-hidden":!0}),d.jsx("span",{className:"waiting-said",children:ZL(e)}),d.jsx("b",{children:bu(e.since,void 0,t)})]})}function e3({tools:e,now:t}){const a=new Array(24).fill(0);let l=0;for(const N of e){const b=t-N.startedAt;if(b<0||b>=6e4)continue;const _=23-Math.floor(b/2500);_>=0&&_<24&&(a[_]+=1,l+=1)}const u=Math.max(1,...a),h=Math.max(0,...a),p=132,f=14,g=p/24,y=h/(2500/1e3),w=l===0?"no tool calls in the last 60s":`${l} tool calls in last 60s · peak ${y.toFixed(1)}/s`;return d.jsxs("div",{className:"tool-spark-row",title:w,children:[d.jsx("svg",{className:"tool-spark",width:p,height:f,viewBox:`0 0 ${p} ${f}`,"aria-hidden":!0,children:a.map((N,b)=>{const _=N===0?1.5:Math.max(1.5,N/u*f),k=b===23&&N>0,j=`tool-spark-bar${N>0?" active":""}${k?" latest":""}`;return d.jsx("rect",{x:b*g+.4,y:f-_,width:Math.max(.5,g-1),height:_,rx:.8,className:j},b)})}),d.jsx("span",{className:"tool-spark-label",children:"60s"})]})}function s1(e){if(e==null)return"(none)";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function t3({tool:e,onClose:t}){const n=Sn(t),s=e.endedAt==null?"inflight":e.ok===!1?"err":"done";return d.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:d.jsxs("div",{ref:n,className:"modal",onClick:i=>i.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"tool-modal-title",children:[d.jsxs("header",{className:"modal-head",children:[d.jsxs("div",{className:"modal-title",children:[d.jsx("span",{className:`status-dot ${s}`,"aria-hidden":!0}),d.jsx("span",{id:"tool-modal-title",className:"modal-tool-name",children:e.name}),d.jsxs("span",{className:"modal-tool-id",title:e.id,children:[e.id.slice(0,12),"…"]})]}),d.jsxs("div",{className:"modal-actions",children:[d.jsx("span",{className:"modal-dur",children:iT(e,"in-flight…")}),d.jsx("button",{className:"glyph-btn",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),d.jsxs("section",{className:"modal-body",children:[e.trimmed&&d.jsx("div",{className:"modal-section",children:d.jsx("p",{className:"modal-note",children:"Full payloads for this call were released to keep memory bounded — only the previews below are still held."})}),d.jsxs("div",{className:"modal-section",children:[d.jsx("h4",{children:"Input"}),d.jsx("pre",{children:s1(e.input??e.inputPreview)})]}),d.jsxs("div",{className:"modal-section",children:[d.jsxs("h4",{children:["Response ",s==="err"&&d.jsx("span",{className:"err-tag",children:"error"})]}),d.jsx("pre",{children:e.endedAt==null?"(waiting…)":s1(e.response??e.errorPreview)})]})]})]})})}const Kc=18,o1=26,n3=12;function r3(e){return s3(e.nodeInternals.values())}function s3(e){const t=new Map;for(const i of e){if(i.type!=="agent")continue;const a=i.data;if(!(a!=null&&a.sessionId)||a.exitAt!=null||i.width==null||i.height==null)continue;const l=i.position.x,u=i.position.y,h=l+i.width,p=u+i.height,f=t.get(a.sessionId);f?(f.minX=Math.min(f.minX,l),f.minY=Math.min(f.minY,u),f.maxX=Math.max(f.maxX,h),f.maxY=Math.max(f.maxY,p),a.kind==="root"&&(f.label=a1(a)??f.label),a.kind==="root"&&(f.name=l1(a))):t.set(a.sessionId,{minX:l,minY:u,maxX:h,maxY:p,label:a1(a)??a.sessionId,name:l1(a)})}const n=new Map;for(const i of t.values())n.set(i.label,(n.get(i.label)??0)+1);const s=[];for(const[i,a]of t){const l=(n.get(a.label)??0)>1;s.push({sessionId:i,...l3(a.label,a.name,i,l),x:a.minX-Kc,y:a.minY-Kc-o1,w:a.maxX-a.minX+Kc*2,h:a.maxY-a.minY+Kc*2+o1})}return s}const qy=" · ",o3=32,i3=/[\u1100-\u115F\u2E80-\u303E\u3041-\u33FF\u3400-\u4DBF\u4E00-\u9FFF\uA000-\uA4CF\uAC00-\uD7A3\uF900-\uFAFF\uFE30-\uFE6F\uFF00-\uFF60\uFFE0-\uFFE6]/;function i1(e){return i3.test(e)?2:1}function a3(e,t=o3){const n=[...e];let s=0;for(const l of n)s+=i1(l);if(s<=t)return e;const i=[];let a=0;for(const l of n){const u=i1(l);if(a+u>t-1)break;i.push(l),a+=u}for(;i.length&&/[\s\-_.:/]/.test(i[i.length-1]);)i.pop();return`${i.join("")}…`}function l3(e,t,n,s){const i=(t==null?void 0:t.trim())??"",a=s?c3(n):void 0,l=[e,i||void 0,a].filter(Boolean);return{label:e,name:i?a3(i):void 0,shortId:a,fullLabel:l.join(qy)}}function c3(e){const t=e.match(/[a-zA-Z0-9]{4}/);return t?t[0]:e.slice(0,4)}function a1(e){if(e.kind==="root")return e.label}function l1(e){if(e.kind==="root")return aT(e.sessionName,e.sessionTitle).face}function u3(){const{x:e,y:t,zoom:n}=HC(),s=gl(),i=it(r3,d3);if(i.length<=1)return null;const a=u=>{try{const h=s.getNodes().filter(p=>{const f=p.data;return(f==null?void 0:f.sessionId)===u});if(h.length===0)return;s.fitView({padding:.3,duration:500,nodes:h})}catch{}},l={transform:`translate(${e}px, ${t}px) scale(${n})`};return d.jsx("div",{className:"session-clusters",style:l,children:i.map(u=>{const h=ww(u.sessionId),p={position:"absolute",left:u.x,top:u.y,width:u.w,height:u.h,"--session-hue":h},f={position:"absolute",left:u.x+16,top:u.y-n3,transform:`scale(${Math.min(1,n)/(n||1)})`,transformOrigin:"left top","--session-hue":h};return d.jsxs(ue.Fragment,{children:[d.jsx("div",{className:"cluster-card",style:p,"aria-hidden":!0}),d.jsxs("button",{type:"button",className:"cluster-label",style:f,title:`Fit view to ${u.fullLabel}
69
+ drag the wrapper to move the whole session`,onClick:()=>a(u.sessionId),children:[u.label,u.name?d.jsxs(d.Fragment,{children:[qy,d.jsx("span",{className:"cluster-label-name",children:u.name})]}):null,u.shortId?qy+u.shortId:null]})]},u.sessionId)})})}function d3(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){const s=e[n],i=t[n];if(s.sessionId!==i.sessionId||s.label!==i.label||s.name!==i.name||s.shortId!==i.shortId||s.fullLabel!==i.fullLabel||s.x!==i.x||s.y!==i.y||s.w!==i.w||s.h!==i.h)return!1}return!0}function f3({data:e}){return d.jsx("div",{className:"session-group-handle",style:{width:(e==null?void 0:e.w)??0,height:(e==null?void 0:e.h)??0}})}const bl={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"}},h3=Object.fromEntries(Object.entries(bl).map(([e,t])=>[e,t.category])),p3=Object.fromEntries(Object.entries(bl).map(([e,t])=>[e,t.emoji])),m3=Object.fromEntries(Object.entries(bl).map(([e,t])=>[e,t.label])),g3=new Set(Object.keys(bl)),v3=new Set(Object.entries(bl).filter(([,e])=>e.shell).map(([e])=>e)),c1={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",...h3};function dT(e){return e.startsWith("mcp__")?"mcp":Object.hasOwn(c1,e)?c1[e]:"other"}const y3=/\btools\.exec_command\s*\(\s*\{[^{}]*?\bcmd\s*:\s*(["'`])((?:\\.|(?!\1)[^\\])*)\1/,w3=/\btools\.([A-Za-z_$][\w$]*)\s*\(/;function x3(e){if(typeof e!="string"||!e)return null;const t=y3.exec(e);if(t){const s=b3(t[2]);if(s.trim())return s}const n=w3.exec(e);return n?n[1]:null}function b3(e){return e.replace(/\\(["'`\\nrt])/g,(t,n)=>n==="n"?`
70
+ `:n==="r"?"\r":n==="t"?" ":n)}const fT=600,_3=4,k3=36,Dy=16,S3=60,N3=6,u1=220,d1=96,E3=28,f1={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:"📡",...p3};function h1(e){return e.startsWith("mcp__")?"🔌":Object.hasOwn(f1,e)?f1[e]:"✨"}const p1={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 hT(e){if(!e)return null;let t=e.trim();if(!t)return null;const n=t.match(/^(?:bash|sh|zsh|fish|powershell|pwsh)(?:\.exe)?\s+(?:-c|-Command|-NoProfile|-NonInteractive|\s)+["']([^"']+)["']/i);if(n)return hT(n[1]);for(;;){const a=t.match(/^([A-Z_][A-Z0-9_]*=\S*)\s+/);if(!a)break;t=t.slice(a[0].length)}t=t.replace(/^sudo(?:\s+-\S+)*\s+/,""),t=t.replace(/^(?:time|nohup|xargs)\s+/,"");const s=t.match(/^([^\s|;&<>(]+)/);if(!s)return null;let i=s[1];return i=i.replace(/^.*[/\\]/,""),i=i.replace(/\.(exe|cmd|bat|ps1)$/i,""),i||null}function j3(e){if(typeof e=="string")return e;if(!e||typeof e!="object")return null;const t=e;if(typeof t.script=="string"){const n=x3(t.script);if(n)return n}if(typeof t.cmd=="string")return t.cmd;if(typeof t.command=="string")return t.command;if(Array.isArray(t.command)&&t.command.every(n=>typeof n=="string")){const n=t.command;if(/powershell|cmd|bash|sh(\.exe)?$/i.test(n[0]??"")){const s=n.findIndex(i=>/^(-Command|-c)$/i.test(i));if(s>=0&&s+1<n.length)return n[s+1]}return n.join(" ")}return typeof t.script=="string"?t.script:null}const C3=new Set(["Bash","PowerShell",...v3]),T3=g3;function R3(e,t){return T3.has(e)||e.startsWith("mcp__")?Math.max(d1,34+t.length*7.5):d1}function A3(e,t){if(!C3.has(e))return null;const n=j3(t);if(!n)return null;const s=hT(n);return s?{emoji:Object.hasOwn(p1,s)?p1[s]:"⚙️",label:s,category:"shell",detail:n}:null}const M3=new Set(["Read","Write","Edit","MultiEdit","NotebookEdit","LS","Glob","apply_patch"]),m1={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:"🗄️"},g1={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 I3(e){const n=e.replace(/\\/g,"/").replace(/\/+$/,""),s=n.lastIndexOf("/");return s>=0?n.slice(s+1):n}function O3(e){const t=e.toLowerCase();if(Object.hasOwn(g1,t))return g1[t];if(t.startsWith("dockerfile."))return"🐳";if(/\.(test|spec)\.[a-z]+$/.test(t))return"🧪";const n=t.lastIndexOf(".");if(n>0&&n<t.length-1){const s=t.slice(n+1);if(Object.hasOwn(m1,s))return m1[s]}return"📄"}function P3(e,t){if(!t||typeof t!="object")return null;const n=t;if(e==="apply_patch"&&typeof n.patch=="string"){const s=n.patch.match(/^\*\*\* (?:Update|Add|Delete) File: (.+)$/m);return s?s[1].trim():null}return typeof n.file_path=="string"?n.file_path:typeof n.notebook_path=="string"?n.notebook_path:typeof n.path=="string"?n.path:e==="Glob"&&typeof n.pattern=="string"?n.pattern:null}function $3(e,t){if(!M3.has(e))return null;const n=P3(e,t);if(!n)return null;const s=I3(n);return s?{emoji:e==="LS"?"📂":O3(s),label:s,category:"file",detail:n}:null}const v1={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 kw(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 L3(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 pT(e){const t=e.toLowerCase();return Object.hasOwn(v1,t)?v1[t]:void 0}function q3(e,t){const n=kw(e);if(!n)return null;const{server:s,method:i}=n;if(!i)return null;const a=pT(s);return{emoji:(a==null?void 0:a.emoji)??"🔌",label:i,category:"mcp",detail:a?`${a.name} · ${i}`:`${s} · ${i}`}}function D3(e,t){return A3(e,t)??$3(e,t)??q3(e)}const y1=m3;function mT(e){const t=kw(e);if(t){const s=pT(t.server);return s?{emoji:s.emoji,label:s.name}:{emoji:"🔌",label:t.server,hue:L3(t.server)}}const n=Object.hasOwn(y1,e)?y1[e]:"";return n?{emoji:h1(e),label:n}:{emoji:h1(e),label:e}}function F3(e){let t=null,n="";for(const s of e){const i=kw(s);if(i){if(!i.server)return null;if(t===null)t=i.server,n=s;else if(i.server!==t)return null}}return t===null?null:mT(n)}function z3(e){return e.endedAt==null?"inflight":e.ok===!1?"err":"done"}function B3(e,t){if(t==null)return 1;const n=e-t;return n<0?1:Math.max(0,1-n/fT)}function U3(e,t){const n=[],s=new Set;for(let i=e.length-1;i>=0&&n.length<t;i--){const a=e[i];s.has(a.id)||(s.add(a.id),n.push(a))}return n.reverse()}function W3(e,t,n,s,i,a){const l=[];for(const u of e.values()){if(!t.has(u.id)||u.exitAt!=null&&a-u.exitAt>fT)continue;const h=s.get(u.id)??n.get(u.id);if(!h)continue;const p=U3(u.tools,_3);if(p.length===0)continue;const f=u.exitAt??null,g=i.get(u.id),y=Math.max((g==null?void 0:g.width)??u1,u1),w=(g==null?void 0:g.height)??130,N=h.x,b=h.y,_=N+y,k=b+w/2;p.forEach((E,j)=>{const C=j*k3,I=N+y+S3,P=b+N3+C,O=B3(a,f),F=E.inputPreview??"",M=z3(E),A=O<.999,q=mT(E.name);l.push({id:`${u.id}::${E.id}`,toolId:E.id,agentId:u.id,toolName:E.name,name:q.label,emoji:q.emoji,status:M,category:dT(E.name),mcpHue:q.hue,inputPreview:F,fade:O,fading:A,worldX:I,worldY:P,anchorX:_,anchorY:k,spawnDx:_-I,spawnDy:k-(P+Dy)});const W=D3(E.name,E.input);if(W){const K=R3(E.name,q.label),T=I+K+E3,Z=P,U=I+K,re=P+Dy;l.push({id:`sub:${u.id}::${E.id}`,toolId:E.id,agentId:u.id,toolName:E.name,name:W.label,emoji:W.emoji,isSub:!0,status:M,category:W.category,inputPreview:W.detail??F,fade:O,fading:A,worldX:T,worldY:Z,anchorX:U,anchorY:re,spawnDx:U-T,spawnDy:0})}})}return l}function H3({agents:e,visibleAgentIds:t,positions:n,pinned:s,measured:i,spotlight:a,hiddenCategories:l,now:u,onOpenTool:h}){const p=W3(e,t,n,s,i,u),f=l&&l.size>0?p.filter(g=>!l.has(g.category)):p;return d.jsx(G3,{bursts:f,spotlight:a,onOpenTool:h})}function G3({bursts:e,spotlight:t,onOpenTool:n}){const{x:s,y:i,zoom:a}=HC();return d.jsxs("div",{className:"tool-bursts-layer","aria-hidden":!0,children:[d.jsx("svg",{className:"tool-bursts-svg",children:e.map(l=>{const u=l.anchorX*a+s,h=l.anchorY*a+i,p=(l.worldX+6)*a+s,f=(l.worldY+Dy)*a+i,g=u+(p-u)*.55,y=t!=null&&!t.has(l.agentId),w=l.fade*(y?.14:1);return d.jsx("path",{d:`M ${u} ${h} Q ${g} ${h}, ${p} ${f}`,className:`tool-conn status-${l.status}${l.fading?" fading":""}`,opacity:w},`l:${l.id}`)})}),e.map(l=>{const u=l.worldX*a+s,h=l.worldY*a+i,p={left:`${u}px`,top:`${h}px`,transform:`scale(${a})`,transformOrigin:"left top","--spawn-dx":`${l.spawnDx}px`,"--spawn-dy":`${l.spawnDy}px`},f=l.isSub?`${l.toolName} · ${l.name}`:l.toolName,g=l.inputPreview?`${f} · ${l.inputPreview}`:f,y=n!=null,w=l.mcpHue!=null?{"--mcp-hue":l.mcpHue}:{},b=t!=null&&!t.has(l.agentId)?" dim":"";return d.jsx("div",{className:"tool-burst-wrap",style:p,children:d.jsxs("div",{className:`tool-burst cat-${l.category}${l.mcpHue!=null?" mcp-hue":""} status-${l.status}${l.fading?" fading":""}${y?" clickable":""}${l.isSub?" sub":""}${b}`,style:w,title:g,onClick:y?()=>n(l.toolId):void 0,children:[d.jsx("span",{className:"tb-emoji",children:l.emoji}),d.jsx("span",{className:"tb-name",children:l.name}),l.status==="inflight"&&d.jsx("span",{className:"tb-spin"}),l.status==="done"&&d.jsx("span",{className:"tb-mark done",children:"✓"}),l.status==="err"&&d.jsx("span",{className:"tb-mark err",children:"×"})]})},l.id)})]})}function gT(e){const t={input:0,output:0,cacheRead:0,cacheWrite:0,total:0};let n=0,s=0,i=0,a=0;for(const l of e){const u=_n(l);t.input+=u.input,t.output+=u.output,t.cacheRead+=u.cacheRead,t.cacheWrite+=u.cacheWrite,t.total+=u.total,n+=l.usage.inputTokens,s+=l.usage.outputTokens,i+=l.usage.cacheReadTokens,a+=l.usage.cacheCreateTokens}return{cost:t,inputTokens:n,outputTokens:s,cacheReadTokens:i,cacheCreateTokens:a,sum:n+s}}const V3="spend on this board",Y3="on this board",K3="board tokens",X3="board cost",ku=`Everything on the board right now, and only that.
71
+ 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.
72
+ Press H for the totals ccusage reads off the logs on disk, which do not forget.`,vT="session spend";function Sw({cost:e,size:t="md"}){const n=e.total;if(n<=0)return null;const s=(a,l,u)=>{if(a<=0)return null;const h=a/n*100;return d.jsx("span",{className:`cb-seg ${l}`,style:{width:`${h}%`},title:`${u}: ${Ve(a)} (${h.toFixed(0)}%)`},l)},i=t==="lg";return d.jsxs("div",{className:i?"cost-bar cost-bar-lg":"cost-bar",role:"img","aria-label":"Cost breakdown",children:[s(e.input,"cb-input","input"),s(e.output,"cb-output","output"),s(e.cacheRead,"cb-cache-r","cache read"),s(e.cacheWrite,"cb-cache-w","cache write")]})}function Q3({state:e,sessionId:t,onClose:n}){const s=S.useMemo(()=>Z3(e,t),[e,t]),i=S.useRef(null),a=Sn(n,{focusRef:i});return s?d.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:d.jsxs("div",{ref:a,className:"modal session-summary",onClick:l=>l.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"ss-title",children:[d.jsxs("div",{className:"modal-head",children:[d.jsxs("div",{className:"modal-title",children:[d.jsx("span",{className:"state-pill state-done","aria-hidden":!0,children:"done"}),d.jsx("span",{id:"ss-title",className:"modal-tool-name",title:s.cwd??s.sessionId,children:s.label}),d.jsxs("span",{className:"modal-tool-id",children:["· ",s.sessionId.slice(0,8)]})]}),d.jsxs("div",{className:"modal-actions",children:[d.jsx("span",{className:"modal-dur",title:"Total wall time",children:s.durationLabel}),d.jsx("button",{type:"button",ref:i,className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),d.jsxs("div",{className:"modal-body",children:[d.jsxs("section",{className:"ss-hero",children:[d.jsxs("div",{className:"ss-hero-left",children:[d.jsx("div",{className:"ss-cost-label",children:vT}),d.jsx("div",{className:"ss-cost",children:Ve(s.cost.total)}),s.modelChips.length>0&&d.jsx("div",{className:"ss-models",children:s.modelChips.map(l=>d.jsx("span",{className:"model-chip","data-family":Pu(l),title:l,children:Is(l)},l))})]}),d.jsx("div",{className:"ss-hero-right",children:s.cost.total>0&&d.jsxs(d.Fragment,{children:[d.jsx(Sw,{cost:s.cost,size:"lg"}),d.jsxs("div",{className:"ss-cost-legend",children:[d.jsxs("span",{className:"ssl ssl-in",children:["input ",d.jsx("b",{children:Ve(s.cost.input)})]}),d.jsxs("span",{className:"ssl ssl-out",children:["output ",d.jsx("b",{children:Ve(s.cost.output)})]}),d.jsxs("span",{className:"ssl ssl-cr",children:["cache r ",d.jsx("b",{children:Ve(s.cost.cacheRead)})]}),d.jsxs("span",{className:"ssl ssl-cw",children:["cache w ",d.jsx("b",{children:Ve(s.cost.cacheWrite)})]})]})]})})]}),d.jsxs("section",{className:"ss-stats",children:[d.jsx(ki,{label:"agents",value:s.agentCount}),d.jsx(ki,{label:"subagents",value:s.subagentCount}),d.jsx(ki,{label:"tool calls",value:s.toolCount}),d.jsx(ki,{label:"prompts",value:s.promptCount}),d.jsx(ki,{label:"tokens",value:s.tokensSum.toLocaleString()}),s.errCount>0&&d.jsx(ki,{label:"errors",value:s.errCount,tone:"err"})]}),s.topTools.length>0&&d.jsxs("section",{className:"modal-section",children:[d.jsx("h4",{children:"Most-used tools"}),d.jsx("div",{className:"ss-top-tools",children:s.topTools.map(([l,u])=>d.jsxs("div",{className:"ss-tt",children:[d.jsx("span",{className:"ss-tt-name",children:l}),d.jsx("span",{className:"ss-tt-bar",children:d.jsx("span",{className:"ss-tt-bar-fill",style:{width:`${u/s.topTools[0][1]*100}%`}})}),d.jsx("span",{className:"ss-tt-count",children:u})]},l))})]}),s.firstPrompt&&d.jsxs("section",{className:"modal-section",children:[d.jsx("h4",{children:"Opening prompt"}),d.jsx("div",{className:"ss-prompt",children:s.firstPrompt})]})]})]})}):null}function ki({label:e,value:t,tone:n}){return d.jsxs("div",{className:`ss-stat${n?` tone-${n}`:""}`,children:[d.jsx("div",{className:"ss-stat-value",children:t}),d.jsx("div",{className:"ss-stat-label",children:e})]})}function Z3(e,t){const n=e.agents.get(t);if(!n)return null;const s=[];for(const j of e.agents.values())j.sessionId===t&&s.push(j);if(s.length===0)return null;const i={input:0,output:0,cacheRead:0,cacheWrite:0,total:0},a=new Set,l=new Map;let u=0,h=0,p=0,f=0,g=0,y,w=1/0,N=0;for(const j of s){const C=_n(j);i.input+=C.input,i.output+=C.output,i.cacheRead+=C.cacheRead,i.cacheWrite+=C.cacheWrite,i.total+=C.total;for(const I of sT(j))a.add(I);j.model&&a.add(j.model),j.kind==="subagent"&&g++,h+=j.prompts.length,!y&&j.prompts.length>0&&(y=j.prompts[0].text),p+=j.usage.inputTokens+j.usage.outputTokens,u+=j.toolCount,w=Math.min(w,j.startedAt),N=Math.max(N,j.endedAt??Date.now());for(const I of j.tools)l.set(I.name,(l.get(I.name)??0)+1),I.ok===!1&&f++}const b=Math.max(0,N-w),_=Math.floor(b/1e3),k=_<60?`${_}s`:_<3600?`${Math.floor(_/60)}m ${String(_%60).padStart(2,"0")}s`:`${Math.floor(_/3600)}h ${Math.floor(_%3600/60)}m`,E=Array.from(l.entries()).sort((j,C)=>C[1]-j[1]).slice(0,5);return{sessionId:t,label:n.label||n.cwdBasename||"session",cwd:n.cwd,durationLabel:k,cost:i,modelChips:Array.from(a),agentCount:s.length,subagentCount:g,toolCount:u,promptCount:h,tokensSum:p,errCount:f,topTools:E,firstPrompt:y}}function Nw(e){return(e==null?void 0:e.kind)==="permission"}function J3(e){const t=[];for(const n of e)n.kind==="root"&&Nw(n.waiting)&&t.push({id:n.id,label:n.label,waiting:n.waiting});return t.sort((n,s)=>n.waiting.since-s.waiting.since)}function e4(e){const t=new Set;for(const n of e)n.state==="active"&&t.add(n.sessionId);return t.size}function w1(e){return e.waiting?Nw(e.waiting)?0:1:e.state==="active"?2:3}function t4(e,t){const n=[];for(const s of e.agents.values()){if(s.kind!=="root")continue;let i=s.toolCount,a=_n(s).total,l=s.endedAt??s.startedAt;for(const u of e.agents.values()){if(u.sessionId!==s.sessionId||u.kind==="root")continue;i+=u.toolCount,a+=_n(u).total;const h=u.endedAt??u.startedAt;h>l&&(l=h)}n.push({sessionId:s.sessionId,label:s.label||s.cwdBasename||"session",cwdBasename:s.cwdBasename,state:s.state,waiting:s.waiting,modelId:s.model,toolCount:i,cost:a,startedAt:s.startedAt,lastActivity:l})}return n.sort((s,i)=>{const a=w1(s),l=w1(i);return a!==l?a-l:s.waiting&&i.waiting?s.waiting.since-i.waiting.since:i.lastActivity-s.lastActivity}),n}function x1(e,t,n){const s=(t??n)-e;if(s<1e3)return"<1s";const i=Math.floor(s/1e3);if(i<60)return`${i}s`;const a=Math.floor(i/60);return a<60?`${a}m`:`${Math.floor(a/60)}h ${a%60}m`}function n4({state:e,now:t,selectedIds:n,onSelect:s,onClose:i}){const a=S.useMemo(()=>t4(e),[e,e.revision,t]),l=a.filter(h=>h.state==="active").length,u=a.filter(h=>Nw(h.waiting)).length;return d.jsxs("aside",{className:"session-list",id:"session-list","aria-label":"Sessions",children:[d.jsxs("div",{className:"sl-header",children:[d.jsxs("h2",{children:["Sessions ",d.jsx("span",{className:"sl-count",children:a.length})]}),u>0&&d.jsxs("span",{className:"sl-waiting-count",children:[u," waiting"]}),l>0&&d.jsxs("span",{className:"sl-live-count",children:[l," live"]}),d.jsx("button",{className:"glyph-btn sl-close",onClick:i,title:"Hide sidebar (L)","aria-label":"Hide session list",children:"‹"})]}),d.jsxs("div",{className:"sl-rows",children:[a.length===0&&d.jsx("div",{className:"sl-empty",children:"No sessions yet."}),a.map(h=>{const p=n.has(h.sessionId);return d.jsxs("button",{type:"button",className:`sl-row state-${h.state}${p?" selected":""}`,onClick:()=>s(h.sessionId),title:`Focus ${h.label}`,children:[d.jsx("span",{className:`sl-dot state-${h.state}`,"aria-hidden":!0}),d.jsx("span",{className:"vis-hidden",children:_u(h.state)}),d.jsxs("div",{className:"sl-row-body",children:[d.jsxs("div",{className:"sl-row-head",children:[d.jsx("span",{className:"sl-label",children:h.label}),h.modelId&&d.jsx("span",{className:"model-chip","data-family":Pu(h.modelId),title:h.modelId,children:Is(h.modelId)})]}),d.jsxs("div",{className:"sl-row-meta",children:[d.jsxs("span",{title:"tool calls",children:[d.jsx("b",{children:h.toolCount})," tools"]}),h.cost>0&&d.jsx("span",{className:"sl-cost",title:vT,children:d.jsx("b",{children:Ve(h.cost)})}),h.waiting?d.jsxs("span",{className:"sl-waiting",title:`${$u(h.waiting)}
73
+ Blocked since ${new Date(h.waiting.since).toLocaleTimeString()} · started ${new Date(h.startedAt).toLocaleString()}`,children:["waiting ",x1(h.waiting.since,void 0,t)]}):d.jsx("span",{className:"sl-elapsed",title:`Started ${new Date(h.startedAt).toLocaleString()}`,children:x1(h.startedAt,h.state==="active"?void 0:h.lastActivity,t)})]})]})]},h.sessionId)})]})]})}const r4=e=>1-Math.pow(1-e,5),yT=420;function s4(e,t){if(!Number.isFinite(e)||!Number.isFinite(t)||e===t)return!1;const n=Math.abs(t-e);if(n<1)return!1;const s=Math.max(Math.abs(e),Math.abs(t));return s===0||n/s>=.005}function o4(e,t,n,s=yT){return n>=s?t:n<=0?e:e+(t-e)*r4(n/s)}function i4(e,t,n,s={}){const i=s.now??(()=>performance.now()),a=s.raf??(w=>requestAnimationFrame(w)),l=s.cancel??(w=>cancelAnimationFrame(w)),u=s.reducedMotion??(()=>typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches),h=s.hidden??(()=>typeof document=="object"&&document.hidden===!0);if(u()||h()||!s4(e,t))return n(t),()=>{};const p=i();let f=0,g=!0;const y=()=>{if(!g)return;const w=i()-p;n(o4(e,t,w)),w<yT&&(f=a(y))};return f=a(y),()=>{g=!1,f&&l(f)}}function Fy(e,t=new Date){return new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate()-(e-1))).toISOString().slice(0,10).replace(/-/g,"")}const b1=[{key:"today",label:"today",noun:"today"},{key:"month",label:"month",noun:"this month"},{key:"all",label:"all",noun:"all time"}];function a4(e,t=new Date){return e==="today"?Fy(1,t):e==="month"?Fy(t.getDate(),t):"20200101"}const bn=e=>typeof e=="number"&&Number.isFinite(e)?e:0,lu=e=>typeof e=="string"?e:"";function wT(e){const t=Array.isArray(e==null?void 0:e.days)?e.days:[],n=new Map;for(const s of t){const i=Array.isArray(s==null?void 0:s.modelBreakdowns)?s.modelBreakdowns:[];for(const a of i){const l=lu(a==null?void 0:a.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+=bn(a==null?void 0:a.cost),u.inputTokens+=bn(a==null?void 0:a.inputTokens),u.outputTokens+=bn(a==null?void 0:a.outputTokens),u.cacheReadTokens+=bn(a==null?void 0:a.cacheReadTokens),u.cacheCreateTokens+=bn(a==null?void 0:a.cacheCreationTokens)}}return[...n.values()].sort((s,i)=>i.cost-s.cost||i.tokens-s.tokens)}function l4(e,t=new Map){const n=Array.isArray(e==null?void 0:e.sessions)?e.sessions:[],s=[];for(const i of n){const a=lu(i==null?void 0:i.period);if(!a)continue;const l=i==null?void 0:i.metadata,u=typeof(l==null?void 0:l.lastActivity)=="string"?Date.parse(l.lastActivity):NaN;s.push({sessionId:a,label:t.get(a)??null,agent:lu(i==null?void 0:i.agent)||"claude",cost:bn(i==null?void 0:i.totalCost),tokens:bn(i==null?void 0:i.totalTokens),models:Array.isArray(i==null?void 0:i.modelsUsed)?i.modelsUsed.map(lu).filter(Boolean):[],lastActivityMs:Number.isFinite(u)?u:null})}return s.sort((i,a)=>a.cost-i.cost||a.tokens-i.tokens)}function c4(e){const t=e==null?void 0:e.totals;if(t&&typeof t=="object"){const h=bn(t.cacheReadTokens),p=bn(t.cacheCreationTokens),f=bn(t.inputTokens),g=bn(t.outputTokens);return{cost:bn(t.totalCost),inputTokens:f,outputTokens:g,cacheReadTokens:h,cacheCreateTokens:p,tokens:bn(t.totalTokens)||f+g+h+p}}const n=wT(e),s=h=>n.reduce((p,f)=>p+h(f),0),i=s(h=>h.inputTokens),a=s(h=>h.outputTokens),l=s(h=>h.cacheReadTokens),u=s(h=>h.cacheCreateTokens);return{cost:s(h=>h.cost),inputTokens:i,outputTokens:a,cacheReadTokens:l,cacheCreateTokens:u,tokens:i+a+l+u}}const zt="ccdeck";function xT(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 zy(e){return xT(Math.floor(e/1e3))}function bT(e,t){const n=e-t;if(n<=0)return null;const s=Math.floor(n/86400),i=Math.floor(n%86400/3600),a=Math.floor(n%3600/60);return s>0?`${s}d ${i}h`:i>0?`${i}h ${a}m`:`${a}m`}function u4(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function d4(e,t,n){const s=new Date(e),i=zy(t-e);return{label:u4(s,new Date(t))?i:`${i} · ${s.toLocaleDateString(n,{month:"short",day:"numeric"})}`,title:s.toLocaleString(n,{dateStyle:"medium",timeStyle:"medium"})}}function _T(e,t){return{disabled:e!=null&&e!==t,busy:e===t}}function kT(e){return e==null}const By="self";function ir(e,t=!1){const n=_T(e?By:null,By);return{disabled:t||n.disabled,"aria-busy":n.busy}}function ar(e){return kT(e?By:null)}function f4(e){return[...e==null?[]:[`#ap-more-${e}`],".accounts-panel .ap-refresh"]}function h4(e){return e==null||e==="BODY"||e==="HTML"}function _1(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 p4(e){return e==="claude-swap"?"Read from claude-swap's last collection — costs no request against your usage-endpoint budget":e==="api"?"Fetched from Anthropic's usage endpoint, at most once every 5 minutes":e==="cli"?"Parsed from `claude /usage`, at most once every 5 minutes":"Last update"}const Kf="__unknown__";function m4(e,t,n,s){const i=Math.max(0,t-s),a=Math.max(0,n-i);if(a<120)return null;const l=Math.min(100,a/n*100),u=e-l;if(Math.abs(u)<3)return{label:"on pace",color:"var(--ok)",expectedPct:l,isDeficit:!1};if(u>0){const h=100-e,p=a>0?e/a:0,f=p>0?h/p:1/0,g={label:`${Math.round(u)}% ahead`,color:"var(--warn)",expectedPct:l,isDeficit:!0};if(f<i&&f<86400){const y=Math.floor(f/3600),w=Math.floor(f%3600/60);g.runsOutIn=y>0?`${y}h ${w}m`:`${w}m`}return g}return{label:`${Math.round(-u)}% reserve`,color:"var(--ok)",expectedPct:l,isDeficit:!1}}function ho({pct:e,label:t,reset:n,resetAt:s,windowSec:i,limitReached:a,nowSec:l}){const u=Math.min(100,Math.max(0,e)),p=a||u>=90?"var(--err)":u>=70?"var(--warn)":"var(--accent)",f=u===0?"< 1%":`${u}%`,g=u===0?2:u,y=s?bT(s,l):null,w=s&&i?m4(u,s,i,l):null;return d.jsxs("div",{className:"qb-row",children:[d.jsxs("div",{className:"qb-meta",children:[d.jsxs("span",{className:"qb-label",children:[t,a&&d.jsx("span",{className:"qb-limit-badge",title:"Rate limit reached",children:"⛔"})]}),d.jsx("span",{className:"qb-pct",style:{color:p},children:f})]}),d.jsxs("div",{className:"qb-track",children:[d.jsx("div",{className:"qb-fill",style:{width:`${g}%`,background:p,opacity:u===0?.4:1}}),w&&d.jsx("div",{className:"qb-pace-marker",style:{left:`${w.expectedPct}%`,background:w.isDeficit?"var(--err)":"var(--ok)"},title:`To last until reset, stay near ${Math.round(w.expectedPct)}% by now`})]}),d.jsxs("div",{className:"qb-reset-row",children:[y?d.jsxs("span",{className:"qb-reset",children:["resets in ",y]}):n?d.jsxs("span",{className:"qb-reset",children:["resets ",n]}):null,w&&d.jsx("span",{className:"qb-pace",style:{color:w.color},children:w.runsOutIn?`runs out in ${w.runsOutIn}`:w.label})]})]})}const g4=6e4;function v4(e){const[t,n]=S.useState(null),[s,i]=S.useState(!1),a=S.useRef(null),l=S.useRef(!1),u=async(p=!1)=>{if(!(p&&!ar(l.current))){p&&(l.current=!0,i(!0));try{const g=await fetch(p?"/api/quota?refresh=1":"/api/quota");g.ok&&n(await g.json())}catch{}finally{p&&(l.current=!1,i(!1))}}};return S.useEffect(()=>{if(e)return u(!0),a.current=window.setInterval(()=>u(!1),g4),()=>{a.current!=null&&window.clearInterval(a.current)}},[e]),{quota:t,loading:s,refresh:()=>{e&&u(!0)}}}function y4(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 w4(e){switch(e){case"no_token":return"Run codex login to authenticate.";case"api_key_mode":return"API-key login — ChatGPT quota is only available for codex login.";case"refresh_rejected":return"Codex session expired — run codex login.";case"refresh_failed":return"Couldn't refresh the Codex token — click ↻ to retry.";case"untrusted_base_url":return"chatgpt_base_url in ~/.codex/config.toml is not an https OpenAI host, so the token was not sent.";default:return"ChatGPT API unreachable — click ↻ to retry."}}const ST=6e4;function x4(e){const[t,n]=S.useState(null),[s,i]=S.useState(!1),a=S.useRef(null),l=S.useRef(!1),u=async(p=!1)=>{if(!(p&&!ar(l.current))){p&&(l.current=!0,i(!0));try{const g=await fetch(p?"/api/codex-quota?refresh=1":"/api/codex-quota");g.ok&&n(await g.json())}catch{}finally{p&&(l.current=!1,i(!1))}}};return S.useEffect(()=>{if(e)return u(!0),a.current=window.setInterval(()=>u(!1),ST),()=>{a.current!=null&&window.clearInterval(a.current)}},[e]),{data:t,loading:s,refresh:()=>{e&&u(!0)}}}function b4(e){const[t,n]=S.useState(null),s=S.useRef(null),i=async()=>{try{const a=await fetch("/api/codex-usage");a.ok&&n(await a.json())}catch{}};return S.useEffect(()=>{if(e)return i(),s.current=window.setInterval(i,ST),()=>{s.current!=null&&window.clearInterval(s.current)}},[e]),{data:t}}function _4(e,t){const[n,s]=S.useState(null),[i,a]=S.useState(!1),[l,u]=S.useState(0);S.useEffect(()=>{const p=()=>{document.visibilityState==="visible"&&u(y=>y+1)},f=window.setInterval(p,6e4),g=()=>{document.visibilityState==="visible"&&u(y=>y+1)};return document.addEventListener("visibilitychange",g),()=>{window.clearInterval(f),document.removeEventListener("visibilitychange",g)}},[]);const h=S.useRef(t);return S.useEffect(()=>{let p=!0;const f=t!==h.current;h.current=t;const g=e,y=a4(g);return a(!0),fetch(`/api/ccusage?since=${y}${f?"&refresh=1":""}`).then(w=>w.ok?w.json():null).then(w=>{p&&(w!=null&&w.ok)&&s({period:g,data:w})}).catch(()=>{}).finally(()=>{p&&a(!1)}),()=>{p=!1}},[e,t,l]),{data:(n==null?void 0:n.data)??null,shown:(n==null?void 0:n.period)??null,loading:i,stale:n!=null&&n.period!==e}}function Ua(e,t){const[n,s]=S.useState(e),i=S.useRef(e),a=S.useRef(t),l=S.useRef(!0);return S.useEffect(()=>{i.current=n},[n]),S.useEffect(()=>{const u=a.current!==t;if(a.current=t,l.current||u){l.current=!1,i.current=e,s(e);return}return i4(i.current,e,p=>{i.current=p,s(p)})},[e,t]),n}function k4({state:e,now:t,providers:n,onClose:s}){var De,Me,_e;const{quota:i,loading:a,refresh:l}=v4(n.claude),{data:u,loading:h,refresh:p}=x4(n.codex),{data:f}=b4(n.codex),[g,y]=S.useState(()=>Math.floor(Date.now()/1e3));S.useEffect(()=>{const G=window.setInterval(()=>y(Math.floor(Date.now()/1e3)),3e4);return()=>window.clearInterval(G)},[]);const{byModel:w,totalCost:N,totalTokens:b,burnRate:_}=S.useMemo(()=>{const G=new Map;for(const Be of e.agents.values())for(const Ie of xl(Be)){const Je=Ie.model??Kf,Ge=xw(Ie.usage,Ie.model),Qe=G.get(Je);Qe?(Qe.inputTokens+=Ie.usage.inputTokens,Qe.outputTokens+=Ie.usage.outputTokens,Qe.cacheReadTokens+=Ie.usage.cacheReadTokens,Qe.cacheCreateTokens+=Ie.usage.cacheCreateTokens,Qe.cost.total+=Ge.total,Qe.cost.input+=Ge.input,Qe.cost.output+=Ge.output,Qe.cost.cacheRead+=Ge.cacheRead,Qe.cost.cacheWrite+=Ge.cacheWrite,Qe.agentCount++):G.set(Je,{model:Je,inputTokens:Ie.usage.inputTokens,outputTokens:Ie.usage.outputTokens,cacheReadTokens:Ie.usage.cacheReadTokens,cacheCreateTokens:Ie.usage.cacheCreateTokens,cost:{...Ge},agentCount:1,priced:Hi(Ie.model)!=null})}const he=Array.from(G.values()).sort((Be,Ie)=>Ie.cost.total-Be.cost.total||Ie.inputTokens+Ie.outputTokens-(Be.inputTokens+Be.outputTokens));let ve=0,We=0;for(const Be of e.agents.values()){if(Be.state!=="active")continue;const Ie=_n(Be);ve+=Ie.total,We=Math.max(We,((Be.endedAt??t)-Be.startedAt)/1e3)}const at=We>0?xu(ve,We):null,rt=gT(e.agents.values());return{byModel:he,totalCost:rt.cost,totalTokens:rt,burnRate:at}},[e,e.revision,t]),k=S.useMemo(()=>{const G=[];for(const he of e.agents.values()){if(he.kind!=="root")continue;let ve=_n(he).total,We=he.usage.inputTokens,at=he.usage.outputTokens,rt=Ly(he);for(const Be of e.agents.values())Be.sessionId!==he.sessionId||Be.kind==="root"||(ve+=_n(Be).total,We+=Be.usage.inputTokens,at+=Be.usage.outputTokens,rt+=Ly(Be));G.push({sessionId:he.sessionId,label:he.label||he.cwdBasename||"session",state:he.state,cost:ve,inputTokens:We,outputTokens:at,unpricedTokens:rt})}return G.sort((he,ve)=>ve.cost-he.cost||ve.inputTokens+ve.outputTokens-(he.inputTokens+he.outputTokens)).slice(0,12)},[e,e.revision]),[E,j]=S.useState("today"),[C,I]=S.useState(0),{data:P,shown:O,stale:F}=_4(E,C),M=P!=null,A=S.useMemo(()=>{const G=new Map;for(const he of e.agents.values()){if(he.kind!=="root"||!he.sessionId)continue;const ve=he.label||he.cwdBasename;ve&&G.set(he.sessionId,ve)}return G},[e,e.revision]),q=S.useMemo(()=>{const G=new Map;for(const he of e.agents.values())he.kind!=="root"||!he.sessionId||G.set(he.sessionId,he.state);return G},[e,e.revision]),W=S.useMemo(()=>M?wT(P):[],[P,M]),K=S.useMemo(()=>{if(!M)return[];const G=l4(P,A).slice(0,12),he=new Map;for(const ve of G)ve.label&&he.set(ve.label,(he.get(ve.label)??0)+1);return G.map(ve=>ve.label&&(he.get(ve.label)??0)>1?{...ve,label:`${ve.label} ${ve.sessionId.slice(0,4)}`}:ve)},[P,M,A]),T=S.useMemo(()=>c4(P),[P]),Z=((De=b1.find(G=>G.key===(O??E)))==null?void 0:De.noun)??"today",U=F?" up-stale":"",re=M?T.cost>0:N.total>0,Q=M?T.tokens:b.sum,H=M?`range:${O??E}`:"board",te=Ua(M?T.cost:N.total,H),$=Ua(M?T.inputTokens:b.inputTokens,H),V=Ua(M?T.outputTokens:b.outputTokens,H),J=Ua(M?T.cacheReadTokens:b.cacheReadTokens,H),D=Ua(M?T.cacheCreateTokens:b.cacheCreateTokens,H),L=w.filter(G=>G.cost.total>0||G.inputTokens+G.outputTokens>0),X=k.filter(G=>G.cost>0||G.inputTokens+G.outputTokens>0),se=M?W.some(G=>G.cost<=0&&G.tokens>0):L.some(G=>!G.priced),fe=a||h,pe=_1(i==null?void 0:i.fetchedAt,g),xe=_1(u==null?void 0:u.fetchedAt,g),je=()=>{l(),p(),I(G=>G+1)},He=n.claude&&n.codex?"Refresh Claude + Codex quota":n.codex?"Refresh Codex quota":"Refresh Claude quota";return d.jsxs("aside",{className:"usage-panel",id:"usage-panel","aria-label":"Usage",children:[d.jsxs("div",{className:"up-header",children:[d.jsx("h2",{children:"Usage"}),_&&d.jsx("span",{className:"up-rate",children:_}),d.jsxs("div",{className:"up-header-right",children:[(n.claude||n.codex)&&d.jsx("button",{type:"button",className:"glyph-btn up-refresh-btn",onClick:je,...ir(fe),"aria-label":He,title:He,children:fe?"…":"↻"}),d.jsx("button",{type:"button",className:"glyph-btn up-close",onClick:s,"aria-label":"Close usage panel",title:"Close (U)",children:"×"})]})]}),n.claude&&d.jsxs("section",{className:"up-section up-quota-section",children:[d.jsxs("h3",{className:"up-section-title",children:["Claude quota",pe&&!a&&d.jsx("span",{className:"up-section-age",title:p4(i==null?void 0:i.source),children:pe})]}),i!=null&&i.ok?d.jsxs("div",{className:"up-quota-bars",children:[i.session5hPct!=null&&d.jsx(ho,{label:"5-hour window",pct:i.session5hPct,reset:i.session5hReset,resetAt:i.session5hResetAt,windowSec:i.session5hWindowSec,nowSec:g}),i.week7dPct!=null&&d.jsx(ho,{label:"7-day window",pct:i.week7dPct,reset:i.week7dReset,resetAt:i.week7dResetAt,windowSec:i.week7dWindowSec,nowSec:g}),i.weekSonnetPct!=null&&d.jsx(ho,{label:"Sonnet (7d)",pct:i.weekSonnetPct,nowSec:g}),i.weekOpusPct!=null&&d.jsx(ho,{label:"Opus (7d)",pct:i.weekOpusPct,nowSec:g})]}):(i==null?void 0:i.ok)===!1?d.jsxs("div",{className:"up-quota-na",children:[d.jsx("span",{children:i.reason==="no_subscription"?"No quota to show.":"Quota unavailable."}),d.jsx("span",{className:"up-quota-hint",children:y4(i.reason)})]}):d.jsx("div",{className:"up-quota-na up-quota-loading",children:"Checking…"})]}),n.codex&&d.jsxs("section",{className:"up-section up-quota-section",children:[d.jsxs("h3",{className:"up-section-title",children:["Codex quota",(u==null?void 0:u.ok)&&u.planLabel&&d.jsx("span",{className:"up-plan-badge",children:u.planLabel}),xe&&!h&&d.jsx("span",{className:"up-section-age",title:"Fetched from the Codex usage endpoint",children:xe})]}),u!=null&&u.ok?d.jsxs("div",{className:"up-quota-bars",children:[(Me=u.windows)==null?void 0:Me.map(G=>d.jsx(ho,{label:G.label,pct:G.pct,reset:G.reset??void 0,resetAt:G.resetAt??void 0,windowSec:G.windowSec??void 0,limitReached:u.limitReached&&G.pct>=100,nowSec:g},G.id)),(_e=u.extraWindows)==null?void 0:_e.map(G=>d.jsx(ho,{label:G.label,pct:G.pct,reset:G.reset??void 0,resetAt:G.resetAt??void 0,windowSec:G.windowSec??void 0,nowSec:g},G.id)),u.creditLimit&&d.jsx(ho,{label:`spend cap · $${Math.round(u.creditLimit.used)} of $${Math.round(u.creditLimit.limit)}`,pct:u.creditLimit.usedPct,reset:u.creditLimit.reset??void 0,resetAt:u.creditLimit.resetAt??void 0,limitReached:u.spendControlReached,nowSec:g}),u.creditsBalance&&!u.creditsUnlimited&&d.jsxs("div",{className:"up-quota-sub up-credits",children:["credits: $",u.creditsBalance,u.overageReached&&" · overage limit reached"]}),u.creditsUnlimited&&d.jsx("div",{className:"up-quota-sub up-credits",children:"credits: unlimited"}),u.resetCredits&&u.resetCredits.availableCount>0&&d.jsxs("div",{className:"up-quota-sub up-reset-credits",title:`Redeem in the Codex CLI or ChatGPT — ${zt} only reports them`,children:[u.resetCredits.availableCount," rate-limit reset",u.resetCredits.availableCount!==1?"s":""," available",u.resetCredits.nextExpiryAt&&` · expires ${new Date(u.resetCredits.nextExpiryAt).toLocaleDateString("en-US",{month:"short",day:"numeric"})}`]}),u.promo&&d.jsx("div",{className:"up-quota-sub",children:u.promo}),u.partial&&d.jsx("div",{className:"up-quota-sub up-quota-hint",children:"Partial data — OpenAI returned limits this build doesn't recognise."})]}):(u==null?void 0:u.ok)===!1?d.jsxs("div",{className:"up-quota-na",children:[d.jsx("span",{children:"Quota unavailable."}),d.jsx("span",{className:"up-quota-hint",children:w4(u.reason)})]}):d.jsx("div",{className:"up-quota-na up-quota-loading",children:"Checking…"}),(f==null?void 0:f.ok)&&f.window7d&&f.window7d.sessionCount>0&&d.jsxs("div",{className:"up-quota-sub",title:`Counted from the rollout files under CODEX_HOME — no network, no account${f.window5h?`
74
+ last 5h: ${Ct(f.window5h.totalTokens)} tokens · ${f.window5h.sessionCount} session${f.window5h.sessionCount!==1?"s":""}`:""}`,children:[Ct(f.window7d.totalTokens)," tokens · ",f.window7d.sessionCount," session",f.window7d.sessionCount!==1?"s":""," (7d)"]})]}),M&&d.jsx("div",{className:"uh-range up-period",role:"group","aria-label":"Period",children:b1.map(G=>d.jsx("button",{type:"button","aria-pressed":E===G.key,className:"uh-range-btn",onClick:()=>j(G.key),children:G.label},G.key))}),Q>0?d.jsxs(d.Fragment,{children:[re&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:`up-total${U}`,title:M?void 0:ku,children:[d.jsx("span",{className:"up-total-value",children:Ve(te)}),d.jsx("span",{className:"up-total-label",children:M?Z:V3})]}),!M&&d.jsx(Sw,{cost:N})]}),d.jsxs("div",{className:`up-tokens-row${U}`,title:M?void 0:ku,children:[d.jsxs("span",{className:"up-tok",children:[d.jsx("span",{className:"up-k",children:"in"}),Ct($)]}),d.jsxs("span",{className:"up-tok",children:[d.jsx("span",{className:"up-k",children:"out"}),Ct(V)]}),(M?T.cacheReadTokens:b.cacheReadTokens)>0&&d.jsxs("span",{className:"up-tok",children:[d.jsx("span",{className:"up-k",children:"cache r"}),Ct(J)]}),(M?T.cacheCreateTokens:b.cacheCreateTokens)>0&&d.jsxs("span",{className:"up-tok",children:[d.jsx("span",{className:"up-k",children:"cache c"}),Ct(D)]}),!re&&d.jsx("span",{className:"up-tok up-scope",children:Y3})]}),(M?W.length:L.length)>0&&d.jsxs("section",{className:`up-section${U}`,children:[d.jsx("h3",{className:"up-section-title",children:"By model"}),d.jsxs("table",{className:"up-table",children:[d.jsx("thead",{children:d.jsxs("tr",{children:[d.jsx("th",{children:"Model"}),d.jsx("th",{children:"Tokens"}),d.jsx("th",{children:"Cost"})]})}),d.jsx("tbody",{children:M?W.map(G=>d.jsxs("tr",{children:[d.jsx("td",{className:"up-model-name",title:G.model,children:Is(G.model)}),d.jsx("td",{className:"up-num",children:Ct(G.tokens)}),G.cost>0?d.jsx("td",{className:"up-num up-cost-val",children:Ve(G.cost)}):d.jsx("td",{className:"up-num up-unpriced",children:Ei})]},G.model)):L.map(G=>d.jsxs("tr",{children:[d.jsx("td",{className:"up-model-name",title:G.model===Kf?"no model reported yet":G.model,children:G.model===Kf?"unknown":Is(G.model)}),d.jsx("td",{className:"up-num",children:Ct(G.inputTokens+G.outputTokens)}),G.priced?d.jsx("td",{className:"up-num up-cost-val",children:Ve(G.cost.total)}):d.jsx("td",{className:"up-num up-unpriced",children:Ei})]},G.model))})]})]}),M&&K.length===0&&T.tokens>0&&d.jsxs("section",{className:"up-section",children:[d.jsx("h3",{className:"up-section-title",children:"By session"}),d.jsxs("div",{className:"up-hint",children:["No session is dated ",Z," yet — ccusage dates sessions in UTC, and the totals above are your local day."]})]}),(M?K.length:X.length)>0&&d.jsxs("section",{className:`up-section${U}`,children:[d.jsxs("h3",{className:"up-section-title",children:["By session",M&&d.jsxs("span",{className:"up-section-age",title:`Sessions with activity ${Z}, each showing what that session has cost since it started.
75
+ A session that began earlier brings its whole total with it, so these rows can add up to more than the figure above.`,children:["active ",Z]})]}),d.jsxs("div",{className:"up-sessions",children:[M&&K.map(G=>{const he=q.get(G.sessionId);return d.jsxs("div",{className:"up-session-row",children:[he?d.jsxs(d.Fragment,{children:[d.jsx("span",{className:`sl-dot state-${he}`,"aria-hidden":!0}),d.jsx("span",{className:"vis-hidden",children:_u(he)})]}):d.jsx("span",{className:"sl-dot up-dot-past","aria-hidden":!0}),d.jsx("span",{className:`up-session-label${G.label?"":" up-session-id"}`,title:G.label?`${G.label}
76
+ ${G.sessionId}`:G.sessionId,children:G.label??G.sessionId.slice(0,8)}),d.jsx("span",{className:"up-session-tokens",children:Ct(G.tokens)}),G.cost>0?d.jsx("span",{className:"up-session-cost",title:G.models.join(", ")||void 0,children:Ve(G.cost)}):d.jsx("span",{className:"up-session-cost up-unpriced",children:Ei})]},G.sessionId)}),!M&&X.map(G=>d.jsxs("div",{className:"up-session-row",children:[d.jsx("span",{className:`sl-dot state-${G.state}`,"aria-hidden":!0}),d.jsx("span",{className:"vis-hidden",children:_u(G.state)}),d.jsx("span",{className:"up-session-label",children:G.label}),d.jsx("span",{className:"up-session-tokens",children:Ct(G.inputTokens+G.outputTokens)}),G.cost>0?d.jsxs("span",{className:"up-session-cost",title:G.unpricedTokens>0?`${Ct(G.unpricedTokens)} tokens in this session are on an unpriced model, so this is a floor`:void 0,children:[Ve(G.cost),G.unpricedTokens>0?"+":""]}):d.jsx("span",{className:"up-session-cost up-unpriced",children:Ei})]},G.sessionId))]})]}),se&&d.jsxs("div",{className:"up-hint",children:["“",Ei,"” means this build holds no published rate for that model — those tokens are counted above and their dollars are not."]})]}):d.jsx("div",{className:"up-empty",children:M?d.jsxs(d.Fragment,{children:["No usage ",Z,".",d.jsx("br",{}),"Try a longer period."]}):d.jsxs(d.Fragment,{children:["No usage data yet.",d.jsx("br",{}),"Start a Claude Code or Codex session."]})})]})}const S4="1",k1="agent-dag.schema",N4=["agent-dag.layout","agent-dag.viewport"];function Lu(e){if(typeof window>"u")return null;try{return window.localStorage.getItem(e)}catch{return null}}function E4(e,t=S4){let n=null;try{n=e.getItem(k1)}catch{return[]}if(n===t)return[];const s=[];if(n!==null)for(const i of N4)try{e.getItem(i)!==null&&(e.removeItem(i),s.push(i))}catch{}try{e.setItem(k1,t)}catch{}return s}const yt={l:30,r:6,t:6,b:2},qu=104,j4=64;function mo(e,t=100,n=qu){const s=n-yt.t-yt.b;return yt.t+s*(1-Math.max(0,Math.min(t,e))/t)}function C4(e,t,n,s=100,i=qu){if(!e.length)return"";const a=e[e.length-1].t-e[0].t,l=p=>{const f=t-yt.l-yt.r;return yt.l+(a>0?f*(p-e[0].t)/a:f/2)};let u="",h=null;for(const p of e){const f=h&&p.t-h.t<=n*2?"L":"M";u+=`${f}${l(p.t).toFixed(1)} ${mo(p.v,s,i).toFixed(1)}`,h=p}return u}function T4(e,t,n,s=100,i=qu){if(e.length<2)return"";const a=i-yt.b,l=e[e.length-1].t-e[0].t,u=t-yt.l-yt.r,h=y=>yt.l+(l>0?u*(y-e[0].t)/l:u/2);let p="",f=[];const g=()=>{if(f.length>=2){let y=`M${h(f[0].t).toFixed(1)} ${a}`;for(const w of f)y+=`L${h(w.t).toFixed(1)} ${mo(w.v,s,i).toFixed(1)}`;p+=`${y}L${h(f[f.length-1].t).toFixed(1)} ${a}Z`}f=[]};for(const y of e)f.length&&y.t-f[f.length-1].t>n*2&&g(),f.push(y);return g(),p}function R4(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 A4(e,t,n){return n!=null&&e>=n?"hot":t!=null&&e>=t?"warn":""}function M4(e,t,n=s=>Ja(s)){const s=e.filter(l=>l.v>0);if(!e.length)return null;if(!s.length)return"never held back";const i=s.length*(t/6e4),a=s[s.length-1];return`held back for ${i===1?"1 minute":`${i} minutes`}, last at ${n(a.t)}`}function Ja(e){const t=new Date(e);return`${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}`}function NT(e,t){const n=Math.max(0,Math.floor((t-e)/6e4));if(n<1)return"less than a minute";if(n<60)return`${n} minute${n===1?"":"s"}`;const s=Math.floor(n/60),i=n%60;return i?`${s}h ${i}m`:`${s}h`}function I4({group:e,title:t,onClose:n}){const s=Sn(n),[i,a]=S.useState(null);S.useEffect(()=>{let p=!0;const f=async()=>{try{const y=await fetch(`/api/system/history?group=${e}`);if(!y.ok)return;const w=await y.json();p&&(w!=null&&w.ok)&&a(w)}catch{}};f();const g=window.setInterval(f,2e4);return()=>{p=!1,window.clearInterval(g)}},[e]);const l=(i==null?void 0:i.series)??[],[u,h]=S.useMemo(()=>{let p=1/0,f=0;for(const g of l)g.points.length&&(p=Math.min(p,g.points[0].t),f=Math.max(f,g.points[g.points.length-1].t));return[Number.isFinite(p)?Math.max(p,(i==null?void 0:i.sinceMs)??0):(i==null?void 0:i.sinceMs)??0,f]},[l,i==null?void 0:i.sinceMs]);return iw.createPortal(d.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:d.jsxs("div",{ref:s,className:"modal hist-modal",onClick:p=>p.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"hist-modal-title",children:[d.jsxs("div",{className:"modal-head",children:[d.jsx("span",{className:"modal-title",id:"hist-modal-title",children:t}),i&&u>0&&d.jsxs("span",{className:"hist-since",children:["since ",Ja(u)," · ",NT(u,h||Date.now())]}),d.jsx("button",{type:"button",className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),d.jsx("div",{className:"hist-body",children:i==null?d.jsx("p",{className:"hist-empty",children:"Reading…"}):l.length===0?d.jsx("p",{className:"hist-empty",children:"Nothing has been measured yet."}):l.map(p=>d.jsx(O4,{series:p,stepMs:i.stepMs},p.label))})]})}),document.body)}function O4({series:e,stepMs:t}){const n=S.useRef(null),[s,i]=S.useState(560),[a,l]=S.useState(null);S.useEffect(()=>{const O=n.current;if(!O||typeof ResizeObserver>"u")return;const F=new ResizeObserver(([M])=>i(Math.max(160,M.contentRect.width)));return F.observe(O),()=>F.disconnect()},[]);const{points:u,unit:h,warnAt:p,critAt:f,label:g,top:y,restsAtZero:w}=e,N=w?j4:qu,{now:b,peak:_}=R4(u),k=h==="C"?"°C":h,E=g==="Throttling"?M4(u,t):null,j=a!=null?u[a]:null,C=u.length>1?u[u.length-1].t-u[0].t:0,I=O=>{const F=s-yt.l-yt.r;return yt.l+(C>0?F*(O-u[0].t)/C:F/2)},P=O=>{if(u.length<2)return;const F=O.currentTarget.getBoundingClientRect(),M=(O.clientX-F.left-yt.l)/Math.max(1,F.width-yt.l-yt.r),A=u[0].t+C*Math.max(0,Math.min(1,M));let q=0;for(let W=1;W<u.length;W++)Math.abs(u[W].t-A)<Math.abs(u[q].t-A)&&(q=W);l(q)};return d.jsxs("section",{className:"hist-series","aria-label":`${g} history`,children:[d.jsxs("div",{className:"hist-head",children:[d.jsx("span",{className:"hist-label",children:g}),d.jsxs("span",{className:"hist-stats",children:[b!=null&&d.jsxs(d.Fragment,{children:[d.jsx("b",{children:b}),d.jsxs("span",{children:[k," now"]})]}),_!=null&&d.jsxs(d.Fragment,{children:[d.jsx("b",{className:A4(_,p,f),children:_}),d.jsxs("span",{children:[k," peak"]})]})]})]}),d.jsx("div",{className:"hist-plot",ref:n,children:d.jsxs("svg",{className:"hist-chart",width:"100%",height:N,viewBox:`0 0 ${s} ${N}`,preserveAspectRatio:"none",role:"img","aria-label":b==null?`${g}: nothing measured yet`:`${g}: ${b}${k} now, peak ${_}${k}, over ${NT(u[0].t,u[u.length-1].t)}`,onPointerMove:P,onPointerLeave:()=>l(null),children:[[["warn",p],["hot",f]].map(([O,F])=>F==null||F>y?null:d.jsxs("g",{children:[d.jsx("line",{className:`hist-rule ${O}`,x1:yt.l,x2:s-yt.r,y1:mo(F,y,N),y2:mo(F,y,N)}),d.jsx("text",{className:`hist-rule-tag ${O}`,x:2,y:mo(F,y,N)+3,children:F})]},O)),d.jsx("line",{className:"hist-floor",x1:yt.l,x2:s-yt.r,y1:N-yt.b,y2:N-yt.b}),d.jsx("path",{className:"hist-area",d:T4(u,s,t,y,N)}),d.jsx("path",{className:"hist-line",d:C4(u,s,t,y,N)}),u.length===1&&d.jsx("circle",{className:"hist-dot",cx:I(u[0].t),cy:mo(u[0].v,y,N),r:3}),j&&d.jsxs("g",{children:[d.jsx("line",{className:"hist-cross",x1:I(j.t),x2:I(j.t),y1:yt.t,y2:N-yt.b}),d.jsx("circle",{className:"hist-dot",cx:I(j.t),cy:mo(j.v,y,N),r:3})]})]})}),d.jsx("div",{className:"hist-axis",children:j?d.jsxs("span",{className:"hist-at",children:[Ja(j.t)," — ",d.jsx("b",{children:j.v}),k]}):d.jsxs(d.Fragment,{children:[d.jsx("span",{children:u.length?Ja(u[0].t):""}),d.jsx("span",{children:u.length?Ja(u[u.length-1].t):""})]})}),E&&d.jsx("div",{className:"hist-note",children:E})]})}function P4({procs:e,total:t,onClose:n}){const s=Sn(n),[i,a]=S.useState(ET),l=Uy(e,i);return iw.createPortal(d.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:d.jsxs("div",{ref:s,className:"modal pl-modal",onClick:u=>u.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"pl-modal-title",children:[d.jsxs("div",{className:"modal-head",children:[d.jsx("span",{className:"modal-title",id:"pl-modal-title",children:"Busiest processes"}),d.jsxs("span",{className:"pl-count",children:[l.length," of ",t," running"]}),d.jsx("button",{type:"button",className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),d.jsx("div",{className:"pl-body",children:l.length===0?d.jsx("p",{className:"pl-empty",children:"Could not read the process list on this platform."}):d.jsxs("table",{className:"sd-procs pl-table",children:[d.jsx("thead",{children:d.jsxs("tr",{children:[d.jsx(Oi,{col:"cpu",label:"cpu",sort:i,onSort:a}),d.jsx(Oi,{col:"mem",label:"mem",sort:i,onSort:a}),d.jsx("th",{scope:"col",className:"pl-pid-h",children:"pid"}),d.jsx(Oi,{col:"name",label:"process",sort:i,onSort:a})]})}),d.jsx("tbody",{children:l.map(u=>d.jsxs("tr",{children:[d.jsx("td",{className:"sd-num",children:u.cpu==null?"—":u.cpu.toFixed(0)}),d.jsx("td",{className:"sd-num sd-dim",children:u.mem.toFixed(1)}),d.jsx("td",{className:"sd-num sd-dim pl-pid",children:u.pid}),d.jsx("td",{className:"pl-name",children:u.name})]},u.pid))})]})}),d.jsx("div",{className:"pl-foot",children:"The busiest by processor and by memory, refreshed every four seconds. Not every process on the machine."})]})}),document.body)}const $4=3e3,L4=4e3,Xf=20,Wa=36,Si=8,q4=8,ET={key:"cpu",dir:"desc",rank:"cpu"};function D4(e,t){return e.key===t?{...e,dir:e.dir==="asc"?"desc":"asc"}:{key:t,dir:t==="name"?"asc":"desc",rank:t==="name"?e.rank:t}}function Uy(e,t){const n=t.dir==="asc"?1:-1,s=(i,a)=>{if(t.key==="name")return n*i.name.localeCompare(a.name,void 0,{sensitivity:"base"});const l=t.key==="cpu"?i.cpu:i.mem,u=t.key==="cpu"?a.cpu:a.mem;return l==null||u==null?l==null?u==null?0:1:-1:n*(l-u)};return[...e].sort((i,a)=>s(i,a)||(a.cpu??-1)-(i.cpu??-1)||a.mem-i.mem||i.pid-a.pid)}function F4(e,t,n=q4){const s=Uy(e,{key:t.rank,dir:"desc",rank:t.rank});return Uy(s.slice(0,n),t)}function z4(e,t){return e.key!==t?"none":e.dir==="asc"?"ascending":"descending"}function B4(e,t,n){return e>=n?"hot":e>=t?"warn":"calm"}function U4(e,t,n=Date.now()){const s=Math.max(0,Math.min(100,100-e));return{pct:s,value:`${s}%`,tone:s===0?"calm":s>=30?"hot":"warn",note:s>0?`CPU held to ${e}% of full speed to cool down`:t?`at full speed · held to ${100-t.peak}% ${W4(t.lastMs,n)}`:"running at full speed, and never held back"}}function W4(e,t=Date.now()){const n=Math.max(0,Math.floor((t-e)/6e4));if(n<2)return"just now";if(n<60)return`${n} minutes ago`;const s=Math.floor(n/60);return s===1?"an hour ago":`${s} hours ago`}const jT="agent-dag.systemPanelOpen";function H4(){return Lu(jT)==="1"}function G4(e){if(!(typeof window>"u"))try{window.localStorage.setItem(jT,e?"1":"0")}catch{}}function go(e){return e>=1024**3?`${(e/1024**3).toFixed(1)} GB`:e>=1024**2?`${Math.round(e/1024**2)} MB`:`${Math.round(e/1024)} KB`}function V4(e){const t=Math.floor(e/86400),n=Math.floor(e%86400/3600),s=Math.floor(e%3600/60);return t>0?`${t}d ${n}h`:n>0?`${n}h ${s}m`:`${s}m`}function Y4(){const[e,t]=S.useState(null),n=S.useRef(null);return S.useEffect(()=>{let s=!0;const i=async()=>{if(document.visibilityState!=="hidden")try{const h=await fetch("/api/system");if(!h.ok)return;const p=await h.json();s&&(p!=null&&p.ok)&&t(p)}catch{}},a=()=>{n.current==null&&(i(),n.current=window.setInterval(i,$4))},l=()=>{n.current!=null&&(window.clearInterval(n.current),n.current=null)},u=()=>{if(document.visibilityState==="hidden"){l();return}a(),i()};return a(),document.addEventListener("visibilitychange",u),()=>{s=!1,l(),document.removeEventListener("visibilitychange",u)}},[]),e}function K4(e){const[t,n]=S.useState(null);return S.useEffect(()=>{let s=!0;const i=async()=>{if(document.visibilityState!=="hidden")try{const l=await fetch("/api/system/processes");if(!l.ok)return;const u=await l.json();s&&(u!=null&&u.ok)&&n({procs:u.procs??[],total:u.total??0})}catch{}};i();const a=window.setInterval(i,L4);return()=>{s=!1,window.clearInterval(a)}},[e]),t}function X4({usageOpen:e=!1}){const t=Y4(),[n,s]=S.useState(H4);S.useEffect(()=>{G4(n)},[n]);const i=S.useRef(null),a=S.useRef(null);if(S.useEffect(()=>{if(n)return Ii.push(()=>{var k,E;const _=((k=a.current)==null?void 0:k.contains(document.activeElement))??!1;s(!1),_&&((E=i.current)==null||E.focus())},lT)},[n]),!t||t.cpu==null||!t.memory)return d.jsx("span",{className:"sysmeter idle",title:"Sampling this machine…",children:d.jsx("span",{className:"sm-box","aria-hidden":!0,children:d.jsxs("span",{className:"sm-graphic",children:[d.jsx("svg",{className:"sm-spark",width:Wa,height:Si,viewBox:`0 0 ${Wa} ${Si}`}),d.jsx("span",{className:"sm-ram"})]})})});const{cpu:l,cpuHistory:u,cores:h,memory:p,loadavg:f}=t,g=p.usedPct>=90,y=u.slice(-Xf),w=Xf-y.length,N=Wa/Xf,b=[`CPU ${l.toFixed(0)}% of ${h} cores`,f?`load ${f[0]} · ${f[1]} · ${f[2]} (1m · 5m · 15m)`:null,`Memory ${go(p.total-p.available)} of ${go(p.total)} used`,"","Click for detail. This machine, not this session."].filter(_=>_!==null).join(`
77
+ `);return d.jsxs("span",{className:"sysmeter-wrap",children:[d.jsxs("button",{type:"button",ref:i,className:"sysmeter",title:b,"aria-label":"Toggle machine detail","aria-expanded":n,"aria-controls":n?"system-panel":void 0,onClick:()=>s(_=>!_),children:[d.jsxs("span",{className:"sm-box","aria-hidden":!0,children:[d.jsxs("span",{className:"sm-graphic",children:[d.jsx("svg",{className:"sm-spark",width:Wa,height:Si,viewBox:`0 0 ${Wa} ${Si}`,children:y.map((_,k)=>{const E=w+k,j=Math.max(1,_/100*Si),C=.32+.68*((k+1)/y.length);return d.jsx("rect",{x:E*N,y:Si-j,width:Math.max(.8,N-.7),height:j,rx:.5,fill:"var(--accent)",opacity:C},E)})}),d.jsx("span",{className:"sm-ram",children:d.jsx("span",{className:`sm-ram-fill${g?" warn":""}`,style:{transform:`scaleX(${Math.max(2,p.usedPct)/100})`}})})]}),d.jsxs("span",{className:"sm-read",children:[d.jsx("b",{children:l.toFixed(0)}),d.jsx("i",{children:"·"}),d.jsx("b",{children:p.usedPct.toFixed(0)})]})]}),d.jsxs("span",{className:"sm-sr",children:["CPU ",l.toFixed(0)," percent, memory ",p.usedPct.toFixed(0)," percent used"]})]}),n&&d.jsx(Q4,{sys:t,usageOpen:e,panelRef:a,onClose:()=>{var _;s(!1),(_=i.current)==null||_.focus()}})]})}function Q4({sys:e,usageOpen:t,panelRef:n,onClose:s}){const i=K4(!0),{memory:a,swap:l,perCore:u,loadavg:h,cores:p,uptimeSec:f,platform:g,thermal:y}=e,w=a?a.total-a.available:0,N=g==="win32"?"Commit":"Swap",b=l&&l.total>0?l.used/l.total*100:0;return d.jsxs("aside",{ref:n,className:`sysdetail${t?" shifted":""}`,id:"system-panel","aria-label":"Machine detail",children:[d.jsxs("div",{className:"sd-head",children:[d.jsx("span",{className:"sd-title",children:"This machine"}),d.jsxs("span",{className:"sd-sub",children:["up ",V4(f)," · ",p," cores"]}),d.jsx("button",{type:"button",className:"glyph-btn sd-close",onClick:s,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),u&&u.length>0&&d.jsx("div",{className:"sd-section",role:"group","aria-label":"Cores",children:d.jsx(cu,{group:"cores",title:"Core history",action:"Show core history",label:"Cores",children:d.jsx("div",{className:"sd-cores",style:{"--n":u.length},children:u.map((_,k)=>d.jsx("span",{className:"sd-core",title:`core ${k+1}: ${_}%`,children:d.jsx("span",{className:"sd-core-fill",style:{transform:`scaleY(${Math.max(2,_)/100})`}})},k))})})}),d.jsx("div",{className:"sd-section",role:"group","aria-label":"Memory",children:d.jsxs(cu,{group:"memory",title:"Memory history",action:"Show memory history",label:"Memory",children:[a&&d.jsx(Su,{label:"Physical",value:d.jsxs(d.Fragment,{children:[d.jsx("b",{children:go(w)})," of ",go(a.total)]}),pct:a.usedPct,tone:a.usedPct>=90?"warn":"calm",note:`${go(a.available)} available`}),l&&l.total>0&&d.jsx(Su,{label:N,value:d.jsxs(d.Fragment,{children:[d.jsx("b",{children:go(l.used)})," of ",go(l.total)]}),pct:b,tone:b>=90?"warn":"calm",note:b>=50?"paging to disk":void 0})]})}),h&&d.jsx("div",{className:"sd-section",role:"group","aria-label":"Load average",children:d.jsxs(cu,{group:"load",title:"Load history",action:"Show load history",label:"Load average",children:[d.jsx("div",{className:"sd-load",children:h.map((_,k)=>d.jsxs("span",{className:`sd-load-item${_>p?" over":""}`,children:[d.jsx("b",{children:_.toFixed(2)}),d.jsx("span",{children:["1m","5m","15m"][k]})]},k))}),d.jsx("div",{className:"sd-note",children:h[0]>p?`${(h[0]/p).toFixed(1)}× more work queued than cores to run it`:`within ${p} cores`})]})}),d.jsx(Z4,{thermal:y}),d.jsx(J4,{read:i})]})}function cu({group:e,title:t,action:n,label:s,children:i}){const[a,l]=S.useState(!1);return d.jsxs(d.Fragment,{children:[d.jsxs("button",{type:"button",className:"sd-open",onClick:()=>l(!0),title:n,"aria-label":n,children:[d.jsxs("div",{className:"sd-h","aria-hidden":!0,children:[s," ",d.jsx("i",{className:"sd-row-more",children:"›"})]}),i]}),a&&d.jsx(I4,{group:e,title:t,onClose:()=>l(!1)})]})}function Z4({thermal:e}){if(!e)return null;const t=e.throttle?U4(e.throttle.speedLimit,e.heldBack):null;return d.jsx("div",{className:"sd-section",role:"group","aria-label":"Thermal",children:d.jsxs(cu,{group:"thermal",title:"Thermal history",action:"Show thermal history",label:"Thermal",children:[e.celsius.map(n=>d.jsx(Su,{label:n.label,value:d.jsxs(d.Fragment,{children:[d.jsx("b",{children:n.celsius})," °C"]}),pct:n.celsius,tone:B4(n.celsius,n.warnAt,n.critAt)},n.label)),t&&d.jsx(Su,{label:"Throttling",value:t.value,pct:t.pct,tone:t.tone,note:t.note})]})})}function J4({read:e}){const[t,n]=S.useState(ET),[s,i]=S.useState(!1),a=(e==null?void 0:e.procs)??null;return d.jsxs("div",{className:"sd-section",role:"group","aria-label":"Busiest processes",children:[d.jsxs("div",{className:"sd-hrow",children:[d.jsx("div",{className:"sd-h","aria-hidden":!0,children:"Busiest processes"}),a!=null&&a.length>0&&d.jsxs("button",{type:"button",className:"sd-all",onClick:()=>i(!0),title:"Show every process the deck is watching","aria-label":"Show every process the deck is watching",children:["more ",d.jsx("i",{className:"sd-row-more","aria-hidden":!0,children:"›"})]})]}),s&&e&&d.jsx(P4,{procs:e.procs,total:e.total,onClose:()=>i(!1)}),a==null?d.jsx("div",{className:"sd-note",children:"reading…"}):a.length===0?d.jsx("div",{className:"sd-note",children:"Could not read the process list on this platform."}):d.jsxs("table",{className:"sd-procs",children:[d.jsx("thead",{children:d.jsxs("tr",{children:[d.jsx(Oi,{col:"cpu",label:"cpu",sort:t,onSort:n}),d.jsx(Oi,{col:"mem",label:"mem",sort:t,onSort:n}),d.jsx(Oi,{col:"name",label:"process",sort:t,onSort:n})]})}),d.jsx("tbody",{children:F4(a,t).map(l=>d.jsxs("tr",{children:[d.jsx("td",{className:"sd-num",children:l.cpu==null?"—":l.cpu.toFixed(0)}),d.jsx("td",{className:"sd-num sd-dim",children:l.mem.toFixed(1)}),d.jsx("td",{className:"sd-proc-name",title:`pid ${l.pid}`,children:l.name})]},l.pid))})]})]})}function Oi({col:e,label:t,sort:n,onSort:s}){const i=z4(n,e);return d.jsx("th",{scope:"col","aria-sort":i,children:d.jsxs("button",{type:"button",className:"sd-sort",title:`Sort by ${t}`,onClick:()=>s(D4(n,e)),children:[t,d.jsx("span",{className:"sd-sort-dir","aria-hidden":!0,children:i==="none"?"":i==="ascending"?"↑":"↓"})]})})}function Su({label:e,value:t,pct:n,tone:s="calm",note:i}){return d.jsxs("div",{className:"sd-row",children:[d.jsxs("div",{className:"sd-row-head",children:[d.jsx("span",{className:"sd-row-label",children:e}),d.jsx("span",{className:"sd-row-val",children:t})]}),d.jsx("span",{className:"sd-track",children:d.jsx("span",{className:`sd-fill${s==="calm"?"":` ${s}`}`,style:{transform:`scaleX(${n<=0?0:Math.max(1,Math.min(100,n))/100})`}})}),i&&d.jsx("div",{className:"sd-note",children:i})]})}const S1=18,eq=1100,Ni=(e,t)=>{const n=Math.sin(e*12.9898+t*78.233)*43758.5453;return n-Math.floor(n)},tq=Array.from({length:S1},(e,t)=>{const n=-72+144*t/(S1-1)+(Ni(t,1)-.5)*9,s=(n-90)*(Math.PI/180),i=(54+32*Math.cos(n*Math.PI/180))*(.74+Ni(t,2)*.52);return{dx:Math.cos(s)*i,dy:Math.sin(s)*i,rot:(t%2?1:-1)*(100+Ni(t,3)*260),delay:Math.round(Ni(t,4)*90),dur:760+Math.round(Ni(t,5)*260),scale:.8+Ni(t,6)*.45,hue:t%4,round:t%3===0}});function N1({anchor:e}){var i;const[t,n]=S.useState(null),s=typeof window<"u"&&((i=window.matchMedia)==null?void 0:i.call(window,"(prefers-reduced-motion: reduce)").matches);return S.useEffect(()=>{if(s)return;const a=e.current;if(!a)return;const l=a.getBoundingClientRect();n({x:l.left+l.width/2,y:l.top+l.height/2});const u=window.setTimeout(()=>n(null),eq);return()=>window.clearTimeout(u)},[e,s]),s||!t?null:iw.createPortal(d.jsx("div",{className:"confetti",style:{left:`${t.x}px`,top:`${t.y}px`},"aria-hidden":!0,children:tq.map((a,l)=>d.jsx("span",{className:`confetti-bit${a.round?" round":""}`,"data-hue":a.hue,style:{"--dx":`${a.dx.toFixed(1)}px`,"--dy":`${a.dy.toFixed(1)}px`,"--rot":`${a.rot}deg`,"--s":a.scale.toFixed(2),animationDelay:`${a.delay}ms`,animationDuration:`${a.dur}ms, ${a.dur}ms`}},l))}),document.body)}const CT=new Set(["awaiting_url","awaiting_code","registering"]);function nq(e){return e!=null&&CT.has(e)}function TT(e){return e!=null&&e!=="done"&&!CT.has(e)}const rq="the sign-in ended before it finished — the deck restarted, or it was cancelled in another tab",sq="the sign-in did not complete";function oq({state:e,serverError:t,localError:n}){const s=e==="idle";return{title:s?"Sign-in ended":"Sign-in failed",message:n||t||(s?rq:sq)}}const iq="done";function aq(){let e=!1;return{shouldAnnounce(t){return t!==iq?(e=!1,!1):e?!1:(e=!0,!0)}}}function Ew(e,t){return t&&Object.hasOwn(e,t)?e[t]:void 0}const lq={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 ${zt}`,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"},cq={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"},uq=`claude-swap could not read the login keychain — start ${zt} from a Terminal window rather than a background service`;function Wy(e,t){if((e==null?void 0:e.reason)!=="no_cswap"&&/keychain/i.test(Fi(e)))return uq;const n=Ew(cq,e==null?void 0:e.reason);return n||(e==null?void 0:e.reason)||t}function Fi(e){return((e==null?void 0:e.output)||(e==null?void 0:e.detail)||(e==null?void 0:e.error)||"").trim()}const dq={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"},fq="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 hq(e){return/\bnpx\b/i.test(e)&&/(command not found|not found|not recognized|ENOENT)/i.test(e)}const pq="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",mq="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",gq=e=>/\b(?:ERR_)?MODULE_NOT_FOUND\b|cannot find (?:module|package)/i.test(e),vq=/node_modules[\\/]npm[\\/]bin[\\/]|\bnpm-prefix\.js\b|\bnp[mx][-.][\w.-]*cli\.js\b/i,yq=/[\\/]_npx[\\/]/i,wq=`the copy of ccusage ${zt} installed for itself`;function xq(e){const t=String((e==null?void 0:e.install)??"").replace(/\s+/g," ").trim();return t.length>240?`${t.slice(0,239)}…`:t}function bq(e,t){const n=_q(e,t),s=xq(e);switch(e==null?void 0:e.stage){case"npx":return s?`ccusage failed on both of its paths. The managed install failed first — ${s} — and the deck then fell back to npx, where ${Ha(n)}`:`there is no managed copy of ccusage on this machine, and the npx fallback failed: ${Ha(n)}`;case"managed":return`${wq} failed to run: ${Ha(n)}`;case"path":return e.bin?`the ccusage this deck found at ${e.bin} failed to run: ${Ha(n)}`:`the ccusage this deck found on your PATH failed to run: ${Ha(n)}`;default:return n}}const Ha=e=>/^[A-Z][a-z]/.test(e)?e[0].toLowerCase()+e.slice(1):e;function _q(e,t){const n=Fi(e);if(gq(n)){if(yq.test(n))return mq;if(vq.test(n))return pq}if(hq(n))return fq;const s=Ew(dq,e==null?void 0:e.reason);return s||(e==null?void 0:e.reason)||t}function Ti(e,t){if(e!=null&&e.detail)return e.detail;if(e!=null&&e.error&&TT(e.state))return e.error;const n=Ew(lq,e==null?void 0:e.reason);return n||(e!=null&&e.error?e.error:(e==null?void 0:e.reason)||t)}function kq(e,t,n){if(n<=0||bw(e))return{kind:"pass"};const s=t>=0&&t<n?t:-1;switch(e.key){case"ArrowRight":return{kind:"select",index:s===-1?0:(s+1)%n};case"ArrowLeft":return{kind:"select",index:s===-1?n-1:(s-1+n)%n};case"Home":return{kind:"select",index:0};case"End":return{kind:"select",index:n-1};default:return{kind:"pass"}}}function RT(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 Sq(e){const t=new Map;for(const n of e){const s=(n.email??"").trim().toLowerCase();s&&t.set(s,(t.get(s)??0)+1)}return e.map(n=>{const s=(n.email??"").trim(),i=n.alias||s||`account ${n.num}`,a=[];return n.alias&&s&&a.push(s),s&&(t.get(s.toLowerCase())??0)>1&&a.push(n.org||`slot ${n.num}`),{num:n.num,label:i,sub:a.length?a.join(" · "):null}})}function Nq(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 Eq(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 jq(e){const t=e.length;if(!t)return"Nothing to import.";const n=p=>e.filter(f=>f.state===p).length,s=[],i=n("imported");i&&s.push(`${i} of ${t} imported`);const a=n("healed");a&&s.push(`${a} had a dead token replaced`);const l=n("updated");l&&s.push(`${l} updated`);const u=n("present");u&&s.push(`${u} already here`);const h=n("failed");return h&&s.push(`${h} did not arrive`),`${s.join(", ")}.`}const Cq=1500,Xc=[{id:"login",label:"Sign in"},{id:"paste",label:"Paste a share"}],E1="aa-panel",j1=e=>`aa-tab-${e}`;async function Ga(e){return(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json().catch(()=>null)}const Hy=ue.forwardRef((e,t)=>d.jsxs("svg",{className:"aa-mark",viewBox:"0 0 44 44","aria-hidden":!0,ref:t,children:[d.jsx("circle",{className:"aa-mark-ring",cx:"22",cy:"22",r:"20"}),d.jsx("path",{className:"aa-mark-tick",d:"M13.5 22.5 L19.5 28.5 L31 17"})]}));Hy.displayName="SuccessMark";function Tq({onClose:e,onChanged:t}){const[n,s]=S.useState("login"),[i,a]=S.useState(null),[l,u]=S.useState(""),[h,p]=S.useState(""),[f,g]=S.useState(!1),[y,w]=S.useState(null),[N,b]=S.useState(null),[_,k]=S.useState(null),[E,j]=S.useState(null),C=S.useRef(""),I=S.useRef(!1),P=S.useRef(!1),O=S.useRef(null),F=S.useRef(null),M=S.useRef(null),A=S.useRef(null),q=S.useRef([]),W=S.useRef(!1),K=S.useCallback(()=>{I.current&&Ga({action:"login-cancel"}).catch(()=>{}),e()},[e]),T=Sn(K,{focusRef:M}),Z=S.useCallback(async()=>{if(!ar(P.current))return;P.current=!0,g(!0),w(null),I.current=!0;const L=await Ga({action:"login"}).catch(()=>null);if(P.current=!1,g(!1),!(L!=null&&L.ok)){w(Ti(L,"could not start the sign-in"));return}a(L)},[]);S.useEffect(()=>{if(!nq(i==null?void 0:i.state))return;const L=window.setInterval(async()=>{try{const X=await fetch("/api/claude-accounts/login");X.ok&&a(await X.json())}catch{}},Cq);return()=>window.clearInterval(L)},[i]);const U=S.useRef(t);U.current=t;const re=S.useState(aq)[0];S.useEffect(()=>{var L;(i==null?void 0:i.state)==="awaiting_code"&&((L=O.current)==null||L.focus()),re.shouldAnnounce(i==null?void 0:i.state)&&U.current()},[i==null?void 0:i.state,re]),S.useEffect(()=>{var L;n==="paste"&&!W.current&&((L=F.current)==null||L.focus()),W.current=!1},[n]);const Q=S.useCallback(L=>{var se;const X=kq(L,Xc.findIndex(fe=>fe.id===n),Xc.length);X.kind!=="pass"&&(L.preventDefault(),W.current=!0,s(Xc[X.index].id),(se=q.current[X.index])==null||se.focus())},[n]),H=S.useCallback(async()=>{var X;if(!ar(P.current))return;P.current=!0,g(!0),w(null);const L=await Ga({action:"login-code",code:l}).catch(()=>null);if(P.current=!1,g(!1),!(L!=null&&L.ok)){w(Ti(L,"the code was not accepted")),L!=null&&L.state&&a(L),(X=O.current)==null||X.select();return}u(""),a(L)},[l,i]),te=S.useCallback(async()=>{if(!ar(P.current))return;P.current=!0,g(!0),w(null);const L=await Ga({action:"import",blob:h}).catch(()=>null);if(P.current=!1,g(!1),!(L!=null&&L.ok)){w(Ti(L,"the import failed"));return}C.current=h,p(""),j(null),b(L.results??[]),t()},[h,t]),$=S.useCallback(async L=>{const X=`${L.email}|${L.org??""}`;if(!ar(P.current)||!C.current)return;P.current=!0,g(!0),k(X),j(null);const se=await Ga({action:"import",blob:C.current,force:!0,only:{email:L.email,org:L.org??""}}).catch(()=>null);if(P.current=!1,g(!1),k(null),!(se!=null&&se.ok)){j({key:X,text:Ti(se,"that account could not be updated")});return}const fe=(se.results??[])[0];fe&&b(pe=>pe&&pe.map(xe=>`${xe.email}|${xe.org??""}`===X?fe:xe)),t()},[t]),V=(i==null?void 0:i.state)==="done"?i.account:null,J=TT(i==null?void 0:i.state)||!!(y&&I.current&&!f),D=oq({state:i==null?void 0:i.state,serverError:i==null?void 0:i.error,localError:y});return d.jsx("div",{className:"modal-backdrop",onClick:K,role:"presentation",children:d.jsxs("div",{ref:T,className:"modal aa-modal",onClick:L=>L.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Add a Claude account",children:[d.jsxs("header",{className:"modal-head",children:[d.jsx("div",{className:"modal-title",children:d.jsx("span",{className:"aa-tabs",role:"tablist","aria-label":"How to add the account",onKeyDown:Q,children:Xc.map((L,X)=>d.jsx("button",{type:"button",role:"tab",id:j1(L.id),ref:se=>{q.current[X]=se},"aria-selected":n===L.id,"aria-controls":E1,tabIndex:n===L.id?0:-1,className:`aa-tab${n===L.id?" on":""}`,onClick:()=>{W.current=!1,s(L.id)},children:L.label},L.id))})}),d.jsx("div",{className:"modal-actions",children:d.jsx("button",{type:"button",className:"glyph-btn",onClick:K,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),d.jsx("section",{className:"modal-body aa-body",id:E1,role:"tabpanel","aria-labelledby":j1(n),children:n==="login"?V?d.jsxs("div",{className:"aa-done",children:[d.jsx(Hy,{ref:A}),d.jsx(N1,{anchor:A}),d.jsx("h4",{children:V.added?`Account ${V.num} added`:"Credentials refreshed"}),d.jsxs("p",{className:"aa-note",children:[d.jsx("strong",{children:V.email}),V.added?" is in the rotation. The account you were using is still active.":" was already managed, so its stored credentials were replaced."]}),d.jsx("button",{type:"button",className:"btn primary",onClick:e,children:"Done"})]}):(i==null?void 0:i.state)==="awaiting_code"||(i==null?void 0:i.state)==="registering"?d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"aa-step",children:[d.jsx("h4",{children:"1 · Approve in the browser"}),d.jsx("p",{className:"aa-note",children:"A tab should have opened. If not, use this link:"}),d.jsx("a",{className:"aa-link",href:i.url??"#",target:"_blank",rel:"noreferrer noopener",children:i.url})]}),d.jsxs("div",{className:"aa-step",children:[d.jsx("h4",{children:"2 · Paste a code, if the page shows one"}),d.jsx("p",{className:"aa-note",children:"It usually finishes on its own — if the page says you are all set, there is nothing to do here."}),d.jsxs("div",{className:"aa-field",children:[d.jsx("input",{ref:O,type:"text",value:l,onChange:L=>u(L.target.value),onKeyDown:L=>{L.key==="Enter"&&l.trim()&&!f&&H()},placeholder:"paste the code here",spellCheck:!1,autoComplete:"off","aria-label":"Sign-in code",disabled:i.state==="registering"}),d.jsx("button",{type:"button",className:"btn primary",...ir(f,!l.trim()||i.state==="registering"),onClick:H,children:i.state==="registering"?"registering…":"Continue"})]}),(y||i.error)&&d.jsx("p",{className:"aa-err",children:y??i.error}),d.jsx("p",{className:"aa-note",children:"The code goes straight to the claude CLI on this machine. It is never stored or sent anywhere else."})]})]}):J?d.jsxs("div",{className:"aa-step",children:[d.jsx("h4",{children:D.title}),d.jsx("p",{className:"aa-err",children:D.message}),d.jsx("button",{type:"button",className:"btn",onClick:()=>{I.current=!1,a(null),w(null),Z()},children:"Try again"})]}):f||I.current?d.jsx("div",{className:"aa-step",children:d.jsx("p",{className:"aa-note",children:"Asking the claude CLI for a sign-in link…"})}):d.jsxs("div",{className:"aa-step aa-primer",children:[d.jsx("h4",{children:"Sign in to Anthropic"}),d.jsx("p",{className:"aa-note",children:"Opens a browser tab where you approve the sign-in. It normally completes by itself; only if the page hands you a code does it need pasting back here. claude-swap records the account when it completes, and the account you are using now stays active."}),d.jsx("div",{className:"aa-actions",children:d.jsx("button",{type:"button",ref:M,className:"btn primary",onClick:Z,children:"Open the sign-in page"})})]}):N?(()=>{const L=N.filter(X=>X.state==="imported").length;return d.jsxs("div",{className:"aa-done",children:[d.jsx(Hy,{ref:A}),L>0&&d.jsx(N1,{anchor:A}),d.jsx("h4",{children:jq(N)}),N.length>0&&d.jsx("ul",{className:"aa-results",children:N.map(X=>{const se=`${X.email}|${X.org??""}`;return d.jsxs("li",{className:`aa-result ${X.state}`,children:[d.jsx("span",{className:"aa-result-who",children:X.email||(X.num?`slot ${X.num}`:"an account")}),d.jsx("span",{className:"aa-result-what",children:Eq(X.state)}),X.state==="present"&&d.jsx("button",{type:"button",className:"aa-result-fix","aria-busy":_===se,title:`Overwrite the stored login for ${X.email} with the one in this share. Do this when that account has stopped working here; if it works, leave it.`,onClick:()=>$(X),children:_===se?"updating…":"update anyway"}),(E==null?void 0:E.key)===se&&d.jsx("span",{className:"aa-result-err",children:E.text})]},se)})}),d.jsxs("p",{className:"aa-note",children:["Nothing changed on the deck you copied this from. An account already here is left as it is, unless its stored login was dead or you pressed",d.jsx("strong",{children:" update anyway"}),"."]}),d.jsxs("div",{className:"aa-actions",children:[d.jsx("button",{type:"button",className:"btn primary",onClick:e,children:"Done"}),d.jsx("button",{type:"button",className:"btn",onClick:()=>{C.current="",j(null),b(null)},children:"Import another"})]})]})})():d.jsxs("div",{className:"aa-step",children:[d.jsx("h4",{children:"Paste an account shared from another deck"}),d.jsxs("div",{className:"aa-field",children:[d.jsx("input",{ref:F,type:"text",value:h,onChange:L=>p(L.target.value),onKeyDown:L=>{L.key==="Enter"&&h.trim()&&!f&&te()},placeholder:"ccdeck2:…",spellCheck:!1,autoComplete:"off","aria-label":"Shared account"}),d.jsx("button",{type:"button",className:"btn primary",...ir(f,!h.trim()),onClick:te,children:f?"importing…":"Import"})]}),y&&d.jsx("p",{className:"aa-err",children:y}),d.jsxs("p",{className:"aa-note",children:["Use ",d.jsx("strong",{children:"share"})," on one account in the other deck, or ",d.jsx("strong",{children:"↗"})," above its list to send several at once. A share carries a live login for every account in it and expires ten minutes after it is made."]})]})})]})})}async function Rq(e){return(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json().catch(()=>null)}const Aq=1800;function Mq({accounts:e,onClose:t,copyText:n}){const[s,i]=S.useState([]),[a,l]=S.useState(null),[u,h]=S.useState(!1),[p,f]=S.useState(null),[g,y]=S.useState(!1),[w,N]=S.useState(()=>Math.floor(Date.now()/1e3)),b=S.useRef(null),_=S.useRef(!1),k=Sn(t,{focusRef:b});S.useEffect(()=>{if(!a)return;N(Math.floor(Date.now()/1e3));const A=window.setInterval(()=>N(Math.floor(Date.now()/1e3)),1e3);return()=>window.clearInterval(A)},[a]);const E=Sq(e),j=e.filter(A=>!s.includes(A.num)).map(A=>A.num),C=j.length===e.length,I=A=>i(q=>q.includes(A)?q.filter(W=>W!==A):[...q,A]),P=S.useCallback(async()=>{if(!ar(_.current)||!j.length)return;_.current=!0,h(!0),f(null),y(!1);const A=await Rq({action:"share",accounts:j}).catch(()=>null);if(_.current=!1,h(!1),!(A!=null&&A.ok)){f(Ti(A,"the share could not be made"));return}l({blob:A.blob,expiresAt:A.expiresAt,shared:A.shared??[],failed:A.failed??[]})},[e,j]),O=a?RT(a.expiresAt,w):null,F=(O==null?void 0:O.tone)==="gone",M=(a==null?void 0:a.shared.length)??0;return d.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:d.jsxs("div",{ref:k,className:"modal sa-modal",onClick:A=>A.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Share accounts with another deck",children:[d.jsxs("header",{className:"modal-head",children:[d.jsx("div",{className:"modal-title",children:d.jsx("h3",{children:"Share accounts"})}),d.jsx("div",{className:"modal-actions",children:d.jsx("button",{type:"button",className:"glyph-btn",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),d.jsx("section",{className:"modal-body sa-body",children:a?d.jsxs("div",{className:"sa-step",children:[d.jsx("h4",{children:F?"This share has expired":M===1?"1 account, ready to paste":`${M} accounts, ready to paste`}),d.jsx("code",{className:`ap-share-blob${F?" sa-dead":""}`,children:a.blob}),d.jsxs("div",{className:"ap-share-foot",children:[d.jsx("button",{type:"button",className:"ap-manage-btn",ref:b,onClick:async()=>{if(F){l(null),P();return}await n(a.blob)&&(y(!0),window.setTimeout(()=>y(!1),Aq))},children:F?"make a new share":g?"copied":`copy ${M===1?"the share":"all "+M}`}),d.jsxs("span",{className:"ap-manage-hint",title:"This text is the sign-in for every account in it. It is base64 of plain JSON — the expiry inside it is not signed, so anyone holding a copy can change it, and the logins themselves are in there in the clear either way. The countdown only says how long another deck's import dialog will still accept it. If a copy escapes, sign those accounts out and back in.",children:[d.jsx("span",{className:"ap-share-warn",children:M===1?"this is the password":`this is ${M} passwords`})," · ",d.jsx("span",{className:`ap-share-expiry ${O==null?void 0:O.tone}`,children:O==null?void 0:O.text})]})]}),a.failed.length>0&&d.jsxs("div",{className:"sa-failed",role:"alert",children:[d.jsx("p",{className:"sa-failed-head",children:a.failed.length===1?"One account is not in this bundle:":`${a.failed.length} accounts are not in this bundle:`}),d.jsx("ul",{className:"sa-list",children:a.failed.map(A=>{var W;const q=!!(A.email&&((W=A.detail)!=null&&W.includes(A.email)));return d.jsxs("li",{children:[!q&&d.jsx("span",{className:"sa-who",children:A.email||`account ${A.num}`}),d.jsx("span",{className:"sa-why",children:A.detail||"could not be exported"})]},`${A.num}-${A.email}`)})})]}),d.jsx("p",{className:"sa-note",children:F?d.jsx(d.Fragment,{children:"Another deck will refuse this text now. Make a new one — the same accounts are still picked."}):d.jsxs(d.Fragment,{children:["Paste it into the other deck with ",d.jsx("strong",{children:"+"})," → ",d.jsx("strong",{children:"Paste a share"}),". Accounts it already holds are left exactly as they are."]})}),d.jsxs("div",{className:"sa-actions",children:[d.jsx("button",{type:"button",className:"btn",onClick:()=>{l(null),y(!1)},children:"Pick again"}),d.jsx("button",{type:"button",className:"btn primary",onClick:t,children:"Done"})]})]}):e.length===0?d.jsxs("div",{className:"sa-step",children:[d.jsx("h4",{children:"Nothing to share"}),d.jsxs("p",{className:"sa-note",children:["This deck is not holding any accounts right now. Sign one in with ",d.jsx("strong",{children:"+"}),", or wait — the panel is still reading the store."]}),d.jsx("div",{className:"sa-actions",children:d.jsx("button",{type:"button",className:"btn primary",ref:b,onClick:t,children:"Close"})})]}):d.jsxs("div",{className:"sa-step",children:[d.jsxs("h4",{children:["Which accounts go to the other ",zt,"?"]}),d.jsx("p",{className:`sa-count${j.length?"":" empty"}`,children:Nq(j.length)}),d.jsx("ul",{className:"sa-list sa-pick",children:E.map(A=>d.jsx("li",{children:d.jsxs("label",{className:"sa-row",children:[d.jsx("input",{type:"checkbox",checked:j.includes(A.num),onChange:()=>I(A.num)}),d.jsx("span",{className:"sa-who",children:A.label}),A.sub&&d.jsx("span",{className:"sa-sub",children:A.sub})]})},A.num))}),p&&d.jsx("p",{className:"aa-err",children:p}),d.jsxs("div",{className:"sa-actions",children:[d.jsx("button",{type:"button",className:"btn",onClick:()=>i(C?e.map(A=>A.num):[]),children:C?"Clear all":"Select all"}),d.jsx("button",{type:"button",className:"btn primary",ref:b,...ir(u,!j.length),onClick:P,children:u?"making the share…":j.length===0?"Share":j.length===1?"Share 1 account":`Share ${j.length} accounts`})]})]})})]})})}function Iq(e,t){const n=new Set(e),s=e.length?Math.max(...e):0;return[...new Set([...e,s+1])].sort((i,a)=>i-a).map(i=>{const a=i===t?"here":n.has(i)?"swap":"free";return{slot:i,kind:a,label:a==="here"?`slot ${i}`:`slot ${i} · ${a}`}})}function Oq(e,t,n){if(!(n!=null&&n.ok))return null;const s=Number.isInteger(n.to)?n.to:null;if(s==null)return{menuFor:null,confirmRemove:null,shareFor:null,swapNote:null};const i=n.swapped===!0&&s!==t;return{menuFor:e.menuFor===t?s:i&&e.menuFor===s?t:e.menuFor,confirmRemove:null,shareFor:null,swapNote:i?{at:s,displaced:t}:null}}function Pq(e,t,n){return t!=null&&e.some(s=>s.slot===t)?t:n}function $q(e,t,n){var i;const s=((i=e.find(a=>a.slot===t))==null?void 0:i.kind)??"here";return s==="swap"?{label:"swap",done:"swapped",sends:!0,swaps:!0,title:`Send this account to slot ${t}. That slot is taken, so the two accounts trade places and the one standing there moves to slot ${n}.`}:s==="free"?{label:"move",done:"moved",sends:!0,swaps:!1,title:`Send this account to slot ${t}. That slot is empty, so no other account moves.`}:{label:"move",done:"here",sends:!1,swaps:!1,title:`This account already holds slot ${n}.`}}function Lq(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 C1(e){return typeof e.id=="string"&&e.id.startsWith("scoped-")}function T1(e){const t=e.filter(u=>!C1(u)),n=e.filter(u=>C1(u)),s=t.length?t:n,i=t.length?n:[],a=s.reduce((u,h)=>u&&u.pct>=h.pct?u:h,null);let l=null;for(const u of i)a&&u.pct<=a.pct||(!l||u.pct>l.pct)&&(l=u);return{shown:s,rest:i,fuller:l,peak:l??a}}function qq(e,t,n){return e<1?null:t?"fewer":n?`${n.label} ${Math.round(n.pct)}%`:`${e} more`}function Dq(e,t,n,s){const i=e==null?"No usage has been collected for this account yet.":`${Math.round(e)}% left on ${t??"the window that runs out first"}, which is the one that runs out first.`,a=n===1?"the other window":`the other ${n} windows`;return`${i} ${s?"Hide":"Show"} ${a}.`}const Fq="\0";function jw(e){const t=typeof e.email=="string"?e.email.trim():"";if(!t)return`slot:${e.num}`;const n=typeof e.org=="string"?e.org.trim():"";return`acct:${t}${Fq}${n}`}function zq(e,t){const n=jw(t);return e.includes(n)?e.filter(s=>s!==n):[...e,n]}function Bq(e,t){if(!Array.isArray(t))return e;const n=new Set(t.map(jw)),s=e.filter(i=>n.has(i));return s.length===e.length?e:s}const Uq=64;function Wq(e,t){const n=e.trim();return{alias:n,commit:n!==(t??"").trim()}}const Hq=Object.freeze({text:"couldn't reach the deck server",reload:!0});async function R1(e){return e.ok?{ok:!0,status:e.status,body:null}:{ok:!1,status:e.status,body:await e.json().catch(()=>null)}}function Gq(e){const t=e.find(s=>!s.ok);if(!t)return null;const n=Fi(t.body);return{text:Wy(t.body,`the deck server answered ${t.status}`),...n?{raw:n}:{},reload:!0}}function A1(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 M1=15e3,Vq=8e3,Qf=1800,Yq=3e4,Kq=[70,80,85,90,95];function I1(e,t){return xT(t-Math.floor(e/1e3))}function Xq(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 Qq(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 O1({lane:e,nowSec:t}){const n=Math.min(100,Math.max(0,e.pct)),s=n>=90?"var(--err)":n>=70?"var(--warn)":"var(--accent)",i=e.resetAt?bT(e.resetAt,t):null;return d.jsxs("div",{className:"ap-lane",children:[d.jsx("span",{className:"ap-lane-label",children:e.label}),d.jsx("div",{className:"ap-lane-track",children:d.jsx("div",{className:"ap-lane-fill",style:{width:`${n===0?1.5:n}%`,background:s,opacity:n===0?.4:1}})}),d.jsxs("span",{className:"ap-lane-pct",style:{color:s},children:[n,"%"]}),d.jsx("span",{className:"ap-lane-reset",children:i?`resets ${i}`:""})]})}async function P1(e){var n;let t=!1;try{t=await Promise.race([((n=navigator.clipboard)==null?void 0:n.writeText(e).then(()=>!0))??Promise.resolve(!1),new Promise(s=>window.setTimeout(()=>s(!1),500))])}catch{t=!1}if(t)return!0;try{const s=document.createElement("textarea");s.value=e,s.setAttribute("readonly",""),s.style.cssText="position:fixed;top:0;left:0;opacity:0",document.body.appendChild(s),s.select(),t=document.execCommand("copy"),s.remove()}catch{t=!1}return t}function Zq({onClose:e}){var Ge,Qe,Oe,lt,Mt;const[t,n]=S.useState(null),[s,i]=S.useState(null),[a,l]=S.useState(null),[u,h]=S.useState(!1),[p,f]=S.useState(null),[g,y]=S.useState(()=>Math.floor(Date.now()/1e3)),w=S.useRef(null),[N,b]=S.useState(null),[_,k]=S.useState(!1),[E,j]=S.useState(""),[C,I]=S.useState(null),[P,O]=S.useState(null),[F,M]=S.useState(null),[A,q]=S.useState(!1),[W,K]=S.useState(!1),[T,Z]=S.useState(null),[U,re]=S.useState(null),[Q,H]=S.useState(null),[te,$]=S.useState(null),[V,J]=S.useState(!1),[D,L]=S.useState([]),X=S.useRef(null),se=S.useCallback(ae=>kT(X.current)?(X.current=ae,l(ae),!0):!1,[]),fe=S.useCallback(()=>{X.current=null,l(null)},[]),pe=(ae,$e=!1)=>{const Fe=_T(a,ae);return{disabled:Fe.disabled,"aria-busy":Fe.busy||$e}},xe=S.useCallback(ae=>{window.requestAnimationFrame(()=>{var $e;if(h4((($e=document.activeElement)==null?void 0:$e.tagName)??null))for(const Fe of f4(ae)){const Ne=document.querySelector(Fe);if(Ne){Ne.focus();return}}})},[]),je=S.useCallback(async(ae=!1)=>{ae&&h(!0);const $e=new AbortController,Fe=window.setTimeout(()=>$e.abort(),Yq);try{const[Ne,Ye]=await Promise.all([fetch(`/api/claude-accounts${ae?"?refresh=1":""}`,{signal:$e.signal}),fetch("/api/cswap-auto",{signal:$e.signal})]);if(Ne.ok){const st=await Ne.json();n(st),L(Te=>Bq(Te,st.accounts))}Ye.ok&&i(await Ye.json());const Et=Gq([await R1(Ne),await R1(Ye)]);f(st=>A1(st,Et))}catch{f(Ne=>A1(Ne,Hq))}finally{window.clearTimeout(Fe),ae&&h(!1)}},[]),He=S.useCallback(async(ae,$e)=>{if(!se($e))return null;f(null);try{const Ne=await(await fetch("/api/cswap-auto",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(ae)})).json().catch(()=>null);return Ne!=null&&Ne.ok||f({text:Wy(Ne,"command failed"),raw:Fi(Ne)}),Ne}catch{return f({text:"server unreachable"}),null}finally{fe()}},[se,fe]),De=S.useCallback(async(ae,$e)=>{if(!se($e))return null;f(null);try{const Ne=await(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(ae)})).json().catch(()=>null);return Ne!=null&&Ne.ok||f({text:Ti(Ne,"command failed")}),Ne}catch{return f({text:"server unreachable"}),null}finally{fe()}},[se,fe]);S.useEffect(()=>(je(!0),w.current=window.setInterval(()=>je(!1),M1),()=>{w.current!=null&&window.clearInterval(w.current)}),[je]),S.useEffect(()=>{const ae=window.setInterval(()=>y(Math.floor(Date.now()/1e3)),3e4);return()=>window.clearInterval(ae)},[]);const Me=((Ge=s==null?void 0:s.settings["autoswitch.threshold"])==null?void 0:Ge.value)??"90",_e=te??Me,G=Lq(_e,Me),he=(Qe=t==null?void 0:t.accounts)==null?void 0:Qe.find(ae=>ae.active),ve=((Oe=T1((he==null?void 0:he.lanes)??[]).peak)==null?void 0:Oe.pct)??null,We=ve!=null&&ve>=Number(Me)-15,at=async ae=>{if(se(`switch-${ae}`)){f(null);try{const Fe=await(await fetch("/api/claude-accounts/switch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({account:ae})})).json().catch(()=>null);Fe!=null&&Fe.ok||f({text:Wy(Fe,"the switch failed"),raw:Fi(Fe)}),await je(!0)}catch{f({text:"server unreachable"})}finally{fe(),xe(ae)}}},rt=async(ae,$e)=>{const{commit:Fe,alias:Ne}=Wq(E,$e);if(Fe){const Ye=await De({action:"alias",account:ae,alias:Ne},`alias-${ae}`);if(await je(!0),!(Ye!=null&&Ye.ok))return;j(Ne)}I(ae),window.setTimeout(()=>I(Ye=>Ye===ae?null:Ye),Qf)},Be=async(ae,$e)=>{const Fe=await De({action:"move",account:ae,slot:$e},`move-${ae}`),Ne=Oq({menuFor:N,shareFor:(F==null?void 0:F.num)??null},ae,Fe);if(await je(!0),Ne){b(Ne.menuFor),O(Ne.confirmRemove),Ne.shareFor==null&&(M(null),K(!1)),Z(Ne.swapNote);const Ye=Ne.swapNote;Ye&&window.setTimeout(()=>Z(Et=>Et===Ye?null:Et),Vq),re(null),xe(Ne.menuFor)}return Fe},Ie=async(ae,$e,Fe)=>{if(Fe.sends){const Ne=await Be(ae,$e);if(!(Ne!=null&&Ne.ok))return}H(ae),window.setTimeout(()=>H(Ne=>Ne===ae?null:Ne),Qf)},Je=async(ae,$e)=>{if($e.sends){const Fe=await He({action:"setting",key:"autoswitch.threshold",value:ae},"threshold");if(await je(!0),!(Fe!=null&&Fe.ok))return;$(null)}J(!0),window.setTimeout(()=>J(!1),Qf)};return d.jsxs("aside",{className:"accounts-panel",id:"accounts-panel","aria-label":"Claude accounts",children:[d.jsxs("div",{className:"ap-header",children:[d.jsx("h2",{children:"Accounts"}),d.jsxs("div",{className:"ap-header-right",children:[d.jsx("button",{type:"button",className:"glyph-btn ap-add",onClick:()=>k(!0),"aria-label":"Add an account",title:"Sign in to another Claude account, or paste one shared from another deck",children:"+"}),(((lt=t==null?void 0:t.accounts)==null?void 0:lt.length)??0)>0&&d.jsx("button",{type:"button",className:"glyph-btn ap-share-set",onClick:()=>q(!0),"aria-label":"Share accounts with another deck",title:`Copy several accounts to another ${zt} in one paste. The text carries a live login for each one — treat it as those passwords.`,children:"↗"}),d.jsx("button",{type:"button",className:"glyph-btn ap-refresh",onClick:()=>je(!0),...pe("reload",u),"aria-label":"Reload accounts",title:"Reload from claude-swap",children:u?"…":"↻"}),d.jsx("button",{type:"button",className:"glyph-btn",onClick:e,"aria-label":"Close accounts panel",title:"Close (A)",children:"×"})]})]}),t==null?p?d.jsxs("div",{className:"ap-empty",role:"alert",children:[d.jsx("span",{title:p.raw||void 0,children:p.text}),d.jsxs("span",{className:"ap-hint",children:["No accounts have arrived, so there is nothing to show yet. The panel keeps trying every ",M1/1e3," seconds."]}),d.jsx("button",{type:"button",className:"ap-fix",disabled:u,onClick:()=>je(!0),children:u?"trying…":"try again"})]}):d.jsx("div",{className:"ap-empty",children:"Checking…"}):t.ok?d.jsxs(d.Fragment,{children:[(Mt=t.accounts)==null?void 0:Mt.map(ae=>{const{shown:$e,rest:Fe,fuller:Ne,peak:Ye}=T1(ae.lanes),Et=D.includes(jw(ae)),st=qq(Fe.length,Et,Ne);return d.jsxs("div",{className:`ap-account${ae.active?" active":""}`,children:[d.jsxs("div",{className:"ap-account-head",children:[d.jsx("span",{className:"ap-num",children:ae.num}),ae.alias&&d.jsx("span",{className:"ap-alias",title:ae.alias,children:ae.alias}),d.jsx("span",{className:"ap-email",title:ae.email??void 0,children:ae.email}),d.jsx("button",{type:"button",id:`ap-more-${ae.num}`,className:`ap-more${N===ae.num?" on":""}`,"aria-label":`Manage account ${ae.num}`,"aria-expanded":N===ae.num,"aria-controls":N===ae.num?`ap-manage-${ae.num}`:void 0,title:"Share, rename, move, remove",onClick:()=>{b(N===ae.num?null:ae.num),j(ae.alias??""),O(null),M(null),K(!1),Z(null),I(null),re(null),H(null)},children:"⋯"}),ae.active&&d.jsx("span",{className:"ap-badge-active",children:"active"}),ae.disabled&&d.jsx("span",{className:"ap-badge-held",children:"held out"}),!ae.active&&!ae.disabled&&d.jsx("button",{type:"button",className:"ap-manage-btn ap-switch",...pe(`switch-${ae.num}`),onClick:()=>at(ae.num),title:`Switch to ${ae.alias??ae.email}`,children:a===`switch-${ae.num}`?"…":"switch"})]}),d.jsx("div",{className:"ap-lanes",id:`ap-lanes-${ae.num}`,children:$e.length?d.jsxs(d.Fragment,{children:[$e.map(Te=>d.jsx(O1,{lane:Te,nowSec:g},Te.id)),Et&&Fe.map(Te=>d.jsx(O1,{lane:Te,nowSec:g},Te.id))]}):d.jsx("div",{className:"ap-hint",children:"No usage recorded yet."})}),d.jsxs("div",{className:"ap-meta",children:[ae.staleCopy&&d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"ap-stale-copy",title:"The deck can still see this account — its live usage is being read — but claude-swap's own stored copy of the login was rejected, so these numbers stopped updating. Resume re-captures the copy from the login you already have.",children:"numbers paused"}),d.jsx("button",{type:"button",className:"ap-fix",...pe("recapture"),onClick:async()=>{const Te=await De({action:"recapture"},"recapture");Te!=null&&Te.ok&&je(!0)},title:"Re-capture this account's stored credentials from the login you already have. No sign-in, no switch.",children:a==="recapture"?"resuming…":"resume"})]}),ae.error&&(()=>{const Te=Qq(ae.error);return d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"ap-err",title:Te.hint,children:Te.text}),Te.fixable&&d.jsx("button",{type:"button",className:"ap-fix",onClick:()=>k(!0),title:"Open the sign-in dialog. Signing in as this account replaces its stored login in place.",children:"sign in again"})]})})(),st&&d.jsx("button",{type:"button",className:"ap-lanes-more","aria-expanded":Et,"aria-controls":`ap-lanes-${ae.num}`,title:Dq(ae.headroom,(Ye==null?void 0:Ye.label)??null,Fe.length,Et),onClick:()=>L(Te=>zq(Te,ae)),children:st}),(((s==null?void 0:s.enabled)||(s==null?void 0:s.external))&&!ae.active||ae.disabled)&&d.jsx("button",{type:"button",className:"ap-rotate",...pe(`rot-${ae.num}`),onClick:()=>He({action:"account",account:ae.num,enabled:ae.disabled},`rot-${ae.num}`).then(()=>je(!0)),title:ae.disabled?"Return this account to auto-rotation":"Hold this account out of auto-rotation",children:ae.disabled?"put back":"hold out"}),ae.fetchedAt?d.jsxs("span",{className:`ap-age${ae.stale?" ap-stale":""}`,title:"When claude-swap last read this account's usage, and when it plans to read it again. It sets that interval itself — 3 minutes at the fastest, wider while an account is recovering from a rate limit — and every surface, including `cswap watch`, follows the same plan.",children:["collected ",I1(ae.fetchedAt,g),Xq(ae.nextAt,g)]}):d.jsx("span",{className:"ap-age ap-stale",title:"claude-swap has not read this account yet",children:"never collected"})]}),N===ae.num&&d.jsxs("div",{className:"ap-manage",id:`ap-manage-${ae.num}`,role:"group","aria-label":`Manage account ${ae.num}`,children:[d.jsxs("div",{className:"ap-manage-name",children:[d.jsx("label",{className:"vis-hidden",htmlFor:`ap-alias-${ae.num}`,children:"Alias"}),d.jsx("input",{id:`ap-alias-${ae.num}`,className:"ap-manage-input",type:"text",value:E,onChange:Te=>j(Te.target.value),onKeyDown:Te=>{Te.key==="Enter"&&rt(ae.num,ae.alias)},maxLength:Uq,placeholder:"e.g. work",spellCheck:!1,autoFocus:!0}),d.jsx("button",{type:"button",className:"ap-manage-btn",...pe(`alias-${ae.num}`),onClick:()=>rt(ae.num,ae.alias),title:"A short name to show instead of the email",children:C===ae.num?"saved":"save"})]}),(()=>{const Te=Iq((t.accounts??[]).map(kt=>kt.num),ae.num),xt=Pq(Te,U,ae.num),ut=$q(Te,xt,ae.num);return d.jsxs("div",{className:"ap-manage-slot",children:[d.jsx("label",{className:"vis-hidden",htmlFor:`ap-slot-${ae.num}`,children:"Slot"}),d.jsx("span",{className:"ap-field",children:d.jsx("select",{id:`ap-slot-${ae.num}`,value:String(xt),...pe(`move-${ae.num}`),onChange:kt=>re(Number(kt.target.value)),children:Te.map(kt=>d.jsx("option",{value:kt.slot,children:kt.label},kt.slot))})}),d.jsx("button",{type:"button",className:"ap-manage-btn",...pe(`move-${ae.num}`),title:ut.title,onClick:()=>Ie(ae.num,xt,ut),children:Q===ae.num?ut.done:ut.label})]})})(),d.jsxs("div",{className:"ap-manage-acts",children:[d.jsx("button",{type:"button",className:"ap-manage-btn",...pe(`share-${ae.num}`),title:`Copy this account to another ${zt}. Anyone who has the text can use the account — treat it as the password. The other deck stops accepting it after 10 minutes; that does not make an escaped copy safe.`,onClick:async()=>{K(!1);const Te=await De({action:"share",account:ae.num},`share-${ae.num}`);Te!=null&&Te.ok&&M({num:ae.num,blob:Te.blob,expiresAt:Te.expiresAt})},children:"share"}),d.jsx("button",{type:"button",className:`ap-manage-btn danger${P===ae.num?" armed":""}`,...pe(`rm-${ae.num}`),title:P===ae.num?"This deletes the stored credentials for this account":"Remove this account from claude-swap",onClick:()=>{if(P!==ae.num){O(ae.num),window.setTimeout(()=>O(Te=>Te===ae.num?null:Te),4e3);return}O(null),De({action:"remove",account:ae.num},`rm-${ae.num}`).then(()=>{b(null),je(!0),xe(null)})},children:P===ae.num?"confirm":"remove"})]}),(T==null?void 0:T.at)===ae.num&&(()=>{var ut;const Te=(ut=t.accounts)==null?void 0:ut.find(kt=>kt.num===T.displaced),xt=(Te==null?void 0:Te.alias)??(Te==null?void 0:Te.email)??"the account that was there";return d.jsxs("span",{className:"ap-manage-hint ap-manage-swap",title:`Slot ${T.at} was taken, so the two accounts traded places: ${xt} now holds slot ${T.displaced}.`,children:["swapped with slot ",T.displaced]})})(),(F==null?void 0:F.num)===ae.num&&(()=>{const Te=RT(F.expiresAt,g),xt=Te.tone==="gone";return d.jsxs("div",{className:`ap-share${xt?" expired":""}`,children:[d.jsx("code",{className:"ap-share-blob",children:F.blob}),d.jsxs("div",{className:"ap-share-foot",children:[d.jsx("button",{type:"button",className:"ap-manage-btn",...pe(`share-${ae.num}`),onClick:async()=>{if(xt){K(!1);const ut=await De({action:"share",account:ae.num},`share-${ae.num}`);ut!=null&&ut.ok&&M({num:ae.num,blob:ut.blob,expiresAt:ut.expiresAt});return}await P1(F.blob)&&(K(!0),window.setTimeout(()=>K(!1),1800))},children:xt?"make a new share":W?"copied":"copy"}),d.jsxs("span",{className:"ap-manage-hint",title:"This text is the account's password. It is base64 of plain JSON — the expiry inside it is not signed, so anyone holding a copy can change it, and the login itself is in there in the clear either way. The countdown only says how long another deck's import dialog will still accept it. If a copy escapes, sign the account out and back in.",children:[d.jsx("span",{className:"ap-share-warn",children:"this is the password"})," · ",d.jsx("span",{className:`ap-share-expiry ${Te.tone}`,children:Te.text})]})]})]})})()]})]},ae.num)}),(s==null?void 0:s.ok)&&d.jsxs("div",{className:"ap-auto",children:[d.jsxs("div",{className:"ap-auto-head",children:[d.jsx("h3",{className:"ap-auto-title",children:"Auto-switch"}),d.jsxs("span",{className:"ap-auto-ctl",children:[ve!=null&&d.jsxs("span",{className:`ap-auto-now${We?" near":""}`,children:[Math.round(ve),"%"]}),d.jsx("span",{className:"ap-field",title:"Switch once the active account passes this much of its limit",children:d.jsx("select",{"aria-label":"Switch threshold",value:_e,...pe("threshold"),onChange:ae=>$(ae.target.value),children:Kq.map(ae=>d.jsxs("option",{value:ae,children:[ae,"%"]},ae))})}),d.jsx("button",{type:"button",className:"ap-manage-btn",...pe("threshold"),title:G.title,onClick:()=>Je(_e,G),children:V?G.done:G.label}),d.jsxs("button",{type:"button",className:`ap-auto-state${s.enabled?" live":""}`,role:"switch","aria-checked":s.enabled,"aria-label":"Auto-switch",...pe("enable"),onClick:()=>He({action:"enable",enabled:!s.enabled},"enable").then(()=>je(!0)),title:s.enabled?"Stop switching accounts automatically":"Switch accounts automatically when the active one nears its limit",children:[d.jsx("i",{className:s.enabled?"ap-pulse":"ap-dot","aria-hidden":!0}),s.enabled?"on":"off"]})]})]}),s.external&&d.jsxs("p",{className:"ap-auto-note",children:[d.jsx("i",{className:"ap-pulse","aria-hidden":!0})," A ",d.jsx("code",{children:"cswap auto"})," loop in your terminal is doing the switching. The deck stands down while it runs",s.enabled?" — this toggle takes over when you stop it.":"."]}),s.lastTick&&d.jsx("div",{className:"ap-auto-foot",children:d.jsxs("span",{className:"ap-auto-result",children:["checked ",I1(s.lastTick.at,g)]})})]}),p&&d.jsxs("div",{className:"ap-failure",role:"alert",children:[d.jsx("span",{className:"ap-failure-text",title:p.raw||void 0,children:p.text}),d.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>f(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),d.jsx("p",{className:"ap-footnote",title:"Anthropic's usage endpoint allows roughly 28–30 requests per hour per account, shared by every tool on this machine — polling it from here would rate-limit your account. So the deck never fetches: it asks claude-swap to collect while this panel is open, at most once every three minutes, and claude-swap decides whether that touches the network at all.",children:"These numbers only update while this panel is open."})]}):d.jsx("div",{className:"ap-empty",children:t.reason==="no_cswap"?d.jsxs(d.Fragment,{children:[d.jsx("span",{children:"claude-swap isn't installed."}),d.jsx("span",{className:"ap-hint",children:"This panel reads the account store claude-swap keeps — without it there is nothing to show. It is a separate tool, published on PyPI, so it does not come with this package."}),t.hint&&d.jsx("code",{className:"ap-cmd",children:t.hint}),d.jsxs("span",{className:"ap-hint",children:["Then add an account with the ",d.jsx("strong",{children:"+"})," button above."]})]}):t.reason==="no_accounts"?d.jsxs(d.Fragment,{children:[d.jsx("span",{children:"No accounts added yet."}),d.jsxs("span",{className:"ap-hint",children:["claude-swap is installed but has nothing in its store. Use the ",d.jsx("strong",{children:"+"})," above to sign one in, or to paste one shared from another deck."]})]}):d.jsxs(d.Fragment,{children:[d.jsx("span",{children:"Couldn't read the account store."}),d.jsxs("span",{className:"ap-hint",children:["claude-swap is installed, but its store could not be read",t.reason?` (${t.reason})`:"","."]})]})}),_&&d.jsx(Tq,{onClose:()=>k(!1),onChanged:()=>je(!0)}),A&&d.jsx(Mq,{accounts:((t==null?void 0:t.accounts)??[]).map(ae=>({num:ae.num,email:ae.email,alias:ae.alias,org:ae.org})),onClose:()=>q(!1),copyText:P1})]})}const Jq=3e4;function eD({bundle:e,running:t,lastTried:n}){return!t||e===t?!1:n!==t}function tD({bundle:e,running:t,pending:n,lastTried:s}){return t?eD({bundle:e,running:t,lastTried:s})?"reload":n==null||n&&n!==t?"wait":"confirm":"wait"}function nD(e){return!e||e.state!=="failed"?null:`${typeof e.at=="number"?e.at:0}:${e.error??""}`}function rD({asked:e,reported:t}){return t?t!==e:!1}function sD(e){const t=e.thresholdMs??Jq;return!e.enabled||e.kind!=="restart"||!e.canRestart?{idleSince:null,restart:!1}:e.busy?{idleSince:null,restart:!1}:e.idleSince==null?{idleSince:e.now,restart:!1}:e.now<e.idleSince?{idleSince:e.now,restart:!1}:{idleSince:e.idleSince,restart:e.now-e.idleSince>=t}}function oD(e,t){return e==="confirmation"?t.confirmOpen?"clear":"ignore":t.modalOpen||t.confirmOpen?"ignore":"confirm"}function iD(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 aD(e){return e<=0?null:e===1?"the one agent":`all ${e} agents`}function lD(e,t){const n=aD(e),s=n?`removes ${n} on the canvas`:null,i=u=>`This ${s?`${s} and ${u}`:u}`;if(!t)return{note:`${i("deletes the event log on disk")} — the file a restarted deck replays to rebuild what you see, and the file every deck on this machine shares unless one was told otherwise. Layout, pins and selection go with it. This cannot be undone.`,confirm:"Clear everything"};if(!t.path)return{note:`${i("leaves nothing on disk — this deck keeps no event log")}. Layout, pins and selection go with it. This cannot be undone.`,confirm:"Clear everything"};if(!t.mine){const u=t.ownerPort===null?"another running deck owns that file":`the deck on port ${t.ownerPort} owns that file`,h=t.decks>2?`, one of ${t.decks} decks sharing it`:"";return{note:`${i(`leaves the event log alone: ${u}${h}`)}. Clearing here empties this canvas only — restart this deck and the log replays back onto it. Layout, pins and selection go with it.`,confirm:"Clear this canvas"}}if(t.decks<=1)return{note:`${i("deletes this deck's event log")} — the file a restarted deck replays to rebuild what you see. Layout, pins and selection go with it. This cannot be undone.`,confirm:"Clear everything"};const a=t.decks-1,l=a===1?"That deck keeps what is on its canvas until it restarts, and then it is gone there too.":"Those decks keep what is on their canvases until they restart, and then it is gone there too.";return{note:`${i(`deletes the event log ${a===1?"1 other running deck shares":`${a} other running decks share`} with this one`)} — every session recorded in it, not just the ones drawn here. ${l} This cannot be undone.`,confirm:"Clear everything"}}function cD({agentCount:e,onConfirm:t,onCancel:n}){const s=S.useRef(null),i=Sn(n,{focusRef:s,layer:AL}),[a,l]=S.useState(null);S.useEffect(()=>{let p=!1;return fetch("/api/clear").then(f=>f.ok?f.json():null).then(f=>{p||l(iD(f))}).catch(()=>{}),()=>{p=!0}},[]);const{note:u,confirm:h}=lD(e,a);return d.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:d.jsxs("div",{ref:i,className:"modal clear-confirm",onClick:p=>p.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"clear-confirm-title",children:[d.jsxs("header",{className:"modal-head",children:[d.jsxs("div",{className:"modal-title",children:[d.jsx("span",{className:"status-dot err","aria-hidden":!0}),d.jsx("span",{id:"clear-confirm-title",className:"modal-tool-name",children:"Clear the deck?"})]}),d.jsx("div",{className:"modal-actions",children:d.jsx("button",{type:"button",className:"glyph-btn",onClick:n,"aria-label":"Cancel (Esc)",title:"Cancel (Esc)",children:"×"})})]}),d.jsxs("section",{className:"modal-body",children:[d.jsx("p",{className:"modal-note",children:u}),d.jsxs("div",{className:"cc-actions",children:[d.jsx("button",{type:"button",ref:s,className:"btn",onClick:n,children:"Cancel"}),d.jsx("button",{type:"button",className:"btn danger",onClick:t,children:h})]})]})]})})}const uD="One-key shortcuts run when nothing on the page has focus. A focused control keeps its own keys — this sheet included, which takes the keyboard while it is open — so Esc is the way back to the canvas.",dD=[{title:"Canvas",rows:[{cap:"Space",action:"pause or resume the stream",binds:[" "]},{cap:"J",action:"next agent",binds:["j","J"]},{cap:"K",action:"previous agent",binds:["k","K"]},{cap:"F",action:"fit every agent on screen",binds:["f","F"]},{cap:"R",action:"re-arrange the canvas and drop the pins",binds:["r","R"]},{cap:"C",action:"clear the canvas and the event log — asks first",binds:["c","C"]}]},{title:"Panels and dialogs",rows:[{cap:"U",action:"usage panel",binds:["u","U"]},{cap:"L",action:"session list",binds:["l","L"]},{cap:"H",action:"usage history",binds:["h","H"]},{cap:"A",action:"Claude accounts, where Claude Code is installed",binds:["a","A"]},{cap:"?",action:"this sheet",binds:["?"]}]},{title:"Settings",rows:[{cap:"M",action:"sound on or off",binds:["m","M"]},{cap:"T",action:"light or dark theme",binds:["t","T"]}]},{title:"Focus and selection",rows:[{cap:"Tab",action:"reach the agent cards",binds:[]},{cap:"Enter",action:"select the focused card",binds:["Enter"]},{cap:"Shift + Enter",action:"add the focused card to the selection",binds:["Enter"]},{cap:"Esc",action:"close what is open, deselect, release focus",binds:["Escape"]}]},{title:"Mouse",rows:[{cap:"drag",action:"move a node, and pin it where you dropped it",binds:[]},{cap:"shift-click",action:"add an agent to the selection",binds:[]},{cap:"click",action:"the topbar speaker opens volume and sound settings",binds:[]}]}];function fD({onClose:e}){const t=Sn(e);return d.jsx("div",{className:"modal-backdrop",onClick:e,role:"presentation",children:d.jsxs("div",{ref:t,className:"modal key-help",onClick:n=>n.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"key-help-title",children:[d.jsxs("header",{className:"modal-head",children:[d.jsx("div",{className:"modal-title",children:d.jsx("span",{id:"key-help-title",className:"modal-tool-name",children:"Keyboard shortcuts"})}),d.jsx("div",{className:"modal-actions",children:d.jsx("button",{type:"button",className:"glyph-btn",onClick:e,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),d.jsxs("section",{className:"modal-body",children:[d.jsx("p",{className:"modal-note",children:uD}),d.jsx("div",{className:"shortcuts",children:dD.map(n=>d.jsxs(S.Fragment,{children:[d.jsx("h3",{className:"kh-group",children:n.title}),n.rows.map(s=>d.jsxs("div",{className:"sc",children:[d.jsx("kbd",{children:s.cap}),d.jsx("span",{children:s.action})]},`${n.title}:${s.cap}:${s.action}`))]},n.title))})]})]})})}const hD=["done","needs-input"],pD=[{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}]}],mD=[{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}]}],Cw={done:pD,"needs-input":mD},zi="two";function Gy(e,t){const n=Cw[e];return n.find(s=>s.id===t)??n.find(s=>s.id===zi)??n[0]}function AT(e,t){return Cw[e].some(s=>s.id===t)?t:zi}Gy("done",zi).notes,Gy("needs-input",zi).notes;const $1=.04,gD=.24,MT=0,Tw=100,Vy=5,ll=50;function cl(e){if(!Number.isFinite(e))return ll;const t=Math.round(e/Vy)*Vy;return Math.min(Tw,Math.max(MT,t))}function vD(e){if(e==null)return ll;const t=e.trim();return/^-?\d+(\.\d+)?$/.test(t)?cl(Number(t)):ll}function yD(e){const t=cl(e),n=$1+(gD-$1)*(t/Tw);return Math.round(n*1e4)/1e4}function wD(e,t){const n=t.trim,s=typeof n=="number"&&Number.isFinite(n)&&n>0&&n<=1?n:1;return Math.round(yD(e)*s*1e4)/1e4}const xD=160,bD="agent-dag.soundLevel.done",_D="agent-dag.soundLevel.needs-input",kD="agent-dag.soundFigure.done",SD="agent-dag.soundFigure.needs-input",IT={done:bD,"needs-input":_D},OT={done:kD,"needs-input":SD},Yy={done:{level:ll,figure:zi},"needs-input":{level:ll,figure:zi}};function ND(e){const t=n=>({level:vD(e(IT[n])),figure:AT(n,e(OT[n]))});return{done:t("done"),"needs-input":t("needs-input")}}const ED={Stop:"done",Notification:"needs-input"};function jD(e,t){var s;if(t)return null;const n=(s=e==null?void 0:e.payload)==null?void 0:s.hook_event_name;return typeof n!="string"?null:ED[n]??null}function CD(e={enabled:()=>!0}){const t=e.ctor??(typeof window<"u"?window.AudioContext??window.webkitAudioContext??null:null);let n=null,s=!1;const i=()=>e.enabled()?s&&(n==null?void 0:n.state)==="running"?"ready":"locked":"off",a=()=>{var h;return(h=e.onState)==null?void 0:h.call(e,i())};function l(){var h;if(!(!t||s))try{n=n??new t,(h=n.resume)==null||h.call(n).then(a,()=>{}),s=!0,a()}catch{}}function u(h,p=!1){var N;if(!p&&!e.enabled()||!n||n.state!=="running")return!1;const f=(((N=e.prefs)==null?void 0:N.call(e))??Yy)[h]??Yy[h],g=Gy(h,f.figure),y=wD(f.level,g),w=n.currentTime;for(const b of g.notes){const _=n.createOscillator(),k=n.createGain();_.type=g.type??"sine",_.frequency.value=b.hz;const E=w+b.at,j=E+b.ms/1e3;k.gain.setValueAtTime(1e-4,E),k.gain.exponentialRampToValueAtTime(y,E+.012),k.gain.exponentialRampToValueAtTime(1e-4,j),_.connect(k).connect(n.destination),_.start(E),_.stop(j+.02)}return!0}return{unlock:l,play:u,state:i,get context(){return n}}}const L1={done:"Turn finished","needs-input":"Claude is asking"},TD={done:"Every finished turn, on both CLIs.","needs-input":"Claude Code only — Codex has no such event."};function RD({onClose:e,soundOn:t,onToggleSound:n,prefs:s,onLevel:i,onFigure:a,onPreview:l,openerRef:u}){const h=Sn(e),p=S.useRef(e);return p.current=e,S.useEffect(()=>{const f=g=>{var w,N;const y=g.target;y&&((w=h.current)!=null&&w.contains(y)||(N=u.current)!=null&&N.contains(y)||p.current())};return window.addEventListener("pointerdown",f,!0),()=>window.removeEventListener("pointerdown",f,!0)},[h,u]),d.jsxs("div",{ref:h,id:"sound-menu",className:"sound-menu",role:"dialog","aria-label":"Sound settings",children:[d.jsxs("button",{type:"button",className:"btn sm-switch",onClick:n,"aria-pressed":t,children:[d.jsx("span",{className:"sm-switch-label",children:"Sound"}),d.jsx("span",{className:"sm-switch-state",children:t?"on":"off"})]}),hD.map(f=>{const g=s[f],y=`sm-level-${f}`,w=`sm-figure-${f}`;return d.jsxs("section",{className:"sm-tone","aria-labelledby":`sm-name-${f}`,children:[d.jsxs("div",{className:"sm-tone-head",children:[d.jsx("h3",{className:"sm-tone-name",id:`sm-name-${f}`,children:L1[f]}),d.jsxs("button",{type:"button",className:"btn sm-hear",onClick:()=>l(f),"aria-label":`Hear the ${L1[f].toLowerCase()} tone`,children:[d.jsx("svg",{width:"11",height:"11",viewBox:"0 0 12 12",fill:"currentColor","aria-hidden":!0,children:d.jsx("path",{d:"M3 1.6v8.8l7-4.4z"})}),"Hear it"]})]}),d.jsxs("div",{className:"sm-row",children:[d.jsx("label",{htmlFor:y,children:"Volume"}),d.jsx("input",{id:y,type:"range",min:MT,max:Tw,step:Vy,value:g.level,onChange:N=>i(f,Number(N.target.value))}),d.jsxs("span",{className:"sm-read",children:[g.level,"%"]})]}),d.jsxs("div",{className:"sm-row",children:[d.jsx("label",{htmlFor:w,children:"Sound"}),d.jsx("select",{id:w,className:"sm-select",value:g.figure,onChange:N=>a(f,N.target.value),children:Cw[f].map(N=>d.jsx("option",{value:N.id,children:N.label},N.id))})]}),d.jsx("p",{className:"sm-note",children:TD[f]})]},f)}),d.jsx("p",{className:"sm-foot",children:"M turns the sound on and off from anywhere."})]})}const AD={"//":["What a user would NOTICE. One key per version that has something to say,","and no key at all for a version that has nothing — which is most of them.","","The rule this file exists to serve: before every release, ask 'what would a","user notice?' and write the answer here. 'Nothing user-visible' is a valid","and expected answer, and it is spelled by adding no key. A release with no","key shows no modal, and that silence is what keeps the modal worth reading","on the day it is not silent.","","What belongs here: something that changed on the user's machine or under","their hands — a hook written to or removed from settings.json, a default","that flipped, a control that moved or went away, a stored preference that","changed meaning. What does not: bounds, races, assertions that could not","fire, anything that is invisible when it is correct.","","Write it for the person running the deck, not for the person reading the","diff. `title` is the sentence they scan; `body` is what they need in order","to act on it, or to stop worrying about it.","","Keys are versions exactly as package.json spells them. A key that is not a","version, or an entry missing either field, fails the suite rather than","being quietly dropped — see src/web/__tests__/release-notes-file.test.ts.","Ordering here is for humans; the deck sorts by version itself.","","A title may open with an emoji, and if it does, put exactly ONE space after","it. Not two: the dialog gives a leading emoji its own optical gap, because","a colour glyph is drawn edge to edge inside its advance and one word space","after one reads as none. A second space here would be a lie in the data","about a defect in the type, and the suite refuses both it and no space at","all."],"3.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.
78
+
79
+ 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.
80
+
81
+ 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.
82
+
83
+ 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.
84
+
85
+ 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.
86
+
87
+ 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.
88
+
89
+ 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.
90
+
91
+ 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.
92
+
93
+ 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.
94
+
95
+ 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.
96
+
97
+ 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.
98
+
99
+ 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.
100
+
101
+ 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.
102
+
103
+ 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.
104
+
105
+ 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.
106
+
107
+ 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.
108
+
109
+ 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.
110
+
111
+ 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.
112
+
113
+ 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.
114
+
115
+ 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.
116
+
117
+ 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.
118
+
119
+ 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".
120
+
121
+ 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.
122
+
123
+ 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.
124
+
125
+ 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.
126
+
127
+ 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.
128
+
129
+ 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.
130
+
131
+ 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.
132
+
133
+ 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.
134
+
135
+ 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.
136
+
137
+ 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.
138
+
139
+ 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.
140
+
141
+ 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.
142
+
143
+ 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.
144
+
145
+ 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.
146
+
147
+ 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.
148
+
149
+ 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.
150
+
151
+ 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.
152
+
153
+ 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.
154
+
155
+ 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."}]},Rw="agent-dag.releaseNotesSeen";function q1(e){return e.split(/[.\-+]/).map(t=>parseInt(t,10)).map(t=>Number.isNaN(t)?0:t)}function Bi(e,t){const n=q1(e),s=q1(t);for(let i=0;i<Math.max(n.length,s.length);i++){const a=(n[i]??0)-(s[i]??0);if(a!==0)return a<0?-1:1}return 0}function Ui(e){return typeof e=="string"&&/^\d+\.\d+\.\d+/.test(e)}function MD(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 ID(e){if(!e||typeof e!="object")return[];const t=[];for(const[n,s]of Object.entries(e)){if(!Ui(n)||!Array.isArray(s))continue;const i=s.filter(MD);i.length&&t.push({version:n,notes:i})}return t.sort((n,s)=>Bi(s.version,n.version))}const D1=ID(AD);function PT(e,t,n){return e.filter(s=>Bi(s.version,n)<=0&&(t===null||Bi(s.version,t)>0))}function OD(e,t){return e.filter(n=>Bi(n.version,t)===0)}function PD(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 $D({since:e,running:t,entries:n,firstRun:s}){if(!n.length)return"Nothing in this build has anything to report yet. Most releases do not, which is the point.";if(e!==null){const l=n.length===1?"one release":`${n.length} releases`;return`You were last caught up at v${e}. Since then ${l} changed something you would notice. Clicking the version in the topbar brings this back.`}if(s&&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 i=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 a=Bi(i,t);return a<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.`:a>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 LD=new RegExp("^(?:\\p{Extended_Pictographic}|\\p{Emoji_Modifier}|\\p{Regional_Indicator}|[\\u200D\\uFE0F])+(?= \\S)","u");function qD(e){const t=LD.exec(e);return t?{icon:t[0],rest:e.slice(t[0].length)}:{icon:null,rest:e}}function DD(){if(typeof window>"u")return null;try{return window.localStorage}catch{return null}}function FD(e){if(!e)return null;let t=null;try{t=e.getItem(Rw)}catch{return null}return Ui(t)?t:null}function zD(e){if(!e)return!1;try{return e.getItem(Rw),!0}catch{return!1}}function BD(e,t){if(!e)return!1;try{return e.setItem(Rw,t),!0}catch{return!1}}function UD({stored:e,running:t,notes:n,remembers:s=!0}){if(!Ui(t))return{show:[],record:null,reason:"no-version"};if(!Ui(e)){if(!s)return{show:[],record:t,reason:"cannot-remember"};const l=OD(n,t);return l.length?{show:l,record:t,reason:"welcome"}:{show:[],record:t,reason:"first-run"}}const i=Bi(e,t);if(i===0)return{show:[],record:null,reason:"seen"};if(i>0)return{show:[],record:null,reason:"ahead"};const a=PT(n,e,t);return a.length?{show:a,record:t,reason:"new-notes"}:{show:[],record:t,reason:"nothing-new"}}function WD({entries:e,since:t,running:n,firstRun:s,onClose:i}){const a=Sn(i),l=PD(e);return d.jsx("div",{className:"modal-backdrop",onClick:i,role:"presentation",children:d.jsxs("div",{ref:a,className:"modal release-notes",onClick:u=>u.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"release-notes-title",children:[d.jsxs("header",{className:"modal-head",children:[d.jsxs("div",{className:"modal-title",children:[d.jsx("span",{id:"release-notes-title",className:"modal-tool-name",children:"What's new"}),l&&d.jsx("span",{className:"modal-tool-id",children:l})]}),d.jsx("div",{className:"modal-actions",children:d.jsx("button",{type:"button",className:"glyph-btn",onClick:i,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),d.jsxs("section",{className:"modal-body",children:[d.jsx("p",{className:"modal-note",children:$D({since:t,running:n,firstRun:s,entries:e})}),e.map(u=>d.jsxs("section",{className:"modal-section",children:[d.jsxs("h3",{className:"rn-version",children:["v",u.version]}),d.jsx("ul",{className:"rn-notes",children:u.notes.map((h,p)=>{const{icon:f,rest:g}=qD(h.title);return d.jsxs("li",{className:"rn-note",children:[d.jsxs("p",{className:"rn-note-title",children:[f&&d.jsx("span",{className:"rn-note-icon",children:f}),g]}),d.jsx("p",{className:"rn-note-body",children:h.body})]},p)})})]},u.version))]})]})})}function HD(e){return e.slice().sort((t,n)=>t.y-n.y||t.x-n.x)}function GD(e,t,n){var l;if(e.length===0)return null;const s=HD(e),i=t?s.findIndex(u=>u.id===t):-1,a=i===-1?n===1?0:s.length-1:(i+n+s.length)%s.length;return((l=s[a])==null?void 0:l.id)??null}const VD=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Escape","Delete","Backspace"]);function YD(e,t){return t==null?{kind:"deck",nodeId:null}:e.key==="Enter"||e.key===" "?{kind:"activate",nodeId:t,additive:e.shiftKey}:VD.has(e.key)?{kind:"node",nodeId:t}:{kind:"deck",nodeId:t}}const KD=new Set(["","BODY","HTML","#DOCUMENT"]);function XD(e){return!e||_w(e)?!1:!KD.has(String(e.tagName??"").toUpperCase())}function Qc(e,t){if(t.size!==0)for(const n of Array.from(e.keys()))t.has(n)||e.delete(n)}function QD(e,t){let n=!1;for(const i of e)if(!t.has(i)){n=!0;break}if(!n)return e;const s=new Set;for(const i of e)t.has(i)&&s.add(i);return s}function ZD(e){const t=new Set;for(const n of e)t.add(n.id),t.add(`group:${n.sessionId}`);return t}function JD(e,t){if(!t||!e.agents.get(t))return null;const s=new Set([t]);let i=t;for(;i;){const l=e.agents.get(i);if(!(l!=null&&l.parentId)||s.has(l.parentId))break;s.add(l.parentId),i=l.parentId}let a=!0;for(;a;){a=!1;for(const l of e.agents.values())l.parentId&&s.has(l.parentId)&&!s.has(l.id)&&(s.add(l.id),a=!0)}return s}function e5(e,t){const n=new Set;for(const s of t){const i=JD(e,s);if(i)for(const a of i)n.add(a)}return n.size>0?n:null}function $T(e,t,n){return!t.has(e)||n.has(e)}function t5(e,t,n,s){return!t.has(e)&&$T(e,n,s)}function n5(e,t,n){const s={x:0,y:0};return t.set(e,s),n.add(e),s}function r5(e,t,n,s){n.set(e,t),s.delete(e)}const s5=40,o5=120;function i5(e,t){let n=null,s=0,i=Number.NEGATIVE_INFINITY;const a=()=>{n=null,i=t.now(),e()},l=()=>{n!=null&&(t.clearTimeout(n),n=null)},u=(h,p,f)=>{if(n!=null){if(s<=h)return;l()}const g=Math.min(f,Math.max(0,h-p));s=h,n=t.setTimeout(a,g)};return{live(h=s5){const p=t.now(),f=Math.max(i+h,p);if(f<=p){l(),a();return}u(f,p,h)},replay(h=o5){l(),s=t.now()+h,n=t.setTimeout(a,h)},flush(){l(),a()},cancel(){l()}}}const a5=1e3;function l5(e={}){const t=Math.max(1,Math.floor(e.limit??a5)),n=e.protect;let s=!1,i=[],a=new Set,l=0,u=0,h=null;return{get paused(){return s},get size(){return i.length},get dropped(){return l},get overflowed(){return l>0},get through(){return u},accept(p){const f=typeof(p==null?void 0:p.seq)=="number"?p.seq:null,g=(p==null?void 0:p.epoch)??null,y=g!==null&&g!==h;y&&(h=g,u=0);const w=f!==null&&!y&&f<=u;if(f!==null&&f>u&&(u=f),!s)return!0;if(w)return!1;if(i.push(p),n!=null&&n(p)&&a.add(p),i.length>t){let N=0;if(a.size<i.length)for(;a.has(i[N]);)N++;const[b]=i.splice(N,1);a.delete(b),l++}return!1},setPaused(p){if(s=p,p)return[];const f=i;return i=[],a=new Set,l=0,f}}}const LT="agent-dag.theme";function c5(e){return e==="light"?"light":"dark"}function u5(){return c5(Lu(LT))}function d5({waiting:e,running:t,connected:n=!0}){return{title:e>0?`(${e}) ${zt}`:zt,icon:n?e>0?"waiting":t>0?"running":"idle":"offline"}}const Zc={offline:"#e05252",waiting:"#c97d12",running:"#2a90d4",idle:"#7e828c"};function Jc(e,t){const i=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"?i(` stroke-dasharray="${56.5485.toFixed(2)} ${18.8495.toFixed(2)}" transform="rotate(-58 16 16)"`):i("")+(t==="running"?`<circle cx="16" cy="16" r="5" fill="${e}"/>`:"")}</svg>`}const f5=Object.freeze({offline:`data:image/svg+xml,${encodeURIComponent(Jc(Zc.offline,"offline"))}`,waiting:`data:image/svg+xml,${encodeURIComponent(Jc(Zc.waiting,"waiting"))}`,running:`data:image/svg+xml,${encodeURIComponent(Jc(Zc.running,"running"))}`,idle:`data:image/svg+xml,${encodeURIComponent(Jc(Zc.idle,"idle"))}`}),h5="No sessions are waiting for you.";function p5(e){if(e.length===0)return"";const[t,...n]=e;if(n.length===0)return`${t.label} is waiting for your permission.`;const s=`${n.length} more session${n.length===1?"":"s"}`;return`${t.label} and ${s} are waiting for your permission.`}function m5(e,t){return t!==""?t:e===""?"":h5}function g5(){let e=0;return{begin(){const t=++e;return()=>t===e},cancel(){e++}}}function v5(e){return!e.answer||e.answer.range!==e.want?{phase:"busy",stale:!1}:e.answer.ok?{phase:e.answer.days>0?"chart":"empty",stale:e.loading}:{phase:"error",stale:e.loading}}function y5(e){return e.claude&&e.codex?"Claude Code and Codex":e.claude?"Claude Code":e.codex?"Codex":null}const F1={claude:"Claude Code",codex:"Codex",opencode:"OpenCode",openclaw:"OpenClaw",copilot:"GitHub Copilot",pi:"pi-agent"};function Aw(e){const t=e.toLowerCase();return Object.hasOwn(F1,t)?F1[t]:t?t[0].toUpperCase()+t.slice(1):""}function w5(e){return e.length<=1?e[0]??"":`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`}function x5(e,t=[]){const n=t.length?w5(t.map(Aw)):y5(e);return n?`via ccusage · local ${n} logs`:"via ccusage · local agent logs"}function b5(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 _5(e,t){const n=t.prefs??Yy,s=cl(n.done.level),i=cl(n["needs-input"].level),a=s===i?`${s}%`:`${s}% and ${i}%`,l=t.on?`Sound: on at ${a} — 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?`
156
+
157
+ 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.`:"",h=t.on&&t.locked?`
158
+
159
+ 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+h+`
160
+
161
+ Click to set the volume and the sound of each tone, and to hear either one.`}function qT(e){const t=new Map;for(const n of e)for(const s of n.agents??[]){if(!s||typeof s.agent!="string"||s.agent==="")continue;const i=t.get(s.agent)??{id:s.agent,cost:0,tokens:0};i.cost+=Number.isFinite(s.totalCost)?s.totalCost:0,i.tokens+=Number.isFinite(s.totalTokens)?s.totalTokens:0,t.set(s.agent,i)}return[...t.values()].sort((n,s)=>s.cost-n.cost||n.id.localeCompare(s.id))}function k5(e){const t=qT([{agents:e}]);return t.length<2?null:t.map(n=>`${Aw(n.id)} ${Ve(n.cost)}`).join(" · ")}function z1(e){switch(e.toLowerCase()){case"claude":return"var(--usage-purple)";case"codex":return"var(--usage-orange)";case"gemini":return"var(--usage-indigo)";case"copilot":return"var(--usage-green)";default:return"var(--usage-zinc)"}}function S5(e,t){if(!(t>0)||!(e>0))return"0%";const n=e/t*100;return n<.1?"<0.1%":`${n.toFixed(1)}%`}function eu(e){const t=e.toLowerCase();return t.includes("opus")?"var(--usage-purple)":t.includes("sonnet")?"var(--usage-blue)":t.includes("haiku")?"var(--usage-green)":t.includes("gpt-5")||t.includes("gpt5")?"var(--usage-amber)":t.includes("gpt")?"var(--usage-red)":t.includes("gemini")?"var(--usage-indigo)":t.includes("codex")?"var(--usage-orange)":"var(--usage-zinc)"}const N5=[7,14,30,90];function E5(e){const[t,n]=S.useState(null),[s,i]=S.useState(!1),a=S.useState(g5)[0],l=S.useRef(!1),u=(h=!1)=>{if(h&&!ar(l.current))return;const p=a.begin();l.current=h;const f=e;i(!0);const y=`/api/ccusage?since=${Fy(f)}${h?"&refresh=1":""}`;fetch(y).then(w=>w.json()).then(w=>{p()&&n({range:f,resp:w})}).catch(()=>{p()&&n({range:f,resp:{ok:!1,reason:"unreachable"}})}).finally(()=>{p()&&(l.current=!1,i(!1))})};return S.useEffect(()=>(u(!1),()=>a.cancel()),[e]),{landed:t,loading:s,reload:()=>u(!0)}}function j5({onClose:e,providers:t}){var F;const[n,s]=S.useState(30),[i,a]=S.useState(null),{landed:l,loading:u,reload:h}=E5(n),p=S.useRef(null),f=Sn(e,{focusRef:p}),g=v5({loading:u,want:n,answer:l&&{range:l.range,ok:l.resp.ok===!0,days:((F=l.resp.days)==null?void 0:F.length)??0}}),y=g.phase==="chart"?l.resp.days??[]:[],w=S.useMemo(()=>y.reduce((M,A)=>Math.max(M,A.totalCost),0),[y]),N=S.useRef(null);S.useLayoutEffect(()=>{const M=N.current;M&&(M.scrollLeft=M.scrollWidth)},[y]);const{totalCost:b,totalTok:_,inOut:k,cacheRead:E,modelCosts:j}=S.useMemo(()=>{let M=0,A=0,q=0,W=0;const K=new Map;for(const T of y){M+=T.totalCost,A+=T.totalTokens,q+=T.inputTokens+T.outputTokens,W+=T.cacheReadTokens;for(const Z of T.modelBreakdowns)K.set(Z.modelName,(K.get(Z.modelName)??0)+Z.cost)}return{totalCost:M,totalTok:A,inOut:q,cacheRead:W,modelCosts:K}},[y]),C=S.useMemo(()=>Array.from(j.entries()).sort((M,A)=>A[1]-M[1]),[j]),I=S.useMemo(()=>qT(y),[y]),P=I.length>1,O=i?y.find(M=>M.period===i)??null:null;return d.jsx("div",{className:"uh-backdrop",onClick:e,role:"presentation",children:d.jsxs("div",{ref:f,className:"uh-modal",onClick:M=>M.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Usage history",children:[d.jsxs("header",{className:"uh-head",children:[d.jsxs("div",{className:"uh-titlewrap",children:[d.jsx("div",{className:"uh-title",children:"Usage history"}),d.jsx("div",{className:"uh-sub",children:x5(t,I.map(M=>M.id))})]}),d.jsx("div",{className:"uh-range",role:"group","aria-label":"Range",children:N5.map(M=>d.jsxs("button",{type:"button","aria-pressed":n===M,className:"uh-range-btn",onClick:()=>{s(M),a(null)},children:[M,"d"]},M))}),d.jsx("button",{className:"glyph-btn uh-reload",onClick:h,...ir(u),title:"Re-run ccusage","aria-label":"Reload",children:u?"…":"↻"}),d.jsx("button",{ref:p,className:"glyph-btn uh-close",onClick:e,"aria-label":"Close",children:"×"})]}),g.phase==="busy"?d.jsx("div",{className:"uh-status","aria-busy":"true",children:l?"running ccusage…":"running ccusage… (first run downloads the package)"}):g.phase==="error"?d.jsxs("div",{className:"uh-status uh-err",title:Fi(l.resp)||void 0,children:[bq(l.resp,"ccusage did not report usage"),d.jsx("div",{children:d.jsx("button",{className:"btn uh-retry",onClick:h,...ir(u),children:u?"trying…":"Try again"})})]}):g.phase==="empty"?d.jsx("div",{className:`uh-status${g.stale?" uh-stale":""}`,"aria-busy":g.stale||void 0,children:"no usage in this range"}):d.jsxs("div",{className:g.stale?"uh-stale":void 0,"aria-busy":g.stale||void 0,children:[d.jsxs("div",{className:"uh-totals",children:[d.jsx(tu,{label:"total cost",val:Ve(b),accent:!0}),d.jsx(tu,{label:"tokens",val:Ct(_)}),d.jsx(tu,{label:"input+output",val:Ct(k)}),d.jsx(tu,{label:"cache reads",val:Ct(E)})]}),P&&d.jsxs("div",{className:"uh-agents",role:"group","aria-label":"Cost by CLI",children:[d.jsx("div",{className:"uh-agent-bar","aria-hidden":"true",children:I.map(M=>d.jsx("span",{className:"uh-agent-seg",style:{width:`${b>0?M.cost/b*100:0}%`,background:z1(M.id)}},M.id))}),d.jsx("div",{className:"uh-agent-keys",children:I.map(M=>d.jsxs("span",{className:"uh-agent-key",title:`${M.id} · ${Ct(M.tokens)} tokens`,children:[d.jsx("span",{className:"uh-legend-dot",style:{background:z1(M.id)}}),Aw(M.id),d.jsx("span",{className:"uh-agent-cost",children:Ve(M.cost)}),d.jsx("span",{className:"uh-agent-share",children:S5(M.cost,b)})]},M.id))})]}),d.jsx("div",{ref:N,className:"uh-chart",role:"group","aria-label":"Daily cost by model",children:y.map(M=>{const A=w>0?M.totalCost/w*100:0,q=M.period===i,W=`${M.period}, ${Ve(M.totalCost)}`;return d.jsxs("button",{className:`uh-bar-col${q?" sel":""}`,onClick:()=>a(q?null:M.period),"aria-pressed":q,"aria-label":W,title:`${M.period} · ${Ve(M.totalCost)}`,style:{flexBasis:`${100/y.length}%`},children:[d.jsx("div",{className:"uh-bar",style:{height:`${Math.max(A,M.totalCost>0?2:0)}%`},children:M.modelBreakdowns.slice().sort((K,T)=>T.cost-K.cost).map(K=>{const T=M.totalCost>0?K.cost/M.totalCost*100:0;return d.jsx("div",{className:"uh-bar-seg",style:{height:`${T}%`,background:eu(K.modelName)}},K.modelName)})}),d.jsx("span",{className:"uh-bar-label",children:M.period.slice(5)})]},M.period)})}),d.jsx("div",{className:"uh-legend",children:C.map(([M,A])=>d.jsxs("span",{className:"uh-legend-item",title:M,children:[d.jsx("span",{className:"uh-legend-dot",style:{background:eu(M)}}),Is(M)," ",d.jsx("span",{className:"uh-legend-cost",children:Ve(A)})]},M))}),O&&d.jsxs("div",{className:"uh-detail",children:[d.jsxs("div",{className:"uh-detail-head",children:[d.jsx("span",{className:"uh-detail-date",children:O.period}),d.jsx("span",{className:"uh-detail-cost",children:Ve(O.totalCost)}),(()=>{var q,W;const A=k5(O.agents)??((W=(q=O.metadata)==null?void 0:q.agents)!=null&&W.length?O.metadata.agents.join(" · "):null);return A?d.jsx("span",{className:"uh-detail-agents",title:A,children:A}):null})()]}),d.jsxs("div",{className:"uh-detail-mini",children:[d.jsx(nu,{label:"input",val:Ct(O.inputTokens)}),d.jsx(nu,{label:"output",val:Ct(O.outputTokens)}),d.jsx(nu,{label:"cache write",val:Ct(O.cacheCreationTokens)}),d.jsx(nu,{label:"cache read",val:Ct(O.cacheReadTokens)})]}),d.jsx("div",{className:"uh-detail-models",children:O.modelBreakdowns.slice().sort((M,A)=>A.cost-M.cost).map(M=>{const A=O.totalCost>0?M.cost/O.totalCost*100:0;return d.jsxs("div",{className:"uh-model-row",title:M.modelName,children:[d.jsxs("span",{className:"uh-model-name",children:[d.jsx("span",{className:"uh-legend-dot",style:{background:eu(M.modelName)}}),d.jsx("span",{className:"uh-model-label",children:Is(M.modelName)})]}),d.jsx("span",{className:"uh-model-bar",children:d.jsx("span",{className:"uh-model-bar-fill",style:{width:`${A}%`,background:eu(M.modelName)}})}),d.jsx("span",{className:"uh-model-cost",children:Ve(M.cost)})]},M.modelName)})})]})]})]})})}function tu({label:e,val:t,accent:n}){return d.jsxs("div",{className:"uh-stat",children:[d.jsx("span",{className:`uh-stat-val${n?" accent":""}`,children:t}),d.jsx("span",{className:"uh-stat-label",children:e})]})}function nu({label:e,val:t}){return d.jsxs("div",{className:"uh-ministat",children:[d.jsx("span",{className:"uh-ministat-val",children:t}),d.jsx("span",{className:"uh-ministat-label",children:e})]})}function C5(e){const t=/^#?([0-9a-f]{6})$/i.exec((e??"").trim());if(!t)return!1;const n=parseInt(t[1],16),s=[n>>16&255,n>>8&255,n&255].map(i=>{const a=i/255;return a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4)});return .2126*s[0]+.7152*s[1]+.0722*s[2]>.5}const B1=1e4,T5=12e3;function R5({browsers:e,findings:t,watching:n,palette:s,now:i=()=>Date.now()}){const a=S.useRef(null),l=S.useRef(null);return l.current={browsers:e,findings:t,watching:n},S.useEffect(()=>{var w;const u=a.current;if(!u)return;const h=u.getContext("2d");if(!h)return;const p=((w=window.matchMedia)==null?void 0:w.call(window,"(prefers-reduced-motion: reduce)").matches)??!1;let f=0,g=!1;const y=()=>{var re;if(g)return;const N=l.current;if(!N)return;const{browsers:b,findings:_,watching:k}=N,E=s["--accent"]||"#7dd3fc",j=s["--line"]||"#1f2229",C=s["--text-dim"]||"#6e727c",I=C5(s["--bg"]),P=I?42:26,O=I?.85:.65,F=i(),M=Math.min(window.devicePixelRatio||1,2),A=u.clientWidth,q=u.clientHeight;(u.width!==A*M||u.height!==q*M)&&(u.width=A*M,u.height=q*M),h.setTransform(M,0,0,M,0,0),h.clearRect(0,0,A,q);const W=A/2,K=q/2,T=Math.min(A,q)/2-6;h.strokeStyle=j,h.lineWidth=1,h.globalAlpha=I?1:.9;for(const Q of[.4,.7,1])h.beginPath(),h.arc(W,K,T*Q,0,Math.PI*2),h.stroke();h.beginPath(),h.moveTo(W-T,K),h.lineTo(W+T,K),h.moveTo(W,K-T),h.lineTo(W,K+T),h.stroke(),h.globalAlpha=1;const U=(k&&!p?F%B1/B1:0)*Math.PI*2-Math.PI/2;if(k){const Q=(re=h.createConicGradient)==null?void 0:re.call(h,U-.85,W,K);Q&&(Q.addColorStop(0,"transparent"),Q.addColorStop(.85/(Math.PI*2),`color-mix(in srgb, ${E} ${P}%, transparent)`),Q.addColorStop(1,"transparent"),h.fillStyle=Q,h.beginPath(),h.moveTo(W,K),h.arc(W,K,T,U-.85,U),h.closePath(),h.fill()),h.strokeStyle=E,h.globalAlpha=O,h.beginPath(),h.moveTo(W,K),h.lineTo(W+Math.cos(U)*T,K+Math.sin(U)*T),h.stroke(),h.globalAlpha=1}b.forEach((Q,H)=>{const te=H/Math.max(b.length,1)*Math.PI*2-Math.PI/2,$=Q.lastReadMs===null?1:Math.min(1,(F-Q.lastReadMs)/12e4),V=T*(.42+$*.5),J=W+Math.cos(te)*V,D=K+Math.sin(te)*V,L=Math.abs((U-te+Math.PI*3)%(Math.PI*2)-Math.PI),X=k?Math.max(0,1-L/.55):0;h.beginPath(),h.arc(J,D,3+X*1.6,0,Math.PI*2),h.fillStyle=Q.running?E:C,h.globalAlpha=Q.running?.55+X*.45:.35,h.fill(),h.globalAlpha=1});for(const Q of _){const H=(F-Q.atMs)/T5;if(H<0||H>1)continue;const $=Math.max(0,b.findIndex(D=>D.key===Q.browser))/Math.max(b.length,1)*Math.PI*2-Math.PI/2,V=W+Math.cos($)*T*.6,J=K+Math.sin($)*T*.6;h.beginPath(),h.arc(V,J,4+H*22,0,Math.PI*2),h.strokeStyle=E,h.globalAlpha=(1-H)*.8,h.lineWidth=1.5,h.stroke(),h.globalAlpha=1}f=requestAnimationFrame(y)};return y(),()=>{g=!0,cancelAnimationFrame(f)}},[i,s]),d.jsx("canvas",{ref:a,className:"bw-radar",role:"img","aria-label":n?`Watching ${e.length} browser${e.length===1?"":"s"}`:"Not watching"})}const U1="agent-dag.browserWatch.seenMs";function A5(e,t){return e.filter(n=>n.startMs>t)}function M5(e,t,n){if(e===null)return null;const s=e+t-n;return s>0?s:null}function I5(e){const t=Math.ceil(e/1e3),n=Math.floor(t/60),s=t%60;return n>0?`${n}m ${s}s`:`${s}s`}function DT(e){return(e??[]).filter(t=>t.installed&&t.profiles>0)}function W1(e,t){return t?{kind:"saving",word:"Saving",detail:""}:e.settings.enabled?{kind:"on",word:"Watching",detail:""}:{kind:"off",word:"Paused",detail:"nothing new is recorded"}}function O5(e,t){return e.map(n=>({key:n.key,name:n.name,running:n.running,visits:t.filter(s=>s.browser===n.key).reduce((s,i)=>s+i.programVisits,0)}))}function P5(e,t){if(e===null)return null;const n=Math.max(0,Math.round((t-e)/1e3));if(n<5)return"just now";if(n<60)return`${n} sec ago`;const s=Math.round(n/60);return s<60?`${s} min ago`:`${Math.round(s/60)} hr ago`}function $5(e){const t=e.profiles.filter(s=>s.degraded);if(t.length>0){const s=t[0],i=t.length-1;return{kind:"unreadable",text:`${s.name}/${s.profile} could not be read — ${s.reason??"no reason given"}`+(i>0?`, and ${i} more`:"")+". The watch continues on the profiles it can read."}}const n=DT(e.browsers);return n.length===0?{kind:"no-profiles",text:"No browser on this machine has a profile to read. Open one of the browsers below once and it will be watched from then on."}:n.some(s=>s.running)?null:{kind:"none-running",text:"No watched browser is running, so nothing can be navigated right now. Their history is still read, and anything found while they were open is still here."}}function L5(e){const t=n=>new Date(n).toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit",hour12:!1});return e.count===1||e.endMs-e.startMs<6e4?t(e.startMs):`${t(e.startMs)} → ${t(e.endMs)}`}function q5(e){return new Date(e).toLocaleDateString(void 0,{weekday:"short",day:"numeric",month:"short"})}function H1(e){const t=Math.round((e.endMs-e.startMs)/6e4);return t<1?"":`${t} min`}function D5({onClose:e,onSeen:t,onWatching:n,palette:s}){const i=Sn(e),[a,l]=S.useState(null),[u,h]=S.useState(null),[p,f]=S.useState(!1),g=S.useRef(!1),[y,w]=S.useState(null),[N,b]=S.useState(null),[_,k]=S.useState(!1),[E,j]=S.useState(!1),[C,I]=S.useState(!1),[P,O]=S.useState(!1),[F,M]=S.useState(!1),[A,q]=S.useState(!1),[W,K]=S.useState(()=>Date.now());S.useEffect(()=>{const J=setInterval(()=>K(Date.now()),1e3);return()=>clearInterval(J)},[]);const T=S.useCallback(async J=>{var D;if(!(J&&!ar(g.current))){g.current=J,f(!0);try{const L=await fetch(`/api/browser-watch${J?"?refresh=1":""}`);if(!L.ok)throw new Error(`the deck answered ${L.status}`);const X=await L.json();l(X),w(se=>{var fe;return se===null?((fe=X==null?void 0:X.settings)==null?void 0:fe.quietMinutes)??15:se}),n(((D=X==null?void 0:X.settings)==null?void 0:D.enabled)===!0),h(null)}catch(L){h(L instanceof Error?L.message:String(L))}finally{g.current=!1,f(!1)}}},[n]);S.useEffect(()=>{T(!1)},[T]),S.useEffect(()=>{const J=setInterval(()=>{T(!1)},1e4);return()=>clearInterval(J)},[T]);const Z=S.useCallback(async J=>{try{await fetch("/api/browser-watch/dismiss",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({host:J.host,startMs:J.startMs})})}finally{await T(!1)}},[T]),U=S.useCallback(async J=>{k(!0);try{const D=await fetch("/api/browser-watch",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(J)});if(!D.ok)throw new Error(`the deck answered ${D.status}`);await T(!1)}catch(D){h(D instanceof Error?D.message:String(D))}finally{k(!1)}},[T]);S.useEffect(()=>()=>t(Date.now()),[t]);const re=S.useMemo(()=>{const J=[];for(const D of(a==null?void 0:a.episodes)??[]){const L=q5(D.startMs),X=J[J.length-1];X&&X.label===L?X.episodes.push(D):J.push({label:L,episodes:[D]})}return J},[a]),Q=DT(a==null?void 0:a.browsers),H=((a==null?void 0:a.browsers)??[]).filter(J=>!(J.installed&&J.profiles>0)),te=a?$5(a):null,$=Q.reduce((J,D)=>J+D.profiles,0),V=a?M5(a.coverage.lastHumanMs,a.coverage.quietMs,W):null;return d.jsx("div",{className:"modal-backdrop",onClick:e,role:"presentation",children:d.jsxs("div",{ref:i,className:"modal bw-modal",onClick:J=>J.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"bw-title",children:[d.jsxs("header",{className:"modal-head",children:[d.jsxs("div",{className:"modal-title",children:[d.jsx("span",{className:"modal-tool-name",id:"bw-title",children:"Browser watch"}),d.jsx("span",{className:"modal-tool-id",children:a?`${$} ${$===1?"profile":"profiles"} · local only`:"local only"})]}),d.jsxs("div",{className:"modal-actions",children:[d.jsx("button",{className:"glyph-btn",onClick:()=>void T(!0),...ir(p),"aria-label":"Re-read every profile now",title:"Re-read every profile now",children:p?"…":"↻"}),d.jsx("button",{className:"glyph-btn",onClick:e,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),d.jsxs("div",{className:"modal-body bw-body",children:[!a&&!u&&d.jsxs("div",{className:"bw-loading",children:[d.jsx("span",{className:"bw-loading-bar","aria-hidden":!0}),d.jsx("p",{children:"Reading each browser's history. The first look copies the file, which takes a moment."})]}),u&&d.jsx("div",{className:"bw-state",children:d.jsxs("div",{className:"bw-row err",children:[d.jsx("span",{className:"bw-dot","aria-hidden":!0}),d.jsx("span",{className:"bw-row-label",children:"Could not read"}),d.jsx("span",{className:"bw-row-detail",children:u})]})}),a&&te&&d.jsx("p",{className:`bw-trouble ${te.kind}`,role:"status",children:te.text}),a&&d.jsxs("div",{className:"bw-work",children:[d.jsxs("aside",{className:"bw-side",children:[d.jsxs("section",{className:"bw-sec",children:[d.jsxs("h4",{className:"bw-sec-head",children:["Activity overview",d.jsx("button",{className:"bw-help",onClick:()=>O(J=>!J),"aria-expanded":P,"aria-label":"What the sweep and the dots mean",children:"?"})]}),d.jsxs("div",{className:"bw-glance",children:[d.jsx(R5,{browsers:Q.map(J=>{var D;return{key:J.key,name:J.name,running:J.running,lastReadMs:((D=a.profiles.find(L=>L.browser===J.key))==null?void 0:D.lastWrittenMs)??null}}),findings:a.episodes.slice(0,6).map(J=>({browser:J.browser??null,atMs:J.endMs})),watching:a.settings.enabled,palette:s}),d.jsx("ul",{className:"bw-counts",children:O5(Q,a.profiles).map(J=>d.jsxs("li",{children:[d.jsx("span",{className:"bw-count-n",children:J.visits.toLocaleString("en-US")}),d.jsx("span",{className:"bw-count-of",children:J.name})]},J.key))})]}),d.jsx("p",{className:"bw-since",children:"Pages a program opened, since this deck started"}),a.coverage.checkedMs>0&&d.jsxs("p",{className:"bw-since",children:["Last checked ",P5(a.coverage.checkedMs,W),a.coverage.checks>0&&d.jsxs(d.Fragment,{children:[" · ",a.coverage.checks.toLocaleString("en-US")," ",a.coverage.checks===1?"check":"checks"]})]}),V!==null&&d.jsxs("p",{className:"bw-gate",children:["You are browsing — a program page would count in ",I5(V)]}),P&&d.jsxs("dl",{className:"bw-key",children:[d.jsx("dt",{children:"Sweep"}),d.jsx("dd",{children:"one poll of every watched profile"}),d.jsx("dt",{children:"Dot"}),d.jsx("dd",{children:"a browser, further out the longer since it last wrote history"}),d.jsx("dt",{children:"Ring"}),d.jsx("dd",{children:"a finding, leaving the browser it came from"})]})]}),d.jsxs("section",{className:"bw-sec",children:[d.jsxs("h4",{className:"bw-sec-head",children:["Watched profiles",d.jsx("button",{className:"bw-help",onClick:()=>M(J=>!J),"aria-expanded":F,"aria-label":"What running, idle and connected to Anthropic mean",children:"?"})]}),F&&d.jsxs("dl",{className:"bw-key",children:[d.jsx("dt",{children:"Running"}),d.jsx("dd",{children:"the browser has a process on this machine right now"}),d.jsx("dt",{children:"Connected"}),d.jsx("dd",{children:"an open connection to an address Anthropic's relay uses — which it shares with claude.ai, so an open tab looks the same as an agent channel"})]}),d.jsx("ul",{className:"bw-profiles",children:Q.map(J=>d.jsxs("li",{children:[d.jsx("span",{className:`bw-prof-dot${J.running?" on":""}`,"aria-hidden":!0}),d.jsx("span",{className:"bw-prof-name",children:J.name}),d.jsx("span",{className:"bw-prof-state",children:J.running?"running":"idle"}),J.running&&J.relay.state==="live"&&d.jsx("span",{className:"bw-relay",children:"connected to Anthropic"})]},J.key))}),H.length>0&&d.jsxs(d.Fragment,{children:[d.jsxs("button",{className:"bw-why bw-rest-head",onClick:()=>q(J=>!J),"aria-expanded":A,children:[d.jsx("span",{className:"bw-chev","aria-hidden":!0,children:A?"▾":"▸"})," ",H.length," not watched"]}),A&&d.jsxs("p",{className:"bw-rest",children:[H.map(J=>J.name).join(", ")," — not installed, or installed and never opened, so there is no history to read."]})]})]})]}),d.jsxs("div",{className:"bw-main",children:[d.jsxs("section",{className:"bw-findings",children:[d.jsxs("h4",{className:"bw-sec-head bw-head-row",children:["Findings",a.episodes.length>0&&d.jsxs("span",{className:"bw-feed-count",children:[a.episodes.length," ",a.episodes.length===1?"episode":"episodes"]})]}),d.jsx("div",{className:"bw-eps",children:re.length===0?d.jsxs("div",{className:"bw-empty",children:[d.jsx("p",{className:"bw-empty-head",children:"Nothing found yet"}),d.jsxs("p",{className:"bw-empty-note",children:["An episode lands here when a program opens pages in a browser nobody has touched for"," ",a.settings.quietMinutes," ",a.settings.quietMinutes===1?"minute":"minutes",". On most machines that is rare, so an empty list is the ordinary result rather than a sign something is wrong."]}),!a.settings.enabled&&d.jsx("p",{className:"bw-empty-note",children:"Watching is off, so this shows only what this deck has seen since it started. Anything an earlier run recorded comes back when you switch it on."})]}):re.map(J=>d.jsxs("div",{className:"bw-day",children:[d.jsx("h4",{className:"bw-sec-head",children:J.label}),J.episodes.map(D=>{const L=`${D.host}-${D.startMs}`,X=N===L;return d.jsxs("div",{className:`bw-ep${X?" open":""}`,children:[d.jsxs("div",{className:"bw-ep-row",children:[d.jsxs("button",{className:"bw-ep-head",onClick:()=>b(X?null:L),"aria-expanded":X,children:[d.jsx("span",{className:"bw-chev","aria-hidden":!0,children:X?"▾":"▸"}),d.jsx("span",{className:"bw-ep-host",children:D.host}),d.jsxs("span",{className:"bw-ep-meta",children:[L5(D),H1(D)&&d.jsxs(d.Fragment,{children:[" · ",H1(D)]})]}),d.jsxs("span",{className:"bw-ep-count",children:[D.count," ",D.count===1?"page":"pages"]})]}),d.jsx("button",{className:"glyph-btn bw-ep-x",onClick:()=>void Z(D),"aria-label":`Dismiss ${D.host}`,title:"Dismiss — it leaves this list for good, and stays in the log file",children:"×"})]}),X&&d.jsx("ul",{className:"bw-urls",children:D.urls.map((se,fe)=>d.jsxs("li",{children:[d.jsx("span",{className:"bw-url-time",children:new Date(se.timeMs).toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit",hour12:!1})}),d.jsx("span",{className:"bw-url",children:se.url})]},`${se.url}-${se.timeMs}-${fe}`))})]},L)})]},J.label))})]}),d.jsxs("section",{className:"bw-feed",children:[d.jsxs("h4",{className:"bw-sec-head bw-head-row",children:["Live activity",d.jsxs("span",{className:"bw-feed-count",children:[a.log.length," ",a.log.length===1?"event":"events"]})]}),d.jsx("p",{className:"bw-since bw-feed-note",children:"Pages you opened yourself — counted to run the rule, never written down. Addresses appear under Findings, and only for pages a program opened."}),d.jsx("div",{className:"bw-log","aria-live":"polite","aria-relevant":"additions",children:a.log.length===0?d.jsx("p",{className:"bw-note",children:"The deck writes a line here each time it looks at a profile."}):a.log.map(J=>d.jsxs("div",{className:`bw-log-line ${J.level}${J.parts?"":" sys"}`,children:[d.jsx("span",{className:"bw-log-time",children:new Date(J.atMs).toLocaleTimeString("en-GB",{hour12:!1})}),J.parts?d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"bw-log-browser",children:J.parts.browser}),d.jsx("span",{className:"bw-log-profile",title:J.parts.profile,children:J.parts.profile}),d.jsxs("span",{className:"bw-log-value",children:[J.parts.value,J.parts.flagged>0&&d.jsxs("span",{className:"bw-log-flag",children:[" · ",J.parts.flagged," flagged"]})]})]}):d.jsx("span",{className:"bw-log-sys",children:J.text})]},`${J.atMs}-${J.level}-${J.text}`))})]})]})]}),a&&E&&d.jsxs("div",{className:"bw-settings",children:[d.jsxs("label",{title:"A program opening a page counts as a finding only if nobody had touched the browser for this long. Shorter catches more and reports more of your own work; longer is quieter.",children:[d.jsx("span",{children:"Nobody browsing for"}),d.jsxs("select",{value:y??a.settings.quietMinutes,onChange:J=>{w(Number(J.target.value)),U({quietMinutes:Number(J.target.value)})},children:[d.jsx("option",{value:1,children:"1 min"}),d.jsx("option",{value:5,children:"5 min"}),d.jsx("option",{value:15,children:"15 min"}),d.jsx("option",{value:30,children:"30 min"}),d.jsx("option",{value:60,children:"60 min"})]})]}),d.jsxs("label",{children:[d.jsx("span",{children:"When it finds one"}),d.jsx("select",{value:a.settings.reaction,onChange:J=>void U({reaction:J.target.value}),disabled:!a.settings.enabled,title:a.settings.enabled?"What to do besides writing it down.":"Turn watching on to arm a reaction.",children:(a.reactions??["notify"]).map(J=>d.jsx("option",{value:J,children:J==="notify"?"notify me":J==="close-tab"?"close the tab":"quit the browser"},J))})]}),d.jsxs("div",{className:"bw-settings-note",children:[d.jsxs("p",{children:["Chrome marks a navigation that came from an extension or a command rather than from a click. These are the ones that happened while nobody had touched the browser for the time above. ",d.jsx("strong",{children:"Usually that is your own agent doing what you asked."})]}),d.jsxs("button",{className:"bw-why",onClick:()=>I(J=>!J),"aria-expanded":C,children:[d.jsx("span",{className:"bw-chev","aria-hidden":!0,children:C?"▾":"▸"})," What Browser Watch can access"]}),C&&d.jsxs("dl",{className:"bw-access",children:[d.jsx("dt",{children:"Reads"}),d.jsxs("dd",{children:["A copy of each browser's own history database — the live file is locked while the browser holds it. Only rows newer than the moment this deck started:"," ",new Date(a.coverage.startedMs).toLocaleString(),"."]}),d.jsx("dt",{children:"Keeps"}),d.jsxs("dd",{children:["Only while the switch is on, and only the episodes it flagged — never your ordinary browsing. In ",d.jsx("code",{className:"bw-path",children:a.coverage.logPath}),", with every address written in full so you can check it yourself."]}),d.jsx("dt",{children:"Sends"}),d.jsx("dd",{children:"Nothing. No part of this reads or writes over the network; the deck serves on 127.0.0.1 and this panel talks only to it."}),d.jsx("dt",{children:"Never reads"}),d.jsx("dd",{children:"Anything from before this deck started, cookies, saved passwords, page contents, or any browser profile with no history file."})]})]})]}),a&&d.jsxs("footer",{className:"bw-status",children:[d.jsx("span",{className:`bw-mode-dot${a.settings.enabled?" on":""}`,"aria-hidden":!0}),d.jsx("span",{className:"bw-mode-word",children:W1(a,_).word},W1(a,_).kind),d.jsx("span",{className:"bw-status-text",children:a.coverage.archived===0?a.settings.enabled?"No episodes recorded yet":"No episodes on disk":`${a.coverage.archived} ${a.coverage.archived===1?"episode":"episodes"} on disk`}),d.jsx("button",{className:`glyph-btn bw-gear${E?" on":""}`,onClick:()=>j(J=>!J),"aria-expanded":E,"aria-label":"Settings",title:"Settings",children:d.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3","aria-hidden":!0,children:[d.jsx("circle",{cx:"7",cy:"7",r:"2.1"}),d.jsx("path",{d:"M7 1.2v1.6M7 11.2v1.6M1.2 7h1.6M11.2 7h1.6M2.9 2.9l1.1 1.1M10 10l1.1 1.1M11.1 2.9L10 4M4 10l-1.1 1.1"})]})}),d.jsxs("label",{className:"bw-switch",htmlFor:"bw-enabled",children:[d.jsx("span",{className:"bw-switch-label",id:"bw-enabled-label",children:"Watch browser activity"}),d.jsx("button",{id:"bw-enabled",type:"button",role:"switch","aria-checked":a.settings.enabled,"aria-labelledby":"bw-enabled-label",className:"bw-toggle",onClick:()=>void U({enabled:!a.settings.enabled}),title:a.settings.enabled?"On — every episode it finds is written down, so the list outlives the browsing history being cleared":"Off — showing only what this deck has seen since it started. Anything an earlier run archived is hidden until you switch back on, and nothing new is kept",children:d.jsx("span",{className:"bw-toggle-knob"})})]})]})]})]})})}function Mw(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 Zf,G1;function F5(){if(G1)return Zf;G1=1;function e(){this.__data__=[],this.size=0}return Zf=e,Zf}var Jf,V1;function Gi(){if(V1)return Jf;V1=1;function e(t,n){return t===n||t!==t&&n!==n}return Jf=e,Jf}var eh,Y1;function Du(){if(Y1)return eh;Y1=1;var e=Gi();function t(n,s){for(var i=n.length;i--;)if(e(n[i][0],s))return i;return-1}return eh=t,eh}var th,K1;function z5(){if(K1)return th;K1=1;var e=Du(),t=Array.prototype,n=t.splice;function s(i){var a=this.__data__,l=e(a,i);if(l<0)return!1;var u=a.length-1;return l==u?a.pop():n.call(a,l,1),--this.size,!0}return th=s,th}var nh,X1;function B5(){if(X1)return nh;X1=1;var e=Du();function t(n){var s=this.__data__,i=e(s,n);return i<0?void 0:s[i][1]}return nh=t,nh}var rh,Q1;function U5(){if(Q1)return rh;Q1=1;var e=Du();function t(n){return e(this.__data__,n)>-1}return rh=t,rh}var sh,Z1;function W5(){if(Z1)return sh;Z1=1;var e=Du();function t(n,s){var i=this.__data__,a=e(i,n);return a<0?(++this.size,i.push([n,s])):i[a][1]=s,this}return sh=t,sh}var oh,J1;function Fu(){if(J1)return oh;J1=1;var e=F5(),t=z5(),n=B5(),s=U5(),i=W5();function a(l){var u=-1,h=l==null?0:l.length;for(this.clear();++u<h;){var p=l[u];this.set(p[0],p[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=s,a.prototype.set=i,oh=a,oh}var ih,e_;function H5(){if(e_)return ih;e_=1;var e=Fu();function t(){this.__data__=new e,this.size=0}return ih=t,ih}var ah,t_;function G5(){if(t_)return ah;t_=1;function e(t){var n=this.__data__,s=n.delete(t);return this.size=n.size,s}return ah=e,ah}var lh,n_;function V5(){if(n_)return lh;n_=1;function e(t){return this.__data__.get(t)}return lh=e,lh}var ch,r_;function Y5(){if(r_)return ch;r_=1;function e(t){return this.__data__.has(t)}return ch=e,ch}var uh,s_;function FT(){if(s_)return uh;s_=1;var e=typeof Lc=="object"&&Lc&&Lc.Object===Object&&Lc;return uh=e,uh}var dh,o_;function dr(){if(o_)return dh;o_=1;var e=FT(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return dh=n,dh}var fh,i_;function Vi(){if(i_)return fh;i_=1;var e=dr(),t=e.Symbol;return fh=t,fh}var hh,a_;function K5(){if(a_)return hh;a_=1;var e=Vi(),t=Object.prototype,n=t.hasOwnProperty,s=t.toString,i=e?e.toStringTag:void 0;function a(l){var u=n.call(l,i),h=l[i];try{l[i]=void 0;var p=!0}catch{}var f=s.call(l);return p&&(u?l[i]=h:delete l[i]),f}return hh=a,hh}var ph,l_;function X5(){if(l_)return ph;l_=1;var e=Object.prototype,t=e.toString;function n(s){return t.call(s)}return ph=n,ph}var mh,c_;function ko(){if(c_)return mh;c_=1;var e=Vi(),t=K5(),n=X5(),s="[object Null]",i="[object Undefined]",a=e?e.toStringTag:void 0;function l(u){return u==null?u===void 0?i:s:a&&a in Object(u)?t(u):n(u)}return mh=l,mh}var gh,u_;function Dn(){if(u_)return gh;u_=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return gh=e,gh}var vh,d_;function _l(){if(d_)return vh;d_=1;var e=ko(),t=Dn(),n="[object AsyncFunction]",s="[object Function]",i="[object GeneratorFunction]",a="[object Proxy]";function l(u){if(!t(u))return!1;var h=e(u);return h==s||h==i||h==n||h==a}return vh=l,vh}var yh,f_;function Q5(){if(f_)return yh;f_=1;var e=dr(),t=e["__core-js_shared__"];return yh=t,yh}var wh,h_;function Z5(){if(h_)return wh;h_=1;var e=Q5(),t=(function(){var s=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return s?"Symbol(src)_1."+s:""})();function n(s){return!!t&&t in s}return wh=n,wh}var xh,p_;function zT(){if(p_)return xh;p_=1;var e=Function.prototype,t=e.toString;function n(s){if(s!=null){try{return t.call(s)}catch{}try{return s+""}catch{}}return""}return xh=n,xh}var bh,m_;function J5(){if(m_)return bh;m_=1;var e=_l(),t=Z5(),n=Dn(),s=zT(),i=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,l=Function.prototype,u=Object.prototype,h=l.toString,p=u.hasOwnProperty,f=RegExp("^"+h.call(p).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function g(y){if(!n(y)||t(y))return!1;var w=e(y)?f:a;return w.test(s(y))}return bh=g,bh}var _h,g_;function eF(){if(g_)return _h;g_=1;function e(t,n){return t==null?void 0:t[n]}return _h=e,_h}var kh,v_;function So(){if(v_)return kh;v_=1;var e=J5(),t=eF();function n(s,i){var a=t(s,i);return e(a)?a:void 0}return kh=n,kh}var Sh,y_;function Iw(){if(y_)return Sh;y_=1;var e=So(),t=dr(),n=e(t,"Map");return Sh=n,Sh}var Nh,w_;function zu(){if(w_)return Nh;w_=1;var e=So(),t=e(Object,"create");return Nh=t,Nh}var Eh,x_;function tF(){if(x_)return Eh;x_=1;var e=zu();function t(){this.__data__=e?e(null):{},this.size=0}return Eh=t,Eh}var jh,b_;function nF(){if(b_)return jh;b_=1;function e(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}return jh=e,jh}var Ch,__;function rF(){if(__)return Ch;__=1;var e=zu(),t="__lodash_hash_undefined__",n=Object.prototype,s=n.hasOwnProperty;function i(a){var l=this.__data__;if(e){var u=l[a];return u===t?void 0:u}return s.call(l,a)?l[a]:void 0}return Ch=i,Ch}var Th,k_;function sF(){if(k_)return Th;k_=1;var e=zu(),t=Object.prototype,n=t.hasOwnProperty;function s(i){var a=this.__data__;return e?a[i]!==void 0:n.call(a,i)}return Th=s,Th}var Rh,S_;function oF(){if(S_)return Rh;S_=1;var e=zu(),t="__lodash_hash_undefined__";function n(s,i){var a=this.__data__;return this.size+=this.has(s)?0:1,a[s]=e&&i===void 0?t:i,this}return Rh=n,Rh}var Ah,N_;function iF(){if(N_)return Ah;N_=1;var e=tF(),t=nF(),n=rF(),s=sF(),i=oF();function a(l){var u=-1,h=l==null?0:l.length;for(this.clear();++u<h;){var p=l[u];this.set(p[0],p[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=s,a.prototype.set=i,Ah=a,Ah}var Mh,E_;function aF(){if(E_)return Mh;E_=1;var e=iF(),t=Fu(),n=Iw();function s(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return Mh=s,Mh}var Ih,j_;function lF(){if(j_)return Ih;j_=1;function e(t){var n=typeof t;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?t!=="__proto__":t===null}return Ih=e,Ih}var Oh,C_;function Bu(){if(C_)return Oh;C_=1;var e=lF();function t(n,s){var i=n.__data__;return e(s)?i[typeof s=="string"?"string":"hash"]:i.map}return Oh=t,Oh}var Ph,T_;function cF(){if(T_)return Ph;T_=1;var e=Bu();function t(n){var s=e(this,n).delete(n);return this.size-=s?1:0,s}return Ph=t,Ph}var $h,R_;function uF(){if(R_)return $h;R_=1;var e=Bu();function t(n){return e(this,n).get(n)}return $h=t,$h}var Lh,A_;function dF(){if(A_)return Lh;A_=1;var e=Bu();function t(n){return e(this,n).has(n)}return Lh=t,Lh}var qh,M_;function fF(){if(M_)return qh;M_=1;var e=Bu();function t(n,s){var i=e(this,n),a=i.size;return i.set(n,s),this.size+=i.size==a?0:1,this}return qh=t,qh}var Dh,I_;function Ow(){if(I_)return Dh;I_=1;var e=aF(),t=cF(),n=uF(),s=dF(),i=fF();function a(l){var u=-1,h=l==null?0:l.length;for(this.clear();++u<h;){var p=l[u];this.set(p[0],p[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=s,a.prototype.set=i,Dh=a,Dh}var Fh,O_;function hF(){if(O_)return Fh;O_=1;var e=Fu(),t=Iw(),n=Ow(),s=200;function i(a,l){var u=this.__data__;if(u instanceof e){var h=u.__data__;if(!t||h.length<s-1)return h.push([a,l]),this.size=++u.size,this;u=this.__data__=new n(h)}return u.set(a,l),this.size=u.size,this}return Fh=i,Fh}var zh,P_;function Uu(){if(P_)return zh;P_=1;var e=Fu(),t=H5(),n=G5(),s=V5(),i=Y5(),a=hF();function l(u){var h=this.__data__=new e(u);this.size=h.size}return l.prototype.clear=t,l.prototype.delete=n,l.prototype.get=s,l.prototype.has=i,l.prototype.set=a,zh=l,zh}var Bh,$_;function Pw(){if($_)return Bh;$_=1;function e(t,n){for(var s=-1,i=t==null?0:t.length;++s<i&&n(t[s],s,t)!==!1;);return t}return Bh=e,Bh}var Uh,L_;function BT(){if(L_)return Uh;L_=1;var e=So(),t=(function(){try{var n=e(Object,"defineProperty");return n({},"",{}),n}catch{}})();return Uh=t,Uh}var Wh,q_;function Wu(){if(q_)return Wh;q_=1;var e=BT();function t(n,s,i){s=="__proto__"&&e?e(n,s,{configurable:!0,enumerable:!0,value:i,writable:!0}):n[s]=i}return Wh=t,Wh}var Hh,D_;function Hu(){if(D_)return Hh;D_=1;var e=Wu(),t=Gi(),n=Object.prototype,s=n.hasOwnProperty;function i(a,l,u){var h=a[l];(!(s.call(a,l)&&t(h,u))||u===void 0&&!(l in a))&&e(a,l,u)}return Hh=i,Hh}var Gh,F_;function kl(){if(F_)return Gh;F_=1;var e=Hu(),t=Wu();function n(s,i,a,l){var u=!a;a||(a={});for(var h=-1,p=i.length;++h<p;){var f=i[h],g=l?l(a[f],s[f],f,a,s):void 0;g===void 0&&(g=s[f]),u?t(a,f,g):e(a,f,g)}return a}return Gh=n,Gh}var Vh,z_;function pF(){if(z_)return Vh;z_=1;function e(t,n){for(var s=-1,i=Array(t);++s<t;)i[s]=n(s);return i}return Vh=e,Vh}var Yh,B_;function jr(){if(B_)return Yh;B_=1;function e(t){return t!=null&&typeof t=="object"}return Yh=e,Yh}var Kh,U_;function mF(){if(U_)return Kh;U_=1;var e=ko(),t=jr(),n="[object Arguments]";function s(i){return t(i)&&e(i)==n}return Kh=s,Kh}var Xh,W_;function Sl(){if(W_)return Xh;W_=1;var e=mF(),t=jr(),n=Object.prototype,s=n.hasOwnProperty,i=n.propertyIsEnumerable,a=e((function(){return arguments})())?e:function(l){return t(l)&&s.call(l,"callee")&&!i.call(l,"callee")};return Xh=a,Xh}var Qh,H_;function At(){if(H_)return Qh;H_=1;var e=Array.isArray;return Qh=e,Qh}var Ka={exports:{}},Zh,G_;function gF(){if(G_)return Zh;G_=1;function e(){return!1}return Zh=e,Zh}Ka.exports;var V_;function Yi(){return V_||(V_=1,(function(e,t){var n=dr(),s=gF(),i=t&&!t.nodeType&&t,a=i&&!0&&e&&!e.nodeType&&e,l=a&&a.exports===i,u=l?n.Buffer:void 0,h=u?u.isBuffer:void 0,p=h||s;e.exports=p})(Ka,Ka.exports)),Ka.exports}var Jh,Y_;function Gu(){if(Y_)return Jh;Y_=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function n(s,i){var a=typeof s;return i=i??e,!!i&&(a=="number"||a!="symbol"&&t.test(s))&&s>-1&&s%1==0&&s<i}return Jh=n,Jh}var ep,K_;function $w(){if(K_)return ep;K_=1;var e=9007199254740991;function t(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=e}return ep=t,ep}var tp,X_;function vF(){if(X_)return tp;X_=1;var e=ko(),t=$w(),n=jr(),s="[object Arguments]",i="[object Array]",a="[object Boolean]",l="[object Date]",u="[object Error]",h="[object Function]",p="[object Map]",f="[object Number]",g="[object Object]",y="[object RegExp]",w="[object Set]",N="[object String]",b="[object WeakMap]",_="[object ArrayBuffer]",k="[object DataView]",E="[object Float32Array]",j="[object Float64Array]",C="[object Int8Array]",I="[object Int16Array]",P="[object Int32Array]",O="[object Uint8Array]",F="[object Uint8ClampedArray]",M="[object Uint16Array]",A="[object Uint32Array]",q={};q[E]=q[j]=q[C]=q[I]=q[P]=q[O]=q[F]=q[M]=q[A]=!0,q[s]=q[i]=q[_]=q[a]=q[k]=q[l]=q[u]=q[h]=q[p]=q[f]=q[g]=q[y]=q[w]=q[N]=q[b]=!1;function W(K){return n(K)&&t(K.length)&&!!q[e(K)]}return tp=W,tp}var np,Q_;function Vu(){if(Q_)return np;Q_=1;function e(t){return function(n){return t(n)}}return np=e,np}var Xa={exports:{}};Xa.exports;var Z_;function Lw(){return Z_||(Z_=1,(function(e,t){var n=FT(),s=t&&!t.nodeType&&t,i=s&&!0&&e&&!e.nodeType&&e,a=i&&i.exports===s,l=a&&n.process,u=(function(){try{var h=i&&i.require&&i.require("util").types;return h||l&&l.binding&&l.binding("util")}catch{}})();e.exports=u})(Xa,Xa.exports)),Xa.exports}var rp,J_;function Nl(){if(J_)return rp;J_=1;var e=vF(),t=Vu(),n=Lw(),s=n&&n.isTypedArray,i=s?t(s):e;return rp=i,rp}var sp,ek;function UT(){if(ek)return sp;ek=1;var e=pF(),t=Sl(),n=At(),s=Yi(),i=Gu(),a=Nl(),l=Object.prototype,u=l.hasOwnProperty;function h(p,f){var g=n(p),y=!g&&t(p),w=!g&&!y&&s(p),N=!g&&!y&&!w&&a(p),b=g||y||w||N,_=b?e(p.length,String):[],k=_.length;for(var E in p)(f||u.call(p,E))&&!(b&&(E=="length"||w&&(E=="offset"||E=="parent")||N&&(E=="buffer"||E=="byteLength"||E=="byteOffset")||i(E,k)))&&_.push(E);return _}return sp=h,sp}var op,tk;function Yu(){if(tk)return op;tk=1;var e=Object.prototype;function t(n){var s=n&&n.constructor,i=typeof s=="function"&&s.prototype||e;return n===i}return op=t,op}var ip,nk;function WT(){if(nk)return ip;nk=1;function e(t,n){return function(s){return t(n(s))}}return ip=e,ip}var ap,rk;function yF(){if(rk)return ap;rk=1;var e=WT(),t=e(Object.keys,Object);return ap=t,ap}var lp,sk;function qw(){if(sk)return lp;sk=1;var e=Yu(),t=yF(),n=Object.prototype,s=n.hasOwnProperty;function i(a){if(!e(a))return t(a);var l=[];for(var u in Object(a))s.call(a,u)&&u!="constructor"&&l.push(u);return l}return lp=i,lp}var cp,ok;function Zr(){if(ok)return cp;ok=1;var e=_l(),t=$w();function n(s){return s!=null&&t(s.length)&&!e(s)}return cp=n,cp}var up,ik;function Os(){if(ik)return up;ik=1;var e=UT(),t=qw(),n=Zr();function s(i){return n(i)?e(i):t(i)}return up=s,up}var dp,ak;function wF(){if(ak)return dp;ak=1;var e=kl(),t=Os();function n(s,i){return s&&e(i,t(i),s)}return dp=n,dp}var fp,lk;function xF(){if(lk)return fp;lk=1;function e(t){var n=[];if(t!=null)for(var s in Object(t))n.push(s);return n}return fp=e,fp}var hp,ck;function bF(){if(ck)return hp;ck=1;var e=Dn(),t=Yu(),n=xF(),s=Object.prototype,i=s.hasOwnProperty;function a(l){if(!e(l))return n(l);var u=t(l),h=[];for(var p in l)p=="constructor"&&(u||!i.call(l,p))||h.push(p);return h}return hp=a,hp}var pp,uk;function No(){if(uk)return pp;uk=1;var e=UT(),t=bF(),n=Zr();function s(i){return n(i)?e(i,!0):t(i)}return pp=s,pp}var mp,dk;function _F(){if(dk)return mp;dk=1;var e=kl(),t=No();function n(s,i){return s&&e(i,t(i),s)}return mp=n,mp}var Qa={exports:{}};Qa.exports;var fk;function HT(){return fk||(fk=1,(function(e,t){var n=dr(),s=t&&!t.nodeType&&t,i=s&&!0&&e&&!e.nodeType&&e,a=i&&i.exports===s,l=a?n.Buffer:void 0,u=l?l.allocUnsafe:void 0;function h(p,f){if(f)return p.slice();var g=p.length,y=u?u(g):new p.constructor(g);return p.copy(y),y}e.exports=h})(Qa,Qa.exports)),Qa.exports}var gp,hk;function GT(){if(hk)return gp;hk=1;function e(t,n){var s=-1,i=t.length;for(n||(n=Array(i));++s<i;)n[s]=t[s];return n}return gp=e,gp}var vp,pk;function VT(){if(pk)return vp;pk=1;function e(t,n){for(var s=-1,i=t==null?0:t.length,a=0,l=[];++s<i;){var u=t[s];n(u,s,t)&&(l[a++]=u)}return l}return vp=e,vp}var yp,mk;function YT(){if(mk)return yp;mk=1;function e(){return[]}return yp=e,yp}var wp,gk;function Dw(){if(gk)return wp;gk=1;var e=VT(),t=YT(),n=Object.prototype,s=n.propertyIsEnumerable,i=Object.getOwnPropertySymbols,a=i?function(l){return l==null?[]:(l=Object(l),e(i(l),function(u){return s.call(l,u)}))}:t;return wp=a,wp}var xp,vk;function kF(){if(vk)return xp;vk=1;var e=kl(),t=Dw();function n(s,i){return e(s,t(s),i)}return xp=n,xp}var bp,yk;function Fw(){if(yk)return bp;yk=1;function e(t,n){for(var s=-1,i=n.length,a=t.length;++s<i;)t[a+s]=n[s];return t}return bp=e,bp}var _p,wk;function Ku(){if(wk)return _p;wk=1;var e=WT(),t=e(Object.getPrototypeOf,Object);return _p=t,_p}var kp,xk;function KT(){if(xk)return kp;xk=1;var e=Fw(),t=Ku(),n=Dw(),s=YT(),i=Object.getOwnPropertySymbols,a=i?function(l){for(var u=[];l;)e(u,n(l)),l=t(l);return u}:s;return kp=a,kp}var Sp,bk;function SF(){if(bk)return Sp;bk=1;var e=kl(),t=KT();function n(s,i){return e(s,t(s),i)}return Sp=n,Sp}var Np,_k;function XT(){if(_k)return Np;_k=1;var e=Fw(),t=At();function n(s,i,a){var l=i(s);return t(s)?l:e(l,a(s))}return Np=n,Np}var Ep,kk;function QT(){if(kk)return Ep;kk=1;var e=XT(),t=Dw(),n=Os();function s(i){return e(i,n,t)}return Ep=s,Ep}var jp,Sk;function NF(){if(Sk)return jp;Sk=1;var e=XT(),t=KT(),n=No();function s(i){return e(i,n,t)}return jp=s,jp}var Cp,Nk;function EF(){if(Nk)return Cp;Nk=1;var e=So(),t=dr(),n=e(t,"DataView");return Cp=n,Cp}var Tp,Ek;function jF(){if(Ek)return Tp;Ek=1;var e=So(),t=dr(),n=e(t,"Promise");return Tp=n,Tp}var Rp,jk;function ZT(){if(jk)return Rp;jk=1;var e=So(),t=dr(),n=e(t,"Set");return Rp=n,Rp}var Ap,Ck;function CF(){if(Ck)return Ap;Ck=1;var e=So(),t=dr(),n=e(t,"WeakMap");return Ap=n,Ap}var Mp,Tk;function Ki(){if(Tk)return Mp;Tk=1;var e=EF(),t=Iw(),n=jF(),s=ZT(),i=CF(),a=ko(),l=zT(),u="[object Map]",h="[object Object]",p="[object Promise]",f="[object Set]",g="[object WeakMap]",y="[object DataView]",w=l(e),N=l(t),b=l(n),_=l(s),k=l(i),E=a;return(e&&E(new e(new ArrayBuffer(1)))!=y||t&&E(new t)!=u||n&&E(n.resolve())!=p||s&&E(new s)!=f||i&&E(new i)!=g)&&(E=function(j){var C=a(j),I=C==h?j.constructor:void 0,P=I?l(I):"";if(P)switch(P){case w:return y;case N:return u;case b:return p;case _:return f;case k:return g}return C}),Mp=E,Mp}var Ip,Rk;function TF(){if(Rk)return Ip;Rk=1;var e=Object.prototype,t=e.hasOwnProperty;function n(s){var i=s.length,a=new s.constructor(i);return i&&typeof s[0]=="string"&&t.call(s,"index")&&(a.index=s.index,a.input=s.input),a}return Ip=n,Ip}var Op,Ak;function JT(){if(Ak)return Op;Ak=1;var e=dr(),t=e.Uint8Array;return Op=t,Op}var Pp,Mk;function zw(){if(Mk)return Pp;Mk=1;var e=JT();function t(n){var s=new n.constructor(n.byteLength);return new e(s).set(new e(n)),s}return Pp=t,Pp}var $p,Ik;function RF(){if(Ik)return $p;Ik=1;var e=zw();function t(n,s){var i=s?e(n.buffer):n.buffer;return new n.constructor(i,n.byteOffset,n.byteLength)}return $p=t,$p}var Lp,Ok;function AF(){if(Ok)return Lp;Ok=1;var e=/\w*$/;function t(n){var s=new n.constructor(n.source,e.exec(n));return s.lastIndex=n.lastIndex,s}return Lp=t,Lp}var qp,Pk;function MF(){if(Pk)return qp;Pk=1;var e=Vi(),t=e?e.prototype:void 0,n=t?t.valueOf:void 0;function s(i){return n?Object(n.call(i)):{}}return qp=s,qp}var Dp,$k;function eR(){if($k)return Dp;$k=1;var e=zw();function t(n,s){var i=s?e(n.buffer):n.buffer;return new n.constructor(i,n.byteOffset,n.length)}return Dp=t,Dp}var Fp,Lk;function IF(){if(Lk)return Fp;Lk=1;var e=zw(),t=RF(),n=AF(),s=MF(),i=eR(),a="[object Boolean]",l="[object Date]",u="[object Map]",h="[object Number]",p="[object RegExp]",f="[object Set]",g="[object String]",y="[object Symbol]",w="[object ArrayBuffer]",N="[object DataView]",b="[object Float32Array]",_="[object Float64Array]",k="[object Int8Array]",E="[object Int16Array]",j="[object Int32Array]",C="[object Uint8Array]",I="[object Uint8ClampedArray]",P="[object Uint16Array]",O="[object Uint32Array]";function F(M,A,q){var W=M.constructor;switch(A){case w:return e(M);case a:case l:return new W(+M);case N:return t(M,q);case b:case _:case k:case E:case j:case C:case I:case P:case O:return i(M,q);case u:return new W;case h:case g:return new W(M);case p:return n(M);case f:return new W;case y:return s(M)}}return Fp=F,Fp}var zp,qk;function tR(){if(qk)return zp;qk=1;var e=Dn(),t=Object.create,n=(function(){function s(){}return function(i){if(!e(i))return{};if(t)return t(i);s.prototype=i;var a=new s;return s.prototype=void 0,a}})();return zp=n,zp}var Bp,Dk;function nR(){if(Dk)return Bp;Dk=1;var e=tR(),t=Ku(),n=Yu();function s(i){return typeof i.constructor=="function"&&!n(i)?e(t(i)):{}}return Bp=s,Bp}var Up,Fk;function OF(){if(Fk)return Up;Fk=1;var e=Ki(),t=jr(),n="[object Map]";function s(i){return t(i)&&e(i)==n}return Up=s,Up}var Wp,zk;function PF(){if(zk)return Wp;zk=1;var e=OF(),t=Vu(),n=Lw(),s=n&&n.isMap,i=s?t(s):e;return Wp=i,Wp}var Hp,Bk;function $F(){if(Bk)return Hp;Bk=1;var e=Ki(),t=jr(),n="[object Set]";function s(i){return t(i)&&e(i)==n}return Hp=s,Hp}var Gp,Uk;function LF(){if(Uk)return Gp;Uk=1;var e=$F(),t=Vu(),n=Lw(),s=n&&n.isSet,i=s?t(s):e;return Gp=i,Gp}var Vp,Wk;function rR(){if(Wk)return Vp;Wk=1;var e=Uu(),t=Pw(),n=Hu(),s=wF(),i=_F(),a=HT(),l=GT(),u=kF(),h=SF(),p=QT(),f=NF(),g=Ki(),y=TF(),w=IF(),N=nR(),b=At(),_=Yi(),k=PF(),E=Dn(),j=LF(),C=Os(),I=No(),P=1,O=2,F=4,M="[object Arguments]",A="[object Array]",q="[object Boolean]",W="[object Date]",K="[object Error]",T="[object Function]",Z="[object GeneratorFunction]",U="[object Map]",re="[object Number]",Q="[object Object]",H="[object RegExp]",te="[object Set]",$="[object String]",V="[object Symbol]",J="[object WeakMap]",D="[object ArrayBuffer]",L="[object DataView]",X="[object Float32Array]",se="[object Float64Array]",fe="[object Int8Array]",pe="[object Int16Array]",xe="[object Int32Array]",je="[object Uint8Array]",He="[object Uint8ClampedArray]",De="[object Uint16Array]",Me="[object Uint32Array]",_e={};_e[M]=_e[A]=_e[D]=_e[L]=_e[q]=_e[W]=_e[X]=_e[se]=_e[fe]=_e[pe]=_e[xe]=_e[U]=_e[re]=_e[Q]=_e[H]=_e[te]=_e[$]=_e[V]=_e[je]=_e[He]=_e[De]=_e[Me]=!0,_e[K]=_e[T]=_e[J]=!1;function G(he,ve,We,at,rt,Be){var Ie,Je=ve&P,Ge=ve&O,Qe=ve&F;if(We&&(Ie=rt?We(he,at,rt,Be):We(he)),Ie!==void 0)return Ie;if(!E(he))return he;var Oe=b(he);if(Oe){if(Ie=y(he),!Je)return l(he,Ie)}else{var lt=g(he),Mt=lt==T||lt==Z;if(_(he))return a(he,Je);if(lt==Q||lt==M||Mt&&!rt){if(Ie=Ge||Mt?{}:N(he),!Je)return Ge?h(he,i(Ie,he)):u(he,s(Ie,he))}else{if(!_e[lt])return rt?he:{};Ie=w(he,lt,Je)}}Be||(Be=new e);var ae=Be.get(he);if(ae)return ae;Be.set(he,Ie),j(he)?he.forEach(function(Ne){Ie.add(G(Ne,ve,We,Ne,he,Be))}):k(he)&&he.forEach(function(Ne,Ye){Ie.set(Ye,G(Ne,ve,We,Ye,he,Be))});var $e=Qe?Ge?f:p:Ge?I:C,Fe=Oe?void 0:$e(he);return t(Fe||he,function(Ne,Ye){Fe&&(Ye=Ne,Ne=he[Ye]),n(Ie,Ye,G(Ne,ve,We,Ye,he,Be))}),Ie}return Vp=G,Vp}var Yp,Hk;function qF(){if(Hk)return Yp;Hk=1;var e=rR(),t=4;function n(s){return e(s,t)}return Yp=n,Yp}var Kp,Gk;function Bw(){if(Gk)return Kp;Gk=1;function e(t){return function(){return t}}return Kp=e,Kp}var Xp,Vk;function DF(){if(Vk)return Xp;Vk=1;function e(t){return function(n,s,i){for(var a=-1,l=Object(n),u=i(n),h=u.length;h--;){var p=u[t?h:++a];if(s(l[p],p,l)===!1)break}return n}}return Xp=e,Xp}var Qp,Yk;function Uw(){if(Yk)return Qp;Yk=1;var e=DF(),t=e();return Qp=t,Qp}var Zp,Kk;function Ww(){if(Kk)return Zp;Kk=1;var e=Uw(),t=Os();function n(s,i){return s&&e(s,i,t)}return Zp=n,Zp}var Jp,Xk;function FF(){if(Xk)return Jp;Xk=1;var e=Zr();function t(n,s){return function(i,a){if(i==null)return i;if(!e(i))return n(i,a);for(var l=i.length,u=s?l:-1,h=Object(i);(s?u--:++u<l)&&a(h[u],u,h)!==!1;);return i}}return Jp=t,Jp}var em,Qk;function Xu(){if(Qk)return em;Qk=1;var e=Ww(),t=FF(),n=t(e);return em=n,em}var tm,Zk;function Eo(){if(Zk)return tm;Zk=1;function e(t){return t}return tm=e,tm}var nm,Jk;function sR(){if(Jk)return nm;Jk=1;var e=Eo();function t(n){return typeof n=="function"?n:e}return nm=t,nm}var rm,eS;function oR(){if(eS)return rm;eS=1;var e=Pw(),t=Xu(),n=sR(),s=At();function i(a,l){var u=s(a)?e:t;return u(a,n(l))}return rm=i,rm}var sm,tS;function iR(){return tS||(tS=1,sm=oR()),sm}var om,nS;function zF(){if(nS)return om;nS=1;var e=Xu();function t(n,s){var i=[];return e(n,function(a,l,u){s(a,l,u)&&i.push(a)}),i}return om=t,om}var im,rS;function BF(){if(rS)return im;rS=1;var e="__lodash_hash_undefined__";function t(n){return this.__data__.set(n,e),this}return im=t,im}var am,sS;function UF(){if(sS)return am;sS=1;function e(t){return this.__data__.has(t)}return am=e,am}var lm,oS;function aR(){if(oS)return lm;oS=1;var e=Ow(),t=BF(),n=UF();function s(i){var a=-1,l=i==null?0:i.length;for(this.__data__=new e;++a<l;)this.add(i[a])}return s.prototype.add=s.prototype.push=t,s.prototype.has=n,lm=s,lm}var cm,iS;function WF(){if(iS)return cm;iS=1;function e(t,n){for(var s=-1,i=t==null?0:t.length;++s<i;)if(n(t[s],s,t))return!0;return!1}return cm=e,cm}var um,aS;function lR(){if(aS)return um;aS=1;function e(t,n){return t.has(n)}return um=e,um}var dm,lS;function cR(){if(lS)return dm;lS=1;var e=aR(),t=WF(),n=lR(),s=1,i=2;function a(l,u,h,p,f,g){var y=h&s,w=l.length,N=u.length;if(w!=N&&!(y&&N>w))return!1;var b=g.get(l),_=g.get(u);if(b&&_)return b==u&&_==l;var k=-1,E=!0,j=h&i?new e:void 0;for(g.set(l,u),g.set(u,l);++k<w;){var C=l[k],I=u[k];if(p)var P=y?p(I,C,k,u,l,g):p(C,I,k,l,u,g);if(P!==void 0){if(P)continue;E=!1;break}if(j){if(!t(u,function(O,F){if(!n(j,F)&&(C===O||f(C,O,h,p,g)))return j.push(F)})){E=!1;break}}else if(!(C===I||f(C,I,h,p,g))){E=!1;break}}return g.delete(l),g.delete(u),E}return dm=a,dm}var fm,cS;function HF(){if(cS)return fm;cS=1;function e(t){var n=-1,s=Array(t.size);return t.forEach(function(i,a){s[++n]=[a,i]}),s}return fm=e,fm}var hm,uS;function Hw(){if(uS)return hm;uS=1;function e(t){var n=-1,s=Array(t.size);return t.forEach(function(i){s[++n]=i}),s}return hm=e,hm}var pm,dS;function GF(){if(dS)return pm;dS=1;var e=Vi(),t=JT(),n=Gi(),s=cR(),i=HF(),a=Hw(),l=1,u=2,h="[object Boolean]",p="[object Date]",f="[object Error]",g="[object Map]",y="[object Number]",w="[object RegExp]",N="[object Set]",b="[object String]",_="[object Symbol]",k="[object ArrayBuffer]",E="[object DataView]",j=e?e.prototype:void 0,C=j?j.valueOf:void 0;function I(P,O,F,M,A,q,W){switch(F){case E:if(P.byteLength!=O.byteLength||P.byteOffset!=O.byteOffset)return!1;P=P.buffer,O=O.buffer;case k:return!(P.byteLength!=O.byteLength||!q(new t(P),new t(O)));case h:case p:case y:return n(+P,+O);case f:return P.name==O.name&&P.message==O.message;case w:case b:return P==O+"";case g:var K=i;case N:var T=M&l;if(K||(K=a),P.size!=O.size&&!T)return!1;var Z=W.get(P);if(Z)return Z==O;M|=u,W.set(P,O);var U=s(K(P),K(O),M,A,q,W);return W.delete(P),U;case _:if(C)return C.call(P)==C.call(O)}return!1}return pm=I,pm}var mm,fS;function VF(){if(fS)return mm;fS=1;var e=QT(),t=1,n=Object.prototype,s=n.hasOwnProperty;function i(a,l,u,h,p,f){var g=u&t,y=e(a),w=y.length,N=e(l),b=N.length;if(w!=b&&!g)return!1;for(var _=w;_--;){var k=y[_];if(!(g?k in l:s.call(l,k)))return!1}var E=f.get(a),j=f.get(l);if(E&&j)return E==l&&j==a;var C=!0;f.set(a,l),f.set(l,a);for(var I=g;++_<w;){k=y[_];var P=a[k],O=l[k];if(h)var F=g?h(O,P,k,l,a,f):h(P,O,k,a,l,f);if(!(F===void 0?P===O||p(P,O,u,h,f):F)){C=!1;break}I||(I=k=="constructor")}if(C&&!I){var M=a.constructor,A=l.constructor;M!=A&&"constructor"in a&&"constructor"in l&&!(typeof M=="function"&&M instanceof M&&typeof A=="function"&&A instanceof A)&&(C=!1)}return f.delete(a),f.delete(l),C}return mm=i,mm}var gm,hS;function YF(){if(hS)return gm;hS=1;var e=Uu(),t=cR(),n=GF(),s=VF(),i=Ki(),a=At(),l=Yi(),u=Nl(),h=1,p="[object Arguments]",f="[object Array]",g="[object Object]",y=Object.prototype,w=y.hasOwnProperty;function N(b,_,k,E,j,C){var I=a(b),P=a(_),O=I?f:i(b),F=P?f:i(_);O=O==p?g:O,F=F==p?g:F;var M=O==g,A=F==g,q=O==F;if(q&&l(b)){if(!l(_))return!1;I=!0,M=!1}if(q&&!M)return C||(C=new e),I||u(b)?t(b,_,k,E,j,C):n(b,_,O,k,E,j,C);if(!(k&h)){var W=M&&w.call(b,"__wrapped__"),K=A&&w.call(_,"__wrapped__");if(W||K){var T=W?b.value():b,Z=K?_.value():_;return C||(C=new e),j(T,Z,k,E,C)}}return q?(C||(C=new e),s(b,_,k,E,j,C)):!1}return gm=N,gm}var vm,pS;function uR(){if(pS)return vm;pS=1;var e=YF(),t=jr();function n(s,i,a,l,u){return s===i?!0:s==null||i==null||!t(s)&&!t(i)?s!==s&&i!==i:e(s,i,a,l,n,u)}return vm=n,vm}var ym,mS;function KF(){if(mS)return ym;mS=1;var e=Uu(),t=uR(),n=1,s=2;function i(a,l,u,h){var p=u.length,f=p,g=!h;if(a==null)return!f;for(a=Object(a);p--;){var y=u[p];if(g&&y[2]?y[1]!==a[y[0]]:!(y[0]in a))return!1}for(;++p<f;){y=u[p];var w=y[0],N=a[w],b=y[1];if(g&&y[2]){if(N===void 0&&!(w in a))return!1}else{var _=new e;if(h)var k=h(N,b,w,a,l,_);if(!(k===void 0?t(b,N,n|s,h,_):k))return!1}}return!0}return ym=i,ym}var wm,gS;function dR(){if(gS)return wm;gS=1;var e=Dn();function t(n){return n===n&&!e(n)}return wm=t,wm}var xm,vS;function XF(){if(vS)return xm;vS=1;var e=dR(),t=Os();function n(s){for(var i=t(s),a=i.length;a--;){var l=i[a],u=s[l];i[a]=[l,u,e(u)]}return i}return xm=n,xm}var bm,yS;function fR(){if(yS)return bm;yS=1;function e(t,n){return function(s){return s==null?!1:s[t]===n&&(n!==void 0||t in Object(s))}}return bm=e,bm}var _m,wS;function QF(){if(wS)return _m;wS=1;var e=KF(),t=XF(),n=fR();function s(i){var a=t(i);return a.length==1&&a[0][2]?n(a[0][0],a[0][1]):function(l){return l===i||e(l,i,a)}}return _m=s,_m}var km,xS;function Xi(){if(xS)return km;xS=1;var e=ko(),t=jr(),n="[object Symbol]";function s(i){return typeof i=="symbol"||t(i)&&e(i)==n}return km=s,km}var Sm,bS;function Gw(){if(bS)return Sm;bS=1;var e=At(),t=Xi(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,s=/^\w*$/;function i(a,l){if(e(a))return!1;var u=typeof a;return u=="number"||u=="symbol"||u=="boolean"||a==null||t(a)?!0:s.test(a)||!n.test(a)||l!=null&&a in Object(l)}return Sm=i,Sm}var Nm,_S;function ZF(){if(_S)return Nm;_S=1;var e=Ow(),t="Expected a function";function n(s,i){if(typeof s!="function"||i!=null&&typeof i!="function")throw new TypeError(t);var a=function(){var l=arguments,u=i?i.apply(this,l):l[0],h=a.cache;if(h.has(u))return h.get(u);var p=s.apply(this,l);return a.cache=h.set(u,p)||h,p};return a.cache=new(n.Cache||e),a}return n.Cache=e,Nm=n,Nm}var Em,kS;function JF(){if(kS)return Em;kS=1;var e=ZF(),t=500;function n(s){var i=e(s,function(l){return a.size===t&&a.clear(),l}),a=i.cache;return i}return Em=n,Em}var jm,SS;function e6(){if(SS)return jm;SS=1;var e=JF(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g,s=e(function(i){var a=[];return i.charCodeAt(0)===46&&a.push(""),i.replace(t,function(l,u,h,p){a.push(h?p.replace(n,"$1"):u||l)}),a});return jm=s,jm}var Cm,NS;function Qu(){if(NS)return Cm;NS=1;function e(t,n){for(var s=-1,i=t==null?0:t.length,a=Array(i);++s<i;)a[s]=n(t[s],s,t);return a}return Cm=e,Cm}var Tm,ES;function t6(){if(ES)return Tm;ES=1;var e=Vi(),t=Qu(),n=At(),s=Xi(),i=e?e.prototype:void 0,a=i?i.toString:void 0;function l(u){if(typeof u=="string")return u;if(n(u))return t(u,l)+"";if(s(u))return a?a.call(u):"";var h=u+"";return h=="0"&&1/u==-1/0?"-0":h}return Tm=l,Tm}var Rm,jS;function hR(){if(jS)return Rm;jS=1;var e=t6();function t(n){return n==null?"":e(n)}return Rm=t,Rm}var Am,CS;function Zu(){if(CS)return Am;CS=1;var e=At(),t=Gw(),n=e6(),s=hR();function i(a,l){return e(a)?a:t(a,l)?[a]:n(s(a))}return Am=i,Am}var Mm,TS;function El(){if(TS)return Mm;TS=1;var e=Xi();function t(n){if(typeof n=="string"||e(n))return n;var s=n+"";return s=="0"&&1/n==-1/0?"-0":s}return Mm=t,Mm}var Im,RS;function Ju(){if(RS)return Im;RS=1;var e=Zu(),t=El();function n(s,i){i=e(i,s);for(var a=0,l=i.length;s!=null&&a<l;)s=s[t(i[a++])];return a&&a==l?s:void 0}return Im=n,Im}var Om,AS;function n6(){if(AS)return Om;AS=1;var e=Ju();function t(n,s,i){var a=n==null?void 0:e(n,s);return a===void 0?i:a}return Om=t,Om}var Pm,MS;function r6(){if(MS)return Pm;MS=1;function e(t,n){return t!=null&&n in Object(t)}return Pm=e,Pm}var $m,IS;function pR(){if(IS)return $m;IS=1;var e=Zu(),t=Sl(),n=At(),s=Gu(),i=$w(),a=El();function l(u,h,p){h=e(h,u);for(var f=-1,g=h.length,y=!1;++f<g;){var w=a(h[f]);if(!(y=u!=null&&p(u,w)))break;u=u[w]}return y||++f!=g?y:(g=u==null?0:u.length,!!g&&i(g)&&s(w,g)&&(n(u)||t(u)))}return $m=l,$m}var Lm,OS;function mR(){if(OS)return Lm;OS=1;var e=r6(),t=pR();function n(s,i){return s!=null&&t(s,i,e)}return Lm=n,Lm}var qm,PS;function s6(){if(PS)return qm;PS=1;var e=uR(),t=n6(),n=mR(),s=Gw(),i=dR(),a=fR(),l=El(),u=1,h=2;function p(f,g){return s(f)&&i(g)?a(l(f),g):function(y){var w=t(y,f);return w===void 0&&w===g?n(y,f):e(g,w,u|h)}}return qm=p,qm}var Dm,$S;function gR(){if($S)return Dm;$S=1;function e(t){return function(n){return n==null?void 0:n[t]}}return Dm=e,Dm}var Fm,LS;function o6(){if(LS)return Fm;LS=1;var e=Ju();function t(n){return function(s){return e(s,n)}}return Fm=t,Fm}var zm,qS;function i6(){if(qS)return zm;qS=1;var e=gR(),t=o6(),n=Gw(),s=El();function i(a){return n(a)?e(s(a)):t(a)}return zm=i,zm}var Bm,DS;function Jr(){if(DS)return Bm;DS=1;var e=QF(),t=s6(),n=Eo(),s=At(),i=i6();function a(l){return typeof l=="function"?l:l==null?n:typeof l=="object"?s(l)?t(l[0],l[1]):e(l):i(l)}return Bm=a,Bm}var Um,FS;function vR(){if(FS)return Um;FS=1;var e=VT(),t=zF(),n=Jr(),s=At();function i(a,l){var u=s(a)?e:t;return u(a,n(l,3))}return Um=i,Um}var Wm,zS;function a6(){if(zS)return Wm;zS=1;var e=Object.prototype,t=e.hasOwnProperty;function n(s,i){return s!=null&&t.call(s,i)}return Wm=n,Wm}var Hm,BS;function yR(){if(BS)return Hm;BS=1;var e=a6(),t=pR();function n(s,i){return s!=null&&t(s,i,e)}return Hm=n,Hm}var Gm,US;function l6(){if(US)return Gm;US=1;var e=qw(),t=Ki(),n=Sl(),s=At(),i=Zr(),a=Yi(),l=Yu(),u=Nl(),h="[object Map]",p="[object Set]",f=Object.prototype,g=f.hasOwnProperty;function y(w){if(w==null)return!0;if(i(w)&&(s(w)||typeof w=="string"||typeof w.splice=="function"||a(w)||u(w)||n(w)))return!w.length;var N=t(w);if(N==h||N==p)return!w.size;if(l(w))return!e(w).length;for(var b in w)if(g.call(w,b))return!1;return!0}return Gm=y,Gm}var Vm,WS;function wR(){if(WS)return Vm;WS=1;function e(t){return t===void 0}return Vm=e,Vm}var Ym,HS;function xR(){if(HS)return Ym;HS=1;var e=Xu(),t=Zr();function n(s,i){var a=-1,l=t(s)?Array(s.length):[];return e(s,function(u,h,p){l[++a]=i(u,h,p)}),l}return Ym=n,Ym}var Km,GS;function bR(){if(GS)return Km;GS=1;var e=Qu(),t=Jr(),n=xR(),s=At();function i(a,l){var u=s(a)?e:n;return u(a,t(l,3))}return Km=i,Km}var Xm,VS;function c6(){if(VS)return Xm;VS=1;function e(t,n,s,i){var a=-1,l=t==null?0:t.length;for(i&&l&&(s=t[++a]);++a<l;)s=n(s,t[a],a,t);return s}return Xm=e,Xm}var Qm,YS;function u6(){if(YS)return Qm;YS=1;function e(t,n,s,i,a){return a(t,function(l,u,h){s=i?(i=!1,l):n(s,l,u,h)}),s}return Qm=e,Qm}var Zm,KS;function _R(){if(KS)return Zm;KS=1;var e=c6(),t=Xu(),n=Jr(),s=u6(),i=At();function a(l,u,h){var p=i(l)?e:s,f=arguments.length<3;return p(l,n(u,4),h,f,t)}return Zm=a,Zm}var Jm,XS;function d6(){if(XS)return Jm;XS=1;var e=ko(),t=At(),n=jr(),s="[object String]";function i(a){return typeof a=="string"||!t(a)&&n(a)&&e(a)==s}return Jm=i,Jm}var eg,QS;function f6(){if(QS)return eg;QS=1;var e=gR(),t=e("length");return eg=t,eg}var tg,ZS;function h6(){if(ZS)return tg;ZS=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",s="\\u20d0-\\u20ff",i=t+n+s,a="\\ufe0e\\ufe0f",l="\\u200d",u=RegExp("["+l+e+i+a+"]");function h(p){return u.test(p)}return tg=h,tg}var ng,JS;function p6(){if(JS)return ng;JS=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",s="\\u20d0-\\u20ff",i=t+n+s,a="\\ufe0e\\ufe0f",l="["+e+"]",u="["+i+"]",h="\\ud83c[\\udffb-\\udfff]",p="(?:"+u+"|"+h+")",f="[^"+e+"]",g="(?:\\ud83c[\\udde6-\\uddff]){2}",y="[\\ud800-\\udbff][\\udc00-\\udfff]",w="\\u200d",N=p+"?",b="["+a+"]?",_="(?:"+w+"(?:"+[f,g,y].join("|")+")"+b+N+")*",k=b+N+_,E="(?:"+[f+u+"?",u,g,y,l].join("|")+")",j=RegExp(h+"(?="+h+")|"+E+k,"g");function C(I){for(var P=j.lastIndex=0;j.test(I);)++P;return P}return ng=C,ng}var rg,eN;function m6(){if(eN)return rg;eN=1;var e=f6(),t=h6(),n=p6();function s(i){return t(i)?n(i):e(i)}return rg=s,rg}var sg,tN;function g6(){if(tN)return sg;tN=1;var e=qw(),t=Ki(),n=Zr(),s=d6(),i=m6(),a="[object Map]",l="[object Set]";function u(h){if(h==null)return 0;if(n(h))return s(h)?i(h):h.length;var p=t(h);return p==a||p==l?h.size:e(h).length}return sg=u,sg}var og,nN;function v6(){if(nN)return og;nN=1;var e=Pw(),t=tR(),n=Ww(),s=Jr(),i=Ku(),a=At(),l=Yi(),u=_l(),h=Dn(),p=Nl();function f(g,y,w){var N=a(g),b=N||l(g)||p(g);if(y=s(y,4),w==null){var _=g&&g.constructor;b?w=N?new _:[]:h(g)?w=u(_)?t(i(g)):{}:w={}}return(b?e:n)(g,function(k,E,j){return y(w,k,E,j)}),w}return og=f,og}var ig,rN;function y6(){if(rN)return ig;rN=1;var e=Vi(),t=Sl(),n=At(),s=e?e.isConcatSpreadable:void 0;function i(a){return n(a)||t(a)||!!(s&&a&&a[s])}return ig=i,ig}var ag,sN;function Vw(){if(sN)return ag;sN=1;var e=Fw(),t=y6();function n(s,i,a,l,u){var h=-1,p=s.length;for(a||(a=t),u||(u=[]);++h<p;){var f=s[h];i>0&&a(f)?i>1?n(f,i-1,a,l,u):e(u,f):l||(u[u.length]=f)}return u}return ag=n,ag}var lg,oN;function w6(){if(oN)return lg;oN=1;function e(t,n,s){switch(s.length){case 0:return t.call(n);case 1:return t.call(n,s[0]);case 2:return t.call(n,s[0],s[1]);case 3:return t.call(n,s[0],s[1],s[2])}return t.apply(n,s)}return lg=e,lg}var cg,iN;function kR(){if(iN)return cg;iN=1;var e=w6(),t=Math.max;function n(s,i,a){return i=t(i===void 0?s.length-1:i,0),function(){for(var l=arguments,u=-1,h=t(l.length-i,0),p=Array(h);++u<h;)p[u]=l[i+u];u=-1;for(var f=Array(i+1);++u<i;)f[u]=l[u];return f[i]=a(p),e(s,this,f)}}return cg=n,cg}var ug,aN;function x6(){if(aN)return ug;aN=1;var e=Bw(),t=BT(),n=Eo(),s=t?function(i,a){return t(i,"toString",{configurable:!0,enumerable:!1,value:e(a),writable:!0})}:n;return ug=s,ug}var dg,lN;function b6(){if(lN)return dg;lN=1;var e=800,t=16,n=Date.now;function s(i){var a=0,l=0;return function(){var u=n(),h=t-(u-l);if(l=u,h>0){if(++a>=e)return arguments[0]}else a=0;return i.apply(void 0,arguments)}}return dg=s,dg}var fg,cN;function SR(){if(cN)return fg;cN=1;var e=x6(),t=b6(),n=t(e);return fg=n,fg}var hg,uN;function ed(){if(uN)return hg;uN=1;var e=Eo(),t=kR(),n=SR();function s(i,a){return n(t(i,a,e),i+"")}return hg=s,hg}var pg,dN;function NR(){if(dN)return pg;dN=1;function e(t,n,s,i){for(var a=t.length,l=s+(i?1:-1);i?l--:++l<a;)if(n(t[l],l,t))return l;return-1}return pg=e,pg}var mg,fN;function _6(){if(fN)return mg;fN=1;function e(t){return t!==t}return mg=e,mg}var gg,hN;function k6(){if(hN)return gg;hN=1;function e(t,n,s){for(var i=s-1,a=t.length;++i<a;)if(t[i]===n)return i;return-1}return gg=e,gg}var vg,pN;function S6(){if(pN)return vg;pN=1;var e=NR(),t=_6(),n=k6();function s(i,a,l){return a===a?n(i,a,l):e(i,t,l)}return vg=s,vg}var yg,mN;function N6(){if(mN)return yg;mN=1;var e=S6();function t(n,s){var i=n==null?0:n.length;return!!i&&e(n,s,0)>-1}return yg=t,yg}var wg,gN;function E6(){if(gN)return wg;gN=1;function e(t,n,s){for(var i=-1,a=t==null?0:t.length;++i<a;)if(s(n,t[i]))return!0;return!1}return wg=e,wg}var xg,vN;function j6(){if(vN)return xg;vN=1;function e(){}return xg=e,xg}var bg,yN;function C6(){if(yN)return bg;yN=1;var e=ZT(),t=j6(),n=Hw(),s=1/0,i=e&&1/n(new e([,-0]))[1]==s?function(a){return new e(a)}:t;return bg=i,bg}var _g,wN;function T6(){if(wN)return _g;wN=1;var e=aR(),t=N6(),n=E6(),s=lR(),i=C6(),a=Hw(),l=200;function u(h,p,f){var g=-1,y=t,w=h.length,N=!0,b=[],_=b;if(f)N=!1,y=n;else if(w>=l){var k=p?null:i(h);if(k)return a(k);N=!1,y=s,_=new e}else _=p?[]:b;e:for(;++g<w;){var E=h[g],j=p?p(E):E;if(E=f||E!==0?E:0,N&&j===j){for(var C=_.length;C--;)if(_[C]===j)continue e;p&&_.push(j),b.push(E)}else y(_,j,f)||(_!==b&&_.push(j),b.push(E))}return b}return _g=u,_g}var kg,xN;function ER(){if(xN)return kg;xN=1;var e=Zr(),t=jr();function n(s){return t(s)&&e(s)}return kg=n,kg}var Sg,bN;function R6(){if(bN)return Sg;bN=1;var e=Vw(),t=ed(),n=T6(),s=ER(),i=t(function(a){return n(e(a,1,s,!0))});return Sg=i,Sg}var Ng,_N;function A6(){if(_N)return Ng;_N=1;var e=Qu();function t(n,s){return e(s,function(i){return n[i]})}return Ng=t,Ng}var Eg,kN;function jR(){if(kN)return Eg;kN=1;var e=A6(),t=Os();function n(s){return s==null?[]:e(s,t(s))}return Eg=n,Eg}var jg,SN;function Fn(){if(SN)return jg;SN=1;var e;if(typeof Mw=="function")try{e={clone:qF(),constant:Bw(),each:iR(),filter:vR(),has:yR(),isArray:At(),isEmpty:l6(),isFunction:_l(),isUndefined:wR(),keys:Os(),map:bR(),reduce:_R(),size:g6(),transform:v6(),union:R6(),values:jR()}}catch{}return e||(e=window._),jg=e,jg}var Cg,NN;function Yw(){if(NN)return Cg;NN=1;var e=Fn();Cg=i;var t="\0",n="\0",s="";function i(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={}}i.prototype._nodeCount=0,i.prototype._edgeCount=0,i.prototype.isDirected=function(){return this._isDirected},i.prototype.isMultigraph=function(){return this._isMultigraph},i.prototype.isCompound=function(){return this._isCompound},i.prototype.setGraph=function(f){return this._label=f,this},i.prototype.graph=function(){return this._label},i.prototype.setDefaultNodeLabel=function(f){return e.isFunction(f)||(f=e.constant(f)),this._defaultNodeLabelFn=f,this},i.prototype.nodeCount=function(){return this._nodeCount},i.prototype.nodes=function(){return e.keys(this._nodes)},i.prototype.sources=function(){var f=this;return e.filter(this.nodes(),function(g){return e.isEmpty(f._in[g])})},i.prototype.sinks=function(){var f=this;return e.filter(this.nodes(),function(g){return e.isEmpty(f._out[g])})},i.prototype.setNodes=function(f,g){var y=arguments,w=this;return e.each(f,function(N){y.length>1?w.setNode(N,g):w.setNode(N)}),this},i.prototype.setNode=function(f,g){return e.has(this._nodes,f)?(arguments.length>1&&(this._nodes[f]=g),this):(this._nodes[f]=arguments.length>1?g: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)},i.prototype.node=function(f){return this._nodes[f]},i.prototype.hasNode=function(f){return e.has(this._nodes,f)},i.prototype.removeNode=function(f){var g=this;if(e.has(this._nodes,f)){var y=function(w){g.removeEdge(g._edgeObjs[w])};delete this._nodes[f],this._isCompound&&(this._removeFromParentsChildList(f),delete this._parent[f],e.each(this.children(f),function(w){g.setParent(w)}),delete this._children[f]),e.each(e.keys(this._in[f]),y),delete this._in[f],delete this._preds[f],e.each(e.keys(this._out[f]),y),delete this._out[f],delete this._sucs[f],--this._nodeCount}return this},i.prototype.setParent=function(f,g){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(e.isUndefined(g))g=n;else{g+="";for(var y=g;!e.isUndefined(y);y=this.parent(y))if(y===f)throw new Error("Setting "+g+" as parent of "+f+" would create a cycle");this.setNode(g)}return this.setNode(f),this._removeFromParentsChildList(f),this._parent[f]=g,this._children[g][f]=!0,this},i.prototype._removeFromParentsChildList=function(f){delete this._children[this._parent[f]][f]},i.prototype.parent=function(f){if(this._isCompound){var g=this._parent[f];if(g!==n)return g}},i.prototype.children=function(f){if(e.isUndefined(f)&&(f=n),this._isCompound){var g=this._children[f];if(g)return e.keys(g)}else{if(f===n)return this.nodes();if(this.hasNode(f))return[]}},i.prototype.predecessors=function(f){var g=this._preds[f];if(g)return e.keys(g)},i.prototype.successors=function(f){var g=this._sucs[f];if(g)return e.keys(g)},i.prototype.neighbors=function(f){var g=this.predecessors(f);if(g)return e.union(g,this.successors(f))},i.prototype.isLeaf=function(f){var g;return this.isDirected()?g=this.successors(f):g=this.neighbors(f),g.length===0},i.prototype.filterNodes=function(f){var g=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});g.setGraph(this.graph());var y=this;e.each(this._nodes,function(b,_){f(_)&&g.setNode(_,b)}),e.each(this._edgeObjs,function(b){g.hasNode(b.v)&&g.hasNode(b.w)&&g.setEdge(b,y.edge(b))});var w={};function N(b){var _=y.parent(b);return _===void 0||g.hasNode(_)?(w[b]=_,_):_ in w?w[_]:N(_)}return this._isCompound&&e.each(g.nodes(),function(b){g.setParent(b,N(b))}),g},i.prototype.setDefaultEdgeLabel=function(f){return e.isFunction(f)||(f=e.constant(f)),this._defaultEdgeLabelFn=f,this},i.prototype.edgeCount=function(){return this._edgeCount},i.prototype.edges=function(){return e.values(this._edgeObjs)},i.prototype.setPath=function(f,g){var y=this,w=arguments;return e.reduce(f,function(N,b){return w.length>1?y.setEdge(N,b,g):y.setEdge(N,b),b}),this},i.prototype.setEdge=function(){var f,g,y,w,N=!1,b=arguments[0];typeof b=="object"&&b!==null&&"v"in b?(f=b.v,g=b.w,y=b.name,arguments.length===2&&(w=arguments[1],N=!0)):(f=b,g=arguments[1],y=arguments[3],arguments.length>2&&(w=arguments[2],N=!0)),f=""+f,g=""+g,e.isUndefined(y)||(y=""+y);var _=u(this._isDirected,f,g,y);if(e.has(this._edgeLabels,_))return N&&(this._edgeLabels[_]=w),this;if(!e.isUndefined(y)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(f),this.setNode(g),this._edgeLabels[_]=N?w:this._defaultEdgeLabelFn(f,g,y);var k=h(this._isDirected,f,g,y);return f=k.v,g=k.w,Object.freeze(k),this._edgeObjs[_]=k,a(this._preds[g],f),a(this._sucs[f],g),this._in[g][_]=k,this._out[f][_]=k,this._edgeCount++,this},i.prototype.edge=function(f,g,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):u(this._isDirected,f,g,y);return this._edgeLabels[w]},i.prototype.hasEdge=function(f,g,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):u(this._isDirected,f,g,y);return e.has(this._edgeLabels,w)},i.prototype.removeEdge=function(f,g,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):u(this._isDirected,f,g,y),N=this._edgeObjs[w];return N&&(f=N.v,g=N.w,delete this._edgeLabels[w],delete this._edgeObjs[w],l(this._preds[g],f),l(this._sucs[f],g),delete this._in[g][w],delete this._out[f][w],this._edgeCount--),this},i.prototype.inEdges=function(f,g){var y=this._in[f];if(y){var w=e.values(y);return g?e.filter(w,function(N){return N.v===g}):w}},i.prototype.outEdges=function(f,g){var y=this._out[f];if(y){var w=e.values(y);return g?e.filter(w,function(N){return N.w===g}):w}},i.prototype.nodeEdges=function(f,g){var y=this.inEdges(f,g);if(y)return y.concat(this.outEdges(f,g))};function a(f,g){f[g]?f[g]++:f[g]=1}function l(f,g){--f[g]||delete f[g]}function u(f,g,y,w){var N=""+g,b=""+y;if(!f&&N>b){var _=N;N=b,b=_}return N+s+b+s+(e.isUndefined(w)?t:w)}function h(f,g,y,w){var N=""+g,b=""+y;if(!f&&N>b){var _=N;N=b,b=_}var k={v:N,w:b};return w&&(k.name=w),k}function p(f,g){return u(f,g.v,g.w,g.name)}return Cg}var Tg,EN;function M6(){return EN||(EN=1,Tg="2.1.8"),Tg}var Rg,jN;function I6(){return jN||(jN=1,Rg={Graph:Yw(),version:M6()}),Rg}var Ag,CN;function O6(){if(CN)return Ag;CN=1;var e=Fn(),t=Yw();Ag={write:n,read:a};function n(l){var u={options:{directed:l.isDirected(),multigraph:l.isMultigraph(),compound:l.isCompound()},nodes:s(l),edges:i(l)};return e.isUndefined(l.graph())||(u.value=e.clone(l.graph())),u}function s(l){return e.map(l.nodes(),function(u){var h=l.node(u),p=l.parent(u),f={v:u};return e.isUndefined(h)||(f.value=h),e.isUndefined(p)||(f.parent=p),f})}function i(l){return e.map(l.edges(),function(u){var h=l.edge(u),p={v:u.v,w:u.w};return e.isUndefined(u.name)||(p.name=u.name),e.isUndefined(h)||(p.value=h),p})}function a(l){var u=new t(l.options).setGraph(l.value);return e.each(l.nodes,function(h){u.setNode(h.v,h.value),h.parent&&u.setParent(h.v,h.parent)}),e.each(l.edges,function(h){u.setEdge({v:h.v,w:h.w,name:h.name},h.value)}),u}return Ag}var Mg,TN;function P6(){if(TN)return Mg;TN=1;var e=Fn();Mg=t;function t(n){var s={},i=[],a;function l(u){e.has(s,u)||(s[u]=!0,a.push(u),e.each(n.successors(u),l),e.each(n.predecessors(u),l))}return e.each(n.nodes(),function(u){a=[],l(u),a.length&&i.push(a)}),i}return Mg}var Ig,RN;function CR(){if(RN)return Ig;RN=1;var e=Fn();Ig=t;function t(){this._arr=[],this._keyIndices={}}return t.prototype.size=function(){return this._arr.length},t.prototype.keys=function(){return this._arr.map(function(n){return n.key})},t.prototype.has=function(n){return e.has(this._keyIndices,n)},t.prototype.priority=function(n){var s=this._keyIndices[n];if(s!==void 0)return this._arr[s].priority},t.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},t.prototype.add=function(n,s){var i=this._keyIndices;if(n=String(n),!e.has(i,n)){var a=this._arr,l=a.length;return i[n]=l,a.push({key:n,priority:s}),this._decrease(l),!0}return!1},t.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var n=this._arr.pop();return delete this._keyIndices[n.key],this._heapify(0),n.key},t.prototype.decrease=function(n,s){var i=this._keyIndices[n];if(s>this._arr[i].priority)throw new Error("New priority is greater than current priority. Key: "+n+" Old: "+this._arr[i].priority+" New: "+s);this._arr[i].priority=s,this._decrease(i)},t.prototype._heapify=function(n){var s=this._arr,i=2*n,a=i+1,l=n;i<s.length&&(l=s[i].priority<s[l].priority?i:l,a<s.length&&(l=s[a].priority<s[l].priority?a:l),l!==n&&(this._swap(n,l),this._heapify(l)))},t.prototype._decrease=function(n){for(var s=this._arr,i=s[n].priority,a;n!==0&&(a=n>>1,!(s[a].priority<i));)this._swap(n,a),n=a},t.prototype._swap=function(n,s){var i=this._arr,a=this._keyIndices,l=i[n],u=i[s];i[n]=u,i[s]=l,a[u.key]=n,a[l.key]=s},Ig}var Og,AN;function TR(){if(AN)return Og;AN=1;var e=Fn(),t=CR();Og=s;var n=e.constant(1);function s(a,l,u,h){return i(a,String(l),u||n,h||function(p){return a.outEdges(p)})}function i(a,l,u,h){var p={},f=new t,g,y,w=function(N){var b=N.v!==g?N.v:N.w,_=p[b],k=u(N),E=y.distance+k;if(k<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+N+" Weight: "+k);E<_.distance&&(_.distance=E,_.predecessor=g,f.decrease(b,E))};for(a.nodes().forEach(function(N){var b=N===l?0:Number.POSITIVE_INFINITY;p[N]={distance:b},f.add(N,b)});f.size()>0&&(g=f.removeMin(),y=p[g],y.distance!==Number.POSITIVE_INFINITY);)h(g).forEach(w);return p}return Og}var Pg,MN;function $6(){if(MN)return Pg;MN=1;var e=TR(),t=Fn();Pg=n;function n(s,i,a){return t.transform(s.nodes(),function(l,u){l[u]=e(s,u,i,a)},{})}return Pg}var $g,IN;function RR(){if(IN)return $g;IN=1;var e=Fn();$g=t;function t(n){var s=0,i=[],a={},l=[];function u(h){var p=a[h]={onStack:!0,lowlink:s,index:s++};if(i.push(h),n.successors(h).forEach(function(y){e.has(a,y)?a[y].onStack&&(p.lowlink=Math.min(p.lowlink,a[y].index)):(u(y),p.lowlink=Math.min(p.lowlink,a[y].lowlink))}),p.lowlink===p.index){var f=[],g;do g=i.pop(),a[g].onStack=!1,f.push(g);while(h!==g);l.push(f)}}return n.nodes().forEach(function(h){e.has(a,h)||u(h)}),l}return $g}var Lg,ON;function L6(){if(ON)return Lg;ON=1;var e=Fn(),t=RR();Lg=n;function n(s){return e.filter(t(s),function(i){return i.length>1||i.length===1&&s.hasEdge(i[0],i[0])})}return Lg}var qg,PN;function q6(){if(PN)return qg;PN=1;var e=Fn();qg=n;var t=e.constant(1);function n(i,a,l){return s(i,a||t,l||function(u){return i.outEdges(u)})}function s(i,a,l){var u={},h=i.nodes();return h.forEach(function(p){u[p]={},u[p][p]={distance:0},h.forEach(function(f){p!==f&&(u[p][f]={distance:Number.POSITIVE_INFINITY})}),l(p).forEach(function(f){var g=f.v===p?f.w:f.v,y=a(f);u[p][g]={distance:y,predecessor:p}})}),h.forEach(function(p){var f=u[p];h.forEach(function(g){var y=u[g];h.forEach(function(w){var N=y[p],b=f[w],_=y[w],k=N.distance+b.distance;k<_.distance&&(_.distance=k,_.predecessor=b.predecessor)})})}),u}return qg}var Dg,$N;function AR(){if($N)return Dg;$N=1;var e=Fn();Dg=t,t.CycleException=n;function t(s){var i={},a={},l=[];function u(h){if(e.has(a,h))throw new n;e.has(i,h)||(a[h]=!0,i[h]=!0,e.each(s.predecessors(h),u),delete a[h],l.push(h))}if(e.each(s.sinks(),u),e.size(i)!==s.nodeCount())throw new n;return l}function n(){}return n.prototype=new Error,Dg}var Fg,LN;function D6(){if(LN)return Fg;LN=1;var e=AR();Fg=t;function t(n){try{e(n)}catch(s){if(s instanceof e.CycleException)return!1;throw s}return!0}return Fg}var zg,qN;function MR(){if(qN)return zg;qN=1;var e=Fn();zg=t;function t(s,i,a){e.isArray(i)||(i=[i]);var l=(s.isDirected()?s.successors:s.neighbors).bind(s),u=[],h={};return e.each(i,function(p){if(!s.hasNode(p))throw new Error("Graph does not have node: "+p);n(s,p,a==="post",h,l,u)}),u}function n(s,i,a,l,u,h){e.has(l,i)||(l[i]=!0,a||h.push(i),e.each(u(i),function(p){n(s,p,a,l,u,h)}),a&&h.push(i))}return zg}var Bg,DN;function F6(){if(DN)return Bg;DN=1;var e=MR();Bg=t;function t(n,s){return e(n,s,"post")}return Bg}var Ug,FN;function z6(){if(FN)return Ug;FN=1;var e=MR();Ug=t;function t(n,s){return e(n,s,"pre")}return Ug}var Wg,zN;function B6(){if(zN)return Wg;zN=1;var e=Fn(),t=Yw(),n=CR();Wg=s;function s(i,a){var l=new t,u={},h=new n,p;function f(y){var w=y.v===p?y.w:y.v,N=h.priority(w);if(N!==void 0){var b=a(y);b<N&&(u[w]=p,h.decrease(w,b))}}if(i.nodeCount()===0)return l;e.each(i.nodes(),function(y){h.add(y,Number.POSITIVE_INFINITY),l.setNode(y)}),h.decrease(i.nodes()[0],0);for(var g=!1;h.size()>0;){if(p=h.removeMin(),e.has(u,p))l.setEdge(p,u[p]);else{if(g)throw new Error("Input graph is not connected: "+i);g=!0}i.nodeEdges(p).forEach(f)}return l}return Wg}var Hg,BN;function U6(){return BN||(BN=1,Hg={components:P6(),dijkstra:TR(),dijkstraAll:$6(),findCycles:L6(),floydWarshall:q6(),isAcyclic:D6(),postorder:F6(),preorder:z6(),prim:B6(),tarjan:RR(),topsort:AR()}),Hg}var Gg,UN;function W6(){if(UN)return Gg;UN=1;var e=I6();return Gg={Graph:e.Graph,json:O6(),alg:U6(),version:e.version},Gg}var Vg,WN;function cr(){if(WN)return Vg;WN=1;var e;if(typeof Mw=="function")try{e=W6()}catch{}return e||(e=window.graphlib),Vg=e,Vg}var Yg,HN;function H6(){if(HN)return Yg;HN=1;var e=rR(),t=1,n=4;function s(i){return e(i,t|n)}return Yg=s,Yg}var Kg,GN;function td(){if(GN)return Kg;GN=1;var e=Gi(),t=Zr(),n=Gu(),s=Dn();function i(a,l,u){if(!s(u))return!1;var h=typeof l;return(h=="number"?t(u)&&n(l,u.length):h=="string"&&l in u)?e(u[l],a):!1}return Kg=i,Kg}var Xg,VN;function G6(){if(VN)return Xg;VN=1;var e=ed(),t=Gi(),n=td(),s=No(),i=Object.prototype,a=i.hasOwnProperty,l=e(function(u,h){u=Object(u);var p=-1,f=h.length,g=f>2?h[2]:void 0;for(g&&n(h[0],h[1],g)&&(f=1);++p<f;)for(var y=h[p],w=s(y),N=-1,b=w.length;++N<b;){var _=w[N],k=u[_];(k===void 0||t(k,i[_])&&!a.call(u,_))&&(u[_]=y[_])}return u});return Xg=l,Xg}var Qg,YN;function V6(){if(YN)return Qg;YN=1;var e=Jr(),t=Zr(),n=Os();function s(i){return function(a,l,u){var h=Object(a);if(!t(a)){var p=e(l,3);a=n(a),l=function(g){return p(h[g],g,h)}}var f=i(a,l,u);return f>-1?h[p?a[f]:f]:void 0}}return Qg=s,Qg}var Zg,KN;function Y6(){if(KN)return Zg;KN=1;var e=/\s/;function t(n){for(var s=n.length;s--&&e.test(n.charAt(s)););return s}return Zg=t,Zg}var Jg,XN;function K6(){if(XN)return Jg;XN=1;var e=Y6(),t=/^\s+/;function n(s){return s&&s.slice(0,e(s)+1).replace(t,"")}return Jg=n,Jg}var ev,QN;function X6(){if(QN)return ev;QN=1;var e=K6(),t=Dn(),n=Xi(),s=NaN,i=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,l=/^0o[0-7]+$/i,u=parseInt;function h(p){if(typeof p=="number")return p;if(n(p))return s;if(t(p)){var f=typeof p.valueOf=="function"?p.valueOf():p;p=t(f)?f+"":f}if(typeof p!="string")return p===0?p:+p;p=e(p);var g=a.test(p);return g||l.test(p)?u(p.slice(2),g?2:8):i.test(p)?s:+p}return ev=h,ev}var tv,ZN;function IR(){if(ZN)return tv;ZN=1;var e=X6(),t=1/0,n=17976931348623157e292;function s(i){if(!i)return i===0?i:0;if(i=e(i),i===t||i===-t){var a=i<0?-1:1;return a*n}return i===i?i:0}return tv=s,tv}var nv,JN;function Q6(){if(JN)return nv;JN=1;var e=IR();function t(n){var s=e(n),i=s%1;return s===s?i?s-i:s:0}return nv=t,nv}var rv,eE;function Z6(){if(eE)return rv;eE=1;var e=NR(),t=Jr(),n=Q6(),s=Math.max;function i(a,l,u){var h=a==null?0:a.length;if(!h)return-1;var p=u==null?0:n(u);return p<0&&(p=s(h+p,0)),e(a,t(l,3),p)}return rv=i,rv}var sv,tE;function J6(){if(tE)return sv;tE=1;var e=V6(),t=Z6(),n=e(t);return sv=n,sv}var ov,nE;function OR(){if(nE)return ov;nE=1;var e=Vw();function t(n){var s=n==null?0:n.length;return s?e(n,1):[]}return ov=t,ov}var iv,rE;function ez(){if(rE)return iv;rE=1;var e=Uw(),t=sR(),n=No();function s(i,a){return i==null?i:e(i,t(a),n)}return iv=s,iv}var av,sE;function tz(){if(sE)return av;sE=1;function e(t){var n=t==null?0:t.length;return n?t[n-1]:void 0}return av=e,av}var lv,oE;function nz(){if(oE)return lv;oE=1;var e=Wu(),t=Ww(),n=Jr();function s(i,a){var l={};return a=n(a,3),t(i,function(u,h,p){e(l,h,a(u,h,p))}),l}return lv=s,lv}var cv,iE;function Kw(){if(iE)return cv;iE=1;var e=Xi();function t(n,s,i){for(var a=-1,l=n.length;++a<l;){var u=n[a],h=s(u);if(h!=null&&(p===void 0?h===h&&!e(h):i(h,p)))var p=h,f=u}return f}return cv=t,cv}var uv,aE;function rz(){if(aE)return uv;aE=1;function e(t,n){return t>n}return uv=e,uv}var dv,lE;function sz(){if(lE)return dv;lE=1;var e=Kw(),t=rz(),n=Eo();function s(i){return i&&i.length?e(i,n,t):void 0}return dv=s,dv}var fv,cE;function PR(){if(cE)return fv;cE=1;var e=Wu(),t=Gi();function n(s,i,a){(a!==void 0&&!t(s[i],a)||a===void 0&&!(i in s))&&e(s,i,a)}return fv=n,fv}var hv,uE;function oz(){if(uE)return hv;uE=1;var e=ko(),t=Ku(),n=jr(),s="[object Object]",i=Function.prototype,a=Object.prototype,l=i.toString,u=a.hasOwnProperty,h=l.call(Object);function p(f){if(!n(f)||e(f)!=s)return!1;var g=t(f);if(g===null)return!0;var y=u.call(g,"constructor")&&g.constructor;return typeof y=="function"&&y instanceof y&&l.call(y)==h}return hv=p,hv}var pv,dE;function $R(){if(dE)return pv;dE=1;function e(t,n){if(!(n==="constructor"&&typeof t[n]=="function")&&n!="__proto__")return t[n]}return pv=e,pv}var mv,fE;function iz(){if(fE)return mv;fE=1;var e=kl(),t=No();function n(s){return e(s,t(s))}return mv=n,mv}var gv,hE;function az(){if(hE)return gv;hE=1;var e=PR(),t=HT(),n=eR(),s=GT(),i=nR(),a=Sl(),l=At(),u=ER(),h=Yi(),p=_l(),f=Dn(),g=oz(),y=Nl(),w=$R(),N=iz();function b(_,k,E,j,C,I,P){var O=w(_,E),F=w(k,E),M=P.get(F);if(M){e(_,E,M);return}var A=I?I(O,F,E+"",_,k,P):void 0,q=A===void 0;if(q){var W=l(F),K=!W&&h(F),T=!W&&!K&&y(F);A=F,W||K||T?l(O)?A=O:u(O)?A=s(O):K?(q=!1,A=t(F,!0)):T?(q=!1,A=n(F,!0)):A=[]:g(F)||a(F)?(A=O,a(O)?A=N(O):(!f(O)||p(O))&&(A=i(F))):q=!1}q&&(P.set(F,A),C(A,F,j,I,P),P.delete(F)),e(_,E,A)}return gv=b,gv}var vv,pE;function lz(){if(pE)return vv;pE=1;var e=Uu(),t=PR(),n=Uw(),s=az(),i=Dn(),a=No(),l=$R();function u(h,p,f,g,y){h!==p&&n(p,function(w,N){if(y||(y=new e),i(w))s(h,p,N,f,u,g,y);else{var b=g?g(l(h,N),w,N+"",h,p,y):void 0;b===void 0&&(b=w),t(h,N,b)}},a)}return vv=u,vv}var yv,mE;function cz(){if(mE)return yv;mE=1;var e=ed(),t=td();function n(s){return e(function(i,a){var l=-1,u=a.length,h=u>1?a[u-1]:void 0,p=u>2?a[2]:void 0;for(h=s.length>3&&typeof h=="function"?(u--,h):void 0,p&&t(a[0],a[1],p)&&(h=u<3?void 0:h,u=1),i=Object(i);++l<u;){var f=a[l];f&&s(i,f,l,h)}return i})}return yv=n,yv}var wv,gE;function uz(){if(gE)return wv;gE=1;var e=lz(),t=cz(),n=t(function(s,i,a){e(s,i,a)});return wv=n,wv}var xv,vE;function LR(){if(vE)return xv;vE=1;function e(t,n){return t<n}return xv=e,xv}var bv,yE;function dz(){if(yE)return bv;yE=1;var e=Kw(),t=LR(),n=Eo();function s(i){return i&&i.length?e(i,n,t):void 0}return bv=s,bv}var _v,wE;function fz(){if(wE)return _v;wE=1;var e=Kw(),t=Jr(),n=LR();function s(i,a){return i&&i.length?e(i,t(a,2),n):void 0}return _v=s,_v}var kv,xE;function hz(){if(xE)return kv;xE=1;var e=dr(),t=function(){return e.Date.now()};return kv=t,kv}var Sv,bE;function pz(){if(bE)return Sv;bE=1;var e=Hu(),t=Zu(),n=Gu(),s=Dn(),i=El();function a(l,u,h,p){if(!s(l))return l;u=t(u,l);for(var f=-1,g=u.length,y=g-1,w=l;w!=null&&++f<g;){var N=i(u[f]),b=h;if(N==="__proto__"||N==="constructor"||N==="prototype")return l;if(f!=y){var _=w[N];b=p?p(_,N,w):void 0,b===void 0&&(b=s(_)?_:n(u[f+1])?[]:{})}e(w,N,b),w=w[N]}return l}return Sv=a,Sv}var Nv,_E;function mz(){if(_E)return Nv;_E=1;var e=Ju(),t=pz(),n=Zu();function s(i,a,l){for(var u=-1,h=a.length,p={};++u<h;){var f=a[u],g=e(i,f);l(g,f)&&t(p,n(f,i),g)}return p}return Nv=s,Nv}var Ev,kE;function gz(){if(kE)return Ev;kE=1;var e=mz(),t=mR();function n(s,i){return e(s,i,function(a,l){return t(s,l)})}return Ev=n,Ev}var jv,SE;function vz(){if(SE)return jv;SE=1;var e=OR(),t=kR(),n=SR();function s(i){return n(t(i,void 0,e),i+"")}return jv=s,jv}var Cv,NE;function yz(){if(NE)return Cv;NE=1;var e=gz(),t=vz(),n=t(function(s,i){return s==null?{}:e(s,i)});return Cv=n,Cv}var Tv,EE;function wz(){if(EE)return Tv;EE=1;var e=Math.ceil,t=Math.max;function n(s,i,a,l){for(var u=-1,h=t(e((i-s)/(a||1)),0),p=Array(h);h--;)p[l?h:++u]=s,s+=a;return p}return Tv=n,Tv}var Rv,jE;function xz(){if(jE)return Rv;jE=1;var e=wz(),t=td(),n=IR();function s(i){return function(a,l,u){return u&&typeof u!="number"&&t(a,l,u)&&(l=u=void 0),a=n(a),l===void 0?(l=a,a=0):l=n(l),u=u===void 0?a<l?1:-1:n(u),e(a,l,u,i)}}return Rv=s,Rv}var Av,CE;function bz(){if(CE)return Av;CE=1;var e=xz(),t=e();return Av=t,Av}var Mv,TE;function _z(){if(TE)return Mv;TE=1;function e(t,n){var s=t.length;for(t.sort(n);s--;)t[s]=t[s].value;return t}return Mv=e,Mv}var Iv,RE;function kz(){if(RE)return Iv;RE=1;var e=Xi();function t(n,s){if(n!==s){var i=n!==void 0,a=n===null,l=n===n,u=e(n),h=s!==void 0,p=s===null,f=s===s,g=e(s);if(!p&&!g&&!u&&n>s||u&&h&&f&&!p&&!g||a&&h&&f||!i&&f||!l)return 1;if(!a&&!u&&!g&&n<s||g&&i&&l&&!a&&!u||p&&i&&l||!h&&l||!f)return-1}return 0}return Iv=t,Iv}var Ov,AE;function Sz(){if(AE)return Ov;AE=1;var e=kz();function t(n,s,i){for(var a=-1,l=n.criteria,u=s.criteria,h=l.length,p=i.length;++a<h;){var f=e(l[a],u[a]);if(f){if(a>=p)return f;var g=i[a];return f*(g=="desc"?-1:1)}}return n.index-s.index}return Ov=t,Ov}var Pv,ME;function Nz(){if(ME)return Pv;ME=1;var e=Qu(),t=Ju(),n=Jr(),s=xR(),i=_z(),a=Vu(),l=Sz(),u=Eo(),h=At();function p(f,g,y){g.length?g=e(g,function(b){return h(b)?function(_){return t(_,b.length===1?b[0]:b)}:b}):g=[u];var w=-1;g=e(g,a(n));var N=s(f,function(b,_,k){var E=e(g,function(j){return j(b)});return{criteria:E,index:++w,value:b}});return i(N,function(b,_){return l(b,_,y)})}return Pv=p,Pv}var $v,IE;function Ez(){if(IE)return $v;IE=1;var e=Vw(),t=Nz(),n=ed(),s=td(),i=n(function(a,l){if(a==null)return[];var u=l.length;return u>1&&s(a,l[0],l[1])?l=[]:u>2&&s(l[0],l[1],l[2])&&(l=[l[0]]),t(a,e(l,1),[])});return $v=i,$v}var Lv,OE;function jz(){if(OE)return Lv;OE=1;var e=hR(),t=0;function n(s){var i=++t;return e(s)+i}return Lv=n,Lv}var qv,PE;function Cz(){if(PE)return qv;PE=1;function e(t,n,s){for(var i=-1,a=t.length,l=n.length,u={};++i<a;){var h=i<l?n[i]:void 0;s(u,t[i],h)}return u}return qv=e,qv}var Dv,$E;function Tz(){if($E)return Dv;$E=1;var e=Hu(),t=Cz();function n(s,i){return t(s||[],i||[],e)}return Dv=n,Dv}var Fv,LE;function wt(){if(LE)return Fv;LE=1;var e;if(typeof Mw=="function")try{e={cloneDeep:H6(),constant:Bw(),defaults:G6(),each:iR(),filter:vR(),find:J6(),flatten:OR(),forEach:oR(),forIn:ez(),has:yR(),isUndefined:wR(),last:tz(),map:bR(),mapValues:nz(),max:sz(),merge:uz(),min:dz(),minBy:fz(),now:hz(),pick:yz(),range:bz(),reduce:_R(),sortBy:Ez(),uniqueId:jz(),values:jR(),zipObject:Tz()}}catch{}return e||(e=window._),Fv=e,Fv}var zv,qE;function Rz(){if(qE)return zv;qE=1,zv=e;function e(){var s={};s._next=s._prev=s,this._sentinel=s}e.prototype.dequeue=function(){var s=this._sentinel,i=s._prev;if(i!==s)return t(i),i},e.prototype.enqueue=function(s){var i=this._sentinel;s._prev&&s._next&&t(s),s._next=i._next,i._next._prev=s,i._next=s,s._prev=i},e.prototype.toString=function(){for(var s=[],i=this._sentinel,a=i._prev;a!==i;)s.push(JSON.stringify(a,n)),a=a._prev;return"["+s.join(", ")+"]"};function t(s){s._prev._next=s._next,s._next._prev=s._prev,delete s._next,delete s._prev}function n(s,i){if(s!=="_next"&&s!=="_prev")return i}return zv}var Bv,DE;function Az(){if(DE)return Bv;DE=1;var e=wt(),t=cr().Graph,n=Rz();Bv=i;var s=e.constant(1);function i(p,f){if(p.nodeCount()<=1)return[];var g=u(p,f||s),y=a(g.graph,g.buckets,g.zeroIdx);return e.flatten(e.map(y,function(w){return p.outEdges(w.v,w.w)}),!0)}function a(p,f,g){for(var y=[],w=f[f.length-1],N=f[0],b;p.nodeCount();){for(;b=N.dequeue();)l(p,f,g,b);for(;b=w.dequeue();)l(p,f,g,b);if(p.nodeCount()){for(var _=f.length-2;_>0;--_)if(b=f[_].dequeue(),b){y=y.concat(l(p,f,g,b,!0));break}}}return y}function l(p,f,g,y,w){var N=w?[]:void 0;return e.forEach(p.inEdges(y.v),function(b){var _=p.edge(b),k=p.node(b.v);w&&N.push({v:b.v,w:b.w}),k.out-=_,h(f,g,k)}),e.forEach(p.outEdges(y.v),function(b){var _=p.edge(b),k=b.w,E=p.node(k);E.in-=_,h(f,g,E)}),p.removeNode(y.v),N}function u(p,f){var g=new t,y=0,w=0;e.forEach(p.nodes(),function(_){g.setNode(_,{v:_,in:0,out:0})}),e.forEach(p.edges(),function(_){var k=g.edge(_.v,_.w)||0,E=f(_),j=k+E;g.setEdge(_.v,_.w,j),w=Math.max(w,g.node(_.v).out+=E),y=Math.max(y,g.node(_.w).in+=E)});var N=e.range(w+y+3).map(function(){return new n}),b=y+1;return e.forEach(g.nodes(),function(_){h(N,b,g.node(_))}),{graph:g,buckets:N,zeroIdx:b}}function h(p,f,g){g.out?g.in?p[g.out-g.in+f].enqueue(g):p[p.length-1].enqueue(g):p[0].enqueue(g)}return Bv}var Uv,FE;function Mz(){if(FE)return Uv;FE=1;var e=wt(),t=Az();Uv={run:n,undo:i};function n(a){var l=a.graph().acyclicer==="greedy"?t(a,u(a)):s(a);e.forEach(l,function(h){var p=a.edge(h);a.removeEdge(h),p.forwardName=h.name,p.reversed=!0,a.setEdge(h.w,h.v,p,e.uniqueId("rev"))});function u(h){return function(p){return h.edge(p).weight}}}function s(a){var l=[],u={},h={};function p(f){e.has(h,f)||(h[f]=!0,u[f]=!0,e.forEach(a.outEdges(f),function(g){e.has(u,g.w)?l.push(g):p(g.w)}),delete u[f])}return e.forEach(a.nodes(),p),l}function i(a){e.forEach(a.edges(),function(l){var u=a.edge(l);if(u.reversed){a.removeEdge(l);var h=u.forwardName;delete u.reversed,delete u.forwardName,a.setEdge(l.w,l.v,u,h)}})}return Uv}var Wv,zE;function pn(){if(zE)return Wv;zE=1;var e=wt(),t=cr().Graph;Wv={addDummyNode:n,simplify:s,asNonCompoundGraph:i,successorWeights:a,predecessorWeights:l,intersectRect:u,buildLayerMatrix:h,normalizeRanks:p,removeEmptyRanks:f,addBorderNode:g,maxRank:y,partition:w,time:N,notime:b};function n(_,k,E,j){var C;do C=e.uniqueId(j);while(_.hasNode(C));return E.dummy=k,_.setNode(C,E),C}function s(_){var k=new t().setGraph(_.graph());return e.forEach(_.nodes(),function(E){k.setNode(E,_.node(E))}),e.forEach(_.edges(),function(E){var j=k.edge(E.v,E.w)||{weight:0,minlen:1},C=_.edge(E);k.setEdge(E.v,E.w,{weight:j.weight+C.weight,minlen:Math.max(j.minlen,C.minlen)})}),k}function i(_){var k=new t({multigraph:_.isMultigraph()}).setGraph(_.graph());return e.forEach(_.nodes(),function(E){_.children(E).length||k.setNode(E,_.node(E))}),e.forEach(_.edges(),function(E){k.setEdge(E,_.edge(E))}),k}function a(_){var k=e.map(_.nodes(),function(E){var j={};return e.forEach(_.outEdges(E),function(C){j[C.w]=(j[C.w]||0)+_.edge(C).weight}),j});return e.zipObject(_.nodes(),k)}function l(_){var k=e.map(_.nodes(),function(E){var j={};return e.forEach(_.inEdges(E),function(C){j[C.v]=(j[C.v]||0)+_.edge(C).weight}),j});return e.zipObject(_.nodes(),k)}function u(_,k){var E=_.x,j=_.y,C=k.x-E,I=k.y-j,P=_.width/2,O=_.height/2;if(!C&&!I)throw new Error("Not possible to find intersection inside of the rectangle");var F,M;return Math.abs(I)*P>Math.abs(C)*O?(I<0&&(O=-O),F=O*C/I,M=O):(C<0&&(P=-P),F=P,M=P*I/C),{x:E+F,y:j+M}}function h(_){var k=e.map(e.range(y(_)+1),function(){return[]});return e.forEach(_.nodes(),function(E){var j=_.node(E),C=j.rank;e.isUndefined(C)||(k[C][j.order]=E)}),k}function p(_){var k=e.min(e.map(_.nodes(),function(E){return _.node(E).rank}));e.forEach(_.nodes(),function(E){var j=_.node(E);e.has(j,"rank")&&(j.rank-=k)})}function f(_){var k=e.min(e.map(_.nodes(),function(I){return _.node(I).rank})),E=[];e.forEach(_.nodes(),function(I){var P=_.node(I).rank-k;E[P]||(E[P]=[]),E[P].push(I)});var j=0,C=_.graph().nodeRankFactor;e.forEach(E,function(I,P){e.isUndefined(I)&&P%C!==0?--j:j&&e.forEach(I,function(O){_.node(O).rank+=j})})}function g(_,k,E,j){var C={width:0,height:0};return arguments.length>=4&&(C.rank=E,C.order=j),n(_,"border",C,k)}function y(_){return e.max(e.map(_.nodes(),function(k){var E=_.node(k).rank;if(!e.isUndefined(E))return E}))}function w(_,k){var E={lhs:[],rhs:[]};return e.forEach(_,function(j){k(j)?E.lhs.push(j):E.rhs.push(j)}),E}function N(_,k){var E=e.now();try{return k()}finally{console.log(_+" time: "+(e.now()-E)+"ms")}}function b(_,k){return k()}return Wv}var Hv,BE;function Iz(){if(BE)return Hv;BE=1;var e=wt(),t=pn();Hv={run:n,undo:i};function n(a){a.graph().dummyChains=[],e.forEach(a.edges(),function(l){s(a,l)})}function s(a,l){var u=l.v,h=a.node(u).rank,p=l.w,f=a.node(p).rank,g=l.name,y=a.edge(l),w=y.labelRank;if(f!==h+1){a.removeEdge(l);var N,b,_;for(_=0,++h;h<f;++_,++h)y.points=[],b={width:0,height:0,edgeLabel:y,edgeObj:l,rank:h},N=t.addDummyNode(a,"edge",b,"_d"),h===w&&(b.width=y.width,b.height=y.height,b.dummy="edge-label",b.labelpos=y.labelpos),a.setEdge(u,N,{weight:y.weight},g),_===0&&a.graph().dummyChains.push(N),u=N;a.setEdge(u,p,{weight:y.weight},g)}}function i(a){e.forEach(a.graph().dummyChains,function(l){var u=a.node(l),h=u.edgeLabel,p;for(a.setEdge(u.edgeObj,h);u.dummy;)p=a.successors(l)[0],a.removeNode(l),h.points.push({x:u.x,y:u.y}),u.dummy==="edge-label"&&(h.x=u.x,h.y=u.y,h.width=u.width,h.height=u.height),l=p,u=a.node(l)})}return Hv}var Gv,UE;function Nu(){if(UE)return Gv;UE=1;var e=wt();Gv={longestPath:t,slack:n};function t(s){var i={};function a(l){var u=s.node(l);if(e.has(i,l))return u.rank;i[l]=!0;var h=e.min(e.map(s.outEdges(l),function(p){return a(p.w)-s.edge(p).minlen}));return(h===Number.POSITIVE_INFINITY||h===void 0||h===null)&&(h=0),u.rank=h}e.forEach(s.sources(),a)}function n(s,i){return s.node(i.w).rank-s.node(i.v).rank-s.edge(i).minlen}return Gv}var Vv,WE;function qR(){if(WE)return Vv;WE=1;var e=wt(),t=cr().Graph,n=Nu().slack;Vv=s;function s(u){var h=new t({directed:!1}),p=u.nodes()[0],f=u.nodeCount();h.setNode(p,{});for(var g,y;i(h,u)<f;)g=a(h,u),y=h.hasNode(g.v)?n(u,g):-n(u,g),l(h,u,y);return h}function i(u,h){function p(f){e.forEach(h.nodeEdges(f),function(g){var y=g.v,w=f===y?g.w:y;!u.hasNode(w)&&!n(h,g)&&(u.setNode(w,{}),u.setEdge(f,w,{}),p(w))})}return e.forEach(u.nodes(),p),u.nodeCount()}function a(u,h){return e.minBy(h.edges(),function(p){if(u.hasNode(p.v)!==u.hasNode(p.w))return n(h,p)})}function l(u,h,p){e.forEach(u.nodes(),function(f){h.node(f).rank+=p})}return Vv}var Yv,HE;function Oz(){if(HE)return Yv;HE=1;var e=wt(),t=qR(),n=Nu().slack,s=Nu().longestPath,i=cr().alg.preorder,a=cr().alg.postorder,l=pn().simplify;Yv=u,u.initLowLimValues=g,u.initCutValues=h,u.calcCutValue=f,u.leaveEdge=w,u.enterEdge=N,u.exchangeEdges=b;function u(j){j=l(j),s(j);var C=t(j);g(C),h(C,j);for(var I,P;I=w(C);)P=N(C,j,I),b(C,j,I,P)}function h(j,C){var I=a(j,j.nodes());I=I.slice(0,I.length-1),e.forEach(I,function(P){p(j,C,P)})}function p(j,C,I){var P=j.node(I),O=P.parent;j.edge(I,O).cutvalue=f(j,C,I)}function f(j,C,I){var P=j.node(I),O=P.parent,F=!0,M=C.edge(I,O),A=0;return M||(F=!1,M=C.edge(O,I)),A=M.weight,e.forEach(C.nodeEdges(I),function(q){var W=q.v===I,K=W?q.w:q.v;if(K!==O){var T=W===F,Z=C.edge(q).weight;if(A+=T?Z:-Z,k(j,I,K)){var U=j.edge(I,K).cutvalue;A+=T?-U:U}}}),A}function g(j,C){arguments.length<2&&(C=j.nodes()[0]),y(j,{},1,C)}function y(j,C,I,P,O){var F=I,M=j.node(P);return C[P]=!0,e.forEach(j.neighbors(P),function(A){e.has(C,A)||(I=y(j,C,I,A,P))}),M.low=F,M.lim=I++,O?M.parent=O:delete M.parent,I}function w(j){return e.find(j.edges(),function(C){return j.edge(C).cutvalue<0})}function N(j,C,I){var P=I.v,O=I.w;C.hasEdge(P,O)||(P=I.w,O=I.v);var F=j.node(P),M=j.node(O),A=F,q=!1;F.lim>M.lim&&(A=M,q=!0);var W=e.filter(C.edges(),function(K){return q===E(j,j.node(K.v),A)&&q!==E(j,j.node(K.w),A)});return e.minBy(W,function(K){return n(C,K)})}function b(j,C,I,P){var O=I.v,F=I.w;j.removeEdge(O,F),j.setEdge(P.v,P.w,{}),g(j),h(j,C),_(j,C)}function _(j,C){var I=e.find(j.nodes(),function(O){return!C.node(O).parent}),P=i(j,I);P=P.slice(1),e.forEach(P,function(O){var F=j.node(O).parent,M=C.edge(O,F),A=!1;M||(M=C.edge(F,O),A=!0),C.node(O).rank=C.node(F).rank+(A?M.minlen:-M.minlen)})}function k(j,C,I){return j.hasEdge(C,I)}function E(j,C,I){return I.low<=C.lim&&C.lim<=I.lim}return Yv}var Kv,GE;function Pz(){if(GE)return Kv;GE=1;var e=Nu(),t=e.longestPath,n=qR(),s=Oz();Kv=i;function i(h){switch(h.graph().ranker){case"network-simplex":u(h);break;case"tight-tree":l(h);break;case"longest-path":a(h);break;default:u(h)}}var a=t;function l(h){t(h),n(h)}function u(h){s(h)}return Kv}var Xv,VE;function $z(){if(VE)return Xv;VE=1;var e=wt();Xv=t;function t(i){var a=s(i);e.forEach(i.graph().dummyChains,function(l){for(var u=i.node(l),h=u.edgeObj,p=n(i,a,h.v,h.w),f=p.path,g=p.lca,y=0,w=f[y],N=!0;l!==h.w;){if(u=i.node(l),N){for(;(w=f[y])!==g&&i.node(w).maxRank<u.rank;)y++;w===g&&(N=!1)}if(!N){for(;y<f.length-1&&i.node(w=f[y+1]).minRank<=u.rank;)y++;w=f[y]}i.setParent(l,w),l=i.successors(l)[0]}})}function n(i,a,l,u){var h=[],p=[],f=Math.min(a[l].low,a[u].low),g=Math.max(a[l].lim,a[u].lim),y,w;y=l;do y=i.parent(y),h.push(y);while(y&&(a[y].low>f||g>a[y].lim));for(w=y,y=u;(y=i.parent(y))!==w;)p.push(y);return{path:h.concat(p.reverse()),lca:w}}function s(i){var a={},l=0;function u(h){var p=l;e.forEach(i.children(h),u),a[h]={low:p,lim:l++}}return e.forEach(i.children(),u),a}return Xv}var Qv,YE;function Lz(){if(YE)return Qv;YE=1;var e=wt(),t=pn();Qv={run:n,cleanup:l};function n(u){var h=t.addDummyNode(u,"root",{},"_root"),p=i(u),f=e.max(e.values(p))-1,g=2*f+1;u.graph().nestingRoot=h,e.forEach(u.edges(),function(w){u.edge(w).minlen*=g});var y=a(u)+1;e.forEach(u.children(),function(w){s(u,h,g,y,f,p,w)}),u.graph().nodeRankFactor=g}function s(u,h,p,f,g,y,w){var N=u.children(w);if(!N.length){w!==h&&u.setEdge(h,w,{weight:0,minlen:p});return}var b=t.addBorderNode(u,"_bt"),_=t.addBorderNode(u,"_bb"),k=u.node(w);u.setParent(b,w),k.borderTop=b,u.setParent(_,w),k.borderBottom=_,e.forEach(N,function(E){s(u,h,p,f,g,y,E);var j=u.node(E),C=j.borderTop?j.borderTop:E,I=j.borderBottom?j.borderBottom:E,P=j.borderTop?f:2*f,O=C!==I?1:g-y[w]+1;u.setEdge(b,C,{weight:P,minlen:O,nestingEdge:!0}),u.setEdge(I,_,{weight:P,minlen:O,nestingEdge:!0})}),u.parent(w)||u.setEdge(h,b,{weight:0,minlen:g+y[w]})}function i(u){var h={};function p(f,g){var y=u.children(f);y&&y.length&&e.forEach(y,function(w){p(w,g+1)}),h[f]=g}return e.forEach(u.children(),function(f){p(f,1)}),h}function a(u){return e.reduce(u.edges(),function(h,p){return h+u.edge(p).weight},0)}function l(u){var h=u.graph();u.removeNode(h.nestingRoot),delete h.nestingRoot,e.forEach(u.edges(),function(p){var f=u.edge(p);f.nestingEdge&&u.removeEdge(p)})}return Qv}var Zv,KE;function qz(){if(KE)return Zv;KE=1;var e=wt(),t=pn();Zv=n;function n(i){function a(l){var u=i.children(l),h=i.node(l);if(u.length&&e.forEach(u,a),e.has(h,"minRank")){h.borderLeft=[],h.borderRight=[];for(var p=h.minRank,f=h.maxRank+1;p<f;++p)s(i,"borderLeft","_bl",l,h,p),s(i,"borderRight","_br",l,h,p)}}e.forEach(i.children(),a)}function s(i,a,l,u,h,p){var f={width:0,height:0,rank:p,borderType:a},g=h[a][p-1],y=t.addDummyNode(i,"border",f,l);h[a][p]=y,i.setParent(y,u),g&&i.setEdge(g,y,{weight:1})}return Zv}var Jv,XE;function Dz(){if(XE)return Jv;XE=1;var e=wt();Jv={adjust:t,undo:n};function t(p){var f=p.graph().rankdir.toLowerCase();(f==="lr"||f==="rl")&&s(p)}function n(p){var f=p.graph().rankdir.toLowerCase();(f==="bt"||f==="rl")&&a(p),(f==="lr"||f==="rl")&&(u(p),s(p))}function s(p){e.forEach(p.nodes(),function(f){i(p.node(f))}),e.forEach(p.edges(),function(f){i(p.edge(f))})}function i(p){var f=p.width;p.width=p.height,p.height=f}function a(p){e.forEach(p.nodes(),function(f){l(p.node(f))}),e.forEach(p.edges(),function(f){var g=p.edge(f);e.forEach(g.points,l),e.has(g,"y")&&l(g)})}function l(p){p.y=-p.y}function u(p){e.forEach(p.nodes(),function(f){h(p.node(f))}),e.forEach(p.edges(),function(f){var g=p.edge(f);e.forEach(g.points,h),e.has(g,"x")&&h(g)})}function h(p){var f=p.x;p.x=p.y,p.y=f}return Jv}var ey,QE;function Fz(){if(QE)return ey;QE=1;var e=wt();ey=t;function t(n){var s={},i=e.filter(n.nodes(),function(p){return!n.children(p).length}),a=e.max(e.map(i,function(p){return n.node(p).rank})),l=e.map(e.range(a+1),function(){return[]});function u(p){if(!e.has(s,p)){s[p]=!0;var f=n.node(p);l[f.rank].push(p),e.forEach(n.successors(p),u)}}var h=e.sortBy(i,function(p){return n.node(p).rank});return e.forEach(h,u),l}return ey}var ty,ZE;function zz(){if(ZE)return ty;ZE=1;var e=wt();ty=t;function t(s,i){for(var a=0,l=1;l<i.length;++l)a+=n(s,i[l-1],i[l]);return a}function n(s,i,a){for(var l=e.zipObject(a,e.map(a,function(y,w){return w})),u=e.flatten(e.map(i,function(y){return e.sortBy(e.map(s.outEdges(y),function(w){return{pos:l[w.w],weight:s.edge(w).weight}}),"pos")}),!0),h=1;h<a.length;)h<<=1;var p=2*h-1;h-=1;var f=e.map(new Array(p),function(){return 0}),g=0;return e.forEach(u.forEach(function(y){var w=y.pos+h;f[w]+=y.weight;for(var N=0;w>0;)w%2&&(N+=f[w+1]),w=w-1>>1,f[w]+=y.weight;g+=y.weight*N})),g}return ty}var ny,JE;function Bz(){if(JE)return ny;JE=1;var e=wt();ny=t;function t(n,s){return e.map(s,function(i){var a=n.inEdges(i);if(a.length){var l=e.reduce(a,function(u,h){var p=n.edge(h),f=n.node(h.v);return{sum:u.sum+p.weight*f.order,weight:u.weight+p.weight}},{sum:0,weight:0});return{v:i,barycenter:l.sum/l.weight,weight:l.weight}}else return{v:i}})}return ny}var ry,ej;function Uz(){if(ej)return ry;ej=1;var e=wt();ry=t;function t(i,a){var l={};e.forEach(i,function(h,p){var f=l[h.v]={indegree:0,in:[],out:[],vs:[h.v],i:p};e.isUndefined(h.barycenter)||(f.barycenter=h.barycenter,f.weight=h.weight)}),e.forEach(a.edges(),function(h){var p=l[h.v],f=l[h.w];!e.isUndefined(p)&&!e.isUndefined(f)&&(f.indegree++,p.out.push(l[h.w]))});var u=e.filter(l,function(h){return!h.indegree});return n(u)}function n(i){var a=[];function l(p){return function(f){f.merged||(e.isUndefined(f.barycenter)||e.isUndefined(p.barycenter)||f.barycenter>=p.barycenter)&&s(p,f)}}function u(p){return function(f){f.in.push(p),--f.indegree===0&&i.push(f)}}for(;i.length;){var h=i.pop();a.push(h),e.forEach(h.in.reverse(),l(h)),e.forEach(h.out,u(h))}return e.map(e.filter(a,function(p){return!p.merged}),function(p){return e.pick(p,["vs","i","barycenter","weight"])})}function s(i,a){var l=0,u=0;i.weight&&(l+=i.barycenter*i.weight,u+=i.weight),a.weight&&(l+=a.barycenter*a.weight,u+=a.weight),i.vs=a.vs.concat(i.vs),i.barycenter=l/u,i.weight=u,i.i=Math.min(a.i,i.i),a.merged=!0}return ry}var sy,tj;function Wz(){if(tj)return sy;tj=1;var e=wt(),t=pn();sy=n;function n(a,l){var u=t.partition(a,function(b){return e.has(b,"barycenter")}),h=u.lhs,p=e.sortBy(u.rhs,function(b){return-b.i}),f=[],g=0,y=0,w=0;h.sort(i(!!l)),w=s(f,p,w),e.forEach(h,function(b){w+=b.vs.length,f.push(b.vs),g+=b.barycenter*b.weight,y+=b.weight,w=s(f,p,w)});var N={vs:e.flatten(f,!0)};return y&&(N.barycenter=g/y,N.weight=y),N}function s(a,l,u){for(var h;l.length&&(h=e.last(l)).i<=u;)l.pop(),a.push(h.vs),u++;return u}function i(a){return function(l,u){return l.barycenter<u.barycenter?-1:l.barycenter>u.barycenter?1:a?u.i-l.i:l.i-u.i}}return sy}var oy,nj;function Hz(){if(nj)return oy;nj=1;var e=wt(),t=Bz(),n=Uz(),s=Wz();oy=i;function i(u,h,p,f){var g=u.children(h),y=u.node(h),w=y?y.borderLeft:void 0,N=y?y.borderRight:void 0,b={};w&&(g=e.filter(g,function(I){return I!==w&&I!==N}));var _=t(u,g);e.forEach(_,function(I){if(u.children(I.v).length){var P=i(u,I.v,p,f);b[I.v]=P,e.has(P,"barycenter")&&l(I,P)}});var k=n(_,p);a(k,b);var E=s(k,f);if(w&&(E.vs=e.flatten([w,E.vs,N],!0),u.predecessors(w).length)){var j=u.node(u.predecessors(w)[0]),C=u.node(u.predecessors(N)[0]);e.has(E,"barycenter")||(E.barycenter=0,E.weight=0),E.barycenter=(E.barycenter*E.weight+j.order+C.order)/(E.weight+2),E.weight+=2}return E}function a(u,h){e.forEach(u,function(p){p.vs=e.flatten(p.vs.map(function(f){return h[f]?h[f].vs:f}),!0)})}function l(u,h){e.isUndefined(u.barycenter)?(u.barycenter=h.barycenter,u.weight=h.weight):(u.barycenter=(u.barycenter*u.weight+h.barycenter*h.weight)/(u.weight+h.weight),u.weight+=h.weight)}return oy}var iy,rj;function Gz(){if(rj)return iy;rj=1;var e=wt(),t=cr().Graph;iy=n;function n(i,a,l){var u=s(i),h=new t({compound:!0}).setGraph({root:u}).setDefaultNodeLabel(function(p){return i.node(p)});return e.forEach(i.nodes(),function(p){var f=i.node(p),g=i.parent(p);(f.rank===a||f.minRank<=a&&a<=f.maxRank)&&(h.setNode(p),h.setParent(p,g||u),e.forEach(i[l](p),function(y){var w=y.v===p?y.w:y.v,N=h.edge(w,p),b=e.isUndefined(N)?0:N.weight;h.setEdge(w,p,{weight:i.edge(y).weight+b})}),e.has(f,"minRank")&&h.setNode(p,{borderLeft:f.borderLeft[a],borderRight:f.borderRight[a]}))}),h}function s(i){for(var a;i.hasNode(a=e.uniqueId("_root")););return a}return iy}var ay,sj;function Vz(){if(sj)return ay;sj=1;var e=wt();ay=t;function t(n,s,i){var a={},l;e.forEach(i,function(u){for(var h=n.parent(u),p,f;h;){if(p=n.parent(h),p?(f=a[p],a[p]=h):(f=l,l=h),f&&f!==h){s.setEdge(f,h);return}h=p}})}return ay}var ly,oj;function Yz(){if(oj)return ly;oj=1;var e=wt(),t=Fz(),n=zz(),s=Hz(),i=Gz(),a=Vz(),l=cr().Graph,u=pn();ly=h;function h(y){var w=u.maxRank(y),N=p(y,e.range(1,w+1),"inEdges"),b=p(y,e.range(w-1,-1,-1),"outEdges"),_=t(y);g(y,_);for(var k=Number.POSITIVE_INFINITY,E,j=0,C=0;C<4;++j,++C){f(j%2?N:b,j%4>=2),_=u.buildLayerMatrix(y);var I=n(y,_);I<k&&(C=0,E=e.cloneDeep(_),k=I)}g(y,E)}function p(y,w,N){return e.map(w,function(b){return i(y,b,N)})}function f(y,w){var N=new l;e.forEach(y,function(b){var _=b.graph().root,k=s(b,_,N,w);e.forEach(k.vs,function(E,j){b.node(E).order=j}),a(b,N,k.vs)})}function g(y,w){e.forEach(w,function(N){e.forEach(N,function(b,_){y.node(b).order=_})})}return ly}var cy,ij;function Kz(){if(ij)return cy;ij=1;var e=wt(),t=cr().Graph,n=pn();cy={positionX:N,findType1Conflicts:s,findType2Conflicts:i,addConflict:l,hasConflict:u,verticalAlignment:h,horizontalCompaction:p,alignCoordinates:y,findSmallestWidthAlignment:g,balance:w};function s(k,E){var j={};function C(I,P){var O=0,F=0,M=I.length,A=e.last(P);return e.forEach(P,function(q,W){var K=a(k,q),T=K?k.node(K).order:M;(K||q===A)&&(e.forEach(P.slice(F,W+1),function(Z){e.forEach(k.predecessors(Z),function(U){var re=k.node(U),Q=re.order;(Q<O||T<Q)&&!(re.dummy&&k.node(Z).dummy)&&l(j,U,Z)})}),F=W+1,O=T)}),P}return e.reduce(E,C),j}function i(k,E){var j={};function C(P,O,F,M,A){var q;e.forEach(e.range(O,F),function(W){q=P[W],k.node(q).dummy&&e.forEach(k.predecessors(q),function(K){var T=k.node(K);T.dummy&&(T.order<M||T.order>A)&&l(j,K,q)})})}function I(P,O){var F=-1,M,A=0;return e.forEach(O,function(q,W){if(k.node(q).dummy==="border"){var K=k.predecessors(q);K.length&&(M=k.node(K[0]).order,C(O,A,W,F,M),A=W,F=M)}C(O,A,O.length,M,P.length)}),O}return e.reduce(E,I),j}function a(k,E){if(k.node(E).dummy)return e.find(k.predecessors(E),function(j){return k.node(j).dummy})}function l(k,E,j){if(E>j){var C=E;E=j,j=C}var I=k[E];I||(k[E]=I={}),I[j]=!0}function u(k,E,j){if(E>j){var C=E;E=j,j=C}return e.has(k[E],j)}function h(k,E,j,C){var I={},P={},O={};return e.forEach(E,function(F){e.forEach(F,function(M,A){I[M]=M,P[M]=M,O[M]=A})}),e.forEach(E,function(F){var M=-1;e.forEach(F,function(A){var q=C(A);if(q.length){q=e.sortBy(q,function(U){return O[U]});for(var W=(q.length-1)/2,K=Math.floor(W),T=Math.ceil(W);K<=T;++K){var Z=q[K];P[A]===A&&M<O[Z]&&!u(j,A,Z)&&(P[Z]=A,P[A]=I[A]=I[Z],M=O[Z])}}})}),{root:I,align:P}}function p(k,E,j,C,I){var P={},O=f(k,E,j,I),F=I?"borderLeft":"borderRight";function M(W,K){for(var T=O.nodes(),Z=T.pop(),U={};Z;)U[Z]?W(Z):(U[Z]=!0,T.push(Z),T=T.concat(K(Z))),Z=T.pop()}function A(W){P[W]=O.inEdges(W).reduce(function(K,T){return Math.max(K,P[T.v]+O.edge(T))},0)}function q(W){var K=O.outEdges(W).reduce(function(Z,U){return Math.min(Z,P[U.w]-O.edge(U))},Number.POSITIVE_INFINITY),T=k.node(W);K!==Number.POSITIVE_INFINITY&&T.borderType!==F&&(P[W]=Math.max(P[W],K))}return M(A,O.predecessors.bind(O)),M(q,O.successors.bind(O)),e.forEach(C,function(W){P[W]=P[j[W]]}),P}function f(k,E,j,C){var I=new t,P=k.graph(),O=b(P.nodesep,P.edgesep,C);return e.forEach(E,function(F){var M;e.forEach(F,function(A){var q=j[A];if(I.setNode(q),M){var W=j[M],K=I.edge(W,q);I.setEdge(W,q,Math.max(O(k,A,M),K||0))}M=A})}),I}function g(k,E){return e.minBy(e.values(E),function(j){var C=Number.NEGATIVE_INFINITY,I=Number.POSITIVE_INFINITY;return e.forIn(j,function(P,O){var F=_(k,O)/2;C=Math.max(P+F,C),I=Math.min(P-F,I)}),C-I})}function y(k,E){var j=e.values(E),C=e.min(j),I=e.max(j);e.forEach(["u","d"],function(P){e.forEach(["l","r"],function(O){var F=P+O,M=k[F],A;if(M!==E){var q=e.values(M);A=O==="l"?C-e.min(q):I-e.max(q),A&&(k[F]=e.mapValues(M,function(W){return W+A}))}})})}function w(k,E){return e.mapValues(k.ul,function(j,C){if(E)return k[E.toLowerCase()][C];var I=e.sortBy(e.map(k,C));return(I[1]+I[2])/2})}function N(k){var E=n.buildLayerMatrix(k),j=e.merge(s(k,E),i(k,E)),C={},I;e.forEach(["u","d"],function(O){I=O==="u"?E:e.values(E).reverse(),e.forEach(["l","r"],function(F){F==="r"&&(I=e.map(I,function(W){return e.values(W).reverse()}));var M=(O==="u"?k.predecessors:k.successors).bind(k),A=h(k,I,j,M),q=p(k,I,A.root,A.align,F==="r");F==="r"&&(q=e.mapValues(q,function(W){return-W})),C[O+F]=q})});var P=g(k,C);return y(C,P),w(C,k.graph().align)}function b(k,E,j){return function(C,I,P){var O=C.node(I),F=C.node(P),M=0,A;if(M+=O.width/2,e.has(O,"labelpos"))switch(O.labelpos.toLowerCase()){case"l":A=-O.width/2;break;case"r":A=O.width/2;break}if(A&&(M+=j?A:-A),A=0,M+=(O.dummy?E:k)/2,M+=(F.dummy?E:k)/2,M+=F.width/2,e.has(F,"labelpos"))switch(F.labelpos.toLowerCase()){case"l":A=F.width/2;break;case"r":A=-F.width/2;break}return A&&(M+=j?A:-A),A=0,M}}function _(k,E){return k.node(E).width}return cy}var uy,aj;function Xz(){if(aj)return uy;aj=1;var e=wt(),t=pn(),n=Kz().positionX;uy=s;function s(a){a=t.asNonCompoundGraph(a),i(a),e.forEach(n(a),function(l,u){a.node(u).x=l})}function i(a){var l=t.buildLayerMatrix(a),u=a.graph().ranksep,h=0;e.forEach(l,function(p){var f=e.max(e.map(p,function(g){return a.node(g).height}));e.forEach(p,function(g){a.node(g).y=h+f/2}),h+=f+u})}return uy}var dy,lj;function Qz(){if(lj)return dy;lj=1;var e=wt(),t=Mz(),n=Iz(),s=Pz(),i=pn().normalizeRanks,a=$z(),l=pn().removeEmptyRanks,u=Lz(),h=qz(),p=Dz(),f=Yz(),g=Xz(),y=pn(),w=cr().Graph;dy=N;function N(D,L){var X=L&&L.debugTiming?y.time:y.notime;X("layout",function(){var se=X(" buildLayoutGraph",function(){return M(D)});X(" runLayout",function(){b(se,X)}),X(" updateInputGraph",function(){_(D,se)})})}function b(D,L){L(" makeSpaceForEdgeLabels",function(){A(D)}),L(" removeSelfEdges",function(){H(D)}),L(" acyclic",function(){t.run(D)}),L(" nestingGraph.run",function(){u.run(D)}),L(" rank",function(){s(y.asNonCompoundGraph(D))}),L(" injectEdgeLabelProxies",function(){q(D)}),L(" removeEmptyRanks",function(){l(D)}),L(" nestingGraph.cleanup",function(){u.cleanup(D)}),L(" normalizeRanks",function(){i(D)}),L(" assignRankMinMax",function(){W(D)}),L(" removeEdgeLabelProxies",function(){K(D)}),L(" normalize.run",function(){n.run(D)}),L(" parentDummyChains",function(){a(D)}),L(" addBorderSegments",function(){h(D)}),L(" order",function(){f(D)}),L(" insertSelfEdges",function(){te(D)}),L(" adjustCoordinateSystem",function(){p.adjust(D)}),L(" position",function(){g(D)}),L(" positionSelfEdges",function(){$(D)}),L(" removeBorderNodes",function(){Q(D)}),L(" normalize.undo",function(){n.undo(D)}),L(" fixupEdgeLabelCoords",function(){U(D)}),L(" undoCoordinateSystem",function(){p.undo(D)}),L(" translateGraph",function(){T(D)}),L(" assignNodeIntersects",function(){Z(D)}),L(" reversePoints",function(){re(D)}),L(" acyclic.undo",function(){t.undo(D)})}function _(D,L){e.forEach(D.nodes(),function(X){var se=D.node(X),fe=L.node(X);se&&(se.x=fe.x,se.y=fe.y,L.children(X).length&&(se.width=fe.width,se.height=fe.height))}),e.forEach(D.edges(),function(X){var se=D.edge(X),fe=L.edge(X);se.points=fe.points,e.has(fe,"x")&&(se.x=fe.x,se.y=fe.y)}),D.graph().width=L.graph().width,D.graph().height=L.graph().height}var k=["nodesep","edgesep","ranksep","marginx","marginy"],E={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},j=["acyclicer","ranker","rankdir","align"],C=["width","height"],I={width:0,height:0},P=["minlen","weight","width","height","labeloffset"],O={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},F=["labelpos"];function M(D){var L=new w({multigraph:!0,compound:!0}),X=J(D.graph());return L.setGraph(e.merge({},E,V(X,k),e.pick(X,j))),e.forEach(D.nodes(),function(se){var fe=J(D.node(se));L.setNode(se,e.defaults(V(fe,C),I)),L.setParent(se,D.parent(se))}),e.forEach(D.edges(),function(se){var fe=J(D.edge(se));L.setEdge(se,e.merge({},O,V(fe,P),e.pick(fe,F)))}),L}function A(D){var L=D.graph();L.ranksep/=2,e.forEach(D.edges(),function(X){var se=D.edge(X);se.minlen*=2,se.labelpos.toLowerCase()!=="c"&&(L.rankdir==="TB"||L.rankdir==="BT"?se.width+=se.labeloffset:se.height+=se.labeloffset)})}function q(D){e.forEach(D.edges(),function(L){var X=D.edge(L);if(X.width&&X.height){var se=D.node(L.v),fe=D.node(L.w),pe={rank:(fe.rank-se.rank)/2+se.rank,e:L};y.addDummyNode(D,"edge-proxy",pe,"_ep")}})}function W(D){var L=0;e.forEach(D.nodes(),function(X){var se=D.node(X);se.borderTop&&(se.minRank=D.node(se.borderTop).rank,se.maxRank=D.node(se.borderBottom).rank,L=e.max(L,se.maxRank))}),D.graph().maxRank=L}function K(D){e.forEach(D.nodes(),function(L){var X=D.node(L);X.dummy==="edge-proxy"&&(D.edge(X.e).labelRank=X.rank,D.removeNode(L))})}function T(D){var L=Number.POSITIVE_INFINITY,X=0,se=Number.POSITIVE_INFINITY,fe=0,pe=D.graph(),xe=pe.marginx||0,je=pe.marginy||0;function He(De){var Me=De.x,_e=De.y,G=De.width,he=De.height;L=Math.min(L,Me-G/2),X=Math.max(X,Me+G/2),se=Math.min(se,_e-he/2),fe=Math.max(fe,_e+he/2)}e.forEach(D.nodes(),function(De){He(D.node(De))}),e.forEach(D.edges(),function(De){var Me=D.edge(De);e.has(Me,"x")&&He(Me)}),L-=xe,se-=je,e.forEach(D.nodes(),function(De){var Me=D.node(De);Me.x-=L,Me.y-=se}),e.forEach(D.edges(),function(De){var Me=D.edge(De);e.forEach(Me.points,function(_e){_e.x-=L,_e.y-=se}),e.has(Me,"x")&&(Me.x-=L),e.has(Me,"y")&&(Me.y-=se)}),pe.width=X-L+xe,pe.height=fe-se+je}function Z(D){e.forEach(D.edges(),function(L){var X=D.edge(L),se=D.node(L.v),fe=D.node(L.w),pe,xe;X.points?(pe=X.points[0],xe=X.points[X.points.length-1]):(X.points=[],pe=fe,xe=se),X.points.unshift(y.intersectRect(se,pe)),X.points.push(y.intersectRect(fe,xe))})}function U(D){e.forEach(D.edges(),function(L){var X=D.edge(L);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 re(D){e.forEach(D.edges(),function(L){var X=D.edge(L);X.reversed&&X.points.reverse()})}function Q(D){e.forEach(D.nodes(),function(L){if(D.children(L).length){var X=D.node(L),se=D.node(X.borderTop),fe=D.node(X.borderBottom),pe=D.node(e.last(X.borderLeft)),xe=D.node(e.last(X.borderRight));X.width=Math.abs(xe.x-pe.x),X.height=Math.abs(fe.y-se.y),X.x=pe.x+X.width/2,X.y=se.y+X.height/2}}),e.forEach(D.nodes(),function(L){D.node(L).dummy==="border"&&D.removeNode(L)})}function H(D){e.forEach(D.edges(),function(L){if(L.v===L.w){var X=D.node(L.v);X.selfEdges||(X.selfEdges=[]),X.selfEdges.push({e:L,label:D.edge(L)}),D.removeEdge(L)}})}function te(D){var L=y.buildLayerMatrix(D);e.forEach(L,function(X){var se=0;e.forEach(X,function(fe,pe){var xe=D.node(fe);xe.order=pe+se,e.forEach(xe.selfEdges,function(je){y.addDummyNode(D,"selfedge",{width:je.label.width,height:je.label.height,rank:xe.rank,order:pe+ ++se,e:je.e,label:je.label},"_se")}),delete xe.selfEdges})})}function $(D){e.forEach(D.nodes(),function(L){var X=D.node(L);if(X.dummy==="selfedge"){var se=D.node(X.e.v),fe=se.x+se.width/2,pe=se.y,xe=X.x-fe,je=se.height/2;D.setEdge(X.e,X.label),D.removeNode(L),X.label.points=[{x:fe+2*xe/3,y:pe-je},{x:fe+5*xe/6,y:pe-je},{x:fe+xe,y:pe},{x:fe+5*xe/6,y:pe+je},{x:fe+2*xe/3,y:pe+je}],X.label.x=X.x,X.label.y=X.y}})}function V(D,L){return e.mapValues(e.pick(D,L),Number)}function J(D){var L={};return e.forEach(D,function(X,se){L[se.toLowerCase()]=X}),L}return dy}var fy,cj;function Zz(){if(cj)return fy;cj=1;var e=wt(),t=pn(),n=cr().Graph;fy={debugOrdering:s};function s(i){var a=t.buildLayerMatrix(i),l=new n({compound:!0,multigraph:!0}).setGraph({});return e.forEach(i.nodes(),function(u){l.setNode(u,{label:u}),l.setParent(u,"layer"+i.node(u).rank)}),e.forEach(i.edges(),function(u){l.setEdge(u.v,u.w,{},u.name)}),e.forEach(a,function(u,h){var p="layer"+h;l.setNode(p,{rank:"same"}),e.reduce(u,function(f,g){return l.setEdge(f,g,{style:"invis"}),g})}),l}return fy}var hy,uj;function Jz(){return uj||(uj=1,hy="0.8.5"),hy}var py,dj;function eB(){return dj||(dj=1,py={graphlib:cr(),layout:Qz(),debug:Zz(),util:{time:pn().time,notime:pn().notime},version:Jz()}),py}var tB=eB();const fj=Jy(tB),Wi=240,Eu=130,Pi=74,nd=72,hj=Pi+nd;function nB(e,t){var s;let n=Wi;for(const i of e)n=Math.max(n,((s=t.get(i.id))==null?void 0:s.width)??Wi);return n}const DR=420,rB=2;function ul(e){var n;return((n=e.data)==null?void 0:n.sessionId)??"_default"}function sB(e,t){return((t==null?void 0:t.get(e))??0)>0?DR:0}function oB(e,t){const n=(t==null?void 0:t.get(e))??0;return n>0?6+n*36:0}function dl(e,t,n){const s=t.get(e);return{w:((s==null?void 0:s.width)??Wi)+sB(e,n),h:Math.max((s==null?void 0:s.height)??Eu,oB(e,n))}}function iB(e){return[...e.keys()].sort().map(t=>`${t}:${e.get(t)}`).join("|")}function aB(e,t,n,s,i,a){const l=new fj.graphlib.Graph;l.setDefaultEdgeLabel(()=>({})),l.setGraph({rankdir:n,marginx:0,marginy:0,nodesep:70,ranksep:160,edgesep:30});const u=e.filter(k=>!i.has(k)),h=new Set(u);for(const k of u){const{w:E,h:j}=dl(k,s,a);l.setNode(k,{width:E,height:j})}for(const k of t)h.has(k.source)&&h.has(k.target)&&l.setEdge(k.source,k.target);fj.layout(l);const p=new Map;let f=1/0,g=1/0,y=-1/0,w=-1/0;for(const k of u){const E=l.node(k);if(!E)continue;const j=s.get(k),C=(j==null?void 0:j.width)??Wi,I=(j==null?void 0:j.height)??Eu,P=dl(k,s,a),O=E.x-P.w/2,F=E.y-P.h/2;p.set(k,{x:O,y:F}),O<f&&(f=O),F<g&&(g=F),O+C>y&&(y=O+C),F+I>w&&(w=F+I)}if(Number.isFinite(f)&&Number.isFinite(g))for(const[k,E]of p)p.set(k,{x:E.x-f,y:E.y-g});const N=Number.isFinite(y)?y-f:0,b=Number.isFinite(w)?w-g:0;let _=null;for(const k of e){const E=i.get(k);if(!E)continue;const j=s.get(k),C=(j==null?void 0:j.width)??Wi,I=(j==null?void 0:j.height)??Eu;_=_===null?{minX:E.x,minY:E.y,maxX:E.x+C,maxY:E.y+I}:{minX:Math.min(_.minX,E.x),minY:Math.min(_.minY,E.y),maxX:Math.max(_.maxX,E.x+C),maxY:Math.max(_.maxY,E.y+I)}}return{positions:p,width:N,height:b,pinnedBox:_}}function lB(e,t,n={}){const s=n.direction??"LR",i=n.pinned??new Map,a=n.measured??new Map,l=n.lanes,u=new Map;for(const k of e){const E=ul(k),j=u.get(E);j?j.push(k.id):u.set(E,[k.id])}const p=Array.from(u.keys()).sort().map(k=>({sid:k,...aB(u.get(k),t,s,a,i,l)})),f=nB(e,a),g=n.availableHeight&&n.availableHeight>0?n.availableHeight:Number.POSITIVE_INFINITY,y=k=>{const E=[[]];let j=0;for(const C of p)E.length<k&&j>0&&j+C.height>g&&(E.push([]),j=0),E[E.length-1].push(C),j+=C.height+hj;return E},w=k=>k.reduce((E,j)=>Math.max(E,j.width),0)+DR;let N=y(n.availableWidth?rB:1);N.length>1&&N.reduce((E,j)=>E+w(j),0)+f*(N.length-1)>(n.availableWidth??0)&&(N=y(1));const b=new Map;let _=0;for(const k of N){const E=w(k);let j=0;for(const{positions:C,height:I,pinnedBox:P}of k){for(const[F,M]of C)b.set(F,{x:M.x+_,y:M.y+j});let O=j+I;P&&P.maxY>O&&P.minX<_+E&&_<P.maxX&&(O=P.maxY),j=O+hj}_+=E+f}return e.map(k=>{const E=i.get(k.id);if(E)return{...k,position:E};const j=b.get(k.id);return j?{...k,position:j}:k})}function cB(e,t,n,s,i){const l=Pi+nd,u=60,h=w=>dl(w,s,i),p=new Map(e.map(w=>[w.id,ul(w)])),f=[],g=e.map(w=>({id:w.id,pos:n.get(w.id)??t.get(w.id)})).filter(w=>w.pos!=null).sort((w,N)=>w.pos.y-N.pos.y||w.pos.x-N.pos.x||w.id.localeCompare(N.id)),y=[];for(const{id:w,pos:N}of g){const{w:b,h:_}=h(w),k=p.get(w)??"_default";if(n.has(w)){f.push({x:N.x,y:N.y,w:b,h:_,sid:k});continue}let E=N.y;for(let j=0;j<f.length+1;j++){const C=f.find(I=>{const P=I.sid===k?24:u,O=I.sid===k?24:l;return N.x<I.x+I.w+P&&I.x<N.x+b+P&&E<I.y+I.h+O&&I.y<E+_+O});if(!C)break;E=C.y+C.h+(C.sid===k?24:l)}E!==N.y&&(t.set(w,{x:N.x,y:E}),y.push(w)),f.push({x:N.x,y:E,w:b,h:_,sid:k})}return y}function uB(e,t,n,s,i,a){const l=b=>dl(b,s,a),u=b=>n.get(b)??t.get(b),h=new Map;for(const b of e){if(!u(b.id))continue;const _=ul(b),k=h.get(_);k?k.push(b):h.set(_,[b])}const p=new Set;for(const[b,_]of h)_.every(k=>i.has(k.id)&&!n.has(k.id))&&p.add(b);const f=new Map,g=[];for(const b of e){const _=u(b.id);if(!_)continue;const{w:k,h:E}=l(b.id),j=ul(b);p.has(j)?(f.get(j)??f.set(j,[]).get(j)).push(b):g.push({x:_.x,y:_.y,w:k,h:E})}if(f.size===0)return[];const y=Pi+nd,w=(b,_,k,E)=>g.some(j=>b<j.x+j.w+Pi&&j.x<b+k+Pi&&_<j.y+j.h+y&&j.y<_+E+y),N=[];for(const b of[...f.keys()].sort()){const _=f.get(b);let k=1/0,E=1/0,j=-1/0,C=-1/0;for(const q of _){const W=u(q.id),{w:K,h:T}=l(q.id);k=Math.min(k,W.x),E=Math.min(E,W.y),j=Math.max(j,W.x+K),C=Math.max(C,W.y+T)}const I=j-k,P=C-E,O=[...new Set(g.map(q=>Math.round(q.x)))].sort((q,W)=>q-W),F=O.length?O:[k],M=[0,...g.map(q=>q.y+q.h+y)].sort((q,W)=>q-W);let A=null;e:for(const q of F)for(const W of M){if(W>=E)break;if(!w(q,W,I,P)){A={x:q,y:W};break e}}if(A){const q=A.x-k,W=A.y-E;for(const K of _){const T=u(K.id);t.set(K.id,{x:T.x+q,y:T.y+W})}N.push(b)}for(const q of _){const W=u(q.id),{w:K,h:T}=l(q.id);g.push({x:W.x,y:W.y,w:K,h:T})}}return N}function dB(e,t,n,s,i,a=!1,l){const p=Pi+nd+1,f=8,g=1.75,y=200,w=.7,N=.01,b=A=>dl(A,s,l),_=A=>n.get(A)??t.get(A),k=new Map;for(const A of e){if(!_(A.id))continue;const q=ul(A),W=k.get(q);W?W.push(A):k.set(q,[A])}const E=[],j=new Set,C=new Set,I=i.size===0;for(const A of[...k.keys()].sort()){const q=k.get(A);let W=1/0,K=1/0,T=-1/0,Z=-1/0,U=!1;for(const te of q){const $=_(te.id),{w:V,h:J}=b(te.id);W=Math.min(W,$.x),K=Math.min(K,$.y),T=Math.max(T,$.x+V),Z=Math.max(Z,$.y+J),n.has(te.id)&&(U=!0)}const re=T-W,Q=Z-K;C.add(A);const H=i.get(A);H&&(re>H.w+f||Q>H.h+f)&&j.add(A),i.set(A,{w:re,h:Q}),E.push({sid:A,members:q.map(te=>te.id),x:W,y:K,w:re,h:Q,anchored:U,mass:1})}for(const A of[...i.keys()])C.has(A)||i.delete(A);if(a||I)return[];let P=!1;for(let A=0;A<E.length&&!P;A++)for(let q=A+1;q<E.length;q++){const W=E[A],K=E[q];if(!(W.anchored&&K.anchored)&&Math.abs(W.x+W.w/2-(K.x+K.w/2))<(W.w+K.w)/2+61&&Math.abs(W.y+W.h/2-(K.y+K.h/2))<(W.h+K.h)/2+p){P=!0;break}}if(j.size===0&&!P)return[];if(j.size>0)for(const A of E)j.has(A.sid)&&(A.mass=8);else for(const A of E)A.mass=Math.max(1,A.w*A.h/(Wi*Eu));const O=new Map(E.map(A=>[A.sid,A.x])),F=new Map(E.map(A=>[A.sid,A.y]));for(let A=0;A<y;A++){const q=new Map,W=new Map;let K=0;for(let T=0;T<E.length;T++)for(let Z=T+1;Z<E.length;Z++){const U=E[T],re=E[Z];if(U.anchored&&re.anchored)continue;const Q=U.x+U.w/2,H=U.y+U.h/2,te=re.x+re.w/2,$=re.y+re.h/2,V=(U.w+re.w)/2+61-Math.abs(Q-te),J=(U.h+re.h)/2+p-Math.abs(H-$);if(V<=0||J<=0)continue;const D=(Ie,Je)=>!Ie.anchored&&!(Je<0&&Ie.x<=0),L=(Ie,Je)=>!Ie.anchored&&!(Je<0&&Ie.y<=0),X=(Ie,Je,Ge)=>{const Qe=Ie===Je,Oe=Qe?U.sid<re.sid?-1:1:Math.sign(Ie-Je);return Ge(U,Oe)||Ge(re,-Oe)?Oe:Qe&&(Ge(U,-Oe)||Ge(re,Oe))?-Oe:0},se=X(Q,te,D),fe=X(H,$,L),pe=se!==0,xe=fe!==0;if(!pe&&!xe)continue;const je=pe&&(!xe||V*g<J),[He,De,Me,_e]=je?[se,V,q,D]:[fe,J,W,L],G=_e(U,He),he=_e(re,-He),ve=U.mass,We=re.mass,at=G?he?We/(ve+We):1:0,rt=he?G?ve/(ve+We):1:0,Be=De*w;Me.set(U.sid,(Me.get(U.sid)??0)+He*Be*at),Me.set(re.sid,(Me.get(re.sid)??0)-He*Be*rt),K+=Be}for(const T of E)T.anchored||(T.x=Math.max(0,T.x+(q.get(T.sid)??0)),T.y=Math.max(0,T.y+(W.get(T.sid)??0)));if(K<N)break}const M=[];for(const A of E){const q=A.x-O.get(A.sid),W=A.y-F.get(A.sid);if(!(Math.abs(q)<1&&Math.abs(W)<1)){for(const K of A.members){if(n.has(K))continue;const T=t.get(K);T&&t.set(K,{x:T.x+q,y:T.y+W})}M.push(A.sid)}}return M}const fB=600;function Ky(e,t){return!(e.exitAt!=null&&t-e.exitAt>fB||e.kind==="root"&&e.state==="done"&&e.tools.length===0&&e.endedAt!=null&&e.endedAt-e.startedAt<3e3)}function hB(e,t){const n=new Set;for(const s of e.agents.values())Ky(s,t)&&n.add(s.id);return n}function pB(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 mB(e,t,n=0){if(!e)return!1;for(const s of t)if(pB(e,s,n))return!0;return!1}const FR="sessionGroup";function gB(e,t){var s;if(e.type===FR)return"transparent";const n=(s=e.data)==null?void 0:s.state;return t(n==="err"?"--err":n==="active"?"--inflight":"--ok")}const zR=["--err","--inflight","--ok","--grid-line","--minimap-mask","--panel","--line","--accent","--text-dim","--bg"];function pj(e){const t={};for(const n of zR)t[n]=e(n);return t}function vB(e){return t=>e[t]??""}function yB(e,t){return zR.every(n=>e[n]===t[n])}function wB(e){const t=new Set(e.pins),n=new Map,s=new Map;for(const[i,a]of e.positions)n.set(i,a),t.has(i)&&s.set(i,a);return{positions:n,pinned:s}}const xB=1200,bB=1e3;function mj(e){return e.lastDeckFitAt>0&&e.at-e.lastDeckFitAt<xB?!1:e.hasSourceEvent?!0:e.lastCanvasInputAt>0&&e.at-e.lastCanvasInputAt<bB}function my({durationMs:e,documentHidden:t}){return t?!1:Number.isFinite(e)&&e>0}function _B(e,t,n){const s=e.x*t.zoom+t.x,i=e.y*t.zoom+t.y,a=(e.x+e.width)*t.zoom+t.x,l=(e.y+e.height)*t.zoom+t.y;return a>0&&s<n.width&&l>0&&i<n.height}function kB({pane:e,viewport:t,boxes:n}){if(!e||!(e.width>0)||!(e.height>0)||!Number.isFinite(t.zoom)||t.zoom<=0||!Number.isFinite(t.x)||!Number.isFinite(t.y))return!1;let s=!1;for(const i of n)if(s=!0,_B(i,t,e))return!1;return s}const SB="Update checks are off (AGENTS_DECK_NO_UPDATE_CHECK=1)",gy="click for what's new";function NB(e){if(e.checkDisabled)return`${SB} · ${gy}`;if(e.checking)return`Asking npm for the newest release… · ${gy}`;const t=e.latest?`npm has v${e.latest}`:e.latestPending?`npm's latest tag names v${e.latestPending}, which it cannot serve yet`:"npm not reached yet",n=e.checkedAgo?` · checked ${e.checkedAgo}`:"";return`${t}${n} · re-checked periodically · ${gy}, and to check npm now`}function EB(e){const t=`Version v${e.running}, show what's new`;return e.checkDisabled?`${t} — update checks are off`:e.checking?`${t} — checking npm for a newer release`:`${t} and check npm for a newer release`}function jB(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 CB(e){if(e==null)return{kind:"unknown",lead:"No data yet. Start a Claude Code or Codex session — it appears here as soon as the deck sees its first event.",workspace:null,tail:""};const t=e.trim();return t===""?{kind:"machine",lead:"No data yet. Start a Claude Code or Codex session anywhere on this machine — this deck is unscoped and captures every workspace.",workspace:null,tail:""}:{kind:"scoped",lead:"No data yet. This deck only captures sessions running under",workspace:t,tail:" — start one there, or restart it without --workspace/--scope to watch the whole machine."}}const Xy={kind:"assumed",claude:!0,codex:!0};function TB(e){if(!e||typeof e!="object")return Xy;const t=e.providers;if(!t||typeof t!="object")return Xy;const n=t;return{kind:"reported",claude:n.claude!==!1,codex:n.codex!==!1}}function ju(e){const t=Math.max(0,Math.floor(e));return`${t} event${t===1?"":"s"}`}const gj=99;function RB(e){const t=Math.max(0,Math.floor(e));return t>gj?`${gj}+`:String(t)}const AB="Pause the canvas";function MB(e){if(!e.paused)return"Pause live updates — events keep arriving and are applied when you resume (Space)";const t=Math.max(0,Math.floor(e.dropped??0));return t>0?`The pause is full — ${ju(e.held)} held and ${t} older ${t===1?"one":"ones"} already dropped. Resume to follow the canvas again (Space)`:e.held<=0?"Nothing has arrived since you paused. Resume to follow the canvas again (Space)":`${ju(e.held)} arrived while paused and will be applied in order when you resume (Space)`}function IB(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 BR="paused · full",OB=(e,t)=>t>0?BR:e>0?`paused · ${RB(e)}`:"paused";function PB(e){const t=Math.max(0,Math.floor(e.dropped??0));return e.connected?e.paused?{tone:"paused",resting:!1,label:OB(e.held,t),widest:BR,title:t>0?`Connected — the pause is full at ${ju(e.held)}; the oldest are being dropped as new ones arrive. Resume to catch up (Space)`:e.held>0?`Connected — ${ju(e.held)} held until you resume (Space)`:"Connected — updates held until you resume (Space)"}:{tone:"live",resting:!0,label:"live",widest:"live",title:"Receiving events"}:{tone:"dead",resting:!1,label:"offline",widest:"offline",title:e.paused?"SSE disconnected — and the canvas is paused, so resuming will not bring events back until it reconnects":"SSE disconnected"}}function vj(e){return typeof window>"u"?"":getComputedStyle(document.documentElement).getPropertyValue(e).trim()||""}const $B={agent:XL,sessionGroup:f3},UR="react-flow__node";function yj(e){var t,n;return!!e&&((n=(t=e.classList)==null?void 0:t.contains)==null?void 0:n.call(t,UR))===!0}function LB(e){try{const t=document.querySelector(`.${UR}[data-id="${CSS.escape(e)}"]`);t==null||t.focus({preventScroll:!0})}catch{}}const qB=["a[href]","button:not(:disabled)","input:not(:disabled)","select:not(:disabled)","textarea:not(:disabled)","summary","[tabindex]"].join(","),DB=420,ru=18,FB=200,zB=5*6e4,BB=6,UB=2*6e4,wj=400,Xw="agent-dag.layout",Qw="agent-dag.viewport",WR="agent-dag.summariesDismissed",HR="agent-dag.sessionListOpen",GR="agent-dag.detailOpen",VR="agent-dag.usagePanelOpen",xj="agent-dag.accountsPanelOpen",vy="agent-dag.versionNoticeDismissed",bj="agent-dag.oldNameNoticeDismissed",WB=15*6e4,yy={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:"},_j="agent-dag.autoRestart",kj="agent-dag.bundleReloadedFor";function HB(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(HR)==="1"}catch{return!1}}function GB(e){if(!(typeof window>"u"))try{window.localStorage.setItem(HR,e?"1":"0")}catch{}}function VB(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(GR)==="1"}catch{return!1}}function YB(e){if(!(typeof window>"u"))try{window.localStorage.setItem(GR,e?"1":"0")}catch{}}function KB(){const e=Lu(VR);return e===null?!0:e==="1"}function XB(e){if(!(typeof window>"u"))try{window.localStorage.setItem(VR,e?"1":"0")}catch{}}function QB(){if(typeof window>"u")return new Set;try{const e=window.localStorage.getItem(WR);if(!e)return new Set;const t=JSON.parse(e);return new Set(Array.isArray(t)?t.filter(n=>typeof n=="string"):[])}catch{return new Set}}function Sj(e){if(!(typeof window>"u"))try{const t=Array.from(e),n=t.length>200?t.slice(-200):t;window.localStorage.setItem(WR,JSON.stringify(n))}catch{}}function ZB(){const e={positions:[],pins:[]};if(typeof window>"u")return e;try{const t=window.localStorage.getItem(Xw);if(!t)return e;const n=JSON.parse(t);if(!("v"in n)){const i=Object.entries(n).filter(([,a])=>a&&typeof a.x=="number"&&typeof a.y=="number");return{positions:i,pins:i.map(([a])=>a)}}return{positions:Object.entries(n.positions??{}).filter(([,i])=>i&&typeof i.x=="number"&&typeof i.y=="number"),pins:Array.isArray(n.pins)?n.pins:[]}}catch{return e}}function wy(e,t){if(!(typeof window>"u"))try{const n={};for(const[s,i]of e)n[s]=i;for(const[s,i]of t)n[s]=i;window.localStorage.setItem(Xw,JSON.stringify({v:2,positions:n,pins:Array.from(t.keys())}))}catch{}}function JB(){if(typeof window>"u")return null;try{const e=window.localStorage.getItem(Qw);if(!e)return null;const t=JSON.parse(e);return typeof(t==null?void 0:t.x)!="number"||typeof(t==null?void 0:t.y)!="number"||typeof(t==null?void 0:t.zoom)!="number"?null:t}catch{return null}}function e8(e){if(!(typeof window>"u"))try{window.localStorage.setItem(Qw,JSON.stringify(e))}catch{}}function Nj(){if(!(typeof window>"u")){try{window.localStorage.removeItem(Xw)}catch{}try{window.localStorage.removeItem(Qw)}catch{}}}function t8(e,t){const n=e.agents.get(t);if(!n)return;const s=[];for(const f of e.agents.values())f.sessionId===t&&s.push(f);const i={schemaVersion:1,exportedAt:new Date().toISOString(),sessionId:t,label:n.label,cwd:n.cwd,startedAt:n.startedAt,endedAt:n.endedAt,model:n.model,agents:s.map(f=>({id:f.id,kind:f.kind,label:f.label,parentId:f.parentId,state:f.state,startedAt:f.startedAt,endedAt:f.endedAt,model:f.model,cwd:f.cwd,usage:f.usage,prompts:f.prompts,tools:f.tools.map(g=>({id:g.id,name:g.name,inputPreview:g.inputPreview,startedAt:g.startedAt,endedAt:g.endedAt,ok:g.ok,errorPreview:g.errorPreview,usage:g.usage}))}))},a=JSON.stringify(i,null,2),l=new Blob([a],{type:"application/json"}),u=URL.createObjectURL(l),h=document.createElement("a"),p=(n.label||"session").replace(/[^a-z0-9._-]/gi,"_");h.href=u,h.download=`${zt}-${p}-${t.slice(0,8)}.json`,document.body.appendChild(h),h.click(),document.body.removeChild(h),setTimeout(()=>URL.revokeObjectURL(u),1e3)}const Qy={file:"📁",shell:"⚡",web:"🌐",agent:"🤖",task:"📋",plan:"🧭",mcp:"🔌",other:"✨"},Zy={file:"file",shell:"shell",web:"web",agent:"agent",task:"task",plan:"plan",mcp:"mcp",other:"other"},YR=dT;function n8(e,t,n,s,i,a,l,u,h,p,f,g,y,w,N,b,_,k){const E=[],j=[];for(const A of e.agents.values()){if(!_.has(A.id))continue;const q=A.exitAt!=null,W=b!=null&&!b.has(A.id),K=[q?"rf-exiting":"",W?"rf-spotlit-out":""].filter(Boolean).join(" ")||void 0,T=a.get(A.id);if(E.push({id:A.id,type:"agent",position:{x:0,y:0},data:{...A,now:t,onOpenContext:k},className:K,...T?{width:T.width,height:T.height}:null}),A.parentId&&_.has(A.parentId)){const Z=ww(A.sessionId),U=q,re=N.size>0&&(N.has(A.id)||N.has(A.parentId)),Q=b!=null&&!b.has(A.id)&&!b.has(A.parentId),H=A.state==="active"?2:1.5,te=re?H+1.5:H,$=U?.2:Q?.12:1,V=["sess-edge",A.state==="active"?"sess-live":"sess-idle",U?"rf-edge-exiting":"",re?"rf-edge-selected":""].filter(Boolean).join(" ");j.push({id:`e:${A.parentId}->${A.id}`,source:A.parentId,target:A.id,animated:(A.state==="active"||re)&&!U,type:"smoothstep",style:{"--session-hue":Z,strokeWidth:te,opacity:$,transition:"var(--edge-transition)"},className:V})}}const C=new Map;for(const A of e.agents.values())A.tools.length>0&&C.set(A.id,Math.min(4,A.tools.length));const I=`${y}#lanes:${iB(C)}`,P=E.filter(A=>t5(A.id,i,f,g));if(P.length>0||I!==w.current){if(P.length>0){const A=lB(E,j,{direction:"LR",pinned:i,measured:a,availableWidth:n,availableHeight:s,lanes:C});for(const q of A)$T(q.id,f,g)&&r5(q.id,q.position,f,g);uB(E,f,i,a,new Set(P.map(q=>q.id)),C)}cB(E,f,i,a,C),w.current=I}const O=dB(E,f,i,a,l,!h||p,C);O.length>0&&u(O),Qc(f,e.agents),Qc(g,e.agents),Qc(i,e.agents),Qc(a,ZD(e.agents.values()));const F=[];let M=!1;for(const A of E){let q=i.get(A.id)??f.get(A.id);q||(q=n5(A.id,f,g),M=!0),F.push({...A,position:q})}return M&&(w.current=""),{nodes:F,edges:j}}function r8(){return d.jsx(vw,{children:d.jsx(s8,{})})}function s8(){var ds,Bl,Xs,Ul;const e=gl(),t=Rt(),n=S.useState($y)[0],s=S.useRef(n),[,i]=S.useState(0),a=S.useCallback(()=>i(z=>z+1),[]),[l,u]=S.useState(()=>new Set),[h,p]=S.useState(null),[f,g]=S.useState(null),y=S.useCallback((z,Y)=>{u(le=>{if(!Y)return new Set([z]);const de=new Set(le);return de.has(z)?de.delete(z):de.add(z),de}),p(le=>Y&&le===z?le:z)},[]),w=S.useCallback(()=>{u(new Set),p(null)},[]),[N,b]=S.useState(null),[_,k]=S.useState(null),E=S.useCallback(z=>k(z),[]),[j,C]=S.useState(!1),[I,P]=S.useState(!1),O=S.useState(QB)[0],[F,M]=S.useState(HB);S.useEffect(()=>{GB(F)},[F]);const[A,q]=S.useState(VB);S.useEffect(()=>{YB(A)},[A]);const[W,K]=S.useState(KB);S.useEffect(()=>{XB(W)},[W]);const[T,Z]=S.useState(()=>{try{const z=window.localStorage.getItem(xj);return z===null?!0:z==="1"}catch{return!0}});S.useEffect(()=>{try{window.localStorage.setItem(xj,T?"1":"0")}catch{}},[T]);const[U,re]=S.useState(null);S.useEffect(()=>{let z=null;try{z=localStorage.getItem("agent-dag.sound")}catch{}re(z===null?!0:z==="on")},[]);const Q=S.useCallback(()=>{re(z=>{var le;const Y=z!==!0;try{localStorage.setItem("agent-dag.sound",Y?"on":"off")}catch{}return Y&&((le=je.current)==null||le.unlock()),Y})},[]),H=S.useCallback(z=>{Q()},[Q]),te=S.useRef(H);te.current=H;const $=S.useRef(U);$.current=U;const[V,J]=S.useState(()=>ND(Lu)),D=S.useRef(V);D.current=V;const L=S.useRef(null),X=S.useCallback((z,Y=!1)=>{var le,de;if((le=je.current)==null||le.unlock(),L.current!==null&&clearTimeout(L.current),L.current=null,!Y){(de=je.current)==null||de.play(z,!0);return}L.current=setTimeout(()=>{var be;L.current=null,(be=je.current)==null||be.play(z,!0)},xD)},[]),se=S.useCallback((z,Y)=>{J(le=>{const de={level:cl(Y.level??le[z].level),figure:AT(z,Y.figure??le[z].figure)};try{localStorage.setItem(IT[z],String(de.level)),localStorage.setItem(OT[z],de.figure)}catch{}return{...le,[z]:de}}),X(z,!0)},[X]);S.useEffect(()=>()=>{L.current!==null&&clearTimeout(L.current)},[]);const[fe,pe]=S.useState(!1),xe=S.useRef(null),je=S.useRef(null),[He,De]=S.useState("locked");S.useEffect(()=>{const z=CD({enabled:()=>$.current===!0,prefs:()=>D.current,onState:De});je.current=z,De(z.state());const Y=()=>z.unlock();return window.addEventListener("pointerdown",Y,{once:!0,capture:!0}),window.addEventListener("keydown",Y,{once:!0,capture:!0}),()=>{window.removeEventListener("pointerdown",Y,{capture:!0}),window.removeEventListener("keydown",Y,{capture:!0})}},[]);const[Me,_e]=S.useState(!1),[G,he]=S.useState(null),[ve,We]=S.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(vy)??""}catch{return""}}),[at,rt]=S.useState(!1),Be=S.useRef(0),[Ie,Je]=S.useState(!1),Ge=S.useCallback((z=!1)=>(z&&(Be.current=Date.now(),Je(!0)),fetch(z?"/api/version?refresh=1":"/api/version").then(Y=>Y.ok?Y.json():null).then(Y=>{Y&&he(Y)}).catch(()=>{}).finally(()=>{z&&Je(!1)})),[]),Qe=S.useCallback(()=>{Ge(Date.now()-Be.current>=WB)},[Ge]);S.useEffect(()=>{Ge();const z=window.setInterval(Qe,5*6e4),Y=()=>{document.visibilityState==="visible"&&Qe()};return document.addEventListener("visibilitychange",Y),()=>{window.clearInterval(z),document.removeEventListener("visibilitychange",Y)}},[Ge,Qe]),S.useEffect(()=>{Me&&Ge()},[Me,Ge]);const Oe=(G==null?void 0:G.notice)??null,[lt,Mt]=S.useState(null),ae=S.useRef(!1);S.useEffect(()=>{if(ae.current)return;const z=DD(),Y=FD(z),le=UD({stored:Y,running:(G==null?void 0:G.running)??null,notes:D1,remembers:zD(z)});le.reason!=="no-version"&&(ae.current=!0,le.record&&BD(z,le.record),le.show.length&&Mt({entries:le.show,since:Y,firstRun:le.reason==="welcome"}))},[G==null?void 0:G.running]);const $e=(G==null?void 0:G.running)??"3.4.0",Fe=S.useMemo(()=>PT(D1,null,$e),[$e]),Ne=S.useCallback(()=>{Mt({entries:Fe,since:null,firstRun:!1})},[Fe]),[Ye,Et]=S.useState(null),[st,Te]=S.useState(Xy);S.useEffect(()=>{let z=!1;return fetch("/api/health").then(Y=>Y.ok?Y.json():null).then(Y=>{z||(Te(TB(Y)),!(!Y||typeof Y.workspace!="string")&&Et(Y.workspace))}).catch(()=>{}),()=>{z=!0}},[Me]);const xt=S.useRef(st);xt.current=st;const ut=Oe?`${Oe.kind}:${Oe.to}`:"",kt=Oe!=null&&ve!==ut,Nn=S.useCallback(()=>{We("");try{window.localStorage.setItem(vy,"")}catch{}},[]),zn=S.useCallback(()=>{if(Oe){We(ut);try{window.localStorage.setItem(vy,ut)}catch{}}},[Oe,ut]),[En,jo]=S.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(bj)??""}catch{return""}}),mn=G!=null&&G.invokedAs&&G.invokedAs!==zt?G.invokedAs:null,Co=mn!=null&&En!==mn,To=S.useCallback(()=>{if(mn){jo(mn);try{window.localStorage.setItem(bj,mn)}catch{}}},[mn]),Bt=((ds=G==null?void 0:G.upgrade)==null?void 0:ds.state)??"idle",Cr=nD(G==null?void 0:G.upgrade),Bn=S.useRef(!1),Ps=S.useCallback(async()=>{if(ar(Bn.current||Bt==="running")){Bn.current=!0;try{await fetch("/api/upgrade",{method:"POST"})}catch{}await Ge(),Bn.current=!1}},[Bt,Ge]);S.useEffect(()=>{if(Bt!=="running")return;const z=window.setInterval(Ge,3e3);return()=>window.clearInterval(z)},[Bt,Ge]);const Tr=S.useCallback(async()=>{var le;const z=G==null?void 0:G.command;if(!z)return;let Y=!1;try{Y=await Promise.race([((le=navigator.clipboard)==null?void 0:le.writeText(z).then(()=>!0))??Promise.resolve(!1),new Promise(de=>window.setTimeout(()=>de(!1),500))])}catch{Y=!1}if(!Y)try{const de=document.createElement("textarea");de.value=z,de.setAttribute("readonly",""),de.style.cssText="position:fixed;top:0;left:0;opacity:0",document.body.appendChild(de),de.select(),Y=document.execCommand("copy"),de.remove()}catch{Y=!1}Y&&(rt(!0),window.setTimeout(()=>rt(!1),1600))},[G==null?void 0:G.command]),Qi=S.useCallback(()=>{M(z=>(z||Z(!1),!z))},[]),fr=S.useCallback(()=>{Z(z=>(z||M(!1),!z))},[]),[Rr,hr]=S.useState(!1),[es,Ro]=S.useState(!1),[Ao,Mo]=S.useState(()=>{try{return Number(localStorage.getItem(U1))||0}catch{return 0}}),[jn,Io]=S.useState([]),[Ar,Oo]=S.useState(!1);S.useEffect(()=>{let z=!0;const Y=()=>{fetch("/api/browser-watch?live=0").then(de=>de.ok?de.json():null).then(de=>{var be;!z||!(de!=null&&de.ok)||(Io(de.episodes??[]),Oo(((be=de.settings)==null?void 0:be.enabled)===!0))}).catch(()=>{})};Y();const le=setInterval(Y,5*6e4);return()=>{z=!1,clearInterval(le)}},[]);const Un=S.useMemo(()=>A5(jn,Ao).length,[jn,Ao]),[Po,$s]=S.useState(0),Ls=S.useRef(null),[$o,Lo]=S.useState(!1),ot=S.useRef(null),[Zi,ts]=S.useState(0),Gt=S.useState(()=>l5({protect:z=>uL(s.current,z)}))[0],[Wn,qo]=S.useState(!1),ns=S.useCallback(()=>{const z=Gt.paused&&Gt.dropped>0,Y=Gt.setPaused(!Gt.paused);z&&dL(s.current);for(const le of Y)s.current=Qb(s.current,le);qo(Gt.paused)},[Gt]),[mt,sn]=S.useState(Date.now()),[Hn,gn]=S.useState(()=>{if(typeof window>"u")return!0;try{return window.localStorage.getItem(_j)!=="0"}catch{return!0}}),rd=S.useCallback(()=>{gn(z=>{const Y=!z;try{window.localStorage.setItem(_j,Y?"1":"0")}catch{}return Y})},[]),[Mr,Do]=S.useState(!1),[Fo,zo]=S.useState("restart"),[rs,qs]=S.useState(null),ss=S.useRef(!1),jl=S.useRef(null),Bo=S.useRef(0),Ds=S.useCallback(async z=>{if(!ar(ss.current))return;const Y=(z==null?void 0:z.upgrade)===!0;ss.current=!0,jl.current=Cr;const le=++Bo.current;zo(Y?"npx":"restart"),Do(!0);try{window.sessionStorage.setItem("agent-dag.restartPending",(Oe==null?void 0:Oe.to)??"")}catch{}try{await fetch("/api/restart",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({upgrade:Y})})}catch{}window.setTimeout(()=>{if(Bo.current===le&&ss.current){ss.current=!1,Do(!1);try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}}},Y?18e4:3e4)},[Oe==null?void 0:Oe.to,Cr]),Uo=S.useRef(null);S.useEffect(()=>{let z=!1;for(const le of s.current.agents.values())if(le.state==="active"){z=!0;break}const Y=sD({enabled:Hn,kind:Oe==null?void 0:Oe.kind,canRestart:(G==null?void 0:G.canRestart)===!0,busy:z,idleSince:Uo.current,now:mt});Uo.current=Y.idleSince,Y.restart&&Ds()},[Hn,Oe==null?void 0:Oe.kind,G==null?void 0:G.canRestart,mt,Ds]),S.useEffect(()=>{const z=G==null?void 0:G.running;let Y=null,le=null;try{Y=window.sessionStorage.getItem("agent-dag.restartPending"),le=window.sessionStorage.getItem(kj)}catch{return}const de=tD({bundle:"3.4.0",running:z,pending:Y,lastTried:le});if(de==="reload"){try{window.sessionStorage.setItem(kj,z??"")}catch{return}window.location.reload();return}if(de!=="confirm")return;try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}ss.current=!1,Do(!1),qs(z??null);const be=window.setTimeout(()=>qs(null),6e3);return()=>window.clearTimeout(be)},[G==null?void 0:G.running]),S.useEffect(()=>{if(Mr&&rD({asked:jl.current,reported:Cr})){try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}ss.current=!1,Do(!1)}},[Mr,Cr]);const os=S.useState(()=>wB(ZB()))[0],Jt=S.useRef(os.pinned),is=S.useRef(null),Ze=S.useState(()=>JB())[0],[Ji,Cl]=S.useState(()=>new Set),[Ir,ea]=S.useState(u5),[Gn,Tl]=S.useState(()=>pj(vj)),Wo=S.useMemo(()=>vB(Gn),[Gn]),Ho=S.useCallback(z=>gB(z,Wo),[Wo]),pr=S.useMemo(()=>({background:Gn["--panel"],border:`1px solid ${Gn["--line"]}`,borderRadius:8}),[Gn]),[Vn,mr]=S.useState(!1);S.useEffect(()=>{document.documentElement.dataset.theme=Ir;try{window.localStorage.setItem(LT,Ir)}catch{}Tl(z=>{const Y=pj(vj);return yB(z,Y)?z:Y})},[Ir]);const vn=S.useCallback((z,Y)=>{if(my({durationMs:Y,documentHidden:document.hidden})){e.setViewport(z,{duration:Y});return}const{d3Zoom:le,d3Selection:de}=t.getState(),be=de==null?void 0:de.property("__zoom");if(le&&de&&be&&be.k>0&&z.zoom>0){le.transform(de,be.scale(z.zoom/be.k).translate((z.x-be.x)/z.zoom,(z.y-be.y)/z.zoom));return}e.setViewport(z,{duration:0})},[e,t]),Yn=S.useRef(null);S.useEffect(()=>{if(!Ze)return;const z=window.setTimeout(()=>{try{vn(Ze,0)}catch{}Xn.current=Date.now()},60);return()=>window.clearTimeout(z)},[vn,Ze]);const Kn=S.useRef(!0);S.useEffect(()=>{const z=new EventSource("/events"),Y=i5(a,{now:()=>Date.now(),setTimeout:(le,de)=>window.setTimeout(le,de),clearTimeout:le=>window.clearTimeout(le)});return z.addEventListener("open",()=>{_e(!0),mr(!0)}),z.addEventListener("error",()=>_e(!1)),z.addEventListener("replay-end",()=>{Kn.current=!1,Y.flush()}),z.addEventListener("hook",le=>{var de;try{const be=JSON.parse(le.data);if(!Gt.accept(be))return;s.current=Qb(s.current,be);const Ce=be.replay===!0||Kn.current||Date.now()-be.receivedAt>3e4;Ce?Y.replay():Y.live();const Ue=jD(be,Ce);Ue&&((de=je.current)==null||de.play(Ue))}catch{}}),()=>{z.close(),Y.cancel()}},[a]),S.useEffect(()=>{const z=setInterval(()=>{const Y=Date.now();sn(Y);let le=fL(s.current,Y,Xb);hL(s.current,Y,Xb)&&(le=!0),lL(s.current,Y,FB,zB)&&(le=!0),cL(s.current,Y,BB,UB)&&(le=!0),u(de=>QD(de,s.current.agents)),p(de=>de!=null&&!s.current.agents.has(de)?null:de),le&&a()},250);return()=>clearInterval(z)},[a]);const ta=S.useRef(null),Xn=S.useRef(0),Fs=420,Cn=S.useCallback((z=500)=>{try{const Ce=document.querySelector(".canvas-wrap"),Ue=Array.from(document.querySelectorAll(".react-flow__node")).filter(ft=>ft.offsetWidth>0);if(!Ce||Ue.length===0)return;const tt=Ce.getBoundingClientRect(),gt=e.getViewport();if(!Number.isFinite(gt.zoom)||gt.zoom<=0)return;const ct=ft=>(ft-tt.left-gt.x)/gt.zoom,on=ft=>(ft-tt.top-gt.y)/gt.zoom,Yt=Ue.map(ft=>ft.getBoundingClientRect()),fs=Math.min(...Yt.map(ft=>ct(ft.left))),Wl=Math.max(...Yt.map(ft=>ct(ft.right))),ma=Math.min(...Yt.map(ft=>on(ft.top))),Hl=Math.max(...Yt.map(ft=>on(ft.bottom))),ga=Wl-fs,Qs=Hl-ma;if(!(ga>0&&Qs>0))return;const Zs=Math.max(.2,Math.min(1,(tt.width-160)/(ga+Fs)*.86,(tt.height-160)/Qs*.86)),Js={x:80-fs*Zs,y:Math.max(80,(tt.height-Qs*Zs)/2)-ma*Zs,zoom:Zs};vn(Js,z),Xn.current=Date.now(),Yn.current=my({durationMs:z,documentHidden:document.hidden})?{target:Js,until:Date.now()+z+60}:null,window.setTimeout(()=>{var ft;try{((ft=Yn.current)==null?void 0:ft.target)===Js&&(Yn.current=null);const ei=e.getViewport();(Math.abs(ei.zoom-Zs)>.01||Math.abs(ei.x-Js.x)>2)&&vn(Js,0)}catch{}},z+60)}catch{}},[e,vn]);S.useEffect(()=>{const z=()=>{if(!document.hidden)return;const Y=Yn.current;if(Yn.current=null,!(!Y||Date.now()>Y.until)){try{vn(Y.target,0)}catch{}Xn.current=Date.now()}};return document.addEventListener("visibilitychange",z),()=>document.removeEventListener("visibilitychange",z)},[vn]);const Go=S.useRef(""),as=S.useRef(null),na=S.useRef(0),Vo=S.useCallback(()=>{na.current=Date.now()},[]),Or=S.useRef(null),ls=S.useRef(0),gr=S.useCallback(()=>{ls.current=Date.now()},[]),zs=S.useCallback(z=>({hasSourceEvent:!!z,at:Date.now(),lastDeckFitAt:Xn.current,lastCanvasInputAt:ls.current}),[]),ra="agent-dag.autoFitDisabled",Rl=S.useState(()=>{if(typeof window>"u")return!1;try{return window.localStorage.getItem(ra)==="1"}catch{return!1}})[0],vr=S.useRef(Rl),[Bs,Yo]=S.useState(Rl),Ko=S.useCallback(()=>{if(!vr.current){vr.current=!0,Yo(!0);try{window.localStorage.setItem(ra,"1")}catch{}}},[]),yr=S.useCallback(()=>{vr.current=!1,Yo(!1);try{window.localStorage.removeItem(ra)}catch{}Cn(400)},[e,Cn]);S.useEffect(()=>{const z=setInterval(()=>{if(vr.current||Date.now()-na.current<800)return;const Y=s.current,le=Date.now(),de=[];for(const Ce of Y.agents.values())Ky(Ce,le)&&de.push({id:Ce.id});if(de.length===0)return;const be=[];for(const{id:Ce}of de){const Ue=Qn.current.get(Ce),tt=Jt.current.get(Ce)??It.current.get(Ce);!Ue||!tt||be.push({x:tt.x,y:tt.y,width:Ue.width,height:Ue.height})}kB({pane:Or.current,viewport:e.getViewport(),boxes:be})&&Cn(600)},1500);return()=>clearInterval(z)},[e]);const Us=S.useRef(!1),Qn=S.useRef(new Map),sa=S.useRef(0),Xo=S.useCallback(z=>{const Y=Qn.current;let le=!1;for(const de of z.nodeInternals.values()){const be=de.width,Ce=de.height;if(be==null||Ce==null)continue;const Ue=Y.get(de.id);Ue?(Math.abs(Ue.height-Ce)>4||Math.abs(Ue.width-be)>4)&&(Y.set(de.id,{width:be,height:Ce}),le=!0):(Y.set(de.id,{width:be,height:Ce}),le=!0)}return le&&(sa.current+=1),sa.current},[]),Ws=it(Xo),[oa,en]=S.useState(0);S.useEffect(()=>{let z=0;const Y=()=>{const de=Qn.current;let be=!1;for(const Ce of document.querySelectorAll(".react-flow__node[data-id]")){const Ue=Ce.getAttribute("data-id");if(!Ue)continue;const tt=Ce.offsetWidth,gt=Ce.offsetHeight;if(!tt||!gt)continue;const ct=de.get(Ue);(!ct||Math.abs(ct.width-tt)>4||Math.abs(ct.height-gt)>4)&&(de.set(Ue,{width:tt,height:gt}),be=!0)}be&&en(Ce=>Ce+1)};if(Us.current)return;let le=0;return document.visibilityState==="hidden"?le=window.setTimeout(Y,32):z=requestAnimationFrame(Y),()=>{cancelAnimationFrame(z),window.clearTimeout(le)}});const It=S.useRef(os.positions),ia=S.useRef(new Set),Pr=S.useRef(""),cs=S.useMemo(()=>{const z=[];for(const Y of s.current.agents.values())Ky(Y,mt)&&z.push(Y.id+(Y.parentId?`>${Y.parentId}`:""));return z.sort(),`${z.join("|")}#sv${Ws}.${oa}`},[s.current,s.current.revision,mt,Ws,oa]),$r=S.useRef(null);S.useEffect(()=>($r.current!=null&&window.clearTimeout($r.current),$r.current=window.setTimeout(()=>{wy(It.current,Jt.current)},1500),()=>{$r.current!=null&&window.clearTimeout($r.current)}),[cs]),S.useEffect(()=>{if(Go.current===cs)return;const z=Go.current;if(Go.current=cs,!z||vr.current)return;Date.now()-Xn.current>1200&&Cn(400),ta.current&&window.clearTimeout(ta.current),ta.current=window.setTimeout(()=>{vr.current||Cn(500)},280)},[cs,e,Cn]);const Hs=S.useMemo(()=>e5(s.current,l),[s.current,s.current.revision,l]),Lr=S.useMemo(()=>hB(s.current,mt),[s.current,s.current.revision,mt]),Gs=S.useRef(null),[Vs,Al]=S.useState({w:0,h:0});S.useEffect(()=>{const z=Gs.current;if(!z||typeof ResizeObserver>"u")return;const Y=new ResizeObserver(le=>{var be;const de=(be=le[0])==null?void 0:be.contentRect;de&&(Or.current={width:de.width,height:de.height},Al(Ce=>Math.abs(Ce.w-de.width)>40||Math.abs(Ce.h-de.height)>40?{w:de.width,h:de.height}:Ce))});return Y.observe(z),Or.current={width:z.clientWidth,height:z.clientHeight},Al({w:z.clientWidth,h:z.clientHeight}),()=>Y.disconnect()},[]);const sd=S.useCallback(z=>{var le,de;const Y=z.target;!(Y!=null&&Y.closest)||Y.closest(qB)!==z.currentTarget||(z.preventDefault(),(de=(le=document.activeElement)==null?void 0:le.blur)==null||de.call(le))},[]),od=S.useRef(new Map),[Qo,id]=S.useState(!1);S.useEffect(()=>{const z=window.setTimeout(()=>id(!0),2500);return()=>window.clearTimeout(z)},[]);const[ad,aa]=S.useState(!1),wr=S.useRef(null),[la,ca]=S.useState(!1),ld=S.useCallback(()=>{wr.current&&(window.clearTimeout(wr.current),wr.current=null),aa(!1)},[]),cd=S.useCallback(z=>{z.length!==0&&queueMicrotask(()=>{aa(!0),wr.current&&window.clearTimeout(wr.current),wr.current=window.setTimeout(()=>aa(!1),DB+80)})},[]);S.useEffect(()=>()=>{wr.current&&window.clearTimeout(wr.current)},[]);const Ml=Vs.w>0?Vs.w*.92:0,Il=Vs.h>0?Vs.h:0,{nodes:Tn,edges:ud}=S.useMemo(()=>n8(s.current,mt,Ml,Il,Jt.current,Qn.current,od.current,cd,Qo,la,It.current,ia.current,cs,Pr,l,Hs,Lr,E),[s.current,s.current.revision,mt,Ml,Il,Qo,la,cs,l,Hs,Lr,E,Po]),Ol=S.useMemo(()=>{const z=new Map;for(const le of Tn){const de=le.data;if(!(de!=null&&de.sessionId)||de.exitAt!=null)continue;const be=le.width,Ce=le.height;if(be==null||Ce==null)continue;const Ue=le.position.x,tt=le.position.y,gt=Ue+be,ct=tt+Ce,on=z.get(de.sessionId);on?(on.minX=Math.min(on.minX,Ue),on.minY=Math.min(on.minY,tt),on.maxX=Math.max(on.maxX,gt),on.maxY=Math.max(on.maxY,ct)):z.set(de.sessionId,{minX:Ue,minY:tt,maxX:gt,maxY:ct})}const Y=[];for(const[le,de]of z){const be=de.maxX-de.minX+ru*2,Ce=de.maxY-de.minY+ru*2;Y.push({id:`group:${le}`,type:FR,position:{x:de.minX-ru,y:de.minY-ru},data:{sessionId:le,w:be,h:Ce},width:be,height:Ce,style:{width:be,height:Ce},zIndex:-1,draggable:!0,selectable:!1,focusable:!1,deletable:!1,connectable:!1})}return Y},[Tn,mt]),dd=S.useMemo(()=>{const z=[...Ol,...Tn],Y=ot.current;return!Y||Y.size===0?z:z.map(le=>{const de=Y.get(le.id);return de?{...le,position:de}:le})},[Ol,Tn,Zi]),Ys=S.useMemo(()=>{const z=new Set;for(const Y of s.current.agents.values())for(const le of Y.tools)z.add(YR(le.name));return Object.keys(Qy).filter(Y=>z.has(Y))},[s.current,s.current.revision]);S.useEffect(()=>{if(Ys.length<=1){Lo(!1);return}let z=0;const Y=()=>{const le=Ls.current;if(le&&!document.hidden){const de=le.getBoundingClientRect(),be=Array.from(document.querySelectorAll(".react-flow__node, .tool-burst")).map(Ue=>Ue.getBoundingClientRect()),Ce=mB(de,be,8);Lo(Ue=>Ue===Ce?Ue:Ce)}z=window.setTimeout(Y,300)};return Y(),()=>window.clearTimeout(z)},[Ys.length]);const fd=S.useCallback(z=>{Cl(Y=>{const le=new Set(Y);return le.has(z)?le.delete(z):le.add(z),le})},[]),tn=h?s.current.agents.get(h):null,ua=f?Array.from(s.current.agents.values()).flatMap(z=>z.tools).find(z=>z.id===f)??null:null,Pl=S.useCallback(async()=>{try{await fetch("/api/clear",{method:"POST"})}catch{}s.current=$y(),Jt.current.clear(),Qn.current.clear(),It.current.clear(),Pr.current="",Nj(),w(),a()},[a,w]),$l=S.useRef(j);$l.current=j;const Ll=S.useRef(I);Ll.current=I;const da=S.useRef(!1);da.current=ua!=null||Rr||_!=null||N!=null||es||I||lt!=null;const us=S.useCallback(z=>{const Y=oD(z,{confirmOpen:$l.current,modalOpen:da.current});Y==="confirm"?C(!0):Y==="clear"&&(C(!1),Pl())},[Pl]),qr=S.useCallback(()=>{Jt.current.clear(),It.current.clear(),Pr.current="",Nj(),a(),window.setTimeout(()=>Cn(500),80)},[a,e,Cn]),ql=S.useCallback(()=>Cn(500),[Cn]),Ks=S.useRef(Tn);Ks.current=Tn;const fa=S.useRef(h);fa.current=h;const Zo=S.useCallback(z=>{const Y=Ks.current,le=GD(Y.map(Ce=>({id:Ce.id,x:Ce.position.x,y:Ce.position.y})),fa.current,z),de=le?Y.find(Ce=>Ce.id===le):void 0;if(!de)return;const be=yj(document.activeElement);y(de.id,!1),window.setTimeout(()=>{try{e.fitView({padding:.35,duration:350,nodes:[de]})}catch{}Xn.current=Date.now(),be&&LB(de.id)},30)},[y,e]),ha=S.useCallback(z=>{y(z,!1),window.setTimeout(()=>{try{const Y=Ks.current.find(le=>le.id===z);Y&&e.fitView({padding:.3,duration:500,nodes:[Y]}),Xn.current=Date.now()}catch{}},60)},[y,e]);S.useEffect(()=>{const z=Y=>{var tt,gt;const le=Y.target,de={tagName:le==null?void 0:le.tagName,isContentEditable:le==null?void 0:le.isContentEditable,role:(tt=le==null?void 0:le.getAttribute)==null?void 0:tt.call(le,"role"),type:le==null?void 0:le.type};if(Y.key==="Escape"){const ct=IL({overlayOpen:Ii.depth()>0,panelOnTop:Ii.topIsPanel(),typing:_w(de)});ct==="dismiss"?Ii.dismissTop():ct==="blur"?le==null||le.blur():(XD(de)&&(le==null||le.blur()),w());return}if(bw(Y))return;const be=yj(le)?(gt=le==null?void 0:le.getAttribute)==null?void 0:gt.call(le,"data-id"):null,Ce=be&&Ks.current.some(ct=>ct.id===be)?be:null,Ue=YD(Y,Ce);if(Ue.kind==="activate"){Y.preventDefault(),y(Ue.nodeId,Ue.additive);return}Ue.kind!=="node"&&(Ue.nodeId==null&&zL(de)||BL({key:Y.key,modalOpen:da.current,sheetOpen:Ll.current})||(Y.key===" "&&(Y.preventDefault(),ns()),(Y.key==="c"||Y.key==="C")&&us("shortcut"),(Y.key==="r"||Y.key==="R")&&qr(),(Y.key==="f"||Y.key==="F")&&ql(),(Y.key==="l"||Y.key==="L")&&Qi(),(Y.key==="h"||Y.key==="H")&&hr(ct=>!ct),(Y.key==="u"||Y.key==="U")&&K(ct=>!ct),(Y.key==="a"||Y.key==="A")&&xt.current.claude&&fr(),(Y.key==="j"||Y.key==="J")&&Zo(1),(Y.key==="k"||Y.key==="K")&&Zo(-1),(Y.key==="t"||Y.key==="T")&&ea(ct=>ct==="dark"?"light":"dark"),(Y.key==="m"||Y.key==="M")&&xt.current.claude&&$.current!==null&&te.current(Y.shiftKey),Y.key==="?"&&P(ct=>!ct)))};return window.addEventListener("keydown",z),()=>window.removeEventListener("keydown",z)},[us,qr,ql,w,y,Zo,ns]);const Jo=s.current.agents.size,Vt=S.useMemo(()=>J3(s.current.agents.values()),[s.current,s.current.revision]),Dl=S.useMemo(()=>e4(s.current.agents.values()),[s.current,s.current.revision]),Fl=S.useRef(null);S.useEffect(()=>{const z=d5({waiting:Vt.length,running:Dl,connected:Me}),Y=Fl.current;if(Fl.current=z,(Y==null?void 0:Y.title)!==z.title&&(document.title=z.title),(Y==null?void 0:Y.icon)!==z.icon){const le=document.querySelector('link[rel="icon"]');le&&(le.href=f5[z.icon])}},[Vt.length,Dl,Me]);const[hd,zl]=S.useState(""),pa=p5(Vt);S.useEffect(()=>{zl(z=>m5(z,pa))},[pa]);const Lt=S.useMemo(()=>gT(s.current.agents.values()),[s.current,s.current.revision]);return d.jsxs("div",{className:"app",children:[d.jsx("a",{className:"skip-link",href:"#canvas",children:"Skip to the canvas"}),d.jsxs("header",{className:"topbar",children:[d.jsxs("div",{className:"readout",children:[d.jsxs("div",{className:"brand",children:[d.jsx("span",{className:"logo"}),d.jsx("h1",{children:zt}),Oe?d.jsxs("button",{type:"button",className:"v stale",onClick:()=>{Ne(),Nn()},"aria-haspopup":"dialog","aria-label":jB({...Oe,open:kt}),title:Oe.kind==="restart"?`Running v${Oe.from}; v${Oe.to} is installed on disk. Restart to pick it up · click for what's new`:`Running v${Oe.from}; v${Oe.to} is on npm · click for what's new`,children:["v",Oe.from,d.jsx("span",{className:"v-dot","aria-hidden":!0})]}):(()=>{const z={running:$e,latest:G==null?void 0:G.latest,latestPending:G==null?void 0:G.latestPending,checkedAgo:G!=null&&G.checkedAt?zy(mt-G.checkedAt):null,checkDisabled:G==null?void 0:G.checkDisabled,checking:Ie};return d.jsxs("button",{type:"button",className:Ie?"v checking":"v",onClick:()=>{Ne(),Ge(!0)},"aria-busy":Ie||void 0,"aria-haspopup":"dialog","aria-label":EB(z),title:NB(z),children:["v",z.running]})})()]}),d.jsxs("span",{className:"status",children:[(()=>{const z=PB({connected:Me,paused:Wn,held:Gt.size,dropped:Gt.dropped});return z.resting?null:d.jsx("span",{className:`pill ${z.tone}`,title:z.title,children:d.jsxs("span",{className:"pill-box",children:[d.jsx("span",{className:"pill-widest","aria-hidden":!0,children:z.widest}),d.jsx("span",{className:"pill-label",children:z.label})]})})})(),d.jsx(X4,{usageOpen:W}),Lt.sum>0&&d.jsxs("span",{className:"stat",title:`in:${Lt.inputTokens.toLocaleString()} out:${Lt.outputTokens.toLocaleString()} cache-r:${Lt.cacheReadTokens.toLocaleString()} cache-c:${Lt.cacheCreateTokens.toLocaleString()}
162
+
163
+ ${ku}`,children:[d.jsx("span",{className:"count",children:Ct(Lt.sum)}),d.jsx("span",{className:"lbl",children:K3})]}),Lt.cost.total>0&&(()=>{let z=0,Y=0;for(const be of s.current.agents.values()){if(be.state!=="active")continue;const Ce=_n(be);z+=Ce.total,Y=Math.max(Y,((be.endedAt??mt)-be.startedAt)/1e3)}const le=Y>0?xu(z,Y):null,de=`input ${Ve(Lt.cost.input)} + output ${Ve(Lt.cost.output)} + cache r ${Ve(Lt.cost.cacheRead)} + cache w ${Ve(Lt.cost.cacheWrite)}${le?`
164
+ active burn: ${le}`:""}
165
+
166
+ ${ku}`;return d.jsxs("span",{className:"stat",title:de,children:[d.jsx("span",{className:"count",children:Ve(Lt.cost.total)}),d.jsxs("span",{className:"lbl",children:[X3,le?` · ${le}`:""]})]})})()]}),d.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:hd}),Vt.length>0&&d.jsxs("button",{type:"button",className:"waiting-stat",onClick:()=>ha(Vt[0].id),title:`Blocked waiting for you — click to go to the one that has been stuck longest:
167
+ ${Vt.map(z=>` ${z.label}: ${$u(z.waiting)} (${zy(mt-z.waiting.since)})`).join(`
168
+ `)}`,"aria-label":`${Vt.length} session${Vt.length===1?"":"s"} waiting for you`,children:[d.jsx("span",{className:"ap-pulse","aria-hidden":!0}),d.jsx("b",{children:Vt.length})," waiting"]})]}),tn&&(()=>{const z=_n(tn),Y=Math.max(0,((tn.endedAt??mt)-tn.startedAt)/1e3),le=tn.state==="active"?xu(z.total,Y):null,de=l.size-1;return d.jsxs("button",{type:"button",className:"selected-ribbon",title:`Fit view to ${tn.label}`,onClick:()=>{try{const be=Tn.find(Ce=>Ce.id===tn.id);be&&e.fitView({padding:.35,duration:500,nodes:[be]}),Xn.current=Date.now()}catch{}},children:[d.jsx("span",{className:`state-pill state-${tn.state}`,children:tn.state==="active"?"live":tn.state}),d.jsx("span",{className:"selected-label",children:tn.label}),z.total>0&&d.jsxs("span",{className:"selected-cost",children:[Ve(z.total),le?d.jsxs("span",{className:"selected-rate",children:[" · ",le]}):null]}),de>0&&d.jsxs("span",{className:"selected-extra",children:["+",de]}),d.jsx("span",{"aria-hidden":!0,className:"selected-close",onClick:be=>{be.stopPropagation(),w()},children:"×"})]})})(),d.jsxs("div",{className:"actions",children:[d.jsxs("div",{className:"action-run",children:[d.jsx("button",{className:"btn icon-btn",onClick:()=>K(z=>!z),title:`${W?"Hide":"Show"} usage panel (U)`,"aria-label":"Toggle usage panel","aria-expanded":W,"aria-controls":W?"usage-panel":void 0,children:"$"}),st.claude&&d.jsx("button",{className:"btn icon-btn",onClick:fr,title:`${T?"Hide":"Show"} accounts (A)`,"aria-label":"Toggle accounts panel","aria-expanded":T,"aria-controls":T?"accounts-panel":void 0,children:d.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[d.jsx("circle",{cx:"7",cy:"4.6",r:"2.4"}),d.jsx("path",{d:"M2.4 12c0-2.3 2.1-3.7 4.6-3.7s4.6 1.4 4.6 3.7"})]})}),d.jsx("button",{className:"btn icon-btn",onClick:()=>hr(z=>!z),title:"Usage history — ccusage (H)","aria-label":"Open usage history","aria-haspopup":"dialog",children:d.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round","aria-hidden":!0,children:[d.jsx("line",{x1:"3",y1:"11.5",x2:"3",y2:"7"}),d.jsx("line",{x1:"7",y1:"11.5",x2:"7",y2:"3"}),d.jsx("line",{x1:"11",y1:"11.5",x2:"11",y2:"8.5"})]})}),d.jsxs("button",{className:`btn icon-btn bw-btn${Un>0?" has-findings":Ar?" watching":""}`,onClick:()=>Ro(z=>!z),title:Ar?"Browser watch — watching; the deck is keeping its own copy":"Browser watch — not watching; reading the browser's history live","aria-label":`Browser watch, ${Ar?"watching":"not watching"}`+(Un>0?`, ${Un} unread`:""),"aria-haspopup":"dialog",children:[d.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5","aria-hidden":!0,children:[d.jsx("path",{d:"M0.9 7s2.2-4 6.1-4 6.1 4 6.1 4-2.2 4-6.1 4S0.9 7 0.9 7Z"}),Ar||Un>0?d.jsx("circle",{cx:"7",cy:"7",r:"1.8",fill:"currentColor",stroke:"none"}):d.jsx("line",{x1:"2.4",y1:"11.6",x2:"11.6",y2:"2.4"})]}),Un>0&&d.jsx("span",{className:"bw-badge","aria-hidden":!0,children:Un})]})]}),d.jsxs("div",{className:"action-run",children:[st.claude&&U!==null&&d.jsxs("div",{className:"sound-slot",children:[d.jsx("button",{ref:xe,className:"btn icon-btn",onClick:()=>pe(z=>!z),...ir(!1),title:_5(st,{on:U===!0,locked:He==="locked",prefs:V}),"aria-label":"Sound settings","aria-haspopup":"dialog","aria-expanded":fe,"aria-controls":fe?"sound-menu":void 0,children:d.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[d.jsx("path",{d:"M3.2 5.2h2L7.8 3v8L5.2 8.8h-2z"}),U?d.jsxs(d.Fragment,{children:[d.jsx("path",{d:"M9.8 5.4a2.4 2.4 0 0 1 0 3.2"}),d.jsx("path",{d:"M11.3 3.9a4.6 4.6 0 0 1 0 6.2"})]}):d.jsxs(d.Fragment,{children:[d.jsx("path",{d:"M10 5.6l2.6 2.8"}),d.jsx("path",{d:"M12.6 5.6L10 8.4"})]})]})}),fe&&d.jsx(RD,{onClose:()=>pe(!1),soundOn:U===!0,onToggleSound:Q,prefs:V,onLevel:(z,Y)=>se(z,{level:Y}),onFigure:(z,Y)=>se(z,{figure:Y}),onPreview:z=>X(z),openerRef:xe})]}),d.jsx("button",{className:"btn icon-btn",onClick:()=>ea(z=>z==="dark"?"light":"dark"),title:`Switch to ${Ir==="dark"?"light":"dark"} mode (T)`,"aria-label":"Toggle theme",children:Ir==="dark"?"☀":"☾"})]})]})]}),rs?d.jsxs("div",{className:"ver-banner done",role:"status",children:[d.jsx("span",{className:"ver-dot"}),d.jsxs("strong",{children:["Restarted — now running v",rs,"."]}),d.jsx("span",{className:"ver-sub",children:"The canvas replayed from the event log."})]}):Vn&&!Me?d.jsxs("div",{className:"conn-banner",role:"alert",children:[d.jsx("span",{className:"conn-dot"}),Mr?Fo==="npx"?"Fetching the new version with npx — this can take a minute…":`Restarting ${zt}…`:(()=>{const z=IB({connected:Me,paused:Wn});return d.jsxs(d.Fragment,{children:[`Lost connection to the ${zt} server. Reconnecting…`,z&&d.jsx("span",{className:"conn-sub",children:z})]})})()]}):kt&&Oe?d.jsxs("div",{className:`ver-banner ${Oe.kind}`,role:"status",children:[d.jsx("span",{className:"ver-dot"}),Oe.kind==="restart"?d.jsxs(d.Fragment,{children:[d.jsxs("strong",{children:["v",Oe.to," is installed — this deck still runs v",Oe.from,"."]}),G!=null&&G.canRestart?d.jsxs(d.Fragment,{children:[d.jsx("button",{type:"button",className:"ver-act",onClick:()=>Ds(),...ir(Mr),title:"Stop this process and bring it back on the same port. The canvas replays from the event log.",children:Mr?"restarting…":"Restart now"}),d.jsxs("button",{type:"button",className:`ver-auto${Hn?" on":""}`,role:"switch","aria-checked":Hn,onClick:rd,title:Hn?"Restarts on its own once nothing has been running for 30 seconds. Click to require a click instead.":"Only restarts when you click. Click to let it restart itself while idle.",children:[d.jsx("i",{"aria-hidden":!0}),"auto when idle"]})]}):d.jsx("span",{className:"ver-sub",title:"Node loads every module once, at startup. An upgrade replaces the files on disk but not the code already in memory, so this process keeps running the old version until it is restarted.",children:"Restart it to pick up the new code."})]}):d.jsxs(d.Fragment,{children:[d.jsxs("strong",{children:[zt," v",Oe.to," is out — you are on v",Oe.from,"."]}),(G==null?void 0:G.upgradeMode)==="install"&&Bt!=="failed"&&d.jsx("button",{type:"button",className:"ver-act",onClick:Ps,...ir(Bt==="running",Bt==="done"),title:`Runs ${((Bl=G==null?void 0:G.upgrade)==null?void 0:Bl.command)??(G==null?void 0:G.command)??"npm i -g"} here, then restarts once nothing is running.`,children:Bt==="running"?"installing…":Bt==="done"?"installed":"Update now"}),(G==null?void 0:G.upgradeMode)==="npx"&&(G==null?void 0:G.canRestart)&&d.jsx("button",{type:"button",className:"ver-act",onClick:()=>Ds({upgrade:!0}),...ir(Mr),title:`Runs ${G==null?void 0:G.command} and hands it this port. Nothing is installed globally — npx unpacks its own copy.`,children:Mr?"fetching…":Bt==="failed"?"Retry update":"Update & restart"}),Bt==="failed"?d.jsxs("span",{className:"ver-sub fail",title:((Xs=G==null?void 0:G.upgrade)==null?void 0:Xs.error)??"",children:[(G==null?void 0:G.upgradeMode)==="npx"?"update failed":"install failed",": ",((Ul=G==null?void 0:G.upgrade)==null?void 0:Ul.error)??"unknown error"," — run it yourself:"]}):(G==null?void 0:G.upgradeMode)==="npx"?d.jsx("span",{className:"ver-sub",children:G!=null&&G.canRestart?"npx cannot upgrade in place, so the deck re-runs:":yy.npx}):G!=null&&G.upgradeBlocked?d.jsx("span",{className:"ver-sub",children:Object.hasOwn(yy,G.upgradeBlocked)?yy[G.upgradeBlocked]:"cannot install from here"}):null,d.jsxs("button",{type:"button",className:"ver-cmd",onClick:Tr,title:"Copy to clipboard",children:[d.jsx("code",{children:G==null?void 0:G.command}),d.jsx("span",{className:"ver-cmd-hint",children:at?"copied":"copy"})]})]}),d.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:zn,children:"×"})]}):Co&&mn?d.jsxs("div",{className:"ver-banner",role:"status",children:[d.jsx("span",{className:"ver-dot"}),d.jsxs("strong",{children:[mn," still works — the deck is called ",zt," now."]}),G!=null&&G.renameFix?d.jsx("span",{className:"ver-sub",children:G.renameFix}):null,d.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:To,children:"×"})]}):null,W&&d.jsx(k4,{state:s.current,now:mt,providers:st,onClose:()=>K(!1)}),T&&st.claude&&d.jsx(Zq,{onClose:()=>Z(!1)}),F&&d.jsx(n4,{state:s.current,now:mt,selectedIds:l,onSelect:ha,onClose:()=>M(!1)}),d.jsxs("main",{id:"canvas",tabIndex:-1,className:`canvas-wrap${ad?" bubbling":""}${la?" dragging-any":""}`,ref:Gs,onMouseDownCapture:sd,onPointerDownCapture:gr,onPointerUpCapture:gr,onWheelCapture:gr,children:[Jo===0&&d.jsx(o8,{live:Me,everConnected:Vn,providers:st}),Ys.length>1&&d.jsx("div",{ref:Ls,className:`cat-filter-bar${$o?" occluded":""}`,role:"group","aria-label":"Filter tools by category",children:Ys.map(z=>{const Y=Ji.has(z);return d.jsxs("button",{type:"button",className:`cat-filter${Y?" off":""}`,onClick:()=>fd(z),"aria-pressed":!Y,title:`${Y?"Show":"Hide"} ${Zy[z]} tools`,children:[d.jsx("span",{className:"cat-emoji",children:Qy[z]}),d.jsx("span",{className:"cat-name",children:Zy[z]})]},z)})}),d.jsxs(WC,{nodes:dd,edges:ud,nodeTypes:$B,fitView:!Ze,fitViewOptions:{padding:.25,duration:my({durationMs:wj,documentHidden:document.hidden})?wj:0},minZoom:.2,maxZoom:1.6,panOnScroll:!0,nodesDraggable:!0,nodesConnectable:!1,selectionOnDrag:!1,nodeDragThreshold:5,onNodeClick:(z,Y)=>{if(Y.type==="sessionGroup"){w();return}y(Y.id,z.shiftKey)},onPaneClick:()=>w(),onMoveStart:z=>{mj(zs(z))&&Ko()},onMove:(z,Y)=>{Vo(),mj(zs(z))&&Ko(),as.current&&window.clearTimeout(as.current),as.current=window.setTimeout(()=>e8(Y),250)},onNodeDragStart:(z,Y)=>{var le;if(ld(),Us.current=!0,ot.current=new Map,ca(!0),Vo(),Ko(),Y.type==="sessionGroup"){const de=(le=Y.data)==null?void 0:le.sessionId,be=new Map;if(de)for(const Ce of Tn){const Ue=Ce.data;(Ue==null?void 0:Ue.sessionId)===de&&be.set(Ce.id,{x:Ce.position.x,y:Ce.position.y})}is.current={start:{x:Y.position.x,y:Y.position.y},members:be};return}Jt.current.set(Y.id,{x:Y.position.x,y:Y.position.y})},onNodeDrag:(z,Y)=>{var le;if(Vo(),Y.type==="sessionGroup"){const de=is.current;if(!de)return;const be=Y.position.x-de.start.x,Ce=Y.position.y-de.start.y;for(const[tt,gt]of de.members){const ct={x:gt.x+be,y:gt.y+Ce};Jt.current.set(tt,ct),It.current.set(tt,ct)}const Ue=ot.current;if(Ue){for(const[tt,gt]of de.members)Ue.set(tt,{x:gt.x+be,y:gt.y+Ce});Ue.set(Y.id,{x:Y.position.x,y:Y.position.y})}ts(tt=>tt+1);return}Jt.current.set(Y.id,{x:Y.position.x,y:Y.position.y}),It.current.set(Y.id,{x:Y.position.x,y:Y.position.y}),(le=ot.current)==null||le.set(Y.id,{x:Y.position.x,y:Y.position.y}),ts(de=>de+1)},onNodeDragStop:(z,Y)=>{if(Vo(),Us.current=!1,ot.current=null,ca(!1),$s(le=>le+1),Y.type==="sessionGroup"){const le=is.current;if(le){const de=Y.position.x-le.start.x,be=Y.position.y-le.start.y;for(const[Ce,Ue]of le.members){const tt={x:Ue.x+de,y:Ue.y+be};Jt.current.set(Ce,tt),It.current.set(Ce,tt)}}is.current=null,wy(It.current,Jt.current),$s(de=>de+1);return}Jt.current.set(Y.id,{x:Y.position.x,y:Y.position.y}),It.current.set(Y.id,{x:Y.position.x,y:Y.position.y}),wy(It.current,Jt.current)},children:[d.jsx(Y$,{gap:28,size:1,color:Gn["--grid-line"]}),d.jsx(u3,{}),d.jsx(H3,{agents:s.current.agents,visibleAgentIds:Lr,positions:It.current,pinned:Jt.current,measured:Qn.current,spotlight:Hs,hiddenCategories:Ji,now:mt,onOpenTool:g}),d.jsxs(B$,{showInteractive:!1,children:[d.jsx(Sr,{onClick:yr,title:Bs?"Recenter view + re-enable autofit":"Recenter view (autofit already on)","aria-label":"Recenter view",style:Bs?{color:"var(--accent)"}:void 0,children:d.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[d.jsx("circle",{cx:"12",cy:"12",r:"3.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),d.jsx("path",{d:"M12 2v4M12 18v4M2 12h4M18 12h4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})]})}),d.jsx(Sr,{onClick:ns,title:MB({paused:Wn,held:Gt.size,dropped:Gt.dropped}),"aria-label":AB,"aria-pressed":Wn,children:d.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:d.jsx("path",{d:"M9 5.5v13M15 5.5v13",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})})}),d.jsx(Sr,{onClick:qr,title:"Auto-arrange — clear pins (R)","aria-label":"Re-arrange the canvas",children:d.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[d.jsx("rect",{x:"8.5",y:"2",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),d.jsx("rect",{x:"1.5",y:"17",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),d.jsx("rect",{x:"15.5",y:"17",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),d.jsx("path",{d:"M12 7v6.5M5 17v-3.5h14V17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]})}),d.jsx(Sr,{onClick:()=>us("button"),title:"Clear the canvas and the server's event log — asks first (C)","aria-label":"Clear the canvas",children:d.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[d.jsx("path",{d:"M4 6.2h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"}),d.jsx("path",{d:"M9 6.2V4.4a1.6 1.6 0 0 1 1.6-1.6h2.8a1.6 1.6 0 0 1 1.6 1.6v1.8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),d.jsx("path",{d:"M17.4 6.4 16.7 20a2 2 0 0 1-2 1.9H9.3a2 2 0 0 1-2-1.9L6.6 6.4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),d.jsx("path",{d:"M10.3 10.6v6.8M13.7 10.6v6.8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})]})}),d.jsx(Sr,{onClick:()=>P(z=>!z),title:"Keyboard shortcuts (?)","aria-label":"Open the keyboard shortcuts","aria-haspopup":"dialog",children:d.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[d.jsx("path",{d:"M8.6 8.4a3.5 3.5 0 1 1 4.6 3.35c-.85.3-1.2 1-1.2 1.85v1",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),d.jsx("path",{d:"M12 18.4v.2",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",fill:"none"})]})})]}),d.jsx(P$,{zoomable:!0,pannable:!0,nodeColor:Ho,nodeStrokeWidth:2,maskColor:Gn["--minimap-mask"],style:pr})]})]}),A?d.jsxs("aside",{className:"detail","aria-label":"Detail",children:[d.jsx("button",{type:"button",className:"glyph-btn detail-close",title:"Close panel","aria-label":"Close detail panel",onClick:()=>q(!1),children:"×"}),tn?d.jsx(l8,{agent:tn,now:mt,onOpenTool:g,onShowSummary:z=>{O.has(z)&&(O.delete(z),Sj(O)),b(z)},onExportSession:z=>t8(s.current,z)}):d.jsx(a8,{count:Jo,workspace:Ye})]}):d.jsx("button",{type:"button",className:"detail-reopen",title:"Show detail panel","aria-label":"Show detail panel",onClick:()=>q(!0),children:"‹"}),ua&&d.jsx(t3,{tool:ua,onClose:()=>g(null)}),Rr&&d.jsx(j5,{providers:st,onClose:()=>hr(!1)}),es&&d.jsx(D5,{onClose:()=>Ro(!1),onSeen:z=>{Mo(z);try{localStorage.setItem(U1,String(z))}catch{}},onWatching:Oo,palette:Gn}),_&&(()=>{const z=s.current.agents.get(_);return z?d.jsx(YL,{agent:z,onClose:()=>k(null)}):null})(),N&&d.jsx(Q3,{state:s.current,sessionId:N,onClose:()=>{O.add(N),Sj(O),b(null)}}),lt&&d.jsx(WD,{entries:lt.entries,since:lt.since,firstRun:lt.firstRun,running:$e,onClose:()=>Mt(null)}),I&&d.jsx(fD,{onClose:()=>P(!1)}),j&&d.jsx(cD,{agentCount:Jo,onConfirm:()=>us("confirmation"),onCancel:()=>C(!1)})]})}function o8({live:e,everConnected:t,providers:n}){const s=!e;return d.jsxs("div",{className:"empty-hero",children:[d.jsxs("div",{className:"orbit-stack","aria-hidden":!0,children:[d.jsx("div",{className:"core"}),d.jsxs("div",{className:"orbit r1",children:[d.jsx("span",{className:"dot"}),d.jsx("span",{className:"dot b"})]}),d.jsxs("div",{className:"orbit r2",children:[d.jsx("span",{className:"dot"}),d.jsx("span",{className:"dot b"})]}),d.jsxs("div",{className:"orbit r3",children:[d.jsx("span",{className:"dot"}),d.jsx("span",{className:"dot b"})]})]}),s?d.jsxs(d.Fragment,{children:[d.jsx("h2",{children:t?"Disconnected from server":"Server unreachable"}),d.jsxs("p",{children:["The browser cannot reach ",d.jsx("code",{children:"/events"}),". Check that",d.jsx("code",{children:zt})," is still running in your terminal, then this page will resume automatically."]})]}):i8(n)]})}function i8(e){return d.jsxs(d.Fragment,{children:[d.jsx("h2",{children:"Waiting for Claude Code or Codex"}),d.jsxs("p",{children:["Run ",d.jsx("code",{children:"claude"})," or ",d.jsx("code",{children:"codex"})," in any folder. As soon as a session sends an event, a node appears here and grows as subagents fork and tools are called."]}),d.jsxs("p",{className:"hint-row",children:["Not seeing anything? Make sure ",d.jsx("code",{children:zt})," is running."]}),b5(e).map(t=>d.jsx("p",{className:"hint-row",children:t.spans.map((n,s)=>n.code?d.jsx("code",{children:n.text},s):d.jsx("span",{children:n.text},s))},t.provider))]})}function a8({count:e,workspace:t}){const n=CB(t);return d.jsxs(d.Fragment,{children:[d.jsx("h2",{children:"Detail"}),e===0?d.jsxs("div",{className:"hint",children:[n.lead,n.workspace!==null&&d.jsxs(d.Fragment,{children:[" ",d.jsx("code",{children:n.workspace}),n.tail]})]}):d.jsx("div",{className:"empty",children:"Click an agent to see its tools."}),d.jsx("h3",{style:{marginTop:4},children:"Shortcuts"}),d.jsxs("div",{className:"shortcuts",children:[d.jsxs("div",{className:"sc",children:[d.jsx("kbd",{children:"?"}),d.jsx("span",{children:"all shortcuts"})]}),d.jsxs("div",{className:"sc",children:[d.jsx("kbd",{children:"drag"}),d.jsx("span",{children:"move a node"})]}),d.jsxs("div",{className:"sc",children:[d.jsx("kbd",{children:"tab"}),d.jsx("span",{children:"reach the cards"})]}),d.jsxs("div",{className:"sc",children:[d.jsx("kbd",{children:"enter"}),d.jsx("span",{children:"select the focused card"})]}),d.jsxs("div",{className:"sc",children:[d.jsx("kbd",{children:"space"}),d.jsx("span",{children:"pause / resume"})]}),d.jsxs("div",{className:"sc",children:[d.jsx("kbd",{children:"J"}),d.jsx("span",{children:"next agent"})]}),d.jsxs("div",{className:"sc",children:[d.jsx("kbd",{children:"K"}),d.jsx("span",{children:"previous agent"})]}),d.jsxs("div",{className:"sc",children:[d.jsx("kbd",{children:"R"}),d.jsx("span",{children:"re-arrange"})]}),d.jsxs("div",{className:"sc",children:[d.jsx("kbd",{children:"F"}),d.jsx("span",{children:"fit view"})]}),d.jsxs("div",{className:"sc",children:[d.jsx("kbd",{children:"L"}),d.jsx("span",{children:"session list"})]}),d.jsxs("div",{className:"sc",children:[d.jsx("kbd",{children:"H"}),d.jsx("span",{children:"usage history"})]}),d.jsxs("div",{className:"sc",children:[d.jsx("kbd",{children:"U"}),d.jsx("span",{children:"usage panel"})]}),d.jsxs("div",{className:"sc",children:[d.jsx("kbd",{children:"C"}),d.jsx("span",{children:"clear canvas"})]}),d.jsxs("div",{className:"sc",children:[d.jsx("kbd",{children:"T"}),d.jsx("span",{children:"toggle theme"})]}),d.jsxs("div",{className:"sc",children:[d.jsx("kbd",{children:"Esc"}),d.jsx("span",{children:"deselect, release focus"})]})]})]})}function l8({agent:e,now:t,onOpenTool:n,onShowSummary:s,onExportSession:i}){const a=bu(e.startedAt,e.endedAt,t),l=_n(e),u=l.total>0,h=e.usage.inputTokens+e.usage.outputTokens,p=new Map;for(const N of e.tools){const b=YR(N.name);p.set(b,(p.get(b)??0)+1)}const f=e.tools.filter(N=>N.ok===!1).length,g=e.tools.filter(N=>!N.endedAt).length,y=Array.from(p.entries()).sort((N,b)=>b[1]-N[1]),w=p.has("mcp")?F3(e.tools.map(N=>N.name)):null;return d.jsxs(d.Fragment,{children:[d.jsxs("header",{className:"detail-hero",children:[d.jsxs("div",{className:"hero-line",children:[d.jsx("span",{className:`state-pill state-${e.state}`,children:e.state==="active"?"live":e.state}),d.jsx("h2",{className:"hero-title",title:e.cwd??e.label,children:e.label})]}),d.jsxs("div",{className:"hero-meta",children:[d.jsx("span",{className:"hero-meta-item",children:e.kind}),d.jsx("span",{className:"hero-sep",children:"·"}),d.jsx("span",{className:"hero-meta-item",title:`started ${new Date(e.startedAt).toLocaleString()}`,children:a}),e.model&&(()=>{const N=oT(e);return d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"hero-sep",children:"·"}),d.jsxs("span",{className:"model-chip","data-family":Pu(e.model),title:N.length>0?`${e.model}
169
+ spend on this panel also covers:
170
+ ${N.join(`
171
+ `)}`:e.model,children:[Is(e.model),N.length>0?` +${N.length}`:""]})]})})()]}),u&&d.jsxs("div",{className:"hero-cost",children:[d.jsxs("div",{className:"hero-cost-headline",children:[d.jsx("span",{className:"hero-cost-value",children:Ve(l.total)}),d.jsx("span",{className:"hero-cost-label",children:"spend"})]}),d.jsx(Sw,{cost:l})]}),d.jsxs("div",{className:"hero-actions",children:[e.kind==="root"&&e.state==="done"&&s&&d.jsx("button",{type:"button",className:"btn hero-action-btn",onClick:()=>s(e.sessionId),title:"Reopen the end-of-session recap modal",children:"Show recap"}),i&&d.jsx("button",{type:"button",className:"btn hero-action-btn",onClick:()=>i(e.sessionId),title:"Download this session as JSON",children:"Export JSON"})]})]}),e.tools.length>0&&d.jsxs("section",{className:"detail-section",children:[d.jsx("h3",{children:"Activity"}),d.jsxs("div",{className:"activity-row",children:[d.jsxs("div",{className:"activity-counters",children:[d.jsxs("span",{className:"ac-item",children:[d.jsx("b",{children:e.toolCount})," calls"]}),g>0&&d.jsxs("span",{className:"ac-item ac-live",children:[d.jsx("b",{children:g})," live"]}),f>0&&d.jsxs("span",{className:"ac-item ac-err",children:[d.jsx("b",{children:f})," err"]})]}),d.jsx("div",{className:"cat-strip",children:y.map(([N,b])=>{const _=N==="mcp"?w:null,k=_==null?void 0:_.hue,E=`${b} ${Zy[N]} call${b===1?"":"s"}`;return d.jsxs("span",{className:`cat-chip cat-${N}${k!=null?" mcp-hue":""}`,style:k!=null?{"--mcp-hue":k}:void 0,title:_?`${E}, all to ${_.label}`:E,children:[d.jsx("span",{className:"cat-emoji",children:Qy[N]}),d.jsx("span",{className:"cat-count",children:b}),_&&d.jsx("span",{className:"cat-server",children:_.label})]},N)})})]})]}),h>0&&d.jsxs("section",{className:"detail-section",children:[d.jsx("h3",{children:"Tokens"}),d.jsxs("div",{className:"tokens-grid",children:[d.jsxs("div",{children:[d.jsx("span",{className:"k",children:"in"}),d.jsx("b",{children:e.usage.inputTokens.toLocaleString()})]}),d.jsxs("div",{children:[d.jsx("span",{className:"k",children:"out"}),d.jsx("b",{children:e.usage.outputTokens.toLocaleString()})]}),d.jsxs("div",{children:[d.jsx("span",{className:"k",children:"cache r"}),d.jsx("b",{children:e.usage.cacheReadTokens.toLocaleString()})]}),d.jsxs("div",{children:[d.jsx("span",{className:"k",children:"cache c"}),d.jsx("b",{children:e.usage.cacheCreateTokens.toLocaleString()})]})]})]}),d.jsxs("section",{className:"detail-section",children:[d.jsx("h3",{children:"Identity"}),d.jsxs("div",{children:[e.cwd&&d.jsxs("div",{className:"row",children:[d.jsx("span",{className:"k",children:"cwd"}),d.jsx("span",{className:"v",title:e.cwd,children:e.cwd})]}),d.jsxs("div",{className:"row",children:[d.jsx("span",{className:"k",children:"session"}),d.jsxs("span",{className:"v",children:[e.sessionId.slice(0,12),"…"]})]}),e.parentId&&d.jsxs("div",{className:"row",children:[d.jsx("span",{className:"k",children:"parent"}),d.jsxs("span",{className:"v",children:[e.parentId.slice(0,12),"…"]})]})]})]}),e.prompts.length>0&&d.jsxs("section",{className:"detail-section",children:[d.jsxs("h3",{children:["Prompts ",d.jsx("span",{className:"section-count",children:e.prompts.length})]}),d.jsx("div",{className:"prompts",children:e.prompts.slice().reverse().map((N,b)=>{const _=d4(N.at,t);return d.jsxs("div",{className:"prompt-entry",children:[d.jsx("div",{className:"prompt-time",title:_.title,children:_.label}),d.jsx("div",{className:"prompt-text",children:N.text})]},b)})})]}),d.jsxs("section",{className:"detail-section",children:[d.jsxs("h3",{children:["Tool calls ",d.jsx("span",{className:"section-count",children:e.tools.length})]}),e.tools.length===0&&d.jsx("div",{className:"empty",children:"No tool calls yet."}),d.jsx("div",{children:e.tools.slice().reverse().map(N=>d.jsx(u8,{t:N,onClick:()=>n(N.id)},N.id))})]})]})}const c8={inflight:"in-flight",done:"done",err:"error"};function u8({t:e,onClick:t}){const n=e.endedAt==null?"inflight":e.ok===!1?"err":"done",s=iT(e,"…");return d.jsxs("button",{className:"tool clickable",title:e.inputPreview||e.name,onClick:t,children:[d.jsxs("span",{className:"name",children:[d.jsx("span",{className:`status-dot ${n}`,"aria-hidden":!0}),d.jsx("span",{className:"vis-hidden",children:c8[n]}),e.name]}),d.jsx("span",{style:{color:"var(--muted)"},children:s})]})}try{E4(window.localStorage)}catch{}const d8=VA.createRoot(document.getElementById("root"));d8.render(d.jsx(r8,{}));