agent-dag 1.45.0 → 1.46.2

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.
@@ -1,89 +0,0 @@
1
- (function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))i(o);new MutationObserver(o=>{for(const a of o)if(a.type==="childList")for(const u of a.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&i(u)}).observe(document,{childList:!0,subtree:!0});function r(o){const a={};return o.integrity&&(a.integrity=o.integrity),o.referrerPolicy&&(a.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?a.credentials="include":o.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function i(o){if(o.ep)return;o.ep=!0;const a=r(o);fetch(o.href,a)}})();var su=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function dy(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Vd={exports:{}},ma={},Gd={exports:{}},We={};/**
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 ux;function YR(){if(ux)return We;ux=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),u=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),g=Symbol.iterator;function y(I){return I===null||typeof I!="object"?null:(I=g&&I[g]||I["@@iterator"],typeof I=="function"?I:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},E=Object.assign,_={};function b(I,Y,ue){this.props=I,this.context=Y,this.refs=_,this.updater=ue||w}b.prototype.isReactComponent={},b.prototype.setState=function(I,Y){if(typeof I!="object"&&typeof I!="function"&&I!=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,I,Y,"setState")},b.prototype.forceUpdate=function(I){this.updater.enqueueForceUpdate(this,I,"forceUpdate")};function k(){}k.prototype=b.prototype;function S(I,Y,ue){this.props=I,this.context=Y,this.refs=_,this.updater=ue||w}var N=S.prototype=new k;N.constructor=S,E(N,b.prototype),N.isPureReactComponent=!0;var T=Array.isArray,A=Object.prototype.hasOwnProperty,L={current:null},P={key:!0,ref:!0,__self:!0,__source:!0};function U(I,Y,ue){var F,Z={},ne=null,B=null;if(Y!=null)for(F in Y.ref!==void 0&&(B=Y.ref),Y.key!==void 0&&(ne=""+Y.key),Y)A.call(Y,F)&&!P.hasOwnProperty(F)&&(Z[F]=Y[F]);var de=arguments.length-2;if(de===1)Z.children=ue;else if(1<de){for(var pe=Array(de),ye=0;ye<de;ye++)pe[ye]=arguments[ye+2];Z.children=pe}if(I&&I.defaultProps)for(F in de=I.defaultProps,de)Z[F]===void 0&&(Z[F]=de[F]);return{$$typeof:e,type:I,key:ne,ref:B,props:Z,_owner:L.current}}function O(I,Y){return{$$typeof:e,type:I.type,key:Y,ref:I.ref,props:I.props,_owner:I._owner}}function M(I){return typeof I=="object"&&I!==null&&I.$$typeof===e}function q(I){var Y={"=":"=0",":":"=2"};return"$"+I.replace(/[=:]/g,function(ue){return Y[ue]})}var V=/\/+/g;function Q(I,Y){return typeof I=="object"&&I!==null&&I.key!=null?q(""+I.key):Y.toString(36)}function j(I,Y,ue,F,Z){var ne=typeof I;(ne==="undefined"||ne==="boolean")&&(I=null);var B=!1;if(I===null)B=!0;else switch(ne){case"string":case"number":B=!0;break;case"object":switch(I.$$typeof){case e:case t:B=!0}}if(B)return B=I,Z=Z(B),I=F===""?"."+Q(B,0):F,T(Z)?(ue="",I!=null&&(ue=I.replace(V,"$&/")+"/"),j(Z,Y,ue,"",function(ye){return ye})):Z!=null&&(M(Z)&&(Z=O(Z,ue+(!Z.key||B&&B.key===Z.key?"":(""+Z.key).replace(V,"$&/")+"/")+I)),Y.push(Z)),1;if(B=0,F=F===""?".":F+":",T(I))for(var de=0;de<I.length;de++){ne=I[de];var pe=F+Q(ne,de);B+=j(ne,Y,ue,pe,Z)}else if(pe=y(I),typeof pe=="function")for(I=pe.call(I),de=0;!(ne=I.next()).done;)ne=ne.value,pe=F+Q(ne,de++),B+=j(ne,Y,ue,pe,Z);else if(ne==="object")throw Y=String(I),Error("Objects are not valid as a React child (found: "+(Y==="[object Object]"?"object with keys {"+Object.keys(I).join(", ")+"}":Y)+"). If you meant to render a collection of children, use an array instead.");return B}function G(I,Y,ue){if(I==null)return I;var F=[],Z=0;return j(I,F,"","",function(ne){return Y.call(ue,ne,Z++)}),F}function z(I){if(I._status===-1){var Y=I._result;Y=Y(),Y.then(function(ue){(I._status===0||I._status===-1)&&(I._status=1,I._result=ue)},function(ue){(I._status===0||I._status===-1)&&(I._status=2,I._result=ue)}),I._status===-1&&(I._status=0,I._result=Y)}if(I._status===1)return I._result.default;throw I._result}var te={current:null},J={transition:null},$={ReactCurrentDispatcher:te,ReactCurrentBatchConfig:J,ReactCurrentOwner:L};function W(){throw Error("act(...) is not supported in production builds of React.")}return We.Children={map:G,forEach:function(I,Y,ue){G(I,function(){Y.apply(this,arguments)},ue)},count:function(I){var Y=0;return G(I,function(){Y++}),Y},toArray:function(I){return G(I,function(Y){return Y})||[]},only:function(I){if(!M(I))throw Error("React.Children.only expected to receive a single React element child.");return I}},We.Component=b,We.Fragment=r,We.Profiler=o,We.PureComponent=S,We.StrictMode=i,We.Suspense=f,We.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=$,We.act=W,We.cloneElement=function(I,Y,ue){if(I==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+I+".");var F=E({},I.props),Z=I.key,ne=I.ref,B=I._owner;if(Y!=null){if(Y.ref!==void 0&&(ne=Y.ref,B=L.current),Y.key!==void 0&&(Z=""+Y.key),I.type&&I.type.defaultProps)var de=I.type.defaultProps;for(pe in Y)A.call(Y,pe)&&!P.hasOwnProperty(pe)&&(F[pe]=Y[pe]===void 0&&de!==void 0?de[pe]:Y[pe])}var pe=arguments.length-2;if(pe===1)F.children=ue;else if(1<pe){de=Array(pe);for(var ye=0;ye<pe;ye++)de[ye]=arguments[ye+2];F.children=de}return{$$typeof:e,type:I.type,key:Z,ref:ne,props:F,_owner:B}},We.createContext=function(I){return I={$$typeof:u,_currentValue:I,_currentValue2:I,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},I.Provider={$$typeof:a,_context:I},I.Consumer=I},We.createElement=U,We.createFactory=function(I){var Y=U.bind(null,I);return Y.type=I,Y},We.createRef=function(){return{current:null}},We.forwardRef=function(I){return{$$typeof:c,render:I}},We.isValidElement=M,We.lazy=function(I){return{$$typeof:d,_payload:{_status:-1,_result:I},_init:z}},We.memo=function(I,Y){return{$$typeof:p,type:I,compare:Y===void 0?null:Y}},We.startTransition=function(I){var Y=J.transition;J.transition={};try{I()}finally{J.transition=Y}},We.unstable_act=W,We.useCallback=function(I,Y){return te.current.useCallback(I,Y)},We.useContext=function(I){return te.current.useContext(I)},We.useDebugValue=function(){},We.useDeferredValue=function(I){return te.current.useDeferredValue(I)},We.useEffect=function(I,Y){return te.current.useEffect(I,Y)},We.useId=function(){return te.current.useId()},We.useImperativeHandle=function(I,Y,ue){return te.current.useImperativeHandle(I,Y,ue)},We.useInsertionEffect=function(I,Y){return te.current.useInsertionEffect(I,Y)},We.useLayoutEffect=function(I,Y){return te.current.useLayoutEffect(I,Y)},We.useMemo=function(I,Y){return te.current.useMemo(I,Y)},We.useReducer=function(I,Y,ue){return te.current.useReducer(I,Y,ue)},We.useRef=function(I){return te.current.useRef(I)},We.useState=function(I){return te.current.useState(I)},We.useSyncExternalStore=function(I,Y,ue){return te.current.useSyncExternalStore(I,Y,ue)},We.useTransition=function(){return te.current.useTransition()},We.version="18.3.1",We}var cx;function Fa(){return cx||(cx=1,Gd.exports=YR()),Gd.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 dx;function KR(){if(dx)return ma;dx=1;var e=Fa(),t=Symbol.for("react.element"),r=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,o=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a={key:!0,ref:!0,__self:!0,__source:!0};function u(c,f,p){var d,g={},y=null,w=null;p!==void 0&&(y=""+p),f.key!==void 0&&(y=""+f.key),f.ref!==void 0&&(w=f.ref);for(d in f)i.call(f,d)&&!a.hasOwnProperty(d)&&(g[d]=f[d]);if(c&&c.defaultProps)for(d in f=c.defaultProps,f)g[d]===void 0&&(g[d]=f[d]);return{$$typeof:t,type:c,key:y,ref:w,props:g,_owner:o.current}}return ma.Fragment=r,ma.jsx=u,ma.jsxs=u,ma}var fx;function XR(){return fx||(fx=1,Vd.exports=KR()),Vd.exports}var m=XR(),iu={},Yd={exports:{}},on={},Kd={exports:{}},Xd={};/**
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 hx;function QR(){return hx||(hx=1,(function(e){function t(J,$){var W=J.length;J.push($);e:for(;0<W;){var I=W-1>>>1,Y=J[I];if(0<o(Y,$))J[I]=$,J[W]=Y,W=I;else break e}}function r(J){return J.length===0?null:J[0]}function i(J){if(J.length===0)return null;var $=J[0],W=J.pop();if(W!==$){J[0]=W;e:for(var I=0,Y=J.length,ue=Y>>>1;I<ue;){var F=2*(I+1)-1,Z=J[F],ne=F+1,B=J[ne];if(0>o(Z,W))ne<Y&&0>o(B,Z)?(J[I]=B,J[ne]=W,I=ne):(J[I]=Z,J[F]=W,I=F);else if(ne<Y&&0>o(B,W))J[I]=B,J[ne]=W,I=ne;else break e}}return $}function o(J,$){var W=J.sortIndex-$.sortIndex;return W!==0?W:J.id-$.id}if(typeof performance=="object"&&typeof performance.now=="function"){var a=performance;e.unstable_now=function(){return a.now()}}else{var u=Date,c=u.now();e.unstable_now=function(){return u.now()-c}}var f=[],p=[],d=1,g=null,y=3,w=!1,E=!1,_=!1,b=typeof setTimeout=="function"?setTimeout:null,k=typeof clearTimeout=="function"?clearTimeout:null,S=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function N(J){for(var $=r(p);$!==null;){if($.callback===null)i(p);else if($.startTime<=J)i(p),$.sortIndex=$.expirationTime,t(f,$);else break;$=r(p)}}function T(J){if(_=!1,N(J),!E)if(r(f)!==null)E=!0,z(A);else{var $=r(p);$!==null&&te(T,$.startTime-J)}}function A(J,$){E=!1,_&&(_=!1,k(U),U=-1),w=!0;var W=y;try{for(N($),g=r(f);g!==null&&(!(g.expirationTime>$)||J&&!q());){var I=g.callback;if(typeof I=="function"){g.callback=null,y=g.priorityLevel;var Y=I(g.expirationTime<=$);$=e.unstable_now(),typeof Y=="function"?g.callback=Y:g===r(f)&&i(f),N($)}else i(f);g=r(f)}if(g!==null)var ue=!0;else{var F=r(p);F!==null&&te(T,F.startTime-$),ue=!1}return ue}finally{g=null,y=W,w=!1}}var L=!1,P=null,U=-1,O=5,M=-1;function q(){return!(e.unstable_now()-M<O)}function V(){if(P!==null){var J=e.unstable_now();M=J;var $=!0;try{$=P(!0,J)}finally{$?Q():(L=!1,P=null)}}else L=!1}var Q;if(typeof S=="function")Q=function(){S(V)};else if(typeof MessageChannel<"u"){var j=new MessageChannel,G=j.port2;j.port1.onmessage=V,Q=function(){G.postMessage(null)}}else Q=function(){b(V,0)};function z(J){P=J,L||(L=!0,Q())}function te(J,$){U=b(function(){J(e.unstable_now())},$)}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(J){J.callback=null},e.unstable_continueExecution=function(){E||w||(E=!0,z(A))},e.unstable_forceFrameRate=function(J){0>J||125<J?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):O=0<J?Math.floor(1e3/J):5},e.unstable_getCurrentPriorityLevel=function(){return y},e.unstable_getFirstCallbackNode=function(){return r(f)},e.unstable_next=function(J){switch(y){case 1:case 2:case 3:var $=3;break;default:$=y}var W=y;y=$;try{return J()}finally{y=W}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(J,$){switch(J){case 1:case 2:case 3:case 4:case 5:break;default:J=3}var W=y;y=J;try{return $()}finally{y=W}},e.unstable_scheduleCallback=function(J,$,W){var I=e.unstable_now();switch(typeof W=="object"&&W!==null?(W=W.delay,W=typeof W=="number"&&0<W?I+W:I):W=I,J){case 1:var Y=-1;break;case 2:Y=250;break;case 5:Y=1073741823;break;case 4:Y=1e4;break;default:Y=5e3}return Y=W+Y,J={id:d++,callback:$,priorityLevel:J,startTime:W,expirationTime:Y,sortIndex:-1},W>I?(J.sortIndex=W,t(p,J),r(f)===null&&J===r(p)&&(_?(k(U),U=-1):_=!0,te(T,W-I))):(J.sortIndex=Y,t(f,J),E||w||(E=!0,z(A))),J},e.unstable_shouldYield=q,e.unstable_wrapCallback=function(J){var $=y;return function(){var W=y;y=$;try{return J.apply(this,arguments)}finally{y=W}}}})(Xd)),Xd}var px;function ZR(){return px||(px=1,Kd.exports=QR()),Kd.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 mx;function JR(){if(mx)return on;mx=1;var e=Fa(),t=ZR();function r(n){for(var s="https://reactjs.org/docs/error-decoder.html?invariant="+n,l=1;l<arguments.length;l++)s+="&args[]="+encodeURIComponent(arguments[l]);return"Minified React error #"+n+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var i=new Set,o={};function a(n,s){u(n,s),u(n+"Capture",s)}function u(n,s){for(o[n]=s,n=0;n<s.length;n++)i.add(s[n])}var c=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),f=Object.prototype.hasOwnProperty,p=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,d={},g={};function y(n){return f.call(g,n)?!0:f.call(d,n)?!1:p.test(n)?g[n]=!0:(d[n]=!0,!1)}function w(n,s,l,h){if(l!==null&&l.type===0)return!1;switch(typeof s){case"function":case"symbol":return!0;case"boolean":return h?!1:l!==null?!l.acceptsBooleans:(n=n.toLowerCase().slice(0,5),n!=="data-"&&n!=="aria-");default:return!1}}function E(n,s,l,h){if(s===null||typeof s>"u"||w(n,s,l,h))return!0;if(h)return!1;if(l!==null)switch(l.type){case 3:return!s;case 4:return s===!1;case 5:return isNaN(s);case 6:return isNaN(s)||1>s}return!1}function _(n,s,l,h,v,x,R){this.acceptsBooleans=s===2||s===3||s===4,this.attributeName=h,this.attributeNamespace=v,this.mustUseProperty=l,this.propertyName=n,this.type=s,this.sanitizeURL=x,this.removeEmptyString=R}var b={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(n){b[n]=new _(n,0,!1,n,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(n){var s=n[0];b[s]=new _(s,1,!1,n[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(n){b[n]=new _(n,2,!1,n.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(n){b[n]=new _(n,2,!1,n,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(n){b[n]=new _(n,3,!1,n.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(n){b[n]=new _(n,3,!0,n,null,!1,!1)}),["capture","download"].forEach(function(n){b[n]=new _(n,4,!1,n,null,!1,!1)}),["cols","rows","size","span"].forEach(function(n){b[n]=new _(n,6,!1,n,null,!1,!1)}),["rowSpan","start"].forEach(function(n){b[n]=new _(n,5,!1,n.toLowerCase(),null,!1,!1)});var k=/[\-:]([a-z])/g;function S(n){return n[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(n){var s=n.replace(k,S);b[s]=new _(s,1,!1,n,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(n){var s=n.replace(k,S);b[s]=new _(s,1,!1,n,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(n){var s=n.replace(k,S);b[s]=new _(s,1,!1,n,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(n){b[n]=new _(n,1,!1,n.toLowerCase(),null,!1,!1)}),b.xlinkHref=new _("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(n){b[n]=new _(n,1,!1,n.toLowerCase(),null,!0,!0)});function N(n,s,l,h){var v=b.hasOwnProperty(s)?b[s]:null;(v!==null?v.type!==0:h||!(2<s.length)||s[0]!=="o"&&s[0]!=="O"||s[1]!=="n"&&s[1]!=="N")&&(E(s,l,v,h)&&(l=null),h||v===null?y(s)&&(l===null?n.removeAttribute(s):n.setAttribute(s,""+l)):v.mustUseProperty?n[v.propertyName]=l===null?v.type===3?!1:"":l:(s=v.attributeName,h=v.attributeNamespace,l===null?n.removeAttribute(s):(v=v.type,l=v===3||v===4&&l===!0?"":""+l,h?n.setAttributeNS(h,s,l):n.setAttribute(s,l))))}var T=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,A=Symbol.for("react.element"),L=Symbol.for("react.portal"),P=Symbol.for("react.fragment"),U=Symbol.for("react.strict_mode"),O=Symbol.for("react.profiler"),M=Symbol.for("react.provider"),q=Symbol.for("react.context"),V=Symbol.for("react.forward_ref"),Q=Symbol.for("react.suspense"),j=Symbol.for("react.suspense_list"),G=Symbol.for("react.memo"),z=Symbol.for("react.lazy"),te=Symbol.for("react.offscreen"),J=Symbol.iterator;function $(n){return n===null||typeof n!="object"?null:(n=J&&n[J]||n["@@iterator"],typeof n=="function"?n:null)}var W=Object.assign,I;function Y(n){if(I===void 0)try{throw Error()}catch(l){var s=l.stack.trim().match(/\n( *(at )?)/);I=s&&s[1]||""}return`
34
- `+I+n}var ue=!1;function F(n,s){if(!n||ue)return"";ue=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(s)if(s=function(){throw Error()},Object.defineProperty(s.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(s,[])}catch(oe){var h=oe}Reflect.construct(n,[],s)}else{try{s.call()}catch(oe){h=oe}n.call(s.prototype)}else{try{throw Error()}catch(oe){h=oe}n()}}catch(oe){if(oe&&h&&typeof oe.stack=="string"){for(var v=oe.stack.split(`
35
- `),x=h.stack.split(`
36
- `),R=v.length-1,D=x.length-1;1<=R&&0<=D&&v[R]!==x[D];)D--;for(;1<=R&&0<=D;R--,D--)if(v[R]!==x[D]){if(R!==1||D!==1)do if(R--,D--,0>D||v[R]!==x[D]){var X=`
37
- `+v[R].replace(" at new "," at ");return n.displayName&&X.includes("<anonymous>")&&(X=X.replace("<anonymous>",n.displayName)),X}while(1<=R&&0<=D);break}}}finally{ue=!1,Error.prepareStackTrace=l}return(n=n?n.displayName||n.name:"")?Y(n):""}function Z(n){switch(n.tag){case 5:return Y(n.type);case 16:return Y("Lazy");case 13:return Y("Suspense");case 19:return Y("SuspenseList");case 0:case 2:case 15:return n=F(n.type,!1),n;case 11:return n=F(n.type.render,!1),n;case 1:return n=F(n.type,!0),n;default:return""}}function ne(n){if(n==null)return null;if(typeof n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case P:return"Fragment";case L:return"Portal";case O:return"Profiler";case U:return"StrictMode";case Q:return"Suspense";case j:return"SuspenseList"}if(typeof n=="object")switch(n.$$typeof){case q:return(n.displayName||"Context")+".Consumer";case M:return(n._context.displayName||"Context")+".Provider";case V:var s=n.render;return n=n.displayName,n||(n=s.displayName||s.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case G:return s=n.displayName||null,s!==null?s:ne(n.type)||"Memo";case z:s=n._payload,n=n._init;try{return ne(n(s))}catch{}}return null}function B(n){var s=n.type;switch(n.tag){case 24:return"Cache";case 9:return(s.displayName||"Context")+".Consumer";case 10:return(s._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return n=s.render,n=n.displayName||n.name||"",s.displayName||(n!==""?"ForwardRef("+n+")":"ForwardRef");case 7:return"Fragment";case 5:return s;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ne(s);case 8:return s===U?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof s=="function")return s.displayName||s.name||null;if(typeof s=="string")return s}return null}function de(n){switch(typeof n){case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function pe(n){var s=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function ye(n){var s=pe(n)?"checked":"value",l=Object.getOwnPropertyDescriptor(n.constructor.prototype,s),h=""+n[s];if(!n.hasOwnProperty(s)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var v=l.get,x=l.set;return Object.defineProperty(n,s,{configurable:!0,get:function(){return v.call(this)},set:function(R){h=""+R,x.call(this,R)}}),Object.defineProperty(n,s,{enumerable:l.enumerable}),{getValue:function(){return h},setValue:function(R){h=""+R},stopTracking:function(){n._valueTracker=null,delete n[s]}}}}function Pe(n){n._valueTracker||(n._valueTracker=ye(n))}function Ue(n){if(!n)return!1;var s=n._valueTracker;if(!s)return!0;var l=s.getValue(),h="";return n&&(h=pe(n)?n.checked?"true":"false":n.value),n=h,n!==l?(s.setValue(n),!0):!1}function De(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}function Me(n,s){var l=s.checked;return W({},s,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:l??n._wrapperState.initialChecked})}function _e(n,s){var l=s.defaultValue==null?"":s.defaultValue,h=s.checked!=null?s.checked:s.defaultChecked;l=de(s.value!=null?s.value:l),n._wrapperState={initialChecked:h,initialValue:l,controlled:s.type==="checkbox"||s.type==="radio"?s.checked!=null:s.value!=null}}function Fe(n,s){s=s.checked,s!=null&&N(n,"checked",s,!1)}function we(n,s){Fe(n,s);var l=de(s.value),h=s.type;if(l!=null)h==="number"?(l===0&&n.value===""||n.value!=l)&&(n.value=""+l):n.value!==""+l&&(n.value=""+l);else if(h==="submit"||h==="reset"){n.removeAttribute("value");return}s.hasOwnProperty("value")?Ke(n,s.type,l):s.hasOwnProperty("defaultValue")&&Ke(n,s.type,de(s.defaultValue)),s.checked==null&&s.defaultChecked!=null&&(n.defaultChecked=!!s.defaultChecked)}function fe(n,s,l){if(s.hasOwnProperty("value")||s.hasOwnProperty("defaultValue")){var h=s.type;if(!(h!=="submit"&&h!=="reset"||s.value!==void 0&&s.value!==null))return;s=""+n._wrapperState.initialValue,l||s===n.value||(n.value=s),n.defaultValue=s}l=n.name,l!==""&&(n.name=""),n.defaultChecked=!!n._wrapperState.initialChecked,l!==""&&(n.name=l)}function Ke(n,s,l){(s!=="number"||De(n.ownerDocument)!==n)&&(l==null?n.defaultValue=""+n._wrapperState.initialValue:n.defaultValue!==""+l&&(n.defaultValue=""+l))}var gt=Array.isArray;function tt(n,s,l,h){if(n=n.options,s){s={};for(var v=0;v<l.length;v++)s["$"+l[v]]=!0;for(l=0;l<n.length;l++)v=s.hasOwnProperty("$"+n[l].value),n[l].selected!==v&&(n[l].selected=v),v&&h&&(n[l].defaultSelected=!0)}else{for(l=""+de(l),s=null,v=0;v<n.length;v++){if(n[v].value===l){n[v].selected=!0,h&&(n[v].defaultSelected=!0);return}s!==null||n[v].disabled||(s=n[v])}s!==null&&(s.selected=!0)}}function ot(n,s){if(s.dangerouslySetInnerHTML!=null)throw Error(r(91));return W({},s,{value:void 0,defaultValue:void 0,children:""+n._wrapperState.initialValue})}function Be(n,s){var l=s.value;if(l==null){if(l=s.children,s=s.defaultValue,l!=null){if(s!=null)throw Error(r(92));if(gt(l)){if(1<l.length)throw Error(r(93));l=l[0]}s=l}s==null&&(s=""),l=s}n._wrapperState={initialValue:de(l)}}function Ze(n,s){var l=de(s.value),h=de(s.defaultValue);l!=null&&(l=""+l,l!==n.value&&(n.value=l),s.defaultValue==null&&n.defaultValue!==l&&(n.defaultValue=l)),h!=null&&(n.defaultValue=""+h)}function ut(n){var s=n.textContent;s===n._wrapperState.initialValue&&s!==""&&s!==null&&(n.value=s)}function _t(n){switch(n){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 ie(n,s){return n==null||n==="http://www.w3.org/1999/xhtml"?_t(s):n==="http://www.w3.org/2000/svg"&&s==="foreignObject"?"http://www.w3.org/1999/xhtml":n}var qe,Oe=(function(n){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(s,l,h,v){MSApp.execUnsafeLocalFunction(function(){return n(s,l,h,v)})}:n})(function(n,s){if(n.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in n)n.innerHTML=s;else{for(qe=qe||document.createElement("div"),qe.innerHTML="<svg>"+s.valueOf().toString()+"</svg>",s=qe.firstChild;n.firstChild;)n.removeChild(n.firstChild);for(;s.firstChild;)n.appendChild(s.firstChild)}});function Te(n,s){if(s){var l=n.firstChild;if(l&&l===n.lastChild&&l.nodeType===3){l.nodeValue=s;return}}n.textContent=s}var ze={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},He=["Webkit","ms","Moz","O"];Object.keys(ze).forEach(function(n){He.forEach(function(s){s=s+n.charAt(0).toUpperCase()+n.substring(1),ze[s]=ze[n]})});function Je(n,s,l){return s==null||typeof s=="boolean"||s===""?"":l||typeof s!="number"||s===0||ze.hasOwnProperty(n)&&ze[n]?(""+s).trim():s+"px"}function ke(n,s){n=n.style;for(var l in s)if(s.hasOwnProperty(l)){var h=l.indexOf("--")===0,v=Je(l,s[l],h);l==="float"&&(l="cssFloat"),h?n.setProperty(l,v):n[l]=v}}var bt=W({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function nt(n,s){if(s){if(bt[n]&&(s.children!=null||s.dangerouslySetInnerHTML!=null))throw Error(r(137,n));if(s.dangerouslySetInnerHTML!=null){if(s.children!=null)throw Error(r(60));if(typeof s.dangerouslySetInnerHTML!="object"||!("__html"in s.dangerouslySetInnerHTML))throw Error(r(61))}if(s.style!=null&&typeof s.style!="object")throw Error(r(62))}}function at(n,s){if(n.indexOf("-")===-1)return typeof s.is=="string";switch(n){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 yn=null;function or(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var un=null,wn=null,xn=null;function cn(n){if(n=ea(n)){if(typeof un!="function")throw Error(r(280));var s=n.stateNode;s&&(s=wl(s),un(n.stateNode,n.type,s))}}function _i(n){wn?xn?xn.push(n):xn=[n]:wn=n}function Cs(){if(wn){var n=wn,s=xn;if(xn=wn=null,cn(n),s)for(n=0;n<s.length;n++)cn(s[n])}}function ar(n,s){return n(s)}function bi(){}var Gr=!1;function Ft(n,s,l){if(Gr)return n(s,l);Gr=!0;try{return ar(n,s,l)}finally{Gr=!1,(wn!==null||xn!==null)&&(bi(),Cs())}}function _n(n,s){var l=n.stateNode;if(l===null)return null;var h=wl(l);if(h===null)return null;l=h[s];e:switch(s){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(h=!h.disabled)||(n=n.type,h=!(n==="button"||n==="input"||n==="select"||n==="textarea")),n=!h;break e;default:n=!1}if(n)return null;if(l&&typeof l!="function")throw Error(r(231,s,typeof l));return l}var js=!1;if(c)try{var Fn={};Object.defineProperty(Fn,"passive",{get:function(){js=!0}}),window.addEventListener("test",Fn,Fn),window.removeEventListener("test",Fn,Fn)}catch{js=!1}function kt(n,s,l,h,v,x,R,D,X){var oe=Array.prototype.slice.call(arguments,3);try{s.apply(l,oe)}catch(me){this.onError(me)}}var br=!1,bn=null,Yr=!1,Ts=null,zn={onError:function(n){br=!0,bn=n}};function Kr(n,s,l,h,v,x,R,D,X){br=!1,bn=null,kt.apply(zn,arguments)}function ki(n,s,l,h,v,x,R,D,X){if(Kr.apply(this,arguments),br){if(br){var oe=bn;br=!1,bn=null}else throw Error(r(198));Yr||(Yr=!0,Ts=oe)}}function Bn(n){var s=n,l=n;if(n.alternate)for(;s.return;)s=s.return;else{n=s;do s=n,(s.flags&4098)!==0&&(l=s.return),n=s.return;while(n)}return s.tag===3?l:null}function Rs(n){if(n.tag===13){var s=n.memoizedState;if(s===null&&(n=n.alternate,n!==null&&(s=n.memoizedState)),s!==null)return s.dehydrated}return null}function As(n){if(Bn(n)!==n)throw Error(r(188))}function lr(n){var s=n.alternate;if(!s){if(s=Bn(n),s===null)throw Error(r(188));return s!==n?null:n}for(var l=n,h=s;;){var v=l.return;if(v===null)break;var x=v.alternate;if(x===null){if(h=v.return,h!==null){l=h;continue}break}if(v.child===x.child){for(x=v.child;x;){if(x===l)return As(v),n;if(x===h)return As(v),s;x=x.sibling}throw Error(r(188))}if(l.return!==h.return)l=v,h=x;else{for(var R=!1,D=v.child;D;){if(D===l){R=!0,l=v,h=x;break}if(D===h){R=!0,h=v,l=x;break}D=D.sibling}if(!R){for(D=x.child;D;){if(D===l){R=!0,l=x,h=v;break}if(D===h){R=!0,h=x,l=v;break}D=D.sibling}if(!R)throw Error(r(189))}}if(l.alternate!==h)throw Error(r(190))}if(l.tag!==3)throw Error(r(188));return l.stateNode.current===l?n:s}function Is(n){return n=lr(n),n!==null?Ms(n):null}function Ms(n){if(n.tag===5||n.tag===6)return n;for(n=n.child;n!==null;){var s=Ms(n);if(s!==null)return s;n=n.sibling}return null}var kr=t.unstable_scheduleCallback,Os=t.unstable_cancelCallback,Ps=t.unstable_shouldYield,Pt=t.unstable_requestPaint,st=t.unstable_now,Xr=t.unstable_getCurrentPriorityLevel,Qr=t.unstable_ImmediatePriority,Si=t.unstable_UserBlockingPriority,kn=t.unstable_NormalPriority,Ls=t.unstable_LowPriority,Sn=t.unstable_IdlePriority,Zr=null,Vt=null;function $s(n){if(Vt&&typeof Vt.onCommitFiberRoot=="function")try{Vt.onCommitFiberRoot(Zr,n,void 0,(n.current.flags&128)===128)}catch{}}var dn=Math.clz32?Math.clz32:Sr,el=Math.log,wc=Math.LN2;function Sr(n){return n>>>=0,n===0?32:31-(el(n)/wc|0)|0}var ur=64,qs=4194304;function Er(n){switch(n&-n){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 n&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return n&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return n}}function fn(n,s){var l=n.pendingLanes;if(l===0)return 0;var h=0,v=n.suspendedLanes,x=n.pingedLanes,R=l&268435455;if(R!==0){var D=R&~v;D!==0?h=Er(D):(x&=R,x!==0&&(h=Er(x)))}else R=l&~v,R!==0?h=Er(R):x!==0&&(h=Er(x));if(h===0)return 0;if(s!==0&&s!==h&&(s&v)===0&&(v=h&-h,x=s&-s,v>=x||v===16&&(x&4194240)!==0))return s;if((h&4)!==0&&(h|=l&16),s=n.entangledLanes,s!==0)for(n=n.entanglements,s&=h;0<s;)l=31-dn(s),v=1<<l,h|=n[l],s&=~v;return h}function xc(n,s){switch(n){case 1:case 2:case 4:return s+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 s+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 En(n,s){for(var l=n.suspendedLanes,h=n.pingedLanes,v=n.expirationTimes,x=n.pendingLanes;0<x;){var R=31-dn(x),D=1<<R,X=v[R];X===-1?((D&l)===0||(D&h)!==0)&&(v[R]=xc(D,s)):X<=s&&(n.expiredLanes|=D),x&=~D}}function Ds(n){return n=n.pendingLanes&-1073741825,n!==0?n:n&1073741824?1073741824:0}function Ei(){var n=ur;return ur<<=1,(ur&4194240)===0&&(ur=64),n}function Ni(n){for(var s=[],l=0;31>l;l++)s.push(n);return s}function cr(n,s,l){n.pendingLanes|=s,s!==536870912&&(n.suspendedLanes=0,n.pingedLanes=0),n=n.eventTimes,s=31-dn(s),n[s]=l}function Io(n,s){var l=n.pendingLanes&~s;n.pendingLanes=s,n.suspendedLanes=0,n.pingedLanes=0,n.expiredLanes&=s,n.mutableReadLanes&=s,n.entangledLanes&=s,s=n.entanglements;var h=n.eventTimes;for(n=n.expirationTimes;0<l;){var v=31-dn(l),x=1<<v;s[v]=0,h[v]=-1,n[v]=-1,l&=~x}}function Ci(n,s){var l=n.entangledLanes|=s;for(n=n.entanglements;l;){var h=31-dn(l),v=1<<h;v&s|n[h]&s&&(n[h]|=s),l&=~v}}var Xe=0;function Mo(n){return n&=-n,1<n?4<n?(n&268435455)!==0?16:536870912:4:1}var ji,Ti,Nr,Oo,Po,Fs=!1,Ri=[],Nn=null,Gt=null,Un=null,zs=new Map,Jr=new Map,Hn=[],_c="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 Yt(n,s){switch(n){case"focusin":case"focusout":Nn=null;break;case"dragenter":case"dragleave":Gt=null;break;case"mouseover":case"mouseout":Un=null;break;case"pointerover":case"pointerout":zs.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":Jr.delete(s.pointerId)}}function Bs(n,s,l,h,v,x){return n===null||n.nativeEvent!==x?(n={blockedOn:s,domEventName:l,eventSystemFlags:h,nativeEvent:x,targetContainers:[v]},s!==null&&(s=ea(s),s!==null&&Ti(s)),n):(n.eventSystemFlags|=h,s=n.targetContainers,v!==null&&s.indexOf(v)===-1&&s.push(v),n)}function Lo(n,s,l,h,v){switch(s){case"focusin":return Nn=Bs(Nn,n,s,l,h,v),!0;case"dragenter":return Gt=Bs(Gt,n,s,l,h,v),!0;case"mouseover":return Un=Bs(Un,n,s,l,h,v),!0;case"pointerover":var x=v.pointerId;return zs.set(x,Bs(zs.get(x)||null,n,s,l,h,v)),!0;case"gotpointercapture":return x=v.pointerId,Jr.set(x,Bs(Jr.get(x)||null,n,s,l,h,v)),!0}return!1}function Cr(n){var s=Ks(n.target);if(s!==null){var l=Bn(s);if(l!==null){if(s=l.tag,s===13){if(s=Rs(l),s!==null){n.blockedOn=s,Po(n.priority,function(){Nr(l)});return}}else if(s===3&&l.stateNode.current.memoizedState.isDehydrated){n.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}n.blockedOn=null}function dr(n){if(n.blockedOn!==null)return!1;for(var s=n.targetContainers;0<s.length;){var l=Us(n.domEventName,n.eventSystemFlags,s[0],n.nativeEvent);if(l===null){l=n.nativeEvent;var h=new l.constructor(l.type,l);yn=h,l.target.dispatchEvent(h),yn=null}else return s=ea(l),s!==null&&Ti(s),n.blockedOn=l,!1;s.shift()}return!0}function Ai(n,s,l){dr(n)&&l.delete(s)}function $o(){Fs=!1,Nn!==null&&dr(Nn)&&(Nn=null),Gt!==null&&dr(Gt)&&(Gt=null),Un!==null&&dr(Un)&&(Un=null),zs.forEach(Ai),Jr.forEach(Ai)}function es(n,s){n.blockedOn===s&&(n.blockedOn=null,Fs||(Fs=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,$o)))}function fr(n){function s(v){return es(v,n)}if(0<Ri.length){es(Ri[0],n);for(var l=1;l<Ri.length;l++){var h=Ri[l];h.blockedOn===n&&(h.blockedOn=null)}}for(Nn!==null&&es(Nn,n),Gt!==null&&es(Gt,n),Un!==null&&es(Un,n),zs.forEach(s),Jr.forEach(s),l=0;l<Hn.length;l++)h=Hn[l],h.blockedOn===n&&(h.blockedOn=null);for(;0<Hn.length&&(l=Hn[0],l.blockedOn===null);)Cr(l),l.blockedOn===null&&Hn.shift()}var jr=T.ReactCurrentBatchConfig,Ii=!0;function bc(n,s,l,h){var v=Xe,x=jr.transition;jr.transition=null;try{Xe=1,qo(n,s,l,h)}finally{Xe=v,jr.transition=x}}function tl(n,s,l,h){var v=Xe,x=jr.transition;jr.transition=null;try{Xe=4,qo(n,s,l,h)}finally{Xe=v,jr.transition=x}}function qo(n,s,l,h){if(Ii){var v=Us(n,s,l,h);if(v===null)Lc(n,s,h,Mi,l),Yt(n,h);else if(Lo(v,n,s,l,h))h.stopPropagation();else if(Yt(n,h),s&4&&-1<_c.indexOf(n)){for(;v!==null;){var x=ea(v);if(x!==null&&ji(x),x=Us(n,s,l,h),x===null&&Lc(n,s,h,Mi,l),x===v)break;v=x}v!==null&&h.stopPropagation()}else Lc(n,s,h,null,l)}}var Mi=null;function Us(n,s,l,h){if(Mi=null,n=or(h),n=Ks(n),n!==null)if(s=Bn(n),s===null)n=null;else if(l=s.tag,l===13){if(n=Rs(s),n!==null)return n;n=null}else if(l===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;n=null}else s!==n&&(n=null);return Mi=n,null}function Wn(n){switch(n){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(Xr()){case Qr:return 1;case Si:return 4;case kn:case Ls:return 16;case Sn:return 536870912;default:return 16}default:return 16}}var Cn=null,Oi=null,Pi=null;function nl(){if(Pi)return Pi;var n,s=Oi,l=s.length,h,v="value"in Cn?Cn.value:Cn.textContent,x=v.length;for(n=0;n<l&&s[n]===v[n];n++);var R=l-n;for(h=1;h<=R&&s[l-h]===v[x-h];h++);return Pi=v.slice(n,1<h?1-h:void 0)}function Hs(n){var s=n.keyCode;return"charCode"in n?(n=n.charCode,n===0&&s===13&&(n=13)):n=s,n===10&&(n=13),32<=n||n===13?n:0}function Ws(){return!0}function Vn(){return!1}function Kt(n){function s(l,h,v,x,R){this._reactName=l,this._targetInst=v,this.type=h,this.nativeEvent=x,this.target=R,this.currentTarget=null;for(var D in n)n.hasOwnProperty(D)&&(l=n[D],this[D]=l?l(x):x[D]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?Ws:Vn,this.isPropagationStopped=Vn,this}return W(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var l=this.nativeEvent;l&&(l.preventDefault?l.preventDefault():typeof l.returnValue!="unknown"&&(l.returnValue=!1),this.isDefaultPrevented=Ws)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=Ws)},persist:function(){},isPersistent:Ws}),s}var Tr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Do=Kt(Tr),hr=W({},Tr,{view:0,detail:0}),kc=Kt(hr),Lt,Vs,ts,Gs=W({},hr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Di,button:0,buttons:0,relatedTarget:function(n){return n.relatedTarget===void 0?n.fromElement===n.srcElement?n.toElement:n.fromElement:n.relatedTarget},movementX:function(n){return"movementX"in n?n.movementX:(n!==ts&&(ts&&n.type==="mousemove"?(Lt=n.screenX-ts.screenX,Vs=n.screenY-ts.screenY):Vs=Lt=0,ts=n),Lt)},movementY:function(n){return"movementY"in n?n.movementY:Vs}}),Fo=Kt(Gs),zo=W({},Gs,{dataTransfer:0}),Li=Kt(zo),Bo=W({},hr,{relatedTarget:0}),$i=Kt(Bo),qi=W({},Tr,{animationName:0,elapsedTime:0,pseudoElement:0}),rl=Kt(qi),Uo=W({},Tr,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),sl=Kt(Uo),Ho=W({},Tr,{data:0}),jn=Kt(Ho),il={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},ol={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"},Sc={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Ec(n){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(n):(n=Sc[n])?!!s[n]:!1}function Di(){return Ec}var Jt=W({},hr,{key:function(n){if(n.key){var s=il[n.key]||n.key;if(s!=="Unidentified")return s}return n.type==="keypress"?(n=Hs(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?ol[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Di,charCode:function(n){return n.type==="keypress"?Hs(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?Hs(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),al=Kt(Jt),ll=W({},Gs,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Wo=Kt(ll),ul=W({},hr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Di}),H=Kt(ul),K=W({},Tr,{propertyName:0,elapsedTime:0,pseudoElement:0}),le=Kt(K),ce=W({},Gs,{deltaX:function(n){return"deltaX"in n?n.deltaX:"wheelDeltaX"in n?-n.wheelDeltaX:0},deltaY:function(n){return"deltaY"in n?n.deltaY:"wheelDeltaY"in n?-n.wheelDeltaY:"wheelDelta"in n?-n.wheelDelta:0},deltaZ:0,deltaMode:0}),Se=Kt(ce),Ne=[9,13,27,32],Le=c&&"CompositionEvent"in window,Ye=null;c&&"documentMode"in document&&(Ye=document.documentMode);var ft=c&&"TextEvent"in window&&!Ye,it=c&&(!Le||Ye&&8<Ye&&11>=Ye),Xt=" ",Ys=!1;function Vo(n,s){switch(n){case"keyup":return Ne.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function cl(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var Rr=!1;function Nc(n,s){switch(n){case"compositionend":return cl(s);case"keypress":return s.which!==32?null:(Ys=!0,Xt);case"textInput":return n=s.data,n===Xt&&Ys?null:n;default:return null}}function dl(n,s){if(Rr)return n==="compositionend"||!Le&&Vo(n,s)?(n=nl(),Pi=Oi=Cn=null,Rr=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1<s.char.length)return s.char;if(s.which)return String.fromCharCode(s.which)}return null;case"compositionend":return it&&s.locale!=="ko"?null:s.data;default:return null}}var Go={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 ns(n){var s=n&&n.nodeName&&n.nodeName.toLowerCase();return s==="input"?!!Go[n.type]:s==="textarea"}function rs(n,s,l,h){_i(h),s=gl(s,"onChange"),0<s.length&&(l=new Do("onChange","change",null,l,h),n.push({event:l,listeners:s}))}var ht=null,ss=null;function YT(n){E0(n,0)}function fl(n){var s=Hi(n);if(Ue(s))return n}function KT(n,s){if(n==="change")return s}var l0=!1;if(c){var Cc;if(c){var jc="oninput"in document;if(!jc){var u0=document.createElement("div");u0.setAttribute("oninput","return;"),jc=typeof u0.oninput=="function"}Cc=jc}else Cc=!1;l0=Cc&&(!document.documentMode||9<document.documentMode)}function c0(){ht&&(ht.detachEvent("onpropertychange",d0),ss=ht=null)}function d0(n){if(n.propertyName==="value"&&fl(ss)){var s=[];rs(s,ss,n,or(n)),Ft(YT,s)}}function XT(n,s,l){n==="focusin"?(c0(),ht=s,ss=l,ht.attachEvent("onpropertychange",d0)):n==="focusout"&&c0()}function QT(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return fl(ss)}function ZT(n,s){if(n==="click")return fl(s)}function JT(n,s){if(n==="input"||n==="change")return fl(s)}function eR(n,s){return n===s&&(n!==0||1/n===1/s)||n!==n&&s!==s}var Gn=typeof Object.is=="function"?Object.is:eR;function Yo(n,s){if(Gn(n,s))return!0;if(typeof n!="object"||n===null||typeof s!="object"||s===null)return!1;var l=Object.keys(n),h=Object.keys(s);if(l.length!==h.length)return!1;for(h=0;h<l.length;h++){var v=l[h];if(!f.call(s,v)||!Gn(n[v],s[v]))return!1}return!0}function f0(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function h0(n,s){var l=f0(n);n=0;for(var h;l;){if(l.nodeType===3){if(h=n+l.textContent.length,n<=s&&h>=s)return{node:l,offset:s-n};n=h}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=f0(l)}}function p0(n,s){return n&&s?n===s?!0:n&&n.nodeType===3?!1:s&&s.nodeType===3?p0(n,s.parentNode):"contains"in n?n.contains(s):n.compareDocumentPosition?!!(n.compareDocumentPosition(s)&16):!1:!1}function m0(){for(var n=window,s=De();s instanceof n.HTMLIFrameElement;){try{var l=typeof s.contentWindow.location.href=="string"}catch{l=!1}if(l)n=s.contentWindow;else break;s=De(n.document)}return s}function Tc(n){var s=n&&n.nodeName&&n.nodeName.toLowerCase();return s&&(s==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||s==="textarea"||n.contentEditable==="true")}function tR(n){var s=m0(),l=n.focusedElem,h=n.selectionRange;if(s!==l&&l&&l.ownerDocument&&p0(l.ownerDocument.documentElement,l)){if(h!==null&&Tc(l)){if(s=h.start,n=h.end,n===void 0&&(n=s),"selectionStart"in l)l.selectionStart=s,l.selectionEnd=Math.min(n,l.value.length);else if(n=(s=l.ownerDocument||document)&&s.defaultView||window,n.getSelection){n=n.getSelection();var v=l.textContent.length,x=Math.min(h.start,v);h=h.end===void 0?x:Math.min(h.end,v),!n.extend&&x>h&&(v=h,h=x,x=v),v=h0(l,x);var R=h0(l,h);v&&R&&(n.rangeCount!==1||n.anchorNode!==v.node||n.anchorOffset!==v.offset||n.focusNode!==R.node||n.focusOffset!==R.offset)&&(s=s.createRange(),s.setStart(v.node,v.offset),n.removeAllRanges(),x>h?(n.addRange(s),n.extend(R.node,R.offset)):(s.setEnd(R.node,R.offset),n.addRange(s)))}}for(s=[],n=l;n=n.parentNode;)n.nodeType===1&&s.push({element:n,left:n.scrollLeft,top:n.scrollTop});for(typeof l.focus=="function"&&l.focus(),l=0;l<s.length;l++)n=s[l],n.element.scrollLeft=n.left,n.element.scrollTop=n.top}}var nR=c&&"documentMode"in document&&11>=document.documentMode,Fi=null,Rc=null,Ko=null,Ac=!1;function g0(n,s,l){var h=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;Ac||Fi==null||Fi!==De(h)||(h=Fi,"selectionStart"in h&&Tc(h)?h={start:h.selectionStart,end:h.selectionEnd}:(h=(h.ownerDocument&&h.ownerDocument.defaultView||window).getSelection(),h={anchorNode:h.anchorNode,anchorOffset:h.anchorOffset,focusNode:h.focusNode,focusOffset:h.focusOffset}),Ko&&Yo(Ko,h)||(Ko=h,h=gl(Rc,"onSelect"),0<h.length&&(s=new Do("onSelect","select",null,s,l),n.push({event:s,listeners:h}),s.target=Fi)))}function hl(n,s){var l={};return l[n.toLowerCase()]=s.toLowerCase(),l["Webkit"+n]="webkit"+s,l["Moz"+n]="moz"+s,l}var zi={animationend:hl("Animation","AnimationEnd"),animationiteration:hl("Animation","AnimationIteration"),animationstart:hl("Animation","AnimationStart"),transitionend:hl("Transition","TransitionEnd")},Ic={},v0={};c&&(v0=document.createElement("div").style,"AnimationEvent"in window||(delete zi.animationend.animation,delete zi.animationiteration.animation,delete zi.animationstart.animation),"TransitionEvent"in window||delete zi.transitionend.transition);function pl(n){if(Ic[n])return Ic[n];if(!zi[n])return n;var s=zi[n],l;for(l in s)if(s.hasOwnProperty(l)&&l in v0)return Ic[n]=s[l];return n}var y0=pl("animationend"),w0=pl("animationiteration"),x0=pl("animationstart"),_0=pl("transitionend"),b0=new Map,k0="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 is(n,s){b0.set(n,s),a(s,[n])}for(var Mc=0;Mc<k0.length;Mc++){var Oc=k0[Mc],rR=Oc.toLowerCase(),sR=Oc[0].toUpperCase()+Oc.slice(1);is(rR,"on"+sR)}is(y0,"onAnimationEnd"),is(w0,"onAnimationIteration"),is(x0,"onAnimationStart"),is("dblclick","onDoubleClick"),is("focusin","onFocus"),is("focusout","onBlur"),is(_0,"onTransitionEnd"),u("onMouseEnter",["mouseout","mouseover"]),u("onMouseLeave",["mouseout","mouseover"]),u("onPointerEnter",["pointerout","pointerover"]),u("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 Xo="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(" "),iR=new Set("cancel close invalid load scroll toggle".split(" ").concat(Xo));function S0(n,s,l){var h=n.type||"unknown-event";n.currentTarget=l,ki(h,s,void 0,n),n.currentTarget=null}function E0(n,s){s=(s&4)!==0;for(var l=0;l<n.length;l++){var h=n[l],v=h.event;h=h.listeners;e:{var x=void 0;if(s)for(var R=h.length-1;0<=R;R--){var D=h[R],X=D.instance,oe=D.currentTarget;if(D=D.listener,X!==x&&v.isPropagationStopped())break e;S0(v,D,oe),x=X}else for(R=0;R<h.length;R++){if(D=h[R],X=D.instance,oe=D.currentTarget,D=D.listener,X!==x&&v.isPropagationStopped())break e;S0(v,D,oe),x=X}}}if(Yr)throw n=Ts,Yr=!1,Ts=null,n}function ct(n,s){var l=s[Bc];l===void 0&&(l=s[Bc]=new Set);var h=n+"__bubble";l.has(h)||(N0(s,n,2,!1),l.add(h))}function Pc(n,s,l){var h=0;s&&(h|=4),N0(l,n,h,s)}var ml="_reactListening"+Math.random().toString(36).slice(2);function Qo(n){if(!n[ml]){n[ml]=!0,i.forEach(function(l){l!=="selectionchange"&&(iR.has(l)||Pc(l,!1,n),Pc(l,!0,n))});var s=n.nodeType===9?n:n.ownerDocument;s===null||s[ml]||(s[ml]=!0,Pc("selectionchange",!1,s))}}function N0(n,s,l,h){switch(Wn(s)){case 1:var v=bc;break;case 4:v=tl;break;default:v=qo}l=v.bind(null,s,l,n),v=void 0,!js||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(v=!0),h?v!==void 0?n.addEventListener(s,l,{capture:!0,passive:v}):n.addEventListener(s,l,!0):v!==void 0?n.addEventListener(s,l,{passive:v}):n.addEventListener(s,l,!1)}function Lc(n,s,l,h,v){var x=h;if((s&1)===0&&(s&2)===0&&h!==null)e:for(;;){if(h===null)return;var R=h.tag;if(R===3||R===4){var D=h.stateNode.containerInfo;if(D===v||D.nodeType===8&&D.parentNode===v)break;if(R===4)for(R=h.return;R!==null;){var X=R.tag;if((X===3||X===4)&&(X=R.stateNode.containerInfo,X===v||X.nodeType===8&&X.parentNode===v))return;R=R.return}for(;D!==null;){if(R=Ks(D),R===null)return;if(X=R.tag,X===5||X===6){h=x=R;continue e}D=D.parentNode}}h=h.return}Ft(function(){var oe=x,me=or(l),ge=[];e:{var he=b0.get(n);if(he!==void 0){var xe=Do,Ee=n;switch(n){case"keypress":if(Hs(l)===0)break e;case"keydown":case"keyup":xe=al;break;case"focusin":Ee="focus",xe=$i;break;case"focusout":Ee="blur",xe=$i;break;case"beforeblur":case"afterblur":xe=$i;break;case"click":if(l.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":xe=Fo;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":xe=Li;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":xe=H;break;case y0:case w0:case x0:xe=rl;break;case _0:xe=le;break;case"scroll":xe=kc;break;case"wheel":xe=Se;break;case"copy":case"cut":case"paste":xe=sl;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":xe=Wo}var Ce=(s&4)!==0,St=!Ce&&n==="scroll",re=Ce?he!==null?he+"Capture":null:he;Ce=[];for(var ee=oe,se;ee!==null;){se=ee;var ve=se.stateNode;if(se.tag===5&&ve!==null&&(se=ve,re!==null&&(ve=_n(ee,re),ve!=null&&Ce.push(Zo(ee,ve,se)))),St)break;ee=ee.return}0<Ce.length&&(he=new xe(he,Ee,null,l,me),ge.push({event:he,listeners:Ce}))}}if((s&7)===0){e:{if(he=n==="mouseover"||n==="pointerover",xe=n==="mouseout"||n==="pointerout",he&&l!==yn&&(Ee=l.relatedTarget||l.fromElement)&&(Ks(Ee)||Ee[Ar]))break e;if((xe||he)&&(he=me.window===me?me:(he=me.ownerDocument)?he.defaultView||he.parentWindow:window,xe?(Ee=l.relatedTarget||l.toElement,xe=oe,Ee=Ee?Ks(Ee):null,Ee!==null&&(St=Bn(Ee),Ee!==St||Ee.tag!==5&&Ee.tag!==6)&&(Ee=null)):(xe=null,Ee=oe),xe!==Ee)){if(Ce=Fo,ve="onMouseLeave",re="onMouseEnter",ee="mouse",(n==="pointerout"||n==="pointerover")&&(Ce=Wo,ve="onPointerLeave",re="onPointerEnter",ee="pointer"),St=xe==null?he:Hi(xe),se=Ee==null?he:Hi(Ee),he=new Ce(ve,ee+"leave",xe,l,me),he.target=St,he.relatedTarget=se,ve=null,Ks(me)===oe&&(Ce=new Ce(re,ee+"enter",Ee,l,me),Ce.target=se,Ce.relatedTarget=St,ve=Ce),St=ve,xe&&Ee)t:{for(Ce=xe,re=Ee,ee=0,se=Ce;se;se=Bi(se))ee++;for(se=0,ve=re;ve;ve=Bi(ve))se++;for(;0<ee-se;)Ce=Bi(Ce),ee--;for(;0<se-ee;)re=Bi(re),se--;for(;ee--;){if(Ce===re||re!==null&&Ce===re.alternate)break t;Ce=Bi(Ce),re=Bi(re)}Ce=null}else Ce=null;xe!==null&&C0(ge,he,xe,Ce,!1),Ee!==null&&St!==null&&C0(ge,St,Ee,Ce,!0)}}e:{if(he=oe?Hi(oe):window,xe=he.nodeName&&he.nodeName.toLowerCase(),xe==="select"||xe==="input"&&he.type==="file")var je=KT;else if(ns(he))if(l0)je=JT;else{je=QT;var Ae=XT}else(xe=he.nodeName)&&xe.toLowerCase()==="input"&&(he.type==="checkbox"||he.type==="radio")&&(je=ZT);if(je&&(je=je(n,oe))){rs(ge,je,l,me);break e}Ae&&Ae(n,he,oe),n==="focusout"&&(Ae=he._wrapperState)&&Ae.controlled&&he.type==="number"&&Ke(he,"number",he.value)}switch(Ae=oe?Hi(oe):window,n){case"focusin":(ns(Ae)||Ae.contentEditable==="true")&&(Fi=Ae,Rc=oe,Ko=null);break;case"focusout":Ko=Rc=Fi=null;break;case"mousedown":Ac=!0;break;case"contextmenu":case"mouseup":case"dragend":Ac=!1,g0(ge,l,me);break;case"selectionchange":if(nR)break;case"keydown":case"keyup":g0(ge,l,me)}var Ie;if(Le)e:{switch(n){case"compositionstart":var $e="onCompositionStart";break e;case"compositionend":$e="onCompositionEnd";break e;case"compositionupdate":$e="onCompositionUpdate";break e}$e=void 0}else Rr?Vo(n,l)&&($e="onCompositionEnd"):n==="keydown"&&l.keyCode===229&&($e="onCompositionStart");$e&&(it&&l.locale!=="ko"&&(Rr||$e!=="onCompositionStart"?$e==="onCompositionEnd"&&Rr&&(Ie=nl()):(Cn=me,Oi="value"in Cn?Cn.value:Cn.textContent,Rr=!0)),Ae=gl(oe,$e),0<Ae.length&&($e=new jn($e,n,null,l,me),ge.push({event:$e,listeners:Ae}),Ie?$e.data=Ie:(Ie=cl(l),Ie!==null&&($e.data=Ie)))),(Ie=ft?Nc(n,l):dl(n,l))&&(oe=gl(oe,"onBeforeInput"),0<oe.length&&(me=new jn("onBeforeInput","beforeinput",null,l,me),ge.push({event:me,listeners:oe}),me.data=Ie))}E0(ge,s)})}function Zo(n,s,l){return{instance:n,listener:s,currentTarget:l}}function gl(n,s){for(var l=s+"Capture",h=[];n!==null;){var v=n,x=v.stateNode;v.tag===5&&x!==null&&(v=x,x=_n(n,l),x!=null&&h.unshift(Zo(n,x,v)),x=_n(n,s),x!=null&&h.push(Zo(n,x,v))),n=n.return}return h}function Bi(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5);return n||null}function C0(n,s,l,h,v){for(var x=s._reactName,R=[];l!==null&&l!==h;){var D=l,X=D.alternate,oe=D.stateNode;if(X!==null&&X===h)break;D.tag===5&&oe!==null&&(D=oe,v?(X=_n(l,x),X!=null&&R.unshift(Zo(l,X,D))):v||(X=_n(l,x),X!=null&&R.push(Zo(l,X,D)))),l=l.return}R.length!==0&&n.push({event:s,listeners:R})}var oR=/\r\n?/g,aR=/\u0000|\uFFFD/g;function j0(n){return(typeof n=="string"?n:""+n).replace(oR,`
38
- `).replace(aR,"")}function vl(n,s,l){if(s=j0(s),j0(n)!==s&&l)throw Error(r(425))}function yl(){}var $c=null,qc=null;function Dc(n,s){return n==="textarea"||n==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var Fc=typeof setTimeout=="function"?setTimeout:void 0,lR=typeof clearTimeout=="function"?clearTimeout:void 0,T0=typeof Promise=="function"?Promise:void 0,uR=typeof queueMicrotask=="function"?queueMicrotask:typeof T0<"u"?function(n){return T0.resolve(null).then(n).catch(cR)}:Fc;function cR(n){setTimeout(function(){throw n})}function zc(n,s){var l=s,h=0;do{var v=l.nextSibling;if(n.removeChild(l),v&&v.nodeType===8)if(l=v.data,l==="/$"){if(h===0){n.removeChild(v),fr(s);return}h--}else l!=="$"&&l!=="$?"&&l!=="$!"||h++;l=v}while(l);fr(s)}function os(n){for(;n!=null;n=n.nextSibling){var s=n.nodeType;if(s===1||s===3)break;if(s===8){if(s=n.data,s==="$"||s==="$!"||s==="$?")break;if(s==="/$")return null}}return n}function R0(n){n=n.previousSibling;for(var s=0;n;){if(n.nodeType===8){var l=n.data;if(l==="$"||l==="$!"||l==="$?"){if(s===0)return n;s--}else l==="/$"&&s++}n=n.previousSibling}return null}var Ui=Math.random().toString(36).slice(2),pr="__reactFiber$"+Ui,Jo="__reactProps$"+Ui,Ar="__reactContainer$"+Ui,Bc="__reactEvents$"+Ui,dR="__reactListeners$"+Ui,fR="__reactHandles$"+Ui;function Ks(n){var s=n[pr];if(s)return s;for(var l=n.parentNode;l;){if(s=l[Ar]||l[pr]){if(l=s.alternate,s.child!==null||l!==null&&l.child!==null)for(n=R0(n);n!==null;){if(l=n[pr])return l;n=R0(n)}return s}n=l,l=n.parentNode}return null}function ea(n){return n=n[pr]||n[Ar],!n||n.tag!==5&&n.tag!==6&&n.tag!==13&&n.tag!==3?null:n}function Hi(n){if(n.tag===5||n.tag===6)return n.stateNode;throw Error(r(33))}function wl(n){return n[Jo]||null}var Uc=[],Wi=-1;function as(n){return{current:n}}function dt(n){0>Wi||(n.current=Uc[Wi],Uc[Wi]=null,Wi--)}function lt(n,s){Wi++,Uc[Wi]=n.current,n.current=s}var ls={},zt=as(ls),en=as(!1),Xs=ls;function Vi(n,s){var l=n.type.contextTypes;if(!l)return ls;var h=n.stateNode;if(h&&h.__reactInternalMemoizedUnmaskedChildContext===s)return h.__reactInternalMemoizedMaskedChildContext;var v={},x;for(x in l)v[x]=s[x];return h&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=s,n.__reactInternalMemoizedMaskedChildContext=v),v}function tn(n){return n=n.childContextTypes,n!=null}function xl(){dt(en),dt(zt)}function A0(n,s,l){if(zt.current!==ls)throw Error(r(168));lt(zt,s),lt(en,l)}function I0(n,s,l){var h=n.stateNode;if(s=s.childContextTypes,typeof h.getChildContext!="function")return l;h=h.getChildContext();for(var v in h)if(!(v in s))throw Error(r(108,B(n)||"Unknown",v));return W({},l,h)}function _l(n){return n=(n=n.stateNode)&&n.__reactInternalMemoizedMergedChildContext||ls,Xs=zt.current,lt(zt,n),lt(en,en.current),!0}function M0(n,s,l){var h=n.stateNode;if(!h)throw Error(r(169));l?(n=I0(n,s,Xs),h.__reactInternalMemoizedMergedChildContext=n,dt(en),dt(zt),lt(zt,n)):dt(en),lt(en,l)}var Ir=null,bl=!1,Hc=!1;function O0(n){Ir===null?Ir=[n]:Ir.push(n)}function hR(n){bl=!0,O0(n)}function us(){if(!Hc&&Ir!==null){Hc=!0;var n=0,s=Xe;try{var l=Ir;for(Xe=1;n<l.length;n++){var h=l[n];do h=h(!0);while(h!==null)}Ir=null,bl=!1}catch(v){throw Ir!==null&&(Ir=Ir.slice(n+1)),kr(Qr,us),v}finally{Xe=s,Hc=!1}}return null}var Gi=[],Yi=0,kl=null,Sl=0,Tn=[],Rn=0,Qs=null,Mr=1,Or="";function Zs(n,s){Gi[Yi++]=Sl,Gi[Yi++]=kl,kl=n,Sl=s}function P0(n,s,l){Tn[Rn++]=Mr,Tn[Rn++]=Or,Tn[Rn++]=Qs,Qs=n;var h=Mr;n=Or;var v=32-dn(h)-1;h&=~(1<<v),l+=1;var x=32-dn(s)+v;if(30<x){var R=v-v%5;x=(h&(1<<R)-1).toString(32),h>>=R,v-=R,Mr=1<<32-dn(s)+v|l<<v|h,Or=x+n}else Mr=1<<x|l<<v|h,Or=n}function Wc(n){n.return!==null&&(Zs(n,1),P0(n,1,0))}function Vc(n){for(;n===kl;)kl=Gi[--Yi],Gi[Yi]=null,Sl=Gi[--Yi],Gi[Yi]=null;for(;n===Qs;)Qs=Tn[--Rn],Tn[Rn]=null,Or=Tn[--Rn],Tn[Rn]=null,Mr=Tn[--Rn],Tn[Rn]=null}var hn=null,pn=null,pt=!1,Yn=null;function L0(n,s){var l=On(5,null,null,0);l.elementType="DELETED",l.stateNode=s,l.return=n,s=n.deletions,s===null?(n.deletions=[l],n.flags|=16):s.push(l)}function $0(n,s){switch(n.tag){case 5:var l=n.type;return s=s.nodeType!==1||l.toLowerCase()!==s.nodeName.toLowerCase()?null:s,s!==null?(n.stateNode=s,hn=n,pn=os(s.firstChild),!0):!1;case 6:return s=n.pendingProps===""||s.nodeType!==3?null:s,s!==null?(n.stateNode=s,hn=n,pn=null,!0):!1;case 13:return s=s.nodeType!==8?null:s,s!==null?(l=Qs!==null?{id:Mr,overflow:Or}:null,n.memoizedState={dehydrated:s,treeContext:l,retryLane:1073741824},l=On(18,null,null,0),l.stateNode=s,l.return=n,n.child=l,hn=n,pn=null,!0):!1;default:return!1}}function Gc(n){return(n.mode&1)!==0&&(n.flags&128)===0}function Yc(n){if(pt){var s=pn;if(s){var l=s;if(!$0(n,s)){if(Gc(n))throw Error(r(418));s=os(l.nextSibling);var h=hn;s&&$0(n,s)?L0(h,l):(n.flags=n.flags&-4097|2,pt=!1,hn=n)}}else{if(Gc(n))throw Error(r(418));n.flags=n.flags&-4097|2,pt=!1,hn=n}}}function q0(n){for(n=n.return;n!==null&&n.tag!==5&&n.tag!==3&&n.tag!==13;)n=n.return;hn=n}function El(n){if(n!==hn)return!1;if(!pt)return q0(n),pt=!0,!1;var s;if((s=n.tag!==3)&&!(s=n.tag!==5)&&(s=n.type,s=s!=="head"&&s!=="body"&&!Dc(n.type,n.memoizedProps)),s&&(s=pn)){if(Gc(n))throw D0(),Error(r(418));for(;s;)L0(n,s),s=os(s.nextSibling)}if(q0(n),n.tag===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(r(317));e:{for(n=n.nextSibling,s=0;n;){if(n.nodeType===8){var l=n.data;if(l==="/$"){if(s===0){pn=os(n.nextSibling);break e}s--}else l!=="$"&&l!=="$!"&&l!=="$?"||s++}n=n.nextSibling}pn=null}}else pn=hn?os(n.stateNode.nextSibling):null;return!0}function D0(){for(var n=pn;n;)n=os(n.nextSibling)}function Ki(){pn=hn=null,pt=!1}function Kc(n){Yn===null?Yn=[n]:Yn.push(n)}var pR=T.ReactCurrentBatchConfig;function ta(n,s,l){if(n=l.ref,n!==null&&typeof n!="function"&&typeof n!="object"){if(l._owner){if(l=l._owner,l){if(l.tag!==1)throw Error(r(309));var h=l.stateNode}if(!h)throw Error(r(147,n));var v=h,x=""+n;return s!==null&&s.ref!==null&&typeof s.ref=="function"&&s.ref._stringRef===x?s.ref:(s=function(R){var D=v.refs;R===null?delete D[x]:D[x]=R},s._stringRef=x,s)}if(typeof n!="string")throw Error(r(284));if(!l._owner)throw Error(r(290,n))}return n}function Nl(n,s){throw n=Object.prototype.toString.call(s),Error(r(31,n==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":n))}function F0(n){var s=n._init;return s(n._payload)}function z0(n){function s(re,ee){if(n){var se=re.deletions;se===null?(re.deletions=[ee],re.flags|=16):se.push(ee)}}function l(re,ee){if(!n)return null;for(;ee!==null;)s(re,ee),ee=ee.sibling;return null}function h(re,ee){for(re=new Map;ee!==null;)ee.key!==null?re.set(ee.key,ee):re.set(ee.index,ee),ee=ee.sibling;return re}function v(re,ee){return re=vs(re,ee),re.index=0,re.sibling=null,re}function x(re,ee,se){return re.index=se,n?(se=re.alternate,se!==null?(se=se.index,se<ee?(re.flags|=2,ee):se):(re.flags|=2,ee)):(re.flags|=1048576,ee)}function R(re){return n&&re.alternate===null&&(re.flags|=2),re}function D(re,ee,se,ve){return ee===null||ee.tag!==6?(ee=Fd(se,re.mode,ve),ee.return=re,ee):(ee=v(ee,se),ee.return=re,ee)}function X(re,ee,se,ve){var je=se.type;return je===P?me(re,ee,se.props.children,ve,se.key):ee!==null&&(ee.elementType===je||typeof je=="object"&&je!==null&&je.$$typeof===z&&F0(je)===ee.type)?(ve=v(ee,se.props),ve.ref=ta(re,ee,se),ve.return=re,ve):(ve=Xl(se.type,se.key,se.props,null,re.mode,ve),ve.ref=ta(re,ee,se),ve.return=re,ve)}function oe(re,ee,se,ve){return ee===null||ee.tag!==4||ee.stateNode.containerInfo!==se.containerInfo||ee.stateNode.implementation!==se.implementation?(ee=zd(se,re.mode,ve),ee.return=re,ee):(ee=v(ee,se.children||[]),ee.return=re,ee)}function me(re,ee,se,ve,je){return ee===null||ee.tag!==7?(ee=oi(se,re.mode,ve,je),ee.return=re,ee):(ee=v(ee,se),ee.return=re,ee)}function ge(re,ee,se){if(typeof ee=="string"&&ee!==""||typeof ee=="number")return ee=Fd(""+ee,re.mode,se),ee.return=re,ee;if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case A:return se=Xl(ee.type,ee.key,ee.props,null,re.mode,se),se.ref=ta(re,null,ee),se.return=re,se;case L:return ee=zd(ee,re.mode,se),ee.return=re,ee;case z:var ve=ee._init;return ge(re,ve(ee._payload),se)}if(gt(ee)||$(ee))return ee=oi(ee,re.mode,se,null),ee.return=re,ee;Nl(re,ee)}return null}function he(re,ee,se,ve){var je=ee!==null?ee.key:null;if(typeof se=="string"&&se!==""||typeof se=="number")return je!==null?null:D(re,ee,""+se,ve);if(typeof se=="object"&&se!==null){switch(se.$$typeof){case A:return se.key===je?X(re,ee,se,ve):null;case L:return se.key===je?oe(re,ee,se,ve):null;case z:return je=se._init,he(re,ee,je(se._payload),ve)}if(gt(se)||$(se))return je!==null?null:me(re,ee,se,ve,null);Nl(re,se)}return null}function xe(re,ee,se,ve,je){if(typeof ve=="string"&&ve!==""||typeof ve=="number")return re=re.get(se)||null,D(ee,re,""+ve,je);if(typeof ve=="object"&&ve!==null){switch(ve.$$typeof){case A:return re=re.get(ve.key===null?se:ve.key)||null,X(ee,re,ve,je);case L:return re=re.get(ve.key===null?se:ve.key)||null,oe(ee,re,ve,je);case z:var Ae=ve._init;return xe(re,ee,se,Ae(ve._payload),je)}if(gt(ve)||$(ve))return re=re.get(se)||null,me(ee,re,ve,je,null);Nl(ee,ve)}return null}function Ee(re,ee,se,ve){for(var je=null,Ae=null,Ie=ee,$e=ee=0,Ot=null;Ie!==null&&$e<se.length;$e++){Ie.index>$e?(Ot=Ie,Ie=null):Ot=Ie.sibling;var et=he(re,Ie,se[$e],ve);if(et===null){Ie===null&&(Ie=Ot);break}n&&Ie&&et.alternate===null&&s(re,Ie),ee=x(et,ee,$e),Ae===null?je=et:Ae.sibling=et,Ae=et,Ie=Ot}if($e===se.length)return l(re,Ie),pt&&Zs(re,$e),je;if(Ie===null){for(;$e<se.length;$e++)Ie=ge(re,se[$e],ve),Ie!==null&&(ee=x(Ie,ee,$e),Ae===null?je=Ie:Ae.sibling=Ie,Ae=Ie);return pt&&Zs(re,$e),je}for(Ie=h(re,Ie);$e<se.length;$e++)Ot=xe(Ie,re,$e,se[$e],ve),Ot!==null&&(n&&Ot.alternate!==null&&Ie.delete(Ot.key===null?$e:Ot.key),ee=x(Ot,ee,$e),Ae===null?je=Ot:Ae.sibling=Ot,Ae=Ot);return n&&Ie.forEach(function(ys){return s(re,ys)}),pt&&Zs(re,$e),je}function Ce(re,ee,se,ve){var je=$(se);if(typeof je!="function")throw Error(r(150));if(se=je.call(se),se==null)throw Error(r(151));for(var Ae=je=null,Ie=ee,$e=ee=0,Ot=null,et=se.next();Ie!==null&&!et.done;$e++,et=se.next()){Ie.index>$e?(Ot=Ie,Ie=null):Ot=Ie.sibling;var ys=he(re,Ie,et.value,ve);if(ys===null){Ie===null&&(Ie=Ot);break}n&&Ie&&ys.alternate===null&&s(re,Ie),ee=x(ys,ee,$e),Ae===null?je=ys:Ae.sibling=ys,Ae=ys,Ie=Ot}if(et.done)return l(re,Ie),pt&&Zs(re,$e),je;if(Ie===null){for(;!et.done;$e++,et=se.next())et=ge(re,et.value,ve),et!==null&&(ee=x(et,ee,$e),Ae===null?je=et:Ae.sibling=et,Ae=et);return pt&&Zs(re,$e),je}for(Ie=h(re,Ie);!et.done;$e++,et=se.next())et=xe(Ie,re,$e,et.value,ve),et!==null&&(n&&et.alternate!==null&&Ie.delete(et.key===null?$e:et.key),ee=x(et,ee,$e),Ae===null?je=et:Ae.sibling=et,Ae=et);return n&&Ie.forEach(function(GR){return s(re,GR)}),pt&&Zs(re,$e),je}function St(re,ee,se,ve){if(typeof se=="object"&&se!==null&&se.type===P&&se.key===null&&(se=se.props.children),typeof se=="object"&&se!==null){switch(se.$$typeof){case A:e:{for(var je=se.key,Ae=ee;Ae!==null;){if(Ae.key===je){if(je=se.type,je===P){if(Ae.tag===7){l(re,Ae.sibling),ee=v(Ae,se.props.children),ee.return=re,re=ee;break e}}else if(Ae.elementType===je||typeof je=="object"&&je!==null&&je.$$typeof===z&&F0(je)===Ae.type){l(re,Ae.sibling),ee=v(Ae,se.props),ee.ref=ta(re,Ae,se),ee.return=re,re=ee;break e}l(re,Ae);break}else s(re,Ae);Ae=Ae.sibling}se.type===P?(ee=oi(se.props.children,re.mode,ve,se.key),ee.return=re,re=ee):(ve=Xl(se.type,se.key,se.props,null,re.mode,ve),ve.ref=ta(re,ee,se),ve.return=re,re=ve)}return R(re);case L:e:{for(Ae=se.key;ee!==null;){if(ee.key===Ae)if(ee.tag===4&&ee.stateNode.containerInfo===se.containerInfo&&ee.stateNode.implementation===se.implementation){l(re,ee.sibling),ee=v(ee,se.children||[]),ee.return=re,re=ee;break e}else{l(re,ee);break}else s(re,ee);ee=ee.sibling}ee=zd(se,re.mode,ve),ee.return=re,re=ee}return R(re);case z:return Ae=se._init,St(re,ee,Ae(se._payload),ve)}if(gt(se))return Ee(re,ee,se,ve);if($(se))return Ce(re,ee,se,ve);Nl(re,se)}return typeof se=="string"&&se!==""||typeof se=="number"?(se=""+se,ee!==null&&ee.tag===6?(l(re,ee.sibling),ee=v(ee,se),ee.return=re,re=ee):(l(re,ee),ee=Fd(se,re.mode,ve),ee.return=re,re=ee),R(re)):l(re,ee)}return St}var Xi=z0(!0),B0=z0(!1),Cl=as(null),jl=null,Qi=null,Xc=null;function Qc(){Xc=Qi=jl=null}function Zc(n){var s=Cl.current;dt(Cl),n._currentValue=s}function Jc(n,s,l){for(;n!==null;){var h=n.alternate;if((n.childLanes&s)!==s?(n.childLanes|=s,h!==null&&(h.childLanes|=s)):h!==null&&(h.childLanes&s)!==s&&(h.childLanes|=s),n===l)break;n=n.return}}function Zi(n,s){jl=n,Xc=Qi=null,n=n.dependencies,n!==null&&n.firstContext!==null&&((n.lanes&s)!==0&&(nn=!0),n.firstContext=null)}function An(n){var s=n._currentValue;if(Xc!==n)if(n={context:n,memoizedValue:s,next:null},Qi===null){if(jl===null)throw Error(r(308));Qi=n,jl.dependencies={lanes:0,firstContext:n}}else Qi=Qi.next=n;return s}var Js=null;function ed(n){Js===null?Js=[n]:Js.push(n)}function U0(n,s,l,h){var v=s.interleaved;return v===null?(l.next=l,ed(s)):(l.next=v.next,v.next=l),s.interleaved=l,Pr(n,h)}function Pr(n,s){n.lanes|=s;var l=n.alternate;for(l!==null&&(l.lanes|=s),l=n,n=n.return;n!==null;)n.childLanes|=s,l=n.alternate,l!==null&&(l.childLanes|=s),l=n,n=n.return;return l.tag===3?l.stateNode:null}var cs=!1;function td(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function H0(n,s){n=n.updateQueue,s.updateQueue===n&&(s.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,effects:n.effects})}function Lr(n,s){return{eventTime:n,lane:s,tag:0,payload:null,callback:null,next:null}}function ds(n,s,l){var h=n.updateQueue;if(h===null)return null;if(h=h.shared,(Qe&2)!==0){var v=h.pending;return v===null?s.next=s:(s.next=v.next,v.next=s),h.pending=s,Pr(n,l)}return v=h.interleaved,v===null?(s.next=s,ed(h)):(s.next=v.next,v.next=s),h.interleaved=s,Pr(n,l)}function Tl(n,s,l){if(s=s.updateQueue,s!==null&&(s=s.shared,(l&4194240)!==0)){var h=s.lanes;h&=n.pendingLanes,l|=h,s.lanes=l,Ci(n,l)}}function W0(n,s){var l=n.updateQueue,h=n.alternate;if(h!==null&&(h=h.updateQueue,l===h)){var v=null,x=null;if(l=l.firstBaseUpdate,l!==null){do{var R={eventTime:l.eventTime,lane:l.lane,tag:l.tag,payload:l.payload,callback:l.callback,next:null};x===null?v=x=R:x=x.next=R,l=l.next}while(l!==null);x===null?v=x=s:x=x.next=s}else v=x=s;l={baseState:h.baseState,firstBaseUpdate:v,lastBaseUpdate:x,shared:h.shared,effects:h.effects},n.updateQueue=l;return}n=l.lastBaseUpdate,n===null?l.firstBaseUpdate=s:n.next=s,l.lastBaseUpdate=s}function Rl(n,s,l,h){var v=n.updateQueue;cs=!1;var x=v.firstBaseUpdate,R=v.lastBaseUpdate,D=v.shared.pending;if(D!==null){v.shared.pending=null;var X=D,oe=X.next;X.next=null,R===null?x=oe:R.next=oe,R=X;var me=n.alternate;me!==null&&(me=me.updateQueue,D=me.lastBaseUpdate,D!==R&&(D===null?me.firstBaseUpdate=oe:D.next=oe,me.lastBaseUpdate=X))}if(x!==null){var ge=v.baseState;R=0,me=oe=X=null,D=x;do{var he=D.lane,xe=D.eventTime;if((h&he)===he){me!==null&&(me=me.next={eventTime:xe,lane:0,tag:D.tag,payload:D.payload,callback:D.callback,next:null});e:{var Ee=n,Ce=D;switch(he=s,xe=l,Ce.tag){case 1:if(Ee=Ce.payload,typeof Ee=="function"){ge=Ee.call(xe,ge,he);break e}ge=Ee;break e;case 3:Ee.flags=Ee.flags&-65537|128;case 0:if(Ee=Ce.payload,he=typeof Ee=="function"?Ee.call(xe,ge,he):Ee,he==null)break e;ge=W({},ge,he);break e;case 2:cs=!0}}D.callback!==null&&D.lane!==0&&(n.flags|=64,he=v.effects,he===null?v.effects=[D]:he.push(D))}else xe={eventTime:xe,lane:he,tag:D.tag,payload:D.payload,callback:D.callback,next:null},me===null?(oe=me=xe,X=ge):me=me.next=xe,R|=he;if(D=D.next,D===null){if(D=v.shared.pending,D===null)break;he=D,D=he.next,he.next=null,v.lastBaseUpdate=he,v.shared.pending=null}}while(!0);if(me===null&&(X=ge),v.baseState=X,v.firstBaseUpdate=oe,v.lastBaseUpdate=me,s=v.shared.interleaved,s!==null){v=s;do R|=v.lane,v=v.next;while(v!==s)}else x===null&&(v.shared.lanes=0);ni|=R,n.lanes=R,n.memoizedState=ge}}function V0(n,s,l){if(n=s.effects,s.effects=null,n!==null)for(s=0;s<n.length;s++){var h=n[s],v=h.callback;if(v!==null){if(h.callback=null,h=l,typeof v!="function")throw Error(r(191,v));v.call(h)}}}var na={},mr=as(na),ra=as(na),sa=as(na);function ei(n){if(n===na)throw Error(r(174));return n}function nd(n,s){switch(lt(sa,s),lt(ra,n),lt(mr,na),n=s.nodeType,n){case 9:case 11:s=(s=s.documentElement)?s.namespaceURI:ie(null,"");break;default:n=n===8?s.parentNode:s,s=n.namespaceURI||null,n=n.tagName,s=ie(s,n)}dt(mr),lt(mr,s)}function Ji(){dt(mr),dt(ra),dt(sa)}function G0(n){ei(sa.current);var s=ei(mr.current),l=ie(s,n.type);s!==l&&(lt(ra,n),lt(mr,l))}function rd(n){ra.current===n&&(dt(mr),dt(ra))}var vt=as(0);function Al(n){for(var s=n;s!==null;){if(s.tag===13){var l=s.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||l.data==="$?"||l.data==="$!"))return s}else if(s.tag===19&&s.memoizedProps.revealOrder!==void 0){if((s.flags&128)!==0)return s}else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===n)break;for(;s.sibling===null;){if(s.return===null||s.return===n)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}var sd=[];function id(){for(var n=0;n<sd.length;n++)sd[n]._workInProgressVersionPrimary=null;sd.length=0}var Il=T.ReactCurrentDispatcher,od=T.ReactCurrentBatchConfig,ti=0,yt=null,jt=null,It=null,Ml=!1,ia=!1,oa=0,mR=0;function Bt(){throw Error(r(321))}function ad(n,s){if(s===null)return!1;for(var l=0;l<s.length&&l<n.length;l++)if(!Gn(n[l],s[l]))return!1;return!0}function ld(n,s,l,h,v,x){if(ti=x,yt=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,Il.current=n===null||n.memoizedState===null?wR:xR,n=l(h,v),ia){x=0;do{if(ia=!1,oa=0,25<=x)throw Error(r(301));x+=1,It=jt=null,s.updateQueue=null,Il.current=_R,n=l(h,v)}while(ia)}if(Il.current=Ll,s=jt!==null&&jt.next!==null,ti=0,It=jt=yt=null,Ml=!1,s)throw Error(r(300));return n}function ud(){var n=oa!==0;return oa=0,n}function gr(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return It===null?yt.memoizedState=It=n:It=It.next=n,It}function In(){if(jt===null){var n=yt.alternate;n=n!==null?n.memoizedState:null}else n=jt.next;var s=It===null?yt.memoizedState:It.next;if(s!==null)It=s,jt=n;else{if(n===null)throw Error(r(310));jt=n,n={memoizedState:jt.memoizedState,baseState:jt.baseState,baseQueue:jt.baseQueue,queue:jt.queue,next:null},It===null?yt.memoizedState=It=n:It=It.next=n}return It}function aa(n,s){return typeof s=="function"?s(n):s}function cd(n){var s=In(),l=s.queue;if(l===null)throw Error(r(311));l.lastRenderedReducer=n;var h=jt,v=h.baseQueue,x=l.pending;if(x!==null){if(v!==null){var R=v.next;v.next=x.next,x.next=R}h.baseQueue=v=x,l.pending=null}if(v!==null){x=v.next,h=h.baseState;var D=R=null,X=null,oe=x;do{var me=oe.lane;if((ti&me)===me)X!==null&&(X=X.next={lane:0,action:oe.action,hasEagerState:oe.hasEagerState,eagerState:oe.eagerState,next:null}),h=oe.hasEagerState?oe.eagerState:n(h,oe.action);else{var ge={lane:me,action:oe.action,hasEagerState:oe.hasEagerState,eagerState:oe.eagerState,next:null};X===null?(D=X=ge,R=h):X=X.next=ge,yt.lanes|=me,ni|=me}oe=oe.next}while(oe!==null&&oe!==x);X===null?R=h:X.next=D,Gn(h,s.memoizedState)||(nn=!0),s.memoizedState=h,s.baseState=R,s.baseQueue=X,l.lastRenderedState=h}if(n=l.interleaved,n!==null){v=n;do x=v.lane,yt.lanes|=x,ni|=x,v=v.next;while(v!==n)}else v===null&&(l.lanes=0);return[s.memoizedState,l.dispatch]}function dd(n){var s=In(),l=s.queue;if(l===null)throw Error(r(311));l.lastRenderedReducer=n;var h=l.dispatch,v=l.pending,x=s.memoizedState;if(v!==null){l.pending=null;var R=v=v.next;do x=n(x,R.action),R=R.next;while(R!==v);Gn(x,s.memoizedState)||(nn=!0),s.memoizedState=x,s.baseQueue===null&&(s.baseState=x),l.lastRenderedState=x}return[x,h]}function Y0(){}function K0(n,s){var l=yt,h=In(),v=s(),x=!Gn(h.memoizedState,v);if(x&&(h.memoizedState=v,nn=!0),h=h.queue,fd(Z0.bind(null,l,h,n),[n]),h.getSnapshot!==s||x||It!==null&&It.memoizedState.tag&1){if(l.flags|=2048,la(9,Q0.bind(null,l,h,v,s),void 0,null),Mt===null)throw Error(r(349));(ti&30)!==0||X0(l,s,v)}return v}function X0(n,s,l){n.flags|=16384,n={getSnapshot:s,value:l},s=yt.updateQueue,s===null?(s={lastEffect:null,stores:null},yt.updateQueue=s,s.stores=[n]):(l=s.stores,l===null?s.stores=[n]:l.push(n))}function Q0(n,s,l,h){s.value=l,s.getSnapshot=h,J0(s)&&ew(n)}function Z0(n,s,l){return l(function(){J0(s)&&ew(n)})}function J0(n){var s=n.getSnapshot;n=n.value;try{var l=s();return!Gn(n,l)}catch{return!0}}function ew(n){var s=Pr(n,1);s!==null&&Zn(s,n,1,-1)}function tw(n){var s=gr();return typeof n=="function"&&(n=n()),s.memoizedState=s.baseState=n,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:aa,lastRenderedState:n},s.queue=n,n=n.dispatch=yR.bind(null,yt,n),[s.memoizedState,n]}function la(n,s,l,h){return n={tag:n,create:s,destroy:l,deps:h,next:null},s=yt.updateQueue,s===null?(s={lastEffect:null,stores:null},yt.updateQueue=s,s.lastEffect=n.next=n):(l=s.lastEffect,l===null?s.lastEffect=n.next=n:(h=l.next,l.next=n,n.next=h,s.lastEffect=n)),n}function nw(){return In().memoizedState}function Ol(n,s,l,h){var v=gr();yt.flags|=n,v.memoizedState=la(1|s,l,void 0,h===void 0?null:h)}function Pl(n,s,l,h){var v=In();h=h===void 0?null:h;var x=void 0;if(jt!==null){var R=jt.memoizedState;if(x=R.destroy,h!==null&&ad(h,R.deps)){v.memoizedState=la(s,l,x,h);return}}yt.flags|=n,v.memoizedState=la(1|s,l,x,h)}function rw(n,s){return Ol(8390656,8,n,s)}function fd(n,s){return Pl(2048,8,n,s)}function sw(n,s){return Pl(4,2,n,s)}function iw(n,s){return Pl(4,4,n,s)}function ow(n,s){if(typeof s=="function")return n=n(),s(n),function(){s(null)};if(s!=null)return n=n(),s.current=n,function(){s.current=null}}function aw(n,s,l){return l=l!=null?l.concat([n]):null,Pl(4,4,ow.bind(null,s,n),l)}function hd(){}function lw(n,s){var l=In();s=s===void 0?null:s;var h=l.memoizedState;return h!==null&&s!==null&&ad(s,h[1])?h[0]:(l.memoizedState=[n,s],n)}function uw(n,s){var l=In();s=s===void 0?null:s;var h=l.memoizedState;return h!==null&&s!==null&&ad(s,h[1])?h[0]:(n=n(),l.memoizedState=[n,s],n)}function cw(n,s,l){return(ti&21)===0?(n.baseState&&(n.baseState=!1,nn=!0),n.memoizedState=l):(Gn(l,s)||(l=Ei(),yt.lanes|=l,ni|=l,n.baseState=!0),s)}function gR(n,s){var l=Xe;Xe=l!==0&&4>l?l:4,n(!0);var h=od.transition;od.transition={};try{n(!1),s()}finally{Xe=l,od.transition=h}}function dw(){return In().memoizedState}function vR(n,s,l){var h=ms(n);if(l={lane:h,action:l,hasEagerState:!1,eagerState:null,next:null},fw(n))hw(s,l);else if(l=U0(n,s,l,h),l!==null){var v=Zt();Zn(l,n,h,v),pw(l,s,h)}}function yR(n,s,l){var h=ms(n),v={lane:h,action:l,hasEagerState:!1,eagerState:null,next:null};if(fw(n))hw(s,v);else{var x=n.alternate;if(n.lanes===0&&(x===null||x.lanes===0)&&(x=s.lastRenderedReducer,x!==null))try{var R=s.lastRenderedState,D=x(R,l);if(v.hasEagerState=!0,v.eagerState=D,Gn(D,R)){var X=s.interleaved;X===null?(v.next=v,ed(s)):(v.next=X.next,X.next=v),s.interleaved=v;return}}catch{}finally{}l=U0(n,s,v,h),l!==null&&(v=Zt(),Zn(l,n,h,v),pw(l,s,h))}}function fw(n){var s=n.alternate;return n===yt||s!==null&&s===yt}function hw(n,s){ia=Ml=!0;var l=n.pending;l===null?s.next=s:(s.next=l.next,l.next=s),n.pending=s}function pw(n,s,l){if((l&4194240)!==0){var h=s.lanes;h&=n.pendingLanes,l|=h,s.lanes=l,Ci(n,l)}}var Ll={readContext:An,useCallback:Bt,useContext:Bt,useEffect:Bt,useImperativeHandle:Bt,useInsertionEffect:Bt,useLayoutEffect:Bt,useMemo:Bt,useReducer:Bt,useRef:Bt,useState:Bt,useDebugValue:Bt,useDeferredValue:Bt,useTransition:Bt,useMutableSource:Bt,useSyncExternalStore:Bt,useId:Bt,unstable_isNewReconciler:!1},wR={readContext:An,useCallback:function(n,s){return gr().memoizedState=[n,s===void 0?null:s],n},useContext:An,useEffect:rw,useImperativeHandle:function(n,s,l){return l=l!=null?l.concat([n]):null,Ol(4194308,4,ow.bind(null,s,n),l)},useLayoutEffect:function(n,s){return Ol(4194308,4,n,s)},useInsertionEffect:function(n,s){return Ol(4,2,n,s)},useMemo:function(n,s){var l=gr();return s=s===void 0?null:s,n=n(),l.memoizedState=[n,s],n},useReducer:function(n,s,l){var h=gr();return s=l!==void 0?l(s):s,h.memoizedState=h.baseState=s,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:s},h.queue=n,n=n.dispatch=vR.bind(null,yt,n),[h.memoizedState,n]},useRef:function(n){var s=gr();return n={current:n},s.memoizedState=n},useState:tw,useDebugValue:hd,useDeferredValue:function(n){return gr().memoizedState=n},useTransition:function(){var n=tw(!1),s=n[0];return n=gR.bind(null,n[1]),gr().memoizedState=n,[s,n]},useMutableSource:function(){},useSyncExternalStore:function(n,s,l){var h=yt,v=gr();if(pt){if(l===void 0)throw Error(r(407));l=l()}else{if(l=s(),Mt===null)throw Error(r(349));(ti&30)!==0||X0(h,s,l)}v.memoizedState=l;var x={value:l,getSnapshot:s};return v.queue=x,rw(Z0.bind(null,h,x,n),[n]),h.flags|=2048,la(9,Q0.bind(null,h,x,l,s),void 0,null),l},useId:function(){var n=gr(),s=Mt.identifierPrefix;if(pt){var l=Or,h=Mr;l=(h&~(1<<32-dn(h)-1)).toString(32)+l,s=":"+s+"R"+l,l=oa++,0<l&&(s+="H"+l.toString(32)),s+=":"}else l=mR++,s=":"+s+"r"+l.toString(32)+":";return n.memoizedState=s},unstable_isNewReconciler:!1},xR={readContext:An,useCallback:lw,useContext:An,useEffect:fd,useImperativeHandle:aw,useInsertionEffect:sw,useLayoutEffect:iw,useMemo:uw,useReducer:cd,useRef:nw,useState:function(){return cd(aa)},useDebugValue:hd,useDeferredValue:function(n){var s=In();return cw(s,jt.memoizedState,n)},useTransition:function(){var n=cd(aa)[0],s=In().memoizedState;return[n,s]},useMutableSource:Y0,useSyncExternalStore:K0,useId:dw,unstable_isNewReconciler:!1},_R={readContext:An,useCallback:lw,useContext:An,useEffect:fd,useImperativeHandle:aw,useInsertionEffect:sw,useLayoutEffect:iw,useMemo:uw,useReducer:dd,useRef:nw,useState:function(){return dd(aa)},useDebugValue:hd,useDeferredValue:function(n){var s=In();return jt===null?s.memoizedState=n:cw(s,jt.memoizedState,n)},useTransition:function(){var n=dd(aa)[0],s=In().memoizedState;return[n,s]},useMutableSource:Y0,useSyncExternalStore:K0,useId:dw,unstable_isNewReconciler:!1};function Kn(n,s){if(n&&n.defaultProps){s=W({},s),n=n.defaultProps;for(var l in n)s[l]===void 0&&(s[l]=n[l]);return s}return s}function pd(n,s,l,h){s=n.memoizedState,l=l(h,s),l=l==null?s:W({},s,l),n.memoizedState=l,n.lanes===0&&(n.updateQueue.baseState=l)}var $l={isMounted:function(n){return(n=n._reactInternals)?Bn(n)===n:!1},enqueueSetState:function(n,s,l){n=n._reactInternals;var h=Zt(),v=ms(n),x=Lr(h,v);x.payload=s,l!=null&&(x.callback=l),s=ds(n,x,v),s!==null&&(Zn(s,n,v,h),Tl(s,n,v))},enqueueReplaceState:function(n,s,l){n=n._reactInternals;var h=Zt(),v=ms(n),x=Lr(h,v);x.tag=1,x.payload=s,l!=null&&(x.callback=l),s=ds(n,x,v),s!==null&&(Zn(s,n,v,h),Tl(s,n,v))},enqueueForceUpdate:function(n,s){n=n._reactInternals;var l=Zt(),h=ms(n),v=Lr(l,h);v.tag=2,s!=null&&(v.callback=s),s=ds(n,v,h),s!==null&&(Zn(s,n,h,l),Tl(s,n,h))}};function mw(n,s,l,h,v,x,R){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(h,x,R):s.prototype&&s.prototype.isPureReactComponent?!Yo(l,h)||!Yo(v,x):!0}function gw(n,s,l){var h=!1,v=ls,x=s.contextType;return typeof x=="object"&&x!==null?x=An(x):(v=tn(s)?Xs:zt.current,h=s.contextTypes,x=(h=h!=null)?Vi(n,v):ls),s=new s(l,x),n.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,s.updater=$l,n.stateNode=s,s._reactInternals=n,h&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=v,n.__reactInternalMemoizedMaskedChildContext=x),s}function vw(n,s,l,h){n=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(l,h),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(l,h),s.state!==n&&$l.enqueueReplaceState(s,s.state,null)}function md(n,s,l,h){var v=n.stateNode;v.props=l,v.state=n.memoizedState,v.refs={},td(n);var x=s.contextType;typeof x=="object"&&x!==null?v.context=An(x):(x=tn(s)?Xs:zt.current,v.context=Vi(n,x)),v.state=n.memoizedState,x=s.getDerivedStateFromProps,typeof x=="function"&&(pd(n,s,x,l),v.state=n.memoizedState),typeof s.getDerivedStateFromProps=="function"||typeof v.getSnapshotBeforeUpdate=="function"||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(s=v.state,typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount(),s!==v.state&&$l.enqueueReplaceState(v,v.state,null),Rl(n,l,v,h),v.state=n.memoizedState),typeof v.componentDidMount=="function"&&(n.flags|=4194308)}function eo(n,s){try{var l="",h=s;do l+=Z(h),h=h.return;while(h);var v=l}catch(x){v=`
39
- Error generating stack: `+x.message+`
40
- `+x.stack}return{value:n,source:s,stack:v,digest:null}}function gd(n,s,l){return{value:n,source:null,stack:l??null,digest:s??null}}function vd(n,s){try{console.error(s.value)}catch(l){setTimeout(function(){throw l})}}var bR=typeof WeakMap=="function"?WeakMap:Map;function yw(n,s,l){l=Lr(-1,l),l.tag=3,l.payload={element:null};var h=s.value;return l.callback=function(){Hl||(Hl=!0,Id=h),vd(n,s)},l}function ww(n,s,l){l=Lr(-1,l),l.tag=3;var h=n.type.getDerivedStateFromError;if(typeof h=="function"){var v=s.value;l.payload=function(){return h(v)},l.callback=function(){vd(n,s)}}var x=n.stateNode;return x!==null&&typeof x.componentDidCatch=="function"&&(l.callback=function(){vd(n,s),typeof h!="function"&&(hs===null?hs=new Set([this]):hs.add(this));var R=s.stack;this.componentDidCatch(s.value,{componentStack:R!==null?R:""})}),l}function xw(n,s,l){var h=n.pingCache;if(h===null){h=n.pingCache=new bR;var v=new Set;h.set(s,v)}else v=h.get(s),v===void 0&&(v=new Set,h.set(s,v));v.has(l)||(v.add(l),n=LR.bind(null,n,s,l),s.then(n,n))}function _w(n){do{var s;if((s=n.tag===13)&&(s=n.memoizedState,s=s!==null?s.dehydrated!==null:!0),s)return n;n=n.return}while(n!==null);return null}function bw(n,s,l,h,v){return(n.mode&1)===0?(n===s?n.flags|=65536:(n.flags|=128,l.flags|=131072,l.flags&=-52805,l.tag===1&&(l.alternate===null?l.tag=17:(s=Lr(-1,1),s.tag=2,ds(l,s,1))),l.lanes|=1),n):(n.flags|=65536,n.lanes=v,n)}var kR=T.ReactCurrentOwner,nn=!1;function Qt(n,s,l,h){s.child=n===null?B0(s,null,l,h):Xi(s,n.child,l,h)}function kw(n,s,l,h,v){l=l.render;var x=s.ref;return Zi(s,v),h=ld(n,s,l,h,x,v),l=ud(),n!==null&&!nn?(s.updateQueue=n.updateQueue,s.flags&=-2053,n.lanes&=~v,$r(n,s,v)):(pt&&l&&Wc(s),s.flags|=1,Qt(n,s,h,v),s.child)}function Sw(n,s,l,h,v){if(n===null){var x=l.type;return typeof x=="function"&&!Dd(x)&&x.defaultProps===void 0&&l.compare===null&&l.defaultProps===void 0?(s.tag=15,s.type=x,Ew(n,s,x,h,v)):(n=Xl(l.type,null,h,s,s.mode,v),n.ref=s.ref,n.return=s,s.child=n)}if(x=n.child,(n.lanes&v)===0){var R=x.memoizedProps;if(l=l.compare,l=l!==null?l:Yo,l(R,h)&&n.ref===s.ref)return $r(n,s,v)}return s.flags|=1,n=vs(x,h),n.ref=s.ref,n.return=s,s.child=n}function Ew(n,s,l,h,v){if(n!==null){var x=n.memoizedProps;if(Yo(x,h)&&n.ref===s.ref)if(nn=!1,s.pendingProps=h=x,(n.lanes&v)!==0)(n.flags&131072)!==0&&(nn=!0);else return s.lanes=n.lanes,$r(n,s,v)}return yd(n,s,l,h,v)}function Nw(n,s,l){var h=s.pendingProps,v=h.children,x=n!==null?n.memoizedState:null;if(h.mode==="hidden")if((s.mode&1)===0)s.memoizedState={baseLanes:0,cachePool:null,transitions:null},lt(no,mn),mn|=l;else{if((l&1073741824)===0)return n=x!==null?x.baseLanes|l:l,s.lanes=s.childLanes=1073741824,s.memoizedState={baseLanes:n,cachePool:null,transitions:null},s.updateQueue=null,lt(no,mn),mn|=n,null;s.memoizedState={baseLanes:0,cachePool:null,transitions:null},h=x!==null?x.baseLanes:l,lt(no,mn),mn|=h}else x!==null?(h=x.baseLanes|l,s.memoizedState=null):h=l,lt(no,mn),mn|=h;return Qt(n,s,v,l),s.child}function Cw(n,s){var l=s.ref;(n===null&&l!==null||n!==null&&n.ref!==l)&&(s.flags|=512,s.flags|=2097152)}function yd(n,s,l,h,v){var x=tn(l)?Xs:zt.current;return x=Vi(s,x),Zi(s,v),l=ld(n,s,l,h,x,v),h=ud(),n!==null&&!nn?(s.updateQueue=n.updateQueue,s.flags&=-2053,n.lanes&=~v,$r(n,s,v)):(pt&&h&&Wc(s),s.flags|=1,Qt(n,s,l,v),s.child)}function jw(n,s,l,h,v){if(tn(l)){var x=!0;_l(s)}else x=!1;if(Zi(s,v),s.stateNode===null)Dl(n,s),gw(s,l,h),md(s,l,h,v),h=!0;else if(n===null){var R=s.stateNode,D=s.memoizedProps;R.props=D;var X=R.context,oe=l.contextType;typeof oe=="object"&&oe!==null?oe=An(oe):(oe=tn(l)?Xs:zt.current,oe=Vi(s,oe));var me=l.getDerivedStateFromProps,ge=typeof me=="function"||typeof R.getSnapshotBeforeUpdate=="function";ge||typeof R.UNSAFE_componentWillReceiveProps!="function"&&typeof R.componentWillReceiveProps!="function"||(D!==h||X!==oe)&&vw(s,R,h,oe),cs=!1;var he=s.memoizedState;R.state=he,Rl(s,h,R,v),X=s.memoizedState,D!==h||he!==X||en.current||cs?(typeof me=="function"&&(pd(s,l,me,h),X=s.memoizedState),(D=cs||mw(s,l,D,h,he,X,oe))?(ge||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"&&(s.flags|=4194308)):(typeof R.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=h,s.memoizedState=X),R.props=h,R.state=X,R.context=oe,h=D):(typeof R.componentDidMount=="function"&&(s.flags|=4194308),h=!1)}else{R=s.stateNode,H0(n,s),D=s.memoizedProps,oe=s.type===s.elementType?D:Kn(s.type,D),R.props=oe,ge=s.pendingProps,he=R.context,X=l.contextType,typeof X=="object"&&X!==null?X=An(X):(X=tn(l)?Xs:zt.current,X=Vi(s,X));var xe=l.getDerivedStateFromProps;(me=typeof xe=="function"||typeof R.getSnapshotBeforeUpdate=="function")||typeof R.UNSAFE_componentWillReceiveProps!="function"&&typeof R.componentWillReceiveProps!="function"||(D!==ge||he!==X)&&vw(s,R,h,X),cs=!1,he=s.memoizedState,R.state=he,Rl(s,h,R,v);var Ee=s.memoizedState;D!==ge||he!==Ee||en.current||cs?(typeof xe=="function"&&(pd(s,l,xe,h),Ee=s.memoizedState),(oe=cs||mw(s,l,oe,h,he,Ee,X)||!1)?(me||typeof R.UNSAFE_componentWillUpdate!="function"&&typeof R.componentWillUpdate!="function"||(typeof R.componentWillUpdate=="function"&&R.componentWillUpdate(h,Ee,X),typeof R.UNSAFE_componentWillUpdate=="function"&&R.UNSAFE_componentWillUpdate(h,Ee,X)),typeof R.componentDidUpdate=="function"&&(s.flags|=4),typeof R.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof R.componentDidUpdate!="function"||D===n.memoizedProps&&he===n.memoizedState||(s.flags|=4),typeof R.getSnapshotBeforeUpdate!="function"||D===n.memoizedProps&&he===n.memoizedState||(s.flags|=1024),s.memoizedProps=h,s.memoizedState=Ee),R.props=h,R.state=Ee,R.context=X,h=oe):(typeof R.componentDidUpdate!="function"||D===n.memoizedProps&&he===n.memoizedState||(s.flags|=4),typeof R.getSnapshotBeforeUpdate!="function"||D===n.memoizedProps&&he===n.memoizedState||(s.flags|=1024),h=!1)}return wd(n,s,l,h,x,v)}function wd(n,s,l,h,v,x){Cw(n,s);var R=(s.flags&128)!==0;if(!h&&!R)return v&&M0(s,l,!1),$r(n,s,x);h=s.stateNode,kR.current=s;var D=R&&typeof l.getDerivedStateFromError!="function"?null:h.render();return s.flags|=1,n!==null&&R?(s.child=Xi(s,n.child,null,x),s.child=Xi(s,null,D,x)):Qt(n,s,D,x),s.memoizedState=h.state,v&&M0(s,l,!0),s.child}function Tw(n){var s=n.stateNode;s.pendingContext?A0(n,s.pendingContext,s.pendingContext!==s.context):s.context&&A0(n,s.context,!1),nd(n,s.containerInfo)}function Rw(n,s,l,h,v){return Ki(),Kc(v),s.flags|=256,Qt(n,s,l,h),s.child}var xd={dehydrated:null,treeContext:null,retryLane:0};function _d(n){return{baseLanes:n,cachePool:null,transitions:null}}function Aw(n,s,l){var h=s.pendingProps,v=vt.current,x=!1,R=(s.flags&128)!==0,D;if((D=R)||(D=n!==null&&n.memoizedState===null?!1:(v&2)!==0),D?(x=!0,s.flags&=-129):(n===null||n.memoizedState!==null)&&(v|=1),lt(vt,v&1),n===null)return Yc(s),n=s.memoizedState,n!==null&&(n=n.dehydrated,n!==null)?((s.mode&1)===0?s.lanes=1:n.data==="$!"?s.lanes=8:s.lanes=1073741824,null):(R=h.children,n=h.fallback,x?(h=s.mode,x=s.child,R={mode:"hidden",children:R},(h&1)===0&&x!==null?(x.childLanes=0,x.pendingProps=R):x=Ql(R,h,0,null),n=oi(n,h,l,null),x.return=s,n.return=s,x.sibling=n,s.child=x,s.child.memoizedState=_d(l),s.memoizedState=xd,n):bd(s,R));if(v=n.memoizedState,v!==null&&(D=v.dehydrated,D!==null))return SR(n,s,R,h,D,v,l);if(x){x=h.fallback,R=s.mode,v=n.child,D=v.sibling;var X={mode:"hidden",children:h.children};return(R&1)===0&&s.child!==v?(h=s.child,h.childLanes=0,h.pendingProps=X,s.deletions=null):(h=vs(v,X),h.subtreeFlags=v.subtreeFlags&14680064),D!==null?x=vs(D,x):(x=oi(x,R,l,null),x.flags|=2),x.return=s,h.return=s,h.sibling=x,s.child=h,h=x,x=s.child,R=n.child.memoizedState,R=R===null?_d(l):{baseLanes:R.baseLanes|l,cachePool:null,transitions:R.transitions},x.memoizedState=R,x.childLanes=n.childLanes&~l,s.memoizedState=xd,h}return x=n.child,n=x.sibling,h=vs(x,{mode:"visible",children:h.children}),(s.mode&1)===0&&(h.lanes=l),h.return=s,h.sibling=null,n!==null&&(l=s.deletions,l===null?(s.deletions=[n],s.flags|=16):l.push(n)),s.child=h,s.memoizedState=null,h}function bd(n,s){return s=Ql({mode:"visible",children:s},n.mode,0,null),s.return=n,n.child=s}function ql(n,s,l,h){return h!==null&&Kc(h),Xi(s,n.child,null,l),n=bd(s,s.pendingProps.children),n.flags|=2,s.memoizedState=null,n}function SR(n,s,l,h,v,x,R){if(l)return s.flags&256?(s.flags&=-257,h=gd(Error(r(422))),ql(n,s,R,h)):s.memoizedState!==null?(s.child=n.child,s.flags|=128,null):(x=h.fallback,v=s.mode,h=Ql({mode:"visible",children:h.children},v,0,null),x=oi(x,v,R,null),x.flags|=2,h.return=s,x.return=s,h.sibling=x,s.child=h,(s.mode&1)!==0&&Xi(s,n.child,null,R),s.child.memoizedState=_d(R),s.memoizedState=xd,x);if((s.mode&1)===0)return ql(n,s,R,null);if(v.data==="$!"){if(h=v.nextSibling&&v.nextSibling.dataset,h)var D=h.dgst;return h=D,x=Error(r(419)),h=gd(x,h,void 0),ql(n,s,R,h)}if(D=(R&n.childLanes)!==0,nn||D){if(h=Mt,h!==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&(h.suspendedLanes|R))!==0?0:v,v!==0&&v!==x.retryLane&&(x.retryLane=v,Pr(n,v),Zn(h,n,v,-1))}return qd(),h=gd(Error(r(421))),ql(n,s,R,h)}return v.data==="$?"?(s.flags|=128,s.child=n.child,s=$R.bind(null,n),v._reactRetry=s,null):(n=x.treeContext,pn=os(v.nextSibling),hn=s,pt=!0,Yn=null,n!==null&&(Tn[Rn++]=Mr,Tn[Rn++]=Or,Tn[Rn++]=Qs,Mr=n.id,Or=n.overflow,Qs=s),s=bd(s,h.children),s.flags|=4096,s)}function Iw(n,s,l){n.lanes|=s;var h=n.alternate;h!==null&&(h.lanes|=s),Jc(n.return,s,l)}function kd(n,s,l,h,v){var x=n.memoizedState;x===null?n.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:h,tail:l,tailMode:v}:(x.isBackwards=s,x.rendering=null,x.renderingStartTime=0,x.last=h,x.tail=l,x.tailMode=v)}function Mw(n,s,l){var h=s.pendingProps,v=h.revealOrder,x=h.tail;if(Qt(n,s,h.children,l),h=vt.current,(h&2)!==0)h=h&1|2,s.flags|=128;else{if(n!==null&&(n.flags&128)!==0)e:for(n=s.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&Iw(n,l,s);else if(n.tag===19)Iw(n,l,s);else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===s)break e;for(;n.sibling===null;){if(n.return===null||n.return===s)break e;n=n.return}n.sibling.return=n.return,n=n.sibling}h&=1}if(lt(vt,h),(s.mode&1)===0)s.memoizedState=null;else switch(v){case"forwards":for(l=s.child,v=null;l!==null;)n=l.alternate,n!==null&&Al(n)===null&&(v=l),l=l.sibling;l=v,l===null?(v=s.child,s.child=null):(v=l.sibling,l.sibling=null),kd(s,!1,v,l,x);break;case"backwards":for(l=null,v=s.child,s.child=null;v!==null;){if(n=v.alternate,n!==null&&Al(n)===null){s.child=v;break}n=v.sibling,v.sibling=l,l=v,v=n}kd(s,!0,l,null,x);break;case"together":kd(s,!1,null,null,void 0);break;default:s.memoizedState=null}return s.child}function Dl(n,s){(s.mode&1)===0&&n!==null&&(n.alternate=null,s.alternate=null,s.flags|=2)}function $r(n,s,l){if(n!==null&&(s.dependencies=n.dependencies),ni|=s.lanes,(l&s.childLanes)===0)return null;if(n!==null&&s.child!==n.child)throw Error(r(153));if(s.child!==null){for(n=s.child,l=vs(n,n.pendingProps),s.child=l,l.return=s;n.sibling!==null;)n=n.sibling,l=l.sibling=vs(n,n.pendingProps),l.return=s;l.sibling=null}return s.child}function ER(n,s,l){switch(s.tag){case 3:Tw(s),Ki();break;case 5:G0(s);break;case 1:tn(s.type)&&_l(s);break;case 4:nd(s,s.stateNode.containerInfo);break;case 10:var h=s.type._context,v=s.memoizedProps.value;lt(Cl,h._currentValue),h._currentValue=v;break;case 13:if(h=s.memoizedState,h!==null)return h.dehydrated!==null?(lt(vt,vt.current&1),s.flags|=128,null):(l&s.child.childLanes)!==0?Aw(n,s,l):(lt(vt,vt.current&1),n=$r(n,s,l),n!==null?n.sibling:null);lt(vt,vt.current&1);break;case 19:if(h=(l&s.childLanes)!==0,(n.flags&128)!==0){if(h)return Mw(n,s,l);s.flags|=128}if(v=s.memoizedState,v!==null&&(v.rendering=null,v.tail=null,v.lastEffect=null),lt(vt,vt.current),h)break;return null;case 22:case 23:return s.lanes=0,Nw(n,s,l)}return $r(n,s,l)}var Ow,Sd,Pw,Lw;Ow=function(n,s){for(var l=s.child;l!==null;){if(l.tag===5||l.tag===6)n.appendChild(l.stateNode);else if(l.tag!==4&&l.child!==null){l.child.return=l,l=l.child;continue}if(l===s)break;for(;l.sibling===null;){if(l.return===null||l.return===s)return;l=l.return}l.sibling.return=l.return,l=l.sibling}},Sd=function(){},Pw=function(n,s,l,h){var v=n.memoizedProps;if(v!==h){n=s.stateNode,ei(mr.current);var x=null;switch(l){case"input":v=Me(n,v),h=Me(n,h),x=[];break;case"select":v=W({},v,{value:void 0}),h=W({},h,{value:void 0}),x=[];break;case"textarea":v=ot(n,v),h=ot(n,h),x=[];break;default:typeof v.onClick!="function"&&typeof h.onClick=="function"&&(n.onclick=yl)}nt(l,h);var R;l=null;for(oe in v)if(!h.hasOwnProperty(oe)&&v.hasOwnProperty(oe)&&v[oe]!=null)if(oe==="style"){var D=v[oe];for(R in D)D.hasOwnProperty(R)&&(l||(l={}),l[R]="")}else oe!=="dangerouslySetInnerHTML"&&oe!=="children"&&oe!=="suppressContentEditableWarning"&&oe!=="suppressHydrationWarning"&&oe!=="autoFocus"&&(o.hasOwnProperty(oe)?x||(x=[]):(x=x||[]).push(oe,null));for(oe in h){var X=h[oe];if(D=v!=null?v[oe]:void 0,h.hasOwnProperty(oe)&&X!==D&&(X!=null||D!=null))if(oe==="style")if(D){for(R in D)!D.hasOwnProperty(R)||X&&X.hasOwnProperty(R)||(l||(l={}),l[R]="");for(R in X)X.hasOwnProperty(R)&&D[R]!==X[R]&&(l||(l={}),l[R]=X[R])}else l||(x||(x=[]),x.push(oe,l)),l=X;else oe==="dangerouslySetInnerHTML"?(X=X?X.__html:void 0,D=D?D.__html:void 0,X!=null&&D!==X&&(x=x||[]).push(oe,X)):oe==="children"?typeof X!="string"&&typeof X!="number"||(x=x||[]).push(oe,""+X):oe!=="suppressContentEditableWarning"&&oe!=="suppressHydrationWarning"&&(o.hasOwnProperty(oe)?(X!=null&&oe==="onScroll"&&ct("scroll",n),x||D===X||(x=[])):(x=x||[]).push(oe,X))}l&&(x=x||[]).push("style",l);var oe=x;(s.updateQueue=oe)&&(s.flags|=4)}},Lw=function(n,s,l,h){l!==h&&(s.flags|=4)};function ua(n,s){if(!pt)switch(n.tailMode){case"hidden":s=n.tail;for(var l=null;s!==null;)s.alternate!==null&&(l=s),s=s.sibling;l===null?n.tail=null:l.sibling=null;break;case"collapsed":l=n.tail;for(var h=null;l!==null;)l.alternate!==null&&(h=l),l=l.sibling;h===null?s||n.tail===null?n.tail=null:n.tail.sibling=null:h.sibling=null}}function Ut(n){var s=n.alternate!==null&&n.alternate.child===n.child,l=0,h=0;if(s)for(var v=n.child;v!==null;)l|=v.lanes|v.childLanes,h|=v.subtreeFlags&14680064,h|=v.flags&14680064,v.return=n,v=v.sibling;else for(v=n.child;v!==null;)l|=v.lanes|v.childLanes,h|=v.subtreeFlags,h|=v.flags,v.return=n,v=v.sibling;return n.subtreeFlags|=h,n.childLanes=l,s}function NR(n,s,l){var h=s.pendingProps;switch(Vc(s),s.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ut(s),null;case 1:return tn(s.type)&&xl(),Ut(s),null;case 3:return h=s.stateNode,Ji(),dt(en),dt(zt),id(),h.pendingContext&&(h.context=h.pendingContext,h.pendingContext=null),(n===null||n.child===null)&&(El(s)?s.flags|=4:n===null||n.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,Yn!==null&&(Pd(Yn),Yn=null))),Sd(n,s),Ut(s),null;case 5:rd(s);var v=ei(sa.current);if(l=s.type,n!==null&&s.stateNode!=null)Pw(n,s,l,h,v),n.ref!==s.ref&&(s.flags|=512,s.flags|=2097152);else{if(!h){if(s.stateNode===null)throw Error(r(166));return Ut(s),null}if(n=ei(mr.current),El(s)){h=s.stateNode,l=s.type;var x=s.memoizedProps;switch(h[pr]=s,h[Jo]=x,n=(s.mode&1)!==0,l){case"dialog":ct("cancel",h),ct("close",h);break;case"iframe":case"object":case"embed":ct("load",h);break;case"video":case"audio":for(v=0;v<Xo.length;v++)ct(Xo[v],h);break;case"source":ct("error",h);break;case"img":case"image":case"link":ct("error",h),ct("load",h);break;case"details":ct("toggle",h);break;case"input":_e(h,x),ct("invalid",h);break;case"select":h._wrapperState={wasMultiple:!!x.multiple},ct("invalid",h);break;case"textarea":Be(h,x),ct("invalid",h)}nt(l,x),v=null;for(var R in x)if(x.hasOwnProperty(R)){var D=x[R];R==="children"?typeof D=="string"?h.textContent!==D&&(x.suppressHydrationWarning!==!0&&vl(h.textContent,D,n),v=["children",D]):typeof D=="number"&&h.textContent!==""+D&&(x.suppressHydrationWarning!==!0&&vl(h.textContent,D,n),v=["children",""+D]):o.hasOwnProperty(R)&&D!=null&&R==="onScroll"&&ct("scroll",h)}switch(l){case"input":Pe(h),fe(h,x,!0);break;case"textarea":Pe(h),ut(h);break;case"select":case"option":break;default:typeof x.onClick=="function"&&(h.onclick=yl)}h=v,s.updateQueue=h,h!==null&&(s.flags|=4)}else{R=v.nodeType===9?v:v.ownerDocument,n==="http://www.w3.org/1999/xhtml"&&(n=_t(l)),n==="http://www.w3.org/1999/xhtml"?l==="script"?(n=R.createElement("div"),n.innerHTML="<script><\/script>",n=n.removeChild(n.firstChild)):typeof h.is=="string"?n=R.createElement(l,{is:h.is}):(n=R.createElement(l),l==="select"&&(R=n,h.multiple?R.multiple=!0:h.size&&(R.size=h.size))):n=R.createElementNS(n,l),n[pr]=s,n[Jo]=h,Ow(n,s,!1,!1),s.stateNode=n;e:{switch(R=at(l,h),l){case"dialog":ct("cancel",n),ct("close",n),v=h;break;case"iframe":case"object":case"embed":ct("load",n),v=h;break;case"video":case"audio":for(v=0;v<Xo.length;v++)ct(Xo[v],n);v=h;break;case"source":ct("error",n),v=h;break;case"img":case"image":case"link":ct("error",n),ct("load",n),v=h;break;case"details":ct("toggle",n),v=h;break;case"input":_e(n,h),v=Me(n,h),ct("invalid",n);break;case"option":v=h;break;case"select":n._wrapperState={wasMultiple:!!h.multiple},v=W({},h,{value:void 0}),ct("invalid",n);break;case"textarea":Be(n,h),v=ot(n,h),ct("invalid",n);break;default:v=h}nt(l,v),D=v;for(x in D)if(D.hasOwnProperty(x)){var X=D[x];x==="style"?ke(n,X):x==="dangerouslySetInnerHTML"?(X=X?X.__html:void 0,X!=null&&Oe(n,X)):x==="children"?typeof X=="string"?(l!=="textarea"||X!=="")&&Te(n,X):typeof X=="number"&&Te(n,""+X):x!=="suppressContentEditableWarning"&&x!=="suppressHydrationWarning"&&x!=="autoFocus"&&(o.hasOwnProperty(x)?X!=null&&x==="onScroll"&&ct("scroll",n):X!=null&&N(n,x,X,R))}switch(l){case"input":Pe(n),fe(n,h,!1);break;case"textarea":Pe(n),ut(n);break;case"option":h.value!=null&&n.setAttribute("value",""+de(h.value));break;case"select":n.multiple=!!h.multiple,x=h.value,x!=null?tt(n,!!h.multiple,x,!1):h.defaultValue!=null&&tt(n,!!h.multiple,h.defaultValue,!0);break;default:typeof v.onClick=="function"&&(n.onclick=yl)}switch(l){case"button":case"input":case"select":case"textarea":h=!!h.autoFocus;break e;case"img":h=!0;break e;default:h=!1}}h&&(s.flags|=4)}s.ref!==null&&(s.flags|=512,s.flags|=2097152)}return Ut(s),null;case 6:if(n&&s.stateNode!=null)Lw(n,s,n.memoizedProps,h);else{if(typeof h!="string"&&s.stateNode===null)throw Error(r(166));if(l=ei(sa.current),ei(mr.current),El(s)){if(h=s.stateNode,l=s.memoizedProps,h[pr]=s,(x=h.nodeValue!==l)&&(n=hn,n!==null))switch(n.tag){case 3:vl(h.nodeValue,l,(n.mode&1)!==0);break;case 5:n.memoizedProps.suppressHydrationWarning!==!0&&vl(h.nodeValue,l,(n.mode&1)!==0)}x&&(s.flags|=4)}else h=(l.nodeType===9?l:l.ownerDocument).createTextNode(h),h[pr]=s,s.stateNode=h}return Ut(s),null;case 13:if(dt(vt),h=s.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(pt&&pn!==null&&(s.mode&1)!==0&&(s.flags&128)===0)D0(),Ki(),s.flags|=98560,x=!1;else if(x=El(s),h!==null&&h.dehydrated!==null){if(n===null){if(!x)throw Error(r(318));if(x=s.memoizedState,x=x!==null?x.dehydrated:null,!x)throw Error(r(317));x[pr]=s}else Ki(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Ut(s),x=!1}else Yn!==null&&(Pd(Yn),Yn=null),x=!0;if(!x)return s.flags&65536?s:null}return(s.flags&128)!==0?(s.lanes=l,s):(h=h!==null,h!==(n!==null&&n.memoizedState!==null)&&h&&(s.child.flags|=8192,(s.mode&1)!==0&&(n===null||(vt.current&1)!==0?Tt===0&&(Tt=3):qd())),s.updateQueue!==null&&(s.flags|=4),Ut(s),null);case 4:return Ji(),Sd(n,s),n===null&&Qo(s.stateNode.containerInfo),Ut(s),null;case 10:return Zc(s.type._context),Ut(s),null;case 17:return tn(s.type)&&xl(),Ut(s),null;case 19:if(dt(vt),x=s.memoizedState,x===null)return Ut(s),null;if(h=(s.flags&128)!==0,R=x.rendering,R===null)if(h)ua(x,!1);else{if(Tt!==0||n!==null&&(n.flags&128)!==0)for(n=s.child;n!==null;){if(R=Al(n),R!==null){for(s.flags|=128,ua(x,!1),h=R.updateQueue,h!==null&&(s.updateQueue=h,s.flags|=4),s.subtreeFlags=0,h=l,l=s.child;l!==null;)x=l,n=h,x.flags&=14680066,R=x.alternate,R===null?(x.childLanes=0,x.lanes=n,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,n=R.dependencies,x.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),l=l.sibling;return lt(vt,vt.current&1|2),s.child}n=n.sibling}x.tail!==null&&st()>ro&&(s.flags|=128,h=!0,ua(x,!1),s.lanes=4194304)}else{if(!h)if(n=Al(R),n!==null){if(s.flags|=128,h=!0,l=n.updateQueue,l!==null&&(s.updateQueue=l,s.flags|=4),ua(x,!0),x.tail===null&&x.tailMode==="hidden"&&!R.alternate&&!pt)return Ut(s),null}else 2*st()-x.renderingStartTime>ro&&l!==1073741824&&(s.flags|=128,h=!0,ua(x,!1),s.lanes=4194304);x.isBackwards?(R.sibling=s.child,s.child=R):(l=x.last,l!==null?l.sibling=R:s.child=R,x.last=R)}return x.tail!==null?(s=x.tail,x.rendering=s,x.tail=s.sibling,x.renderingStartTime=st(),s.sibling=null,l=vt.current,lt(vt,h?l&1|2:l&1),s):(Ut(s),null);case 22:case 23:return $d(),h=s.memoizedState!==null,n!==null&&n.memoizedState!==null!==h&&(s.flags|=8192),h&&(s.mode&1)!==0?(mn&1073741824)!==0&&(Ut(s),s.subtreeFlags&6&&(s.flags|=8192)):Ut(s),null;case 24:return null;case 25:return null}throw Error(r(156,s.tag))}function CR(n,s){switch(Vc(s),s.tag){case 1:return tn(s.type)&&xl(),n=s.flags,n&65536?(s.flags=n&-65537|128,s):null;case 3:return Ji(),dt(en),dt(zt),id(),n=s.flags,(n&65536)!==0&&(n&128)===0?(s.flags=n&-65537|128,s):null;case 5:return rd(s),null;case 13:if(dt(vt),n=s.memoizedState,n!==null&&n.dehydrated!==null){if(s.alternate===null)throw Error(r(340));Ki()}return n=s.flags,n&65536?(s.flags=n&-65537|128,s):null;case 19:return dt(vt),null;case 4:return Ji(),null;case 10:return Zc(s.type._context),null;case 22:case 23:return $d(),null;case 24:return null;default:return null}}var Fl=!1,Ht=!1,jR=typeof WeakSet=="function"?WeakSet:Set,be=null;function to(n,s){var l=n.ref;if(l!==null)if(typeof l=="function")try{l(null)}catch(h){wt(n,s,h)}else l.current=null}function Ed(n,s,l){try{l()}catch(h){wt(n,s,h)}}var $w=!1;function TR(n,s){if($c=Ii,n=m0(),Tc(n)){if("selectionStart"in n)var l={start:n.selectionStart,end:n.selectionEnd};else e:{l=(l=n.ownerDocument)&&l.defaultView||window;var h=l.getSelection&&l.getSelection();if(h&&h.rangeCount!==0){l=h.anchorNode;var v=h.anchorOffset,x=h.focusNode;h=h.focusOffset;try{l.nodeType,x.nodeType}catch{l=null;break e}var R=0,D=-1,X=-1,oe=0,me=0,ge=n,he=null;t:for(;;){for(var xe;ge!==l||v!==0&&ge.nodeType!==3||(D=R+v),ge!==x||h!==0&&ge.nodeType!==3||(X=R+h),ge.nodeType===3&&(R+=ge.nodeValue.length),(xe=ge.firstChild)!==null;)he=ge,ge=xe;for(;;){if(ge===n)break t;if(he===l&&++oe===v&&(D=R),he===x&&++me===h&&(X=R),(xe=ge.nextSibling)!==null)break;ge=he,he=ge.parentNode}ge=xe}l=D===-1||X===-1?null:{start:D,end:X}}else l=null}l=l||{start:0,end:0}}else l=null;for(qc={focusedElem:n,selectionRange:l},Ii=!1,be=s;be!==null;)if(s=be,n=s.child,(s.subtreeFlags&1028)!==0&&n!==null)n.return=s,be=n;else for(;be!==null;){s=be;try{var Ee=s.alternate;if((s.flags&1024)!==0)switch(s.tag){case 0:case 11:case 15:break;case 1:if(Ee!==null){var Ce=Ee.memoizedProps,St=Ee.memoizedState,re=s.stateNode,ee=re.getSnapshotBeforeUpdate(s.elementType===s.type?Ce:Kn(s.type,Ce),St);re.__reactInternalSnapshotBeforeUpdate=ee}break;case 3:var se=s.stateNode.containerInfo;se.nodeType===1?se.textContent="":se.nodeType===9&&se.documentElement&&se.removeChild(se.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(ve){wt(s,s.return,ve)}if(n=s.sibling,n!==null){n.return=s.return,be=n;break}be=s.return}return Ee=$w,$w=!1,Ee}function ca(n,s,l){var h=s.updateQueue;if(h=h!==null?h.lastEffect:null,h!==null){var v=h=h.next;do{if((v.tag&n)===n){var x=v.destroy;v.destroy=void 0,x!==void 0&&Ed(s,l,x)}v=v.next}while(v!==h)}}function zl(n,s){if(s=s.updateQueue,s=s!==null?s.lastEffect:null,s!==null){var l=s=s.next;do{if((l.tag&n)===n){var h=l.create;l.destroy=h()}l=l.next}while(l!==s)}}function Nd(n){var s=n.ref;if(s!==null){var l=n.stateNode;switch(n.tag){case 5:n=l;break;default:n=l}typeof s=="function"?s(n):s.current=n}}function qw(n){var s=n.alternate;s!==null&&(n.alternate=null,qw(s)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(s=n.stateNode,s!==null&&(delete s[pr],delete s[Jo],delete s[Bc],delete s[dR],delete s[fR])),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}function Dw(n){return n.tag===5||n.tag===3||n.tag===4}function Fw(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||Dw(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function Cd(n,s,l){var h=n.tag;if(h===5||h===6)n=n.stateNode,s?l.nodeType===8?l.parentNode.insertBefore(n,s):l.insertBefore(n,s):(l.nodeType===8?(s=l.parentNode,s.insertBefore(n,l)):(s=l,s.appendChild(n)),l=l._reactRootContainer,l!=null||s.onclick!==null||(s.onclick=yl));else if(h!==4&&(n=n.child,n!==null))for(Cd(n,s,l),n=n.sibling;n!==null;)Cd(n,s,l),n=n.sibling}function jd(n,s,l){var h=n.tag;if(h===5||h===6)n=n.stateNode,s?l.insertBefore(n,s):l.appendChild(n);else if(h!==4&&(n=n.child,n!==null))for(jd(n,s,l),n=n.sibling;n!==null;)jd(n,s,l),n=n.sibling}var $t=null,Xn=!1;function fs(n,s,l){for(l=l.child;l!==null;)zw(n,s,l),l=l.sibling}function zw(n,s,l){if(Vt&&typeof Vt.onCommitFiberUnmount=="function")try{Vt.onCommitFiberUnmount(Zr,l)}catch{}switch(l.tag){case 5:Ht||to(l,s);case 6:var h=$t,v=Xn;$t=null,fs(n,s,l),$t=h,Xn=v,$t!==null&&(Xn?(n=$t,l=l.stateNode,n.nodeType===8?n.parentNode.removeChild(l):n.removeChild(l)):$t.removeChild(l.stateNode));break;case 18:$t!==null&&(Xn?(n=$t,l=l.stateNode,n.nodeType===8?zc(n.parentNode,l):n.nodeType===1&&zc(n,l),fr(n)):zc($t,l.stateNode));break;case 4:h=$t,v=Xn,$t=l.stateNode.containerInfo,Xn=!0,fs(n,s,l),$t=h,Xn=v;break;case 0:case 11:case 14:case 15:if(!Ht&&(h=l.updateQueue,h!==null&&(h=h.lastEffect,h!==null))){v=h=h.next;do{var x=v,R=x.destroy;x=x.tag,R!==void 0&&((x&2)!==0||(x&4)!==0)&&Ed(l,s,R),v=v.next}while(v!==h)}fs(n,s,l);break;case 1:if(!Ht&&(to(l,s),h=l.stateNode,typeof h.componentWillUnmount=="function"))try{h.props=l.memoizedProps,h.state=l.memoizedState,h.componentWillUnmount()}catch(D){wt(l,s,D)}fs(n,s,l);break;case 21:fs(n,s,l);break;case 22:l.mode&1?(Ht=(h=Ht)||l.memoizedState!==null,fs(n,s,l),Ht=h):fs(n,s,l);break;default:fs(n,s,l)}}function Bw(n){var s=n.updateQueue;if(s!==null){n.updateQueue=null;var l=n.stateNode;l===null&&(l=n.stateNode=new jR),s.forEach(function(h){var v=qR.bind(null,n,h);l.has(h)||(l.add(h),h.then(v,v))})}}function Qn(n,s){var l=s.deletions;if(l!==null)for(var h=0;h<l.length;h++){var v=l[h];try{var x=n,R=s,D=R;e:for(;D!==null;){switch(D.tag){case 5:$t=D.stateNode,Xn=!1;break e;case 3:$t=D.stateNode.containerInfo,Xn=!0;break e;case 4:$t=D.stateNode.containerInfo,Xn=!0;break e}D=D.return}if($t===null)throw Error(r(160));zw(x,R,v),$t=null,Xn=!1;var X=v.alternate;X!==null&&(X.return=null),v.return=null}catch(oe){wt(v,s,oe)}}if(s.subtreeFlags&12854)for(s=s.child;s!==null;)Uw(s,n),s=s.sibling}function Uw(n,s){var l=n.alternate,h=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:if(Qn(s,n),vr(n),h&4){try{ca(3,n,n.return),zl(3,n)}catch(Ce){wt(n,n.return,Ce)}try{ca(5,n,n.return)}catch(Ce){wt(n,n.return,Ce)}}break;case 1:Qn(s,n),vr(n),h&512&&l!==null&&to(l,l.return);break;case 5:if(Qn(s,n),vr(n),h&512&&l!==null&&to(l,l.return),n.flags&32){var v=n.stateNode;try{Te(v,"")}catch(Ce){wt(n,n.return,Ce)}}if(h&4&&(v=n.stateNode,v!=null)){var x=n.memoizedProps,R=l!==null?l.memoizedProps:x,D=n.type,X=n.updateQueue;if(n.updateQueue=null,X!==null)try{D==="input"&&x.type==="radio"&&x.name!=null&&Fe(v,x),at(D,R);var oe=at(D,x);for(R=0;R<X.length;R+=2){var me=X[R],ge=X[R+1];me==="style"?ke(v,ge):me==="dangerouslySetInnerHTML"?Oe(v,ge):me==="children"?Te(v,ge):N(v,me,ge,oe)}switch(D){case"input":we(v,x);break;case"textarea":Ze(v,x);break;case"select":var he=v._wrapperState.wasMultiple;v._wrapperState.wasMultiple=!!x.multiple;var xe=x.value;xe!=null?tt(v,!!x.multiple,xe,!1):he!==!!x.multiple&&(x.defaultValue!=null?tt(v,!!x.multiple,x.defaultValue,!0):tt(v,!!x.multiple,x.multiple?[]:"",!1))}v[Jo]=x}catch(Ce){wt(n,n.return,Ce)}}break;case 6:if(Qn(s,n),vr(n),h&4){if(n.stateNode===null)throw Error(r(162));v=n.stateNode,x=n.memoizedProps;try{v.nodeValue=x}catch(Ce){wt(n,n.return,Ce)}}break;case 3:if(Qn(s,n),vr(n),h&4&&l!==null&&l.memoizedState.isDehydrated)try{fr(s.containerInfo)}catch(Ce){wt(n,n.return,Ce)}break;case 4:Qn(s,n),vr(n);break;case 13:Qn(s,n),vr(n),v=n.child,v.flags&8192&&(x=v.memoizedState!==null,v.stateNode.isHidden=x,!x||v.alternate!==null&&v.alternate.memoizedState!==null||(Ad=st())),h&4&&Bw(n);break;case 22:if(me=l!==null&&l.memoizedState!==null,n.mode&1?(Ht=(oe=Ht)||me,Qn(s,n),Ht=oe):Qn(s,n),vr(n),h&8192){if(oe=n.memoizedState!==null,(n.stateNode.isHidden=oe)&&!me&&(n.mode&1)!==0)for(be=n,me=n.child;me!==null;){for(ge=be=me;be!==null;){switch(he=be,xe=he.child,he.tag){case 0:case 11:case 14:case 15:ca(4,he,he.return);break;case 1:to(he,he.return);var Ee=he.stateNode;if(typeof Ee.componentWillUnmount=="function"){h=he,l=he.return;try{s=h,Ee.props=s.memoizedProps,Ee.state=s.memoizedState,Ee.componentWillUnmount()}catch(Ce){wt(h,l,Ce)}}break;case 5:to(he,he.return);break;case 22:if(he.memoizedState!==null){Vw(ge);continue}}xe!==null?(xe.return=he,be=xe):Vw(ge)}me=me.sibling}e:for(me=null,ge=n;;){if(ge.tag===5){if(me===null){me=ge;try{v=ge.stateNode,oe?(x=v.style,typeof x.setProperty=="function"?x.setProperty("display","none","important"):x.display="none"):(D=ge.stateNode,X=ge.memoizedProps.style,R=X!=null&&X.hasOwnProperty("display")?X.display:null,D.style.display=Je("display",R))}catch(Ce){wt(n,n.return,Ce)}}}else if(ge.tag===6){if(me===null)try{ge.stateNode.nodeValue=oe?"":ge.memoizedProps}catch(Ce){wt(n,n.return,Ce)}}else if((ge.tag!==22&&ge.tag!==23||ge.memoizedState===null||ge===n)&&ge.child!==null){ge.child.return=ge,ge=ge.child;continue}if(ge===n)break e;for(;ge.sibling===null;){if(ge.return===null||ge.return===n)break e;me===ge&&(me=null),ge=ge.return}me===ge&&(me=null),ge.sibling.return=ge.return,ge=ge.sibling}}break;case 19:Qn(s,n),vr(n),h&4&&Bw(n);break;case 21:break;default:Qn(s,n),vr(n)}}function vr(n){var s=n.flags;if(s&2){try{e:{for(var l=n.return;l!==null;){if(Dw(l)){var h=l;break e}l=l.return}throw Error(r(160))}switch(h.tag){case 5:var v=h.stateNode;h.flags&32&&(Te(v,""),h.flags&=-33);var x=Fw(n);jd(n,x,v);break;case 3:case 4:var R=h.stateNode.containerInfo,D=Fw(n);Cd(n,D,R);break;default:throw Error(r(161))}}catch(X){wt(n,n.return,X)}n.flags&=-3}s&4096&&(n.flags&=-4097)}function RR(n,s,l){be=n,Hw(n)}function Hw(n,s,l){for(var h=(n.mode&1)!==0;be!==null;){var v=be,x=v.child;if(v.tag===22&&h){var R=v.memoizedState!==null||Fl;if(!R){var D=v.alternate,X=D!==null&&D.memoizedState!==null||Ht;D=Fl;var oe=Ht;if(Fl=R,(Ht=X)&&!oe)for(be=v;be!==null;)R=be,X=R.child,R.tag===22&&R.memoizedState!==null?Gw(v):X!==null?(X.return=R,be=X):Gw(v);for(;x!==null;)be=x,Hw(x),x=x.sibling;be=v,Fl=D,Ht=oe}Ww(n)}else(v.subtreeFlags&8772)!==0&&x!==null?(x.return=v,be=x):Ww(n)}}function Ww(n){for(;be!==null;){var s=be;if((s.flags&8772)!==0){var l=s.alternate;try{if((s.flags&8772)!==0)switch(s.tag){case 0:case 11:case 15:Ht||zl(5,s);break;case 1:var h=s.stateNode;if(s.flags&4&&!Ht)if(l===null)h.componentDidMount();else{var v=s.elementType===s.type?l.memoizedProps:Kn(s.type,l.memoizedProps);h.componentDidUpdate(v,l.memoizedState,h.__reactInternalSnapshotBeforeUpdate)}var x=s.updateQueue;x!==null&&V0(s,x,h);break;case 3:var R=s.updateQueue;if(R!==null){if(l=null,s.child!==null)switch(s.child.tag){case 5:l=s.child.stateNode;break;case 1:l=s.child.stateNode}V0(s,R,l)}break;case 5:var D=s.stateNode;if(l===null&&s.flags&4){l=D;var X=s.memoizedProps;switch(s.type){case"button":case"input":case"select":case"textarea":X.autoFocus&&l.focus();break;case"img":X.src&&(l.src=X.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(s.memoizedState===null){var oe=s.alternate;if(oe!==null){var me=oe.memoizedState;if(me!==null){var ge=me.dehydrated;ge!==null&&fr(ge)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}Ht||s.flags&512&&Nd(s)}catch(he){wt(s,s.return,he)}}if(s===n){be=null;break}if(l=s.sibling,l!==null){l.return=s.return,be=l;break}be=s.return}}function Vw(n){for(;be!==null;){var s=be;if(s===n){be=null;break}var l=s.sibling;if(l!==null){l.return=s.return,be=l;break}be=s.return}}function Gw(n){for(;be!==null;){var s=be;try{switch(s.tag){case 0:case 11:case 15:var l=s.return;try{zl(4,s)}catch(X){wt(s,l,X)}break;case 1:var h=s.stateNode;if(typeof h.componentDidMount=="function"){var v=s.return;try{h.componentDidMount()}catch(X){wt(s,v,X)}}var x=s.return;try{Nd(s)}catch(X){wt(s,x,X)}break;case 5:var R=s.return;try{Nd(s)}catch(X){wt(s,R,X)}}}catch(X){wt(s,s.return,X)}if(s===n){be=null;break}var D=s.sibling;if(D!==null){D.return=s.return,be=D;break}be=s.return}}var AR=Math.ceil,Bl=T.ReactCurrentDispatcher,Td=T.ReactCurrentOwner,Mn=T.ReactCurrentBatchConfig,Qe=0,Mt=null,Et=null,qt=0,mn=0,no=as(0),Tt=0,da=null,ni=0,Ul=0,Rd=0,fa=null,rn=null,Ad=0,ro=1/0,qr=null,Hl=!1,Id=null,hs=null,Wl=!1,ps=null,Vl=0,ha=0,Md=null,Gl=-1,Yl=0;function Zt(){return(Qe&6)!==0?st():Gl!==-1?Gl:Gl=st()}function ms(n){return(n.mode&1)===0?1:(Qe&2)!==0&&qt!==0?qt&-qt:pR.transition!==null?(Yl===0&&(Yl=Ei()),Yl):(n=Xe,n!==0||(n=window.event,n=n===void 0?16:Wn(n.type)),n)}function Zn(n,s,l,h){if(50<ha)throw ha=0,Md=null,Error(r(185));cr(n,l,h),((Qe&2)===0||n!==Mt)&&(n===Mt&&((Qe&2)===0&&(Ul|=l),Tt===4&&gs(n,qt)),sn(n,h),l===1&&Qe===0&&(s.mode&1)===0&&(ro=st()+500,bl&&us()))}function sn(n,s){var l=n.callbackNode;En(n,s);var h=fn(n,n===Mt?qt:0);if(h===0)l!==null&&Os(l),n.callbackNode=null,n.callbackPriority=0;else if(s=h&-h,n.callbackPriority!==s){if(l!=null&&Os(l),s===1)n.tag===0?hR(Kw.bind(null,n)):O0(Kw.bind(null,n)),uR(function(){(Qe&6)===0&&us()}),l=null;else{switch(Mo(h)){case 1:l=Qr;break;case 4:l=Si;break;case 16:l=kn;break;case 536870912:l=Sn;break;default:l=kn}l=rx(l,Yw.bind(null,n))}n.callbackPriority=s,n.callbackNode=l}}function Yw(n,s){if(Gl=-1,Yl=0,(Qe&6)!==0)throw Error(r(327));var l=n.callbackNode;if(so()&&n.callbackNode!==l)return null;var h=fn(n,n===Mt?qt:0);if(h===0)return null;if((h&30)!==0||(h&n.expiredLanes)!==0||s)s=Kl(n,h);else{s=h;var v=Qe;Qe|=2;var x=Qw();(Mt!==n||qt!==s)&&(qr=null,ro=st()+500,si(n,s));do try{OR();break}catch(D){Xw(n,D)}while(!0);Qc(),Bl.current=x,Qe=v,Et!==null?s=0:(Mt=null,qt=0,s=Tt)}if(s!==0){if(s===2&&(v=Ds(n),v!==0&&(h=v,s=Od(n,v))),s===1)throw l=da,si(n,0),gs(n,h),sn(n,st()),l;if(s===6)gs(n,h);else{if(v=n.current.alternate,(h&30)===0&&!IR(v)&&(s=Kl(n,h),s===2&&(x=Ds(n),x!==0&&(h=x,s=Od(n,x))),s===1))throw l=da,si(n,0),gs(n,h),sn(n,st()),l;switch(n.finishedWork=v,n.finishedLanes=h,s){case 0:case 1:throw Error(r(345));case 2:ii(n,rn,qr);break;case 3:if(gs(n,h),(h&130023424)===h&&(s=Ad+500-st(),10<s)){if(fn(n,0)!==0)break;if(v=n.suspendedLanes,(v&h)!==h){Zt(),n.pingedLanes|=n.suspendedLanes&v;break}n.timeoutHandle=Fc(ii.bind(null,n,rn,qr),s);break}ii(n,rn,qr);break;case 4:if(gs(n,h),(h&4194240)===h)break;for(s=n.eventTimes,v=-1;0<h;){var R=31-dn(h);x=1<<R,R=s[R],R>v&&(v=R),h&=~x}if(h=v,h=st()-h,h=(120>h?120:480>h?480:1080>h?1080:1920>h?1920:3e3>h?3e3:4320>h?4320:1960*AR(h/1960))-h,10<h){n.timeoutHandle=Fc(ii.bind(null,n,rn,qr),h);break}ii(n,rn,qr);break;case 5:ii(n,rn,qr);break;default:throw Error(r(329))}}}return sn(n,st()),n.callbackNode===l?Yw.bind(null,n):null}function Od(n,s){var l=fa;return n.current.memoizedState.isDehydrated&&(si(n,s).flags|=256),n=Kl(n,s),n!==2&&(s=rn,rn=l,s!==null&&Pd(s)),n}function Pd(n){rn===null?rn=n:rn.push.apply(rn,n)}function IR(n){for(var s=n;;){if(s.flags&16384){var l=s.updateQueue;if(l!==null&&(l=l.stores,l!==null))for(var h=0;h<l.length;h++){var v=l[h],x=v.getSnapshot;v=v.value;try{if(!Gn(x(),v))return!1}catch{return!1}}}if(l=s.child,s.subtreeFlags&16384&&l!==null)l.return=s,s=l;else{if(s===n)break;for(;s.sibling===null;){if(s.return===null||s.return===n)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function gs(n,s){for(s&=~Rd,s&=~Ul,n.suspendedLanes|=s,n.pingedLanes&=~s,n=n.expirationTimes;0<s;){var l=31-dn(s),h=1<<l;n[l]=-1,s&=~h}}function Kw(n){if((Qe&6)!==0)throw Error(r(327));so();var s=fn(n,0);if((s&1)===0)return sn(n,st()),null;var l=Kl(n,s);if(n.tag!==0&&l===2){var h=Ds(n);h!==0&&(s=h,l=Od(n,h))}if(l===1)throw l=da,si(n,0),gs(n,s),sn(n,st()),l;if(l===6)throw Error(r(345));return n.finishedWork=n.current.alternate,n.finishedLanes=s,ii(n,rn,qr),sn(n,st()),null}function Ld(n,s){var l=Qe;Qe|=1;try{return n(s)}finally{Qe=l,Qe===0&&(ro=st()+500,bl&&us())}}function ri(n){ps!==null&&ps.tag===0&&(Qe&6)===0&&so();var s=Qe;Qe|=1;var l=Mn.transition,h=Xe;try{if(Mn.transition=null,Xe=1,n)return n()}finally{Xe=h,Mn.transition=l,Qe=s,(Qe&6)===0&&us()}}function $d(){mn=no.current,dt(no)}function si(n,s){n.finishedWork=null,n.finishedLanes=0;var l=n.timeoutHandle;if(l!==-1&&(n.timeoutHandle=-1,lR(l)),Et!==null)for(l=Et.return;l!==null;){var h=l;switch(Vc(h),h.tag){case 1:h=h.type.childContextTypes,h!=null&&xl();break;case 3:Ji(),dt(en),dt(zt),id();break;case 5:rd(h);break;case 4:Ji();break;case 13:dt(vt);break;case 19:dt(vt);break;case 10:Zc(h.type._context);break;case 22:case 23:$d()}l=l.return}if(Mt=n,Et=n=vs(n.current,null),qt=mn=s,Tt=0,da=null,Rd=Ul=ni=0,rn=fa=null,Js!==null){for(s=0;s<Js.length;s++)if(l=Js[s],h=l.interleaved,h!==null){l.interleaved=null;var v=h.next,x=l.pending;if(x!==null){var R=x.next;x.next=v,h.next=R}l.pending=h}Js=null}return n}function Xw(n,s){do{var l=Et;try{if(Qc(),Il.current=Ll,Ml){for(var h=yt.memoizedState;h!==null;){var v=h.queue;v!==null&&(v.pending=null),h=h.next}Ml=!1}if(ti=0,It=jt=yt=null,ia=!1,oa=0,Td.current=null,l===null||l.return===null){Tt=1,da=s,Et=null;break}e:{var x=n,R=l.return,D=l,X=s;if(s=qt,D.flags|=32768,X!==null&&typeof X=="object"&&typeof X.then=="function"){var oe=X,me=D,ge=me.tag;if((me.mode&1)===0&&(ge===0||ge===11||ge===15)){var he=me.alternate;he?(me.updateQueue=he.updateQueue,me.memoizedState=he.memoizedState,me.lanes=he.lanes):(me.updateQueue=null,me.memoizedState=null)}var xe=_w(R);if(xe!==null){xe.flags&=-257,bw(xe,R,D,x,s),xe.mode&1&&xw(x,oe,s),s=xe,X=oe;var Ee=s.updateQueue;if(Ee===null){var Ce=new Set;Ce.add(X),s.updateQueue=Ce}else Ee.add(X);break e}else{if((s&1)===0){xw(x,oe,s),qd();break e}X=Error(r(426))}}else if(pt&&D.mode&1){var St=_w(R);if(St!==null){(St.flags&65536)===0&&(St.flags|=256),bw(St,R,D,x,s),Kc(eo(X,D));break e}}x=X=eo(X,D),Tt!==4&&(Tt=2),fa===null?fa=[x]:fa.push(x),x=R;do{switch(x.tag){case 3:x.flags|=65536,s&=-s,x.lanes|=s;var re=yw(x,X,s);W0(x,re);break e;case 1:D=X;var ee=x.type,se=x.stateNode;if((x.flags&128)===0&&(typeof ee.getDerivedStateFromError=="function"||se!==null&&typeof se.componentDidCatch=="function"&&(hs===null||!hs.has(se)))){x.flags|=65536,s&=-s,x.lanes|=s;var ve=ww(x,D,s);W0(x,ve);break e}}x=x.return}while(x!==null)}Jw(l)}catch(je){s=je,Et===l&&l!==null&&(Et=l=l.return);continue}break}while(!0)}function Qw(){var n=Bl.current;return Bl.current=Ll,n===null?Ll:n}function qd(){(Tt===0||Tt===3||Tt===2)&&(Tt=4),Mt===null||(ni&268435455)===0&&(Ul&268435455)===0||gs(Mt,qt)}function Kl(n,s){var l=Qe;Qe|=2;var h=Qw();(Mt!==n||qt!==s)&&(qr=null,si(n,s));do try{MR();break}catch(v){Xw(n,v)}while(!0);if(Qc(),Qe=l,Bl.current=h,Et!==null)throw Error(r(261));return Mt=null,qt=0,Tt}function MR(){for(;Et!==null;)Zw(Et)}function OR(){for(;Et!==null&&!Ps();)Zw(Et)}function Zw(n){var s=nx(n.alternate,n,mn);n.memoizedProps=n.pendingProps,s===null?Jw(n):Et=s,Td.current=null}function Jw(n){var s=n;do{var l=s.alternate;if(n=s.return,(s.flags&32768)===0){if(l=NR(l,s,mn),l!==null){Et=l;return}}else{if(l=CR(l,s),l!==null){l.flags&=32767,Et=l;return}if(n!==null)n.flags|=32768,n.subtreeFlags=0,n.deletions=null;else{Tt=6,Et=null;return}}if(s=s.sibling,s!==null){Et=s;return}Et=s=n}while(s!==null);Tt===0&&(Tt=5)}function ii(n,s,l){var h=Xe,v=Mn.transition;try{Mn.transition=null,Xe=1,PR(n,s,l,h)}finally{Mn.transition=v,Xe=h}return null}function PR(n,s,l,h){do so();while(ps!==null);if((Qe&6)!==0)throw Error(r(327));l=n.finishedWork;var v=n.finishedLanes;if(l===null)return null;if(n.finishedWork=null,n.finishedLanes=0,l===n.current)throw Error(r(177));n.callbackNode=null,n.callbackPriority=0;var x=l.lanes|l.childLanes;if(Io(n,x),n===Mt&&(Et=Mt=null,qt=0),(l.subtreeFlags&2064)===0&&(l.flags&2064)===0||Wl||(Wl=!0,rx(kn,function(){return so(),null})),x=(l.flags&15990)!==0,(l.subtreeFlags&15990)!==0||x){x=Mn.transition,Mn.transition=null;var R=Xe;Xe=1;var D=Qe;Qe|=4,Td.current=null,TR(n,l),Uw(l,n),tR(qc),Ii=!!$c,qc=$c=null,n.current=l,RR(l),Pt(),Qe=D,Xe=R,Mn.transition=x}else n.current=l;if(Wl&&(Wl=!1,ps=n,Vl=v),x=n.pendingLanes,x===0&&(hs=null),$s(l.stateNode),sn(n,st()),s!==null)for(h=n.onRecoverableError,l=0;l<s.length;l++)v=s[l],h(v.value,{componentStack:v.stack,digest:v.digest});if(Hl)throw Hl=!1,n=Id,Id=null,n;return(Vl&1)!==0&&n.tag!==0&&so(),x=n.pendingLanes,(x&1)!==0?n===Md?ha++:(ha=0,Md=n):ha=0,us(),null}function so(){if(ps!==null){var n=Mo(Vl),s=Mn.transition,l=Xe;try{if(Mn.transition=null,Xe=16>n?16:n,ps===null)var h=!1;else{if(n=ps,ps=null,Vl=0,(Qe&6)!==0)throw Error(r(331));var v=Qe;for(Qe|=4,be=n.current;be!==null;){var x=be,R=x.child;if((be.flags&16)!==0){var D=x.deletions;if(D!==null){for(var X=0;X<D.length;X++){var oe=D[X];for(be=oe;be!==null;){var me=be;switch(me.tag){case 0:case 11:case 15:ca(8,me,x)}var ge=me.child;if(ge!==null)ge.return=me,be=ge;else for(;be!==null;){me=be;var he=me.sibling,xe=me.return;if(qw(me),me===oe){be=null;break}if(he!==null){he.return=xe,be=he;break}be=xe}}}var Ee=x.alternate;if(Ee!==null){var Ce=Ee.child;if(Ce!==null){Ee.child=null;do{var St=Ce.sibling;Ce.sibling=null,Ce=St}while(Ce!==null)}}be=x}}if((x.subtreeFlags&2064)!==0&&R!==null)R.return=x,be=R;else e:for(;be!==null;){if(x=be,(x.flags&2048)!==0)switch(x.tag){case 0:case 11:case 15:ca(9,x,x.return)}var re=x.sibling;if(re!==null){re.return=x.return,be=re;break e}be=x.return}}var ee=n.current;for(be=ee;be!==null;){R=be;var se=R.child;if((R.subtreeFlags&2064)!==0&&se!==null)se.return=R,be=se;else e:for(R=ee;be!==null;){if(D=be,(D.flags&2048)!==0)try{switch(D.tag){case 0:case 11:case 15:zl(9,D)}}catch(je){wt(D,D.return,je)}if(D===R){be=null;break e}var ve=D.sibling;if(ve!==null){ve.return=D.return,be=ve;break e}be=D.return}}if(Qe=v,us(),Vt&&typeof Vt.onPostCommitFiberRoot=="function")try{Vt.onPostCommitFiberRoot(Zr,n)}catch{}h=!0}return h}finally{Xe=l,Mn.transition=s}}return!1}function ex(n,s,l){s=eo(l,s),s=yw(n,s,1),n=ds(n,s,1),s=Zt(),n!==null&&(cr(n,1,s),sn(n,s))}function wt(n,s,l){if(n.tag===3)ex(n,n,l);else for(;s!==null;){if(s.tag===3){ex(s,n,l);break}else if(s.tag===1){var h=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof h.componentDidCatch=="function"&&(hs===null||!hs.has(h))){n=eo(l,n),n=ww(s,n,1),s=ds(s,n,1),n=Zt(),s!==null&&(cr(s,1,n),sn(s,n));break}}s=s.return}}function LR(n,s,l){var h=n.pingCache;h!==null&&h.delete(s),s=Zt(),n.pingedLanes|=n.suspendedLanes&l,Mt===n&&(qt&l)===l&&(Tt===4||Tt===3&&(qt&130023424)===qt&&500>st()-Ad?si(n,0):Rd|=l),sn(n,s)}function tx(n,s){s===0&&((n.mode&1)===0?s=1:(s=qs,qs<<=1,(qs&130023424)===0&&(qs=4194304)));var l=Zt();n=Pr(n,s),n!==null&&(cr(n,s,l),sn(n,l))}function $R(n){var s=n.memoizedState,l=0;s!==null&&(l=s.retryLane),tx(n,l)}function qR(n,s){var l=0;switch(n.tag){case 13:var h=n.stateNode,v=n.memoizedState;v!==null&&(l=v.retryLane);break;case 19:h=n.stateNode;break;default:throw Error(r(314))}h!==null&&h.delete(s),tx(n,l)}var nx;nx=function(n,s,l){if(n!==null)if(n.memoizedProps!==s.pendingProps||en.current)nn=!0;else{if((n.lanes&l)===0&&(s.flags&128)===0)return nn=!1,ER(n,s,l);nn=(n.flags&131072)!==0}else nn=!1,pt&&(s.flags&1048576)!==0&&P0(s,Sl,s.index);switch(s.lanes=0,s.tag){case 2:var h=s.type;Dl(n,s),n=s.pendingProps;var v=Vi(s,zt.current);Zi(s,l),v=ld(null,s,h,n,v,l);var x=ud();return s.flags|=1,typeof v=="object"&&v!==null&&typeof v.render=="function"&&v.$$typeof===void 0?(s.tag=1,s.memoizedState=null,s.updateQueue=null,tn(h)?(x=!0,_l(s)):x=!1,s.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,td(s),v.updater=$l,s.stateNode=v,v._reactInternals=s,md(s,h,n,l),s=wd(null,s,h,!0,x,l)):(s.tag=0,pt&&x&&Wc(s),Qt(null,s,v,l),s=s.child),s;case 16:h=s.elementType;e:{switch(Dl(n,s),n=s.pendingProps,v=h._init,h=v(h._payload),s.type=h,v=s.tag=FR(h),n=Kn(h,n),v){case 0:s=yd(null,s,h,n,l);break e;case 1:s=jw(null,s,h,n,l);break e;case 11:s=kw(null,s,h,n,l);break e;case 14:s=Sw(null,s,h,Kn(h.type,n),l);break e}throw Error(r(306,h,""))}return s;case 0:return h=s.type,v=s.pendingProps,v=s.elementType===h?v:Kn(h,v),yd(n,s,h,v,l);case 1:return h=s.type,v=s.pendingProps,v=s.elementType===h?v:Kn(h,v),jw(n,s,h,v,l);case 3:e:{if(Tw(s),n===null)throw Error(r(387));h=s.pendingProps,x=s.memoizedState,v=x.element,H0(n,s),Rl(s,h,null,l);var R=s.memoizedState;if(h=R.element,x.isDehydrated)if(x={element:h,isDehydrated:!1,cache:R.cache,pendingSuspenseBoundaries:R.pendingSuspenseBoundaries,transitions:R.transitions},s.updateQueue.baseState=x,s.memoizedState=x,s.flags&256){v=eo(Error(r(423)),s),s=Rw(n,s,h,l,v);break e}else if(h!==v){v=eo(Error(r(424)),s),s=Rw(n,s,h,l,v);break e}else for(pn=os(s.stateNode.containerInfo.firstChild),hn=s,pt=!0,Yn=null,l=B0(s,null,h,l),s.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling;else{if(Ki(),h===v){s=$r(n,s,l);break e}Qt(n,s,h,l)}s=s.child}return s;case 5:return G0(s),n===null&&Yc(s),h=s.type,v=s.pendingProps,x=n!==null?n.memoizedProps:null,R=v.children,Dc(h,v)?R=null:x!==null&&Dc(h,x)&&(s.flags|=32),Cw(n,s),Qt(n,s,R,l),s.child;case 6:return n===null&&Yc(s),null;case 13:return Aw(n,s,l);case 4:return nd(s,s.stateNode.containerInfo),h=s.pendingProps,n===null?s.child=Xi(s,null,h,l):Qt(n,s,h,l),s.child;case 11:return h=s.type,v=s.pendingProps,v=s.elementType===h?v:Kn(h,v),kw(n,s,h,v,l);case 7:return Qt(n,s,s.pendingProps,l),s.child;case 8:return Qt(n,s,s.pendingProps.children,l),s.child;case 12:return Qt(n,s,s.pendingProps.children,l),s.child;case 10:e:{if(h=s.type._context,v=s.pendingProps,x=s.memoizedProps,R=v.value,lt(Cl,h._currentValue),h._currentValue=R,x!==null)if(Gn(x.value,R)){if(x.children===v.children&&!en.current){s=$r(n,s,l);break e}}else for(x=s.child,x!==null&&(x.return=s);x!==null;){var D=x.dependencies;if(D!==null){R=x.child;for(var X=D.firstContext;X!==null;){if(X.context===h){if(x.tag===1){X=Lr(-1,l&-l),X.tag=2;var oe=x.updateQueue;if(oe!==null){oe=oe.shared;var me=oe.pending;me===null?X.next=X:(X.next=me.next,me.next=X),oe.pending=X}}x.lanes|=l,X=x.alternate,X!==null&&(X.lanes|=l),Jc(x.return,l,s),D.lanes|=l;break}X=X.next}}else if(x.tag===10)R=x.type===s.type?null:x.child;else if(x.tag===18){if(R=x.return,R===null)throw Error(r(341));R.lanes|=l,D=R.alternate,D!==null&&(D.lanes|=l),Jc(R,l,s),R=x.sibling}else R=x.child;if(R!==null)R.return=x;else for(R=x;R!==null;){if(R===s){R=null;break}if(x=R.sibling,x!==null){x.return=R.return,R=x;break}R=R.return}x=R}Qt(n,s,v.children,l),s=s.child}return s;case 9:return v=s.type,h=s.pendingProps.children,Zi(s,l),v=An(v),h=h(v),s.flags|=1,Qt(n,s,h,l),s.child;case 14:return h=s.type,v=Kn(h,s.pendingProps),v=Kn(h.type,v),Sw(n,s,h,v,l);case 15:return Ew(n,s,s.type,s.pendingProps,l);case 17:return h=s.type,v=s.pendingProps,v=s.elementType===h?v:Kn(h,v),Dl(n,s),s.tag=1,tn(h)?(n=!0,_l(s)):n=!1,Zi(s,l),gw(s,h,v),md(s,h,v,l),wd(null,s,h,!0,n,l);case 19:return Mw(n,s,l);case 22:return Nw(n,s,l)}throw Error(r(156,s.tag))};function rx(n,s){return kr(n,s)}function DR(n,s,l,h){this.tag=n,this.key=l,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=s,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=h,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function On(n,s,l,h){return new DR(n,s,l,h)}function Dd(n){return n=n.prototype,!(!n||!n.isReactComponent)}function FR(n){if(typeof n=="function")return Dd(n)?1:0;if(n!=null){if(n=n.$$typeof,n===V)return 11;if(n===G)return 14}return 2}function vs(n,s){var l=n.alternate;return l===null?(l=On(n.tag,s,n.key,n.mode),l.elementType=n.elementType,l.type=n.type,l.stateNode=n.stateNode,l.alternate=n,n.alternate=l):(l.pendingProps=s,l.type=n.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=n.flags&14680064,l.childLanes=n.childLanes,l.lanes=n.lanes,l.child=n.child,l.memoizedProps=n.memoizedProps,l.memoizedState=n.memoizedState,l.updateQueue=n.updateQueue,s=n.dependencies,l.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},l.sibling=n.sibling,l.index=n.index,l.ref=n.ref,l}function Xl(n,s,l,h,v,x){var R=2;if(h=n,typeof n=="function")Dd(n)&&(R=1);else if(typeof n=="string")R=5;else e:switch(n){case P:return oi(l.children,v,x,s);case U:R=8,v|=8;break;case O:return n=On(12,l,s,v|2),n.elementType=O,n.lanes=x,n;case Q:return n=On(13,l,s,v),n.elementType=Q,n.lanes=x,n;case j:return n=On(19,l,s,v),n.elementType=j,n.lanes=x,n;case te:return Ql(l,v,x,s);default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case M:R=10;break e;case q:R=9;break e;case V:R=11;break e;case G:R=14;break e;case z:R=16,h=null;break e}throw Error(r(130,n==null?n:typeof n,""))}return s=On(R,l,s,v),s.elementType=n,s.type=h,s.lanes=x,s}function oi(n,s,l,h){return n=On(7,n,h,s),n.lanes=l,n}function Ql(n,s,l,h){return n=On(22,n,h,s),n.elementType=te,n.lanes=l,n.stateNode={isHidden:!1},n}function Fd(n,s,l){return n=On(6,n,null,s),n.lanes=l,n}function zd(n,s,l){return s=On(4,n.children!==null?n.children:[],n.key,s),s.lanes=l,s.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},s}function zR(n,s,l,h,v){this.tag=s,this.containerInfo=n,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Ni(0),this.expirationTimes=Ni(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ni(0),this.identifierPrefix=h,this.onRecoverableError=v,this.mutableSourceEagerHydrationData=null}function Bd(n,s,l,h,v,x,R,D,X){return n=new zR(n,s,l,D,X),s===1?(s=1,x===!0&&(s|=8)):s=0,x=On(3,null,null,s),n.current=x,x.stateNode=n,x.memoizedState={element:h,isDehydrated:l,cache:null,transitions:null,pendingSuspenseBoundaries:null},td(x),n}function BR(n,s,l){var h=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:L,key:h==null?null:""+h,children:n,containerInfo:s,implementation:l}}function sx(n){if(!n)return ls;n=n._reactInternals;e:{if(Bn(n)!==n||n.tag!==1)throw Error(r(170));var s=n;do{switch(s.tag){case 3:s=s.stateNode.context;break e;case 1:if(tn(s.type)){s=s.stateNode.__reactInternalMemoizedMergedChildContext;break e}}s=s.return}while(s!==null);throw Error(r(171))}if(n.tag===1){var l=n.type;if(tn(l))return I0(n,l,s)}return s}function ix(n,s,l,h,v,x,R,D,X){return n=Bd(l,h,!0,n,v,x,R,D,X),n.context=sx(null),l=n.current,h=Zt(),v=ms(l),x=Lr(h,v),x.callback=s??null,ds(l,x,v),n.current.lanes=v,cr(n,v,h),sn(n,h),n}function Zl(n,s,l,h){var v=s.current,x=Zt(),R=ms(v);return l=sx(l),s.context===null?s.context=l:s.pendingContext=l,s=Lr(x,R),s.payload={element:n},h=h===void 0?null:h,h!==null&&(s.callback=h),n=ds(v,s,R),n!==null&&(Zn(n,v,R,x),Tl(n,v,R)),R}function Jl(n){if(n=n.current,!n.child)return null;switch(n.child.tag){case 5:return n.child.stateNode;default:return n.child.stateNode}}function ox(n,s){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var l=n.retryLane;n.retryLane=l!==0&&l<s?l:s}}function Ud(n,s){ox(n,s),(n=n.alternate)&&ox(n,s)}function UR(){return null}var ax=typeof reportError=="function"?reportError:function(n){console.error(n)};function Hd(n){this._internalRoot=n}eu.prototype.render=Hd.prototype.render=function(n){var s=this._internalRoot;if(s===null)throw Error(r(409));Zl(n,s,null,null)},eu.prototype.unmount=Hd.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var s=n.containerInfo;ri(function(){Zl(null,n,null,null)}),s[Ar]=null}};function eu(n){this._internalRoot=n}eu.prototype.unstable_scheduleHydration=function(n){if(n){var s=Oo();n={blockedOn:null,target:n,priority:s};for(var l=0;l<Hn.length&&s!==0&&s<Hn[l].priority;l++);Hn.splice(l,0,n),l===0&&Cr(n)}};function Wd(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function tu(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11&&(n.nodeType!==8||n.nodeValue!==" react-mount-point-unstable "))}function lx(){}function HR(n,s,l,h,v){if(v){if(typeof h=="function"){var x=h;h=function(){var oe=Jl(R);x.call(oe)}}var R=ix(s,h,n,0,null,!1,!1,"",lx);return n._reactRootContainer=R,n[Ar]=R.current,Qo(n.nodeType===8?n.parentNode:n),ri(),R}for(;v=n.lastChild;)n.removeChild(v);if(typeof h=="function"){var D=h;h=function(){var oe=Jl(X);D.call(oe)}}var X=Bd(n,0,!1,null,null,!1,!1,"",lx);return n._reactRootContainer=X,n[Ar]=X.current,Qo(n.nodeType===8?n.parentNode:n),ri(function(){Zl(s,X,l,h)}),X}function nu(n,s,l,h,v){var x=l._reactRootContainer;if(x){var R=x;if(typeof v=="function"){var D=v;v=function(){var X=Jl(R);D.call(X)}}Zl(s,R,n,v)}else R=HR(l,s,n,v,h);return Jl(R)}ji=function(n){switch(n.tag){case 3:var s=n.stateNode;if(s.current.memoizedState.isDehydrated){var l=Er(s.pendingLanes);l!==0&&(Ci(s,l|1),sn(s,st()),(Qe&6)===0&&(ro=st()+500,us()))}break;case 13:ri(function(){var h=Pr(n,1);if(h!==null){var v=Zt();Zn(h,n,1,v)}}),Ud(n,1)}},Ti=function(n){if(n.tag===13){var s=Pr(n,134217728);if(s!==null){var l=Zt();Zn(s,n,134217728,l)}Ud(n,134217728)}},Nr=function(n){if(n.tag===13){var s=ms(n),l=Pr(n,s);if(l!==null){var h=Zt();Zn(l,n,s,h)}Ud(n,s)}},Oo=function(){return Xe},Po=function(n,s){var l=Xe;try{return Xe=n,s()}finally{Xe=l}},un=function(n,s,l){switch(s){case"input":if(we(n,l),s=l.name,l.type==="radio"&&s!=null){for(l=n;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll("input[name="+JSON.stringify(""+s)+'][type="radio"]'),s=0;s<l.length;s++){var h=l[s];if(h!==n&&h.form===n.form){var v=wl(h);if(!v)throw Error(r(90));Ue(h),we(h,v)}}}break;case"textarea":Ze(n,l);break;case"select":s=l.value,s!=null&&tt(n,!!l.multiple,s,!1)}},ar=Ld,bi=ri;var WR={usingClientEntryPoint:!1,Events:[ea,Hi,wl,_i,Cs,Ld]},pa={findFiberByHostInstance:Ks,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},VR={bundleType:pa.bundleType,version:pa.version,rendererPackageName:pa.rendererPackageName,rendererConfig:pa.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:T.ReactCurrentDispatcher,findHostInstanceByFiber:function(n){return n=Is(n),n===null?null:n.stateNode},findFiberByHostInstance:pa.findFiberByHostInstance||UR,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 ru=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ru.isDisabled&&ru.supportsFiber)try{Zr=ru.inject(VR),Vt=ru}catch{}}return on.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=WR,on.createPortal=function(n,s){var l=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Wd(s))throw Error(r(200));return BR(n,s,null,l)},on.createRoot=function(n,s){if(!Wd(n))throw Error(r(299));var l=!1,h="",v=ax;return s!=null&&(s.unstable_strictMode===!0&&(l=!0),s.identifierPrefix!==void 0&&(h=s.identifierPrefix),s.onRecoverableError!==void 0&&(v=s.onRecoverableError)),s=Bd(n,1,!1,null,null,l,!1,h,v),n[Ar]=s.current,Qo(n.nodeType===8?n.parentNode:n),new Hd(s)},on.findDOMNode=function(n){if(n==null)return null;if(n.nodeType===1)return n;var s=n._reactInternals;if(s===void 0)throw typeof n.render=="function"?Error(r(188)):(n=Object.keys(n).join(","),Error(r(268,n)));return n=Is(s),n=n===null?null:n.stateNode,n},on.flushSync=function(n){return ri(n)},on.hydrate=function(n,s,l){if(!tu(s))throw Error(r(200));return nu(null,n,s,!0,l)},on.hydrateRoot=function(n,s,l){if(!Wd(n))throw Error(r(405));var h=l!=null&&l.hydratedSources||null,v=!1,x="",R=ax;if(l!=null&&(l.unstable_strictMode===!0&&(v=!0),l.identifierPrefix!==void 0&&(x=l.identifierPrefix),l.onRecoverableError!==void 0&&(R=l.onRecoverableError)),s=ix(s,null,n,1,l??null,v,!1,x,R),n[Ar]=s.current,Qo(n),h)for(n=0;n<h.length;n++)l=h[n],v=l._getVersion,v=v(l._source),s.mutableSourceEagerHydrationData==null?s.mutableSourceEagerHydrationData=[l,v]:s.mutableSourceEagerHydrationData.push(l,v);return new eu(s)},on.render=function(n,s,l){if(!tu(s))throw Error(r(200));return nu(null,n,s,!1,l)},on.unmountComponentAtNode=function(n){if(!tu(n))throw Error(r(40));return n._reactRootContainer?(ri(function(){nu(null,null,n,!1,function(){n._reactRootContainer=null,n[Ar]=null})}),!0):!1},on.unstable_batchedUpdates=Ld,on.unstable_renderSubtreeIntoContainer=function(n,s,l,h){if(!tu(l))throw Error(r(200));if(n==null||n._reactInternals===void 0)throw Error(r(38));return nu(n,s,l,!1,h)},on.version="18.3.1-next-f1338f8080-20240426",on}var gx;function LN(){if(gx)return Yd.exports;gx=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(),Yd.exports=JR(),Yd.exports}var vx;function eA(){if(vx)return iu;vx=1;var e=LN();return iu.createRoot=e.createRoot,iu.hydrateRoot=e.hydrateRoot,iu}var tA=eA(),C=Fa();const ae=dy(C);function Dt(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let r=0,i;r<e.length;r++)(i=Dt(e[r]))!==""&&(t+=(t&&" ")+i);else for(let r in e)e[r]&&(t+=(t&&" ")+r);return t}var Qd={exports:{}},Zd={},Jd={exports:{}},ef={};/**
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 yx;function nA(){if(yx)return ef;yx=1;var e=Fa();function t(g,y){return g===y&&(g!==0||1/g===1/y)||g!==g&&y!==y}var r=typeof Object.is=="function"?Object.is:t,i=e.useState,o=e.useEffect,a=e.useLayoutEffect,u=e.useDebugValue;function c(g,y){var w=y(),E=i({inst:{value:w,getSnapshot:y}}),_=E[0].inst,b=E[1];return a(function(){_.value=w,_.getSnapshot=y,f(_)&&b({inst:_})},[g,w,y]),o(function(){return f(_)&&b({inst:_}),g(function(){f(_)&&b({inst:_})})},[g]),u(w),w}function f(g){var y=g.getSnapshot;g=g.value;try{var w=y();return!r(g,w)}catch{return!0}}function p(g,y){return y()}var d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?p:c;return ef.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:d,ef}var wx;function rA(){return wx||(wx=1,Jd.exports=nA()),Jd.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 xx;function sA(){if(xx)return Zd;xx=1;var e=Fa(),t=rA();function r(p,d){return p===d&&(p!==0||1/p===1/d)||p!==p&&d!==d}var i=typeof Object.is=="function"?Object.is:r,o=t.useSyncExternalStore,a=e.useRef,u=e.useEffect,c=e.useMemo,f=e.useDebugValue;return Zd.useSyncExternalStoreWithSelector=function(p,d,g,y,w){var E=a(null);if(E.current===null){var _={hasValue:!1,value:null};E.current=_}else _=E.current;E=c(function(){function k(L){if(!S){if(S=!0,N=L,L=y(L),w!==void 0&&_.hasValue){var P=_.value;if(w(P,L))return T=P}return T=L}if(P=T,i(N,L))return P;var U=y(L);return w!==void 0&&w(P,U)?(N=L,P):(N=L,T=U)}var S=!1,N,T,A=g===void 0?null:g;return[function(){return k(d())},A===null?void 0:function(){return k(A())}]},[d,g,y,w]);var b=o(p,E[0],E[1]);return u(function(){_.hasValue=!0,_.value=b},[b]),f(b),b},Zd}var _x;function iA(){return _x||(_x=1,Qd.exports=sA()),Qd.exports}var oA=iA();const aA=dy(oA),lA={},bx=e=>{let t;const r=new Set,i=(d,g)=>{const y=typeof d=="function"?d(t):d;if(!Object.is(y,t)){const w=t;t=g??(typeof y!="object"||y===null)?y:Object.assign({},t,y),r.forEach(E=>E(t,w))}},o=()=>t,f={setState:i,getState:o,getInitialState:()=>p,subscribe:d=>(r.add(d),()=>r.delete(d)),destroy:()=>{(lA?"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."),r.clear()}},p=t=e(i,o,f);return f},uA=e=>e?bx(e):bx,{useDebugValue:cA}=ae,{useSyncExternalStoreWithSelector:dA}=aA,fA=e=>e;function $N(e,t=fA,r){const i=dA(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,r);return cA(i),i}const kx=(e,t)=>{const r=uA(e),i=(o,a=t)=>$N(r,o,a);return Object.assign(i,r),i},hA=(e,t)=>e?kx(e,t):kx;function At(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[i,o]of e)if(!Object.is(o,t.get(i)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const i of e)if(!t.has(i))return!1;return!0}const r=Object.keys(e);if(r.length!==Object.keys(t).length)return!1;for(const i of r)if(!Object.prototype.hasOwnProperty.call(t,i)||!Object.is(e[i],t[i]))return!1;return!0}var pA={value:()=>{}};function Vu(){for(var e=0,t=arguments.length,r={},i;e<t;++e){if(!(i=arguments[e]+"")||i in r||/[\s.]/.test(i))throw new Error("illegal type: "+i);r[i]=[]}return new Su(r)}function Su(e){this._=e}function mA(e,t){return e.trim().split(/^|\s+/).map(function(r){var i="",o=r.indexOf(".");if(o>=0&&(i=r.slice(o+1),r=r.slice(0,o)),r&&!t.hasOwnProperty(r))throw new Error("unknown type: "+r);return{type:r,name:i}})}Su.prototype=Vu.prototype={constructor:Su,on:function(e,t){var r=this._,i=mA(e+"",r),o,a=-1,u=i.length;if(arguments.length<2){for(;++a<u;)if((o=(e=i[a]).type)&&(o=gA(r[o],e.name)))return o;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++a<u;)if(o=(e=i[a]).type)r[o]=Sx(r[o],e.name,t);else if(t==null)for(o in r)r[o]=Sx(r[o],e.name,null);return this},copy:function(){var e={},t=this._;for(var r in t)e[r]=t[r].slice();return new Su(e)},call:function(e,t){if((o=arguments.length-2)>0)for(var r=new Array(o),i=0,o,a;i<o;++i)r[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(a=this._[e],i=0,o=a.length;i<o;++i)a[i].value.apply(t,r)},apply:function(e,t,r){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var i=this._[e],o=0,a=i.length;o<a;++o)i[o].value.apply(t,r)}};function gA(e,t){for(var r=0,i=e.length,o;r<i;++r)if((o=e[r]).name===t)return o.value}function Sx(e,t,r){for(var i=0,o=e.length;i<o;++i)if(e[i].name===t){e[i]=pA,e=e.slice(0,i).concat(e.slice(i+1));break}return r!=null&&e.push({name:t,value:r}),e}var $v="http://www.w3.org/1999/xhtml";const Ex={svg:"http://www.w3.org/2000/svg",xhtml:$v,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Gu(e){var t=e+="",r=t.indexOf(":");return r>=0&&(t=e.slice(0,r))!=="xmlns"&&(e=e.slice(r+1)),Ex.hasOwnProperty(t)?{space:Ex[t],local:e}:e}function vA(e){return function(){var t=this.ownerDocument,r=this.namespaceURI;return r===$v&&t.documentElement.namespaceURI===$v?t.createElement(e):t.createElementNS(r,e)}}function yA(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function qN(e){var t=Gu(e);return(t.local?yA:vA)(t)}function wA(){}function fy(e){return e==null?wA:function(){return this.querySelector(e)}}function xA(e){typeof e!="function"&&(e=fy(e));for(var t=this._groups,r=t.length,i=new Array(r),o=0;o<r;++o)for(var a=t[o],u=a.length,c=i[o]=new Array(u),f,p,d=0;d<u;++d)(f=a[d])&&(p=e.call(f,f.__data__,d,a))&&("__data__"in f&&(p.__data__=f.__data__),c[d]=p);return new vn(i,this._parents)}function _A(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function bA(){return[]}function DN(e){return e==null?bA:function(){return this.querySelectorAll(e)}}function kA(e){return function(){return _A(e.apply(this,arguments))}}function SA(e){typeof e=="function"?e=kA(e):e=DN(e);for(var t=this._groups,r=t.length,i=[],o=[],a=0;a<r;++a)for(var u=t[a],c=u.length,f,p=0;p<c;++p)(f=u[p])&&(i.push(e.call(f,f.__data__,p,u)),o.push(f));return new vn(i,o)}function FN(e){return function(){return this.matches(e)}}function zN(e){return function(t){return t.matches(e)}}var EA=Array.prototype.find;function NA(e){return function(){return EA.call(this.children,e)}}function CA(){return this.firstElementChild}function jA(e){return this.select(e==null?CA:NA(typeof e=="function"?e:zN(e)))}var TA=Array.prototype.filter;function RA(){return Array.from(this.children)}function AA(e){return function(){return TA.call(this.children,e)}}function IA(e){return this.selectAll(e==null?RA:AA(typeof e=="function"?e:zN(e)))}function MA(e){typeof e!="function"&&(e=FN(e));for(var t=this._groups,r=t.length,i=new Array(r),o=0;o<r;++o)for(var a=t[o],u=a.length,c=i[o]=[],f,p=0;p<u;++p)(f=a[p])&&e.call(f,f.__data__,p,a)&&c.push(f);return new vn(i,this._parents)}function BN(e){return new Array(e.length)}function OA(){return new vn(this._enter||this._groups.map(BN),this._parents)}function Ru(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Ru.prototype={constructor:Ru,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 PA(e){return function(){return e}}function LA(e,t,r,i,o,a){for(var u=0,c,f=t.length,p=a.length;u<p;++u)(c=t[u])?(c.__data__=a[u],i[u]=c):r[u]=new Ru(e,a[u]);for(;u<f;++u)(c=t[u])&&(o[u]=c)}function $A(e,t,r,i,o,a,u){var c,f,p=new Map,d=t.length,g=a.length,y=new Array(d),w;for(c=0;c<d;++c)(f=t[c])&&(y[c]=w=u.call(f,f.__data__,c,t)+"",p.has(w)?o[c]=f:p.set(w,f));for(c=0;c<g;++c)w=u.call(e,a[c],c,a)+"",(f=p.get(w))?(i[c]=f,f.__data__=a[c],p.delete(w)):r[c]=new Ru(e,a[c]);for(c=0;c<d;++c)(f=t[c])&&p.get(y[c])===f&&(o[c]=f)}function qA(e){return e.__data__}function DA(e,t){if(!arguments.length)return Array.from(this,qA);var r=t?$A:LA,i=this._parents,o=this._groups;typeof e!="function"&&(e=PA(e));for(var a=o.length,u=new Array(a),c=new Array(a),f=new Array(a),p=0;p<a;++p){var d=i[p],g=o[p],y=g.length,w=FA(e.call(d,d&&d.__data__,p,i)),E=w.length,_=c[p]=new Array(E),b=u[p]=new Array(E),k=f[p]=new Array(y);r(d,g,_,b,k,w,t);for(var S=0,N=0,T,A;S<E;++S)if(T=_[S]){for(S>=N&&(N=S+1);!(A=b[N])&&++N<E;);T._next=A||null}}return u=new vn(u,i),u._enter=c,u._exit=f,u}function FA(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function zA(){return new vn(this._exit||this._groups.map(BN),this._parents)}function BA(e,t,r){var i=this.enter(),o=this,a=this.exit();return typeof e=="function"?(i=e(i),i&&(i=i.selection())):i=i.append(e+""),t!=null&&(o=t(o),o&&(o=o.selection())),r==null?a.remove():r(a),i&&o?i.merge(o).order():o}function UA(e){for(var t=e.selection?e.selection():e,r=this._groups,i=t._groups,o=r.length,a=i.length,u=Math.min(o,a),c=new Array(o),f=0;f<u;++f)for(var p=r[f],d=i[f],g=p.length,y=c[f]=new Array(g),w,E=0;E<g;++E)(w=p[E]||d[E])&&(y[E]=w);for(;f<o;++f)c[f]=r[f];return new vn(c,this._parents)}function HA(){for(var e=this._groups,t=-1,r=e.length;++t<r;)for(var i=e[t],o=i.length-1,a=i[o],u;--o>=0;)(u=i[o])&&(a&&u.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(u,a),a=u);return this}function WA(e){e||(e=VA);function t(g,y){return g&&y?e(g.__data__,y.__data__):!g-!y}for(var r=this._groups,i=r.length,o=new Array(i),a=0;a<i;++a){for(var u=r[a],c=u.length,f=o[a]=new Array(c),p,d=0;d<c;++d)(p=u[d])&&(f[d]=p);f.sort(t)}return new vn(o,this._parents).order()}function VA(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function GA(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function YA(){return Array.from(this)}function KA(){for(var e=this._groups,t=0,r=e.length;t<r;++t)for(var i=e[t],o=0,a=i.length;o<a;++o){var u=i[o];if(u)return u}return null}function XA(){let e=0;for(const t of this)++e;return e}function QA(){return!this.node()}function ZA(e){for(var t=this._groups,r=0,i=t.length;r<i;++r)for(var o=t[r],a=0,u=o.length,c;a<u;++a)(c=o[a])&&e.call(c,c.__data__,a,o);return this}function JA(e){return function(){this.removeAttribute(e)}}function e2(e){return function(){this.removeAttributeNS(e.space,e.local)}}function t2(e,t){return function(){this.setAttribute(e,t)}}function n2(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function r2(e,t){return function(){var r=t.apply(this,arguments);r==null?this.removeAttribute(e):this.setAttribute(e,r)}}function s2(e,t){return function(){var r=t.apply(this,arguments);r==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,r)}}function i2(e,t){var r=Gu(e);if(arguments.length<2){var i=this.node();return r.local?i.getAttributeNS(r.space,r.local):i.getAttribute(r)}return this.each((t==null?r.local?e2:JA:typeof t=="function"?r.local?s2:r2:r.local?n2:t2)(r,t))}function UN(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function o2(e){return function(){this.style.removeProperty(e)}}function a2(e,t,r){return function(){this.style.setProperty(e,t,r)}}function l2(e,t,r){return function(){var i=t.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,r)}}function u2(e,t,r){return arguments.length>1?this.each((t==null?o2:typeof t=="function"?l2:a2)(e,t,r??"")):xo(this.node(),e)}function xo(e,t){return e.style.getPropertyValue(t)||UN(e).getComputedStyle(e,null).getPropertyValue(t)}function c2(e){return function(){delete this[e]}}function d2(e,t){return function(){this[e]=t}}function f2(e,t){return function(){var r=t.apply(this,arguments);r==null?delete this[e]:this[e]=r}}function h2(e,t){return arguments.length>1?this.each((t==null?c2:typeof t=="function"?f2:d2)(e,t)):this.node()[e]}function HN(e){return e.trim().split(/^|\s+/)}function hy(e){return e.classList||new WN(e)}function WN(e){this._node=e,this._names=HN(e.getAttribute("class")||"")}WN.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 VN(e,t){for(var r=hy(e),i=-1,o=t.length;++i<o;)r.add(t[i])}function GN(e,t){for(var r=hy(e),i=-1,o=t.length;++i<o;)r.remove(t[i])}function p2(e){return function(){VN(this,e)}}function m2(e){return function(){GN(this,e)}}function g2(e,t){return function(){(t.apply(this,arguments)?VN:GN)(this,e)}}function v2(e,t){var r=HN(e+"");if(arguments.length<2){for(var i=hy(this.node()),o=-1,a=r.length;++o<a;)if(!i.contains(r[o]))return!1;return!0}return this.each((typeof t=="function"?g2:t?p2:m2)(r,t))}function y2(){this.textContent=""}function w2(e){return function(){this.textContent=e}}function x2(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function _2(e){return arguments.length?this.each(e==null?y2:(typeof e=="function"?x2:w2)(e)):this.node().textContent}function b2(){this.innerHTML=""}function k2(e){return function(){this.innerHTML=e}}function S2(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function E2(e){return arguments.length?this.each(e==null?b2:(typeof e=="function"?S2:k2)(e)):this.node().innerHTML}function N2(){this.nextSibling&&this.parentNode.appendChild(this)}function C2(){return this.each(N2)}function j2(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function T2(){return this.each(j2)}function R2(e){var t=typeof e=="function"?e:qN(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function A2(){return null}function I2(e,t){var r=typeof e=="function"?e:qN(e),i=t==null?A2:typeof t=="function"?t:fy(t);return this.select(function(){return this.insertBefore(r.apply(this,arguments),i.apply(this,arguments)||null)})}function M2(){var e=this.parentNode;e&&e.removeChild(this)}function O2(){return this.each(M2)}function P2(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function L2(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function $2(e){return this.select(e?L2:P2)}function q2(e){return arguments.length?this.property("__data__",e):this.node().__data__}function D2(e){return function(t){e.call(this,t,this.__data__)}}function F2(e){return e.trim().split(/^|\s+/).map(function(t){var r="",i=t.indexOf(".");return i>=0&&(r=t.slice(i+1),t=t.slice(0,i)),{type:t,name:r}})}function z2(e){return function(){var t=this.__on;if(t){for(var r=0,i=-1,o=t.length,a;r<o;++r)a=t[r],(!e.type||a.type===e.type)&&a.name===e.name?this.removeEventListener(a.type,a.listener,a.options):t[++i]=a;++i?t.length=i:delete this.__on}}}function B2(e,t,r){return function(){var i=this.__on,o,a=D2(t);if(i){for(var u=0,c=i.length;u<c;++u)if((o=i[u]).type===e.type&&o.name===e.name){this.removeEventListener(o.type,o.listener,o.options),this.addEventListener(o.type,o.listener=a,o.options=r),o.value=t;return}}this.addEventListener(e.type,a,r),o={type:e.type,name:e.name,value:t,listener:a,options:r},i?i.push(o):this.__on=[o]}}function U2(e,t,r){var i=F2(e+""),o,a=i.length,u;if(arguments.length<2){var c=this.node().__on;if(c){for(var f=0,p=c.length,d;f<p;++f)for(o=0,d=c[f];o<a;++o)if((u=i[o]).type===d.type&&u.name===d.name)return d.value}return}for(c=t?B2:z2,o=0;o<a;++o)this.each(c(i[o],t,r));return this}function YN(e,t,r){var i=UN(e),o=i.CustomEvent;typeof o=="function"?o=new o(t,r):(o=i.document.createEvent("Event"),r?(o.initEvent(t,r.bubbles,r.cancelable),o.detail=r.detail):o.initEvent(t,!1,!1)),e.dispatchEvent(o)}function H2(e,t){return function(){return YN(this,e,t)}}function W2(e,t){return function(){return YN(this,e,t.apply(this,arguments))}}function V2(e,t){return this.each((typeof t=="function"?W2:H2)(e,t))}function*G2(){for(var e=this._groups,t=0,r=e.length;t<r;++t)for(var i=e[t],o=0,a=i.length,u;o<a;++o)(u=i[o])&&(yield u)}var KN=[null];function vn(e,t){this._groups=e,this._parents=t}function za(){return new vn([[document.documentElement]],KN)}function Y2(){return this}vn.prototype=za.prototype={constructor:vn,select:xA,selectAll:SA,selectChild:jA,selectChildren:IA,filter:MA,data:DA,enter:OA,exit:zA,join:BA,merge:UA,selection:Y2,order:HA,sort:WA,call:GA,nodes:YA,node:KA,size:XA,empty:QA,each:ZA,attr:i2,style:u2,property:h2,classed:v2,text:_2,html:E2,raise:C2,lower:T2,append:R2,insert:I2,remove:O2,clone:$2,datum:q2,on:U2,dispatch:V2,[Symbol.iterator]:G2};function Ln(e){return typeof e=="string"?new vn([[document.querySelector(e)]],[document.documentElement]):new vn([[e]],KN)}function K2(e){let t;for(;t=e.sourceEvent;)e=t;return e}function er(e,t){if(e=K2(e),t===void 0&&(t=e.currentTarget),t){var r=t.ownerSVGElement||t;if(r.createSVGPoint){var i=r.createSVGPoint();return i.x=e.clientX,i.y=e.clientY,i=i.matrixTransform(t.getScreenCTM().inverse()),[i.x,i.y]}if(t.getBoundingClientRect){var o=t.getBoundingClientRect();return[e.clientX-o.left-t.clientLeft,e.clientY-o.top-t.clientTop]}}return[e.pageX,e.pageY]}const X2={passive:!1},Ta={capture:!0,passive:!1};function tf(e){e.stopImmediatePropagation()}function mo(e){e.preventDefault(),e.stopImmediatePropagation()}function XN(e){var t=e.document.documentElement,r=Ln(e).on("dragstart.drag",mo,Ta);"onselectstart"in t?r.on("selectstart.drag",mo,Ta):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function QN(e,t){var r=e.document.documentElement,i=Ln(e).on("dragstart.drag",null);t&&(i.on("click.drag",mo,Ta),setTimeout(function(){i.on("click.drag",null)},0)),"onselectstart"in r?i.on("selectstart.drag",null):(r.style.MozUserSelect=r.__noselect,delete r.__noselect)}const ou=e=>()=>e;function qv(e,{sourceEvent:t,subject:r,target:i,identifier:o,active:a,x:u,y:c,dx:f,dy:p,dispatch:d}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:r,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},identifier:{value:o,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:u,enumerable:!0,configurable:!0},y:{value:c,enumerable:!0,configurable:!0},dx:{value:f,enumerable:!0,configurable:!0},dy:{value:p,enumerable:!0,configurable:!0},_:{value:d}})}qv.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Q2(e){return!e.ctrlKey&&!e.button}function Z2(){return this.parentNode}function J2(e,t){return t??{x:e.x,y:e.y}}function eI(){return navigator.maxTouchPoints||"ontouchstart"in this}function tI(){var e=Q2,t=Z2,r=J2,i=eI,o={},a=Vu("start","drag","end"),u=0,c,f,p,d,g=0;function y(T){T.on("mousedown.drag",w).filter(i).on("touchstart.drag",b).on("touchmove.drag",k,X2).on("touchend.drag touchcancel.drag",S).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function w(T,A){if(!(d||!e.call(this,T,A))){var L=N(this,t.call(this,T,A),T,A,"mouse");L&&(Ln(T.view).on("mousemove.drag",E,Ta).on("mouseup.drag",_,Ta),XN(T.view),tf(T),p=!1,c=T.clientX,f=T.clientY,L("start",T))}}function E(T){if(mo(T),!p){var A=T.clientX-c,L=T.clientY-f;p=A*A+L*L>g}o.mouse("drag",T)}function _(T){Ln(T.view).on("mousemove.drag mouseup.drag",null),QN(T.view,p),mo(T),o.mouse("end",T)}function b(T,A){if(e.call(this,T,A)){var L=T.changedTouches,P=t.call(this,T,A),U=L.length,O,M;for(O=0;O<U;++O)(M=N(this,P,T,A,L[O].identifier,L[O]))&&(tf(T),M("start",T,L[O]))}}function k(T){var A=T.changedTouches,L=A.length,P,U;for(P=0;P<L;++P)(U=o[A[P].identifier])&&(mo(T),U("drag",T,A[P]))}function S(T){var A=T.changedTouches,L=A.length,P,U;for(d&&clearTimeout(d),d=setTimeout(function(){d=null},500),P=0;P<L;++P)(U=o[A[P].identifier])&&(tf(T),U("end",T,A[P]))}function N(T,A,L,P,U,O){var M=a.copy(),q=er(O||L,A),V,Q,j;if((j=r.call(T,new qv("beforestart",{sourceEvent:L,target:y,identifier:U,active:u,x:q[0],y:q[1],dx:0,dy:0,dispatch:M}),P))!=null)return V=j.x-q[0]||0,Q=j.y-q[1]||0,function G(z,te,J){var $=q,W;switch(z){case"start":o[U]=G,W=u++;break;case"end":delete o[U],--u;case"drag":q=er(J||te,A),W=u;break}M.call(z,T,new qv(z,{sourceEvent:te,subject:j,target:y,identifier:U,active:W,x:q[0]+V,y:q[1]+Q,dx:q[0]-$[0],dy:q[1]-$[1],dispatch:M}),P)}}return y.filter=function(T){return arguments.length?(e=typeof T=="function"?T:ou(!!T),y):e},y.container=function(T){return arguments.length?(t=typeof T=="function"?T:ou(T),y):t},y.subject=function(T){return arguments.length?(r=typeof T=="function"?T:ou(T),y):r},y.touchable=function(T){return arguments.length?(i=typeof T=="function"?T:ou(!!T),y):i},y.on=function(){var T=a.on.apply(a,arguments);return T===a?y:T},y.clickDistance=function(T){return arguments.length?(g=(T=+T)*T,y):Math.sqrt(g)},y}function py(e,t,r){e.prototype=t.prototype=r,r.constructor=e}function ZN(e,t){var r=Object.create(e.prototype);for(var i in t)r[i]=t[i];return r}function Ba(){}var Ra=.7,Au=1/Ra,go="\\s*([+-]?\\d+)\\s*",Aa="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",wr="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",nI=/^#([0-9a-f]{3,8})$/,rI=new RegExp(`^rgb\\(${go},${go},${go}\\)$`),sI=new RegExp(`^rgb\\(${wr},${wr},${wr}\\)$`),iI=new RegExp(`^rgba\\(${go},${go},${go},${Aa}\\)$`),oI=new RegExp(`^rgba\\(${wr},${wr},${wr},${Aa}\\)$`),aI=new RegExp(`^hsl\\(${Aa},${wr},${wr}\\)$`),lI=new RegExp(`^hsla\\(${Aa},${wr},${wr},${Aa}\\)$`),Nx={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};py(Ba,Ia,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Cx,formatHex:Cx,formatHex8:uI,formatHsl:cI,formatRgb:jx,toString:jx});function Cx(){return this.rgb().formatHex()}function uI(){return this.rgb().formatHex8()}function cI(){return JN(this).formatHsl()}function jx(){return this.rgb().formatRgb()}function Ia(e){var t,r;return e=(e+"").trim().toLowerCase(),(t=nI.exec(e))?(r=t[1].length,t=parseInt(t[1],16),r===6?Tx(t):r===3?new an(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):r===8?au(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):r===4?au(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=rI.exec(e))?new an(t[1],t[2],t[3],1):(t=sI.exec(e))?new an(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=iI.exec(e))?au(t[1],t[2],t[3],t[4]):(t=oI.exec(e))?au(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=aI.exec(e))?Ix(t[1],t[2]/100,t[3]/100,1):(t=lI.exec(e))?Ix(t[1],t[2]/100,t[3]/100,t[4]):Nx.hasOwnProperty(e)?Tx(Nx[e]):e==="transparent"?new an(NaN,NaN,NaN,0):null}function Tx(e){return new an(e>>16&255,e>>8&255,e&255,1)}function au(e,t,r,i){return i<=0&&(e=t=r=NaN),new an(e,t,r,i)}function dI(e){return e instanceof Ba||(e=Ia(e)),e?(e=e.rgb(),new an(e.r,e.g,e.b,e.opacity)):new an}function Dv(e,t,r,i){return arguments.length===1?dI(e):new an(e,t,r,i??1)}function an(e,t,r,i){this.r=+e,this.g=+t,this.b=+r,this.opacity=+i}py(an,Dv,ZN(Ba,{brighter(e){return e=e==null?Au:Math.pow(Au,e),new an(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Ra:Math.pow(Ra,e),new an(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new an(di(this.r),di(this.g),di(this.b),Iu(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:Rx,formatHex:Rx,formatHex8:fI,formatRgb:Ax,toString:Ax}));function Rx(){return`#${ui(this.r)}${ui(this.g)}${ui(this.b)}`}function fI(){return`#${ui(this.r)}${ui(this.g)}${ui(this.b)}${ui((isNaN(this.opacity)?1:this.opacity)*255)}`}function Ax(){const e=Iu(this.opacity);return`${e===1?"rgb(":"rgba("}${di(this.r)}, ${di(this.g)}, ${di(this.b)}${e===1?")":`, ${e})`}`}function Iu(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function di(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ui(e){return e=di(e),(e<16?"0":"")+e.toString(16)}function Ix(e,t,r,i){return i<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new tr(e,t,r,i)}function JN(e){if(e instanceof tr)return new tr(e.h,e.s,e.l,e.opacity);if(e instanceof Ba||(e=Ia(e)),!e)return new tr;if(e instanceof tr)return e;e=e.rgb();var t=e.r/255,r=e.g/255,i=e.b/255,o=Math.min(t,r,i),a=Math.max(t,r,i),u=NaN,c=a-o,f=(a+o)/2;return c?(t===a?u=(r-i)/c+(r<i)*6:r===a?u=(i-t)/c+2:u=(t-r)/c+4,c/=f<.5?a+o:2-a-o,u*=60):c=f>0&&f<1?0:u,new tr(u,c,f,e.opacity)}function hI(e,t,r,i){return arguments.length===1?JN(e):new tr(e,t,r,i??1)}function tr(e,t,r,i){this.h=+e,this.s=+t,this.l=+r,this.opacity=+i}py(tr,hI,ZN(Ba,{brighter(e){return e=e==null?Au:Math.pow(Au,e),new tr(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Ra:Math.pow(Ra,e),new tr(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,i=r+(r<.5?r:1-r)*t,o=2*r-i;return new an(nf(e>=240?e-240:e+120,o,i),nf(e,o,i),nf(e<120?e+240:e-120,o,i),this.opacity)},clamp(){return new tr(Mx(this.h),lu(this.s),lu(this.l),Iu(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=Iu(this.opacity);return`${e===1?"hsl(":"hsla("}${Mx(this.h)}, ${lu(this.s)*100}%, ${lu(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Mx(e){return e=(e||0)%360,e<0?e+360:e}function lu(e){return Math.max(0,Math.min(1,e||0))}function nf(e,t,r){return(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)*255}const eC=e=>()=>e;function pI(e,t){return function(r){return e+r*t}}function mI(e,t,r){return e=Math.pow(e,r),t=Math.pow(t,r)-e,r=1/r,function(i){return Math.pow(e+i*t,r)}}function gI(e){return(e=+e)==1?tC:function(t,r){return r-t?mI(t,r,e):eC(isNaN(t)?r:t)}}function tC(e,t){var r=t-e;return r?pI(e,r):eC(isNaN(e)?t:e)}const Ox=(function e(t){var r=gI(t);function i(o,a){var u=r((o=Dv(o)).r,(a=Dv(a)).r),c=r(o.g,a.g),f=r(o.b,a.b),p=tC(o.opacity,a.opacity);return function(d){return o.r=u(d),o.g=c(d),o.b=f(d),o.opacity=p(d),o+""}}return i.gamma=e,i})(1);function xs(e,t){return e=+e,t=+t,function(r){return e*(1-r)+t*r}}var Fv=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,rf=new RegExp(Fv.source,"g");function vI(e){return function(){return e}}function yI(e){return function(t){return e(t)+""}}function wI(e,t){var r=Fv.lastIndex=rf.lastIndex=0,i,o,a,u=-1,c=[],f=[];for(e=e+"",t=t+"";(i=Fv.exec(e))&&(o=rf.exec(t));)(a=o.index)>r&&(a=t.slice(r,a),c[u]?c[u]+=a:c[++u]=a),(i=i[0])===(o=o[0])?c[u]?c[u]+=o:c[++u]=o:(c[++u]=null,f.push({i:u,x:xs(i,o)})),r=rf.lastIndex;return r<t.length&&(a=t.slice(r),c[u]?c[u]+=a:c[++u]=a),c.length<2?f[0]?yI(f[0].x):vI(t):(t=f.length,function(p){for(var d=0,g;d<t;++d)c[(g=f[d]).i]=g.x(p);return c.join("")})}var Px=180/Math.PI,zv={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function nC(e,t,r,i,o,a){var u,c,f;return(u=Math.sqrt(e*e+t*t))&&(e/=u,t/=u),(f=e*r+t*i)&&(r-=e*f,i-=t*f),(c=Math.sqrt(r*r+i*i))&&(r/=c,i/=c,f/=c),e*i<t*r&&(e=-e,t=-t,f=-f,u=-u),{translateX:o,translateY:a,rotate:Math.atan2(t,e)*Px,skewX:Math.atan(f)*Px,scaleX:u,scaleY:c}}var uu;function xI(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?zv:nC(t.a,t.b,t.c,t.d,t.e,t.f)}function _I(e){return e==null||(uu||(uu=document.createElementNS("http://www.w3.org/2000/svg","g")),uu.setAttribute("transform",e),!(e=uu.transform.baseVal.consolidate()))?zv:(e=e.matrix,nC(e.a,e.b,e.c,e.d,e.e,e.f))}function rC(e,t,r,i){function o(p){return p.length?p.pop()+" ":""}function a(p,d,g,y,w,E){if(p!==g||d!==y){var _=w.push("translate(",null,t,null,r);E.push({i:_-4,x:xs(p,g)},{i:_-2,x:xs(d,y)})}else(g||y)&&w.push("translate("+g+t+y+r)}function u(p,d,g,y){p!==d?(p-d>180?d+=360:d-p>180&&(p+=360),y.push({i:g.push(o(g)+"rotate(",null,i)-2,x:xs(p,d)})):d&&g.push(o(g)+"rotate("+d+i)}function c(p,d,g,y){p!==d?y.push({i:g.push(o(g)+"skewX(",null,i)-2,x:xs(p,d)}):d&&g.push(o(g)+"skewX("+d+i)}function f(p,d,g,y,w,E){if(p!==g||d!==y){var _=w.push(o(w)+"scale(",null,",",null,")");E.push({i:_-4,x:xs(p,g)},{i:_-2,x:xs(d,y)})}else(g!==1||y!==1)&&w.push(o(w)+"scale("+g+","+y+")")}return function(p,d){var g=[],y=[];return p=e(p),d=e(d),a(p.translateX,p.translateY,d.translateX,d.translateY,g,y),u(p.rotate,d.rotate,g,y),c(p.skewX,d.skewX,g,y),f(p.scaleX,p.scaleY,d.scaleX,d.scaleY,g,y),p=d=null,function(w){for(var E=-1,_=y.length,b;++E<_;)g[(b=y[E]).i]=b.x(w);return g.join("")}}}var bI=rC(xI,"px, ","px)","deg)"),kI=rC(_I,", ",")",")"),SI=1e-12;function Lx(e){return((e=Math.exp(e))+1/e)/2}function EI(e){return((e=Math.exp(e))-1/e)/2}function NI(e){return((e=Math.exp(2*e))-1)/(e+1)}const CI=(function e(t,r,i){function o(a,u){var c=a[0],f=a[1],p=a[2],d=u[0],g=u[1],y=u[2],w=d-c,E=g-f,_=w*w+E*E,b,k;if(_<SI)k=Math.log(y/p)/t,b=function(P){return[c+P*w,f+P*E,p*Math.exp(t*P*k)]};else{var S=Math.sqrt(_),N=(y*y-p*p+i*_)/(2*p*r*S),T=(y*y-p*p-i*_)/(2*y*r*S),A=Math.log(Math.sqrt(N*N+1)-N),L=Math.log(Math.sqrt(T*T+1)-T);k=(L-A)/t,b=function(P){var U=P*k,O=Lx(A),M=p/(r*S)*(O*NI(t*U+A)-EI(A));return[c+M*w,f+M*E,p*O/Lx(t*U+A)]}}return b.duration=k*1e3*t/Math.SQRT2,b}return o.rho=function(a){var u=Math.max(.001,+a),c=u*u,f=c*c;return e(u,c,f)},o})(Math.SQRT2,2,4);var _o=0,ka=0,ga=0,sC=1e3,Mu,Sa,Ou=0,hi=0,Yu=0,Ma=typeof performance=="object"&&performance.now?performance:Date,iC=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function my(){return hi||(iC(jI),hi=Ma.now()+Yu)}function jI(){hi=0}function Pu(){this._call=this._time=this._next=null}Pu.prototype=oC.prototype={constructor:Pu,restart:function(e,t,r){if(typeof e!="function")throw new TypeError("callback is not a function");r=(r==null?my():+r)+(t==null?0:+t),!this._next&&Sa!==this&&(Sa?Sa._next=this:Mu=this,Sa=this),this._call=e,this._time=r,Bv()},stop:function(){this._call&&(this._call=null,this._time=1/0,Bv())}};function oC(e,t,r){var i=new Pu;return i.restart(e,t,r),i}function TI(){my(),++_o;for(var e=Mu,t;e;)(t=hi-e._time)>=0&&e._call.call(void 0,t),e=e._next;--_o}function $x(){hi=(Ou=Ma.now())+Yu,_o=ka=0;try{TI()}finally{_o=0,AI(),hi=0}}function RI(){var e=Ma.now(),t=e-Ou;t>sC&&(Yu-=t,Ou=e)}function AI(){for(var e,t=Mu,r,i=1/0;t;)t._call?(i>t._time&&(i=t._time),e=t,t=t._next):(r=t._next,t._next=null,t=e?e._next=r:Mu=r);Sa=e,Bv(i)}function Bv(e){if(!_o){ka&&(ka=clearTimeout(ka));var t=e-hi;t>24?(e<1/0&&(ka=setTimeout($x,e-Ma.now()-Yu)),ga&&(ga=clearInterval(ga))):(ga||(Ou=Ma.now(),ga=setInterval(RI,sC)),_o=1,iC($x))}}function qx(e,t,r){var i=new Pu;return t=t==null?0:+t,i.restart(o=>{i.stop(),e(o+t)},t,r),i}var II=Vu("start","end","cancel","interrupt"),MI=[],aC=0,Dx=1,Uv=2,Eu=3,Fx=4,Hv=5,Nu=6;function Ku(e,t,r,i,o,a){var u=e.__transition;if(!u)e.__transition={};else if(r in u)return;OI(e,r,{name:t,index:i,group:o,on:II,tween:MI,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:aC})}function gy(e,t){var r=sr(e,t);if(r.state>aC)throw new Error("too late; already scheduled");return r}function xr(e,t){var r=sr(e,t);if(r.state>Eu)throw new Error("too late; already running");return r}function sr(e,t){var r=e.__transition;if(!r||!(r=r[t]))throw new Error("transition not found");return r}function OI(e,t,r){var i=e.__transition,o;i[t]=r,r.timer=oC(a,0,r.time);function a(p){r.state=Dx,r.timer.restart(u,r.delay,r.time),r.delay<=p&&u(p-r.delay)}function u(p){var d,g,y,w;if(r.state!==Dx)return f();for(d in i)if(w=i[d],w.name===r.name){if(w.state===Eu)return qx(u);w.state===Fx?(w.state=Nu,w.timer.stop(),w.on.call("interrupt",e,e.__data__,w.index,w.group),delete i[d]):+d<t&&(w.state=Nu,w.timer.stop(),w.on.call("cancel",e,e.__data__,w.index,w.group),delete i[d])}if(qx(function(){r.state===Eu&&(r.state=Fx,r.timer.restart(c,r.delay,r.time),c(p))}),r.state=Uv,r.on.call("start",e,e.__data__,r.index,r.group),r.state===Uv){for(r.state=Eu,o=new Array(y=r.tween.length),d=0,g=-1;d<y;++d)(w=r.tween[d].value.call(e,e.__data__,r.index,r.group))&&(o[++g]=w);o.length=g+1}}function c(p){for(var d=p<r.duration?r.ease.call(null,p/r.duration):(r.timer.restart(f),r.state=Hv,1),g=-1,y=o.length;++g<y;)o[g].call(e,d);r.state===Hv&&(r.on.call("end",e,e.__data__,r.index,r.group),f())}function f(){r.state=Nu,r.timer.stop(),delete i[t];for(var p in i)return;delete e.__transition}}function Cu(e,t){var r=e.__transition,i,o,a=!0,u;if(r){t=t==null?null:t+"";for(u in r){if((i=r[u]).name!==t){a=!1;continue}o=i.state>Uv&&i.state<Hv,i.state=Nu,i.timer.stop(),i.on.call(o?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete r[u]}a&&delete e.__transition}}function PI(e){return this.each(function(){Cu(this,e)})}function LI(e,t){var r,i;return function(){var o=xr(this,e),a=o.tween;if(a!==r){i=r=a;for(var u=0,c=i.length;u<c;++u)if(i[u].name===t){i=i.slice(),i.splice(u,1);break}}o.tween=i}}function $I(e,t,r){var i,o;if(typeof r!="function")throw new Error;return function(){var a=xr(this,e),u=a.tween;if(u!==i){o=(i=u).slice();for(var c={name:t,value:r},f=0,p=o.length;f<p;++f)if(o[f].name===t){o[f]=c;break}f===p&&o.push(c)}a.tween=o}}function qI(e,t){var r=this._id;if(e+="",arguments.length<2){for(var i=sr(this.node(),r).tween,o=0,a=i.length,u;o<a;++o)if((u=i[o]).name===e)return u.value;return null}return this.each((t==null?LI:$I)(r,e,t))}function vy(e,t,r){var i=e._id;return e.each(function(){var o=xr(this,i);(o.value||(o.value={}))[t]=r.apply(this,arguments)}),function(o){return sr(o,i).value[t]}}function lC(e,t){var r;return(typeof t=="number"?xs:t instanceof Ia?Ox:(r=Ia(t))?(t=r,Ox):wI)(e,t)}function DI(e){return function(){this.removeAttribute(e)}}function FI(e){return function(){this.removeAttributeNS(e.space,e.local)}}function zI(e,t,r){var i,o=r+"",a;return function(){var u=this.getAttribute(e);return u===o?null:u===i?a:a=t(i=u,r)}}function BI(e,t,r){var i,o=r+"",a;return function(){var u=this.getAttributeNS(e.space,e.local);return u===o?null:u===i?a:a=t(i=u,r)}}function UI(e,t,r){var i,o,a;return function(){var u,c=r(this),f;return c==null?void this.removeAttribute(e):(u=this.getAttribute(e),f=c+"",u===f?null:u===i&&f===o?a:(o=f,a=t(i=u,c)))}}function HI(e,t,r){var i,o,a;return function(){var u,c=r(this),f;return c==null?void this.removeAttributeNS(e.space,e.local):(u=this.getAttributeNS(e.space,e.local),f=c+"",u===f?null:u===i&&f===o?a:(o=f,a=t(i=u,c)))}}function WI(e,t){var r=Gu(e),i=r==="transform"?kI:lC;return this.attrTween(e,typeof t=="function"?(r.local?HI:UI)(r,i,vy(this,"attr."+e,t)):t==null?(r.local?FI:DI)(r):(r.local?BI:zI)(r,i,t))}function VI(e,t){return function(r){this.setAttribute(e,t.call(this,r))}}function GI(e,t){return function(r){this.setAttributeNS(e.space,e.local,t.call(this,r))}}function YI(e,t){var r,i;function o(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&GI(e,a)),r}return o._value=t,o}function KI(e,t){var r,i;function o(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&VI(e,a)),r}return o._value=t,o}function XI(e,t){var r="attr."+e;if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;var i=Gu(e);return this.tween(r,(i.local?YI:KI)(i,t))}function QI(e,t){return function(){gy(this,e).delay=+t.apply(this,arguments)}}function ZI(e,t){return t=+t,function(){gy(this,e).delay=t}}function JI(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?QI:ZI)(t,e)):sr(this.node(),t).delay}function eM(e,t){return function(){xr(this,e).duration=+t.apply(this,arguments)}}function tM(e,t){return t=+t,function(){xr(this,e).duration=t}}function nM(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?eM:tM)(t,e)):sr(this.node(),t).duration}function rM(e,t){if(typeof t!="function")throw new Error;return function(){xr(this,e).ease=t}}function sM(e){var t=this._id;return arguments.length?this.each(rM(t,e)):sr(this.node(),t).ease}function iM(e,t){return function(){var r=t.apply(this,arguments);if(typeof r!="function")throw new Error;xr(this,e).ease=r}}function oM(e){if(typeof e!="function")throw new Error;return this.each(iM(this._id,e))}function aM(e){typeof e!="function"&&(e=FN(e));for(var t=this._groups,r=t.length,i=new Array(r),o=0;o<r;++o)for(var a=t[o],u=a.length,c=i[o]=[],f,p=0;p<u;++p)(f=a[p])&&e.call(f,f.__data__,p,a)&&c.push(f);return new Ur(i,this._parents,this._name,this._id)}function lM(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,r=e._groups,i=t.length,o=r.length,a=Math.min(i,o),u=new Array(i),c=0;c<a;++c)for(var f=t[c],p=r[c],d=f.length,g=u[c]=new Array(d),y,w=0;w<d;++w)(y=f[w]||p[w])&&(g[w]=y);for(;c<i;++c)u[c]=t[c];return new Ur(u,this._parents,this._name,this._id)}function uM(e){return(e+"").trim().split(/^|\s+/).every(function(t){var r=t.indexOf(".");return r>=0&&(t=t.slice(0,r)),!t||t==="start"})}function cM(e,t,r){var i,o,a=uM(t)?gy:xr;return function(){var u=a(this,e),c=u.on;c!==i&&(o=(i=c).copy()).on(t,r),u.on=o}}function dM(e,t){var r=this._id;return arguments.length<2?sr(this.node(),r).on.on(e):this.each(cM(r,e,t))}function fM(e){return function(){var t=this.parentNode;for(var r in this.__transition)if(+r!==e)return;t&&t.removeChild(this)}}function hM(){return this.on("end.remove",fM(this._id))}function pM(e){var t=this._name,r=this._id;typeof e!="function"&&(e=fy(e));for(var i=this._groups,o=i.length,a=new Array(o),u=0;u<o;++u)for(var c=i[u],f=c.length,p=a[u]=new Array(f),d,g,y=0;y<f;++y)(d=c[y])&&(g=e.call(d,d.__data__,y,c))&&("__data__"in d&&(g.__data__=d.__data__),p[y]=g,Ku(p[y],t,r,y,p,sr(d,r)));return new Ur(a,this._parents,t,r)}function mM(e){var t=this._name,r=this._id;typeof e!="function"&&(e=DN(e));for(var i=this._groups,o=i.length,a=[],u=[],c=0;c<o;++c)for(var f=i[c],p=f.length,d,g=0;g<p;++g)if(d=f[g]){for(var y=e.call(d,d.__data__,g,f),w,E=sr(d,r),_=0,b=y.length;_<b;++_)(w=y[_])&&Ku(w,t,r,_,y,E);a.push(y),u.push(d)}return new Ur(a,u,t,r)}var gM=za.prototype.constructor;function vM(){return new gM(this._groups,this._parents)}function yM(e,t){var r,i,o;return function(){var a=xo(this,e),u=(this.style.removeProperty(e),xo(this,e));return a===u?null:a===r&&u===i?o:o=t(r=a,i=u)}}function uC(e){return function(){this.style.removeProperty(e)}}function wM(e,t,r){var i,o=r+"",a;return function(){var u=xo(this,e);return u===o?null:u===i?a:a=t(i=u,r)}}function xM(e,t,r){var i,o,a;return function(){var u=xo(this,e),c=r(this),f=c+"";return c==null&&(f=c=(this.style.removeProperty(e),xo(this,e))),u===f?null:u===i&&f===o?a:(o=f,a=t(i=u,c))}}function _M(e,t){var r,i,o,a="style."+t,u="end."+a,c;return function(){var f=xr(this,e),p=f.on,d=f.value[a]==null?c||(c=uC(t)):void 0;(p!==r||o!==d)&&(i=(r=p).copy()).on(u,o=d),f.on=i}}function bM(e,t,r){var i=(e+="")=="transform"?bI:lC;return t==null?this.styleTween(e,yM(e,i)).on("end.style."+e,uC(e)):typeof t=="function"?this.styleTween(e,xM(e,i,vy(this,"style."+e,t))).each(_M(this._id,e)):this.styleTween(e,wM(e,i,t),r).on("end.style."+e,null)}function kM(e,t,r){return function(i){this.style.setProperty(e,t.call(this,i),r)}}function SM(e,t,r){var i,o;function a(){var u=t.apply(this,arguments);return u!==o&&(i=(o=u)&&kM(e,u,r)),i}return a._value=t,a}function EM(e,t,r){var i="style."+(e+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(t==null)return this.tween(i,null);if(typeof t!="function")throw new Error;return this.tween(i,SM(e,t,r??""))}function NM(e){return function(){this.textContent=e}}function CM(e){return function(){var t=e(this);this.textContent=t??""}}function jM(e){return this.tween("text",typeof e=="function"?CM(vy(this,"text",e)):NM(e==null?"":e+""))}function TM(e){return function(t){this.textContent=e.call(this,t)}}function RM(e){var t,r;function i(){var o=e.apply(this,arguments);return o!==r&&(t=(r=o)&&TM(o)),t}return i._value=e,i}function AM(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,RM(e))}function IM(){for(var e=this._name,t=this._id,r=cC(),i=this._groups,o=i.length,a=0;a<o;++a)for(var u=i[a],c=u.length,f,p=0;p<c;++p)if(f=u[p]){var d=sr(f,t);Ku(f,e,r,p,u,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new Ur(i,this._parents,e,r)}function MM(){var e,t,r=this,i=r._id,o=r.size();return new Promise(function(a,u){var c={value:u},f={value:function(){--o===0&&a()}};r.each(function(){var p=xr(this,i),d=p.on;d!==e&&(t=(e=d).copy(),t._.cancel.push(c),t._.interrupt.push(c),t._.end.push(f)),p.on=t}),o===0&&a()})}var OM=0;function Ur(e,t,r,i){this._groups=e,this._parents=t,this._name=r,this._id=i}function cC(){return++OM}var Dr=za.prototype;Ur.prototype={constructor:Ur,select:pM,selectAll:mM,selectChild:Dr.selectChild,selectChildren:Dr.selectChildren,filter:aM,merge:lM,selection:vM,transition:IM,call:Dr.call,nodes:Dr.nodes,node:Dr.node,size:Dr.size,empty:Dr.empty,each:Dr.each,on:dM,attr:WI,attrTween:XI,style:bM,styleTween:EM,text:jM,textTween:AM,remove:hM,tween:qI,delay:JI,duration:nM,ease:sM,easeVarying:oM,end:MM,[Symbol.iterator]:Dr[Symbol.iterator]};function PM(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var LM={time:null,delay:0,duration:250,ease:PM};function $M(e,t){for(var r;!(r=e.__transition)||!(r=r[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return r}function qM(e){var t,r;e instanceof Ur?(t=e._id,e=e._name):(t=cC(),(r=LM).time=my(),e=e==null?null:e+"");for(var i=this._groups,o=i.length,a=0;a<o;++a)for(var u=i[a],c=u.length,f,p=0;p<c;++p)(f=u[p])&&Ku(f,e,t,p,u,r||$M(f,t));return new Ur(i,this._parents,e,t)}za.prototype.interrupt=PI;za.prototype.transition=qM;const cu=e=>()=>e;function DM(e,{sourceEvent:t,target:r,transform:i,dispatch:o}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:o}})}function Fr(e,t,r){this.k=e,this.x=t,this.y=r}Fr.prototype={constructor:Fr,scale:function(e){return e===1?this:new Fr(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Fr(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 Br=new Fr(1,0,0);Fr.prototype;function sf(e){e.stopImmediatePropagation()}function va(e){e.preventDefault(),e.stopImmediatePropagation()}function FM(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function zM(){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 zx(){return this.__zoom||Br}function BM(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function UM(){return navigator.maxTouchPoints||"ontouchstart"in this}function HM(e,t,r){var i=e.invertX(t[0][0])-r[0][0],o=e.invertX(t[1][0])-r[1][0],a=e.invertY(t[0][1])-r[0][1],u=e.invertY(t[1][1])-r[1][1];return e.translate(o>i?(i+o)/2:Math.min(0,i)||Math.max(0,o),u>a?(a+u)/2:Math.min(0,a)||Math.max(0,u))}function dC(){var e=FM,t=zM,r=HM,i=BM,o=UM,a=[0,1/0],u=[[-1/0,-1/0],[1/0,1/0]],c=250,f=CI,p=Vu("start","zoom","end"),d,g,y,w=500,E=150,_=0,b=10;function k(j){j.property("__zoom",zx).on("wheel.zoom",U,{passive:!1}).on("mousedown.zoom",O).on("dblclick.zoom",M).filter(o).on("touchstart.zoom",q).on("touchmove.zoom",V).on("touchend.zoom touchcancel.zoom",Q).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}k.transform=function(j,G,z,te){var J=j.selection?j.selection():j;J.property("__zoom",zx),j!==J?A(j,G,z,te):J.interrupt().each(function(){L(this,arguments).event(te).start().zoom(null,typeof G=="function"?G.apply(this,arguments):G).end()})},k.scaleBy=function(j,G,z,te){k.scaleTo(j,function(){var J=this.__zoom.k,$=typeof G=="function"?G.apply(this,arguments):G;return J*$},z,te)},k.scaleTo=function(j,G,z,te){k.transform(j,function(){var J=t.apply(this,arguments),$=this.__zoom,W=z==null?T(J):typeof z=="function"?z.apply(this,arguments):z,I=$.invert(W),Y=typeof G=="function"?G.apply(this,arguments):G;return r(N(S($,Y),W,I),J,u)},z,te)},k.translateBy=function(j,G,z,te){k.transform(j,function(){return r(this.__zoom.translate(typeof G=="function"?G.apply(this,arguments):G,typeof z=="function"?z.apply(this,arguments):z),t.apply(this,arguments),u)},null,te)},k.translateTo=function(j,G,z,te,J){k.transform(j,function(){var $=t.apply(this,arguments),W=this.__zoom,I=te==null?T($):typeof te=="function"?te.apply(this,arguments):te;return r(Br.translate(I[0],I[1]).scale(W.k).translate(typeof G=="function"?-G.apply(this,arguments):-G,typeof z=="function"?-z.apply(this,arguments):-z),$,u)},te,J)};function S(j,G){return G=Math.max(a[0],Math.min(a[1],G)),G===j.k?j:new Fr(G,j.x,j.y)}function N(j,G,z){var te=G[0]-z[0]*j.k,J=G[1]-z[1]*j.k;return te===j.x&&J===j.y?j:new Fr(j.k,te,J)}function T(j){return[(+j[0][0]+ +j[1][0])/2,(+j[0][1]+ +j[1][1])/2]}function A(j,G,z,te){j.on("start.zoom",function(){L(this,arguments).event(te).start()}).on("interrupt.zoom end.zoom",function(){L(this,arguments).event(te).end()}).tween("zoom",function(){var J=this,$=arguments,W=L(J,$).event(te),I=t.apply(J,$),Y=z==null?T(I):typeof z=="function"?z.apply(J,$):z,ue=Math.max(I[1][0]-I[0][0],I[1][1]-I[0][1]),F=J.__zoom,Z=typeof G=="function"?G.apply(J,$):G,ne=f(F.invert(Y).concat(ue/F.k),Z.invert(Y).concat(ue/Z.k));return function(B){if(B===1)B=Z;else{var de=ne(B),pe=ue/de[2];B=new Fr(pe,Y[0]-de[0]*pe,Y[1]-de[1]*pe)}W.zoom(null,B)}})}function L(j,G,z){return!z&&j.__zooming||new P(j,G)}function P(j,G){this.that=j,this.args=G,this.active=0,this.sourceEvent=null,this.extent=t.apply(j,G),this.taps=0}P.prototype={event:function(j){return j&&(this.sourceEvent=j),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(j,G){return this.mouse&&j!=="mouse"&&(this.mouse[1]=G.invert(this.mouse[0])),this.touch0&&j!=="touch"&&(this.touch0[1]=G.invert(this.touch0[0])),this.touch1&&j!=="touch"&&(this.touch1[1]=G.invert(this.touch1[0])),this.that.__zoom=G,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(j){var G=Ln(this.that).datum();p.call(j,this.that,new DM(j,{sourceEvent:this.sourceEvent,target:k,transform:this.that.__zoom,dispatch:p}),G)}};function U(j,...G){if(!e.apply(this,arguments))return;var z=L(this,G).event(j),te=this.__zoom,J=Math.max(a[0],Math.min(a[1],te.k*Math.pow(2,i.apply(this,arguments)))),$=er(j);if(z.wheel)(z.mouse[0][0]!==$[0]||z.mouse[0][1]!==$[1])&&(z.mouse[1]=te.invert(z.mouse[0]=$)),clearTimeout(z.wheel);else{if(te.k===J)return;z.mouse=[$,te.invert($)],Cu(this),z.start()}va(j),z.wheel=setTimeout(W,E),z.zoom("mouse",r(N(S(te,J),z.mouse[0],z.mouse[1]),z.extent,u));function W(){z.wheel=null,z.end()}}function O(j,...G){if(y||!e.apply(this,arguments))return;var z=j.currentTarget,te=L(this,G,!0).event(j),J=Ln(j.view).on("mousemove.zoom",Y,!0).on("mouseup.zoom",ue,!0),$=er(j,z),W=j.clientX,I=j.clientY;XN(j.view),sf(j),te.mouse=[$,this.__zoom.invert($)],Cu(this),te.start();function Y(F){if(va(F),!te.moved){var Z=F.clientX-W,ne=F.clientY-I;te.moved=Z*Z+ne*ne>_}te.event(F).zoom("mouse",r(N(te.that.__zoom,te.mouse[0]=er(F,z),te.mouse[1]),te.extent,u))}function ue(F){J.on("mousemove.zoom mouseup.zoom",null),QN(F.view,te.moved),va(F),te.event(F).end()}}function M(j,...G){if(e.apply(this,arguments)){var z=this.__zoom,te=er(j.changedTouches?j.changedTouches[0]:j,this),J=z.invert(te),$=z.k*(j.shiftKey?.5:2),W=r(N(S(z,$),te,J),t.apply(this,G),u);va(j),c>0?Ln(this).transition().duration(c).call(A,W,te,j):Ln(this).call(k.transform,W,te,j)}}function q(j,...G){if(e.apply(this,arguments)){var z=j.touches,te=z.length,J=L(this,G,j.changedTouches.length===te).event(j),$,W,I,Y;for(sf(j),W=0;W<te;++W)I=z[W],Y=er(I,this),Y=[Y,this.__zoom.invert(Y),I.identifier],J.touch0?!J.touch1&&J.touch0[2]!==Y[2]&&(J.touch1=Y,J.taps=0):(J.touch0=Y,$=!0,J.taps=1+!!d);d&&(d=clearTimeout(d)),$&&(J.taps<2&&(g=Y[0],d=setTimeout(function(){d=null},w)),Cu(this),J.start())}}function V(j,...G){if(this.__zooming){var z=L(this,G).event(j),te=j.changedTouches,J=te.length,$,W,I,Y;for(va(j),$=0;$<J;++$)W=te[$],I=er(W,this),z.touch0&&z.touch0[2]===W.identifier?z.touch0[0]=I:z.touch1&&z.touch1[2]===W.identifier&&(z.touch1[0]=I);if(W=z.that.__zoom,z.touch1){var ue=z.touch0[0],F=z.touch0[1],Z=z.touch1[0],ne=z.touch1[1],B=(B=Z[0]-ue[0])*B+(B=Z[1]-ue[1])*B,de=(de=ne[0]-F[0])*de+(de=ne[1]-F[1])*de;W=S(W,Math.sqrt(B/de)),I=[(ue[0]+Z[0])/2,(ue[1]+Z[1])/2],Y=[(F[0]+ne[0])/2,(F[1]+ne[1])/2]}else if(z.touch0)I=z.touch0[0],Y=z.touch0[1];else return;z.zoom("touch",r(N(W,I,Y),z.extent,u))}}function Q(j,...G){if(this.__zooming){var z=L(this,G).event(j),te=j.changedTouches,J=te.length,$,W;for(sf(j),y&&clearTimeout(y),y=setTimeout(function(){y=null},w),$=0;$<J;++$)W=te[$],z.touch0&&z.touch0[2]===W.identifier?delete z.touch0:z.touch1&&z.touch1[2]===W.identifier&&delete z.touch1;if(z.touch1&&!z.touch0&&(z.touch0=z.touch1,delete z.touch1),z.touch0)z.touch0[1]=this.__zoom.invert(z.touch0[0]);else if(z.end(),z.taps===2&&(W=er(W,this),Math.hypot(g[0]-W[0],g[1]-W[1])<b)){var I=Ln(this).on("dblclick.zoom");I&&I.apply(this,arguments)}}}return k.wheelDelta=function(j){return arguments.length?(i=typeof j=="function"?j:cu(+j),k):i},k.filter=function(j){return arguments.length?(e=typeof j=="function"?j:cu(!!j),k):e},k.touchable=function(j){return arguments.length?(o=typeof j=="function"?j:cu(!!j),k):o},k.extent=function(j){return arguments.length?(t=typeof j=="function"?j:cu([[+j[0][0],+j[0][1]],[+j[1][0],+j[1][1]]]),k):t},k.scaleExtent=function(j){return arguments.length?(a[0]=+j[0],a[1]=+j[1],k):[a[0],a[1]]},k.translateExtent=function(j){return arguments.length?(u[0][0]=+j[0][0],u[1][0]=+j[1][0],u[0][1]=+j[0][1],u[1][1]=+j[1][1],k):[[u[0][0],u[0][1]],[u[1][0],u[1][1]]]},k.constrain=function(j){return arguments.length?(r=j,k):r},k.duration=function(j){return arguments.length?(c=+j,k):c},k.interpolate=function(j){return arguments.length?(f=j,k):f},k.on=function(){var j=p.on.apply(p,arguments);return j===p?k:j},k.clickDistance=function(j){return arguments.length?(_=(j=+j)*j,k):Math.sqrt(_)},k.tapDistance=function(j){return arguments.length?(b=+j,k):b},k}var WM=LN();const Xu=C.createContext(null),VM=Xu.Provider,Hr={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.`},fC=Hr.error001();function rt(e,t){const r=C.useContext(Xu);if(r===null)throw new Error(fC);return $N(r,e,t)}const Nt=()=>{const e=C.useContext(Xu);if(e===null)throw new Error(fC);return C.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},GM=e=>e.userSelectionActive?"none":"all";function yy({position:e,children:t,className:r,style:i,...o}){const a=rt(GM),u=`${e}`.split("-");return ae.createElement("div",{className:Dt(["react-flow__panel",r,...u]),style:{...i,pointerEvents:a},...o},t)}function YM({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:ae.createElement(yy,{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"},ae.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}const KM=({x:e,y:t,label:r,labelStyle:i={},labelShowBg:o=!0,labelBgStyle:a={},labelBgPadding:u=[2,4],labelBgBorderRadius:c=2,children:f,className:p,...d})=>{const g=C.useRef(null),[y,w]=C.useState({x:0,y:0,width:0,height:0}),E=Dt(["react-flow__edge-textwrapper",p]);return C.useEffect(()=>{if(g.current){const _=g.current.getBBox();w({x:_.x,y:_.y,width:_.width,height:_.height})}},[r]),typeof r>"u"||!r?null:ae.createElement("g",{transform:`translate(${e-y.width/2} ${t-y.height/2})`,className:E,visibility:y.width?"visible":"hidden",...d},o&&ae.createElement("rect",{width:y.width+2*u[0],x:-u[0],y:-u[1],height:y.height+2*u[1],className:"react-flow__edge-textbg",style:a,rx:c,ry:c}),ae.createElement("text",{className:"react-flow__edge-text",y:y.height/2,dy:"0.3em",ref:g,style:i},r),f)};var XM=C.memo(KM);const wy=e=>({width:e.offsetWidth,height:e.offsetHeight}),bo=(e,t=0,r=1)=>Math.min(Math.max(e,t),r),xy=(e={x:0,y:0},t)=>({x:bo(e.x,t[0][0],t[1][0]),y:bo(e.y,t[0][1],t[1][1])}),Bx=(e,t,r)=>e<t?bo(Math.abs(e-t),1,50)/50:e>r?-bo(Math.abs(e-r),1,50)/50:0,hC=(e,t)=>{const r=Bx(e.x,35,t.width-35)*20,i=Bx(e.y,35,t.height-35)*20;return[r,i]},pC=e=>{var t;return((t=e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},mC=(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)}),Oa=({x:e,y:t,width:r,height:i})=>({x:e,y:t,x2:e+r,y2:t+i}),gC=({x:e,y:t,x2:r,y2:i})=>({x:e,y:t,width:r-e,height:i-t}),Ux=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),QM=(e,t)=>gC(mC(Oa(e),Oa(t))),Wv=(e,t)=>{const r=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),i=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(r*i)},ZM=e=>$n(e.width)&&$n(e.height)&&$n(e.x)&&$n(e.y),$n=e=>!isNaN(e)&&isFinite(e),xt=Symbol.for("internals"),vC=["Enter"," ","Escape"],JM=(e,t)=>{},eO=e=>"nativeEvent"in e;function Vv(e){var o,a;const t=eO(e)?e.nativeEvent:e,r=((a=(o=t.composedPath)==null?void 0:o.call(t))==null?void 0:a[0])||e.target;return["INPUT","SELECT","TEXTAREA"].includes(r==null?void 0:r.nodeName)||(r==null?void 0:r.hasAttribute("contenteditable"))||!!(r!=null&&r.closest(".nokey"))}const yC=e=>"clientX"in e,ks=(e,t)=>{var a,u;const r=yC(e),i=r?e.clientX:(a=e.touches)==null?void 0:a[0].clientX,o=r?e.clientY:(u=e.touches)==null?void 0:u[0].clientY;return{x:i-((t==null?void 0:t.left)??0),y:o-((t==null?void 0:t.top)??0)}},Lu=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0},Ua=({id:e,path:t,labelX:r,labelY:i,label:o,labelStyle:a,labelShowBg:u,labelBgStyle:c,labelBgPadding:f,labelBgBorderRadius:p,style:d,markerEnd:g,markerStart:y,interactionWidth:w=20})=>ae.createElement(ae.Fragment,null,ae.createElement("path",{id:e,style:d,d:t,fill:"none",className:"react-flow__edge-path",markerEnd:g,markerStart:y}),w&&ae.createElement("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:w,className:"react-flow__edge-interaction"}),o&&$n(r)&&$n(i)?ae.createElement(XM,{x:r,y:i,label:o,labelStyle:a,labelShowBg:u,labelBgStyle:c,labelBgPadding:f,labelBgBorderRadius:p}):null);Ua.displayName="BaseEdge";function ya(e,t,r){return r===void 0?r:i=>{const o=t().edges.find(a=>a.id===e);o&&r(i,{...o})}}function wC({sourceX:e,sourceY:t,targetX:r,targetY:i}){const o=Math.abs(r-e)/2,a=r<e?r+o:r-o,u=Math.abs(i-t)/2,c=i<t?i+u:i-u;return[a,c,o,u]}function xC({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:o,sourceControlY:a,targetControlX:u,targetControlY:c}){const f=e*.125+o*.375+u*.375+r*.125,p=t*.125+a*.375+c*.375+i*.125,d=Math.abs(f-e),g=Math.abs(p-t);return[f,p,d,g]}var pi;(function(e){e.Strict="strict",e.Loose="loose"})(pi||(pi={}));var ci;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(ci||(ci={}));var Pa;(function(e){e.Partial="partial",e.Full="full"})(Pa||(Pa={}));var bs;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(bs||(bs={}));var $u;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})($u||($u={}));var Re;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Re||(Re={}));function Hx({pos:e,x1:t,y1:r,x2:i,y2:o}){return e===Re.Left||e===Re.Right?[.5*(t+i),r]:[t,.5*(r+o)]}function _C({sourceX:e,sourceY:t,sourcePosition:r=Re.Bottom,targetX:i,targetY:o,targetPosition:a=Re.Top}){const[u,c]=Hx({pos:r,x1:e,y1:t,x2:i,y2:o}),[f,p]=Hx({pos:a,x1:i,y1:o,x2:e,y2:t}),[d,g,y,w]=xC({sourceX:e,sourceY:t,targetX:i,targetY:o,sourceControlX:u,sourceControlY:c,targetControlX:f,targetControlY:p});return[`M${e},${t} C${u},${c} ${f},${p} ${i},${o}`,d,g,y,w]}const _y=C.memo(({sourceX:e,sourceY:t,targetX:r,targetY:i,sourcePosition:o=Re.Bottom,targetPosition:a=Re.Top,label:u,labelStyle:c,labelShowBg:f,labelBgStyle:p,labelBgPadding:d,labelBgBorderRadius:g,style:y,markerEnd:w,markerStart:E,interactionWidth:_})=>{const[b,k,S]=_C({sourceX:e,sourceY:t,sourcePosition:o,targetX:r,targetY:i,targetPosition:a});return ae.createElement(Ua,{path:b,labelX:k,labelY:S,label:u,labelStyle:c,labelShowBg:f,labelBgStyle:p,labelBgPadding:d,labelBgBorderRadius:g,style:y,markerEnd:w,markerStart:E,interactionWidth:_})});_y.displayName="SimpleBezierEdge";const Wx={[Re.Left]:{x:-1,y:0},[Re.Right]:{x:1,y:0},[Re.Top]:{x:0,y:-1},[Re.Bottom]:{x:0,y:1}},tO=({source:e,sourcePosition:t=Re.Bottom,target:r})=>t===Re.Left||t===Re.Right?e.x<r.x?{x:1,y:0}:{x:-1,y:0}:e.y<r.y?{x:0,y:1}:{x:0,y:-1},Vx=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function nO({source:e,sourcePosition:t=Re.Bottom,target:r,targetPosition:i=Re.Top,center:o,offset:a}){const u=Wx[t],c=Wx[i],f={x:e.x+u.x*a,y:e.y+u.y*a},p={x:r.x+c.x*a,y:r.y+c.y*a},d=tO({source:f,sourcePosition:t,target:p}),g=d.x!==0?"x":"y",y=d[g];let w=[],E,_;const b={x:0,y:0},k={x:0,y:0},[S,N,T,A]=wC({sourceX:e.x,sourceY:e.y,targetX:r.x,targetY:r.y});if(u[g]*c[g]===-1){E=o.x??S,_=o.y??N;const P=[{x:E,y:f.y},{x:E,y:p.y}],U=[{x:f.x,y:_},{x:p.x,y:_}];u[g]===y?w=g==="x"?P:U:w=g==="x"?U:P}else{const P=[{x:f.x,y:p.y}],U=[{x:p.x,y:f.y}];if(g==="x"?w=u.x===y?U:P:w=u.y===y?P:U,t===i){const Q=Math.abs(e[g]-r[g]);if(Q<=a){const j=Math.min(a-1,a-Q);u[g]===y?b[g]=(f[g]>e[g]?-1:1)*j:k[g]=(p[g]>r[g]?-1:1)*j}}if(t!==i){const Q=g==="x"?"y":"x",j=u[g]===c[Q],G=f[Q]>p[Q],z=f[Q]<p[Q];(u[g]===1&&(!j&&G||j&&z)||u[g]!==1&&(!j&&z||j&&G))&&(w=g==="x"?P:U)}const O={x:f.x+b.x,y:f.y+b.y},M={x:p.x+k.x,y:p.y+k.y},q=Math.max(Math.abs(O.x-w[0].x),Math.abs(M.x-w[0].x)),V=Math.max(Math.abs(O.y-w[0].y),Math.abs(M.y-w[0].y));q>=V?(E=(O.x+M.x)/2,_=w[0].y):(E=w[0].x,_=(O.y+M.y)/2)}return[[e,{x:f.x+b.x,y:f.y+b.y},...w,{x:p.x+k.x,y:p.y+k.y},r],E,_,T,A]}function rO(e,t,r,i){const o=Math.min(Vx(e,t)/2,Vx(t,r)/2,i),{x:a,y:u}=t;if(e.x===a&&a===r.x||e.y===u&&u===r.y)return`L${a} ${u}`;if(e.y===u){const p=e.x<r.x?-1:1,d=e.y<r.y?1:-1;return`L ${a+o*p},${u}Q ${a},${u} ${a},${u+o*d}`}const c=e.x<r.x?1:-1,f=e.y<r.y?-1:1;return`L ${a},${u+o*f}Q ${a},${u} ${a+o*c},${u}`}function Gv({sourceX:e,sourceY:t,sourcePosition:r=Re.Bottom,targetX:i,targetY:o,targetPosition:a=Re.Top,borderRadius:u=5,centerX:c,centerY:f,offset:p=20}){const[d,g,y,w,E]=nO({source:{x:e,y:t},sourcePosition:r,target:{x:i,y:o},targetPosition:a,center:{x:c,y:f},offset:p});return[d.reduce((b,k,S)=>{let N="";return S>0&&S<d.length-1?N=rO(d[S-1],k,d[S+1],u):N=`${S===0?"M":"L"}${k.x} ${k.y}`,b+=N,b},""),g,y,w,E]}const Qu=C.memo(({sourceX:e,sourceY:t,targetX:r,targetY:i,label:o,labelStyle:a,labelShowBg:u,labelBgStyle:c,labelBgPadding:f,labelBgBorderRadius:p,style:d,sourcePosition:g=Re.Bottom,targetPosition:y=Re.Top,markerEnd:w,markerStart:E,pathOptions:_,interactionWidth:b})=>{const[k,S,N]=Gv({sourceX:e,sourceY:t,sourcePosition:g,targetX:r,targetY:i,targetPosition:y,borderRadius:_==null?void 0:_.borderRadius,offset:_==null?void 0:_.offset});return ae.createElement(Ua,{path:k,labelX:S,labelY:N,label:o,labelStyle:a,labelShowBg:u,labelBgStyle:c,labelBgPadding:f,labelBgBorderRadius:p,style:d,markerEnd:w,markerStart:E,interactionWidth:b})});Qu.displayName="SmoothStepEdge";const by=C.memo(e=>{var t;return ae.createElement(Qu,{...e,pathOptions:C.useMemo(()=>{var r;return{borderRadius:0,offset:(r=e.pathOptions)==null?void 0:r.offset}},[(t=e.pathOptions)==null?void 0:t.offset])})});by.displayName="StepEdge";function sO({sourceX:e,sourceY:t,targetX:r,targetY:i}){const[o,a,u,c]=wC({sourceX:e,sourceY:t,targetX:r,targetY:i});return[`M ${e},${t}L ${r},${i}`,o,a,u,c]}const ky=C.memo(({sourceX:e,sourceY:t,targetX:r,targetY:i,label:o,labelStyle:a,labelShowBg:u,labelBgStyle:c,labelBgPadding:f,labelBgBorderRadius:p,style:d,markerEnd:g,markerStart:y,interactionWidth:w})=>{const[E,_,b]=sO({sourceX:e,sourceY:t,targetX:r,targetY:i});return ae.createElement(Ua,{path:E,labelX:_,labelY:b,label:o,labelStyle:a,labelShowBg:u,labelBgStyle:c,labelBgPadding:f,labelBgBorderRadius:p,style:d,markerEnd:g,markerStart:y,interactionWidth:w})});ky.displayName="StraightEdge";function du(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Gx({pos:e,x1:t,y1:r,x2:i,y2:o,c:a}){switch(e){case Re.Left:return[t-du(t-i,a),r];case Re.Right:return[t+du(i-t,a),r];case Re.Top:return[t,r-du(r-o,a)];case Re.Bottom:return[t,r+du(o-r,a)]}}function bC({sourceX:e,sourceY:t,sourcePosition:r=Re.Bottom,targetX:i,targetY:o,targetPosition:a=Re.Top,curvature:u=.25}){const[c,f]=Gx({pos:r,x1:e,y1:t,x2:i,y2:o,c:u}),[p,d]=Gx({pos:a,x1:i,y1:o,x2:e,y2:t,c:u}),[g,y,w,E]=xC({sourceX:e,sourceY:t,targetX:i,targetY:o,sourceControlX:c,sourceControlY:f,targetControlX:p,targetControlY:d});return[`M${e},${t} C${c},${f} ${p},${d} ${i},${o}`,g,y,w,E]}const qu=C.memo(({sourceX:e,sourceY:t,targetX:r,targetY:i,sourcePosition:o=Re.Bottom,targetPosition:a=Re.Top,label:u,labelStyle:c,labelShowBg:f,labelBgStyle:p,labelBgPadding:d,labelBgBorderRadius:g,style:y,markerEnd:w,markerStart:E,pathOptions:_,interactionWidth:b})=>{const[k,S,N]=bC({sourceX:e,sourceY:t,sourcePosition:o,targetX:r,targetY:i,targetPosition:a,curvature:_==null?void 0:_.curvature});return ae.createElement(Ua,{path:k,labelX:S,labelY:N,label:u,labelStyle:c,labelShowBg:f,labelBgStyle:p,labelBgPadding:d,labelBgBorderRadius:g,style:y,markerEnd:w,markerStart:E,interactionWidth:b})});qu.displayName="BezierEdge";const Sy=C.createContext(null),iO=Sy.Provider;Sy.Consumer;const oO=()=>C.useContext(Sy),aO=e=>"id"in e&&"source"in e&&"target"in e,lO=({source:e,sourceHandle:t,target:r,targetHandle:i})=>`reactflow__edge-${e}${t||""}-${r}${i||""}`,Yv=(e,t)=>typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(i=>`${i}=${e[i]}`).join("&")}`,uO=(e,t)=>t.some(r=>r.source===e.source&&r.target===e.target&&(r.sourceHandle===e.sourceHandle||!r.sourceHandle&&!e.sourceHandle)&&(r.targetHandle===e.targetHandle||!r.targetHandle&&!e.targetHandle)),cO=(e,t)=>{if(!e.source||!e.target)return t;let r;return aO(e)?r={...e}:r={...e,id:lO(e)},uO(r,t)?t:t.concat(r)},Kv=({x:e,y:t},[r,i,o],a,[u,c])=>{const f={x:(e-r)/o,y:(t-i)/o};return a?{x:u*Math.round(f.x/u),y:c*Math.round(f.y/c)}:f},kC=({x:e,y:t},[r,i,o])=>({x:e*o+r,y:t*o+i}),fi=(e,t=[0,0])=>{if(!e)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const r=(e.width??0)*t[0],i=(e.height??0)*t[1],o={x:e.position.x-r,y:e.position.y-i};return{...o,positionAbsolute:e.positionAbsolute?{x:e.positionAbsolute.x-r,y:e.positionAbsolute.y-i}:o}},Zu=(e,t=[0,0])=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const r=e.reduce((i,o)=>{const{x:a,y:u}=fi(o,t).positionAbsolute;return mC(i,Oa({x:a,y:u,width:o.width||0,height:o.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return gC(r)},SC=(e,t,[r,i,o]=[0,0,1],a=!1,u=!1,c=[0,0])=>{const f={x:(t.x-r)/o,y:(t.y-i)/o,width:t.width/o,height:t.height/o},p=[];return e.forEach(d=>{const{width:g,height:y,selectable:w=!0,hidden:E=!1}=d;if(u&&!w||E)return!1;const{positionAbsolute:_}=fi(d,c),b={x:_.x,y:_.y,width:g||0,height:y||0},k=Wv(f,b),S=typeof g>"u"||typeof y>"u"||g===null||y===null,N=a&&k>0,T=(g||0)*(y||0);(S||N||k>=T||d.dragging)&&p.push(d)}),p},EC=(e,t)=>{const r=e.map(i=>i.id);return t.filter(i=>r.includes(i.source)||r.includes(i.target))},NC=(e,t,r,i,o,a=.1)=>{const u=t/(e.width*(1+a)),c=r/(e.height*(1+a)),f=Math.min(u,c),p=bo(f,i,o),d=e.x+e.width/2,g=e.y+e.height/2,y=t/2-d*p,w=r/2-g*p;return{x:y,y:w,zoom:p}},li=(e,t=0)=>e.transition().duration(t);function Yx(e,t,r,i){return(t[r]||[]).reduce((o,a)=>{var u,c;return`${e.id}-${a.id}-${r}`!==i&&o.push({id:a.id||null,type:r,nodeId:e.id,x:(((u=e.positionAbsolute)==null?void 0:u.x)??0)+a.x+a.width/2,y:(((c=e.positionAbsolute)==null?void 0:c.y)??0)+a.y+a.height/2}),o},[])}function dO(e,t,r,i,o,a){const{x:u,y:c}=ks(e),p=t.elementsFromPoint(u,c).find(E=>E.classList.contains("react-flow__handle"));if(p){const E=p.getAttribute("data-nodeid");if(E){const _=Ey(void 0,p),b=p.getAttribute("data-handleid"),k=a({nodeId:E,id:b,type:_});if(k){const S=o.find(N=>N.nodeId===E&&N.type===_&&N.id===b);return{handle:{id:b,type:_,nodeId:E,x:(S==null?void 0:S.x)||r.x,y:(S==null?void 0:S.y)||r.y},validHandleResult:k}}}}let d=[],g=1/0;if(o.forEach(E=>{const _=Math.sqrt((E.x-r.x)**2+(E.y-r.y)**2);if(_<=i){const b=a(E);_<=g&&(_<g?d=[{handle:E,validHandleResult:b}]:_===g&&d.push({handle:E,validHandleResult:b}),g=_)}}),!d.length)return{handle:null,validHandleResult:CC()};if(d.length===1)return d[0];const y=d.some(({validHandleResult:E})=>E.isValid),w=d.some(({handle:E})=>E.type==="target");return d.find(({handle:E,validHandleResult:_})=>w?E.type==="target":y?_.isValid:!0)||d[0]}const fO={source:null,target:null,sourceHandle:null,targetHandle:null},CC=()=>({handleDomNode:null,isValid:!1,connection:fO,endHandle:null});function jC(e,t,r,i,o,a,u){const c=o==="target",f=u.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={...CC(),handleDomNode:f};if(f){const d=Ey(void 0,f),g=f.getAttribute("data-nodeid"),y=f.getAttribute("data-handleid"),w=f.classList.contains("connectable"),E=f.classList.contains("connectableend"),_={source:c?g:r,sourceHandle:c?y:i,target:c?r:g,targetHandle:c?i:y};p.connection=_,w&&E&&(t===pi.Strict?c&&d==="source"||!c&&d==="target":g!==r||y!==i)&&(p.endHandle={nodeId:g,handleId:y,type:d},p.isValid=a(_))}return p}function hO({nodes:e,nodeId:t,handleId:r,handleType:i}){return e.reduce((o,a)=>{if(a[xt]){const{handleBounds:u}=a[xt];let c=[],f=[];u&&(c=Yx(a,u,"source",`${t}-${r}-${i}`),f=Yx(a,u,"target",`${t}-${r}-${i}`)),o.push(...c,...f)}return o},[])}function Ey(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function of(e){e==null||e.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function pO(e,t){let r=null;return t?r="valid":e&&!t&&(r="invalid"),r}function TC({event:e,handleId:t,nodeId:r,onConnect:i,isTarget:o,getState:a,setState:u,isValidConnection:c,edgeUpdaterType:f,onReconnectEnd:p}){const d=pC(e.target),{connectionMode:g,domNode:y,autoPanOnConnect:w,connectionRadius:E,onConnectStart:_,panBy:b,getNodes:k,cancelConnection:S}=a();let N=0,T;const{x:A,y:L}=ks(e),P=d==null?void 0:d.elementFromPoint(A,L),U=Ey(f,P),O=y==null?void 0:y.getBoundingClientRect();if(!O||!U)return;let M,q=ks(e,O),V=!1,Q=null,j=!1,G=null;const z=hO({nodes:k(),nodeId:r,handleId:t,handleType:U}),te=()=>{if(!w)return;const[W,I]=hC(q,O);b({x:W,y:I}),N=requestAnimationFrame(te)};u({connectionPosition:q,connectionStatus:null,connectionNodeId:r,connectionHandleId:t,connectionHandleType:U,connectionStartHandle:{nodeId:r,handleId:t,type:U},connectionEndHandle:null}),_==null||_(e,{nodeId:r,handleId:t,handleType:U});function J(W){const{transform:I}=a();q=ks(W,O);const{handle:Y,validHandleResult:ue}=dO(W,d,Kv(q,I,!1,[1,1]),E,z,F=>jC(F,g,r,t,o?"target":"source",c,d));if(T=Y,V||(te(),V=!0),G=ue.handleDomNode,Q=ue.connection,j=ue.isValid,u({connectionPosition:T&&j?kC({x:T.x,y:T.y},I):q,connectionStatus:pO(!!T,j),connectionEndHandle:ue.endHandle}),!T&&!j&&!G)return of(M);Q.source!==Q.target&&G&&(of(M),M=G,G.classList.add("connecting","react-flow__handle-connecting"),G.classList.toggle("valid",j),G.classList.toggle("react-flow__handle-valid",j))}function $(W){var I,Y;(T||G)&&Q&&j&&(i==null||i(Q)),(Y=(I=a()).onConnectEnd)==null||Y.call(I,W),f&&(p==null||p(W)),of(M),S(),cancelAnimationFrame(N),V=!1,j=!1,Q=null,G=null,d.removeEventListener("mousemove",J),d.removeEventListener("mouseup",$),d.removeEventListener("touchmove",J),d.removeEventListener("touchend",$)}d.addEventListener("mousemove",J),d.addEventListener("mouseup",$),d.addEventListener("touchmove",J),d.addEventListener("touchend",$)}const Kx=()=>!0,mO=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),gO=(e,t,r)=>i=>{const{connectionStartHandle:o,connectionEndHandle:a,connectionClickStartHandle:u}=i;return{connecting:(o==null?void 0:o.nodeId)===e&&(o==null?void 0:o.handleId)===t&&(o==null?void 0:o.type)===r||(a==null?void 0:a.nodeId)===e&&(a==null?void 0:a.handleId)===t&&(a==null?void 0:a.type)===r,clickConnecting:(u==null?void 0:u.nodeId)===e&&(u==null?void 0:u.handleId)===t&&(u==null?void 0:u.type)===r}},RC=C.forwardRef(({type:e="source",position:t=Re.Top,isValidConnection:r,isConnectable:i=!0,isConnectableStart:o=!0,isConnectableEnd:a=!0,id:u,onConnect:c,children:f,className:p,onMouseDown:d,onTouchStart:g,...y},w)=>{var O,M;const E=u||null,_=e==="target",b=Nt(),k=oO(),{connectOnClick:S,noPanClassName:N}=rt(mO,At),{connecting:T,clickConnecting:A}=rt(gO(k,E,e),At);k||(M=(O=b.getState()).onError)==null||M.call(O,"010",Hr.error010());const L=q=>{const{defaultEdgeOptions:V,onConnect:Q,hasDefaultEdges:j}=b.getState(),G={...V,...q};if(j){const{edges:z,setEdges:te}=b.getState();te(cO(G,z))}Q==null||Q(G),c==null||c(G)},P=q=>{if(!k)return;const V=yC(q);o&&(V&&q.button===0||!V)&&TC({event:q,handleId:E,nodeId:k,onConnect:L,isTarget:_,getState:b.getState,setState:b.setState,isValidConnection:r||b.getState().isValidConnection||Kx}),V?d==null||d(q):g==null||g(q)},U=q=>{const{onClickConnectStart:V,onClickConnectEnd:Q,connectionClickStartHandle:j,connectionMode:G,isValidConnection:z}=b.getState();if(!k||!j&&!o)return;if(!j){V==null||V(q,{nodeId:k,handleId:E,handleType:e}),b.setState({connectionClickStartHandle:{nodeId:k,type:e,handleId:E}});return}const te=pC(q.target),J=r||z||Kx,{connection:$,isValid:W}=jC({nodeId:k,id:E,type:e},G,j.nodeId,j.handleId||null,j.type,J,te);W&&L($),Q==null||Q(q),b.setState({connectionClickStartHandle:null})};return ae.createElement("div",{"data-handleid":E,"data-nodeid":k,"data-handlepos":t,"data-id":`${k}-${E}-${e}`,className:Dt(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",N,p,{source:!_,target:_,connectable:i,connectablestart:o,connectableend:a,connecting:A,connectionindicator:i&&(o&&!T||a&&T)}]),onMouseDown:P,onTouchStart:P,onClick:S?U:void 0,ref:w,...y},f)});RC.displayName="Handle";var ko=C.memo(RC);const AC=({data:e,isConnectable:t,targetPosition:r=Re.Top,sourcePosition:i=Re.Bottom})=>ae.createElement(ae.Fragment,null,ae.createElement(ko,{type:"target",position:r,isConnectable:t}),e==null?void 0:e.label,ae.createElement(ko,{type:"source",position:i,isConnectable:t}));AC.displayName="DefaultNode";var Xv=C.memo(AC);const IC=({data:e,isConnectable:t,sourcePosition:r=Re.Bottom})=>ae.createElement(ae.Fragment,null,e==null?void 0:e.label,ae.createElement(ko,{type:"source",position:r,isConnectable:t}));IC.displayName="InputNode";var MC=C.memo(IC);const OC=({data:e,isConnectable:t,targetPosition:r=Re.Top})=>ae.createElement(ae.Fragment,null,ae.createElement(ko,{type:"target",position:r,isConnectable:t}),e==null?void 0:e.label);OC.displayName="OutputNode";var PC=C.memo(OC);const Ny=()=>null;Ny.displayName="GroupNode";const vO=e=>({selectedNodes:e.getNodes().filter(t=>t.selected),selectedEdges:e.edges.filter(t=>t.selected).map(t=>({...t}))}),fu=e=>e.id;function yO(e,t){return At(e.selectedNodes.map(fu),t.selectedNodes.map(fu))&&At(e.selectedEdges.map(fu),t.selectedEdges.map(fu))}const LC=C.memo(({onSelectionChange:e})=>{const t=Nt(),{selectedNodes:r,selectedEdges:i}=rt(vO,yO);return C.useEffect(()=>{const o={nodes:r,edges:i};e==null||e(o),t.getState().onSelectionChange.forEach(a=>a(o))},[r,i,e]),null});LC.displayName="SelectionListener";const wO=e=>!!e.onSelectionChange;function xO({onSelectionChange:e}){const t=rt(wO);return e||t?ae.createElement(LC,{onSelectionChange:e}):null}const _O=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 io(e,t){C.useEffect(()=>{typeof e<"u"&&t(e)},[e])}function Ve(e,t,r){C.useEffect(()=>{typeof t<"u"&&r({[e]:t})},[t])}const bO=({nodes:e,edges:t,defaultNodes:r,defaultEdges:i,onConnect:o,onConnectStart:a,onConnectEnd:u,onClickConnectStart:c,onClickConnectEnd:f,nodesDraggable:p,nodesConnectable:d,nodesFocusable:g,edgesFocusable:y,edgesUpdatable:w,elevateNodesOnSelect:E,minZoom:_,maxZoom:b,nodeExtent:k,onNodesChange:S,onEdgesChange:N,elementsSelectable:T,connectionMode:A,snapGrid:L,snapToGrid:P,translateExtent:U,connectOnClick:O,defaultEdgeOptions:M,fitView:q,fitViewOptions:V,onNodesDelete:Q,onEdgesDelete:j,onNodeDrag:G,onNodeDragStart:z,onNodeDragStop:te,onSelectionDrag:J,onSelectionDragStart:$,onSelectionDragStop:W,noPanClassName:I,nodeOrigin:Y,rfId:ue,autoPanOnConnect:F,autoPanOnNodeDrag:Z,onError:ne,connectionRadius:B,isValidConnection:de,nodeDragThreshold:pe})=>{const{setNodes:ye,setEdges:Pe,setDefaultNodesAndEdges:Ue,setMinZoom:De,setMaxZoom:Me,setTranslateExtent:_e,setNodeExtent:Fe,reset:we}=rt(_O,At),fe=Nt();return C.useEffect(()=>{const Ke=i==null?void 0:i.map(gt=>({...gt,...M}));return Ue(r,Ke),()=>{we()}},[]),Ve("defaultEdgeOptions",M,fe.setState),Ve("connectionMode",A,fe.setState),Ve("onConnect",o,fe.setState),Ve("onConnectStart",a,fe.setState),Ve("onConnectEnd",u,fe.setState),Ve("onClickConnectStart",c,fe.setState),Ve("onClickConnectEnd",f,fe.setState),Ve("nodesDraggable",p,fe.setState),Ve("nodesConnectable",d,fe.setState),Ve("nodesFocusable",g,fe.setState),Ve("edgesFocusable",y,fe.setState),Ve("edgesUpdatable",w,fe.setState),Ve("elementsSelectable",T,fe.setState),Ve("elevateNodesOnSelect",E,fe.setState),Ve("snapToGrid",P,fe.setState),Ve("snapGrid",L,fe.setState),Ve("onNodesChange",S,fe.setState),Ve("onEdgesChange",N,fe.setState),Ve("connectOnClick",O,fe.setState),Ve("fitViewOnInit",q,fe.setState),Ve("fitViewOnInitOptions",V,fe.setState),Ve("onNodesDelete",Q,fe.setState),Ve("onEdgesDelete",j,fe.setState),Ve("onNodeDrag",G,fe.setState),Ve("onNodeDragStart",z,fe.setState),Ve("onNodeDragStop",te,fe.setState),Ve("onSelectionDrag",J,fe.setState),Ve("onSelectionDragStart",$,fe.setState),Ve("onSelectionDragStop",W,fe.setState),Ve("noPanClassName",I,fe.setState),Ve("nodeOrigin",Y,fe.setState),Ve("rfId",ue,fe.setState),Ve("autoPanOnConnect",F,fe.setState),Ve("autoPanOnNodeDrag",Z,fe.setState),Ve("onError",ne,fe.setState),Ve("connectionRadius",B,fe.setState),Ve("isValidConnection",de,fe.setState),Ve("nodeDragThreshold",pe,fe.setState),io(e,ye),io(t,Pe),io(_,De),io(b,Me),io(U,_e),io(k,Fe),null},Xx={display:"none"},kO={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},$C="react-flow__node-desc",qC="react-flow__edge-desc",SO="react-flow__aria-live",EO=e=>e.ariaLiveMessage;function NO({rfId:e}){const t=rt(EO);return ae.createElement("div",{id:`${SO}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:kO},t)}function CO({rfId:e,disableKeyboardA11y:t}){return ae.createElement(ae.Fragment,null,ae.createElement("div",{id:`${$C}-${e}`,style:Xx},"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."," "),ae.createElement("div",{id:`${qC}-${e}`,style:Xx},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!t&&ae.createElement(NO,{rfId:e}))}var La=(e=null,t={actInsideInputWithModifier:!0})=>{const[r,i]=C.useState(!1),o=C.useRef(!1),a=C.useRef(new Set([])),[u,c]=C.useMemo(()=>{if(e!==null){const p=(Array.isArray(e)?e:[e]).filter(g=>typeof g=="string").map(g=>g.split("+")),d=p.reduce((g,y)=>g.concat(...y),[]);return[p,d]}return[[],[]]},[e]);return C.useEffect(()=>{const f=typeof document<"u"?document:null,p=(t==null?void 0:t.target)||f;if(e!==null){const d=w=>{if(o.current=w.ctrlKey||w.metaKey||w.shiftKey,(!o.current||o.current&&!t.actInsideInputWithModifier)&&Vv(w))return!1;const _=Zx(w.code,c);a.current.add(w[_]),Qx(u,a.current,!1)&&(w.preventDefault(),i(!0))},g=w=>{if((!o.current||o.current&&!t.actInsideInputWithModifier)&&Vv(w))return!1;const _=Zx(w.code,c);Qx(u,a.current,!0)?(i(!1),a.current.clear()):a.current.delete(w[_]),w.key==="Meta"&&a.current.clear(),o.current=!1},y=()=>{a.current.clear(),i(!1)};return p==null||p.addEventListener("keydown",d),p==null||p.addEventListener("keyup",g),window.addEventListener("blur",y),()=>{p==null||p.removeEventListener("keydown",d),p==null||p.removeEventListener("keyup",g),window.removeEventListener("blur",y)}}},[e,i]),r};function Qx(e,t,r){return e.filter(i=>r||i.length===t.size).some(i=>i.every(o=>t.has(o)))}function Zx(e,t){return t.includes(e)?"code":"key"}function DC(e,t,r,i){var c,f;const o=e.parentNode||e.parentId;if(!o)return r;const a=t.get(o),u=fi(a,i);return DC(a,t,{x:(r.x??0)+u.x,y:(r.y??0)+u.y,z:(((c=a[xt])==null?void 0:c.z)??0)>(r.z??0)?((f=a[xt])==null?void 0:f.z)??0:r.z??0},i)}function FC(e,t,r){e.forEach(i=>{var a;const o=i.parentNode||i.parentId;if(o&&!e.has(o))throw new Error(`Parent node ${o} not found`);if(o||r!=null&&r[i.id]){const{x:u,y:c,z:f}=DC(i,e,{...i.position,z:((a=i[xt])==null?void 0:a.z)??0},t);i.positionAbsolute={x:u,y:c},i[xt].z=f,r!=null&&r[i.id]&&(i[xt].isParent=!0)}})}function af(e,t,r,i){const o=new Map,a={},u=i?1e3:0;return e.forEach(c=>{var w;const f=($n(c.zIndex)?c.zIndex:0)+(c.selected?u:0),p=t.get(c.id),d={...c,positionAbsolute:{x:c.position.x,y:c.position.y}},g=c.parentNode||c.parentId;g&&(a[g]=!0);const y=(p==null?void 0:p.type)&&(p==null?void 0:p.type)!==c.type;Object.defineProperty(d,xt,{enumerable:!1,value:{handleBounds:y||(w=p==null?void 0:p[xt])==null?void 0:w.handleBounds,z:f}}),o.set(c.id,d)}),FC(o,r,a),o}function zC(e,t={}){const{getNodes:r,width:i,height:o,minZoom:a,maxZoom:u,d3Zoom:c,d3Selection:f,fitViewOnInitDone:p,fitViewOnInit:d,nodeOrigin:g}=e(),y=t.initial&&!p&&d;if(c&&f&&(y||!t.initial)){const E=r().filter(b=>{var S;const k=t.includeHiddenNodes?b.width&&b.height:!b.hidden;return(S=t.nodes)!=null&&S.length?k&&t.nodes.some(N=>N.id===b.id):k}),_=E.every(b=>b.width&&b.height);if(E.length>0&&_){const b=Zu(E,g),{x:k,y:S,zoom:N}=NC(b,i,o,t.minZoom??a,t.maxZoom??u,t.padding??.1),T=Br.translate(k,S).scale(N);return typeof t.duration=="number"&&t.duration>0?c.transform(li(f,t.duration),T):c.transform(f,T),!0}}return!1}function jO(e,t){return e.forEach(r=>{const i=t.get(r.id);i&&t.set(i.id,{...i,[xt]:i[xt],selected:r.selected})}),new Map(t)}function TO(e,t){return t.map(r=>{const i=e.find(o=>o.id===r.id);return i&&(r.selected=i.selected),r})}function hu({changedNodes:e,changedEdges:t,get:r,set:i}){const{nodeInternals:o,edges:a,onNodesChange:u,onEdgesChange:c,hasDefaultNodes:f,hasDefaultEdges:p}=r();e!=null&&e.length&&(f&&i({nodeInternals:jO(e,o)}),u==null||u(e)),t!=null&&t.length&&(p&&i({edges:TO(t,a)}),c==null||c(t))}const oo=()=>{},RO={zoomIn:oo,zoomOut:oo,zoomTo:oo,getZoom:()=>1,setViewport:oo,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:oo,fitBounds:oo,project:e=>e,screenToFlowPosition:e=>e,flowToScreenPosition:e=>e,viewportInitialized:!1},AO=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),IO=()=>{const e=Nt(),{d3Zoom:t,d3Selection:r}=rt(AO,At);return C.useMemo(()=>r&&t?{zoomIn:o=>t.scaleBy(li(r,o==null?void 0:o.duration),1.2),zoomOut:o=>t.scaleBy(li(r,o==null?void 0:o.duration),1/1.2),zoomTo:(o,a)=>t.scaleTo(li(r,a==null?void 0:a.duration),o),getZoom:()=>e.getState().transform[2],setViewport:(o,a)=>{const[u,c,f]=e.getState().transform,p=Br.translate(o.x??u,o.y??c).scale(o.zoom??f);t.transform(li(r,a==null?void 0:a.duration),p)},getViewport:()=>{const[o,a,u]=e.getState().transform;return{x:o,y:a,zoom:u}},fitView:o=>zC(e.getState,o),setCenter:(o,a,u)=>{const{width:c,height:f,maxZoom:p}=e.getState(),d=typeof(u==null?void 0:u.zoom)<"u"?u.zoom:p,g=c/2-o*d,y=f/2-a*d,w=Br.translate(g,y).scale(d);t.transform(li(r,u==null?void 0:u.duration),w)},fitBounds:(o,a)=>{const{width:u,height:c,minZoom:f,maxZoom:p}=e.getState(),{x:d,y:g,zoom:y}=NC(o,u,c,f,p,(a==null?void 0:a.padding)??.1),w=Br.translate(d,g).scale(y);t.transform(li(r,a==null?void 0:a.duration),w)},project:o=>{const{transform:a,snapToGrid:u,snapGrid:c}=e.getState();return console.warn("[DEPRECATED] `project` is deprecated. Instead use `screenToFlowPosition`. There is no need to subtract the react flow bounds anymore! https://reactflow.dev/api-reference/types/react-flow-instance#screen-to-flow-position"),Kv(o,a,u,c)},screenToFlowPosition:o=>{const{transform:a,snapToGrid:u,snapGrid:c,domNode:f}=e.getState();if(!f)return o;const{x:p,y:d}=f.getBoundingClientRect(),g={x:o.x-p,y:o.y-d};return Kv(g,a,u,c)},flowToScreenPosition:o=>{const{transform:a,domNode:u}=e.getState();if(!u)return o;const{x:c,y:f}=u.getBoundingClientRect(),p=kC(o,a);return{x:p.x+c,y:p.y+f}},viewportInitialized:!0}:RO,[t,r])};function Ha(){const e=IO(),t=Nt(),r=C.useCallback(()=>t.getState().getNodes().map(_=>({..._})),[]),i=C.useCallback(_=>t.getState().nodeInternals.get(_),[]),o=C.useCallback(()=>{const{edges:_=[]}=t.getState();return _.map(b=>({...b}))},[]),a=C.useCallback(_=>{const{edges:b=[]}=t.getState();return b.find(k=>k.id===_)},[]),u=C.useCallback(_=>{const{getNodes:b,setNodes:k,hasDefaultNodes:S,onNodesChange:N}=t.getState(),T=b(),A=typeof _=="function"?_(T):_;if(S)k(A);else if(N){const L=A.length===0?T.map(P=>({type:"remove",id:P.id})):A.map(P=>({item:P,type:"reset"}));N(L)}},[]),c=C.useCallback(_=>{const{edges:b=[],setEdges:k,hasDefaultEdges:S,onEdgesChange:N}=t.getState(),T=typeof _=="function"?_(b):_;if(S)k(T);else if(N){const A=T.length===0?b.map(L=>({type:"remove",id:L.id})):T.map(L=>({item:L,type:"reset"}));N(A)}},[]),f=C.useCallback(_=>{const b=Array.isArray(_)?_:[_],{getNodes:k,setNodes:S,hasDefaultNodes:N,onNodesChange:T}=t.getState();if(N){const L=[...k(),...b];S(L)}else if(T){const A=b.map(L=>({item:L,type:"add"}));T(A)}},[]),p=C.useCallback(_=>{const b=Array.isArray(_)?_:[_],{edges:k=[],setEdges:S,hasDefaultEdges:N,onEdgesChange:T}=t.getState();if(N)S([...k,...b]);else if(T){const A=b.map(L=>({item:L,type:"add"}));T(A)}},[]),d=C.useCallback(()=>{const{getNodes:_,edges:b=[],transform:k}=t.getState(),[S,N,T]=k;return{nodes:_().map(A=>({...A})),edges:b.map(A=>({...A})),viewport:{x:S,y:N,zoom:T}}},[]),g=C.useCallback(({nodes:_,edges:b})=>{const{nodeInternals:k,getNodes:S,edges:N,hasDefaultNodes:T,hasDefaultEdges:A,onNodesDelete:L,onEdgesDelete:P,onNodesChange:U,onEdgesChange:O}=t.getState(),M=(_||[]).map(G=>G.id),q=(b||[]).map(G=>G.id),V=S().reduce((G,z)=>{const te=z.parentNode||z.parentId,J=!M.includes(z.id)&&te&&G.find(W=>W.id===te);return(typeof z.deletable=="boolean"?z.deletable:!0)&&(M.includes(z.id)||J)&&G.push(z),G},[]),Q=N.filter(G=>typeof G.deletable=="boolean"?G.deletable:!0),j=Q.filter(G=>q.includes(G.id));if(V||j){const G=EC(V,Q),z=[...j,...G],te=z.reduce((J,$)=>(J.includes($.id)||J.push($.id),J),[]);if((A||T)&&(A&&t.setState({edges:N.filter(J=>!te.includes(J.id))}),T&&(V.forEach(J=>{k.delete(J.id)}),t.setState({nodeInternals:new Map(k)}))),te.length>0&&(P==null||P(z),O&&O(te.map(J=>({id:J,type:"remove"})))),V.length>0&&(L==null||L(V),U)){const J=V.map($=>({id:$.id,type:"remove"}));U(J)}}},[]),y=C.useCallback(_=>{const b=ZM(_),k=b?null:t.getState().nodeInternals.get(_.id);return!b&&!k?[null,null,b]:[b?_:Ux(k),k,b]},[]),w=C.useCallback((_,b=!0,k)=>{const[S,N,T]=y(_);return S?(k||t.getState().getNodes()).filter(A=>{if(!T&&(A.id===N.id||!A.positionAbsolute))return!1;const L=Ux(A),P=Wv(L,S);return b&&P>0||P>=S.width*S.height}):[]},[]),E=C.useCallback((_,b,k=!0)=>{const[S]=y(_);if(!S)return!1;const N=Wv(S,b);return k&&N>0||N>=S.width*S.height},[]);return C.useMemo(()=>({...e,getNodes:r,getNode:i,getEdges:o,getEdge:a,setNodes:u,setEdges:c,addNodes:f,addEdges:p,toObject:d,deleteElements:g,getIntersectingNodes:w,isNodeIntersecting:E}),[e,r,i,o,a,u,c,f,p,d,g,w,E])}const MO={actInsideInputWithModifier:!1};var OO=({deleteKeyCode:e,multiSelectionKeyCode:t})=>{const r=Nt(),{deleteElements:i}=Ha(),o=La(e,MO),a=La(t);C.useEffect(()=>{if(o){const{edges:u,getNodes:c}=r.getState(),f=c().filter(d=>d.selected),p=u.filter(d=>d.selected);i({nodes:f,edges:p}),r.setState({nodesSelectionActive:!1})}},[o]),C.useEffect(()=>{r.setState({multiSelectionActive:a})},[a])};function PO(e){const t=Nt();C.useEffect(()=>{let r;const i=()=>{var a,u;if(!e.current)return;const o=wy(e.current);(o.height===0||o.width===0)&&((u=(a=t.getState()).onError)==null||u.call(a,"004",Hr.error004())),t.setState({width:o.width||500,height:o.height||500})};return i(),window.addEventListener("resize",i),e.current&&(r=new ResizeObserver(()=>i()),r.observe(e.current)),()=>{window.removeEventListener("resize",i),r&&e.current&&r.unobserve(e.current)}},[])}const Cy={position:"absolute",width:"100%",height:"100%",top:0,left:0},LO=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,pu=e=>({x:e.x,y:e.y,zoom:e.k}),ao=(e,t)=>e.target.closest(`.${t}`),Jx=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),e_=e=>{const t=e.ctrlKey&&Lu()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t},$O=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),qO=({onMove:e,onMoveStart:t,onMoveEnd:r,onPaneContextMenu:i,zoomOnScroll:o=!0,zoomOnPinch:a=!0,panOnScroll:u=!1,panOnScrollSpeed:c=.5,panOnScrollMode:f=ci.Free,zoomOnDoubleClick:p=!0,elementsSelectable:d,panOnDrag:g=!0,defaultViewport:y,translateExtent:w,minZoom:E,maxZoom:_,zoomActivationKeyCode:b,preventScrolling:k=!0,children:S,noWheelClassName:N,noPanClassName:T})=>{const A=C.useRef(),L=Nt(),P=C.useRef(!1),U=C.useRef(!1),O=C.useRef(null),M=C.useRef({x:0,y:0,zoom:0}),{d3Zoom:q,d3Selection:V,d3ZoomHandler:Q,userSelectionActive:j}=rt($O,At),G=La(b),z=C.useRef(0),te=C.useRef(!1),J=C.useRef();return PO(O),C.useEffect(()=>{if(O.current){const $=O.current.getBoundingClientRect(),W=dC().scaleExtent([E,_]).translateExtent(w),I=Ln(O.current).call(W),Y=Br.translate(y.x,y.y).scale(bo(y.zoom,E,_)),ue=[[0,0],[$.width,$.height]],F=W.constrain()(Y,ue,w);W.transform(I,F),W.wheelDelta(e_),L.setState({d3Zoom:W,d3Selection:I,d3ZoomHandler:I.on("wheel.zoom"),transform:[F.x,F.y,F.k],domNode:O.current.closest(".react-flow")})}},[]),C.useEffect(()=>{V&&q&&(u&&!G&&!j?V.on("wheel.zoom",$=>{if(ao($,N))return!1;$.preventDefault(),$.stopImmediatePropagation();const W=V.property("__zoom").k||1;if($.ctrlKey&&a){const de=er($),pe=e_($),ye=W*Math.pow(2,pe);q.scaleTo(V,ye,de,$);return}const I=$.deltaMode===1?20:1;let Y=f===ci.Vertical?0:$.deltaX*I,ue=f===ci.Horizontal?0:$.deltaY*I;!Lu()&&$.shiftKey&&f!==ci.Vertical&&(Y=$.deltaY*I,ue=0),q.translateBy(V,-(Y/W)*c,-(ue/W)*c,{internal:!0});const F=pu(V.property("__zoom")),{onViewportChangeStart:Z,onViewportChange:ne,onViewportChangeEnd:B}=L.getState();clearTimeout(J.current),te.current||(te.current=!0,t==null||t($,F),Z==null||Z(F)),te.current&&(e==null||e($,F),ne==null||ne(F),J.current=setTimeout(()=>{r==null||r($,F),B==null||B(F),te.current=!1},150))},{passive:!1}):typeof Q<"u"&&V.on("wheel.zoom",function($,W){if(!k&&$.type==="wheel"&&!$.ctrlKey||ao($,N))return null;$.preventDefault(),Q.call(this,$,W)},{passive:!1}))},[j,u,f,V,q,Q,G,a,k,N,t,e,r]),C.useEffect(()=>{q&&q.on("start",$=>{var Y,ue;if(!$.sourceEvent||$.sourceEvent.internal)return null;z.current=(Y=$.sourceEvent)==null?void 0:Y.button;const{onViewportChangeStart:W}=L.getState(),I=pu($.transform);P.current=!0,M.current=I,((ue=$.sourceEvent)==null?void 0:ue.type)==="mousedown"&&L.setState({paneDragging:!0}),W==null||W(I),t==null||t($.sourceEvent,I)})},[q,t]),C.useEffect(()=>{q&&(j&&!P.current?q.on("zoom",null):j||q.on("zoom",$=>{var I;const{onViewportChange:W}=L.getState();if(L.setState({transform:[$.transform.x,$.transform.y,$.transform.k]}),U.current=!!(i&&Jx(g,z.current??0)),(e||W)&&!((I=$.sourceEvent)!=null&&I.internal)){const Y=pu($.transform);W==null||W(Y),e==null||e($.sourceEvent,Y)}}))},[j,q,e,g,i]),C.useEffect(()=>{q&&q.on("end",$=>{if(!$.sourceEvent||$.sourceEvent.internal)return null;const{onViewportChangeEnd:W}=L.getState();if(P.current=!1,L.setState({paneDragging:!1}),i&&Jx(g,z.current??0)&&!U.current&&i($.sourceEvent),U.current=!1,(r||W)&&LO(M.current,$.transform)){const I=pu($.transform);M.current=I,clearTimeout(A.current),A.current=setTimeout(()=>{W==null||W(I),r==null||r($.sourceEvent,I)},u?150:0)}})},[q,u,g,r,i]),C.useEffect(()=>{q&&q.filter($=>{const W=G||o,I=a&&$.ctrlKey;if((g===!0||Array.isArray(g)&&g.includes(1))&&$.button===1&&$.type==="mousedown"&&(ao($,"react-flow__node")||ao($,"react-flow__edge")))return!0;if(!g&&!W&&!u&&!p&&!a||j||!p&&$.type==="dblclick"||ao($,N)&&$.type==="wheel"||ao($,T)&&($.type!=="wheel"||u&&$.type==="wheel"&&!G)||!a&&$.ctrlKey&&$.type==="wheel"||!W&&!u&&!I&&$.type==="wheel"||!g&&($.type==="mousedown"||$.type==="touchstart")||Array.isArray(g)&&!g.includes($.button)&&$.type==="mousedown")return!1;const Y=Array.isArray(g)&&g.includes($.button)||!$.button||$.button<=1;return(!$.ctrlKey||$.type==="wheel")&&Y})},[j,q,o,a,u,p,g,d,G]),ae.createElement("div",{className:"react-flow__renderer",ref:O,style:Cy},S)},DO=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function FO(){const{userSelectionActive:e,userSelectionRect:t}=rt(DO,At);return e&&t?ae.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 t_(e,t){const r=t.parentNode||t.parentId,i=e.find(o=>o.id===r);if(i){const o=t.position.x+t.width-i.width,a=t.position.y+t.height-i.height;if(o>0||a>0||t.position.x<0||t.position.y<0){if(i.style={...i.style},i.style.width=i.style.width??i.width,i.style.height=i.style.height??i.height,o>0&&(i.style.width+=o),a>0&&(i.style.height+=a),t.position.x<0){const u=Math.abs(t.position.x);i.position.x=i.position.x-u,i.style.width+=u,t.position.x=0}if(t.position.y<0){const u=Math.abs(t.position.y);i.position.y=i.position.y-u,i.style.height+=u,t.position.y=0}i.width=i.style.width,i.height=i.style.height}}}function zO(e,t){if(e.some(i=>i.type==="reset"))return e.filter(i=>i.type==="reset").map(i=>i.item);const r=e.filter(i=>i.type==="add").map(i=>i.item);return t.reduce((i,o)=>{const a=e.filter(c=>c.id===o.id);if(a.length===0)return i.push(o),i;const u={...o};for(const c of a)if(c)switch(c.type){case"select":{u.selected=c.selected;break}case"position":{typeof c.position<"u"&&(u.position=c.position),typeof c.positionAbsolute<"u"&&(u.positionAbsolute=c.positionAbsolute),typeof c.dragging<"u"&&(u.dragging=c.dragging),u.expandParent&&t_(i,u);break}case"dimensions":{typeof c.dimensions<"u"&&(u.width=c.dimensions.width,u.height=c.dimensions.height),typeof c.updateStyle<"u"&&(u.style={...u.style||{},...c.dimensions}),typeof c.resizing=="boolean"&&(u.resizing=c.resizing),u.expandParent&&t_(i,u);break}case"remove":return i}return i.push(u),i},r)}function BO(e,t){return zO(e,t)}const _s=(e,t)=>({id:e,type:"select",selected:t});function ho(e,t){return e.reduce((r,i)=>{const o=t.includes(i.id);return!i.selected&&o?(i.selected=!0,r.push(_s(i.id,!0))):i.selected&&!o&&(i.selected=!1,r.push(_s(i.id,!1))),r},[])}const lf=(e,t)=>r=>{r.target===t.current&&(e==null||e(r))},UO=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),BC=C.memo(({isSelecting:e,selectionMode:t=Pa.Full,panOnDrag:r,onSelectionStart:i,onSelectionEnd:o,onPaneClick:a,onPaneContextMenu:u,onPaneScroll:c,onPaneMouseEnter:f,onPaneMouseMove:p,onPaneMouseLeave:d,children:g})=>{const y=C.useRef(null),w=Nt(),E=C.useRef(0),_=C.useRef(0),b=C.useRef(),{userSelectionActive:k,elementsSelectable:S,dragging:N}=rt(UO,At),T=()=>{w.setState({userSelectionActive:!1,userSelectionRect:null}),E.current=0,_.current=0},A=Q=>{a==null||a(Q),w.getState().resetSelectedElements(),w.setState({nodesSelectionActive:!1})},L=Q=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){Q.preventDefault();return}u==null||u(Q)},P=c?Q=>c(Q):void 0,U=Q=>{const{resetSelectedElements:j,domNode:G}=w.getState();if(b.current=G==null?void 0:G.getBoundingClientRect(),!S||!e||Q.button!==0||Q.target!==y.current||!b.current)return;const{x:z,y:te}=ks(Q,b.current);j(),w.setState({userSelectionRect:{width:0,height:0,startX:z,startY:te,x:z,y:te}}),i==null||i(Q)},O=Q=>{const{userSelectionRect:j,nodeInternals:G,edges:z,transform:te,onNodesChange:J,onEdgesChange:$,nodeOrigin:W,getNodes:I}=w.getState();if(!e||!b.current||!j)return;w.setState({userSelectionActive:!0,nodesSelectionActive:!1});const Y=ks(Q,b.current),ue=j.startX??0,F=j.startY??0,Z={...j,x:Y.x<ue?Y.x:ue,y:Y.y<F?Y.y:F,width:Math.abs(Y.x-ue),height:Math.abs(Y.y-F)},ne=I(),B=SC(G,Z,te,t===Pa.Partial,!0,W),de=EC(B,z).map(ye=>ye.id),pe=B.map(ye=>ye.id);if(E.current!==pe.length){E.current=pe.length;const ye=ho(ne,pe);ye.length&&(J==null||J(ye))}if(_.current!==de.length){_.current=de.length;const ye=ho(z,de);ye.length&&($==null||$(ye))}w.setState({userSelectionRect:Z})},M=Q=>{if(Q.button!==0)return;const{userSelectionRect:j}=w.getState();!k&&j&&Q.target===y.current&&(A==null||A(Q)),w.setState({nodesSelectionActive:E.current>0}),T(),o==null||o(Q)},q=Q=>{k&&(w.setState({nodesSelectionActive:E.current>0}),o==null||o(Q)),T()},V=S&&(e||k);return ae.createElement("div",{className:Dt(["react-flow__pane",{dragging:N,selection:e}]),onClick:V?void 0:lf(A,y),onContextMenu:lf(L,y),onWheel:lf(P,y),onMouseEnter:V?void 0:f,onMouseDown:V?U:void 0,onMouseMove:V?O:p,onMouseUp:V?M:void 0,onMouseLeave:V?q:d,ref:y,style:Cy},g,ae.createElement(FO,null))});BC.displayName="Pane";function UC(e,t){const r=e.parentNode||e.parentId;if(!r)return!1;const i=t.get(r);return i?i.selected?!0:UC(i,t):!1}function n_(e,t,r){let i=e;do{if(i!=null&&i.matches(t))return!0;if(i===r.current)return!1;i=i.parentElement}while(i);return!1}function HO(e,t,r,i){return Array.from(e.values()).filter(o=>(o.selected||o.id===i)&&(!o.parentNode||o.parentId||!UC(o,e))&&(o.draggable||t&&typeof o.draggable>"u")).map(o=>{var a,u;return{id:o.id,position:o.position||{x:0,y:0},positionAbsolute:o.positionAbsolute||{x:0,y:0},distance:{x:r.x-(((a=o.positionAbsolute)==null?void 0:a.x)??0),y:r.y-(((u=o.positionAbsolute)==null?void 0:u.y)??0)},delta:{x:0,y:0},extent:o.extent,parentNode:o.parentNode||o.parentId,parentId:o.parentNode||o.parentId,width:o.width,height:o.height,expandParent:o.expandParent}})}function WO(e,t){return!t||t==="parent"?t:[t[0],[t[1][0]-(e.width||0),t[1][1]-(e.height||0)]]}function HC(e,t,r,i,o=[0,0],a){const u=WO(e,e.extent||i);let c=u;const f=e.parentNode||e.parentId;if(e.extent==="parent"&&!e.expandParent)if(f&&e.width&&e.height){const g=r.get(f),{x:y,y:w}=fi(g,o).positionAbsolute;c=g&&$n(y)&&$n(w)&&$n(g.width)&&$n(g.height)?[[y+e.width*o[0],w+e.height*o[1]],[y+g.width-e.width+e.width*o[0],w+g.height-e.height+e.height*o[1]]]:c}else a==null||a("005",Hr.error005()),c=u;else if(e.extent&&f&&e.extent!=="parent"){const g=r.get(f),{x:y,y:w}=fi(g,o).positionAbsolute;c=[[e.extent[0][0]+y,e.extent[0][1]+w],[e.extent[1][0]+y,e.extent[1][1]+w]]}let p={x:0,y:0};if(f){const g=r.get(f);p=fi(g,o).positionAbsolute}const d=c&&c!=="parent"?xy(t,c):t;return{position:{x:d.x-p.x,y:d.y-p.y},positionAbsolute:d}}function uf({nodeId:e,dragItems:t,nodeInternals:r}){const i=t.map(o=>({...r.get(o.id),position:o.position,positionAbsolute:o.positionAbsolute}));return[e?i.find(o=>o.id===e):i[0],i]}const r_=(e,t,r,i)=>{const o=t.querySelectorAll(e);if(!o||!o.length)return null;const a=Array.from(o),u=t.getBoundingClientRect(),c={x:u.width*i[0],y:u.height*i[1]};return a.map(f=>{const p=f.getBoundingClientRect();return{id:f.getAttribute("data-handleid"),position:f.getAttribute("data-handlepos"),x:(p.left-u.left-c.x)/r,y:(p.top-u.top-c.y)/r,...wy(f)}})};function wa(e,t,r){return r===void 0?r:i=>{const o=t().nodeInternals.get(e);o&&r(i,{...o})}}function Qv({id:e,store:t,unselect:r=!1,nodeRef:i}){const{addSelectedNodes:o,unselectNodesAndEdges:a,multiSelectionActive:u,nodeInternals:c,onError:f}=t.getState(),p=c.get(e);if(!p){f==null||f("012",Hr.error012(e));return}t.setState({nodesSelectionActive:!1}),p.selected?(r||p.selected&&u)&&(a({nodes:[p],edges:[]}),requestAnimationFrame(()=>{var d;return(d=i==null?void 0:i.current)==null?void 0:d.blur()})):o([e])}function VO(){const e=Nt();return C.useCallback(({sourceEvent:r})=>{const{transform:i,snapGrid:o,snapToGrid:a}=e.getState(),u=r.touches?r.touches[0].clientX:r.clientX,c=r.touches?r.touches[0].clientY:r.clientY,f={x:(u-i[0])/i[2],y:(c-i[1])/i[2]};return{xSnapped:a?o[0]*Math.round(f.x/o[0]):f.x,ySnapped:a?o[1]*Math.round(f.y/o[1]):f.y,...f}},[])}function cf(e){return(t,r,i)=>e==null?void 0:e(t,i)}function WC({nodeRef:e,disabled:t=!1,noDragClassName:r,handleSelector:i,nodeId:o,isSelectable:a,selectNodesOnDrag:u}){const c=Nt(),[f,p]=C.useState(!1),d=C.useRef([]),g=C.useRef({x:null,y:null}),y=C.useRef(0),w=C.useRef(null),E=C.useRef({x:0,y:0}),_=C.useRef(null),b=C.useRef(!1),k=C.useRef(!1),S=C.useRef(!1),N=VO();return C.useEffect(()=>{if(e!=null&&e.current){const T=Ln(e.current),A=({x:U,y:O})=>{const{nodeInternals:M,onNodeDrag:q,onSelectionDrag:V,updateNodePositions:Q,nodeExtent:j,snapGrid:G,snapToGrid:z,nodeOrigin:te,onError:J}=c.getState();g.current={x:U,y:O};let $=!1,W={x:0,y:0,x2:0,y2:0};if(d.current.length>1&&j){const Y=Zu(d.current,te);W=Oa(Y)}if(d.current=d.current.map(Y=>{const ue={x:U-Y.distance.x,y:O-Y.distance.y};z&&(ue.x=G[0]*Math.round(ue.x/G[0]),ue.y=G[1]*Math.round(ue.y/G[1]));const F=[[j[0][0],j[0][1]],[j[1][0],j[1][1]]];d.current.length>1&&j&&!Y.extent&&(F[0][0]=Y.positionAbsolute.x-W.x+j[0][0],F[1][0]=Y.positionAbsolute.x+(Y.width??0)-W.x2+j[1][0],F[0][1]=Y.positionAbsolute.y-W.y+j[0][1],F[1][1]=Y.positionAbsolute.y+(Y.height??0)-W.y2+j[1][1]);const Z=HC(Y,ue,M,F,te,J);return $=$||Y.position.x!==Z.position.x||Y.position.y!==Z.position.y,Y.position=Z.position,Y.positionAbsolute=Z.positionAbsolute,Y}),!$)return;Q(d.current,!0,!0),p(!0);const I=o?q:cf(V);if(I&&_.current){const[Y,ue]=uf({nodeId:o,dragItems:d.current,nodeInternals:M});I(_.current,Y,ue)}},L=()=>{if(!w.current)return;const[U,O]=hC(E.current,w.current);if(U!==0||O!==0){const{transform:M,panBy:q}=c.getState();g.current.x=(g.current.x??0)-U/M[2],g.current.y=(g.current.y??0)-O/M[2],q({x:U,y:O})&&A(g.current)}y.current=requestAnimationFrame(L)},P=U=>{var te;const{nodeInternals:O,multiSelectionActive:M,nodesDraggable:q,unselectNodesAndEdges:V,onNodeDragStart:Q,onSelectionDragStart:j}=c.getState();k.current=!0;const G=o?Q:cf(j);(!u||!a)&&!M&&o&&((te=O.get(o))!=null&&te.selected||V()),o&&a&&u&&Qv({id:o,store:c,nodeRef:e});const z=N(U);if(g.current=z,d.current=HO(O,q,z,o),G&&d.current){const[J,$]=uf({nodeId:o,dragItems:d.current,nodeInternals:O});G(U.sourceEvent,J,$)}};if(t)T.on(".drag",null);else{const U=tI().on("start",O=>{const{domNode:M,nodeDragThreshold:q}=c.getState();q===0&&P(O),S.current=!1;const V=N(O);g.current=V,w.current=(M==null?void 0:M.getBoundingClientRect())||null,E.current=ks(O.sourceEvent,w.current)}).on("drag",O=>{var Q,j;const M=N(O),{autoPanOnNodeDrag:q,nodeDragThreshold:V}=c.getState();if(O.sourceEvent.type==="touchmove"&&O.sourceEvent.touches.length>1&&(S.current=!0),!S.current){if(!b.current&&k.current&&q&&(b.current=!0,L()),!k.current){const G=M.xSnapped-(((Q=g==null?void 0:g.current)==null?void 0:Q.x)??0),z=M.ySnapped-(((j=g==null?void 0:g.current)==null?void 0:j.y)??0);Math.sqrt(G*G+z*z)>V&&P(O)}(g.current.x!==M.xSnapped||g.current.y!==M.ySnapped)&&d.current&&k.current&&(_.current=O.sourceEvent,E.current=ks(O.sourceEvent,w.current),A(M))}}).on("end",O=>{if(!(!k.current||S.current)&&(p(!1),b.current=!1,k.current=!1,cancelAnimationFrame(y.current),d.current)){const{updateNodePositions:M,nodeInternals:q,onNodeDragStop:V,onSelectionDragStop:Q}=c.getState(),j=o?V:cf(Q);if(M(d.current,!1,!1),j){const[G,z]=uf({nodeId:o,dragItems:d.current,nodeInternals:q});j(O.sourceEvent,G,z)}}}).filter(O=>{const M=O.target;return!O.button&&(!r||!n_(M,`.${r}`,e))&&(!i||n_(M,i,e))});return T.call(U),()=>{T.on(".drag",null)}}}},[e,t,r,i,a,c,o,u,N]),f}function VC(){const e=Nt();return C.useCallback(r=>{const{nodeInternals:i,nodeExtent:o,updateNodePositions:a,getNodes:u,snapToGrid:c,snapGrid:f,onError:p,nodesDraggable:d}=e.getState(),g=u().filter(S=>S.selected&&(S.draggable||d&&typeof S.draggable>"u")),y=c?f[0]:5,w=c?f[1]:5,E=r.isShiftPressed?4:1,_=r.x*y*E,b=r.y*w*E,k=g.map(S=>{if(S.positionAbsolute){const N={x:S.positionAbsolute.x+_,y:S.positionAbsolute.y+b};c&&(N.x=f[0]*Math.round(N.x/f[0]),N.y=f[1]*Math.round(N.y/f[1]));const{positionAbsolute:T,position:A}=HC(S,N,i,o,void 0,p);S.position=A,S.positionAbsolute=T}return S});a(k,!0,!1)},[])}const vo={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var xa=e=>{const t=({id:r,type:i,data:o,xPos:a,yPos:u,xPosOrigin:c,yPosOrigin:f,selected:p,onClick:d,onMouseEnter:g,onMouseMove:y,onMouseLeave:w,onContextMenu:E,onDoubleClick:_,style:b,className:k,isDraggable:S,isSelectable:N,isConnectable:T,isFocusable:A,selectNodesOnDrag:L,sourcePosition:P,targetPosition:U,hidden:O,resizeObserver:M,dragHandle:q,zIndex:V,isParent:Q,noDragClassName:j,noPanClassName:G,initialized:z,disableKeyboardA11y:te,ariaLabel:J,rfId:$,hasHandleBounds:W})=>{const I=Nt(),Y=C.useRef(null),ue=C.useRef(null),F=C.useRef(P),Z=C.useRef(U),ne=C.useRef(i),B=N||S||d||g||y||w,de=VC(),pe=wa(r,I.getState,g),ye=wa(r,I.getState,y),Pe=wa(r,I.getState,w),Ue=wa(r,I.getState,E),De=wa(r,I.getState,_),Me=we=>{const{nodeDragThreshold:fe}=I.getState();if(N&&(!L||!S||fe>0)&&Qv({id:r,store:I,nodeRef:Y}),d){const Ke=I.getState().nodeInternals.get(r);Ke&&d(we,{...Ke})}},_e=we=>{if(!Vv(we)&&!te)if(vC.includes(we.key)&&N){const fe=we.key==="Escape";Qv({id:r,store:I,unselect:fe,nodeRef:Y})}else S&&p&&Object.prototype.hasOwnProperty.call(vo,we.key)&&(I.setState({ariaLiveMessage:`Moved selected node ${we.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~a}, y: ${~~u}`}),de({x:vo[we.key].x,y:vo[we.key].y,isShiftPressed:we.shiftKey}))};C.useEffect(()=>()=>{ue.current&&(M==null||M.unobserve(ue.current),ue.current=null)},[]),C.useEffect(()=>{if(Y.current&&!O){const we=Y.current;(!z||!W||ue.current!==we)&&(ue.current&&(M==null||M.unobserve(ue.current)),M==null||M.observe(we),ue.current=we)}},[O,z,W]),C.useEffect(()=>{const we=ne.current!==i,fe=F.current!==P,Ke=Z.current!==U;Y.current&&(we||fe||Ke)&&(we&&(ne.current=i),fe&&(F.current=P),Ke&&(Z.current=U),I.getState().updateNodeDimensions([{id:r,nodeElement:Y.current,forceUpdate:!0}]))},[r,i,P,U]);const Fe=WC({nodeRef:Y,disabled:O||!S,noDragClassName:j,handleSelector:q,nodeId:r,isSelectable:N,selectNodesOnDrag:L});return O?null:ae.createElement("div",{className:Dt(["react-flow__node",`react-flow__node-${i}`,{[G]:S},k,{selected:p,selectable:N,parent:Q,dragging:Fe}]),ref:Y,style:{zIndex:V,transform:`translate(${c}px,${f}px)`,pointerEvents:B?"all":"none",visibility:z?"visible":"hidden",...b},"data-id":r,"data-testid":`rf__node-${r}`,onMouseEnter:pe,onMouseMove:ye,onMouseLeave:Pe,onContextMenu:Ue,onClick:Me,onDoubleClick:De,onKeyDown:A?_e:void 0,tabIndex:A?0:void 0,role:A?"button":void 0,"aria-describedby":te?void 0:`${$C}-${$}`,"aria-label":J},ae.createElement(iO,{value:r},ae.createElement(e,{id:r,data:o,type:i,xPos:a,yPos:u,selected:p,isConnectable:T,sourcePosition:P,targetPosition:U,dragging:Fe,dragHandle:q,zIndex:V})))};return t.displayName="NodeWrapper",C.memo(t)};const GO=e=>{const t=e.getNodes().filter(r=>r.selected);return{...Zu(t,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};function YO({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:r}){const i=Nt(),{width:o,height:a,x:u,y:c,transformString:f,userSelectionActive:p}=rt(GO,At),d=VC(),g=C.useRef(null);if(C.useEffect(()=>{var E;r||(E=g.current)==null||E.focus({preventScroll:!0})},[r]),WC({nodeRef:g}),p||!o||!a)return null;const y=e?E=>{const _=i.getState().getNodes().filter(b=>b.selected);e(E,_)}:void 0,w=E=>{Object.prototype.hasOwnProperty.call(vo,E.key)&&d({x:vo[E.key].x,y:vo[E.key].y,isShiftPressed:E.shiftKey})};return ae.createElement("div",{className:Dt(["react-flow__nodesselection","react-flow__container",t]),style:{transform:f}},ae.createElement("div",{ref:g,className:"react-flow__nodesselection-rect",onContextMenu:y,tabIndex:r?void 0:-1,onKeyDown:r?void 0:w,style:{width:o,height:a,top:c,left:u}}))}var KO=C.memo(YO);const XO=e=>e.nodesSelectionActive,GC=({children:e,onPaneClick:t,onPaneMouseEnter:r,onPaneMouseMove:i,onPaneMouseLeave:o,onPaneContextMenu:a,onPaneScroll:u,deleteKeyCode:c,onMove:f,onMoveStart:p,onMoveEnd:d,selectionKeyCode:g,selectionOnDrag:y,selectionMode:w,onSelectionStart:E,onSelectionEnd:_,multiSelectionKeyCode:b,panActivationKeyCode:k,zoomActivationKeyCode:S,elementsSelectable:N,zoomOnScroll:T,zoomOnPinch:A,panOnScroll:L,panOnScrollSpeed:P,panOnScrollMode:U,zoomOnDoubleClick:O,panOnDrag:M,defaultViewport:q,translateExtent:V,minZoom:Q,maxZoom:j,preventScrolling:G,onSelectionContextMenu:z,noWheelClassName:te,noPanClassName:J,disableKeyboardA11y:$})=>{const W=rt(XO),I=La(g),Y=La(k),ue=Y||M,F=Y||L,Z=I||y&&ue!==!0;return OO({deleteKeyCode:c,multiSelectionKeyCode:b}),ae.createElement(qO,{onMove:f,onMoveStart:p,onMoveEnd:d,onPaneContextMenu:a,elementsSelectable:N,zoomOnScroll:T,zoomOnPinch:A,panOnScroll:F,panOnScrollSpeed:P,panOnScrollMode:U,zoomOnDoubleClick:O,panOnDrag:!I&&ue,defaultViewport:q,translateExtent:V,minZoom:Q,maxZoom:j,zoomActivationKeyCode:S,preventScrolling:G,noWheelClassName:te,noPanClassName:J},ae.createElement(BC,{onSelectionStart:E,onSelectionEnd:_,onPaneClick:t,onPaneMouseEnter:r,onPaneMouseMove:i,onPaneMouseLeave:o,onPaneContextMenu:a,onPaneScroll:u,panOnDrag:ue,isSelecting:!!Z,selectionMode:w},e,W&&ae.createElement(KO,{onSelectionContextMenu:z,noPanClassName:J,disableKeyboardA11y:$})))};GC.displayName="FlowRenderer";var QO=C.memo(GC);function ZO(e){return rt(C.useCallback(r=>e?SC(r.nodeInternals,{x:0,y:0,width:r.width,height:r.height},r.transform,!0):r.getNodes(),[e]))}function JO(e){const t={input:xa(e.input||MC),default:xa(e.default||Xv),output:xa(e.output||PC),group:xa(e.group||Ny)},r={},i=Object.keys(e).filter(o=>!["input","default","output","group"].includes(o)).reduce((o,a)=>(o[a]=xa(e[a]||Xv),o),r);return{...t,...i}}const eP=({x:e,y:t,width:r,height:i,origin:o})=>!r||!i?{x:e,y:t}:o[0]<0||o[1]<0||o[0]>1||o[1]>1?{x:e,y:t}:{x:e-r*o[0],y:t-i*o[1]},tP=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),YC=e=>{const{nodesDraggable:t,nodesConnectable:r,nodesFocusable:i,elementsSelectable:o,updateNodeDimensions:a,onError:u}=rt(tP,At),c=ZO(e.onlyRenderVisibleElements),f=C.useRef(),p=C.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const d=new ResizeObserver(g=>{const y=g.map(w=>({id:w.target.getAttribute("data-id"),nodeElement:w.target,forceUpdate:!0}));a(y)});return f.current=d,d},[]);return C.useEffect(()=>()=>{var d;(d=f==null?void 0:f.current)==null||d.disconnect()},[]),ae.createElement("div",{className:"react-flow__nodes",style:Cy},c.map(d=>{var A,L,P;let g=d.type||"default";e.nodeTypes[g]||(u==null||u("003",Hr.error003(g)),g="default");const y=e.nodeTypes[g]||e.nodeTypes.default,w=!!(d.draggable||t&&typeof d.draggable>"u"),E=!!(d.selectable||o&&typeof d.selectable>"u"),_=!!(d.connectable||r&&typeof d.connectable>"u"),b=!!(d.focusable||i&&typeof d.focusable>"u"),k=e.nodeExtent?xy(d.positionAbsolute,e.nodeExtent):d.positionAbsolute,S=(k==null?void 0:k.x)??0,N=(k==null?void 0:k.y)??0,T=eP({x:S,y:N,width:d.width??0,height:d.height??0,origin:e.nodeOrigin});return ae.createElement(y,{key:d.id,id:d.id,className:d.className,style:d.style,type:g,data:d.data,sourcePosition:d.sourcePosition||Re.Bottom,targetPosition:d.targetPosition||Re.Top,hidden:d.hidden,xPos:S,yPos:N,xPosOrigin:T.x,yPosOrigin:T.y,selectNodesOnDrag:e.selectNodesOnDrag,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,selected:!!d.selected,isDraggable:w,isSelectable:E,isConnectable:_,isFocusable:b,resizeObserver:p,dragHandle:d.dragHandle,zIndex:((A=d[xt])==null?void 0:A.z)??0,isParent:!!((L=d[xt])!=null&&L.isParent),noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!d.width&&!!d.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:d.ariaLabel,hasHandleBounds:!!((P=d[xt])!=null&&P.handleBounds)})}))};YC.displayName="NodeRenderer";var nP=C.memo(YC);const rP=(e,t,r)=>r===Re.Left?e-t:r===Re.Right?e+t:e,sP=(e,t,r)=>r===Re.Top?e-t:r===Re.Bottom?e+t:e,s_="react-flow__edgeupdater",i_=({position:e,centerX:t,centerY:r,radius:i=10,onMouseDown:o,onMouseEnter:a,onMouseOut:u,type:c})=>ae.createElement("circle",{onMouseDown:o,onMouseEnter:a,onMouseOut:u,className:Dt([s_,`${s_}-${c}`]),cx:rP(t,i,e),cy:sP(r,i,e),r:i,stroke:"transparent",fill:"transparent"}),iP=()=>!0;var lo=e=>{const t=({id:r,className:i,type:o,data:a,onClick:u,onEdgeDoubleClick:c,selected:f,animated:p,label:d,labelStyle:g,labelShowBg:y,labelBgStyle:w,labelBgPadding:E,labelBgBorderRadius:_,style:b,source:k,target:S,sourceX:N,sourceY:T,targetX:A,targetY:L,sourcePosition:P,targetPosition:U,elementsSelectable:O,hidden:M,sourceHandleId:q,targetHandleId:V,onContextMenu:Q,onMouseEnter:j,onMouseMove:G,onMouseLeave:z,reconnectRadius:te,onReconnect:J,onReconnectStart:$,onReconnectEnd:W,markerEnd:I,markerStart:Y,rfId:ue,ariaLabel:F,isFocusable:Z,isReconnectable:ne,pathOptions:B,interactionWidth:de,disableKeyboardA11y:pe})=>{const ye=C.useRef(null),[Pe,Ue]=C.useState(!1),[De,Me]=C.useState(!1),_e=Nt(),Fe=C.useMemo(()=>`url('#${Yv(Y,ue)}')`,[Y,ue]),we=C.useMemo(()=>`url('#${Yv(I,ue)}')`,[I,ue]);if(M)return null;const fe=ze=>{var at;const{edges:He,addSelectedEdges:Je,unselectNodesAndEdges:ke,multiSelectionActive:bt}=_e.getState(),nt=He.find(yn=>yn.id===r);nt&&(O&&(_e.setState({nodesSelectionActive:!1}),nt.selected&&bt?(ke({nodes:[],edges:[nt]}),(at=ye.current)==null||at.blur()):Je([r])),u&&u(ze,nt))},Ke=ya(r,_e.getState,c),gt=ya(r,_e.getState,Q),tt=ya(r,_e.getState,j),ot=ya(r,_e.getState,G),Be=ya(r,_e.getState,z),Ze=(ze,He)=>{if(ze.button!==0)return;const{edges:Je,isValidConnection:ke}=_e.getState(),bt=He?S:k,nt=(He?V:q)||null,at=He?"target":"source",yn=ke||iP,or=He,un=Je.find(cn=>cn.id===r);Me(!0),$==null||$(ze,un,at);const wn=cn=>{Me(!1),W==null||W(cn,un,at)};TC({event:ze,handleId:nt,nodeId:bt,onConnect:cn=>J==null?void 0:J(un,cn),isTarget:or,getState:_e.getState,setState:_e.setState,isValidConnection:yn,edgeUpdaterType:at,onReconnectEnd:wn})},ut=ze=>Ze(ze,!0),_t=ze=>Ze(ze,!1),ie=()=>Ue(!0),qe=()=>Ue(!1),Oe=!O&&!u,Te=ze=>{var He;if(!pe&&vC.includes(ze.key)&&O){const{unselectNodesAndEdges:Je,addSelectedEdges:ke,edges:bt}=_e.getState();ze.key==="Escape"?((He=ye.current)==null||He.blur(),Je({edges:[bt.find(at=>at.id===r)]})):ke([r])}};return ae.createElement("g",{className:Dt(["react-flow__edge",`react-flow__edge-${o}`,i,{selected:f,animated:p,inactive:Oe,updating:Pe}]),onClick:fe,onDoubleClick:Ke,onContextMenu:gt,onMouseEnter:tt,onMouseMove:ot,onMouseLeave:Be,onKeyDown:Z?Te:void 0,tabIndex:Z?0:void 0,role:Z?"button":"img","data-testid":`rf__edge-${r}`,"aria-label":F===null?void 0:F||`Edge from ${k} to ${S}`,"aria-describedby":Z?`${qC}-${ue}`:void 0,ref:ye},!De&&ae.createElement(e,{id:r,source:k,target:S,selected:f,animated:p,label:d,labelStyle:g,labelShowBg:y,labelBgStyle:w,labelBgPadding:E,labelBgBorderRadius:_,data:a,style:b,sourceX:N,sourceY:T,targetX:A,targetY:L,sourcePosition:P,targetPosition:U,sourceHandleId:q,targetHandleId:V,markerStart:Fe,markerEnd:we,pathOptions:B,interactionWidth:de}),ne&&ae.createElement(ae.Fragment,null,(ne==="source"||ne===!0)&&ae.createElement(i_,{position:P,centerX:N,centerY:T,radius:te,onMouseDown:ut,onMouseEnter:ie,onMouseOut:qe,type:"source"}),(ne==="target"||ne===!0)&&ae.createElement(i_,{position:U,centerX:A,centerY:L,radius:te,onMouseDown:_t,onMouseEnter:ie,onMouseOut:qe,type:"target"})))};return t.displayName="EdgeWrapper",C.memo(t)};function oP(e){const t={default:lo(e.default||qu),straight:lo(e.bezier||ky),step:lo(e.step||by),smoothstep:lo(e.step||Qu),simplebezier:lo(e.simplebezier||_y)},r={},i=Object.keys(e).filter(o=>!["default","bezier"].includes(o)).reduce((o,a)=>(o[a]=lo(e[a]||qu),o),r);return{...t,...i}}function o_(e,t,r=null){const i=((r==null?void 0:r.x)||0)+t.x,o=((r==null?void 0:r.y)||0)+t.y,a=(r==null?void 0:r.width)||t.width,u=(r==null?void 0:r.height)||t.height;switch(e){case Re.Top:return{x:i+a/2,y:o};case Re.Right:return{x:i+a,y:o+u/2};case Re.Bottom:return{x:i+a/2,y:o+u};case Re.Left:return{x:i,y:o+u/2}}}function a_(e,t){return e?e.length===1||!t?e[0]:t&&e.find(r=>r.id===t)||null:null}const aP=(e,t,r,i,o,a)=>{const u=o_(r,e,t),c=o_(a,i,o);return{sourceX:u.x,sourceY:u.y,targetX:c.x,targetY:c.y}};function lP({sourcePos:e,targetPos:t,sourceWidth:r,sourceHeight:i,targetWidth:o,targetHeight:a,width:u,height:c,transform:f}){const p={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+r,t.x+o),y2:Math.max(e.y+i,t.y+a)};p.x===p.x2&&(p.x2+=1),p.y===p.y2&&(p.y2+=1);const d=Oa({x:(0-f[0])/f[2],y:(0-f[1])/f[2],width:u/f[2],height:c/f[2]}),g=Math.max(0,Math.min(d.x2,p.x2)-Math.max(d.x,p.x)),y=Math.max(0,Math.min(d.y2,p.y2)-Math.max(d.y,p.y));return Math.ceil(g*y)>0}function l_(e){var i,o,a,u,c;const t=((i=e==null?void 0:e[xt])==null?void 0:i.handleBounds)||null,r=t&&(e==null?void 0:e.width)&&(e==null?void 0:e.height)&&typeof((o=e==null?void 0:e.positionAbsolute)==null?void 0:o.x)<"u"&&typeof((a=e==null?void 0:e.positionAbsolute)==null?void 0:a.y)<"u";return[{x:((u=e==null?void 0:e.positionAbsolute)==null?void 0:u.x)||0,y:((c=e==null?void 0:e.positionAbsolute)==null?void 0:c.y)||0,width:(e==null?void 0:e.width)||0,height:(e==null?void 0:e.height)||0},t,!!r]}const uP=[{level:0,isMaxLevel:!0,edges:[]}];function cP(e,t,r=!1){let i=-1;const o=e.reduce((u,c)=>{var d,g;const f=$n(c.zIndex);let p=f?c.zIndex:0;if(r){const y=t.get(c.target),w=t.get(c.source),E=c.selected||(y==null?void 0:y.selected)||(w==null?void 0:w.selected),_=Math.max(((d=w==null?void 0:w[xt])==null?void 0:d.z)||0,((g=y==null?void 0:y[xt])==null?void 0:g.z)||0,1e3);p=(f?c.zIndex:0)+(E?_:0)}return u[p]?u[p].push(c):u[p]=[c],i=p>i?p:i,u},{}),a=Object.entries(o).map(([u,c])=>{const f=+u;return{edges:c,level:f,isMaxLevel:f===i}});return a.length===0?uP:a}function dP(e,t,r){const i=rt(C.useCallback(o=>e?o.edges.filter(a=>{const u=t.get(a.source),c=t.get(a.target);return(u==null?void 0:u.width)&&(u==null?void 0:u.height)&&(c==null?void 0:c.width)&&(c==null?void 0:c.height)&&lP({sourcePos:u.positionAbsolute||{x:0,y:0},targetPos:c.positionAbsolute||{x:0,y:0},sourceWidth:u.width,sourceHeight:u.height,targetWidth:c.width,targetHeight:c.height,width:o.width,height:o.height,transform:o.transform})}):o.edges,[e,t]));return cP(i,t,r)}const fP=({color:e="none",strokeWidth:t=1})=>ae.createElement("polyline",{style:{stroke:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),hP=({color:e="none",strokeWidth:t=1})=>ae.createElement("polyline",{style:{stroke:e,fill:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),u_={[$u.Arrow]:fP,[$u.ArrowClosed]:hP};function pP(e){const t=Nt();return C.useMemo(()=>{var o,a;return Object.prototype.hasOwnProperty.call(u_,e)?u_[e]:((a=(o=t.getState()).onError)==null||a.call(o,"009",Hr.error009(e)),null)},[e])}const mP=({id:e,type:t,color:r,width:i=12.5,height:o=12.5,markerUnits:a="strokeWidth",strokeWidth:u,orient:c="auto-start-reverse"})=>{const f=pP(t);return f?ae.createElement("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${i}`,markerHeight:`${o}`,viewBox:"-10 -10 20 20",markerUnits:a,orient:c,refX:"0",refY:"0"},ae.createElement(f,{color:r,strokeWidth:u})):null},gP=({defaultColor:e,rfId:t})=>r=>{const i=[];return r.edges.reduce((o,a)=>([a.markerStart,a.markerEnd].forEach(u=>{if(u&&typeof u=="object"){const c=Yv(u,t);i.includes(c)||(o.push({id:c,color:u.color||e,...u}),i.push(c))}}),o),[]).sort((o,a)=>o.id.localeCompare(a.id))},KC=({defaultColor:e,rfId:t})=>{const r=rt(C.useCallback(gP({defaultColor:e,rfId:t}),[e,t]),(i,o)=>!(i.length!==o.length||i.some((a,u)=>a.id!==o[u].id)));return ae.createElement("defs",null,r.map(i=>ae.createElement(mP,{id:i.id,key:i.id,type:i.type,color:i.color,width:i.width,height:i.height,markerUnits:i.markerUnits,strokeWidth:i.strokeWidth,orient:i.orient})))};KC.displayName="MarkerDefinitions";var vP=C.memo(KC);const yP=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}),XC=({defaultMarkerColor:e,onlyRenderVisibleElements:t,elevateEdgesOnSelect:r,rfId:i,edgeTypes:o,noPanClassName:a,onEdgeContextMenu:u,onEdgeMouseEnter:c,onEdgeMouseMove:f,onEdgeMouseLeave:p,onEdgeClick:d,onEdgeDoubleClick:g,onReconnect:y,onReconnectStart:w,onReconnectEnd:E,reconnectRadius:_,children:b,disableKeyboardA11y:k})=>{const{edgesFocusable:S,edgesUpdatable:N,elementsSelectable:T,width:A,height:L,connectionMode:P,nodeInternals:U,onError:O}=rt(yP,At),M=dP(t,U,r);return A?ae.createElement(ae.Fragment,null,M.map(({level:q,edges:V,isMaxLevel:Q})=>ae.createElement("svg",{key:q,style:{zIndex:q},width:A,height:L,className:"react-flow__edges react-flow__container"},Q&&ae.createElement(vP,{defaultColor:e,rfId:i}),ae.createElement("g",null,V.map(j=>{const[G,z,te]=l_(U.get(j.source)),[J,$,W]=l_(U.get(j.target));if(!te||!W)return null;let I=j.type||"default";o[I]||(O==null||O("011",Hr.error011(I)),I="default");const Y=o[I]||o.default,ue=P===pi.Strict?$.target:($.target??[]).concat($.source??[]),F=a_(z.source,j.sourceHandle),Z=a_(ue,j.targetHandle),ne=(F==null?void 0:F.position)||Re.Bottom,B=(Z==null?void 0:Z.position)||Re.Top,de=!!(j.focusable||S&&typeof j.focusable>"u"),pe=j.reconnectable||j.updatable,ye=typeof y<"u"&&(pe||N&&typeof pe>"u");if(!F||!Z)return O==null||O("008",Hr.error008(F,j)),null;const{sourceX:Pe,sourceY:Ue,targetX:De,targetY:Me}=aP(G,F,ne,J,Z,B);return ae.createElement(Y,{key:j.id,id:j.id,className:Dt([j.className,a]),type:I,data:j.data,selected:!!j.selected,animated:!!j.animated,hidden:!!j.hidden,label:j.label,labelStyle:j.labelStyle,labelShowBg:j.labelShowBg,labelBgStyle:j.labelBgStyle,labelBgPadding:j.labelBgPadding,labelBgBorderRadius:j.labelBgBorderRadius,style:j.style,source:j.source,target:j.target,sourceHandleId:j.sourceHandle,targetHandleId:j.targetHandle,markerEnd:j.markerEnd,markerStart:j.markerStart,sourceX:Pe,sourceY:Ue,targetX:De,targetY:Me,sourcePosition:ne,targetPosition:B,elementsSelectable:T,onContextMenu:u,onMouseEnter:c,onMouseMove:f,onMouseLeave:p,onClick:d,onEdgeDoubleClick:g,onReconnect:y,onReconnectStart:w,onReconnectEnd:E,reconnectRadius:_,rfId:i,ariaLabel:j.ariaLabel,isFocusable:de,isReconnectable:ye,pathOptions:"pathOptions"in j?j.pathOptions:void 0,interactionWidth:j.interactionWidth,disableKeyboardA11y:k})})))),b):null};XC.displayName="EdgeRenderer";var wP=C.memo(XC);const xP=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function _P({children:e}){const t=rt(xP);return ae.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:t}},e)}function bP(e){const t=Ha(),r=C.useRef(!1);C.useEffect(()=>{!r.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),r.current=!0)},[e,t.viewportInitialized])}const kP={[Re.Left]:Re.Right,[Re.Right]:Re.Left,[Re.Top]:Re.Bottom,[Re.Bottom]:Re.Top},QC=({nodeId:e,handleType:t,style:r,type:i=bs.Bezier,CustomComponent:o,connectionStatus:a})=>{var L,P,U;const{fromNode:u,handleId:c,toX:f,toY:p,connectionMode:d}=rt(C.useCallback(O=>({fromNode:O.nodeInternals.get(e),handleId:O.connectionHandleId,toX:(O.connectionPosition.x-O.transform[0])/O.transform[2],toY:(O.connectionPosition.y-O.transform[1])/O.transform[2],connectionMode:O.connectionMode}),[e]),At),g=(L=u==null?void 0:u[xt])==null?void 0:L.handleBounds;let y=g==null?void 0:g[t];if(d===pi.Loose&&(y=y||(g==null?void 0:g[t==="source"?"target":"source"])),!u||!y)return null;const w=c?y.find(O=>O.id===c):y[0],E=w?w.x+w.width/2:(u.width??0)/2,_=w?w.y+w.height/2:u.height??0,b=(((P=u.positionAbsolute)==null?void 0:P.x)??0)+E,k=(((U=u.positionAbsolute)==null?void 0:U.y)??0)+_,S=w==null?void 0:w.position,N=S?kP[S]:null;if(!S||!N)return null;if(o)return ae.createElement(o,{connectionLineType:i,connectionLineStyle:r,fromNode:u,fromHandle:w,fromX:b,fromY:k,toX:f,toY:p,fromPosition:S,toPosition:N,connectionStatus:a});let T="";const A={sourceX:b,sourceY:k,sourcePosition:S,targetX:f,targetY:p,targetPosition:N};return i===bs.Bezier?[T]=bC(A):i===bs.Step?[T]=Gv({...A,borderRadius:0}):i===bs.SmoothStep?[T]=Gv(A):i===bs.SimpleBezier?[T]=_C(A):T=`M${b},${k} ${f},${p}`,ae.createElement("path",{d:T,fill:"none",className:"react-flow__connection-path",style:r})};QC.displayName="ConnectionLine";const SP=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function EP({containerStyle:e,style:t,type:r,component:i}){const{nodeId:o,handleType:a,nodesConnectable:u,width:c,height:f,connectionStatus:p}=rt(SP,At);return!(o&&a&&c&&u)?null:ae.createElement("svg",{style:e,width:c,height:f,className:"react-flow__edges react-flow__connectionline react-flow__container"},ae.createElement("g",{className:Dt(["react-flow__connection",p])},ae.createElement(QC,{nodeId:o,handleType:a,style:t,type:r,CustomComponent:i,connectionStatus:p})))}function c_(e,t){return C.useRef(null),Nt(),C.useMemo(()=>t(e),[e])}const ZC=({nodeTypes:e,edgeTypes:t,onMove:r,onMoveStart:i,onMoveEnd:o,onInit:a,onNodeClick:u,onEdgeClick:c,onNodeDoubleClick:f,onEdgeDoubleClick:p,onNodeMouseEnter:d,onNodeMouseMove:g,onNodeMouseLeave:y,onNodeContextMenu:w,onSelectionContextMenu:E,onSelectionStart:_,onSelectionEnd:b,connectionLineType:k,connectionLineStyle:S,connectionLineComponent:N,connectionLineContainerStyle:T,selectionKeyCode:A,selectionOnDrag:L,selectionMode:P,multiSelectionKeyCode:U,panActivationKeyCode:O,zoomActivationKeyCode:M,deleteKeyCode:q,onlyRenderVisibleElements:V,elementsSelectable:Q,selectNodesOnDrag:j,defaultViewport:G,translateExtent:z,minZoom:te,maxZoom:J,preventScrolling:$,defaultMarkerColor:W,zoomOnScroll:I,zoomOnPinch:Y,panOnScroll:ue,panOnScrollSpeed:F,panOnScrollMode:Z,zoomOnDoubleClick:ne,panOnDrag:B,onPaneClick:de,onPaneMouseEnter:pe,onPaneMouseMove:ye,onPaneMouseLeave:Pe,onPaneScroll:Ue,onPaneContextMenu:De,onEdgeContextMenu:Me,onEdgeMouseEnter:_e,onEdgeMouseMove:Fe,onEdgeMouseLeave:we,onReconnect:fe,onReconnectStart:Ke,onReconnectEnd:gt,reconnectRadius:tt,noDragClassName:ot,noWheelClassName:Be,noPanClassName:Ze,elevateEdgesOnSelect:ut,disableKeyboardA11y:_t,nodeOrigin:ie,nodeExtent:qe,rfId:Oe})=>{const Te=c_(e,JO),ze=c_(t,oP);return bP(a),ae.createElement(QO,{onPaneClick:de,onPaneMouseEnter:pe,onPaneMouseMove:ye,onPaneMouseLeave:Pe,onPaneContextMenu:De,onPaneScroll:Ue,deleteKeyCode:q,selectionKeyCode:A,selectionOnDrag:L,selectionMode:P,onSelectionStart:_,onSelectionEnd:b,multiSelectionKeyCode:U,panActivationKeyCode:O,zoomActivationKeyCode:M,elementsSelectable:Q,onMove:r,onMoveStart:i,onMoveEnd:o,zoomOnScroll:I,zoomOnPinch:Y,zoomOnDoubleClick:ne,panOnScroll:ue,panOnScrollSpeed:F,panOnScrollMode:Z,panOnDrag:B,defaultViewport:G,translateExtent:z,minZoom:te,maxZoom:J,onSelectionContextMenu:E,preventScrolling:$,noDragClassName:ot,noWheelClassName:Be,noPanClassName:Ze,disableKeyboardA11y:_t},ae.createElement(_P,null,ae.createElement(wP,{edgeTypes:ze,onEdgeClick:c,onEdgeDoubleClick:p,onlyRenderVisibleElements:V,onEdgeContextMenu:Me,onEdgeMouseEnter:_e,onEdgeMouseMove:Fe,onEdgeMouseLeave:we,onReconnect:fe,onReconnectStart:Ke,onReconnectEnd:gt,reconnectRadius:tt,defaultMarkerColor:W,noPanClassName:Ze,elevateEdgesOnSelect:!!ut,disableKeyboardA11y:_t,rfId:Oe},ae.createElement(EP,{style:S,type:k,component:N,containerStyle:T})),ae.createElement("div",{className:"react-flow__edgelabel-renderer"}),ae.createElement(nP,{nodeTypes:Te,onNodeClick:u,onNodeDoubleClick:f,onNodeMouseEnter:d,onNodeMouseMove:g,onNodeMouseLeave:y,onNodeContextMenu:w,selectNodesOnDrag:j,onlyRenderVisibleElements:V,noPanClassName:Ze,noDragClassName:ot,disableKeyboardA11y:_t,nodeOrigin:ie,nodeExtent:qe,rfId:Oe})))};ZC.displayName="GraphView";var NP=C.memo(ZC);const Zv=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],ws={rfId:"1",width:0,height:0,transform:[0,0,1],nodeInternals:new Map,edges:[],onNodesChange:null,onEdgesChange:null,hasDefaultNodes:!1,hasDefaultEdges:!1,d3Zoom:null,d3Selection:null,d3ZoomHandler:void 0,minZoom:.5,maxZoom:2,translateExtent:Zv,nodeExtent:Zv,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:pi.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:JM,isValidConnection:void 0},CP=()=>hA((e,t)=>({...ws,setNodes:r=>{const{nodeInternals:i,nodeOrigin:o,elevateNodesOnSelect:a}=t();e({nodeInternals:af(r,i,o,a)})},getNodes:()=>Array.from(t().nodeInternals.values()),setEdges:r=>{const{defaultEdgeOptions:i={}}=t();e({edges:r.map(o=>({...i,...o}))})},setDefaultNodesAndEdges:(r,i)=>{const o=typeof r<"u",a=typeof i<"u",u=o?af(r,new Map,t().nodeOrigin,t().elevateNodesOnSelect):new Map;e({nodeInternals:u,edges:a?i:[],hasDefaultNodes:o,hasDefaultEdges:a})},updateNodeDimensions:r=>{const{onNodesChange:i,nodeInternals:o,fitViewOnInit:a,fitViewOnInitDone:u,fitViewOnInitOptions:c,domNode:f,nodeOrigin:p}=t(),d=f==null?void 0:f.querySelector(".react-flow__viewport");if(!d)return;const g=window.getComputedStyle(d),{m22:y}=new window.DOMMatrixReadOnly(g.transform),w=r.reduce((_,b)=>{const k=o.get(b.id);if(k!=null&&k.hidden)o.set(k.id,{...k,[xt]:{...k[xt],handleBounds:void 0}});else if(k){const S=wy(b.nodeElement);!!(S.width&&S.height&&(k.width!==S.width||k.height!==S.height||b.forceUpdate))&&(o.set(k.id,{...k,[xt]:{...k[xt],handleBounds:{source:r_(".source",b.nodeElement,y,p),target:r_(".target",b.nodeElement,y,p)}},...S}),_.push({id:k.id,type:"dimensions",dimensions:S}))}return _},[]);FC(o,p);const E=u||a&&!u&&zC(t,{initial:!0,...c});e({nodeInternals:new Map(o),fitViewOnInitDone:E}),(w==null?void 0:w.length)>0&&(i==null||i(w))},updateNodePositions:(r,i=!0,o=!1)=>{const{triggerNodeChanges:a}=t(),u=r.map(c=>{const f={id:c.id,type:"position",dragging:o};return i&&(f.positionAbsolute=c.positionAbsolute,f.position=c.position),f});a(u)},triggerNodeChanges:r=>{const{onNodesChange:i,nodeInternals:o,hasDefaultNodes:a,nodeOrigin:u,getNodes:c,elevateNodesOnSelect:f}=t();if(r!=null&&r.length){if(a){const p=BO(r,c()),d=af(p,o,u,f);e({nodeInternals:d})}i==null||i(r)}},addSelectedNodes:r=>{const{multiSelectionActive:i,edges:o,getNodes:a}=t();let u,c=null;i?u=r.map(f=>_s(f,!0)):(u=ho(a(),r),c=ho(o,[])),hu({changedNodes:u,changedEdges:c,get:t,set:e})},addSelectedEdges:r=>{const{multiSelectionActive:i,edges:o,getNodes:a}=t();let u,c=null;i?u=r.map(f=>_s(f,!0)):(u=ho(o,r),c=ho(a(),[])),hu({changedNodes:c,changedEdges:u,get:t,set:e})},unselectNodesAndEdges:({nodes:r,edges:i}={})=>{const{edges:o,getNodes:a}=t(),u=r||a(),c=i||o,f=u.map(d=>(d.selected=!1,_s(d.id,!1))),p=c.map(d=>_s(d.id,!1));hu({changedNodes:f,changedEdges:p,get:t,set:e})},setMinZoom:r=>{const{d3Zoom:i,maxZoom:o}=t();i==null||i.scaleExtent([r,o]),e({minZoom:r})},setMaxZoom:r=>{const{d3Zoom:i,minZoom:o}=t();i==null||i.scaleExtent([o,r]),e({maxZoom:r})},setTranslateExtent:r=>{var i;(i=t().d3Zoom)==null||i.translateExtent(r),e({translateExtent:r})},resetSelectedElements:()=>{const{edges:r,getNodes:i}=t(),a=i().filter(c=>c.selected).map(c=>_s(c.id,!1)),u=r.filter(c=>c.selected).map(c=>_s(c.id,!1));hu({changedNodes:a,changedEdges:u,get:t,set:e})},setNodeExtent:r=>{const{nodeInternals:i}=t();i.forEach(o=>{o.positionAbsolute=xy(o.position,r)}),e({nodeExtent:r,nodeInternals:new Map(i)})},panBy:r=>{const{transform:i,width:o,height:a,d3Zoom:u,d3Selection:c,translateExtent:f}=t();if(!u||!c||!r.x&&!r.y)return!1;const p=Br.translate(i[0]+r.x,i[1]+r.y).scale(i[2]),d=[[0,0],[o,a]],g=u==null?void 0:u.constrain()(p,d,f);return u.transform(c,g),i[0]!==g.x||i[1]!==g.y||i[2]!==g.k},cancelConnection:()=>e({connectionNodeId:ws.connectionNodeId,connectionHandleId:ws.connectionHandleId,connectionHandleType:ws.connectionHandleType,connectionStatus:ws.connectionStatus,connectionStartHandle:ws.connectionStartHandle,connectionEndHandle:ws.connectionEndHandle}),reset:()=>e({...ws})}),Object.is),jy=({children:e})=>{const t=C.useRef(null);return t.current||(t.current=CP()),ae.createElement(VM,{value:t.current},e)};jy.displayName="ReactFlowProvider";const JC=({children:e})=>C.useContext(Xu)?ae.createElement(ae.Fragment,null,e):ae.createElement(jy,null,e);JC.displayName="ReactFlowWrapper";const jP={input:MC,default:Xv,output:PC,group:Ny},TP={default:qu,straight:ky,step:by,smoothstep:Qu,simplebezier:_y},RP=[0,0],AP=[15,15],IP={x:0,y:0,zoom:1},MP={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},ej=C.forwardRef(({nodes:e,edges:t,defaultNodes:r,defaultEdges:i,className:o,nodeTypes:a=jP,edgeTypes:u=TP,onNodeClick:c,onEdgeClick:f,onInit:p,onMove:d,onMoveStart:g,onMoveEnd:y,onConnect:w,onConnectStart:E,onConnectEnd:_,onClickConnectStart:b,onClickConnectEnd:k,onNodeMouseEnter:S,onNodeMouseMove:N,onNodeMouseLeave:T,onNodeContextMenu:A,onNodeDoubleClick:L,onNodeDragStart:P,onNodeDrag:U,onNodeDragStop:O,onNodesDelete:M,onEdgesDelete:q,onSelectionChange:V,onSelectionDragStart:Q,onSelectionDrag:j,onSelectionDragStop:G,onSelectionContextMenu:z,onSelectionStart:te,onSelectionEnd:J,connectionMode:$=pi.Strict,connectionLineType:W=bs.Bezier,connectionLineStyle:I,connectionLineComponent:Y,connectionLineContainerStyle:ue,deleteKeyCode:F="Backspace",selectionKeyCode:Z="Shift",selectionOnDrag:ne=!1,selectionMode:B=Pa.Full,panActivationKeyCode:de="Space",multiSelectionKeyCode:pe=Lu()?"Meta":"Control",zoomActivationKeyCode:ye=Lu()?"Meta":"Control",snapToGrid:Pe=!1,snapGrid:Ue=AP,onlyRenderVisibleElements:De=!1,selectNodesOnDrag:Me=!0,nodesDraggable:_e,nodesConnectable:Fe,nodesFocusable:we,nodeOrigin:fe=RP,edgesFocusable:Ke,edgesUpdatable:gt,elementsSelectable:tt,defaultViewport:ot=IP,minZoom:Be=.5,maxZoom:Ze=2,translateExtent:ut=Zv,preventScrolling:_t=!0,nodeExtent:ie,defaultMarkerColor:qe="#b1b1b7",zoomOnScroll:Oe=!0,zoomOnPinch:Te=!0,panOnScroll:ze=!1,panOnScrollSpeed:He=.5,panOnScrollMode:Je=ci.Free,zoomOnDoubleClick:ke=!0,panOnDrag:bt=!0,onPaneClick:nt,onPaneMouseEnter:at,onPaneMouseMove:yn,onPaneMouseLeave:or,onPaneScroll:un,onPaneContextMenu:wn,children:xn,onEdgeContextMenu:cn,onEdgeDoubleClick:_i,onEdgeMouseEnter:Cs,onEdgeMouseMove:ar,onEdgeMouseLeave:bi,onEdgeUpdate:Gr,onEdgeUpdateStart:Ft,onEdgeUpdateEnd:_n,onReconnect:js,onReconnectStart:Fn,onReconnectEnd:kt,reconnectRadius:br=10,edgeUpdaterRadius:bn=10,onNodesChange:Yr,onEdgesChange:Ts,noDragClassName:zn="nodrag",noWheelClassName:Kr="nowheel",noPanClassName:ki="nopan",fitView:Bn=!1,fitViewOptions:Rs,connectOnClick:As=!0,attributionPosition:lr,proOptions:Is,defaultEdgeOptions:Ms,elevateNodesOnSelect:kr=!0,elevateEdgesOnSelect:Os=!1,disableKeyboardA11y:Ps=!1,autoPanOnConnect:Pt=!0,autoPanOnNodeDrag:st=!0,connectionRadius:Xr=20,isValidConnection:Qr,onError:Si,style:kn,id:Ls,nodeDragThreshold:Sn,...Zr},Vt)=>{const $s=Ls||"1";return ae.createElement("div",{...Zr,style:{...kn,...MP},ref:Vt,className:Dt(["react-flow",o]),"data-testid":"rf__wrapper",id:Ls},ae.createElement(JC,null,ae.createElement(NP,{onInit:p,onMove:d,onMoveStart:g,onMoveEnd:y,onNodeClick:c,onEdgeClick:f,onNodeMouseEnter:S,onNodeMouseMove:N,onNodeMouseLeave:T,onNodeContextMenu:A,onNodeDoubleClick:L,nodeTypes:a,edgeTypes:u,connectionLineType:W,connectionLineStyle:I,connectionLineComponent:Y,connectionLineContainerStyle:ue,selectionKeyCode:Z,selectionOnDrag:ne,selectionMode:B,deleteKeyCode:F,multiSelectionKeyCode:pe,panActivationKeyCode:de,zoomActivationKeyCode:ye,onlyRenderVisibleElements:De,selectNodesOnDrag:Me,defaultViewport:ot,translateExtent:ut,minZoom:Be,maxZoom:Ze,preventScrolling:_t,zoomOnScroll:Oe,zoomOnPinch:Te,zoomOnDoubleClick:ke,panOnScroll:ze,panOnScrollSpeed:He,panOnScrollMode:Je,panOnDrag:bt,onPaneClick:nt,onPaneMouseEnter:at,onPaneMouseMove:yn,onPaneMouseLeave:or,onPaneScroll:un,onPaneContextMenu:wn,onSelectionContextMenu:z,onSelectionStart:te,onSelectionEnd:J,onEdgeContextMenu:cn,onEdgeDoubleClick:_i,onEdgeMouseEnter:Cs,onEdgeMouseMove:ar,onEdgeMouseLeave:bi,onReconnect:js??Gr,onReconnectStart:Fn??Ft,onReconnectEnd:kt??_n,reconnectRadius:br??bn,defaultMarkerColor:qe,noDragClassName:zn,noWheelClassName:Kr,noPanClassName:ki,elevateEdgesOnSelect:Os,rfId:$s,disableKeyboardA11y:Ps,nodeOrigin:fe,nodeExtent:ie}),ae.createElement(bO,{nodes:e,edges:t,defaultNodes:r,defaultEdges:i,onConnect:w,onConnectStart:E,onConnectEnd:_,onClickConnectStart:b,onClickConnectEnd:k,nodesDraggable:_e,nodesConnectable:Fe,nodesFocusable:we,edgesFocusable:Ke,edgesUpdatable:gt,elementsSelectable:tt,elevateNodesOnSelect:kr,minZoom:Be,maxZoom:Ze,nodeExtent:ie,onNodesChange:Yr,onEdgesChange:Ts,snapToGrid:Pe,snapGrid:Ue,connectionMode:$,translateExtent:ut,connectOnClick:As,defaultEdgeOptions:Ms,fitView:Bn,fitViewOptions:Rs,onNodesDelete:M,onEdgesDelete:q,onNodeDragStart:P,onNodeDrag:U,onNodeDragStop:O,onSelectionDrag:j,onSelectionDragStart:Q,onSelectionDragStop:G,noPanClassName:ki,nodeOrigin:fe,rfId:$s,autoPanOnConnect:Pt,autoPanOnNodeDrag:st,onError:Si,connectionRadius:Xr,isValidConnection:Qr,nodeDragThreshold:Sn}),ae.createElement(xO,{onSelectionChange:V}),xn,ae.createElement(YM,{proOptions:Is,position:lr}),ae.createElement(CO,{rfId:$s,disableKeyboardA11y:Ps})))});ej.displayName="ReactFlow";const OP=e=>({x:e.transform[0],y:e.transform[1],zoom:e.transform[2]});function tj(){return rt(OP,At)}const nj=({id:e,x:t,y:r,width:i,height:o,style:a,color:u,strokeColor:c,strokeWidth:f,className:p,borderRadius:d,shapeRendering:g,onClick:y,selected:w})=>{const{background:E,backgroundColor:_}=a||{},b=u||E||_;return ae.createElement("rect",{className:Dt(["react-flow__minimap-node",{selected:w},p]),x:t,y:r,rx:d,ry:d,width:i,height:o,fill:b,stroke:c,strokeWidth:f,shapeRendering:g,onClick:y?k=>y(k,e):void 0})};nj.displayName="MiniMapNode";var PP=C.memo(nj);const LP=e=>e.nodeOrigin,$P=e=>e.getNodes().filter(t=>!t.hidden&&t.width&&t.height),df=e=>e instanceof Function?e:()=>e;function qP({nodeStrokeColor:e="transparent",nodeColor:t="#e2e2e2",nodeClassName:r="",nodeBorderRadius:i=5,nodeStrokeWidth:o=2,nodeComponent:a=PP,onClick:u}){const c=rt($P,At),f=rt(LP),p=df(t),d=df(e),g=df(r),y=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return ae.createElement(ae.Fragment,null,c.map(w=>{const{x:E,y:_}=fi(w,f).positionAbsolute;return ae.createElement(a,{key:w.id,x:E,y:_,width:w.width,height:w.height,style:w.style,selected:w.selected,className:g(w),color:p(w),borderRadius:i,strokeColor:d(w),strokeWidth:o,shapeRendering:y,onClick:u,id:w.id})}))}var DP=C.memo(qP);const FP=200,zP=150,BP=e=>{const t=e.getNodes(),r={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:r,boundingRect:t.length>0?QM(Zu(t,e.nodeOrigin),r):r,rfId:e.rfId}},UP="react-flow__minimap-desc";function rj({style:e,className:t,nodeStrokeColor:r="transparent",nodeColor:i="#e2e2e2",nodeClassName:o="",nodeBorderRadius:a=5,nodeStrokeWidth:u=2,nodeComponent:c,maskColor:f="rgb(240, 240, 240, 0.6)",maskStrokeColor:p="none",maskStrokeWidth:d=1,position:g="bottom-right",onClick:y,onNodeClick:w,pannable:E=!1,zoomable:_=!1,ariaLabel:b="React Flow mini map",inversePan:k=!1,zoomStep:S=10,offsetScale:N=5}){const T=Nt(),A=C.useRef(null),{boundingRect:L,viewBB:P,rfId:U}=rt(BP,At),O=(e==null?void 0:e.width)??FP,M=(e==null?void 0:e.height)??zP,q=L.width/O,V=L.height/M,Q=Math.max(q,V),j=Q*O,G=Q*M,z=N*Q,te=L.x-(j-L.width)/2-z,J=L.y-(G-L.height)/2-z,$=j+z*2,W=G+z*2,I=`${UP}-${U}`,Y=C.useRef(0);Y.current=Q,C.useEffect(()=>{if(A.current){const Z=Ln(A.current),ne=pe=>{const{transform:ye,d3Selection:Pe,d3Zoom:Ue}=T.getState();if(pe.sourceEvent.type!=="wheel"||!Pe||!Ue)return;const De=-pe.sourceEvent.deltaY*(pe.sourceEvent.deltaMode===1?.05:pe.sourceEvent.deltaMode?1:.002)*S,Me=ye[2]*Math.pow(2,De);Ue.scaleTo(Pe,Me)},B=pe=>{const{transform:ye,d3Selection:Pe,d3Zoom:Ue,translateExtent:De,width:Me,height:_e}=T.getState();if(pe.sourceEvent.type!=="mousemove"||!Pe||!Ue)return;const Fe=Y.current*Math.max(1,ye[2])*(k?-1:1),we={x:ye[0]-pe.sourceEvent.movementX*Fe,y:ye[1]-pe.sourceEvent.movementY*Fe},fe=[[0,0],[Me,_e]],Ke=Br.translate(we.x,we.y).scale(ye[2]),gt=Ue.constrain()(Ke,fe,De);Ue.transform(Pe,gt)},de=dC().on("zoom",E?B:null).on("zoom.wheel",_?ne:null);return Z.call(de),()=>{Z.on("zoom",null)}}},[E,_,k,S]);const ue=y?Z=>{const ne=er(Z);y(Z,{x:ne[0],y:ne[1]})}:void 0,F=w?(Z,ne)=>{const B=T.getState().nodeInternals.get(ne);w(Z,B)}:void 0;return ae.createElement(yy,{position:g,style:e,className:Dt(["react-flow__minimap",t]),"data-testid":"rf__minimap"},ae.createElement("svg",{width:O,height:M,viewBox:`${te} ${J} ${$} ${W}`,role:"img","aria-labelledby":I,ref:A,onClick:ue},b&&ae.createElement("title",{id:I},b),ae.createElement(DP,{onClick:F,nodeColor:i,nodeStrokeColor:r,nodeBorderRadius:a,nodeClassName:o,nodeStrokeWidth:u,nodeComponent:c}),ae.createElement("path",{className:"react-flow__minimap-mask",d:`M${te-z},${J-z}h${$+z*2}v${W+z*2}h${-$-z*2}z
57
- M${P.x},${P.y}h${P.width}v${P.height}h${-P.width}z`,fill:f,fillRule:"evenodd",stroke:p,strokeWidth:d,pointerEvents:"none"})))}rj.displayName="MiniMap";var HP=C.memo(rj);function WP(){return ae.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},ae.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function VP(){return ae.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},ae.createElement("path",{d:"M0 0h32v4.2H0z"}))}function GP(){return ae.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},ae.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 YP(){return ae.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},ae.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 KP(){return ae.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},ae.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 yr=({children:e,className:t,...r})=>ae.createElement("button",{type:"button",className:Dt(["react-flow__controls-button",t]),...r},e);yr.displayName="ControlButton";const XP=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom}),sj=({style:e,showZoom:t=!0,showFitView:r=!0,showInteractive:i=!0,fitViewOptions:o,onZoomIn:a,onZoomOut:u,onFitView:c,onInteractiveChange:f,className:p,children:d,position:g="bottom-left"})=>{const y=Nt(),[w,E]=C.useState(!1),{isInteractive:_,minZoomReached:b,maxZoomReached:k}=rt(XP,At),{zoomIn:S,zoomOut:N,fitView:T}=Ha();if(C.useEffect(()=>{E(!0)},[]),!w)return null;const A=()=>{S(),a==null||a()},L=()=>{N(),u==null||u()},P=()=>{T(o),c==null||c()},U=()=>{y.setState({nodesDraggable:!_,nodesConnectable:!_,elementsSelectable:!_}),f==null||f(!_)};return ae.createElement(yy,{className:Dt(["react-flow__controls",p]),position:g,style:e,"data-testid":"rf__controls"},t&&ae.createElement(ae.Fragment,null,ae.createElement(yr,{onClick:A,className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:k},ae.createElement(WP,null)),ae.createElement(yr,{onClick:L,className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:b},ae.createElement(VP,null))),r&&ae.createElement(yr,{className:"react-flow__controls-fitview",onClick:P,title:"fit view","aria-label":"fit view"},ae.createElement(GP,null)),i&&ae.createElement(yr,{className:"react-flow__controls-interactive",onClick:U,title:"toggle interactivity","aria-label":"toggle interactivity"},_?ae.createElement(KP,null):ae.createElement(YP,null)),d)};sj.displayName="Controls";var QP=C.memo(sj),nr;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(nr||(nr={}));function ZP({color:e,dimensions:t,lineWidth:r}){return ae.createElement("path",{stroke:e,strokeWidth:r,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`})}function JP({color:e,radius:t}){return ae.createElement("circle",{cx:t,cy:t,r:t,fill:e})}const eL={[nr.Dots]:"#91919a",[nr.Lines]:"#eee",[nr.Cross]:"#e2e2e2"},tL={[nr.Dots]:1,[nr.Lines]:1,[nr.Cross]:6},nL=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function ij({id:e,variant:t=nr.Dots,gap:r=20,size:i,lineWidth:o=1,offset:a=2,color:u,style:c,className:f}){const p=C.useRef(null),{transform:d,patternId:g}=rt(nL,At),y=u||eL[t],w=i||tL[t],E=t===nr.Dots,_=t===nr.Cross,b=Array.isArray(r)?r:[r,r],k=[b[0]*d[2]||1,b[1]*d[2]||1],S=w*d[2],N=_?[S,S]:k,T=E?[S/a,S/a]:[N[0]/a,N[1]/a];return ae.createElement("svg",{className:Dt(["react-flow__background",f]),style:{...c,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:p,"data-testid":"rf__background"},ae.createElement("pattern",{id:g+e,x:d[0]%k[0],y:d[1]%k[1],width:k[0],height:k[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${T[0]},-${T[1]})`},E?ae.createElement(JP,{color:y,radius:S/a}):ae.createElement(ZP,{dimensions:N,color:y,lineWidth:o})),ae.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${g+e})`}))}ij.displayName="Background";var rL=C.memo(ij);const sL=["us-gov","global","apac","us","eu","jp","au"],iL=new RegExp(`^(?:(?:${sL.join("|")})\\.)?anthropic\\.`,"i");function Ju(e){return e.replace(iL,"")}function oj(){return{inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0}}function Ty(e){const t=e.cache_creation,r=t&&typeof t=="object"?t:e,i=r.ephemeral_1h_input_tokens,o=r.ephemeral_5m_input_tokens;return typeof i!="number"&&typeof o!="number"?{}:{cacheCreate1hTokens:Number(i??0),cacheCreate5mTokens:Number(o??0)}}function oL(e){const t=Ty(e),r={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"&&(r.reasoningOutputTokens=Number(e.reasoning_output_tokens)),r}function aL(e){if(!e||typeof e!="object"||Array.isArray(e))return;const t={};for(const[r,i]of Object.entries(e))!r||!i||typeof i!="object"||(t[r]=oL(i));return Object.keys(t).length?t:void 0}function aj(e,t=0){if(!e||typeof e!="object"||t>6)return null;const r=e;if(typeof r.input_tokens=="number"||typeof r.output_tokens=="number"||typeof r.cache_read_input_tokens=="number"||typeof r.cache_creation_input_tokens=="number")return{inputTokens:Number(r.input_tokens??0),outputTokens:Number(r.output_tokens??0),cacheReadTokens:Number(r.cache_read_input_tokens??0),cacheCreateTokens:Number(r.cache_creation_input_tokens??0),...Ty(r)};for(const i of Object.values(r)){const o=aj(i,t+1);if(o)return o}return null}const lL=/^(?:claude[-_]|gpt[-_]|o\d|codex[-_])/i;function lj(e,t=0){if(!e||typeof e!="object"||t>6)return null;const r=e;if(typeof r.model=="string"&&lL.test(Ju(r.model)))return r.model;for(const i of Object.values(r)){const o=lj(i,t+1);if(o)return o}return null}function Jv(){return{agents:new Map,toolIndex:new Map,toolOwner:new Map,activeSubagentStack:new Map,lastSeq:0,seqEpoch:null,totalEvents:0,revision:0}}function Ss(e){if(!e)return;const t=e.replace(/\\/g,"/").split("/").filter(Boolean);return t[t.length-1]}function d_(){return{msgsUser:0,msgsAssistant:0,toolUses:0,toolResults:0,systemReminders:0,currentContextTokens:0,memoryFiles:[]}}function Wa(e,t){return`${e}::${t}`}function Du(e){return e.agent_type??e.subagent_type??"subagent"}function ja(e){return e.agent_id?e.agent_id:e.parent_tool_use_id?e.parent_tool_use_id:null}function po(e,t,r,i){const o=t;let a=e.agents.get(o);return a||(a={id:o,sessionId:t,label:"session",kind:"root",state:"active",startedAt:r,lastEventAt:r,tools:[],prompts:[],toolCount:0,childCount:0,synthetic:i,usage:oj()},e.agents.set(o,a),a)}function uj(e,t,r,i){const o=Wa(t,r),a=e.agents.get(o);if(!a)return null;!a.cwd&&i.cwd&&(a.cwd=i.cwd,a.cwdBasename=Ss(i.cwd));const u=Du(i);return u&&(a.label==="subagent"||!a.label)&&(a.label=u),a}function uL(e,t,r){const i=t.session_id??"unknown",o=ja(t);if(o){const f=uj(e,i,o,t);if(f)return f}const a=e.activeSubagentStack.get(i),u=a&&a.length>0?a[a.length-1]:null;if(u){const f=e.agents.get(Wa(i,u));if(f)return!f.cwd&&t.cwd&&(f.cwd=t.cwd,f.cwdBasename=Ss(t.cwd)),f}const c=po(e,i,r,t.hook_event_name!=="SessionStart");return!c.cwd&&t.cwd&&(c.cwd=t.cwd,c.cwdBasename=Ss(t.cwd)),c.label==="session"&&t.cwd&&(c.label=Ss(t.cwd)??"session"),c}function cL(e,t,r,i,o){const a=Wa(t,r),u=po(e,t,o,!0);let c=e.agents.get(a);if(c){!c.cwd&&i.cwd&&(c.cwd=i.cwd,c.cwdBasename=Ss(i.cwd));const f=Du(i);return f&&(c.label==="subagent"||!c.label)&&(c.label=f),c}return c={id:a,sessionId:t,label:Du(i),kind:"subagent",parentId:u.id,state:"active",startedAt:o,tools:[],prompts:[],cwd:i.cwd,cwdBasename:Ss(i.cwd),toolCount:0,childCount:0,usage:oj()},e.agents.set(a,c),u.childCount+=1,c}function dL(e,t,r){const i=e.activeSubagentStack.get(t)??[];i.includes(r)||(i.push(r),e.activeSubagentStack.set(t,i))}function fL(e,t,r){const i=e.activeSubagentStack.get(t);if(i){for(let o=i.length-1;o>=0;o--)if(i[o]===r){i.splice(o,1);break}i.length===0&&e.activeSubagentStack.delete(t)}}function mu(e,t=80){if(e==null)return"";if(typeof e=="string")return e.length>t?e.slice(0,t-1)+"…":e;try{const r=JSON.stringify(e);return r.length>t?r.slice(0,t-1)+"…":r}catch{return String(e)}}const f_=200,hL=25;function pL(e,t){const r=t.tools;if(r.length>f_){const i=r.splice(0,r.length-f_);for(const o of i)e.toolIndex.get(o.id)===o&&(e.toolIndex.delete(o.id),e.toolOwner.delete(o.id))}for(let i=r.length-hL-1;i>=0;i--){const o=r[i];if(o.trimmed)break;o.input=void 0,o.response=void 0,o.trimmed=!0}}function mL(e,t,r){const i=e.toolIndex.get(r);if(i)return i;for(let o=t.tools.length-1;o>=0;o--)if(t.tools[o].id===r)return t.tools[o];return null}const h_=2e3;function gL(e,t,r){for(let i=e.prompts.length-1;i>=0;i--){const o=e.prompts[i];if(o.at<t-h_)return!1;if(o.text===r&&o.at<=t+h_)return!0}return!1}function cj(e,t){for(const r of t.tools)e.toolIndex.get(r.id)===r&&e.toolIndex.delete(r.id),e.toolOwner.get(r.id)===t.id&&e.toolOwner.delete(r.id)}function Va(e,t){return t&&(e.revision+=1),t}function vL(e,t,r,i){if(e.agents.size<=r)return!1;const o=p=>p.state==="done"&&p.endedAt!=null&&t-p.endedAt>i,a=[],u=new Map;for(const[p,d]of e.agents){if(d.parentId!=null){const g=u.get(d.parentId);g?g.push(p):u.set(d.parentId,[p])}o(d)&&a.push({id:p,endedAt:d.endedAt})}if(a.length===0)return!1;a.sort((p,d)=>p.endedAt-d.endedAt);let c=0;const f=p=>{const d=e.agents.get(p);d&&(cj(e,d),e.agents.delete(p),c++)};for(const p of a){if(e.agents.size<=r)break;if(!e.agents.has(p.id))continue;const d=(u.get(p.id)??[]).map(g=>e.agents.get(g)).filter(g=>g!=null);if(!d.some(g=>!o(g))){for(const g of d)f(g.id);f(p.id)}}return Va(e,c>0)}function yL(e,t,r,i){const o=new Map;for(const[p,d]of e.agents){let g=o.get(d.sessionId);g||(g={ids:[],endedAt:0,live:!1,closed:!1},o.set(d.sessionId,g)),g.ids.push(p),d.kind==="root"&&d.closedAt!=null&&(g.closed=!0),d.state==="done"&&d.endedAt!=null?g.endedAt=Math.max(g.endedAt,d.endedAt):g.live=!0}const a=[...o.values()].filter(p=>!p.live&&p.endedAt>0&&t-p.endedAt>i).sort((p,d)=>p.closed===d.closed?p.endedAt-d.endedAt:p.closed?-1:1);let c=[...o.values()].filter(p=>!p.live).length-r;if(c<=0)return!1;let f=!1;for(const p of a){if(c<=0)break;for(const d of p.ids){const g=e.agents.get(d);g&&cj(e,g),e.agents.delete(d)}c--,f=!0}return Va(e,f)}function wL(e,t){const r=t==null?void 0:t.payload,i=r==null?void 0:r.hook_event_name;if(i!=="PostToolUse"&&i!=="PostToolUseFailure")return!1;const o=r==null?void 0:r.tool_use_id;return typeof o=="string"&&o.length>0&&e.toolIndex.has(o)}function xL(e){let t=!1;for(const r of e.agents.values())for(const i of r.tools)i.endedAt!=null||i.outcomeGap||(i.outcomeGap=!0,t=!0);return Va(e,t)}function _L(e,t,r){let i=!1;for(const o of e.agents.values()){if(o.provider==="codex")continue;const a=e.agents.get(o.sessionId),u=(a==null?void 0:a.lastEventAt)??(a==null?void 0:a.startedAt);for(const c of o.tools){const f=Math.max(c.startedAt,u??c.startedAt);c.endedAt==null&&t-f>r&&(c.endedAt=f,c.ok=!1,c.errorPreview=c.outcomeGap?"no result reached the deck — events were dropped while the deck was paused":"session ended before this call returned",e.toolIndex.delete(c.id),e.toolOwner.delete(c.id),i=!0)}}return Va(e,i)}const p_=90*6e4;function bL(e,t,r){let i=!1;for(const o of e.agents.values()){if(o.kind!=="root")continue;const a=o.lastEventAt??o.startedAt;if(!(t-a<=r)){o.waiting&&(o.waiting=null,i=!0),o.closedAt==null&&(o.closedAt=a),o.state==="active"&&(o.state="done",o.endedAt=a,o.reaped=!0,i=!0);for(const u of e.agents.values())u.sessionId!==o.sessionId||u.kind==="root"||u.state!=="active"||(u.state="done",u.endedAt=a,i=!0);e.activeSubagentStack.delete(o.sessionId)}}return Va(e,i)}function kL(e){return e==="permission_prompt"?"permission":e==="idle_prompt"?"idle":null}const SL=new Set(["Notification","ModelObserved","ContextObserved","UsageObserved","SessionNamed"]);function EL(e,t){let r=null;for(const i of e.toolIndex.values()){const o=i.agentId?e.agents.get(i.agentId):void 0;!o||o.sessionId!==t||(!r||i.startedAt>r.startedAt)&&(r=i)}return r==null?void 0:r.explicitSubagentId}function NL(e,t,r,i,o){const a=r==="permission"?EL(e,t):void 0;return a?{kind:r,message:i,since:o,subagentId:a}:{kind:r,message:i,since:o}}function CL(e,t,r){if(e.kind!=="permission")return!0;const i=ja(t);return i==null?!0:e.subagentId!=null&&Wa(r,i)===e.subagentId}function m_(e,t){const r=t.epoch??null;if(r!==null&&r!==e.seqEpoch)e.seqEpoch=r,e.lastSeq=0;else if(t.seq<=e.lastSeq)return e;const i=t.payload??{},o=t.receivedAt,a=i.hook_event_name??"Unknown";if(a==="__clear")return{...Jv(),lastSeq:t.seq,seqEpoch:e.seqEpoch,revision:e.revision+1};e.totalEvents+=1,e.lastSeq=t.seq,e.revision+=1;const u=i.session_id??"unknown";if(!SL.has(a)){const d=e.agents.get(u);d!=null&&d.waiting&&CL(d.waiting,i,u)&&(d.waiting=null)}const c=e.agents.get(u);if(c&&o>(c.lastEventAt??0)&&(c.lastEventAt=o,c.reaped&&(c.reaped=!1,c.state="active",c.endedAt=void 0,c.closedAt=void 0)),typeof i.model_context_window=="number"&&i.model_context_window>0){const d=e.agents.get(u);d&&(d.contextWindow=i.model_context_window)}if(typeof i.approval_policy=="string"&&i.approval_policy){const d=e.agents.get(u);d&&(d.approvalPolicy=i.approval_policy)}if(typeof i.context_tokens=="number"&&i.context_tokens>=0){const d=e.agents.get(u);d&&(d.context={...d.context??d_(),currentContextTokens:i.context_tokens})}if(a==="ModelObserved"){const d=typeof i.model=="string"?i.model:null;if(d){const y=e.agents.get(u);y&&(y.model=d)}const g=i.subagentModels;if(g&&typeof g=="object")for(const[y,w]of Object.entries(g)){if(typeof w!="string")continue;const E=`${u}::${y}`,_=e.agents.get(E);_&&(_.model=w)}return e}if(a==="ContextObserved"){const d=i.context??null;if(d){const g=e.agents.get(u);if(g){const y=g.context??d_(),w=(_,b)=>typeof d[_]=="number"?d[_]:b,E=Array.isArray(d.memoryFiles)?d.memoryFiles:Array.isArray(d.claudeMdFiles)?d.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:E??y.memoryFiles}}}return e}if(a==="SessionNamed"){const d=e.agents.get(u);if(d){const g=typeof i.sessionName=="string"?i.sessionName.trim():"",y=typeof i.sessionTitle=="string"?i.sessionTitle.trim():"";g&&(d.sessionName=g),y&&(d.sessionTitle=y);const w=d.sessionName??"";d.sessionTitle&&w&&d.sessionTitle.toLowerCase()===w.toLowerCase()&&(d.sessionTitle=void 0)}return e}if(a==="UsageObserved"){const d=i.usage??null;if(d){const g=e.agents.get(u);if(g){g.usage.inputTokens=Number(d.input_tokens??0),g.usage.outputTokens=Number(d.output_tokens??0),g.usage.cacheReadTokens=Number(d.cache_read_input_tokens??d.cached_input_tokens??0),g.usage.cacheCreateTokens=Number(d.cache_creation_input_tokens??d.cache_write_input_tokens??0);const y=Ty(d);g.usage.cacheCreate1hTokens=y.cacheCreate1hTokens,g.usage.cacheCreate5mTokens=y.cacheCreate5mTokens,typeof d.reasoning_output_tokens=="number"&&(g.usage.reasoningOutputTokens=Number(d.reasoning_output_tokens)),g.usageByModel=aL(i.usageByModel)}}return e}const f=uL(e,i,o);f.provider||(f.provider=i.provider==="codex"?"codex":"claude");const p=lj(i);switch(p&&(f.model=p),a){case"SessionStart":{const d=po(e,u,o,!1);d.synthetic=!1,d.state="active",d.closedAt=void 0,d.startedAt=d.startedAt||o,!d.cwd&&i.cwd&&(d.cwd=i.cwd,d.cwdBasename=Ss(i.cwd)),d.label==="session"&&i.cwd&&(d.label=Ss(i.cwd)??"session");break}case"UserPromptSubmit":{for(const y of e.agents.values())y.sessionId===u&&y.kind==="subagent"&&y.state==="done"&&y.exitAt==null&&y.endedAt!=null&&y.endedAt<o&&(y.exitAt=o);const d=po(e,u,o,!1);d.state="active",d.endedAt=void 0,d.closedAt=void 0,d.exitAt=void 0;const g=(typeof i.prompt=="string"?i.prompt:typeof i.message=="string"?i.message:"")??"";g&&!gL(d,o,g)&&(d.prompts.push({at:o,text:g}),d.firstPrompt||(d.firstPrompt=mu(g,120)));break}case"PreToolUse":{const d=i.tool_use_id?mL(e,f,i.tool_use_id):null;if(d){i.tool_name&&d.name==="?"&&(d.name=i.tool_name),d.endedAt==null&&!d.trimmed&&i.tool_input!==void 0&&(d.input=i.tool_input,d.inputPreview=mu(i.tool_input));break}const g=i.tool_use_id??`${f.id}:${f.toolCount}`,y=ja(i),w={id:g,name:i.tool_name??"?",input:i.tool_input,inputPreview:mu(i.tool_input),agentId:f.id,explicitSubagentId:y?Wa(u,y):void 0,startedAt:o};f.tools.push(w),f.toolCount+=1,f.state="active",e.toolIndex.set(g,w),e.toolOwner.set(g,f.id),pL(e,f);break}case"PostToolUse":case"PostToolUseFailure":{const d=i.tool_use_id;if(!d)break;let g=e.toolIndex.get(d),y=!1;if(!g)for(const E of e.agents.values()){const _=E.tools.find(b=>b.id===d);if(_){g=_,y=!0;break}}if(!g||g.outcomeApplied)break;g.outcomeApplied=!0,g.outcomeGap=void 0,g.endedAt=o,g.ok=a==="PostToolUse",g.trimmed||(g.response=i.tool_response),a==="PostToolUseFailure"?g.errorPreview=mu(i.tool_response):y&&(g.errorPreview=void 0);const w=aj(i.tool_response);w&&(g.usage=w),e.toolIndex.delete(d),e.toolOwner.delete(d);break}case"SubagentStart":{const d=ja(i);if(!d)break;const g=cL(e,u,d,i,o);g.state="active",g.startedAt=g.startedAt||o,g.exitAt=void 0,g.endedAt=void 0;const y=Du(i);y&&(g.label=y),dL(e,u,d);break}case"SubagentStop":{const d=ja(i);if(!d)break;const g=uj(e,u,d,i);if(!g)break;g.state="done",g.endedAt=o,fL(e,u,d);break}case"Stop":case"SessionEnd":{const d=po(e,u,o,!1);d.state="done",d.endedAt=o,a==="SessionEnd"&&(d.closedAt=o),e.activeSubagentStack.delete(u);break}case"Notification":{const d=kL(i.notification_type);if(!d)break;const g=po(e,u,o,!1),y=typeof i.message=="string"?i.message:"",w=g.waiting;g.waiting=w&&w.kind===d&&w.message===y?{...w,since:Math.min(w.since,o)}:NL(e,u,d,y,o);break}}return e}function Ry(e){let t=5381;for(let r=0;r<e.length;r++)t=(t<<5)+t^e.charCodeAt(r);return Math.abs(t)%360}const jL=Date.UTC(2026,8,1);function TL(e){return e<jL?{input:2,output:10,cacheRead:.2,cacheWrite:2.5,cacheWrite1h:4}:{input:3,output:15,cacheRead:.3,cacheWrite:3.75,cacheWrite1h:6}}const RL=[{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:TL},{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 AL(e){return e?/^(?:gpt[-_]|codex[-_]|o\d)/i.test(e):!1}function No(e,t=Date.now()){if(!e)return null;const r=Ju(e);for(const i of RL)if(i.match.test(r))return typeof i.rates=="function"?i.rates(t):i.rates;return null}function dj(e,t){const r=Math.max(0,e.cacheCreate1hTokens??0),i=Math.max(0,e.cacheCreate5mTokens??0),o=Math.max(0,e.cacheCreateTokens-r-i),a=i+o,u=t.cacheWrite1h??t.cacheWrite;return{tokens5m:a,tokens1h:r,usd5m:a*t.cacheWrite/1e6,usd1h:r*u/1e6}}function fj(e,t,r=Date.now()){if(!AL(t))return e.inputTokens;const i=No(t,r),o=((i==null?void 0:i.cacheWrite)??0)>0?Math.max(0,e.cacheCreateTokens):0;return Math.max(0,e.inputTokens-e.cacheReadTokens-o)}function Ay(e,t,r=Date.now()){const i=No(t,r);if(!i)return{input:0,output:0,cacheRead:0,cacheWrite:0,total:0};const o=fj(e,t,r)*i.input/1e6,a=e.outputTokens*i.output/1e6,u=e.cacheReadTokens*i.cacheRead/1e6,c=dj(e,i),f=c.usd5m+c.usd1h;return{input:o,output:a,cacheRead:u,cacheWrite:f,total:o+a+u+f}}const g_=2e5,IL=1e6,ML=[/\[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],OL=[{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 PL(e){if(!e)return g_;const t=Ju(e);for(const r of ML)if(r.test(t))return IL;for(const r of OL)if(r.match.test(t))return r.window;return g_}function hj(e,t){return typeof e=="number"&&e>0?e:PL(t)}const ju="not priced";function Ge(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 Fu(e,t){if(e<=0||t<10)return null;const r=e/t,i=r*60;return i>=.01?`${Ge(i)}/min`:`${Ge(r*3600)}/hr`}function LL(e,t){const r={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)&&(r.cacheCreate1hTokens=(e.cacheCreate1hTokens??0)+(t.cacheCreate1hTokens??0),r.cacheCreate5mTokens=(e.cacheCreate5mTokens??0)+(t.cacheCreate5mTokens??0)),(e.reasoningOutputTokens!==void 0||t.reasoningOutputTokens!==void 0)&&(r.reasoningOutputTokens=(e.reasoningOutputTokens??0)+(t.reasoningOutputTokens??0)),r}function $L(e,t){let r=0,i=0,o=0,a=0,u=0,c=0;for(const g of t)r+=g.inputTokens,i+=g.outputTokens,o+=g.cacheReadTokens,a+=g.cacheCreateTokens,u+=g.cacheCreate1hTokens??0,c+=g.cacheCreate5mTokens??0;const f=(g,y)=>Math.max(0,g-y),p={inputTokens:f(e.inputTokens,r),outputTokens:f(e.outputTokens,i),cacheReadTokens:f(e.cacheReadTokens,o),cacheCreateTokens:f(e.cacheCreateTokens,a)};return(e.cacheCreate1hTokens!==void 0||e.cacheCreate5mTokens!==void 0)&&(p.cacheCreate1hTokens=f(e.cacheCreate1hTokens??0,u),p.cacheCreate5mTokens=f(e.cacheCreate5mTokens??0,c)),p.inputTokens+p.outputTokens+p.cacheReadTokens+p.cacheCreateTokens>0?p:null}function Ga(e){const t=e.usageByModel,r=t?Object.keys(t):[];if(!t||r.length===0)return[{model:e.model,usage:e.usage}];const i=r.map(a=>({model:a,usage:t[a]})),o=$L(e.usage,i.map(a=>a.usage));if(o){const a=i.findIndex(u=>u.model===e.model);a>=0?i[a]={model:i[a].model,usage:LL(i[a].usage,o)}:i.push({model:e.model,usage:o})}return i}function gn(e,t=Date.now()){const r={input:0,output:0,cacheRead:0,cacheWrite:0,total:0};for(const i of Ga(e)){const o=Ay(i.usage,i.model,t);r.input+=o.input,r.output+=o.output,r.cacheRead+=o.cacheRead,r.cacheWrite+=o.cacheWrite,r.total+=o.total}return r}function ey(e,t=Date.now()){let r=0;for(const i of Ga(e))No(i.model,t)==null&&(r+=i.usage.inputTokens+i.usage.outputTokens);return r}function pj(e){const t=[];for(const r of Ga(e)){if(!r.model||t.includes(r.model))continue;const i=r.usage;i.inputTokens+i.outputTokens+i.cacheReadTokens+i.cacheCreateTokens<=0||t.push(r.model)}return t}function mj(e){return pj(e).filter(t=>t!==e.model)}const qL=new Set(["untrusted","on-request","on-failure"]);function DL(e){return typeof e!="string"||!e?null:qL.has(e)?!0:e==="never"?!1:null}function FL(e){if(e.provider!=="codex"||e.kind!=="root"||e.waiting||e.state!=="active")return null;const t=DL(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 v_(e){return e[0].toUpperCase()+e.slice(1).toLowerCase()}function mi(e){const t=Ju(e).replace(/[-_]\d{8}(?!\d)/,""),r=t.match(/^claude[-_](opus|sonnet|haiku|fable|mythos)[-_](\d+(?:[-_.]\d+)*)/i);if(r){const o=v_(r[1]),a=r[2].replace(/[-_]/g,".");return`${o} ${a}`}const i=t.match(/^gpt[-_](\d+(?:[-_.]\d+)*)((?:[-_][A-Za-z0-9.]+)*)$/i);if(i){const o=i[1].replace(/[-_]/g,"."),a=i[2].split(/[-_]/).filter(Boolean).map(v_);return[`GPT-${o}`,...a].join(" ")}return e}function Rt(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 zu(e,t,r){const i=(t??r)-e;if(i<1e3)return`${Math.max(0,i)}ms`;const o=Math.floor(i/1e3);if(o<60)return`${o}s`;const a=Math.floor(o/60),u=o%60;return`${a}m ${String(u).padStart(2,"0")}s`}function gj(e,t){if(e.endedAt==null)return t;const r=e.endedAt-e.startedAt;return r<1e3?`${r}ms`:`${(r/1e3).toFixed(2)}s`}function vj(e,t){const r=typeof e=="string"?e.trim():"",i=typeof t=="string"?t.trim():"";return{face:r||i||void 0,tooltip:i||r||void 0}}const zL=1,yj=-1;function BL(){const e=[];let t=0;function r(){let i;for(const o of e)(!i||o.layer>i.layer||o.layer===i.layer&&o.seq>i.seq)&&(i=o);return i}return{push(i,o=0){const a={dismiss:i,layer:o,seq:t++};return e.push(a),()=>{const u=e.indexOf(a);u!==-1&&e.splice(u,1)}},dismissTop(){const i=r();return i?(i.dismiss(),!0):!1},isTop(i){const o=r();return o!=null&&o.dismiss===i},depth(){return e.length},topIsPanel(){const i=r();return i!=null&&i.layer===yj}}}const yo=BL();function UL(e){return e.overlayOpen&&!e.panelOnTop?"dismiss":e.typing?"blur":e.overlayOpen?"dismiss":"clear-selection"}function y_(e){return String(e.tagName??"").toUpperCase()==="BODY"}function HL(e,t){return!e||!e.isConnected||y_(e)?!1:t==null||y_(t)}const w_="a[href], button, input, select, textarea, [tabindex]";function WL(e){return!e||e.disabled||e.rendered===!1?!1:(e.tabIndex??0)>=0}function VL(e){if(!e||!e.overflowing||e.hasFocusable)return!1;const t=String(e.overflow??"").toLowerCase();return t==="auto"||t==="scroll"}function GL({count:e,index:t,shiftKey:r}){return e<=0?{kind:"hold"}:t<0||t>=e?{kind:"focus",index:r?e-1:0}:!r&&t===e-1?{kind:"focus",index:0}:r&&t===0?{kind:"focus",index:e-1}:{kind:"allow"}}function Iy(e){return e.ctrlKey||e.metaKey||e.altKey}const YL=new Set(["button","checkbox","color","file","image","radio","range","reset","submit"]),KL=new Set(["INPUT","TEXTAREA","SELECT","OPTION","BUTTON","SUMMARY","A"]),XL=new Set(["button","checkbox","combobox","link","listbox","menu","menubar","menuitem","menuitemcheckbox","menuitemradio","option","radio","searchbox","slider","spinbutton","switch","tab","textbox","treeitem"]);function wj(e){return typeof e.tagName=="string"?e.tagName.toUpperCase():""}function My(e){if(!e)return!1;if(e.isContentEditable)return!0;const t=wj(e);return t==="TEXTAREA"?!0:t!=="INPUT"?!1:!YL.has(String(e.type??"text").toLowerCase())}function QL(e){if(!e)return!1;if(My(e)||KL.has(wj(e)))return!0;const t=typeof e.role=="string"?e.role.trim().toLowerCase():"";return t!==""&&t.split(/\s+/).some(r=>XL.has(r))}function ZL({key:e,modalOpen:t,sheetOpen:r}){return t?!(e==="?"&&r):!1}function xj(e){return e?Array.from(e.querySelectorAll("*")).filter(t=>{if(t.matches(w_))return WL({disabled:t.disabled,tabIndex:t.tabIndex,rendered:t.getClientRects().length>0});const r=t.scrollHeight>t.clientHeight;return r&&VL({overflowing:r,overflow:getComputedStyle(t).overflowY,hasFocusable:t.querySelector(w_)!=null})}):[]}function JL(e,t){const r=xj(e);if(!t||!e.contains(t)||r.includes(t))return r;const i=r.findIndex(o=>(t.compareDocumentPosition(o)&Node.DOCUMENT_POSITION_FOLLOWING)!==0);return i===-1?[...r,t]:[...r.slice(0,i),t,...r.slice(i)]}function gi(e,t={}){const{focusRef:r,layer:i}=t,o=C.useRef(null),a=C.useRef(e);a.current=e;const u=C.useRef(null);u.current===null&&(u.current=()=>a.current());const c=u.current;return C.useEffect(()=>yo.push(c,i),[c,i]),C.useEffect(()=>{var p;const f=document.activeElement;return(p=(r==null?void 0:r.current)??xj(o.current)[0])==null||p.focus(),()=>{HL(f,document.activeElement)&&f.focus()}},[]),C.useEffect(()=>{const f=p=>{var _;if(p.key!=="Tab"||Iy(p))return;const d=o.current;if(!d)return;const g=document.activeElement;if(!(g!=null&&d.contains(g))&&!yo.isTop(c))return;const w=JL(d,g),E=GL({count:w.length,index:g?w.indexOf(g):-1,shiftKey:p.shiftKey});E.kind!=="allow"&&(p.preventDefault(),E.kind==="focus"&&((_=w[E.index])==null||_.focus()))};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[c]),o}function e$(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 Pn(e){return e.toLocaleString()}function t$(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(2)} MB`}const n$=60;function r$(e,t=n$){if(e.length<=t)return e;const r=e.slice(e.length-(t-1)),i=r.search(/[/\\]/);return"…"+(i===-1?r:r.slice(i))}function s$({agent:e,onClose:t}){var y;const r=C.useRef(null),i=gi(t,{focusRef:r}),o=e.context,a=e.usage,u=(o==null?void 0:o.currentContextTokens)??0,c=hj(e.contextWindow,e.model),f=Math.min(100,u/c*100),p=gn(e),d=a.inputTokens+a.cacheReadTokens+a.cacheCreateTokens,g=e$(e.provider);return m.jsx("div",{className:"ctx-modal-backdrop",onClick:t,role:"presentation",children:m.jsxs("div",{ref:i,className:"ctx-modal",onClick:w=>w.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Context breakdown",children:[m.jsxs("header",{className:"ctx-modal-head",children:[m.jsxs("div",{children:[m.jsxs("div",{className:"ctx-modal-title",children:["Context · ",e.label]}),m.jsx("div",{className:"ctx-modal-sub",children:g.subtitle})]}),m.jsx("button",{type:"button",ref:r,className:"glyph-btn ctx-modal-close",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),m.jsxs("section",{className:"ctx-window-row",children:[m.jsx("div",{className:"ctx-window-bar",role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(f),children:m.jsx("div",{className:"ctx-window-fill",style:{width:`${f}%`}})}),m.jsxs("div",{className:"ctx-window-meta",children:[m.jsxs("span",{className:"ctx-window-pct",children:[f.toFixed(1),"%"]}),m.jsxs("span",{children:[Pn(u)," / ",Pn(c)," tok (",g.windowScope,")"]})]})]}),m.jsx("h3",{className:"ctx-section-title",children:"Cumulative usage · whole session"}),m.jsxs("div",{className:"ctx-grid",children:[m.jsx(Jn,{label:"input tokens",val:Pn(a.inputTokens)}),m.jsx(Jn,{label:"output tokens",val:Pn(a.outputTokens)}),m.jsx(Jn,{label:"cache reads",val:Pn(a.cacheReadTokens)}),m.jsx(Jn,{label:"cache writes",val:Pn(a.cacheCreateTokens)}),m.jsx(Jn,{label:"cumulative total",val:Pn(d)}),m.jsx(Jn,{label:"estimated cost",val:Ge(p.total),accent:!0})]}),m.jsx("h3",{className:"ctx-section-title",children:"Transcript composition"}),g.compositionCounted?m.jsxs("div",{className:"ctx-grid",children:[m.jsx(Jn,{label:"user messages",val:Pn((o==null?void 0:o.msgsUser)??0)}),m.jsx(Jn,{label:"assistant messages",val:Pn((o==null?void 0:o.msgsAssistant)??0)}),m.jsx(Jn,{label:"tool uses",val:Pn((o==null?void 0:o.toolUses)??0)}),m.jsx(Jn,{label:"tool results",val:Pn((o==null?void 0:o.toolResults)??0)}),m.jsx(Jn,{label:"system-reminders",val:Pn((o==null?void 0:o.systemReminders)??0)})]}):m.jsx("div",{className:"ctx-empty",children:g.compositionUncounted}),m.jsx("h3",{className:"ctx-section-title",children:g.memoryHeading}),(((y=o==null?void 0:o.memoryFiles)==null?void 0:y.length)??0)===0?m.jsx("div",{className:"ctx-empty",children:g.memoryEmpty}):m.jsx("ul",{className:"ctx-md-list",children:o.memoryFiles.map(w=>m.jsxs("li",{children:[m.jsx("span",{className:"ctx-md-path",title:w.path,children:r$(w.path)}),m.jsx("span",{className:"ctx-md-size",children:t$(w.bytes)})]},w.path))})]})})}function Jn({label:e,val:t,accent:r}){return m.jsxs("div",{className:`ctx-row${r?" accent":""}`,children:[m.jsx("span",{className:"ctx-row-label",children:e}),m.jsx("span",{className:"ctx-row-val",children:t})]})}function i$({currentContextTokens:e,modelId:t,contextWindow:r,size:i=26,onClick:o,title:a}){const u=hj(r,t),c=Math.min(1,e/u),f=i/2-3,p=i/2,d=2*Math.PI*f,g=d*c,y=c>.9?"var(--err)":c>.7?"var(--inflight)":"var(--accent)";return m.jsx("button",{type:"button",className:"ctx-donut",onClick:o,title:a??`context: ${e.toLocaleString()} / ${u.toLocaleString()} (${(c*100).toFixed(1)}%)`,"aria-label":"Show context breakdown",children:m.jsxs("svg",{width:i,height:i,viewBox:`0 0 ${i} ${i}`,children:[m.jsx("circle",{cx:p,cy:p,r:f,stroke:"var(--line)",strokeWidth:"2.5",fill:"none"}),m.jsx("circle",{cx:p,cy:p,r:f,stroke:y,strokeWidth:"2.5",fill:"none",strokeDasharray:`${g} ${d-g}`,strokeDashoffset:d/4,strokeLinecap:"round",style:{transition:"var(--ctx-arc-transition)"}}),m.jsx("text",{x:p,y:p+3,textAnchor:"middle",fontSize:"8",fill:"var(--text)",fontWeight:"600",children:Math.round(c*100)})]})})}function x_(e,t){const r=No(t);if(!r)return`model: ${t}
60
- no published rate in this build — the tokens are counted, the dollars are not`;const i=d=>d.toLocaleString(),o=d=>`$${d}/MTok`,a=Ay(e,t),u=dj(e,r),c=u.tokens1h>0?[`cache w5m${i(u.tokens5m).padStart(14)} × ${o(r.cacheWrite).padEnd(11)} = ${Ge(u.usd5m)}`,`cache w1h${i(u.tokens1h).padStart(14)} × ${o(r.cacheWrite1h??r.cacheWrite).padEnd(11)} = ${Ge(u.usd1h)}`]:[`cache w ${i(u.tokens5m).padStart(14)} × ${o(r.cacheWrite).padEnd(11)} = ${Ge(u.usd5m)}`],f=fj(e,t),p=f===e.inputTokens?"input":"uncached";return[`model: ${t}`,`${p.padEnd(9)}${i(f).padStart(14)} × ${o(r.input).padEnd(11)} = ${Ge(a.input)}`,`output ${i(e.outputTokens).padStart(14)} × ${o(r.output).padEnd(11)} = ${Ge(a.output)}`,`cache r ${i(e.cacheReadTokens).padStart(14)} × ${o(r.cacheRead).padEnd(11)} = ${Ge(a.cacheRead)}`,...c,"─────────────────────────────────────────",`total = ${Ge(a.total)}`].join(`
61
- `)}function __(e){const t=Ga(e);return t.length<=1?x_(e.usage,e.model):[...t.map(r=>x_(r.usage,r.model)),"═════════════════════════════════════════",`all models = ${Ge(gn(e).total)}`].join(`
62
- `)}function o$({data:e,selected:t}){var y;const r=e.now??Date.now(),i=["agent-node",`state-${e.state}`,e.synthetic?"synthetic":"",t?"selected":""].filter(Boolean).join(" "),o=e.tools.filter(w=>!w.endedAt).length,a=Ry(e.sessionId),u=((y=e.context)==null?void 0:y.currentContextTokens)??0,c=e.kind==="root"&&u>0,f=e.sessionTitle?e.cwd?`${e.cwd}
63
- ${e.sessionTitle}`:e.sessionTitle:e.cwd,p=mj(e),d=p.length>0?`${e.model}
64
- spend on this card also covers:
65
- ${p.join(`
66
- `)}`:e.model,g=vj(e.sessionName,e.sessionTitle);return m.jsxs("div",{className:i,style:{"--session-hue":a},children:[m.jsx("span",{className:"accent-stripe"}),m.jsx(ko,{type:"target",position:Re.Left,style:{background:"transparent",border:"none"}}),m.jsxs("div",{className:"head",children:[m.jsxs("div",{className:"title",children:[m.jsx(a$,{state:e.state}),m.jsx("span",{className:"label",title:f,children:e.label}),e.synthetic&&m.jsx("span",{className:"synth-tag",title:"No SessionStart captured — synthesised",children:"?"})]}),m.jsxs("div",{className:"head-right",children:[c&&e.onOpenContext&&m.jsx(i$,{currentContextTokens:u,modelId:e.model,contextWindow:e.contextWindow,onClick:()=>e.onOpenContext(e.sessionId)}),m.jsx("div",{className:"time",title:`Started ${new Date(e.startedAt).toLocaleTimeString()}`,children:zu(e.startedAt,e.endedAt,r)})]})]}),m.jsxs("div",{className:"sub",children:[e.kind==="root"?"session":"subagent",e.childCount>0&&m.jsxs("span",{className:"spawn-badge",title:`${e.childCount} subagents spawned`,children:["→ ",e.childCount]}),e.cwdBasename&&e.kind==="subagent"?` · ${e.cwdBasename}`:"",e.model?m.jsxs("span",{className:"model-chip",title:d,children:[mi(e.model),p.length>0?` +${p.length}`:""]}):e.provider==="codex"?m.jsx("span",{className:"model-chip",title:"OpenAI Codex — no model reported yet",children:"Codex"}):null]}),e.kind==="root"&&g.face&&m.jsx("div",{className:"session-name",title:g.tooltip,children:g.face}),e.waiting&&m.jsx(u$,{waiting:e.waiting,now:r}),(()=>{const w=FL(e);return w?m.jsxs("div",{className:"approval-blind-row",title:w.detail,children:[m.jsx("span",{className:"approval-blind-dot","aria-hidden":!0}),m.jsx("span",{className:"approval-blind-said",children:w.label})]}):null})(),e.tools.length>0&&m.jsx(c$,{tools:e.tools,now:r}),m.jsxs("div",{className:"meta",children:[m.jsxs("span",{children:[m.jsx("b",{children:e.toolCount})," tools"]}),o>0&&m.jsxs("span",{className:"inflight-meta",children:[m.jsx("b",{children:o})," in-flight"]}),e.usage.inputTokens+e.usage.outputTokens>0&&m.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:[m.jsx("b",{children:Rt(e.usage.inputTokens+e.usage.outputTokens)})," tok"]}),e.model&&(()=>{const w=No(e.model),E=gn(e),_=ey(e);if(!w&&E.total<=0)return e.usage.inputTokens+e.usage.outputTokens<=0?null:m.jsx("span",{className:"cost-unpriced",title:__(e),children:ju});if(E.total<=0)return null;const b=Math.max(0,((e.endedAt??r)-e.startedAt)/1e3),k=e.state==="active"?Fu(E.total,b):null,S=__(e)+(k?`
67
- burn: ${k}`:"");return m.jsxs("span",{className:"cost-meta",title:S,children:[m.jsxs("b",{children:[Ge(E.total),_>0?"+":""]}),k&&m.jsx("span",{className:"cost-rate",children:k})]})})()]}),m.jsx(ko,{type:"source",position:Re.Right,style:{background:"transparent",border:"none"}})]})}function Oy(e){return e==="active"?"live":e==="done"?"done":"err"}function a$({state:e}){return m.jsx("span",{className:`state-pill state-${e}`,children:Oy(e)})}function ec(e){return e.message?e.message:e.kind==="permission"?"Needs your permission":"Waiting for your input"}function l$(e){return e.kind==="permission"?ec(e):"Your turn"}function u$({waiting:e,now:t}){const r=e.kind==="permission",i=ec(e);return m.jsxs("div",{className:r?"waiting-row permission":"waiting-row idle",title:`${i}
68
- Blocked for ${zu(e.since,void 0,t)} — the answer goes in the terminal, not here.`,children:[r?m.jsx("span",{className:"ap-pulse","aria-hidden":!0}):m.jsx("span",{className:"waiting-dot","aria-hidden":!0}),m.jsx("span",{className:"waiting-said",children:l$(e)}),m.jsx("b",{children:zu(e.since,void 0,t)})]})}function c$({tools:e,now:t}){const a=new Array(24).fill(0);let u=0;for(const y of e){const w=t-y.startedAt;if(w<0||w>=6e4)continue;const E=23-Math.floor(w/2500);E>=0&&E<24&&(a[E]+=1,u+=1)}const c=Math.max(1,...a),f=132,p=14,d=f/24,g=c/(2500/1e3);return m.jsxs("div",{className:"tool-spark-row",title:`${u} tool calls in last 60s · peak ${g.toFixed(1)}/s`,children:[m.jsx("svg",{className:"tool-spark",width:f,height:p,viewBox:`0 0 ${f} ${p}`,"aria-hidden":!0,children:a.map((y,w)=>{const E=y===0?1.5:Math.max(1.5,y/c*p),_=w===23&&y>0,k=`tool-spark-bar${y>0?" active":""}${_?" latest":""}`;return m.jsx("rect",{x:w*d+.4,y:p-E,width:Math.max(.5,d-1),height:E,rx:.8,className:k},w)})}),m.jsx("span",{className:"tool-spark-label",children:"60s"})]})}function b_(e){if(e==null)return"(none)";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function d$({tool:e,onClose:t}){const r=gi(t),i=e.endedAt==null?"inflight":e.ok===!1?"err":"done";return m.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:m.jsxs("div",{ref:r,className:"modal",onClick:o=>o.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"tool-modal-title",children:[m.jsxs("header",{className:"modal-head",children:[m.jsxs("div",{className:"modal-title",children:[m.jsx("span",{className:`status-dot ${i}`,"aria-hidden":!0}),m.jsx("span",{id:"tool-modal-title",className:"modal-tool-name",children:e.name}),m.jsxs("span",{className:"modal-tool-id",title:e.id,children:[e.id.slice(0,12),"…"]})]}),m.jsxs("div",{className:"modal-actions",children:[m.jsx("span",{className:"modal-dur",children:gj(e,"in-flight…")}),m.jsx("button",{className:"glyph-btn",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),m.jsxs("section",{className:"modal-body",children:[e.trimmed&&m.jsx("div",{className:"modal-section",children:m.jsx("p",{className:"modal-note",children:"Full payloads for this call were released to keep memory bounded — only the previews below are still held."})}),m.jsxs("div",{className:"modal-section",children:[m.jsx("h4",{children:"Input"}),m.jsx("pre",{children:b_(e.input??e.inputPreview)})]}),m.jsxs("div",{className:"modal-section",children:[m.jsxs("h4",{children:["Response ",i==="err"&&m.jsx("span",{className:"err-tag",children:"error"})]}),m.jsx("pre",{children:e.endedAt==null?"(waiting…)":b_(e.response??e.errorPreview)})]})]})]})})}const gu=18,k_=26,f$=12;function h$(e){return p$(e.nodeInternals.values())}function p$(e){const t=new Map;for(const o of e){if(o.type!=="agent")continue;const a=o.data;if(!(a!=null&&a.sessionId)||a.exitAt!=null||o.width==null||o.height==null)continue;const u=o.position.x,c=o.position.y,f=u+o.width,p=c+o.height,d=t.get(a.sessionId);d?(d.minX=Math.min(d.minX,u),d.minY=Math.min(d.minY,c),d.maxX=Math.max(d.maxX,f),d.maxY=Math.max(d.maxY,p),a.kind==="root"&&(d.label=E_(a)??d.label),a.kind==="root"&&(d.name=N_(a))):t.set(a.sessionId,{minX:u,minY:c,maxX:f,maxY:p,label:E_(a)??a.sessionId,name:N_(a)})}const r=new Map;for(const o of t.values())r.set(o.label,(r.get(o.label)??0)+1);const i=[];for(const[o,a]of t){const u=(r.get(a.label)??0)>1;i.push({sessionId:o,...y$(a.label,a.name,o,u),x:a.minX-gu,y:a.minY-gu-k_,w:a.maxX-a.minX+gu*2,h:a.maxY-a.minY+gu*2+k_})}return i}const ty=" · ",m$=32,g$=/[\u1100-\u115F\u2E80-\u303E\u3041-\u33FF\u3400-\u4DBF\u4E00-\u9FFF\uA000-\uA4CF\uAC00-\uD7A3\uF900-\uFAFF\uFE30-\uFE6F\uFF00-\uFF60\uFFE0-\uFFE6]/;function S_(e){return g$.test(e)?2:1}function v$(e,t=m$){const r=[...e];let i=0;for(const u of r)i+=S_(u);if(i<=t)return e;const o=[];let a=0;for(const u of r){const c=S_(u);if(a+c>t-1)break;o.push(u),a+=c}for(;o.length&&/[\s\-_.:/]/.test(o[o.length-1]);)o.pop();return`${o.join("")}…`}function y$(e,t,r,i){const o=(t==null?void 0:t.trim())??"",a=i?w$(r):void 0,u=[e,o||void 0,a].filter(Boolean);return{label:e,name:o?v$(o):void 0,shortId:a,fullLabel:u.join(ty)}}function w$(e){const t=e.match(/[a-zA-Z0-9]{4}/);return t?t[0]:e.slice(0,4)}function E_(e){if(e.kind==="root")return e.label}function N_(e){if(e.kind==="root")return vj(e.sessionName,e.sessionTitle).face}function x$(){const{x:e,y:t,zoom:r}=tj(),i=Ha(),o=rt(h$,_$);if(o.length<=1)return null;const a=c=>{try{const f=i.getNodes().filter(p=>{const d=p.data;return(d==null?void 0:d.sessionId)===c});if(f.length===0)return;i.fitView({padding:.3,duration:500,nodes:f})}catch{}},u={transform:`translate(${e}px, ${t}px) scale(${r})`};return m.jsx("div",{className:"session-clusters",style:u,children:o.map(c=>{const f=Ry(c.sessionId),p={position:"absolute",left:c.x,top:c.y,width:c.w,height:c.h,"--session-hue":f},d={position:"absolute",left:c.x+16,top:c.y-f$,transform:`scale(${Math.min(1,r)/(r||1)})`,transformOrigin:"left top","--session-hue":f};return m.jsxs(ae.Fragment,{children:[m.jsx("div",{className:"cluster-card",style:p,"aria-hidden":!0}),m.jsxs("button",{type:"button",className:"cluster-label",style:d,title:`Fit view to ${c.fullLabel}
69
- drag the wrapper to move the whole session`,onClick:()=>a(c.sessionId),children:[c.label,c.name?m.jsxs(m.Fragment,{children:[ty,m.jsx("span",{className:"cluster-label-name",children:c.name})]}):null,c.shortId?ty+c.shortId:null]})]},c.sessionId)})})}function _$(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++){const i=e[r],o=t[r];if(i.sessionId!==o.sessionId||i.label!==o.label||i.name!==o.name||i.shortId!==o.shortId||i.fullLabel!==o.fullLabel||i.x!==o.x||i.y!==o.y||i.w!==o.w||i.h!==o.h)return!1}return!0}function b$({data:e}){return m.jsx("div",{className:"session-group-handle",style:{width:(e==null?void 0:e.w)??0,height:(e==null?void 0:e.h)??0}})}const Ya={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"}},k$=Object.fromEntries(Object.entries(Ya).map(([e,t])=>[e,t.category])),S$=Object.fromEntries(Object.entries(Ya).map(([e,t])=>[e,t.emoji])),E$=Object.fromEntries(Object.entries(Ya).map(([e,t])=>[e,t.label])),N$=new Set(Object.keys(Ya)),C$=new Set(Object.entries(Ya).filter(([,e])=>e.shell).map(([e])=>e)),C_={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",...k$};function _j(e){return e.startsWith("mcp__")?"mcp":Object.hasOwn(C_,e)?C_[e]:"other"}const j$=/\btools\.exec_command\s*\(\s*\{[^{}]*?\bcmd\s*:\s*(["'`])((?:\\.|(?!\1)[^\\])*)\1/,T$=/\btools\.([A-Za-z_$][\w$]*)\s*\(/;function R$(e){if(typeof e!="string"||!e)return null;const t=j$.exec(e);if(t){const i=A$(t[2]);if(i.trim())return i}const r=T$.exec(e);return r?r[1]:null}function A$(e){return e.replace(/\\(["'`\\nrt])/g,(t,r)=>r==="n"?`
70
- `:r==="r"?"\r":r==="t"?" ":r)}const bj=600,I$=4,M$=36,ny=16,O$=60,P$=6,j_=220,T_=96,L$=28,R_={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:"📡",...S$};function A_(e){return e.startsWith("mcp__")?"🔌":Object.hasOwn(R_,e)?R_[e]:"✨"}const I_={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 kj(e){if(!e)return null;let t=e.trim();if(!t)return null;const r=t.match(/^(?:bash|sh|zsh|fish|powershell|pwsh)(?:\.exe)?\s+(?:-c|-Command|-NoProfile|-NonInteractive|\s)+["']([^"']+)["']/i);if(r)return kj(r[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 i=t.match(/^([^\s|;&<>(]+)/);if(!i)return null;let o=i[1];return o=o.replace(/^.*[/\\]/,""),o=o.replace(/\.(exe|cmd|bat|ps1)$/i,""),o||null}function $$(e){if(typeof e=="string")return e;if(!e||typeof e!="object")return null;const t=e;if(typeof t.script=="string"){const r=R$(t.script);if(r)return r}if(typeof t.cmd=="string")return t.cmd;if(typeof t.command=="string")return t.command;if(Array.isArray(t.command)&&t.command.every(r=>typeof r=="string")){const r=t.command;if(/powershell|cmd|bash|sh(\.exe)?$/i.test(r[0]??"")){const i=r.findIndex(o=>/^(-Command|-c)$/i.test(o));if(i>=0&&i+1<r.length)return r[i+1]}return r.join(" ")}return typeof t.script=="string"?t.script:null}const q$=new Set(["Bash","PowerShell",...C$]),D$=N$;function F$(e,t){return D$.has(e)||e.startsWith("mcp__")?Math.max(T_,34+t.length*7.5):T_}function z$(e,t){if(!q$.has(e))return null;const r=$$(t);if(!r)return null;const i=kj(r);return i?{emoji:Object.hasOwn(I_,i)?I_[i]:"⚙️",label:i,category:"shell",detail:r}:null}const B$=new Set(["Read","Write","Edit","MultiEdit","NotebookEdit","LS","Glob","apply_patch"]),M_={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:"🗄️"},O_={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 U$(e){const r=e.replace(/\\/g,"/").replace(/\/+$/,""),i=r.lastIndexOf("/");return i>=0?r.slice(i+1):r}function H$(e){const t=e.toLowerCase();if(Object.hasOwn(O_,t))return O_[t];if(t.startsWith("dockerfile."))return"🐳";if(/\.(test|spec)\.[a-z]+$/.test(t))return"🧪";const r=t.lastIndexOf(".");if(r>0&&r<t.length-1){const i=t.slice(r+1);if(Object.hasOwn(M_,i))return M_[i]}return"📄"}function W$(e,t){if(!t||typeof t!="object")return null;const r=t;if(e==="apply_patch"&&typeof r.patch=="string"){const i=r.patch.match(/^\*\*\* (?:Update|Add|Delete) File: (.+)$/m);return i?i[1].trim():null}return typeof r.file_path=="string"?r.file_path:typeof r.notebook_path=="string"?r.notebook_path:typeof r.path=="string"?r.path:e==="Glob"&&typeof r.pattern=="string"?r.pattern:null}function V$(e,t){if(!B$.has(e))return null;const r=W$(e,t);if(!r)return null;const i=U$(r);return i?{emoji:e==="LS"?"📂":H$(i),label:i,category:"file",detail:r}:null}const P_={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 Py(e){if(!e.startsWith("mcp__"))return null;const t=e.slice(5),r=t.indexOf("__");return r<=0?{server:t,method:""}:{server:t.slice(0,r),method:t.slice(r+2)}}function G$(e){let t=5381;for(let r=0;r<e.length;r++)t=(t<<5)+t^e.charCodeAt(r);return Math.abs(t)%360}function Sj(e){const t=e.toLowerCase();return Object.hasOwn(P_,t)?P_[t]:void 0}function Y$(e,t){const r=Py(e);if(!r)return null;const{server:i,method:o}=r;if(!o)return null;const a=Sj(i);return{emoji:(a==null?void 0:a.emoji)??"🔌",label:o,category:"mcp",detail:a?`${a.name} · ${o}`:`${i} · ${o}`}}function K$(e,t){return z$(e,t)??V$(e,t)??Y$(e)}const L_=E$;function Ej(e){const t=Py(e);if(t){const i=Sj(t.server);return i?{emoji:i.emoji,label:i.name}:{emoji:"🔌",label:t.server,hue:G$(t.server)}}const r=Object.hasOwn(L_,e)?L_[e]:"";return r?{emoji:A_(e),label:r}:{emoji:A_(e),label:e}}function X$(e){let t=null,r="";for(const i of e){const o=Py(i);if(o){if(!o.server)return null;if(t===null)t=o.server,r=i;else if(o.server!==t)return null}}return t===null?null:Ej(r)}function Q$(e){return e.endedAt==null?"inflight":e.ok===!1?"err":"done"}function Z$(e,t,r){if(r==null)return 1;const i=t-r;return i<0?1:Math.max(0,1-i/bj)}function J$(e,t){const r=[],i=new Set;for(let o=e.length-1;o>=0&&r.length<t;o--){const a=e[o];i.has(a.id)||(i.add(a.id),r.push(a))}return r.reverse()}function e3(e,t,r,i,o,a){const u=[];for(const c of e.values()){if(!t.has(c.id)||c.exitAt!=null&&a-c.exitAt>bj)continue;const f=i.get(c.id)??r.get(c.id);if(!f)continue;const p=J$(c.tools,I$);if(p.length===0)continue;const d=c.exitAt??null,g=o.get(c.id),y=Math.max((g==null?void 0:g.width)??j_,j_),w=(g==null?void 0:g.height)??130,E=f.x,_=f.y,b=E+y,k=_+w/2;p.forEach((S,N)=>{const T=N*M$,A=E+y+O$,L=_+P$+T,P=Z$(S,a,d),U=S.inputPreview??"",O=Q$(S),M=P<.999,q=Ej(S.name);u.push({id:`${c.id}::${S.id}`,toolId:S.id,agentId:c.id,toolName:S.name,name:q.label,emoji:q.emoji,status:O,category:_j(S.name),mcpHue:q.hue,inputPreview:U,fade:P,fading:M,worldX:A,worldY:L,anchorX:b,anchorY:k,spawnDx:b-A,spawnDy:k-(L+ny)});const V=K$(S.name,S.input);if(V){const Q=F$(S.name,q.label),j=A+Q+L$,G=L,z=A+Q,te=L+ny;u.push({id:`sub:${c.id}::${S.id}`,toolId:S.id,agentId:c.id,toolName:S.name,name:V.label,emoji:V.emoji,isSub:!0,status:O,category:V.category,inputPreview:V.detail??U,fade:P,fading:M,worldX:j,worldY:G,anchorX:z,anchorY:te,spawnDx:z-j,spawnDy:0})}})}return u}function t3({agents:e,visibleAgentIds:t,positions:r,pinned:i,measured:o,spotlight:a,hiddenCategories:u,now:c,onOpenTool:f}){const p=e3(e,t,r,i,o,c),d=u&&u.size>0?p.filter(g=>!u.has(g.category)):p;return m.jsx(n3,{bursts:d,spotlight:a,onOpenTool:f})}function n3({bursts:e,spotlight:t,onOpenTool:r}){const{x:i,y:o,zoom:a}=tj();return m.jsxs("div",{className:"tool-bursts-layer","aria-hidden":!0,children:[m.jsx("svg",{className:"tool-bursts-svg",children:e.map(u=>{const c=u.anchorX*a+i,f=u.anchorY*a+o,p=(u.worldX+6)*a+i,d=(u.worldY+ny)*a+o,g=c+(p-c)*.55,y=t!=null&&!t.has(u.agentId),w=u.fade*(y?.14:1);return m.jsx("path",{d:`M ${c} ${f} Q ${g} ${f}, ${p} ${d}`,className:`tool-conn status-${u.status}${u.fading?" fading":""}`,opacity:w},`l:${u.id}`)})}),e.map(u=>{const c=u.worldX*a+i,f=u.worldY*a+o,p={left:`${c}px`,top:`${f}px`,transform:`scale(${a})`,transformOrigin:"left top","--spawn-dx":`${u.spawnDx}px`,"--spawn-dy":`${u.spawnDy}px`},d=u.isSub?`${u.toolName} · ${u.name}`:u.toolName,g=u.inputPreview?`${d} · ${u.inputPreview}`:d,y=r!=null,w=u.mcpHue!=null?{"--mcp-hue":u.mcpHue}:{},_=t!=null&&!t.has(u.agentId)?" dim":"";return m.jsx("div",{className:"tool-burst-wrap",style:p,children:m.jsxs("div",{className:`tool-burst cat-${u.category}${u.mcpHue!=null?" mcp-hue":""} status-${u.status}${u.fading?" fading":""}${y?" clickable":""}${u.isSub?" sub":""}${_}`,style:w,title:g,onClick:y?()=>r(u.toolId):void 0,children:[m.jsx("span",{className:"tb-emoji",children:u.emoji}),m.jsx("span",{className:"tb-name",children:u.name}),u.status==="inflight"&&m.jsx("span",{className:"tb-spin"}),u.status==="done"&&m.jsx("span",{className:"tb-mark done",children:"✓"}),u.status==="err"&&m.jsx("span",{className:"tb-mark err",children:"×"})]})},u.id)})]})}function Nj(e){const t={input:0,output:0,cacheRead:0,cacheWrite:0,total:0};let r=0,i=0,o=0,a=0;for(const u of e){const c=gn(u);t.input+=c.input,t.output+=c.output,t.cacheRead+=c.cacheRead,t.cacheWrite+=c.cacheWrite,t.total+=c.total,r+=u.usage.inputTokens,i+=u.usage.outputTokens,o+=u.usage.cacheReadTokens,a+=u.usage.cacheCreateTokens}return{cost:t,inputTokens:r,outputTokens:i,cacheReadTokens:o,cacheCreateTokens:a,sum:r+i}}const r3="spend on this board",s3="on this board",i3="board tokens",o3="board cost",Bu=`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.`,Cj="session spend";function Ly({cost:e,size:t="md"}){const r=e.total;if(r<=0)return null;const i=(a,u,c)=>{if(a<=0)return null;const f=a/r*100;return m.jsx("span",{className:`cb-seg ${u}`,style:{width:`${f}%`},title:`${c}: ${Ge(a)} (${f.toFixed(0)}%)`},u)},o=t==="lg";return m.jsxs("div",{className:o?"cost-bar cost-bar-lg":"cost-bar",role:"img","aria-label":"Cost breakdown",children:[i(e.input,"cb-input","input"),i(e.output,"cb-output","output"),i(e.cacheRead,"cb-cache-r","cache read"),i(e.cacheWrite,"cb-cache-w","cache write")]})}function a3({state:e,sessionId:t,onClose:r}){const i=C.useMemo(()=>l3(e,t),[e,t]),o=C.useRef(null),a=gi(r,{focusRef:o});return i?m.jsx("div",{className:"modal-backdrop",onClick:r,role:"presentation",children:m.jsxs("div",{ref:a,className:"modal session-summary",onClick:u=>u.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"ss-title",children:[m.jsxs("div",{className:"modal-head",children:[m.jsxs("div",{className:"modal-title",children:[m.jsx("span",{className:"state-pill state-done","aria-hidden":!0,children:"done"}),m.jsx("span",{id:"ss-title",className:"modal-tool-name",title:i.cwd??i.sessionId,children:i.label}),m.jsxs("span",{className:"modal-tool-id",children:["· ",i.sessionId.slice(0,8)]})]}),m.jsxs("div",{className:"modal-actions",children:[m.jsx("span",{className:"modal-dur",title:"Total wall time",children:i.durationLabel}),m.jsx("button",{type:"button",ref:o,className:"glyph-btn",onClick:r,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),m.jsxs("div",{className:"modal-body",children:[m.jsxs("section",{className:"ss-hero",children:[m.jsxs("div",{className:"ss-hero-left",children:[m.jsx("div",{className:"ss-cost-label",children:Cj}),m.jsx("div",{className:"ss-cost",children:Ge(i.cost.total)}),i.modelChips.length>0&&m.jsx("div",{className:"ss-models",children:i.modelChips.map(u=>m.jsx("span",{className:"model-chip",title:u,children:mi(u)},u))})]}),m.jsx("div",{className:"ss-hero-right",children:i.cost.total>0&&m.jsxs(m.Fragment,{children:[m.jsx(Ly,{cost:i.cost,size:"lg"}),m.jsxs("div",{className:"ss-cost-legend",children:[m.jsxs("span",{className:"ssl ssl-in",children:["input ",m.jsx("b",{children:Ge(i.cost.input)})]}),m.jsxs("span",{className:"ssl ssl-out",children:["output ",m.jsx("b",{children:Ge(i.cost.output)})]}),m.jsxs("span",{className:"ssl ssl-cr",children:["cache r ",m.jsx("b",{children:Ge(i.cost.cacheRead)})]}),m.jsxs("span",{className:"ssl ssl-cw",children:["cache w ",m.jsx("b",{children:Ge(i.cost.cacheWrite)})]})]})]})})]}),m.jsxs("section",{className:"ss-stats",children:[m.jsx(uo,{label:"agents",value:i.agentCount}),m.jsx(uo,{label:"subagents",value:i.subagentCount}),m.jsx(uo,{label:"tool calls",value:i.toolCount}),m.jsx(uo,{label:"prompts",value:i.promptCount}),m.jsx(uo,{label:"tokens",value:i.tokensSum.toLocaleString()}),i.errCount>0&&m.jsx(uo,{label:"errors",value:i.errCount,tone:"err"})]}),i.topTools.length>0&&m.jsxs("section",{className:"modal-section",children:[m.jsx("h4",{children:"Most-used tools"}),m.jsx("div",{className:"ss-top-tools",children:i.topTools.map(([u,c])=>m.jsxs("div",{className:"ss-tt",children:[m.jsx("span",{className:"ss-tt-name",children:u}),m.jsx("span",{className:"ss-tt-bar",children:m.jsx("span",{className:"ss-tt-bar-fill",style:{width:`${c/i.topTools[0][1]*100}%`}})}),m.jsx("span",{className:"ss-tt-count",children:c})]},u))})]}),i.firstPrompt&&m.jsxs("section",{className:"modal-section",children:[m.jsx("h4",{children:"Opening prompt"}),m.jsx("div",{className:"ss-prompt",children:i.firstPrompt})]})]})]})}):null}function uo({label:e,value:t,tone:r}){return m.jsxs("div",{className:`ss-stat${r?` tone-${r}`:""}`,children:[m.jsx("div",{className:"ss-stat-value",children:t}),m.jsx("div",{className:"ss-stat-label",children:e})]})}function l3(e,t){const r=e.agents.get(t);if(!r)return null;const i=[];for(const N of e.agents.values())N.sessionId===t&&i.push(N);if(i.length===0)return null;const o={input:0,output:0,cacheRead:0,cacheWrite:0,total:0},a=new Set,u=new Map;let c=0,f=0,p=0,d=0,g=0,y,w=1/0,E=0;for(const N of i){const T=gn(N);o.input+=T.input,o.output+=T.output,o.cacheRead+=T.cacheRead,o.cacheWrite+=T.cacheWrite,o.total+=T.total;for(const A of pj(N))a.add(A);N.model&&a.add(N.model),N.kind==="subagent"&&g++,f+=N.prompts.length,!y&&N.prompts.length>0&&(y=N.prompts[0].text),p+=N.usage.inputTokens+N.usage.outputTokens,c+=N.toolCount,w=Math.min(w,N.startedAt),E=Math.max(E,N.endedAt??Date.now());for(const A of N.tools)u.set(A.name,(u.get(A.name)??0)+1),A.ok===!1&&d++}const _=Math.max(0,E-w),b=Math.floor(_/1e3),k=b<60?`${b}s`:b<3600?`${Math.floor(b/60)}m ${String(b%60).padStart(2,"0")}s`:`${Math.floor(b/3600)}h ${Math.floor(b%3600/60)}m`,S=Array.from(u.entries()).sort((N,T)=>T[1]-N[1]).slice(0,5);return{sessionId:t,label:r.label||r.cwdBasename||"session",cwd:r.cwd,durationLabel:k,cost:o,modelChips:Array.from(a),agentCount:i.length,subagentCount:g,toolCount:c,promptCount:f,tokensSum:p,errCount:d,topTools:S,firstPrompt:y}}function $y(e){return(e==null?void 0:e.kind)==="permission"}function u3(e){const t=[];for(const r of e)r.kind==="root"&&$y(r.waiting)&&t.push({id:r.id,label:r.label,waiting:r.waiting});return t.sort((r,i)=>r.waiting.since-i.waiting.since)}function c3(e){const t=new Set;for(const r of e)r.state==="active"&&t.add(r.sessionId);return t.size}function $_(e){return e.waiting?$y(e.waiting)?0:1:e.state==="active"?2:3}function d3(e,t){const r=[];for(const i of e.agents.values()){if(i.kind!=="root")continue;let o=i.toolCount,a=gn(i).total,u=i.endedAt??i.startedAt;for(const c of e.agents.values()){if(c.sessionId!==i.sessionId||c.kind==="root")continue;o+=c.toolCount,a+=gn(c).total;const f=c.endedAt??c.startedAt;f>u&&(u=f)}r.push({sessionId:i.sessionId,label:i.label||i.cwdBasename||"session",cwdBasename:i.cwdBasename,state:i.state,waiting:i.waiting,modelId:i.model,toolCount:o,cost:a,startedAt:i.startedAt,lastActivity:u})}return r.sort((i,o)=>{const a=$_(i),u=$_(o);return a!==u?a-u:i.waiting&&o.waiting?i.waiting.since-o.waiting.since:o.lastActivity-i.lastActivity}),r}function q_(e,t,r){const i=(t??r)-e;if(i<1e3)return"<1s";const o=Math.floor(i/1e3);if(o<60)return`${o}s`;const a=Math.floor(o/60);return a<60?`${a}m`:`${Math.floor(a/60)}h ${a%60}m`}function f3({state:e,now:t,selectedIds:r,onSelect:i,onClose:o}){const a=C.useMemo(()=>d3(e),[e,e.revision,t]),u=a.filter(f=>f.state==="active").length,c=a.filter(f=>$y(f.waiting)).length;return m.jsxs("aside",{className:"session-list",id:"session-list","aria-label":"Sessions",children:[m.jsxs("div",{className:"sl-header",children:[m.jsxs("h2",{children:["Sessions ",m.jsx("span",{className:"sl-count",children:a.length})]}),c>0&&m.jsxs("span",{className:"sl-waiting-count",children:[c," waiting"]}),u>0&&m.jsxs("span",{className:"sl-live-count",children:[u," live"]}),m.jsx("button",{className:"glyph-btn sl-close",onClick:o,title:"Hide sidebar (L)","aria-label":"Hide session list",children:"‹"})]}),m.jsxs("div",{className:"sl-rows",children:[a.length===0&&m.jsx("div",{className:"sl-empty",children:"No sessions yet."}),a.map(f=>{const p=r.has(f.sessionId);return m.jsxs("button",{type:"button",className:`sl-row state-${f.state}${p?" selected":""}`,onClick:()=>i(f.sessionId),title:`Focus ${f.label}`,children:[m.jsx("span",{className:`sl-dot state-${f.state}`,"aria-hidden":!0}),m.jsx("span",{className:"vis-hidden",children:Oy(f.state)}),m.jsxs("div",{className:"sl-row-body",children:[m.jsxs("div",{className:"sl-row-head",children:[m.jsx("span",{className:"sl-label",children:f.label}),f.modelId&&m.jsx("span",{className:"model-chip",title:f.modelId,children:mi(f.modelId)})]}),m.jsxs("div",{className:"sl-row-meta",children:[m.jsxs("span",{title:"tool calls",children:[m.jsx("b",{children:f.toolCount})," tools"]}),f.cost>0&&m.jsx("span",{className:"sl-cost",title:Cj,children:m.jsx("b",{children:Ge(f.cost)})}),f.waiting?m.jsxs("span",{className:"sl-waiting",title:`${ec(f.waiting)}
73
- Blocked since ${new Date(f.waiting.since).toLocaleTimeString()} · started ${new Date(f.startedAt).toLocaleString()}`,children:["waiting ",q_(f.waiting.since,void 0,t)]}):m.jsx("span",{className:"sl-elapsed",title:`Started ${new Date(f.startedAt).toLocaleString()}`,children:q_(f.startedAt,f.state==="active"?void 0:f.lastActivity,t)})]})]})]},f.sessionId)})]})]})}const Wt="ccdeck";function jj(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 ry(e){return jj(Math.floor(e/1e3))}function Tj(e,t){const r=e-t;if(r<=0)return null;const i=Math.floor(r/86400),o=Math.floor(r%86400/3600),a=Math.floor(r%3600/60);return i>0?`${i}d ${o}h`:o>0?`${o}h ${a}m`:`${a}m`}function h3(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function p3(e,t,r){const i=new Date(e),o=ry(t-e);return{label:h3(i,new Date(t))?o:`${o} · ${i.toLocaleDateString(r,{month:"short",day:"numeric"})}`,title:i.toLocaleString(r,{dateStyle:"medium",timeStyle:"medium"})}}function Rj(e,t){return{disabled:e!=null&&e!==t,busy:e===t}}function Aj(e){return e==null}const sy="self";function zr(e,t=!1){const r=Rj(e?sy:null,sy);return{disabled:t||r.disabled,"aria-busy":r.busy}}function Es(e){return Aj(e?sy:null)}function m3(e){return[...e==null?[]:[`#ap-more-${e}`],".accounts-panel .ap-refresh"]}function g3(e){return e==null||e==="BODY"||e==="HTML"}function D_(e,t){if(!e)return null;const r=t-Math.floor(e/1e3);return r<10?"just now":r<60?`${r}s ago`:r<3600?`${Math.floor(r/60)}m ago`:`${Math.floor(r/3600)}h ago`}function v3(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 ff="__unknown__";function y3(e,t,r,i){const o=Math.max(0,t-i),a=Math.max(0,r-o);if(a<120)return null;const u=Math.min(100,a/r*100),c=e-u;if(Math.abs(c)<3)return{label:"on pace",color:"var(--ok)",expectedPct:u,isDeficit:!1};if(c>0){const f=100-e,p=a>0?e/a:0,d=p>0?f/p:1/0,g={label:`${Math.round(c)}% ahead`,color:"var(--warn)",expectedPct:u,isDeficit:!0};if(d<o&&d<86400){const y=Math.floor(d/3600),w=Math.floor(d%3600/60);g.runsOutIn=y>0?`${y}h ${w}m`:`${w}m`}return g}return{label:`${Math.round(-c)}% reserve`,color:"var(--ok)",expectedPct:u,isDeficit:!1}}function ai({pct:e,label:t,reset:r,resetAt:i,windowSec:o,limitReached:a,nowSec:u}){const c=Math.min(100,Math.max(0,e)),p=a||c>=90?"var(--err)":c>=70?"var(--warn)":"var(--accent)",d=c===0?"< 1%":`${c}%`,g=c===0?2:c,y=i?Tj(i,u):null,w=i&&o?y3(c,i,o,u):null;return m.jsxs("div",{className:"qb-row",children:[m.jsxs("div",{className:"qb-meta",children:[m.jsxs("span",{className:"qb-label",children:[t,a&&m.jsx("span",{className:"qb-limit-badge",title:"Rate limit reached",children:"⛔"})]}),m.jsx("span",{className:"qb-pct",style:{color:p},children:d})]}),m.jsxs("div",{className:"qb-track",children:[m.jsx("div",{className:"qb-fill",style:{width:`${g}%`,background:p,opacity:c===0?.4:1}}),w&&m.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`})]}),m.jsxs("div",{className:"qb-reset-row",children:[y?m.jsxs("span",{className:"qb-reset",children:["resets in ",y]}):r?m.jsxs("span",{className:"qb-reset",children:["resets ",r]}):null,w&&m.jsx("span",{className:"qb-pace",style:{color:w.color},children:w.runsOutIn?`runs out in ${w.runsOutIn}`:w.label})]})]})}const w3=6e4;function x3(e){const[t,r]=C.useState(null),[i,o]=C.useState(!1),a=C.useRef(null),u=C.useRef(!1),c=async(p=!1)=>{if(!(p&&!Es(u.current))){p&&(u.current=!0,o(!0));try{const g=await fetch(p?"/api/quota?refresh=1":"/api/quota");g.ok&&r(await g.json())}catch{}finally{p&&(u.current=!1,o(!1))}}};return C.useEffect(()=>{if(e)return c(!0),a.current=window.setInterval(()=>c(!1),w3),()=>{a.current!=null&&window.clearInterval(a.current)}},[e]),{quota:t,loading:i,refresh:()=>{e&&c(!0)}}}function _3(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 Ij=6e4;function b3(e){const[t,r]=C.useState(null),[i,o]=C.useState(!1),a=C.useRef(null),u=C.useRef(!1),c=async(p=!1)=>{if(!(p&&!Es(u.current))){p&&(u.current=!0,o(!0));try{const g=await fetch(p?"/api/codex-quota?refresh=1":"/api/codex-quota");g.ok&&r(await g.json())}catch{}finally{p&&(u.current=!1,o(!1))}}};return C.useEffect(()=>{if(e)return c(!0),a.current=window.setInterval(()=>c(!1),Ij),()=>{a.current!=null&&window.clearInterval(a.current)}},[e]),{data:t,loading:i,refresh:()=>{e&&c(!0)}}}function k3(e){const[t,r]=C.useState(null),i=C.useRef(null),o=async()=>{try{const a=await fetch("/api/codex-usage");a.ok&&r(await a.json())}catch{}};return C.useEffect(()=>{if(e)return o(),i.current=window.setInterval(o,Ij),()=>{i.current!=null&&window.clearInterval(i.current)}},[e]),{data:t}}function S3({state:e,now:t,providers:r,onClose:i}){var V,Q;const{quota:o,loading:a,refresh:u}=x3(r.claude),{data:c,loading:f,refresh:p}=b3(r.codex),{data:d}=k3(r.codex),[g,y]=C.useState(()=>Math.floor(Date.now()/1e3));C.useEffect(()=>{const j=window.setInterval(()=>y(Math.floor(Date.now()/1e3)),3e4);return()=>window.clearInterval(j)},[]);const{byModel:w,totalCost:E,totalTokens:_,burnRate:b}=C.useMemo(()=>{const j=new Map;for(const W of e.agents.values())for(const I of Ga(W)){const Y=I.model??ff,ue=Ay(I.usage,I.model),F=j.get(Y);F?(F.inputTokens+=I.usage.inputTokens,F.outputTokens+=I.usage.outputTokens,F.cacheReadTokens+=I.usage.cacheReadTokens,F.cacheCreateTokens+=I.usage.cacheCreateTokens,F.cost.total+=ue.total,F.cost.input+=ue.input,F.cost.output+=ue.output,F.cost.cacheRead+=ue.cacheRead,F.cost.cacheWrite+=ue.cacheWrite,F.agentCount++):j.set(Y,{model:Y,inputTokens:I.usage.inputTokens,outputTokens:I.usage.outputTokens,cacheReadTokens:I.usage.cacheReadTokens,cacheCreateTokens:I.usage.cacheCreateTokens,cost:{...ue},agentCount:1,priced:No(I.model)!=null})}const G=Array.from(j.values()).sort((W,I)=>I.cost.total-W.cost.total||I.inputTokens+I.outputTokens-(W.inputTokens+W.outputTokens));let z=0,te=0;for(const W of e.agents.values()){if(W.state!=="active")continue;const I=gn(W);z+=I.total,te=Math.max(te,((W.endedAt??t)-W.startedAt)/1e3)}const J=te>0?Fu(z,te):null,$=Nj(e.agents.values());return{byModel:G,totalCost:$.cost,totalTokens:$,burnRate:J}},[e,e.revision,t]),k=C.useMemo(()=>{const j=[];for(const G of e.agents.values()){if(G.kind!=="root")continue;let z=gn(G).total,te=G.usage.inputTokens,J=G.usage.outputTokens,$=ey(G);for(const W of e.agents.values())W.sessionId!==G.sessionId||W.kind==="root"||(z+=gn(W).total,te+=W.usage.inputTokens,J+=W.usage.outputTokens,$+=ey(W));j.push({sessionId:G.sessionId,label:G.label||G.cwdBasename||"session",state:G.state,cost:z,inputTokens:te,outputTokens:J,unpricedTokens:$})}return j.sort((G,z)=>z.cost-G.cost||z.inputTokens+z.outputTokens-(G.inputTokens+G.outputTokens)).slice(0,12)},[e,e.revision]),S=E.total>0,N=_.sum,T=w.filter(j=>j.cost.total>0||j.inputTokens+j.outputTokens>0),A=k.filter(j=>j.cost>0||j.inputTokens+j.outputTokens>0),L=T.some(j=>!j.priced),P=a||f,U=D_(o==null?void 0:o.fetchedAt,g),O=D_(c==null?void 0:c.fetchedAt,g),M=()=>{u(),p()},q=r.claude&&r.codex?"Refresh Claude + Codex quota":r.codex?"Refresh Codex quota":"Refresh Claude quota";return m.jsxs("aside",{className:"usage-panel",id:"usage-panel","aria-label":"Usage",children:[m.jsxs("div",{className:"up-header",children:[m.jsx("h2",{children:"Usage"}),b&&m.jsx("span",{className:"up-rate",children:b}),m.jsxs("div",{className:"up-header-right",children:[(r.claude||r.codex)&&m.jsx("button",{type:"button",className:"glyph-btn up-refresh-btn",onClick:M,...zr(P),"aria-label":q,title:q,children:P?"…":"↻"}),m.jsx("button",{type:"button",className:"glyph-btn up-close",onClick:i,"aria-label":"Close usage panel",title:"Close (U)",children:"×"})]})]}),r.claude&&m.jsxs("section",{className:"up-section up-quota-section",children:[m.jsxs("h3",{className:"up-section-title",children:["Claude quota",U&&!a&&m.jsx("span",{className:"up-section-age",title:v3(o==null?void 0:o.source),children:U})]}),o!=null&&o.ok?m.jsxs("div",{className:"up-quota-bars",children:[o.session5hPct!=null&&m.jsx(ai,{label:"5-hour window",pct:o.session5hPct,reset:o.session5hReset,resetAt:o.session5hResetAt,windowSec:o.session5hWindowSec,nowSec:g}),o.week7dPct!=null&&m.jsx(ai,{label:"7-day window",pct:o.week7dPct,reset:o.week7dReset,resetAt:o.week7dResetAt,windowSec:o.week7dWindowSec,nowSec:g}),o.weekSonnetPct!=null&&m.jsx(ai,{label:"Sonnet (7d)",pct:o.weekSonnetPct,nowSec:g}),o.weekOpusPct!=null&&m.jsx(ai,{label:"Opus (7d)",pct:o.weekOpusPct,nowSec:g})]}):(o==null?void 0:o.ok)===!1?m.jsxs("div",{className:"up-quota-na",children:[m.jsx("span",{children:"Quota unavailable."}),m.jsxs("span",{className:"up-quota-hint",children:["Run ",m.jsx("code",{children:"/usage"})," in a claude session, then click ↻"]})]}):m.jsx("div",{className:"up-quota-na up-quota-loading",children:"Checking…"})]}),r.codex&&m.jsxs("section",{className:"up-section up-quota-section",children:[m.jsxs("h3",{className:"up-section-title",children:["Codex quota",(c==null?void 0:c.ok)&&c.planLabel&&m.jsx("span",{className:"up-plan-badge",children:c.planLabel}),O&&!f&&m.jsx("span",{className:"up-section-age",title:"Fetched from the Codex usage endpoint",children:O})]}),c!=null&&c.ok?m.jsxs("div",{className:"up-quota-bars",children:[(V=c.windows)==null?void 0:V.map(j=>m.jsx(ai,{label:j.label,pct:j.pct,reset:j.reset??void 0,resetAt:j.resetAt??void 0,windowSec:j.windowSec??void 0,limitReached:c.limitReached&&j.pct>=100,nowSec:g},j.id)),(Q=c.extraWindows)==null?void 0:Q.map(j=>m.jsx(ai,{label:j.label,pct:j.pct,reset:j.reset??void 0,resetAt:j.resetAt??void 0,windowSec:j.windowSec??void 0,nowSec:g},j.id)),c.creditLimit&&m.jsx(ai,{label:`spend cap · $${Math.round(c.creditLimit.used)} of $${Math.round(c.creditLimit.limit)}`,pct:c.creditLimit.usedPct,reset:c.creditLimit.reset??void 0,resetAt:c.creditLimit.resetAt??void 0,limitReached:c.spendControlReached,nowSec:g}),c.creditsBalance&&!c.creditsUnlimited&&m.jsxs("div",{className:"up-quota-sub up-credits",children:["credits: $",c.creditsBalance,c.overageReached&&" · overage limit reached"]}),c.creditsUnlimited&&m.jsx("div",{className:"up-quota-sub up-credits",children:"credits: unlimited"}),c.resetCredits&&c.resetCredits.availableCount>0&&m.jsxs("div",{className:"up-quota-sub up-reset-credits",title:`Redeem in the Codex CLI or ChatGPT — ${Wt} only reports them`,children:[c.resetCredits.availableCount," rate-limit reset",c.resetCredits.availableCount!==1?"s":""," available",c.resetCredits.nextExpiryAt&&` · expires ${new Date(c.resetCredits.nextExpiryAt).toLocaleDateString("en-US",{month:"short",day:"numeric"})}`]}),c.promo&&m.jsx("div",{className:"up-quota-sub",children:c.promo}),c.partial&&m.jsx("div",{className:"up-quota-sub up-quota-hint",children:"Partial data — OpenAI returned limits this build doesn't recognise."})]}):(c==null?void 0:c.ok)===!1?m.jsxs("div",{className:"up-quota-na",children:[m.jsx("span",{children:"Quota unavailable."}),m.jsx("span",{className:"up-quota-hint",children:_3(c.reason)})]}):m.jsx("div",{className:"up-quota-na up-quota-loading",children:"Checking…"}),(d==null?void 0:d.ok)&&d.window7d&&d.window7d.sessionCount>0&&m.jsxs("div",{className:"up-quota-sub",title:`Counted from the rollout files under CODEX_HOME — no network, no account${d.window5h?`
74
- last 5h: ${Rt(d.window5h.totalTokens)} tokens · ${d.window5h.sessionCount} session${d.window5h.sessionCount!==1?"s":""}`:""}`,children:[Rt(d.window7d.totalTokens)," tokens · ",d.window7d.sessionCount," session",d.window7d.sessionCount!==1?"s":""," (7d)"]})]}),N>0?m.jsxs(m.Fragment,{children:[S&&m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"up-total",title:Bu,children:[m.jsx("span",{className:"up-total-value",children:Ge(E.total)}),m.jsx("span",{className:"up-total-label",children:r3})]}),m.jsx(Ly,{cost:E})]}),m.jsxs("div",{className:"up-tokens-row",title:Bu,children:[m.jsxs("span",{className:"up-tok",children:[m.jsx("span",{className:"up-k",children:"in"}),Rt(_.inputTokens)]}),m.jsxs("span",{className:"up-tok",children:[m.jsx("span",{className:"up-k",children:"out"}),Rt(_.outputTokens)]}),_.cacheReadTokens>0&&m.jsxs("span",{className:"up-tok",children:[m.jsx("span",{className:"up-k",children:"cache r"}),Rt(_.cacheReadTokens)]}),_.cacheCreateTokens>0&&m.jsxs("span",{className:"up-tok",children:[m.jsx("span",{className:"up-k",children:"cache c"}),Rt(_.cacheCreateTokens)]}),!S&&m.jsx("span",{className:"up-tok up-scope",children:s3})]}),T.length>0&&m.jsxs("section",{className:"up-section",children:[m.jsx("h3",{className:"up-section-title",children:"By model"}),m.jsxs("table",{className:"up-table",children:[m.jsx("thead",{children:m.jsxs("tr",{children:[m.jsx("th",{children:"Model"}),m.jsx("th",{children:"Tokens"}),m.jsx("th",{children:"Cost"})]})}),m.jsx("tbody",{children:T.map(j=>m.jsxs("tr",{children:[m.jsx("td",{className:"up-model-name",title:j.model===ff?"no model reported yet":j.model,children:j.model===ff?"unknown":mi(j.model)}),m.jsx("td",{className:"up-num",children:Rt(j.inputTokens+j.outputTokens)}),j.priced?m.jsx("td",{className:"up-num up-cost-val",children:Ge(j.cost.total)}):m.jsx("td",{className:"up-num up-unpriced",children:ju})]},j.model))})]})]}),A.length>0&&m.jsxs("section",{className:"up-section",children:[m.jsx("h3",{className:"up-section-title",children:"By session"}),m.jsx("div",{className:"up-sessions",children:A.map(j=>m.jsxs("div",{className:"up-session-row",children:[m.jsx("span",{className:`sl-dot state-${j.state}`,"aria-hidden":!0}),m.jsx("span",{className:"vis-hidden",children:Oy(j.state)}),m.jsx("span",{className:"up-session-label",children:j.label}),m.jsx("span",{className:"up-session-tokens",children:Rt(j.inputTokens+j.outputTokens)}),j.cost>0?m.jsxs("span",{className:"up-session-cost",title:j.unpricedTokens>0?`${Rt(j.unpricedTokens)} tokens in this session are on an unpriced model, so this is a floor`:void 0,children:[Ge(j.cost),j.unpricedTokens>0?"+":""]}):m.jsx("span",{className:"up-session-cost up-unpriced",children:ju})]},j.sessionId))})]}),L&&m.jsxs("div",{className:"up-hint",children:["“",ju,"” means this build holds no published rate for that model — those tokens are counted above and their dollars are not."]})]}):m.jsxs("div",{className:"up-empty",children:["No usage data yet.",m.jsx("br",{}),"Start a Claude Code or Codex session."]})]})}const E3="1",F_="agent-dag.schema",N3=["agent-dag.layout","agent-dag.viewport"];function qy(e){if(typeof window>"u")return null;try{return window.localStorage.getItem(e)}catch{return null}}function C3(e,t=E3){let r=null;try{r=e.getItem(F_)}catch{return[]}if(r===t)return[];const i=[];if(r!==null)for(const o of N3)try{e.getItem(o)!==null&&(e.removeItem(o),i.push(o))}catch{}try{e.setItem(F_,t)}catch{}return i}const j3=3e3,T3=4e3,hf=20,_a=36,co=8,Mj="agent-dag.systemPanelOpen";function R3(){return qy(Mj)==="1"}function A3(e){if(!(typeof window>"u"))try{window.localStorage.setItem(Mj,e?"1":"0")}catch{}}function $a(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 I3(e){const t=Math.floor(e/86400),r=Math.floor(e%86400/3600),i=Math.floor(e%3600/60);return t>0?`${t}d ${r}h`:r>0?`${r}h ${i}m`:`${i}m`}function M3(){const[e,t]=C.useState(null),r=C.useRef(null);return C.useEffect(()=>{let i=!0;const o=async()=>{if(document.visibilityState!=="hidden")try{const f=await fetch("/api/system");if(!f.ok)return;const p=await f.json();i&&(p!=null&&p.ok)&&t(p)}catch{}},a=()=>{r.current==null&&(o(),r.current=window.setInterval(o,j3))},u=()=>{r.current!=null&&(window.clearInterval(r.current),r.current=null)},c=()=>{if(document.visibilityState==="hidden"){u();return}a(),o()};return a(),document.addEventListener("visibilitychange",c),()=>{i=!1,u(),document.removeEventListener("visibilitychange",c)}},[]),e}function O3(e){const[t,r]=C.useState(null);return C.useEffect(()=>{let i=!0;const o=async()=>{if(document.visibilityState!=="hidden")try{const u=await fetch("/api/system/processes");if(!u.ok)return;const c=await u.json();i&&(c!=null&&c.ok)&&r(c.procs??[])}catch{}};o();const a=window.setInterval(o,T3);return()=>{i=!1,window.clearInterval(a)}},[e]),t}function P3({usageOpen:e=!1}){const t=M3(),[r,i]=C.useState(R3);C.useEffect(()=>{A3(r)},[r]);const o=C.useRef(null),a=C.useRef(null);if(C.useEffect(()=>{if(r)return yo.push(()=>{var k,S;const b=((k=a.current)==null?void 0:k.contains(document.activeElement))??!1;i(!1),b&&((S=o.current)==null||S.focus())},yj)},[r]),!t||t.cpu==null||!t.memory)return m.jsx("span",{className:"sysmeter idle",title:"Sampling this machine…",children:m.jsx("span",{className:"sm-box","aria-hidden":!0,children:m.jsxs("span",{className:"sm-graphic",children:[m.jsx("svg",{className:"sm-spark",width:_a,height:co,viewBox:`0 0 ${_a} ${co}`}),m.jsx("span",{className:"sm-ram"})]})})});const{cpu:u,cpuHistory:c,cores:f,memory:p,loadavg:d}=t,g=p.usedPct>=90,y=c.slice(-hf),w=hf-y.length,E=_a/hf,_=[`CPU ${u.toFixed(0)}% of ${f} cores`,d?`load ${d[0]} · ${d[1]} · ${d[2]} (1m · 5m · 15m)`:null,`Memory ${$a(p.total-p.available)} of ${$a(p.total)} used`,"","Click for detail. This machine, not this session."].filter(b=>b!==null).join(`
75
- `);return m.jsxs("span",{className:"sysmeter-wrap",children:[m.jsxs("button",{type:"button",ref:o,className:"sysmeter",title:_,"aria-label":"Toggle machine detail","aria-expanded":r,"aria-controls":r?"system-panel":void 0,onClick:()=>i(b=>!b),children:[m.jsxs("span",{className:"sm-box","aria-hidden":!0,children:[m.jsxs("span",{className:"sm-graphic",children:[m.jsx("svg",{className:"sm-spark",width:_a,height:co,viewBox:`0 0 ${_a} ${co}`,children:y.map((b,k)=>{const S=w+k,N=Math.max(1,b/100*co),T=.32+.68*((k+1)/y.length);return m.jsx("rect",{x:S*E,y:co-N,width:Math.max(.8,E-.7),height:N,rx:.5,fill:"var(--accent)",opacity:T},S)})}),m.jsx("span",{className:"sm-ram",children:m.jsx("span",{className:`sm-ram-fill${g?" warn":""}`,style:{transform:`scaleX(${Math.max(2,p.usedPct)/100})`}})})]}),m.jsxs("span",{className:"sm-read",children:[m.jsx("b",{children:u.toFixed(0)}),m.jsx("i",{children:"·"}),m.jsx("b",{children:p.usedPct.toFixed(0)})]})]}),m.jsxs("span",{className:"sm-sr",children:["CPU ",u.toFixed(0)," percent, memory ",p.usedPct.toFixed(0)," percent used"]})]}),r&&m.jsx(L3,{sys:t,usageOpen:e,panelRef:a,onClose:()=>{var b;i(!1),(b=o.current)==null||b.focus()}})]})}function L3({sys:e,usageOpen:t,panelRef:r,onClose:i}){const o=O3(!0),{memory:a,swap:u,perCore:c,loadavg:f,cores:p,uptimeSec:d,platform:g}=e,y=a?a.total-a.available:0,w=g==="win32"?"Commit":"Swap",E=u&&u.total>0?u.used/u.total*100:0;return m.jsxs("aside",{ref:r,className:`sysdetail${t?" shifted":""}`,id:"system-panel","aria-label":"Machine detail",children:[m.jsxs("div",{className:"sd-head",children:[m.jsx("span",{className:"sd-title",children:"This machine"}),m.jsxs("span",{className:"sd-sub",children:["up ",I3(d)," · ",p," cores"]}),m.jsx("button",{type:"button",className:"glyph-btn sd-close",onClick:i,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),c&&c.length>0&&m.jsxs("div",{className:"sd-section",role:"group","aria-label":"Cores",children:[m.jsx("div",{className:"sd-h","aria-hidden":!0,children:"Cores"}),m.jsx("div",{className:"sd-cores",style:{"--n":c.length},children:c.map((_,b)=>m.jsx("span",{className:"sd-core",title:`core ${b+1}: ${_}%`,children:m.jsx("span",{className:"sd-core-fill",style:{transform:`scaleY(${Math.max(2,_)/100})`}})},b))})]}),m.jsxs("div",{className:"sd-section",role:"group","aria-label":"Memory",children:[m.jsx("div",{className:"sd-h","aria-hidden":!0,children:"Memory"}),a&&m.jsx(z_,{label:"Physical",used:y,total:a.total,pct:a.usedPct,note:`${$a(a.available)} available`}),u&&u.total>0&&m.jsx(z_,{label:w,used:u.used,total:u.total,pct:E,note:E>=50?"paging to disk":void 0})]}),f&&m.jsxs("div",{className:"sd-section",role:"group","aria-label":"Load average",children:[m.jsx("div",{className:"sd-h","aria-hidden":!0,children:"Load average"}),m.jsx("div",{className:"sd-load",children:f.map((_,b)=>m.jsxs("span",{className:`sd-load-item${_>p?" over":""}`,children:[m.jsx("b",{children:_.toFixed(2)}),m.jsx("span",{children:["1m","5m","15m"][b]})]},b))}),m.jsx("div",{className:"sd-note",children:f[0]>p?`${(f[0]/p).toFixed(1)}× more work queued than cores to run it`:`within ${p} cores`})]}),m.jsxs("div",{className:"sd-section",role:"group","aria-label":"Busiest processes",children:[m.jsx("div",{className:"sd-h","aria-hidden":!0,children:"Busiest processes"}),o==null?m.jsx("div",{className:"sd-note",children:"reading…"}):o.length===0?m.jsx("div",{className:"sd-note",children:"Could not read the process list on this platform."}):m.jsxs("table",{className:"sd-procs",children:[m.jsx("thead",{children:m.jsxs("tr",{children:[m.jsx("th",{children:"cpu"}),m.jsx("th",{children:"mem"}),m.jsx("th",{children:"process"})]})}),m.jsx("tbody",{children:o.map(_=>m.jsxs("tr",{children:[m.jsx("td",{className:"sd-num",children:_.cpu==null?"—":_.cpu.toFixed(0)}),m.jsx("td",{className:"sd-num sd-dim",children:_.mem.toFixed(1)}),m.jsx("td",{className:"sd-proc-name",title:`pid ${_.pid}`,children:_.name})]},_.pid))})]})]})]})}function z_({label:e,used:t,total:r,pct:i,note:o}){const a=i>=90;return m.jsxs("div",{className:"sd-row",children:[m.jsxs("div",{className:"sd-row-head",children:[m.jsx("span",{className:"sd-row-label",children:e}),m.jsxs("span",{className:"sd-row-val",children:[m.jsx("b",{children:$a(t)})," of ",$a(r)]})]}),m.jsx("span",{className:"sd-track",children:m.jsx("span",{className:`sd-fill${a?" warn":""}`,style:{transform:`scaleX(${Math.max(1,Math.min(100,i))/100})`}})}),o&&m.jsx("div",{className:"sd-note",children:o})]})}const B_=18,$3=1100,fo=(e,t)=>{const r=Math.sin(e*12.9898+t*78.233)*43758.5453;return r-Math.floor(r)},q3=Array.from({length:B_},(e,t)=>{const r=-72+144*t/(B_-1)+(fo(t,1)-.5)*9,i=(r-90)*(Math.PI/180),o=(54+32*Math.cos(r*Math.PI/180))*(.74+fo(t,2)*.52);return{dx:Math.cos(i)*o,dy:Math.sin(i)*o,rot:(t%2?1:-1)*(100+fo(t,3)*260),delay:Math.round(fo(t,4)*90),dur:760+Math.round(fo(t,5)*260),scale:.8+fo(t,6)*.45,hue:t%4,round:t%3===0}});function U_({anchor:e,lifetimeMs:t=$3}){var a;const[r,i]=C.useState(null),o=typeof window<"u"&&((a=window.matchMedia)==null?void 0:a.call(window,"(prefers-reduced-motion: reduce)").matches);return C.useEffect(()=>{if(o)return;const u=e.current;if(!u)return;const c=u.getBoundingClientRect();i({x:c.left+c.width/2,y:c.top+c.height/2});const f=window.setTimeout(()=>i(null),t);return()=>window.clearTimeout(f)},[e,t,o]),o||!r?null:WM.createPortal(m.jsx("div",{className:"confetti",style:{left:`${r.x}px`,top:`${r.y}px`},"aria-hidden":!0,children:q3.map((u,c)=>m.jsx("span",{className:`confetti-bit${u.round?" round":""}`,"data-hue":u.hue,style:{"--dx":`${u.dx.toFixed(1)}px`,"--dy":`${u.dy.toFixed(1)}px`,"--rot":`${u.rot}deg`,"--s":u.scale.toFixed(2),animationDelay:`${u.delay}ms`,animationDuration:`${u.dur}ms, ${u.dur}ms`}},c))}),document.body)}const Oj=new Set(["awaiting_url","awaiting_code","registering"]);function D3(e){return e!=null&&Oj.has(e)}function Pj(e){return e!=null&&e!=="done"&&!Oj.has(e)}const F3="the sign-in ended before it finished — the deck restarted, or it was cancelled in another tab",z3="the sign-in did not complete";function B3({state:e,serverError:t,localError:r}){const i=e==="idle";return{title:i?"Sign-in ended":"Sign-in failed",message:r||t||(i?F3:z3)}}const U3="done";function H3(){let e=!1;return{shouldAnnounce(t){return t!==U3?(e=!1,!1):e?!1:(e=!0,!0)}}}function Dy(e,t){return t&&Object.hasOwn(e,t)?e[t]:void 0}const W3={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 ccdeck1:",corrupt:"that share is incomplete — copy the whole thing",wrong_version:`that share was made by a newer ${Wt}`,expired:"that share has expired — make a new one",import_failed:"claude-swap refused the import",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"},V3={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"},G3=`claude-swap could not read the login keychain — start ${Wt} from a Terminal window rather than a background service`;function iy(e,t){if((e==null?void 0:e.reason)!=="no_cswap"&&/keychain/i.test(So(e)))return G3;const r=Dy(V3,e==null?void 0:e.reason);return r||(e==null?void 0:e.reason)||t}function So(e){return((e==null?void 0:e.output)||(e==null?void 0:e.detail)||(e==null?void 0:e.error)||"").trim()}const Y3={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"},K3="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 X3(e){return/\bnpx\b/i.test(e)&&/(command not found|not found|not recognized|ENOENT)/i.test(e)}const Q3="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",Z3="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",J3=e=>/\b(?:ERR_)?MODULE_NOT_FOUND\b|cannot find (?:module|package)/i.test(e),eq=/node_modules[\\/]npm[\\/]bin[\\/]|\bnpm-prefix\.js\b|\bnp[mx][-.][\w.-]*cli\.js\b/i,tq=/[\\/]_npx[\\/]/i,nq=`the copy of ccusage ${Wt} installed for itself`;function rq(e){const t=String((e==null?void 0:e.install)??"").replace(/\s+/g," ").trim();return t.length>240?`${t.slice(0,239)}…`:t}function sq(e,t){const r=iq(e,t),i=rq(e);switch(e==null?void 0:e.stage){case"npx":return i?`ccusage failed on both of its paths. The managed install failed first — ${i} — and the deck then fell back to npx, where ${ba(r)}`:`there is no managed copy of ccusage on this machine, and the npx fallback failed: ${ba(r)}`;case"managed":return`${nq} failed to run: ${ba(r)}`;case"path":return e.bin?`the ccusage this deck found at ${e.bin} failed to run: ${ba(r)}`:`the ccusage this deck found on your PATH failed to run: ${ba(r)}`;default:return r}}const ba=e=>/^[A-Z][a-z]/.test(e)?e[0].toLowerCase()+e.slice(1):e;function iq(e,t){const r=So(e);if(J3(r)){if(tq.test(r))return Z3;if(eq.test(r))return Q3}if(X3(r))return K3;const i=Dy(Y3,e==null?void 0:e.reason);return i||(e==null?void 0:e.reason)||t}function Tu(e,t){if(e!=null&&e.detail)return e.detail;if(e!=null&&e.error&&Pj(e.state))return e.error;const r=Dy(W3,e==null?void 0:e.reason);return r||(e!=null&&e.error?e.error:(e==null?void 0:e.reason)||t)}function oq(e,t,r){if(r<=0||Iy(e))return{kind:"pass"};const i=t>=0&&t<r?t:-1;switch(e.key){case"ArrowRight":return{kind:"select",index:i===-1?0:(i+1)%r};case"ArrowLeft":return{kind:"select",index:i===-1?r-1:(i-1+r)%r};case"Home":return{kind:"select",index:0};case"End":return{kind:"select",index:r-1};default:return{kind:"pass"}}}const aq=1500,vu=[{id:"login",label:"Sign in"},{id:"paste",label:"Paste a share"}],H_="aa-panel",W_=e=>`aa-tab-${e}`;async function yu(e){return(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json().catch(()=>null)}const oy=ae.forwardRef((e,t)=>m.jsxs("svg",{className:"aa-mark",viewBox:"0 0 44 44","aria-hidden":!0,ref:t,children:[m.jsx("circle",{className:"aa-mark-ring",cx:"22",cy:"22",r:"20"}),m.jsx("path",{className:"aa-mark-tick",d:"M13.5 22.5 L19.5 28.5 L31 17"})]}));oy.displayName="SuccessMark";function lq({onClose:e,onChanged:t}){const[r,i]=C.useState("login"),[o,a]=C.useState(null),[u,c]=C.useState(""),[f,p]=C.useState(""),[d,g]=C.useState(!1),[y,w]=C.useState(null),[E,_]=C.useState(null),b=C.useRef(!1),k=C.useRef(!1),S=C.useRef(null),N=C.useRef(null),T=C.useRef(null),A=C.useRef(null),L=C.useRef([]),P=C.useRef(!1),U=C.useCallback(()=>{b.current&&yu({action:"login-cancel"}).catch(()=>{}),e()},[e]),O=gi(U,{focusRef:T}),M=C.useCallback(async()=>{if(!Es(k.current))return;k.current=!0,g(!0),w(null),b.current=!0;const $=await yu({action:"login"}).catch(()=>null);if(k.current=!1,g(!1),!($!=null&&$.ok)){w(Tu($,"could not start the sign-in"));return}a($)},[]);C.useEffect(()=>{if(!D3(o==null?void 0:o.state))return;const $=window.setInterval(async()=>{try{const W=await fetch("/api/claude-accounts/login");W.ok&&a(await W.json())}catch{}},aq);return()=>window.clearInterval($)},[o]);const q=C.useRef(t);q.current=t;const V=C.useState(H3)[0];C.useEffect(()=>{var $;(o==null?void 0:o.state)==="awaiting_code"&&(($=S.current)==null||$.focus()),V.shouldAnnounce(o==null?void 0:o.state)&&q.current()},[o==null?void 0:o.state,V]),C.useEffect(()=>{var $;r==="paste"&&!P.current&&(($=N.current)==null||$.focus()),P.current=!1},[r]);const Q=C.useCallback($=>{var I;const W=oq($,vu.findIndex(Y=>Y.id===r),vu.length);W.kind!=="pass"&&($.preventDefault(),P.current=!0,i(vu[W.index].id),(I=L.current[W.index])==null||I.focus())},[r]),j=C.useCallback(async()=>{var W;if(!Es(k.current))return;k.current=!0,g(!0),w(null);const $=await yu({action:"login-code",code:u}).catch(()=>null);if(k.current=!1,g(!1),!($!=null&&$.ok)){w(Tu($,"the code was not accepted")),$!=null&&$.state&&a($),(W=S.current)==null||W.select();return}c(""),a($)},[u,o]),G=C.useCallback(async()=>{if(!Es(k.current))return;k.current=!0,g(!0),w(null);const $=await yu({action:"import",blob:f}).catch(()=>null);if(k.current=!1,g(!1),!($!=null&&$.ok)){w(Tu($,"the import failed"));return}p(""),_({added:$.added===!0,num:$.num??null,email:$.email??null}),t()},[f,t]),z=(o==null?void 0:o.state)==="done"?o.account:null,te=Pj(o==null?void 0:o.state)||!!(y&&b.current&&!d),J=B3({state:o==null?void 0:o.state,serverError:o==null?void 0:o.error,localError:y});return m.jsx("div",{className:"modal-backdrop",onClick:U,role:"presentation",children:m.jsxs("div",{ref:O,className:"modal aa-modal",onClick:$=>$.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Add a Claude account",children:[m.jsxs("header",{className:"modal-head",children:[m.jsx("div",{className:"modal-title",children:m.jsx("span",{className:"aa-tabs",role:"tablist","aria-label":"How to add the account",onKeyDown:Q,children:vu.map(($,W)=>m.jsx("button",{type:"button",role:"tab",id:W_($.id),ref:I=>{L.current[W]=I},"aria-selected":r===$.id,"aria-controls":H_,tabIndex:r===$.id?0:-1,className:`aa-tab${r===$.id?" on":""}`,onClick:()=>{P.current=!1,i($.id)},children:$.label},$.id))})}),m.jsx("div",{className:"modal-actions",children:m.jsx("button",{type:"button",className:"glyph-btn",onClick:U,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),m.jsx("section",{className:"modal-body aa-body",id:H_,role:"tabpanel","aria-labelledby":W_(r),children:r==="login"?z?m.jsxs("div",{className:"aa-done",children:[m.jsx(oy,{ref:A}),m.jsx(U_,{anchor:A}),m.jsx("h4",{children:z.added?`Account ${z.num} added`:"Credentials refreshed"}),m.jsxs("p",{className:"aa-note",children:[m.jsx("strong",{children:z.email}),z.added?" is in the rotation. The account you were using is still active.":" was already managed, so its stored credentials were replaced."]}),m.jsx("button",{type:"button",className:"btn primary",onClick:e,children:"Done"})]}):(o==null?void 0:o.state)==="awaiting_code"||(o==null?void 0:o.state)==="registering"?m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"aa-step",children:[m.jsx("h4",{children:"1 · Approve in the browser"}),m.jsx("p",{className:"aa-note",children:"A tab should have opened. If not, use this link:"}),m.jsx("a",{className:"aa-link",href:o.url??"#",target:"_blank",rel:"noreferrer noopener",children:o.url})]}),m.jsxs("div",{className:"aa-step",children:[m.jsx("h4",{children:"2 · Paste a code, if the page shows one"}),m.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."}),m.jsxs("div",{className:"aa-field",children:[m.jsx("input",{ref:S,type:"text",value:u,onChange:$=>c($.target.value),onKeyDown:$=>{$.key==="Enter"&&u.trim()&&!d&&j()},placeholder:"paste the code here",spellCheck:!1,autoComplete:"off","aria-label":"Sign-in code",disabled:o.state==="registering"}),m.jsx("button",{type:"button",className:"btn primary",...zr(d,!u.trim()||o.state==="registering"),onClick:j,children:o.state==="registering"?"registering…":"Continue"})]}),(y||o.error)&&m.jsx("p",{className:"aa-err",children:y??o.error}),m.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."})]})]}):te?m.jsxs("div",{className:"aa-step",children:[m.jsx("h4",{children:J.title}),m.jsx("p",{className:"aa-err",children:J.message}),m.jsx("button",{type:"button",className:"btn",onClick:()=>{b.current=!1,a(null),w(null),M()},children:"Try again"})]}):d||b.current?m.jsx("div",{className:"aa-step",children:m.jsx("p",{className:"aa-note",children:"Asking the claude CLI for a sign-in link…"})}):m.jsxs("div",{className:"aa-step aa-primer",children:[m.jsx("h4",{children:"Sign in to Anthropic"}),m.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."}),m.jsx("div",{className:"aa-actions",children:m.jsx("button",{type:"button",ref:T,className:"btn primary",onClick:M,children:"Open the sign-in page"})})]}):E?m.jsxs("div",{className:"aa-done",children:[m.jsx(oy,{ref:A}),E.added&&m.jsx(U_,{anchor:A}),m.jsx("h4",{children:E.added?`Account ${E.num} imported`:"Already here"}),m.jsx("p",{className:"aa-note",children:E.added?m.jsxs(m.Fragment,{children:[E.email?m.jsx("strong",{children:E.email}):"That account"," is in the rotation now. Nothing changed on the deck you copied it from."]}):"This deck already holds that account, so nothing changed."}),m.jsxs("div",{className:"aa-actions",children:[m.jsx("button",{type:"button",className:"btn primary",onClick:e,children:"Done"}),m.jsx("button",{type:"button",className:"btn",onClick:()=>_(null),children:"Import another"})]})]}):m.jsxs("div",{className:"aa-step",children:[m.jsx("h4",{children:"Paste an account shared from another deck"}),m.jsxs("div",{className:"aa-field",children:[m.jsx("input",{ref:N,type:"text",value:f,onChange:$=>p($.target.value),onKeyDown:$=>{$.key==="Enter"&&f.trim()&&!d&&G()},placeholder:"ccdeck1:…",spellCheck:!1,autoComplete:"off","aria-label":"Shared account"}),m.jsx("button",{type:"button",className:"btn primary",...zr(d,!f.trim()),onClick:G,children:d?"importing…":"Import"})]}),y&&m.jsx("p",{className:"aa-err",children:y}),m.jsxs("p",{className:"aa-note",children:["Use ",m.jsx("strong",{children:"share"})," on an account in the other deck. A share carries a live login and expires ten minutes after it is made."]})]})})]})})}function uq(e,t){const r=new Set(e),i=e.length?Math.max(...e):0;return[...new Set([...e,i+1])].sort((o,a)=>o-a).map(o=>{const a=o===t?"here":r.has(o)?"swap":"free";return{slot:o,kind:a,label:a==="here"?`slot ${o}`:`slot ${o} · ${a}`}})}function cq(e,t,r){if(!(r!=null&&r.ok))return null;const i=Number.isInteger(r.to)?r.to:null;if(i==null)return{menuFor:null,confirmRemove:null,shareFor:null,swapNote:null};const o=r.swapped===!0&&i!==t;return{menuFor:e.menuFor===t?i:o&&e.menuFor===i?t:e.menuFor,confirmRemove:null,shareFor:null,swapNote:o?{at:i,displaced:t}:null}}function dq(e,t,r){return t!=null&&e.some(i=>i.slot===t)?t:r}function fq(e,t,r){var o;const i=((o=e.find(a=>a.slot===t))==null?void 0:o.kind)??"here";return i==="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 ${r}.`}:i==="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 ${r}.`}}function hq(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 V_(e){return typeof e.id=="string"&&e.id.startsWith("scoped-")}function G_(e){const t=e.filter(c=>!V_(c)),r=e.filter(c=>V_(c)),i=t.length?t:r,o=t.length?r:[],a=i.reduce((c,f)=>c&&c.pct>=f.pct?c:f,null);let u=null;for(const c of o)a&&c.pct<=a.pct||(!u||c.pct>u.pct)&&(u=c);return{shown:i,rest:o,fuller:u,peak:u??a}}function pq(e,t,r){return e<1?null:t?"fewer":r?`${r.label} ${Math.round(r.pct)}%`:`${e} more`}function mq(e,t,r,i){const o=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=r===1?"the other window":`the other ${r} windows`;return`${o} ${i?"Hide":"Show"} ${a}.`}const gq="\0";function Fy(e){const t=typeof e.email=="string"?e.email.trim():"";if(!t)return`slot:${e.num}`;const r=typeof e.org=="string"?e.org.trim():"";return`acct:${t}${gq}${r}`}function vq(e,t){const r=Fy(t);return e.includes(r)?e.filter(i=>i!==r):[...e,r]}function yq(e,t){if(!Array.isArray(t))return e;const r=new Set(t.map(Fy)),i=e.filter(o=>r.has(o));return i.length===e.length?e:i}const wq=64;function xq(e,t){const r=e.trim();return{alias:r,commit:r!==(t??"").trim()}}const _q=Object.freeze({text:"couldn't reach the deck server",reload:!0});async function Y_(e){return e.ok?{ok:!0,status:e.status,body:null}:{ok:!1,status:e.status,body:await e.json().catch(()=>null)}}function bq(e){const t=e.find(i=>!i.ok);if(!t)return null;const r=So(t.body);return{text:iy(t.body,`the deck server answered ${t.status}`),...r?{raw:r}:{},reload:!0}}function K_(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 X_=15e3,kq=8e3,pf=1800,Sq=3e4,Eq=[70,80,85,90,95];function Q_(e,t){return jj(t-Math.floor(e/1e3))}function Nq(e,t){if(!e)return"";const r=Math.floor(e/1e3)-t;return r<=0?" · due":r<60?` · next in ${r}s`:` · next in ${Math.round(r/60)}m`}function Cq(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 Z_({lane:e,nowSec:t}){const r=Math.min(100,Math.max(0,e.pct)),i=r>=90?"var(--err)":r>=70?"var(--warn)":"var(--accent)",o=e.resetAt?Tj(e.resetAt,t):null;return m.jsxs("div",{className:"ap-lane",children:[m.jsx("span",{className:"ap-lane-label",children:e.label}),m.jsx("div",{className:"ap-lane-track",children:m.jsx("div",{className:"ap-lane-fill",style:{width:`${r===0?1.5:r}%`,background:i,opacity:r===0?.4:1}})}),m.jsxs("span",{className:"ap-lane-pct",style:{color:i},children:[r,"%"]}),m.jsx("span",{className:"ap-lane-reset",children:o?`resets ${o}`:""})]})}async function jq(e){var r;let t=!1;try{t=await Promise.race([((r=navigator.clipboard)==null?void 0:r.writeText(e).then(()=>!0))??Promise.resolve(!1),new Promise(i=>window.setTimeout(()=>i(!1),500))])}catch{t=!1}if(t)return!0;try{const i=document.createElement("textarea");i.value=e,i.setAttribute("readonly",""),i.style.cssText="position:fixed;top:0;left:0;opacity:0",document.body.appendChild(i),i.select(),t=document.execCommand("copy"),i.remove()}catch{t=!1}return t}function Tq(e,t){const r=Math.round(e/1e3)-t;return r<=0?{text:"expired",tone:"gone"}:r<60?{text:`expires in ${r}s`,tone:"soon"}:{text:`expires in ${Math.round(r/60)}m`,tone:"ok"}}function Rq({onClose:e}){var Be,Ze,ut,_t;const[t,r]=C.useState(null),[i,o]=C.useState(null),[a,u]=C.useState(null),[c,f]=C.useState(!1),[p,d]=C.useState(null),[g,y]=C.useState(()=>Math.floor(Date.now()/1e3)),w=C.useRef(null),[E,_]=C.useState(null),[b,k]=C.useState(!1),[S,N]=C.useState(""),[T,A]=C.useState(null),[L,P]=C.useState(null),[U,O]=C.useState(null),[M,q]=C.useState(!1),[V,Q]=C.useState(null),[j,G]=C.useState(null),[z,te]=C.useState(null),[J,$]=C.useState(null),[W,I]=C.useState(!1),[Y,ue]=C.useState([]),F=C.useRef(null),Z=C.useCallback(ie=>Aj(F.current)?(F.current=ie,u(ie),!0):!1,[]),ne=C.useCallback(()=>{F.current=null,u(null)},[]),B=(ie,qe=!1)=>{const Oe=Rj(a,ie);return{disabled:Oe.disabled,"aria-busy":Oe.busy||qe}},de=C.useCallback(ie=>{window.requestAnimationFrame(()=>{var qe;if(g3(((qe=document.activeElement)==null?void 0:qe.tagName)??null))for(const Oe of m3(ie)){const Te=document.querySelector(Oe);if(Te){Te.focus();return}}})},[]),pe=C.useCallback(async(ie=!1)=>{ie&&f(!0);const qe=new AbortController,Oe=window.setTimeout(()=>qe.abort(),Sq);try{const[Te,ze]=await Promise.all([fetch(`/api/claude-accounts${ie?"?refresh=1":""}`,{signal:qe.signal}),fetch("/api/cswap-auto",{signal:qe.signal})]);if(Te.ok){const Je=await Te.json();r(Je),ue(ke=>yq(ke,Je.accounts))}ze.ok&&o(await ze.json());const He=bq([await Y_(Te),await Y_(ze)]);d(Je=>K_(Je,He))}catch{d(Te=>K_(Te,_q))}finally{window.clearTimeout(Oe),ie&&f(!1)}},[]),ye=C.useCallback(async(ie,qe)=>{if(!Z(qe))return null;d(null);try{const Te=await(await fetch("/api/cswap-auto",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(ie)})).json().catch(()=>null);return Te!=null&&Te.ok||d({text:iy(Te,"command failed"),raw:So(Te)}),Te}catch{return d({text:"server unreachable"}),null}finally{ne()}},[Z,ne]),Pe=C.useCallback(async(ie,qe)=>{if(!Z(qe))return null;d(null);try{const Te=await(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(ie)})).json().catch(()=>null);return Te!=null&&Te.ok||d({text:Tu(Te,"command failed")}),Te}catch{return d({text:"server unreachable"}),null}finally{ne()}},[Z,ne]);C.useEffect(()=>(pe(!0),w.current=window.setInterval(()=>pe(!1),X_),()=>{w.current!=null&&window.clearInterval(w.current)}),[pe]),C.useEffect(()=>{const ie=window.setInterval(()=>y(Math.floor(Date.now()/1e3)),3e4);return()=>window.clearInterval(ie)},[]);const Ue=((Be=i==null?void 0:i.settings["autoswitch.threshold"])==null?void 0:Be.value)??"90",De=J??Ue,Me=hq(De,Ue),_e=(Ze=t==null?void 0:t.accounts)==null?void 0:Ze.find(ie=>ie.active),Fe=((ut=G_((_e==null?void 0:_e.lanes)??[]).peak)==null?void 0:ut.pct)??null,we=Fe!=null&&Fe>=Number(Ue)-15,fe=async ie=>{if(Z(`switch-${ie}`)){d(null);try{const Oe=await(await fetch("/api/claude-accounts/switch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({account:ie})})).json().catch(()=>null);Oe!=null&&Oe.ok||d({text:iy(Oe,"the switch failed"),raw:So(Oe)}),await pe(!0)}catch{d({text:"server unreachable"})}finally{ne(),de(ie)}}},Ke=async(ie,qe)=>{const{commit:Oe,alias:Te}=xq(S,qe);if(Oe){const ze=await Pe({action:"alias",account:ie,alias:Te},`alias-${ie}`);if(await pe(!0),!(ze!=null&&ze.ok))return;N(Te)}A(ie),window.setTimeout(()=>A(ze=>ze===ie?null:ze),pf)},gt=async(ie,qe)=>{const Oe=await Pe({action:"move",account:ie,slot:qe},`move-${ie}`),Te=cq({menuFor:E,shareFor:(U==null?void 0:U.num)??null},ie,Oe);if(await pe(!0),Te){_(Te.menuFor),P(Te.confirmRemove),Te.shareFor==null&&(O(null),q(!1)),Q(Te.swapNote);const ze=Te.swapNote;ze&&window.setTimeout(()=>Q(He=>He===ze?null:He),kq),G(null),de(Te.menuFor)}return Oe},tt=async(ie,qe,Oe)=>{if(Oe.sends){const Te=await gt(ie,qe);if(!(Te!=null&&Te.ok))return}te(ie),window.setTimeout(()=>te(Te=>Te===ie?null:Te),pf)},ot=async(ie,qe)=>{if(qe.sends){const Oe=await ye({action:"setting",key:"autoswitch.threshold",value:ie},"threshold");if(await pe(!0),!(Oe!=null&&Oe.ok))return;$(null)}I(!0),window.setTimeout(()=>I(!1),pf)};return m.jsxs("aside",{className:"accounts-panel",id:"accounts-panel","aria-label":"Claude accounts",children:[m.jsxs("div",{className:"ap-header",children:[m.jsx("h2",{children:"Accounts"}),m.jsxs("div",{className:"ap-header-right",children:[m.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:"+"}),m.jsx("button",{type:"button",className:"glyph-btn ap-refresh",onClick:()=>pe(!0),...B("reload",c),"aria-label":"Reload accounts",title:"Reload from claude-swap",children:c?"…":"↻"}),m.jsx("button",{type:"button",className:"glyph-btn",onClick:e,"aria-label":"Close accounts panel",title:"Close (A)",children:"×"})]})]}),t==null?p?m.jsxs("div",{className:"ap-empty",role:"alert",children:[m.jsx("span",{title:p.raw||void 0,children:p.text}),m.jsxs("span",{className:"ap-hint",children:["No accounts have arrived, so there is nothing to show yet. The panel keeps trying every ",X_/1e3," seconds."]}),m.jsx("button",{type:"button",className:"ap-fix",disabled:c,onClick:()=>pe(!0),children:c?"trying…":"try again"})]}):m.jsx("div",{className:"ap-empty",children:"Checking…"}):t.ok?m.jsxs(m.Fragment,{children:[(_t=t.accounts)==null?void 0:_t.map(ie=>{const{shown:qe,rest:Oe,fuller:Te,peak:ze}=G_(ie.lanes),He=Y.includes(Fy(ie)),Je=pq(Oe.length,He,Te);return m.jsxs("div",{className:`ap-account${ie.active?" active":""}`,children:[m.jsxs("div",{className:"ap-account-head",children:[m.jsx("span",{className:"ap-num",children:ie.num}),ie.alias&&m.jsx("span",{className:"ap-alias",title:ie.alias,children:ie.alias}),m.jsx("span",{className:"ap-email",title:ie.email??void 0,children:ie.email}),m.jsx("button",{type:"button",id:`ap-more-${ie.num}`,className:`ap-more${E===ie.num?" on":""}`,"aria-label":`Manage account ${ie.num}`,"aria-expanded":E===ie.num,"aria-controls":E===ie.num?`ap-manage-${ie.num}`:void 0,title:"Share, rename, move, remove",onClick:()=>{_(E===ie.num?null:ie.num),N(ie.alias??""),P(null),O(null),q(!1),Q(null),A(null),G(null),te(null)},children:"⋯"}),ie.active&&m.jsx("span",{className:"ap-badge-active",children:"active"}),ie.disabled&&m.jsx("span",{className:"ap-badge-held",children:"held out"}),!ie.active&&!ie.disabled&&m.jsx("button",{type:"button",className:"ap-manage-btn ap-switch",...B(`switch-${ie.num}`),onClick:()=>fe(ie.num),title:`Switch to ${ie.alias??ie.email}`,children:a===`switch-${ie.num}`?"…":"switch"})]}),m.jsx("div",{className:"ap-lanes",id:`ap-lanes-${ie.num}`,children:qe.length?m.jsxs(m.Fragment,{children:[qe.map(ke=>m.jsx(Z_,{lane:ke,nowSec:g},ke.id)),He&&Oe.map(ke=>m.jsx(Z_,{lane:ke,nowSec:g},ke.id))]}):m.jsx("div",{className:"ap-hint",children:"No usage recorded yet."})}),m.jsxs("div",{className:"ap-meta",children:[ie.error&&(()=>{const ke=Cq(ie.error);return m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"ap-err",title:ke.hint,children:ke.text}),ke.fixable&&m.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"})]})})(),Je&&m.jsx("button",{type:"button",className:"ap-lanes-more","aria-expanded":He,"aria-controls":`ap-lanes-${ie.num}`,title:mq(ie.headroom,(ze==null?void 0:ze.label)??null,Oe.length,He),onClick:()=>ue(ke=>vq(ke,ie)),children:Je}),(((i==null?void 0:i.enabled)||(i==null?void 0:i.external))&&!ie.active||ie.disabled)&&m.jsx("button",{type:"button",className:"ap-rotate",...B(`rot-${ie.num}`),onClick:()=>ye({action:"account",account:ie.num,enabled:ie.disabled},`rot-${ie.num}`).then(()=>pe(!0)),title:ie.disabled?"Return this account to auto-rotation":"Hold this account out of auto-rotation",children:ie.disabled?"put back":"hold out"}),ie.fetchedAt?m.jsxs("span",{className:`ap-age${ie.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 ",Q_(ie.fetchedAt,g),Nq(ie.nextAt,g)]}):m.jsx("span",{className:"ap-age ap-stale",title:"claude-swap has not read this account yet",children:"never collected"})]}),E===ie.num&&m.jsxs("div",{className:"ap-manage",id:`ap-manage-${ie.num}`,role:"group","aria-label":`Manage account ${ie.num}`,children:[m.jsxs("div",{className:"ap-manage-name",children:[m.jsx("label",{className:"vis-hidden",htmlFor:`ap-alias-${ie.num}`,children:"Alias"}),m.jsx("input",{id:`ap-alias-${ie.num}`,className:"ap-manage-input",type:"text",value:S,onChange:ke=>N(ke.target.value),onKeyDown:ke=>{ke.key==="Enter"&&Ke(ie.num,ie.alias)},maxLength:wq,placeholder:"e.g. work",spellCheck:!1,autoFocus:!0}),m.jsx("button",{type:"button",className:"ap-manage-btn",...B(`alias-${ie.num}`),onClick:()=>Ke(ie.num,ie.alias),title:"A short name to show instead of the email",children:T===ie.num?"saved":"save"})]}),(()=>{const ke=uq((t.accounts??[]).map(at=>at.num),ie.num),bt=dq(ke,j,ie.num),nt=fq(ke,bt,ie.num);return m.jsxs("div",{className:"ap-manage-slot",children:[m.jsx("label",{className:"vis-hidden",htmlFor:`ap-slot-${ie.num}`,children:"Slot"}),m.jsx("span",{className:"ap-field",children:m.jsx("select",{id:`ap-slot-${ie.num}`,value:String(bt),...B(`move-${ie.num}`),onChange:at=>G(Number(at.target.value)),children:ke.map(at=>m.jsx("option",{value:at.slot,children:at.label},at.slot))})}),m.jsx("button",{type:"button",className:"ap-manage-btn",...B(`move-${ie.num}`),title:nt.title,onClick:()=>tt(ie.num,bt,nt),children:z===ie.num?nt.done:nt.label})]})})(),m.jsxs("div",{className:"ap-manage-acts",children:[m.jsx("button",{type:"button",className:"ap-manage-btn",...B(`share-${ie.num}`),title:`Copy this account to another ${Wt}. 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()=>{q(!1);const ke=await Pe({action:"share",account:ie.num},`share-${ie.num}`);ke!=null&&ke.ok&&O({num:ie.num,blob:ke.blob,expiresAt:ke.expiresAt})},children:"share"}),m.jsx("button",{type:"button",className:`ap-manage-btn danger${L===ie.num?" armed":""}`,...B(`rm-${ie.num}`),title:L===ie.num?"This deletes the stored credentials for this account":"Remove this account from claude-swap",onClick:()=>{if(L!==ie.num){P(ie.num),window.setTimeout(()=>P(ke=>ke===ie.num?null:ke),4e3);return}P(null),Pe({action:"remove",account:ie.num},`rm-${ie.num}`).then(()=>{_(null),pe(!0),de(null)})},children:L===ie.num?"confirm":"remove"})]}),(V==null?void 0:V.at)===ie.num&&(()=>{var nt;const ke=(nt=t.accounts)==null?void 0:nt.find(at=>at.num===V.displaced),bt=(ke==null?void 0:ke.alias)??(ke==null?void 0:ke.email)??"the account that was there";return m.jsxs("span",{className:"ap-manage-hint ap-manage-swap",title:`Slot ${V.at} was taken, so the two accounts traded places: ${bt} now holds slot ${V.displaced}.`,children:["swapped with slot ",V.displaced]})})(),(U==null?void 0:U.num)===ie.num&&(()=>{const ke=Tq(U.expiresAt,g),bt=ke.tone==="gone";return m.jsxs("div",{className:`ap-share${bt?" expired":""}`,children:[m.jsx("code",{className:"ap-share-blob",children:U.blob}),m.jsxs("div",{className:"ap-share-foot",children:[m.jsx("button",{type:"button",className:"ap-manage-btn",...B(`share-${ie.num}`),onClick:async()=>{if(bt){q(!1);const nt=await Pe({action:"share",account:ie.num},`share-${ie.num}`);nt!=null&&nt.ok&&O({num:ie.num,blob:nt.blob,expiresAt:nt.expiresAt});return}await jq(U.blob)&&(q(!0),window.setTimeout(()=>q(!1),1800))},children:bt?"make a new share":M?"copied":"copy"}),m.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:[m.jsx("span",{className:"ap-share-warn",children:"this is the password"})," · ",m.jsx("span",{className:`ap-share-expiry ${ke.tone}`,children:ke.text})]})]})]})})()]})]},ie.num)}),(i==null?void 0:i.ok)&&m.jsxs("div",{className:"ap-auto",children:[m.jsxs("div",{className:"ap-auto-head",children:[m.jsx("h3",{className:"ap-auto-title",children:"Auto-switch"}),m.jsxs("span",{className:"ap-auto-ctl",children:[Fe!=null&&m.jsxs("span",{className:`ap-auto-now${we?" near":""}`,children:[Math.round(Fe),"%"]}),m.jsx("span",{className:"ap-field",title:"Switch once the active account passes this much of its limit",children:m.jsx("select",{"aria-label":"Switch threshold",value:De,...B("threshold"),onChange:ie=>$(ie.target.value),children:Eq.map(ie=>m.jsxs("option",{value:ie,children:[ie,"%"]},ie))})}),m.jsx("button",{type:"button",className:"ap-manage-btn",...B("threshold"),title:Me.title,onClick:()=>ot(De,Me),children:W?Me.done:Me.label}),m.jsxs("button",{type:"button",className:`ap-auto-state${i.enabled?" live":""}`,role:"switch","aria-checked":i.enabled,"aria-label":"Auto-switch",...B("enable"),onClick:()=>ye({action:"enable",enabled:!i.enabled},"enable").then(()=>pe(!0)),title:i.enabled?"Stop switching accounts automatically":"Switch accounts automatically when the active one nears its limit",children:[m.jsx("i",{className:i.enabled?"ap-pulse":"ap-dot","aria-hidden":!0}),i.enabled?"on":"off"]})]})]}),i.external&&m.jsxs("p",{className:"ap-auto-note",children:[m.jsx("i",{className:"ap-pulse","aria-hidden":!0})," A ",m.jsx("code",{children:"cswap auto"})," loop in your terminal is doing the switching. The deck stands down while it runs",i.enabled?" — this toggle takes over when you stop it.":"."]}),i.lastTick&&m.jsx("div",{className:"ap-auto-foot",children:m.jsxs("span",{className:"ap-auto-result",children:["checked ",Q_(i.lastTick.at,g)]})})]}),p&&m.jsxs("div",{className:"ap-failure",role:"alert",children:[m.jsx("span",{className:"ap-failure-text",title:p.raw||void 0,children:p.text}),m.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>d(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),m.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."})]}):m.jsx("div",{className:"ap-empty",children:t.reason==="no_cswap"?m.jsxs(m.Fragment,{children:[m.jsx("span",{children:"claude-swap isn't installed."}),m.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&&m.jsx("code",{className:"ap-cmd",children:t.hint}),m.jsxs("span",{className:"ap-hint",children:["Then add an account with the ",m.jsx("strong",{children:"+"})," button above."]})]}):t.reason==="no_accounts"?m.jsxs(m.Fragment,{children:[m.jsx("span",{children:"No accounts added yet."}),m.jsxs("span",{className:"ap-hint",children:["claude-swap is installed but has nothing in its store. Use the ",m.jsx("strong",{children:"+"})," above to sign one in, or to paste one shared from another deck."]})]}):m.jsxs(m.Fragment,{children:[m.jsx("span",{children:"Couldn't read the account store."}),m.jsxs("span",{className:"ap-hint",children:["claude-swap is installed, but its store could not be read",t.reason?` (${t.reason})`:"","."]})]})}),b&&m.jsx(lq,{onClose:()=>k(!1),onChanged:()=>pe(!0)})]})}const Aq=3e4;function Iq({bundle:e,running:t,lastTried:r}){return!t||e===t?!1:r!==t}function Mq({bundle:e,running:t,pending:r,lastTried:i}){return t?Iq({bundle:e,running:t,lastTried:i})?"reload":r==null||r&&r!==t?"wait":"confirm":"wait"}function Oq(e){return!e||e.state!=="failed"?null:`${typeof e.at=="number"?e.at:0}:${e.error??""}`}function Pq({asked:e,reported:t}){return t?t!==e:!1}function Lq(e){const t=e.thresholdMs??Aq;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 $q(e,t){return e==="confirmation"?t.confirmOpen?"clear":"ignore":t.modalOpen||t.confirmOpen?"ignore":"confirm"}function qq(e){if(!e||typeof e!="object")return null;const t=e;if(typeof t.decks!="number"||typeof t.mine!="boolean")return null;const r=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 r=="number"?r:null}}function Dq(e){return e<=0?null:e===1?"the one agent":`all ${e} agents`}function Fq(e,t){const r=Dq(e),i=r?`removes ${r} on the canvas`:null,o=c=>`This ${i?`${i} and ${c}`:c}`;if(!t)return{note:`${o("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:`${o("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 c=t.ownerPort===null?"another running deck owns that file":`the deck on port ${t.ownerPort} owns that file`,f=t.decks>2?`, one of ${t.decks} decks sharing it`:"";return{note:`${o(`leaves the event log alone: ${c}${f}`)}. Clearing here empties this canvas only — restart this deck and the log replays back onto it. Layout, pins and selection go with it.`,confirm:"Clear this canvas"}}if(t.decks<=1)return{note:`${o("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,u=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:`${o(`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. ${u} This cannot be undone.`,confirm:"Clear everything"}}function zq({agentCount:e,onConfirm:t,onCancel:r}){const i=C.useRef(null),o=gi(r,{focusRef:i,layer:zL}),[a,u]=C.useState(null);C.useEffect(()=>{let p=!1;return fetch("/api/clear").then(d=>d.ok?d.json():null).then(d=>{p||u(qq(d))}).catch(()=>{}),()=>{p=!0}},[]);const{note:c,confirm:f}=Fq(e,a);return m.jsx("div",{className:"modal-backdrop",onClick:r,role:"presentation",children:m.jsxs("div",{ref:o,className:"modal clear-confirm",onClick:p=>p.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"clear-confirm-title",children:[m.jsxs("header",{className:"modal-head",children:[m.jsxs("div",{className:"modal-title",children:[m.jsx("span",{className:"status-dot err","aria-hidden":!0}),m.jsx("span",{id:"clear-confirm-title",className:"modal-tool-name",children:"Clear the deck?"})]}),m.jsx("div",{className:"modal-actions",children:m.jsx("button",{type:"button",className:"glyph-btn",onClick:r,"aria-label":"Cancel (Esc)",title:"Cancel (Esc)",children:"×"})})]}),m.jsxs("section",{className:"modal-body",children:[m.jsx("p",{className:"modal-note",children:c}),m.jsxs("div",{className:"cc-actions",children:[m.jsx("button",{type:"button",ref:i,className:"btn",onClick:r,children:"Cancel"}),m.jsx("button",{type:"button",className:"btn danger",onClick:t,children:f})]})]})]})})}const Bq="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.",Uq=[{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:"finish 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:[]}]}];function Hq({onClose:e}){const t=gi(e);return m.jsx("div",{className:"modal-backdrop",onClick:e,role:"presentation",children:m.jsxs("div",{ref:t,className:"modal key-help",onClick:r=>r.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"key-help-title",children:[m.jsxs("header",{className:"modal-head",children:[m.jsx("div",{className:"modal-title",children:m.jsx("span",{id:"key-help-title",className:"modal-tool-name",children:"Keyboard shortcuts"})}),m.jsx("div",{className:"modal-actions",children:m.jsx("button",{type:"button",className:"glyph-btn",onClick:e,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),m.jsxs("section",{className:"modal-body",children:[m.jsx("p",{className:"modal-note",children:Bq}),m.jsx("div",{className:"shortcuts",children:Uq.map(r=>m.jsxs(C.Fragment,{children:[m.jsx("h3",{className:"kh-group",children:r.title}),r.rows.map(i=>m.jsxs("div",{className:"sc",children:[m.jsx("kbd",{children:i.cap}),m.jsx("span",{children:i.action})]},`${r.title}:${i.cap}:${i.action}`))]},r.title))})]})]})})}function Wq(e){return e.slice().sort((t,r)=>t.y-r.y||t.x-r.x)}function Vq(e,t,r){var u;if(e.length===0)return null;const i=Wq(e),o=t?i.findIndex(c=>c.id===t):-1,a=o===-1?r===1?0:i.length-1:(o+r+i.length)%i.length;return((u=i[a])==null?void 0:u.id)??null}const Gq=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Escape","Delete","Backspace"]);function Yq(e,t){return t==null?{kind:"deck",nodeId:null}:e.key==="Enter"||e.key===" "?{kind:"activate",nodeId:t,additive:e.shiftKey}:Gq.has(e.key)?{kind:"node",nodeId:t}:{kind:"deck",nodeId:t}}const Kq=new Set(["","BODY","HTML","#DOCUMENT"]);function Xq(e){return!e||My(e)?!1:!Kq.has(String(e.tagName??"").toUpperCase())}function wu(e,t){if(t.size!==0)for(const r of Array.from(e.keys()))t.has(r)||e.delete(r)}function Qq(e,t){let r=!1;for(const o of e)if(!t.has(o)){r=!0;break}if(!r)return e;const i=new Set;for(const o of e)t.has(o)&&i.add(o);return i}function Zq(e){const t=new Set;for(const r of e)t.add(r.id),t.add(`group:${r.sessionId}`);return t}function Jq(e,t){if(!t||!e.agents.get(t))return null;const i=new Set([t]);let o=t;for(;o;){const u=e.agents.get(o);if(!(u!=null&&u.parentId)||i.has(u.parentId))break;i.add(u.parentId),o=u.parentId}let a=!0;for(;a;){a=!1;for(const u of e.agents.values())u.parentId&&i.has(u.parentId)&&!i.has(u.id)&&(i.add(u.id),a=!0)}return i}function eD(e,t){const r=new Set;for(const i of t){const o=Jq(e,i);if(o)for(const a of o)r.add(a)}return r.size>0?r:null}function Lj(e,t,r){return!t.has(e)||r.has(e)}function tD(e,t,r,i){return!t.has(e)&&Lj(e,r,i)}function nD(e,t,r){const i={x:0,y:0};return t.set(e,i),r.add(e),i}function rD(e,t,r,i){r.set(e,t),i.delete(e)}const sD=40,iD=120;function oD(e,t){let r=null,i=0,o=Number.NEGATIVE_INFINITY;const a=()=>{r=null,o=t.now(),e()},u=()=>{r!=null&&(t.clearTimeout(r),r=null)},c=(f,p,d)=>{if(r!=null){if(i<=f)return;u()}const g=Math.min(d,Math.max(0,f-p));i=f,r=t.setTimeout(a,g)};return{live(f=sD){const p=t.now(),d=Math.max(o+f,p);if(d<=p){u(),a();return}c(d,p,f)},replay(f=iD){u(),i=t.now()+f,r=t.setTimeout(a,f)},flush(){u(),a()},cancel(){u()}}}const aD=1e3;function lD(e={}){const t=Math.max(1,Math.floor(e.limit??aD)),r=e.protect;let i=!1,o=[],a=new Set,u=0,c=0,f=null;return{get paused(){return i},get size(){return o.length},get dropped(){return u},get overflowed(){return u>0},get through(){return c},accept(p){const d=typeof(p==null?void 0:p.seq)=="number"?p.seq:null,g=(p==null?void 0:p.epoch)??null,y=g!==null&&g!==f;y&&(f=g,c=0);const w=d!==null&&!y&&d<=c;if(d!==null&&d>c&&(c=d),!i)return!0;if(w)return!1;if(o.push(p),r!=null&&r(p)&&a.add(p),o.length>t){let E=0;if(a.size<o.length)for(;a.has(o[E]);)E++;const[_]=o.splice(E,1);a.delete(_),u++}return!1},setPaused(p){if(i=p,p)return[];const d=o;return o=[],a=new Set,u=0,d}}}const $j="agent-dag.theme";function uD(e){return e==="light"?"light":"dark"}function cD(){return uD(qy($j))}function dD({waiting:e,running:t}){return{title:e>0?`(${e}) ${Wt}`:Wt,icon:e>0?"waiting":t>0?"running":"idle"}}const mf={waiting:"#c97d12",running:"#2a90d4",idle:"#7e828c"};function gf(e,t){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}"/>`:`<circle cx="16" cy="16" r="12" fill="none" stroke="${e}" stroke-width="5"/>`+(t==="running"?`<circle cx="16" cy="16" r="5" fill="${e}"/>`:"")}</svg>`}const fD=Object.freeze({waiting:`data:image/svg+xml,${encodeURIComponent(gf(mf.waiting,"waiting"))}`,running:`data:image/svg+xml,${encodeURIComponent(gf(mf.running,"running"))}`,idle:`data:image/svg+xml,${encodeURIComponent(gf(mf.idle,"idle"))}`}),hD="No sessions are waiting for you.";function pD(e){if(e.length===0)return"";const[t,...r]=e;if(r.length===0)return`${t.label} is waiting for your permission.`;const i=`${r.length} more session${r.length===1?"":"s"}`;return`${t.label} and ${i} are waiting for your permission.`}function mD(e,t){return t!==""?t:e===""?"":hD}function gD(){let e=0;return{begin(){const t=++e;return()=>t===e},cancel(){e++}}}function vD(e,t=new Date){return new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate()-(e-1))).toISOString().slice(0,10).replace(/-/g,"")}function yD(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 wD(e){return e.claude&&e.codex?"Claude Code and Codex":e.claude?"Claude Code":e.codex?"Codex":null}const J_={claude:"Claude Code",codex:"Codex",opencode:"OpenCode",openclaw:"OpenClaw",copilot:"GitHub Copilot",pi:"pi-agent"};function zy(e){const t=e.toLowerCase();return Object.hasOwn(J_,t)?J_[t]:t?t[0].toUpperCase()+t.slice(1):""}function xD(e){return e.length<=1?e[0]??"":`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`}function _D(e,t=[]){const r=t.length?xD(t.map(zy)):wD(e);return r?`via ccusage · local ${r} logs`:"via ccusage · local agent logs"}function bD(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:"."}]},r=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,r]}function kD(e,t){const r=t.on?"Sound: on — a tone when a turn finishes, another when Claude asks for you (M)":"Sound: off — click for a tone when a turn finishes (M)",i=e.codex?`
76
-
77
- 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.`:"",o=t.on&&t.locked?`
78
-
79
- Waiting for a click: this browser plays no sound until the page has been used at least once. Anything you press unlocks it.`:"";return r+i+o}function qj(e){const t=new Map;for(const r of e)for(const i of r.agents??[]){if(!i||typeof i.agent!="string"||i.agent==="")continue;const o=t.get(i.agent)??{id:i.agent,cost:0,tokens:0};o.cost+=Number.isFinite(i.totalCost)?i.totalCost:0,o.tokens+=Number.isFinite(i.totalTokens)?i.totalTokens:0,t.set(i.agent,o)}return[...t.values()].sort((r,i)=>i.cost-r.cost||r.id.localeCompare(i.id))}function SD(e){const t=qj([{agents:e}]);return t.length<2?null:t.map(r=>`${zy(r.id)} ${Ge(r.cost)}`).join(" · ")}function e1(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 ED(e,t){if(!(t>0)||!(e>0))return"0%";const r=e/t*100;return r<.1?"<0.1%":`${r.toFixed(1)}%`}function xu(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 ND=[7,14,30,90];function CD(e){const[t,r]=C.useState(null),[i,o]=C.useState(!1),a=C.useState(gD)[0],u=C.useRef(!1),c=(f=!1)=>{if(f&&!Es(u.current))return;const p=a.begin();u.current=f;const d=e;o(!0);const y=`/api/ccusage?since=${vD(d)}${f?"&refresh=1":""}`;fetch(y).then(w=>w.json()).then(w=>{p()&&r({range:d,resp:w})}).catch(()=>{p()&&r({range:d,resp:{ok:!1,reason:"unreachable"}})}).finally(()=>{p()&&(u.current=!1,o(!1))})};return C.useEffect(()=>(c(!1),()=>a.cancel()),[e]),{landed:t,loading:i,reload:()=>c(!0)}}function jD({onClose:e,providers:t}){var U;const[r,i]=C.useState(30),[o,a]=C.useState(null),{landed:u,loading:c,reload:f}=CD(r),p=C.useRef(null),d=gi(e,{focusRef:p}),g=yD({loading:c,want:r,answer:u&&{range:u.range,ok:u.resp.ok===!0,days:((U=u.resp.days)==null?void 0:U.length)??0}}),y=g.phase==="chart"?u.resp.days??[]:[],w=C.useMemo(()=>y.reduce((O,M)=>Math.max(O,M.totalCost),0),[y]),E=C.useRef(null);C.useLayoutEffect(()=>{const O=E.current;O&&(O.scrollLeft=O.scrollWidth)},[y]);const{totalCost:_,totalTok:b,inOut:k,cacheRead:S,modelCosts:N}=C.useMemo(()=>{let O=0,M=0,q=0,V=0;const Q=new Map;for(const j of y){O+=j.totalCost,M+=j.totalTokens,q+=j.inputTokens+j.outputTokens,V+=j.cacheReadTokens;for(const G of j.modelBreakdowns)Q.set(G.modelName,(Q.get(G.modelName)??0)+G.cost)}return{totalCost:O,totalTok:M,inOut:q,cacheRead:V,modelCosts:Q}},[y]),T=C.useMemo(()=>Array.from(N.entries()).sort((O,M)=>M[1]-O[1]),[N]),A=C.useMemo(()=>qj(y),[y]),L=A.length>1,P=o?y.find(O=>O.period===o)??null:null;return m.jsx("div",{className:"uh-backdrop",onClick:e,role:"presentation",children:m.jsxs("div",{ref:d,className:"uh-modal",onClick:O=>O.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Usage history",children:[m.jsxs("header",{className:"uh-head",children:[m.jsxs("div",{className:"uh-titlewrap",children:[m.jsx("div",{className:"uh-title",children:"Usage history"}),m.jsx("div",{className:"uh-sub",children:_D(t,A.map(O=>O.id))})]}),m.jsx("div",{className:"uh-range",role:"group","aria-label":"Range",children:ND.map(O=>m.jsxs("button",{type:"button","aria-pressed":r===O,className:"uh-range-btn",onClick:()=>{i(O),a(null)},children:[O,"d"]},O))}),m.jsx("button",{className:"glyph-btn uh-reload",onClick:f,...zr(c),title:"Re-run ccusage","aria-label":"Reload",children:c?"…":"↻"}),m.jsx("button",{ref:p,className:"glyph-btn uh-close",onClick:e,"aria-label":"Close",children:"×"})]}),g.phase==="busy"?m.jsx("div",{className:"uh-status","aria-busy":"true",children:u?"running ccusage…":"running ccusage… (first run downloads the package)"}):g.phase==="error"?m.jsxs("div",{className:"uh-status uh-err",title:So(u.resp)||void 0,children:[sq(u.resp,"ccusage did not report usage"),m.jsx("div",{children:m.jsx("button",{className:"btn uh-retry",onClick:f,...zr(c),children:c?"trying…":"Try again"})})]}):g.phase==="empty"?m.jsx("div",{className:`uh-status${g.stale?" uh-stale":""}`,"aria-busy":g.stale||void 0,children:"no usage in this range"}):m.jsxs("div",{className:g.stale?"uh-stale":void 0,"aria-busy":g.stale||void 0,children:[m.jsxs("div",{className:"uh-totals",children:[m.jsx(_u,{label:"total cost",val:Ge(_),accent:!0}),m.jsx(_u,{label:"tokens",val:Rt(b)}),m.jsx(_u,{label:"input+output",val:Rt(k)}),m.jsx(_u,{label:"cache reads",val:Rt(S)})]}),L&&m.jsxs("div",{className:"uh-agents",role:"group","aria-label":"Cost by CLI",children:[m.jsx("div",{className:"uh-agent-bar","aria-hidden":"true",children:A.map(O=>m.jsx("span",{className:"uh-agent-seg",style:{width:`${_>0?O.cost/_*100:0}%`,background:e1(O.id)}},O.id))}),m.jsx("div",{className:"uh-agent-keys",children:A.map(O=>m.jsxs("span",{className:"uh-agent-key",title:`${O.id} · ${Rt(O.tokens)} tokens`,children:[m.jsx("span",{className:"uh-legend-dot",style:{background:e1(O.id)}}),zy(O.id),m.jsx("span",{className:"uh-agent-cost",children:Ge(O.cost)}),m.jsx("span",{className:"uh-agent-share",children:ED(O.cost,_)})]},O.id))})]}),m.jsx("div",{ref:E,className:"uh-chart",role:"group","aria-label":"Daily cost by model",children:y.map(O=>{const M=w>0?O.totalCost/w*100:0,q=O.period===o,V=`${O.period}, ${Ge(O.totalCost)}`;return m.jsxs("button",{className:`uh-bar-col${q?" sel":""}`,onClick:()=>a(q?null:O.period),"aria-pressed":q,"aria-label":V,title:`${O.period} · ${Ge(O.totalCost)}`,style:{flexBasis:`${100/y.length}%`},children:[m.jsx("div",{className:"uh-bar",style:{height:`${Math.max(M,O.totalCost>0?2:0)}%`},children:O.modelBreakdowns.slice().sort((Q,j)=>j.cost-Q.cost).map(Q=>{const j=O.totalCost>0?Q.cost/O.totalCost*100:0;return m.jsx("div",{className:"uh-bar-seg",style:{height:`${j}%`,background:xu(Q.modelName)}},Q.modelName)})}),m.jsx("span",{className:"uh-bar-label",children:O.period.slice(5)})]},O.period)})}),m.jsx("div",{className:"uh-legend",children:T.map(([O,M])=>m.jsxs("span",{className:"uh-legend-item",title:O,children:[m.jsx("span",{className:"uh-legend-dot",style:{background:xu(O)}}),mi(O)," ",m.jsx("span",{className:"uh-legend-cost",children:Ge(M)})]},O))}),P&&m.jsxs("div",{className:"uh-detail",children:[m.jsxs("div",{className:"uh-detail-head",children:[m.jsx("span",{className:"uh-detail-date",children:P.period}),m.jsx("span",{className:"uh-detail-cost",children:Ge(P.totalCost)}),(()=>{var q,V;const M=SD(P.agents)??((V=(q=P.metadata)==null?void 0:q.agents)!=null&&V.length?P.metadata.agents.join(" · "):null);return M?m.jsx("span",{className:"uh-detail-agents",title:M,children:M}):null})()]}),m.jsxs("div",{className:"uh-detail-mini",children:[m.jsx(bu,{label:"input",val:Rt(P.inputTokens)}),m.jsx(bu,{label:"output",val:Rt(P.outputTokens)}),m.jsx(bu,{label:"cache write",val:Rt(P.cacheCreationTokens)}),m.jsx(bu,{label:"cache read",val:Rt(P.cacheReadTokens)})]}),m.jsx("div",{className:"uh-detail-models",children:P.modelBreakdowns.slice().sort((O,M)=>M.cost-O.cost).map(O=>{const M=P.totalCost>0?O.cost/P.totalCost*100:0;return m.jsxs("div",{className:"uh-model-row",title:O.modelName,children:[m.jsxs("span",{className:"uh-model-name",children:[m.jsx("span",{className:"uh-legend-dot",style:{background:xu(O.modelName)}}),m.jsx("span",{className:"uh-model-label",children:mi(O.modelName)})]}),m.jsx("span",{className:"uh-model-bar",children:m.jsx("span",{className:"uh-model-bar-fill",style:{width:`${M}%`,background:xu(O.modelName)}})}),m.jsx("span",{className:"uh-model-cost",children:Ge(O.cost)})]},O.modelName)})})]})]})]})})}function _u({label:e,val:t,accent:r}){return m.jsxs("div",{className:"uh-stat",children:[m.jsx("span",{className:`uh-stat-val${r?" accent":""}`,children:t}),m.jsx("span",{className:"uh-stat-label",children:e})]})}function bu({label:e,val:t}){return m.jsxs("div",{className:"uh-ministat",children:[m.jsx("span",{className:"uh-ministat-val",children:t}),m.jsx("span",{className:"uh-ministat-label",children:e})]})}function By(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 vf,t1;function TD(){if(t1)return vf;t1=1;function e(){this.__data__=[],this.size=0}return vf=e,vf}var yf,n1;function Co(){if(n1)return yf;n1=1;function e(t,r){return t===r||t!==t&&r!==r}return yf=e,yf}var wf,r1;function tc(){if(r1)return wf;r1=1;var e=Co();function t(r,i){for(var o=r.length;o--;)if(e(r[o][0],i))return o;return-1}return wf=t,wf}var xf,s1;function RD(){if(s1)return xf;s1=1;var e=tc(),t=Array.prototype,r=t.splice;function i(o){var a=this.__data__,u=e(a,o);if(u<0)return!1;var c=a.length-1;return u==c?a.pop():r.call(a,u,1),--this.size,!0}return xf=i,xf}var _f,i1;function AD(){if(i1)return _f;i1=1;var e=tc();function t(r){var i=this.__data__,o=e(i,r);return o<0?void 0:i[o][1]}return _f=t,_f}var bf,o1;function ID(){if(o1)return bf;o1=1;var e=tc();function t(r){return e(this.__data__,r)>-1}return bf=t,bf}var kf,a1;function MD(){if(a1)return kf;a1=1;var e=tc();function t(r,i){var o=this.__data__,a=e(o,r);return a<0?(++this.size,o.push([r,i])):o[a][1]=i,this}return kf=t,kf}var Sf,l1;function nc(){if(l1)return Sf;l1=1;var e=TD(),t=RD(),r=AD(),i=ID(),o=MD();function a(u){var c=-1,f=u==null?0:u.length;for(this.clear();++c<f;){var p=u[c];this.set(p[0],p[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=i,a.prototype.set=o,Sf=a,Sf}var Ef,u1;function OD(){if(u1)return Ef;u1=1;var e=nc();function t(){this.__data__=new e,this.size=0}return Ef=t,Ef}var Nf,c1;function PD(){if(c1)return Nf;c1=1;function e(t){var r=this.__data__,i=r.delete(t);return this.size=r.size,i}return Nf=e,Nf}var Cf,d1;function LD(){if(d1)return Cf;d1=1;function e(t){return this.__data__.get(t)}return Cf=e,Cf}var jf,f1;function $D(){if(f1)return jf;f1=1;function e(t){return this.__data__.has(t)}return jf=e,jf}var Tf,h1;function Dj(){if(h1)return Tf;h1=1;var e=typeof su=="object"&&su&&su.Object===Object&&su;return Tf=e,Tf}var Rf,p1;function ir(){if(p1)return Rf;p1=1;var e=Dj(),t=typeof self=="object"&&self&&self.Object===Object&&self,r=e||t||Function("return this")();return Rf=r,Rf}var Af,m1;function jo(){if(m1)return Af;m1=1;var e=ir(),t=e.Symbol;return Af=t,Af}var If,g1;function qD(){if(g1)return If;g1=1;var e=jo(),t=Object.prototype,r=t.hasOwnProperty,i=t.toString,o=e?e.toStringTag:void 0;function a(u){var c=r.call(u,o),f=u[o];try{u[o]=void 0;var p=!0}catch{}var d=i.call(u);return p&&(c?u[o]=f:delete u[o]),d}return If=a,If}var Mf,v1;function DD(){if(v1)return Mf;v1=1;var e=Object.prototype,t=e.toString;function r(i){return t.call(i)}return Mf=r,Mf}var Of,y1;function vi(){if(y1)return Of;y1=1;var e=jo(),t=qD(),r=DD(),i="[object Null]",o="[object Undefined]",a=e?e.toStringTag:void 0;function u(c){return c==null?c===void 0?o:i:a&&a in Object(c)?t(c):r(c)}return Of=u,Of}var Pf,w1;function qn(){if(w1)return Pf;w1=1;function e(t){var r=typeof t;return t!=null&&(r=="object"||r=="function")}return Pf=e,Pf}var Lf,x1;function Ka(){if(x1)return Lf;x1=1;var e=vi(),t=qn(),r="[object AsyncFunction]",i="[object Function]",o="[object GeneratorFunction]",a="[object Proxy]";function u(c){if(!t(c))return!1;var f=e(c);return f==i||f==o||f==r||f==a}return Lf=u,Lf}var $f,_1;function FD(){if(_1)return $f;_1=1;var e=ir(),t=e["__core-js_shared__"];return $f=t,$f}var qf,b1;function zD(){if(b1)return qf;b1=1;var e=FD(),t=(function(){var i=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return i?"Symbol(src)_1."+i:""})();function r(i){return!!t&&t in i}return qf=r,qf}var Df,k1;function Fj(){if(k1)return Df;k1=1;var e=Function.prototype,t=e.toString;function r(i){if(i!=null){try{return t.call(i)}catch{}try{return i+""}catch{}}return""}return Df=r,Df}var Ff,S1;function BD(){if(S1)return Ff;S1=1;var e=Ka(),t=zD(),r=qn(),i=Fj(),o=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,u=Function.prototype,c=Object.prototype,f=u.toString,p=c.hasOwnProperty,d=RegExp("^"+f.call(p).replace(o,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function g(y){if(!r(y)||t(y))return!1;var w=e(y)?d:a;return w.test(i(y))}return Ff=g,Ff}var zf,E1;function UD(){if(E1)return zf;E1=1;function e(t,r){return t==null?void 0:t[r]}return zf=e,zf}var Bf,N1;function yi(){if(N1)return Bf;N1=1;var e=BD(),t=UD();function r(i,o){var a=t(i,o);return e(a)?a:void 0}return Bf=r,Bf}var Uf,C1;function Uy(){if(C1)return Uf;C1=1;var e=yi(),t=ir(),r=e(t,"Map");return Uf=r,Uf}var Hf,j1;function rc(){if(j1)return Hf;j1=1;var e=yi(),t=e(Object,"create");return Hf=t,Hf}var Wf,T1;function HD(){if(T1)return Wf;T1=1;var e=rc();function t(){this.__data__=e?e(null):{},this.size=0}return Wf=t,Wf}var Vf,R1;function WD(){if(R1)return Vf;R1=1;function e(t){var r=this.has(t)&&delete this.__data__[t];return this.size-=r?1:0,r}return Vf=e,Vf}var Gf,A1;function VD(){if(A1)return Gf;A1=1;var e=rc(),t="__lodash_hash_undefined__",r=Object.prototype,i=r.hasOwnProperty;function o(a){var u=this.__data__;if(e){var c=u[a];return c===t?void 0:c}return i.call(u,a)?u[a]:void 0}return Gf=o,Gf}var Yf,I1;function GD(){if(I1)return Yf;I1=1;var e=rc(),t=Object.prototype,r=t.hasOwnProperty;function i(o){var a=this.__data__;return e?a[o]!==void 0:r.call(a,o)}return Yf=i,Yf}var Kf,M1;function YD(){if(M1)return Kf;M1=1;var e=rc(),t="__lodash_hash_undefined__";function r(i,o){var a=this.__data__;return this.size+=this.has(i)?0:1,a[i]=e&&o===void 0?t:o,this}return Kf=r,Kf}var Xf,O1;function KD(){if(O1)return Xf;O1=1;var e=HD(),t=WD(),r=VD(),i=GD(),o=YD();function a(u){var c=-1,f=u==null?0:u.length;for(this.clear();++c<f;){var p=u[c];this.set(p[0],p[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=i,a.prototype.set=o,Xf=a,Xf}var Qf,P1;function XD(){if(P1)return Qf;P1=1;var e=KD(),t=nc(),r=Uy();function i(){this.size=0,this.__data__={hash:new e,map:new(r||t),string:new e}}return Qf=i,Qf}var Zf,L1;function QD(){if(L1)return Zf;L1=1;function e(t){var r=typeof t;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?t!=="__proto__":t===null}return Zf=e,Zf}var Jf,$1;function sc(){if($1)return Jf;$1=1;var e=QD();function t(r,i){var o=r.__data__;return e(i)?o[typeof i=="string"?"string":"hash"]:o.map}return Jf=t,Jf}var eh,q1;function ZD(){if(q1)return eh;q1=1;var e=sc();function t(r){var i=e(this,r).delete(r);return this.size-=i?1:0,i}return eh=t,eh}var th,D1;function JD(){if(D1)return th;D1=1;var e=sc();function t(r){return e(this,r).get(r)}return th=t,th}var nh,F1;function e4(){if(F1)return nh;F1=1;var e=sc();function t(r){return e(this,r).has(r)}return nh=t,nh}var rh,z1;function t4(){if(z1)return rh;z1=1;var e=sc();function t(r,i){var o=e(this,r),a=o.size;return o.set(r,i),this.size+=o.size==a?0:1,this}return rh=t,rh}var sh,B1;function Hy(){if(B1)return sh;B1=1;var e=XD(),t=ZD(),r=JD(),i=e4(),o=t4();function a(u){var c=-1,f=u==null?0:u.length;for(this.clear();++c<f;){var p=u[c];this.set(p[0],p[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=i,a.prototype.set=o,sh=a,sh}var ih,U1;function n4(){if(U1)return ih;U1=1;var e=nc(),t=Uy(),r=Hy(),i=200;function o(a,u){var c=this.__data__;if(c instanceof e){var f=c.__data__;if(!t||f.length<i-1)return f.push([a,u]),this.size=++c.size,this;c=this.__data__=new r(f)}return c.set(a,u),this.size=c.size,this}return ih=o,ih}var oh,H1;function ic(){if(H1)return oh;H1=1;var e=nc(),t=OD(),r=PD(),i=LD(),o=$D(),a=n4();function u(c){var f=this.__data__=new e(c);this.size=f.size}return u.prototype.clear=t,u.prototype.delete=r,u.prototype.get=i,u.prototype.has=o,u.prototype.set=a,oh=u,oh}var ah,W1;function Wy(){if(W1)return ah;W1=1;function e(t,r){for(var i=-1,o=t==null?0:t.length;++i<o&&r(t[i],i,t)!==!1;);return t}return ah=e,ah}var lh,V1;function zj(){if(V1)return lh;V1=1;var e=yi(),t=(function(){try{var r=e(Object,"defineProperty");return r({},"",{}),r}catch{}})();return lh=t,lh}var uh,G1;function oc(){if(G1)return uh;G1=1;var e=zj();function t(r,i,o){i=="__proto__"&&e?e(r,i,{configurable:!0,enumerable:!0,value:o,writable:!0}):r[i]=o}return uh=t,uh}var ch,Y1;function ac(){if(Y1)return ch;Y1=1;var e=oc(),t=Co(),r=Object.prototype,i=r.hasOwnProperty;function o(a,u,c){var f=a[u];(!(i.call(a,u)&&t(f,c))||c===void 0&&!(u in a))&&e(a,u,c)}return ch=o,ch}var dh,K1;function Xa(){if(K1)return dh;K1=1;var e=ac(),t=oc();function r(i,o,a,u){var c=!a;a||(a={});for(var f=-1,p=o.length;++f<p;){var d=o[f],g=u?u(a[d],i[d],d,a,i):void 0;g===void 0&&(g=i[d]),c?t(a,d,g):e(a,d,g)}return a}return dh=r,dh}var fh,X1;function r4(){if(X1)return fh;X1=1;function e(t,r){for(var i=-1,o=Array(t);++i<t;)o[i]=r(i);return o}return fh=e,fh}var hh,Q1;function _r(){if(Q1)return hh;Q1=1;function e(t){return t!=null&&typeof t=="object"}return hh=e,hh}var ph,Z1;function s4(){if(Z1)return ph;Z1=1;var e=vi(),t=_r(),r="[object Arguments]";function i(o){return t(o)&&e(o)==r}return ph=i,ph}var mh,J1;function Qa(){if(J1)return mh;J1=1;var e=s4(),t=_r(),r=Object.prototype,i=r.hasOwnProperty,o=r.propertyIsEnumerable,a=e((function(){return arguments})())?e:function(u){return t(u)&&i.call(u,"callee")&&!o.call(u,"callee")};return mh=a,mh}var gh,eb;function Ct(){if(eb)return gh;eb=1;var e=Array.isArray;return gh=e,gh}var Ea={exports:{}},vh,tb;function i4(){if(tb)return vh;tb=1;function e(){return!1}return vh=e,vh}Ea.exports;var nb;function To(){return nb||(nb=1,(function(e,t){var r=ir(),i=i4(),o=t&&!t.nodeType&&t,a=o&&!0&&e&&!e.nodeType&&e,u=a&&a.exports===o,c=u?r.Buffer:void 0,f=c?c.isBuffer:void 0,p=f||i;e.exports=p})(Ea,Ea.exports)),Ea.exports}var yh,rb;function lc(){if(rb)return yh;rb=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function r(i,o){var a=typeof i;return o=o??e,!!o&&(a=="number"||a!="symbol"&&t.test(i))&&i>-1&&i%1==0&&i<o}return yh=r,yh}var wh,sb;function Vy(){if(sb)return wh;sb=1;var e=9007199254740991;function t(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=e}return wh=t,wh}var xh,ib;function o4(){if(ib)return xh;ib=1;var e=vi(),t=Vy(),r=_r(),i="[object Arguments]",o="[object Array]",a="[object Boolean]",u="[object Date]",c="[object Error]",f="[object Function]",p="[object Map]",d="[object Number]",g="[object Object]",y="[object RegExp]",w="[object Set]",E="[object String]",_="[object WeakMap]",b="[object ArrayBuffer]",k="[object DataView]",S="[object Float32Array]",N="[object Float64Array]",T="[object Int8Array]",A="[object Int16Array]",L="[object Int32Array]",P="[object Uint8Array]",U="[object Uint8ClampedArray]",O="[object Uint16Array]",M="[object Uint32Array]",q={};q[S]=q[N]=q[T]=q[A]=q[L]=q[P]=q[U]=q[O]=q[M]=!0,q[i]=q[o]=q[b]=q[a]=q[k]=q[u]=q[c]=q[f]=q[p]=q[d]=q[g]=q[y]=q[w]=q[E]=q[_]=!1;function V(Q){return r(Q)&&t(Q.length)&&!!q[e(Q)]}return xh=V,xh}var _h,ob;function uc(){if(ob)return _h;ob=1;function e(t){return function(r){return t(r)}}return _h=e,_h}var Na={exports:{}};Na.exports;var ab;function Gy(){return ab||(ab=1,(function(e,t){var r=Dj(),i=t&&!t.nodeType&&t,o=i&&!0&&e&&!e.nodeType&&e,a=o&&o.exports===i,u=a&&r.process,c=(function(){try{var f=o&&o.require&&o.require("util").types;return f||u&&u.binding&&u.binding("util")}catch{}})();e.exports=c})(Na,Na.exports)),Na.exports}var bh,lb;function Za(){if(lb)return bh;lb=1;var e=o4(),t=uc(),r=Gy(),i=r&&r.isTypedArray,o=i?t(i):e;return bh=o,bh}var kh,ub;function Bj(){if(ub)return kh;ub=1;var e=r4(),t=Qa(),r=Ct(),i=To(),o=lc(),a=Za(),u=Object.prototype,c=u.hasOwnProperty;function f(p,d){var g=r(p),y=!g&&t(p),w=!g&&!y&&i(p),E=!g&&!y&&!w&&a(p),_=g||y||w||E,b=_?e(p.length,String):[],k=b.length;for(var S in p)(d||c.call(p,S))&&!(_&&(S=="length"||w&&(S=="offset"||S=="parent")||E&&(S=="buffer"||S=="byteLength"||S=="byteOffset")||o(S,k)))&&b.push(S);return b}return kh=f,kh}var Sh,cb;function cc(){if(cb)return Sh;cb=1;var e=Object.prototype;function t(r){var i=r&&r.constructor,o=typeof i=="function"&&i.prototype||e;return r===o}return Sh=t,Sh}var Eh,db;function Uj(){if(db)return Eh;db=1;function e(t,r){return function(i){return t(r(i))}}return Eh=e,Eh}var Nh,fb;function a4(){if(fb)return Nh;fb=1;var e=Uj(),t=e(Object.keys,Object);return Nh=t,Nh}var Ch,hb;function Yy(){if(hb)return Ch;hb=1;var e=cc(),t=a4(),r=Object.prototype,i=r.hasOwnProperty;function o(a){if(!e(a))return t(a);var u=[];for(var c in Object(a))i.call(a,c)&&c!="constructor"&&u.push(c);return u}return Ch=o,Ch}var jh,pb;function Wr(){if(pb)return jh;pb=1;var e=Ka(),t=Vy();function r(i){return i!=null&&t(i.length)&&!e(i)}return jh=r,jh}var Th,mb;function Ns(){if(mb)return Th;mb=1;var e=Bj(),t=Yy(),r=Wr();function i(o){return r(o)?e(o):t(o)}return Th=i,Th}var Rh,gb;function l4(){if(gb)return Rh;gb=1;var e=Xa(),t=Ns();function r(i,o){return i&&e(o,t(o),i)}return Rh=r,Rh}var Ah,vb;function u4(){if(vb)return Ah;vb=1;function e(t){var r=[];if(t!=null)for(var i in Object(t))r.push(i);return r}return Ah=e,Ah}var Ih,yb;function c4(){if(yb)return Ih;yb=1;var e=qn(),t=cc(),r=u4(),i=Object.prototype,o=i.hasOwnProperty;function a(u){if(!e(u))return r(u);var c=t(u),f=[];for(var p in u)p=="constructor"&&(c||!o.call(u,p))||f.push(p);return f}return Ih=a,Ih}var Mh,wb;function wi(){if(wb)return Mh;wb=1;var e=Bj(),t=c4(),r=Wr();function i(o){return r(o)?e(o,!0):t(o)}return Mh=i,Mh}var Oh,xb;function d4(){if(xb)return Oh;xb=1;var e=Xa(),t=wi();function r(i,o){return i&&e(o,t(o),i)}return Oh=r,Oh}var Ca={exports:{}};Ca.exports;var _b;function Hj(){return _b||(_b=1,(function(e,t){var r=ir(),i=t&&!t.nodeType&&t,o=i&&!0&&e&&!e.nodeType&&e,a=o&&o.exports===i,u=a?r.Buffer:void 0,c=u?u.allocUnsafe:void 0;function f(p,d){if(d)return p.slice();var g=p.length,y=c?c(g):new p.constructor(g);return p.copy(y),y}e.exports=f})(Ca,Ca.exports)),Ca.exports}var Ph,bb;function Wj(){if(bb)return Ph;bb=1;function e(t,r){var i=-1,o=t.length;for(r||(r=Array(o));++i<o;)r[i]=t[i];return r}return Ph=e,Ph}var Lh,kb;function Vj(){if(kb)return Lh;kb=1;function e(t,r){for(var i=-1,o=t==null?0:t.length,a=0,u=[];++i<o;){var c=t[i];r(c,i,t)&&(u[a++]=c)}return u}return Lh=e,Lh}var $h,Sb;function Gj(){if(Sb)return $h;Sb=1;function e(){return[]}return $h=e,$h}var qh,Eb;function Ky(){if(Eb)return qh;Eb=1;var e=Vj(),t=Gj(),r=Object.prototype,i=r.propertyIsEnumerable,o=Object.getOwnPropertySymbols,a=o?function(u){return u==null?[]:(u=Object(u),e(o(u),function(c){return i.call(u,c)}))}:t;return qh=a,qh}var Dh,Nb;function f4(){if(Nb)return Dh;Nb=1;var e=Xa(),t=Ky();function r(i,o){return e(i,t(i),o)}return Dh=r,Dh}var Fh,Cb;function Xy(){if(Cb)return Fh;Cb=1;function e(t,r){for(var i=-1,o=r.length,a=t.length;++i<o;)t[a+i]=r[i];return t}return Fh=e,Fh}var zh,jb;function dc(){if(jb)return zh;jb=1;var e=Uj(),t=e(Object.getPrototypeOf,Object);return zh=t,zh}var Bh,Tb;function Yj(){if(Tb)return Bh;Tb=1;var e=Xy(),t=dc(),r=Ky(),i=Gj(),o=Object.getOwnPropertySymbols,a=o?function(u){for(var c=[];u;)e(c,r(u)),u=t(u);return c}:i;return Bh=a,Bh}var Uh,Rb;function h4(){if(Rb)return Uh;Rb=1;var e=Xa(),t=Yj();function r(i,o){return e(i,t(i),o)}return Uh=r,Uh}var Hh,Ab;function Kj(){if(Ab)return Hh;Ab=1;var e=Xy(),t=Ct();function r(i,o,a){var u=o(i);return t(i)?u:e(u,a(i))}return Hh=r,Hh}var Wh,Ib;function Xj(){if(Ib)return Wh;Ib=1;var e=Kj(),t=Ky(),r=Ns();function i(o){return e(o,r,t)}return Wh=i,Wh}var Vh,Mb;function p4(){if(Mb)return Vh;Mb=1;var e=Kj(),t=Yj(),r=wi();function i(o){return e(o,r,t)}return Vh=i,Vh}var Gh,Ob;function m4(){if(Ob)return Gh;Ob=1;var e=yi(),t=ir(),r=e(t,"DataView");return Gh=r,Gh}var Yh,Pb;function g4(){if(Pb)return Yh;Pb=1;var e=yi(),t=ir(),r=e(t,"Promise");return Yh=r,Yh}var Kh,Lb;function Qj(){if(Lb)return Kh;Lb=1;var e=yi(),t=ir(),r=e(t,"Set");return Kh=r,Kh}var Xh,$b;function v4(){if($b)return Xh;$b=1;var e=yi(),t=ir(),r=e(t,"WeakMap");return Xh=r,Xh}var Qh,qb;function Ro(){if(qb)return Qh;qb=1;var e=m4(),t=Uy(),r=g4(),i=Qj(),o=v4(),a=vi(),u=Fj(),c="[object Map]",f="[object Object]",p="[object Promise]",d="[object Set]",g="[object WeakMap]",y="[object DataView]",w=u(e),E=u(t),_=u(r),b=u(i),k=u(o),S=a;return(e&&S(new e(new ArrayBuffer(1)))!=y||t&&S(new t)!=c||r&&S(r.resolve())!=p||i&&S(new i)!=d||o&&S(new o)!=g)&&(S=function(N){var T=a(N),A=T==f?N.constructor:void 0,L=A?u(A):"";if(L)switch(L){case w:return y;case E:return c;case _:return p;case b:return d;case k:return g}return T}),Qh=S,Qh}var Zh,Db;function y4(){if(Db)return Zh;Db=1;var e=Object.prototype,t=e.hasOwnProperty;function r(i){var o=i.length,a=new i.constructor(o);return o&&typeof i[0]=="string"&&t.call(i,"index")&&(a.index=i.index,a.input=i.input),a}return Zh=r,Zh}var Jh,Fb;function Zj(){if(Fb)return Jh;Fb=1;var e=ir(),t=e.Uint8Array;return Jh=t,Jh}var ep,zb;function Qy(){if(zb)return ep;zb=1;var e=Zj();function t(r){var i=new r.constructor(r.byteLength);return new e(i).set(new e(r)),i}return ep=t,ep}var tp,Bb;function w4(){if(Bb)return tp;Bb=1;var e=Qy();function t(r,i){var o=i?e(r.buffer):r.buffer;return new r.constructor(o,r.byteOffset,r.byteLength)}return tp=t,tp}var np,Ub;function x4(){if(Ub)return np;Ub=1;var e=/\w*$/;function t(r){var i=new r.constructor(r.source,e.exec(r));return i.lastIndex=r.lastIndex,i}return np=t,np}var rp,Hb;function _4(){if(Hb)return rp;Hb=1;var e=jo(),t=e?e.prototype:void 0,r=t?t.valueOf:void 0;function i(o){return r?Object(r.call(o)):{}}return rp=i,rp}var sp,Wb;function Jj(){if(Wb)return sp;Wb=1;var e=Qy();function t(r,i){var o=i?e(r.buffer):r.buffer;return new r.constructor(o,r.byteOffset,r.length)}return sp=t,sp}var ip,Vb;function b4(){if(Vb)return ip;Vb=1;var e=Qy(),t=w4(),r=x4(),i=_4(),o=Jj(),a="[object Boolean]",u="[object Date]",c="[object Map]",f="[object Number]",p="[object RegExp]",d="[object Set]",g="[object String]",y="[object Symbol]",w="[object ArrayBuffer]",E="[object DataView]",_="[object Float32Array]",b="[object Float64Array]",k="[object Int8Array]",S="[object Int16Array]",N="[object Int32Array]",T="[object Uint8Array]",A="[object Uint8ClampedArray]",L="[object Uint16Array]",P="[object Uint32Array]";function U(O,M,q){var V=O.constructor;switch(M){case w:return e(O);case a:case u:return new V(+O);case E:return t(O,q);case _:case b:case k:case S:case N:case T:case A:case L:case P:return o(O,q);case c:return new V;case f:case g:return new V(O);case p:return r(O);case d:return new V;case y:return i(O)}}return ip=U,ip}var op,Gb;function eT(){if(Gb)return op;Gb=1;var e=qn(),t=Object.create,r=(function(){function i(){}return function(o){if(!e(o))return{};if(t)return t(o);i.prototype=o;var a=new i;return i.prototype=void 0,a}})();return op=r,op}var ap,Yb;function tT(){if(Yb)return ap;Yb=1;var e=eT(),t=dc(),r=cc();function i(o){return typeof o.constructor=="function"&&!r(o)?e(t(o)):{}}return ap=i,ap}var lp,Kb;function k4(){if(Kb)return lp;Kb=1;var e=Ro(),t=_r(),r="[object Map]";function i(o){return t(o)&&e(o)==r}return lp=i,lp}var up,Xb;function S4(){if(Xb)return up;Xb=1;var e=k4(),t=uc(),r=Gy(),i=r&&r.isMap,o=i?t(i):e;return up=o,up}var cp,Qb;function E4(){if(Qb)return cp;Qb=1;var e=Ro(),t=_r(),r="[object Set]";function i(o){return t(o)&&e(o)==r}return cp=i,cp}var dp,Zb;function N4(){if(Zb)return dp;Zb=1;var e=E4(),t=uc(),r=Gy(),i=r&&r.isSet,o=i?t(i):e;return dp=o,dp}var fp,Jb;function nT(){if(Jb)return fp;Jb=1;var e=ic(),t=Wy(),r=ac(),i=l4(),o=d4(),a=Hj(),u=Wj(),c=f4(),f=h4(),p=Xj(),d=p4(),g=Ro(),y=y4(),w=b4(),E=tT(),_=Ct(),b=To(),k=S4(),S=qn(),N=N4(),T=Ns(),A=wi(),L=1,P=2,U=4,O="[object Arguments]",M="[object Array]",q="[object Boolean]",V="[object Date]",Q="[object Error]",j="[object Function]",G="[object GeneratorFunction]",z="[object Map]",te="[object Number]",J="[object Object]",$="[object RegExp]",W="[object Set]",I="[object String]",Y="[object Symbol]",ue="[object WeakMap]",F="[object ArrayBuffer]",Z="[object DataView]",ne="[object Float32Array]",B="[object Float64Array]",de="[object Int8Array]",pe="[object Int16Array]",ye="[object Int32Array]",Pe="[object Uint8Array]",Ue="[object Uint8ClampedArray]",De="[object Uint16Array]",Me="[object Uint32Array]",_e={};_e[O]=_e[M]=_e[F]=_e[Z]=_e[q]=_e[V]=_e[ne]=_e[B]=_e[de]=_e[pe]=_e[ye]=_e[z]=_e[te]=_e[J]=_e[$]=_e[W]=_e[I]=_e[Y]=_e[Pe]=_e[Ue]=_e[De]=_e[Me]=!0,_e[Q]=_e[j]=_e[ue]=!1;function Fe(we,fe,Ke,gt,tt,ot){var Be,Ze=fe&L,ut=fe&P,_t=fe&U;if(Ke&&(Be=tt?Ke(we,gt,tt,ot):Ke(we)),Be!==void 0)return Be;if(!S(we))return we;var ie=_(we);if(ie){if(Be=y(we),!Ze)return u(we,Be)}else{var qe=g(we),Oe=qe==j||qe==G;if(b(we))return a(we,Ze);if(qe==J||qe==O||Oe&&!tt){if(Be=ut||Oe?{}:E(we),!Ze)return ut?f(we,o(Be,we)):c(we,i(Be,we))}else{if(!_e[qe])return tt?we:{};Be=w(we,qe,Ze)}}ot||(ot=new e);var Te=ot.get(we);if(Te)return Te;ot.set(we,Be),N(we)?we.forEach(function(Je){Be.add(Fe(Je,fe,Ke,Je,we,ot))}):k(we)&&we.forEach(function(Je,ke){Be.set(ke,Fe(Je,fe,Ke,ke,we,ot))});var ze=_t?ut?d:p:ut?A:T,He=ie?void 0:ze(we);return t(He||we,function(Je,ke){He&&(ke=Je,Je=we[ke]),r(Be,ke,Fe(Je,fe,Ke,ke,we,ot))}),Be}return fp=Fe,fp}var hp,ek;function C4(){if(ek)return hp;ek=1;var e=nT(),t=4;function r(i){return e(i,t)}return hp=r,hp}var pp,tk;function Zy(){if(tk)return pp;tk=1;function e(t){return function(){return t}}return pp=e,pp}var mp,nk;function j4(){if(nk)return mp;nk=1;function e(t){return function(r,i,o){for(var a=-1,u=Object(r),c=o(r),f=c.length;f--;){var p=c[t?f:++a];if(i(u[p],p,u)===!1)break}return r}}return mp=e,mp}var gp,rk;function Jy(){if(rk)return gp;rk=1;var e=j4(),t=e();return gp=t,gp}var vp,sk;function e0(){if(sk)return vp;sk=1;var e=Jy(),t=Ns();function r(i,o){return i&&e(i,o,t)}return vp=r,vp}var yp,ik;function T4(){if(ik)return yp;ik=1;var e=Wr();function t(r,i){return function(o,a){if(o==null)return o;if(!e(o))return r(o,a);for(var u=o.length,c=i?u:-1,f=Object(o);(i?c--:++c<u)&&a(f[c],c,f)!==!1;);return o}}return yp=t,yp}var wp,ok;function fc(){if(ok)return wp;ok=1;var e=e0(),t=T4(),r=t(e);return wp=r,wp}var xp,ak;function xi(){if(ak)return xp;ak=1;function e(t){return t}return xp=e,xp}var _p,lk;function rT(){if(lk)return _p;lk=1;var e=xi();function t(r){return typeof r=="function"?r:e}return _p=t,_p}var bp,uk;function sT(){if(uk)return bp;uk=1;var e=Wy(),t=fc(),r=rT(),i=Ct();function o(a,u){var c=i(a)?e:t;return c(a,r(u))}return bp=o,bp}var kp,ck;function iT(){return ck||(ck=1,kp=sT()),kp}var Sp,dk;function R4(){if(dk)return Sp;dk=1;var e=fc();function t(r,i){var o=[];return e(r,function(a,u,c){i(a,u,c)&&o.push(a)}),o}return Sp=t,Sp}var Ep,fk;function A4(){if(fk)return Ep;fk=1;var e="__lodash_hash_undefined__";function t(r){return this.__data__.set(r,e),this}return Ep=t,Ep}var Np,hk;function I4(){if(hk)return Np;hk=1;function e(t){return this.__data__.has(t)}return Np=e,Np}var Cp,pk;function oT(){if(pk)return Cp;pk=1;var e=Hy(),t=A4(),r=I4();function i(o){var a=-1,u=o==null?0:o.length;for(this.__data__=new e;++a<u;)this.add(o[a])}return i.prototype.add=i.prototype.push=t,i.prototype.has=r,Cp=i,Cp}var jp,mk;function M4(){if(mk)return jp;mk=1;function e(t,r){for(var i=-1,o=t==null?0:t.length;++i<o;)if(r(t[i],i,t))return!0;return!1}return jp=e,jp}var Tp,gk;function aT(){if(gk)return Tp;gk=1;function e(t,r){return t.has(r)}return Tp=e,Tp}var Rp,vk;function lT(){if(vk)return Rp;vk=1;var e=oT(),t=M4(),r=aT(),i=1,o=2;function a(u,c,f,p,d,g){var y=f&i,w=u.length,E=c.length;if(w!=E&&!(y&&E>w))return!1;var _=g.get(u),b=g.get(c);if(_&&b)return _==c&&b==u;var k=-1,S=!0,N=f&o?new e:void 0;for(g.set(u,c),g.set(c,u);++k<w;){var T=u[k],A=c[k];if(p)var L=y?p(A,T,k,c,u,g):p(T,A,k,u,c,g);if(L!==void 0){if(L)continue;S=!1;break}if(N){if(!t(c,function(P,U){if(!r(N,U)&&(T===P||d(T,P,f,p,g)))return N.push(U)})){S=!1;break}}else if(!(T===A||d(T,A,f,p,g))){S=!1;break}}return g.delete(u),g.delete(c),S}return Rp=a,Rp}var Ap,yk;function O4(){if(yk)return Ap;yk=1;function e(t){var r=-1,i=Array(t.size);return t.forEach(function(o,a){i[++r]=[a,o]}),i}return Ap=e,Ap}var Ip,wk;function t0(){if(wk)return Ip;wk=1;function e(t){var r=-1,i=Array(t.size);return t.forEach(function(o){i[++r]=o}),i}return Ip=e,Ip}var Mp,xk;function P4(){if(xk)return Mp;xk=1;var e=jo(),t=Zj(),r=Co(),i=lT(),o=O4(),a=t0(),u=1,c=2,f="[object Boolean]",p="[object Date]",d="[object Error]",g="[object Map]",y="[object Number]",w="[object RegExp]",E="[object Set]",_="[object String]",b="[object Symbol]",k="[object ArrayBuffer]",S="[object DataView]",N=e?e.prototype:void 0,T=N?N.valueOf:void 0;function A(L,P,U,O,M,q,V){switch(U){case S:if(L.byteLength!=P.byteLength||L.byteOffset!=P.byteOffset)return!1;L=L.buffer,P=P.buffer;case k:return!(L.byteLength!=P.byteLength||!q(new t(L),new t(P)));case f:case p:case y:return r(+L,+P);case d:return L.name==P.name&&L.message==P.message;case w:case _:return L==P+"";case g:var Q=o;case E:var j=O&u;if(Q||(Q=a),L.size!=P.size&&!j)return!1;var G=V.get(L);if(G)return G==P;O|=c,V.set(L,P);var z=i(Q(L),Q(P),O,M,q,V);return V.delete(L),z;case b:if(T)return T.call(L)==T.call(P)}return!1}return Mp=A,Mp}var Op,_k;function L4(){if(_k)return Op;_k=1;var e=Xj(),t=1,r=Object.prototype,i=r.hasOwnProperty;function o(a,u,c,f,p,d){var g=c&t,y=e(a),w=y.length,E=e(u),_=E.length;if(w!=_&&!g)return!1;for(var b=w;b--;){var k=y[b];if(!(g?k in u:i.call(u,k)))return!1}var S=d.get(a),N=d.get(u);if(S&&N)return S==u&&N==a;var T=!0;d.set(a,u),d.set(u,a);for(var A=g;++b<w;){k=y[b];var L=a[k],P=u[k];if(f)var U=g?f(P,L,k,u,a,d):f(L,P,k,a,u,d);if(!(U===void 0?L===P||p(L,P,c,f,d):U)){T=!1;break}A||(A=k=="constructor")}if(T&&!A){var O=a.constructor,M=u.constructor;O!=M&&"constructor"in a&&"constructor"in u&&!(typeof O=="function"&&O instanceof O&&typeof M=="function"&&M instanceof M)&&(T=!1)}return d.delete(a),d.delete(u),T}return Op=o,Op}var Pp,bk;function $4(){if(bk)return Pp;bk=1;var e=ic(),t=lT(),r=P4(),i=L4(),o=Ro(),a=Ct(),u=To(),c=Za(),f=1,p="[object Arguments]",d="[object Array]",g="[object Object]",y=Object.prototype,w=y.hasOwnProperty;function E(_,b,k,S,N,T){var A=a(_),L=a(b),P=A?d:o(_),U=L?d:o(b);P=P==p?g:P,U=U==p?g:U;var O=P==g,M=U==g,q=P==U;if(q&&u(_)){if(!u(b))return!1;A=!0,O=!1}if(q&&!O)return T||(T=new e),A||c(_)?t(_,b,k,S,N,T):r(_,b,P,k,S,N,T);if(!(k&f)){var V=O&&w.call(_,"__wrapped__"),Q=M&&w.call(b,"__wrapped__");if(V||Q){var j=V?_.value():_,G=Q?b.value():b;return T||(T=new e),N(j,G,k,S,T)}}return q?(T||(T=new e),i(_,b,k,S,N,T)):!1}return Pp=E,Pp}var Lp,kk;function uT(){if(kk)return Lp;kk=1;var e=$4(),t=_r();function r(i,o,a,u,c){return i===o?!0:i==null||o==null||!t(i)&&!t(o)?i!==i&&o!==o:e(i,o,a,u,r,c)}return Lp=r,Lp}var $p,Sk;function q4(){if(Sk)return $p;Sk=1;var e=ic(),t=uT(),r=1,i=2;function o(a,u,c,f){var p=c.length,d=p,g=!f;if(a==null)return!d;for(a=Object(a);p--;){var y=c[p];if(g&&y[2]?y[1]!==a[y[0]]:!(y[0]in a))return!1}for(;++p<d;){y=c[p];var w=y[0],E=a[w],_=y[1];if(g&&y[2]){if(E===void 0&&!(w in a))return!1}else{var b=new e;if(f)var k=f(E,_,w,a,u,b);if(!(k===void 0?t(_,E,r|i,f,b):k))return!1}}return!0}return $p=o,$p}var qp,Ek;function cT(){if(Ek)return qp;Ek=1;var e=qn();function t(r){return r===r&&!e(r)}return qp=t,qp}var Dp,Nk;function D4(){if(Nk)return Dp;Nk=1;var e=cT(),t=Ns();function r(i){for(var o=t(i),a=o.length;a--;){var u=o[a],c=i[u];o[a]=[u,c,e(c)]}return o}return Dp=r,Dp}var Fp,Ck;function dT(){if(Ck)return Fp;Ck=1;function e(t,r){return function(i){return i==null?!1:i[t]===r&&(r!==void 0||t in Object(i))}}return Fp=e,Fp}var zp,jk;function F4(){if(jk)return zp;jk=1;var e=q4(),t=D4(),r=dT();function i(o){var a=t(o);return a.length==1&&a[0][2]?r(a[0][0],a[0][1]):function(u){return u===o||e(u,o,a)}}return zp=i,zp}var Bp,Tk;function Ao(){if(Tk)return Bp;Tk=1;var e=vi(),t=_r(),r="[object Symbol]";function i(o){return typeof o=="symbol"||t(o)&&e(o)==r}return Bp=i,Bp}var Up,Rk;function n0(){if(Rk)return Up;Rk=1;var e=Ct(),t=Ao(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,i=/^\w*$/;function o(a,u){if(e(a))return!1;var c=typeof a;return c=="number"||c=="symbol"||c=="boolean"||a==null||t(a)?!0:i.test(a)||!r.test(a)||u!=null&&a in Object(u)}return Up=o,Up}var Hp,Ak;function z4(){if(Ak)return Hp;Ak=1;var e=Hy(),t="Expected a function";function r(i,o){if(typeof i!="function"||o!=null&&typeof o!="function")throw new TypeError(t);var a=function(){var u=arguments,c=o?o.apply(this,u):u[0],f=a.cache;if(f.has(c))return f.get(c);var p=i.apply(this,u);return a.cache=f.set(c,p)||f,p};return a.cache=new(r.Cache||e),a}return r.Cache=e,Hp=r,Hp}var Wp,Ik;function B4(){if(Ik)return Wp;Ik=1;var e=z4(),t=500;function r(i){var o=e(i,function(u){return a.size===t&&a.clear(),u}),a=o.cache;return o}return Wp=r,Wp}var Vp,Mk;function U4(){if(Mk)return Vp;Mk=1;var e=B4(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,r=/\\(\\)?/g,i=e(function(o){var a=[];return o.charCodeAt(0)===46&&a.push(""),o.replace(t,function(u,c,f,p){a.push(f?p.replace(r,"$1"):c||u)}),a});return Vp=i,Vp}var Gp,Ok;function hc(){if(Ok)return Gp;Ok=1;function e(t,r){for(var i=-1,o=t==null?0:t.length,a=Array(o);++i<o;)a[i]=r(t[i],i,t);return a}return Gp=e,Gp}var Yp,Pk;function H4(){if(Pk)return Yp;Pk=1;var e=jo(),t=hc(),r=Ct(),i=Ao(),o=e?e.prototype:void 0,a=o?o.toString:void 0;function u(c){if(typeof c=="string")return c;if(r(c))return t(c,u)+"";if(i(c))return a?a.call(c):"";var f=c+"";return f=="0"&&1/c==-1/0?"-0":f}return Yp=u,Yp}var Kp,Lk;function fT(){if(Lk)return Kp;Lk=1;var e=H4();function t(r){return r==null?"":e(r)}return Kp=t,Kp}var Xp,$k;function pc(){if($k)return Xp;$k=1;var e=Ct(),t=n0(),r=U4(),i=fT();function o(a,u){return e(a)?a:t(a,u)?[a]:r(i(a))}return Xp=o,Xp}var Qp,qk;function Ja(){if(qk)return Qp;qk=1;var e=Ao();function t(r){if(typeof r=="string"||e(r))return r;var i=r+"";return i=="0"&&1/r==-1/0?"-0":i}return Qp=t,Qp}var Zp,Dk;function mc(){if(Dk)return Zp;Dk=1;var e=pc(),t=Ja();function r(i,o){o=e(o,i);for(var a=0,u=o.length;i!=null&&a<u;)i=i[t(o[a++])];return a&&a==u?i:void 0}return Zp=r,Zp}var Jp,Fk;function W4(){if(Fk)return Jp;Fk=1;var e=mc();function t(r,i,o){var a=r==null?void 0:e(r,i);return a===void 0?o:a}return Jp=t,Jp}var em,zk;function V4(){if(zk)return em;zk=1;function e(t,r){return t!=null&&r in Object(t)}return em=e,em}var tm,Bk;function hT(){if(Bk)return tm;Bk=1;var e=pc(),t=Qa(),r=Ct(),i=lc(),o=Vy(),a=Ja();function u(c,f,p){f=e(f,c);for(var d=-1,g=f.length,y=!1;++d<g;){var w=a(f[d]);if(!(y=c!=null&&p(c,w)))break;c=c[w]}return y||++d!=g?y:(g=c==null?0:c.length,!!g&&o(g)&&i(w,g)&&(r(c)||t(c)))}return tm=u,tm}var nm,Uk;function pT(){if(Uk)return nm;Uk=1;var e=V4(),t=hT();function r(i,o){return i!=null&&t(i,o,e)}return nm=r,nm}var rm,Hk;function G4(){if(Hk)return rm;Hk=1;var e=uT(),t=W4(),r=pT(),i=n0(),o=cT(),a=dT(),u=Ja(),c=1,f=2;function p(d,g){return i(d)&&o(g)?a(u(d),g):function(y){var w=t(y,d);return w===void 0&&w===g?r(y,d):e(g,w,c|f)}}return rm=p,rm}var sm,Wk;function mT(){if(Wk)return sm;Wk=1;function e(t){return function(r){return r==null?void 0:r[t]}}return sm=e,sm}var im,Vk;function Y4(){if(Vk)return im;Vk=1;var e=mc();function t(r){return function(i){return e(i,r)}}return im=t,im}var om,Gk;function K4(){if(Gk)return om;Gk=1;var e=mT(),t=Y4(),r=n0(),i=Ja();function o(a){return r(a)?e(i(a)):t(a)}return om=o,om}var am,Yk;function Vr(){if(Yk)return am;Yk=1;var e=F4(),t=G4(),r=xi(),i=Ct(),o=K4();function a(u){return typeof u=="function"?u:u==null?r:typeof u=="object"?i(u)?t(u[0],u[1]):e(u):o(u)}return am=a,am}var lm,Kk;function gT(){if(Kk)return lm;Kk=1;var e=Vj(),t=R4(),r=Vr(),i=Ct();function o(a,u){var c=i(a)?e:t;return c(a,r(u,3))}return lm=o,lm}var um,Xk;function X4(){if(Xk)return um;Xk=1;var e=Object.prototype,t=e.hasOwnProperty;function r(i,o){return i!=null&&t.call(i,o)}return um=r,um}var cm,Qk;function vT(){if(Qk)return cm;Qk=1;var e=X4(),t=hT();function r(i,o){return i!=null&&t(i,o,e)}return cm=r,cm}var dm,Zk;function Q4(){if(Zk)return dm;Zk=1;var e=Yy(),t=Ro(),r=Qa(),i=Ct(),o=Wr(),a=To(),u=cc(),c=Za(),f="[object Map]",p="[object Set]",d=Object.prototype,g=d.hasOwnProperty;function y(w){if(w==null)return!0;if(o(w)&&(i(w)||typeof w=="string"||typeof w.splice=="function"||a(w)||c(w)||r(w)))return!w.length;var E=t(w);if(E==f||E==p)return!w.size;if(u(w))return!e(w).length;for(var _ in w)if(g.call(w,_))return!1;return!0}return dm=y,dm}var fm,Jk;function yT(){if(Jk)return fm;Jk=1;function e(t){return t===void 0}return fm=e,fm}var hm,eS;function wT(){if(eS)return hm;eS=1;var e=fc(),t=Wr();function r(i,o){var a=-1,u=t(i)?Array(i.length):[];return e(i,function(c,f,p){u[++a]=o(c,f,p)}),u}return hm=r,hm}var pm,tS;function xT(){if(tS)return pm;tS=1;var e=hc(),t=Vr(),r=wT(),i=Ct();function o(a,u){var c=i(a)?e:r;return c(a,t(u,3))}return pm=o,pm}var mm,nS;function Z4(){if(nS)return mm;nS=1;function e(t,r,i,o){var a=-1,u=t==null?0:t.length;for(o&&u&&(i=t[++a]);++a<u;)i=r(i,t[a],a,t);return i}return mm=e,mm}var gm,rS;function J4(){if(rS)return gm;rS=1;function e(t,r,i,o,a){return a(t,function(u,c,f){i=o?(o=!1,u):r(i,u,c,f)}),i}return gm=e,gm}var vm,sS;function _T(){if(sS)return vm;sS=1;var e=Z4(),t=fc(),r=Vr(),i=J4(),o=Ct();function a(u,c,f){var p=o(u)?e:i,d=arguments.length<3;return p(u,r(c,4),f,d,t)}return vm=a,vm}var ym,iS;function e5(){if(iS)return ym;iS=1;var e=vi(),t=Ct(),r=_r(),i="[object String]";function o(a){return typeof a=="string"||!t(a)&&r(a)&&e(a)==i}return ym=o,ym}var wm,oS;function t5(){if(oS)return wm;oS=1;var e=mT(),t=e("length");return wm=t,wm}var xm,aS;function n5(){if(aS)return xm;aS=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",i="\\u20d0-\\u20ff",o=t+r+i,a="\\ufe0e\\ufe0f",u="\\u200d",c=RegExp("["+u+e+o+a+"]");function f(p){return c.test(p)}return xm=f,xm}var _m,lS;function r5(){if(lS)return _m;lS=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",i="\\u20d0-\\u20ff",o=t+r+i,a="\\ufe0e\\ufe0f",u="["+e+"]",c="["+o+"]",f="\\ud83c[\\udffb-\\udfff]",p="(?:"+c+"|"+f+")",d="[^"+e+"]",g="(?:\\ud83c[\\udde6-\\uddff]){2}",y="[\\ud800-\\udbff][\\udc00-\\udfff]",w="\\u200d",E=p+"?",_="["+a+"]?",b="(?:"+w+"(?:"+[d,g,y].join("|")+")"+_+E+")*",k=_+E+b,S="(?:"+[d+c+"?",c,g,y,u].join("|")+")",N=RegExp(f+"(?="+f+")|"+S+k,"g");function T(A){for(var L=N.lastIndex=0;N.test(A);)++L;return L}return _m=T,_m}var bm,uS;function s5(){if(uS)return bm;uS=1;var e=t5(),t=n5(),r=r5();function i(o){return t(o)?r(o):e(o)}return bm=i,bm}var km,cS;function i5(){if(cS)return km;cS=1;var e=Yy(),t=Ro(),r=Wr(),i=e5(),o=s5(),a="[object Map]",u="[object Set]";function c(f){if(f==null)return 0;if(r(f))return i(f)?o(f):f.length;var p=t(f);return p==a||p==u?f.size:e(f).length}return km=c,km}var Sm,dS;function o5(){if(dS)return Sm;dS=1;var e=Wy(),t=eT(),r=e0(),i=Vr(),o=dc(),a=Ct(),u=To(),c=Ka(),f=qn(),p=Za();function d(g,y,w){var E=a(g),_=E||u(g)||p(g);if(y=i(y,4),w==null){var b=g&&g.constructor;_?w=E?new b:[]:f(g)?w=c(b)?t(o(g)):{}:w={}}return(_?e:r)(g,function(k,S,N){return y(w,k,S,N)}),w}return Sm=d,Sm}var Em,fS;function a5(){if(fS)return Em;fS=1;var e=jo(),t=Qa(),r=Ct(),i=e?e.isConcatSpreadable:void 0;function o(a){return r(a)||t(a)||!!(i&&a&&a[i])}return Em=o,Em}var Nm,hS;function r0(){if(hS)return Nm;hS=1;var e=Xy(),t=a5();function r(i,o,a,u,c){var f=-1,p=i.length;for(a||(a=t),c||(c=[]);++f<p;){var d=i[f];o>0&&a(d)?o>1?r(d,o-1,a,u,c):e(c,d):u||(c[c.length]=d)}return c}return Nm=r,Nm}var Cm,pS;function l5(){if(pS)return Cm;pS=1;function e(t,r,i){switch(i.length){case 0:return t.call(r);case 1:return t.call(r,i[0]);case 2:return t.call(r,i[0],i[1]);case 3:return t.call(r,i[0],i[1],i[2])}return t.apply(r,i)}return Cm=e,Cm}var jm,mS;function bT(){if(mS)return jm;mS=1;var e=l5(),t=Math.max;function r(i,o,a){return o=t(o===void 0?i.length-1:o,0),function(){for(var u=arguments,c=-1,f=t(u.length-o,0),p=Array(f);++c<f;)p[c]=u[o+c];c=-1;for(var d=Array(o+1);++c<o;)d[c]=u[c];return d[o]=a(p),e(i,this,d)}}return jm=r,jm}var Tm,gS;function u5(){if(gS)return Tm;gS=1;var e=Zy(),t=zj(),r=xi(),i=t?function(o,a){return t(o,"toString",{configurable:!0,enumerable:!1,value:e(a),writable:!0})}:r;return Tm=i,Tm}var Rm,vS;function c5(){if(vS)return Rm;vS=1;var e=800,t=16,r=Date.now;function i(o){var a=0,u=0;return function(){var c=r(),f=t-(c-u);if(u=c,f>0){if(++a>=e)return arguments[0]}else a=0;return o.apply(void 0,arguments)}}return Rm=i,Rm}var Am,yS;function kT(){if(yS)return Am;yS=1;var e=u5(),t=c5(),r=t(e);return Am=r,Am}var Im,wS;function gc(){if(wS)return Im;wS=1;var e=xi(),t=bT(),r=kT();function i(o,a){return r(t(o,a,e),o+"")}return Im=i,Im}var Mm,xS;function ST(){if(xS)return Mm;xS=1;function e(t,r,i,o){for(var a=t.length,u=i+(o?1:-1);o?u--:++u<a;)if(r(t[u],u,t))return u;return-1}return Mm=e,Mm}var Om,_S;function d5(){if(_S)return Om;_S=1;function e(t){return t!==t}return Om=e,Om}var Pm,bS;function f5(){if(bS)return Pm;bS=1;function e(t,r,i){for(var o=i-1,a=t.length;++o<a;)if(t[o]===r)return o;return-1}return Pm=e,Pm}var Lm,kS;function h5(){if(kS)return Lm;kS=1;var e=ST(),t=d5(),r=f5();function i(o,a,u){return a===a?r(o,a,u):e(o,t,u)}return Lm=i,Lm}var $m,SS;function p5(){if(SS)return $m;SS=1;var e=h5();function t(r,i){var o=r==null?0:r.length;return!!o&&e(r,i,0)>-1}return $m=t,$m}var qm,ES;function m5(){if(ES)return qm;ES=1;function e(t,r,i){for(var o=-1,a=t==null?0:t.length;++o<a;)if(i(r,t[o]))return!0;return!1}return qm=e,qm}var Dm,NS;function g5(){if(NS)return Dm;NS=1;function e(){}return Dm=e,Dm}var Fm,CS;function v5(){if(CS)return Fm;CS=1;var e=Qj(),t=g5(),r=t0(),i=1/0,o=e&&1/r(new e([,-0]))[1]==i?function(a){return new e(a)}:t;return Fm=o,Fm}var zm,jS;function y5(){if(jS)return zm;jS=1;var e=oT(),t=p5(),r=m5(),i=aT(),o=v5(),a=t0(),u=200;function c(f,p,d){var g=-1,y=t,w=f.length,E=!0,_=[],b=_;if(d)E=!1,y=r;else if(w>=u){var k=p?null:o(f);if(k)return a(k);E=!1,y=i,b=new e}else b=p?[]:_;e:for(;++g<w;){var S=f[g],N=p?p(S):S;if(S=d||S!==0?S:0,E&&N===N){for(var T=b.length;T--;)if(b[T]===N)continue e;p&&b.push(N),_.push(S)}else y(b,N,d)||(b!==_&&b.push(N),_.push(S))}return _}return zm=c,zm}var Bm,TS;function ET(){if(TS)return Bm;TS=1;var e=Wr(),t=_r();function r(i){return t(i)&&e(i)}return Bm=r,Bm}var Um,RS;function w5(){if(RS)return Um;RS=1;var e=r0(),t=gc(),r=y5(),i=ET(),o=t(function(a){return r(e(a,1,i,!0))});return Um=o,Um}var Hm,AS;function x5(){if(AS)return Hm;AS=1;var e=hc();function t(r,i){return e(i,function(o){return r[o]})}return Hm=t,Hm}var Wm,IS;function NT(){if(IS)return Wm;IS=1;var e=x5(),t=Ns();function r(i){return i==null?[]:e(i,t(i))}return Wm=r,Wm}var Vm,MS;function Dn(){if(MS)return Vm;MS=1;var e;if(typeof By=="function")try{e={clone:C4(),constant:Zy(),each:iT(),filter:gT(),has:vT(),isArray:Ct(),isEmpty:Q4(),isFunction:Ka(),isUndefined:yT(),keys:Ns(),map:xT(),reduce:_T(),size:i5(),transform:o5(),union:w5(),values:NT()}}catch{}return e||(e=window._),Vm=e,Vm}var Gm,OS;function s0(){if(OS)return Gm;OS=1;var e=Dn();Gm=o;var t="\0",r="\0",i="";function o(d){this._isDirected=e.has(d,"directed")?d.directed:!0,this._isMultigraph=e.has(d,"multigraph")?d.multigraph:!1,this._isCompound=e.has(d,"compound")?d.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[r]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}o.prototype._nodeCount=0,o.prototype._edgeCount=0,o.prototype.isDirected=function(){return this._isDirected},o.prototype.isMultigraph=function(){return this._isMultigraph},o.prototype.isCompound=function(){return this._isCompound},o.prototype.setGraph=function(d){return this._label=d,this},o.prototype.graph=function(){return this._label},o.prototype.setDefaultNodeLabel=function(d){return e.isFunction(d)||(d=e.constant(d)),this._defaultNodeLabelFn=d,this},o.prototype.nodeCount=function(){return this._nodeCount},o.prototype.nodes=function(){return e.keys(this._nodes)},o.prototype.sources=function(){var d=this;return e.filter(this.nodes(),function(g){return e.isEmpty(d._in[g])})},o.prototype.sinks=function(){var d=this;return e.filter(this.nodes(),function(g){return e.isEmpty(d._out[g])})},o.prototype.setNodes=function(d,g){var y=arguments,w=this;return e.each(d,function(E){y.length>1?w.setNode(E,g):w.setNode(E)}),this},o.prototype.setNode=function(d,g){return e.has(this._nodes,d)?(arguments.length>1&&(this._nodes[d]=g),this):(this._nodes[d]=arguments.length>1?g:this._defaultNodeLabelFn(d),this._isCompound&&(this._parent[d]=r,this._children[d]={},this._children[r][d]=!0),this._in[d]={},this._preds[d]={},this._out[d]={},this._sucs[d]={},++this._nodeCount,this)},o.prototype.node=function(d){return this._nodes[d]},o.prototype.hasNode=function(d){return e.has(this._nodes,d)},o.prototype.removeNode=function(d){var g=this;if(e.has(this._nodes,d)){var y=function(w){g.removeEdge(g._edgeObjs[w])};delete this._nodes[d],this._isCompound&&(this._removeFromParentsChildList(d),delete this._parent[d],e.each(this.children(d),function(w){g.setParent(w)}),delete this._children[d]),e.each(e.keys(this._in[d]),y),delete this._in[d],delete this._preds[d],e.each(e.keys(this._out[d]),y),delete this._out[d],delete this._sucs[d],--this._nodeCount}return this},o.prototype.setParent=function(d,g){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(e.isUndefined(g))g=r;else{g+="";for(var y=g;!e.isUndefined(y);y=this.parent(y))if(y===d)throw new Error("Setting "+g+" as parent of "+d+" would create a cycle");this.setNode(g)}return this.setNode(d),this._removeFromParentsChildList(d),this._parent[d]=g,this._children[g][d]=!0,this},o.prototype._removeFromParentsChildList=function(d){delete this._children[this._parent[d]][d]},o.prototype.parent=function(d){if(this._isCompound){var g=this._parent[d];if(g!==r)return g}},o.prototype.children=function(d){if(e.isUndefined(d)&&(d=r),this._isCompound){var g=this._children[d];if(g)return e.keys(g)}else{if(d===r)return this.nodes();if(this.hasNode(d))return[]}},o.prototype.predecessors=function(d){var g=this._preds[d];if(g)return e.keys(g)},o.prototype.successors=function(d){var g=this._sucs[d];if(g)return e.keys(g)},o.prototype.neighbors=function(d){var g=this.predecessors(d);if(g)return e.union(g,this.successors(d))},o.prototype.isLeaf=function(d){var g;return this.isDirected()?g=this.successors(d):g=this.neighbors(d),g.length===0},o.prototype.filterNodes=function(d){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){d(b)&&g.setNode(b,_)}),e.each(this._edgeObjs,function(_){g.hasNode(_.v)&&g.hasNode(_.w)&&g.setEdge(_,y.edge(_))});var w={};function E(_){var b=y.parent(_);return b===void 0||g.hasNode(b)?(w[_]=b,b):b in w?w[b]:E(b)}return this._isCompound&&e.each(g.nodes(),function(_){g.setParent(_,E(_))}),g},o.prototype.setDefaultEdgeLabel=function(d){return e.isFunction(d)||(d=e.constant(d)),this._defaultEdgeLabelFn=d,this},o.prototype.edgeCount=function(){return this._edgeCount},o.prototype.edges=function(){return e.values(this._edgeObjs)},o.prototype.setPath=function(d,g){var y=this,w=arguments;return e.reduce(d,function(E,_){return w.length>1?y.setEdge(E,_,g):y.setEdge(E,_),_}),this},o.prototype.setEdge=function(){var d,g,y,w,E=!1,_=arguments[0];typeof _=="object"&&_!==null&&"v"in _?(d=_.v,g=_.w,y=_.name,arguments.length===2&&(w=arguments[1],E=!0)):(d=_,g=arguments[1],y=arguments[3],arguments.length>2&&(w=arguments[2],E=!0)),d=""+d,g=""+g,e.isUndefined(y)||(y=""+y);var b=c(this._isDirected,d,g,y);if(e.has(this._edgeLabels,b))return E&&(this._edgeLabels[b]=w),this;if(!e.isUndefined(y)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(d),this.setNode(g),this._edgeLabels[b]=E?w:this._defaultEdgeLabelFn(d,g,y);var k=f(this._isDirected,d,g,y);return d=k.v,g=k.w,Object.freeze(k),this._edgeObjs[b]=k,a(this._preds[g],d),a(this._sucs[d],g),this._in[g][b]=k,this._out[d][b]=k,this._edgeCount++,this},o.prototype.edge=function(d,g,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):c(this._isDirected,d,g,y);return this._edgeLabels[w]},o.prototype.hasEdge=function(d,g,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):c(this._isDirected,d,g,y);return e.has(this._edgeLabels,w)},o.prototype.removeEdge=function(d,g,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):c(this._isDirected,d,g,y),E=this._edgeObjs[w];return E&&(d=E.v,g=E.w,delete this._edgeLabels[w],delete this._edgeObjs[w],u(this._preds[g],d),u(this._sucs[d],g),delete this._in[g][w],delete this._out[d][w],this._edgeCount--),this},o.prototype.inEdges=function(d,g){var y=this._in[d];if(y){var w=e.values(y);return g?e.filter(w,function(E){return E.v===g}):w}},o.prototype.outEdges=function(d,g){var y=this._out[d];if(y){var w=e.values(y);return g?e.filter(w,function(E){return E.w===g}):w}},o.prototype.nodeEdges=function(d,g){var y=this.inEdges(d,g);if(y)return y.concat(this.outEdges(d,g))};function a(d,g){d[g]?d[g]++:d[g]=1}function u(d,g){--d[g]||delete d[g]}function c(d,g,y,w){var E=""+g,_=""+y;if(!d&&E>_){var b=E;E=_,_=b}return E+i+_+i+(e.isUndefined(w)?t:w)}function f(d,g,y,w){var E=""+g,_=""+y;if(!d&&E>_){var b=E;E=_,_=b}var k={v:E,w:_};return w&&(k.name=w),k}function p(d,g){return c(d,g.v,g.w,g.name)}return Gm}var Ym,PS;function _5(){return PS||(PS=1,Ym="2.1.8"),Ym}var Km,LS;function b5(){return LS||(LS=1,Km={Graph:s0(),version:_5()}),Km}var Xm,$S;function k5(){if($S)return Xm;$S=1;var e=Dn(),t=s0();Xm={write:r,read:a};function r(u){var c={options:{directed:u.isDirected(),multigraph:u.isMultigraph(),compound:u.isCompound()},nodes:i(u),edges:o(u)};return e.isUndefined(u.graph())||(c.value=e.clone(u.graph())),c}function i(u){return e.map(u.nodes(),function(c){var f=u.node(c),p=u.parent(c),d={v:c};return e.isUndefined(f)||(d.value=f),e.isUndefined(p)||(d.parent=p),d})}function o(u){return e.map(u.edges(),function(c){var f=u.edge(c),p={v:c.v,w:c.w};return e.isUndefined(c.name)||(p.name=c.name),e.isUndefined(f)||(p.value=f),p})}function a(u){var c=new t(u.options).setGraph(u.value);return e.each(u.nodes,function(f){c.setNode(f.v,f.value),f.parent&&c.setParent(f.v,f.parent)}),e.each(u.edges,function(f){c.setEdge({v:f.v,w:f.w,name:f.name},f.value)}),c}return Xm}var Qm,qS;function S5(){if(qS)return Qm;qS=1;var e=Dn();Qm=t;function t(r){var i={},o=[],a;function u(c){e.has(i,c)||(i[c]=!0,a.push(c),e.each(r.successors(c),u),e.each(r.predecessors(c),u))}return e.each(r.nodes(),function(c){a=[],u(c),a.length&&o.push(a)}),o}return Qm}var Zm,DS;function CT(){if(DS)return Zm;DS=1;var e=Dn();Zm=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(r){return r.key})},t.prototype.has=function(r){return e.has(this._keyIndices,r)},t.prototype.priority=function(r){var i=this._keyIndices[r];if(i!==void 0)return this._arr[i].priority},t.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},t.prototype.add=function(r,i){var o=this._keyIndices;if(r=String(r),!e.has(o,r)){var a=this._arr,u=a.length;return o[r]=u,a.push({key:r,priority:i}),this._decrease(u),!0}return!1},t.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var r=this._arr.pop();return delete this._keyIndices[r.key],this._heapify(0),r.key},t.prototype.decrease=function(r,i){var o=this._keyIndices[r];if(i>this._arr[o].priority)throw new Error("New priority is greater than current priority. Key: "+r+" Old: "+this._arr[o].priority+" New: "+i);this._arr[o].priority=i,this._decrease(o)},t.prototype._heapify=function(r){var i=this._arr,o=2*r,a=o+1,u=r;o<i.length&&(u=i[o].priority<i[u].priority?o:u,a<i.length&&(u=i[a].priority<i[u].priority?a:u),u!==r&&(this._swap(r,u),this._heapify(u)))},t.prototype._decrease=function(r){for(var i=this._arr,o=i[r].priority,a;r!==0&&(a=r>>1,!(i[a].priority<o));)this._swap(r,a),r=a},t.prototype._swap=function(r,i){var o=this._arr,a=this._keyIndices,u=o[r],c=o[i];o[r]=c,o[i]=u,a[c.key]=r,a[u.key]=i},Zm}var Jm,FS;function jT(){if(FS)return Jm;FS=1;var e=Dn(),t=CT();Jm=i;var r=e.constant(1);function i(a,u,c,f){return o(a,String(u),c||r,f||function(p){return a.outEdges(p)})}function o(a,u,c,f){var p={},d=new t,g,y,w=function(E){var _=E.v!==g?E.v:E.w,b=p[_],k=c(E),S=y.distance+k;if(k<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+E+" Weight: "+k);S<b.distance&&(b.distance=S,b.predecessor=g,d.decrease(_,S))};for(a.nodes().forEach(function(E){var _=E===u?0:Number.POSITIVE_INFINITY;p[E]={distance:_},d.add(E,_)});d.size()>0&&(g=d.removeMin(),y=p[g],y.distance!==Number.POSITIVE_INFINITY);)f(g).forEach(w);return p}return Jm}var eg,zS;function E5(){if(zS)return eg;zS=1;var e=jT(),t=Dn();eg=r;function r(i,o,a){return t.transform(i.nodes(),function(u,c){u[c]=e(i,c,o,a)},{})}return eg}var tg,BS;function TT(){if(BS)return tg;BS=1;var e=Dn();tg=t;function t(r){var i=0,o=[],a={},u=[];function c(f){var p=a[f]={onStack:!0,lowlink:i,index:i++};if(o.push(f),r.successors(f).forEach(function(y){e.has(a,y)?a[y].onStack&&(p.lowlink=Math.min(p.lowlink,a[y].index)):(c(y),p.lowlink=Math.min(p.lowlink,a[y].lowlink))}),p.lowlink===p.index){var d=[],g;do g=o.pop(),a[g].onStack=!1,d.push(g);while(f!==g);u.push(d)}}return r.nodes().forEach(function(f){e.has(a,f)||c(f)}),u}return tg}var ng,US;function N5(){if(US)return ng;US=1;var e=Dn(),t=TT();ng=r;function r(i){return e.filter(t(i),function(o){return o.length>1||o.length===1&&i.hasEdge(o[0],o[0])})}return ng}var rg,HS;function C5(){if(HS)return rg;HS=1;var e=Dn();rg=r;var t=e.constant(1);function r(o,a,u){return i(o,a||t,u||function(c){return o.outEdges(c)})}function i(o,a,u){var c={},f=o.nodes();return f.forEach(function(p){c[p]={},c[p][p]={distance:0},f.forEach(function(d){p!==d&&(c[p][d]={distance:Number.POSITIVE_INFINITY})}),u(p).forEach(function(d){var g=d.v===p?d.w:d.v,y=a(d);c[p][g]={distance:y,predecessor:p}})}),f.forEach(function(p){var d=c[p];f.forEach(function(g){var y=c[g];f.forEach(function(w){var E=y[p],_=d[w],b=y[w],k=E.distance+_.distance;k<b.distance&&(b.distance=k,b.predecessor=_.predecessor)})})}),c}return rg}var sg,WS;function RT(){if(WS)return sg;WS=1;var e=Dn();sg=t,t.CycleException=r;function t(i){var o={},a={},u=[];function c(f){if(e.has(a,f))throw new r;e.has(o,f)||(a[f]=!0,o[f]=!0,e.each(i.predecessors(f),c),delete a[f],u.push(f))}if(e.each(i.sinks(),c),e.size(o)!==i.nodeCount())throw new r;return u}function r(){}return r.prototype=new Error,sg}var ig,VS;function j5(){if(VS)return ig;VS=1;var e=RT();ig=t;function t(r){try{e(r)}catch(i){if(i instanceof e.CycleException)return!1;throw i}return!0}return ig}var og,GS;function AT(){if(GS)return og;GS=1;var e=Dn();og=t;function t(i,o,a){e.isArray(o)||(o=[o]);var u=(i.isDirected()?i.successors:i.neighbors).bind(i),c=[],f={};return e.each(o,function(p){if(!i.hasNode(p))throw new Error("Graph does not have node: "+p);r(i,p,a==="post",f,u,c)}),c}function r(i,o,a,u,c,f){e.has(u,o)||(u[o]=!0,a||f.push(o),e.each(c(o),function(p){r(i,p,a,u,c,f)}),a&&f.push(o))}return og}var ag,YS;function T5(){if(YS)return ag;YS=1;var e=AT();ag=t;function t(r,i){return e(r,i,"post")}return ag}var lg,KS;function R5(){if(KS)return lg;KS=1;var e=AT();lg=t;function t(r,i){return e(r,i,"pre")}return lg}var ug,XS;function A5(){if(XS)return ug;XS=1;var e=Dn(),t=s0(),r=CT();ug=i;function i(o,a){var u=new t,c={},f=new r,p;function d(y){var w=y.v===p?y.w:y.v,E=f.priority(w);if(E!==void 0){var _=a(y);_<E&&(c[w]=p,f.decrease(w,_))}}if(o.nodeCount()===0)return u;e.each(o.nodes(),function(y){f.add(y,Number.POSITIVE_INFINITY),u.setNode(y)}),f.decrease(o.nodes()[0],0);for(var g=!1;f.size()>0;){if(p=f.removeMin(),e.has(c,p))u.setEdge(p,c[p]);else{if(g)throw new Error("Input graph is not connected: "+o);g=!0}o.nodeEdges(p).forEach(d)}return u}return ug}var cg,QS;function I5(){return QS||(QS=1,cg={components:S5(),dijkstra:jT(),dijkstraAll:E5(),findCycles:N5(),floydWarshall:C5(),isAcyclic:j5(),postorder:T5(),preorder:R5(),prim:A5(),tarjan:TT(),topsort:RT()}),cg}var dg,ZS;function M5(){if(ZS)return dg;ZS=1;var e=b5();return dg={Graph:e.Graph,json:k5(),alg:I5(),version:e.version},dg}var fg,JS;function rr(){if(JS)return fg;JS=1;var e;if(typeof By=="function")try{e=M5()}catch{}return e||(e=window.graphlib),fg=e,fg}var hg,eE;function O5(){if(eE)return hg;eE=1;var e=nT(),t=1,r=4;function i(o){return e(o,t|r)}return hg=i,hg}var pg,tE;function vc(){if(tE)return pg;tE=1;var e=Co(),t=Wr(),r=lc(),i=qn();function o(a,u,c){if(!i(c))return!1;var f=typeof u;return(f=="number"?t(c)&&r(u,c.length):f=="string"&&u in c)?e(c[u],a):!1}return pg=o,pg}var mg,nE;function P5(){if(nE)return mg;nE=1;var e=gc(),t=Co(),r=vc(),i=wi(),o=Object.prototype,a=o.hasOwnProperty,u=e(function(c,f){c=Object(c);var p=-1,d=f.length,g=d>2?f[2]:void 0;for(g&&r(f[0],f[1],g)&&(d=1);++p<d;)for(var y=f[p],w=i(y),E=-1,_=w.length;++E<_;){var b=w[E],k=c[b];(k===void 0||t(k,o[b])&&!a.call(c,b))&&(c[b]=y[b])}return c});return mg=u,mg}var gg,rE;function L5(){if(rE)return gg;rE=1;var e=Vr(),t=Wr(),r=Ns();function i(o){return function(a,u,c){var f=Object(a);if(!t(a)){var p=e(u,3);a=r(a),u=function(g){return p(f[g],g,f)}}var d=o(a,u,c);return d>-1?f[p?a[d]:d]:void 0}}return gg=i,gg}var vg,sE;function $5(){if(sE)return vg;sE=1;var e=/\s/;function t(r){for(var i=r.length;i--&&e.test(r.charAt(i)););return i}return vg=t,vg}var yg,iE;function q5(){if(iE)return yg;iE=1;var e=$5(),t=/^\s+/;function r(i){return i&&i.slice(0,e(i)+1).replace(t,"")}return yg=r,yg}var wg,oE;function D5(){if(oE)return wg;oE=1;var e=q5(),t=qn(),r=Ao(),i=NaN,o=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,u=/^0o[0-7]+$/i,c=parseInt;function f(p){if(typeof p=="number")return p;if(r(p))return i;if(t(p)){var d=typeof p.valueOf=="function"?p.valueOf():p;p=t(d)?d+"":d}if(typeof p!="string")return p===0?p:+p;p=e(p);var g=a.test(p);return g||u.test(p)?c(p.slice(2),g?2:8):o.test(p)?i:+p}return wg=f,wg}var xg,aE;function IT(){if(aE)return xg;aE=1;var e=D5(),t=1/0,r=17976931348623157e292;function i(o){if(!o)return o===0?o:0;if(o=e(o),o===t||o===-t){var a=o<0?-1:1;return a*r}return o===o?o:0}return xg=i,xg}var _g,lE;function F5(){if(lE)return _g;lE=1;var e=IT();function t(r){var i=e(r),o=i%1;return i===i?o?i-o:i:0}return _g=t,_g}var bg,uE;function z5(){if(uE)return bg;uE=1;var e=ST(),t=Vr(),r=F5(),i=Math.max;function o(a,u,c){var f=a==null?0:a.length;if(!f)return-1;var p=c==null?0:r(c);return p<0&&(p=i(f+p,0)),e(a,t(u,3),p)}return bg=o,bg}var kg,cE;function B5(){if(cE)return kg;cE=1;var e=L5(),t=z5(),r=e(t);return kg=r,kg}var Sg,dE;function MT(){if(dE)return Sg;dE=1;var e=r0();function t(r){var i=r==null?0:r.length;return i?e(r,1):[]}return Sg=t,Sg}var Eg,fE;function U5(){if(fE)return Eg;fE=1;var e=Jy(),t=rT(),r=wi();function i(o,a){return o==null?o:e(o,t(a),r)}return Eg=i,Eg}var Ng,hE;function H5(){if(hE)return Ng;hE=1;function e(t){var r=t==null?0:t.length;return r?t[r-1]:void 0}return Ng=e,Ng}var Cg,pE;function W5(){if(pE)return Cg;pE=1;var e=oc(),t=e0(),r=Vr();function i(o,a){var u={};return a=r(a,3),t(o,function(c,f,p){e(u,f,a(c,f,p))}),u}return Cg=i,Cg}var jg,mE;function i0(){if(mE)return jg;mE=1;var e=Ao();function t(r,i,o){for(var a=-1,u=r.length;++a<u;){var c=r[a],f=i(c);if(f!=null&&(p===void 0?f===f&&!e(f):o(f,p)))var p=f,d=c}return d}return jg=t,jg}var Tg,gE;function V5(){if(gE)return Tg;gE=1;function e(t,r){return t>r}return Tg=e,Tg}var Rg,vE;function G5(){if(vE)return Rg;vE=1;var e=i0(),t=V5(),r=xi();function i(o){return o&&o.length?e(o,r,t):void 0}return Rg=i,Rg}var Ag,yE;function OT(){if(yE)return Ag;yE=1;var e=oc(),t=Co();function r(i,o,a){(a!==void 0&&!t(i[o],a)||a===void 0&&!(o in i))&&e(i,o,a)}return Ag=r,Ag}var Ig,wE;function Y5(){if(wE)return Ig;wE=1;var e=vi(),t=dc(),r=_r(),i="[object Object]",o=Function.prototype,a=Object.prototype,u=o.toString,c=a.hasOwnProperty,f=u.call(Object);function p(d){if(!r(d)||e(d)!=i)return!1;var g=t(d);if(g===null)return!0;var y=c.call(g,"constructor")&&g.constructor;return typeof y=="function"&&y instanceof y&&u.call(y)==f}return Ig=p,Ig}var Mg,xE;function PT(){if(xE)return Mg;xE=1;function e(t,r){if(!(r==="constructor"&&typeof t[r]=="function")&&r!="__proto__")return t[r]}return Mg=e,Mg}var Og,_E;function K5(){if(_E)return Og;_E=1;var e=Xa(),t=wi();function r(i){return e(i,t(i))}return Og=r,Og}var Pg,bE;function X5(){if(bE)return Pg;bE=1;var e=OT(),t=Hj(),r=Jj(),i=Wj(),o=tT(),a=Qa(),u=Ct(),c=ET(),f=To(),p=Ka(),d=qn(),g=Y5(),y=Za(),w=PT(),E=K5();function _(b,k,S,N,T,A,L){var P=w(b,S),U=w(k,S),O=L.get(U);if(O){e(b,S,O);return}var M=A?A(P,U,S+"",b,k,L):void 0,q=M===void 0;if(q){var V=u(U),Q=!V&&f(U),j=!V&&!Q&&y(U);M=U,V||Q||j?u(P)?M=P:c(P)?M=i(P):Q?(q=!1,M=t(U,!0)):j?(q=!1,M=r(U,!0)):M=[]:g(U)||a(U)?(M=P,a(P)?M=E(P):(!d(P)||p(P))&&(M=o(U))):q=!1}q&&(L.set(U,M),T(M,U,N,A,L),L.delete(U)),e(b,S,M)}return Pg=_,Pg}var Lg,kE;function Q5(){if(kE)return Lg;kE=1;var e=ic(),t=OT(),r=Jy(),i=X5(),o=qn(),a=wi(),u=PT();function c(f,p,d,g,y){f!==p&&r(p,function(w,E){if(y||(y=new e),o(w))i(f,p,E,d,c,g,y);else{var _=g?g(u(f,E),w,E+"",f,p,y):void 0;_===void 0&&(_=w),t(f,E,_)}},a)}return Lg=c,Lg}var $g,SE;function Z5(){if(SE)return $g;SE=1;var e=gc(),t=vc();function r(i){return e(function(o,a){var u=-1,c=a.length,f=c>1?a[c-1]:void 0,p=c>2?a[2]:void 0;for(f=i.length>3&&typeof f=="function"?(c--,f):void 0,p&&t(a[0],a[1],p)&&(f=c<3?void 0:f,c=1),o=Object(o);++u<c;){var d=a[u];d&&i(o,d,u,f)}return o})}return $g=r,$g}var qg,EE;function J5(){if(EE)return qg;EE=1;var e=Q5(),t=Z5(),r=t(function(i,o,a){e(i,o,a)});return qg=r,qg}var Dg,NE;function LT(){if(NE)return Dg;NE=1;function e(t,r){return t<r}return Dg=e,Dg}var Fg,CE;function eF(){if(CE)return Fg;CE=1;var e=i0(),t=LT(),r=xi();function i(o){return o&&o.length?e(o,r,t):void 0}return Fg=i,Fg}var zg,jE;function tF(){if(jE)return zg;jE=1;var e=i0(),t=Vr(),r=LT();function i(o,a){return o&&o.length?e(o,t(a,2),r):void 0}return zg=i,zg}var Bg,TE;function nF(){if(TE)return Bg;TE=1;var e=ir(),t=function(){return e.Date.now()};return Bg=t,Bg}var Ug,RE;function rF(){if(RE)return Ug;RE=1;var e=ac(),t=pc(),r=lc(),i=qn(),o=Ja();function a(u,c,f,p){if(!i(u))return u;c=t(c,u);for(var d=-1,g=c.length,y=g-1,w=u;w!=null&&++d<g;){var E=o(c[d]),_=f;if(E==="__proto__"||E==="constructor"||E==="prototype")return u;if(d!=y){var b=w[E];_=p?p(b,E,w):void 0,_===void 0&&(_=i(b)?b:r(c[d+1])?[]:{})}e(w,E,_),w=w[E]}return u}return Ug=a,Ug}var Hg,AE;function sF(){if(AE)return Hg;AE=1;var e=mc(),t=rF(),r=pc();function i(o,a,u){for(var c=-1,f=a.length,p={};++c<f;){var d=a[c],g=e(o,d);u(g,d)&&t(p,r(d,o),g)}return p}return Hg=i,Hg}var Wg,IE;function iF(){if(IE)return Wg;IE=1;var e=sF(),t=pT();function r(i,o){return e(i,o,function(a,u){return t(i,u)})}return Wg=r,Wg}var Vg,ME;function oF(){if(ME)return Vg;ME=1;var e=MT(),t=bT(),r=kT();function i(o){return r(t(o,void 0,e),o+"")}return Vg=i,Vg}var Gg,OE;function aF(){if(OE)return Gg;OE=1;var e=iF(),t=oF(),r=t(function(i,o){return i==null?{}:e(i,o)});return Gg=r,Gg}var Yg,PE;function lF(){if(PE)return Yg;PE=1;var e=Math.ceil,t=Math.max;function r(i,o,a,u){for(var c=-1,f=t(e((o-i)/(a||1)),0),p=Array(f);f--;)p[u?f:++c]=i,i+=a;return p}return Yg=r,Yg}var Kg,LE;function uF(){if(LE)return Kg;LE=1;var e=lF(),t=vc(),r=IT();function i(o){return function(a,u,c){return c&&typeof c!="number"&&t(a,u,c)&&(u=c=void 0),a=r(a),u===void 0?(u=a,a=0):u=r(u),c=c===void 0?a<u?1:-1:r(c),e(a,u,c,o)}}return Kg=i,Kg}var Xg,$E;function cF(){if($E)return Xg;$E=1;var e=uF(),t=e();return Xg=t,Xg}var Qg,qE;function dF(){if(qE)return Qg;qE=1;function e(t,r){var i=t.length;for(t.sort(r);i--;)t[i]=t[i].value;return t}return Qg=e,Qg}var Zg,DE;function fF(){if(DE)return Zg;DE=1;var e=Ao();function t(r,i){if(r!==i){var o=r!==void 0,a=r===null,u=r===r,c=e(r),f=i!==void 0,p=i===null,d=i===i,g=e(i);if(!p&&!g&&!c&&r>i||c&&f&&d&&!p&&!g||a&&f&&d||!o&&d||!u)return 1;if(!a&&!c&&!g&&r<i||g&&o&&u&&!a&&!c||p&&o&&u||!f&&u||!d)return-1}return 0}return Zg=t,Zg}var Jg,FE;function hF(){if(FE)return Jg;FE=1;var e=fF();function t(r,i,o){for(var a=-1,u=r.criteria,c=i.criteria,f=u.length,p=o.length;++a<f;){var d=e(u[a],c[a]);if(d){if(a>=p)return d;var g=o[a];return d*(g=="desc"?-1:1)}}return r.index-i.index}return Jg=t,Jg}var ev,zE;function pF(){if(zE)return ev;zE=1;var e=hc(),t=mc(),r=Vr(),i=wT(),o=dF(),a=uc(),u=hF(),c=xi(),f=Ct();function p(d,g,y){g.length?g=e(g,function(_){return f(_)?function(b){return t(b,_.length===1?_[0]:_)}:_}):g=[c];var w=-1;g=e(g,a(r));var E=i(d,function(_,b,k){var S=e(g,function(N){return N(_)});return{criteria:S,index:++w,value:_}});return o(E,function(_,b){return u(_,b,y)})}return ev=p,ev}var tv,BE;function mF(){if(BE)return tv;BE=1;var e=r0(),t=pF(),r=gc(),i=vc(),o=r(function(a,u){if(a==null)return[];var c=u.length;return c>1&&i(a,u[0],u[1])?u=[]:c>2&&i(u[0],u[1],u[2])&&(u=[u[0]]),t(a,e(u,1),[])});return tv=o,tv}var nv,UE;function gF(){if(UE)return nv;UE=1;var e=fT(),t=0;function r(i){var o=++t;return e(i)+o}return nv=r,nv}var rv,HE;function vF(){if(HE)return rv;HE=1;function e(t,r,i){for(var o=-1,a=t.length,u=r.length,c={};++o<a;){var f=o<u?r[o]:void 0;i(c,t[o],f)}return c}return rv=e,rv}var sv,WE;function yF(){if(WE)return sv;WE=1;var e=ac(),t=vF();function r(i,o){return t(i||[],o||[],e)}return sv=r,sv}var iv,VE;function mt(){if(VE)return iv;VE=1;var e;if(typeof By=="function")try{e={cloneDeep:O5(),constant:Zy(),defaults:P5(),each:iT(),filter:gT(),find:B5(),flatten:MT(),forEach:sT(),forIn:U5(),has:vT(),isUndefined:yT(),last:H5(),map:xT(),mapValues:W5(),max:G5(),merge:J5(),min:eF(),minBy:tF(),now:nF(),pick:aF(),range:cF(),reduce:_T(),sortBy:mF(),uniqueId:gF(),values:NT(),zipObject:yF()}}catch{}return e||(e=window._),iv=e,iv}var ov,GE;function wF(){if(GE)return ov;GE=1,ov=e;function e(){var i={};i._next=i._prev=i,this._sentinel=i}e.prototype.dequeue=function(){var i=this._sentinel,o=i._prev;if(o!==i)return t(o),o},e.prototype.enqueue=function(i){var o=this._sentinel;i._prev&&i._next&&t(i),i._next=o._next,o._next._prev=i,o._next=i,i._prev=o},e.prototype.toString=function(){for(var i=[],o=this._sentinel,a=o._prev;a!==o;)i.push(JSON.stringify(a,r)),a=a._prev;return"["+i.join(", ")+"]"};function t(i){i._prev._next=i._next,i._next._prev=i._prev,delete i._next,delete i._prev}function r(i,o){if(i!=="_next"&&i!=="_prev")return o}return ov}var av,YE;function xF(){if(YE)return av;YE=1;var e=mt(),t=rr().Graph,r=wF();av=o;var i=e.constant(1);function o(p,d){if(p.nodeCount()<=1)return[];var g=c(p,d||i),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,d,g){for(var y=[],w=d[d.length-1],E=d[0],_;p.nodeCount();){for(;_=E.dequeue();)u(p,d,g,_);for(;_=w.dequeue();)u(p,d,g,_);if(p.nodeCount()){for(var b=d.length-2;b>0;--b)if(_=d[b].dequeue(),_){y=y.concat(u(p,d,g,_,!0));break}}}return y}function u(p,d,g,y,w){var E=w?[]:void 0;return e.forEach(p.inEdges(y.v),function(_){var b=p.edge(_),k=p.node(_.v);w&&E.push({v:_.v,w:_.w}),k.out-=b,f(d,g,k)}),e.forEach(p.outEdges(y.v),function(_){var b=p.edge(_),k=_.w,S=p.node(k);S.in-=b,f(d,g,S)}),p.removeNode(y.v),E}function c(p,d){var g=new t,y=0,w=0;e.forEach(p.nodes(),function(b){g.setNode(b,{v:b,in:0,out:0})}),e.forEach(p.edges(),function(b){var k=g.edge(b.v,b.w)||0,S=d(b),N=k+S;g.setEdge(b.v,b.w,N),w=Math.max(w,g.node(b.v).out+=S),y=Math.max(y,g.node(b.w).in+=S)});var E=e.range(w+y+3).map(function(){return new r}),_=y+1;return e.forEach(g.nodes(),function(b){f(E,_,g.node(b))}),{graph:g,buckets:E,zeroIdx:_}}function f(p,d,g){g.out?g.in?p[g.out-g.in+d].enqueue(g):p[p.length-1].enqueue(g):p[0].enqueue(g)}return av}var lv,KE;function _F(){if(KE)return lv;KE=1;var e=mt(),t=xF();lv={run:r,undo:o};function r(a){var u=a.graph().acyclicer==="greedy"?t(a,c(a)):i(a);e.forEach(u,function(f){var p=a.edge(f);a.removeEdge(f),p.forwardName=f.name,p.reversed=!0,a.setEdge(f.w,f.v,p,e.uniqueId("rev"))});function c(f){return function(p){return f.edge(p).weight}}}function i(a){var u=[],c={},f={};function p(d){e.has(f,d)||(f[d]=!0,c[d]=!0,e.forEach(a.outEdges(d),function(g){e.has(c,g.w)?u.push(g):p(g.w)}),delete c[d])}return e.forEach(a.nodes(),p),u}function o(a){e.forEach(a.edges(),function(u){var c=a.edge(u);if(c.reversed){a.removeEdge(u);var f=c.forwardName;delete c.reversed,delete c.forwardName,a.setEdge(u.w,u.v,c,f)}})}return lv}var uv,XE;function ln(){if(XE)return uv;XE=1;var e=mt(),t=rr().Graph;uv={addDummyNode:r,simplify:i,asNonCompoundGraph:o,successorWeights:a,predecessorWeights:u,intersectRect:c,buildLayerMatrix:f,normalizeRanks:p,removeEmptyRanks:d,addBorderNode:g,maxRank:y,partition:w,time:E,notime:_};function r(b,k,S,N){var T;do T=e.uniqueId(N);while(b.hasNode(T));return S.dummy=k,b.setNode(T,S),T}function i(b){var k=new t().setGraph(b.graph());return e.forEach(b.nodes(),function(S){k.setNode(S,b.node(S))}),e.forEach(b.edges(),function(S){var N=k.edge(S.v,S.w)||{weight:0,minlen:1},T=b.edge(S);k.setEdge(S.v,S.w,{weight:N.weight+T.weight,minlen:Math.max(N.minlen,T.minlen)})}),k}function o(b){var k=new t({multigraph:b.isMultigraph()}).setGraph(b.graph());return e.forEach(b.nodes(),function(S){b.children(S).length||k.setNode(S,b.node(S))}),e.forEach(b.edges(),function(S){k.setEdge(S,b.edge(S))}),k}function a(b){var k=e.map(b.nodes(),function(S){var N={};return e.forEach(b.outEdges(S),function(T){N[T.w]=(N[T.w]||0)+b.edge(T).weight}),N});return e.zipObject(b.nodes(),k)}function u(b){var k=e.map(b.nodes(),function(S){var N={};return e.forEach(b.inEdges(S),function(T){N[T.v]=(N[T.v]||0)+b.edge(T).weight}),N});return e.zipObject(b.nodes(),k)}function c(b,k){var S=b.x,N=b.y,T=k.x-S,A=k.y-N,L=b.width/2,P=b.height/2;if(!T&&!A)throw new Error("Not possible to find intersection inside of the rectangle");var U,O;return Math.abs(A)*L>Math.abs(T)*P?(A<0&&(P=-P),U=P*T/A,O=P):(T<0&&(L=-L),U=L,O=L*A/T),{x:S+U,y:N+O}}function f(b){var k=e.map(e.range(y(b)+1),function(){return[]});return e.forEach(b.nodes(),function(S){var N=b.node(S),T=N.rank;e.isUndefined(T)||(k[T][N.order]=S)}),k}function p(b){var k=e.min(e.map(b.nodes(),function(S){return b.node(S).rank}));e.forEach(b.nodes(),function(S){var N=b.node(S);e.has(N,"rank")&&(N.rank-=k)})}function d(b){var k=e.min(e.map(b.nodes(),function(A){return b.node(A).rank})),S=[];e.forEach(b.nodes(),function(A){var L=b.node(A).rank-k;S[L]||(S[L]=[]),S[L].push(A)});var N=0,T=b.graph().nodeRankFactor;e.forEach(S,function(A,L){e.isUndefined(A)&&L%T!==0?--N:N&&e.forEach(A,function(P){b.node(P).rank+=N})})}function g(b,k,S,N){var T={width:0,height:0};return arguments.length>=4&&(T.rank=S,T.order=N),r(b,"border",T,k)}function y(b){return e.max(e.map(b.nodes(),function(k){var S=b.node(k).rank;if(!e.isUndefined(S))return S}))}function w(b,k){var S={lhs:[],rhs:[]};return e.forEach(b,function(N){k(N)?S.lhs.push(N):S.rhs.push(N)}),S}function E(b,k){var S=e.now();try{return k()}finally{console.log(b+" time: "+(e.now()-S)+"ms")}}function _(b,k){return k()}return uv}var cv,QE;function bF(){if(QE)return cv;QE=1;var e=mt(),t=ln();cv={run:r,undo:o};function r(a){a.graph().dummyChains=[],e.forEach(a.edges(),function(u){i(a,u)})}function i(a,u){var c=u.v,f=a.node(c).rank,p=u.w,d=a.node(p).rank,g=u.name,y=a.edge(u),w=y.labelRank;if(d!==f+1){a.removeEdge(u);var E,_,b;for(b=0,++f;f<d;++b,++f)y.points=[],_={width:0,height:0,edgeLabel:y,edgeObj:u,rank:f},E=t.addDummyNode(a,"edge",_,"_d"),f===w&&(_.width=y.width,_.height=y.height,_.dummy="edge-label",_.labelpos=y.labelpos),a.setEdge(c,E,{weight:y.weight},g),b===0&&a.graph().dummyChains.push(E),c=E;a.setEdge(c,p,{weight:y.weight},g)}}function o(a){e.forEach(a.graph().dummyChains,function(u){var c=a.node(u),f=c.edgeLabel,p;for(a.setEdge(c.edgeObj,f);c.dummy;)p=a.successors(u)[0],a.removeNode(u),f.points.push({x:c.x,y:c.y}),c.dummy==="edge-label"&&(f.x=c.x,f.y=c.y,f.width=c.width,f.height=c.height),u=p,c=a.node(u)})}return cv}var dv,ZE;function Uu(){if(ZE)return dv;ZE=1;var e=mt();dv={longestPath:t,slack:r};function t(i){var o={};function a(u){var c=i.node(u);if(e.has(o,u))return c.rank;o[u]=!0;var f=e.min(e.map(i.outEdges(u),function(p){return a(p.w)-i.edge(p).minlen}));return(f===Number.POSITIVE_INFINITY||f===void 0||f===null)&&(f=0),c.rank=f}e.forEach(i.sources(),a)}function r(i,o){return i.node(o.w).rank-i.node(o.v).rank-i.edge(o).minlen}return dv}var fv,JE;function $T(){if(JE)return fv;JE=1;var e=mt(),t=rr().Graph,r=Uu().slack;fv=i;function i(c){var f=new t({directed:!1}),p=c.nodes()[0],d=c.nodeCount();f.setNode(p,{});for(var g,y;o(f,c)<d;)g=a(f,c),y=f.hasNode(g.v)?r(c,g):-r(c,g),u(f,c,y);return f}function o(c,f){function p(d){e.forEach(f.nodeEdges(d),function(g){var y=g.v,w=d===y?g.w:y;!c.hasNode(w)&&!r(f,g)&&(c.setNode(w,{}),c.setEdge(d,w,{}),p(w))})}return e.forEach(c.nodes(),p),c.nodeCount()}function a(c,f){return e.minBy(f.edges(),function(p){if(c.hasNode(p.v)!==c.hasNode(p.w))return r(f,p)})}function u(c,f,p){e.forEach(c.nodes(),function(d){f.node(d).rank+=p})}return fv}var hv,eN;function kF(){if(eN)return hv;eN=1;var e=mt(),t=$T(),r=Uu().slack,i=Uu().longestPath,o=rr().alg.preorder,a=rr().alg.postorder,u=ln().simplify;hv=c,c.initLowLimValues=g,c.initCutValues=f,c.calcCutValue=d,c.leaveEdge=w,c.enterEdge=E,c.exchangeEdges=_;function c(N){N=u(N),i(N);var T=t(N);g(T),f(T,N);for(var A,L;A=w(T);)L=E(T,N,A),_(T,N,A,L)}function f(N,T){var A=a(N,N.nodes());A=A.slice(0,A.length-1),e.forEach(A,function(L){p(N,T,L)})}function p(N,T,A){var L=N.node(A),P=L.parent;N.edge(A,P).cutvalue=d(N,T,A)}function d(N,T,A){var L=N.node(A),P=L.parent,U=!0,O=T.edge(A,P),M=0;return O||(U=!1,O=T.edge(P,A)),M=O.weight,e.forEach(T.nodeEdges(A),function(q){var V=q.v===A,Q=V?q.w:q.v;if(Q!==P){var j=V===U,G=T.edge(q).weight;if(M+=j?G:-G,k(N,A,Q)){var z=N.edge(A,Q).cutvalue;M+=j?-z:z}}}),M}function g(N,T){arguments.length<2&&(T=N.nodes()[0]),y(N,{},1,T)}function y(N,T,A,L,P){var U=A,O=N.node(L);return T[L]=!0,e.forEach(N.neighbors(L),function(M){e.has(T,M)||(A=y(N,T,A,M,L))}),O.low=U,O.lim=A++,P?O.parent=P:delete O.parent,A}function w(N){return e.find(N.edges(),function(T){return N.edge(T).cutvalue<0})}function E(N,T,A){var L=A.v,P=A.w;T.hasEdge(L,P)||(L=A.w,P=A.v);var U=N.node(L),O=N.node(P),M=U,q=!1;U.lim>O.lim&&(M=O,q=!0);var V=e.filter(T.edges(),function(Q){return q===S(N,N.node(Q.v),M)&&q!==S(N,N.node(Q.w),M)});return e.minBy(V,function(Q){return r(T,Q)})}function _(N,T,A,L){var P=A.v,U=A.w;N.removeEdge(P,U),N.setEdge(L.v,L.w,{}),g(N),f(N,T),b(N,T)}function b(N,T){var A=e.find(N.nodes(),function(P){return!T.node(P).parent}),L=o(N,A);L=L.slice(1),e.forEach(L,function(P){var U=N.node(P).parent,O=T.edge(P,U),M=!1;O||(O=T.edge(U,P),M=!0),T.node(P).rank=T.node(U).rank+(M?O.minlen:-O.minlen)})}function k(N,T,A){return N.hasEdge(T,A)}function S(N,T,A){return A.low<=T.lim&&T.lim<=A.lim}return hv}var pv,tN;function SF(){if(tN)return pv;tN=1;var e=Uu(),t=e.longestPath,r=$T(),i=kF();pv=o;function o(f){switch(f.graph().ranker){case"network-simplex":c(f);break;case"tight-tree":u(f);break;case"longest-path":a(f);break;default:c(f)}}var a=t;function u(f){t(f),r(f)}function c(f){i(f)}return pv}var mv,nN;function EF(){if(nN)return mv;nN=1;var e=mt();mv=t;function t(o){var a=i(o);e.forEach(o.graph().dummyChains,function(u){for(var c=o.node(u),f=c.edgeObj,p=r(o,a,f.v,f.w),d=p.path,g=p.lca,y=0,w=d[y],E=!0;u!==f.w;){if(c=o.node(u),E){for(;(w=d[y])!==g&&o.node(w).maxRank<c.rank;)y++;w===g&&(E=!1)}if(!E){for(;y<d.length-1&&o.node(w=d[y+1]).minRank<=c.rank;)y++;w=d[y]}o.setParent(u,w),u=o.successors(u)[0]}})}function r(o,a,u,c){var f=[],p=[],d=Math.min(a[u].low,a[c].low),g=Math.max(a[u].lim,a[c].lim),y,w;y=u;do y=o.parent(y),f.push(y);while(y&&(a[y].low>d||g>a[y].lim));for(w=y,y=c;(y=o.parent(y))!==w;)p.push(y);return{path:f.concat(p.reverse()),lca:w}}function i(o){var a={},u=0;function c(f){var p=u;e.forEach(o.children(f),c),a[f]={low:p,lim:u++}}return e.forEach(o.children(),c),a}return mv}var gv,rN;function NF(){if(rN)return gv;rN=1;var e=mt(),t=ln();gv={run:r,cleanup:u};function r(c){var f=t.addDummyNode(c,"root",{},"_root"),p=o(c),d=e.max(e.values(p))-1,g=2*d+1;c.graph().nestingRoot=f,e.forEach(c.edges(),function(w){c.edge(w).minlen*=g});var y=a(c)+1;e.forEach(c.children(),function(w){i(c,f,g,y,d,p,w)}),c.graph().nodeRankFactor=g}function i(c,f,p,d,g,y,w){var E=c.children(w);if(!E.length){w!==f&&c.setEdge(f,w,{weight:0,minlen:p});return}var _=t.addBorderNode(c,"_bt"),b=t.addBorderNode(c,"_bb"),k=c.node(w);c.setParent(_,w),k.borderTop=_,c.setParent(b,w),k.borderBottom=b,e.forEach(E,function(S){i(c,f,p,d,g,y,S);var N=c.node(S),T=N.borderTop?N.borderTop:S,A=N.borderBottom?N.borderBottom:S,L=N.borderTop?d:2*d,P=T!==A?1:g-y[w]+1;c.setEdge(_,T,{weight:L,minlen:P,nestingEdge:!0}),c.setEdge(A,b,{weight:L,minlen:P,nestingEdge:!0})}),c.parent(w)||c.setEdge(f,_,{weight:0,minlen:g+y[w]})}function o(c){var f={};function p(d,g){var y=c.children(d);y&&y.length&&e.forEach(y,function(w){p(w,g+1)}),f[d]=g}return e.forEach(c.children(),function(d){p(d,1)}),f}function a(c){return e.reduce(c.edges(),function(f,p){return f+c.edge(p).weight},0)}function u(c){var f=c.graph();c.removeNode(f.nestingRoot),delete f.nestingRoot,e.forEach(c.edges(),function(p){var d=c.edge(p);d.nestingEdge&&c.removeEdge(p)})}return gv}var vv,sN;function CF(){if(sN)return vv;sN=1;var e=mt(),t=ln();vv=r;function r(o){function a(u){var c=o.children(u),f=o.node(u);if(c.length&&e.forEach(c,a),e.has(f,"minRank")){f.borderLeft=[],f.borderRight=[];for(var p=f.minRank,d=f.maxRank+1;p<d;++p)i(o,"borderLeft","_bl",u,f,p),i(o,"borderRight","_br",u,f,p)}}e.forEach(o.children(),a)}function i(o,a,u,c,f,p){var d={width:0,height:0,rank:p,borderType:a},g=f[a][p-1],y=t.addDummyNode(o,"border",d,u);f[a][p]=y,o.setParent(y,c),g&&o.setEdge(g,y,{weight:1})}return vv}var yv,iN;function jF(){if(iN)return yv;iN=1;var e=mt();yv={adjust:t,undo:r};function t(p){var d=p.graph().rankdir.toLowerCase();(d==="lr"||d==="rl")&&i(p)}function r(p){var d=p.graph().rankdir.toLowerCase();(d==="bt"||d==="rl")&&a(p),(d==="lr"||d==="rl")&&(c(p),i(p))}function i(p){e.forEach(p.nodes(),function(d){o(p.node(d))}),e.forEach(p.edges(),function(d){o(p.edge(d))})}function o(p){var d=p.width;p.width=p.height,p.height=d}function a(p){e.forEach(p.nodes(),function(d){u(p.node(d))}),e.forEach(p.edges(),function(d){var g=p.edge(d);e.forEach(g.points,u),e.has(g,"y")&&u(g)})}function u(p){p.y=-p.y}function c(p){e.forEach(p.nodes(),function(d){f(p.node(d))}),e.forEach(p.edges(),function(d){var g=p.edge(d);e.forEach(g.points,f),e.has(g,"x")&&f(g)})}function f(p){var d=p.x;p.x=p.y,p.y=d}return yv}var wv,oN;function TF(){if(oN)return wv;oN=1;var e=mt();wv=t;function t(r){var i={},o=e.filter(r.nodes(),function(p){return!r.children(p).length}),a=e.max(e.map(o,function(p){return r.node(p).rank})),u=e.map(e.range(a+1),function(){return[]});function c(p){if(!e.has(i,p)){i[p]=!0;var d=r.node(p);u[d.rank].push(p),e.forEach(r.successors(p),c)}}var f=e.sortBy(o,function(p){return r.node(p).rank});return e.forEach(f,c),u}return wv}var xv,aN;function RF(){if(aN)return xv;aN=1;var e=mt();xv=t;function t(i,o){for(var a=0,u=1;u<o.length;++u)a+=r(i,o[u-1],o[u]);return a}function r(i,o,a){for(var u=e.zipObject(a,e.map(a,function(y,w){return w})),c=e.flatten(e.map(o,function(y){return e.sortBy(e.map(i.outEdges(y),function(w){return{pos:u[w.w],weight:i.edge(w).weight}}),"pos")}),!0),f=1;f<a.length;)f<<=1;var p=2*f-1;f-=1;var d=e.map(new Array(p),function(){return 0}),g=0;return e.forEach(c.forEach(function(y){var w=y.pos+f;d[w]+=y.weight;for(var E=0;w>0;)w%2&&(E+=d[w+1]),w=w-1>>1,d[w]+=y.weight;g+=y.weight*E})),g}return xv}var _v,lN;function AF(){if(lN)return _v;lN=1;var e=mt();_v=t;function t(r,i){return e.map(i,function(o){var a=r.inEdges(o);if(a.length){var u=e.reduce(a,function(c,f){var p=r.edge(f),d=r.node(f.v);return{sum:c.sum+p.weight*d.order,weight:c.weight+p.weight}},{sum:0,weight:0});return{v:o,barycenter:u.sum/u.weight,weight:u.weight}}else return{v:o}})}return _v}var bv,uN;function IF(){if(uN)return bv;uN=1;var e=mt();bv=t;function t(o,a){var u={};e.forEach(o,function(f,p){var d=u[f.v]={indegree:0,in:[],out:[],vs:[f.v],i:p};e.isUndefined(f.barycenter)||(d.barycenter=f.barycenter,d.weight=f.weight)}),e.forEach(a.edges(),function(f){var p=u[f.v],d=u[f.w];!e.isUndefined(p)&&!e.isUndefined(d)&&(d.indegree++,p.out.push(u[f.w]))});var c=e.filter(u,function(f){return!f.indegree});return r(c)}function r(o){var a=[];function u(p){return function(d){d.merged||(e.isUndefined(d.barycenter)||e.isUndefined(p.barycenter)||d.barycenter>=p.barycenter)&&i(p,d)}}function c(p){return function(d){d.in.push(p),--d.indegree===0&&o.push(d)}}for(;o.length;){var f=o.pop();a.push(f),e.forEach(f.in.reverse(),u(f)),e.forEach(f.out,c(f))}return e.map(e.filter(a,function(p){return!p.merged}),function(p){return e.pick(p,["vs","i","barycenter","weight"])})}function i(o,a){var u=0,c=0;o.weight&&(u+=o.barycenter*o.weight,c+=o.weight),a.weight&&(u+=a.barycenter*a.weight,c+=a.weight),o.vs=a.vs.concat(o.vs),o.barycenter=u/c,o.weight=c,o.i=Math.min(a.i,o.i),a.merged=!0}return bv}var kv,cN;function MF(){if(cN)return kv;cN=1;var e=mt(),t=ln();kv=r;function r(a,u){var c=t.partition(a,function(_){return e.has(_,"barycenter")}),f=c.lhs,p=e.sortBy(c.rhs,function(_){return-_.i}),d=[],g=0,y=0,w=0;f.sort(o(!!u)),w=i(d,p,w),e.forEach(f,function(_){w+=_.vs.length,d.push(_.vs),g+=_.barycenter*_.weight,y+=_.weight,w=i(d,p,w)});var E={vs:e.flatten(d,!0)};return y&&(E.barycenter=g/y,E.weight=y),E}function i(a,u,c){for(var f;u.length&&(f=e.last(u)).i<=c;)u.pop(),a.push(f.vs),c++;return c}function o(a){return function(u,c){return u.barycenter<c.barycenter?-1:u.barycenter>c.barycenter?1:a?c.i-u.i:u.i-c.i}}return kv}var Sv,dN;function OF(){if(dN)return Sv;dN=1;var e=mt(),t=AF(),r=IF(),i=MF();Sv=o;function o(c,f,p,d){var g=c.children(f),y=c.node(f),w=y?y.borderLeft:void 0,E=y?y.borderRight:void 0,_={};w&&(g=e.filter(g,function(A){return A!==w&&A!==E}));var b=t(c,g);e.forEach(b,function(A){if(c.children(A.v).length){var L=o(c,A.v,p,d);_[A.v]=L,e.has(L,"barycenter")&&u(A,L)}});var k=r(b,p);a(k,_);var S=i(k,d);if(w&&(S.vs=e.flatten([w,S.vs,E],!0),c.predecessors(w).length)){var N=c.node(c.predecessors(w)[0]),T=c.node(c.predecessors(E)[0]);e.has(S,"barycenter")||(S.barycenter=0,S.weight=0),S.barycenter=(S.barycenter*S.weight+N.order+T.order)/(S.weight+2),S.weight+=2}return S}function a(c,f){e.forEach(c,function(p){p.vs=e.flatten(p.vs.map(function(d){return f[d]?f[d].vs:d}),!0)})}function u(c,f){e.isUndefined(c.barycenter)?(c.barycenter=f.barycenter,c.weight=f.weight):(c.barycenter=(c.barycenter*c.weight+f.barycenter*f.weight)/(c.weight+f.weight),c.weight+=f.weight)}return Sv}var Ev,fN;function PF(){if(fN)return Ev;fN=1;var e=mt(),t=rr().Graph;Ev=r;function r(o,a,u){var c=i(o),f=new t({compound:!0}).setGraph({root:c}).setDefaultNodeLabel(function(p){return o.node(p)});return e.forEach(o.nodes(),function(p){var d=o.node(p),g=o.parent(p);(d.rank===a||d.minRank<=a&&a<=d.maxRank)&&(f.setNode(p),f.setParent(p,g||c),e.forEach(o[u](p),function(y){var w=y.v===p?y.w:y.v,E=f.edge(w,p),_=e.isUndefined(E)?0:E.weight;f.setEdge(w,p,{weight:o.edge(y).weight+_})}),e.has(d,"minRank")&&f.setNode(p,{borderLeft:d.borderLeft[a],borderRight:d.borderRight[a]}))}),f}function i(o){for(var a;o.hasNode(a=e.uniqueId("_root")););return a}return Ev}var Nv,hN;function LF(){if(hN)return Nv;hN=1;var e=mt();Nv=t;function t(r,i,o){var a={},u;e.forEach(o,function(c){for(var f=r.parent(c),p,d;f;){if(p=r.parent(f),p?(d=a[p],a[p]=f):(d=u,u=f),d&&d!==f){i.setEdge(d,f);return}f=p}})}return Nv}var Cv,pN;function $F(){if(pN)return Cv;pN=1;var e=mt(),t=TF(),r=RF(),i=OF(),o=PF(),a=LF(),u=rr().Graph,c=ln();Cv=f;function f(y){var w=c.maxRank(y),E=p(y,e.range(1,w+1),"inEdges"),_=p(y,e.range(w-1,-1,-1),"outEdges"),b=t(y);g(y,b);for(var k=Number.POSITIVE_INFINITY,S,N=0,T=0;T<4;++N,++T){d(N%2?E:_,N%4>=2),b=c.buildLayerMatrix(y);var A=r(y,b);A<k&&(T=0,S=e.cloneDeep(b),k=A)}g(y,S)}function p(y,w,E){return e.map(w,function(_){return o(y,_,E)})}function d(y,w){var E=new u;e.forEach(y,function(_){var b=_.graph().root,k=i(_,b,E,w);e.forEach(k.vs,function(S,N){_.node(S).order=N}),a(_,E,k.vs)})}function g(y,w){e.forEach(w,function(E){e.forEach(E,function(_,b){y.node(_).order=b})})}return Cv}var jv,mN;function qF(){if(mN)return jv;mN=1;var e=mt(),t=rr().Graph,r=ln();jv={positionX:E,findType1Conflicts:i,findType2Conflicts:o,addConflict:u,hasConflict:c,verticalAlignment:f,horizontalCompaction:p,alignCoordinates:y,findSmallestWidthAlignment:g,balance:w};function i(k,S){var N={};function T(A,L){var P=0,U=0,O=A.length,M=e.last(L);return e.forEach(L,function(q,V){var Q=a(k,q),j=Q?k.node(Q).order:O;(Q||q===M)&&(e.forEach(L.slice(U,V+1),function(G){e.forEach(k.predecessors(G),function(z){var te=k.node(z),J=te.order;(J<P||j<J)&&!(te.dummy&&k.node(G).dummy)&&u(N,z,G)})}),U=V+1,P=j)}),L}return e.reduce(S,T),N}function o(k,S){var N={};function T(L,P,U,O,M){var q;e.forEach(e.range(P,U),function(V){q=L[V],k.node(q).dummy&&e.forEach(k.predecessors(q),function(Q){var j=k.node(Q);j.dummy&&(j.order<O||j.order>M)&&u(N,Q,q)})})}function A(L,P){var U=-1,O,M=0;return e.forEach(P,function(q,V){if(k.node(q).dummy==="border"){var Q=k.predecessors(q);Q.length&&(O=k.node(Q[0]).order,T(P,M,V,U,O),M=V,U=O)}T(P,M,P.length,O,L.length)}),P}return e.reduce(S,A),N}function a(k,S){if(k.node(S).dummy)return e.find(k.predecessors(S),function(N){return k.node(N).dummy})}function u(k,S,N){if(S>N){var T=S;S=N,N=T}var A=k[S];A||(k[S]=A={}),A[N]=!0}function c(k,S,N){if(S>N){var T=S;S=N,N=T}return e.has(k[S],N)}function f(k,S,N,T){var A={},L={},P={};return e.forEach(S,function(U){e.forEach(U,function(O,M){A[O]=O,L[O]=O,P[O]=M})}),e.forEach(S,function(U){var O=-1;e.forEach(U,function(M){var q=T(M);if(q.length){q=e.sortBy(q,function(z){return P[z]});for(var V=(q.length-1)/2,Q=Math.floor(V),j=Math.ceil(V);Q<=j;++Q){var G=q[Q];L[M]===M&&O<P[G]&&!c(N,M,G)&&(L[G]=M,L[M]=A[M]=A[G],O=P[G])}}})}),{root:A,align:L}}function p(k,S,N,T,A){var L={},P=d(k,S,N,A),U=A?"borderLeft":"borderRight";function O(V,Q){for(var j=P.nodes(),G=j.pop(),z={};G;)z[G]?V(G):(z[G]=!0,j.push(G),j=j.concat(Q(G))),G=j.pop()}function M(V){L[V]=P.inEdges(V).reduce(function(Q,j){return Math.max(Q,L[j.v]+P.edge(j))},0)}function q(V){var Q=P.outEdges(V).reduce(function(G,z){return Math.min(G,L[z.w]-P.edge(z))},Number.POSITIVE_INFINITY),j=k.node(V);Q!==Number.POSITIVE_INFINITY&&j.borderType!==U&&(L[V]=Math.max(L[V],Q))}return O(M,P.predecessors.bind(P)),O(q,P.successors.bind(P)),e.forEach(T,function(V){L[V]=L[N[V]]}),L}function d(k,S,N,T){var A=new t,L=k.graph(),P=_(L.nodesep,L.edgesep,T);return e.forEach(S,function(U){var O;e.forEach(U,function(M){var q=N[M];if(A.setNode(q),O){var V=N[O],Q=A.edge(V,q);A.setEdge(V,q,Math.max(P(k,M,O),Q||0))}O=M})}),A}function g(k,S){return e.minBy(e.values(S),function(N){var T=Number.NEGATIVE_INFINITY,A=Number.POSITIVE_INFINITY;return e.forIn(N,function(L,P){var U=b(k,P)/2;T=Math.max(L+U,T),A=Math.min(L-U,A)}),T-A})}function y(k,S){var N=e.values(S),T=e.min(N),A=e.max(N);e.forEach(["u","d"],function(L){e.forEach(["l","r"],function(P){var U=L+P,O=k[U],M;if(O!==S){var q=e.values(O);M=P==="l"?T-e.min(q):A-e.max(q),M&&(k[U]=e.mapValues(O,function(V){return V+M}))}})})}function w(k,S){return e.mapValues(k.ul,function(N,T){if(S)return k[S.toLowerCase()][T];var A=e.sortBy(e.map(k,T));return(A[1]+A[2])/2})}function E(k){var S=r.buildLayerMatrix(k),N=e.merge(i(k,S),o(k,S)),T={},A;e.forEach(["u","d"],function(P){A=P==="u"?S:e.values(S).reverse(),e.forEach(["l","r"],function(U){U==="r"&&(A=e.map(A,function(V){return e.values(V).reverse()}));var O=(P==="u"?k.predecessors:k.successors).bind(k),M=f(k,A,N,O),q=p(k,A,M.root,M.align,U==="r");U==="r"&&(q=e.mapValues(q,function(V){return-V})),T[P+U]=q})});var L=g(k,T);return y(T,L),w(T,k.graph().align)}function _(k,S,N){return function(T,A,L){var P=T.node(A),U=T.node(L),O=0,M;if(O+=P.width/2,e.has(P,"labelpos"))switch(P.labelpos.toLowerCase()){case"l":M=-P.width/2;break;case"r":M=P.width/2;break}if(M&&(O+=N?M:-M),M=0,O+=(P.dummy?S:k)/2,O+=(U.dummy?S:k)/2,O+=U.width/2,e.has(U,"labelpos"))switch(U.labelpos.toLowerCase()){case"l":M=U.width/2;break;case"r":M=-U.width/2;break}return M&&(O+=N?M:-M),M=0,O}}function b(k,S){return k.node(S).width}return jv}var Tv,gN;function DF(){if(gN)return Tv;gN=1;var e=mt(),t=ln(),r=qF().positionX;Tv=i;function i(a){a=t.asNonCompoundGraph(a),o(a),e.forEach(r(a),function(u,c){a.node(c).x=u})}function o(a){var u=t.buildLayerMatrix(a),c=a.graph().ranksep,f=0;e.forEach(u,function(p){var d=e.max(e.map(p,function(g){return a.node(g).height}));e.forEach(p,function(g){a.node(g).y=f+d/2}),f+=d+c})}return Tv}var Rv,vN;function FF(){if(vN)return Rv;vN=1;var e=mt(),t=_F(),r=bF(),i=SF(),o=ln().normalizeRanks,a=EF(),u=ln().removeEmptyRanks,c=NF(),f=CF(),p=jF(),d=$F(),g=DF(),y=ln(),w=rr().Graph;Rv=E;function E(F,Z){var ne=Z&&Z.debugTiming?y.time:y.notime;ne("layout",function(){var B=ne(" buildLayoutGraph",function(){return O(F)});ne(" runLayout",function(){_(B,ne)}),ne(" updateInputGraph",function(){b(F,B)})})}function _(F,Z){Z(" makeSpaceForEdgeLabels",function(){M(F)}),Z(" removeSelfEdges",function(){$(F)}),Z(" acyclic",function(){t.run(F)}),Z(" nestingGraph.run",function(){c.run(F)}),Z(" rank",function(){i(y.asNonCompoundGraph(F))}),Z(" injectEdgeLabelProxies",function(){q(F)}),Z(" removeEmptyRanks",function(){u(F)}),Z(" nestingGraph.cleanup",function(){c.cleanup(F)}),Z(" normalizeRanks",function(){o(F)}),Z(" assignRankMinMax",function(){V(F)}),Z(" removeEdgeLabelProxies",function(){Q(F)}),Z(" normalize.run",function(){r.run(F)}),Z(" parentDummyChains",function(){a(F)}),Z(" addBorderSegments",function(){f(F)}),Z(" order",function(){d(F)}),Z(" insertSelfEdges",function(){W(F)}),Z(" adjustCoordinateSystem",function(){p.adjust(F)}),Z(" position",function(){g(F)}),Z(" positionSelfEdges",function(){I(F)}),Z(" removeBorderNodes",function(){J(F)}),Z(" normalize.undo",function(){r.undo(F)}),Z(" fixupEdgeLabelCoords",function(){z(F)}),Z(" undoCoordinateSystem",function(){p.undo(F)}),Z(" translateGraph",function(){j(F)}),Z(" assignNodeIntersects",function(){G(F)}),Z(" reversePoints",function(){te(F)}),Z(" acyclic.undo",function(){t.undo(F)})}function b(F,Z){e.forEach(F.nodes(),function(ne){var B=F.node(ne),de=Z.node(ne);B&&(B.x=de.x,B.y=de.y,Z.children(ne).length&&(B.width=de.width,B.height=de.height))}),e.forEach(F.edges(),function(ne){var B=F.edge(ne),de=Z.edge(ne);B.points=de.points,e.has(de,"x")&&(B.x=de.x,B.y=de.y)}),F.graph().width=Z.graph().width,F.graph().height=Z.graph().height}var k=["nodesep","edgesep","ranksep","marginx","marginy"],S={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},N=["acyclicer","ranker","rankdir","align"],T=["width","height"],A={width:0,height:0},L=["minlen","weight","width","height","labeloffset"],P={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},U=["labelpos"];function O(F){var Z=new w({multigraph:!0,compound:!0}),ne=ue(F.graph());return Z.setGraph(e.merge({},S,Y(ne,k),e.pick(ne,N))),e.forEach(F.nodes(),function(B){var de=ue(F.node(B));Z.setNode(B,e.defaults(Y(de,T),A)),Z.setParent(B,F.parent(B))}),e.forEach(F.edges(),function(B){var de=ue(F.edge(B));Z.setEdge(B,e.merge({},P,Y(de,L),e.pick(de,U)))}),Z}function M(F){var Z=F.graph();Z.ranksep/=2,e.forEach(F.edges(),function(ne){var B=F.edge(ne);B.minlen*=2,B.labelpos.toLowerCase()!=="c"&&(Z.rankdir==="TB"||Z.rankdir==="BT"?B.width+=B.labeloffset:B.height+=B.labeloffset)})}function q(F){e.forEach(F.edges(),function(Z){var ne=F.edge(Z);if(ne.width&&ne.height){var B=F.node(Z.v),de=F.node(Z.w),pe={rank:(de.rank-B.rank)/2+B.rank,e:Z};y.addDummyNode(F,"edge-proxy",pe,"_ep")}})}function V(F){var Z=0;e.forEach(F.nodes(),function(ne){var B=F.node(ne);B.borderTop&&(B.minRank=F.node(B.borderTop).rank,B.maxRank=F.node(B.borderBottom).rank,Z=e.max(Z,B.maxRank))}),F.graph().maxRank=Z}function Q(F){e.forEach(F.nodes(),function(Z){var ne=F.node(Z);ne.dummy==="edge-proxy"&&(F.edge(ne.e).labelRank=ne.rank,F.removeNode(Z))})}function j(F){var Z=Number.POSITIVE_INFINITY,ne=0,B=Number.POSITIVE_INFINITY,de=0,pe=F.graph(),ye=pe.marginx||0,Pe=pe.marginy||0;function Ue(De){var Me=De.x,_e=De.y,Fe=De.width,we=De.height;Z=Math.min(Z,Me-Fe/2),ne=Math.max(ne,Me+Fe/2),B=Math.min(B,_e-we/2),de=Math.max(de,_e+we/2)}e.forEach(F.nodes(),function(De){Ue(F.node(De))}),e.forEach(F.edges(),function(De){var Me=F.edge(De);e.has(Me,"x")&&Ue(Me)}),Z-=ye,B-=Pe,e.forEach(F.nodes(),function(De){var Me=F.node(De);Me.x-=Z,Me.y-=B}),e.forEach(F.edges(),function(De){var Me=F.edge(De);e.forEach(Me.points,function(_e){_e.x-=Z,_e.y-=B}),e.has(Me,"x")&&(Me.x-=Z),e.has(Me,"y")&&(Me.y-=B)}),pe.width=ne-Z+ye,pe.height=de-B+Pe}function G(F){e.forEach(F.edges(),function(Z){var ne=F.edge(Z),B=F.node(Z.v),de=F.node(Z.w),pe,ye;ne.points?(pe=ne.points[0],ye=ne.points[ne.points.length-1]):(ne.points=[],pe=de,ye=B),ne.points.unshift(y.intersectRect(B,pe)),ne.points.push(y.intersectRect(de,ye))})}function z(F){e.forEach(F.edges(),function(Z){var ne=F.edge(Z);if(e.has(ne,"x"))switch((ne.labelpos==="l"||ne.labelpos==="r")&&(ne.width-=ne.labeloffset),ne.labelpos){case"l":ne.x-=ne.width/2+ne.labeloffset;break;case"r":ne.x+=ne.width/2+ne.labeloffset;break}})}function te(F){e.forEach(F.edges(),function(Z){var ne=F.edge(Z);ne.reversed&&ne.points.reverse()})}function J(F){e.forEach(F.nodes(),function(Z){if(F.children(Z).length){var ne=F.node(Z),B=F.node(ne.borderTop),de=F.node(ne.borderBottom),pe=F.node(e.last(ne.borderLeft)),ye=F.node(e.last(ne.borderRight));ne.width=Math.abs(ye.x-pe.x),ne.height=Math.abs(de.y-B.y),ne.x=pe.x+ne.width/2,ne.y=B.y+ne.height/2}}),e.forEach(F.nodes(),function(Z){F.node(Z).dummy==="border"&&F.removeNode(Z)})}function $(F){e.forEach(F.edges(),function(Z){if(Z.v===Z.w){var ne=F.node(Z.v);ne.selfEdges||(ne.selfEdges=[]),ne.selfEdges.push({e:Z,label:F.edge(Z)}),F.removeEdge(Z)}})}function W(F){var Z=y.buildLayerMatrix(F);e.forEach(Z,function(ne){var B=0;e.forEach(ne,function(de,pe){var ye=F.node(de);ye.order=pe+B,e.forEach(ye.selfEdges,function(Pe){y.addDummyNode(F,"selfedge",{width:Pe.label.width,height:Pe.label.height,rank:ye.rank,order:pe+ ++B,e:Pe.e,label:Pe.label},"_se")}),delete ye.selfEdges})})}function I(F){e.forEach(F.nodes(),function(Z){var ne=F.node(Z);if(ne.dummy==="selfedge"){var B=F.node(ne.e.v),de=B.x+B.width/2,pe=B.y,ye=ne.x-de,Pe=B.height/2;F.setEdge(ne.e,ne.label),F.removeNode(Z),ne.label.points=[{x:de+2*ye/3,y:pe-Pe},{x:de+5*ye/6,y:pe-Pe},{x:de+ye,y:pe},{x:de+5*ye/6,y:pe+Pe},{x:de+2*ye/3,y:pe+Pe}],ne.label.x=ne.x,ne.label.y=ne.y}})}function Y(F,Z){return e.mapValues(e.pick(F,Z),Number)}function ue(F){var Z={};return e.forEach(F,function(ne,B){Z[B.toLowerCase()]=ne}),Z}return Rv}var Av,yN;function zF(){if(yN)return Av;yN=1;var e=mt(),t=ln(),r=rr().Graph;Av={debugOrdering:i};function i(o){var a=t.buildLayerMatrix(o),u=new r({compound:!0,multigraph:!0}).setGraph({});return e.forEach(o.nodes(),function(c){u.setNode(c,{label:c}),u.setParent(c,"layer"+o.node(c).rank)}),e.forEach(o.edges(),function(c){u.setEdge(c.v,c.w,{},c.name)}),e.forEach(a,function(c,f){var p="layer"+f;u.setNode(p,{rank:"same"}),e.reduce(c,function(d,g){return u.setEdge(d,g,{style:"invis"}),g})}),u}return Av}var Iv,wN;function BF(){return wN||(wN=1,Iv="0.8.5"),Iv}var Mv,xN;function UF(){return xN||(xN=1,Mv={graphlib:rr(),layout:FF(),debug:zF(),util:{time:ln().time,notime:ln().notime},version:BF()}),Mv}var HF=UF();const _N=dy(HF),Eo=240,Hu=130,wo=74,yc=72,bN=wo+yc;function WF(e,t){var i;let r=Eo;for(const o of e)r=Math.max(r,((i=t.get(o.id))==null?void 0:i.width)??Eo);return r}const qT=420,VF=2;function qa(e){var r;return((r=e.data)==null?void 0:r.sessionId)??"_default"}function GF(e,t){return((t==null?void 0:t.get(e))??0)>0?qT:0}function YF(e,t){const r=(t==null?void 0:t.get(e))??0;return r>0?6+r*36:0}function Da(e,t,r){const i=t.get(e);return{w:((i==null?void 0:i.width)??Eo)+GF(e,r),h:Math.max((i==null?void 0:i.height)??Hu,YF(e,r))}}function KF(e){return[...e.keys()].sort().map(t=>`${t}:${e.get(t)}`).join("|")}function XF(e,t,r,i,o,a){const u=new _N.graphlib.Graph;u.setDefaultEdgeLabel(()=>({})),u.setGraph({rankdir:r,marginx:0,marginy:0,nodesep:70,ranksep:160,edgesep:30});const c=e.filter(k=>!o.has(k)),f=new Set(c);for(const k of c){const{w:S,h:N}=Da(k,i,a);u.setNode(k,{width:S,height:N})}for(const k of t)f.has(k.source)&&f.has(k.target)&&u.setEdge(k.source,k.target);_N.layout(u);const p=new Map;let d=1/0,g=1/0,y=-1/0,w=-1/0;for(const k of c){const S=u.node(k);if(!S)continue;const N=i.get(k),T=(N==null?void 0:N.width)??Eo,A=(N==null?void 0:N.height)??Hu,L=Da(k,i,a),P=S.x-L.w/2,U=S.y-L.h/2;p.set(k,{x:P,y:U}),P<d&&(d=P),U<g&&(g=U),P+T>y&&(y=P+T),U+A>w&&(w=U+A)}if(Number.isFinite(d)&&Number.isFinite(g))for(const[k,S]of p)p.set(k,{x:S.x-d,y:S.y-g});const E=Number.isFinite(y)?y-d:0,_=Number.isFinite(w)?w-g:0;let b=null;for(const k of e){const S=o.get(k);if(!S)continue;const N=i.get(k),T=(N==null?void 0:N.width)??Eo,A=(N==null?void 0:N.height)??Hu;b=b===null?{minX:S.x,minY:S.y,maxX:S.x+T,maxY:S.y+A}:{minX:Math.min(b.minX,S.x),minY:Math.min(b.minY,S.y),maxX:Math.max(b.maxX,S.x+T),maxY:Math.max(b.maxY,S.y+A)}}return{positions:p,width:E,height:_,pinnedBox:b}}function QF(e,t,r={}){const i=r.direction??"LR",o=r.pinned??new Map,a=r.measured??new Map,u=r.lanes,c=new Map;for(const k of e){const S=qa(k),N=c.get(S);N?N.push(k.id):c.set(S,[k.id])}const p=Array.from(c.keys()).sort().map(k=>({sid:k,...XF(c.get(k),t,i,a,o,u)})),d=WF(e,a),g=r.availableHeight&&r.availableHeight>0?r.availableHeight:Number.POSITIVE_INFINITY,y=k=>{const S=[[]];let N=0;for(const T of p)S.length<k&&N>0&&N+T.height>g&&(S.push([]),N=0),S[S.length-1].push(T),N+=T.height+bN;return S},w=k=>k.reduce((S,N)=>Math.max(S,N.width),0)+qT;let E=y(r.availableWidth?VF:1);E.length>1&&E.reduce((S,N)=>S+w(N),0)+d*(E.length-1)>(r.availableWidth??0)&&(E=y(1));const _=new Map;let b=0;for(const k of E){const S=w(k);let N=0;for(const{positions:T,height:A,pinnedBox:L}of k){for(const[U,O]of T)_.set(U,{x:O.x+b,y:O.y+N});let P=N+A;L&&L.maxY>P&&L.minX<b+S&&b<L.maxX&&(P=L.maxY),N=P+bN}b+=S+d}return e.map(k=>{const S=o.get(k.id);if(S)return{...k,position:S};const N=_.get(k.id);return N?{...k,position:N}:k})}function ZF(e,t,r,i,o){const u=wo+yc,c=60,f=w=>Da(w,i,o),p=new Map(e.map(w=>[w.id,qa(w)])),d=[],g=e.map(w=>({id:w.id,pos:r.get(w.id)??t.get(w.id)})).filter(w=>w.pos!=null).sort((w,E)=>w.pos.y-E.pos.y||w.pos.x-E.pos.x||w.id.localeCompare(E.id)),y=[];for(const{id:w,pos:E}of g){const{w:_,h:b}=f(w),k=p.get(w)??"_default";if(r.has(w)){d.push({x:E.x,y:E.y,w:_,h:b,sid:k});continue}let S=E.y;for(let N=0;N<d.length+1;N++){const T=d.find(A=>{const L=A.sid===k?24:c,P=A.sid===k?24:u;return E.x<A.x+A.w+L&&A.x<E.x+_+L&&S<A.y+A.h+P&&A.y<S+b+P});if(!T)break;S=T.y+T.h+(T.sid===k?24:u)}S!==E.y&&(t.set(w,{x:E.x,y:S}),y.push(w)),d.push({x:E.x,y:S,w:_,h:b,sid:k})}return y}function JF(e,t,r,i,o,a){const u=_=>Da(_,i,a),c=_=>r.get(_)??t.get(_),f=new Map;for(const _ of e){if(!c(_.id))continue;const b=qa(_),k=f.get(b);k?k.push(_):f.set(b,[_])}const p=new Set;for(const[_,b]of f)b.every(k=>o.has(k.id)&&!r.has(k.id))&&p.add(_);const d=new Map,g=[];for(const _ of e){const b=c(_.id);if(!b)continue;const{w:k,h:S}=u(_.id),N=qa(_);p.has(N)?(d.get(N)??d.set(N,[]).get(N)).push(_):g.push({x:b.x,y:b.y,w:k,h:S})}if(d.size===0)return[];const y=wo+yc,w=(_,b,k,S)=>g.some(N=>_<N.x+N.w+wo&&N.x<_+k+wo&&b<N.y+N.h+y&&N.y<b+S+y),E=[];for(const _ of[...d.keys()].sort()){const b=d.get(_);let k=1/0,S=1/0,N=-1/0,T=-1/0;for(const q of b){const V=c(q.id),{w:Q,h:j}=u(q.id);k=Math.min(k,V.x),S=Math.min(S,V.y),N=Math.max(N,V.x+Q),T=Math.max(T,V.y+j)}const A=N-k,L=T-S,P=[...new Set(g.map(q=>Math.round(q.x)))].sort((q,V)=>q-V),U=P.length?P:[k],O=[0,...g.map(q=>q.y+q.h+y)].sort((q,V)=>q-V);let M=null;e:for(const q of U)for(const V of O){if(V>=S)break;if(!w(q,V,A,L)){M={x:q,y:V};break e}}if(M){const q=M.x-k,V=M.y-S;for(const Q of b){const j=c(Q.id);t.set(Q.id,{x:j.x+q,y:j.y+V})}E.push(_)}for(const q of b){const V=c(q.id),{w:Q,h:j}=u(q.id);g.push({x:V.x,y:V.y,w:Q,h:j})}}return E}function ez(e,t,r,i,o,a=!1,u){const p=wo+yc+1,d=8,g=1.75,y=200,w=.7,E=.01,_=M=>Da(M,i,u),b=M=>r.get(M)??t.get(M),k=new Map;for(const M of e){if(!b(M.id))continue;const q=qa(M),V=k.get(q);V?V.push(M):k.set(q,[M])}const S=[],N=new Set,T=new Set,A=o.size===0;for(const M of[...k.keys()].sort()){const q=k.get(M);let V=1/0,Q=1/0,j=-1/0,G=-1/0,z=!1;for(const W of q){const I=b(W.id),{w:Y,h:ue}=_(W.id);V=Math.min(V,I.x),Q=Math.min(Q,I.y),j=Math.max(j,I.x+Y),G=Math.max(G,I.y+ue),r.has(W.id)&&(z=!0)}const te=j-V,J=G-Q;T.add(M);const $=o.get(M);$&&(te>$.w+d||J>$.h+d)&&N.add(M),o.set(M,{w:te,h:J}),S.push({sid:M,members:q.map(W=>W.id),x:V,y:Q,w:te,h:J,anchored:z,mass:1})}for(const M of[...o.keys()])T.has(M)||o.delete(M);if(a||A)return[];let L=!1;for(let M=0;M<S.length&&!L;M++)for(let q=M+1;q<S.length;q++){const V=S[M],Q=S[q];if(!(V.anchored&&Q.anchored)&&Math.abs(V.x+V.w/2-(Q.x+Q.w/2))<(V.w+Q.w)/2+61&&Math.abs(V.y+V.h/2-(Q.y+Q.h/2))<(V.h+Q.h)/2+p){L=!0;break}}if(N.size===0&&!L)return[];if(N.size>0)for(const M of S)N.has(M.sid)&&(M.mass=8);else for(const M of S)M.mass=Math.max(1,M.w*M.h/(Eo*Hu));const P=new Map(S.map(M=>[M.sid,M.x])),U=new Map(S.map(M=>[M.sid,M.y]));for(let M=0;M<y;M++){const q=new Map,V=new Map;let Q=0;for(let j=0;j<S.length;j++)for(let G=j+1;G<S.length;G++){const z=S[j],te=S[G];if(z.anchored&&te.anchored)continue;const J=z.x+z.w/2,$=z.y+z.h/2,W=te.x+te.w/2,I=te.y+te.h/2,Y=(z.w+te.w)/2+61-Math.abs(J-W),ue=(z.h+te.h)/2+p-Math.abs($-I);if(Y<=0||ue<=0)continue;const F=(Be,Ze)=>!Be.anchored&&!(Ze<0&&Be.x<=0),Z=(Be,Ze)=>!Be.anchored&&!(Ze<0&&Be.y<=0),ne=(Be,Ze,ut)=>{const _t=Be===Ze,ie=_t?z.sid<te.sid?-1:1:Math.sign(Be-Ze);return ut(z,ie)||ut(te,-ie)?ie:_t&&(ut(z,-ie)||ut(te,ie))?-ie:0},B=ne(J,W,F),de=ne($,I,Z),pe=B!==0,ye=de!==0;if(!pe&&!ye)continue;const Pe=pe&&(!ye||Y*g<ue),[Ue,De,Me,_e]=Pe?[B,Y,q,F]:[de,ue,V,Z],Fe=_e(z,Ue),we=_e(te,-Ue),fe=z.mass,Ke=te.mass,gt=Fe?we?Ke/(fe+Ke):1:0,tt=we?Fe?fe/(fe+Ke):1:0,ot=De*w;Me.set(z.sid,(Me.get(z.sid)??0)+Ue*ot*gt),Me.set(te.sid,(Me.get(te.sid)??0)-Ue*ot*tt),Q+=ot}for(const j of S)j.anchored||(j.x=Math.max(0,j.x+(q.get(j.sid)??0)),j.y=Math.max(0,j.y+(V.get(j.sid)??0)));if(Q<E)break}const O=[];for(const M of S){const q=M.x-P.get(M.sid),V=M.y-U.get(M.sid);if(!(Math.abs(q)<1&&Math.abs(V)<1)){for(const Q of M.members){if(r.has(Q))continue;const j=t.get(Q);j&&t.set(Q,{x:j.x+q,y:j.y+V})}O.push(M.sid)}}return O}const tz=600;function ay(e,t){return!(e.exitAt!=null&&t-e.exitAt>tz||e.kind==="root"&&e.state==="done"&&e.tools.length===0&&e.endedAt!=null&&e.endedAt-e.startedAt<3e3)}function nz(e,t){const r=new Set;for(const i of e.agents.values())ay(i,t)&&r.add(i.id);return r}function rz(e,t,r=0){return e.right+r>t.left&&e.left-r<t.right&&e.bottom+r>t.top&&e.top-r<t.bottom}function sz(e,t,r=0){if(!e)return!1;for(const i of t)if(rz(e,i,r))return!0;return!1}const DT="sessionGroup";function iz(e,t){var i;if(e.type===DT)return"transparent";const r=(i=e.data)==null?void 0:i.state;return t(r==="err"?"--err":r==="active"?"--inflight":"--ok")}const FT=["--err","--inflight","--ok","--grid-line","--minimap-mask","--panel","--line"];function kN(e){const t={};for(const r of FT)t[r]=e(r);return t}function oz(e){return t=>e[t]??""}function az(e,t){return FT.every(r=>e[r]===t[r])}function lz(e){const t=new Set(e.pins),r=new Map,i=new Map;for(const[o,a]of e.positions)r.set(o,a),t.has(o)&&i.set(o,a);return{positions:r,pinned:i}}const uz=1200,cz=1e3;function SN(e){return e.lastDeckFitAt>0&&e.at-e.lastDeckFitAt<uz?!1:e.hasSourceEvent?!0:e.lastCanvasInputAt>0&&e.at-e.lastCanvasInputAt<cz}function Ov({durationMs:e,documentHidden:t}){return t?!1:Number.isFinite(e)&&e>0}function dz(e,t,r){const i=e.x*t.zoom+t.x,o=e.y*t.zoom+t.y,a=(e.x+e.width)*t.zoom+t.x,u=(e.y+e.height)*t.zoom+t.y;return a>0&&i<r.width&&u>0&&o<r.height}function fz({pane:e,viewport:t,boxes:r}){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 i=!1;for(const o of r)if(i=!0,dz(o,t,e))return!1;return i}const hz="Update checks are off (AGENTS_DECK_NO_UPDATE_CHECK=1).";function pz(e){if(e.checkDisabled)return hz;if(e.checking)return"Asking npm for the newest release…";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",r=e.checkedAgo?` · checked ${e.checkedAgo}`:"";return`${t}${r} · re-checked periodically · click to check npm now`}function mz(e){const t=`Version v${e.running}`;return e.checkDisabled?`${t}, update checks are off`:e.checking?`${t}, checking npm for a newer release`:`${t}, check npm for a newer release`}function gz(e){const t=e.kind==="restart"?`v${e.to} is installed and waiting for a restart`:`v${e.to} is available on npm`;return`Version v${e.from}, ${t} — ${e.open?"hide":"show"} the notice`}function vz(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 ly={kind:"assumed",claude:!0,codex:!0};function yz(e){if(!e||typeof e!="object")return ly;const t=e.providers;if(!t||typeof t!="object")return ly;const r=t;return{kind:"reported",claude:r.claude!==!1,codex:r.codex!==!1}}const wz={done:[{at:0,hz:740,ms:90},{at:.085,hz:440,ms:150}],"needs-input":[{at:0,hz:440,ms:90},{at:.085,hz:740,ms:150}]},xz=.14,_z={Stop:"done",Notification:"needs-input"};function bz(e,t){var i;if(t)return null;const r=(i=e==null?void 0:e.payload)==null?void 0:i.hook_event_name;return typeof r!="string"?null:_z[r]??null}function kz(e={enabled:()=>!0}){const t=e.ctor??(typeof window<"u"?window.AudioContext??window.webkitAudioContext??null:null);let r=null,i=!1;const o=()=>e.enabled()?i&&(r==null?void 0:r.state)==="running"?"ready":"locked":"off",a=()=>{var f;return(f=e.onState)==null?void 0:f.call(e,o())};function u(){var f;if(!(!t||i))try{r=r??new t,(f=r.resume)==null||f.call(r).then(a,()=>{}),i=!0,a()}catch{}}function c(f){if(!e.enabled()||!r||r.state!=="running")return!1;const p=r.currentTime;for(const d of wz[f]){const g=r.createOscillator(),y=r.createGain();g.type="sine",g.frequency.value=d.hz;const w=p+d.at,E=w+d.ms/1e3;y.gain.setValueAtTime(1e-4,w),y.gain.exponentialRampToValueAtTime(xz,w+.012),y.gain.exponentialRampToValueAtTime(1e-4,E),g.connect(y).connect(r.destination),g.start(w),g.stop(E+.02)}return!0}return{unlock:u,play:c,state:o,get context(){return r}}}function Wu(e){const t=Math.max(0,Math.floor(e));return`${t} event${t===1?"":"s"}`}const EN=99;function Sz(e){const t=Math.max(0,Math.floor(e));return t>EN?`${EN}+`:String(t)}const Ez="Pause the canvas";function Nz(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 — ${Wu(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)":`${Wu(e.held)} arrived while paused and will be applied in order when you resume (Space)`}function Cz(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 zT="paused · full",jz=(e,t)=>t>0?zT:e>0?`paused · ${Sz(e)}`:"paused";function Tz(e){const t=Math.max(0,Math.floor(e.dropped??0));return e.connected?e.paused?{tone:"paused",label:jz(e.held,t),widest:zT,title:t>0?`Connected — the pause is full at ${Wu(e.held)}; the oldest are being dropped as new ones arrive. Resume to catch up (Space)`:e.held>0?`Connected — ${Wu(e.held)} held until you resume (Space)`:"Connected — updates held until you resume (Space)"}:{tone:"live",label:"live",widest:"live",title:"Receiving events"}:{tone:"dead",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 NN(e){return typeof window>"u"?"":getComputedStyle(document.documentElement).getPropertyValue(e).trim()||""}const Rz={agent:o$,sessionGroup:b$},BT="react-flow__node";function CN(e){var t,r;return!!e&&((r=(t=e.classList)==null?void 0:t.contains)==null?void 0:r.call(t,BT))===!0}function Az(e){try{const t=document.querySelector(`.${BT}[data-id="${CSS.escape(e)}"]`);t==null||t.focus({preventScroll:!0})}catch{}}const Iz=["a[href]","button:not(:disabled)","input:not(:disabled)","select:not(:disabled)","textarea:not(:disabled)","summary","[tabindex]"].join(","),Mz=420,ku=18,Oz=200,Pz=5*6e4,Lz=6,$z=2*6e4,jN=400,o0="agent-dag.layout",a0="agent-dag.viewport",UT="agent-dag.summariesDismissed",HT="agent-dag.sessionListOpen",WT="agent-dag.detailOpen",VT="agent-dag.usagePanelOpen",TN="agent-dag.accountsPanelOpen",RN="agent-dag.versionNoticeDismissed",AN="agent-dag.oldNameNoticeDismissed",qz=15*6e4,Pv={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:"},IN="agent-dag.autoRestart",MN="agent-dag.bundleReloadedFor";function Dz(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(HT)==="1"}catch{return!1}}function Fz(e){if(!(typeof window>"u"))try{window.localStorage.setItem(HT,e?"1":"0")}catch{}}function zz(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(WT)==="1"}catch{return!1}}function Bz(e){if(!(typeof window>"u"))try{window.localStorage.setItem(WT,e?"1":"0")}catch{}}function Uz(){const e=qy(VT);return e===null?!0:e==="1"}function Hz(e){if(!(typeof window>"u"))try{window.localStorage.setItem(VT,e?"1":"0")}catch{}}function Wz(){if(typeof window>"u")return new Set;try{const e=window.localStorage.getItem(UT);if(!e)return new Set;const t=JSON.parse(e);return new Set(Array.isArray(t)?t.filter(r=>typeof r=="string"):[])}catch{return new Set}}function ON(e){if(!(typeof window>"u"))try{const t=Array.from(e),r=t.length>200?t.slice(-200):t;window.localStorage.setItem(UT,JSON.stringify(r))}catch{}}function Vz(){const e={positions:[],pins:[]};if(typeof window>"u")return e;try{const t=window.localStorage.getItem(o0);if(!t)return e;const r=JSON.parse(t);if(!("v"in r)){const o=Object.entries(r).filter(([,a])=>a&&typeof a.x=="number"&&typeof a.y=="number");return{positions:o,pins:o.map(([a])=>a)}}return{positions:Object.entries(r.positions??{}).filter(([,o])=>o&&typeof o.x=="number"&&typeof o.y=="number"),pins:Array.isArray(r.pins)?r.pins:[]}}catch{return e}}function Lv(e,t){if(!(typeof window>"u"))try{const r={};for(const[i,o]of e)r[i]=o;for(const[i,o]of t)r[i]=o;window.localStorage.setItem(o0,JSON.stringify({v:2,positions:r,pins:Array.from(t.keys())}))}catch{}}function Gz(){if(typeof window>"u")return null;try{const e=window.localStorage.getItem(a0);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 Yz(e){if(!(typeof window>"u"))try{window.localStorage.setItem(a0,JSON.stringify(e))}catch{}}function PN(){if(!(typeof window>"u")){try{window.localStorage.removeItem(o0)}catch{}try{window.localStorage.removeItem(a0)}catch{}}}function Kz(e,t){const r=e.agents.get(t);if(!r)return;const i=[];for(const d of e.agents.values())d.sessionId===t&&i.push(d);const o={schemaVersion:1,exportedAt:new Date().toISOString(),sessionId:t,label:r.label,cwd:r.cwd,startedAt:r.startedAt,endedAt:r.endedAt,model:r.model,agents:i.map(d=>({id:d.id,kind:d.kind,label:d.label,parentId:d.parentId,state:d.state,startedAt:d.startedAt,endedAt:d.endedAt,model:d.model,cwd:d.cwd,usage:d.usage,prompts:d.prompts,tools:d.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(o,null,2),u=new Blob([a],{type:"application/json"}),c=URL.createObjectURL(u),f=document.createElement("a"),p=(r.label||"session").replace(/[^a-z0-9._-]/gi,"_");f.href=c,f.download=`${Wt}-${p}-${t.slice(0,8)}.json`,document.body.appendChild(f),f.click(),document.body.removeChild(f),setTimeout(()=>URL.revokeObjectURL(c),1e3)}const uy={file:"📁",shell:"⚡",web:"🌐",agent:"🤖",task:"📋",plan:"🧭",mcp:"🔌",other:"✨"},cy={file:"file",shell:"shell",web:"web",agent:"agent",task:"task",plan:"plan",mcp:"mcp",other:"other"},GT=_j;function Xz(e,t,r,i,o,a,u,c,f,p,d,g,y,w,E,_,b,k){const S=[],N=[];for(const M of e.agents.values()){if(!b.has(M.id))continue;const q=M.exitAt!=null,V=_!=null&&!_.has(M.id),Q=[q?"rf-exiting":"",V?"rf-spotlit-out":""].filter(Boolean).join(" ")||void 0,j=a.get(M.id);if(S.push({id:M.id,type:"agent",position:{x:0,y:0},data:{...M,now:t,onOpenContext:k},className:Q,...j?{width:j.width,height:j.height}:null}),M.parentId&&b.has(M.parentId)){const G=Ry(M.sessionId),z=q,te=E.size>0&&(E.has(M.id)||E.has(M.parentId)),J=_!=null&&!_.has(M.id)&&!_.has(M.parentId),$=M.state==="active"?2:1.5,W=te?$+1.5:$,I=z?.2:J?.12:1,Y=["sess-edge",M.state==="active"?"sess-live":"sess-idle",z?"rf-edge-exiting":"",te?"rf-edge-selected":""].filter(Boolean).join(" ");N.push({id:`e:${M.parentId}->${M.id}`,source:M.parentId,target:M.id,animated:(M.state==="active"||te)&&!z,type:"smoothstep",style:{"--session-hue":G,strokeWidth:W,opacity:I,transition:"var(--edge-transition)"},className:Y})}}const T=new Map;for(const M of e.agents.values())M.tools.length>0&&T.set(M.id,Math.min(4,M.tools.length));const A=`${y}#lanes:${KF(T)}`,L=S.filter(M=>tD(M.id,o,d,g));if(L.length>0||A!==w.current){if(L.length>0){const M=QF(S,N,{direction:"LR",pinned:o,measured:a,availableWidth:r,availableHeight:i,lanes:T});for(const q of M)Lj(q.id,d,g)&&rD(q.id,q.position,d,g);JF(S,d,o,a,new Set(L.map(q=>q.id)),T)}ZF(S,d,o,a,T),w.current=A}const P=ez(S,d,o,a,u,!f||p,T);P.length>0&&c(P),wu(d,e.agents),wu(g,e.agents),wu(o,e.agents),wu(a,Zq(e.agents.values()));const U=[];let O=!1;for(const M of S){let q=o.get(M.id)??d.get(M.id);q||(q=nD(M.id,d,g),O=!0),U.push({...M,position:q})}return O&&(w.current=""),{nodes:U,edges:N}}function Qz(){return m.jsx(jy,{children:m.jsx(Zz,{})})}function Zz(){var al,ll,Wo,ul;const e=Ha(),t=Nt(),r=C.useState(Jv)[0],i=C.useRef(r),[,o]=C.useState(0),a=C.useCallback(()=>o(H=>H+1),[]),[u,c]=C.useState(()=>new Set),[f,p]=C.useState(null),[d,g]=C.useState(null),y=C.useCallback((H,K)=>{c(le=>{if(!K)return new Set([H]);const ce=new Set(le);return ce.has(H)?ce.delete(H):ce.add(H),ce}),p(le=>K&&le===H?le:H)},[]),w=C.useCallback(()=>{c(new Set),p(null)},[]),[E,_]=C.useState(null),[b,k]=C.useState(null),S=C.useCallback(H=>k(H),[]),[N,T]=C.useState(!1),[A,L]=C.useState(!1),P=C.useState(Wz)[0],[U,O]=C.useState(Dz);C.useEffect(()=>{Fz(U)},[U]);const[M,q]=C.useState(zz);C.useEffect(()=>{Bz(M)},[M]);const[V,Q]=C.useState(Uz);C.useEffect(()=>{Hz(V)},[V]);const[j,G]=C.useState(()=>{try{const H=window.localStorage.getItem(TN);return H===null?!0:H==="1"}catch{return!0}});C.useEffect(()=>{try{window.localStorage.setItem(TN,j?"1":"0")}catch{}},[j]);const[z,te]=C.useState(null);C.useEffect(()=>{let H=null;try{H=localStorage.getItem("agent-dag.sound")}catch{}te(H===null?!0:H==="on")},[]);const J=C.useCallback(()=>{te(H=>{var le;const K=H!==!0;try{localStorage.setItem("agent-dag.sound",K?"on":"off")}catch{}return K&&((le=Y.current)==null||le.unlock()),K})},[]),$=C.useCallback(H=>{J()},[J]),W=C.useRef($);W.current=$;const I=C.useRef(z);I.current=z;const Y=C.useRef(null),[ue,F]=C.useState("locked");C.useEffect(()=>{const H=kz({enabled:()=>I.current===!0,onState:F});Y.current=H,F(H.state());const K=()=>H.unlock();return window.addEventListener("pointerdown",K,{once:!0,capture:!0}),window.addEventListener("keydown",K,{once:!0,capture:!0}),()=>{window.removeEventListener("pointerdown",K,{capture:!0}),window.removeEventListener("keydown",K,{capture:!0})}},[]);const[Z,ne]=C.useState(!1),[B,de]=C.useState(null),[pe,ye]=C.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(RN)??""}catch{return""}}),[Pe,Ue]=C.useState(!1),De=C.useRef(0),[Me,_e]=C.useState(!1),Fe=C.useCallback((H=!1)=>(H&&(De.current=Date.now(),_e(!0)),fetch(H?"/api/version?refresh=1":"/api/version").then(K=>K.ok?K.json():null).then(K=>{K&&de(K)}).catch(()=>{}).finally(()=>{H&&_e(!1)})),[]),we=C.useCallback(()=>{Fe(Date.now()-De.current>=qz)},[Fe]);C.useEffect(()=>{Fe();const H=window.setInterval(we,5*6e4),K=()=>{document.visibilityState==="visible"&&we()};return document.addEventListener("visibilitychange",K),()=>{window.clearInterval(H),document.removeEventListener("visibilitychange",K)}},[Fe,we]),C.useEffect(()=>{Z&&Fe()},[Z,Fe]);const fe=(B==null?void 0:B.notice)??null,[Ke,gt]=C.useState(null),[tt,ot]=C.useState(ly);C.useEffect(()=>{let H=!1;return fetch("/api/health").then(K=>K.ok?K.json():null).then(K=>{H||(ot(yz(K)),!(!K||typeof K.workspace!="string")&&gt(K.workspace))}).catch(()=>{}),()=>{H=!0}},[Z]);const Be=C.useRef(tt);Be.current=tt;const Ze=fe?`${fe.kind}:${fe.to}`:"",ut=fe!=null&&pe!==Ze,_t=C.useCallback(()=>{if(!fe)return;const H=pe===Ze?"":Ze;ye(H);try{window.localStorage.setItem(RN,H)}catch{}},[fe,Ze,pe]),[ie,qe]=C.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(AN)??""}catch{return""}}),Oe=B!=null&&B.invokedAs&&B.invokedAs!==Wt?B.invokedAs:null,Te=Oe!=null&&ie!==Oe,ze=C.useCallback(()=>{if(Oe){qe(Oe);try{window.localStorage.setItem(AN,Oe)}catch{}}},[Oe]),He=((al=B==null?void 0:B.upgrade)==null?void 0:al.state)??"idle",Je=Oq(B==null?void 0:B.upgrade),ke=C.useRef(!1),bt=C.useCallback(async()=>{if(Es(ke.current||He==="running")){ke.current=!0;try{await fetch("/api/upgrade",{method:"POST"})}catch{}await Fe(),ke.current=!1}},[He,Fe]);C.useEffect(()=>{if(He!=="running")return;const H=window.setInterval(Fe,3e3);return()=>window.clearInterval(H)},[He,Fe]);const nt=C.useCallback(async()=>{var le;const H=B==null?void 0:B.command;if(!H)return;let K=!1;try{K=await Promise.race([((le=navigator.clipboard)==null?void 0:le.writeText(H).then(()=>!0))??Promise.resolve(!1),new Promise(ce=>window.setTimeout(()=>ce(!1),500))])}catch{K=!1}if(!K)try{const ce=document.createElement("textarea");ce.value=H,ce.setAttribute("readonly",""),ce.style.cssText="position:fixed;top:0;left:0;opacity:0",document.body.appendChild(ce),ce.select(),K=document.execCommand("copy"),ce.remove()}catch{K=!1}K&&(Ue(!0),window.setTimeout(()=>Ue(!1),1600))},[B==null?void 0:B.command]),at=C.useCallback(()=>{O(H=>(H||G(!1),!H))},[]),yn=C.useCallback(()=>{G(H=>(H||O(!1),!H))},[]),[or,un]=C.useState(!1),[wn,xn]=C.useState(0),cn=C.useRef(null),[_i,Cs]=C.useState(!1),ar=C.useRef(null),[bi,Gr]=C.useState(0),Ft=C.useState(()=>lD({protect:H=>wL(i.current,H)}))[0],[_n,js]=C.useState(!1),Fn=C.useCallback(()=>{const H=Ft.paused&&Ft.dropped>0,K=Ft.setPaused(!Ft.paused);H&&xL(i.current);for(const le of K)i.current=m_(i.current,le);js(Ft.paused)},[Ft]),[kt,br]=C.useState(Date.now()),[bn,Yr]=C.useState(()=>{if(typeof window>"u")return!0;try{return window.localStorage.getItem(IN)!=="0"}catch{return!0}}),Ts=C.useCallback(()=>{Yr(H=>{const K=!H;try{window.localStorage.setItem(IN,K?"1":"0")}catch{}return K})},[]),[zn,Kr]=C.useState(!1),[ki,Bn]=C.useState("restart"),[Rs,As]=C.useState(null),lr=C.useRef(!1),Is=C.useRef(null),Ms=C.useRef(0),kr=C.useCallback(async H=>{if(!Es(lr.current))return;const K=(H==null?void 0:H.upgrade)===!0;lr.current=!0,Is.current=Je;const le=++Ms.current;Bn(K?"npx":"restart"),Kr(!0);try{window.sessionStorage.setItem("agent-dag.restartPending",(fe==null?void 0:fe.to)??"")}catch{}try{await fetch("/api/restart",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({upgrade:K})})}catch{}window.setTimeout(()=>{if(Ms.current===le&&lr.current){lr.current=!1,Kr(!1);try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}}},K?18e4:3e4)},[fe==null?void 0:fe.to,Je]),Os=C.useRef(null);C.useEffect(()=>{let H=!1;for(const le of i.current.agents.values())if(le.state==="active"){H=!0;break}const K=Lq({enabled:bn,kind:fe==null?void 0:fe.kind,canRestart:(B==null?void 0:B.canRestart)===!0,busy:H,idleSince:Os.current,now:kt});Os.current=K.idleSince,K.restart&&kr()},[bn,fe==null?void 0:fe.kind,B==null?void 0:B.canRestart,kt,kr]),C.useEffect(()=>{const H=B==null?void 0:B.running;let K=null,le=null;try{K=window.sessionStorage.getItem("agent-dag.restartPending"),le=window.sessionStorage.getItem(MN)}catch{return}const ce=Mq({bundle:"1.45.0",running:H,pending:K,lastTried:le});if(ce==="reload"){try{window.sessionStorage.setItem(MN,H??"")}catch{return}window.location.reload();return}if(ce!=="confirm")return;try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}lr.current=!1,Kr(!1),As(H??null);const Se=window.setTimeout(()=>As(null),6e3);return()=>window.clearTimeout(Se)},[B==null?void 0:B.running]),C.useEffect(()=>{if(zn&&Pq({asked:Is.current,reported:Je})){try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}lr.current=!1,Kr(!1)}},[zn,Je]);const Ps=C.useState(()=>lz(Vz()))[0],Pt=C.useRef(Ps.pinned),st=C.useRef(null),Xr=C.useState(()=>Gz())[0],[Qr,Si]=C.useState(()=>new Set),[kn,Ls]=C.useState(cD),[Sn,Zr]=C.useState(()=>kN(NN)),Vt=C.useMemo(()=>oz(Sn),[Sn]),$s=C.useCallback(H=>iz(H,Vt),[Vt]),dn=C.useMemo(()=>({background:Sn["--panel"],border:`1px solid ${Sn["--line"]}`,borderRadius:8}),[Sn]),[el,wc]=C.useState(!1);C.useEffect(()=>{document.documentElement.dataset.theme=kn;try{window.localStorage.setItem($j,kn)}catch{}Zr(H=>{const K=kN(NN);return az(H,K)?H:K})},[kn]);const Sr=C.useCallback((H,K)=>{if(Ov({durationMs:K,documentHidden:document.hidden})){e.setViewport(H,{duration:K});return}const{d3Zoom:le,d3Selection:ce}=t.getState(),Se=ce==null?void 0:ce.property("__zoom");if(le&&ce&&Se&&Se.k>0&&H.zoom>0){le.transform(ce,Se.scale(H.zoom/Se.k).translate((H.x-Se.x)/H.zoom,(H.y-Se.y)/H.zoom));return}e.setViewport(H,{duration:0})},[e,t]),ur=C.useRef(null);C.useEffect(()=>{if(!Xr)return;const H=window.setTimeout(()=>{try{Sr(Xr,0)}catch{}fn.current=Date.now()},60);return()=>window.clearTimeout(H)},[Sr,Xr]);const qs=C.useRef(!0);C.useEffect(()=>{const H=new EventSource("/events"),K=oD(a,{now:()=>Date.now(),setTimeout:(le,ce)=>window.setTimeout(le,ce),clearTimeout:le=>window.clearTimeout(le)});return H.addEventListener("open",()=>{ne(!0),wc(!0)}),H.addEventListener("error",()=>ne(!1)),H.addEventListener("replay-end",()=>{qs.current=!1,K.flush()}),H.addEventListener("hook",le=>{var ce;try{const Se=JSON.parse(le.data);if(!Ft.accept(Se))return;i.current=m_(i.current,Se);const Ne=Se.replay===!0||qs.current||Date.now()-Se.receivedAt>3e4;Ne?K.replay():K.live();const Le=bz(Se,Ne);Le&&((ce=Y.current)==null||ce.play(Le))}catch{}}),()=>{H.close(),K.cancel()}},[a]),C.useEffect(()=>{const H=setInterval(()=>{const K=Date.now();br(K);let le=_L(i.current,K,p_);bL(i.current,K,p_)&&(le=!0),vL(i.current,K,Oz,Pz)&&(le=!0),yL(i.current,K,Lz,$z)&&(le=!0),c(ce=>Qq(ce,i.current.agents)),p(ce=>ce!=null&&!i.current.agents.has(ce)?null:ce),le&&a()},250);return()=>clearInterval(H)},[a]);const Er=C.useRef(null),fn=C.useRef(0),xc=420,En=C.useCallback((H=500)=>{try{const Ne=document.querySelector(".canvas-wrap"),Le=Array.from(document.querySelectorAll(".react-flow__node")).filter(ht=>ht.offsetWidth>0);if(!Ne||Le.length===0)return;const Ye=Ne.getBoundingClientRect(),ft=e.getViewport();if(!Number.isFinite(ft.zoom)||ft.zoom<=0)return;const it=ht=>(ht-Ye.left-ft.x)/ft.zoom,Xt=ht=>(ht-Ye.top-ft.y)/ft.zoom,Ys=Le.map(ht=>ht.getBoundingClientRect()),Vo=Math.min(...Ys.map(ht=>it(ht.left))),cl=Math.max(...Ys.map(ht=>it(ht.right))),Rr=Math.min(...Ys.map(ht=>Xt(ht.top))),Nc=Math.max(...Ys.map(ht=>Xt(ht.bottom))),dl=cl-Vo,Go=Nc-Rr;if(!(dl>0&&Go>0))return;const ns=Math.max(.2,Math.min(1,(Ye.width-160)/(dl+xc)*.86,(Ye.height-160)/Go*.86)),rs={x:80-Vo*ns,y:Math.max(80,(Ye.height-Go*ns)/2)-Rr*ns,zoom:ns};Sr(rs,H),fn.current=Date.now(),ur.current=Ov({durationMs:H,documentHidden:document.hidden})?{target:rs,until:Date.now()+H+60}:null,window.setTimeout(()=>{var ht;try{((ht=ur.current)==null?void 0:ht.target)===rs&&(ur.current=null);const ss=e.getViewport();(Math.abs(ss.zoom-ns)>.01||Math.abs(ss.x-rs.x)>2)&&Sr(rs,0)}catch{}},H+60)}catch{}},[e,Sr]);C.useEffect(()=>{const H=()=>{if(!document.hidden)return;const K=ur.current;if(ur.current=null,!(!K||Date.now()>K.until)){try{Sr(K.target,0)}catch{}fn.current=Date.now()}};return document.addEventListener("visibilitychange",H),()=>document.removeEventListener("visibilitychange",H)},[Sr]);const Ds=C.useRef(""),Ei=C.useRef(null),Ni=C.useRef(0),cr=C.useCallback(()=>{Ni.current=Date.now()},[]),Io=C.useRef(null),Ci=C.useRef(0),Xe=C.useCallback(()=>{Ci.current=Date.now()},[]),Mo=C.useCallback(H=>({hasSourceEvent:!!H,at:Date.now(),lastDeckFitAt:fn.current,lastCanvasInputAt:Ci.current}),[]),ji="agent-dag.autoFitDisabled",Ti=C.useState(()=>{if(typeof window>"u")return!1;try{return window.localStorage.getItem(ji)==="1"}catch{return!1}})[0],Nr=C.useRef(Ti),[Oo,Po]=C.useState(Ti),Fs=C.useCallback(()=>{if(!Nr.current){Nr.current=!0,Po(!0);try{window.localStorage.setItem(ji,"1")}catch{}}},[]),Ri=C.useCallback(()=>{Nr.current=!1,Po(!1);try{window.localStorage.removeItem(ji)}catch{}En(400)},[e,En]);C.useEffect(()=>{const H=setInterval(()=>{if(Nr.current||Date.now()-Ni.current<800)return;const K=i.current,le=Date.now(),ce=[];for(const Ne of K.agents.values())ay(Ne,le)&&ce.push({id:Ne.id});if(ce.length===0)return;const Se=[];for(const{id:Ne}of ce){const Le=Gt.current.get(Ne),Ye=Pt.current.get(Ne)??Yt.current.get(Ne);!Le||!Ye||Se.push({x:Ye.x,y:Ye.y,width:Le.width,height:Le.height})}fz({pane:Io.current,viewport:e.getViewport(),boxes:Se})&&En(600)},1500);return()=>clearInterval(H)},[e]);const Nn=C.useRef(!1),Gt=C.useRef(new Map),Un=C.useRef(0),zs=C.useCallback(H=>{const K=Gt.current;let le=!1;for(const ce of H.nodeInternals.values()){const Se=ce.width,Ne=ce.height;if(Se==null||Ne==null)continue;const Le=K.get(ce.id);Le?(Math.abs(Le.height-Ne)>4||Math.abs(Le.width-Se)>4)&&(K.set(ce.id,{width:Se,height:Ne}),le=!0):(K.set(ce.id,{width:Se,height:Ne}),le=!0)}return le&&(Un.current+=1),Un.current},[]),Jr=rt(zs),[Hn,_c]=C.useState(0);C.useEffect(()=>{let H=0;const K=()=>{const ce=Gt.current;let Se=!1;for(const Ne of document.querySelectorAll(".react-flow__node[data-id]")){const Le=Ne.getAttribute("data-id");if(!Le)continue;const Ye=Ne.offsetWidth,ft=Ne.offsetHeight;if(!Ye||!ft)continue;const it=ce.get(Le);(!it||Math.abs(it.width-Ye)>4||Math.abs(it.height-ft)>4)&&(ce.set(Le,{width:Ye,height:ft}),Se=!0)}Se&&_c(Ne=>Ne+1)};if(Nn.current)return;let le=0;return document.visibilityState==="hidden"?le=window.setTimeout(K,32):H=requestAnimationFrame(K),()=>{cancelAnimationFrame(H),window.clearTimeout(le)}});const Yt=C.useRef(Ps.positions),Bs=C.useRef(new Set),Lo=C.useRef(""),Cr=C.useMemo(()=>{const H=[];for(const K of i.current.agents.values())ay(K,kt)&&H.push(K.id+(K.parentId?`>${K.parentId}`:""));return H.sort(),`${H.join("|")}#sv${Jr}.${Hn}`},[i.current,i.current.revision,kt,Jr,Hn]),dr=C.useRef(null);C.useEffect(()=>(dr.current!=null&&window.clearTimeout(dr.current),dr.current=window.setTimeout(()=>{Lv(Yt.current,Pt.current)},1500),()=>{dr.current!=null&&window.clearTimeout(dr.current)}),[Cr]),C.useEffect(()=>{if(Ds.current===Cr)return;const H=Ds.current;if(Ds.current=Cr,!H||Nr.current)return;Date.now()-fn.current>1200&&En(400),Er.current&&window.clearTimeout(Er.current),Er.current=window.setTimeout(()=>{Nr.current||En(500)},280)},[Cr,e,En]);const Ai=C.useMemo(()=>eD(i.current,u),[i.current,i.current.revision,u]),$o=C.useMemo(()=>nz(i.current,kt),[i.current,i.current.revision,kt]),es=C.useRef(null),[fr,jr]=C.useState({w:0,h:0});C.useEffect(()=>{const H=es.current;if(!H||typeof ResizeObserver>"u")return;const K=new ResizeObserver(le=>{var Se;const ce=(Se=le[0])==null?void 0:Se.contentRect;ce&&(Io.current={width:ce.width,height:ce.height},jr(Ne=>Math.abs(Ne.w-ce.width)>40||Math.abs(Ne.h-ce.height)>40?{w:ce.width,h:ce.height}:Ne))});return K.observe(H),Io.current={width:H.clientWidth,height:H.clientHeight},jr({w:H.clientWidth,h:H.clientHeight}),()=>K.disconnect()},[]);const Ii=C.useCallback(H=>{var le,ce;const K=H.target;!(K!=null&&K.closest)||K.closest(Iz)!==H.currentTarget||(H.preventDefault(),(ce=(le=document.activeElement)==null?void 0:le.blur)==null||ce.call(le))},[]),bc=C.useRef(new Map),[tl,qo]=C.useState(!1);C.useEffect(()=>{const H=window.setTimeout(()=>qo(!0),2500);return()=>window.clearTimeout(H)},[]);const[Mi,Us]=C.useState(!1),Wn=C.useRef(null),[Cn,Oi]=C.useState(!1),Pi=C.useCallback(()=>{Wn.current&&(window.clearTimeout(Wn.current),Wn.current=null),Us(!1)},[]),nl=C.useCallback(H=>{H.length!==0&&queueMicrotask(()=>{Us(!0),Wn.current&&window.clearTimeout(Wn.current),Wn.current=window.setTimeout(()=>Us(!1),Mz+80)})},[]);C.useEffect(()=>()=>{Wn.current&&window.clearTimeout(Wn.current)},[]);const Hs=fr.w>0?fr.w*.92:0,Ws=fr.h>0?fr.h:0,{nodes:Vn,edges:Kt}=C.useMemo(()=>Xz(i.current,kt,Hs,Ws,Pt.current,Gt.current,bc.current,nl,tl,Cn,Yt.current,Bs.current,Cr,Lo,u,Ai,$o,S),[i.current,i.current.revision,kt,Hs,Ws,tl,Cn,Cr,u,Ai,$o,S,wn]),Tr=C.useMemo(()=>{const H=new Map;for(const le of Vn){const ce=le.data;if(!(ce!=null&&ce.sessionId)||ce.exitAt!=null)continue;const Se=le.width,Ne=le.height;if(Se==null||Ne==null)continue;const Le=le.position.x,Ye=le.position.y,ft=Le+Se,it=Ye+Ne,Xt=H.get(ce.sessionId);Xt?(Xt.minX=Math.min(Xt.minX,Le),Xt.minY=Math.min(Xt.minY,Ye),Xt.maxX=Math.max(Xt.maxX,ft),Xt.maxY=Math.max(Xt.maxY,it)):H.set(ce.sessionId,{minX:Le,minY:Ye,maxX:ft,maxY:it})}const K=[];for(const[le,ce]of H){const Se=ce.maxX-ce.minX+ku*2,Ne=ce.maxY-ce.minY+ku*2;K.push({id:`group:${le}`,type:DT,position:{x:ce.minX-ku,y:ce.minY-ku},data:{sessionId:le,w:Se,h:Ne},width:Se,height:Ne,style:{width:Se,height:Ne},zIndex:-1,draggable:!0,selectable:!1,focusable:!1,deletable:!1,connectable:!1})}return K},[Vn,kt]),Do=C.useMemo(()=>{const H=[...Tr,...Vn],K=ar.current;return!K||K.size===0?H:H.map(le=>{const ce=K.get(le.id);return ce?{...le,position:ce}:le})},[Tr,Vn,bi]),hr=C.useMemo(()=>{const H=new Set;for(const K of i.current.agents.values())for(const le of K.tools)H.add(GT(le.name));return Object.keys(uy).filter(K=>H.has(K))},[i.current,i.current.revision]);C.useEffect(()=>{if(hr.length<=1){Cs(!1);return}let H=0;const K=()=>{const le=cn.current;if(le&&!document.hidden){const ce=le.getBoundingClientRect(),Se=Array.from(document.querySelectorAll(".react-flow__node, .tool-burst")).map(Le=>Le.getBoundingClientRect()),Ne=sz(ce,Se,8);Cs(Le=>Le===Ne?Le:Ne)}H=window.setTimeout(K,300)};return K(),()=>window.clearTimeout(H)},[hr.length]);const kc=C.useCallback(H=>{Si(K=>{const le=new Set(K);return le.has(H)?le.delete(H):le.add(H),le})},[]),Lt=f?i.current.agents.get(f):null,Vs=d?Array.from(i.current.agents.values()).flatMap(H=>H.tools).find(H=>H.id===d)??null:null,ts=C.useCallback(async()=>{try{await fetch("/api/clear",{method:"POST"})}catch{}i.current=Jv(),Pt.current.clear(),Gt.current.clear(),Yt.current.clear(),Lo.current="",PN(),w(),a()},[a,w]),Gs=C.useRef(N);Gs.current=N;const Fo=C.useRef(A);Fo.current=A;const zo=C.useRef(!1);zo.current=Vs!=null||or||b!=null||E!=null||A;const Li=C.useCallback(H=>{const K=$q(H,{confirmOpen:Gs.current,modalOpen:zo.current});K==="confirm"?T(!0):K==="clear"&&(T(!1),ts())},[ts]),Bo=C.useCallback(()=>{Pt.current.clear(),Yt.current.clear(),Lo.current="",PN(),a(),window.setTimeout(()=>En(500),80)},[a,e,En]),$i=C.useCallback(()=>En(500),[En]),qi=C.useRef(Vn);qi.current=Vn;const rl=C.useRef(f);rl.current=f;const Uo=C.useCallback(H=>{const K=qi.current,le=Vq(K.map(Ne=>({id:Ne.id,x:Ne.position.x,y:Ne.position.y})),rl.current,H),ce=le?K.find(Ne=>Ne.id===le):void 0;if(!ce)return;const Se=CN(document.activeElement);y(ce.id,!1),window.setTimeout(()=>{try{e.fitView({padding:.35,duration:350,nodes:[ce]})}catch{}fn.current=Date.now(),Se&&Az(ce.id)},30)},[y,e]),sl=C.useCallback(H=>{y(H,!1),window.setTimeout(()=>{try{const K=qi.current.find(le=>le.id===H);K&&e.fitView({padding:.3,duration:500,nodes:[K]}),fn.current=Date.now()}catch{}},60)},[y,e]);C.useEffect(()=>{const H=K=>{var Ye,ft;const le=K.target,ce={tagName:le==null?void 0:le.tagName,isContentEditable:le==null?void 0:le.isContentEditable,role:(Ye=le==null?void 0:le.getAttribute)==null?void 0:Ye.call(le,"role"),type:le==null?void 0:le.type};if(K.key==="Escape"){const it=UL({overlayOpen:yo.depth()>0,panelOnTop:yo.topIsPanel(),typing:My(ce)});it==="dismiss"?yo.dismissTop():it==="blur"?le==null||le.blur():(Xq(ce)&&(le==null||le.blur()),w());return}if(Iy(K))return;const Se=CN(le)?(ft=le==null?void 0:le.getAttribute)==null?void 0:ft.call(le,"data-id"):null,Ne=Se&&qi.current.some(it=>it.id===Se)?Se:null,Le=Yq(K,Ne);if(Le.kind==="activate"){K.preventDefault(),y(Le.nodeId,Le.additive);return}Le.kind!=="node"&&(Le.nodeId==null&&QL(ce)||ZL({key:K.key,modalOpen:zo.current,sheetOpen:Fo.current})||(K.key===" "&&(K.preventDefault(),Fn()),(K.key==="c"||K.key==="C")&&Li("shortcut"),(K.key==="r"||K.key==="R")&&Bo(),(K.key==="f"||K.key==="F")&&$i(),(K.key==="l"||K.key==="L")&&at(),(K.key==="h"||K.key==="H")&&un(it=>!it),(K.key==="u"||K.key==="U")&&Q(it=>!it),(K.key==="a"||K.key==="A")&&Be.current.claude&&yn(),(K.key==="j"||K.key==="J")&&Uo(1),(K.key==="k"||K.key==="K")&&Uo(-1),(K.key==="t"||K.key==="T")&&Ls(it=>it==="dark"?"light":"dark"),(K.key==="m"||K.key==="M")&&Be.current.claude&&I.current!==null&&W.current(K.shiftKey),K.key==="?"&&L(it=>!it)))};return window.addEventListener("keydown",H),()=>window.removeEventListener("keydown",H)},[Li,Bo,$i,w,y,Uo,Fn]);const Ho=i.current.agents.size,jn=C.useMemo(()=>u3(i.current.agents.values()),[i.current,i.current.revision]),il=C.useMemo(()=>c3(i.current.agents.values()),[i.current,i.current.revision]),ol=C.useRef(null);C.useEffect(()=>{const H=dD({waiting:jn.length,running:il}),K=ol.current;if(ol.current=H,(K==null?void 0:K.title)!==H.title&&(document.title=H.title),(K==null?void 0:K.icon)!==H.icon){const le=document.querySelector('link[rel="icon"]');le&&(le.href=fD[H.icon])}},[jn.length,il]);const[Sc,Ec]=C.useState(""),Di=pD(jn);C.useEffect(()=>{Ec(H=>mD(H,Di))},[Di]);const Jt=C.useMemo(()=>Nj(i.current.agents.values()),[i.current,i.current.revision]);return m.jsxs("div",{className:"app",children:[m.jsx("a",{className:"skip-link",href:"#canvas",children:"Skip to the canvas"}),m.jsxs("header",{className:"topbar",children:[m.jsxs("div",{className:"readout",children:[m.jsxs("div",{className:"brand",children:[m.jsx("span",{className:"logo"}),m.jsx("h1",{children:Wt}),fe?m.jsxs("button",{type:"button",className:"v stale",onClick:_t,"aria-label":gz({...fe,open:ut}),title:fe.kind==="restart"?`Running v${fe.from}; v${fe.to} is installed on disk. Restart to pick it up.`:`Running v${fe.from}; v${fe.to} is on npm.`,children:["v",fe.from,m.jsx("span",{className:"v-dot","aria-hidden":!0})]}):(()=>{const H={running:(B==null?void 0:B.running)??"1.45.0",latest:B==null?void 0:B.latest,latestPending:B==null?void 0:B.latestPending,checkedAgo:B!=null&&B.checkedAt?ry(kt-B.checkedAt):null,checkDisabled:B==null?void 0:B.checkDisabled,checking:Me};return m.jsxs("button",{type:"button",className:Me?"v checking":"v",onClick:()=>Fe(!0),"aria-busy":Me||void 0,"aria-label":mz(H),title:pz(H),children:["v",H.running]})})()]}),m.jsxs("span",{className:"status",children:[(()=>{const H=Tz({connected:Z,paused:_n,held:Ft.size,dropped:Ft.dropped});return m.jsx("span",{className:`pill ${H.tone}`,title:H.title,children:m.jsxs("span",{className:"pill-box",children:[m.jsx("span",{className:"pill-widest","aria-hidden":!0,children:H.widest}),m.jsx("span",{className:"pill-label",children:H.label})]})})})(),m.jsx(P3,{usageOpen:V}),Jt.sum>0&&m.jsxs("span",{className:"stat",title:`in:${Jt.inputTokens.toLocaleString()} out:${Jt.outputTokens.toLocaleString()} cache-r:${Jt.cacheReadTokens.toLocaleString()} cache-c:${Jt.cacheCreateTokens.toLocaleString()}
80
-
81
- ${Bu}`,children:[m.jsx("span",{className:"count",children:Rt(Jt.sum)}),m.jsx("span",{className:"lbl",children:i3})]}),Jt.cost.total>0&&(()=>{let H=0,K=0;for(const Se of i.current.agents.values()){if(Se.state!=="active")continue;const Ne=gn(Se);H+=Ne.total,K=Math.max(K,((Se.endedAt??kt)-Se.startedAt)/1e3)}const le=K>0?Fu(H,K):null,ce=`input ${Ge(Jt.cost.input)} + output ${Ge(Jt.cost.output)} + cache r ${Ge(Jt.cost.cacheRead)} + cache w ${Ge(Jt.cost.cacheWrite)}${le?`
82
- active burn: ${le}`:""}
83
-
84
- ${Bu}`;return m.jsxs("span",{className:"stat",title:ce,children:[m.jsx("span",{className:"count",children:Ge(Jt.cost.total)}),m.jsxs("span",{className:"lbl",children:[o3,le?` · ${le}`:""]})]})})()]}),m.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:Sc}),jn.length>0&&m.jsxs("button",{type:"button",className:"waiting-stat",onClick:()=>sl(jn[0].id),title:`Blocked waiting for you — click to go to the one that has been stuck longest:
85
- ${jn.map(H=>` ${H.label}: ${ec(H.waiting)} (${ry(kt-H.waiting.since)})`).join(`
86
- `)}`,"aria-label":`${jn.length} session${jn.length===1?"":"s"} waiting for you`,children:[m.jsx("span",{className:"ap-pulse","aria-hidden":!0}),m.jsx("b",{children:jn.length})," waiting"]})]}),Lt&&(()=>{const H=gn(Lt),K=Math.max(0,((Lt.endedAt??kt)-Lt.startedAt)/1e3),le=Lt.state==="active"?Fu(H.total,K):null,ce=u.size-1;return m.jsxs("button",{type:"button",className:"selected-ribbon",title:`Fit view to ${Lt.label}`,onClick:()=>{try{const Se=Vn.find(Ne=>Ne.id===Lt.id);Se&&e.fitView({padding:.35,duration:500,nodes:[Se]}),fn.current=Date.now()}catch{}},children:[m.jsx("span",{className:`state-pill state-${Lt.state}`,children:Lt.state==="active"?"live":Lt.state}),m.jsx("span",{className:"selected-label",children:Lt.label}),H.total>0&&m.jsxs("span",{className:"selected-cost",children:[Ge(H.total),le?m.jsxs("span",{className:"selected-rate",children:[" · ",le]}):null]}),ce>0&&m.jsxs("span",{className:"selected-extra",children:["+",ce]}),m.jsx("span",{"aria-hidden":!0,className:"selected-close",onClick:Se=>{Se.stopPropagation(),w()},children:"×"})]})})(),m.jsxs("div",{className:"actions",children:[m.jsxs("div",{className:"action-run",children:[m.jsx("button",{className:"btn icon-btn",onClick:()=>Q(H=>!H),title:`${V?"Hide":"Show"} usage panel (U)`,"aria-label":"Toggle usage panel","aria-expanded":V,"aria-controls":V?"usage-panel":void 0,children:"$"}),tt.claude&&m.jsx("button",{className:"btn icon-btn",onClick:yn,title:`${j?"Hide":"Show"} accounts (A)`,"aria-label":"Toggle accounts panel","aria-expanded":j,"aria-controls":j?"accounts-panel":void 0,children:m.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:[m.jsx("circle",{cx:"7",cy:"4.6",r:"2.4"}),m.jsx("path",{d:"M2.4 12c0-2.3 2.1-3.7 4.6-3.7s4.6 1.4 4.6 3.7"})]})}),m.jsx("button",{className:"btn icon-btn",onClick:()=>un(H=>!H),title:"Usage history — ccusage (H)","aria-label":"Open usage history","aria-haspopup":"dialog",children:m.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round","aria-hidden":!0,children:[m.jsx("line",{x1:"3",y1:"11.5",x2:"3",y2:"7"}),m.jsx("line",{x1:"7",y1:"11.5",x2:"7",y2:"3"}),m.jsx("line",{x1:"11",y1:"11.5",x2:"11",y2:"8.5"})]})})]}),m.jsxs("div",{className:"action-run",children:[tt.claude&&z!==null&&m.jsx("button",{className:"btn icon-btn",onClick:H=>$(H.shiftKey),...zr(!1),title:kD(tt,{on:z===!0,locked:ue==="locked"}),"aria-label":"Toggle Claude Code finish sound","aria-pressed":z,children:m.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:[m.jsx("path",{d:"M3.2 5.2h2L7.8 3v8L5.2 8.8h-2z"}),z?m.jsxs(m.Fragment,{children:[m.jsx("path",{d:"M9.8 5.4a2.4 2.4 0 0 1 0 3.2"}),m.jsx("path",{d:"M11.3 3.9a4.6 4.6 0 0 1 0 6.2"})]}):m.jsxs(m.Fragment,{children:[m.jsx("path",{d:"M10 5.6l2.6 2.8"}),m.jsx("path",{d:"M12.6 5.6L10 8.4"})]})]})}),m.jsx("button",{className:"btn icon-btn",onClick:()=>Ls(H=>H==="dark"?"light":"dark"),title:`Switch to ${kn==="dark"?"light":"dark"} mode (T)`,"aria-label":"Toggle theme",children:kn==="dark"?"☀":"☾"})]})]})]}),Rs?m.jsxs("div",{className:"ver-banner done",role:"status",children:[m.jsx("span",{className:"ver-dot"}),m.jsxs("strong",{children:["Restarted — now running v",Rs,"."]}),m.jsx("span",{className:"ver-sub",children:"The canvas replayed from the event log."})]}):el&&!Z?m.jsxs("div",{className:"conn-banner",role:"alert",children:[m.jsx("span",{className:"conn-dot"}),zn?ki==="npx"?"Fetching the new version with npx — this can take a minute…":`Restarting ${Wt}…`:(()=>{const H=Cz({connected:Z,paused:_n});return m.jsxs(m.Fragment,{children:[`Lost connection to the ${Wt} server. Reconnecting…`,H&&m.jsx("span",{className:"conn-sub",children:H})]})})()]}):ut&&fe?m.jsxs("div",{className:`ver-banner ${fe.kind}`,role:"status",children:[m.jsx("span",{className:"ver-dot"}),fe.kind==="restart"?m.jsxs(m.Fragment,{children:[m.jsxs("strong",{children:["v",fe.to," is installed — this deck still runs v",fe.from,"."]}),B!=null&&B.canRestart?m.jsxs(m.Fragment,{children:[m.jsx("button",{type:"button",className:"ver-act",onClick:()=>kr(),...zr(zn),title:"Stop this process and bring it back on the same port. The canvas replays from the event log.",children:zn?"restarting…":"Restart now"}),m.jsxs("button",{type:"button",className:`ver-auto${bn?" on":""}`,role:"switch","aria-checked":bn,onClick:Ts,title:bn?"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:[m.jsx("i",{"aria-hidden":!0}),"auto when idle"]})]}):m.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."})]}):m.jsxs(m.Fragment,{children:[m.jsxs("strong",{children:[Wt," v",fe.to," is out — you are on v",fe.from,"."]}),(B==null?void 0:B.upgradeMode)==="install"&&He!=="failed"&&m.jsx("button",{type:"button",className:"ver-act",onClick:bt,...zr(He==="running",He==="done"),title:`Runs ${((ll=B==null?void 0:B.upgrade)==null?void 0:ll.command)??(B==null?void 0:B.command)??"npm i -g"} here, then restarts once nothing is running.`,children:He==="running"?"installing…":He==="done"?"installed":"Update now"}),(B==null?void 0:B.upgradeMode)==="npx"&&(B==null?void 0:B.canRestart)&&m.jsx("button",{type:"button",className:"ver-act",onClick:()=>kr({upgrade:!0}),...zr(zn),title:`Runs ${B==null?void 0:B.command} and hands it this port. Nothing is installed globally — npx unpacks its own copy.`,children:zn?"fetching…":He==="failed"?"Retry update":"Update & restart"}),He==="failed"?m.jsxs("span",{className:"ver-sub fail",title:((Wo=B==null?void 0:B.upgrade)==null?void 0:Wo.error)??"",children:[(B==null?void 0:B.upgradeMode)==="npx"?"update failed":"install failed",": ",((ul=B==null?void 0:B.upgrade)==null?void 0:ul.error)??"unknown error"," — run it yourself:"]}):(B==null?void 0:B.upgradeMode)==="npx"?m.jsx("span",{className:"ver-sub",children:B!=null&&B.canRestart?"npx cannot upgrade in place, so the deck re-runs:":Pv.npx}):B!=null&&B.upgradeBlocked?m.jsx("span",{className:"ver-sub",children:Object.hasOwn(Pv,B.upgradeBlocked)?Pv[B.upgradeBlocked]:"cannot install from here"}):null,m.jsxs("button",{type:"button",className:"ver-cmd",onClick:nt,title:"Copy to clipboard",children:[m.jsx("code",{children:B==null?void 0:B.command}),m.jsx("span",{className:"ver-cmd-hint",children:Pe?"copied":"copy"})]})]}),m.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:_t,children:"×"})]}):Te&&Oe?m.jsxs("div",{className:"ver-banner",role:"status",children:[m.jsx("span",{className:"ver-dot"}),m.jsxs("strong",{children:[Oe," still works — the deck is called ",Wt," now."]}),B!=null&&B.renameFix?m.jsx("span",{className:"ver-sub",children:B.renameFix}):null,m.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:ze,children:"×"})]}):null,V&&m.jsx(S3,{state:i.current,now:kt,providers:tt,onClose:()=>Q(!1)}),j&&tt.claude&&m.jsx(Rq,{onClose:()=>G(!1)}),U&&m.jsx(f3,{state:i.current,now:kt,selectedIds:u,onSelect:sl,onClose:()=>O(!1)}),m.jsxs("main",{id:"canvas",tabIndex:-1,className:`canvas-wrap${Mi?" bubbling":""}${Cn?" dragging-any":""}`,ref:es,onMouseDownCapture:Ii,onPointerDownCapture:Xe,onPointerUpCapture:Xe,onWheelCapture:Xe,children:[Ho===0&&m.jsx(Jz,{live:Z,everConnected:el,providers:tt}),hr.length>1&&m.jsx("div",{ref:cn,className:`cat-filter-bar${_i?" occluded":""}`,role:"group","aria-label":"Filter tools by category",children:hr.map(H=>{const K=Qr.has(H);return m.jsxs("button",{type:"button",className:`cat-filter${K?" off":""}`,onClick:()=>kc(H),"aria-pressed":!K,title:`${K?"Show":"Hide"} ${cy[H]} tools`,children:[m.jsx("span",{className:"cat-emoji",children:uy[H]}),m.jsx("span",{className:"cat-name",children:cy[H]})]},H)})}),m.jsxs(ej,{nodes:Do,edges:Kt,nodeTypes:Rz,fitView:!Xr,fitViewOptions:{padding:.25,duration:Ov({durationMs:jN,documentHidden:document.hidden})?jN:0},minZoom:.2,maxZoom:1.6,panOnScroll:!0,nodesDraggable:!0,nodesConnectable:!1,selectionOnDrag:!1,nodeDragThreshold:5,onNodeClick:(H,K)=>{if(K.type==="sessionGroup"){w();return}y(K.id,H.shiftKey)},onPaneClick:()=>w(),onMoveStart:H=>{SN(Mo(H))&&Fs()},onMove:(H,K)=>{cr(),SN(Mo(H))&&Fs(),Ei.current&&window.clearTimeout(Ei.current),Ei.current=window.setTimeout(()=>Yz(K),250)},onNodeDragStart:(H,K)=>{var le;if(Pi(),Nn.current=!0,ar.current=new Map,Oi(!0),cr(),Fs(),K.type==="sessionGroup"){const ce=(le=K.data)==null?void 0:le.sessionId,Se=new Map;if(ce)for(const Ne of Vn){const Le=Ne.data;(Le==null?void 0:Le.sessionId)===ce&&Se.set(Ne.id,{x:Ne.position.x,y:Ne.position.y})}st.current={start:{x:K.position.x,y:K.position.y},members:Se};return}Pt.current.set(K.id,{x:K.position.x,y:K.position.y})},onNodeDrag:(H,K)=>{var le;if(cr(),K.type==="sessionGroup"){const ce=st.current;if(!ce)return;const Se=K.position.x-ce.start.x,Ne=K.position.y-ce.start.y;for(const[Ye,ft]of ce.members){const it={x:ft.x+Se,y:ft.y+Ne};Pt.current.set(Ye,it),Yt.current.set(Ye,it)}const Le=ar.current;if(Le){for(const[Ye,ft]of ce.members)Le.set(Ye,{x:ft.x+Se,y:ft.y+Ne});Le.set(K.id,{x:K.position.x,y:K.position.y})}Gr(Ye=>Ye+1);return}Pt.current.set(K.id,{x:K.position.x,y:K.position.y}),Yt.current.set(K.id,{x:K.position.x,y:K.position.y}),(le=ar.current)==null||le.set(K.id,{x:K.position.x,y:K.position.y}),Gr(ce=>ce+1)},onNodeDragStop:(H,K)=>{if(cr(),Nn.current=!1,ar.current=null,Oi(!1),xn(le=>le+1),K.type==="sessionGroup"){const le=st.current;if(le){const ce=K.position.x-le.start.x,Se=K.position.y-le.start.y;for(const[Ne,Le]of le.members){const Ye={x:Le.x+ce,y:Le.y+Se};Pt.current.set(Ne,Ye),Yt.current.set(Ne,Ye)}}st.current=null,Lv(Yt.current,Pt.current),xn(ce=>ce+1);return}Pt.current.set(K.id,{x:K.position.x,y:K.position.y}),Yt.current.set(K.id,{x:K.position.x,y:K.position.y}),Lv(Yt.current,Pt.current)},children:[m.jsx(rL,{gap:28,size:1,color:Sn["--grid-line"]}),m.jsx(x$,{}),m.jsx(t3,{agents:i.current.agents,visibleAgentIds:$o,positions:Yt.current,pinned:Pt.current,measured:Gt.current,spotlight:Ai,hiddenCategories:Qr,now:kt,onOpenTool:g}),m.jsxs(QP,{showInteractive:!1,children:[m.jsx(yr,{onClick:Ri,title:Oo?"Recenter view + re-enable autofit":"Recenter view (autofit already on)","aria-label":"Recenter view",style:Oo?{color:"var(--accent)"}:void 0,children:m.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[m.jsx("circle",{cx:"12",cy:"12",r:"3.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),m.jsx("path",{d:"M12 2v4M12 18v4M2 12h4M18 12h4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})]})}),m.jsx(yr,{onClick:Fn,title:Nz({paused:_n,held:Ft.size,dropped:Ft.dropped}),"aria-label":Ez,"aria-pressed":_n,children:m.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:m.jsx("path",{d:"M9 5.5v13M15 5.5v13",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})})}),m.jsx(yr,{onClick:Bo,title:"Auto-arrange — clear pins (R)","aria-label":"Re-arrange the canvas",children:m.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[m.jsx("rect",{x:"8.5",y:"2",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),m.jsx("rect",{x:"1.5",y:"17",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),m.jsx("rect",{x:"15.5",y:"17",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),m.jsx("path",{d:"M12 7v6.5M5 17v-3.5h14V17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]})}),m.jsx(yr,{onClick:()=>Li("button"),title:"Clear the canvas and the server's event log — asks first (C)","aria-label":"Clear the canvas",children:m.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[m.jsx("path",{d:"M4 6.2h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"}),m.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"}),m.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"}),m.jsx("path",{d:"M10.3 10.6v6.8M13.7 10.6v6.8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})]})}),m.jsx(yr,{onClick:()=>L(H=>!H),title:"Keyboard shortcuts (?)","aria-label":"Open the keyboard shortcuts","aria-haspopup":"dialog",children:m.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[m.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"}),m.jsx("path",{d:"M12 18.4v.2",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",fill:"none"})]})})]}),m.jsx(HP,{zoomable:!0,pannable:!0,nodeColor:$s,nodeStrokeWidth:2,maskColor:Sn["--minimap-mask"],style:dn})]})]}),M?m.jsxs("aside",{className:"detail","aria-label":"Detail",children:[m.jsx("button",{type:"button",className:"glyph-btn detail-close",title:"Close panel","aria-label":"Close detail panel",onClick:()=>q(!1),children:"×"}),Lt?m.jsx(n6,{agent:Lt,now:kt,onOpenTool:g,onShowSummary:H=>{P.has(H)&&(P.delete(H),ON(P)),_(H)},onExportSession:H=>Kz(i.current,H)}):m.jsx(t6,{count:Ho,workspace:Ke})]}):m.jsx("button",{type:"button",className:"detail-reopen",title:"Show detail panel","aria-label":"Show detail panel",onClick:()=>q(!0),children:"‹"}),Vs&&m.jsx(d$,{tool:Vs,onClose:()=>g(null)}),or&&m.jsx(jD,{providers:tt,onClose:()=>un(!1)}),b&&(()=>{const H=i.current.agents.get(b);return H?m.jsx(s$,{agent:H,onClose:()=>k(null)}):null})(),E&&m.jsx(a3,{state:i.current,sessionId:E,onClose:()=>{P.add(E),ON(P),_(null)}}),A&&m.jsx(Hq,{onClose:()=>L(!1)}),N&&m.jsx(zq,{agentCount:Ho,onConfirm:()=>Li("confirmation"),onCancel:()=>T(!1)})]})}function Jz({live:e,everConnected:t,providers:r}){const i=!e;return m.jsxs("div",{className:"empty-hero",children:[m.jsxs("div",{className:"orbit-stack","aria-hidden":!0,children:[m.jsx("div",{className:"core"}),m.jsxs("div",{className:"orbit r1",children:[m.jsx("span",{className:"dot"}),m.jsx("span",{className:"dot b"})]}),m.jsxs("div",{className:"orbit r2",children:[m.jsx("span",{className:"dot"}),m.jsx("span",{className:"dot b"})]}),m.jsxs("div",{className:"orbit r3",children:[m.jsx("span",{className:"dot"}),m.jsx("span",{className:"dot b"})]})]}),i?m.jsxs(m.Fragment,{children:[m.jsx("h2",{children:t?"Disconnected from server":"Server unreachable"}),m.jsxs("p",{children:["The browser cannot reach ",m.jsx("code",{children:"/events"}),". Check that",m.jsx("code",{children:Wt})," is still running in your terminal, then this page will resume automatically."]})]}):e6(r)]})}function e6(e){return m.jsxs(m.Fragment,{children:[m.jsx("h2",{children:"Waiting for Claude Code or Codex"}),m.jsxs("p",{children:["Run ",m.jsx("code",{children:"claude"})," or ",m.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."]}),m.jsxs("p",{className:"hint-row",children:["Not seeing anything? Make sure ",m.jsx("code",{children:Wt})," is running."]}),bD(e).map(t=>m.jsx("p",{className:"hint-row",children:t.spans.map((r,i)=>r.code?m.jsx("code",{children:r.text},i):m.jsx("span",{children:r.text},i))},t.provider))]})}function t6({count:e,workspace:t}){const r=vz(t);return m.jsxs(m.Fragment,{children:[m.jsx("h2",{children:"Detail"}),e===0?m.jsxs("div",{className:"hint",children:[r.lead,r.workspace!==null&&m.jsxs(m.Fragment,{children:[" ",m.jsx("code",{children:r.workspace}),r.tail]})]}):m.jsx("div",{className:"empty",children:"Click an agent to see its tools."}),m.jsx("h3",{style:{marginTop:4},children:"Shortcuts"}),m.jsxs("div",{className:"shortcuts",children:[m.jsxs("div",{className:"sc",children:[m.jsx("kbd",{children:"?"}),m.jsx("span",{children:"all shortcuts"})]}),m.jsxs("div",{className:"sc",children:[m.jsx("kbd",{children:"drag"}),m.jsx("span",{children:"move a node"})]}),m.jsxs("div",{className:"sc",children:[m.jsx("kbd",{children:"tab"}),m.jsx("span",{children:"reach the cards"})]}),m.jsxs("div",{className:"sc",children:[m.jsx("kbd",{children:"enter"}),m.jsx("span",{children:"select the focused card"})]}),m.jsxs("div",{className:"sc",children:[m.jsx("kbd",{children:"space"}),m.jsx("span",{children:"pause / resume"})]}),m.jsxs("div",{className:"sc",children:[m.jsx("kbd",{children:"J"}),m.jsx("span",{children:"next agent"})]}),m.jsxs("div",{className:"sc",children:[m.jsx("kbd",{children:"K"}),m.jsx("span",{children:"previous agent"})]}),m.jsxs("div",{className:"sc",children:[m.jsx("kbd",{children:"R"}),m.jsx("span",{children:"re-arrange"})]}),m.jsxs("div",{className:"sc",children:[m.jsx("kbd",{children:"F"}),m.jsx("span",{children:"fit view"})]}),m.jsxs("div",{className:"sc",children:[m.jsx("kbd",{children:"L"}),m.jsx("span",{children:"session list"})]}),m.jsxs("div",{className:"sc",children:[m.jsx("kbd",{children:"H"}),m.jsx("span",{children:"usage history"})]}),m.jsxs("div",{className:"sc",children:[m.jsx("kbd",{children:"U"}),m.jsx("span",{children:"usage panel"})]}),m.jsxs("div",{className:"sc",children:[m.jsx("kbd",{children:"C"}),m.jsx("span",{children:"clear canvas"})]}),m.jsxs("div",{className:"sc",children:[m.jsx("kbd",{children:"T"}),m.jsx("span",{children:"toggle theme"})]}),m.jsxs("div",{className:"sc",children:[m.jsx("kbd",{children:"Esc"}),m.jsx("span",{children:"deselect, release focus"})]})]})]})}function n6({agent:e,now:t,onOpenTool:r,onShowSummary:i,onExportSession:o}){const a=zu(e.startedAt,e.endedAt,t),u=gn(e),c=u.total>0,f=e.usage.inputTokens+e.usage.outputTokens,p=new Map;for(const E of e.tools){const _=GT(E.name);p.set(_,(p.get(_)??0)+1)}const d=e.tools.filter(E=>E.ok===!1).length,g=e.tools.filter(E=>!E.endedAt).length,y=Array.from(p.entries()).sort((E,_)=>_[1]-E[1]),w=p.has("mcp")?X$(e.tools.map(E=>E.name)):null;return m.jsxs(m.Fragment,{children:[m.jsxs("header",{className:"detail-hero",children:[m.jsxs("div",{className:"hero-line",children:[m.jsx("span",{className:`state-pill state-${e.state}`,children:e.state==="active"?"live":e.state}),m.jsx("h2",{className:"hero-title",title:e.cwd??e.label,children:e.label})]}),m.jsxs("div",{className:"hero-meta",children:[m.jsx("span",{className:"hero-meta-item",children:e.kind}),m.jsx("span",{className:"hero-sep",children:"·"}),m.jsx("span",{className:"hero-meta-item",title:`started ${new Date(e.startedAt).toLocaleString()}`,children:a}),e.model&&(()=>{const E=mj(e);return m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"hero-sep",children:"·"}),m.jsxs("span",{className:"model-chip",title:E.length>0?`${e.model}
87
- spend on this panel also covers:
88
- ${E.join(`
89
- `)}`:e.model,children:[mi(e.model),E.length>0?` +${E.length}`:""]})]})})()]}),c&&m.jsxs("div",{className:"hero-cost",children:[m.jsxs("div",{className:"hero-cost-headline",children:[m.jsx("span",{className:"hero-cost-value",children:Ge(u.total)}),m.jsx("span",{className:"hero-cost-label",children:"spend"})]}),m.jsx(Ly,{cost:u})]}),m.jsxs("div",{className:"hero-actions",children:[e.kind==="root"&&e.state==="done"&&i&&m.jsx("button",{type:"button",className:"btn hero-action-btn",onClick:()=>i(e.sessionId),title:"Reopen the end-of-session recap modal",children:"Show recap"}),o&&m.jsx("button",{type:"button",className:"btn hero-action-btn",onClick:()=>o(e.sessionId),title:"Download this session as JSON",children:"Export JSON"})]})]}),e.tools.length>0&&m.jsxs("section",{className:"detail-section",children:[m.jsx("h3",{children:"Activity"}),m.jsxs("div",{className:"activity-row",children:[m.jsxs("div",{className:"activity-counters",children:[m.jsxs("span",{className:"ac-item",children:[m.jsx("b",{children:e.toolCount})," calls"]}),g>0&&m.jsxs("span",{className:"ac-item ac-live",children:[m.jsx("b",{children:g})," live"]}),d>0&&m.jsxs("span",{className:"ac-item ac-err",children:[m.jsx("b",{children:d})," err"]})]}),m.jsx("div",{className:"cat-strip",children:y.map(([E,_])=>{const b=E==="mcp"?w:null,k=b==null?void 0:b.hue,S=`${_} ${cy[E]} call${_===1?"":"s"}`;return m.jsxs("span",{className:`cat-chip cat-${E}${k!=null?" mcp-hue":""}`,style:k!=null?{"--mcp-hue":k}:void 0,title:b?`${S}, all to ${b.label}`:S,children:[m.jsx("span",{className:"cat-emoji",children:uy[E]}),m.jsx("span",{className:"cat-count",children:_}),b&&m.jsx("span",{className:"cat-server",children:b.label})]},E)})})]})]}),f>0&&m.jsxs("section",{className:"detail-section",children:[m.jsx("h3",{children:"Tokens"}),m.jsxs("div",{className:"tokens-grid",children:[m.jsxs("div",{children:[m.jsx("span",{className:"k",children:"in"}),m.jsx("b",{children:e.usage.inputTokens.toLocaleString()})]}),m.jsxs("div",{children:[m.jsx("span",{className:"k",children:"out"}),m.jsx("b",{children:e.usage.outputTokens.toLocaleString()})]}),m.jsxs("div",{children:[m.jsx("span",{className:"k",children:"cache r"}),m.jsx("b",{children:e.usage.cacheReadTokens.toLocaleString()})]}),m.jsxs("div",{children:[m.jsx("span",{className:"k",children:"cache c"}),m.jsx("b",{children:e.usage.cacheCreateTokens.toLocaleString()})]})]})]}),m.jsxs("section",{className:"detail-section",children:[m.jsx("h3",{children:"Identity"}),m.jsxs("div",{children:[e.cwd&&m.jsxs("div",{className:"row",children:[m.jsx("span",{className:"k",children:"cwd"}),m.jsx("span",{className:"v",title:e.cwd,children:e.cwd})]}),m.jsxs("div",{className:"row",children:[m.jsx("span",{className:"k",children:"session"}),m.jsxs("span",{className:"v",children:[e.sessionId.slice(0,12),"…"]})]}),e.parentId&&m.jsxs("div",{className:"row",children:[m.jsx("span",{className:"k",children:"parent"}),m.jsxs("span",{className:"v",children:[e.parentId.slice(0,12),"…"]})]})]})]}),e.prompts.length>0&&m.jsxs("section",{className:"detail-section",children:[m.jsxs("h3",{children:["Prompts ",m.jsx("span",{className:"section-count",children:e.prompts.length})]}),m.jsx("div",{className:"prompts",children:e.prompts.slice().reverse().map((E,_)=>{const b=p3(E.at,t);return m.jsxs("div",{className:"prompt-entry",children:[m.jsx("div",{className:"prompt-time",title:b.title,children:b.label}),m.jsx("div",{className:"prompt-text",children:E.text})]},_)})})]}),m.jsxs("section",{className:"detail-section",children:[m.jsxs("h3",{children:["Tool calls ",m.jsx("span",{className:"section-count",children:e.tools.length})]}),e.tools.length===0&&m.jsx("div",{className:"empty",children:"No tool calls yet."}),m.jsx("div",{children:e.tools.slice().reverse().map(E=>m.jsx(s6,{t:E,onClick:()=>r(E.id)},E.id))})]})]})}const r6={inflight:"in-flight",done:"done",err:"error"};function s6({t:e,onClick:t}){const r=e.endedAt==null?"inflight":e.ok===!1?"err":"done",i=gj(e,"…");return m.jsxs("button",{className:"tool clickable",title:e.inputPreview||e.name,onClick:t,children:[m.jsxs("span",{className:"name",children:[m.jsx("span",{className:`status-dot ${r}`,"aria-hidden":!0}),m.jsx("span",{className:"vis-hidden",children:r6[r]}),e.name]}),m.jsx("span",{style:{color:"var(--muted)"},children:i})]})}try{C3(window.localStorage)}catch{}const i6=tA.createRoot(document.getElementById("root"));i6.render(m.jsx(Qz,{}));